add spell item dropin for spell based triggers and actions
This commit is contained in:
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+11
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user