Core/Opcodes: Implement CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST

By ArcCORE.
This commit is contained in:
Aokromes
2017-01-21 18:08:52 +01:00
parent f1d7b4e2de
commit 3736cc5963
3 changed files with 46 additions and 1 deletions

View File

@@ -352,3 +352,47 @@ void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
bf->AskToLeaveQueue(_player);
}
/**
* @fn void WorldSession::HandleBfQueueRequest(WorldPacket & recvData)
*
* @brief Send by client when queued battlefield
*/
void WorldSession::HandleBfQueueRequest(WorldPacket & recvData)
{
ObjectGuid guid;
guid[0] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[0]);
Battlefield *pBf = sBattlefieldMgr->GetBattlefieldByGUID(guid);
if(pBf)
{
BattlefieldQueue *pQueue = sBattlefieldMgr->GetQueueForBattlefield(guid);
if(pQueue)
{
bool canJoin = true;
//check if player is queued in BG/LFG, if so - set canJoin to false
if(pQueue->HasEnoughSpace(GetPlayer()) && canJoin)
pQueue->AddPlayerToQueue(GetPlayer());
SendBfQueueInviteResponse(guid,pQueue->GetId(),pBf->GetZoneId(),canJoin,!pQueue->HasEnoughSpace(GetPlayer()),pBf->IsWarTime());
}
}
}

View File

@@ -102,7 +102,7 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &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_MGR_QUEUE_REQUEST, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfQueueRequest );
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_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBattlegroundPlayerPositionsOpcode);

View File

@@ -848,6 +848,7 @@ class TC_GAME_API WorldSession
//Battleground
void HandleBattlemasterHelloOpcode(WorldPacket& recvData);
void HandleBfQueueRequest(WorldPacket & recvData);
void HandleBattlemasterJoinOpcode(WorldPacket& recvData);
void HandleBattlegroundPlayerPositionsOpcode(WorldPacket& recvData);
void HandlePVPLogDataOpcode(WorldPacket& recvData);