Skip to content

Commit

Permalink
Directly enqueue Battle.net messages in CTL
Browse files Browse the repository at this point in the history
As the relevant PR adding BNSendGameData support is still outstanding on
the merge front, let's for now just directly poke at its innards and
enqueue such messages directly.

This is the lesser of two evils compared to what Chomp used to do, and
means we can actually ship this new version of Chomp _today_ without
comms being nerfed by 40% on retail.
  • Loading branch information
Meorawr committed May 7, 2024
1 parent 75a3562 commit 0b9ab65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ read_globals = {

-- ChatThrottleLib
"ChatThrottleLib.BNSendGameData",
"ChatThrottleLib.Enqueue",
"ChatThrottleLib.SendAddonMessage",
"ChatThrottleLib.SendAddonMessageLogged",
"ChatThrottleLib.SendChatMessage",
Expand All @@ -41,6 +42,7 @@ read_globals = {
"BNET_CLIENT_WOW",
"BNFeaturesEnabledAndConnected",
"BNGetNumFriends",
"BNSendGameData",
"C_BattleNet.GetFriendGameAccountInfo",
"C_BattleNet.GetFriendNumGameAccounts",
"C_BattleNet.GetGameAccountInfoByID",
Expand Down
19 changes: 17 additions & 2 deletions Public.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,23 @@ function Chomp.BNSendGameData(bnetIDGameAccount, prefix, text, priority, queue,
error("Chomp.BNSendGameData: prefix: length cannot exceed 16 bytes", 2)
end

local chatType = "WHISPER";
ChatThrottleLib:BNSendGameData(PRIORITY_TO_CTL[priority] or DEFAULT_PRIORITY, prefix, text, chatType, bnetIDGameAccount, queue, callback, callbackArg)
-- Revisit this logic later if/when CTL merges in BNSendGameData support;
-- until then let's poke into its guts.

if not ChatThrottleLib.Enqueue then
return
end

ChatThrottleLib:Enqueue(PRIORITY_TO_CTL[priority] or DEFAULT_PRIORITY, queue or prefix, {
f = BNSendGameData,
callbackFn = callback,
callbackArg = callbackArg,
nSize = length + (ChatThrottleLib.MSG_OVERHEAD or 40),
n = 3,
bnetIDGameAccount,
prefix,
text,
})
end

function Chomp.IsSending()
Expand Down

0 comments on commit 0b9ab65

Please sign in to comment.