aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/chatcommand.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-08-24 00:32:31 +0100
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-08-25 21:32:55 +0200
commit46bed8d09f32360377350d71816a76abdfbf2c7c (patch)
tree7feedae4910dbfe0e53d26ea1e00c4616d2c1850 /NorthstarDLL/chatcommand.cpp
parenta97f1f07bb5aa31629cd87023e09669eb4bf1fe9 (diff)
downloadNorthstarLauncher-46bed8d09f32360377350d71816a76abdfbf2c7c.tar.gz
NorthstarLauncher-46bed8d09f32360377350d71816a76abdfbf2c7c.zip
Adjust folder structure (#242)v1.9.5-rc1v1.9.5
* Adjust folder structure * change launcher directory name
Diffstat (limited to 'NorthstarDLL/chatcommand.cpp')
-rw-r--r--NorthstarDLL/chatcommand.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/NorthstarDLL/chatcommand.cpp b/NorthstarDLL/chatcommand.cpp
new file mode 100644
index 00000000..2aa51737
--- /dev/null
+++ b/NorthstarDLL/chatcommand.cpp
@@ -0,0 +1,38 @@
+#include "pch.h"
+#include "convar.h"
+#include "concommand.h"
+#include "chatcommand.h"
+#include "localchatwriter.h"
+
+// note: isIngameChat is an int64 because the whole register the arg is stored in needs to be 0'd out to work
+// if isIngameChat is false, we use network chat instead
+typedef void(__fastcall* ClientSayTextType)(void* a1, const char* message, __int64 isIngameChat, bool isTeamChat);
+ClientSayTextType ClientSayText;
+
+void ConCommand_say(const CCommand& args)
+{
+ if (args.ArgC() >= 2)
+ ClientSayText(nullptr, args.ArgS(), true, false);
+}
+
+void ConCommand_say_team(const CCommand& args)
+{
+ if (args.ArgC() >= 2)
+ ClientSayText(nullptr, args.ArgS(), true, true);
+}
+
+void ConCommand_log(const CCommand& args)
+{
+ if (args.ArgC() >= 2)
+ {
+ LocalChatWriter(LocalChatWriter::GameContext).WriteLine(args.ArgS());
+ }
+}
+
+void InitialiseChatCommands(HMODULE baseAddress)
+{
+ ClientSayText = (ClientSayTextType)((char*)baseAddress + 0x54780);
+ RegisterConCommand("say", ConCommand_say, "Enters a message in public chat", FCVAR_CLIENTDLL);
+ RegisterConCommand("say_team", ConCommand_say_team, "Enters a message in team chat", FCVAR_CLIENTDLL);
+ RegisterConCommand("log", ConCommand_log, "Log a message to the local chat window", FCVAR_CLIENTDLL);
+}