set the list display as a user flag

This commit is contained in:
IrkTheImp 2025-06-27 20:17:38 -05:00
parent 798c07dffe
commit 51602de36d
4 changed files with 8 additions and 7 deletions

View file

@ -293,7 +293,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
top: loadout.slice(0, Math.min(2, nrLoadoutCards)), top: loadout.slice(0, Math.min(2, nrLoadoutCards)),
bottom: nrLoadoutCards > 2 ? loadout.slice(2, Math.min(5, nrLoadoutCards)) : [], bottom: nrLoadoutCards > 2 ? loadout.slice(2, Math.min(5, nrLoadoutCards)) : [],
nrTotal: nrLoadoutCards, nrTotal: nrLoadoutCards,
listView: this.document.system.layout.listView listView: game.user.getFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList)
}, },
vault: vault.map(x => ({ vault: vault.map(x => ({
...x, ...x,
@ -450,8 +450,9 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
} }
static async toggleLoadoutView(_, button) { static async toggleLoadoutView(_, button) {
const listView = !(button.dataset.value === 'true'); const newAbilityView = !(button.dataset.value === 'true');
await this.document.update({ 'system.layout.listView': listView }); await game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList, newAbilityView);
this.render();
} }
static async attackRoll(event, button) { static async attackRoll(event, button) {

View file

@ -0,0 +1 @@
export const displayDomainCardsAsList = 'displayDomainCardsAsList';

View file

@ -6,6 +6,7 @@ import * as SETTINGS from './settingsConfig.mjs';
import { hooks as HOOKS } from './hooksConfig.mjs'; import { hooks as HOOKS } from './hooksConfig.mjs';
import * as EFFECTS from './effectConfig.mjs'; import * as EFFECTS from './effectConfig.mjs';
import * as ACTIONS from './actionConfig.mjs'; import * as ACTIONS from './actionConfig.mjs';
import * as FLAGS from './flagsConfig.mjs';
export const SYSTEM_ID = 'daggerheart'; export const SYSTEM_ID = 'daggerheart';
@ -18,5 +19,6 @@ export const SYSTEM = {
SETTINGS, SETTINGS,
HOOKS, HOOKS,
EFFECTS, EFFECTS,
ACTIONS ACTIONS,
FLAGS
}; };

View file

@ -90,9 +90,6 @@ export default class DhCharacter extends BaseDataActor {
attack: new fields.NumberField({ integer: true, initial: 0 }), attack: new fields.NumberField({ integer: true, initial: 0 }),
spellcast: new fields.NumberField({ integer: true, initial: 0 }), spellcast: new fields.NumberField({ integer: true, initial: 0 }),
armorScore: new fields.NumberField({ integer: true, initial: 0 }) armorScore: new fields.NumberField({ integer: true, initial: 0 })
}),
layout: new fields.SchemaField({
listView: new fields.BooleanField({ initial: true })
}) })
}; };
} }