Skip to content

Commit

Permalink
Merge pull request #177 from vtt-lair/hide_button
Browse files Browse the repository at this point in the history
add setting to fail button that allows you to hide or display it
  • Loading branch information
vtt-lair authored Jan 31, 2023
2 parents 7f13312 + 02066d6 commit c051b7e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@
"LMRTFY.SavingThrowFail": "FAIL Saving Throw: ",
"LMRTFY.AbilityCheckFail": "FAIL Ability Check: ",
"LMRTFY.SkillCheckFail": "FAIL Skill Check: ",
"LMRTFY.EnableChooseFail": "Enable Fail Button"
"LMRTFY.EnableChooseFail": "Enable Fail Button",
"LMRTFY.ShowFailButtons": "Show Fail Button",
"LMRTFY.ShowFailButtonsHint": "Show fail buttons for ability checks, ability saves and skill the requested roll form"
}
32 changes: 23 additions & 9 deletions src/lmrtfy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ class LMRTFY {
onChange: () => window.location.reload()
});

var showFailButtonSetting = false;
if (game.system.id === 'dnd5e') {
showFailButtonSetting = true;
}
game.settings.register('lmrtfy', 'showFailButtons', {
name: game.i18n.localize('LMRTFY.ShowFailButtons'),
hint: game.i18n.localize('LMRTFY.ShowFailButtonsHint'),
scope: 'world',
config: showFailButtonSetting,
type: Boolean,
default: showFailButtonSetting, // if it's DnD 5e default to true
onChange: () => window.location.reload()
});

Handlebars.registerHelper('lmrtfy-controlledToken', function (actor) {
const actorsControlledToken = canvas.tokens?.controlled.find(t => t.actor.id === actor.id);
if (actorsControlledToken) {
Expand Down Expand Up @@ -66,7 +80,7 @@ class LMRTFY {
LMRTFY.abilityAbbreviations = CONFIG.DND5E.abilityAbbreviations;
LMRTFY.modIdentifier = 'mod';
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
LMRTFY.canFailChecks = true;
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons');
break;

case 'pf1':
Expand All @@ -83,7 +97,7 @@ class LMRTFY {
LMRTFY.abilityAbbreviations = CONFIG.PF1.abilitiesShort;
LMRTFY.modIdentifier = 'mod';
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

case 'pf2e':
Expand All @@ -100,7 +114,7 @@ class LMRTFY {
LMRTFY.abilityAbbreviations = CONFIG.PF2E.abilities;
LMRTFY.modIdentifier = 'mod';
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

case 'D35E':
Expand All @@ -117,7 +131,7 @@ class LMRTFY {
LMRTFY.abilityAbbreviations = CONFIG.D35E.abilityAbbreviations;
LMRTFY.modIdentifier = 'mod';
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

case 'cof':
Expand All @@ -133,7 +147,7 @@ class LMRTFY {
LMRTFY.abilityAbbreviations = CONFIG.COF.statAbbreviations;
LMRTFY.modIdentifier = 'mod';
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

case 'coc':
Expand All @@ -149,7 +163,7 @@ class LMRTFY {
LMRTFY.abilityAbbreviations = CONFIG.COC.statAbbreviations;
LMRTFY.modIdentifier = 'mod';
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

case 'demonlord':
Expand All @@ -168,7 +182,7 @@ class LMRTFY {
LMRTFY.abilityAbbreviations = abilities;
LMRTFY.modIdentifier = 'modifier';
LMRTFY.abilityModifiers = {};
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

case 'ose':
Expand All @@ -187,7 +201,7 @@ class LMRTFY {
LMRTFY.specialRolls = {};
LMRTFY.modIdentifier = 'modifier';
LMRTFY.abilityModifiers = {};
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

case 'foundry-chromatic-dungeons':
Expand All @@ -199,7 +213,7 @@ class LMRTFY {
LMRTFY.skills = {};
LMRTFY.saves = CONFIG.CHROMATIC.saves;
LMRTFY.specialRolls = {};
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
LMRTFY.canFailChecks = game.settings.get('lmrtfy', 'showFailButtons'); // defaulted to false due to system
break;

default:
Expand Down

0 comments on commit c051b7e

Please sign in to comment.