From ed67c38b0f3126d940a77b841cad3bd70d603fae Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Tue, 16 Dec 2025 15:03:29 -0500 Subject: [PATCH] fix multi use for some conditionals --- Conditionals.lua | 36 +++++++++++++++++----------------- Core.lua | 3 +++ Extensions/Tooltip/Generic.lua | 4 ++++ 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Conditionals.lua b/Conditionals.lua index e7d7861..614a0e1 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -2306,9 +2306,9 @@ CleveRoids.Keywords = { -- Check if an argument like :target or :focus was provided. The parser turns this into a table. if type(conditionals.combat) == "table" then -- If so, run the check on the provided unit(s). - return Or(conditionals.combat, function(unit) + return Multi(conditionals.combat, function(unit) return UnitExists(unit) and UnitAffectingCombat(unit) - end) + end, conditionals, "combat") else -- Otherwise, this is a bare [combat]. The value might be 'true' or a spell name. -- In either case, it should safely default to checking the player. @@ -2482,9 +2482,9 @@ CleveRoids.Keywords = { end, reactive = function(conditionals) - return Or(conditionals.reactive, function (v) + return Multi(conditionals.reactive, function (v) return CleveRoids.IsReactiveUsable(v) - end) + end, conditionals, "reactive") end, noreactive = function(conditionals) @@ -2494,7 +2494,7 @@ CleveRoids.Keywords = { end, usable = function(conditionals) - return Or(conditionals.usable, function(name) + return Multi(conditionals.usable, function(name) -- If checking a reactive spell, use reactive logic if CleveRoids.reactiveSpells[name] then return CleveRoids.IsReactiveUsable(name) @@ -2528,7 +2528,7 @@ CleveRoids.Keywords = { -- Check item cooldown (0 remaining = usable) local remaining = CleveRoids.GetItemCooldown(itemName) return remaining == 0 - end) + end, conditionals, "usable") end, nousable = function(conditionals) @@ -2612,9 +2612,9 @@ CleveRoids.Keywords = { return CleveRoids.CheckChanneled(nil) else -- String form [checkchanneled:SpellName] - check if NOT channeling that spell - return Or(conditionals.checkchanneled, function(channeledSpells) + return Multi(conditionals.checkchanneled, function(channeledSpells) return CleveRoids.CheckChanneled(channeledSpells) - end) + end, conditionals, "checkchanneled") end end, @@ -2624,9 +2624,9 @@ CleveRoids.Keywords = { return CleveRoids.CheckCasting(nil) else -- String form [checkcasting:SpellName] - check if NOT casting that spell - return Or(conditionals.checkcasting, function(castingSpells) + return Multi(conditionals.checkcasting, function(castingSpells) return CleveRoids.CheckCasting(castingSpells) - end) + end, conditionals, "checkcasting") end end, @@ -2655,9 +2655,9 @@ CleveRoids.Keywords = { end, mybuff = function(conditionals) - return Or(conditionals.mybuff, function(v) + return Multi(conditionals.mybuff, function(v) return CleveRoids.ValidatePlayerBuff(v) - end) + end, conditionals, "mybuff") end, nomybuff = function(conditionals) @@ -2667,9 +2667,9 @@ CleveRoids.Keywords = { end, mydebuff = function(conditionals) - return Or(conditionals.mydebuff, function(v) + return Multi(conditionals.mydebuff, function(v) return CleveRoids.ValidatePlayerDebuff(v) - end) + end, conditionals, "mydebuff") end, nomydebuff = function(conditionals) @@ -3075,7 +3075,7 @@ CleveRoids.Keywords = { inrange = function(conditionals) if not IsSpellInRange then return end - return Or(conditionals.inrange, function(spellName) + return Multi(conditionals.inrange, function(spellName) local target = conditionals.target or "target" local checkValue = spellName or conditionals.action @@ -3088,7 +3088,7 @@ CleveRoids.Keywords = { end return IsSpellInRange(checkValue, target) == 1 - end) + end, conditionals, "inrange") end, noinrange = function(conditionals) @@ -3110,7 +3110,7 @@ CleveRoids.Keywords = { outrange = function(conditionals) if not IsSpellInRange then return end - return Or(conditionals.outrange, function(spellName) + return Multi(conditionals.outrange, function(spellName) local target = conditionals.target or "target" local checkValue = spellName or conditionals.action @@ -3122,7 +3122,7 @@ CleveRoids.Keywords = { end return IsSpellInRange(checkValue, target) == 0 - end) + end, conditionals, "outrange") end, combo = function(conditionals) diff --git a/Core.lua b/Core.lua index eea8dfd..b36e49a 100644 --- a/Core.lua +++ b/Core.lua @@ -494,6 +494,9 @@ local _ReagentBySpell = { ["Blind"] = "Blinding Powder", -- 5530 } +-- Expose for use in Generic.lua (IndexSpells fallback) +CleveRoids.ReagentBySpell = _ReagentBySpell + -- Minimal map for rogue reagents; extend as needed local _ReagentIdByName = { ["Flash Powder"] = 5140, -- Vanish diff --git a/Extensions/Tooltip/Generic.lua b/Extensions/Tooltip/Generic.lua index ac82d12..3ec4663 100644 --- a/Extensions/Tooltip/Generic.lua +++ b/Extensions/Tooltip/Generic.lua @@ -57,6 +57,10 @@ function CleveRoids.IndexSpells() spells[bookType] = {} else local cost, reagent = CleveRoids.GetSpellCost(i, bookType) + -- Fallback for known reagent spells if tooltip scan failed + if not reagent and CleveRoids.ReagentBySpell then + reagent = CleveRoids.ReagentBySpell[spellName] + end local texture = GetSpellTexture(i, bookType) if not spells[bookType][spellName] then spells[bookType][spellName] = {