Exemple #1
0
 protected override void ElementRead(StreamHandler reader, int index)
 {
     if (index == -5)
         this.Unk = reader.ReadUInt32();
     else
         this.Data[-index - 1] = reader.ReadBytes(reader.ReadInt32());
 }
        public override void Read(StreamHandler reader)
        {
            Caster   = reader.ReadPackedGuid();
            SpellId  = reader.ReadUInt32();
            Duration = reader.ReadInt32();

            HaveFlags = reader.ReadBoolean();
            if (HaveFlags)
            {
                TargetFlags1 = reader.ReadUInt32();
                TargetFlags2 = reader.ReadUInt32();
            }

            Unk_HaveData2 = reader.ReadBoolean();
            if (Unk_HaveData2)
            {
                Unk_Guid1 = reader.ReadPackedGuid();
                Unk_UInt3 = reader.ReadUInt32();
                Unk_Byte  = reader.ReadByte();
                if (Unk_Byte == 2)
                {
                    Unk_Guid2 = reader.ReadPackedGuid();
                }
            }
        }
Exemple #3
0
        private UpdateFields ReadValues(StreamHandler Reader)
        {
            var values = new UpdateFields();

            byte blocksCount = Reader.ReadByte();

            int[] updatemask = new int[blocksCount];

            for (int i = 0; i < updatemask.Length; ++i)
            {
                updatemask[i] = Reader.ReadInt32();
            }

            var mask = new BitArray(updatemask);

            for (uint i = 0; i < mask.Count; ++i)
            {
                if (mask[(int)i])
                {
                    values[i] = Reader.ReadUInt32();
                }
            }

            return(values);
        }
Exemple #4
0
        public override void Read(StreamHandler reader)
        {
            this.Unit = reader.ReadPackedGuid();

            var count = reader.ReadInt32();
            this.ThreatList = new ThreatUpdatePair[count];
            for (int i = 0; i < count; ++i)
                this.ThreatList[i] = new ThreatUpdatePair { Unit = reader.ReadPackedGuid(), Threat = reader.ReadUInt32() };
        }
Exemple #5
0
 protected override void ElementRead(StreamHandler reader, int index)
 {
     if (index == -5)
     {
         this.Unk = reader.ReadUInt32();
     }
     else
     {
         this.Data[-index - 1] = reader.ReadBytes(reader.ReadInt32());
     }
 }
Exemple #6
0
        public override void Read(StreamHandler reader)
        {
            this.Unit = reader.ReadPackedGuid();

            var count = reader.ReadInt32();

            this.ThreatList = new ThreatUpdatePair[count];
            for (int i = 0; i < count; ++i)
            {
                this.ThreatList[i] = new ThreatUpdatePair {
                    Unit = reader.ReadPackedGuid(), Threat = reader.ReadUInt32()
                }
            }
            ;
        }
Exemple #7
0
        public void Read(StreamHandler Reader)
        {
            Slot  = Reader.ReadByte();
            Spell = Reader.ReadUInt32();

            Caster = Unit;

            if (Spell != 0)
            {
                Flags   = (AuraFlags)Reader.ReadUInt16();
                Level   = Reader.ReadByte();
                Charges = Reader.ReadByte();

                if ((Flags & AuraFlags.NotCaster) == 0)
                {
                    Caster = Reader.ReadPackedGuid();
                }

                if ((Flags & AuraFlags.Duration) != 0)
                {
                    MaxDuration = Reader.ReadUInt32();
                    var currentDurationMs = Reader.ReadUInt32();

                    this.AppliedTime = (uint)Environment.TickCount - currentDurationMs;
                }

                if ((Flags & AuraFlags.BasePoints) != 0)
                {
                    for (int i = 0; i < MaxEffects; ++i)
                    {
                        if ((Flags & (AuraFlags)(1 << i)) != 0)
                        {
                            BasePoints[i] = Reader.ReadInt32();
                        }
                        else
                        {
                            BasePoints[i] = 0;
                        }
                    }
                }
                else
                {
                    Array.Clear(BasePoints, 0, MaxEffects);
                }
            }
        }
