From 4e860bbdbedb33f82d2a1228938ff15e2c36988e Mon Sep 17 00:00:00 2001 From: funjoker Date: Fri, 13 Sep 2024 19:20:50 +0200 Subject: [PATCH] Add 4.4.0 CMSG_PET_ACTION handler --- .../Parsers/PetHandler.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/WowPacketParserModule.V4_4_0_54481/Parsers/PetHandler.cs b/WowPacketParserModule.V4_4_0_54481/Parsers/PetHandler.cs index b501267ca8..724066ce3c 100644 --- a/WowPacketParserModule.V4_4_0_54481/Parsers/PetHandler.cs +++ b/WowPacketParserModule.V4_4_0_54481/Parsers/PetHandler.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Xml; using WowPacketParser.Enums; using WowPacketParser.Misc; using WowPacketParser.Parsing; @@ -44,6 +45,42 @@ public static void ReadPetRenameData(Packet packet) packet.ReadWoWString("NewName", bits20); } + public static void ReadPetAction(Packet packet, params object[] indexes) + { + var action = packet.ReadUInt32(); + var value = action & 0x7FFFFF; + var type = (action >> 23) & 0x1F; + + switch (type) + { + case 1: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + { + packet.AddValue("SpellID", StoreGetters.GetName(StoreNameType.Spell, (int)value), indexes); + break; + } + case 6: + { + packet.AddValue("ReactState", (ReactState)value, indexes); + break; + } + case 7: + { + packet.AddValue("CommandState", (CommandState)value, indexes); + break; + } + } + } + [Parser(Opcode.CMSG_QUERY_PET_NAME)] public static void HandlePetNameQuery(Packet packet) { @@ -117,5 +154,16 @@ public static void HandlePetAbandon(Packet packet) { packet.ReadPackedGuid128("PetGUID"); } + + [Parser(Opcode.CMSG_PET_ACTION)] + public static void HandlePetAction(Packet packet) + { + packet.ReadPackedGuid128("PetGUID"); + + ReadPetAction(packet, "Action"); + + packet.ReadPackedGuid128("TargetGUID"); + packet.ReadVector3("ActionPosition"); + } } }