Token HP and conditions with DM visibility toggles, fog of war, live sight range

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJhXuLD2Z6hv3Wqeq9UL9K
This commit is contained in:
Claude
2026-10-24 18:21:39 +00:00
parent a2103566a0
commit 6aac03f112
7 changed files with 248 additions and 21 deletions
+9 -1
View File
@@ -385,6 +385,7 @@ def _entry(r, shares=None, owner=None) -> dict:
if r["npc"]:
e["kind"] = str(ch.get("npc_kind") or "")
e["size"] = ch.get("token_size", 1)
e["hp"] = _health(r["data"])
if shares is not None:
e["shared_with"] = shares.get(r["id"], [])
if owner is not None:
@@ -1143,7 +1144,14 @@ def editor_reset(section: str, confirm: bool = False, user: dict = Depends(admin
return {"ok": True}
maps_mod.install(api, db, current_user, _lobby_for, _dm_only, hub, _event, Path(DB_PATH).parent / "maps", _can_read_character)
def _health(data) -> int | None:
try:
return int(compute(json.loads(data), load_rules())["derived"].get("health"))
except Exception:
return None
maps_mod.install(api, db, current_user, _lobby_for, _dm_only, hub, _event, Path(DB_PATH).parent / "maps", _can_read_character, _health)
combat_view = combat_mod.install(api, db, current_user, _lobby_for, _dm_only, hub, _event, load_rules)
purge_sounds = sounds_mod.install(api, db, current_user, _lobby_for, _dm_only, hub, Path(DB_PATH).parent / "sounds")