Exemple #1
0
        protected override void ElementRead(StreamHandler reader, int index)
        {
            switch (index)
            {
            case -2:
                this.DirectionCos = reader.ReadSingle();
                break;

            case -3:
                this.DirectionSin = reader.ReadSingle();
                break;

            case -4:
                this.HorizontalSpeed = reader.ReadSingle();
                break;

            case -5:
                this.VerticalSpeed = reader.ReadSingle();
                break;

            default:
                base.ElementRead(reader, index);
                break;
            }
        }
 protected override void ElementRead(StreamHandler reader, int index)
 {
     if (index == -2)
         this.NewValue = reader.ReadSingle();
     else
         base.ElementRead(reader, index);
 }
 protected override void ReadElement(StreamHandler reader, MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
 {
     if (element == MovementStatusElements.GenericDword2)
         this.NewValue = reader.ReadSingle();
     else
         base.ReadElement(reader, element, status, guid, tguid);
 }
 protected override void ReadElement(StreamHandler reader, MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
 {
     if (element == MovementStatusElements.GenericDword0)
     {
         this.NewValue = reader.ReadSingle();
     }
     else
     {
         base.ReadElement(reader, element, status, guid, tguid);
     }
 }
Exemple #5
0
 protected override void ElementRead(StreamHandler reader, int index)
 {
     if (index == -2)
     {
         this.NewValue = reader.ReadSingle();
     }
     else
     {
         base.ElementRead(reader, index);
     }
 }
 protected override void ElementRead(StreamHandler reader, int index)
 {
     switch (index)
     {
         case -2:
             this.DirectionCos = reader.ReadSingle();
             break;
         case -3:
             this.DirectionSin = reader.ReadSingle();
             break;
         case -4:
             this.HorizontalSpeed = reader.ReadSingle();
             break;
         case -5:
             this.VerticalSpeed = reader.ReadSingle();
             break;
         default:
             base.ElementRead(reader, index);
             break;
     }
 }
Exemple #7
0
        public override void Read(StreamHandler Reader)
        {
            Caster      = Reader.ReadPackedGuid();
            CastInvoker = Reader.ReadPackedGuid();
            CastId      = Reader.ReadByte();
            SpellId     = Reader.ReadUInt32();
            Flags       = (CastFlags)Reader.ReadUInt32();
            Unk43       = Reader.ReadUInt32();
            CastTime    = Reader.ReadUInt32();

            byte hits = Reader.ReadByte();

            Hits.Capacity = hits;
            for (byte i = 0; i < hits; ++i)
            {
                Hits.Add(Reader.ReadGuid());
            }

            byte misses = Reader.ReadByte();

            Misses.Capacity = misses;
            for (byte i = 0; i < misses; ++i)
            {
                var miss = new MissData();
                miss.Read(Reader);
                Misses.Add(miss);
            }

            TargetData.Read(Reader);

            if ((Flags & CastFlags.PredictedPower) != 0)
            {
                PredictedPower = Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.RuneStates) != 0)
            {
                RunesBefore = (RuneStates)Reader.ReadByte();
                RunesAfter  = (RuneStates)Reader.ReadByte();
                for (int i = 0; i < RuneCooldowns.Length; ++i)
                {
                    RuneCooldowns[i] = Reader.ReadByte();
                }
            }

            if ((Flags & CastFlags.Unk0x00020000) != 0)
            {
                Unk0x20000_Float  = Reader.ReadSingle();
                Unk0x20000_UInt32 = Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.Ammo) != 0)
            {
                ProjectileDisplayId     = Reader.ReadUInt32();
                ProjectileInventoryType = (InventorySlotType)Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.Unk0x00080000) != 0)
            {
                Unk0x80000_UInt32_1 = Reader.ReadUInt32();
                Unk0x80000_UInt32_2 = Reader.ReadUInt32();
            }

            if ((TargetData.Flags & SpellCastTargetFlags.DestLocation) != 0)
            {
                DestLocationCounter = Reader.ReadByte();
            }

            if ((TargetData.Flags & SpellCastTargetFlags.Unk4) != 0)
            {
                uint count = Reader.ReadUInt32();
                Unk4_Count         = count;
                Unk4_List.Capacity = (int)count;

                for (uint i = 0; i < count; ++i)
                {
                    Vector3 v3   = Reader.ReadVector3();
                    WowGuid guid = Reader.ReadGuid();
                    Unk4_List.Add(new KeyValuePair <WowGuid, Vector3>(guid, v3));
                    if (guid.IsEmpty)
                    {
                        break;
                    }
                }
            }
        }
        protected virtual void ReadElement(StreamHandler reader, MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
        {
            if (element >= MovementStatusElements.GuidByte0 && element <= MovementStatusElements.GuidByte7)
            {
                ReadByteMask(reader, ref guid[element - MovementStatusElements.GuidByte0]);
                return;
            }

            if (element >= MovementStatusElements.TransportGuidByte0 &&
                element <= MovementStatusElements.TransportGuidByte7)
            {
                if (status.HaveTransportData)
                    ReadByteMask(reader, ref tguid[element - MovementStatusElements.TransportGuidByte0]);
                return;
            }

            if (element >= MovementStatusElements.GuidByte0_2 && element <= MovementStatusElements.GuidByte7_2)
            {
                ReadByteSeq(reader, ref guid[element - MovementStatusElements.GuidByte0_2]);
                return;
            }

            if (element >= MovementStatusElements.TransportGuidByte0_2 &&
                element <= MovementStatusElements.TransportGuidByte7_2)
            {
                if (status.HaveTransportData)
                    ReadByteSeq(reader, ref tguid[element - MovementStatusElements.TransportGuidByte0_2]);
                return;
            }

            switch (element)
            {
                case MovementStatusElements.Flags:
                    status.Flags = (MovementFlags)(!reader.UnalignedReadBit() ? 1 : 0);
                    break;
                case MovementStatusElements.Flags_2:
                    if (status.Flags != 0)
                        status.Flags = (MovementFlags)reader.UnalignedReadInt(30);
                    break;
                case MovementStatusElements.Flags2:
                    status.Flags2 = (MovementFlags2)(!reader.UnalignedReadBit() ? 1 : 0);
                    break;
                case MovementStatusElements.Flags2_2:
                    if (status.Flags2 != 0)
                        status.Flags2 = (MovementFlags2)reader.UnalignedReadSmallInt(12);
                    break;
                case MovementStatusElements.Timestamp:
                    status.TimeStamp = !reader.UnalignedReadBit() ? 1U : 0U;
                    break;
                case MovementStatusElements.Timestamp_2:
                    if (status.TimeStamp != 0)
                        status.TimeStamp = reader.ReadUInt32();
                    break;
                case MovementStatusElements.HaveFallData:
                    status.HaveFallData = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveFallDirection:
                    if (status.HaveFallData)
                        status.HaveFallDirection = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveTransportData:
                    status.HaveTransportData = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.TransportHaveTime2:
                    if (status.HaveTransportData)
                        status.HaveTransportTime2 = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.TransportHaveTime3:
                    if (status.HaveTransportData)
                        status.HaveTransportTime3 = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveSpline:
                    status.HaveSpline = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.HaveSpline2:
                    status.HaveSpline2 = reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.PositionX:
                    status.Position.X = reader.ReadSingle();
                    break;
                case MovementStatusElements.PositionY:
                    status.Position.Y = reader.ReadSingle();
                    break;
                case MovementStatusElements.PositionZ:
                    status.Position.Z = reader.ReadSingle();
                    break;
                case MovementStatusElements.PositionO:
                    status.Orientation = !reader.UnalignedReadBit() ? 1.0f : 0.0f;
                    break;
                case MovementStatusElements.PositionO_2:
                    if (status.Orientation != 0.0f)
                        status.Orientation = reader.ReadSingle();
                    break;
                case MovementStatusElements.Pitch:
                    status.HavePitch = !reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.Pitch_2:
                    if (status.HavePitch)
                        status.Pitch = reader.ReadSingle();
                    break;
                case MovementStatusElements.FallTime:
                    if (status.HaveFallData)
                        status.FallTime = reader.ReadUInt32();
                    break;
                case MovementStatusElements.SplineElev:
                    status.HaveSplineElevation = !reader.UnalignedReadBit();
                    break;
                case MovementStatusElements.SplineElev_2:
                    if (status.HaveSplineElevation)
                        status.SplineElevation = reader.ReadSingle();
                    break;
                case MovementStatusElements.FallHorizontalSpeed:
                    if (status.HaveFallDirection)
                        status.FallHorizontalSpeed = reader.ReadSingle();
                    break;
                case MovementStatusElements.FallVerticalSpeed:
                    if (status.HaveFallData)
                        status.FallVerticalSpeed = reader.ReadSingle();
                    break;
                case MovementStatusElements.FallCosAngle:
                    if (status.HaveFallDirection)
                        status.FallCosAngle = reader.ReadSingle();
                    break;
                case MovementStatusElements.FallSinAngle:
                    if (status.HaveFallDirection)
                        status.FallSinAngle = reader.ReadSingle();
                    break;
                case MovementStatusElements.TransportSeat:
                    if (status.HaveTransportData)
                        status.TransportSeat = reader.ReadSByte();
                    break;
                case MovementStatusElements.TransportPositionO:
                    if (status.HaveTransportData)
                        status.TransportFacing = reader.ReadSingle();
                    break;
                case MovementStatusElements.TransportPositionX:
                    if (status.HaveTransportData)
                        status.TransportPosition.X = reader.ReadSingle();
                    break;
                case MovementStatusElements.TransportPositionY:
                    if (status.HaveTransportData)
                        status.TransportPosition.Y = reader.ReadSingle();
                    break;
                case MovementStatusElements.TransportPositionZ:
                    if (status.HaveTransportData)
                        status.TransportPosition.Z = reader.ReadSingle();
                    break;
                case MovementStatusElements.TransportTime:
                    if (status.HaveTransportData)
                        status.TransportTime = reader.ReadUInt32();
                    break;
                case MovementStatusElements.TransportTime2:
                    if (status.HaveTransportTime2)
                        status.TransportTime2 = reader.ReadUInt32();
                    break;
                case MovementStatusElements.TransportTime3:
                    if (status.HaveTransportTime3)
                        status.TransportTime3 = reader.ReadUInt32();
                    break;
                default:
                    throw new InvalidOperationException("Unknown element: " + element);
            }
        }
Exemple #9
0
        public override void Read(StreamHandler Reader)
        {
            Caster = Reader.ReadPackedGuid();
            CastInvoker = Reader.ReadPackedGuid();
            CastId = Reader.ReadByte();
            SpellId = Reader.ReadUInt32();
            Flags = (CastFlags)Reader.ReadUInt32();
            Unk43 = Reader.ReadUInt32();
            CastTime = Reader.ReadUInt32();

            byte hits = Reader.ReadByte();
            Hits.Capacity = hits;
            for (byte i = 0; i < hits; ++i)
                Hits.Add(Reader.ReadGuid());

            byte misses = Reader.ReadByte();
            Misses.Capacity = misses;
            for (byte i = 0; i < misses; ++i)
            {
                var miss = new MissData();
                miss.Read(Reader);
                Misses.Add(miss);
            }

            TargetData.Read(Reader);

            if ((Flags & CastFlags.PredictedPower) != 0)
                PredictedPower = Reader.ReadUInt32();

            if ((Flags & CastFlags.RuneStates) != 0)
            {
                RunesBefore = (RuneStates)Reader.ReadByte();
                RunesAfter = (RuneStates)Reader.ReadByte();
                for (int i = 0; i < RuneCooldowns.Length; ++i)
                    RuneCooldowns[i] = Reader.ReadByte();
            }

            if ((Flags & CastFlags.Unk0x00020000) != 0)
            {
                Unk0x20000_Float = Reader.ReadSingle();
                Unk0x20000_UInt32 = Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.Ammo) != 0)
            {
                ProjectileDisplayId = Reader.ReadUInt32();
                ProjectileInventoryType = (InventorySlotType)Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.Unk0x00080000) != 0)
            {
                Unk0x80000_UInt32_1 = Reader.ReadUInt32();
                Unk0x80000_UInt32_2 = Reader.ReadUInt32();
            }

            if ((TargetData.Flags & SpellCastTargetFlags.DestLocation) != 0)
                DestLocationCounter = Reader.ReadByte();

            if ((TargetData.Flags & SpellCastTargetFlags.Unk4) != 0)
            {
                uint count = Reader.ReadUInt32();
                Unk4_Count = count;
                Unk4_List.Capacity = (int)count;

                for (uint i = 0; i < count; ++i)
                {
                    Vector3 v3 = Reader.ReadVector3();
                    WowGuid guid = Reader.ReadGuid();
                    Unk4_List.Add(new KeyValuePair<WowGuid, Vector3>(guid, v3));
                    if (guid.IsEmpty)
                        break;
                }
            }
        }
