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:
parent
60387668d0
commit
f71f947475
13 changed files with 289 additions and 57 deletions
|
|
@ -310,6 +310,15 @@ public static class ItemUseability
|
|||
public static uint TargetFlags(uint useability)
|
||||
=> (useability & TargetMask) >> 16;
|
||||
|
||||
/// <summary>
|
||||
/// Retail <c>ItemUses::IsUseable @ 0x004FCCC0</c>. The implementation
|
||||
/// complements the full bitfield and returns its low bit, so only
|
||||
/// <c>USEABLE_NO</c> disables use. In particular, the default
|
||||
/// <c>USEABLE_UNDEF</c> value zero is usable.
|
||||
/// </summary>
|
||||
public static bool IsUseable(uint useability)
|
||||
=> (useability & No) == 0;
|
||||
|
||||
/// <summary>
|
||||
/// Retail <c>ItemUses::GetLeastLimitedTargetUse</c> (0x004fcd50): the most
|
||||
/// permissive target-use bit present, priority Remote > Viewed >
|
||||
|
|
@ -330,11 +339,7 @@ public static class ItemUseability
|
|||
}
|
||||
|
||||
public static bool IsDirectUseable(uint useability)
|
||||
{
|
||||
uint source = SourceFlags(useability);
|
||||
return !IsTargeted(useability)
|
||||
&& (source & ~(No | NeverWalk)) != Undef;
|
||||
}
|
||||
=> !IsTargeted(useability) && IsUseable(useability);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public static class ItemInteractionPolicy
|
|||
uint useability)
|
||||
=> combatUse != 0
|
||||
|| (type & ToolbarEquipmentTypes) != 0
|
||||
|| (useability & ItemUseability.No) == 0;
|
||||
|| ItemUseability.IsUseable(useability);
|
||||
|
||||
public static ItemPrimaryUseResult DetermineUseResult(
|
||||
in ItemPolicyObject item,
|
||||
|
|
@ -207,7 +207,7 @@ public static class ItemInteractionPolicy
|
|||
return ItemPrimaryUseResult.BeginGame;
|
||||
}
|
||||
|
||||
if (IsUseable(item.Useability))
|
||||
if (ItemUseability.IsUseable(item.Useability))
|
||||
return ItemPrimaryUseResult.ItemUse;
|
||||
|
||||
if (item.IsPlayer && item.Id != playerId)
|
||||
|
|
@ -261,7 +261,7 @@ public static class ItemInteractionPolicy
|
|||
return Consumed(actions);
|
||||
}
|
||||
|
||||
if (IsUseable(source.Useability))
|
||||
if (ItemUseability.IsUseable(source.Useability))
|
||||
{
|
||||
if ((source.Flags & PublicWeenieFlags.PlayerKillerSwitch) != 0)
|
||||
return Consumed(new ItemPolicyAction(
|
||||
|
|
@ -406,7 +406,7 @@ public static class ItemInteractionPolicy
|
|||
if (item.OwnedByPlayer && item.IsContainer)
|
||||
actions.Add(new ItemPolicyAction(ItemPolicyActionKind.OpenContainedContainer, item.Id));
|
||||
if (!item.OwnedByPlayer && item.IsContainer
|
||||
&& IsUseable(item.Useability)
|
||||
&& ItemUseability.IsUseable(item.Useability)
|
||||
&& !ItemUseability.IsTargeted(item.Useability))
|
||||
actions.Add(new ItemPolicyAction(ItemPolicyActionKind.SetGroundObject, item.Id,
|
||||
groundObjectId));
|
||||
|
|
@ -418,10 +418,6 @@ public static class ItemInteractionPolicy
|
|||
|| ((valid & ClothingLocations) != 0 && (current & ClothingLocations) == 0)
|
||||
|| ((valid & HeldLocations) != 0 && (current & HeldLocations) == 0);
|
||||
|
||||
private static bool IsUseable(uint useability)
|
||||
=> (ItemUseability.SourceFlags(useability)
|
||||
& ~(ItemUseability.No | ItemUseability.NeverWalk)) != 0;
|
||||
|
||||
private static ItemPlacementPolicyDecision PlaceOnGround(
|
||||
in ItemPlacementPolicyInput input)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue