Caravans: crewed wagons, town stock by vote, roads, ambushes; war table shows all scouted threats and march impact

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-04 17:57:20 +00:00
parent a4c9977e5c
commit 3486897630
6 changed files with 724 additions and 24 deletions

14
app.py
View file

@ -366,6 +366,18 @@ class Handler(BaseHTTPRequestHandler):
return game.travel(world, player, str(body.get("to")), pouch if isinstance(pouch, dict) else {}, now)
if path == "/api/council/propose":
return game.propose_march(world, player, str(body.get("from")), str(body.get("to")), body.get("guards"), now)
if path == "/api/council/freight":
return game.propose_freight(world, player, str(body.get("to")), body.get("item"), body.get("qty"), now)
if path in ("/api/caravan/form", "/api/caravan/board"):
goods = body.get("goods") if isinstance(body.get("goods"), dict) else {}
freight = body.get("freight") if isinstance(body.get("freight"), list) else []
if path == "/api/caravan/form":
return game.form_caravan(world, player, str(body.get("to")), goods, freight, now)
return game.board_caravan(world, player, body.get("id"), goods, freight, now)
if path == "/api/caravan/depart":
return game.depart_caravan(world, player, body.get("id"), now)
if path == "/api/caravan/cancel":
return game.cancel_caravan(world, player, body.get("id"))
if path == "/api/council/vote":
return game.vote_march(world, player, body.get("id"), bool(body.get("yes")), now)
if path == "/api/charter":
@ -658,7 +670,7 @@ class Handler(BaseHTTPRequestHandler):
"happenings": game.happenings_view(world, now),
"history": history,
"orders": world["orders"],
"kingdom": game.kingdom_view(world, now),
"kingdom": game.kingdom_view(world, now, uid),
"city_speed": game.speed(world),
"threat_report": unseen and {"id": unseen["id"], "kind": unseen["kind"], "at": unseen["resolved"],
"report": unseen["report"]},