Exemple #1
0
 public void Read(StreamHandler Reader)
 {
     TargetGuid    = Reader.ReadGuid();
     MissCondition = (CastMissReason)Reader.ReadByte();
     if (MissCondition == CastMissReason.Reflect)
     {
         ReflectResult = Reader.ReadByte();
     }
 }
Exemple #2
0
        public override void Read(StreamHandler reader)
        {
            ContainerSlot = (InventorySlot)reader.ReadByte();
            Slot = (InventorySlot)reader.ReadByte();
            CastId = reader.ReadByte();
            SpellId = reader.ReadUInt32();
            ItemGuid = reader.ReadGuid();
            GlyphSlot = reader.ReadUInt32();
            UnkFlags = reader.ReadByte();

            TargetData.Read(reader);
        }
Exemple #3
0
        public override void Read(StreamHandler reader)
        {
            ContainerSlot = (InventorySlot)reader.ReadByte();
            Slot          = (InventorySlot)reader.ReadByte();
            CastId        = reader.ReadByte();
            SpellId       = reader.ReadUInt32();
            ItemGuid      = reader.ReadGuid();
            GlyphSlot     = reader.ReadUInt32();
            UnkFlags      = reader.ReadByte();

            TargetData.Read(reader);
        }
Exemple #4
0
 public override void Read(StreamHandler reader)
 {
     Entity       = reader.ReadGuid();
     Model        = reader.ReadUInt32();
     Race         = (Races)reader.ReadByte();
     Gender       = (Genders)reader.ReadByte();
     Class        = (Classes)reader.ReadByte();
     Skin         = reader.ReadByte();
     Face         = reader.ReadByte();
     Hair         = reader.ReadByte();
     HairColor    = reader.ReadByte();
     FaceFeatures = reader.ReadByte();
     Guild        = reader.ReadGuid();
     Head         = reader.ReadUInt32();
     Shoulders    = reader.ReadUInt32();
     Body         = reader.ReadUInt32();
     Chest        = reader.ReadUInt32();
     Waist        = reader.ReadUInt32();
     Legs         = reader.ReadUInt32();
     Feet         = reader.ReadUInt32();
     Wrists       = reader.ReadUInt32();
     Hands        = reader.ReadUInt32();
     Back         = reader.ReadUInt32();
     Tabard       = reader.ReadUInt32();
 }
 public override void Read(StreamHandler reader)
 {
     Entity = reader.ReadGuid();
     Model = reader.ReadUInt32();
     Race = (Races)reader.ReadByte();
     Gender = (Genders)reader.ReadByte();
     Class = (Classes)reader.ReadByte();
     Skin = reader.ReadByte();
     Face = reader.ReadByte();
     Hair = reader.ReadByte();
     HairColor = reader.ReadByte();
     FaceFeatures = reader.ReadByte();
     Guild = reader.ReadGuid();
     Head = reader.ReadUInt32();
     Shoulders = reader.ReadUInt32();
     Body = reader.ReadUInt32();
     Chest = reader.ReadUInt32();
     Waist = reader.ReadUInt32();
     Legs = reader.ReadUInt32();
     Feet = reader.ReadUInt32();
     Wrists = reader.ReadUInt32();
     Hands = reader.ReadUInt32();
     Back = reader.ReadUInt32();
     Tabard = reader.ReadUInt32();
 }
 public override void Read(StreamHandler Reader)
 {
     this.Count = Reader.ReadByte();
     this.Seed = Reader.ReadUInt32();
     this.ClientSeed = Reader.ReadBytes(16);
     this.ServerSeed = Reader.ReadBytes(16);
 }
Exemple #7
0
 public override void Read(StreamHandler Reader)
 {
     this.Count      = Reader.ReadByte();
     this.Seed       = Reader.ReadUInt32();
     this.ClientSeed = Reader.ReadBytes(16);
     this.ServerSeed = Reader.ReadBytes(16);
 }
Exemple #8
0
        private void ReadObjectCreateUpdate(StreamHandler Reader)
        {
            var guid = Reader.ReadPackedGuid();
            var type = (ObjectTypeId)Reader.ReadByte();

            WowObject obj;

            switch (type)
            {
            case ObjectTypeId.Container:
                obj = new WowContainer();
                break;

            case ObjectTypeId.Corpse:
                obj = new WowCorpse();
                break;

            case ObjectTypeId.DynamicObject:
                obj = new WowDynamicObject();
                break;

            case ObjectTypeId.GameObject:
                obj = new WowGameObject();
                break;

            case ObjectTypeId.Item:
                obj = new WowItem();
                break;

            case ObjectTypeId.Object:
            default:
                throw new Exception("Cannot instantiate an object with TypeId=" + type);

            case ObjectTypeId.Player:
                obj = new WowPlayer();
                break;

            case ObjectTypeId.Unit:
                obj = new WowUnit();
                break;

            case ObjectTypeId.AreaTrigger:
                obj = new WowAreaTrigger();
                break;
            }

            obj.Guid         = guid;
            obj.MovementData = new MovementInfo(Reader);
            obj.SetValues(ReadValues(Reader));
            obj.ResetUpdatedFields();

            if (!m_createdObjects.ContainsKey(guid))
            {
                m_createdObjects.Add(guid, obj);
            }
            else
            {
                Console.WriteLine("Error: Created object duplicate guid {0}", guid);
            }
        }
Exemple #9
0
        private UpdateFields ReadValues(StreamHandler Reader)
        {
            var values = new UpdateFields();

            byte blocksCount = Reader.ReadByte();

            int[] updatemask = new int[blocksCount];

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

            var mask = new BitArray(updatemask);

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

            return(values);
        }
Exemple #10
0
 protected void ReadByteSeq(StreamHandler reader, ref byte b)
 {
     if (b != 0)
     {
         b ^= reader.ReadByte();
     }
 }
Exemple #11
0
        public override void Read(StreamHandler reader)
        {
            Caster   = reader.ReadPackedGuid();
            SpellId  = reader.ReadUInt32();
            Duration = reader.ReadInt32();

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

            Unk_HaveData2 = reader.ReadBoolean();
            if (Unk_HaveData2)
            {
                Unk_Guid1 = reader.ReadPackedGuid();
                Unk_UInt3 = reader.ReadUInt32();
                Unk_Byte  = reader.ReadByte();
                if (Unk_Byte == 2)
                {
                    Unk_Guid2 = reader.ReadPackedGuid();
                }
            }
        }
Exemple #12
0
        public void Read(StreamHandler Reader)
        {
            Slot  = Reader.ReadByte();
            Spell = Reader.ReadUInt32();

            Caster = Unit;

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

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

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

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

                if ((Flags & AuraFlags.BasePoints) != 0)
                {
                    for (int i = 0; i < MaxEffects; ++i)
                    {
                        if ((Flags & (AuraFlags)(1 << i)) != 0)
                        {
                            BasePoints[i] = Reader.ReadInt32();
                        }
                        else
                        {
                            BasePoints[i] = 0;
                        }
                    }
                }
                else
                {
                    Array.Clear(BasePoints, 0, MaxEffects);
                }
            }
        }
Exemple #13
0
        public override void Read(StreamHandler reader)
        {
            this.UpdateType = (LFGUpdateType)reader.ReadByte();
            this.ExtraData  = reader.ReadBoolean();
            if (ExtraData)
            {
                this.Queued = reader.ReadBoolean();

                reader.Skip(2); // 2 bools

                uint count = reader.ReadByte();
                Dungeons = new DungeonEntry[count];
                for (uint i = 0; i < count; ++i)
                {
                    Dungeons[i] = new DungeonEntry(reader.ReadUInt32());
                }

                this.Comment = reader.ReadCString();
            }
        }
Exemple #14
0
        public override void Read(StreamHandler reader)
        {
            this.Guid = reader.ReadGuid();
            this.Type = (LootType)reader.ReadByte();
            this.Gold = new Money(reader.ReadUInt32());
            byte itemCount = reader.ReadByte();
            byte currencyCount = reader.ReadByte();

            for (int i = 0; i < itemCount; ++i)
            {
                Item item = reader.ReadStruct<Item>();
                Items.Add(item);
            }

            for (int i = 0; i < currencyCount; ++i)
            {
                Currency currency = reader.ReadStruct<Currency>();
                Currencies.Add(currency);
            }
        }
Exemple #15
0
        public override void Read(StreamHandler reader)
        {
            this.Guid = reader.ReadGuid();
            this.Type = (LootType)reader.ReadByte();
            this.Gold = new Money(reader.ReadUInt32());
            byte itemCount     = reader.ReadByte();
            byte currencyCount = reader.ReadByte();

            for (int i = 0; i < itemCount; ++i)
            {
                Item item = reader.ReadStruct <Item>();
                Items.Add(item);
            }

            for (int i = 0; i < currencyCount; ++i)
            {
                Currency currency = reader.ReadStruct <Currency>();
                Currencies.Add(currency);
            }
        }
Exemple #16
0
        public override void Read(StreamHandler reader)
        {
            Dungeon      = new DungeonEntry(reader.ReadUInt32());
            State        = (LFGState)reader.ReadByte();
            ProposalId   = reader.ReadUInt32();
            BossesKilled = reader.ReadUInt32();
            SameDungeon  = reader.ReadBoolean();

            byte count = reader.ReadByte();

            this.Players = new PlayerInfo[count];
            for (byte i = 0; i < count; ++i)
            {
                this.Players[i].Role       = (GroupRoles)reader.ReadUInt32();
                this.Players[i].SelfPlayer = reader.ReadBoolean();
                this.Players[i].InDungeon  = reader.ReadBoolean();
                this.Players[i].SameGroup  = reader.ReadBoolean();
                this.Players[i].Answered   = reader.ReadBoolean();
                this.Players[i].Accepted   = reader.ReadBoolean();
            }
        }
Exemple #17
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();
            Unk43_2     = Reader.ReadUInt32();

            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.Ammo) != 0)
            {
                ProjectileDisplayId     = Reader.ReadUInt32();
                ProjectileInventoryType = (InventorySlotType)Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.Unk0x04000000) != 0)
            {
                Unk0x04000000_UInt32_1 = Reader.ReadUInt32();
                Unk0x04000000_UInt32_2 = Reader.ReadUInt32();
            }
        }
Exemple #18
0
        /// <summary>
        /// Reads the packed Guid from the current stream and advances
        /// the current position of the stream by packed Guid size.
        /// </summary>
        public static WowGuid ReadPackedGuid(this StreamHandler reader)
        {
            byte mask = reader.ReadByte();

            if (mask == 0)
            {
                return(new WowGuid());
            }

            ulong res = 0;

            for (int i = 0; i < 8; ++i)
            {
                if ((mask & 1) != 0)
                {
                    res |= (ulong)reader.ReadByte() << (i << 3);
                }

                mask >>= 1;
            }

            return(new WowGuid(res));
        }
Exemple #19
0
        public override void Read(StreamHandler reader)
        {
            this.Roles = (GroupRoles)reader.ReadUInt32();

            reader.Skip(2); // 2 bools

            uint count = reader.ReadByte();
            Dungeons = new DungeonEntry[count];
            for (uint i = 0; i < count; ++i)
                Dungeons[i] = new DungeonEntry(reader.ReadUInt32());

            reader.Skip(4);

            this.Comment = reader.ReadCString();
        }
