General development and bug fixes (see commit description).

- Fixed the deaths display, where the windows wasn't usig custom text scripts.
- Fixed an issue with custom displays, where it was unable to use class colors in their texts.
- More development and bug fixes on the new Mythic+ Run Completion panel.
- Framework Update.
This commit is contained in:
Tercio Jose
2024-02-13 13:24:28 -03:00
parent 18e7464cef
commit 2fd02eebb1
19 changed files with 5685 additions and 1758 deletions
+49 -12
View File
@@ -481,12 +481,16 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
---enable the button making it clickable and not grayed out ---enable the button making it clickable and not grayed out
---@return unknown ---@return unknown
function ButtonMetaFunctions:Enable() function ButtonMetaFunctions:Enable()
return self.button:Enable() return self.button:Enable()
end end
---disable the button making it unclickable and grayed out ---disable the button making it unclickable and grayed out
---@return unknown ---@return unknown
function ButtonMetaFunctions:Disable() function ButtonMetaFunctions:Disable()
if (self.color_texture) then
self.color_texture:SetVertexColor(0.14, 0.14, 0.14)
end
return self.button:Disable() return self.button:Disable()
end end
@@ -733,7 +737,7 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
---receives a table where the keys are settings and the values are the values to set ---receives a table where the keys are settings and the values are the values to set
---this is the list of keys the table support: ---this is the list of keys the table support:
---width, height, icon|table, textcolor, textsize, textfont, textalign, backdrop, backdropcolor, backdropbordercolor, onentercolor, onleavecolor, onenterbordercolor, onleavebordercolor ---width, height, icon|table, textcolor, textsize, textfont, textalign, backdrop, backdropcolor, backdropbordercolor, onentercolor, onleavecolor, onenterbordercolor, onleavebordercolor
---@param template table ---@param template table|string
function ButtonMetaFunctions:SetTemplate(template) function ButtonMetaFunctions:SetTemplate(template)
if (type(template) == "string") then if (type(template) == "string") then
template = detailsFramework:GetTemplate("button", template) template = detailsFramework:GetTemplate("button", template)
@@ -808,6 +812,25 @@ function ButtonMetaFunctions:SetTemplate(template)
if (template.textalign) then if (template.textalign) then
self.textalign = template.textalign self.textalign = template.textalign
end end
if (template.rounded_corner) then
self:SetBackdrop(nil)
detailsFramework:AddRoundedCornersToFrame(self.widget or self, template.rounded_corner)
--check if this is a color picker button
if (self.__iscolorpicker) then
self.color_texture:SetTexture([[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]], "CLAMP", "CLAMP", "TRILINEAR")
self.color_texture:SetDrawLayer("overlay", 7)
self.color_texture:SetPoint("topleft", self.widget, "topleft", 2, -2)
self.color_texture:SetPoint("bottomright", self.widget, "bottomright", -2, 2)
self.background_texture:SetDrawLayer("overlay", 6)
self.background_texture:SetPoint("topleft", self.color_texture, "topleft", 2, -2)
self.background_texture:SetPoint("bottomright", self.color_texture, "bottomright", -2, 2)
self.widget.texture_disabled:SetTexture([[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]], "CLAMP", "CLAMP", "TRILINEAR")
end
end
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
@@ -857,7 +880,7 @@ end
---@field textfont string ---@field textfont string
---@field textsize number ---@field textsize number
---@field icon texture created after calling SetIcon() ---@field icon texture created after calling SetIcon()
---@field SetTemplate fun(self: df_button, template: table) set the button visual by a template ---@field SetTemplate fun(self: df_button, template: table|string) set the button visual by a template
---@field RightClick fun(self: df_button) right click the button executing its right click function ---@field RightClick fun(self: df_button) right click the button executing its right click function
---@field Exec fun(self: df_button) execute the button function for the left button ---@field Exec fun(self: df_button) execute the button function for the left button
---@field Disable fun(self: df_button) disable the button ---@field Disable fun(self: df_button) disable the button
@@ -1064,6 +1087,15 @@ end
return self.color_texture:GetVertexColor() return self.color_texture:GetVertexColor()
end end
---@class df_colorpickbutton : df_button
---@field color_callback function
---@field Cancel function
---@field SetColor function
---@field GetColor function
---@field __iscolorpicker boolean
---@field color_texture texture
---@field background_texture texture
---create a button which opens a color picker when clicked ---create a button which opens a color picker when clicked
---@param parent table ---@param parent table
---@param name string|nil ---@param name string|nil
@@ -1077,33 +1109,38 @@ end
end end
function detailsFramework:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate) function detailsFramework:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate)
--button local colorPickButton = detailsFramework:NewButton(parent, _, name, member, 16, 16, pickcolor, alpha, "param2")
local colorPickButton = detailsFramework:NewButton(parent, _, name, member, 16, 16, pickcolor, alpha, "param2", nil, nil, nil, buttonTemplate) ---@cast colorPickButton df_colorpickbutton
colorPickButton.color_callback = callback colorPickButton.color_callback = callback
colorPickButton.Cancel = colorpickCancel colorPickButton.Cancel = colorpickCancel
colorPickButton.SetColor = setColorPickColor colorPickButton.SetColor = setColorPickColor
colorPickButton.GetColor = getColorPickColor colorPickButton.GetColor = getColorPickColor
colorPickButton.__iscolorpicker = true
colorPickButton.HookList.OnColorChanged = {} colorPickButton.HookList.OnColorChanged = {}
if (not buttonTemplate) then
colorPickButton:SetTemplate(detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
end
--background showing a grid to indicate the transparency --background showing a grid to indicate the transparency
local background = colorPickButton:CreateTexture(nil, "background", nil, 2) local background = colorPickButton:CreateTexture("$parentBackgroupTransparency", "background", nil, 2)
background:SetPoint("topleft", colorPickButton.widget, "topleft", 0, 0) background:SetPoint("topleft", colorPickButton.widget, "topleft", 0, 0)
background:SetPoint("bottomright", colorPickButton.widget, "bottomright", 0, 0) background:SetPoint("bottomright", colorPickButton.widget, "bottomright", 0, 0)
background:SetTexture([[Interface\ITEMSOCKETINGFRAME\UI-EMPTYSOCKET]]) background:SetAtlas("AnimCreate_Icon_Texture")
background:SetTexCoord(3/16, 13/16, 3/16, 13/16)
background:SetAlpha(0.3) background:SetAlpha(0.3)
colorPickButton.background_texture = background
--texture which shows the texture color --texture which shows the texture color
local colorTexture = detailsFramework:NewImage(colorPickButton, nil, 16, 16, nil, nil, "color_texture", "$parentTex") local colorTexture = colorPickButton:CreateTexture("$parentTex", "overlay")
colorTexture:SetColorTexture(1, 1, 1) colorTexture:SetColorTexture(1, 1, 1)
colorTexture:SetPoint("topleft", colorPickButton.widget, "topleft", 0, 0) colorTexture:SetPoint("topleft", colorPickButton.widget, "topleft", 0, 0)
colorTexture:SetPoint("bottomright", colorPickButton.widget, "bottomright", 0, 0) colorTexture:SetPoint("bottomright", colorPickButton.widget, "bottomright", 0, 0)
colorTexture:SetDrawLayer("background", 3) colorTexture:SetDrawLayer("background", 3)
colorPickButton.color_texture = colorTexture
if (not buttonTemplate) then
colorPickButton:SetTemplate(detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
else
colorPickButton:SetTemplate(buttonTemplate)
end
return colorPickButton return colorPickButton
end end
+8 -2
View File
@@ -103,7 +103,7 @@
---@field GroupIterator fun(self:table, callback:function, ...) iterate over the group, calling the callback function for each group member ---@field GroupIterator fun(self:table, callback:function, ...) iterate over the group, calling the callback function for each group member
---@field CommaValue fun(self:table, value:number) : string convert a number to a string with commas, e.g. 1000000 -> 1,000,000 ---@field CommaValue fun(self:table, value:number) : string convert a number to a string with commas, e.g. 1000000 -> 1,000,000
---@field SplitTextInLines fun(self:table, text:string) : string[] split a text into lines ---@field SplitTextInLines fun(self:table, text:string) : string[] split a text into lines
---@field UnitGroupRolesAssigned fun(unitId: unit, bUseSupport:boolean, specId: specializationid) : string there's no self here ---@field UnitGroupRolesAssigned fun(unitId: unit, bUseSupport:boolean?, specId: specializationid?) : string there's no self here
---@field SetAnchor fun(self:table, widget:uiobject, anchorTable:df_anchor, anchorTo:uiobject?) only adjust the anchors of a widget, does not save values ---@field SetAnchor fun(self:table, widget:uiobject, anchorTable:df_anchor, anchorTo:uiobject?) only adjust the anchors of a widget, does not save values
---@field AddTextureToText fun(text:string, textureInfo:table, bAddSpace:boolean?, bAddAfterText:boolean) : string textureInfo is a table with .texture .width .height .coords{left, right, top, bottom} ---@field AddTextureToText fun(text:string, textureInfo:table, bAddSpace:boolean?, bAddAfterText:boolean) : string textureInfo is a table with .texture .width .height .coords{left, right, top, bottom}
---@field CreateTextureInfo fun(texture:atlasname|texturepath|textureid, width:number?, height:number?, left:number?, right:number?, top:number?, bottom:number?, imageWidthnumber?, imageHeightnumber?) : table ---@field CreateTextureInfo fun(texture:atlasname|texturepath|textureid, width:number?, height:number?, left:number?, right:number?, top:number?, bottom:number?, imageWidthnumber?, imageHeightnumber?) : table
@@ -112,6 +112,8 @@
---@field CreateDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ---@field CreateDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateFontDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ---@field CreateFontDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateColorDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ---@field CreateColorDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateOutlineDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateAnchorPointDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateFontListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns ---@field CreateFontListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns
---@field CreateTextEntry fun(self:table, parent:frame, textChangedCallback:function, width:number, height:number, member:string?, name:string?, labelText:string?, textentryTemplate:table?, labelTemplate:table?) : df_textentry ---@field CreateTextEntry fun(self:table, parent:frame, textChangedCallback:function, width:number, height:number, member:string?, name:string?, labelText:string?, textentryTemplate:table?, labelTemplate:table?) : df_textentry
---@field ReskinSlider fun(self:table, slider:frame) ---@field ReskinSlider fun(self:table, slider:frame)
@@ -146,5 +148,9 @@
---@field CreateEditor fun(self:table, parent:frame, name:string?, options:df_editor_defaultoptions?) : df_editor ---@field CreateEditor fun(self:table, parent:frame, name:string?, options:df_editor_defaultoptions?) : df_editor
---@field RandomBool fun(self:table, odds: number?) : boolean return a random boolean ---@field RandomBool fun(self:table, odds: number?) : boolean return a random boolean
---@field CreateHighlightTexture fun(self:table, parent:frame, parentKey:string?, alpha:number?, name:string?) : texture ---@field CreateHighlightTexture fun(self:table, parent:frame, parentKey:string?, alpha:number?, name:string?) : texture
---@field CreateIconRowGeneric fun(self:table, parent:frame, name:string?, options:table?)
---@field CreateColorPickButton fun(self:table, parent:frame, name:string?, member:string?, callback:function, alpha:number?, buttonTemplate:table?) : df_button
---@field CreateSlider fun(self:table, parent:frame, width:number?, height:number?, minValue:number?, maxValue:number?, step:number?, defaultv:number?, isDecemal:boolean?, member:string?, name:string?, label:string?, sliderTemplate:string|table?, labelTemplate:string|table?) : df_slider, df_label?
---@field
---@field
---@field ---@field
+32 -11
View File
@@ -303,7 +303,7 @@ function DropDownMetaFunctions:GetFrameForOption(optionsTable, value) --not test
end end
function DropDownMetaFunctions:Refresh() function DropDownMetaFunctions:Refresh()
local optionsTable = DF:Dispatch(self.func, self) local state, optionsTable = xpcall(self.func, geterrorhandler(), self)
if (#optionsTable == 0) then if (#optionsTable == 0) then
self:NoOption(true) self:NoOption(true)
@@ -558,9 +558,11 @@ function DropDownMetaFunctions:Selected(thisOption)
self.statusbar:SetTexture(thisOption.statusbar) self.statusbar:SetTexture(thisOption.statusbar)
if (thisOption.statusbarcolor) then if (thisOption.statusbarcolor) then
self.statusbar:SetVertexColor(unpack(thisOption.statusbarcolor)) self.statusbar:SetVertexColor(unpack(thisOption.statusbarcolor))
else
self.statusbar:SetVertexColor(1, 1, 1, 1)
end end
else else
self.statusbar:SetTexture([[Interface\Tooltips\CHATBUBBLE-BACKGROUND]]) self.statusbar:SetVertexColor(0, 0, 0, 0)
end end
if (self.widget.__rcorners) then if (self.widget.__rcorners) then
@@ -774,9 +776,11 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
thisOptionFrame.statusbar:SetTexture(thisOption.statusbar) thisOptionFrame.statusbar:SetTexture(thisOption.statusbar)
if (thisOption.statusbarcolor) then if (thisOption.statusbarcolor) then
thisOptionFrame.statusbar:SetVertexColor(unpack(thisOption.statusbarcolor)) thisOptionFrame.statusbar:SetVertexColor(unpack(thisOption.statusbarcolor))
else
thisOptionFrame.statusbar:SetVertexColor(1, 1, 1, 1)
end end
else else
thisOptionFrame.statusbar:SetTexture([[Interface\Tooltips\CHATBUBBLE-BACKGROUND]]) thisOptionFrame.statusbar:SetVertexColor(0, 0, 0, 0)
end end
--an extra button in the right side of the row --an extra button in the right side of the row
@@ -824,7 +828,7 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
end end
selectedTexture:Show() selectedTexture:Show()
selectedTexture:SetVertexColor(1, 1, 1, .3) selectedTexture:SetVertexColor(1, 1, 0, .5)
selectedTexture:SetTexCoord(0, 29/32, 5/32, 27/32) selectedTexture:SetTexCoord(0, 29/32, 5/32, 27/32)
currentIndex = tindex currentIndex = tindex
@@ -1009,13 +1013,21 @@ end
--template --template
function DropDownMetaFunctions:SetTemplate(template) function DropDownMetaFunctions:SetTemplate(template)
if (type(template) == "string") then
local templateName = template
template = DF:GetTemplate("dropdown", templateName)
if (not template) then
print("no template found", templateName)
end
end
self.template = template self.template = template
if (template.width) then if (template.width) then
PixelUtil.SetWidth(self.dropdown, template.width) PixelUtil.SetWidth(self.dropdown, template.width)
end end
if (template.height) then if (template.height) then
PixelUtil.SetWidth(self.dropdown, template.height) PixelUtil.SetHeight(self.dropdown, template.height)
end end
if (template.backdrop) then if (template.backdrop) then
@@ -1090,13 +1102,19 @@ end
--object constructor --object constructor
---@class df_dropdown : table, frame ---@class df_dropdown : table, frame
---@field SetTemplate fun(self:df_dropdown, template:table) ---@field SetTemplate fun(self:df_dropdown, template:table|string)
---@field BuildDropDownFontList fun(self:df_dropdown, onClick:function, icon:any, iconTexcoord:table?, iconSize:table?):table make a dropdown list with all fonts available, on select a font, call the function onClick ---@field BuildDropDownFontList fun(self:df_dropdown, onClick:function, icon:any, iconTexcoord:table?, iconSize:table?):table make a dropdown list with all fonts available, on select a font, call the function onClick
---@field ---@field SetFunction fun(self:df_dropdown, func:function)
---@field ---@field SetEmptyTextAndIcon fun(self:df_dropdown, text:string, icon:any)
---@field ---@field Select fun(self:df_dropdown, optionName:string|number, byOptionNumber:boolean?, bOnlyShown:boolean?, runCallback:boolean?):boolean
---@field ---@field Open fun(self:df_dropdown)
---@field ---@field Close fun(self:df_dropdown)
---@field Refresh fun(self:df_dropdown)
---@field GetFunction fun(self:df_dropdown):function
---@field GetMenuSize fun(self:df_dropdown):number, number
---@field SetMenuSize fun(self:df_dropdown, width:number, height:number)
---@field Disable fun(self:df_dropdown)
---@field Enable fun(self:df_dropdown)
---return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns ---return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns
---@param callback function ---@param callback function
@@ -1259,6 +1277,9 @@ function DF:NewDropDown(parent, container, name, member, width, height, func, de
default = 1 default = 1
end end
width = width or 160
height = height or 20
dropDownObject.dropdown = DF:CreateNewDropdownFrame(parent, name) dropDownObject.dropdown = DF:CreateNewDropdownFrame(parent, name)
PixelUtil.SetSize(dropDownObject.dropdown, width, height) PixelUtil.SetSize(dropDownObject.dropdown, width, height)
+50 -18
View File
@@ -1,6 +1,6 @@
local dversion = 510 local dversion = 511
local major, minor = "DetailsFramework-1.0", dversion local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor) local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -2522,6 +2522,28 @@ DF.dropdown_templates["OPTIONS_DROPDOWNDARK_TEMPLATE"] = {
dropiconpoints = {-2, -3}, dropiconpoints = {-2, -3},
} }
DF.dropdown_templates["OLD_DROPDOWN_TEMPLATE"] = {
height = 24,
backdrop = {
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
edgeSize = 8,
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
tileSize = 64,
tile = true,
insets = {left = 4, right = 4, top = 4, bottom = 4}
},
backdropcolor = {0.1215, 0.1176, 0.1294, 0.4000},
backdropbordercolor = {1, 1, 1, 1},
onentercolor = {.5, .5, .5, .9},
onenterbordercolor = {1, 1, 1, 1},
dropicon = "Interface\\BUTTONS\\arrow-Down-Down",
dropiconsize = {16, 16},
dropiconpoints = {-2, -3},
}
--switches --switches
DF.switch_templates = DF.switch_templates or {} DF.switch_templates = DF.switch_templates or {}
DF.switch_templates["OPTIONS_CHECKBOX_TEMPLATE"] = { DF.switch_templates["OPTIONS_CHECKBOX_TEMPLATE"] = {
@@ -2534,6 +2556,23 @@ DF.switch_templates["OPTIONS_CHECKBOX_TEMPLATE"] = {
disabled_backdropcolor = {1, 1, 1, .2}, disabled_backdropcolor = {1, 1, 1, .2},
onenterbordercolor = {1, 1, 1, 1}, onenterbordercolor = {1, 1, 1, 1},
} }
DF.switch_templates["OPTIONS_CIRCLECHECKBOX_TEMPLATE"] = {
width = 18,
height = 18,
is_checkbox = true, --will call SetAsCheckBox()
checked_texture = [[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]],
checked_size_percent = 0.7,
checked_xoffset = 0,
checked_yoffset = 0,
checked_color = "dark3",
rounded_corner = {
color = {.075, .075, .075, 1},
border_color = {.2, .2, .2, 1},
roundness = 8,
},
}
DF.switch_templates["OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"] = { DF.switch_templates["OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"] = {
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdropcolor = {1, 1, 1, .5}, backdropcolor = {1, 1, 1, .5},
@@ -2553,6 +2592,14 @@ DF.button_templates["OPTIONS_BUTTON_TEMPLATE"] = {
backdropbordercolor = {0, 0, 0, 1}, backdropbordercolor = {0, 0, 0, 1},
} }
DF.button_templates["OPTIONS_CIRCLEBUTTON_TEMPLATE"] = {
rounded_corner = {
color = {.075, .075, .075, 1},
border_color = {.2, .2, .2, 1},
roundness = 8,
},
}
DF.button_templates["OPTIONS_BUTTON_GOLDENBORDER_TEMPLATE"] = { DF.button_templates["OPTIONS_BUTTON_GOLDENBORDER_TEMPLATE"] = {
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdropcolor = {1, 1, 1, .5}, backdropcolor = {1, 1, 1, .5},
@@ -3905,7 +3952,7 @@ function DF:GetClassSpecIds(engClass) --naming conventions
end end
local dispatch_error = function(context, errortext) local dispatch_error = function(context, errortext)
DF:Msg( (context or "<no context>") .. " |cFFFF9900error|r: " .. (errortext or "<no error given>")) error((context or "") .. (errortext or ""))
end end
--call a function with payload, if the callback doesn't exists, quit silently --call a function with payload, if the callback doesn't exists, quit silently
@@ -3930,23 +3977,8 @@ end
---@param ... any ---@param ... any
---@return any ---@return any
function DF:Dispatch(func, ...) function DF:Dispatch(func, ...)
if (type(func) ~= "function") then assert(type(func) == "function", "DetailsFramework:Dispatch(func) expect a function as parameter 1. Received: " .. type(func) .. " instead.")
return dispatch_error(_, "DetailsFramework:Dispatch(func) expect a function as parameter 1.")
end
return select(2, xpcall(func, geterrorhandler(), ...)) return select(2, xpcall(func, geterrorhandler(), ...))
--[=[
local dispatchResult = {xpcall(func, geterrorhandler(), ...)}
local okay = dispatchResult[1]
if (not okay) then
return false
end
tremove(dispatchResult, 1)
return unpack(dispatchResult)
--]=]
end end
--[=[ --[=[
+359 -142
View File
@@ -14,14 +14,94 @@ end
---@field options table ---@field options table
---@field NextIcon number ---@field NextIcon number
---@field IconPool table<number, df_icongeneric> table which store the icons created for this iconrow ---@field IconPool table<number, df_icongeneric> table which store the icons created for this iconrow
---@field SetAuraWithIconTemplate fun(self:df_icongeneric, aI:aurainfo, iconTemplateTable:table)
---@field ClearIcons fun(self:df_icongeneric, resetBuffs:boolean?, resetDebuffs:boolean?) ---@class df_iconrow_generic_options : table
---@field AlignAuraIcons fun(self:df_icongeneric) ---@field icon_width number? @The width of the icon.
---@field icon_height number? @The height of the icon.
---@field texcoord table? @The texture coordinates of the icon.
---@field show_text boolean? @Whether to show text on the icon.
---@field text_color table? @The color of the text.
---@field text_size number? @The size of the text.
---@field text_font string? @The font of the text.
---@field text_outline string? @The outline style of the text.
---@field text_anchor df_anchor? @The anchor point of the text.
---@field text_alpha_by_percent boolean? @Whether to change the alpha of the text by the percentage of the cooldown.
---@field desc_text boolean? @Whether to show description text.
---@field desc_text_color table? @The color of the description text.
---@field desc_text_size number? @The size of the description text.
---@field desc_text_font string? @The font of the description text.
---@field desc_text_outline string? @The outline style of the description text.
---@field desc_text_anchor string? @The anchor point of the description text.
---@field desc_text_rel_anchor string? @The relative anchor point of the description text.
---@field desc_text_x_offset number? @The x offset of the description text.
---@field desc_text_y_offset number? @The y offset of the description text.
---@field stack_text boolean? @Whether to show stack text.
---@field stack_text_color table? @The color of the stack text.
---@field stack_text_size number? @The size of the stack text.
---@field stack_text_font string? @The font of the stack text.
---@field stack_text_outline string? @The outline style of the stack text.
---@field stack_text_anchor string? @The anchor point of the stack text.
---@field stack_text_rel_anchor string? @The relative anchor point of the stack text.
---@field stack_text_x_offset number? @The x offset of the stack text.
---@field stack_text_y_offset number? @The y offset of the stack text.
---@field left_padding number? @The distance between the right and left sides.
---@field top_padding number? @The distance between the top and bottom sides.
---@field icon_padding number? @The distance between each icon.
---@field backdrop table? @The backdrop options.
---@field backdrop_color table? @The color of the backdrop.
---@field backdrop_border_color table? @The color of the backdrop border.
---@field anchor table? @The anchor options.
---@field grow_direction number? @The direction in which the icons grow.
---@field center_alignment boolean? @Whether to align the icons in the center.
---@field surpress_blizzard_cd_timer boolean? @Whether to suppress the Blizzard cooldown timer.
---@field surpress_tulla_omni_cc boolean? @Whether to suppress the Tulla OmniCC cooldown count.
---@field on_tick_cooldown_update boolean? @Whether to update cooldowns on every tick.
---@field cooldown_max_brightness number? @The maximum brightness of the cooldown, it is adjusted by the percent.
---@field decimal_timer boolean? @Whether to display the timer in decimal format.
---@field show_cooldown boolean? @Whether to show blizzard cooldown animation.
---@field cooldown_reverse boolean? @Whether to reverse the cooldown animation.
---@field cooldown_swipe_enabled boolean? @Whether to enable the cooldown swipe animation.
---@field cooldown_edge_texture string? @The texture for the cooldown edge.
---@field show_horizontal_swipe boolean? @Whether to show the horizontal swipe animation.
---@field swipe_alpha number? @The alpha value for the swipe animation.
---@field swipe_brightness number? @The brightness value for the swipe animation.
---@field swipe_progressive_color boolean? @Whether to use progressive color for the swipe animation. Start on Green and goes to Red, follows percent amount.
---@field swipe_color table? @When the color isn't progressive, this is the color of the swipe
---@field swipe_color_start number[]? @Whether to use yellow color for the swipe animation.
---@field swipe_color_end number[]? @Whether to use red color for the swipe animation.
---@field remove_on_finish boolean? @Whether to remove the icon when the cooldown finishes. Only usable if the icon has a identifier (from setting specific).
---@field first_icon_use_anchor boolean? @The anchor point for the first ico will use the anchor set in options.anchor.
---@class df_iconrow_generic : df_iconrow
---@field SetCooldown fun(self:df_iconrow_generic, iconFrame:df_icongeneric)
---@field OnIconTick fun(iconFrame:df_icongeneric)
---@field FormatCooldownTime fun(thisTime:number)
---@field FormatCooldownTimeDecimal fun(formattedTime:number)
---@field GetIconGrowDirection fun(self:df_iconrow_generic):number
---@field OnOptionChanged fun(self:df_iconrow_generic, optionName:string)
---@field CreateIcon fun(self:df_iconrow_generic, iconName:string)
---@field GetIcon fun(self:df_iconrow_generic)
---@field SetStacks fun(self:df_iconrow_generic, iconFrame:df_icongeneric, bIsShown:boolean, stacksAmount:number?)
---@field AddSpecificIcon fun(self:df_iconrow_generic, identifierKey:any, spellId:number, borderColor:table, startTime:number, duration:number, forceTexture:string, descText:string, count:number, debuffType:string, caster:string, canStealOrPurge:boolean, spellName:string, isBuff:boolean, modRate:number, iconSettings:table)
---@field AddSpecificIconWithTemplate fun(self:df_iconrow_generic, iconTemplateTable:table)
---@field IsIconShown fun(self:df_iconrow_generic, identifierKey:any)
---@field SetIcon fun(self:df_iconrow_generic, spellId:number, borderColor:table, startTime:number, duration:number, iconTexture:string, descText:string, count:number, debuffType:string, caster:string, canStealOrPurge:boolean, spellName:string, isBuff:boolean, modRate:number, iconSettings:table, expirationTime:number?)
---@field RemoveSpecificIcon fun(self:df_iconrow_generic, identifierKey:any)
---@field ClearIcons fun(self:df_iconrow_generic, resetBuffs:boolean?, resetDebuffs:boolean?)
---@field AlignAuraIcons fun(self:df_iconrow_generic)
---@field SetAuraWithIconTemplate fun(self:df_iconrow_generic, auraInfo:aurainfo, iconTemplateTable:table)
---@field IconPool table<number, df_icongeneric>
---@field NextIcon number
---@field AuraCache table<any, boolean>
---@field shownAmount number
---@field options table
---@field SetSpecificAuraWithIconTemplate fun(self:df_iconrow_generic, identifierKey:any, auraInfo:aurainfo, iconTemplateTable:table)
local unpack = unpack local unpack = unpack
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local PixelUtil = PixelUtil local PixelUtil = PixelUtil
local GetTime = GetTime local GetTime = GetTime
local Clamp = detailsFramework.Math.Clamp
local spellIconCache = {} local spellIconCache = {}
local spellNameCache = {} local spellNameCache = {}
@@ -38,9 +118,16 @@ local iconFrameOnHideScript = function(self)
end end
end end
local checkPointCallback = function(iconFrame)
if (iconFrame.timeRemaining < 3) then
end
return true
end
detailsFramework.IconGenericMixin = { detailsFramework.IconGenericMixin = {
---create a new icon frame ---create a new icon frame
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
---@param iconName string the name of the icon frame ---@param iconName string the name of the icon frame
---@return df_icongeneric ---@return df_icongeneric
CreateIcon = function(self, iconName) CreateIcon = function(self, iconName)
@@ -55,9 +142,8 @@ detailsFramework.IconGenericMixin = {
---@type texture ---@type texture
newIcon.CooldownBrightnessTexture = newIcon:CreateTexture(nil, "artwork", nil, 2) newIcon.CooldownBrightnessTexture = newIcon:CreateTexture(nil, "artwork", nil, 2)
newIcon.CooldownBrightnessTexture:SetBlendMode("ADD") newIcon.CooldownBrightnessTexture:SetBlendMode("ADD")
newIcon.CooldownBrightnessTexture:SetAlpha(1) PixelUtil.SetPoint(newIcon.CooldownBrightnessTexture, "topleft", newIcon.Texture, "topleft", 0, 0)
PixelUtil.SetPoint(newIcon.CooldownBrightnessTexture, "topleft", newIcon, "topleft", 0, 0) PixelUtil.SetPoint(newIcon.CooldownBrightnessTexture, "bottomright", newIcon.Texture, "bottomright", 0, 0)
PixelUtil.SetPoint(newIcon.CooldownBrightnessTexture, "bottomright", newIcon, "bottomright", 0, 0)
---@type texture ---@type texture
newIcon.Border = newIcon:CreateTexture(nil, "background") newIcon.Border = newIcon:CreateTexture(nil, "background")
@@ -80,10 +166,10 @@ detailsFramework.IconGenericMixin = {
--create a overlay texture which will indicate the cooldown time --create a overlay texture which will indicate the cooldown time
newIcon.CooldownTexture = newIcon:CreateTexture(self:GetName() .. "CooldownTexture", "overlay", nil, 6) newIcon.CooldownTexture = newIcon:CreateTexture(self:GetName() .. "CooldownTexture", "overlay", nil, 6)
newIcon.CooldownTexture:SetColorTexture(1, 1, 1, 1) newIcon.CooldownTexture:SetTexture("Interface\\BUTTONS\\GreyscaleRamp64", "CLAMP", "CLAMP", "TRILINEAR")
newIcon.CooldownTexture:SetHeight(2)
newIcon.CooldownTexture:SetPoint("bottomleft", newIcon.Texture, "bottomleft", 0, 0) newIcon.CooldownTexture:SetPoint("bottomleft", newIcon.Texture, "bottomleft", 0, 0)
newIcon.CooldownTexture:SetPoint("bottomright", newIcon.Texture, "bottomright", 0, 0) newIcon.CooldownTexture:SetPoint("bottomright", newIcon.Texture, "bottomright", 0, 0)
newIcon.CooldownTexture:SetHeight(1)
newIcon.CooldownTexture:Hide() newIcon.CooldownTexture:Hide()
newIcon.CooldownEdge = newIcon:CreateTexture(self:GetName() .. "CooldownEdge", "overlay", nil, 7) newIcon.CooldownEdge = newIcon:CreateTexture(self:GetName() .. "CooldownEdge", "overlay", nil, 7)
@@ -95,11 +181,18 @@ detailsFramework.IconGenericMixin = {
newIcon.stacks = 0 newIcon.stacks = 0
newIcon:SetScript("OnHide", iconFrameOnHideScript) newIcon:SetScript("OnHide", iconFrameOnHideScript)
local cooldownFrame = CreateFrame("cooldown", "$parentCooldownFrame", newIcon, "CooldownFrameTemplate, BackdropTemplate")
cooldownFrame:SetAllPoints()
cooldownFrame:EnableMouse(false)
cooldownFrame:SetFrameLevel(newIcon:GetFrameLevel()+1)
cooldownFrame.CountdownText = ({cooldownFrame:GetRegions()})[1]
newIcon.Cooldown = cooldownFrame
return newIcon return newIcon
end, end,
---get an icon frame from the pool ---get an icon frame from the pool
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
---@return df_icongeneric ---@return df_icongeneric
GetIcon = function(self) GetIcon = function(self)
---@type df_icongeneric ---@type df_icongeneric
@@ -152,7 +245,7 @@ detailsFramework.IconGenericMixin = {
end, end,
---adds only if not existing already in the cache ---adds only if not existing already in the cache
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
AddSpecificIcon = function(self, identifierKey, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff, modRate, iconSettings) AddSpecificIcon = function(self, identifierKey, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff, modRate, iconSettings)
if (not identifierKey or identifierKey == "") then if (not identifierKey or identifierKey == "") then
return return
@@ -179,18 +272,32 @@ detailsFramework.IconGenericMixin = {
end end
end, end,
---set an icon frame with a template SetSpecificAuraWithIconTemplate = function(self, identifierKey, auraInfo, iconTemplateTable)
---@param self df_iconrow the parent frame if (not identifierKey or identifierKey == "") then
---@param aI aurainfo return
---@param iconTemplateTable df_icontemplate end
SetAuraWithIconTemplate = function(self, aI, iconTemplateTable)
local startTime = aI.expirationTime - aI.duration if (not self.AuraCache[identifierKey]) then
---@type df_icongeneric ---@type df_icongeneric
self:SetIcon(aI.spellId, nil, startTime, aI.duration, aI.icon, nil, aI.applications, aI.dispelName, aI.sourceUnit, aI.isStealable, aI.name, aI.isHelpful, aI.timeMod, iconTemplateTable, aI.expirationTime) local iconFrame = self:SetAuraWithIconTemplate(auraInfo, iconTemplateTable)
iconFrame.identifierKey = identifierKey
self.AuraCache[identifierKey] = true
end
end, end,
---set an icon frame with a template ---set an icon frame with a template
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
---@param auraInfo aurainfo
---@param iconTemplateTable df_icontemplate
SetAuraWithIconTemplate = function(self, auraInfo, iconTemplateTable)
local startTime = auraInfo.expirationTime - auraInfo.duration
---@type df_icongeneric
return self:SetIcon(auraInfo.spellId, nil, startTime, auraInfo.duration, auraInfo.icon, nil, auraInfo.applications, auraInfo.dispelName, auraInfo.sourceUnit, auraInfo.isStealable, auraInfo.name, auraInfo.isHelpful, auraInfo.timeMod, iconTemplateTable, auraInfo.expirationTime)
end,
---set an icon frame with a template
---@param self df_iconrow_generic the parent frame
---@return df_icongeneric? ---@return df_icongeneric?
SetIcon = function(self, spellId, borderColor, startTime, duration, iconTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff, modRate, iconSettings, expirationTime) SetIcon = function(self, spellId, borderColor, startTime, duration, iconTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff, modRate, iconSettings, expirationTime)
local actualSpellName, spellIcon = spellNameCache[spellId], spellIconCache[spellId] local actualSpellName, spellIcon = spellNameCache[spellId], spellIconCache[spellId]
@@ -213,6 +320,10 @@ detailsFramework.IconGenericMixin = {
end end
end end
if (iconSettings.overrideTexture) then
spellIcon = iconSettings.overrideTexture
end
if (spellIcon) then if (spellIcon) then
spellName = spellName or actualSpellName or "unknown_aura" spellName = spellName or actualSpellName or "unknown_aura"
modRate = modRate or 1 modRate = modRate or 1
@@ -223,8 +334,29 @@ detailsFramework.IconGenericMixin = {
iconFrame.expirationTime = expirationTime iconFrame.expirationTime = expirationTime
local widthFromTexture local width = iconSettings.width or self.options.icon_width
local heightFromTexture local height = iconSettings.height or self.options.icon_height or width
--adjust the width and height by scale
local scale = iconSettings.scale or 1
width = width * scale
height = height * scale
PixelUtil.SetSize(iconFrame, width, height)
--set the texture points to be all points minus one
iconFrame.Texture:ClearAllPoints()
PixelUtil.SetPoint(iconFrame.Texture, "topleft", iconFrame, "topleft", 1, -1)
PixelUtil.SetPoint(iconFrame.Texture, "bottomright", iconFrame, "bottomright", -1, 1)
iconFrame.textureWidth = math.max(iconFrame.Texture:GetWidth(), width)
iconFrame.textureHeight = math.max(iconFrame.Texture:GetHeight(), height) --for some reason, GetHeight() was returning 0 on the first call
--cache size
iconFrame.width = width
iconFrame.height = height
iconFrame:Show()
if (iconFrame.Texture.texture ~= spellIcon or (iconSettings.coords and iconSettings.coords ~= iconFrame.currentCoords)) then if (iconFrame.Texture.texture ~= spellIcon or (iconSettings.coords and iconSettings.coords ~= iconFrame.currentCoords)) then
iconFrame.Texture:SetTexture(spellIcon, "CLAMP", "CLAMP", iconSettings.textureFilter or "LINEAR") --"TRILINEAR" iconFrame.Texture:SetTexture(spellIcon, "CLAMP", "CLAMP", iconSettings.textureFilter or "LINEAR") --"TRILINEAR"
@@ -240,38 +372,13 @@ detailsFramework.IconGenericMixin = {
iconFrame.Texture:SetTexCoord(0, 1, 0, 1) iconFrame.Texture:SetTexCoord(0, 1, 0, 1)
end end
iconFrame.Texture:ClearAllPoints()
if (iconSettings.points) then if (iconSettings.points) then
iconFrame.Texture:ClearAllPoints()
for i = 1, #iconSettings.points do for i = 1, #iconSettings.points do
local point = iconSettings.points[i] local point = iconSettings.points[i]
iconFrame.Texture:SetPoint(point[1], iconFrame, point[2], point[3], point[4]) iconFrame.Texture:SetPoint(point[1], iconFrame, point[2], point[3], point[4])
end end
iconFrame.Texture:SetSize(width, height)
if (iconSettings.width) then
iconFrame.Texture:SetWidth(iconSettings.width)
widthFromTexture = iconSettings.width
else
iconFrame.Texture:SetWidth(self.options.icon_width)
end
if (iconSettings.height or iconSettings.width) then
iconFrame.Texture:SetHeight(iconSettings.height or iconSettings.width)
heightFromTexture = iconSettings.height or iconSettings.width
else
iconFrame.Texture:SetHeight(self.options.icon_height)
end
else
if (iconSettings.width) then
iconFrame.Texture:SetWidth(iconSettings.width)
iconFrame.Texture:SetHeight(iconSettings.height or iconSettings.width)
widthFromTexture = iconSettings.width
heightFromTexture = iconSettings.height or iconSettings.width
PixelUtil.SetPoint(iconFrame.Texture, "center", iconFrame, "center", 0, 0)
else
PixelUtil.SetPoint(iconFrame.Texture, "topleft", iconFrame, "topleft", 1, -1)
PixelUtil.SetPoint(iconFrame.Texture, "bottomright", iconFrame, "bottomright", -1, 1)
end
end end
iconFrame.Texture.texture = spellIcon iconFrame.Texture.texture = spellIcon
@@ -285,6 +392,17 @@ detailsFramework.IconGenericMixin = {
end end
end end
iconFrame:SetIgnoreParentAlpha(false)
if (iconSettings.color) then
local r, g, b, a = detailsFramework:ParseColors(iconSettings.color)
iconFrame.Texture:SetVertexColor(r, g, b, a)
--ignore the param alpha has the settings might have an alpha for it
iconFrame:SetIgnoreParentAlpha(true)
else
iconFrame.Texture:SetVertexColor(1, 1, 1, 1)
end
if (borderColor) then if (borderColor) then
iconFrame.Border:Show() iconFrame.Border:Show()
iconFrame.Border:SetVertexColor(unpack(borderColor)) iconFrame.Border:SetVertexColor(unpack(borderColor))
@@ -306,44 +424,33 @@ detailsFramework.IconGenericMixin = {
iconFrame.stacks = count or 0 iconFrame.stacks = count or 0
if (iconSettings.scale) then
iconFrame.Texture:SetScale(iconSettings.scale)
if (widthFromTexture) then
widthFromTexture = widthFromTexture * iconSettings.scale
end
if (heightFromTexture) then
heightFromTexture = heightFromTexture * iconSettings.scale
end
else
iconFrame.Texture:SetScale(1)
end
if (iconSettings.alpha) then if (iconSettings.alpha) then
iconFrame.Texture:SetAlpha(iconSettings.alpha) iconFrame.Texture:SetAlpha(iconSettings.alpha)
else else
iconFrame.Texture:SetAlpha(1) iconFrame.Texture:SetAlpha(1)
end end
iconFrame:Show()
iconFrame.textureWidth = iconFrame.Texture:GetWidth()
iconFrame.textureHeight = iconFrame.Texture:GetHeight()
PixelUtil.SetSize(iconFrame, iconFrame.textureWidth, iconFrame.textureHeight)
--cache size
iconFrame.width = iconFrame.textureWidth
iconFrame.height = iconFrame.textureHeight
--iconFrame.Texture:SetBlendMode("ADD") --iconFrame.Texture:SetBlendMode("ADD")
iconFrame.CooldownBrightnessTexture:SetTexture(iconFrame.Texture:GetTexture()) iconFrame.CooldownBrightnessTexture:SetTexture(iconFrame.Texture:GetTexture())
do do
local left, top, c, bottom, right = iconFrame.Texture:GetTexCoord() local left, top, c, bottom, right = iconFrame.Texture:GetTexCoord()
iconFrame.CooldownBrightnessTexture:SetTexCoord(left, right, top, bottom) iconFrame.CooldownBrightnessTexture:SetTexCoord(left, right, top, bottom)
iconFrame.CooldownBrightnessTexture.cords = {left, right, top, bottom}
local coords = iconFrame.CooldownBrightnessTexture.cords
if (coords) then
coords[1] = left
coords[2] = right
coords[3] = top
coords[4] = bottom
else
iconFrame.CooldownBrightnessTexture.cords = {left, right, top, bottom}
end
iconFrame.CooldownBrightnessTexture.top = top iconFrame.CooldownBrightnessTexture.top = top
iconFrame.CooldownBrightnessTexture.bottom = bottom iconFrame.CooldownBrightnessTexture.bottom = bottom
end
PixelUtil.SetPoint(iconFrame.CooldownBrightnessTexture, "bottomright", iconFrame, "bottomright", -1, 1) PixelUtil.SetPoint(iconFrame.CooldownBrightnessTexture, "bottomright", iconFrame.Texture, "bottomright", 0, 0)
end
--make information available --make information available
iconFrame.spellId = spellId iconFrame.spellId = spellId
@@ -388,7 +495,7 @@ detailsFramework.IconGenericMixin = {
end end
end, end,
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
---@param iconFrame df_icongeneric ---@param iconFrame df_icongeneric
SetCooldown = function(self, iconFrame) SetCooldown = function(self, iconFrame)
if (iconFrame.cooldownLooper) then if (iconFrame.cooldownLooper) then
@@ -399,69 +506,166 @@ detailsFramework.IconGenericMixin = {
--iconFrame:SetScale(3) --debug --iconFrame:SetScale(3) --debug
iconFrame.CooldownEdge:Hide() if (options.show_horizontal_swipe) then
iconFrame.CooldownEdge.texture = nil iconFrame.CooldownEdge:Show()
iconFrame.CooldownTexture:Show()
iconFrame.CooldownBrightnessTexture:Show()
detailsFramework:SetFontColor(iconFrame.CountdownText, self.options.text_color) iconFrame.CooldownEdge.texture = nil
iconFrame.CooldownEdge:SetAlpha(0.834)
PixelUtil.SetSize(iconFrame.CooldownEdge, iconFrame.CooldownTexture:GetWidth(), 2) PixelUtil.SetSize(iconFrame.CooldownEdge, iconFrame.CooldownTexture:GetWidth(), 2)
PixelUtil.SetPoint(iconFrame.CooldownEdge, "topleft", iconFrame.CooldownTexture, "topleft", 0, 0) PixelUtil.SetPoint(iconFrame.CooldownEdge, "topleft", iconFrame.CooldownTexture, "topleft", 0, 0)
PixelUtil.SetPoint(iconFrame.CooldownEdge, "topright", iconFrame.CooldownTexture, "topright", 0, 0) PixelUtil.SetPoint(iconFrame.CooldownEdge, "topright", iconFrame.CooldownTexture, "topright", 0, 0)
PixelUtil.SetHeight(iconFrame.CooldownEdge, 2) PixelUtil.SetHeight(iconFrame.CooldownEdge, 8)
local swipe_brightness = options.swipe_brightness iconFrame.CooldownEdge:SetTexture(options.swipe_white, "CLAMP", "CLAMP", "TRILINEAR")
iconFrame.CooldownBrightnessTexture:SetAlpha(swipe_brightness) iconFrame.CooldownEdge.texture = options.swipe_white
local swipe_darkness = options.swipe_alpha local swipe_brightness = options.swipe_brightness
iconFrame.CooldownTexture:SetAlpha(swipe_darkness) iconFrame.CooldownBrightnessTexture:SetAlpha(swipe_brightness)
iconFrame.CooldownTexture:SetVertexColor(unpack(options.swipe_color))
iconFrame.CooldownEdge:SetAlpha(0.834) local swipe_darkness = options.swipe_alpha
iconFrame.CooldownTexture:SetAlpha(swipe_darkness)
iconFrame.CooldownTexture:SetVertexColor(unpack(options.swipe_color))
else
iconFrame.CooldownEdge:Hide()
iconFrame.CooldownBrightnessTexture:Hide()
iconFrame.CooldownTexture:Hide()
end
if (options.show_text) then
detailsFramework:SetFontColor(iconFrame.CountdownText, self.options.text_color)
detailsFramework:SetFontSize(iconFrame.CountdownText, self.options.text_size)
detailsFramework:SetFontFace(iconFrame.CountdownText, self.options.text_font)
detailsFramework:SetFontOutline(iconFrame.CountdownText, self.options.text_outline)
detailsFramework:SetAnchor(iconFrame.CountdownText, self.options.text_anchor, iconFrame)
iconFrame.CountdownText:Show()
iconFrame.CountdownText:SetAlpha(1)
else
iconFrame.CountdownText:Hide()
end
if (options.show_cooldown) then
iconFrame.Cooldown:Show()
iconFrame.Cooldown:SetReverse(options.cooldown_reverse)
iconFrame.Cooldown:SetDrawSwipe(options.cooldown_swipe_enabled)
iconFrame.Cooldown:SetEdgeTexture(options.cooldown_edge_texture) --the yellow edge that follows the cooldown animation
iconFrame.Cooldown:SetHideCountdownNumbers(options.surpress_blizzard_cd_timer)
iconFrame.Cooldown:SetSwipeTexture([[Interface\Masks\SquareMask]], 0, 0, 0, 0.3)
--iconFrame.Cooldown:SetSwipeColor(1, 1, 1, 1)
--iconFrame.Cooldown:SetSwipeColor(0, 0, 0, 0.1)
--iconFrame.Cooldown:SetDrawEdge(true) --the same shit as above
--iconFrame.Cooldown:SetDrawSwipe(true)
--iconFrame.Cooldown:SetDrawBling(true) --edge of the animation, a thin horizontal texture
--iconFrame.Cooldown:SetEdgeScale(4) --edge of the animation, a thin horizontal texture
if (not options.surpress_blizzard_cd_timer) then
detailsFramework:SetFontColor(iconFrame.Cooldown.CountdownText, self.options.text_color)
detailsFramework:SetFontSize(iconFrame.Cooldown.CountdownText, self.options.text_size)
detailsFramework:SetFontFace(iconFrame.Cooldown.CountdownText, self.options.text_font)
detailsFramework:SetFontOutline(iconFrame.Cooldown.CountdownText, self.options.text_outline)
end
iconFrame.Cooldown.noCooldownCount = options.surpress_tulla_omni_cc
CooldownFrame_Set(iconFrame.Cooldown, iconFrame.startTime, iconFrame.duration, true, true, iconFrame.modRate)
iconFrame.CooldownBrightnessTexture:Show()
else
iconFrame.Cooldown:Hide()
end
self.OnIconTick(iconFrame) self.OnIconTick(iconFrame)
local amountOfLoops = math.floor(iconFrame.duration / 0.5) local amountOfLoops = math.floor(iconFrame.duration / 0.25)
local loopEndCallback = nil local loopEndCallback = nil
local checkPointCallback = nil if (iconFrame.options.remove_on_finish) then
--increase the amount of loops in one, so the last loop will remove the icon
local newLooper = detailsFramework.Schedules.NewLooper(0.5, self.OnIconTick, amountOfLoops, loopEndCallback, checkPointCallback, iconFrame) --otherwise it might finish
iconFrame.cooldownLooper = newLooper amountOfLoops = amountOfLoops + 1
local newLooper = detailsFramework.Schedules.NewLooper(0.25, self.OnIconTick, amountOfLoops, loopEndCallback, checkPointCallback, iconFrame)
iconFrame.cooldownLooper = newLooper
else
local newLooper = detailsFramework.Schedules.NewLooper(0.25, self.OnIconTick, amountOfLoops, loopEndCallback, checkPointCallback, iconFrame)
iconFrame.cooldownLooper = newLooper
end
end, end,
---@param iconFrame df_icongeneric ---@param iconFrame df_icongeneric
OnIconTick = function(iconFrame) OnIconTick = function(iconFrame)
local now = GetTime() local now = GetTime()
--local percent = (now - iconFrame.startTime) / iconFrame.duration --no mod rate --local percent = (now - iconFrame.startTime) / iconFrame.duration --no mod rate
local percent = ((now - iconFrame.startTime) / (iconFrame.modRate or 1)) / (iconFrame.duration / (iconFrame.modRate or 1)) local percent = (((now - iconFrame.startTime) / (iconFrame.modRate or 1)) / (iconFrame.duration / (iconFrame.modRate or 1))) or 0
local options = iconFrame.options local options = iconFrame.options
percent = Saturate(percent)
--percent = abs(percent - 1) --percent = abs(percent - 1)
local newHeight = math.min(iconFrame.textureHeight * percent, iconFrame.textureHeight) iconFrame.timeRemaining = iconFrame.duration - (now - iconFrame.startTime)
iconFrame.CooldownTexture:SetHeight(newHeight)
PixelUtil.SetPoint(iconFrame.CooldownBrightnessTexture, "bottomright", iconFrame, "bottomright", 0, newHeight) --iconFrame.textureHeight - if (percent >= 1) then
local left, right, top, bottom = unpack(iconFrame.CooldownBrightnessTexture.cords) --time expired
local newBottomCord = Lerp(iconFrame.CooldownBrightnessTexture.top, iconFrame.CooldownBrightnessTexture.bottom, abs(percent - 1)) if (options.remove_on_finish) then
iconFrame.CooldownBrightnessTexture:SetTexCoord(left, right, top, newBottomCord) iconFrame:GetParent():RemoveSpecificIcon(iconFrame.identifierKey)
return
if (percent > options.swipe_percent2) then else
if (options.swipe_red and iconFrame.CooldownEdge.texture ~= options.swipe_red) then percent = 1
iconFrame.CooldownEdge:Show()
iconFrame.CooldownEdge:SetTexture(options.swipe_red)
iconFrame.CooldownEdge.texture = options.swipe_red
end
elseif (percent > options.swipe_percent1) then
if (options.swipe_yellow and iconFrame.CooldownEdge.texture ~= options.swipe_yellow) then
iconFrame.CooldownEdge:Show()
iconFrame.CooldownEdge:SetTexture(options.swipe_yellow)
iconFrame.CooldownEdge.texture = options.swipe_yellow
end end
end end
--iconFrame.CountdownText:SetText(iconFrame.parentIconRow.FormatCooldownTime(iconFrame.duration - (now - iconFrame.startTime))) --no mod rate if (options.show_horizontal_swipe) then
iconFrame.CountdownText:SetText(iconFrame.parentIconRow.FormatCooldownTime((iconFrame.duration - (now - iconFrame.startTime)) / (iconFrame.modRate or 1))) local newHeight = math.min(iconFrame.textureHeight * percent, iconFrame.textureHeight)
--self.CountdownText:Show() iconFrame.CooldownTexture:SetHeight(newHeight)
PixelUtil.SetPoint(iconFrame.CooldownBrightnessTexture, "bottomright", iconFrame.Texture, "bottomright", 0, newHeight) --iconFrame.textureHeight -
local left, right, top, bottom = unpack(iconFrame.CooldownBrightnessTexture.cords)
local newBottomCord = Lerp(iconFrame.CooldownBrightnessTexture.top, iconFrame.CooldownBrightnessTexture.bottom, abs(percent - 1))
iconFrame.CooldownBrightnessTexture:SetTexCoord(left, right, top, newBottomCord)
--local newBrightness = Lerp(Saturate(options.cooldown_max_brightness-0.6), options.cooldown_max_brightness, percent)
--iconFrame.CooldownBrightnessTexture:SetAlpha(newBrightness)
if (options.swipe_progressive_color) then
--interpolate from green to red
--percent goes from 0 to 1, where zero is the start of the cooldown and 1 is the end
if (options.swipe_color_start and options.swipe_color_end) then
--use the first and second color
local r1, g1, b1 = unpack(options.swipe_color_start)
local r2, g2, b2 = unpack(options.swipe_color_end)
local r, g, b = detailsFramework.Math.LerpLinearColor(percent, 1, r1, g1, b1, r2, g2, b2)
iconFrame.CooldownEdge:SetVertexColor(r, g, b, 0.834)
else
--use a solid color
iconFrame.CooldownEdge:SetVertexColor(unpack(options.swipe_color))
end
--iconFrame.CooldownEdge:SetVertexColor(percent, math.abs(percent-1), 0, 0.834)
local alpha = Saturate(0.2 + percent)
iconFrame.CooldownEdge:SetAlpha(alpha)
else
--use a solid color
iconFrame.CooldownEdge:SetVertexColor(unpack(options.swipe_color))
end
end
if (options.show_cooldown) then
if (options.cooldown_max_brightness) then
iconFrame.CooldownBrightnessTexture:SetAlpha(Lerp(0, options.cooldown_max_brightness, percent))
local swipeAlpha = Saturate(Lerp(0, 1, percent))
local exponentialCurve = 0.1 * math.exp(3.5 * swipeAlpha)
exponentialCurve = Saturate(exponentialCurve)
iconFrame.Cooldown:SetSwipeColor(0, 0, 0, exponentialCurve)
end
end
--show the countdown text
if (options.show_text) then
iconFrame.CountdownText:SetText(iconFrame.parentIconRow.FormatCooldownTime((iconFrame.duration - (now - iconFrame.startTime)) / (iconFrame.modRate or 1)))
if (options.text_alpha_by_percent) then
iconFrame.CountdownText:SetAlpha(percent)
end
end
end, end,
FormatCooldownTime = function(thisTime) FormatCooldownTime = function(thisTime)
@@ -495,7 +699,7 @@ detailsFramework.IconGenericMixin = {
end end
end, end,
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
---@param identifierKey any ---@param identifierKey any
RemoveSpecificIcon = function(self, identifierKey) RemoveSpecificIcon = function(self, identifierKey)
if (not identifierKey or identifierKey == "") then if (not identifierKey or identifierKey == "") then
@@ -527,7 +731,7 @@ detailsFramework.IconGenericMixin = {
self:AlignAuraIcons() self:AlignAuraIcons()
end, end,
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
ClearIcons = function(self, resetBuffs, resetDebuffs) ClearIcons = function(self, resetBuffs, resetDebuffs)
resetBuffs = resetBuffs ~= false resetBuffs = resetBuffs ~= false
resetDebuffs = resetDebuffs ~= false resetDebuffs = resetDebuffs ~= false
@@ -560,7 +764,7 @@ detailsFramework.IconGenericMixin = {
self:AlignAuraIcons() self:AlignAuraIcons()
end, end,
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
AlignAuraIcons = function(self) AlignAuraIcons = function(self)
local iconPool = self.IconPool local iconPool = self.IconPool
local iconAmount = #iconPool local iconAmount = #iconPool
@@ -604,22 +808,30 @@ detailsFramework.IconGenericMixin = {
if (growDirection == 1) then --grow to right if (growDirection == 1) then --grow to right
if (bIsFirstIcon) then if (bIsFirstIcon) then
local attachSide = (bIsCenterAligned and "center") or (nWhichSide and not detailsFramework.SideIsCorner[nWhichSide] and "left") or "bottomleft" if (self.options.first_icon_use_anchor) then
PixelUtil.SetPoint(iconFrame, attachSide, anchorTo, attachSide, 0, 0) detailsFramework:SetAnchor(iconFrame, self.options.anchor, self)
else
local attachSide = (bIsCenterAligned and "center") or (nWhichSide and not detailsFramework.SideIsCorner[nWhichSide] and "left") or "bottomleft"
PixelUtil.SetPoint(iconFrame, attachSide, anchorTo, attachSide, 0, 0)
end
else else
PixelUtil.SetPoint(iconFrame, "left", anchorTo, "right", xPadding, 0) PixelUtil.SetPoint(iconFrame, "left", anchorTo, "right", xPadding, 0)
end end
elseif (growDirection == 2) then --grow to left elseif (growDirection == 2) then --grow to left
if (bIsFirstIcon) then if (bIsFirstIcon) then
local attachSide = (bIsCenterAligned and "center") or (nWhichSide and not detailsFramework.SideIsCorner[nWhichSide] and "right") or "bottomright" if (self.options.first_icon_use_anchor) then
PixelUtil.SetPoint(iconFrame, attachSide, anchorTo, attachSide, 0, 0) detailsFramework:SetAnchor(iconFrame, self.options.anchor, self)
else
local attachSide = (bIsCenterAligned and "center") or (nWhichSide and not detailsFramework.SideIsCorner[nWhichSide] and "right") or "bottomright"
PixelUtil.SetPoint(iconFrame, attachSide, anchorTo, attachSide, 0, 0)
end
else else
PixelUtil.SetPoint(iconFrame, "right", anchorTo, "left", xPadding, 0) PixelUtil.SetPoint(iconFrame, "right", anchorTo, "left", xPadding, 0)
end end
end end
width = width + ((iconFrame.width or iconFrame:GetWidth()) * iconFrame:GetScale()) + 1 width = width + ((iconFrame.width or iconFrame:GetWidth())) + 1 --* iconFrame:GetScale() removed the getscale as now the scale are applied to the width and height
end end
if (bIsCenterAligned) then if (bIsCenterAligned) then
@@ -636,13 +848,13 @@ detailsFramework.IconGenericMixin = {
end end
end, end,
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
GetIconGrowDirection = function(self) GetIconGrowDirection = function(self)
local side = self.options.anchor.side local side = self.options.anchor.side
return detailsFramework.GrowDirectionBySide[side] return detailsFramework.GrowDirectionBySide[side]
end, end,
---@param self df_iconrow the parent frame ---@param self df_iconrow_generic the parent frame
OnOptionChanged = function(self, optionName) OnOptionChanged = function(self, optionName)
if (self.SetBackdropColor) then if (self.SetBackdropColor) then
self:SetBackdropColor(unpack(self.options.backdrop_color)) self:SetBackdropColor(unpack(self.options.backdrop_color))
@@ -651,19 +863,18 @@ detailsFramework.IconGenericMixin = {
end, end,
} }
local default_icon_row_options = { ---@type df_iconrow_generic_options
local default_iconrow_generic_options = {
icon_width = 20, icon_width = 20,
icon_height = 20, icon_height = 20,
texcoord = {.1, .9, .1, .9}, texcoord = {.1, .9, .1, .9},
show_text = true, show_text = false,
text_color = {1, 1, 1, 1}, text_color = {1, 1, 1, 1},
text_size = 12, text_size = 12,
text_font = "Arial Narrow", text_font = "Arial Narrow",
text_outline = "NONE", text_outline = "NONE",
text_anchor = "center", text_anchor = {side = 9, x = 0, y = 0},
text_rel_anchor = "center", text_alpha_by_percent = false,
text_x_offset = 0,
text_y_offset = 0,
desc_text = true, desc_text = true,
desc_text_color = {1, 1, 1, 1}, desc_text_color = {1, 1, 1, 1},
desc_text_size = 7, desc_text_size = 7,
@@ -691,29 +902,35 @@ local default_icon_row_options = {
anchor = {side = 6, x = 2, y = 0}, anchor = {side = 6, x = 2, y = 0},
grow_direction = 1, --1 = to right 2 = to left grow_direction = 1, --1 = to right 2 = to left
center_alignment = false, --if true if will align the icons with grow_direction and then set the iconRow width to match the length used by all icons center_alignment = false, --if true if will align the icons with grow_direction and then set the iconRow width to match the length used by all icons
surpress_blizzard_cd_timer = false,
show_cooldown = false,
surpress_tulla_omni_cc = false, surpress_tulla_omni_cc = false,
on_tick_cooldown_update = true, decimal_timer = false, --nop, not in use
decimal_timer = false,
cooldown_reverse = false, cooldown_reverse = false,
cooldown_swipe_enabled = true, cooldown_swipe_enabled = true,
cooldown_edge_texture = "Interface\\Cooldown\\edge", cooldown_edge_texture = "Interface\\Cooldown\\edge",
cooldown_max_brightness = 0.7,
surpress_blizzard_cd_timer = false,
on_tick_cooldown_update = true, --nop, not in use
show_horizontal_swipe = true,
swipe_progressive_color = true,
swipe_alpha = 0.5, swipe_alpha = 0.5,
swipe_brightness = 0.5, swipe_brightness = 0.5,
swipe_color = {0, 0, 0}, swipe_color = {0, 0, 0}, --this variable is having conflicts because it's in use by other things
swipe_yellow = false, swipe_color_start = {0, 1, 0},
swipe_red = false, swipe_color_end = {1, 0, 0},
swipe_percent1 = 0.75,
swipe_percent2 = 0.90,
--first_icon_anchor = "auto", remove_on_finish = false,
first_icon_use_anchor = false,
} }
---@param parent frame ---@param parent frame
---@param name string? ---@param name string?
---@param options table? ---@param options table?
---@return df_iconrow ---@return df_iconrow_generic
function detailsFramework:CreateIconRowGeneric(parent, name, options) function detailsFramework:CreateIconRowGeneric(parent, name, options)
local newIconRowFrame = CreateFrame("frame", name, parent, "BackdropTemplate") local newIconRowFrame = CreateFrame("frame", name, parent, "BackdropTemplate")
newIconRowFrame.IconPool = {} newIconRowFrame.IconPool = {}
@@ -724,7 +941,7 @@ function detailsFramework:CreateIconRowGeneric(parent, name, options)
detailsFramework:Mixin(newIconRowFrame, detailsFramework.IconGenericMixin) detailsFramework:Mixin(newIconRowFrame, detailsFramework.IconGenericMixin)
detailsFramework:Mixin(newIconRowFrame, detailsFramework.OptionsFunctions) detailsFramework:Mixin(newIconRowFrame, detailsFramework.OptionsFunctions)
newIconRowFrame:BuildOptionsTable(default_icon_row_options, options) newIconRowFrame:BuildOptionsTable(default_iconrow_generic_options, options)
newIconRowFrame:SetSize(1, 1) newIconRowFrame:SetSize(1, 1)
+8 -3
View File
@@ -111,14 +111,14 @@ local cornerNames = {"TopLeft", "TopRight", "BottomLeft", "BottomRight"}
local setCornerPoints = function(self, textures, width, height, xOffset, yOffset, bIsBorder) local setCornerPoints = function(self, textures, width, height, xOffset, yOffset, bIsBorder)
for cornerName, thisTexture in pairs(textures) do for cornerName, thisTexture in pairs(textures) do
PixelUtil.SetSize(thisTexture, width or 16, height or 16) PixelUtil.SetSize(thisTexture, width or 16, height or 16)
thisTexture:SetTexture(self.options.corner_texture) thisTexture:SetTexture(self.options.corner_texture, "CLAMP", "CLAMP", "TRILINEAR")
--set the mask --set the mask
if (not thisTexture.MaskTexture and bIsBorder) then if (not thisTexture.MaskTexture and bIsBorder) then
thisTexture.MaskTexture = self:CreateMaskTexture(nil, "background") thisTexture.MaskTexture = self:CreateMaskTexture(nil, "background")
thisTexture.MaskTexture:SetSize(74, 64) thisTexture.MaskTexture:SetSize(74, 64)
thisTexture:AddMaskTexture(thisTexture.MaskTexture) thisTexture:AddMaskTexture(thisTexture.MaskTexture)
thisTexture.MaskTexture:SetTexture([[Interface\Azerite\AzeriteGoldRingRank2]]) --1940690 thisTexture.MaskTexture:SetTexture([[Interface\Azerite\AzeriteGoldRingRank2]], "CLAMP", "CLAMP", "TRILINEAR") --1940690
--thisTexture.MaskTexture:Hide() --thisTexture.MaskTexture:Hide()
end end
@@ -300,7 +300,7 @@ detailsFramework.RoundedCornerPanelMixin = {
---@type height ---@type height
local frameHeight = self:GetHeight() local frameHeight = self:GetHeight()
if (frameHeight < 32) then if (false and frameHeight < 32) then
local newCornerSize = frameHeight / 2 local newCornerSize = frameHeight / 2
--set the new size of the corners on all corner textures --set the new size of the corners on all corner textures
@@ -419,6 +419,11 @@ detailsFramework.RoundedCornerPanelMixin = {
return self:GetHeight() - (borderTexture:GetHeight() * 2) + 2 return self:GetHeight() - (borderTexture:GetHeight() * 2) + 2
elseif (alignment == "horizontal") then elseif (alignment == "horizontal") then
if (self.tabSide) then
if (self.tabSide == "left" or self.tabSide == "right") then
return self:GetWidth() - (borderTexture:GetHeight() * 2) + 2 - borderTexture:GetHeight()
end
end
return self:GetWidth() - (borderTexture:GetHeight() * 2) + 2 return self:GetWidth() - (borderTexture:GetHeight() * 2) + 2
end end
+100 -8
View File
@@ -334,11 +334,11 @@ local grid_scrollbox_options = {
---create a scrollbox with a grid layout ---create a scrollbox with a grid layout
---@param parent frame ---@param parent frame
---@param name string ---@param name string
---@param refreshFunc function ---@param refreshFunc fun(button:frame, data:table)
---@param data table ---@param data table
---@param createColumnFrameFunc function ---@param createColumnFrameFunc fun(line:frame, lineIndex:number, columnIndex:number)
---@param options df_gridscrollbox_options? ---@param options df_gridscrollbox_options?
---@return unknown ---@return df_gridscrollbox
function detailsFramework:CreateGridScrollBox(parent, name, refreshFunc, data, createColumnFrameFunc, options) function detailsFramework:CreateGridScrollBox(parent, name, refreshFunc, data, createColumnFrameFunc, options)
options = options or {} options = options or {}
@@ -428,25 +428,117 @@ function detailsFramework:CreateGridScrollBox(parent, name, refreshFunc, data, c
scrollBox.OnSetData = onSetData scrollBox.OnSetData = onSetData
onSetData(scrollBox, data) onSetData(scrollBox, data)
---@cast scrollBox df_gridscrollbox
return scrollBox return scrollBox
end end
function detailsFramework.CreateRoundedOptionsScrollBox(parent, name, onRefreshButton, onSelectOption, tbdData, createSelectorButton, gridScrollBoxOptions) ---create a scrollbox with a grid layout to be used as a menu
---@param parent frame
---@param name string?
---@param refreshMeFunc fun(gridScrollBox:df_gridscrollbox, searchText:string)
---@param refreshButtonFunc fun(button:button, data:table)
---@param clickFunc fun(button:button, data:table)
---@param onCreateButton fun(button:button, lineIndex:number, columnIndex:number)
---@param gridScrollBoxOptions df_gridscrollbox_options
---@return df_gridscrollbox
function detailsFramework:CreateMenuWithGridScrollBox(parent, name, refreshMeFunc, refreshButtonFunc, clickFunc, onCreateButton, gridScrollBoxOptions)
local dataSelected = nil
local gridScrollBox
local onClickButtonSelectorButton = function(blizzButton, buttonDown, dfButton, data)
dataSelected = data
gridScrollBox:Refresh()
xpcall(clickFunc, geterrorhandler(), dfButton, data)
end
--create a search bar to filter the auras
local searchText = ""
local onSearchTextChangedCallback = function(self, ...)
local text = self:GetText()
searchText = string.lower(text)
dataSelected = nil
gridScrollBox:RefreshMe()
end
local searchBox = detailsFramework:CreateSearchBox(parent, onSearchTextChangedCallback)
---when the scroll is refreshing the line, the line will call this function for each selection button on it ---when the scroll is refreshing the line, the line will call this function for each selection button on it
---@param button df_button ---@param button df_button
---@param data table ---@param data table
local refreshAuraSelectorFrame = function(button, data) local refreshLine = function(button, data)
button.data = data button.data = data
if (data.tooltip) then if (data.tooltip) then
button.tooltip = data.tooltip button.tooltip = data.tooltip
end end
xpcall(onRefreshButton, geterrorhandler(), button, data)
--set what happen when the user clicks the button --set what happen when the user clicks the button
button:SetClickFunction(onSelectOption, button, data) button:SetClickFunction(onClickButtonSelectorButton, button, data)
if (button.data == dataSelected) then
button.widget:SetBorderCornerColor(.9, .9, .9)
else
button.widget:SetBorderCornerColor(unpack(gridScrollBoxOptions.roundedFramePreset.border_color))
end
xpcall(refreshButtonFunc, geterrorhandler(), button, data)
end end
--create a line
local createButton = function(line, lineIndex, columnIndex)
local width = gridScrollBoxOptions.width / gridScrollBoxOptions.columns_per_line - 5
local height = gridScrollBoxOptions.line_height
if (not height) then
height = 30
end
local button = detailsFramework:CreateButton(line, onClickButtonSelectorButton, width, height)
detailsFramework:AddRoundedCornersToFrame(button.widget, gridScrollBoxOptions.roundedFramePreset)
button.textsize = 11
button:SetHook("OnEnter", function(self)
local dfButton = self:GetObject()
GameCooltip:Reset()
if (dfButton.spellId) then
GameCooltip:SetSpellByID(dfButton.spellId)
GameCooltip:SetOwner(self)
GameCooltip:Show()
end
self:SetBorderCornerColor(.9, .9, .9)
end)
button:SetHook("OnLeave", function(self)
GameCooltip:Hide()
local dfButton = self:GetObject()
if (dfButton.data == dataSelected) then
self:SetBorderCornerColor(.9, .9, .9)
else
self:SetBorderCornerColor(unpack(gridScrollBoxOptions.roundedFramePreset.border_color))
end
end)
xpcall(onCreateButton, geterrorhandler(), button, lineIndex, columnIndex)
return button
end
gridScrollBox = detailsFramework:CreateGridScrollBox(parent, name, refreshLine, {}, createButton, gridScrollBoxOptions)
gridScrollBox:SetBackdrop({})
gridScrollBox:SetBackdropColor(0, 0, 0, 0)
gridScrollBox:SetBackdropBorderColor(0, 0, 0, 0)
gridScrollBox.__background:Hide()
gridScrollBox:Show()
gridScrollBox.searchBox = searchBox
searchBox:SetPoint("bottomleft", gridScrollBox, "topleft", 0, 2)
searchBox:SetWidth(gridScrollBoxOptions.width)
function gridScrollBox:RefreshMe()
xpcall(refreshMeFunc, geterrorhandler(), gridScrollBox, searchBox:GetText())
end
return gridScrollBox
end end
--Need to test this and check the "same_name_spells_add(value)" on the OnEnter function --Need to test this and check the "same_name_spells_add(value)" on the OnEnter function
+71 -8
View File
@@ -885,13 +885,26 @@ local get_switch_func = function(self)
return self.OnSwitch return self.OnSwitch
end end
local setCheckedTexture = function(self, texture, xOffSet, yOffSet) local setCheckedTexture = function(self, texture, xOffSet, yOffSet, sizePercent, color)
self.checked_texture:SetTexture(texture) if (texture) then
self.checked_texture:SetTexture(texture, "CLAMP", "CLAMP", "TRILINEAR")
end
if (xOffSet or yOffSet) then if (xOffSet or yOffSet) then
self.checked_texture:SetPoint("center", self.button, "center", xOffSet or -1, yOffSet or -1) self.checked_texture:SetPoint("center", self.button, "center", xOffSet or -1, yOffSet or -1)
else else
self.checked_texture:SetPoint("center", self.button, "center", -1, -1) self.checked_texture:SetPoint("center", self.button, "center", -1, -1)
end end
if (sizePercent and type(sizePercent) == "number") then
local width = self:GetWidth() * sizePercent
self.checked_texture:SetSize(width, width)
end
if (color) then
local r, g, b, a = DF:ParseColors(color)
self.checked_texture:SetVertexColor(r, g, b, a)
end
end end
local set_as_checkbok = function(self) local set_as_checkbok = function(self)
@@ -904,6 +917,7 @@ local set_as_checkbok = function(self)
self.checked_texture = checked self.checked_texture = checked
self.SetCheckedTexture = setCheckedTexture self.SetCheckedTexture = setCheckedTexture
self.SetChecked = switch_set_value
self._thumb:Hide() self._thumb:Hide()
self._text:Hide() self._text:Hide()
@@ -1041,6 +1055,14 @@ function DF:NewSwitch(parent, container, name, member, width, height, leftText,
end end
function DFSliderMetaFunctions:SetTemplate(template) function DFSliderMetaFunctions:SetTemplate(template)
if (type(template) == "string") then
local templateName = template
template = DF:GetTemplate("switch", templateName)
if (not template) then
print("no template found", templateName)
end
end
--slider e switch --slider e switch
if (template.width) then if (template.width) then
PixelUtil.SetWidth(self.widget, template.width) PixelUtil.SetWidth(self.widget, template.width)
@@ -1103,13 +1125,54 @@ function DFSliderMetaFunctions:SetTemplate(template)
local r, g, b, a = DF:ParseColors(template.disabled_backdropcolor) local r, g, b, a = DF:ParseColors(template.disabled_backdropcolor)
self.backdrop_disabledcolor = {r, g, b, a} self.backdrop_disabledcolor = {r, g, b, a}
end end
if (template.is_checkbox) then
self:SetAsCheckBox()
self:SetCheckedTexture(template.checked_texture, template.checked_xoffset or 0, template.checked_yoffset or 0, template.checked_size_percent or 0.7, template.checked_color)
end
if (template.rounded_corner) then
self:SetBackdrop(nil)
DF:AddRoundedCornersToFrame(self.widget or self, template.rounded_corner)
end
end end
function DF:CreateSlider (parent, w, h, min, max, step, defaultv, isDecemal, member, name, with_label, slider_template, label_template) --DF:Mixin(DFSliderMetaFunctions, DF.SetPointMixin)
local slider, label = DF:NewSlider (parent, parent, name, member, w, h, min, max, step, defaultv, isDecemal, false, with_label, slider_template, label_template) --DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin)
return slider, label --DF:Mixin(DFSliderMetaFunctions, DF.TooltipHandlerMixin)
---@class df_slider : slider, df_scripthookmixin
---@field widget slider
---@field slider slider
---@field type string
---@field dframework boolean
---@field SetTemplate fun(self:df_slider, template: table|string)
---@field SetFixedParameter fun(value: any)
---@field GetFixedParameter fun()
---@field SetValueNoCallback fun(value: number)
---@field SetThumbSize fun(width:number, height:number)
---@field ClearFocus fun()
---@param parent frame
---@param width number? default 150
---@param height number? default 20
---@param minValue number? default 1
---@param maxValue number? default 2
---@param step number? default 1
---@param defaultv number? default to minValue
---@param isDecemal boolean? default false
---@param member string?
---@param name string?
---@param label string?
---@param sliderTemplate string|table|nil
---@param labelTemplate string|table|nil
---@return df_slider, df_label?
function DF:CreateSlider (parent, width, height, minValue, maxValue, step, defaultv, isDecemal, member, name, label, sliderTemplate, labelTemplate)
local slider, labelText = DF:NewSlider(parent, parent, name, member, width, height, minValue, maxValue, step, defaultv, isDecemal, false, label, sliderTemplate, labelTemplate)
return slider, labelText
end end
---@return df_slider, df_label?
function DF:NewSlider (parent, container, name, member, width, height, minValue, maxValue, step, defaultValue, isDecemal, isSwitch, with_label, slider_template, label_template) function DF:NewSlider (parent, container, name, member, width, height, minValue, maxValue, step, defaultValue, isDecemal, isSwitch, with_label, slider_template, label_template)
if (not name) then if (not name) then
name = "DetailsFrameworkSlider" .. DF.SliderCounter name = "DetailsFrameworkSlider" .. DF.SliderCounter
@@ -1117,7 +1180,7 @@ function DF:NewSlider (parent, container, name, member, width, height, minValue,
end end
if (not parent) then if (not parent) then
return error("Details! FrameWork: parent not found.", 2) error("Details! FrameWork: parent not found.", 2)
end end
if (not container) then if (not container) then
@@ -1148,8 +1211,8 @@ function DF:NewSlider (parent, container, name, member, width, height, minValue,
step = step or 1 step = step or 1
defaultValue = defaultValue or minValue defaultValue = defaultValue or minValue
width = width or 130 width = width or 160
height = height or 19 height = height or 20
--default members --default members
SliderObject.lockdown = false SliderObject.lockdown = false
+45
View File
@@ -722,6 +722,51 @@ function detailsFramework:NewTextEntry(parent, container, name, member, width, h
return newTextEntryObject, withLabel return newTextEntryObject, withLabel
end end
---create a search box with no backdrop, a magnifying glass icon and a clear search button
---@param parent frame
---@param callback any
---@return df_textentry
function detailsFramework:CreateSearchBox(parent, callback)
local onSearchPressEnterCallback = function(_, _, text, self)
callback(self)
end
local searchBox = detailsFramework:CreateTextEntry(parent, onSearchPressEnterCallback, 220, 26)
searchBox:SetAsSearchBox()
searchBox:SetTextInsets(25, 5, 0, 0)
searchBox:SetBackdrop(nil)
searchBox:SetHook("OnTextChanged", callback)
local file, size, flags = searchBox:GetFont()
searchBox:SetFont(file, 12, flags)
searchBox.ClearSearchButton:SetAlpha(0)
searchBox.BottomLineTexture = searchBox:CreateTexture(nil, "border")
searchBox.BottomLineTexture:SetPoint("bottomleft", searchBox.widget, "bottomleft", -15, 0)
searchBox.BottomLineTexture:SetPoint("bottomright", searchBox.widget, "bottomright", 0, 0)
local bUseAtlasSize = false
searchBox.BottomLineTexture:SetAtlas("common-slider-track")
searchBox.BottomLineTexture:SetHeight(8)
--create the button to clear the search box
searchBox.ClearSearchButton = CreateFrame("button", nil, searchBox.widget, "UIPanelCloseButton")
searchBox.ClearSearchButton:SetPoint("right", searchBox.widget, "right", -3, 0)
searchBox.ClearSearchButton:SetSize(10, 10)
searchBox.ClearSearchButton:SetAlpha(0.3)
searchBox.ClearSearchButton:GetNormalTexture():SetAtlas("common-search-clearbutton")
searchBox.ClearSearchButton:GetHighlightTexture():SetAtlas("common-search-clearbutton")
searchBox.ClearSearchButton:GetPushedTexture():SetAtlas("common-search-clearbutton")
searchBox.ClearSearchButton:SetScript("OnClick", function()
searchBox:SetText("")
searchBox:PressEnter()
searchBox:ClearFocus()
end)
return searchBox
end
function detailsFramework:NewSpellEntry(parent, func, width, height, param1, param2, member, name) function detailsFramework:NewSpellEntry(parent, func, width, height, param1, param2, member, name)
local editbox = detailsFramework:NewTextEntry(parent, parent, name, member, width, height, func, param1, param2) local editbox = detailsFramework:NewTextEntry(parent, parent, name, member, width, height, func, param1, param2)
return editbox return editbox
File diff suppressed because it is too large Load Diff
+9 -2
View File
@@ -18,8 +18,8 @@
local addonName, Details222 = ... local addonName, Details222 = ...
local version, build, date, tocversion = GetBuildInfo() local version, build, date, tocversion = GetBuildInfo()
Details.build_counter = 12294 Details.build_counter = 12307
Details.alpha_build_counter = 12294 --if this is higher than the regular counter, use it instead Details.alpha_build_counter = 12307 --if this is higher than the regular counter, use it instead
Details.dont_open_news = true Details.dont_open_news = true
Details.game_version = version Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter Details.userversion = version .. " " .. Details.build_counter
@@ -158,9 +158,16 @@ do
--change logs --change logs
--[=[ --[=[
--]=] --]=]
local news = { local news = {
{"v10.2.5.12307.155", "February 13th, 2024"},
"Fixed the deaths display, where the windows wasn't usig custom text scripts.",
"Fixed an issue with custom displays, where it was unable to use class colors in their texts.",
"More development and bug fixes on the new Mythic+ Run Completion panel.",
"Framework Update.",
{"v10.2.5.12294.155", "February 08th, 2024"}, {"v10.2.5.12294.155", "February 08th, 2024"},
"General fixes applied to the Mythic+ Panel.", "General fixes applied to the Mythic+ Panel.",
"The Mythic+ section in the options panel can now be translated.", "The Mythic+ section in the options panel can now be translated.",
+137 -136
View File
@@ -2,6 +2,7 @@
local _ = nil local _ = nil
_detalhes.custom_function_cache = {} _detalhes.custom_function_cache = {}
local addonName, Details222 = ... local addonName, Details222 = ...
local Details = _detalhes
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--local pointers --local pointers
@@ -11,17 +12,17 @@
local tinsert = table.insert local tinsert = table.insert
local ipairs = ipairs local ipairs = ipairs
local unpack = table.unpack or unpack local unpack = table.unpack or unpack
local _GetSpellInfo = _detalhes.getspellinfo local _GetSpellInfo = Details.getspellinfo
local IsInRaid = IsInRaid local IsInRaid = IsInRaid
local IsInGroup = IsInGroup local IsInGroup = IsInGroup
local stringReplace = _detalhes.string.replace local stringReplace = Details.string.replace
local Loc = LibStub("AceLocale-3.0"):GetLocale("Details") local Loc = LibStub("AceLocale-3.0"):GetLocale("Details")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--constants --constants
local classCustom = _detalhes.atributo_custom local classCustom = Details.atributo_custom
classCustom.mt = {__index = classCustom} classCustom.mt = {__index = classCustom}
local combatContainers = { local combatContainers = {
@@ -35,7 +36,7 @@
classCustom._InstanceLastCombatShown = {} classCustom._InstanceLastCombatShown = {}
classCustom._TargetActorsProcessed = {} classCustom._TargetActorsProcessed = {}
local ToKFunctions = _detalhes.ToKFunctions local ToKFunctions = Details.ToKFunctions
local SelectedToKFunction = ToKFunctions[1] local SelectedToKFunction = ToKFunctions[1]
local UsingCustomRightText = false local UsingCustomRightText = false
local UsingCustomLeftText = false local UsingCustomLeftText = false
@@ -86,25 +87,25 @@
local func local func
local scriptTypeName = "search" local scriptTypeName = "search"
if (_detalhes.custom_function_cache [instanceObject.customName]) then if (Details.custom_function_cache [instanceObject.customName]) then
func = _detalhes.custom_function_cache [instanceObject.customName] func = Details.custom_function_cache [instanceObject.customName]
else else
local errortext local errortext
func, errortext = loadstring (customObject.script) func, errortext = loadstring (customObject.script)
if (func) then if (func) then
DetailsFramework:SetEnvironment(func) DetailsFramework:SetEnvironment(func)
_detalhes.custom_function_cache [instanceObject.customName] = func Details.custom_function_cache [instanceObject.customName] = func
else else
_detalhes:Msg("|cFFFF9900error compiling code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext) Details:Msg("|cFFFF9900error compiling code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext)
end end
if (customObject.tooltip) then if (customObject.tooltip) then
local tooltip_script, errortext = loadstring (customObject.tooltip) local tooltip_script, errortext = loadstring (customObject.tooltip)
if (tooltip_script) then if (tooltip_script) then
DetailsFramework:SetEnvironment(tooltip_script) DetailsFramework:SetEnvironment(tooltip_script)
_detalhes.custom_function_cache [instanceObject.customName .. "Tooltip"] = tooltip_script Details.custom_function_cache [instanceObject.customName .. "Tooltip"] = tooltip_script
else else
_detalhes:Msg("|cFFFF9900error compiling tooltip code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext) Details:Msg("|cFFFF9900error compiling tooltip code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext)
end end
scriptTypeName = "tooltip" scriptTypeName = "tooltip"
end end
@@ -113,9 +114,9 @@
local total_script, errortext = loadstring (customObject.total_script) local total_script, errortext = loadstring (customObject.total_script)
if (total_script) then if (total_script) then
DetailsFramework:SetEnvironment(total_script) DetailsFramework:SetEnvironment(total_script)
_detalhes.custom_function_cache [instanceObject.customName .. "Total"] = total_script Details.custom_function_cache [instanceObject.customName .. "Total"] = total_script
else else
_detalhes:Msg("|cFFFF9900error compiling total code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext) Details:Msg("|cFFFF9900error compiling total code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext)
end end
scriptTypeName = "total" scriptTypeName = "total"
end end
@@ -124,24 +125,24 @@
local percent_script, errortext = loadstring (customObject.percent_script) local percent_script, errortext = loadstring (customObject.percent_script)
if (percent_script) then if (percent_script) then
DetailsFramework:SetEnvironment(percent_script) DetailsFramework:SetEnvironment(percent_script)
_detalhes.custom_function_cache [instanceObject.customName .. "Percent"] = percent_script Details.custom_function_cache [instanceObject.customName .. "Percent"] = percent_script
else else
_detalhes:Msg("|cFFFF9900error compiling percent code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext) Details:Msg("|cFFFF9900error compiling percent code for custom display " .. (instanceObject.customName or "") .. " |r:", errortext)
end end
scriptTypeName = "percent" scriptTypeName = "percent"
end end
end end
if (not func) then if (not func) then
_detalhes:Msg(Loc ["STRING_CUSTOM_FUNC_INVALID"], func) Details:Msg(Loc ["STRING_CUSTOM_FUNC_INVALID"], func)
_detalhes:EndRefresh (instanceObject, 0, combatObject, combatObject [1]) Details:EndRefresh (instanceObject, 0, combatObject, combatObject [1])
end end
local okey, _total, _top, _amount = pcall (func, combatObject, instance_container, instanceObject) local okey, _total, _top, _amount = pcall (func, combatObject, instance_container, instanceObject)
if (not okey) then if (not okey) then
local errorText = _total local errorText = _total
_detalhes:Msg("|cFFFF9900error on display " .. customObject:GetName() .. " (" .. scriptTypeName .. ")|r:", errorText) Details:Msg("|cFFFF9900error on display " .. customObject:GetName() .. " (" .. scriptTypeName .. ")|r:", errorText)
return _detalhes:EndRefresh(instanceObject, 0, combatObject, combatObject[1]) return Details:EndRefresh(instanceObject, 0, combatObject, combatObject[1])
end end
total = _total or 0 total = _total or 0
@@ -178,7 +179,7 @@
end end
end end
instanceObject:EsconderScrollBar() instanceObject:EsconderScrollBar()
return _detalhes:EndRefresh (instanceObject, total, combatObject, nil) return Details:EndRefresh (instanceObject, total, combatObject, nil)
end end
if (amount > #instance_container._ActorTable) then if (amount > #instance_container._ActorTable) then
@@ -195,8 +196,8 @@
-- key name value need to be formated -- key name value need to be formated
if (customObject) then if (customObject) then
local percent_script = _detalhes.custom_function_cache [instanceObject.customName .. "Percent"] local percent_script = Details.custom_function_cache [instanceObject.customName .. "Percent"]
local total_script = _detalhes.custom_function_cache [instanceObject.customName .. "Total"] local total_script = Details.custom_function_cache [instanceObject.customName .. "Total"]
local okey local okey
for index, actor in ipairs(instance_container._ActorTable) do for index, actor in ipairs(instance_container._ActorTable) do
@@ -206,8 +207,8 @@
if (percent_script) then if (percent_script) then
okey, percent = pcall (percent_script, floor(actor.value), top, total, combatObject, instanceObject, actor) okey, percent = pcall (percent_script, floor(actor.value), top, total, combatObject, instanceObject, actor)
if (not okey) then if (not okey) then
_detalhes:Msg("|cFFFF9900percent script error|r:", percent) Details:Msg("|cFFFF9900percent script error|r:", percent)
return _detalhes:EndRefresh (instanceObject, 0, combatObject, combatObject [1]) return Details:EndRefresh (instanceObject, 0, combatObject, combatObject [1])
end end
else else
percent = format ("%.1f", floor(actor.value) / total * 100) percent = format ("%.1f", floor(actor.value) / total * 100)
@@ -216,8 +217,8 @@
if (total_script) then if (total_script) then
local okey, value = pcall (total_script, floor(actor.value), top, total, combatObject, instanceObject, actor) local okey, value = pcall (total_script, floor(actor.value), top, total, combatObject, instanceObject, actor)
if (not okey) then if (not okey) then
_detalhes:Msg("|cFFFF9900total script error|r:", value) Details:Msg("|cFFFF9900total script error|r:", value)
return _detalhes:EndRefresh (instanceObject, 0, combatObject, combatObject [1]) return Details:EndRefresh (instanceObject, 0, combatObject, combatObject [1])
end end
if (type(value) == "number") then if (type(value) == "number") then
@@ -252,7 +253,7 @@
classCustom:Refresh (instanceObject, instance_container, combatObject, force, total, top, customObject) classCustom:Refresh (instanceObject, instance_container, combatObject, force, total, top, customObject)
return _detalhes:EndRefresh (instanceObject, total, combatObject, combatObject [container_index]) return Details:EndRefresh (instanceObject, total, combatObject, combatObject [container_index])
end end
@@ -288,11 +289,11 @@
elseif (source == "[raid]") then elseif (source == "[raid]") then
if (_detalhes.in_combat and instance.segmento == 0 and not export) then if (Details.in_combat and instance.segmento == 0 and not export) then
if (container_index == 1) then if (container_index == 1) then
combat_container = _detalhes.cache_damage_group combat_container = Details.cache_damage_group
elseif (container_index == 2) then elseif (container_index == 2) then
combat_container = _detalhes.cache_healing_group combat_container = Details.cache_healing_group
end end
end end
@@ -319,7 +320,7 @@
end end
elseif (source == "[player]") then elseif (source == "[player]") then
local pindex = combat [container_index]._NameIndexTable [_detalhes.playername] local pindex = combat [container_index]._NameIndexTable [Details.playername]
if (pindex) then if (pindex) then
local actor = combat [container_index]._ActorTable [pindex] local actor = combat [container_index]._ActorTable [pindex]
local actortotal = func (_, actor, source, target, spellid, combat, instance_container) local actortotal = func (_, actor, source, target, spellid, combat, instance_container)
@@ -379,8 +380,8 @@
end end
end end
local percent_script = _detalhes.custom_function_cache [instance.customName .. "Percent"] local percent_script = Details.custom_function_cache [instance.customName .. "Percent"]
local total_script = _detalhes.custom_function_cache [instance.customName .. "Total"] local total_script = Details.custom_function_cache [instance.customName .. "Total"]
local bars_show_data = instance.row_info.textR_show_data local bars_show_data = instance.row_info.textR_show_data
local bars_brackets = instance:GetBarBracket() local bars_brackets = instance:GetBarBracket()
@@ -399,7 +400,7 @@
local row1 = barContainer [1] local row1 = barContainer [1]
row1.minha_tabela = nil row1.minha_tabela = nil
row1.lineText1:SetText(Loc ["STRING_TOTAL"]) row1.lineText1:SetText(Loc ["STRING_TOTAL"])
row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combatElapsedTime) .. ")") row1.lineText4:SetText(Details:ToK2 (total) .. " (" .. Details:ToK (total / combatElapsedTime) .. ")")
row1:SetValue(100) row1:SetValue(100)
local r, g, b = unpack(instance.total_bar.color) local r, g, b = unpack(instance.total_bar.color)
@@ -435,7 +436,7 @@
local row1 = barContainer [1] local row1 = barContainer [1]
row1.minha_tabela = nil row1.minha_tabela = nil
row1.lineText1:SetText(Loc ["STRING_TOTAL"]) row1.lineText1:SetText(Loc ["STRING_TOTAL"])
row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combatElapsedTime) .. ")") row1.lineText4:SetText(Details:ToK2 (total) .. " (" .. Details:ToK (total / combatElapsedTime) .. ")")
row1:SetValue(100) row1:SetValue(100)
local r, g, b = unpack(instance.total_bar.color) local r, g, b = unpack(instance.total_bar.color)
@@ -493,8 +494,8 @@
--local value, top, total, combat, instance = ... --local value, top, total, combat, instance = ...
okey, percent = pcall (percent_script, self.value, top, total, combat, instance, self) okey, percent = pcall (percent_script, self.value, top, total, combat, instance, self)
if (not okey) then if (not okey) then
_detalhes:Msg("|cFFFF9900error on custom display function|r:", percent) Details:Msg("|cFFFF9900error on custom display function|r:", percent)
return _detalhes:EndRefresh (instance, 0, combat, combat [1]) return Details:EndRefresh (instance, 0, combat, combat [1])
end end
else else
if (percentage_type == 1) then if (percentage_type == 1) then
@@ -512,8 +513,8 @@
if (total_script) then if (total_script) then
local okey, value = pcall (total_script, self.value, top, total, combat, instance, self) local okey, value = pcall (total_script, self.value, top, total, combat, instance, self)
if (not okey) then if (not okey) then
_detalhes:Msg("|cFFFF9900error on custom display function|r:", value) Details:Msg("|cFFFF9900error on custom display function|r:", value)
return _detalhes:EndRefresh (instance, 0, combat, combat [1]) return Details:EndRefresh (instance, 0, combat, combat [1])
end end
if (instance.use_multi_fontstrings) then if (instance.use_multi_fontstrings) then
@@ -554,7 +555,7 @@
-- update tooltip function -- -- update tooltip function --
if (self.id) then if (self.id) then
local school = _detalhes.spell_school_cache[self.nome] local school = Details.spell_school_cache[self.nome]
if (school) then if (school) then
local schoolColor = Details.spells_school[school] local schoolColor = Details.spells_school[school]
if (not schoolColor) then if (not schoolColor) then
@@ -611,7 +612,7 @@
esta_barra.last_value = esta_porcentagem --reseta o ultimo valor da barra esta_barra.last_value = esta_porcentagem --reseta o ultimo valor da barra
if (_detalhes.is_using_row_animations and forcar) then if (Details.is_using_row_animations and forcar) then
esta_barra.tem_animacao = 0 esta_barra.tem_animacao = 0
esta_barra:SetScript("OnUpdate", nil) esta_barra:SetScript("OnUpdate", nil)
end end
@@ -620,7 +621,7 @@
elseif (esta_porcentagem ~= esta_barra.last_value) then --continua mostrando a mesma tabela ento compara a porcentagem elseif (esta_porcentagem ~= esta_barra.last_value) then --continua mostrando a mesma tabela ento compara a porcentagem
--apenas atualizar --apenas atualizar
if (_detalhes.is_using_row_animations) then if (Details.is_using_row_animations) then
local upRow = barras_container [whichRowLine-1] local upRow = barras_container [whichRowLine-1]
if (upRow) then if (upRow) then
@@ -641,14 +642,14 @@
end end
end end
function classCustom:RefreshBarra(esta_barra, instancia, from_resize) function classCustom:RefreshBarra(thisBar, instanceObject, bFromResize)
local class, enemy, arena_enemy, arena_ally = self.classe, self.enemy, self.arena_enemy, self.arena_ally local class, enemy, arena_enemy, arena_ally = self.classe, self.enemy, self.arena_enemy, self.arena_ally
if (from_resize) then if (bFromResize) then
if (self.id) then if (self.id) then
local school = _detalhes.spell_school_cache[self.nome] local schoolData = Details.spell_school_cache[self.nome]
if (school) then if (schoolData) then
local schoolColor = Details.spells_school[school] local schoolColor = Details.spells_school[schoolData]
if (not schoolColor) then if (not schoolColor) then
schoolColor = Details.spells_school[1] schoolColor = Details.spells_school[1]
end end
@@ -662,64 +663,64 @@
end end
end end
_detalhes:SetBarColors(esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) self:SetBarColors(thisBar, instanceObject, actor_class_color_r, actor_class_color_g, actor_class_color_b)
--we need a customized icon settings for custom displays. --we need a customized icon settings for custom displays.
if (self.classe == "UNKNOW") then if (self.classe == "UNKNOW") then
esta_barra.icone_classe:SetTexture("Interface\\LFGFRAME\\LFGROLE_BW") thisBar.icone_classe:SetTexture("Interface\\LFGFRAME\\LFGROLE_BW")
esta_barra.icone_classe:SetTexCoord(.25, .5, 0, 1) thisBar.icone_classe:SetTexCoord(.25, .5, 0, 1)
esta_barra.icone_classe:SetVertexColor(1, 1, 1) thisBar.icone_classe:SetVertexColor(1, 1, 1)
elseif (self.classe == "UNGROUPPLAYER") then elseif (self.classe == "UNGROUPPLAYER") then
if (self.enemy) then if (self.enemy) then
if (_detalhes.faction_against == "Horde") then if (Details.faction_against == "Horde") then
esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Orc_Male") thisBar.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Orc_Male")
esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) thisBar.icone_classe:SetTexCoord(0, 1, 0, 1)
else else
esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Human_Male") thisBar.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Human_Male")
esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) thisBar.icone_classe:SetTexCoord(0, 1, 0, 1)
end end
else else
if (_detalhes.faction_against == "Horde") then if (Details.faction_against == "Horde") then
esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Human_Male") thisBar.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Human_Male")
esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) thisBar.icone_classe:SetTexCoord(0, 1, 0, 1)
else else
esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Orc_Male") thisBar.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Orc_Male")
esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) thisBar.icone_classe:SetTexCoord(0, 1, 0, 1)
end end
end end
esta_barra.icone_classe:SetVertexColor(1, 1, 1) thisBar.icone_classe:SetVertexColor(1, 1, 1)
elseif (self.classe == "PET") then elseif (self.classe == "PET") then
esta_barra.icone_classe:SetTexture(instancia.row_info.icon_file) thisBar.icone_classe:SetTexture(instanceObject.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord(0.25, 0.49609375, 0.75, 1) thisBar.icone_classe:SetTexCoord(0.25, 0.49609375, 0.75, 1)
esta_barra.icone_classe:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b) thisBar.icone_classe:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b)
else else
if (self.id) then if (self.id) then
esta_barra.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) thisBar.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
esta_barra.icone_classe:SetTexture(self.icon) thisBar.icone_classe:SetTexture(self.icon)
else else
if (instancia.row_info.use_spec_icons) then if (instanceObject.row_info.use_spec_icons) then
if ((self.spec and self.spec ~= 0) or (self.my_actor.spec and self.my_actor.spec ~= 0)) then if ((self.spec and self.spec ~= 0) or (self.my_actor.spec and self.my_actor.spec ~= 0)) then
esta_barra.icone_classe:SetTexture(instancia.row_info.spec_file) thisBar.icone_classe:SetTexture(instanceObject.row_info.spec_file)
esta_barra.icone_classe:SetTexCoord(unpack(_detalhes.class_specs_coords[self.spec or self.my_actor.spec])) thisBar.icone_classe:SetTexCoord(unpack(Details.class_specs_coords[self.spec or self.my_actor.spec]))
else else
esta_barra.icone_classe:SetTexture([[Interface\AddOns\Details\images\classes_small]]) thisBar.icone_classe:SetTexture([[Interface\AddOns\Details\images\classes_small]])
esta_barra.icone_classe:SetTexCoord(unpack(Details.class_coords[self.classe])) thisBar.icone_classe:SetTexCoord(unpack(Details.class_coords[self.classe]))
end end
else else
esta_barra.icone_classe:SetTexture(instancia.row_info.icon_file) thisBar.icone_classe:SetTexture(instanceObject.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord(unpack(Details.class_coords[self.classe])) thisBar.icone_classe:SetTexCoord(unpack(Details.class_coords[self.classe]))
end end
end end
esta_barra.icone_classe:SetVertexColor(1, 1, 1) thisBar.icone_classe:SetVertexColor(1, 1, 1)
end end
--left text --left text
self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText) self:SetBarLeftText(thisBar, instanceObject, enemy, arena_enemy, arena_ally, UsingCustomLeftText)
esta_barra.lineText1:SetSize(esta_barra:GetWidth() - esta_barra.lineText4:GetStringWidth() - 20, 15) thisBar.lineText1:SetSize(thisBar:GetWidth() - thisBar.lineText4:GetStringWidth() - 20, 15)
end end
@@ -829,7 +830,7 @@
end end
if (class == "UNKNOW") then if (class == "UNKNOW") then
--try once again --try once again
class = _detalhes:GetClass(actor.nome or actor.name) class = Details:GetClass(actor.nome or actor.name)
if (class and class ~= "UNKNOW") then if (class and class ~= "UNKNOW") then
actor.classe = class actor.classe = class
end end
@@ -839,7 +840,7 @@
local newActor = setmetatable({ local newActor = setmetatable({
nome = actor.nome or actor.name, nome = actor.nome or actor.name,
classe = class, classe = class,
value = _detalhes:GetOrderNumber(), value = Details:GetOrderNumber(),
is_custom = true, is_custom = true,
color = actor.color, color = actor.color,
}, classCustom.mt) }, classCustom.mt)
@@ -847,7 +848,7 @@
newActor.customColor = actor.customColor newActor.customColor = actor.customColor
newActor.name_complement = name_complement newActor.name_complement = name_complement
newActor.displayName = actor.displayName or (_detalhes:GetOnlyName(newActor.nome) .. (name_complement or "")) newActor.displayName = actor.displayName or (Details:GetOnlyName(newActor.nome) .. (name_complement or ""))
newActor:SetSpecId(actor.spec) newActor:SetSpecId(actor.spec)
@@ -935,19 +936,19 @@
local actorObject = self.my_actor local actorObject = self.my_actor
if (actorObject.id) then if (actorObject.id) then
_detalhes:AddTooltipSpellHeaderText (select(1, _GetSpellInfo(actorObject.id)), "yellow", 1, select(3, _GetSpellInfo(actorObject.id)), 0.90625, 0.109375, 0.15625, 0.875, false, 18) Details:AddTooltipSpellHeaderText (select(1, _GetSpellInfo(actorObject.id)), "yellow", 1, select(3, _GetSpellInfo(actorObject.id)), 0.90625, 0.109375, 0.15625, 0.875, false, 18)
else else
_detalhes:AddTooltipSpellHeaderText (customObject:GetName(), "yellow", 1, customObject:GetIcon(), 0.90625, 0.109375, 0.15625, 0.875, false, 18) Details:AddTooltipSpellHeaderText (customObject:GetName(), "yellow", 1, customObject:GetIcon(), 0.90625, 0.109375, 0.15625, 0.875, false, 18)
end end
_detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.6) Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.6)
if (customObject:IsScripted()) then if (customObject:IsScripted()) then
if (customObject.tooltip) then if (customObject.tooltip) then
local func = _detalhes.custom_function_cache [instanceObject.customName .. "Tooltip"] local func = Details.custom_function_cache [instanceObject.customName .. "Tooltip"]
local okey, errortext = pcall(func, actorObject, instanceObject.showing, instanceObject, keydown) local okey, errortext = pcall(func, actorObject, instanceObject.showing, instanceObject, keydown)
if (not okey) then if (not okey) then
_detalhes:Msg("|cFFFF9900error on custom display tooltip function|r:", errortext) Details:Msg("|cFFFF9900error on custom display tooltip function|r:", errortext)
return false return false
end end
end end
@@ -1044,14 +1045,14 @@
function classCustom:RemoveCustom (index) function classCustom:RemoveCustom (index)
if (not _detalhes.tabela_instancias) then if (not Details.tabela_instancias) then
--do not remove customs while the addon is loading. --do not remove customs while the addon is loading.
return return
end end
table.remove (_detalhes.custom, index) table.remove (Details.custom, index)
for _, instance in ipairs(_detalhes.tabela_instancias) do for _, instance in ipairs(Details.tabela_instancias) do
if (instance.atributo == 5 and instance.sub_atributo == index) then if (instance.atributo == 5 and instance.sub_atributo == index) then
instance:ResetAttribute() instance:ResetAttribute()
elseif (instance.atributo == 5 and instance.sub_atributo > index) then elseif (instance.atributo == 5 and instance.sub_atributo > index) then
@@ -1062,33 +1063,33 @@
end end
end end
_detalhes.switch:OnRemoveCustom (index) Details.switch:OnRemoveCustom (index)
end end
--export for plugins --export for plugins
function _detalhes:RemoveCustomObject (object_name) function Details:RemoveCustomObject (object_name)
for index, object in ipairs(_detalhes.custom) do for index, object in ipairs(Details.custom) do
if (object.name == object_name) then if (object.name == object_name) then
return classCustom:RemoveCustom (index) return classCustom:RemoveCustom (index)
end end
end end
end end
function _detalhes:ResetCustomFunctionsCache() function Details:ResetCustomFunctionsCache()
Details:Destroy(_detalhes.custom_function_cache) Details:Destroy(Details.custom_function_cache)
end end
function _detalhes.refresh:r_atributo_custom() function Details.refresh:r_atributo_custom()
--check for non used temp displays --check for non used temp displays
if (_detalhes.tabela_instancias) then if (Details.tabela_instancias) then
for i = #_detalhes.custom, 1, -1 do for i = #Details.custom, 1, -1 do
local custom_object = _detalhes.custom [i] local custom_object = Details.custom [i]
if (custom_object.temp) then if (custom_object.temp) then
--check if there is a instance showing this custom --check if there is a instance showing this custom
local showing = false local showing = false
for index, instance in ipairs(_detalhes.tabela_instancias) do for index, instance in ipairs(Details.tabela_instancias) do
if (instance.atributo == 5 and instance.sub_atributo == i) then if (instance.atributo == 5 and instance.sub_atributo == i) then
showing = true showing = true
end end
@@ -1102,37 +1103,37 @@
end end
--restore metatable and indexes --restore metatable and indexes
for index, custom_object in ipairs(_detalhes.custom) do for index, custom_object in ipairs(Details.custom) do
setmetatable(custom_object, classCustom) setmetatable(custom_object, classCustom)
custom_object.__index = classCustom custom_object.__index = classCustom
end end
end end
function _detalhes.clear:c_atributo_custom() function Details.clear:c_atributo_custom()
for _, custom_object in ipairs(_detalhes.custom) do for _, custom_object in ipairs(Details.custom) do
custom_object.__index = nil custom_object.__index = nil
end end
end end
function classCustom:UpdateSelectedToKFunction() function classCustom:UpdateSelectedToKFunction()
SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation] SelectedToKFunction = ToKFunctions [Details.ps_abbreviation]
FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation] FormatTooltipNumber = ToKFunctions [Details.tooltip.abbreviation]
TooltipMaximizedMethod = _detalhes.tooltip.maximize_method TooltipMaximizedMethod = Details.tooltip.maximize_method
classCustom:UpdateDamageDoneBracket() classCustom:UpdateDamageDoneBracket()
classCustom:UpdateHealingDoneBracket() classCustom:UpdateHealingDoneBracket()
end end
function _detalhes:InstallCustomObject (object) function Details:InstallCustomObject (object)
local have = false local have = false
if (object.script_version) then if (object.script_version) then
for _, custom in ipairs(_detalhes.custom) do for _, custom in ipairs(Details.custom) do
if (custom.name == object.name and (custom.script_version and custom.script_version >= object.script_version) ) then if (custom.name == object.name and (custom.script_version and custom.script_version >= object.script_version) ) then
have = true have = true
break break
end end
end end
else else
for _, custom in ipairs(_detalhes.custom) do for _, custom in ipairs(Details.custom) do
if (custom.name == object.name) then if (custom.name == object.name) then
have = true have = true
break break
@@ -1141,27 +1142,27 @@
end end
if (not have) then if (not have) then
for i, custom in ipairs(_detalhes.custom) do for i, custom in ipairs(Details.custom) do
if (custom.name == object.name) then if (custom.name == object.name) then
table.remove (_detalhes.custom, i) table.remove (Details.custom, i)
break break
end end
end end
setmetatable(object, _detalhes.atributo_custom) setmetatable(object, Details.atributo_custom)
object.__index = _detalhes.atributo_custom object.__index = Details.atributo_custom
_detalhes.custom [#_detalhes.custom+1] = object Details.custom [#Details.custom+1] = object
end end
end end
function Details222.GetCustomDisplayIDByName(customDisplayName) function Details222.GetCustomDisplayIDByName(customDisplayName)
for customDisplayID, customObject in ipairs(_detalhes.custom) do for customDisplayID, customObject in ipairs(Details.custom) do
if (customObject.name == customDisplayName) then if (customObject.name == customDisplayName) then
return customDisplayID return customDisplayID
end end
end end
end end
function _detalhes:AddDefaultCustomDisplays() function Details:AddDefaultCustomDisplays()
local PotionUsed = { local PotionUsed = {
name = Loc ["STRING_CUSTOM_POT_DEFAULT"], name = Loc ["STRING_CUSTOM_POT_DEFAULT"],
icon = [[Interface\ICONS\INV_Potion_03]], icon = [[Interface\ICONS\INV_Potion_03]],
@@ -1280,8 +1281,8 @@
table.remove (self.custom, i) table.remove (self.custom, i)
end end
end end
setmetatable(PotionUsed, _detalhes.atributo_custom) setmetatable(PotionUsed, Details.atributo_custom)
PotionUsed.__index = _detalhes.atributo_custom PotionUsed.__index = Details.atributo_custom
self.custom [#self.custom+1] = PotionUsed self.custom [#self.custom+1] = PotionUsed
end end
@@ -1366,8 +1367,8 @@
table.remove (self.custom, i) table.remove (self.custom, i)
end end
end end
setmetatable(Healthstone, _detalhes.atributo_custom) setmetatable(Healthstone, Details.atributo_custom)
Healthstone.__index = _detalhes.atributo_custom Healthstone.__index = Details.atributo_custom
self.custom [#self.custom+1] = Healthstone self.custom [#self.custom+1] = Healthstone
end end
@@ -1430,8 +1431,8 @@
table.remove (self.custom, i) table.remove (self.custom, i)
end end
end end
setmetatable(DamageActivityTime, _detalhes.atributo_custom) setmetatable(DamageActivityTime, Details.atributo_custom)
DamageActivityTime.__index = _detalhes.atributo_custom DamageActivityTime.__index = Details.atributo_custom
self.custom [#self.custom+1] = DamageActivityTime self.custom [#self.custom+1] = DamageActivityTime
end end
@@ -1492,8 +1493,8 @@
table.remove (self.custom, i) table.remove (self.custom, i)
end end
end end
setmetatable(HealActivityTime, _detalhes.atributo_custom) setmetatable(HealActivityTime, Details.atributo_custom)
HealActivityTime.__index = _detalhes.atributo_custom HealActivityTime.__index = Details.atributo_custom
self.custom [#self.custom+1] = HealActivityTime self.custom [#self.custom+1] = HealActivityTime
end end
@@ -1588,8 +1589,8 @@
end end
end end
if (not have) then if (not have) then
setmetatable(CC_Done, _detalhes.atributo_custom) setmetatable(CC_Done, Details.atributo_custom)
CC_Done.__index = _detalhes.atributo_custom CC_Done.__index = Details.atributo_custom
for i, custom in ipairs(self.custom) do for i, custom in ipairs(self.custom) do
if (custom.name == Loc ["STRING_CUSTOM_CC_DONE"]) then if (custom.name == Loc ["STRING_CUSTOM_CC_DONE"]) then
@@ -1722,8 +1723,8 @@
end end
end end
if (not have) then if (not have) then
setmetatable(CC_Received, _detalhes.atributo_custom) setmetatable(CC_Received, Details.atributo_custom)
CC_Received.__index = _detalhes.atributo_custom CC_Received.__index = Details.atributo_custom
for i, custom in ipairs(self.custom) do for i, custom in ipairs(self.custom) do
if (custom.name == Loc ["STRING_CUSTOM_CC_RECEIVED"]) then if (custom.name == Loc ["STRING_CUSTOM_CC_RECEIVED"]) then
@@ -1982,8 +1983,8 @@
end end
end end
if (not have) then if (not have) then
setmetatable(MySpells, _detalhes.atributo_custom) setmetatable(MySpells, Details.atributo_custom)
MySpells.__index = _detalhes.atributo_custom MySpells.__index = Details.atributo_custom
for i, custom in ipairs(self.custom) do for i, custom in ipairs(self.custom) do
if (custom.name == Loc ["STRING_CUSTOM_MYSPELLS"]) then if (custom.name == Loc ["STRING_CUSTOM_MYSPELLS"]) then
@@ -2074,8 +2075,8 @@
end end
end end
if (not have) then if (not have) then
setmetatable(DamageOnSkullTarget, _detalhes.atributo_custom) setmetatable(DamageOnSkullTarget, Details.atributo_custom)
DamageOnSkullTarget.__index = _detalhes.atributo_custom DamageOnSkullTarget.__index = Details.atributo_custom
for i, custom in ipairs(self.custom) do for i, custom in ipairs(self.custom) do
if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONSKULL"]) then if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONSKULL"]) then
@@ -2204,8 +2205,8 @@
end end
end end
if (not have) then if (not have) then
setmetatable(DamageOnAnyTarget, _detalhes.atributo_custom) setmetatable(DamageOnAnyTarget, Details.atributo_custom)
DamageOnAnyTarget.__index = _detalhes.atributo_custom DamageOnAnyTarget.__index = Details.atributo_custom
for i, custom in ipairs(self.custom) do for i, custom in ipairs(self.custom) do
if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONANYMARKEDTARGET"]) then if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONANYMARKEDTARGET"]) then
@@ -2390,8 +2391,8 @@
table.remove (self.custom, i) table.remove (self.custom, i)
end end
end end
setmetatable(DynamicOverallDamage, _detalhes.atributo_custom) setmetatable(DynamicOverallDamage, Details.atributo_custom)
DynamicOverallDamage.__index = _detalhes.atributo_custom DynamicOverallDamage.__index = Details.atributo_custom
self.custom [#self.custom+1] = DynamicOverallDamage self.custom [#self.custom+1] = DynamicOverallDamage
end end
@@ -2491,13 +2492,13 @@
table.remove (self.custom, i) table.remove (self.custom, i)
end end
end end
setmetatable(DamageOnShields, _detalhes.atributo_custom) setmetatable(DamageOnShields, Details.atributo_custom)
DamageOnShields.__index = _detalhes.atributo_custom DamageOnShields.__index = Details.atributo_custom
self.custom [#self.custom+1] = DamageOnShields self.custom [#self.custom+1] = DamageOnShields
end end
--------------------------------------- ---------------------------------------
_detalhes:ResetCustomFunctionsCache() Details:ResetCustomFunctionsCache()
end end
+19 -6
View File
@@ -327,8 +327,18 @@ function Details.Sort4Reverse(table1, table2) --[[exported]]
return table1[4] < table2[4] return table1[4] < table2[4]
end end
function Details:GetTextColor(instanceObject, actorObject) function Details:GetTextColor(instanceObject, textSide)
if (instanceObject.row_info.textL_class_colors) then local actorObject = self
textSide = textSide or "left"
local bUseClassColor = false
if (textSide == "left") then
bUseClassColor = instanceObject.row_info.textL_class_colors
elseif (textSide == "right") then
bUseClassColor = instanceObject.row_info.textR_class_colors
end
if (bUseClassColor) then
return unpack(Details.class_colors[actorObject.classe or "UNKNOW"]) return unpack(Details.class_colors[actorObject.classe or "UNKNOW"])
else else
return unpack(instanceObject.row_info.fixed_text_color) return unpack(instanceObject.row_info.fixed_text_color)
@@ -3179,9 +3189,12 @@ function Details:SetBarLeftText(bar, instance, enemy, arenaEnemy, arenaAlly, usi
barNumber = bar.colocacao .. ". " barNumber = bar.colocacao .. ". "
end end
--translate cyrillic alphabet to western alphabet by Vardex (https://github.com/Vardex May 22, 2019)
if (instance.row_info.textL_translit_text) then if (instance.row_info.textL_translit_text) then
self.displayName = Translit:Transliterate(self.displayName, "!") if (not self.transliteratedName) then
--translate cyrillic alphabet to western alphabet by Vardex (https://github.com/Vardex May 22, 2019)
self.transliteratedName = Translit:Transliterate(self.displayName, "!")
end
self.displayName = self.transliteratedName or self.displayName
end end
if (enemy) then if (enemy) then
@@ -3282,12 +3295,12 @@ function Details:SetBarColors(bar, instance, r, g, b, a) --[[exported]] --~color
end end
if (instance.row_info.textL_class_colors) then if (instance.row_info.textL_class_colors) then
local textColor_Red, textColor_Green, textColor_Blue = Details:GetTextColor(instance, self) local textColor_Red, textColor_Green, textColor_Blue = self:GetTextColor(instance, "left")
bar.lineText1:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) --the r, g, b color passed are the color used on the bar, so if the bar is not using class color, the text is painted with the fixed color for the bar bar.lineText1:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) --the r, g, b color passed are the color used on the bar, so if the bar is not using class color, the text is painted with the fixed color for the bar
end end
if (instance.row_info.textR_class_colors) then if (instance.row_info.textR_class_colors) then
local textColor_Red, textColor_Green, textColor_Blue = Details:GetTextColor(instance, self) local textColor_Red, textColor_Green, textColor_Blue = self:GetTextColor(instance, "right")
bar.lineText2:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) bar.lineText2:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
bar.lineText3:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) bar.lineText3:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
bar.lineText4:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) bar.lineText4:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
+3 -4
View File
@@ -1372,15 +1372,14 @@ function healingClass:ToolTip_HealingDone (instancia, numero, barra, keydown)
--TOP Curados --TOP Curados
ActorSkillsContainer = self.targets ActorSkillsContainer = self.targets
for target_name, amount in pairs(ActorSkillsContainer) do for targetName, amount in pairs(ActorSkillsContainer) do
if (amount > 0) then if (amount > 0) then
--translate cyrillic alphabet to western alphabet by Vardex (https://github.com/Vardex May 22, 2019) --translate cyrillic alphabet to western alphabet by Vardex (https://github.com/Vardex May 22, 2019)
if (instancia.row_info.textL_translit_text) then if (instancia.row_info.textL_translit_text) then
target_name = Translit:Transliterate(target_name, "!") targetName = Translit:Transliterate(targetName, "!")
end end
tinsert(ActorHealingTargets, {target_name, amount, amount / ActorTotal * 100}) tinsert(ActorHealingTargets, {targetName, amount, amount / ActorTotal * 100})
end end
end end
_table_sort (ActorHealingTargets, _detalhes.Sort2) _table_sort (ActorHealingTargets, _detalhes.Sort2)
+59 -29
View File
@@ -574,55 +574,85 @@ function atributo_misc:ReportSingleDebuffUptimeLine (misc_actor, instance)
return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) return _detalhes:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true})
end end
---index[1] is the death log
---index[2] is the death time
---index[3] is the name of the player
---index[4] is the class of the player
---index[5] is the max health
---index[6] is the time of the fight as string
---@field death boolean
---@field last_cooldown table
---@field dead_at number --combat time when the player died
---@field spec number
---update a row in an instance (window) showing death logs ---update a row in an instance (window) showing death logs
---@param morte table ---@param deathTable table
---@param whichRowLine number ---@param whichRowLine number
---@param rankPosition number ---@param rankPosition number
---@param instance table ---@param instanceObject table
function atributo_misc:UpdateDeathRow(morte, whichRowLine, rankPosition, instance) --todo: change this function name function atributo_misc:UpdateDeathRow(deathTable, whichRowLine, rankPosition, instanceObject) --todo: change this function name
morte["dead"] = true local playerName, playerClass, deathTime, deathCombatTime, deathTimeString, playerMaxHealth, deathEvents, lastCooldown, spec = Details:UnpackDeathTable(deathTable)
local thisRow = instance.barras[whichRowLine]
deathTable["dead"] = true
local thisRow = instanceObject.barras[whichRowLine]
if (not thisRow) then if (not thisRow) then
print("DEBUG: problema com <instancia.esta_barra> "..whichRowLine.." "..rankPosition) print("DEBUG: problema com <instancia.esta_barra> "..whichRowLine.." "..rankPosition)
return return
end end
thisRow.minha_tabela = morte thisRow.minha_tabela = deathTable
morte.nome = morte[3] --void an issue while resizing the window deathTable.nome = playerName
morte.minha_barra = whichRowLine deathTable.minha_barra = whichRowLine
thisRow.colocacao = rankPosition thisRow.colocacao = rankPosition
if (not getmetatable(morte)) then if (not getmetatable(deathTable)) then
setmetatable(morte, {__call = RefreshBarraMorte}) setmetatable(deathTable, {__call = RefreshBarraMorte})
morte._custom = true deathTable._custom = true
end
local bUseCustomLeftText = instanceObject.row_info.textL_enable_custom_text
local actorObject = instanceObject:GetCombat():GetContainer(DETAILS_ATTRIBUTE_MISC):GetActor(playerName)
if (actorObject) then
actorObject:SetBarLeftText(thisRow, instanceObject, false, false, false, bUseCustomLeftText)
else
Details:SetBarLeftText(thisRow, instanceObject, false, false, false, bUseCustomLeftText)
end
if (instanceObject.row_info.textL_class_colors) then
local textColor_Red, textColor_Green, textColor_Blue = actorObject:GetTextColor(instanceObject, "left")
thisRow.lineText1:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) --the r, g, b color passed are the color used on the bar, so if the bar is not using class color, the text is painted with the fixed color for the bar
end
if (instanceObject.row_info.textR_class_colors) then
local textColor_Red, textColor_Green, textColor_Blue = actorObject:GetTextColor(instanceObject, "right")
thisRow.lineText4:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) --the r, g, b color passed are the color used on the bar, so if the bar is not using class color, the text is painted with the fixed color for the bar
end end
thisRow.lineText1:SetText(rankPosition .. ". " .. morte[3]:gsub(("%-.*"), ""))
thisRow.lineText2:SetText("") thisRow.lineText2:SetText("")
thisRow.lineText3:SetText("") thisRow.lineText3:SetText("")
thisRow.lineText4:SetText(morte[6]) thisRow.lineText4:SetText(deathTimeString)
local r, g, b, a = actorObject:GetBarColor()
actorObject:SetBarColors(thisRow, instanceObject, r, g, b, a)
thisRow:SetValue(100) thisRow:SetValue(100)
if (thisRow.hidden or thisRow.fading_in or thisRow.faded) then if (thisRow.hidden or thisRow.fading_in or thisRow.faded) then
Details.FadeHandler.Fader(thisRow, "out") Details.FadeHandler.Fader(thisRow, "out")
end end
--seta a cor da barra e a cor do texto caso eles esteja mostrando com a cor da classe if (instanceObject.row_info.use_spec_icons) then
local r, g, b, a = unpack(_detalhes.class_colors[morte[4]]) local nome = deathTable[3]
_detalhes:SetBarColors(thisRow, instance, r, g, b, a) local spec = instanceObject.showing (1, nome) and instanceObject.showing (1, nome).spec or (instanceObject.showing (2, nome) and instanceObject.showing (2, nome).spec)
if (instance.row_info.use_spec_icons) then
local nome = morte[3]
local spec = instance.showing (1, nome) and instance.showing (1, nome).spec or (instance.showing (2, nome) and instance.showing (2, nome).spec)
if (spec and spec ~= 0) then if (spec and spec ~= 0) then
thisRow.icone_classe:SetTexture(instance.row_info.spec_file) thisRow.icone_classe:SetTexture(instanceObject.row_info.spec_file)
thisRow.icone_classe:SetTexCoord(unpack(_detalhes.class_specs_coords[spec])) thisRow.icone_classe:SetTexCoord(unpack(_detalhes.class_specs_coords[spec]))
else else
if (CLASS_ICON_TCOORDS [morte[4]]) then if (CLASS_ICON_TCOORDS [deathTable[4]]) then
thisRow.icone_classe:SetTexture(instance.row_info.icon_file) thisRow.icone_classe:SetTexture(instanceObject.row_info.icon_file)
thisRow.icone_classe:SetTexCoord(unpack(CLASS_ICON_TCOORDS [morte[4]])) thisRow.icone_classe:SetTexCoord(unpack(CLASS_ICON_TCOORDS [deathTable[4]]))
else else
local texture, l, r, t, b = Details:GetUnknownClassIcon() local texture, l, r, t, b = Details:GetUnknownClassIcon()
thisRow.icone_classe:SetTexture(texture) thisRow.icone_classe:SetTexture(texture)
@@ -630,9 +660,9 @@ function atributo_misc:UpdateDeathRow(morte, whichRowLine, rankPosition, instanc
end end
end end
else else
if (CLASS_ICON_TCOORDS [morte[4]]) then if (CLASS_ICON_TCOORDS [deathTable[4]]) then
thisRow.icone_classe:SetTexture(instance.row_info.icon_file) thisRow.icone_classe:SetTexture(instanceObject.row_info.icon_file)
thisRow.icone_classe:SetTexCoord(unpack(CLASS_ICON_TCOORDS [morte[4]])) thisRow.icone_classe:SetTexCoord(unpack(CLASS_ICON_TCOORDS [deathTable[4]]))
else else
local texture, l, r, t, b = Details:GetUnknownClassIcon() local texture, l, r, t, b = Details:GetUnknownClassIcon()
thisRow.icone_classe:SetTexture(texture) thisRow.icone_classe:SetTexture(texture)
@@ -642,8 +672,8 @@ function atributo_misc:UpdateDeathRow(morte, whichRowLine, rankPosition, instanc
thisRow.icone_classe:SetVertexColor(1, 1, 1) thisRow.icone_classe:SetVertexColor(1, 1, 1)
if (thisRow.mouse_over and not instance.baseframe.isMoving) then --precisa atualizar o tooltip if (thisRow.mouse_over and not instanceObject.baseframe.isMoving) then --precisa atualizar o tooltip
gump:UpdateTooltip (whichRowLine, thisRow, instance) gump:UpdateTooltip (whichRowLine, thisRow, instanceObject)
end end
thisRow.lineText1:SetSize(thisRow:GetWidth() - thisRow.lineText4:GetStringWidth() - 20, 15) thisRow.lineText1:SetSize(thisRow:GetWidth() - thisRow.lineText4:GetStringWidth() - 20, 15)
+9 -9
View File
@@ -458,17 +458,17 @@
---@return {key1: unixtime, key2: spellid} ---@return {key1: unixtime, key2: spellid}
---@return specializationid specId ---@return specializationid specId
function Details:UnpackDeathTable(deathTable) function Details:UnpackDeathTable(deathTable)
local deathevents = deathTable[1] local deathEvents = deathTable[1]
local deathtime = deathTable[2] local deathTime = deathTable[2]
local playername = deathTable[3] local playerName = deathTable[3]
local playerclass = deathTable[4] local playerClass = deathTable[4]
local playermaxhealth = deathTable[5] local playerMaxHealth = deathTable[5]
local deathtimestring = deathTable[6] local deathTimeString = deathTable[6]
local lastcooldown = deathTable.last_cooldown local lastCooldown = deathTable.last_cooldown
local deathcombattime = deathTable.dead_at local deathCombatTime = deathTable.dead_at
local spec = deathTable.spec local spec = deathTable.spec
return playername, playerclass, deathtime, deathcombattime, deathtimestring, playermaxhealth, deathevents, lastcooldown, spec return playerName, playerClass, deathTime, deathCombatTime, deathTimeString, playerMaxHealth, deathEvents, lastCooldown, spec
end end
---get a random fraction number ---get a random fraction number
+95
View File
@@ -0,0 +1,95 @@
--old small window for the end of mythic plus runs
if (false and Details222.MythicPlus.Level and Details222.MythicPlus.Level < 28 and not Details.user_is_patreon_supporter) then
--create the panel
if (not mythicDungeonFrames.ReadyFrame) then
mythicDungeonFrames.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate")
local readyFrame = mythicDungeonFrames.ReadyFrame
local textColor = {1, 0.8196, 0, 1}
local textSize = 11
local roundedCornerTemplate = {
roundness = 6,
color = {.1, .1, .1, 0.98},
border_color = {.05, .05, .05, 0.834},
}
detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate)
local titleLabel = DetailsFramework:CreateLabel(readyFrame, "Details! Mythic Run Completed!", 12, "yellow")
titleLabel:SetPoint("top", readyFrame, "top", 0, -7)
titleLabel.textcolor = textColor
local closeButton = detailsFramework:CreateCloseButton(readyFrame, "$parentCloseButton")
closeButton:SetPoint("topright", readyFrame, "topright", -2, -2)
closeButton:SetScale(1.4)
closeButton:SetAlpha(0.823)
readyFrame:SetSize(255, 120)
readyFrame:SetPoint("center", UIParent, "center", 300, 0)
readyFrame:SetFrameStrata("LOW")
readyFrame:EnableMouse(true)
readyFrame:SetMovable(true)
--DetailsFramework:ApplyStandardBackdrop(readyFrame)
--DetailsFramework:CreateTitleBar (readyFrame, "Details! Mythic Run Completed!")
readyFrame:Hide()
--register to libwindow
local LibWindow = LibStub("LibWindow-1.1")
LibWindow.RegisterConfig(readyFrame, Details.mythic_plus.finished_run_frame)
LibWindow.RestorePosition(readyFrame)
LibWindow.MakeDraggable(readyFrame)
LibWindow.SavePosition(readyFrame)
--show button
---@type df_button
readyFrame.ShowChartButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, "Show Damage Graphic")
readyFrame.ShowChartButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
readyFrame.ShowChartButton:SetPoint("topleft", readyFrame, "topleft", 5, -30)
readyFrame.ShowChartButton:SetIcon([[Interface\AddOns\Details\images\icons2.png]], 16, 16, "overlay", {42/512, 75/512, 153/512, 187/512}, {.7, .7, .7, 1}, nil, 0, 0)
readyFrame.ShowChartButton.textcolor = textColor
--disable feature check box (dont show this again)
local on_switch_enable = function(self, _, value)
Details.mythic_plus.show_damage_graphic = not value
end
local notAgainSwitch, notAgainLabel = DetailsFramework:CreateSwitch(readyFrame, on_switch_enable, not Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, Loc ["STRING_MINITUTORIAL_BOOKMARK4"], DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft")
notAgainSwitch:ClearAllPoints()
notAgainLabel:SetPoint("left", notAgainSwitch, "right", 2, 0)
notAgainSwitch:SetPoint("bottomleft", readyFrame, "bottomleft", 5, 5)
notAgainSwitch:SetAsCheckBox()
notAgainLabel.textSize = textSize
local timeNotInCombatLabel = DetailsFramework:CreateLabel(readyFrame, "Time not in combat:", textSize, "orangered")
timeNotInCombatLabel:SetPoint("bottomleft", notAgainSwitch, "topleft", 0, 7)
local timeNotInCombatAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, "orangered")
timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0)
local elapsedTimeLabel = DetailsFramework:CreateLabel(readyFrame, "Run Time:", textSize, textColor)
elapsedTimeLabel:SetPoint("bottomleft", timeNotInCombatLabel, "topleft", 0, 5)
local elapsedTimeAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, textColor)
elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0)
readyFrame.TimeNotInCombatAmountLabel = timeNotInCombatAmount
readyFrame.ElapsedTimeAmountLabel = elapsedTimeAmount
end
mythicDungeonFrames.ReadyFrame:Show()
--update the run time and time not in combat
local elapsedTime = Details222.MythicPlus.time or 1507
mythicDungeonFrames.ReadyFrame.ElapsedTimeAmountLabel.text = DetailsFramework:IntegerToTimer(elapsedTime)
local overallMythicDungeonCombat = Details:GetCurrentCombat()
if (overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
local combatTime = overallMythicDungeonCombat:GetCombatTime()
local notInCombat = elapsedTime - combatTime
mythicDungeonFrames.ReadyFrame.TimeNotInCombatAmountLabel.text = DetailsFramework:IntegerToTimer(notInCombat) .. " (" .. math.floor(notInCombat / elapsedTime * 100) .. "%)"
end
return
end
+60 -100
View File
@@ -20,8 +20,8 @@ local mythicDungeonCharts = Details222.MythicPlus.Charts.Listener
local mythicDungeonFrames = Details222.MythicPlus.Frames local mythicDungeonFrames = Details222.MythicPlus.Frames
--debug --debug
--_G.DetailsMythicDungeonChartHandler = mythicDungeonCharts _G.MythicDungeonFrames = mythicDungeonFrames
--/run _G.MythicDungeonFrames.ShowEndOfMythicPlusPanel(true)
local createPlayerBanner = function(parent, name) local createPlayerBanner = function(parent, name)
local template = "ChallengeModeBannerPartyMemberTemplate" local template = "ChallengeModeBannerPartyMemberTemplate"
@@ -336,100 +336,6 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug)
Details222.MythicPlus.Level = Details222.MythicPlus.Level or 2 Details222.MythicPlus.Level = Details222.MythicPlus.Level or 2
end end
--feature under development
if (false and Details222.MythicPlus.Level and Details222.MythicPlus.Level < 28 and not Details.user_is_patreon_supporter) then
--create the panel
if (not mythicDungeonFrames.ReadyFrame) then
mythicDungeonFrames.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate")
local readyFrame = mythicDungeonFrames.ReadyFrame
local textColor = {1, 0.8196, 0, 1}
local textSize = 11
local roundedCornerTemplate = {
roundness = 6,
color = {.1, .1, .1, 0.98},
border_color = {.05, .05, .05, 0.834},
}
detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate)
local titleLabel = DetailsFramework:CreateLabel(readyFrame, "Details! Mythic Run Completed!", 12, "yellow")
titleLabel:SetPoint("top", readyFrame, "top", 0, -7)
titleLabel.textcolor = textColor
local closeButton = detailsFramework:CreateCloseButton(readyFrame, "$parentCloseButton")
closeButton:SetPoint("topright", readyFrame, "topright", -2, -2)
closeButton:SetScale(1.4)
closeButton:SetAlpha(0.823)
readyFrame:SetSize(255, 120)
readyFrame:SetPoint("center", UIParent, "center", 300, 0)
readyFrame:SetFrameStrata("LOW")
readyFrame:EnableMouse(true)
readyFrame:SetMovable(true)
--DetailsFramework:ApplyStandardBackdrop(readyFrame)
--DetailsFramework:CreateTitleBar (readyFrame, "Details! Mythic Run Completed!")
readyFrame:Hide()
--register to libwindow
local LibWindow = LibStub("LibWindow-1.1")
LibWindow.RegisterConfig(readyFrame, Details.mythic_plus.mythicrun_chart_frame_ready)
LibWindow.RestorePosition(readyFrame)
LibWindow.MakeDraggable(readyFrame)
LibWindow.SavePosition(readyFrame)
--show button
---@type df_button
readyFrame.ShowChartButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, "Show Damage Graphic")
readyFrame.ShowChartButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
readyFrame.ShowChartButton:SetPoint("topleft", readyFrame, "topleft", 5, -30)
readyFrame.ShowChartButton:SetIcon([[Interface\AddOns\Details\images\icons2.png]], 16, 16, "overlay", {42/512, 75/512, 153/512, 187/512}, {.7, .7, .7, 1}, nil, 0, 0)
readyFrame.ShowChartButton.textcolor = textColor
--disable feature check box (dont show this again)
local on_switch_enable = function(self, _, value)
Details.mythic_plus.show_damage_graphic = not value
end
local notAgainSwitch, notAgainLabel = DetailsFramework:CreateSwitch(readyFrame, on_switch_enable, not Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, Loc ["STRING_MINITUTORIAL_BOOKMARK4"], DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft")
notAgainSwitch:ClearAllPoints()
notAgainLabel:SetPoint("left", notAgainSwitch, "right", 2, 0)
notAgainSwitch:SetPoint("bottomleft", readyFrame, "bottomleft", 5, 5)
notAgainSwitch:SetAsCheckBox()
notAgainLabel.textSize = textSize
local timeNotInCombatLabel = DetailsFramework:CreateLabel(readyFrame, "Time not in combat:", textSize, "orangered")
timeNotInCombatLabel:SetPoint("bottomleft", notAgainSwitch, "topleft", 0, 7)
local timeNotInCombatAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, "orangered")
timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0)
local elapsedTimeLabel = DetailsFramework:CreateLabel(readyFrame, "Run Time:", textSize, textColor)
elapsedTimeLabel:SetPoint("bottomleft", timeNotInCombatLabel, "topleft", 0, 5)
local elapsedTimeAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, textColor)
elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0)
readyFrame.TimeNotInCombatAmountLabel = timeNotInCombatAmount
readyFrame.ElapsedTimeAmountLabel = elapsedTimeAmount
end
mythicDungeonFrames.ReadyFrame:Show()
--update the run time and time not in combat
local elapsedTime = Details222.MythicPlus.time or 1507
mythicDungeonFrames.ReadyFrame.ElapsedTimeAmountLabel.text = DetailsFramework:IntegerToTimer(elapsedTime)
local overallMythicDungeonCombat = Details:GetCurrentCombat()
if (overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
local combatTime = overallMythicDungeonCombat:GetCombatTime()
local notInCombat = elapsedTime - combatTime
mythicDungeonFrames.ReadyFrame.TimeNotInCombatAmountLabel.text = DetailsFramework:IntegerToTimer(notInCombat) .. " (" .. math.floor(notInCombat / elapsedTime * 100) .. "%)"
end
return
end
--create the panel --create the panel
if (not mythicDungeonFrames.ReadyFrame) then if (not mythicDungeonFrames.ReadyFrame) then
mythicDungeonFrames.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate") mythicDungeonFrames.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate")
@@ -457,7 +363,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug)
closeButton:SetAlpha(0.823) closeButton:SetAlpha(0.823)
readyFrame:SetSize(355, 390) readyFrame:SetSize(355, 390)
readyFrame:SetPoint("center", UIParent, "center", 300, 0) readyFrame:SetPoint("center", UIParent, "center", 350, 0)
readyFrame:SetFrameStrata("LOW") readyFrame:SetFrameStrata("LOW")
readyFrame:EnableMouse(true) readyFrame:EnableMouse(true)
readyFrame:SetMovable(true) readyFrame:SetMovable(true)
@@ -465,11 +371,60 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug)
--register to libwindow --register to libwindow
local LibWindow = LibStub("LibWindow-1.1") local LibWindow = LibStub("LibWindow-1.1")
LibWindow.RegisterConfig(readyFrame, Details.mythic_plus.mythicrun_chart_frame_ready) LibWindow.RegisterConfig(readyFrame, Details.mythic_plus.finished_run_frame)
LibWindow.RestorePosition(readyFrame) LibWindow.RestorePosition(readyFrame)
LibWindow.MakeDraggable(readyFrame) LibWindow.MakeDraggable(readyFrame)
LibWindow.SavePosition(readyFrame) LibWindow.SavePosition(readyFrame)
--waiting for loot label
local waitingForLootLabel = DetailsFramework:CreateLabel(readyFrame, "Waiting for loot", 12, "silver")
waitingForLootLabel:SetPoint("bottom", readyFrame, "bottom", 0, 54)
waitingForLootLabel:Hide()
local waitingForLootDotsAnimationLabel = DetailsFramework:CreateLabel(readyFrame, "...", 12, "silver")
waitingForLootDotsAnimationLabel:SetPoint("left", waitingForLootLabel, "right", 0, 0)
waitingForLootDotsAnimationLabel:Hide()
--make a text dot animation, which will show no dots at start and then "." then ".." then "..." and back to "" and so on
function readyFrame.StartTextDotAnimation()
--update the Waiting for Loot labels
waitingForLootLabel:Show()
waitingForLootDotsAnimationLabel:Show()
local dots = waitingForLootDotsAnimationLabel
local dotsCount = 0
local maxDots = 3
local maxLoops = 24
local dotsTimer = C_Timer.NewTicker(0.5, function()
dotsCount = dotsCount + 1
if (dotsCount > maxDots) then
dotsCount = 0
end
local dotsText = ""
for i = 1, dotsCount do
dotsText = dotsText .. "."
end
dots:SetText(dotsText)
end, maxLoops)
waitingForLootDotsAnimationLabel.dotsTimer = dotsTimer
end
function readyFrame.StopTextDotAnimation()
waitingForLootLabel:Hide()
waitingForLootDotsAnimationLabel:Hide()
if (waitingForLootDotsAnimationLabel.dotsTimer) then
waitingForLootDotsAnimationLabel.dotsTimer:Cancel()
end
end
readyFrame:SetScript("OnHide", function(self)
readyFrame.StopTextDotAnimation()
end)
--warning footer --warning footer
local warningFooter = DetailsFramework:CreateLabel(readyFrame, "Under development.", 9, "yellow") local warningFooter = DetailsFramework:CreateLabel(readyFrame, "Under development.", 9, "yellow")
warningFooter:SetPoint("bottom", readyFrame, "bottom", 0, 20) warningFooter:SetPoint("bottom", readyFrame, "bottom", 0, 20)
@@ -590,13 +545,14 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug)
--print("equip loc:", itemEquipLoc) --print("equip loc:", itemEquipLoc)
if (effectiveILvl > 300) then --avoid showing loot that isn't items if (effectiveILvl > 300) then --avoid showing loot that isn't items
local rarityColor = ITEM_QUALITY_COLORS[itemQuality] local rarityColor = ITEM_QUALITY_COLORS[itemQuality]
lootSquare.LootIconBorder:SetVertexColor(rarityColor.r, rarityColor.g, rarityColor.b, 1) lootSquare.LootIconBorder:SetVertexColor(rarityColor.r, rarityColor.g, rarityColor.b, 1)
lootSquare.LootIcon:SetTexture(GetItemIcon(itemID)) lootSquare.LootIcon:SetTexture(GetItemIcon(itemID))
lootSquare.LootItemLevel:SetText(effectiveILvl or "0") lootSquare.LootItemLevel:SetText(effectiveILvl or "0")
readyFrame.StopTextDotAnimation()
--print("loot info:", itemLink, effectiveILvl, itemQuality) --print("loot info:", itemLink, effectiveILvl, itemQuality)
lootSquare:Show() lootSquare:Show()
end end
@@ -637,11 +593,15 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug)
readyFrame.YouBeatTheTimerLabel = youBeatTheTimerLabel readyFrame.YouBeatTheTimerLabel = youBeatTheTimerLabel
readyFrame.KeystoneUpgradeLabel = keystoneUpgradeLabel readyFrame.KeystoneUpgradeLabel = keystoneUpgradeLabel
readyFrame.RantingLabel = rantingLabel readyFrame.RantingLabel = rantingLabel
end end --end of creating of the readyFrame
--mythic+ finished, showing the readyFrame for the user
local readyFrame = mythicDungeonFrames.ReadyFrame local readyFrame = mythicDungeonFrames.ReadyFrame
readyFrame:Show() readyFrame:Show()
readyFrame.StartTextDotAnimation()
for i = 1, #readyFrame.PlayerBanners do for i = 1, #readyFrame.PlayerBanners do
--hide the lootSquare --hide the lootSquare
readyFrame.PlayerBanners[i].LootSquare:Hide() readyFrame.PlayerBanners[i].LootSquare:Hide()
+2 -2
View File
@@ -1606,7 +1606,7 @@ local default_global_data = {
last_mythicrun_chart = {}, last_mythicrun_chart = {},
mythicrun_chart_frame = {}, mythicrun_chart_frame = {},
mythicrun_chart_frame_minimized = {}, mythicrun_chart_frame_minimized = {},
mythicrun_chart_frame_ready = {}, finished_run_frame = {}, --end of mythic+ panel
mythicrun_time_type = 1, --1: combat time (the amount of time the player is in combat) 2: run time (the amount of time it took to finish the mythic+ run) mythicrun_time_type = 1, --1: combat time (the amount of time the player is in combat) 2: run time (the amount of time it took to finish the mythic+ run)
}, --implementar esse time_type quando estiver dando refresh na janela }, --implementar esse time_type quando estiver dando refresh na janela
@@ -2003,7 +2003,7 @@ function Details:ImportProfile (profileString, newProfileName, bImportAutoRunCod
mythicPlusSettings.last_mythicrun_chart = {} mythicPlusSettings.last_mythicrun_chart = {}
mythicPlusSettings.mythicrun_chart_frame = {} mythicPlusSettings.mythicrun_chart_frame = {}
mythicPlusSettings.mythicrun_chart_frame_minimized = {} mythicPlusSettings.mythicrun_chart_frame_minimized = {}
mythicPlusSettings.mythicrun_chart_frame_ready = {} mythicPlusSettings.finished_run_frame = {}
--make the max amount of segments be 30 --make the max amount of segments be 30
Details.segments_amount = 40 Details.segments_amount = 40