diff options
| author | Shauren <shauren.trinity@gmail.com> | 2025-12-29 00:28:20 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2025-12-29 00:28:20 +0100 |
| commit | d93f1a63c094f85da7ed6b07de3b3fe51bd11d03 (patch) | |
| tree | f5f2bb70c64d3f34f6a5250beb3e0bcc532a9c8e /src/server | |
| parent | 405e1a3b27e8419ee69d6331b053650ce1eb1a65 (diff) | |
Core/Objects: Added new visible object type - bnet account with HousingStorageData
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/database/Database/Implementation/LoginDatabase.cpp | 4 | ||||
| -rw-r--r-- | src/server/game/Entities/Account/Account.cpp | 86 | ||||
| -rw-r--r-- | src/server/game/Entities/Account/Account.h | 54 | ||||
| -rw-r--r-- | src/server/game/Entities/Item/Item.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 7 | ||||
| -rw-r--r-- | src/server/game/Entities/Transport/Transport.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSession.cpp | 28 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSession.h | 24 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSocket.cpp | 65 |
10 files changed, 218 insertions, 56 deletions
diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp index 5ed330a6c48..820e828003a 100644 --- a/src/server/database/Database/Implementation/LoginDatabase.cpp +++ b/src/server/database/Database/Implementation/LoginDatabase.cpp @@ -40,8 +40,8 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_UPD_LOGON, "UPDATE account SET salt = ?, verifier = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id AS aId, a.session_key_bnet, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, a.client_build, a.locale, a.recruiter, a.os, a.timezone_offset, ba.id AS baId, aa.SecurityLevel, " - "bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate AS is_bnet_banned, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate AS is_banned, r.id " + PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id AS account_id, a.session_key_bnet, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, a.client_build, a.locale, a.recruiter, a.os, a.timezone_offset, ba.id AS bnet_account_id, ba.email as bnet_account_email, aa.SecurityLevel, " + "bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate AS is_bnet_banned, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate AS is_banned, r.id AS recruitId " "FROM account a LEFT JOIN account r ON a.id = r.recruiter LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id " "LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?) LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 " "WHERE a.username = ? AND LENGTH(a.session_key_bnet) = 64 ORDER BY aa.RealmID DESC LIMIT 1", CONNECTION_ASYNC); diff --git a/src/server/game/Entities/Account/Account.cpp b/src/server/game/Entities/Account/Account.cpp new file mode 100644 index 00000000000..1de478212b7 --- /dev/null +++ b/src/server/game/Entities/Account/Account.cpp @@ -0,0 +1,86 @@ +/* +* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "Account.h" +#include "Map.h" +#include "Player.h" +#include "StringFormat.h" +#include "WorldSession.h" + +namespace Battlenet +{ +Account::Account(WorldSession* session, ObjectGuid guid, std::string&& name) : m_session(session), m_name(std::move(name)) +{ + _Create(guid); + + m_entityFragments.Add(WowCS::EntityFragment::FHousingStorage_C, false, WowCS::FragmentSerializationTraits<&Account::m_housingStorageData>{}); + + // Default value + SetUpdateFieldValue(m_values.ModifyValue(&Account::m_housingStorageData).ModifyValue(&UF::HousingStorageData::DecorMaxOwnedCount), 5000); +} + +void Account::ClearUpdateMask(bool remove) +{ + m_values.ClearChangesMask(&Account::m_housingStorageData); + BaseEntity::ClearUpdateMask(remove); +} + +std::string Account::GetNameForLocaleIdx(LocaleConstant /*locale*/) const +{ + return m_name; +} + +void Account::BuildUpdate(UpdateDataMapType& data_map) +{ + BuildUpdateChangesMask(); + + if (Player* owner = m_session->GetPlayer()) + BuildFieldsUpdate(owner, data_map); + + ClearUpdateMask(false); +} + +std::string Account::GetDebugInfo() const +{ + return Trinity::StringFormat("{}\nName: {}", BaseEntity::GetDebugInfo(), m_name); +} + +UF::UpdateFieldFlag Account::GetUpdateFieldFlagsFor(Player const* target) const +{ + if (*target->m_playerData->BnetAccount == GetGUID()) + return UF::UpdateFieldFlag::Owner; + + return UF::UpdateFieldFlag::None; +} + +bool Account::AddToObjectUpdate() +{ + if (Player* owner = m_session->GetPlayer(); owner && owner->IsInWorld()) + { + owner->GetMap()->AddUpdateObject(this); + return true; + } + + return false; +} + +void Account::RemoveFromObjectUpdate() +{ + if (Player* owner = m_session->GetPlayer(); owner && owner->IsInWorld()) + owner->GetMap()->RemoveUpdateObject(this); +} +} diff --git a/src/server/game/Entities/Account/Account.h b/src/server/game/Entities/Account/Account.h new file mode 100644 index 00000000000..3e6f1360e98 --- /dev/null +++ b/src/server/game/Entities/Account/Account.h @@ -0,0 +1,54 @@ +/* +* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef TRINITYCORE_ACCOUNT_H +#define TRINITYCORE_ACCOUNT_H + +#include "BaseEntity.h" + +class WorldSession; + +namespace Battlenet +{ +class Account final : public BaseEntity +{ +public: + explicit Account(WorldSession* session, ObjectGuid guid, std::string&& name); + + void ClearUpdateMask(bool remove) override; + + std::string GetNameForLocaleIdx(LocaleConstant locale) const override; + + void BuildUpdate(UpdateDataMapType& data_map) override; + + std::string GetDebugInfo() const override; + + UF::UpdateField<UF::HousingStorageData, int32(WowCS::EntityFragment::FHousingStorage_C), 0> m_housingStorageData; + +protected: + UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const* target) const override; + + bool AddToObjectUpdate() override; + void RemoveFromObjectUpdate() override; + +private: + WorldSession* m_session; + std::string m_name; +}; +} + +#endif // TRINITYCORE_ACCOUNT_H diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index e6536e3c91e..5bbd1b81edb 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1786,7 +1786,7 @@ bool Item::IsBindedNotWith(Player const* player) const void Item::BuildUpdate(UpdateDataMapType& data_map) { - Object::BuildUpdateChangesMask(); + BuildUpdateChangesMask(); if (Player* owner = GetOwner()) BuildFieldsUpdate(owner, data_map); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 148f0ceca21..33fc45d5617 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -3117,7 +3117,7 @@ struct WorldObjectChangeAccumulator void WorldObject::BuildUpdate(UpdateDataMapType& data_map) { - Object::BuildUpdateChangesMask(); + BuildUpdateChangesMask(); WorldObjectChangeAccumulator notifier(*this, data_map); WorldObjectVisibleChangeVisitor visitor(notifier); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 68013f65654..4eb409c8b12 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17,6 +17,7 @@ #include "Player.h" #include "AreaTrigger.h" +#include "Account.h" #include "AccountMgr.h" #include "AchievementMgr.h" #include "ArenaTeam.h" @@ -1540,6 +1541,8 @@ void Player::AddToWorld() for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) if (m_items[i]) m_items[i]->AddToWorld(); + + GetSession()->GetBattlenetAccount().AddToWorld(); } void Player::RemoveFromWorld() @@ -1559,6 +1562,8 @@ void Player::RemoveFromWorld() sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); } + GetSession()->GetBattlenetAccount().RemoveFromWorld(); + // Remove items from world before self - player must be found in Item::RemoveFromObjectUpdate for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) if (m_items[i]) @@ -3592,6 +3597,8 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c for (Item* item : m_items) if (item) item->BuildCreateUpdateBlockForPlayer(data, target); + + GetSession()->GetBattlenetAccount().BuildCreateUpdateBlockForPlayer(data, target); } Unit::BuildCreateUpdateBlockForPlayer(data, target); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index b17921d3840..81733d625fd 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -689,7 +689,7 @@ void Transport::UpdatePassengerPositions(PassengerSet const& passengers) void Transport::BuildUpdate(UpdateDataMapType& data_map) { - Object::BuildUpdateChangesMask(); + BuildUpdateChangesMask(); for (MapReference const& playerReference : GetMap()->GetPlayers()) if (playerReference.GetSource()->InSamePhase(this)) diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index d2b2b96a69b..a336b5790ad 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -15,11 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/** \file - \ingroup u2w -*/ - #include "WorldSession.h" +#include "Account.h" #include "AccountMgr.h" #include "AuthenticationPackets.h" #include "Bag.h" @@ -107,17 +104,19 @@ bool WorldSessionFilter::Process(WorldPacket* packet) } /// WorldSession constructor -WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time, - std::string os, Minutes timezoneOffset, uint32 build, ClientBuild::VariantId clientBuildVariant, LocaleConstant locale, uint32 recruiter, bool isARecruiter): +WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::string&& battlenetAccountEmail, + std::shared_ptr<WorldSocket>&& sock, AccountTypes sec, uint8 expansion, time_t mute_time, std::string&& os, Minutes timezoneOffset, + uint32 build, ClientBuild::VariantId clientBuildVariant, LocaleConstant locale, uint32 recruiter, bool isARecruiter) : m_muteTime(mute_time), m_timeOutTime(0), AntiDOS(this), m_GUIDLow(UI64LIT(0)), _player(nullptr), + m_Socket({ std::move(sock), nullptr }), _security(sec), _accountId(id), _accountName(std::move(name)), - _battlenetAccountId(battlenetAccountId), + _battlenetAccount(new Battlenet::Account(this, ObjectGuid::Create<HighGuid::BNetAccount>(battlenetAccountId), std::move(battlenetAccountEmail))), m_accountExpansion(expansion), m_expansion(std::min<uint8>(expansion, sWorld->getIntConfig(CONFIG_EXPANSION))), _os(std::move(os)), @@ -151,14 +150,13 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun _battlePetMgr(std::make_unique<BattlePets::BattlePetMgr>(this)), _collectionMgr(std::make_unique<CollectionMgr>(this)) { - if (sock) + if (m_Socket[CONNECTION_TYPE_REALM]) { - m_Address = sock->GetRemoteIpAddress().to_string(); + m_Address = m_Socket[CONNECTION_TYPE_REALM]->GetRemoteIpAddress().to_string(); ResetTimeOutTime(false); LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = {};", GetAccountId()); // One-time query } - m_Socket[CONNECTION_TYPE_REALM] = std::move(sock); _instanceConnectKey.Raw = UI64LIT(0); } @@ -195,6 +193,16 @@ bool WorldSession::PlayerDisconnected() const m_Socket[CONNECTION_TYPE_INSTANCE] && m_Socket[CONNECTION_TYPE_INSTANCE]->IsOpen()); } +uint32 WorldSession::GetBattlenetAccountId() const +{ + return GetBattlenetAccountGUID().GetCounter(); +} + +ObjectGuid WorldSession::GetBattlenetAccountGUID() const +{ + return _battlenetAccount->GetGUID(); +} + std::string const & WorldSession::GetPlayerName() const { return _player != nullptr ? _player->GetName() : DefaultPlayerName; diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 2c55b457ce7..9c5dee6a355 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -15,10 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/// \addtogroup u2w -/// @{ -/// \file - #ifndef __WORLDSESSION_H #define __WORLDSESSION_H @@ -70,6 +66,11 @@ enum InventoryResult : uint8; enum class StableResult : uint8; enum class TabardVendorType : int32; +namespace Battlenet +{ +class Account; +} + namespace BattlePets { class BattlePetMgr; @@ -969,8 +970,9 @@ struct PacketCounter class TC_GAME_API WorldSession { public: - WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::shared_ptr<WorldSocket> sock, AccountTypes sec, uint8 expansion, time_t mute_time, - std::string os, Minutes timezoneOffset, uint32 build, ClientBuild::VariantId clientBuildVariant, LocaleConstant locale, uint32 recruiter, bool isARecruiter); + WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::string&& battlenetAccountEmail, + std::shared_ptr<WorldSocket>&& sock, AccountTypes sec, uint8 expansion, time_t mute_time, std::string&& os, Minutes timezoneOffset, + uint32 build, ClientBuild::VariantId clientBuildVariant, LocaleConstant locale, uint32 recruiter, bool isARecruiter); ~WorldSession(); bool PlayerLoading() const { return !m_playerLoading.IsEmpty(); } @@ -1006,8 +1008,9 @@ class TC_GAME_API WorldSession uint32 GetAccountId() const { return _accountId; } ObjectGuid GetAccountGUID() const { return ObjectGuid::Create<HighGuid::WowAccount>(GetAccountId()); } std::string const& GetAccountName() const { return _accountName; } - uint32 GetBattlenetAccountId() const { return _battlenetAccountId; } - ObjectGuid GetBattlenetAccountGUID() const { return ObjectGuid::Create<HighGuid::BNetAccount>(GetBattlenetAccountId()); } + uint32 GetBattlenetAccountId() const; + ObjectGuid GetBattlenetAccountGUID() const; + Battlenet::Account& GetBattlenetAccount() const { return *_battlenetAccount; } Player* GetPlayer() const { return _player; } std::string const& GetPlayerName() const; std::string GetPlayerInfo() const; @@ -1964,14 +1967,14 @@ class TC_GAME_API WorldSession ObjectGuid::LowType m_GUIDLow; // set logined or recently logout player (while m_playerRecentlyLogout set) Player* _player; - std::shared_ptr<WorldSocket> m_Socket[MAX_CONNECTION_TYPES]; + std::array<std::shared_ptr<WorldSocket>, MAX_CONNECTION_TYPES> m_Socket; std::string m_Address; // Current Remote Address // std::string m_LAddress; // Last Attempted Remote Adress - we can not set attempted ip for a non-existing session! AccountTypes _security; uint32 _accountId; std::string _accountName; - uint32 _battlenetAccountId; + std::unique_ptr<Battlenet::Account> _battlenetAccount; uint8 m_accountExpansion; uint8 m_expansion; std::string _os; @@ -2028,4 +2031,3 @@ class TC_GAME_API WorldSession }; #endif -/// @} diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index a701939c313..3aa0064b34c 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -29,6 +29,7 @@ #include "IpBanCheckConnectionInitializer.h" #include "PacketLog.h" #include "ProtobufJSON.h" +#include "QueryResultStructured.h" #include "RealmList.h" #include "RBAC.h" #include "RealmList.pb.h" @@ -616,6 +617,7 @@ struct AccountInfo struct { uint32 Id; + std::string Email; bool IsLockedToIP; std::string LastIP; std::string LockCountry; @@ -633,39 +635,42 @@ struct AccountInfo uint32 Recruiter; std::string OS; Minutes TimezoneOffset; - bool IsRectuiter; + bool IsRecruiter; AccountTypes Security; bool IsBanned; } Game; bool IsBanned() const { return BattleNet.IsBanned || Game.IsBanned; } - explicit AccountInfo(Field const* fields) + explicit AccountInfo(PreparedResultSet const* result) { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 - // SELECT a.id, a.session_key, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, a.client_build, a.locale, a.recruiter, a.os, a.timezone_offset, ba.id, aa.SecurityLevel, - // 14 15 16 - // bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id - // FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?) - // LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id LEFT JOIN account r ON a.id = r.recruiter - // WHERE a.username = ? AND LENGTH(a.session_key) = 40 ORDER BY aa.RealmID DESC LIMIT 1 - Game.Id = fields[0].GetUInt32(); - Game.KeyData = fields[1].GetBinary<64>(); - BattleNet.LastIP = fields[2].GetString(); - BattleNet.IsLockedToIP = fields[3].GetBool(); - BattleNet.LockCountry = fields[4].GetString(); - Game.Expansion = fields[5].GetUInt8(); - Game.MuteTime = fields[6].GetInt64(); - Game.Build = fields[7].GetUInt32(); - Game.Locale = LocaleConstant(fields[8].GetUInt8()); - Game.Recruiter = fields[9].GetUInt32(); - Game.OS = fields[10].GetString(); - Game.TimezoneOffset = Minutes(fields[11].GetInt16()); - BattleNet.Id = fields[12].GetUInt32(); - Game.Security = AccountTypes(fields[13].GetUInt8()); - BattleNet.IsBanned = fields[14].GetUInt32() != 0; - Game.IsBanned = fields[15].GetUInt32() != 0; - Game.IsRectuiter = fields[16].GetUInt32() != 0; + // SELECT a.id AS accountId, a.session_key_bnet, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, a.client_build, a.locale, a.recruiter, a.os, a.timezone_offset, ba.id AS bnet_account_id, ba.email as bnet_account_email, aa.SecurityLevel, + // bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate AS is_bnet_banned, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate AS is_banned, r.id AS recruitId + // FROM account a LEFT JOIN account r ON a.id = r.recruiter LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id + // LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?) LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 + // WHERE a.username = ? AND LENGTH(a.session_key_bnet) = 64 ORDER BY aa.RealmID DESC LIMIT 1 + + DEFINE_FIELD_ACCESSOR_CACHE_ANONYMOUS(PreparedResultSet, (account_id)(session_key_bnet)(last_ip)(locked)(lock_country)(expansion)(mutetime)(client_build) + (locale)(recruiter)(os)(timezone_offset)(bnet_account_id)(bnet_account_email)(SecurityLevel)(is_bnet_banned)(is_banned)(recruitId)) fields { *result }; + + Game.Id = fields.account_id().GetUInt32(); + Game.KeyData = fields.session_key_bnet().GetBinary<64>(); + BattleNet.LastIP = fields.last_ip().GetStringView(); + BattleNet.IsLockedToIP = fields.locked().GetBool(); + BattleNet.LockCountry = fields.lock_country().GetStringView(); + Game.Expansion = fields.expansion().GetUInt8(); + Game.MuteTime = fields.mutetime().GetInt64(); + Game.Build = fields.client_build().GetUInt32(); + Game.Locale = LocaleConstant(fields.locale().GetUInt8()); + Game.Recruiter = fields.recruiter().GetUInt32(); + Game.OS = fields.os().GetStringView(); + Game.TimezoneOffset = Minutes(fields.timezone_offset().GetInt16()); + BattleNet.Id = fields.bnet_account_id().GetUInt32(); + BattleNet.Email = fields.bnet_account_email().GetStringView(); + Game.Security = AccountTypes(fields.SecurityLevel().GetUInt8()); + BattleNet.IsBanned = fields.is_bnet_banned().GetUInt32() != 0; + Game.IsBanned = fields.is_banned().GetUInt32() != 0; + Game.IsRecruiter = fields.recruitId().GetUInt32() != 0; if (Game.Locale >= TOTAL_LOCALES) Game.Locale = LOCALE_enUS; @@ -707,7 +712,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth:: std::string address = GetRemoteIpAddress().to_string(); - AccountInfo account(result->Fetch()); + AccountInfo account(result.get()); ClientBuild::Info const* buildInfo = ClientBuild::GetBuildInfo(account.Game.Build); if (!buildInfo) @@ -887,9 +892,9 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth:: _authed = true; _worldSession = new WorldSession(account.Game.Id, std::move(*joinTicket->mutable_gameaccount()), account.BattleNet.Id, - static_pointer_cast<WorldSocket>(shared_from_this()), account.Game.Security, account.Game.Expansion, mutetime, - account.Game.OS, account.Game.TimezoneOffset, account.Game.Build, buildVariant, account.Game.Locale, - account.Game.Recruiter, account.Game.IsRectuiter); + std::move(account.BattleNet.Email), static_pointer_cast<WorldSocket>(shared_from_this()), account.Game.Security, + account.Game.Expansion, mutetime, std::move(account.Game.OS), account.Game.TimezoneOffset, account.Game.Build, buildVariant, + account.Game.Locale, account.Game.Recruiter, account.Game.IsRecruiter); QueueQuery(_worldSession->LoadPermissionsAsync().WithPreparedCallback([this](PreparedQueryResult result) { |
