Skip to content

Commit

Permalink
Merge pull request #185 from PwQt/master
Browse files Browse the repository at this point in the history
Modify 5e abilities to use new data structure
  • Loading branch information
vtt-lair authored Jun 10, 2023
2 parents 024c88b + 6239ae4 commit 8d2206e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/lmrtfy.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ class LMRTFY {
LMRTFY.saveRollMethod = 'rollAbilitySave';
LMRTFY.abilityRollMethod = 'rollAbilityTest';
LMRTFY.skillRollMethod = 'rollSkill';
LMRTFY.abilities = CONFIG.DND5E.abilities;
LMRTFY.abilities = LMRTFY.create5eAbilities();
LMRTFY.skills = CONFIG.DND5E.skills;
LMRTFY.saves = CONFIG.DND5E.abilities;
LMRTFY.saves = LMRTFY.create5eAbilities();
LMRTFY.normalRollEvent = { shiftKey: true, altKey: false, ctrlKey: false };
LMRTFY.advantageRollEvent = { shiftKey: false, altKey: true, ctrlKey: false };
LMRTFY.disadvantageRollEvent = { shiftKey: false, altKey: false, ctrlKey: true };
LMRTFY.specialRolls = { 'initiative': true, 'deathsave': true };
LMRTFY.abilityAbbreviations = CONFIG.DND5E.abilityAbbreviations;
LMRTFY.abilityAbbreviations = LMRTFY.create5eAbilities();
LMRTFY.modIdentifier = 'mod';
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons');
Expand Down Expand Up @@ -305,6 +305,18 @@ class LMRTFY {

return abilityMods;
}

static create5eAbilities() {
let abbr = {};

for (let key in CONFIG.DND5E.abilities) {
let abb = game.i18n.localize(CONFIG.DND5E.abilities[key].abbreviation);
let upperFirstLetter = abb.charAt(0).toUpperCase() + abb.slice(1);
abbr[`${abb}`] = `DND5E.Ability${upperFirstLetter}`;
}

return abbr;
}

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

0 comments on commit 8d2206e

Please sign in to comment.