Core/BG: Initial work on battleground and battlefield related packets

This commit is contained in:
Tuxity
2012-08-28 23:42:15 +01:00
committed by Nay
parent 122df95165
commit ee760ab360
15 changed files with 738 additions and 266 deletions

View File

@@ -34,6 +34,8 @@
Battlefield::Battlefield()
{
m_Guid = MAKE_NEW_GUID(m_TypeId, 0, HIGHGUID_TYPE_BATTLEGROUND);
m_Timer = 0;
m_IsEnabled = true;
m_isActive = false;
@@ -100,7 +102,7 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end())
{
m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
player->GetSession()->SendBfLeaveMessage(m_BattleId);
player->GetSession()->SendBfLeaveMessage(m_Guid);
if (Group* group = player->GetGroup()) // Remove the player from the raid group
group->RemoveMember(player->GetGUID());
@@ -203,7 +205,7 @@ void Battlefield::InvitePlayerToQueue(Player* player)
return;
if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer)
player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId);
player->GetSession()->SendBfInvitePlayerToQueue(m_Guid);
}
void Battlefield::InvitePlayersInQueueToWar()
@@ -272,7 +274,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite;
player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite);
player->GetSession()->SendBfInvitePlayerToWar(m_Guid, m_ZoneId, m_TimeForAcceptInvite);
}
void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
@@ -368,7 +370,7 @@ void Battlefield::PlayerAcceptInviteToQueue(Player* player)
// Add player in queue
m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
// Send notification
player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId);
player->GetSession()->SendBfQueueInviteResponse(m_Guid, m_ZoneId);
}
// Called in WorldSession::HandleBfExitRequest
@@ -386,7 +388,7 @@ void Battlefield::PlayerAcceptInviteToWar(Player* player)
if (AddOrSetPlayerToCorrectBfGroup(player))
{
player->GetSession()->SendBfEntered(m_BattleId);
player->GetSession()->SendBfEntered(m_Guid);
m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());

View File

@@ -239,6 +239,7 @@ class Battlefield : public ZoneScript
uint32 GetTypeId() { return m_TypeId; }
uint32 GetZoneId() { return m_ZoneId; }
uint64 GetGUID() { return m_Guid; }
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
@@ -357,6 +358,8 @@ class Battlefield : public ZoneScript
void InitStalker(uint32 entry, float x, float y, float z, float o);
protected:
uint64 m_Guid;
uint64 StalkerGuid;
uint32 m_Timer; // Global timer for event
bool m_IsEnabled;

View File

