Added Mythic+ Overall's time types

This commit is contained in:
Tercio Jose
2023-12-01 12:30:19 -03:00
parent 0ff046b500
commit eb8c9894a5
6 changed files with 130 additions and 81 deletions
+44 -44
View File
@@ -519,12 +519,16 @@ detailsFramework.EditorMixin = {
---@param anchorSettings df_anchor
StartObjectMovement = function(self, anchorSettings)
local object = self:GetEditingObject()
local moverFrame = self:GetMoverFrame()
--self:UpdateGuideLinesAnchors()
local moverFrame = self:GetMoverFrame()
moverFrame:EnableMouse(true)
moverFrame:SetMovable(true)
moverFrame:ClearAllPoints()
moverFrame:Show()
--update guidelines
if (self:GetEditingOptions().use_guide_lines) then
--self:UpdateGuideLinesAnchors()
--show all four guidelines
for side, texture in pairs(self.moverGuideLines) do
texture:Show()
@@ -533,56 +537,43 @@ detailsFramework.EditorMixin = {
local optionsFrame = self:GetOptionsFrame()
moverFrame:EnableMouse(true)
moverFrame:SetMovable(true)
moverFrame:ClearAllPoints()
moverFrame:Show()
--update the mover frame size to match the object size
if (object:GetObjectType() == "FontString") then
---@cast object fontstring
local width = object:GetStringWidth()
local height = object:GetStringHeight()
moverFrame:SetSize(width, height)
else
local width, height = object:GetSize()
moverFrame:SetSize(width, height)
end
for i = 1, object:GetNumPoints() do
local point, relativeTo, relativePoint, x, y = object:GetPoint(i)
moverFrame:SetPoint(point, relativeTo, relativePoint, x, y)
end
local objectWidth, objectHeight = object:GetSize()
moverFrame:SetSize(objectWidth, objectHeight)
detailsFramework:SetAnchor(moverFrame, anchorSettings, object:GetParent())
local currentPosX, currentPosY
moverFrame:SetScript("OnMouseDown", function()
object:ClearAllPoints()
object:SetPoint("topleft", moverFrame, "topleft", 0, 0)
currentPosX, currentPosY = moverFrame:GetCenter()
moverFrame:SetBackdropBorderColor(1, 1, 0, 0)
for i = 1, object:GetNumPoints() do
local point, relativeTo, relativePoint, x, y = object:GetPoint(i)
moverFrame:SetPoint(point, relativeTo, relativePoint, x, y)
end
moverFrame:StartMoving()
moverFrame.bIsMoving = true
moverFrame:StartMoving()
end)
moverFrame:SetScript("OnMouseUp", function()
moverFrame:StopMovingOrSizing()
moverFrame.bIsMoving = false
local originX = anchorSettings.x
local originY = anchorSettings.y
local newPosX, newPosY = moverFrame:GetCenter()
local xOffset = newPosX - currentPosX
local yOffset = newPosY - currentPosY
anchorSettings.x = originX + xOffset
anchorSettings.y = originY + yOffset
local anchorXSlider = optionsFrame:GetWidgetById("anchoroffsetx")
anchorXSlider:SetValueNoCallback(anchorSettings.x)
local anchorYSlider = optionsFrame:GetWidgetById("anchoroffsety")
anchorYSlider:SetValueNoCallback(anchorSettings.y)
object:ClearAllPoints()
detailsFramework:SetAnchor(object, anchorSettings, object:GetParent())
moverFrame:ClearAllPoints()
for i = 1, object:GetNumPoints() do
local point, relativeTo, relativePoint, x, y = object:GetPoint(i)
moverFrame:SetPoint(point, relativeTo, relativePoint, x, y)
end
end)
--detailsFramework:SetAnchor(moverFrame, anchorSettings)
@@ -590,9 +581,9 @@ detailsFramework.EditorMixin = {
moverFrame:SetScript("OnUpdate", function()
--if the object isn't moving, make the mover follow the object position
if (moverFrame.bIsMoving) then
object:ClearAllPoints()
object:SetPoint("topleft", moverFrame, "topleft", 0, 0)
if (false and moverFrame.bIsMoving) then
--object:ClearAllPoints()
--object:SetPoint("topleft", moverFrame, "topleft", 0, 0)
--if the object is moving, check if the moverFrame has moved
local newPosX, newPosY = moverFrame:GetCenter()
@@ -668,6 +659,10 @@ detailsFramework.EditorMixin = {
localizedLabel = type(localizedLabel) == "string" and localizedLabel or "invalid label"
--a button to select the widget
local selectButton = CreateFrame("button", "$parentSelectButton" .. id, object:GetParent())
selectButton:SetAllPoints(object)
---@type df_editor_objectinfo
local objectRegistered = {
object = object,
@@ -678,8 +673,13 @@ detailsFramework.EditorMixin = {
extraoptions = extraOptions or {},
callback = callback,
options = options,
selectButton = selectButton,
}
selectButton:SetScript("OnClick", function()
self:EditObject(objectRegistered)
end)
registeredObjects[#registeredObjects+1] = objectRegistered
self.registeredObjectsByID[id] = objectRegistered
@@ -862,6 +862,7 @@ local editorDefaultOptions = {
---@field extraoptions table
---@field callback function
---@field options df_editobjectoptions
---@field selectButton button
function detailsFramework:CreateEditor(parent, name, options)
name = name or ("DetailsFrameworkEditor" .. math.random(100000, 10000000))
@@ -904,10 +905,9 @@ function detailsFramework:CreateEditor(parent, name, options)
--frame that is used to move the object
local moverFrame = CreateFrame("frame", "$parentMoverFrame", OTTFrame, "BackdropTemplate")
moverFrame:SetClampedToScreen(true)
moverFrame:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = 1,
})
detailsFramework:ApplyStandardBackdrop(moverFrame)
moverFrame:SetBackdropColor(.10, .10, .10, 0)
moverFrame.__background:SetAlpha(0.1)
editorFrame.moverFrame = moverFrame
editorFrame:CreateMoverGuideLines()
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 484
local dversion = 485
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
+18 -9
View File
@@ -686,7 +686,23 @@ end
detailsFramework.CanvasScrollBoxMixin = {
SetScrollSpeed = function(self, speed)
assert(type(speed) == "number", "CanvasScrollBox:SetScrollSpeed(speed): speed must be a number.")
self.scrollStep = speed
end,
GetScrollSpeed = function(self)
return self.scrollStep
end,
OnVerticalScroll = function(self, delta)
local scrollStep = self:GetScrollSpeed()
if (delta > 0) then
self:SetVerticalScroll(math.max(self:GetVerticalScroll() - scrollStep, 0))
else
self:SetVerticalScroll(math.min(self:GetVerticalScroll() + scrollStep, self:GetVerticalScrollRange()))
end
end,
}
local canvasScrollBoxDefaultOptions = {
@@ -707,16 +723,9 @@ function detailsFramework:CreateCanvasScrollBox(parent, child, name, options)
---@type df_canvasscrollbox
local canvasScrollBox = CreateFrame("scrollframe", name or ("DetailsFrameworkCanvasScroll" .. math.random(50000, 10000000)), parent, "BackdropTemplate, UIPanelScrollFrameTemplate")
canvasScrollBox.scrollStep = 20
canvasScrollBox.minValue = 0
canvasScrollBox:SetScript("OnMouseWheel", function(self, value)
local scrollBar = self
local scrollStep = scrollBar.scrollStep or scrollBar:GetHeight() / 2
if ( value > 0 ) then
scrollBar:SetVerticalScroll(scrollBar:GetVerticalScroll() - scrollStep)
else
scrollBar:SetVerticalScroll(scrollBar:GetVerticalScroll() + scrollStep)
end
end)
canvasScrollBox:SetScript("OnMouseWheel", detailsFramework.CanvasScrollBoxMixin.OnVerticalScroll)
detailsFramework:Mixin(canvasScrollBox, detailsFramework.CanvasScrollBoxMixin)
detailsFramework:Mixin(canvasScrollBox, detailsFramework.OptionsFunctions)
+39 -26
View File
@@ -2738,41 +2738,54 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra
local currentCombat = Details:GetCurrentCombat()
--calculate the actor dps
if ((Details.time_type == 2 and self.grupo) or not Details:CaptureGet("damage") or instanceObject.segmento == -1 or Details.use_realtimedps) then
if (Details.use_realtimedps and Details.in_combat) then
local currentDps = self.last_dps_realtime
if (currentDps) then
dps = currentDps
end
if (currentCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
if (Details.mythic_plus.mythicrun_time_type == 1) then
--total time in combat, activity time
combatTime = currentCombat:GetCombatTime()
elseif (Details.mythic_plus.mythicrun_time_type == 2) then
--elapsed time of the run
combatTime = currentCombat:GetRunTime()
end
if (not dps) then
if (instanceObject.segmento == -1 and combatTime == 0) then
local actor = currentCombat(1, self.nome)
if (actor) then
local combatTime = actor:Tempo()
dps = damageTotal / combatTime
self.last_dps = dps
dps = damageTotal / combatTime
self.last_dps = dps
else
--calculate the actor dps
if ((Details.time_type == 2 and self.grupo) or not Details:CaptureGet("damage") or instanceObject.segmento == -1 or Details.use_realtimedps) then
if (Details.use_realtimedps and Details.in_combat) then
local currentDps = self.last_dps_realtime
if (currentDps) then
dps = currentDps
end
end
if (not dps) then
if (instanceObject.segmento == -1 and combatTime == 0) then
local actor = currentCombat(1, self.nome)
if (actor) then
local combatTime = actor:Tempo()
dps = damageTotal / combatTime
self.last_dps = dps
else
dps = damageTotal / combatTime
self.last_dps = dps
end
else
dps = damageTotal / combatTime
self.last_dps = dps
end
else
dps = damageTotal / combatTime
self.last_dps = dps
end
end
else
if (not self.on_hold) then
dps = damageTotal/self:Tempo() --calcula o dps deste objeto
self.last_dps = dps --salva o dps dele
else
if (self.last_dps == 0) then --no calculou o dps dele ainda mas entrou em standby
dps = damageTotal/self:Tempo()
self.last_dps = dps
if (not self.on_hold) then
dps = damageTotal/self:Tempo() --calcula o dps deste objeto
self.last_dps = dps --salva o dps dele
else
dps = self.last_dps
if (self.last_dps == 0) then --no calculou o dps dele ainda mas entrou em standby
dps = damageTotal/self:Tempo()
self.last_dps = dps
else
dps = self.last_dps
end
end
end
end
+26
View File
@@ -6891,6 +6891,32 @@ do
local sectionOptions = {
{type = "label", get = function() return Loc["STRING_OPTIONS_GENERAL_ANCHOR"] end, text_template = subSectionTitleTextTemplate},
{
type = "toggle",
get = function() return Details.mythic_plus.mythicrun_time_type == 1 end,
set = function(self, fixedparam, value)
Details.mythic_plus.mythicrun_time_type = value and 1
sectionFrame:GetWidgetById("mythic_time_2"):SetValue(not value)
end,
name = "Use Total Combat Time",
desc = "The overall segment for the Mythic+ run will use 'totalDamage / totalCombatTime' to calculate DPS.",
id = "mythic_time_1",
},
{
type = "toggle",
get = function() return Details.mythic_plus.mythicrun_time_type == 2 end,
set = function(self, fixedparam, value)
Details.mythic_plus.mythicrun_time_type = value and 2
sectionFrame:GetWidgetById("mythic_time_1"):SetValue(not value)
end,
name = "Use Run Time",
desc = "The overall segment for the Mythic+ run will use 'totalDamage / runTime' to calculate DPS.",
id = "mythic_time_2",
},
{type = "blank"},
{--dedicated segment for bosses
type = "toggle",
get = function() return Details.mythic_plus.boss_dedicated_segment end,
+2 -1
View File
@@ -495,6 +495,7 @@ function Details:ApplyProfile(profileName, bNoSave, bIsCopy)
Details.time_type = 2
end
--enable all captures, this is a fix for the old performance profiles which doesn't exiss anymore
Details.capture_real["damage"] = true
Details.capture_real["heal"] = true
Details.capture_real["energy"] = true
@@ -1523,7 +1524,7 @@ local default_global_data = {
ctrl_click_close_tutorial = false,
},
performance_profiles = {
performance_profiles = { --deprecated
["RaidFinder"] = {enabled = false, update_speed = 1, use_row_animations = false, damage = true, heal = true, aura = true, energy = false, miscdata = true},
["Raid15"] = {enabled = false, update_speed = 1, use_row_animations = false, damage = true, heal = true, aura = true, energy = false, miscdata = true},
["Raid30"] = {enabled = false, update_speed = 1, use_row_animations = false, damage = true, heal = true, aura = true, energy = false, miscdata = true},