Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.3.5] SMSG_ATTACKER_STATE_UPDATE structure #348

Open
ariel- opened this issue Jan 22, 2018 · 2 comments
Open

[3.3.5] SMSG_ATTACKER_STATE_UPDATE structure #348

ariel- opened this issue Jan 22, 2018 · 2 comments
Labels

Comments

@ariel-
Copy link
Contributor

ariel- commented Jan 22, 2018

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);
            }
...
@ennioVisco ennioVisco added the bug label Feb 14, 2018
@ennioVisco
Copy link
Member

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

@ariel-
Copy link
Contributor Author

ariel- commented Feb 14, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants