Libraries Update

This commit is contained in:
Tercio Jose
2023-07-04 18:23:57 -03:00
parent 185d27ea9c
commit b5f302ae03
10 changed files with 145 additions and 20 deletions
+106
View File
@@ -0,0 +1,106 @@
local detailsFramework = _G.DetailsFramework
if (not detailsFramework or not DetailsFrameworkCanLoad) then
return
end
local CreateFrame = CreateFrame
---@class df_roundedpanel : frame, blz_backdrop, df_optionsmixin, df_titlebar
---@field cornerTextures texture[]
---@field edgeTextures texture[]
---@field Constructor fun(self:df_roundedpanel)
---@class blz_backdrop : table
---@field TopLeftCorner texture
---@field TopRightCorner texture
---@field BottomLeftCorner texture
---@field BottomRightCorner texture
---@field TopEdge texture
---@field BottomEdge texture
---@field LeftEdge texture
---@field RightEdge texture
---@field Center texture
detailsFramework.RoundedCornerPanelMixin = {
Constructor = function(self)
self.cornerTextures = {}
self.edgeTextures = {}
local red, green, blue, alpha = detailsFramework:GetDefaultBackdropColor()
self:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
self:SetBackdropColor(red, green, blue, alpha * 0.95)
self:SetBackdropBorderColor(0, 0, 0, 0.95)
self.__background = self:CreateTexture(nil, "border", nil, -6)
self.__background:SetColorTexture(red, green, blue)
self.__background:SetAllPoints()
self:SetSize(self.options.width, self.options.height)
if (self.options.use_titlebar) then
detailsFramework:CreateTitleBar(self)
self:SetTitle(self.options.title)
end
if (self.options.use_scalebar) then
detailsFramework:CreateScaleBar(self, self.options)
self:SetScale(self.options.scale)
end
--fill the corner and edge textures table
for index, cornerName in ipairs({"TopLeftCorner", "TopRightCorner", "BottomLeftCorner", "BottomRightCorner"}) do
local thisTexture = self[cornerName]
self.cornerTextures[cornerName] = thisTexture
thisTexture:SetTexture([[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]])
--local bIsOdd = index % 2 == 1
--thisTexture:SetTexCoord(bIsOdd and 0 or 0.5, index < 3 and 0 or 0.5, bIsOdd and 0.5 or 1, index < 3 and 0.5 or 1)
if (cornerName == "TopLeftCorner") then
thisTexture:SetTexCoord(0, 0.5, 0, 0.5)
elseif (cornerName == "TopRightCorner") then
thisTexture:SetTexCoord(0.5, 1, 0, 0.5)
elseif (cornerName == "BottomLeftCorner") then
thisTexture:SetTexCoord(0, 0.5, 0.5, 1)
elseif (cornerName == "BottomRightCorner") then
thisTexture:SetTexCoord(0.5, 1, 0.5, 1)
end
end
for _, edgeName in ipairs({"TopEdge", "BottomEdge", "LeftEdge", "RightEdge"}) do
self.edgeTextures[edgeName] = self[edgeName]
end
end,
}
local defaultOptions = {
width = 200,
height = 200,
use_titlebar = true,
use_scalebar = true,
title = "",
scale = 1,
}
---create a regular panel with rounded corner
---@param parent frame
---@param name string|nil
---@param optionsTable table|nil
---@return df_roundedpanel
function detailsFramework:CreateRoundedPanel(parent, name, optionsTable)
---@type df_roundedpanel
local newRoundedPanel = CreateFrame("frame", name, parent, "BackdropTemplate")
newRoundedPanel:EnableMouse(true)
newRoundedPanel.__dftype = "df_roundedpanel"
detailsFramework:Mixin(newRoundedPanel, detailsFramework.RoundedCornerPanelMixin)
detailsFramework:Mixin(newRoundedPanel, detailsFramework.OptionsFunctions)
newRoundedPanel:BuildOptionsTable(defaultOptions, optionsTable or {})
newRoundedPanel:Constructor()
return newRoundedPanel
end
+6 -6
View File
@@ -1,6 +1,6 @@
local dversion = 444
local dversion = 445
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -124,9 +124,9 @@ end
---return true if the player is playing in the WotLK version of wow with the retail api
---@return boolean
function DF.IsWotLKWowWithRetailAPI()
function DF.IsNonRetailWowWithRetailAPI()
local _, _, _, buildInfo = GetBuildInfo()
if (buildInfo < 40000 and buildInfo >= 30401) then
if (buildInfo < 40000 and buildInfo >= 30401) or (buildInfo < 20000 and buildInfo >= 11404) then
return true
end
return false
@@ -263,7 +263,7 @@ function DF.UnitGroupRolesAssigned(unitId)
end
end
---return the specialization of the player it self
---return the specializationid of the player it self
---@return number|nil
function DF.GetSpecialization()
if (GetSpecialization) then
@@ -272,7 +272,7 @@ function DF.GetSpecialization()
return nil
end
---return the specialization using the specId
---return the specializationid using the specId
---@param specId unknown
function DF.GetSpecializationInfoByID(specId)
if (GetSpecializationInfoByID) then
@@ -3394,7 +3394,7 @@ function DF:CreateAnimation(animation, animationType, order, duration, arg1, arg
anim:SetToAlpha(arg2)
elseif (animationType == "SCALE") then
if (DF.IsDragonflight() or DF.IsWotLKWowWithRetailAPI()) then
if (DF.IsDragonflight() or DF.IsNonRetailWowWithRetailAPI()) then
anim:SetScaleFrom(arg1, arg2)
anim:SetScaleTo(arg3, arg4)
else
+1
View File
@@ -23,6 +23,7 @@
<Script file="charts.lua"/>
<Script file="scripting.lua"/>
<Script file="externals.lua"/>
<Script file="frames.lua"/>
<Include file="tutorial_alert.xml"/>
<Include file="split_bar.xml"/>
+4
View File
@@ -269,6 +269,10 @@ detailsFramework.SetPointMixin = {
---mixin for options
---@class df_optionsmixin
---@field SetOption fun(self, optionName: string, optionValue: any)
---@field GetOption fun(self, optionName: string):any
---@field GetAllOptions fun(self):table
---@field BuildOptionsTable fun(self, defaultOptions: table, userOptions: table)
detailsFramework.OptionsFunctions = {
SetOption = function(self, optionName, optionValue)
if (self.options) then
+14 -8
View File
@@ -1880,7 +1880,10 @@ local SimplePanel_frame_backdrop_border_color = {0, 0, 0, 1}
--with_label was making the frame stay in place while its parent moves
--the slider was anchoring to with_label and here here were anchoring the slider again
---@class df_scalebar : slider
---@field thumb texture
function detailsFramework:CreateScaleBar(frame, config) --~scale
---@type df_scalebar
local scaleBar, text = detailsFramework:CreateSlider(frame, 120, 14, 0.6, 1.6, 0.1, config.scale, true, "ScaleBar", nil, "Scale:", detailsFramework:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE"), detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
scaleBar.thumb:SetWidth(24)
scaleBar:SetValueStep(0.1)
@@ -4372,30 +4375,31 @@ end
-- ~title bar
detailsFramework.TitleFunctions = {
SetTitle = function(self, titleText, titleColor, font, size)
self.TitleLabel:SetText(titleText or self.TitleLabel:GetText())
local titleLabel = self.TitleLabel or self.Text
titleLabel:SetText(titleText or titleLabel:GetText())
if (titleColor) then
local r, g, b, a = detailsFramework:ParseColors(titleColor)
self.TitleLabel:SetTextColor(r, g, b, a)
titleLabel:SetTextColor(r, g, b, a)
end
if (font) then
detailsFramework:SetFontFace (self.TitleLabel, font)
detailsFramework:SetFontFace (titleLabel, font)
end
if (size) then
detailsFramework:SetFontSize(self.TitleLabel, size)
detailsFramework:SetFontSize(titleLabel, size)
end
end
}
---@class df_titlebar : frame
---@field TitleBar frame
---@field TitleLabel fontstring
---@field CloseButton button
---@field SetTitle fun(self:df_titlebar, titleText:string, titleColor:any, font:string, size:number)
---create a title bar with a font string in the center and a close button in the right side
---@param parent frame
@@ -4435,7 +4439,9 @@ function detailsFramework:CreateTitleBar(parent, titleText)
parent.TitleBar = titleBar
parent.CloseButton = closeButton
parent.TitleLabel = titleLabel
parent.SetTitle = titleBar.SetTitle
titleBar.TitleBar = titleBar --to fit documentation
titleBar.CloseButton = closeButton
titleBar.Text = titleLabel
@@ -5324,7 +5330,7 @@ function detailsFramework:OpenLoadConditionsPanel(optionsTable, callback, frameO
function loadConditionsFrame.Refresh (self)
if IS_WOW_PROJECT_MAINLINE then
--update the talents (might have changed if the player changed its specialization)
--update the talents (might have changed if the player changed its specializationid)
local talentList = {}
for _, talentTable in ipairs(detailsFramework:GetCharacterTalents()) do
if talentTable.ID then
+1 -1
View File
@@ -323,7 +323,7 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin)
if (texture) then
if (type(texture) == "table") then
if (texture.gradient) then
if (detailsFramework.IsDragonflight() or detailsFramework.IsWotLKWowWithRetailAPI()) then
if (detailsFramework.IsDragonflight() or detailsFramework.IsNonRetailWowWithRetailAPI()) then
ImageObject.image:SetColorTexture(1, 1, 1, 1)
local fromColor = detailsFramework:FormatColor("tablemembers", texture.fromColor)
local toColor = detailsFramework:FormatColor("tablemembers", texture.toColor)
+9 -1
View File
@@ -107,6 +107,14 @@
---| "DEMONHUNTER"
---| "EVOKER"
---@alias instancetype
---| "none"
---| "party"
---| "raid"
---| "arena"
---| "pvp"
---| "scenario"
---@alias width number property that represents the horizontal size of a UI element, such as a frame or a texture. Gotten from the first result of GetWidth() or from the first result of GetSize(). It is expected a GetWidth() or GetSize() when the type 'height' is used.
---@alias height number property that represents the vertical size of a UI element, such as a frame or a texture. Gotten from the first result of GetHeight() or from the second result of GetSize(). It is expected a GetHeight() or GetSize() when the type 'height' is used.
---@alias red number color value representing the red component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color)
@@ -127,7 +135,7 @@
---@alias actorid string unique id of a unit (GUID)
---@alias serial string unique id of a unit (GUID)
---@alias guid string unique id of a unit (GUID)
---@alias specialization number the ID of a class specialization
---@alias specializationid number the ID of a class specialization
---@alias controlflags number flags telling what unit type the is (player, npc, pet, etc); it's relatiotionship to the player (friendly, hostile, etc); who controls the unit (controlled by the player, controlled by the server, etc)
---@alias color table, string @table(r: red|number, g: green|number, b: blue|number, a: alpha|number) @string(color name) @hex (000000-ffffff) value representing a color, the value must be a table with the following fields: r, g, b, a. r, g, b are numbers between 0 and 1, a is a number between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color)
---@alias scale number @number(0.65-2.40) value representing the scale factor of the UIObject, the value must be between 0.65 and 2.40, the width and height of the UIObject will be multiplied by this value.
+1 -1
View File
@@ -647,7 +647,7 @@ function openRaidLib.CooldownManager.GetPlayerCooldownList()
--get the player specId
local specId = openRaidLib.GetPlayerSpecId()
if (specId) then
--get the cooldowns for the specialization
--get the cooldowns for the specializationid
local playerCooldowns = LIB_OPEN_RAID_PLAYERCOOLDOWNS
if (not playerCooldowns) then
openRaidLib.DiagnosticError("CooldownManager|GetPlayerCooldownList|LIB_OPEN_RAID_PLAYERCOOLDOWNS is nil")
+1 -1
View File
@@ -37,7 +37,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
end
local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 102
local CONST_LIB_VERSION = 103
if (not LIB_OPEN_RAID_MAX_VERSION) then
LIB_OPEN_RAID_MAX_VERSION = CONST_LIB_VERSION
@@ -367,9 +367,9 @@ do
[216331] = {cooldown = 120, duration = 20, specs = {65}, talent = false, charges = 1, class = "PALADIN", type = 1}, --Avenging Crusader
[31884] = {cooldown = 120, duration = 20, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 1}, --Avenging Wrath
[1044] = {cooldown = 25, duration = 8, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 5}, --Blessing of Freedom
[1022] = {cooldown = 300, duration = 10, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Protection
[1022] = {cooldown = 300, duration = 10, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 3, shareid = 204018}, --Blessing of Protection
[6940] = {cooldown = 120, duration = 12, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Sacrifice
[204018] = {cooldown = 180, duration = 10, specs = {66}, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Spellwarding
[204018] = {cooldown = 180, duration = 10, specs = {66}, talent = false, charges = 1, class = "PALADIN", type = 3, shareid = 1022}, --Blessing of Spellwarding
[115750] = {cooldown = 90, duration = 6, specs = {65, 66, 70}, talent = false, charges = 1, class = "PALADIN", type = 8}, --Blinding Light
[231895] = {cooldown = 120, duration = 25, specs = {70}, talent = false, charges = 1, class = "PALADIN", type = 1}, --Crusade
[498] = {cooldown = 60, duration = 8, specs = {65}, talent = false, charges = 1, class = "PALADIN", type = 2}, --Divine Protection