Skip to content

Commit

Permalink
Add multiple 4.4.0 packet handlers
Browse files Browse the repository at this point in the history
SMSG_AREA_TRIGGER_DENIED
SMSG_AREA_SPIRIT_HEALER_TIME
SMSG_ACTIVATE_TAXI_REPLY
SMSG_AREA_TRIGGER_MESSAGE
SMSG_AREA_TRIGGER_NO_CORPSE
SMSG_AREA_TRIGGER_RE_PATH
SMSG_ATTACK_SWING_ERROR
SMSG_AUCTION_CLOSED_NOTIFICATION
SMSG_AUCTION_COMMAND_RESULT
SMSG_AUCTION_HELLO_RESPONSE
SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT
SMSG_AUCTION_LIST_ITEMS_RESULT
SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT
SMSG_AUCTION_LIST_PENDING_SALES_RESULT
SMSG_AUCTION_OUTBID_NOTIFICATION
  • Loading branch information
funjoker committed Aug 4, 2024
1 parent 071971a commit e6daee8
Show file tree
Hide file tree
Showing 6 changed files with 403 additions and 0 deletions.
113 changes: 113 additions & 0 deletions WowPacketParserModule.V4_4_0_54481/Parsers/AreaTriggerHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
using System.Collections.Generic;
using WowPacketParser.Enums;
using WowPacketParser.Misc;
using WowPacketParser.Parsing;
using WowPacketParser.Store.Objects;

namespace WowPacketParserModule.V4_4_0_54481.Parsers
{
public static class AreaTriggerHandler
{
public static List<AreaTriggerCreatePropertiesSplinePoint> ReadAreaTriggerSpline(AreaTriggerCreateProperties createProperties, Packet packet, params object[] indexes)
{
packet.ReadInt32("TimeToTarget", indexes);
packet.ReadInt32("ElapsedTimeForMovement", indexes);

packet.ResetBitReader();

var pointCount = (int)packet.ReadBits("PointsCount", 16, indexes);
var points = new List<AreaTriggerCreatePropertiesSplinePoint>(pointCount);

for (var i = 0u; i < pointCount; ++i)
{
var point = packet.ReadVector3("Points", indexes, i);
if (createProperties != null)
{
points.Add(new AreaTriggerCreatePropertiesSplinePoint()
{
areatriggerGuid = createProperties.Guid,
Idx = i,
X = point.X,
Y = point.Y,
Z = point.Z
});
}
}

return points;
}

public static AreaTriggerCreatePropertiesOrbit ReadAreaTriggerOrbit(WowGuid areaTriggerGuid, Packet packet, params object[] indexes)
{
packet.ResetBitReader();
var orbit = new AreaTriggerCreatePropertiesOrbit();
orbit.areatriggerGuid = areaTriggerGuid;

var hasTarget = packet.ReadBit("HasPathTarget", indexes);
var hasCenter = packet.ReadBit("HasCenter", indexes);
orbit.CounterClockwise = packet.ReadBit("CounterClockwise", indexes);
orbit.CanLoop = packet.ReadBit("CanLoop", indexes);

packet.ReadUInt32("TimeToTarget", indexes);
packet.ReadInt32("ElapsedTimeForMovement", indexes);
orbit.StartDelay = packet.ReadUInt32("StartDelay", indexes);
orbit.CircleRadius = packet.ReadSingle("Radius", indexes);
orbit.BlendFromRadius = packet.ReadSingle("BlendFromRadius", indexes);
orbit.InitialAngle = packet.ReadSingle("InitialAngle", indexes);
orbit.ZOffset = packet.ReadSingle("ZOffset", indexes);

if (hasTarget)
packet.ReadPackedGuid128("PathTarget", indexes);

if (hasCenter)
packet.ReadVector3("Center", indexes);

return orbit;
}

[Parser(Opcode.SMSG_AREA_TRIGGER_DENIED)]
public static void HandleAreaTriggerDenied(Packet packet)
{
packet.ReadInt32("AreaTriggerID");
packet.ReadBit("Entered");
}

[Parser(Opcode.SMSG_AREA_TRIGGER_MESSAGE)]
public static void HandleAreaTriggerMessage(Packet packet)
{
packet.ReadUInt32("AreaTriggerID");
packet.ReadUInt32("MessageID");
}

public static void ReadAreaTriggerMovementScript(Packet packet, params object[] indexes)
{
packet.ReadInt32("SpellScriptID", indexes);
packet.ReadVector3("Center", indexes);
}

[Parser(Opcode.SMSG_AREA_TRIGGER_RE_PATH)]
public static void HandleAreaTriggerReShape(Packet packet)
{
packet.ReadPackedGuid128("TriggerGUID");

packet.ResetBitReader();
var hasAreaTriggerSpline = packet.ReadBit("HasAreaTriggerSpline");
var hasAreaTriggerOrbit = packet.ReadBit("HasAreaTriggerOrbit");
var hasAreaTriggerMovementScript = packet.ReadBit("HasAreaTriggerMovementScript");

if (hasAreaTriggerSpline)
ReadAreaTriggerSpline(null, packet, "Spline");

if (hasAreaTriggerMovementScript)
ReadAreaTriggerMovementScript(packet, "MovementScript");

if (hasAreaTriggerOrbit)
ReadAreaTriggerOrbit(null, packet, "Orbit");
}

[Parser(Opcode.SMSG_AREA_TRIGGER_NO_CORPSE)]
public static void HandleCorpseNull(Packet packet)
{
}
}
}
196 changes: 196 additions & 0 deletions WowPacketParserModule.V4_4_0_54481/Parsers/AuctionHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
using WowPacketParser.Enums;
using WowPacketParser.Misc;
using WowPacketParser.Parsing;
using CoreParsers = WowPacketParser.Parsing.Parsers;

