Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions worlds/soe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
from BaseClasses import MultiWorld, CollectionState

__all__ = ["pyevermizer", "SoEWorld"]

__version__ = "0.50.1"
__author__ = "black-sliver"

"""
In evermizer:
Expand Down Expand Up @@ -461,7 +462,7 @@ def generate_output(self, output_directory: str) -> None:
except FileNotFoundError:
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.
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
Expand Down
8 changes: 8 additions & 0 deletions worlds/soe/archipelago.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"game": "Secret of Evermore",
"authors": [
"black-sliver"
],
"world_version": "0.50.1",
"minimum_ap_version": "0.4.2"
}
11 changes: 8 additions & 3 deletions worlds/soe/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
# 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
item_names: Set[str] = set()
items = [item for item in filter(lambda item: item.progression, # type: ignore[arg-type]
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]
items = [
item
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:
Expand Down
14 changes: 14 additions & 0 deletions worlds/soe/test/test_manifest.py
Original file line number Diff line number Diff line change
@@ -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")
Empty file added worlds/soe/tools/__init__.py
Empty file.
42 changes: 42 additions & 0 deletions worlds/soe/tools/make_manifest.py
Original file line number Diff line number Diff line change
@@ -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)
Loading