SoE: add apworld manifest (#5557)

* SoE: add APWorld manifest

* SoE: small typing fixes
This commit is contained in:
black-sliver
2025-11-11 18:16:38 +00:00
committed by GitHub
parent 088f2cc269
commit 283badfc7e
6 changed files with 75 additions and 5 deletions

View File

@@ -20,7 +20,8 @@ if typing.TYPE_CHECKING:
from BaseClasses import MultiWorld, CollectionState from BaseClasses import MultiWorld, CollectionState
__all__ = ["pyevermizer", "SoEWorld"] __all__ = ["pyevermizer", "SoEWorld"]
__version__ = "0.50.1"
__author__ = "black-sliver"
""" """
In evermizer: In evermizer:
@@ -461,7 +462,7 @@ class SoEWorld(World):
except FileNotFoundError: except FileNotFoundError:
pass pass
def modify_multidata(self, multidata: typing.Dict[str, typing.Any]) -> None: def modify_multidata(self, multidata: typing.Mapping[str, typing.Any]) -> None:
# wait for self.connect_name to be available. # wait for self.connect_name to be available.
self.connect_name_available_event.wait() self.connect_name_available_event.wait()
# we skip in case of error, so that the original error in the output thread is the one that gets raised # we skip in case of error, so that the original error in the output thread is the one that gets raised

View File

@@ -0,0 +1,8 @@
{
"game": "Secret of Evermore",
"authors": [
"black-sliver"
],
"world_version": "0.50.1",
"minimum_ap_version": "0.4.2"
}

View File

@@ -16,9 +16,14 @@ rules = pyevermizer.get_logic()
# Logic.items are all items and extra items excluding non-progression items and duplicates # Logic.items are all items and extra items excluding non-progression items and duplicates
# NOTE: we are skipping sniff items here because none of them is supposed to provide progression # NOTE: we are skipping sniff items here because none of them is supposed to provide progression
item_names: Set[str] = set() item_names: Set[str] = set()
items = [item for item in filter(lambda item: item.progression, # type: ignore[arg-type] items = [
chain(pyevermizer.get_items(), pyevermizer.get_extra_items())) item
if item.name not in item_names and not item_names.add(item.name)] # type: ignore[func-returns-value] for item in filter(
lambda item: item.progression,
chain(pyevermizer.get_items(), pyevermizer.get_extra_items()),
)
if item.name not in item_names and not item_names.add(item.name) # type: ignore[func-returns-value]
]
class SoEPlayerLogic: class SoEPlayerLogic:

View File

@@ -0,0 +1,14 @@
import json
from pathlib import Path
from unittest import TestCase, skipUnless
@skipUnless((Path(__file__).parent.parent / "tools" / "make_manifest.py").exists(), "Packaged without tools")
class ManifestTest(TestCase):
def test_manifest_is_up_to_date(self) -> None:
from ..tools.make_manifest import make_manifest
expected_manifest = make_manifest()
with (Path(__file__).parent.parent / "archipelago.json").open("r", encoding="utf-8") as f:
actual_manifest = json.load(f)
self.assertEqual(actual_manifest, expected_manifest, "Manifest is not up to date")

View File

View File

@@ -0,0 +1,42 @@
"""Create archipelago.json manifest file. Run as `python -m worlds.soe.tools.make_manifest`."""
import json
from importlib.metadata import metadata
from pathlib import Path
from typing import Any
from .. import SoEWorld, __version__ as world_version, __author__ as world_author
__all__ = ["make_manifest"]
def make_manifest() -> dict[str, Any]:
"""
Generate and return manifest dict for the Secret of Evermore APWorld.
The world version is supposed to be equal to the pyevermizer version, but we may have to break that in the future
if we ever do a breaking change to the world after we are >= 1.0.0, or we release multiple versions of the APWorld
for a single pyevermizer version.
"""
meta = metadata("pyevermizer")
version = meta["Version"]
authors = list(dict.fromkeys(map(str.rstrip, (world_author + "," + meta["Author"]).split(","))))
assert world_version == version, f"Expected world version ({world_version}) == pyevermizer version ({version})."
return {
"game": SoEWorld.game,
"authors": authors,
"world_version": world_version,
"minimum_ap_version": "0.4.2", # introduction of settings API
}
if __name__ == "__main__":
assert SoEWorld.__file__, "Could not determine world source."
module_dir = Path(SoEWorld.__file__).parent
assert module_dir.is_dir(), f"{module_dir} is not a directory"
manifest_path = module_dir / "archipelago.json"
with manifest_path.open("w", encoding="utf-8") as f:
json.dump(make_manifest(), f, indent=4)