From 801dfb3bbc347bbcd513edc405873496a5abf4c0 Mon Sep 17 00:00:00 2001 From: Tercio Date: Fri, 23 Feb 2018 12:13:56 -0300 Subject: [PATCH] - Added damage chart at the end of a mythic dungeon run. - Framework update to v66. --- Details.toc | 1 + Libs/DF/fw.lua | 2 +- Libs/DF/panel.lua | 121 +++++++++-- boot.lua | 10 +- core/control.lua | 2 +- functions/dungeon.lua | 422 +++++++++++++++++++++++++++++++++++++ functions/profiles.lua | 3 + gumps/janela_principal.lua | 3 +- 8 files changed, 532 insertions(+), 32 deletions(-) create mode 100644 functions/dungeon.lua diff --git a/Details.toc b/Details.toc index d98cf7c8..080bf62a 100644 --- a/Details.toc +++ b/Details.toc @@ -43,6 +43,7 @@ functions\timedata.lua functions\report.lua functions\rowanimation.lua functions\raidinfo.lua +functions\dungeon.lua core\timemachine.lua diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 307d437e..220a8431 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 65 +local dversion = 66 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 8a82c5d7..be63eb77 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -2415,24 +2415,21 @@ local chart_panel_align_timelabels = function (self, elapsed_time) end local chart_panel_set_scale = function (self, amt, func, text) - if (type (amt) ~= "number") then return end - local piece = amt / 1000 / 8 - if (not text or text == "") then - text = amt > 1000000 and "M" or amt > 1000 and "K" - end - + --each line amount, then multiply the line index by this number + local piece = amt / 8 + for i = 1, 8 do if (func) then - self ["dpsamt" .. math.abs (i-9)]:SetText ( func (piece*i) .. (text or "")) + self ["dpsamt" .. math.abs (i-9)]:SetText (func (piece*i)) else if (piece*i > 1) then - self ["dpsamt" .. math.abs (i-9)]:SetText ( format ("%.1f", piece*i) .. (text or "")) + self ["dpsamt" .. math.abs (i-9)]:SetText (DF.FormatNumber (piece*i)) else - self ["dpsamt" .. math.abs (i-9)]:SetText ( format ("%.3f", piece*i) .. (text or "")) + self ["dpsamt" .. math.abs (i-9)]:SetText (format ("%.3f", piece*i)) end end end @@ -2535,7 +2532,6 @@ local create_box = function (self, next_box) self.BoxLabels [next_box] = thisbox local box = DF:NewImage (self.Graphic, nil, 16, 16, "border") - local text = DF:NewLabel (self.Graphic) local border = DF:NewImage (self.Graphic, [[Interface\DialogFrame\UI-DialogBox-Gold-Corner]], 30, 30, "artwork") @@ -2543,7 +2539,7 @@ local create_box = function (self, next_box) border:SetTexture ([[Interface\DialogFrame\UI-DialogBox-Gold-Corner]]) local checktexture = DF:NewImage (self.Graphic, [[Interface\Buttons\UI-CheckBox-Check]], 18, 18, "overlay") - checktexture:SetPoint ("center", box, "center", -1, -1) + checktexture:SetPoint ("center", box, "center", 0, -1) checktexture:SetTexture ([[Interface\Buttons\UI-CheckBox-Check]]) thisbox.box = box @@ -2557,7 +2553,12 @@ local create_box = function (self, next_box) button:SetScript ("OnClick", function() chart_panel_enable_line (self, thisbox) end) - button:SetPoint ("center", box.widget or box, "center") + button:SetPoint ("topleft", box.widget or box, "topleft", 0, 0) + button:SetPoint ("bottomright", box.widget or box, "bottomright", 0, 0) + + button:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + button:SetBackdropColor (0, 0, 0, 0.0) + button:SetBackdropBorderColor (0, 0, 0, 1) thisbox.button = button @@ -2566,7 +2567,7 @@ local create_box = function (self, next_box) if (next_box == 1) then thisbox.text:SetPoint ("topright", self, "topright", -35, -16) else - thisbox.text:SetPoint ("right", self.BoxLabels [next_box-1].box, "left", -7, 0) + thisbox.text:SetPoint ("right", self.BoxLabels [next_box-1].box, "left", -17, 0) end return thisbox @@ -2594,7 +2595,7 @@ local realign_labels = function (self) line_width = box.text:GetStringWidth() + 26 box.text:SetPoint ("topright", self, "topright", -35, -40) else - box.text:SetPoint ("right", self.BoxLabels [i-1].box, "left", -7, 0) + box.text:SetPoint ("right", self.BoxLabels [i-1].box, "left", -27, 0) end else break @@ -2604,7 +2605,7 @@ local realign_labels = function (self) end local chart_panel_add_label = function (self, color, name, type, number) - + local next_box = self.BoxLabelsAmount local thisbox = self.BoxLabels [next_box] @@ -2613,19 +2614,19 @@ local chart_panel_add_label = function (self, color, name, type, number) end self.BoxLabelsAmount = self.BoxLabelsAmount + 1 - + thisbox.type = type thisbox.index = number - + thisbox.box:SetColorTexture (unpack (color)) thisbox.text:SetText (name) thisbox.check:Show() thisbox.button:Show() - thisbox.border:Show() + thisbox.border:Hide() thisbox.box:Show() thisbox.text:Show() - + thisbox.showing = true thisbox.enabled = true @@ -2638,7 +2639,7 @@ local draw_overlay = function (self, this_overlay, overlayData, color) local pixel = self.Graphic:GetWidth() / self.TimeScale local index = 1 - local r, g, b = unpack (color or line_default_color) + local r, g, b, a = unpack (color or line_default_color) for i = 1, #overlayData, 2 do local aura_start = overlayData [i] @@ -2659,7 +2660,7 @@ local draw_overlay = function (self, this_overlay, overlayData, color) this_block:SetWidth (pixel*5) end - this_block:SetColorTexture (r, g, b, 0.25) + this_block:SetColorTexture (r, g, b, a or 0.25) this_block:Show() index = index + 1 @@ -2694,6 +2695,80 @@ local chart_panel_add_overlay = function (self, overlayData, color, name, icon) self.OverlaysAmount = self.OverlaysAmount + 1 end +-- Define the tricube weight function +function calc_cubeweight (i, j, d) + local w = ( 1 - math.abs ((j-i)/d)^3)^3 + if w < 0 then + w = 0; + end + return w +end + +local calc_lowess_smoothing = function (self, data, bandwidth) + local length = #data + local newData = {} + + for i = 1, length do + local A = 0 + local B = 0 + local C = 0 + local D = 0 + local E = 0 + + -- Calculate span of values to be included in the regression + local jmin = floor (i-bandwidth/2) + local jmax = ceil (i+bandwidth/2) + if jmin < 1 then + jmin = 1 + end + if jmax > length then + jmax = length + end + + -- For all the values in the span, compute the weight and then the linear fit + + for j = jmin, jmax do + w = calc_cubeweight (i, j, bandwidth/2) + x = j + y = data [j] + + A = A + w*x + B = B + w*y + C = C + w*x^2 + D = D + w*x*y + E = E + w + end + + -- Calculate a (slope) and b (offset) for the linear fit + local a = (A*B-D*E)/(A^2 - C*E); + local b = (A*D-B*C)/(A^2 - C*E); + + -- Calculate the smoothed value by the formula y=a*x+b (x <- i) + newData [i] = a*i+b; + + end + + return newData +end + +local calc_stddev = function (self, data) + local total = 0 + for i = 1, #data do + total = total + data[i] + end + local mean = total / #data + + local totalDistance = 0 + for i = 1, #data do + totalDistance = totalDistance + ((data[i] - mean) ^ 2) + end + + local deviation = math.sqrt (totalDistance / #data) + return deviation +end + + + local SMA_table = {} local SMA_max = 0 local reset_SMA = function() @@ -2760,7 +2835,7 @@ local chart_panel_add_data = function (self, graphicData, color, name, elapsed_t local amount = #graphicData local scaleW = 1/self:GetWidth() - + local content = graphicData tinsert (content, 1, 0) tinsert (content, 1, 0) @@ -3051,6 +3126,8 @@ function DF:CreateChartPanel (parent, w, h, name) f.AddOverlay = chart_panel_add_overlay f.HideCloseButton = chart_panel_hide_close_button f.RightClickClose = chart_panel_right_click_close + f.CalcStdDev = calc_stddev + f.CalcLowessSmoothing = calc_lowess_smoothing f:SetScript ("OnSizeChanged", chart_panel_onresize) chart_panel_onresize (f) diff --git a/boot.lua b/boot.lua index fe3672fb..abb4b4f2 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 = 5282 + _detalhes.build_counter = 5333 _detalhes.userversion = "v7.3.0." .. _detalhes.build_counter _detalhes.realversion = 129 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" @@ -21,16 +21,14 @@ do local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) --[[ -|cFFFFFF00v7.3.5.5231.128 (|cFFFFCC00Feb 02nd, 2018|r|cFFFFFF00)|r:\n\n -|cFFFFFF00-|r Fixed an issue with wasted shield absorbs where the wasted amount was subtracting the total healing done.\n\n +|cFFFFFF00v7.3.5.5333.129 (|cFFFFCC00Feb 23rd, 2018|r|cFFFFFF00)|r:\n\n +|cFFFFFF00-|r Added a damage chart for mythic dungeon runs, it shows at the of the run.\n\n |cFFFFFF00-|r .\n\n --]] -- - - - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v7.3.5.5231.128 (|cFFFFCC00Feb 02nd, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with wasted shield absorbs where the wasted amount was subtracting the total healing done.\n\n|cFFFFFF00v7.3.5.5221.128 (|cFFFFCC00Jan 26th, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Warlock mana from Life Tap won't show up any more under mana regen, this makes easy to see Soul Shard gain.\n\n|cFFFFFF00v7.3.2.5183.128 (|cFFFFCC00Jan 12th, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r The new bar animation is now applied to all users by default.\n\n|cFFFFFF00-|r Fixed an issue with the threat plugin where sometimes it was triggering errors.\n\n|cFFFFFF00v7.3.2.5175.128 (|cFFFFCC00Jan 03rd, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r ElvUI skins should have now a more good looking scrollbar.\n\n|cFFFFFF00-|r When starting to edit a custom display, the code window now clear the code from the previous display.\n\n|cFFFFFF00v7.3.2.5154.128 (|cFFFFCC00Dec 22th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r API and Create Aura windows are now attached to the new plugin window.\n\n|cFFFFFF00v7.3.2.5101.128 (|cFFFFCC00Dec 15th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Moving the custom display window to the new plugins window.\n\n|cFFFFFF00-|r Major layout changes on the Encounter Details plugin window.\n\n|cFFFFFF00v7.3.2.4919.128 (|cFFFFCC00Dec 08th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with the statistics sharing among guild members.\n\n|cFFFFFF00-|r Fixed an issue with Argus encounter where two segments were created.\n\n|cFFFFFF00-|r Fixed aura type images on the Create Aura Panel.\n\n|cFFFFFF00-|r Create Aura Panel can now be closed with Right Click.\n\n|cFFFFFF00-|r Framework updated to r60, plugins should be more stable now.\n\n|cFFFFFF00v7.3.0.4830.126 (|cFFFFFF00v7.3.2.4836.126 (|cFFFFCC00Nov 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Removed some tutorial windows popups.\n\n|cFFFFCC00Oct 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed opening windows when streamer settings > no alerts is enabled.\n\n|cFFFFFF00v7.3.0.4823.126 (|cFFFFCC00Oct 09th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added new options section: Streamer Settings, focused on adjustments for streamers and youtubers.\n\n|cFFFFFF00-|r Animations now always run at the same speed regardless the framerate.\n\n|cFFFFFF00-|r Click-To-Open menus now close the menu if the menu is already open.\n\n|cFFFFFF00v7.3.0.4723.126 (|cFFFFCC00Set 22th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed overall dungeon segments being added to overall data.\n\n|cFFFFFF00v7.3.0.4705.126 (|cFFFFCC00Set 19th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed damage taken tooltip for Brewmaster Monk where sometimes the tooltip didn't open.\n\n|cFFFFFF00-|r Fixed overall data on mythic dungeon not adding trash segments even with the option enabled on the options panel.\n\n|cFFFFFF00-|r Fixed the guild selection dropdown reseting everytime the Guild Rank window is opened.\n\n|cFFFFFF00v7.3.0.4677.126 (|cFFFFCC00Set 10th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r During mythic dungeons, the trash segments will be merged into a new segment at the end of the boss encounter (instead of merging on the fly while cleaning up).\n\n|cFFFFFF00v7.3.0.4615.125 (|cFFFFCC00Set 09th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Setting up the dungeon stuff as opt-in for early adopters while we continue to make improvements on the system.\n\n|cFFFFFF00v7.3.0.4586.125 (|cFFFFCC00Set 08th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Formating mythic+ dungeon segments, each segment should count the boss trash + boss fight.\n\n|cFFFFFF00-|r At the end of the mythic+ dungeon, it should create a new segment adding up all segments described above.\n\n|cFFFFFF00v7.3.0.4499.124 (|cFFFFCC00Set 05th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added an option to always show all players when using the standard mode. Option under PvP/PvE bracket on the options panel.\n\n|cFFFFFF00-|r Added a setting to exclude healing done lines from the death log below a certain healing amount. This options is also under PvP/PvE bracket.\n\n|cFFFFFF00-|r Fixed the guild selection on the ranking panel.\n\n|cFFFFFF00v7.3.0.4467.124 (|cFFFFCC00August 29th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Damage or Healing record for the encounter should be printed on chat on the boss pull.\nUse /run Details.announce_damagerecord.enabled = false; to disable.\n\n|cFFFFFF00v7.2.5.4437.124 (|cFFFFCC00August 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added healing done cap for death log. Use /run Details.deathlog_healingdone_min = 10000\n\n|cFFFFFF00-|r Fixed an issue where the alpha from the fixed bar color was used even when this option was disabled.\n\n|cFFFFFF00v7.2.5.4436.124 (|cFFFFCC00August 17th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Attempt to fix the issue where the window doesn't update after entering a raid or reseting data.\n\n|cFFFFFF00v7.2.5.4434.124 (|cFFFFCC00August 10th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added buttons to create an aura at Aura tab on the Player Details window.\n\n|cFFFFFF00-|r Fixes and improvements on the damage rank panel.\n\n|cFFFFFF00-|r Best damage or healing for the player on the current boss encounter is now shown on the spec icon tooltip.\n\n|cFFFFFF00-|r Major revamp on the aura creation panel.\n\n|cFFFFFF00v7.2.5.4369.124 (|cFFFFCC00August 1st, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Details! can now track debuff applications (stack) and refreshes.\n\n|cFFFFFF00-|r Added new tab on Player Detail Window called 'Auras', you can see your buffs and debuffs from there.\n\n|cFFFFFF00-|r Death log now show debuff applications.\n\n|cFFFFFF00v7.2.5.4275.123 (|cFFFFCC00July 18th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed some issues with tooltiops popup when the user press SHIFT.\n\n|cFFFFFF00-|r Now is possible to change the bar durating when selecting Cast Start trigger on Details! Forge.\n\n|cFFFFFF00-|r Kil'Jaeden adds should be consolidated into only one actor instead of having one for each player targeted.\n\n|cFFFFFF00v7.2.5.4236.122 (|cFFFFCC00July 05th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r The alert to open the raid ranking after a boss kill, is now shown for 10 seconds (down from 40).\n\n|cFFFFFF00-|r Added a report button on the raid ranking panel and boss are sort alphabetically.\n\n|cFFFFFF00-|r Fixed some issues on the combatlog introduced on the wow patch 7.2.5 where sometimes the source of an event has no name.\n\n|cFFFFFF00-|r Ticket #209, fixed more issues with the comparison panel where are pets involved.\n\n|cFFFFFF00v7.2.5.4201.121 (|cFFFFCC00June 26th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed Monk Stagger where it was only shown on the friendly fire and not under the Damage Taken display.\n\n|cFFFFFF00-|r Added Forge and Ranking options on the main menu (orange cogwheel).\n\n|cFFFFFF00v7.2.5.4102.121 (|cFFFFCC00June 22th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Details! Forge has updated and now is more usder friendly.\n\n|cFFFFFF00-|r Fixed an issue with player buff uptime where sometimes some buffs wans't showing in the tooltip.\n\n|cFFFFFF00v7.2.5.3968.120 (|cFFFFCC00June 20th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r New Death Recap implemented! replaces the default from Blizzard and can be configured at Options > Raid Tools.\n\n|cFFFFFF00-|r New Guild Damage and Heal rank on '/details ranking' panel.\n\n|cFFFFFF00-|r Added a Guild Sync button on the Details! Ranking Panel.\n\n|cFFFFFF00-|r Added Custom display 'Damage on Shields', useful for encounter like Maiden of Vigilance where there's big shields to be removed and you want to know who is doing more damage to it.\n\n|cFFFFFF00-|r Added Heal Absorbed display under Heal bracket.\n\nHeal Absorb are the heal denied by abilities such like DK's Necrotic Strike or raid boss Sisters of the Moon 'Embrace of the Eclipse' ability.\nThe tooltip of this display shows which players got heal denied, which abilities absorbed the heal, which abilities tried to heal but got the heal denied.\n\n|cFFFFFF00-|r Added Alternate Power display under Energy bracket, it shows the total of alternate power gain from each player, useful for encounters such as Demonic Inquisition.\n\n|cFFFFFF00-|r 'First Hit' message after pulling a boss, now also shows who the boss is targeting (almost always is who pulled).\n\n|cFFFFFF00-|r Raid Dps {rdps} and Hps {rhps} can now be used on the Broker Data Feed..\n\n|cFFFFFF00-|r Fixed an issue with Chromie from the scenario 'The Deaths of Chromie' where she wasn't being shown on the meter.\n\n|cFFFFFF00-|r Fixed Paladin 'Light of the Martyr' damage to self.\n\n|cFFFFFF00-|r Ticket #198 'Script Error' Fixed.\n\n|cFFFFFF00v7.2.0.3703.119 (|cFFFFCC00May 29th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an error while killing low level mobs with warrior class.\n\n|cFFFFFF00v7.2.0.3693.118 (|cFFFFCC00May 25th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fury Warrior shouldn't be assigned as Protection any more.\n\n|cFFFFFF00-|r Some parser fixes.\n\n|cFFFFFF00v7.2.0.3673.118 (|cFFFFCC00May 09th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Ticket #187: Fixed an issue when comparing hunter pets on the player detail window.\n\n|cFFFFFF00-|r Ticket #189 #186: Fixed a taint issue for some classes when using friendly nameplates on.\n\n|cFFFFFF00v7.2.0.3512.116 (|cFFFFCC00April 27th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Havoc Demon Hunter: your fury energy is being shown under Mana Restored (don't ask me why, the combat log is telling us it's mana).\n\n|cFFFFFF00-|r Pets now are shown on damage tooltips.\n\n|cFFFFFF00-|r Pets are now also shown on the comparison panel.\n\n|cFFFFFF00v7.2.0.3474.116 (|cFFFFCC00April 20th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Plugin: Raid Check > added some food buffs which wasn't being tracked.\n\n|cFFFFFF00v7.2.0.3467.116 (|cFFFFCC00April 07th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fix for the custom display window where apply and cancel buttons where over the edit window.\n\n|cFFFFFF00-|r Fix for an issue on editing a bookmark.\n\n|cFFFFFF00v7.1.5.3459.116 (|cFFFFCC00Mar 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue on dynamic overall data where it wasn't showing DPS.\n\n|cFFFFFF00-|r Fixed an issue with Apply, Save and Cancel buttons when editing a custom display.\n\n|cFFFFFF00-|r Removed the Damage and Healing presets for custom displays, now is only possible create custom displays by scripting them.\n\n|cFFFFFF00v7.1.5.3431.116 (|cFFFFCC00Mar 15th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with bar orientation right to left where fixed bar color isn't working.\n\n|cFFFFFF00-|r The nickname field now use FrizQuadrataTT font and shall be compatible with Cyrillic.\n\n|cFFFFFF00v7.1.5.3418.116 (|cFFFFCC00Mar 1st, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Ticket #167 fix: Light of the Martyr self-damage now does reduce the healing done (following WCL method).\n\n|cFFFFFF00-|r Ticket #169 fix: Damage Prevented is now working for new segments.\n\n|cFFFFFF00-|r Fixed an issue where sometimes BeastMaster's Hati pet wasn't detected correctly.\n\n|cFFFFFF00v7.1.5.3369.116 (|cFFFFCC00Feb 07th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added custom display 'Dynamic Overall Damage' for mythic dungeons.\n\n|cFFFFFF00-|r Fix for Ticket #168: 'Auto Hide While [Not] Inside Instance is broken'.\n\n|cFFFFFF00-|r The bar truncate frame 'DetailsLeftTextAntiTruncate' is now created on Details! load instead on demand.\n\n|cFFFFFF00v7.1.5.3315.116 (|cFFFFCC00Jan 23th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Ticket #162: 'no Monochrome font' available, added an experimental slash command: /run _detalhes:UseOutline ('MONOCHROME').\n\n|cFFFFFF00-|r Ticket #158: 'no elapsed time shown on report to chat', added the elapsed time when reporting a segment.\n\n|cFFFFFF00-|r Ticket #164: 'error when browsing segments', an attempt to fix the problem has been made.\n\n|cFFFFFF00v7.1.5.3305.116 (|cFFFFCC00Jan 15th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Another fix for mythic dungeons overall data reset (thanks Tharai @ Curseforge).\n\n|cFFFFFF00-|r Fix for spec detection on PvP Arenas (thanks Pas06 @ Curseforge).\n\n|cFFFFFF00v7.1.0.3276.115 (|cFFFFCC00Jan 08th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the overall data not reseting when starting a new mythic+ dungeon.\n\n|cFFFFFF00v7.1.0.3266.115 (|cFFFFCC00Dec 29th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with overall data not updating correctly at the end of the combat.\n\n|cFFFFFF00-|r Added a tutorial line on the window when the user access overall data.\n\n|cFFFFFF00v7.1.0.3236.115 (|cFFFFCC00Dec 19th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Integration with BigWigs should be working okay now.\n\n|cFFFFFF00v7.1.0.3231.115 (|cFFFFCC00Dec 15th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Disabled the link with BigWigs to avoid the 'RegisterMessage' error on every login.\n\n|cFFFFFF00v7.1.0.3229.115 (|cFFFFCC00Dec 09th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r When a window is locked, resize grips shouldn't be enabled messing with bar mouse over.\n\n|cFFFFFF00v7.0.3.3222.115 (|cFFFFCC00November 28th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Unstable Affliction to common spells with the same name.\n\n|cFFFFFF00-|r Fixed few issues with built-in plugins.\n\n|cFFFFFF00v7.0.3.3202.115 (|cFFFFCC00November 08th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Weakauras creator from the Encounter Details plugin and '/details forge' shall work correctly now with Trials of Valor.\n\n|cFFFFFF00-|r Raid history should now be recording your Trials of Valor kills.\n\n|cFFFFFF00-|r Added Trials of Valor raid info, good luck and have fun!.\n\n|cFFFFFF00v7.0.3.3201.115 (|cFFFFCC00November 04th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fix for Paladin holy icon.\n\n|cFFFFFF00-|r Fix for Rogue outlaw icon.\n\n|cFFFFFF00-|r Fixed misc displays with bar sorted by ascending order.\n\n|cFFFFFF00-|r Fix for '/details show' command while the window is on auto hide.\n\n|cFFFFFF00v7.0.3.3114.115 (|cFFFFCC00October 26th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): tooltip tutorial is now clamped to screen and its close button should be visible.\n\n|cFFFFFF00-|r Raid Check (plugin): now also works on dungeons.\n\n|cFFFFFF00-|r Added Potion of the Prolongued Power to the tracker.\n\n|cFFFFFF00v7.1.0.3097.115 (|cFFFFCC00October 25th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r renamed 'report history' to 'latest reports'.\n\n|cFFFFFF00-|r attempt to make all Details! users on the party or raid to track rogue's akaari's soul." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v7.3.5.5333.129 (|cFFFFCC00Feb 23rd, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added a damage chart for mythic dungeon runs, it shows at the of the run.\n\n|cFFFFFF00v7.3.5.5231.128 (|cFFFFCC00Feb 02nd, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with wasted shield absorbs where the wasted amount was subtracting the total healing done.\n\n|cFFFFFF00v7.3.5.5221.128 (|cFFFFCC00Jan 26th, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Warlock mana from Life Tap won't show up any more under mana regen, this makes easy to see Soul Shard gain.\n\n|cFFFFFF00v7.3.2.5183.128 (|cFFFFCC00Jan 12th, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r The new bar animation is now applied to all users by default.\n\n|cFFFFFF00-|r Fixed an issue with the threat plugin where sometimes it was triggering errors.\n\n|cFFFFFF00v7.3.2.5175.128 (|cFFFFCC00Jan 03rd, 2018|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r ElvUI skins should have now a more good looking scrollbar.\n\n|cFFFFFF00-|r When starting to edit a custom display, the code window now clear the code from the previous display.\n\n|cFFFFFF00v7.3.2.5154.128 (|cFFFFCC00Dec 22th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r API and Create Aura windows are now attached to the new plugin window.\n\n|cFFFFFF00v7.3.2.5101.128 (|cFFFFCC00Dec 15th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Moving the custom display window to the new plugins window.\n\n|cFFFFFF00-|r Major layout changes on the Encounter Details plugin window.\n\n|cFFFFFF00v7.3.2.4919.128 (|cFFFFCC00Dec 08th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with the statistics sharing among guild members.\n\n|cFFFFFF00-|r Fixed an issue with Argus encounter where two segments were created.\n\n|cFFFFFF00-|r Fixed aura type images on the Create Aura Panel.\n\n|cFFFFFF00-|r Create Aura Panel can now be closed with Right Click.\n\n|cFFFFFF00-|r Framework updated to r60, plugins should be more stable now.\n\n|cFFFFFF00v7.3.0.4830.126 (|cFFFFFF00v7.3.2.4836.126 (|cFFFFCC00Nov 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Removed some tutorial windows popups.\n\n|cFFFFCC00Oct 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed opening windows when streamer settings > no alerts is enabled.\n\n|cFFFFFF00v7.3.0.4823.126 (|cFFFFCC00Oct 09th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added new options section: Streamer Settings, focused on adjustments for streamers and youtubers.\n\n|cFFFFFF00-|r Animations now always run at the same speed regardless the framerate.\n\n|cFFFFFF00-|r Click-To-Open menus now close the menu if the menu is already open.\n\n|cFFFFFF00v7.3.0.4723.126 (|cFFFFCC00Set 22th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed overall dungeon segments being added to overall data.\n\n|cFFFFFF00v7.3.0.4705.126 (|cFFFFCC00Set 19th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed damage taken tooltip for Brewmaster Monk where sometimes the tooltip didn't open.\n\n|cFFFFFF00-|r Fixed overall data on mythic dungeon not adding trash segments even with the option enabled on the options panel.\n\n|cFFFFFF00-|r Fixed the guild selection dropdown reseting everytime the Guild Rank window is opened.\n\n|cFFFFFF00v7.3.0.4677.126 (|cFFFFCC00Set 10th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r During mythic dungeons, the trash segments will be merged into a new segment at the end of the boss encounter (instead of merging on the fly while cleaning up).\n\n|cFFFFFF00v7.3.0.4615.125 (|cFFFFCC00Set 09th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Setting up the dungeon stuff as opt-in for early adopters while we continue to make improvements on the system.\n\n|cFFFFFF00v7.3.0.4586.125 (|cFFFFCC00Set 08th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Formating mythic+ dungeon segments, each segment should count the boss trash + boss fight.\n\n|cFFFFFF00-|r At the end of the mythic+ dungeon, it should create a new segment adding up all segments described above.\n\n|cFFFFFF00v7.3.0.4499.124 (|cFFFFCC00Set 05th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added an option to always show all players when using the standard mode. Option under PvP/PvE bracket on the options panel.\n\n|cFFFFFF00-|r Added a setting to exclude healing done lines from the death log below a certain healing amount. This options is also under PvP/PvE bracket.\n\n|cFFFFFF00-|r Fixed the guild selection on the ranking panel.\n\n|cFFFFFF00v7.3.0.4467.124 (|cFFFFCC00August 29th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Damage or Healing record for the encounter should be printed on chat on the boss pull.\nUse /run Details.announce_damagerecord.enabled = false; to disable.\n\n|cFFFFFF00v7.2.5.4437.124 (|cFFFFCC00August 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added healing done cap for death log. Use /run Details.deathlog_healingdone_min = 10000\n\n|cFFFFFF00-|r Fixed an issue where the alpha from the fixed bar color was used even when this option was disabled.\n\n|cFFFFFF00v7.2.5.4436.124 (|cFFFFCC00August 17th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Attempt to fix the issue where the window doesn't update after entering a raid or reseting data.\n\n|cFFFFFF00v7.2.5.4434.124 (|cFFFFCC00August 10th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added buttons to create an aura at Aura tab on the Player Details window.\n\n|cFFFFFF00-|r Fixes and improvements on the damage rank panel.\n\n|cFFFFFF00-|r Best damage or healing for the player on the current boss encounter is now shown on the spec icon tooltip.\n\n|cFFFFFF00-|r Major revamp on the aura creation panel.\n\n|cFFFFFF00v7.2.5.4369.124 (|cFFFFCC00August 1st, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Details! can now track debuff applications (stack) and refreshes.\n\n|cFFFFFF00-|r Added new tab on Player Detail Window called 'Auras', you can see your buffs and debuffs from there.\n\n|cFFFFFF00-|r Death log now show debuff applications.\n\n|cFFFFFF00v7.2.5.4275.123 (|cFFFFCC00July 18th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed some issues with tooltiops popup when the user press SHIFT.\n\n|cFFFFFF00-|r Now is possible to change the bar durating when selecting Cast Start trigger on Details! Forge.\n\n|cFFFFFF00-|r Kil'Jaeden adds should be consolidated into only one actor instead of having one for each player targeted.\n\n|cFFFFFF00v7.2.5.4236.122 (|cFFFFCC00July 05th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r The alert to open the raid ranking after a boss kill, is now shown for 10 seconds (down from 40).\n\n|cFFFFFF00-|r Added a report button on the raid ranking panel and boss are sort alphabetically.\n\n|cFFFFFF00-|r Fixed some issues on the combatlog introduced on the wow patch 7.2.5 where sometimes the source of an event has no name.\n\n|cFFFFFF00-|r Ticket #209, fixed more issues with the comparison panel where are pets involved.\n\n|cFFFFFF00v7.2.5.4201.121 (|cFFFFCC00June 26th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed Monk Stagger where it was only shown on the friendly fire and not under the Damage Taken display.\n\n|cFFFFFF00-|r Added Forge and Ranking options on the main menu (orange cogwheel).\n\n|cFFFFFF00v7.2.5.4102.121 (|cFFFFCC00June 22th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Details! Forge has updated and now is more usder friendly.\n\n|cFFFFFF00-|r Fixed an issue with player buff uptime where sometimes some buffs wans't showing in the tooltip.\n\n|cFFFFFF00v7.2.5.3968.120 (|cFFFFCC00June 20th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r New Death Recap implemented! replaces the default from Blizzard and can be configured at Options > Raid Tools.\n\n|cFFFFFF00-|r New Guild Damage and Heal rank on '/details ranking' panel.\n\n|cFFFFFF00-|r Added a Guild Sync button on the Details! Ranking Panel.\n\n|cFFFFFF00-|r Added Custom display 'Damage on Shields', useful for encounter like Maiden of Vigilance where there's big shields to be removed and you want to know who is doing more damage to it.\n\n|cFFFFFF00-|r Added Heal Absorbed display under Heal bracket.\n\nHeal Absorb are the heal denied by abilities such like DK's Necrotic Strike or raid boss Sisters of the Moon 'Embrace of the Eclipse' ability.\nThe tooltip of this display shows which players got heal denied, which abilities absorbed the heal, which abilities tried to heal but got the heal denied.\n\n|cFFFFFF00-|r Added Alternate Power display under Energy bracket, it shows the total of alternate power gain from each player, useful for encounters such as Demonic Inquisition.\n\n|cFFFFFF00-|r 'First Hit' message after pulling a boss, now also shows who the boss is targeting (almost always is who pulled).\n\n|cFFFFFF00-|r Raid Dps {rdps} and Hps {rhps} can now be used on the Broker Data Feed..\n\n|cFFFFFF00-|r Fixed an issue with Chromie from the scenario 'The Deaths of Chromie' where she wasn't being shown on the meter.\n\n|cFFFFFF00-|r Fixed Paladin 'Light of the Martyr' damage to self.\n\n|cFFFFFF00-|r Ticket #198 'Script Error' Fixed.\n\n|cFFFFFF00v7.2.0.3703.119 (|cFFFFCC00May 29th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an error while killing low level mobs with warrior class.\n\n|cFFFFFF00v7.2.0.3693.118 (|cFFFFCC00May 25th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fury Warrior shouldn't be assigned as Protection any more.\n\n|cFFFFFF00-|r Some parser fixes.\n\n|cFFFFFF00v7.2.0.3673.118 (|cFFFFCC00May 09th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Ticket #187: Fixed an issue when comparing hunter pets on the player detail window.\n\n|cFFFFFF00-|r Ticket #189 #186: Fixed a taint issue for some classes when using friendly nameplates on.\n\n|cFFFFFF00v7.2.0.3512.116 (|cFFFFCC00April 27th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Havoc Demon Hunter: your fury energy is being shown under Mana Restored (don't ask me why, the combat log is telling us it's mana).\n\n|cFFFFFF00-|r Pets now are shown on damage tooltips.\n\n|cFFFFFF00-|r Pets are now also shown on the comparison panel.\n\n|cFFFFFF00v7.2.0.3474.116 (|cFFFFCC00April 20th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Plugin: Raid Check > added some food buffs which wasn't being tracked.\n\n|cFFFFFF00v7.2.0.3467.116 (|cFFFFCC00April 07th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fix for the custom display window where apply and cancel buttons where over the edit window.\n\n|cFFFFFF00-|r Fix for an issue on editing a bookmark.\n\n|cFFFFFF00v7.1.5.3459.116 (|cFFFFCC00Mar 21th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue on dynamic overall data where it wasn't showing DPS.\n\n|cFFFFFF00-|r Fixed an issue with Apply, Save and Cancel buttons when editing a custom display.\n\n|cFFFFFF00-|r Removed the Damage and Healing presets for custom displays, now is only possible create custom displays by scripting them.\n\n|cFFFFFF00v7.1.5.3431.116 (|cFFFFCC00Mar 15th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with bar orientation right to left where fixed bar color isn't working.\n\n|cFFFFFF00-|r The nickname field now use FrizQuadrataTT font and shall be compatible with Cyrillic.\n\n|cFFFFFF00v7.1.5.3418.116 (|cFFFFCC00Mar 1st, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Ticket #167 fix: Light of the Martyr self-damage now does reduce the healing done (following WCL method).\n\n|cFFFFFF00-|r Ticket #169 fix: Damage Prevented is now working for new segments.\n\n|cFFFFFF00-|r Fixed an issue where sometimes BeastMaster's Hati pet wasn't detected correctly.\n\n|cFFFFFF00v7.1.5.3369.116 (|cFFFFCC00Feb 07th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added custom display 'Dynamic Overall Damage' for mythic dungeons.\n\n|cFFFFFF00-|r Fix for Ticket #168: 'Auto Hide While [Not] Inside Instance is broken'.\n\n|cFFFFFF00-|r The bar truncate frame 'DetailsLeftTextAntiTruncate' is now created on Details! load instead on demand.\n\n|cFFFFFF00v7.1.5.3315.116 (|cFFFFCC00Jan 23th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Ticket #162: 'no Monochrome font' available, added an experimental slash command: /run _detalhes:UseOutline ('MONOCHROME').\n\n|cFFFFFF00-|r Ticket #158: 'no elapsed time shown on report to chat', added the elapsed time when reporting a segment.\n\n|cFFFFFF00-|r Ticket #164: 'error when browsing segments', an attempt to fix the problem has been made.\n\n|cFFFFFF00v7.1.5.3305.116 (|cFFFFCC00Jan 15th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Another fix for mythic dungeons overall data reset (thanks Tharai @ Curseforge).\n\n|cFFFFFF00-|r Fix for spec detection on PvP Arenas (thanks Pas06 @ Curseforge).\n\n|cFFFFFF00v7.1.0.3276.115 (|cFFFFCC00Jan 08th, 2017|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed the overall data not reseting when starting a new mythic+ dungeon.\n\n|cFFFFFF00v7.1.0.3266.115 (|cFFFFCC00Dec 29th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed an issue with overall data not updating correctly at the end of the combat.\n\n|cFFFFFF00-|r Added a tutorial line on the window when the user access overall data.\n\n|cFFFFFF00v7.1.0.3236.115 (|cFFFFCC00Dec 19th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Integration with BigWigs should be working okay now.\n\n|cFFFFFF00v7.1.0.3231.115 (|cFFFFCC00Dec 15th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Disabled the link with BigWigs to avoid the 'RegisterMessage' error on every login.\n\n|cFFFFFF00v7.1.0.3229.115 (|cFFFFCC00Dec 09th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r When a window is locked, resize grips shouldn't be enabled messing with bar mouse over.\n\n|cFFFFFF00v7.0.3.3222.115 (|cFFFFCC00November 28th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added Unstable Affliction to common spells with the same name.\n\n|cFFFFFF00-|r Fixed few issues with built-in plugins.\n\n|cFFFFFF00v7.0.3.3202.115 (|cFFFFCC00November 08th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Weakauras creator from the Encounter Details plugin and '/details forge' shall work correctly now with Trials of Valor.\n\n|cFFFFFF00-|r Raid history should now be recording your Trials of Valor kills.\n\n|cFFFFFF00-|r Added Trials of Valor raid info, good luck and have fun!.\n\n|cFFFFFF00v7.0.3.3201.115 (|cFFFFCC00November 04th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fix for Paladin holy icon.\n\n|cFFFFFF00-|r Fix for Rogue outlaw icon.\n\n|cFFFFFF00-|r Fixed misc displays with bar sorted by ascending order.\n\n|cFFFFFF00-|r Fix for '/details show' command while the window is on auto hide.\n\n|cFFFFFF00v7.0.3.3114.115 (|cFFFFCC00October 26th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Encounter Details (plugin): tooltip tutorial is now clamped to screen and its close button should be visible.\n\n|cFFFFFF00-|r Raid Check (plugin): now also works on dungeons.\n\n|cFFFFFF00-|r Added Potion of the Prolongued Power to the tracker.\n\n|cFFFFFF00v7.1.0.3097.115 (|cFFFFCC00October 25th, 2016|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r renamed 'report history' to 'latest reports'.\n\n|cFFFFFF00-|r attempt to make all Details! users on the party or raid to track rogue's akaari's soul." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails!:|r " diff --git a/core/control.lua b/core/control.lua index b4479367..c0e5801a 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1588,7 +1588,7 @@ if (instancia.rows_showing == 0 and instancia:GetSegment() == -1) then -- -1 overall data if (not instancia:IsShowingOverallDataWarning()) then local tutorial = _detalhes:GetTutorialCVar ("OVERALLDATA_WARNING1") or 0 - if (tutorial < 10) then + if ((type (tutorial) == "number") and (tutorial < 10)) then _detalhes:SetTutorialCVar ("OVERALLDATA_WARNING1", tutorial + 1) instancia:ShowOverallDataWarning (true) end diff --git a/functions/dungeon.lua b/functions/dungeon.lua new file mode 100644 index 00000000..8be4a429 --- /dev/null +++ b/functions/dungeon.lua @@ -0,0 +1,422 @@ + + +--> dungeon file + + + +--local pointer to details object +local Details = _G._detalhes +local debugmode = true + +--constants +local CONST_USE_PLAYER_EDPS = false + +--> Generate damage chart for mythic dungeon runs + +--[=[ +The chart table needs to be stored saparated from the combat +Should the chart data be volatile? + +--]=] + +local mythicDungeonCharts = Details:CreateEventListener() + +function mythicDungeonCharts:Debug (...) + if (debugmode) then + print ("Details! DungeonCharts (debug.Alpha " .. Details.build_counter .. "." .. Details.realversion .. " ): ", ...) + end +end + +local addPlayerDamage = function (unitName, unitRealm) + + --get the combatlog name + local CLName + if (unitRealm and unitRealm ~= "") then + CLName = unitName .. "-" .. unitRealm + else + CLName = unitName + end + + --get the player data + local playerData = mythicDungeonCharts.ChartTable.Players [CLName] + + --if this is the first tick for the player, ignore the damage done on this tick + --this is done to prevent a tick tick with all the damage the player did on the previous segment + local bIsFirstTick = false + + --check if the player data doesn't exists + if (not playerData) then + playerData = { + Name = unitName, + ChartData = {max_value = 0}, + Class = select (2, UnitClass (CLName)), + + --spec zero for now, need to retrive later during combat + Spec = 0, + + --last damage to calc difference + LastDamage = 0, + + --if started a new combat, need to reset the lastdamage + LastCombatID = -1, + } + + mythicDungeonCharts.ChartTable.Players [CLName] = playerData + bIsFirstTick = true + end + + --get the current combat + local currentCombat = Details:GetCombat (DETAILS_SEGMENTID_CURRENT) + if (currentCombat) then + + local isOverallSegment = false + + local mythicDungeonInfo = currentCombat.is_mythic_dungeon + if (mythicDungeonInfo) then + if (mythicDungeonInfo.TrashOverallSegment or mythicDungeonInfo.OverallSegment) then + isOverallSegment = true + end + end + + if (not isOverallSegment) then + --check if the combat has changed + local segmentId = currentCombat.combat_id + if (segmentId ~= playerData.LastCombatID) then + playerData.LastDamage = 0 + playerData.LastCombatID = segmentId + + --mythicDungeonCharts:Debug ("Combat changed for player", CLName) + end + + local actorTable = currentCombat:GetActor (DETAILS_ATTRIBUTE_DAMAGE, CLName) + if (actorTable) then + --update the player spec + playerData.Spec = actorTable.spec + + if (bIsFirstTick) then + --ignore previous damage + playerData.LastDamage = actorTable.total + end + + --get the damage done + local damageDone = actorTable.total + + --check which data is used, dps or damage done + if (CONST_USE_PLAYER_EDPS) then + local eDps = damageDone / currentCombat:GetCombatTime() + + --add the damage to the chart table + tinsert (playerData.ChartData, eDps) + --mythicDungeonCharts:Debug ("Added dps for " , CLName, ":", eDps) + + if (eDps > playerData.ChartData.max_value) then + playerData.ChartData.max_value = eDps + end + else + --calc the difference and add to the table + local damageDiff = floor (damageDone - playerData.LastDamage) + playerData.LastDamage = damageDone + + --add the damage to the chart table + tinsert (playerData.ChartData, damageDiff) + --mythicDungeonCharts:Debug ("Added damage for " , CLName, ":", damageDiff) + + if (damageDiff > playerData.ChartData.max_value) then + playerData.ChartData.max_value = damageDiff + end + end + else + --player still didn't made anything on this combat, so just add zero + tinsert (playerData.ChartData, 0) + end + end + end +end + +local tickerCallback = function (tickerObject) + + --check if is inside the dungeon + local inInstance = IsInInstance(); + if (not inInstance) then + mythicDungeonCharts:OnEndMythicDungeon() + return + end + + --check if still running the dungeon + if (not mythicDungeonCharts.ChartTable or not mythicDungeonCharts.ChartTable.Running) then + tickerObject:Cancel() + return + end + + --tick damage + local totalPlayers = GetNumGroupMembers() + for i = 1, totalPlayers-1 do + local unitName, unitRealm = UnitName ("party" .. i) + if (unitName) then + addPlayerDamage (unitName, unitRealm) + end + end + + addPlayerDamage (UnitName ("player")) +end + +function mythicDungeonCharts:OnBossDefeated() + + local currentCombat = Details:GetCurrentCombat() + local segmentType = currentCombat:GetCombatType() + local bossInfo = currentCombat:GetBossInfo() + + print (mythicDungeonCharts.ChartTable, mythicDungeonCharts.ChartTable.Running, segmentType, bossInfo) + + if (mythicDungeonCharts.ChartTable and mythicDungeonCharts.ChartTable.Running and bossInfo) then + + local copiedBossInfo = Details:GetFramework().table.copy ({}, bossInfo) + tinsert (mythicDungeonCharts.ChartTable.BossDefeated, {time() - mythicDungeonCharts.ChartTable.StartTime, copiedBossInfo, currentCombat:GetCombatTime()}) + mythicDungeonCharts:Debug ("Boss defeated, time saved", currentCombat:GetCombatTime()) + else + if (mythicDungeonCharts.ChartTable.EndTime ~= -1) then + local now = time() + --check if the dungeon just ended + if (mythicDungeonCharts.ChartTable.EndTime + 2 >= now) then + + if (bossInfo) then + local copiedBossInfo = Details:GetFramework().table.copy ({}, bossInfo) + tinsert (mythicDungeonCharts.ChartTable.BossDefeated, {time() - mythicDungeonCharts.ChartTable.StartTime, copiedBossInfo, currentCombat:GetCombatTime()}) + mythicDungeonCharts:Debug ("Boss defeated, time saved, but used time aproximation:", mythicDungeonCharts.ChartTable.EndTime + 2, now, currentCombat:GetCombatTime()) + end + end + else + mythicDungeonCharts:Debug ("Boss defeated, but no chart capture is running") + end + end +end + +function mythicDungeonCharts:OnStartMythicDungeon() + + if (not Details.mythic_plus.show_damage_graphic) then + mythicDungeonCharts:Debug ("Dungeon started, no capturing mythic dungeon chart data, disabled on profile") + return + else + mythicDungeonCharts:Debug ("Dungeon started, new capture started") + end + + mythicDungeonCharts.ChartTable = { + Running = true, + Players = {}, + ElapsedTime = 0, + StartTime = time(), + EndTime = -1, + DungeonName = "", + + --store when each boss got defeated in comparison with the StartTime + BossDefeated = {}, + } + + mythicDungeonCharts.ChartTable.Ticker = C_Timer.NewTicker (1, tickerCallback) + + _detalhes.mythic_plus.last_mythicrun_chart = mythicDungeonCharts.ChartTable +end + +function mythicDungeonCharts:OnEndMythicDungeon() + if (mythicDungeonCharts.ChartTable and mythicDungeonCharts.ChartTable.Running) then + mythicDungeonCharts.ChartTable.Running = false + mythicDungeonCharts.ChartTable.ElapsedTime = time() - mythicDungeonCharts.ChartTable.StartTime + mythicDungeonCharts.ChartTable.EndTime = time() + mythicDungeonCharts.ChartTable.Ticker:Cancel() + + local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo() + mythicDungeonCharts.ChartTable.DungeonName = name + + mythicDungeonCharts:Debug ("Dungeon ended, chart data capture stopped") + + mythicDungeonCharts.ShowChart() + else + mythicDungeonCharts:Debug ("Dungeon ended, no chart data was running") + end +end + +mythicDungeonCharts:RegisterEvent ("COMBAT_MYTHICDUNGEON_START", "OnStartMythicDungeon") +mythicDungeonCharts:RegisterEvent ("COMBAT_MYTHICDUNGEON_END", "OnEndMythicDungeon") +mythicDungeonCharts:RegisterEvent ("COMBAT_BOSS_DEFEATED", "OnBossDefeated") + +function mythicDungeonCharts.ShowChart() + + if (not mythicDungeonCharts.Frame) then + + mythicDungeonCharts.Frame = CreateFrame ("frame", "DetailsMythicDungeonChartFrame", UIParent) + local f = mythicDungeonCharts.Frame + + f:SetSize (1210, 600) + f:SetPoint ("center", UIParent, "center", 0, 0) + f:SetFrameStrata ("LOW") + f:EnableMouse (true) + f:SetMovable (true) + f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + f:SetBackdropColor (0, 0, 0, 0.9) + f:SetBackdropBorderColor (0, 0, 0, 1) + + tinsert (UISpecialFrames, "DetailsMythicDungeonChartFrame") + + --register to libwindow + local LibWindow = LibStub ("LibWindow-1.1") + LibWindow.RegisterConfig (f, Details.mythic_plus.mythicrun_chart_frame) + LibWindow.RestorePosition (f) + LibWindow.MakeDraggable (f) + LibWindow.SavePosition (f) + + f.ChartFrame = Details:GetFramework():CreateChartPanel (f, 1200, 600, "DetailsMythicDungeonChartGraphicFrame") + f.ChartFrame:SetPoint ("topleft", f, "topleft", 5, 0) + + f.ChartFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + f.ChartFrame:SetBackdropColor (0, 0, 0, 0.0) + f.ChartFrame:SetBackdropBorderColor (0, 0, 0, 0) + + f.ChartFrame.CloseButton:Hide() + + f.BossWidgetsFrame = CreateFrame ("frame", "$parentBossFrames", f) + f.BossWidgetsFrame:SetFrameLevel (f:GetFrameLevel()+10) + f.BossWidgetsFrame.Widgets = {} + + function f.ChartFrame.RefreshBossTimeline (self, bossTable, elapsedTime) + + for i, bossTable in ipairs (mythicDungeonCharts.ChartTable.BossDefeated) do + + local bossWidget = f.BossWidgetsFrame.Widgets [i] + if (not bossWidget) then + local newBossWidget = CreateFrame ("frame", "$parentBossWidget" .. i, f.BossWidgetsFrame) + newBossWidget:SetSize (64, 32) + newBossWidget:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + newBossWidget:SetBackdropColor (0, 0, 0, 0.1) + newBossWidget:SetBackdropBorderColor (0, 0, 0, 0) + + local bossAvatar = Details:GetFramework():CreateImage (newBossWidget, "", 64, 32, "border") + bossAvatar:SetPoint ("bottomleft", newBossWidget, "bottomleft", 0, 0) + newBossWidget.AvatarTexture = bossAvatar + + local verticalLine = Details:GetFramework():CreateImage (newBossWidget, "", 1, f.ChartFrame.Graphic:GetHeight(), "overlay") + verticalLine:SetColorTexture (1, 1, 1, 0.3) + verticalLine:SetPoint ("bottomleft", newBossWidget, "bottomright", 0, 0) + + local timeText = Details:GetFramework():CreateLabel (newBossWidget) + timeText:SetPoint ("bottomright", newBossWidget, "bottomright", 0, 0) + newBossWidget.TimeText = timeText + + local timeBackground = Details:GetFramework():CreateImage (newBossWidget, "", 30, 12, "artwork") + timeBackground:SetColorTexture (0, 0, 0, 0.5) + timeBackground:SetPoint ("topleft", timeText, "topleft", -2, 2) + timeBackground:SetPoint ("bottomright", timeText, "bottomright", 2, 0) + + f.BossWidgetsFrame.Widgets [i] = newBossWidget + bossWidget = newBossWidget + end + + local chartLength = f.ChartFrame.Graphic:GetWidth() + local secondsPerPixel = chartLength / elapsedTime + local xPosition = bossTable[1] * secondsPerPixel + + bossWidget:SetPoint ("bottomright", f.ChartFrame.Graphic, "bottomleft", xPosition, 0) + + bossWidget.TimeText:SetText (Details:GetFramework():IntegerToTimer (bossTable[1])) + + if (bossTable[2].bossimage) then + bossWidget.AvatarTexture:SetTexture (bossTable[2].bossimage) + else + local bossAvatar = Details:GetBossPortrait (nil, nil, bossTable[2].name, bossTable[2].ej_instance_id) + bossWidget.AvatarTexture:SetTexture (bossAvatar) + end + end + end + + end + + mythicDungeonCharts.Frame.ChartFrame:Reset() + + if (not mythicDungeonCharts.ChartTable) then + --load the last mythic dungeon run chart + local t = {} + Details:GetFramework().table.copy (t, Details.mythic_plus.last_mythicrun_chart) + mythicDungeonCharts.ChartTable = t + end + + local charts = mythicDungeonCharts.ChartTable.Players + + for playerName, playerTable in pairs (charts) do + + local chartData = playerTable.ChartData + local lineName = playerTable.Name + + local lineColor = {1, 1, 1, 1} + local classColor = RAID_CLASS_COLORS [playerTable.Class] + if (classColor) then + lineColor [1] = classColor.r + lineColor [2] = classColor.g + lineColor [3] = classColor.b + + --print (playerName, playerTable.Class) + end + + local combatTime = mythicDungeonCharts.ChartTable.ElapsedTime + local texture = "line" + + --lowess smooth + --chartData = mythicDungeonCharts.LowessSmoothing (chartData, 75) + chartData = mythicDungeonCharts.Frame.ChartFrame:CalcLowessSmoothing (chartData, 75) + + local maxValue = 0 + for i = 1, #chartData do + if (chartData [i] > maxValue) then + maxValue = chartData [i] + end + end + chartData.max_value = maxValue + + mythicDungeonCharts.Frame.ChartFrame:AddLine (chartData, lineColor, lineName, combatTime, texture, "SMA") + + --[=[ + local smoothFactor = 0.075 + local forecastSmoothFactor = 1 - smoothFactor + local lastForecast = chartData[1] + local chartLag = {lastForecast} + local maxValue = lastForecast + + for i = 2, #chartData do + local forecast = (chartData[i] * smoothFactor) + (lastForecast * forecastSmoothFactor) + tinsert (chartLag, forecast) + lastForecast = forecast + + if (forecast > maxValue) then + maxValue = forecast + end + end + chartLag.max_value = maxValue + + mythicDungeonCharts.Frame.ChartFrame:AddLine (chartLag, lineColor, lineName, combatTime, texture, "SMA") + --]=] + end + + + mythicDungeonCharts.Frame.ChartFrame:RefreshBossTimeline (mythicDungeonCharts.ChartTable.BossDefeated, mythicDungeonCharts.ChartTable.ElapsedTime) + + --generate boss time table + local bossTimeTable = {} + for i, bossTable in ipairs (mythicDungeonCharts.ChartTable.BossDefeated) do + local combatTime = bossTable [3] or math.random (10, 30) + + tinsert (bossTimeTable, bossTable[1]) + tinsert (bossTimeTable, bossTable[1] - combatTime) + end + + mythicDungeonCharts.Frame.ChartFrame:AddOverlay (bossTimeTable, {1, 1, 1, 0.05}, "Boss Combat Time", "") + + + local phrase = " Average Dps (under development)\npress Escape to hide, Details! Alpha Build." .. _detalhes.build_counter .. "." .. _detalhes.realversion + + mythicDungeonCharts.Frame.ChartFrame:SetTitle (mythicDungeonCharts.ChartTable.DungeonName and mythicDungeonCharts.ChartTable.DungeonName .. phrase or phrase) + Details:GetFramework():SetFontSize (mythicDungeonCharts.Frame.ChartFrame.chart_title, 14) + + +end + +--C_Timer.After (1, mythicDungeonCharts.ShowChart) + +-- endd diff --git a/functions/profiles.lua b/functions/profiles.lua index 7e0c9074..07d30006 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1307,6 +1307,9 @@ local default_global_data = { boss_dedicated_segment = true, -- make_overall_when_done = true, -- make_overall_boss_only = false, -- + show_damage_graphic = true, + last_mythicrun_chart = {}, + mythicrun_chart_frame = {}, }, --> plugin window positions diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index b56bbdc8..eacc7ead 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -2143,8 +2143,7 @@ local icon_frame_on_enter = function (self) elseif (actor.dead_at) then - else - --> is a normal actor + elseif (actor.name) then --ensure it's an actor table local serial = actor.serial local name = actor:name()