ModernUO/Projects/Server.Tests/Tests/Items
Kamron Batman 2b845b0d8d fix: stop stack merges and splits from laundering PlayerConstructed
PlayerConstructed is per-instance provenance, and #2574 put it on every
crafted item -- including potions, arrows and other stackables. Stack
operations were written when no item carried provenance of any kind, so they
treated two piles of the same graphic as interchangeable.

Merging keeps the receiving stack's value. Dropping bought potions onto a
crafted stack made the whole pile count as crafted; the reverse order erased
it. Which happened was decided by drag direction alone. CanStackWith now
compares PlayerConstructed, so the two never merge into one indistinguishable
pile.

Splitting rebuilds one half in Mobile.LiftItemDupe, which copies a fixed list
of fields rather than going through Dupe/CopyProperties -- PlayerConstructed
was not on that list, so dragging part of a pile off stripped the new half.
Note that [IgnoreDupe] does not govern this path; it only applies to Dupe().
LiftItemDupe now copies the flag, so a split cannot produce halves that
disagree about what they are.

Refusing to merge is the whole fix: a stack has nowhere to record provenance,
so the only coherent behaviour is to keep the two piles apart. Paths that
genuinely virtualize an item -- pouring a potion keg, for one -- rebuild it
without the flag, and the result is simply treated as not crafted.

Adds 7 tests: both merge directions, the matching case, split copying, and the
split/re-merge round trip.
2026-08-13 19:10:31 -07:00
..
ContainerTests.cs perf: Eliminates allocations in Container searching. (#2409) 2026-04-25 13:40:21 -07:00
DecayRegistrationTests.cs fix: Items dropped on the ground never decay (#2536) 2026-07-16 18:51:04 -07:00
PlayerConstructedStackingTests.cs fix: stop stack merges and splits from laundering PlayerConstructed 2026-08-13 19:10:31 -07:00