Esempio n. 1
0
        public void OnChangeEquipInRoom(ClientSession cs, InPacket ip)
        {
            if (cs.CurrentRoom == null)
            {
                return;
            }


            using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_CHANGE_LOOK_EQUIP_NOT))
            {
                oPacket.WriteInt(cs.LoginUID);
                oPacket.WriteInt(cs.MyCharacter.MyChar.Length);

                for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++)
                {
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType);
                    oPacket.WriteInt(0); // 00 00 00 00
                }


                for (int i = 0; i < 6; i++)
                {
                    if (cs.CurrentRoom.Slot[i].Active == true)
                    {
                        oPacket.CompressAndAssemble(cs.CurrentRoom.Slot[i].cs.CRYPT_KEY, cs.CurrentRoom.Slot[i].cs.CRYPT_HMAC, cs.CurrentRoom.Slot[i].cs.CRYPT_PREFIX, cs.CurrentRoom.Slot[i].cs.CRYPT_COUNT);
                        cs.CurrentRoom.Slot[i].cs.Send(oPacket);
                        oPacket.CancelAssemble();
                    }
                }
            }
        }
Esempio n. 2
0
        public void OnChat(ClientSession cs, InPacket ip)
        {
            ip.ReadByte(); // 01
            ip.ReadInt();  // 00 00 00 00
            int    WhereLen = ip.ReadInt();
            string Where    = ip.ReadUnicodeString(WhereLen);

            ip.ReadInt(); // 00 00 00 00
            ip.ReadInt(); // 00 00 00 00
            ip.ReadInt(); // FF FF FF FF
            int    ChatLen = ip.ReadInt();
            string Chat    = ip.ReadUnicodeString(ChatLen);

            if (Where == "Server")
            {
                if (cs.AuthLevel == 1)
                {
                    if (Chat.Substring(0, 1) == "!")
                    {
                        cmd.GMCommands(cs, Chat, ip);
                    }
                    else
                    {
                    }
                    if (Chat.Substring(0, 1) == "/")
                    {
                        cmd.GMCommands(cs, Chat, ip);
                    }
                }
                using (OutPacket op = new OutPacket(GameOpcodes.EVENT_CHAT_NOT))
                {
                    op.WriteByte(1);
                    op.WriteInt(cs.LoginUID);
                    op.WriteInt(cs.Nick.Length * 2);
                    op.WriteUnicodeString(cs.Nick);
                    op.WriteInt(0);
                    op.WriteInt(0);
                    op.WriteInt(-1);
                    op.WriteInt(ChatLen);
                    op.WriteUnicodeString(Chat);
                    op.WriteInt(0);
                    op.WriteInt(0);



                    foreach (ClientSession u in UsersList)
                    {
                        if (u.CurrentRoom == cs.CurrentRoom)
                        {
                            op.Assemble(u.CRYPT_KEY, u.CRYPT_HMAC, u.CRYPT_PREFIX, u.CRYPT_COUNT);
                            u.Send(op);
                            op.CancelAssemble();
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public void GMCommands(ClientSession cs, String Chat, InPacket ip)
 {
     if (cs.AuthLevel == 1)
     {
         //Commands!
         if (Chat == "/loginout")
         {
             using (OutPacket op = new OutPacket(GameOpcodes.EVENT_STAT_LOGINOUT_COUNT))
             {
                 op.WriteInt(0);
                 op.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT);
                 cs.Send(op);
             }
         }
         if (Chat == "/Char" + Chat.Substring(5))
         {
             cs.CurrentChar = Convert.ToInt32(Chat.Substring(5));
         }
         if (Chat == "/addgp" + (string)Chat.Substring(6))
         {
             DataSet ds = new DataSet();
             Database.Query(ref ds, "UPDATE   `gc`.`account` SET   `Gamepoint` = '{1}' WHERE `LoginUID` = '{0}'", cs.LoginUID, cs.GamePoint + Convert.ToInt32(Chat.Substring(6)));
         }
         if (Chat == "!!!!!" + Chat.Substring(5))
         {
             using (OutPacket op = new OutPacket(GameOpcodes.EVENT_SIGN_BOARD_NOT))
             {
                 //LogFactory.GetLog("SIGNBOARD").LogInfo("TEXT: " + Chat.Substring(5));
                 op.WriteHexString("00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
                 op.WriteInt((cs.Nick + " : " + Chat.Substring(5)).Length * 2);
                 op.WriteUnicodeString((cs.Nick + " : " + Chat.Substring(5)));
                 foreach (ClientSession u in cs.CurrentChannel.UsersList)
                 {
                     if (u.CurrentRoom == cs.CurrentRoom)
                     {
                         op.Assemble(u.CRYPT_KEY, u.CRYPT_HMAC, u.CRYPT_PREFIX, u.CRYPT_COUNT);
                         u.Send(op);
                         op.CancelAssemble();
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
        public void OnChat(ClientSession cs, InPacket ip)
        {
            ip.ReadByte(); // 01
            ip.ReadInt();  // 00 00 00 00
            int    WhereLen = ip.ReadInt();
            string Where    = ip.ReadUnicodeString(WhereLen);

            ip.ReadInt(); // 00 00 00 00
            ip.ReadInt(); // 00 00 00 00
            ip.ReadInt(); // FF FF FF FF
            int    ChatLen = ip.ReadInt();
            string Chat    = ip.ReadUnicodeString(ChatLen);

            //LogFactory.GetLog("Main").LogInfo("Chat: {0}", Chat);

            using (OutPacket op = new OutPacket(GameOpcodes.EVENT_CHAT_NOT))
            {
                op.WriteByte(1);
                op.WriteInt(cs.LoginUID);
                op.WriteInt(cs.Nick.Length * 2);
                op.WriteUnicodeString(cs.Nick);
                op.WriteInt(0);
                op.WriteInt(0);
                op.WriteInt(-1);
                op.WriteInt(ChatLen);
                op.WriteUnicodeString(Chat);
                op.WriteInt(0);
                op.WriteInt(0);

                // 채널에 있는 모든 유저중 같은 방 (null이면 로비실이니까.)
                foreach (ClientSession u in UsersList)
                {
                    if (u.CurrentRoom == cs.CurrentRoom)
                    {
                        op.Assemble(u.CRYPT_KEY, u.CRYPT_HMAC, u.CRYPT_PREFIX, u.CRYPT_COUNT);
                        u.Send(op);
                        op.CancelAssemble(); // 버퍼 되돌리기
                    }
                }
            }
        }
Esempio n. 5
0
        public void OnJoinRoom(ClientSession cs, InPacket ip)
        {
            ip.ReadByte(); // 0
            ip.ReadByte(); // 0
            ip.ReadByte(); // 0
            ip.ReadByte(); // 0
            ushort RoomID  = ip.ReadUShort();
            int    PassLen = ip.ReadInt();
            string Pass    = "";

            if (PassLen > 0)
            {
                Pass = ip.ReadUnicodeString(PassLen);
            }
            //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM ID: "+RoomID);
            //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Length Password: "******"ROOM INFO:").LogInfo("ROOM Password: "******"Main").LogInfo(" Sergio Dean {0} metade Kana {1} {2} uma determinada ranhura ({3}, {4})", Team1, Team2, pos, EmptyPos1, EmptyPos2);

            // 방 슬롯에 정보 입력
            room.Slot[pos].Active = true;
            room.Slot[pos].cs     = cs;
            room.Slot[pos].Open   = false;
            room.Slot[pos].Spree  = 0;
            room.Slot[pos].Leader = false;
            room.Slot[pos].AFK    = false;

            // 유저한테 방 입력
            cs.CurrentRoom = room;

            // 방에 있는 사람들한테 입장했다고 알려준다. (입장하는놈은 제외)
            using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_BROAD))
            {
                oPacket.WriteInt(cs.Login.Length * 2);
                oPacket.WriteUnicodeString(cs.Login);
                oPacket.WriteInt(cs.LoginUID);
                oPacket.WriteInt(cs.Nick.Length * 2);
                oPacket.WriteUnicodeString(cs.Nick);
                oPacket.WriteInt(pos);
                oPacket.WriteByte((byte)cs.CurrentChar);
                oPacket.WriteHexString("00 FF 00 FF 00 FF 00 00 00 00");
                oPacket.WriteByte((byte)(pos / 3)); // 팀을 구하면 됨. 빠르게 처리하기 위해서
                oPacket.WriteHexString("01 00 00 00 0D 00 00 00 00 10 F4 00 00 00 00 00 4E 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5F 00 00 00 00 00 00 00 00 00 00 00");
                if (room.GetRoomLeaderCS() == cs)
                {
                    oPacket.WriteByte(1);
                }
                else
                {
                    oPacket.WriteByte(0);
                }
                oPacket.WriteHexString("01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");

                oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length);
                for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++)
                {
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType);
                    //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].CharType);
                    oPacket.WriteInt(0);
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Promotion);
                    //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].Promotion);
                    oPacket.WriteInt(0);
                    oPacket.WriteByte(0);
                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Exp);
                    //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].Exp);
                    oPacket.WriteByte(0);
                    oPacket.WriteByte(0);
                    oPacket.WriteByte(0);
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Level);
                    //LogFactory.GetLog("ROOM INFO:").LogInfo("ROOM Chartype: " + cs.MyCharacter.MyChar[i].Level);
                    oPacket.WriteInt(0);
                    oPacket.WriteInt(0);

                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length);
                    for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++)
                    {
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID);
                        oPacket.WriteInt(1);
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID);
                        oPacket.WriteInt(0);
                        oPacket.WriteInt(0);
                        oPacket.WriteInt(0);
                        oPacket.WriteInt(0);
                        oPacket.WriteByte(0);
                        oPacket.WriteByte(0);
                        oPacket.WriteByte(0);
                    }

                    //oPacket.WriteHexString("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 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 01 00 00 00 00 00 00 00 00 02 00 00 00 A0 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 02 01 FF 00 00 00 00 01 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 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07");
                    // 이 패킷이 아래 끝까지 분리됐음. ▼▼
                    oPacket.WriteHexString("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 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 01 00");

                    // 장착한 스킬

                    /*
                     * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill.Length);
                     * for (int j = 0; j < cs.MyCharacter.MyChar[i].EquipSkill.Length; j++)
                     * {
                     *  oPacket.WriteInt(0);
                     *  oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillGroup);
                     *  oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillID);
                     * }*/
                    oPacket.WriteInt(0);

                    // FF가 스킬포인트일지도
                    oPacket.WriteHexString("00 00 00 FF 00 00 00 A0 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 02 00 FF 00 00 00 00 00 00");

                    // 배운 스킬

                    /*oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill.Length);
                     * for (int j = 0; j < cs.MyCharacter.MyChar[i].MySkill.Length; j++)
                     * {
                     *  oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill[j].SkillID);
                     * }*/
                    oPacket.WriteInt(0);

                    oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07");
                    // ▲▲
                }
                oPacket.WriteHexString("00 00 00 04 13 00 A8 C0 01 EC A8 C0 9B BA FE A9");
                oPacket.WriteIPFromString(cs.GetIP(), false);
                oPacket.WriteHexString("00 00 00 01 7E F6 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 E5 6A 00 00 00 01 2C BD 52 5A 00 00 00 00 01 00 00 E5 88 00 00 00 01 2C BD 52 5B 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 56 86 32 00 56 87 6E D4 00 00 00 01 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 00 00 00 00 00 00 00 01 00 00 00 00 01 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 00 00 00");

                // 방에 있는 모든 유저에게 전송해야함.
                for (int i = 0; i < 6; i++)
                {
                    // 나 자신은 제외한 나머지한테 전송
                    if (room.Slot[i].Active == true && room.Slot[i].cs != cs)
                    {
                        oPacket.Assemble(room.Slot[i].cs.CRYPT_KEY, room.Slot[i].cs.CRYPT_HMAC, room.Slot[i].cs.CRYPT_PREFIX, room.Slot[i].cs.CRYPT_COUNT);
                        room.Slot[i].cs.Send(oPacket); // 패킷 보내고
                        oPacket.CancelAssemble();      // 다시 패킷 복구
                    }
                }
            }

            // 방에 접속했다고 알려준다.
            using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_ACK))
            {
                op.WriteUShort(RoomID);
                op.WriteInt(room.RoomName.Length * 2);
                op.WriteUnicodeString(room.RoomName);
                op.WriteByte(0);
                if (room.RoomPass.Length > 0)
                {
                    op.WriteByte(1); // 비밀방
                }
                else
                {
                    op.WriteByte(0); // 공개방
                }
                op.WriteInt(room.RoomPass.Length * 2);
                op.WriteUnicodeString(room.RoomPass);
                op.WriteShort((short)room.GetPlayerCount());
                op.WriteShort((short)room.GetFreeSlot());
                op.WriteHexString("00 0B");
                op.WriteByte((byte)room.GameCategory);
                op.WriteInt(room.GameMode);
                op.WriteInt(room.ItemMode);
                op.WriteBool(room.RandomMap);
                op.WriteInt(room.GameMap);
                op.WriteHexString("00 00 00 0C");
                for (int i = 0; i < 6; i++)
                {
                    op.WriteBool(room.Slot[i].Open);
                }
                op.WriteHexString("FF FF FF FF 00 00 00 00 00 00 00 00 01");
                op.WriteIPFromString(Server.UDPRelayIP, true);
                op.WriteShort(Server.UDPRelayPort);
                op.WriteIPFromString(Server.TCPRelayIP, true);
                op.WriteShort(Server.TCPRelayPort);

                op.WriteHexString("01 00 01 00 00 01 2C 00 00 00 14 00 02 4B 52 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 00 00 06 01 00 00 00 00");

                op.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT);
                cs.Send(op);
            }

            room.SendJoinRoomInfoDivide(cs);
            //return;

            // 방에 입장할 수 없다.
