Pin skills to the top of the sidebar

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-20 20:06:16 +01:00
parent fb237cb686
commit be478f3b2e
5 changed files with 55 additions and 4 deletions

18
game.py
View file

@ -1033,7 +1033,7 @@ RAID_TRAITS = ["lightly armoured, heavy on archers", "mounted and fast, few bows
# --- world ---------------------------------------------------------------
WORLD_VERSION = 18
WORLD_VERSION = 19
def new_world(now: float, speed: float = 1.0) -> dict:
@ -1183,6 +1183,10 @@ def migrate(world: dict, now: float | None = None) -> dict:
for slot in ("ring", "amulet", "trinket"):
player["equip"].setdefault(slot, None)
world["version"] = 18
if world["version"] < 19:
for player in world["players"].values():
player.setdefault("pinned", [])
world["version"] = 19
return world
@ -1425,6 +1429,7 @@ def new_player(uid: str, name: str, cls: str, now: float) -> dict:
"perks": {"bank_slot": 0},
"garrison": False,
"donated": 0,
"pinned": [], # skills pinned to the top of the sidebar
}
@ -3841,6 +3846,17 @@ def buy_perk(player: dict, perk: str) -> str | None:
return None
def toggle_pin(player: dict, skill: str) -> str | None:
if skill not in SKILL_IDS:
return "No such skill"
pinned = player["pinned"]
if skill in pinned:
pinned.remove(skill)
else:
pinned.append(skill)
return None
# --- icons ------------------------------------------------------------------------
# Every item, skill, class, building, prayer and output-less action gets a
# game-icons.net glyph (CC BY 3.0) and a tint. Families share a shape and are