Exemple #8
0
        public override void Read(StreamHandler reader)
        {
            Caster = reader.ReadPackedGuid();
            SpellId = reader.ReadUInt32();
            Duration = reader.ReadInt32();

            HaveFlags = reader.ReadBoolean();
            if (HaveFlags)
            {
                TargetFlags1 = reader.ReadUInt32();
                TargetFlags2 = reader.ReadUInt32();
            }

            Unk_HaveData2 = reader.ReadBoolean();
            if (Unk_HaveData2)
            {
                Unk_Guid1 = reader.ReadPackedGuid();
                Unk_UInt3 = reader.ReadUInt32();
                Unk_Byte = reader.ReadByte();
                if (Unk_Byte == 2)
                    Unk_Guid2 = reader.ReadPackedGuid();
            }
        }
Exemple #9
0
        public static StreamHandler DecompressBlock(this StreamHandler reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            int uncompressedLength = reader.ReadInt32();

            if (uncompressedLength == 0)
            {
                return(new StreamHandler(new byte[0]));
            }

            reader.Skip(2);
            byte[] compressedBytes = reader.ReadBytes((int)reader.RemainingLength);

            byte[] uncompressedBytes = new byte[uncompressedLength];
            using (var stream = new MemoryStream(compressedBytes))
                using (var dStream = new DeflateStream(stream, CompressionMode.Decompress, true))
                    dStream.Read(uncompressedBytes, 0, uncompressedLength);

            return(new StreamHandler(uncompressedBytes));
        }
