Пример #1
0
        public static void HandleAuraUpdate(Packet packet)
        {
            packet.ReadBit("UpdateAll");
            var guid = packet.ReadPackedGuid128("UnitGUID");
            var count = packet.ReadUInt32("AurasCount");

            var auras = new List<Aura>();
            for (var i = 0; i < count; ++i)
            {
                var aura = new Aura();

                packet.ReadByte("Slot", i);

                packet.ResetBitReader();
                var hasAura = packet.ReadBit("HasAura", i);
                if (hasAura)
                {
                    aura.SpellId = (uint)packet.ReadInt32<SpellId>("SpellID", i);
                    if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_0_20173))
                        packet.ReadUInt32("SpellXSpellVisualID", i);
                    aura.AuraFlags = packet.ReadByteE<AuraFlagMoP>("Flags", i);
                    packet.ReadInt32("ActiveFlags", i);
                    aura.Level = packet.ReadUInt16("CastLevel", i);
                    aura.Charges = packet.ReadByte("Applications", i);

                    var int72 = packet.ReadUInt32("Int56 Count", i);
                    var effectCount = packet.ReadUInt32("Effect Count", i);

                    for (var j = 0; j < int72; ++j)
                        packet.ReadSingle("Points", i, j);

                    for (var j = 0; j < effectCount; ++j)
                        packet.ReadSingle("EstimatedPoints", i, j);

                    packet.ResetBitReader();
                    var hasCasterGUID = packet.ReadBit("HasCastUnit", i);
                    var hasDuration = packet.ReadBit("HasDuration", i);
                    var hasMaxDuration = packet.ReadBit("HasRemaining", i);

                    if (hasCasterGUID)
                        packet.ReadPackedGuid128("CastUnit", i);

                    aura.Duration = hasDuration ? packet.ReadInt32("Duration", i) : 0;
                    aura.MaxDuration = hasMaxDuration ? packet.ReadInt32("Remaining", i) : 0;

                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }
            }

            if (Storage.Objects.ContainsKey(guid))
            {
                var unit = Storage.Objects[guid].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                        unit.Auras = auras;
                    else
                        unit.AddedAuras.Add(auras);
                }
            }
        }
Пример #2
0
        public static void HandleAuraUpdate(Packet packet)
        {
            var guid = new byte[8];
            var powerGUID = new byte[8];

            packet.ReadBit(); // fake bit?

            packet.StartBitStream(guid, 6, 1, 0);

            var bits4 = (int)packet.ReadBits(24);

            packet.StartBitStream(guid, 2, 4);

            var hasPowerData = packet.ReadBit();

            var powerCount = 0u;
            if (hasPowerData)
            {
                packet.StartBitStream(powerGUID, 7, 0, 6);
                powerCount = packet.ReadBits(21);
                packet.StartBitStream(powerGUID, 3, 1, 2, 4, 5);
            }

            packet.StartBitStream(guid, 7, 3, 5);

            var hasAura = new bool[bits4];
            var hasCasterGUID = new bool[bits4];
            var hasDuration = new bool[bits4];
            var hasMaxDuration = new bool[bits4];
            var effectCount = new uint[bits4];
            var casterGUID = new byte[bits4][];
            var bitsEC = new uint[bits4];

            for (var i = 0; i < bits4; ++i)
            {
                hasAura[i] = packet.ReadBit();

                if (hasAura[i])
                {
                    hasMaxDuration[i] = packet.ReadBit();
                    effectCount[i] = packet.ReadBits(22);
                    hasCasterGUID[i] = packet.ReadBit();
                    if (hasCasterGUID[i])
                    {
                        casterGUID[i] = new byte[8];
                        packet.StartBitStream(casterGUID[i], 3, 0, 2, 6, 5, 7, 4, 1);
                    }

                    hasDuration[i] = packet.ReadBit();
                    bitsEC[i] = packet.ReadBits(22);
                }
            }

            var auras = new List<Aura>();
            for (var i = 0; i < bits4; ++i)
            {
                if (hasAura[i])
                {
                    var aura = new Aura();

                    aura.Duration = hasDuration[i] ? packet.ReadInt32("Duration", i) : 0;

                    if (hasCasterGUID[i])
                    {
                        packet.ParseBitStream(casterGUID[i], 0, 7, 5, 6, 1, 3, 2, 4);
                        packet.WriteGuid("Caster GUID", casterGUID[i], i);
                        aura.CasterGuid = new WowGuid64(BitConverter.ToUInt64(casterGUID[i], 0));
                    }
                    else
                        aura.CasterGuid = new WowGuid64();

                    aura.AuraFlags = packet.ReadByteE<AuraFlagMoP>("Flags", i);

                    for (var j = 0; j < effectCount[i]; ++j)
                        packet.ReadSingle("Effect Value", i, j);

                    aura.SpellId = packet.ReadUInt32("Spell Id", i);

                    aura.MaxDuration = hasMaxDuration[i] ? packet.ReadInt32("Max Duration", i) : 0;

                    for (var j = 0; j < bitsEC[i]; ++j)
                        packet.ReadSingle("FloatEA");

                    aura.Charges = packet.ReadByte("Charges", i);
                    packet.ReadInt32("Effect Mask", i);
                    aura.Level = packet.ReadUInt16("Caster Level", i);
                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }

                packet.ReadByte("Slot", i);
            }

            if (hasPowerData)
            {
                packet.ReadXORByte(powerGUID, 7);
                packet.ReadXORByte(powerGUID, 4);
                packet.ReadXORByte(powerGUID, 5);
                packet.ReadXORByte(powerGUID, 1);
                packet.ReadXORByte(powerGUID, 6);
                for (var i = 0; i < powerCount; ++i)
                {
                    packet.ReadInt32("Value", i);
                    packet.ReadInt32E<PowerType>("Power type", i); // Actually powertype for class
                }

                packet.ReadInt32("Attack power");
                packet.ReadInt32("Spell power");
                packet.ReadXORByte(powerGUID, 3);
                packet.ReadInt32("Current health");
                packet.ReadXORByte(powerGUID, 0);
                packet.ReadXORByte(powerGUID, 2);
                packet.WriteGuid("Power GUID", powerGUID);
            }

            packet.ParseBitStream(guid, 0, 4, 3, 7, 5, 6, 2, 1);

            packet.WriteGuid("Guid", guid);

            var GUID = new WowGuid64(BitConverter.ToUInt64(guid, 0));
            if (Storage.Objects.ContainsKey(GUID))
            {
                var unit = Storage.Objects[GUID].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                        unit.Auras = auras;
                    else
                        unit.AddedAuras.Add(auras);
                }
            }
        }
Пример #3
0
        private static Aura ReadAuraUpdateBlock(Packet packet, int i)
        {
            var aura = new Aura
            {
                Slot = packet.ReadByte("Slot", i)
            };

            var id = packet.ReadInt32<SpellId>("Spell ID", i);
            if (id <= 0)
                return null;
            aura.SpellId = (uint)id;

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333))
                aura.AuraFlags = packet.ReadInt16E<AuraFlag>("Flags", i);
            else
                aura.AuraFlags = packet.ReadByteE<AuraFlag>("Flags", i);

            aura.Level = packet.ReadByte("Level", i);

            aura.Charges = packet.ReadByte("Charges", i);

            aura.CasterGuid = !aura.AuraFlags.HasAnyFlag(AuraFlag.NotCaster) ? packet.ReadPackedGuid("Caster GUID", i) : new WowGuid64();

            if (aura.AuraFlags.HasAnyFlag(AuraFlag.Duration))
            {
                aura.MaxDuration = packet.ReadInt32("Max Duration", i);
                aura.Duration = packet.ReadInt32("Duration", i);
            }
            else
            {
                aura.MaxDuration = 0;
                aura.Duration = 0;
            }

            if (aura.AuraFlags.HasAnyFlag(AuraFlag.Scalable))
            {
                // This aura is scalable with level/talents
                // Here we show each effect value after scaling
                if (aura.AuraFlags.HasAnyFlag(AuraFlag.EffectIndex0))
                    packet.ReadInt32("Effect 0 Value", i);
                if (aura.AuraFlags.HasAnyFlag(AuraFlag.EffectIndex1))
                    packet.ReadInt32("Effect 1 Value", i);
                if (aura.AuraFlags.HasAnyFlag(AuraFlag.EffectIndex2))
                    packet.ReadInt32("Effect 2 Value", i);
            }

            packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");

            return aura;
        }
Пример #4
0
        private static Aura ReadAuraUpdateBlock505(Packet packet, int i)
        {
            var aura = new Aura
            {
                Slot = packet.ReadByte("Slot", i)
            };

            var id = packet.ReadInt32<SpellId>("Spell ID", i);
            if (id <= 0)
                return null;

            aura.SpellId = (uint)id;

            aura.AuraFlags = packet.ReadByteE<AuraFlagMoP>("Flags", i);

            var mask = packet.ReadUInt32("Effect Mask", i);

            aura.Level = (uint)packet.ReadInt16("Level", i);

            aura.Charges = packet.ReadByte("Charges", i);

            aura.CasterGuid = !aura.AuraFlags.HasAnyFlag(AuraFlagMoP.NoCaster) ? packet.ReadPackedGuid("Caster GUID", i) : new WowGuid64();

            if (aura.AuraFlags.HasAnyFlag(AuraFlagMoP.Duration))
            {
                aura.MaxDuration = packet.ReadInt32("Max Duration", i);
                aura.Duration = packet.ReadInt32("Duration", i);
            }
            else
            {
                aura.MaxDuration = 0;
                aura.Duration = 0;
            }

            if (aura.AuraFlags.HasAnyFlag(AuraFlagMoP.Scalable))
            {
                var b1 = packet.ReadByte("Effect Count", i);
                for (var j = 0; j < b1; ++j)
                    if (((1 << j) & mask) != 0)
                        packet.ReadSingle("Effect Value", i, j);
            }

            packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");

            return aura;
        }
