Clean-up after the old attempt at the crypt summary
This commit is contained in:
parent
155685a6c3
commit
69dac6a0df
4 changed files with 0 additions and 120 deletions
|
|
@ -1,104 +0,0 @@
|
||||||
import { filePath } from "../consts.mjs";
|
|
||||||
import { GenericAppMixin } from "./GenericApp.mjs";
|
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
|
||||||
|
|
||||||
const conditions = [
|
|
||||||
{ label: `RipCrypt.common.difficulties.easy`, value: 4 },
|
|
||||||
{ label: `RipCrypt.common.difficulties.normal`, value: 5 },
|
|
||||||
{ label: `RipCrypt.common.difficulties.tough`, value: 6 },
|
|
||||||
{ label: `RipCrypt.common.difficulties.hard`, value: 7 },
|
|
||||||
];
|
|
||||||
|
|
||||||
export class DelveTourApp extends GenericAppMixin(HandlebarsApplicationMixin(ApplicationV2)) {
|
|
||||||
// #region Options
|
|
||||||
static DEFAULT_OPTIONS = {
|
|
||||||
classes: [
|
|
||||||
`ripcrypt--CryptApp`,
|
|
||||||
],
|
|
||||||
window: {
|
|
||||||
title: `Delve Tour`,
|
|
||||||
frame: true,
|
|
||||||
positioned: true,
|
|
||||||
resizable: false,
|
|
||||||
minimizable: false,
|
|
||||||
},
|
|
||||||
position: {
|
|
||||||
width: `auto`,
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
randomCondition: this.#randomCondition,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static PARTS = {
|
|
||||||
turnCount: {
|
|
||||||
template: filePath(`templates/Apps/CryptApp/turnCount.hbs`),
|
|
||||||
},
|
|
||||||
delveConditions: {
|
|
||||||
template: filePath(`templates/Apps/CryptApp/delveConditions.hbs`),
|
|
||||||
},
|
|
||||||
fate: {
|
|
||||||
template: filePath(`templates/Apps/CryptApp/fate.hbs`),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Lifecycle
|
|
||||||
async _renderFrame(options) {
|
|
||||||
const frame = await super._renderFrame(options);
|
|
||||||
this.window.close.remove(); // Prevent closing
|
|
||||||
return frame;
|
|
||||||
};
|
|
||||||
|
|
||||||
async _onRender(context, options) {
|
|
||||||
await super._onRender(context, options);
|
|
||||||
|
|
||||||
// Shortcut because users can't edit
|
|
||||||
if (!game.user.isGM) { return };
|
|
||||||
|
|
||||||
// Add event listener for the dropdown
|
|
||||||
if (options.parts.includes(`delveConditions`)) {
|
|
||||||
const select = this.element.querySelector(`#${this.id}-difficulty`);
|
|
||||||
select.addEventListener(`change`, async (ev) => {
|
|
||||||
const newDifficulty = parseInt(ev.target.value);
|
|
||||||
if (!Number.isNaN(newDifficulty)) {
|
|
||||||
await game.settings.set(`ripcrypt`, `dc`, newDifficulty);
|
|
||||||
};
|
|
||||||
this.render({ parts: [`delveConditions`] });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
async _preparePartContext(partId, ctx, opts) {
|
|
||||||
ctx = await super._preparePartContext(partId, ctx, opts);
|
|
||||||
|
|
||||||
ctx.meta.editable = game.user.isGM;
|
|
||||||
|
|
||||||
switch (partId) {
|
|
||||||
case `delveConditions`: {
|
|
||||||
ctx = this._prepareDifficulty(ctx);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Logger.log(`${partId} Context`, ctx);
|
|
||||||
return ctx;
|
|
||||||
};
|
|
||||||
|
|
||||||
_prepareDifficulty(ctx) {
|
|
||||||
ctx.options = conditions;
|
|
||||||
ctx.difficulty = game.settings.get(`ripcrypt`, `dc`);
|
|
||||||
return ctx;
|
|
||||||
};
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Actions
|
|
||||||
static async #randomCondition() {
|
|
||||||
const dc = conditions[Math.floor(Math.random() * conditions.length)];
|
|
||||||
await game.settings.set(`ripcrypt`, `dc`, dc.value);
|
|
||||||
await this.render({ parts: [`delveConditions`] });
|
|
||||||
};
|
|
||||||
// #endregion
|
|
||||||
};
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
import { AllItemSheetV1 } from "../Apps/ItemSheets/AllItemSheetV1.mjs";
|
import { AllItemSheetV1 } from "../Apps/ItemSheets/AllItemSheetV1.mjs";
|
||||||
import { CombinedHeroSheet } from "../Apps/ActorSheets/CombinedHeroSheet.mjs";
|
import { CombinedHeroSheet } from "../Apps/ActorSheets/CombinedHeroSheet.mjs";
|
||||||
import { DelveDiceHUD } from "../Apps/DelveDiceHUD.mjs";
|
import { DelveDiceHUD } from "../Apps/DelveDiceHUD.mjs";
|
||||||
import { DelveTourApp } from "../Apps/DelveTourApp.mjs";
|
|
||||||
import { HeroSkillsCardV1 } from "../Apps/ActorSheets/HeroSkillsCardV1.mjs";
|
import { HeroSkillsCardV1 } from "../Apps/ActorSheets/HeroSkillsCardV1.mjs";
|
||||||
import { HeroSummaryCardV1 } from "../Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
import { HeroSummaryCardV1 } from "../Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
||||||
import { RipCryptCombatTracker } from "../Apps/sidebar/CombatTracker.mjs";
|
import { RipCryptCombatTracker } from "../Apps/sidebar/CombatTracker.mjs";
|
||||||
|
|
@ -39,9 +38,7 @@ Hooks.once(`init`, () => {
|
||||||
Logger.log(`Initializing`);
|
Logger.log(`Initializing`);
|
||||||
|
|
||||||
CONFIG.Combat.initiative.decimals = 2;
|
CONFIG.Combat.initiative.decimals = 2;
|
||||||
CONFIG.ui.crypt = DelveTourApp;
|
|
||||||
CONFIG.ui.delveDice = DelveDiceHUD;
|
CONFIG.ui.delveDice = DelveDiceHUD;
|
||||||
// globalThis.delveDice = new DelveDiceHUD();
|
|
||||||
|
|
||||||
// #region Settings
|
// #region Settings
|
||||||
registerMetaSettings();
|
registerMetaSettings();
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,6 @@ Hooks.once(`ready`, () => {
|
||||||
if (game.paused) { game.togglePause() };
|
if (game.paused) { game.togglePause() };
|
||||||
};
|
};
|
||||||
|
|
||||||
if (game.settings.get(`ripcrypt`, `showDelveTour`)) {
|
|
||||||
ui.crypt.render({ force: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
ui.delveDice.render({ force: true });
|
ui.delveDice.render({ force: true });
|
||||||
|
|
||||||
// MARK: 1-time updates
|
// MARK: 1-time updates
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,6 @@
|
||||||
const { NumberField, StringField } = foundry.data.fields;
|
const { NumberField, StringField } = foundry.data.fields;
|
||||||
|
|
||||||
export function registerWorldSettings() {
|
export function registerWorldSettings() {
|
||||||
game.settings.register(`ripcrypt`, `showDelveTour`, {
|
|
||||||
name: `Delve Tour Popup`,
|
|
||||||
scope: `world`,
|
|
||||||
type: Boolean,
|
|
||||||
config: false,
|
|
||||||
default: true,
|
|
||||||
requiresReload: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
game.settings.register(`ripcrypt`, `sandsOfFateInitial`, {
|
game.settings.register(`ripcrypt`, `sandsOfFateInitial`, {
|
||||||
name: `RipCrypt.setting.sandsOfFateInitial.name`,
|
name: `RipCrypt.setting.sandsOfFateInitial.name`,
|
||||||
hint: `RipCrypt.setting.sandsOfFateInitial.hint`,
|
hint: `RipCrypt.setting.sandsOfFateInitial.hint`,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue