Skip to content

Commit

Permalink
Fixes for the latest alpha version
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 6, 2023
1 parent ea2cec6 commit 6bfcc14
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 29 deletions.
13 changes: 7 additions & 6 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
---@field GetDefaultBackdropColor fun(self:table) : red, green, blue, alpha return a standard backdrop color
---@field Msg fun(self:table, message:string, ...) show a message in the chat frame
---@field MsgWarning fun(self:table, message:string, ...) show a warning message in the chat frame
---@field CreateCloseButton fun(self:table, parent:frame, frameName:string|nil) : df_closebutton
---@field CreateTabButton fun(self:table, parent:frame, frameName:string|nil) : df_tabbutton
---@field CreateRoundedPanel fun(self:table, parent:frame, frameName:string|nil, optionsTable:df_roundedpanel_options|nil) : df_roundedpanel
---@field CreateCloseButton fun(self:table, parent:frame, frameName:string?) : df_closebutton
---@field CreateTabButton fun(self:table, parent:frame, frameName:string?) : df_tabbutton
---@field CreateRoundedPanel fun(self:table, parent:frame, frameName:string?, optionsTable:df_roundedpanel_options?) : df_roundedpanel
---@field CreateScaleBar fun(self:table, parent:frame, config:table<scale,number>) : df_scalebar
---@field AddRoundedCornersToFrame fun(self:table, frame:frame, optionsTable:df_roundedpanel_preset|nil)
---@field ParseColors fun(self:table, red:any, green:number|nil, blue:number|nil, alpha:number|nil) : red, green, blue, alpha
---@field Mixin fun(self:table, target:table, ...) : table
---@field AddRoundedCornersToFrame fun(self:table, frame:frame, optionsTable:df_roundedpanel_preset?)
---@field ParseColors fun(self:table, red:any, green:number?, blue:number?, alpha:number?) : red, green, blue, alpha
---@field Mixin fun(self:table, target:table, ...) : table
---@field SetButtonTexture fun(self:table, button:button|df_button, texture:atlasname|texturepath|textureid)
61 changes: 59 additions & 2 deletions Libs/DF/frames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ local cornerNames = {"TopLeft", "TopRight", "BottomLeft", "BottomRight"}
---@field CreateBorder fun(self:df_roundedpanel) --called from SetBorderCornerColor if the border is not created yet
---@field CalculateBorderEdgeSize fun(self:df_roundedpanel, alignment: "vertical"|"horizontal"): number --calculate the size of the border edge texture
---@field SetTitleBarColor fun(self:df_roundedpanel, red: any, green: number|nil, blue: number|nil, alpha: number|nil)
---@field GetMaxFrameLevel fun(self:df_roundedpanel) : number --return the max frame level of the frame and its children

---@class df_roundedpanel : frame, df_roundedcornermixin, df_optionsmixin, df_titlebar
---@field bHasBorder boolean
Expand All @@ -75,6 +76,7 @@ local cornerNames = {"TopLeft", "TopRight", "BottomLeft", "BottomRight"}
---@field BorderCornerTextures cornertextures
---@field BorderEdgeTextures edgetextures
---@field TitleBar df_roundedpanel
---@field bIsTitleBar boolean
---@field TopLeft texture corner texture
---@field TopRight texture corner texture
---@field BottomLeft texture corner texture
Expand Down Expand Up @@ -211,6 +213,54 @@ detailsFramework.RoundedCornerPanelMixin = {
setCornerPoints(self, self.CornerTextures)
end,

---get the highest frame level of the rounded panel and its children
---@param self df_roundedpanel
---@return framelevel
GetMaxFrameLevel = function(self)
---@type framelevel
local maxFrameLevel = 0
local children = {self:GetChildren()}

for i = 1, #children do
local thisChild = children[i]
---@cast thisChild frame
if (thisChild:GetFrameLevel() > maxFrameLevel) then
maxFrameLevel = thisChild:GetFrameLevel()
end
end

return maxFrameLevel
end,

---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)
---@type df_roundedpanel
local titleBar = detailsFramework:CreateRoundedPanel(self, "$parentTitleBar", {width = self.options.width - 6, height = 16})
titleBar:SetPoint("top", self, "top", 0, -4)
titleBar:SetRoundness(5)
titleBar:SetFrameLevel(9500)
titleBar.bIsTitleBar = true
self.TitleBar = titleBar
self.bHasTitleBar = true

