private void LeaveHostNoBOT_GiveBattle(Room room,Account p) { List <Account> allPlayers = room.getAllPlayers(SLOT_STATE.READY,1); if (allPlayers.Count == 0) { return; } int leader = room._leader; int state = room._state == RoomState.Battle ? 12 : 8; room.setNewLeader(-1,state,room._leader,true); using (BATTLE_GIVEUPBATTLE_PAK battleGiveupbattlePak = new BATTLE_GIVEUPBATTLE_PAK(room,leader)) { using (BATTLE_LEAVEP2PSERVER_PAK leaveP2PserverPak = new BATTLE_LEAVEP2PSERVER_PAK(p,0)) { byte[] completeBytes1 = battleGiveupbattlePak.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REC-6"); byte[] completeBytes2 = leaveP2PserverPak.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REC-7"); foreach (Account account in allPlayers) { if (room._slots[account._slotId].state >= SLOT_STATE.PRESTART) { account.SendCompletePacket(completeBytes1); } account.SendCompletePacket(completeBytes2); } } } }
private void LeaveHostNoBOT_GiveBattle(Room room,Account p) { List <Account> players = room.getAllPlayers(SLOT_STATE.READY,1); if (players.Count == 0) { return; } int oldLeader = room._leader; int state = (room._state == RoomState.Battle ? 12 : 8); room.setNewLeader(-1,state,room._leader,true); using (BATTLE_GIVEUPBATTLE_PAK packet = new BATTLE_GIVEUPBATTLE_PAK(room,oldLeader)) using (BATTLE_LEAVEP2PSERVER_PAK packet2 = new BATTLE_LEAVEP2PSERVER_PAK(p,0)) { byte[] data = packet.GetCompleteBytes(); byte[] data2 = packet2.GetCompleteBytes(); foreach (Account pR in players) { if (room._slots[pR._slotId].state >= SLOT_STATE.PRESTART) { pR.SendCompletePacket(data); } pR.SendCompletePacket(data2); } } }