Update Libraries
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
--[[ $Id: CallbackHandler-1.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 7
|
||||
--[[ $Id: CallbackHandler-1.0.lua 1298 2022-12-12 15:10:10Z nevcairiel $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 8
|
||||
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not CallbackHandler then return end -- No upgrade needed
|
||||
@@ -7,21 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed
|
||||
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
|
||||
|
||||
-- Lua APIs
|
||||
local error = error
|
||||
local securecallfunction, error = securecallfunction, error
|
||||
local setmetatable, rawget = setmetatable, rawget
|
||||
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
|
||||
|
||||
local xpcall = xpcall
|
||||
|
||||
local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function Dispatch(handlers, ...)
|
||||
local index, method = next(handlers)
|
||||
if not method then return end
|
||||
repeat
|
||||
xpcall(method, errorhandler, ...)
|
||||
securecallfunction(method, ...)
|
||||
index, method = next(handlers, index)
|
||||
until not method
|
||||
end
|
||||
|
||||
@@ -137,6 +137,11 @@
|
||||
---@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 GetColorBrightness fun(self:table, r:number, g:number, b:number) : number return the brightness of a color from zero to one
|
||||
---@field GetColorHue fun(self:table, r:number, g:number, b:number) : number return the hue of a color from red to blue to green to yellow and back to red
|
||||
---@field IsHtmlColor fun(self:table, colorName:any) : unknown return true if DF.alias_text_colors has the colorName as a key
|
||||
---@field CreateColorTable fun(self:table, r:number, g:number, b:number, a:number) : table return a table with {r, g, b, a}
|
||||
---@field FormatColor fun(self:table, newFormat:string, r:number|string, g:number?, b:number?, a:number?, decimalsAmount:number?) : string|table|number|nil, number|nil, number|nil, number|nil takes in a color in one format and converts it to another specified format.
|
||||
---@field
|
||||
---@field
|
||||
|
||||
|
||||
+45
-2
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
local dversion = 495
|
||||
local dversion = 496
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary(major, minor)
|
||||
|
||||
@@ -2025,7 +2025,16 @@ end
|
||||
IsColorTable = true,
|
||||
}
|
||||
|
||||
---convert a any format of color to any other format of color
|
||||
--takes in a color in one format and converts it to another specified format.
|
||||
--here are the parameters it accepts:
|
||||
--newFormat (string): The format to convert the color to. It can be one of the following: "commastring", "tablestring", "table", "tablemembers", "numbers", "hex".
|
||||
--r (number|string): The red component of the color or a string representing the color.
|
||||
--g (number|nil): The green component of the color. This is optional if r is a string.
|
||||
--b (number|nil): The blue component of the color. This is optional if r is a string.
|
||||
--a (number|nil): The alpha component of the color. This is optional and defaults to 1 if not provided.
|
||||
--decimalsAmount (number|nil): The number of decimal places to round the color components to. This is optional and defaults to 4 if not provided.
|
||||
--The function returns the color in the new format. The return type depends on the newFormat parameter. It can be a string, a table, or four separate number values (for the "numbers" format).
|
||||
--For the "hex" format, it returns a string representing the color in hexadecimal format.
|
||||
---@param newFormat string
|
||||
---@param r number|string
|
||||
---@param g number|nil
|
||||
@@ -2085,6 +2094,40 @@ end
|
||||
return DF.alias_text_colors[colorName]
|
||||
end
|
||||
|
||||
---return the brightness of a color from zero to one
|
||||
---@param r number
|
||||
---@param g number
|
||||
---@param b number
|
||||
---@return number
|
||||
function DF:GetColorBrightness(r, g, b)
|
||||
r, g, b = DF:ParseColors(r, g, b)
|
||||
return 0.2134 * r + 0.7152 * g + 0.0721 * b
|
||||
end
|
||||
|
||||
---return the hue of a color from red to blue to green to yellow and back to red
|
||||
---@param r number
|
||||
---@param g number
|
||||
---@param b number
|
||||
---@return number
|
||||
function DF:GetColorHue(r, g, b)
|
||||
r, g, b = DF:ParseColors(r, g, b)
|
||||
|
||||
local minValue, maxValue = math.min(r, g, b), math.max(r, g, b)
|
||||
|
||||
if (maxValue == minValue) then
|
||||
return 0
|
||||
|
||||
elseif (maxValue == r) then
|
||||
return (g - b) / (maxValue - minValue) % 6
|
||||
|
||||
elseif (maxValue == g) then
|
||||
return (b - r) / (maxValue - minValue) + 2
|
||||
|
||||
else
|
||||
return (r - g) / (maxValue - minValue) + 4
|
||||
end
|
||||
end
|
||||
|
||||
---get the values passed and return r g b a color values
|
||||
---the function accept color name, tables with r g b a members, indexed tables with r g b a values, numbers, html hex color
|
||||
---@param red any
|
||||
|
||||
@@ -241,6 +241,8 @@ function detailsFramework.Schedules.LazyExecute(callback, payload, maxIterations
|
||||
return payload
|
||||
end
|
||||
|
||||
--Schedules a callback function to be executed after a specified time delay.
|
||||
--It uniquely identifies each scheduled task by an ID, cancel and replace any existing schedules with the same ID.
|
||||
function detailsFramework.Schedules.AfterById(time, callback, id, ...)
|
||||
if (not detailsFramework.Schedules.ExecuteTimerTable) then
|
||||
detailsFramework.Schedules.ExecuteTimerTable = {}
|
||||
|
||||
@@ -43,7 +43,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
|
||||
end
|
||||
|
||||
local major = "LibOpenRaid-1.0"
|
||||
local CONST_LIB_VERSION = 117
|
||||
local CONST_LIB_VERSION = 118
|
||||
|
||||
if (LIB_OPEN_RAID_MAX_VERSION) then
|
||||
if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then
|
||||
@@ -508,7 +508,7 @@ end
|
||||
LIB_OPEN_RAID_COMM_SCHEDULER = newTickerHandle
|
||||
end
|
||||
|
||||
function openRaidLib.commHandler.SendCommData(data, flags)
|
||||
function openRaidLib.commHandler.SendCommData(data, flags, bIgnoreQueue)
|
||||
local LibDeflate = LibStub:GetLibrary("LibDeflate")
|
||||
local dataCompressed = LibDeflate:CompressDeflate(data, {level = 9})
|
||||
local dataEncoded = LibDeflate:EncodeForWoWAddonChannel(dataCompressed)
|
||||
@@ -2665,7 +2665,8 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNREQUEST_PREFIX, openRaid
|
||||
|
||||
function openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty()
|
||||
local dataToSend = getKeystoneInfoToComm()
|
||||
openRaidLib.commHandler.SendCommData(dataToSend, CONST_COMM_SENDTO_PARTY)
|
||||
local bIgnoreQueue = true
|
||||
openRaidLib.commHandler.SendCommData(dataToSend, CONST_COMM_SENDTO_PARTY, bIgnoreQueue)
|
||||
diagnosticComm("SendPlayerKeystoneInfoToParty| " .. dataToSend) --debug
|
||||
end
|
||||
|
||||
@@ -2686,8 +2687,9 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNREQUEST_PREFIX, openRaid
|
||||
local keystoneInfo = openRaidLib.KeystoneInfoManager.GetKeystoneInfo(UnitName("player"), true)
|
||||
openRaidLib.KeystoneInfoManager.UpdatePlayerKeystoneInfo(keystoneInfo)
|
||||
|
||||
if (IsInGroup() and not IsInRaid()) then
|
||||
openRaidLib.Schedules.NewUniqueTimer(0.1, openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty, "KeystoneInfoManager", "sendKeystoneInfoToParty_Schedule")
|
||||
local _, instanceType = GetInstanceInfo()
|
||||
if (instanceType == "party") then
|
||||
openRaidLib.Schedules.NewUniqueTimer(0.01, openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty, "KeystoneInfoManager", "sendKeystoneInfoToParty_Schedule")
|
||||
end
|
||||
|
||||
if (IsInGuild()) then
|
||||
|
||||
@@ -7,24 +7,24 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||
LibStub = LibStub or {libs = {}, minors = {} }
|
||||
_G[LIBSTUB_MAJOR] = LibStub
|
||||
LibStub.minor = LIBSTUB_MINOR
|
||||
|
||||
|
||||
function LibStub:NewLibrary(major, minor)
|
||||
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
|
||||
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
|
||||
|
||||
minor = assert(tonumber(string.match(minor, "%d+")), "Minor version must either be a number or contain a number.")
|
||||
|
||||
local oldminor = self.minors[major]
|
||||
if oldminor and oldminor >= minor then return nil end
|
||||
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
|
||||
return self.libs[major], oldminor
|
||||
end
|
||||
|
||||
|
||||
function LibStub:GetLibrary(major, silent)
|
||||
if not self.libs[major] and not silent then
|
||||
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
|
||||
end
|
||||
return self.libs[major], self.minors[major]
|
||||
end
|
||||
|
||||
|
||||
function LibStub:IterateLibraries() return pairs(self.libs) end
|
||||
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user