refactor: unify aura and hoT tracking into a single master dictionary with localized support

This commit is contained in:
Bluewhale1337
2026-10-15 14:19:10 +02:00
parent 3ed13b97f4
commit 71b92fe1a6
8 changed files with 67 additions and 40 deletions
+25 -32
View File
@@ -166,17 +166,6 @@ function HealBot_CheckBuffs(unit)
end
end
local HealBot_TrackedHoTs = {
["Interface\\Icons\\Spell_Holy_Renew"] = true,
["Interface\\Icons\\Spell_Nature_Rejuvenation"] = true,
["Interface\\Icons\\Spell_Nature_ResistNature"] = true,
["Interface\\Icons\\Spell_Holy_PowerWordShield"] = true,
["Interface\\Icons\\Spell_Holy_SealOfProtection"] = true,
["Interface\\Icons\\Spell_Holy_Excorcism"] = true,
["Interface\\Icons\\btnholyscriptures"] = true,
["Interface\\Icons\\Spell_Holy_AshesToAshes"] = true,
}
local HealBot_DebuffTypeMap = nil
local HealBot_AuraWarningPlayed = {}
@@ -190,6 +179,9 @@ function HealBot_OnEvent_UnitAura(this, unit)
[HEALBOT_POISON] = HEALBOT_POISON_en,
[HEALBOT_CURSE] = HEALBOT_CURSE_en
}
if HealBot_Init_TrackedAuras then
HealBot_Init_TrackedAuras()
end
end
local DebuffType;
@@ -280,13 +272,26 @@ function HealBot_OnEvent_UnitAura(this, unit)
local buff = UnitBuff(unit, b)
if not buff then break end
activeBuffs[buff] = true
if HealBot_TrackedHoTs[buff] and iconCount < 10 then
if HealBot_TrackedAura_Textures and HealBot_TrackedAura_Textures[buff] and iconCount < 10 then
iconCount = iconCount + 1
HealBot_UnitIcons[unit][iconCount] = buff
end
b = b + 1
end
local d = 1
local activeDebuffs = HealBot_GetTable()
while true do
local debuff = UnitDebuff(unit, d)
if not debuff then break end
activeDebuffs[debuff] = true
if HealBot_TrackedAura_Textures and HealBot_TrackedAura_Textures[debuff] and iconCount < 10 then
iconCount = iconCount + 1
HealBot_UnitIcons[unit][iconCount] = debuff
end
d = d + 1
end
if HealBot_Integrations_Nampower_Active and HealBot_Nampower_Auras then
local guid = HealBot_GetUnitGUID and HealBot_GetUnitGUID(unit)
if guid then
@@ -294,33 +299,21 @@ function HealBot_OnEvent_UnitAura(this, unit)
HealBot_Nampower_NameCache[guid] = UnitName(unit)
if HealBot_Nampower_Auras[guid] then
local validHoTs = {
["Renew"] = "Interface\\Icons\\Spell_Holy_Renew",
["Rejuvenation"] = "Interface\\Icons\\Spell_Nature_Rejuvenation",
["Regrowth"] = "Interface\\Icons\\Spell_Nature_ResistNature",
["Power Word: Shield"] = "Interface\\Icons\\Spell_Holy_PowerWordShield",
}
for spellName, _ in pairs(HealBot_Nampower_Auras[guid]) do
local tex = validHoTs[spellName]
if tex and not activeBuffs[tex] then
HealBot_Nampower_Auras[guid][spellName] = nil
local auraInfo = HealBot_TrackedAura_Spells and HealBot_TrackedAura_Spells[spellName]
if auraInfo then
local tex = auraInfo.texture
local isActive = auraInfo.isDebuff and activeDebuffs[tex] or activeBuffs[tex]
if not isActive then
HealBot_Nampower_Auras[guid][spellName] = nil
end
end
end
end
end
end
HealBot_ReleaseTable(activeBuffs)
local d = 1
while true do
local debuff = UnitDebuff(unit, d)
if not debuff then break end
if HealBot_TrackedHoTs[debuff] and iconCount < 10 then
iconCount = iconCount + 1
HealBot_UnitIcons[unit][iconCount] = debuff
end
d = d + 1
end
HealBot_ReleaseTable(activeDebuffs)
if HealBot_UnitDebuff[unit] then
if DebuffType and HealBot_Range_Check(unit, 40) == 1 then
+31
View File
@@ -603,3 +603,34 @@ function HealBot_ReleaseTable(t)
end
end
HealBot_TrackedAuras = {
["Renew"] = { texture = "Interface\\Icons\\Spell_Holy_Renew", isDebuff = false, showTimer = true, locKey = "HEALBOT_RENEW" },
["Rejuvenation"] = { texture = "Interface\\Icons\\Spell_Nature_Rejuvenation", isDebuff = false, showTimer = true, locKey = "HEALBOT_REJUVENATION" },
["Regrowth"] = { texture = "Interface\\Icons\\Spell_Nature_ResistNature", isDebuff = false, showTimer = true, locKey = "HEALBOT_REGROWTH" },
["Power Word: Shield"] = { texture = "Interface\\Icons\\Spell_Holy_PowerWordShield", isDebuff = false, showTimer = true, locKey = "HEALBOT_POWER_WORD_SHIELD" },
["Fear Ward"] = { texture = "Interface\\Icons\\Spell_Holy_Excorcism", isDebuff = false, showTimer = true, locKey = "HEALBOT_FEAR_WARD" },
["Abolish Disease"] = { texture = "Interface\\Icons\\Spell_Nature_NullifyDisease",isDebuff = false, showTimer = true, locKey = "HEALBOT_ABOLISH_DISEASE" },
["Abolish Poison"] = { texture = "Interface\\Icons\\Spell_Nature_NullifyPoison", isDebuff = false, showTimer = true, locKey = "HEALBOT_ABOLISH_POISON" },
["Weakened Soul"] = { texture = "Interface\\Icons\\Spell_Holy_AshesToAshes", isDebuff = true, showTimer = true, locKey = "HEALBOT_WEAKENED_SOUL" },
["Blessing of Protection"] = { texture = "Interface\\Icons\\Spell_Holy_SealOfProtection", isDebuff = false, showTimer = false },
["Holy Scriptures"] = { texture = "Interface\\Icons\\btnholyscriptures", isDebuff = false, showTimer = false },
};
HealBot_TrackedAura_Textures = {};
HealBot_TrackedAura_Spells = {};
function HealBot_Init_TrackedAuras()
for spell, info in pairs(HealBot_TrackedAuras) do
HealBot_TrackedAura_Textures[info.texture] = info
HealBot_TrackedAura_Spells[spell] = info
if info.locKey then
local locName = getglobal(info.locKey)
if locName and locName ~= "" then
HealBot_TrackedAura_Spells[locName] = info
end
end
end
end
HealBot_Init_TrackedAuras();
+1
View File
@@ -154,6 +154,7 @@ HEALBOT_BUFF_REGROWTH = "Interface\\Icons\\Spell_Nature_ResistNature"
HEALBOT_BUFF_RENEW = "Interface\\Icons\\Spell_Holy_Renew";
HEALBOT_BUFF_FEAR_WARD = "Interface\\Icons\\Spell_Holy_Excorcism";
HEALBOT_DEBUFF_WEAKENED_SOUL = "Interface\\Icons\\Spell_Holy_AshesToAshes";
HEALBOT_WEAKENED_SOUL = "Geschw\195\164chte Seele";
HEALBOT_DEBUFF_RECENTLY_BANDAGED = "Interface\\Icons\\INV_Misc_Bandage_08";
+1
View File
@@ -171,6 +171,7 @@ HEALBOT_BUFF_REGROWTH = "Interface\\Icons\\Spell_Nature_ResistNature"
HEALBOT_BUFF_RENEW = "Interface\\Icons\\Spell_Holy_Renew";
HEALBOT_BUFF_FEAR_WARD = "Interface\\Icons\\Spell_Holy_Excorcism";
HEALBOT_DEBUFF_WEAKENED_SOUL = "Interface\\Icons\\Spell_Holy_AshesToAshes";
HEALBOT_WEAKENED_SOUL = "Weakened Soul";
HEALBOT_DEBUFF_RECENTLY_BANDAGED = "Interface\\Icons\\INV_Misc_Bandage_08";
+1
View File
@@ -72,6 +72,7 @@ HEALBOT_LESSER_HEAL = "Soins inf\195\169rieurs";
HEALBOT_LESSER_HEALING_WAVE = "Vague de soins mineurs";
HEALBOT_MEND_PET = "Soigner un Familier";
HEALBOT_POWER_WORD_SHIELD = "Mot de pouvoir : Bouclier";
HEALBOT_WEAKENED_SOUL = "\195\130me affaiblie";
HEALBOT_REGROWTH = "R\195\169tablissement";
HEALBOT_RENEW = "R\195\169novation";
HEALBOT_REJUVENATION = "R\195\169cup\195\169ration";
+1
View File
@@ -54,6 +54,7 @@ if (GetLocale() == "koKR") then
HEALBOT_LESSER_HEALING_WAVE = "하급 치유의 물결";
HEALBOT_MEND_PET = "동물 치료";
HEALBOT_POWER_WORD_SHIELD = "신의 권능: 보호막";
HEALBOT_WEAKENED_SOUL = "신체 취약";
HEALBOT_REGROWTH = "재생";
HEALBOT_RENEW = "소생";
HEALBOT_REJUVENATION = "회복";
+4 -8
View File
@@ -1372,12 +1372,7 @@ end
local HealBot_PlayerHoTsListFrame = nil
local HealBot_PlayerHoTFrames = {}
local HealBot_PlayerHoTs_ValidHoTs = {
["Renew"] = "Interface\\Icons\\Spell_Holy_Renew",
["Rejuvenation"] = "Interface\\Icons\\Spell_Nature_Rejuvenation",
["Regrowth"] = "Interface\\Icons\\Spell_Nature_ResistNature",
["Power Word: Shield"] = "Interface\\Icons\\Spell_Holy_PowerWordShield",
}
local HealBot_PlayerHoTs_ListCache = {}
@@ -1409,7 +1404,8 @@ function HealBot_Action_UpdatePlayerHoTs()
if HealBot_Integrations_Nampower_Active and HealBot_Nampower_Auras then
for targetName, auras in pairs(HealBot_Nampower_Auras) do
for spellName, expiration in pairs(auras) do
if HealBot_PlayerHoTs_ValidHoTs[spellName] then
local auraInfo = HealBot_TrackedAura_Spells and HealBot_TrackedAura_Spells[spellName]
if auraInfo and auraInfo.showTimer then
if expiration > currentTime then
numHoTs = numHoTs + 1
if not HealBot_PlayerHoTs_ListCache[numHoTs] then
@@ -1504,7 +1500,7 @@ function HealBot_Action_UpdatePlayerHoTs()
end
local spellId = HealBot_GetSpellId and HealBot_GetSpellId(hot.spell) or nil
local tex = HealBot_PlayerHoTs_ValidHoTs[hot.spell] or "Interface\\Icons\\INV_Misc_QuestionMark"
local tex = (HealBot_TrackedAura_Spells and HealBot_TrackedAura_Spells[hot.spell] and HealBot_TrackedAura_Spells[hot.spell].texture) or "Interface\\Icons\\INV_Misc_QuestionMark"
if spellId then
tex = GetSpellTexture(spellId, "BOOKTYPE_SPELL") or tex
end
+3
View File
@@ -50,6 +50,9 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\
### Change Log
**v1.7.6**
* **Refactor & Feature - Unified Aura & HoT Tracking** - Unified bar icons and HoT timers into a single master dictionary (`HealBot_TrackedAuras`) in `HealBot_Data.lua`. Added Weakened Soul, Fear Ward, Abolish Disease, and Abolish Poison to active timer bars with localized client support and debuff-aware pruning.
**v1.7.5**
* **Feature - Test Bars** - Implemented a "Test Bars" button and slider in the Skins options tab, allowing you to spawn and adjust a dummy raid group of up to 40 members without being in a real raid. This allows for easy layout and appearance customization out of combat.
* **UI - Skins Options & Custom Health Gradients** - Added configurable Max HP and Min HP colour pickers with descriptive labels for custom gradient support. Fixed colour picker button click interceptors and hooked ColorPickerFrame callbacks. Integrated global font selector across raid frame text, headers, Options button, and preview bars. Reorganized Skins tab layout to anchor Test Bars cleanly in Column 2.