Exemple #10
0
        protected override void InternalParse()
        {
            int    row;
            int    size;
            DB2Ids type;

            Output.AppendLine("Data Size: " + (size = Reader.ReadInt32()));
            byte[] data = Reader.ReadBytes(size);

            Output.AppendLine("Type: " + (type = (DB2Ids)Reader.ReadUInt32()));
            Output.AppendLine("Row: " + (row = Reader.ReadInt32()));
            Output.AppendLine("Time(?): " + Reader.ReadUInt32().AsUnixTime());
            Output.AppendLine();

            if (row < 0)
            {
                return;
            }

            using (var dataReader = new StreamHandler(data))
            {
                if (type == DB2Ids.Item)
                {
                    Output.AppendLine("Item Id: " + dataReader.ReadUInt32());
                    Output.AppendLine("Class: " + (ItemClass)dataReader.ReadUInt32());
                    Output.AppendLine("SubClass: " + (ItemSubClass)dataReader.ReadUInt32());
                    Output.AppendLine("Unk -1: " + dataReader.ReadInt32());
                    Output.AppendLine("Material: " + (Material)dataReader.ReadUInt32());
                    Output.AppendLine("Display Id: " + dataReader.ReadUInt32());
                    Output.AppendLine("Inventory Type: " + (InventorySlot)dataReader.ReadUInt32());
                    Output.AppendLine("Sheath: " + dataReader.ReadUInt32());
                }
                else if (type == DB2Ids.ItemSparse)
                {
                    Output.AppendLine("id: " + dataReader.ReadInt32());
                    Output.AppendLine("quality: " + (ItemQuality)dataReader.ReadInt32());
                    Output.AppendLine("flags: " + dataReader.ReadUInt32());
                    Output.AppendLine("flags2: " + dataReader.ReadUInt32());
                    Output.AppendLine("4.3.2 float1: " + dataReader.ReadSingle()); // 0.95-1.05
                    Output.AppendLine("4.3.2 float2: " + dataReader.ReadSingle()); // 0, 1, 4, huge
                    Output.AppendLine("4.3.2 int: " + dataReader.ReadUInt32());    // stack count
                    Output.AppendLine("buyprice: " + dataReader.ReadInt32());
                    Output.AppendLine("sellprice: " + dataReader.ReadInt32());
                    Output.AppendLine("inventorytype: " + dataReader.ReadInt32());
                    Output.AppendLine("allowableclass: " + dataReader.ReadInt32());
                    Output.AppendLine("allowablerace: " + dataReader.ReadInt32());
                    Output.AppendLine("itemlevel: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredlevel: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredskill: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredskillrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredspell: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredhonorrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredcityrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredreputationfaction: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredreputationrank: " + dataReader.ReadInt32());
                    Output.AppendLine("maxcount: " + dataReader.ReadInt32());
                    Output.AppendLine("stackable: " + dataReader.ReadInt32());
                    Output.AppendLine("containerslots: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_10: " + dataReader.ReadInt32());
                    Output.AppendLine("scalingstatdistribution: " + dataReader.ReadInt32());
                    Output.AppendLine("damagetype: " + dataReader.ReadInt32());
                    Output.AppendLine("delay: " + dataReader.ReadInt32());
                    Output.AppendLine("rangedmodrange: " + dataReader.ReadSingle());
                    Output.AppendLine("spellid_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_5: " + dataReader.ReadInt32());
                    Output.AppendLine("bonding: " + dataReader.ReadInt32());
                    Output.AppendLine("name: " + dataReader.ReadPascalString16());
                    Output.AppendLine("name2: " + dataReader.ReadPascalString16());
                    Output.AppendLine("name3: " + dataReader.ReadPascalString16());
                    Output.AppendLine("name4: " + dataReader.ReadPascalString16());
                    Output.AppendLine("description: " + dataReader.ReadPascalString16());
                    Output.AppendLine("pagetext: " + dataReader.ReadInt32());
                    Output.AppendLine("languageid: " + dataReader.ReadInt32());
                    Output.AppendLine("pagematerial: " + dataReader.ReadInt32());
                    Output.AppendLine("startquest: " + dataReader.ReadInt32());
                    Output.AppendLine("lockid: " + dataReader.ReadInt32());
                    Output.AppendLine("material: " + dataReader.ReadInt32());
                    Output.AppendLine("sheath: " + dataReader.ReadInt32());
                    Output.AppendLine("randomproperty: " + dataReader.ReadInt32());
                    Output.AppendLine("randomsuffix: " + dataReader.ReadInt32());
                    Output.AppendLine("itemset: " + dataReader.ReadInt32());
                    Output.AppendLine("area: " + dataReader.ReadInt32());
                    Output.AppendLine("map: " + dataReader.ReadInt32());
                    Output.AppendLine("bagfamily: " + dataReader.ReadInt32());
                    Output.AppendLine("totemcategory: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcolor_1: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcolor_2: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcolor_3: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcontent_1: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcontent_2: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcontent_3: " + dataReader.ReadInt32());
                    Output.AppendLine("socketbonus: " + dataReader.ReadInt32());
                    Output.AppendLine("gemproperties: " + dataReader.ReadInt32());
                    Output.AppendLine("armordamagemodifier: " + dataReader.ReadSingle());
                    Output.AppendLine("duration: " + dataReader.ReadInt32());
                    Output.AppendLine("itemlimitcategory: " + dataReader.ReadInt32());
                    Output.AppendLine("holidayid: " + dataReader.ReadInt32());
                    Output.AppendLine("statscalingfactor: " + dataReader.ReadSingle());
                    Output.AppendLine("arch_field_130: " + dataReader.ReadInt32());
                    Output.AppendLine("arch_field_131: " + dataReader.ReadInt32());
                }
                else
                {
                    throw new Exception("Unknown item update type: " + type);
                }

                if (!dataReader.IsRead)
                {
                    throw new Exception("Data was not read fully, bytes still not read: " + dataReader.RemainingLength);
                }
            }
        }
