fix overflow debuffs

This commit is contained in:
Jrc13245
2025-12-11 22:22:46 -05:00
parent b5f7399d30
commit 35cce7e61a
2 changed files with 21 additions and 11 deletions
+6 -5
View File
@@ -390,11 +390,12 @@ end
-- Helper: Get debuff time-left (seconds) from CleveRoids.libdebuff only
local function _get_debuff_timeleft(unitToken, auraName)
-- SuperWoW path: GUID-based lookup
-- SuperWoW debuff slots: 1-16 are regular debuffs, 17-48 overflow to buff slots 1-32
if CleveRoids.hasSuperwow then
local _, guid = UnitExists(unitToken)
if guid and CleveRoids.libdebuff and CleveRoids.libdebuff.objects[guid] then
-- Check 1-32: debuff slots 1-16 + all 32 buff slots for overflow
for i = 1, 32 do
-- Check 1-48: debuff slots 1-16 + overflow debuffs in buff slots 1-32
for i = 1, 48 do
local effect, _, _, _, _, duration, timeleft = CleveRoids.libdebuff:UnitDebuff(unitToken, i)
if not effect then break end
if effect == auraName and timeleft and timeleft >= 0 then
@@ -406,7 +407,7 @@ local function _get_debuff_timeleft(unitToken, auraName)
-- Non-SuperWoW fallback
if CleveRoids.libdebuff and CleveRoids.libdebuff.UnitDebuff then
for idx = 1, 32 do
for idx = 1, 48 do
local effect, _, _, _, _, duration, timeleft = CleveRoids.libdebuff:UnitDebuff(unitToken, idx)
if not effect then break end
if effect == auraName and timeleft and timeleft >= 0 then
@@ -1692,8 +1693,8 @@ function CleveRoids.ValidateUnitDebuff(unit, args)
filterCaster = nil
end
-- Check 1-32: debuff slots 1-16 + all 32 buff slots for overflow
for idx = 1, 32 do
-- Check 1-48: debuff slots 1-16 + overflow debuffs in buff slots 1-32
for idx = 1, 48 do
local effect, _, _, _, _, duration, timeleft, effectCaster = CleveRoids.libdebuff:UnitDebuff(unit, idx, filterCaster)
if not effect then break end
if effect == args.name then
+15 -6
View File
@@ -1369,13 +1369,22 @@ function lib:UnitDebuff(unit, id, filterCaster)
-- Normalize GUID to string for consistent table key lookups
guid = CleveRoids.NormalizeGUID(guid)
local texture, stacks, dtype, spellID = UnitDebuff(unit, id)
local texture, stacks, dtype, spellID = nil, nil, nil, nil
if not texture or not spellID then
texture, stacks, spellID = UnitBuff(unit, id)
-- Only accept buffs that are known debuffs (either static or learned durations, including combo durations)
if texture and spellID and lib:GetDuration(spellID) <= 0 then
return nil
-- SuperWoW debuff slots: 1-16 are regular debuffs, 17-48 overflow to buff slots 1-32
-- See: https://forum.turtle-wow.org/viewtopic.php?t=13281
if id <= 16 then
-- Regular debuff slot
texture, stacks, dtype, spellID = UnitDebuff(unit, id)
else
-- Overflow debuff in buff slot: debuff index 17 = buff index 1, etc.
local buffIndex = id - 16
if buffIndex <= 32 then
texture, stacks, spellID = UnitBuff(unit, buffIndex)
-- Only accept buffs that are known debuffs (either static or learned durations, including combo durations)
if texture and spellID and lib:GetDuration(spellID) <= 0 then
return nil
end
end
end