Skip to content

Commit

Permalink
Added atonement update to all all players to see on their buff uptime
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Nov 6, 2023
1 parent d11f8a1 commit 466c67a
Show file tree
Hide file tree
Showing 13 changed files with 2,215 additions and 1,207 deletions.
1,547 changes: 1,547 additions & 0 deletions Libs/DF/buildmenu.lua

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Libs/DF/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,11 @@ function ButtonMetaFunctions:SetTemplate(template)
end

if (template.width) then
self:SetWidth(template.width)
PixelUtil.SetWidth(self.button, template.width)
end

if (template.height) then
self:SetHeight(template.height)
PixelUtil.SetHeight(self.button, template.height)
end

if (template.backdrop) then
Expand Down Expand Up @@ -928,7 +928,7 @@ end
detailsFramework:Mixin(buttonObject.button, detailsFramework.WidgetFunctions)

createButtonWidgets(buttonObject.button)
buttonObject.button:SetSize(width or 100, height or 20)
PixelUtil.SetSize(buttonObject.button, width or 100, height or 20)
buttonObject.widget = buttonObject.button
buttonObject.button.MyObject = buttonObject

Expand Down Expand Up @@ -964,8 +964,8 @@ end
if (shortMethod == false) then --if is false, do not use auto resize
--do nothing
elseif (not shortMethod) then --if the value is omitted, use the default resize
local new_width = textWidth + 15
buttonObject.button:SetWidth(new_width)
local newWidth = textWidth + 15
PixelUtil.SetWidth(buttonObject.button, newWidth)

elseif (shortMethod == 1) then
local loop = true
Expand Down
27 changes: 20 additions & 7 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@

---@class df_table_functions
---@field find fun(tbl:table, value:any) : number? find the index of a value in a array
---@field addunique fun(tbl:table, value:any) : boolean add a value to an array if it doesn't exist yet
---@field reverse fun(tbl:table) reverse the order of an array
---@field append fun(tbl1:table, tbl2:table) append the array of table2 to table1
---@field duplicate fun(tblReceiving:table, tblGiving:table) copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, keys pointing to a UIObject are preserved
---@field copy fun(tblReceiving:table, tblGiving:table) copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, threat UIObjects as regular tables
---@field deploy fun(tblReceiving:table, tblGiving:table) copy keys/values that does exist on tblGiving but not in tblReceiving
---@field copytocompress fun(tblReceiving:table, tblGiving:table) copy the values from table2 to table1 overwriting existing values, ignores __index, functions and tables with a 'GetObjectType' key
---@field addunique fun(tbl:table, index:any, value:any) : boolean add a value to an array if it doesn't exist yet, if the index is omitted the value will be added to the end of the array
---@field reverse fun(tbl:table) : table reverse the order of an array
---@field append fun(tbl1:table, tbl2:table) : table append the array of table2 to table1
---@field duplicate fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, keys pointing to a UIObject are preserved
---@field copy fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, threat UIObjects as regular tables
---@field deploy fun(tblReceiving:table, tblGiving:table) : table copy keys/values that does exist on tblGiving but not in tblReceiving
---@field copytocompress fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index, functions and tables with a 'GetObjectType' key
---@field removeduplicate fun(tbl1:table, tbl2:table) remove the keys from table1 which also exists in table2 with the same value
---@field getfrompath fun(tbl:table, path:string) : any get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c
---@field setfrompath fun(tbl:table, path:string, value:any) : boolean set the value of a table using a path, e.g. setfrompath(tbl, "a.b.c", 10) is the same as tbl.a.b.c = 10
---@field dump fun(tbl:table) : string dump a table to a string

