Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketSimpleCape"/> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketSimpleCape(IL2RPacket packet)
 {
     CapeInfoID            = packet.ReadUInt32();
     CapeLevel             = packet.ReadUInt16();
     ColorSymbolInfoID     = packet.ReadUInt32();
     ColorBackgroundInfoID = packet.ReadUInt32();
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketPartyEmblem"/> class.
        /// </summary>
        /// <param name="packet">The packet.</param>
        public PacketPartyEmblem(IL2RPacket Packet)
        {
            L2RPacket packet = (L2RPacket)Packet;

            PartyName = packet.ReadString();
            Bool      = packet.ReadByte();
        }
Beispiel #3
0
        /// <summary>
        /// Reads the single.
        /// </summary>
        /// <returns></returns>
        public static float ReadSingle(this IL2RPacket packet)
        {
            float value = BitConverter.ToSingle(packet._bytes, packet._index);

            packet._index += 4;
            return(value);
        }
Beispiel #4
0
 /// <summary>
 /// Reads the bytes.
 /// </summary>
 /// <param name="length">The length.</param>
 /// <returns></returns>
 public static byte[] ReadBytes(this IL2RPacket packet, int length)
 {
     byte[] value = new byte[length];
     Array.Copy(packet._bytes, packet._index, value, 0, length);
     packet._index += length;
     return(value);
 }
Beispiel #5
0
        /// <summary>
        /// Reads the int32.
        /// </summary>
        /// <returns></returns>
        public static int ReadInt32(this IL2RPacket packet)
        {
            int value = BitConverter.ToInt32(packet._bytes, packet._index);

            packet._index += 4;
            return(value);
        }
Beispiel #6
0
        /// <summary>
        /// Reads the byte.
        /// </summary>
        /// <returns></returns>
        public static byte ReadByte(this IL2RPacket packet)
        {
            byte value = packet._bytes[packet._index];

            packet._index += 1;
            return(value);
        }
Beispiel #7
0
        /// <summary>
        /// Reads the int64.
        /// </summary>
        /// <returns></returns>
        public static long ReadInt64(this IL2RPacket packet)
        {
            long value = BitConverter.ToInt64(packet._bytes, packet._index);

            packet._index += 8;
            return(value);
        }
Beispiel #8
0
        /// <summary>
        /// Reads the int16.
        /// </summary>
        /// <returns></returns>
        public static short ReadInt16(this IL2RPacket packet)
        {
            short value = BitConverter.ToInt16(packet._bytes, packet._index);

            packet._index += 2;
            return(value);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketGuildAgitQuestListresult" /> class.
        /// </summary>
        /// <param name="packet">The packet.</param>
        public PacketGuildAgitQuestListresult(IL2RPacket packet)
        {
            using (StreamWriter stm = new StreamWriter(@"Output\QuestList.csv", true))
            {
                stm.WriteLineAsync("QuestId,State,PlayerId,Player,Rank,CompletedAt");

                packet.Skip(2);

                byte[] unkHeader = packet.ReadBytes(4);
                uint   numQuests = packet.ReadUInt16();

                for (int i = 0; i < numQuests; i++)
                {
                    uint questId = packet.ReadUInt32();

                    byte[] unk = packet.ReadBytes(4);

                    string   state         = Enum.QuestState.Enum(packet.ReadByte());
                    ulong    playerId      = packet.ReadUInt64();
                    string   player        = packet.ReadString();
                    string   rank          = CSV.guildMemberGrade.guildMemberGradeName(packet.ReadByte());
                    DateTime completedTime = DateTime.Now;//packet.ReadDate();

                    stm.WriteLineAsync(questId + "," + state + "," + playerId + "," + player + "," + rank + "," + completedTime);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketAchievement" /> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketAchievement(IL2RPacket packet)
 {
     EAchievementType  = packet.ReadByte();
     AchievementInfoID = packet.ReadUInt32();
     EAchievementState = packet.ReadByte();
     TaskParam         = packet.ReadUInt32();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketItemList" /> class.
        /// </summary>
        /// <param name="packet">The packet.</param>
        public PacketItemList(IL2RPacket packet)
        {
            PacketReader pckt = (PacketReader)packet;

            BagCount      = pckt.ReadUInt16();
            BagType       = pckt.ReadByte();
            MaxInvenSize  = pckt.ReadUInt16();
            ExpInvenSize  = pckt.ReadUInt16();
            UsedInvenSize = pckt.ReadUInt16();

            for (int j = 0; j < UsedInvenSize; j++)
            {
                UItemID           = pckt.ReadUInt64();
                ItemID            = Enum.Item.Enum(pckt.ReadUInt32());
                Exp               = pckt.ReadUInt32();
                Level             = pckt.ReadByte();
                EnchantLevel      = pckt.ReadByte();
                LimitBreakCount   = pckt.ReadByte();
                LimitBreakAddRate = pckt.ReadByte();
                Count             = pckt.ReadUInt16();
                Liked             = pckt.ReadByte();
                LootedTime        = pckt.ReadDate();
                BasicOptionLength = pckt.ReadUInt16();

                for (int k = 0; BasicOptionLength > k; k++)
                {
                    string ItemOption = CSV.itemOption.itemOptionName(pckt.ReadInt32());
                    uint   IOvalue    = pckt.ReadUInt32();
                    BasicOption[k] = "\"" + ItemOption + "(+" + IOvalue + ")\"";
                }

                SocketListLength = pckt.ReadUInt16();
                for (int k = 0; SocketListLength > k; k++)
                {
                    ulong  SoulCrystalID    = pckt.ReadUInt64();
                    string SoulCrystalName  = Enum.Item.Enum(pckt.ReadUInt32());
                    int    SoulCrystalEXP   = pckt.ReadInt32();
                    byte   SoulCrystalLevel = pckt.ReadByte();
                    ushort SoulCrystalCount = pckt.ReadUInt16();
                    for (int i = 0; i < SoulCrystalCount; i++)
                    {
                        string ItemOption = CSV.itemOption.itemOptionName(pckt.ReadInt32());
                        uint   IOvalue    = pckt.ReadUInt32();
                    }
                    SocketList[k] = "\"" + SoulCrystalName + "\"";
                }

                Bind                  = pckt.ReadByte();
                AbilityLevel          = pckt.ReadByte();
                AbilityUpgradeAddRate = pckt.ReadUInt16();
                CraftFlag             = pckt.ReadByte();
                EventPeriodID         = pckt.ReadUInt32();
                ExpireTime            = pckt.ReadUInt64();
                if (EnchantLevel > 0)
                {
                    EnchantLevelPlus = "+" + EnchantLevel + " ";
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketSimpleEquipment"/> class.
        /// </summary>
        /// <param name="packet">The packet.</param>
        public PacketSimpleEquipment(IL2RPacket Packet)
        {
            L2RPacket packet = (L2RPacket)Packet;

            ItemInfoID   = packet.ReadUInt32();
            EnchantLevel = packet.ReadByte();
            byte tmpUnk = packet.ReadByte();
        }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StatusMovement" /> class.
 /// </summary>
 /// <param name="Packet">The packet.</param>
 public PacketStatusMovement(IL2RPacket Packet)
 {
     packet         = (L2RPacket)Packet;
     playerId       = packet.ReadUInt64();
     playerMoveType = packet.ReadUInt16();
     playerDestXpos = packet.ReadSingle();
     playerDestYpos = packet.ReadSingle();
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketBuffInfo" /> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketBuffInfo(IL2RPacket packet)
 {
     // All of this is wrong but works to get past it.
     SkillUID   = packet.ReadUInt64();
     SkillID    = packet.ReadUInt32();
     BuffID     = packet.ReadUInt32();
     BuffLv     = packet.ReadUInt32();
     StackCount = packet.ReadUInt16();
     EndTime    = packet.ReadUInt64();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketPlayerGuild" /> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketPlayerGuild(IL2RPacket packet)
 {
     GuildID                = packet.ReadUInt64();
     GuildMembersGrade      = packet.ReadByte();
     GuildName              = packet.ReadString();
     EmblemSymbolInfoID     = packet.ReadUInt32();
     EmblemBackgroundInfoID = packet.ReadUInt32();
     OccupyTitleInfoID      = packet.ReadUInt32();
     CastleType             = packet.ReadByte();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketPKMode"/> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketPKMode(IL2RPacket packet)
 {
     PkStatus  = packet.ReadByte();
     Monster   = packet.ReadByte();
     Guild     = packet.ReadByte();
     Alliance  = packet.ReadByte();
     Friends   = packet.ReadByte();
     EtcPlayer = packet.ReadByte();
     BadPlayer = packet.ReadByte();
 }
Beispiel #17
0
        public static void TypePacket(PacketReader packet, ushort packetID)
        {
            /*
             *
             * L2RPacket IDs for version: 1.04.16      2018-05-08
             *
             * Currently all packet parsers have been disabled due
             * to changes. Parsers need to be tested and possibly
             * modified before they will work again.
             *
             */

            Console.Write("PacketID: " + packetID.ToString("X") + "\tLength: " + packet.Remaining);
            //Packet Handler for PacketID
            switch (packetID)
            {
            case 203:                                      // 0xCC
                result = new PacketStatusMovement(packet); //"PktPlayerMoveListNotify";
                break;

                //default:
                //    result = "(InvalidPacket)";
                //    break;
            }

            Directory.CreateDirectory(@"Packets");
            string filename = @"Packets\" + result + "-" + packet.Remaining + ".dat";

            using (FileStream SourceStream = File.Open(filename, FileMode.OpenOrCreate))
            {
                SourceStream.Seek(0, SeekOrigin.End);
                SourceStream.WriteAsync(packet._bytes, 0, packet._bytes.Length);
            }

            //using (FileStream fileStream = new FileStream(@"Packets\" + result + "(" + packet.Remaining + ").dat", FileMode.Append, FileAccess.Write, FileShare.Write))
            //{
            //    // Test may not work at all

            //    packet.SetIndex(0);
            //    byte[] length = BitConverter.GetBytes(packet.Remaining + 5);
            //    byte[] PackID = BitConverter.GetBytes(packetID);
            //    fileStream.WriteByte(length[0]);
            //    fileStream.WriteByte(length[1]);
            //    fileStream.WriteByte(0);
            //    fileStream.WriteByte(PackID[0]);
            //    fileStream.WriteByte(PackID[1]);
            //    // End Test
            //    for (int j = 0; j < packet.Remaining;)
            //    {
            //        fileStream.WriteByte(packet.ReadByte());
            //    }
            //}

            Console.Write("\tPacketType: " + result + "\n");
        }
        public PacketChatPartyWriteResult(IL2RPacket packet)
        {
            //packet.Skip(2);

            ushort numMessages = packet.ReadUInt16();

            for (int i = 0; i < numMessages; i++)
            {
                ChatList.Add(new PacketChat(packet));
            }
        }
Beispiel #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketBagInfo"/> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketBagInfo(IL2RPacket packet)
 {
     Type             = packet.ReadByte();
     EnabledSlotCount = packet.ReadUInt16();
     ExpandedCount    = packet.ReadUInt16();
     ItemCount        = packet.ReadUInt16();
     for (int j = 0; j < ItemCount; j++)
     {
         ItemList.Add(new PacketItem(packet));
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketBagListReadResult"/> class.
        /// </summary>
        /// <param name="packet">The packet.</param>
        public PacketBagListReadResult(IL2RPacket packet)
        {
            packet.Skip(2);

            ushort BagCount = packet.ReadUInt16();

            for (int i = 0; i < BagCount; i++)
            {
                BagInfoList.Add(new PacketBagInfo(packet));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketGroundObjectInfo"/> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketGroundObjectInfo(IL2RPacket packet)
 {
     GroundObjectUID = packet.ReadUInt64();
     GroundObjectID  = packet.ReadUInt32();
     SkillInfoID     = packet.ReadUInt32();
     OwnerUID        = packet.ReadUInt64();
     XPos            = packet.ReadSingle();
     YPos            = packet.ReadSingle();
     ZPos            = packet.ReadSingle();
     Direction       = packet.ReadSingle();
     ElapsedTime     = packet.ReadUInt32();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketGadget"/> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketGadget(IL2RPacket packet)
 {
     GadgetUID   = packet.ReadUInt64();
     GadgetID    = packet.ReadUInt32();
     XPos        = packet.ReadSingle();
     YPos        = packet.ReadSingle();
     ZPos        = packet.ReadSingle();
     Direction   = packet.ReadSingle();
     Active      = packet.ReadByte();
     OwnerName   = packet.ReadString();//This is a guess
     RemainCount = packet.ReadUInt32();
 }
Beispiel #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PacketChatGuildWriteResult"/> class.
        /// </summary>
        /// <param name="packet">The packet.</param>
        public PacketChatGuildWriteResult(IL2RPacket packet)
        {
            packet.Skip(2);

            LastChatID  = packet.ReadUInt64();
            numMessages = packet.ReadUInt16();

            for (int i = 0; i < numMessages; i++)
            {
                ChatList.Add(new PacketChat(packet));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketItemSocket" /> class.
 /// </summary>
 /// <param name="packet">The packet.</param>
 public PacketItemSoulCrystal(IL2RPacket packet)
 {
     SoulCrystalID    = packet.ReadUInt64();
     SoulCrystalName  = Enum.Item.Enum(packet.ReadUInt32());
     SoulCrystalEXP   = packet.ReadInt32();
     SoulCrystalLevel = packet.ReadByte();
     SoulCrystalCount = packet.ReadUInt16();
     for (int i = 0; i < SoulCrystalCount; i++)
     {
         ItemOptionList.Add(new PacketItemOption(packet));
     }
 }
Beispiel #25
0
        public PacketSightEnterNotify(IL2RPacket packet)
        {
            UInt16 PlayerCount = packet.ReadUInt16();

            for (int i = 0; i < PlayerCount; i++)
            {
                Players.Add(new PacketOtherPlayer(packet));
            }

            UInt16 NPCCount = packet.ReadUInt16();

            for (int i = 0; i < NPCCount; i++)
            {
                //PktNpcCreateInfo.Packet(packet);
            }

            UInt16 ProjectileCount = packet.ReadUInt16();

            for (int i = 0; i < ProjectileCount; i++)
            {
                //PktProjectileInfo.Packet(packet);
            }

            UInt16 GroundObjectCount = packet.ReadUInt16();

            for (int i = 0; i < GroundObjectCount; i++)
            {
                //PktGroundObjectInfo.Packet(packet);
            }

            UInt16 GadgetCount = packet.ReadUInt16();

            for (int i = 0; i < GadgetCount; i++)
            {
                //PktGadget.Packet(packet);
            }

            UInt16 ActorOwerInfoCount = packet.ReadUInt16();

            for (int i = 0; i < ActorOwerInfoCount; i++)
            {
                //PktActorOwnerInfo.Packet(packet);
            }


            UInt16 BossNpcCombatStartTimeCount = packet.ReadUInt16();

            for (int i = 0; i < BossNpcCombatStartTimeCount; i++)
            {
                //UInt64 BossUID = packet.ReadUInt64();
                //DateTime Time = packet.ReadDate();
            }
        }
Beispiel #26
0
        /// <summary>
        /// Reads the byte.
        /// </summary>
        /// <returns></returns>
        public static byte ReadByte(this IL2RPacket packet)
        {
            byte value = 0;

            if ((packet.Bytes.Length) - 1 > (packet.Index + 1))
            {
                value = packet.Bytes[packet.Index];
            }

            packet.Index += 1;

            return(value);
        }
Beispiel #27
0
        /// <summary>
        /// Reads the bytes.
        /// </summary>
        /// <param name="length">The length.</param>
        /// <returns></returns>
        public static byte[] ReadBytes(this IL2RPacket packet, int length)
        {
            byte[] value = new byte[length];

            if ((packet.Bytes.Length - 1) >= (packet.Index + length))
            {
                Array.Copy(packet.Bytes, packet.Index, value, 0, length);
            }

            packet.Index += length;

            return(value);
        }
Beispiel #28
0
        /// <summary>
        /// Reads the int16.
        /// </summary>
        /// <returns></returns>
        public static short ReadInt16(this IL2RPacket packet)
        {
            short value = 0;

            if ((packet.Bytes.Length - 1) > (packet.Index + 2))
            {
                value = BitConverter.ToInt16(packet.Bytes, packet.Index);
            }

            packet.Index += 2;

            return(value);
        }
Beispiel #29
0
        /// <summary>
        /// Reads the int32.
        /// </summary>
        /// <returns></returns>
        public static int ReadInt32(this IL2RPacket packet)
        {
            int value = 0;

            if ((packet.Bytes.Length - 1) > (packet.Index + 4))
            {
                value = BitConverter.ToInt32(packet.Bytes, packet.Index);
            }

            packet.Index += 4;

            return(value);
        }
Beispiel #30
0
        /// <summary>
        /// Reads the int64.
        /// </summary>
        /// <returns></returns>
        public static long ReadInt64(this IL2RPacket packet)
        {
            long value = 0;

            if ((packet.Bytes.Length - 1) > (packet.Index + 8))
            {
                value = BitConverter.ToInt64(packet.Bytes, packet.Index);
            }

            packet.Index += 8;

            return(value);
        }