Exemple #11
0
        protected override unsafe void InternalOpenForReading(Stream stream, bool closeStream)
        {
            m_isLoaded = true;

            var mainHeaderBytes = new byte[MainHeader.Size];

            stream.Read(mainHeaderBytes, 0, MainHeader.Size);

            MainHeader *mainHeader;

            fixed(byte *mainHeaderBytesPtr = mainHeaderBytes)
            {
                mainHeader = (MainHeader *)mainHeaderBytesPtr;

                m_nPackets      = mainHeader->PacketCount;
                this.StartTime  = mainHeader->StartedOnUnix.AsUnixTime();
                this.StartTicks = mainHeader->StartedOnTicks;

                this.InternalSetCapacity(m_nPackets);
            }

            int extraLen = mainHeader->ExtraDataLength;

            if (extraLen > 0)
            {
                byte[] extraData = new byte[extraLen];
                stream.Read(extraData, 0, extraLen);
                using (var reader = new StreamHandler(extraData))
                {
                    ExtraDataFlags flags = mainHeader->ExtraInfoFlags;
                    if (flags.HasFlag(ExtraDataFlags.HasClientIPv4))
                    {
                        this.ClientAddress = new IPAddress(reader.ReadBytes(4));
                    }
                    if (flags.HasFlag(ExtraDataFlags.HasServerIPv4))
                    {
                        this.ServerAddress = new IPAddress(reader.ReadBytes(4));
                    }
                    if (flags.HasFlag(ExtraDataFlags.HasClientIPv6))
                    {
                        this.ClientAddress = new IPAddress(reader.ReadBytes(16));
                    }
                    if (flags.HasFlag(ExtraDataFlags.HasServerIPv6))
                    {
                        this.ServerAddress = new IPAddress(reader.ReadBytes(16));
                    }
                    if (flags.HasFlag(ExtraDataFlags.HasClientPort))
                    {
                        this.ClientPort = reader.ReadInt32();
                    }
                    if (flags.HasFlag(ExtraDataFlags.HasServerPort))
                    {
                        this.ServerPort = reader.ReadInt32();
                    }
                    if (flags.HasFlag(ExtraDataFlags.HasSnifferIdString))
                    {
                        int origLen = reader.ReadInt32();
                        int cmprLen = reader.ReadInt32();
                        var arr     = new byte[origLen];

                        using (var iStream = new MemoryStream(reader.ReadBytes(cmprLen)))
                            using (var ds = new DeflateStream(iStream, CompressionMode.Decompress, true))
                                ds.Read(arr, 0, arr.Length);

                        this.SnifferDesc = Encoding.UTF8.GetString(arr);
                    }
                }
            }

            m_stream = new StreamHandler(stream, closeStream);
        }
