diff --git a/.gitignore b/.gitignore index c889e194..d2b5a4a8 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,5 @@ plugins/Details_TinyThreat/.github/workflows/release.yml plugins/Details_Vanguard/.github/workflows/release.yml photoshop/ten_years_skin.tga *.yml +plugins/Details_EncounterDetails/Libs/LibLuaServer/LuaServerDefinitions.lua +plugins/Details_EncounterDetails/Definitions.lua diff --git a/Definitions.lua b/Definitions.lua index a0031e3e..26b2f706 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -244,6 +244,7 @@ ---@field total_without_pet number ---@field total number ---@field total_extra number +---@field last_dps_realtime number ---@field targets targettable ---@field GetSpell fun(actor: actor, spellId: number) : spelltable ---@field BuildSpellTargetFromBreakdownSpellData fun(actor: actor, bkSpellData: spelltableadv) : table diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index eae2f3f1..4cf3c313 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -855,6 +855,7 @@ end end ---@class df_button : button + ---@field widget button ---@field tooltip string ---@field shown boolean ---@field width number diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua new file mode 100644 index 00000000..caa43a01 --- /dev/null +++ b/Libs/DF/definitions.lua @@ -0,0 +1,14 @@ + +---@class detailsframework +---@field OptionsFunctions df_optionsmixin +---@field RoundedCornerPanelMixin df_roundedcornermixin +---@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 CreateScaleBar fun(self:table, parent:frame, config:table) : 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 \ No newline at end of file diff --git a/Libs/DF/frames.lua b/Libs/DF/frames.lua index 9494b82f..2b863cdb 100644 --- a/Libs/DF/frames.lua +++ b/Libs/DF/frames.lua @@ -1,15 +1,18 @@ +---@class detailsframework local detailsFramework = _G.DetailsFramework if (not detailsFramework or not DetailsFrameworkCanLoad) then return end local CreateFrame = CreateFrame +local defaultRed, defaultGreen, defaultBlue = detailsFramework:GetDefaultBackdropColor() +--local defaultColorTable = {defaultRed, defaultGreen, defaultBlue, 1} +local defaultColorTable = {0.98, 0.98, 0.98, 1} +local defaultBorderColorTable = {0.1, 0.1, 0.1, 1} ----@class df_roundedpanel : frame, blz_backdrop, df_optionsmixin, df_titlebar ----@field cornerTextures texture[] ----@field edgeTextures texture[] ----@field Constructor fun(self:df_roundedpanel) +---@type edgenames[] +local cornerNames = {"TopLeft", "TopRight", "BottomLeft", "BottomRight"} ---@class blz_backdrop : table ---@field TopLeftCorner texture @@ -22,55 +25,423 @@ local CreateFrame = CreateFrame ---@field RightEdge texture ---@field Center texture -detailsFramework.RoundedCornerPanelMixin = { - Constructor = function(self) - self.cornerTextures = {} - self.edgeTextures = {} +---@class cornertextures : table +---@field TopLeft texture +---@field TopRight texture +---@field BottomLeft texture +---@field BottomRight texture - local red, green, blue, alpha = detailsFramework:GetDefaultBackdropColor() +---@class edgetextures : table +---@field Top texture +---@field Bottom texture +---@field Left texture +---@field Right texture - self:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) - self:SetBackdropColor(red, green, blue, alpha * 0.95) - self:SetBackdropBorderColor(0, 0, 0, 0.95) +---@class df_roundedpanel_preset : table +---@field border_color any +---@field color any +---@field roundness number - self.__background = self:CreateTexture(nil, "border", nil, -6) - self.__background:SetColorTexture(red, green, blue) - self.__background:SetAllPoints() +---@class df_roundedpanel_options : table +---@field width number +---@field height number +---@field use_titlebar boolean +---@field use_scalebar boolean +---@field title string +---@field scale number +---@field roundness number +---@field color any +---@field border_color any +---@field corner_texture texturepath|textureid - self:SetSize(self.options.width, self.options.height) +---@class df_roundedcornermixin : table +---@field RoundedCornerConstructor fun(self:df_roundedpanel) --called from CreateRoundedPanel +---@field SetColor fun(self:df_roundedpanel, red: any, green: number|nil, blue: number|nil, alpha: number|nil) +---@field SetBorderCornerColor fun(self:df_roundedpanel, red: any, green: number|nil, blue: number|nil, alpha: number|nil) +---@field SetRoundness fun(self:df_roundedpanel, slope: number) +---@field GetCornerSize fun(self:df_roundedpanel) : width, height +---@field OnSizeChanged fun(self:df_roundedpanel) --called when the frame size changes +---@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) - if (self.options.use_titlebar) then - detailsFramework:CreateTitleBar(self) - self:SetTitle(self.options.title) +---@class df_roundedpanel : frame, df_roundedcornermixin, df_optionsmixin, df_titlebar +---@field bHasBorder boolean +---@field bHasTitleBar boolean +---@field options df_roundedpanel_options +---@field cornerRoundness number +---@field CornerTextures cornertextures +---@field CenterTextures texture[] +---@field BorderCornerTextures cornertextures +---@field BorderEdgeTextures edgetextures +---@field TitleBar df_roundedpanel +---@field TopLeft texture corner texture +---@field TopRight texture corner texture +---@field BottomLeft texture corner texture +---@field BottomRight texture corner texture +---@field TopEdgeBorder texture border edge +---@field BottomEdgeBorder texture border edge +---@field LeftEdgeBorder texture border edge +---@field RightEdgeBorder texture border edge +---@field TopLeftBorder texture border corner +---@field TopRightBorder texture border corner +---@field BottomLeftBorder texture border corner +---@field BottomRightBorder texture border corner +---@field TopHorizontalEdge texture texture connecting the top corners +---@field BottomHorizontalEdge texture texture connecting the bottom corners +---@field CenterBlock texture texture connecting the bottom left of the topleft corner with the top right of the bottom right corner + +---@param self df_roundedpanel +---@param textures cornertextures +---@param width number|nil +---@param height number|nil +---@param xOffset number|nil +---@param yOffset number|nil +---@param bIsBorder boolean|nil +local setCornerPoints = function(self, textures, width, height, xOffset, yOffset, bIsBorder) + for cornerName, thisTexture in pairs(textures) do + thisTexture:SetSize(width or 16, height or 16) + thisTexture:SetTexture(self.options.corner_texture) + + --set the mask + if (not thisTexture.MaskTexture and bIsBorder) then + thisTexture.MaskTexture = self:CreateMaskTexture(nil, "background") + thisTexture.MaskTexture:SetSize(74, 64) + thisTexture:AddMaskTexture(thisTexture.MaskTexture) + thisTexture.MaskTexture:SetTexture([[Interface\Azerite\AzeriteGoldRingRank2]]) --1940690 + --thisTexture.MaskTexture:Hide() end - if (self.options.use_scalebar) then - detailsFramework:CreateScaleBar(self, self.options) - self:SetScale(self.options.scale) - end + xOffset = xOffset or 0 + yOffset = yOffset or 0 - --fill the corner and edge textures table - for index, cornerName in ipairs({"TopLeftCorner", "TopRightCorner", "BottomLeftCorner", "BottomRightCorner"}) do - local thisTexture = self[cornerName] - self.cornerTextures[cornerName] = thisTexture - thisTexture:SetTexture([[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]]) + --todo: adjust the other corners setpoint offset + --todo (done): use mask when the alpha is below 0.98, disable the mask when the alpha is above 0.98 - --local bIsOdd = index % 2 == 1 - --thisTexture:SetTexCoord(bIsOdd and 0 or 0.5, index < 3 and 0 or 0.5, bIsOdd and 0.5 or 1, index < 3 and 0.5 or 1) + if (cornerName == "TopLeft") then + thisTexture:SetTexCoord(0, 0.5, 0, 0.5) + thisTexture:SetPoint(cornerName, self, cornerName, -xOffset, yOffset) + if (thisTexture.MaskTexture) then + thisTexture.MaskTexture:SetPoint(cornerName, self, cornerName, -18-xOffset, 16+yOffset) + end - if (cornerName == "TopLeftCorner") then - thisTexture:SetTexCoord(0, 0.5, 0, 0.5) - elseif (cornerName == "TopRightCorner") then - thisTexture:SetTexCoord(0.5, 1, 0, 0.5) - elseif (cornerName == "BottomLeftCorner") then - thisTexture:SetTexCoord(0, 0.5, 0.5, 1) - elseif (cornerName == "BottomRightCorner") then - thisTexture:SetTexCoord(0.5, 1, 0.5, 1) + elseif (cornerName == "TopRight") then + thisTexture:SetTexCoord(0.5, 1, 0, 0.5) + thisTexture:SetPoint(cornerName, self, cornerName, xOffset, yOffset) + if (thisTexture.MaskTexture) then + thisTexture.MaskTexture:SetPoint(cornerName, self, cornerName, -18+xOffset, 16+yOffset) + end + + elseif (cornerName == "BottomLeft") then + thisTexture:SetTexCoord(0, 0.5, 0.5, 1) + thisTexture:SetPoint(cornerName, self, cornerName, -xOffset, -yOffset) + if (thisTexture.MaskTexture) then + thisTexture.MaskTexture:SetPoint(cornerName, self, cornerName, -18-xOffset, 16-yOffset) + end + + elseif (cornerName == "BottomRight") then + thisTexture:SetTexCoord(0.5, 1, 0.5, 1) + thisTexture:SetPoint(cornerName, self, cornerName, xOffset, -yOffset) + if (thisTexture.MaskTexture) then + thisTexture.MaskTexture:SetPoint(cornerName, self, cornerName, -18+xOffset, 16-yOffset) end end + end +end - for _, edgeName in ipairs({"TopEdge", "BottomEdge", "LeftEdge", "RightEdge"}) do - self.edgeTextures[edgeName] = self[edgeName] +detailsFramework.RoundedCornerPanelMixin = { + RoundedCornerConstructor = function(self) + self.CornerTextures = {} + self.CenterTextures = {} + self.BorderCornerTextures = {} + self.BorderEdgeTextures = {} + + self.cornerRoundness = 0 + + for i = 1, #cornerNames do + ---@type texture + local newCornerTexture = self:CreateTexture(nil, "border", nil, 0) + self.CornerTextures[cornerNames[i]] = newCornerTexture + self[cornerNames[i]] = newCornerTexture + end + + --create the top texture which connects the top corners with a horizontal line + ---@type texture + local topHorizontalEdge = self:CreateTexture(nil, "border", nil, 0) + topHorizontalEdge:SetPoint("topleft", self.CornerTextures["TopLeft"], "topright", 0, 0) + topHorizontalEdge:SetPoint("bottomleft", self.CornerTextures["TopLeft"], "bottomright", 0, 0) + topHorizontalEdge:SetPoint("topright", self.CornerTextures["TopRight"], "topleft", 0, 0) + topHorizontalEdge:SetPoint("bottomright", self.CornerTextures["TopRight"], "bottomleft", 0, 0) + topHorizontalEdge:SetColorTexture(unpack(defaultColorTable)) + + --create the bottom texture which connects the bottom corners with a horizontal line + ---@type texture + local bottomHorizontalEdge = self:CreateTexture(nil, "border", nil, 0) + bottomHorizontalEdge:SetPoint("topleft", self.CornerTextures["BottomLeft"], "topright", 0, 0) + bottomHorizontalEdge:SetPoint("bottomleft", self.CornerTextures["BottomLeft"], "bottomright", 0, 0) + bottomHorizontalEdge:SetPoint("topright", self.CornerTextures["BottomRight"], "topleft", 0, 0) + bottomHorizontalEdge:SetPoint("bottomright", self.CornerTextures["BottomRight"], "bottomleft", 0, 0) + bottomHorizontalEdge:SetColorTexture(unpack(defaultColorTable)) + + --create the center block which connects the bottom left of the topleft corner with the top right of the bottom right corner + ---@type texture + local centerBlock = self:CreateTexture(nil, "border", nil, 0) + centerBlock:SetPoint("topleft", self.CornerTextures["TopLeft"], "bottomleft", 0, 0) + centerBlock:SetPoint("bottomleft", self.CornerTextures["BottomLeft"], "topleft", 0, 0) + centerBlock:SetPoint("topright", self.CornerTextures["BottomRight"], "topright", 0, 0) + centerBlock:SetPoint("bottomright", self.CornerTextures["BottomRight"], "topright", 0, 0) + centerBlock:SetColorTexture(unpack(defaultColorTable)) + + self.CenterTextures[#self.CenterTextures+1] = topHorizontalEdge + self.CenterTextures[#self.CenterTextures+1] = bottomHorizontalEdge + self.CenterTextures[#self.CenterTextures+1] = centerBlock + + self.TopHorizontalEdge = topHorizontalEdge + self.BottomHorizontalEdge = bottomHorizontalEdge + self.CenterBlock = centerBlock + + ---@type width + local width = self.options.width + ---@type height + local height = self.options.height + + self:SetSize(width, height) + + --fill the corner and edge textures table + setCornerPoints(self, self.CornerTextures) + end, + + ---return the width and height of the corner textures + ---@param self df_roundedpanel + ---@return number, number + GetCornerSize = function(self) + return self.CornerTextures["TopLeft"]:GetSize() + end, + + ---set how rounded the corners should be + ---@param self df_roundedpanel + ---@param roundness number + SetRoundness = function(self, roundness) + self.cornerRoundness = roundness + self:OnSizeChanged() + end, + + ---adjust the size of the corner textures and the border edge textures + ---@param self df_roundedpanel + OnSizeChanged = function(self) + --if the frame has a titlebar, need to adjust the size of the titlebar + if (self.bHasTitleBar) then + self.TitleBar:SetWidth(self:GetWidth() - 14) + end + + --if the frame height is below 32, need to recalculate the size of the corners + ---@type height + local frameHeight = self:GetHeight() + + if (frameHeight < 32) then + local newCornerSize = frameHeight / 2 + + --set the new size of the corners on all corner textures + for _, thisTexture in pairs(self.CornerTextures) do + thisTexture:SetSize(newCornerSize-self.cornerRoundness, newCornerSize) + end + + --check if the frame has border and set the size of the border corners as well + if (self.bHasBorder) then + for _, thisTexture in pairs(self.BorderCornerTextures) do + thisTexture:SetSize(newCornerSize, newCornerSize) + end + + --hide the left and right edges as the corner textures already is enough to fill the frame + self.BorderEdgeTextures["Left"]:Hide() + self.BorderEdgeTextures["Right"]:Hide() + + local horizontalEdgesNewSize = self:CalculateBorderEdgeSize("horizontal") + self.BorderEdgeTextures["Top"]:SetSize(horizontalEdgesNewSize, 1) + self.BorderEdgeTextures["Bottom"]:SetSize(horizontalEdgesNewSize, 1) + end + + self.CenterBlock:Hide() + else + if (self.bHasBorder) then + self.BorderEdgeTextures["Left"]:Show() + self.BorderEdgeTextures["Right"]:Show() + end + + ---@type width, height + local cornerWidth, cornerHeight = 16, 16 + + self.CenterBlock:Show() + + for _, thisTexture in pairs(self.CornerTextures) do + thisTexture:SetSize(cornerWidth-self.cornerRoundness, cornerHeight-self.cornerRoundness) + end + + if (self.bHasBorder) then + for _, thisTexture in pairs(self.BorderCornerTextures) do + thisTexture:SetSize(cornerWidth-self.cornerRoundness, cornerHeight-self.cornerRoundness) + thisTexture.MaskTexture:SetSize(74-(self.cornerRoundness*0.75), 64-self.cornerRoundness) + end + + local horizontalEdgesNewSize = self:CalculateBorderEdgeSize("horizontal") + self.BorderEdgeTextures["Top"]:SetSize(horizontalEdgesNewSize, 1) + self.BorderEdgeTextures["Bottom"]:SetSize(horizontalEdgesNewSize, 1) + + local verticalEdgesNewSize = self:CalculateBorderEdgeSize("vertical") + self.BorderEdgeTextures["Left"]:SetSize(1, verticalEdgesNewSize) + self.BorderEdgeTextures["Right"]:SetSize(1, verticalEdgesNewSize) + end + end + end, + + ---get the size of the edge texture + ---@param self df_roundedpanel + ---@param alignment "vertical"|"horizontal" + ---@return number edgeSize + CalculateBorderEdgeSize = function(self, alignment) + ---@type string + local borderCornerName = next(self.BorderCornerTextures) + if (not borderCornerName) then + return 0 + end + + ---@type texture + local borderTexture = self.BorderCornerTextures[borderCornerName] + + alignment = alignment:lower() + + if (alignment == "vertical") then + return self:GetHeight() - (borderTexture:GetHeight() * 2) + 2 + + elseif (alignment == "horizontal") then + return self:GetWidth() - (borderTexture:GetHeight() * 2) + 2 + end + + error("df_roundedpanel:CalculateBorderEdgeSize(self, alignment) alignment must be 'vertical' or 'horizontal'") + end, + + ---@param self df_roundedpanel + CreateBorder = function(self) + local r, g, b, a = 0, 0, 0, 0.8 + + --create the corner edges + for i = 1, #cornerNames do + ---@type texture + local newBorderTexture = self:CreateTexture(nil, "background", nil, 0) + self.BorderCornerTextures[cornerNames[i]] = newBorderTexture + newBorderTexture:SetColorTexture(unpack(defaultColorTable)) + newBorderTexture:SetVertexColor(r, g, b, a) + self[cornerNames[i] .. "Border"] = newBorderTexture + end + + setCornerPoints(self, self.BorderCornerTextures, 16, 16, 1, 1, true) + + --create the top, left, bottom and right edges, the edge has 1pixel width and connects the corners + ---@type texture + local topEdge = self:CreateTexture(nil, "background", nil, 0) + topEdge:SetPoint("bottom", self, "top", 0, 0) + self.BorderEdgeTextures["Top"] = topEdge + + ---@type texture + local leftEdge = self:CreateTexture(nil, "background", nil, 0) + leftEdge:SetPoint("right", self, "left", 0, 0) + self.BorderEdgeTextures["Left"] = leftEdge + + ---@type texture + local bottomEdge = self:CreateTexture(nil, "background", nil, 0) + bottomEdge:SetPoint("top", self, "bottom", 0, 0) + self.BorderEdgeTextures["Bottom"] = bottomEdge + + ---@type texture + local rightEdge = self:CreateTexture(nil, "background", nil, 0) + rightEdge:SetPoint("left", self, "right", 0, 0) + self.BorderEdgeTextures["Right"] = rightEdge + + ---@type width + local horizontalEdgeSize = self:CalculateBorderEdgeSize("horizontal") + ---@type height + local verticalEdgeSize = self:CalculateBorderEdgeSize("vertical") + + --set the edges size + topEdge:SetSize(horizontalEdgeSize, 1) + leftEdge:SetSize(1, verticalEdgeSize) + bottomEdge:SetSize(horizontalEdgeSize, 1) + rightEdge:SetSize(1, verticalEdgeSize) + + for edgeName, thisTexture in pairs(self.BorderEdgeTextures) do + ---@cast thisTexture texture + thisTexture:SetColorTexture(unpack(defaultColorTable)) + thisTexture:SetVertexColor(r, g, b, a) + end + + self.TopEdgeBorder = topEdge + self.BottomEdgeBorder = bottomEdge + self.LeftEdgeBorder = leftEdge + self.RightEdgeBorder = rightEdge + + self.bHasBorder = true + end, + + ---@param self df_roundedpanel + ---@param red any + ---@param green number|nil + ---@param blue number|nil + ---@param alpha number|nil + SetTitleBarColor = function(self, red, green, blue, alpha) + if (self.bHasTitleBar) then + red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha) + self.TitleBar:SetColor(red, green, blue, alpha) + end + end, + + ---@param self df_roundedpanel + ---@param red any + ---@param green number|nil + ---@param blue number|nil + ---@param alpha number|nil + SetBorderCornerColor = function(self, red, green, blue, alpha) + if (not self.bHasBorder) then + self:CreateBorder() + end + + red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha) + + for _, thisTexture in pairs(self.BorderCornerTextures) do + thisTexture:SetVertexColor(red, green, blue, alpha) + end + + for _, thisTexture in pairs(self.BorderEdgeTextures) do + thisTexture:SetVertexColor(red, green, blue, alpha) + end + end, + + ---@param self df_roundedpanel + ---@param red any + ---@param green number|nil + ---@param blue number|nil + ---@param alpha number|nil + SetColor = function(self, red, green, blue, alpha) + red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha) + + for _, thisTexture in pairs(self.CornerTextures) do + thisTexture:SetVertexColor(red, green, blue, alpha) + end + + for _, thisTexture in pairs(self.CenterTextures) do + thisTexture:SetVertexColor(red, green, blue, alpha) + end + + if (self.bHasBorder) then + if (alpha < 0.98) then + --if using borders, the two border textures overlaps making the alpha be darker than it should + for _, thisTexture in pairs(self.BorderCornerTextures) do + thisTexture.MaskTexture:Show() + end + else + for _, thisTexture in pairs(self.BorderCornerTextures) do + thisTexture.MaskTexture:Hide() + end + end end end, } @@ -78,10 +449,20 @@ detailsFramework.RoundedCornerPanelMixin = { local defaultOptions = { width = 200, height = 200, - use_titlebar = true, - use_scalebar = true, + use_titlebar = false, + use_scalebar = false, title = "", scale = 1, + roundness = 0, + color = defaultColorTable, + border_color = defaultColorTable, + corner_texture = [[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]], +} + +local defaultPreset = { + border_color = {.1, .1, .1, 0.834}, + color = {defaultRed, defaultGreen, defaultBlue}, + roundness = 3, } ---create a regular panel with rounded corner @@ -94,13 +475,126 @@ function detailsFramework:CreateRoundedPanel(parent, name, optionsTable) local newRoundedPanel = CreateFrame("frame", name, parent, "BackdropTemplate") newRoundedPanel:EnableMouse(true) newRoundedPanel.__dftype = "df_roundedpanel" + newRoundedPanel.__rcorners = true detailsFramework:Mixin(newRoundedPanel, detailsFramework.RoundedCornerPanelMixin) detailsFramework:Mixin(newRoundedPanel, detailsFramework.OptionsFunctions) - newRoundedPanel:BuildOptionsTable(defaultOptions, optionsTable or {}) + newRoundedPanel:RoundedCornerConstructor() + newRoundedPanel:SetScript("OnSizeChanged", newRoundedPanel.OnSizeChanged) - newRoundedPanel:Constructor() + if (newRoundedPanel.options.use_titlebar) then + ---@type df_roundedpanel + local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = 26}) + titleBar:SetPoint("top", newRoundedPanel, "top", 0, -7) + newRoundedPanel.TitleBar = titleBar + titleBar:SetRoundness(5) + newRoundedPanel.bHasTitleBar = true + end + + if (newRoundedPanel.options.use_scalebar) then + detailsFramework:CreateScaleBar(newRoundedPanel.TitleBar or newRoundedPanel, newRoundedPanel.options) + newRoundedPanel:SetScale(newRoundedPanel.options.scale) + end + + newRoundedPanel:SetRoundness(newRoundedPanel.options.roundness) + newRoundedPanel:SetColor(newRoundedPanel.options.color) + newRoundedPanel:SetBorderCornerColor(newRoundedPanel.options.border_color) return newRoundedPanel -end \ No newline at end of file +end + +local applyPreset = function(frame, preset) + if (preset.border_color) then + frame:SetBorderCornerColor(preset.border_color) + end + + if (preset.color) then + frame:SetColor(preset.color) + end + + if (preset.roundness) then + frame:SetRoundness(preset.roundness) + else + frame:SetRoundness(1) + 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 +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.") + + if (frame.GetBackdropBorderColor) then + local red, green, blue, alpha = frame:GetBackdropBorderColor() + if (alpha and alpha > 0) then + detailsFramework:MsgWarning("AddRoundedCornersToFrame() applyed to a frame with a backdrop border.") + detailsFramework:Msg(debugstack(2, 1, 0)) + end + end + + ---@cast frame +df_roundedcornermixin + detailsFramework:Mixin(frame, detailsFramework.RoundedCornerPanelMixin) + + if (not frame["BuildOptionsTable"]) then + ---@cast frame +df_optionsmixin + detailsFramework:Mixin(frame, detailsFramework.OptionsFunctions) + end + + frame:BuildOptionsTable(defaultOptions, {}) + + frame.options.width = frame:GetWidth() + frame.options.height = frame:GetHeight() + + frame:RoundedCornerConstructor() + frame:HookScript("OnSizeChanged", frame.OnSizeChanged) + + frame.__rcorners = true + + --handle preset + if (preset and type(preset) == "table") then + applyPreset(frame, preset) + else + applyPreset(frame, defaultPreset) + end +end + +---test case: +C_Timer.After(1, function() if true then return end + local DF = DetailsFramework + + local parent = UIParent + local name = "NewRoundedCornerFrame" + local optionsTable = { + use_titlebar = true, + use_scalebar = true, + title = "Test", + scale = 1.0, + } + + ---@type df_roundedpanel + local frame = _G[name] or DF:CreateRoundedPanel(parent, name, optionsTable) + frame:SetSize(800, 600) + frame:SetPoint("center", parent, "center", 0, 0) + + frame:SetColor(.1, .1, .1, 1) + frame:SetTitleBarColor(.2, .2, .2, .5) + frame:SetBorderCornerColor(.2, .2, .2, .5) + frame:SetRoundness(0) + + local radiusSlider = DF:CreateSlider(frame, 120, 14, 0, 15, 1, frame.cornerRoundness, false, "RadiusBar", nil, nil, DF:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE")) + radiusSlider:SetHook("OnValueChange", function(self, fixedValue, value) + value = floor(value) + if (frame.cornerRoundness == value) then + return + end + frame:SetRoundness(value) + end) + + local radiusText = frame:CreateFontString(nil, "overlay", "GameFontNormal") + radiusText:SetText("Radius:") + radiusText:SetPoint("bottomleft", radiusSlider.widget, "topleft", 0, 0) + radiusSlider:SetPoint(10, -100) +end) \ No newline at end of file diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 1a344409..ada2e921 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 449 +local dversion = 450 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -40,7 +40,11 @@ DF.AuthorInfo = { } function DF:Msg(msg, ...) - print("|cFFFFFFAA" .. (self.__name or "FW Msg:") .. "|r ", msg, ...) + print("|cFFFFFFAA" .. (self.__name or "Details!Framework:") .. "|r ", msg, ...) +end + +function DF:MsgWarning(msg, ...) + print("|cFFFFFFAA" .. (self.__name or "Details!Framework") .. "|r |cFFFFAA00[Warning]|r", msg, ...) end local PixelUtil = PixelUtil or DFPixelUtil diff --git a/Libs/DF/label.lua b/Libs/DF/label.lua index 9ff0528e..a462993c 100644 --- a/Libs/DF/label.lua +++ b/Libs/DF/label.lua @@ -215,16 +215,24 @@ detailsFramework:Mixin(LabelMetaFunctions, detailsFramework.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --methods - --text text + ---set the text of the label and truncate it is its width passes 'maxWidth' threshold + ---@param self df_label + ---@param text string + ---@param maxWidth width function LabelMetaFunctions:SetTextTruncated(text, maxWidth) self.widget:SetText(text) detailsFramework:TruncateText(self.widget, maxWidth) end - --textcolor - function LabelMetaFunctions:SetTextColor(r, g, b, a) - r, g, b, a = detailsFramework:ParseColors(r, g, b, a) - return self.label:SetTextColor(r, g, b, a) + ---set the text color + ---@param self df_label + ---@param red any + ---@param green number|nil + ---@param blue number|nil + ---@param alpha number|nil + function LabelMetaFunctions:SetTextColor(red, green, blue, alpha) + red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha) + return self.label:SetTextColor(red, green, blue, alpha) end ------------------------------------------------------------------------------------------------------------ @@ -248,94 +256,127 @@ detailsFramework:Mixin(LabelMetaFunctions, detailsFramework.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --object constructor - function detailsFramework:CreateLabel(parent, text, size, color, font, member, name, layer) - return detailsFramework:NewLabel(parent, nil, name, member, text, font, size, color, layer) +---@class df_label +---@field widget fontstring widget and label points to the same fontstring +---@field label fontstring widget and label points to the same fontstring +---@field align justifyh +---@field valign justifyv +---@field text string +---@field width width +---@field height height +---@field fontcolor any +---@field color any +---@field fontface string +---@field fontsize number +---@field textcolor any +---@field textfont string +---@field textsize number +---@field shadow fontflags +---@field outline fontflags +---@field rotation number +---@field SetTemplate fun(self: df_label, template: table) set the fontstring visual by a template +---@field SetTextColor fun(self: df_label, red: any, green: number|nil, blue: number|nil, alpha: number|nil) set the button text color +---@field SetTextTruncated fun(self: df_label, text: string, maxWidth: width) + +---create a new label object +---@param parent frame +---@param text string +---@param size number|nil +---@param color any|nil +---@param font string|nil +---@param member string|nil +---@param name string|nil +---@param layer drawlayer|nil +---@return df_label|nil +function detailsFramework:CreateLabel(parent, text, size, color, font, member, name, layer) + return detailsFramework:NewLabel(parent, nil, name, member, text, font, size, color, layer) +end + +function detailsFramework:NewLabel(parent, container, name, member, text, font, size, color, layer) + if (not parent) then + return error("Details! Framework: parent not found.", 2) + end + if (not container) then + container = parent end - function detailsFramework:NewLabel(parent, container, name, member, text, font, size, color, layer) - if (not parent) then - return error("Details! Framework: parent not found.", 2) - end - if (not container) then - container = parent - end + if (not name) then + name = "DetailsFrameworkLabelNumber" .. detailsFramework.LabelNameCounter + detailsFramework.LabelNameCounter = detailsFramework.LabelNameCounter + 1 + end - if (not name) then - name = "DetailsFrameworkLabelNumber" .. detailsFramework.LabelNameCounter - detailsFramework.LabelNameCounter = detailsFramework.LabelNameCounter + 1 - end + if (name:find("$parent")) then + local parentName = detailsFramework.GetParentName(parent) + name = name:gsub("$parent", parentName) + end - if (name:find("$parent")) then - local parentName = detailsFramework.GetParentName(parent) - name = name:gsub("$parent", parentName) - end + ---@type df_label + local labelObject = {type = "label", dframework = true} - local labelObject = {type = "label", dframework = true} + if (member) then + parent[member] = labelObject + end - if (member) then - parent[member] = labelObject - end + if (parent.dframework) then + parent = parent.widget + end - if (parent.dframework) then - parent = parent.widget - end + if (container.dframework) then + container = container.widget + end - if (container.dframework) then - container = container.widget - end + if (not font or font == "") then + font = "GameFontNormal" + end - if (not font or font == "") then - font = "GameFontNormal" - end + labelObject.label = parent:CreateFontString(name, layer or "OVERLAY", font) + labelObject.widget = labelObject.label + labelObject.label.MyObject = labelObject - labelObject.label = parent:CreateFontString(name, layer or "OVERLAY", font) - labelObject.widget = labelObject.label - labelObject.label.MyObject = labelObject - - if (not loadedAPILabelFunctions) then - loadedAPILabelFunctions = true - local idx = getmetatable(labelObject.label).__index - for funcName, funcAddress in pairs(idx) do - if (not LabelMetaFunctions[funcName]) then - LabelMetaFunctions[funcName] = function(object, ...) - local x = loadstring( "return _G['"..object.label:GetName().."']:"..funcName.."(...)") - return x(...) - end + if (not loadedAPILabelFunctions) then + loadedAPILabelFunctions = true + local idx = getmetatable(labelObject.label).__index + for funcName, funcAddress in pairs(idx) do + if (not LabelMetaFunctions[funcName]) then + LabelMetaFunctions[funcName] = function(object, ...) + local x = loadstring( "return _G['"..object.label:GetName().."']:"..funcName.."(...)") + return x(...) end end end + end - --if the text is a table, it means a language table has been passed - if (type(text) == "table") then - local locTable = text - if (detailsFramework.Language.IsLocTable(locTable)) then - detailsFramework.Language.SetTextWithLocTable(labelObject.widget, locTable) - else - labelObject.label:SetText(text) - end + --if the text is a table, it means a language table has been passed + if (type(text) == "table") then + local locTable = text + if (detailsFramework.Language.IsLocTable(locTable)) then + detailsFramework.Language.SetTextWithLocTable(labelObject.widget, locTable) else labelObject.label:SetText(text) end + else + labelObject.label:SetText(text) + end - labelObject.label:SetJustifyH("left") + labelObject.label:SetJustifyH("left") - if (color) then - local r, g, b, a = detailsFramework:ParseColors(color) - labelObject.label:SetTextColor(r, g, b, a) - end + if (color) then + local r, g, b, a = detailsFramework:ParseColors(color) + labelObject.label:SetTextColor(r, g, b, a) + end - if (size and type(size) == "number") then - detailsFramework:SetFontSize(labelObject.label, size) - end + if (size and type(size) == "number") then + detailsFramework:SetFontSize(labelObject.label, size) + end - labelObject.HookList = {} + labelObject.HookList = {} - setmetatable(labelObject, LabelMetaFunctions) + setmetatable(labelObject, LabelMetaFunctions) - --if template has been passed as the third parameter - if (size and type(size) == "table") then - labelObject:SetTemplate(size) - end + --if template has been passed as the third parameter + if (size and type(size) == "table") then + labelObject:SetTemplate(size) + end - return labelObject - end \ No newline at end of file + return labelObject +end \ No newline at end of file diff --git a/Libs/DF/mixins.lua b/Libs/DF/mixins.lua index 6bdf6ba3..101ad248 100644 --- a/Libs/DF/mixins.lua +++ b/Libs/DF/mixins.lua @@ -269,6 +269,7 @@ detailsFramework.SetPointMixin = { ---mixin for options ---@class df_optionsmixin +---@field options table ---@field SetOption fun(self, optionName: string, optionValue: any) ---@field GetOption fun(self, optionName: string):any ---@field GetAllOptions fun(self):table diff --git a/Libs/DF/slider.lua b/Libs/DF/slider.lua index 75ef682c..8460a1c9 100644 --- a/Libs/DF/slider.lua +++ b/Libs/DF/slider.lua @@ -1178,6 +1178,8 @@ function DF:NewSlider (parent, container, name, member, width, height, minValue, if (label_template) then label:SetTemplate(label_template) end + + SliderObject.label = label end if (slider_template) then diff --git a/Libs/LibLuaServer/LibLuaServer.lua b/Libs/LibLuaServer/LibLuaServer.lua index 9e2d3405..6b5c09a2 100644 --- a/Libs/LibLuaServer/LibLuaServer.lua +++ b/Libs/LibLuaServer/LibLuaServer.lua @@ -29,6 +29,16 @@ ---| "right" ---| "center" +---@alias edgenames +---| "topleft" +---| "topright" +---| "bottomleft" +---| "bottomright" +---| "TopLeft" +---| "TopRight" +---| "BottomLeft" +---| "BottomRight" + ---@alias framestrata ---| "background" ---| "low" @@ -88,6 +98,12 @@ ---| "bottom" ---| "middle" +---@alias fontflags +---| "none" +---| "outline" +---| "thickoutline" +---| "monochrome" + ---@alias orientation ---| "HORIZONTAL" ---| "VERTICAL" @@ -115,6 +131,56 @@ ---| "pvp" ---| "scenario" +---@alias texturefilter +---| "LINEAR" +---| "TRILINEAR" +---| "NEAREST" + +---@alias texturewrap +---| "CLAMP" +---| "CLAMPTOBLACKADDITIVE" +---| "CLAMPTOBLACK" +---| "CLAMPTOWHITEADDITIVE" +---| "CLAMPTOWHITE" +---| "MIRROR" +---| "REPEAT" +---| "MIRRORONCE" + +---@alias blendmode +---| "ADD" +---| "BLEND" +---| "DISABLE" +---| "MOD" +---| "MOD2X" +---| "OVERLAY" +---| "ALPHAKEY" +---| "REPLACE" +---| "SUBTRACT" + +---@alias objecttype +---| "Frame" +---| "Button" +---| "FontString" +---| "Texture" +---| "StatusBar" +---| "Font" +---| "EditBox" +---| "CheckButton" +---| "Slider" +---| "Model" +---| "PlayerModel" +---| "DressUpModel" +---| "TabardModel" +---| "Cooldown" +---| "ScrollingMessageFrame" +---| "ScrollFrame" +---| "SimpleHTML" +---| "AnimationGroup" +---| "Animation" +---| "MessageFrame" +---| "Minimap" +---| "GameTooltip" + ---@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 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) @@ -182,7 +248,8 @@ ---@class texturetable : {texture: string, coords: texturecoords, size: objectsize} ---@class uiobject ----@field GetObjectType fun(self: uiobject) : string +---@field GetObjectType fun(self: uiobject) : objecttype +---@field IsObjectType fun(self: uiobject, objectType: string) : boolean ---@field Show fun(self: uiobject) make the object be shown on the user screen ---@field Hide fun(self: uiobject) make the object be hidden from the user screen ---@field SetShown fun(self: uiobject, state: boolean) show or hide the object @@ -271,6 +338,9 @@ ---@field SetBackdrop fun(self: frame, backdrop: backdrop|table) ---@field SetBackdropColor fun(self: frame, red: red|number, green: green|number, blue: blue|number, alpha: alpha|number) ---@field SetBackdropBorderColor fun(self: frame, red: red|number, green: green|number, blue: blue|number, alpha: alpha|number) +---@field GetBackdrop fun(self: frame) : backdrop +---@field GetBackdropColor fun(self: frame) : red|number, green|number, blue|number, alpha|number +---@field GetBackdropBorderColor fun(self: frame) : red|number, green|number, blue|number, alpha|number ---@field SetHitRectInsets fun(self: frame, left: number, right: number, top: number, bottom: number) ---@field SetToplevel fun(self: frame, toplevel: boolean) ---@field SetPropagateKeyboardInput fun(self: frame, propagate: boolean) @@ -289,6 +359,7 @@ ---@field GetChildren fun(self: frame) : frame[] ---@field GetRegions fun(self: frame) : region[] ---@field CreateTexture fun(self: frame, name: string|nil, layer: drawlayer, inherits: string|nil, subLayer: number|nil) : texture +---@field CreateMaskTexture fun(self: frame, name: string|nil, layer: drawlayer, inherits: string|nil, subLayer: number|nil) : texture ---@field CreateFontString fun(self: frame, name: string|nil, layer: drawlayer, inherits: string|nil, subLayer: number|nil) : fontstring ---@field EnableMouse fun(self: frame, enable: boolean) enable mouse interaction ---@field SetResizable fun(self: frame, enable: boolean) enable resizing of the frame @@ -400,11 +471,11 @@ ---@class texture : region ---@field SetDrawLayer fun(self: texture, layer: drawlayer, subLayer: number|nil) ----@field SetTexture fun(self: texture, path: string) +---@field SetTexture fun(self: texture, path: string, horizontalWrap: texturewrap|nil, verticalWrap: texturewrap|nil, filter: texturefilter|nil) ---@field SetAtlas fun(self: texture, atlas: string) ---@field SetColorTexture fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) ---@field SetDesaturated fun(self: texture, desaturate: boolean) ----@field SetBlendMode fun(self: texture, mode: "ADD"|"BLEND"|"DISABLE"|"MOD"|"MOD2X"|"OVERLAY"|"REPLACE"|"SUBTRACT") +---@field SetBlendMode fun(self: texture, mode: blendmode) ---@field SetVertexColor fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) ---@field GetPoint fun(self: texture, index: number) : string, table, string, number, number ---@field SetShown fun(self: texture, state: boolean) diff --git a/boot.lua b/boot.lua index 5809e7c3..9996d838 100644 --- a/boot.lua +++ b/boot.lua @@ -118,6 +118,10 @@ Details222.Actors = {} + Details222.CurrentDPS = { + Cache = {} + } + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --initialization stuff local _ diff --git a/classes/class_damage.lua b/classes/class_damage.lua index f987474d..757b62fe 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -156,12 +156,20 @@ function Details.SortKeyGroup (table1, table2) --[[exported]] end -function Details.SortKeySimple(table1, table2) --[[exported]] +function Details.SortKeySimple(table1, table2) --[[exported]] return table1[keyName] > table2[keyName] end +---sort by real time dps +---@param actor1 actor +---@param actor2 actor +---@return boolean +function Details.SortByRealTimeDps(actor1, actor2) + return (actor1.last_dps_realtime or 0) > (actor2.last_dps_realtime or 0) +end -function Details:ContainerSort (container, amount, keyName2) --[[exported]] + +function Details:ContainerSort (container, amount, keyName2) --[[exported]] keyName = keyName2 _table_sort(container, Details.SortKeySimple) @@ -216,13 +224,13 @@ function Details:GetTimeInCombat(petOwner) --[[exported]] if (petOwner) then if (Details.time_type == 1 or not petOwner.grupo) then return self:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then return self:GetCombatTime() end else if (Details.time_type == 1) then return self:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then return self:GetCombatTime() end end @@ -429,6 +437,7 @@ end --caches last_value = nil, last_dps = 0, --cache of the latest dps value calculated for this actor + last_dps_realtime = 0, --cache of the latest real time dps value calculated for this actor --start_time: the time when the actor started to do damage start_time = 0, --end_time: the time when the actor stopped to do damage @@ -461,27 +470,77 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --special cases - -- dps (calculate dps for actors) - function damageClass:ContainerRefreshDps (container, combat_time) - local total = 0 + --todo: Details.use_realtimedps "realtimedps_order_bars" need to come from the sorter function. + --todo: "realtimedps_always_arena" need to come from the sorter function because it'll have "realtimedps_order_bars" always on. - if (Details.time_type == 2 or not Details:CaptureGet("damage") or Details.time_type == 3) then - for _, actor in ipairs(container) do - if (actor.grupo) then - actor.last_dps = actor.total / combat_time - else - actor.last_dps = actor.total / actor:Tempo() - end - total = total + actor.last_dps - end - else - for _, actor in ipairs(container) do - actor.last_dps = actor.total / actor:Tempo() - total = total + actor.last_dps + ---calculate real time dps for each actor within the passed table + ---@param tableWithActors actor[] + ---@return number + function damageClass:RefreshDpsRealTime(tableWithActors) + local totalRealTime = 0 + local timeSample = Details222.CurrentDPS.GetTimeSample() + + for _, actorObject in ipairs(tableWithActors) do + ---@cast actorObject actordamage + ---@type details_currentdps_actorcache + local realTimeDPS = Details222.CurrentDPS.Cache[actorObject.serial] + if (realTimeDPS) then + realTimeDPS = realTimeDPS.totalDamage / timeSample + actorObject.last_dps_realtime = realTimeDPS + totalRealTime = totalRealTime + realTimeDPS end end - return total + return totalRealTime + end + + --dps (calculate dps for actors) + ---@param tableWithActors table + ---@param combatTime combattime + ---@return number, number + function damageClass:ContainerRefreshDps(tableWithActors, combatTime) + local total = 0 + local totalRealTime = 0 + + local bIsEffectiveTime = Details.time_type == 2 + local bOrderDpsByRealTime = Details.CurrentDps.CanSortByRealTimeDps() + local timeSample = Details222.CurrentDPS.GetTimeSample() + + if (bIsEffectiveTime or not Details:CaptureGet("damage")) then + for _, actorObject in ipairs(tableWithActors) do + ---@cast actorObject actordamage + if (actorObject.grupo) then + actorObject.last_dps = actorObject.total / combatTime + else + actorObject.last_dps = actorObject.total / actorObject:Tempo() + end + + if (bOrderDpsByRealTime) then + ---@type details_currentdps_actorcache + local realTimeDPS = Details222.CurrentDPS.Cache[actorObject.serial] + if (realTimeDPS) then + realTimeDPS = realTimeDPS.totalDamage / timeSample + actorObject.last_dps_realtime = realTimeDPS + totalRealTime = totalRealTime + realTimeDPS + end + end + + total = total + actorObject.last_dps + end + else + for _, actorObject in ipairs(tableWithActors) do + actorObject.last_dps = actorObject.total / actorObject:Tempo() + total = total + actorObject.last_dps + + if (bOrderDpsByRealTime) then + local realTimeDPS = Details222.CurrentDPS.Cache[actorObject.serial] or 0 + actorObject.last_dps_realtime = realTimeDPS + totalRealTime = totalRealTime + realTimeDPS + end + end + end + + return total, totalRealTime end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1679,11 +1738,16 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --main refresh function -function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, refreshRequired) - local showing = combatObject[class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable +---@param instanceObject instance +---@param combatObject combat +---@param bForceUpdate boolean +---@param bExportData boolean +function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, bExportData) + ---@type actorcontainer + local damageContainer = combatObject[class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable --not have something to show - if (#showing._ActorTable < 1) then + if (#damageContainer._ActorTable < 1) then if (Details.debug and false) then Details.showing_ActorTable_Timer = Details.showing_ActorTable_Timer or 0 if (time() > Details.showing_ActorTable_Timer) then @@ -1693,23 +1757,23 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end --colocado isso recentemente para fazer as barras de dano sumirem na troca de atributo - return Details:EsconderBarrasNaoUsadas(instancia, showing), "", 0, 0 + return Details:HideBarsNotInUse(instanceObject, damageContainer), "", 0, 0 end --total local total = 0 --top actor #1 - instancia.top = 0 + instanceObject.top = 0 local isUsingCache = false - local subAttribute = instancia.sub_atributo - local actorTableContent = showing._ActorTable + local subAttribute = instanceObject.sub_atributo + local actorTableContent = damageContainer._ActorTable local amount = #actorTableContent - local windowMode = instancia.modo + local windowMode = instanceObject.modo --pega qual a sub key que ser� usada --sub keys - if (exportar) then - if (type(exportar) == "boolean") then + if (bExportData) then + if (type(bExportData) == "boolean") then if (subAttribute == 1) then --DAMAGE DONE keyName = "total" @@ -1738,13 +1802,13 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re keyName = "damage_taken_by_spells" end else - keyName = exportar.key - windowMode = exportar.modo + keyName = bExportData.key + windowMode = bExportData.modo end - elseif (instancia.atributo == 5) then --custom + elseif (instanceObject.atributo == 5) then --custom keyName = "custom" - total = combatObject.totals [instancia.customName] + total = combatObject.totals [instanceObject.customName] else if (subAttribute == 1) then --DAMAGE DONE @@ -1777,14 +1841,14 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end if (keyName == "frags") then - local frags = instancia.showing.frags + local frags = instanceObject.showing.frags local frags_total_kills = 0 local index = 0 for fragName, fragAmount in pairs(frags) do - local fragged_actor = showing._NameIndexTable [fragName] --get index + local fragged_actor = damageContainer._NameIndexTable [fragName] --get index if (fragged_actor) then - fragged_actor = showing._ActorTable [fragged_actor] --get object + fragged_actor = damageContainer._ActorTable [fragged_actor] --get object if (fragged_actor) then index = index + 1 local actor_classe = fragged_actor.classe @@ -1815,15 +1879,15 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end end - instancia.top = 0 + instanceObject.top = 0 if (tsize > 0) then _table_sort(ntable, Details.Sort2) - instancia.top = ntable [1][2] + instanceObject.top = ntable [1][2] end total = index - if (exportar) then + if (bExportData) then local export = {} for i = 1, index do export [i] = {ntable[i][1], ntable[i][2], ntable[i][3]} @@ -1832,23 +1896,23 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end if (total < 1) then - instancia:EsconderScrollBar() - return Details:EndRefresh(instancia, total, combatObject, showing) --retorna a tabela que precisa ganhar o refresh + instanceObject:EsconderScrollBar() + return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh end combatObject.totals.frags_total = frags_total_kills - instancia:RefreshScrollBar(total) + instanceObject:RefreshScrollBar(total) local whichRowLine = 1 - local lineContainer = instancia.barras + local lineContainer = instanceObject.barras - for i = instancia.barraS[1], instancia.barraS[2], 1 do - damageClass:AtualizarFrags(ntable[i], whichRowLine, i, instancia) + for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do + damageClass:AtualizarFrags(ntable[i], whichRowLine, i, instanceObject) whichRowLine = whichRowLine+1 end - return Details:EndRefresh(instancia, total, combatObject, showing) --retorna a tabela que precisa ganhar o refresh + return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh elseif (keyName == "damage_taken_by_spells") then local bs_index, total = 0, 0 @@ -1953,43 +2017,41 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end end - instancia.top = 0 + instanceObject.top = 0 if (tsize > 0) then _table_sort(bs_table, Details.Sort2) - instancia.top = bs_table [1][2] + instanceObject.top = bs_table [1][2] end local total2 = bs_index - if (exportar) then + if (bExportData) then local export = {} for i = 1, bs_index do -- spellid, total, spellschool export [i] = {spellid = bs_table[i][1], damage = bs_table[i][2], spellschool = bs_table[i][3]} end - return total, "damage", instancia.top, bs_index, export + return total, "damage", instanceObject.top, bs_index, export end if (bs_index < 1) then - instancia:EsconderScrollBar() - return Details:EndRefresh(instancia, bs_index, combatObject, showing) --retorna a tabela que precisa ganhar o refresh + instanceObject:EsconderScrollBar() + return Details:EndRefresh(instanceObject, bs_index, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh end combatObject.totals.by_spell = total - instancia:RefreshScrollBar(bs_index) + instanceObject:RefreshScrollBar(bs_index) local whichRowLine = 1 - local lineContainer = instancia.barras + local lineContainer = instanceObject.barras - --print(bs_index, #bs_table, instancia.barraS[1], instancia.barraS[2]) - - for i = instancia.barraS[1], instancia.barraS[2], 1 do - damageClass:AtualizarBySpell (bs_table[i], whichRowLine, i, instancia) + for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do + damageClass:AtualizarBySpell (bs_table[i], whichRowLine, i, instanceObject) whichRowLine = whichRowLine+1 end - return Details:EndRefresh(instancia, bs_index, combatObject, showing) + return Details:EndRefresh(instanceObject, bs_index, combatObject, damageContainer) elseif (keyName == "voidzones") then local index = 0 @@ -2001,11 +2063,11 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re index = index + 1 --pega no container de dano o actor respons�vel por aplicar o debuff - local twin_damage_actor = showing._NameIndexTable [actor.damage_twin] or showing._NameIndexTable ["[*] " .. actor.damage_twin] + local twin_damage_actor = damageContainer._NameIndexTable [actor.damage_twin] or damageContainer._NameIndexTable ["[*] " .. actor.damage_twin] if (twin_damage_actor) then local index = twin_damage_actor - twin_damage_actor = showing._ActorTable [twin_damage_actor] + twin_damage_actor = damageContainer._ActorTable [twin_damage_actor] local spell = twin_damage_actor.spells._ActorTable [actor.damage_spellid] @@ -2067,35 +2129,35 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re if (tsize > 0 and vtable[1]) then _table_sort(vtable, void_zone_sort) - instancia.top = vtable [1].damage + instanceObject.top = vtable [1].damage end total = index - if (exportar) then + if (bExportData) then for _, t in ipairs(vtable) do t.report_name = Details:GetSpellLink(t.damage_spellid) end - return voidzone_damage_total, "damage", instancia.top, total, vtable, "report_name" + return voidzone_damage_total, "damage", instanceObject.top, total, vtable, "report_name" end if (total < 1) then - instancia:EsconderScrollBar() - return Details:EndRefresh(instancia, total, combatObject, showing) --retorna a tabela que precisa ganhar o refresh + instanceObject:EsconderScrollBar() + return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh end combatObject.totals.voidzone_damage = voidzone_damage_total - instancia:RefreshScrollBar(total) + instanceObject:RefreshScrollBar(total) local whichRowLine = 1 - local lineContainer = instancia.barras + local lineContainer = instanceObject.barras - for i = instancia.barraS[1], instancia.barraS[2], 1 do - vtable[i]:AtualizarVoidZone (whichRowLine, i, instancia) + for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do + vtable[i]:AtualizarVoidZone (whichRowLine, i, instanceObject) whichRowLine = whichRowLine+1 end - return Details:EndRefresh(instancia, total, combatObject, showing) --retorna a tabela que precisa ganhar o refresh + return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh else --/run Details:Dump(Details:GetCurrentCombat():GetActor(1, "Injured Steelspine 1")) @@ -2120,13 +2182,12 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re --keyName = "damage_taken" --result of the first actor - instancia.top = actorTableContent[1] and actorTableContent[1][keyName] + instanceObject.top = actorTableContent[1] and actorTableContent[1][keyName] - elseif (windowMode == modo_ALL) then --mostrando ALL + elseif (windowMode == DETAILS_MODE_ALL) then --mostrando ALL --faz o sort da categoria e retorna o amount corrigido - --print(keyName) if (subAttribute == 2) then - local combat_time = instancia.showing:GetCombatTime() + local combat_time = instanceObject.showing:GetCombatTime() total = damageClass:ContainerRefreshDps(actorTableContent, combat_time) else --pega o total ja aplicado na tabela do combate @@ -2136,25 +2197,16 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re amount = Details:ContainerSort(actorTableContent, amount, keyName) --grava o total - instancia.top = actorTableContent[1][keyName] + instanceObject.top = actorTableContent[1][keyName] - elseif (windowMode == modo_GROUP) then --mostrando GROUP - - --organiza as tabelas - - if (Details.in_combat and instancia.segmento == 0 and not exportar) then + elseif (windowMode == DETAILS_MODE_GROUP) then --mostrando GROUP + if (Details.in_combat and instanceObject.segmento == 0 and not bExportData) then isUsingCache = true end if (isUsingCache) then - actorTableContent = Details.cache_damage_group - if (subAttribute == 2) then --dps - local combat_time = instancia.showing:GetCombatTime() - damageClass:ContainerRefreshDps (actorTableContent, combat_time) - end - if (#actorTableContent < 1) then if (Details.debug and false) then Details.showing_ActorTable_Timer2 = Details.showing_ActorTable_Timer2 or 0 @@ -2164,29 +2216,58 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end end - return Details:EsconderBarrasNaoUsadas (instancia, showing), "", 0, 0 + return Details:HideBarsNotInUse(instanceObject, damageContainer), "", 0, 0 end - _table_sort(actorTableContent, Details.SortKeySimple) + local bOrderDpsByRealTime = Details.CurrentDps.CanSortByRealTimeDps() - if (actorTableContent[1][keyName] < 1) then - amount = 0 + if (subAttribute == 2) then --dps + local combatTime = combatObject:GetCombatTime() + local realTimeTotal = 0 + total, realTimeTotal = damageClass:ContainerRefreshDps(actorTableContent, combatTime) + + if (bOrderDpsByRealTime) then + total = realTimeTotal + end + + elseif (subAttribute == 1) then --damage done + if (bOrderDpsByRealTime) then + total = damageClass:RefreshDpsRealTime(actorTableContent) + end + end + + if (bOrderDpsByRealTime) then + _table_sort(actorTableContent, Details.SortByRealTimeDps) + + if (actorTableContent[1]["last_dps_realtime"] < 1) then + amount = 0 + else + instanceObject.top = actorTableContent[1].last_dps_realtime + amount = #actorTableContent + end else - instancia.top = actorTableContent[1][keyName] - amount = #actorTableContent - end + _table_sort(actorTableContent, Details.SortKeySimple) + if (actorTableContent[1][keyName] < 1) then + amount = 0 + else + instanceObject.top = actorTableContent[1][keyName] + amount = #actorTableContent + end - for i = 1, amount do - total = total + actorTableContent[i][keyName] + if (subAttribute ~= 2) then --other than dps because dps already did the iteration and the total is already calculated + for i = 1, amount do + total = total + actorTableContent[i][keyName] + end + end end else if (subAttribute == 2) then --dps - local combat_time = instancia.showing:GetCombatTime() - damageClass:ContainerRefreshDps (actorTableContent, combat_time) + local combatTime = combatObject:GetCombatTime() + damageClass:ContainerRefreshDps(actorTableContent, combatTime) end - _table_sort(actorTableContent, Details.SortKeyGroup) end + -- if (not isUsingCache) then for index, player in ipairs(actorTableContent) do @@ -2203,7 +2284,7 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end end - instancia.top = actorTableContent[1] and actorTableContent[1][keyName] + instanceObject.top = actorTableContent[1] and actorTableContent[1][keyName] end end @@ -2211,22 +2292,22 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re --refaz o mapa do container if (not isUsingCache) then - showing:remapear() + damageContainer:remapear() end - if (exportar) then - return total, keyName, instancia.top, amount + if (bExportData) then + return total, keyName, instanceObject.top, amount end if (amount < 1) then --n�o h� barras para mostrar - if (forcar) then - if (instancia.modo == 2) then --group - for i = 1, instancia.rows_fit_in_window do - Details.FadeHandler.Fader(instancia.barras [i], "in", Details.fade_speed) + if (bForceUpdate) then + if (instanceObject.modo == 2) then --group + for i = 1, instanceObject.rows_fit_in_window do + Details.FadeHandler.Fader(instanceObject.barras [i], "in", Details.fade_speed) end end end - instancia:EsconderScrollBar() --precisaria esconder a scroll bar + instanceObject:EsconderScrollBar() --precisaria esconder a scroll bar if (Details.debug and false) then Details.showing_ActorTable_Timer2 = Details.showing_ActorTable_Timer2 or 0 @@ -2236,26 +2317,26 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end end - return Details:EndRefresh(instancia, total, combatObject, showing) --retorna a tabela que precisa ganhar o refresh + return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh end - instancia:RefreshScrollBar(amount) + instanceObject:RefreshScrollBar(amount) local whichRowLine = 1 - local lineContainer = instancia.barras - local percentageType = instancia.row_info.percent_type - local barsShowData = instancia.row_info.textR_show_data - local barsBrackets = instancia:GetBarBracket() - local barsSeparator = instancia:GetBarSeparator() - local baseframe = instancia.baseframe - local useAnimations = Details.is_using_row_animations and (not baseframe.isStretching and not forcar and not baseframe.isResizing) + local lineContainer = instanceObject.barras + local percentageType = instanceObject.row_info.percent_type + local barsShowData = instanceObject.row_info.textR_show_data + local barsBrackets = instanceObject:GetBarBracket() + local barsSeparator = instanceObject:GetBarSeparator() + local baseframe = instanceObject.baseframe + local useAnimations = Details.is_using_row_animations and (not baseframe.isStretching and not bForceUpdate and not baseframe.isResizing) if (total == 0) then total = 0.00000001 end local myPos - local following = instancia.following.enabled and subAttribute ~= 6 + local following = instanceObject.following.enabled and subAttribute ~= 6 if (following) then if (isUsingCache) then @@ -2267,19 +2348,19 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end end else - myPos = showing._NameIndexTable [Details.playername] + myPos = damageContainer._NameIndexTable [Details.playername] end end - local combatTime = instancia.showing:GetCombatTime() - UsingCustomLeftText = instancia.row_info.textL_enable_custom_text - UsingCustomRightText = instancia.row_info.textR_enable_custom_text + local combatTime = instanceObject.showing:GetCombatTime() + UsingCustomLeftText = instanceObject.row_info.textL_enable_custom_text + UsingCustomRightText = instanceObject.row_info.textR_enable_custom_text local useTotalBar = false - if (instancia.total_bar.enabled) then + if (instanceObject.total_bar.enabled) then useTotalBar = true - if (instancia.total_bar.only_in_group and (not IsInGroup() and not IsInRaid())) then + if (instanceObject.total_bar.only_in_group and (not IsInGroup() and not IsInRaid())) then useTotalBar = false end @@ -2289,17 +2370,17 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end if (subAttribute == 2) then --dps - instancia.player_top_dps = actorTableContent [1].last_dps - instancia.player_top_dps_threshold = instancia.player_top_dps - (instancia.player_top_dps * 0.65) + instanceObject.player_top_dps = actorTableContent [1].last_dps + instanceObject.player_top_dps_threshold = instanceObject.player_top_dps - (instanceObject.player_top_dps * 0.65) end local totalBarIsShown - if (instancia.bars_sort_direction == 1) then --top to bottom - if (useTotalBar and instancia.barraS[1] == 1) then + if (instanceObject.bars_sort_direction == 1) then --top to bottom + if (useTotalBar and instanceObject.barraS[1] == 1) then whichRowLine = 2 - local iterLast = instancia.barraS[2] - if (iterLast == instancia.rows_fit_in_window) then + local iterLast = instanceObject.barraS[2] + if (iterLast == instanceObject.rows_fit_in_window) then iterLast = iterLast - 1 end @@ -2307,7 +2388,7 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re row1.minha_tabela = nil row1.lineText1:SetText(Loc ["STRING_TOTAL"]) - if (instancia.use_multi_fontstrings) then + if (instanceObject.use_multi_fontstrings) then row1.lineText2:SetText("") row1.lineText3:SetText(Details:ToK2(total)) row1.lineText4:SetText(Details:ToK(total / combatTime)) @@ -2316,59 +2397,59 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end row1:SetValue(100) - local r, g, b = unpack(instancia.total_bar.color) + local r, g, b = unpack(instanceObject.total_bar.color) row1.textura:SetVertexColor(r, g, b) - row1.icone_classe:SetTexture(instancia.total_bar.icon) + row1.icone_classe:SetTexture(instanceObject.total_bar.icon) row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) Details.FadeHandler.Fader(row1, "out") totalBarIsShown = true - if (following and myPos and myPos+1 > instancia.rows_fit_in_window and instancia.barraS[2] < myPos+1) then - for i = instancia.barraS[1], iterLast-1, 1 do + if (following and myPos and myPos+1 > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos+1) then + for i = instanceObject.barraS[1], iterLast-1, 1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end - actorTableContent[myPos]:RefreshLine(instancia, lineContainer, whichRowLine, myPos, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 else - for i = instancia.barraS[1], iterLast, 1 do + for i = instanceObject.barraS[1], iterLast, 1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end end else - if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then - for i = instancia.barraS[1], instancia.barraS[2]-1, 1 do + if (following and myPos and myPos > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos) then + for i = instanceObject.barraS[1], instanceObject.barraS[2]-1, 1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end - actorTableContent[myPos]:RefreshLine(instancia, lineContainer, whichRowLine, myPos, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 else - for i = instancia.barraS[1], instancia.barraS[2], 1 do + for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end end end - elseif (instancia.bars_sort_direction == 2) then --bottom to top - if (useTotalBar and instancia.barraS[1] == 1) then + elseif (instanceObject.bars_sort_direction == 2) then --bottom to top + if (useTotalBar and instanceObject.barraS[1] == 1) then whichRowLine = 2 - local iter_last = instancia.barraS[2] - if (iter_last == instancia.rows_fit_in_window) then + local iter_last = instanceObject.barraS[2] + if (iter_last == instanceObject.rows_fit_in_window) then iter_last = iter_last - 1 end @@ -2376,7 +2457,7 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re row1.minha_tabela = nil row1.lineText1:SetText(Loc ["STRING_TOTAL"]) - if (instancia.use_multi_fontstrings) then + if (instanceObject.use_multi_fontstrings) then row1.lineText2:SetText("") row1.lineText3:SetText(Details:ToK2(total)) row1.lineText4:SetText(Details:ToK(total / combatTime)) @@ -2385,47 +2466,46 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end row1:SetValue(100) - local r, g, b = unpack(instancia.total_bar.color) + local r, g, b = unpack(instanceObject.total_bar.color) row1.textura:SetVertexColor(r, g, b) - row1.icone_classe:SetTexture(instancia.total_bar.icon) + row1.icone_classe:SetTexture(instanceObject.total_bar.icon) row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) Details.FadeHandler.Fader(row1, "out") totalBarIsShown = true - if (following and myPos and myPos+1 > instancia.rows_fit_in_window and instancia.barraS[2] < myPos+1) then - actorTableContent[myPos]:RefreshLine(instancia, lineContainer, whichRowLine, myPos, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + if (following and myPos and myPos+1 > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos+1) then + actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 - for i = iter_last-1, instancia.barraS[1], -1 do + for i = iter_last-1, instanceObject.barraS[1], -1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end else - for i = iter_last, instancia.barraS[1], -1 do + for i = iter_last, instanceObject.barraS[1], -1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end end else - if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then - actorTableContent[myPos]:RefreshLine(instancia, lineContainer, whichRowLine, myPos, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + if (following and myPos and myPos > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos) then + actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 - for i = instancia.barraS[2]-1, instancia.barraS[1], -1 do + for i = instanceObject.barraS[2]-1, instanceObject.barraS[1], -1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end else - -- /run print(Details:GetInstance(1).barraS[2]) -- vai do 5 ao 1 -- qual barra come�a no 1 -- i = 5 at� 1 -- player 5 atualiza na barra 1 / player 1 atualiza na barra 5 - for i = instancia.barraS[2], instancia.barraS[1], -1 do + for i = instanceObject.barraS[2], instanceObject.barraS[1], -1 do if (actorTableContent[i]) then - actorTableContent[i]:RefreshLine(instancia, lineContainer, whichRowLine, i, total, subAttribute, forcar, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) + actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator) whichRowLine = whichRowLine+1 end end @@ -2435,29 +2515,29 @@ function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, re end if (totalBarIsShown) then - instancia:RefreshScrollBar(amount + 1) + instanceObject:RefreshScrollBar(amount + 1) else - instancia:RefreshScrollBar(amount) + instanceObject:RefreshScrollBar(amount) end if (useAnimations) then - instancia:PerformAnimations(whichRowLine - 1) + instanceObject:PerformAnimations(whichRowLine - 1) end --beta, hidar barras n�o usadas durante um refresh for�ado - if (forcar) then - if (instancia.modo == 2) then --group - for i = whichRowLine, instancia.rows_fit_in_window do - Details.FadeHandler.Fader(instancia.barras [i], "in", Details.fade_speed) + if (bForceUpdate) then + if (instanceObject.modo == 2) then --group + for i = whichRowLine, instanceObject.rows_fit_in_window do + Details.FadeHandler.Fader(instanceObject.barras [i], "in", Details.fade_speed) end end end Details.LastFullDamageUpdate = Details._tempo - instancia:AutoAlignInLineFontStrings() + instanceObject:AutoAlignInLineFontStrings() - return Details:EndRefresh(instancia, total, combatObject, showing) --retorna a tabela que precisa ganhar o refresh + return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh end --[[exported]] function Details:AutoAlignInLineFontStrings() @@ -2586,7 +2666,7 @@ local actor_class_color_r, actor_class_color_g, actor_class_color_b perSecondText = perSecondText or "" percentText = percentText or "" - if ((Details.time_type == 3 or (Details.combat_log.evoker_show_realtimedps and Details.playerspecid == 1473)) and Details.in_combat) then --real time + if ((Details.use_realtimedps or (Details.combat_log.evoker_show_realtimedps and Details.playerspecid == 1473)) and Details.in_combat) then --real time if (thisLine:GetActor()) then local actorSerial = thisLine:GetActor().serial local currentDps = Details.CurrentDps.GetCurrentDps(actorSerial) @@ -2631,7 +2711,7 @@ local actor_class_color_r, actor_class_color_g, actor_class_color_b end -- ~atualizar ~barra ~update -function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, total, sub_atributo, forcar, keyName, combat_time, percentage_type, bUseAnimations, bars_show_data, bars_brackets, bars_separator) +function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, rank, total, subAttribute, bForceRefresh, keyName, combatTime, percentageType, bUseAnimations, bars_show_data, bars_brackets, bars_separator) local thisLine = lineContainer[whichRowLine] if (not thisLine) then @@ -2652,37 +2732,37 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to local percentNumber --calc the percent amount base on the percent type - if (percentage_type == 1) then + if (percentageType == 1) then percentString = format("%.1f", self[keyName] / total * 100) - elseif (percentage_type == 2) then - percentString = format("%.1f", self[keyName] / instance.top * 100) + elseif (percentageType == 2) then + percentString = format("%.1f", self[keyName] / instanceObject.top * 100) end local currentCombat = Details:GetCurrentCombat() --calculate the actor dps - if ((Details.time_type == 2 and self.grupo) or not Details:CaptureGet("damage") or instance.segmento == -1 or Details.time_type == 3) then - if (Details.time_type == 3 and Details.in_combat) then - local currentDps = Details.CurrentDps.GetCurrentDps(self.serial) + 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 (instance.segmento == -1 and combat_time == 0) 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 / combat_time + dps = damageTotal / combatTime self.last_dps = dps end else - dps = damageTotal / combat_time + dps = damageTotal / combatTime self.last_dps = dps end end @@ -2701,41 +2781,45 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to end --right text - if (sub_atributo == 1) then --damage done + if (subAttribute == 1) then --damage done dps = _math_floor(dps) - local formated_damage = SelectedToKFunction(_, damageTotal) - local formated_dps = SelectedToKFunction(_, dps) - thisLine.ps_text = formated_dps + local formatedDamage = SelectedToKFunction(_, damageTotal) + local formatedDps = SelectedToKFunction(_, dps) + thisLine.ps_text = formatedDps - if (not bars_show_data [1]) then - formated_damage = "" + if (not bars_show_data[1]) then + formatedDamage = "" end - if (not bars_show_data [2]) then - formated_dps = "" + if (not bars_show_data[2]) then + formatedDps = "" end - if (not bars_show_data [3]) then + if (not bars_show_data[3]) then percentString = "" else percentString = percentString .. "%" end - local rightText = formated_damage .. bars_brackets[1] .. formated_dps .. bars_separator .. percentString .. bars_brackets[2] + local rightText = formatedDamage .. bars_brackets[1] .. formatedDps .. bars_separator .. percentString .. bars_brackets[2] if (UsingCustomRightText) then - thisLine.lineText4:SetText(stringReplace(instance.row_info.textR_custom_text, formated_damage, formated_dps, percentString, self, instance.showing, instance, rightText)) + thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formatedDamage, formatedDps, percentString, self, instanceObject.showing, instanceObject, rightText)) else - if (instance.use_multi_fontstrings) then - instance:SetInLineTexts(thisLine, formated_damage, formated_dps, percentString) + if (instanceObject.use_multi_fontstrings) then + instanceObject:SetInLineTexts(thisLine, formatedDamage, formatedDps, percentString) else thisLine.lineText4:SetText(rightText) end end - percentNumber = _math_floor((damageTotal/instance.top) * 100) + if (Details.CurrentDps.CanSortByRealTimeDps()) then + percentNumber = _math_floor((self.last_dps_realtime / instanceObject.top) * 100) + else + percentNumber = _math_floor((damageTotal/instanceObject.top) * 100) + end - elseif (sub_atributo == 2) then --dps + elseif (subAttribute == 2) then --dps local raw_dps = dps dps = _math_floor(dps) @@ -2746,12 +2830,12 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to local diff_from_topdps if (rank > 1) then - diff_from_topdps = instance.player_top_dps - raw_dps + diff_from_topdps = instanceObject.player_top_dps - raw_dps end local rightText if (diff_from_topdps) then - local threshold = diff_from_topdps / instance.player_top_dps_threshold * 100 + local threshold = diff_from_topdps / instanceObject.player_top_dps_threshold * 100 if (threshold < 100) then threshold = abs(threshold - 100) else @@ -2787,20 +2871,20 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to end if (UsingCustomRightText) then - thisLine.lineText4:SetText(stringReplace(instance.row_info.textR_custom_text, formated_dps, formated_damage, percentString, self, instance.showing, instance, rightText)) + thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_dps, formated_damage, percentString, self, instanceObject.showing, instanceObject, rightText)) else - if (instance.use_multi_fontstrings) then + if (instanceObject.use_multi_fontstrings) then --instance:SetInLineTexts(thisLine, formated_damage, formated_dps, porcentagem) - instance:SetInLineTexts(thisLine, rightText) + instanceObject:SetInLineTexts(thisLine, rightText) else thisLine.lineText4:SetText(rightText) end end - percentNumber = _math_floor((dps/instance.top) * 100) + percentNumber = _math_floor((dps/instanceObject.top) * 100) - elseif (sub_atributo == 3) then --damage taken - local dtps = self.damage_taken / combat_time + elseif (subAttribute == 3) then --damage taken + local dtps = self.damage_taken / combatTime local formated_damage_taken = SelectedToKFunction(_, self.damage_taken) local formated_dtps = SelectedToKFunction(_, dtps) @@ -2820,18 +2904,18 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to local rightText = formated_damage_taken .. bars_brackets[1] .. formated_dtps .. bars_separator .. percentString .. bars_brackets[2] if (UsingCustomRightText) then - thisLine.lineText4:SetText(stringReplace(instance.row_info.textR_custom_text, formated_damage_taken, formated_dtps, percentString, self, instance.showing, instance, rightText)) + thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_damage_taken, formated_dtps, percentString, self, instanceObject.showing, instanceObject, rightText)) else - if (instance.use_multi_fontstrings) then - instance:SetInLineTexts(thisLine, formated_damage_taken, formated_dtps, percentString) + if (instanceObject.use_multi_fontstrings) then + instanceObject:SetInLineTexts(thisLine, formated_damage_taken, formated_dtps, percentString) else thisLine.lineText4:SetText(rightText) end end - percentNumber = _math_floor((self.damage_taken/instance.top) * 100) + percentNumber = _math_floor((self.damage_taken/instanceObject.top) * 100) - elseif (sub_atributo == 4) then --friendly fire + elseif (subAttribute == 4) then --friendly fire local formated_friendly_fire = SelectedToKFunction(_, self.friendlyfire_total) if (not bars_show_data [1]) then @@ -2845,18 +2929,18 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to local rightText = formated_friendly_fire .. bars_brackets[1] .. percentString .. bars_brackets[2] if (UsingCustomRightText) then - thisLine.lineText4:SetText(stringReplace(instance.row_info.textR_custom_text, formated_friendly_fire, "", percentString, self, instance.showing, instance, rightText)) + thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_friendly_fire, "", percentString, self, instanceObject.showing, instanceObject, rightText)) else - if (instance.use_multi_fontstrings) then - instance:SetInLineTexts(thisLine, "", formated_friendly_fire, percentString) + if (instanceObject.use_multi_fontstrings) then + instanceObject:SetInLineTexts(thisLine, "", formated_friendly_fire, percentString) else thisLine.lineText4:SetText(rightText) end end - percentNumber = _math_floor((self.friendlyfire_total/instance.top) * 100) + percentNumber = _math_floor((self.friendlyfire_total/instanceObject.top) * 100) - elseif (sub_atributo == 6) then --enemies - local dtps = self.damage_taken / combat_time + elseif (subAttribute == 6) then --enemies + local dtps = self.damage_taken / combatTime local formatedDamageTaken = SelectedToKFunction(_, self.damage_taken) local formatedDtps = SelectedToKFunction(_, dtps) @@ -2876,38 +2960,40 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to local rightText = formatedDamageTaken .. bars_brackets[1] .. formatedDtps .. bars_separator .. percentString .. bars_brackets[2] if (UsingCustomRightText) then - thisLine.lineText4:SetText(stringReplace(instance.row_info.textR_custom_text, formatedDamageTaken, formatedDtps, percentString, self, instance.showing, instance, rightText)) + thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formatedDamageTaken, formatedDtps, percentString, self, instanceObject.showing, instanceObject, rightText)) else - if (instance.use_multi_fontstrings) then - instance:SetInLineTexts(thisLine, formatedDamageTaken, formatedDtps, percentString) + if (instanceObject.use_multi_fontstrings) then + instanceObject:SetInLineTexts(thisLine, formatedDamageTaken, formatedDtps, percentString) else thisLine.lineText4:SetText(rightText) end end - percentNumber = _math_floor((self.damage_taken/instance.top) * 100) + percentNumber = _math_floor((self.damage_taken/instanceObject.top) * 100) end --need tooltip update? - if (thisLine.mouse_over and not instance.baseframe.isMoving) then - gump:UpdateTooltip(whichRowLine, thisLine, instance) + if (thisLine.mouse_over and not instanceObject.baseframe.isMoving) then + gump:UpdateTooltip(whichRowLine, thisLine, instanceObject) end if (self.need_refresh) then self.need_refresh = false - forcar = true + bForceRefresh = true end actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor() - return self:RefreshLineValue(thisLine, instance, previousData, forcar, percentNumber, bUseAnimations, total, instance.top) + return self:RefreshLineValue(thisLine, instanceObject, previousData, bForceRefresh, percentNumber, bUseAnimations, total, instanceObject.top) end ---show an extra statusbar on the line, after the main statusbar ---@param thisLine table ---@param amount valueamount ----@param amountPercent number ---@param extraAmount valueamount +---@param totalAmount valueamount +---@param topAmount valueamount +---@param instanceObject instance function Details:ShowExtraStatusbar(thisLine, amount, extraAmount, totalAmount, topAmount, instanceObject) if (extraAmount and extraAmount > 0 and Details.combat_log.evoker_calc_damage) then local extraStatusbar = thisLine.extraStatusbar @@ -2947,7 +3033,7 @@ end function Details:RefreshLineValue(thisLine, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) --[[exported]] thisLine.extraStatusbar:Hide() - if (thisLine.colocacao == 1) then + if (thisLine.colocacao == 1) then thisLine.animacao_ignorar = true if (not previousData or previousData ~= thisLine.minha_tabela or isForceRefresh) then @@ -3344,7 +3430,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local meu_tempo if (Details.time_type == 1 or not self.grupo) then meu_tempo = self:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then meu_tempo = instancia.showing:GetCombatTime() end @@ -3532,7 +3618,7 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local timeInCombat = 0 if (Details.time_type == 1 or not self.grupo) then timeInCombat = petActorObject:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then timeInCombat = petActorObject:GetCombatTime() end @@ -4753,7 +4839,7 @@ function damageClass:MontaInfoDamageDone() --I guess this fills the list of spel local actorCombatTime if (Details.time_type == 1 or not actorObject.grupo) then actorCombatTime = actorObject:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then actorCombatTime = breakdownWindowFrame.instancia.showing:GetCombatTime() end @@ -5732,7 +5818,7 @@ function damageClass:MontaDetalhesDamageDone (spellId, spellLine, instance) --th if (Details.time_type == 1 or not self.grupo) then meu_tempo = self:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then meu_tempo = breakdownWindowFrame.instancia.showing:GetCombatTime() end @@ -6068,8 +6154,6 @@ function damageClass:MontaDetalhesDamageDone (spellId, spellLine, instance) --th local percentFromPeak = damageDone / maxValue --normalized thisTexture:SetHeight(math.min(percentFromPeak * height, height - 15)) thisTexture:Show() - - --print("DEBUG", 7 , "Peak:", percentFromPeak, "position:", texturePosition, "damage done:", damageDone) --debug end --show bloodlust indicators, member .bloodlust is not guarantted @@ -6298,7 +6382,7 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate local meu_tempo if (Details.time_type == 1 or not self.grupo) then meu_tempo = self:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then meu_tempo = breakdownWindowFrame.instancia.showing:GetCombatTime() end diff --git a/classes/class_heal.lua b/classes/class_heal.lua index 86a68682..cea2aaf3 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -213,7 +213,7 @@ function healingClass:RefreshWindow (instancia, tabela_do_combate, forcar, expor --n�o h� barras para mostrar -- not have something to show if (#showing._ActorTable < 1) then --n�o h� barras para mostrar --colocado isso recentemente para fazer as barras de dano sumirem na troca de atributo - return _detalhes:EsconderBarrasNaoUsadas (instancia, showing), "", 0, 0 + return _detalhes:HideBarsNotInUse(instancia, showing), "", 0, 0 end --total @@ -309,7 +309,7 @@ function healingClass:RefreshWindow (instancia, tabela_do_combate, forcar, expor end if (#conteudo < 1) then - return _detalhes:EsconderBarrasNaoUsadas (instancia, showing), "", 0, 0 + return _detalhes:HideBarsNotInUse(instancia, showing), "", 0, 0 end _detalhes:ContainerSortHeal (conteudo, nil, keyName) @@ -1992,7 +1992,7 @@ function healingClass:MontaInfoHealingDone() local actorCombatTime if (Details.time_type == 1 or not actorObject.grupo) then actorCombatTime = actorObject:Tempo() - elseif (Details.time_type == 2 or Details.time_type == 3) then + elseif (Details.time_type == 2 or Details.use_realtimedps) then actorCombatTime = breakdownWindowFrame.instancia.showing:GetCombatTime() end diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 7981f9d0..d7d52957 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -3273,7 +3273,7 @@ local function GetDpsHps (_thisActor, key) if (_thisActor [keyname]) then return _thisActor [keyname] else - if ((Details.time_type == 2 and _thisActor.grupo) or not Details:CaptureGet("damage") or Details.time_type == 3) then + if ((Details.time_type == 2 and _thisActor.grupo) or not Details:CaptureGet("damage") or Details.use_realtimedps) then local dps = _thisActor.total / _thisActor:GetCombatTime() _thisActor [keyname] = dps return dps @@ -3788,7 +3788,7 @@ function Details:envia_relatorio (linhas, custom) end --effective ou active time - if (Details.time_type == 2 or Details.time_type == 3) then + if (Details.time_type == 2 or Details.use_realtimedps) then linhas[1] = linhas[1] .. " [" .. segmentTime .. " EF]" else linhas[1] = linhas[1] .. " [" .. segmentTime .. " AC]" diff --git a/classes/class_resources.lua b/classes/class_resources.lua index a706eeb9..4cd0d3f8 100644 --- a/classes/class_resources.lua +++ b/classes/class_resources.lua @@ -283,7 +283,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex local showing = tabela_do_combate [class_type] if (#showing._ActorTable < 1) then --n�o h� barras para mostrar - return _detalhes:EsconderBarrasNaoUsadas (instancia, showing), "", 0, 0 + return _detalhes:HideBarsNotInUse(instancia, showing), "", 0, 0 end local total = 0 diff --git a/classes/class_utility.lua b/classes/class_utility.lua index b349be4c..d53ce036 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -652,7 +652,7 @@ function atributo_misc:RefreshWindow(instance, combatObject, bIsForceRefresh, bI local utilityActorContainer = combatObject[class_type] if (#utilityActorContainer._ActorTable < 1) then --n�o h� barras para mostrar - return _detalhes:EsconderBarrasNaoUsadas (instance, utilityActorContainer), "", 0, 0 + return _detalhes:HideBarsNotInUse(instance, utilityActorContainer), "", 0, 0 end local total = 0 diff --git a/core/control.lua b/core/control.lua index bda1acfa..2669a971 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1795,10 +1795,10 @@ end function Details:EndRefresh (instancia, total, combatTable, showing) - Details:EsconderBarrasNaoUsadas (instancia, showing) + Details:HideBarsNotInUse(instancia, showing) end - function Details:EsconderBarrasNaoUsadas (instancia, showing) + function Details:HideBarsNotInUse(instancia, showing) --primeira atualiza��o ap�s uma mudan�a de segmento -- verifica se h� mais barras sendo mostradas do que o necess�rio -------------------- if (instancia.v_barras) then diff --git a/frames/window_breakdown/window_playerbreakdown.lua b/frames/window_breakdown/window_playerbreakdown.lua index 1fae30d4..eae5de55 100644 --- a/frames/window_breakdown/window_playerbreakdown.lua +++ b/frames/window_breakdown/window_playerbreakdown.lua @@ -243,6 +243,12 @@ function Details222.BreakdownWindow.RefreshPlayerScroll() end end +Details.PlayerBreakdown.RoundedCornerPreset = { + roundness = 6, + color = {.1, .1, .1, 0.98}, + border_color = {.05, .05, .05, 0.834}, +} + ---open the breakdown window ---@param self details ---@param instanceObject instance @@ -255,6 +261,13 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute ---@type number, number local mainAttribute, subAttribute = instanceObject:GetDisplay() + if (not breakdownWindowFrame.__rcorners) then + breakdownWindowFrame:SetBackdropColor(.1, .1, .1, 0) + breakdownWindowFrame:SetBackdropBorderColor(.1, .1, .1, 0) + breakdownWindowFrame.__background:Hide() + detailsFramework:AddRoundedCornersToFrame(breakdownWindowFrame, Details.PlayerBreakdown.RoundedCornerPreset) + end + if (not Details.row_singleclick_overwrite[mainAttribute] or not Details.row_singleclick_overwrite[mainAttribute][subAttribute]) then Details:CloseBreakdownWindow() return @@ -711,7 +724,8 @@ function Details:CreateBreakdownWindow() table.insert(summaryWidgets, SWW) --where SummaryWidgets is declared: at the header of the file, what is the purpose of this table? breakdownWindowFrame.SummaryWindowWidgets:Hide() - detailsFramework:CreateScaleBar(breakdownWindowFrame, Details.player_details_window) + local scaleBar = detailsFramework:CreateScaleBar(breakdownWindowFrame, Details.player_details_window) + scaleBar.label:AdjustPointsOffset(-6, 3) breakdownWindowFrame:SetScale(Details.player_details_window.scale) --class icon @@ -720,21 +734,17 @@ function Details:CreateBreakdownWindow() breakdownWindowFrame.classIcon:SetSize(54, 54) breakdownWindowFrame.classIcon:SetAlpha(0.7) - --close button - breakdownWindowFrame.closeButton = CreateFrame("Button", nil, breakdownWindowFrame, "UIPanelCloseButton") - breakdownWindowFrame.closeButton:SetSize(20, 20) - breakdownWindowFrame.closeButton:SetPoint("TOPRIGHT", breakdownWindowFrame, "TOPRIGHT", -5, -4) - breakdownWindowFrame.closeButton:SetFrameLevel(breakdownWindowFrame:GetFrameLevel()+5) - breakdownWindowFrame.closeButton:GetNormalTexture():SetDesaturated(true) - breakdownWindowFrame.closeButton:GetNormalTexture():SetVertexColor(.6, .6, .6) - breakdownWindowFrame.closeButton:SetScript("OnClick", function(self) + local closeButton = detailsFramework:CreateCloseButton(breakdownWindowFrame) + closeButton:SetPoint("topright", breakdownWindowFrame, "topright", -2, -2) + closeButton:SetScript("OnClick", function(self) Details:CloseBreakdownWindow() end) + breakdownWindowFrame.closeButton = closeButton --title detailsFramework:NewLabel(breakdownWindowFrame, breakdownWindowFrame, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) breakdownWindowFrame.titleText:SetPoint("center", breakdownWindowFrame, "center") - breakdownWindowFrame.titleText:SetPoint("top", breakdownWindowFrame, "top", 0, -6) + breakdownWindowFrame.titleText:SetPoint("top", breakdownWindowFrame, "top", 0, -3) --create the texts shown on the window do @@ -766,17 +776,18 @@ function Details:CreateBreakdownWindow() statusBar:SetPoint("bottomleft", breakdownWindowFrame, "bottomleft") statusBar:SetPoint("bottomright", breakdownWindowFrame, "bottomright") statusBar:SetHeight(PLAYER_DETAILS_STATUSBAR_HEIGHT) - detailsFramework:ApplyStandardBackdrop(statusBar) + --detailsFramework:ApplyStandardBackdrop(statusBar) statusBar:SetAlpha(PLAYER_DETAILS_STATUSBAR_ALPHA) breakdownWindowFrame.statusBar = statusBar statusBar.Text = detailsFramework:CreateLabel(statusBar) - statusBar.Text:SetPoint("left", 2, 0) + statusBar.Text:SetPoint("left", 12, 0) --create the gradients in the top and bottom side of the breakdown window local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background") local gradientUp = detailsFramework:CreateTexture(breakdownWindowFrame, {gradient = "vertical", fromColor = gradientStartColor, toColor = {0, 0, 0, 0.2}}, 1, 68, "artwork", {0, 1, 0, 1}) - gradientUp:SetPoint("tops", 1, 1) + gradientUp:SetPoint("tops", 1, 18) + --gradientUp:Hide() local gradientHeight = 481 local gradientDown = detailsFramework:CreateTexture(breakdownWindowFrame, {gradient = "vertical", fromColor = "transparent", toColor = {0, 0, 0, 0.7}}, 1, gradientHeight, "border", {0, 1, 0, 1}) diff --git a/frames/window_breakdown/window_playerbreakdown_list.lua b/frames/window_breakdown/window_playerbreakdown_list.lua index ce08942e..fd571de7 100644 --- a/frames/window_breakdown/window_playerbreakdown_list.lua +++ b/frames/window_breakdown/window_playerbreakdown_list.lua @@ -1,6 +1,9 @@ local Details = _G.Details + +---@class detailsframework local detailsFramework = _G.DetailsFramework + local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true) local addonName, Details222 = ... @@ -11,6 +14,7 @@ local C_Timer = _G.C_Timer local tinsert = table.insert local CreateFrame = CreateFrame local GetSpecializationInfoByID = GetSpecializationInfoByID +local PixelUtil = PixelUtil local scrollbox_size = {215, 405} local scrollbox_lines = 19 @@ -30,20 +34,30 @@ function breakdownWindowPlayerList.CreatePlayerListFrame() local pluginsFrame = breakdownWindowFrame.BreakdownPluginSelectionFrame breakdownSideMenu:SetSize(scrollbox_size[1], scrollbox_size[2]) - breakdownSideMenu:SetPoint("topright", breakdownWindowFrame, "topleft", 0, 0) - breakdownSideMenu:SetPoint("bottomright", breakdownWindowFrame, "bottomleft", 0, 0) - detailsFramework:ApplyStandardBackdrop(breakdownSideMenu) - breakdownSideMenu.RightEdge:Hide() + PixelUtil.SetPoint(breakdownSideMenu, "topright", breakdownWindowFrame, "topleft", -2, 0) + PixelUtil.SetPoint(breakdownSideMenu, "bottomright", breakdownWindowFrame, "bottomleft", -2, 0) + --detailsFramework:ApplyStandardBackdrop(breakdownSideMenu) + --breakdownSideMenu.RightEdge:Hide() + + detailsFramework:AddRoundedCornersToFrame(breakdownSideMenu, Details.PlayerBreakdown.RoundedCornerPreset) local titleHeight = 20 --plugins menu title bar local titleBarPlugins = CreateFrame("frame", nil, breakdownSideMenu, "BackdropTemplate") - PixelUtil.SetPoint(titleBarPlugins, "topleft", breakdownSideMenu, "topleft", 2, -3) - PixelUtil.SetPoint(titleBarPlugins, "topright", breakdownSideMenu, "topright", -2, -3) + PixelUtil.SetPoint(titleBarPlugins, "topleft", breakdownSideMenu, "topleft", 2, -0) + PixelUtil.SetPoint(titleBarPlugins, "topright", breakdownSideMenu, "topright", -2, -0) titleBarPlugins:SetHeight(titleHeight) - titleBarPlugins:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) - titleBarPlugins:SetBackdropColor(.5, .5, .5, 1) - titleBarPlugins:SetBackdropBorderColor(0, 0, 0, 1) + --titleBarPlugins:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) + --titleBarPlugins:SetBackdropColor(.5, .5, .5, 1) + --titleBarPlugins:SetBackdropBorderColor(0, 0, 0, 1) + + ---@type df_roundedpanel_preset + --local titleBarRoundedCornerPreset = { + -- roundness = 5, + -- color = {.05, .05, .05, 1}, + -- border_color = "transparent", + --} + --detailsFramework:AddRoundedCornersToFrame(titleBarPlugins, titleBarRoundedCornerPreset) --title label local titleBarPlugins_TitleLabel = detailsFramework:NewLabel(titleBarPlugins, titleBarPlugins, nil, "titulo", "Plugins", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) @@ -53,9 +67,9 @@ function breakdownWindowPlayerList.CreatePlayerListFrame() --plugins menu title bar local titleBarPlayerSeparator = CreateFrame("frame", nil, breakdownSideMenu, "BackdropTemplate") titleBarPlayerSeparator:SetHeight(titleHeight) - titleBarPlayerSeparator:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) - titleBarPlayerSeparator:SetBackdropColor(.5, .5, .5, 1) - titleBarPlayerSeparator:SetBackdropBorderColor(0, 0, 0, 1) + --titleBarPlayerSeparator:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) + --titleBarPlayerSeparator:SetBackdropColor(.5, .5, .5, 1) + --titleBarPlayerSeparator:SetBackdropBorderColor(0, 0, 0, 1) --title label local titleBarTools_TitleLabel = detailsFramework:NewLabel(titleBarPlayerSeparator, titleBarPlayerSeparator, nil, "titulo", "Players", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) @@ -349,12 +363,6 @@ function breakdownWindowPlayerList.CreatePlayerListFrame() totalStatusBar:SetFrameLevel(line:GetFrameLevel()+1) totalStatusBar:SetAlpha(0.5) - --setup anchors - --specIcon:SetPoint("topleft", line, "topleft", 0, 0) - --roleIcon:SetPoint("topleft", specIcon, "topright", 2, 0) - --playerName:SetPoint("topleft", specIcon, "topright", 2, -3) - --className:SetPoint("topleft", roleIcon, "bottomleft", 0, -2) - --rankText:SetPoint("right", line, "right", -2, 0) totalStatusBar:SetPoint("bottomleft", specIcon, "bottomright", 0, 0) line.specIcon = specIcon @@ -388,12 +396,14 @@ function breakdownWindowPlayerList.CreatePlayerListFrame() playerScroll.ScrollBar:ClearAllPoints() playerScroll.ScrollBar:SetPoint("topright", playerScroll, "topright", -2, -37) playerScroll.ScrollBar:SetPoint("bottomright", playerScroll, "bottomright", -2, 17) + breakdownWindowFrame.playerScrollBox = playerScroll playerScroll.ScrollBar:Hide() + --remove the standard backdrop playerScroll:SetBackdrop({}) playerScroll:SetBackdropColor(0, 0, 0, 0) playerScroll:SetBackdropBorderColor(0, 0, 0, 0) - breakdownWindowFrame.playerScrollBox = playerScroll + playerScroll.__background:Hide() --need to be created before breakdownWindowFrame.Header = DetailsFramework:CreateHeader(playerScroll, headerTable, headerOptions) @@ -500,10 +510,10 @@ function breakdownWindowPlayerList.CreatePlayerListFrame() end end) - local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background") - local gradientBelow = DetailsFramework:CreateTexture(breakdownWindowFrame.playerScrollBox, - {gradient = "vertical", fromColor = gradientStartColor, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1}) - gradientBelow:SetPoint("bottoms", 1, 1) + --local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background") + --local gradientBelow = DetailsFramework:CreateTexture(breakdownWindowFrame.playerScrollBox, + --{gradient = "vertical", fromColor = gradientStartColor, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1}) + --gradientBelow:SetPoint("bottoms", 1, 1) end function Details.PlayerBreakdown.CreatePlayerListFrame() diff --git a/frames/window_breakdown/window_playerbreakdown_spells.lua b/frames/window_breakdown/window_playerbreakdown_spells.lua index 1f09ffd1..7946d85a 100644 --- a/frames/window_breakdown/window_playerbreakdown_spells.lua +++ b/frames/window_breakdown/window_playerbreakdown_spells.lua @@ -547,13 +547,22 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame) --~init --spellsTab.CreateReportButtons(tabFrame) --create a button in the breakdown window to open the options for this tab - local optionsButton = DF:CreateButton(tabFrame, Details.OpenSpellBreakdownOptions, 130, 20, "options", 14, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) - optionsButton:SetPoint("bottomright", tabFrame, "bottomright", -5, 5) - optionsButton.textsize = 16 - optionsButton.textcolor = "yellow" + local optionsButton = DF:CreateButton(tabFrame, Details.OpenSpellBreakdownOptions, 130, 18, "options", 14) + --optionsButton:SetTemplate(DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) + optionsButton:SetPoint("bottomright", tabFrame, "bottomright", -10, -19) + optionsButton.textsize = 12 + optionsButton.textcolor = "orange" + + ---@type df_roundedpanel_preset + local preset = { + roundness = 5, + color = {.2, .2, .2, 0.98}, + border_color = {.1, .1, .1, 0.834}, + } + DF:AddRoundedCornersToFrame(optionsButton, preset) --open the breakdown window at startup for testing - --[=[ debug + --[= debug C_Timer.After(1, function() Details:OpenPlayerDetails(1) C_Timer.After(1, function() diff --git a/frames/window_main.lua b/frames/window_main.lua index e4557b0b..4ed8a7ee 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -148,7 +148,7 @@ function Details:RefreshScrollBar(x) --x = amount of bars being refreshed if (self.update) then self.update = false self.v_barras = true - return Details:EsconderBarrasNaoUsadas(self) + return Details:HideBarsNotInUse(self) end end diff --git a/frames/window_options2_sections.lua b/frames/window_options2_sections.lua index 770c80c2..08bb8bf3 100644 --- a/frames/window_options2_sections.lua +++ b/frames/window_options2_sections.lua @@ -200,11 +200,12 @@ do Details:RefreshMainWindow(-1, true) afterUpdate() end + local timetypeOptions = { --localize-me {value = 1, label = "Activity Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\Achievement_Quests_Completed_Daily_08", iconcolor = {1, .9, .9}, texcoord = {0.078125, 0.921875, 0.078125, 0.921875}}, {value = 2, label = "Effective Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\Achievement_Quests_Completed_08"}, - {value = 3, label = "Real Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\Ability_Evoker_TipTheScales"}, + --{value = 3, label = "Real Time", onclick = onSelectTimeType, icon = "Interface\\Icons\\Ability_Evoker_TipTheScales"}, } local buildTimeTypeMenu = function() return timetypeOptions @@ -304,6 +305,39 @@ do desc = Loc ["STRING_OPTIONS_TIMEMEASURE_DESC"], }, + {--use real time + type = "toggle", + get = function() return Details.use_realtimedps end, + set = function(self, fixedparam, value) + Details.use_realtimedps = value + end, + name = "Show 'Real Time' DPS", + desc = "If Enabled and while in combat, show the damage done of the latest 5 seconds divided by 5.", + boxfirst = true, + }, + + {--real time dps order bars + type = "toggle", + get = function() return Details.realtimedps_order_bars end, + set = function(self, fixedparam, value) + Details.realtimedps_order_bars = value + end, + name = "Order Bars By Real Time DPS", + desc = "If Enabled, players dealing more real time DPS are place above other players in the window.", + boxfirst = true, + }, + + {--always use real time in arenas + type = "toggle", + get = function() return Details.realtimedps_always_arena end, + set = function(self, fixedparam, value) + Details.realtimedps_always_arena = value + end, + name = "Always Use Real Time in Arenas", + desc = "If Enabled, real time DPS is always used in arenas, even if the option above is disabled.", + boxfirst = true, + }, + {type = "blank"}, {type = "label", get = function() return "Segments:" end, text_template = subSectionTitleTextTemplate}, diff --git a/functions/currentdps.lua b/functions/currentdps.lua index f0a4b370..bfad0256 100644 --- a/functions/currentdps.lua +++ b/functions/currentdps.lua @@ -16,7 +16,7 @@ local currentCombatObject = nil ---@field cache number[] ---@type table -local currentDPSCache = {} +local currentDPSCache = Details222.CurrentDPS.Cache ---create a new cache table ---@return details_currentdps_actorcache @@ -60,6 +60,12 @@ local cacheSize = secondsOfData / delayTimeBetweenUpdates --the index of the cache that will be removed when the cache is full local cacheOverflowIndex = cacheSize + 1 +---return how many seconds of data is being used to calculate the current dps +---@return number +function Details222.CurrentDPS.GetTimeSample() + return secondsOfData +end + ---on tick function ---@param self frame ---@param deltaTime number time elapsed between frames @@ -75,7 +81,7 @@ currentDpsFrame.OnUpdateFunc = function(self, deltaTime) for index, actorObject in damageContainer:ListActors() do ---@cast actorObject actor - if (actorObject:IsPlayer()) then + if (actorObject.grupo) then ---@type details_currentdps_actorcache local dpsCache = getActorDpsCache(actorObject.serial) @@ -103,7 +109,10 @@ currentDpsFrame.OnUpdateFunc = function(self, deltaTime) currentDelay = 0 end ---serial = guid +---return the value of the current dps for the given player +---serial = guid +---@param serial guid +---@return number|nil function Details.CurrentDps.GetCurrentDps(serial) local dpsCache = currentDPSCache[serial] if (dpsCache) then @@ -112,6 +121,19 @@ function Details.CurrentDps.GetCurrentDps(serial) end end +---return if the window bars can be sorted by real time dps +---@return boolean +function Details.CurrentDps.CanSortByRealTimeDps() + if (not Details.in_combat) then + return false + end + + local bOrderDpsByRealTime = Details.use_realtimedps and Details.realtimedps_order_bars + if (not bOrderDpsByRealTime) then + bOrderDpsByRealTime = Details.realtimedps_always_arena and Details.zone_type == "arena" + end + return bOrderDpsByRealTime +end --start the proccess of updating the current dps and hps for each player function Details.CurrentDps.StartCurrentDpsTracker() @@ -130,9 +152,9 @@ local eventListener = Details:CreateEventListener() eventListener:RegisterEvent("COMBAT_PLAYER_ENTER", function() --check if can start the real time dps tracker - local bCanStartRealTimeDpsTracker = Details.combat_log.evoker_show_realtimedps and Details.playerspecid == 1473 + local bCanStartRealTimeDpsTracker = Details.use_realtimedps or (Details.combat_log.evoker_show_realtimedps and Details.playerspecid == 1473) if (not bCanStartRealTimeDpsTracker) then - bCanStartRealTimeDpsTracker = Details.time_type == 3 + bCanStartRealTimeDpsTracker = Details.zone_type == "arena" and Details.realtimedps_always_arena end if (bCanStartRealTimeDpsTracker) then diff --git a/functions/profiles.lua b/functions/profiles.lua index 2954429c..28034fb9 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -937,6 +937,11 @@ local default_profile = { update_speed = 0.20, time_type = 2, time_type_original = 2, + + use_realtimedps = false, + realtimedps_order_bars = false, + realtimedps_always_arena = false, + memory_threshold = 3, memory_ram = 64, remove_realm_from_name = true, diff --git a/plugins/Details_Compare2/Details_Compare2.lua b/plugins/Details_Compare2/Details_Compare2.lua index 2bb87c1f..ed40dc8a 100644 --- a/plugins/Details_Compare2/Details_Compare2.lua +++ b/plugins/Details_Compare2/Details_Compare2.lua @@ -127,7 +127,7 @@ do tooltip = CreateFrame ("frame", nil, UIParent, "BackdropTemplate") tooltip:SetFrameStrata ("tooltip") tooltip:SetSize (1, 1) - Details.gump:CreateBorder (tooltip) + _detalhes.gump:CreateBorder (tooltip) tooltip:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) tooltip:SetBackdropColor (.2, .2, .2, .99) tooltip:SetBackdropBorderColor (unpack (comparisonFrameSettings.tooltipBorderColor)) @@ -218,7 +218,7 @@ do tooltip = CreateFrame ("frame", nil, UIParent, "BackdropTemplate") tooltip:SetFrameStrata ("tooltip") tooltip:SetSize (1, 1) - Details.gump:CreateBorder (tooltip) + _detalhes.gump:CreateBorder (tooltip) tooltip:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) tooltip:SetBackdropColor (0, 0, 0, 1) tooltip:SetBackdropBorderColor (unpack (comparisonFrameSettings.tooltipBorderColor)) diff --git a/plugins/Details_DataStorage/Details_DataStorage.lua b/plugins/Details_DataStorage/Details_DataStorage.lua index 5373538f..a073b99f 100644 --- a/plugins/Details_DataStorage/Details_DataStorage.lua +++ b/plugins/Details_DataStorage/Details_DataStorage.lua @@ -1,7 +1,7 @@ DETAILS_STORAGE_VERSION = 5 -function Details:CreateStorageDB() +function _detalhes:CreateStorageDB() DetailsDataStorage = { VERSION = DETAILS_STORAGE_VERSION, [14] = {}, --normal mode (raid) @@ -19,18 +19,18 @@ f:RegisterEvent ("ADDON_LOADED") f:SetScript ("OnEvent", function (self, event, addonName) if (addonName == "Details_DataStorage") then - DetailsDataStorage = DetailsDataStorage or Details:CreateStorageDB() + DetailsDataStorage = DetailsDataStorage or _detalhes:CreateStorageDB() DetailsDataStorage.Data = {} if (DetailsDataStorage.VERSION < DETAILS_STORAGE_VERSION) then --> do revisions if (DetailsDataStorage.VERSION < 5) then table.wipe (DetailsDataStorage) - DetailsDataStorage = Details:CreateStorageDB() + DetailsDataStorage = _detalhes:CreateStorageDB() end end - if (Details and Details.debug) then + if (_detalhes and _detalhes.debug) then print ("|cFFFFFF00Details! Storage|r: loaded!") end DETAILS_STORAGE_LOADED = true diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua index 7aa3ada3..52cf4d19 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua @@ -259,9 +259,12 @@ local function CreatePluginFrames(data) return encounterDetails:CloseWindow() end + DetailsPluginContainerWindow.OpenPlugin(encounterDetails) + --build all window data encounterDetails.db.opened = encounterDetails.db.opened + 1 encounterDetails:OpenAndRefresh() + --show edFrame:Show() encounterDetails.open = true @@ -282,14 +285,13 @@ local function CreatePluginFrames(data) end end - DetailsPluginContainerWindow.OpenPlugin(encounterDetails) - return true end function encounterDetails:CloseWindow() encounterDetails.open = false edFrame:Hide() + Details:CloseBreakdownWindow() return true end diff --git a/plugins/Details_EncounterDetails/Libs/AceLocale-3.0/AceLocale-3.0.lua b/plugins/Details_EncounterDetails/Libs/AceLocale-3.0/AceLocale-3.0.lua deleted file mode 100644 index 2ecc0cb8..00000000 --- a/plugins/Details_EncounterDetails/Libs/AceLocale-3.0/AceLocale-3.0.lua +++ /dev/null @@ -1,137 +0,0 @@ ---- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings. --- @class file --- @name AceLocale-3.0 --- @release $Id: AceLocale-3.0.lua 1035 2011-07-09 03:20:13Z kaelten $ -local MAJOR,MINOR = "AceLocale-3.0", 6 - -local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR) - -if not AceLocale then return end -- no upgrade needed - --- Lua APIs -local assert, tostring, error = assert, tostring, error -local getmetatable, setmetatable, rawset, rawget = getmetatable, setmetatable, rawset, rawget - --- Global vars/functions that we don't upvalue since they might get hooked, or upgraded --- List them here for Mikk's FindGlobals script --- GLOBALS: GAME_LOCALE, geterrorhandler - -local gameLocale = GetLocale() -if gameLocale == "enGB" then - gameLocale = "enUS" -end - -AceLocale.apps = AceLocale.apps or {} -- array of ["AppName"]=localetableref -AceLocale.appnames = AceLocale.appnames or {} -- array of [localetableref]="AppName" - --- This metatable is used on all tables returned from GetLocale -local readmeta = { - __index = function(self, key) -- requesting totally unknown entries: fire off a nonbreaking error and return key - rawset(self, key, key) -- only need to see the warning once, really - geterrorhandler()(MAJOR..": "..tostring(AceLocale.appnames[self])..": Missing entry for '"..tostring(key).."'") - return key - end -} - --- This metatable is used on all tables returned from GetLocale if the silent flag is true, it does not issue a warning on unknown keys -local readmetasilent = { - __index = function(self, key) -- requesting totally unknown entries: return key - rawset(self, key, key) -- only need to invoke this function once - return key - end -} - --- Remember the locale table being registered right now (it gets set by :NewLocale()) --- NOTE: Do never try to register 2 locale tables at once and mix their definition. -local registering - --- local assert false function -local assertfalse = function() assert(false) end - --- This metatable proxy is used when registering nondefault locales -local writeproxy = setmetatable({}, { - __newindex = function(self, key, value) - rawset(registering, key, value == true and key or value) -- assigning values: replace 'true' with key string - end, - __index = assertfalse -}) - --- This metatable proxy is used when registering the default locale. --- It refuses to overwrite existing values --- Reason 1: Allows loading locales in any order --- Reason 2: If 2 modules have the same string, but only the first one to be --- loaded has a translation for the current locale, the translation --- doesn't get overwritten. --- -local writedefaultproxy = setmetatable({}, { - __newindex = function(self, key, value) - if not rawget(registering, key) then - rawset(registering, key, value == true and key or value) - end - end, - __index = assertfalse -}) - ---- Register a new locale (or extend an existing one) for the specified application. --- :NewLocale will return a table you can fill your locale into, or nil if the locale isn't needed for the players --- game locale. --- @paramsig application, locale[, isDefault[, silent]] --- @param application Unique name of addon / module --- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc. --- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS) --- @param silent If true, the locale will not issue warnings for missing keys. Must be set on the first locale registered. If set to "raw", nils will be returned for unknown keys (no metatable used). --- @usage --- -- enUS.lua --- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true) --- L["string1"] = true --- --- -- deDE.lua --- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "deDE") --- if not L then return end --- L["string1"] = "Zeichenkette1" --- @return Locale Table to add localizations to, or nil if the current locale is not required. -function AceLocale:NewLocale(application, locale, isDefault, silent) - - -- GAME_LOCALE allows translators to test translations of addons without having that wow client installed - local gameLocale = GAME_LOCALE or gameLocale - - local app = AceLocale.apps[application] - - if silent and app and getmetatable(app) ~= readmetasilent then - geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered") - end - - if not app then - if silent=="raw" then - app = {} - else - app = setmetatable({}, silent and readmetasilent or readmeta) - end - AceLocale.apps[application] = app - AceLocale.appnames[app] = application - end - - if locale ~= gameLocale and not isDefault then - return -- nop, we don't need these translations - end - - registering = app -- remember globally for writeproxy and writedefaultproxy - - if isDefault then - return writedefaultproxy - end - - return writeproxy -end - ---- Returns localizations for the current locale (or default locale if translations are missing). --- Errors if nothing is registered (spank developer, not just a missing translation) --- @param application Unique name of addon / module --- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional) --- @return The locale table for the current language. -function AceLocale:GetLocale(application, silent) - if not silent and not AceLocale.apps[application] then - error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2) - end - return AceLocale.apps[application] -end diff --git a/plugins/Details_EncounterDetails/Libs/AceLocale-3.0/AceLocale-3.0.xml b/plugins/Details_EncounterDetails/Libs/AceLocale-3.0/AceLocale-3.0.xml deleted file mode 100644 index a4cf340c..00000000 --- a/plugins/Details_EncounterDetails/Libs/AceLocale-3.0/AceLocale-3.0.xml +++ /dev/null @@ -1,4 +0,0 @@ - -