feat(net): #13 read options2 gated on CHARACTER_OPTIONS2 flag
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b17dc3b152
commit
98eebef740
2 changed files with 34 additions and 0 deletions
|
|
@ -398,6 +398,9 @@ public static class PlayerDescriptionParser
|
||||||
// to 0 if EOF.
|
// to 0 if EOF.
|
||||||
if (payload.Length - pos >= 4)
|
if (payload.Length - pos >= 4)
|
||||||
spellbookFilters = ReadU32(payload, ref pos);
|
spellbookFilters = ReadU32(payload, ref pos);
|
||||||
|
|
||||||
|
if (optionFlags.HasFlag(CharacterOptionDataFlag.CharacterOptions2))
|
||||||
|
options2 = ReadU32(payload, ref pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FormatException ex)
|
catch (FormatException ex)
|
||||||
|
|
|
||||||
|
|
@ -593,4 +593,35 @@ public sealed class PlayerDescriptionParserTests
|
||||||
Assert.NotNull(parsed);
|
Assert.NotNull(parsed);
|
||||||
Assert.Equal(0xF00DBA42u, parsed!.Value.SpellbookFilters);
|
Assert.Equal(0xF00DBA42u, parsed!.Value.SpellbookFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TryParse_TrailerOptions2_GatedOnCharacterOptions2Bit()
|
||||||
|
{
|
||||||
|
var sb = new MemoryStream();
|
||||||
|
using var writer = new BinaryWriter(sb);
|
||||||
|
writer.Write(0u); // propertyFlags
|
||||||
|
writer.Write(0x52u); // weenieType
|
||||||
|
writer.Write(0x201u); // ATTRIBUTE | ENCHANTMENT
|
||||||
|
writer.Write(1u); // has_health
|
||||||
|
writer.Write(0u); // empty attribute_flags
|
||||||
|
writer.Write(0u); // empty enchantment mask
|
||||||
|
|
||||||
|
// option_flags = CHARACTER_OPTIONS2 (0x40)
|
||||||
|
writer.Write(0x40u);
|
||||||
|
writer.Write(0u); // options1
|
||||||
|
|
||||||
|
// Legacy hotbar list: count=0.
|
||||||
|
writer.Write(0u);
|
||||||
|
|
||||||
|
// spellbook_filters
|
||||||
|
writer.Write(0u);
|
||||||
|
|
||||||
|
// options2 sentinel
|
||||||
|
writer.Write(0xC0FFEE01u);
|
||||||
|
|
||||||
|
var parsed = PlayerDescriptionParser.TryParse(sb.ToArray());
|
||||||
|
|
||||||
|
Assert.NotNull(parsed);
|
||||||
|
Assert.Equal(0xC0FFEE01u, parsed!.Value.Options2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue