mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Rename 'OriginID' to 'NucleusID'
Nucleus ID is the official internal term for the platform user id used by the OriginSDK.
This commit is contained in:
parent
22fa9bbef9
commit
afad5b92ec
@ -37,11 +37,11 @@ uint32_t CClient::GetUserID(void) const
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: gets the originID of this client
|
||||
// Purpose: gets the nucleusID of this client
|
||||
//---------------------------------------------------------------------------------
|
||||
uint64_t CClient::GetOriginID(void) const
|
||||
uint64_t CClient::GetNucleusID(void) const
|
||||
{
|
||||
return m_nOriginID;
|
||||
return m_nNucleusID;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
@ -101,11 +101,11 @@ void CClient::SetUserID(uint32_t nUserID)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: sets the originID of this client
|
||||
// Purpose: sets the nucleusID of this client
|
||||
//---------------------------------------------------------------------------------
|
||||
void CClient::SetOriginID(uint64_t nOriginID)
|
||||
void CClient::SetNucleusID(uint64_t nNucleusID)
|
||||
{
|
||||
m_nOriginID = nOriginID;
|
||||
m_nNucleusID = nNucleusID;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
CClient* GetClient(int nIndex) const;
|
||||
uint16_t GetHandle(void) const;
|
||||
uint32_t GetUserID(void) const;
|
||||
uint64_t GetOriginID(void) const;
|
||||
uint64_t GetNucleusID(void) const;
|
||||
SIGNONSTATE GetSignonState(void) const;
|
||||
PERSISTENCE GetPersistenceState(void) const;
|
||||
CNetChan* GetNetChan(void) const;
|
||||
@ -26,7 +26,7 @@ public:
|
||||
const char* GetClientName(void) const;
|
||||
void SetHandle(uint16_t nHandle);
|
||||
void SetUserID(uint32_t nUserID);
|
||||
void SetOriginID(uint64_t nOriginID);
|
||||
void SetNucleusID(uint64_t nNucleusID);
|
||||
void SetSignonState(SIGNONSTATE nSignonState);
|
||||
void SetPersistenceState(PERSISTENCE nPersistenceState);
|
||||
void SetNetChan(CNetChan* pNetChan);
|
||||
@ -58,7 +58,7 @@ private:
|
||||
char pad_03A8[8]; //0x03A8
|
||||
SIGNONSTATE m_nSignonState; //0x03B0
|
||||
int32_t m_nDeltaTick; //0x03B4
|
||||
uint64_t m_nOriginID; //0x03B8
|
||||
uint64_t m_nNucleusID; //0x03B8
|
||||
int32_t m_nStringTableAckTick; //0x03BC
|
||||
int32_t m_nSignonTick; //0x03C0
|
||||
char pad_03C0[464]; //0x03C4
|
||||
|
@ -60,10 +60,10 @@ void CBanSystem::Load(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
uint64_t nOriginID = jsEntry["originID"].get<uint64_t>();
|
||||
uint64_t nNucleusID = jsEntry["nucleusID"].get<uint64_t>();
|
||||
string svIpAddress = jsEntry["ipAddress"].get<string>();
|
||||
|
||||
m_vBanList.push_back(std::make_pair(svIpAddress, nOriginID));
|
||||
m_vBanList.push_back(std::make_pair(svIpAddress, nNucleusID));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -84,7 +84,7 @@ void CBanSystem::Save(void) const
|
||||
{
|
||||
jsOut["totalBans"] = m_vBanList.size();
|
||||
jsOut[std::to_string(i)]["ipAddress"] = m_vBanList[i].first;
|
||||
jsOut[std::to_string(i)]["originID"] = m_vBanList[i].second;
|
||||
jsOut[std::to_string(i)]["nucleusID"] = m_vBanList[i].second;
|
||||
}
|
||||
|
||||
fs::path path = std::filesystem::current_path() /= "platform\\banlist.json"; // !TODO: Use FS "PLATFORM".
|
||||
@ -96,16 +96,16 @@ void CBanSystem::Save(void) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: adds a banned player entry to the banlist
|
||||
// Input : &svIpAddress -
|
||||
// nOriginID -
|
||||
// nNucleusID -
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBanSystem::AddEntry(const string& svIpAddress, const uint64_t nOriginID)
|
||||
bool CBanSystem::AddEntry(const string& svIpAddress, const uint64_t nNucleusID)
|
||||
{
|
||||
if (!svIpAddress.empty())
|
||||
{
|
||||
auto it = std::find(m_vBanList.begin(), m_vBanList.end(), std::make_pair(svIpAddress, nOriginID));
|
||||
auto it = std::find(m_vBanList.begin(), m_vBanList.end(), std::make_pair(svIpAddress, nNucleusID));
|
||||
if (it == m_vBanList.end())
|
||||
{
|
||||
m_vBanList.push_back(std::make_pair(svIpAddress, nOriginID));
|
||||
m_vBanList.push_back(std::make_pair(svIpAddress, nNucleusID));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -115,14 +115,14 @@ bool CBanSystem::AddEntry(const string& svIpAddress, const uint64_t nOriginID)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: deletes an entry in the banlist
|
||||
// Input : &svIpAddress -
|
||||
// nOriginID -
|
||||
// nNucleusID -
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBanSystem::DeleteEntry(const string& svIpAddress, const uint64_t nOriginID)
|
||||
bool CBanSystem::DeleteEntry(const string& svIpAddress, const uint64_t nNucleusID)
|
||||
{
|
||||
bool result = false;
|
||||
for (size_t i = 0; i < m_vBanList.size(); i++)
|
||||
{
|
||||
if (svIpAddress.compare(m_vBanList[i].first) == NULL || nOriginID == m_vBanList[i].second)
|
||||
if (svIpAddress.compare(m_vBanList[i].first) == NULL || nNucleusID == m_vBanList[i].second)
|
||||
{
|
||||
m_vBanList.erase(m_vBanList.begin() + i);
|
||||
result = true;
|
||||
@ -135,21 +135,21 @@ bool CBanSystem::DeleteEntry(const string& svIpAddress, const uint64_t nOriginID
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: adds a connect refuse entry to the refuselist
|
||||
// Input : &svError -
|
||||
// nOriginID -
|
||||
// nNucleusID -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBanSystem::AddConnectionRefuse(const string& svError, const uint64_t nOriginID)
|
||||
void CBanSystem::AddConnectionRefuse(const string& svError, const uint64_t nNucleusID)
|
||||
{
|
||||
if (m_vRefuseList.empty())
|
||||
{
|
||||
m_vRefuseList.push_back(std::make_pair(svError, nOriginID));
|
||||
m_vRefuseList.push_back(std::make_pair(svError, nNucleusID));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < m_vRefuseList.size(); i++)
|
||||
{
|
||||
if (m_vRefuseList[i].second != nOriginID)
|
||||
if (m_vRefuseList[i].second != nNucleusID)
|
||||
{
|
||||
m_vRefuseList.push_back(std::make_pair(svError, nOriginID));
|
||||
m_vRefuseList.push_back(std::make_pair(svError, nNucleusID));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,13 +157,13 @@ void CBanSystem::AddConnectionRefuse(const string& svError, const uint64_t nOrig
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: deletes an entry in the refuselist
|
||||
// Input : nOriginID -
|
||||
// Input : nNucleusID -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBanSystem::DeleteConnectionRefuse(const uint64_t nOriginID)
|
||||
void CBanSystem::DeleteConnectionRefuse(const uint64_t nNucleusID)
|
||||
{
|
||||
for (size_t i = 0; i < m_vRefuseList.size(); i++)
|
||||
{
|
||||
if (m_vRefuseList[i].second == nOriginID)
|
||||
if (m_vRefuseList[i].second == nNucleusID)
|
||||
{
|
||||
m_vRefuseList.erase(m_vRefuseList.begin() + i);
|
||||
}
|
||||
@ -190,15 +190,15 @@ void CBanSystem::BanListCheck(void)
|
||||
if (!pNetChan)
|
||||
continue;
|
||||
|
||||
if (pClient->GetOriginID() != m_vRefuseList[i].second)
|
||||
if (pClient->GetNucleusID() != m_vRefuseList[i].second)
|
||||
continue;
|
||||
|
||||
string svIpAddress = pNetChan->GetAddress();
|
||||
|
||||
Warning(eDLL_T::SERVER, "Connection rejected for '%s' ('%llu' is banned from this server!)\n", svIpAddress.c_str(), pClient->GetOriginID());
|
||||
Warning(eDLL_T::SERVER, "Connection rejected for '%s' ('%llu' is banned from this server!)\n", svIpAddress.c_str(), pClient->GetNucleusID());
|
||||
NET_DisconnectClient(pClient, c, m_vRefuseList[i].first.c_str(), 0, true);
|
||||
|
||||
if (AddEntry(svIpAddress, pClient->GetOriginID() && !bSave))
|
||||
if (AddEntry(svIpAddress, pClient->GetNucleusID() && !bSave))
|
||||
bSave = true;
|
||||
}
|
||||
}
|
||||
@ -211,24 +211,24 @@ void CBanSystem::BanListCheck(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: checks if specified ip address or necleus id is banned
|
||||
// Input : &svIpAddress -
|
||||
// nOriginID -
|
||||
// nNucleusID -
|
||||
// Output : true if banned, false if not banned
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBanSystem::IsBanned(const string& svIpAddress, const uint64_t nOriginID) const
|
||||
bool CBanSystem::IsBanned(const string& svIpAddress, const uint64_t nNucleusID) const
|
||||
{
|
||||
for (size_t i = 0; i < m_vBanList.size(); i++)
|
||||
{
|
||||
string ipAddress = m_vBanList[i].first;
|
||||
uint64_t originID = m_vBanList[i].second;
|
||||
uint64_t nucleusID = m_vBanList[i].second;
|
||||
|
||||
if (ipAddress.empty() ||
|
||||
!originID) // Cannot be null.
|
||||
!nucleusID) // Cannot be null.
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ipAddress.compare(svIpAddress) == NULL ||
|
||||
nOriginID == originID)
|
||||
nNucleusID == nucleusID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -9,15 +9,15 @@ public:
|
||||
void Load(void);
|
||||
void Save(void) const;
|
||||
|
||||
bool AddEntry(const string& svIpAddress, const uint64_t nOriginID);
|
||||
bool DeleteEntry(const string& svIpAddress, const uint64_t nOriginID);
|
||||
bool AddEntry(const string& svIpAddress, const uint64_t nNucleusID);
|
||||
bool DeleteEntry(const string& svIpAddress, const uint64_t nNucleusID);
|
||||
|
||||
void AddConnectionRefuse(const string& svError, const uint64_t nOriginID);
|
||||
void DeleteConnectionRefuse(const uint64_t nOriginID);
|
||||
void AddConnectionRefuse(const string& svError, const uint64_t nNucleusID);
|
||||
void DeleteConnectionRefuse(const uint64_t nNucleusID);
|
||||
|
||||
void BanListCheck(void);
|
||||
|
||||
bool IsBanned(const string& svIpAddress, const uint64_t nOriginID) const;
|
||||
bool IsBanned(const string& svIpAddress, const uint64_t nNucleusID) const;
|
||||
bool IsRefuseListValid(void) const;
|
||||
bool IsBanListValid(void) const;
|
||||
|
||||
|
@ -358,14 +358,14 @@ bool CPylon::GetServerByToken(NetGameServer_t& slOutServer, string& svOutMessage
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Checks if client is banned on the comp server.
|
||||
// Input : svIpAddress -
|
||||
// nOriginID -
|
||||
// nNucleusID -
|
||||
// &svOutErrCl -
|
||||
// Output : Returns true if banned, false if not banned.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CPylon::CheckForBan(const string& svIpAddress, uint64_t nOriginID, string& svOutErrCl)
|
||||
bool CPylon::CheckForBan(const string& svIpAddress, uint64_t nNucleusID, string& svOutErrCl)
|
||||
{
|
||||
nlohmann::json jsRequestBody = nlohmann::json::object();
|
||||
jsRequestBody["oid"] = nOriginID;
|
||||
jsRequestBody["id"] = nNucleusID;
|
||||
jsRequestBody["ip"] = svIpAddress;
|
||||
|
||||
httplib::Client htClient(pylon_matchmaking_hostname->GetString()); htClient.set_connection_timeout(10);
|
||||
|
@ -9,6 +9,6 @@ public:
|
||||
vector<NetGameServer_t> GetServerList(string& svOutMessage);
|
||||
bool PostServerHost(string& svOutMessage, string& svOutToken, const NetGameServer_t& slServerListing);
|
||||
bool GetServerByToken(NetGameServer_t& slOutServer, string& svOutMessage, const string& svToken);
|
||||
bool CheckForBan(const string& svIpAddress, uint64_t nOriginID, string& svOutErrCl);
|
||||
bool CheckForBan(const string& svIpAddress, uint64_t nNucleusID, string& svOutErrCl);
|
||||
};
|
||||
extern CPylon* g_pMasterServer;
|
||||
|
@ -24,13 +24,13 @@ bool HIVEngineServer__PersistenceAvailable(void* entidx, int clienthandle)
|
||||
|
||||
string svClientName = pNetChan->GetName();
|
||||
string svIpAddress = pNetChan->GetAddress();
|
||||
uint64_t nOriginID = pClient->GetOriginID();
|
||||
uint64_t nNucleusID = pClient->GetNucleusID();
|
||||
|
||||
DevMsg(eDLL_T::SERVER, "______________________________________________________________\n");
|
||||
DevMsg(eDLL_T::SERVER, "+- NetChannel:\n");
|
||||
DevMsg(eDLL_T::SERVER, "+- Enabled persistence for NetChannel:\n");
|
||||
DevMsg(eDLL_T::SERVER, " |- IDX : | '#%d'\n", clienthandle);
|
||||
DevMsg(eDLL_T::SERVER, " |- UID : | '%s'\n", svClientName.c_str());
|
||||
DevMsg(eDLL_T::SERVER, " |- OID : | '%llu'\n", nOriginID);
|
||||
DevMsg(eDLL_T::SERVER, " |- PID : | '%llu'\n", nNucleusID);
|
||||
DevMsg(eDLL_T::SERVER, " |- ADR : | '%s'\n", svIpAddress.c_str());
|
||||
DevMsg(eDLL_T::SERVER, " -------------------------------------------------------------\n");
|
||||
|
||||
|
@ -333,11 +333,11 @@ void ConCommand::Init(void)
|
||||
// SERVER DLL |
|
||||
#ifndef CLIENT_DLL
|
||||
ConCommand::Create("script", "Run input code as SERVER script on the VM.", FCVAR_CHEAT, SQVM_ServerScript_f, nullptr);
|
||||
ConCommand::Create("sv_kick", "Kick a client from the server by name. | Usage: kick \"<name>\".", FCVAR_RELEASE, Host_Kick_f, nullptr);
|
||||
ConCommand::Create("sv_kickid", "Kick a client from the server by UserID or OriginID | Usage: kickid \"<UserID>\"/\"<OriginID>\".", FCVAR_RELEASE, Host_KickID_f, nullptr);
|
||||
ConCommand::Create("sv_ban", "Bans a client from the server by name. | Usage: ban <name>.", FCVAR_RELEASE, Host_Ban_f, nullptr);
|
||||
ConCommand::Create("sv_banid", "Bans a client from the server by UserID, OriginID or IPAddress | Usage: banid \"<UserID>\"/\"<OriginID>/<IPAddress>\".", FCVAR_RELEASE, Host_BanID_f, nullptr);
|
||||
ConCommand::Create("sv_unban", "Unbans a client from the server by OriginID or IPAddress | Usage: unban \"<OriginID>\"/\"<IPAddress>\".", FCVAR_RELEASE, Host_Unban_f, nullptr);
|
||||
ConCommand::Create("sv_kick", "Kick a client from the server by user name. | Usage: sv_kick \"<UserID>\".", FCVAR_RELEASE, Host_Kick_f, nullptr);
|
||||
ConCommand::Create("sv_kickid", "Kick a client from the server by handle or platform id | Usage: sv_kickid \"<HandleID>\"/\"<NucleusID>\".", FCVAR_RELEASE, Host_KickID_f, nullptr);
|
||||
ConCommand::Create("sv_ban", "Bans a client from the server by user name. | Usage: sv_ban <UserID>.", FCVAR_RELEASE, Host_Ban_f, nullptr);
|
||||
ConCommand::Create("sv_banid", "Bans a client from the server by handle, platform id or ip address | Usage: sv_banid \"<HandleID>\"/\"<NucleusID>/<IPAddress>\".", FCVAR_RELEASE, Host_BanID_f, nullptr);
|
||||
ConCommand::Create("sv_unban", "Unbans a client from the server by platform id or ip address | Usage: sv_unban \"<NucleusID>\"/\"<IPAddress>\".", FCVAR_RELEASE, Host_Unban_f, nullptr);
|
||||
ConCommand::Create("sv_reloadbanlist", "Reloads the ban list from the disk.", FCVAR_RELEASE, Host_ReloadBanList_f, nullptr);
|
||||
#endif // !CLIENT_DLL
|
||||
#ifndef DEDICATED
|
||||
|
@ -153,10 +153,10 @@ void Host_KickID_f(const CCommand& args)
|
||||
if (bOnlyDigits)
|
||||
{
|
||||
uint64_t nTargetID = static_cast<uint64_t>(std::stoll(args.Arg(1)));
|
||||
if (nTargetID > MAX_PLAYERS) // Is it a possible originID?
|
||||
if (nTargetID > MAX_PLAYERS) // Is it a possible nucleusID?
|
||||
{
|
||||
uint64_t nOriginID = pClient->GetOriginID();
|
||||
if (nOriginID != nTargetID)
|
||||
uint64_t nNucleusID = pClient->GetNucleusID();
|
||||
if (nNucleusID != nTargetID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -185,7 +185,7 @@ void Host_KickID_f(const CCommand& args)
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
Error(eDLL_T::SERVER, false, "%s - sv_kickid requires a UserID or OriginID. You can get the UserID with the 'status' command. Error: %s", __FUNCTION__, e.what());
|
||||
Error(eDLL_T::SERVER, false, "%s - sv_kickid requires a handle or platform id. You can get the handle with the 'status' command.\n Error: %s", __FUNCTION__, e.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ void Host_Ban_f(const CCommand& args)
|
||||
{
|
||||
if (strcmp(args.Arg(1), pNetChan->GetName()) == NULL) // Our wanted name?
|
||||
{
|
||||
if (g_pBanSystem->AddEntry(pNetChan->GetAddress(), pClient->GetOriginID()) && !bSave)
|
||||
if (g_pBanSystem->AddEntry(pNetChan->GetAddress(), pClient->GetNucleusID()) && !bSave)
|
||||
{
|
||||
bSave = true;
|
||||
}
|
||||
@ -259,10 +259,10 @@ void Host_BanID_f(const CCommand& args)
|
||||
if (bOnlyDigits)
|
||||
{
|
||||
uint64_t nTargetID = static_cast<uint64_t>(std::stoll(args.Arg(1)));
|
||||
if (nTargetID > static_cast<uint64_t>(MAX_PLAYERS)) // Is it a possible originID?
|
||||
if (nTargetID > static_cast<uint64_t>(MAX_PLAYERS)) // Is it a possible nucleusID?
|
||||
{
|
||||
uint64_t nOriginID = pClient->GetOriginID();
|
||||
if (nOriginID != nTargetID)
|
||||
uint64_t nNucleusID = pClient->GetNucleusID();
|
||||
if (nNucleusID != nTargetID)
|
||||
continue;
|
||||
}
|
||||
else // If its not try by handle.
|
||||
@ -272,7 +272,7 @@ void Host_BanID_f(const CCommand& args)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (g_pBanSystem->AddEntry(pNetChan->GetAddress(), pClient->GetOriginID()) && !bSave)
|
||||
if (g_pBanSystem->AddEntry(pNetChan->GetAddress(), pClient->GetNucleusID()) && !bSave)
|
||||
bSave = true;
|
||||
|
||||
g_pBanSystem->Save();
|
||||
@ -283,7 +283,7 @@ void Host_BanID_f(const CCommand& args)
|
||||
if (strcmp(args.Arg(1), pNetChan->GetAddress()) != NULL)
|
||||
continue;
|
||||
|
||||
if (g_pBanSystem->AddEntry(pNetChan->GetAddress(), pClient->GetOriginID()) && !bSave)
|
||||
if (g_pBanSystem->AddEntry(pNetChan->GetAddress(), pClient->GetNucleusID()) && !bSave)
|
||||
bSave = true;
|
||||
|
||||
g_pBanSystem->Save();
|
||||
@ -296,7 +296,7 @@ void Host_BanID_f(const CCommand& args)
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
Error(eDLL_T::SERVER, false, "%s - Banid Error: %s", __FUNCTION__, e.what());
|
||||
Error(eDLL_T::SERVER, false, "%s - Ban error:\n%s\n", __FUNCTION__, e.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -332,7 +332,7 @@ void Host_Unban_f(const CCommand& args)
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
Error(eDLL_T::SERVER, false, "%s - Unban error: %s", __FUNCTION__, e.what());
|
||||
Error(eDLL_T::SERVER, false, "%s - Unban error:\n%s\n", __FUNCTION__, e.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user