2022-02-19 02:31:16 +01:00
|
|
|
#pragma once
|
2023-01-26 20:06:48 +01:00
|
|
|
#include "thirdparty/curl/include/curl/curl.h"
|
2023-04-28 23:47:58 +02:00
|
|
|
#include "bansystem.h"
|
2022-07-01 10:29:27 +02:00
|
|
|
#include "serverlisting.h"
|
2023-09-16 00:45:11 +02:00
|
|
|
#include "localize/ilocalize.h"
|
2022-02-19 02:31:16 +01:00
|
|
|
|
2024-02-24 02:15:09 +01:00
|
|
|
extern ConVar pylon_matchmaking_hostname;
|
|
|
|
extern ConVar pylon_host_update_interval;
|
|
|
|
extern ConVar pylon_showdebuginfo;
|
|
|
|
|
2024-04-05 16:26:18 +02:00
|
|
|
struct MSEulaData_t
|
|
|
|
{
|
|
|
|
int version;
|
|
|
|
string language;
|
|
|
|
string contents;
|
|
|
|
};
|
|
|
|
|
2022-07-01 10:29:27 +02:00
|
|
|
class CPylon
|
|
|
|
{
|
|
|
|
public:
|
2024-03-10 01:57:04 +01:00
|
|
|
CPylon() { SetLanguage(g_LanguageNames[0]); }
|
2023-09-16 00:45:11 +02:00
|
|
|
|
2024-03-10 01:57:04 +01:00
|
|
|
bool GetServerList(vector<NetGameServer_t>& outServerList, string& outMessage) const;
|
2023-04-24 01:55:37 +02:00
|
|
|
bool GetServerByToken(NetGameServer_t& slOutServer, string& outMessage, const string& svToken) const;
|
2023-10-15 10:40:46 +02:00
|
|
|
bool PostServerHost(string& outMessage, string& svOutToken, string& outHostIp, const NetGameServer_t& netGameServer) const;
|
2023-04-28 23:47:58 +02:00
|
|
|
|
2023-08-31 00:16:25 +02:00
|
|
|
bool GetBannedList(const CBanSystem::BannedList_t& inBannedVec, CBanSystem::BannedList_t& outBannedVec) const;
|
2023-04-29 00:05:47 +02:00
|
|
|
bool CheckForBan(const string& ipAddress, const uint64_t nucleusId, const string& personaName, string& outReason) const;
|
2023-04-24 01:55:37 +02:00
|
|
|
|
2023-10-15 10:40:46 +02:00
|
|
|
bool AuthForConnection(const uint64_t nucleusId, const char* ipAddress, const char* authCode, string& outToken, string& outMessage) const;
|
|
|
|
|
2023-10-25 23:29:37 +02:00
|
|
|
bool GetEULA(MSEulaData_t& outData, string& outMessage) const;
|
2024-04-05 16:26:18 +02:00
|
|
|
|
2023-09-07 11:17:05 +02:00
|
|
|
void ExtractError(const rapidjson::Document& resultBody, string& outMessage, CURLINFO status, const char* errorText = nullptr) const;
|
2023-04-24 01:55:37 +02:00
|
|
|
void ExtractError(const string& response, string& outMessage, CURLINFO status, const char* messageText = nullptr) const;
|
2023-04-24 00:32:27 +02:00
|
|
|
|
2023-09-07 11:17:05 +02:00
|
|
|
void LogBody(const rapidjson::Document& responseJson) const;
|
2024-04-05 16:26:18 +02:00
|
|
|
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;
|
2023-04-25 00:45:39 +02:00
|
|
|
bool QueryServer(const char* endpoint, const char* request, string& outResponse, string& outMessage, CURLINFO& outStatus) const;
|
|
|
|
|
2024-03-10 01:57:04 +01:00
|
|
|
inline void SetLanguage(const char* lang)
|
|
|
|
{
|
|
|
|
AUTO_LOCK(m_StringMutex);
|
|
|
|
m_Language = lang;
|
|
|
|
};
|
|
|
|
inline const string& GetLanguage() const
|
|
|
|
{
|
|
|
|
AUTO_LOCK(m_StringMutex);
|
|
|
|
return m_Language;
|
|
|
|
};
|
2023-08-17 20:22:28 +01:00
|
|
|
|
2023-02-04 19:18:18 +01:00
|
|
|
private:
|
2023-10-08 16:37:10 +02:00
|
|
|
string m_Language;
|
2024-03-10 01:57:04 +01:00
|
|
|
mutable CThreadFastMutex m_StringMutex;
|
2022-07-01 10:29:27 +02:00
|
|
|
};
|
2024-01-21 21:29:23 +01:00
|
|
|
extern CPylon g_MasterServer;
|