forked from TrinityCore/WowPacketParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
149,082 additions
and
36 deletions.
There are no files selected for viewing
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,22 @@ | ||
namespace WowPacketParser.Enums | ||
{ | ||
public enum ServiceHash : uint | ||
{ | ||
AccountService = 0x62DA0891, | ||
AuthenticationListener = 0x71240E35, | ||
AuthenticationService = 0xDECFC01, | ||
ChallengeService = 0xBBDA171F, | ||
ClubListener = 0x80909D73, | ||
ClubService = 0xE273DE0E, | ||
ClubMembershipListener = 0x2B34597B, | ||
ClubMembershipService = 0x94B94786, | ||
ConnectionService = 0x65446991, | ||
FriendsService = 0xA3DDB1BD, | ||
GameUtilitiesService = 0x3FC1274D, | ||
PresenceListener = 0x890AB85F, | ||
ReportService = 0x7CAF61C9, | ||
ReportServiceV2 = 0x3A4218FB, | ||
ResourceService = 0xECBE75BA, | ||
UserManagerService = 0x3E19268A | ||
} | ||
} |
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,22 @@ | ||
namespace WowPacketParser.Misc | ||
{ | ||
public struct MethodCall | ||
{ | ||
public MethodCall(ulong type, ulong objectId, uint token) | ||
{ | ||
Type = type; | ||
ObjectId = objectId; | ||
Token = token; | ||
} | ||
|
||
public ulong Type; | ||
|
||
public ulong ObjectId; | ||
|
||
public uint Token; | ||
|
||
public uint GetServiceHash() { return (uint)(Type >> 32); } | ||
|
||
public uint GetMethodId() { return (uint)(Type & 0xFFFFFFFF); } | ||
} | ||
} |
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
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,53 @@ | ||
using WowPacketParser.Enums; | ||
using WowPacketParser.Misc; | ||
|
||
namespace WowPacketParser.Parsing.Parsers | ||
{ | ||
public static class BattlenetProtoHandler | ||
{ | ||
public static MethodCall ReadMethodCall(Packet packet, params object[] idx) | ||
{ | ||
var method = new MethodCall(); | ||
|
||
method.Type = packet.ReadUInt64("Type", idx); | ||
method.ObjectId = packet.ReadUInt64("ObjectId", idx); | ||
method.Token = packet.ReadUInt32("Token", idx); | ||
|
||
return method; | ||
} | ||
|
||
public static void ReadProtoData(Packet packet, int length, MethodCall method, params object[] indexes) | ||
{ | ||
packet.AddValue("MethodCall", "ServiceHash: 0x" + method.GetServiceHash().ToString("X") + " MethodID: " + method.GetMethodId(), indexes); | ||
packet.ReadBytesTable("Message", length, indexes); | ||
} | ||
|
||
[Parser(Opcode.CMSG_BATTLENET_REQUEST)] | ||
public static void HandleBattlenetRequest(Packet packet) | ||
{ | ||
var method = ReadMethodCall(packet, "Method"); | ||
|
||
int protoSize = packet.ReadInt32(); | ||
ReadProtoData(packet, protoSize, method, "Data"); | ||
} | ||
|
||
[Parser(Opcode.SMSG_BATTLENET_NOTIFICATION)] | ||
public static void HandleBattlenetNotification(Packet packet) | ||
{ | ||
var method = ReadMethodCall(packet, "Method"); | ||
|
||
int protoSize = packet.ReadInt32(); | ||
ReadProtoData(packet, protoSize, method, "Data"); | ||
} | ||
|
||
[Parser(Opcode.SMSG_BATTLENET_RESPONSE)] | ||
public static void HandleBattlenetResponse(Packet packet) | ||
{ | ||
packet.ReadInt32E<BattlenetRpcErrorCode>("BnetStatus"); | ||
var method = ReadMethodCall(packet, "Method"); | ||
|
||
int protoSize = packet.ReadInt32(); | ||
ReadProtoData(packet, protoSize, method, "Data"); | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
WowPacketParserModule.V10_0_0_46181/Parsers/BattlenetProtoHandler1020.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,74 @@ | ||
using System; | ||
using System.Text.Json; | ||
using WowPacketParser.Enums; | ||
using WowPacketParser.Misc; | ||
using WowPacketParser.Parsing; | ||
|
||
namespace WowPacketParserModule.V10_0_0_46181.Protos.V10_2_0_52649 | ||
{ | ||
public static class BattlenetProtoHandler | ||
{ | ||
public static MethodCall ReadMethodCall(Packet packet, params object[] idx) | ||
{ | ||
var method = new MethodCall(); | ||
|
||
method.Type = packet.ReadUInt64("Type", idx); | ||
method.ObjectId = packet.ReadUInt64("ObjectId", idx); | ||
method.Token = packet.ReadUInt32("Token", idx); | ||
|
||
return method; | ||
} | ||
|
||
public static void ReadProtoData(Packet packet, int length, MethodCall method, params object[] indexes) | ||
{ | ||
var val = packet.ReadBytes(length); | ||
|
||
var parser = ProtobufParser.GetParser(method.GetServiceHash(), method.GetMethodId(), packet.Opcode); | ||
|
||
if (parser == null) | ||
{ | ||
packet.AddValue("MethodCall", "ServiceHash: 0x" + method.GetServiceHash().ToString("X") + " MethodID: " + method.GetMethodId(), indexes); | ||
packet.AddValue("Message", Convert.ToHexString(val), indexes); | ||
return; | ||
} | ||
|
||
packet.AddValue("Type", ProtobufParser.GetParserName(parser), indexes); | ||
|
||
var msg = parser.ParseFrom(val).ToString(); | ||
var formattedMsg = JsonSerializer.Serialize(JsonDocument.Parse(msg), new JsonSerializerOptions | ||
{ | ||
WriteIndented = true | ||
}); | ||
|
||
packet.AddValue("Message", System.Environment.NewLine + formattedMsg, indexes); | ||
} | ||
|
||
[Parser(Opcode.CMSG_BATTLENET_REQUEST)] | ||
public static void HandleBattlenetRequest(Packet packet) | ||
{ | ||
var method = ReadMethodCall(packet, "Method"); | ||
|
||
int protoSize = packet.ReadInt32(); | ||
ReadProtoData(packet, protoSize, method, "Data"); | ||
} | ||
|
||
[Parser(Opcode.SMSG_BATTLENET_NOTIFICATION)] | ||
public static void HandleBattlenetNotification(Packet packet) | ||
{ | ||
var method = ReadMethodCall(packet, "Method"); | ||
|
||
int protoSize = packet.ReadInt32(); | ||
ReadProtoData(packet, protoSize, method, "Data"); | ||
} | ||
|
||
[Parser(Opcode.SMSG_BATTLENET_RESPONSE)] | ||
public static void HandleBattlenetResponse(Packet packet) | ||
{ | ||
packet.ReadInt32E<BattlenetRpcErrorCode>("BnetStatus"); | ||
var method = ReadMethodCall(packet, "Method"); | ||
|
||
int protoSize = packet.ReadInt32(); | ||
ReadProtoData(packet, protoSize, method, "Data"); | ||
} | ||
} | ||
} |
Oops, something went wrong.