Gold: guard wages, raid retune, strongbox, caravan wares, looks, monuments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-24 13:34:59 +01:00
parent 9d61de2012
commit cd44709d80
6 changed files with 816 additions and 31 deletions

22
app.py
View file

@ -120,6 +120,10 @@ def player_view(world: dict, player: dict, now: float) -> dict:
"role": me["role"], "abilities": me["abilities"], "style": me["style"]}
view["health_potion"] = game.health_potion(player)
view["perk_costs"] = {perk: game.perk_cost(player, perk) for perk in player["perks"]}
view["rent_cost"] = game.rent_cost(player)
view["caravan"] = game.caravan_view(world, player, now)
view["titles"] = game.titles(player)
view["shown"] = game.look_view(player)
if player["action"]:
action, fight = game.growing(player), game.current_fight(world, player)
duration = fight["duration"] if fight else game.action_time(world, player, action)
@ -182,6 +186,7 @@ def city_view(world: dict, now: float) -> dict:
"defence": game.defence(world),
"day": game.calendar_day(world, now) + 1,
"fires": game.fires_view(world, now),
"monuments": game.monuments_view(world),
}
@ -208,6 +213,7 @@ def roster(world: dict, now: float) -> list[dict]:
"fight": player["action"]["id"] if game.joinable(world, player) and game.offline_limit(world, player) > now else None,
"party": (player["action"] or {}).get("party"),
"garrison": player["garrison"], "donated": player["donated"],
"look": game.look_view(player),
})
return sorted(people, key=lambda p: -p["donated"])
@ -423,6 +429,22 @@ class Handler(BaseHTTPRequestHandler):
return game.aid_problem(world, player, str(body.get("kind")), str(body.get("item")), str(body.get("source")), now)
if path == "/api/hire":
return game.hire_mercenaries(world, player, now)
if path == "/api/wages":
return game.pay_wages(world, player, qty if qty == "all" or isinstance(qty, int) else -1, str(body.get("source")), now)
if path == "/api/rent":
return game.rent_slot(player)
if path == "/api/buy":
skill = body.get("skill")
return game.buy_ware(world, player, str(body.get("ware")), str(skill) if skill else None, now)
if path == "/api/look":
look = body.get("look")
return game.set_look(player, look) if isinstance(look, dict) else "Bad request"
if path == "/api/home":
return game.upgrade_home(player)
if path == "/api/monument":
return game.give_monument(world, player, str(body.get("id")), qty if qty == "all" or isinstance(qty, int) else -1, now)
if path == "/api/statue":
return game.carve_statue(world, player, str(body.get("of")), now)
if path == "/api/potion":
return game.use_potion(player, str(body.get("item")))
if path == "/api/prayers":