Exemple #20
0
        public override void Read(StreamHandler Reader)
        {
            byte[] blob = Reader.ReadBytes(256);
            Token           = Reader.ReadUInt32();
            UnknownULong    = Reader.ReadUInt64();
            ConnectionIndex = Reader.ReadByte();

            // hardcoded in client
            byte[] modulus1 =
            {
                0x91, 0xD5, 0x9B, 0xB7, 0xD4, 0xE1, 0x83, 0xA5, 0x22, 0x2B, 0x5F, 0x38, 0xF4, 0xB8, 0x86, 0xFF,
                0x32, 0x84, 0x38, 0x2D, 0x99, 0x38, 0x8F, 0xBA, 0xF3, 0xC9, 0x22, 0x5D, 0x51, 0x73, 0x1E, 0x28,
                0x87, 0x24, 0x8F, 0xB5, 0xC9, 0xB0, 0x7C, 0x95, 0xD0, 0x6B, 0x5B, 0xF4, 0x94, 0xC5, 0x94, 0x9D,
                0xFA, 0x6F, 0x47, 0x3A, 0xA3, 0x86, 0xC0, 0xA8, 0x37, 0xF3, 0x9B, 0xEF, 0x2F, 0xC1, 0xFB, 0xB3,
                0xF4, 0x1C, 0x2B, 0x0E, 0xD3, 0x6D, 0x88, 0xBB, 0x02, 0xE0, 0x4E, 0x63, 0xFA, 0x76, 0xE3, 0x43,
                0xF9, 0x01, 0xFD, 0x23, 0x5E, 0x6A, 0x0B, 0x14, 0xEC, 0x5E, 0x91, 0x34, 0x0D, 0x0B, 0x4F, 0xA3,
                0x5A, 0x46, 0xC5, 0x5E, 0xDC, 0xB5, 0xCD, 0xC1, 0x47, 0x6B, 0x59, 0xCA, 0xFA, 0xA9, 0xBE, 0x24,
                0x9F, 0xF5, 0x05, 0x6B, 0xBB, 0x67, 0x8B, 0xB7, 0xE4, 0x3A, 0x43, 0x00, 0x5C, 0x1C, 0xB7, 0xCA,
                0x98, 0x90, 0x79, 0x77, 0x6D, 0x05, 0x4F, 0x83, 0xCC, 0xAC, 0x06, 0x2E, 0x50, 0x11, 0x87, 0x23,
                0xD8, 0xA6, 0xF7, 0x6F, 0x7A, 0x59, 0x87, 0xA6, 0xDE, 0x5D, 0xD8, 0xEC, 0x44, 0xBE, 0x45, 0x31,
                0x7F, 0x8A, 0xF0, 0x58, 0x89, 0x53, 0x74, 0xDF, 0xCC, 0xAD, 0x01, 0x24, 0xD8, 0x19, 0x65, 0x1C,
                0x25, 0xD3, 0xE1, 0x6B, 0x8B, 0xDA, 0xFE, 0x1D, 0xA4, 0x2C, 0x8B, 0x25, 0xED, 0x7C, 0xFF, 0x6A,
                0xE0, 0x63, 0xD0, 0x52, 0x20, 0x7E, 0x62, 0x49, 0xD2, 0xB3, 0x6B, 0xCC, 0x91, 0x69, 0xA5, 0x08,
                0x8B, 0x69, 0x65, 0xFF, 0xB9, 0xC9, 0x17, 0x02, 0x5D, 0xD8, 0x8E, 0x1A, 0x63, 0xD9, 0x2A, 0x7F,
                0xDB, 0xE3, 0xF8, 0x76, 0x6D, 0xEA, 0x0E, 0x36, 0x98, 0x78, 0x19, 0xC5, 0x87, 0xBA, 0x6C, 0x20,
                0xB6, 0x08, 0x44, 0x04, 0x4C, 0xA8, 0xD5, 0xB6, 0x9D, 0x4D, 0x00, 0x20, 0x40, 0x00, 0x90, 0x04
            };

            // hardcoded in client
            byte[] exp = { 0x01, 0x00, 0x01, 0x00 };

            BigInteger res_bn = BigInteger.ModPow(new BigInteger(blob), new BigInteger(exp), new BigInteger(modulus1));

            FixedBlob = FixBlob(res_bn.ToByteArray());

            ServerHash = new byte[0];
            Port       = BitConverter.ToUInt16(FixedBlob, 21);
            IP         = new IPAddress(FixedBlob.Take(4).ToArray());

            //byte[] bytes = new byte[0]
            //    .Concat(BitConverter.GetBytes(Port))
            //    .Concat(BitConverter.GetBytes(ip))
            //    .ToArray();

            //SHA1Managed sha1 = new SHA1Managed();
            ComputedHash = new byte[0]; //sha1.ComputeHash(bytes);
        }
        public override void Read(StreamHandler Reader)
        {
            byte[] blob = Reader.ReadBytes(256);
            Token = Reader.ReadUInt32();
            UnknownULong = Reader.ReadUInt64();
            ConnectionIndex = Reader.ReadByte();

            // hardcoded in client
            byte[] modulus1 = {
                    0x91, 0xD5, 0x9B, 0xB7, 0xD4, 0xE1, 0x83, 0xA5, 0x22, 0x2B, 0x5F, 0x38, 0xF4, 0xB8, 0x86, 0xFF, 
                    0x32, 0x84, 0x38, 0x2D, 0x99, 0x38, 0x8F, 0xBA, 0xF3, 0xC9, 0x22, 0x5D, 0x51, 0x73, 0x1E, 0x28, 
                    0x87, 0x24, 0x8F, 0xB5, 0xC9, 0xB0, 0x7C, 0x95, 0xD0, 0x6B, 0x5B, 0xF4, 0x94, 0xC5, 0x94, 0x9D, 
                    0xFA, 0x6F, 0x47, 0x3A, 0xA3, 0x86, 0xC0, 0xA8, 0x37, 0xF3, 0x9B, 0xEF, 0x2F, 0xC1, 0xFB, 0xB3, 
                    0xF4, 0x1C, 0x2B, 0x0E, 0xD3, 0x6D, 0x88, 0xBB, 0x02, 0xE0, 0x4E, 0x63, 0xFA, 0x76, 0xE3, 0x43, 
                    0xF9, 0x01, 0xFD, 0x23, 0x5E, 0x6A, 0x0B, 0x14, 0xEC, 0x5E, 0x91, 0x34, 0x0D, 0x0B, 0x4F, 0xA3, 
                    0x5A, 0x46, 0xC5, 0x5E, 0xDC, 0xB5, 0xCD, 0xC1, 0x47, 0x6B, 0x59, 0xCA, 0xFA, 0xA9, 0xBE, 0x24, 
                    0x9F, 0xF5, 0x05, 0x6B, 0xBB, 0x67, 0x8B, 0xB7, 0xE4, 0x3A, 0x43, 0x00, 0x5C, 0x1C, 0xB7, 0xCA, 
                    0x98, 0x90, 0x79, 0x77, 0x6D, 0x05, 0x4F, 0x83, 0xCC, 0xAC, 0x06, 0x2E, 0x50, 0x11, 0x87, 0x23, 
                    0xD8, 0xA6, 0xF7, 0x6F, 0x7A, 0x59, 0x87, 0xA6, 0xDE, 0x5D, 0xD8, 0xEC, 0x44, 0xBE, 0x45, 0x31, 
                    0x7F, 0x8A, 0xF0, 0x58, 0x89, 0x53, 0x74, 0xDF, 0xCC, 0xAD, 0x01, 0x24, 0xD8, 0x19, 0x65, 0x1C, 
                    0x25, 0xD3, 0xE1, 0x6B, 0x8B, 0xDA, 0xFE, 0x1D, 0xA4, 0x2C, 0x8B, 0x25, 0xED, 0x7C, 0xFF, 0x6A, 
                    0xE0, 0x63, 0xD0, 0x52, 0x20, 0x7E, 0x62, 0x49, 0xD2, 0xB3, 0x6B, 0xCC, 0x91, 0x69, 0xA5, 0x08, 
                    0x8B, 0x69, 0x65, 0xFF, 0xB9, 0xC9, 0x17, 0x02, 0x5D, 0xD8, 0x8E, 0x1A, 0x63, 0xD9, 0x2A, 0x7F, 
                    0xDB, 0xE3, 0xF8, 0x76, 0x6D, 0xEA, 0x0E, 0x36, 0x98, 0x78, 0x19, 0xC5, 0x87, 0xBA, 0x6C, 0x20, 
                    0xB6, 0x08, 0x44, 0x04, 0x4C, 0xA8, 0xD5, 0xB6, 0x9D, 0x4D, 0x00, 0x20, 0x40, 0x00, 0x90, 0x04
                };

            // hardcoded in client
            byte[] exp = { 0x01, 0x00, 0x01, 0x00 };

            BigInteger res_bn = BigInteger.ModPow(new BigInteger(blob), new BigInteger(exp), new BigInteger(modulus1));

            FixedBlob = FixBlob(res_bn.ToByteArray());

            ServerHash = new byte[0];
            Port = BitConverter.ToUInt16(FixedBlob, 21);
            IP = new IPAddress(FixedBlob.Take(4).ToArray());

            //byte[] bytes = new byte[0]
            //    .Concat(BitConverter.GetBytes(Port))
            //    .Concat(BitConverter.GetBytes(ip))
            //    .ToArray();

            //SHA1Managed sha1 = new SHA1Managed();
            ComputedHash = new byte[0]; //sha1.ComputeHash(bytes);
        }
Exemple #22
0
        public override void Read(StreamHandler reader)
        {
            this.Roles = (GroupRoles)reader.ReadUInt32();

            reader.Skip(2); // 2 bools

            uint count = reader.ReadByte();

            Dungeons = new DungeonEntry[count];
            for (uint i = 0; i < count; ++i)
            {
                Dungeons[i] = new DungeonEntry(reader.ReadUInt32());
            }

            reader.Skip(4);

            this.Comment = reader.ReadCString();
        }
Exemple #23
0
        public static StreamHandler ReadXorByte(this StreamHandler reader, ref byte value)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (value != 0)
            {
                if (value != 1)
                {
                    throw new InvalidOperationException();
                }

                value ^= reader.ReadByte();
            }

            return(reader);
        }
Exemple #24
0
        public override void Read(StreamHandler reader)
        {
            Caster = reader.ReadPackedGuid();
            SpellId = reader.ReadUInt32();
            Duration = reader.ReadInt32();

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

            Unk_HaveData2 = reader.ReadBoolean();
            if (Unk_HaveData2)
            {
                Unk_Guid1 = reader.ReadPackedGuid();
                Unk_UInt3 = reader.ReadUInt32();
                Unk_Byte = reader.ReadByte();
                if (Unk_Byte == 2)
                    Unk_Guid2 = reader.ReadPackedGuid();
            }
        }
Exemple #25
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();
            Unk43_2 = Reader.ReadUInt32();

            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.Ammo) != 0)
            {
                ProjectileDisplayId = Reader.ReadUInt32();
                ProjectileInventoryType = (InventorySlotType)Reader.ReadUInt32();
            }

            if ((Flags & CastFlags.Unk0x04000000) != 0)
            {
                Unk0x04000000_UInt32_1 = Reader.ReadUInt32();
                Unk0x04000000_UInt32_2 = Reader.ReadUInt32();
            }
        }
Exemple #26
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 #27
0
 public void Read(StreamHandler Reader)
 {
     TargetGuid = Reader.ReadGuid();
     MissCondition = (CastMissReason)Reader.ReadByte();
     if (MissCondition == CastMissReason.Reflect)
         ReflectResult = Reader.ReadByte();
 }
        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 #29
0
        public sealed override void Read(StreamHandler reader)
        {
            var seq_b = ByteSequence;
            var seq_m = MaskSequence;
            var b_xor = ByteXorValue;

            int size = seq_m.Count(x => x >= 0);
            if (size != seq_m.Length && this.IsMaskSequenceSwapped)
                throw new InvalidOperationException("Cannot have elements in swapped MaskSequence.");
            CheckSequences(seq_b, seq_m);

            if (this.IsMaskSequenceSwapped)
            {
                var seq_m_copy = new int[seq_m.Length];
                for (int i = 0; i < seq_m.Length; )
                {
                    var t = i;
                    for (int j = t + 8 - 1; j >= t; --j, ++i)
                        seq_m_copy[j] = seq_m[i];
                }
                seq_m = seq_m_copy;
            }

            //byte[] data = new byte[size];
            //var src = new BitArray(reader.ReadBytes(size / 8));
            //var dst = new BitArray(size);

            //for (int i = 0; i < size; ++i)
            //    dst[seq_m[i]] = src[i];

            //for (int i = 0; i < seq_b.Length; ++i)
            //{
            //    var el = seq_b[i];
            //    if (el < 0)
            //        ElementRead(reader, el);
            //    else if (dst[el])
            //        data[el] = (byte)(reader.ReadByte() ^ b_xor);
            //}

            byte[] data = new byte[size];
            var dst = new BitArray(size);

            for (int i = 0; i < seq_m.Length; ++i)
            {
                var el = seq_m[i];
                if (el < 0)
                    ElementRead(reader, el);
                else
                    dst[el] = reader.UnalignedReadBit();
            }

            for (int i = 0; i < seq_b.Length; ++i)
            {
                var el = seq_b[i];
                if (el < 0)
                    ElementRead(reader, el);
                else if (dst[el])
                    data[el] = (byte)(reader.ReadByte() ^ b_xor);
            }

            PackedRead(data);
        }
Exemple #30
0
 public static string ReadPascalString8(this StreamHandler sh)
 {
     return(PascalStringReader(sh, sh.ReadByte()));
 }
Exemple #31
0
        public override void Read(StreamHandler reader)
        {
            Dungeon = new DungeonEntry(reader.ReadUInt32());
            State = (LFGState)reader.ReadByte();
            ProposalId = reader.ReadUInt32();
            BossesKilled = reader.ReadUInt32();
            SameDungeon = reader.ReadBoolean();

            byte count = reader.ReadByte();
            this.Players = new PlayerInfo[count];
            for (byte i = 0; i < count; ++i)
            {
                this.Players[i].Role = (GroupRoles)reader.ReadUInt32();
                this.Players[i].SelfPlayer = reader.ReadBoolean();
                this.Players[i].InDungeon = reader.ReadBoolean();
                this.Players[i].SameGroup = reader.ReadBoolean();
                this.Players[i].Answered = reader.ReadBoolean();
                this.Players[i].Accepted = reader.ReadBoolean();
            }
        }
Exemple #32
0
        private static byte[] FixBlob(byte[] blob)
        {
            var fixedBlob = new byte[260];

            using (var reader = new StreamHandler(blob))
            {
                fixedBlob[91]  = reader.ReadByte();
                fixedBlob[149] = reader.ReadByte();
                fixedBlob[96]  = reader.ReadByte();
                fixedBlob[44]  = reader.ReadByte();
                fixedBlob[92]  = reader.ReadByte();
                fixedBlob[66]  = reader.ReadByte();
                fixedBlob[165] = reader.ReadByte();
                fixedBlob[111] = reader.ReadByte();
                fixedBlob[221] = reader.ReadByte();
                fixedBlob[243] = reader.ReadByte();
                fixedBlob[69]  = reader.ReadByte();
                fixedBlob[7]   = reader.ReadByte();
                fixedBlob[246] = reader.ReadByte();
                fixedBlob[118] = reader.ReadByte();
                fixedBlob[64]  = reader.ReadByte();
                fixedBlob[131] = reader.ReadByte();
                fixedBlob[113] = reader.ReadByte();
                fixedBlob[100] = reader.ReadByte();
                fixedBlob[27]  = reader.ReadByte();
                fixedBlob[40]  = reader.ReadByte();
                fixedBlob[78]  = reader.ReadByte();
                fixedBlob[209] = reader.ReadByte();
                fixedBlob[14]  = reader.ReadByte();
                fixedBlob[203] = reader.ReadByte();
                fixedBlob[141] = reader.ReadByte();
                fixedBlob[108] = reader.ReadByte();
                fixedBlob[188] = reader.ReadByte();
                fixedBlob[195] = reader.ReadByte();
                fixedBlob[102] = reader.ReadByte();
                fixedBlob[211] = reader.ReadByte();
                fixedBlob[193] = reader.ReadByte();
                fixedBlob[89]  = reader.ReadByte();
                fixedBlob[93]  = reader.ReadByte();
                fixedBlob[227] = reader.ReadByte();
                fixedBlob[214] = reader.ReadByte();
                fixedBlob[256] = reader.ReadByte();
                fixedBlob[43]  = reader.ReadByte();
                fixedBlob[187] = reader.ReadByte();
                fixedBlob[115] = reader.ReadByte();
                fixedBlob[245] = reader.ReadByte();
                fixedBlob[192] = reader.ReadByte();
                fixedBlob[244] = reader.ReadByte();
                fixedBlob[60]  = reader.ReadByte();
                fixedBlob[207] = reader.ReadByte();
                fixedBlob[30]  = reader.ReadByte();
                fixedBlob[1]   = reader.ReadByte();
                fixedBlob[179] = reader.ReadByte();
                fixedBlob[56]  = reader.ReadByte();
                fixedBlob[86]  = reader.ReadByte();
                fixedBlob[117] = reader.ReadByte();
                fixedBlob[198] = reader.ReadByte();
                fixedBlob[189] = reader.ReadByte();
                fixedBlob[74]  = reader.ReadByte();
                fixedBlob[122] = reader.ReadByte();
                fixedBlob[228] = reader.ReadByte();
                fixedBlob[45]  = reader.ReadByte();
                fixedBlob[183] = reader.ReadByte();
                fixedBlob[0]   = reader.ReadByte();
                fixedBlob[172] = reader.ReadByte();
                fixedBlob[136] = reader.ReadByte();
                fixedBlob[26]  = reader.ReadByte();
                fixedBlob[144] = reader.ReadByte();
                fixedBlob[28]  = reader.ReadByte();
                fixedBlob[171] = reader.ReadByte();
                fixedBlob[68]  = reader.ReadByte();
                fixedBlob[29]  = reader.ReadByte();
                fixedBlob[9]   = reader.ReadByte();
                fixedBlob[114] = reader.ReadByte();
                fixedBlob[25]  = reader.ReadByte();
                fixedBlob[110] = reader.ReadByte();
                fixedBlob[34]  = reader.ReadByte();
                fixedBlob[186] = reader.ReadByte();
                fixedBlob[152] = reader.ReadByte();
                fixedBlob[53]  = reader.ReadByte();
                fixedBlob[90]  = reader.ReadByte();
                fixedBlob[200] = reader.ReadByte();
                fixedBlob[51]  = reader.ReadByte();
                fixedBlob[10]  = reader.ReadByte();
                fixedBlob[119] = reader.ReadByte();
                fixedBlob[168] = reader.ReadByte();
                fixedBlob[77]  = reader.ReadByte();
                fixedBlob[88]  = reader.ReadByte();
                fixedBlob[137] = reader.ReadByte();
                fixedBlob[103] = reader.ReadByte();
                fixedBlob[139] = reader.ReadByte();
                fixedBlob[11]  = reader.ReadByte();
                fixedBlob[31]  = reader.ReadByte();
                fixedBlob[12]  = reader.ReadByte();
                fixedBlob[181] = reader.ReadByte();
                fixedBlob[49]  = reader.ReadByte();
                fixedBlob[39]  = reader.ReadByte();
                fixedBlob[215] = reader.ReadByte();
                fixedBlob[233] = reader.ReadByte();
                fixedBlob[85]  = reader.ReadByte();
                fixedBlob[145] = reader.ReadByte();
                fixedBlob[220] = reader.ReadByte();
                fixedBlob[249] = reader.ReadByte();
                fixedBlob[148] = reader.ReadByte();
                fixedBlob[236] = reader.ReadByte();
                fixedBlob[217] = reader.ReadByte();
                fixedBlob[216] = reader.ReadByte();
                fixedBlob[210] = reader.ReadByte();
                fixedBlob[2]   = reader.ReadByte();
                fixedBlob[127] = reader.ReadByte();
                fixedBlob[36]  = reader.ReadByte();
                fixedBlob[252] = reader.ReadByte();
                fixedBlob[164] = reader.ReadByte();
                fixedBlob[42]  = reader.ReadByte();
                fixedBlob[84]  = reader.ReadByte();
                fixedBlob[143] = reader.ReadByte();
                fixedBlob[126] = reader.ReadByte();
                fixedBlob[169] = reader.ReadByte();
                fixedBlob[22]  = reader.ReadByte();
                fixedBlob[212] = reader.ReadByte();
                fixedBlob[67]  = reader.ReadByte();
                fixedBlob[255] = reader.ReadByte();
                fixedBlob[175] = reader.ReadByte();
                fixedBlob[47]  = reader.ReadByte();
                fixedBlob[99]  = reader.ReadByte();
                fixedBlob[226] = reader.ReadByte();
                fixedBlob[105] = reader.ReadByte();
                fixedBlob[80]  = reader.ReadByte();
                fixedBlob[55]  = reader.ReadByte();
                fixedBlob[161] = reader.ReadByte();
                fixedBlob[15]  = reader.ReadByte();
                fixedBlob[194] = reader.ReadByte();
                fixedBlob[95]  = reader.ReadByte();
                fixedBlob[241] = reader.ReadByte();
                fixedBlob[128] = reader.ReadByte();
                fixedBlob[138] = reader.ReadByte();
                fixedBlob[123] = reader.ReadByte();
                fixedBlob[230] = reader.ReadByte();
                fixedBlob[62]  = reader.ReadByte();
                fixedBlob[158] = reader.ReadByte();
                fixedBlob[20]  = reader.ReadByte();
                fixedBlob[250] = reader.ReadByte();
                fixedBlob[222] = reader.ReadByte();
                fixedBlob[153] = reader.ReadByte();
                fixedBlob[106] = reader.ReadByte();
                fixedBlob[170] = reader.ReadByte();
                fixedBlob[235] = reader.ReadByte();
                fixedBlob[182] = reader.ReadByte();
                fixedBlob[202] = reader.ReadByte();
                fixedBlob[234] = reader.ReadByte();
                fixedBlob[251] = reader.ReadByte();
                fixedBlob[150] = reader.ReadByte();
                fixedBlob[71]  = reader.ReadByte();
                fixedBlob[162] = reader.ReadByte();
                fixedBlob[167] = reader.ReadByte();
                fixedBlob[83]  = reader.ReadByte();
                fixedBlob[163] = reader.ReadByte();
                fixedBlob[120] = reader.ReadByte();
                fixedBlob[61]  = reader.ReadByte();
                fixedBlob[232] = reader.ReadByte();
                fixedBlob[196] = reader.ReadByte();
                fixedBlob[109] = reader.ReadByte();
                fixedBlob[155] = reader.ReadByte();
                fixedBlob[125] = reader.ReadByte();
                fixedBlob[204] = reader.ReadByte();
                fixedBlob[242] = reader.ReadByte();
                fixedBlob[48]  = reader.ReadByte();
                fixedBlob[248] = reader.ReadByte();
                fixedBlob[208] = reader.ReadByte();
                fixedBlob[238] = reader.ReadByte();
                fixedBlob[166] = reader.ReadByte();
                fixedBlob[160] = reader.ReadByte();
                fixedBlob[97]  = reader.ReadByte();
                fixedBlob[75]  = reader.ReadByte();
                fixedBlob[41]  = reader.ReadByte();
                fixedBlob[157] = reader.ReadByte();
                fixedBlob[154] = reader.ReadByte();
                fixedBlob[191] = reader.ReadByte();
                fixedBlob[4]   = reader.ReadByte();
                fixedBlob[73]  = reader.ReadByte();
                fixedBlob[247] = reader.ReadByte();
                fixedBlob[63]  = reader.ReadByte();
                fixedBlob[107] = reader.ReadByte();
                fixedBlob[101] = reader.ReadByte();
                fixedBlob[104] = reader.ReadByte();
                fixedBlob[130] = reader.ReadByte();
                fixedBlob[174] = reader.ReadByte();
                fixedBlob[180] = reader.ReadByte();
                fixedBlob[151] = reader.ReadByte();
                fixedBlob[65]  = reader.ReadByte();
                fixedBlob[225] = reader.ReadByte();
                fixedBlob[176] = reader.ReadByte();
                fixedBlob[87]  = reader.ReadByte();
                fixedBlob[124] = reader.ReadByte();
                fixedBlob[135] = reader.ReadByte();
                fixedBlob[231] = reader.ReadByte();
                fixedBlob[173] = reader.ReadByte();
                fixedBlob[46]  = reader.ReadByte();
                fixedBlob[185] = reader.ReadByte();
                fixedBlob[98]  = reader.ReadByte();
                fixedBlob[213] = reader.ReadByte();
                fixedBlob[112] = reader.ReadByte();
                fixedBlob[146] = reader.ReadByte();
                fixedBlob[229] = reader.ReadByte();
                fixedBlob[140] = reader.ReadByte();
                fixedBlob[240] = reader.ReadByte();
                fixedBlob[129] = reader.ReadByte();
                fixedBlob[257] = reader.ReadByte();
                fixedBlob[32]  = reader.ReadByte();
                fixedBlob[3]   = reader.ReadByte();
                fixedBlob[5]   = reader.ReadByte();
                fixedBlob[79]  = reader.ReadByte();
                fixedBlob[50]  = reader.ReadByte();
                fixedBlob[206] = reader.ReadByte();
                fixedBlob[239] = reader.ReadByte();
                fixedBlob[219] = reader.ReadByte();
                fixedBlob[59]  = reader.ReadByte();
                fixedBlob[205] = reader.ReadByte();
                fixedBlob[132] = reader.ReadByte();
                fixedBlob[76]  = reader.ReadByte();
                fixedBlob[199] = reader.ReadByte();
                fixedBlob[223] = reader.ReadByte();
                fixedBlob[54]  = reader.ReadByte();
                fixedBlob[35]  = reader.ReadByte();
                fixedBlob[82]  = reader.ReadByte();
                fixedBlob[13]  = reader.ReadByte();
                fixedBlob[57]  = reader.ReadByte();
                fixedBlob[70]  = reader.ReadByte();
                fixedBlob[218] = reader.ReadByte();
                fixedBlob[133] = reader.ReadByte();
                fixedBlob[237] = reader.ReadByte();
                fixedBlob[21]  = reader.ReadByte();
                fixedBlob[52]  = reader.ReadByte();
                fixedBlob[23]  = reader.ReadByte();
                fixedBlob[147] = reader.ReadByte();
                fixedBlob[197] = reader.ReadByte();
                fixedBlob[177] = reader.ReadByte();
                fixedBlob[16]  = reader.ReadByte();
                fixedBlob[184] = reader.ReadByte();
                fixedBlob[33]  = reader.ReadByte();
                fixedBlob[94]  = reader.ReadByte();
                fixedBlob[72]  = reader.ReadByte();
                fixedBlob[190] = reader.ReadByte();
                fixedBlob[8]   = reader.ReadByte();
                fixedBlob[178] = reader.ReadByte();
                fixedBlob[159] = reader.ReadByte();
                fixedBlob[224] = reader.ReadByte();
                fixedBlob[201] = reader.ReadByte();
                fixedBlob[37]  = reader.ReadByte();
                fixedBlob[254] = reader.ReadByte();
                fixedBlob[134] = reader.ReadByte();
                fixedBlob[116] = reader.ReadByte();
                fixedBlob[58]  = reader.ReadByte();
                fixedBlob[156] = reader.ReadByte();
                fixedBlob[81]  = reader.ReadByte();
                fixedBlob[142] = reader.ReadByte();
                fixedBlob[6]   = reader.ReadByte();
                fixedBlob[24]  = reader.ReadByte();
                fixedBlob[121] = reader.ReadByte();
                fixedBlob[38]  = reader.ReadByte();
                fixedBlob[253] = reader.ReadByte();
            }

            return(fixedBlob);
        }
Exemple #33
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 #34
0
        private void ReadObjectCreateUpdate(StreamHandler Reader)
        {
            var guid = Reader.ReadPackedGuid();
            var type = (ObjectTypeId)Reader.ReadByte();

            WowObject obj;

            switch (type)
            {
                case ObjectTypeId.Container:
                    obj = new WowContainer();
                    break;
                case ObjectTypeId.Corpse:
                    obj = new WowCorpse();
                    break;
                case ObjectTypeId.DynamicObject:
                    obj = new WowDynamicObject();
                    break;
                case ObjectTypeId.GameObject:
                    obj = new WowGameObject();
                    break;
                case ObjectTypeId.Item:
                    obj = new WowItem();
                    break;
                case ObjectTypeId.Object:
                default:
                    throw new Exception("Cannot instantiate an object with TypeId=" + type);
                case ObjectTypeId.Player:
                    obj = new WowPlayer();
                    break;
                case ObjectTypeId.Unit:
                    obj = new WowUnit();
                    break;
                case ObjectTypeId.AreaTrigger:
                    obj = new WowAreaTrigger();
                    break;
            }

            obj.Guid = guid;
            obj.MovementData = new MovementInfo(Reader);
            obj.SetValues(ReadValues(Reader));
            obj.ResetUpdatedFields();

            if (!m_createdObjects.ContainsKey(guid))
                m_createdObjects.Add(guid, obj);
            else
                Console.WriteLine("Error: Created object duplicate guid {0}", guid);
        }
Exemple #35
0
        private UpdateFields ReadValues(StreamHandler Reader)
        {
            var values = new UpdateFields();

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

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

            var mask = new BitArray(updatemask);

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

            return values;
        }
Exemple #36
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);
        }
 protected void ReadByteSeq(StreamHandler reader, ref byte b)
 {
     if (b != 0)
         b ^= reader.ReadByte();
 }
Exemple #38
0
        public override void Read(StreamHandler reader)
        {
            this.UpdateType = (LFGUpdateType)reader.ReadByte();
            this.ExtraData = reader.ReadBoolean();
            if (ExtraData)
            {
                this.Queued = reader.ReadBoolean();

                reader.Skip(2); // 2 bools

                uint count = reader.ReadByte();
                Dungeons = new DungeonEntry[count];
                for (uint i = 0; i < count; ++i)
                    Dungeons[i] = new DungeonEntry(reader.ReadUInt32());

                this.Comment = reader.ReadCString();
            }
        }
        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 #40
0
        public void Read(StreamHandler Reader)
        {
            Slot = Reader.ReadByte();
            Spell = Reader.ReadUInt32();

            Caster = Unit;

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

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

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

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

                if ((Flags & AuraFlags.BasePoints) != 0)
                {
                    for (int i = 0; i < MaxEffects; ++i)
                    {
                        if ((Flags & (AuraFlags)(1 << i)) != 0)
                            BasePoints[i] = Reader.ReadInt32();
                        else
                            BasePoints[i] = 0;
                    }
                }
                else
                    Array.Clear(BasePoints, 0, MaxEffects);
            }
        }
        private static byte[] FixBlob(byte[] blob)
        {
            var fixedBlob = new byte[260];

            using (var reader = new StreamHandler(blob))
            {
                fixedBlob[91] = reader.ReadByte();
                fixedBlob[149] = reader.ReadByte();
                fixedBlob[96] = reader.ReadByte();
                fixedBlob[44] = reader.ReadByte();
                fixedBlob[92] = reader.ReadByte();
                fixedBlob[66] = reader.ReadByte();
                fixedBlob[165] = reader.ReadByte();
                fixedBlob[111] = reader.ReadByte();
                fixedBlob[221] = reader.ReadByte();
                fixedBlob[243] = reader.ReadByte();
                fixedBlob[69] = reader.ReadByte();
                fixedBlob[7] = reader.ReadByte();
                fixedBlob[246] = reader.ReadByte();
                fixedBlob[118] = reader.ReadByte();
                fixedBlob[64] = reader.ReadByte();
                fixedBlob[131] = reader.ReadByte();
                fixedBlob[113] = reader.ReadByte();
                fixedBlob[100] = reader.ReadByte();
                fixedBlob[27] = reader.ReadByte();
                fixedBlob[40] = reader.ReadByte();
                fixedBlob[78] = reader.ReadByte();
                fixedBlob[209] = reader.ReadByte();
                fixedBlob[14] = reader.ReadByte();
                fixedBlob[203] = reader.ReadByte();
                fixedBlob[141] = reader.ReadByte();
                fixedBlob[108] = reader.ReadByte();
                fixedBlob[188] = reader.ReadByte();
                fixedBlob[195] = reader.ReadByte();
                fixedBlob[102] = reader.ReadByte();
                fixedBlob[211] = reader.ReadByte();
                fixedBlob[193] = reader.ReadByte();
                fixedBlob[89] = reader.ReadByte();
                fixedBlob[93] = reader.ReadByte();
                fixedBlob[227] = reader.ReadByte();
                fixedBlob[214] = reader.ReadByte();
                fixedBlob[256] = reader.ReadByte();
                fixedBlob[43] = reader.ReadByte();
                fixedBlob[187] = reader.ReadByte();
                fixedBlob[115] = reader.ReadByte();
                fixedBlob[245] = reader.ReadByte();
                fixedBlob[192] = reader.ReadByte();
                fixedBlob[244] = reader.ReadByte();
                fixedBlob[60] = reader.ReadByte();
                fixedBlob[207] = reader.ReadByte();
                fixedBlob[30] = reader.ReadByte();
                fixedBlob[1] = reader.ReadByte();
                fixedBlob[179] = reader.ReadByte();
                fixedBlob[56] = reader.ReadByte();
                fixedBlob[86] = reader.ReadByte();
                fixedBlob[117] = reader.ReadByte();
                fixedBlob[198] = reader.ReadByte();
                fixedBlob[189] = reader.ReadByte();
                fixedBlob[74] = reader.ReadByte();
                fixedBlob[122] = reader.ReadByte();
                fixedBlob[228] = reader.ReadByte();
                fixedBlob[45] = reader.ReadByte();
                fixedBlob[183] = reader.ReadByte();
                fixedBlob[0] = reader.ReadByte();
                fixedBlob[172] = reader.ReadByte();
                fixedBlob[136] = reader.ReadByte();
                fixedBlob[26] = reader.ReadByte();
                fixedBlob[144] = reader.ReadByte();
                fixedBlob[28] = reader.ReadByte();
                fixedBlob[171] = reader.ReadByte();
                fixedBlob[68] = reader.ReadByte();
                fixedBlob[29] = reader.ReadByte();
                fixedBlob[9] = reader.ReadByte();
                fixedBlob[114] = reader.ReadByte();
                fixedBlob[25] = reader.ReadByte();
                fixedBlob[110] = reader.ReadByte();
                fixedBlob[34] = reader.ReadByte();
                fixedBlob[186] = reader.ReadByte();
                fixedBlob[152] = reader.ReadByte();
                fixedBlob[53] = reader.ReadByte();
                fixedBlob[90] = reader.ReadByte();
                fixedBlob[200] = reader.ReadByte();
                fixedBlob[51] = reader.ReadByte();
                fixedBlob[10] = reader.ReadByte();
                fixedBlob[119] = reader.ReadByte();
                fixedBlob[168] = reader.ReadByte();
                fixedBlob[77] = reader.ReadByte();
                fixedBlob[88] = reader.ReadByte();
                fixedBlob[137] = reader.ReadByte();
                fixedBlob[103] = reader.ReadByte();
                fixedBlob[139] = reader.ReadByte();
                fixedBlob[11] = reader.ReadByte();
                fixedBlob[31] = reader.ReadByte();
                fixedBlob[12] = reader.ReadByte();
                fixedBlob[181] = reader.ReadByte();
                fixedBlob[49] = reader.ReadByte();
                fixedBlob[39] = reader.ReadByte();
                fixedBlob[215] = reader.ReadByte();
                fixedBlob[233] = reader.ReadByte();
                fixedBlob[85] = reader.ReadByte();
                fixedBlob[145] = reader.ReadByte();
                fixedBlob[220] = reader.ReadByte();
                fixedBlob[249] = reader.ReadByte();
                fixedBlob[148] = reader.ReadByte();
                fixedBlob[236] = reader.ReadByte();
                fixedBlob[217] = reader.ReadByte();
                fixedBlob[216] = reader.ReadByte();
                fixedBlob[210] = reader.ReadByte();
                fixedBlob[2] = reader.ReadByte();
                fixedBlob[127] = reader.ReadByte();
                fixedBlob[36] = reader.ReadByte();
                fixedBlob[252] = reader.ReadByte();
                fixedBlob[164] = reader.ReadByte();
                fixedBlob[42] = reader.ReadByte();
                fixedBlob[84] = reader.ReadByte();
                fixedBlob[143] = reader.ReadByte();
                fixedBlob[126] = reader.ReadByte();
                fixedBlob[169] = reader.ReadByte();
                fixedBlob[22] = reader.ReadByte();
                fixedBlob[212] = reader.ReadByte();
                fixedBlob[67] = reader.ReadByte();
                fixedBlob[255] = reader.ReadByte();
                fixedBlob[175] = reader.ReadByte();
                fixedBlob[47] = reader.ReadByte();
                fixedBlob[99] = reader.ReadByte();
                fixedBlob[226] = reader.ReadByte();
                fixedBlob[105] = reader.ReadByte();
                fixedBlob[80] = reader.ReadByte();
                fixedBlob[55] = reader.ReadByte();
                fixedBlob[161] = reader.ReadByte();
                fixedBlob[15] = reader.ReadByte();
                fixedBlob[194] = reader.ReadByte();
                fixedBlob[95] = reader.ReadByte();
                fixedBlob[241] = reader.ReadByte();
                fixedBlob[128] = reader.ReadByte();
                fixedBlob[138] = reader.ReadByte();
                fixedBlob[123] = reader.ReadByte();
                fixedBlob[230] = reader.ReadByte();
                fixedBlob[62] = reader.ReadByte();
                fixedBlob[158] = reader.ReadByte();
                fixedBlob[20] = reader.ReadByte();
                fixedBlob[250] = reader.ReadByte();
                fixedBlob[222] = reader.ReadByte();
                fixedBlob[153] = reader.ReadByte();
                fixedBlob[106] = reader.ReadByte();
                fixedBlob[170] = reader.ReadByte();
                fixedBlob[235] = reader.ReadByte();
                fixedBlob[182] = reader.ReadByte();
                fixedBlob[202] = reader.ReadByte();
                fixedBlob[234] = reader.ReadByte();
                fixedBlob[251] = reader.ReadByte();
                fixedBlob[150] = reader.ReadByte();
                fixedBlob[71] = reader.ReadByte();
                fixedBlob[162] = reader.ReadByte();
                fixedBlob[167] = reader.ReadByte();
                fixedBlob[83] = reader.ReadByte();
                fixedBlob[163] = reader.ReadByte();
                fixedBlob[120] = reader.ReadByte();
                fixedBlob[61] = reader.ReadByte();
                fixedBlob[232] = reader.ReadByte();
                fixedBlob[196] = reader.ReadByte();
                fixedBlob[109] = reader.ReadByte();
                fixedBlob[155] = reader.ReadByte();
                fixedBlob[125] = reader.ReadByte();
                fixedBlob[204] = reader.ReadByte();
                fixedBlob[242] = reader.ReadByte();
                fixedBlob[48] = reader.ReadByte();
                fixedBlob[248] = reader.ReadByte();
                fixedBlob[208] = reader.ReadByte();
                fixedBlob[238] = reader.ReadByte();
                fixedBlob[166] = reader.ReadByte();
                fixedBlob[160] = reader.ReadByte();
                fixedBlob[97] = reader.ReadByte();
                fixedBlob[75] = reader.ReadByte();
                fixedBlob[41] = reader.ReadByte();
                fixedBlob[157] = reader.ReadByte();
                fixedBlob[154] = reader.ReadByte();
                fixedBlob[191] = reader.ReadByte();
                fixedBlob[4] = reader.ReadByte();
                fixedBlob[73] = reader.ReadByte();
                fixedBlob[247] = reader.ReadByte();
                fixedBlob[63] = reader.ReadByte();
                fixedBlob[107] = reader.ReadByte();
                fixedBlob[101] = reader.ReadByte();
                fixedBlob[104] = reader.ReadByte();
                fixedBlob[130] = reader.ReadByte();
                fixedBlob[174] = reader.ReadByte();
                fixedBlob[180] = reader.ReadByte();
                fixedBlob[151] = reader.ReadByte();
                fixedBlob[65] = reader.ReadByte();
                fixedBlob[225] = reader.ReadByte();
                fixedBlob[176] = reader.ReadByte();
                fixedBlob[87] = reader.ReadByte();
                fixedBlob[124] = reader.ReadByte();
                fixedBlob[135] = reader.ReadByte();
                fixedBlob[231] = reader.ReadByte();
                fixedBlob[173] = reader.ReadByte();
                fixedBlob[46] = reader.ReadByte();
                fixedBlob[185] = reader.ReadByte();
                fixedBlob[98] = reader.ReadByte();
                fixedBlob[213] = reader.ReadByte();
                fixedBlob[112] = reader.ReadByte();
                fixedBlob[146] = reader.ReadByte();
                fixedBlob[229] = reader.ReadByte();
                fixedBlob[140] = reader.ReadByte();
                fixedBlob[240] = reader.ReadByte();
                fixedBlob[129] = reader.ReadByte();
                fixedBlob[257] = reader.ReadByte();
                fixedBlob[32] = reader.ReadByte();
                fixedBlob[3] = reader.ReadByte();
                fixedBlob[5] = reader.ReadByte();
                fixedBlob[79] = reader.ReadByte();
                fixedBlob[50] = reader.ReadByte();
                fixedBlob[206] = reader.ReadByte();
                fixedBlob[239] = reader.ReadByte();
                fixedBlob[219] = reader.ReadByte();
                fixedBlob[59] = reader.ReadByte();
                fixedBlob[205] = reader.ReadByte();
                fixedBlob[132] = reader.ReadByte();
                fixedBlob[76] = reader.ReadByte();
                fixedBlob[199] = reader.ReadByte();
                fixedBlob[223] = reader.ReadByte();
                fixedBlob[54] = reader.ReadByte();
                fixedBlob[35] = reader.ReadByte();
                fixedBlob[82] = reader.ReadByte();
                fixedBlob[13] = reader.ReadByte();
                fixedBlob[57] = reader.ReadByte();
                fixedBlob[70] = reader.ReadByte();
                fixedBlob[218] = reader.ReadByte();
                fixedBlob[133] = reader.ReadByte();
                fixedBlob[237] = reader.ReadByte();
                fixedBlob[21] = reader.ReadByte();
                fixedBlob[52] = reader.ReadByte();
                fixedBlob[23] = reader.ReadByte();
                fixedBlob[147] = reader.ReadByte();
                fixedBlob[197] = reader.ReadByte();
                fixedBlob[177] = reader.ReadByte();
                fixedBlob[16] = reader.ReadByte();
                fixedBlob[184] = reader.ReadByte();
                fixedBlob[33] = reader.ReadByte();
                fixedBlob[94] = reader.ReadByte();
                fixedBlob[72] = reader.ReadByte();
                fixedBlob[190] = reader.ReadByte();
                fixedBlob[8] = reader.ReadByte();
                fixedBlob[178] = reader.ReadByte();
                fixedBlob[159] = reader.ReadByte();
                fixedBlob[224] = reader.ReadByte();
                fixedBlob[201] = reader.ReadByte();
                fixedBlob[37] = reader.ReadByte();
                fixedBlob[254] = reader.ReadByte();
                fixedBlob[134] = reader.ReadByte();
                fixedBlob[116] = reader.ReadByte();
                fixedBlob[58] = reader.ReadByte();
                fixedBlob[156] = reader.ReadByte();
                fixedBlob[81] = reader.ReadByte();
                fixedBlob[142] = reader.ReadByte();
                fixedBlob[6] = reader.ReadByte();
                fixedBlob[24] = reader.ReadByte();
                fixedBlob[121] = reader.ReadByte();
                fixedBlob[38] = reader.ReadByte();
                fixedBlob[253] = reader.ReadByte();
            }

            return fixedBlob;
        }
