Skip to content

Commit

Permalink
Cleaned up a backwards compatibility layer for addon channel communic…
Browse files Browse the repository at this point in the history
…ation with older versions
  • Loading branch information
linaori committed Oct 6, 2022
1 parent 6e1a9aa commit def06a8
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions QueueTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ local Memory = {

local CommunicationEvent = {
SyncData = 'Bgc:syncData',
NotifyMercDuration = 'Bgc:notifyMerc', -- replaced by Bgc:syncData
ReadyCheckHeartbeat = 'Bgc:rchb',
EnterBattleground = 'Bgc:enterBg',
DeclineBattleground = 'Bgc:declineBg',
Expand All @@ -141,7 +140,6 @@ function Private.SendSyncData()
local channel, player = GetMessageDestination()
local payload = PackData(Memory.syncDataPayloadBuffer)

Module:SendCommMessage(CommunicationEvent.NotifyMercDuration, payload, channel, player) -- remove in future
Module:SendCommMessage(CommunicationEvent.SyncData, payload, channel, player)
Memory.syncDataPayloadBuffer = nil
end
Expand Down Expand Up @@ -445,14 +443,10 @@ end

function Private.ProcessSyncData(payload, data)
local time = GetTime()
-- renamed after 1.4.0, remove "remaining" index in the future
data.mercenaryExpiry = (payload.remainingMercenary or payload.remaining) + time
if payload.remainingDeserter then
-- added after 1.4.0, remove if check in the future
data.deserterExpiry = payload.remainingDeserter + time
end

data.addonVersion = payload.addonVersion or '<=1.4.1' -- added after 1.4.1
data.mercenaryExpiry = payload.remainingMercenary + time
data.deserterExpiry = payload.remainingDeserter + time
data.addonVersion = payload.addonVersion
data.autoAcceptRole = payload.autoAcceptRole

Private.RefreshPlayerTable()
Expand Down Expand Up @@ -578,7 +572,6 @@ function Module:OnEnable()
self:RegisterEvent('GROUP_ROSTER_UPDATE')
self:RegisterEvent('PLAYER_ENTERING_WORLD')

self:RegisterComm(CommunicationEvent.NotifyMercDuration, Private.OnSyncData)
self:RegisterComm(CommunicationEvent.SyncData, Private.OnSyncData)
self:RegisterComm(CommunicationEvent.ReadyCheckHeartbeat, Private.OnReadyCheckHeartbeat)
self:RegisterComm(CommunicationEvent.EnterBattleground, Private.OnEnterBattleground)
Expand Down

0 comments on commit def06a8

Please sign in to comment.