From 7e66b5a21d8c4308f4d9910cc31f13000c92ab88 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sun, 16 Nov 2025 01:47:43 +0100 Subject: [PATCH] . --- lang/en.json | 1 - module/applications/sheets/actors/party.mjs | 24 ++++++++++----------- module/data/actor/party.mjs | 2 +- module/documents/actor.mjs | 11 ---------- 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/lang/en.json b/lang/en.json index bcdfe03d..693f2dad 100755 --- a/lang/en.json +++ b/lang/en.json @@ -2624,7 +2624,6 @@ "duplicateCard": "You cannot select the same card more than once.", "duplicateCharacter": "This actor is already registered in the party members list.", "onlyCharactersInPartySheet": "You can only drag characters, companions and adverasries to the party sheet.", - "onlyLinkedActorsInPartySheet": "Actors in the ", "notPrimary": "The weapon is not a primary weapon!", "notSecondary": "The weapon is not a secondary weapon!", "itemTooHighTier": "The item must be from Tier1", diff --git a/module/applications/sheets/actors/party.mjs b/module/applications/sheets/actors/party.mjs index 2b93d592..8d009778 100644 --- a/module/applications/sheets/actors/party.mjs +++ b/module/applications/sheets/actors/party.mjs @@ -280,18 +280,18 @@ export default class Party extends DHBaseActorSheet { }); } - get partyMembersForRoll() { - return this.document.system.partyMembers.filter(x => Party.DICE_ROLL_ACTOR_TYPES.includes(x.type)); - } - static async #tagTeamRoll() { - new game.system.api.applications.dialogs.TagTeamDialog(this.partyMembersForRoll).render({ + new game.system.api.applications.dialogs.TagTeamDialog( + this.document.system.partyMembers.filter(x => Party.DICE_ROLL_ACTOR_TYPES.includes(x.type)) + ).render({ force: true }); } - static async #groupRoll(params) { - new GroupRollDialog(this.partyMembersForRoll).render({ force: true }); + static async #groupRoll(_params) { + new GroupRollDialog( + this.document.system.partyMembers.filter(x => Party.DICE_ROLL_ACTOR_TYPES.includes(x.type)) + ).render({ force: true }); } /** @@ -461,17 +461,17 @@ export default class Party extends DHBaseActorSheet { event.stopPropagation(); const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event); - const item = await foundry.utils.fromUuid(data.uuid); + const document = await foundry.utils.fromUuid(data.uuid); - if (item instanceof DhpActor && Party.ALLOWED_ACTOR_TYPES.includes(item.type)) { + if (document instanceof DhpActor && Party.ALLOWED_ACTOR_TYPES.includes(document.type)) { const currentMembers = this.document.system.partyMembers.map(x => x.uuid); if (currentMembers.includes(data.uuid)) { return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateCharacter')); } - await this.document.update({ 'system.partyMembers': [...currentMembers, item.uuid] }); - } else if (item instanceof DHItem) { - this.document.createEmbeddedDocuments('Item', [item.toObject()]); + await this.document.update({ 'system.partyMembers': [...currentMembers, document.uuid] }); + } else if (document instanceof DHItem) { + this.document.createEmbeddedDocuments('Item', [document.toObject()]); } else { ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.onlyCharactersInPartySheet')); } diff --git a/module/data/actor/party.mjs b/module/data/actor/party.mjs index 3d437fc8..06731246 100644 --- a/module/data/actor/party.mjs +++ b/module/data/actor/party.mjs @@ -31,7 +31,7 @@ export default class DhParty extends BaseDataActor { // Register this party to all members if (game.actors.get(this.parent.id) === this.parent) { for (const member of this.partyMembers) { - member?.parties?.add(this.parent); + member.parties?.add(this.parent); } } } diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index c9110ba3..8faf1350 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -85,17 +85,6 @@ export default class DhpActor extends Actor { this.updateSource({ prototypeToken }); } - /**@inheritdoc */ - async _preDelete() { - if (this.parent.parties) { - for (const party of this.parent.parties) { - await party.update({ - 'system.partyMembers': party.system.partyMembers.filter(x => x.uuid !== this.parent.uuid) - }); - } - } - } - _onUpdate(changes, options, userId) { super._onUpdate(changes, options, userId); for (const party of this.parties) {