- A character's purse holds gold, silver and copper as separate coins: 1 gold = 10 silver = 100 copper. The money log records each entry's coin. - Spending and giving are paid from the whole purse: coins of the kind named go first, then the nearest bigger coin is broken (change comes back in as few coins as possible), then smaller coins are counted out. A payment is refused only when the whole purse isn't worth enough. - Exchange converts one coin into another at the fixed worth. - Encounter rewards and gifts between characters can be in any coin; the party overview shows the whole purse. - All packages at version 1.4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 lines
620 B
SQL
11 lines
620 B
SQL
-- CreateEnum: the three coins. Silver is worth 0.1 gold, copper 0.01 gold.
|
|
CREATE TYPE "Currency" AS ENUM ('GOLD', 'SILVER', 'COPPER');
|
|
|
|
-- AlterTable: a character's purse holds each coin separately
|
|
ALTER TABLE "characters" ADD COLUMN "silver" INTEGER NOT NULL DEFAULT 0;
|
|
ALTER TABLE "characters" ADD COLUMN "copper" INTEGER NOT NULL DEFAULT 0;
|
|
|
|
-- AlterTable: every ledger entry and coin reward is in one coin; all existing ones are gold
|
|
ALTER TABLE "gold_transactions" ADD COLUMN "currency" "Currency" NOT NULL DEFAULT 'GOLD';
|
|
ALTER TABLE "encounter_rewards" ADD COLUMN "currency" "Currency" NOT NULL DEFAULT 'GOLD';
|