Cache maintenance; Parser options

This commit is contained in:
Tercio Jose
2023-01-27 14:45:33 -03:00
parent 6352fc8387
commit 59372cc0bd
11 changed files with 1123 additions and 1561 deletions
+44 -30
View File
@@ -1785,82 +1785,96 @@
end
--call update functions
function Details:RefreshAllMainWindows (forcar)
local combatTable = self.showing
function Details:RefreshAllMainWindows(bForceRefresh)
local combatObject = self.showing
--the the segment does not have a valid combat, freeze the window
if (not combatTable) then
if (not combatObject) then
if (not self.freezed) then
return self:Freeze()
end
return
end
local need_refresh = combatTable[self.atributo].need_refresh
if (not need_refresh and not forcar) then
return --no precisa de refresh
--else
--combatTable[self.atributo].need_refresh = false
local needRefresh = combatObject[self.atributo].need_refresh
if (not needRefresh and not bForceRefresh) then
return
end
--measure the cpu time spent on this function
--local startTime = debugprofilestop()
if (self.atributo == 1) then --damage
return atributo_damage:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_damage:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 2) then --heal
return atributo_heal:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_heal:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 3) then --energy
return atributo_energy:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_energy:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 4) then --outros
return atributo_misc:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_misc:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 5) then --ocustom
return atributo_custom:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_custom:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
end
--[[if (Details222.Perf.WindowUpdateC) then
local elapsedTime = debugprofilestop() - startTime
if (Details222.Perf.WindowUpdate) then
Details222.Perf.WindowUpdate = Details222.Perf.WindowUpdate + elapsedTime
end
end--]]
end
--["1"] = "WindowUpdate",
--["2"] = 308.6662000129,
function Details:DumpPerf()
local t = {}
for name, value in pairs(Details222.Perf) do
t[#t+1] = {name, value}
end
dumpt(t)
end
function Details:ForceRefresh()
self:RefreshMainWindow(true)
end
function Details:RefreshMainWindow(instance, forceRefresh)
function Details:RefreshMainWindow(instance, bForceRefresh)
if (not instance or type(instance) == "boolean") then
forceRefresh = instance
bForceRefresh = instance
instance = self
end
if (not forceRefresh) then
if (not bForceRefresh) then
Details.LastUpdateTick = Details._tempo
end
if (instance == -1) then
--update
for index, instance in ipairs(Details.tabela_instancias) do
if (instance.ativa) then
if (instance.modo == modo_GROUP or instance.modo == modo_ALL) then
instance:RefreshAllMainWindows(forceRefresh)
--print("all instances got updates")
for index, thisInstance in ipairs(Details.tabela_instancias) do
if (thisInstance.ativa) then
if (thisInstance.modo == modo_GROUP or thisInstance.modo == modo_ALL) then
thisInstance:RefreshAllMainWindows(bForceRefresh)
end
end
end
--flag windows as no need update next tick
for index, instance in ipairs(Details.tabela_instancias) do
if (instance.ativa and instance.showing) then
if (instance.modo == modo_GROUP or instance.modo == modo_ALL) then
if (instance.atributo <= 4) then
instance.showing [instance.atributo].need_refresh = false
for index, thisInstance in ipairs(Details.tabela_instancias) do
if (thisInstance.ativa and thisInstance.showing) then
if (thisInstance.modo == modo_GROUP or thisInstance.modo == modo_ALL) then
if (thisInstance.atributo <= 4) then
thisInstance.showing[thisInstance.atributo].need_refresh = false
end
end
end
end
if (not forceRefresh) then --update player details window if opened
if (not bForceRefresh) then --update player details window if opened
if (info.ativo) then
--print("info.jogador:MontaInfo()")
return info.jogador:MontaInfo()
end
end
@@ -1876,7 +1890,7 @@
if (instance.modo == modo_ALL or instance.modo == modo_GROUP) then
--print("updating all instances...")
return instance:RefreshAllMainWindows (forceRefresh)
return instance:RefreshAllMainWindows(bForceRefresh)
end
end
+51
View File
@@ -1,4 +1,5 @@
local _detalhes = _G._detalhes
local addonName, Details222 = ...
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
local UnitName = UnitName
@@ -3275,3 +3276,53 @@ function CopyText(text) --[[GLOBAL]]
Details.CopyTextField.textField:HighlightText()
end)
end
-------------------------------------------------------------------------
--> cache maintenance
function Details222.Cache.DoMaintenance()
local currentTime = time()
local delay = 1036800 --12 days
if (currentTime > Details.latest_spell_pool_access + delay) then
local spellIdPoolBackup = DetailsFramework.table.copy({}, Details.spell_pool)
wipe(Details.spell_pool)
--preserve ignored spells spellId
for spellId in pairs(Details.spellid_ignored) do
Details.spell_pool[spellId] = spellIdPoolBackup[spellId]
end
Details.latest_spell_pool_access = currentTime
wipe(spellIdPoolBackup)
end
if (currentTime > Details.latest_npcid_pool_access + delay) then
local npcIdPoolBackup = DetailsFramework.table.copy({}, Details.npcid_pool)
wipe(Details.npcid_pool)
--preserve ignored npcs npcId
for npcId in pairs (Details.npcid_ignored) do
Details.npcid_pool[npcId] = npcIdPoolBackup[npcId]
end
Details.latest_npcid_pool_access = currentTime
wipe(npcIdPoolBackup)
end
if (currentTime > Details.latest_encounter_spell_pool_access + delay) then
wipe(Details.encounter_spell_pool)
Details.latest_encounter_spell_pool_access = currentTime
end
if (currentTime > Details.boss_mods_timers.latest_boss_mods_access + delay) then
wipe(Details.boss_mods_timers.encounter_timers_bw)
wipe(Details.boss_mods_timers.encounter_timers_dbm)
Details.boss_mods_timers.latest_boss_mods_access = currentTime
end
--latest_shield_spellid_cache_access
--shield_spellid_cache
end
+1 -1
View File
@@ -834,7 +834,7 @@
Details:ResetSpecCache()
--cleanup the shield cache
wipe(Details.escudos)
wipe(Details.ShieldCache)
--set the time of the latest internal garbage collect
Details.ultima_coleta = _detalhes._tempo
+963 -1506
View File
File diff suppressed because it is too large Load Diff