Start working on issue

This commit is contained in:
momo5502 2016-09-05 19:55:47 +02:00
parent e43a645712
commit 7ed67debfc
4 changed files with 53 additions and 0 deletions

View File

@ -56,6 +56,7 @@ namespace Components
Loader::Register(new BitMessage());
#endif
Loader::Register(new FileSystem());
Loader::Register(new PlayerName());
Loader::Register(new QuickPatch());
Loader::Register(new ServerInfo());
Loader::Register(new ServerList());

View File

@ -69,6 +69,7 @@ namespace Components
#include "Modules\Singleton.hpp"
#include "Modules\BitMessage.hpp"
#include "Modules\FileSystem.hpp"
#include "Modules\PlayerName.hpp"
#include "Modules\QuickPatch.hpp"
#include "Modules\ServerInfo.hpp"
#include "Modules\ServerList.hpp"

View File

@ -0,0 +1,33 @@
#include "STDInclude.hpp"
namespace Components
{
std::string PlayerName::PlayerNames[18];
int PlayerName::GetClientName(int /*localClientNum*/, int index, char *buf, int size)
{
if (index < 0 || index >= 18) return 0;
return strncpy_s(buf, size, PlayerName::PlayerNames[index].data(), PlayerName::PlayerNames[index].size()) == 0;
}
PlayerName::PlayerName()
{
if (0)
{
for (int i = 0; i < ARRAY_SIZE(PlayerName::PlayerNames); ++i)
{
PlayerName::PlayerNames[i] = "mumu";
}
Utils::Hook(Game::CL_GetClientName, PlayerName::GetClientName, HOOK_JUMP).Install()->Quick();
}
}
PlayerName::~PlayerName()
{
for (int i = 0; i < ARRAY_SIZE(PlayerName::PlayerNames); ++i)
{
PlayerName::PlayerNames[i].clear();
}
}
}

View File

@ -0,0 +1,18 @@
namespace Components
{
class PlayerName : public Component
{
public:
PlayerName();
~PlayerName();
#ifdef DEBUG
const char* GetName() { return "PlayerName"; };
#endif
private:
static std::string PlayerNames[18];
static int GetClientName(int localClientNum, int index, char *buf, int size);
};
}