Skip to content

Commit

Permalink
Add 4.4.0 CMSG_PET_ACTION handler
Browse files Browse the repository at this point in the history
  • Loading branch information
funjoker committed Sep 13, 2024
1 parent 0eb2105 commit 4e860bb
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions WowPacketParserModule.V4_4_0_54481/Parsers/PetHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using System.Xml;
using WowPacketParser.Enums;
using WowPacketParser.Misc;
using WowPacketParser.Parsing;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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");
}
}
}

0 comments on commit 4e860bb

Please sign in to comment.