---@class df_language : table
Expand Down Expand Up @@ -51,9 +53,12 @@
---@field Language df_language
---@field KeybindMixin df_keybindmixin
---@field ScriptHookMixin df_scripthookmixin
---@field EditorMixin df_editormixin
---@field ClassCache {ID:number, Name:string, FileString:string, Texture:string, TexCoord:number[]}[] only available after calling GetClassList()
---@field Math df_math
---@field FontOutlineFlags {key1:outline, key2:string}[]
---@field table df_table_functions
---@field AnchorPoints string[]
---@field ClassFileNameToIndex table<string, number> engClass -> classIndex
---@field LoadSpellCache fun(self:table, hashMap:table, indexTable:table, allSpellsSameName:table) : hashMap:table, indexTable:table, allSpellsSameName:table load all spells in the game and add them into the passed tables
---@field UnloadSpellCache fun(self:table) wipe the table contents filled with LoadSpellCache()
Expand Down Expand Up @@ -83,8 +88,10 @@
---@field SetButtonTexture fun(self:table, button:button|df_button, texture:atlasname|texturepath|textureid)
---@field CreateFadeAnimation fun(self:table, UIObject:uiobject, fadeInTime:number?, fadeOutTime:number?, fadeInAlpha:number?, fadeOutAlpha:number?)
---@field SetFontSize fun(self:table, fontstring:fontstring, size:number)
---@field GetFontSize fun(self:table, fontstring:fontstring) : number return the font size of the fontstring
---@field SetFontColor fun(self:table, fontstring:fontstring, red:any, green:number?, blue:number?, alpha:number?)
---@field SetFontFace fun(self:table, fontstring:fontstring, font:string)
---@field GetFontFace fun(self:table, fontstring:fontstring) : string return the font face of the fontstring
---@field SetFontShadow fun(self:table, fontstring:fontstring, red:any, green:number?, blue:number?, alpha:number?, offsetX:number?, offsetY:number?)
---@field SetFontOutline fun(self:table, fontstring:fontstring, outline:fontflags)
---@field RemoveRealmName fun(self:table, name:string) : string, number remove the realm name from the player name, must be in the format of "name-realm"
Expand All @@ -101,6 +108,9 @@
---@field ApplyStandardBackdrop fun(self:table, frame:frame, bUseSolidColor:boolean?, alphaScale:number?)
---@field CreateLabel fun(self:table, parent:frame, text:string, size:number?, color:any?, font:string?, member:string?, name:string?, layer:drawlayer?) : df_label
---@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 CreateColorDropDown 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 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 GetAvailableSpells fun(self:table) : table<spellid, boolean>
Expand All @@ -121,6 +131,9 @@
---@field CreateScrollBox fun(self:table, parent:frame, name:string, refreshFunc:function, data:table, width:number, height:number, lineAmount:number, lineHeight:number, createLineFunc:function?, autoAmount:boolean?, noScroll:boolean?, noBackdrop:boolean?) : df_scrollbox
---@field CreateAuraScrollBox fun(self:table, parent:frame, name:string?, data:table?, onRemoveCallback:function?, options:table?) : df_aurascrollbox
---@field CreateGridScrollBox fun(self:table, parent:frame, name:string?, refreshFunc:function, data:table?, createColumnFrameFunc:function, options:table?) : df_gridscrollbox
---@field CreateCanvasScrollBox fun(self:table, parent:frame, child:frame?, name:string?, options:table?) : df_canvasscrollbox
---@field GetSizeFromPercent fun(self:table, uiObject:uiobject, percent:number) : number get the min size of a uiObject and multiply it by the percent passed
---@field BuildMenu fun(self:table, parent:frame, menuOptions:df_menu_table[], xOffset:number?, yOffset:number?, height:number?, useColon:boolean?, textTemplate:table?, dropdownTemplate:table?, switchTemplate:table?, switchIsCheckbox:boolean?, sliderTemplate:table?, buttonTemplate:table?, valueChangeHook:function?)
---@field BuildMenuVolatile fun(self:table, parent:frame, menuOptions:df_menu_table[], xOffset:number?, yOffset:number?, height:number?, useColon:boolean?, textTemplate:table?, dropdownTemplate:table?, switchTemplate:table?, switchIsCheckbox:boolean?, sliderTemplate:table?, buttonTemplate:table?, valueChangeHook:function?)
---@field
---@field
120 changes: 116 additions & 4 deletions Libs/DF/dropdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,10 @@ end
function DF:BuildDropDownFontList(onClick, icon, iconTexcoord, iconSize)
local fontTable = {}

