More progress on caching stuff; journal links; cooltip hotfixes; code cleanups

This commit is contained in:
Tercio Jose
2022-12-23 20:33:29 -03:00
parent ce9a3b875b
commit 7d5d80073b
10 changed files with 416 additions and 161 deletions
+1
View File
@@ -62,6 +62,7 @@ functions\testbars.lua
functions\editmode.lua
functions\warcraftlogs.lua
functions\textures.lua
functions\journal.lua
core\timemachine.lua
+8 -2
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 11
local version = 12
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -2649,10 +2649,12 @@ function DF:CreateCoolTip()
if (anchor and index == 1) then
local myAnchor, hisAnchor, x, y = unpack(anchor)
fontstring:ClearAllPoints()
fontstring:SetPoint(myAnchor, frame.upperImage, hisAnchor or myAnchor, x or 0, y or 0)
elseif (anchor and index == 2) then
local myAnchor, hisAnchor, x, y = unpack(anchor)
fontstring:ClearAllPoints()
fontstring:SetPoint(myAnchor, frame, hisAnchor or myAnchor, x or 0, y or 0)
end
@@ -2725,10 +2727,12 @@ function DF:CreateCoolTip()
if (type(anchor[1]) == "table") then
for anchorIndex, anchorPoints in ipairs(anchor) do
local myAnchor, hisAnchor, x, y = unpack(anchorPoints)
texture:ClearAllPoints()
texture:SetPoint(myAnchor, frame, hisAnchor or myAnchor, x or 0, y or 0)
end
else
local myAnchor, hisAnchor, x, y = unpack(anchor)
texture:ClearAllPoints()
texture:SetPoint(myAnchor, frame, hisAnchor or myAnchor, x or 0, y or 0)
end
end
@@ -2737,8 +2741,10 @@ function DF:CreateCoolTip()
local leftCoord, rightCoord, topCoord, bottomCoord = unpack(texCoord)
texture:SetTexCoord(leftCoord, rightCoord, topCoord, bottomCoord)
end
if (overlay) then
texture:SetVertexColor(unpack(overlay))
local red, green, blue, alpha = DF:ParseColors(overlay)
texture:SetVertexColor(red, green, blue, alpha)
end
gameCooltip.Banner[index] = true
+8 -1
View File
@@ -1,6 +1,6 @@
local dversion = 406
local dversion = 407
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -775,6 +775,13 @@ function DF:AddClassColorToText(text, className)
return text
end
function DF:MakeStringFromSpellId(spellId)
local spellName, _, spellIcon = GetSpellInfo(spellId)
if (spellName) then
return "|T" .. spellIcon .. ":16:16:0:0:64:64:4:60:4:60|t " .. spellName
end
end
function DF:GetClassTCoordsAndTexture(class)
local l, r, t, b = unpack(CLASS_ICON_TCOORDS[class])
return l, r, t, b, [[Interface\WORLDSTATEFRAME\Icons-Classes]]
+81
View File
@@ -72,6 +72,7 @@
Details222.Pets = {}
Details222.MythicPlus = {}
Details222.EJCache = {}
Details222.Segments = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialization stuff
@@ -994,3 +995,83 @@ if (select(4, GetBuildInfo()) >= 100000) then
end
end)
end
Details222.ClassCache = {}
Details222.ClassCache.ByName = {}
Details222.ClassCache.ByGUID = {}
function Details222.ClassCache.GetClass(value)
local className = Details222.ClassCache.ByName[value] or Details222.ClassCache.ByGUID[value]
if (className) then
return className
end
local _, unitClass = UnitClass(value)
return unitClass
end
function Details222.ClassCache.MakeCache()
--iterage among all segments in the container history, get the damage container and get the actor list, check if the actor is a player and if it is, get the class and store it in the cache
for _, combatObject in ipairs(Details.tabela_historico.tabelas) do
for _, actorObject in combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE):ListActors() do
if (actorObject:IsPlayer()) then
local actorName = actorObject.nome
local actorClass = actorObject.classe
local actorGUID = actorObject.serial
Details222.ClassCache.ByName[actorName] = actorClass
Details222.ClassCache.ByGUID[actorGUID] = actorClass
end
end
end
end
Details222.UnitIdCache = {}
Details222.UnitIdCache.Raid = {
[1] = "raid1",
[2] = "raid2",
[3] = "raid3",
[4] = "raid4",
[5] = "raid5",
[6] = "raid6",
[7] = "raid7",
[8] = "raid8",
[9] = "raid9",
[10] = "raid10",
[11] = "raid11",
[12] = "raid12",
[13] = "raid13",
[14] = "raid14",
[15] = "raid15",
[16] = "raid16",
[17] = "raid17",
[18] = "raid18",
[19] = "raid19",
[20] = "raid20",
[21] = "raid21",
[22] = "raid22",
[23] = "raid23",
[24] = "raid24",
[25] = "raid25",
[26] = "raid26",
[27] = "raid27",
[28] = "raid28",
[29] = "raid29",
[30] = "raid30",
[31] = "raid31",
[32] = "raid32",
[33] = "raid33",
[34] = "raid34",
[35] = "raid35",
[36] = "raid36",
[37] = "raid37",
[38] = "raid38",
[39] = "raid39",
[40] = "raid40",
}
Details222.UnitIdCache.Party = {
[1] = "party1",
[2] = "party2",
[3] = "party3",
[4] = "party4",
}
+51 -59
View File
@@ -17,10 +17,10 @@
local _InCombatLockdown = InCombatLockdown --wow api local
local atributo_damage = _detalhes.atributo_damage --details local
local atributo_heal = _detalhes.atributo_heal --details local
local atributo_energy = _detalhes.atributo_energy --details local
local atributo_misc = _detalhes.atributo_misc --details local
local classDamage = _detalhes.atributo_damage --details local
local classHeal = _detalhes.atributo_heal --details local
local classEnergy = _detalhes.atributo_energy --details local
local classUtility = _detalhes.atributo_misc --details local
local alvo_da_habilidade = _detalhes.alvo_da_habilidade --details local
local habilidade_dano = _detalhes.habilidade_dano --details local
local habilidade_cura = _detalhes.habilidade_cura --details local
@@ -216,30 +216,30 @@
if (class_type == class_type_dano) then
if (combate.overall_added and not overall_saved) then
shadow = atributo_damage:r_connect_shadow (esta_classe)
shadow = classDamage:r_connect_shadow (esta_classe)
else
shadow = atributo_damage:r_onlyrefresh_shadow (esta_classe)
shadow = classDamage:r_onlyrefresh_shadow (esta_classe)
end
elseif (class_type == class_type_cura) then
if (combate.overall_added and not overall_saved) then
shadow = atributo_heal:r_connect_shadow (esta_classe)
shadow = classHeal:r_connect_shadow (esta_classe)
else
shadow = atributo_heal:r_onlyrefresh_shadow (esta_classe)
shadow = classHeal:r_onlyrefresh_shadow (esta_classe)
end
elseif (class_type == class_type_e_energy) then
if (combate.overall_added and not overall_saved) then
shadow = atributo_energy:r_connect_shadow (esta_classe)
shadow = classEnergy:r_connect_shadow (esta_classe)
else
shadow = atributo_energy:r_onlyrefresh_shadow (esta_classe)
shadow = classEnergy:r_onlyrefresh_shadow (esta_classe)
end
elseif (class_type == class_type_misc) then
if (combate.overall_added and not overall_saved) then
shadow = atributo_misc:r_connect_shadow (esta_classe)
shadow = classUtility:r_connect_shadow (esta_classe)
else
shadow = atributo_misc:r_onlyrefresh_shadow (esta_classe)
shadow = classUtility:r_onlyrefresh_shadow (esta_classe)
end
end
@@ -262,14 +262,14 @@
--restaura last_events_table
local primeiro_combate = tabelas_do_historico [1] --primeiro combate
if (primeiro_combate) then
primeiro_combate [1]:ActorCallFunction (atributo_damage.r_last_events_table)
primeiro_combate [2]:ActorCallFunction (atributo_heal.r_last_events_table)
primeiro_combate [1]:ActorCallFunction (classDamage.r_last_events_table)
primeiro_combate [2]:ActorCallFunction (classHeal.r_last_events_table)
end
local segundo_combate = tabelas_do_historico [2] --segundo combate
if (segundo_combate) then
segundo_combate [1]:ActorCallFunction (atributo_damage.r_last_events_table)
segundo_combate [2]:ActorCallFunction (atributo_heal.r_last_events_table)
segundo_combate [1]:ActorCallFunction (classDamage.r_last_events_table)
segundo_combate [2]:ActorCallFunction (classHeal.r_last_events_table)
end
end
@@ -748,7 +748,7 @@
UpdateAddOnMemoryUsage()
local memory = GetAddOnMemoryUsage ("Details")
if (memory > _detalhes.memory_ram) then
_detalhes:IniciarColetaDeLixo (true, 60) --sending true doesn't check anythink
_detalhes:RestartInternalGarbageCollector (true, 60) --sending true doesn't check anythink
end
end
end
@@ -762,25 +762,25 @@
_detalhes:Msg("(debug) checking memory periodically. Using: ",math.floor(memory))
end
if (memory > _detalhes.memory_ram * 1000) then
_detalhes:IniciarColetaDeLixo (1, 60) --sending 1 only check for combat and ignore garbage collect cooldown
_detalhes:RestartInternalGarbageCollector (1, 60) --sending 1 only check for combat and ignore garbage collect cooldown
end
end
end
function _detalhes:IniciarColetaDeLixo (forcar, lastevent)
if (not forcar) then
function _detalhes:RestartInternalGarbageCollector(bShouldForceCollect, lastEvent)
if (not bShouldForceCollect) then
if (_detalhes.ultima_coleta + _detalhes.intervalo_coleta > _detalhes._tempo + 1) then
return
elseif (_detalhes.in_combat or _InCombatLockdown() or _detalhes:IsInInstance()) then
_detalhes:ScheduleTimer("IniciarColetaDeLixo", 5)
_detalhes:ScheduleTimer("RestartInternalGarbageCollector", 5)
return
end
else
if (type(forcar) ~= "boolean") then
if (forcar == 1) then
if (type(bShouldForceCollect) ~= "boolean") then
if (bShouldForceCollect == 1) then
if (_detalhes.in_combat or _InCombatLockdown()) then
_detalhes:ScheduleTimer("IniciarColetaDeLixo", 5, forcar)
_detalhes:ScheduleTimer("RestartInternalGarbageCollector", 5, bShouldForceCollect)
return
end
end
@@ -788,70 +788,62 @@
end
if (_detalhes.debug) then
if (forcar) then
_detalhes:Msg("(debug) collecting garbage with forced state: ", forcar)
if (bShouldForceCollect) then
_detalhes:Msg("(debug) collecting garbage with forced state:", bShouldForceCollect)
else
_detalhes:Msg("(debug) collecting garbage.")
end
end
local memory = GetAddOnMemoryUsage ("Details")
--cleanup all the parser caches
Details:ClearParserCache()
--reseta o cache do parser
_detalhes:ClearParserCache()
--limpa barras que no esto sendo usadas nas instncias.
for index, instancia in ipairs(_detalhes.tabela_instancias) do
if (instancia.barras and instancia.barras [1]) then
for i, barra in ipairs(instancia.barras) do
if (not barra:IsShown()) then
barra.minha_tabela = nil
--cleanup all the window lines (bars) which isn't in use
for index, instanceObject in ipairs(Details.tabela_instancias) do
if (instanceObject.barras and instanceObject.barras[1]) then
for i, lineRow in ipairs(instanceObject.barras) do
if (not lineRow:IsShown()) then
lineRow.minha_tabela = nil
end
end
end
end
--faz a coleta nos 4 atributos
local damage = atributo_damage:ColetarLixo (lastevent)
local heal = atributo_heal:ColetarLixo (lastevent)
local energy = atributo_energy:ColetarLixo (lastevent)
local misc = atributo_misc:ColetarLixo (lastevent)
--do garbage collection on the handler for each actor class
local damage = classDamage:ColetarLixo(lastEvent)
local heal = classHeal:ColetarLixo(lastEvent)
local energy = classEnergy:ColetarLixo(lastEvent)
local misc = classUtility:ColetarLixo(lastEvent)
local limpados = damage + heal + energy + misc
--refresh nas janelas
if (limpados > 0) then
_detalhes:InstanciaCallFunction(_detalhes.reset_window)
Details:InstanciaCallFunction(_detalhes.reset_window)
end
_detalhes:ManutencaoTimeMachine()
Details:ManutencaoTimeMachine()
--print cache states
--if (_detalhes.debug) then
-- _detalhes:Msg("(debug) removed: damage "..damage.." heal "..heal.." energy "..energy.." misc "..misc)
--end
--elimina pets antigos
--cleanup backlisted pets within the handler of actor containers
_detalhes:LimparPets()
if (not _detalhes.in_combat) then
_detalhes:ClearCCPetsBlackList()
Details:ClearCCPetsBlackList()
end
--reseta cache de specs
_detalhes:ResetSpecCache()
--cleanup spec cache
Details:ResetSpecCache()
--wipa container de escudos
wipe(_detalhes.escudos)
--cleanup the shield cache
wipe(Details.escudos)
_detalhes.ultima_coleta = _detalhes._tempo
--set the time of the latest internal garbage collect
Details.ultima_coleta = _detalhes._tempo
if (_detalhes.debug) then
Details:Msg("(debug) executing: collectgarbage().")
collectgarbage()
UpdateAddOnMemoryUsage()
--local memory2 = GetAddOnMemoryUsage ("Details")
--_detalhes:Msg("(debug) memory before: "..memory.." memory after: "..memory2)
end
end
--combates Normais
+95 -82
View File
@@ -12,7 +12,6 @@
local UnitHealthMax = UnitHealthMax
local UnitGUID = UnitGUID
local IsInGroup = IsInGroup
--local GetNumGroupMembers = GetNumGroupMembers
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
local GetTime = GetTime
local tonumber = tonumber
@@ -5583,7 +5582,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
--in case the player left the raid during the encounter
local check_for_encounter_end = function()
--this function clear the encounter_id from the cache
local checkIfEncounterIsDone = function()
if (not _current_encounter_id) then
return
end
@@ -5623,8 +5623,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--this function is guaranteed to run after a combat is done
--can also run when the player leaves combat state (regen enabled)
function _detalhes:RunScheduledEventsAfterCombat (OnRegenEnabled)
function _detalhes:RunScheduledEventsAfterCombat(OnRegenEnabled)
if (_detalhes.debug) then
_detalhes:Msg("(debug) running scheduled events after combat end.")
end
@@ -5777,13 +5776,13 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (_detalhes.debug) then
_detalhes:Msg("(debug) |cFFFFFF00PLAYER_REGEN_ENABLED|r event triggered.")
print("combat lockdown:", InCombatLockdown())
print("affecting combat:", UnitAffectingCombat("player"))
--print("combat lockdown:", InCombatLockdown())
--print("affecting combat:", UnitAffectingCombat("player"))
if (_current_encounter_id and IsInInstance()) then
print("has a encounter ID")
print("player is dead:", UnitHealth ("player") < 1)
end
--if (_current_encounter_id and IsInInstance()) then
--print("has a encounter ID")
--print("player is dead:", UnitHealth ("player") < 1)
--end
end
if (Details.auto_swap_to_dynamic_overall) then
@@ -5791,23 +5790,22 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
--elapsed combat time
_detalhes.LatestCombatDone = GetTime()
_detalhes.tabela_vigente.CombatEndedAt = GetTime()
_detalhes.tabela_vigente.TotalElapsedCombatTime = _detalhes.tabela_vigente.CombatEndedAt - (_detalhes.tabela_vigente.CombatStartedAt or 0)
Details.LatestCombatDone = GetTime()
C_Timer.After(10, check_for_encounter_end)
local currentCombat = Details:GetCurrentCombat()
currentCombat.CombatEndedAt = GetTime()
currentCombat.TotalElapsedCombatTime = currentCombat.CombatEndedAt - (currentCombat.CombatStartedAt or 0)
C_Timer.After(10, checkIfEncounterIsDone)
--playing alone, just finish the combat right now
if (not IsInGroup() and not IsInRaid()) then
_detalhes.tabela_vigente.playing_solo = true
_detalhes:SairDoCombate()
currentCombat.playing_solo = true
Details:SairDoCombate()
else
--is in a raid or party group
C_Timer.After(1, function()
local inCombat
if (IsInRaid()) then
--raid
local inCombat = false
for i = 1, GetNumGroupMembers() do
if (UnitAffectingCombat("raid" .. i)) then
@@ -5817,11 +5815,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
if (not inCombat) then
_detalhes:RunScheduledEventsAfterCombat (true)
Details:RunScheduledEventsAfterCombat(true)
end
elseif (IsInGroup()) then
--party (dungeon)
local inCombat = false
for i = 1, GetNumGroupMembers() -1 do
if (UnitAffectingCombat("party" .. i)) then
@@ -5831,7 +5828,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
if (not inCombat) then
_detalhes:RunScheduledEventsAfterCombat (true)
Details:RunScheduledEventsAfterCombat(true)
end
end
end)
@@ -5952,41 +5949,38 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes.in_group = IsInGroup() or IsInRaid()
if (_detalhes.in_group) then
--entrou num grupo
_detalhes:IniciarColetaDeLixo (true)
_detalhes:WipePets()
_detalhes:SchedulePetUpdate(1)
_detalhes:InstanceCall(_detalhes.AdjustAlphaByContext)
--player entered in a group, cleanup and set the new enviromnent
Details:RestartInternalGarbageCollector(true)
Details:WipePets()
Details:SchedulePetUpdate(1)
Details:InstanceCall(Details.AdjustAlphaByContext)
_detalhes:CheckSwitchOnLogon()
_detalhes:CheckVersion()
_detalhes:SendEvent("GROUP_ONENTER")
Details:CheckSwitchOnLogon()
Details:CheckVersion()
Details:SendEvent("GROUP_ONENTER")
_detalhes:DispatchAutoRunCode("on_groupchange")
Details:DispatchAutoRunCode("on_groupchange")
wipe (_detalhes.trusted_characters)
C_Timer.After(5, _detalhes.ScheduleSyncPlayerActorData)
wipe (Details.trusted_characters)
C_Timer.After(5, Details.ScheduleSyncPlayerActorData)
end
else
_detalhes.in_group = IsInGroup() or IsInRaid()
if (not _detalhes.in_group) then
--saiu do grupo
_detalhes:IniciarColetaDeLixo(true)
_detalhes:WipePets()
_detalhes:SchedulePetUpdate(1)
wipe(_detalhes.details_users)
_detalhes:InstanceCall(_detalhes.AdjustAlphaByContext)
_detalhes:CheckSwitchOnLogon()
_detalhes:SendEvent("GROUP_ONLEAVE")
_detalhes:DispatchAutoRunCode("on_groupchange")
wipe (_detalhes.trusted_characters)
--player left the group, run routines to cleanup the environment
Details:RestartInternalGarbageCollector(true)
Details:WipePets()
Details:SchedulePetUpdate(1)
wipe(Details.details_users)
Details:InstanceCall(Details.AdjustAlphaByContext)
Details:CheckSwitchOnLogon()
Details:SendEvent("GROUP_ONLEAVE")
Details:DispatchAutoRunCode("on_groupchange")
wipe(Details.trusted_characters)
else
--ainda esta no grupo
--player is still in a group
_detalhes:SchedulePetUpdate(2)
--send char data
@@ -6415,34 +6409,43 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
wipe(bitfield_swap_cache)
wipe(empower_cache)
local roster = _detalhes.tabela_vigente.raid_roster
local groupRoster = _detalhes.tabela_vigente.raid_roster
if (IsInRaid()) then
local unitIdCache = Details222.UnitIdCache.Raid
for i = 1, GetNumGroupMembers() do
local name = GetUnitName("raid"..i, true)
local unitId = unitIdCache[i]
local unitName = GetUnitName(unitId, true)
local unitGUID = UnitGUID(unitId)
local guid = UnitGUID("raid"..i)
raid_members_cache[guid] = name
roster[name] = guid
local _, unitClass = UnitClass(unitId)
Details222.ClassCache.ByName[unitName] = unitClass
Details222.ClassCache.ByGUID[unitGUID] = unitClass
local role = _UnitGroupRolesAssigned(name)
raid_members_cache[unitGUID] = unitName
groupRoster[unitName] = unitGUID
local role = _UnitGroupRolesAssigned(unitName)
if (role == "TANK") then
tanks_members_cache[UnitGUID("raid"..i)] = true
tanks_members_cache[unitGUID] = true
end
if (auto_regen_power_specs[_detalhes.cached_specs[UnitGUID("raid" .. i)]]) then
auto_regen_cache[name] = auto_regen_power_specs[_detalhes.cached_specs[UnitGUID("raid" .. i)]]
if (auto_regen_power_specs[_detalhes.cached_specs[unitGUID]]) then
auto_regen_cache[unitName] = auto_regen_power_specs[_detalhes.cached_specs[unitGUID]]
end
end
elseif (IsInGroup()) then
--party
local unitIdCache = Details222.UnitIdCache.Party
for i = 1, GetNumGroupMembers()-1 do
local name = GetUnitName("party"..i, true)
local unitId = unitIdCache[i]
local guid = UnitGUID("party"..i)
local name = GetUnitName(unitId, true)
local guid = UnitGUID(unitId)
raid_members_cache[guid] = name
roster[name] = guid
groupRoster[name] = guid
local role = _UnitGroupRolesAssigned(name)
if (role == "TANK") then
@@ -6455,44 +6458,46 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
--player
local name = GetUnitName("player", true)
local playerName = GetUnitName("player", true)
local playerGUID = UnitGUID("player")
raid_members_cache[UnitGUID("player")] = name
roster[name] = UnitGUID("player")
raid_members_cache[playerGUID] = playerName
groupRoster[playerName] = playerGUID
local role = _UnitGroupRolesAssigned(name)
local role = _UnitGroupRolesAssigned(playerName)
if (role == "TANK") then
tanks_members_cache[UnitGUID("player")] = true
tanks_members_cache[playerGUID] = true
end
if (auto_regen_power_specs[_detalhes.cached_specs[UnitGUID("player")]]) then
auto_regen_cache[name] = auto_regen_power_specs[_detalhes.cached_specs[UnitGUID("player")]]
if (auto_regen_power_specs[_detalhes.cached_specs[playerGUID]]) then
auto_regen_cache[playerName] = auto_regen_power_specs[_detalhes.cached_specs[playerGUID]]
end
else
local name = GetUnitName("player", true)
local playerName = GetUnitName("player", true)
local playerGUID = UnitGUID("player")
raid_members_cache[UnitGUID("player")] = name
roster[name] = UnitGUID("player")
raid_members_cache[playerGUID] = playerName
groupRoster[playerName] = playerGUID
local role = _UnitGroupRolesAssigned(name)
local role = _UnitGroupRolesAssigned(playerName)
if (role == "TANK") then
tanks_members_cache[UnitGUID("player")] = true
tanks_members_cache[playerGUID] = true
else
local spec = DetailsFramework.GetSpecialization()
if (spec and spec ~= 0) then
if (DetailsFramework.GetSpecializationRole (spec) == "TANK") then
tanks_members_cache[UnitGUID("player")] = true
tanks_members_cache[playerGUID] = true
end
end
end
if (auto_regen_power_specs[_detalhes.cached_specs[UnitGUID("player")]]) then
auto_regen_cache[name] = auto_regen_power_specs[_detalhes.cached_specs[UnitGUID("player")]]
if (auto_regen_power_specs[_detalhes.cached_specs[playerGUID]]) then
auto_regen_cache[playerName] = auto_regen_power_specs[_detalhes.cached_specs[playerGUID]]
end
end
local orderNames = {}
for playerName in pairs(roster) do
for playerName in pairs(groupRoster) do
orderNames[#orderNames+1] = playerName
end
table.sort(orderNames, function(name1, name2)
@@ -6500,20 +6505,28 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end)
_detalhes.tabela_vigente.raid_roster_indexed = orderNames
if (_detalhes.iam_a_tank) then
tanks_members_cache[UnitGUID("player")] = true
end
end
function _detalhes:IsATank(playerguid)
return tanks_members_cache[playerguid]
---return true or false
---@param unitGUID string
---@return boolean
function Details:IsATank(unitGUID)
return tanks_members_cache[unitGUID] or false
end
function _detalhes:IsInCache(playerguid)
return raid_members_cache[playerguid]
---returns the unit name
---@param unitGUID string
---@return string
function Details:IsInCache(unitGUID)
return raid_members_cache[unitGUID]
end
function _detalhes:GetParserPlayerCache()
---return the internal raid members cache, containing the unitGUID as key and the unitName as value
---@return table
function Details:GetParserPlayerCache()
return raid_members_cache
end
+16 -3
View File
@@ -547,6 +547,8 @@ do
EncounterJournal_LoadUI()
end
hooksecurefunc("EncounterJournal_OpenJournalLink", Details222.EJCache.OnClickEncounterJournalLink)
do
--iterate among all raid instances, by passing true in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get raid instances
local bGetRaidInstances = true
@@ -770,9 +772,20 @@ do
end
--reset the dungeon journal to the default state
if (EncounterJournalSuggestTab) then
EncounterJournalSuggestTab:Click()
end
C_Timer.After(0.5, function()
EncounterJournal_ResetDisplay(nil, "none")
end)
C_Timer.After(1, function()
if (EncounterJournalSuggestTab) then
EncounterJournalSuggestTab:Click()
end
end)
--EncounterJournal_OpenJournalLink(tag, jtype, id, difficultyID)
--EncounterJournal_OpenJournal(difficultyID, instanceID, encounterID, sectionID, creatureID, itemID, tierIndex)
--local tooltipInfo = CreateBaseTooltipInfo("GetHyperlink", link, classID, specID);
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+141
View File
@@ -0,0 +1,141 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local C_Timer = _G.C_Timer
local addonName, Details222 = ...
--get the sectionInfo and try to extract the spellID from it
--sectionInfo is always a valid table
local parseSectionInfoForSpellID = function(sectionInfo)
local spellId = sectionInfo.spellID
if (spellId) then
spellId = tonumber(spellId)
if (spellId) then
local spellName = GetSpellInfo(spellId)
if (spellName) then
return spellId
end
end
end
end
--this function is called when the player clicks on a link in the chat window to open a section in the encounter journal
function Details222.EJCache.OnClickEncounterJournalLink(tag, journalType, id, difficultyId)
journalType = tonumber(journalType)
id = tonumber(id)
difficultyId = tonumber(difficultyId)
local instanceId, encounterId, sectionId, tierIndex = EJ_HandleLinkPath(journalType, id)
if (sectionId) then
local sectionInfo = C_EncounterJournal.GetSectionInfo(sectionId)
if (sectionInfo and type(sectionInfo) == "table") then
local spellId = parseSectionInfoForSpellID(sectionInfo)
--spellId is guaranteed to be a valid spellId or nil
if (spellId) then
local damageDoneTable = Details222.DamageSpells.GetDamageDoneToPlayersBySpell(spellId)
local topDamage = damageDoneTable[1] and damageDoneTable[1][2]
if (topDamage and topDamage > 0) then
--build a cooltip with the damage done to players by the spellId
local gameCooltip = GameCooltip
gameCooltip:Preset(2)
gameCooltip:SetType("tooltip")
gameCooltip:SetOption("LeftPadding", -5)
gameCooltip:SetOption("RightPadding", 5)
gameCooltip:SetOption("LinePadding", 1)
gameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_hyanda]])
for i = 1, #damageDoneTable do
local targetName, damageDone = unpack(damageDoneTable[i])
local nameWithoutRealm = DF:RemoveRealmName(targetName)
local formattedDamage = Details:ToK2(damageDone)
local className = Details222.ClassCache.GetClass(targetName)
local classTexture, left, right, top, bottom = Details:GetClassIcon(className)
gameCooltip:AddLine(nameWithoutRealm, formattedDamage)
gameCooltip:AddIcon(classTexture, 1, 1, 14, 14, left, right, top, bottom)
gameCooltip:AddStatusBar(damageDone / topDamage * 100, 1, .5, .5, .5, 1, false, {value = 100, color = {.2, .2, .2, 0.9}, texture = [[Interface\AddOns\Details\images\bar_hyanda]]})
end
local abilityString = DF:MakeStringFromSpellId(spellId)
if (abilityString) then
abilityString = abilityString .. " (damage to)"
end
local anchor = {"bottom", "top", 0, 0}
gameCooltip:SetBannerImage(1, 2, [[Interface\PetBattles\Weather-Blizzard]], 220, 55, anchor, {0.85, 0.189609375, 1, 0}, {0, 0, 0, 1})
gameCooltip:SetBannerText(1, 2, abilityString or "Ability Damage Done", {"bottomleft", "topleft", 0, 2}, "white", 14)
gameCooltip:SetOwner(EncounterJournal, "topleft", "topright", 50, -10)
gameCooltip:Show()
end
end
end
end
if (not Details222.EJCache.HasJournalOnHideHooked) then
Details222.EJCache.HasJournalOnHideHooked = true
EncounterJournal:HookScript("OnHide", function()
GameCooltip:Hide()
end)
end
end
--search the damage container within the combatObject index[1] for actor that used the spellId passed and inflicted damage to players
---@param spellId number
---@param combatId any
---@return table
function Details222.DamageSpells.GetDamageDoneToPlayersBySpell(spellId, combatId)
local combatObject = Details:GetCombat(combatId)
if (not combatObject) then
return {}
end
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
if (not damageContainer) then
return {}
end
local damageDoneTable = {}
for index, actorObject in damageContainer:ListActors() do
if (actorObject:IsNeutralOrEnemy()) then
local spellTable = actorObject:GetSpell(spellId)
if (spellTable) then
for targetName, damageDone in pairs(spellTable.targets) do
damageDoneTable[targetName] = (damageDoneTable[targetName] or 0) + damageDone
end
end
end
end
local sortedResult = {}
for targetName, damageDone in pairs(damageDoneTable) do
local className = Details222.ClassCache.GetClass(targetName)
sortedResult[#sortedResult + 1] = {targetName, damageDone, className}
end
table.sort(sortedResult, function(a, b) return a[2] > b[2] end)
return sortedResult
end
--[=[
["description"] = "Eranog wreathes several players in flames. Upon expiration a Flamerift forms at each player's location, inflicting 144,550 Fire damage to players within 4 yards.
A Flamescale Tarasek spills forth from each Flamerift, leaving behind a Lava Flow.
On Mythic difficulty, Eranog also opens a Greater Flamerift that creates a Flamescale Captain.",
["link"] = "[Flamerift]",
["siblingSectionID"] = 26037,
["startsOpen"] = false,
["creatureDisplayID"] = 0,
["headerType"] = 2,
["title"] = "Flamerift",
["firstChildSectionID"] = 26036,
["uiModelSceneID"] = 0,
["filteredByDifficulty"] = false,
["abilityIcon"] = 134153,
["spellID"] = 390715,
--]=]
+12 -12
View File
@@ -72,28 +72,28 @@ do
return [[Interface\AddOns\Details\images\icons2]], unpack(roles [role])
end
function _detalhes:GetClassIcon (class)
local c
function _detalhes:GetClassIcon(class)
if (self.classe) then
c = self.classe
class = self.classe
elseif (type(class) == "table" and class.classe) then
c = class.classe
class = class.classe
elseif (type(class) == "string") then
c = class
class = class
else
c = "UNKNOW"
class = "UNKNOW"
end
if (c == "UNKNOW") then
if (class == "UNKNOW") then
return [[Interface\LFGFRAME\LFGROLE_BW]], 0.25, 0.5, 0, 1
elseif (c == "UNGROUPPLAYER") then
elseif (class == "UNGROUPPLAYER") then
return [[Interface\ICONS\Achievement_Character_Orc_Male]], 0, 1, 0, 1
elseif (c == "PET") then
elseif (class == "PET") then
return [[Interface\AddOns\Details\images\classes_small]], 0.25, 0.49609375, 0.75, 1
else
return [[Interface\AddOns\Details\images\classes_small]], unpack(_detalhes.class_coords [c])
return [[Interface\AddOns\Details\images\classes_small]], unpack(_detalhes.class_coords[class])
end
end
+3 -2
View File
@@ -223,7 +223,7 @@ function Details:StartMeUp() --I'll never stop!
self.ultima_coleta = 0
self.intervalo_coleta = 720
self.intervalo_memoria = 180
self.garbagecollect = Details.Schedules.NewTicker(self.intervalo_coleta, Details.IniciarColetaDeLixo, Details)
self.garbagecollect = Details.Schedules.NewTicker(self.intervalo_coleta, Details.RestartInternalGarbageCollector, Details)
self.next_memory_check = _G.time() + self.intervalo_memoria
--player role
@@ -579,9 +579,10 @@ function Details:StartMeUp() --I'll never stop!
_G["UpdateAddOnMemoryUsage"] = Details.UpdateAddOnMemoryUsage_Custom
end
pcall(Details222.EJCache.MakeCache)
pcall(Details222.ClassCache.MakeCache)
function Details:InstallOkey()
return true
end