Game/PumpSave.cs

Data class representing the persistent save state for the DesertPump game. It stores player currency, resources, progression levels, owned cosmetic backgrounds, worker levels, daily streak info, tree growth state, and timestamps used for idle earnings and save/load compatibility.

namespace DesertPump;

/// <summary>
/// Everything that survives a restart. Written to the game's data folder as json,
/// so keep it flat and boring - anything clever here becomes a save migration later.
/// </summary>
public sealed class PumpSave
{
	public double Coins { get; set; }
	public double Water { get; set; }

	/// <summary>Index into <see cref="PumpTier.All"/>.</summary>
	public int PumpLevel { get; set; }

	/// <summary>Shop upgrade levels, indexed by <see cref="UpgradeKind"/>.</summary>
	public int StorageLevel { get; set; }
	public int PowerLevel { get; set; }
	public int ValueLevel { get; set; }

	/// <summary>Kept so older saves still load. Mute now lives in the settings file.</summary>
	public bool Muted { get; set; }

	public long TotalPumps { get; set; }
	public double TotalEarned { get; set; }
	public double TotalLitresSold { get; set; }

	/// <summary>Background ids the player has bought.</summary>
	public List<string> OwnedBackgrounds { get; set; } = new();

	/// <summary>Which background is currently showing.</summary>
	public string SelectedBackground { get; set; } = BackgroundStyle.DefaultId;

	/// <summary>Unix day number of the last daily bonus claim, for the streak.</summary>
	public long LastDailyDay { get; set; }

	public int DailyStreak { get; set; }

	/// <summary>Worker levels, indexed the same as <see cref="WorkerType.All"/>.</summary>
	public List<int> WorkerLevels { get; set; } = new();

	/// <summary>Tree stages grown - the leaderboard score.</summary>
	public int TreeHeight { get; set; }

	/// <summary>Litres poured into the stage in progress.</summary>
	public double TreeWater { get; set; }

	/// <summary>Unix seconds the growing stage finishes, 0 when idle.</summary>
	public long TreeGrowsAt { get; set; }

	/// <summary>Unix seconds at the last write, used to pay out idle earnings.</summary>
	public long SavedAt { get; set; }
}