Exemple #12
0
 public static string ReadPascalString32(this StreamHandler sh)
 {
     return(PascalStringReader(sh, sh.ReadInt32()));
 }
        protected override void InternalParse()
        {
            int row;
            int size;
            DB2Ids type;

            Output.AppendLine("Data Size: " + (size = Reader.ReadInt32()));
            byte[] data = Reader.ReadBytes(size);

            Output.AppendLine("Type: " + (type = (DB2Ids)Reader.ReadUInt32()));
            Output.AppendLine("Row: " + (row = Reader.ReadInt32()));
            Output.AppendLine("Time(?): " + Reader.ReadUInt32().AsUnixTime());
            Output.AppendLine();

            if (row < 0)
                return;

            using (var dataReader = new StreamHandler(data))
            {
                if (type == DB2Ids.Item)
                {
                    Output.AppendLine("Item Id: " + dataReader.ReadUInt32());
                    Output.AppendLine("Class: " + (ItemClass)dataReader.ReadUInt32());
                    Output.AppendLine("SubClass: " + (ItemSubClass)dataReader.ReadUInt32());
                    Output.AppendLine("Unk -1: " + dataReader.ReadInt32());
                    Output.AppendLine("Material: " + (Material)dataReader.ReadUInt32());
                    Output.AppendLine("Display Id: " + dataReader.ReadUInt32());
                    Output.AppendLine("Inventory Type: " + (InventorySlot)dataReader.ReadUInt32());
                    Output.AppendLine("Sheath: " + dataReader.ReadUInt32());
                }
                else if (type == DB2Ids.ItemSparse)
                {
                    Output.AppendLine("id: " + dataReader.ReadInt32());
                    Output.AppendLine("quality: " + (ItemQuality)dataReader.ReadInt32());
                    Output.AppendLine("flags: " + dataReader.ReadUInt32());
                    Output.AppendLine("flags2: " + dataReader.ReadUInt32());
                    Output.AppendLine("4.3.2 float1: " + dataReader.ReadSingle()); // 0.95-1.05
                    Output.AppendLine("4.3.2 float2: " + dataReader.ReadSingle()); // 0, 1, 4, huge
                    Output.AppendLine("4.3.2 int: " + dataReader.ReadUInt32()); // stack count
                    Output.AppendLine("buyprice: " + dataReader.ReadInt32());
                    Output.AppendLine("sellprice: " + dataReader.ReadInt32());
                    Output.AppendLine("inventorytype: " + dataReader.ReadInt32());
                    Output.AppendLine("allowableclass: " + dataReader.ReadInt32());
                    Output.AppendLine("allowablerace: " + dataReader.ReadInt32());
                    Output.AppendLine("itemlevel: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredlevel: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredskill: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredskillrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredspell: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredhonorrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredcityrank: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredreputationfaction: " + dataReader.ReadInt32());
                    Output.AppendLine("requiredreputationrank: " + dataReader.ReadInt32());
                    Output.AppendLine("maxcount: " + dataReader.ReadInt32());
                    Output.AppendLine("stackable: " + dataReader.ReadInt32());
                    Output.AppendLine("containerslots: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_type10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_value10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk1_10: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_1: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_2: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_3: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_4: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_5: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_6: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_7: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_8: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_9: " + dataReader.ReadInt32());
                    Output.AppendLine("stat_unk2_10: " + dataReader.ReadInt32());
                    Output.AppendLine("scalingstatdistribution: " + dataReader.ReadInt32());
                    Output.AppendLine("damagetype: " + dataReader.ReadInt32());
                    Output.AppendLine("delay: " + dataReader.ReadInt32());
                    Output.AppendLine("rangedmodrange: " + dataReader.ReadSingle());
                    Output.AppendLine("spellid_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellid_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spelltrigger_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcharges_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcooldown_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategory_5: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_1: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_2: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_3: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_4: " + dataReader.ReadInt32());
                    Output.AppendLine("spellcategorycooldown_5: " + dataReader.ReadInt32());
                    Output.AppendLine("bonding: " + dataReader.ReadInt32());
                    Output.AppendLine("name: " + dataReader.ReadPascalString16());
                    Output.AppendLine("name2: " + dataReader.ReadPascalString16());
                    Output.AppendLine("name3: " + dataReader.ReadPascalString16());
                    Output.AppendLine("name4: " + dataReader.ReadPascalString16());
                    Output.AppendLine("description: " + dataReader.ReadPascalString16());
                    Output.AppendLine("pagetext: " + dataReader.ReadInt32());
                    Output.AppendLine("languageid: " + dataReader.ReadInt32());
                    Output.AppendLine("pagematerial: " + dataReader.ReadInt32());
                    Output.AppendLine("startquest: " + dataReader.ReadInt32());
                    Output.AppendLine("lockid: " + dataReader.ReadInt32());
                    Output.AppendLine("material: " + dataReader.ReadInt32());
                    Output.AppendLine("sheath: " + dataReader.ReadInt32());
                    Output.AppendLine("randomproperty: " + dataReader.ReadInt32());
                    Output.AppendLine("randomsuffix: " + dataReader.ReadInt32());
                    Output.AppendLine("itemset: " + dataReader.ReadInt32());
                    Output.AppendLine("area: " + dataReader.ReadInt32());
                    Output.AppendLine("map: " + dataReader.ReadInt32());
                    Output.AppendLine("bagfamily: " + dataReader.ReadInt32());
                    Output.AppendLine("totemcategory: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcolor_1: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcolor_2: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcolor_3: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcontent_1: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcontent_2: " + dataReader.ReadInt32());
                    Output.AppendLine("socketcontent_3: " + dataReader.ReadInt32());
                    Output.AppendLine("socketbonus: " + dataReader.ReadInt32());
                    Output.AppendLine("gemproperties: " + dataReader.ReadInt32());
                    Output.AppendLine("armordamagemodifier: " + dataReader.ReadSingle());
                    Output.AppendLine("duration: " + dataReader.ReadInt32());
                    Output.AppendLine("itemlimitcategory: " + dataReader.ReadInt32());
                    Output.AppendLine("holidayid: " + dataReader.ReadInt32());
                    Output.AppendLine("statscalingfactor: " + dataReader.ReadSingle());
                    Output.AppendLine("arch_field_130: " + dataReader.ReadInt32());
                    Output.AppendLine("arch_field_131: " + dataReader.ReadInt32());
                }
                else
                    throw new Exception("Unknown item update type: " + type);

                if (!dataReader.IsRead)
                    throw new Exception("Data was not read fully, bytes still not read: " + dataReader.RemainingLength);
            }
        }
