fix: LastMoved and stat-gain stamps stay absolute across restarts (#2729)

ReadAnchoredTime shifted Item.LastMoved, Item.DecayResetTime and
Mobile.LastStr/Int/DexGain forward by the downtime at load. The bytes
were stable from save to save, but the first save after every restart
rewrote one timestamp in nearly every item record and most mobile
records, which defeats any per-record backup or delta save.

- LastMoved and DecayResetTime are read as saved. The downtime credit
  is applied after load by Item.CreditDowntimeToDecay, which moves
  DecayResetTime only for items whose decay countdown was still running
  when the save started. Every other item keeps its bytes, and decay
  timing is unchanged.
- World.LoadedSaveStartTime exposes the loaded save's anchor so the
  credit can tell which countdowns were running.
- Stat-gain stamps are read raw. The cooldown is minutes long, so
  downtime counting toward it costs nothing.

No format change: these fields were already absolute ticks.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kamron Batman 2026-10-25 16:27:12 -07:00 • committed by GitHub
parent ab59efea86
commit 9af7dd555a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 157 additions and 12 deletions

View file

@ -108,6 +108,12 @@ public static class World
/// payloads, which carry no anchor of their own. Zero for saves that predate the anchor.
/// </summary>
public static TimeSpan LoadTimeShift { get; internal set; }
/// <summary>
/// UTC start time of the save being loaded, read from its index anchor. Default for saves
/// that predate the anchor.
/// </summary>
public static DateTime LoadedSaveStartTime { get; internal set; }
public static bool Running => WorldState is not WorldState.Loading and not WorldState.Initial;
public static bool Loading => WorldState == WorldState.Loading;
@ -674,6 +680,7 @@ public static class World
}
item.ClearProperties();
item.CreditDowntimeToDecay(LoadedSaveStartTime, LoadTimeShift);
item.UpdateDecayRegistration();
}
}