if (type(iconSize) ~= "table") then
iconSize = {iconSize or 16, iconSize or 16}
end

local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
for name, fontPath in pairs(SharedMedia:HashTable("font")) do
fontTable[#fontTable+1] = {value = name, label = name, onclick = onClick, icon = icon, iconsize = iconSize, texcoord = iconTexcoord, font = fontPath, descfont = "abcdefg ABCDEFG"}
Expand All @@ -1006,10 +1010,10 @@ function DropDownMetaFunctions:SetTemplate(template)
self.template = template

if (template.width) then
self:SetWidth(template.width)
PixelUtil.SetWidth(self.dropdown, template.width)
end
if (template.height) then
self:SetHeight(template.height)
PixelUtil.SetWidth(self.dropdown, template.height)
end

if (template.backdrop) then
Expand Down Expand Up @@ -1092,7 +1096,116 @@ end
---@field
---@field

---return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns
---@param callback function
---@return function
function DF:CreateFontListGenerator(callback)
return function() return DF:BuildDropDownFontList(callback, [[Interface\AnimCreate\AnimCreateIcons]], {0, 32/128, 64/128, 96/128}, 16) end
end

local colorGeneratorStatusBarTexture = [[Interface\Tooltips\UI-Tooltip-Background]]
local colorGeneratorStatusBarColor = {.1, .1, .1, .8}
local colorGeneratorNoColor = {0, 0, 0, 0}

function DF:CreateColorListGenerator(callback)
local newGenerator = function()
local dropdownOptions = {}

for colorName, colorTable in pairs(DF:GetDefaultColorList()) do
table.insert(dropdownOptions, {
label = colorName,
value = colorTable,
color = colorTable,
statusbar = colorGeneratorStatusBarTexture,
statusbarcolor = colorGeneratorStatusBarColor,
onclick = callback
})
end

table.insert(dropdownOptions, 1, {
label = "no color",
value = "blank",
color = colorGeneratorNoColor,
statusbar = colorGeneratorStatusBarTexture,
statusbarcolor = colorGeneratorStatusBarColor,
onclick = callback
})

return dropdownOptions
end

return newGenerator
end

function DF:CreateOutlineListGenerator(callback)
local newGenerator = function()
local dropdownOptions = {}

for i, outlineInfo in ipairs(DF.FontOutlineFlags) do
local outlineName, outlineLoc = unpack(outlineInfo)
table.insert(dropdownOptions, {
label = outlineLoc,
value = outlineName,
onclick = callback
})
end

return dropdownOptions
end

return newGenerator
end

function DF:CreateAnchorPointListGenerator(callback)
local newGenerator = function()
local dropdownOptions = {}

for i, pointName in pairs(DF.AnchorPoints) do
table.insert(dropdownOptions, {
label = pointName,
value = i,
onclick = callback
})
end

return dropdownOptions
end

return newGenerator
end

---create a dropdown object with a list of fonts
---@param parent frame
---@param callback function
---@param default any
---@param width number?
---@param height number?
---@param member string?
---@param name string?
---@param template table?
function DF:CreateFontDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateFontListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end

function DF:CreateColorDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateColorListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end

function DF:CreateOutlineDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateOutlineListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end

function DF:CreateAnchorPointDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateAnchorPointListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end

---create a dropdown object
---@param parent frame
Expand Down Expand Up @@ -1144,8 +1257,7 @@ function DF:NewDropDown(parent, container, name, member, width, height, func, de
end

dropDownObject.dropdown = DF:CreateNewDropdownFrame(parent, name)
dropDownObject.dropdown:SetWidth(width)
dropDownObject.dropdown:SetHeight(height)
PixelUtil.SetSize(dropDownObject.dropdown, width, height)

dropDownObject.container = container
dropDownObject.widget = dropDownObject.dropdown
Expand Down
Loading

0 comments on commit 466c67a

Please sign in to comment.