Exemple #42
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 #43
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 #44
0
        public sealed override void Read(StreamHandler reader)
        {
            var seq_b = ByteSequence;
            var seq_m = MaskSequence;
            var b_xor = ByteXorValue;

            int size = seq_m.Count(x => x >= 0);

            if (size != seq_m.Length && this.IsMaskSequenceSwapped)
            {
                throw new InvalidOperationException("Cannot have elements in swapped MaskSequence.");
            }
            CheckSequences(seq_b, seq_m);

            if (this.IsMaskSequenceSwapped)
            {
                var seq_m_copy = new int[seq_m.Length];
                for (int i = 0; i < seq_m.Length;)
                {
                    var t = i;
                    for (int j = t + 8 - 1; j >= t; --j, ++i)
                    {
                        seq_m_copy[j] = seq_m[i];
                    }
                }
                seq_m = seq_m_copy;
            }

            //byte[] data = new byte[size];
            //var src = new BitArray(reader.ReadBytes(size / 8));
            //var dst = new BitArray(size);

            //for (int i = 0; i < size; ++i)
            //    dst[seq_m[i]] = src[i];

            //for (int i = 0; i < seq_b.Length; ++i)
            //{
            //    var el = seq_b[i];
            //    if (el < 0)
            //        ElementRead(reader, el);
            //    else if (dst[el])
            //        data[el] = (byte)(reader.ReadByte() ^ b_xor);
            //}

            byte[] data = new byte[size];
            var    dst  = new BitArray(size);

            for (int i = 0; i < seq_m.Length; ++i)
            {
                var el = seq_m[i];
                if (el < 0)
                {
                    ElementRead(reader, el);
                }
                else
                {
                    dst[el] = reader.UnalignedReadBit();
                }
            }

            for (int i = 0; i < seq_b.Length; ++i)
            {
                var el = seq_b[i];
                if (el < 0)
                {
                    ElementRead(reader, el);
                }
                else if (dst[el])
                {
                    data[el] = (byte)(reader.ReadByte() ^ b_xor);
                }
            }

            PackedRead(data);
        }