This commit is contained in:
WBHarry 2026-06-15 15:39:09 +02:00
parent 2a16b15140
commit 351f97f391
6 changed files with 13 additions and 14 deletions

View file

@ -45,7 +45,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
context.isGM = game.user.isGM;
context.ownershipDefaultOptions = CONFIG.DH.GENERAL.basicOwnershiplevels;
context.defaultOwnership = this.data.defaultOwnership;
context.countdownTypes = CONFIG.DH.GENERAL.countdownType;
context.countdownTypes = CONFIG.DH.GENERAL.countdownTypes;
context.countdownProgressionTypes = CONFIG.DH.GENERAL.countdownProgressionTypes;
context.countdownLoopingTypes = CONFIG.DH.GENERAL.countdownLoopingTypes;
context.hideNewCountdowns = this.hideNewCountdowns;
@ -62,7 +62,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
const randomizeValid = !new Roll(countdown.progress.startFormula ?? '').isDeterministic;
acc[key] = {
...countdown,
typeName: game.i18n.localize(CONFIG.DH.GENERAL.countdownType[countdown.type].label),
typeName: game.i18n.localize(CONFIG.DH.GENERAL.countdownTypes[countdown.type].label),
progress: {
...countdown.progress,
typeName: game.i18n.localize(

View file

@ -1,6 +1,5 @@
import { waitForDiceSoNice } from '../../helpers/utils.mjs';
import { emitGMUpdate, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
import { SYSTEM } from './../../../module/config/system.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -39,7 +38,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
},
actions: {
toggleViewMode: DhCountdowns.#onToggleViewMode,
onToggleCountdownTypes: DhCountdowns.#onToggleCountdownTypes,
toggleCountdownTypes: DhCountdowns.#onToggleCountdownTypes,
editCountdowns: DhCountdowns.#onEditCountdowns,
loopCountdown: DhCountdowns.#onLoopCountdown,
decreaseCountdown: (_, target) => this.editCountdown(false, target),
@ -65,7 +64,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
* @returns {string[]}
*/
get visibleCountdownTypes() {
const { encounter, narrative } = SYSTEM.GENERAL.countdownType;
const { encounter, narrative } = CONFIG.DH.GENERAL.countdownTypes;
return game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownTypeModes)
?? [encounter.id, narrative.id];
}
@ -173,7 +172,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
loopTooltip: isLooping && game.i18n.localize(loopTooltip)
};
return acc;
}, Object.keys(CONFIG.DH.GENERAL.countdownType).reduce((acc, key) => {
}, Object.keys(CONFIG.DH.GENERAL.countdownTypes).reduce((acc, key) => {
acc[key] = {};
return acc;
}, {}));
@ -191,7 +190,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
context.userCountdownTypes = this.visibleCountdownTypes;
context.typeToggles =
Object.values(CONFIG.DH.GENERAL.countdownType).map(type => ({
Object.values(CONFIG.DH.GENERAL.countdownTypes).map(type => ({
type: type.id,
label: game.i18n.localize(type.shortLabel),
active: context.userCountdownTypes.includes(type.id)

View file

@ -959,7 +959,7 @@ export const countdownAppMode = {
iconOnly: 'icon-only'
};
export const countdownType = {
export const countdownTypes = {
encounter: {
id: 'encounter',
label: 'DAGGERHEART.CONFIG.CountdownType.encounter.label',

View file

@ -35,8 +35,8 @@ export class DhCountdown extends foundry.abstract.DataModel {
return {
type: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.countdownType,
initial: CONFIG.DH.GENERAL.countdownType.encounter.id,
choices: CONFIG.DH.GENERAL.countdownTypes,
initial: CONFIG.DH.GENERAL.countdownTypes.encounter.id,
label: 'DAGGERHEART.GENERAL.type'
}),
name: new fields.StringField({
@ -100,7 +100,7 @@ export class DhCountdown extends foundry.abstract.DataModel {
: undefined;
return {
type: type ?? CONFIG.DH.GENERAL.countdownType.encounter.id,
type: type ?? CONFIG.DH.GENERAL.countdownTypes.encounter.id,
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Countdown.newCountdown'),
img: 'icons/magic/time/hourglass-yellow-green.webp',
ownership: ownership,

View file

@ -8,8 +8,8 @@ export default class CountdownField extends fields.ArrayField {
...game.system.api.data.countdowns.DhCountdown.defineSchema(),
type: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.countdownType,
initial: CONFIG.DH.GENERAL.countdownType.encounter.id,
choices: CONFIG.DH.GENERAL.countdownTypes,
initial: CONFIG.DH.GENERAL.countdownTypes.encounter.id,
label: 'DAGGERHEART.GENERAL.type'
}),
name: new fields.StringField({

View file

@ -6,7 +6,7 @@
{{/unless}}
<div class="header-type-toggles">
{{#each typeToggles as |type|}}
<a class="header-type {{#unless type.active}}inactive{{/unless}}" data-action="onToggleCountdownTypes" data-type="{{type.type}}">{{localize type.label}}</a>
<a class="header-type {{#unless type.active}}inactive{{/unless}}" data-action="toggleCountdownTypes" data-type="{{type.type}}">{{localize type.label}}</a>
{{/each}}
</div>
{{#if isGM}}