diff --git a/README.md b/README.md index ac3666b3..f59143fd 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,6 @@ You can find the documentation here: https://github.com/Foundryborne/daggerheart Looking to contribute to the project? Look no further, check out our [contributing guide](CONTRIBUTING.md), and keep the [Code of Conduct](coc.md) in mind when working on things. -## AI Policy - -The Foundryborne Daggerheart system does not make use of AI (generative or otherwise) for any area of its implementation. We expect all contributors to follow this same policy when contributing with a pull request; contributions made using AI will be rejected outright. - ## Disclaimer: **Daggerheart System** diff --git a/module/applications/levelup/levelup.mjs b/module/applications/levelup/levelup.mjs index 03638548..c4616d9a 100644 --- a/module/applications/levelup/levelup.mjs +++ b/module/applications/levelup/levelup.mjs @@ -358,14 +358,14 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2) const experienceIncreaseTagify = htmlElement.querySelector('.levelup-experience-increases'); if (experienceIncreaseTagify) { const allExperiences = { + ...this.actor.system.experiences, ...Object.values(this.levelup.levels).reduce((acc, level) => { for (const key of Object.keys(level.achievements.experiences)) { acc[key] = level.achievements.experiences[key]; } return acc; - }, {}), - ...this.actor.system.experiences + }, {}) }; tagifyElement( experienceIncreaseTagify, diff --git a/module/applications/settings/homebrewSettings.mjs b/module/applications/settings/homebrewSettings.mjs index 09bb00f2..40ea0301 100644 --- a/module/applications/settings/homebrewSettings.mjs +++ b/module/applications/settings/homebrewSettings.mjs @@ -111,7 +111,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli switch (partId) { case 'domains': - const selectedDomain = this.settings.domains[this.selected.domain] ?? null; + const selectedDomain = this.selected.domain ? this.settings.domains[this.selected.domain] : null; const enrichedDescription = selectedDomain ? await foundry.applications.ux.TextEditor.implementation.enrichHTML(selectedDomain.description) : null; diff --git a/module/applications/sheets-configs/action-base-config.mjs b/module/applications/sheets-configs/action-base-config.mjs index b65e1cdf..e83dfae4 100644 --- a/module/applications/sheets-configs/action-base-config.mjs +++ b/module/applications/sheets-configs/action-base-config.mjs @@ -204,7 +204,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2) }; } - if (this.action.parent.metadata?.isInventoryItem) { + if (this.action.parent.metadata.isInventoryItem) { options.quantity = { label: 'DAGGERHEART.GENERAL.itemQuantity', group: 'Global' diff --git a/module/applications/ui/countdowns.mjs b/module/applications/ui/countdowns.mjs index 6fa05e29..76e2b399 100644 --- a/module/applications/ui/countdowns.mjs +++ b/module/applications/ui/countdowns.mjs @@ -31,9 +31,9 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application minimizable: false }, actions: { - toggleViewMode: DhCountdowns.#onToggleViewMode, - editCountdowns: DhCountdowns.#onEditCountdowns, - loopCountdown: DhCountdowns.#onLoopCountdown, + toggleViewMode: DhCountdowns.#toggleViewMode, + editCountdowns: DhCountdowns.#editCountdowns, + loopCountdown: DhCountdowns.#loopCountdown, decreaseCountdown: (_, target) => this.editCountdown(false, target), increaseCountdown: (_, target) => this.editCountdown(true, target) }, @@ -147,7 +147,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application return true; } - static async #onToggleViewMode() { + static async #toggleViewMode() { const currentMode = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownMode); const appMode = CONFIG.DH.GENERAL.countdownAppMode; const newMode = currentMode === appMode.textIcon ? appMode.iconOnly : appMode.textIcon; @@ -158,16 +158,15 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application this.render(); } - static async #onEditCountdowns() { + static async #editCountdowns() { new game.system.api.applications.ui.CountdownEdit().render(true); } - static async #onLoopCountdown(_, target) { + static async #loopCountdown(_, target) { if (!DhCountdowns.canPerformEdit()) return; const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns); - const countdownId = target.closest('[data-countdown]').dataset.countdown; - const countdown = settings.countdowns[countdownId]; + const countdown = settings.countdowns[target.id]; let progressMax = countdown.progress.start; let message = null; @@ -186,7 +185,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application await waitForDiceSoNice(message); await settings.updateSource({ - [`countdowns.${countdownId}.progress`]: { + [`countdowns.${target.id}.progress`]: { current: newMax, start: newMax } @@ -200,12 +199,11 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application if (!DhCountdowns.canPerformEdit()) return; const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns); - const countdownId = target.closest('[data-countdown]').dataset.countdown; - const countdown = settings.countdowns[countdownId]; + const countdown = settings.countdowns[target.id]; const newCurrent = increase ? Math.min(countdown.progress.current + 1, countdown.progress.start) : Math.max(countdown.progress.current - 1, 0); - await settings.updateSource({ [`countdowns.${countdownId}.progress.current`]: newCurrent }); + await settings.updateSource({ [`countdowns.${target.id}.progress.current`]: newCurrent }); await emitGMUpdate(GMUpdateEvent.UpdateCountdowns, DhCountdowns.gmSetSetting.bind(settings), settings, null, { refreshType: RefreshType.Countdown }); diff --git a/module/data/actor/tierAdjustment.mjs b/module/data/actor/tierAdjustment.mjs index bc6ad176..785eec2b 100644 --- a/module/data/actor/tierAdjustment.mjs +++ b/module/data/actor/tierAdjustment.mjs @@ -1,6 +1,5 @@ import { calculateExpectedValue, parseTermsFromSimpleFormula } from '../../helpers/utils.mjs'; import { adversaryExpectedDamage, adversaryScalingData } from '../../config/actorConfig.mjs'; -import { parseInlineParams } from '../../enrichers/parser.mjs'; export function getTierAdjustedAdversary(source, tier) { const currentTier = source.tier ?? 1; @@ -61,8 +60,8 @@ export function getTierAdjustedAdversary(source, tier) { const descriptionFormulas = []; for (const withDescription of [item.system, ...Object.values(item.system.actions)]) { withDescription.description = withDescription.description.replace(damageRegex, (match, inner) => { - const { value: formula } = parseInlineParams(inner, { first: 'value' }); - if (!formula) return match; + const { value: formula } = parseInlineParams(inner); + if (!formula || !type) return match; try { const newFormula = calculateAdjustedDamage(formula, 'action', damageMeta)?.formula; diff --git a/module/data/item/ancestry.mjs b/module/data/item/ancestry.mjs index eae1136c..b9253a3c 100644 --- a/module/data/item/ancestry.mjs +++ b/module/data/item/ancestry.mjs @@ -1,6 +1,6 @@ import BaseDataItem from './base.mjs'; import ItemLinkFields from '../../data/fields/itemLinkFields.mjs'; -import { fromUuids, getFeaturesHTMLData } from '../../helpers/utils.mjs'; +import { getFeaturesHTMLData } from '../../helpers/utils.mjs'; export default class DHAncestry extends BaseDataItem { /** @inheritDoc */ @@ -45,10 +45,6 @@ export default class DHAncestry extends BaseDataItem { /**@inheritdoc */ async getDescriptionData() { - // Preload all ancestry features for acquisition from the cache - // todo: make feature acquisition async and replace feature helpers for methods - await fromUuids(this._source.features.map(f => f.item)); - const baseDescription = this.description; const features = await getFeaturesHTMLData(this.features); diff --git a/module/data/item/community.mjs b/module/data/item/community.mjs index 6f4470b8..6d054976 100644 --- a/module/data/item/community.mjs +++ b/module/data/item/community.mjs @@ -1,4 +1,4 @@ -import { fromUuids, getFeaturesHTMLData } from '../../helpers/utils.mjs'; +import { getFeaturesHTMLData } from '../../helpers/utils.mjs'; import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs'; import BaseDataItem from './base.mjs'; @@ -27,10 +27,6 @@ export default class DHCommunity extends BaseDataItem { /**@inheritdoc */ async getDescriptionData() { - // Preload all community features for acquisition from the cache - // todo: make feature acquisition async and replace feature helpers for methods - await fromUuids(this._source.features); - const baseDescription = this.description; const features = await getFeaturesHTMLData(this.features); diff --git a/module/data/item/subclass.mjs b/module/data/item/subclass.mjs index 934b55d3..55b078c2 100644 --- a/module/data/item/subclass.mjs +++ b/module/data/item/subclass.mjs @@ -91,7 +91,7 @@ export default class DHSubclass extends BaseDataItem { ? game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.spellcastingTrait].label) : null; - // Preload all subclass features for acquisition from the cache + // Preload all class features for acquisition from the cache // todo: make feature acquisition async and replace feature helpers for methods await fromUuids(this._source.features.map(f => f.item)); diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index fb20870f..02c4ab24 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -37,7 +37,6 @@ export default class DHRoll extends Roll { static async buildConfigure(config = {}, message = {}) { config.hooks = [...this.getHooks(), '']; config.dialog ??= {}; - config.damageOptions ??= {}; for (const hook of config.hooks) { if (Hooks.call(`${CONFIG.DH.id}.preRoll${hook.capitalize()}`, config, message) === false) return null; diff --git a/module/dice/helpers.mjs b/module/dice/helpers.mjs index 35adb8b7..33519949 100644 --- a/module/dice/helpers.mjs +++ b/module/dice/helpers.mjs @@ -1,5 +1,3 @@ -import { ResourceUpdateMap } from '../data/action/baseAction.mjs'; - export function updateResourcesForDualityReroll(oldDuality, newDuality, actor) { const { hopeFear } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation); if (game.user.isGM ? !hopeFear.gm : !hopeFear.players) return; diff --git a/module/enrichers/DamageEnricher.mjs b/module/enrichers/DamageEnricher.mjs index db0e8729..e3f9c42a 100644 --- a/module/enrichers/DamageEnricher.mjs +++ b/module/enrichers/DamageEnricher.mjs @@ -1,7 +1,7 @@ import { parseInlineParams } from './parser.mjs'; export default function DhDamageEnricher(match, _options) { - const { value, type, inline } = parseInlineParams(match[1], { first: 'value' }); + const { value, type, inline } = parseInlineParams(match[1]); if (!value || !type) return match[0]; return getDamageMessage(value, type, inline, match[0]); } @@ -59,7 +59,7 @@ export const renderDamageButton = async event => { { formula: value, applyTo: CONFIG.DH.GENERAL.healingTypes.hitPoints.id, - damageTypes: type + type: type } ] }; diff --git a/module/enrichers/parser.mjs b/module/enrichers/parser.mjs index 76ea0b73..365caec9 100644 --- a/module/enrichers/parser.mjs +++ b/module/enrichers/parser.mjs @@ -8,7 +8,7 @@ export function parseInlineParams(paramString, { first } = {}) { const parts = paramString.split('|').map(x => x.trim()); const params = {}; for (const [idx, param] of parts.entries()) { - if (first && idx === 0 && !param.includes(':')) { + if (first && idx === 0) { params[first] = param; } else { const parts = param.split(':'); diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index ddc353b1..2f20175b 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -879,7 +879,6 @@ export async function fromUuids(uuids) { const packEmbeddedEntries = entries.filter( e => !(e.value instanceof Document) && - e.parsed && e.parsed.collection instanceof foundry.documents.collections.CompendiumCollection && e.parsed.embedded.length > 0 ); @@ -896,7 +895,7 @@ export async function fromUuids(uuids) { const pack = game.packs.get(packGroup[0].value.pack); if (!pack) continue; - const ids = packGroup.map(p => p.parsed?.id).filter(id => !!id); + const ids = packGroup.map(p => p.parsed.id); const documents = await pack.getDocuments({ _id__in: ids }); for (const p of packGroup) { p.value = documents.find(d => d.id === p.parsed.id) ?? p.value; diff --git a/styles/less/ui/countdown/countdown.less b/styles/less/ui/countdown/countdown.less index 63e539ba..66a6c88a 100644 --- a/styles/less/ui/countdown/countdown.less +++ b/styles/less/ui/countdown/countdown.less @@ -18,7 +18,7 @@ border: 0; box-shadow: none; color: @color-text-primary; - width: 18.75rem; + width: 300px; pointer-events: all; align-self: flex-end; transition: 0.3s right ease-in-out; @@ -36,7 +36,7 @@ transition: opacity var(--ui-fade-duration); } - &:not(.performance-low, .noblur) { + :not(.performance-low, .noblur) { backdrop-filter: blur(5px); } @@ -49,7 +49,8 @@ } &.icon-only { - width: 12rem; + width: 180px; + min-width: 180px; } .countdowns-header, @@ -107,8 +108,8 @@ gap: 16px; img { - width: 2.75rem; - height: 2.75rem; + width: 44px; + height: 44px; border-radius: 6px; } @@ -126,7 +127,7 @@ .countdown-tool-controls { display: flex; align-items: center; - gap: var(--spacer-12); + gap: 16px; } .progress-tag { diff --git a/system.json b/system.json index ed14a17b..588ceafe 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.3.2", + "version": "2.3.1", "compatibility": { "minimum": "14.361", "verified": "14.363", @@ -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.3.2/system.zip", + "download": "https://github.com/Foundryborne/daggerheart/releases/download/2.3.1/system.zip", "authors": [ { "name": "WBHarry" diff --git a/templates/ui/countdowns.hbs b/templates/ui/countdowns.hbs index faaffdc5..95067826 100644 --- a/templates/ui/countdowns.hbs +++ b/templates/ui/countdowns.hbs @@ -11,20 +11,18 @@