Skip to content

Commit

Permalink
Core/BossPrototype: Add :GetMaxPlayers() and deprecate `:NewTargetL…
Browse files Browse the repository at this point in the history
…ist()`
  • Loading branch information
funkydude committed Jul 17, 2024
1 parent b8c3890 commit 93f955c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
21 changes: 11 additions & 10 deletions Core/BossPrototype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ local bossUtilityFrame = CreateFrame("Frame")
local petUtilityFrame = CreateFrame("Frame")
local enabledModules, unitTargetScans = {}, {}
local allowedEvents = {}
local difficulty
local difficulty, maxPlayers
local UpdateDispelStatus, UpdateInterruptStatus = nil, nil
local myGUID, myRole, myRolePosition
local myGroupGUIDs, myGroupRoles, myGroupRolePositions = {}, {}, {}
local solo = false
local classColorMessages = true
local englishSayMessages = false
do -- Update some data that may be called at the top of modules (prior to initialization)
local _, _, diff = GetInstanceInfo()
difficulty = diff
local _, _, diff, _, currentMaxPlayers = GetInstanceInfo()
difficulty, maxPlayers = diff, currentMaxPlayers
myGUID = UnitGUID("player")
local function update(_, role, position, player)
myGroupRolePositions[player] = position
Expand Down Expand Up @@ -1360,6 +1360,12 @@ do
end
end

--- Get the max player count of the current instance.
-- @return number
function boss:GetMaxPlayers()
return maxPlayers
end

--- Get the current instance difficulty.
-- @return difficulty id
function boss:Difficulty()
Expand Down Expand Up @@ -2437,15 +2443,10 @@ do
})
myNameWithColor = coloredNames[myName]

local mt = {
__newindex = function(self, key, value)
rawset(self, key, coloredNames[value])
end
}
--- Get a table that colors player names based on class.
--- Get a table that colors player names based on class. [DEPRECATED]
-- @return an empty table
function boss:NewTargetList()
return setmetatable({}, mt)
return {}
end

--- Color a player name based on class.
Expand Down
21 changes: 11 additions & 10 deletions Core/BossPrototype_Classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ local bossUtilityFrame = CreateFrame("Frame")
local petUtilityFrame = CreateFrame("Frame")
local enabledModules, unitTargetScans = {}, {}
local allowedEvents = {}
local difficulty
local difficulty, maxPlayers
local UpdateDispelStatus, UpdateInterruptStatus = nil, nil
local myGUID, myRole, myRolePosition
local myGroupGUIDs, myGroupRoles, myGroupRolePositions = {}, {}, {}
local solo = false
local classColorMessages = true
local englishSayMessages = false
do -- Update some data that may be called at the top of modules (prior to initialization)
local _, _, diff = GetInstanceInfo()
difficulty = diff
local _, _, diff, _, currentMaxPlayers = GetInstanceInfo()
difficulty, maxPlayers = diff, currentMaxPlayers
myGUID = UnitGUID("player")
local function update(_, role, position, player)
myGroupRolePositions[player] = position
Expand Down Expand Up @@ -1437,6 +1437,12 @@ do
end
end

--- Get the max player count of the current instance.
-- @return number
function boss:GetMaxPlayers()
return maxPlayers
end

--- Get the current instance difficulty.
-- @return difficulty id
function boss:Difficulty()
Expand Down Expand Up @@ -2435,15 +2441,10 @@ do
})
myNameWithColor = coloredNames[myName]

local mt = {
__newindex = function(self, key, value)
rawset(self, key, coloredNames[value])
end
}
--- Get a table that colors player names based on class.
--- Get a table that colors player names based on class. [DEPRECATED]
-- @return an empty table
function boss:NewTargetList()
return setmetatable({}, mt)
return {}
end

--- Color a player name based on class.
Expand Down

0 comments on commit 93f955c

Please sign in to comment.