void WorldSession::HandleBattlefieldPortOpcode(WorldPacket &recv_data) { if(!_player->IsInWorld()) return; CHECK_PACKET_SIZE(recv_data, 5); sLog.outString("BATTLEGROUND: Recieved CMSG_BATTLEFIELD_PORT packet."); uint16 mapinfo; uint8 action; uint16 unk; uint32 Battlegroundtype; recv_data >> unk >> Battlegroundtype >> mapinfo >> action; if(action == 0) { // Leave queue } else { // if we are already in a BG Battleground *lastbg = sBattlegroundMgr.GetBattleground(GetPlayer()->m_bgLastBattlegroundID); if(lastbg) lastbg->RemovePlayer(GetPlayer(), false, false, false); // Enter battleground! Battleground *bg = sBattlegroundMgr.GetBattleground(GetPlayer()->m_bgBattlegroundID); if(!bg) sLog.outError("BATTLEGROUND: Warning! Could not find battleground instance %d", GetPlayer()->m_bgBattlegroundID); else bg->AddPlayer(GetPlayer(), true, true); } }
void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket &recv_data) { sLog.outString("Recieved CMSG_LEAVEBATTLEFIELD"); Battleground *bg = GetPlayer()->GetCurrentBattleground(); if(!bg) return; bg->RemovePlayer(GetPlayer(),true,true,!bg->m_GameStatus); }