Skip to content

Commit

Permalink
Corrected ActivePlayerData::BitVectors 11.0.5 structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Shauren committed Oct 30, 2024
1 parent a3ba169 commit 571ee41
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 20 deletions.
6 changes: 6 additions & 0 deletions WowPacketParser/Store/Objects/UpdateFields/IBitVector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace WowPacketParser.Store.Objects.UpdateFields
{
public interface IBitVector
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions WowPacketParserModule.V11_0_0_55666/Parsers/UpdateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// <auto-generated>
// DO NOT EDIT
// </auto-generated>

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<System.Nullable<ulong>> Values { get; } = new DynamicUpdateField<System.Nullable<ulong>>();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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<System.Nullable<ulong>>[] Values { get; } = new DynamicUpdateField<System.Nullable<ulong>>[13] { new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>(), new DynamicUpdateField<System.Nullable<ulong>>() };
public IBitVector[] Values { get; } = new IBitVector[13];
}
}

0 comments on commit 571ee41

Please sign in to comment.