Favour per town; bank slot prices restart in each town

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-04 17:14:40 +00:00
parent 22635504e8
commit a4c9977e5c
4 changed files with 146 additions and 28 deletions

10
app.py
View file

@ -121,8 +121,8 @@ def player_view(world: dict, player: dict, now: float) -> dict:
"boosts": {ab: [game.ITEMS[i]["name"] for i in player["equip"].values() if i and ab in game.ITEMS[i].get("mods", {})]
for ab in me["mods"]}}
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["perk_costs"] = {perk: game.perk_cost(world, player, perk) for perk in player["perks"]}
view["rent_cost"] = game.rent_cost(world, player)
view["caravan"] = game.caravan_view(world, player, now)
view["titles"] = game.titles(player)
view["achievements"] = game.achievements(player)
@ -212,7 +212,7 @@ def roster(world: dict, now: float) -> list[dict]:
if key in ("max_hit", "accuracy", "evasion", "crit", "interval", "block", "damage")},
"armour": game.armour(player), "reduction": round(game.damage_reduction(player), 3),
"ward": game.magic_ward(player), "ward_reduction": round(game.reduction(game.magic_ward(player)), 3),
"favour": player["favour"],
"favour": game.favour_saved(player),
"id": player["id"], "name": player["name"], "cls": player["cls"],
"total": sum(game.skill_level(player, skill) for skill in game.SKILL_IDS),
"levels": {skill: game.skill_level(player, skill) for skill in game.SKILL_IDS},
@ -490,7 +490,7 @@ class Handler(BaseHTTPRequestHandler):
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)
return game.rent_slot(world, 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)
@ -531,7 +531,7 @@ class Handler(BaseHTTPRequestHandler):
if path == "/api/plot":
return game.plant_second_plot(world, player, body.get("id") or None)
if path == "/api/perk":
return game.buy_perk(player, str(body.get("perk")))
return game.buy_perk(world, player, str(body.get("perk")))
if path == "/api/pin":
return game.toggle_pin(player, str(body.get("skill")))
if path == "/api/track":