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
+5 -2
View File
@@ -76,6 +76,8 @@
Details222.Segments = {}
Details222.Tables = {}
Details222.Mixins = {}
Details222.Cache = {}
Details222.Perf = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialization stuff
@@ -252,8 +254,9 @@ do
[2522] = true, --sepulcher of the first ones
}
--armazena os escudos - Shields information for absorbs
_detalhes.escudos = {}
--store shield information for absorbs
_detalhes.ShieldCache = {}
--armazena as funes dos frames - Frames functions
_detalhes.gump = _G ["DetailsFramework"]
function _detalhes:GetFramework()
+10 -15
View File
@@ -961,37 +961,32 @@ function atributo_heal:RefreshBarra(thisLine, instancia, from_resize)
end
function _detalhes:CloseShields(combat)
local escudos = _detalhes.escudos
if (not _detalhes.parser_options.shield_overheal) then
return
end
local shieldCache = _detalhes.ShieldCache
local container = combat[2]
local timeNow = time()
local parser = _detalhes.parser
local GetSpellInfo = GetSpellInfo --no colocar no cache de spells
local getSpellInfo = GetSpellInfo --does not add the spell into the spell info cache
for alvo_name, spellid_table in pairs(escudos) do
local tgt = container:PegarCombatente (_, alvo_name)
for targetName, spellid_table in pairs(shieldCache) do
local tgt = container:PegarCombatente (_, targetName)
if (tgt) then
for spellid, owner_table in pairs(spellid_table) do
local spellname = GetSpellInfo(spellid)
local spellname = getSpellInfo(spellid)
for owner, amount in pairs(owner_table) do
if (amount > 0) then
local obj = container:PegarCombatente (_, owner)
if (obj) then
parser:heal ("SPELL_AURA_REMOVED", timeNow, obj.serial, owner, obj.flag_original, tgt.serial, alvo_name, tgt.flag_original, nil, spellid, spellname, nil, 0, _math_ceil (amount), 0, 0, nil, true)
parser:heal("SPELL_AURA_REMOVED", timeNow, obj.serial, owner, obj.flag_original, tgt.serial, targetName, tgt.flag_original, nil, spellid, spellname, nil, 0, _math_ceil (amount), 0, 0, nil, true)
end
end
end
end
end
end
--escudo [alvo_name] [spellid] [who_name]
end
--------------------------------------------- // TOOLTIPS // ---------------------------------------------
+2 -2
View File
@@ -507,8 +507,8 @@ function segmentClass:resetar()
--limpa o cache de magias
Details:ClearSpellCache()
--limpa a tabela de escudos
wipe(Details.escudos)
--limpa a tabela de ShieldCache
wipe(Details.ShieldCache)
--reinicia a time machine
timeMachine:Reiniciar()
+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
+12 -3
View File
@@ -428,6 +428,8 @@ function Details:OpenForge()
entry:SetPoint("left", label, "right", 2, 0)
entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
end
Details.latest_spell_pool_access = time()
return DetailsForgeAllSpellsFilterPanel
end,
search = function()
@@ -437,7 +439,7 @@ function Details:OpenForge()
local lower_FilterCaster = lower (filter_caster)
local lower_FilterSpellName = lower (filter_name)
wipe (spell_already_added)
local SpellPoll = Details.spell_pool
for spellID, className in pairs(SpellPoll) do
@@ -516,8 +518,7 @@ function Details:OpenForge()
{texture = spellIcon, texcoord = {.1, .9, .1, .9}},
{text = spellName or "", id = data[1] or 1},
data[1] or "",
Details:GetSpellSchoolFormatedName (Details.spell_school_cache [spellName]) or "",
"|c" .. classColor .. data[2] .. "|r",
Details:GetSpellSchoolFormatedName (Details.spell_school_cache [spellName]) or "", "|c" .. classColor .. data[2] .. "|r",
events,
Details.spellid_ignored[data[1]]
}
@@ -566,6 +567,8 @@ function Details:OpenForge()
entry:SetPoint("left", label, "right", 2, 0)
entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
end
Details.latest_encounter_spell_pool_access = time()
return DetailsForgeEncounterBossSpellsFilterPanel
end,
search = function()
@@ -712,6 +715,8 @@ function Details:OpenForge()
searchEntry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
end
Details.latest_npcid_pool_access = time()
return DetailsForgeEncounterNpcIDsFilterPanel
end,
@@ -813,6 +818,8 @@ function Details:OpenForge()
entry:SetPoint("left", label, "right", 2, 0)
entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
end
Details.boss_mods_timers.latest_boss_mods_access = time()
return DetailsForgeDBMBarsFilterPanel
end,
search = function()
@@ -945,6 +952,8 @@ function Details:OpenForge()
entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
--
end
Details.boss_mods_timers.latest_boss_mods_access = time()
return DetailsForgeBigWigsBarsFilterPanel
end,
search = function()
+7 -1
View File
@@ -899,4 +899,10 @@ mythicDungeonCharts.ClassColors = {
if (debugmode) then
--C_Timer.After(1, mythicDungeonCharts.ShowChart)
end
end
Details222.MythicPlus = {
IsMythicPlus = function()
return C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo() and true or false
end,
}
+26 -1
View File
@@ -1463,13 +1463,34 @@ local default_global_data = {
show_life_percent = false,
show_segments = false,
},
--spell caches
boss_mods_timers = {
encounter_timers_dbm = {},
encounter_timers_bw = {},
latest_boss_mods_access = time(),
},
spell_pool = {},
encounter_spell_pool = {},
latest_spell_pool_access = time(),
npcid_pool = {},
latest_npcid_pool_access = time(),
encounter_spell_pool = {},
latest_encounter_spell_pool_access = time(),
--store spells that passed by the healing absorb event on the parser, this list will help counting the overhealing of shields
shield_spellid_cache = {},
latest_shield_spellid_cache_access = time(),
--parser options
parser_options = {
--compute the overheal of shields
shield_overheal = false,
--compute the energy wasted by players when they current energy is equal to the maximum energy
energy_overflow = false,
},
--aura creation frame libwindow
createauraframe = {}, --deprecated
@@ -1737,6 +1758,10 @@ local exportProfileBlacklist = {
mythic_plus = true,
plugin_window_pos = true,
switchSaved = true,
installed_skins_cache = true,
trinket_data = true,
keystone_cache = true,
performance_profiles = true,
}
--transform the current profile into a string which can be shared in the internet
+2
View File
@@ -583,6 +583,8 @@ function Details:StartMeUp() --I'll never stop!
pcall(Details222.ClassCache.MakeCache)
Details222.Cache.DoMaintenance()
function Details:InstallOkey()
return true
end