mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
many fixes
This commit is contained in:
+13
-4
@@ -36,7 +36,10 @@ local stat_checks = {
|
||||
|
||||
-- Defensive Stats
|
||||
armor = function() local _, effective = UnitArmor("player"); return effective end,
|
||||
defense = function() return GetDefense() end,
|
||||
defense = function()
|
||||
local base, modifier = UnitDefense("player")
|
||||
return (base or 0) + (modifier or 0)
|
||||
end,
|
||||
|
||||
-- Resistances
|
||||
arcane_res = function() local _, val = UnitResistance("player", 7); return val end,
|
||||
@@ -765,7 +768,12 @@ function CleveRoids.ValidateUnitDebuff(unit, args)
|
||||
end
|
||||
end
|
||||
|
||||
-- No timers at all: treat missing/unknown as 0s and compare
|
||||
-- No timers at all: treat missing/unknown as 0s and compare
|
||||
if not found then
|
||||
-- If debuff doesn't exist, treat as 0 seconds and compare
|
||||
return cmp[args.operator](0, args.amount)
|
||||
end
|
||||
-- If we reach here with no timer data, treat as 0
|
||||
return cmp[args.operator](0, args.amount)
|
||||
end
|
||||
end
|
||||
@@ -1445,7 +1453,8 @@ CleveRoids.Keywords = {
|
||||
|
||||
-- The "Or" helper handles multiple values like [class:Warrior/Druid].
|
||||
return Or(conditionals.class, function(requiredClass)
|
||||
return strlower(requiredClass) == strlower(localizedClass) or strlower(requiredClass) == strlower(englishClass)
|
||||
-- Line ~1114
|
||||
return string.lower(requiredClass) == string.lower(localizedClass) or string.lower(requiredClass) == string.lower(englishClass)
|
||||
end)
|
||||
end,
|
||||
|
||||
@@ -1470,7 +1479,7 @@ CleveRoids.Keywords = {
|
||||
|
||||
-- The "And" helper ensures the player's class is not any of the forbidden classes.
|
||||
return And(conditionals.noclass, function(forbiddenClass)
|
||||
return strlower(forbiddenClass) ~= strlower(localizedClass) and strlower(forbiddenClass) ~= strlower(englishClass)
|
||||
return string.lower(forbiddenClass) ~= string.lower(localizedClass) and string.lower(forbiddenClass) ~= string.lower(englishClass)
|
||||
end)
|
||||
end
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ function CleveRoids.GetReagentCount(reagentName)
|
||||
local _, _, idstr = string.find(link, "item:(%d+)")
|
||||
local id = idstr and tonumber(idstr) or nil
|
||||
if (wantId and id == wantId) or (not wantId and string.find(link, "%["..reagentName.."%]")) then
|
||||
total = total + (count > 0 and count or 1)
|
||||
total = total + (count or 0)
|
||||
end
|
||||
else
|
||||
-- Fallback: scan bag slot tooltip for the name
|
||||
@@ -137,7 +137,7 @@ function CleveRoids.GetReagentCount(reagentName)
|
||||
local left1 = _G[tip:GetName().."TextLeft1"]
|
||||
local name = left1 and left1:GetText()
|
||||
if name and name == reagentName then
|
||||
total = total + (count > 0 and count or 1)
|
||||
total = total + (count or 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -151,8 +151,16 @@ function CleveRoids.GetSpellCost(spellSlot, bookType)
|
||||
CleveRoids.Frame:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||
CleveRoids.Frame:SetSpell(spellSlot, bookType)
|
||||
|
||||
local _, _, cost = string.find(CleveRoids.Frame.costFontString:GetText() or "", "^(%d+)%s+[^yYsS]") -- avoid yd/yds
|
||||
local _, _, reagent = string.find(CleveRoids.Frame.reagentFontString:GetText() or "", "^Reagents?%s*:%s*(.*)")
|
||||
local cost, reagent
|
||||
local costText = CleveRoids.Frame.costFontString:GetText()
|
||||
if costText then
|
||||
_, _, cost = string.find(costText, "^(%d+)%s+[^yYsS]")
|
||||
end
|
||||
|
||||
local reagentText = CleveRoids.Frame.reagentFontString:GetText()
|
||||
if reagentText then
|
||||
_, _, reagent = string.find(reagentText, "^Reagents?%s*:%s*(.*)")
|
||||
end
|
||||
reagent = _StripColor(reagent)
|
||||
|
||||
-- Fallback: scan all lines on a named tooltip (handles Vanish layout)
|
||||
|
||||
+23
-8
@@ -16,9 +16,12 @@ if type(hooksecurefunc) ~= "function" then
|
||||
local orig = _G[fname]
|
||||
if type(orig) ~= "function" then return end
|
||||
_G[fname] = function(...)
|
||||
local r = { orig(unpack(arg)) } -- Lua 5.0 varargs
|
||||
post(unpack(arg))
|
||||
return unpack(r)
|
||||
-- Capture arguments into a local table to avoid arg scope issues
|
||||
local args = arg or {}
|
||||
local n = (type(args) == "table" and args.n) or 0
|
||||
local r = { orig(unpack(args, 1, n)) }
|
||||
post(unpack(args, 1, n))
|
||||
return unpack(r, 1, table.getn(r))
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -29,9 +32,12 @@ if type(hooksecurefunc) ~= "function" then
|
||||
local orig = tgt[fname]
|
||||
if type(orig) ~= "function" then return end
|
||||
tgt[fname] = function(...)
|
||||
local r = { orig(unpack(arg)) }
|
||||
post(unpack(arg))
|
||||
return unpack(r)
|
||||
-- Capture arguments into a local table to avoid arg scope issues
|
||||
local args = arg or {}
|
||||
local n = (type(args) == "table" and args.n) or 0
|
||||
local r = { orig(unpack(args, 1, n)) }
|
||||
post(unpack(args, 1, n))
|
||||
return unpack(r, 1, table.getn(r))
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -410,6 +416,12 @@ function lib:PersistPending(effect)
|
||||
lib:RemovePending()
|
||||
end
|
||||
|
||||
local function GenerateUniqueTooltipName()
|
||||
local base = "CleveRoidsLibDebuffTT"
|
||||
local suffix = string.format("%d%d", GetTime() * 1000, math.random(1000, 9999))
|
||||
return base .. suffix
|
||||
end
|
||||
|
||||
-- Read API similar to pfUI: returns effect, rank(nil), texture, stacks, dtype, duration, timeleft, caster
|
||||
function lib:UnitDebuff(unit, id)
|
||||
local unitName = UnitName(unit)
|
||||
@@ -432,13 +444,16 @@ function lib:UnitDebuff(unit, id)
|
||||
-- We avoid a full scanner dependency to keep this self-contained:
|
||||
-- Build a temporary tooltip to fetch line 1 as the effect name.
|
||||
if not lib._tt then
|
||||
lib._tt = CreateFrame("GameTooltip", "CleveRoidsLibDebuffTT", UIParent, "GameTooltipTemplate")
|
||||
lib._tt = CreateFrame("GameTooltip", nil, UIParent, "GameTooltipTemplate")
|
||||
lib._tt:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
lib._L1 = lib._tt:CreateFontString(nil, nil, "GameTooltipText")
|
||||
lib._R1 = lib._tt:CreateFontString(nil, nil, "GameTooltipText")
|
||||
lib._tt:AddFontStrings(lib._L1, lib._R1)
|
||||
end
|
||||
local tt = lib._tt
|
||||
tt:ClearLines()
|
||||
tt:SetUnitDebuff(unit, id)
|
||||
effect = (getglobal("CleveRoidsLibDebuffTTTextLeft1") and getglobal("CleveRoidsLibDebuffTTTextLeft1"):GetText()) or ""
|
||||
effect = lib._L1 and lib._L1:GetText() or ""
|
||||
end
|
||||
|
||||
-- read level-scoped storage, try exact level then 0 fallback (pfUI pattern)
|
||||
|
||||
Reference in New Issue
Block a user