Пример #5
0
        public static void HandleAuraUpdate(Packet packet)
        {
            var guid = new byte[8];
            var guid2 = new byte[8];

            guid[1] = packet.ReadBit();
            var hasPowerData = packet.ReadBit();

            uint bits3C = 0;
            if (hasPowerData)
            {
                packet.StartBitStream(guid2, 1, 5, 6);
                bits3C = packet.ReadBits(21);
                packet.StartBitStream(guid2, 2, 3, 7, 0, 4);
            }

            var bits4 = packet.ReadBits(24);
            guid[6] = packet.ReadBit();

            var hasAura = new bool[bits4];
            var hasCasterGUID = new bool[bits4];
            var hasDuration = new bool[bits4];
            var hasMaxDuration = new bool[bits4];
            var effectCount = new uint[bits4];
            var casterGUID = new byte[bits4][];
            for (var i = 0; i < bits4; ++i)
            {
                hasAura[i] = packet.ReadBit();
                if (hasAura[i])
                {
                    hasMaxDuration[i] = packet.ReadBit();
                    effectCount[i] = packet.ReadBits(22);
                    hasCasterGUID[i] = packet.ReadBit();
                    if (hasCasterGUID[i])
                    {
                        casterGUID[i] = new byte[8];
                        packet.StartBitStream(casterGUID[i], 5, 7, 4, 1, 6, 0, 3, 2);
                    }
                    hasDuration[i] = packet.ReadBit();
                }
            }
            packet.StartBitStream(guid, 2, 3, 7, 4);
            packet.ReadBit("Is AURA_UPDATE_ALL");
            packet.StartBitStream(guid, 0, 5);
            packet.ResetBitReader();

            var auras = new List<Aura>();
            for (var i = 0; i < bits4; ++i)
            {
                if (hasAura[i])
                {
                    var aura = new Aura();
                    if (hasCasterGUID[i])
                    {
                        packet.ParseBitStream(casterGUID[i], 2, 7, 6, 1, 4, 0, 5, 3);
                        packet.WriteGuid("Caster GUID", casterGUID[i], i);
                        aura.CasterGuid = new Guid(BitConverter.ToUInt64(casterGUID[i], 0));
                    }
                    else
                        aura.CasterGuid = new Guid();

                    aura.Charges = packet.ReadByte("Charges", i);

                    if (hasDuration[i])
                        aura.Duration = packet.ReadInt32("Duration", i);
                    else
                        aura.Duration = 0;

                    aura.SpellId = packet.ReadUInt32("Spell Id", i);
                    aura.AuraFlags = packet.ReadEnum<AuraFlagMoP>("Flags", TypeCode.Byte, i);

                    for (var j = 0; j < effectCount[i]; ++j)
                        packet.ReadSingle("Effect Value", i, j);
                    packet.ReadInt32("Effect Mask", i);

                    if (hasMaxDuration[i])
                        aura.MaxDuration = packet.ReadInt32("Max Duration", i);
                    else
                        aura.MaxDuration = 0;

                    aura.Level = packet.ReadUInt16("Caster Level", i);
                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }
                packet.ReadByte("Slot", i);
            }

            if (hasPowerData)
            {
                packet.ReadXORBytes(guid2, 7, 0);
                for (var i = 0; i < bits3C; ++i)
                {
                    packet.ReadEnum<PowerType>("Power Type", TypeCode.UInt32, i);
                    packet.ReadInt32("Power Value", i);
                }
                packet.ReadXORBytes(guid2, 2, 5);
                packet.ReadInt32("Attack power");
                packet.ReadInt32("Spell power");
                packet.ReadXORBytes(guid2, 6, 4, 3, 1);
                packet.ReadInt32("Current Health");
                packet.WriteGuid("PowerUnitGUID", guid2);
            }
            packet.ParseBitStream(guid, 0, 5, 7, 2, 1, 4, 3, 6);
            packet.WriteGuid("Guid", guid);

            var GUID = new Guid(BitConverter.ToUInt64(guid, 0));
            if (Storage.Objects.ContainsKey(GUID))
            {
                var unit = Storage.Objects[GUID].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                        unit.Auras = auras;
                    else if (unit.AddedAuras == null)
                        unit.AddedAuras = new List<List<Aura>> { auras };
                    else
                        unit.AddedAuras.Add(auras);
                }
            }
        }