@@ -27,124 +27,291 @@
#include "Opcodes.h"
//This send to player windows for invite player to join the war
//Param1:(BattleId) the BattleId of Bf
//Param1:(guid) the guid of Bf
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
//Param3:(time) Time in second that the player have for accept
void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
void WorldSession::SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 pTime)
{
//Send packet
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
data << uint32(BattleId);
data << uint32(ZoneId);
data << uint32((time(NULL) + p_time));
ObjectGuid guidBytes = guid;
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 16);
data.WriteBit(guidBytes[5]);
data.WriteBit(guidBytes[3]);
data.WriteBit(guidBytes[7]);
data.WriteBit(guidBytes[2]);
data.WriteBit(guidBytes[6]);
data.WriteBit(guidBytes[4]);
data.WriteBit(guidBytes[1]);
data.WriteBit(guidBytes[0]);
data.WriteByteSeq(guidBytes[6]);
data << uint32(zoneId); // Zone Id
data.WriteByteSeq(guidBytes[1]);
data.WriteByteSeq(guidBytes[3]);
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[2]);
data.WriteByteSeq(guidBytes[0]);
data << uint32(time(NULL) + pTime); // Invite lasts until
data.WriteByteSeq(guidBytes[7]);
data.WriteByteSeq(guidBytes[5]);
//Sending the packet to player
SendPacket(&data);
}
//This send invitation to player to join the queue
//Param1:(BattleId) the BattleId of Bf
void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
void WorldSession::SendBfInvitePlayerToQueue(uint64 guid)
{
ObjectGuid guidBytes = guid;
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5);
data << uint32(BattleId);
data << uint8(1); //warmup ? used ?
data.WriteBit(1); // unk
data.WriteBit(0); // Has Warmup
data.WriteBit(1); // unk
data.WriteBit(guidBytes[0]);
data.WriteBit(1); // unk
data.WriteBit(guidBytes[2]);
data.WriteBit(guidBytes[6]);
data.WriteBit(guidBytes[3]);
data.WriteBit(1); // unk
data.WriteBit(0); // unk
data.WriteBit(guidBytes[1]);
data.WriteBit(guidBytes[5]);
data.WriteBit(guidBytes[4]);
data.WriteBit(1); // unk
data.WriteBit(guidBytes[7]);
data.FlushBits();
data.WriteByteSeq(guidBytes[2]);
data.WriteByteSeq(guidBytes[3]);
data.WriteByteSeq(guidBytes[6]);
data << uint8(1); // Warmup
data.WriteByteSeq(guidBytes[5]);
data.WriteByteSeq(guidBytes[0]);
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[1]);
data.WriteByteSeq(guidBytes[7]);
//Sending packet to player
SendPacket(&data);
}
//This send packet for inform player that he join queue
//Param1:(BattleId) the BattleId of Bf
//Param1:(guid) the guid of Bf
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
//Param3:(CanQueue) if able to queue
//Param4:(Full) on log in is full
void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full)
void WorldSession::SendBfQueueInviteResponse(uint64 guid, uint32 ZoneId, bool CanQueue, bool Full)
{
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
data << uint32(BattleId);
const bool hasSecondGuid = false;
const bool warmup = true;
ObjectGuid guidBytes = guid;
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 16);
data.WriteBit(guidBytes[1]);
data.WriteBit(guidBytes[6]);
data.WriteBit(guidBytes[5]);
data.WriteBit(guidBytes[7]);
data.WriteBit(Full); // Logging In, VERIFYME
data.WriteBit(guidBytes[0]);
data.WriteBit(!hasSecondGuid);
data.WriteBit(guidBytes[4]);
// if (hasSecondGuid) 7 3 0 4 2 6 1 5
data.WriteBit(guidBytes[3]);
data.WriteBit(guidBytes[2]);
// if (hasSecondGuid) 2 5 3 0 4 6 1 7
data.FlushBits();
data << uint8(CanQueue); // Accepted
data.WriteByteSeq(guidBytes[1]);
data.WriteByteSeq(guidBytes[3]);
data.WriteByteSeq(guidBytes[6]);
data.WriteByteSeq(guidBytes[7]);
data.WriteByteSeq(guidBytes[0]);
data << uint8(warmup);
data.WriteByteSeq(guidBytes[2]);
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[5]);
data << uint32(ZoneId);
data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming
data << uint8(1); //Warmup
SendPacket(&data);
}
//This is call when player accept to join war
//Param1:(BattleId) the BattleId of Bf
void WorldSession::SendBfEntered(uint32 BattleId)
void WorldSession::SendBfEntered(uint64 guid)
{
// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
data << uint32(BattleId);
data << uint8(1); //unk
data << uint8(1); //unk
data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK
uint8 isAFK = _player->isAFK() ? 1 : 0;
ObjectGuid guidBytes = guid;
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 11);
data.WriteBit(0); // unk
data.WriteBit(isAFK); // Clear AFK
data.WriteBit(guidBytes[1]);
data.WriteBit(guidBytes[4]);
data.WriteBit(guidBytes[5]);
data.WriteBit(guidBytes[0]);
data.WriteBit(guidBytes[3]);
data.WriteBit(0); // unk
data.WriteBit(guidBytes[6]);
data.WriteBit(guidBytes[7]);
data.WriteBit(guidBytes[2]);
data.FlushBits();
data.WriteByteSeq(guidBytes[5]);
data.WriteByteSeq(guidBytes[3]);
data.WriteByteSeq(guidBytes[0]);
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[1]);
data.WriteByteSeq(guidBytes[7]);
data.WriteByteSeq(guidBytes[2]);
data.WriteByteSeq(guidBytes[6]);
SendPacket(&data);
}
void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
void WorldSession::SendBfLeaveMessage(uint64 guid, BFLeaveReason reason)
{
WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
data << uint32(BattleId);
data << uint8(reason);//byte Reason
data << uint8(2);//byte BattleStatus
data << uint8(0);//bool Relocated
ObjectGuid guidBytes = guid;
WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 11);
data.WriteBit(guidBytes[2]);
data.WriteBit(guidBytes[5]);
data.WriteBit(guidBytes[1]);
data.WriteBit(guidBytes[0]);
data.WriteBit(guidBytes[3]);
data.WriteBit(guidBytes[6]);
data.WriteBit(0); // Relocated
data.WriteBit(guidBytes[7]);
data.WriteBit(guidBytes[4]);
data.FlushBits();
data << uint8(2); // BattleStatus
data.WriteByteSeq(guidBytes[1]);
data.WriteByteSeq(guidBytes[7]);
data.WriteByteSeq(guidBytes[4]);
data.WriteByteSeq(guidBytes[2]);
data.WriteByteSeq(guidBytes[3]);
data << uint8(reason); // Reason
data.WriteByteSeq(guidBytes[6]);
data.WriteByteSeq(guidBytes[0]);
data.WriteByteSeq(guidBytes[5]);
SendPacket(&data);
}
//Send by client when he click on accept for queue
void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data)
void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
{
uint32 BattleId;
uint8 Accepted;
uint8 accepted;
ObjectGuid guid;
recv_data >> BattleId >> Accepted;
sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
accepted = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[5]);
sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: GUID:"UI64FMTD" Accepted:%u", guid, accepted);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
return;
if (Accepted)
{
Bf->PlayerAcceptInviteToQueue(_player);
}
if (accepted)
bf->PlayerAcceptInviteToQueue(_player);
}
//Send by client on clicking in accept or refuse of invitation windows for join game
void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data)
void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
{
uint32 BattleId;
uint8 Accepted;
uint8 accepted;
ObjectGuid guid;
recv_data >> BattleId >> Accepted;
sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
guid[6] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
accepted = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[5]);
sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: GUID:"UI64FMTD" Accepted:%u", guid, accepted);
Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if (!bf)
return;
//If player accept invitation
if (Accepted)
{
Bf->PlayerAcceptInviteToWar(_player);
}
if (accepted)
bf->PlayerAcceptInviteToWar(_player);
else
{
if (_player->GetZoneId() == Bf->GetZoneId())
Bf->KickPlayerFromBattlefield(_player->GetGUID());
}
if (_player->GetZoneId() == bf->GetZoneId())
bf->KickPlayerFromBattlefield(_player->GetGUID());
}
void WorldSession::HandleBfExitRequest(WorldPacket & recv_data)
void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
{
uint32 BattleId;
ObjectGuid guid;
recv_data >> BattleId;
sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
Bf->AskToLeaveQueue(_player);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[6]);
sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: GUID:"UI64FMTD" ", guid);
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldByGUID(guid))
bf->AskToLeaveQueue(_player);
}

View File

@@ -118,6 +118,15 @@ Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
return NULL;
}
Battlefield* BattlefieldMgr::GetBattlefieldByGUID(uint64 guid)
{
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
if ((*itr)->GetGUID() == guid)
return (*itr);
return NULL;
}
void BattlefieldMgr::Update(uint32 diff)
{
m_UpdateTimer += diff;

View File

@@ -48,6 +48,7 @@ class BattlefieldMgr
// return assigned battlefield
Battlefield *GetBattlefieldToZoneId(uint32 zoneid);
Battlefield *GetBattlefieldByBattleId(uint32 battleid);
Battlefield *GetBattlefieldByGUID(uint64 guid);
ZoneScript *GetZoneScript(uint32 zoneId);

View File

@@ -131,6 +131,7 @@ void Battleground::BroadcastWorker(Do& _do)
Battleground::Battleground()
{
m_Guid = MAKE_NEW_GUID(m_TypeID, 0, HIGHGUID_TYPE_BATTLEGROUND);
m_TypeID = BATTLEGROUND_TYPE_NONE;
m_RandomTypeID = BATTLEGROUND_TYPE_NONE;
m_InstanceID = 0;
@@ -493,7 +494,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
WorldPacket status;
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType());
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType());
player->GetSession()->SendPacket(&status);
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
@@ -914,7 +915,7 @@ void Battleground::EndBattleground(uint32 winner)
player->GetSession()->SendPacket(&data);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
player->GetSession()->SendPacket(&data);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
}
@@ -1020,7 +1021,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
if (SendPacket)
{
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
player->GetSession()->SendPacket(&data);
}
@@ -1144,14 +1145,14 @@ void Battleground::AddPlayer(Player* player)
UpdatePlayersCountByTeam(team, false); // +1 player
WorldPacket data;
sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, player);
sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, player->GetGUID());
SendPacketToTeam(team, &data, player, false);
// BG Status packet
WorldPacket status;
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), isArena() ? 0 : 1);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), isArena() ? 0 : 1);
player->GetSession()->SendPacket(&status);
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
@@ -1860,7 +1861,7 @@ void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player)
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
player->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType());
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType());
player->GetSession()->SendPacket(&data);
}

