From 05354e9c6b1e94305887ffa5e70bb06711d5f149 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Wed, 30 Dec 2020 17:34:14 +0100 Subject: [PATCH] tab on 20q and Hide rank 0 (initial) on progession --- system/scripts/actors/character-sheet.js | 8 +- .../scripts/actors/twenty-questions-dialog.js | 3 +- system/scripts/actors/twenty-questions.js | 24 +- system/scripts/config.js | 2 +- .../actors/twenty-questions-dialog.html | 1118 +++++++++-------- 5 files changed, 583 insertions(+), 572 deletions(-) diff --git a/system/scripts/actors/character-sheet.js b/system/scripts/actors/character-sheet.js index 24578d0..22df5d0 100644 --- a/system/scripts/actors/character-sheet.js +++ b/system/scripts/actors/character-sheet.js @@ -73,10 +73,14 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e { xp = Math.floor(xp / 2); } - const rank = Math.max(0, item.data.bought_at_rank - 1); + const rank = Math.max(0, item.data.bought_at_rank); + if (rank < 1) { + // Ignore starting comp/items + return; + } if (!adv[rank]) { adv[rank] = { - rank: rank + 1, + rank: rank, spent: 0, goal: CONFIG.l5r5e.xp.costPerRank[rank] || null, list: [], diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js index ccfc2d5..40adc35 100644 --- a/system/scripts/actors/twenty-questions-dialog.js +++ b/system/scripts/actors/twenty-questions-dialog.js @@ -33,7 +33,8 @@ export class TwentyQuestionsDialog extends FormApplication { template: CONFIG.l5r5e.paths.templates + "actors/twenty-questions-dialog.html", title: game.i18n.localize("l5r5e.twenty_questions.title"), width: 600, - height: 600, + height: 800, + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "part1" }], resizable: true, closeOnSubmit: false, submitOnClose: false, diff --git a/system/scripts/actors/twenty-questions.js b/system/scripts/actors/twenty-questions.js index c8a3cd5..09510e1 100644 --- a/system/scripts/actors/twenty-questions.js +++ b/system/scripts/actors/twenty-questions.js @@ -209,10 +209,10 @@ export class TwentyQuestions { * Fill a actor data from this object */ async toActor(actor, itemsCache) { - const actorDatas = duplicate(actor.data.data); + const actorDatas = actor.data.data; const formData = this.data; - // Update the actor real datas + // Update the actor actorDatas.zeni = Math.floor(formData.step2.wealth * 50); actorDatas.identity = { ...actorDatas.identity, @@ -268,24 +268,24 @@ export class TwentyQuestions { await actor.deleteEmbeddedEntity("OwnedItem", deleteIds); // Add items in 20Q to actor - Object.values(itemsCache).forEach((types) => { - types.forEach((item) => { + for (const types of Object.values(itemsCache)) { + for (const item of types) { const itemData = duplicate(item.data); if (itemData.data?.bought_at_rank) { itemData.data.bought_at_rank = 0; } - actor.createEmbeddedEntity("OwnedItem", itemData); - }); - }); + if (itemData.data?.xp_spent) { + itemData.data.xp_spent = 0; + } + await actor.createEmbeddedEntity("OwnedItem", itemData); + } + } // Update actor - actor.update({ + await actor.update({ name: (formData.step2.family + " " + formData.step19.firstname).trim(), - data: diffObject(actor.data.data, actorDatas), + data: actor.data.data, }); - - // TODO Tmp - // console.log(actor); } /** diff --git a/system/scripts/config.js b/system/scripts/config.js index f37d073..cb11027 100644 --- a/system/scripts/config.js +++ b/system/scripts/config.js @@ -8,7 +8,7 @@ L5R5E.paths = { L5R5E.stances = ["earth", "air", "water", "fire", "void"]; L5R5E.techniques = ["kata", "kiho", "invocation", "ritual", "shuji", "maho", "ninjutsu"]; L5R5E.xp = { - costPerRank: [20, 24, 32, 44, 60], + costPerRank: [0, 20, 24, 32, 44, 60], ringCostMultiplier: 3, skillCostMultiplier: 2, techniqueCost: 3, diff --git a/system/templates/actors/twenty-questions-dialog.html b/system/templates/actors/twenty-questions-dialog.html index 49c870e..b3aec38 100644 --- a/system/templates/actors/twenty-questions-dialog.html +++ b/system/templates/actors/twenty-questions-dialog.html @@ -7,39 +7,116 @@

{{localize 'l5r5e.twenty_questions.title'}}

{{localize 'l5r5e.twenty_questions.intro'}} +

{{localize 'l5r5e.twenty_questions.section'}}
-

{{localize 'l5r5e.twenty_questions.part1.title'}}

-
-
- +
+ +
+

{{localize 'l5r5e.twenty_questions.part1.title'}}

+
+ - - - + +
-
+
+
+
+

{{localize 'l5r5e.twenty_questions.part2.title'}}

+
+

{{localize 'l5r5e.twenty_questions.part2.q3'}}

-
- + - - - - - - - - - - - - -
- + + + + - + - + + + - -
+ + - - - + + + - -
- + {{#select data.step3.skill3}} + + {{#each skillsList as |skills catId|}} + + {{#each skills as |obj|}} + + {{/each}} + {{/each}} - - {{/each}} - {{/select}} - -
-
+ {{localize 'l5r5e.twenty_questions.access'}}
- - -
- -
- - - -

{{localize 'l5r5e.twenty_questions.part2.title'}}

-
-
-

{{localize 'l5r5e.twenty_questions.part2.q3'}}

- - - - - - - - + + + + + +
- {{/each}} - {{/select}} - - -
+ {{localize 'l5r5e.twenty_questions.schoolab'}} +
+ {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.school_ability stepName='step3.school_ability' itemType='techniques' hideDndAt=1 }} +
+ {{localize 'l5r5e.twenty_questions.startech'}} +
+ {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.techniques stepName='step3.techniques' itemType='techniques' hideDndAt=5 }} +
+ {{localize 'l5r5e.twenty_questions.outfit'}} +
+ {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.equipment stepName='step3.equipment' itemType='items' hideDndAt=10 }} +
+
+ +
+ +
+ +
+ +
+

