Browse Source

change api

dev
Jørgen Lien Sellæg 4 months ago
parent
commit
36e7bc0be5
  1. 6
      TradeSkillMaster_AuctionDB/Modules/ChannelSync.lua

6
TradeSkillMaster_AuctionDB/Modules/ChannelSync.lua

@ -18,6 +18,7 @@ local BUNDLE_TIMEOUT = 45
local private = { local private = {
channelId = nil, channelId = nil,
channelName = nil,
lastBroadcastHash = nil, lastBroadcastHash = nil,
incoming = {}, incoming = {},
} }
@ -43,6 +44,7 @@ local function EnsureChannel()
channelId = GetChannelName(CHANNEL_NAME) channelId = GetChannelName(CHANNEL_NAME)
end end
private.channelId = channelId > 0 and channelId or nil private.channelId = channelId > 0 and channelId or nil
private.channelName = private.channelId and CHANNEL_NAME or nil
end end
local function ChatFilter(_, _, msg, _, _, _, _, _, channelName) local function ChatFilter(_, _, msg, _, _, _, _, _, channelName)
@ -103,7 +105,7 @@ function ChannelSync:BroadcastScanData(scanType)
return return
end end
EnsureChannel() EnsureChannel()
if not private.channelId then return end if not private.channelName then return end
TSM:Serialize() TSM:Serialize()
local payload = { local payload = {
@ -121,7 +123,7 @@ function ChannelSync:BroadcastScanData(scanType)
for i = 1, total do for i = 1, total do
local chunk = strsub(encoded, (i - 1) * CHUNK_SIZE + 1, i * CHUNK_SIZE) local chunk = strsub(encoded, (i - 1) * CHUNK_SIZE + 1, i * CHUNK_SIZE)
local msg = strjoin("|", COMM_PREFIX, hash, i .. "/" .. total, chunk) local msg = strjoin("|", COMM_PREFIX, hash, i .. "/" .. total, chunk)
self:SendCommMessage(COMM_PREFIX, msg, "CHANNEL", private.channelId) self:SendCommMessage(COMM_PREFIX, msg, "CHANNEL", private.channelName)
end end
end end

Loading…
Cancel
Save