View File

@@ -133,12 +133,12 @@ enum BattlegroundBuffObjects
enum BattlegroundRandomRewards
{
BG_REWARD_WINNER_HONOR_FIRST = 30,
BG_REWARD_WINNER_ARENA_FIRST = 25,
BG_REWARD_WINNER_HONOR_LAST = 15,
BG_REWARD_WINNER_ARENA_LAST = 0,
BG_REWARD_LOSER_HONOR_FIRST = 5,
BG_REWARD_LOSER_HONOR_LAST = 5
BG_REWARD_WINNER_HONOR_FIRST = 270,
BG_REWARD_WINNER_CONQUEST_FIRST = 100,
BG_REWARD_WINNER_HONOR_LAST = 135,
BG_REWARD_WINNER_CONQUEST_LAST = 50,
BG_REWARD_LOSER_HONOR_FIRST = 45,
BG_REWARD_LOSER_HONOR_LAST = 35
};
const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY };
@@ -342,6 +342,7 @@ class Battleground
/* Battleground */
// Get methods:
char const* GetName() const { return m_Name; }
uint64 GetGUID() { return m_Guid; }
BattlegroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
BattlegroundBracketId GetBracketId() const { return m_BracketId; }
uint32 GetInstanceID() const { return m_InstanceID; }
@@ -635,6 +636,7 @@ class Battleground
bool m_PrematureCountDown;
uint32 m_PrematureCountDownTimer;
char const* m_Name;
uint64 m_Guid;
/* Pre- and post-update hooks */

View File

