28 lines
931 B
JavaScript
28 lines
931 B
JavaScript
/**
|
|
* Stop XP flag history tracking (tab-based version).
|
|
*/
|
|
|
|
const TARGET_ACTOR = game.actors.getName("Zeratal") ?? null;
|
|
const ACTOR_ID = TARGET_ACTOR?.id ?? "put-actor-id-here";
|
|
|
|
if (!ACTOR_ID || ACTOR_ID === "put-actor-id-here") {
|
|
return ui.notifications.warn("Set ACTOR_ID before running the macro.");
|
|
}
|
|
|
|
const state = game.pf1?.xpHistoryFlags;
|
|
if (!state) return ui.notifications.info("XP flag history tracking is not active.");
|
|
|
|
const logKey = `pf1-xp-history-flags-${ACTOR_ID}`;
|
|
const handler = state.hooks?.[logKey];
|
|
|
|
if (!handler) {
|
|
return ui.notifications.info(`No XP flag history hook found for ${TARGET_ACTOR?.name ?? ACTOR_ID}.`);
|
|
}
|
|
|
|
Hooks.off("updateActor", handler);
|
|
delete state.hooks[logKey];
|
|
if (state.current) delete state.current[ACTOR_ID];
|
|
|
|
const actorName = game.actors.get(ACTOR_ID)?.name ?? TARGET_ACTOR?.name ?? ACTOR_ID;
|
|
ui.notifications.info(`XP flag history tracking disabled for ${actorName}.`);
|