- Elapsed combat time now uses Float numbers instead of Integer.
This commit is contained in:
+24
-17
@@ -17,6 +17,7 @@
|
||||
local _table_remove = table.remove -- lua local
|
||||
local _rawget = rawget
|
||||
local _math_max = math.max
|
||||
local _GetTime = GetTime
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
@@ -31,7 +32,8 @@
|
||||
local REACTION_HOSTILE = 0x00000040
|
||||
local CONTROL_PLAYER = 0x00000100
|
||||
|
||||
local _tempo = time()
|
||||
--local _tempo = time()
|
||||
local _tempo = _GetTime()
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> api functions
|
||||
@@ -108,11 +110,26 @@
|
||||
if (self.end_time) then
|
||||
return _math_max (self.end_time - self.start_time, 0.1)
|
||||
elseif (self.start_time and _detalhes.in_combat) then
|
||||
return _math_max (_tempo - self.start_time, 0.1)
|
||||
--return _math_max (_tempo - self.start_time, 0.1)
|
||||
return _math_max (_GetTime() - self.start_time, 0.1)
|
||||
else
|
||||
return 0.1
|
||||
end
|
||||
end
|
||||
|
||||
function combate:GetStartTime()
|
||||
return self.start_time
|
||||
end
|
||||
function combate:SetStartTime (t)
|
||||
self.start_time = t
|
||||
end
|
||||
|
||||
function combate:GetEndTime()
|
||||
return self.end_time
|
||||
end
|
||||
function combate:SetEndTime (t)
|
||||
self.end_time = t
|
||||
end
|
||||
|
||||
--return the total of a specific attribute
|
||||
local power_table = {0, 1, 3, 6}
|
||||
@@ -209,7 +226,8 @@
|
||||
|
||||
-- a tabela sem o tempo de inicio é a tabela descartavel do inicio do addon
|
||||
if (iniciada) then
|
||||
esta_tabela.start_time = _tempo
|
||||
--esta_tabela.start_time = _tempo
|
||||
esta_tabela.start_time = _GetTime()
|
||||
esta_tabela.end_time = nil
|
||||
else
|
||||
esta_tabela.start_time = 0
|
||||
@@ -314,9 +332,6 @@
|
||||
jogador:TerminarTempo()
|
||||
jogador:Iniciar (false) --trava o dps do jogador
|
||||
else
|
||||
|
||||
--print ("Tempo NAO Iniciando:", self.nome, self.start_time, self.end_time, self.delay, _tempo)
|
||||
|
||||
if (jogador.start_time == 0) then
|
||||
jogador.start_time = _tempo
|
||||
end
|
||||
@@ -337,16 +352,8 @@
|
||||
end
|
||||
|
||||
function combate:seta_tempo_decorrido()
|
||||
if (self.playing_solo) then
|
||||
local damage_actor = self (1, _detalhes.playername)
|
||||
if (damage_actor) then
|
||||
self.end_time = damage_actor.last_event or _tempo
|
||||
else
|
||||
self.end_time = _tempo
|
||||
end
|
||||
else
|
||||
self.end_time = _tempo
|
||||
end
|
||||
--self.end_time = _tempo
|
||||
self.end_time = _GetTime()
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_combate (tabela_combate, shadow)
|
||||
@@ -402,7 +409,7 @@
|
||||
combate1 [4].need_refresh = true
|
||||
|
||||
--> reduz o tempo
|
||||
combate1.start_time = combate1.start_time + (combate2.end_time - combate2.start_time)
|
||||
combate1.start_time = combate1.start_time + combate2:GetCombatTime()
|
||||
|
||||
--> apaga as mortes da luta diminuida
|
||||
local amt_mortes = #combate2.last_events_tables --> quantas mortes teve nessa luta
|
||||
|
||||
@@ -1326,6 +1326,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra,
|
||||
self.last_dps = dps
|
||||
end
|
||||
else
|
||||
--print ("calculando dps")
|
||||
dps = damage_total / combat_time
|
||||
self.last_dps = dps
|
||||
end
|
||||
|
||||
+16
-11
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
+2
-2
@@ -176,8 +176,8 @@ function SlashCmdList.DETAILS (msg, editbox)
|
||||
self.spells._ActorTable [122].total = 25000
|
||||
end
|
||||
|
||||
combat.start_time = time()-30
|
||||
combat.end_time = time()
|
||||
combat.start_time = GetTime()-30
|
||||
combat.end_time = GetTime()
|
||||
|
||||
combat.totals_grupo [1] = 100000
|
||||
combat.totals [1] = 100000
|
||||
|
||||
@@ -4897,7 +4897,7 @@ local build_segment_list = function (self, elapsed)
|
||||
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_ENEMY"] .. ":", enemy, 2, "white", "white")
|
||||
|
||||
local decorrido = (thisCombat.end_time or _detalhes._tempo) - thisCombat.start_time
|
||||
local decorrido = thisCombat:GetCombatTime()
|
||||
local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60)
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_TIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
|
||||
|
||||
@@ -4959,16 +4959,16 @@ local build_segment_list = function (self, elapsed)
|
||||
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_ENEMY"] .. ":", enemy, 2, "white", "white")
|
||||
|
||||
if (not _detalhes.tabela_vigente.end_time) then
|
||||
if (not _detalhes.tabela_vigente:GetEndTime()) then
|
||||
if (_detalhes.in_combat) then
|
||||
local decorrido = _detalhes._tempo - _detalhes.tabela_vigente.start_time
|
||||
local decorrido = _detalhes.tabela_vigente:GetCombatTime()
|
||||
local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60)
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_TIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
|
||||
else
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_TIME"] .. ":", "--x--x--", 2, "white", "white")
|
||||
end
|
||||
else
|
||||
local decorrido = (_detalhes.tabela_vigente.end_time) - _detalhes.tabela_vigente.start_time
|
||||
local decorrido = _detalhes.tabela_vigente:GetCombatTime()
|
||||
local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60)
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_TIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
|
||||
end
|
||||
@@ -4998,16 +4998,16 @@ local build_segment_list = function (self, elapsed)
|
||||
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_ENEMY"] .. ":", "--x--x--", 2, "white", "white")
|
||||
|
||||
if (not _detalhes.tabela_overall.end_time) then
|
||||
if (not _detalhes.tabela_overall:GetEndTime()) then
|
||||
if (_detalhes.in_combat) then
|
||||
local decorrido = _detalhes._tempo - _detalhes.tabela_overall.start_time
|
||||
local decorrido = _detalhes.tabela_overall:GetCombatTime()
|
||||
local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60)
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_TIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
|
||||
else
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_TIME"] .. ":", "--x--x--", 2, "white", "white")
|
||||
end
|
||||
else
|
||||
local decorrido = (_detalhes.tabela_overall.end_time) - _detalhes.tabela_overall.start_time
|
||||
local decorrido = _detalhes.tabela_overall:GetCombatTime()
|
||||
local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60)
|
||||
CoolTip:AddLine (Loc ["STRING_SEGMENT_TIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user