Exemple #14
0
        protected unsafe override void InternalOpenForReading(Stream stream, bool closeStream)
        {
            m_isLoaded = true;

            var mainHeaderBytes = new byte[MainHeader.Size];

            stream.Read(mainHeaderBytes, 0, MainHeader.Size);

            MainHeader* mainHeader;
            fixed (byte* mainHeaderBytesPtr = mainHeaderBytes)
            {
                mainHeader = (MainHeader*)mainHeaderBytesPtr;

                m_nPackets = mainHeader->PacketCount;
                this.StartTime = mainHeader->StartedOnUnix.AsUnixTime();
                this.StartTicks = mainHeader->StartedOnTicks;

                this.InternalSetCapacity(m_nPackets);
            }

            int extraLen = mainHeader->ExtraDataLength;
            if (extraLen > 0)
            {
                byte[] extraData = new byte[extraLen];
                stream.Read(extraData, 0, extraLen);
                using (var reader = new StreamHandler(extraData))
                {
                    ExtraDataFlags flags = mainHeader->ExtraInfoFlags;
                    if (flags.HasFlag(ExtraDataFlags.HasClientIPv4))
                        this.ClientAddress = new IPAddress(reader.ReadBytes(4));
                    if (flags.HasFlag(ExtraDataFlags.HasServerIPv4))
                        this.ServerAddress = new IPAddress(reader.ReadBytes(4));
                    if (flags.HasFlag(ExtraDataFlags.HasClientIPv6))
                        this.ClientAddress = new IPAddress(reader.ReadBytes(16));
                    if (flags.HasFlag(ExtraDataFlags.HasServerIPv6))
                        this.ServerAddress = new IPAddress(reader.ReadBytes(16));
                    if (flags.HasFlag(ExtraDataFlags.HasClientPort))
                        this.ClientPort = reader.ReadInt32();
                    if (flags.HasFlag(ExtraDataFlags.HasServerPort))
                        this.ServerPort = reader.ReadInt32();
                    if (flags.HasFlag(ExtraDataFlags.HasSnifferIdString))
                    {
                        int origLen = reader.ReadInt32();
                        int cmprLen = reader.ReadInt32();
                        var arr = new byte[origLen];

                        using (var iStream = new MemoryStream(reader.ReadBytes(cmprLen)))
                        using (var ds = new DeflateStream(iStream, CompressionMode.Decompress, true))
                            ds.Read(arr, 0, arr.Length);

                        this.SnifferDesc = Encoding.UTF8.GetString(arr);
                    }
                }
            }

            m_stream = new StreamHandler(stream, closeStream);
        }
