Fix build errors after previous commit

This commit is contained in:
Antz 2016-03-24 20:19:27 +00:00 committed by Antz
parent c1150219d4
commit 35415eb738
5 changed files with 280 additions and 86 deletions

View file

@ -39,9 +39,21 @@
#include "Guild.h"
#include "GuildMgr.h"
#include "World.h"
#include "ObjectAccessor.h"
#include "BattleGround/BattleGroundMgr.h"
#include "MapManager.h"
#include "SocialMgr.h"
#ifdef ENABLE_ELUNA
#include "LuaEngine.h"
#endif /* ENABLE_ELUNA */
#ifdef ENABLE_PLAYERBOTS
#include "playerbot.h"
#endif
// Warden
#include "WardenWin.h"
#include "WardenMac.h"
#include "Auth/AuthCrypt.h"
#include "Auth/HMACSHA1.h"
#include "zlib.h"
@ -51,12 +63,12 @@ static bool MapSessionFilterHelper(WorldSession* session, OpcodeHandler const& o
{
// we do not process thread-unsafe packets
if (opHandle.packetProcessing == PROCESS_THREADUNSAFE)
return false;
{ return false; }
// we do not process not loggined player packets
Player* plr = session->GetPlayer();
if (!plr)
return false;
{ return false; }
// in Map::Update() we do not process packets where player is not in world!
return plr->IsInWorld();
@ -67,7 +79,7 @@ bool MapSessionFilter::Process(WorldPacket* packet)
{
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
if (opHandle.packetProcessing == PROCESS_INPLACE)
return true;
{ return true; }
// let's check if our opcode can be really processed in Map::Update()
return MapSessionFilterHelper(m_pSession, opHandle);
@ -80,7 +92,7 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
// check if packet handler is supposed to be safe
if (opHandle.packetProcessing == PROCESS_INPLACE)
return true;
{ return true; }
// let's check if our opcode can't be processed in Map::Update()
return !MapSessionFilterHelper(m_pSession, opHandle);
@ -105,7 +117,7 @@ WorldSession::~WorldSession()
{
///- unload player if not unloaded
if (_player)
LogoutPlayer(true);
{ LogoutPlayer(true); }
/// - If have unclosed socket, close it
if (m_Socket)
@ -115,10 +127,14 @@ WorldSession::~WorldSession()
m_Socket = NULL;
}
// Warden
if (_warden)
delete _warden;
///- empty incoming packet queue
WorldPacket* packet = NULL;
while (_recvQueue.next(packet))
delete packet;
{ delete packet; }
}
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
@ -136,8 +152,17 @@ char const* WorldSession::GetPlayerName() const
/// Send a packet to the client
void WorldSession::SendPacket(WorldPacket const* packet)
{
#ifdef ENABLE_PLAYERBOTS
if (GetPlayer()) {
if (GetPlayer()->GetPlayerbotAI())
GetPlayer()->GetPlayerbotAI()->HandleBotOutgoingPacket(*packet);
else if (GetPlayer()->GetPlayerbotMgr())
GetPlayer()->GetPlayerbotMgr()->HandleMasterOutgoingPacket(*packet);
}
#endif
if (!m_Socket)
return;
{ return; }
if (opcodeTable[packet->GetOpcode()].status == STATUS_UNHANDLED)
{
@ -184,7 +209,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
#endif // !MANGOS_DEBUG
if (m_Socket->SendPacket(*packet) == -1)
m_Socket->CloseSocket();
{ m_Socket->CloseSocket(); }
}
/// Add an incoming packet to the queue
@ -235,12 +260,17 @@ bool WorldSession::Update(PacketFilter& updater)
{
// skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
if (!m_playerRecentlyLogout)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
{ LogUnexpectedOpcode(packet, "the player has not logged in yet"); }
}
else if (_player->IsInWorld())
ExecuteOpcode(opHandle, packet);
{ ExecuteOpcode(opHandle, packet); }
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
#ifdef ENABLE_PLAYERBOTS
if (_player && _player->GetPlayerbotMgr())
_player->GetPlayerbotMgr()->HandleMasterIncomingPacket(*packet);
#endif
break;
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT:
if (!_player && !m_playerRecentlyLogout)
@ -249,15 +279,15 @@ bool WorldSession::Update(PacketFilter& updater)
}
else
// not expected _player or must checked in packet hanlder
ExecuteOpcode(opHandle, packet);
{ ExecuteOpcode(opHandle, packet); }
break;
case STATUS_TRANSFER:
if (!_player)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
{ LogUnexpectedOpcode(packet, "the player has not logged in yet"); }
else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "the player is still in world");
{ LogUnexpectedOpcode(packet, "the player is still in world"); }
else
ExecuteOpcode(opHandle, packet);
{ ExecuteOpcode(opHandle, packet); }
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
@ -313,6 +343,11 @@ bool WorldSession::Update(PacketFilter& updater)
delete packet;
}
#ifdef ENABLE_PLAYERBOTS
if (GetPlayer() && GetPlayer()->GetPlayerbotMgr())
GetPlayer()->GetPlayerbotMgr()->UpdateSessions(0);
#endif
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
@ -320,6 +355,9 @@ bool WorldSession::Update(PacketFilter& updater)
m_Socket = NULL;
}
if (m_Socket && !m_Socket->IsClosed() && _warden)
_warden->Update();
// check if we are safe to proceed with logout
// logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
@ -327,31 +365,58 @@ bool WorldSession::Update(PacketFilter& updater)
///- If necessary, log the player out
time_t currTime = time(NULL);
if (!m_Socket || (ShouldLogOut(currTime) && !m_playerLoading))
LogoutPlayer(true);
{ LogoutPlayer(true); }
if (m_Socket && GetPlayer() && _warden)
_warden->Update();
if (!m_Socket)
return false; // Will remove this session from the world session map
{ return false; } // Will remove this session from the world session map
}
return true;
}
#ifdef ENABLE_PLAYERBOTS
void WorldSession::HandleBotPackets()
{
WorldPacket* packet;
while (_recvQueue.next(packet))
{
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
(this->*opHandle.handler)(*packet);
delete packet;
}
}
#endif
/// %Log the player out
void WorldSession::LogoutPlayer(bool Save)
{
// finish pending transfers before starting the logout
while (_player && _player->IsBeingTeleportedFar())
HandleMoveWorldportAckOpcode();
{ HandleMoveWorldportAckOpcode(); }
m_playerLogout = true;
m_playerSave = Save;
if (_player)
{
#ifdef ENABLE_PLAYERBOTS
if (GetPlayer()->GetPlayerbotMgr())
GetPlayer()->GetPlayerbotMgr()->LogoutAllBots();
#endif
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() , _player->GetGUIDLow());
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
DoLootRelease(lootGuid);
{ DoLootRelease(lootGuid); }
#ifdef ENABLE_PLAYERBOTS
if (_player->GetPlayerbotMgr())
_player->GetPlayerbotMgr()->LogoutAllBots();
sRandomPlayerbotMgr.OnPlayerLogout(_player);
#endif
///- If the player just died before logging out, make him appear as a ghost
// FIXME: logout must be delayed in case lost connection with client in time of combat
@ -375,10 +440,10 @@ void WorldSession::LogoutPlayer(bool Save)
if (owner)
{
if (owner->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)owner);
{ aset.insert((Player*)owner); }
}
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
aset.insert((Player*)(*itr));
{ aset.insert((Player*)(*itr)); }
}
_player->SetPvPDeath(!aset.empty());
@ -388,13 +453,13 @@ void WorldSession::LogoutPlayer(bool Save)
// give honor to all attackers from set like group case
for (std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr)
(*itr)->RewardHonor(_player, aset.size());
{ (*itr)->RewardHonor(_player, aset.size()); }
// give bg rewards and update counters like kill by first from attackers
// this can't be called for all attackers.
if (!aset.empty())
if (BattleGround* bg = _player->GetBattleGround())
bg->HandleKillPlayer(_player, *aset.begin());
{ bg->HandleKillPlayer(_player, *aset.begin()); }
}
else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
@ -407,7 +472,7 @@ void WorldSession::LogoutPlayer(bool Save)
}
// drop a flag if player is carrying it
if (BattleGround* bg = _player->GetBattleGround())
bg->EventPlayerLoggedOut(_player);
{ bg->EventPlayerLoggedOut(_player); }
///- Teleport to home if the player is in an invalid instance
if (!_player->m_InstanceValid && !_player->isGameMaster())
@ -420,7 +485,7 @@ void WorldSession::LogoutPlayer(bool Save)
// FG: finish pending transfers after starting the logout
// this should fix players beeing able to logout and login back with full hp at death position
while (_player->IsBeingTeleportedFar())
HandleMoveWorldportAckOpcode();
{ HandleMoveWorldportAckOpcode(); }
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
@ -434,11 +499,23 @@ void WorldSession::LogoutPlayer(bool Save)
///- Reset the online field in the account table
// no point resetting online in character table here as Player::SaveToDB() will set it to 1 since player has not been removed from world at this stage
// No SQL injection as AccountID is uint32
#ifdef ENABLE_PLAYERBOTS
if (!GetPlayer()->GetPlayerbotAI())
{
static SqlStatementID id;
// playerbot mod
if (!_player->GetPlayerbotAI())
{
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE account SET active_realm_id = ? WHERE id = ?");
stmt.PExecute(uint32(0), GetAccountId());
}
}
#else
static SqlStatementID id;
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE account SET active_realm_id = ? WHERE id = ?");
stmt.PExecute(uint32(0), GetAccountId());
#endif
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
{
@ -457,27 +534,36 @@ void WorldSession::LogoutPlayer(bool Save)
///- empty buyback items and save the player in the database
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
if (Save)
_player->SaveToDB();
{ _player->SaveToDB(); }
///- Leave all channels before player delete...
_player->CleanupChannels();
#ifndef ENABLE_PLAYERBOTS
///- If the player is in a group (or invited), remove him. If the group if then only 1 person, disband the group.
_player->UninviteFromGroup();
// remove player from the group if he is:
// a) in group; b) not in raid group; c) logging out normally (not being kicked or disconnected)
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket)
_player->RemoveFromGroup();
{ _player->RemoveFromGroup(); }
#endif
///- Send update to group
if (_player->GetGroup())
_player->GetGroup()->SendUpdate();
{ _player->GetGroup()->SendUpdate(); }
///- Broadcast a logout message to the player's friends
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetObjectGuid(), true);
sSocialMgr.RemovePlayerSocial(_player->GetGUIDLow());
#ifdef ENABLE_PLAYERBOTS
uint32 guid = GetPlayer()->GetGUIDLow();
#endif
///- Used by Eluna
#ifdef ENABLE_ELUNA
sEluna->OnLogout(_player);
#endif /* ENABLE_ELUNA */
///- Remove the player from the world
// the player may not be in the world when logging out
// e.g if he got disconnected during a transfer to another map
@ -503,8 +589,11 @@ void WorldSession::LogoutPlayer(bool Save)
// No SQL injection as AccountId is uint32
static SqlStatementID updChars;
#ifdef ENABLE_PLAYERBOTS
SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 0 WHERE account = ?");
#else
stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 0 WHERE account = ?");
#endif
stmt.PExecute(GetAccountId());
DEBUG_LOG("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
@ -520,7 +609,7 @@ void WorldSession::LogoutPlayer(bool Save)
void WorldSession::KickPlayer()
{
if (m_Socket)
m_Socket->CloseSocket();
{ m_Socket->CloseSocket(); }
}
/// Cancel channeling handler
@ -775,7 +864,7 @@ void WorldSession::SendAccountDataTimes(uint32 mask)
void WorldSession::LoadTutorialsData()
{
for (int aX = 0 ; aX < 8 ; ++aX)
m_Tutorials[ aX ] = 0;
{ m_Tutorials[ aX ] = 0; }
QueryResult* result = CharacterDatabase.PQuery("SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u'", GetAccountId());
@ -790,7 +879,7 @@ void WorldSession::LoadTutorialsData()
Field* fields = result->Fetch();
for (int iI = 0; iI < 8; ++iI)
m_Tutorials[iI] = fields[iI].GetUInt32();
{ m_Tutorials[iI] = fields[iI].GetUInt32(); }
}
while (result->NextRow());
@ -820,7 +909,7 @@ void WorldSession::SendTutorialsData()
{
WorldPacket data(SMSG_TUTORIAL_FLAGS, 4 * 8);
for (uint32 i = 0; i < 8; ++i)
data << m_Tutorials[i];
{ data << m_Tutorials[i]; }
SendPacket(&data);
}
@ -835,7 +924,7 @@ void WorldSession::SaveTutorialsData()
{
SqlStatement stmt = CharacterDatabase.CreateStatement(updTutorial, "UPDATE character_tutorial SET tut0=?, tut1=?, tut2=?, tut3=?, tut4=?, tut5=?, tut6=?, tut7=? WHERE account = ?");
for (int i = 0; i < 8; ++i)
stmt.addUInt32(m_Tutorials[i]);
{ stmt.addUInt32(m_Tutorials[i]); }
stmt.addUInt32(GetAccountId());
stmt.Execute();
@ -848,7 +937,7 @@ void WorldSession::SaveTutorialsData()
stmt.addUInt32(GetAccountId());
for (int i = 0; i < 8; ++i)
stmt.addUInt32(m_Tutorials[i]);
{ stmt.addUInt32(m_Tutorials[i]); }
stmt.Execute();
}
@ -984,15 +1073,6 @@ void WorldSession::SendAddonsInfo()
SendPacket(&data);
}
void WorldSession::SetPlayer(Player* plr)
{
_player = plr;
// set m_GUID that can be used while player loggined and later until m_playerRecentlyLogout not reset
if (_player)
m_GUIDLow = _player->GetGUIDLow();
}
void WorldSession::SendRedirectClient(std::string& ip, uint16 port)
{
uint32 ip2 = ACE_OS::inet_addr(ip.c_str());
@ -1014,10 +1094,15 @@ void WorldSession::SendRedirectClient(std::string& ip, uint16 port)
void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* packet)
{
#ifdef ENABLE_ELUNA
if (!sEluna->OnPacketReceive(this, *packet))
return;
#endif /* ENABLE_ELUNA */
// need prevent do internal far teleports in handlers because some handlers do lot steps
// or call code that can do far teleports in some conditions unexpectedly for generic way work code
if (_player)
_player->SetCanDelayTeleport(true);
{ _player->SetCanDelayTeleport(true); }
(this->*opHandle.handler)(*packet);
@ -1029,9 +1114,25 @@ void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* pac
// we should execute delayed teleports only for alive(!) players
// because we don't want player's ghost teleported from graveyard
if (_player->IsHasDelayedTeleport())
_player->TeleportTo(_player->m_teleport_dest, _player->m_teleport_options);
{ _player->TeleportTo(_player->m_teleport_dest, _player->m_teleport_options); }
}
if (packet->rpos() < packet->wpos() && sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG))
LogUnprocessedTail(packet);
{ LogUnprocessedTail(packet); }
}
void WorldSession::InitWarden(uint16 build, BigNumber* k, std::string const& os)
{
_build = build;
if (os == "Win" && sWorld.getConfig(CONFIG_BOOL_WARDEN_WIN_ENABLED))
{
_warden = new WardenWin();
_warden->Init(this, k);
}
else if (os == "OSX" && sWorld.getConfig(CONFIG_BOOL_WARDEN_OSX_ENABLED))
{
_warden = new WardenMac();
_warden->Init(this, k);
}
}

View file

@ -26,10 +26,11 @@
/// @{
/// \file
#ifndef __WORLDSESSION_H
#define __WORLDSESSION_H
#ifndef MANGOS_H_WORLDSESSION
#define MANGOS_H_WORLDSESSION
#include "Common.h"
#include "Auth/BigNumber.h"
#include "SharedDefines.h"
#include "ObjectGuid.h"
#include "AuctionHouseMgr.h"
@ -186,13 +187,18 @@ class PacketFilter
explicit PacketFilter(WorldSession* pSession) : m_pSession(pSession) {}
virtual ~PacketFilter() {}
virtual bool Process(WorldPacket* /*packet*/) { return true; }
virtual bool ProcessLogout() const { return true; }
virtual bool Process(WorldPacket* /*packet*/)
{
return true;
}
virtual bool ProcessLogout() const
{
return true;
}
protected:
WorldSession* const m_pSession;
};
// process only thread-safe packets in Map::Update()
class MapSessionFilter : public PacketFilter
{
@ -202,7 +208,10 @@ class MapSessionFilter : public PacketFilter
virtual bool Process(WorldPacket* packet) override;
// in Map::Update() we do not process player logout!
virtual bool ProcessLogout() const override { return false; }
virtual bool ProcessLogout() const override
{
return false;
}
};
// class used to filer only thread-unsafe packets from queue
@ -225,9 +234,19 @@ class WorldSession
WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale);
~WorldSession();
bool PlayerLoading() const { return m_playerLoading; }
bool PlayerLogout() const { return m_playerLogout; }
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
bool PlayerLoading() const
{
return m_playerLoading;
}
bool PlayerLogout() const
{
return m_playerLogout;
}
bool PlayerLogoutWithSave() const
{
return m_playerLogout && m_playerSave;
}
void SizeError(WorldPacket const& packet, uint32 size) const;
@ -262,20 +281,46 @@ class WorldSession
void SendQueryTimeResponse();
void SendRedirectClient(std::string& ip, uint16 port);
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }
Player* GetPlayer() const { return _player; }
AccountTypes GetSecurity() const
{
return _security;
}
uint32 GetAccountId() const
{
return _accountId;
}
Player* GetPlayer() const
{
return _player;
}
char const* GetPlayerName() const;
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
void SetPlayer(Player* plr);
void SetSecurity(AccountTypes security)
{
_security = security;
}
std::string const& GetRemoteAddress()
{
return m_Address;
}
void SetPlayer(Player* plr)
{
_player = plr;
}
uint8 Expansion() const { return m_expansion; }
// Warden
void InitWarden(uint16 build, BigNumber* k, std::string const& os);
/// Session in auth.queue currently
void SetInQueue(bool state) { m_inQueue = state; }
void SetInQueue(bool state)
{
m_inQueue = state;
}
/// Is the user engaged in a log out process?
bool isLogingOut() const { return _logoutTime || m_playerLogout; }
bool isLogingOut() const
{
return _logoutTime || m_playerLogout;
}
/// Engage the logout process for the user
void LogoutRequest(time_t requestTime)
@ -353,7 +398,7 @@ class WorldSession
{
m_Tutorials[intId] = value;
if (m_tutorialState == TUTORIALDATA_UNCHANGED)
m_tutorialState = TUTORIALDATA_CHANGED;
{ m_tutorialState = TUTORIALDATA_CHANGED; }
}
}
// used with item_page table
@ -398,16 +443,30 @@ class WorldSession
time_t m_muteTime;
// Locales
LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
int GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
LocaleConstant GetSessionDbcLocale() const
{
return m_sessionDbcLocale;
}
int GetSessionDbLocaleIndex() const
{
return m_sessionDbLocaleIndex;
}
const char* GetMangosString(int32 entry) const;
uint32 GetLatency() const { return m_latency; }
void SetLatency(uint32 latency) { m_latency = latency; }
uint32 GetLatency() const
{
return m_latency;
}
void SetLatency(uint32 latency)
{
m_latency = latency;
}
void SetClientTimeDelay(uint32 delay) { m_clientTimeDelay = delay; }
uint32 getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus);
public: // opcodes handlers
// opcodes handlers
void Handle_NULL(WorldPacket& recvPacket); // not used
void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead
void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client
@ -460,13 +519,24 @@ class WorldSession
void HandleRepopRequestOpcode(WorldPacket& recvPacket);
void HandleAutostoreLootItemOpcode(WorldPacket& recvPacket);
void HandleLootMoneyOpcode(WorldPacket& recvPacket);
/**
* Method which handles the loot Opcode sent by the client, happens when the player is actually looting the object.
* It generates required loot on purpose.
*/
void HandleLootOpcode(WorldPacket& recvPacket);
/**
* Method which handles the loot release opcode sent by the client, happens when the player has end looting the object.
* It will take care of the looting state of the object depending on the case.
*/
void HandleLootReleaseOpcode(WorldPacket& recvPacket);
void HandleLootMasterGiveOpcode(WorldPacket& recvPacket);
void HandleWhoOpcode(WorldPacket& recvPacket);
void HandleLogoutRequestOpcode(WorldPacket& recvPacket);
void HandlePlayerLogoutOpcode(WorldPacket& recvPacket);
void HandleLogoutCancelOpcode(WorldPacket& recvPacket);
void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket);
void HandleGMTicketCreateOpcode(WorldPacket& recvPacket);
void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket);
@ -516,6 +586,7 @@ class WorldSession
void HandleGameObjectQueryOpcode(WorldPacket& recvPacket);
// Movement Handler
void HandleMoveWorldportAckOpcode(WorldPacket& recvPacket);
void HandleMoveWorldportAckOpcode(); // for server-side calls
@ -638,7 +709,7 @@ class WorldSession
void HandleAuctionListOwnerItems(WorldPacket& recv_data);
void HandleAuctionPlaceBid(WorldPacket& recv_data);
void AuctionBind(uint32 price, AuctionEntry* auction, Player* pl, Player* auction_owner);
void AuctionBind(uint32 price, AuctionEntry * auction, Player * pl, Player* auction_owner);
void HandleAuctionListPendingSales(WorldPacket& recv_data);
void HandleGetMailList(WorldPacket& recv_data);
@ -843,6 +914,13 @@ class WorldSession
void HandleSetActiveVoiceChannel(WorldPacket& recv_data);
void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data);
#ifdef ENABLE_PLAYERBOTS
void HandleBotPackets();
#endif
// for Warden
uint16 GetClientBuild() const { return _build; }
// Guild Bank
void HandleGuildPermissions(WorldPacket& recv_data);
void HandleGuildBankMoneyWithdrawn(WorldPacket& recv_data);
@ -924,7 +1002,8 @@ class WorldSession
uint8 m_expansion;
// Warden
Warden* _warden;
Warden* _warden; // Remains NULL if Warden system is not enabled by config
uint16 _build; // connected client build
time_t _logoutTime;
bool m_inQueue; // session wait in auth.queue
@ -938,6 +1017,7 @@ class WorldSession
AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES];
uint32 m_Tutorials[8];
TutorialDataState m_tutorialState;
uint32 m_clientTimeDelay;
AddonsList m_addonsList;
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
};

