Skip to content

Commit 8d2206e

Browse files
authored
Merge pull request #185 from PwQt/master
Modify 5e abilities to use new data structure
2 parents 024c88b + 6239ae4 commit 8d2206e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/lmrtfy.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ class LMRTFY {
7070
LMRTFY.saveRollMethod = 'rollAbilitySave';
7171
LMRTFY.abilityRollMethod = 'rollAbilityTest';
7272
LMRTFY.skillRollMethod = 'rollSkill';
73-
LMRTFY.abilities = CONFIG.DND5E.abilities;
73+
LMRTFY.abilities = LMRTFY.create5eAbilities();
7474
LMRTFY.skills = CONFIG.DND5E.skills;
75-
LMRTFY.saves = CONFIG.DND5E.abilities;
75+
LMRTFY.saves = LMRTFY.create5eAbilities();
7676
LMRTFY.normalRollEvent = { shiftKey: true, altKey: false, ctrlKey: false };
7777
LMRTFY.advantageRollEvent = { shiftKey: false, altKey: true, ctrlKey: false };
7878
LMRTFY.disadvantageRollEvent = { shiftKey: false, altKey: false, ctrlKey: true };
7979
LMRTFY.specialRolls = { 'initiative': true, 'deathsave': true };
80-
LMRTFY.abilityAbbreviations = CONFIG.DND5E.abilityAbbreviations;
80+
LMRTFY.abilityAbbreviations = LMRTFY.create5eAbilities();
8181
LMRTFY.modIdentifier = 'mod';
8282
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
8383
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons');
@@ -305,6 +305,18 @@ class LMRTFY {
305305

306306
return abilityMods;
307307
}
308+
309+
static create5eAbilities() {
310+
let abbr = {};
311+
312+
for (let key in CONFIG.DND5E.abilities) {
313+
let abb = game.i18n.localize(CONFIG.DND5E.abilities[key].abbreviation);
314+
let upperFirstLetter = abb.charAt(0).toUpperCase() + abb.slice(1);
315+
abbr[`${abb}`] = `DND5E.Ability${upperFirstLetter}`;
316+
}
317+
318+
return abbr;
319+
}
308320

309321
static onMessage(data) {
310322
//console.log("LMRTF got message: ", data)

0 commit comments

Comments
 (0)