AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AccountInfo Struct Reference

#include "AuthSession.h"

Public Member Functions

void LoadResult (Field *fields)
 
 AccountInfo (Field *fields)
 

Public Attributes

uint32 Id = 0
 
std::string Login
 
bool IsLockedToIP = false
 
std::string LockCountry
 
std::string LastIP
 
uint32 FailedLogins = 0
 
bool IsBanned = false
 
bool IsPermanentlyBanned = false
 
AccountTypes SecurityLevel = SEC_PLAYER
 
::SessionKey SessionKey
 
uint8 Expansion
 
int64 MuteTime
 
LocaleConstant Locale
 
uint32 Recruiter
 
std::string OS
 
bool IsRectuiter
 
AccountTypes Security
 
uint32 TotalTime
 

Detailed Description

Constructor & Destructor Documentation

◆ AccountInfo()

AccountInfo::AccountInfo ( Field fields)
inlineexplicit
365 {
366 // 0 1 2 3 4 5 6 7 8 9 10 11
367 // SELECT a.id, a.sessionkey, a.last_ip, a.locked, a.lock_country, a.expansion, a.mutetime, a.locale, a.recruiter, a.os, a.totaltime, aa.gmLevel,
368 // 12 13
369 // ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id
370 // FROM account a
371 // LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?)
372 // LEFT JOIN account_banned ab ON a.id = ab.id
373 // LEFT JOIN account r ON a.id = r.recruiter
374 // WHERE a.username = ? ORDER BY aa.RealmID DESC LIMIT 1
375 Id = fields[0].Get<uint32>();
376 SessionKey = fields[1].Get<Binary, SESSION_KEY_LENGTH>();
377 LastIP = fields[2].Get<std::string>();
378 IsLockedToIP = fields[3].Get<bool>();
379 LockCountry = fields[4].Get<std::string>();
380 Expansion = fields[5].Get<uint8>();
381 MuteTime = fields[6].Get<int64>();
382 Locale = LocaleConstant(fields[7].Get<uint8>());
383 Recruiter = fields[8].Get<uint32>();
384 OS = fields[9].Get<std::string>();
385 TotalTime = fields[10].Get<uint32>();
386 Security = AccountTypes(fields[11].Get<uint8>());
387 IsBanned = fields[12].Get<uint64>() != 0;
388 IsRectuiter = fields[13].Get<uint32>() != 0;
389
390 uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
391 if (Expansion > world_expansion)
392 Expansion = world_expansion;
393
394 if (Locale >= TOTAL_LOCALES)
396 }
std::array< uint8, SESSION_KEY_LENGTH > SessionKey
Definition AuthDefines.h:25
constexpr std::size_t SESSION_KEY_LENGTH
Definition AuthDefines.h:24
LocaleConstant
Definition Common.h:65
@ TOTAL_LOCALES
Definition Common.h:76
@ LOCALE_enUS
Definition Common.h:66
AccountTypes
Definition Common.h:56
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
std::uint64_t uint64
Definition Define.h:106
std::int64_t int64
Definition Define.h:102
std::vector< uint8 > Binary
Definition Field.h:40
@ CONFIG_EXPANSION
Definition IWorld.h:275
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112
#define sWorld
Definition World.h:363
std::string LockCountry
Definition AuthSession.h:55
std::string OS
Definition WorldSocket.cpp:358
uint32 Recruiter
Definition WorldSocket.cpp:357
LocaleConstant Locale
Definition WorldSocket.cpp:356
int64 MuteTime
Definition WorldSocket.cpp:355
bool IsRectuiter
Definition WorldSocket.cpp:359
AccountTypes Security
Definition WorldSocket.cpp:360
uint32 Id
Definition AuthSession.h:52
bool IsBanned
Definition AuthSession.h:58
bool IsLockedToIP
Definition AuthSession.h:54
std::string LastIP
Definition AuthSession.h:56
uint8 Expansion
Definition WorldSocket.cpp:354
uint32 TotalTime
Definition WorldSocket.cpp:362

References CONFIG_EXPANSION, Expansion, Field::Get(), Id, IsBanned, IsLockedToIP, IsRectuiter, LastIP, Locale, LOCALE_enUS, LockCountry, MuteTime, OS, Recruiter, Security, SESSION_KEY_LENGTH, sWorld, TOTAL_LOCALES, and TotalTime.

Member Function Documentation

◆ LoadResult()

void AccountInfo::LoadResult ( Field fields)
138{
139 // 0 1 2 3 4 5
140 // SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins,
141 // 6 7
142 // ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate,
143 // 8 9
144 // ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate,
145 // 10
146 // aa.gmlevel (, more query-specific fields)
147 // FROM account a LEFT JOIN account_access aa ON a.id = aa.id LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 LEFT JOIN ip_banned ipb ON ipb.ip = ? WHERE a.username = ?
148
149 Id = fields[0].Get<uint32>();
150 Login = fields[1].Get<std::string>();
151 IsLockedToIP = fields[2].Get<bool>();
152 LockCountry = fields[3].Get<std::string>();
153 LastIP = fields[4].Get<std::string>();
154 FailedLogins = fields[5].Get<uint32>();
155 IsBanned = fields[6].Get<bool>() || fields[8].Get<bool>();
156 IsPermanentlyBanned = fields[7].Get<bool>() || fields[9].Get<bool>();
157 SecurityLevel = static_cast<AccountTypes>(fields[10].Get<uint8>()) > SEC_CONSOLE ? SEC_CONSOLE : static_cast<AccountTypes>(fields[10].Get<uint8>());
158
159 // Use our own uppercasing of the account name instead of using UPPER() in mysql query
160 // This is how the account was created in the first place and changing it now would result in breaking
161 // login for all accounts having accented characters in their name
163}
@ SEC_CONSOLE
Definition Common.h:61
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition Util.cpp:532
uint32 FailedLogins
Definition AuthSession.h:57
bool IsPermanentlyBanned
Definition AuthSession.h:59
AccountTypes SecurityLevel
Definition AuthSession.h:60
std::string Login
Definition AuthSession.h:53

References FailedLogins, Field::Get(), Id, IsBanned, IsLockedToIP, IsPermanentlyBanned, LastIP, LockCountry, Login, SEC_CONSOLE, SecurityLevel, and Utf8ToUpperOnlyLatin().

Referenced by AuthSession::LogonChallengeCallback(), and AuthSession::ReconnectChallengeCallback().

Member Data Documentation

◆ Expansion

uint8 AccountInfo::Expansion

◆ FailedLogins

uint32 AccountInfo::FailedLogins = 0

◆ Id

◆ IsBanned

◆ IsLockedToIP

◆ IsPermanentlyBanned

bool AccountInfo::IsPermanentlyBanned = false

◆ IsRectuiter

bool AccountInfo::IsRectuiter

◆ LastIP

◆ Locale

◆ LockCountry

◆ Login

◆ MuteTime

int64 AccountInfo::MuteTime

◆ OS

std::string AccountInfo::OS

◆ Recruiter

uint32 AccountInfo::Recruiter

◆ Security

AccountTypes AccountInfo::Security

◆ SecurityLevel

AccountTypes AccountInfo::SecurityLevel = SEC_PLAYER

◆ SessionKey

::SessionKey AccountInfo::SessionKey

◆ TotalTime

uint32 AccountInfo::TotalTime

The documentation for this struct was generated from the following files: