Skip to content

Commit

Permalink
Added "Role Check" to status column when doing a role check, and "Acc…
Browse files Browse the repository at this point in the history
…epted" when the role check is accepted
  • Loading branch information
linaori committed Oct 14, 2022
1 parent 2ca9662 commit 7f3d3ab
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local Private, _, Namespace = {}, ...
Namespace.Debug = {}
--@debug@
Namespace.Debug.enabled = true
Namespace.Meta.version = '1.9.0-dev'
Namespace.Meta.version = '1.10.0-dev'
--@end-debug@

local type, pairs, tostring, print, concat, select = type, pairs, tostring, print, table.concat, select
Expand Down
2 changes: 2 additions & 0 deletions Locales/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ L['Disable Entry Button by Default'] = true
L['The entry button requires shift to be held first, or the group leader to enter.'] = true
L['Show or hide the Battleground Commander group information window'] = true
L['Queue Pop'] = true
L['Accepted'] = true
L['Role Check'] = true
L['OK'] = true
L['Offline'] = true
L['Open World'] = true
Expand Down
2 changes: 2 additions & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ L['Disable Entry Button by Default'] = true
L['The entry button requires shift to be held first, or the group leader to enter.'] = true
L['Show or hide the Battleground Commander group information window'] = true
L['Queue Pop'] = true
L['Accepted'] = true
L['Role Check'] = true
L['OK'] = true
L['Offline'] = true
L['Open World'] = true
Expand Down
2 changes: 2 additions & 0 deletions Locales/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ L['Disable Entry Button by Default'] = true
L['The entry button requires shift to be held first, or the group leader to enter.'] = true
L['Show or hide the Battleground Commander group information window'] = true
L['Queue Pop'] = true
L['Accepted'] = true
L['Role Check'] = true
L['OK'] = true
L['Offline'] = true
L['Open World'] = true
Expand Down
3 changes: 3 additions & 0 deletions PlayerData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Namespace.PlayerData = {}

local ReadyCheckState = Namespace.Utils.ReadyCheckState
local BattlegroundStatus = Namespace.Utils.BattlegroundStatus
local RoleCheckStatus = Namespace.Utils.RoleCheckStatus
local GroupType = Namespace.Utils.GroupType
local GetGroupType = Namespace.Utils.GetGroupType
local GetRealUnitName = Namespace.Utils.GetRealUnitName
Expand Down Expand Up @@ -33,6 +34,7 @@ local Memory = {
-- units = {[1] => first unit, first unit = true, second unit = true},
-- class = 'CLASS',
-- readyState = ReadyCheckState,
-- roleCheckStatus = RoleCheckStatus,
-- deserterExpiry = -1,
-- mercenaryExpiry = nil,
-- addonVersion = 'whatever remote version',
Expand Down Expand Up @@ -76,6 +78,7 @@ function Namespace.PlayerData.RebuildPlayerData()
deserterExpiry = -1,
units = {primary = unit, [unit] = true},
battlegroundStatus = BattlegroundStatus.Nothing,
roleCheckStatus = RoleCheckStatus.Nothing,
isConnected = UnitIsConnected(unit),
}

