The Velan Codex

Chapter

Save model impact (`Velan.Save`)

(Idea) A short spec for a later pure-C# ticket. Velan.Save stores what the player holds; it doesn't know the catalogue, so it checks shapes, not rules. Caps, prices, slot kinds and standing belong to the item rules (VEL-78 decides where they live).

What to add

Bump SaveSchema.CurrentVersion to 2. New fields on SaveGame, all required, in this JSON shape (camelCase, like the rest of the save):

"purse": 20,
"inventory": [
  { "itemId": "homespun_tunic", "count": 1 },
  { "itemId": "warden_band", "count": 2 },
  { "itemId": "mend_tonic", "count": 3 }
],
"equipment": { "leftBand": "warden_band", "rightBand": "warden_band", "charm": "", "coat": "homespun_tunic" },
"belt": ["mend_tonic", "", ""],
"prepared": { "meal": "eel_pie", "ward": "" }
public int Purse;
public List<ItemStack> Inventory = new List<ItemStack>();
public Equipment Equipment = new Equipment();
public List<string> Belt = new List<string> { "", "", "" };
public PreparedItems Prepared = new PreparedItems();

public sealed class ItemStack { public string ItemId = ""; public int Count; }
public sealed class Equipment { public string LeftBand = ""; public string RightBand = ""; public string Charm = ""; public string Coat = ""; }
public sealed class PreparedItems { public string Meal = ""; public string Ward = ""; }

Rules for the serializer

Reject, with SaveFormatException naming the field, as the existing readers do:

Don't check that equipped, belt or prepared ids are in the inventory, or that counts are under the caps: the catalogue can change between builds, and the item rules fix that up on load (an equipped item no longer held is unequipped; an unknown id is dropped and logged).

New game and migration

Tests

For the item rules and dialogue (not Velan.Save)

Listed so VEL-78 and the dialogue tickets have them in one place: item data files in Assets/StreamingAssets/Data/Items/<id>.json with an index.json (id, name, category, slot, tier, faction, price, stats, pair bonus, flavour, icon), shop files in Data/Shops/<id>.json (stock with optional price overrides, flag conditions and commission materials); add and remove with the stack caps and overflow sale; buy and sell with the standing modifier; equip checks for slot kind and stack count; stat totals with the caps from section 2; and dialogue commands <<give_item id count>>, <<take_item id count>>, <<give_copper n>>, <<open_shop id>> with functions item_count("id") and copper().

From Items and Economy › Save model impact (`Velan.Save`)