[Dedicated] Update cardtitles across clients.
This commit is contained in:
parent
e55f807003
commit
6f71a65a83
@ -144,12 +144,36 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CardTitles::SendCustomTitlesToClients()
|
||||||
|
{
|
||||||
|
const char* list = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < 18; i++)
|
||||||
|
{
|
||||||
|
char playerTitle[18] = { 0 };
|
||||||
|
|
||||||
|
if (Game::svs_clients[i].state >= 3)
|
||||||
|
{
|
||||||
|
strncpy_s(playerTitle, Game::Info_ValueForKey(Game::svs_clients[i].connectInfoString, "customTitle"), 18);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(playerTitle, 0, 18);
|
||||||
|
}
|
||||||
|
|
||||||
|
list = Utils::String::VA("%s\\%s\\%s", list, std::to_string(i).c_str(), playerTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
list = Utils::String::VA("%c customTitles \"%s", 20, list);
|
||||||
|
Game::SV_GameSendServerCommand(-1, 0, list);
|
||||||
|
}
|
||||||
|
|
||||||
void CardTitles::ParseCustomTitles(const char* msg)
|
void CardTitles::ParseCustomTitles(const char* msg)
|
||||||
{
|
{
|
||||||
const char* playerTitle;
|
const char* playerTitle;
|
||||||
for (int i = 0; i < 18; i++)
|
for (int i = 0; i < 18; i++)
|
||||||
{
|
{
|
||||||
playerTitle = Utils::Hook::Call<const char*(const char*, const char*)>(0x47C820)(msg, std::to_string(i).c_str());
|
playerTitle = Game::Info_ValueForKey(msg, std::to_string(i).c_str());
|
||||||
|
|
||||||
if (playerTitle != nullptr)
|
if (playerTitle != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,7 @@ namespace Components
|
|||||||
public:
|
public:
|
||||||
static Game::dvar_t* CustomTitleDvar;
|
static Game::dvar_t* CustomTitleDvar;
|
||||||
|
|
||||||
|
static void SendCustomTitlesToClients();
|
||||||
static void ParseCustomTitles(const char * msg);
|
static void ParseCustomTitles(const char * msg);
|
||||||
|
|
||||||
CardTitles();
|
CardTitles();
|
||||||
@ -71,5 +72,6 @@ namespace Components
|
|||||||
static const char* TableLookupByRowHook(Game::Operand * operand, tablelookuprequest_s * request);
|
static const char* TableLookupByRowHook(Game::Operand * operand, tablelookuprequest_s * request);
|
||||||
static void TableLookupByRowHookStub();
|
static void TableLookupByRowHookStub();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -452,6 +452,17 @@ namespace Components
|
|||||||
// Post initialization point
|
// Post initialization point
|
||||||
Utils::Hook(0x60BFBF, Dedicated::PostInitializationStub, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x60BFBF, Dedicated::PostInitializationStub, HOOK_JUMP).install()->quick();
|
||||||
|
|
||||||
|
// Custom cardtitles
|
||||||
|
Dedicated::OnFrame([]()
|
||||||
|
{
|
||||||
|
static std::uint64_t LastUpdate = 0;
|
||||||
|
|
||||||
|
if ((GetTickCount64() - LastUpdate) > 120 * 1000)
|
||||||
|
{
|
||||||
|
CardTitles::SendCustomTitlesToClients();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
#ifdef USE_LEGACY_SERVER_LIST
|
#ifdef USE_LEGACY_SERVER_LIST
|
||||||
|
|
||||||
// Heartbeats
|
// Heartbeats
|
||||||
|
@ -121,6 +121,8 @@ namespace Game
|
|||||||
Image_LoadFromFileWithReader_t Image_LoadFromFileWithReader = Image_LoadFromFileWithReader_t(0x53ABF0);
|
Image_LoadFromFileWithReader_t Image_LoadFromFileWithReader = Image_LoadFromFileWithReader_t(0x53ABF0);
|
||||||
Image_Release_t Image_Release = Image_Release_t(0x51F010);
|
Image_Release_t Image_Release = Image_Release_t(0x51F010);
|
||||||
|
|
||||||
|
Info_ValueForKey_t Info_ValueForKey = Info_ValueForKey_t(0x47C820);
|
||||||
|
|
||||||
Key_SetCatcher_t Key_SetCatcher = Key_SetCatcher_t(0x43BD00);
|
Key_SetCatcher_t Key_SetCatcher = Key_SetCatcher_t(0x43BD00);
|
||||||
|
|
||||||
LargeLocalInit_t LargeLocalInit = LargeLocalInit_t(0x4A62A0);
|
LargeLocalInit_t LargeLocalInit = LargeLocalInit_t(0x4A62A0);
|
||||||
|
@ -304,6 +304,9 @@ namespace Game
|
|||||||
typedef void(__cdecl * Image_Release_t)(GfxImage* image);
|
typedef void(__cdecl * Image_Release_t)(GfxImage* image);
|
||||||
extern Image_Release_t Image_Release;
|
extern Image_Release_t Image_Release;
|
||||||
|
|
||||||
|
typedef char*(__cdecl * Info_ValueForKey_t)(const char* infoString, const char* key);
|
||||||
|
extern Info_ValueForKey_t Info_ValueForKey;
|
||||||
|
|
||||||
typedef void(__cdecl * Key_SetCatcher_t)(int localClientNum, int catcher);
|
typedef void(__cdecl * Key_SetCatcher_t)(int localClientNum, int catcher);
|
||||||
extern Key_SetCatcher_t Key_SetCatcher;
|
extern Key_SetCatcher_t Key_SetCatcher;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user