Main implementation

This commit is contained in:
WBHarry 2025-10-23 19:51:22 +02:00
parent 9e9c1d2ac0
commit 0511d24921
24 changed files with 1230 additions and 499 deletions

View file

@ -1,4 +1,5 @@
import DamageDialog from '../applications/dialogs/damageDialog.mjs';
import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
import DHRoll from './dhRoll.mjs';
export default class DamageRoll extends DHRoll {
@ -338,5 +339,13 @@ export default class DamageRoll extends DHRoll {
parts: damageParts
}
});
Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.TagTeamRoll });
await game.socket.emit(`system.${CONFIG.DH.id}`, {
action: socketEvent.Refresh,
data: {
refreshType: RefreshType.TagTeamRoll
}
});
}
}

View file

@ -29,6 +29,10 @@ export default class DHRoll extends Roll {
config.hooks = [...this.getHooks(), ''];
config.dialog ??= {};
const actorIdSplit = config.source.actor.split('.');
const tagTeamSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll);
config.tagTeamSelected = tagTeamSettings.members[actorIdSplit[actorIdSplit.length - 1]];
for (const hook of config.hooks) {
if (Hooks.call(`${CONFIG.DH.id}.preRoll${hook.capitalize()}`, config, message) === false) return null;
}
@ -100,6 +104,10 @@ export default class DHRoll extends Roll {
if (roll._evaluated) {
const message = await cls.create(msgData, { rollMode: config.selectedRollMode });
if (config.tagTeamSelected) {
game.system.api.applications.dialogs.TagTeamDialog.assignRoll(message.speakerActor, message);
}
if (game.modules.get('dice-so-nice')?.active) {
await game.dice3d.waitFor3DAnimationByMessageID(message.id);
}
@ -228,7 +236,8 @@ export const registerRollDiceHooks = () => {
if (
!config.source?.actor ||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||
config.actionType === 'reaction'
config.actionType === 'reaction' ||
config.tagTeamSelected
)
return;