Exemple #1
0
        private void SendText(Session p, int ID, String Text, string Nick = null)
        {
            PacketWrite pw = new PacketWrite();

            pw.Byte(1);
            pw.Int(p.PInfo.m_dwUserUID);
            pw.UnicodeStr(p.PInfo.m_strNickName);
            pw.Int(0);
            pw.Int(0);
            pw.Int(-1);
            pw.UnicodeStr(Text);
            pw.Int(0);
            pw.Int(0);

            if (ID == 0)
            {
                for (int i = 0; i < GameServer.UsersList.Count; i++)
                {
                    if (GameServer.UsersList[i].PInfo.m_dwChannelUID != p.PInfo.m_dwChannelUID)
                    {
                        continue;
                    }
                    GameServer.UsersList[i].SendPacket(pw, 38);
                }
            }

            if (ID == 1)
            {
                p.PInfo.CurRoom.SendForAllPlayersInRoom(pw, 39);
            }
        }
Exemple #2
0
        public void Loading(Session p, Read_Buffer r)
        {
            PacketWrite WB = new PacketWrite();

            WB.HexArray("00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 01 00 00 00");
            WB.HexArray("02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 00");

            WB.Int(TtLoad.Length);
            WB.UnicodeStr(TtLoad[0]);
            WB.UnicodeStr(TtLoad[1]);
            WB.UnicodeStr(TtLoad[2]);
            WB.UnicodeStr(TtLoad[3]);
            WB.HexArray("00 00 00 02 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00");

            WB.Int(Match.Length);
            WB.UnicodeStr(Match[0]);
            WB.UnicodeStr(Match[1]);
            WB.UnicodeStr(Match[2]);
            WB.Int(0);

            WB.Int(Square.Length);
            WB.Int(0);
            WB.UnicodeStr(Square[0]);
            WB.Int(1);
            WB.UnicodeStr(Square[1]);
            WB.Int(2);
            WB.UnicodeStr(Square[2]);
            WB.HexArray("00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00");
            WB.Int(0);
            p.SESSION_SEND(WB.Get_Packet(), 22);
            WaitTime(p, r);
        }
Exemple #3
0
        public void Loading(Session p, PacketRead r)
        {
            PacketWrite WB = new PacketWrite();

            WB.HexArray("00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 01 00 00 00");
            WB.HexArray("02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 00");

            WB.Int(TtLoad.Length);
            WB.UnicodeStr(TtLoad[0]);
            WB.UnicodeStr(TtLoad[1]);
            WB.UnicodeStr(TtLoad[2]);
            WB.UnicodeStr(TtLoad[3]);
            WB.HexArray("00 00 00 02 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00");

            WB.Int(Match.Length);
            WB.UnicodeStr(Match[0]);
            WB.UnicodeStr(Match[1]);
            WB.UnicodeStr(Match[2]);
            WB.Int(0);

            WB.Int(Square.Length);
            WB.Int(0);
            WB.UnicodeStr(Square[0]);
            WB.Int(1);
            WB.UnicodeStr(Square[1]);
            WB.Int(2);
            WB.UnicodeStr(Square[2]);
            WB.HexArray("00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00");
            WB.Int(0);
            p.SendPacket(WB, 22);
            WaitTime(p, r);
        }
 public static void KUserInfo(Session right, PacketWrite ks)
 {
     //#c22CBAA
     //#c769EFF
     ks.UnicodeStr(right.PInfo.m_strLogin);
     ks.Int(right.PInfo.m_dwUserUID);
     ks.UnicodeStr(right.PInfo.m_strNickName);
     ks.Int(0);
     ks.Byte(right.PInfo.m_ucCharType);
     ks.HexArray("00 00 00 00 00 FF 00 FF 00 FF 00 00 00 00 00 00 00 00 00 64 00 00");
     ks.Int(right.PInfo.m_iGamePoint);
     ks.Short(0);
 }
Exemple #5
0
        public void RoomMyInfoDivide(Session p, PacketRead r)
        {
            r.Jump(6);
            ushort roomid    = (ushort)r.Get_Short();
            Room   room      = RoomExists(roomid);
            int    TempCount = -1;

            for (int i = 0; i < room.m_usMaxUsers; i++)
            {
                if (room.m_dwSlots[i].Active == false)
                {
                    continue;
                }
                TempCount++;
                if (room.m_dwSlots[i].usr == p)
                {
                    PacketWrite pw = new PacketWrite();
                    pw.Int(0);
                    pw.Int(room.m_usUsers());
                    pw.Int(TempCount);
                    pw.UnicodeStr(room.m_dwSlots[i].usr.PInfo.m_strLogin);
                    pw.Int(room.m_dwSlots[i].usr.PInfo.m_dwUserUID);
                    pw.UnicodeStr(room.m_dwSlots[i].usr.PInfo.m_strNickName);
                    pw.Int(i);
                    pw.Byte(room.m_dwSlots[i].usr.PInfo.m_ucCharType);
                    pw.Int(0);
                    pw.HexArray("00 FF 00 FF 00 FF 00 00 00 00");
                    pw.Byte((byte)room.GetTeam(room.m_dwSlots[i].usr));
                    pw.HexArray("00 00 00 00 64 00 00");
                    pw.Int(room.m_dwSlots[i].usr.PInfo.m_iGamePoint);
                    pw.Short(0);
                    Serializables.SerializeStages(room.m_dwSlots[i].usr, pw);
                    if (room.m_sSearchLeader() == room.m_dwSlots[i].usr)
                    {
                        pw.Bool(true);
                    }
                    else
                    {
                        pw.Bool(false);
                    }
                    pw.HexArray("01 00 00 00 00 00 00 00 00 00 00 00 00");
                    Serializables.m_roomCharacterInfo(room.m_dwSlots[i].usr, pw);
                    pw.HexArray("00 00 00 02 76 19 A8 C0 10 0C D6 BA 00 00 00 01 7F 39 00 00 00 00 00 00 00 00 00 00 00");
                    pw.Byte(room.m_dwSlots[i].Status);
                    pw.HexArray("00 00 00 00 00 12 C8 F2 00 00 00 00 00 D6 D9 BE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 42 00 52 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 00 06 11 16 00 00 00 00 00 00 00 00 46 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 D8 00 00 01 A0 04 7B 00 00 00 00 00 00 00 00");

                    p.SendPacket(pw, 1472);
                    break;
                }
            }
        }
