private void LeavePlayer_QuitBattle(Room room, Account p) { using (PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK packet = new PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK(p, 0)) { room.SendPacketToPlayers(packet, SlotStateEnum.READY, 1); } }
private void LeaveHostNoBOT_GiveBattle(Room room, Account p) { List <Account> players = room.GetAllPlayers(SlotStateEnum.READY, 1); if (players.Count == 0) { return; } int oldLeader = room.leaderSlot; room.SetNewLeader(-1, room.state == RoomStateEnum.Battle ? 12 : 8, room.leaderSlot, true); using (PROTOCOL_BATTLE_GIVEUPBATTLE_ACK packet = new PROTOCOL_BATTLE_GIVEUPBATTLE_ACK(room, oldLeader)) using (PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK packet2 = new PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK(p, 0)) { byte[] data = packet.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REQ-6"); byte[] data2 = packet2.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REQ-7"); for (int i = 0; i < players.Count; i++) { Account pR = players[i]; if (room.slots[pR.slotId].state >= SlotStateEnum.PRESTART) { pR.SendCompletePacket(data); } pR.SendCompletePacket(data2); } } }
private void LeavePlayerNoBOT_EndBattle(Room room, Account p, int red13, int blue13) { isFinished = true; TeamResultTypeEnum winnerTeam = room.GetWinnerTeam(red13, blue13); List <Account> players = room.GetAllPlayers(SlotStateEnum.READY, 1); if (players.Count > 0) { if (room.state == RoomStateEnum.Battle) { room.CalculateResult(winnerTeam, false); } using (PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK packet = new PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK(p, 0)) { byte[] data = packet.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REQ-8"); room.GetBattleResult(out ushort missionCompletes, out ushort inBattle, out byte[] a1); for (int i = 0; i < players.Count; i++) { Account pR = players[i]; pR.SendCompletePacket(data); pR.SendPacket(new PROTOCOL_BATTLE_ENDBATTLE_ACK(pR, winnerTeam, inBattle, missionCompletes, false, a1)); } } } room.ResetBattleInfo(); }
private void LeaveHostBOT_EndBattle(Room room, Account p) { List <Account> players = room.GetAllPlayers(SlotStateEnum.READY, 1); if (players.Count > 0) { using (PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK packet = new PROTOCOL_BATTLE_LEAVEP2PSERVER_ACK(p, 0)) { byte[] data = packet.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REQ-3"); TeamResultTypeEnum winnerTeam = room.GetWinnerTeam(); room.GetBattleResult(out ushort missionCompletes, out ushort inBattle, out byte[] a1); for (int i = 0; i < players.Count; i++) { Account pR = players[i]; pR.SendCompletePacket(data); pR.SendPacket(new PROTOCOL_BATTLE_ENDBATTLE_ACK(pR, winnerTeam, inBattle, missionCompletes, true, a1)); } } } room.ResetBattleInfo(); }