From 1bb9add3313497732de6d69761ec8e27ca3f0191 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 20 Nov 2022 17:44:08 +0100 Subject: [PATCH] Overwrite bot names --- src/client/component/bots.cpp | 53 +++++++++++++++++++++++++++++++++++ src/client/std_include.hpp | 1 + 2 files changed, 54 insertions(+) create mode 100644 src/client/component/bots.cpp diff --git a/src/client/component/bots.cpp b/src/client/component/bots.cpp new file mode 100644 index 00000000..d3db86f3 --- /dev/null +++ b/src/client/component/bots.cpp @@ -0,0 +1,53 @@ +#include +#include "loader/component_loader.hpp" + +#include +#include + +#include + +namespace bots +{ + namespace + { + const std::vector& get_bot_names() + { + static const auto bot_names = [] + { + std::vector names{ + "momo5502", + "Maurice", + "Jasmin", + }; + + std::random_device rd; + std::mt19937 gen(rd()); + std::ranges::shuffle(names, gen); + return names; + }(); + + return bot_names; + } + + const char* get_bot_name() + { + static size_t current = 0; + const auto& names = get_bot_names(); + + current = (current + 1) % names.size(); + return names.at(current).data(); + } + } + + class component final : public component_interface + { + public: + void post_unpack() override + { + utils::hook::jump(0x141653B70_g, get_bot_name); + utils::hook::jump(0x141654280_g, get_bot_name); + } + }; +} + +REGISTER_COMPONENT(bots::component) diff --git a/src/client/std_include.hpp b/src/client/std_include.hpp index d606c2f2..f6722d42 100644 --- a/src/client/std_include.hpp +++ b/src/client/std_include.hpp @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include