cantjoin:
            using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_DIVIDE_ACK))
            {
                op.WriteInt(6);
                op.WriteHexString("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 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 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 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 30 00 00 00 F9 00 00 09 0D 00 00 00 00 00 00 00 00 F2 04 00 00 00 00 00 00 13 49 F4 FC 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 09 13 F2 04 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");

                op.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT);
                cs.Send(op);
            }
            //return;
        }
Esempio n. 6
0
        public void OnEquipItem(ClientSession cs, InPacket ip)
        {
            int    LoginIDLen = ip.ReadInt();
            string LoginID    = ip.ReadUnicodeString(LoginIDLen);

            ip.ReadInt(); // 00 00 00 00
            byte CharNum = ip.ReadByte();

            for (byte i = 0; i < CharNum; i++)
            {
                byte TargetChar = ip.ReadByte();
                int  EquipCount = ip.ReadInt();

                int MyCharPos = -1;
                for (int t = 0; t < cs.MyCharacter.MyChar.Length; t++)
                {
                    if (cs.MyCharacter.MyChar[t].CharType == TargetChar)
                    {
                        MyCharPos = t;
                    }
                }

                // 내가 가진 캐릭터 목록에 없다
                if (MyCharPos == -1)
                {
                    continue;
                }

                //Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, EquipCount);
                int len = cs.MyCharacter.MyChar[MyCharPos].Equip.Length;
                for (int j = 0; j < EquipCount; j++)
                {
                    int kind   = 0;
                    int ItemID = ip.ReadInt();
                    ip.ReadInt();  // 00 00 00 01
                    int ItemUID = ip.ReadInt();
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadByte(); // 00 00 00
                    ip.ReadByte(); //
                    ip.ReadByte(); //

                    /*
                     * helm 0
                     * upper 1
                     * lower 2
                     * Weapon 3
                     * gloves 8
                     * shoes 9
                     * Circlet 10
                     * Wings 12
                     * Mask 11
                     * cloak 13
                     * Stompers 14
                     * Shields 15
                     */
                    DataSet ds3 = new DataSet();
                    Database.Query(ref ds3, "SELECT   `Kind` FROM  `gc`.`goodsinfolist` WHERE `GoodsID` = '{0}'", ItemID);
                    if (ds3.Tables[0].Rows.Count == 0)
                    {
                        LogFactory.GetLog("EQUIPS").LogWarning("ITEM NAO EXISTE!");
                        kind = 0;
                    }
                    else
                    {
                        kind = Convert.ToInt32(ds3.Tables[0].Rows[0]["Kind"].ToString());
                    }
                    int type = 0;
                    if (kind == 0)
                    {
                        type = 0;
                    }
                    if (kind == 1)
                    {
                        type = 1;
                    }
                    if (kind == 2)
                    {
                        type = 2;
                    }
                    if (kind == 3)
                    {
                        type = 3;
                    }
                    if (kind == 8)
                    {
                        type = 4;
                    }
                    if (kind == 9)
                    {
                        type = 5;
                    }
                    if (kind == 13)
                    {
                        type = 6;
                    }
                    //cs.MyCharacter.MyChar[MyCharPos].Equip[j].ItemID = ItemID;
                    DataSet ds2 = new DataSet();
                    Database.Query(ref ds2, "SELECT itemID FROM gc.equipment WHERE LoginUID = '{0}' AND CharType = '{1}' AND ItemUID = '{2}'", cs.LoginUID, MyChar[MyCharPos].CharType, ItemUID);
                    if (ds2.Tables[0].Rows.Count == 0)
                    {
                        DataSet ds = new DataSet();
                        Database.Query(ref ds, "INSERT INTO gc.equipment ( LoginUID, CharType, ItemType, ItemID,ItemUID) VALUES ( '{0}', '{1}', '{2}', '{3}' ,'{4}')", cs.LoginUID, MyChar[MyCharPos].CharType, type, ItemID, ItemUID);
                    }
                    else
                    {
                        DataSet ds = new DataSet();
                        Database.Query(ref ds, "UPDATE   `gc`.`equipment` SET  `ItemID` = '{0}' WHERE `LoginUID` = '{1}'   AND `CharType` = '{2}'   AND `ItemType` = '{3}'", ItemID, cs.LoginUID, MyChar[MyCharPos].CharType, type);
                    }
                    if (EquipCount > len)
                    {
                        for (int k = 0; k < EquipCount; k++)
                        {
                            len++;
                        }
                    }
                    LogFactory.GetLog("EQUIPAMENTOS").LogInfo("ATUAL TYPE: " + type);
                    if (type > len)
                    {
                        for (int h = 0; h < type; h++)
                        {
                            type--;
                            LogFactory.GetLog("EQUIPAMENTOS").LogInfo("ATUAL TYPE: " + type);
                        }
                    }
                    Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, len);
                    cs.MyCharacter.MyChar[MyCharPos].TotalEquips++;
                    LogFactory.GetLog("EQUIPS").LogInfo("TOTAL: " + cs.MyCharacter.MyChar[MyCharPos].TotalEquips);
                    cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemID  = ItemID;
                    cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemUID = ItemUID;

                    //Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, EquipCount++);

                    /*cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemID = ItemID;
                     * cs.MyCharacter.MyChar[MyCharPos].Equip[type].ItemUID = ItemUID;*/
                }

                // 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 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                ip.Skip(99);
            }

            // 패킷 구조 똑같이 보내면 된다.
            using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD))
            {
                oPacket.WriteInt(cs.Login.Length * 2);
                oPacket.WriteUnicodeString(cs.Login);
                oPacket.WriteInt(0);
                oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length);

                for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++)
                {
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType);
                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length);
                    for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++)
                    {
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID);
                        oPacket.WriteInt(1);
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID);
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteByte(); // 00 00 00
                        oPacket.WriteByte(); //
                        oPacket.WriteByte(); //
                    }

                    // 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 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                    oPacket.Skip(99);
                }

                oPacket.WriteInt(0); // 그냥

                oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT);
                cs.Send(oPacket);
            }

            if (cs.CurrentRoom == null)
            {
                return;
            }

            using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD))
            {
                oPacket.WriteInt(cs.Login.Length);
                oPacket.WriteUnicodeString(cs.Login);

                oPacket.WriteByte(2); // ???

                oPacket.WriteInt(cs.MyCharacter.MyChar.Length);
                for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++)
                {
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType);
                    oPacket.WriteInt(0); // 00 00 00 00
                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length);
                    for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++)
                    {
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID);
                        oPacket.WriteInt(1);
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID);
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteByte(); // 00 00 00
                        oPacket.WriteByte(); //
                        oPacket.WriteByte(); //
                    }

                    oPacket.Skip(61);
                    oPacket.WriteHexString("FF FF");
                    oPacket.Skip(32);
                    oPacket.WriteInt(cs.LoginUID);
                }

                for (int i = 0; i < 6; i++)
                {
                    if (cs.CurrentRoom.Slot[i].Active == true)
                    {
                        oPacket.CompressAndAssemble(cs.CurrentRoom.Slot[i].cs.CRYPT_KEY, cs.CurrentRoom.Slot[i].cs.CRYPT_HMAC, cs.CurrentRoom.Slot[i].cs.CRYPT_PREFIX, cs.CurrentRoom.Slot[i].cs.CRYPT_COUNT);
                        cs.CurrentRoom.Slot[i].cs.Send(oPacket);
                        oPacket.CancelAssemble();
                    }
                }
            }
        }
Esempio n. 7
0
        public void OnEquipItem(ClientSession cs, InPacket ip)
        {
            int    LoginIDLen = ip.ReadInt();
            string LoginID    = ip.ReadUnicodeString(LoginIDLen);

            ip.ReadInt(); // 00 00 00 00
            byte CharNum = ip.ReadByte();

            for (byte i = 0; i < CharNum; i++)
            {
                byte TargetChar = ip.ReadByte();
                int  EquipCount = ip.ReadInt();

                int MyCharPos = -1;
                for (int t = 0; t < cs.MyCharacter.MyChar.Length; t++)
                {
                    if (cs.MyCharacter.MyChar[t].CharType == TargetChar)
                    {
                        MyCharPos = t;
                    }
                }

                // 내가 가진 캐릭터 목록에 없다
                if (MyCharPos == -1)
                {
                    continue;
                }

                Array.Resize(ref cs.MyCharacter.MyChar[MyCharPos].Equip, EquipCount);

                for (int j = 0; j < EquipCount; j++)
                {
                    int ItemID = ip.ReadInt();
                    ip.ReadInt();  // 00 00 00 01
                    int ItemUID = ip.ReadInt();
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadInt();  // 00 00 00 00
                    ip.ReadByte(); // 00 00 00
                    ip.ReadByte(); //
                    ip.ReadByte(); //

                    cs.MyCharacter.MyChar[MyCharPos].Equip[j].ItemID  = ItemID;
                    cs.MyCharacter.MyChar[MyCharPos].Equip[j].ItemUID = ItemUID;
                }

                // 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 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                ip.Skip(99);
            }

            // 패킷 구조 똑같이 보내면 된다.
            using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD))
            {
                oPacket.WriteInt(cs.Login.Length * 2);
                oPacket.WriteUnicodeString(cs.Login);
                oPacket.WriteInt(0);
                oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length);

                for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++)
                {
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType);
                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length);
                    for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++)
                    {
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID);
                        oPacket.WriteInt(1);
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID);
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteByte(); // 00 00 00
                        oPacket.WriteByte(); //
                        oPacket.WriteByte(); //
                    }

                    // 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 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                    oPacket.Skip(99);
                }

                oPacket.WriteInt(0); // 그냥

                oPacket.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT);
                cs.Send(oPacket);
            }

            // 내가 지금 방에 입장하고 있으면 방 인원한테 장비가 바뀌었다고 알려준다.
            if (cs.CurrentRoom == null)
            {
                return;
            }

            using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_EQUIP_ITEM_BROAD))
            {
                oPacket.WriteInt(cs.Login.Length);
                oPacket.WriteUnicodeString(cs.Login);

                oPacket.WriteByte(2); // ???

                oPacket.WriteInt(cs.MyCharacter.MyChar.Length);
                for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++)
                {
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType);
                    oPacket.WriteInt(0); // 00 00 00 00
                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length);
                    for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++)
                    {
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID);
                        oPacket.WriteInt(1);
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID);
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteInt();  // 00 00 00 00
                        oPacket.WriteByte(); // 00 00 00
                        oPacket.WriteByte(); //
                        oPacket.WriteByte(); //
                    }

                    oPacket.Skip(61);
                    oPacket.WriteHexString("FF FF");
                    oPacket.Skip(32);
                    oPacket.WriteInt(cs.LoginUID);
                }

                // 방에 있는 모든 유저에게 전송해야함.
                for (int i = 0; i < 6; i++)
                {
                    if (cs.CurrentRoom.Slot[i].Active == true)
                    {
                        oPacket.CompressAndAssemble(cs.CurrentRoom.Slot[i].cs.CRYPT_KEY, cs.CurrentRoom.Slot[i].cs.CRYPT_HMAC, cs.CurrentRoom.Slot[i].cs.CRYPT_PREFIX, cs.CurrentRoom.Slot[i].cs.CRYPT_COUNT);
                        cs.CurrentRoom.Slot[i].cs.Send(oPacket); // 패킷 보내고
                        oPacket.CancelAssemble();                // 다시 패킷 복구
                    }
                }
            }
        }
