Compact lobby top bar, scrollable initiative cards, hidden NPC names, resizable panels
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJhXuLD2Z6hv3Wqeq9UL9K
This commit is contained in:
@@ -58,6 +58,8 @@ def install(api, db, current_user, lobby_for, dm_only, hub, event, load_rules):
|
||||
continue
|
||||
if toks[e["token"]] and not is_dm:
|
||||
continue
|
||||
if e["kind"] == "npc" and not is_dm and e["id"] != c.get("current"):
|
||||
e = {**e, "name": ""} # players only learn an NPC's name when it is its turn
|
||||
out.append({k: e[k] for k in ("id", "kind", "name", "init", "base", "roll") if k in e} | {k: e[k] for k in ("user", "token") if k in e})
|
||||
cur = c.get("current")
|
||||
return {"round": c["round"], "current": cur if any(e["id"] == cur for e in out) else None, "entries": out}
|
||||
|
||||
@@ -352,6 +352,13 @@ def install(api, db, current_user, lobby_for, dm_only, hub, event, store_dir: Pa
|
||||
LEFT JOIN characters c ON c.id = m.character_id
|
||||
WHERE t.lobby_id=? ORDER BY t.rowid""", (lobby["id"],)).fetchall()
|
||||
full = ctx["viewer"] is None
|
||||
turn_tok = "" # players only learn an NPC's name while it is that NPC's turn
|
||||
try:
|
||||
cb = json.loads(lobby["combat"]) if lobby["combat"] else None
|
||||
if cb:
|
||||
turn_tok = next((e.get("token", "") for e in cb["entries"] if e["id"] == cb.get("current")), "")
|
||||
except (ValueError, KeyError, TypeError):
|
||||
pass
|
||||
out = []
|
||||
for r in rows:
|
||||
player = r["user_id"] is not None
|
||||
@@ -367,6 +374,8 @@ def install(api, db, current_user, lobby_for, dm_only, hub, event, store_dir: Pa
|
||||
name = (json.loads(r["data"]).get("name") if r["data"] else "") or r["username"]
|
||||
except ValueError:
|
||||
name = r["username"]
|
||||
if not player and not full and r["id"] != turn_tok:
|
||||
name = ""
|
||||
pt = ""
|
||||
src = r["data"] if player else r["ndata"]
|
||||
if src:
|
||||
|
||||
Reference in New Issue
Block a user