Add durable recipe discovery and profession crafting
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user