tracking: reduce memory load on aura change

This commit is contained in:
shagu
2018-07-15 21:32:19 +02:00
parent 95b7acbe8e
commit 387854e801
+28 -12
View File
@@ -3,6 +3,13 @@ pfUI:RegisterModule("tracking", function ()
MiniMapTrackingFrame:UnregisterAllEvents()
MiniMapTrackingFrame:Hide()
local function HasEntries(tbl)
for _ in pairs(tbl) do
return true
end
return nil
end
local config = {
border = C.appearance.border.default,
size = tonumber(C.appearance.minimap.tracking_size),
@@ -71,7 +78,7 @@ pfUI:RegisterModule("tracking", function ()
elseif not texture then
state.texture = nil
if config.pulse and table.getn(state.spells) > 0 then
if config.pulse and HasEntries(state.spells) then
this.pulse = true
this.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark")
this.icon:SetVertexColor(1,1,1,1)
@@ -126,28 +133,37 @@ pfUI:RegisterModule("tracking", function ()
local _, playerClass = UnitClass("player")
local isCatForm = pfUI.tracking:PlayerIsDruidInCatForm(playerClass)
state.spells = {}
for tabIndex = 1, GetNumSpellTabs() do
local _, _, offset, numSpells = GetSpellTabInfo(tabIndex)
for spellIndex = offset + 1, offset + numSpells do
local spellTexture = GetSpellTexture(spellIndex, BOOKTYPE_SPELL)
for _, c in pairs({"any", playerClass}) do
for _, t in pairs(knownTrackingSpellTextures[c] or {}) do
if c == "DRUID" and not isCatForm then
break
end
if strfind(spellTexture, t) then
table.insert(state.spells, {
for _, texture in pairs(knownTrackingSpellTextures["any"]) do
if strfind(spellTexture, texture) and not state.spells[texture] then
state.spells[texture] = {
index = spellIndex,
name = GetSpellName(spellIndex, BOOKTYPE_SPELL),
texture = spellTexture
}
end
end
for _, texture in pairs(knownTrackingSpellTextures[playerClass]) do
if strfind(spellTexture, texture) and not state.spells[texture] then
state.spells[texture] = {
index = spellIndex,
name = GetSpellName(spellIndex, BOOKTYPE_SPELL),
texture = spellTexture
})
break
end
}
end
end
end
end
-- remove humanoid tracking for non-cat druids
if playerClass == "DRUID" and not isCatForm then
state.spells["Ability_Tracking"] = nil
end
end
function pfUI.tracking:PlayerIsDruidInCatForm(playerClass)