- 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
+1 -1
View File
@@ -1,5 +1,5 @@
local dversion = 139
local dversion = 140
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
+6 -2
View File
@@ -5599,9 +5599,13 @@ function DF:CreateLoadFilterParser (callback)
if (event == "ENCOUNTER_START") then
local encounterID = ...
f.EncounterIDCached = encounterID
elseif (event == "PLAYER_REGEN_ENABLED") then
elseif (event == "ENCOUNTER_END") then
f.EncounterIDCached = nil
elseif (event == "PLAYER_REGEN_ENABLED") then
--f.EncounterIDCached = nil
--when the player dies during an encounter, the game is triggering regen enabled
elseif (event == "PLAYER_SPECIALIZATION_CHANGED") then
if (DetailsFrameworkLoadConditionsPanel and DetailsFrameworkLoadConditionsPanel:IsShown()) then
+2 -1
View File
@@ -5,7 +5,8 @@
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0")
_detalhes.build_counter = 6902
_detalhes.alpha_build_counter = 6902 --if this is higher than the regular counter, use it instead
_detalhes.alpha_build_counter = 6926 --if this is higher than the regular counter, use it instead
_detalhes.game_version = "v8.1.0"
_detalhes.userversion = "v8.1.0." .. _detalhes.build_counter
_detalhes.realversion = 135 --core version, this is used to check API version for scripts and plugins (see alias below)
_detalhes.APIVersion = _detalhes.realversion --core version
+1
View File
@@ -875,6 +875,7 @@
_detalhes.StoreSpells()
_detalhes:RunScheduledEventsAfterCombat()
end
function _detalhes:GetPlayersInArena()
+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()
+2 -1
View File
@@ -1664,7 +1664,8 @@ Damage Update Status: @INSTANCEDAMAGESTATUS
end
print (" ")
print (Loc ["STRING_DETAILS1"] .. "" .. _detalhes.userversion .. " [|cFFFFFF00CORE: " .. _detalhes.realversion .. "|r] " .. Loc ["STRING_COMMAND_LIST"] .. ":")
local v = _detalhes.game_version .. "." .. (_detalhes.build_counter >= _detalhes.alpha_build_counter and _detalhes.build_counter or _detalhes.alpha_build_counter)
print (Loc ["STRING_DETAILS1"] .. "" .. v .. " [|cFFFFFF00CORE: " .. _detalhes.realversion .. "|r] " .. Loc ["STRING_COMMAND_LIST"] .. ":")
print ("|cffffaeae/details|r |cffffff33" .. Loc ["STRING_SLASH_NEW"] .. "|r: " .. Loc ["STRING_SLASH_NEW_DESC"])
print ("|cffffaeae/details|r |cffffff33" .. Loc ["STRING_SLASH_SHOW"] .. " " .. Loc ["STRING_SLASH_HIDE"] .. " " .. Loc ["STRING_SLASH_TOGGLE"] .. "|r|cfffcffb0 <" .. Loc ["STRING_WINDOW_NUMBER"] .. ">|r: " .. Loc ["STRING_SLASH_SHOWHIDETOGGLE_DESC"])