-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
801d6f1
commit 27b2a7c
Showing
5 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export default class RequestCheckSD extends FormApplication { | ||
|
||
static get defaultOptions() { | ||
return foundry.utils.mergeObject(super.defaultOptions, { | ||
classes: ["shadowdark"], | ||
template: "systems/shadowdark/templates/apps/request-check.hbs", | ||
width: 400, | ||
title: game.i18n.localize("SHADOWDARK.apps.request-check.title"), | ||
closeOnSubmit: false, | ||
}); | ||
} | ||
|
||
activateListeners(html) { | ||
super.activateListeners(html); | ||
|
||
html.find(".custom-dc").click( | ||
event => { | ||
$(event.target).siblings()[0].checked=true; | ||
} | ||
); | ||
} | ||
|
||
/** @override */ | ||
async getData() { | ||
return { | ||
stats: CONFIG.SHADOWDARK.ABILITIES_LONG, | ||
difficulty: { | ||
9: `9 (${game.i18n.localize("SHADOWDARK.apps.request-check.easy")})`, | ||
12: `12 (${game.i18n.localize("SHADOWDARK.apps.request-check.normal")})`, | ||
15: `15 (${game.i18n.localize("SHADOWDARK.apps.request-check.hard")})`, | ||
18: `18 (${game.i18n.localize("SHADOWDARK.apps.request-check.extreme")})`, | ||
}, | ||
}; | ||
} | ||
|
||
/** @inheritdoc */ | ||
async _updateObject(event, data) { | ||
|
||
if (data.custom) { | ||
data.difficulty = data.custom; | ||
} | ||
data.difficulty = parseInt(data.difficulty); | ||
|
||
switch (event.submitter.name) { | ||
case "request-copy": | ||
let linkText = `[[request ${data.difficulty} ${data.stat}]]`; | ||
await navigator.clipboard.writeText(linkText); | ||
ui.notifications.info(game.i18n.localize("SHADOWDARK.apps.request-check.copied")); | ||
break; | ||
case "request-check": | ||
shadowdark.checks.displayRequest(data.difficulty, data.stat); | ||
this.close(); | ||
break; | ||
default: | ||
shadowdark.log("Request Check Error"); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<form autocomplete="off"> | ||
<div class="grid-2-columns"> | ||
{{#> ui/sd-box | ||
header-label="Difficulty" | ||
}} | ||
<div class="grid-1-columns"> | ||
{{radioBoxes "difficulty" difficulty checked="12"}} | ||
<hr> | ||
<label class="checkbox"> | ||
<input type="radio" name="difficulty" value="0"> | ||
<input type="number" class="custom-dc" name="custom" style="width:2em;" maxlength="2"> | ||
({{localize "SHADOWDARK.apps.request-check.custom"}}) | ||
</label> | ||
</div> | ||
{{/ui/sd-box}} | ||
|
||
{{#> ui/sd-box | ||
header-label="Stat" | ||
}} | ||
<div class="grid-1-columns"> | ||
{{radioBoxes "stat" stats checked="str"}} | ||
</div> | ||
{{/ui/sd-box}} | ||
|
||
<hr class="grid-colspan-2"> | ||
|
||
<button class="grid-colspan-2" type="submit" name="request-copy">{{localize "SHADOWDARK.apps.request-check.copy_to_clipboard"}}</button> | ||
<button class="grid-colspan-2 larger" type="submit" name="request-check" style="font-family:'Old Newspaper Font';"> | ||
{{localize "SHADOWDARK.apps.request-check.title"}} | ||
</button> | ||
</div> | ||
</form> |