diff --git a/module/applications/sheets/character.mjs b/module/applications/sheets/character.mjs index 468d9379..3b191b32 100644 --- a/module/applications/sheets/character.mjs +++ b/module/applications/sheets/character.mjs @@ -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, removeCard: this.removeDomainCard, selectClass: this.selectClass, @@ -391,7 +392,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, @@ -553,6 +555,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(); @@ -753,7 +771,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', @@ -778,7 +798,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 = { diff --git a/module/config/flagsConfig.mjs b/module/config/flagsConfig.mjs new file mode 100644 index 00000000..b06a36e1 --- /dev/null +++ b/module/config/flagsConfig.mjs @@ -0,0 +1 @@ +export const displayDomainCardsAsList = 'displayDomainCardsAsList'; diff --git a/module/config/system.mjs b/module/config/system.mjs index 41d67154..6ad0e689 100644 --- a/module/config/system.mjs +++ b/module/config/system.mjs @@ -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 }; diff --git a/styles/daggerheart.css b/styles/daggerheart.css index 994293bf..395912ec 100755 --- a/styles/daggerheart.css +++ b/styles/daggerheart.css @@ -3619,13 +3619,35 @@ div.daggerheart.views.multiclass { .theme-light .application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet { background: transparent; } -.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet img { +.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait { + position: relative; height: 235px; width: 275px; border-bottom: 1px solid light-dark(#18162e, #f3c267); cursor: pointer; +} +.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait img { + height: 235px; + width: 275px; object-fit: cover; } +.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait .death-roll-btn { + display: none; +} +.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait.death-roll { + filter: grayscale(1); +} +.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait.death-roll .death-roll-btn { + display: flex; + position: absolute; + top: 30%; + right: 30%; + font-size: 6rem; + color: #efe6d8; +} +.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait.death-roll .death-roll-btn:hover { + text-shadow: 0 0 8px #efe6d8; +} .application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .info-section { position: relative; display: flex; @@ -3957,7 +3979,7 @@ div.daggerheart.views.multiclass { z-index: 1; color: light-dark(#18162e50, #efe6d850); } -.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toogle-view { +.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toggle-view { background: light-dark(#18162e10, #18162e); border: 1px solid light-dark(#18162e, #f3c267); border-radius: 15px; @@ -3965,24 +3987,24 @@ div.daggerheart.views.multiclass { gap: 0; width: 62px; } -.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toogle-view span { +.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toggle-view span { margin: 1px; width: 26px; color: light-dark(#18162e, #f3c267); } -.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toogle-view span.list-icon i { +.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toggle-view span.list-icon i { margin-left: 3px; } -.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toogle-view span.grid-icon i { +.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toggle-view span.grid-icon i { margin-right: 3px; } -.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toogle-view span.list-active { +.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toggle-view span.list-active { border-radius: 32px 3px 3px 32px; background-color: light-dark(#18162e, #f3c267); color: light-dark(#efe6d8, #18162e); padding: 2px; } -.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toogle-view span.grid-active { +.application.sheet.daggerheart.actor.dh-style.character .tab.loadout .search-section .btn-toggle-view span.grid-active { border-radius: 3px 32px 32px 3px; background-color: light-dark(#18162e, #f3c267); color: light-dark(#efe6d8, #18162e); diff --git a/styles/less/actors/character/loadout.less b/styles/less/actors/character/loadout.less index 0eb514e2..c8eae725 100644 --- a/styles/less/actors/character/loadout.less +++ b/styles/less/actors/character/loadout.less @@ -43,7 +43,7 @@ } } - .btn-toogle-view { + .btn-toggle-view { background: light-dark(@dark-blue-10, @dark-blue); border: 1px solid light-dark(@dark-blue, @golden); border-radius: 15px; diff --git a/templates/sheets/actors/character/loadout.hbs b/templates/sheets/actors/character/loadout.hbs index 375581f3..e80aaa80 100644 --- a/templates/sheets/actors/character/loadout.hbs +++ b/templates/sheets/actors/character/loadout.hbs @@ -11,18 +11,29 @@ -
+ {{#if this.abilities.loadout.listView}} {{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.PC.Tabs.Loadout') type='domainCard' isGlassy=true cardView='list'}} + {{else}} + {{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.PC.Tabs.Loadout') type='domainCard' isGlassy=true cardView='card'}} + {{/if}} + + {{#if this.abilities.loadout.listView}} {{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.PC.Tabs.Vault') type='domainCard' isVault=true isGlassy=true cardView='list'}} + {{else}} + {{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.PC.Tabs.Vault') type='domainCard' isVault=true isGlassy=true cardView='card'}} + {{/if}} + +
\ No newline at end of file diff --git a/templates/sheets/global/partials/domain-card-item.hbs b/templates/sheets/global/partials/domain-card-item.hbs index 55662833..13337cb4 100644 --- a/templates/sheets/global/partials/domain-card-item.hbs +++ b/templates/sheets/global/partials/domain-card-item.hbs @@ -14,18 +14,18 @@ {{/if}} {{#if (eq type 'domainCard')}} {{#unless item.system.inVault}} - + {{else}} - + {{/unless}} {{/if}} - +
{{item.name}}
diff --git a/templates/sheets/global/partials/inventory-fieldset-items.hbs b/templates/sheets/global/partials/inventory-fieldset-items.hbs index f327c268..1465c74a 100644 --- a/templates/sheets/global/partials/inventory-fieldset-items.hbs +++ b/templates/sheets/global/partials/inventory-fieldset-items.hbs @@ -1,49 +1,53 @@
{{title}} - + {{#if (and (eq cardView 'card') (eq type 'domainCard'))}} + + {{/if}}
\ No newline at end of file