mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-23 19:09:55 +02:00
.
This commit is contained in:
parent
2a16b15140
commit
351f97f391
6 changed files with 13 additions and 14 deletions
|
|
@ -45,7 +45,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
|
||||||
context.isGM = game.user.isGM;
|
context.isGM = game.user.isGM;
|
||||||
context.ownershipDefaultOptions = CONFIG.DH.GENERAL.basicOwnershiplevels;
|
context.ownershipDefaultOptions = CONFIG.DH.GENERAL.basicOwnershiplevels;
|
||||||
context.defaultOwnership = this.data.defaultOwnership;
|
context.defaultOwnership = this.data.defaultOwnership;
|
||||||
context.countdownTypes = CONFIG.DH.GENERAL.countdownType;
|
context.countdownTypes = CONFIG.DH.GENERAL.countdownTypes;
|
||||||
context.countdownProgressionTypes = CONFIG.DH.GENERAL.countdownProgressionTypes;
|
context.countdownProgressionTypes = CONFIG.DH.GENERAL.countdownProgressionTypes;
|
||||||
context.countdownLoopingTypes = CONFIG.DH.GENERAL.countdownLoopingTypes;
|
context.countdownLoopingTypes = CONFIG.DH.GENERAL.countdownLoopingTypes;
|
||||||
context.hideNewCountdowns = this.hideNewCountdowns;
|
context.hideNewCountdowns = this.hideNewCountdowns;
|
||||||
|
|
@ -62,7 +62,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
|
||||||
const randomizeValid = !new Roll(countdown.progress.startFormula ?? '').isDeterministic;
|
const randomizeValid = !new Roll(countdown.progress.startFormula ?? '').isDeterministic;
|
||||||
acc[key] = {
|
acc[key] = {
|
||||||
...countdown,
|
...countdown,
|
||||||
typeName: game.i18n.localize(CONFIG.DH.GENERAL.countdownType[countdown.type].label),
|
typeName: game.i18n.localize(CONFIG.DH.GENERAL.countdownTypes[countdown.type].label),
|
||||||
progress: {
|
progress: {
|
||||||
...countdown.progress,
|
...countdown.progress,
|
||||||
typeName: game.i18n.localize(
|
typeName: game.i18n.localize(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { waitForDiceSoNice } from '../../helpers/utils.mjs';
|
import { waitForDiceSoNice } from '../../helpers/utils.mjs';
|
||||||
import { emitGMUpdate, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
|
import { emitGMUpdate, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
|
||||||
import { SYSTEM } from './../../../module/config/system.mjs';
|
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
|
|
||||||
|
|
@ -39,7 +38,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
toggleViewMode: DhCountdowns.#onToggleViewMode,
|
toggleViewMode: DhCountdowns.#onToggleViewMode,
|
||||||
onToggleCountdownTypes: DhCountdowns.#onToggleCountdownTypes,
|
toggleCountdownTypes: DhCountdowns.#onToggleCountdownTypes,
|
||||||
editCountdowns: DhCountdowns.#onEditCountdowns,
|
editCountdowns: DhCountdowns.#onEditCountdowns,
|
||||||
loopCountdown: DhCountdowns.#onLoopCountdown,
|
loopCountdown: DhCountdowns.#onLoopCountdown,
|
||||||
decreaseCountdown: (_, target) => this.editCountdown(false, target),
|
decreaseCountdown: (_, target) => this.editCountdown(false, target),
|
||||||
|
|
@ -65,7 +64,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
|
||||||
* @returns {string[]}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
get visibleCountdownTypes() {
|
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)
|
return game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownTypeModes)
|
||||||
?? [encounter.id, narrative.id];
|
?? [encounter.id, narrative.id];
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +172,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
|
||||||
loopTooltip: isLooping && game.i18n.localize(loopTooltip)
|
loopTooltip: isLooping && game.i18n.localize(loopTooltip)
|
||||||
};
|
};
|
||||||
return acc;
|
return acc;
|
||||||
}, Object.keys(CONFIG.DH.GENERAL.countdownType).reduce((acc, key) => {
|
}, Object.keys(CONFIG.DH.GENERAL.countdownTypes).reduce((acc, key) => {
|
||||||
acc[key] = {};
|
acc[key] = {};
|
||||||
return acc;
|
return acc;
|
||||||
}, {}));
|
}, {}));
|
||||||
|
|
@ -191,7 +190,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
|
||||||
context.userCountdownTypes = this.visibleCountdownTypes;
|
context.userCountdownTypes = this.visibleCountdownTypes;
|
||||||
|
|
||||||
context.typeToggles =
|
context.typeToggles =
|
||||||
Object.values(CONFIG.DH.GENERAL.countdownType).map(type => ({
|
Object.values(CONFIG.DH.GENERAL.countdownTypes).map(type => ({
|
||||||
type: type.id,
|
type: type.id,
|
||||||
label: game.i18n.localize(type.shortLabel),
|
label: game.i18n.localize(type.shortLabel),
|
||||||
active: context.userCountdownTypes.includes(type.id)
|
active: context.userCountdownTypes.includes(type.id)
|
||||||
|
|
|
||||||
|
|
@ -959,7 +959,7 @@ export const countdownAppMode = {
|
||||||
iconOnly: 'icon-only'
|
iconOnly: 'icon-only'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const countdownType = {
|
export const countdownTypes = {
|
||||||
encounter: {
|
encounter: {
|
||||||
id: 'encounter',
|
id: 'encounter',
|
||||||
label: 'DAGGERHEART.CONFIG.CountdownType.encounter.label',
|
label: 'DAGGERHEART.CONFIG.CountdownType.encounter.label',
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ export class DhCountdown extends foundry.abstract.DataModel {
|
||||||
return {
|
return {
|
||||||
type: new fields.StringField({
|
type: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.countdownType,
|
choices: CONFIG.DH.GENERAL.countdownTypes,
|
||||||
initial: CONFIG.DH.GENERAL.countdownType.encounter.id,
|
initial: CONFIG.DH.GENERAL.countdownTypes.encounter.id,
|
||||||
label: 'DAGGERHEART.GENERAL.type'
|
label: 'DAGGERHEART.GENERAL.type'
|
||||||
}),
|
}),
|
||||||
name: new fields.StringField({
|
name: new fields.StringField({
|
||||||
|
|
@ -100,7 +100,7 @@ export class DhCountdown extends foundry.abstract.DataModel {
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
return {
|
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'),
|
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Countdown.newCountdown'),
|
||||||
img: 'icons/magic/time/hourglass-yellow-green.webp',
|
img: 'icons/magic/time/hourglass-yellow-green.webp',
|
||||||
ownership: ownership,
|
ownership: ownership,
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ export default class CountdownField extends fields.ArrayField {
|
||||||
...game.system.api.data.countdowns.DhCountdown.defineSchema(),
|
...game.system.api.data.countdowns.DhCountdown.defineSchema(),
|
||||||
type: new fields.StringField({
|
type: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.countdownType,
|
choices: CONFIG.DH.GENERAL.countdownTypes,
|
||||||
initial: CONFIG.DH.GENERAL.countdownType.encounter.id,
|
initial: CONFIG.DH.GENERAL.countdownTypes.encounter.id,
|
||||||
label: 'DAGGERHEART.GENERAL.type'
|
label: 'DAGGERHEART.GENERAL.type'
|
||||||
}),
|
}),
|
||||||
name: new fields.StringField({
|
name: new fields.StringField({
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<div class="header-type-toggles">
|
<div class="header-type-toggles">
|
||||||
{{#each typeToggles as |type|}}
|
{{#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}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{#if isGM}}
|
{{#if isGM}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue