void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); recv_data.read_skip<uint8>(); // unk1 recv_data.read_skip<uint8>(); // unk2 recv_data.read_skip<uint32>(); // BattleGroundTypeId recv_data.read_skip<uint16>(); // unk3 // if(bgTypeId >= MAX_BATTLEGROUND_TYPES) // cheating? but not important in this case // return; // not allow leave battleground in combat if (_player->isInCombat()) if (BattleGround* bg = _player->GetBattleGround()) if (bg->GetStatus() != STATUS_WAIT_LEAVE) return; // check if arena is in progress when player leave and make player lose rating if is in progres if(BattleGround* bg = _player->GetBattleGround()) { if(bg->isArena() && bg->isRated() && bg->GetStatus() != STATUS_WAIT_LEAVE) { ArenaTeam *team = sObjectMgr.GetArenaTeamById(bg->GetArenaTeamIdForTeam(bg->GetOtherTeam(_player->GetTeam()))); if(team) { uint32 other_team_rating = team->GetBattleRating(); team->MemberLost(_player, other_team_rating); } } } _player->LeaveBattleground(); }