add spell item dropin for spell based triggers and actions

This commit is contained in:
ChatGPT
2026-06-04 21:01:54 +02:00
parent 3c25080666
commit c2ffa47ff2
29 changed files with 191 additions and 13 deletions
Executable → Regular
View File
View File
View File
View File
+11
View File
@@ -13,6 +13,7 @@ export async function handleTrigger(triggerType, context) {
try {
if (!reaction?.enabled) continue;
if (reaction.trigger?.type !== triggerType) continue;
if (!matchesTriggerSpellFilter(reaction.trigger, context)) continue;
if (!await checkConsumptionAvailable(reaction, context)) continue;
if (!await checkConditions(reaction, context)) continue;
@@ -23,3 +24,13 @@ export async function handleTrigger(triggerType, context) {
}
}
}
function matchesTriggerSpellFilter(trigger, context) {
const expectedName = trigger?.spell?.itemName;
if (!expectedName) return true;
const actualName = context?.spellItem?.name ?? context?.item?.name ?? context?.itemName ?? context?.spellName ?? null;
if (!actualName) return false;
return actualName.toLocaleLowerCase() === expectedName.toLocaleLowerCase();
}