mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project. This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console). Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
60 lines
2.4 KiB
C++
60 lines
2.4 KiB
C++
#pragma once
|
|
#include "thirdparty/curl/include/curl/curl.h"
|
|
#include "bansystem.h"
|
|
#include "serverlisting.h"
|
|
#include "localize/ilocalize.h"
|
|
|
|
extern ConVar pylon_matchmaking_hostname;
|
|
extern ConVar pylon_host_update_interval;
|
|
extern ConVar pylon_showdebuginfo;
|
|
|
|
struct MSEulaData_t
|
|
{
|
|
int version;
|
|
string language;
|
|
string contents;
|
|
};
|
|
|
|
class CPylon
|
|
{
|
|
public:
|
|
CPylon() { m_Language = g_LanguageNames[0]; }
|
|
|
|
vector<NetGameServer_t> GetServerList(string& outMessage) const;
|
|
bool GetServerByToken(NetGameServer_t& slOutServer, string& outMessage, const string& svToken) const;
|
|
bool PostServerHost(string& outMessage, string& svOutToken, string& outHostIp, const NetGameServer_t& netGameServer) const;
|
|
|
|
bool GetBannedList(const CBanSystem::BannedList_t& inBannedVec, CBanSystem::BannedList_t& outBannedVec) const;
|
|
bool CheckForBan(const string& ipAddress, const uint64_t nucleusId, const string& personaName, string& outReason) const;
|
|
|
|
bool AuthForConnection(const uint64_t nucleusId, const char* ipAddress, const char* authCode, string& outToken, string& outMessage) const;
|
|
|
|
bool GetEULA(MSEulaData_t& outData, string& outMessage) const;
|
|
|
|
void ExtractError(const rapidjson::Document& resultBody, string& outMessage, CURLINFO status, const char* errorText = nullptr) const;
|
|
void ExtractError(const string& response, string& outMessage, CURLINFO status, const char* messageText = nullptr) const;
|
|
|
|
void LogBody(const rapidjson::Document& responseJson) const;
|
|
bool SendRequest(const char* endpoint, const rapidjson::Document& requestJson, rapidjson::Document& responseJson, string& outMessage, CURLINFO& status, const char* errorText = nullptr, const bool checkEula = true) const;
|
|
bool QueryServer(const char* endpoint, const char* request, string& outResponse, string& outMessage, CURLINFO& outStatus) const;
|
|
|
|
inline void SetCurrentToken(const string& token) { m_Token = token; }
|
|
inline const string& GetCurrentToken() const { return m_Token; }
|
|
|
|
inline void SetCurrentError(const string& error) { m_ErrorMsg = error; }
|
|
inline const string& GetCurrentError() const { return m_ErrorMsg; }
|
|
|
|
inline void SetHostIP(const string& ip) { m_HostIP = ip; };
|
|
inline const string& GetHostIP() const { return m_HostIP; };
|
|
|
|
inline void SetLanguage(const char* lang) { m_Language = lang; };
|
|
inline const string& GetLanguage() const { return m_Language; };
|
|
|
|
private:
|
|
string m_Token;
|
|
string m_ErrorMsg;
|
|
string m_HostIP;
|
|
string m_Language;
|
|
};
|
|
extern CPylon g_MasterServer;
|