From 3b37859cb531ed9ace1bd4eefa5541cede09918d Mon Sep 17 00:00:00 2001 From: Vlyan Date: Fri, 24 May 2024 18:44:24 +0200 Subject: [PATCH] v12 fixes : Fix select to selectOptions --- .../scripts/actors/twenty-questions-dialog.js | 5 +- system/scripts/config.js | 1 + system/scripts/items/advancement-sheet.js | 35 ++-- system/scripts/items/weapon-sheet.js | 5 +- .../actors/character-generator-dialog.html | 12 +- system/templates/actors/npc/identity.html | 6 +- .../actors/twenty-questions-dialog.html | 150 ++++-------------- system/templates/dice/dice-picker-dialog.html | 12 +- .../items/advancement/advancement-sheet.html | 32 ++-- .../items/peculiarity/peculiarity-sheet.html | 12 +- .../items/technique/technique-sheet.html | 12 +- .../templates/items/weapon/weapon-sheet.html | 6 +- 12 files changed, 87 insertions(+), 201 deletions(-) diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js index 129a7cd..24031f8 100644 --- a/system/scripts/actors/twenty-questions-dialog.js +++ b/system/scripts/actors/twenty-questions-dialog.js @@ -150,7 +150,10 @@ export class TwentyQuestionsDialog extends FormApplication { skillsList, skillsListStep7, skillsListStep17, - noHonorSkillsList: ["commerce", "skulduggery", "medicine", "seafaring", "survival", "labor"], + noHonorSkillsList: CONFIG.l5r5e.noHonorSkillsList.map(id => ({ + id, + label: game.i18n.localize("l5r5e.skills." + CONFIG.l5r5e.skills.get(id.toLowerCase()) + "." + id.toLowerCase()) + })), techniquesList: game.l5r5e.HelpersL5r5e.getTechniquesList({ displayInTypes: true }), data: this.object.data, cache: this.cache, diff --git a/system/scripts/config.js b/system/scripts/config.js index 500e7e6..a546c85 100644 --- a/system/scripts/config.js +++ b/system/scripts/config.js @@ -23,6 +23,7 @@ export const L5R5E = { skirmish: "tactics", mass_battle: "command", }, + noHonorSkillsList: ["commerce", "skulduggery", "medicine", "seafaring", "survival", "labor"], }; // *** Techniques *** diff --git a/system/scripts/items/advancement-sheet.js b/system/scripts/items/advancement-sheet.js index e2b8e03..30d958b 100644 --- a/system/scripts/items/advancement-sheet.js +++ b/system/scripts/items/advancement-sheet.js @@ -7,7 +7,11 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e { /** * Sub Types of advancements */ - static types = { ring: "l5r5e.rings.label", skill: "l5r5e.skills.label" }; // others have theirs own xp count + static types = [ + { id: "ring", label: "l5r5e.rings.label" }, + { id: "skill", label: "l5r5e.skills.label" }, + // others have theirs own xp count + ]; /** @override */ static get defaultOptions() { @@ -43,29 +47,33 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e { const currentSkill = this.object.system.skill; html.find("#advancement_type").on("change", (event) => { - $(event.target).prop("disabled", true); - if ($(event.target).val() === "skill") { + const targetEvt = $(event.target); + targetEvt.prop("disabled", true); + + if (targetEvt.val() === "skill") { this._updateChoice({ ring: currentRing }, { skill: currentSkill }).then( - $(event.target).prop("disabled", false) + targetEvt.prop("disabled", false) ); - } else { + } else if (targetEvt.val() === "ring") { this._updateChoice({ skill: currentSkill }, { ring: currentRing }).then( - $(event.target).prop("disabled", false) + targetEvt.prop("disabled", false) ); } }); html.find("#advancement_ring").on("change", (event) => { - $(event.target).prop("disabled", true); - this._updateChoice({ ring: currentRing }, { ring: $(event.target).val() }).then( - $(event.target).prop("disabled", false) + const targetEvt = $(event.target); + targetEvt.prop("disabled", true); + this._updateChoice({ ring: currentRing }, { ring: targetEvt.val() }).then( + targetEvt.prop("disabled", false) ); }); html.find("#advancement_skill").on("change", (event) => { - $(event.target).prop("disabled", true); - this._updateChoice({ skill: currentSkill }, { skill: $(event.target).val() }).then( - $(event.target).prop("disabled", false) + const targetEvt = $(event.target); + targetEvt.prop("disabled", true); + this._updateChoice({ skill: currentSkill }, { skill: targetEvt.val() }).then( + targetEvt.prop("disabled", false) ); }); } @@ -141,8 +149,5 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e { xp_used: xp_used, }, }); - - // Re render - this.render(false); } } diff --git a/system/scripts/items/weapon-sheet.js b/system/scripts/items/weapon-sheet.js index 3d8e0d6..68f2bd8 100644 --- a/system/scripts/items/weapon-sheet.js +++ b/system/scripts/items/weapon-sheet.js @@ -18,7 +18,10 @@ export class WeaponSheetL5r5e extends ItemSheetL5r5e { // Martial skills only sheetData.data.skills = Array.from(CONFIG.l5r5e.skills) .filter(([id, cat]) => cat === "martial") - .map(([id, cat]) => id); + .map(([id, cat]) => ({ + id, + label: "l5r5e.skills." + cat.toLowerCase() + "." + id.toLowerCase(), + })); return sheetData; } diff --git a/system/templates/actors/character-generator-dialog.html b/system/templates/actors/character-generator-dialog.html index 244937f..f6ff8b6 100644 --- a/system/templates/actors/character-generator-dialog.html +++ b/system/templates/actors/character-generator-dialog.html @@ -4,11 +4,7 @@
@@ -16,11 +12,7 @@
diff --git a/system/templates/actors/npc/identity.html b/system/templates/actors/npc/identity.html index 11afb65..2747b01 100644 --- a/system/templates/actors/npc/identity.html +++ b/system/templates/actors/npc/identity.html @@ -2,11 +2,7 @@ {{!-- Npc Type (minion / adversary) --}}
  • {{!-- Martial --}} diff --git a/system/templates/actors/twenty-questions-dialog.html b/system/templates/actors/twenty-questions-dialog.html index 594635d..6888ccb 100644 --- a/system/templates/actors/twenty-questions-dialog.html +++ b/system/templates/actors/twenty-questions-dialog.html @@ -22,11 +22,7 @@
    @@ -46,12 +42,8 @@ @@ -59,16 +51,12 @@ @@ -94,39 +82,27 @@ {{localize 'l5r5e.twenty_questions.increase_ring1'}} {{localize 'l5r5e.twenty_questions.increase_skill2'}} @@ -160,20 +136,12 @@ {{localize 'l5r5e.twenty_questions.increase_ring2'}} {{localize 'l5r5e.twenty_questions.part2.honor'}} @@ -181,64 +149,44 @@ {{localize 'l5r5e.twenty_questions.increase_skill3'}} @@ -271,12 +219,8 @@ @@ -304,16 +248,12 @@ {{localize 'l5r5e.twenty_questions.increase_skill1'}} @@ -332,12 +272,8 @@ {{localize 'l5r5e.twenty_questions.increase_skill1'}} @@ -415,18 +351,14 @@ {{localize 'l5r5e.twenty_questions.and'}} {{localize 'l5r5e.twenty_questions.increase_skill1'}} @@ -478,16 +410,12 @@ {{else}} @@ -538,16 +466,12 @@ {{localize 'l5r5e.twenty_questions.increase_skill1'}} {{localize 'l5r5e.twenty_questions.part6.d10r2_drop_items'}} {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step18.heritage_item stepName='step18.heritage_item' itemType='items' hideDndAt=1}} @@ -558,16 +482,12 @@ {{/ifCond}} diff --git a/system/templates/dice/dice-picker-dialog.html b/system/templates/dice/dice-picker-dialog.html index 8656770..8582c6b 100644 --- a/system/templates/dice/dice-picker-dialog.html +++ b/system/templates/dice/dice-picker-dialog.html @@ -25,13 +25,11 @@ {{/if}} {{else}} diff --git a/system/templates/items/advancement/advancement-sheet.html b/system/templates/items/advancement/advancement-sheet.html index a38f38e..26a3d63 100644 --- a/system/templates/items/advancement/advancement-sheet.html +++ b/system/templates/items/advancement/advancement-sheet.html @@ -8,36 +8,24 @@ {{!-- Attributes Tab --}}
    {{#ifCond data.system.advancement_type '==' 'ring'}} {{/ifCond}} {{#ifCond data.system.advancement_type '==' 'skill'}} - + {{/ifCond}}