Exemple #15
0
        public void Read(StreamHandler Reader)
        {
            Slot = Reader.ReadByte();
            Spell = Reader.ReadUInt32();

            Caster = Unit;

            if (Spell != 0)
            {
                Flags = (AuraFlags)Reader.ReadUInt16();
                Level = Reader.ReadByte();
                Charges = Reader.ReadByte();

                if ((Flags & AuraFlags.NotCaster) == 0)
                    Caster = Reader.ReadPackedGuid();

                if ((Flags & AuraFlags.Duration) != 0)
                {
                    MaxDuration = Reader.ReadUInt32();
                    var currentDurationMs = Reader.ReadUInt32();

                    this.AppliedTime = (uint)Environment.TickCount - currentDurationMs;
                }

                if ((Flags & AuraFlags.BasePoints) != 0)
                {
                    for (int i = 0; i < MaxEffects; ++i)
                    {
                        if ((Flags & (AuraFlags)(1 << i)) != 0)
                            BasePoints[i] = Reader.ReadInt32();
                        else
                            BasePoints[i] = 0;
                    }
                }
                else
                    Array.Clear(BasePoints, 0, MaxEffects);
            }
        }
Exemple #16
0
        private UpdateFields ReadValues(StreamHandler Reader)
        {
            var values = new UpdateFields();

            byte blocksCount = Reader.ReadByte();
            int[] updatemask = new int[blocksCount];

            for (int i = 0; i < updatemask.Length; ++i)
                updatemask[i] = Reader.ReadInt32();

            var mask = new BitArray(updatemask);

            for (uint i = 0; i < mask.Count; ++i)
                if (mask[(int)i])
                    values[i] = Reader.ReadUInt32();

            return values;
        }
Exemple #17
0
        /// <summary>
        /// Reads the spline info from the current stream,
        /// advancing the current position by spline info's size.
        /// </summary>
        public static SplineInfo ReadSplineInfo(this StreamHandler Reader)
        {
            var info = new SplineInfo();

            var flags = info.Flags = (SplineFlags)Reader.ReadUInt32();

            if ((flags & SplineFlags.FinalPoint) != SplineFlags.None)
            {
                info.FinalPoint = Reader.ReadVector3();
            }

            if ((flags & SplineFlags.FinalTarget) != SplineFlags.None)
            {
                info.FinalGuid = Reader.ReadGuid();
            }

            if ((flags & SplineFlags.FinalOrient) != SplineFlags.None)
            {
                info.FinalRotation = Reader.ReadSingle();
            }

            info.CurrentTime        = Reader.ReadUInt32();
            info.FullTime           = Reader.ReadUInt32();
            info.Unknown1           = Reader.ReadUInt32();
            info.DurationMultiplier = Reader.ReadSingle();
            info.UnknownFloat2      = Reader.ReadSingle();
            info.UnknownFloat3      = Reader.ReadSingle();
            info.Unknown2           = Reader.ReadUInt32();
            int count = Reader.ReadInt32();

            var points = info.Points;

            points.Capacity = count;
            for (int i = 0; i < count; ++i)
            {
                points.Add(Reader.ReadVector3());
            }

            if ((flags & (SplineFlags.Flying | SplineFlags.CatMullRom)) != 0)
            {
                if ((flags & SplineFlags.Cyclic) != 0)
                {
                    points.RemoveAt(0);

                    if ((flags & SplineFlags.EnterCycle) != 0)
                    {
                        points.RemoveAt(0);
                    }

                    points.RemoveAt(points.Count - 1);
                    points.RemoveAt(points.Count - 1);
                }
                else
                {
                    points.RemoveAt(0);
                    points.RemoveAt(points.Count - 1);
                }
            }

            info.SplineMode = (SplineMode)Reader.ReadByte();
            info.EndPoint   = Reader.ReadVector3();

            return(info);
        }