fix: stealing from a container on the ground follows its lift rules (#2697)

`Stealing` moves the item with `AddToBackpack` and never asks the container, so a theft skipped the rules a container sets for a hand lift: a treasure chest's crime, refusal and guardian roll, a boat hold from outside the boat, a house's moving crate, and the Haochi/Emino quest chests.

An item in a container on the ground now goes through its `CheckLift` after the weight check, and a successful theft calls `OnItemLifted`, as a hand lift does. Deco containers are skipped: their `CheckLift` refuses everyone, and stealing is the only way into them.

These are the containers with their own `CheckLift` that a thief can reach:

| Container on the ground | What a hand lift already enforces | A theft until now |
|---|---|---|
| Treasure map chest | crime for a non-owner; refused if temporary, or for a non-owner on Trammel rules; guardian roll | none of it |
| Boat hold | only from aboard, while the boat is stopped | also from outside the boat, or while it moves |
| House moving crate | owner only | anyone |
| Haochi / Emino quest chests | one item, only while on the quest | anyone, any number, and it didn't count for the quest |
| Fish bowl not locked down | the fish stay in | the fish could be stolen |
This commit is contained in:
Sergi Rosell 2026-10-09 09:21:43 +02:00 • committed by GitHub
parent ee4c174e34
commit 0dbb0f5a2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,7 @@ using Server.Factions;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Network;
using Server.Spells;
using Server.Spells.Fifth;
using Server.Spells.Ninjitsu;
@ -259,12 +260,17 @@ public static class Stealing
else
{
var w = toSteal.Weight + toSteal.TotalWeight;
var reject = LRReason.Inspecific;
if (w > MaxWeightToSteal)
{
// This item is too heavy to steal from someone's backpack.
_thief.SendLocalizedMessage(502722);
}
else if (root is Container { IsDecoContainer: false } && !toSteal.CheckLift(_thief, toSteal, ref reject))
{
_thief.SendLocalizedMessage(502710); // You can't steal that!
}
else
{
if (toSteal.Stackable && toSteal.Amount > 1)
@ -375,6 +381,11 @@ public static class Stealing
if (stolen != null)
{
if (root is Container)
{
stolen.OnItemLifted(from, stolen);
}
from.AddToBackpack(stolen);
if (!(stolen is Container || stolen.Stackable))