-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added parsing for treasure picker opcodes (TWW)
- Loading branch information
Showing
2 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
WowPacketParserModule.V11_0_0_55666/Parsers/QueryHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
| ||
using WowPacketParser.Enums; | ||
using WowPacketParser.Misc; | ||
using WowPacketParser.Parsing; | ||
|
||
namespace WowPacketParserModule.V11_0_0_55666.Parsers | ||
{ | ||
public static class QueryHandler | ||
{ | ||
[Parser(Opcode.CMSG_QUERY_TREASURE_PICKER)] | ||
public static void HandleQueryQuestRewards(Packet packet) | ||
{ | ||
packet.ReadInt32("QuestID"); | ||
packet.ReadInt32("TreasurePickerID"); | ||
} | ||
|
||
public static void ReadTreasurePickItem(Packet packet, params object[] indexes) | ||
{ | ||
Substructures.ItemHandler.ReadItemInstance(packet, indexes); | ||
packet.ReadUInt32("Quantity", indexes); | ||
var hasContextFlags = packet.ReadBit("HasContextFlags", indexes); | ||
packet.ResetBitReader(); | ||
|
||
if (hasContextFlags) | ||
packet.ReadInt32("ContextFlags", indexes); | ||
} | ||
|
||
public static void ReadTreasurePickCurrency(Packet packet, params object[] indexes) | ||
{ | ||
packet.ReadUInt32("CurrencyID", indexes); | ||
packet.ReadUInt32("Quantity", indexes); | ||
var hasContextFlags = packet.ReadBit("HasContextFlags", indexes); | ||
packet.ResetBitReader(); | ||
|
||
if (hasContextFlags) | ||
packet.ReadInt32("ContextFlags", indexes); | ||
} | ||
|
||
public static void ReadTreasurePickerBonus(Packet packet, params object[] indexes) | ||
{ | ||
var bonusItemCount = packet.ReadUInt32("BonusItemCount", indexes); | ||
var bonusCurrencyCount = packet.ReadUInt32("BonusCurrencyCount", indexes); | ||
packet.ReadUInt64("BonusMoney", indexes); | ||
packet.ReadBit("BonusContext", indexes); | ||
packet.ResetBitReader(); | ||
|
||
for (var i = 0; i < bonusItemCount; ++i) | ||
ReadTreasurePickItem(packet, indexes, i); | ||
|
||
for (var i = 0; i < bonusCurrencyCount; ++i) | ||
ReadTreasurePickCurrency(packet, indexes, i); | ||
} | ||
|
||
public static void ReadTreasurePick(Packet packet) | ||
{ | ||
var itemCount = packet.ReadUInt32("ItemCount"); | ||
var currencyCount = packet.ReadUInt32("CurrencyCount"); | ||
|
||
packet.ReadUInt64("Money"); | ||
|
||
var bonusCount = packet.ReadUInt32("BonusCount"); | ||
|
||
packet.ReadUInt32("Flags"); | ||
packet.ReadBit("IsChoice"); | ||
packet.ResetBitReader(); | ||
|
||
for (var i = 0; i < itemCount; ++i) | ||
ReadTreasurePickItem(packet, i); | ||
|
||
for (int i = 0; i < currencyCount; i++) | ||
ReadTreasurePickCurrency(packet, i); | ||
|
||
for (var i = 0; i < bonusCount; ++i) | ||
ReadTreasurePickerBonus(packet, i); | ||
} | ||
|
||
[Parser(Opcode.SMSG_TREASURE_PICKER_RESPONSE)] | ||
public static void HandleTreasurePickerResponse(Packet packet) | ||
{ | ||
packet.ReadUInt32("QuestID"); | ||
packet.ReadUInt32("TreasurePickerID"); | ||
ReadTreasurePick(packet); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters