Consistency Fixes (ID->Id, AuthString->AuthId)
This commit is contained in:
parent
3fba1d2817
commit
7f3656215b
@ -1914,7 +1914,7 @@ CPlayer::CPlayer()
|
|||||||
m_bIsSourceTV = false;
|
m_bIsSourceTV = false;
|
||||||
m_bIsReplay = false;
|
m_bIsReplay = false;
|
||||||
m_Serial.value = -1;
|
m_Serial.value = -1;
|
||||||
m_SteamID = k_steamIDNil;
|
m_SteamId = k_steamIDNil;
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
m_LanguageCookie = InvalidQueryCvarCookie;
|
m_LanguageCookie = InvalidQueryCvarCookie;
|
||||||
#endif
|
#endif
|
||||||
@ -1997,7 +1997,7 @@ void CPlayer::Disconnect()
|
|||||||
m_bIsSourceTV = false;
|
m_bIsSourceTV = false;
|
||||||
m_bIsReplay = false;
|
m_bIsReplay = false;
|
||||||
m_Serial.value = -1;
|
m_Serial.value = -1;
|
||||||
m_SteamID = k_steamIDNil;
|
m_SteamId = k_steamIDNil;
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
m_LanguageCookie = InvalidQueryCvarCookie;
|
m_LanguageCookie = InvalidQueryCvarCookie;
|
||||||
#endif
|
#endif
|
||||||
@ -2033,7 +2033,7 @@ const char *CPlayer::GetAuthString(bool validated)
|
|||||||
return m_AuthID.c_str();
|
return m_AuthID.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CSteamID &CPlayer::GetSteamID(bool validated)
|
const CSteamID &CPlayer::GetSteamId(bool validated)
|
||||||
{
|
{
|
||||||
if (IsFakeClient() || (validated && !IsAuthStringValidated()))
|
if (IsFakeClient() || (validated && !IsAuthStringValidated()))
|
||||||
{
|
{
|
||||||
@ -2041,9 +2041,9 @@ const CSteamID &CPlayer::GetSteamID(bool validated)
|
|||||||
return invalidId;
|
return invalidId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_SteamID.IsValid())
|
if (m_SteamId.IsValid())
|
||||||
{
|
{
|
||||||
return m_SteamID;
|
return m_SteamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
@ -2051,7 +2051,7 @@ const CSteamID &CPlayer::GetSteamID(bool validated)
|
|||||||
/* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */
|
/* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */
|
||||||
if (pAuth && (strlen(pAuth) > 10) && pAuth[8] != '_')
|
if (pAuth && (strlen(pAuth) > 10) && pAuth[8] != '_')
|
||||||
{
|
{
|
||||||
m_SteamID = CSteamID(atoi(&pAuth[8]) | (atoi(&pAuth[10]) << 1),
|
m_SteamId = CSteamID(atoi(&pAuth[8]) | (atoi(&pAuth[10]) << 1),
|
||||||
k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeIndividual);
|
k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeIndividual);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -2064,17 +2064,17 @@ const CSteamID &CPlayer::GetSteamID(bool validated)
|
|||||||
|
|
||||||
if (steamId)
|
if (steamId)
|
||||||
{
|
{
|
||||||
m_SteamID = (*steamId);
|
m_SteamId = (*steamId);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return m_SteamID;
|
return m_SteamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CPlayer::GetSteamAccountID(bool validated)
|
unsigned int CPlayer::GetSteamAccountID(bool validated)
|
||||||
{
|
{
|
||||||
if (!IsFakeClient() && (!validated || IsAuthStringValidated()))
|
if (!IsFakeClient() && (!validated || IsAuthStringValidated()))
|
||||||
{
|
{
|
||||||
const CSteamID &id = GetSteamID();
|
const CSteamID &id = GetSteamId();
|
||||||
if (id.IsValid())
|
if (id.IsValid())
|
||||||
return id.GetAccountID();
|
return id.GetAccountID();
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ public:
|
|||||||
const char *GetIPAddress();
|
const char *GetIPAddress();
|
||||||
const char *GetAuthString(bool validated = true);
|
const char *GetAuthString(bool validated = true);
|
||||||
unsigned int GetSteamAccountID(bool validated = true);
|
unsigned int GetSteamAccountID(bool validated = true);
|
||||||
const CSteamID &GetSteamID(bool validated = true);
|
const CSteamID &GetSteamId(bool validated = true);
|
||||||
uint64_t GetSteamID64(bool validated = true) { return GetSteamID(validated).ConvertToUint64(); }
|
uint64_t GetSteamId64(bool validated = true) { return GetSteamId(validated).ConvertToUint64(); }
|
||||||
edict_t *GetEdict();
|
edict_t *GetEdict();
|
||||||
bool IsInGame();
|
bool IsInGame();
|
||||||
bool WasCountedAsInGame();
|
bool WasCountedAsInGame();
|
||||||
@ -134,7 +134,7 @@ private:
|
|||||||
bool m_bIsSourceTV;
|
bool m_bIsSourceTV;
|
||||||
bool m_bIsReplay;
|
bool m_bIsReplay;
|
||||||
serial_t m_Serial;
|
serial_t m_Serial;
|
||||||
CSteamID m_SteamID;
|
CSteamID m_SteamId;
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
QueryCvarCookie_t m_LanguageCookie;
|
QueryCvarCookie_t m_LanguageCookie;
|
||||||
#endif
|
#endif
|
||||||
|
@ -332,15 +332,15 @@ static cell_t sm_GetClientIP(IPluginContext *pCtx, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Must match clients.inc
|
// Must match clients.inc
|
||||||
enum class AuthStringType
|
enum class AuthIdType
|
||||||
{
|
{
|
||||||
Engine = 0,
|
Engine = 0,
|
||||||
Steam2,
|
Steam2,
|
||||||
Steam3,
|
Steam3,
|
||||||
SteamID64,
|
SteamId64,
|
||||||
};
|
};
|
||||||
|
|
||||||
static cell_t SteamIDToLocal(IPluginContext *pCtx, int index, AuthStringType authType, cell_t local_addr, size_t bytes, bool validate)
|
static cell_t SteamIdToLocal(IPluginContext *pCtx, int index, AuthIdType authType, cell_t local_addr, size_t bytes, bool validate)
|
||||||
{
|
{
|
||||||
if ((index < 1) || (index > playerhelpers->GetMaxClients()))
|
if ((index < 1) || (index > playerhelpers->GetMaxClients()))
|
||||||
{
|
{
|
||||||
@ -355,7 +355,7 @@ static cell_t SteamIDToLocal(IPluginContext *pCtx, int index, AuthStringType aut
|
|||||||
|
|
||||||
switch (authType)
|
switch (authType)
|
||||||
{
|
{
|
||||||
case AuthStringType::Engine:
|
case AuthIdType::Engine:
|
||||||
{
|
{
|
||||||
const char *authstr = pPlayer->GetAuthString(validate);
|
const char *authstr = pPlayer->GetAuthString(validate);
|
||||||
if (!authstr || authstr[0] == '\0')
|
if (!authstr || authstr[0] == '\0')
|
||||||
@ -366,8 +366,8 @@ static cell_t SteamIDToLocal(IPluginContext *pCtx, int index, AuthStringType aut
|
|||||||
pCtx->StringToLocal(local_addr, bytes, authstr);
|
pCtx->StringToLocal(local_addr, bytes, authstr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AuthStringType::Steam2:
|
case AuthIdType::Steam2:
|
||||||
case AuthStringType::Steam3:
|
case AuthIdType::Steam3:
|
||||||
{
|
{
|
||||||
if (pPlayer->IsFakeClient())
|
if (pPlayer->IsFakeClient())
|
||||||
{
|
{
|
||||||
@ -375,7 +375,7 @@ static cell_t SteamIDToLocal(IPluginContext *pCtx, int index, AuthStringType aut
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t steamId = pPlayer->GetSteamID64(validate);
|
uint64_t steamId = pPlayer->GetSteamId64(validate);
|
||||||
if (steamId == 0)
|
if (steamId == 0)
|
||||||
{
|
{
|
||||||
if (gamehelpers->IsLANServer())
|
if (gamehelpers->IsLANServer())
|
||||||
@ -398,7 +398,7 @@ static cell_t SteamIDToLocal(IPluginContext *pCtx, int index, AuthStringType aut
|
|||||||
unsigned int universe = steamId >> 56;
|
unsigned int universe = steamId >> 56;
|
||||||
unsigned int accountId = steamId & 0xFFFFFFFF;
|
unsigned int accountId = steamId & 0xFFFFFFFF;
|
||||||
unsigned int instance = (steamId >> 32) & 0x000FFFFF;
|
unsigned int instance = (steamId >> 32) & 0x000FFFFF;
|
||||||
if (authType == AuthStringType::Steam2)
|
if (authType == AuthIdType::Steam2)
|
||||||
{
|
{
|
||||||
if (atoi(g_pGameConf->GetKeyValue("UseInvalidUniverseInSteam2IDs")) == 1)
|
if (atoi(g_pGameConf->GetKeyValue("UseInvalidUniverseInSteam2IDs")) == 1)
|
||||||
{
|
{
|
||||||
@ -420,14 +420,14 @@ static cell_t SteamIDToLocal(IPluginContext *pCtx, int index, AuthStringType aut
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AuthStringType::SteamID64:
|
case AuthIdType::SteamId64:
|
||||||
{
|
{
|
||||||
if (pPlayer->IsFakeClient() || gamehelpers->IsLANServer())
|
if (pPlayer->IsFakeClient() || gamehelpers->IsLANServer())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t steamId = pPlayer->GetSteamID64(validate);
|
uint64_t steamId = pPlayer->GetSteamId64(validate);
|
||||||
if (steamId == 0)
|
if (steamId == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -452,12 +452,12 @@ static cell_t sm_GetClientAuthStr(IPluginContext *pCtx, const cell_t *params)
|
|||||||
validate = !!params[4];
|
validate = !!params[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
return SteamIDToLocal(pCtx, params[1], AuthStringType::Steam2, params[2], (size_t)params[3], validate);
|
return SteamIdToLocal(pCtx, params[1], AuthIdType::Steam2, params[2], (size_t)params[3], validate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_GetClientAuthId(IPluginContext *pCtx, const cell_t *params)
|
static cell_t sm_GetClientAuthId(IPluginContext *pCtx, const cell_t *params)
|
||||||
{
|
{
|
||||||
return SteamIDToLocal(pCtx, params[1], (AuthStringType)params[2], params[3], (size_t)params[4], params[5] != 0);
|
return SteamIdToLocal(pCtx, params[1], (AuthIdType)params[2], params[3], (size_t)params[4], params[5] != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_GetSteamAccountID(IPluginContext *pCtx, const cell_t *params)
|
static cell_t sm_GetSteamAccountID(IPluginContext *pCtx, const cell_t *params)
|
||||||
|
@ -54,14 +54,14 @@ enum NetFlow
|
|||||||
* "STEAM_ID_LAN" - Authentication is disabled because of being on a LAN server.
|
* "STEAM_ID_LAN" - Authentication is disabled because of being on a LAN server.
|
||||||
* "BOT" - The client is a bot.
|
* "BOT" - The client is a bot.
|
||||||
*/
|
*/
|
||||||
enum AuthStringType
|
enum AuthIdType
|
||||||
{
|
{
|
||||||
AuthString_Engine = 0, /**< The game-specific auth string as returned from the engine */
|
AuthId_Engine = 0, /**< The game-specific auth string as returned from the engine */
|
||||||
|
|
||||||
// The following are only available on games that support Steam authentication.
|
// The following are only available on games that support Steam authentication.
|
||||||
AuthString_Steam2, /**< Steam2 rendered format, ex "STEAM_1:1:4153990" */
|
AuthId_Steam2, /**< Steam2 rendered format, ex "STEAM_1:1:4153990" */
|
||||||
AuthString_Steam3, /**< Steam3 rendered format, ex "[U:1:8307981]" */
|
AuthId_Steam3, /**< Steam3 rendered format, ex "[U:1:8307981]" */
|
||||||
AuthString_SteamID64, /**< A SteamID64 (uint64) as a String, ex "76561197968573709" */
|
AuthId_SteamID64, /**< A SteamID64 (uint64) as a String, ex "76561197968573709" */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,8 +293,8 @@ native bool:GetClientAuthString(client, String:auth[], maxlen, bool:validate=tru
|
|||||||
* Retrieves a client's authentication string (SteamID).
|
* Retrieves a client's authentication string (SteamID).
|
||||||
*
|
*
|
||||||
* @param client Player index.
|
* @param client Player index.
|
||||||
* @param authType Auth string type and format to use.
|
* @param authType Auth id type and format to use.
|
||||||
* @param auth Buffer to store the client's auth string.
|
* @param auth Buffer to store the client's auth id.
|
||||||
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
||||||
* @param validate Check backend validation status.
|
* @param validate Check backend validation status.
|
||||||
* DO NOT PASS FALSE UNLESS YOU UNDERSTAND THE CONSEQUENCES,
|
* DO NOT PASS FALSE UNLESS YOU UNDERSTAND THE CONSEQUENCES,
|
||||||
@ -302,7 +302,7 @@ native bool:GetClientAuthString(client, String:auth[], maxlen, bool:validate=tru
|
|||||||
* @return True on success, false otherwise.
|
* @return True on success, false otherwise.
|
||||||
* @error If the client is not connected or the index is invalid.
|
* @error If the client is not connected or the index is invalid.
|
||||||
*/
|
*/
|
||||||
native bool:GetClientAuthId(client, AuthStringType:authType, String:auth[], maxlen, bool:validate=true);
|
native bool:GetClientAuthId(client, AuthIdType:authType, String:auth[], maxlen, bool:validate=true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the client's Steam account ID.
|
* Returns the client's Steam account ID.
|
||||||
|
@ -273,9 +273,9 @@ namespace SourceMod
|
|||||||
*
|
*
|
||||||
* @param validated Check backend validation status.
|
* @param validated Check backend validation status.
|
||||||
*
|
*
|
||||||
* @return Steam ID or 0 if not available.
|
* @return Steam Id or 0 if not available.
|
||||||
*/
|
*/
|
||||||
virtual uint64_t GetSteamID64(bool validated = true) =0;
|
virtual uint64_t GetSteamId64(bool validated = true) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user