WowPacketParser icon indicating copy to clipboard operation
WowPacketParser copied to clipboard

[3.3.5] SMSG_ATTACKER_STATE_UPDATE structure

Open ariel- opened this issue 8 years ago • 2 comments

Description: SMSG_ATTACKER_STATE_UPDATE packet structure is wrong for 3.3.5 sniffs and does not match TrinityCore structure.

Current (wrong):

            var hitInfo = packet.ReadInt32E<SpellHitInfo>("HitInfo");
            packet.ReadPackedGuid("AttackerGUID");
            packet.ReadPackedGuid("TargetGUID");
            packet.ReadInt32("Damage");
            packet.ReadInt32("OverDamage");

            var subDmgCount = packet.ReadByte();
            for (var i = 0; i < subDmgCount; ++i)
            {
                packet.ReadInt32("SchoolMask", i);
                packet.ReadSingle("Float Damage", i);
                packet.ReadInt32("Int Damage", i);

                if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_PARTIAL_ABSORB | SpellHitInfo.HITINFO_FULL_ABSORB))
                    packet.ReadInt32("Damage Absorbed", i);

                if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_PARTIAL_RESIST | SpellHitInfo.HITINFO_FULL_RESIST))
                    packet.ReadInt32("Damage Resisted", i);
            }
...

Expected (correct):

            var hitInfo = packet.ReadInt32E<SpellHitInfo>("HitInfo");
            packet.ReadPackedGuid("AttackerGUID");
            packet.ReadPackedGuid("TargetGUID");
            packet.ReadInt32("Damage");
            packet.ReadInt32("OverDamage");

            var subDmgCount = packet.ReadByte();
            for (var i = 0; i < subDmgCount; ++i)
            {
                packet.ReadInt32("SchoolMask", i);
                packet.ReadSingle("Float Damage", i);
                packet.ReadInt32("Int Damage", i);
            }

            if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_PARTIAL_ABSORB | SpellHitInfo.HITINFO_FULL_ABSORB))
            {
                for (var i = 0; i < subDmgCount; ++i)
                    packet.ReadInt32("Damage Absorbed", i);
            }


            if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_PARTIAL_RESIST | SpellHitInfo.HITINFO_FULL_RESIST))
            {
                for (var i = 0; i < subDmgCount; ++i)
                    packet.ReadInt32("Damage Resisted", i);
            }
...

ariel- avatar Jan 22 '18 07:01 ariel-

Do you have any reference about the correct behavior? Maybe a sniff?

ennioVisco avatar Feb 14 '18 16:02 ennioVisco

There's a sniff on the repo which showcases the behaviour, also TrinityCore's own code showing the packet real structure (I don't change the WPP code myself because it has some version conditionals thrown around)

here specifically: https://github.com/TrinityCore/TrinityCore/blob/a93d74c8df26e836211092aaf79d0c199d25decc/src/server/game/Entities/Unit/Unit.cpp#L5460-L5488

ariel- avatar Feb 14 '18 19:02 ariel-