From 557a25305af3fede4269936e9ba9d846a95de9a5 Mon Sep 17 00:00:00 2001 From: Tercio Date: Wed, 3 Jun 2015 19:58:52 -0300 Subject: [PATCH] - added extra tooltip for the icon on player's bar. --- boot.lua | 27 ++++-- classes/classe_custom.lua | 1 + core/control.lua | 11 ++- core/gears.lua | 118 +++++++++++++++++++++-- functions/profiles.lua | 6 ++ functions/savedata.lua | 3 + gumps/janela_news.lua | 2 +- gumps/janela_principal.lua | 186 ++++++++++++++++++++++++++++++++++++- startup.lua | 12 ++- 9 files changed, 342 insertions(+), 24 deletions(-) diff --git a/boot.lua b/boot.lua index e95ab235..63471690 100644 --- a/boot.lua +++ b/boot.lua @@ -4,7 +4,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") _detalhes.build_counter = 996 --it's 996 for release - _detalhes.userversion = "v3.15.1a" + _detalhes.userversion = "v3.15.2" _detalhes.realversion = 69 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" Details = _detalhes @@ -21,7 +21,8 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ -|cFFFFFF00v3.15.1 (|cFFFFCC00May 30, 2015|r|cFFFFFF00)|r:\n\n +|cFFFFFF00v3.15.2 (|cFFFFCC00Jun 03, 2015|r|cFFFFFF00)|r:\n\n +|cFFFFFF00-|r Added an extra tooltip for the class icon at the player's bar.\n\n |cFFFFFF00-|r Activity time now has only 3 seconds inactivity tolerance on battlegrounds and arenas.\n\n |cFFFFFF00-|r Effective time will automatically be used when inside a battleground and using sync from the score board.\n\n |cFFFFFF00-|r Added 'hide all' option on the minimap menu.\n\n @@ -35,7 +36,7 @@ do -- - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.15.1 (|cFFFFCC00May 30, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Activity time now has only 3 seconds inactivity tolerance on battlegrounds and arenas.\n\n|cFFFFFF00-|r Effective time will automatically be used when inside a battleground and using sync from the score board.\n\n|cFFFFFF00-|r Added 'hide all' option on the minimap menu.\n\n|cFFFFFF00-|r Added support for battlegrounds.\n\n|cFFFFFF00-|r Added option for disable showing battleground enemies when the window is in group mode.\n\n|cFFFFFF00-|r Added option to disable the sync from battleground score board.\n\n|cFFFFFF00-|r Enemies from a battleground match segment won't be erased when the player logout.\n\n|cFFFFFF00v3.14.4 (|cFFFFCC00May 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r TimeLine (plugin): now also shows marks symbolizing the player death.\n\n|cFFFFFF00-|r Added raid history panel. Open it through bookmark or /details history.\n\n|cFFFFFF00-|r Added support for skins for Player Detail Window.\n\n|cFFFFFF00-|r Added report history on report button.\n\n|cFFFFFF00-|r Added key bindings settings for report what is shown on window #1 or #2.\n\n|cFFFFFF00v3.14.0b (|cFFFFCC00May 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Several texture changes for a smaller download size.\n\n|cFFFFFF00v3.13.4a (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Created 'Details! Forge' but is still under development: /details forge.\n\n|cFFFFFF00-|r Several improvements on combatlog reader and custom displays.\n\n|cFFFFFF00-|r Improvements on enemies damage taken tooltip.\n\n|cFFFFFF00v3.13.1 (|cFFFFCC00April 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added casted amount for healing and damage spells. The result is shown on Player Detail Window and Comparison Panel.\n\n|cFFFFFF00-|r Added uptime amount for healing spells on Player Detail Window.\n\n|cFFFFFF00-|r Added an option to disable lock/resize/ungroup buttons. It's under miscellaneous bracket on Options Panel.\n\n|cFFFFFF00-|r Wallpaper for menus on title bar got a customization option under tooltips bracket on Options Panel.\n\n|cFFFFFF00-|r Updated spell list for Crowd Control and class detection.\n\n|cFFFFFF00-|r Improved Weakaura creation tool under Encounter Details Plugin.\n\n|cFFFFFF00v3.12.10 (|cFFFFCC00April 18, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added the spell uptime on damage player detail window.\n\n|cFFFFFF00-|r Added Rune Tap as cooldown.\n\n|cFFFFFF00-|r Report lines for deaths is now inverted. No need to scroll up the chat to see the cause of death anymore.\n\n|cFFFFFF00-|r Fixed some annoyances with auto current feature where it was changing the segments even when the user were using the window.\n\n|cFFFFFF00v3.12.7 (|cFFFFCC00April 09, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added slash command /details profile .\n\n|cFFFFFF00v3.12.6 (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): added a report button on Emotes tab.\n\n|cFFFFFF00-|r Encounter Details (plugin): improved Weakauras creation.\n\n|cFFFFFF00-|r Encounter Details (plugin): fixed the report text for interrupts and dispells.\n\n|cFFFFFF00-|r Crowd control by Pets now is merged with its owner.\n\n|cFFFFFF00-|r Truncated left text on bars now shows the entire text when hover over the bar.\n\n|cFFFFFF00-|r Added an extra option on minimap menu to disable the minimap icon.\n\n|cFFFFFF00-|r Fixed a problem when disabling the minimap icon through options panel.\n\n|cFFFFFF00-|r Fixed an issue with item level tracker feature.\n\n|cFFFFFF00v3.12.2 (|cFFFFCC00Mar 30, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Raid Check (plugin): added item level.\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): bug fixes, it's important to update it.\n\n|cFFFFFF00-|r Time Line (plugin): bug fixes.\n\n|cFFFFFF00-|r Added option to disabled th eitem level tracker.\n\n|cFFFFFF00-|r Added item level on Raid Check plugin panel.\n\n|cFFFFFF00-|r Added Spirit Link Totem damage and healing on death log.\n\n|cFFFFFF00-|r Added the total of life exchanged by the Spirit Link Totem on player detail window.\n\n|cFFFFFF00-|r Added more spells for crowd control.\n\n|cFFFFFF00-|r Added scroll on bookmark panel.\n\n|cFFFFFF00-|r Fixed issue with Dps/Hps data broker which wasn't respecting the type of time (effective/activity) selected.\n\n|cFFFFFF00-|r Fixed few bugs when using the key bind to toggle windows.\n\n|cFFFFFF00v3.11.5 (|cFFFFCC00Mar 18, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with overall data where max/min amount for spells was being calculated wrong.\n\n|cFFFFFF00-|r Fixed a problem while reporting enemy damage taken.\n\n|cFFFFFF00-|r Fixed an issue with damage taken by spell where some spells wasn't shown.\n\n|cFFFFFF00-|r Few improvements on tooltips.\n\n|cFFFFFF00-|r Fixed a accuracy problem with shaman's spirit link toten where its life exchange was considered healing done.\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." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v3.15.2 (|cFFFFCC00Jun 03, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added an extra tooltip for the class icon at the player's bar.\n\n|cFFFFFF00-|r Activity time now has only 3 seconds inactivity tolerance on battlegrounds and arenas.\n\n|cFFFFFF00-|r Effective time will automatically be used when inside a battleground and using sync from the score board.\n\n|cFFFFFF00-|r Added 'hide all' option on the minimap menu.\n\n|cFFFFFF00-|r Added support for battlegrounds.\n\n|cFFFFFF00-|r Added option for disable showing battleground enemies when the window is in group mode.\n\n|cFFFFFF00-|r Added option to disable the sync from battleground score board.\n\n|cFFFFFF00-|r Enemies from a battleground match segment won't be erased when the player logout.\n\n|cFFFFFF00v3.14.4 (|cFFFFCC00May 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r TimeLine (plugin): now also shows marks symbolizing the player death.\n\n|cFFFFFF00-|r Added raid history panel. Open it through bookmark or /details history.\n\n|cFFFFFF00-|r Added support for skins for Player Detail Window.\n\n|cFFFFFF00-|r Added report history on report button.\n\n|cFFFFFF00-|r Added key bindings settings for report what is shown on window #1 or #2.\n\n|cFFFFFF00v3.14.0b (|cFFFFCC00May 13, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Several texture changes for a smaller download size.\n\n|cFFFFFF00v3.13.4a (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Created 'Details! Forge' but is still under development: /details forge.\n\n|cFFFFFF00-|r Several improvements on combatlog reader and custom displays.\n\n|cFFFFFF00-|r Improvements on enemies damage taken tooltip.\n\n|cFFFFFF00v3.13.1 (|cFFFFCC00April 27, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added casted amount for healing and damage spells. The result is shown on Player Detail Window and Comparison Panel.\n\n|cFFFFFF00-|r Added uptime amount for healing spells on Player Detail Window.\n\n|cFFFFFF00-|r Added an option to disable lock/resize/ungroup buttons. It's under miscellaneous bracket on Options Panel.\n\n|cFFFFFF00-|r Wallpaper for menus on title bar got a customization option under tooltips bracket on Options Panel.\n\n|cFFFFFF00-|r Updated spell list for Crowd Control and class detection.\n\n|cFFFFFF00-|r Improved Weakaura creation tool under Encounter Details Plugin.\n\n|cFFFFFF00v3.12.10 (|cFFFFCC00April 18, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added the spell uptime on damage player detail window.\n\n|cFFFFFF00-|r Added Rune Tap as cooldown.\n\n|cFFFFFF00-|r Report lines for deaths is now inverted. No need to scroll up the chat to see the cause of death anymore.\n\n|cFFFFFF00-|r Fixed some annoyances with auto current feature where it was changing the segments even when the user were using the window.\n\n|cFFFFFF00v3.12.7 (|cFFFFCC00April 09, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added slash command /details profile .\n\n|cFFFFFF00v3.12.6 (|cFFFFCC00May 06, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): added a report button on Emotes tab.\n\n|cFFFFFF00-|r Encounter Details (plugin): improved Weakauras creation.\n\n|cFFFFFF00-|r Encounter Details (plugin): fixed the report text for interrupts and dispells.\n\n|cFFFFFF00-|r Crowd control by Pets now is merged with its owner.\n\n|cFFFFFF00-|r Truncated left text on bars now shows the entire text when hover over the bar.\n\n|cFFFFFF00-|r Added an extra option on minimap menu to disable the minimap icon.\n\n|cFFFFFF00-|r Fixed a problem when disabling the minimap icon through options panel.\n\n|cFFFFFF00-|r Fixed an issue with item level tracker feature.\n\n|cFFFFFF00v3.12.2 (|cFFFFCC00Mar 30, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Raid Check (plugin): added item level.\n\n|cFFFFFF00-|r Advanced Death Logs (plugin): bug fixes, it's important to update it.\n\n|cFFFFFF00-|r Time Line (plugin): bug fixes.\n\n|cFFFFFF00-|r Added option to disabled th eitem level tracker.\n\n|cFFFFFF00-|r Added item level on Raid Check plugin panel.\n\n|cFFFFFF00-|r Added Spirit Link Totem damage and healing on death log.\n\n|cFFFFFF00-|r Added the total of life exchanged by the Spirit Link Totem on player detail window.\n\n|cFFFFFF00-|r Added more spells for crowd control.\n\n|cFFFFFF00-|r Added scroll on bookmark panel.\n\n|cFFFFFF00-|r Fixed issue with Dps/Hps data broker which wasn't respecting the type of time (effective/activity) selected.\n\n|cFFFFFF00-|r Fixed few bugs when using the key bind to toggle windows.\n\n|cFFFFFF00v3.11.5 (|cFFFFCC00Mar 18, 2015|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with overall data where max/min amount for spells was being calculated wrong.\n\n|cFFFFFF00-|r Fixed a problem while reporting enemy damage taken.\n\n|cFFFFFF00-|r Fixed an issue with damage taken by spell where some spells wasn't shown.\n\n|cFFFFFF00-|r Few improvements on tooltips.\n\n|cFFFFFF00-|r Fixed a accuracy problem with shaman's spirit link toten where its life exchange was considered healing done.\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." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " @@ -50,24 +51,31 @@ do --> containers --> armazenas as funções do parser - All parse functions - _detalhes.parser = {} + _detalhes.parser = {} _detalhes.parser_functions = {} _detalhes.parser_frame = CreateFrame ("Frame") _detalhes.pvp_parser_frame = CreateFrame ("Frame") _detalhes.parser_frame:Hide() --> armazena os escudos - Shields information for absorbs - _detalhes.escudos = {} + _detalhes.escudos = {} --> armazena as funções dos frames - Frames functions - _detalhes.gump = {} + _detalhes.gump = {} function _detalhes:GetFramework() return self.gump end + --> animações dos icones + _detalhes.icon_animations = { + load = { + in_use = {}, + available = {}, + }, + } --> armazena as funções para inicialização dos dados - Metatable functions - _detalhes.refresh = {} + _detalhes.refresh = {} --> armazena as funções para limpar e guardas os dados - Metatable functions - _detalhes.clear = {} + _detalhes.clear = {} --> armazena a config do painel de fast switch - _detalhes.switch = {} + _detalhes.switch = {} --> armazena os estilos salvos _detalhes.savedStyles = {} --> armazena quais atributos possue janela de atributos - contain attributes and sub attributos wich have a detailed window (left click on a row) @@ -81,6 +89,7 @@ do _detalhes.cache_healing_group = {} --> cache de specs _detalhes.cached_specs = {} + _detalhes.cached_talents = {} --> ignored pets _detalhes.pets_ignored = {} _detalhes.pets_no_owner = {} diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index a6d2a3cb..12cea810 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -824,6 +824,7 @@ nome = actor.nome, classe = class, value = _detalhes:GetOrderNumber (actor.nome), + is_custom = true, }, atributo_custom.mt) new_actor.name_complement = name_complement diff --git a/core/control.lua b/core/control.lua index 91c552d3..60edd73a 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1034,9 +1034,9 @@ end end - function _detalhes:MontaTooltip (frame, qual_barra, keydown) - + function _detalhes:BuildInstanceBarTooltip (frame) local GameCooltip = GameCooltip + GameCooltip:Reset() GameCooltip:SetType ("tooltip") @@ -1063,7 +1063,14 @@ else GameCooltip:SetHost (DetailsTooltipAnchor, myPoint, anchorPoint, x_Offset, y_Offset) end + end + + function _detalhes:MontaTooltip (frame, qual_barra, keydown) + + self:BuildInstanceBarTooltip (frame) + local GameCooltip = GameCooltip + local esta_barra = self.barras [qual_barra] --> barra que o mouse passou em cima e irá mostrar o tooltip local objeto = esta_barra.minha_tabela --> pega a referencia da tabela --> retorna a classe_damage ou classe_heal if (not objeto) then --> a barra não possui um objeto diff --git a/core/gears.lua b/core/gears.lua index 2f494aa1..63a8ee36 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -702,17 +702,17 @@ function _detalhes:StoreEncounter (combat) print (myrole, mybest and mybest[1], mybest and mybest[2], mybest and mybest[3], onencounter and onencounter.date) if (mybest) then - local done = 0 + local d_one = 0 if (myrole == "DAMAGER" or myrole == "TANK") then - done = combat (1, _detalhes.playername) and combat (1, _detalhes.playername).total + d_one = combat (1, _detalhes.playername) and combat (1, _detalhes.playername).total elseif (myrole == "HEALER") then - done = combat (2, _detalhes.playername) and combat (2, _detalhes.playername).total + d_one = combat (2, _detalhes.playername) and combat (2, _detalhes.playername).total end - if (mybest[1] > done) then - print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_NOTBEST"], _detalhes:comma_value (done), mybest[1], onencounter.date, mybest[2])) + if (mybest[1] > d_one) then + print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_NOTBEST"], _detalhes:comma_value (d_one), mybest[1], onencounter.date, mybest[2])) else - print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_BEST"], _detalhes:comma_value (done))) + print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_BEST"], _detalhes:comma_value (d_one))) end end @@ -725,6 +725,7 @@ end _detalhes.ilevel = {} local ilvl_core = _detalhes:CreateEventListener() ilvl_core.amt_inspecting = 0 +_detalhes.ilevel.core = ilvl_core ilvl_core:RegisterEvent ("GROUP_ONENTER", "OnEnter") ilvl_core:RegisterEvent ("GROUP_ONLEAVE", "OnLeave") @@ -733,6 +734,15 @@ ilvl_core:RegisterEvent ("COMBAT_PLAYER_LEAVE", "LeaveCombat") ilvl_core:RegisterEvent ("ZONE_TYPE_CHANGED", "ZoneChanged") local inspecting = {} +ilvl_core.forced_inspects = {} + +function ilvl_core:HasQueuedInspec (unitName) + local guid = UnitGUID (unitName) + if (guid) then + return ilvl_core.forced_inspects [guid] + end +end + local inspect_frame = CreateFrame ("frame") inspect_frame:RegisterEvent ("INSPECT_READY") @@ -812,6 +822,44 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout) _detalhes.item_level_pool [guid] = {name = name, ilvl = average, time = time()} end end + + local spec = GetInspectSpecialization (unitid) + if (spec and spec ~= 0) then + _detalhes.cached_specs [guid] = spec + end + +-------------------------------------------------------------------------------------------------------- + + local talents = {} + for i = 1, 7 do + for o = 1, 3 do + local talentID, name, texture, selected, available = GetTalentInfo (i, o, 1, true, unitid) + if (selected) then + tinsert (talents, talentID) + break + end + end + end + + if (talents [1]) then + _detalhes.cached_talents [guid] = talents + --print (UnitName (unitid), "talents:", unpack (talents)) + end + +-------------------------------------------------------------------------------------------------------- + + if (ilvl_core.forced_inspects [guid]) then + if (type (ilvl_core.forced_inspects [guid].callback) == "function") then + local okey, errortext = pcall (ilvl_core.forced_inspects[guid].callback, guid, unitid, ilvl_core.forced_inspects[guid].param1, ilvl_core.forced_inspects[guid].param2) + if (not okey) then + _detalhes:Msg ("Error on QueryInspect callback: " .. errortext) + end + end + ilvl_core.forced_inspects [guid] = nil + end + +-------------------------------------------------------------------------------------------------------- + end end _detalhes.ilevel.CalcItemLevel = ilvl_core.CalcItemLevel @@ -843,12 +891,21 @@ function ilvl_core:InspectTimeOut (guid) ilvl_core.amt_inspecting = ilvl_core.amt_inspecting - 1 end -function ilvl_core:GetItemLevel (unitid, guid) +function ilvl_core:ReGetItemLevel (t) + local unitid, guid, is_forced = unpack (t) + return ilvl_core:GetItemLevel (unitid, guid, is_forced) +end + +function ilvl_core:GetItemLevel (unitid, guid, is_forced) + --> ddouble check - if (UnitAffectingCombat ("player") or InCombatLockdown()) then + if (not is_forced and (UnitAffectingCombat ("player") or InCombatLockdown())) then return end if (not unitid or not CanInspect (unitid) or not CheckInteractDistance (unitid, 1)) then + if (is_forced) then + ilvl_core:ScheduleTimer ("ReGetItemLevel", 3, {unitid, guid, is_forced}) + end return end @@ -888,6 +945,42 @@ function ilvl_core:Reset() end end +function ilvl_core:QueryInspect (unitName, callback, param1) + local unitid + + if (IsInRaid()) then + for i = 1, GetNumGroupMembers() do + if (GetUnitName ("raid" .. i, true) == unitName) then + unitid = "raid" .. i + break + end + end + elseif (IsInGroup()) then + for i = 1, GetNumGroupMembers()-1 do + if (GetUnitName ("party" .. i, true) == unitName) then + unitid = "party" .. i + break + end + end + end + + if (not unitid) then + return + end + + local guid = UnitGUID (unitid) + if (not guid or ilvl_core.forced_inspects [guid]) then + return + end + + if (inspecting [guid]) then + return + end + + ilvl_core.forced_inspects [guid] = {callback = callback, param1 = param1} + ilvl_core:GetItemLevel (unitid, guid, true) +end + function ilvl_core:Loop() if (ilvl_core.amt_inspecting >= MAX_INSPECT_AMOUNT) then return @@ -898,7 +991,14 @@ function ilvl_core:Loop() ilvl_core.raid_id = 1 end - local unitid = "raid" .. ilvl_core.raid_id + local unitid + if (IsInRaid()) then + unitid = "raid" .. ilvl_core.raid_id + elseif (IsInGroup()) then + unitid = "party" .. ilvl_core.raid_id + else + return + end local guid = UnitGUID (unitid) if (not guid) then diff --git a/functions/profiles.lua b/functions/profiles.lua index dbb7cf44..19e5cd20 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -988,6 +988,12 @@ _detalhes.default_profile = default_profile -- aqui fica as propriedades do jogador que não serão armazenadas no profile local default_player_data = { --> current combat number + + cached_specs = {}, + cached_talents = {}, + + last_day = date ("%d"), + combat_id = 0, combat_counter = 0, last_instance_id = 0, diff --git a/functions/savedata.lua b/functions/savedata.lua index 07fb5cfb..515b81b3 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -85,6 +85,9 @@ function _detalhes:SaveConfig() --> buffs xpcall (_detalhes.Buffs.SaveBuffs, _detalhes.saver_error_func) + --> date + _detalhes.last_day = date ("%d") + --> salva o container do personagem for key, value in pairs (_detalhes.default_player_data) do if (not is_exception [key]) then diff --git a/gumps/janela_news.lua b/gumps/janela_news.lua index 4435a8b1..ddcf1aff 100644 --- a/gumps/janela_news.lua +++ b/gumps/janela_news.lua @@ -5,7 +5,7 @@ local g = _detalhes.gump local _ function _detalhes:DumpTable (text_to_show, dumpvalues, keeptext) - return _detalhes:OpenNewsWindow (text_to_show, dumpvalues, keeptext) + return _detalhes:OpenNewsWindow (text_to_show, true, keeptext) end function _detalhes:OpenNewsWindow (text_to_show, dumpvalues, keeptext) diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 36d703c6..efd55b14 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -2054,6 +2054,181 @@ local set_bar_value = function (self, value) end end +local icon_frame_on_enter = function (self) + local actor = self.row.minha_tabela + + if (actor) then + if (actor.is_custom) then + + + elseif (actor.dead_at) then + + + else + local serial = actor.serial + local name = actor:name() + local class = actor:class() + local spec = _detalhes.cached_specs [serial] or actor.spec + local talents = _detalhes.cached_talents [serial] + local ilvl = _detalhes.ilevel:GetIlvl (serial) + + local instance = _detalhes:GetInstance (self.row.instance_id) + + instance:BuildInstanceBarTooltip (self) + + local class_icon, class_L, class_R, class_T, class_B = _detalhes:GetClassIcon (class) + + local spec_id, spec_name, spec_description, spec_icon, spec_background, spec_role, spec_class = GetSpecializationInfoByID (spec or 0) + local spec_L, spec_R, spec_T, spec_B + if (spec_id) then + spec_L, spec_R, spec_T, spec_B = unpack (_detalhes.class_specs_coords [spec]) + end + + GameCooltip:AddLine (name, spec_name) + + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], 1, 1, 16, 16, class_L, class_R, class_T, class_B) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\spec_icons_normal_alpha]], 1, 2, 16, 16, spec_L, spec_R, spec_T, spec_B) + + GameCooltip:AddLine ("") + + local talent_string = "" + if (talents) then + for i = 1, #talents do + local talentID, name, texture, selected, available = GetTalentInfoByID (talents [i]) + talent_string = talent_string .. " |T" .. texture .. ":16:16:0:0:64:64:4:60:4:60|t" + end + end + GameCooltip:AddLine ("Talents:", talent_string) + GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3) + GameCooltip:AddLine ("Item Level:", ilvl and format ("%.1f", ilvl.ilvl) or "??") + GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3) + GameCooltip:AddLine ("Class:", LOCALIZED_CLASS_NAMES_MALE [class]) + GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3) + + -- + + local damage = instance.showing (1, name) + local healing = instance.showing (2, name) + GameCooltip:AddLine ("Damage:", _detalhes:ToK2 (damage and damage.total or 0)) + GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3) + GameCooltip:AddLine ("Healing:", _detalhes:ToK2 (healing and healing.total or 0)) + GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3) + + -- + + GameCooltip:AddLine ("") + GameCooltip:AddLine (Loc ["STRING_QUERY_INSPECT"], nil, 1, "orange") + --|TInterface\\TUTORIALFRAME\\UI-TUTORIAL-FRAME:14:14:0:1:512:512:8:70:224:306|t + GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 8/512, 70/512, 224/512, 306/512) + + GameCooltip:SetOption ("StatusBarTexture", [[Interface\AddOns\Details\images\bar_skyline]]) + + GameCooltip:ShowCooltip() + + self.unitname = name + self.showing = "actor" + end + end + +end +local icon_frame_on_leave = function (self) + GameCooltip:Hide() + GameTooltip:Hide() +end + +local icon_frame_events = _detalhes:CreateEventListener() +function icon_frame_events:EnterCombat() + for anim, _ in pairs (_detalhes.icon_animations.load.in_use) do + anim.anim:Stop() + anim:Hide() + tinsert (_detalhes.icon_animations.load.available, anim) + end + wipe (_detalhes.icon_animations.load.in_use) +end + +icon_frame_events:RegisterEvent ("COMBAT_PLAYER_ENTER", "EnterCombat") + +function icon_frame_events:CancelAnim (anim) + if (_detalhes.icon_animations.load.in_use [anim]) then + _detalhes.icon_animations.load.in_use [anim] = nil + tinsert (_detalhes.icon_animations.load.available, anim) + anim.anim:Stop() + anim:Hide() + end +end + +local icon_frame_inspect_callback = function (guid, unitid, icon_frame) + local is_in_use = _detalhes.icon_animations.load.in_use [icon_frame.icon_animation] + if (is_in_use) then + tinsert (_detalhes.icon_animations.load.available, icon_frame.icon_animation) + _detalhes.icon_animations.load.in_use [icon_frame.icon_animation] = nil + end + + icon_frame.icon_animation.anim:Stop() + icon_frame.icon_animation:Hide() + + if (icon_frame:IsMouseOver()) then + icon_frame_on_enter (icon_frame) + end +end + +local icon_frame_create_animation = function() + local f = CreateFrame ("frame", nil, UIParent) + f:SetFrameStrata ("FULLSCREEN") + f.anim = f:CreateAnimationGroup() + f.rotate = f.anim:CreateAnimation ("Rotation") + f.rotate:SetDegrees (360) + f.rotate:SetDuration (2) + f.anim:SetLooping ("repeat") + + local t = f:CreateTexture (nil, "overlay") + t:SetTexture ([[Interface\COMMON\StreamCircle]]) + t:SetAlpha (0.7) + t:SetAllPoints() + + tinsert (_detalhes.icon_animations.load.available, f) +end + +local icon_frame_on_click = function (self) + if (_detalhes.in_combat) then + _detalhes:Msg (Loc ["STRING_QUERY_INSPECT_FAIL1"]) + return + end + if (self.showing == "actor") then + + if (_detalhes.ilevel.core:HasQueuedInspec (self.unitname)) then + return + end + + _detalhes.ilevel.core:QueryInspect (self.unitname, icon_frame_inspect_callback, self) + + --> icon animation + local anim = tremove (_detalhes.icon_animations.load.available) + if (not anim) then + icon_frame_create_animation() + anim = tremove (_detalhes.icon_animations.load.available) + end + + anim:Show() + anim:SetParent (self) + anim:ClearAllPoints() + anim:SetFrameStrata ("TOOLTIP") + anim:SetPoint ("center", self, "center") + anim:SetSize (self:GetWidth()*1.7, self:GetHeight()*1.7) + anim.anim:Play() + self.icon_animation = anim + + local pid = icon_frame_events:ScheduleTimer ("CancelAnim", 4, anim) + _detalhes.icon_animations.load.in_use [anim] = pid + end +end + +local set_frame_icon_scripts = function (row) + row.icon_frame:SetScript ("OnEnter", icon_frame_on_enter) + row.icon_frame:SetScript ("OnLeave", icon_frame_on_leave) + row.icon_frame:SetScript ("OnMouseUp", icon_frame_on_click) +end + local function barra_scripts (esta_barra, instancia, i) esta_barra._instance = instancia @@ -2065,6 +2240,8 @@ local function barra_scripts (esta_barra, instancia, i) esta_barra:SetScript ("OnShow", barra_scripts_onshow) + set_frame_icon_scripts (esta_barra) + esta_barra.SetValue = set_bar_value end @@ -3458,7 +3635,14 @@ function gump:CriaNovaBarra (instancia, index) icone_classe:SetTexture (instancia.row_info.icon_file) icone_classe:SetTexCoord (.75, 1, .75, 1) new_row.icone_classe = icone_classe - + + local icon_frame = CreateFrame ("frame", "DetailsBarra_IconFrame_" .. instancia.meu_id .. "_" .. index, new_row.statusbar) + icon_frame:SetPoint ("topleft", icone_classe, "topleft") + icon_frame:SetPoint ("bottomright", icone_classe, "bottomright") + icon_frame:SetFrameLevel (new_row.statusbar:GetFrameLevel()+1) + icon_frame.row = new_row + new_row.icon_frame = icon_frame + icone_classe:SetPoint ("left", new_row, "left") new_row.statusbar:SetPoint ("topleft", icone_classe, "topright") new_row.statusbar:SetPoint ("bottomright", new_row, "bottomright") diff --git a/startup.lua b/startup.lua index b2ff801c..5b8aab66 100644 --- a/startup.lua +++ b/startup.lua @@ -494,14 +494,22 @@ function _G._detalhes:Start() --boss mobs callbacks _detalhes:ScheduleTimer ("BossModsLink", 5) - + + --> limit item level life for 24Hs local now = time() for guid, t in pairs (_detalhes.item_level_pool) do - if (t.time+3600 < now) then + if (t.time+86400 < now) then _detalhes.item_level_pool [guid] = nil end end + --> dailly reset of the cache for talents and specs. + local today = date ("%d") + if (_detalhes.last_day ~= today) then + wipe (_detalhes.cached_specs) + wipe (_detalhes.cached_talents) + end + --[[ function _detalhes:TestResize() _detalhes:OpenNewsWindow ("TESTE, |TInterface\\AddOns\\Details\\images\\key_shift:20:40:0:0:64:64:0:64:0:40|t")