diff --git a/module/blades-actor.js b/module/blades-actor.js index c930824..8a1df31 100644 --- a/module/blades-actor.js +++ b/module/blades-actor.js @@ -1,4 +1,5 @@ import { bladesRoll } from "./blades-roll.js"; +import { BladesHelpers } from "./blades-helpers.js"; /** * Extend the basic Actor @@ -43,11 +44,14 @@ export class BladesActor extends Actor { /* -------------------------------------------- */ rollAttributePopup(attribute_name) { + // const roll = new Roll("1d20 + @abilities.wis.mod", actor.getRollData()); + let attribute_label = BladesHelpers.getAttributeLabel(attribute_name); + new Dialog({ - title: `Roll ${attribute_name}`, + title: `${game.i18n.localize('BITD.Roll')} ${game.i18n.localize(attribute_label)}`, content: ` -

Roll ${attribute_name}

+

${game.i18n.localize('BITD.Roll')} ${game.i18n.localize(attribute_label)}

@@ -76,7 +80,7 @@ export class BladesActor extends Actor { buttons: { yes: { icon: "", - label: `Roll`, + label: game.i18n.localize('BITD.Roll'), callback: (html) => { let modifier = parseInt(html.find('[name="mod"]')[0].value); let position = html.find('[name="pos"]')[0].value; @@ -86,7 +90,7 @@ export class BladesActor extends Actor { }, no: { icon: "", - label: `Close`, + label: game.i18n.localize('Close'), }, }, default: "yes", diff --git a/module/blades-helpers.js b/module/blades-helpers.js index 560be31..7aeed97 100644 --- a/module/blades-helpers.js +++ b/module/blades-helpers.js @@ -198,4 +198,28 @@ export class BladesHelpers { /* -------------------------------------------- */ + /** + * Returns the label for attribute. + * + * @param {string} attribute_name + * @returns {string} + */ + static getAttributeLabel(attribute_name) { + // Calculate Dice to throw. + let attribute_labels = {}; + const attributes = game.system.model.Actor.character.attributes; + + for (var attibute_name in attributes) { + attribute_labels[attibute_name] = attributes[attibute_name].label; + for (var skill_name in attributes[attibute_name].skills) { + attribute_labels[skill_name] = attributes[attibute_name].skills[skill_name].label; + } + + } + + return attribute_labels[attribute_name]; + } + + /* -------------------------------------------- */ + } diff --git a/module/blades-roll.js b/module/blades-roll.js index 8aaab93..8f207bb 100644 --- a/module/blades-roll.js +++ b/module/blades-roll.js @@ -49,6 +49,7 @@ async function showChatRollMessage(r, zeromode, attribute_name = "", position = let speaker = ChatMessage.getSpeaker(); let isBelow070 = isNewerVersion('0.7.0', game.data.version); let rolls = []; + let attribute_label = BladesHelpers.getAttributeLabel(attribute_name); // Backward Compat for rolls. if (isBelow070) { @@ -86,7 +87,7 @@ async function showChatRollMessage(r, zeromode, attribute_name = "", position = effect_localize = 'BITD.EffectStandard' } - let result = await renderTemplate("systems/blades-in-the-dark/templates/blades-roll.html", {rolls: rolls, roll_status: roll_status, attribute_name: attribute_name, position: position_localize, effect: effect_localize}); + let result = await renderTemplate("systems/blades-in-the-dark/templates/blades-roll.html", {rolls: rolls, roll_status: roll_status, attribute_label: attribute_label, position: position_localize, effect: effect_localize}); let messageData = { speaker: speaker, diff --git a/system.json b/system.json index e79af42..3ab1901 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "blades-in-the-dark", "title": "Blades in the Dark", "description": "Blades in the dark game system.", - "version": "1.0", + "version": "1.1", "minimumCoreVersion": "0.5.3", "compatibleCoreVersion": "0.7.0", "templateVersion": 1, @@ -26,8 +26,8 @@ } ], "url": "https://github.com/megastruktur/foundryvtt-blades-in-the-dark/", - "manifest": "https://raw.githubusercontent.com/megastruktur/foundryvtt-blades-in-the-dark/1.0/system.json", - "download": "https://github.com/megastruktur/foundryvtt-blades-in-the-dark/archive/1.0.zip", + "manifest": "https://raw.githubusercontent.com/megastruktur/foundryvtt-blades-in-the-dark/1.1/system.json", + "download": "https://github.com/megastruktur/foundryvtt-blades-in-the-dark/archive/1.1.zip", "packs": [ { "name": "class", diff --git a/templates/blades-roll.html b/templates/blades-roll.html index cdc6001..cc163c8 100644 --- a/templates/blades-roll.html +++ b/templates/blades-roll.html @@ -1,5 +1,5 @@
- {{#if attribute_name}}
{{attribute_name}}
{{/if}} + {{#if attribute_label}}
{{localize attribute_label}}
{{/if}} {{#if position}}
{{{localize position}}} | {{{localize effect}}}