Skip to content

Commit 772ff15

Browse files
BAndyscDDuarte
authored andcommitted
Added support for it 6.2.4 HighGuidType (#238)
* HighGuidType enum has changed in 6.2.4, added support for it * Fix tests
1 parent 3ca3bdf commit 772ff15

File tree

4 files changed

+244
-47
lines changed

4 files changed

+244
-47
lines changed

WowPacketParser/Enums/HighGuidType.cs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,109 @@
11
namespace WowPacketParser.Enums
22
{
33
public enum HighGuidType
4+
{
5+
Null = 0,
6+
Uniq,
7+
Player,
8+
Item,
9+
WorldTransaction,
10+
StaticDoor,
11+
Transport,
12+
Conversation,
13+
Creature,
14+
Vehicle,
15+
Pet,
16+
GameObject,
17+
DynamicObject,
18+
AreaTrigger,
19+
Corpse,
20+
LootObject,
21+
SceneObject,
22+
Scenario,
23+
AIGroup,
24+
DynamicDoor,
25+
ClientActor,
26+
Vignette,
27+
CallForHelp,
28+
AIResource,
29+
AILock,
30+
AILockTicket,
31+
ChatChannel,
32+
Party,
33+
Guild,
34+
WowAccount,
35+
BNetAccount,
36+
GMTask,
37+
MobileSession,
38+
RaidGroup,
39+
Spell,
40+
Mail,
41+
WebObj,
42+
LFGObject,
43+
LFGList,
44+
UserRouter,
45+
PVPQueueGroup,
46+
UserClient,
47+
PetBattle,
48+
UniqUserClient,
49+
BattlePet,
50+
CommerceObj,
51+
ClientSession,
52+
};
53+
54+
public enum HighGuidType624
55+
{
56+
Null = 0,
57+
Uniq = 1,
58+
Player = 2,
59+
Item = 3,
60+
WorldTransaction = 4,
61+
StaticDoor = 5,
62+
Transport = 6,
63+
Conversation = 7,
64+
Creature = 8,
65+
Vehicle = 9,
66+
Pet = 10,
67+
GameObject = 11,
68+
DynamicObject = 12,
69+
AreaTrigger = 13,
70+
Corpse = 14,
71+
LootObject = 15,
72+
SceneObject = 16,
73+
Scenario = 17,
74+
AIGroup = 18,
75+
DynamicDoor = 19,
76+
ClientActor = 20,
77+
Vignette = 21,
78+
CallForHelp = 22,
79+
AIResource = 23,
80+
AILock = 24,
81+
AILockTicket = 25,
82+
ChatChannel = 26,
83+
Party = 27,
84+
Guild = 28,
85+
WowAccount = 29,
86+
BNetAccount = 30,
87+
GMTask = 31,
88+
MobileSession = 32,
89+
RaidGroup = 33,
90+
Spell = 34,
91+
Mail = 35,
92+
WebObj = 36,
93+
LFGObject = 37,
94+
LFGList = 38,
95+
UserRouter = 39,
96+
PVPQueueGroup = 40,
97+
UserClient = 41,
98+
PetBattle = 42,
99+
UniqUserClient = 43,
100+
BattlePet = 44,
101+
CommerceObj = 45,
102+
ClientSession = 46,
103+
};
104+
105+
106+
public enum HighGuidType623
4107
{
5108
Null = 0,
6109
Uniq = 1,

WowPacketParser/Misc/HighGuid.cs

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using WowPacketParser.Enums;
7+
8+
namespace WowPacketParser.Misc
9+
{
10+
public abstract class HighGuid
11+
{
12+
protected HighGuidType highGuidType;
13+
14+
public HighGuidType GetHighGuidType()
15+
{
16+
return highGuidType;
17+
}
18+
19+
}
20+
21+
public class HighGuidLegacy : HighGuid
22+
{
23+
private HighGuidTypeLegacy high;
24+
private static readonly Dictionary<HighGuidTypeLegacy, HighGuidType> HighLegacyToHighType
25+
= new Dictionary<HighGuidTypeLegacy, HighGuidType>
26+
{
27+
{ HighGuidTypeLegacy.None, HighGuidType.Null },
28+
{ HighGuidTypeLegacy.Player, HighGuidType.Player },
29+
{ HighGuidTypeLegacy.BattleGround1, HighGuidType.PVPQueueGroup }, // ?? unused in wpp
30+
{ HighGuidTypeLegacy.InstanceSave, HighGuidType.LFGList }, // ?? unused in wpp
31+
{ HighGuidTypeLegacy.Group, HighGuidType.RaidGroup },
32+
{ HighGuidTypeLegacy.BattleGround2, HighGuidType.PVPQueueGroup }, // ?? unused in wpp
33+
{ HighGuidTypeLegacy.MOTransport, HighGuidType.Transport }, // ?? unused in wpp
34+
{ HighGuidTypeLegacy.Guild, HighGuidType.Guild },
35+
{ HighGuidTypeLegacy.Item, HighGuidType.Item },
36+
{ HighGuidTypeLegacy.DynObject, HighGuidType.DynamicObject },
37+
{ HighGuidTypeLegacy.GameObject, HighGuidType.GameObject },
38+
{ HighGuidTypeLegacy.Transport, HighGuidType.Transport },
39+
{ HighGuidTypeLegacy.Unit, HighGuidType.Creature },
40+
{ HighGuidTypeLegacy.Pet, HighGuidType.Pet },
41+
{ HighGuidTypeLegacy.Vehicle, HighGuidType.Vehicle },
42+
};
43+
44+
public HighGuidLegacy(HighGuidTypeLegacy high)
45+
{
46+
this.high = high;
47+
if (!HighLegacyToHighType.ContainsKey(high))
48+
throw new ArgumentOutOfRangeException("0x" + high.ToString("X"));
49+
50+
highGuidType = HighLegacyToHighType[high];
51+
}
52+
}
53+
54+
55+
public class HighGuid623 : HighGuid
56+
{
57+
protected byte high;
58+
private static readonly Dictionary<HighGuidType623, HighGuidType> High623ToHighType
59+
= new Dictionary<HighGuidType623, HighGuidType>
60+
{
61+
{ HighGuidType623.Null, HighGuidType.Null },
62+
{ HighGuidType623.Uniq, HighGuidType.Uniq },
63+
{ HighGuidType623.Player, HighGuidType.Player },
64+
{ HighGuidType623.Item, HighGuidType.Item },
65+
{ HighGuidType623.StaticDoor, HighGuidType.StaticDoor },
66+
{ HighGuidType623.Transport, HighGuidType.Transport },
67+
{ HighGuidType623.Conversation, HighGuidType.Conversation },
68+
{ HighGuidType623.Creature, HighGuidType.Creature },
69+
{ HighGuidType623.Vehicle, HighGuidType.Vehicle },
70+
{ HighGuidType623.Pet, HighGuidType.Pet },
71+
{ HighGuidType623.GameObject, HighGuidType.GameObject },
72+
{ HighGuidType623.DynamicObject, HighGuidType.DynamicObject },
73+
{ HighGuidType623.AreaTrigger, HighGuidType.AreaTrigger },
74+
{ HighGuidType623.Corpse, HighGuidType.Corpse },
75+
{ HighGuidType623.LootObject, HighGuidType.LootObject },
76+
{ HighGuidType623.SceneObject, HighGuidType.SceneObject },
77+
{ HighGuidType623.Scenario, HighGuidType.Scenario },
78+
{ HighGuidType623.AIGroup, HighGuidType.AIGroup },
79+
{ HighGuidType623.DynamicDoor, HighGuidType.DynamicDoor },
80+
{ HighGuidType623.ClientActor, HighGuidType.ClientActor },
81+
{ HighGuidType623.Vignette, HighGuidType.Vignette },
82+
{ HighGuidType623.CallForHelp, HighGuidType.CallForHelp },
83+
{ HighGuidType623.AIResource, HighGuidType.AIResource },
84+
{ HighGuidType623.AILock, HighGuidType.AILock },
85+
{ HighGuidType623.AILockTicket, HighGuidType.AILockTicket },
86+
{ HighGuidType623.ChatChannel, HighGuidType.ChatChannel },
87+
{ HighGuidType623.Party, HighGuidType.Party },
88+
{ HighGuidType623.Guild, HighGuidType.Guild },
89+
{ HighGuidType623.WowAccount, HighGuidType.WowAccount },
90+
{ HighGuidType623.BNetAccount, HighGuidType.BNetAccount },
91+
{ HighGuidType623.GMTask, HighGuidType.GMTask },
92+
{ HighGuidType623.MobileSession, HighGuidType.MobileSession },
93+
{ HighGuidType623.RaidGroup, HighGuidType.RaidGroup },
94+
{ HighGuidType623.Spell, HighGuidType.Spell },
95+
{ HighGuidType623.Mail, HighGuidType.Mail },
96+
{ HighGuidType623.WebObj, HighGuidType.WebObj },
97+
{ HighGuidType623.LFGObject, HighGuidType.LFGObject },
98+
{ HighGuidType623.LFGList, HighGuidType.LFGList },
99+
{ HighGuidType623.UserRouter, HighGuidType.UserRouter },
100+
{ HighGuidType623.PVPQueueGroup, HighGuidType.PVPQueueGroup },
101+
{ HighGuidType623.UserClient, HighGuidType.UserClient },
102+
{ HighGuidType623.PetBattle, HighGuidType.PetBattle },
103+
{ HighGuidType623.UniqueUserClient, HighGuidType.UniqUserClient },
104+
{ HighGuidType623.BattlePet, HighGuidType.BattlePet }
105+
};
106+
107+
public HighGuid623(byte high)
108+
{
109+
this.high = high;
110+
if (!High623ToHighType.ContainsKey((HighGuidType623)high))
111+
throw new ArgumentOutOfRangeException("0x" + high.ToString("X"));
112+
113+
highGuidType = High623ToHighType[(HighGuidType623)high];
114+
}
115+
}
116+
117+
public class HighGuid624 : HighGuid
118+
{
119+
protected byte high;
120+
121+
public HighGuid624(byte high)
122+
{
123+
this.high = high;
124+
highGuidType = (HighGuidType)high;
125+
}
126+
}
127+
}

WowPacketParser/Misc/WowGuid.cs

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ namespace WowPacketParser.Misc
55
{
66
public abstract class WowGuid
77
{
8-
public ulong Low { get; set; }
9-
public ulong High { get; set; }
8+
public ulong Low { get; protected set; }
9+
public HighGuid HighGuid { get; protected set; }
10+
public ulong High { get; protected set; }
1011

1112
public static WowGuid Empty = new WowGuid64(0);
1213

@@ -25,7 +26,11 @@ public bool HasEntry()
2526

2627
public abstract ulong GetLow();
2728
public abstract uint GetEntry();
28-
public abstract HighGuidType GetHighType();
29+
30+
public HighGuidType GetHighType()
31+
{
32+
return HighGuid.GetHighGuidType();
33+
}
2934

3035
public ObjectType GetObjectType()
3136
{
@@ -93,11 +98,10 @@ public WowGuid128(ulong low, ulong high)
9398
{
9499
Low = low;
95100
High = high;
96-
}
97-
98-
public override HighGuidType GetHighType()
99-
{
100-
return (HighGuidType)(byte)((High >> 58) & 0x3F);
101+
if (ClientVersion.Build >= ClientVersionBuild.V6_2_4_21315)
102+
HighGuid = new HighGuid624((byte)((High >> 58) & 0x3F));
103+
else
104+
HighGuid = new HighGuid623((byte)((High >> 58) & 0x3F));
101105
}
102106

103107
public byte GetSubType() // move to base?
@@ -161,6 +165,7 @@ public class WowGuid64 : WowGuid
161165
public WowGuid64(ulong id)
162166
{
163167
Low = id;
168+
HighGuid = new HighGuidLegacy(GetHighGuidTypeLegacy());
164169
}
165170

166171
public WowGuid64()
@@ -218,45 +223,6 @@ public HighGuidTypeLegacy GetHighGuidTypeLegacy()
218223
}
219224
}
220225

221-
public override HighGuidType GetHighType()
222-
{
223-
switch (GetHighGuidTypeLegacy())
224-
{
225-
case HighGuidTypeLegacy.None:
226-
return HighGuidType.Null;
227-
case HighGuidTypeLegacy.Player:
228-
return HighGuidType.Player;
229-
case HighGuidTypeLegacy.BattleGround1:
230-
return HighGuidType.PVPQueueGroup; // ?? unused in wpp
231-
case HighGuidTypeLegacy.InstanceSave:
232-
return HighGuidType.LFGList; // ?? unused in wpp
233-
case HighGuidTypeLegacy.Group:
234-
return HighGuidType.RaidGroup;
235-
case HighGuidTypeLegacy.BattleGround2:
236-
return HighGuidType.PVPQueueGroup; // ?? unused in wpp
237-
case HighGuidTypeLegacy.MOTransport:
238-
return HighGuidType.Transport; // ?? unused in wpp
239-
case HighGuidTypeLegacy.Guild:
240-
return HighGuidType.Guild;
241-
case HighGuidTypeLegacy.Item:
242-
return HighGuidType.Item;
243-
case HighGuidTypeLegacy.DynObject:
244-
return HighGuidType.DynamicObject;
245-
case HighGuidTypeLegacy.GameObject:
246-
return HighGuidType.GameObject;
247-
case HighGuidTypeLegacy.Transport:
248-
return HighGuidType.Transport;
249-
case HighGuidTypeLegacy.Unit:
250-
return HighGuidType.Creature;
251-
case HighGuidTypeLegacy.Pet:
252-
return HighGuidType.Pet;
253-
case HighGuidTypeLegacy.Vehicle:
254-
return HighGuidType.Vehicle;
255-
default:
256-
throw new ArgumentOutOfRangeException("0x" + GetHighGuidTypeLegacy().ToString("X"));
257-
}
258-
}
259-
260226
public override string ToString()
261227
{
262228
if (Low == 0)

WowPacketParser/WowPacketParser.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@
401401
<Compile Include="Misc\Extensions.cs" />
402402
<Compile Include="Misc\FileCompressionAttribute.cs" />
403403
<Compile Include="Misc\Filters.cs" />
404+
<Compile Include="Misc\HighGuid.cs" />
404405
<Compile Include="Misc\WowGuid.cs" />
405406
<Compile Include="Misc\LfgEntry.cs" />
406407
<Compile Include="Misc\Logger.cs" />

0 commit comments

Comments
 (0)