fix: resolve UI rendering crashes, address unit frame aliasing bugs, and implement automatic debuff tracking with lazy-load identity fetches.

This commit is contained in:
Bluewhale1337
2026-08-22 17:18:48 +02:00
parent d0e027ec12
commit b3c2b4a096
7 changed files with 145 additions and 63 deletions
+57 -14
View File
@@ -155,10 +155,21 @@ local HealBot_TrackedHoTs = {
["Interface\\Icons\\Spell_Holy_AshesToAshes"] = true,
}
local HealBot_DebuffTypeMap = nil
function HealBot_OnEvent_UnitAura(this, unit)
if not HealBot_DebuffTypeMap then
HealBot_DebuffTypeMap = {
[HEALBOT_DISEASE] = HEALBOT_DISEASE_en,
[HEALBOT_MAGIC] = HEALBOT_MAGIC_en,
[HEALBOT_POISON] = HEALBOT_POISON_en,
[HEALBOT_CURSE] = HEALBOT_CURSE_en
}
end
local DebuffType;
if HealBot_Heals[unit] and unit ~= "target" then
if HealBot_Heals[unit] then
if not HealBot_UnitIcons[unit] then
HealBot_UnitIcons[unit] = {}
end
@@ -168,17 +179,43 @@ function HealBot_OnEvent_UnitAura(this, unit)
local iconCount = 0
local i = 1;
HealBot_UnitDebuff[unit] = nil;
while true do
local debuff, tmp, debuff_type = UnitDebuff(unit, i, 1)
local debuff, tmp, debuff_type = UnitDebuff(unit, i)
if debuff then
if iconCount < 10 then
iconCount = iconCount + 1
HealBot_UnitIcons[unit][iconCount] = debuff
local mapped_type = nil
if debuff_type then
mapped_type = HealBot_DebuffTypeMap[debuff_type] or debuff_type
end
if HealBot_CDCInc[UnitClass(unit)] == 1 and debuff_type and HealBot_DebuffWatch[debuff_type] then
HealBot_UnitDebuff[unit] = debuff_type
DebuffType = debuff_type;
if HealBot_DebuffPriority[debuff_type] then
local unitClass = HealBot_Model.units[unit] and HealBot_Model.units[unit].class or UnitClass(unit)
local shouldTrack = false
if unit == "target" then
shouldTrack = true
elseif HealBot_CDCInc[unitClass] == 1 then
shouldTrack = true
elseif not unitClass or HealBot_CDCInc[unitClass] == nil then
shouldTrack = true
end
if shouldTrack and mapped_type and HealBot_DebuffWatch[mapped_type] then
if iconCount < 10 then
iconCount = iconCount + 1
HealBot_UnitIcons[unit][iconCount] = debuff
end
HealBot_UnitDebuff[unit] = mapped_type
DebuffType = mapped_type;
local isPriority = false
if HealBot_DebuffPriority then
for _, pType in ipairs(HealBot_DebuffPriority) do
if pType == mapped_type then
isPriority = true
break
end
end
end
if isPriority then
break
end
end
@@ -213,16 +250,22 @@ function HealBot_OnEvent_UnitAura(this, unit)
if HealBot_UnitDebuff[unit] then
if DebuffType and HealBot_Range_Check(unit, 27) == 1 then
if HealBot_Config.ShowDebuffWarning == 1 then
local color = HealBot_Config.CDCBarColour[DebuffType]
local r, g, b = 1, 0, 0
if color then
r, g, b = color.R, color.G, color.B
end
UIErrorsFrame:AddMessage(UnitName(unit) .. " suffers from " .. DebuffType,
HealBot_Config.CDCBarColour[DebuffType].R,
HealBot_Config.CDCBarColour[DebuffType].G,
HealBot_Config.CDCBarColour[DebuffType].B,
r, g, b,
1, UIERRORS_HOLD_TIME);
end
if HealBot_Config.SoundDebuffWarning == 1 then HealBot_PlaySound(HealBot_Config.SoundDebuffPlay); end
end
end
HealBot_CheckBuffs(unit);
HealBot_RecalcHeals(unit);
-- Check buffs synchronously because tooltip scanning fails in OnUpdate
HealBot_CheckBuffs(unit)
-- Defer UI updates
HealBot_View_DirtyUnits[unit] = true
end
end