local textFontString = titleBar:CreateFontString("$parentText", "overlay", "GameFontNormal")
textFontString:SetPoint("center", titleBar, "center", 0, 0)
titleBar.Text = textFontString

local closeButton = detailsFramework:CreateCloseButton(titleBar, "$parentCloseButton")
closeButton:SetPoint("right", titleBar, "right", -3, 0)
closeButton:SetSize(10, 10)
closeButton:SetAlpha(0.3)
closeButton:SetScript("OnClick", function(self)
self:GetParent():GetParent():Hide()
end)
detailsFramework:SetButtonTexture(closeButton, "common-search-clearbutton")

return titleBar
end,

---return the width and height of the corner textures
---@param self df_roundedpanel
---@return number, number
Expand Down Expand Up @@ -518,11 +568,15 @@ local applyPreset = function(frame, preset)
else
frame:SetRoundness(1)
end

if (preset.use_titlebar) then
frame:CreateTitleBar()
end
end

---set a frame to have rounded corners following the settings passed by the preset table
---@param frame frame
---@param preset df_roundedpanel_preset|nil
---@param preset df_roundedpanel_preset?
function detailsFramework:AddRoundedCornersToFrame(frame, preset)
frame = frame and frame.widget or frame
assert(frame and frame.GetObjectType and frame.SetPoint, "AddRoundedCornersToFrame(frame): frame must be a frame object.")
Expand Down Expand Up @@ -566,7 +620,10 @@ function detailsFramework:AddRoundedCornersToFrame(frame, preset)
end

