general round of code cleanup and making it more robust
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
Details222.MythicPlus = {}
|
||||
Details222.EJCache = {}
|
||||
Details222.Segments = {}
|
||||
Details222.Tables = {}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--initialization stuff
|
||||
@@ -1074,4 +1075,10 @@ Details222.UnitIdCache.Party = {
|
||||
[2] = "party2",
|
||||
[3] = "party3",
|
||||
[4] = "party4",
|
||||
}
|
||||
}
|
||||
|
||||
function Details222.Tables.MakeWeakTable(mode)
|
||||
local newTable = {}
|
||||
setmetatable(newTable, {__mode = mode or "v"})
|
||||
return newTable
|
||||
end
|
||||
@@ -22,6 +22,11 @@
|
||||
return habilidade_dano:NovaTabela(spellId, nil, cleuToken)
|
||||
end
|
||||
|
||||
--cleu token is used to check if the spell is a dot
|
||||
function Details.CreateSpellTable(spellId, cleuToken)
|
||||
return habilidade_dano:NovaTabela(spellId, nil, cleuToken)
|
||||
end
|
||||
|
||||
function habilidade_dano:NovaTabela(id, link, token)
|
||||
local _newDamageSpell = {
|
||||
total = 0, --total damage
|
||||
|
||||
@@ -29,115 +29,117 @@
|
||||
counter = 0,
|
||||
targets = {}
|
||||
}
|
||||
|
||||
|
||||
if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then
|
||||
_newMiscSpell.uptime = 0
|
||||
_newMiscSpell.actived = false
|
||||
_newMiscSpell.activedamt = 0 --s�o quantos estao ativados no momento
|
||||
_newMiscSpell.refreshamt = 0
|
||||
_newMiscSpell.appliedamt = 0
|
||||
|
||||
|
||||
elseif (token == "SPELL_INTERRUPT") then
|
||||
_newMiscSpell.interrompeu_oque = {}
|
||||
|
||||
|
||||
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
|
||||
_newMiscSpell.dispell_oque = {}
|
||||
|
||||
|
||||
elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
|
||||
_newMiscSpell.cc_break_oque = {}
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
return _newMiscSpell
|
||||
end
|
||||
|
||||
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
|
||||
local actorUtilityObject = token
|
||||
|
||||
--print(self.id, GetSpellInfo(self.id))
|
||||
|
||||
if (spellID == "BUFF_OR_DEBUFF") then
|
||||
|
||||
if (spellName == "COOLDOWN") then
|
||||
local parserToken = spellName
|
||||
if (parserToken == "COOLDOWN") then
|
||||
self.counter = self.counter + 1
|
||||
--target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_REFRESH") then
|
||||
|
||||
elseif (parserToken == "BUFF_UPTIME_REFRESH") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
self.refreshamt = self.refreshamt + 1
|
||||
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --token = actor misc object
|
||||
end
|
||||
self.actived_at = _detalhes._tempo
|
||||
self.actived = true
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_OUT") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --token = actor misc object
|
||||
end
|
||||
self.actived = false
|
||||
self.actived_at = nil
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_IN" or spellName == "DEBUFF_UPTIME_IN") then
|
||||
self.actived = true
|
||||
self.activedamt = self.activedamt + 1
|
||||
self.appliedamt = self.appliedamt + 1
|
||||
|
||||
if (self.actived_at and self.actived and spellName == "DEBUFF_UPTIME_IN") then
|
||||
--ja esta ativo em outro mob e jogou num novo
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
|
||||
self.actived_at = _detalhes._tempo
|
||||
|
||||
elseif (spellName == "DEBUFF_UPTIME_REFRESH") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
self.refreshamt = self.refreshamt + 1
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
actorUtilityObject.buff_uptime = actorUtilityObject.buff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
self.actived_at = _detalhes._tempo
|
||||
self.actived = true
|
||||
|
||||
elseif (spellName == "DEBUFF_UPTIME_OUT") then
|
||||
elseif (parserToken == "BUFF_UPTIME_OUT") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at --token = actor misc object
|
||||
actorUtilityObject.buff_uptime = actorUtilityObject.buff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
|
||||
self.actived = false
|
||||
self.actived_at = nil
|
||||
|
||||
elseif (parserToken == "BUFF_UPTIME_IN" or parserToken == "DEBUFF_UPTIME_IN") then
|
||||
self.actived = true
|
||||
self.activedamt = self.activedamt + 1
|
||||
self.appliedamt = self.appliedamt + 1
|
||||
|
||||
if (self.actived_at and self.actived and parserToken == "DEBUFF_UPTIME_IN") then
|
||||
--ja esta ativo em outro mob e jogou num novo
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
actorUtilityObject.debuff_uptime = actorUtilityObject.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
|
||||
self.actived_at = _detalhes._tempo
|
||||
|
||||
if (not self.uptime) then
|
||||
self.uptime = 0
|
||||
end
|
||||
|
||||
elseif (parserToken == "DEBUFF_UPTIME_REFRESH") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
self.refreshamt = self.refreshamt + 1
|
||||
actorUtilityObject.debuff_uptime = actorUtilityObject.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
self.actived_at = _detalhes._tempo
|
||||
self.actived = true
|
||||
|
||||
elseif (parserToken == "DEBUFF_UPTIME_OUT") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
actorUtilityObject.debuff_uptime = actorUtilityObject.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
|
||||
self.activedamt = self.activedamt - 1
|
||||
|
||||
|
||||
if (self.activedamt == 0) then
|
||||
self.actived = false
|
||||
self.actived_at = nil
|
||||
else
|
||||
self.actived_at = _detalhes._tempo
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
elseif (token == "SPELL_INTERRUPT") then
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (not self.interrompeu_oque [spellID]) then
|
||||
|
||||
if (not self.interrompeu_oque [spellID]) then
|
||||
self.interrompeu_oque [spellID] = 1
|
||||
else
|
||||
self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1
|
||||
end
|
||||
|
||||
|
||||
--target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
|
||||
elseif (token == "SPELL_RESURRECT") then
|
||||
self.ress = (self.ress or 0) + 1
|
||||
--target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
|
||||
self.dispell = (self.dispell or 0) + 1
|
||||
|
||||
|
||||
if (not self.dispell_oque [spellID]) then
|
||||
self.dispell_oque [spellID] = 1
|
||||
else
|
||||
@@ -145,19 +147,18 @@
|
||||
end
|
||||
|
||||
--target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then
|
||||
self.cc_break = (self.cc_break or 0) + 1
|
||||
|
||||
|
||||
if (not self.cc_break_oque [spellID]) then
|
||||
self.cc_break_oque [spellID] = 1
|
||||
else
|
||||
self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1
|
||||
end
|
||||
|
||||
--target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
end
|
||||
|
||||
end
|
||||
--target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
end
|
||||
end
|
||||
+540
-535
File diff suppressed because it is too large
Load Diff
+19
-2
@@ -102,7 +102,9 @@
|
||||
--cache
|
||||
local cacheAnything = {
|
||||
arenaHealth = {},
|
||||
paladin_vivaldi_blessings = {},
|
||||
}
|
||||
|
||||
--druids kyrian bounds
|
||||
local druid_kyrian_bounds = {} --remove on 10.0
|
||||
--spell containers for special cases
|
||||
@@ -961,7 +963,14 @@
|
||||
--Light of the Martyr - paladin spell which causes damage to the caster it self
|
||||
elseif (spellid == 196917) then -- or spellid == 183998 < healing part
|
||||
return parser:LOTM_damage(token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spelltype, amount, overkill, school, resisted, blocked, absorbed, critical, glacing, crushing, isoffhand)
|
||||
|
||||
elseif (spellid == 388009 or spellid == 388012) then --damage from the paladin blessings of the seasons
|
||||
local blessingSource = cacheAnything.paladin_vivaldi_blessings[who_serial]
|
||||
if (blessingSource) then
|
||||
who_serial, who_name, who_flags = unpack(blessingSource)
|
||||
end
|
||||
end
|
||||
|
||||
--end
|
||||
|
||||
if (isWOTLK) then
|
||||
@@ -2739,7 +2748,10 @@
|
||||
end
|
||||
end
|
||||
|
||||
if (spellid == 27827) then --spirit of redemption (holy ~priest) ~spirit
|
||||
if (spellid == 388007 or spellid == 388011) then --buff: bleesing of the summer and winter
|
||||
cacheAnything.paladin_vivaldi_blessings[alvo_serial] = {who_serial, who_name, who_flags}
|
||||
|
||||
elseif (spellid == 27827) then --spirit of redemption (holy ~priest) ~spirit
|
||||
--C_Timer.After(0.1, function()
|
||||
parser:dead ("UNIT_DIED", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags)
|
||||
ignore_death [who_name] = true
|
||||
@@ -3235,6 +3247,9 @@
|
||||
|
||||
elseif (spellid == SPELLID_NECROMANCER_CHEAT_DEATH) then --remove on 10.0
|
||||
necro_cheat_deaths[who_serial] = nil
|
||||
|
||||
elseif (spellid == 388007 or spellid == 388011) then --buff: bleesing of the summer
|
||||
cacheAnything.paladin_vivaldi_blessings[alvo_serial] = nil
|
||||
end
|
||||
|
||||
--druid kyrian empower bounds (9.0 kyrian covenant - probably remove on 10.0)
|
||||
@@ -6342,7 +6357,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
return _detalhes.cache_healing_group
|
||||
end
|
||||
|
||||
function _detalhes:ClearParserCache()
|
||||
function _detalhes:ClearParserCache() --~wipe
|
||||
wipe(damage_cache)
|
||||
wipe(damage_cache_pets)
|
||||
wipe(damage_cache_petsOwners)
|
||||
@@ -6365,6 +6380,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
wipe(dk_pets_cache.army)
|
||||
wipe(dk_pets_cache.apoc)
|
||||
|
||||
wipe(cacheAnything.paladin_vivaldi_blessings)
|
||||
|
||||
damage_cache = setmetatable({}, _detalhes.weaktable)
|
||||
damage_cache_pets = setmetatable({}, _detalhes.weaktable)
|
||||
damage_cache_petsOwners = setmetatable({}, _detalhes.weaktable)
|
||||
|
||||
+6
-3
@@ -2,6 +2,7 @@
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
local addonName, Details222 = ...
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -1124,15 +1125,17 @@ end
|
||||
return true
|
||||
|
||||
elseif (IsInRaid()) then
|
||||
local unitIdCache = Details222.UnitIdCache.Raid
|
||||
for i = 1, GetNumGroupMembers(), 1 do
|
||||
if (UnitAffectingCombat("raid"..i)) then
|
||||
if (UnitAffectingCombat(unitIdCache[i])) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
elseif (IsInGroup()) then
|
||||
local unitIdCache = Details222.UnitIdCache.Party
|
||||
for i = 1, GetNumGroupMembers()-1, 1 do
|
||||
if (UnitAffectingCombat("party"..i)) then
|
||||
if (UnitAffectingCombat(unitIdCache[i])) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -1150,7 +1153,7 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes:SairDoCombate()
|
||||
Details:SairDoCombate()
|
||||
end
|
||||
|
||||
function _detalhes:FindGUIDFromName (name)
|
||||
|
||||
@@ -3025,6 +3025,10 @@ function gump:CriaJanelaInfo()
|
||||
if (miscActor and miscActor.buff_uptime_spells) then
|
||||
for spellID, spellObject in pairs(miscActor.buff_uptime_spells._ActorTable) do
|
||||
local spellName, _, spellIcon = GetSpellInfo(spellID)
|
||||
if (not spellObject.uptime) then
|
||||
print(_GetSpellInfo(spellID))
|
||||
dumpt(spellObject)
|
||||
end
|
||||
tinsert(newAuraTable, {spellIcon, spellName, spellObject.uptime, spellObject.appliedamt, spellObject.refreshamt, spellObject.uptime/combatTime*100, spellID = spellID})
|
||||
end
|
||||
end
|
||||
|
||||
+15
-1
@@ -181,12 +181,26 @@ do
|
||||
function _detalhes:GetFlag (actor)
|
||||
return self.flag_original or actor and actor.flag_original
|
||||
end
|
||||
|
||||
function _detalhes:GetSpells()
|
||||
return self.spells._ActorTable
|
||||
end
|
||||
function _detalhes:GetActorSpells()
|
||||
return self.spells._ActorTable
|
||||
end
|
||||
function _detalhes:GetSpell (spellid)
|
||||
|
||||
function _detalhes:GetSpell(spellid)
|
||||
return self.spells._ActorTable [spellid]
|
||||
end
|
||||
|
||||
---return an array of pet names
|
||||
---@return table
|
||||
function _detalhes:GetPets()
|
||||
return self.pets
|
||||
end
|
||||
|
||||
---return an array of pet names
|
||||
---@return table
|
||||
function _detalhes:Pets()
|
||||
return self.pets
|
||||
end
|
||||
|
||||
@@ -381,7 +381,7 @@ do
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--Cache All Spells
|
||||
|
||||
function Details:BuildSpellListSlow()
|
||||
function Details:BuildSpellListSlow() -- this is not in use
|
||||
|
||||
local load_frame = _G.DetailsLoadSpellCache
|
||||
if (load_frame and (load_frame.completed or load_frame.inprogress)) then
|
||||
|
||||
Reference in New Issue
Block a user