diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 2ab6df8..48f611f 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -273,6 +273,10 @@ export class DeltaGreenActorSheet extends ActorSheet { // Remove the type from the dataset since it's in the itemData.type prop. delete itemData.data["type"]; + if(type == "weapon"){ + itemData.data.skill = "firearms"; //default skill to firearms, since that will be most common + } + // Finally, create the item! return this.actor.createOwnedItem(itemData); } @@ -307,6 +311,9 @@ export class DeltaGreenActorSheet extends ActorSheet { targetVal = this.actor.data.data.sanity.value; label += `, Target: ${targetVal}`; } + else if(dataset.target === "damage"){ + // damage roll, not a skill check + } roll.roll().toMessage({ speaker: ChatMessage.getSpeaker({ actor: this.actor }), diff --git a/module/deltagreen.js b/module/deltagreen.js index 8bc8d6f..efff015 100644 --- a/module/deltagreen.js +++ b/module/deltagreen.js @@ -43,11 +43,19 @@ Hooks.once('init', async function() { }); Handlebars.registerHelper('toLowerCase', function(str) { - return str.toLowerCase(); + try { + return str.toLowerCase(); + } catch (error) { + return ""; + } }); Handlebars.registerHelper('toUpperCase', function(str) { - return str.toUpperCase(); + try { + return str.toUpperCase(); + } catch (error) { + return ""; + } }); Handlebars.registerHelper('if_eq', function(a, b, opts) { @@ -59,10 +67,15 @@ Hooks.once('init', async function() { }); Handlebars.registerHelper('getActorSkillProp', function(actorData, skillName, prop) { - let skills = actorData.skills; - let skill = skills[skillName]; - let propVal = skill[prop]; - return propVal; + if(skillName != "" && prop != ""){ + let skills = actorData.skills; + let skill = skills[skillName]; + let propVal = skill[prop]; + return propVal; + } + else{ + return ""; + } }); }); diff --git a/template.json b/template.json index f2ad219..da4f1e2 100644 --- a/template.json +++ b/template.json @@ -377,7 +377,8 @@ "templates": [ "base" ], - "armor": 3 + "armor": 3, + "equipped": true } } } \ No newline at end of file diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 683ac43..51b263a 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -135,27 +135,43 @@ {{!-- Owned Items Tab --}}
-
    +
    +

    WEAPONS

    +
      +
    1. Name
      Skill
      +
      Damage
      +
      Lethality
    2. - {{#each actor.items as |item id|}} -
    3. -
      -

      {{item.name}}

      - {{getActorSkillProp ../data item.data.skill 'label'}} -
      - - -
      -
    4. - {{/each}} -
    + + {{#each actor.items as |item id|}} + {{#if_eq item.type 'weapon'}} + +
  1. +
    +

    {{item.name}}

    + {{getActorSkillProp ../data item.data.skill 'label'}} + {{toUpperCase item.data.damage}} + {{item.data.lethality}}% +
    + + +
    +
  2. + + {{/if_eq}} + {{/each}} +
+
+
+

ARMOR

+
{{!-- Biography Tab --}} diff --git a/templates/item/item-weapon-sheet.html b/templates/item/item-weapon-sheet.html index 6af802c..6761efa 100644 --- a/templates/item/item-weapon-sheet.html +++ b/templates/item/item-weapon-sheet.html @@ -14,7 +14,11 @@
- + +
+
+ +