Overwrite bot names

This commit is contained in:
momo5502 2022-11-20 17:44:08 +01:00
parent 97ddddef78
commit 1bb9add331
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,53 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include <utils/nt.hpp>
#include <utils/hook.hpp>
#include <game/game.hpp>
namespace bots
{
namespace
{
const std::vector<std::string>& get_bot_names()
{
static const auto bot_names = []
{
std::vector<std::string> 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)

View File

@ -72,6 +72,7 @@
#include <utility>
#include <filesystem>
#include <functional>
#include <random>
#include <sstream>
#include <optional>
#include <unordered_set>