feat(Core/Account): Add account flags support (#22533)

This commit is contained in:
Kitzunu
2025-07-24 15:09:30 +02:00
committed by GitHub
parent 603249c046
commit 1e68280691
8 changed files with 109 additions and 13 deletions

View File

@@ -352,6 +352,7 @@ struct AccountInfo
bool IsLockedToIP;
std::string LockCountry;
uint8 Expansion;
uint32 Flags;
int64 MuteTime;
LocaleConstant Locale;
uint32 Recruiter;
@@ -363,9 +364,9 @@ struct AccountInfo
explicit AccountInfo(Field* fields)
{
// 0 1 2 3 4 5 6 7 8 9 10 11
// 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,
// 12 13
// 0 1 2 3 4 5 6 7 8 9 10 11 12
// SELECT a.id, a.sessionkey, a.last_ip, a.locked, a.lock_country, a.expansion, a.Flags a.mutetime, a.locale, a.recruiter, a.os, a.totaltime, aa.gmLevel,
// 13 14
// ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id
// FROM account a
// LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?)
@@ -378,14 +379,15 @@ struct AccountInfo
IsLockedToIP = fields[3].Get<bool>();
LockCountry = fields[4].Get<std::string>();
Expansion = fields[5].Get<uint8>();
MuteTime = fields[6].Get<int64>();
Locale = LocaleConstant(fields[7].Get<uint8>());
Recruiter = fields[8].Get<uint32>();
OS = fields[9].Get<std::string>();
TotalTime = fields[10].Get<uint32>();
Security = AccountTypes(fields[11].Get<uint8>());
IsBanned = fields[12].Get<uint64>() != 0;
IsRectuiter = fields[13].Get<uint32>() != 0;
Flags = fields[6].Get<uint32>();
MuteTime = fields[7].Get<int64>();
Locale = LocaleConstant(fields[8].Get<uint8>());
Recruiter = fields[9].Get<uint32>();
OS = fields[10].Get<std::string>();
TotalTime = fields[11].Get<uint32>();
Security = AccountTypes(fields[12].Get<uint8>());
IsBanned = fields[13].Get<uint64>() != 0;
IsRectuiter = fields[14].Get<uint32>() != 0;
uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
if (Expansion > world_expansion)
@@ -696,6 +698,8 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
LoginDatabase.Execute(stmt);
AccountMgr::ValidateAccountFlags(account.Id, account.Flags, account.Security);
// At this point, we can safely hook a successful login
sScriptMgr->OnAccountLogin(account.Id);