Restored encounter/narrative

This commit is contained in:
WBHarry 2026-06-14 20:29:39 +02:00
parent ec56e1812c
commit cf47385d83
30 changed files with 42 additions and 56 deletions

View file

@ -3,7 +3,6 @@ import { emitGMUpdate, GMUpdateEvent, RefreshType, socketEvent } from '../../sys
import { SYSTEM } from './../../../module/config/system.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
const { shortterm, longterm } = SYSTEM.GENERAL.countdownType;
/**
* A UI element which displays the countdowns in this world.
@ -66,9 +65,9 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
* @returns {string[]}
*/
get visibleCountdownTypes() {
const { shortterm, longterm } = SYSTEM.GENERAL.countdownType;
const { encounter, narrative } = SYSTEM.GENERAL.countdownType;
return game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownTypeModes)
?? [shortterm.id, longterm.id];
?? [encounter.id, narrative.id];
}
async _renderFrame(options) {

View file

@ -960,15 +960,15 @@ export const countdownAppMode = {
};
export const countdownType = {
shortterm: {
id: 'shortterm',
label: 'DAGGERHEART.CONFIG.CountdownBaseType.shortterm.label',
shortLabel: 'DAGGERHEART.CONFIG.CountdownBaseType.shortterm.shortLabel'
encounter: {
id: 'encounter',
label: 'DAGGERHEART.CONFIG.CountdownBaseType.encounter.label',
shortLabel: 'DAGGERHEART.CONFIG.CountdownBaseType.encounter.shortLabel'
},
longterm: {
id: 'longterm',
label: 'DAGGERHEART.CONFIG.CountdownBaseType.longterm.label',
shortLabel: 'DAGGERHEART.CONFIG.CountdownBaseType.longterm.shortLabel'
narrative: {
id: 'narrative',
label: 'DAGGERHEART.CONFIG.CountdownBaseType.narrative.label',
shortLabel: 'DAGGERHEART.CONFIG.CountdownBaseType.narrative.shortLabel'
}
};

View file

@ -27,19 +27,6 @@ export default class DhCountdowns extends foundry.abstract.DataModel {
foundry.ui.countdowns.changedCountdownsForAnimation.add(...changedCountdowns);
}
migrateData(source) {
for (const countdown of source.countdowns) {
switch (countdown.type) {
case 'narrative':
countdown.type = CONFIG.DH.GENERAL.countdownType.longterm.id;
break;
case 'encounter':
countdown.type = CONFIG.DH.GENERAL.countdownType.shortterm.id;
break;
}
}
}
}
export class DhCountdown extends foundry.abstract.DataModel {
@ -49,7 +36,7 @@ export class DhCountdown extends foundry.abstract.DataModel {
type: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.countdownType,
initial: CONFIG.DH.GENERAL.countdownType.shortterm.id,
initial: CONFIG.DH.GENERAL.countdownType.encounter.id,
label: 'DAGGERHEART.GENERAL.type'
}),
name: new fields.StringField({
@ -113,7 +100,7 @@ export class DhCountdown extends foundry.abstract.DataModel {
: undefined;
return {
type: type ?? CONFIG.DH.GENERAL.countdownType.shortterm.id,
type: type ?? CONFIG.DH.GENERAL.countdownType.encounter.id,
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Countdown.newCountdown'),
img: 'icons/magic/time/hourglass-yellow-green.webp',
ownership: ownership,

View file

@ -9,7 +9,7 @@ export default class CountdownField extends fields.ArrayField {
type: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.countdownType,
initial: CONFIG.DH.GENERAL.countdownType.shortterm.id,
initial: CONFIG.DH.GENERAL.countdownType.encounter.id,
label: 'DAGGERHEART.GENERAL.type'
}),
name: new fields.StringField({