- Added damage chart at the end of a mythic dungeon run.
- Framework update to v66.
This commit is contained in:
@@ -43,6 +43,7 @@ functions\timedata.lua
|
||||
functions\report.lua
|
||||
functions\rowanimation.lua
|
||||
functions\raidinfo.lua
|
||||
functions\dungeon.lua
|
||||
|
||||
core\timemachine.lua
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
local dversion = 65
|
||||
local dversion = 66
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary (major, minor)
|
||||
|
||||
|
||||
+99
-22
@@ -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)
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user