Skip to content

Commit

Permalink
Added definitions for unitframes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 13, 2023
1 parent 0b32fe3 commit 592b9a3
Show file tree
Hide file tree
Showing 4 changed files with 262 additions and 84 deletions.
1 change: 1 addition & 0 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
---@field Mixin fun(self:table, target:table, ...) : table
---@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 UnitGroupRolesAssigned fun(self:table, unitId: unit, specId: specializationid) : string
12 changes: 10 additions & 2 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 456
local dversion = 457
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -233,14 +233,22 @@ end

---return the role of the unit, this is safe to use for all versions of wow
---@param unitId string
---@param specId number
---@return string
function DF.UnitGroupRolesAssigned(unitId)
function DF.UnitGroupRolesAssigned(unitId, specId)
if (not DF.IsTimewalkWoW()) then --Was function exist check. TBC has function, returns NONE. -Flamanis 5/16/2022
local role = UnitGroupRolesAssigned(unitId)

if (specId == 1473) then
return "SUPPORT"
end

if (role == "NONE" and UnitIsUnit(unitId, "player")) then
local specializationIndex = GetSpecialization() or 0
local id, name, description, icon, role, primaryStat = GetSpecializationInfo(specializationIndex)
if (id == 1473) then
return "SUPPORT"
end
return id and role or "NONE"
end

Expand Down
45 changes: 30 additions & 15 deletions Libs/DF/mixins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,13 @@ detailsFramework.PayloadMixin = {

---mixin to use with DetailsFramework:Mixin(table, detailsFramework.ScriptHookMixin)
---
---@class DetailsFramework.ScriptHookMixin
---@class df_scripthookmixin
---@field HookList table
---@field SetHook fun(self: table, hookType: string, func: function)
---@field HasHook fun(self: table, hookType: string, func: function)
---@field RunHooksForWidget fun(self: table, event: string, ...)
---@field ClearHooks fun(self: table)

detailsFramework.ScriptHookMixin = {
RunHooksForWidget = function(self, event, ...)
local hooks = self.HookList[event]
Expand Down Expand Up @@ -991,6 +997,29 @@ detailsFramework.ValueMixin = {
statusBar:
--]=]

---@class df_statusbarmixin : table
---@field SetTexture fun(self: table, texture: string, isTemporary: boolean)
---@field ResetTexture fun(self: table)
---@field GetTexture fun(self: table) : string
---@field SetAtlas fun(self: table, atlasName: string)
---@field GetAtlas fun(self: table) : string
---@field SetTexCoord fun(self: table, ...)
---@field GetTexCoord fun(self: table) : number, number, number, number
---@field SetColor fun(self: table, ...)
---@field GetColor fun(self: table) : number, number, number, number
---@field SetMaskTexture fun(self: table, texture: string)
---@field GetMaskTexture fun(self: table) : string
---@field SetMaskTexCoord fun(self: table, ...)
---@field GetMaskTexCoord fun(self: table) : number, number, number, number
---@field SetMaskAtlas fun(self: table, atlasName: string)
---@field GetMaskAtlas fun(self: table) : string
---@field AddMaskTexture fun(self: table, texture: string)
---@field SetBorderTexture fun(self: table, texture: string)
---@field GetBorderTexture fun(self: table) : string
---@field SetBorderColor fun(self: table, ...)
---@field GetBorderColor fun(self: table) : number, number, number, number


detailsFramework.StatusBarFunctions = {
SetTexture = function(self, texture, isTemporary)
self.barTexture:SetTexture(texture)
Expand Down Expand Up @@ -1046,20 +1075,6 @@ detailsFramework.StatusBarFunctions = {
self.barTextureMask:GetTexture()
end,

--SetMaskTexCoord = function(self, ...) --MaskTexture doesn't not support texcoord
-- if (not self:HasTextureMask()) then
-- return
-- end
-- self.barTextureMask:SetTexCoord(...)
--end,

--GetMaskTexCoord = function(self, ...)
-- if (not self:HasTextureMask()) then
-- return
-- end
-- self.barTextureMask:GetTexCoord()
--end,

SetMaskAtlas = function(self, atlasName)
if (not self:HasTextureMask()) then
return
Expand Down
Loading

0 comments on commit 592b9a3

Please sign in to comment.