- Full rework on how deaths are handled, now the last events before death should be more precise.

- Added damage taken from environment, like falling, lava, drowning, etc.
- Added Fire and Brimstone spell customizations for warlocks.
- Bookmark now are shared between all characters.
- Fixed few inconsistencies with trash recognition.
- Fixed Cloud Capture where sometimes it wasn't sharing.
- Fixed report where it wasn't sharing for guild and raid when the player name box were empty.
- Report box now also saves the position and last report channel.
- You Are Not Prepared plugin now have tooltips for spells and auto open after a boss encounter.
- Advanced Death Logs plugin got full rewrite (and still are in development).

- New API: _detalhes:GetFramework() return the framework object.
- New API: combat:GetDifficult() return the raid difficult on the combat object.
- New API: combat:GetBossInfo() return the boss info object.
- New API: combat:GetDeaths() return the table used to store deaths.
- New API: _detalhes:CreatePluginOptionsFrame (name, title, template), create a preset frame for options.
- New API Alias: framework:CreateLabel (parent, text, size, color, font, member, name)
This commit is contained in:
tercio
2014-07-30 11:41:45 -03:00
parent e5eff411c9
commit 2d1cf1b220
24 changed files with 591 additions and 610 deletions
+13 -24
View File
@@ -52,30 +52,12 @@
local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = _GetInstanceInfo()
if (InstanceType == "party" or InstanceType == "raid") then
_detalhes.tabela_vigente.is_trash = true
return Loc ["STRING_SEGMENT_TRASH"]
end
local trash_list
if (_detalhes.in_group and _detalhes.last_instance) then
trash_list = _detalhes:GetInstanceTrashInfo (_detalhes.last_instance)
end
for _, actor in _ipairs (_detalhes.tabela_vigente[class_type_dano]._ActorTable) do
if (not actor.grupo and not actor.owner and not actor.nome:find ("[*]") and _bit_band (actor.flag_original, 0x00000060) ~= 0) then --> 0x20+0x40 neutral + enemy reaction
if (trash_list) then
local serial = tonumber (actor.serial:sub(6, 10), 16)
if (serial and trash_list [serial]) then
if (_detalhes.debug) then
_detalhes:Msg ("(debug) segment against trash mobs.")
end
_detalhes.tabela_vigente.is_trash = true
return Loc ["STRING_SEGMENT_TRASH"]
end
end
for name, _ in _pairs (actor.targets._NameIndexTable) do
if (name == _detalhes.playername) then
return actor.nome
@@ -113,6 +95,7 @@
zone = zone,
mapid = mapid,
diff = diff,
diff_string = select (4, GetInstanceInfo()),
ej_instance_id = EJ_GetCurrentInstance(),
}
@@ -421,13 +404,18 @@
_detalhes.tabela_vigente:seta_tempo_decorrido() --> salva o end_time
_detalhes.tabela_overall:seta_tempo_decorrido() --seta o end_time
--> drop last events table to garbage collector
_detalhes.tabela_vigente.player_last_events = {}
--> flag instance type
local _, InstanceType = _GetInstanceInfo()
_detalhes.tabela_vigente.instance_type = InstanceType
if (not _detalhes.tabela_vigente.is_boss) then
local inimigo = _detalhes:FindEnemy()
if (InstanceType == "party" or InstanceType == "raid") then
_detalhes.tabela_vigente.is_trash = true
end
if (inimigo) then
if (_detalhes.debug) then
@@ -581,6 +569,7 @@
end
end
_detalhes.pre_pot_used = nil
_table_wipe (_detalhes.encounter_table)
_detalhes:SendEvent ("COMBAT_PLAYER_LEAVE", nil, _detalhes.tabela_vigente)
@@ -786,9 +775,9 @@
--_detalhes:ScheduleTimer ("EqualizePets", 1+math.random())
--> do not equilize if there is any disabled capture
if (_detalhes:CaptureIsAllEnabled()) then
--if (_detalhes:CaptureIsAllEnabled()) then
_detalhes:ScheduleTimer ("EqualizeActors", 2+math.random()+math.random() , host_of)
end
--end
end
function _detalhes:EqualizeActors (host_of)
@@ -806,13 +795,13 @@
end
if (damage) then
damage = {damage.total, damage.damage_taken, damage.friendlyfire_total}
damage = {damage.total or 0, damage.damage_taken or 0, damage.friendlyfire_total or 0}
else
damage = {0, 0, 0}
end
if (heal) then
heal = {heal.total, heal.totalover, heal.healing_taken}
heal = {heal.total or 0, heal.totalover or 0, heal.healing_taken or 0}
else
heal = {0, 0, 0}
end
+2
View File
@@ -421,6 +421,7 @@
if (_detalhes.schedule_chat_leave) then
_detalhes:CancelTimer (_detalhes.schedule_chat_leave)
_detalhes.schedule_chat_leave = nil
end
_detalhes.schedule_chat_enter = nil
@@ -451,6 +452,7 @@
if (_detalhes.schedule_chat_enter) then
_detalhes:CancelTimer (_detalhes.schedule_chat_enter)
_detalhes.schedule_chat_enter = nil
end
_detalhes.schedule_chat_leave = nil
+152 -95
View File
@@ -79,6 +79,8 @@
local raid_members_cache = setmetatable ({}, _detalhes.weaktable)
--> tanks
local tanks_members_cache = setmetatable ({}, _detalhes.weaktable)
--> damage and heal last events
local last_events_cache = {} --> placeholder
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
@@ -92,13 +94,19 @@
local AFFILIATION_GROUP = 0x00000007
local REACTION_FRIENDLY = 0x00000010
--> recording data options shortcuts
local ENVIRONMENTAL_FALLING_NAME = Loc ["STRING_ENVIRONMENTAL_FALLING"]
local ENVIRONMENTAL_DROWNING_NAME = Loc ["STRING_ENVIRONMENTAL_DROWNING"]
local ENVIRONMENTAL_FATIGUE_NAME = Loc ["STRING_ENVIRONMENTAL_FATIGUE"]
local ENVIRONMENTAL_FIRE_NAME = Loc ["STRING_ENVIRONMENTAL_FIRE"]
local ENVIRONMENTAL_LAVA_NAME = Loc ["STRING_ENVIRONMENTAL_LAVA"]
local ENVIRONMENTAL_SLIME_NAME = Loc ["STRING_ENVIRONMENTAL_SLIME"]
--> recording data options flags
local _recording_self_buffs = false
local _recording_ability_with_buffs = false
--local _recording_took_damage = false
local _recording_healing = false
local _recording_buffs_and_debuffs = false
--> in combat shortcut
--> in combat flag
local _in_combat = false
--> hooks
local _hook_cooldowns = false
@@ -235,29 +243,31 @@
elseif (jogador_alvo.grupo) then
--> record death log
local t = jogador_alvo.last_events_table
local t = last_events_cache [alvo_name]
if (not t) then
jogador_alvo.last_events_table = _detalhes:CreateActorLastEventTable()
t = jogador_alvo.last_events_table
t = _current_combat:CreateLastEventsTable (alvo_name)
end
local i = t.n
t.n = i + 1
t = t [i]
local this_event = t [i]
t [1] = true --> true if this is a damage || false for healing
t [2] = spellid --> spellid || false if this is a battle ress line
t [3] = amount --> amount of damage or healing
t [4] = time --> parser time
t [5] = _UnitHealth (alvo_name) --> current unit heal
t [6] = who_name --> source name
this_event [1] = true --> true if this is a damage || false for healing
this_event [2] = spellid --> spellid || false if this is a battle ress line
this_event [3] = amount --> amount of damage or healing
this_event [4] = time --> parser time
this_event [5] = _UnitHealth (alvo_name) --> current unit heal
this_event [6] = who_name --> source name
this_event [7] = absorbed
this_event [8] = school
i = i + 1
if (i == 9) then
jogador_alvo.last_events_table.n = 1
if (i == 17) then
t.n = 1
else
t.n = i
end
--> record avoidance only for player actors
@@ -353,28 +363,31 @@
if (raid_members_cache [who_serial] and raid_members_cache [alvo_serial]) then
--> record death log
local t = jogador_alvo.last_events_table
local t = last_events_cache [alvo_name]
if (not t) then
jogador_alvo.last_events_table = _detalhes:CreateActorLastEventTable()
t = jogador_alvo.last_events_table
t = _current_combat:CreateLastEventsTable (alvo_name)
end
local i = t.n
t.n = i + 1
t = t [i]
t [1] = true --> true if this is a damage || false for healing
t [2] = spellid --> spellid || false if this is a battle ress line
t [3] = amount --> amount of damage or healing
t [4] = time --> parser time
t [5] = _UnitHealth (alvo_name) --> current unit heal
t [6] = who_name --> source name
local this_event = t [i]
this_event [1] = true --> true if this is a damage || false for healing
this_event [2] = spellid --> spellid || false if this is a battle ress line
this_event [3] = amount --> amount of damage or healing
this_event [4] = time --> parser time
this_event [5] = _UnitHealth (alvo_name) --> current unit heal
this_event [6] = who_name --> source name
this_event [7] = absorbed
this_event [8] = school
this_event [9] = true
i = i + 1
if (i == 9) then
jogador_alvo.last_events_table.n = 1
if (i == 17) then
t.n = 1
else
t.n = i
end
--> faz a adução do friendly fire
@@ -628,28 +641,33 @@
if (jogador_alvo.grupo) then
local t = jogador_alvo.last_events_table
local t = last_events_cache [alvo_name]
if (not t) then
jogador_alvo.last_events_table = _detalhes:CreateActorLastEventTable()
t = jogador_alvo.last_events_table
t = _current_combat:CreateLastEventsTable (alvo_name)
end
local i = t.n
t.n = i + 1
t = t [i]
t [1] = false --> true if this is a damage || false for healing
t [2] = spellid --> spellid || false if this is a battle ress line
t [3] = amount --> amount of damage or healing
t [4] = time --> parser time
t [5] = _UnitHealth (alvo_name) --> current unit heal
t [6] = who_name --> source name
local this_event = t [i]
this_event [1] = false --> true if this is a damage || false for healing
this_event [2] = spellid --> spellid || false if this is a battle ress line
this_event [3] = amount --> amount of damage or healing
this_event [4] = time --> parser time
this_event [5] = _UnitHealth (alvo_name) --> current unit heal
this_event [6] = who_name --> source name
this_event [7] = is_shield
this_event [8] = absorbed
i = i + 1
if (i == 9) then
jogador_alvo.last_events_table.n = 1
if (i == 17) then
t.n = 1
else
t.n = i
end
end
------------------------------------------------------------------------------------------------
@@ -1490,28 +1508,28 @@
end
end
local t = damage_actor.last_events_table
--> last events
local t = last_events_cache [who_name]
if (not t) then
damage_actor.last_events_table = _detalhes:CreateActorLastEventTable()
t = damage_actor.last_events_table
t = _current_combat:CreateLastEventsTable (who_name)
end
local i = t.n
t.n = i + 1
t = t [i]
local this_event = t [i]
t [1] = 1 --> true if this is a damage || false for healing || 1 for cooldown
t [2] = spellid --> spellid || false if this is a battle ress line
t [3] = 1 --> amount of damage or healing
t [4] = time --> parser time
t [5] = _UnitHealth (who_name) --> current unit heal
t [6] = who_name --> source name
this_event [1] = 1 --> true if this is a damage || false for healing || 1 for cooldown
this_event [2] = spellid --> spellid || false if this is a battle ress line
this_event [3] = 1 --> amount of damage or healing
this_event [4] = time --> parser time
this_event [5] = _UnitHealth (who_name) --> current unit heal
this_event [6] = who_name --> source name
i = i + 1
if (i == 9) then
damage_actor.last_events_table.n = 1
if (i == 17) then
t.n = 1
else
t.n = i
end
este_jogador.last_cooldown = {time, spellid}
@@ -2008,7 +2026,14 @@
end
if (not jaTem) then
_table_insert (_current_combat.last_events_tables [i] [1], 1, {true, spellid, false, time, _UnitHealth (alvo_name), who_name })
_table_insert (_current_combat.last_events_tables [i] [1], 1, {
2,
spellid,
1,
time,
_UnitHealth (alvo_name),
who_name
})
break
end
end
@@ -2214,57 +2239,55 @@
end
--> monta a estrutura da morte pegando a tabela de dano e a tabela de cura
local dano = _current_combat[1]:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --> container do dano
local cura = _current_combat[2]:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --> container da cura
--> objeto da morte
local esta_morte = {}
--> adiciona a tabela da morte apenas os DANOS recentes
for index, tabela in _ipairs (dano.last_events_table) do
if (tabela [4]) then
if (tabela [4] + 12 > time) then --> mostra apenas eventos recentes
esta_morte [#esta_morte+1] = tabela
end
end
--> add events
local t = last_events_cache [alvo_name]
if (not t) then
t = _current_combat:CreateLastEventsTable (alvo_name)
end
--> adiciona a tabela da morte apenas as CURAS recentes
if (cura.last_events_table) then
for index, tabela in _ipairs (cura.last_events_table) do
if (tabela [4]) then
if (tabela [4] + 12 > time) then
esta_morte [#esta_morte+1] = tabela
end
local last_index = t.n --or 'next index'
if (last_index < 17 and not t[last_index][4]) then
for i = 1, last_index-1 do
if (t[i][4] and t[i][4]+16 > time) then
_table_insert (esta_morte, t[i])
end
end
else
for i = last_index, 16 do --next index to 16
if (t[i][4] and t[i][4]+16 > time) then
_table_insert (esta_morte, t[i])
end
end
for i = 1, last_index-1 do --1 to latest index
if (t[i][4] and t[i][4]+16 > time) then
_table_insert (esta_morte, t[i])
end
end
end
--parser:safe_sort_dead (esta_morte)
_table_sort (esta_morte, _detalhes.Sort4)
if (_hook_deaths) then
--> send event to registred functions
local death_at = _tempo - _current_combat.start_time
local max_health = _UnitHealthMax (alvo_name)
local new_death_table = {}
for index, t in _ipairs (esta_morte) do
new_death_table [index] = t
end
for _, func in _ipairs (_hook_deaths_container) do
local new_death_table = table_deepcopy (esta_morte)
func (nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, new_death_table, este_jogador.last_cooldown, death_at, max_health)
end
end
end
if (_detalhes.deadlog_limit and #esta_morte > _detalhes.deadlog_limit) then
for i = #esta_morte, _detalhes.deadlog_limit+1, -1 do
_table_remove (esta_morte, i)
if (_detalhes.deadlog_limit and #esta_morte > _detalhes.deadlog_limit) then
while (#esta_morte > _detalhes.deadlog_limit) do
_table_remove (esta_morte, 1)
end
end
if (este_jogador.last_cooldown) then
local t = {}
t [1] = 2 --> true if this is a damage || false for healing || 1 for cooldown usage || 2 for last cooldown
t [1] = 3 --> true if this is a damage || false for healing || 1 for cooldown usage || 2 for last cooldown
t [2] = este_jogador.last_cooldown[2] --> spellid || false if this is a battle ress line
t [3] = 1 --> amount of damage or healing
t [4] = este_jogador.last_cooldown[1] --> parser time
@@ -2273,7 +2296,7 @@
esta_morte [#esta_morte+1] = t
else
local t = {}
t [1] = 2 --> true if this is a damage || false for healing || 1 for cooldown usage || 2 for last cooldown
t [1] = 3 --> true if this is a damage || false for healing || 1 for cooldown usage || 2 for last cooldown
t [2] = 0 --> spellid || false if this is a battle ress line
t [3] = 0 --> amount of damage or healing
t [4] = 0 --> parser time
@@ -2285,13 +2308,14 @@
local decorrido = _tempo - _current_combat.start_time
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}
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}
_table_insert (_current_combat.last_events_tables, #_current_combat.last_events_tables+1, t)
--> reseta a pool
dano.last_events_table = _detalhes:CreateActorLastEventTable()
cura.last_events_table = _detalhes:CreateActorLastEventTable()
last_events_cache [alvo_name] = nil
--dano.last_events_table = _detalhes:CreateActorLastEventTable()
--cura.last_events_table = _detalhes:CreateActorLastEventTable()
end
end
@@ -2344,10 +2368,38 @@
death_table = t
local status, error = xpcall (do_death_sort, sort_error)
if (not status) then
_table_sort (t, _detalhes.Sort4)
--_detalhes:Msg ("(debug) xpcall return false, sort got error.")
_table_sort (t, _detalhes.Sort4Reverse)
end
end
function parser:environment (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, env_type, amount)
local spelid
if (env_type == "Falling") then
who_name = ENVIRONMENTAL_FALLING_NAME
spelid = 3
elseif (env_type == "Drowning") then
who_name = ENVIRONMENTAL_DROWNING_NAME
spelid = 4
elseif (env_type == "Fatigue") then
who_name = ENVIRONMENTAL_FATIGUE_NAME
spelid = 5
elseif (env_type == "Fire") then
who_name = ENVIRONMENTAL_FIRE_NAME
spelid = 6
elseif (env_type == "Lava") then
who_name = ENVIRONMENTAL_LAVA_NAME
spelid = 7
elseif (env_type == "Slime") then
who_name = ENVIRONMENTAL_SLIME_NAME
spelid = 8
end
return parser:spell_dmg (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spelid or 1, env_type, 00000003, amount) --> localize-me
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
@@ -2428,6 +2480,7 @@
token_list ["RANGE_MISSED"] = nil
token_list ["SWING_MISSED"] = nil
token_list ["SPELL_MISSED"] = nil
token_list ["ENVIRONMENTAL_DAMAGE"] = nil
elseif (capture_type == "heal") then
token_list ["SPELL_HEAL"] = nil
@@ -2490,6 +2543,7 @@
token_list ["RANGE_MISSED"] = parser.rangemissed
token_list ["SWING_MISSED"] = parser.swingmissed
token_list ["SPELL_MISSED"] = parser.missed
token_list ["ENVIRONMENTAL_DAMAGE"] = parser.environment
elseif (capture_type == "heal") then
token_list ["SPELL_HEAL"] = parser.heal
@@ -3085,6 +3139,9 @@
--> refresh combat tables
_current_combat = _detalhes.tabela_vigente
--> last events pointer
last_events_cache = _current_combat.player_last_events
--> refresh total containers
_current_total = _current_combat.totals
+53 -2
View File
@@ -30,8 +30,8 @@
else
if (current [key] == nil) then
current [key] = value
elseif (type (current [key]) ~= type (value)) then
current [key] = value
--elseif (type (current [key]) ~= type (value)) then
-- current [key] = value
end
end
end
@@ -224,3 +224,54 @@
return NewPlugin
end
function _detalhes:CreatePluginOptionsFrame (name, title, template)
template = template or 1
if (template == 1) then
local options_frame = CreateFrame ("frame", name, UIParent)
tinsert (UISpecialFrames, name)
options_frame:SetSize (500, 200)
options_frame:SetFrameStrata ("DIALOG")
options_frame:SetScript ("OnMouseDown", function(self, button)
if (button == "RightButton") then
if (self.moving) then
self.moving = false
self:StopMovingOrSizing()
end
return options_frame:Hide()
elseif (button == "LeftButton" and not self.moving) then
self.moving = true
self:StartMoving()
end
end)
options_frame:SetScript ("OnMouseUp", function(self)
if (self.moving) then
self.moving = false
self:StopMovingOrSizing()
end
end)
options_frame:SetMovable (true)
options_frame:EnableMouse (true)
options_frame:Hide()
options_frame:SetPoint ("center", UIParent, "center")
options_frame:SetBackdrop ({bgFile = [[Interface\ACHIEVEMENTFRAME\UI-Achievement-Parchment-Horizontal]], tile = true, tileSize = 830,
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 32,
insets = {left = 5, right = 5, top = 5, bottom = 5}})
options_frame:SetBackdropColor (0, 0, 0, .7)
local title = _detalhes.gump:NewLabel (options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow")
title:SetPoint (12, -13)
_detalhes:SetFontOutline (title, true)
local c = CreateFrame ("Button", nil, options_frame, "UIPanelCloseButton")
c:SetWidth (32)
c:SetHeight (32)
c:SetPoint ("TOPRIGHT", options_frame, "TOPRIGHT", -3, -3)
c:SetFrameLevel (options_frame:GetFrameLevel()+1)
return options_frame
end
end
+13 -2
View File
@@ -191,7 +191,7 @@
end
--> unpack more than 1 table
-- thanks http://www.dzone.com/snippets/lua-unpack-multiple-tables
-- http://www.dzone.com/snippets/lua-unpack-multiple-tables
function _detalhes:unpacks (...)
local values = {}
for i = 1, select ('#', ...) do
@@ -202,11 +202,22 @@
return unpack (values)
end
--> trim thanks from http://lua-users.org/wiki/StringTrim
--> trim http://lua-users.org/wiki/StringTrim
function _detalhes:trim (s)
local from = s:match"^%s*()"
return from > #s and "" or s:match(".*%S", from)
end
--> reverse numerical table
function _detalhes:reverse_table (t)
local new = {}
local index = 1
for i = #t, 1, -1 do
new [index] = t[i]
index = index + 1
end
return new
end
-- lua base64 codec (c) 2006-2008 by Alex Kloss - http://www.it-rfc.de - licensed under the terms of the LGPL2 - http://lua-users.org/wiki/BaseSixtyFour
do