Skip to Content
The Alchemy Project

Shops, Sanctums & Inns

This page is a guide to the games/tbs/src/shop/ folder of the Alchemy project. Its code runs every town counter in Golden Sun: The Broken Seal, covering shops, sanctums, inns, and the full-pack item picker.

Whenever Isaac steps up to a counter to buy gear, sell artifacts, repair a broken weapon, revive a fallen friend, or rest for the night, a blocking loop in this folder takes over. It also handles the item-drop picker that appears when every character's pack is full on a treasure pickup.

The sections below explain how shop inventories, pricing, global artifact counters, hidden Game Ticket tallies, sanctum services, and inns work, followed by the file map. Conceptual context is given in Dialogue, Menus & Shops.

Pricing, services, and shop_stock.c

In a Sanctum, choosing Revive quotes a price for downed allies, skips healthy ones, and plays the revival sparkle animation
In a Sanctum, choosing Revive quotes a price for downed allies, skips healthy ones, and plays the revival…
  • Shop stock table (shop_stock.c): One row per shop names its kind, ordinary stock, and rare stock. Weapon, armour, and item shops run identical code, indexing parallel dialogue sets by a fixed offset.
  • Pricing, global artifacts, and Game Tickets: Shops buy at 75% (50% if broken) and repair at 25%. Selling rare artifacts increments global counters in Game Logic & Tables. Cumulative coins spent also increment a hidden deterministic tally that grants Game Tickets at fixed thresholds.
  • Sanctums (shop_sanctum.c): Revive, Cure Poison, Repel Evil, and Remove Curse share one light-show sequence differing only in status check, clear mask, and fee.
  • Inns (shop_inn.c): Inns charge per living party member. Downed allies are neither billed nor healed.
  • Item picker (shop_item_picker.c): Reuses the Sell UI without a shopkeeper when every pack is full on treasure pickup.

File map

File(s)Role
shop.c, shop_internal.hParent translation unit #includeing all shop_*.c parts into one object
shop_run.c, shop_buy.c, shop_sell.c, shop_repair.c, shop_cursor.cMain Buy, Sell, Artifacts, and Repair loop and trade sub-screens
shop_stock.cMaster stock table for every town shop
shop_sanctum.c, shop_inn.c, shop_item_picker.c, stubs.sSanctum, inn, full-pack item picker, and jump-table stubs

Source files

src/shop/

FileDescription
shop.cThe shop object: every counter the party trades at.
shop_buy.cBuying: the stock list, the money and party windows, quantities and prices.
shop_cursor.cThe shop's quantity bar and price sprites, the field's colours tinted and restored (the Sanctum's healing, a Djinni joining the party), and the hand cursor's glides.
shop_inn.cThe inn: room prices, checking in and the night's sleep.
shop_internal.hWhat every part of the shop object shares: its includes, the shop actions and sanctum services, and the values that differ by edition.
shop_item_picker.cThe item picker: which party member's item to drop when every pack is full.
shop_repair.cRepairing broken items.
shop_run.cRunning a shop, its cursor state, and the message helpers every counter uses.
shop_sanctum.cA Sanctum: its healer's services, their donations, and the burst of sparkles as one is given.
shop_sell.cSelling: choosing a party member, the item grid and the sale.
shop_stock.cThe Game Ticket counter, the gift items and every shop's stock.
shop_tables.cThe shop's tables: the quantity bar's and the price digits' tile offsets, the Game Ticket costs, the gift items, every shop's stock, the sanctum's tunes and the inns' prices.

include/shop/

FileDescription
shop.hThe counters of a town, shops, sanctums and inns: SHOP_STATE, the state they share, the shop screen's tiles, and every function of the shop object.
stubs.hShops, inns and the cursors used by their screens.