mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
.
This commit is contained in:
parent
4510deae96
commit
85ef7191ab
4 changed files with 35 additions and 1 deletions
|
|
@ -106,6 +106,21 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
return data;
|
||||
}
|
||||
|
||||
async _preDelete() {
|
||||
/* Clear all partyMembers from tagTeam setting.*/
|
||||
/* Revisit this when tagTeam is improved for many parties */
|
||||
if (this.parent.parties.size > 0) {
|
||||
const tagTeam = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll);
|
||||
await tagTeam.updateSource({
|
||||
initiator: this.parent.id === tagTeam.initiator ? null : tagTeam.initiator,
|
||||
members: Object.keys(tagTeam.members).find(x => x === this.parent.id)
|
||||
? { [`-=${this.parent.id}`]: null }
|
||||
: {}
|
||||
});
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll, tagTeam);
|
||||
}
|
||||
}
|
||||
|
||||
async _preUpdate(changes, options, userId) {
|
||||
const allowed = await super._preUpdate(changes, options, userId);
|
||||
if (allowed === false) return;
|
||||
|
|
|
|||
|
|
@ -678,6 +678,8 @@ export default class DhCharacter extends BaseDataActor {
|
|||
}
|
||||
|
||||
async _preDelete() {
|
||||
super._preDelete();
|
||||
|
||||
if (this.companion) {
|
||||
this.companion.updateLevel(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,23 @@ export default class DhParty extends BaseDataActor {
|
|||
}
|
||||
}
|
||||
|
||||
async _preDelete() {
|
||||
/* Clear all partyMembers from tagTeam setting.*/
|
||||
/* Revisit this when tagTeam is improved for many parties */
|
||||
const tagTeam = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll);
|
||||
await tagTeam.updateSource({
|
||||
initiator: this.partyMembers.some(x => x.id === tagTeam.initiator) ? null : tagTeam.initiator,
|
||||
members: Object.keys(tagTeam.members).reduce((acc, key) => {
|
||||
if (this.partyMembers.find(x => x.id === key)) {
|
||||
acc[`-=${key}`] = null;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {})
|
||||
});
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll, tagTeam);
|
||||
}
|
||||
|
||||
_onDelete(options, userId) {
|
||||
super._onDelete(options, userId);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue