From e431362a37d77028419a20d4edf3afa3c488d5ac Mon Sep 17 00:00:00 2001 From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com> Date: Sun, 28 Jul 2024 22:44:33 -0700 Subject: [PATCH] basics of sorting for equipment added, and added roll icons --- css/deltagreen.css | 13 ++ module/actor/actor-sheet.js | 24 ++- module/templates.js | 1 + templates/actor/actor-sheet.html | 169 +----------------- templates/actor/custom-skills-partial.html | 5 + templates/actor/equipment-partial.html | 192 +++++++++++++++++++++ templates/actor/npc-sheet.html | 164 +----------------- templates/actor/unnatural-sheet.html | 163 +---------------- 8 files changed, 240 insertions(+), 491 deletions(-) create mode 100644 templates/actor/equipment-partial.html diff --git a/css/deltagreen.css b/css/deltagreen.css index 9aed516..09cf6e2 100644 --- a/css/deltagreen.css +++ b/css/deltagreen.css @@ -1133,3 +1133,16 @@ input.item-sheet-short-input { min-height: 300px; resize: none; } + +.weapon-name-flexcontainer { + display: flex; + justify-content: flex-start; + flex-direction: row; + column-gap: 10px; +} + +.weapon-name-flexitem { + flex: content; + align-self: flex-start; + text-align: left; +} diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 96c14a2..146e247 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -15,7 +15,7 @@ export default class DeltaGreenActorSheet extends ActorSheet { return foundry.utils.mergeObject(super.defaultOptions, { classes: ["deltagreen", "sheet", "actor"], template: "systems/deltagreen/templates/actor/actor-sheet.html", - width: 700, + width: 750, height: 770, tabs: [ { @@ -61,9 +61,9 @@ export default class DeltaGreenActorSheet extends ActorSheet { const data = super.getData(); // Prepare items. - if (this.actor.type === "agent") { - this._prepareCharacterItems(data); - } + //if (this.actor.type === "agent") { + this._prepareCharacterItems(data); + //} // Make it easy for the sheet handlebars to understand how to sort the skills. data.sortSkillsSetting = game.settings.get("deltagreen", "sortSkills"); @@ -146,6 +146,7 @@ export default class DeltaGreenActorSheet extends ActorSheet { // Initialize containers. const armor = []; const weapons = []; + const gear = []; // Iterate through items, allocating to containers // let totalWeight = 0; @@ -157,12 +158,27 @@ export default class DeltaGreenActorSheet extends ActorSheet { // Append to weapons. else if (i.type === "weapon") { weapons.push(i); + } else if (i.type === "gear") { + gear.push(i); } } + armor.sort(function (a, b) { + return a.sort - b.sort; + }); + + weapons.sort(function (a, b) { + return a.sort - b.sort; + }); + + gear.sort(function (a, b) { + return a.sort - b.sort; + }); + // Assign and return actorData.armor = armor; actorData.weapons = weapons; + actorData.gear = gear; } // Can add extra buttons to form header here if necessary diff --git a/module/templates.js b/module/templates.js index feb7415..bf9efc8 100644 --- a/module/templates.js +++ b/module/templates.js @@ -14,5 +14,6 @@ export default async function preloadHandlebarsTemplates() { "systems/deltagreen/templates/dialog/modify-percentile-roll.html", "systems/deltagreen/templates/actor/vehicle-sheet.html", "systems/deltagreen/templates/actor/help-and-licensing-partial.html", + "systems/deltagreen/templates/actor/equipment-partial.html", ]); } diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index c482281..21f8734 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -104,15 +104,18 @@ {{#unless skill.proficiency}}title="{{localize 'DG.Tooltip.CannotRollSkillLabel'}}"{{/unless}} > {{localizeWithFallback (concat "DG.Skills." key) skill.label }} + {{#if_eq key 'ritual' }} + {{#if (keepSanityPrivate)}} {{/if}} + {{#unless (keepSanityPrivate)}} {{/if_not_eq}} + {{/each}} @@ -148,7 +153,7 @@
- + ({{numberFormat statistic.x5 decimals=0 sign=false}}%)
@@ -283,167 +288,7 @@ {{!-- GEAR Tab --}}
-
- -
- {{localize 'DG.Gear.Weapons'}} -
- -
    - -
  1. -
    - {{localize 'DG.Gear.Name'}} - {{localize 'DG.Gear.DamageOrLethality'}} - {{localize 'DG.Gear.ArmorPiercing'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'weapon'}} - -
  3. -
    - -

    - {{item.name}} -

    -
    - - - {{#unless item.system.isLethal}} - - {{toUpperCase item.system.damage}}{{#if_eq item.system.skill 'unarmed_combat'}}{{actor.system.statistics.str.meleeDamageBonusFormula}}{{/if_eq}}{{#if_eq item.system.skill 'melee_weapons'}}{{actor.system.statistics.str.meleeDamageBonusFormula}}{{/if_eq}} - - {{/unless}} - - {{#if item.system.isLethal}} - - {{item.system.lethality}}% - {{/if}} - - {{#if item.system.lethality}} - - - {{#if item.system.isLethal}} - - {{else}} - - {{/if}} - {{/if}} - - - {{item.system.armorPiercing}} - -
    - - -
    - -
  4. - - {{/if_eq}} - {{/each}} -
-
-
- -
- {{localize 'DG.Gear.Armor'}} -
- -
    -
  1. -
    -
    {{localize 'DG.Gear.Name'}}
    - {{localize 'DG.Gear.ArmorRating'}} - {{localize 'DG.Gear.Equipped'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'armor'}} - -
  3. -
    -

    {{item.name}}

    - {{item.system.protection}} - - - {{#if item.system.equipped}} - - {{else}} - - {{/if}} - - -
    - - -
    -
  4. - - {{/if_eq}} - {{/each}} - -
-
-
- -
- {{localize 'DG.Gear.OtherGear'}} -
- -
    -
  1. -
    -
    {{localize 'DG.Gear.Name'}}
    - - {{localize 'DG.Gear.Equipped'}} - -
  2. - - {{#each actor.items as |item id|}} - - {{#if_eq item.type 'gear'}} - -
  3. -
    -

    {{item.name}}

    - - - - {{#if item.system.equipped}} - - {{else}} - - {{/if}} - - - -
    - - -
    -
  4. - - {{/if_eq}} - {{/each}} - -
-
+ {{> "systems/deltagreen/templates/actor/equipment-partial.html" }}
{{!-- PERSONAL (Biography) Tab --}} diff --git a/templates/actor/custom-skills-partial.html b/templates/actor/custom-skills-partial.html index f51eb43..10fbb52 100644 --- a/templates/actor/custom-skills-partial.html +++ b/templates/actor/custom-skills-partial.html @@ -6,6 +6,7 @@ {{/if_eq}}
+ {{#each actor.system.typedSkills as |skill key|}}
@@ -14,6 +15,7 @@ {{#unless skill.proficiency}}title="{{localize 'DG.Tooltip.CannotRollSkillLabel'}}"{{/unless}} > {{skill.group}} ({{skill.label}}) + {{#if_eq ../actorType "agent"}} @@ -26,10 +28,12 @@
{{/each}} + {{#each specialTraining as |training|}}
@@ -37,4 +41,5 @@
{{/each}} +
\ No newline at end of file diff --git a/templates/actor/equipment-partial.html b/templates/actor/equipment-partial.html new file mode 100644 index 0000000..9d8b137 --- /dev/null +++ b/templates/actor/equipment-partial.html @@ -0,0 +1,192 @@ + +{{!-- WEAPONS/ATTACKS --}} +
+ +
+ {{localize 'DG.Gear.Weapons'}} +
+ +
    + +
  1. +
    + {{localize 'DG.Gear.Name'}} + {{localize 'DG.Gear.DamageOrLethality'}} + {{localize 'DG.Gear.ArmorPiercing'}} + +
  2. + + {{#each actor.weapons as |item id|}} + +
  3. + +
    + + + + + +

    + {{item.name}} +

    + + + + + +
    + +
    + + + + {{#if item.system.lethality}} + {{#if item.system.isLethal}} + + {{else}} + + {{/if}} + {{/if}} + + {{#unless item.system.isLethal}} + + {{toUpperCase item.system.damage}}{{#if_eq item.system.skill 'unarmed_combat'}}{{actor.system.statistics.str.meleeDamageBonusFormula}}{{/if_eq}}{{#if_eq item.system.skill 'melee_weapons'}}{{actor.system.statistics.str.meleeDamageBonusFormula}}{{/if_eq}} + + + {{/unless}} + + {{#if item.system.isLethal}} + + {{item.system.lethality}}% + + + {{/if}} + + + + {{item.system.armorPiercing}} + +
    + + +
    + +
  4. + + {{/each}} + +
+ +
+ +{{!-- ARMOR/DEFENSE --}} +
+ +
+ {{localize 'DG.Gear.Armor'}} +
+ +
    + +
  1. + +
    +
    {{localize 'DG.Gear.Name'}}
    + {{localize 'DG.Gear.ArmorRating'}} + {{localize 'DG.Gear.Equipped'}} + + +
  2. + + {{#each actor.armor as |item id|}} + +
  3. + +
    + +

    {{item.name}}

    + + {{item.system.protection}} + + + {{#if item.system.equipped}} + + {{else}} + + {{/if}} + + +
    + + +
    + +
  4. + + {{/each}} + +
+
+ +{{!-- OTHER GEAR/MISC --}} + +
+ +
+ {{localize 'DG.Gear.OtherGear'}} +
+ +
    + +
  1. + +
    + +
    {{localize 'DG.Gear.Name'}}
    + + {{localize 'DG.Gear.Equipped'}} + + + +
  2. + + {{#each actor.gear as |item id|}} + +
  3. + +
    + +

    {{item.name}}

    + + + + {{#if item.system.equipped}} + + {{else}} + + {{/if}} + + + +
    + + +
    + +
  4. + + {{/each}} + +
+ +
\ No newline at end of file diff --git a/templates/actor/npc-sheet.html b/templates/actor/npc-sheet.html index f0d1bd1..0a65a48 100644 --- a/templates/actor/npc-sheet.html +++ b/templates/actor/npc-sheet.html @@ -144,169 +144,7 @@ {{!-- GEAR --}}
-
- -
- {{localize 'DG.Gear.Weapons'}} -
- -
    - -
  1. -
    - {{localize 'DG.Gear.Name'}} - {{localize 'DG.Gear.DamageOrLethality'}} - {{localize 'DG.Gear.ArmorPiercing'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'weapon'}} - -
  3. -
    - -

    - {{item.name}} -

    - - - {{#unless item.system.isLethal}} - - {{toUpperCase item.system.damage}} - - {{/unless}} - - {{#if item.system.isLethal}} - {{formatLethality item.system.lethality}} - {{/if}} - - {{#if item.system.lethality}} - - - {{#if item.system.isLethal}} - - {{else}} - - {{/if}} - {{/if}} - - - - {{item.system.armorPiercing}} - -
    - - -
    - -
  4. - - {{/if_eq}} - {{/each}} -
-
-
- -
- {{localize 'DG.Gear.Armor'}} -
- -
    -
  1. -
    -
    {{localize 'DG.Gear.Name'}}
    - {{localize 'DG.Gear.ArmorRating'}} - {{localize 'DG.Gear.Equipped'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'armor'}} - -
  3. -
    -

    {{item.name}}

    - {{item.system.protection}} - - - {{#if item.system.equipped}} - - {{else}} - - {{/if}} - - -
    - - -
    -
  4. - - {{/if_eq}} - {{/each}} - -
-
-
- -
- {{localize 'DG.Gear.OtherGear'}} -
- -
    -
  1. -
    -
    {{localize 'DG.Gear.Name'}}
    -
    - {{localize 'DG.Gear.Equipped'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'gear'}} - -
  3. -
    - -

    {{item.name}}

    - - - - - - {{#if item.system.equipped}} - - {{else}} - - {{/if}} - - - -
    - - -
    -
  4. - - {{/if_eq}} - {{/each}} - -
-
+ {{> "systems/deltagreen/templates/actor/equipment-partial.html" }}
{{!-- About Tab --}} diff --git a/templates/actor/unnatural-sheet.html b/templates/actor/unnatural-sheet.html index b218063..c13ef57 100644 --- a/templates/actor/unnatural-sheet.html +++ b/templates/actor/unnatural-sheet.html @@ -137,168 +137,7 @@ {{!-- GEAR --}}
-
- -
- {{localize 'DG.Gear.Weapons'}} -
- -
    - -
  1. -
    - {{localize 'DG.Gear.Name'}} - {{localize 'DG.Gear.DamageOrLethality'}} - {{localize 'DG.Gear.ArmorPiercing'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'weapon'}} - -
  3. -
    - -

    - {{item.name}} -

    - - - {{#unless item.system.isLethal}} - - {{toUpperCase item.system.damage}} - - {{/unless}} - - {{#if item.system.isLethal}} - {{formatLethality item.system.lethality}} - {{/if}} - - {{#if item.system.lethality}} - - - {{#if item.system.isLethal}} - - {{else}} - - {{/if}} - {{/if}} - - - {{item.system.armorPiercing}} - -
    - - -
    - -
  4. - - {{/if_eq}} - {{/each}} -
-
-
- -
- {{localize 'DG.Gear.Armor'}} -
- -
    -
  1. -
    -
    {{localize 'DG.Gear.Name'}}
    - {{localize 'DG.Gear.ArmorRating'}} - {{localize 'DG.Gear.Equipped'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'armor'}} - -
  3. -
    -

    {{item.name}}

    - {{item.system.protection}} - - - {{#if item.system.equipped}} - - {{else}} - - {{/if}} - - -
    - - -
    -
  4. - - {{/if_eq}} - {{/each}} - -
-
-
- -
- {{localize 'DG.Gear.OtherGear'}} -
- -
    -
  1. -
    -
    {{localize 'DG.Gear.Name'}}
    -
    - {{localize 'DG.Gear.Equipped'}} - -
  2. - - {{#each actor.items as |item id|}} - {{#if_eq item.type 'gear'}} - -
  3. -
    - -

    {{item.name}}

    - - - - - - {{#if item.system.equipped}} - - {{else}} - - {{/if}} - - - -
    - - -
    -
  4. - - {{/if_eq}} - {{/each}} - -
-
+ {{> "systems/deltagreen/templates/actor/equipment-partial.html" }}
{{!-- About Tab --}}