From 075286b2bbf265a64223148f689d5fb930156cea Mon Sep 17 00:00:00 2001 From: Paul Maskelyne Date: Fri, 29 Dec 2023 20:40:58 +0000 Subject: [PATCH] closes #60 --- CHANGELOG.md | 1 + .../release_notes__auV5NLfnrA5zUr9q.json | 2 +- system/src/sheets/FalloutActorSheet.mjs | 39 ++++++++-------- system/templates/actor/parts/actor-skills.hbs | 45 ++++++++++--------- 4 files changed, 47 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ab5d7b6..18994c92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ ### Bugfixes - [#34] Weapon Qualities and Damage Effects should be displayed in (localised) alphabetical order on Weapon item sheet - [#51] Item quantity boxes polluting actor data when altered +- [#60] Use localized skill names to sort and display alphabetically on Character sheet ### Chores - [#33] Merged Polish language updates from Crowdin diff --git a/data/packs/system-documentation.db/release_notes__auV5NLfnrA5zUr9q.json b/data/packs/system-documentation.db/release_notes__auV5NLfnrA5zUr9q.json index e09206ce..2db5da81 100644 --- a/data/packs/system-documentation.db/release_notes__auV5NLfnrA5zUr9q.json +++ b/data/packs/system-documentation.db/release_notes__auV5NLfnrA5zUr9q.json @@ -8,7 +8,7 @@ "system": { }, "text": { - "content": "

v11.3.0

\n\n

Enhancements

\n\n\n\n

Bugfixes

\n\n\n\n

Chores

\n\n\n\n
\n\n

v11.2.6

\n\n

Bugfixes

\n\n\n\n

Chores

\n\n\n\n
\n\n

v11.2.5

\n\n

Chores

\n\n\n\n
\n\n

v11.2.4

\n\n

Bugfixes

\n\n\n\n
\n\n

v11.2.3

\n\n

Bugfixes

\n\n\n\n
\n\n

v11.2.2

\n\n

Bugfixes

\n\n\n\n

Enhancements

\n\n\n\n
\n\n

v11.2.1

\n\n

Bugfixes

\n\n\n\n
\n\n

v11.2.0

\n\n\n\n
\n\n

v11.1.0

\n\n\n\n
\n\n

v11.0.3

\n\n\n\n
\n\n

v11.0.2

\n\n\n\n
\n\n

v11.0.1

\n\n\n\n
\n\n

v10.1.5

\n\n\n\n
\n\n

v10.1.4

\n\n\n\n
\n\n

v10.1.3

\n\n\n\n
\n\n

v10.1.2

\n\n\n\n
\n\n

v10.1.1

\n\n\n\n
\n\n

v10.1.0

\n\n\n\n
\n\n

v10.0.9

\n\n\n\n
\n\n

v10.0.8

\n\n\n\n
\n\n

v10.0.7

\n\n\n\n
\n\n

v10.0.6

\n\n\n\n
\n\n

v10.0.5

\n\n\n\n
\n\n

v10.0.4

\n\n\n\n
\n\n

v10.0.3

\n\n\n\n
\n\n

v10.0.2

\n\n\n\n
\n\n

v10.0.1

\n\n\n\n
\n\n

v10.0.0

\n\n\n\n
\n\n

v9.0.6

\n\n\n\n
\n\n

v9.0.5

\n\n\n\n
\n\n

v9.0.4

\n\n\n\n
\n\n

v9.0.3

\n\n\n\n
\n\n

v9.0.2

\n\n\n\n
\n\n

v9.0.1

\n\n\n\n
\n\n

v9.0.0

\n\n\n\n
\n\n

v1.9.1

\n\n\n\n
\n\n

v1.9

\n\n\n\n
\n\n

v1.8

\n\n\n\n
\n\n

v1.7

\n\n\n\n
\n\n

v1.6

\n\n\n\n
\n\n

v1.5

\n\n\n\n
\n\n

v1.4

\n\n\n\n
\n\n

v1.3

\n\n\n\n
\n\n

v1.21

\n\n\n\n
\n\n

v1.2

\n\n\n\n
\n\n

v1.1

\n\n", + "content": "

AUTO-GENERATED. DO NOT EDIT.

