Documentation
¶
Overview ¶
Package crafting keeps a campaign's crafting: the recipes its Directors write, the crafting tags on Armory items, the benches recipes are made at, and the campaign's crafting settings.
Nothing here knows a game system or a campaign. How a project is rolled (the dice, the characteristics, what an edge is worth) comes read-only from the enabled system's manifest; steps, tags and bench kinds are this plugin's fixed library, so nothing a Director or their AI writes can break the bench that plays a recipe.
The browser HTTP surface for crafting. Handlers bind, call the service and shape the response; the service owns every rule, so a mis-wired route cannot widen access.
Hand-written SQL for recipes, who knows them, material tags, benches and settings.
SECURITY: every statement filters on campaign_id, so an id from another campaign never reads or changes anything here.
Route registration for crafting.
Index ¶
- Constants
- Variables
- func AIRuleData(r Rule) json.RawMessage
- func CleanLooks(raw json.RawMessage) map[string]*Look
- func RegisterRoutes(e *echo.Echo, h *Handler, campaignSvc campaigns.CampaignService, ...)
- func TierLabels(tops []int) []string
- type AIRecipe
- type Armory
- type ArrangementInput
- type Bench
- type BenchInput
- type BenchKind
- type BenchPlay
- type BookMaterial
- type BookPage
- type Botch
- type BreakInput
- type BreakResult
- type CalendarSource
- type CampaignDirectory
- type Catalog
- type CatalogTable
- type CharacterCrafting
- type Choice
- type Colors
- type Cond
- type Cost
- type CraftNeed
- type CraftRecipe
- type CraftSub
- type Day
- type DayMoon
- type Days
- type Directory
- type Discover
- type DropInput
- type DropLine
- type DropList
- type DropView
- type Effect
- type Enchant
- type EntityInfo
- type Extras
- type Fight
- type FightCreature
- type FightSpoils
- type GenerateInput
- type GenerateResult
- type GeneratedMaterial
- type GeneratedRecipe
- type Handler
- func (h *Handler) Approve(c *echo.Context) error
- func (h *Handler) Book(c *echo.Context) error
- func (h *Handler) BreakDown(c *echo.Context) error
- func (h *Handler) CancelProject(c *echo.Context) error
- func (h *Handler) Catalog(c *echo.Context) error
- func (h *Handler) Character(c *echo.Context) error
- func (h *Handler) ClearSpoil(c *echo.Context) error
- func (h *Handler) ClearSpoilLine(c *echo.Context) error
- func (h *Handler) ClearTray(c *echo.Context) error
- func (h *Handler) CreateBench(c *echo.Context) error
- func (h *Handler) CreateMaterial(c *echo.Context) error
- func (h *Handler) CreateRecipe(c *echo.Context) error
- func (h *Handler) DeleteBench(c *echo.Context) error
- func (h *Handler) DeleteDrops(c *echo.Context) error
- func (h *Handler) DeletePack(c *echo.Context) error
- func (h *Handler) DeleteRecipe(c *echo.Context) error
- func (h *Handler) Experiment(c *echo.Context) error
- func (h *Handler) Generate(c *echo.Context) error
- func (h *Handler) GetBench(c *echo.Context) error
- func (h *Handler) GetRecipe(c *echo.Context) error
- func (h *Handler) GiveRoll(c *echo.Context) error
- func (h *Handler) Help(c *echo.Context) error
- func (h *Handler) ImportPack(c *echo.Context) error
- func (h *Handler) ItemBlock(c *echo.Context) error
- func (h *Handler) ItemCrafting(c *echo.Context) error
- func (h *Handler) Library(c *echo.Context) error
- func (h *Handler) ListBenches(c *echo.Context) error
- func (h *Handler) ListPacks(c *echo.Context) error
- func (h *Handler) ListRecipes(c *echo.Context) error
- func (h *Handler) LogRespite(c *echo.Context) error
- func (h *Handler) PackDetail(c *echo.Context) error
- func (h *Handler) PackFile(c *echo.Context) error
- func (h *Handler) Page(c *echo.Context) error
- func (h *Handler) PlaceItemBlock(c *echo.Context) error
- func (h *Handler) Projects(c *echo.Context) error
- func (h *Handler) PutSpoils(c *echo.Context) error
- func (h *Handler) RevealSpoil(c *echo.Context) error
- func (h *Handler) RollProject(c *echo.Context) error
- func (h *Handler) SaveArrangement(c *echo.Context) error
- func (h *Handler) SaveDrops(c *echo.Context) error
- func (h *Handler) SavePack(c *echo.Context) error
- func (h *Handler) SaveRules(c *echo.Context) error
- func (h *Handler) SaveSettings(c *echo.Context) error
- func (h *Handler) SaveUpgrades(c *echo.Context) error
- func (h *Handler) SetItemPicture(c *echo.Context) error
- func (h *Handler) SetKindPictures(c *echo.Context) error
- func (h *Handler) SetPoints(c *echo.Context) error
- func (h *Handler) SetTags(c *echo.Context) error
- func (h *Handler) Spoils(c *echo.Context) error
- func (h *Handler) StartProject(c *echo.Context) error
- func (h *Handler) StudySpoil(c *echo.Context) error
- func (h *Handler) TakeSpoil(c *echo.Context) error
- func (h *Handler) UpdateBench(c *echo.Context) error
- func (h *Handler) UpdatePack(c *echo.Context) error
- func (h *Handler) UpdateRecipe(c *echo.Context) error
- func (h *Handler) UploadPack(c *echo.Context) error
- type HelpInput
- type HelpView
- type ImportInput
- type ImportResult
- type Ingredients
- type ItemCrafting
- type ItemDrop
- type ItemLook
- type ItemMaker
- type ItemUse
- type Keeps
- type Kept
- type KeptPick
- type KindPicturesInput
- type KnownItem
- type LayoutPlacer
- type Level
- type Library
- type Look
- type LookMark
- type LookSpot
- type MakeKind
- type Mastery
- type Material
- type MaterialInput
- type MaterialItem
- type MaterialPicture
- type Mishap
- type Mishaps
- type Named
- type Pack
- type PackChange
- type PackDetail
- type PackItem
- type PackLine
- type PackMaterial
- type PackRecipe
- type PackRow
- type PackSkipped
- type PackStore
- type PackView
- type PageInfo
- type Pages
- type Picture
- type Piece
- type Project
- type ProjectDeps
- type ProjectDetails
- type ProjectRoll
- type ProjectStore
- type ProjectView
- type ProjectsPage
- type PutInput
- type PutResult
- type Quality
- type Recipe
- type RecipeInput
- type Repository
- type Respite
- type RespiteHook
- type RespiteResult
- type Result
- type RollInput
- type RollLog
- type RollResult
- type Rule
- type RulesChange
- type RulesInput
- type RulesSource
- type Salvage
- type SavePackInput
- type Service
- type SetPointsInput
- type Settings
- type Sheets
- type Spoil
- type SpoilLine
- type SpoilLineView
- type SpoilStore
- type SpoilView
- type SpoilsPage
- type StartInput
- type Step
- type StepKind
- type StepOption
- type Study
- type StudyResult
- type StudyView
- type Substitute
- type TableRow
- type Tables
- type Tag
- type TakeInput
- type TakeResult
- type TakenView
- type Template
- type TemplateStep
- type Term
- type Tier
- type Tool
- type TryInput
- type TryPick
- type TryResult
- type TryView
- type TurnStore
- type Upgrades
- type UpgradesInput
- type Viewer
- type Worked
Constants ¶
const ( BotchBane = "bane" BotchQuirk = "baneAndQuirk" BotchIngredients = "baneAndIngredients" )
Botch costs: what botched work at the bench costs on top of its bane.
const ( ProjectActive = "active" ProjectMade = "made" ProjectCancelled = "cancelled" )
Project statuses.
const ( WorkClean = "clean" WorkBotched = "botched" WorkSteady = "steady" WorkSkipped = "skipped" )
How the steps went, as the bench reports them when the roll is made: clean work earns an edge, botched work a bane when the campaign gives banes, steady work or a slip is a plain roll, and skipped steps are a plain roll the campaign may refuse.
const ( DropTake = "take" DropHarvest = "harvest" )
How a drop line is taken: as it is, or harvested with a test whose three tiers each pay an amount.
const ( SpoilWaiting = "waiting" SpoilTaken = "taken" SpoilCleared = "cleared" SpoilLost = "lost" )
Spoil line statuses. A lost line was a one chance find whose study failed: nobody gets it.
const ( StudyMiss = "miss" StudyKnown = "known" StudyLost = "lost" StudyRevealed = "revealed" )
How a study went. A study's row is written before its dice are rolled, with no outcome, and filled in after; a reveal is the Director naming an item without a roll.
const ( TurnTry = "try" TurnHelp = "help" )
Turn kinds, as crafting_turns keeps them.
const ( TryUsed = "used" TryHalf = "half" TryKept = "kept" )
What a try that finds nothing costs, as Discover.FailedTry says.
const ( TryFound = "found" TryClose = "close" TryNothing = "nothing" )
What a try came to.
const AddonSlug = "crafting"
AddonSlug is the addon that turns the Crafting app on for a campaign.
const ItemBlockType = "crafting_item"
ItemBlockType is the page block that shows "How it's made" and "In crafting" on an Armory item's page.
const MaxBodyBytes = 256 << 10
MaxBodyBytes caps a request body. A recipe with forty rules and every look filled is well under it; a bench arrangement is the largest thing sent.
const (
PackFormat = "chronicle-recipe-pack"
)
Pack limits.
const PluginSlug = "crafting"
PluginSlug names this plugin in the registry and the health/migration bookkeeping.
Variables ¶
var BenchKinds = []BenchKind{ {Key: "apothecary", Name: "Apothecary bench", Tools: []string{"mortar", "flask", "burner"}}, }
BenchKinds are the stations the engine can draw today.
var Difficulties = []Choice{{"easy", "Forgiving"}, {"std", "Standard"}, {"hard", "Exacting"}}
Difficulties set how tight the bench's timing is (craft_scene.js DIFF).
var MakeKinds = []MakeKind{ {Key: "potions", Label: "Potions", For: "consumable", Templates: []string{"steady", "volatile"}, Nouns: []string{"Draught", "Tonic", "Elixir", "Tincture", "Philter"}, Kinds: []string{"herb", "liquid", "fungus", "magic_essence"}}, {Key: "salves", Label: "Salves", For: "consumable", Templates: []string{"steady"}, Nouns: []string{"Salve", "Balm", "Poultice", "Unguent", "Paste"}, Kinds: []string{"herb", "resin", "fungus", "body_part"}}, {Key: "weapons", Label: "Weapons", For: "weapon", Templates: []string{""}, Nouns: []string{"Blade", "Spear", "Axe", "Maul", "Bow"}, Kinds: []string{"metal", "wood", "bone", "hide"}}, {Key: "gear", Label: "Gear", For: "gear", Templates: []string{""}, Nouns: []string{"Charm", "Kit", "Lantern", "Cloak", "Satchel"}, Kinds: []string{"cloth", "hide", "wood", "gem"}}, }
MakeKinds are what the generator can write. Weapons and gear have no bench steps yet: the only bench Chronicle draws is the apothecary's.
var MigrationsFS embed.FS
MigrationsFS contains the embedded SQL migration files.
var Moments = []string{"success", "progress", "failure", "breakthrough"}
Moments are the times a recipe's look plays on the bench, beside its rules.
var Pictures = []Picture{
{"leaf", "Leaf"}, {"sprig", "Sprig"}, {"flower", "Flower"}, {"root", "Root"}, {"moss", "Moss clump"}, {"mushroom", "Mushroom"},
{"seeds", "Seed pouch"}, {"flask", "Flask"}, {"vial", "Corked vial"}, {"potion", "Round bottle"}, {"jar", "Jar"}, {"drop", "Drop"},
{"fang", "Fang and drop"}, {"amber", "Amber lump"}, {"candle", "Wax candle"}, {"ingot", "Ingot"}, {"ore", "Ore"}, {"coin", "Coins"},
{"gem", "Cut gem"}, {"crystals", "Crystal cluster"}, {"stone", "Stone"}, {"rune", "Rune stone"}, {"powder", "Powder in a dish"},
{"salt", "Salt crystals"}, {"log", "Log"}, {"plank", "Planks"}, {"cloth", "Folded cloth"}, {"spool", "Spool of thread"},
{"hide", "Hide"}, {"scale", "Scales"}, {"shell", "Shell"}, {"feather", "Feather"}, {"bone", "Bone"}, {"skull", "Skull"},
{"claw", "Claw"}, {"horn", "Horn"}, {"heart", "Heart"}, {"eye", "Eye"}, {"tentacle", "Tentacles"}, {"shard", "Shard"}, {"orb", "Orb"}, {"ring", "Ring"},
{"ember", "Ember"}, {"scroll", "Scroll"}, {"ink", "Ink and quill"}, {"bundle", "Wrapped bundle"},
{"berries", "Berries"}, {"thorn", "Thorny vine"}, {"cone", "Pine cone"}, {"nut", "Acorns"}, {"wheat", "Sheaf of wheat"}, {"bark", "Strip of bark"},
{"fruit", "Fruit"}, {"coral", "Coral"}, {"tusk", "Tusk"}, {"antler", "Antler"}, {"wing", "Leathery wing"}, {"paw", "Paw"},
{"stinger", "Stinger"}, {"egg", "Egg"}, {"web", "Spider web"}, {"cocoon", "Silk cocoon"}, {"beak", "Beak"}, {"quills", "Quills"},
{"fin", "Fin"}, {"slime", "Slime"}, {"coal", "Coal"}, {"clay", "Lump of clay"}, {"sand", "Pile of sand"}, {"pearl", "Pearl"},
{"ice", "Ice"}, {"flint", "Flint and steel"}, {"nugget", "Nugget"}, {"geode", "Geode"}, {"meteor", "Meteorite"}, {"rope", "Coil of rope"},
{"chain", "Chain"}, {"cog", "Cogs"}, {"nails", "Nails"}, {"barrel", "Barrel"}, {"bricks", "Bricks"}, {"yarn", "Ball of yarn"},
{"glass", "Glass"}, {"wax", "Cake of wax"}, {"wisp", "Wisp"}, {"star", "Star"}, {"moon", "Crescent moon"}, {"sigil", "Sigil"},
{"bolt", "Lightning bolt"}, {"snowflake", "Snowflake"}, {"cloud", "Cloud"}, {"shadow", "Shadow"},
}
Pictures is every picture a kind or an item may wear, in the picker's order.
var Skins = []Choice{{"desk", "The desk"}, {"journal", "The journal"}}
Skins are the two looks a bench plays in; the campaign picks one for every player.
var StaticAssetsFS embed.FS
StaticAssetsFS holds the app's script, served at /static/plugins/crafting/.
var StepKinds = []StepKind{ {Key: "add", Name: "Add", Blurb: "Put an ingredient in", Item: true, Into: []string{"mortar", "flask"}}, {Key: "grind", Name: "Grind", Blurb: "Circle the pestle", Tool: "mortar", Accepts: []string{"herb", "bone", "body_part", "remnant_part", "fungus", "scale", "gem", "salt", "grain", "flower", "horn", "shell", "coral"}, Option: &StepOption{Key: "turns", Label: "turns", Choices: []int{2, 3, 5}, Min: 1, Max: 8, Default: 3}}, {Key: "tip", Name: "Tip into the flask", Blurb: "Drag the mortar over", Tool: "mortar"}, {Key: "pour", Name: "Pour to the line", Blurb: "Stop at the gold line", Tool: "flask", Graded: true, Item: true, Accepts: []string{"liquid", "magic_essence", "venom", "resin", "oil", "blood"}}, {Key: "simmer", Name: "Keep it steady", Blurb: "Hold the heat in its band", Tool: "burner", Graded: true, Option: &StepOption{Key: "secs", Label: "", Choices: []int{5, 10}, Words: []string{"Short", "Long"}, Min: 2, Max: 20, Default: 5}}, {Key: "strike", Name: "Catch the moment", Blurb: "Press on the gold", Graded: true, Option: &StepOption{Key: "n", Label: "presses", Choices: []int{1, 2, 3}, Min: 1, Max: 6, Default: 2}}, }
StepKinds are the steps the bench engine plays, under the names the editor mockup gives them: simmer is "Keep it steady" and strike is "Catch the moment".
var TagGroups = []Choice{
{"grown", "Grown"}, {"creature", "From creatures"}, {"earth", "From the earth"}, {"made", "Made"}, {"magic", "Magic"},
}
TagGroups name the groups of the editor's kind menu, in its order.
var Tags = []Tag{
{Key: "metal", Label: "Metal", Group: "earth", Picture: "ingot", Tint: "#8d939c"},
{Key: "remnant_part", Label: "Remnant part", Group: "magic", Picture: "shard", Tint: "#6d45c4"},
{Key: "body_part", Label: "Body part", Group: "creature", Picture: "heart", Tint: "#b3263a"},
{Key: "bone", Label: "Bone", Group: "creature", Picture: "bone", Tint: "#e3d6b8"},
{Key: "hide", Label: "Hide", Group: "creature", Picture: "hide", Tint: "#9a6a3e"},
{Key: "liquid", Label: "Liquid", Group: "made", Picture: "flask", Tint: "#8fbbe0"},
{Key: "herb", Label: "Herb", Group: "grown", Picture: "leaf", Tint: "#6a9c3a"},
{Key: "magic_item", Label: "Magic item", Group: "magic", Picture: "ring", Tint: "#7fd6d2"},
{Key: "magic_essence", Label: "Magic essence", Group: "magic", Picture: "drop", Tint: "#a77cf0"},
{Key: "fungus", Label: "Fungus", Group: "grown", Picture: "mushroom", Tint: "#c98a3a"},
{Key: "wood", Label: "Wood", Group: "grown", Picture: "log", Tint: "#9a7048"},
{Key: "resin", Label: "Resin", Group: "grown", Picture: "amber", Tint: "#d99a2b"},
{Key: "scale", Label: "Scale", Group: "creature", Picture: "scale", Tint: "#4f8f6a"},
{Key: "feather", Label: "Feather", Group: "creature", Picture: "feather", Tint: "#d9c9a3"},
{Key: "venom", Label: "Venom", Group: "creature", Picture: "fang", Tint: "#7cc242"},
{Key: "gem", Label: "Gem", Group: "earth", Picture: "gem", Tint: "#4fb3c9"},
{Key: "stone", Label: "Stone", Group: "earth", Picture: "stone", Tint: "#8f8a80"},
{Key: "powder", Label: "Powder", Group: "earth", Picture: "powder", Tint: "#e9e2d0"},
{Key: "cloth", Label: "Cloth", Group: "made", Picture: "cloth", Tint: "#c0504d"},
{Key: "paper", Label: "Paper", Group: "made", Picture: "scroll", Tint: "#b08a5a"},
{Key: "ore", Label: "Ore", Group: "earth", Picture: "ore", Tint: "#8a6f5a"},
{Key: "salt", Label: "Salt", Group: "earth", Picture: "salt", Tint: "#e8e4dc"},
{Key: "oil", Label: "Oil", Group: "made", Picture: "jar", Tint: "#c9a030"},
{Key: "ash", Label: "Ash", Group: "earth", Picture: "coal", Tint: "#6a6a6a"},
{Key: "silk", Label: "Silk", Group: "creature", Picture: "cocoon", Tint: "#f0ead6"},
{Key: "ice", Label: "Ice", Group: "earth", Picture: "ice", Tint: "#a8dcf0"},
{Key: "shadow", Label: "Shadow", Group: "magic", Picture: "shadow", Tint: "#7462b0"},
{Key: "sand", Label: "Sand", Group: "earth", Picture: "sand", Tint: "#d8c090"},
{Key: "glass", Label: "Glass", Group: "made", Picture: "glass", Tint: "#9fd0c9"},
{Key: "wax", Label: "Wax", Group: "made", Picture: "wax", Tint: "#e8c860"},
{Key: "coral", Label: "Coral", Group: "creature", Picture: "coral", Tint: "#e0503c"},
{Key: "starmetal", Label: "Starmetal", Group: "magic", Picture: "meteor", Tint: "#7f8fb0"},
{Key: "fruit", Label: "Fruit", Group: "grown", Picture: "fruit", Tint: "#c0392b"},
{Key: "grain", Label: "Grain", Group: "grown", Picture: "wheat", Tint: "#d8b04a"},
{Key: "flower", Label: "Flower", Group: "grown", Picture: "flower", Tint: "#d870a0"},
{Key: "blood", Label: "Blood", Group: "creature", Picture: "vial", Tint: "#a3262e"},
{Key: "horn", Label: "Horn", Group: "creature", Picture: "horn", Tint: "#d8c8a0"},
{Key: "shell", Label: "Shell", Group: "creature", Picture: "shell", Tint: "#e2c9a6"},
{Key: "clay", Label: "Clay", Group: "earth", Picture: "clay", Tint: "#b0623c"},
{Key: "spirit", Label: "Spirit", Group: "magic", Picture: "wisp", Tint: "#9fe8ff"},
}
Tags are the material kinds a recipe can ask for. An item's first tag in this order picks its picture, so new kinds are appended, never inserted, and a key is never renamed: recipes and drop lists store it.
var Templates = []Template{ {Key: "steady", Name: "Steady brew", Bench: "apothecary", Steps: []TemplateStep{ {T: "add", Want: []string{"herb", "bone", "body_part", "remnant_part"}, To: "mortar"}, {T: "grind", Turns: 3}, {T: "tip"}, {T: "pour", Want: []string{"liquid", "magic_essence"}}, {T: "simmer", Secs: 5}}}, {Key: "volatile", Name: "Volatile brew", Bench: "apothecary", Steps: []TemplateStep{ {T: "add", Want: []string{"herb", "bone", "body_part", "remnant_part"}, To: "mortar"}, {T: "grind", Turns: 2}, {T: "tip"}, {T: "add", Want: []string{"liquid", "magic_essence"}, To: "flask"}, {T: "strike", N: 2}}}, }
Templates are the two apothecary brews: steady ones end on the heat gauge, volatile ones on the timing bar.
var Tools = []Tool{
{"mortar", "mortar"},
{"flask", "flask"},
{"burner", "burner and bellows"},
}
Tools are the tools the apothecary bench draws.
Functions ¶
func AIRuleData ¶
func AIRuleData(r Rule) json.RawMessage
AIRuleData is a stored rule in the form the AI reads and writes, the rules editor's ruleData.
func CleanLooks ¶
func CleanLooks(raw json.RawMessage) map[string]*Look
CleanLooks reads a recipe's moment looks, keeping the moments the bench plays.
func RegisterRoutes ¶
func RegisterRoutes(e *echo.Echo, h *Handler, campaignSvc campaigns.CampaignService, authSvc auth.AuthService, addonSvc addons.AddonService)
RegisterRoutes mounts the routes under the campaign group, behind the crafting addon. Every member reaches every route; the service lets only a Director (the Owner or a co-Director, which a role middleware cannot express) see the editors' data or change them, shows a player only the recipe book, and lets a player start and roll projects only for a character they have claimed. CSRF is enforced by the global middleware.
func TierLabels ¶
TierLabels names a tiered test's three outcomes from the system's two tier tops: "11 or less", "12 to 16", "17 or more".
Types ¶
type AIRecipe ¶
type AIRecipe struct {
// ID is the recipe to change; "" makes a new one.
ID string
Name string
Method string
Materials []Material
Result Result
Goal int
Stat string
Prerequisite string
Source string
Cost Cost
Who string
Known []string
Rules json.RawMessage
// SetEnchant says the AI wrote the recipe's enchanting: Enchant then
// replaces it, nil turning it off. Unset keeps what is stored.
SetEnchant bool
Enchant *Enchant
}
AIRecipe is a recipe as the AI connection writes it, by ids: the connection resolves the AI's names first. Method is a template key that lays the steps over the materials, as the editor's template picker does; "" keeps a stored recipe's steps (each still pointing at the same material) and gives a new one none. Rules, when set, is the whole list of "When… then…" rules, merged by MergeAIRules so a new or changed rule waits as a draft; nil keeps the stored ones. Looks and colours are the Director's, so an AI save keeps them.
type Armory ¶
type Armory interface {
Pack(ctx context.Context, campaignID string, v Viewer, characterID string) (*Pack, error)
// Charge is a cost against the pack, in Pack.Have's units.
Charge(p *Pack, c Cost) int64
// Spend takes the materials and the cost, all or nothing, and says what
// was paid ("25 gp"), "" when no coins changed hands.
// Spend also returns what the remembered copies that went in carried.
Spend(ctx context.Context, campaignID string, v Viewer, characterID string, items []PackItem, c Cost, label string) (string, []Kept, error)
// Give puts the made item in the pack with what it remembers.
Give(ctx context.Context, campaignID string, v Viewer, characterID, itemID string, qty int, label string, k Kept) error
// Use takes items from the pack for something other than a project,
// which why names in the history ("in an experiment"), and returns what
// the remembered copies taken carried.
Use(ctx context.Context, campaignID string, v Viewer, characterID string, items []PackItem, why string) ([]Kept, error)
// GiveFor puts an item in a character's pack on behalf of a hero the
// viewer may act for, with the history line given.
GiveFor(ctx context.Context, campaignID string, v Viewer, actingFor, characterID, itemID string, qty int, why string, k Kept) error
// GiveSpoil puts what a hero took or harvested from the spoils tray in
// their pack.
GiveSpoil(ctx context.Context, campaignID string, v Viewer, characterID, itemID string, qty int, harvested bool, k Kept) error
// GoOff turns every copy whose day has come into what it becomes, and
// says how many.
GoOff(ctx context.Context, campaignID string, v Viewer, day int64) (int, error)
}
Armory is the Armory as crafting needs it: a hero's pack, taking a project's materials and cost, and putting the made item in the pack. Each call checks the viewer may act for the character. Implemented in internal/app over the Armory's stash service.
type ArrangementInput ¶
type ArrangementInput struct {
State json.RawMessage `json:"state"`
Version int `json:"version"`
}
ArrangementInput saves one look's arrangement of a bench.
type Bench ¶
type Bench struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Desk json.RawMessage `json:"desk"`
Journal json.RawMessage `json:"journal"`
Upgrades Upgrades `json:"upgrades"`
SortOrder int `json:"sortOrder"`
Version int `json:"version"`
}
Bench is a named place of one bench kind, with each look's arrangement from build mode (nil until arranged).
type BenchInput ¶
type BenchInput struct {
Name string `json:"name"`
Kind string `json:"kind"`
Version int `json:"version"`
}
BenchInput names a bench and its kind.
type BenchKind ¶
type BenchKind struct {
Key string `json:"key"`
Name string `json:"name"`
Tools []string `json:"tools"`
}
BenchKind is a kind of crafting station: what it is called and the tools it has. A campaign's benches are places of one of these kinds.
type BenchPlay ¶
type BenchPlay struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Desk any `json:"desk"`
Journal any `json:"journal"`
}
BenchPlay is the campaign's bench of one kind as a player plays it: its arrangement for each look, nil when it has never been arranged.
type BookMaterial ¶
BookMaterial is one line of "You need".
type BookPage ¶
type BookPage struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Bench string `json:"bench"`
Needs []BookMaterial `json:"needs"`
Method []string `json:"method"`
Makes string `json:"makes"`
MakesQty int `json:"makesQty"`
Goal int `json:"goal"`
Roll string `json:"roll"`
Graded bool `json:"graded"`
Prerequisite string `json:"prerequisite,omitempty"`
Source string `json:"source,omitempty"`
Cost *Cost `json:"cost,omitempty"`
Lines []string `json:"lines"`
// KnownBy names the viewer's characters who know a "must be learned"
// recipe; empty when everyone knows it.
KnownBy []string `json:"knownBy,omitempty"`
}
BookPage is a recipe as a player reads it in their recipe book: what it needs, the method, the project, and the rules written in the book. Rules shown only when they happen, secret rules and drafts never reach it.
type BreakInput ¶
BreakInput breaks one made item down. Copy names the remembered copy to break, 0 for any.
type BreakResult ¶
type BreakResult struct {
Item string `json:"item"`
Back []string `json:"back"`
Notes []string `json:"notes"`
}
BreakResult is what breaking an item down gave back.
type CalendarSource ¶
type CalendarSource interface {
DefaultCalendarID(ctx context.Context, campaignID string, role int, userID string) string
}
CalendarSource names the campaign's default calendar as the viewer may see it, "" when there is none; the rules editor reads its moons and days.
type CampaignDirectory ¶
type CampaignDirectory interface {
DirectedBy(ctx context.Context, userID string) ([]Named, error)
Directs(ctx context.Context, campaignID, userID string) (bool, error)
}
CampaignDirectory says which campaigns a user directs (Owner or co-Director). Implemented in internal/app over the campaigns plugin.
type Catalog ¶
type Catalog struct {
Items []MaterialItem `json:"items"`
Characters []Named `json:"characters"`
Tables []CatalogTable `json:"tables"`
Skills []string `json:"skills"`
Truncated bool `json:"truncated"`
}
Catalog is what the Director's editors pick from: the campaign's Armory items with their tags, its characters, its Rolling Tables by name and the skills its characters' sheets list. Truncated says a list was cut short, never silently.
type CatalogTable ¶
CatalogTable is one Rolling Table with its rows' words, so the rules editor can show and try what a quirk or mishap table holds.
type CharacterCrafting ¶
type CharacterCrafting struct {
Character Named `json:"character"`
Pack Pack `json:"pack"`
Projects []ProjectView `json:"projects"`
Recipes []CraftRecipe `json:"recipes"`
Benches []BenchPlay `json:"benches"`
// Settings are the campaign's bench settings: the look players start
// in, the timing, whether botched work gives a bane and skipping.
Settings Settings `json:"settings"`
// Edge and Bane are what clean and botched work add to a roll.
Edge int `json:"edge"`
Bane int `json:"bane"`
// CalendarID is the default calendar the bench's window shows, "" when
// there is none or the viewer can't see it; Today is its date, only
// then.
CalendarID string `json:"calendarId,omitempty"`
Today string `json:"today,omitempty"`
// Spoils are the party's spoils tray, as this viewer may see it; nil
// when spoils aren't set up.
Spoils []SpoilView `json:"spoils"`
Director bool `json:"director"`
// Try is "Try something new", nil when there is nothing left this hero
// could find; Party is the party's projects this hero may help with.
Try *TryView `json:"try,omitempty"`
Party []HelpView `json:"party"`
}
CharacterCrafting is the Crafting block on a character's page.
type Colors ¶
type Colors struct {
Base string `json:"base,omitempty"`
Paste string `json:"paste,omitempty"`
Mid string `json:"mid,omitempty"`
Final string `json:"final,omitempty"`
}
Colors are the brew's colours on the bench: the water, the ground paste, halfway, and done. Empty means the bench's own.
type Cond ¶
type Cond struct {
Kind string `json:"kind"`
Moon string `json:"moon,omitempty"`
Phase string `json:"phase,omitempty"`
Event string `json:"event,omitempty"`
Result string `json:"result,omitempty"`
Weather string `json:"weather,omitempty"`
Season string `json:"season,omitempty"`
Time string `json:"time,omitempty"`
Bench string `json:"bench,omitempty"`
Mark string `json:"mark,omitempty"`
Skill string `json:"skill,omitempty"`
}
Cond is one condition of a rule. Only the fields its kind uses are set.
type Cost ¶
Cost is what starting the project costs on top of its materials, in the money the campaign uses. A hero whose sheet keeps Wealth needs it rather than spending it, as at a shop.
type CraftNeed ¶
type CraftNeed struct {
ItemID string `json:"itemId,omitempty"`
Tag string `json:"tag,omitempty"`
Qty int `json:"qty"`
Name string `json:"name"`
// Tags are a named item's crafting tags.
Tags []string `json:"tags,omitempty"`
// Sub is what may stand in for a named item, and what that costs.
Sub *CraftSub `json:"sub,omitempty"`
// Picture is how the bench draws the line: a named item's own picture
// or its first kind's, or the kind's for an "any herb" line.
Picture MaterialPicture `json:"picture"`
}
CraftNeed is one material line of a recipe a hero can start.
type CraftRecipe ¶
type CraftRecipe struct {
ID string `json:"id"`
Name string `json:"name"`
Template string `json:"template"`
Kind string `json:"kind"`
Bench string `json:"bench"`
Needs []CraftNeed `json:"needs"`
Steps []Step `json:"steps"`
Colors Colors `json:"colors"`
Goal int `json:"goal"`
Stat string `json:"stat"`
Roll string `json:"roll"`
// Skip says this hero has mastered the recipe and its mastery lets
// them skip the bench steps, whatever the campaign's setting.
Skip bool `json:"skip,omitempty"`
// StatValue is the hero's characteristic from their sheet; nil when the
// recipe names none or the sheet has no number there.
StatValue *int `json:"statValue,omitempty"`
Cost *Cost `json:"cost,omitempty"`
Makes string `json:"makes"`
MakesQty int `json:"makesQty"`
// MakesID is the item it makes, and Salvage what breaking one down gives
// back ("1 × Spring water"), empty when it can't be broken down.
MakesID string `json:"makesId,omitempty"`
Salvage []string `json:"salvage,omitempty"`
// Charge is the cost against this hero's money, in Pack.Have's units.
Charge int64 `json:"charge"`
Lines []string `json:"lines"`
// Enchant is set on a recipe that enchants one of its materials.
Enchant *Enchant `json:"enchant,omitempty"`
}
CraftRecipe is a recipe a hero knows, with what starting it takes, what a roll adds and what the bench plays. Rules the book doesn't show never reach it.
type CraftSub ¶
type CraftSub struct {
Tag string `json:"tag"`
Name string `json:"name"`
Costs string `json:"costs"`
}
CraftSub lets any item with a tag stand in for a named material; Costs is "bane", "points" (−2 to every roll) or "none".
type Day ¶
type Day struct {
// Abs is today on the calendar's day count; After names the day n days
// on, as that count and in words.
Abs int64
After func(n int) (int64, string)
Time string
Label string
Moons []DayMoon
Events []string
Rolled map[string]string
Weather string
Season string
}
Day is the campaign calendar's today, as a project roll reads it: the moons, the events and rolled results on the day, its weather and season, and the time of day by the calendar's clock ("dawn", "day", "dusk" or "night"; "" when unknown).
type DayMoon ¶
DayMoon is one moon today: a cycling moon's phase (0 new, 0.5 full), or a hand-set moon's state ("" before its first mark).
type Directory ¶
type Directory interface {
// Entity returns one of the campaign's pages, nil when there is no such
// page in this campaign.
Entity(ctx context.Context, campaignID, id string) (*EntityInfo, error)
// ListItems lists the Armory items the role and user may see; the bool
// is true when the list was cut short.
ListItems(ctx context.Context, campaignID string, role int, userID string) ([]Named, bool, error)
// ListCharacters lists the characters the role and user may see.
ListCharacters(ctx context.Context, campaignID string, role int, userID string) ([]Named, bool, error)
// OwnedCharacterIDs lists the characters the user has claimed.
OwnedCharacterIDs(ctx context.Context, campaignID, userID string) (map[string]bool, error)
// Party lists the claimed characters the role and user may see.
Party(ctx context.Context, campaignID string, role int, userID string) ([]Named, error)
}
Directory reads the campaign's pages. Implemented in internal/app over the entities and Armory plugins, so this plugin never reads their tables.
type Discover ¶
type Discover struct {
CloseWhen string `json:"closeWhen"`
Hint string `json:"hint,omitempty"`
LearnedBy string `json:"learnedBy"`
FailedTry string `json:"failedTry"`
}
Discover lets a hero find the recipe by experimenting.
type DropInput ¶
type DropInput struct {
Also string `json:"also"`
Lines []DropLine `json:"lines"`
Version int `json:"version"`
}
DropInput saves a page's drop list; Version 0 makes a new one.
type DropLine ¶
type DropLine struct {
ItemID string `json:"itemId"`
Mode string `json:"mode"`
Qty int `json:"qty,omitempty"`
Stat string `json:"stat,omitempty"`
Yields []int `json:"yields,omitempty"`
Study bool `json:"study,omitempty"`
StudyStat string `json:"studyStat,omitempty"`
Once bool `json:"once,omitempty"`
}
DropLine is one thing a page drops. A taken line gives Qty; a harvest adds Stat ("" for none) to the system's dice and pays Yields[tier]. Study says nobody may take or harvest it until a hero identifies it with a test adding StudyStat ("" for none); Once says the first failed study loses it.
type DropList ¶
DropList is what a page leaves when it is defeated, harvested or found. Also names a page whose list drops first, such as a Remnant's original; it is followed one step only.
type DropView ¶
type DropView struct {
PageID string `json:"pageId"`
Page string `json:"page"`
Kind string `json:"kind"`
Also string `json:"also,omitempty"`
AlsoName string `json:"alsoName,omitempty"`
Lines []DropLine `json:"lines"`
Version int `json:"version"`
}
DropView is a drop list as the Spoils tab shows it.
type Effect ¶
type Effect struct {
Kind string `json:"kind"`
Amount int `json:"amount,omitempty"`
Item string `json:"item,omitempty"`
Mark string `json:"mark,omitempty"`
Table string `json:"table,omitempty"`
Recipe string `json:"recipe,omitempty"`
Text string `json:"text,omitempty"`
}
Effect is what a rule does when it is on.
type Enchant ¶
Enchant makes a recipe enchant an item the hero already owns instead of making a new one: one of material Line goes in and comes back as the same item, with what it remembered, plus the enchantment Name. An item holds at most Slots enchantments, so a recipe can't stack them without end.
type EntityInfo ¶
EntityInfo is what the service needs to know about a page another plugin owns: its name, and whether it is an Armory item or a character.
type Extras ¶
type Extras struct {
Botch Botch `json:"botch"`
Mishaps *Mishaps `json:"mishaps"`
Quality *Quality `json:"quality"`
Substitutes []Substitute `json:"substitutes"`
Breakthrough bool `json:"breakthrough"`
Mastery *Mastery `json:"mastery"`
Discover *Discover `json:"discover"`
Keeps *Keeps `json:"keeps"`
MakersMark bool `json:"makersMark"`
Salvage []Salvage `json:"salvage"`
OthersCanHelp bool `json:"othersCanHelp"`
Enchant *Enchant `json:"enchant"`
}
Extras are a recipe's "If it goes wrong" and "Extras" settings. A nil pointer is a setting turned off.
func CleanExtras ¶
func CleanExtras(raw json.RawMessage, materials int) Extras
CleanExtras reads a recipe's extras as the AI or the editor wrote them. materials is how many materials the recipe has, which bounds a substitute's For.
func DefaultExtras ¶
func DefaultExtras() Extras
DefaultExtras is a recipe with nothing turned on: botched work costs only its bane.
func FollowMaterials ¶
FollowMaterials keeps a recipe's substitutes, and the line it enchants, on the material they were written for when the materials list changes. A substitute names its material by index, so without this an edit that removes or reorders materials leaves it standing in for a different line. A substitute whose material is gone is dropped.
type Fight ¶
type Fight struct {
Name string
Creatures []FightCreature
}
Fight is a fight that ended, as crafting hears it: each creature row, with how many of its copies were down.
type FightCreature ¶
FightCreature is one creature row of a fight. PageID is "" for a row with no page.
type FightSpoils ¶
FightSpoils is what a fight left, a line per creature, for the Director.
type GenerateInput ¶
type GenerateInput struct {
Make string `json:"make"`
Kinds []string `json:"kinds"`
Count int `json:"count"`
Echelon int `json:"echelon"`
Table string `json:"table"`
Seed string `json:"seed"`
Rerolls []int `json:"rerolls"`
}
GenerateInput is what to make. Rerolls holds how many times each row was rolled again, so one row changes and the rest stay.
type GenerateResult ¶
type GenerateResult struct {
Seed string `json:"seed"`
Rows []GeneratedRecipe `json:"rows"`
// Makes lists what can be made, for the inputs.
Makes []MakeKind `json:"makes"`
}
GenerateResult is the list with the seed that made it.
type GeneratedMaterial ¶
GeneratedMaterial is one line of a generated recipe, with its name.
type GeneratedRecipe ¶
type GeneratedRecipe struct {
Name string `json:"name"`
Template string `json:"template"`
Materials []GeneratedMaterial `json:"materials"`
Steps []Step `json:"steps"`
// Goal is 0 when neither the system nor the Director's recipes give one.
Goal int `json:"goal"`
// GoalFrom is "system", "recipes" or "" (set it yourself).
GoalFrom string `json:"goalFrom"`
// ResultID is an Armory item already named like the recipe, "" when
// keeping it makes a new one.
ResultID string `json:"resultId,omitempty"`
// Missing are the kinds the row asks "any" of because the campaign has
// no item of that kind yet.
Missing []string `json:"missing"`
// Taken says a recipe of this name already exists.
Taken bool `json:"taken,omitempty"`
}
GeneratedRecipe is one row. Nothing is saved until the Director keeps it.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves the crafting routes.
func NewHandler ¶
func NewHandler(svc Service, cal CalendarSource) *Handler
NewHandler builds the handler; cal may be nil.
func (*Handler) BreakDown ¶
BreakDown handles POST /campaigns/:id/crafting/characters/:eid/break-down.
func (*Handler) CancelProject ¶
CancelProject handles DELETE /campaigns/:id/crafting/projects/:pid.
func (*Handler) Character ¶
Character handles GET /campaigns/:id/crafting/characters/:eid: the Crafting block on a character's page.
func (*Handler) ClearSpoil ¶
ClearSpoil handles DELETE /campaigns/:id/crafting/spoils/:sid.
func (*Handler) ClearSpoilLine ¶
ClearSpoilLine handles DELETE /campaigns/:id/crafting/spoil-lines/:lid.
func (*Handler) CreateBench ¶
CreateBench handles POST /campaigns/:id/crafting/benches.
func (*Handler) CreateMaterial ¶
CreateMaterial handles POST /campaigns/:id/crafting/materials.
func (*Handler) CreateRecipe ¶
CreateRecipe handles POST /campaigns/:id/crafting/recipes.
func (*Handler) DeleteBench ¶
DeleteBench handles DELETE /campaigns/:id/crafting/benches/:bid.
func (*Handler) DeleteDrops ¶
DeleteDrops handles DELETE /campaigns/:id/crafting/drops/:eid.
func (*Handler) DeletePack ¶
DeletePack handles DELETE /campaigns/:id/crafting/packs/:pid.
func (*Handler) DeleteRecipe ¶
DeleteRecipe handles DELETE /campaigns/:id/crafting/recipes/:rid.
func (*Handler) Experiment ¶
Experiment handles POST /campaigns/:id/crafting/characters/:eid/experiment.
func (*Handler) ImportPack ¶
ImportPack handles POST /campaigns/:id/crafting/packs/:pid/import.
func (*Handler) ItemCrafting ¶
ItemCrafting handles GET /campaigns/:id/crafting/items/:eid.
func (*Handler) ListBenches ¶
ListBenches handles GET /campaigns/:id/crafting/benches.
func (*Handler) ListRecipes ¶
ListRecipes handles GET /campaigns/:id/crafting/recipes.
func (*Handler) LogRespite ¶
LogRespite handles POST /campaigns/:id/crafting/respites.
func (*Handler) PackDetail ¶
PackDetail handles GET /campaigns/:id/crafting/packs/:pid.
func (*Handler) PackFile ¶
PackFile handles GET /campaigns/:id/crafting/packs/:pid/file: the pack as a download.
func (*Handler) Page ¶
Page renders GET /campaigns/:id/crafting: the Director's editors, or a player's recipe book. The script reads everything else from the API.
func (*Handler) PlaceItemBlock ¶
PlaceItemBlock handles POST /campaigns/:id/crafting/item-block.
func (*Handler) Projects ¶
Projects handles GET /campaigns/:id/crafting/projects: the Director's tab.
func (*Handler) RevealSpoil ¶
RevealSpoil handles POST /campaigns/:id/crafting/spoil-lines/:lid/reveal: the Director naming a find's item to the party.
func (*Handler) RollProject ¶
RollProject handles POST /campaigns/:id/crafting/projects/:pid/roll.
func (*Handler) SaveArrangement ¶
SaveArrangement handles PUT /campaigns/:id/crafting/benches/:bid/look/:skin.
func (*Handler) SaveSettings ¶
SaveSettings handles PUT /campaigns/:id/crafting/settings.
func (*Handler) SaveUpgrades ¶
SaveUpgrades handles PUT /campaigns/:id/crafting/benches/:bid/upgrades.
func (*Handler) SetItemPicture ¶
SetItemPicture handles PUT /campaigns/:id/crafting/materials/:eid/picture; a null picture makes the item follow its kind again.
func (*Handler) SetKindPictures ¶
SetKindPictures handles PUT /campaigns/:id/crafting/pictures.
func (*Handler) StartProject ¶
StartProject handles POST /campaigns/:id/crafting/characters/:eid/projects.
func (*Handler) StudySpoil ¶
StudySpoil handles POST /campaigns/:id/crafting/spoil-lines/:lid/study: a hero's study of a find that needs one.
func (*Handler) TakeSpoil ¶
TakeSpoil handles POST /campaigns/:id/crafting/spoil-lines/:lid/take: taking or harvesting one line for a hero.
func (*Handler) UpdateBench ¶
UpdateBench handles PUT /campaigns/:id/crafting/benches/:bid.
func (*Handler) UpdatePack ¶
UpdatePack handles PUT /campaigns/:id/crafting/packs/:pid.
func (*Handler) UpdateRecipe ¶
UpdateRecipe handles PUT /campaigns/:id/crafting/recipes/:rid.
type HelpInput ¶
HelpInput is a hand on a party member's project: the hero helping, and the project's version the block last read.
type HelpView ¶
type HelpView struct {
Project ProjectView `json:"project"`
Helped bool `json:"helped"`
}
HelpView is a party member's project this hero may help with; Helped says they already did this respite.
type ImportInput ¶
type ImportInput struct {
Matches map[string]string `json:"matches"`
Recipes []string `json:"recipes"`
}
ImportInput brings a pack in. Matches maps a material's name to an item id of this campaign, or "" to make it new; a material left out matches an item of the same name, else is made new. Recipes names the ones to bring in; none means all.
type ImportResult ¶
type ImportResult struct {
Made []Named `json:"made"`
Items []Named `json:"items"`
Skipped []PackSkipped `json:"skipped"`
}
ImportResult says what bringing a pack in did.
type Ingredients ¶
type Ingredients struct {
Marks []string `json:"marks,omitempty"`
Fine int `json:"fine,omitempty"`
Poor int `json:"poor,omitempty"`
}
Ingredients is what the remembered copies that went into a project carried: their marks, and how many were fine or poor.
type ItemCrafting ¶
type ItemCrafting struct {
ItemID string `json:"itemId"`
Name string `json:"name"`
Director bool `json:"director"`
// Kinds are the item's crafting tags; Director only.
Kinds []string `json:"kinds"`
// MadeBy are the recipes that make the item, as the editor reads them;
// Director only.
MadeBy []Recipe `json:"madeBy"`
// Uses are the recipes that ask for the item by name or by one of its
// kinds.
Uses []ItemUse `json:"uses"`
// Drops are the drop lists that give the item; Director only.
Drops []ItemDrop `json:"drops"`
DropsCut bool `json:"dropsCut,omitempty"`
// Book are the pages a player reads for the recipes that make it.
Book []BookPage `json:"book"`
}
ItemCrafting is what an Armory item's page shows about crafting: the recipes that make it ("How it's made") and, for a material, its kinds, the recipes that ask for it and the drop lists that give it ("In crafting"). A Director gets everything, drafts included. A player gets only the book pages they could already read in their recipe book, and never the item's kinds or its drop lists.
type ItemDrop ¶
type ItemDrop struct {
PageID string `json:"pageId"`
Page string `json:"page"`
Mode string `json:"mode"`
Qty int `json:"qty,omitempty"`
}
ItemDrop is one drop list line that gives an item.
type ItemLook ¶
type ItemLook struct {
Shape string `json:"shape"`
Body string `json:"body"`
Trim string `json:"trim"`
Detail string `json:"detail"`
Mark *LookMark `json:"mark,omitempty"`
}
ItemLook is a made copy's picture, drawn by static/js/widgets/craft_results.js.
type ItemMaker ¶
type ItemMaker interface {
CreateItem(ctx context.Context, campaignID, userID, name string) (id string, err error)
}
ItemMaker makes a new Armory item. Implemented in internal/app over the entities plugin. The item is the Director's only until they share it or a hero takes one, so a made-up material never shows players a page early.
type ItemUse ¶
type ItemUse struct {
ID string `json:"id"`
Name string `json:"name"`
Qty int `json:"qty"`
// ByKind is the kind the recipe asks for when it doesn't name the item.
ByKind string `json:"byKind,omitempty"`
Draft bool `json:"draft,omitempty"`
}
ItemUse is one recipe that asks for an item.
type Kept ¶
type Kept struct {
ID int64 `json:"id,omitempty"`
Qty int `json:"qty,omitempty"`
Marks []string `json:"marks,omitempty"`
// Enchants are the enchantments the copy carries.
Enchants []string `json:"enchants,omitempty"`
Quality string `json:"quality,omitempty"`
Quirk string `json:"quirk,omitempty"`
How string `json:"how,omitempty"`
By string `json:"by,omitempty"`
On string `json:"on,omitempty"`
OffDay int64 `json:"offDay,omitempty"`
OffOn string `json:"offOn,omitempty"`
Becomes string `json:"-"`
// BecomesName names Becomes for the block.
BecomesName string `json:"becomes,omitempty"`
// Off marks a copy that has gone off.
Off bool `json:"off,omitempty"`
// Look is a made copy's picture (result_look.go).
Look *ItemLook `json:"look,omitempty"`
}
Kept is what some copies of an item remember, as the Armory keeps them: marks, fine or poor, a quirk, who made or harvested them and when, and when they go off (OffDay on the calendar's day count) and what into.
type KindPicturesInput ¶
type KindPicturesInput struct {
Kinds map[string]*MaterialPicture `json:"kinds"`
}
KindPicturesInput changes several kinds' pictures at once, so swapping two kinds is one save. A kind mapped to null goes back to its default.
type LayoutPlacer ¶
type LayoutPlacer interface {
PlaceItemBlock(ctx context.Context, campaignID string) (int, error)
// ItemBlockPlaced says whether every item page type already places it.
ItemBlockPlaced(ctx context.Context, campaignID string) (bool, error)
}
LayoutPlacer puts the "How it's made" block on the campaign's item pages, after their entry, where a layout doesn't already place it. It answers how many page types it changed.
type Level ¶
type Level struct {
Name string `json:"name"`
Changes string `json:"changes,omitempty"`
Rule *Rule `json:"rule,omitempty"`
How string `json:"how"`
Note string `json:"note,omitempty"`
}
Level is one rung of a piece's ladder.
type Library ¶
type Library struct {
// Tags carry each kind's picture as this campaign has it.
Tags []Tag `json:"tags"`
TagGroups []Choice `json:"tagGroups"`
Pictures []Picture `json:"pictures"`
Tools []Tool `json:"tools"`
Steps []StepKind `json:"steps"`
BenchKinds []BenchKind `json:"benchKinds"`
Templates []Template `json:"templates"`
Skins []Choice `json:"skins"`
Difficulties []Choice `json:"difficulties"`
Moments []string `json:"moments"`
Rules systems.CraftingRules `json:"rules"`
// System names the game system the rules come from, "" when none is
// enabled and the defaults apply.
System string `json:"system"`
Settings Settings `json:"settings"`
Director bool `json:"director"`
// Makes are what the recipe generator can write.
Makes []MakeKind `json:"makes"`
// Owner says the viewer owns the campaign, which the AI connection's
// copy and paste needs; set by the handler.
Owner bool `json:"owner"`
}
Library is the fixed lists and the campaign's settings and system rules, read by both the editors and the recipe book.
type MakeKind ¶
type MakeKind struct {
Key string `json:"key"`
Label string `json:"label"`
// For matches a published goal's "for" ("consumable", "weapon").
For string `json:"for"`
// Templates are the methods its recipes use; "" means no bench steps,
// so heroes make the project roll alone.
Templates []string `json:"-"`
Nouns []string `json:"-"`
// Kinds are the material kinds it draws from when the Director picks
// none.
Kinds []string `json:"kinds"`
}
MakeKind is a kind of thing the generator writes recipes for.
type Material ¶
type Material struct {
ItemID string `json:"itemId,omitempty"`
Tag string `json:"tag,omitempty"`
Qty int `json:"qty"`
}
Material is one thing a recipe asks for: a named Armory item, or any item carrying a tag ("any herb"), so players can use what they carry.
type MaterialInput ¶
MaterialInput makes a new Armory item with crafting kinds, for a generated recipe or a pack that needs a material the campaign lacks.
type MaterialItem ¶
type MaterialItem struct {
ID string `json:"id"`
Name string `json:"name"`
Tags []string `json:"tags"`
// Picture is the item's own picture; nil when it follows its first kind.
Picture *MaterialPicture `json:"picture,omitempty"`
}
MaterialItem is an Armory item with its crafting tags, for the Materials tab and the recipe editor's pickers.
type MaterialPicture ¶
MaterialPicture is a picture from the library (Pictures) and its tint, a #rrggbb colour. A kind wears one by default; an item may wear its own.
type Named ¶
Named is a page picked by id and shown by name: a character a recipe is known by, an item.
type Pack ¶
type Pack struct {
Name string `json:"name"`
Items []PackItem `json:"items"`
PayKind string `json:"payKind"`
Have int64 `json:"have"`
MoneyLabel string `json:"moneyLabel"`
// MoneyKey is the sheet's money field, which decides how a cost in
// another coin converts; the Armory's own business, never sent.
MoneyKey string `json:"-"`
}
Pack is what a hero carries and how they pay, as the viewer may see it. PayKind is "" (no money field), "wealth", "purse" or "coins"; Have is in hundredths (a purse in copper).
type PackChange ¶
type PackChange struct {
Name string `json:"name"`
}
PackChange renames a pack or shares it.
type PackDetail ¶
type PackDetail struct {
PackView
Recipes []PackRecipe `json:"recipes"`
Materials []PackMaterial `json:"materials"`
// Matches maps a material's name to the id of this campaign's item of
// the same name.
Matches map[string]string `json:"matches"`
}
PackDetail is one pack opened to bring in: its recipes and materials, and for each material the campaign's item of the same name, if any.
type PackItem ¶
type PackItem struct {
ItemID string `json:"itemId"`
Name string `json:"name"`
Qty int `json:"qty"`
Tags []string `json:"tags"`
// Picture is what the item wears: its own, or its first kind's.
Picture MaterialPicture `json:"picture"`
// Kept are the copies that remember something, oldest first; the rest
// of Qty is plain.
Kept []Kept `json:"kept,omitempty"`
// Use asks for remembered copies to go into a project first.
Use []KeptPick `json:"-"`
}
PackItem is one thing a hero carries.
type PackLine ¶
type PackLine struct {
Material string `json:"material,omitempty"`
Kind string `json:"kind,omitempty"`
Qty int `json:"qty"`
}
PackLine is one material line: a pack material by name, or any item of a kind.
type PackMaterial ¶
PackMaterial is an item a pack's recipes ask for or make, by name.
type PackRecipe ¶
type PackRecipe struct {
Name string `json:"name"`
Template string `json:"template,omitempty"`
Bench string `json:"bench,omitempty"`
Lines []PackLine `json:"lines"`
Steps []Step `json:"steps"`
Makes string `json:"makes,omitempty"`
MakesQty int `json:"makesQty,omitempty"`
Goal int `json:"goal"`
Stat string `json:"stat,omitempty"`
Prerequisite string `json:"prerequisite,omitempty"`
Source string `json:"source,omitempty"`
Cost Cost `json:"cost"`
Who string `json:"who,omitempty"`
Colors Colors `json:"colors"`
}
PackRecipe is one recipe in a pack. Makes names a pack material.
type PackRow ¶
type PackRow struct {
ID string
CampaignID string
CreatedBy string
Name string
Source string
RecipeCount int
Body string
UpdatedAt time.Time
}
PackRow is a stored recipe pack. Body is the pack's JSON.
type PackSkipped ¶
PackSkipped is a recipe left out, with why.
type PackStore ¶
type PackStore interface {
CreatePack(ctx context.Context, p PackRow) error
GetPack(ctx context.Context, id string) (PackRow, bool, error)
// ListPacks lists the packs of the given campaigns, and every shared
// pack when shared is set, newest first, without their bodies.
ListPacks(ctx context.Context, campaignIDs []string, shared bool, limit int) ([]PackRow, error)
// UpdatePack renames a pack or shares it; ok is false when the pack is
// not in the campaign.
UpdatePack(ctx context.Context, campaignID, id, name string, shared bool) (ok bool, err error)
DeletePack(ctx context.Context, campaignID, id string) error
}
PackStore keeps recipe packs.
func NewPackStore ¶
NewPackStore creates a MariaDB-backed pack store.
type PackView ¶
type PackView struct {
ID string `json:"id"`
Name string `json:"name"`
From string `json:"from"`
Campaign string `json:"campaign,omitempty"`
File bool `json:"file,omitempty"`
Count int `json:"count"`
Updated time.Time `json:"updated"`
}
PackView is a pack as the Workshop lists it. From is "here" (this campaign), "campaign" (another the viewer directs) or "server" (shared by a Director on this server).
type Pages ¶
type Pages interface {
// Page returns nil when there is no such page in this campaign.
Page(ctx context.Context, campaignID, id string) (*PageInfo, error)
CanSee(ctx context.Context, campaignID, id string, role int, userID string) (bool, error)
}
Pages reads the campaign's pages of every kind for drop lists, and whether a viewer may see one. Implemented in internal/app over the entities plugin.
type Picture ¶
Picture is one drawing in the material picture library, named for what it shows, never for a material. The drawings live in static/js/widgets/craft_pictures.js under the same keys.
type Piece ¶
type Piece struct {
Name string `json:"name"`
Have int `json:"have"`
Levels []Level `json:"levels"`
}
Piece is one part of a bench with its ladder; Have is the level the party has reached, counted from 0.
type Project ¶
type Project struct {
ID string
CampaignID string
CharacterID string
RecipeID string
RecipeName string
Goal int
Stat string
ResultItemID string
ResultQty int
Points int
RollsReady int
Status string
Delivered bool
Took string
StartedBy string
StartedAt time.Time
FinishedAt *time.Time
Version int
Details ProjectDetails
}
Project is a hero's crafting project as stored. RecipeName, Goal, Stat and the result are what the recipe said when it started.
type ProjectDeps ¶
type ProjectDeps struct {
Store ProjectStore
Armory Armory
Spoils SpoilStore
Pages Pages
Sheets Sheets
Tables Tables
Days Days
// Calendar names the default calendar as the viewer sees it, which
// decides whether today's date may reach the block.
Calendar CalendarSource
Respite RespiteHook
// Rolls, when set, adds each project roll to the campaign's roll log.
Rolls RollLog
// Items makes Armory items for a recipe's result or a pack's missing
// material; Layouts places the item block; Campaigns and Packs share
// recipe packs between campaigns. Each is nil until wired, and what
// needs it answers that it is not set up.
Items ItemMaker
Layouts LayoutPlacer
Campaigns CampaignDirectory
Packs PackStore
Roll func(n int) int
Now func() time.Time
}
ProjectDeps are what projects and spoils need beyond recipes: where they are kept, the Armory, the campaign's pages, the hero's sheet, the calendar, who hears of a respite and the roll log. Store and Armory are required for projects, Spoils, Armory and Pages for spoils; Sheets, Days, Respite and Rolls may be nil (no characteristic is added, no calendar rule is on, no Homebrew rule runs, no roll reaches the log). Roll and Now are for tests.
type ProjectDetails ¶
type ProjectDetails struct {
Made []string `json:"made,omitempty"`
Subs []string `json:"subs,omitempty"`
// Used is what the ingredients that went in remembered; nil for a
// project started before copies remembered anything, whose ingredient
// rules stay unknown.
Used *Ingredients `json:"used,omitempty"`
// Item is what the made item will remember (fine, marks, a quirk).
Item *Kept `json:"item,omitempty"`
// Base is the copy an enchanting project took, as it was, and BaseItem
// its item, so a cancelled project gives it back unchanged.
Base *Kept `json:"base,omitempty"`
BaseItem string `json:"baseItem,omitempty"`
}
ProjectDetails is what a project keeps beyond its numbers: what its item came out as (fine, marked, a quirk, made as something else), and the standing cost of each substitute it started with ("bane" or "points").
type ProjectRoll ¶
type ProjectRoll struct {
Hero string
Recipe string
Sides int
Dice []int
Total int
From, To int
Goal int
Finished bool
}
ProjectRoll is one project roll as the campaign's roll log shows it: the dice, the total and the progress, never the terms, whose words can carry a Director's secret rule.
type ProjectStore ¶
type ProjectStore interface {
CreateProject(ctx context.Context, p Project) error
GetProject(ctx context.Context, campaignID, id string) (Project, bool, error)
// ListProjects lists projects in one status, for one character or (with
// characterID "") the whole campaign: in progress oldest first,
// finished ones newest first. limit 0 means no limit.
ListProjects(ctx context.Context, campaignID, characterID, status string, limit int) ([]Project, error)
CountActive(ctx context.Context, campaignID, characterID string) (int, error)
// UpdateProject writes the points, rolls ready, status, delivered flag
// and finish time if the stored version is still expected; ok is false
// on a lost race.
UpdateProject(ctx context.Context, p Project, expected int) (ok bool, err error)
// AddRoll records a roll as made, with how the steps went.
AddRoll(ctx context.Context, campaignID, projectID, rolledBy, work, dice, terms string, total, from, to int) error
// CleanRolls counts a hero's rolls of one recipe made with clean work,
// which a recipe's mastery counts.
CleanRolls(ctx context.Context, campaignID, characterID, recipeID string) (int, error)
// LogRespite gives every project in progress one more roll and records
// the respite, in one transaction, and says how many projects it
// reached.
LogRespite(ctx context.Context, campaignID, loggedBy, dayLabel string) (int, error)
LastRespite(ctx context.Context, campaignID string) (*Respite, error)
TurnStore
}
ProjectStore keeps projects, respites and rolls. Every statement filters on campaign_id, as the recipe repository's do.
type ProjectView ¶
type ProjectView struct {
ID string `json:"id"`
CharacterID string `json:"characterId"`
Hero string `json:"hero"`
RecipeID string `json:"recipeId,omitempty"`
Name string `json:"name"`
Kind string `json:"kind"`
Roll string `json:"roll"`
Goal int `json:"goal"`
Points int `json:"points"`
RollsReady int `json:"rollsReady"`
Status string `json:"status"`
// Waits says why a ready roll can't be made today (a recipe's rule),
// "" when it can.
Waits string `json:"waits,omitempty"`
// Makes names what it makes: "1 × Healing potion".
Makes string `json:"makes"`
// Undelivered is set on a finished project whose item could not be put
// in the hero's pack, so the Director can give it by hand.
Undelivered bool `json:"undelivered,omitempty"`
// Came names what the item came out as: "Fine", a mark, a quirk.
Came []string `json:"came,omitempty"`
Took string `json:"took,omitempty"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
Version int `json:"version"`
}
ProjectView is a project as the block and the Projects tab show it.
type ProjectsPage ¶
type ProjectsPage struct {
Active []ProjectView `json:"active"`
Finished []ProjectView `json:"finished"`
// LastRespite is when the last respite was logged and the calendar's
// date then; nil before the first.
LastRespite *Respite `json:"lastRespite,omitempty"`
Today string `json:"today,omitempty"`
}
ProjectsPage is the Director's Projects tab.
type PutInput ¶
type PutInput struct {
PageID string `json:"pageId"`
Copies int `json:"copies"`
Origin string `json:"origin"`
}
PutInput puts a page's drop list in the tray by hand, Copies times.
type PutResult ¶
type PutResult struct {
Spoils int `json:"spoils"`
}
PutResult says how many spoils went in the tray.
type Recipe ¶
type Recipe struct {
ID string `json:"id"`
Name string `json:"name"`
Template string `json:"template"`
Bench string `json:"bench"`
Materials []Material `json:"materials"`
Steps []Step `json:"steps"`
Result Result `json:"result"`
Goal int `json:"goal"`
Stat string `json:"stat"`
Prerequisite string `json:"prerequisite"`
Source string `json:"source"`
Cost Cost `json:"cost"`
Who string `json:"who"`
Known []string `json:"known"`
Colors Colors `json:"colors"`
Rules []Rule `json:"rules"`
Looks map[string]*Look `json:"looks"`
Extras Extras `json:"extras"`
Draft bool `json:"draft"`
DraftPrompt string `json:"draftPrompt,omitempty"`
SortOrder int `json:"sortOrder"`
Version int `json:"version"`
UpdatedAt time.Time `json:"updatedAt"`
}
Recipe is a recipe as its Director edits it.
type RecipeInput ¶
type RecipeInput struct {
Name string `json:"name"`
Template string `json:"template"`
Bench string `json:"bench"`
Materials []Material `json:"materials"`
Steps []Step `json:"steps"`
Result Result `json:"result"`
Goal int `json:"goal"`
Stat string `json:"stat"`
Prerequisite string `json:"prerequisite"`
Source string `json:"source"`
Cost Cost `json:"cost"`
Who string `json:"who"`
Known []string `json:"known"`
Colors Colors `json:"colors"`
Version int `json:"version"`
// Draft makes a new recipe a draft players never see until a Director
// approves it. It is read only on create; approving is its own call.
Draft bool `json:"draft,omitempty"`
}
RecipeInput is what the editor sends to create or change a recipe. Rules and looks are saved on their own (RulesInput), so the recipe form and the rules editor never overwrite each other. Version is the one the editor last read; zero on create.
func LayTemplate ¶
func LayTemplate(in RecipeInput, key string, tags map[string][]string) (RecipeInput, bool)
LayTemplate lays a template's steps over a recipe, as the editor's applyTemplate does: each step that wants a material takes the first one whose tags fit, or adds an "any" line for it. tags are each item's crafting tags. ok is false for a template the library doesn't have.
type Repository ¶
type Repository interface {
GetSettings(ctx context.Context, campaignID string) (Settings, error)
SaveSettings(ctx context.Context, campaignID string, s Settings) error
ListRecipes(ctx context.Context, campaignID string) ([]Recipe, error)
GetRecipe(ctx context.Context, campaignID, id string) (Recipe, bool, error)
// CreateRecipe stores r with its known list; errDuplicate when the name
// is taken.
CreateRecipe(ctx context.Context, campaignID, createdBy string, r Recipe) error
// UpdateRecipe writes everything but the rules and looks if the stored
// version is still expected, and replaces the known list; ok is false on
// a lost race. errDuplicate when the new name is taken.
UpdateRecipe(ctx context.Context, campaignID, userID string, r Recipe, expected int) (ok bool, err error)
// UpdateRules writes the rules, looks and extras on the same terms.
UpdateRules(ctx context.Context, campaignID, id string, rules []Rule, looks map[string]*Look, extras Extras, expected int) (ok bool, err error)
// SetDraft clears or sets the draft flag, bumping the version.
SetDraft(ctx context.Context, campaignID, id string, draft bool) error
DeleteRecipe(ctx context.Context, campaignID, id string) error
// KnownBy lists the recipes each of the characters knows.
KnownBy(ctx context.Context, campaignID string, characterIDs []string) (map[string][]string, error)
// Learn adds a character to those who know a recipe; knowing it
// already is not an error.
Learn(ctx context.Context, campaignID, recipeID, characterID, userID string) error
// ListTags returns each tagged item's tags, in no particular order.
ListTags(ctx context.Context, campaignID string) (map[string][]string, error)
// SetTags replaces one item's tags.
SetTags(ctx context.Context, campaignID, itemID string, tags []string) error
// ListKindPictures returns the campaign's own picture for each kind it
// changed; a kind with no row wears the library's default.
ListKindPictures(ctx context.Context, campaignID string) (map[string]MaterialPicture, error)
// SetKindPictures writes several kinds at once, so a swap is one change;
// a nil entry puts that kind back on its default.
SetKindPictures(ctx context.Context, campaignID string, set map[string]*MaterialPicture) error
// ListItemPictures returns each item that wears its own picture.
ListItemPictures(ctx context.Context, campaignID string) (map[string]MaterialPicture, error)
// SetItemPicture gives one item its own picture; nil makes it follow its
// first kind again.
SetItemPicture(ctx context.Context, campaignID, itemID string, p *MaterialPicture) error
ListBenches(ctx context.Context, campaignID string) ([]Bench, error)
GetBench(ctx context.Context, campaignID, id string) (Bench, bool, error)
// CreateBench returns errDuplicate when the name is taken.
CreateBench(ctx context.Context, campaignID string, b Bench) error
// UpdateBench renames a bench or changes its kind; ok false on a lost
// race, errDuplicate on a name clash.
UpdateBench(ctx context.Context, campaignID string, b Bench, expected int) (ok bool, err error)
// SaveArrangement stores one look's arrangement ("desk" or "journal").
SaveArrangement(ctx context.Context, campaignID, id, skin string, state json.RawMessage, expected int) (ok bool, err error)
DeleteBench(ctx context.Context, campaignID, id string) error
// SaveUpgrades stores a bench's upgrade ladders; ok false on a lost
// version race.
SaveUpgrades(ctx context.Context, campaignID, id string, u Upgrades, expected int) (ok bool, err error)
}
Repository is the persistence boundary for crafting.
func NewRepository ¶
func NewRepository(db *sql.DB) Repository
NewRepository creates a MariaDB-backed repository.
type Respite ¶
type Respite struct {
DayLabel string `json:"dayLabel,omitempty"`
Projects int `json:"projects"`
At time.Time `json:"at"`
}
Respite is one logged respite.
type RespiteHook ¶
type RespiteHook interface {
RespiteLogged(ctx context.Context, campaignID string, v Viewer) error
}
RespiteHook tells the rest of Chronicle a respite was logged from the Crafting app, so Homebrew rules set off by a respite run as they would from the drawer.
type RespiteResult ¶
type RespiteResult struct {
Projects int `json:"projects"`
// Warnings name the parts of the respite that didn't happen (rules that
// didn't run, brews that didn't go off), so the page doesn't report
// success over them. The respite itself is logged either way.
Warnings []string `json:"warnings,omitempty"`
}
RespiteResult says how many projects a respite gave a roll.
type RollInput ¶
type RollInput struct {
Work string `json:"work"`
Bench string `json:"bench"`
Version int `json:"version"`
}
RollInput makes a project's roll. Work is how the steps went (WorkClean and so on); Bench is the bench it was worked at, "" for none.
type RollLog ¶
type RollLog interface {
ProjectRolled(ctx context.Context, campaignID string, v Viewer, r ProjectRoll)
}
RollLog hears each project roll so it joins the campaign's roll log.
type RollResult ¶
type RollResult struct {
Project ProjectView `json:"project"`
Dice []int `json:"dice"`
Sides int `json:"sides"`
Terms []Term `json:"terms"`
Total int `json:"total"`
From int `json:"from"`
To int `json:"to"`
Finished bool `json:"finished"`
// Spoiled says a recipe's chance of "can't be made" came up: the roll
// was used and added nothing.
Spoiled bool `json:"spoiled,omitempty"`
// Made names what reached the pack, "" when nothing did; Item is what
// it remembers (fine, a mark, a quirk, who made it, when it goes off).
Made string `json:"made,omitempty"`
Item *Kept `json:"item,omitempty"`
// Mishap is what struck mid-brew, nil when nothing did; Row is its row
// of the table (from 0), which picks its look on the bench.
Mishap *Mishap `json:"mishap,omitempty"`
// Breakthrough says the dice came up high enough to roll again.
Breakthrough bool `json:"breakthrough,omitempty"`
// Lost says botched work cost the ingredients: the project is over.
Lost bool `json:"lost,omitempty"`
Notes []string `json:"notes"`
// Moment is which of the recipe's moments this roll was (rollMoment),
// and Look how the Director dressed it in How it looks, nil when they
// didn't. Only the moment that happened is sent, so a player never sees
// the looks, or the words, of mishaps that didn't strike.
Moment string `json:"moment,omitempty"`
Look *Look `json:"look,omitempty"`
}
RollResult is a roll as made: the dice as they fell, each term, and what it did to the project.
type Rule ¶
type Rule struct {
When []Cond `json:"when"`
Then Effect `json:"then"`
Chance string `json:"chance,omitempty"`
Players string `json:"players"`
BookLine string `json:"bookLine,omitempty"`
Look *Look `json:"look,omitempty"`
Draft bool `json:"draft,omitempty"`
}
Rule is one rule in the form the AI reads and writes (ruleData): players is "book", "whenItHappens" or "secret", and a secret rule has no look.
func CleanRules ¶
func CleanRules(raw json.RawMessage) []Rule
CleanRules reads a list of rules as the AI or the editor wrote them and returns the stored form; anything it cannot read is left out.
type RulesChange ¶
RulesChange is what an AI's list of rules does to a recipe's: the list to store, and how many rules it keeps as they were, adds as drafts and drops.
func MergeAIRules ¶
func MergeAIRules(stored []Rule, raw json.RawMessage) (RulesChange, error)
MergeAIRules reads the whole list of "When… then…" rules an AI wrote for a recipe whose stored rules are stored. A rule written exactly as a stored one keeps it, approval and look included, so sending the list back with one rule changed leaves the others alone. Every other rule arrives as a draft, which counts for nothing until a Director approves it in the rules editor. Unlike the editor's forgiving CleanRules, a rule Chronicle can't read, or one with a value the editor would clamp, drop or replace, is refused with its place in the list, so an AI never has a rule dropped or changed without a word.
type RulesInput ¶
type RulesInput struct {
Rules json.RawMessage `json:"rules"`
Looks json.RawMessage `json:"looks"`
Extras json.RawMessage `json:"extras,omitempty"`
Version int `json:"version"`
}
RulesInput saves a recipe's rules, moment looks and extras. Extras left out keep what the recipe has.
type RulesSource ¶
type RulesSource interface {
CraftingRules(ctx context.Context, campaignID string) (systems.CraftingRules, string)
}
RulesSource gives the crafting rules of the campaign's enabled system, with the system's name ("" and the defaults when none is enabled).
type SavePackInput ¶
SavePackInput saves recipes as a pack.
type Service ¶
type Service interface {
Library(ctx context.Context, campaignID string, v Viewer) (*Library, error)
Catalog(ctx context.Context, campaignID string, v Viewer) (*Catalog, error)
SaveSettings(ctx context.Context, campaignID string, v Viewer, s Settings) (*Settings, error)
ListRecipes(ctx context.Context, campaignID string, v Viewer) ([]Recipe, error)
GetRecipe(ctx context.Context, campaignID, id string, v Viewer) (*Recipe, error)
CreateRecipe(ctx context.Context, campaignID string, v Viewer, in RecipeInput) (*Recipe, error)
UpdateRecipe(ctx context.Context, campaignID, id string, v Viewer, in RecipeInput) (*Recipe, error)
SaveRules(ctx context.Context, campaignID, id string, v Viewer, in RulesInput) (*Recipe, error)
Approve(ctx context.Context, campaignID, id string, v Viewer) (*Recipe, error)
DeleteRecipe(ctx context.Context, campaignID, id string, v Viewer) error
Book(ctx context.Context, campaignID string, v Viewer) ([]BookPage, error)
SetTags(ctx context.Context, campaignID, itemID string, v Viewer, tags []string) ([]string, error)
ListBenches(ctx context.Context, campaignID string, v Viewer) ([]Bench, error)
GetBench(ctx context.Context, campaignID, id string, v Viewer) (*Bench, error)
CreateBench(ctx context.Context, campaignID string, v Viewer, in BenchInput) (*Bench, error)
UpdateBench(ctx context.Context, campaignID, id string, v Viewer, in BenchInput) (*Bench, error)
SaveArrangement(ctx context.Context, campaignID, id, skin string, v Viewer, in ArrangementInput) (*Bench, error)
SaveUpgrades(ctx context.Context, campaignID, id string, v Viewer, in UpgradesInput) (*Bench, error)
DeleteBench(ctx context.Context, campaignID, id string, v Viewer) error
// CanCraftFor says whether the viewer may see a character's Crafting
// block: a Director, or the character's player.
CanCraftFor(ctx context.Context, campaignID, characterID string, v Viewer) (bool, error)
Character(ctx context.Context, campaignID, characterID string, v Viewer) (*CharacterCrafting, error)
StartProject(ctx context.Context, campaignID, characterID string, v Viewer, in StartInput) (*ProjectView, error)
RollProject(ctx context.Context, campaignID, id string, v Viewer, in RollInput) (*RollResult, error)
Experiment(ctx context.Context, campaignID, characterID string, v Viewer, in TryInput) (*TryResult, error)
BreakDown(ctx context.Context, campaignID, characterID string, v Viewer, in BreakInput) (*BreakResult, error)
Help(ctx context.Context, campaignID, projectID string, v Viewer, in HelpInput) (*RollResult, error)
CancelProject(ctx context.Context, campaignID, id string, v Viewer) error
Projects(ctx context.Context, campaignID string, v Viewer) (*ProjectsPage, error)
LogRespite(ctx context.Context, campaignID string, v Viewer) (*RespiteResult, error)
RespitePressed(ctx context.Context, campaignID string, v Viewer) error
GiveRoll(ctx context.Context, campaignID, id string, v Viewer) (*ProjectView, error)
SetPoints(ctx context.Context, campaignID, id string, v Viewer, in SetPointsInput) (*ProjectView, error)
Spoils(ctx context.Context, campaignID string, v Viewer) (*SpoilsPage, error)
SaveDrops(ctx context.Context, campaignID, pageID string, v Viewer, in DropInput) (*DropView, error)
DeleteDrops(ctx context.Context, campaignID, pageID string, v Viewer) error
PutSpoils(ctx context.Context, campaignID string, v Viewer, in PutInput) (*PutResult, error)
ClearTray(ctx context.Context, campaignID string, v Viewer) error
ClearSpoil(ctx context.Context, campaignID, id string, v Viewer) error
ClearSpoilLine(ctx context.Context, campaignID string, id int64, v Viewer) error
TakeSpoil(ctx context.Context, campaignID string, lineID int64, v Viewer, in TakeInput) (*TakeResult, error)
// StudySpoil rolls a hero's study of a find that needs one;
// RevealSpoil names its item to the party without a roll.
StudySpoil(ctx context.Context, campaignID string, lineID int64, v Viewer, in TakeInput) (*StudyResult, error)
RevealSpoil(ctx context.Context, campaignID string, lineID int64, v Viewer) error
// FightEnded puts what a fight's defeated creatures drop in the tray.
FightEnded(ctx context.Context, campaignID string, v Viewer, f Fight) (*FightSpoils, error)
// DropNotes says which of a fight's pages have a drop list.
DropNotes(ctx context.Context, campaignID string, v Viewer, pageIDs []string) (map[string]string, error)
// SaveAIRecipe and CheckDrops are the AI connection's: a recipe written
// by an AI (a new one arrives as a draft), and a drop list's checks run
// at review without saving.
SaveAIRecipe(ctx context.Context, campaignID string, v Viewer, in AIRecipe, check bool) (*Recipe, error)
CheckDrops(ctx context.Context, campaignID, pageID string, v Viewer, in DropInput) error
// SetKindPictures changes what kinds wear and returns every kind as it
// now stands; SetItemPicture gives one item its own picture, or nil to
// follow its kind.
SetKindPictures(ctx context.Context, campaignID string, v Viewer, in KindPicturesInput) ([]Tag, error)
SetItemPicture(ctx context.Context, campaignID, itemID string, v Viewer, in *MaterialPicture) (*MaterialPicture, error)
// ItemCrafting is what an Armory item's page shows: how it is made and
// where it is used, as the viewer may read it.
ItemCrafting(ctx context.Context, campaignID, itemID string, v Viewer) (*ItemCrafting, error)
// CreateMaterial makes a Director-only Armory item with crafting kinds.
CreateMaterial(ctx context.Context, campaignID string, v Viewer, in MaterialInput) (*MaterialItem, error)
// ItemBlock and PlaceItemBlock say whether item pages show "How it's
// made" and put it there when the Director asks.
ItemBlock(ctx context.Context, campaignID string, v Viewer) (bool, error)
PlaceItemBlock(ctx context.Context, campaignID string, v Viewer) (int, error)
// TeachParty and KnownRecipes are the Homebrew Workshop's: a rule
// teaching a recipe to the party, and a part's recipe list checked.
TeachParty(ctx context.Context, campaignID string, v Viewer, name string) (string, error)
KnownRecipes(ctx context.Context, campaignID string, v Viewer, ids []string) ([]string, error)
// Generate writes recipes from the campaign's materials without saving.
Generate(ctx context.Context, campaignID string, v Viewer, in GenerateInput) (*GenerateResult, error)
// Recipe packs: saved sets of recipes other campaigns bring in.
ListPacks(ctx context.Context, campaignID string, v Viewer) ([]PackView, error)
PackDetail(ctx context.Context, campaignID, id string, v Viewer) (*PackDetail, error)
SavePack(ctx context.Context, campaignID string, v Viewer, in SavePackInput) (*PackView, error)
UploadPack(ctx context.Context, campaignID string, v Viewer, raw []byte) (*PackView, error)
UpdatePack(ctx context.Context, campaignID, id string, v Viewer, in PackChange) (*PackView, error)
DeletePack(ctx context.Context, campaignID, id string, v Viewer) error
PackFile(ctx context.Context, campaignID, id string, v Viewer) ([]byte, string, error)
ImportPack(ctx context.Context, campaignID, id string, v Viewer, in ImportInput) (*ImportResult, error)
}
Service is crafting's business logic. Every method takes the viewer and decides what they may see or change, so a route cannot widen access.
func NewService ¶
func NewService(repo Repository, dir Directory, rules RulesSource, projects ProjectDeps) Service
NewService builds the service. rules may be nil, which means every campaign uses the default crafting rules. projects may be empty, and the project routes then answer that projects are not set up.
type SetPointsInput ¶
SetPointsInput sets a project's points, below its goal.
type Settings ¶
type Settings struct {
// Skin is the look a player's bench opens in ("desk" or "journal")
// until they switch at the bench; a narrow screen opens the journal.
Skin string `json:"skin"`
// Difficulty is how tight the bench's timing is.
Difficulty string `json:"difficulty"`
// Bane is whether botched work gives a bane.
Bane bool `json:"bane"`
// Skip is whether players may skip the steps and just roll.
Skip bool `json:"skip"`
}
Settings are a campaign's crafting defaults.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings are what a campaign has before its Director changes any.
type Sheets ¶
type Sheets interface {
Stat(ctx context.Context, campaignID, characterID, key string) (value int, ok bool, err error)
Skills(ctx context.Context, campaignID, characterID string) (skills []string, ok bool, err error)
}
Sheets reads a hero's sheet: a characteristic (ok is false when the field holds no number), and the skills it lists (ok is false when it lists none, so a rule about a skill stays unknown rather than off).
type Spoil ¶
type Spoil struct {
ID string
CampaignID string
PageID string
PageName string
Copy int
Copies int
Origin string
CreatedBy string
CreatedAt time.Time
Lines []SpoilLine
}
Spoil is one thing that dropped, with its lines as the drop list read then. Copy and Copies number the copies of one creature that dropped together ("Troll, 1 of 2"); Origin is the fight's name, "" when the Director put it in by hand.
type SpoilLine ¶
type SpoilLine struct {
ID int64
SpoilID string
ItemID string
ItemName string
Mode string
Qty int
Stat string
Yields [3]int
Study bool
StudyStat string
Once bool
Status string
CharacterID string
TakenBy string
TakenQty int
Rolled *int
TakenAt *time.Time
}
SpoilLine is one line of a spoil. ItemName is the item's name when it dropped, for the Director's history; what a player is shown comes from what they may see now.
type SpoilLineView ¶
type SpoilLineView struct {
ID int64 `json:"id"`
ItemID string `json:"itemId,omitempty"`
Name string `json:"name"`
Unseen bool `json:"unseen,omitempty"`
Tags []string `json:"tags"`
// Kinds names the tags in words: "bone, hide".
Kinds string `json:"kinds,omitempty"`
Mode string `json:"mode"`
Qty int `json:"qty,omitempty"`
Roll string `json:"roll,omitempty"`
Tiers []Tier `json:"tiers,omitempty"`
// Locked says it waits for a study. A player reads "Something
// unidentified", with no id, name or kinds; the Director reads it all.
Locked bool `json:"locked,omitempty"`
Study *StudyView `json:"study,omitempty"`
// Identified names who identified the item by study ("Tobin"), or says
// the Director revealed it; UsedIn names the party's recipes that use
// it, when a study showed them.
Identified string `json:"identified,omitempty"`
UsedIn []string `json:"usedIn,omitempty"`
}
SpoilLineView is a waiting line as the viewer may see it. An item a player can't see has no id or kinds and reads as unseen until taken.
type SpoilStore ¶
type SpoilStore interface {
GetDrops(ctx context.Context, campaignID, pageID string) (DropList, bool, error)
// ListDrops lists drop lists, newest change first, up to limit.
ListDrops(ctx context.Context, campaignID string, limit int) ([]DropList, error)
// DropsFor returns the drop lists the given pages have, by page.
DropsFor(ctx context.Context, campaignID string, pageIDs []string) (map[string]DropList, error)
// SaveDrops writes a page's drop list: expected 0 makes a new one, any
// other value replaces the stored list at that version. ok is false on
// a lost race or when a new list's page already has one.
SaveDrops(ctx context.Context, campaignID string, d DropList, by string, expected int) (ok bool, err error)
DeleteDrops(ctx context.Context, campaignID, pageID string) error
// AddSpoils stores spoils and their lines in one transaction.
AddSpoils(ctx context.Context, campaignID string, spoils []Spoil) error
CountWaiting(ctx context.Context, campaignID string) (int, error)
// ListTray lists the spoils with waiting lines, oldest first, each
// holding only its waiting lines.
ListTray(ctx context.Context, campaignID string) ([]Spoil, error)
GetLine(ctx context.Context, campaignID string, id int64) (SpoilLine, bool, error)
// ClaimLine marks a waiting line taken for a hero; ok is false when the
// line was no longer waiting.
ClaimLine(ctx context.Context, campaignID string, id int64, characterID, by string, qty int, rolled *int, at time.Time) (ok bool, err error)
// ReleaseLine puts a claimed line back in the tray, after its item
// failed to reach the pack.
ReleaseLine(ctx context.Context, campaignID string, id int64) error
// ClearLine, ClearSpoil and ClearTray clear waiting lines and say how
// many.
ClearLine(ctx context.Context, campaignID string, id int64) (int, error)
ClearSpoil(ctx context.Context, campaignID, spoilID string) (int, error)
ClearTray(ctx context.Context, campaignID string) (int, error)
// ListTaken lists lines taken lately, newest first.
ListTaken(ctx context.Context, campaignID string, limit int) ([]SpoilLine, error)
// KnownItems returns which of the given items the party has identified.
KnownItems(ctx context.Context, campaignID string, itemIDs []string) (map[string]KnownItem, error)
// MarkKnown records an identified item; an item already known keeps who
// identified it and gains Recipes if this study showed them.
MarkKnown(ctx context.Context, campaignID string, k KnownItem) error
// StartStudy writes a study's row before its roll, unless the hero
// already studied that item since the last respite; ok is false then.
StartStudy(ctx context.Context, campaignID string, st Study) (id int64, ok bool, err error)
// FinishStudy records a study's outcome and roll.
FinishStudy(ctx context.Context, campaignID string, id int64, outcome string, rolled int) error
// LogStudy writes a finished row, such as a reveal.
LogStudy(ctx context.Context, campaignID string, st Study) error
// TriesSinceRespite lists the heroes' studies of the given items since
// the last respite, oldest first.
TriesSinceRespite(ctx context.Context, campaignID string, itemIDs []string) ([]Study, error)
// RecentStudies lists studies and reveals, newest first.
RecentStudies(ctx context.Context, campaignID string, limit int) ([]Study, error)
// LoseLine marks a waiting line lost on its one chance; ok is false
// when the line was no longer waiting.
LoseLine(ctx context.Context, campaignID string, id int64, characterID, by string, rolled int, at time.Time) (ok bool, err error)
}
SpoilStore keeps drop lists and the spoils tray. Every statement filters on campaign_id.
type SpoilView ¶
type SpoilView struct {
ID string `json:"id"`
Source string `json:"source"`
Copy int `json:"copy"`
Copies int `json:"copies"`
Origin string `json:"origin,omitempty"`
// ByHand says the Director put it in, not a fight.
ByHand bool `json:"byHand,omitempty"`
At time.Time `json:"at"`
Lines []SpoilLineView `json:"lines"`
}
SpoilView is a spoil in the tray. Source is the page's name, or "Something the party found" for a player who can't see the page; that player isn't told the fight's name either, or that it was put in by hand.
type SpoilsPage ¶
type SpoilsPage struct {
Tray []SpoilView `json:"tray"`
Taken []TakenView `json:"taken"`
Drops []DropView `json:"drops"`
Heroes []Named `json:"heroes"`
Items []MaterialItem `json:"items"`
Stats []systems.CraftingStat `json:"stats"`
Tiers []string `json:"tiers"`
Dice string `json:"dice"`
// Truncated says a list of items or heroes was cut short.
Truncated bool `json:"truncated,omitempty"`
}
SpoilsPage is the Director's Spoils tab: the tray, what was taken lately, every drop list, and what the editor and the tray's buttons pick from.
type StartInput ¶
type StartInput struct {
RecipeID string `json:"recipeId"`
Picks map[int]string `json:"picks"`
// Use names, per material line, remembered copies to put in first.
Use map[int][]KeptPick `json:"use"`
}
StartInput starts a project. Picks fills each "any <tag>" material, by its index in the recipe's materials, with an item the hero carries.
type Step ¶
type Step struct {
T string `json:"t"`
Material *int `json:"material,omitempty"`
To string `json:"to,omitempty"`
Turns int `json:"turns,omitempty"`
Secs int `json:"secs,omitempty"`
N int `json:"n,omitempty"`
}
Step is one step of a recipe, in the bench engine's terms. Material is an index into the recipe's materials, nil until one is picked.
func KeepStepMaterials ¶
KeepStepMaterials points each step at the same material in a recipe's new list of materials: the same item, or the same "any" tag. A step whose material is gone loses it, and the editor asks for one.
type StepKind ¶
type StepKind struct {
Key string `json:"key"`
Name string `json:"name"`
Blurb string `json:"blurb"`
Tool string `json:"tool,omitempty"`
Graded bool `json:"graded"`
Item bool `json:"item"`
Accepts []string `json:"accepts,omitempty"`
Into []string `json:"into,omitempty"`
Option *StepOption `json:"option,omitempty"`
}
StepKind is one kind of step. Item steps use one of the recipe's materials; Accepts limits which tags that material may carry.
type StepOption ¶
type StepOption struct {
Key string `json:"key"`
Label string `json:"label"`
Choices []int `json:"choices"`
Words []string `json:"words,omitempty"`
Min int `json:"min"`
Max int `json:"max"`
Default int `json:"default"`
}
StepOption is a step's one setting, offered as a short list in the editor and clamped to [Min, Max] on save, which is what the engine accepts.
type Study ¶
type Study struct {
ID int64
ItemID string
LineID int64
CharacterID string
Outcome string
Rolled *int
CreatedBy string
At time.Time
}
Study is one study or reveal of an item.
type StudyResult ¶
type StudyResult struct {
Hero string `json:"hero"`
Dice []int `json:"dice"`
Sides int `json:"sides"`
Terms []Term `json:"terms"`
Total int `json:"total"`
Tier int `json:"tier"`
Tiers []string `json:"tiers"`
Known bool `json:"known"`
Lost bool `json:"lost,omitempty"`
Item string `json:"item,omitempty"`
Kinds string `json:"kinds,omitempty"`
Mode string `json:"mode"`
UsedIn []string `json:"usedIn,omitempty"`
Notes []string `json:"notes"`
}
StudyResult is a study as rolled. Item, Kinds and UsedIn are filled only when it landed; Lost says a one chance find is gone.
type StudyView ¶
type StudyView struct {
Roll string `json:"roll"`
Tiers []string `json:"tiers"`
// Says is what each outcome does, lowest first.
Says []string `json:"says"`
Once bool `json:"once,omitempty"`
// Tried lists the misses since the last respite: "Mira rolled 8".
Tried []string `json:"tried,omitempty"`
// Wait says why the hero in view can't study it now, "" when they can.
Wait string `json:"wait,omitempty"`
}
StudyView is a locked line's study: the test, what each outcome does, and who has tried since the last respite.
type Substitute ¶
Substitute lets any item with a tag stand in for one of the recipe's materials (For is its index), at a cost.
type Tables ¶
type Tables interface {
// All lists the campaign's tables with their rows' words, for the rules
// editor.
All(ctx context.Context, campaignID string) ([]CatalogTable, error)
// Rows returns a table's rows by its name; ok is false when the campaign
// has no table by that name.
Rows(ctx context.Context, campaignID, name string) (rows []TableRow, ok bool, err error)
}
Tables reads the campaign's Rolling Tables, which a recipe's quirks and mishaps are rolled on. Implemented in internal/app over the rolltables service.
type Tag ¶
type Tag struct {
Key string `json:"key"`
Label string `json:"label"`
Group string `json:"group"`
Picture string `json:"picture"`
Tint string `json:"tint"`
// DefaultPicture and DefaultTint are what the kind ships with, so the
// editor can offer to put a changed kind back.
DefaultPicture string `json:"defaultPicture,omitempty"`
DefaultTint string `json:"defaultTint,omitempty"`
}
Tag is a crafting tag on an Armory item: what kind of material it is. Picture and Tint are the kind's picture: the default here, the campaign's own choice once Library fills it in. Group places it in the editor's menu.
type TakeInput ¶
type TakeInput struct {
CharacterID string `json:"characterId"`
}
TakeInput takes or harvests a line for a hero.
type TakeResult ¶
type TakeResult struct {
Hero string `json:"hero"`
// Item is the item's name, which the taker may see now it is theirs.
Item string `json:"item"`
Got string `json:"got"`
Qty int `json:"qty"`
Dice []int `json:"dice,omitempty"`
Sides int `json:"sides,omitempty"`
Terms []Term `json:"terms,omitempty"`
Total int `json:"total,omitempty"`
Tier int `json:"tier"`
Tiers []Tier `json:"tiers,omitempty"`
Notes []string `json:"notes"`
}
TakeResult is a line taken or harvested: what reached the hero's pack and, for a harvest, the test as rolled.
type Template ¶
type Template struct {
Key string `json:"key"`
Name string `json:"name"`
Bench string `json:"bench"`
Steps []TemplateStep `json:"steps"`
}
Template fills in a recipe's steps and bench in one pick.
type TemplateStep ¶
type TemplateStep struct {
T string `json:"t"`
Want []string `json:"want,omitempty"`
To string `json:"to,omitempty"`
Turns int `json:"turns,omitempty"`
Secs int `json:"secs,omitempty"`
N int `json:"n,omitempty"`
}
TemplateStep is one step a template lays down; Want names the tags the material it uses should carry, so the template can pick or add one.
type TryInput ¶
type TryInput struct {
Items []TryPick `json:"items"`
}
TryInput is what a hero puts into a try.
type TryResult ¶
type TryResult struct {
Outcome string `json:"outcome"`
Recipe string `json:"recipe,omitempty"`
RecipeID string `json:"recipeId,omitempty"`
Hint string `json:"hint,omitempty"`
// Learned names who learned a found recipe; Party says the recipe
// teaches the whole party.
Learned []string `json:"learned,omitempty"`
Party bool `json:"party,omitempty"`
// Cost is what the try cost (TryUsed, TryHalf, TryKept); Used is what
// left the pack and Back what stayed in it, as "2 × Bloodmoss".
Cost string `json:"cost"`
Used []string `json:"used"`
Back []string `json:"back"`
}
TryResult is what a try came to. A near miss carries only the recipe's hint, never its name or id; Recipe and RecipeID are set only on a find.
type TryView ¶
type TryView struct {
Ready bool `json:"ready"`
}
TryView is the block's "Try something new": shown when the campaign has a recipe this hero could still find; Ready says the turn is unspent.
type TurnStore ¶
type TurnStore interface {
// TakeTurn spends the turn; ok is false when it was already spent.
TakeTurn(ctx context.Context, campaignID, characterID, kind, projectID string, respiteID int64) (ok bool, err error)
// ReturnTurn gives back a turn whose work then failed.
ReturnTurn(ctx context.Context, campaignID, characterID, kind, projectID string, respiteID int64) error
// TurnsTaken lists the turns the character spent since the respite, as
// kind and project ("try:", "help:<project id>").
TurnsTaken(ctx context.Context, campaignID, characterID string, respiteID int64) (map[string]bool, error)
// RespiteID is the campaign's latest respite, 0 before the first.
RespiteID(ctx context.Context, campaignID string) (int64, error)
}
TurnStore keeps the turns heroes spend. A turn is keyed on the campaign's latest respite, so a new respite gives every turn back.
type Upgrades ¶
type Upgrades struct {
Pieces []Piece `json:"pieces"`
}
Upgrades are a bench's pieces.
func CleanUpgrades ¶
func CleanUpgrades(raw json.RawMessage) Upgrades
CleanUpgrades reads a bench's upgrades as the editor or the AI wrote them. Like the rules it forgives: a piece without a name or levels is left out, an unknown way of coming by a level is "given", and the level reached is kept on the ladder.
type UpgradesInput ¶
type UpgradesInput struct {
Upgrades json.RawMessage `json:"upgrades"`
Version int `json:"version"`
}
UpgradesInput saves a bench's upgrade ladders.
type Viewer ¶
type Viewer struct {
UserID string
MemberRole int
VisibilityRole int
// Director is the Owner or a co-Director: who may see and change every
// recipe, bench and tag.
Director bool
}
Viewer is who is asking, as the service needs it.
type Worked ¶
type Worked struct {
Bench string
Skills map[string]bool
// Marks are the marks the ingredients that went in carried, lowercased;
// nil when the project can't say.
Marks map[string]bool
}
Worked is what a roll knows of how it was worked: the bench's name ("" for none) and the maker's skills, lowercased (nil when the sheet lists none). A nil *Worked is a project listed before it is worked.
Source Files
¶
- ai.go
- ai_rules.go
- book.go
- dice.go
- embed.go
- errors.go
- extras.go
- generate.go
- handler.go
- handler_making.go
- handler_projects.go
- handler_spoils.go
- item.go
- library.go
- making.go
- model.go
- opening.go
- packs.go
- pictures.go
- projects.go
- repository.go
- repository_packs.go
- repository_projects.go
- repository_spoils.go
- result_look.go
- roll_extras.go
- routes.go
- rules.go
- service.go
- service_projects.go
- service_spoils.go
- service_study.go
- service_turns.go
- spoils.go
- turns.go
- upgrades.go
- validate.go
- verdict.go