From e04f3b36accccb590a2d51b4829256b9964ac3fd Mon Sep 17 00:00:00 2001 From: Emma Miler Date: Mon, 19 Dec 2022 19:32:16 +0100 Subject: Restructuring (#365) * Remove launcher proxy * Restructuring * More restructuring * Fix include dirs * Fix merge * Remove clang thing * Filters * Oops --- NorthstarDLL/client/chatcommand.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 NorthstarDLL/client/chatcommand.cpp (limited to 'NorthstarDLL/client/chatcommand.cpp') diff --git a/NorthstarDLL/client/chatcommand.cpp b/NorthstarDLL/client/chatcommand.cpp new file mode 100644 index 00000000..76ed9784 --- /dev/null +++ b/NorthstarDLL/client/chatcommand.cpp @@ -0,0 +1,36 @@ +#include "pch.h" +#include "core/convar/convar.h" +#include "core/convar/concommand.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 +void(__fastcall* ClientSayText)(void* a1, const char* message, uint64_t isIngameChat, bool isTeamChat); + +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()); + } +} + +ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientChatCommand, ConCommand, (CModule module)) +{ + ClientSayText = module.Offset(0x54780).As(); + 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); +} -- cgit v1.2.3