namespace WowPacketParserModule.V4_4_0_54481.Parsers
{
public static class AuctionHandler
{
public static void ReadClientAuctionOwnerNotification(Packet packet, params object[] idx)
{
packet.ReadInt32<ItemId>("AuctionItemID", idx);
packet.ReadUInt64("BidAmount", idx);
Substructures.ItemHandler.ReadItemInstance(packet, idx, "Item");
}

public static void ReadAuctionBucketKey(Packet packet, params object[] idx)
{
packet.ReadBits("ItemID", 20, idx);
var hasBattlePetSpeciesID = packet.ReadBit("HasBattlePetSpeciesID", idx);
packet.ReadBits("ItemLevel", 11, idx);
var hasSuffixItemNameDescriptionID = packet.ReadBit("HasSuffixItemNameDescriptionID", idx);

if (hasBattlePetSpeciesID)
packet.ReadUInt16("BattlePetSpeciesID");

if (hasSuffixItemNameDescriptionID)
packet.ReadUInt16("SuffixItemNameDescriptionID");
}

public static void ReadCliAuctionItem(Packet packet, params object[] idx)
{

var hasItem = packet.ReadBit("HasItem", idx);
var enchantmentsCount = packet.ReadBits("EnchantmentsCount", 4, idx);
var gemsCount = packet.ReadBits("GemsCount", 2, idx);
var hasMinBid = packet.ReadBit("HasMinBid", idx);
var hasMinIncrement = packet.ReadBit("HasMinIncrement", idx);
var hasBuyoutPrice = packet.ReadBit("HasBuyoutPrice", idx);
var hasUnitPrice = packet.ReadBit("HasUnitPrice", idx);
var hasCensorServerSideInfo = packet.ReadBit("HasCensorServerSideInfo", idx);
var hasCensorBidInfo = packet.ReadBit("HasCensorBidInfo", idx);
var hasAuctionBucketKey = packet.ReadBit("HasAuctionBucketKey", idx);
var hasCreator = packet.ReadBit("HasCreator", idx);
var hasBidder = false;
var hasBidAmount = false;

if (!hasCensorBidInfo)
{
hasBidder = packet.ReadBit("HasBidder", idx);
hasBidAmount = packet.ReadBit("HasBidAmount", idx);
}

packet.ResetBitReader();

if (hasItem)
Substructures.ItemHandler.ReadItemInstance(packet, idx);

packet.ReadInt32("Count", idx);
packet.ReadInt32("Charges", idx);
packet.ReadInt32("Flags", idx);
packet.ReadInt32("AuctionItemID", idx);
packet.ReadPackedGuid128("Owner", idx);
packet.ReadInt32("DurationLeft", idx);
packet.ReadByte("DeleteReason", idx);

for (int i = 0; i < enchantmentsCount; i++)
Substructures.ItemHandler.ReadItemEnchantData(packet, idx, "Enchantments", i);

if (hasMinBid)
packet.ReadUInt64("MinBid", idx);

if (hasMinIncrement)
packet.ReadUInt64("MinIncrement", idx);

if (hasBuyoutPrice)
packet.ReadUInt64("BuyoutPrice", idx);

if (hasUnitPrice)
packet.ReadUInt64("UnitPrice", idx);

if (!hasCensorServerSideInfo)
{
packet.ReadPackedGuid128("ItemGUID", idx);
packet.ReadPackedGuid128("OwnerAccountID", idx);
packet.ReadInt32("EndTime", idx);
}

if (hasCreator)
packet.ReadPackedGuid128("Creator", idx);

if (!hasCensorBidInfo)
{
if (hasBidder)
packet.ReadPackedGuid128("Bidder", idx);

if (hasBidAmount)
packet.ReadInt64("BidAmount", idx);
}

for (int i = 0; i < gemsCount; i++)
Substructures.ItemHandler.ReadItemGemData(packet, idx, "Gems", i);

if (hasAuctionBucketKey)
ReadAuctionBucketKey(packet, idx, "AuctionBucketKey");
}

public static void ReadClientAuctionBidderNotification(Packet packet, params object[] idx)
{
packet.ReadInt32("AuctionHouseID", idx); // CONFIRM?
packet.ReadInt32<ItemId>("AuctionItemID", idx); // CONFIRM?
packet.ReadPackedGuid128("Bidder", idx);
Substructures.ItemHandler.ReadItemInstance(packet, idx, "Item");
}

[Parser(Opcode.SMSG_AUCTION_CLOSED_NOTIFICATION)]
public static void HandleAuctionClosedNotification(Packet packet)
{
ReadClientAuctionOwnerNotification(packet, "Info");

packet.ReadSingle("ProceedsMailDelay");
packet.ReadBit("Sold");
}

[Parser(Opcode.SMSG_AUCTION_COMMAND_RESULT)]
public static void HandleAuctionCommandResult(Packet packet)
{
packet.ReadUInt32("AuctionItemID");
packet.ReadUInt32E<AuctionHouseAction>("Command");
packet.ReadUInt32E<AuctionHouseError>("ErrorCode");
packet.ReadUInt32("BagResult");
packet.ReadPackedGuid128("Guid");
packet.ReadUInt64("MinIncrement");
packet.ReadUInt64("Money");
packet.ReadUInt32("DesiredDelay");
}

[Parser(Opcode.SMSG_AUCTION_HELLO_RESPONSE)]
public static void HandleServerAuctionHello(Packet packet)
{
packet.ReadPackedGuid128("Guid");
packet.ReadUInt32("PurchasedItemDeliveryDelay");
packet.ReadUInt32("CancelledItemDeliveryDelay");
packet.ReadUInt32("DeliveryDelay");
packet.ReadBit("OpenForBusiness");

CoreParsers.NpcHandler.LastGossipOption.Reset();
CoreParsers.NpcHandler.TempGossipOptionPOI.Reset();
}

[Parser(Opcode.SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT)]
[Parser(Opcode.SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT)]
public static void HandleAuctionListItemsResult(Packet packet)
{
var itemsCount = packet.ReadInt32("ItemsCount");
packet.ReadUInt32("TotalCount");
packet.ReadUInt32("DesiredDelay");

for (var i = 0; i < itemsCount; ++i)
ReadCliAuctionItem(packet, i);
}

[Parser(Opcode.SMSG_AUCTION_LIST_ITEMS_RESULT)]
public static void HandleListItemsResult(Packet packet)
{
var itemsCount = packet.ReadInt32("ItemsCount");
packet.ReadInt32("TotalCount");
packet.ReadInt32("DesiredDelay");

packet.ReadBit("OnlyUsable");
packet.ResetBitReader();

for (var i = 0; i < itemsCount; i++)
ReadCliAuctionItem(packet, i);
}

[Parser(Opcode.SMSG_AUCTION_LIST_PENDING_SALES_RESULT)]
public static void HandleAuctionListPendingSalesResult(Packet packet)
{
var mailsCount = packet.ReadInt32("MailsCount");
packet.ReadInt32("TotalNumRecords");

for (var i = 0; i < mailsCount; i++)
MailHandler.ReadMailListEntry(packet, i, "MailListEntry");
}

[Parser(Opcode.SMSG_AUCTION_OUTBID_NOTIFICATION)]
public static void HandleAuctionOutbitNotification(Packet packet)
{
ReadClientAuctionBidderNotification(packet, "Info");

packet.ReadUInt64("BidAmount");
packet.ReadUInt64("MinIncrement");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ namespace WowPacketParserModule.V4_4_0_54481.Parsers
{
public static class BattlegroundHandler
{
[Parser(Opcode.SMSG_AREA_SPIRIT_HEALER_TIME)]
public static void HandleAreaSpiritHealerTime(Packet packet)
{
packet.ReadPackedGuid128("HealerGuid");
packet.ReadUInt32("TimeLeft");
}

[Parser(Opcode.CMSG_ARENA_TEAM_ROSTER)]
public static void HandleArenaTeamQuery(Packet packet)
{
Expand Down
6 changes: 6 additions & 0 deletions WowPacketParserModule.V4_4_0_54481/Parsers/CombatHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public static void HandleAttackStartStop(Packet packet)
packet.ReadBit("NowDead");
}

[Parser(Opcode.SMSG_ATTACK_SWING_ERROR)]
public static void HandleAttackSwingError(Packet packet)
{
packet.ReadBitsE<AttackSwingErr>("Reason", 3);
}

[Parser(Opcode.SMSG_CANCEL_AUTO_REPEAT)]
public static void HandleCancelAutoRepeat(Packet packet)
{
Expand Down
Loading

0 comments on commit e6daee8

Please sign in to comment.