feat(net): #13 read desired_comps list in PD trailer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-10 08:39:31 +02:00
parent 8cbb991d95
commit 75e8e260f2
2 changed files with 48 additions and 0 deletions

View file

@ -378,6 +378,21 @@ public static class PlayerDescriptionParser
list.Add(ReadU32(payload, ref pos));
hotbarSpells.Add(list);
}
if (optionFlags.HasFlag(CharacterOptionDataFlag.DesiredComps))
{
// holtburger events.rs:558-574 — u16 count + u16 padding (4-byte header).
if (payload.Length - pos < 4) throw new FormatException("truncated desired_comps header");
ushort count = ReadU16(payload, ref pos);
ReadU16(payload, ref pos); // padding/buckets — discarded
if (count > 10_000) throw new FormatException("unreasonable desired_comps count");
for (int i = 0; i < count; i++)
{
uint id = ReadU32(payload, ref pos);
uint amt = ReadU32(payload, ref pos);
desiredComps.Add((id, amt));
}
}
}
}
catch (FormatException ex)