Skip to content

Commit

Permalink
Merge pull request #170 from vtt-lair/feat/fail_buttons
Browse files Browse the repository at this point in the history
disable fail buttons for midi until midi has patched issue
  • Loading branch information
vtt-lair authored Jan 22, 2023
2 parents 8582ad2 + 76a0876 commit 75888a4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/lmrtfy.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ class LMRTFY {
'M258.3,421.9l19.7,11.2c0.3,0.2,0.3,0.1,0.3-0.2l-0.4-7.9c0-0.3,0-0.4-0.3-0.4L258.3,421.9L258.3,421.9z M299.1,421.9l-20,2.8' +
'c-0.3,0-0.2,0.2-0.2,0.4l0.4,8c0,0.2,0,0.3,0.3,0.2L299.1,421.9z"/>' +
'</g>' +
'</svg>'
'</svg>';

// for now we don't allow can fails until midi-qol has update patching.js
if (game.modules.get('midi-qol')) {
LMRTFY.canFailChecks = false;
}

if (game.settings.get('lmrtfy', 'deselectOnRequestorRender')) {
Hooks.on("renderLMRTFYRequestor", () => {
Expand Down
47 changes: 42 additions & 5 deletions src/roller.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,42 +471,79 @@ class LMRTFYRoller extends Application {
event.preventDefault();
const ability = event.currentTarget.dataset.ability;
if (game.system.id === 'pf2e') this.pf2Roll = this.pf2eRollFor.ABILITY;
this._makeRoll(event, LMRTFY.abilityRollMethod, false, ability);

// for now we don't allow can fails until midi-qol has update patching.js
if (game.modules.get('midi-qol')) {
this._makeRoll(event, LMRTFY.abilityRollMethod, ability);
} else {
this._makeRoll(event, LMRTFY.abilityRollMethod, false, ability);
}
}

_onFailAbilityCheck(event) {
event.preventDefault();
const ability = event.currentTarget.dataset.ability;
if (game.system.id === 'pf2e') this.pf2Roll = this.pf2eRollFor.ABILITY;
this._makeRoll(event, LMRTFY.abilityRollMethod, true, ability);

// for now we don't allow can fails until midi-qol has update patching.js
if (game.modules.get('midi-qol')) {
this._makeRoll(event, LMRTFY.abilityRollMethod, ability);
} else {
this._makeRoll(event, LMRTFY.abilityRollMethod, true, ability);
}
}

_onAbilitySave(event) {
event.preventDefault();
const saves = event.currentTarget.dataset.ability;
if (game.system.id === 'pf2e') this.pf2Roll = this.pf2eRollFor.SAVE;
this._makeRoll(event, LMRTFY.saveRollMethod, false, saves);

// for now we don't allow can fails until midi-qol has update patching.js
if (game.modules.get('midi-qol')) {
this._makeRoll(event, LMRTFY.saveRollMethod, saves);
} else {
this._makeRoll(event, LMRTFY.saveRollMethod, false, saves);
}
}

_onFailAbilitySave(event) {
event.preventDefault();
const saves = event.currentTarget.dataset.ability;
if (game.system.id === 'pf2e') this.pf2Roll = this.pf2eRollFor.SAVE;
this._makeRoll(event, LMRTFY.saveRollMethod, true, saves);

// for now we don't allow can fails until midi-qol has update patching.js
if (game.modules.get('midi-qol')) {
this._makeRoll(event, LMRTFY.saveRollMethod, saves);
} else {
this._makeRoll(event, LMRTFY.saveRollMethod, true, saves);
}
}

_onSkillCheck(event) {
event.preventDefault();
const skill = event.currentTarget.dataset.skill;
if (game.system.id === 'pf2e') this.pf2Roll = this.pf2eRollFor.SKILL;
this._makeRoll(event, LMRTFY.skillRollMethod, false, skill);

// for now we don't allow can fails until midi-qol has update patching.js
if (game.modules.get('midi-qol')) {
this._makeRoll(event, LMRTFY.skillRollMethod, skill);
} else {
this._makeRoll(event, LMRTFY.skillRollMethod, false, skill);
}
}

_onFailSkillCheck(event) {
event.preventDefault();
const skill = event.currentTarget.dataset.skill;
if (game.system.id === 'pf2e') this.pf2Roll = this.pf2eRollFor.SKILL;
this._makeRoll(event, LMRTFY.skillRollMethod, true, skill);

// for now we don't allow can fails until midi-qol has update patching.js
if (game.modules.get('midi-qol')) {
this._makeRoll(event, LMRTFY.skillRollMethod, skill);
} else {
this._makeRoll(event, LMRTFY.skillRollMethod, true, skill);
}
}

async _onCustomFormula(event) {
Expand Down

0 comments on commit 75888a4

Please sign in to comment.