mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
Fix build errors after previous commit
This commit is contained in:
parent
c1150219d4
commit
35415eb738
5 changed files with 280 additions and 86 deletions
|
|
@ -39,9 +39,21 @@
|
||||||
#include "Guild.h"
|
#include "Guild.h"
|
||||||
#include "GuildMgr.h"
|
#include "GuildMgr.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
#include "ObjectAccessor.h"
|
||||||
#include "BattleGround/BattleGroundMgr.h"
|
#include "BattleGround/BattleGroundMgr.h"
|
||||||
#include "MapManager.h"
|
#include "MapManager.h"
|
||||||
#include "SocialMgr.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/AuthCrypt.h"
|
||||||
#include "Auth/HMACSHA1.h"
|
#include "Auth/HMACSHA1.h"
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
@ -51,12 +63,12 @@ static bool MapSessionFilterHelper(WorldSession* session, OpcodeHandler const& o
|
||||||
{
|
{
|
||||||
// we do not process thread-unsafe packets
|
// we do not process thread-unsafe packets
|
||||||
if (opHandle.packetProcessing == PROCESS_THREADUNSAFE)
|
if (opHandle.packetProcessing == PROCESS_THREADUNSAFE)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
// we do not process not loggined player packets
|
// we do not process not loggined player packets
|
||||||
Player* plr = session->GetPlayer();
|
Player* plr = session->GetPlayer();
|
||||||
if (!plr)
|
if (!plr)
|
||||||
return false;
|
{ return false; }
|
||||||
|
|
||||||
// in Map::Update() we do not process packets where player is not in world!
|
// in Map::Update() we do not process packets where player is not in world!
|
||||||
return plr->IsInWorld();
|
return plr->IsInWorld();
|
||||||
|
|
@ -67,7 +79,7 @@ bool MapSessionFilter::Process(WorldPacket* packet)
|
||||||
{
|
{
|
||||||
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
||||||
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
||||||
return true;
|
{ return true; }
|
||||||
|
|
||||||
// let's check if our opcode can be really processed in Map::Update()
|
// let's check if our opcode can be really processed in Map::Update()
|
||||||
return MapSessionFilterHelper(m_pSession, opHandle);
|
return MapSessionFilterHelper(m_pSession, opHandle);
|
||||||
|
|
@ -80,7 +92,7 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
|
||||||
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
||||||
// check if packet handler is supposed to be safe
|
// check if packet handler is supposed to be safe
|
||||||
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
||||||
return true;
|
{ return true; }
|
||||||
|
|
||||||
// let's check if our opcode can't be processed in Map::Update()
|
// let's check if our opcode can't be processed in Map::Update()
|
||||||
return !MapSessionFilterHelper(m_pSession, opHandle);
|
return !MapSessionFilterHelper(m_pSession, opHandle);
|
||||||
|
|
@ -105,7 +117,7 @@ WorldSession::~WorldSession()
|
||||||
{
|
{
|
||||||
///- unload player if not unloaded
|
///- unload player if not unloaded
|
||||||
if (_player)
|
if (_player)
|
||||||
LogoutPlayer(true);
|
{ LogoutPlayer(true); }
|
||||||
|
|
||||||
/// - If have unclosed socket, close it
|
/// - If have unclosed socket, close it
|
||||||
if (m_Socket)
|
if (m_Socket)
|
||||||
|
|
@ -115,10 +127,14 @@ WorldSession::~WorldSession()
|
||||||
m_Socket = NULL;
|
m_Socket = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warden
|
||||||
|
if (_warden)
|
||||||
|
delete _warden;
|
||||||
|
|
||||||
///- empty incoming packet queue
|
///- empty incoming packet queue
|
||||||
WorldPacket* packet = NULL;
|
WorldPacket* packet = NULL;
|
||||||
while (_recvQueue.next(packet))
|
while (_recvQueue.next(packet))
|
||||||
delete packet;
|
{ delete packet; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
|
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
|
||||||
|
|
@ -136,8 +152,17 @@ char const* WorldSession::GetPlayerName() const
|
||||||
/// Send a packet to the client
|
/// Send a packet to the client
|
||||||
void WorldSession::SendPacket(WorldPacket const* packet)
|
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)
|
if (!m_Socket)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
if (opcodeTable[packet->GetOpcode()].status == STATUS_UNHANDLED)
|
if (opcodeTable[packet->GetOpcode()].status == STATUS_UNHANDLED)
|
||||||
{
|
{
|
||||||
|
|
@ -184,7 +209,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||||
#endif // !MANGOS_DEBUG
|
#endif // !MANGOS_DEBUG
|
||||||
|
|
||||||
if (m_Socket->SendPacket(*packet) == -1)
|
if (m_Socket->SendPacket(*packet) == -1)
|
||||||
m_Socket->CloseSocket();
|
{ m_Socket->CloseSocket(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add an incoming packet to the queue
|
/// 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
|
// skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
|
||||||
if (!m_playerRecentlyLogout)
|
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())
|
else if (_player->IsInWorld())
|
||||||
ExecuteOpcode(opHandle, packet);
|
{ ExecuteOpcode(opHandle, packet); }
|
||||||
|
|
||||||
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
|
// 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;
|
break;
|
||||||
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT:
|
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT:
|
||||||
if (!_player && !m_playerRecentlyLogout)
|
if (!_player && !m_playerRecentlyLogout)
|
||||||
|
|
@ -249,15 +279,15 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// not expected _player or must checked in packet hanlder
|
// not expected _player or must checked in packet hanlder
|
||||||
ExecuteOpcode(opHandle, packet);
|
{ ExecuteOpcode(opHandle, packet); }
|
||||||
break;
|
break;
|
||||||
case STATUS_TRANSFER:
|
case STATUS_TRANSFER:
|
||||||
if (!_player)
|
if (!_player)
|
||||||
LogUnexpectedOpcode(packet, "the player has not logged in yet");
|
{ LogUnexpectedOpcode(packet, "the player has not logged in yet"); }
|
||||||
else if (_player->IsInWorld())
|
else if (_player->IsInWorld())
|
||||||
LogUnexpectedOpcode(packet, "the player is still in world");
|
{ LogUnexpectedOpcode(packet, "the player is still in world"); }
|
||||||
else
|
else
|
||||||
ExecuteOpcode(opHandle, packet);
|
{ ExecuteOpcode(opHandle, packet); }
|
||||||
break;
|
break;
|
||||||
case STATUS_AUTHED:
|
case STATUS_AUTHED:
|
||||||
// prevent cheating with skip queue wait
|
// prevent cheating with skip queue wait
|
||||||
|
|
@ -313,6 +343,11 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
delete packet;
|
delete packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
|
if (GetPlayer() && GetPlayer()->GetPlayerbotMgr())
|
||||||
|
GetPlayer()->GetPlayerbotMgr()->UpdateSessions(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
///- Cleanup socket pointer if need
|
///- Cleanup socket pointer if need
|
||||||
if (m_Socket && m_Socket->IsClosed())
|
if (m_Socket && m_Socket->IsClosed())
|
||||||
{
|
{
|
||||||
|
|
@ -320,6 +355,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
m_Socket = NULL;
|
m_Socket = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_Socket && !m_Socket->IsClosed() && _warden)
|
||||||
|
_warden->Update();
|
||||||
|
|
||||||
// check if we are safe to proceed with logout
|
// check if we are safe to proceed with logout
|
||||||
// logout procedure should happen only in World::UpdateSessions() method!!!
|
// logout procedure should happen only in World::UpdateSessions() method!!!
|
||||||
if (updater.ProcessLogout())
|
if (updater.ProcessLogout())
|
||||||
|
|
@ -327,31 +365,58 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
///- If necessary, log the player out
|
///- If necessary, log the player out
|
||||||
time_t currTime = time(NULL);
|
time_t currTime = time(NULL);
|
||||||
if (!m_Socket || (ShouldLogOut(currTime) && !m_playerLoading))
|
if (!m_Socket || (ShouldLogOut(currTime) && !m_playerLoading))
|
||||||
LogoutPlayer(true);
|
{ LogoutPlayer(true); }
|
||||||
|
|
||||||
|
if (m_Socket && GetPlayer() && _warden)
|
||||||
|
_warden->Update();
|
||||||
|
|
||||||
if (!m_Socket)
|
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;
|
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
|
/// %Log the player out
|
||||||
void WorldSession::LogoutPlayer(bool Save)
|
void WorldSession::LogoutPlayer(bool Save)
|
||||||
{
|
{
|
||||||
// finish pending transfers before starting the logout
|
// finish pending transfers before starting the logout
|
||||||
while (_player && _player->IsBeingTeleportedFar())
|
while (_player && _player->IsBeingTeleportedFar())
|
||||||
HandleMoveWorldportAckOpcode();
|
{ HandleMoveWorldportAckOpcode(); }
|
||||||
|
|
||||||
m_playerLogout = true;
|
m_playerLogout = true;
|
||||||
m_playerSave = Save;
|
m_playerSave = Save;
|
||||||
|
|
||||||
if (_player)
|
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());
|
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() , _player->GetGUIDLow());
|
||||||
|
|
||||||
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
|
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
|
///- 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
|
// 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)
|
||||||
{
|
{
|
||||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
aset.insert((Player*)owner);
|
{ aset.insert((Player*)owner); }
|
||||||
}
|
}
|
||||||
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
|
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
|
||||||
aset.insert((Player*)(*itr));
|
{ aset.insert((Player*)(*itr)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
_player->SetPvPDeath(!aset.empty());
|
_player->SetPvPDeath(!aset.empty());
|
||||||
|
|
@ -388,13 +453,13 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
|
|
||||||
// give honor to all attackers from set like group case
|
// give honor to all attackers from set like group case
|
||||||
for (std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr)
|
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
|
// give bg rewards and update counters like kill by first from attackers
|
||||||
// this can't be called for all attackers.
|
// this can't be called for all attackers.
|
||||||
if (!aset.empty())
|
if (!aset.empty())
|
||||||
if (BattleGround* bg = _player->GetBattleGround())
|
if (BattleGround* bg = _player->GetBattleGround())
|
||||||
bg->HandleKillPlayer(_player, *aset.begin());
|
{ bg->HandleKillPlayer(_player, *aset.begin()); }
|
||||||
}
|
}
|
||||||
else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
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
|
// drop a flag if player is carrying it
|
||||||
if (BattleGround* bg = _player->GetBattleGround())
|
if (BattleGround* bg = _player->GetBattleGround())
|
||||||
bg->EventPlayerLoggedOut(_player);
|
{ bg->EventPlayerLoggedOut(_player); }
|
||||||
|
|
||||||
///- Teleport to home if the player is in an invalid instance
|
///- Teleport to home if the player is in an invalid instance
|
||||||
if (!_player->m_InstanceValid && !_player->isGameMaster())
|
if (!_player->m_InstanceValid && !_player->isGameMaster())
|
||||||
|
|
@ -420,7 +485,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
// FG: finish pending transfers after starting the logout
|
// 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
|
// this should fix players beeing able to logout and login back with full hp at death position
|
||||||
while (_player->IsBeingTeleportedFar())
|
while (_player->IsBeingTeleportedFar())
|
||||||
HandleMoveWorldportAckOpcode();
|
{ HandleMoveWorldportAckOpcode(); }
|
||||||
|
|
||||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
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
|
///- 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 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
|
// 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;
|
static SqlStatementID id;
|
||||||
|
|
||||||
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE account SET active_realm_id = ? WHERE id = ?");
|
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE account SET active_realm_id = ? WHERE id = ?");
|
||||||
stmt.PExecute(uint32(0), GetAccountId());
|
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 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()))
|
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
|
///- 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)
|
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
|
||||||
if (Save)
|
if (Save)
|
||||||
_player->SaveToDB();
|
{ _player->SaveToDB(); }
|
||||||
|
|
||||||
///- Leave all channels before player delete...
|
///- Leave all channels before player delete...
|
||||||
_player->CleanupChannels();
|
_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.
|
///- If the player is in a group (or invited), remove him. If the group if then only 1 person, disband the group.
|
||||||
_player->UninviteFromGroup();
|
_player->UninviteFromGroup();
|
||||||
|
|
||||||
// remove player from the group if he is:
|
// 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)
|
// 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)
|
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket)
|
||||||
_player->RemoveFromGroup();
|
{ _player->RemoveFromGroup(); }
|
||||||
|
#endif
|
||||||
///- Send update to group
|
///- Send update to group
|
||||||
if (_player->GetGroup())
|
if (_player->GetGroup())
|
||||||
_player->GetGroup()->SendUpdate();
|
{ _player->GetGroup()->SendUpdate(); }
|
||||||
|
|
||||||
///- Broadcast a logout message to the player's friends
|
///- Broadcast a logout message to the player's friends
|
||||||
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetObjectGuid(), true);
|
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetObjectGuid(), true);
|
||||||
sSocialMgr.RemovePlayerSocial(_player->GetGUIDLow());
|
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
|
///- Remove the player from the world
|
||||||
// the player may not be in the world when logging out
|
// the player may not be in the world when logging out
|
||||||
// e.g if he got disconnected during a transfer to another map
|
// 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
|
// No SQL injection as AccountId is uint32
|
||||||
|
|
||||||
static SqlStatementID updChars;
|
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 = ?");
|
stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 0 WHERE account = ?");
|
||||||
|
#endif
|
||||||
stmt.PExecute(GetAccountId());
|
stmt.PExecute(GetAccountId());
|
||||||
|
|
||||||
DEBUG_LOG("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
DEBUG_LOG("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
||||||
|
|
@ -520,7 +609,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
void WorldSession::KickPlayer()
|
void WorldSession::KickPlayer()
|
||||||
{
|
{
|
||||||
if (m_Socket)
|
if (m_Socket)
|
||||||
m_Socket->CloseSocket();
|
{ m_Socket->CloseSocket(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cancel channeling handler
|
/// Cancel channeling handler
|
||||||
|
|
@ -775,7 +864,7 @@ void WorldSession::SendAccountDataTimes(uint32 mask)
|
||||||
void WorldSession::LoadTutorialsData()
|
void WorldSession::LoadTutorialsData()
|
||||||
{
|
{
|
||||||
for (int aX = 0 ; aX < 8 ; ++aX)
|
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());
|
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();
|
Field* fields = result->Fetch();
|
||||||
|
|
||||||
for (int iI = 0; iI < 8; ++iI)
|
for (int iI = 0; iI < 8; ++iI)
|
||||||
m_Tutorials[iI] = fields[iI].GetUInt32();
|
{ m_Tutorials[iI] = fields[iI].GetUInt32(); }
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
|
|
@ -820,7 +909,7 @@ void WorldSession::SendTutorialsData()
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_TUTORIAL_FLAGS, 4 * 8);
|
WorldPacket data(SMSG_TUTORIAL_FLAGS, 4 * 8);
|
||||||
for (uint32 i = 0; i < 8; ++i)
|
for (uint32 i = 0; i < 8; ++i)
|
||||||
data << m_Tutorials[i];
|
{ data << m_Tutorials[i]; }
|
||||||
SendPacket(&data);
|
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 = ?");
|
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)
|
for (int i = 0; i < 8; ++i)
|
||||||
stmt.addUInt32(m_Tutorials[i]);
|
{ stmt.addUInt32(m_Tutorials[i]); }
|
||||||
|
|
||||||
stmt.addUInt32(GetAccountId());
|
stmt.addUInt32(GetAccountId());
|
||||||
stmt.Execute();
|
stmt.Execute();
|
||||||
|
|
@ -848,7 +937,7 @@ void WorldSession::SaveTutorialsData()
|
||||||
|
|
||||||
stmt.addUInt32(GetAccountId());
|
stmt.addUInt32(GetAccountId());
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
stmt.addUInt32(m_Tutorials[i]);
|
{ stmt.addUInt32(m_Tutorials[i]); }
|
||||||
|
|
||||||
stmt.Execute();
|
stmt.Execute();
|
||||||
}
|
}
|
||||||
|
|
@ -984,15 +1073,6 @@ void WorldSession::SendAddonsInfo()
|
||||||
SendPacket(&data);
|
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)
|
void WorldSession::SendRedirectClient(std::string& ip, uint16 port)
|
||||||
{
|
{
|
||||||
uint32 ip2 = ACE_OS::inet_addr(ip.c_str());
|
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)
|
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
|
// 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
|
// or call code that can do far teleports in some conditions unexpectedly for generic way work code
|
||||||
if (_player)
|
if (_player)
|
||||||
_player->SetCanDelayTeleport(true);
|
{ _player->SetCanDelayTeleport(true); }
|
||||||
|
|
||||||
(this->*opHandle.handler)(*packet);
|
(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
|
// we should execute delayed teleports only for alive(!) players
|
||||||
// because we don't want player's ghost teleported from graveyard
|
// because we don't want player's ghost teleported from graveyard
|
||||||
if (_player->IsHasDelayedTeleport())
|
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))
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -26,10 +26,11 @@
|
||||||
/// @{
|
/// @{
|
||||||
/// \file
|
/// \file
|
||||||
|
|
||||||
#ifndef __WORLDSESSION_H
|
#ifndef MANGOS_H_WORLDSESSION
|
||||||
#define __WORLDSESSION_H
|
#define MANGOS_H_WORLDSESSION
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "Auth/BigNumber.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
#include "AuctionHouseMgr.h"
|
#include "AuctionHouseMgr.h"
|
||||||
|
|
@ -186,13 +187,18 @@ class PacketFilter
|
||||||
explicit PacketFilter(WorldSession* pSession) : m_pSession(pSession) {}
|
explicit PacketFilter(WorldSession* pSession) : m_pSession(pSession) {}
|
||||||
virtual ~PacketFilter() {}
|
virtual ~PacketFilter() {}
|
||||||
|
|
||||||
virtual bool Process(WorldPacket* /*packet*/) { return true; }
|
virtual bool Process(WorldPacket* /*packet*/)
|
||||||
virtual bool ProcessLogout() const { return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool ProcessLogout() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WorldSession* const m_pSession;
|
WorldSession* const m_pSession;
|
||||||
};
|
};
|
||||||
|
|
||||||
// process only thread-safe packets in Map::Update()
|
// process only thread-safe packets in Map::Update()
|
||||||
class MapSessionFilter : public PacketFilter
|
class MapSessionFilter : public PacketFilter
|
||||||
{
|
{
|
||||||
|
|
@ -202,7 +208,10 @@ class MapSessionFilter : public PacketFilter
|
||||||
|
|
||||||
virtual bool Process(WorldPacket* packet) override;
|
virtual bool Process(WorldPacket* packet) override;
|
||||||
// in Map::Update() we do not process player logout!
|
// 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
|
// 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(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale);
|
||||||
~WorldSession();
|
~WorldSession();
|
||||||
|
|
||||||
bool PlayerLoading() const { return m_playerLoading; }
|
bool PlayerLoading() const
|
||||||
bool PlayerLogout() const { return m_playerLogout; }
|
{
|
||||||
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
|
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;
|
void SizeError(WorldPacket const& packet, uint32 size) const;
|
||||||
|
|
||||||
|
|
@ -262,20 +281,46 @@ class WorldSession
|
||||||
void SendQueryTimeResponse();
|
void SendQueryTimeResponse();
|
||||||
void SendRedirectClient(std::string& ip, uint16 port);
|
void SendRedirectClient(std::string& ip, uint16 port);
|
||||||
|
|
||||||
AccountTypes GetSecurity() const { return _security; }
|
AccountTypes GetSecurity() const
|
||||||
uint32 GetAccountId() const { return _accountId; }
|
{
|
||||||
Player* GetPlayer() const { return _player; }
|
return _security;
|
||||||
|
}
|
||||||
|
uint32 GetAccountId() const
|
||||||
|
{
|
||||||
|
return _accountId;
|
||||||
|
}
|
||||||
|
Player* GetPlayer() const
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
char const* GetPlayerName() const;
|
char const* GetPlayerName() const;
|
||||||
void SetSecurity(AccountTypes security) { _security = security; }
|
void SetSecurity(AccountTypes security)
|
||||||
std::string const& GetRemoteAddress() { return m_Address; }
|
{
|
||||||
void SetPlayer(Player* plr);
|
_security = security;
|
||||||
|
}
|
||||||
|
std::string const& GetRemoteAddress()
|
||||||
|
{
|
||||||
|
return m_Address;
|
||||||
|
}
|
||||||
|
void SetPlayer(Player* plr)
|
||||||
|
{
|
||||||
|
_player = plr;
|
||||||
|
}
|
||||||
uint8 Expansion() const { return m_expansion; }
|
uint8 Expansion() const { return m_expansion; }
|
||||||
|
// Warden
|
||||||
|
void InitWarden(uint16 build, BigNumber* k, std::string const& os);
|
||||||
|
|
||||||
/// Session in auth.queue currently
|
/// 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?
|
/// 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
|
/// Engage the logout process for the user
|
||||||
void LogoutRequest(time_t requestTime)
|
void LogoutRequest(time_t requestTime)
|
||||||
|
|
@ -353,7 +398,7 @@ class WorldSession
|
||||||
{
|
{
|
||||||
m_Tutorials[intId] = value;
|
m_Tutorials[intId] = value;
|
||||||
if (m_tutorialState == TUTORIALDATA_UNCHANGED)
|
if (m_tutorialState == TUTORIALDATA_UNCHANGED)
|
||||||
m_tutorialState = TUTORIALDATA_CHANGED;
|
{ m_tutorialState = TUTORIALDATA_CHANGED; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// used with item_page table
|
// used with item_page table
|
||||||
|
|
@ -398,16 +443,30 @@ class WorldSession
|
||||||
time_t m_muteTime;
|
time_t m_muteTime;
|
||||||
|
|
||||||
// Locales
|
// Locales
|
||||||
LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
|
LocaleConstant GetSessionDbcLocale() const
|
||||||
int GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
|
{
|
||||||
|
return m_sessionDbcLocale;
|
||||||
|
}
|
||||||
|
int GetSessionDbLocaleIndex() const
|
||||||
|
{
|
||||||
|
return m_sessionDbLocaleIndex;
|
||||||
|
}
|
||||||
const char* GetMangosString(int32 entry) const;
|
const char* GetMangosString(int32 entry) const;
|
||||||
|
|
||||||
uint32 GetLatency() const { return m_latency; }
|
uint32 GetLatency() const
|
||||||
void SetLatency(uint32 latency) { m_latency = latency; }
|
{
|
||||||
|
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);
|
uint32 getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus);
|
||||||
|
|
||||||
public: // opcodes handlers
|
public: // opcodes handlers
|
||||||
|
|
||||||
|
// opcodes handlers
|
||||||
void Handle_NULL(WorldPacket& recvPacket); // not used
|
void Handle_NULL(WorldPacket& recvPacket); // not used
|
||||||
void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead
|
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
|
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 HandleRepopRequestOpcode(WorldPacket& recvPacket);
|
||||||
void HandleAutostoreLootItemOpcode(WorldPacket& recvPacket);
|
void HandleAutostoreLootItemOpcode(WorldPacket& recvPacket);
|
||||||
void HandleLootMoneyOpcode(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);
|
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 HandleLootReleaseOpcode(WorldPacket& recvPacket);
|
||||||
void HandleLootMasterGiveOpcode(WorldPacket& recvPacket);
|
void HandleLootMasterGiveOpcode(WorldPacket& recvPacket);
|
||||||
void HandleWhoOpcode(WorldPacket& recvPacket);
|
void HandleWhoOpcode(WorldPacket& recvPacket);
|
||||||
void HandleLogoutRequestOpcode(WorldPacket& recvPacket);
|
void HandleLogoutRequestOpcode(WorldPacket& recvPacket);
|
||||||
void HandlePlayerLogoutOpcode(WorldPacket& recvPacket);
|
void HandlePlayerLogoutOpcode(WorldPacket& recvPacket);
|
||||||
void HandleLogoutCancelOpcode(WorldPacket& recvPacket);
|
void HandleLogoutCancelOpcode(WorldPacket& recvPacket);
|
||||||
|
|
||||||
void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket);
|
void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket);
|
||||||
void HandleGMTicketCreateOpcode(WorldPacket& recvPacket);
|
void HandleGMTicketCreateOpcode(WorldPacket& recvPacket);
|
||||||
void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket);
|
void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket);
|
||||||
|
|
@ -516,6 +586,7 @@ class WorldSession
|
||||||
|
|
||||||
void HandleGameObjectQueryOpcode(WorldPacket& recvPacket);
|
void HandleGameObjectQueryOpcode(WorldPacket& recvPacket);
|
||||||
|
|
||||||
|
// Movement Handler
|
||||||
void HandleMoveWorldportAckOpcode(WorldPacket& recvPacket);
|
void HandleMoveWorldportAckOpcode(WorldPacket& recvPacket);
|
||||||
void HandleMoveWorldportAckOpcode(); // for server-side calls
|
void HandleMoveWorldportAckOpcode(); // for server-side calls
|
||||||
|
|
||||||
|
|
@ -638,7 +709,7 @@ class WorldSession
|
||||||
void HandleAuctionListOwnerItems(WorldPacket& recv_data);
|
void HandleAuctionListOwnerItems(WorldPacket& recv_data);
|
||||||
void HandleAuctionPlaceBid(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 HandleAuctionListPendingSales(WorldPacket& recv_data);
|
||||||
|
|
||||||
void HandleGetMailList(WorldPacket& recv_data);
|
void HandleGetMailList(WorldPacket& recv_data);
|
||||||
|
|
@ -843,6 +914,13 @@ class WorldSession
|
||||||
void HandleSetActiveVoiceChannel(WorldPacket& recv_data);
|
void HandleSetActiveVoiceChannel(WorldPacket& recv_data);
|
||||||
void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data);
|
void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data);
|
||||||
|
|
||||||
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
|
void HandleBotPackets();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// for Warden
|
||||||
|
uint16 GetClientBuild() const { return _build; }
|
||||||
|
|
||||||
// Guild Bank
|
// Guild Bank
|
||||||
void HandleGuildPermissions(WorldPacket& recv_data);
|
void HandleGuildPermissions(WorldPacket& recv_data);
|
||||||
void HandleGuildBankMoneyWithdrawn(WorldPacket& recv_data);
|
void HandleGuildBankMoneyWithdrawn(WorldPacket& recv_data);
|
||||||
|
|
@ -924,7 +1002,8 @@ class WorldSession
|
||||||
uint8 m_expansion;
|
uint8 m_expansion;
|
||||||
|
|
||||||
// Warden
|
// Warden
|
||||||
Warden* _warden;
|
Warden* _warden; // Remains NULL if Warden system is not enabled by config
|
||||||
|
uint16 _build; // connected client build
|
||||||
|
|
||||||
time_t _logoutTime;
|
time_t _logoutTime;
|
||||||
bool m_inQueue; // session wait in auth.queue
|
bool m_inQueue; // session wait in auth.queue
|
||||||
|
|
@ -938,6 +1017,7 @@ class WorldSession
|
||||||
AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES];
|
AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES];
|
||||||
uint32 m_Tutorials[8];
|
uint32 m_Tutorials[8];
|
||||||
TutorialDataState m_tutorialState;
|
TutorialDataState m_tutorialState;
|
||||||
|
uint32 m_clientTimeDelay;
|
||||||
AddonsList m_addonsList;
|
AddonsList m_addonsList;
|
||||||
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
|
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1061,16 +1061,6 @@ void WorldSession::HandleSetActionBarTogglesOpcode(WorldPacket& recv_data)
|
||||||
GetPlayer()->SetByteValue(PLAYER_FIELD_BYTES, 2, ActionBar);
|
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)
|
void WorldSession::HandlePlayedTime(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
uint8 unk1;
|
uint8 unk1;
|
||||||
|
|
|
||||||
|
|
@ -171,13 +171,35 @@ bool BigNumber::isZero() const
|
||||||
return BN_is_zero(_bn) != 0;
|
return BN_is_zero(_bn) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
|
uint8* BigNumber::AsByteArray(int minSize)
|
||||||
{
|
{
|
||||||
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
|
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
|
||||||
|
|
||||||
delete[] _array;
|
delete[] _array;
|
||||||
_array = new uint8[length];
|
_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 we need more bytes than length of BigNumber set the rest to 0
|
||||||
if (length > GetNumBytes())
|
if (length > GetNumBytes())
|
||||||
memset((void*)_array, 0, length);
|
memset((void*)_array, 0, length);
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,8 @@ class BigNumber
|
||||||
* @param minSize
|
* @param minSize
|
||||||
* @return uint8
|
* @return uint8
|
||||||
*/
|
*/
|
||||||
uint8* AsByteArray(int minSize = 0, bool reverse = true);
|
uint8* AsByteArray(int minSize = 0);
|
||||||
|
uint8* AsByteArray(int minSize, bool reverse);
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue