diff --git a/Conditionals.lua b/Conditionals.lua index 360f6c8..f2d12cb 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -793,6 +793,45 @@ function CleveRoids.ValidatePlayerDebuff(args) return CleveRoids.ValidateAura("player", args, false) end +function CleveRoids.ValidateWeaponImbue(slot, imbueName) + -- Check if weapon has enchant + local hasMainEnchant, mainExpiration, mainCharges, hasOffEnchant, offExpiration, offCharges = GetWeaponEnchantInfo() + + local hasEnchant = (slot == "mh" and hasMainEnchant) or (slot == "oh" and hasOffEnchant) + if not hasEnchant then return false end + + -- If no specific imbue requested, just return enchant exists + if not imbueName or imbueName == "" then return true end + + -- Create tooltip scanner if needed + if not CleveRoidsTooltip then + CreateFrame("GameTooltip", "CleveRoidsTooltip", nil, "GameTooltipTemplate") + end + + -- Scan weapon tooltip + CleveRoidsTooltip:SetOwner(UIParent, "ANCHOR_NONE") + CleveRoidsTooltip:ClearLines() + CleveRoidsTooltip:SetInventoryItem("player", slot == "mh" and 16 or 17) + + -- Look for green text (temporary enchant) + for i = 1, CleveRoidsTooltip:NumLines() do + local text = _G["CleveRoidsTooltipTextLeft"..i] + if text then + local line = text:GetText() + local r, g, b = text:GetTextColor() + -- Green text indicates temporary enchant + if line and g > 0.8 and r < 0.2 and b < 0.2 then + -- Normalize and compare + line = string.lower(line) + imbueName = string.lower(string.gsub(imbueName, "_", " ")) + return string.find(line, imbueName, 1, true) ~= nil + end + end + end + + return false +end + -- TODO: Look into https://github.com/Stanzilla/WoWUIBugs/issues/47 if needed function CleveRoids.GetCooldown(name, ignoreGCD) if not name then return 0 end @@ -1907,5 +1946,21 @@ CleveRoids.Keywords = { mybuffcount = function(conditionals) return And(conditionals.mybuffcount,function (v) return CleveRoids.ValidatePlayerAuraCount(v.bigger, v.amount) end) + end, + + mhimbue = function(conditionals) + return CleveRoids.ValidateWeaponImbue("mh", conditionals.value) + end, + + nomhimbue = function(conditionals) + return not CleveRoids.ValidateWeaponImbue("mh", conditionals.value) + end, + + ohimbue = function(conditionals) + return CleveRoids.ValidateWeaponImbue("oh", conditionals.value) + end, + + noohimbue = function(conditionals) + return not CleveRoids.ValidateWeaponImbue("oh", conditionals.value) end } diff --git a/Extensions/Tooltip/Generic.lua b/Extensions/Tooltip/Generic.lua index 426d607..0029301 100644 --- a/Extensions/Tooltip/Generic.lua +++ b/Extensions/Tooltip/Generic.lua @@ -192,6 +192,36 @@ function CleveRoids.ClearSlot(slots, slot) slots[slot] = nil end +-- Local helper for 1.12.1: safely get action button info via tooltip +function CleveRoids.GetActionButtonInfo(slot) + if not CleveRoidsActionTooltip then + CreateFrame("GameTooltip", "CleveRoidsActionTooltip", UIParent, "GameTooltipTemplate") + end + + local tooltip = CleveRoidsActionTooltip + tooltip:SetOwner(UIParent, "ANCHOR_NONE") + tooltip:ClearLines() + tooltip:SetAction(slot) + + local name, rank + local text = _G["CleveRoidsActionTooltipTextLeft1"] + if text then name = text:GetText() end + local text2 = _G["CleveRoidsActionTooltipTextLeft2"] + if text2 then + local maybeRank = text2:GetText() + -- Rank lines usually start with "Rank" + if maybeRank and string.find(maybeRank, "Rank") then + rank = maybeRank + end + end + + -- Determine if it's an item or spell based on texture (heuristic) + local tex = GetActionTexture(slot) + local actionType = tex and "SPELL" or "ITEM" + + return actionType, tex, name, rank +end + function CleveRoids.IndexActionSlot(slot) if not HasAction(slot) then CleveRoids.Actions[slot] = nil @@ -202,7 +232,6 @@ function CleveRoids.IndexActionSlot(slot) if name then local reactiveName = CleveRoids.reactiveSpells[name] and name local actionSlotName = name..(rank and ("("..rank..")") or "") - if reactiveName then if not CleveRoids.reactiveSlots[reactiveName] then CleveRoids.reactiveSlots[reactiveName] = slot @@ -211,7 +240,6 @@ function CleveRoids.IndexActionSlot(slot) elseif not reactiveName then CleveRoids.ClearSlot(CleveRoids.reactiveSlots, slot) end - if actionType == "SPELL" or actionType == "ITEM" then if not CleveRoids.actionSlots[actionSlotName] then CleveRoids.actionSlots[actionSlotName] = slot @@ -220,7 +248,6 @@ function CleveRoids.IndexActionSlot(slot) end end end - CleveRoids.TestForActiveAction(CleveRoids.GetAction(slot)) CleveRoids.SendEventForAction(slot, "ACTIONBAR_SLOT_CHANGED", slot) end diff --git a/README.md b/README.md index 4f6ce40..4ec847a 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,7 @@ The system includes pre-configured durations for 329+ debuffs across all classes | mybuffcount | [mybuffcount:>=X]
[mybuffcount:<=X] | | | If the player has more or less auras present than X.| | queuedspell | [queuedspell]
[queuedspell:X] | | * | if the player has any or a specific spell queued with nampower. | | onswingpending | [onswingpending] | | * | If the player has a on swing spell pending.| +| mhimbue/ohimbue | [mhimbue:Flametongue]
[ohimbue] | | * | If the player has weapon imbue on their mh/oh.| ### Unit Based ### The default @unitid is usually @target if you don't specify one