Exemple #6
0
        private void RoomInfo(Session p, Room room)
        {
            PacketWrite pw = new PacketWrite();

            pw.UShort(room.m_usRoomID);
            pw.UnicodeStr(room.m_strRoomName);
            pw.Byte(1);
            if (room.m_strRoomPasswd.Length > 0)
            {
                pw.Bool(true);
            }
            else
            {
                pw.Bool(false);
            }

            pw.UnicodeStr(room.m_strRoomPasswd);
            pw.Short(room.m_usUsers());
            pw.Short(room.m_usMaxUsers);
            pw.Bool(room.m_bPlaying);
            pw.Byte(11);
            pw.Byte(room.m_cGameCategory);
            pw.Int(room.m_iGameMode);
            pw.Int(room.m_iSubGameMode);
            pw.Bool(room.m_bRandomableMap);
            pw.Int(room.m_iMapID);
            pw.Int(room.m_iP2PVersion);
            for (short j = 0; j < room.m_usMaxUsers; j++)
            {
                pw.Bool(room.m_dwSlots[j].Open);
            }

            if (room.m_usMaxUsers == 4)
            {
                pw.Bool(false);
                pw.Bool(false);
            }
            pw.Int(-1);
            pw.Int(room.m_cDifficulty);
            pw.HexArray("00 00 00 00 01");
            pw.WriteIP(GameServer.m_dwIP);
            pw.UShort(GameServer.m_usURelayServerPort);
            pw.WriteIP(GameServer.m_dwIP);
            pw.UShort(GameServer.m_usTRelayServerPort);
            pw.HexArray("01 00 01 00 00 01 2C 00 00 00 14 00 02 26 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 42 00 52 00 00 06 01 00 00 00 00 00 00 00 06 00 00 00 00 FF FF FF FF");

            p.SendPacket(pw, 1558);
        }
Exemple #7
0
        public void CharsEquipsInfo(Session right)
        {
            PacketWrite pw = new PacketWrite();

            pw.UnicodeStr(right.PInfo.m_strLogin);
            pw.Byte(right.PInfo.m_ucCharType);
            pw.Int(right.PCharacters.CharInfo.Length);
            for (int x = 0; x < right.PCharacters.CharInfo.Length; x++)
            {
                pw.Byte(right.PCharacters.CharInfo[x].CharType);
                pw.Int(right.PCharacters.CharInfo[x].Equipements.Count);
                for (int x2 = 0; x2 < right.PCharacters.CharInfo[x].Equipements.Count; x2++)
                {
                    pw.Int(right.PCharacters.CharInfo[x].Equipements[x2].ItemID);
                    pw.Int(1);
                    pw.Int(right.PCharacters.CharInfo[x].Equipements[x2].ItemUID);
                    pw.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
                }
                pw.Int(0);
                Serializables.KPetInfo(right, pw, x);
                pw.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
            }
            pw.Int(right.PInfo.m_dwUserUID);
            pw.Short(0);
            right.SendPacket(pw, 96);
            if (right.PInfo.CurRoom != null)
            {
                right.PInfo.CurRoom.SendForAllPlayersInRoom(pw, 96);
            }
        }
