diff --git a/module/applications/sheets/api/application-mixin.mjs b/module/applications/sheets/api/application-mixin.mjs index 0168f46d..98f38f03 100644 --- a/module/applications/sheets/api/application-mixin.mjs +++ b/module/applications/sheets/api/application-mixin.mjs @@ -603,7 +603,7 @@ export default function DHApplicationMixin(Base) { const doc = await fromUuid(itemUuid); //get inventory-item description element - const descriptionElement = el.querySelector('.inventory-description'); + const descriptionElement = el.querySelector('.invetory-description'); if (!doc || !descriptionElement) continue; // localize the description (idk if it's still necessary) diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index 58be672b..27383b7a 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -54,10 +54,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel return {}; } - get hasDescription() { - return Boolean(this.description); - } - /** * Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property. * @@ -451,15 +447,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel static migrateData(source) { if (source.damage?.parts && Array.isArray(source.damage.parts)) { - let hitPointsExists = source.damage.parts.some(x => x.applyTo === 'hitPoints'); source.damage.parts = source.damage.parts.reduce((acc, part) => { - if (!part.applyTo && hitPointsExists) return acc; - - if (!part.applyTo) { - hitPointsExists = true; - part.applyTo = 'hitPoints'; - } - acc[part.applyTo] = part; return acc; }, {}); diff --git a/module/data/actor/adversary.mjs b/module/data/actor/adversary.mjs index ae17c128..d6d0dcdf 100644 --- a/module/data/actor/adversary.mjs +++ b/module/data/actor/adversary.mjs @@ -87,7 +87,6 @@ export default class DhpAdversary extends DhCreature { parts: { hitPoints: { type: ['physical'], - applyTo: 'hitPoints', value: { multiplier: 'flat' } diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index b39c64aa..3b12da6f 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -107,7 +107,6 @@ export default class DhCharacter extends DhCreature { parts: { hitPoints: { type: ['physical'], - applyTo: 'hitPoints', value: { custom: { enabled: true, diff --git a/module/data/actor/companion.mjs b/module/data/actor/companion.mjs index 2ca7fd5b..300bd698 100644 --- a/module/data/actor/companion.mjs +++ b/module/data/actor/companion.mjs @@ -102,7 +102,6 @@ export default class DhCompanion extends DhCreature { parts: { hitPoints: { type: ['physical'], - applyTo: 'hitPoints', value: { dice: 'd6', multiplier: 'prof' diff --git a/module/data/countdowns.mjs b/module/data/countdowns.mjs index ffe4d26b..8e55ed31 100644 --- a/module/data/countdowns.mjs +++ b/module/data/countdowns.mjs @@ -28,39 +28,6 @@ export default class DhCountdowns extends foundry.abstract.DataModel { for (const countdownKey of changedCountdowns) foundry.ui.countdowns.changedCountdownsForAnimation.add(countdownKey); } - - static migrateData(source) { - const migrateOldCountdowns = (data, type) => { - for (const key of Object.keys(data.countdowns)) { - const countdown = data.countdowns[key]; - source.countdowns[key] = { - ...countdown, - type: type, - ownership: Object.keys(countdown.ownership.players).reduce((acc, key) => { - acc[key] = - countdown.ownership.players[key].type === 1 ? 2 : countdown.ownership.players[key].type; - return acc; - }, {}), - progress: { - ...countdown.progress, - type: countdown.progress.type.value - } - }; - } - - source[type] = null; - }; - - if (source.narrative) { - migrateOldCountdowns(source.narrative, 'narrative'); - } - - if (source.encounter) { - migrateOldCountdowns(source.encounter, 'encounter'); - } - - return super.migrateData(source); - } } export class DhCountdown extends foundry.abstract.DataModel { diff --git a/module/data/item/armor.mjs b/module/data/item/armor.mjs index 15bb620d..21c56f9a 100644 --- a/module/data/item/armor.mjs +++ b/module/data/item/armor.mjs @@ -52,10 +52,6 @@ export default class DHArmor extends AttachableItem { ); } - get itemFeatures() { - return this.armorFeatures; - } - /**@inheritdoc */ async getDescriptionData() { const baseDescription = this.description; @@ -173,4 +169,8 @@ export default class DHArmor extends AttachableItem { const labels = [`${game.i18n.localize('DAGGERHEART.ITEMS.Armor.baseScore')}: ${this.armor.max}`]; return labels; } + + get itemFeatures() { + return this.armorFeatures; + } } diff --git a/module/data/item/weapon.mjs b/module/data/item/weapon.mjs index 39c0fc8e..84e4de7f 100644 --- a/module/data/item/weapon.mjs +++ b/module/data/item/weapon.mjs @@ -113,10 +113,6 @@ export default class DHWeapon extends AttachableItem { ); } - get itemFeatures() { - return this.weaponFeatures; - } - /**@inheritdoc */ async getDescriptionData() { const baseDescription = this.description; @@ -273,4 +269,8 @@ export default class DHWeapon extends AttachableItem { return labels; } + + get itemFeatures() { + return this.weaponFeatures; + } } diff --git a/module/documents/activeEffect.mjs b/module/documents/activeEffect.mjs index 4a9f3cc4..cdfc9a52 100644 --- a/module/documents/activeEffect.mjs +++ b/module/documents/activeEffect.mjs @@ -65,10 +65,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect { ); } - get hasDescription() { - return Boolean(this.description); - } - /* -------------------------------------------- */ /* Event Handlers */ /* -------------------------------------------- */ diff --git a/module/documents/item.mjs b/module/documents/item.mjs index 14717538..32543ebd 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -89,10 +89,6 @@ export default class DHItem extends foundry.documents.Item { return !pack?.locked && this.isOwner && isValidType && hasActions; } - get hasDescription() { - return Boolean(this.system.description) || Boolean(this.system.itemFeatures?.length); - } - /** @inheritdoc */ static async createDialog(data = {}, createOptions = {}, options = {}) { const { folders, types, template, context = {}, ...dialogOptions } = options; diff --git a/module/systemRegistration/migrations.mjs b/module/systemRegistration/migrations.mjs index 6971c34c..ec546c92 100644 --- a/module/systemRegistration/migrations.mjs +++ b/module/systemRegistration/migrations.mjs @@ -1,4 +1,5 @@ import { defaultRestOptions } from '../config/generalConfig.mjs'; +import { RefreshType, socketEvent } from './socket.mjs'; export async function runMigrations() { let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion); @@ -152,26 +153,61 @@ export async function runMigrations() { await pack.configure({ locked: true }); } + /* Migrate old countdown structure */ + const countdownSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns); + const getCountdowns = (data, type) => { + return Object.keys(data.countdowns).reduce((acc, key) => { + const countdown = data.countdowns[key]; + acc[key] = { + ...countdown, + type: type, + ownership: Object.keys(countdown.ownership.players).reduce((acc, key) => { + acc[key] = + countdown.ownership.players[key].type === 1 ? 2 : countdown.ownership.players[key].type; + return acc; + }, {}), + progress: { + ...countdown.progress, + type: countdown.progress.type.value + } + }; + + return acc; + }, {}); + }; + + await countdownSettings.updateSource({ + countdowns: { + ...getCountdowns(countdownSettings.narrative, 'narrative'), + ...getCountdowns(countdownSettings.encounter, 'encounter') + } + }); + await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, countdownSettings); + + game.socket.emit(`system.${CONFIG.DH.id}`, { + action: socketEvent.Refresh, + data: { refreshType: RefreshType.Countdown } + }); + Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.Countdown }); + lastMigrationVersion = '1.2.0'; } if (foundry.utils.isNewerVersion('1.2.7', lastMigrationVersion)) { - try { - const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll'); - const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator); - const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => { - if (!game.actors.some(actor => actor.id === id)) { - acc[id] = _del; - } - return acc; - }, {}); + const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll'); + const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator); + const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => { + if (!game.actors.some(actor => actor.id === id)) { + acc[id] = _del; + } + return acc; + }, {}); - await tagTeam.updateSource({ - initiator: initatorMissing ? null : tagTeam.initiator, - members: missingMembers - }); - await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam); - } catch { } + await tagTeam.updateSource({ + initiator: initatorMissing ? null : tagTeam.initiator, + members: missingMembers + }); + await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam); lastMigrationVersion = '1.2.7'; } @@ -267,8 +303,6 @@ export async function runMigrations() { /* Migrate existing effects modifying armor, creating new Armor Effects instead */ const migrateEffects = async entity => { - if (!entity?.effects) return; - for (const effect of entity.effects) { if (effect.system.changes.every(x => x.key !== 'system.armorScore')) continue; diff --git a/styles/less/global/inventory-item.less b/styles/less/global/inventory-item.less index fc73ba95..3a5a9321 100644 --- a/styles/less/global/inventory-item.less +++ b/styles/less/global/inventory-item.less @@ -43,19 +43,16 @@ } } - .item-main { - border-radius: 5px; - padding: 2px; - margin: -2px; - } - &:hover { .inventory-item-header .item-label .item-name .expanded-icon { margin-left: 10px; display: inline-block; } - .item-main { - background: light-dark(@dark-blue-40, @golden-40); + &:has(.inventory-item-content.extensible) { + .inventory-item-header, + .inventory-item-content { + background: light-dark(@dark-blue-40, @golden-40); + } } &:has(.inventory-item-content.extended) { .inventory-item-header .item-label .item-name .expanded-icon { @@ -63,6 +60,19 @@ } } } + + &:has(.inventory-item-content.extensible) { + .inventory-item-header { + border-radius: 5px 5px 0 0; + } + .inventory-item-content { + border-radius: 0 0 5px 5px; + } + } + + &:not(:has(.inventory-item-content.extensible)) .inventory-item-header { + border-radius: 5px; + } } .inventory-item-header, @@ -161,7 +171,7 @@ grid-template-rows: 1fr; padding-top: 4px; } - .inventory-description { + .invetory-description { overflow: hidden; h1 { diff --git a/system.json b/system.json index 0ecc2e75..4660a196 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "daggerheart", "title": "Daggerheart", "description": "An unofficial implementation of the Daggerheart system", - "version": "2.4.2", + "version": "2.4.1", "compatibility": { "minimum": "14.364", "verified": "14.364", @@ -10,7 +10,7 @@ }, "url": "https://github.com/Foundryborne/daggerheart", "manifest": "https://raw.githubusercontent.com/Foundryborne/daggerheart/v14/system.json", - "download": "https://github.com/Foundryborne/daggerheart/releases/download/2.4.2/system.zip", + "download": "https://github.com/Foundryborne/daggerheart/releases/download/2.4.1/system.zip", "authors": [ { "name": "WBHarry" diff --git a/templates/sheets/global/partials/inventory-item-V2.hbs b/templates/sheets/global/partials/inventory-item-V2.hbs index 775690d4..f7d22a30 100644 --- a/templates/sheets/global/partials/inventory-item-V2.hbs +++ b/templates/sheets/global/partials/inventory-item-V2.hbs @@ -25,146 +25,146 @@ Parameters: data-type="{{type}}" data-item-type="{{item.type}}" data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}" > -