private void LeavePlayerNoBOT_EndBattle(Room room,Account p,int red13,int blue13)
        {
            this.isFinished = true;
            TeamResultType winnerTeam = AllUtils.GetWinnerTeam(room,red13,blue13);
            List <Account> allPlayers = room.getAllPlayers(SLOT_STATE.READY,1);

            if (allPlayers.Count != 0)
            {
                if (room._state == RoomState.Battle)
                {
                    room.CalculateResult(winnerTeam,false);
                }
                using (BATTLE_LEAVEP2PSERVER_PAK leaveP2PserverPak = new BATTLE_LEAVEP2PSERVER_PAK(p,0))
                {
                    byte[] completeBytes = leaveP2PserverPak.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REC-8");
                    ushort result1;
                    ushort result2;
                    byte[] data;
                    AllUtils.getBattleResult(room,out result1,out result2,out data);
                    foreach (Account p1 in allPlayers)
                    {
                        p1.SendCompletePacket(completeBytes);
                        p1.SendPacket((SendPacket) new BATTLE_ENDBATTLE_PAK(p1,winnerTeam,result2,result1,false,data));
                    }
                }
            }
            AllUtils.resetBattleInfo(room);
        }
        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 LeavePlayerNoBOT_EndBattle(Room room,Account p,int red13,int blue13)
        {
            isFinished = true;
            TeamResultType winnerTeam = AllUtils.GetWinnerTeam(room,red13,blue13);
            List <Account> players    = room.getAllPlayers(SLOT_STATE.READY,1);

            if (players.Count == 0)
            {
                goto EndLabel;
            }
            if (room._state == RoomState.Battle)
            {
                room.CalculateResult(winnerTeam,false);
            }
            using (BATTLE_LEAVEP2PSERVER_PAK packet = new BATTLE_LEAVEP2PSERVER_PAK(p,0))
            {
                byte[] data = packet.GetCompleteBytes();
                ushort inBattle,missionCompletes;
                byte[] a1;
                AllUtils.getBattleResult(room,out missionCompletes,out inBattle,out a1);
                foreach (Account pR in players)
                {
                    pR.SendCompletePacket(data);
                    pR.SendPacket(new BATTLE_ENDBATTLE_PAK(pR,winnerTeam,inBattle,missionCompletes,false,a1));
                }
            }
EndLabel:
            AllUtils.resetBattleInfo(room);
        }
        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);
                    }
                }
        }
        private void LeaveHostBOT_EndBattle(Room room,Account p)
        {
            List <Account> allPlayers = room.getAllPlayers(SLOT_STATE.READY,1);

            if (allPlayers.Count != 0)
            {
                using (BATTLE_LEAVEP2PSERVER_PAK leaveP2PserverPak = new BATTLE_LEAVEP2PSERVER_PAK(p,0))
                {
                    byte[]         completeBytes = leaveP2PserverPak.GetCompleteBytes("BATTLE_PLAYER_LEAVE_REC-3");
                    TeamResultType winnerTeam    = AllUtils.GetWinnerTeam(room);
                    ushort         result1;
                    ushort         result2;
                    byte[]         data;
                    AllUtils.getBattleResult(room,out result1,out result2,out data);
                    foreach (Account p1 in allPlayers)
                    {
                        p1.SendCompletePacket(completeBytes);
                        p1.SendPacket((SendPacket) new BATTLE_ENDBATTLE_PAK(p1,winnerTeam,result2,result1,true,data));
                    }
                }
            }
            AllUtils.resetBattleInfo(room);
        }
        private void LeaveHostBOT_EndBattle(Room room,Account p)
        {
            List <Account> players = room.getAllPlayers(SLOT_STATE.READY,1);

            if (players.Count == 0)
            {
                goto EndLabel;
            }
            using (BATTLE_LEAVEP2PSERVER_PAK packet = new BATTLE_LEAVEP2PSERVER_PAK(p,0))
            {
                byte[]         data = packet.GetCompleteBytes();
                TeamResultType winnerTeam = AllUtils.GetWinnerTeam(room);
                ushort         inBattle,missionCompletes;
                byte[]         a1;
                AllUtils.getBattleResult(room,out missionCompletes,out inBattle,out a1);
                foreach (Account pR in players)
                {
                    pR.SendCompletePacket(data);
                    pR.SendPacket(new BATTLE_ENDBATTLE_PAK(pR,winnerTeam,inBattle,missionCompletes,true,a1));
                }
            }
EndLabel:
            AllUtils.resetBattleInfo(room);
        }