View file

@ -1061,16 +1061,6 @@ void WorldSession::HandleSetActionBarTogglesOpcode(WorldPacket& recv_data)
GetPlayer()->SetByteValue(PLAYER_FIELD_BYTES, 2, ActionBar);
}
void WorldSession::HandleWardenDataOpcode(WorldPacket& recv_data)
{
recv_data.read_skip<uint8>();
/*
uint8 tmp;
recv_data >> tmp;
DEBUG_LOG("Received opcode CMSG_WARDEN_DATA, not resolve.uint8 = %u", tmp);
*/
}
void WorldSession::HandlePlayedTime(WorldPacket& recv_data)
{
uint8 unk1;

View file

@ -171,13 +171,35 @@ bool BigNumber::isZero() const
return BN_is_zero(_bn) != 0;
}
uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
uint8* BigNumber::AsByteArray(int minSize)
{
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
delete[] _array;
_array = new uint8[length];
// If we need more bytes than length of BigNumber set the rest to 0
if (length > GetNumBytes())
{ memset((void*)_array, 0, length); }
BN_bn2bin(_bn, (unsigned char*)_array);
std::reverse(_array, _array + length);
return _array;
}
uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
{
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
if (_array)
{
delete[] _array;
_array = NULL;
}
_array = new uint8[length];
// If we need more bytes than length of BigNumber set the rest to 0
if (length > GetNumBytes())
memset((void*)_array, 0, length);

View file

@ -240,7 +240,8 @@ class BigNumber
* @param minSize
* @return uint8
*/
uint8* AsByteArray(int minSize = 0, bool reverse = true);
uint8* AsByteArray(int minSize = 0);
uint8* AsByteArray(int minSize, bool reverse);
/**
* @brief
*