Core/Account: Add total time played in account (#1003)

This saves the total time played on the account, even if your characters have been deleted.
This commit is contained in:
Kargatum
2018-09-18 00:58:42 +07:00
committed by Barbz
parent 82ca2bef99
commit 0d6eb11db9
6 changed files with 45 additions and 11 deletions

View File

@@ -730,6 +730,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
uint64 DosResponse;
uint32 BuiltNumberClient;
uint32 id, security;
uint32 TotalTime = 0;
bool skipQueue = false;
//uint8 expansion = 0;
LocaleConstant locale;
@@ -765,8 +766,8 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
sLog->outStaticDebug ("WorldSocket::HandleAuthSession: client %u, loginServerID %u, account %s, loginServerType %u, clientseed %u", BuiltNumberClient, loginServerID, account.c_str(), loginServerType, clientSeed);
#endif
// Get the account information from the realmd database
// 0 1 2 3 4 5 6 7 8 9
// SELECT id, sessionkey, last_ip, locked, lock_country, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ?
// 0 1 2 3 4 5 6 7 8 9 10
// SELECT id, sessionkey, last_ip, locked, lock_country, expansion, mutetime, locale, recruiter, os, totaltime FROM account WHERE username = ?
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME);
stmt->setString(0, account);
@@ -834,6 +835,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
uint32 recruiter = fields[8].GetUInt32();
std::string os = fields[9].GetString();
TotalTime = fields[10].GetUInt32();
// Must be done before WorldSession is created
if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED) && os != "Win" && os != "OSX")
@@ -949,7 +951,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
LoginDatabase.Execute(stmt);
// NOTE ATM the socket is single-threaded, have this in mind ...
ACE_NEW_RETURN (m_Session, WorldSession (id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter, skipQueue), -1);
ACE_NEW_RETURN(m_Session, WorldSession(id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter, skipQueue, TotalTime), -1);
m_Crypt.Init(&k);