Skip to content

Commit 8582ad2

Browse files
authored
Merge pull request #169 from vtt-lair/feat/fail_buttons
add fail button to ability, save and skill rolls
2 parents 5d01d4b + b4395d7 commit 8582ad2

File tree

6 files changed

+218
-13
lines changed

6 files changed

+218
-13
lines changed

css/lmrtfy.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ form .form-group .lmrtfy-skill-checks {
130130
}
131131

132132
.lmrtfy-ability-check,
133+
.lmrtfy-ability-check-fail,
133134
.lmrtfy-ability-save,
135+
.lmrtfy-ability-save-fail,
134136
.lmrtfy-skill-check,
137+
.lmrtfy-skill-check-fail,
135138
.lmrtfy-custom-formula,
136139
.lmrtfy-initiative,
137140
.lmrtfy-death-save,
@@ -142,8 +145,11 @@ form .form-group .lmrtfy-skill-checks {
142145
margin-top: 4px;
143146
}
144147
.lmrtfy-parchment .lmrtfy-ability-check,
148+
.lmrtfy-parchment .lmrtfy-ability-check-fail,
145149
.lmrtfy-parchment .lmrtfy-ability-save,
150+
.lmrtfy-parchment .lmrtfy-ability-save-fail,
146151
.lmrtfy-parchment .lmrtfy-skill-check,
152+
.lmrtfy-parchment .lmrtfy-skill-check-fail,
147153
.lmrtfy-parchment .lmrtfy-custom-formula,
148154
.lmrtfy-parchment .lmrtfy-initiative,
149155
.lmrtfy-parchment .lmrtfy-death-save,
@@ -156,6 +162,15 @@ form .form-group .lmrtfy-skill-checks {
156162
height: 78px;
157163
}
158164

165+
.enable-lmrtfy-ability-check-fail,
166+
.enable-lmrtfy-ability-save-fail,
167+
.enable-lmrtfy-skill-check-fail {
168+
width: 10%;
169+
position: absolute !important;
170+
margin-top: -57px !important;
171+
right: 27px;
172+
}
173+
159174
.lmrtfy-roller button:disabled {
160175
opacity: 0.5;
161176
}
@@ -210,7 +225,8 @@ form .form-group .lmrtfy-skill-checks {
210225
transition: all ease-in-out 0.25s;
211226
position: relative;
212227
margin: 6px;
213-
border-radius: 5px
228+
border-radius: 5px;
229+
cursor: pointer;
214230
}
215231

216232
.lmrtfy-bonus-button {
@@ -396,3 +412,14 @@ form .form-group .lmrtfy-skill-checks {
396412
.system-pf1 form .form-group .lmrtfy-skill-checks {
397413
max-height: 600px;
398414
}
415+
416+
.disabled-button {
417+
cursor: default !important;
418+
filter: opacity(0.5) !important;
419+
}
420+
421+
.disabled-button:hover {
422+
color: #000 !important;
423+
border-color: #000 !important;
424+
box-shadow: 0 0 6px inset #8d9ea7 !important;
425+
}

lang/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,9 @@
5959
"LMRTFY.SelectedNotification": "The selected user can only be used with 'Save Request as Macro'",
6060
"LMRTFY.Macros": "For Macros",
6161
"LMRTFY.Users": "Users",
62-
"LMRTFY.NoSelectedToken": "Token(s) needs to be selected before the macro can be run"
62+
"LMRTFY.NoSelectedToken": "Token(s) needs to be selected before the macro can be run",
63+
"LMRTFY.SavingThrowFail": "FAIL Saving Throw: ",
64+
"LMRTFY.AbilityCheckFail": "FAIL Ability Check: ",
65+
"LMRTFY.SkillCheckFail": "FAIL Skill Check: ",
66+
"LMRTFY.EnableChooseFail": "Enable Fail Button"
6367
}

src/lmrtfy.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class LMRTFY {
6666
LMRTFY.abilityAbbreviations = CONFIG.DND5E.abilityAbbreviations;
6767
LMRTFY.modIdentifier = 'mod';
6868
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
69+
LMRTFY.canFailChecks = true;
6970
break;
7071

7172
case 'pf1':
@@ -82,6 +83,7 @@ class LMRTFY {
8283
LMRTFY.abilityAbbreviations = CONFIG.PF1.abilitiesShort;
8384
LMRTFY.modIdentifier = 'mod';
8485
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
86+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
8587
break;
8688

8789
case 'pf2e':
@@ -98,6 +100,7 @@ class LMRTFY {
98100
LMRTFY.abilityAbbreviations = CONFIG.PF2E.abilities;
99101
LMRTFY.modIdentifier = 'mod';
100102
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
103+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
101104
break;
102105

103106
case 'D35E':
@@ -114,6 +117,7 @@ class LMRTFY {
114117
LMRTFY.abilityAbbreviations = CONFIG.D35E.abilityAbbreviations;
115118
LMRTFY.modIdentifier = 'mod';
116119
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
120+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
117121
break;
118122

119123
case 'cof':
@@ -129,6 +133,7 @@ class LMRTFY {
129133
LMRTFY.abilityAbbreviations = CONFIG.COF.statAbbreviations;
130134
LMRTFY.modIdentifier = 'mod';
131135
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
136+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
132137
break;
133138

134139
case 'coc':
@@ -144,6 +149,7 @@ class LMRTFY {
144149
LMRTFY.abilityAbbreviations = CONFIG.COC.statAbbreviations;
145150
LMRTFY.modIdentifier = 'mod';
146151
LMRTFY.abilityModifiers = LMRTFY.parseAbilityModifiers();
152+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
147153
break;
148154

149155
case 'demonlord':
@@ -162,6 +168,7 @@ class LMRTFY {
162168
LMRTFY.abilityAbbreviations = abilities;
163169
LMRTFY.modIdentifier = 'modifier';
164170
LMRTFY.abilityModifiers = {};
171+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
165172
break;
166173

167174
case 'ose':
@@ -180,6 +187,7 @@ class LMRTFY {
180187
LMRTFY.specialRolls = {};
181188
LMRTFY.modIdentifier = 'modifier';
182189
LMRTFY.abilityModifiers = {};
190+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
183191
break;
184192

185193
case 'foundry-chromatic-dungeons':
@@ -191,13 +199,31 @@ class LMRTFY {
191199
LMRTFY.skills = {};
192200
LMRTFY.saves = CONFIG.CHROMATIC.saves;
193201
LMRTFY.specialRolls = {};
202+
LMRTFY.canFailChecks = false; // unsure if how and if system could handle this
194203
break;
195204

196205
default:
197206
console.error('LMRFTY | Unsupported system detected');
198207

199208
}
200209

210+
LMRTFY.d20Svg = '<svg class="lmrtfy-dice-svg-normal" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"' +
211+
'viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">' +
212+
'<g transform="translate(-246.69456,-375.66745)">' +
213+
'<path d="M278.2,382.1c-0.1,0-0.2,0-0.3,0.1L264.8,398c-0.2,0.3-0.2,0.3,0.1,0.3l26.4-0.1c0.4,0,0.4,0,0.1-0.3l-13-15.8' +
214+
'C278.4,382.1,278.3,382.1,278.2,382.1L278.2,382.1z M280.7,383.5l11.9,14.5c0.2,0.2,0.2,0.2,0.5,0.1l6.3-2.9' +
215+
'c0.4-0.2,0.4-0.2,0.1-0.4L280.7,383.5z M275.2,384c0,0-0.1,0.1-0.3,0.2l-17.3,11.4l5.4,2.5c0.3,0.1,0.4,0.1,0.5-0.1l11.4-13.6' +
216+
'C275.1,384.1,275.2,384,275.2,384L275.2,384z M300.3,395.8c-0.1,0-0.1,0-0.3,0.1l-6.4,2.9c-0.2,0.1-0.2,0.2-0.1,0.4l7.5,19' +
217+
'l-0.5-22.1C300.4,395.9,300.4,395.8,300.3,395.8L300.3,395.8z M257.1,396.4l-0.7,21.5l6.3-18.6c0.1-0.3,0.1-0.3-0.1-0.4' +
218+
'L257.1,396.4L257.1,396.4z M291.6,399.2l-27,0.1c-0.4,0-0.4,0-0.2,0.3l13.7,23.1c0.2,0.4,0.2,0.3,0.4,0l13.2-23.2' +
219+
'C291.9,399.3,291.9,399.2,291.6,399.2L291.6,399.2z M292.7,399.8c0,0-0.1,0.1-0.1,0.2l-13.3,23.3c-0.1,0.2-0.2,0.3,0.2,0.3' +
220+
'l21.1-2.9c0.3-0.1,0.3-0.2,0.2-0.5l-7.9-20.2C292.7,399.9,292.7,399.8,292.7,399.8L292.7,399.8z M263.6,400c0,0,0,0.1-0.1,0.3' +
221+
'l-6.7,19.8c-0.1,0.4-0.1,0.6,0.3,0.7l20.1,2.9c0.4,0.1,0.3-0.1,0.2-0.3l-13.7-23.1C263.6,400,263.6,400,263.6,400L263.6,400z' +
222+
'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' +
223+
'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"/>' +
224+
'</g>' +
225+
'</svg>'
226+
201227
if (game.settings.get('lmrtfy', 'deselectOnRequestorRender')) {
202228
Hooks.on("renderLMRTFYRequestor", () => {
203229
canvas.tokens.releaseAll();

src/requestor.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ class LMRTFYRequestor extends FormApplication {
330330

331331
let dc = undefined;
332332
if (game.system.id === 'pf2e') {
333-
if (Number.isInteger(formData.dc)) {
333+
if (Number.isInteger(parseInt(formData.dc))) {
334334
dc = {
335-
value: formData.dc,
335+
value: parseInt(formData.dc),
336336
visibility: formData.visibility
337337
}
338338
}
@@ -354,6 +354,7 @@ class LMRTFYRequestor extends FormApplication {
354354
perception: formData['extra-perception'],
355355
tables: tables,
356356
chooseOne: formData['choose-one'],
357+
canFailChecks: LMRTFY.canFailChecks,
357358
}
358359
if (game.system.id === 'pf2e' && dc) {
359360
socketData['dc'] = dc;

0 commit comments

Comments
 (0)