@@ -180,56 +180,244 @@ void BattlegroundMgr::Update(uint32 diff)
}
}
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame)
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, Player * pPlayer, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame)
{
// we can be in 2 queues in same time...
if (!bg)
StatusID = STATUS_NONE;
if (StatusID == 0 || !bg)
{
data->Initialize(SMSG_BATTLEFIELD_STATUS, 4+8);
*data << uint32(QueueSlot); // queue id (0...1)
*data << uint64(0);
return;
}
ObjectGuid guidBytes1 = pPlayer->GetGUID();
ObjectGuid guidBytes2 = bg->GetGUID();
data->Initialize(SMSG_BATTLEFIELD_STATUS, (4+8+1+1+4+1+4+4+4));
*data << uint32(QueueSlot); // queue id (0...1) - player can be in 2 queues in time
// The following segment is read as uint64 in client but can be appended as their original type.
*data << uint8(arenatype);
sLog->outDebug(LOG_FILTER_NETWORKIO, "BattlegroundMgr::BuildBattlegroundStatusPacket: arenatype = %u for bg instanceID %u, TypeID %u.", arenatype, bg->GetClientInstanceID(), bg->GetTypeID());
*data << uint8(bg->isArena() ? 0xC : 0x2);
*data << uint32(bg->GetTypeID());
*data << uint16(0x1F90);
// End of uint64 segment, decomposed this way for simplicity
*data << uint8(0); // 3.3.0, some level, only saw 80...
*data << uint8(0); // 3.3.0, some level, only saw 80...
*data << uint32(bg->GetClientInstanceID());
// alliance/horde for BG and skirmish/rated for Arenas
// following displays the minimap-icon 0 = faction icon 1 = arenaicon
*data << uint8(bg->isRated()); // 1 for rated match, 0 for bg or non rated match
*data << uint32(StatusID); // status
switch (StatusID)
{
case STATUS_WAIT_QUEUE: // status_in_queue
*data << uint32(Time1); // average wait time, milliseconds
*data << uint32(Time2); // time in queue, updated every minute!, milliseconds
case STATUS_NONE:
{
//data->Initialize(SMSG_BATTLEFIELD_STATUS_FAILED);
sLog->outDebug(LOG_FILTER_NETWORKIO, ">>>>> STATUS_NONE");
break;
case STATUS_WAIT_JOIN: // status_invite
*data << uint32(bg->GetMapId()); // map id
*data << uint64(0); // 3.3.5, unknown
*data << uint32(Time1); // time to remove from queue, milliseconds
}
case STATUS_WAIT_QUEUE:
{
data->Initialize(SMSG_BATTLEFIELD_STATUS_QUEUED);
data->WriteBit(guidBytes1[3]);
data->WriteBit(guidBytes1[0]);
data->WriteBit(guidBytes2[3]);
data->WriteBit(guidBytes1[2]);
data->WriteBit(0); // unk
data->WriteBit(0); // Join Failed
data->WriteBit(guidBytes2[2]);
data->WriteBit(guidBytes1[1]);
data->WriteBit(guidBytes2[0]);
data->WriteBit(guidBytes2[6]);
data->WriteBit(guidBytes2[4]);
data->WriteBit(guidBytes1[6]);
data->WriteBit(guidBytes1[7]);
data->WriteBit(guidBytes2[7]);
data->WriteBit(guidBytes2[5]);
data->WriteBit(guidBytes1[4]);
data->WriteBit(guidBytes1[5]);
data->WriteBit(0); // unk
data->WriteBit(0); // unk
data->WriteBit(guidBytes2[1]);
data->FlushBits();
data->WriteByteSeq(guidBytes1[0]);
*data << uint32(0); // unk
data->WriteByteSeq(guidBytes2[5]);
data->WriteByteSeq(guidBytes1[3]);
*data << uint32(0); // unk
data->WriteByteSeq(guidBytes2[7]);
data->WriteByteSeq(guidBytes2[1]);
data->WriteByteSeq(guidBytes2[2]);
*data << uint8(0); // unk
data->WriteByteSeq(guidBytes2[4]);
data->WriteByteSeq(guidBytes1[2]);
*data << uint8(0); // unk
data->WriteByteSeq(guidBytes2[6]);
data->WriteByteSeq(guidBytes1[7]);
data->WriteByteSeq(guidBytes2[3]);
data->WriteByteSeq(guidBytes1[6]);
data->WriteByteSeq(guidBytes2[0]);
*data << uint32(bg->GetStartTime()); // Time
*data << uint32(0); // unk
*data << uint8(bg->GetMinLevel()); // Min Level
*data << uint32(0); // unk
data->WriteByteSeq(guidBytes1[1]);
data->WriteByteSeq(guidBytes1[5]);
*data << uint32(0); // unk
data->WriteByteSeq(guidBytes1[4]);
break;
case STATUS_IN_PROGRESS: // status_in_progress
*data << uint32(bg->GetMapId()); // map id
*data << uint64(0); // 3.3.5, unknown
*data << uint32(Time1); // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
*data << uint32(Time2); // time from bg start, milliseconds
*data << uint8(uiFrame);
}
case STATUS_WAIT_JOIN:
{
data->Initialize(SMSG_BATTLEFIELD_STATUS_NEEDCONFIRMATION, 44);
*data << uint32(bg->GetClientInstanceID()); // Client Instance ID
*data << uint32(Time1); // Time until closed
*data << uint8(0); // unk
*data << uint32(QueueSlot); // Queue slot
*data << uint32(Time2); // Time
*data << uint8(bg->GetMinLevel()); // Min Level
*data << uint32(bg->GetStatus()); // Status
*data << uint32(bg->GetMapId()); // Map Id
*data << uint8(0); // unk
data->WriteBit(guidBytes1[5]);
data->WriteBit(guidBytes1[2]);
data->WriteBit(guidBytes1[1]);
data->WriteBit(guidBytes2[2]);
data->WriteBit(guidBytes1[4]);
data->WriteBit(guidBytes2[6]);
data->WriteBit(guidBytes2[3]);
data->WriteBit(bg->isRated()); // Is Rated
data->WriteBit(guidBytes1[7]);
data->WriteBit(guidBytes1[3]);
data->WriteBit(guidBytes2[7]);
data->WriteBit(guidBytes2[0]);
data->WriteBit(guidBytes2[4]);
data->WriteBit(guidBytes1[6]);
data->WriteBit(guidBytes2[1]);
data->WriteBit(guidBytes2[5]);
data->WriteBit(guidBytes1[0]);
data->FlushBits();
data->WriteByteSeq(guidBytes2[6]);
data->WriteByteSeq(guidBytes2[5]);
data->WriteByteSeq(guidBytes2[7]);
data->WriteByteSeq(guidBytes2[0]);
data->WriteByteSeq(guidBytes1[0]);
data->WriteByteSeq(guidBytes1[7]);
data->WriteByteSeq(guidBytes2[4]);
data->WriteByteSeq(guidBytes1[1]);
data->WriteByteSeq(guidBytes2[0]);
data->WriteByteSeq(guidBytes1[4]);
data->WriteByteSeq(guidBytes2[1]);
data->WriteByteSeq(guidBytes1[5]);
data->WriteByteSeq(guidBytes2[3]);
data->WriteByteSeq(guidBytes1[6]);
data->WriteByteSeq(guidBytes1[2]);
data->WriteByteSeq(guidBytes1[3]);
break;
default:
sLog->outError(LOG_FILTER_BATTLEGROUND, "Unknown BG status!");
}
case STATUS_IN_PROGRESS:
{
data->Initialize(SMSG_BATTLEFIELD_STATUS_ACTIVE, 49);
data->WriteBit(guidBytes1[2]);
data->WriteBit(guidBytes1[7]);
data->WriteBit(guidBytes2[7]);
data->WriteBit(guidBytes2[1]);
data->WriteBit(guidBytes1[5]);
data->WriteBit(0); // Unk
data->WriteBit(guidBytes2[0]);
data->WriteBit(guidBytes1[1]);
data->WriteBit(guidBytes2[3]);
data->WriteBit(guidBytes1[6]);
data->WriteBit(guidBytes2[5]);
data->WriteBit(0); // Unk Bit 64
data->WriteBit(guidBytes1[4]);
data->WriteBit(guidBytes2[6]);
data->WriteBit(guidBytes2[4]);
data->WriteBit(guidBytes2[2]);
data->WriteBit(guidBytes1[3]);
data->WriteBit(guidBytes1[0]);
data->WriteByteSeq(guidBytes2[4]);
data->WriteByteSeq(guidBytes2[5]);
data->WriteByteSeq(guidBytes1[5]);
data->WriteByteSeq(guidBytes2[1]);
data->WriteByteSeq(guidBytes2[6]);
data->WriteByteSeq(guidBytes2[3]);
data->WriteByteSeq(guidBytes2[7]);
data->WriteByteSeq(guidBytes1[6]);
*data << uint32(Time2); // Time
*data << uint8(bg->GetPlayersCountByTeam(bg->GetPlayerTeam(pPlayer->GetGUID()))); // Teamsize
data->WriteByteSeq(guidBytes1[4]);
data->WriteByteSeq(guidBytes1[1]);
*data << uint32(QueueSlot); // Queue slot
*data << uint8(bg->GetMaxLevel()); // Max Level
*data << uint32(bg->GetStatus()); // Status
*data << uint32(bg->GetMapId()); // Map Id
*data << uint8(bg->GetMinLevel()); // Min Level
*data << uint32(Time1); // Time until closed
data->WriteByteSeq(guidBytes1[2]);
*data << uint32(bg->GetStartTime()); // Time since started
data->WriteByteSeq(guidBytes1[0]);
data->WriteByteSeq(guidBytes1[3]);
data->WriteByteSeq(guidBytes1[2]);
*data << uint32(bg->GetClientInstanceID()); // Client Instance ID
data->WriteByteSeq(guidBytes2[0]);
data->WriteByteSeq(guidBytes1[7]);
break;
}
case STATUS_WAIT_LEAVE:
{
data->Initialize(SMSG_BATTLEFIELD_STATUS_WAITFORGROUPS, 48);
*data << uint8(0); // unk
*data << uint32(bg->GetStatus()); // Status
*data << uint32(QueueSlot); // Queue slot
*data << uint32(Time1); // Time until closed
*data << uint32(0); // unk
*data << uint8(0); // unk
*data << uint8(0); // unk
*data << uint8(bg->GetMinLevel()); // Min Level
*data << uint8(0); // unk
*data << uint8(0); // unk
*data << uint32(bg->GetMapId()); // Map Id
*data << uint32(Time2); // Time
*data << uint8(0); // unk
data->WriteBit(guidBytes2[0]);
data->WriteBit(guidBytes2[1]);
data->WriteBit(guidBytes2[7]);
data->WriteBit(guidBytes1[7]);
data->WriteBit(guidBytes1[0]);
data->WriteBit(guidBytes2[4]);
data->WriteBit(guidBytes1[6]);
data->WriteBit(guidBytes1[2]);
data->WriteBit(guidBytes1[3]);
data->WriteBit(guidBytes2[3]);
data->WriteBit(guidBytes1[4]);
data->WriteBit(guidBytes2[5]);
data->WriteBit(guidBytes1[5]);
data->WriteBit(guidBytes2[2]);
data->WriteBit(bg->isRated()); // Is Rated
data->WriteBit(guidBytes1[1]);
data->WriteBit(guidBytes2[6]);
data->FlushBits();
data->WriteByteSeq(guidBytes1[0]);
data->WriteByteSeq(guidBytes2[4]);
data->WriteByteSeq(guidBytes1[3]);
data->WriteByteSeq(guidBytes2[1]);
data->WriteByteSeq(guidBytes2[0]);
data->WriteByteSeq(guidBytes2[2]);
data->WriteByteSeq(guidBytes1[2]);
data->WriteByteSeq(guidBytes2[7]);
data->WriteByteSeq(guidBytes1[1]);
data->WriteByteSeq(guidBytes1[6]);
data->WriteByteSeq(guidBytes2[6]);
data->WriteByteSeq(guidBytes2[5]);
data->WriteByteSeq(guidBytes1[5]);
data->WriteByteSeq(guidBytes1[4]);
data->WriteByteSeq(guidBytes1[7]);
data->WriteByteSeq(guidBytes2[3]);
break;
}
}
}
@@ -419,12 +607,13 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
data->put(wpos, scoreCount);
}
void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result)
void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Battleground* bg, Player* pPlayer, GroupJoinBattlegroundResult result)
{
data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
*data << int32(result);
if (result == ERR_BATTLEGROUND_JOIN_TIMED_OUT || result == ERR_BATTLEGROUND_JOIN_FAILED)
*data << uint64(0); // player guid
ObjectGuid guidBytes1 = pPlayer->GetGUID();
ObjectGuid guidBytes2 = bg->GetGUID();
data->Initialize(SMSG_BATTLEFIELD_STATUS_FAILED);
}
void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value)
@@ -442,14 +631,52 @@ void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid)
{
ObjectGuid guidBytes = guid;
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
*data << uint64(guid);
data->WriteBit(guidBytes[7]);
data->WriteBit(guidBytes[6]);
data->WriteBit(guidBytes[2]);
data->WriteBit(guidBytes[4]);
data->WriteBit(guidBytes[5]);
data->WriteBit(guidBytes[1]);
data->WriteBit(guidBytes[3]);
data->WriteBit(guidBytes[0]);
data->WriteByteSeq(guidBytes[4]);
data->WriteByteSeq(guidBytes[2]);
data->WriteByteSeq(guidBytes[5]);
data->WriteByteSeq(guidBytes[7]);
data->WriteByteSeq(guidBytes[0]);
data->WriteByteSeq(guidBytes[6]);
data->WriteByteSeq(guidBytes[1]);
data->WriteByteSeq(guidBytes[3]);
}
void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player)
void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, uint64 guid)
{
ObjectGuid guidBytes = guid;
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
*data << uint64(player->GetGUID());
data->WriteBit(guidBytes[0]);
data->WriteBit(guidBytes[4]);
data->WriteBit(guidBytes[3]);
data->WriteBit(guidBytes[5]);
data->WriteBit(guidBytes[7]);
data->WriteBit(guidBytes[6]);
data->WriteBit(guidBytes[2]);
data->WriteBit(guidBytes[1]);
data->WriteByteSeq(guidBytes[1]);
data->WriteByteSeq(guidBytes[5]);
data->WriteByteSeq(guidBytes[3]);
data->WriteByteSeq(guidBytes[2]);
data->WriteByteSeq(guidBytes[0]);
data->WriteByteSeq(guidBytes[7]);
data->WriteByteSeq(guidBytes[4]);
data->WriteByteSeq(guidBytes[6]);
}
Battleground* BattlegroundMgr::GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId)
@@ -846,63 +1073,66 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
if (!player)
return;
uint32 winner_kills = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
uint32 winner_conquest = player->GetRandomWinner() ? BG_REWARD_WINNER_CONQUEST_FIRST : BG_REWARD_WINNER_CONQUEST_LAST;
uint32 winner_honor = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_FIRST : BG_REWARD_WINNER_HONOR_LAST;
uint32 loser_honor = !player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_FIRST : BG_REWARD_LOSER_HONOR_LAST;
winner_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(winner_kills));
loser_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills));
ObjectGuid guidBytes = guid;
data->Initialize(SMSG_BATTLEFIELD_LIST);
// TODO: Fix guid
*data << uint64(guid); // battlemaster guid
*data << uint32(winner_conquest); // Winner Conquest Reward or Random Winner Conquest Reward
*data << uint32(winner_conquest); // Winner Conquest Reward or Random Winner Conquest Reward
*data << uint32(loser_honor); // Loser Honor Reward or Random Loser Honor Reward
*data << uint32(bgTypeId); // battleground id
*data << uint8(0); // unk
*data << uint8(0); // unk
*data << uint32(loser_honor); // Loser Honor Reward or Random Loser Honor Reward
*data << uint32(winner_honor); // Winner Honor Reward or Random Winner Honor Reward
*data << uint32(winner_honor); // Winner Honor Reward or Random Winner Honor Reward
*data << uint8(0); // max level
*data << uint8(0); // min level
// Rewards
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
*data << uint32(winner_kills); // 3.3.3 winHonor
*data << uint32(winner_arena); // 3.3.3 winArena
*data << uint32(loser_kills); // 3.3.3 lossHonor
data->WriteBit(guidBytes[0]);
data->WriteBit(guidBytes[1]);
data->WriteBit(guidBytes[7]);
data->WriteBit(0); // unk
data->WriteBit(0); // unk
size_t count_pos = data->wpos();
data->WriteBit(0); // bg instance count
uint8 isRandom = bgTypeId == BATTLEGROUND_RB;
data->WriteBit(guidBytes[6]);
data->WriteBit(guidBytes[4]);
data->WriteBit(guidBytes[2]);
data->WriteBit(guidBytes[3]);
data->WriteBit(0); // unk
data->WriteBit(guidBytes[5]);
data->WriteBit(0); // unk
*data << uint8(isRandom); // 3.3.3 isRandom
if (isRandom)
data->FlushBits();
data->WriteByteSeq(guidBytes[6]);
data->WriteByteSeq(guidBytes[1]);
data->WriteByteSeq(guidBytes[7]);
data->WriteByteSeq(guidBytes[5]);
if (Battleground* bgTemplate = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId))
{
// Rewards (random)
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
*data << uint32(winner_kills); // 3.3.3 winHonor_Random
*data << uint32(winner_arena); // 3.3.3 winArena_Random
*data << uint32(loser_kills); // 3.3.3 lossHonor_Random
}
if (bgTypeId == BATTLEGROUND_AA) // arena
{
*data << uint32(0); // unk (count?)
}
else // battleground
{
size_t count_pos = data->wpos();
*data << uint32(0); // number of bg instances
if (Battleground* bgTemplate = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId))
// expected bracket entry
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), player->getLevel()))
{
// expected bracket entry
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), player->getLevel()))
uint32 count = 0;
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracketId].end();++itr)
{
uint32 count = 0;
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracketId].end();++itr)
{
*data << uint32(*itr);
++count;
}
data->put<uint32>(count_pos, count);
*data << uint32(*itr); // instance id
++count;
}
data->put<uint32>(count_pos, count);
}
}
data->WriteByteSeq(guidBytes[0]);
data->WriteByteSeq(guidBytes[2]);
data->WriteByteSeq(guidBytes[4]);
data->WriteByteSeq(guidBytes[3]);
}
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)

View File

@@ -66,14 +66,14 @@ class BattlegroundMgr
void Update(uint32 diff);
/* Packet Building */
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player);
void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, uint64 guid);
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId);
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Battleground* bg, Player* player, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1);
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, Player* player, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, uint8 uiFrame = 1);
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundId);
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
/* Battlegrounds */

View File

@@ -391,7 +391,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
plr2->RemoveBattlegroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to
// queue->removeplayer, it causes bugs
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, plr2, queueSlot, STATUS_NONE, 0, 0, 0);
plr2->GetSession()->SendPacket(&data);
}
// then actually delete, this may delete the group as well!
@@ -470,7 +470,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg,
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
// send status packet
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, player, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
player->GetSession()->SendPacket(&data);
}
return true;
@@ -1022,7 +1022,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
WorldPacket data;
//we must send remaining time in queue
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, player, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType);
player->GetSession()->SendPacket(&data);
}
}
@@ -1070,7 +1070,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
sBattlegroundMgr->ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, player, queueSlot, STATUS_NONE, 0, 0, 0);
player->GetSession()->SendPacket(&data);
}
}

View File

@@ -43,6 +43,7 @@ enum HighGuid
HIGHGUID_VEHICLE = 0xF15, // blizz F550
HIGHGUID_DYNAMICOBJECT = 0xF10, // blizz F100
HIGHGUID_CORPSE = 0xF101, // blizz F100
HIGHGUID_TYPE_BATTLEGROUND = 0x1F1, // new 4.x
HIGHGUID_MO_TRANSPORT = 0x1FC, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
HIGHGUID_GROUP = 0x1F5,
HIGHGUID_GUILD = 0x1FF5, // new 4.x

