ModernUO/Projects/UOContent/Items
Kamron Batman 2935eafe24
feat: convert all delta-time serialization to anchored time (#2589)
## Summary

Phase 3 of the anchored-time work: **every actively-written delta-time value in the engine now stores an anchored timestamp** — absolute on the wire, shifted forward by the downtime at load. Remaining time survives restarts (as delta did), and unlike delta, the bytes do not change on every save, so an idle world serializes identically save after save.

The answer to "is it possible everywhere": **yes** — including the one case that looked impossible.

## The GenericPersistence problem, solved

`GenericPersistence` bins (`Virtues.bin`, `StealableArtifacts.bin`, …) are raw payloads with no idx header, so they have no anchor of their own — anchored reads there would silently apply zero shift. But the anchor is a property of the **save**, not the file: every file in one save shares one `World.SaveStartTime`, and `Persistence.Load` reads **all** entity indexes (phase 1) before **any** persistence payload (phase 2). So the idx v5 header stamps a save-wide `World.LoadTimeShift`, and generic persistence readers inherit it. No file-format change, no per-bin header, old bins unaffected.

## Converted

- **Item v10 → v11**: `LastMoved` — previously whole-minute delta, rewritten every save for every item, the single largest source of idle-save churn — and `DecayResetTime` (retiring the TODO from #2583). **Mobile v37 → v38**: the three stat-gain stamps. **BaseCreature v20 → v21**: `SummonEnd`.
- **17 code-generated classes** (`[DeltaDateTime]` → `[AnchoredDateTime]`, version bump + `MigrateFrom` each): the five field spells, TransientItem, VirtueContext (×7 fields), PuzzleChestSolutionAndTime, BaseCamp, BaseBoat, RentedVendor, PlayerVendor, Ethics Player, Sheep, StarRoomGate, ChampionSpawn (×3), Corpse (`TimeOfDeath`, v19). The `MigrateFrom` bodies were generated from each class's current migration schema and are compiler-verified; VirtueContext's save-flagged nullables fall back to the same defaults the old deserialize left in place. Corpse's six migrations moved to a new `Corpse.Migrations.cs`.
- **Hand-written sites**: StealableArtifacts (v2), VendorInventory (v1), ML quest objectives (persistence v3) — each gated on its own version.

**Not converted, deliberately**: the ~25 read-only `ReadDeltaTime` sites in legacy version fallbacks and migration replays — they decode existing old bytes and must never change. `[DeltaDateTime]`/`WriteDeltaTime` remain available for them.

## Verification

- Build 0 errors / 0 warnings; **837 + 708 tests green**.
- Schema regeneration produced exactly the 17 expected new `vN.json` files (all `AnchoredTime` rule args), nothing else touched.
- **New acceptance tests** pin the point of the whole effort: serializing the same item at two save times **5 hours apart produces byte-identical output**, and `LastMoved`/`DecayResetTime` round-trip **exactly** at sub-minute precision (the old minutes encoding destroyed both properties).

## Notes for review

- `LastMoved` grows from a 1–3 byte encoded minutes value to 8-byte ticks per item — the price of byte-stability; it repays itself in incremental-save behavior since unchanged items now produce unchanged bytes.
- BaseEscortable-style semantics are unchanged: anchored shift preserves *remaining* time exactly, the same contract delta provided, so no gameplay-visible behavior changes — deadlines simply stop being consumed by downtime that delta already protected against, now with stable bytes.

## Enforcement

`WriteDeltaTime` is now `[Obsolete]` (interface + implementation). With the repo's warnings-as-errors, any new delta-time write — hand-written or emitted by a still-unconverted `[DeltaDateTime]` field — fails the build, with the migration instructions in the message. That the full solution still builds with **zero warnings** is itself the proof no active delta writer survived the conversion. `ReadDeltaTime` deliberately stays un-attributed: its remaining callers decode existing old bytes and are correct forever; its XML docs now state the legacy-decode-only contract.
2026-08-22 19:34:43 -07:00
..
Addons refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Aquarium refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Armor refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Body Parts feat: Adds pre-T2A-pub15 bounty system (#2377) 2026-03-22 12:35:16 -07:00
Books feat: adopt serialization generator v4 (field-side linkage, anchored timers) (#2586) 2026-08-22 17:54:02 -07:00
Bulletin Boards feat: Adds pre-T2A-pub15 bounty system (#2377) 2026-03-22 12:35:16 -07:00
Champion Artifacts fix: Optimizes items to use default weights. (Part 2) (#2241) 2025-07-24 15:41:44 -07:00
Clothing refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Construction refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Containers refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Decoration Artifacts fix: Optimizes items to use default weights. (Part 2) (#2241) 2025-07-24 15:41:44 -07:00
Deeds refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Facial Formats UO Content (#201) 2020-08-27 18:30:38 -07:00
Farming fix: fixes the id for farmable cabbage (#2227) 2025-07-02 15:04:48 -07:00
Food refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Games refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Gems fix: Codegens gems (#1059) 2022-06-13 17:38:46 -07:00
Guilds fix: Eliminates double lookup with Contains->Remove (#2539) 2026-07-19 09:26:27 -07:00
Jewels refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Lights feat: adopt serialization generator v4 (field-side linkage, anchored timers) (#2586) 2026-08-22 17:54:02 -07:00
Maps fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
Minor Artifacts fix: Optimizes items to use default weights. (Part 3) (#2242) 2025-07-24 16:21:27 -07:00
Misc feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
New Haven Quest Rewards fix: Codegen new haven quest rewards (#1269) 2022-11-23 13:00:28 -08:00
PlantsFlowers/Potted fix: Optimizes items to use default weights. (Part 2) (#2241) 2025-07-24 15:41:44 -07:00
Quivers feat: adopt serialization generator v4 (field-side linkage, anchored timers) (#2586) 2026-08-22 17:54:02 -07:00
Resources refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Shields fix: Optimizes items to use default weights. (Part 3) (#2242) 2025-07-24 16:21:27 -07:00
Skill Items refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Special refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Suits refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Talismans refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Traps fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
TreasureChests fix: Items dropped on the ground never decay (#2536) 2026-07-16 18:51:04 -07:00
Wands fix: Optimizes items to use default weights. (Part 4) (#2243) 2025-07-24 23:29:29 -07:00
Weapons feat: adopt serialization generator v4 (field-side linkage, anchored timers) (#2586) 2026-08-22 17:54:02 -07:00