Merge branch 'main' into release

This commit is contained in:
WBHarry 2026-03-23 01:13:44 +01:00
commit cdf159b4a7
66 changed files with 12 additions and 138 deletions

View file

@ -2461,8 +2461,7 @@
"featuresLabel": "Community Feature" "featuresLabel": "Community Feature"
}, },
"Consumable": { "Consumable": {
"consumeOnUse": "Consume On Use", "consumeOnUse": "Consume On Use"
"destroyOnEmpty": "Destroy On Empty"
}, },
"DomainCard": { "DomainCard": {
"type": "Type", "type": "Type",

View file

@ -18,8 +18,7 @@ export default class DHConsumable extends BaseDataItem {
const fields = foundry.data.fields; const fields = foundry.data.fields;
return { return {
...super.defineSchema(), ...super.defineSchema(),
consumeOnUse: new fields.BooleanField({ initial: true }), consumeOnUse: new fields.BooleanField({ initial: true })
destroyOnEmpty: new fields.BooleanField({ initial: true })
}; };
} }

View file

@ -754,20 +754,10 @@ export default class DhpActor extends Actor {
resources.forEach(r => { resources.forEach(r => {
if (r.itemId) { if (r.itemId) {
const { path, value } = game.system.api.fields.ActionFields.CostField.getItemIdCostUpdate(r); const { path, value } = game.system.api.fields.ActionFields.CostField.getItemIdCostUpdate(r);
updates.items[r.key] = {
if ( target: r.target,
r.key === 'quantity' && resources: { [path]: value }
r.target.type === 'consumable' && };
value === 0 &&
r.target.system.destroyOnEmpty
) {
r.target.delete();
} else {
updates.items[r.key] = {
target: r.target,
resources: { [path]: value }
};
}
} else { } else {
const valueFunc = (base, resource, baseMax) => { const valueFunc = (base, resource, baseMax) => {
if (resource.clear) return baseMax && base.inverted ? baseMax : 0; if (resource.clear) return baseMax && base.inverted ? baseMax : 0;

View file

@ -169,70 +169,19 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
} }
} }
this.baseActivate(element, { ...options, html: html }); this.noOffset = options.noOffset;
super.activate(element, { ...options, html: html });
} }
/* Need to pass more options to _setAnchor, so have to copy whole foundry method >_< */ _setAnchor(direction) {
async baseActivate(element, options) {
let { text, direction, cssClass, locked = false, html, content } = options;
if (content && !html) {
foundry.utils.logCompatibilityWarning(
'The content option has been deprecated in favor of the html option',
{ since: 13, until: 15, once: true }
);
html = content;
}
if (text && html) throw new Error('Cannot provide both text and html options to TooltipManager#activate.');
// Deactivate currently active element
this.deactivate();
// Check if the element still exists in the DOM.
if (!document.body.contains(element)) return;
// Mark the new element as active
this.#active = true;
this.element = element;
element.setAttribute('aria-describedby', 'tooltip');
html ||= element.dataset.tooltipHtml;
if (html) {
if (typeof html === 'string') this.tooltip.innerHTML = foundry.utils.cleanHTML(html);
else {
this.tooltip.innerHTML = ''; // Clear existing HTML
this.tooltip.appendChild(html);
}
} else {
text ||= element.dataset.tooltipText;
if (text) this.tooltip.textContent = text;
else {
text = element.dataset.tooltip;
// Localized message should be safe
if (game.i18n.has(text)) this.tooltip.innerHTML = game.i18n.localize(text);
else this.tooltip.innerHTML = foundry.utils.cleanHTML(text);
}
}
// Activate display of the tooltip
this.tooltip.removeAttribute('class');
this.tooltip.classList.add('active', 'themed', 'theme-dark');
this.tooltip.showPopover();
cssClass ??= element.closest('[data-tooltip-class]')?.dataset.tooltipClass;
if (cssClass) this.tooltip.classList.add(...cssClass.split(' '));
// Set tooltip position
direction ??= element.closest('[data-tooltip-direction]')?.dataset.tooltipDirection;
if (!direction) direction = this._determineDirection();
this._setAnchor(direction, options);
if (locked || element.dataset.hasOwnProperty('locked')) this.lockTooltip();
}
_setAnchor(direction, options = {}) {
const directions = this.constructor.TOOLTIP_DIRECTIONS; const directions = this.constructor.TOOLTIP_DIRECTIONS;
const pad = this.constructor.TOOLTIP_MARGIN_PX; const pad = this.constructor.TOOLTIP_MARGIN_PX;
const pos = this.element.getBoundingClientRect(); const pos = this.element.getBoundingClientRect();
const { innerHeight, innerWidth } = this.tooltip.ownerDocument.defaultView; const { innerHeight, innerWidth } = this.tooltip.ownerDocument.defaultView;
const tooltipPadding = 16; const tooltipPadding = 16;
const horizontalOffset = options.noOffset ? tooltipPadding : this.tooltip.offsetWidth / 2 - pos.width / 2; const horizontalOffset = this.noOffset ? tooltipPadding : this.tooltip.offsetWidth / 2 - pos.width / 2;
const verticalOffset = options.noOffset ? tooltipPadding : this.tooltip.offsetHeight / 2 - pos.height / 2; const verticalOffset = this.noOffset ? tooltipPadding : this.tooltip.offsetHeight / 2 - pos.height / 2;
const style = {}; const style = {};
switch (direction) { switch (direction) {

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -48,7 +48,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -89,7 +89,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -71,7 +71,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -134,7 +134,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -84,7 +84,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -91,7 +91,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -71,7 +71,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -89,7 +89,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -84,7 +84,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -84,7 +84,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -84,7 +84,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -84,7 +84,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -85,7 +85,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -85,7 +85,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -84,7 +84,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -71,7 +71,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -64,7 +64,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -159,7 +159,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 62, "page": 62,

View file

@ -91,7 +91,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -85,7 +85,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -40,7 +40,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 60, "page": 60,

View file

@ -45,7 +45,6 @@
} }
}, },
"consumeOnUse": true, "consumeOnUse": true,
"destroyOnEmpty": true,
"attribution": { "attribution": {
"source": "Daggerheart SRD", "source": "Daggerheart SRD",
"page": 61, "page": 61,

View file

@ -2,7 +2,7 @@
"id": "daggerheart", "id": "daggerheart",
"title": "Daggerheart", "title": "Daggerheart",
"description": "An unofficial implementation of the Daggerheart system", "description": "An unofficial implementation of the Daggerheart system",
"version": "1.9.4", "version": "1.9.5",
"compatibility": { "compatibility": {
"minimum": "13.346", "minimum": "13.346",
"verified": "13.351", "verified": "13.351",

View file

@ -10,8 +10,5 @@
<span>{{localize "DAGGERHEART.ITEMS.Consumable.consumeOnUse"}}</span> <span>{{localize "DAGGERHEART.ITEMS.Consumable.consumeOnUse"}}</span>
{{formField systemFields.consumeOnUse value=source.system.consumeOnUse}} {{formField systemFields.consumeOnUse value=source.system.consumeOnUse}}
<span>{{localize "DAGGERHEART.ITEMS.Consumable.destroyOnEmpty"}}</span>
{{formField systemFields.destroyOnEmpty value=source.system.destroyOnEmpty}}
</fieldset> </fieldset>
</section> </section>