diff --git a/Debug.lua b/Debug.lua index de2abfb..54f9b1f 100644 --- a/Debug.lua +++ b/Debug.lua @@ -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 diff --git a/Locales/deDE.lua b/Locales/deDE.lua index 3f11cef..4bb01db 100644 --- a/Locales/deDE.lua +++ b/Locales/deDE.lua @@ -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 diff --git a/Locales/enUS.lua b/Locales/enUS.lua index 19c670a..d394e79 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -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 diff --git a/Locales/ruRU.lua b/Locales/ruRU.lua index be956e9..c02c0cc 100644 --- a/Locales/ruRU.lua +++ b/Locales/ruRU.lua @@ -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 diff --git a/PlayerData.lua b/PlayerData.lua index a3c0a47..47c11bd 100644 --- a/PlayerData.lua +++ b/PlayerData.lua @@ -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 @@ -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', @@ -76,6 +78,7 @@ function Namespace.PlayerData.RebuildPlayerData() deserterExpiry = -1, units = {primary = unit, [unit] = true}, battlegroundStatus = BattlegroundStatus.Nothing, + roleCheckStatus = RoleCheckStatus.Nothing, isConnected = UnitIsConnected(unit), } diff --git a/QueueTools.lua b/QueueTools.lua index 98e453f..bb796be 100644 --- a/QueueTools.lua +++ b/QueueTools.lua @@ -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 @@ -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 @@ -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'] @@ -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') @@ -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 @@ -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() diff --git a/Utils.lua b/Utils.lua index 062fbc9..5ced5f7 100644 --- a/Utils.lua +++ b/Utils.lua @@ -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}',