Esempio n. 8
0
        public void OnJoinRoom(ClientSession cs, InPacket ip)
        {
            ip.ReadByte(); // 0
            ip.ReadByte(); // 0
            ip.ReadByte(); // 0
            ushort RoomID  = ip.ReadUShort();
            int    PassLen = ip.ReadInt();
            string Pass    = "";

            if (PassLen > 0)
            {
                Pass = ip.ReadUnicodeString(PassLen);
            }


            Room room = GetRoom(RoomID);


            if (room == null)
            {
                goto cantjoin;
            }


            if (room.GetFreeSlot() == 0 || room.Playing == true || cs.CurrentRoom != null)
            {
                goto cantjoin;
            }


            if (room.RoomPass != Pass)
            {
                goto cantjoin;
            }


            byte Team1 = 0, Team2 = 0;
            int  EmptyPos1 = -1, EmptyPos2 = -1;

            for (int i = 0; i < 3; i++)
            {
                if (room.Slot[i].Active == true)
                {
                    Team1++;
                }
                if (EmptyPos1 == -1 && room.Slot[i].Open == true)
                {
                    EmptyPos1 = i;
                }
            }
            for (int i = 3; i < 6; i++)
            {
                if (room.Slot[i].Active == true)
                {
                    Team2++;
                }
                if (EmptyPos2 == -1 && room.Slot[i].Open == true)
                {
                    EmptyPos2 = i;
                }
            }


            int pos = EmptyPos1;

            if (Team1 >= Team2)
            {
                pos = EmptyPos2;
            }

            room.Slot[pos].Active = true;
            room.Slot[pos].cs     = cs;
            room.Slot[pos].Open   = false;
            room.Slot[pos].Spree  = 0;
            room.Slot[pos].Leader = false;
            room.Slot[pos].AFK    = false;


            cs.CurrentRoom = room;


            using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_BROAD))
            {
                oPacket.WriteInt(cs.Login.Length * 2);
                oPacket.WriteUnicodeString(cs.Login);
                oPacket.WriteInt(cs.LoginUID);
                oPacket.WriteInt(cs.Nick.Length * 2);
                oPacket.WriteUnicodeString(cs.Nick);
                oPacket.WriteInt(pos);
                oPacket.WriteByte((byte)cs.CurrentChar);
                oPacket.WriteHexString("00 FF 00 FF 00 FF 00 00 00 00");
                oPacket.WriteByte((byte)(pos / 3));
                oPacket.WriteHexString("01 00 00 00 0D 00 00 00 00 10 F4 00 00 00 00 00 4E 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 54 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5F 00 00 00 00 00 00 00 00 00 00 00");
                if (room.GetRoomLeaderCS() == cs)
                {
                    oPacket.WriteByte(1);
                }
                else
                {
                    oPacket.WriteByte(0);
                }
                oPacket.WriteHexString("01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");

                oPacket.WriteByte((byte)cs.MyCharacter.MyChar.Length);
                for (int i = 0; i < cs.MyCharacter.MyChar.Length; i++)
                {
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].CharType);
                    oPacket.WriteInt(0);
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Promotion);
                    oPacket.WriteInt(0);
                    oPacket.WriteByte(0);
                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Exp);
                    oPacket.WriteByte(0);
                    oPacket.WriteByte(0);
                    oPacket.WriteByte(0);
                    oPacket.WriteByte((byte)cs.MyCharacter.MyChar[i].Level);
                    oPacket.WriteInt(0);
                    oPacket.WriteInt(0);

                    oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip.Length);
                    for (int j = 0; j < cs.MyCharacter.MyChar[i].Equip.Length; j++)
                    {
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemID);
                        oPacket.WriteInt(1);
                        oPacket.WriteInt(cs.MyCharacter.MyChar[i].Equip[j].ItemUID);
                        oPacket.WriteInt(0);
                        oPacket.WriteInt(0);
                        oPacket.WriteInt(0);
                        oPacket.WriteInt(0);
                        oPacket.WriteByte(0);
                        oPacket.WriteByte(0);
                        oPacket.WriteByte(0);
                    }

                    //oPacket.WriteHexString("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 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 01 00 00 00 00 00 00 00 00 02 00 00 00 A0 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 02 01 FF 00 00 00 00 01 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 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07");

                    oPacket.WriteHexString("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 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 01 00");


                    /*
                     * oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill.Length);
                     * for (int j = 0; j < cs.MyCharacter.MyChar[i].EquipSkill.Length; j++)
                     * {
                     *  oPacket.WriteInt(0);
                     *  oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillGroup);
                     *  oPacket.WriteInt(cs.MyCharacter.MyChar[i].EquipSkill[j].SkillID);
                     * }*/
                    oPacket.WriteInt(0);


                    oPacket.WriteHexString("00 00 00 FF 00 00 00 A0 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 02 00 FF 00 00 00 00 00 00");


                    /*oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill.Length);
                     * for (int j = 0; j < cs.MyCharacter.MyChar[i].MySkill.Length; j++)
                     * {
                     *  oPacket.WriteInt(cs.MyCharacter.MyChar[i].MySkill[j].SkillID);
                     * }*/
                    oPacket.WriteInt(0);

                    oPacket.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 2C 00 00 01 2C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07");
                }
                oPacket.WriteHexString("00 00 00 04 13 00 A8 C0 01 EC A8 C0 9B BA FE A9");
                oPacket.WriteIPFromString(cs.GetIP(), false);
                oPacket.WriteHexString("00 00 00 01 7E F6 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 E5 6A 00 00 00 01 2C BD 52 5A 00 00 00 00 01 00 00 E5 88 00 00 00 01 2C BD 52 5B 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 56 86 32 00 56 87 6E D4 00 00 00 01 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 00 00 00 00 00 00 00 01 00 00 00 00 01 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 00 00 00");


                for (int i = 0; i < 6; i++)
                {
                    if (room.Slot[i].Active == true && room.Slot[i].cs != cs)
                    {
                        oPacket.Assemble(room.Slot[i].cs.CRYPT_KEY, room.Slot[i].cs.CRYPT_HMAC, room.Slot[i].cs.CRYPT_PREFIX, room.Slot[i].cs.CRYPT_COUNT);
                        room.Slot[i].cs.Send(oPacket);
                        oPacket.CancelAssemble();
                    }
                }
            }


            using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_ACK))
            {
                op.WriteUShort(RoomID);
                op.WriteInt(room.RoomName.Length * 2);
                op.WriteUnicodeString(room.RoomName);
                op.WriteByte(0);
                if (room.RoomPass.Length > 0)
                {
                    op.WriteByte(1);
                }
                else
                {
                    op.WriteByte(0);
                }
                op.WriteInt(room.RoomPass.Length * 2);
                op.WriteUnicodeString(room.RoomPass);
                op.WriteShort((short)room.GetPlayerCount());
                op.WriteShort((short)room.GetFreeSlot());
                op.WriteHexString("00 0B");
                op.WriteByte((byte)room.GameCategory);
                op.WriteInt(room.GameMode);
                op.WriteInt(room.ItemMode);
                op.WriteBool(room.RandomMap);
                op.WriteInt(room.GameMap);
                op.WriteHexString("00 00 00 0C");
                for (int i = 0; i < 6; i++)
                {
                    op.WriteBool(room.Slot[i].Open);
                }
                op.WriteHexString("FF FF FF FF 00 00 00 00 00 00 00 00 01");
                op.WriteIPFromString(Server.UDPRelayIP, true);
                op.WriteShort(Server.UDPRelayPort);
                op.WriteIPFromString(Server.TCPRelayIP, true);
                op.WriteShort(Server.TCPRelayPort);

                op.WriteHexString("01 00 01 00 00 01 2C 00 00 00 14 00 02 4B 52 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 00 00 06 01 00 00 00 00");

                op.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT);
                cs.Send(op);
            }

            room.SendJoinRoomInfoDivide(cs);
            return;


cantjoin:
            using (OutPacket op = new OutPacket(GameOpcodes.EVENT_JOIN_ROOM_INFO_DIVIDE_ACK))
            {
                op.WriteInt(6);
                op.WriteHexString("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 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 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 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 30 00 00 00 F9 00 00 09 0D 00 00 00 00 00 00 00 00 F2 04 00 00 00 00 00 00 13 49 F4 FC 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 09 13 F2 04 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");

                op.CompressAndAssemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, cs.CRYPT_COUNT);
                cs.Send(op);
            }
            return;
        }