diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index d0f904c..bdf7c9c 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -347,6 +347,20 @@ export class DeltaGreenActorSheet extends ActorSheet { targetVal = dataset.target; label = game.i18n.localize(label).toUpperCase(); } + else if(rollType === "weaponskill"){ + targetVal = dataset.target; + + // some weapons randomly can just use dexterity x5, so try to trap on that + // otherwise roll a regular skill test + if(targetVal === "dex"){ + label = game.i18n.localize("DG.Attributes.dex"); + targetVal = this.actor.data.data.statistics.dex.x5; + } + else{ + label = game.i18n.localize("DG.Skills." + targetVal); + targetVal = this.actor.data.data.skills[targetVal].proficiency; + } + } else if(dataset.target === "statistic.x5"){ let stat = this.actor.data.data.statistics[key]; targetVal = stat.x5; diff --git a/module/deltagreen.js b/module/deltagreen.js index 70924e2..7850802 100644 --- a/module/deltagreen.js +++ b/module/deltagreen.js @@ -157,6 +157,24 @@ Hooks.once('init', async function() { } }); + Handlebars.registerHelper('localizeWeaponSkill', function(skill) { + let label = skill; + + try { + + if(skill === 'dex'){ + label = game.i18n.localize("DG.Attributes.dex"); + } + else{ + label = game.i18n.localize("DG.Skills." + skill); + } + } catch (error) { + console.log(error); + } + + return label; + }); + // looks at system setting for what font to use and returns the class that is then used in the handlebars template that // generates the character sheet. Handlebars.registerHelper('getFontFamilySystemSettingClass', function() { diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 0360605..744f97b 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -266,10 +266,10 @@ class="item-name rollable" data-roll="d100" - data-rolltype="skill" - data-target="{{getActorSkillProp ../data item.data.data.skill 'proficiency'}}" - data-label="{{localize (concat 'DG.Skills.' item.data.data.skill)}}" - title="{{localize 'DG.Tooltip.SkillLabel'}} ({{localize (concat 'DG.Skills.' item.data.data.skill)}})" + data-rolltype="weaponskill" + data-target="{{item.data.data.skill}}" + data-label="{{localizeWeaponSkill item.data.data.skill}}" + title="{{localize 'DG.Tooltip.SkillLabel'}} ({{localizeWeaponSkill item.data.data.skill}})" > {{item.name}} diff --git a/templates/item/item-weapon-sheet.html b/templates/item/item-weapon-sheet.html index 0680839..effa40f 100644 --- a/templates/item/item-weapon-sheet.html +++ b/templates/item/item-weapon-sheet.html @@ -37,9 +37,8 @@ - - - + + {{localize 'DG.ItemWindow.Weapons.IsLethality'}}: