Raids: alarm at the gates, battle replay and report popup for everyone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-20 13:12:12 +01:00
parent fcaabf5ae2
commit a35bcd6512
5 changed files with 146 additions and 7 deletions

9
app.py
View file

@ -315,6 +315,12 @@ 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/seen":
event_id = body.get("id")
if not isinstance(event_id, int):
return "Bad event"
player["seen_threat"] = max(player.get("seen_threat", 0), event_id)
return None
if path == "/api/stop":
game.stop(player)
return None
@ -472,6 +478,7 @@ class Handler(BaseHTTPRequestHandler):
now = self.store.now()
player = world["players"].get(uid)
upcoming = game.upcoming_event(world)
unseen = game.unseen_threat(world, player) if player else None
history = [
{"id": e["id"], "kind": e["kind"], "track": e.get("track", "major"), "at": e["resolved"], "report": e.get("report")}
for e in reversed(world["events"]) if e["status"] == "done"
@ -485,6 +492,8 @@ class Handler(BaseHTTPRequestHandler):
"favours": game.favours(world, now),
"happenings": game.happenings_view(world, now),
"history": history,
"threat_report": unseen and {"id": unseen["id"], "kind": unseen["kind"], "at": unseen["resolved"],
"report": unseen["report"]},
"players": roster(world, now),
"ledger": world["ledger"][-80:],
"board": world["board"][-80:],