View File

@@ -72,17 +72,35 @@ void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId
void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
{
uint64 guid;
uint32 bgTypeId_;
uint32 instanceId;
uint8 joinAsGroup;
uint8 asGroup;
bool isPremade = false;
Group* grp = NULL;
ObjectGuid guid;
recvData >> guid; // battlemaster guid
recvData >> bgTypeId_; // battleground type id (DBC id)
recvData >> instanceId; // instance id, 0 if First Available selected
recvData >> joinAsGroup; // join as group
recvData >> instanceId; // Instance Id
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
asGroup = recvData.ReadBit(); // As Group
guid[4] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[1]);
//extract from guid
bgTypeId_ = GUID_LOPART(guid);
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
@@ -95,10 +113,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
ChatHandler(this).PSendSysMessage(LANG_BG_DISABLED);
return;
}
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID:"UI64FMTD" TypeId:%u)", guid, bgTypeId_);
// can do this, since it's battleground, not arena
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0);
@@ -126,13 +143,13 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
GroupJoinBattlegroundResult err;
// check queue conditions
if (!joinAsGroup)
if (!asGroup)
{
if (GetPlayer()->isUsingLfg())
{
// player is using dungeon finder or raid finder
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_LFG_CANT_USE_BATTLEGROUND);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_LFG_CANT_USE_BATTLEGROUND);
GetPlayer()->GetSession()->SendPacket(&data);
return;
}
@@ -141,7 +158,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
if (!_player->CanJoinToBattleground())
{
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
_player->GetSession()->SendPacket(&data);
return;
}
@@ -150,7 +167,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
{
//player is already in random queue
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_RANDOM_BG);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_IN_RANDOM_BG);
_player->GetSession()->SendPacket(&data);
return;
}
@@ -159,7 +176,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
{
//player is already in queue, can't start random queue
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_NON_RANDOM_BG);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_IN_NON_RANDOM_BG);
_player->GetSession()->SendPacket(&data);
return;
}
@@ -173,7 +190,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
if (!_player->HasFreeBattlegroundQueueId())
{
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_TOO_MANY_QUEUES);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, ERR_BATTLEGROUND_TOO_MANY_QUEUES);
_player->GetSession()->SendPacket(&data);
return;
}
@@ -187,7 +204,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
WorldPacket data;
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
SendPacket(&data);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName());
}
@@ -223,7 +240,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
if (err <= 0)
{
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err);
member->GetSession()->SendPacket(&data);
continue;
}
@@ -232,9 +249,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
uint32 queueSlot = member->AddBattlegroundQueueId(bgQueueTypeId);
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, member, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
member->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err);
member->GetSession()->SendPacket(&data);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName());
}
@@ -246,13 +263,14 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEGROUND_PLAYER_POSITIONS Message");
Battleground* bg = _player->GetBattleground();
if (!bg) // can't be received if player not in battleground
return;
uint32 count = 0;
uint32 acount = 0;
uint32 hcount = 0;
Player* aplr = NULL;
Player* hplr = NULL;
@@ -260,31 +278,75 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recvD
{
aplr = ObjectAccessor::FindPlayer(guid);
if (aplr)
++count;
++acount;
}
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE))
{
hplr = ObjectAccessor::FindPlayer(guid);
if (hplr)
++count;
++hcount;
}
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count);
data << 0;
data << count;
if (aplr)
ObjectGuid aguid = aplr ? aplr->GetGUID() : 0;
ObjectGuid hguid = hplr ? hplr->GetGUID() : 0;
WorldPacket data(SMSG_BATTLEFIELD_PLAYER_POSITIONS);
data.WriteBits(acount, 22);
for (uint8 i = 0; i < acount; i++)
{
data << uint64(aplr->GetGUID());
data << float(aplr->GetPositionX());
data << float(aplr->GetPositionY());
data.WriteBit(aguid[3]);
data.WriteBit(aguid[5]);
data.WriteBit(aguid[1]);
data.WriteBit(aguid[6]);
data.WriteBit(aguid[7]);
data.WriteBit(aguid[0]);
data.WriteBit(aguid[2]);
data.WriteBit(aguid[4]);
}
if (hplr)
data.WriteBits(hcount, 22);
for (uint8 i = 0; i < hcount; i++)
{
data << uint64(hplr->GetGUID());
data << float(hplr->GetPositionX());
data.WriteBit(hguid[6]);
data.WriteBit(hguid[5]);
data.WriteBit(hguid[4]);
data.WriteBit(hguid[7]);
data.WriteBit(hguid[2]);
data.WriteBit(hguid[1]);
data.WriteBit(hguid[0]);
data.WriteBit(hguid[3]);
}
data.FlushBits();
for (uint8 i = 0; i < hcount; i++)
{
data.WriteByteSeq(hguid[2]);
data.WriteByteSeq(hguid[1]);
data << float(hplr->GetPositionY());
data.WriteByteSeq(hguid[5]);
data.WriteByteSeq(hguid[4]);
data.WriteByteSeq(hguid[7]);
data.WriteByteSeq(hguid[0]);
data.WriteByteSeq(hguid[6]);
data.WriteByteSeq(hguid[3]);
data << float(hplr->GetPositionX());
}
for (uint8 i = 0; i < acount; i++)
{
data.WriteByteSeq(aguid[6]);
data << float(aplr->GetPositionX());
data.WriteByteSeq(aguid[5]);
data.WriteByteSeq(aguid[3]);
data << float(aplr->GetPositionY());
data.WriteByteSeq(aguid[1]);
data.WriteByteSeq(aguid[7]);
data.WriteByteSeq(aguid[0]);
data.WriteByteSeq(aguid[2]);
data.WriteByteSeq(aguid[4]);
}
SendPacket(&data);
@@ -394,7 +456,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
{
//send bg command result to show nice message
WorldPacket data2;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data2, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data2, bg, _player, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
_player->GetSession()->SendPacket(&data2);
action = 0;
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
@@ -431,7 +493,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
_player->CleanupAfterTaxiFlight();
}
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType());
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType());
_player->GetSession()->SendPacket(&data);
// remove battleground queue status from BGmgr
bgQueue.RemovePlayer(_player->GetGUID(), false);
@@ -463,7 +525,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
}
}
_player->RemoveBattlegroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player, queueSlot, STATUS_NONE, 0, 0, 0);
bgQueue.RemovePlayer(_player->GetGUID(), true);
// player left queue, we should update it - do not update Arena Queue
if (!ginfo.ArenaType)
@@ -519,7 +581,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
{
// this line is checked, i only don't know if GetStartTime is changing itself after bg end!
// send status in Battleground
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, i, STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), arenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), i, STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), arenaType);
SendPacket(&data);
continue;
}
@@ -537,7 +599,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
continue;
uint32 remainingTime = getMSTimeDiff(getMSTime(), ginfo.RemoveInviteTime);
// send status invited to Battleground
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType);
SendPacket(&data);
}
else
@@ -553,7 +615,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(&ginfo, bracketEntry->GetBracketId());
// send status in Battleground Queue
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(ginfo.JoinTime, getMSTime()), arenaType);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(ginfo.JoinTime, getMSTime()), arenaType);
SendPacket(&data);
}
}
@@ -696,7 +758,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
if (err <= 0)
{
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err);
member->GetSession()->SendPacket(&data);
continue;
}
@@ -705,9 +767,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
uint32 queueSlot = member->AddBattlegroundQueueId(bgQueueTypeId);
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, member, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
member->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, bg, _player, err);
member->GetSession()->SendPacket(&data);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName());
}
@@ -720,7 +782,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
WorldPacket data;
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, GetPlayer(), queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
SendPacket(&data);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName());
}

