Fix attribute translations for Roll
This commit is contained in:
parent
701e645f2a
commit
753af8667a
5 changed files with 38 additions and 9 deletions
|
@ -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: `
|
||||
<h2>Roll ${attribute_name}</h2>
|
||||
<h2>${game.i18n.localize('BITD.Roll')} ${game.i18n.localize(attribute_label)}</h2>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label>${game.i18n.localize('BITD.Modifier')}:</label>
|
||||
|
@ -76,7 +80,7 @@ export class BladesActor extends Actor {
|
|||
buttons: {
|
||||
yes: {
|
||||
icon: "<i class='fas fa-check'></i>",
|
||||
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: "<i class='fas fa-times'></i>",
|
||||
label: `Close`,
|
||||
label: game.i18n.localize('Close'),
|
||||
},
|
||||
},
|
||||
default: "yes",
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="dice-tooltip blades-die-tooltip">
|
||||
{{#if attribute_name}}<div class="chat-label label-stripe-chat">{{attribute_name}}</div>{{/if}}
|
||||
{{#if attribute_label}}<div class="chat-label label-stripe-chat">{{localize attribute_label}}</div>{{/if}}
|
||||
{{#if position}}
|
||||
<div class="chat-label-small label-stripe-chat-small">
|
||||
{{{localize position}}} | {{{localize effect}}}
|
||||
|
|
Reference in a new issue