ModernUO/Projects/UOContent/Items/Addons
Kamron Batman b042edcf0b
refactor: fold hand-written serializable property setters into field hooks (#2587)
## Summary

Folds **113** hand-written `[SerializableProperty]` members into plain `[SerializableField]` declarations using the v4 setter hooks — value coercion/vetoes via `allowFieldChange`, post-change side effects via `fieldChanged` (whose `oldValue` parameter covers the old-house/old-sender unsubscribe patterns). Net **-450 lines** of setter boilerplate.

```cs
// before
[SerializableProperty(1)]
[CommandProperty(AccessLevel.GameMaster)]
public int Charges
{
    get => _charges;
    set
    {
        _charges = Math.Clamp(value, 0, MaxCharges);
        InvalidateProperties();
        this.MarkDirty();
    }
}

// after
[SerializableField(1, allowFieldChange: nameof(AllowChargesChange))]
[SerializedCommandProperty(AccessLevel.GameMaster)]
[InvalidateProperties]
private int _charges;

private bool AllowChargesChange(ref int value)
{
    value = Math.Clamp(value, 0, MaxCharges);
    return true;
}
```

## How sites were selected

A classifier parsed all 204 `[SerializableProperty]` sites and converted only those matching strict shapes: getter is exactly `get => _field;`, the assignment comes first (after at most an equality guard), and relocated side effects contain no `return`, no `value` mutation, and no field re-assignment. Everything else was left alone deliberately:

- **~34 custom getters** (fallback defaults like `_x == -1 ? Default : _x`, self-healing refs) — no setter hook can express these.
- **~35 pre-assignment logic** (durability Unscale/Scale sandwiches, old-state captures like PotionKeg's pile weight).
- **virtual/override members, name-mismatched backing fields (`m_`), exotic semantics** (guards' `Focus` does work on *equal* assignment; `ChampionSpawn.Active` never assigns its field).

Five sites the classifier refused were converted by hand where the hooks fit cleanly: `ReceiverCrystal.Sender`, `PlayerVendor.House`, `PlayerBarkeeper.House` (old-value unsubscribe via `oldValue`), `BaseSuit.AccessLevel` (its existing virtual `OnAccessLevelChanged` already had the exact callback shape), and `DyeTub.DyedHue` (a true veto: `AllowDyedHueChange(ref int value) => _redyable`).

## Verification

- Build: **0 errors, 0 warnings**.
- **Schema regeneration produces zero Migrations changes** — the conversion is wire- and schema-neutral by construction (same orders, types, and property names), and CI's schema diff check enforces it.
- **835 + 708 tests green.**

## Behavioral notes (all strict improvements, called out for review)

- Generated setters skip everything when the incoming value equals the current one; a few converted setters previously re-ran side effects on equal assignment (redundant `Update()`-style refreshes).
- Generated setters always `MarkDirty()` on change; several converted setters never did (e.g. `DyeTub.DyedHue`, `MorphItem` ranges) — their changes only persisted if something else dirtied the entity. Those latent persistence bugs are fixed by construction.
2026-08-22 18:20:39 -07:00
..
AbbatoirAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
AddonComponent.cs fix: Fixes null components in BaseAddon (#2208) 2025-06-02 22:11:40 -10:00
AddonContainerComponent.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
AlchemistTableEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
AlchemistTableSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
AnvilEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
AnvilSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ArcaneBookshelfEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ArcaneBookshelfSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ArcaneCircleAddon.cs fix: Fixes addons that do not give deeds (#1224) 2022-11-02 19:26:51 -07:00
ArcanistStatueEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ArcanistStatueSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ArcheryButteAddon.cs fix: Fixes crafter deserialize, cleans up bandages, and codegens misc items (#1350) 2023-02-25 00:54:12 -08:00
BallotBox.cs perf: Migrate Holiday and Decorative gumps to DynamicGump/StaticGump (#2413) 2026-04-25 17:22:41 -07:00
BaseAddon.cs refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
BaseAddonContainer.cs refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
BaseAddonContainerDeed.cs refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
BaseAddonDeed.cs fix: Optimizes items to use default weights. (Part 1) (#2240) 2025-07-24 14:44:39 -07:00
BearRugs.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
BloodPentagram.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
DartBoard.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
ElvenBedEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenBedSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenDresserEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenDresserSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenForgeAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenLoveseatEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenLoveseatSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenSpinningWheelEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenSpinningwheelSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenStoveEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenStoveSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenWashbasinEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ElvenWashbasinSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
FancyElvenTableEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
FancyElvenTableSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
FireColumnAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
FlourMillEastAddon.cs refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
FlourMillSouthAddon.cs refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
FlowerTapestries.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
GiantWebs.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
GozaMats.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
GrayBrickFireplaceEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
GrayBrickFireplaceSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
JackOLantern.cs fix: Fixes addons that do not give deeds (#1224) 2022-11-02 19:26:51 -07:00
LargeBedEastAddon.cs fix: Codegens construction items (#1520) 2023-09-29 23:28:51 -07:00
LargeBedSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
LargeForgeEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
LargeForgeSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
LargeStoneTableEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
LargeStoneTableSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
LoomEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
LoomSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
MediumStoneTableEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
MediumStoneTableSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
OrnateElvenChestEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
OrnateElvenChestSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
OrnateElvenTableEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
OrnateElvenTableSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ParrotPerchAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
PentagramAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
PickpocketDips.cs feat: Adds SerializedCommandProperty (#1249) 2022-11-14 18:24:33 -08:00
PyramidAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
RejuvinationAnkhs.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SandstoneFireplaceEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SandstoneFireplaceSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SandstoneFountainAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SerpentPillarAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
ShrineOfWisdomAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SHTeleporter.cs refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
SkullPileAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SmallBedEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SmallBedSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SmallForgeAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SolenAntHole.cs fix: Fixes serialization and dirty tracking conveniences (#1627) 2023-12-03 15:55:31 -08:00
SpinningwheelEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SpinningwheelSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SquirrelStatueEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
SquirrelStatueSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
StoneFireplaceEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
StoneFireplaceSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
StoneFountainAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
StoneOvenEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
StoneOvenSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
StretchedHides.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
TallElvenBedEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
TallElvenBedSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
Telescope.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
TrainingDummies.cs feat: Adds SerializedCommandProperty (#1249) 2022-11-14 18:24:33 -08:00
WarriorStatueEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
WarriorStatueSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
WaterTroughEastAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
WaterTroughSouthAddon.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00
WaterVat.cs fix: Updates serialization to use v2.0 (#998) 2022-04-17 08:02:15 -07:00