Merge branch 'development' into feature/313-preset-measured-templates

This commit is contained in:
Chris Ryan 2025-11-12 16:22:21 +10:00
commit c02f44faf1
146 changed files with 4403 additions and 569 deletions

View file

@ -5,6 +5,8 @@ import { createScrollText, damageKeyToNumber } from '../helpers/utils.mjs';
import DhCompanionLevelUp from '../applications/levelup/companionLevelup.mjs';
export default class DhpActor extends Actor {
parties = new Set();
#scrollTextQueue = [];
#scrollTextInterval;
@ -74,7 +76,7 @@ export default class DhpActor extends Actor {
// Configure prototype token settings
const prototypeToken = {};
if (['character', 'companion'].includes(this.type))
if (['character', 'companion', 'party'].includes(this.type))
Object.assign(prototypeToken, {
sight: { enabled: true },
actorLink: true,
@ -83,6 +85,20 @@ export default class DhpActor extends Actor {
this.updateSource({ prototypeToken });
}
_onUpdate(changes, options, userId) {
super._onUpdate(changes, options, userId);
for (const party of this.parties) {
party.render();
}
}
_onDelete(options, userId) {
super._onDelete(options, userId);
for (const party of this.parties) {
party.render();
}
}
async updateLevel(newLevel) {
if (!['character', 'companion'].includes(this.type) || newLevel === this.system.levelData.level.changed) return;
@ -808,4 +824,14 @@ export default class DhpActor extends Actor {
return await super.importFromJSON(json);
}
/**
* Generate an array of localized tag.
* @returns {string[]} An array of localized tag strings.
*/
_getTags() {
const tags = [];
if (this.system._getTags) tags.push(...this.system._getTags());
return tags;
}
}

View file

@ -1,4 +1,4 @@
import { emitAsGM, GMUpdateEvent } from '../systemRegistration/socket.mjs';
import { emitAsGM, GMUpdateEvent, RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
export default class DhpChatMessage extends foundry.documents.ChatMessage {
targetHook = null;
@ -16,7 +16,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
const html = await super.renderHTML({ actor: actorData, author: this.author });
if (this.flags.core?.RollTable) {
html.querySelector('.roll-buttons.apply-buttons').remove();
html.querySelector('.roll-buttons.apply-buttons')?.remove();
}
this.enrichChatMessage(html);
@ -155,7 +155,15 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
event.stopPropagation();
const config = foundry.utils.deepClone(this.system);
config.event = event;
this.system.action?.workflow.get('damage')?.execute(config, this._id, true);
await this.system.action?.workflow.get('damage')?.execute(config, this._id, true);
Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.TagTeamRoll });
await game.socket.emit(`system.${CONFIG.DH.id}`, {
action: socketEvent.Refresh,
data: {
refreshType: RefreshType.TagTeamRoll
}
});
}
async onApplyDamage(event) {