From 94053f2a4d0e7b4f2b02852df96fc22b8d578515 Mon Sep 17 00:00:00 2001 From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:42:41 -0700 Subject: [PATCH] changed actor sheet settings data model slightly to better organize it --- module/actor/actor-sheet.js | 18 +++++++++--------- template.json | 23 ++++++++++++++--------- templates/actor/actor-sheet.html | 4 ++-- templates/actor/equipment-partial.html | 6 +++--- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index e55a662..c8a0800 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -161,7 +161,7 @@ export default class DeltaGreenActorSheet extends ActorSheet { } } - if (actorData.system.sorting.armorSortAlphabetical) { + if (actorData.system.settings.sorting.armorSortAlphabetical) { armor.sort(function (a, b) { let x = a.name.toLowerCase(); let y = b.name.toLowerCase(); @@ -179,7 +179,7 @@ export default class DeltaGreenActorSheet extends ActorSheet { }); } - if (actorData.system.sorting.weaponSortAlphabetical) { + if (actorData.system.settings.sorting.weaponSortAlphabetical) { weapons.sort(function (a, b) { let x = a.name.toLowerCase(); let y = b.name.toLowerCase(); @@ -197,7 +197,7 @@ export default class DeltaGreenActorSheet extends ActorSheet { }); } - if (actorData.system.sorting.gearSortAlphabetical) { + if (actorData.system.settings.sorting.gearSortAlphabetical) { gear.sort(function (a, b) { let x = a.name.toLowerCase(); let y = b.name.toLowerCase(); @@ -553,18 +553,18 @@ export default class DeltaGreenActorSheet extends ActorSheet { if (itemType === "weapon") { this.actor.update({ - "system.sorting.weaponSortAlphabetical": - !this.actor.system.sorting.weaponSortAlphabetical, + "system.settings.sorting.weaponSortAlphabetical": + !this.actor.system.settings.sorting.weaponSortAlphabetical, }); } else if (itemType === "armor") { this.actor.update({ - "system.sorting.armorSortAlphabetical": - !this.actor.system.sorting.armorSortAlphabetical, + "system.settings.sorting.armorSortAlphabetical": + !this.actor.system.settings.sorting.armorSortAlphabetical, }); } else if (itemType === "gear") { this.actor.update({ - "system.sorting.gearSortAlphabetical": - !this.actor.system.sorting.gearSortAlphabetical, + "system.settings.sorting.gearSortAlphabetical": + !this.actor.system.settings.sorting.gearSortAlphabetical, }); } }); diff --git a/template.json b/template.json index feec250..1700db6 100644 --- a/template.json +++ b/template.json @@ -40,11 +40,16 @@ } } }, - "item-sorting": { - "sorting": { - "weaponSortAlphabetical": false, - "armorSortAlphabetical": false, - "gearSortAlphabetical": false + "sheet-settings": { + "settings": { + "sorting": { + "weaponSortAlphabetical": false, + "armorSortAlphabetical": false, + "gearSortAlphabetical": false + }, + "rolling": { + "defaultPercentileModifier": 20 + } } }, "human_skills": { @@ -436,7 +441,7 @@ } }, "unnatural": { - "templates": ["base", "unnatural_skills", "item-sorting"], + "templates": ["base", "unnatural_skills", "sheet-settings"], "sanity": { "notes": "", "failedLoss": "1D4", @@ -448,7 +453,7 @@ "showUntrainedSkills": true }, "npc": { - "templates": ["base", "human_skills", "item-sorting"], + "templates": ["base", "human_skills", "sheet-settings"], "schemaVersion": 1.0, "sanity": { "value": 100, @@ -459,7 +464,7 @@ "showUntrainedSkills": true }, "vehicle": { - "templates": ["item-sorting"], + "templates": ["sheet-settings"], "name": "", "description": "", "shortDescription": "", @@ -473,7 +478,7 @@ "passengers": [] }, "agent": { - "templates": ["base", "human_skills", "item-sorting"], + "templates": ["base", "human_skills", "sheet-settings"], "schemaVersion": 1.0, "sanity": { "value": 100, diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 21f8734..91e3610 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -153,9 +153,9 @@
- + - ({{numberFormat statistic.x5 decimals=0 sign=false}}%) + ({{numberFormat statistic.x5 decimals=0 sign=false}}% )
diff --git a/templates/actor/equipment-partial.html b/templates/actor/equipment-partial.html index cc80c0a..cc09a90 100644 --- a/templates/actor/equipment-partial.html +++ b/templates/actor/equipment-partial.html @@ -10,7 +10,7 @@
  • - {{#if actor.system.sorting.weaponSortAlphabetical}} + {{#if actor.system.settings.sorting.weaponSortAlphabetical}} {{else}} @@ -107,7 +107,7 @@
  • - {{#if actor.system.sorting.armorSortAlphabetical}} + {{#if actor.system.settings.sorting.armorSortAlphabetical}} {{else}} @@ -165,7 +165,7 @@
  • - {{#if actor.system.sorting.gearSortAlphabetical}} + {{#if actor.system.settings.sorting.gearSortAlphabetical}} {{else}}