Added logging

This commit is contained in:
WBHarry 2026-01-15 22:07:02 +01:00
parent 9fb9ae1b91
commit 6f4ed1d6d9
2 changed files with 16 additions and 1 deletions

View file

@ -78,6 +78,7 @@ CONFIG.ux.ContextMenu = applications.ux.DHContextMenu;
CONFIG.ux.TooltipManager = documents.DhTooltipManager;
CONFIG.ux.TemplateManager = new TemplateManager();
CONFIG.ux.TokenManager = new TokenManager();
CONFIG.debug.triggers = false;
Hooks.once('init', () => {
game.system.api = {
@ -501,7 +502,7 @@ class RegisteredTriggers extends Map {
if (dualityTrigger) {
const tokenBoundActors = ['adversary', 'environment'];
const triggerActors = ['character', ...tokenBoundActors];
for (let { actor: actorUuid, triggeringActorType, commands } of dualityTrigger.values()) {
for (let [itemUuid, { actor: actorUuid, triggeringActorType, commands }] of dualityTrigger.entries()) {
const actor = await foundry.utils.fromUuid(actorUuid);
if (!actor || !triggerActors.includes(actor.type)) continue;
if (tokenBoundActors.includes(actor.type) && !actor.getActiveTokens().length) continue;
@ -514,6 +515,17 @@ class RegisteredTriggers extends Map {
for (let command of commands) {
try {
if (CONFIG.debug.triggers) {
const item = await foundry.utils.fromUuid(itemUuid);
console.log(
game.i18n.format('DAGGERHEART.UI.ConsoleLogs.triggerRun', {
actor: actor.name ?? '<Missing Actor>',
item: item?.name ?? '<Missing Item>',
trigger: game.i18n.localize(triggerData.label)
})
);
}
const result = await command(...args);
if (result?.updates?.length) updates.push(...result.updates);
} catch (_) {

View file

@ -2709,6 +2709,9 @@
"rerollDamage": "Reroll Damage",
"assignTagRoll": "Assign as Tag Roll"
},
"ConsoleLogs": {
"triggerRun": "DH TRIGGER | Item '{item}' on actor '{actor}' ran a '{trigger}' trigger."
},
"Countdowns": {
"title": "Countdowns",
"toggleIconMode": "Toggle Icon Only",