Пример #6
0
        public static void HandleAuraUpdate(Packet packet)
        {
            var guid = new byte[8];

            guid[3] = packet.ReadBit();
            guid[6] = packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            guid[4] = packet.ReadBit();

            var bits0 = packet.ReadBits(24);

            var bit10 = packet.ReadBit();

            var hasAura = new bool[bits0];
            var hasCasterGUID = new bool[bits0];
            var hasMaxDuration = new bool[bits0];
            var hasDuration = new bool[bits0];
            var bits48 = new uint[bits0];
            var casterGUID = new byte[bits0][];
            var effectCount = new uint[bits0];

            for (var i = 0; i < bits0; ++i)
            {
                hasAura[i] = packet.ReadBit();

                if (hasAura[i])
                {
                    effectCount[i] = packet.ReadBits(22);
                    bits48[i] = packet.ReadBits(22);

                    hasCasterGUID[i] = packet.ReadBit();
                    if (hasCasterGUID[i])
                    {
                        casterGUID[i] = new byte[8];
                        packet.StartBitStream(casterGUID[i], 7, 4, 2, 5, 6, 1, 3, 0);
                    }

                    hasMaxDuration[i] = packet.ReadBit();
                    hasDuration[i] = packet.ReadBit();
                }
            }

            guid[1] = packet.ReadBit();
            guid[2] = packet.ReadBit();

            var auras = new List<Aura>();
            for (var i = 0; i < bits0; ++i)
            {
                if (hasAura[i])
                {
                    var aura = new Aura();
                    if (hasCasterGUID[i])
                    {
                        packet.ParseBitStream(casterGUID[i], 0, 3, 7, 1, 2, 5, 4, 6);
                        packet.WriteGuid("Caster GUID", casterGUID[i], i);
                        aura.CasterGuid = new WowGuid64(BitConverter.ToUInt64(casterGUID[i], 0));
                    }

                    aura.Duration = hasDuration[i] ? packet.ReadInt32("Duration", i) : 0;

                    for (var j = 0; j < bits48[i]; ++j)
                        packet.ReadSingle("Float3", i, j);

                    for (var j = 0; j < effectCount[i]; ++j)
                        packet.ReadSingle("Effect Value", i, j);

                    aura.Level = packet.ReadUInt16("Caster Level", i);

                    aura.MaxDuration = hasMaxDuration[i] ? packet.ReadInt32("Max Duration", i) : 0;

                    aura.Charges = packet.ReadByte("Charges", i);
                    aura.SpellId = packet.ReadUInt32("Spell Id", i);
                    aura.AuraFlags = packet.ReadByteE<AuraFlagMoP>("Flags", i);
                    packet.ReadInt32("Effect Mask", i);

                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }

                packet.ReadByte("Slot", i);
            }

            packet.ParseBitStream(guid, 5, 1, 2, 6, 0, 7, 4, 3);

            packet.WriteGuid("Guid", guid);

            var GUID = new WowGuid64(BitConverter.ToUInt64(guid, 0));
            if (Storage.Objects.ContainsKey(GUID))
            {
                var unit = Storage.Objects[GUID].Item1 as Unit;
                if (unit != null)
                {
                    // If this is the first packet that sends auras
                    // (hopefully at spawn time) add it to the "Auras" field,
                    // if not create another row of auras in AddedAuras
                    // (similar to ChangedUpdateFields)

                    if (unit.Auras == null)
                        unit.Auras = auras;
                    else
                        unit.AddedAuras.Add(auras);
                }
            }
        }
        public static Aura ReadAuraUpdateBlock(ref Packet packet)
        {
            var aura = new Aura();

            aura.Slot = packet.ReadByte("Slot");

            var id = packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Spell ID");
            if (id <= 0)
                return null;
            aura.SpellId = (uint)id;

            var type = ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333) ? TypeCode.Int16 : TypeCode.Byte;
            aura.AuraFlags = packet.ReadEnum<AuraFlag>("Flags", type);

            aura.Level = packet.ReadByte("Level");

            aura.Charges = packet.ReadByte("Charges");

            aura.CasterGuid = !aura.AuraFlags.HasAnyFlag(AuraFlag.NotCaster) ? packet.ReadPackedGuid("Caster GUID") : new Guid();

            if (aura.AuraFlags.HasAnyFlag(AuraFlag.Duration))
            {
                aura.MaxDuration = packet.ReadInt32("Max Duration");
                aura.Duration = packet.ReadInt32("Duration");
            }
            else // Is this needed?
            {
                aura.MaxDuration = 0;
                aura.Duration = 0;
            }

            if (aura.AuraFlags.HasAnyFlag(AuraFlag.Scalable))
            {
                // This aura is scalable with level/talents
                // Here we show each effect value after scaling
                if (aura.AuraFlags.HasAnyFlag(AuraFlag.EffectIndex0))
                    packet.ReadInt32("Effect 0 Value");
                if (aura.AuraFlags.HasAnyFlag(AuraFlag.EffectIndex1))
                    packet.ReadInt32("Effect 1 Value");
                if (aura.AuraFlags.HasAnyFlag(AuraFlag.EffectIndex2))
                    packet.ReadInt32("Effect 2 Value");
            }

            packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");

            return aura;
        }
