diff --git a/WowPacketParser/Store/Objects/UpdateFields/IBitVector.cs b/WowPacketParser/Store/Objects/UpdateFields/IBitVector.cs new file mode 100644 index 0000000000..218ef2f6ad --- /dev/null +++ b/WowPacketParser/Store/Objects/UpdateFields/IBitVector.cs @@ -0,0 +1,6 @@ +namespace WowPacketParser.Store.Objects.UpdateFields +{ + public interface IBitVector + { + } +} diff --git a/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateFieldsHandler1105.cs b/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateFieldsHandler1105.cs index b042da92a5..ce130e13d3 100644 --- a/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateFieldsHandler1105.cs +++ b/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateFieldsHandler1105.cs @@ -2532,50 +2532,84 @@ public static ISkillInfo ReadUpdateSkillInfo(Packet packet, params object[] inde return data; } - public static IBitVectors ReadCreateBitVectors(Packet packet, params object[] indexes) + public static IBitVector ReadCreateBitVector(Packet packet, params object[] indexes) { - var data = new BitVectors(); + var data = new BitVector(); packet.ResetBitReader(); - for (var i = 0; i < 13; ++i) + data.Values.Resize(packet.ReadUInt32()); + for (var i = 0; i < data.Values.Count; ++i) { - data.Values[i].Resize(packet.ReadUInt32()); - for (var j = 0; j < data.Values[i].Count; ++j) - { - data.Values[i][j] = packet.ReadUInt64("Values", indexes, i, j); - } + data.Values[i] = packet.ReadUInt64("Values", indexes, i); } return data; } - public static IBitVectors ReadUpdateBitVectors(Packet packet, params object[] indexes) + public static IBitVector ReadUpdateBitVector(Packet packet, params object[] indexes) { - var data = new BitVectors(); + var data = new BitVector(); packet.ResetBitReader(); var rawChangesMask = new int[1]; - rawChangesMask[0] = (int)packet.ReadBits(1); + rawChangesMask[0] = (int)packet.ReadBits(2); var changesMask = new BitArray(rawChangesMask); if (changesMask[0]) { - for (var i = 0; i < 13; ++i) + if (changesMask[1]) { - data.Values[i].ReadUpdateMask(packet); + data.Values.ReadUpdateMask(packet); } } + packet.ResetBitReader(); if (changesMask[0]) { - for (var i = 0; i < 13; ++i) + if (changesMask[1]) { - for (var j = 0; j < data.Values[i].Count; ++j) + for (var i = 0; i < data.Values.Count; ++i) { - if (data.Values[i].UpdateMask[j]) + if (data.Values.UpdateMask[i]) { - data.Values[i][j] = packet.ReadUInt64("Values", indexes, i, j); + data.Values[i] = packet.ReadUInt64("Values", indexes, i); } } } } + return data; + } + + public static IBitVectors ReadCreateBitVectors(Packet packet, params object[] indexes) + { + var data = new BitVectors(); packet.ResetBitReader(); + for (var i = 0; i < 13; ++i) + { + data.Values[i] = ReadCreateBitVector(packet, indexes, "Values", i); + } + return data; + } + + public static IBitVectors ReadUpdateBitVectors(Packet packet, params object[] indexes) + { + var data = new BitVectors(); + packet.ResetBitReader(); + var rawChangesMask = new int[1]; + var rawMaskMask = new int[1]; + rawMaskMask[0] = (int)packet.ReadBits(1); + var maskMask = new BitArray(rawMaskMask); + if (maskMask[0]) + rawChangesMask[0] = (int)packet.ReadBits(32); + var changesMask = new BitArray(rawChangesMask); + + packet.ResetBitReader(); + if (changesMask[0]) + { + for (var i = 0; i < 13; ++i) + { + if (changesMask[1 + i]) + { + data.Values[i] = ReadUpdateBitVector(packet, indexes, "Values", i); + } + } + } return data; } diff --git a/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateHandler.cs b/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateHandler.cs index e50f0838c5..1b6769fef1 100644 --- a/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateHandler.cs +++ b/WowPacketParserModule.V11_0_0_55666/Parsers/UpdateHandler.cs @@ -839,9 +839,9 @@ private static MovementInfo ReadMovementUpdateBlock(Packet packet, CreateObject gob.WorldEffectID = worldEffectId; var hasInt1 = packet.ReadBit("bit8", index); - var hasStruct2 = packet.ReadBit("HasShipPath", index); + var hasShipPath = packet.ReadBit("HasShipPath", index); var hasTransportStatePercent = packet.ReadBit("HasTransportStatePercent", index); - if (hasStruct2) + if (hasShipPath) { packet.ResetBitReader(); packet.ReadUInt32("Period", index, "ShipPath"); diff --git a/WowPacketParserModule.V11_0_0_55666/UpdateFields/V11_0_5_57171/BitVector.cs b/WowPacketParserModule.V11_0_0_55666/UpdateFields/V11_0_5_57171/BitVector.cs new file mode 100644 index 0000000000..4714f852c9 --- /dev/null +++ b/WowPacketParserModule.V11_0_0_55666/UpdateFields/V11_0_5_57171/BitVector.cs @@ -0,0 +1,17 @@ +// +// DO NOT EDIT +// + +using System.CodeDom.Compiler; +using WowPacketParser.Misc; +using WowPacketParser.Store.Objects.UpdateFields; + +namespace WowPacketParserModule.V11_0_0_55666.UpdateFields.V11_0_5_57171 +{ + [GeneratedCode("UpdateFieldCodeGenerator.Formats.WowPacketParserHandler", "1.0.0.0")] + public class BitVector : IBitVector + { + public DynamicUpdateField> Values { get; } = new DynamicUpdateField>(); + } +} + diff --git a/WowPacketParserModule.V11_0_0_55666/UpdateFields/V11_0_5_57171/BitVectors.cs b/WowPacketParserModule.V11_0_0_55666/UpdateFields/V11_0_5_57171/BitVectors.cs index 3766e83bcd..cef7a8b752 100644 --- a/WowPacketParserModule.V11_0_0_55666/UpdateFields/V11_0_5_57171/BitVectors.cs +++ b/WowPacketParserModule.V11_0_0_55666/UpdateFields/V11_0_5_57171/BitVectors.cs @@ -11,7 +11,7 @@ namespace WowPacketParserModule.V11_0_0_55666.UpdateFields.V11_0_5_57171 [GeneratedCode("UpdateFieldCodeGenerator.Formats.WowPacketParserHandler", "1.0.0.0")] public class BitVectors : IBitVectors { - public DynamicUpdateField>[] Values { get; } = new DynamicUpdateField>[13] { new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>(), new DynamicUpdateField>() }; + public IBitVector[] Values { get; } = new IBitVector[13]; } }