mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +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.",
|
"duplicateCard": "You cannot select the same card more than once.",
|
||||||
"duplicateCharacter": "This actor is already registered in the party members list.",
|
"duplicateCharacter": "This actor is already registered in the party members list.",
|
||||||
"onlyCharactersInPartySheet": "You can only drag characters, companions and adverasries to the party sheet.",
|
"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!",
|
"notPrimary": "The weapon is not a primary weapon!",
|
||||||
"notSecondary": "The weapon is not a secondary weapon!",
|
"notSecondary": "The weapon is not a secondary weapon!",
|
||||||
"itemTooHighTier": "The item must be from Tier1",
|
"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() {
|
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
|
force: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #groupRoll(params) {
|
static async #groupRoll(_params) {
|
||||||
new GroupRollDialog(this.partyMembersForRoll).render({ force: true });
|
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();
|
event.stopPropagation();
|
||||||
|
|
||||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
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);
|
const currentMembers = this.document.system.partyMembers.map(x => x.uuid);
|
||||||
if (currentMembers.includes(data.uuid)) {
|
if (currentMembers.includes(data.uuid)) {
|
||||||
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateCharacter'));
|
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateCharacter'));
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.document.update({ 'system.partyMembers': [...currentMembers, item.uuid] });
|
await this.document.update({ 'system.partyMembers': [...currentMembers, document.uuid] });
|
||||||
} else if (item instanceof DHItem) {
|
} else if (document instanceof DHItem) {
|
||||||
this.document.createEmbeddedDocuments('Item', [item.toObject()]);
|
this.document.createEmbeddedDocuments('Item', [document.toObject()]);
|
||||||
} else {
|
} else {
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.onlyCharactersInPartySheet'));
|
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
|
// Register this party to all members
|
||||||
if (game.actors.get(this.parent.id) === this.parent) {
|
if (game.actors.get(this.parent.id) === this.parent) {
|
||||||
for (const member of this.partyMembers) {
|
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 });
|
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) {
|
_onUpdate(changes, options, userId) {
|
||||||
super._onUpdate(changes, options, userId);
|
super._onUpdate(changes, options, userId);
|
||||||
for (const party of this.parties) {
|
for (const party of this.parties) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue