mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Objects: Added new visible object type - bnet account with HousingStorageData
This commit is contained in:
@@ -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);
|
||||
|
||||
86
src/server/game/Entities/Account/Account.cpp
Normal file
86
src/server/game/Entities/Account/Account.cpp
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
54
src/server/game/Entities/Account/Account.h
Normal file
54
src/server/game/Entities/Account/Account.h
Normal file
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -3117,7 +3117,7 @@ struct WorldObjectChangeAccumulator
|
||||
|
||||
void WorldObject::BuildUpdate(UpdateDataMapType& data_map)
|
||||
{
|
||||
Object::BuildUpdateChangesMask();
|
||||
BuildUpdateChangesMask();
|
||||
|
||||
WorldObjectChangeAccumulator notifier(*this, data_map);
|
||||
WorldObjectVisibleChangeVisitor visitor(notifier);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
/// @}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user