diff options
author | Tom Barham <me@cpdt.dev> | 2022-02-22 08:33:53 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 19:33:53 -0300 |
commit | 8c9f34283f8670dda98959d0785d682e6f652a93 (patch) | |
tree | 5e9d8c10fb5d1df2816fac43e4db3b80cc7f93a0 /NorthstarDedicatedTest/serverchathooks.h | |
parent | ae9df9bc734c6c0364028c71db5e7236e7c344dd (diff) | |
download | NorthstarLauncher-8c9f34283f8670dda98959d0785d682e6f652a93.tar.gz NorthstarLauncher-8c9f34283f8670dda98959d0785d682e6f652a93.zip |
Advanced chat: custom messages and client hooks (#74)
Co-authored-by: Emma Miler <27428383+emma-miler@users.noreply.github.com>
Diffstat (limited to 'NorthstarDedicatedTest/serverchathooks.h')
-rw-r--r-- | NorthstarDedicatedTest/serverchathooks.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/serverchathooks.h b/NorthstarDedicatedTest/serverchathooks.h new file mode 100644 index 00000000..f3425ae6 --- /dev/null +++ b/NorthstarDedicatedTest/serverchathooks.h @@ -0,0 +1,29 @@ +#pragma once +#include "pch.h" +#include <rapidjson/document.h> +#include <rapidjson/stringbuffer.h> + +enum class CustomMessageType : char +{ + Chat = 1, + Whisper = 2 +}; + +constexpr unsigned char CUSTOM_MESSAGE_INDEX_BIT = 0b10000000; +constexpr unsigned char CUSTOM_MESSAGE_INDEX_MASK = ~CUSTOM_MESSAGE_INDEX_BIT; + +// Send a vanilla chat message as if it was from the player. +void ChatSendMessage(unsigned int playerIndex, const char* text, bool isteam); + +// Send a custom message. +// fromPlayerIndex: set to -1 for a [SERVER] message, or another value to send from a specific player +// toPlayerIndex: set to -1 to send to all players, or another value to send to a single player +// isTeam: display a [TEAM] badge +// isDead: display a [DEAD] badge +// messageType: send a specific message type +void ChatBroadcastMessage( + int fromPlayerIndex, int toPlayerIndex, const char* text, bool isTeam, bool isDead, CustomMessageType messageType); + +void InitialiseServerChatHooks_Engine(HMODULE baseAddress); + +void InitialiseServerChatHooks_Server(HMODULE baseAddress); |