Expand Down
53 changes: 50 additions & 3 deletions QueueTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local ForEachPlayerData = Namespace.PlayerData.ForEachPlayerData
local ForEachUnitData = Namespace.PlayerData.ForEachUnitData
local ReadyCheckState = Namespace.Utils.ReadyCheckState
local BattlegroundStatus = Namespace.Utils.BattlegroundStatus
local RoleCheckStatus = Namespace.Utils.RoleCheckStatus
local IsLeaderOrAssistant = Namespace.Utils.IsLeaderOrAssistant
local GetPlayerAuraExpiration = Namespace.Utils.GetPlayerAuraExpiration
local RaidMarker = Namespace.Utils.RaidMarker
Expand Down Expand Up @@ -261,8 +262,6 @@ function Private.CreateTableRow(index, data)
local readyCheckColumn = {
value = function(tableData, _, realRow, column)
local columnData = tableData[realRow].cols[column]
local readyState = data.readyState
local battlegroundStatus = data.battlegroundStatus

if not data.isConnected then
columnData.color = ColorList.Bad
Expand All @@ -277,11 +276,24 @@ function Private.CreateTableRow(index, data)
return format('%dm', timeDiff.fullMinutes) .. ' ' .. L['Deserter']
end

local battlegroundStatus = data.battlegroundStatus
if battlegroundStatus == BattlegroundStatus.Entered then
columnData.color = nil
return L['Entered']
end

local roleCheckStatus = data.roleCheckStatus
if roleCheckStatus == RoleCheckStatus.Waiting then
columnData.color = ColorList.Warning
return L['Role Check']
end

if roleCheckStatus == RoleCheckStatus.Accepted then
columnData.color = ColorList.Good
return L['Accepted']
end

local readyState = data.readyState
if readyState == ReadyCheckState.Declined then
columnData.color = ColorList.Bad
return L['Not Ready']
Expand Down Expand Up @@ -574,6 +586,9 @@ function Module:OnEnable()
self:RegisterEvent('PLAYER_REGEN_DISABLED')
self:RegisterEvent('UPDATE_BATTLEFIELD_STATUS')
self:RegisterEvent('LFG_ROLE_CHECK_SHOW')
self:RegisterEvent('LFG_ROLE_CHECK_ROLE_CHOSEN')
self:RegisterEvent('LFG_ROLE_CHECK_DECLINED')
self:RegisterEvent('LFG_ROLE_CHECK_UPDATE')
self:RegisterEvent('UNIT_CONNECTION')
self:RegisterEvent('GROUP_ROSTER_UPDATE')
self:RegisterEvent('PLAYER_ENTERING_WORLD')
Expand Down Expand Up @@ -613,6 +628,35 @@ function Module:UNIT_CONNECTION(_, unitTarget, isConnected)
playerData.isConnected = isConnected
end

function Module:LFG_ROLE_CHECK_ROLE_CHOSEN(_, sender)
local data = GetPlayerDataByName(sender)
if not data then return end

data.roleCheckStatus = RoleCheckStatus.Accepted

Private.RefreshPlayerTable()
end

function Module:LFG_ROLE_CHECK_DECLINED()
ForEachPlayerData(function(data) data.roleCheckStatus = RoleCheckStatus.Nothing end)

Private.RefreshPlayerTable()
end

function Module:LFG_ROLE_CHECK_UPDATE()
local doRefresh = false
ForEachUnitData(function(data)
if data.roleCheckStatus == RoleCheckStatus.Nothing then
data.roleCheckStatus = RoleCheckStatus.Waiting
doRefresh = true
end
end)

if not doRefresh then return end

Private.RefreshPlayerTable()
end

function Module:LFG_ROLE_CHECK_SHOW()
local _, _, _, _, _, bgQueue = GetLFGRoleUpdate()
if not bgQueue then return end
Expand Down Expand Up @@ -689,7 +733,10 @@ function Private.DetectQueueEntry(previousState, newState)
if previousState.status ~= QueueStatus.None then return end
if newState.status ~= QueueStatus.Queued then return end

ForEachPlayerData(function(data) data.battlegroundStatus = BattlegroundStatus.None end)
ForEachPlayerData(function(data)
data.battlegroundStatus = BattlegroundStatus.Nothing
data.roleCheckStatus = RoleCheckStatus.Nothing
end)

Private.RestoreEntryButton()
Private.RefreshPlayerTable()
Expand Down
6 changes: 6 additions & 0 deletions Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ Namespace.Utils.BattlegroundStatus = {
Entered = 3,
}

Namespace.Utils.RoleCheckStatus = {
Nothing = 0,
Waiting = 1,
Ready = 2,
}

Namespace.Utils.RaidMarker = {
YellowStar = '{rt1}',
OrangeCircle = '{rt2}',
Expand Down

0 comments on commit 7f3d3ab

Please sign in to comment.