From 44070b38a54f0a22a3023d2fa1ba30dc541aabcf Mon Sep 17 00:00:00 2001 From: Tercio Date: Mon, 16 Mar 2015 00:56:58 -0300 Subject: [PATCH] - Boss segments now need to have at least 30 seconds to be added on the overall data. - When the segment limit is reach, segments with less combat time will be erased instead of the olders. - Added item level tracker. - Details Storage now stores the item level of the character as well and only guild runs. - Fixed window positioning when changing from Solo mode to Group mode. --- boot.lua | 13 +- classes/classe_instancia.lua | 2 +- classes/container_historico.lua | 67 ++- core/control.lua | 3 + core/gears.lua | 467 ++++++++++-------- core/network.lua | 15 + core/parser.lua | 11 +- core/windows.lua | 4 +- functions/profiles.lua | 8 +- functions/slash.lua | 20 + images/border_3.tga | Bin 0 -> 1809 bytes .../Details_DataStorage.lua | 20 +- startup.lua | 19 + 13 files changed, 412 insertions(+), 237 deletions(-) create mode 100644 images/border_3.tga diff --git a/boot.lua b/boot.lua index e156cd4d..a481f1b4 100644 --- a/boot.lua +++ b/boot.lua @@ -4,8 +4,8 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") _detalhes.build_counter = 656 --it's 656 for release - _detalhes.userversion = "v3.11.0" - _detalhes.realversion = 63 --core version + _detalhes.userversion = "v3.11.2" + _detalhes.realversion = 64 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -20,14 +20,18 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ -|cFFFFFF00v3.11.0 (|cFFFFCC00Mar 13, 2015|r|cFFFFFF00)|r:\n\n +|cFFFFFF00v3.11.2 (|cFFFFCC00Mar 16, 2015|r|cFFFFFF00)|r:\n\n +|cFFFFFF00-|r Boss segments now need to have at least 30 seconds to be added on the overall data.\n\n +|cFFFFFF00-|r When the segment limit is reach, segments with less combat time will be erased instead of the olders.\n\n +|cFFFFFF00-|r Added item level tracker.\n\n +|cFFFFFF00-|r Fixed window positioning when changing from Solo mode to Group mode.\n\n |cFFFFFF00-|r Added an option for change the amount of lines on death log.\n\n |cFFFFFF00-|r Added custom display for CC done.\n\n --]] -- - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.11.0 (|cFFFFCC00Mar 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added an option for change the amount of lines on death log.\n\n|cFFFFFF00-|r Added custom display for CC done.\n\n|cFFFFFF00v3.10.10 (|cFFFFCC00Mar 10, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): done a calibration on endurance calculation.\n\n|cFFFFFF00-|r Raid Check (plugin): now also show information for 50+ stats runes.\n\n|cFFFFFF00-|r Fixed cooldowns spell targets on overall data.\n\n|cFFFFFF00-|r Fixed report custom displays where sometimes it didn't report spell links.\n\n|cFFFFFF00-|r Replaced old report line saying 'for the last X segments' with 'overall data'.\n\n|cFFFFFF00-|r Mini-displays on statusbar are now more responsible to right button click.\n\n|cFFFFFF00-|r Added Mage's Greater Invisibility as cooldown.\n\n|cFFFFFF00v3.10.8 (|cFFFFCC00Mar 02, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Improved aura creation.\n\n|cFFFFFF00-|r Custom display 'My Spells' now also show your pets.\n\n|cFFFFFF00-|r Fixed 'Raid Check' plugin food detection.\n\n|cFFFFFF00v3.10.6 (|cFFFFCC00Feb 24, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): several bug fixes and improvements.\n\n|cFFFFFF00-|r Encounter Details (plugin): added new tab showing enemy spells from the encounter with an aura creation panel.\n\n|cFFFFFF00-|r Encounter Details (plugin): added phase indicators on graphic tab, hovering over shows the damage and heal for that specific phase.\n\n|cFFFFFF00-|r Segments menu now also show the encounter try number plus the elapsed combat time.\n\n|cFFFFFF00-|r Several improvements on Overall Data, also, now it has an option to not save it when the character logoff.\n\n|cFFFFFF00-|r Player Details window now closes with right click on any bar.\n\n|cFFFFFF00-|r Fixed Nature's Vigil cooldown.\n\n|cFFFFFF00v3.9.12a (|cFFFFCC00Feb 16, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Roll back on combat detection after reset data, might be causing problems.\n\n|cFFFFFF00v3.9.12 (|cFFFFCC00Feb 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): got report buttons for Endurance and Deaths Overall Damage.\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): the Deaths and Endurance limits can now be changed under the plugin options.\n\n|cFFFFFF00-|r Chart Viewer (plugin): has been revamped and now it's less complicated to use.\n\n|cFFFFFF00-|r Time Line (plugin): added options to change the background color and scale.\n\n|cFFFFFF00-|r Raid Check (plugin): its window is now 'always on top'.\n\n|cFFFFFF00-|r Accuracy adjustments on overheal of Divine Aegis and Illuminated Healing.\n\n|cFFFFFF00-|r Removed healthstone from cooldown list, added Nature's Vigil.\n\n|cFFFFFF00-|r Enemies display now shows damage taken instead of damage done.\n\n|cFFFFFF00-|r Tooltip for enemies display now also show damage and healing done by the enemy.\n\n|cFFFFFF00-|r Added an option under miscellaneous to show neutral and hostile creatures on damage taken display.\n\n|cFFFFFF00-|r Added an option to ignore nicknames and always use character names.\n\n|cFFFFFF00-|r Enabling the display icon on title bar now makes the title text automatically move slightly to right.\n\n|cFFFFFF00-|r Fixed issue with skin changing when the window has the statusbar enabled.\n\n|cFFFFFF00v3.9.4 (|cFFFFCC00Feb 03, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added option 'Ignore Mass Toggle', when enabled the window won't be affected when hiding, showing or toggling all windows.\n\n|cFFFFFF00-|r Added window number for slash commands 'hide', 'show' and 'toggle'. Usage: '/details hide 1' to hide window 1.\n\n|cFFFFFF00-|r Removed keybinds for Open and Close, added toggle instead.\n\n|cFFFFFF00-|r Added slash command 'toggle'.\n\n|cFFFFFF00-|r Added display icons for all skins which still didn't have they.\n\n|cFFFFFF00-|r Improved 'Align with right chat' tool, now it also supports Forced Square skin.\n\n|cFFFFFF00-|r Improvements on Bookmark panel.\n\n|cFFFFFF00-|r Improvements on spec icons with transparency.\n\n|cFFFFFF00-|r Created custom spell for Living Bomb explosion.\n\n|cFFFFFF00-|r Fixed statusbar textures and mini displays.\n\n|cFFFFFF00-|r Fixed an issue with title bar buttons when toggling the titlebar anchor from bottom to top position.\n\n|cFFFFFF00-|r Fixed an issue with title bar text when toggling the statusbar position from bottom to top.\n\n|cFFFFFF00-|r Fixed yet another bug with avoidance tab on player detail window.\n\n|cFFFFFF00-|r Fixed the window ungroup button (above the resize one).\n\n|cFFFFFF00v3.8.13 (|cFFFFCC00Jan 26, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r RaidCheck (plugin): added an option to be able to use the report panel.\n\n|cFFFFFF00-|r You Are Not Prepared (plugin): added Auto Close the window, can be disabled through its options panel.\n\n|cFFFFFF00-|r Vanguard (plugin): Added Options Panel.\n\n|cFFFFFF00-|r Details! is now using 'LibWindow-1.1' to save and restore the positioning of the windows, bug might appear, please report if something weird happen.\n\n|cFFFFFF00-|r Improved specialization detection in order to try detect spec changes.\n\n|cFFFFFF00-|r Added options to change the brackets and the separator for dps/percent block.\n\n|cFFFFFF00-|r Added options for show (or hide) totals, dps and percent amount.\n\n|cFFFFFF00-|r Added Segments shortcut menu pressing Shift + Right click.\n\n|cFFFFFF00-|r Fixed positioning after reopen a window previously closed on last logon.\n\n|cFFFFFF00-|r Fixed enemies display where sometimes the bars were black instead of red.\n\n|cFFFFFF00-|r Fixed few places where spec icons wasn't being used on.\n\n|cFFFFFF00-|r Fixed avoidance panel on Player Details Window where sometimes was giving errors.\n\n|cFFFFFF00-|r Fixed priest shadow and holy detection.\n\n|cFFFFFF00-|r Fixed blood and unholy spec icons.\n\n|cFFFFFF00-|r Fixed an issue with 'Always Show me' feature where it was showing the player on Enemies display.\n\n|cFFFFFF00v3.8.1 (|cFFFFCC00Jan 17, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Plugin Vanguard: got full rewrite and now it is more easy to use.\n\n|cFFFFFF00-|r Plugin TimeAttack: fixed problem where sometimes required a reload to start a new time.\n\n|cFFFFFF00-|r Plugin Damage the Game!: fixed a problem where sometimes the time didn't started after level 2.\n\n|cFFFFFF00-|r Added specialization icons.\n\n|cFFFFFF00-|r Fixed Auto-Hide where it wasn't hiding the wallpaper of the window.\n\n|cFFFFFF00-|r Added 'Editing Group' check box on option panel, when enabled, settings changed also are modified on all windows in the group.\n\n|cFFFFFF00-|r Changing window's skin, doesn't change any more settings not related with appearance, for example, Auto-Hide, Switches.\n\n|cFFFFFF00-|r Custom display 'Health Potion & Stone' now also track Healing Tonic.\n\n|cFFFFFF00-|r Custom display 'Damage Taken by Spell' now tracks more spells and also melee hits.\n\n|cFFFFFF00-|r Menus now uses 'Friz Quadrata TT' font as default, also added an option to change it on options panel -> miscellaneous.\n\n|cFFFFFF00-|r 'Switch to Current' feature now switches all windows which have this option enabled.\n\n|cFFFFFF00-|r The message telling to use '/details reinstall' now only shows if a problem happen during the addon load process.\n\n|cFFFFFF00-|r Segments Saved option now can be set to 25, up from 5.\n\n|cFFFFFF00-|r Attempt to fix the bug with the monk spell 'Storm, Earth, and Fire'." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.11.2 (|cFFFFCC00Mar 16, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Boss segments now need to have at least 30 seconds to be added on the overall data.\n\n|cFFFFFF00-|r When the segment limit is reach, segments with less combat time will be erased instead of the olders.\n\n|cFFFFFF00-|r Added item level tracker.\n\n|cFFFFFF00-|r Fixed window positioning when changing from Solo mode to Group mode.\n\n|cFFFFFF00-|r Added an option for change the amount of lines on death log.\n\n|cFFFFFF00-|r Added custom display for CC done.\n\n|cFFFFFF00v3.10.10 (|cFFFFCC00Mar 10, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): done a calibration on endurance calculation.\n\n|cFFFFFF00-|r Raid Check (plugin): now also show information for 50+ stats runes.\n\n|cFFFFFF00-|r Fixed cooldowns spell targets on overall data.\n\n|cFFFFFF00-|r Fixed report custom displays where sometimes it didn't report spell links.\n\n|cFFFFFF00-|r Replaced old report line saying 'for the last X segments' with 'overall data'.\n\n|cFFFFFF00-|r Mini-displays on statusbar are now more responsible to right button click.\n\n|cFFFFFF00-|r Added Mage's Greater Invisibility as cooldown.\n\n|cFFFFFF00v3.10.8 (|cFFFFCC00Mar 02, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Improved aura creation.\n\n|cFFFFFF00-|r Custom display 'My Spells' now also show your pets.\n\n|cFFFFFF00-|r Fixed 'Raid Check' plugin food detection.\n\n|cFFFFFF00v3.10.6 (|cFFFFCC00Feb 24, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): several bug fixes and improvements.\n\n|cFFFFFF00-|r Encounter Details (plugin): added new tab showing enemy spells from the encounter with an aura creation panel.\n\n|cFFFFFF00-|r Encounter Details (plugin): added phase indicators on graphic tab, hovering over shows the damage and heal for that specific phase.\n\n|cFFFFFF00-|r Segments menu now also show the encounter try number plus the elapsed combat time.\n\n|cFFFFFF00-|r Several improvements on Overall Data, also, now it has an option to not save it when the character logoff.\n\n|cFFFFFF00-|r Player Details window now closes with right click on any bar.\n\n|cFFFFFF00-|r Fixed Nature's Vigil cooldown.\n\n|cFFFFFF00v3.9.12a (|cFFFFCC00Feb 16, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Roll back on combat detection after reset data, might be causing problems.\n\n|cFFFFFF00v3.9.12 (|cFFFFCC00Feb 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): got report buttons for Endurance and Deaths Overall Damage.\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): the Deaths and Endurance limits can now be changed under the plugin options.\n\n|cFFFFFF00-|r Chart Viewer (plugin): has been revamped and now it's less complicated to use.\n\n|cFFFFFF00-|r Time Line (plugin): added options to change the background color and scale.\n\n|cFFFFFF00-|r Raid Check (plugin): its window is now 'always on top'.\n\n|cFFFFFF00-|r Accuracy adjustments on overheal of Divine Aegis and Illuminated Healing.\n\n|cFFFFFF00-|r Removed healthstone from cooldown list, added Nature's Vigil.\n\n|cFFFFFF00-|r Enemies display now shows damage taken instead of damage done.\n\n|cFFFFFF00-|r Tooltip for enemies display now also show damage and healing done by the enemy.\n\n|cFFFFFF00-|r Added an option under miscellaneous to show neutral and hostile creatures on damage taken display.\n\n|cFFFFFF00-|r Added an option to ignore nicknames and always use character names.\n\n|cFFFFFF00-|r Enabling the display icon on title bar now makes the title text automatically move slightly to right.\n\n|cFFFFFF00-|r Fixed issue with skin changing when the window has the statusbar enabled.\n\n|cFFFFFF00v3.9.4 (|cFFFFCC00Feb 03, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added option 'Ignore Mass Toggle', when enabled the window won't be affected when hiding, showing or toggling all windows.\n\n|cFFFFFF00-|r Added window number for slash commands 'hide', 'show' and 'toggle'. Usage: '/details hide 1' to hide window 1.\n\n|cFFFFFF00-|r Removed keybinds for Open and Close, added toggle instead.\n\n|cFFFFFF00-|r Added slash command 'toggle'.\n\n|cFFFFFF00-|r Added display icons for all skins which still didn't have they.\n\n|cFFFFFF00-|r Improved 'Align with right chat' tool, now it also supports Forced Square skin.\n\n|cFFFFFF00-|r Improvements on Bookmark panel.\n\n|cFFFFFF00-|r Improvements on spec icons with transparency.\n\n|cFFFFFF00-|r Created custom spell for Living Bomb explosion.\n\n|cFFFFFF00-|r Fixed statusbar textures and mini displays.\n\n|cFFFFFF00-|r Fixed an issue with title bar buttons when toggling the titlebar anchor from bottom to top position.\n\n|cFFFFFF00-|r Fixed an issue with title bar text when toggling the statusbar position from bottom to top.\n\n|cFFFFFF00-|r Fixed yet another bug with avoidance tab on player detail window.\n\n|cFFFFFF00-|r Fixed the window ungroup button (above the resize one).\n\n|cFFFFFF00v3.8.13 (|cFFFFCC00Jan 26, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r RaidCheck (plugin): added an option to be able to use the report panel.\n\n|cFFFFFF00-|r You Are Not Prepared (plugin): added Auto Close the window, can be disabled through its options panel.\n\n|cFFFFFF00-|r Vanguard (plugin): Added Options Panel.\n\n|cFFFFFF00-|r Details! is now using 'LibWindow-1.1' to save and restore the positioning of the windows, bug might appear, please report if something weird happen.\n\n|cFFFFFF00-|r Improved specialization detection in order to try detect spec changes.\n\n|cFFFFFF00-|r Added options to change the brackets and the separator for dps/percent block.\n\n|cFFFFFF00-|r Added options for show (or hide) totals, dps and percent amount.\n\n|cFFFFFF00-|r Added Segments shortcut menu pressing Shift + Right click.\n\n|cFFFFFF00-|r Fixed positioning after reopen a window previously closed on last logon.\n\n|cFFFFFF00-|r Fixed enemies display where sometimes the bars were black instead of red.\n\n|cFFFFFF00-|r Fixed few places where spec icons wasn't being used on.\n\n|cFFFFFF00-|r Fixed avoidance panel on Player Details Window where sometimes was giving errors.\n\n|cFFFFFF00-|r Fixed priest shadow and holy detection.\n\n|cFFFFFF00-|r Fixed blood and unholy spec icons.\n\n|cFFFFFF00-|r Fixed an issue with 'Always Show me' feature where it was showing the player on Enemies display.\n\n|cFFFFFF00v3.8.1 (|cFFFFCC00Jan 17, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Plugin Vanguard: got full rewrite and now it is more easy to use." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " @@ -290,6 +294,7 @@ do SharedMedia:Register ("background", "Details Ground", [[Interface\AddOns\Details\images\background]]) SharedMedia:Register ("border", "Details BarBorder 1", [[Interface\AddOns\Details\images\border_1]]) SharedMedia:Register ("border", "Details BarBorder 2", [[Interface\AddOns\Details\images\border_2]]) + SharedMedia:Register ("border", "Details BarBorder 3", [[Interface\AddOns\Details\images\border_3]]) --misc fonts SharedMedia:Register ("font", "Oswald", [[Interface\Addons\Details\fonts\Oswald-Regular.otf]]) SharedMedia:Register ("font", "Nueva Std Cond", [[Interface\Addons\Details\fonts\NuevaStd-Cond.otf]]) diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index adece333..69bcc7ec 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -2387,7 +2387,7 @@ function _detalhes:MontaAtributosOption (instancia, func) --> custom --GameCooltip:AddLine ("$div") - CoolTip:AddLine ("$div", nil, 1, -2, 1) + CoolTip:AddLine ("$div", nil, 1, -3, 1) CoolTip:AddMenu (1, func, nil, 5, nil, atributos.lista[5], nil, true) CoolTip:AddIcon ("Interface\\AddOns\\Details\\images\\atributos_icones", 1, 1, 20, 20, p*(5-1), p*(5), 0, 1) diff --git a/classes/container_historico.lua b/classes/container_historico.lua index d9c099bc..efe6673a 100644 --- a/classes/container_historico.lua +++ b/classes/container_historico.lua @@ -88,6 +88,7 @@ function historico:adicionar (tabela) end --> adiciona no index #1 + _table_insert (self.tabelas, 1, tabela) --_detalhes.encounter_counter @@ -157,16 +158,20 @@ function historico:adicionar (tabela) end if (overall_added) then - if (_detalhes.debug) then - _detalhes:Msg ("(debug) overall data flag match with the current combat.") - end - if (InCombatLockdown()) then - _detalhes.schedule_add_to_overall = true - if (_detalhes.debug) then - _detalhes:Msg ("(debug) player is in combat, scheduling overall addition.") - end + if (tabela.is_boss and tabela:GetCombatTime() < 30) then + _detalhes:Msg ("segment not added to overall (less than 30 seconds of combat time).") else - historico:adicionar_overall (tabela) + if (_detalhes.debug) then + _detalhes:Msg ("(debug) overall data flag match with the current combat.") + end + if (InCombatLockdown()) then + _detalhes.schedule_add_to_overall = true + if (_detalhes.debug) then + _detalhes:Msg ("(debug) player is in combat, scheduling overall addition.") + end + else + historico:adicionar_overall (tabela) + end end end @@ -232,13 +237,39 @@ function historico:adicionar (tabela) --> verifica se precisa apagar a última tabela do histórico if (#self.tabelas > _detalhes.segments_amount) then - local combat_removed = self.tabelas [#self.tabelas] - - --> diminuir quantidades no overall - --if (combat_removed.overall_added) then - -- _detalhes.tabela_overall = _detalhes.tabela_overall - combat_removed - -- print ("removendo combate 2") - --end + local combat_removed, combat_index + + --> verifica se estão dando try em um boss e remove o combate menos relevante + local bossid = tabela.is_boss and tabela.is_boss.id + + local last_segment = self.tabelas [#self.tabelas] + local last_bossid = last_segment.is_boss and last_segment.is_boss.id + + if (_detalhes.zone_type == "raid" and bossid and last_bossid and bossid == last_bossid) then + + local shorter_combat + local shorter_id + local min_time = 99999 + + for i = 4, #self.tabelas do + local combat = self.tabelas [i] + if (combat.is_boss and combat.is_boss.id == bossid and combat:GetCombatTime() < min_time and not combat.is_boss.killed) then + shorter_combat = combat + shorter_id = i + min_time = combat:GetCombatTime() + end + end + + if (shorter_combat) then + combat_removed = shorter_combat + combat_index = shorter_id + end + end + + if (not combat_removed) then + combat_removed = self.tabelas [#self.tabelas] + combat_index = #self.tabelas + end --> verificar novamente a time machine for _, jogador in ipairs (combat_removed [1]._ActorTable) do --> damage @@ -253,8 +284,8 @@ function historico:adicionar (tabela) end --> remover - _table_remove (self.tabelas, #self.tabelas) - _detalhes:SendEvent ("DETAILS_DATA_SEGMENTREMOVED", nil, nil) + _table_remove (self.tabelas, combat_index) + _detalhes:SendEvent ("DETAILS_DATA_SEGMENTREMOVED") end diff --git a/core/control.lua b/core/control.lua index d0d2d0c3..d764ef0d 100644 --- a/core/control.lua +++ b/core/control.lua @@ -455,6 +455,9 @@ --> add to storage if (not InCombatLockdown() and not UnitAffectingCombat ("player") and not _detalhes.logoff_saving_data) then + + --_detalhes.StoreEncounter() + local successful, errortext = pcall (_detalhes.StoreEncounter) if (not successful) then _detalhes:Msg ("error occurred on StoreEncounter():", errortext) diff --git a/core/gears.lua b/core/gears.lua index 984558d4..5c0f3f2f 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -2,6 +2,8 @@ local _detalhes = _G._detalhes local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) local UnitName = UnitName +local UnitGUID = UnitGUID +local UnitGroupRolesAssigned = UnitGroupRolesAssigned local select = select local floor = floor @@ -293,6 +295,11 @@ function _detalhes:GetPerformanceRaidType() return nil end + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> background tasks + + local background_tasks = {} local task_timers = { ["LOW"] = 30, @@ -354,6 +361,10 @@ end _detalhes.background_tasks_loop = _detalhes:ScheduleRepeatingTimer ("DoBackgroundTasks", 120) + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> storage stuff + local store_instances = { [1205] = true, --Blackrock Foundry [1228] = true, --Highmaul @@ -384,181 +395,8 @@ function _detalhes:StoreEncounter (combat) local diff = combat:GetDifficulty() --> check for heroic mode - if (diff == 5 or diff == 6 or diff == 15) then --test on raid finder or diff == 7 or diff == 17 - - local role = UnitGroupRolesAssigned ("player") - if (role ~= "DAMAGER" and role ~= "HEALER") then - return - end - - --> check if the storage is already loaded - if (not IsAddOnLoaded ("Details_DataStorage")) then - local loaded, reason = LoadAddOn ("Details_DataStorage") - if (not loaded) then - return - end - end - - --> get the storage table - local db = DetailsDataStorage - - if (not db and _detalhes.CreateStorageDB) then - db = _detalhes:CreateStorageDB() - if (not db) then - return - end - elseif (not db) then - return - end - - local self_database = db.SELF_STORAGE - - if (not self_database) then - --> outdate database? - return - end - - local heroic_branch = self_database ["HEROIC"] - if (not heroic_branch) then - heroic_branch = {} - self_database ["HEROIC"] = heroic_branch - end - - --> heroic database: numeric table with combats - local encounter_database = heroic_branch [encounter_id] - - if (not encounter_database) then - heroic_branch [encounter_id] = {} - encounter_database = heroic_branch [encounter_id] - end - - --> get player data - local t = { - total = 0, - spells = {}, - } - - if (role == "DAMAGER") then - - local player = combat (1, _detalhes.playername) - - if (player) then - t.total = player.total - for spellid, spell in pairs (player.spells._ActorTable) do - t.spells [spellid] = spell.total - end - end - - elseif (role == "HEALER") then - local player = combat (2, _detalhes.playername) - if (player) then - t.total = player.total - for spellid, spell in pairs (player.spells._ActorTable) do - t.spells [spellid] = spell.total - end - end - end + if (diff == 14 or diff == 15 or diff == 16) then --test on raid finder ' or diff == 17' - if (t.total > 0) then - local this_combat_data = { - total = t.total, - spells = t.spells, - date = date ("%H:%M %d/%m/%y"), - time = time(), - elapsed = combat:GetCombatTime(), - } - tinsert (encounter_database, this_combat_data) - end - - --> check for normal mode - elseif (diff == 3 or diff == 4 or diff == 14) then - - local role = UnitGroupRolesAssigned ("player") - if (role ~= "DAMAGER" and role ~= "HEALER") then - return - end - - --> check if the storage is already loaded - if (not IsAddOnLoaded ("Details_DataStorage")) then - local loaded, reason = LoadAddOn ("Details_DataStorage") - if (not loaded) then - return - end - end - - --> get the storage table - local db = DetailsDataStorage - - if (not db and _detalhes.CreateStorageDB) then - db = _detalhes:CreateStorageDB() - if (not db) then - return - end - elseif (not db) then - return - end - - local self_database = db.SELF_STORAGE - - if (not self_database) then - --> outdate database? - return - end - - local normal_branch = self_database ["NORMAL"] - if (not normal_branch) then - normal_branch = {} - self_database ["NORMAL"] = normal_branch - end - - --> heroic database: numeric table with combats - local encounter_database = normal_branch [encounter_id] - - if (not encounter_database) then - normal_branch [encounter_id] = {} - encounter_database = normal_branch [encounter_id] - end - - --> get player data - local t = { - total = 0, - spells = {}, - role = role, - } - - if (role == "DAMAGER") then - local player = combat (1, _detalhes.playername) - if (player) then - t.total = player.total - for spellid, spell in pairs (player.spells._ActorTable) do - t.spells [spellid] = spell.total - end - end - - elseif (role == "HEALER") then - local player = combat (2, _detalhes.playername) - if (player) then - t.total = player.total - for spellid, spell in pairs (player.spells._ActorTable) do - t.spells [spellid] = spell.total - end - end - end - - if (t.total > 0) then - local this_combat_data = { - total = t.total, - spells = t.spells, - date = date ("%H:%M %d/%m/%y"), - time = time(), - elapsed = combat:GetCombatTime(), - } - tinsert (encounter_database, this_combat_data) - end - - --> check if is a mythic encounter and store the mythic encounter - elseif (difficulty == 16) then - --> check the guild name local match = 0 local guildName = select (1, GetGuildInfo ("player")) @@ -578,7 +416,7 @@ function _detalhes:StoreEncounter (combat) else return end - + --> check if the storage is already loaded if (not IsAddOnLoaded ("Details_DataStorage")) then local loaded, reason = LoadAddOn ("Details_DataStorage") @@ -586,7 +424,7 @@ function _detalhes:StoreEncounter (combat) return end end - + --> get the storage table local db = DetailsDataStorage @@ -598,49 +436,276 @@ function _detalhes:StoreEncounter (combat) elseif (not db) then return end - - local raid_database = db.RAID_STORAGE - if (not raid_database) then - db.RAID_STORAGE = {} - raid_database = db.RAID_STORAGE + local diff_storage = db [diff] + if (not diff_storage) then + db [diff] = {} + diff_storage = db [diff] end - --> encounter_database: numeric table with combats - local encounter_database = raid_database [encounter_id] - + local encounter_database = diff_storage [encounter_id] if (not encounter_database) then - raid_database [encounter_id] = {} - encounter_database = raid_database [encounter_id] + diff_storage [encounter_id] = {} + encounter_database = diff_storage [encounter_id] end - --> get raid members data local this_combat_data = { damage = {}, - heal = {}, + healing = {}, date = date ("%H:%M %d/%m/%y"), time = time(), elapsed = combat:GetCombatTime(), guild = guildName, } + + local damage_container_hash = combat [1]._NameIndexTable + local damage_container_pool = combat [1]._ActorTable - for i = 1, raid_size do - local player_name, player_realm = UnitName ("raid" .. i) - if (player_realm and player_realm ~= "") then - player_name = player_name .. "-" .. player_realm + local healing_container_hash = combat [2]._NameIndexTable + local healing_container_pool = combat [2]._ActorTable + + for i = 1, GetNumGroupMembers() do + + local role = UnitGroupRolesAssigned ("raid" .. i) + + if (role == "DAMAGER") then + local player_name, player_realm = UnitName ("raid" .. i) + if (player_realm and player_realm ~= "") then + player_name = player_name .. "-" .. player_realm + end + + local damage_actor = damage_container_pool [damage_container_hash [player_name]] + if (damage_actor) then + local guid = UnitGUID (player_name) or UnitGUID (UnitName ("raid" .. i)) + this_combat_data.damage [player_name] = {floor (damage_actor.total), _detalhes.item_level_pool [guid] or 0} + end + elseif (role == "HEALER") then + local player_name, player_realm = UnitName ("raid" .. i) + if (player_realm and player_realm ~= "") then + player_name = player_name .. "-" .. player_realm + end + + local heal_actor = healing_container_pool [healing_container_hash [player_name]] + if (heal_actor) then + local guid = UnitGUID (player_name) or UnitGUID (UnitName ("raid" .. i)) + this_combat_data.healing [player_name] = {floor (heal_actor.total), _detalhes.item_level_pool [guid] or 0} + end end - local damage_actor = combat (1, player_name) - if (damage_actor) then - this_combat_data.damage [player_name] = floor (damage_actor.total) - end - - local heal_actor = combat (2, player_name) - if (heal_actor) then - this_combat_data.heal [player_name] = floor (heal_actor.total) - end end tinsert (encounter_database, this_combat_data) + + print ("|cFFFFFF00Details! Storage|r: encounter saved!") + end +end + +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> inspect stuff + +local ilvl_core = _detalhes:CreateEventListener() + +ilvl_core:RegisterEvent ("GROUP_ONENTER", "OnEnter") +ilvl_core:RegisterEvent ("GROUP_ONLEAVE", "OnLeave") +ilvl_core:RegisterEvent ("COMBAT_PLAYER_ENTER", "EnterCombat") +ilvl_core:RegisterEvent ("COMBAT_PLAYER_LEAVE", "LeaveCombat") +ilvl_core:RegisterEvent ("ZONE_TYPE_CHANGED", "ZoneChanged") + +local inspecting = {} +local inspect_frame = CreateFrame ("frame") + +local check_inspect_queue = function() + for spellid, timeout_id in pairs (inspecting) do + return + end + + inspect_frame:UnregisterEvent ("INSPECT_READY") +end + +local inspect_amout = function() + local i = 0 + for spellid, timeout_id in pairs (inspecting) do + i = i + 1 + end + return i +end + +function _detalhes:IlvlFromNetwork (player, realm, core, ilvl) + local guid = UnitGUID (player .. "-" .. realm) + if (not guid) then + guid = UnitGUID (player) + if (not guid) then + return + end + end + + _detalhes.item_level_pool [guid] = {name = player, ilvl = ilvl, time = time()} +end + +inspect_frame:SetScript ("OnEvent", function (self, event, ...) + local guid, unitid, arg3 = select (1, ...) + + if (inspecting [guid]) then + local unitid, cancel_tread = inspecting [guid] [1], inspecting [guid] [2] + inspecting [guid] = nil + + ilvl_core:CancelTimer (cancel_tread) + + --> do inspect stuff + if (unitid) then + if (CheckInteractDistance (unitid, 1)) then + local item_amount = 0 + local item_level = 0 + + for equip_id = 1, 17 do + if (equip_id ~= 4) then --shirt slot + local item = GetInventoryItemLink (unitid, equip_id) + if (item) then + local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo (item) + if (iLevel) then + item_amount = item_amount + 1 + item_level = item_level + iLevel + end + end + end + end + + local average = item_level / item_amount + + -- register + if (average > 0) then + _detalhes.item_level_pool [guid] = {name = UnitName (unitid), ilvl = average, time = time()} + end + end + end + + --> check queue + check_inspect_queue() + end +end) + +function ilvl_core:InspectTimeOut (guid) + inspecting [guid] = nil + check_inspect_queue() +end + +function ilvl_core:GetItemLevel (unitid, guid) + --> double check + if (UnitAffectingCombat ("player") or InCombatLockdown()) then + return + end + if (not unitid or not CanInspect (unitid) or not CheckInteractDistance (unitid, 1)) then + return + end + + inspect_frame:RegisterEvent ("INSPECT_READY") + inspecting [guid] = {unitid, ilvl_core:ScheduleTimer ("InspectTimeOut", 12, guid)} + + NotifyInspect (unitid) +end + +function ilvl_core:Reset() + ilvl_core.raid_id = 1 +end + +function ilvl_core:Loop() + if (inspect_amout() > 1) then + return + end + + local members_amt = GetNumGroupMembers() + if (ilvl_core.raid_id > members_amt) then + ilvl_core.raid_id = 1 + end + + local unitid = "raid" .. ilvl_core.raid_id + + local guid = UnitGUID (unitid) + if (not guid) then + ilvl_core.raid_id = ilvl_core.raid_id + 1 + return + end + + if (inspecting [guid]) then + return + end + + local ilvl_table = _detalhes.ilevel:GetIlvl (guid) + if (ilvl_table and ilvl_table.time + 3600 > time()) then + ilvl_core.raid_id = ilvl_core.raid_id + 1 + return + end + + ilvl_core:GetItemLevel (unitid, guid) + ilvl_core.raid_id = ilvl_core.raid_id + 1 +end + +function ilvl_core:EnterCombat() + if (ilvl_core.loop_process) then + ilvl_core:CancelTimer (ilvl_core.loop_process) + ilvl_core.loop_process = nil + end +end + +local can_start_loop = function() + if (_detalhes:GetZoneType() ~= "raid" or ilvl_core.loop_process or _detalhes.in_combat) then + return false + end + return true +end + +function ilvl_core:LeaveCombat() + if (can_start_loop()) then + ilvl_core:Reset() + ilvl_core.loop_process = ilvl_core:ScheduleRepeatingTimer ("Loop", 2) + end +end + +function ilvl_core:ZoneChanged (zone_type) + if (can_start_loop()) then + ilvl_core:Reset() + ilvl_core.loop_process = ilvl_core:ScheduleRepeatingTimer ("Loop", 2) + end +end + +function ilvl_core:OnEnter() + if (IsInRaid()) then + _detalhes:SentMyItemLevel() + end + + if (can_start_loop()) then + ilvl_core:Reset() + ilvl_core.loop_process = ilvl_core:ScheduleRepeatingTimer ("Loop", 2) + end +end + +function ilvl_core:OnLeave() + if (ilvl_core.loop_process) then + ilvl_core:CancelTimer (ilvl_core.loop_process) + ilvl_core.loop_process = nil + end +end + +--> ilvl API +_detalhes.ilevel = {} + +function _detalhes.ilevel:GetPool() + return _detalhes.item_level_pool +end + +function _detalhes.ilevel:GetIlvl (guid) + return _detalhes.item_level_pool [guid] +end + +function _detalhes.ilevel:GetInOrder() + local order = {} + + for guid, t in pairs (_detalhes.item_level_pool) do + order [#order+1] = {t.name, t.ilvl, t.time} + end + + table.sort (order, _detalhes.Sort2) + + return order end \ No newline at end of file diff --git a/core/network.lua b/core/network.lua index b9fdfaba..2cc90857 100644 --- a/core/network.lua +++ b/core/network.lua @@ -29,6 +29,8 @@ local CONST_VERSION_CHECK = "CV" + local CONST_ITEMLEVEL_DATA = "IL" + local CONST_CLOUD_REQUEST = "CR" local CONST_CLOUD_FOUND = "CF" local CONST_CLOUD_DATARQ = "CD" @@ -39,6 +41,7 @@ ["HIGHFIVE_REQUEST"] = CONST_HIGHFIVE_REQUEST, ["HIGHFIVE_DATA"] = CONST_HIGHFIVE_DATA, ["VERSION_CHECK"] = CONST_VERSION_CHECK, + ["ITEMLEVEL_DATA"] = CONST_ITEMLEVEL_DATA, ["CLOUD_REQUEST"] = CONST_CLOUD_REQUEST, ["CLOUD_FOUND"] = CONST_CLOUD_FOUND, ["CLOUD_DATARQ"] = CONST_CLOUD_DATARQ, @@ -245,6 +248,7 @@ [CONST_HIGHFIVE_REQUEST] = _detalhes.network.HighFive_Request, [CONST_HIGHFIVE_DATA] = _detalhes.network.HighFive_DataReceived, [CONST_VERSION_CHECK] = _detalhes.network.Update_VersionReceived, + [CONST_ITEMLEVEL_DATA] = _detalhes.network.ItemLevel_Received, [CONST_CLOUD_REQUEST] = _detalhes.network.Cloud_Request, [CONST_CLOUD_FOUND] = _detalhes.network.Cloud_Found, @@ -453,6 +457,17 @@ end end end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> item level + function _detalhes:SentMyItemLevel() + local overall, equipped = GetAverageItemLevel() + _detalhes:SendRaidData (CONST_ITEMLEVEL_DATA, overall) + end + + function _detalhes.network.ItemLevel_Received (player, realm, core_version, itemlevel) + _detalhes:IlvlFromNetwork (player, realm, core_version, itemlevel) + end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> update diff --git a/core/parser.lua b/core/parser.lua index 3e9e0c68..9d198193 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -2606,7 +2606,13 @@ return _detalhes.zone_type end function _detalhes.parser_functions:ZONE_CHANGED_NEW_AREA (...) + local zoneName, zoneType, _, _, _, _, _, zoneMapID = _GetInstanceInfo() + + _detalhes.zone_type = zoneType + _detalhes.zone_id = zoneMapID + _detalhes.zone_name = zoneName + if (_detalhes.last_zone_type ~= zoneType) then _detalhes:SendEvent ("ZONE_TYPE_CHANGED", nil, zoneType) _detalhes.last_zone_type = zoneType @@ -2614,10 +2620,6 @@ _detalhes:CheckChatOnZoneChange (zoneType) - _detalhes.zone_type = zoneType - _detalhes.zone_id = zoneMapID - _detalhes.zone_name = zoneName - if (_detalhes.debug) then _detalhes:Msg ("(debug) zone change:", _detalhes.zone_name, "is a", _detalhes.zone_type, "zone.") end @@ -2859,6 +2861,7 @@ if (_detalhes.schedule_store_boss_encounter) then if (not _detalhes.logoff_saving_data) then + --_detalhes.StoreEncounter() local successful, errortext = pcall (_detalhes.StoreEncounter) if (not successful) then _detalhes:Msg ("error occurred on StoreEncounter():", errortext) diff --git a/core/windows.lua b/core/windows.lua index 6fb71b0b..19c73668 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -388,7 +388,9 @@ return _detalhes:ScheduleTimer ("SaveMainWindowPosition", 1, self) end - self:SaveLibWindow() + if (self.mostrando ~= "solo") then + self:SaveLibWindow() + end --> save the position local _w = baseframe_width diff --git a/functions/profiles.lua b/functions/profiles.lua index 93704248..e991632d 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -943,9 +943,9 @@ local default_profile = { anchor_relative = "top", anchor_offset = {0, 0}, - border_texture = "Blizzard Tooltip", - border_color = {1, 1, 1, 1}, - border_size = 16, + border_texture = "Details BarBorder 3", + border_color = {0.76, 0.76, 0.76, 1}, + border_size = 14, }, } @@ -1054,6 +1054,8 @@ local default_global_data = { }, --> auras details_auras = {}, + --> ilvl + item_level_pool = {}, } _detalhes.default_global_data = default_global_data diff --git a/functions/slash.lua b/functions/slash.lua index a7c145e5..830e8d6d 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -935,7 +935,27 @@ function SlashCmdList.DETAILS (msg, editbox) local _, _, flags = barra.texto_esquerdo:GetFont() print ("outline:",flags) end + + elseif (msg == "ilvl") then + local item_amount = 0 + local item_level = 0 + for equip_id = 1, 17 do + if (equip_id ~= 4) then --shirt slot + local item = GetInventoryItemLink ("player", equip_id) + if (item) then + local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo (item) + if (iLevel) then + item_amount = item_amount + 1 + item_level = item_level + iLevel + end + end + end + end + + local average = item_level / item_amount + print ("your item lvl:", average) + else --if (_detalhes.opened_windows < 1) then diff --git a/images/border_3.tga b/images/border_3.tga new file mode 100644 index 0000000000000000000000000000000000000000..12b93f504c727f3efd8b03b72cf748163f895747 GIT binary patch literal 1809 zcmZQz;9`J*1_l8J1&&4#7et6M%$PCb|5UInhy@mF263CfvL8Nt_&)`UEJW{u1q+~h zK`gM?LXct*Ye*Uo_W5j}<3-_Kpp8H1YY{kRz%e~-0W6Z~;X#DGkQ6p*IbG7#un+d> zKYsi`DynGgUvPN<&ak5v0gFZ=tBJ+f>Hz8$07MuMasUW~1ckbWc?Ns>`{_owdHT5O GF#rIq< do revisions - if (DetailsDataStorage.VERSION == 1) then - DetailsDataStorage.SELF_STORAGE = {} - DetailsDataStorage.VERSION = 2 + if (DetailsDataStorage.VERSION < 3) then + table.wipe (DetailsDataStorage) + DetailsDataStorage = _detalhes:CreateStorageDB() end end + print ("|cFFFFFF00Details! Storage|r: loaded!") DETAILS_STORAGE_LOADED = true + end end) diff --git a/startup.lua b/startup.lua index 37bac9f3..ad0ffd6b 100644 --- a/startup.lua +++ b/startup.lua @@ -347,6 +347,25 @@ function _G._detalhes:Start() _detalhes:AddDefaultCustomDisplays() --> Reset for the new structure + if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 64 and enable_reset_warning) then + function _detalhes:ResetDataStorage() + if (not IsAddOnLoaded ("Details_DataStorage")) then + local loaded, reason = LoadAddOn ("Details_DataStorage") + if (not loaded) then + return + end + end + + local db = DetailsDataStorage + if (db) then + table.wipe (db) + end + + DetailsDataStorage = _detalhes:CreateStorageDB() + end + _detalhes:ScheduleTimer ("ResetDataStorage", 1) + end + if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 47 and enable_reset_warning) then for i = #_detalhes.custom, 1, -1 do _detalhes.atributo_custom:RemoveCustom (i)