From d8134d51f1384804a1a3e1c16dcd46f47b2fa2cb Mon Sep 17 00:00:00 2001 From: Tercio Date: Tue, 18 Sep 2018 18:13:39 -0300 Subject: [PATCH] - Fixed pets with the owner name showing twice in the pet name. - Fixed tooltips not showing pets for the end segment created after a mythic dungeon. --- Libs/DF/auras.lua | 254 +++++++++++++++++++++--------- Libs/DF/fw.lua | 16 +- Libs/DF/panel.lua | 17 +- Libs/DF/spells.lua | 2 + boot.lua | 3 +- classes/classe_damage.lua | 15 +- classes/classe_energy.lua | 5 + classes/classe_heal.lua | 5 + classes/classe_others.lua | 5 + classes/container_combatentes.lua | 15 +- classes/container_pets.lua | 24 ++- core/parser.lua | 39 ++++- functions/link.lua | 24 ++- functions/slash.lua | 25 ++- 14 files changed, 337 insertions(+), 112 deletions(-) diff --git a/Libs/DF/auras.lua b/Libs/DF/auras.lua index 4eba01d5..6b387adf 100644 --- a/Libs/DF/auras.lua +++ b/Libs/DF/auras.lua @@ -45,7 +45,7 @@ local default_text_for_aura_frame = { MANUAL_ADD_TRACKLIST_DEBUFF = "Add Debuff to Tracklist", } -function DF:LoadAllSpells (hashMap, indexTable) +function DF:LoadAllSpells (hashMap, indexTable, allSpellsSameName) --pre checking which tables to fill to avoid checking if the table exists during the gigantic loop for performance @@ -88,11 +88,32 @@ function DF:LoadAllSpells (hashMap, indexTable) end elseif (hashMap and indexTable) then - for i = 1, CONST_MAX_SPELLS do - local spellName = GetSpellInfo (i) - if (spellName) then - indexTable [#indexTable+1] = lower (spellName) - hashMap [indexTable [#indexTable]] = i + --DF_CALC_PERFORMANCE() + if (allSpellsSameName) then + for i = 1, CONST_MAX_SPELLS do + local spellName = GetSpellInfo (i) + if (spellName) then + spellName = lower (spellName) + indexTable [#indexTable + 1] = spellName + hashMap [spellName] = i + + --same name table + local sameNameTable = allSpellsSameName [spellName] + if (not sameNameTable) then + sameNameTable = {} + allSpellsSameName [spellName] = sameNameTable + end + sameNameTable [#sameNameTable + 1] = i + end + end + else + for i = 1, CONST_MAX_SPELLS do + local spellName = GetSpellInfo (i) + if (spellName) then + spellName = lower (spellName) + indexTable [#indexTable + 1] = spellName + hashMap [spellName] = i + end end end end @@ -264,9 +285,12 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t local AllSpellsMap = {} local AllSpellNames = {} + --store a table with spell name as key and in the value an index table with spell IDs + local AllSpellsSameName = {} + local load_all_spells = function (self, capsule) if (not next (AllSpellsMap)) then - DF:LoadAllSpells (AllSpellsMap, AllSpellNames) + DF:LoadAllSpells (AllSpellsMap, AllSpellNames, AllSpellsSameName) f_auto.AddBuffBlacklistTextBox.SpellAutoCompleteList = AllSpellNames f_auto.AddDebuffBlacklistTextBox.SpellAutoCompleteList = AllSpellNames @@ -321,19 +345,54 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t debuff_name_blacklist_entry:SetJustifyH ("left") debuff_name_blacklist_entry.tooltip = "Enter the debuff name using lower case letters." f_auto.AddDebuffBlacklistTextBox = debuff_name_blacklist_entry - + + local same_name_spells_add = function (spellID) + local spellName = GetSpellInfo (spellID) + if (spellName) then + if (not next (AllSpellsMap)) then + load_all_spells() + end + + spellName = lower (spellName) + local spellWithSameName = AllSpellsSameName [spellName] + if (spellWithSameName) then + db.aura_cache_by_name [spellName] = DF.table.copy ({}, spellWithSameName) + end + end + end + + local get_spellID_from_string = function (text) + --check if the user entered a spell ID + local isSpellID = tonumber (text) + if (isSpellID and isSpellID > 1 and isSpellID < 10000000) then + local isValidSpellID = GetSpellInfo (isSpellID) + if (isValidSpellID) then + return isSpellID + else + return + end + end + + --get the spell ID from the spell name + text = lower (text) + local spellID = AllSpellsMap [text] + if (not spellID) then + return + end + + return spellID + end + local add_blacklist_buff_button = self:CreateButton (background_add_blacklist, function() local text = buff_name_blacklist_entry.text buff_name_blacklist_entry:SetText ("") buff_name_blacklist_entry:ClearFocus() if (text ~= "") then - text = lower (text) - --get the spellId - local spellId = AllSpellsMap [text] + local spellId = get_spellID_from_string (text) if (not spellId) then - print ("spell not found") + DetailsFramework.Msg ({__name = "DetailsFramework"}, "Spell not found!") return end @@ -344,6 +403,9 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t _G [f_auto:GetName() .. "BuffIgnored"]:Refresh() DF:QuickDispatch (change_callback) + + --add to spells with the same name cache + same_name_spells_add (spellId) end end, 100, 20, "Add to Blacklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) @@ -354,12 +416,10 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t debuff_name_blacklist_entry:ClearFocus() if (text ~= "") then - text = lower (text) - --get the spellId - local spellId = AllSpellsMap [text] + local spellId = get_spellID_from_string (text) if (not spellId) then - print ("spell not found") + DetailsFramework.Msg ({__name = "DetailsFramework"}, "Spell not found!") return end @@ -370,6 +430,9 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t _G [f_auto:GetName() .. "DebuffIgnored"]:Refresh() DF:QuickDispatch (change_callback) + + --add to spells with the same name cache + same_name_spells_add (spellId) end end, 100, 20, "Add to Blacklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) @@ -390,44 +453,16 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t debuff_name_tracklist_entry.tooltip = "Enter the debuff name using lower case letters." f_auto.AddDebuffTracklistTextBox = debuff_name_tracklist_entry - local add_tracklist_buff_button = self:CreateButton (background_add_tracklist, function() - local text = buff_name_tracklist_entry.text - buff_name_tracklist_entry:SetText ("") - buff_name_tracklist_entry:ClearFocus() - - if (text ~= "") then - text = lower (text) - - --get the spellId - local spellId = AllSpellsMap [text] - if (not spellId) then - print ("spell not found") - return - end - - --add the spellId to the blacklist - f.db.aura_tracker.buff_tracked [spellId] = true - - --refresh the buff blacklist frame - _G [f_auto:GetName() .. "BuffTracked"]:Refresh() - - DF:QuickDispatch (change_callback) - end - - end, 100, 20, "Add to Tracklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) - local add_tracklist_debuff_button = self:CreateButton (background_add_tracklist, function() local text = debuff_name_tracklist_entry.text debuff_name_tracklist_entry:SetText ("") debuff_name_tracklist_entry:ClearFocus() if (text ~= "") then - text = lower (text) - --get the spellId - local spellId = AllSpellsMap [text] + local spellId = get_spellID_from_string (text) if (not spellId) then - print ("spell not found") + DetailsFramework.Msg ({__name = "DetailsFramework"}, "Spell not found!") return end @@ -438,9 +473,40 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t _G [f_auto:GetName() .. "DebuffTracked"]:Refresh() DF:QuickDispatch (change_callback) + + --add to spells with the same name cache + same_name_spells_add (spellId) end end, 100, 20, "Add to Tracklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) + local add_tracklist_buff_button = self:CreateButton (background_add_tracklist, function() + local text = buff_name_tracklist_entry.text + buff_name_tracklist_entry:SetText ("") + buff_name_tracklist_entry:ClearFocus() + + if (text ~= "") then + --get the spellId + local spellId = get_spellID_from_string (text) + if (not spellId) then + DetailsFramework.Msg ({__name = "DetailsFramework"}, "Spell not found!") + return + end + + --add the spellId to the blacklist + f.db.aura_tracker.buff_tracked [spellId] = true + + --refresh the buff blacklist frame + _G [f_auto:GetName() .. "BuffTracked"]:Refresh() + + DF:QuickDispatch (change_callback) + + --add to spells with the same name cache + same_name_spells_add (spellId) + + end + + end, 100, 20, "Add to Tracklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) + --anchors: background_add_blacklist:SetPoint ("topleft", f_auto, "topleft", 0, y) background_add_tracklist:SetPoint ("topleft", background_add_blacklist, "bottomleft", 0, -10) @@ -472,6 +538,44 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t --options passed to the create aura panel local width, height, row_height = options.width, options.height, options.row_height + local autoTrackList_LineOnEnter = function (self, capsule, value) + local spellName = GetSpellInfo (value) + if (spellName) then + --GameTooltip:SetOwner (self, "ANCHOR_TOPLEFT", -40, 0); + --GameTooltip:SetSpellByID(value); + --GameTooltip:Show() + + local spellsWithSameName = db.aura_cache_by_name [lower (spellName)] + if (not spellsWithSameName) then + same_name_spells_add (value) + spellsWithSameName = db.aura_cache_by_name [lower (spellName)] + end + + if (spellsWithSameName) then + GameCooltip2:Preset (2) + GameCooltip2:SetOwner (self, "left", "right", 2, 0) + + GameCooltip2:AddLine ("List of Spells:") + GameCooltip2:AddIcon ("", 1, 1, 1, 20) + GameCooltip2:AddStatusBar (100, 1, .2, .2, .2, .5, false, false, "Details Flat") + + for i, spellID in ipairs (spellsWithSameName) do + local spellName, _, spellIcon = GetSpellInfo (spellID) + if (spellName) then + GameCooltip2:AddLine (spellName) + GameCooltip2:AddIcon (spellIcon) + end + end + + GameCooltip2:Show() + end + + end + end + + local autoTrackList_LineOnLeave = function() + GameCooltip2:Hide() + end --Debuffs on the black list local debuff_ignored = self:CreateSimpleListBox (f_auto, "$parentDebuffIgnored", texts.DEBUFFS_IGNORED, "the list is empty", f.db.aura_tracker.debuff_banned, function (spellid) @@ -486,7 +590,8 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t backdrop_color = {.8, .8, .8, 0.2}, panel_border_color = {.01, 0, 0, 1}, iconcoords = {.1, .9, .1, .9}, - onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_CURSOR"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, + onenter = autoTrackList_LineOnEnter, + onleave = autoTrackList_LineOnLeave, show_x_button = true, x_button_func = function (spellId) f.db.aura_tracker.debuff_banned [spellId] = nil; DF:QuickDispatch (change_callback); @@ -507,7 +612,8 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t backdrop_color = {.8, .8, .8, 0.2}, panel_border_color = {.02, 0, 0, 1}, iconcoords = {.1, .9, .1, .9}, - onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_CURSOR"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, + onenter = autoTrackList_LineOnEnter, + onleave = autoTrackList_LineOnLeave, show_x_button = true, x_button_func = function (spellId) f.db.aura_tracker.buff_banned [spellId] = nil; DF:QuickDispatch (change_callback); @@ -527,7 +633,8 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t backdrop_color = {.8, .8, .8, 0.2}, panel_border_color = {0, .02, 0, 1}, iconcoords = {.1, .9, .1, .9}, - onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_CURSOR"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, + onenter = autoTrackList_LineOnEnter, + onleave = autoTrackList_LineOnLeave, show_x_button = true, x_button_func = function (spellId) f.db.aura_tracker.debuff_tracked [spellId] = nil; DF:QuickDispatch (change_callback); @@ -547,7 +654,8 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t backdrop_color = {.8, .8, .8, 0.2}, panel_border_color = {0, .01, 0, 1}, iconcoords = {.1, .9, .1, .9}, - onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_CURSOR"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, + onenter = autoTrackList_LineOnEnter, + onleave = autoTrackList_LineOnLeave, show_x_button = true, x_button_func = function (spellId) f.db.aura_tracker.buff_tracked [spellId] = nil; DF:QuickDispatch (change_callback); @@ -741,26 +849,23 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t if (text:find (";")) then for _, spellName in ipairs ({strsplit (";", text)}) do spellName = self:trim (spellName) - spellName = lower (spellName) - if (string.len (spellName) > 0) then - local spellId = AllSpellsMap [spellName] - if (spellId) then - tinsert (f.db.aura_tracker.buff, spellId) - else - print ("spellId not found for spell:", spellName) - end + local spellID = get_spellID_from_string (spellName) + + if (spellID) then + tinsert (f.db.aura_tracker.buff, spellID) + else + print ("spellId not found for spell:", spellName) end end else --get the spellId - local spellName = lower (text) - local spellId = AllSpellsMap [spellName] - if (not spellId) then - print ("spellIs for spell ", spellName, "not found") + local spellID = get_spellID_from_string (text) + if (not spellID) then + print ("spellIs for spell ", text, "not found") return end - tinsert (f.db.aura_tracker.buff, spellId) + tinsert (f.db.aura_tracker.buff, spellID) end buffs_added:Refresh() @@ -777,26 +882,23 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t if (text:find (";")) then for _, spellName in ipairs ({strsplit (";", text)}) do spellName = self:trim (spellName) - spellName = lower (spellName) - if (string.len (spellName) > 0) then - local spellId = AllSpellsMap [spellName] - if (spellId) then - tinsert (f.db.aura_tracker.debuff, spellId) - else - print ("spellId not found for spell:", spellName) - end + local spellID = get_spellID_from_string (spellName) + + if (spellID) then + tinsert (f.db.aura_tracker.debuff, spellID) + else + print ("spellId not found for spell:", spellName) end end else --get the spellId - local spellName = lower (text) - local spellId = AllSpellsMap [spellName] - if (not spellId) then - print ("spellIs for spell ", spellName, "not found") + local spellID = get_spellID_from_string (text) + if (not spellID) then + print ("spellIs for spell ", text, "not found") return end - tinsert (f.db.aura_tracker.debuff, spellId) + tinsert (f.db.aura_tracker.debuff, spellID) end debuffs_added:Refresh() diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index fa8a3553..a18edc11 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 105 +local dversion = 107 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -2411,7 +2411,19 @@ function DF:Dispatch (func, ...) end --/run local a, b =32,3; local f=function(c,d) return c+d, 2, 3;end; print (xpcall(f,geterrorhandler(),a,b)) - +function DF_CALC_PERFORMANCE() + local F = CreateFrame ("frame") + local T = GetTime() + local J = false + F:SetScript ("OnUpdate", function (self, deltaTime) + if (not J) then + J = true + return + end + print ("Elapsed Time:", deltaTime) + F:SetScript ("OnUpdate", nil) + end) +end --doo elsee --was doing double loops due to not enought height diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index ad10b308..f273b17a 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -4820,10 +4820,11 @@ DF.IconRowFunctions = { local cooldownFrame = CreateFrame ("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate") cooldownFrame:SetAllPoints() cooldownFrame:EnableMouse (false) + cooldownFrame:SetFrameLevel (newIconFrame:GetFrameLevel()+1) - newIconFrame.Text = cooldownFrame:CreateFontString (nil, "overlay", "GameFontNormal") - newIconFrame.Text:SetPoint ("center") - newIconFrame.Text:Hide() + newIconFrame.CountdownText = cooldownFrame:CreateFontString (nil, "overlay", "GameFontNormal") + newIconFrame.CountdownText:SetPoint ("center") + newIconFrame.CountdownText:Hide() newIconFrame.Desc = newIconFrame:CreateFontString (nil, "overlay", "GameFontNormal") newIconFrame.Desc:SetPoint ("bottom", newIconFrame, "top", 0, 2) @@ -4858,7 +4859,7 @@ DF.IconRowFunctions = { end - DF:SetFontColor (iconFrame.Text, self.options.text_color) + DF:SetFontColor (iconFrame.CountdownText, self.options.text_color) self.NextIcon = self.NextIcon + 1 return iconFrame @@ -4889,14 +4890,14 @@ DF.IconRowFunctions = { CooldownFrame_Set (iconFrame.Cooldown, startTime, duration, true, true) if (self.options.show_text) then - iconFrame.Text:Show() - iconFrame.Text:SetText (floor (startTime + duration - GetTime())) + iconFrame.CountdownText:Show() + iconFrame.CountdownText:SetText (floor (startTime + duration - GetTime())) else - iconFrame.Text:Hide() + iconFrame.CountdownText:Hide() end else - iconFrame.Text:Hide() + iconFrame.CountdownText:Hide() end if (descText and self.options.desc_text) then diff --git a/Libs/DF/spells.lua b/Libs/DF/spells.lua index b65ec1c4..eca51c10 100644 --- a/Libs/DF/spells.lua +++ b/Libs/DF/spells.lua @@ -604,6 +604,7 @@ DF.CrowdControlSpells = { [710] = "WARLOCK", --Banish [118] = "MAGE", --Polymorph + [61305] = "MAGE", --Polymorph (black cat) [82691] = "MAGE", --Ring of Frost (debuff spellid) [122] = "MAGE", --Frost Nova [157997] = "MAGE", --Ice Nova @@ -623,6 +624,7 @@ DF.CrowdControlSpells = { [408] = "ROGUE", --Kidney Shot [6770] = "ROGUE", --Sap [1776] = "ROGUE", --Gouge + [199804] = "ROGUE", --Between the Eyes [853] = "PALADIN", --Hammer of Justice [20066] = "PALADIN", --Repentance (talent) diff --git a/boot.lua b/boot.lua index f60ca437..7ee921d2 100644 --- a/boot.lua +++ b/boot.lua @@ -3,7 +3,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 6449 + _detalhes.build_counter = 6458 _detalhes.userversion = "v8.0.1." .. _detalhes.build_counter _detalhes.realversion = 134 --core version _detalhes.APIVersion = _detalhes.realversion --core version @@ -511,6 +511,7 @@ do SharedMedia:Register ("statusbar", "Skyline", [[Interface\AddOns\Details\images\bar_skyline]]) SharedMedia:Register ("statusbar", "WorldState Score", [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]]) SharedMedia:Register ("statusbar", "DGround", [[Interface\AddOns\Details\images\bar_background]]) + SharedMedia:Register ("statusbar", "Details Flat", [[Interface\AddOns\Details\images\bar_background]]) --window bg and bar border SharedMedia:Register ("background", "Details Ground", [[Interface\AddOns\Details\images\background]]) diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index 46967f10..b31b0ad8 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -4010,7 +4010,6 @@ function atributo_damage:MontaInfoDamageDone() info:SetTopRightTexts() end - --> add pets local ActorPets = self.pets --local class_color = RAID_CLASS_COLORS [self.classe] and RAID_CLASS_COLORS [self.classe].colorStr @@ -5014,9 +5013,10 @@ end function atributo_damage:r_connect_shadow (actor, no_refresh, combat_object) + --check if there's a custom combat, if not just use the overall container local host_combat = combat_object or _detalhes.tabela_overall - --> criar uma shadow desse ator se ainda n�o tiver uma + --check if the host combat object has a shadow actor for this actor, if not, just create one new local overall_dano = host_combat [1] local shadow = overall_dano._ActorTable [overall_dano._NameIndexTable [actor.nome]] @@ -5036,7 +5036,7 @@ end shadow.end_time = time() end - --> restaura a meta e indexes ao ator + --check if need to restore meta tables and indexes for this actor if (not no_refresh) then _detalhes.refresh:r_atributo_damage (actor, shadow) end @@ -5049,7 +5049,12 @@ end local tempo = end_time - actor.start_time shadow.start_time = shadow.start_time - tempo - + + --> pets (add unique pet names) + for _, petName in _ipairs (actor.pets) do + DetailsFramework.table.addunique (shadow.pets, petName) + end + --> total de dano (captura de dados) shadow.total = shadow.total + actor.total shadow.totalabsorbed = shadow.totalabsorbed + actor.totalabsorbed @@ -5114,7 +5119,7 @@ end end end end - + --> copia o container de friendly fire (captura de dados) for target_name, ff_table in _pairs (actor.friendlyfire) do --> cria ou pega a shadow diff --git a/classes/classe_energy.lua b/classes/classe_energy.lua index 0821b4fa..8aa07e14 100644 --- a/classes/classe_energy.lua +++ b/classes/classe_energy.lua @@ -1422,6 +1422,11 @@ end _detalhes.refresh:r_atributo_energy (actor, shadow) end + --> pets (add unique pet names) + for _, petName in _ipairs (actor.pets) do + DetailsFramework.table.addunique (shadow.pets, petName) + end + --> total das energias (captura de dados) shadow.total = shadow.total + actor.total shadow.received = shadow.received + actor.received diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index 42fef5ab..2501be81 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -2473,6 +2473,11 @@ end local tempo = end_time - actor.start_time shadow.start_time = shadow.start_time - tempo + --> pets (add unique pet names) + for _, petName in _ipairs (actor.pets) do + DetailsFramework.table.addunique (shadow.pets, petName) + end + --> total de cura (captura de dados) shadow.total = shadow.total + actor.total --> total de overheal (captura de dados) diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 36a5b85f..8e78a47f 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -2473,6 +2473,11 @@ function atributo_misc:r_connect_shadow (actor, no_refresh, combat_object) if (not no_refresh) then _detalhes.refresh:r_atributo_misc (actor, shadow) end + + --> pets (add unique pet names) + for _, petName in _ipairs (actor.pets) do + DetailsFramework.table.addunique (shadow.pets, petName) + end if (actor.spell_cast) then if (not shadow.spell_cast) then diff --git a/classes/container_combatentes.lua b/classes/container_combatentes.lua index 7c615fea..7284e6ea 100644 --- a/classes/container_combatentes.lua +++ b/classes/container_combatentes.lua @@ -18,6 +18,8 @@ local _ipairs = ipairs --lua local local _pairs = pairs --lua local + local AddUnique = DetailsFramework.table.addunique --framework + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> constants @@ -485,7 +487,6 @@ if (container_pets [serial]) then --> � um pet reconhecido --[[statistics]]-- _detalhes.statistics.container_pet_calls = _detalhes.statistics.container_pet_calls + 1 - local nome_dele, dono_nome, dono_serial, dono_flag = _detalhes.tabela_pets:PegaDono (serial, nome, flag) if (nome_dele and dono_nome) then nome = nome_dele @@ -541,7 +542,7 @@ read_actor_flag (novo_objeto, dono_do_pet, serial, flag, nome, "damage") if (dono_do_pet) then - dono_do_pet.pets [#dono_do_pet.pets+1] = nome + AddUnique (dono_do_pet.pets, nome) end if (self.shadow) then @@ -575,7 +576,7 @@ read_actor_flag (novo_objeto, dono_do_pet, serial, flag, nome, "heal") if (dono_do_pet) then - dono_do_pet.pets [#dono_do_pet.pets+1] = nome + AddUnique (dono_do_pet.pets, nome) end if (self.shadow) then @@ -602,7 +603,7 @@ read_actor_flag (novo_objeto, dono_do_pet, serial, flag, nome, "energy") if (dono_do_pet) then - dono_do_pet.pets [#dono_do_pet.pets+1] = nome + AddUnique (dono_do_pet.pets, nome) end if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player @@ -620,11 +621,9 @@ local shouldScanOnce = get_actor_class (novo_objeto, nome, flag, serial) read_actor_flag (novo_objeto, dono_do_pet, serial, flag, nome, "misc") - - --local teste_classe = - + if (dono_do_pet) then - dono_do_pet.pets [#dono_do_pet.pets+1] = nome + AddUnique (dono_do_pet.pets, nome) end if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player diff --git a/classes/container_pets.lua b/classes/container_pets.lua index e8b9276e..2631d84c 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -43,7 +43,19 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) --> buscar pelo pet no container de pets local busca = self.pets [pet_serial] if (busca) then - return pet_nome .." <"..busca[1]..">", busca[1], busca[2], busca[3] --> [1] dono nome [2] dono serial [3] dono flag + + --in merging operations, make sure to not add the owner name a second time in the name + + --check if the pet name already has the owner name in, if not, add it + if (not pet_nome:find ("<")) then + --get the owner name + local ownerName = busca[1] + --add the owner name to the pet name + pet_nome = pet_nome .. " <".. ownerName ..">" + end + + return pet_nome, busca[1], busca[2], busca[3] --> [1] dono nome [2] dono serial [3] dono flag + end --> buscar pelo pet na raide @@ -93,7 +105,12 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) if (dono_nome) then self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, true} --> adicionada a flag emulada - return pet_nome .." <"..dono_nome..">", dono_nome, dono_serial, dono_flags + + if (not pet_nome:find ("<")) then + pet_nome = pet_nome .. " <".. dono_nome ..">" + end + + return pet_nome, dono_nome, dono_serial, dono_flags else if (pet_flags and _bit_band (pet_flags, OBJECT_TYPE_PET) ~= 0) then --> � um pet @@ -225,8 +242,9 @@ end function _detalhes:LimparPets() --> elimina pets antigos local _new_PetTable = {} + --> minimum of 90 minutes to clean a pet from the pet table data for PetSerial, PetTable in _pairs (_detalhes.tabela_pets.pets) do - if ( (PetTable[4] + _detalhes.intervalo_coleta > _detalhes._tempo + 1) or (PetTable[5] and PetTable[4] + 43200 > _detalhes._tempo) ) then + if ( (PetTable[4] + 5400 > _detalhes._tempo + 1) or (PetTable[5] and PetTable[4] + 43200 > _detalhes._tempo) ) then _new_PetTable [PetSerial] = PetTable end end diff --git a/core/parser.lua b/core/parser.lua index 9ecd01ba..b8acd630 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -78,6 +78,8 @@ local energy_cache = setmetatable ({}, _detalhes.weaktable) --> misc local misc_cache = setmetatable ({}, _detalhes.weaktable) + local misc_cache_pets = setmetatable ({}, _detalhes.weaktable) + local misc_cache_petsOwners = setmetatable ({}, _detalhes.weaktable) --> party & raid members local raid_members_cache = setmetatable ({}, _detalhes.weaktable) --> tanks @@ -424,7 +426,7 @@ local este_jogador, meu_dono = damage_cache [who_serial] or damage_cache_pets [who_serial] or damage_cache [who_name], damage_cache_petsOwners [who_serial] if (not este_jogador) then --> pode ser um desconhecido ou um pet - + este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true) if (meu_dono) then --> � um pet @@ -462,7 +464,6 @@ local jogador_alvo, alvo_dono = damage_cache [alvo_serial] or damage_cache_pets [alvo_serial] or damage_cache [alvo_name], damage_cache_petsOwners [alvo_serial] if (not jogador_alvo) then - jogador_alvo, alvo_dono, alvo_name = _current_damage_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) if (alvo_dono) then @@ -2843,11 +2844,28 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 --> get actors --> main actor - local este_jogador = misc_cache [who_name] + + local este_jogador, meu_dono = misc_cache [who_serial] or misc_cache_pets [who_serial] or misc_cache [who_name], misc_cache_petsOwners [who_serial] + --local este_jogador = misc_cache [who_name] + if (not este_jogador) then + este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) - if (not meu_dono) then --> se n�o for um pet, adicionar no cache - misc_cache [who_name] = este_jogador + + if (meu_dono) then --> é um pet + if (who_serial ~= "") then + misc_cache_pets [who_serial] = este_jogador + misc_cache_petsOwners [who_serial] = meu_dono + end + + --conferir se o dono já esta no cache + if (not misc_cache [meu_dono.serial] and meu_dono.serial ~= "") then + misc_cache [meu_dono.serial] = meu_dono + end + else + if (who_flags) then + misc_cache [who_name] = este_jogador + end end end @@ -4569,7 +4587,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 amount = amount + 1 end print ("parser misc_cache", amount) - print ("group damage", #_detalhes.cache_damage_group) print ("group damage", #_detalhes.cache_healing_group) end @@ -4589,6 +4606,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _table_wipe (healing_cache) _table_wipe (energy_cache) _table_wipe (misc_cache) + _table_wipe (misc_cache_pets) + _table_wipe (misc_cache_petsOwners) + _table_wipe (ignore_death) damage_cache = setmetatable ({}, _detalhes.weaktable) @@ -4600,7 +4620,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 energy_cache = setmetatable ({}, _detalhes.weaktable) misc_cache = setmetatable ({}, _detalhes.weaktable) - + misc_cache_pets = setmetatable ({}, _detalhes.weaktable) + misc_cache_petsOwners = setmetatable ({}, _detalhes.weaktable) end function parser:RevomeActorFromCache (actor_serial, actor_name) @@ -4611,6 +4632,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 healing_cache [actor_name] = nil energy_cache [actor_name] = nil misc_cache [actor_name] = nil + misc_cache_pets [actor_name] = nil + misc_cache_petsOwners [actor_name] = nil end if (actor_serial) then damage_cache [actor_serial] = nil @@ -4619,6 +4642,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 healing_cache [actor_serial] = nil energy_cache [actor_serial] = nil misc_cache [actor_serial] = nil + misc_cache_pets [actor_serial] = nil + misc_cache_petsOwners [actor_serial] = nil end end diff --git a/functions/link.lua b/functions/link.lua index b657b5bc..423af2fd 100644 --- a/functions/link.lua +++ b/functions/link.lua @@ -4335,7 +4335,29 @@ function _detalhes.OpenDetailsDeathRecap (segment, RecapID) --segment to use local death = _detalhes.tabela_vigente.last_events_tables - + + --see if this segment has a death for the player + local foundPlayer = false + for index = #death, 1, -1 do + if (death [index] [3] == _detalhes.playername) then + foundPlayer = true + break + end + end + + --in case a combat has been created after the player death, the death won't be at the current segment + if (not foundPlayer) then + local segmentHistory = _detalhes:GetCombatSegments() + for i = 1, 2 do + local segment = segmentHistory [1] + if (segment and segment ~= _detalhes.tabela_vigente) then + if (_detalhes.tabela_vigente.start_time - 3 < segment.end_time) then + death = segment.last_events_tables + end + end + end + end + --segments if (_detalhes.death_recap.show_segments) then local last_index = 0 diff --git a/functions/slash.lua b/functions/slash.lua index 648e3b50..372e8dce 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -211,6 +211,28 @@ function SlashCmdList.DETAILS (msg, editbox) print ("|cFF00FF00No error occured!|r") end + elseif (msg == "tr") then + + local f = CreateFrame ("frame", nil, UIParent) + f:SetSize (300, 300) + f:SetPoint ("center") + +-- /run TTT:SetTexture ("Interface\\1024.tga") + local texture = f:CreateTexture ("TTT", "background") + texture:SetAllPoints() + texture:SetTexture ("Interface\\1023.tga") + + local A = DetailsFramework:CreateAnimationHub (texture) + + local b = DetailsFramework:CreateAnimation (A, "ROTATION", 1, 40, 360) + b:SetTarget (texture) + A:Play() + + C_Timer.NewTicker (1, function() + texture:SetTexCoord (math.random(), math.random(), math.random(), math.random(), math.random(), math.random(), math.random(), math.random()) + end) + + elseif (msg == "realmsync") then _detalhes.realm_sync = not _detalhes.realm_sync @@ -1374,7 +1396,8 @@ Damage Update Status: @INSTANCEDAMAGESTATUS startDate = lastSegment:GetDate() end - _detalhes:Msg ("done merging " .. segmentsAdded .. " segments.") + newCombat.is_trash = false + _detalhes:Msg ("done merging, segments: " .. segmentsAdded .. ", total time: " .. DetailsFramework:IntegerToTimer (totalTime)) --[[ --mythic+ debug --> tag the segment as mythic overall segment