Skip to content

Commit b592b3b

Browse files
committed
Add 11.2.7 entity fragments enum
1 parent 6d393a8 commit b592b3b

File tree

2 files changed

+157
-4
lines changed

2 files changed

+157
-4
lines changed

WowPacketParser/Enums/WowCSEntityFragments.cs

Lines changed: 142 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,31 @@ public enum WowCSEntityFragments : int
2727
Tag_ActiveObject_C,
2828
Tag_VisibleObject_C,
2929
Tag_UnitVehicle,
30+
Tag_HousingRoom,
31+
Tag_MeshObject,
32+
Tag_HouseExteriorPiece,
33+
Tag_HouseExteriorRoot,
3034
FEntityPosition,
3135
FEntityLocalMatrix,
3236
FEntityWorldMatrix,
37+
FTransportLink,
38+
FPlayerOwnershipLink,
3339
CActor,
3440
FVendor_C,
3541
FMirroredObject_C,
42+
FMeshObjectData_C,
43+
FHousingDecor_C,
44+
FHousingRoom_C,
45+
FHousingRoomComponentMesh_C,
46+
FHousingPlayerHouse_C,
47+
FJamHousingCornerstone_C,
48+
FHousingDecorActor_C,
49+
FHousingPlotAreaTrigger_C,
50+
FNeighborhoodMirrorData_C,
51+
FMirroredPositionData_C,
52+
PlayerHouseInfoComponent_C,
53+
FHousingStorage_C,
54+
FHousingFixture_C,
3655
End
3756
}
3857

@@ -68,6 +87,55 @@ public enum WowCSEntityFragments1100 : int
6887
End = 255
6988
}
7089

90+
public enum WowCSEntityFragments1127 : int
91+
{
92+
FEntityPosition = 1,
93+
CGObject = 2,
94+
FTransportLink = 5,
95+
FPlayerOwnershipLink = 13,
96+
CActor = 15,
97+
FVendor_C = 17,
98+
FMirroredObject_C = 18,
99+
FMeshObjectData_C = 19,
100+
FHousingDecor_C = 20,
101+
FHousingRoom_C = 21,
102+
FHousingRoomComponentMesh_C = 22,
103+
FHousingPlayerHouse_C = 23,
104+
FJamHousingCornerstone_C = 27,
105+
FHousingDecorActor_C = 28,
106+
FHousingPlotAreaTrigger_C = 29,
107+
FNeighborhoodMirrorData_C = 30,
108+
FMirroredPositionData_C = 31,
109+
PlayerHouseInfoComponent_C = 32,
110+
FHousingStorage_C = 33,
111+
FHousingFixture_C = 34,
112+
Tag_Item = 200,
113+
Tag_Container = 201,
114+
Tag_AzeriteEmpoweredItem = 202,
115+
Tag_AzeriteItem = 203,
116+
Tag_Unit = 204,
117+
Tag_Player = 205,
118+
Tag_GameObject = 206,
119+
Tag_DynamicObject = 207,
120+
Tag_Corpse = 208,
121+
Tag_AreaTrigger = 209,
122+
Tag_SceneObject = 210,
123+
Tag_Conversation = 211,
124+
Tag_AIGroup = 212,
125+
Tag_Scenario = 213,
126+
Tag_LootObject = 214,
127+
Tag_ActivePlayer = 215,
128+
Tag_ActiveClient_S = 216,
129+
Tag_ActiveObject_C = 217,
130+
Tag_VisibleObject_C = 218,
131+
Tag_UnitVehicle = 219,
132+
Tag_HousingRoom = 220,
133+
Tag_MeshObject = 221,
134+
Tag_HouseExteriorPiece = 224,
135+
Tag_HouseExteriorRoot = 225,
136+
End = 255
137+
}
138+
71139
public static class WowCSUtilities
72140
{
73141
public static bool IsUpdateable(WowCSEntityFragments fragment)
@@ -76,6 +144,18 @@ public static bool IsUpdateable(WowCSEntityFragments fragment)
76144
{
77145
case WowCSEntityFragments.CGObject:
78146
case WowCSEntityFragments.FVendor_C:
147+
case WowCSEntityFragments.FMeshObjectData_C:
148+
case WowCSEntityFragments.FHousingDecor_C:
149+
case WowCSEntityFragments.FHousingRoom_C:
150+
case WowCSEntityFragments.FHousingRoomComponentMesh_C:
151+
case WowCSEntityFragments.FHousingPlayerHouse_C:
152+
case WowCSEntityFragments.FJamHousingCornerstone_C:
153+
case WowCSEntityFragments.FHousingPlotAreaTrigger_C:
154+
case WowCSEntityFragments.FNeighborhoodMirrorData_C:
155+
case WowCSEntityFragments.FMirroredPositionData_C:
156+
case WowCSEntityFragments.PlayerHouseInfoComponent_C:
157+
case WowCSEntityFragments.FHousingStorage_C:
158+
case WowCSEntityFragments.FHousingFixture_C:
79159
return true;
80160
default:
81161
return false;
@@ -88,9 +168,11 @@ public static bool IsIndirect(WowCSEntityFragments fragment)
88168
{
89169
case WowCSEntityFragments.CGObject:
90170
case WowCSEntityFragments.CActor:
171+
case WowCSEntityFragments.FPlayerOwnershipLink:
172+
case WowCSEntityFragments.PlayerHouseInfoComponent_C:
91173
return true;
92174
case WowCSEntityFragments.FVendor_C:
93-
return ClientVersion.AddedInVersion(ClientBranch.Retail, ClientVersionBuild.V11_0_7_58630) ||
175+
return (ClientVersion.AddedInVersion(ClientBranch.Retail, ClientVersionBuild.V11_0_7_58630) && ClientVersion.RemovedInVersion(ClientBranch.Retail, ClientVersionBuild.V11_2_7_64632)) ||
94176
ClientVersion.AddedInVersion(ClientBranch.Classic, ClientVersionBuild.V1_15_8_63829) ||
95177
ClientVersion.AddedInVersion(ClientBranch.MoP, ClientVersionBuild.V5_5_0_61735) ||
96178
ClientVersion.AddedInVersion(ClientBranch.Cata, ClientVersionBuild.V4_4_2_59185) ||
@@ -154,6 +236,59 @@ public static WowCSEntityFragments ToUniversal(WowCSEntityFragments1100 fragment
154236
_ => throw new ArgumentOutOfRangeException(nameof(fragment), fragment, null)
155237
};
156238
}
239+
240+
public static WowCSEntityFragments ToUniversal(WowCSEntityFragments1127 fragment)
241+
{
242+
return fragment switch
243+
{
244+
WowCSEntityFragments1127.End => WowCSEntityFragments.End,
245+
WowCSEntityFragments1127.FEntityPosition => WowCSEntityFragments.FEntityPosition,
246+
WowCSEntityFragments1127.CGObject => WowCSEntityFragments.CGObject,
247+
WowCSEntityFragments1127.FTransportLink => WowCSEntityFragments.FTransportLink,
248+
WowCSEntityFragments1127.FPlayerOwnershipLink => WowCSEntityFragments.FPlayerOwnershipLink,
249+
WowCSEntityFragments1127.CActor => WowCSEntityFragments.CActor,
250+
WowCSEntityFragments1127.FVendor_C => WowCSEntityFragments.FVendor_C,
251+
WowCSEntityFragments1127.FMirroredObject_C => WowCSEntityFragments.FMirroredObject_C,
252+
WowCSEntityFragments1127.FMeshObjectData_C => WowCSEntityFragments.FMeshObjectData_C,
253+
WowCSEntityFragments1127.FHousingDecor_C => WowCSEntityFragments.FHousingDecor_C,
254+
WowCSEntityFragments1127.FHousingRoom_C => WowCSEntityFragments.FHousingRoom_C,
255+
WowCSEntityFragments1127.FHousingRoomComponentMesh_C => WowCSEntityFragments.FHousingRoomComponentMesh_C,
256+
WowCSEntityFragments1127.FHousingPlayerHouse_C => WowCSEntityFragments.FHousingPlayerHouse_C,
257+
WowCSEntityFragments1127.FJamHousingCornerstone_C => WowCSEntityFragments.FJamHousingCornerstone_C,
258+
WowCSEntityFragments1127.FHousingDecorActor_C => WowCSEntityFragments.FHousingDecorActor_C,
259+
WowCSEntityFragments1127.FHousingPlotAreaTrigger_C => WowCSEntityFragments.FHousingPlotAreaTrigger_C,
260+
WowCSEntityFragments1127.FNeighborhoodMirrorData_C => WowCSEntityFragments.FNeighborhoodMirrorData_C,
261+
WowCSEntityFragments1127.FMirroredPositionData_C => WowCSEntityFragments.FMirroredPositionData_C,
262+
WowCSEntityFragments1127.PlayerHouseInfoComponent_C => WowCSEntityFragments.PlayerHouseInfoComponent_C,
263+
WowCSEntityFragments1127.FHousingStorage_C => WowCSEntityFragments.FHousingStorage_C,
264+
WowCSEntityFragments1127.FHousingFixture_C => WowCSEntityFragments.FHousingFixture_C,
265+
WowCSEntityFragments1127.Tag_Item => WowCSEntityFragments.Tag_Item,
266+
WowCSEntityFragments1127.Tag_Container => WowCSEntityFragments.Tag_Container,
267+
WowCSEntityFragments1127.Tag_AzeriteEmpoweredItem => WowCSEntityFragments.Tag_AzeriteEmpoweredItem,
268+
WowCSEntityFragments1127.Tag_AzeriteItem => WowCSEntityFragments.Tag_AzeriteItem,
269+
WowCSEntityFragments1127.Tag_Unit => WowCSEntityFragments.Tag_Unit,
270+
WowCSEntityFragments1127.Tag_Player => WowCSEntityFragments.Tag_Player,
271+
WowCSEntityFragments1127.Tag_GameObject => WowCSEntityFragments.Tag_GameObject,
272+
WowCSEntityFragments1127.Tag_DynamicObject => WowCSEntityFragments.Tag_DynamicObject,
273+
WowCSEntityFragments1127.Tag_Corpse => WowCSEntityFragments.Tag_Corpse,
274+
WowCSEntityFragments1127.Tag_AreaTrigger => WowCSEntityFragments.Tag_AreaTrigger,
275+
WowCSEntityFragments1127.Tag_SceneObject => WowCSEntityFragments.Tag_SceneObject,
276+
WowCSEntityFragments1127.Tag_Conversation => WowCSEntityFragments.Tag_Conversation,
277+
WowCSEntityFragments1127.Tag_AIGroup => WowCSEntityFragments.Tag_AIGroup,
278+
WowCSEntityFragments1127.Tag_Scenario => WowCSEntityFragments.Tag_Scenario,
279+
WowCSEntityFragments1127.Tag_LootObject => WowCSEntityFragments.Tag_LootObject,
280+
WowCSEntityFragments1127.Tag_ActivePlayer => WowCSEntityFragments.Tag_ActivePlayer,
281+
WowCSEntityFragments1127.Tag_ActiveClient_S => WowCSEntityFragments.Tag_ActiveClient_S,
282+
WowCSEntityFragments1127.Tag_ActiveObject_C => WowCSEntityFragments.Tag_ActiveObject_C,
283+
WowCSEntityFragments1127.Tag_VisibleObject_C => WowCSEntityFragments.Tag_VisibleObject_C,
284+
WowCSEntityFragments1127.Tag_UnitVehicle => WowCSEntityFragments.Tag_UnitVehicle,
285+
WowCSEntityFragments1127.Tag_HousingRoom => WowCSEntityFragments.Tag_HousingRoom,
286+
WowCSEntityFragments1127.Tag_MeshObject => WowCSEntityFragments.Tag_MeshObject,
287+
WowCSEntityFragments1127.Tag_HouseExteriorPiece => WowCSEntityFragments.Tag_HouseExteriorPiece,
288+
WowCSEntityFragments1127.Tag_HouseExteriorRoot => WowCSEntityFragments.Tag_HouseExteriorRoot,
289+
_ => throw new ArgumentOutOfRangeException(nameof(fragment), fragment, null)
290+
};
291+
}
157292
}
158293

159294
public readonly record struct WowCSEntityFragment : IComparable<WowCSEntityFragment>
@@ -167,6 +302,12 @@ public WowCSEntityFragment(WowCSEntityFragments1100 versionValue)
167302
VersionValue = (int)versionValue;
168303
}
169304

305+
public WowCSEntityFragment(WowCSEntityFragments1127 versionValue)
306+
{
307+
UniversalValue = WowCSUtilities.ToUniversal(versionValue);
308+
VersionValue = (int)versionValue;
309+
}
310+
170311
public int CompareTo(WowCSEntityFragment other)
171312
{
172313
return VersionValue.CompareTo(other.VersionValue);

WowPacketParserModule.V11_0_0_55666/Parsers/UpdateHandler.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,24 @@ public static void HandleUpdateObject(Packet packet)
213213
}
214214
}
215215

216+
private static WowCSEntityFragment TransformFragment1100(Packet packet, string name, byte fragmentId, int idx, int fragmentIdx) =>
217+
new (packet.AddValue(name, (WowCSEntityFragments1100)fragmentId, idx, fragmentIdx));
218+
219+
private static WowCSEntityFragment TransformFragment1127(Packet packet, string name, byte fragmentId, int idx, int fragmentIdx) =>
220+
new (packet.AddValue(name, (WowCSEntityFragments1127)fragmentId, idx, fragmentIdx));
221+
216222
private static List<WowCSEntityFragment> ReadEntityFragments(Packet packet, string name, int idx)
217223
{
224+
Func<Packet, string, byte, int, int, WowCSEntityFragment> fragmentTransformer;
225+
if (ClientVersion.AddedInVersion(ClientVersionBuild.V11_2_7_64632))
226+
fragmentTransformer = TransformFragment1127;
227+
else
228+
fragmentTransformer = TransformFragment1100;
229+
218230
var fragmentIds = new List<WowCSEntityFragment>();
219-
WowCSEntityFragments1100 fragmentId;
220-
while ((fragmentId = packet.ReadByteE<WowCSEntityFragments1100>()) != WowCSEntityFragments1100.End)
221-
fragmentIds.Add(new WowCSEntityFragment(packet.AddValue(name, fragmentId, idx, fragmentIds.Count)));
231+
byte fragmentId;
232+
while ((fragmentId = packet.ReadByte()) != 255)
233+
fragmentIds.Add(fragmentTransformer(packet, name, fragmentId, idx, fragmentIds.Count));
222234

223235
return fragmentIds;
224236
}

0 commit comments

Comments
 (0)