Renamed "PegarCombatente" to "GetOrCreateActor"; More parser cleanup

This commit is contained in:
Tercio Jose
2023-07-27 13:24:27 -03:00
parent f6931c2d8b
commit a26186438a
3 changed files with 193 additions and 179 deletions
+1
View File
@@ -149,6 +149,7 @@
---@field _ActorTable table array of actors
---@field _NameIndexTable table<string, number> [actorName] = actorIndex in the _ActorTable, actorcontainer:Remap() refreshes the _NameIndexTable
---@field GetActor fun(container: actorcontainer, actorName: string) get an actor by its name
---@field GetOrCreateActor fun(container: actorcontainer, actorSerial: guid, actorName: actorname, actorFlags: controlflags, bShouldCreateActor: boolean) get an actor by its name, if the actor doesn't exist it will be created
---@field GetSpellSource fun(container: actorcontainer, spellId: number) get the first actor found which casted the spell
---@field GetAmount fun(container: actorcontainer, actorName: string, key: string) get the amount of actor[key]
---@field GetTotal fun(container: actorcontainer, key: string) get the total amount of actor[key] for all actors
+4 -7
View File
@@ -445,7 +445,6 @@ end
return newContainer
end
--try to get the actor class from name
local getActorClass = function(actorObject, actorName, actorFlags, actorSerial)
--get spec
@@ -706,8 +705,8 @@ end
---@param actorFlags number
---@param bShouldCreateActor boolean
---@return table|nil, table|nil, string|nil
function actorContainer:GetOrCreateActor(actorSerial, actorName, actorFlags, bShouldCreateActor)
return self:PegarCombatente(actorSerial, actorName, actorFlags, bShouldCreateActor)
function actorContainer:PegarCombatente(actorSerial, actorName, actorFlags, bShouldCreateActor)
return self:GetOrCreateActor(actorSerial, actorName, actorFlags, bShouldCreateActor)
end
---@param actorSerial string
@@ -715,7 +714,7 @@ end
---@param actorFlags number
---@param bShouldCreateActor boolean
---@return table|nil, table|nil, string|nil
function actorContainer:PegarCombatente(actorSerial, actorName, actorFlags, bShouldCreateActor)
function actorContainer:GetOrCreateActor(actorSerial, actorName, actorFlags, bShouldCreateActor)
--need to check if the actor is a pet
local petOwnerObject
actorSerial = actorSerial or "ns"
@@ -880,9 +879,7 @@ end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--core
--_detalhes:AddToNpcIdCache (novo_objeto)
function Details:AddToNpcIdCache (actor)
function Details:AddToNpcIdCache(actor) --not called anywhere
if (flag and serial) then
if (bitBand (flag, REACTION_HOSTILE) ~= 0 and bitBand (flag, OBJECT_TYPE_NPC) ~= 0 and bitBand (flag, OBJECT_TYPE_PETGUARDIAN) == 0) then
local npc_id = Details:GetNpcIdFromGuid (serial)
+188 -172
View File
@@ -201,6 +201,7 @@
flyaway_timer = {},
shield = {},
ss = {},
infernobless = {},
}
local empower_cache = {}
@@ -624,7 +625,7 @@
end
--~spell ~spelldamage
function parser:spell_dmg(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetRaidFlags, spellId, spellName, spellType, amount, overkill, school, resisted, blocked, absorbed, critical, glacing, crushing, isoffhand, isreflected, A1, A2, A3)
function parser:spell_dmg(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetRaidFlags, spellId, spellName, spellType, amount, overkill, school, resisted, blocked, absorbed, critical, glacing, crushing, isoffhand, isreflected)
--early checks and fixes
if (sourceSerial == "") then
if (sourceFlags and bitBand(sourceFlags, OBJECT_TYPE_PETS) ~= 0) then
@@ -870,12 +871,11 @@
------------------------------------------------------------------------------------------------
--get actors
---@type actor, actor
local sourceActor, ownerActor = damage_cache[sourceSerial] or damage_cache_pets[sourceSerial] or damage_cache[sourceName], damage_cache_petsOwners[sourceSerial]
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_damage_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_damage_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (ownerActor) then --the actor is a pet
if (sourceSerial ~= "") then
@@ -923,7 +923,7 @@
local targetActor, targetOwner = damage_cache[targetSerial] or damage_cache_pets[targetSerial] or damage_cache[targetName], damage_cache_petsOwners[targetSerial]
if (not targetActor) then
targetActor, targetOwner, targetName = _current_damage_container:PegarCombatente(targetSerial, targetName, targetFlags, true)
targetActor, targetOwner, targetName = _current_damage_container:GetOrCreateActor(targetSerial, targetName, targetFlags, true)
if (targetOwner) then
if (targetSerial ~= "") then
--insert in the pet cache
@@ -1246,7 +1246,7 @@
local evokerActor = damage_cache[evokerSourceSerial]
if (not evokerActor) then
evokerActor = _current_damage_container:PegarCombatente(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
evokerActor = _current_damage_container:GetOrCreateActor(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
end
if (evokerActor) then
@@ -1276,7 +1276,7 @@
--print(evokerActor, evokerSourceSerial, evokerSourceName, evokerSourceFlags, versaBuff, sourceName)
if (not evokerActor) then
evokerActor = _current_damage_container:PegarCombatente(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
evokerActor = _current_damage_container:GetOrCreateActor(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
end
if (evokerActor) then
@@ -1302,7 +1302,7 @@
local evokerActor = damage_cache[evokerSourceSerial]
if (not evokerActor) then
evokerActor = _current_damage_container:PegarCombatente(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
evokerActor = _current_damage_container:GetOrCreateActor(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
end
if (evokerActor) then
@@ -1327,7 +1327,30 @@
local evokerActor = damage_cache[evokerSourceSerial]
if (not evokerActor) then
evokerActor = _current_damage_container:PegarCombatente(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
evokerActor = _current_damage_container:GetOrCreateActor(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
end
if (evokerActor) then
evokerActor.total_extra = (evokerActor.total_extra or 0) + amount
end
end
end
if (spellId == 410265 and augmentation_cache.infernobless[sourceSerial] and sourceName ~= Details.playername) then
---@type table<serial, evokerinfo[]>
local currentlyBuffedWithInfernoBless = augmentation_cache.infernobless[sourceSerial]
for i, evokerInfo in ipairs(currentlyBuffedWithInfernoBless) do
---@cast evokerInfo evokerinfo
---@type serial, actorname, controlflags
local evokerSourceSerial, evokerSourceName, evokerSourceFlags = unpack(evokerInfo)
---@type actor
local evokerActor = damage_cache[evokerSourceSerial]
if (not evokerActor) then
evokerActor = _current_damage_container:GetOrCreateActor(evokerSourceSerial, evokerSourceName, evokerSourceFlags, true)
end
if (evokerActor) then
@@ -1360,7 +1383,7 @@
local evokerActor = damage_cache[evokerSerial]
if (not evokerActor) then
evokerActor = _current_damage_container:PegarCombatente(evokerSerial, evokerName, evokerFlags, true)
evokerActor = _current_damage_container:GetOrCreateActor(evokerSerial, evokerName, evokerFlags, true)
end
if (evokerActor) then
@@ -1491,7 +1514,7 @@
local sourceActor, ownerActor = damage_cache[sourceSerial] or damage_cache_pets[sourceSerial] or damage_cache[sourceName], damage_cache_petsOwners[sourceSerial]
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_damage_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_damage_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (ownerActor) then -- um pet
if (sourceSerial ~= "") then
damage_cache_pets[sourceSerial] = sourceActor
@@ -1699,7 +1722,7 @@
if (not este_jogador) then --pode ser um desconhecido ou um pet
este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true)
este_jogador, meu_dono, who_name = _current_damage_container:GetOrCreateActor (who_serial, who_name, who_flags, true)
if (meu_dono) then -- um pet
if (who_serial ~= "") then
@@ -1736,7 +1759,7 @@
if (not jogador_alvo) then
jogador_alvo, alvo_dono, alvo_name = _current_damage_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true)
jogador_alvo, alvo_dono, alvo_name = _current_damage_container:GetOrCreateActor (alvo_serial, alvo_name, alvo_flags, true)
if (alvo_dono) then
if (alvo_serial ~= "") then
@@ -1802,7 +1825,7 @@
local este_jogador = damage_cache [who_serial]
if (not este_jogador) then
local meu_dono
este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true)
este_jogador, meu_dono, who_name = _current_damage_container:GetOrCreateActor (who_serial, who_name, who_flags, true)
if (not este_jogador) then
return --just return if actor doen't exist yet
end
@@ -1818,32 +1841,25 @@
end
--function parser:swingmissed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, missType, isOffHand, amountMissed)
function parser:swingmissed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
return parser:missed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, 1, "Corpo-a-Corpo", 00000001, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
function parser:swingmissed(token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
return parser:missed(token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, 1, "Corpo-a-Corpo", 00000001, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
end
function parser:rangemissed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
return parser:missed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, 2, "Tiro-Automtico", 00000001, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
function parser:rangemissed(token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
return parser:missed(token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, 2, "Tiro-Automtico", 00000001, missType, isOffHand, amountMissed) --, isOffHand, amountMissed, arg1
end
-- ~miss
function parser:missed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, missType, isOffHand, amountMissed, arg1, arg2, arg3)
--print(spellid, spellname, missType, amountMissed) --MISS
------------------------------------------------------------------------------------------------
--early checks and fixes
if (not alvo_name) then
function parser:missed(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellType, missType, isOffHand, amountMissed)
if (not targetName) then
--no target name, just quit
return
elseif (not who_name) then
elseif (not sourceName) then
--no actor name, use spell name instead
who_name = "[*] " .. spellname
who_flags = 0xa48
who_serial = ""
sourceName = "[*] " .. spellName
sourceFlags = 0xa48
sourceSerial = ""
end
------------------------------------------------------------------------------------------------
@@ -1854,60 +1870,56 @@
--'misser'
local este_jogador = damage_cache [who_serial]
if (not este_jogador) then
--este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (nil, who_name)
local meu_dono
este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true)
if (not este_jogador) then
---@type actor
local sourceActor = damage_cache[sourceSerial]
if (not sourceActor) then
local ownerActor
sourceActor, ownerActor, sourceName = _current_damage_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not sourceActor) then
return --just return if actor doen't exist yet
end
end
este_jogador.last_event = _tempo
sourceActor.last_event = _tempo
if (tanks_members_cache [alvo_serial]) then --only track tanks
local TargetActor = damage_cache [alvo_serial]
if (TargetActor) then
local avoidance = TargetActor.avoidance
if (tanks_members_cache[targetSerial]) then --only track tanks for avoidance
local targetActor = damage_cache[targetSerial]
if (targetActor) then
local avoidance = targetActor.avoidance
if (not avoidance) then
TargetActor.avoidance = Details:CreateActorAvoidanceTable()
avoidance = TargetActor.avoidance
targetActor.avoidance = Details:CreateActorAvoidanceTable()
avoidance = targetActor.avoidance
end
local missTable = avoidance.overall [missType]
--not to confuse with overall data, this is the overall miss table counting avoidance for all mobs
local overallMissTable = avoidance.overall[missType]
if (missTable) then
--overall
if (overallMissTable) then
local overall = avoidance.overall
overall [missType] = missTable + 1 --adicionado a quantidade do miss
overall[missType] = overallMissTable + 1 --add to the amount of misses
--from this mob
local mob = avoidance [who_name]
if (not mob) then --if isn't in the table, build on the fly
mob = Details:CreateActorAvoidanceTable (true)
avoidance [who_name] = mob
--avoidance for this mob only
local missTableMob = avoidance[sourceName]
if (not missTableMob) then --if isn't in the table, build on the fly
missTableMob = Details:CreateActorAvoidanceTable(true)
avoidance[sourceName] = missTableMob
end
mob [missType] = mob [missType] + 1
missTableMob[missType] = missTableMob[missType] + 1
if (missType == "ABSORB") then --full absorb
overall ["ALL"] = overall ["ALL"] + 1 --qualtipo de hit ou absorb
overall ["FULL_ABSORBED"] = overall ["FULL_ABSORBED"] + 1 --amount
overall ["ABSORB_AMT"] = overall ["ABSORB_AMT"] + (amountMissed or 0)
overall ["FULL_ABSORB_AMT"] = overall ["FULL_ABSORB_AMT"] + (amountMissed or 0)
overall["ALL"] = overall["ALL"] + 1 --qualtipo de hit ou absorb
overall["FULL_ABSORBED"] = overall["FULL_ABSORBED"] + 1 --amount
overall["ABSORB_AMT"] = overall["ABSORB_AMT"] + (amountMissed or 0)
overall["FULL_ABSORB_AMT"] = overall["FULL_ABSORB_AMT"] + (amountMissed or 0)
mob ["ALL"] = mob ["ALL"] + 1 --qualtipo de hit ou absorb
mob ["FULL_ABSORBED"] = mob ["FULL_ABSORBED"] + 1 --amount
mob ["ABSORB_AMT"] = mob ["ABSORB_AMT"] + (amountMissed or 0)
mob ["FULL_ABSORB_AMT"] = mob ["FULL_ABSORB_AMT"] + (amountMissed or 0)
missTableMob["ALL"] = missTableMob["ALL"] + 1 --qualtipo de hit ou absorb
missTableMob["FULL_ABSORBED"] = missTableMob["FULL_ABSORBED"] + 1 --amount
missTableMob["ABSORB_AMT"] = missTableMob["ABSORB_AMT"] + (amountMissed or 0)
missTableMob["FULL_ABSORB_AMT"] = missTableMob["FULL_ABSORB_AMT"] + (amountMissed or 0)
end
end
end
end
@@ -1916,26 +1928,23 @@
if (missType == "ABSORB") then
if (token == "SWING_MISSED") then
este_jogador.totalabsorbed = este_jogador.totalabsorbed + amountMissed
--return parser:swing ("SWING_DAMAGE", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
return parser:spell_dmg ("SWING_DAMAGE", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
sourceActor.totalabsorbed = sourceActor.totalabsorbed + amountMissed
return parser:spell_dmg("SWING_DAMAGE", time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
elseif (token == "RANGE_MISSED") then
este_jogador.totalabsorbed = este_jogador.totalabsorbed + amountMissed
--this can call the spell_dmg directly, no need for this proxy
--return parser:range ("RANGE_DAMAGE", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
return parser:spell_dmg("RANGE_DAMAGE", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
sourceActor.totalabsorbed = sourceActor.totalabsorbed + amountMissed
return parser:spell_dmg("RANGE_DAMAGE", time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellType, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
else
este_jogador.totalabsorbed = este_jogador.totalabsorbed + amountMissed
return parser:spell_dmg(token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
sourceActor.totalabsorbed = sourceActor.totalabsorbed + amountMissed
return parser:spell_dmg(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellType, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
end
------------------------------------------------------------------------------------------------
--spell reflection
elseif (missType == "REFLECT" and reflection_auras[alvo_serial]) then --~reflect
elseif (missType == "REFLECT" and reflection_auras[targetSerial]) then --~reflect
--a reflect event and we have the reflecting aura data
if (reflection_damage[who_serial] and reflection_damage[who_serial][spellid] and time-reflection_damage[who_serial][spellid].time > 3.5 and (not reflection_debuffs[who_serial] or (reflection_debuffs[who_serial] and not reflection_debuffs[who_serial][spellid]))) then
if (reflection_damage[sourceSerial] and reflection_damage[sourceSerial][spellId] and time-reflection_damage[sourceSerial][spellId].time > 3.5 and (not reflection_debuffs[sourceSerial] or (reflection_debuffs[sourceSerial] and not reflection_debuffs[sourceSerial][spellId]))) then
--here we check if we have to filter old damage data
--we check for two conditions
--the first is to see if this is an old damage
@@ -1943,72 +1952,69 @@
--the second condition is to see if there is an active debuff with the same spellid
--if there is one then we ignore the timer and skip this
--this should be cleared afterwards somehow... don't know how...
reflection_damage[who_serial][spellid] = nil
if (next(reflection_damage[who_serial]) == nil) then
reflection_damage[sourceSerial][spellId] = nil
if (next(reflection_damage[sourceSerial]) == nil) then
--there should be some better way of handling this kind of filtering, any suggestion?
reflection_damage[who_serial] = nil
reflection_damage[sourceSerial] = nil
end
end
local damage = reflection_damage[who_serial] and reflection_damage[who_serial][spellid]
local reflection = reflection_auras[alvo_serial]
local damage = reflection_damage[sourceSerial] and reflection_damage[sourceSerial][spellId]
local reflection = reflection_auras[targetSerial]
if (damage) then
--damage ocurred first, so we have its data
local amount = reflection_damage[who_serial][spellid].amount
local amount = reflection_damage[sourceSerial][spellId].amount
local isreflected = spellid --which spell was reflected
alvo_serial = reflection.who_serial
alvo_name = reflection.who_name
alvo_flags = reflection.who_flags
spellid = reflection.spellid
spellname = reflection.spellname
spelltype = reflection.spelltype
local isreflected = spellId --which spell was reflected
targetSerial = reflection.who_serial
targetName = reflection.who_name
targetFlags = reflection.who_flags
spellId = reflection.spellid
spellName = reflection.spellname
spellType = reflection.spelltype
--crediting the source of the aura that caused the reflection
--also saying that the damage came from the aura that reflected the spell
reflection_damage[who_serial][spellid] = nil
if next(reflection_damage[who_serial]) == nil then
reflection_damage[sourceSerial][spellId] = nil
if next(reflection_damage[sourceSerial]) == nil then
--this is so bad at clearing, there should be a better way of handling this
reflection_damage[who_serial] = nil
reflection_damage[sourceSerial] = nil
end
return parser:spell_dmg(token,time,alvo_serial,alvo_name,alvo_flags,who_serial,who_name,who_flags,nil,spellid,spellname,spelltype,amount,-1,nil,nil,nil,nil,false,false,false,false, isreflected)
return parser:spell_dmg(token, time, targetSerial, targetName, targetFlags, sourceSerial, sourceName, sourceFlags, nil, spellId, spellName, spellType, amount, -1, nil, nil, nil, nil, false, false, false, false, isreflected)
else
--saving information about this reflect because it occurred before the damage event
reflection_events[who_serial] = reflection_events[who_serial] or {}
reflection_events[who_serial][spellid] = reflection
reflection_events[who_serial][spellid].time = time
reflection_events[sourceSerial] = reflection_events[sourceSerial] or {}
reflection_events[sourceSerial][spellId] = reflection
reflection_events[sourceSerial][spellId].time = time
end
else
--colocando aqui apenas pois ele confere o override dentro do damage
if (is_using_spellId_override) then
spellid = override_spellId [spellid] or spellid
spellId = override_spellId[spellId] or spellId
end
--actor spells table
local spell = este_jogador.spells._ActorTable [spellid]
local spell = sourceActor.spells._ActorTable[spellId]
if (not spell) then
spell = este_jogador.spells:PegaHabilidade (spellid, true, token)
spell.spellschool = spelltype
if (_current_combat.is_boss and who_flags and bitBand(who_flags, OBJECT_TYPE_ENEMY) ~= 0) then
Details.spell_school_cache [spellname] = spelltype
spell = sourceActor.spells:PegaHabilidade(spellId, true, token)
spell.spellschool = spellType
if (_current_combat.is_boss and sourceFlags and bitBand(sourceFlags, OBJECT_TYPE_ENEMY) ~= 0) then
Details.spell_school_cache[spellName] = spellType
end
end
return _spell_damageMiss_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, missType)
return _spell_damageMiss_func(spell, targetSerial, targetName, targetFlags, sourceName, missType)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------
--SPELL_EMPOWER
-----------------------------------------------------------------------------------------------------------------------------------------
function parser:spell_empower(token, time, sourceGUID, sourceName, sourceFlags, targetGUID, targetName, targetFlags, targetRaidFlags, spellId, spellName, spellSchool, empowerLevel)
--empowerLevel only exists on _END and _INTERRUPT
if (token == "SPELL_EMPOWER_START" or token == "SPELL_EMPOWER_INTERRUPT") then
return
end
@@ -2030,7 +2036,7 @@
local sourceObject = damage_cache[sourceGUID] or damage_cache[sourceName]
if (not sourceObject) then
sourceObject = _current_damage_container:PegarCombatente(sourceGUID, sourceName, sourceFlags, true)
sourceObject = _current_damage_container:GetOrCreateActor(sourceGUID, sourceName, sourceFlags, true)
end
if (not sourceObject) then
@@ -2059,13 +2065,10 @@
--SUMMON serach key: ~summon |
-----------------------------------------------------------------------------------------------------------------------------------------
function parser:summon(token, time, sourceSerial, sourceName, sourceFlags, petSerial, petName, petFlags, petRaidFlags, spellId, spellName)
--[[statistics]]-- _detalhes.statistics.pets_summons = _detalhes.statistics.pets_summons + 1
if (not sourceName) then
sourceName = "[*] " .. spellName
end
local npcId = tonumber(select(6, strsplit("-", petSerial)) or 0)
--differenciate army and apoc pets for DK
@@ -2086,6 +2089,7 @@
if (isWOTLK) then
if (npcId == 15439) then
Details.tabela_pets:Adicionar(petSerial:gsub("%-15439%-", "%-15438%-"), "Greater Fire Elemental", petFlags, sourceSerial, sourceName, sourceFlags)
elseif (npcId == 15438) then
return
end
@@ -2124,78 +2128,74 @@
[152118] = true, --Clarity of Will
}
function parser:heal_denied (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellidAbsorb, spellnameAbsorb, spellschoolAbsorb, serialHealer, nameHealer, flagsHealer, flags2Healer, spellidHeal, spellnameHeal, typeHeal, amountDenied)
function parser:heal_denied(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellIdAbsorb, spellNameAbsorb, spellSchoolAbsorb, serialHealer, nameHealer, flagsHealer, flags2Healer, spellIdHeal, spellNameHeal, typeHeal, amountDenied)
if (not _in_combat) then
return
end
--check invalid serial against pets
if (who_serial == "") then
if (who_flags and bitBand(who_flags, OBJECT_TYPE_PETS) ~= 0) then -- um pet
if (sourceSerial == "") then
if (sourceFlags and bitBand(sourceFlags, OBJECT_TYPE_PETS) ~= 0) then --is pet
return
end
end
--no name, use spellname
if (not who_name) then
who_name = "[*] " .. (spellnameHeal or "--unknown spell--")
if (not sourceName) then
sourceName = "[*] " .. (spellNameHeal or "--unknown spell--")
end
--no target, just ignore
if (not alvo_name) then
if (not targetName) then
return
end
--if no spellid
if (not spellidAbsorb) then
spellidAbsorb = 1
spellnameAbsorb = "unknown"
spellschoolAbsorb = 1
if (not spellIdAbsorb) then
spellIdAbsorb = 1
spellNameAbsorb = "unknown"
spellSchoolAbsorb = 1
end
if (is_using_spellId_override) then
spellidAbsorb = override_spellId [spellidAbsorb] or spellidAbsorb
spellidHeal = override_spellId [spellidHeal] or spellidHeal
spellIdAbsorb = override_spellId[spellIdAbsorb] or spellIdAbsorb
spellIdHeal = override_spellId[spellIdHeal] or spellIdHeal
end
------------------------------------------------------------------------------------------------
--get actors
local este_jogador, meu_dono = healing_cache [who_serial]
if (not este_jogador) then --pode ser um desconhecido ou um pet
este_jogador, meu_dono, who_name = _current_heal_container:PegarCombatente (who_serial, who_name, who_flags, true)
if (not meu_dono and who_flags and who_serial ~= "") then --se no for um pet, add no cache
healing_cache [who_serial] = este_jogador
--source actor
---@type actor
local sourceActor, ownerActor = healing_cache[sourceSerial]
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_heal_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not ownerActor and sourceFlags and sourceSerial ~= "") then --add to cache if isn't a pet
healing_cache[sourceSerial] = sourceActor
end
end
local jogador_alvo, alvo_dono = healing_cache [alvo_serial]
if (not jogador_alvo) then
jogador_alvo, alvo_dono, alvo_name = _current_heal_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true)
if (not alvo_dono and alvo_flags and alvo_serial ~= "") then
healing_cache [alvo_serial] = jogador_alvo
local targetActor, targetOwner = healing_cache[targetSerial]
if (not targetActor) then
targetActor, targetOwner, targetName = _current_heal_container:GetOrCreateActor(targetSerial, targetName, targetFlags, true)
if (not targetOwner and targetFlags and targetSerial ~= "") then
healing_cache[targetSerial] = targetActor
end
end
este_jogador.last_event = _tempo
sourceActor.last_event = _tempo
------------------------------------------------
este_jogador.totaldenied = este_jogador.totaldenied + amountDenied
sourceActor.totaldenied = sourceActor.totaldenied + amountDenied
--actor spells table
local spell = este_jogador.spells._ActorTable [spellidAbsorb]
local spell = sourceActor.spells._ActorTable[spellIdAbsorb]
if (not spell) then
spell = este_jogador.spells:PegaHabilidade (spellidAbsorb, true, token)
if (_current_combat.is_boss and who_flags and bitBand(who_flags, OBJECT_TYPE_ENEMY) ~= 0) then
Details.spell_school_cache [spellnameAbsorb] = spellschoolAbsorb or 1
spell = sourceActor.spells:PegaHabilidade(spellIdAbsorb, true, token)
if (_current_combat.is_boss and sourceFlags and bitBand(sourceFlags, OBJECT_TYPE_ENEMY) ~= 0) then
Details.spell_school_cache[spellNameAbsorb] = spellSchoolAbsorb or 1
end
end
--return spell:Add (alvo_serial, alvo_name, alvo_flags, cura_efetiva, who_name, absorbed, critical, overhealing)
return _spell_heal_func(spell, alvo_serial, alvo_name, alvo_flags, amountDenied, spellidHeal, token, nameHealer, overhealing)
return _spell_heal_func(spell, targetSerial, targetName, targetFlags, amountDenied, spellIdHeal, token, nameHealer) --, overhealing
end
function parser:heal_absorb(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellSchool, shieldOwnerSerial, shieldOwnerName, shieldOwnerFlags, shieldOwnerFlags2, shieldSpellId, shieldName, shieldType, amount)
@@ -2238,7 +2238,6 @@
shield_spellid_cache[shieldSpellId] = true
end
--chamar a funo de cura pra contar a cura
return parser:heal(token, time, shieldOwnerSerial, shieldOwnerName, shieldOwnerFlags, targetSerial, targetName, targetFlags, targetFlags2, shieldSpellId, shieldName, shieldType, amount, 0, 0, nil, true)
end
@@ -2347,7 +2346,7 @@
--healer
local sourceActor, ownerActor = healing_cache[sourceSerial], nil
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_heal_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_heal_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not ownerActor and sourceFlags and sourceSerial ~= "") then --if isn't a pet, add to the cache
healing_cache[sourceSerial] = sourceActor
end
@@ -2356,7 +2355,7 @@
--target
local targetActor, targetOwner = healing_cache[targetSerial], nil
if (not targetActor) then
targetActor, targetOwner, targetName = _current_heal_container:PegarCombatente(targetSerial, targetName, targetFlags, true)
targetActor, targetOwner, targetName = _current_heal_container:GetOrCreateActor(targetSerial, targetName, targetFlags, true)
if (not targetOwner and targetFlags and targetSerial ~= "") then --if isn't a pet, add to the cache
healing_cache[targetSerial] = targetActor
end
@@ -2387,7 +2386,7 @@
--this is a enemy healing another enemy
--create or get an actor which the actor name is the spell name
local actorName = GetSpellInfo(spellId)
local spellActor = _current_heal_container:PegarCombatente(spellId, actorName, 0x514, true)
local spellActor = _current_heal_container:GetOrCreateActor(spellId, actorName, 0x514, true)
spellActor.grupo = true
spellActor.last_event = _tempo
spellActor.total = spellActor.total + effectiveHeal
@@ -2451,10 +2450,10 @@
------------------------------------------------------------------------------------------------
--~activity time
if (not sourceActor.iniciar_hps) then
sourceActor:GetOrChangeActivityStatus (true) --inicia o hps do jogador
sourceActor:GetOrChangeActivityStatus(true)
if (ownerActor and not ownerActor.iniciar_hps) then
ownerActor:GetOrChangeActivityStatus (true)
ownerActor:GetOrChangeActivityStatus(true)
if (ownerActor.end_time) then
ownerActor.end_time = nil
else
@@ -2565,7 +2564,7 @@
--get actors
local este_jogador, meu_dono = healing_cache [who_serial]
if (not este_jogador) then --pode ser um desconhecido ou um pet
este_jogador, meu_dono, who_name = _current_heal_container:PegarCombatente (who_serial, who_name, who_flags, true)
este_jogador, meu_dono, who_name = _current_heal_container:GetOrCreateActor (who_serial, who_name, who_flags, true)
if (not meu_dono and who_flags and who_serial ~= "") then --se no for um pet, add no cache
healing_cache [who_serial] = este_jogador
end
@@ -2573,7 +2572,7 @@
local jogador_alvo, alvo_dono = healing_cache [alvo_serial]
if (not jogador_alvo) then
jogador_alvo, alvo_dono, alvo_name = _current_heal_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true)
jogador_alvo, alvo_dono, alvo_name = _current_heal_container:GetOrCreateActor (alvo_serial, alvo_name, alvo_flags, true)
if (not alvo_dono and alvo_flags and alvo_serial ~= "") then
healing_cache [alvo_serial] = jogador_alvo
end
@@ -2686,6 +2685,12 @@
---@type evokerinfo
local evokerInfo = {sourceSerial, sourceName, sourceFlags, amount}
table.insert(augmentation_cache.shield[targetSerial], evokerInfo)
elseif (spellId == 410263) then
augmentation_cache.infernobless[targetSerial] = augmentation_cache.infernobless[targetSerial] or {}
---@type evokerinfo
local evokerInfo = {sourceSerial, sourceName, sourceFlags}
table.insert(augmentation_cache.infernobless[targetSerial], evokerInfo)
end
if (buffs_makeyourown[spellId]) then
@@ -2878,7 +2883,7 @@
---@type actor
local sourceActor, ownerActor = misc_cache[sourceName]
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_misc_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not ownerActor) then
misc_cache[sourceName] = sourceActor
end
@@ -3144,6 +3149,16 @@
end
end
end
elseif (spellid == 410263) then
if (augmentation_cache.infernobless[targetSerial]) then
for index, evokerInfo in ipairs(augmentation_cache.infernobless[targetSerial]) do
if (evokerInfo[1] == sourceSerial) then
table.remove(augmentation_cache.infernobless[targetSerial], index)
break
end
end
end
end
if (buffs_makeyourown[spellid]) then
@@ -3285,7 +3300,7 @@
--nome do debuff ser usado para armazenar o nome do ator
local este_jogador = misc_cache [spellname]
if (not este_jogador) then --pode ser um desconhecido ou um pet
este_jogador = _current_misc_container:PegarCombatente (who_serial, spellname, who_flags, true)
este_jogador = _current_misc_container:GetOrCreateActor (who_serial, spellname, who_flags, true)
misc_cache [spellname] = este_jogador
end
@@ -3434,7 +3449,7 @@
--get actors
local este_jogador = misc_cache [who_name]
if (not este_jogador) then --pode ser um desconhecido ou um pet
este_jogador = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true)
este_jogador = _current_misc_container:GetOrCreateActor (who_serial, who_name, who_flags, true)
misc_cache [who_name] = este_jogador
end
@@ -3473,7 +3488,7 @@
--get actors
local este_jogador = misc_cache [who_name]
if (not este_jogador) then --pode ser um desconhecido ou um pet
este_jogador = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true)
este_jogador = _current_misc_container:GetOrCreateActor (who_serial, who_name, who_flags, true)
misc_cache [who_name] = este_jogador
end
@@ -3626,7 +3641,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local actorObject = energy_cache[actorName]
if (not actorObject) then
--as alternate power bars does not trigger for pets, this is guaranteed to be a player actor
actorObject = _current_energy_container:PegarCombatente(UnitGUID(unitID), actorName, 0x514, true)
actorObject = _current_energy_container:GetOrCreateActor(UnitGUID(unitID), actorName, 0x514, true)
energy_cache[actorName] = actorObject
end
@@ -3691,7 +3706,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local ownerActor
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_energy_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_energy_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
sourceActor.powertype = powerType
if (ownerActor) then
ownerActor.powertype = powerType
@@ -3709,7 +3724,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local targetActor = energy_cache[targetName]
local ownerTarget
if (not targetActor) then
targetActor, ownerTarget, targetName = _current_energy_container:PegarCombatente(targetSerial, targetName, targetFlags, true)
targetActor, ownerTarget, targetName = _current_energy_container:GetOrCreateActor(targetSerial, targetName, targetFlags, true)
targetActor.powertype = powerType
if (ownerTarget) then
ownerTarget.powertype = powerType
@@ -3783,7 +3798,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--main actor
local sourceActor, ownerActor = misc_cache[sourceName], nil
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_misc_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not ownerActor) then
misc_cache[sourceName] = sourceActor
end
@@ -3816,7 +3831,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--[=[
local damage_actor = damage_cache[sourceSerial]
if (not damage_actor) then
damage_actor = _current_damage_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
damage_actor = _current_damage_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (sourceFlags) then
damage_cache[sourceSerial] = damage_actor
end
@@ -3913,7 +3928,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
---@type actorutility, actorutility
local sourceActor, ownerActor = misc_cache[sourceName], nil
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_misc_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not ownerActor) then
misc_cache[sourceName] = sourceActor
end
@@ -4021,7 +4036,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
---@type actor, actor
local sourceActor, ownerActor = misc_cache[sourceSerial] or misc_cache_pets[sourceSerial] or misc_cache[sourceName], misc_cache_petsOwners[sourceSerial]
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente (sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_misc_container:GetOrCreateActor (sourceSerial, sourceName, sourceFlags, true)
if (ownerActor) then
if (sourceSerial ~= "") then
misc_cache_pets [sourceSerial] = sourceActor
@@ -4088,7 +4103,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
---@type actor
local enemyActorObject = damage_cache[sourceSerial]
if (not enemyActorObject) then
enemyActorObject = _current_damage_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
enemyActorObject = _current_damage_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
end
if (enemyActorObject) then
@@ -4144,7 +4159,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
---@type actor, actor
local sourceActor, ownerActor = misc_cache[sourceName]
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_misc_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not ownerActor) then
misc_cache[sourceName] = sourceActor
end
@@ -4251,7 +4266,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--main actor
local este_jogador, meu_dono = misc_cache [who_name]
if (not este_jogador) then --pode ser um desconhecido ou um pet
este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true)
este_jogador, meu_dono, who_name = _current_misc_container:GetOrCreateActor (who_serial, who_name, who_flags, true)
if (not meu_dono) then --se no for um pet, add no cache
misc_cache [who_name] = este_jogador
end
@@ -4356,7 +4371,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
---@type actorutility, actorutility
local sourceActor, ownerActor = misc_cache[sourceName], nil
if (not sourceActor) then --unknown if is a pet or player
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
sourceActor, ownerActor, sourceName = _current_misc_container:GetOrCreateActor(sourceSerial, sourceName, sourceFlags, true)
if (not ownerActor) then --not a pet: add to cache
misc_cache[sourceName] = sourceActor
end
@@ -4470,7 +4485,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--main actor no container de misc que ir armazenar a morte
local thisPlayer, meu_dono = misc_cache [targetName]
if (not thisPlayer) then --pode ser um desconhecido ou um pet
thisPlayer, meu_dono, sourceName = _current_misc_container:PegarCombatente (targetSerial, targetName, targetFlags, true)
thisPlayer, meu_dono, sourceName = _current_misc_container:GetOrCreateActor (targetSerial, targetName, targetFlags, true)
if (not meu_dono) then --se no for um pet, add no cache
misc_cache [targetName] = thisPlayer
end
@@ -6548,6 +6563,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
Details:Destroy(augmentation_cache.breath_targets)
Details:Destroy(augmentation_cache.infernobless)
cacheAnything.track_hunter_frenzy = Details.combat_log.track_hunter_frenzy
@@ -7035,7 +7051,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
flag = 0x548
end
actor = _current_damage_container:PegarCombatente (guid, name, flag, true)
actor = _current_damage_container:GetOrCreateActor (guid, name, flag, true)
actor.total = Details:GetOrderNumber()
actor.classe = classToken or "UNKNOW"
@@ -7065,7 +7081,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
flag = 0x548
end
actor = _current_heal_container:PegarCombatente (guid, name, flag, true)
actor = _current_heal_container:GetOrCreateActor (guid, name, flag, true)
actor.total = Details:GetOrderNumber()
actor.classe = classToken or "UNKNOW"