{{localize 'l5r5e.twenty_questions.part3.title'}}

+
+

{{localize 'l5r5e.twenty_questions.part3.q5'}}

+ +
- - - - - -
- {{localize 'l5r5e.twenty_questions.access'}} + + + + +
+

{{localize 'l5r5e.twenty_questions.part3.q6'}}

+ +
- {{localize 'l5r5e.twenty_questions.schoolab'}} -
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.school_ability stepName='step3.school_ability' itemType='techniques' hideDndAt=1 }} -
- {{localize 'l5r5e.twenty_questions.startech'}} -
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.techniques stepName='step3.techniques' itemType='techniques' hideDndAt=5 }} -
- {{localize 'l5r5e.twenty_questions.outfit'}} -
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step3.equipment stepName='step3.equipment' itemType='items' hideDndAt=10 }} -
-
+ + +
-
- -
- -
-
+
+ -

{{localize 'l5r5e.twenty_questions.part3.title'}}

-
-
-

{{localize 'l5r5e.twenty_questions.part3.q5'}}

- - -
- -
-

{{localize 'l5r5e.twenty_questions.part3.q6'}}

- - -
- -
- - - - - + + + +
- + + {{localize 'l5r5e.twenty_questions.or'}} + + +
+
-
- +
+ - - - - - - -
- - - {{localize 'l5r5e.twenty_questions.or'}} - - -
-
-
- -

{{localize 'l5r5e.twenty_questions.part4.title'}}

-
-
- -
- {{localize 'l5r5e.twenty_questions.distinction'}} -
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step9.distinction stepName='step9.distinction' itemType='peculiarities' hideDndAt=1 }} -
- -
- -
- {{localize 'l5r5e.twenty_questions.adversity'}} -
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step10.adversity stepName='step10.adversity' itemType='peculiarities' hideDndAt=1 }} -
- -
- -
- {{localize 'l5r5e.twenty_questions.passion'}} -
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step11.passion stepName='step11.passion' itemType='peculiarities' hideDndAt=1 }} -
- -
- -
- {{localize 'l5r5e.twenty_questions.anxiety'}} -
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step12.anxiety stepName='step12.anxiety' itemType='peculiarities' hideDndAt=1 }} -
- -
- -
- - - - + + + +
- + {{localize 'l5r5e.twenty_questions.or'}} + + +
+
+ +
+

{{localize 'l5r5e.twenty_questions.part4.title'}}

+
+
- {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step14.special_features stepName='step14.special_features' itemType='items' hideDndAt=1 }} - -
- -
- -
- -
- -
- -
-
+ {{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step9.distinction stepName='step9.distinction' itemType='peculiarities' hideDndAt=1 }} +
-

{{localize 'l5r5e.twenty_questions.part6.title'}}

-
-
- -
-
-
- - - - - - -
- - - -
-
+
+ + + + + + +
+ + + +
+
-
- -
-
+
+ +
+ +
+

{{localize 'l5r5e.twenty_questions.part7.title'}}

+
+ +
+
+ {{#if hasErrors}} + corriger les erreurs pour poursuivre ! + {{else}} + + {{/if}} +
+
-
- {{#if hasErrors}} - corriger les erreurs pour poursuivre ! - {{else}} - - {{/if}} \ No newline at end of file