Exemple #10
0
        protected virtual void ReadElement(StreamHandler reader, MovementStatusElements element, MovementStatus status, byte[] guid, byte[] tguid)
        {
            if (element >= MovementStatusElements.GuidByte0 && element <= MovementStatusElements.GuidByte7)
            {
                ReadByteMask(reader, ref guid[element - MovementStatusElements.GuidByte0]);
                return;
            }

            if (element >= MovementStatusElements.TransportGuidByte0 &&
                element <= MovementStatusElements.TransportGuidByte7)
            {
                if (status.HaveTransportData)
                {
                    ReadByteMask(reader, ref tguid[element - MovementStatusElements.TransportGuidByte0]);
                }
                return;
            }

            if (element >= MovementStatusElements.GuidByte0_2 && element <= MovementStatusElements.GuidByte7_2)
            {
                ReadByteSeq(reader, ref guid[element - MovementStatusElements.GuidByte0_2]);
                return;
            }

            if (element >= MovementStatusElements.TransportGuidByte0_2 &&
                element <= MovementStatusElements.TransportGuidByte7_2)
            {
                if (status.HaveTransportData)
                {
                    ReadByteSeq(reader, ref tguid[element - MovementStatusElements.TransportGuidByte0_2]);
                }
                return;
            }

            switch (element)
            {
            case MovementStatusElements.Flags:
                status.Flags = (MovementFlags)(!reader.UnalignedReadBit() ? 1 : 0);
                break;

            case MovementStatusElements.Flags_2:
                if (status.Flags != 0)
                {
                    status.Flags = (MovementFlags)reader.UnalignedReadInt(30);
                }
                break;

            case MovementStatusElements.Flags2:
                status.Flags2 = (MovementFlags2)(!reader.UnalignedReadBit() ? 1 : 0);
                break;

            case MovementStatusElements.Flags2_2:
                if (status.Flags2 != 0)
                {
                    status.Flags2 = (MovementFlags2)reader.UnalignedReadSmallInt(12);
                }
                break;

            case MovementStatusElements.Timestamp:
                status.TimeStamp = !reader.UnalignedReadBit() ? 1U : 0U;
                break;

            case MovementStatusElements.Timestamp_2:
                if (status.TimeStamp != 0)
                {
                    status.TimeStamp = reader.ReadUInt32();
                }
                break;

            case MovementStatusElements.HaveFallData:
                status.HaveFallData = reader.UnalignedReadBit();
                break;

            case MovementStatusElements.HaveFallDirection:
                if (status.HaveFallData)
                {
                    status.HaveFallDirection = reader.UnalignedReadBit();
                }
                break;

            case MovementStatusElements.HaveTransportData:
                status.HaveTransportData = reader.UnalignedReadBit();
                break;

            case MovementStatusElements.TransportHaveTime2:
                if (status.HaveTransportData)
                {
                    status.HaveTransportTime2 = reader.UnalignedReadBit();
                }
                break;

            case MovementStatusElements.TransportHaveTime3:
                if (status.HaveTransportData)
                {
                    status.HaveTransportTime3 = reader.UnalignedReadBit();
                }
                break;

            case MovementStatusElements.HaveSpline:
                status.HaveSpline = reader.UnalignedReadBit();
                break;

            case MovementStatusElements.HaveSpline2:
                status.HaveSpline2 = reader.UnalignedReadBit();
                break;

            case MovementStatusElements.PositionX:
                status.Position.X = reader.ReadSingle();
                break;

            case MovementStatusElements.PositionY:
                status.Position.Y = reader.ReadSingle();
                break;

            case MovementStatusElements.PositionZ:
                status.Position.Z = reader.ReadSingle();
                break;

            case MovementStatusElements.PositionO:
                status.Orientation = !reader.UnalignedReadBit() ? 1.0f : 0.0f;
                break;

            case MovementStatusElements.PositionO_2:
                if (status.Orientation != 0.0f)
                {
                    status.Orientation = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.Pitch:
                status.HavePitch = !reader.UnalignedReadBit();
                break;

            case MovementStatusElements.Pitch_2:
                if (status.HavePitch)
                {
                    status.Pitch = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.FallTime:
                if (status.HaveFallData)
                {
                    status.FallTime = reader.ReadUInt32();
                }
                break;

            case MovementStatusElements.SplineElev:
                status.HaveSplineElevation = !reader.UnalignedReadBit();
                break;

            case MovementStatusElements.SplineElev_2:
                if (status.HaveSplineElevation)
                {
                    status.SplineElevation = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.FallHorizontalSpeed:
                if (status.HaveFallDirection)
                {
                    status.FallHorizontalSpeed = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.FallVerticalSpeed:
                if (status.HaveFallData)
                {
                    status.FallVerticalSpeed = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.FallCosAngle:
                if (status.HaveFallDirection)
                {
                    status.FallCosAngle = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.FallSinAngle:
                if (status.HaveFallDirection)
                {
                    status.FallSinAngle = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.TransportSeat:
                if (status.HaveTransportData)
                {
                    status.TransportSeat = reader.ReadSByte();
                }
                break;

            case MovementStatusElements.TransportPositionO:
                if (status.HaveTransportData)
                {
                    status.TransportFacing = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.TransportPositionX:
                if (status.HaveTransportData)
                {
                    status.TransportPosition.X = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.TransportPositionY:
                if (status.HaveTransportData)
                {
                    status.TransportPosition.Y = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.TransportPositionZ:
                if (status.HaveTransportData)
                {
                    status.TransportPosition.Z = reader.ReadSingle();
                }
                break;

            case MovementStatusElements.TransportTime:
                if (status.HaveTransportData)
                {
                    status.TransportTime = reader.ReadUInt32();
                }
                break;

            case MovementStatusElements.TransportTime2:
                if (status.HaveTransportTime2)
                {
                    status.TransportTime2 = reader.ReadUInt32();
                }
                break;

            case MovementStatusElements.TransportTime3:
                if (status.HaveTransportTime3)
                {
                    status.TransportTime3 = reader.ReadUInt32();
                }
                break;

            default:
                throw new InvalidOperationException("Unknown element: " + element);
            }
        }
        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);
            }
        }
        private void ReadFromStreamHandler(StreamHandler Reader, WowOpcodes opcode)
        {
            GameMasterMessage = (opcode == WowOpcodes.SMSG_GM_MESSAGECHAT);

            m_type = (ChatMessageType)Reader.ReadByte();
            if (m_type == ChatMessageType.Addon2)
                m_type = ChatMessageType.Addon;

            m_language = (Language)Reader.ReadUInt32();
            m_senderGUID = Reader.ReadGuid();
            m_unknownUInt32 = Reader.ReadUInt32();

            switch (m_type)
            {
                case ChatMessageType.MonsterSay:
                case ChatMessageType.MonsterParty:
                case ChatMessageType.MonsterYell:
                case ChatMessageType.MonsterWhisper:
                case ChatMessageType.MonsterEmote:
                case ChatMessageType.BattleNet:
                case ChatMessageType.RaidBossEmote:
                case ChatMessageType.RaidBossWhisper:
                    Reader.Skip(4);
                    m_senderName = Reader.ReadCString();
                    m_targetGUID = Reader.ReadGuid();
                    if (!m_targetGUID.IsEmpty
                        && !m_targetGUID.IsPlayer
                        && !m_targetGUID.IsPet)
                    {
                        Reader.Skip(4);
                        m_targetName = Reader.ReadCString();
                    }
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    if (m_type == ChatMessageType.RaidBossEmote || m_type == ChatMessageType.RaidBossWhisper)
                    {
                        m_displayTime = Reader.ReadSingle();
                        m_suspendEvent = Reader.ReadBoolean();
                    }
                    break;
                case ChatMessageType.BGSystemNeutral:
                case ChatMessageType.BGSystemAlliance:
                case ChatMessageType.BGSystemHorde:
                    m_targetGUID = Reader.ReadGuid();
                    if (!m_targetGUID.IsEmpty
                        && !m_targetGUID.IsPlayer)
                    {
                        Reader.Skip(4);
                        m_targetName = Reader.ReadCString();
                    }
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    break;
                case ChatMessageType.Achievement:
                case ChatMessageType.GuildAchievement:
                    m_targetGUID = Reader.ReadGuid();
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    m_achievementId = Reader.ReadUInt32();
                    break;
                case ChatMessageType.WhisperForeign:
                    Reader.Skip(4);
                    m_senderName = Reader.ReadCString();
                    m_targetGUID = Reader.ReadGuid();
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    break;
                default:
                    if (GameMasterMessage)
                    {
                        Reader.Skip(4);
                        m_senderName = Reader.ReadCString();
                    }
                    if (m_type == ChatMessageType.Channel)
                        m_channel = Reader.ReadCString();
                    m_targetGUID = Reader.ReadGuid();
                    if (m_language == Language.Addon)
                        m_addonPrefix = Reader.ReadCString();
                    Reader.Skip(4);
                    m_text = Reader.ReadCString();
                    m_flags = (ChatMessageFlags)Reader.ReadByte();
                    break;
            }
        }
Exemple #13
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);
                }
            }
        }
 protected override void ElementRead(StreamHandler reader, int index)
 {
     this.NewValue = reader.ReadSingle();
 }
        private void ReadFromStreamHandler(StreamHandler Reader, WowOpcodes opcode)
        {
            GameMasterMessage = (opcode == WowOpcodes.SMSG_GM_MESSAGECHAT);

            m_type = (ChatMessageType)Reader.ReadByte();
            if (m_type == ChatMessageType.Addon2)
            {
                m_type = ChatMessageType.Addon;
            }

            m_language      = (Language)Reader.ReadUInt32();
            m_senderGUID    = Reader.ReadGuid();
            m_unknownUInt32 = Reader.ReadUInt32();

            switch (m_type)
            {
            case ChatMessageType.MonsterSay:
            case ChatMessageType.MonsterParty:
            case ChatMessageType.MonsterYell:
            case ChatMessageType.MonsterWhisper:
            case ChatMessageType.MonsterEmote:
            case ChatMessageType.BattleNet:
            case ChatMessageType.RaidBossEmote:
            case ChatMessageType.RaidBossWhisper:
                Reader.Skip(4);
                m_senderName = Reader.ReadCString();
                m_targetGUID = Reader.ReadGuid();
                if (!m_targetGUID.IsEmpty &&
                    !m_targetGUID.IsPlayer &&
                    !m_targetGUID.IsPet)
                {
                    Reader.Skip(4);
                    m_targetName = Reader.ReadCString();
                }
                if (m_language == Language.Addon)
                {
                    m_addonPrefix = Reader.ReadCString();
                }
                Reader.Skip(4);
                m_text  = Reader.ReadCString();
                m_flags = (ChatMessageFlags)Reader.ReadByte();
                if (m_type == ChatMessageType.RaidBossEmote || m_type == ChatMessageType.RaidBossWhisper)
                {
                    m_displayTime  = Reader.ReadSingle();
                    m_suspendEvent = Reader.ReadBoolean();
                }
                break;

            case ChatMessageType.BGSystemNeutral:
            case ChatMessageType.BGSystemAlliance:
            case ChatMessageType.BGSystemHorde:
                m_targetGUID = Reader.ReadGuid();
                if (!m_targetGUID.IsEmpty &&
                    !m_targetGUID.IsPlayer)
                {
                    Reader.Skip(4);
                    m_targetName = Reader.ReadCString();
                }
                if (m_language == Language.Addon)
                {
                    m_addonPrefix = Reader.ReadCString();
                }
                Reader.Skip(4);
                m_text  = Reader.ReadCString();
                m_flags = (ChatMessageFlags)Reader.ReadByte();
                break;

            case ChatMessageType.Achievement:
            case ChatMessageType.GuildAchievement:
                m_targetGUID = Reader.ReadGuid();
                if (m_language == Language.Addon)
                {
                    m_addonPrefix = Reader.ReadCString();
                }
                Reader.Skip(4);
                m_text          = Reader.ReadCString();
                m_flags         = (ChatMessageFlags)Reader.ReadByte();
                m_achievementId = Reader.ReadUInt32();
                break;

            case ChatMessageType.WhisperForeign:
                Reader.Skip(4);
                m_senderName = Reader.ReadCString();
                m_targetGUID = Reader.ReadGuid();
                if (m_language == Language.Addon)
                {
                    m_addonPrefix = Reader.ReadCString();
                }
                Reader.Skip(4);
                m_text  = Reader.ReadCString();
                m_flags = (ChatMessageFlags)Reader.ReadByte();
                break;

            default:
                if (GameMasterMessage)
                {
                    Reader.Skip(4);
                    m_senderName = Reader.ReadCString();
                }
                if (m_type == ChatMessageType.Channel)
                {
                    m_channel = Reader.ReadCString();
                }
                m_targetGUID = Reader.ReadGuid();
                if (m_language == Language.Addon)
                {
                    m_addonPrefix = Reader.ReadCString();
                }
                Reader.Skip(4);
                m_text  = Reader.ReadCString();
                m_flags = (ChatMessageFlags)Reader.ReadByte();
                break;
            }
        }
Exemple #16
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);
        }
Exemple #17
0
        public unsafe MovementInfo(StreamHandler Reader)
        {
            var guid = new WowGuid();

            this.HaveAttackingTarget    = Reader.UnalignedReadBit();
            guid.Bytes[2]               = Reader.UnalignedReadTinyInt(1);
            this.HaveVehicleData        = Reader.UnalignedReadBit();
            guid.Bytes[1]               = Reader.UnalignedReadTinyInt(1);
            guid.Bytes[4]               = Reader.UnalignedReadTinyInt(1);
            guid.Bytes[3]               = Reader.UnalignedReadTinyInt(1);
            this.HaveTransportTime      = Reader.UnalignedReadBit();
            this.HaveGameObjectPosition = Reader.UnalignedReadBit();
            bool field_1C8 = Reader.UnalignedReadBit();
            bool field_1AC = Reader.UnalignedReadBit();

            this.HaveGameObjectRotation = Reader.UnalignedReadBit();
            this.Living       = Reader.UnalignedReadBit();
            this.HavePosition = Reader.UnalignedReadBit();
            var arrCounter = Reader.UnalignedReadInt(24);

            guid.Bytes[0] = Reader.UnalignedReadTinyInt(1);

            bool    havePFlags = false;
            WowGuid p_guid;
            uint    splinePoints    = 0;
            bool    havePFlags2     = false;
            bool    haveOrientation = false;

            if (this.Living)
            {
                this.HaveTransportData = Reader.UnalignedReadBit();
                if (this.HaveTransportData)
                {
                    fixed(byte *bytes = this.TransportGuid.Bytes)
                    {
                        bytes[2] = Reader.UnalignedReadTinyInt(1);
                        bytes[7] = Reader.UnalignedReadTinyInt(1);
                        bytes[5] = Reader.UnalignedReadTinyInt(1);
                        this.HaveTransportTime3 = Reader.UnalignedReadBit();
                        bytes[3] = Reader.UnalignedReadTinyInt(1);
                        bytes[0] = Reader.UnalignedReadTinyInt(1);
                        bytes[4] = Reader.UnalignedReadTinyInt(1);
                        bytes[1] = Reader.UnalignedReadTinyInt(1);
                        this.HaveTransportTime2 = Reader.UnalignedReadBit();
                        bytes[6] = Reader.UnalignedReadTinyInt(1);
                    }
                }

                this.HaveSpline2 = Reader.UnalignedReadBit();
                p_guid.Bytes[7]  = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[6]  = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[5]  = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[2]  = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[4]  = Reader.UnalignedReadTinyInt(1);
                havePFlags       = !Reader.UnalignedReadBit();
                p_guid.Bytes[1]  = Reader.UnalignedReadTinyInt(1);
                this.SelfTarget  = Reader.UnalignedReadBit();
                this.TimeStamp   = !Reader.UnalignedReadBit() ? 1U : 0U;
                havePFlags2      = !Reader.UnalignedReadBit();

                if (this.HaveSpline2)
                {
                    this.HaveSpline = Reader.UnalignedReadBit();
                    if (this.HaveSpline)
                    {
                        this.Spline.HaveDurationMultiplier = Reader.UnalignedReadBit();
                        this.Spline.Flags        = (SplineFlags)Reader.UnalignedReadInt(25);
                        this.Spline.SplineMode   = (SplineMode)Reader.UnalignedReadTinyInt(2);
                        this.Spline.HaveUnknown1 = Reader.UnalignedReadBit();
                        splinePoints             = Reader.UnalignedReadInt(22);
                        var type = Reader.UnalignedReadTinyInt(2);
                        switch (type)
                        {
                        case 0:
                            this.Spline.SplineType = SplineType.FacingSpot;
                            break;

                        case 1:
                            this.Spline.SplineType = SplineType.Normal;
                            break;

                        case 2:
                            this.Spline.SplineType = SplineType.FacingTarget;
                            break;

                        case 3:
                            this.Spline.SplineType = SplineType.FacingAngle;
                            break;
                        }
                        if (this.Spline.SplineType == SplineType.FacingTarget)
                        {
                            fixed(byte *bytes = this.Spline.FacingTarget.Bytes)
                            {
                                bytes[7] = Reader.UnalignedReadTinyInt(1);
                                bytes[3] = Reader.UnalignedReadTinyInt(1);
                                bytes[4] = Reader.UnalignedReadTinyInt(1);
                                bytes[2] = Reader.UnalignedReadTinyInt(1);
                                bytes[1] = Reader.UnalignedReadTinyInt(1);
                                bytes[6] = Reader.UnalignedReadTinyInt(1);
                                bytes[0] = Reader.UnalignedReadTinyInt(1);
                                bytes[5] = Reader.UnalignedReadTinyInt(1);
                            }
                        }
                    }
                }

                p_guid.Bytes[3] = Reader.UnalignedReadTinyInt(1);
                if (havePFlags)
                {
                    this.Flags = (MovementFlags)Reader.UnalignedReadInt(30);
                }
                this.HavePitch    = !Reader.UnalignedReadBit();
                this.HaveFallData = Reader.UnalignedReadBit();

                if (havePFlags2)
                {
                    this.Flags2 = (MovementFlags2)Reader.UnalignedReadSmallInt(12);
                }

                p_guid.Bytes[0] = Reader.UnalignedReadTinyInt(1);
                haveOrientation = !Reader.UnalignedReadBit();

                if (this.HaveFallData)
                {
                    this.HaveFallDirection = Reader.UnalignedReadBit();
                }

                this.HaveSplineElevation = !Reader.UnalignedReadBit();
            }

            if (this.HaveGameObjectPosition)
            {
                fixed(byte *bytes = this.TransportGuid.Bytes)
                {
                    bytes[1] = Reader.UnalignedReadTinyInt(1);
                    this.HaveTransportTime3 = Reader.UnalignedReadBit();
                    bytes[3] = Reader.UnalignedReadTinyInt(1);
                    bytes[2] = Reader.UnalignedReadTinyInt(1);
                    bytes[6] = Reader.UnalignedReadTinyInt(1);
                    bytes[5] = Reader.UnalignedReadTinyInt(1);
                    bytes[0] = Reader.UnalignedReadTinyInt(1);
                    bytes[4] = Reader.UnalignedReadTinyInt(1);
                    this.HaveTransportTime2 = Reader.UnalignedReadBit();
                    bytes[7] = Reader.UnalignedReadTinyInt(1);
                }
            }

            ushort field_1B2 = 0;
            ushort field_1AE = 0;
            ushort field_1B0 = 0;

            if (field_1AC)
            {
                field_1B2 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
                field_1AE = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
                field_1B0 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
            }

            if (this.HaveAttackingTarget)
            {
                fixed(byte *bytes = this.AttackingTarget.Bytes)
                {
                    bytes[3] = Reader.UnalignedReadTinyInt(1);
                    bytes[4] = Reader.UnalignedReadTinyInt(1);
                    bytes[6] = Reader.UnalignedReadTinyInt(1);
                    bytes[0] = Reader.UnalignedReadTinyInt(1);
                    bytes[1] = Reader.UnalignedReadTinyInt(1);
                    bytes[7] = Reader.UnalignedReadTinyInt(1);
                    bytes[5] = Reader.UnalignedReadTinyInt(1);
                    bytes[2] = Reader.UnalignedReadTinyInt(1);
                }
            }

            this.UnkUInt32 = new uint[arrCounter];
            for (uint i = 0; i < arrCounter; ++i)
            {
                this.UnkUInt32[i] = Reader.ReadUInt32();
            }

            if (this.HavePosition)
            {
                Reader
                .ReadSingle(out this.Position.Z)
                .ReadSingle(out this.Orientation)
                .ReadSingle(out this.Position.X)
                .ReadSingle(out this.Position.Y);
            }

            if (this.HaveVehicleData)
            {
                Reader
                .ReadUInt32(out this.VehicleId)
                .ReadSingle(out this.VehicleAimAdjustement);
            }

            if (this.HaveGameObjectPosition)
            {
                fixed(byte *bytes = this.TransportGuid.Bytes)
                {
                    Reader
                    .ReadXorByte(ref bytes[1])
                    .ReadXorByte(ref bytes[4])
                    .ReadSingle(out this.TransportPosition.Z);

                    if (this.HaveTransportTime3)
                    {
                        this.TransportTime3 = Reader.ReadUInt32();
                    }

                    this.TransportTime = Reader.ReadUInt32();

                    Reader
                    .ReadXorByte(ref bytes[5])
                    .ReadXorByte(ref bytes[6])
                    .ReadSingle(out this.TransportPosition.X)
                    .ReadXorByte(ref bytes[2]);

                    if (this.HaveTransportTime2)
                    {
                        this.TransportTime2 = Reader.ReadUInt32();
                    }

                    Reader
                    .ReadSByte(out this.TransportSeat)
                    .ReadXorByte(ref bytes[3])
                    .ReadSingle(out this.TransportPosition.Y)
                    .ReadSingle(out this.TransportFacing)
                    .ReadXorByte(ref bytes[7])
                    .ReadXorByte(ref bytes[0]);
                }
            }

            if (this.Living)
            {
                if (this.HaveSpline2)
                {
                    if (this.HaveSpline)
                    {
                        var points = this.Spline.Points;
                        points.Capacity = (int)splinePoints;
                        for (int i = 0; i < splinePoints; i++)
                        {
                            points.Add(new Vector3()
                            {
                                Y = Reader.ReadSingle(),
                                X = Reader.ReadSingle(),
                                Z = Reader.ReadSingle()
                            });
                        }

                        if (this.Spline.HaveDurationMultiplier)
                        {
                            this.Spline.DurationMultiplier = Reader.ReadSingle();
                        }

                        this.Spline.UnknownFloat2 = Reader.ReadSingle();

                        if (this.Spline.SplineType == SplineType.FacingTarget)
                        {
                            fixed(byte *bytes = this.Spline.FacingTarget.Bytes)
                            {
                                Reader
                                .ReadXorByte(ref bytes[3])
                                .ReadXorByte(ref bytes[4])
                                .ReadXorByte(ref bytes[5])
                                .ReadXorByte(ref bytes[7])
                                .ReadXorByte(ref bytes[2])
                                .ReadXorByte(ref bytes[0])
                                .ReadXorByte(ref bytes[6])
                                .ReadXorByte(ref bytes[1]);
                            }
                        }

                        if (this.Spline.HaveUnknown1)
                        {
                            this.Spline.Unknown1 = Reader.ReadUInt32();
                        }

                        this.Spline.UnknownFloat3 = Reader.ReadSingle();
                        this.Spline.Unknown2      = Reader.ReadUInt32();

                        if (this.Spline.SplineType == SplineType.FacingSpot)
                        {
                            Reader
                            .ReadSingle(out this.Spline.FacingSpot.Y)
                            .ReadSingle(out this.Spline.FacingSpot.Z)
                            .ReadSingle(out this.Spline.FacingSpot.X);
                        }

                        this.Spline.CurrentTime = Reader.ReadUInt32();

                        if (this.Spline.SplineType == SplineType.FacingAngle)
                        {
                            this.Spline.FacingAngle = Reader.ReadSingle();
                        }
                    }

                    Reader
                    .ReadSingle(out this.Spline.EndPoint.Z)
                    .ReadSingle(out this.Spline.EndPoint.Y)
                    .ReadUInt32(out this.Spline.FullTime)
                    .ReadSingle(out this.Spline.EndPoint.X);
                }

                this.Speeds[8] = Reader.ReadSingle();

                // Transport Data
                if (this.HaveTransportData)
                {
                    fixed(byte *bytes = this.TransportGuid.Bytes)
                    {
                        Reader
                        .ReadXorByte(ref bytes[4])
                        .ReadSingle(out this.TransportPosition.Z)
                        .ReadXorByte(ref bytes[7])
                        .ReadXorByte(ref bytes[5])
                        .ReadXorByte(ref bytes[1])
                        .ReadSingle(out this.TransportPosition.X)
                        .ReadXorByte(ref bytes[3])
                        .ReadXorByte(ref bytes[6]);

                        if (this.HaveTransportTime3)
                        {
                            this.TransportTime3 = Reader.ReadUInt32();
                        }

                        Reader
                        .ReadSingle(out this.TransportPosition.Y)
                        .ReadSByte(out this.TransportSeat)
                        .ReadSingle(out this.TransportFacing);

                        if (this.HaveTransportTime2)
                        {
                            this.TransportTime2 = Reader.ReadUInt32();
                        }

                        Reader
                        .ReadXorByte(ref bytes[2])
                        .ReadUInt32(out this.TransportTime)
                        .ReadXorByte(ref bytes[0]);
                    }
                }

                Reader
                .ReadSingle(out this.Speeds[7])
                .ReadSingle(out this.Position.X);

                if (this.HavePitch)
                {
                    Reader.ReadSingle(out this.Pitch);
                }

                // Fall Data
                if (this.HaveFallData)
                {
                    Reader.ReadUInt32(out this.FallTime);
                    if (this.HaveFallDirection)
                    {
                        Reader
                        .ReadSingle(out this.FallSinAngle)
                        .ReadSingle(out this.FallHorizontalSpeed)
                        .ReadSingle(out this.FallCosAngle);
                    }
                    Reader.ReadSingle(out this.FallVerticalSpeed);
                }

                Reader
                .ReadXorByte(ref p_guid.Bytes[7])
                .ReadSingle(out this.Speeds[4])
                .ReadXorByte(ref p_guid.Bytes[0])
                .ReadXorByte(ref p_guid.Bytes[5]);

                if (this.TimeStamp != 0)
                {
                    this.TimeStamp = Reader.ReadUInt32();
                }

                Reader
                .ReadSingle(out this.Position.Z)
                .ReadSingle(out this.Speeds[6])
                .ReadXorByte(ref p_guid.Bytes[1])
                .ReadSingle(out this.Speeds[2])
                .ReadSingle(out this.Speeds[5])
                .ReadSingle(out this.Speeds[3])
                .ReadSingle(out this.Speeds[0])
                .ReadXorByte(ref p_guid.Bytes[3])
                .ReadXorByte(ref p_guid.Bytes[4])
                .ReadXorByte(ref p_guid.Bytes[2])
                .ReadXorByte(ref p_guid.Bytes[6]);

                if (this.HaveSplineElevation)
                {
                    this.SplineElevation = Reader.ReadSingle();
                }

                this.Position.Y = Reader.ReadSingle();

                if (haveOrientation)
                {
                    this.Orientation = Reader.ReadSingle();
                }

                this.Speeds[1] = Reader.ReadSingle();
            }

            if (field_1C8)
            {
                Console.WriteLine("Error: 16 floats @ 1CC detected !!!");

                Reader.ReadBytes(16 * 4); // 16 floats starting at 1CC
                var field_20C = Reader.ReadByte();
            }

            // transport time
            if (this.HaveTransportTime)
            {
                Reader.ReadUInt32(out this.TransportTime);
            }

            // unk2 ?
            if (field_1AC)
            {
                Console.WriteLine("Error: 3 shorts @ 1AE detected !!!");

                if (field_1B0 != 0)
                {
                    field_1B0 = Reader.ReadUInt16();
                }
                if (field_1B2 != 0)
                {
                    field_1B2 = Reader.ReadUInt16();
                }
                if (field_1AE != 0)
                {
                    field_1AE = Reader.ReadUInt16();
                }
            }

            // go rotation?
            if (this.HaveGameObjectRotation)
            {
                this.GameObjectRotation = Reader.ReadUInt64().UnpackQuaternion();
            }

            // target guid?
            if (this.HaveAttackingTarget)
            {
                fixed(byte *bytes = this.AttackingTarget.Bytes)
                {
                    Reader
                    .ReadXorByte(ref bytes[3])
                    .ReadXorByte(ref bytes[5])
                    .ReadXorByte(ref bytes[0])
                    .ReadXorByte(ref bytes[7])
                    .ReadXorByte(ref bytes[2])
                    .ReadXorByte(ref bytes[4])
                    .ReadXorByte(ref bytes[6])
                    .ReadXorByte(ref bytes[1]);
                }
            }

            this.Guid = guid;
        }
Exemple #18
0
        public unsafe MovementInfo(StreamHandler Reader)
        {
            var guid = new WowGuid();
            this.HaveAttackingTarget = Reader.UnalignedReadBit();
            guid.Bytes[2] = Reader.UnalignedReadTinyInt(1);
            this.HaveVehicleData = Reader.UnalignedReadBit();
            guid.Bytes[1] = Reader.UnalignedReadTinyInt(1);
            guid.Bytes[4] = Reader.UnalignedReadTinyInt(1);
            guid.Bytes[3] = Reader.UnalignedReadTinyInt(1);
            this.HaveTransportTime = Reader.UnalignedReadBit();
            this.HaveGameObjectPosition = Reader.UnalignedReadBit();
            bool field_1C8 = Reader.UnalignedReadBit();
            bool field_1AC = Reader.UnalignedReadBit();
            this.HaveGameObjectRotation = Reader.UnalignedReadBit();
            this.Living = Reader.UnalignedReadBit();
            this.HavePosition = Reader.UnalignedReadBit();
            var arrCounter = Reader.UnalignedReadInt(24);
            guid.Bytes[0] = Reader.UnalignedReadTinyInt(1);

            bool havePFlags = false;
            WowGuid p_guid;
            uint splinePoints = 0;
            bool havePFlags2 = false;
            bool haveOrientation = false;

            if (this.Living)
            {
                this.HaveTransportData = Reader.UnalignedReadBit();
                if (this.HaveTransportData)
                {
                    fixed (byte* bytes = this.TransportGuid.Bytes)
                    {
                        bytes[2] = Reader.UnalignedReadTinyInt(1);
                        bytes[7] = Reader.UnalignedReadTinyInt(1);
                        bytes[5] = Reader.UnalignedReadTinyInt(1);
                        this.HaveTransportTime3 = Reader.UnalignedReadBit();
                        bytes[3] = Reader.UnalignedReadTinyInt(1);
                        bytes[0] = Reader.UnalignedReadTinyInt(1);
                        bytes[4] = Reader.UnalignedReadTinyInt(1);
                        bytes[1] = Reader.UnalignedReadTinyInt(1);
                        this.HaveTransportTime2 = Reader.UnalignedReadBit();
                        bytes[6] = Reader.UnalignedReadTinyInt(1);
                    }
                }

                this.HaveSpline2 = Reader.UnalignedReadBit();
                p_guid.Bytes[7] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[6] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[5] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[2] = Reader.UnalignedReadTinyInt(1);
                p_guid.Bytes[4] = Reader.UnalignedReadTinyInt(1);
                havePFlags = !Reader.UnalignedReadBit();
                p_guid.Bytes[1] = Reader.UnalignedReadTinyInt(1);
                this.SelfTarget = Reader.UnalignedReadBit();
                this.TimeStamp = !Reader.UnalignedReadBit() ? 1U : 0U;
                havePFlags2 = !Reader.UnalignedReadBit();

                if (this.HaveSpline2)
                {
                    this.HaveSpline = Reader.UnalignedReadBit();
                    if (this.HaveSpline)
                    {
                        this.Spline.HaveDurationMultiplier = Reader.UnalignedReadBit();
                        this.Spline.Flags = (SplineFlags)Reader.UnalignedReadInt(25);
                        this.Spline.SplineMode = (SplineMode)Reader.UnalignedReadTinyInt(2);
                        this.Spline.HaveUnknown1 = Reader.UnalignedReadBit();
                        splinePoints = Reader.UnalignedReadInt(22);
                        var type = Reader.UnalignedReadTinyInt(2);
                        switch (type)
                        {
                            case 0:
                                this.Spline.SplineType = SplineType.FacingSpot;
                                break;
                            case 1:
                                this.Spline.SplineType = SplineType.Normal;
                                break;
                            case 2:
                                this.Spline.SplineType = SplineType.FacingTarget;
                                break;
                            case 3:
                                this.Spline.SplineType = SplineType.FacingAngle;
                                break;
                        }
                        if (this.Spline.SplineType == SplineType.FacingTarget)
                        {
                            fixed (byte* bytes = this.Spline.FacingTarget.Bytes)
                            {
                                bytes[7] = Reader.UnalignedReadTinyInt(1);
                                bytes[3] = Reader.UnalignedReadTinyInt(1);
                                bytes[4] = Reader.UnalignedReadTinyInt(1);
                                bytes[2] = Reader.UnalignedReadTinyInt(1);
                                bytes[1] = Reader.UnalignedReadTinyInt(1);
                                bytes[6] = Reader.UnalignedReadTinyInt(1);
                                bytes[0] = Reader.UnalignedReadTinyInt(1);
                                bytes[5] = Reader.UnalignedReadTinyInt(1);
                            }
                        }
                    }
                }

                p_guid.Bytes[3] = Reader.UnalignedReadTinyInt(1);
                if (havePFlags)
                    this.Flags = (MovementFlags)Reader.UnalignedReadInt(30);
                this.HavePitch = !Reader.UnalignedReadBit();
                this.HaveFallData = Reader.UnalignedReadBit();

                if (havePFlags2)
                    this.Flags2 = (MovementFlags2)Reader.UnalignedReadSmallInt(12);

                p_guid.Bytes[0] = Reader.UnalignedReadTinyInt(1);
                haveOrientation = !Reader.UnalignedReadBit();

                if (this.HaveFallData)
                    this.HaveFallDirection = Reader.UnalignedReadBit();

                this.HaveSplineElevation = !Reader.UnalignedReadBit();
            }

            if (this.HaveGameObjectPosition)
            {
                fixed (byte* bytes = this.TransportGuid.Bytes)
                {
                    bytes[1] = Reader.UnalignedReadTinyInt(1);
                    this.HaveTransportTime3 = Reader.UnalignedReadBit();
                    bytes[3] = Reader.UnalignedReadTinyInt(1);
                    bytes[2] = Reader.UnalignedReadTinyInt(1);
                    bytes[6] = Reader.UnalignedReadTinyInt(1);
                    bytes[5] = Reader.UnalignedReadTinyInt(1);
                    bytes[0] = Reader.UnalignedReadTinyInt(1);
                    bytes[4] = Reader.UnalignedReadTinyInt(1);
                    this.HaveTransportTime2 = Reader.UnalignedReadBit();
                    bytes[7] = Reader.UnalignedReadTinyInt(1);
                }
            }

            ushort field_1B2 = 0;
            ushort field_1AE = 0;
            ushort field_1B0 = 0;
            if (field_1AC)
            {
                field_1B2 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
                field_1AE = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
                field_1B0 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0);
            }

            if (this.HaveAttackingTarget)
            {
                fixed (byte* bytes = this.AttackingTarget.Bytes)
                {
                    bytes[3] = Reader.UnalignedReadTinyInt(1);
                    bytes[4] = Reader.UnalignedReadTinyInt(1);
                    bytes[6] = Reader.UnalignedReadTinyInt(1);
                    bytes[0] = Reader.UnalignedReadTinyInt(1);
                    bytes[1] = Reader.UnalignedReadTinyInt(1);
                    bytes[7] = Reader.UnalignedReadTinyInt(1);
                    bytes[5] = Reader.UnalignedReadTinyInt(1);
                    bytes[2] = Reader.UnalignedReadTinyInt(1);
                }
            }

            this.UnkUInt32 = new uint[arrCounter];
            for (uint i = 0; i < arrCounter; ++i)
            {
                this.UnkUInt32[i] = Reader.ReadUInt32();
            }

            if (this.HavePosition)
            {
                Reader
                    .ReadSingle(out this.Position.Z)
                    .ReadSingle(out this.Orientation)
                    .ReadSingle(out this.Position.X)
                    .ReadSingle(out this.Position.Y);
            }

            if (this.HaveVehicleData)
            {
                Reader
                    .ReadUInt32(out this.VehicleId)
                    .ReadSingle(out this.VehicleAimAdjustement);
            }

            if (this.HaveGameObjectPosition)
            {
                fixed (byte* bytes = this.TransportGuid.Bytes)
                {
                    Reader
                        .ReadXorByte(ref bytes[1])
                        .ReadXorByte(ref bytes[4])
                        .ReadSingle(out this.TransportPosition.Z);

                    if (this.HaveTransportTime3)
                        this.TransportTime3 = Reader.ReadUInt32();

                    this.TransportTime = Reader.ReadUInt32();

                    Reader
                        .ReadXorByte(ref bytes[5])
                        .ReadXorByte(ref bytes[6])
                        .ReadSingle(out this.TransportPosition.X)
                        .ReadXorByte(ref bytes[2]);

                    if (this.HaveTransportTime2)
                        this.TransportTime2 = Reader.ReadUInt32();

                    Reader
                        .ReadSByte(out this.TransportSeat)
                        .ReadXorByte(ref bytes[3])
                        .ReadSingle(out this.TransportPosition.Y)
                        .ReadSingle(out this.TransportFacing)
                        .ReadXorByte(ref bytes[7])
                        .ReadXorByte(ref bytes[0]);
                }
            }

            if (this.Living)
            {
                if (this.HaveSpline2)
                {
                    if (this.HaveSpline)
                    {
                        var points = this.Spline.Points;
                        points.Capacity = (int)splinePoints;
                        for (int i = 0; i < splinePoints; i++)
                            points.Add(new Vector3()
                            {
                                Y = Reader.ReadSingle(),
                                X = Reader.ReadSingle(),
                                Z = Reader.ReadSingle()
                            });

                        if (this.Spline.HaveDurationMultiplier)
                        {
                            this.Spline.DurationMultiplier = Reader.ReadSingle();
                        }

                        this.Spline.UnknownFloat2 = Reader.ReadSingle();

                        if (this.Spline.SplineType == SplineType.FacingTarget)
                        {
                            fixed (byte* bytes = this.Spline.FacingTarget.Bytes)
                            {
                                Reader
                                    .ReadXorByte(ref bytes[3])
                                    .ReadXorByte(ref bytes[4])
                                    .ReadXorByte(ref bytes[5])
                                    .ReadXorByte(ref bytes[7])
                                    .ReadXorByte(ref bytes[2])
                                    .ReadXorByte(ref bytes[0])
                                    .ReadXorByte(ref bytes[6])
                                    .ReadXorByte(ref bytes[1]);
                            }
                        }

                        if (this.Spline.HaveUnknown1)
                        {
                            this.Spline.Unknown1 = Reader.ReadUInt32();
                        }

                        this.Spline.UnknownFloat3 = Reader.ReadSingle();
                        this.Spline.Unknown2 = Reader.ReadUInt32();

                        if (this.Spline.SplineType == SplineType.FacingSpot)
                        {
                            Reader
                                .ReadSingle(out this.Spline.FacingSpot.Y)
                                .ReadSingle(out this.Spline.FacingSpot.Z)
                                .ReadSingle(out this.Spline.FacingSpot.X);
                        }

                        this.Spline.CurrentTime = Reader.ReadUInt32();

                        if (this.Spline.SplineType == SplineType.FacingAngle)
                            this.Spline.FacingAngle = Reader.ReadSingle();
                    }

                    Reader
                        .ReadSingle(out this.Spline.EndPoint.Z)
                        .ReadSingle(out this.Spline.EndPoint.Y)
                        .ReadUInt32(out this.Spline.FullTime)
                        .ReadSingle(out this.Spline.EndPoint.X);
                }

                this.Speeds[8] = Reader.ReadSingle();

                // Transport Data
                if (this.HaveTransportData)
                {
                    fixed (byte* bytes = this.TransportGuid.Bytes)
                    {
                        Reader
                            .ReadXorByte(ref bytes[4])
                            .ReadSingle(out this.TransportPosition.Z)
                            .ReadXorByte(ref bytes[7])
                            .ReadXorByte(ref bytes[5])
                            .ReadXorByte(ref bytes[1])
                            .ReadSingle(out this.TransportPosition.X)
                            .ReadXorByte(ref bytes[3])
                            .ReadXorByte(ref bytes[6]);

                        if (this.HaveTransportTime3)
                            this.TransportTime3 = Reader.ReadUInt32();

                        Reader
                            .ReadSingle(out this.TransportPosition.Y)
                            .ReadSByte(out this.TransportSeat)
                            .ReadSingle(out this.TransportFacing);

                        if (this.HaveTransportTime2)
                            this.TransportTime2 = Reader.ReadUInt32();

                        Reader
                            .ReadXorByte(ref bytes[2])
                            .ReadUInt32(out this.TransportTime)
                            .ReadXorByte(ref bytes[0]);
                    }
                }

                Reader
                    .ReadSingle(out this.Speeds[7])
                    .ReadSingle(out this.Position.X);

                if (this.HavePitch)
                    Reader.ReadSingle(out this.Pitch);

                // Fall Data
                if (this.HaveFallData)
                {
                    Reader.ReadUInt32(out this.FallTime);
                    if (this.HaveFallDirection)
                    {
                        Reader
                            .ReadSingle(out this.FallSinAngle)
                            .ReadSingle(out this.FallHorizontalSpeed)
                            .ReadSingle(out this.FallCosAngle);
                    }
                    Reader.ReadSingle(out this.FallVerticalSpeed);
                }

                Reader
                    .ReadXorByte(ref p_guid.Bytes[7])
                    .ReadSingle(out this.Speeds[4])
                    .ReadXorByte(ref p_guid.Bytes[0])
                    .ReadXorByte(ref p_guid.Bytes[5]);

                if (this.TimeStamp != 0)
                    this.TimeStamp = Reader.ReadUInt32();

                Reader
                    .ReadSingle(out this.Position.Z)
                    .ReadSingle(out this.Speeds[6])
                    .ReadXorByte(ref p_guid.Bytes[1])
                    .ReadSingle(out this.Speeds[2])
                    .ReadSingle(out this.Speeds[5])
                    .ReadSingle(out this.Speeds[3])
                    .ReadSingle(out this.Speeds[0])
                    .ReadXorByte(ref p_guid.Bytes[3])
                    .ReadXorByte(ref p_guid.Bytes[4])
                    .ReadXorByte(ref p_guid.Bytes[2])
                    .ReadXorByte(ref p_guid.Bytes[6]);

                if (this.HaveSplineElevation)
                    this.SplineElevation = Reader.ReadSingle();

                this.Position.Y = Reader.ReadSingle();

                if (haveOrientation)
                    this.Orientation = Reader.ReadSingle();

                this.Speeds[1] = Reader.ReadSingle();
            }

            if (field_1C8)
            {
                Console.WriteLine("Error: 16 floats @ 1CC detected !!!");

                Reader.ReadBytes(16 * 4); // 16 floats starting at 1CC
                var field_20C = Reader.ReadByte();
            }

            // transport time
            if (this.HaveTransportTime)
                Reader.ReadUInt32(out this.TransportTime);

            // unk2 ?
            if (field_1AC)
            {
                Console.WriteLine("Error: 3 shorts @ 1AE detected !!!");

                if (field_1B0 != 0)
                    field_1B0 = Reader.ReadUInt16();
                if (field_1B2 != 0)
                    field_1B2 = Reader.ReadUInt16();
                if (field_1AE != 0)
                    field_1AE = Reader.ReadUInt16();
            }

            // go rotation?
            if (this.HaveGameObjectRotation)
                this.GameObjectRotation = Reader.ReadUInt64().UnpackQuaternion();

            // target guid?
            if (this.HaveAttackingTarget)
            {
                fixed (byte* bytes = this.AttackingTarget.Bytes)
                {
                    Reader
                        .ReadXorByte(ref bytes[3])
                        .ReadXorByte(ref bytes[5])
                        .ReadXorByte(ref bytes[0])
                        .ReadXorByte(ref bytes[7])
                        .ReadXorByte(ref bytes[2])
                        .ReadXorByte(ref bytes[4])
                        .ReadXorByte(ref bytes[6])
                        .ReadXorByte(ref bytes[1]);
                }
            }

            this.Guid = guid;
        }
 protected override void ElementRead(StreamHandler reader, int index)
 {
     this.NewValue = reader.ReadSingle();
 }