fix(items): port retail useability and autowear rejection

Use the exact low USEABLE_NO-bit predicate so reset/zero-valued direct-use items such as Blackmoor's Favor reach the ordinary Use request. Port AutoWear's clothing-priority blocker lookup and exact named system notice through the shared activation owner.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-23 08:33:31 +02:00
parent 60387668d0
commit f71f947475
13 changed files with 289 additions and 57 deletions

View file

@ -436,6 +436,24 @@ public sealed class ItemInteractionControllerTests
Assert.Equal(new[] { 0x50000A03u }, h.Uses);
}
[Fact]
public void ZeroValuedUseabilityGem_sendsUseLikeBlackmoorsFavor()
{
var h = new Harness();
const uint favor = 0x50000A30u;
h.AddContained(favor, item =>
{
item.Name = "Blackmoor's Favor";
item.Type = ItemType.Gem;
item.Useability = ItemUseability.Undef;
});
Assert.True(h.Controller.ActivateItem(favor));
Assert.Equal(new[] { favor }, h.Uses);
Assert.Equal(1, h.Controller.BusyCount);
}
[Fact]
public void ContainerItem_sendsUseToOpen()
{
@ -527,6 +545,7 @@ public sealed class ItemInteractionControllerTests
h.Objects.AddOrUpdate(new ClientObject
{
ObjectId = 0x50000AF2u,
Name = "Chainmail Hauberk",
Type = ItemType.Clothing,
CurrentlyEquippedLocation = EquipMask.UpperArmWear,
Priority = 0x00000004u,
@ -547,6 +566,10 @@ public sealed class ItemInteractionControllerTests
Assert.Empty(h.Wields);
Assert.Equal(Pack, h.Objects.Get(0x50000A17u)!.ContainerId);
Assert.Equal(
new[] { "You must remove your Chainmail Hauberk to wear that" },
h.SystemMessages);
Assert.Empty(h.Toasts);
}
[Fact]
@ -563,12 +586,15 @@ public sealed class ItemInteractionControllerTests
h.AddContained(0x50000A06u, item =>
{
item.Type = ItemType.Armor;
item.CombatUse = 4; // COMBAT_USE_SHIELD
item.ValidLocations = EquipMask.Shield;
item.Useability = ItemUseability.No;
});
Assert.False(h.Controller.ActivateItem(0x50000A06u));
bool activated = h.Controller.ActivateItem(0x50000A06u);
Assert.Empty(h.Wields);
Assert.False(activated);
Assert.Equal(Pack, h.Objects.Get(0x50000A06u)!.ContainerId);
}