mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-11 10:03:44 -07:00
Compare commits
21 Commits
0.6.3
...
NewSoupVi-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89ccce7805 | ||
|
|
88a4a589a0 | ||
|
|
bead81b64b | ||
|
|
16d5b453a7 | ||
|
|
48906de873 | ||
|
|
9a64b8c5ce | ||
|
|
6ba2b7f8c3 | ||
|
|
6f7ca082f2 | ||
|
|
eb09be3594 | ||
|
|
9d654b7e3b | ||
|
|
8f7fcd4889 | ||
|
|
b85887241f | ||
|
|
5110676c76 | ||
|
|
0020e6c3d3 | ||
|
|
6e6fd0e9bc | ||
|
|
85c26f9740 | ||
|
|
9057ce0ce3 | ||
|
|
378cc91a4d | ||
|
|
cdde38fdc9 | ||
|
|
c34c00baa4 | ||
|
|
9bd535752e |
2
.github/pyright-config.json
vendored
2
.github/pyright-config.json
vendored
@@ -29,7 +29,7 @@
|
||||
"reportMissingImports": true,
|
||||
"reportMissingTypeStubs": true,
|
||||
|
||||
"pythonVersion": "3.10",
|
||||
"pythonVersion": "3.11",
|
||||
"pythonPlatform": "Windows",
|
||||
|
||||
"executionEnvironments": [
|
||||
|
||||
2
.github/workflows/analyze-modified-files.yml
vendored
2
.github/workflows/analyze-modified-files.yml
vendored
@@ -53,7 +53,7 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
if: env.diff != ''
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: "Install dependencies"
|
||||
if: env.diff != ''
|
||||
|
||||
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -22,9 +22,9 @@ env:
|
||||
# NOTE: since appimage/appimagetool and appimage/type2-runtime does not have tags anymore,
|
||||
# we check the sha256 and require manual intervention if it was updated.
|
||||
APPIMAGETOOL_VERSION: continuous
|
||||
APPIMAGETOOL_X86_64_HASH: '363dafac070b65cc36ca024b74db1f043c6f5cd7be8fca760e190dce0d18d684'
|
||||
APPIMAGETOOL_X86_64_HASH: '29348a20b80827cd261c28e95172ff828b69d43d4e4e18e3fd069e2c8693c94e'
|
||||
APPIMAGE_RUNTIME_VERSION: continuous
|
||||
APPIMAGE_RUNTIME_X86_64_HASH: 'e3c4dfb70eddf42e7e5a1d28dff396d30563aa9a901970aebe6f01f3fecf9f8e'
|
||||
APPIMAGE_RUNTIME_X86_64_HASH: 'e70ffa9b69b211574d0917adc482dd66f25a0083427b5945783965d55b0b0a8b'
|
||||
|
||||
permissions: # permissions required for attestation
|
||||
id-token: 'write'
|
||||
|
||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -12,9 +12,9 @@ env:
|
||||
# NOTE: since appimage/appimagetool and appimage/type2-runtime does not have tags anymore,
|
||||
# we check the sha256 and require manual intervention if it was updated.
|
||||
APPIMAGETOOL_VERSION: continuous
|
||||
APPIMAGETOOL_X86_64_HASH: '363dafac070b65cc36ca024b74db1f043c6f5cd7be8fca760e190dce0d18d684'
|
||||
APPIMAGETOOL_X86_64_HASH: '29348a20b80827cd261c28e95172ff828b69d43d4e4e18e3fd069e2c8693c94e'
|
||||
APPIMAGE_RUNTIME_VERSION: continuous
|
||||
APPIMAGE_RUNTIME_X86_64_HASH: 'e3c4dfb70eddf42e7e5a1d28dff396d30563aa9a901970aebe6f01f3fecf9f8e'
|
||||
APPIMAGE_RUNTIME_X86_64_HASH: 'e70ffa9b69b211574d0917adc482dd66f25a0083427b5945783965d55b0b0a8b'
|
||||
|
||||
permissions: # permissions required for attestation
|
||||
id-token: 'write'
|
||||
|
||||
5
.github/workflows/unittests.yml
vendored
5
.github/workflows/unittests.yml
vendored
@@ -39,11 +39,10 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
python:
|
||||
- {version: '3.10'}
|
||||
- {version: '3.11'}
|
||||
- {version: '3.11.2'} # Change to '3.11' around 2026-06-10
|
||||
- {version: '3.12'}
|
||||
include:
|
||||
- python: {version: '3.10'} # old compat
|
||||
- python: {version: '3.11'} # old compat
|
||||
os: windows-latest
|
||||
- python: {version: '3.12'} # current
|
||||
os: windows-latest
|
||||
|
||||
@@ -1899,7 +1899,8 @@ class Spoiler:
|
||||
if self.unreachables:
|
||||
outfile.write('\n\nUnreachable Progression Items:\n\n')
|
||||
outfile.write(
|
||||
'\n'.join(['%s: %s' % (unreachable.item, unreachable) for unreachable in self.unreachables]))
|
||||
'\n'.join(['%s: %s' % (unreachable.item, unreachable)
|
||||
for unreachable in sorted(self.unreachables)]))
|
||||
|
||||
if self.paths:
|
||||
outfile.write('\n\nPaths:\n\n')
|
||||
|
||||
@@ -28,7 +28,7 @@ COPY requirements.txt WebHostLib/requirements.txt
|
||||
|
||||
RUN pip install --no-cache-dir -r \
|
||||
WebHostLib/requirements.txt \
|
||||
setuptools
|
||||
"setuptools>=75,<81"
|
||||
|
||||
COPY _speedups.pyx .
|
||||
COPY intset.h .
|
||||
@@ -36,7 +36,7 @@ COPY intset.h .
|
||||
RUN cythonize -b -i _speedups.pyx
|
||||
|
||||
# Archipelago
|
||||
FROM python:3.12-slim AS archipelago
|
||||
FROM python:3.12-slim-bookworm AS archipelago
|
||||
ARG TARGETARCH
|
||||
ENV VIRTUAL_ENV=/opt/venv
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
@@ -5,15 +5,15 @@ import multiprocessing
|
||||
import warnings
|
||||
|
||||
|
||||
if sys.platform in ("win32", "darwin") and sys.version_info < (3, 10, 11):
|
||||
if sys.platform in ("win32", "darwin") and sys.version_info < (3, 11, 9):
|
||||
# Official micro version updates. This should match the number in docs/running from source.md.
|
||||
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. Official 3.10.15+ is supported.")
|
||||
elif sys.platform in ("win32", "darwin") and sys.version_info < (3, 10, 15):
|
||||
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. Official 3.11.9+ is supported.")
|
||||
elif sys.platform in ("win32", "darwin") and sys.version_info < (3, 11, 13):
|
||||
# There are known security issues, but no easy way to install fixed versions on Windows for testing.
|
||||
warnings.warn(f"Python Version {sys.version_info} has security issues. Don't use in production.")
|
||||
elif sys.version_info < (3, 10, 1):
|
||||
elif sys.version_info < (3, 11, 0):
|
||||
# Other platforms may get security backports instead of micro updates, so the number is unreliable.
|
||||
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.10.1+ is supported.")
|
||||
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.11.0+ is supported.")
|
||||
|
||||
# don't run update if environment is frozen/compiled or if not the parent process (skip in subprocess)
|
||||
_skip_update = bool(
|
||||
@@ -74,11 +74,11 @@ def update_command():
|
||||
def install_pkg_resources(yes=False):
|
||||
try:
|
||||
import pkg_resources # noqa: F401
|
||||
except ImportError:
|
||||
except (AttributeError, ImportError):
|
||||
check_pip()
|
||||
if not yes:
|
||||
confirm("pkg_resources not found, press enter to install it")
|
||||
subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", "setuptools"])
|
||||
subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", "setuptools>=75,<81"])
|
||||
|
||||
|
||||
def update(yes: bool = False, force: bool = False) -> None:
|
||||
|
||||
11
Utils.py
11
Utils.py
@@ -47,7 +47,7 @@ class Version(typing.NamedTuple):
|
||||
return ".".join(str(item) for item in self)
|
||||
|
||||
|
||||
__version__ = "0.6.3"
|
||||
__version__ = "0.6.4"
|
||||
version_tuple = tuplize_version(__version__)
|
||||
|
||||
is_linux = sys.platform.startswith("linux")
|
||||
@@ -414,11 +414,11 @@ def get_adjuster_settings(game_name: str) -> Namespace:
|
||||
@cache_argsless
|
||||
def get_unique_identifier():
|
||||
common_path = cache_path("common.json")
|
||||
if os.path.exists(common_path):
|
||||
try:
|
||||
with open(common_path) as f:
|
||||
common_file = json.load(f)
|
||||
uuid = common_file.get("uuid", None)
|
||||
else:
|
||||
except FileNotFoundError:
|
||||
common_file = {}
|
||||
uuid = None
|
||||
|
||||
@@ -428,6 +428,9 @@ def get_unique_identifier():
|
||||
from uuid import uuid4
|
||||
uuid = str(uuid4())
|
||||
common_file["uuid"] = uuid
|
||||
|
||||
cache_folder = os.path.dirname(common_path)
|
||||
os.makedirs(cache_folder, exist_ok=True)
|
||||
with open(common_path, "w") as f:
|
||||
json.dump(common_file, f, separators=(",", ":"))
|
||||
return uuid
|
||||
@@ -900,7 +903,7 @@ def async_start(co: Coroutine[None, None, typing.Any], name: Optional[str] = Non
|
||||
Use this to start a task when you don't keep a reference to it or immediately await it,
|
||||
to prevent early garbage collection. "fire-and-forget"
|
||||
"""
|
||||
# https://docs.python.org/3.10/library/asyncio-task.html#asyncio.create_task
|
||||
# https://docs.python.org/3.11/library/asyncio-task.html#asyncio.create_task
|
||||
# Python docs:
|
||||
# ```
|
||||
# Important: Save a reference to the result of [asyncio.create_task],
|
||||
|
||||
@@ -11,5 +11,5 @@ api_endpoints = Blueprint('api', __name__, url_prefix="/api")
|
||||
def get_players(seed: Seed) -> List[Tuple[str, str]]:
|
||||
return [(slot.player_name, slot.game) for slot in seed.slots.order_by(Slot.player_id)]
|
||||
|
||||
|
||||
from . import datapackage, generate, room, user # trigger registration
|
||||
# trigger endpoint registration
|
||||
from . import datapackage, generate, room, tracker, user
|
||||
|
||||
230
WebHostLib/api/tracker.py
Normal file
230
WebHostLib/api/tracker.py
Normal file
@@ -0,0 +1,230 @@
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any, TypedDict
|
||||
from uuid import UUID
|
||||
|
||||
from flask import abort
|
||||
|
||||
from NetUtils import ClientStatus, Hint, NetworkItem, SlotType
|
||||
from WebHostLib import cache
|
||||
from WebHostLib.api import api_endpoints
|
||||
from WebHostLib.models import Room
|
||||
from WebHostLib.tracker import TrackerData
|
||||
|
||||
|
||||
@api_endpoints.route("/tracker/<suuid:tracker>")
|
||||
@cache.memoize(timeout=60)
|
||||
def tracker_data(tracker: UUID) -> dict[str, Any]:
|
||||
"""
|
||||
Outputs json data to <root_path>/api/tracker/<id of current session tracker>.
|
||||
|
||||
:param tracker: UUID of current session tracker.
|
||||
|
||||
:return: Tracking data for all players in the room. Typing and docstrings describe the format of each value.
|
||||
"""
|
||||
room: Room | None = Room.get(tracker=tracker)
|
||||
if not room:
|
||||
abort(404)
|
||||
|
||||
tracker_data = TrackerData(room)
|
||||
|
||||
all_players: dict[int, list[int]] = tracker_data.get_all_players()
|
||||
|
||||
class PlayerAlias(TypedDict):
|
||||
player: int
|
||||
name: str | None
|
||||
|
||||
player_aliases: list[dict[str, int | list[PlayerAlias]]] = []
|
||||
"""Slot aliases of all players."""
|
||||
for team, players in all_players.items():
|
||||
team_player_aliases: list[PlayerAlias] = []
|
||||
team_aliases = {"team": team, "players": team_player_aliases}
|
||||
player_aliases.append(team_aliases)
|
||||
for player in players:
|
||||
team_player_aliases.append({"player": player, "alias": tracker_data.get_player_alias(team, player)})
|
||||
|
||||
class PlayerItemsReceived(TypedDict):
|
||||
player: int
|
||||
items: list[NetworkItem]
|
||||
|
||||
player_items_received: list[dict[str, int | list[PlayerItemsReceived]]] = []
|
||||
"""Items received by each player."""
|
||||
for team, players in all_players.items():
|
||||
player_received_items: list[PlayerItemsReceived] = []
|
||||
team_items_received = {"team": team, "players": player_received_items}
|
||||
player_items_received.append(team_items_received)
|
||||
for player in players:
|
||||
player_received_items.append(
|
||||
{"player": player, "items": tracker_data.get_player_received_items(team, player)})
|
||||
|
||||
class PlayerChecksDone(TypedDict):
|
||||
player: int
|
||||
locations: list[int]
|
||||
|
||||
player_checks_done: list[dict[str, int | list[PlayerChecksDone]]] = []
|
||||
"""ID of all locations checked by each player."""
|
||||
for team, players in all_players.items():
|
||||
per_player_checks: list[PlayerChecksDone] = []
|
||||
team_checks_done = {"team": team, "players": per_player_checks}
|
||||
player_checks_done.append(team_checks_done)
|
||||
for player in players:
|
||||
per_player_checks.append(
|
||||
{"player": player, "locations": sorted(tracker_data.get_player_checked_locations(team, player))})
|
||||
|
||||
total_checks_done: list[dict[str, int]] = [
|
||||
{"team": team, "checks_done": checks_done}
|
||||
for team, checks_done in tracker_data.get_team_locations_checked_count().items()
|
||||
]
|
||||
"""Total number of locations checked for the entire multiworld per team."""
|
||||
|
||||
class PlayerHints(TypedDict):
|
||||
player: int
|
||||
hints: list[Hint]
|
||||
|
||||
hints: list[dict[str, int | list[PlayerHints]]] = []
|
||||
"""Hints that all players have used or received."""
|
||||
for team, players in tracker_data.get_all_slots().items():
|
||||
per_player_hints: list[PlayerHints] = []
|
||||
team_hints = {"team": team, "players": per_player_hints}
|
||||
hints.append(team_hints)
|
||||
for player in players:
|
||||
player_hints = sorted(tracker_data.get_player_hints(team, player))
|
||||
per_player_hints.append({"player": player, "hints": player_hints})
|
||||
slot_info = tracker_data.get_slot_info(team, player)
|
||||
# this assumes groups are always after players
|
||||
if slot_info.type != SlotType.group:
|
||||
continue
|
||||
for member in slot_info.group_members:
|
||||
team_hints[member]["hints"] += player_hints
|
||||
|
||||
class PlayerTimer(TypedDict):
|
||||
player: int
|
||||
time: datetime | None
|
||||
|
||||
activity_timers: list[dict[str, int | list[PlayerTimer]]] = []
|
||||
"""Time of last activity per player. Returned as RFC 1123 format and null if no connection has been made."""
|
||||
for team, players in all_players.items():
|
||||
player_timers: list[PlayerTimer] = []
|
||||
team_timers = {"team": team, "players": player_timers}
|
||||
activity_timers.append(team_timers)
|
||||
for player in players:
|
||||
player_timers.append({"player": player, "time": None})
|
||||
|
||||
client_activity_timers: tuple[tuple[int, int], float] = tracker_data._multisave.get("client_activity_timers", ())
|
||||
for (team, player), timestamp in client_activity_timers:
|
||||
# use index since we can rely on order
|
||||
activity_timers[team]["player_timers"][player - 1]["time"] = datetime.fromtimestamp(timestamp, timezone.utc)
|
||||
|
||||
connection_timers: list[dict[str, int | list[PlayerTimer]]] = []
|
||||
"""Time of last connection per player. Returned as RFC 1123 format and null if no connection has been made."""
|
||||
for team, players in all_players.items():
|
||||
player_timers: list[PlayerTimer] = []
|
||||
team_connection_timers = {"team": team, "players": player_timers}
|
||||
connection_timers.append(team_connection_timers)
|
||||
for player in players:
|
||||
player_timers.append({"player": player, "time": None})
|
||||
|
||||
client_connection_timers: tuple[tuple[int, int], float] = tracker_data._multisave.get(
|
||||
"client_connection_timers", ())
|
||||
for (team, player), timestamp in client_connection_timers:
|
||||
connection_timers[team]["players"][player - 1]["time"] = datetime.fromtimestamp(timestamp, timezone.utc)
|
||||
|
||||
class PlayerStatus(TypedDict):
|
||||
player: int
|
||||
status: ClientStatus
|
||||
|
||||
player_status: list[dict[str, int | list[PlayerStatus]]] = []
|
||||
"""The current client status for each player."""
|
||||
for team, players in all_players.items():
|
||||
player_statuses: list[PlayerStatus] = []
|
||||
team_status = {"team": team, "players": player_statuses}
|
||||
player_status.append(team_status)
|
||||
for player in players:
|
||||
player_statuses.append({"player": player, "status": tracker_data.get_player_client_status(team, player)})
|
||||
|
||||
return {
|
||||
**get_static_tracker_data(room),
|
||||
"aliases": player_aliases,
|
||||
"player_items_received": player_items_received,
|
||||
"player_checks_done": player_checks_done,
|
||||
"total_checks_done": total_checks_done,
|
||||
"hints": hints,
|
||||
"activity_timers": activity_timers,
|
||||
"connection_timers": connection_timers,
|
||||
"player_status": player_status,
|
||||
"datapackage": tracker_data._multidata["datapackage"],
|
||||
}
|
||||
|
||||
@cache.memoize()
|
||||
def get_static_tracker_data(room: Room) -> dict[str, Any]:
|
||||
"""
|
||||
Builds and caches the static data for this active session tracker, so that it doesn't need to be recalculated.
|
||||
"""
|
||||
|
||||
tracker_data = TrackerData(room)
|
||||
|
||||
all_players: dict[int, list[int]] = tracker_data.get_all_players()
|
||||
|
||||
class PlayerGroups(TypedDict):
|
||||
slot: int
|
||||
name: str
|
||||
members: list[int]
|
||||
|
||||
groups: list[dict[str, int | list[PlayerGroups]]] = []
|
||||
"""The Slot ID of groups and the IDs of the group's members."""
|
||||
for team, players in tracker_data.get_all_slots().items():
|
||||
groups_in_team: list[PlayerGroups] = []
|
||||
team_groups = {"team": team, "groups": groups_in_team}
|
||||
groups.append(team_groups)
|
||||
for player in players:
|
||||
slot_info = tracker_data.get_slot_info(team, player)
|
||||
if slot_info.type != SlotType.group or not slot_info.group_members:
|
||||
continue
|
||||
groups_in_team.append(
|
||||
{
|
||||
"slot": player,
|
||||
"name": slot_info.name,
|
||||
"members": list(slot_info.group_members),
|
||||
})
|
||||
class PlayerName(TypedDict):
|
||||
player: int
|
||||
name: str
|
||||
|
||||
player_names: list[dict[str, str | list[PlayerName]]] = []
|
||||
"""Slot names of all players."""
|
||||
for team, players in all_players.items():
|
||||
per_team_player_names: list[PlayerName] = []
|
||||
team_names = {"team": team, "players": per_team_player_names}
|
||||
player_names.append(team_names)
|
||||
for player in players:
|
||||
per_team_player_names.append({"player": player, "name": tracker_data.get_player_name(team, player)})
|
||||
|
||||
class PlayerGame(TypedDict):
|
||||
player: int
|
||||
game: str
|
||||
|
||||
games: list[dict[str, int | list[PlayerGame]]] = []
|
||||
"""The game each player is playing."""
|
||||
for team, players in all_players.items():
|
||||
player_games: list[PlayerGame] = []
|
||||
team_games = {"team": team, "players": player_games}
|
||||
games.append(team_games)
|
||||
for player in players:
|
||||
player_games.append({"player": player, "game": tracker_data.get_player_game(team, player)})
|
||||
|
||||
class PlayerSlotData(TypedDict):
|
||||
player: int
|
||||
slot_data: dict[str, Any]
|
||||
|
||||
slot_data: list[dict[str, int | list[PlayerSlotData]]] = []
|
||||
"""Slot data for each player."""
|
||||
for team, players in all_players.items():
|
||||
player_slot_data: list[PlayerSlotData] = []
|
||||
team_slot_data = {"team": team, "players": player_slot_data}
|
||||
slot_data.append(team_slot_data)
|
||||
for player in players:
|
||||
player_slot_data.append({"player": player, "slot_data": tracker_data.get_slot_data(team, player)})
|
||||
|
||||
return {
|
||||
"groups": groups,
|
||||
"slot_data": slot_data,
|
||||
}
|
||||
@@ -133,6 +133,15 @@ def tutorial(game: str, file: str):
|
||||
return abort(404)
|
||||
|
||||
|
||||
@app.route('/tutorial/<string:game>/<string:file>/<string:lang>')
|
||||
def tutorial_redirect(game: str, file: str, lang: str):
|
||||
"""
|
||||
Permanent redirect old tutorial URLs to new ones to keep search engines happy.
|
||||
e.g. /tutorial/Archipelago/setup/en -> /tutorial/Archipelago/setup_en
|
||||
"""
|
||||
return redirect(url_for("tutorial", game=game, file=f"{file}_{lang}"), code=301)
|
||||
|
||||
|
||||
@app.route('/tutorial/')
|
||||
@cache.cached()
|
||||
def tutorial_landing():
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
font-weight: normal;
|
||||
font-family: LondrinaSolid-Regular, sans-serif;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer; /* TODO: remove once we drop showdown.js */
|
||||
width: 100%;
|
||||
text-shadow: 1px 1px 4px #000000;
|
||||
}
|
||||
@@ -37,7 +36,6 @@
|
||||
font-size: 38px;
|
||||
font-weight: normal;
|
||||
font-family: LondrinaSolid-Light, sans-serif;
|
||||
cursor: pointer; /* TODO: remove once we drop showdown.js */
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0.5rem;
|
||||
@@ -50,7 +48,6 @@
|
||||
font-family: LexendDeca-Regular, sans-serif;
|
||||
text-transform: none;
|
||||
text-align: left;
|
||||
cursor: pointer; /* TODO: remove once we drop showdown.js */
|
||||
width: 100%;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
@@ -59,7 +56,6 @@
|
||||
font-family: LexendDeca-Regular, sans-serif;
|
||||
text-transform: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer; /* TODO: remove once we drop showdown.js */
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
@@ -67,14 +63,12 @@
|
||||
font-family: LexendDeca-Regular, sans-serif;
|
||||
text-transform: none;
|
||||
font-size: 22px;
|
||||
cursor: pointer; /* TODO: remove once we drop showdown.js */
|
||||
}
|
||||
|
||||
.markdown h6, .markdown details summary.h6{
|
||||
font-family: LexendDeca-Regular, sans-serif;
|
||||
text-transform: none;
|
||||
font-size: 20px;
|
||||
cursor: pointer; /* TODO: remove once we drop showdown.js */
|
||||
}
|
||||
|
||||
.markdown h4, .markdown h5, .markdown h6{
|
||||
|
||||
@@ -11,32 +11,32 @@
|
||||
<h1>Site Map</h1>
|
||||
<h2>Base Pages</h2>
|
||||
<ul>
|
||||
<li><a href="/discord">Discord Link</a></li>
|
||||
<li><a href="/faq/en">F.A.Q. Page</a></li>
|
||||
<li><a href="/favicon.ico">Favicon</a></li>
|
||||
<li><a href="/generate">Generate Game Page</a></li>
|
||||
<li><a href="/">Homepage</a></li>
|
||||
<li><a href="/uploads">Host Game Page</a></li>
|
||||
<li><a href="/datapackage">Raw Data Package</a></li>
|
||||
<li><a href="{{ url_for('check')}}">Settings Validator</a></li>
|
||||
<li><a href="/sitemap">Site Map</a></li>
|
||||
<li><a href="/start-playing">Start Playing</a></li>
|
||||
<li><a href="/games">Supported Games Page</a></li>
|
||||
<li><a href="/tutorial">Tutorials Page</a></li>
|
||||
<li><a href="/user-content">User Content</a></li>
|
||||
<li><a href="{{url_for('stats')}}">Game Statistics</a></li>
|
||||
<li><a href="/glossary/en">Glossary</a></li>
|
||||
<li><a href="{{url_for("show_session")}}">Session / Login</a></li>
|
||||
<li><a href="{{ url_for('discord') }}">Discord Link</a></li>
|
||||
<li><a href="{{ url_for('faq', lang='en') }}">F.A.Q. Page</a></li>
|
||||
<li><a href="{{ url_for('favicon') }}">Favicon</a></li>
|
||||
<li><a href="{{ url_for('generate') }}">Generate Game Page</a></li>
|
||||
<li><a href="{{ url_for('landing') }}">Homepage</a></li>
|
||||
<li><a href="{{ url_for('uploads') }}">Host Game Page</a></li>
|
||||
<li><a href="{{ url_for('get_datapackage') }}">Raw Data Package</a></li>
|
||||
<li><a href="{{ url_for('check') }}">Settings Validator</a></li>
|
||||
<li><a href="{{ url_for('get_sitemap') }}">Site Map</a></li>
|
||||
<li><a href="{{ url_for('start_playing') }}">Start Playing</a></li>
|
||||
<li><a href="{{ url_for('games') }}">Supported Games Page</a></li>
|
||||
<li><a href="{{ url_for('tutorial_landing') }}">Tutorials Page</a></li>
|
||||
<li><a href="{{ url_for('user_content') }}">User Content</a></li>
|
||||
<li><a href="{{ url_for('stats') }}">Game Statistics</a></li>
|
||||
<li><a href="{{ url_for('glossary', lang='en') }}">Glossary</a></li>
|
||||
<li><a href="{{ url_for('show_session') }}">Session / Login</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Tutorials</h2>
|
||||
<ul>
|
||||
<li><a href="/tutorial/Archipelago/setup/en">Multiworld Setup Tutorial</a></li>
|
||||
<li><a href="/tutorial/Archipelago/mac/en">Setup Guide for Mac</a></li>
|
||||
<li><a href="/tutorial/Archipelago/commands/en">Server and Client Commands</a></li>
|
||||
<li><a href="/tutorial/Archipelago/advanced_settings/en">Advanced YAML Guide</a></li>
|
||||
<li><a href="/tutorial/Archipelago/triggers/en">Triggers Guide</a></li>
|
||||
<li><a href="/tutorial/Archipelago/plando/en">Plando Guide</a></li>
|
||||
<li><a href="{{ url_for('tutorial', game='Archipelago', file='setup_en') }}">Multiworld Setup Tutorial</a></li>
|
||||
<li><a href="{{ url_for('tutorial', game='Archipelago', file='mac_en') }}">Setup Guide for Mac</a></li>
|
||||
<li><a href="{{ url_for('tutorial', game='Archipelago', file='commands_en') }}">Server and Client Commands</a></li>
|
||||
<li><a href="{{ url_for('tutorial', game='Archipelago', file='advanced_settings_en') }}">Advanced YAML Guide</a></li>
|
||||
<li><a href="{{ url_for('tutorial', game='Archipelago', file='triggers_en') }}">Triggers Guide</a></li>
|
||||
<li><a href="{{ url_for('tutorial', game='Archipelago', file='plando_en') }}">Plando Guide</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Game Info Pages</h2>
|
||||
|
||||
@@ -16,7 +16,7 @@ game contributions:
|
||||
* **Do not introduce unit test failures/regressions.**
|
||||
Archipelago supports multiple versions of Python. You may need to download older Python versions to fully test
|
||||
your changes. Currently, the oldest supported version
|
||||
is [Python 3.10](https://www.python.org/downloads/release/python-31015/).
|
||||
is [Python 3.11](https://www.python.org/downloads/release/python-31113/).
|
||||
It is recommended that automated github actions are turned on in your fork to have github run unit tests after
|
||||
pushing.
|
||||
You can turn them on here:
|
||||
|
||||
@@ -7,7 +7,7 @@ use that version. These steps are for developers or platforms without compiled r
|
||||
## General
|
||||
|
||||
What you'll need:
|
||||
* [Python 3.10.11 or newer](https://www.python.org/downloads/), not the Windows Store version
|
||||
* [Python 3.11.9 or newer](https://www.python.org/downloads/), not the Windows Store version
|
||||
* On Windows, please consider only using the latest supported version in production environments since security
|
||||
updates for older versions are not easily available.
|
||||
* Python 3.12.x is currently the newest supported version
|
||||
|
||||
@@ -16,6 +16,8 @@ Current endpoints:
|
||||
- [`/status/<suuid:seed>`](#status)
|
||||
- Room API
|
||||
- [`/room_status/<suuid:room_id>`](#roomstatus)
|
||||
- Tracker API
|
||||
- [`/tracker/<suuid:tracker>`](#tracker)
|
||||
- User API
|
||||
- [`/get_rooms`](#getrooms)
|
||||
- [`/get_seeds`](#getseeds)
|
||||
@@ -244,6 +246,214 @@ Example:
|
||||
}
|
||||
```
|
||||
|
||||
## Tracker Endpoints
|
||||
Endpoints to fetch information regarding players of an active WebHost room with the supplied tracker_ID. The tracker ID
|
||||
can either be viewed while on a room tracker page, or from the [room's endpoint](#room-endpoints).
|
||||
|
||||
### `/tracker/<suuid:tracker>`
|
||||
<a name=tracker></a>
|
||||
Will provide a dict of tracker data with the following keys:
|
||||
|
||||
- item_link groups and their players (`groups`)
|
||||
- Each player's slot_data (`slot_data`)
|
||||
- Each player's current alias (`aliases`)
|
||||
- Will return the name if there is none
|
||||
- A list of items each player has received as a NetworkItem (`player_items_received`)
|
||||
- A list of checks done by each player as a list of the location id's (`player_checks_done`)
|
||||
- The total number of checks done by all players (`total_checks_done`)
|
||||
- Hints that players have used or received (`hints`)
|
||||
- The time of last activity of each player in RFC 1123 format (`activity_timers`)
|
||||
- The time of last active connection of each player in RFC 1123 format (`connection_timers`)
|
||||
- The current client status of each player (`player_status`)
|
||||
- The datapackage hash for each player (`datapackage`)
|
||||
- This hash can then be sent to the datapackage API to receive the appropriate datapackage as necessary
|
||||
|
||||
|
||||
Example:
|
||||
```json
|
||||
{
|
||||
"groups": [
|
||||
{
|
||||
"team": 0,
|
||||
"groups": [
|
||||
{
|
||||
"slot": 5,
|
||||
"name": "testGroup",
|
||||
"members": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
{
|
||||
"slot": 6,
|
||||
"name": "myCoolLink",
|
||||
"members": [
|
||||
3,
|
||||
4
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"slot_data": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"slot_data": {
|
||||
"example_option": 1,
|
||||
"other_option": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"slot_data": {
|
||||
"example_option": 1,
|
||||
"other_option": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"aliases": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"alias": "Incompetence"
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"alias": "Slot_Name_2"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"player_items_received": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"items": [
|
||||
[1, 1, 1, 0],
|
||||
[2, 2, 2, 1]
|
||||
]
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"items": [
|
||||
[1, 1, 1, 2],
|
||||
[2, 2, 2, 0]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"player_checks_done": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"locations": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"locations": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"total_checks_done": [
|
||||
{
|
||||
"team": 0,
|
||||
"checks_done": 4
|
||||
}
|
||||
],
|
||||
"hints": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"hints": [
|
||||
[1, 2, 4, 6, 0, "", 4, 0]
|
||||
]
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"hints": []
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"activity_timers": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"time": "Fri, 18 Apr 2025 20:35:45 GMT"
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"time": "Fri, 18 Apr 2025 20:42:46 GMT"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"connection_timers": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"time": "Fri, 18 Apr 2025 20:38:25 GMT"
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"time": "Fri, 18 Apr 2025 21:03:00 GMT"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"player_status": [
|
||||
{
|
||||
"team": 0,
|
||||
"players": [
|
||||
{
|
||||
"player": 1,
|
||||
"status": 0
|
||||
},
|
||||
{
|
||||
"player": 2,
|
||||
"status": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"datapackage": {
|
||||
"Archipelago": {
|
||||
"checksum": "ac9141e9ad0318df2fa27da5f20c50a842afeecb",
|
||||
"version": 0
|
||||
},
|
||||
"The Messenger": {
|
||||
"checksum": "6991cbcda7316b65bcb072667f3ee4c4cae71c0b",
|
||||
"version": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## User Endpoints
|
||||
User endpoints can get room and seed details from the current session tokens (cookies)
|
||||
|
||||
|
||||
@@ -257,6 +257,14 @@ another flag like "progression", it means "an especially useful progression item
|
||||
combined with `progression`; see below)
|
||||
* `progression_skip_balancing`: the combination of `progression` and `skip_balancing`, i.e., a progression item that
|
||||
will not be moved around by progression balancing; used, e.g., for currency or tokens, to not flood early spheres
|
||||
* `deprioritized`: denotes that an item should not be placed on priority locations
|
||||
(to be combined with `progression`; see below)
|
||||
* `progression_deprioritized`: the combination of `progression` and `deprioritized`, i.e. a progression item that
|
||||
should not be placed on priority locations, despite being progression;
|
||||
like skip_balancing, this is commonly used for currency or tokens.
|
||||
* `progression_deprioritized_skip_balancing`: the combination of `progression`, `deprioritized` and `skip_balancing`.
|
||||
Since there is overlap between the kind of items that want `skip_balancing` and `deprioritized`,
|
||||
this combined classification exists for convenience
|
||||
|
||||
### Regions
|
||||
|
||||
|
||||
@@ -754,7 +754,12 @@ class Settings(Group):
|
||||
return super().__getattribute__(key)
|
||||
# directly import world and grab settings class
|
||||
world_mod, world_cls_name = _world_settings_name_cache[key].rsplit(".", 1)
|
||||
world = cast(type, getattr(__import__(world_mod, fromlist=[world_cls_name]), world_cls_name))
|
||||
try:
|
||||
world = cast(type, getattr(__import__(world_mod, fromlist=[world_cls_name]), world_cls_name))
|
||||
except AttributeError:
|
||||
import warnings
|
||||
warnings.warn(f"World {world_cls_name} failed to initialize properly.")
|
||||
return super().__getattribute__(key)
|
||||
assert getattr(world, "settings_key") == key
|
||||
try:
|
||||
cls_or_name = world.__annotations__["settings"]
|
||||
|
||||
2
setup.py
2
setup.py
@@ -30,7 +30,7 @@ try:
|
||||
install_cx_freeze = False
|
||||
except pkg_resources.ResolutionError:
|
||||
install_cx_freeze = True
|
||||
except ImportError:
|
||||
except (AttributeError, ImportError):
|
||||
install_cx_freeze = True
|
||||
pkg_resources = None # type: ignore[assignment]
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import List, Optional, Tuple, Type, Union
|
||||
|
||||
from BaseClasses import CollectionState, Item, ItemClassification, Location, MultiWorld, Region
|
||||
from worlds import network_data_package
|
||||
from worlds.AutoWorld import World, call_all
|
||||
from worlds.AutoWorld import World, WebWorld, call_all
|
||||
|
||||
gen_steps = (
|
||||
"generate_early",
|
||||
@@ -17,7 +17,7 @@ gen_steps = (
|
||||
|
||||
|
||||
def setup_solo_multiworld(
|
||||
world_type: Type[World], steps: Tuple[str, ...] = gen_steps, seed: Optional[int] = None
|
||||
world_type: Type[World], steps: Tuple[str, ...] = gen_steps, seed: Optional[int] = None
|
||||
) -> MultiWorld:
|
||||
"""
|
||||
Creates a multiworld with a single player of `world_type`, sets default options, and calls provided gen steps.
|
||||
@@ -62,11 +62,16 @@ def setup_multiworld(worlds: Union[List[Type[World]], Type[World]], steps: Tuple
|
||||
return multiworld
|
||||
|
||||
|
||||
class TestWebWorld(WebWorld):
|
||||
tutorials = []
|
||||
|
||||
|
||||
class TestWorld(World):
|
||||
game = f"Test Game"
|
||||
item_name_to_id = {}
|
||||
location_name_to_id = {}
|
||||
hidden = True
|
||||
web = TestWebWorld()
|
||||
|
||||
|
||||
# add our test world to the data package, so we can test it later
|
||||
|
||||
63
test/webhost/test_sitemap.py
Normal file
63
test/webhost/test_sitemap.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import urllib.parse
|
||||
import html
|
||||
import re
|
||||
from flask import url_for
|
||||
|
||||
import WebHost
|
||||
from . import TestBase
|
||||
|
||||
|
||||
class TestSitemap(TestBase):
|
||||
|
||||
# Codes for OK and some redirects that we use
|
||||
valid_status_codes = [200, 302, 308]
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
super().setUpClass()
|
||||
WebHost.copy_tutorials_files_to_static()
|
||||
|
||||
def test_sitemap_route(self) -> None:
|
||||
"""Verify that the sitemap route works correctly and renders the template without errors."""
|
||||
with self.app.test_request_context():
|
||||
# Test the /sitemap route
|
||||
with self.client.open("/sitemap") as response:
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b"Site Map", response.data)
|
||||
|
||||
# Test the /index route which should also serve the sitemap
|
||||
with self.client.open("/index") as response:
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b"Site Map", response.data)
|
||||
|
||||
# Test using url_for with the function name
|
||||
with self.client.open(url_for('get_sitemap')) as response:
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b'Site Map', response.data)
|
||||
|
||||
def test_sitemap_links(self) -> None:
|
||||
"""
|
||||
Verify that all links in the sitemap are valid by making a request to each one.
|
||||
"""
|
||||
with self.app.test_request_context():
|
||||
with self.client.open(url_for("get_sitemap")) as response:
|
||||
self.assertEqual(response.status_code, 200)
|
||||
html_content = response.data.decode()
|
||||
|
||||
# Extract all href links using regex
|
||||
href_pattern = re.compile(r'href=["\'](.*?)["\']')
|
||||
links = href_pattern.findall(html_content)
|
||||
|
||||
self.assertTrue(len(links) > 0, "No links found in sitemap")
|
||||
|
||||
# Test each link
|
||||
for link in links:
|
||||
# Skip external links
|
||||
if link.startswith(("http://", "https://")):
|
||||
continue
|
||||
|
||||
link = urllib.parse.unquote(html.unescape(link))
|
||||
|
||||
with self.client.open(link) as response, self.subTest(link=link):
|
||||
self.assertIn(response.status_code, self.valid_status_codes,
|
||||
f"Link {link} returned invalid status code {response.status_code}")
|
||||
@@ -1,17 +1,46 @@
|
||||
def load_tests(loader, standard_tests, pattern):
|
||||
from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from unittest import TestLoader, TestSuite
|
||||
|
||||
|
||||
def load_tests(loader: "TestLoader", standard_tests: "TestSuite", pattern: str):
|
||||
import os
|
||||
import unittest
|
||||
import fnmatch
|
||||
from .. import file_path
|
||||
from worlds.AutoWorld import AutoWorldRegister
|
||||
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTests(standard_tests)
|
||||
|
||||
# pattern hack
|
||||
# all tests from within __init__ are always imported, so we need to filter out the folder earlier
|
||||
# if the pattern isn't matching a specific world, we don't have much of a solution
|
||||
|
||||
if pattern.startswith("worlds."):
|
||||
if pattern.endswith(".py"):
|
||||
pattern = pattern[:-3]
|
||||
components = pattern.split(".")
|
||||
world_glob = f"worlds.{components[1]}"
|
||||
pattern = components[-1]
|
||||
|
||||
elif pattern.startswith(f"worlds{os.path.sep}") or pattern.startswith(f"worlds{os.path.altsep}"):
|
||||
components = pattern.split(os.path.sep)
|
||||
if len(components) == 1:
|
||||
components = pattern.split(os.path.altsep)
|
||||
world_glob = f"worlds.{components[1]}"
|
||||
pattern = components[-1]
|
||||
else:
|
||||
world_glob = "*"
|
||||
|
||||
|
||||
folders = [os.path.join(os.path.split(world.__file__)[0], "test")
|
||||
for world in AutoWorldRegister.world_types.values()]
|
||||
for world in AutoWorldRegister.world_types.values()
|
||||
if fnmatch.fnmatch(world.__module__, world_glob)]
|
||||
|
||||
all_tests = [
|
||||
test_case for folder in folders if os.path.exists(folder)
|
||||
for test_collection in loader.discover(folder, top_level_dir=file_path)
|
||||
for test_collection in loader.discover(folder, top_level_dir=file_path, pattern=pattern)
|
||||
for test_suite in test_collection if isinstance(test_suite, unittest.suite.TestSuite)
|
||||
for test_case in test_suite
|
||||
]
|
||||
|
||||
@@ -37,7 +37,7 @@ class CV64Web(WebWorld):
|
||||
|
||||
tutorials = [Tutorial(
|
||||
"Multiworld Setup Guide",
|
||||
"A guide to setting up the Archipleago Castlevania 64 randomizer on your computer and connecting it to a "
|
||||
"A guide to setting up the Archipelago Castlevania 64 randomizer on your computer and connecting it to a "
|
||||
"multiworld.",
|
||||
"English",
|
||||
"setup_en.md",
|
||||
|
||||
@@ -41,7 +41,7 @@ class CVCotMWeb(WebWorld):
|
||||
|
||||
tutorials = [Tutorial(
|
||||
"Multiworld Setup Guide",
|
||||
"A guide to setting up the Archipleago Castlevania: Circle of the Moon randomizer on your computer and "
|
||||
"A guide to setting up the Archipelago Castlevania: Circle of the Moon randomizer on your computer and "
|
||||
"connecting it to a multiworld.",
|
||||
"English",
|
||||
"setup_en.md",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Archipelago does not have a compiled release on macOS. However, it is possible to run from source code on macOS. This guide expects you to have some experience with running software from the terminal.
|
||||
## Prerequisite Software
|
||||
Here is a list of software to install and source code to download.
|
||||
1. Python 3.10 "universal2" or newer from the [macOS Python downloads page](https://www.python.org/downloads/macos/).
|
||||
1. Python 3.11 "universal2" or newer from the [macOS Python downloads page](https://www.python.org/downloads/macos/).
|
||||
**Python 3.13 is not supported yet.**
|
||||
2. Xcode from the [macOS App Store](https://apps.apple.com/us/app/xcode/id497799835).
|
||||
3. The source code from the [Archipelago releases page](https://github.com/ArchipelagoMW/Archipelago/releases).
|
||||
|
||||
@@ -135,6 +135,10 @@ class JakAndDaxterContext(CommonContext):
|
||||
self.tags = set()
|
||||
await self.send_connect()
|
||||
|
||||
async def disconnect(self, allow_autoreconnect: bool = False):
|
||||
self.locations_checked = set() # Clear this set to gracefully handle server disconnects.
|
||||
await super(JakAndDaxterContext, self).disconnect(allow_autoreconnect)
|
||||
|
||||
def on_package(self, cmd: str, args: dict):
|
||||
|
||||
if cmd == "RoomInfo":
|
||||
@@ -177,6 +181,10 @@ class JakAndDaxterContext(CommonContext):
|
||||
|
||||
create_task_log_exception(get_orb_balance())
|
||||
|
||||
# If there were any locations checked while the client wasn't connected, we want to make sure the server
|
||||
# knows about them. To do that, replay the whole location_outbox (no duplicates will be sent).
|
||||
self.memr.outbox_index = 0
|
||||
|
||||
# Tell the server if Deathlink is enabled or disabled in the in-game options.
|
||||
# This allows us to "remember" the user's choice.
|
||||
self.on_deathlink_toggle()
|
||||
@@ -254,6 +262,7 @@ class JakAndDaxterContext(CommonContext):
|
||||
|
||||
# We don't need an ap_inform function because check_locations solves that need.
|
||||
def on_location_check(self, location_ids: list[int]):
|
||||
self.locations_checked.update(location_ids) # Populate this set to gracefully handle server disconnects.
|
||||
create_task_log_exception(self.check_locations(location_ids))
|
||||
|
||||
# CommonClient has no finished_game function, so we will have to craft our own. TODO - Update if that changes.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# Kingdom Hearts 2
|
||||
|
||||
<h2 style="text-transform:none";>Changes from the vanilla game</h2>
|
||||
## Changes from the vanilla game
|
||||
|
||||
This randomizer creates a more dynamic play experience by randomizing the locations of most items in Kingdom Hearts 2. Currently all items within Chests, Popups, Get Bonuses, Form Levels, and Sora's Levels are randomized. This allows abilities that Sora would normally have to be placed on Keyblades with random stats. Additionally, there are several options for ways to finish the game, allowing for different goals beyond beating the final boss.
|
||||
|
||||
<h2 style="text-transform:none";>Where is the options page</h2>
|
||||
## Where is the options page
|
||||
|
||||
The [player options page for this game](../player-options) contains all the options you need to configure and export a config file.
|
||||
|
||||
|
||||
<h2 style="text-transform:none";>What is randomized in this game?</h2>
|
||||
## What is randomized in this game?
|
||||
|
||||
|
||||
- Chests
|
||||
@@ -21,27 +21,27 @@ The [player options page for this game](../player-options) contains all the opti
|
||||
- Keyblade Stats
|
||||
- Keyblade Abilities
|
||||
|
||||
<h2 style="text-transform:none";>What Kingdom Hearts 2 items can appear in other players' worlds?</h2>
|
||||
## What Kingdom Hearts 2 items can appear in other players' worlds?
|
||||
|
||||
|
||||
Every item in the game except for abilities on weapons.
|
||||
|
||||
<h2 style="text-transform:none";>What is The Garden of Assemblage "GoA"?</h2>
|
||||
## What is The Garden of Assemblage "GoA"?
|
||||
|
||||
|
||||
The Garden of Assemblage Mod made by Sonicshadowsilver2 and Num turns the Garden of Assemblage into a “World Hub” where each portal takes you to one of the game worlds (as opposed to having a world map). This allows you to enter worlds at any time, and world progression is maintained for each world individually.
|
||||
|
||||
<h2 style="text-transform:none";>What does another world's item look like in Kingdom Hearts 2?</h2>
|
||||
## What does another world's item look like in Kingdom Hearts 2?
|
||||
|
||||
|
||||
In Kingdom Hearts 2, items which need to be sent to other worlds appear in any location that has a item in the vanilla game. They are represented by the Archipelago icon, and must be "picked up" as if it were a normal item. Upon obtaining the item, it will be sent to its home world.
|
||||
|
||||
<h2 style="text-transform:none";>When the player receives an item, what happens?</h2>
|
||||
## When the player receives an item, what happens?
|
||||
|
||||
|
||||
It is added to your inventory. If you obtain magic, you will need to pause your game to have it show up in your inventory, then enter a new room for it to become properly usable.
|
||||
|
||||
<h2 style="text-transform:none";>What Happens if I die before Room Saving?</h2>
|
||||
## What Happens if I die before Room Saving?
|
||||
|
||||
|
||||
When you die in vanilla Kingdom Hearts 2, you are reverted to the last non-boss room you entered and your status is reverted to what it was at that time. However, in archipelago, any item that you have sent/received will not be taken away from the player, any chest you have opened will remain open, and you will keep your level, but lose the experience.
|
||||
@@ -49,7 +49,7 @@ When you die in vanilla Kingdom Hearts 2, you are reverted to the last non-boss
|
||||
|
||||
For example, if you are fighting Roxas, receive Reflect Element, then die mid-fight, you will keep that Reflect Element. You will still need to pause your game to have it show up in your inventory, then enter a new room for it to become properly usable.
|
||||
|
||||
<h2 style="text-transform:none";>Customization options:</h2>
|
||||
## Customization options:
|
||||
|
||||
|
||||
- Choose a goal from the list below (with an additional option to Kill Final Xemnas alongside your goal).
|
||||
@@ -64,11 +64,11 @@ For example, if you are fighting Roxas, receive Reflect Element, then die mid-fi
|
||||
- Customize the amount and level of progressive movement (Growth Abilities) you start with.
|
||||
- Customize start inventory, i.e., begin every run with certain items or spells of your choice.
|
||||
|
||||
<h2 style="text-transform:none";>What are Lucky Emblems?</h2>
|
||||
## What are Lucky Emblems?
|
||||
Lucky Emblems are items that are required to beat the game if your goal is "Lucky Emblem Hunt".<br>
|
||||
You can think of these as requiring X number of Proofs of Nonexistence to open the final door.
|
||||
|
||||
<h2 style="text-transform:none";>What is Hitlist/Bounties?</h2>
|
||||
## What is Hitlist/Bounties?
|
||||
The Hitlist goal adds "bounty" items to select late-game fights and locations, and you need to collect X number of them to win.<br>
|
||||
The list of possible locations that can contain a bounty:
|
||||
|
||||
@@ -82,7 +82,7 @@ The list of possible locations that can contain a bounty:
|
||||
- Transport to Remembrance
|
||||
- Godess of Fate cup and Hades Paradox cup
|
||||
|
||||
<h2 style="text-transform:none";>Quality of life:</h2>
|
||||
## Quality of life:
|
||||
|
||||
|
||||
With the help of Shananas, Num, and ZakTheRobot we have many QoL features such are:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Kingdom Hearts 2 Archipelago Setup Guide
|
||||
|
||||
<h2 style="text-transform:none";>Quick Links</h2>
|
||||
## Quick Links
|
||||
|
||||
- [Game Info Page](../../../../games/Kingdom%20Hearts%202/info/en)
|
||||
- [Player Options Page](../../../../games/Kingdom%20Hearts%202/player-options)
|
||||
|
||||
<h2 style="text-transform:none";>Required Software:</h2>
|
||||
## Required Software:
|
||||
|
||||
Kingdom Hearts II Final Mix from the [Epic Games Store](https://store.epicgames.com/en-US/discover/kingdom-hearts) or [Steam](https://store.steampowered.com/app/2552430/KINGDOM_HEARTS_HD_1525_ReMIX/)
|
||||
|
||||
@@ -23,39 +23,39 @@ Kingdom Hearts II Final Mix from the [Epic Games Store](https://store.epicgames.
|
||||
1. Optionally Install the Archipelago Quality Of Life mod from `JaredWeakStrike/AP_QOL` using OpenKH Mod Manager
|
||||
2. Optionally Install the Quality Of Life mod from `shananas/BearSkip` using OpenKH Mod Manager
|
||||
|
||||
<h3 style="text-transform:none";>Required: Archipelago Companion Mod</h3>
|
||||
### Required: Archipelago Companion Mod
|
||||
|
||||
Load this mod just like the <b>GoA ROM</b> you did during the KH2 Rando setup. `JaredWeakStrike/APCompanion`<br>
|
||||
Have this mod second-highest priority below the .zip seed.<br>
|
||||
This mod is based upon Num's Garden of Assemblage Mod and requires it to work. Without Num this could not be possible.
|
||||
|
||||
<h3 style="text-transform:none";>Required: Auto Save Mod and KH2 Lua Library</h3>
|
||||
### Required: Auto Save Mod and KH2 Lua Library
|
||||
|
||||
Load these mods just like you loaded the GoA ROM mod during the KH2 Rando setup. `KH2FM-Mods-equations19/auto-save` and `KH2FM-Mods-equations19/KH2-Lua-Library` Location doesn't matter, required in case of crashes. See [Best Practices](en#best-practices) on how to load the auto save
|
||||
Load these mods just like you loaded the GoA ROM mod during the KH2 Rando setup. `KH2FM-Mods-equations19/auto-save` and `KH2FM-Mods-equations19/KH2-Lua-Library` Location doesn't matter, required in case of crashes. See [Best Practices](#best-practices) on how to load the auto save
|
||||
|
||||
<h3 style="text-transform:none";>Optional QoL Mods: AP QoL and Bear Skip</h3>
|
||||
### Optional QoL Mods: AP QoL and Bear Skip
|
||||
|
||||
`JaredWeakStrike/AP_QOL` Makes the urns minigames much faster, makes Cavern of Remembrance orbs drop significantly more drive orbs for refilling drive/leveling master form, skips the animation when using the bulky vendor RC, skips carpet escape auto-scroller in Agrabah 2, and prevents the wardrobe in the Beasts Castle wardrobe push minigame from waking up while being pushed.
|
||||
|
||||
`shananas/BearSkip` Skips all minigames in 100 Acre Woods except the Spooky Cave minigame since there are chests in Spooky Cave you can only get during the minigame. For Spooky Cave, Pooh is moved to the other side of the invisible wall that prevents you from using his RC to finish the minigame.
|
||||
|
||||
<h3 style="text-transform:none";>Installing A Seed</h3>
|
||||
### Installing A Seed
|
||||
|
||||
When you generate a game you will see a download link for a KH2 .zip seed on the room page. Download the seed then open OpenKH Mod Manager and click the green plus and "Select and install Mod Archive".<br>
|
||||
Make sure the seed is on the top of the list (Highest Priority)<br>
|
||||
After Installing the seed click "Mod Loader -> Build/Build and Run". Every slot is a unique mod to install and will be needed be repatched for different slots/rooms.
|
||||
|
||||
<h2 style="text-transform:none";>Optional Software:</h2>
|
||||
## Optional Software:
|
||||
|
||||
- [Kingdom Hearts 2 AP Tracker](https://github.com/palex00/kh2-ap-tracker/releases/latest/), for use with
|
||||
[PopTracker](https://github.com/black-sliver/PopTracker/releases)
|
||||
|
||||
<h2 style="text-transform:none";>What the Mod Manager Should Look Like.</h2>
|
||||
## What the Mod Manager Should Look Like.
|
||||
|
||||

|
||||
|
||||
|
||||
<h2 style="text-transform:none";>Using the KH2 Client</h2>
|
||||
## Using the KH2 Client
|
||||
|
||||
Start the game through OpenKH Mod Manager. If starting a new run, enter the Garden of Assemblage from a new save. If returning to a run, load the save and enter the Garden of Assemblage. Then run the [ArchipelagoKH2Client.exe](https://github.com/ArchipelagoMW/Archipelago/releases).<br>
|
||||
When you successfully connect to the server the client will automatically hook into the game to send/receive checks. <br>
|
||||
@@ -67,13 +67,13 @@ Most checks will be sent to you anywhere outside a load or cutscene.<br>
|
||||
|
||||
If you obtain magic, you will need to pause your game to have it show up in your inventory, then enter a new room for it to become properly usable.
|
||||
|
||||
<h2 style="text-transform:none";>KH2 Client should look like this: </h2>
|
||||
## KH2 Client should look like this:
|
||||
|
||||

|
||||
|
||||
Enter The room's port number into the top box <b> where the x's are</b> and press "Connect". Follow the prompts there and you should be connected
|
||||
|
||||
<h2 style="text-transform:none";>Common Pitfalls</h2>
|
||||
## Common Pitfalls
|
||||
|
||||
- Having an old GOA Lua Script in your `C:\Users\*YourName*\Documents\KINGDOM HEARTS HD 1.5+2.5 ReMIX\scripts\kh2` folder.
|
||||
- Pressing F2 while in game should look like this. 
|
||||
@@ -86,7 +86,7 @@ Enter The room's port number into the top box <b> where the x's are</b> and pres
|
||||
- Using a seed from the standalone KH2 Randomizer Seed Generator.
|
||||
- The Archipelago version of the KH2 Randomizer does not use this Seed Generator; refer to the [Archipelago Setup](https://archipelago.gg/tutorial/Archipelago/setup/en) to learn how to generate and play a seed through Archipelago.
|
||||
|
||||
<h2 style="text-transform:none"; >Best Practices</h2>
|
||||
## Best Practices
|
||||
|
||||
- Make a save at the start of the GoA before opening anything. This will be the file to select when loading an autosave if/when your game crashes.
|
||||
- If you don't want to have a save in the GoA. Disconnect the client, load the auto save, and then reconnect the client after it loads the auto save.
|
||||
@@ -94,13 +94,13 @@ Enter The room's port number into the top box <b> where the x's are</b> and pres
|
||||
- Run the game in windows/borderless windowed mode. Fullscreen is stable but the game can crash if you alt-tab out.
|
||||
- Make sure to save in a different save slot when playing in an async or disconnecting from the server to play a different seed
|
||||
|
||||
<h2 style="text-transform:none";>Logic Sheet & PopTracker Autotracking</h2>
|
||||
## Logic Sheet & PopTracker Autotracking
|
||||
|
||||
Have any questions on what's in logic? This spreadsheet made by Bulcon has the answer [Requirements/logic sheet](https://docs.google.com/spreadsheets/d/1nNi8ohEs1fv-sDQQRaP45o6NoRcMlLJsGckBonweDMY/edit?usp=sharing)
|
||||
|
||||
Alternatively you can use the Kingdom Hearts 2 PopTracker Pack that is based off of the logic sheet above and does all the work for you.
|
||||
|
||||
<h3 style="text-transform:none";>PopTracker Pack</h3>
|
||||
### PopTracker Pack
|
||||
|
||||
1. Download [Kingdom Hearts 2 AP Tracker](https://github.com/palex00/kh2-ap-tracker/releases/latest/) and
|
||||
[PopTracker](https://github.com/black-sliver/PopTracker/releases).
|
||||
@@ -112,7 +112,7 @@ Alternatively you can use the Kingdom Hearts 2 PopTracker Pack that is based off
|
||||
This pack will handle logic, received items, checked locations and autotabbing for you!
|
||||
|
||||
|
||||
<h2 style="text-transform:none";>F.A.Q.</h2>
|
||||
## F.A.Q.
|
||||
|
||||
- Why is my Client giving me a "Cannot Open Process: " error?
|
||||
- Due to how the client reads kingdom hearts 2 memory some people's computer flags it as a virus. Run the client as admin.
|
||||
|
||||
@@ -3,6 +3,8 @@ import typing
|
||||
from BaseClasses import Location
|
||||
|
||||
|
||||
task_types = ["prayer", "magic", "runecraft", "mining", "crafting", "smithing", "fishing", "cooking", "firemaking", "woodcutting", "combat"]
|
||||
|
||||
class SkillRequirement(typing.NamedTuple):
|
||||
skill: str
|
||||
level: int
|
||||
|
||||
@@ -8,7 +8,7 @@ import requests
|
||||
# The CSVs are updated at this repository to be shared between generator and client.
|
||||
data_repository_address = "https://raw.githubusercontent.com/digiholic/osrs-archipelago-logic/"
|
||||
# The Github tag of the CSVs this was generated with
|
||||
data_csv_tag = "v2.0.4"
|
||||
data_csv_tag = "v2.0.5"
|
||||
# If true, generate using file names in the repository
|
||||
debug = False
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ location_rows = [
|
||||
LocationRow('Bake a Redberry Pie', 'cooking', ['Redberry Bush', 'Wheat', 'Windmill', 'Pie Dish', ], [SkillRequirement('Cooking', 10), ], [], 0),
|
||||
LocationRow('Cook some Stew', 'cooking', ['Bowl', 'Meat', 'Potato', ], [SkillRequirement('Cooking', 25), ], [], 0),
|
||||
LocationRow('Bake an Apple Pie', 'cooking', ['Cooking Apple', 'Wheat', 'Windmill', 'Pie Dish', ], [SkillRequirement('Cooking', 32), ], [], 2),
|
||||
LocationRow('Enter the Cook\'s Guild', 'cooking', ['Cook\'s Guild', ], [], [], 0),
|
||||
LocationRow('Enter the Cook\'s Guild', 'cooking', ['Cook\'s Guild', ], [SkillRequirement('Cooking', 32), ], [], 0),
|
||||
LocationRow('Bake a Cake', 'cooking', ['Wheat', 'Windmill', 'Egg', 'Milk', 'Cake Tin', ], [SkillRequirement('Cooking', 40), ], [], 6),
|
||||
LocationRow('Bake a Meat Pizza', 'cooking', ['Wheat', 'Windmill', 'Cheese', 'Tomato', 'Meat', ], [SkillRequirement('Cooking', 45), ], [], 8),
|
||||
LocationRow('Burn a Log', 'firemaking', [], [SkillRequirement('Firemaking', 1), SkillRequirement('Woodcutting', 1), ], [], 0),
|
||||
|
||||
@@ -2,7 +2,7 @@ from dataclasses import dataclass
|
||||
|
||||
from Options import Choice, Toggle, Range, PerGameCommonOptions
|
||||
|
||||
MAX_COMBAT_TASKS = 16
|
||||
MAX_COMBAT_TASKS = 17
|
||||
|
||||
MAX_PRAYER_TASKS = 5
|
||||
MAX_MAGIC_TASKS = 7
|
||||
|
||||
@@ -190,6 +190,8 @@ def get_firemaking_skill_rule(level, player, options) -> CollectionRule:
|
||||
|
||||
|
||||
def get_skill_rule(skill, level, player, options) -> CollectionRule:
|
||||
if level <= 1:
|
||||
return lambda state: True
|
||||
if skill.lower() == "fishing":
|
||||
return get_fishing_skill_rule(level, player, options)
|
||||
if skill.lower() == "mining":
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import typing
|
||||
|
||||
from BaseClasses import Item, Tutorial, ItemClassification, Region, MultiWorld, CollectionState
|
||||
from Fill import fill_restrictive, FillError
|
||||
from BaseClasses import Item, Tutorial, ItemClassification, Region, MultiWorld
|
||||
from worlds.AutoWorld import WebWorld, World
|
||||
from Options import OptionError
|
||||
from .Items import OSRSItem, starting_area_dict, chunksanity_starting_chunks, QP_Items, ItemRow, \
|
||||
chunksanity_special_region_names
|
||||
from .Locations import OSRSLocation, LocationRow
|
||||
from .Locations import OSRSLocation, LocationRow, task_types
|
||||
from .Rules import *
|
||||
from .Options import OSRSOptions, StartingArea
|
||||
from .Names import LocationNames, ItemNames, RegionNames
|
||||
@@ -47,6 +47,7 @@ class OSRSWorld(World):
|
||||
base_id = 0x070000
|
||||
data_version = 1
|
||||
explicit_indirect_conditions = False
|
||||
ut_can_gen_without_yaml = True
|
||||
|
||||
item_name_to_id = {item_rows[i].name: 0x070000 + i for i in range(len(item_rows))}
|
||||
location_name_to_id = {location_rows[i].name: 0x070000 + i for i in range(len(location_rows))}
|
||||
@@ -105,6 +106,18 @@ class OSRSWorld(World):
|
||||
|
||||
# Set Starting Chunk
|
||||
self.multiworld.push_precollected(self.create_item(self.starting_area_item))
|
||||
elif hasattr(self.multiworld,"re_gen_passthrough") and self.game in self.multiworld.re_gen_passthrough:
|
||||
re_gen_passthrough = self.multiworld.re_gen_passthrough[self.game] # UT passthrough
|
||||
if "starting_area" in re_gen_passthrough:
|
||||
self.starting_area_item = re_gen_passthrough["starting_area"]
|
||||
for task_type in task_types:
|
||||
if f"max_{task_type}_level" in re_gen_passthrough:
|
||||
getattr(self.options,f"max_{task_type}_level").value = re_gen_passthrough[f"max_{task_type}_level"]
|
||||
max_count = getattr(self.options,f"max_{task_type}_tasks")
|
||||
max_count.value = max_count.range_end
|
||||
self.options.brutal_grinds.value = re_gen_passthrough["brutal_grinds"]
|
||||
|
||||
|
||||
|
||||
"""
|
||||
This function pulls from LogicCSVToPython so that it sends the correct tag of the repository to the client.
|
||||
@@ -115,20 +128,13 @@ class OSRSWorld(World):
|
||||
data = self.options.as_dict("brutal_grinds")
|
||||
data["data_csv_tag"] = data_csv_tag
|
||||
data["starting_area"] = str(self.starting_area_item) #these aren't actually strings, they just play them on tv
|
||||
for task_type in task_types:
|
||||
data[f"max_{task_type}_level"] = getattr(self.options,f"max_{task_type}_level").value
|
||||
return data
|
||||
|
||||
def interpret_slot_data(self, slot_data: typing.Dict[str, typing.Any]) -> None:
|
||||
if "starting_area" in slot_data:
|
||||
self.starting_area_item = slot_data["starting_area"]
|
||||
menu_region = self.multiworld.get_region("Menu",self.player)
|
||||
menu_region.exits.clear() #prevent making extra exits if players just reconnect to a differnet slot
|
||||
if self.starting_area_item in chunksanity_special_region_names:
|
||||
starting_area_region = chunksanity_special_region_names[self.starting_area_item]
|
||||
else:
|
||||
starting_area_region = self.starting_area_item[6:] # len("Area: ")
|
||||
starting_entrance = menu_region.create_exit(f"Start->{starting_area_region}")
|
||||
starting_entrance.access_rule = lambda state: state.has(self.starting_area_item, self.player)
|
||||
starting_entrance.connect(self.region_name_to_data[starting_area_region])
|
||||
@staticmethod
|
||||
def interpret_slot_data(slot_data: typing.Dict[str, typing.Any]) -> typing.Dict[str, typing.Any]:
|
||||
return slot_data
|
||||
|
||||
def create_regions(self) -> None:
|
||||
"""
|
||||
@@ -195,6 +201,8 @@ class OSRSWorld(World):
|
||||
generation_is_fake = hasattr(self.multiworld, "generation_is_fake") # UT specific override
|
||||
locations_required = 0
|
||||
for item_row in item_rows:
|
||||
if item_row.name == self.starting_area_item:
|
||||
continue #skip starting area
|
||||
# If it's a filler item, set it aside for later
|
||||
if item_row.progression == ItemClassification.filler:
|
||||
continue
|
||||
@@ -206,15 +214,18 @@ class OSRSWorld(World):
|
||||
locations_required += item_row.amount
|
||||
if self.options.enable_duds: locations_required += self.options.dud_count
|
||||
|
||||
locations_added = 1 # At this point we've already added the starting area, so we start at 1 instead of 0
|
||||
|
||||
locations_added = 0 # Keep track of the number of locations we add so we don't add more the number of items we're going to make
|
||||
# Quests are always added first, before anything else is rolled
|
||||
for i, location_row in enumerate(location_rows):
|
||||
if location_row.category in {"quest", "points", "goal"}:
|
||||
if location_row.category in {"quest"}:
|
||||
if self.task_within_skill_levels(location_row.skills):
|
||||
self.create_and_add_location(i)
|
||||
if location_row.category == "quest":
|
||||
locations_added += 1
|
||||
locations_added += 1
|
||||
elif location_row.category in {"goal"}:
|
||||
if not self.task_within_skill_levels(location_row.skills):
|
||||
raise OptionError(f"Goal location for {self.player_name} not allowed in skill levels") #it doesn't actually have any, but just in case for future
|
||||
self.create_and_add_location(i)
|
||||
|
||||
|
||||
# Build up the weighted Task Pool
|
||||
rnd = self.random
|
||||
@@ -225,18 +236,28 @@ class OSRSWorld(World):
|
||||
rnd.shuffle(general_tasks)
|
||||
else:
|
||||
general_tasks.reverse()
|
||||
for i in range(self.options.minimum_general_tasks):
|
||||
general_tasks_added = 0
|
||||
while general_tasks_added<self.options.minimum_general_tasks and general_tasks:
|
||||
task = general_tasks.pop()
|
||||
self.add_location(task)
|
||||
locations_added += 1
|
||||
if self.task_within_skill_levels(task.skills):
|
||||
self.add_location(task)
|
||||
locations_added += 1
|
||||
general_tasks_added += 1
|
||||
while generation_is_fake and len(general_tasks)>0:
|
||||
task = general_tasks.pop()
|
||||
if self.task_within_skill_levels(task.skills):
|
||||
self.add_location(task)
|
||||
locations_added += 1
|
||||
general_tasks_added += 1
|
||||
if general_tasks_added < self.options.minimum_general_tasks:
|
||||
raise OptionError(f"{self.plyaer_name} doesn't have enough general tasks to create required minimum count"+
|
||||
f", raise maximum skill levels or lower minimum general tasks")
|
||||
|
||||
general_weight = self.options.general_task_weight if len(general_tasks) > 0 else 0
|
||||
general_weight = self.options.general_task_weight.value if len(general_tasks) > 0 else 0
|
||||
|
||||
tasks_per_task_type: typing.Dict[str, typing.List[LocationRow]] = {}
|
||||
weights_per_task_type: typing.Dict[str, int] = {}
|
||||
|
||||
task_types = ["prayer", "magic", "runecraft", "mining", "crafting",
|
||||
"smithing", "fishing", "cooking", "firemaking", "woodcutting", "combat"]
|
||||
|
||||
for task_type in task_types:
|
||||
max_amount_for_task_type = getattr(self.options, f"max_{task_type}_tasks")
|
||||
tasks_for_this_type = [task for task in self.locations_by_category[task_type]
|
||||
@@ -263,10 +284,13 @@ class OSRSWorld(World):
|
||||
all_weights.append(weights_per_task_type[task_type])
|
||||
|
||||
# Even after the initial forced generals, they can still be rolled randomly
|
||||
if general_weight > 0:
|
||||
if general_weight > 0 and len(general_tasks)>0:
|
||||
all_tasks.append(general_tasks)
|
||||
all_weights.append(general_weight)
|
||||
|
||||
if not generation_is_fake and locations_added > locations_required: #due to minimum general tasks we already have more than needed
|
||||
raise OptionError(f"Too many locations created for {self.player_name}, lower the minimum general tasks")
|
||||
|
||||
while locations_added < locations_required or (generation_is_fake and len(all_tasks) > 0):
|
||||
if all_tasks:
|
||||
chosen_task = rnd.choices(all_tasks, all_weights)[0]
|
||||
@@ -282,9 +306,9 @@ class OSRSWorld(World):
|
||||
del all_tasks[index]
|
||||
del all_weights[index]
|
||||
|
||||
else:
|
||||
else: # We can ignore general tasks in UT because they will have been cleared already
|
||||
if len(general_tasks) == 0:
|
||||
raise Exception(f"There are not enough available tasks to fill the remaining pool for OSRS " +
|
||||
raise OptionError(f"There are not enough available tasks to fill the remaining pool for OSRS " +
|
||||
f"Please adjust {self.player_name}'s settings to be less restrictive of tasks.")
|
||||
task = general_tasks.pop()
|
||||
self.add_location(task)
|
||||
@@ -296,7 +320,7 @@ class OSRSWorld(World):
|
||||
self.create_and_add_location(index)
|
||||
|
||||
def create_items(self) -> None:
|
||||
filler_items = []
|
||||
filler_items:list[ItemRow] = []
|
||||
for item_row in item_rows:
|
||||
if item_row.name != self.starting_area_item:
|
||||
# If it's a filler item, set it aside for later
|
||||
@@ -321,7 +345,7 @@ class OSRSWorld(World):
|
||||
|
||||
def get_filler_item_name(self) -> str:
|
||||
if self.options.enable_duds:
|
||||
return self.random.choice([item for item in item_rows if item.progression == ItemClassification.filler])
|
||||
return self.random.choice([item.name for item in item_rows if item.progression == ItemClassification.filler])
|
||||
else:
|
||||
return self.random.choice([ItemNames.Progressive_Weapons, ItemNames.Progressive_Magic,
|
||||
ItemNames.Progressive_Range_Weapon, ItemNames.Progressive_Armor,
|
||||
@@ -388,6 +412,12 @@ class OSRSWorld(World):
|
||||
# Set the access rule for the QP Location
|
||||
add_rule(qp_loc, lambda state, loc=q_loc: (loc.can_reach(state)))
|
||||
|
||||
qp = 0
|
||||
for qp_event in self.available_QP_locations:
|
||||
qp += int(qp_event[0])
|
||||
if qp < self.location_rows_by_name[LocationNames.Q_Dragon_Slayer].qp:
|
||||
raise OptionError(f"{self.player_name} doesn't have enough quests for reach goal, increase maximum skill levels")
|
||||
|
||||
# place "Victory" at "Dragon Slayer" and set collection as win condition
|
||||
self.multiworld.get_location(LocationNames.Q_Dragon_Slayer, self.player) \
|
||||
.place_locked_item(self.create_event("Victory"))
|
||||
|
||||
@@ -168,8 +168,8 @@ class ZillionWorld(World):
|
||||
def create_regions(self) -> None:
|
||||
assert self.zz_system.randomizer, "generate_early hasn't been called"
|
||||
assert self.id_to_zz_item, "generate_early hasn't been called"
|
||||
p = self.player
|
||||
logic_cache = ZillionLogicCache(p, self.zz_system.randomizer, self.id_to_zz_item)
|
||||
player = self.player
|
||||
logic_cache = ZillionLogicCache(player, self.zz_system.randomizer, self.id_to_zz_item)
|
||||
self.logic_cache = logic_cache
|
||||
w = self.multiworld
|
||||
self.my_locations = []
|
||||
@@ -192,7 +192,7 @@ class ZillionWorld(World):
|
||||
all_regions: dict[str, ZillionRegion] = {}
|
||||
for here_zz_name, zz_r in self.zz_system.randomizer.regions.items():
|
||||
here_name = "Menu" if here_zz_name == "start" else zz_reg_name_to_reg_name(here_zz_name)
|
||||
all_regions[here_name] = ZillionRegion(zz_r, here_name, here_name, p, w)
|
||||
all_regions[here_name] = ZillionRegion(zz_r, here_name, here_name, player, w)
|
||||
self.multiworld.regions.append(all_regions[here_name])
|
||||
|
||||
limited_skill = Req(gun=3, jump=3, skill=self.zz_system.randomizer.options.skill, hp=940, red=1, floppy=126)
|
||||
@@ -239,7 +239,7 @@ class ZillionWorld(World):
|
||||
for zz_dest in zz_here.connections.keys():
|
||||
dest_name = "Menu" if zz_dest.name == "start" else zz_reg_name_to_reg_name(zz_dest.name)
|
||||
dest = all_regions[dest_name]
|
||||
exit_ = Entrance(p, f"{here_name} to {dest_name}", here)
|
||||
exit_ = Entrance(player, f"{here_name} to {dest_name}", here)
|
||||
here.exits.append(exit_)
|
||||
exit_.connect(dest)
|
||||
|
||||
@@ -248,6 +248,11 @@ class ZillionWorld(World):
|
||||
if self.options.priority_dead_ends.value:
|
||||
self.options.priority_locations.value |= {loc.name for loc in dead_end_locations}
|
||||
|
||||
# main location name is an alias
|
||||
main_loc_name = self.zz_system.randomizer.loc_name_2_pretty[self.zz_system.randomizer.locations["main"].name]
|
||||
self.multiworld.get_location(main_loc_name, player).place_locked_item(self.create_item("Win"))
|
||||
self.multiworld.completion_condition[player] = lambda state: state.has("Win", player)
|
||||
|
||||
@override
|
||||
def create_items(self) -> None:
|
||||
if not self.id_to_zz_item:
|
||||
@@ -272,17 +277,6 @@ class ZillionWorld(World):
|
||||
self.logger.debug(f"Zillion Items: {item_name} 1")
|
||||
self.multiworld.itempool.append(self.create_item(item_name))
|
||||
|
||||
@override
|
||||
def generate_basic(self) -> None:
|
||||
assert self.zz_system.randomizer, "generate_early hasn't been called"
|
||||
# main location name is an alias
|
||||
main_loc_name = self.zz_system.randomizer.loc_name_2_pretty[self.zz_system.randomizer.locations["main"].name]
|
||||
|
||||
self.multiworld.get_location(main_loc_name, self.player)\
|
||||
.place_locked_item(self.create_item("Win"))
|
||||
self.multiworld.completion_condition[self.player] = \
|
||||
lambda state: state.has("Win", self.player)
|
||||
|
||||
@staticmethod
|
||||
def stage_generate_basic(multiworld: MultiWorld, *args: Any) -> None: # noqa: ANN401
|
||||
# item link pools are about to be created in main
|
||||
|
||||
Reference in New Issue
Block a user