Пример #8
0
        public static void HandleAuraUpdate(Packet packet)
        {
            var bits0 = 0;
            var guid2 = new byte[8];
            var bit18 = false;

            guid2[3] = packet.ReadBit();
            bit18 = packet.ReadBit();
            guid2[4] = packet.ReadBit();
            guid2[5] = packet.ReadBit();
            bits0 = (int)packet.ReadBits(24);
            guid2[7] = packet.ReadBit();
            guid2[6] = packet.ReadBit();

            var hasCasterGUID = new bool[bits0];
            var hasDuration = new bool[bits0];
            var hasMaxDuration = new bool[bits0];
            var hasAura = new bool[bits0];
            var effectCount = new uint[bits0];
            var bits48 = new uint[bits0];
            var casterGUID = new byte[bits0][];

            for (var i = 0; i < bits0; ++i)
            {
                hasAura[i] = packet.ReadBit();
                if (hasAura[i])
                {
                    hasMaxDuration[i] = packet.ReadBit();
                    bits48[i] = packet.ReadBits(22);
                    hasDuration[i] = packet.ReadBit();
                    hasCasterGUID[i] = packet.ReadBit();
                    effectCount[i] = packet.ReadBits(22);

                    if (hasCasterGUID[i])
                    {
                        casterGUID[i] = new byte[8];
                        packet.StartBitStream(casterGUID[i], 1, 6, 0, 7, 5, 3, 2, 4);
                    }
                }
            }

            guid2[2] = packet.ReadBit();
            guid2[0] = packet.ReadBit();
            guid2[1] = packet.ReadBit();

            var auras = new List<Aura>();
            for (var i = 0; i < bits0; ++i)
            {
                if (hasAura[i])
                {
                    var aura = new Aura();
                    if (hasCasterGUID[i])
                    {
                        packet.ParseBitStream(casterGUID[i], 2, 5, 6, 7, 0, 1, 4, 3);
                        packet.WriteGuid("Caster GUID", casterGUID[i], i);
                        aura.CasterGuid = new WowGuid(BitConverter.ToUInt64(casterGUID[i], 0));
                    }

                    for (var j = 0; j < bits48[i]; ++j)
                        packet.ReadSingle("FloatEM", i, j);

                    for (var j = 0; j < effectCount[i]; ++j)
                        packet.ReadSingle("Effect Value", i, j);

                    packet.ReadInt32("Effect Mask", i);
                    aura.AuraFlags = packet.ReadEnum<AuraFlagMoP>("Flags", TypeCode.Byte, i);
                    var id = packet.ReadEntry<Int32>(StoreNameType.Spell, "Spell ID", i);
                    aura.SpellId = (uint)id;
                    aura.Level = packet.ReadUInt16("Caster Level", i);
                    aura.Charges = packet.ReadByte("Charges", i);

                    if (hasMaxDuration[i])
                        aura.MaxDuration = packet.ReadInt32("Max Duration", i);
                    else
                        aura.MaxDuration = 0;

                    if (hasDuration[i])
                        aura.Duration = packet.ReadInt32("Duration", i);
                    else
                        aura.Duration = 0;
                }
                packet.ReadByte("Slot", i);
            }
            packet.ParseBitStream(guid2, 0, 1, 3, 4, 2, 6, 7, 5);
            packet.WriteGuid("GUID2", guid2);
        }
Пример #9
0
 public AuraPacket(DateTime _time, int _number, Aura _aura)
 {
     time = _time;
     number = _number;
     aura = _aura;
 }