Skip to content

Commit

Permalink
Framework and Lib OpenRaid updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Dec 18, 2023
1 parent 298228e commit 2a2e9eb
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
---@field deploy fun(tblReceiving:table, tblGiving:table) : table copy keys/values that does exist on tblGiving but not in tblReceiving
---@field copytocompress fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index, functions and tables with a 'GetObjectType' key
---@field removeduplicate fun(tbl1:table, tbl2:table) remove the keys from table1 which also exists in table2 with the same value
---@field getfrompath fun(tbl:table, path:string) : any get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c
---@field getfrompath fun(tbl:table, path:string, subOffset:number?) : any get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c; if subOffset is passed, return the subOffset'th value of the path
---@field setfrompath fun(tbl:table, path:string, value:any) : boolean set the value of a table using a path, e.g. setfrompath(tbl, "a.b.c", 10) is the same as tbl.a.b.c = 10
---@field dump fun(tbl:table) : string dump a table to a string

Expand Down
52 changes: 37 additions & 15 deletions Libs/DF/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ detailsFramework.EditorMixin = {

local anchorSettings

--table to use on DF:BuildMenu()
--table to use on DF:BuildMenuVolatile()
local menuOptions = {}
for i = 1, #attributeList do
local option = attributeList[i]
Expand Down Expand Up @@ -418,11 +418,7 @@ detailsFramework.EditorMixin = {
maxValue = object:GetParent():GetHeight()/2
end

if (option.name == "classcolor") then print("", value) end

if (bHasValue) then
if (option.name == "classcolor") then print("HERE", value) end

local parentTable = getParentTable(profileTable, profileKey)

if (option.name == "anchor" or option.name == "anchoroffsetx" or option.name == "anchoroffsety") then
Expand All @@ -435,7 +431,12 @@ detailsFramework.EditorMixin = {
get = function() return value end,
set = function(widget, fixedValue, newValue, ...)
--color is a table with 4 indexes for each color plus alpha
if (option.widget == "color") then
if (option.widget == "range" or option.widget == "slider") then
if (not option.usedecimals) then
newValue = math.floor(newValue)
end

elseif (option.widget == "color") then
--calor callback sends the red color in the fixedParameter slot
local r, g, b, alpha = fixedValue, newValue, ...
--need to use the same table from the profile table
Expand Down Expand Up @@ -488,6 +489,7 @@ detailsFramework.EditorMixin = {
menuOptions.align_as_pairs = true
menuOptions.align_as_pairs_length = 150
menuOptions.widget_width = 180
menuOptions.slider_buttons_to_left = true

local optionsFrame = self:GetOptionsFrame()
local canvasScrollBox = self:GetCanvasScrollBox()
Expand Down Expand Up @@ -814,11 +816,16 @@ detailsFramework.EditorMixin = {

return selectObjectScrollBox
end,

OnHide = function(self)
self:StopObjectMovement()
end,
}

---@class df_editor_defaultoptions : table
---@field width number
---@field height number
---@field options_width number
---@field create_object_list boolean
---@field object_list_width number
---@field object_list_height number
Expand All @@ -828,7 +835,8 @@ detailsFramework.EditorMixin = {
---@class df_editor_defaultoptions
local editorDefaultOptions = {
width = 400,
height = 600,
height = 548,
options_width = 340,
create_object_list = true,
object_list_width = 200,
object_list_height = 420,
Expand Down Expand Up @@ -871,31 +879,45 @@ function detailsFramework:CreateEditor(parent, name, options)
detailsFramework:Mixin(editorFrame, detailsFramework.EditorMixin)
detailsFramework:Mixin(editorFrame, detailsFramework.OptionsFunctions)

editorFrame:SetScript("OnHide", editorFrame.OnHide)

editorFrame.registeredObjects = {}
editorFrame.registeredObjectsByID = {}

editorFrame:BuildOptionsTable(editorDefaultOptions, options)

editorFrame:SetSize(editorFrame.options.width, editorFrame.options.height)

--The options frame holds the options for the object being edited. It is used as the parent frame for the BuildMenuVolatile() function.
local optionsFrame = CreateFrame("frame", name .. "OptionsFrame", editorFrame, "BackdropTemplate")
optionsFrame:SetSize(editorFrame.options.options_width, 5000)

local canvasScrollBoxOptions = {
width = editorFrame.options.options_width,
height = 400,
reskin_slider = true,
}
local canvasFrame = detailsFramework:CreateCanvasScrollBox(editorFrame, optionsFrame, name .. "CanvasScrollBox", canvasScrollBoxOptions)

if (editorFrame.options.create_object_list) then
local scrollWidth = editorFrame.options.object_list_width
local scrollHeight = editorFrame.options.object_list_height
local scrollLinesAmount = editorFrame.options.object_list_lines
local scrollLineHeight = editorFrame.options.object_list_line_height

local objectSelector = editorFrame:CreateObjectSelectionList(scrollWidth, scrollHeight, scrollLinesAmount, scrollLineHeight)
objectSelector:SetPoint("topleft", editorFrame, "topright", 2, 0)
objectSelector:SetPoint("topleft", editorFrame, "topleft", 0, -2)
objectSelector:SetBackdropBorderColor(0, 0, 0, 0)
editorFrame.objectSelector = objectSelector
objectSelector:RefreshMe()
end

--options frame is the frame that holds the options for the editing object, it is used as the parent frame for BuildMenuVolatile()
local optionsFrame = CreateFrame("frame", name .. "OptionsFrame", editorFrame, "BackdropTemplate")
optionsFrame:SetSize(editorFrame.options.width, 5000)

local canvasFrame = detailsFramework:CreateCanvasScrollBox(editorFrame, optionsFrame, name .. "CanvasScrollBox")
canvasFrame:SetAllPoints()
local nScrollBarWidth = 30
canvasFrame:SetPoint("topleft", objectSelector, "topright", nScrollBarWidth, 0)
canvasFrame:SetPoint("bottomleft", objectSelector, "bottomright", -nScrollBarWidth, 0)
else
canvasFrame:SetPoint("topleft", editorFrame, "topleft", 2, -2)
canvasFrame:SetPoint("bottomleft", editorFrame, "bottomleft", 2, 0)
end

--over the top frame is a frame that is always on top of everything else
local OTTFrame = CreateFrame("frame", "$parentOTTFrame", UIParent)
Expand Down
11 changes: 9 additions & 2 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 491
local dversion = 492
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -526,10 +526,12 @@ end
---get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c
---@param t table
---@param path string
---@param subOffset number?
---@return any
function DF.table.getfrompath(t, path)
function DF.table.getfrompath(t, path, subOffset)
if (path:match("%.") or path:match("%[")) then
local value
local offset = 0

for key in path:gmatch("[%w_]+") do
value = t[key] or t[tonumber(key)]
Expand All @@ -541,6 +543,11 @@ function DF.table.getfrompath(t, path)

--update t for the next iteration
t = value
offset = offset + 1

if (subOffset == offset) then
return value
end
end

return value
Expand Down
15 changes: 10 additions & 5 deletions Libs/DF/rounded_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ local cornerNames = {"TopLeft", "TopRight", "BottomLeft", "BottomRight"}
---@field border_color any
---@field corner_texture any
---@field horizontal_border_size_offset number?
---@field titlebar_height number?

---@class df_roundedpanel_preset : table, df_roundedpanel_options
---@field border_color any
---@field color any
---@field roundness number?
---@field titlebar_height number?

---@class df_roundedcornermixin : table
---@field RoundedCornerConstructor fun(self:df_roundedpanel) --called from CreateRoundedPanel
Expand Down Expand Up @@ -239,9 +241,9 @@ detailsFramework.RoundedCornerPanelMixin = {
---create a frame placed at the top side of the rounded panel, this frame has a member called 'Text' which is a fontstring for the title
---@param self df_roundedpanel
---@return df_roundedpanel
CreateTitleBar = function(self)
CreateTitleBar = function(self, optionsTable)
---@type df_roundedpanel
local titleBar = detailsFramework:CreateRoundedPanel(self, "$parentTitleBar", {width = self.options.width - 6, height = 16})
local titleBar = detailsFramework:CreateRoundedPanel(self, "$parentTitleBar", {width = self.options.width - 6, height = self.options.titlebar_height})
titleBar:SetPoint("top", self, "top", 0, -4)
titleBar:SetRoundness(5)
titleBar:SetFrameLevel(9500)
Expand Down Expand Up @@ -512,19 +514,20 @@ local defaultOptions = {
color = {.1, .1, .1, 1},
border_color = {.2, .2, .2, .5},
corner_texture = [[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]],
titlebar_height = 26,
}

local defaultPreset = {
color = {.1, .1, .1, 1},
border_color = {.2, .2, .2, .5},
roundness = 3,
titlebar_height = 16,
}

---create a regular panel with rounded corner
---@param parent frame
---@param name string|nil
---@param optionsTable table|nil
---@return df_roundedpanel
function detailsFramework:CreateRoundedPanel(parent, name, optionsTable)
---@type df_roundedpanel
local newRoundedPanel = CreateFrame("frame", name, parent, "BackdropTemplate")
Expand All @@ -540,7 +543,7 @@ function detailsFramework:CreateRoundedPanel(parent, name, optionsTable)

if (newRoundedPanel.options.use_titlebar) then
---@type df_roundedpanel
local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = 26})
local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = newRoundedPanel.options.titlebar_height})
titleBar:SetColor(unpack(titleBarColor))
titleBar:SetPoint("top", newRoundedPanel, "top", 0, -7)

Expand Down Expand Up @@ -579,7 +582,8 @@ local applyPreset = function(frame, preset)
end

if (preset.use_titlebar) then
frame:CreateTitleBar()
frame:CreateTitleBar(preset)
frame.TitleBar.Text:SetText(preset.title)
end
end

Expand Down Expand Up @@ -623,6 +627,7 @@ function detailsFramework:AddRoundedCornersToFrame(frame, preset)
--handle preset
if (preset and type(preset) == "table") then
frame.options.horizontal_border_size_offset = preset.horizontal_border_size_offset
frame.options.titlebar_height = preset.titlebar_height
applyPreset(frame, preset)
else
applyPreset(frame, defaultPreset)
Expand Down
3 changes: 3 additions & 0 deletions Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ do
--defensive potions
[6262] = {cooldown = 60, duration = 0, specs = {}, talent = false, charges = 1, class = "", type = 10}, --Healthstone
[370511] = {cooldown = 300, duration = 0, specs = {}, talent = false, charges = 1, class = "", type = 10, shareid = 101}, --Refreshing Healing Potion
[415569] = {cooldown = 300, duration = 0, specs = {}, talent = false, charges = 1, class = "", type = 10, sharedid = 101}, -- Dreamwalker's Healing Potion

--attack potions
[371024] = {cooldown = 300, duration = 30, specs = {}, talent = false, charges = 1, class = "", type = 11, shareid = 101}, --Elemental Potion of Power
Expand Down Expand Up @@ -548,6 +549,7 @@ do
[186387] = {cooldown = 30, duration = 6, specs = {}, talent = false, charges = 1, class = "HUNTER", type = 8}, --Bursting Shot
[236776] = {cooldown = 40, duration = 0, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 8}, --High Explosive Trap
[272682] = {cooldown = 45, duration = 4, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 7}, --Master's Call
[359844] = {cooldown = 120, duration = 20, specs = {253}, talent = true, charges = 1, class = "HUNTER", type = 1}, -- Call of the Wild
--Boar nil 62305 Master's Call
--Boar Tiranaa 54216 Master's Call
--Tiranaa Tiranaa 272682 Master's Call
Expand Down Expand Up @@ -734,6 +736,7 @@ do
[1966] = {cooldown = 15, duration = 0, specs = {}, talent = false, charges = 1, class = "ROGUE", type = 2}, --Feint
[384631] = {cooldown = 90, duration = 12, specs = {261}, talent = false, charges = 1, class = "ROGUE", type = 1}, --Flagellation
[277925] = {cooldown = 60, duration = 4, specs = {261}, talent = false, charges = 1, class = "ROGUE", type = 1}, --Shuriken Tornado
[360194] = {cooldown = 120, duration = 16, specs = {259}, talent = true, charges = 1, class = "ROGUE", type = 1}, -- Deathmark

--~evoker
-- 1467 - Devastation
Expand Down
2 changes: 1 addition & 1 deletion core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5796,7 +5796,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end

function Details.parser_functions:CHALLENGE_MODE_START(...)
function Details.parser_functions:CHALLENGE_MODE_START(...) --~challenge ~mythic ~m+
--send mythic dungeon start event
if (Details.debug) then
end
Expand Down
66 changes: 58 additions & 8 deletions functions/dungeon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,33 @@ function mythicDungeonCharts.ShowReadyPanel()
mythicDungeonCharts.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate")
local readyFrame = mythicDungeonCharts.ReadyFrame

readyFrame:SetSize(255, 80)
local textColor = {1, 0.8196, 0, 1}
local textSize = 11

local roundedCornerTemplate = {
roundness = 6,
color = {.1, .1, .1, 0.98},
border_color = {.05, .05, .05, 0.834},
}

detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate)

local titleLabel = DetailsFramework:CreateLabel(readyFrame, "Details! Mythic Run Completed!", 12, "yellow")
titleLabel:SetPoint("top", readyFrame, "top", 0, -7)
titleLabel.textcolor = textColor

local closeButton = detailsFramework:CreateCloseButton(readyFrame, "$parentCloseButton")
closeButton:SetPoint("topright", readyFrame, "topright", -2, -2)
closeButton:SetScale(1.4)
closeButton:SetAlpha(0.823)

readyFrame:SetSize(255, 120)
readyFrame:SetPoint("center", UIParent, "center", 300, 0)
readyFrame:SetFrameStrata("LOW")
readyFrame:EnableMouse(true)
readyFrame:SetMovable(true)
DetailsFramework:ApplyStandardBackdrop(readyFrame)
DetailsFramework:CreateTitleBar (readyFrame, "Details! Damage Chart for M+")
--DetailsFramework:ApplyStandardBackdrop(readyFrame)
--DetailsFramework:CreateTitleBar (readyFrame, "Details! Mythic Run Completed!")

readyFrame:Hide()

Expand All @@ -297,14 +317,17 @@ function mythicDungeonCharts.ShowReadyPanel()
LibWindow.SavePosition(readyFrame)

--show button
readyFrame.ShowButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, Loc ["STRING_SLASH_SHOW"]:gsub("^%l", string.upper))
---@type df_button
readyFrame.ShowButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, "Show Damage Graphic")
readyFrame.ShowButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
readyFrame.ShowButton:SetPoint("topright", readyFrame, "topright", -5, -30)
readyFrame.ShowButton:SetPoint("topleft", readyFrame, "topleft", 5, -30)
readyFrame.ShowButton:SetIcon([[Interface\AddOns\Details\images\icons2.png]], 16, 16, "overlay", {42/512, 75/512, 153/512, 187/512}, {.7, .7, .7, 1}, nil, 0, 0)
readyFrame.ShowButton.textcolor = textColor

--discart button
readyFrame.DiscartButton = DetailsFramework:CreateButton(readyFrame, function() readyFrame:Hide() end, 80, 20, Loc ["STRING_DISCARD"])
readyFrame.DiscartButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
readyFrame.DiscartButton:SetPoint("right", readyFrame.ShowButton, "left", -5, 0)
--readyFrame.DiscartButton = DetailsFramework:CreateButton(readyFrame, function() readyFrame:Hide() end, 80, 20, Loc ["STRING_DISCARD"])
--readyFrame.DiscartButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
--readyFrame.DiscartButton:SetPoint("right", readyFrame.ShowButton, "left", -5, 0)

--disable feature check box (dont show this again)
local on_switch_enable = function(self, _, value)
Expand All @@ -316,9 +339,36 @@ function mythicDungeonCharts.ShowReadyPanel()
notAgainLabel:SetPoint("left", notAgainSwitch, "right", 2, 0)
notAgainSwitch:SetPoint("bottomleft", readyFrame, "bottomleft", 5, 5)
notAgainSwitch:SetAsCheckBox()
notAgainLabel.textSize = textSize



local timeNotInCombatLabel = DetailsFramework:CreateLabel(readyFrame, "Time not in combat:", textSize, "orangered")
timeNotInCombatLabel:SetPoint("bottomleft", notAgainSwitch, "topleft", 0, 7)
local timeNotInCombatAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, "orangered")
timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0)

local elapsedTimeLabel = DetailsFramework:CreateLabel(readyFrame, "Run Time:", textSize, textColor)
elapsedTimeLabel:SetPoint("bottomleft", timeNotInCombatLabel, "topleft", 0, 5)
local elapsedTimeAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, textColor)
elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0)

readyFrame.TimeNotInCombatAmountLabel = timeNotInCombatAmount
readyFrame.ElapsedTimeAmountLabel = elapsedTimeAmount
end

mythicDungeonCharts.ReadyFrame:Show()

--update the run time and time not in combat
local elapsedTime = Details222.MythicPlus.time or 1507
mythicDungeonCharts.ReadyFrame.ElapsedTimeAmountLabel.text = DetailsFramework:IntegerToTimer(elapsedTime)

local overallMythicDungeonCombat = Details:GetCurrentCombat()
if (overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
local combatTime = overallMythicDungeonCombat:GetCombatTime()
local notInCombat = elapsedTime - combatTime
mythicDungeonCharts.ReadyFrame.TimeNotInCombatAmountLabel.text = DetailsFramework:IntegerToTimer(notInCombat) .. " (" .. math.floor(notInCombat / elapsedTime * 100) .. "%)"
end
end

function mythicDungeonCharts.ShowChart()
Expand Down
12 changes: 12 additions & 0 deletions functions/mixin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ Details222.Mixins.ActorMixin = {
elseif (containerType == "dispel") then
---@cast actor actorutility
return actor.dispell_spells

elseif (containerType == "interrupt") then
---@cast actor actorutility
return actor.interrupt_spells

elseif (containerType == "interruptwhat") then
---@cast actor actorutility
return actor.interrompeu_oque --is intended to be in portuguese

elseif (containerType == "interrupttargets") then
---@cast actor actorutility
return actor.interrupt_targets
end
end,

Expand Down

0 comments on commit 2a2e9eb

Please sign in to comment.