Fix debuff overflow duration tracking for learned durations

Fixed three issues preventing overflowed debuffs from being properly tracked
with duration information, especially for debuffs with learned durations:

1. lib:UnitDebuff() (line 760): Changed overflow check from only checking
   static database (lib.durations[spellID]) to also checking learned durations
   via lib:GetDuration(spellID). This allows overflowed debuffs with learned
   durations to be properly returned.

2. SeedUnit() UnitBuff loop (line 807): Fixed incorrect UnitBuff() return value
   capture - was trying to get 4 values when it only returns 3, causing spellID
   to always be nil.

3. SeedUnit() both loops (lines 797, 810): Changed to use lib:GetDuration()
   instead of only checking lib.durations[], so both regular debuffs AND
   overflowed debuffs with learned durations are properly seeded into the
   tracking system.

This ensures debuff conditionals like [debuff:Moonfire<4] work correctly for
overflowed debuffs, even if the duration was learned rather than in the
static database.
This commit is contained in:
Claude
2025-11-16 23:20:48 +00:00
parent 67c639d04d
commit 2935e036d4
+15 -8
View File
@@ -756,7 +756,8 @@ function lib:UnitDebuff(unit, id)
if not texture or not spellID then
texture, stacks, spellID = UnitBuff(unit, id)
if texture and spellID and not lib.durations[spellID] then
-- Only accept buffs that are known debuffs (either static or learned durations)
if texture and spellID and lib:GetDuration(spellID) <= 0 then
return nil
end
end
@@ -792,20 +793,26 @@ local function SeedUnit(unit)
local tex, stacks, dtype, spellID = UnitDebuff(unit, i)
if not tex then break end
if spellID and lib.durations[spellID] then
if not (lib.objects[guid] and lib.objects[guid][spellID]) then
lib:AddEffect(guid, unitName, spellID, lib:GetDuration(spellID), stacks)
if spellID then
local duration = lib:GetDuration(spellID)
if duration > 0 then
if not (lib.objects[guid] and lib.objects[guid][spellID]) then
lib:AddEffect(guid, unitName, spellID, duration, stacks)
end
end
end
end
for i=1, 32 do
local tex, stacks, _, spellID = UnitBuff(unit, i)
local tex, stacks, spellID = UnitBuff(unit, i)
if not tex then break end
if spellID and lib.durations[spellID] then
if not (lib.objects[guid] and lib.objects[guid][spellID]) then
lib:AddEffect(guid, unitName, spellID, lib:GetDuration(spellID), stacks)
if spellID then
local duration = lib:GetDuration(spellID)
if duration > 0 then
if not (lib.objects[guid] and lib.objects[guid][spellID]) then
lib:AddEffect(guid, unitName, spellID, duration, stacks)
end
end
end
end