View File

@@ -101,14 +101,14 @@ void InitOpcodes()
DEFINE_OPCODE_HANDLER(CMSG_BANKER_ACTIVATE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBankerActivateOpcode );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_LEAVE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_LIST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlefieldListOpcode );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_EXIT_REQUEST, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfEntryInviteResponse );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_EXIT_REQUEST, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfExitRequest );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfQueueInviteResponse );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_PORT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleBattleFieldPortOpcode );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_PORT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattleFieldPortOpcode );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_STATUS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlefieldStatusOpcode );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEGROUND_PLAYER_POSITIONS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEMASTER_JOIN, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlemasterJoinOpcode );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEGROUND_PLAYER_POSITIONS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBattlegroundPlayerPositionsOpcode);
DEFINE_OPCODE_HANDLER(CMSG_BATTLEMASTER_JOIN, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlemasterJoinOpcode );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEMASTER_JOIN_ARENA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlemasterJoinArena );
DEFINE_OPCODE_HANDLER(CMSG_BATTLEMASTER_JOIN_RATED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_BEGIN_TRADE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBeginTradeOpcode );
@@ -664,26 +664,27 @@ void InitOpcodes()
DEFINE_OPCODE_HANDLER(SMSG_AVAILABLE_VOICE_CHANNEL, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_AVERAGE_ITEM_LEVEL_INFORM, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BARBER_SHOP_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_LIST, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_EJECTED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_LIST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_EJECTED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_EJECT_PENDING, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_ENTERED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_ENTERED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_EXIT_REQUEST, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_STATE_CHANGE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_PLAYER_POSITIONS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_PLAYER_POSITIONS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_PORT_DENIED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_RATED_INFO, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS2, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS3, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS4, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_FAILED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_QUEUED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_ACTIVE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_NEEDCONFIRMATION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_WAITFORGROUPS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_FAILED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEGROUND_INFO_THROTTLED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEGROUND_PLAYER_JOINED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEGROUND_PLAYER_LEFT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEGROUND_PLAYER_JOINED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BATTLEGROUND_PLAYER_LEFT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BINDER_CONFIRM, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BINDPOINTUPDATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_BREAK_TARGET, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
@@ -840,8 +841,7 @@ void InitOpcodes()
DEFINE_OPCODE_HANDLER(SMSG_GROUP_DECLINE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_DESTROYED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_INVITE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_JOINED_BATTLEGROUND, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_LIST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_LIST, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_SET_LEADER, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_SET_ROLE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_GROUP_UNINVITE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
@@ -1550,7 +1550,6 @@ void InitOpcodes()
//DEFINE_OPCODE_HANDLER(CMSG_WEATHER_SPEED_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
//DEFINE_OPCODE_HANDLER(CMSG_XP_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
//DEFINE_OPCODE_HANDLER(CMSG_ZONE_MAP, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
//DEFINE_OPCODE_HANDLER(MSG_BATTLEGROUND_PLAYER_POSITIONS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlegroundPlayerPositionsOpcode);
//DEFINE_OPCODE_HANDLER(MSG_DELAY_GHOST_TELEPORT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
//DEFINE_OPCODE_HANDLER(MSG_DEV_SHOWLABEL, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
//DEFINE_OPCODE_HANDLER(MSG_GM_ACCOUNT_ONLINE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
@@ -1592,8 +1591,6 @@ void InitOpcodes()
//DEFINE_OPCODE_HANDLER(MSG_VIEW_PHASE_SHIFT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
//DEFINE_OPCODE_HANDLER(SMSG_AFK_MONITOR_INFO_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(SMSG_AURACASTLOG, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS1, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(SMSG_BATTLEGROUND_PLAYER_POSITIONS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(SMSG_BINDZONEREPLY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(SMSG_BUY_BANK_SLOT_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(SMSG_CALENDAR_ACTION_PENDING, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );

View File

@@ -588,7 +588,6 @@ enum Opcodes
CMSG_WRAP_ITEM = 0x4F06,
CMSG_ZONEUPDATE = 0x4F37,
MSG_AUCTION_HELLO = 0x2307,
MSG_BATTLEGROUND_PLAYER_POSITIONS = 0x0000,
MSG_CHANNEL_START = 0x0A15, // SMSG only?
MSG_CHANNEL_UPDATE = 0x2417, // SMSG only?
MSG_CORPSE_QUERY = 0x4336,
@@ -729,15 +728,14 @@ enum Opcodes
SMSG_BATTLEFIELD_PORT_DENIED = 0x35A3,
SMSG_BATTLEFIELD_RATED_INFO = 0x54A3,
SMSG_BATTLEFIELD_STATUS = 0x7DA1,
SMSG_BATTLEFIELD_STATUS1 = 0x0000,
SMSG_BATTLEFIELD_STATUS2 = 0x74A4,
SMSG_BATTLEFIELD_STATUS3 = 0x59A0,
SMSG_BATTLEFIELD_STATUS4 = 0x75A2,
SMSG_BATTLEFIELD_STATUS_QUEUED = 0x35A1,
SMSG_BATTLEFIELD_STATUS_ACTIVE = 0x74A4,
SMSG_BATTLEFIELD_STATUS_NEEDCONFIRMATION = 0x59A0,
SMSG_BATTLEFIELD_STATUS_WAITFORGROUPS = 0x75A2,
SMSG_BATTLEFIELD_STATUS_FAILED = 0x71A7,
SMSG_BATTLEGROUND_INFO_THROTTLED = 0x34B2,
SMSG_BATTLEGROUND_PLAYER_JOINED = 0x50B0,
SMSG_BATTLEGROUND_PLAYER_LEFT = 0x59A6,
SMSG_BATTLEGROUND_PLAYER_POSITIONS = 0x0000,
SMSG_BINDER_CONFIRM = 0x2835,
SMSG_BINDPOINTUPDATE = 0x0527,
SMSG_BINDZONEREPLY = 0x0000,
@@ -908,7 +906,6 @@ enum Opcodes
SMSG_GROUP_DECLINE = 0x6835,
SMSG_GROUP_DESTROYED = 0x2207,
SMSG_GROUP_INVITE = 0x31B2,
SMSG_GROUP_JOINED_BATTLEGROUND = 0x35A1,
SMSG_GROUP_LIST = 0x4C24,
SMSG_GROUP_SET_LEADER = 0x0526,
SMSG_GROUP_SET_ROLE = 0x39A6,

View File

@@ -809,14 +809,14 @@ class WorldSession
void HandleInstanceLockResponse(WorldPacket& recvPacket);
// Battlefield
void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
void SendBfInvitePlayerToQueue(uint32 BattleId);
void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
void SendBfEntered(uint32 BattleId);
void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
void HandleBfQueueInviteResponse(WorldPacket &recv_data);
void HandleBfEntryInviteResponse(WorldPacket &recv_data);
void HandleBfExitRequest(WorldPacket &recv_data);
void SendBfInvitePlayerToWar(uint64 guid, uint32 zoneId, uint32 pTime);
void SendBfInvitePlayerToQueue(uint64 guid);
void SendBfQueueInviteResponse(uint64 guid, uint32 zoneId, bool canQueue = true, bool full = false);
void SendBfEntered(uint64 guid);
void SendBfLeaveMessage(uint64 guid, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
void HandleBfQueueInviteResponse(WorldPacket& recvData);
void HandleBfEntryInviteResponse(WorldPacket& recvData);
void HandleBfExitRequest(WorldPacket& recvData);
// Looking for Dungeon/Raid
void HandleLfgSetCommentOpcode(WorldPacket& recvData);