fix: added serverinfo struct
This commit is contained in:
parent
d31fe6e855
commit
51582936c4
@ -15,7 +15,7 @@ namespace server_list
|
||||
{
|
||||
namespace
|
||||
{
|
||||
utils::hook::detour lua_gameitem_to_table_hook;
|
||||
utils::hook::detour lua_serverinfo_to_table_hook;
|
||||
|
||||
struct state
|
||||
{
|
||||
@ -77,13 +77,13 @@ namespace server_list
|
||||
callback(true, result);
|
||||
}
|
||||
|
||||
void lua_gameitem_to_table_stub(game::hks::lua_State* state, __int64 gameItem, int index)
|
||||
void lua_serverinfo_to_table_stub(game::hks::lua_State* state, game::ServerInfo serverInfo, int index)
|
||||
{
|
||||
lua_gameitem_to_table_hook.invoke(state, gameItem, index);
|
||||
lua_serverinfo_to_table_hook.invoke(state, serverInfo, index);
|
||||
|
||||
if (state)
|
||||
{
|
||||
auto botCount = atoi(game::Info_ValueForKey(gameItem + 276, "bots"));
|
||||
auto botCount = atoi(game::Info_ValueForKey(serverInfo.tags, "bots"));
|
||||
game::Lua_SetTableInt("botCount", botCount, state);
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ namespace server_list
|
||||
});
|
||||
}, scheduler::async, 200ms);
|
||||
|
||||
lua_gameitem_to_table_hook.create(0x141F1FD10_g, lua_gameitem_to_table_stub);
|
||||
lua_serverinfo_to_table_hook.create(0x141F1FD10_g, lua_serverinfo_to_table_stub);
|
||||
}
|
||||
|
||||
void pre_destroy() override
|
||||
|
@ -1032,6 +1032,32 @@ namespace game
|
||||
Agreement debugAgreement;
|
||||
JoinType joinType;
|
||||
JoinResult joinResult;
|
||||
};
|
||||
|
||||
struct ServerInfo
|
||||
{
|
||||
uint16_t m_usConnectionPort;
|
||||
uint16_t m_usQueryPort;
|
||||
uint32_t m_unIP;
|
||||
int m_nPing;
|
||||
byte unk[0x22];
|
||||
char mapname[32];
|
||||
char description[64];
|
||||
char gamemode[16];
|
||||
char modname[32];
|
||||
int playerCount;
|
||||
int maxPlayers;
|
||||
int unk2;
|
||||
int unk3;
|
||||
int unk4;
|
||||
bool dedicated;
|
||||
bool ranked;
|
||||
bool hardcore;
|
||||
bool zombies;
|
||||
char servername[64];
|
||||
char tags[128];
|
||||
int unk5;
|
||||
int unk6;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -76,7 +76,7 @@ namespace game
|
||||
WEAK symbol<bool(uint64_t, int*, bool)> Live_GetConnectivityInformation{0x141E0C380};
|
||||
|
||||
// Info
|
||||
WEAK symbol<const char* (__int64, const char* key)> Info_ValueForKey{ 0x1422E87B0 };
|
||||
WEAK symbol<const char* (const char*, const char* key)> Info_ValueForKey{ 0x1422E87B0 };
|
||||
|
||||
// MSG
|
||||
WEAK symbol<uint8_t(msg_t* msg)> MSG_ReadByte{0x142155450, 0x14050D1B0};
|
||||
|
Loading…
Reference in New Issue
Block a user