", "format": 1 }, "title": { diff --git a/system/src/sheets/FalloutActorSheet.mjs b/system/src/sheets/FalloutActorSheet.mjs index d0f2212f..89248481 100644 --- a/system/src/sheets/FalloutActorSheet.mjs +++ b/system/src/sheets/FalloutActorSheet.mjs @@ -154,8 +154,6 @@ export default class FalloutActorSheet extends ActorSheet { * @return {undefined} */ async _prepareItems(context) { - // Initialize containers. - const skills = []; const perks = []; const apparel = []; @@ -168,7 +166,6 @@ export default class FalloutActorSheet extends ActorSheet { const consumables = []; const books_and_magz = []; const miscellany = []; - // const gear = []; const specialAbilities = []; const diseases = []; @@ -176,11 +173,18 @@ export default class FalloutActorSheet extends ActorSheet { // Iterate through items, allocating to containers for (let i of context.items) { i.img = i.img || DEFAULT_TOKEN; - // Append to gear. + if (i.type === "skill") { + i.localizedName = game.i18n.localize( + `FALLOUT.SKILL.${i.name}` + ); + + i.localizedDefaultAttribute = game.i18n.localize( + `FALLOUT.AbilityAbbr.${i.system.defaultAttribute}` + ); + skills.push(i); } - // Append to skills. else if (i.type === "perk") { perks.push(i); } @@ -232,13 +236,8 @@ export default class FalloutActorSheet extends ActorSheet { } } - // Assign and return + skills.sort((a, b) => a.localizedName.localeCompare(b.localizedName)); - skills.sort(function(a, b) { - let nameA = a.name.toUpperCase(); - let nameB = b.name.toUpperCase(); - return nameA < nameB ? -1 : nameA > nameB ? 1 : 0; - }); context.skills = skills; let clothing = apparel.filter(a => a.system.appareltype === "clothing"); @@ -248,6 +247,7 @@ export default class FalloutActorSheet extends ActorSheet { let powerArmor = apparel.filter(a => a.system.appareltype === "powerArmor"); let plating = robotApparel.filter(a => a.system.appareltype === "plating"); let robotArmor = robotApparel.filter(a => a.system.appareltype === "armor"); + context.allApparel = [ { apparelType: "clothing", list: clothing }, { apparelType: "outfit", list: outfit }, @@ -255,22 +255,23 @@ export default class FalloutActorSheet extends ActorSheet { { apparelType: "armor", list: armor }, { apparelType: "powerArmor", list: powerArmor }, ]; + context.allRobotApparel = [ { apparelType: "plating", list: plating }, { apparelType: "armor", list: robotArmor }, ]; - context.apparel_mods = apparel_mods; - context.robot_mods = robot_mods; - context.perks = perks; context.ammo = ammo; - context.weapons = weapons; - context.weapon_mods = weapon_mods; - context.specialAbilities = specialAbilities; - context.consumables = consumables; + context.apparel_mods = apparel_mods; context.books_and_magz = books_and_magz; - context.miscellany = miscellany; + context.consumables = consumables; context.diseases = diseases; + context.miscellany = miscellany; + context.perks = perks; + context.robot_mods = robot_mods; + context.specialAbilities = specialAbilities; + context.weapon_mods = weapon_mods; + context.weapons = weapons; // WRAP INVENTORY DEPENDING ON THE CHARACTER TYPE: // for example put apparel in inventory for all except the character actor. diff --git a/system/templates/actor/parts/actor-skills.hbs b/system/templates/actor/parts/actor-skills.hbs index 33413c67..f3ae18fa 100644 --- a/system/templates/actor/parts/actor-skills.hbs +++ b/system/templates/actor/parts/actor-skills.hbs @@ -1,21 +1,26 @@
    -
  1. -
    {{localize "FALLOUT.TEMPLATES.SKILL"}}
    -
    {{localize "FALLOUT.TEMPLATES.Tag"}}
    -
    {{localize "FALLOUT.TEMPLATES.Rank"}}
    -
  2. - {{#each skills as |item id|}} -
  3. - -
    - -
    -
    - -
    -
  4. - {{/each}} -
\ No newline at end of file +
  • +
    {{localize "FALLOUT.TEMPLATES.SKILL"}}
    +
    {{localize "FALLOUT.TEMPLATES.Tag"}}
    +
    {{localize "FALLOUT.TEMPLATES.Rank"}}
    +
  • + {{#each skills as |item id|}} +
  • + +
    + +
    +
    + +
    +
  • + {{/each}} +