Exemple #8
0
        /* public static void Command_Exit(Session player)
         * {
         *   WriteBuffer Write = new WriteBuffer();
         *   Write.Int(0);
         *   Write.Int(0);
         *   player.Session_Send(Write, 1240);
         * }
         *
         * public static void Command_NextMode(Session player)
         * {
         *   WriteBuffer WB = new WriteBuffer();
         *   WB.Int(0);
         *   WB.Byte(0);
         *   WB.Short(0);
         *
         *   WB.Byte((byte)player.Account.CurrentRoom.MatchMode);
         *   WB.Int(player.Account.CurrentRoom.GameMode + 1);
         *   WB.Int(player.Account.CurrentRoom.ItemMode);
         *   WB.Boolean(player.Account.CurrentRoom.RandomMap);
         *   WB.Int(player.Account.CurrentRoom.Map);
         *
         *   WB.Int(0);
         *   WB.HexArray("FF FF FF FF 00 00 00 00 00 00 00");
         *
         *   WB.Short((short)player.Account.CurrentRoom.PlayersInRoom());
         *   WB.Short((short)player.Account.CurrentRoom.OpenSlots());
         *
         *   for (int i = 0; i < player.Account.CurrentRoom.MaxPlayers; i++)
         *   {
         *       WB.Boolean(player.Account.CurrentRoom.Slots[i].Open);
         *   }
         *
         *   WB.Int(0);
         *   WB.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00");
         *   for (int i = 0; i < player.Account.CurrentRoom.MaxPlayers; i++)
         *   {
         *       if (player.Account.CurrentRoom.Slots[i].Active == true)
         *       {
         *           player.Account.CurrentRoom.Slots[i].Player.Session_Send(WB, 29);
         *       }
         *   }
         * }
         *
         * public static void Command_PrevioustMode(Session player)
         * {
         *   WriteBuffer WB = new WriteBuffer();
         *   WB.Int(0);
         *   WB.Byte(0);
         *   WB.Short(0);
         *
         *   WB.Byte((byte)player.Account.CurrentRoom.MatchMode);
         *   WB.Int(player.Account.CurrentRoom.GameMode - 1);
         *   WB.Int(player.Account.CurrentRoom.ItemMode);
         *   WB.Boolean(player.Account.CurrentRoom.RandomMap);
         *   WB.Int(player.Account.CurrentRoom.Map);
         *
         *   WB.Int(0);
         *   WB.HexArray("FF FF FF FF 00 00 00 00 00 00 00");
         *
         *   WB.Short((short)player.Account.CurrentRoom.PlayersInRoom());
         *   WB.Short((short)player.Account.CurrentRoom.OpenSlots());
         *
         *   for (int i = 0; i < player.Account.CurrentRoom.MaxPlayers; i++)
         *   {
         *       WB.Boolean(player.Account.CurrentRoom.Slots[i].Open);
         *   }
         *
         *   WB.Int(0);
         *   WB.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00");
         *   for (int i = 0; i < player.Account.CurrentRoom.MaxPlayers; i++)
         *   {
         *       if (player.Account.CurrentRoom.Slots[i].Active == true)
         *       {
         *           player.Account.CurrentRoom.Slots[i].Player.Session_Send(WB, 29);
         *       }
         *   }
         * }*/

        public static void Command_SignBoard(Session player, string Msg)
        {
            PacketWrite pw = new PacketWrite();

            pw.HexArray("00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
            pw.UnicodeStr(Msg);

            Serializables.SendForAllPlayers(pw, 362);
        }
Exemple #9
0
        public void CreateRoom(Session p, PacketRead r)
        {
            //===================
            // 0; OK..
            // 1; 현재 채널에 더이상의 방을 만들 수 없음.
            // 2; 존재하지 않는 캐릭터가 선택되었습니다.
            // 3; 입장할수 있는 올바른 레벨이 아닙니다.
            try
            {
                int m_dwOK = 0;
                Serializables.KRoomInfo(p, r);
                byte[] restant = r.Buffer_Array_Bytes(78);
                Serializables.KUserInfo(p, r);

                PacketWrite pw = new PacketWrite();
                pw.Int(m_dwOK);
                Serializables.KUserInfo(p, pw);
                Serializables.SerializeStages(p, pw);
                pw.HexArray("01 01 00 00 00 00 00 00 00 00 00 00 00 00");
                Serializables.m_roomCharacterInfo(p, pw);
                pw.HexArray("00 00 00 02 6B 00 A8 C0 E4 02 2D B1 00 00 00 01 7F 1A 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 E5 6A 00 00 00 00 00 D9 92 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 5A 00 5A 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 85 89 82 21 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
                Serializables.KRoomInfo(p, pw);
                pw.ArrayBytes(restant);

                p.SendPacket(pw, 57);
                GameServer.List_Rooms.Add(p.PInfo.CurRoom.m_usRoomID, p.PInfo.CurRoom);
                GameServer.UsersList.Remove(p);
                p.PInfo.m_cStatus = "ROOM";
            }
            catch (Exception ex)
            {
                Log.Write("\n===========:Error:===========\n{0}\n{1}\n=============================n", ex.Message, ex.StackTrace);
                PacketWrite pw = new PacketWrite();
                pw.Int(1);
                pw.UnicodeStr(p.PInfo.m_strLogin);
                pw.Int(p.PInfo.m_dwUserUID);
                pw.UnicodeStr(p.PInfo.m_strNickName);
                p.SendPacket(pw, 57);
            }
        }
Exemple #10
0
        public void UsersList(Session s, PacketRead r)
        {
            PacketWrite pw = new PacketWrite();

            pw.Int(GameServer.UsersList.Count);
            for (int i = 0; i < GameServer.UsersList.Count; i++)
            {
                pw.Int(GameServer.UsersList[i].PInfo.m_dwUserUID);//id
                pw.UnicodeStr(GameServer.UsersList[i].PInfo.m_strLogin);
                pw.Byte((byte)11);
                pw.HexArray("00 13 00 00 00 00 00");
            }
            s.SendPacket(PacketCompress.HalfCompress(pw.Get_Packet()), 51);
        }
Exemple #11
0
        public static void KRoomInfo(Session right, PacketWrite ks)
        {
            libcomservice.REQUEST.Room room = right.PInfo.CurRoom;

            ks.UShort(room.m_usRoomID);
            ks.UnicodeStr(room.m_strRoomName);
            ks.Bool(room.m_bPublic);
            ks.Bool(room.m_bGuild);
            ks.UnicodeStr(room.m_strRoomPasswd);
            ks.Short(room.m_usUsers());
            ks.Short(7);
            ks.Bool(room.m_bPlaying);
            ks.Byte(room.m_cGrade);
            ks.Byte(room.m_cGameCategory);
            ks.Int(room.m_iGameMode);
            ks.Int(room.m_iSubGameMode);
            ks.Bool(room.m_bRandomableMap);
            ks.Int(room.m_iMapID);
            ks.Int(room.m_iP2PVersion);
            for (short j = 0; j < room.m_usMaxUsers; j++)
            {
                ks.Bool(room.m_dwSlots[j].Open);
            }
            if (room.m_usMaxUsers == 4)
            {
                ks.Bool(false);
                ks.Bool(false);
            }
            ks.Int(room.m_vecMonsterSlot);
            ks.Int(room.m_cDifficulty);
            ks.HexArray("00 00 00 00 01");
            ks.WriteIP(GameServer.m_dwIP);
            ks.UShort(GameServer.m_usURelayServerPort);
            ks.WriteIP(GameServer.m_dwIP);
            ks.UShort(GameServer.m_usTRelayServerPort);
        }
Exemple #12
0
        public void Contents(Session player)
        {
            PacketWrite Write = new PacketWrite();

            Write.HexArray("00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 0A 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 09 00 00 00 01 00 00 00 01 00 00 00 0A 00 00 00 01 00 00 00 01 00 00 00 0E 00 00 00 01 00 00 00 01 00 00 00 12 00 00 00 01 00 00 00 01 00 00 00 14 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 01 00 00 00 03 00 00 00 03");

            //MatchModes
            Write.Int(4);
            Write.Int((int)MatchModes.GC_GMC_MATCH);
            Write.Int((int)MatchModes.GC_GMC_INDIGO);
            Write.Int((int)MatchModes.GC_GMC_DEATHMATCH);
            Write.Int((int)MatchModes.GC_GMC_ANGELS_EGG);

            Write.HexArray("00 00 00 08 00 00 00 01 00 00 00 09 00 00 00 15 00 00 00 01 00 00 00 0D 00 00 00 0E 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 05 00 00 00 03 00 00 00 01 00 00 00 06 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 05 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 06 00 00 00 01 00 00 00 1C 00 00 00 07 00 00 00 01 00 00 00 1D 00 00 00 08 00 00 00 02 00 00 00 1F 00 00 00 20 00 00 00 02 00 00 00 42");
            //Stages
            Write.HexArray("00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1E 00 00 00 24 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2A 00 00 00 2B 00 00 00 2C 00 00 00 2D 00 00 00 2E 00 00 00 2F 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 37 00 00 00 38 00 00 00 39 00 00 00 3A 00 00 00 3B 00 00 00 3C 00 00 00 3D 00 00 00 3E 00 00 00 3F 00 00 00 40 00 00 00 46 00 00 00 49 00 00 00 4A 00 00 00 4B 00 00 00 4C 00 00 00 4E 00 00 00 4F 00 00 00 50 00 00 00 51 00 00 00 54 00 00 00 55 00 00 00 56 00 00 00 57 00 00 00 58 00 00 00 59 00 00 00 5A 00 00 00 5B 00 00 00 5C 00 00 00 5D 00 00 00 5E 00 00 00 5F");

            Write.HexArray("00 00 00 09 00 00 00 02 00 00 00 21 00 00 00 22 00 00 00 0A 00 00 00 01 00 00 00 25 00 00 00 0B 00 00 00 01 00 00 00 26 00 00 00 0D 00 00 00 01 00 00 00 42 00 00 00 0C 00 00 00 01 00 00 00 41 00 00 00 0B 00 00 00 04 00 00 00 00 01 00 00 00 63 00 00 00 00 01 00 00 00 0C 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 04 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 5F 00 00 00 01 01 00 00 00 0D 00 00 00 0A 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 09 00 00 00 04 00 00 00 06 00 00 00 05 00 00 00 08 00 00 00 07 00 00 00 0B 00 00 00 05 01 00 00 00 0F 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 03 00 00 00 00 08 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 09 00 00 00 0B 00 00 00 02 00 00 00 0A 00 00 00 04 00 00 00 0C 01 00 00 00 01 00 00 00 00 00 00 00 08 00 00 00 00 0D 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 0B 01 00 00 00 0F 00 00 00 64 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 2B 00 00 00 2F 00 00 00 0A 00 00 00 00 02 00 00 00 00 00 00 00 0A 00 00 00 06 00 00 00 00 01 00 00 00 00 00 00 00 07 00 00 00 00 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 01");

            Write.Int(MaxLevel);
            Write.Int(lCharacters.Count);
            for (int x = 0; x < lCharacters.Count; x++)
            {
                Write.Int(lCharacters[x].CharId);
                Write.Int(lCharacters[x].MaxPromotion);
                for (byte y = 0; y < lCharacters[x].MaxPromotion; y++)
                {
                    Write.Byte(y);
                }
            }

            Write.HexArray("00 00 00 13 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 03 00 00 00 01 00 00 00 04 00 00 00 01 00 00 00 05 00 00 00 01 00 00 00 06 00 00 00 01 00 00 00 07 00 00 00 01 00 00 00 08 00 00 00 01 00 00 00 09 00 00 00 01 00 00 00 0A 00 00 00 00 00 00 00 0B 00 00 00 01 00 00 00 0C 00 00 00 01 00 00 00 0D 00 00 00 01 00 00 00 0E 00 00 00 00 00 00 00 0F 00 00 00 01 00 00 00 10 00 00 00 01 00 00 00 11 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 12 00 00 00 00 00 01 83 3F 00 00 00 01 00 01 83 40 00 00 00 02 00 01 83 41 00 00 00 03 00 01 83 42 00 00 00 04 00 01 83 43 00 00 00 05 00 01 83 44 00 00 00 06 00 01 83 45 00 00 00 07 00 01 83 46 00 00 00 08 00 01 83 47 00 00 00 09 00 01 83 48 00 00 00 0A 00 01 83 49 00 00 00 0B 00 01 83 4A 00 00 00 0C 00 01 83 4B 00 00 00 0D 00 01 83 4C 00 00 00 0E 00 01 83 4D 00 00 00 0F 00 01 83 4E 00 00 00 10 00 01 83 4F 00 00 00 11 00 01 E3 32");
            Write.HexArray("00 00 00 43 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00 1D 00 00 00 1E 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 29 00 00 00 2A 00 00 00 2B 00 00 00 2C 00 00 00 2D 00 00 00 2E 00 00 00 2F 00 00 00 30 00 00 00 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 39 00 00 00 3A 00 00 00 3B 00 00 00 3C 00 00 00 3D 00 00 00 3E 00 00 00 3F 00 00 00 40 00 00 00 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 45 00 00 00 46 00 00 00 47");
            Write.HexArray("00 00 00 02 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 17 00 00 01 B9 00 00 01 B9 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 BA 00 00 01 BA 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 BB 00 00 01 BB 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 BC 00 00 01 BC 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 BD 00 00 01 BD 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 BF 00 00 01 BF 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 C0 00 00 01 C0 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 C1 00 00 01 C1 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 01 C2 00 00 01 C2 00 00 00 64 00 00 00 CF 00 00 03 E8 00 00 02 1A 00 00 02 1A 00 00 00 79 00 00 05 DC 00 00 0D AC 00 00 02 5C 00 00 02 5C 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 5D 00 00 02 5D 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 5E 00 00 02 5E 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 5F 00 00 02 5F 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 60 00 00 02 60 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 61 00 00 02 61 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 62 00 00 02 62 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 63 00 00 02 63 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 65 00 00 02 65 00 00 00 8C 00 00 04 4C 00 00 24 86 00 00 02 67 00 00 02 67 00 00 00 C8 00 00 08 98 00 00 1B 58 00 00 02 68 00 00 02 68 00 00 00 F0 00 00 0C E4 00 00 1D 4C 00 00 02 69 00 00 02 69 00 00 00 B4 00 00 01 F4 00 00 24 86 00 00 02 6A 00 00 02 6A 00 00 00 B4 00 00 01 F4 00 00 24 86");
            Write.HexArray("00 00 00 00 00 00 00 02");
            Write.HexArray("00 00 00 18 00 00 00 1E");
            Write.Int(lEvents.Count);
            for (int x = 0; x < lEvents.Count; x++)
            {
                Write.Int(lEvents[x].EventUID);
                Write.Int(lEvents[x].MBoxID);
                Write.UnicodeStr(lEvents[x].TextureFile);
                Write.Int(1);
                Write.Int(lEvents[x].EventCoin);
            }
            player.SendPacket(Write, 12);
        }
Exemple #13
0
 private static void InformLeaveRoom(Session player)
 {
     try
     {
         PacketWrite WB = new PacketWrite();
         WB.UnicodeStr(player.PInfo.m_strLogin);
         WB.Int(0);
         WB.Int(player.PInfo.m_dwUserUID);
         WB.Int(3);
         for (int i = 0; i < player.PInfo.CurRoom.m_usMaxUsers; i++)
         {
             if (player.PInfo.CurRoom.m_dwSlots[i].Active == true)
             {
                 player.PInfo.CurRoom.m_dwSlots[i].usr.SendPacket(WB, 130);
             }
         }
     }
     catch (Exception ex)
     {
         Log.Write("\n===========:Error:===========\n{0}\n{1}\n=============================n", ex.Message, ex.StackTrace);
     }
 }
Exemple #14
0
        public void Send_List(Session p)
        {
            PacketWrite pw = new PacketWrite();

            pw.Int(List.Length);
            for (int i = 0; i < List.Length; i++)
            {
                pw.Int(i + 1);
                pw.Int(i + 1);
                pw.UnicodeStr(List[i].ServerName);
                pw.Str(List[i].ServerIP);
                pw.UShort(List[i].ServerPort);
                pw.Int(0);
                pw.Int(500);
                pw.Int(327);
                pw.Int(-1);
                pw.Int(-1);
                pw.Str(List[i].ServerIP);
                pw.Int(0);
                pw.Int(0);
            }
            p.SESSION_SEND(pw.Get_Packet(), 4);
        }
Exemple #15
0
        public void SendList(Session right, PacketRead rs)
        {
            PacketWrite ks = new PacketWrite();

            ks.Int(List.Length);
            for (int i = 0; i < List.Length; i++)
            {
                ks.Int(i + 1);
                ks.Int(i + 1);
                ks.UnicodeStr(List[i].ServerName);
                ks.Str(List[i].ServerIP);
                ks.UShort(List[i].ServerPort);
                ks.Int(0);
                ks.Int(500);
                ks.Int(327);
                ks.Int(-1);
                ks.Int(-1);
                ks.Str(List[i].ServerIP);
                ks.Int(0);
                ks.Int(0);
            }
            right.SendPacket(ks, 156);
        }
Exemple #16
0
        public void ListRooms(Session p, PacketRead r)
        {
            try
            {
                byte RoomType = r.Byte();
                byte RoomMode = r.Byte();

                int RoomsCount = 0;
                foreach (ushort i in GameServer.List_Rooms.Keys)
                {
                    if (p.PInfo.m_dwChannelUID == 6)
                    {
                        if (RoomMode != GameServer.List_Rooms[i].m_iGameMode)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (GameServer.List_Rooms[i].m_cGameCategory != 0)
                        {
                            continue;
                        }
                    }
                    if (RoomType == 1)
                    {
                        if (GameServer.List_Rooms[i].m_bPlaying == true || GameServer.List_Rooms[i].m_abTotalSlotsOpen() == 0)
                        {
                            continue;
                        }
                    }
                    RoomsCount += 1;
                }

                PacketWrite pw = new PacketWrite();
                pw.Int(RoomsCount);

                foreach (ushort RoomPosition in GameServer.List_Rooms.Keys)
                {
                    if (p.PInfo.m_dwChannelUID == 6)
                    {
                        if (RoomMode != GameServer.List_Rooms[RoomPosition].m_iGameMode)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (GameServer.List_Rooms[RoomPosition].m_cGameCategory != 0)
                        {
                            continue;
                        }
                    }

                    if (RoomType == 1)
                    {
                        if (GameServer.List_Rooms[RoomPosition].m_bPlaying == true || GameServer.List_Rooms[RoomPosition].m_abTotalSlotsOpen() == 0)
                        {
                            continue;
                        }
                    }

                    pw.UShort(GameServer.List_Rooms[RoomPosition].m_usRoomID);
                    pw.UnicodeStr(GameServer.List_Rooms[RoomPosition].m_strRoomName);

                    if (GameServer.List_Rooms[RoomPosition].m_strRoomPasswd.Length > 0)
                    {
                        pw.Bool(false);
                    }
                    else
                    {
                        pw.Bool(true);
                    }

                    pw.Byte(0);
                    pw.UnicodeStr(GameServer.List_Rooms[RoomPosition].m_strRoomPasswd);
                    pw.Short((short)(GameServer.List_Rooms[RoomPosition].m_abTotalSlotsOpen() + 1));
                    pw.Short(GameServer.List_Rooms[RoomPosition].m_usUsers());
                    pw.Bool(GameServer.List_Rooms[RoomPosition].m_bPlaying);
                    pw.HexArray("6F 0C CC FA 0B 08 00 00 00 20 63 00 00 F5 00 00 00 03 00 00 00 00");
                    pw.Short(0);
                    pw.Short(GameServer.List_Rooms[RoomPosition].m_usUsers());
                    for (int x = 0; x < GameServer.List_Rooms[RoomPosition].m_usMaxUsers; x++)
                    {
                        if (GameServer.List_Rooms[RoomPosition].m_dwSlots[x].Active)
                        {
                            pw.UnicodeStr(GameServer.List_Rooms[RoomPosition].m_dwSlots[x].usr.PInfo.m_strNickName);
                            pw.Byte(11);
                        }
                    }
                    pw.HexArray("00 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 04 42 00 52 00 00 00 00 00 07 00 00 00 00 FF FF FF FF");
                }
                p.SendPacket(PacketCompress.HalfCompress(pw.Get_Packet()), 49);
            }
            catch
            {
                PacketWrite pw = new PacketWrite();
                pw.Int(0);
                p.SendPacket(PacketCompress.HalfCompress(pw.Get_Packet()), 49);
            }
        }
Exemple #17
0
        public void Login(Session p, Read_Buffer r)
        {
            try
            {
                r.Int();
                p.PInfo.Username = r.String();
                p.PInfo.Passwd   = r.String();

                PacketWrite WB = new PacketWrite();

                Log.Write("clog : KTRUser::KSkTRUser::CheckLogin::User {0} and Passwd {1}", p.PInfo.Username, p.PInfo.Passwd);
                int Login_Acess = Querys.Execute_VerifyAccount(p, p.PInfo.Username, p.PInfo.Passwd);
                if (Login_Acess == 0)
                {
                    SERVER_LIST Servers = new SERVER_LIST();
                    Servers.Send_List(p);
                    p.Req.HandlerNewsFromChannel(p, r);
                    p.Req.HandlerClientContents(p, r);
                    p.Req.HandlerSocketTablesInfo(p, r);
                    p.Req.HandlerCashBack(p, r);

                    Log.Write("clog : KTRUser::KSkTRUser::OnClientLoginOK(), {0}-{1}-{2}.", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                }
                WB.Int(Login_Acess);
                WB.UnicodeStr(p.PInfo.Username);
                WB.Str(p.PInfo.Passwd);
                WB.HexArray("00 00 00 00 14 0F 03 F7 4C 00 00 00 00 00 00 00 02 5A 5A 00 00 C9 8E 00 00 C9 8E");
                WB.UnicodeStr(MarksURL);
                WB.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 03 00 00 00 00 00 00 00 00 64 01 00 00 00 00 00 00 00 64 02 00 00 00 00 00 00 00 64 01 BF 80 00 00 FC 04 97 FF 00 00 00 00 00 00 00 00 00 00 00 00 00");

                WB.UnicodeStr(p.PInfo.Username);
                WB.UnicodeStr(p.PInfo.UserNick);

                WB.HexArray("00 00 00 04 01 00");

                WB.Int(p.PInfo.Guild_Contribution);
                WB.HexArray("00 00 00 00 00 00 00 00");

                WB.UnicodeStr(p.PInfo.Guild_Who);

                WB.HexArray("07 E1 06 12 00 00 00 07 E1 07 09 00 00 00 00 00 00 00 00 00 04");

                WB.UnicodeStr(p.PInfo.Guild_Name);

                WB.HexArray("01 00 00 00 01");

                WB.UnicodeStr(p.PInfo.Guild_mark);

                WB.UnicodeStr(p.PInfo.Guild_desc);

                WB.HexArray("02 07 E1 05 15 00 00 00 00 02 E0 C2");

                WB.UnicodeStr(MarksURL);

                WB.Int(0);
                WB.Int(500000);

                WB.HexArray("00 00 00 C7 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 03 E8 00 00 00 03");

                WB.Int(1);
                WB.UnicodeStr(p.PInfo.Guild_desc);

                WB.Int(2);
                WB.UnicodeStr(p.PInfo.Guild_notice1);

                WB.Int(3);
                WB.UnicodeStr(p.PInfo.Guild_notice1);

                WB.Int(0);

                WB.UnicodeStr(MarksURL);

                WB.HexArray("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 07 00 00 00 00 00 0C 1A C6 8E 02 00 00 00 00 0C 1A C6 8E 08 00 00 00 00 0C 1A C6 8E 09 00 00 00 00 0C 1A C6 8E 10 00 00 00 00 00 00 09 D3 11 00 00 00 00 0C 1A C6 8E 12 00 00 00 00 00 00 02 21 01 BF 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00");

                p.SESSION_SEND(WB.Get_Packet(), 3);
            }
            catch (Exception Ex)
            {
                Log.Write("{0} \n\n {1}", Ex.Message, Ex.StackTrace);
            }
        }
Exemple #18
0
        public void Login(Session p, PacketRead r)
        {
            //33 = +1
            //1249 - normal
            try
            {
                byte[] Crc32  = new byte[] { 0x43, 0x7D, 0x7A, 0x7A };
                int    m_dwOK = 0;
                p.PInfo.m_strLogin  = r.String();
                p.PInfo.m_strPasswd = r.String();
                p.PInfo.m_bMale     = r.Bool();
                p.PInfo.m_iVersion  = r.Int();
                r.Int();
                byte[] checksum = r.Buffer_Array_Bytes(4);
                //Log.WriteHex("Checksum:",checksum);

                PacketWrite pw = new PacketWrite();

                Log.Write("clog : KTRUser::KSkTRUser::CheckLogin::User {0} and Passwd {1}", p.PInfo.m_strLogin, p.PInfo.m_strPasswd);
                int Login_Acess = Querys.Execute_VerifyAccount(p, p.PInfo.m_strLogin, p.PInfo.m_strPasswd);
                if (Login_Acess == 0)
                {
                    p.Req.ExpTable(p);
                    p.Req.ServerTime(p);
                    p.Req.NewCharChoice(p);
                    p.PCharacters.LoadCharacters(p.PInfo.m_strLogin, p.PInfo.m_dwUserUID);
                    p.PStages.LoadStages(p);
                    p.PInventory.InventoryItens(p);
                    p.PLetter.LoadLetter(p.PInfo.m_dwUserUID);
                    Log.Write("clog : KTRUser::KSkTRUser::OnClientLoginOK(), {0}-{1}-{2}.", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                }
                else if (Login_Acess == 14)
                {
                    m_dwOK = 7;
                }
                if (checksum != Crc32)
                {
                    m_dwOK = 10;
                }
                pw.UnicodeStr(p.PInfo.m_strLogin);
                pw.UnicodeStr(p.PInfo.m_strNickName);
                pw.Int(0);
                pw.Str(p.PInfo.m_strPasswd);
                pw.HexArray("00 2E 00 37 00 32 00 31 00 00 C8 72 D1 BF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
                pw.Byte(0);     //m_cAuthLevel
                pw.Int(100);    //m_iAge
                pw.Bool(false); //m_bAgreePrivateInfo
                pw.Byte(0);     //m_cPCBangType
                Serializables.m_mapCharacterInfo(p, pw);
                pw.UShort(GameServer.m_usUdpPort);
                pw.Int(p.PInfo.m_dwUserUID);
                pw.UnicodeStr(GameServer.m_strServerName);
                pw.Int(GameServer.m_iSessionInfo);
                pw.HexArray("00 00 00 00");
                Serializables.SerializeStages(p, pw);
                pw.UInt(3222798336);//C0 18 00 00 //m_nConnectType
                Serializables.m_vecMissionSlot(p, pw);
                pw.Int(0);
                pw.HexArray("29 E1 85 22 02 00 74 85 00 00 00 01 00 00 00 00 00 00 00 00");
                pw.UnicodeStr("MsgServer_02");
                pw.Str(GameServer.m_dwIP);
                pw.UShort(GameServer.m_usMsgPort);
                pw.HexArray("00 00 02 9D 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF");
                pw.Str(GameServer.m_dwIP);
                pw.HexArray("00 00 00 00 00 00 00 00 03 5A 35 55 C0 5A 35 55 C0 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 01 00 00 00 01 61 D0 5E 60 00 D0 FF F9 3D AC 0C F9 74 00 5A 35 55 00 00 00 00 00 73 E6 5F 5A 33 2C A0 00 00 00 00");
                //Chars
                pw.HexArray("00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 0E 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 14 00 00 00 00 00 00 00 00 00 00");
                pw.HexArray("00 00 00 03 00 00 00 C6 00 0C 22 CC 00 00 00 00 00 00 00 C7 00 0C F1 FC 00 00 00 00 00 00 00 C9 00 15 6D 0A 00 00 00 01");
                pw.Int(p.PInfo.m_dwSlots);
                pw.Byte(255);
                pw.Byte(0);
                pw.Byte(0);
                p.SendPacket(pw, 34);
                p.Shop.SendMyVirtualCash(p);
                p.HeroDugeons.HeroDungeonInfo(p);
                UdpPort(p);
                sends(p);
            }
            catch (Exception Ex)
            {
                Log.Write("{0} \n\n {1}", Ex.Message, Ex.StackTrace);
            }
        }
Exemple #19
0
        public void EnterRoom(Session p, PacketRead r)
        {
            try
            {
                r.Jump(4);
                ushort roomID   = (ushort)r.Get_Short();
                string Password = r.UnicodeString();
                r.Jump(5);
                string userLogin = r.UnicodeString();
                r.Jump(4);
                string userNick = r.UnicodeString();
                r.Jump(4);
                p.PInfo.m_ucCharType = r.Byte();

                Room room = RoomExists(roomID);

                if (room == null)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                else if (room.m_abTotalSlotsOpen() == 0)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                else if (room.m_bPlaying == true)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                else if (room.m_strRoomPasswd != Password)
                {
                    PacketWrite pw2 = new PacketWrite();
                    pw2.Int(1);
                    p.SendPacket(pw2, 54);
                    return;
                }
                int pos = 0;
                if (room.m_cGameCategory == 2)
                {
                    pos = room.m_abSlotOpen();
                }
                else
                {
                    byte Team1 = 0, Team2 = 0;
                    int  EmptyPos1 = -1, EmptyPos2 = -1;
                    for (int i = 0; i < 3; i++)
                    {
                        if (room.m_dwSlots[i].Active == true)
                        {
                            Team1++;
                        }
                        if (EmptyPos1 == -1 && room.m_dwSlots[i].Open == true)
                        {
                            EmptyPos1 = i;
                        }
                    }
                    for (int i = 3; i < 6; i++)
                    {
                        if (room.m_dwSlots[i].Active == true)
                        {
                            Team2++;
                        }
                        if (EmptyPos2 == -1 && room.m_dwSlots[i].Open == true)
                        {
                            EmptyPos2 = i;
                        }
                    }

                    pos = EmptyPos1;
                    if (Team1 >= Team2)
                    {
                        pos = EmptyPos2;
                    }
                }
                room.m_dwSlots[pos].Active       = true;
                room.m_dwSlots[pos].usr          = p;
                room.m_dwSlots[pos].Open         = false;
                room.m_dwSlots[pos].AFK          = false;
                room.m_dwSlots[pos].Deaths       = 0;
                room.m_dwSlots[pos].Kills        = 0;
                room.m_dwSlots[pos].Win          = 0;
                room.m_dwSlots[pos].PositionSlot = pos;
                room.m_dwSlots[pos].Leader       = false;

                p.PInfo.CurRoom   = room;
                p.PInfo.m_cStatus = "ROOM";
                GameServer.UsersList.Remove(p);

                PacketWrite pw = new PacketWrite();
                pw.UnicodeStr(p.PInfo.m_strLogin);
                pw.Int(p.PInfo.m_dwUserUID);
                pw.UnicodeStr(p.PInfo.m_strNickName);
                pw.Int(pos);
                pw.Byte(p.PInfo.m_ucCharType);
                pw.Int(0);
                pw.HexArray("00 FF 00 FF 00 FF 00 00 00 00");
                pw.Byte((byte)(pos / 3));
                pw.HexArray("01 00 00 00 64 00 00");
                pw.Int(p.PInfo.m_iGamePoint);
                pw.Short(0);
                Serializables.SerializeStages(p, pw);
                if (room.m_sSearchLeader() == p)
                {
                    pw.Bool(true);
                }
                else
                {
                    pw.Bool(false);
                }
                pw.HexArray("01 00 00 00 00 00 00 00 00 00 00 00 00");
                Serializables.m_roomCharacterInfo(p, pw);
                pw.HexArray("00 00 00 02 76 19 A8 C0 10 0C D6 BA 00 00 00 01 7F 39 00 00 00 00 00 00 00 00 00 00 00");
                pw.Byte(room.m_dwSlots[pos].Status);
                pw.HexArray("00 00 00 00 00 12 C8 F2 00 00 00 00 00 D6 D9 BE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 42 00 52 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D2 F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 00 06 11 16 00 00 00 00 00 00 00 00 46 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 97 D8 00 00 01 A0 04 7B 00 00 00 00 00 00 00 00");

                room.SendForAllPlayersInRoom(pw, 54);
                RoomInfo(p, room);
                RoomInfoDivide(p, room);
            }
            catch (Exception ex)
            {
                Log.Write("{0}", ex.StackTrace);
                PacketWrite pw = new PacketWrite();
                pw.Int(1);
                p.SendPacket(pw, 54);
                p.PInfo.CurRoom   = null;
                p.PInfo.m_cStatus = "LOBBY";
                GameServer.UsersList.Add(p);
            }
        }