diff --git a/app.py b/app.py index ce0a9ff..9f032ce 100644 --- a/app.py +++ b/app.py @@ -482,7 +482,8 @@ class Handler(BaseHTTPRequestHandler): 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"))) + qty = body.get("qty", 1) + return game.use_potion(player, str(body.get("item")), qty if qty == "all" or isinstance(qty, int) else -1) if path == "/api/prayers": ids = body.get("ids") return game.set_prayers(player, ids) if isinstance(ids, list) else "Bad request" diff --git a/game.py b/game.py index 0c2ee3d..c95b496 100644 --- a/game.py +++ b/game.py @@ -2692,18 +2692,24 @@ def potion_effect(player: dict, skill: str) -> dict: return ITEMS[active["item"]]["potion"] if active else {} -def use_potion(player: dict, item: str) -> str | None: - """Drink a potion from the bank into its skill's slot (topping up the same potion).""" +def use_potion(player: dict, item: str, qty: int | str = 1) -> str | None: + """Drink potions from the bank into their skill's slot (topping up the same potion).""" spec = ITEMS.get(item, {}).get("potion") if not spec: return "That isn't a potion" - if player["bank"].get(item, 0) < 1: + have = player["bank"].get(item, 0) + if have < 1: return "You don't have one" - bank_take(player, item, 1) + qty = have if qty == "all" else qty + if not isinstance(qty, int) or qty < 1: + return "Bad amount" + if have < qty: + return "You don't have that many" + bank_take(player, item, qty) current = player["potions"].get(spec["skill"]) charges = current["charges"] if current and current["item"] == item else 0 fresh = round(POTION_CHARGES * (1.25 if player["cls"] == "homesteader" else 1)) - player["potions"][spec["skill"]] = {"item": item, "charges": charges + fresh} + player["potions"][spec["skill"]] = {"item": item, "charges": charges + fresh * qty} return None @@ -6270,6 +6276,7 @@ ORDER_RECIPES, ORDER_RAW = _order_sources() # line here (new / balance / fix), and a new release a new entry on top. PATCH_NOTES = [ {"date": "2026-10-27", "title": "Prayer", "notes": [ + ("new", "Added \"Drink all\" option to potions in the bank."), ("new", "Firekeeping: Tend all fires. Each log goes on the lowest fire with room in your pile."), ("new", "Added resource dumps for Leatherworking: Guard Jerkins"), ("fix", "+Q button: rounded corners."), diff --git a/static/app.js b/static/app.js index 22a192f..adfe9ac 100644 --- a/static/app.js +++ b/static/app.js @@ -1903,6 +1903,7 @@ function itemPanel(id) { ${it.slot ? equipRow(id, it) : ""} ${it.potion ? `