mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
.
This commit is contained in:
parent
0dc22e24ca
commit
7e66b5a21d
4 changed files with 13 additions and 25 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue