fix(net): sign-extend retail capacity bytes

Mirror PublicWeenieDesc::UnPack MOVSX behavior so ACE's FF capacity sentinels remain -1 instead of becoming 255. This suppresses non-container capacity prose through the normal retail appraisal checks, with raw-wire and formatter regression coverage.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-23 18:25:17 +02:00
parent d3c5e06fdd
commit 2c00d53db2
7 changed files with 101 additions and 41 deletions

View file

@ -88,17 +88,15 @@ public sealed class ItemAppraisalTextFormatterTests
}
[Fact]
public void HookWithHookProfile_UsesRetailUnknownsAndSuppressesBogusCapacity()
public void NpcLooksLikeObjectCreature_UsesRetailUnknownsAndSuppressesNegativeCapacity()
{
var obj = new ClientObject
{
ObjectId = 0x50000005u,
Name = "Black Phyntos Hive",
Type = ItemType.Container,
ItemsCapacity = 255,
ContainersCapacity = 255,
HookItemTypes = (uint)ItemType.Container,
HookType = 4u,
Type = ItemType.Creature,
ItemsCapacity = -1,
ContainersCapacity = -1,
};
var properties = new PropertyBundle();
properties.Strings[16u] =
@ -106,12 +104,7 @@ public sealed class ItemAppraisalTextFormatterTests
ItemAppraisalReport report = ItemAppraisalTextFormatter.BuildReport(
obj,
Parsed(
properties,
hook: new AppraiseInfoParser.HookProfile(
Flags: 0u,
ValidLocations: 0u,
AmmoType: 0u)),
Parsed(properties),
_ => null);
Assert.Equal(
@ -138,6 +131,33 @@ public sealed class ItemAppraisalTextFormatterTests
});
}
[Fact]
public void HookWithHookProfile_SuppressesHooksOwnCapacity()
{
var obj = new ClientObject
{
ObjectId = 0x50000015u,
Name = "Weapon Hook",
Type = ItemType.Container,
ItemsCapacity = 24,
ContainersCapacity = 1,
HookItemTypes = (uint)ItemType.Weapon,
HookType = 4u,
};
ItemAppraisalReport report = ItemAppraisalTextFormatter.BuildReport(
obj,
Parsed(
new PropertyBundle(),
hook: new AppraiseInfoParser.HookProfile(
Flags: 0u,
ValidLocations: 0u,
AmmoType: 0u)),
_ => null);
Assert.DoesNotContain("Can hold", report.ToString());
}
[Fact]
public void OrdinaryContainer_PresentsCapacityAsRetailParagraph()
{