Core/Misc: Send saved client settings instantly after login, not only after entering world

This commit is contained in:
Shauren
2021-11-06 18:33:44 +01:00
parent 581d514678
commit 3917c2ad01
3 changed files with 18 additions and 9 deletions

View File

@@ -29,7 +29,6 @@
#include "CharacterCache.h"
#include "CharacterPackets.h"
#include "Chat.h"
#include "ClientConfigPackets.h"
#include "Common.h"
#include "Containers.h"
#include "DatabaseEnv.h"
@@ -1050,6 +1049,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
pCurrChar->SetVirtualPlayerRealm(GetVirtualRealmAddress());
SendAccountDataTimes(ObjectGuid::Empty, GLOBAL_CACHE_MASK);
SendTutorialsData();
pCurrChar->GetMotionMaster()->Initialize();
@@ -1062,14 +1062,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
// load player specific part before send times
LoadAccountData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA), PER_CHARACTER_CACHE_MASK);
WorldPackets::ClientConfig::AccountDataTimes accountDataTimes;
accountDataTimes.PlayerGuid = playerGuid;
accountDataTimes.ServerTime = GameTime::GetGameTimeSystemPoint();
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
accountDataTimes.AccountTimes[i] = GetAccountData(AccountDataType(i))->Time;
SendPacket(accountDataTimes.Write());
SendAccountDataTimes(playerGuid, ALL_ACCOUNT_DATA_CACHE_MASK);
SendFeatureSystemStatus();

View File

@@ -28,6 +28,7 @@
#include "BattlenetPackets.h"
#include "CharacterPackets.h"
#include "ChatPackets.h"
#include "ClientConfigPackets.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Group.h"
@@ -809,6 +810,18 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time, std::string
_accountData[type].Data = data;
}
void WorldSession::SendAccountDataTimes(ObjectGuid playerGuid, uint32 mask)
{
WorldPackets::ClientConfig::AccountDataTimes accountDataTimes;
accountDataTimes.PlayerGuid = playerGuid;
accountDataTimes.ServerTime = GameTime::GetGameTimeSystemPoint();
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
if (mask & (1 << i))
accountDataTimes.AccountTimes[i] = GetAccountData(AccountDataType(i))->Time;
SendPacket(accountDataTimes.Write());
}
void WorldSession::LoadTutorialsData(PreparedQueryResult result)
{
memset(_tutorials, 0, sizeof(uint32) * MAX_ACCOUNT_TUTORIAL_VALUES);
@@ -1089,6 +1102,7 @@ void WorldSession::InitializeSessionCallback(LoginDatabaseQueryHolder* realmHold
SendFeatureSystemStatusGlueScreen();
SendClientCacheVersion(sWorld->getIntConfig(CONFIG_CLIENTCACHE_VERSION));
SendAvailableHotfixes();
SendAccountDataTimes(ObjectGuid::Empty, GLOBAL_CACHE_MASK);
SendTutorialsData();
if (PreparedQueryResult characterCountsResult = holder->GetPreparedResult(AccountInfoQueryHolder::GLOBAL_REALM_CHARACTER_COUNTS))

View File

@@ -832,6 +832,7 @@ enum AccountDataType
#define NUM_ACCOUNT_DATA_TYPES 12
#define ALL_ACCOUNT_DATA_CACHE_MASK 0xFFF
#define GLOBAL_CACHE_MASK 0x515
#define PER_CHARACTER_CACHE_MASK 0xAEA
@@ -1049,6 +1050,7 @@ class TC_GAME_API WorldSession
// Account Data
AccountData const* GetAccountData(AccountDataType type) const { return &_accountData[type]; }
void SetAccountData(AccountDataType type, time_t time, std::string const& data);
void SendAccountDataTimes(ObjectGuid playerGuid, uint32 mask);
void LoadAccountData(PreparedQueryResult result, uint32 mask);
void LoadTutorialsData(PreparedQueryResult result);