Get the delve conditions editable
This commit is contained in:
parent
110823a26b
commit
155685a6c3
3 changed files with 29 additions and 2 deletions
|
|
@ -64,7 +64,8 @@
|
||||||
"easy": "Easy",
|
"easy": "Easy",
|
||||||
"normal": "Normal",
|
"normal": "Normal",
|
||||||
"tough": "Tough",
|
"tough": "Tough",
|
||||||
"hard": "Hard"
|
"hard": "Hard",
|
||||||
|
"random": "Random Condition"
|
||||||
},
|
},
|
||||||
"drag": "Drag",
|
"drag": "Drag",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { localizer } from "../utils/Localizer.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
|
const { ContextMenu } = foundry.applications.ui;
|
||||||
const { FatePath } = gameTerms;
|
const { FatePath } = gameTerms;
|
||||||
|
|
||||||
const CompassRotations = {
|
const CompassRotations = {
|
||||||
|
|
@ -96,6 +97,25 @@ export class DelveDiceHUD extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
|
||||||
// Shortcut because users can't edit
|
// Shortcut because users can't edit
|
||||||
if (!game.user.isGM) { return };
|
if (!game.user.isGM) { return };
|
||||||
|
|
||||||
|
new ContextMenu(
|
||||||
|
this.element,
|
||||||
|
`#delve-difficulty`,
|
||||||
|
[
|
||||||
|
...conditions.map(condition => ({
|
||||||
|
name: localizer(condition.label),
|
||||||
|
callback: DelveDiceHUD.#setDifficulty.bind(this, condition.value),
|
||||||
|
})),
|
||||||
|
{
|
||||||
|
name: localizer(`RipCrypt.common.difficulties.random`),
|
||||||
|
callback: () => {
|
||||||
|
const condition = conditions[Math.floor(Math.random() * conditions.length)];
|
||||||
|
DelveDiceHUD.#setDifficulty.bind(this)(condition.value);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
{ jQuery: false, fixed: true },
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
async _preparePartContext(partId, ctx, opts) {
|
async _preparePartContext(partId, ctx, opts) {
|
||||||
|
|
@ -202,6 +222,12 @@ export class DelveDiceHUD extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
this.#animateCompassTo(fate);
|
this.#animateCompassTo(fate);
|
||||||
game.settings.set(`ripcrypt`, `currentFate`, fate);
|
game.settings.set(`ripcrypt`, `currentFate`, fate);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @this {DelveDiceHUD} */
|
||||||
|
static async #setDifficulty(value) {
|
||||||
|
this._difficulty = value;
|
||||||
|
game.settings.set(`ripcrypt`, `dc`, value);
|
||||||
|
};
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Public API
|
// #region Public API
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
class="icon-container"
|
class="icon-container"
|
||||||
data-tooltip="Difficulty: 8"
|
data-tooltip="Difficulty: 8"
|
||||||
>
|
>
|
||||||
<span class="large">8</span>
|
<span class="large">{{dc}}</span>
|
||||||
<rc-icon
|
<rc-icon
|
||||||
class="hourglass"
|
class="hourglass"
|
||||||
name="icons/d8-outline"
|
name="icons/d8-outline"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue