Skip to Content
The Alchemy Project

Shops, Sanctums, Inns & Forge

This page is a guide to the games/tla/src/shop/ folder of the Alchemy project. Every town counter in Golden Sun: The Lost Age runs from its code, from weapon shops and inns to sanctums and Sunshine's Forge.

These blocking UI routines take over whenever Felix buys gear, rests at an inn, or revives a fallen ally at a Sanctum. Beyond The Broken Seal's counters, The Lost Age adds General Stores, Sunshine's Forge in Yallam, and an item picker reused by Naribwe's fortune teller.

The sections below cover Sunshine's Forge and how it rolls and delivers forged equipment, followed by notes on shops, sanctums, inns, the item picker, and a file map. Conceptual context is given in Dialogue, Menus & Shops.

Sunshine's Forge (shop_forge.c)

Felix hands a Tear Stone to Sunshine at his anvil in Yallam so he can begin forging it
Felix hands a Tear Stone to Sunshine at his anvil in Yallam so he can begin forging it

mnForgeRun reuses the Sell UI filtered to forgeable items, backed by weighted recipe tables in shop_tables.c. The 9 forgeable materials each roll among 4–7 weighted outcomes (a Tear Stone can become a Cloud Wand or a Spirit Ring), while the 11 rusty weapons each map to one fixed weapon.

The output is rolled at drop-off and saved in MainRoutineStateWork. It is finished as soon as Felix talks to Yallam's innkeeper across the counter (staying the night is not required), after which Sunshine's wife sells him the finished item.

Shops, sanctums, inns, and the item picker

At Daila's sanctum, choosing Revive highlights downed Jenna, skips healthy allies, and revives Jenna with sparkles
At Daila's sanctum, choosing Revive highlights downed Jenna, skips healthy allies, and revives Jenna with…
  • Shops and General Stores (mnShopRun, shop_tables.c): Each shop gets one table row across 4 dialogue voices (Weapon, Armor, Item, and General Store). General Stores resell global rare artifacts of every equipment category tracked in Game Logic & Tables. Shops buy at 75% (50% if broken), repair at 25%, and track a deterministic hidden coin-spent tally for Game Tickets.
  • Sanctums (shop_sanctum.c, mnSanctumRun): Revive, Cure Poison, Repel Evil, and Remove Curse share one light-show sequence, differing only in their status check, clear mask, and fee.
  • Inns (shop_inn.c, mnInnCheckIn): Inns charge per living party member; downed allies are neither billed nor healed.
  • Item picker (shop_item_picker.c, mnItemPickerRun): Reuses the Sell UI without a shopkeeper for full-pack drops. Naribwe's fortune teller also reuses it for the choice of any unequipped or removable item.

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.cmnShopRun loop across Buy, Sell, Artifacts, and Repair
shop_tables.c, shop_stock.cMaster shop stock table and Sunshine's Forge recipe and weight tables
shop_forge.cmnForgeRun: Sunshine's smithy in Yallam
shop_sanctum.c, shop_inn.c, shop_item_picker.c, stubs.sSanctum, inn, item picker, and jump-table stubs exported to scene overlays

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 quantity bar, the price digits and their sprites, the field's tint behind the sanctum and the Djinn, the hand cursor's glides, and loading a picture into VRAM.
shop_forge.cThe forge: its recipes, the materials the party holds and the roll for the result.
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, its state, the counters and services it runs, the stock table's columns and the tables shop_tables.c holds.
shop_item_picker.cThe forge's counter; the item picker scripts use to choose one of a party member's items, to show Naribwe's fortune teller or to drop; and the grid of item icons the shop's windows draw.
shop_repair.cRepairing broken items.
shop_run.cRunning a shop: the artifacts it lists, opening its state, the counter's loop and the message helpers every counter uses.
shop_sanctum.cThe sanctum's services, their donations and their sparkles.
shop_sell.cSelling: choosing a party member, the item grid and the sale.
shop_stock.cThe Game Ticket counter 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 forge's recipes, the sanctum's tunes and the inns' prices.

include/shop/

FileDescription
shop.hWhat the shop object defines for the code outside it.
stubs.hThe stub calls into the shop module, as the other modules' code calls them.