---test case:
C_Timer.After(1, function() if true then return end
C_Timer.After(1, function()

if true then return end

local DF = DetailsFramework

local parent = UIParent
Expand Down
4 changes: 2 additions & 2 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


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

Expand Down Expand Up @@ -585,7 +585,7 @@ function DF.table.removeduplicate(table1, table2)
for key, value in pairs(table2) do
if (type(value) == "table") then
if (table1[key]) then
DF.SavedVars.removeduplicate(value, table1[key])
DF.table.removeduplicate(value, table1[key])
end
else
if (type(table1[key]) == "number" and type(value) == "number") then
Expand Down
48 changes: 33 additions & 15 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr
PanelObject.frame:SetBackdrop({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 10, tileSize = 64, tile = true})

PanelObject.widget = PanelObject.frame
PanelObject.frame.MyObject = PanelObject

if (not APIFrameFunctions) then
APIFrameFunctions = {}
Expand All @@ -644,8 +645,6 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr
PanelObject.frame:SetWidth(w or 100)
PanelObject.frame:SetHeight(h or 100)

PanelObject.frame.MyObject = PanelObject

PanelObject.HookList = {
OnEnter = {},
OnLeave = {},
Expand Down Expand Up @@ -1980,6 +1979,7 @@ local no_options = {}
---UseStatusBar = false, --if true, creates a status bar at the bottom of the frame (frame.StatusBar)
---NoCloseButton = false, --if true, won't show the close button
---NoTitleBar = false, --if true, don't create the title bar
---RoundedCorners = false, --use rounded corners if true
---@class simplepanel
---@field TitleBar frame
---@field Title fontstring
Expand Down Expand Up @@ -2024,29 +2024,47 @@ function detailsFramework:CreateSimplePanel(parent, width, height, title, frameN
simplePanel:SetMovable(true)

--set the backdrop
simplePanel:SetBackdrop(SimplePanel_frame_backdrop)
simplePanel:SetBackdropColor(unpack(SimplePanel_frame_backdrop_color))
simplePanel:SetBackdropBorderColor(unpack(SimplePanel_frame_backdrop_border_color))
if (panelOptions.RoundedCorners) then
local tRoundedCornerPreset = {
roundness = 6,
color = {.1, .1, .1, 0.98},
border_color = {.05, .05, .05, 0.834},
use_titlebar = true,
}
detailsFramework:AddRoundedCornersToFrame(simplePanel, tRoundedCornerPreset)
else
simplePanel:SetBackdrop(SimplePanel_frame_backdrop)
simplePanel:SetBackdropColor(unpack(SimplePanel_frame_backdrop_color))
simplePanel:SetBackdropBorderColor(unpack(SimplePanel_frame_backdrop_border_color))
end

simplePanel.DontRightClickClose = panelOptions.DontRightClickClose

if (not panelOptions.NoTUISpecialFrame) then
tinsert(UISpecialFrames, frameName)
end

if (panelOptions.UseStatusBar) then
if (panelOptions.UseStatusBar and not panelOptions.RoundedCorners) then
local statusBar = detailsFramework:CreateStatusBar(simplePanel)
simplePanel.StatusBar = statusBar
end

local titleBar = CreateFrame("frame", frameName .. "TitleBar", simplePanel,"BackdropTemplate")
titleBar:SetPoint("topleft", simplePanel, "topleft", 2, -3)
titleBar:SetPoint("topright", simplePanel, "topright", -2, -3)
titleBar:SetHeight(20)
titleBar:SetBackdrop(SimplePanel_frame_backdrop)
titleBar:SetBackdropColor(.2, .2, .2, 1)
titleBar:SetBackdropBorderColor(0, 0, 0, 1)
simplePanel.TitleBar = titleBar
local titleBar = CreateFrame("frame", frameName .. "TitleBar", simplePanel, "BackdropTemplate")

if (panelOptions.RoundedCorners) then
simplePanel.TitleBar:SetColor(.2, .2, .2, 0.4)
simplePanel.TitleBar:SetBorderCornerColor(0, 0, 0, 0)

else
simplePanel.TitleBar = titleBar
titleBar:SetPoint("topleft", simplePanel, "topleft", 2, -3)
titleBar:SetPoint("topright", simplePanel, "topright", -2, -3)
titleBar:SetHeight(20)
titleBar:SetBackdrop(SimplePanel_frame_backdrop)
titleBar:SetBackdropColor(.2, .2, .2, 1)
titleBar:SetBackdropBorderColor(0, 0, 0, 1)
simplePanel.TitleBar = titleBar
end

local close = CreateFrame("button", frameName and frameName .. "CloseButton", titleBar)
close:SetFrameLevel(detailsFramework.FRAMELEVEL_OVERLAY)
Expand Down Expand Up @@ -2077,7 +2095,7 @@ function detailsFramework:CreateSimplePanel(parent, width, height, title, frameN
simplePanel.Title:SetPoint("center", titleBar, "center")
simplePanel.Close:SetPoint("right", titleBar, "right", -2, 0)

if (panelOptions.NoCloseButton) then
if (panelOptions.NoCloseButton or panelOptions.RoundedCorners) then
simplePanel.Close:Hide()
end

Expand Down
2 changes: 2 additions & 0 deletions Libs/LibLuaServer/LibLuaServer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@

---@alias width number property that represents the horizontal size of a UI element, such as a frame or a texture. Gotten from the first result of GetWidth() or from the first result of GetSize(). It is expected a GetWidth() or GetSize() when the type 'height' is used.
---@alias height number property that represents the vertical size of a UI element, such as a frame or a texture. Gotten from the first result of GetHeight() or from the second result of GetSize(). It is expected a GetHeight() or GetSize() when the type 'height' is used.
---@alias framelevel number represent how high a frame is placed within its strata. The higher the frame level, the more likely it is to appear in front of other frames. The frame level is a number between 0 and 65535. The default frame level is 0. The frame level is set with the SetFrameLevel() function.
---@alias red number color value representing the red component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color)
---@alias green number color value representing the green component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color)
---@alias blue number color value representing the blue component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color)
Expand Down Expand Up @@ -211,6 +212,7 @@
---@alias npcid number a number that identifies a specific npc in the game.
---@alias textureid number each texture from the game client has an id.
---@alias texturepath string access textures from addons.
---@alias atlasname string a name of an atlas, an atlas name is used with the SetAtlas() function to display a texture from the game client.
---@alias valueamount number used to represent a value, such as a damage amount, a healing amount, or a resource amount.
---@alias unixtime number a number that represents the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds.
---@alias timestring string refers to a string showing a time value, such as "1:23" or "1:23:45".
Expand Down
42 changes: 42 additions & 0 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,48 @@ do
return Details:Dump(spellInfo)
end
end

--check if is an atlas texture
local atlas
if (type(value) == "string") then
atlas = C_Texture.GetAtlasInfo(value)
if (atlas) then
return Details:Dump(atlas)
end
end

--[=[
for key, tooltip in pairs(_G) do
if (type(tooltip) == "table" and tooltip.GetName) then
if (tooltip.IsShown and tooltip.HookScript and not tooltip.widget and not tooltip.MyObject) then
if (tooltip.GetObjectType and not getmetatable(tooltip)) then
print(tooltip:GetObjectType())
if (tooltip:GetObjectType() == "GameTooltip") then
if (tooltip:IsShown()) then
print(tooltip:GetName())
end
end
end
end
end
end
--]=]

if (value == nil) then
local allTooltips = {"GameTooltip", "EventTraceTooltip", "FrameStackTooltip", "GarrisonMissionMechanicTooltip", "GarrisonMissionMechanicFollowerCounterTooltip", "ItemSocketingDescription", "NamePlateTooltip", "PrivateAurasTooltip", "RuneforgeFrameResultTooltip", "ItemRefTooltip", "QuickKeybindTooltip", "SettingsTooltip"}
for i = 1, #allTooltips do
local tooltipName = allTooltips[i]
local tooltip = _G[tooltipName]

if (tooltip and tooltip.GetTooltipData) then
local tooltipData = tooltip:GetTooltipData()
if (tooltipData)then
return Details:Dump(tooltipData)
end
end
end
end

return Details:Dump(value)
end

Expand Down
6 changes: 4 additions & 2 deletions classes/class_damage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2991,8 +2991,8 @@ end
---@param totalAmount valueamount
---@param topAmount valueamount
---@param instanceObject instance
---@param onEnterFunc function|nil
---@param onLeaveFunc function|nil
---@param onEnterFunc function?
---@param onLeaveFunc function?
function Details:ShowExtraStatusbar(thisLine, amount, extraAmount, totalAmount, topAmount, instanceObject, onEnterFunc, onLeaveFunc)
if (extraAmount and extraAmount > 0 and Details.combat_log.evoker_calc_damage) then
local extraStatusbar = thisLine.extraStatusbar
Expand Down Expand Up @@ -6705,6 +6705,8 @@ end

if (actorObject.augmentedSpellsContainer) then
local overallAugmentedSpellsContainer = overallActor.augmentedSpellsContainer or spellContainerClass:CreateSpellContainer(Details.container_type.CONTAINER_DAMAGE_CLASS)
overallActor.augmentedSpellsContainer = overallAugmentedSpellsContainer

for spellId, spellTable in pairs(actorObject.augmentedSpellsContainer._ActorTable) do --same as actorObject.augmentedSpellsContainer:GetRawSpellTable()
local overallSpellTable = overallAugmentedSpellsContainer:GetOrCreateSpell(spellId, true)
overallSpellTable.total = overallSpellTable.total + spellTable.total
Expand Down
7 changes: 5 additions & 2 deletions classes/class_utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2366,8 +2366,8 @@ local refresh_alvos = function(container1, container2)
end
local refresh_habilidades = function(container1, container2)
for spellid, habilidade in pairs(container2._ActorTable) do
local habilidade_shadow = container1:PegaHabilidade (spellid, true, nil, true)
refresh_alvos (habilidade_shadow.targets , habilidade.targets)
local habilidade_shadow = container1:PegaHabilidade(spellid, true, nil, true)
refresh_alvos(habilidade_shadow.targets , habilidade.targets)
end
end

Expand Down Expand Up @@ -2414,6 +2414,9 @@ function atributo_misc:r_onlyrefresh_shadow (actor)
refresh_habilidades (shadow.buff_uptime_spells, actor.buff_uptime_spells)

if (actor.received_buffs_spells) then
if (not shadow.received_buffs_spells) then
shadow.received_buffs_spells = container_habilidades:NovoContainer(_detalhes.container_type.CONTAINER_MISC_CLASS)
end
refresh_habilidades(shadow.received_buffs_spells, actor.received_buffs_spells)
end
end
Expand Down

0 comments on commit 6bfcc14

Please sign in to comment.