Fix conflicts...again...

This commit is contained in:
Dapoolp 2025-06-28 18:08:01 +02:00
commit 7744e4a933
8 changed files with 99 additions and 60 deletions

View file

@ -26,6 +26,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
toggleHope: this.toggleHope,
toggleGold: this.toggleGold,
toggleLoadoutView: this.toggleLoadoutView,
attackRoll: this.attackRoll,
useDomainCard: this.useDomainCard,
selectClass: this.selectClass,
selectSubclass: this.selectSubclass,
@ -370,7 +371,8 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
loadout: {
top: loadout.slice(0, Math.min(2, nrLoadoutCards)),
bottom: nrLoadoutCards > 2 ? loadout.slice(2, Math.min(5, nrLoadoutCards)) : [],
nrTotal: nrLoadoutCards
nrTotal: nrLoadoutCards,
listView: game.user.getFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList)
},
vault: vault.map(x => ({
...x,
@ -493,6 +495,22 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
this.render();
}
static async toggleLoadoutView(_, button) {
const newAbilityView = !(button.dataset.value === 'true');
await game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList, newAbilityView);
this.render();
}
static async attackRoll(event, button) {
const weapon = await fromUuid(button.dataset.weapon);
if (!weapon) return;
const wasUsed = await weapon.use(event);
if (wasUsed) {
Hooks.callAll(SYSTEM.HOOKS.characterAttack, {});
}
}
static levelManagement() {
if (this.document.system.needsCharacterSetup) {
this.characterSetup();
@ -683,7 +701,9 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
const cls = getDocumentClass('ChatMessage');
const systemData = {
name: game.i18n.localize('DAGGERHEART.General.Experience.Single'),
description: `${experience.description} ${experience.total < 0 ? experience.total : `+${experience.total}`}`
description: `${experience.description} ${
experience.total < 0 ? experience.total : `+${experience.total}`
}`
};
const msg = new cls({
type: 'abilityUse',
@ -709,7 +729,9 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
? this.document.system.multiclass.subclass
: this.document.system.class.subclass;
const ability = item.system[`${button.dataset.key}Feature`];
const title = `${item.name} - ${game.i18n.localize(`DAGGERHEART.Sheets.PC.DomainCard.${capitalize(button.dataset.key)}Title`)}`;
const title = `${item.name} - ${game.i18n.localize(
`DAGGERHEART.Sheets.PC.DomainCard.${capitalize(button.dataset.key)}Title`
)}`;
const cls = getDocumentClass('ChatMessage');
const systemData = {
@ -782,8 +804,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
}
static async toggleVault(event, button) {
const itemId = event.target.closest('[data-item-id]').dataset.itemId,
item = this.document.items.get(itemId);
const item = this.getItem(event);
if (!item) return;
await item.update({ 'system.inVault': !item.system.inVault });
}

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 * as EFFECTS from './effectConfig.mjs';
import * as ACTIONS from './actionConfig.mjs';
import * as FLAGS from './flagsConfig.mjs';
export const SYSTEM_ID = 'daggerheart';
@ -18,5 +19,6 @@ export const SYSTEM = {
SETTINGS,
HOOKS,
EFFECTS,
ACTIONS
ACTIONS,
FLAGS
};