Work orders: crafting orders claimed by one crafter, open materials requests, escrow, refunds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-20 18:01:02 +01:00
parent 89fd9b3c40
commit d03f0035eb
7 changed files with 538 additions and 8 deletions

12
app.py
View file

@ -323,6 +323,17 @@ class Handler(BaseHTTPRequestHandler):
return "Bad quantity"
if path == "/api/action":
return game.start_action(world, player, str(body.get("id")), now, once=bool(body.get("once")))
if path == "/api/order":
return game.post_order(world, player, body.get("kind"), str(item), qty, body.get("provide"),
body.get("reward"), now)
if path == "/api/order/cancel":
return game.cancel_order(world, player, body.get("id"), now)
if path == "/api/order/work":
return game.work_order(world, player, body.get("id"), now)
if path == "/api/order/drop":
return game.claim_order(world, player, body.get("id"), claim=False)
if path == "/api/order/deliver":
return game.deliver_order(world, player, body.get("id"), now)
if path == "/api/seen":
event_id = body.get("id")
if not isinstance(event_id, int):
@ -502,6 +513,7 @@ class Handler(BaseHTTPRequestHandler):
"favours": game.favours(world, now),
"happenings": game.happenings_view(world, now),
"history": history,
"orders": world["orders"],
"threat_report": unseen and {"id": unseen["id"], "kind": unseen["kind"], "at": unseen["resolved"],
"report": unseen["report"]},
"players": roster(world, now),