Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChatThrottleLib: Add Battle.net addon message support
This adds the necessary hooks and public APIs to support sending comms over the BNSendGameData API. There's a few differences to note up-front about CTL's provided interface for this functionality. - The BNSendGameData API supports sending messages up to 4078 bytes in length, but our implementation limits it to 255 bytes. - The BNSendGameData API has a different parameter ordering and no 'chattype' parameter, whereas our implementation is consistent with SendAddonMessage. On message size, our round-robin message selection effectively pauses when it reaches a message for which there isn't yet enough accrued bandwidth to send. In the case of 4078 byte messages that this API supports, this could mean with the current CPS value that a priority blocks for up to 5 seconds before enough bandwidth is available to send it off. This would be extremely unfair to everything else sending data, so we limit it to the usual 255 bytes. On parameter ordering, there's an inconsistency between the API's parameters and the data supplied in its event; the API doesn't have a chattype parameter but its event fires with one always set to 'WHISPER'. If the API changed to require a chattype parameter down the line it would require a backwards compatibility break in our interface if we hadn't accomodated it, so it feels sensible to just require it up-front even if it must always be 'WHISPER'. With both the message size and added chattype parameter in mind, it then also makes sense to just make the interface have the same parameter ordering as SendAddonMessage to make it a bit easier to generically use these functions. BNSendGameData requires an order of (target, prefix, data), whereas our interface is the standard (prio, prefix, data, chattype, target).
- Loading branch information