fix: stealing no longer takes items out of a locked container (#2681)
`TryStealItem` doesn't check for a locked container, so an item that can still be targeted inside one (the gump stays open when it gets locked, or the client targets by serial) is stolen without picking the lock.
It now refuses with 501747 ("It appears to be locked."); GMs are exempt, and stealing the locked container itself is unchanged. It checks the lock directly rather than calling `CheckLift`, which would also refuse items in deco containers.
This commit is contained in:
parent
225c634bf7
commit
e440c6fafa
1 changed files with 7 additions and 0 deletions
|
|
@ -45,6 +45,9 @@ public static class Stealing
|
|||
public static bool IsEmptyHanded(Mobile from) =>
|
||||
from.FindItemOnLayer(Layer.OneHanded) == null && from.FindItemOnLayer(Layer.TwoHanded) == null;
|
||||
|
||||
private static bool IsInLockedContainer(Item item) =>
|
||||
item.Parent is Item parent && (parent is LockableContainer { Locked: true } || IsInLockedContainer(parent));
|
||||
|
||||
public static TimeSpan OnUse(Mobile m)
|
||||
{
|
||||
if (!IsEmptyHanded(m))
|
||||
|
|
@ -249,6 +252,10 @@ public static class Stealing
|
|||
{
|
||||
_thief.SendLocalizedMessage(502710); // You can't steal that!
|
||||
}
|
||||
else if (_thief.AccessLevel < AccessLevel.GameMaster && IsInLockedContainer(toSteal))
|
||||
{
|
||||
_thief.SendLocalizedMessage(501747); // It appears to be locked.
|
||||
}
|
||||
else
|
||||
{
|
||||
var w = toSteal.Weight + toSteal.TotalWeight;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue