feat(ui): drive toolbar use state from selection

Port the retail selected-object availability predicate into Core and project it through the shared interaction owner. The imported hand now follows canonical selection/object notices, keeps weapon and targeted-tool activation on the existing wield/use cursor paths, and ghosts empty or explicitly unusable selections per the connected UX requirement.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-23 08:07:47 +02:00
parent 0134122c28
commit 60387668d0
11 changed files with 269 additions and 16 deletions

View file

@ -151,6 +151,22 @@ public static class ItemInteractionPolicy
private static readonly EquipMask BodyLocations = (EquipMask)0x00007E00u;
private static readonly EquipMask ClothingLocations = (EquipMask)0x080001FFu;
private static readonly EquipMask HeldLocations = (EquipMask)0x7C0F8000u;
private const ItemType ToolbarEquipmentTypes =
ItemType.Armor | ItemType.Clothing | ItemType.Jewelry;
/// <summary>
/// Exact selected-object predicate used by retail's toolbar hand.
/// <c>gmToolbarUI::HandleSelectionChanged @ 0x004BF380</c> leaves the
/// button active for combat-use objects, armor/clothing/jewelry, or an
/// <c>ItemUses</c> value whose <c>USEABLE_NO</c> bit is clear.
/// </summary>
public static bool IsToolbarUseEnabled(
ItemType type,
byte combatUse,
uint useability)
=> combatUse != 0
|| (type & ToolbarEquipmentTypes) != 0
|| (useability & ItemUseability.No) == 0;
public static ItemPrimaryUseResult DetermineUseResult(
in ItemPolicyObject item,