Add durable recipe discovery and profession crafting

This commit is contained in:
dingo
2026-09-09 13:28:07 -04:00
parent 940a345613
commit b65f3e8562
42 changed files with 2183 additions and 136 deletions
+8
View File
@@ -139,6 +139,9 @@ func (l *Lease) Save(ctx context.Context, w *game.World, claimID string) error {
return l.SaveCommand(ctx, w, claimID, nil, "")
}
func (l *Lease) SaveCommand(ctx context.Context, w *game.World, claimID string, command *Command, outcome string) error {
return l.save(ctx, w, claimID, command, outcome, nil)
}
func (l *Lease) save(ctx context.Context, w *game.World, claimID string, command *Command, outcome string, receipt *craftReceipt) error {
live := w
w = stageTitleWorld(w)
data, err := json.Marshal(w)
@@ -159,6 +162,11 @@ func (l *Lease) SaveCommand(ctx context.Context, w *game.World, claimID string,
if n != 1 {
return ErrOwnership
}
if receipt != nil {
if _, err = tx.ExecContext(ctx, d.q(`INSERT INTO craft_receipts(id,account_id,character_id,request_json,result_json) VALUES(?,?,?,?,?)`), receipt.ID, receipt.Account, receipt.CharacterID, receipt.Request, receipt.Result); err != nil {
return err
}
}
if claimID != "" {
c := w.Characters[claimID]
if c == nil {