- Framework update.

- Schedules run after combat ends and no more after regen_enabled.
This commit is contained in:
Tercioo
2019-02-23 14:55:50 -03:00
parent df46fc9cf2
commit ab333051bc
6 changed files with 129 additions and 23 deletions
+117 -18
View File
@@ -4224,6 +4224,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
_current_encounter_id = nil
_track_ghuun_bloodshield = nil --REMOVE ON PATCH 9.0
local _, instanceType = GetInstanceInfo() --> let's make sure it isn't a dungeon
if (_detalhes.zone_type == "party" or instanceType == "party") then
@@ -4306,22 +4307,53 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes.tabela_vigente.CombatStartedAt = GetTime()
end
function _detalhes.parser_functions:PLAYER_REGEN_ENABLED (...)
--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)
_current_encounter_id = nil
_track_ghuun_bloodshield = nil --REMOVE ON PATCH 9.0
--> playing alone, just finish the combat right now
if (not _IsInGroup() and not IsInRaid()) then
_detalhes.tabela_vigente.playing_solo = true
_detalhes:SairDoCombate()
--in case the player left the raid during the encounter
local check_for_encounter_end = function()
if (not _current_encounter_id) then
return
end
if (IsInRaid()) then
--raid
local inCombat = false
for i = 1, GetNumGroupMembers() do
if (UnitAffectingCombat ("raid" .. i)) then
inCombat = true
break
end
end
if (not inCombat) then
_current_encounter_id = nil
end
elseif (IsInGroup()) then
--party (dungeon)
local inCombat = false
for i = 1, GetNumGroupMembers() -1 do
if (UnitAffectingCombat ("party" .. i)) then
inCombat = true
break
end
end
if (not inCombat) then
_current_encounter_id = nil
end
else
_current_encounter_id = nil
end
end
--> 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)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) running scheduled events after combat end.")
end
--> add segments to overall data if any scheduled
if (_detalhes.schedule_add_to_overall and #_detalhes.schedule_add_to_overall > 0) then
if (_detalhes.debug) then
@@ -4411,7 +4443,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end
if (_detalhes.wipe_called) then
if (_detalhes.wipe_called and false) then --disabled
_detalhes.wipe_called = nil
_detalhes:CaptureSet (nil, "damage", true)
_detalhes:CaptureSet (nil, "energy", true)
@@ -4426,10 +4458,77 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes:CaptureSet (false, "spellcast", false, 10)
end
_table_wipe (bitfield_swap_cache)
_table_wipe (ignore_actors)
if (not OnRegenEnabled) then
_table_wipe (bitfield_swap_cache)
_table_wipe (ignore_actors)
_detalhes:DispatchAutoRunCode ("on_leavecombat")
end
end
function _detalhes.parser_functions:PLAYER_REGEN_ENABLED (...)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) |cFFFFFF00PLAYER_REGEN_ENABLED|r event triggered.")
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
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)
--
C_Timer.After (10, check_for_encounter_end)
--> playing alone, just finish the combat right now
if (not _IsInGroup() and not IsInRaid()) then
_detalhes.tabela_vigente.playing_solo = true
_detalhes: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
inCombat = true
break
end
end
if (not inCombat) then
_detalhes:RunScheduledEventsAfterCombat (true)
end
elseif (IsInGroup()) then
--party (dungeon)
local inCombat = false
for i = 1, GetNumGroupMembers() -1 do
if (UnitAffectingCombat ("party" .. i)) then
inCombat = true
break
end
end
if (not inCombat) then
_detalhes:RunScheduledEventsAfterCombat (true)
end
end
end)
end
_detalhes:DispatchAutoRunCode ("on_leavecombat")
end
function _detalhes.parser_functions:PLAYER_TALENT_UPDATE()