- Elapsed combat time now uses Float numbers instead of Integer.

This commit is contained in:
tercio
2014-12-16 14:41:34 -02:00
parent 042aa8758c
commit 449d7f8a25
10 changed files with 95 additions and 69 deletions
+16 -11
View File
@@ -25,6 +25,7 @@
local _UnitExists = UnitExists --wow api local
local _UnitGUID = UnitGUID --wow api local
local _UnitName = UnitName --wow api local
local _GetTime = GetTime
local _IsAltKeyDown = IsAltKeyDown
local _IsShiftKeyDown = IsShiftKeyDown
@@ -253,11 +254,13 @@
end
--> conta o tempo na tabela overall -- start time at overall table
if (_detalhes.tabela_overall.end_time) then
_detalhes.tabela_overall.start_time = _tempo - (_detalhes.tabela_overall.end_time - _detalhes.tabela_overall.start_time)
_detalhes.tabela_overall.end_time = nil
if (_detalhes.tabela_overall:GetEndTime()) then
--_detalhes.tabela_overall:SetStartTime (_tempo - (_detalhes.tabela_overall.end_time - _detalhes.tabela_overall.start_time))
_detalhes.tabela_overall:SetStartTime (_GetTime() - _detalhes.tabela_overall:GetCombatTime())
_detalhes.tabela_overall:SetEndTime (nil)
else
_detalhes.tabela_overall.start_time = _tempo
--_detalhes.tabela_overall.start_time = _tempo
_detalhes.tabela_overall:SetStartTime (_GetTime())
end
--> re-lock nos tempos da tabela passada -- lock again last table times
@@ -409,8 +412,8 @@
_detalhes.tabela_vigente:seta_data (_detalhes._detalhes_props.DATA_TYPE_END) --> salva hora, minuto, segundo do fim da luta
_detalhes.tabela_overall:seta_data (_detalhes._detalhes_props.DATA_TYPE_END) --> salva hora, minuto, segundo do fim da luta
_detalhes.tabela_vigente:seta_tempo_decorrido() --> salva o end_time
_detalhes.tabela_overall:seta_tempo_decorrido() --seta o end_time
_detalhes.tabela_vigente:seta_tempo_decorrido()
_detalhes.tabela_overall:seta_tempo_decorrido()
--> drop last events table to garbage collector
_detalhes.tabela_vigente.player_last_events = {}
@@ -485,7 +488,7 @@
end
if (from_encounter_end) then
_detalhes.tabela_vigente.end_time = _detalhes.encounter_table ["end"]
_detalhes.tabela_vigente:SetEndTime (_detalhes.encounter_table ["end"])
end
--> encounter boss function
@@ -528,7 +531,7 @@
_detalhes.CloseSoloDebuffs()
end
local tempo_do_combate = _detalhes.tabela_vigente.end_time - _detalhes.tabela_vigente.start_time
local tempo_do_combate = _detalhes.tabela_vigente:GetCombatTime()
local invalid_combat
--if ( tempo_do_combate >= _detalhes.minimum_combat_time) then --> tempo minimo precisa ser 5 segundos pra acrecentar a tabela ao historico
@@ -542,9 +545,11 @@
invalid_combat = _detalhes.tabela_vigente
_detalhes.tabela_vigente = _detalhes.tabela_historico.tabelas[1] --> pega a tabela do ultimo combate
if (_detalhes.tabela_vigente.start_time == 0) then
_detalhes.tabela_vigente.start_time = _detalhes._tempo
_detalhes.tabela_vigente.end_time = _detalhes._tempo
if (_detalhes.tabela_vigente:GetStartTime() == 0) then
--_detalhes.tabela_vigente.start_time = _detalhes._tempo
_detalhes.tabela_vigente:SetStartTime (_GetTime())
--_detalhes.tabela_vigente.end_time = _detalhes._tempo
_detalhes.tabela_vigente:SetEndTime (_GetTime())
end
_detalhes.tabela_vigente.resincked = true
+4 -2
View File
@@ -78,8 +78,10 @@
end
--> tempo padrao do overall
combate_overall.start_time = _tempo
combate_overall.end_time = _tempo
--combate_overall.start_time = _tempo
combate_overall.start_time = GetTime()
--combate_overall.end_time = _tempo
combate_overall.end_time = GetTime()
--> inicia a recuperação das tabelas e montagem do overall
if (#tabelas_do_historico > 0) then
+23 -15
View File
@@ -24,6 +24,7 @@
local _IsInGroup = IsInGroup --wow api local
local _GetNumGroupMembers = GetNumGroupMembers --wow api local
local _UnitGroupRolesAssigned = UnitGroupRolesAssigned --wow api local
local _GetTime = GetTime
local _cstr = string.format --lua local
local _table_insert = table.insert --lua local
@@ -2206,7 +2207,7 @@
if (_hook_deaths) then
--> send event to registred functions
local death_at = _tempo - _current_combat.start_time
local death_at = _tempo - _current_combat:GetStartTime()
local max_health = _UnitHealthMax (alvo_name)
for _, func in _ipairs (_hook_deaths_container) do
@@ -2241,7 +2242,7 @@
esta_morte [#esta_morte+1] = t
end
local decorrido = _tempo - _current_combat.start_time
local decorrido = _tempo - _current_combat:GetStartTime()
local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60)
local t = {esta_morte, time, este_jogador.nome, este_jogador.classe, _UnitHealthMax (alvo_name), minutos.."m "..segundos.."s", ["dead"] = true, ["last_cooldown"] = este_jogador.last_cooldown, ["dead_at"] = decorrido}
@@ -2548,7 +2549,7 @@
end
_detalhes.latest_ENCOUNTER_END = _detalhes.latest_ENCOUNTER_END or 0
if (_detalhes.latest_ENCOUNTER_END + 10 > _detalhes._tempo) then
if (_detalhes.latest_ENCOUNTER_END + 10 > _GetTime()) then
return
end
@@ -2570,7 +2571,8 @@
--print (encounterID, encounterName, difficultyID, raidSize)
_detalhes.encounter_table.phase = 1
_detalhes.encounter_table ["start"] = time()
--_detalhes.encounter_table ["start"] = time()
_detalhes.encounter_table ["start"] = _GetTime()
_detalhes.encounter_table ["end"] = nil
_detalhes.encounter_table.id = encounterID
@@ -2580,7 +2582,7 @@
_detalhes.encounter_table.zone = zoneName
_detalhes.encounter_table.mapid = zoneMapID
if (dbm_mod and dbm_time == time()) then
if (dbm_mod and dbm_time == time()) then --pode ser time() é usado no start pra saber se foi no mesmo segundo.
_detalhes.encounter_table.DBM_Mod = dbm_mod
end
@@ -2590,10 +2592,12 @@
if (type (encounter_start_table.delay) == "function") then
local delay = encounter_start_table.delay()
if (delay) then
_detalhes.encounter_table ["start"] = time() + delay
--_detalhes.encounter_table ["start"] = time() + delay
_detalhes.encounter_table ["start"] = _GetTime() + delay
end
else
_detalhes.encounter_table ["start"] = time() + encounter_start_table.delay
--_detalhes.encounter_table ["start"] = time() + encounter_start_table.delay
_detalhes.encounter_table ["start"] = _GetTime() + encounter_start_table.delay
end
end
if (encounter_start_table.func) then
@@ -2626,9 +2630,11 @@
if (_detalhes.latest_ENCOUNTER_END + 15 > _detalhes._tempo) then
return
end
_detalhes.latest_ENCOUNTER_END = _detalhes._tempo
--_detalhes.latest_ENCOUNTER_END = _detalhes._tempo
_detalhes.latest_ENCOUNTER_END = _GetTime()
_detalhes.encounter_table ["end"] = time() - 0.4
--_detalhes.encounter_table ["end"] = time() - 0.4
_detalhes.encounter_table ["end"] = _GetTime() - 0.4
local _, _, _, _, _, _, _, zoneMapID = _GetInstanceInfo()
@@ -2641,9 +2647,8 @@
_detalhes:SairDoCombate (false, true) --wipe
end
else
if ((_detalhes.tabela_vigente.end_time or 0) + 2 >= _detalhes.encounter_table ["end"]) then
--_detalhes.tabela_vigente.start_time = _detalhes.encounter_table ["start"]
_detalhes.tabela_vigente.end_time = _detalhes.encounter_table ["end"]
if ((_detalhes.tabela_vigente:GetEndTime() or 0) + 2 >= _detalhes.encounter_table ["end"]) then
_detalhes.tabela_vigente:SetEndTime (_detalhes.encounter_table ["end"])
_detalhes:AtualizaGumpPrincipal (-1, true)
end
end
@@ -2655,9 +2660,12 @@
local frase = _select (1, ...)
--> reset combat timer
if ( (frase:find ("The battle") and frase:find ("has begun!") ) and _current_combat.pvp) then
local tempo_do_combate = _tempo - _current_combat.start_time
_detalhes.tabela_overall.start_time = _detalhes.tabela_overall.start_time + tempo_do_combate
_current_combat.start_time = _tempo
--local tempo_do_combate = _tempo - _current_combat:GetStartTime()
local tempo_do_combate = _GetTime() - _current_combat:GetStartTime()
_detalhes.tabela_overall:SetStartTime (_detalhes.tabela_overall:GetStartTime() + tempo_do_combate)
--_current_combat.start_time = _tempo
_current_combat:SetStartTime (_GetTime())
_detalhes.listener:UnregisterEvent ("CHAT_MSG_BG_SYSTEM_NEUTRAL")
end
end
+5 -8
View File
@@ -1,10 +1,3 @@
--File Revision: 2
--Last Modification: 12/09/2013
-- Change Log:
-- 27/07/2013: Finished alpha version.
-- 12/09/2013: Fixed some problems with garbage collector.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local _detalhes = _G._detalhes
@@ -16,13 +9,17 @@
local _table_insert = table.insert --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
local _math_floor = math.floor --lua local
local _time = time --lua local
local _math_floor = math.floor
local _GetTime = GetTime --api local
local timeMachine = _detalhes.timeMachine --details local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local _tempo = _time()
local _tempo = _time()
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
+4 -2
View File
@@ -2317,8 +2317,10 @@
end
current_combat.start_time = time()-360
current_combat.end_time = time()
--current_combat.start_time = time()-360
current_combat.start_time = GetTime() - 360
--current_combat.end_time = time()
current_combat.end_time = GetTime()
current_combat.totals_grupo [1] = total_damage
current_combat.totals_grupo [2] = total_heal