osr-editor 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- osr_editor-0.1.0.dist-info/METADATA +137 -0
- osr_editor-0.1.0.dist-info/RECORD +31 -0
- osr_editor-0.1.0.dist-info/WHEEL +4 -0
- osr_editor-0.1.0.dist-info/entry_points.txt +7 -0
- osr_editor-0.1.0.dist-info/licenses/LICENSE +21 -0
- osreditor/__init__.py +6 -0
- osreditor/addresses.py +123 -0
- osreditor/aids.py +932 -0
- osreditor/app.py +1756 -0
- osreditor/catalogs.py +208 -0
- osreditor/config.py +134 -0
- osreditor/conversions.py +864 -0
- osreditor/diagnostics.py +285 -0
- osreditor/documents.py +1797 -0
- osreditor/errors.py +397 -0
- osreditor/forge.py +510 -0
- osreditor/importers/__init__.py +197 -0
- osreditor/importers/project.py +146 -0
- osreditor/importers/watabou.py +603 -0
- osreditor/lint.py +295 -0
- osreditor/ops.py +740 -0
- osreditor/overrides.py +957 -0
- osreditor/projects.py +321 -0
- osreditor/providers.py +209 -0
- osreditor/publish.py +138 -0
- osreditor/py.typed +0 -0
- osreditor/sidecar.py +309 -0
- osreditor/static/assets/index-BzGvXxpQ.css +2 -0
- osreditor/static/assets/index-pa5z1OMB.js +55 -0
- osreditor/static/index.html +13 -0
- osreditor/store.py +270 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: osr-editor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local GUI editor for creating and modifying osrlib adventure modules.
|
|
5
|
+
Keywords: bx,osr,ttrpg,adventure-module,dungeon,editor,osrlib,old-school-essentials
|
|
6
|
+
Author: Marsh Macy
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Topic :: Games/Entertainment :: Role-Playing
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Dist: osrlib>=1.3,<2
|
|
17
|
+
Requires-Dist: osr-forge>=0.1,<0.2
|
|
18
|
+
Requires-Dist: pydantic>=2
|
|
19
|
+
Requires-Dist: pyyaml>=6
|
|
20
|
+
Requires-Dist: fastapi>=0.139
|
|
21
|
+
Requires-Dist: uvicorn>=0.51
|
|
22
|
+
Requires-Dist: platformdirs>=4
|
|
23
|
+
Requires-Python: >=3.14
|
|
24
|
+
Project-URL: Changelog, https://github.com/mmacy/osr-editor/blob/main/CHANGELOG.md
|
|
25
|
+
Project-URL: Documentation, https://mmacy.github.io/osr-editor/
|
|
26
|
+
Project-URL: Issues, https://github.com/mmacy/osr-editor/issues
|
|
27
|
+
Project-URL: Repository, https://github.com/mmacy/osr-editor
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# osr-editor
|
|
31
|
+
|
|
32
|
+
A local GUI application for creating and modifying adventure modules playable by [osrlib](https://github.com/mmacy/osrlib-python)-powered games. osr-editor authors the same stamped `adventure.json` documents that [osr-forge](https://github.com/mmacy/osr-forge) produces and [osr-web](https://github.com/mmacy/osr-web) plays: a FastAPI backend that holds the working document as real osrlib model objects, serving a React frontend to the browser.
|
|
33
|
+
|
|
34
|
+
**[Documentation](https://mmacy.github.io/osr-editor/)** · **[PyPI](https://pypi.org/project/osr-editor/)** · **[Changelog](https://github.com/mmacy/osr-editor/blob/main/CHANGELOG.md)**
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```console
|
|
39
|
+
uv tool install osr-editor
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or `pipx install osr-editor`, or `pip install osr-editor`. Python ≥ 3.14; no node toolchain — the published wheel ships the built frontend.
|
|
43
|
+
|
|
44
|
+
## Quickstart
|
|
45
|
+
|
|
46
|
+
```console
|
|
47
|
+
osr-editor
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The editor serves on `http://127.0.0.1:8630` and opens your browser to the home screen. Pass a project directory to open it straight away — `osr-editor ~/adventures/mill.osr`. The [quickstart](https://mmacy.github.io/osr-editor/getting-started/quickstart/) takes you from launch to a first exported adventure.
|
|
51
|
+
|
|
52
|
+
## What it does
|
|
53
|
+
|
|
54
|
+
- **[Projects](https://mmacy.github.io/osr-editor/guides/projects/)** — always-saved, canonically serialized, git-friendly project directories; every commit is one undo step, and the document on disk is always the artifact the game engine loads.
|
|
55
|
+
- **[The map editor](https://mmacy.github.io/osr-editor/guides/map-editor/)** — the full geometry tool set on graph paper: rooms, corridors, walls and doors in every state, areas, entrances, transitions, multi-level and multi-dungeon management, and live structural lint with click-to-navigate findings.
|
|
56
|
+
- **[Stocking and keyed content](https://mmacy.github.io/osr-editor/guides/stocking-and-keyed-content/)** — the map-first stocking flow over encounters, treasure, traps, features, and wandering tables, through type-ahead pickers that never author a dangling reference.
|
|
57
|
+
- **[The monster editor](https://mmacy.github.io/osr-editor/guides/monster-editor/)** — full stat-block authoring over the adventure's bundled templates: create from scratch or clone any catalog monster, with renames cascading through every reference.
|
|
58
|
+
- **[Forge-backed review](https://mmacy.github.io/osr-editor/guides/forge-backed-review/)** — open an osr-forge workdir and correct it graphically: the report as a work list beside the source pages, every edit a reasoned `overrides.yaml` entry on forge's own pure assemble loop.
|
|
59
|
+
- **[Converting a PDF](https://mmacy.github.io/osr-editor/guides/converting-a-pdf/)** — the front door to forge's pipeline: price the run first, convert with live progress and cooperative cancel, land in the review queue. No credential is ever written to disk.
|
|
60
|
+
- **[Authoring aids](https://mmacy.github.io/osr-editor/guides/authoring-aids/)** — SRD stocking with seeded, reproducible re-rolls; treasure and encounter previews; and the prose assistant, present only when a provider is configured.
|
|
61
|
+
- **[Import, export, and publish](https://mmacy.github.io/osr-editor/guides/import-export-publish/)** — geometry in from another project or a Watabou One Page Dungeon export (or any installed [importer plugin](https://mmacy.github.io/osr-editor/reference/writing-a-geometry-importer/)); the stamped document out to any path; publish into an osr-web checkout as a live symlink or a snapshot.
|
|
62
|
+
|
|
63
|
+
## Development
|
|
64
|
+
|
|
65
|
+
Working on the editor itself takes both toolchains: Python ≥ 3.14 with [uv](https://docs.astral.sh/uv/), and Node.js (LTS, see `frontend/.nvmrc`). Build the frontend once, then run the editor from the checkout:
|
|
66
|
+
|
|
67
|
+
```console
|
|
68
|
+
cd frontend && npm ci && npm run build && cd ..
|
|
69
|
+
uv sync
|
|
70
|
+
uv run osr-editor
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The dev loop runs the two halves side by side:
|
|
74
|
+
|
|
75
|
+
```console
|
|
76
|
+
# terminal one — the backend
|
|
77
|
+
uv run osr-editor --no-browser
|
|
78
|
+
|
|
79
|
+
# terminal two — the frontend with hot reload
|
|
80
|
+
cd frontend && npm run dev
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Vite serves the frontend on its own port and proxies `/api` to the backend on 8630.
|
|
84
|
+
|
|
85
|
+
### The full local gauntlet
|
|
86
|
+
|
|
87
|
+
Everything CI runs, runnable locally:
|
|
88
|
+
|
|
89
|
+
```console
|
|
90
|
+
# backend
|
|
91
|
+
uv sync --locked
|
|
92
|
+
uv run ruff format --check
|
|
93
|
+
uv run ruff check
|
|
94
|
+
uv run pyright
|
|
95
|
+
uv run pytest
|
|
96
|
+
|
|
97
|
+
# docs
|
|
98
|
+
uv run mkdocs build --strict
|
|
99
|
+
|
|
100
|
+
# frontend (from frontend/)
|
|
101
|
+
npm ci
|
|
102
|
+
npx prettier --check .
|
|
103
|
+
npx eslint .
|
|
104
|
+
npx tsc -b --force
|
|
105
|
+
npx vitest run
|
|
106
|
+
npm run build
|
|
107
|
+
|
|
108
|
+
# generated types (from the repo root; fails CI on drift)
|
|
109
|
+
uv run scripts/generate_types.py
|
|
110
|
+
|
|
111
|
+
# end to end (from frontend/, after npm run build)
|
|
112
|
+
npx tsc -p ../tests/e2e
|
|
113
|
+
npx playwright test
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Type generation
|
|
117
|
+
|
|
118
|
+
TypeScript types in `frontend/src/types/generated/` are generated from the pydantic models by `uv run scripts/generate_types.py`. Never hand-edit them; CI regenerates and fails on drift.
|
|
119
|
+
|
|
120
|
+
### Working against unreleased sibling checkouts
|
|
121
|
+
|
|
122
|
+
Dependencies resolve from PyPI. When a phase needs unreleased osrlib or osr-forge surface, flip the dependency to an editable path source in `pyproject.toml` for the duration:
|
|
123
|
+
|
|
124
|
+
```toml
|
|
125
|
+
[tool.uv.sources]
|
|
126
|
+
osrlib = { path = "../osrlib-python", editable = true }
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Revert before merging — CI resolves `uv sync --locked` from PyPI.
|
|
130
|
+
|
|
131
|
+
### Releasing
|
|
132
|
+
|
|
133
|
+
Releases are tag-driven; the runbook lives in [`AGENTS.md`](https://github.com/mmacy/osr-editor/blob/main/AGENTS.md).
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT. osr-editor ships no game content — osrlib carries the OGL data. Modules you author or convert are yours and stay in your project directories.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
osreditor/__init__.py,sha256=J0NpW9XcIkjn-MLKKukaoRF2xst7noNgObeVjORmzR0,317
|
|
2
|
+
osreditor/addresses.py,sha256=9p9o1yfLCOCwxmIEgxAFf-1qA1hUf-fRVGXb_-CehgM,3600
|
|
3
|
+
osreditor/aids.py,sha256=A4oR5KCnuu2Lb5Era2IVwB57BPQDlWLdJj6geldMPp8,35795
|
|
4
|
+
osreditor/app.py,sha256=9VijC3z_eZKNVTJYxH7GZdqmmTlr9qmRslbxaA4z8UA,64360
|
|
5
|
+
osreditor/catalogs.py,sha256=9VW434zINmQRomqdH0UqVoJLtZ0NVOgsEHTGTLsaqCo,6785
|
|
6
|
+
osreditor/config.py,sha256=KgXhIlh5dwpb4mjAPTtTL04r2hzGdTdsLilGs0BQb-o,4572
|
|
7
|
+
osreditor/conversions.py,sha256=djB8iWgDDwKdjVjCLXffxUksRokD2LheMIfteGdaa5c,32702
|
|
8
|
+
osreditor/diagnostics.py,sha256=USavWefWL_zsEN-Mcf16G_iX7HKIHXTdWKGCBQu2xy8,13166
|
|
9
|
+
osreditor/documents.py,sha256=e9vXSyRRl7hiMLTVL3f3-zPfjkgaTS9CazupPpPINus,83686
|
|
10
|
+
osreditor/errors.py,sha256=QgKrluE9yayHCrVyCntZpKuGr5xdqFOogjfayYEHXEE,13485
|
|
11
|
+
osreditor/forge.py,sha256=st3kmeuMCoq-mjiR1hOYaXitJ44RI-XdftvA1Qvwi68,19771
|
|
12
|
+
osreditor/importers/__init__.py,sha256=EZfTmiYNQn7coSV6A0I9L4025rnByAxc_jO5Ys6c36s,7074
|
|
13
|
+
osreditor/importers/project.py,sha256=A2W8UIuQMa_ilaSlFvA1Tq68-flkUBbTfwhGn0Wk628,5946
|
|
14
|
+
osreditor/importers/watabou.py,sha256=VbMzQ7LJvf6ScikfEIQE1fsYNoXlSxd9DWxNC8bA4eM,24758
|
|
15
|
+
osreditor/lint.py,sha256=93xM9Y4BQISSaRnCYT1bW_IkOJtxqlh6DkyGgsMQTn8,13971
|
|
16
|
+
osreditor/ops.py,sha256=-5w7AwrzbyCZ2UODhqFzCE3XXYoGapPX_wc7kCa5RVo,30661
|
|
17
|
+
osreditor/overrides.py,sha256=OxJaG_F70k0P1vidJBpgMO6t_haOPEeo2j5tkVP7NVc,40236
|
|
18
|
+
osreditor/projects.py,sha256=o3GmZIIS8lEq7dwap_Cn_vo4LhM91SV3OUx89Mv-RsY,12502
|
|
19
|
+
osreditor/providers.py,sha256=Hohl30kcvBsJyZmE5LmKYzae6I561TK8dFKSx1k8Vd0,7183
|
|
20
|
+
osreditor/publish.py,sha256=YZhxk6XPjBTw3prt7KHbkjknwH5fl6jw6m6ELZdwH58,5464
|
|
21
|
+
osreditor/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
osreditor/sidecar.py,sha256=s5aW2UgffH6kVMtSd9ImlL70ojYBqK-gGR8QP-GLVxU,11003
|
|
23
|
+
osreditor/static/assets/index-BzGvXxpQ.css,sha256=WQrNYDEnXac0efImdmd3o2g6iFI8pKYf5EeAMOekw6M,37513
|
|
24
|
+
osreditor/static/assets/index-pa5z1OMB.js,sha256=Y75tOGYatik1zKpL-mcWnHrtsPoXuLV07z-EaPyyQcI,671479
|
|
25
|
+
osreditor/static/index.html,sha256=-pn0DkqbqHPb0Tgd6mEpHEgy9Pzv6MwqeMog-Cznr_k,395
|
|
26
|
+
osreditor/store.py,sha256=EokmfPBdPdHsvxqXXmOFvb7UyCEgmnEUeUudhHnN8qk,10143
|
|
27
|
+
osr_editor-0.1.0.dist-info/licenses/LICENSE,sha256=VilPtgJh_TlCG79BW1ZucsC3EGbjwtsJA_SnA8gGoUc,1067
|
|
28
|
+
osr_editor-0.1.0.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
29
|
+
osr_editor-0.1.0.dist-info/entry_points.txt,sha256=wutTgzckD3fksTY3_K_MVN7qe4C2IiBYTOCdwJ4OPIE,182
|
|
30
|
+
osr_editor-0.1.0.dist-info/METADATA,sha256=rmafy0Er-YQTF4jEbydqbqIYP5hyL_17FFe04h6_2NM,6644
|
|
31
|
+
osr_editor-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Marsh Macy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
osreditor/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""osr-editor: a local GUI application for authoring osrlib adventure modules.
|
|
2
|
+
|
|
3
|
+
The package is the FastAPI backend of the editor: it holds the working document
|
|
4
|
+
as real osrlib model objects, applies typed edit operations, and serves the
|
|
5
|
+
built React frontend. See `docs/spec.md` for the architecture and contracts.
|
|
6
|
+
"""
|
osreditor/addresses.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""The diagnostics address grammar, built: `/`-joined `kind:value` segments.
|
|
2
|
+
|
|
3
|
+
The grammar was pinned by the validation tier (see
|
|
4
|
+
[`osreditor.diagnostics`][osreditor.diagnostics]): values are percent-encoded
|
|
5
|
+
(RFC 3986, everything reserved) so arbitrary osrlib ids can never make the
|
|
6
|
+
grammar ambiguous. Phase 2 adds two geometry segments, appended after the level
|
|
7
|
+
segment: `cell:<x>,<y>` and `edge:<x>,<y>:<north|west>`. Their values are
|
|
8
|
+
numeric grammar, unambiguous without encoding; the general segment parse rule
|
|
9
|
+
stays "kind is up to the first `:`, value is the remainder". The `edge:`
|
|
10
|
+
segment ships with the grammar (the inspector and hover refs use edge
|
|
11
|
+
addressing) even though no phase 2 finding emits it — `edge_invalid`
|
|
12
|
+
deliberately addresses the level. Phase 4 adds the top-level `monster:<id>`
|
|
13
|
+
segment for bundled monster templates, finer than the bare `monsters` scope
|
|
14
|
+
phase 1 pinned.
|
|
15
|
+
|
|
16
|
+
Three producers build addresses — the validation parser, the structural lint,
|
|
17
|
+
and the `ResizeLevel` offender list — so the builders live here, in one place.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from urllib.parse import quote
|
|
21
|
+
|
|
22
|
+
from osrlib.crawl.dungeon import Position
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"area_address",
|
|
26
|
+
"cell_address",
|
|
27
|
+
"dungeon_address",
|
|
28
|
+
"edge_address",
|
|
29
|
+
"encode_value",
|
|
30
|
+
"level_address",
|
|
31
|
+
"monster_address",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def encode_value(value: str) -> str:
|
|
36
|
+
"""Percent-encode an id for the address grammar (RFC 3986, everything reserved).
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
value: The raw id.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
The encoded segment value.
|
|
43
|
+
"""
|
|
44
|
+
return quote(value, safe="")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def monster_address(template_id: str) -> str:
|
|
48
|
+
"""Build a bundled-monster-template address — a top-level segment kind, phase 4's.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
template_id: The bundled template id.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
`monster:<id>`.
|
|
55
|
+
"""
|
|
56
|
+
return f"monster:{encode_value(template_id)}"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def dungeon_address(dungeon_id: str) -> str:
|
|
60
|
+
"""Build a dungeon-scope address.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
dungeon_id: The dungeon id.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
`dungeon:<id>`.
|
|
67
|
+
"""
|
|
68
|
+
return f"dungeon:{encode_value(dungeon_id)}"
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def level_address(dungeon_id: str, level_number: int) -> str:
|
|
72
|
+
"""Build a level-scope address.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
dungeon_id: The dungeon id.
|
|
76
|
+
level_number: The 1-based level number.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
`dungeon:<id>/level:<n>`.
|
|
80
|
+
"""
|
|
81
|
+
return f"{dungeon_address(dungeon_id)}/level:{level_number}"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def area_address(dungeon_id: str, level_number: int, area_id: str) -> str:
|
|
85
|
+
"""Build an area-scope address.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
dungeon_id: The dungeon id.
|
|
89
|
+
level_number: The 1-based level number.
|
|
90
|
+
area_id: The area id.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
`dungeon:<id>/level:<n>/area:<id>`.
|
|
94
|
+
"""
|
|
95
|
+
return f"{level_address(dungeon_id, level_number)}/area:{encode_value(area_id)}"
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def cell_address(dungeon_id: str, level_number: int, cell: Position) -> str:
|
|
99
|
+
"""Build a cell-scope address.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
dungeon_id: The dungeon id.
|
|
103
|
+
level_number: The 1-based level number.
|
|
104
|
+
cell: The cell.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
`dungeon:<id>/level:<n>/cell:<x>,<y>`.
|
|
108
|
+
"""
|
|
109
|
+
return f"{level_address(dungeon_id, level_number)}/cell:{cell[0]},{cell[1]}"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def edge_address(dungeon_id: str, level_number: int, edge_key: str) -> str:
|
|
113
|
+
"""Build an edge-scope address from a canonical edge key.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
dungeon_id: The dungeon id.
|
|
117
|
+
level_number: The 1-based level number.
|
|
118
|
+
edge_key: The canonical edge key (`x,y:north|west`).
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
`dungeon:<id>/level:<n>/edge:<x>,<y>:<side>`.
|
|
122
|
+
"""
|
|
123
|
+
return f"{level_address(dungeon_id, level_number)}/edge:{edge_key}"
|