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

- 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.h | Parent translation unit #includeing all shop_*.c parts into one object |
shop_run.c, shop_buy.c, shop_sell.c, shop_repair.c, shop_cursor.c | Main Buy, Sell, Artifacts, and Repair loop and trade sub-screens |
shop_stock.c | Master stock table for every town shop |
shop_sanctum.c, shop_inn.c, shop_item_picker.c, stubs.s | Sanctum, inn, full-pack item picker, and jump-table stubs |
Source files
| File | Description |
|---|---|
shop.c | The shop object: every counter the party trades at. |
shop_buy.c | Buying: the stock list, the money and party windows, quantities and prices. |
shop_cursor.c | The 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.c | The inn: room prices, checking in and the night's sleep. |
shop_internal.h | What 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.c | The item picker: which party member's item to drop when every pack is full. |
shop_repair.c | Repairing broken items. |
shop_run.c | Running a shop, its cursor state, and the message helpers every counter uses. |
shop_sanctum.c | A Sanctum: its healer's services, their donations, and the burst of sparkles as one is given. |
shop_sell.c | Selling: choosing a party member, the item grid and the sale. |
shop_stock.c | The Game Ticket counter, the gift items and every shop's stock. |
shop_tables.c | The 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. |
| File | Description |
|---|---|
shop.h | The 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.h | Shops, inns and the cursors used by their screens. |