Compare commits

..

1 Commits

Author SHA1 Message Date
NewSoupVi
5e8af01cca Update options.py 2024-11-24 21:39:53 +01:00
149 changed files with 2487 additions and 5606 deletions

1
.gitattributes vendored
View File

@@ -1,2 +1 @@
worlds/blasphemous/region_data.py linguist-generated=true
worlds/yachtdice/YachtWeights.py linguist-generated=true

View File

@@ -16,7 +16,7 @@
"reportMissingImports": true,
"reportMissingTypeStubs": true,
"pythonVersion": "3.10",
"pythonVersion": "3.8",
"pythonPlatform": "Windows",
"executionEnvironments": [

View File

@@ -53,7 +53,7 @@ jobs:
- uses: actions/setup-python@v5
if: env.diff != ''
with:
python-version: '3.10'
python-version: 3.8
- name: "Install dependencies"
if: env.diff != ''

View File

@@ -24,14 +24,14 @@ env:
jobs:
# build-release-macos: # LF volunteer
build-win: # RCs will still be built and signed by hand
build-win-py38: # RCs will still be built and signed by hand
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.8'
- name: Download run-time dependencies
run: |
Invoke-WebRequest -Uri https://github.com/Ijwu/Enemizer/releases/download/${Env:ENEMIZER_VERSION}/win-x64.zip -OutFile enemizer.zip
@@ -111,10 +111,10 @@ jobs:
- name: Get a recent python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.11'
- name: Install build-time dependencies
run: |
echo "PYTHON=python3.12" >> $GITHUB_ENV
echo "PYTHON=python3.11" >> $GITHUB_ENV
wget -nv https://github.com/AppImage/AppImageKit/releases/download/$APPIMAGETOOL_VERSION/appimagetool-x86_64.AppImage
chmod a+rx appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage --appimage-extract

View File

@@ -44,10 +44,10 @@ jobs:
- name: Get a recent python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.11'
- name: Install build-time dependencies
run: |
echo "PYTHON=python3.12" >> $GITHUB_ENV
echo "PYTHON=python3.11" >> $GITHUB_ENV
wget -nv https://github.com/AppImage/AppImageKit/releases/download/$APPIMAGETOOL_VERSION/appimagetool-x86_64.AppImage
chmod a+rx appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage --appimage-extract

View File

@@ -33,11 +33,13 @@ jobs:
matrix:
os: [ubuntu-latest]
python:
- {version: '3.8'}
- {version: '3.9'}
- {version: '3.10'}
- {version: '3.11'}
- {version: '3.12'}
include:
- python: {version: '3.10'} # old compat
- python: {version: '3.8'} # win7 compat
os: windows-latest
- python: {version: '3.12'} # current
os: windows-latest

View File

@@ -1,16 +1,18 @@
from __future__ import annotations
import collections
import itertools
import functools
import logging
import random
import secrets
import typing # this can go away when Python 3.8 support is dropped
from argparse import Namespace
from collections import Counter, deque
from collections.abc import Collection, MutableSequence
from enum import IntEnum, IntFlag
from typing import (AbstractSet, Any, Callable, ClassVar, Dict, Iterable, Iterator, List, Mapping, NamedTuple,
Optional, Protocol, Set, Tuple, Union, TYPE_CHECKING)
Optional, Protocol, Set, Tuple, Union, Type)
from typing_extensions import NotRequired, TypedDict
@@ -18,7 +20,7 @@ import NetUtils
import Options
import Utils
if TYPE_CHECKING:
if typing.TYPE_CHECKING:
from worlds import AutoWorld
@@ -229,7 +231,7 @@ class MultiWorld():
for player in self.player_ids:
world_type = AutoWorld.AutoWorldRegister.world_types[self.game[player]]
self.worlds[player] = world_type(self, player)
options_dataclass: type[Options.PerGameCommonOptions] = world_type.options_dataclass
options_dataclass: typing.Type[Options.PerGameCommonOptions] = world_type.options_dataclass
self.worlds[player].options = options_dataclass(**{option_key: getattr(args, option_key)[player]
for option_key in options_dataclass.type_hints})
@@ -973,7 +975,7 @@ class Region:
entrances: List[Entrance]
exits: List[Entrance]
locations: List[Location]
entrance_type: ClassVar[type[Entrance]] = Entrance
entrance_type: ClassVar[Type[Entrance]] = Entrance
class Register(MutableSequence):
region_manager: MultiWorld.RegionManager
@@ -1073,7 +1075,7 @@ class Region:
return entrance.parent_region.get_connecting_entrance(is_main_entrance)
def add_locations(self, locations: Dict[str, Optional[int]],
location_type: Optional[type[Location]] = None) -> None:
location_type: Optional[Type[Location]] = None) -> None:
"""
Adds locations to the Region object, where location_type is your Location class and locations is a dict of
location names to address.
@@ -1110,7 +1112,7 @@ class Region:
return exit_
def add_exits(self, exits: Union[Iterable[str], Dict[str, Optional[str]]],
rules: Dict[str, Callable[[CollectionState], bool]] = None) -> List[Entrance]:
rules: Dict[str, Callable[[CollectionState], bool]] = None) -> None:
"""
Connects current region to regions in exit dictionary. Passed region names must exist first.
@@ -1120,14 +1122,10 @@ class Region:
"""
if not isinstance(exits, Dict):
exits = dict.fromkeys(exits)
return [
self.connect(
self.multiworld.get_region(connecting_region, self.player),
name,
rules[connecting_region] if rules and connecting_region in rules else None,
)
for connecting_region, name in exits.items()
]
for connecting_region, name in exits.items():
self.connect(self.multiworld.get_region(connecting_region, self.player),
name,
rules[connecting_region] if rules and connecting_region in rules else None)
def __repr__(self):
return self.multiworld.get_name_string_for_object(self) if self.multiworld else f'{self.name} (Player {self.player})'
@@ -1266,10 +1264,6 @@ class Item:
def trap(self) -> bool:
return ItemClassification.trap in self.classification
@property
def filler(self) -> bool:
return not (self.advancement or self.useful or self.trap)
@property
def excludable(self) -> bool:
return not (self.advancement or self.useful)
@@ -1392,21 +1386,14 @@ class Spoiler:
# second phase, sphere 0
removed_precollected: List[Item] = []
for precollected_items in multiworld.precollected_items.values():
# The list of items is mutated by removing one item at a time to determine if each item is required to beat
# the game, and re-adding that item if it was required, so a copy needs to be made before iterating.
for item in precollected_items.copy():
if not item.advancement:
continue
logging.debug('Checking if %s (Player %d) is required to beat the game.', item.name, item.player)
precollected_items.remove(item)
multiworld.state.remove(item)
if not multiworld.can_beat_game():
# Add the item back into `precollected_items` and collect it into `multiworld.state`.
multiworld.push_precollected(item)
else:
removed_precollected.append(item)
for item in (i for i in chain.from_iterable(multiworld.precollected_items.values()) if i.advancement):
logging.debug('Checking if %s (Player %d) is required to beat the game.', item.name, item.player)
multiworld.precollected_items[item.player].remove(item)
multiworld.state.remove(item)
if not multiworld.can_beat_game():
multiworld.push_precollected(item)
else:
removed_precollected.append(item)
# we are now down to just the required progress items in collection_spheres. Unfortunately
# the previous pruning stage could potentially have made certain items dependant on others
@@ -1545,7 +1532,7 @@ class Spoiler:
[f" {location}: {item}" for (location, item) in sphere.items()] if isinstance(sphere, dict) else
[f" {item}" for item in sphere])) for (sphere_nr, sphere) in self.playthrough.items()]))
if self.unreachables:
outfile.write('\n\nUnreachable Progression Items:\n\n')
outfile.write('\n\nUnreachable Items:\n\n')
outfile.write(
'\n'.join(['%s: %s' % (unreachable.item, unreachable) for unreachable in self.unreachables]))

View File

@@ -23,7 +23,7 @@ if __name__ == "__main__":
from MultiServer import CommandProcessor
from NetUtils import (Endpoint, decode, NetworkItem, encode, JSONtoTextParser, ClientStatus, Permission, NetworkSlot,
RawJSONtoTextParser, add_json_text, add_json_location, add_json_item, JSONTypes, HintStatus, SlotType)
RawJSONtoTextParser, add_json_text, add_json_location, add_json_item, JSONTypes, SlotType)
from Utils import Version, stream_input, async_start
from worlds import network_data_package, AutoWorldRegister
import os
@@ -412,7 +412,6 @@ class CommonContext:
await self.server.socket.close()
if self.server_task is not None:
await self.server_task
self.ui.update_hints()
async def send_msgs(self, msgs: typing.List[typing.Any]) -> None:
""" `msgs` JSON serializable """
@@ -552,14 +551,7 @@ class CommonContext:
await self.ui_task
if self.input_task:
self.input_task.cancel()
# Hints
def update_hint(self, location: int, finding_player: int, status: typing.Optional[HintStatus]) -> None:
msg = {"cmd": "UpdateHint", "location": location, "player": finding_player}
if status is not None:
msg["status"] = status
async_start(self.send_msgs([msg]), name="update_hint")
# DataPackage
async def prepare_data_package(self, relevant_games: typing.Set[str],
remote_date_package_versions: typing.Dict[str, int],

39
Fill.py
View File

@@ -978,32 +978,15 @@ def distribute_planned(multiworld: MultiWorld) -> None:
multiworld.random.shuffle(items)
count = 0
err: typing.List[str] = []
successful_pairs: typing.List[typing.Tuple[int, Item, Location]] = []
claimed_indices: typing.Set[typing.Optional[int]] = set()
successful_pairs: typing.List[typing.Tuple[Item, Location]] = []
for item_name in items:
index_to_delete: typing.Optional[int] = None
if from_pool:
try:
# If from_pool, try to find an existing item with this name & player in the itempool and use it
index_to_delete, item = next(
(i, item) for i, item in enumerate(multiworld.itempool)
if item.player == player and item.name == item_name and i not in claimed_indices
)
except StopIteration:
warn(
f"Could not remove {item_name} from pool for {multiworld.player_name[player]} as it's already missing from it.",
placement['force'])
item = multiworld.worlds[player].create_item(item_name)
else:
item = multiworld.worlds[player].create_item(item_name)
item = multiworld.worlds[player].create_item(item_name)
for location in reversed(candidates):
if (location.address is None) == (item.code is None): # either both None or both not None
if not location.item:
if location.item_rule(item):
if location.can_fill(multiworld.state, item, False):
successful_pairs.append((index_to_delete, item, location))
claimed_indices.add(index_to_delete)
successful_pairs.append((item, location))
candidates.remove(location)
count = count + 1
break
@@ -1015,7 +998,6 @@ def distribute_planned(multiworld: MultiWorld) -> None:
err.append(f"Cannot place {item_name} into already filled location {location}.")
else:
err.append(f"Mismatch between {item_name} and {location}, only one is an event.")
if count == maxcount:
break
if count < placement['count']['min']:
@@ -1023,16 +1005,17 @@ def distribute_planned(multiworld: MultiWorld) -> None:
failed(
f"Plando block failed to place {m - count} of {m} item(s) for {multiworld.player_name[player]}, error(s): {' '.join(err)}",
placement['force'])
# Sort indices in reverse so we can remove them one by one
successful_pairs = sorted(successful_pairs, key=lambda successful_pair: successful_pair[0] or 0, reverse=True)
for (index, item, location) in successful_pairs:
for (item, location) in successful_pairs:
multiworld.push_item(location, item, collect=False)
location.locked = True
logging.debug(f"Plando placed {item} at {location}")
if index is not None: # If this item is from_pool and was found in the pool, remove it.
multiworld.itempool.pop(index)
if from_pool:
try:
multiworld.itempool.remove(item)
except ValueError:
warn(
f"Could not remove {item} from pool for {multiworld.player_name[player]} as it's already missing from it.",
placement['force'])
except Exception as e:
raise Exception(

65
Main.py
View File

@@ -153,38 +153,45 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
# remove starting inventory from pool items.
# Because some worlds don't actually create items during create_items this has to be as late as possible.
fallback_inventory = StartInventoryPool({})
depletion_pool: Dict[int, Dict[str, int]] = {
player: getattr(multiworld.worlds[player].options, "start_inventory_from_pool", fallback_inventory).value.copy()
for player in multiworld.player_ids
}
target_per_player = {
player: sum(target_items.values()) for player, target_items in depletion_pool.items() if target_items
}
if target_per_player:
new_itempool: List[Item] = []
# Make new itempool with start_inventory_from_pool items removed
for item in multiworld.itempool:
if any(getattr(multiworld.worlds[player].options, "start_inventory_from_pool", None) for player in multiworld.player_ids):
new_items: List[Item] = []
old_items: List[Item] = []
depletion_pool: Dict[int, Dict[str, int]] = {
player: getattr(multiworld.worlds[player].options,
"start_inventory_from_pool",
StartInventoryPool({})).value.copy()
for player in multiworld.player_ids
}
for player, items in depletion_pool.items():
player_world: AutoWorld.World = multiworld.worlds[player]
for count in items.values():
for _ in range(count):
new_items.append(player_world.create_filler())
target: int = sum(sum(items.values()) for items in depletion_pool.values())
for i, item in enumerate(multiworld.itempool):
if depletion_pool[item.player].get(item.name, 0):
target -= 1
depletion_pool[item.player][item.name] -= 1
# quick abort if we have found all items
if not target:
old_items.extend(multiworld.itempool[i+1:])
break
else:
new_itempool.append(item)
old_items.append(item)
# Create filler in place of the removed items, warn if any items couldn't be found in the multiworld itempool
for player, target in target_per_player.items():
unfound_items = {item: count for item, count in depletion_pool[player].items() if count}
if unfound_items:
player_name = multiworld.get_player_name(player)
logger.warning(f"{player_name} tried to remove items from their pool that don't exist: {unfound_items}")
needed_items = target_per_player[player] - sum(unfound_items.values())
new_itempool += [multiworld.worlds[player].create_filler() for _ in range(needed_items)]
assert len(multiworld.itempool) == len(new_itempool), "Item Pool amounts should not change."
multiworld.itempool[:] = new_itempool
# leftovers?
if target:
for player, remaining_items in depletion_pool.items():
remaining_items = {name: count for name, count in remaining_items.items() if count}
if remaining_items:
logger.warning(f"{multiworld.get_player_name(player)}"
f" is trying to remove items from their pool that don't exist: {remaining_items}")
# find all filler we generated for the current player and remove until it matches
removables = [item for item in new_items if item.player == player]
for _ in range(sum(remaining_items.values())):
new_items.remove(removables.pop())
assert len(multiworld.itempool) == len(new_items + old_items), "Item Pool amounts should not change."
multiworld.itempool[:] = new_items + old_items
multiworld.link_items()
@@ -269,7 +276,7 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
def precollect_hint(location):
entrance = er_hint_data.get(location.player, {}).get(location.address, "")
hint = NetUtils.Hint(location.item.player, location.player, location.address,
location.item.code, False, entrance, location.item.flags, False)
location.item.code, False, entrance, location.item.flags)
precollected_hints[location.player].add(hint)
if location.item.player not in multiworld.groups:
precollected_hints[location.item.player].add(hint)

View File

@@ -5,8 +5,8 @@ import multiprocessing
import warnings
if sys.version_info < (3, 10, 11):
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.10.11+ is supported.")
if sys.version_info < (3, 8, 6):
raise RuntimeError("Incompatible Python Version. 3.8.7+ is supported.")
# don't run update if environment is frozen/compiled or if not the parent process (skip in subprocess)
_skip_update = bool(getattr(sys, "frozen", False) or multiprocessing.parent_process())

View File

@@ -41,8 +41,7 @@ import NetUtils
import Utils
from Utils import version_tuple, restricted_loads, Version, async_start, get_intended_text
from NetUtils import Endpoint, ClientStatus, NetworkItem, decode, encode, NetworkPlayer, Permission, NetworkSlot, \
SlotType, LocationStore, Hint, HintStatus
from BaseClasses import ItemClassification
SlotType, LocationStore
min_client_version = Version(0, 1, 6)
colorama.init()
@@ -229,7 +228,7 @@ class Context:
self.hint_cost = hint_cost
self.location_check_points = location_check_points
self.hints_used = collections.defaultdict(int)
self.hints: typing.Dict[team_slot, typing.Set[Hint]] = collections.defaultdict(set)
self.hints: typing.Dict[team_slot, typing.Set[NetUtils.Hint]] = collections.defaultdict(set)
self.release_mode: str = release_mode
self.remaining_mode: str = remaining_mode
self.collect_mode: str = collect_mode
@@ -657,29 +656,13 @@ class Context:
return max(1, int(self.hint_cost * 0.01 * len(self.locations[slot])))
return 0
def recheck_hints(self, team: typing.Optional[int] = None, slot: typing.Optional[int] = None,
changed: typing.Optional[typing.Set[team_slot]] = None) -> None:
"""Refreshes the hints for the specified team/slot. Providing 'None' for either team or slot
will refresh all teams or all slots respectively. If a set is passed for 'changed', each (team,slot)
pair that has at least one hint modified will be added to the set.
"""
def recheck_hints(self, team: typing.Optional[int] = None, slot: typing.Optional[int] = None):
for hint_team, hint_slot in self.hints:
if team != hint_team and team is not None:
continue # Check specified team only, all if team is None
if slot != hint_slot and slot is not None:
continue # Check specified slot only, all if slot is None
new_hints: typing.Set[Hint] = set()
for hint in self.hints[hint_team, hint_slot]:
new_hint = hint.re_check(self, hint_team)
new_hints.add(new_hint)
if hint == new_hint:
continue
for player in self.slot_set(hint.receiving_player) | {hint.finding_player}:
if changed is not None:
changed.add((hint_team,player))
if slot is not None and slot != player:
self.replace_hint(hint_team, player, hint, new_hint)
self.hints[hint_team, hint_slot] = new_hints
if (team is None or team == hint_team) and (slot is None or slot == hint_slot):
self.hints[hint_team, hint_slot] = {
hint.re_check(self, hint_team) for hint in
self.hints[hint_team, hint_slot]
}
def get_rechecked_hints(self, team: int, slot: int):
self.recheck_hints(team, slot)
@@ -728,7 +711,7 @@ class Context:
else:
return self.player_names[team, slot]
def notify_hints(self, team: int, hints: typing.List[Hint], only_new: bool = False,
def notify_hints(self, team: int, hints: typing.List[NetUtils.Hint], only_new: bool = False,
recipients: typing.Sequence[int] = None):
"""Send and remember hints."""
if only_new:
@@ -766,17 +749,6 @@ class Context:
for client in clients:
async_start(self.send_msgs(client, client_hints))
def get_hint(self, team: int, finding_player: int, seeked_location: int) -> typing.Optional[Hint]:
for hint in self.hints[team, finding_player]:
if hint.location == seeked_location:
return hint
return None
def replace_hint(self, team: int, slot: int, old_hint: Hint, new_hint: Hint) -> None:
if old_hint in self.hints[team, slot]:
self.hints[team, slot].remove(old_hint)
self.hints[team, slot].add(new_hint)
# "events"
def on_goal_achieved(self, client: Client):
@@ -1078,15 +1050,14 @@ def register_location_checks(ctx: Context, team: int, slot: int, locations: typi
"hint_points": get_slot_points(ctx, team, slot),
"checked_locations": new_locations, # send back new checks only
}])
updated_slots: typing.Set[tuple[int, int]] = set()
ctx.recheck_hints(team, slot, updated_slots)
for hint_team, hint_slot in updated_slots:
ctx.on_changed_hints(hint_team, hint_slot)
old_hints = ctx.hints[team, slot].copy()
ctx.recheck_hints(team, slot)
if old_hints != ctx.hints[team, slot]:
ctx.on_changed_hints(team, slot)
ctx.save()
def collect_hints(ctx: Context, team: int, slot: int, item: typing.Union[int, str], auto_status: HintStatus) \
-> typing.List[Hint]:
def collect_hints(ctx: Context, team: int, slot: int, item: typing.Union[int, str]) -> typing.List[NetUtils.Hint]:
hints = []
slots: typing.Set[int] = {slot}
for group_id, group in ctx.groups.items():
@@ -1096,58 +1067,31 @@ def collect_hints(ctx: Context, team: int, slot: int, item: typing.Union[int, st
seeked_item_id = item if isinstance(item, int) else ctx.item_names_for_game(ctx.games[slot])[item]
for finding_player, location_id, item_id, receiving_player, item_flags \
in ctx.locations.find_item(slots, seeked_item_id):
prev_hint = ctx.get_hint(team, slot, location_id)
if prev_hint:
hints.append(prev_hint)
else:
found = location_id in ctx.location_checks[team, finding_player]
entrance = ctx.er_hint_data.get(finding_player, {}).get(location_id, "")
new_status = auto_status
if found:
new_status = HintStatus.HINT_FOUND
elif item_flags & ItemClassification.trap:
new_status = HintStatus.HINT_AVOID
hints.append(Hint(receiving_player, finding_player, location_id, item_id, found, entrance,
item_flags, new_status))
found = location_id in ctx.location_checks[team, finding_player]
entrance = ctx.er_hint_data.get(finding_player, {}).get(location_id, "")
hints.append(NetUtils.Hint(receiving_player, finding_player, location_id, item_id, found, entrance,
item_flags))
return hints
def collect_hint_location_name(ctx: Context, team: int, slot: int, location: str, auto_status: HintStatus) \
-> typing.List[Hint]:
def collect_hint_location_name(ctx: Context, team: int, slot: int, location: str) -> typing.List[NetUtils.Hint]:
seeked_location: int = ctx.location_names_for_game(ctx.games[slot])[location]
return collect_hint_location_id(ctx, team, slot, seeked_location, auto_status)
return collect_hint_location_id(ctx, team, slot, seeked_location)
def collect_hint_location_id(ctx: Context, team: int, slot: int, seeked_location: int, auto_status: HintStatus) \
-> typing.List[Hint]:
prev_hint = ctx.get_hint(team, slot, seeked_location)
if prev_hint:
return [prev_hint]
def collect_hint_location_id(ctx: Context, team: int, slot: int, seeked_location: int) -> typing.List[NetUtils.Hint]:
result = ctx.locations[slot].get(seeked_location, (None, None, None))
if any(result):
item_id, receiving_player, item_flags = result
found = seeked_location in ctx.location_checks[team, slot]
entrance = ctx.er_hint_data.get(slot, {}).get(seeked_location, "")
new_status = auto_status
if found:
new_status = HintStatus.HINT_FOUND
elif item_flags & ItemClassification.trap:
new_status = HintStatus.HINT_AVOID
return [Hint(receiving_player, slot, seeked_location, item_id, found, entrance, item_flags,
new_status)]
return [NetUtils.Hint(receiving_player, slot, seeked_location, item_id, found, entrance, item_flags)]
return []
status_names: typing.Dict[HintStatus, str] = {
HintStatus.HINT_FOUND: "(found)",
HintStatus.HINT_UNSPECIFIED: "(unspecified)",
HintStatus.HINT_NO_PRIORITY: "(no priority)",
HintStatus.HINT_AVOID: "(avoid)",
HintStatus.HINT_PRIORITY: "(priority)",
}
def format_hint(ctx: Context, team: int, hint: Hint) -> str:
def format_hint(ctx: Context, team: int, hint: NetUtils.Hint) -> str:
text = f"[Hint]: {ctx.player_names[team, hint.receiving_player]}'s " \
f"{ctx.item_names[ctx.slot_info[hint.receiving_player].game][hint.item]} is " \
f"at {ctx.location_names[ctx.slot_info[hint.finding_player].game][hint.location]} " \
@@ -1155,8 +1099,7 @@ def format_hint(ctx: Context, team: int, hint: Hint) -> str:
if hint.entrance:
text += f" at {hint.entrance}"
return text + ". " + status_names.get(hint.status, "(unknown)")
return text + (". (found)" if hint.found else ".")
def json_format_send_event(net_item: NetworkItem, receiving_player: int):
@@ -1560,7 +1503,7 @@ class ClientMessageProcessor(CommonCommandProcessor):
def get_hints(self, input_text: str, for_location: bool = False) -> bool:
points_available = get_client_points(self.ctx, self.client)
cost = self.ctx.get_hint_cost(self.client.slot)
auto_status = HintStatus.HINT_UNSPECIFIED if for_location else HintStatus.HINT_PRIORITY
if not input_text:
hints = {hint.re_check(self.ctx, self.client.team) for hint in
self.ctx.hints[self.client.team, self.client.slot]}
@@ -1586,9 +1529,9 @@ class ClientMessageProcessor(CommonCommandProcessor):
self.output(f"Sorry, \"{hint_name}\" is marked as non-hintable.")
hints = []
elif not for_location:
hints = collect_hints(self.ctx, self.client.team, self.client.slot, hint_id, auto_status)
hints = collect_hints(self.ctx, self.client.team, self.client.slot, hint_id)
else:
hints = collect_hint_location_id(self.ctx, self.client.team, self.client.slot, hint_id, auto_status)
hints = collect_hint_location_id(self.ctx, self.client.team, self.client.slot, hint_id)
else:
game = self.ctx.games[self.client.slot]
@@ -1608,16 +1551,16 @@ class ClientMessageProcessor(CommonCommandProcessor):
hints = []
for item_name in self.ctx.item_name_groups[game][hint_name]:
if item_name in self.ctx.item_names_for_game(game): # ensure item has an ID
hints.extend(collect_hints(self.ctx, self.client.team, self.client.slot, item_name, auto_status))
hints.extend(collect_hints(self.ctx, self.client.team, self.client.slot, item_name))
elif not for_location and hint_name in self.ctx.item_names_for_game(game): # item name
hints = collect_hints(self.ctx, self.client.team, self.client.slot, hint_name, auto_status)
hints = collect_hints(self.ctx, self.client.team, self.client.slot, hint_name)
elif hint_name in self.ctx.location_name_groups[game]: # location group name
hints = []
for loc_name in self.ctx.location_name_groups[game][hint_name]:
if loc_name in self.ctx.location_names_for_game(game):
hints.extend(collect_hint_location_name(self.ctx, self.client.team, self.client.slot, loc_name, auto_status))
hints.extend(collect_hint_location_name(self.ctx, self.client.team, self.client.slot, loc_name))
else: # location name
hints = collect_hint_location_name(self.ctx, self.client.team, self.client.slot, hint_name, auto_status)
hints = collect_hint_location_name(self.ctx, self.client.team, self.client.slot, hint_name)
else:
self.output(response)
@@ -1889,51 +1832,13 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict):
target_item, target_player, flags = ctx.locations[client.slot][location]
if create_as_hint:
hints.extend(collect_hint_location_id(ctx, client.team, client.slot, location,
HintStatus.HINT_UNSPECIFIED))
hints.extend(collect_hint_location_id(ctx, client.team, client.slot, location))
locs.append(NetworkItem(target_item, location, target_player, flags))
ctx.notify_hints(client.team, hints, only_new=create_as_hint == 2)
if locs and create_as_hint:
ctx.save()
await ctx.send_msgs(client, [{'cmd': 'LocationInfo', 'locations': locs}])
elif cmd == 'UpdateHint':
location = args["location"]
player = args["player"]
status = args["status"]
if not isinstance(player, int) or not isinstance(location, int) \
or (status is not None and not isinstance(status, int)):
await ctx.send_msgs(client,
[{'cmd': 'InvalidPacket', "type": "arguments", "text": 'UpdateHint',
"original_cmd": cmd}])
return
hint = ctx.get_hint(client.team, player, location)
if not hint:
return # Ignored safely
if hint.receiving_player != client.slot:
await ctx.send_msgs(client,
[{'cmd': 'InvalidPacket', "type": "arguments", "text": 'UpdateHint: No Permission',
"original_cmd": cmd}])
return
new_hint = hint
if status is None:
return
try:
status = HintStatus(status)
except ValueError:
await ctx.send_msgs(client,
[{'cmd': 'InvalidPacket', "type": "arguments",
"text": 'UpdateHint: Invalid Status', "original_cmd": cmd}])
return
new_hint = new_hint.re_prioritize(ctx, status)
if hint == new_hint:
return
ctx.replace_hint(client.team, hint.finding_player, hint, new_hint)
ctx.replace_hint(client.team, hint.receiving_player, hint, new_hint)
ctx.save()
ctx.on_changed_hints(client.team, hint.finding_player)
ctx.on_changed_hints(client.team, hint.receiving_player)
elif cmd == 'StatusUpdate':
update_client_status(ctx, client, args["status"])
@@ -2238,9 +2143,9 @@ class ServerCommandProcessor(CommonCommandProcessor):
hints = []
for item_name_from_group in self.ctx.item_name_groups[game][item]:
if item_name_from_group in self.ctx.item_names_for_game(game): # ensure item has an ID
hints.extend(collect_hints(self.ctx, team, slot, item_name_from_group, HintStatus.HINT_PRIORITY))
hints.extend(collect_hints(self.ctx, team, slot, item_name_from_group))
else: # item name or id
hints = collect_hints(self.ctx, team, slot, item, HintStatus.HINT_PRIORITY)
hints = collect_hints(self.ctx, team, slot, item)
if hints:
self.ctx.notify_hints(team, hints)
@@ -2274,17 +2179,14 @@ class ServerCommandProcessor(CommonCommandProcessor):
if usable:
if isinstance(location, int):
hints = collect_hint_location_id(self.ctx, team, slot, location,
HintStatus.HINT_UNSPECIFIED)
hints = collect_hint_location_id(self.ctx, team, slot, location)
elif game in self.ctx.location_name_groups and location in self.ctx.location_name_groups[game]:
hints = []
for loc_name_from_group in self.ctx.location_name_groups[game][location]:
if loc_name_from_group in self.ctx.location_names_for_game(game):
hints.extend(collect_hint_location_name(self.ctx, team, slot, loc_name_from_group,
HintStatus.HINT_UNSPECIFIED))
hints.extend(collect_hint_location_name(self.ctx, team, slot, loc_name_from_group))
else:
hints = collect_hint_location_name(self.ctx, team, slot, location,
HintStatus.HINT_UNSPECIFIED)
hints = collect_hint_location_name(self.ctx, team, slot, location)
if hints:
self.ctx.notify_hints(team, hints)
else:

View File

@@ -29,14 +29,6 @@ class ClientStatus(ByValue, enum.IntEnum):
CLIENT_GOAL = 30
class HintStatus(enum.IntEnum):
HINT_FOUND = 0
HINT_UNSPECIFIED = 1
HINT_NO_PRIORITY = 10
HINT_AVOID = 20
HINT_PRIORITY = 30
class SlotType(ByValue, enum.IntFlag):
spectator = 0b00
player = 0b01
@@ -305,20 +297,6 @@ def add_json_location(parts: list, location_id: int, player: int = 0, **kwargs)
parts.append({"text": str(location_id), "player": player, "type": JSONTypes.location_id, **kwargs})
status_names: typing.Dict[HintStatus, str] = {
HintStatus.HINT_FOUND: "(found)",
HintStatus.HINT_UNSPECIFIED: "(unspecified)",
HintStatus.HINT_NO_PRIORITY: "(no priority)",
HintStatus.HINT_AVOID: "(avoid)",
HintStatus.HINT_PRIORITY: "(priority)",
}
status_colors: typing.Dict[HintStatus, str] = {
HintStatus.HINT_FOUND: "green",
HintStatus.HINT_UNSPECIFIED: "white",
HintStatus.HINT_NO_PRIORITY: "slateblue",
HintStatus.HINT_AVOID: "salmon",
HintStatus.HINT_PRIORITY: "plum",
}
class Hint(typing.NamedTuple):
receiving_player: int
finding_player: int
@@ -327,21 +305,14 @@ class Hint(typing.NamedTuple):
found: bool
entrance: str = ""
item_flags: int = 0
status: HintStatus = HintStatus.HINT_UNSPECIFIED
def re_check(self, ctx, team) -> Hint:
if self.found and self.status == HintStatus.HINT_FOUND:
if self.found:
return self
found = self.location in ctx.location_checks[team, self.finding_player]
if found:
return self._replace(found=found, status=HintStatus.HINT_FOUND)
return self
def re_prioritize(self, ctx, status: HintStatus) -> Hint:
if self.found and status != HintStatus.HINT_FOUND:
status = HintStatus.HINT_FOUND
if status != self.status:
return self._replace(status=status)
return Hint(self.receiving_player, self.finding_player, self.location, self.item, found, self.entrance,
self.item_flags)
return self
def __hash__(self):
@@ -363,8 +334,10 @@ class Hint(typing.NamedTuple):
else:
add_json_text(parts, "'s World")
add_json_text(parts, ". ")
add_json_text(parts, status_names.get(self.status, "(unknown)"), type="color",
color=status_colors.get(self.status, "red"))
if self.found:
add_json_text(parts, "(found)", type="color", color="green")
else:
add_json_text(parts, "(not found)", type="color", color="red")
return {"cmd": "PrintJSON", "data": parts, "type": "Hint",
"receiving": self.receiving_player,

View File

@@ -828,10 +828,7 @@ class VerifyKeys(metaclass=FreezeValidKeys):
f"is not a valid location name from {world.game}. "
f"Did you mean '{picks[0][0]}' ({picks[0][1]}% sure)")
def __iter__(self) -> typing.Iterator[typing.Any]:
return self.value.__iter__()
class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys, typing.Mapping[str, typing.Any]):
default = {}
supports_weighting = False

View File

@@ -76,7 +76,6 @@ Currently, the following games are supported:
* Kingdom Hearts 1
* Mega Man 2
* Yacht Dice
* Faxanadu
For setup and instructions check out our [tutorials page](https://archipelago.gg/tutorial/).
Downloads can be found at [Releases](https://github.com/ArchipelagoMW/Archipelago/releases), including compiled

View File

@@ -19,7 +19,8 @@ import warnings
from argparse import Namespace
from settings import Settings, get_settings
from time import sleep
from typing import BinaryIO, Coroutine, Optional, Set, Dict, Any, Union, TypeGuard
from typing import BinaryIO, Coroutine, Optional, Set, Dict, Any, Union
from typing_extensions import TypeGuard
from yaml import load, load_all, dump
try:
@@ -47,7 +48,7 @@ class Version(typing.NamedTuple):
return ".".join(str(item) for item in self)
__version__ = "0.6.0"
__version__ = "0.5.1"
version_tuple = tuplize_version(__version__)
is_linux = sys.platform.startswith("linux")
@@ -421,8 +422,7 @@ class RestrictedUnpickler(pickle.Unpickler):
if module == "builtins" and name in safe_builtins:
return getattr(builtins, name)
# used by MultiServer -> savegame/multidata
if module == "NetUtils" and name in {"NetworkItem", "ClientStatus", "Hint",
"SlotType", "NetworkSlot", "HintStatus"}:
if module == "NetUtils" and name in {"NetworkItem", "ClientStatus", "Hint", "SlotType", "NetworkSlot"}:
return getattr(self.net_utils_module, name)
# Options and Plando are unpickled by WebHost -> Generate
if module == "worlds.generic" and name == "PlandoItem":
@@ -482,7 +482,7 @@ def get_text_after(text: str, start: str) -> str:
return text[text.index(start) + len(start):]
loglevel_mapping: dict[str, int] = {name.lower(): level for name, level in logging.getLevelNamesMapping().items()}
loglevel_mapping = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG}
def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, write_mode: str = "w",
@@ -515,13 +515,10 @@ def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, wri
return self.condition(record)
file_handler.addFilter(Filter("NoStream", lambda record: not getattr(record, "NoFile", False)))
file_handler.addFilter(Filter("NoCarriageReturn", lambda record: '\r' not in record.msg))
root_logger.addHandler(file_handler)
if sys.stdout:
formatter = logging.Formatter(fmt='[%(asctime)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.addFilter(Filter("NoFile", lambda record: not getattr(record, "NoStream", False)))
stream_handler.setFormatter(formatter)
root_logger.addHandler(stream_handler)
# Relay unhandled exceptions to logger.
@@ -858,10 +855,11 @@ def async_start(co: Coroutine[None, None, typing.Any], name: Optional[str] = Non
task.add_done_callback(_faf_tasks.discard)
def deprecate(message: str, add_stacklevels: int = 0):
def deprecate(message: str):
if __debug__:
raise Exception(message)
warnings.warn(message, stacklevel=2 + add_stacklevels)
import warnings
warnings.warn(message)
class DeprecateDict(dict):
@@ -875,9 +873,10 @@ class DeprecateDict(dict):
def __getitem__(self, item: Any) -> Any:
if self.should_error:
deprecate(self.log_message, add_stacklevels=1)
deprecate(self.log_message)
elif __debug__:
warnings.warn(self.log_message, stacklevel=2)
import warnings
warnings.warn(self.log_message)
return super().__getitem__(item)

View File

@@ -17,7 +17,7 @@ from Utils import get_file_safe_name
if typing.TYPE_CHECKING:
from flask import Flask
Utils.local_path.cached_path = os.path.dirname(__file__)
Utils.local_path.cached_path = os.path.dirname(__file__) or "." # py3.8 is not abs. remove "." when dropping 3.8
settings.no_gui = True
configpath = os.path.abspath("config.yaml")
if not os.path.exists(configpath): # fall back to config.yaml in home

View File

@@ -5,7 +5,9 @@ waitress>=3.0.0
Flask-Caching>=2.3.0
Flask-Compress>=1.15
Flask-Limiter>=3.8.0
bokeh>=3.5.2
bokeh>=3.1.1; python_version <= '3.8'
bokeh>=3.4.3; python_version == '3.9'
bokeh>=3.5.2; python_version >= '3.10'
markupsafe>=2.1.5
Markdown>=3.7
mdx-breakless-lists>=1.0.1

View File

@@ -53,7 +53,7 @@
<table class="range-rows" data-option="{{ option_name }}">
<tbody>
{{ RangeRow(option_name, option, option.range_start, option.range_start, True) }}
{% if option.default is number and option.range_start < option.default < option.range_end %}
{% if option.range_start < option.default < option.range_end %}
{{ RangeRow(option_name, option, option.default, option.default, True) }}
{% endif %}
{{ RangeRow(option_name, option, option.range_end, option.range_end, True) }}

View File

@@ -59,7 +59,7 @@
finding_text: "Finding Player"
location_text: "Location"
entrance_text: "Entrance"
status_text: "Status"
found_text: "Found?"
TooltipLabel:
id: receiving
sort_key: 'receiving'
@@ -96,9 +96,9 @@
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: status
sort_key: 'status'
text: root.status_text
id: found
sort_key: 'found'
text: root.found_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}

View File

@@ -55,22 +55,19 @@
/worlds/dlcquest/ @axe-y @agilbert1412
# DOOM 1993
/worlds/doom_1993/ @Daivuk @KScl
/worlds/doom_1993/ @Daivuk
# DOOM II
/worlds/doom_ii/ @Daivuk @KScl
/worlds/doom_ii/ @Daivuk
# Factorio
/worlds/factorio/ @Berserker66
# Faxanadu
/worlds/faxanadu/ @Daivuk
# Final Fantasy Mystic Quest
/worlds/ffmq/ @Alchav @wildham0
# Heretic
/worlds/heretic/ @Daivuk @KScl
/worlds/heretic/ @Daivuk
# Hollow Knight
/worlds/hk/ @BadMagic100 @qwint

View File

@@ -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.8](https://www.python.org/downloads/release/python-380/).
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:

View File

@@ -272,7 +272,6 @@ These packets are sent purely from client to server. They are not accepted by cl
* [Sync](#Sync)
* [LocationChecks](#LocationChecks)
* [LocationScouts](#LocationScouts)
* [UpdateHint](#UpdateHint)
* [StatusUpdate](#StatusUpdate)
* [Say](#Say)
* [GetDataPackage](#GetDataPackage)
@@ -343,29 +342,6 @@ This is useful in cases where an item appears in the game world, such as 'ledge
| locations | list\[int\] | The ids of the locations seen by the client. May contain any number of locations, even ones sent before; duplicates do not cause issues with the Archipelago server. |
| create_as_hint | int | If non-zero, the scouted locations get created and broadcasted as a player-visible hint. <br/>If 2 only new hints are broadcast, however this does not remove them from the LocationInfo reply. |
### UpdateHint
Sent to the server to update the status of a Hint. The client must be the 'receiving_player' of the Hint, or the update fails.
### Arguments
| Name | Type | Notes |
| ---- | ---- | ----- |
| player | int | The ID of the player whose location is being hinted for. |
| location | int | The ID of the location to update the hint for. If no hint exists for this location, the packet is ignored. |
| status | [HintStatus](#HintStatus) | Optional. If included, sets the status of the hint to this status. |
#### HintStatus
An enumeration containing the possible hint states.
```python
import enum
class HintStatus(enum.IntEnum):
HINT_FOUND = 0
HINT_UNSPECIFIED = 1
HINT_NO_PRIORITY = 10
HINT_AVOID = 20
HINT_PRIORITY = 30
```
### StatusUpdate
Sent to the server to update on the sender's status. Examples include readiness or goal completion. (Example: defeated Ganon in A Link to the Past)

View File

@@ -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.15 or newer](https://www.python.org/downloads/), not the Windows Store version
* [Python 3.8.7 or newer](https://www.python.org/downloads/), not the Windows Store version
* Python 3.12.x is currently the newest supported version
* pip: included in downloads from python.org, separate in many Linux distributions
* Matching C compiler

View File

@@ -288,8 +288,8 @@ like entrance randomization in logic.
Regions have a list called `exits`, containing `Entrance` objects representing transitions to other regions.
There must be one special region (Called "Menu" by default, but configurable using [origin_region_name](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/AutoWorld.py#L295-L296)),
from which the logic unfolds. AP assumes that a player will always be able to return to this starting region by resetting the game ("Save and quit").
There must be one special region, "Menu", from which the logic unfolds. AP assumes that a player will always be able to
return to the "Menu" region by resetting the game ("Save and quit").
### Entrances
@@ -328,9 +328,6 @@ Even doing `state.can_reach_location` or `state.can_reach_entrance` is problemat
You can use `multiworld.register_indirect_condition(region, entrance)` to explicitly tell the generator that, when a given region becomes accessible, it is necessary to re-check a specific entrance.
You **must** use `multiworld.register_indirect_condition` if you perform this kind of `can_reach` from an entrance access rule, unless you have a **very** good technical understanding of the relevant code and can reason why it will never lead to problems in your case.
Alternatively, you can set [world.explicit_indirect_conditions = False](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/AutoWorld.py#L298-L301),
avoiding the need for indirect conditions at the expense of performance.
### Item Rules
An item rule is a function that returns `True` or `False` for a `Location` based on a single item. It can be used to
@@ -466,7 +463,7 @@ The world has to provide the following things for generation:
* the properties mentioned above
* additions to the item pool
* additions to the regions list: at least one named after the world class's origin_region_name ("Menu" by default)
* additions to the regions list: at least one called "Menu"
* locations placed inside those regions
* a `def create_item(self, item: str) -> MyGameItem` to create any item on demand
* applying `self.multiworld.push_precollected` for world-defined start inventory
@@ -519,7 +516,7 @@ def generate_early(self) -> None:
```python
def create_regions(self) -> None:
# Add regions to the multiworld. One of them must use the origin_region_name as its name ("Menu" by default).
# Add regions to the multiworld. "Menu" is the required starting point.
# Arguments to Region() are name, player, multiworld, and optionally hint_text
menu_region = Region("Menu", self.player, self.multiworld)
self.multiworld.regions.append(menu_region) # or use += [menu_region...]

101
kvui.py
View File

@@ -12,7 +12,10 @@ if sys.platform == "win32":
# kivy 2.2.0 introduced DPI awareness on Windows, but it makes the UI enter an infinitely recursive re-layout
# by setting the application to not DPI Aware, Windows handles scaling the entire window on its own, ignoring kivy's
ctypes.windll.shcore.SetProcessDpiAwareness(0)
try:
ctypes.windll.shcore.SetProcessDpiAwareness(0)
except FileNotFoundError: # shcore may not be found on <= Windows 7
pass # TODO: remove silent except when Python 3.8 is phased out.
os.environ["KIVY_NO_CONSOLELOG"] = "1"
os.environ["KIVY_NO_FILELOG"] = "1"
@@ -52,7 +55,6 @@ from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.uix.progressbar import ProgressBar
from kivy.uix.dropdown import DropDown
from kivy.utils import escape_markup
from kivy.lang import Builder
from kivy.uix.recycleview.views import RecycleDataViewBehavior
@@ -64,7 +66,7 @@ from kivy.uix.popup import Popup
fade_in_animation = Animation(opacity=0, duration=0) + Animation(opacity=1, duration=0.25)
from NetUtils import JSONtoTextParser, JSONMessagePart, SlotType, HintStatus
from NetUtils import JSONtoTextParser, JSONMessagePart, SlotType
from Utils import async_start, get_input_text_from_response
if typing.TYPE_CHECKING:
@@ -301,11 +303,11 @@ class SelectableLabel(RecycleDataViewBehavior, TooltipLabel):
""" Respond to the selection of items in the view. """
self.selected = is_selected
class HintLabel(RecycleDataViewBehavior, BoxLayout):
selected = BooleanProperty(False)
striped = BooleanProperty(False)
index = None
dropdown: DropDown
def __init__(self):
super(HintLabel, self).__init__()
@@ -314,32 +316,10 @@ class HintLabel(RecycleDataViewBehavior, BoxLayout):
self.finding_text = ""
self.location_text = ""
self.entrance_text = ""
self.status_text = ""
self.hint = {}
self.found_text = ""
for child in self.children:
child.bind(texture_size=self.set_height)
ctx = App.get_running_app().ctx
self.dropdown = DropDown()
def set_value(button):
self.dropdown.select(button.status)
def select(instance, data):
ctx.update_hint(self.hint["location"],
self.hint["finding_player"],
data)
for status in (HintStatus.HINT_NO_PRIORITY, HintStatus.HINT_PRIORITY, HintStatus.HINT_AVOID):
name = status_names[status]
status_button = Button(text=name, size_hint_y=None, height=dp(50))
status_button.status = status
status_button.bind(on_release=set_value)
self.dropdown.add_widget(status_button)
self.dropdown.bind(on_select=select)
def set_height(self, instance, value):
self.height = max([child.texture_size[1] for child in self.children])
@@ -351,8 +331,7 @@ class HintLabel(RecycleDataViewBehavior, BoxLayout):
self.finding_text = data["finding"]["text"]
self.location_text = data["location"]["text"]
self.entrance_text = data["entrance"]["text"]
self.status_text = data["status"]["text"]
self.hint = data["status"]["hint"]
self.found_text = data["found"]["text"]
self.height = self.minimum_height
return super(HintLabel, self).refresh_view_attrs(rv, index, data)
@@ -362,21 +341,13 @@ class HintLabel(RecycleDataViewBehavior, BoxLayout):
return True
if self.index: # skip header
if self.collide_point(*touch.pos):
status_label = self.ids["status"]
if status_label.collide_point(*touch.pos):
if self.hint["status"] == HintStatus.HINT_FOUND:
return
ctx = App.get_running_app().ctx
if ctx.slot == self.hint["receiving_player"]: # If this player owns this hint
# open a dropdown
self.dropdown.open(self.ids["status"])
elif self.selected:
if self.selected:
self.parent.clear_selection()
else:
text = "".join((self.receiving_text, "\'s ", self.item_text, " is at ", self.location_text, " in ",
self.finding_text, "\'s World", (" at " + self.entrance_text)
if self.entrance_text != "Vanilla"
else "", ". (", self.status_text.lower(), ")"))
else "", ". (", self.found_text.lower(), ")"))
temp = MarkupLabel(text).markup
text = "".join(
part for part in temp if not part.startswith(("[color", "[/color]", "[ref=", "[/ref]")))
@@ -390,16 +361,18 @@ class HintLabel(RecycleDataViewBehavior, BoxLayout):
for child in self.children:
if child.collide_point(*touch.pos):
key = child.sort_key
if key == "status":
parent.hint_sorter = lambda element: element["status"]["hint"]["status"]
else: parent.hint_sorter = lambda element: remove_between_brackets.sub("", element[key]["text"]).lower()
parent.hint_sorter = lambda element: remove_between_brackets.sub("", element[key]["text"]).lower()
if key == parent.sort_key:
# second click reverses order
parent.reversed = not parent.reversed
else:
parent.sort_key = key
parent.reversed = False
App.get_running_app().update_hints()
break
else:
logging.warning("Did not find clicked header for sorting.")
App.get_running_app().update_hints()
def apply_selection(self, rv, index, is_selected):
""" Respond to the selection of items in the view. """
@@ -693,7 +666,7 @@ class GameManager(App):
self.energy_link_label.text = f"EL: {Utils.format_SI_prefix(self.ctx.current_energy_link_value)}J"
def update_hints(self):
hints = self.ctx.stored_data.get(f"_read_hints_{self.ctx.team}_{self.ctx.slot}", [])
hints = self.ctx.stored_data[f"_read_hints_{self.ctx.team}_{self.ctx.slot}"]
self.log_panels["Hints"].refresh_hints(hints)
# default F1 keybind, opens a settings menu, that seems to break the layout engine once closed
@@ -749,22 +722,6 @@ class UILog(RecycleView):
element.height = element.texture_size[1]
status_names: typing.Dict[HintStatus, str] = {
HintStatus.HINT_FOUND: "Found",
HintStatus.HINT_UNSPECIFIED: "Unspecified",
HintStatus.HINT_NO_PRIORITY: "No Priority",
HintStatus.HINT_AVOID: "Avoid",
HintStatus.HINT_PRIORITY: "Priority",
}
status_colors: typing.Dict[HintStatus, str] = {
HintStatus.HINT_FOUND: "green",
HintStatus.HINT_UNSPECIFIED: "white",
HintStatus.HINT_NO_PRIORITY: "cyan",
HintStatus.HINT_AVOID: "salmon",
HintStatus.HINT_PRIORITY: "plum",
}
class HintLog(RecycleView):
header = {
"receiving": {"text": "[u]Receiving Player[/u]"},
@@ -772,13 +729,12 @@ class HintLog(RecycleView):
"finding": {"text": "[u]Finding Player[/u]"},
"location": {"text": "[u]Location[/u]"},
"entrance": {"text": "[u]Entrance[/u]"},
"status": {"text": "[u]Status[/u]",
"hint": {"receiving_player": -1, "location": -1, "finding_player": -1, "status": ""}},
"found": {"text": "[u]Status[/u]"},
"striped": True,
}
sort_key: str = ""
reversed: bool = True
reversed: bool = False
def __init__(self, parser):
super(HintLog, self).__init__()
@@ -786,18 +742,8 @@ class HintLog(RecycleView):
self.parser = parser
def refresh_hints(self, hints):
if not hints: # Fix the scrolling looking visually wrong in some edge cases
self.scroll_y = 1.0
data = []
ctx = App.get_running_app().ctx
for hint in hints:
if not hint.get("status"): # Allows connecting to old servers
hint["status"] = HintStatus.HINT_FOUND if hint["found"] else HintStatus.HINT_UNSPECIFIED
hint_status_node = self.parser.handle_node({"type": "color",
"color": status_colors.get(hint["status"], "red"),
"text": status_names.get(hint["status"], "Unknown")})
if hint["status"] != HintStatus.HINT_FOUND and hint["receiving_player"] == ctx.slot:
hint_status_node = f"[u]{hint_status_node}[/u]"
data.append({
"receiving": {"text": self.parser.handle_node({"type": "player_id", "text": hint["receiving_player"]})},
"item": {"text": self.parser.handle_node({
@@ -815,10 +761,9 @@ class HintLog(RecycleView):
"entrance": {"text": self.parser.handle_node({"type": "color" if hint["entrance"] else "text",
"color": "blue", "text": hint["entrance"]
if hint["entrance"] else "Vanilla"})},
"status": {
"text": hint_status_node,
"hint": hint,
},
"found": {
"text": self.parser.handle_node({"type": "color", "color": "green" if hint["found"] else "red",
"text": "Found" if hint["found"] else "Not Found"})},
})
data.sort(key=self.hint_sorter, reverse=self.reversed)
@@ -829,7 +774,7 @@ class HintLog(RecycleView):
@staticmethod
def hint_sorter(element: dict) -> str:
return element["status"]["hint"]["status"] # By status by default
return ""
def fix_heights(self):
"""Workaround fix for divergent texture and layout heights"""

View File

@@ -7,7 +7,6 @@ import os
import os.path
import shutil
import sys
import types
import typing
import warnings
from enum import IntEnum
@@ -163,13 +162,8 @@ class Group:
else:
# assign value, try to upcast to type hint
annotation = self.get_type_hints().get(k, None)
candidates = (
[] if annotation is None else (
typing.get_args(annotation)
if typing.get_origin(annotation) in (Union, types.UnionType)
else [annotation]
)
)
candidates = [] if annotation is None else \
typing.get_args(annotation) if typing.get_origin(annotation) is Union else [annotation]
none_type = type(None)
for cls in candidates:
assert isinstance(cls, type), f"{self.__class__.__name__}.{k}: type {cls} not supported in settings"

View File

@@ -321,7 +321,7 @@ class BuildExeCommand(cx_Freeze.command.build_exe.build_exe):
f"{ex}\nPlease close all AP instances and delete manually.")
# regular cx build
self.buildtime = datetime.datetime.now(datetime.timezone.utc)
self.buildtime = datetime.datetime.utcnow()
super().run()
# manually copy built modules to lib folder. cx_Freeze does not know they exist.
@@ -634,7 +634,7 @@ cx_Freeze.setup(
"excludes": ["numpy", "Cython", "PySide2", "PIL",
"pandas", "zstandard"],
"zip_include_packages": ["*"],
"zip_exclude_packages": ["worlds", "sc2"],
"zip_exclude_packages": ["worlds", "sc2", "orjson"], # TODO: remove orjson here once we drop py3.8 support
"include_files": [], # broken in cx 6.14.0, we use more special sauce now
"include_msvcr": False,
"replace_paths": ["*."],

View File

@@ -80,21 +80,3 @@ class TestBase(unittest.TestCase):
call_all(multiworld, step)
self.assertEqual(created_items, multiworld.itempool,
f"{game_name} modified the itempool during {step}")
def test_locality_not_modified(self):
"""Test that worlds don't modify the locality of items after duplicates are resolved"""
gen_steps = ("generate_early", "create_regions", "create_items")
additional_steps = ("set_rules", "generate_basic", "pre_fill")
worlds_to_test = {game: world for game, world in AutoWorldRegister.world_types.items()}
for game_name, world_type in worlds_to_test.items():
with self.subTest("Game", game=game_name):
multiworld = setup_solo_multiworld(world_type, gen_steps)
local_items = multiworld.worlds[1].options.local_items.value.copy()
non_local_items = multiworld.worlds[1].options.non_local_items.value.copy()
for step in additional_steps:
with self.subTest("step", step=step):
call_all(multiworld, step)
self.assertEqual(local_items, multiworld.worlds[1].options.local_items.value,
f"{game_name} modified local_items during {step}")
self.assertEqual(non_local_items, multiworld.worlds[1].options.non_local_items.value,
f"{game_name} modified non_local_items during {step}")

View File

@@ -1,16 +0,0 @@
from unittest import TestCase
from settings import Group
from worlds.AutoWorld import AutoWorldRegister
class TestSettings(TestCase):
def test_settings_can_update(self) -> None:
"""
Test that world settings can update.
"""
for game_name, world_type in AutoWorldRegister.world_types.items():
with self.subTest(game=game_name):
if world_type.settings is not None:
assert isinstance(world_type.settings, Group)
world_type.settings.update({}) # a previous bug had a crash in this call to update

View File

@@ -2,7 +2,9 @@
from __future__ import annotations
import abc
import logging
from typing import TYPE_CHECKING, ClassVar, Dict, Iterable, Tuple, Any, Optional, Union, TypeGuard
from typing import TYPE_CHECKING, ClassVar, Dict, Iterable, Tuple, Any, Optional, Union
from typing_extensions import TypeGuard
from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components

View File

@@ -33,10 +33,7 @@ class AutoWorldRegister(type):
# lazy loading + caching to minimize runtime cost
if cls.__settings is None:
from settings import get_settings
try:
cls.__settings = get_settings()[cls.settings_key]
except AttributeError:
return None
cls.__settings = get_settings()[cls.settings_key]
return cls.__settings
def __new__(mcs, name: str, bases: Tuple[type, ...], dct: Dict[str, Any]) -> AutoWorldRegister:

View File

@@ -103,7 +103,7 @@ def _install_apworld(apworld_src: str = "") -> Optional[Tuple[pathlib.Path, path
try:
import zipfile
zip = zipfile.ZipFile(apworld_path)
directories = [f.name for f in zipfile.Path(zip).iterdir() if f.is_dir()]
directories = [f.filename.strip('/') for f in zip.filelist if f.CRC == 0 and f.file_size == 0 and f.filename.count('/') == 1]
if len(directories) == 1 and directories[0] in apworld_path.stem:
module_name = directories[0]
apworld_name = module_name + ".apworld"

View File

@@ -66,12 +66,19 @@ class WorldSource:
start = time.perf_counter()
if self.is_zip:
importer = zipimport.zipimporter(self.resolved_path)
spec = importer.find_spec(os.path.basename(self.path).rsplit(".", 1)[0])
assert spec, f"{self.path} is not a loadable module"
mod = importlib.util.module_from_spec(spec)
mod.__package__ = f"worlds.{mod.__package__}"
if hasattr(importer, "find_spec"): # new in Python 3.10
spec = importer.find_spec(os.path.basename(self.path).rsplit(".", 1)[0])
assert spec, f"{self.path} is not a loadable module"
mod = importlib.util.module_from_spec(spec)
else: # TODO: remove with 3.8 support
mod = importer.load_module(os.path.basename(self.path).rsplit(".", 1)[0])
if mod.__package__ is not None:
mod.__package__ = f"worlds.{mod.__package__}"
else:
# load_module does not populate package, we'll have to assume mod.__name__ is correct here
# probably safe to remove with 3.8 support
mod.__package__ = f"worlds.{mod.__name__}"
mod.__name__ = f"worlds.{mod.__name__}"
sys.modules[mod.__name__] = mod
with warnings.catch_warnings():

View File

@@ -1,7 +1,7 @@
from dataclasses import dataclass
import typing
from BaseClasses import MultiWorld
from Options import Choice, Range, DeathLink, DefaultOnToggle, FreeText, ItemsAccessibility, PerGameCommonOptions, \
from Options import Choice, Range, DeathLink, DefaultOnToggle, FreeText, ItemsAccessibility, Option, \
PlandoBosses, PlandoConnections, PlandoTexts, Removed, StartInventoryPool, Toggle
from .EntranceShuffle import default_connections, default_dungeon_connections, \
inverted_default_connections, inverted_default_dungeon_connections
@@ -742,86 +742,86 @@ class ALttPPlandoTexts(PlandoTexts):
valid_keys = TextTable.valid_keys
@dataclass
class ALTTPOptions(PerGameCommonOptions):
accessibility: ItemsAccessibility
plando_connections: ALttPPlandoConnections
plando_texts: ALttPPlandoTexts
start_inventory_from_pool: StartInventoryPool
goal: Goal
mode: Mode
glitches_required: GlitchesRequired
dark_room_logic: DarkRoomLogic
open_pyramid: OpenPyramid
crystals_needed_for_gt: CrystalsTower
crystals_needed_for_ganon: CrystalsGanon
triforce_pieces_mode: TriforcePiecesMode
triforce_pieces_percentage: TriforcePiecesPercentage
triforce_pieces_required: TriforcePiecesRequired
triforce_pieces_available: TriforcePiecesAvailable
triforce_pieces_extra: TriforcePiecesExtra
entrance_shuffle: EntranceShuffle
entrance_shuffle_seed: EntranceShuffleSeed
big_key_shuffle: big_key_shuffle
small_key_shuffle: small_key_shuffle
key_drop_shuffle: key_drop_shuffle
compass_shuffle: compass_shuffle
map_shuffle: map_shuffle
restrict_dungeon_item_on_boss: RestrictBossItem
item_pool: ItemPool
item_functionality: ItemFunctionality
enemy_health: EnemyHealth
enemy_damage: EnemyDamage
progressive: Progressive
swordless: Swordless
dungeon_counters: DungeonCounters
retro_bow: RetroBow
retro_caves: RetroCaves
hints: Hints
scams: Scams
boss_shuffle: LTTPBosses
pot_shuffle: PotShuffle
enemy_shuffle: EnemyShuffle
killable_thieves: KillableThieves
bush_shuffle: BushShuffle
shop_item_slots: ShopItemSlots
randomize_shop_inventories: RandomizeShopInventories
shuffle_shop_inventories: ShuffleShopInventories
include_witch_hut: IncludeWitchHut
randomize_shop_prices: RandomizeShopPrices
randomize_cost_types: RandomizeCostTypes
shop_price_modifier: ShopPriceModifier
shuffle_capacity_upgrades: ShuffleCapacityUpgrades
bombless_start: BomblessStart
shuffle_prizes: ShufflePrizes
tile_shuffle: TileShuffle
misery_mire_medallion: MiseryMireMedallion
turtle_rock_medallion: TurtleRockMedallion
glitch_boots: GlitchBoots
beemizer_total_chance: BeemizerTotalChance
beemizer_trap_chance: BeemizerTrapChance
timer: Timer
countdown_start_time: CountdownStartTime
red_clock_time: RedClockTime
blue_clock_time: BlueClockTime
green_clock_time: GreenClockTime
death_link: DeathLink
allow_collect: AllowCollect
ow_palettes: OWPalette
uw_palettes: UWPalette
hud_palettes: HUDPalette
sword_palettes: SwordPalette
shield_palettes: ShieldPalette
# link_palettes: LinkPalette
heartbeep: HeartBeep
heartcolor: HeartColor
quickswap: QuickSwap
menuspeed: MenuSpeed
music: Music
reduceflashing: ReduceFlashing
triforcehud: TriforceHud
alttp_options: typing.Dict[str, type(Option)] = {
"accessibility": ItemsAccessibility,
"plando_connections": ALttPPlandoConnections,
"plando_texts": ALttPPlandoTexts,
"start_inventory_from_pool": StartInventoryPool,
"goal": Goal,
"mode": Mode,
"glitches_required": GlitchesRequired,
"dark_room_logic": DarkRoomLogic,
"open_pyramid": OpenPyramid,
"crystals_needed_for_gt": CrystalsTower,
"crystals_needed_for_ganon": CrystalsGanon,
"triforce_pieces_mode": TriforcePiecesMode,
"triforce_pieces_percentage": TriforcePiecesPercentage,
"triforce_pieces_required": TriforcePiecesRequired,
"triforce_pieces_available": TriforcePiecesAvailable,
"triforce_pieces_extra": TriforcePiecesExtra,
"entrance_shuffle": EntranceShuffle,
"entrance_shuffle_seed": EntranceShuffleSeed,
"big_key_shuffle": big_key_shuffle,
"small_key_shuffle": small_key_shuffle,
"key_drop_shuffle": key_drop_shuffle,
"compass_shuffle": compass_shuffle,
"map_shuffle": map_shuffle,
"restrict_dungeon_item_on_boss": RestrictBossItem,
"item_pool": ItemPool,
"item_functionality": ItemFunctionality,
"enemy_health": EnemyHealth,
"enemy_damage": EnemyDamage,
"progressive": Progressive,
"swordless": Swordless,
"dungeon_counters": DungeonCounters,
"retro_bow": RetroBow,
"retro_caves": RetroCaves,
"hints": Hints,
"scams": Scams,
"boss_shuffle": LTTPBosses,
"pot_shuffle": PotShuffle,
"enemy_shuffle": EnemyShuffle,
"killable_thieves": KillableThieves,
"bush_shuffle": BushShuffle,
"shop_item_slots": ShopItemSlots,
"randomize_shop_inventories": RandomizeShopInventories,
"shuffle_shop_inventories": ShuffleShopInventories,
"include_witch_hut": IncludeWitchHut,
"randomize_shop_prices": RandomizeShopPrices,
"randomize_cost_types": RandomizeCostTypes,
"shop_price_modifier": ShopPriceModifier,
"shuffle_capacity_upgrades": ShuffleCapacityUpgrades,
"bombless_start": BomblessStart,
"shuffle_prizes": ShufflePrizes,
"tile_shuffle": TileShuffle,
"misery_mire_medallion": MiseryMireMedallion,
"turtle_rock_medallion": TurtleRockMedallion,
"glitch_boots": GlitchBoots,
"beemizer_total_chance": BeemizerTotalChance,
"beemizer_trap_chance": BeemizerTrapChance,
"timer": Timer,
"countdown_start_time": CountdownStartTime,
"red_clock_time": RedClockTime,
"blue_clock_time": BlueClockTime,
"green_clock_time": GreenClockTime,
"death_link": DeathLink,
"allow_collect": AllowCollect,
"ow_palettes": OWPalette,
"uw_palettes": UWPalette,
"hud_palettes": HUDPalette,
"sword_palettes": SwordPalette,
"shield_palettes": ShieldPalette,
# "link_palettes": LinkPalette,
"heartbeep": HeartBeep,
"heartcolor": HeartColor,
"quickswap": QuickSwap,
"menuspeed": MenuSpeed,
"music": Music,
"reduceflashing": ReduceFlashing,
"triforcehud": TriforceHud,
# removed:
goals: Removed
smallkey_shuffle: Removed
bigkey_shuffle: Removed
"goals": Removed,
"smallkey_shuffle": Removed,
"bigkey_shuffle": Removed,
}

View File

@@ -782,8 +782,8 @@ def get_nonnative_item_sprite(code: int) -> int:
def patch_rom(world: MultiWorld, rom: LocalRom, player: int, enemized: bool):
local_random = world.per_slot_randoms[player]
local_world = world.worlds[player]
local_random = local_world.random
# patch items
@@ -1867,7 +1867,7 @@ def apply_oof_sfx(rom, oof: str):
def apply_rom_settings(rom, beep, color, quickswap, menuspeed, music: bool, sprite: str, oof: str, palettes_options,
world=None, player=1, allow_random_on_event=False, reduceflashing=False,
triforcehud: str = None, deathlink: bool = False, allowcollect: bool = False):
local_random = random if not world else world.worlds[player].random
local_random = random if not world else world.per_slot_randoms[player]
disable_music: bool = not music
# enable instant item menu
if menuspeed == 'instant':
@@ -2197,9 +2197,8 @@ def write_string_to_rom(rom, target, string):
def write_strings(rom, world, player):
from . import ALTTPWorld
local_random = world.per_slot_randoms[player]
w: ALTTPWorld = world.worlds[player]
local_random = w.random
tt = TextTable()
tt.removeUnwantedText()
@@ -2426,7 +2425,7 @@ def write_strings(rom, world, player):
if world.worlds[player].has_progressive_bows and (w.difficulty_requirements.progressive_bow_limit >= 2 or (
world.swordless[player] or world.glitches_required[player] == 'no_glitches')):
prog_bow_locs = world.find_item_locations('Progressive Bow', player, True)
local_random.shuffle(prog_bow_locs)
world.per_slot_randoms[player].shuffle(prog_bow_locs)
found_bow = False
found_bow_alt = False
while prog_bow_locs and not (found_bow and found_bow_alt):

View File

@@ -1,27 +1,28 @@
import logging
import os
import random
import settings
import threading
import typing
import settings
import Utils
from BaseClasses import Item, CollectionState, Tutorial, MultiWorld
from worlds.AutoWorld import World, WebWorld, LogicMixin
from .Client import ALTTPSNIClient
from .Dungeons import create_dungeons, Dungeon
from .EntranceShuffle import link_entrances, link_inverted_entrances, plando_connect
from .InvertedRegions import create_inverted_regions, mark_dark_world_regions
from .ItemPool import generate_itempool, difficulties
from .Items import item_init_table, item_name_groups, item_table, GetBeemizerItem
from .Options import ALTTPOptions, small_key_shuffle
from .Options import alttp_options, small_key_shuffle
from .Regions import lookup_name_to_id, create_regions, mark_light_world_regions, lookup_vanilla_location_to_entrance, \
is_main_entrance, key_drop_data
from .Client import ALTTPSNIClient
from .Rom import LocalRom, patch_rom, patch_race_rom, check_enemizer, patch_enemizer, apply_rom_settings, \
get_hash_string, get_base_rom_path, LttPDeltaPatch
from .Rules import set_rules
from .Shops import create_shops, Shop, push_shop_inventories, ShopType, price_rate_display, price_type_display_name
from .StateHelpers import can_buy_unlimited
from .SubClasses import ALttPItem, LTTPRegionType
from worlds.AutoWorld import World, WebWorld, LogicMixin
from .StateHelpers import can_buy_unlimited
lttp_logger = logging.getLogger("A Link to the Past")
@@ -131,8 +132,7 @@ class ALTTPWorld(World):
Ganon!
"""
game = "A Link to the Past"
options_dataclass = ALTTPOptions
options: ALTTPOptions
option_definitions = alttp_options
settings_key = "lttp_options"
settings: typing.ClassVar[ALTTPSettings]
topology_present = True
@@ -286,22 +286,13 @@ class ALTTPWorld(World):
if not os.path.exists(rom_file):
raise FileNotFoundError(rom_file)
if multiworld.is_race:
import xxtea # noqa
import xxtea
for player in multiworld.get_game_players(cls.game):
if multiworld.worlds[player].use_enemizer:
check_enemizer(multiworld.worlds[player].enemizer_path)
break
def generate_early(self):
# write old options
import dataclasses
is_first = self.player == min(self.multiworld.get_game_players(self.game))
for field in dataclasses.fields(self.options_dataclass):
if is_first:
setattr(self.multiworld, field.name, {})
getattr(self.multiworld, field.name)[self.player] = getattr(self.options, field.name)
# end of old options re-establisher
player = self.player
multiworld = self.multiworld
@@ -545,10 +536,12 @@ class ALTTPWorld(World):
@property
def use_enemizer(self) -> bool:
return bool(self.options.boss_shuffle or self.options.enemy_shuffle
or self.options.enemy_health != 'default' or self.options.enemy_damage != 'default'
or self.options.pot_shuffle or self.options.bush_shuffle
or self.options.killable_thieves)
world = self.multiworld
player = self.player
return bool(world.boss_shuffle[player] or world.enemy_shuffle[player]
or world.enemy_health[player] != 'default' or world.enemy_damage[player] != 'default'
or world.pot_shuffle[player] or world.bush_shuffle[player]
or world.killable_thieves[player])
def generate_output(self, output_directory: str):
multiworld = self.multiworld

View File

@@ -1,32 +0,0 @@
# A Link to the Past
## Où se trouve la page des paramètres ?
La [page des paramètres du joueur pour ce jeu](../player-options) contient tous les paramètres dont vous avez besoin
pour configurer et exporter le fichier.
## Quel est l'effet de la randomisation sur ce jeu ?
Les objets que le joueur devrait normalement obtenir au cours du jeu ont été déplacés. Il y a tout de même une logique
pour que le jeu puisse être terminé, mais dû au mélange des objets, le joueur peut avoir besoin d'accéder à certaines
zones plus tôt que dans le jeu original.
## Quels sont les objets et endroits mélangés ?
Tous les objets principaux, les collectibles et munitions peuvent être mélangés, et tous les endroits qui
pourraient contenir un de ces objets peuvent avoir leur contenu modifié.
## Quels objets peuvent être dans le monde d'un autre joueur ?
Un objet pouvant être mélangé peut être aussi placé dans le monde d'un autre joueur. Il est possible de limiter certains
objets à votre propre monde.
## À quoi ressemble un objet d'un autre monde dans LttP ?
Les objets appartenant à d'autres mondes sont représentés par une Étoile de Super Mario World.
## Quand le joueur reçoit un objet, que ce passe-t-il ?
Quand le joueur reçoit un objet, Link montrera l'objet au monde en le mettant au-dessus de sa tête. C'est bon pour
les affaires !

View File

@@ -1,28 +1,41 @@
# Guide d'installation du MultiWorld de A Link to the Past Randomizer
<div id="tutorial-video-container">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/mJKEHaiyR_Y" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
</iframe>
</div>
## Logiciels requis
- [Archipelago](https://github.com/ArchipelagoMW/Archipelago/releases).
- [SNI](https://github.com/alttpo/sni/releases). Inclus avec l'installation d'Archipelago ci-dessus.
- SNI n'est pas compatible avec (Q)Usb2Snes.
- [Archipelago](https://github.com/ArchipelagoMW/Archipelago/releases)
- [QUsb2Snes](https://github.com/Skarsnik/QUsb2snes/releases) (Inclus dans les utilitaires précédents)
- Une solution logicielle ou matérielle capable de charger et de lancer des fichiers ROM de SNES
- Un émulateur capable de se connecter à SNI
[snes9x-nwa](https://github.com/Skarsnik/snes9x-emunwa/releases), ([snes9x rr](https://github.com/gocha/snes9x-rr/releases),
[BSNES-plus](https://github.com/black-sliver/bsnes-plus),
[BizHawk](https://tasvideos.org/BizHawk), ou
[RetroArch](https://retroarch.com?page=platforms) 1.10.1 ou plus récent). Ou,
- Un SD2SNES, [FXPak Pro](https://krikzz.com/store/home/54-fxpak-pro.html), ou une autre solution matérielle compatible. **À noter:
les SNES minis ne sont pas encore supportés par SNI. Certains utilisateurs rapportent avoir du succès avec QUsb2Snes pour ce système,
mais ce n'est pas supporté.**
- Le fichier ROM de la v1.0 japonaise, habituellement nommé `Zelda no Densetsu - Kamigami no Triforce (Japan).sfc`
- Un émulateur capable d'éxécuter des scripts Lua
([snes9x rr](https://github.com/gocha/snes9x-rr/releases),
[BizHawk](https://tasvideos.org/BizHawk))
- Un SD2SNES, [FXPak Pro](https://krikzz.com/store/home/54-fxpak-pro.html), ou une autre solution matérielle
compatible
- Le fichier ROM de la v1.0 japonaise, sûrement nommé `Zelda no Densetsu - Kamigami no Triforce (Japan).sfc`
## Procédure d'installation
1. Téléchargez et installez [Archipelago](https://github.com/ArchipelagoMW/Archipelago/releases). **L'installateur se situe dans la section "assets" en bas des informations de version**.
2. Si c'est la première fois que vous faites une génération locale ou un patch, il vous sera demandé votre fichier ROM de base. Il s'agit de votre fichier ROM Link to the Past japonais. Cet étape n'a besoin d'être faite qu'une seule fois.
### Installation sur Windows
3. Si vous utilisez un émulateur, il est recommandé d'assigner votre émulateur capable d'éxécuter des scripts Lua comme
1. Téléchargez et installez les utilitaires du MultiWorld à l'aide du lien au-dessus, faites attention à bien installer
la version la plus récente.
**Le fichier se situe dans la section "assets" en bas des informations de version**. Si vous voulez jouer des parties
classiques de multiworld, téléchargez `Setup.BerserkerMultiWorld.exe`
- Si vous voulez jouer à la version alternative avec le mélangeur de portes dans les donjons, vous téléchargez le
fichier
`Setup.BerserkerMultiWorld.Doors.exe`.
- Durant le processus d'installation, il vous sera demandé de localiser votre ROM v1.0 japonaise. Si vous avez déjà
installé le logiciel auparavant et qu'il s'agit simplement d'une mise à jour, la localisation de la ROM originale
ne sera pas requise.
- Il vous sera peut-être également demandé d'installer Microsoft Visual C++. Si vous le possédez déjà (possiblement
parce qu'un jeu Steam l'a déjà installé), l'installateur ne reproposera pas de l'installer.
2. Si vous utilisez un émulateur, il est recommandé d'assigner votre émulateur capable d'éxécuter des scripts Lua comme
programme par défaut pour ouvrir vos ROMs.
1. Extrayez votre dossier d'émulateur sur votre Bureau, ou à un endroit dont vous vous souviendrez.
2. Faites un clic droit sur un fichier ROM et sélectionnez **Ouvrir avec...**
@@ -31,6 +44,58 @@
5. Naviguez dans les dossiers jusqu'au fichier `.exe` de votre émulateur et choisissez **Ouvrir**. Ce fichier
devrait se trouver dans le dossier que vous avez extrait à la première étape.
### Installation sur Mac
- Des volontaires sont recherchés pour remplir cette section ! Contactez **Farrak Kilhn** sur Discord si vous voulez
aider.
## Configurer son fichier YAML
### Qu'est-ce qu'un fichier YAML et pourquoi en ai-je besoin ?
Votre fichier YAML contient un ensemble d'options de configuration qui fournissent au générateur des informations sur
comment il devrait générer votre seed. Chaque joueur d'un multiwolrd devra fournir son propre fichier YAML. Cela permet
à chaque joueur d'apprécier une expérience customisée selon ses goûts, et les différents joueurs d'un même multiworld
peuvent avoir différentes options.
### Où est-ce que j'obtiens un fichier YAML ?
La page [Génération de partie](/games/A%20Link%20to%20the%20Past/player-options) vous permet de configurer vos
paramètres personnels et de les exporter vers un fichier YAML.
### Configuration avancée du fichier YAML
Une version plus avancée du fichier YAML peut être créée en utilisant la page
des [paramètres de pondération](/games/A Link to the Past/weighted-options), qui vous permet de configurer jusqu'à
trois préréglages. Cette page a de nombreuses options qui sont essentiellement représentées avec des curseurs
glissants. Cela vous permet de choisir quelles sont les chances qu'une certaine option apparaisse par rapport aux
autres disponibles dans une même catégorie.
Par exemple, imaginez que le générateur crée un seau étiqueté "Mélange des cartes", et qu'il place un morceau de papier
pour chaque sous-option. Imaginez également que la valeur pour "On" est 20 et la valeur pour "Off" est 40.
Dans cet exemple, il y a soixante morceaux de papier dans le seau : vingt pour "On" et quarante pour "Off". Quand le
générateur décide s'il doit oui ou non activer le mélange des cartes pour votre partie, , il tire aléatoirement un
papier dans le seau. Dans cet exemple, il y a de plus grandes chances d'avoir le mélange de cartes désactivé.
S'il y a une option dont vous ne voulez jamais, mettez simplement sa valeur à zéro. N'oubliez pas qu'il faut que pour
chaque paramètre il faut au moins une option qui soit paramétrée sur un nombre strictement positif.
### Vérifier son fichier YAML
Si vous voulez valider votre fichier YAML pour être sûr qu'il fonctionne, vous pouvez le vérifier sur la page du
[Validateur de YAML](/check).
## Générer une partie pour un joueur
1. Aller sur la page [Génération de partie](/games/A%20Link%20to%20the%20Past/player-options), configurez vos options,
et cliquez sur le bouton "Generate Game".
2. Il vous sera alors présenté une page d'informations sur la seed, où vous pourrez télécharger votre patch.
3. Double-cliquez sur le patch et l'émulateur devrait se lancer automatiquement avec la seed. Etant donné que le client
n'est pas requis pour les parties à un joueur, vous pouvez le fermer ainsi que l'interface Web (WebUI).
## Rejoindre un MultiWorld
### Obtenir son patch et créer sa ROM
Quand vous rejoignez un multiworld, il vous sera demandé de fournir votre fichier YAML à celui qui héberge la partie ou
@@ -44,58 +109,35 @@ automatiquement le client, et devrait créer la ROM dans le même dossier que vo
#### Avec un émulateur
Quand le client se lance automatiquement, SNI devrait se lancer automatiquement également en arrière-plan. Si
Quand le client se lance automatiquement, QUsb2Snes devrait se lancer automatiquement également en arrière-plan. Si
c'est la première fois qu'il démarre, il vous sera peut-être demandé de l'autoriser à communiquer à travers le pare-feu
Windows.
#### snes9x-nwa
1. Cliquez sur 'Network Menu' et cochez **Enable Emu Network Control**
2. Chargez votre ROM si ce n'est pas déjà fait.
##### snes9x-rr
1. Chargez votre ROM si ce n'est pas déjà fait.
2. Cliquez sur le menu "File" et survolez l'option **Lua Scripting**
3. Cliquez alors sur **New Lua Script Window...**
4. Dans la nouvelle fenêtre, sélectionnez **Browse...**
5. Sélectionnez le fichier lua connecteur inclus avec votre client
- Recherchez `/SNI/lua/` dans votre fichier Archipelago.
6. Si vous avez une erreur en chargeant le script indiquant `socket.dll missing` ou similaire, naviguez vers le fichier du
lua que vous utilisez dans votre explorateur de fichiers et copiez le `socket.dll` à la base de votre installation snes9x.
#### BSNES-Plus
1. Chargez votre ROM si ce n'est pas déjà fait.
2. L'émulateur devrait automatiquement se connecter lorsque SNI se lancera.
5. Dirigez vous vers le dossier où vous avez extrait snes9x-rr, allez dans le dossier `lua`, puis
choisissez `multibridge.lua`
6. Remarquez qu'un nom vous a été assigné, et que l'interface Web affiche "SNES Device: Connected", avec ce même nom
dans le coin en haut à gauche.
##### BizHawk
1. Assurez vous d'avoir le cœur BSNES chargé. Cela est possible en cliquant sur le menu "Tools" de BizHawk et suivant
1. Assurez vous d'avoir le coeur BSNES chargé. Cela est possible en cliquant sur le menu "Tools" de BizHawk et suivant
ces options de menu :
- (≤ 2.8) `Config``Cores``SNES``BSNES`
- (≥ 2.9) `Config``Preferred Cores``SNES``BSNESv115+`
Une fois le cœur changé, rechargez le avec Ctrl+R (par défaut).
`Config --> Cores --> SNES --> BSNES`
Une fois le coeur changé, vous devez redémarrer BizHawk.
2. Chargez votre ROM si ce n'est pas déjà fait.
3. Glissez et déposez le fichier `Connector.lua` que vous avez téléchargé ci-dessus sur la fenêtre principale EmuHawk.
- Recherchez `/SNI/lua/` dans votre fichier Archipelago.
- Vous pouvez aussi ouvrir la console Lua manuellement, cliquez sur `Script``Open Script`, et naviguez sur `Connecteur.lua`
avec le sélecteur de fichiers.
##### RetroArch 1.10.1 ou plus récent
Vous n'avez qu'à faire ces étapes qu'une fois.
1. Entrez dans le menu principal RetroArch
2. Allez dans Réglages --> Interface utilisateur. Mettez "Afficher les réglages avancés" sur ON.
3. Allez dans Réglages --> Réseau. Mettez "Commandes Réseau" sur ON. (trouvé sous Request Device 16.) Laissez le
Port des commandes réseau à 555355.
![Screenshot of Network Commands setting](/static/generated/docs/A%20Link%20to%20the%20Past/retroarch-network-commands-fr.png)
4. Allez dans Menu Principal --> Mise à jour en ligne --> Téléchargement de cœurs. Descendez jusqu'a"Nintendo - SNES / SFC (bsnes-mercury Performance)" et
sélectionnez le.
Quand vous chargez une ROM, veillez a sélectionner un cœur **bsnes-mercury**. Ce sont les seuls cœurs qui autorisent les outils externs à lire les données d'une ROM.
3. Cliquez sur le menu "Tools" et cliquez sur **Lua Console**
4. Cliquez sur le bouton pour ouvrir un nouveau script Lua.
5. Dirigez vous vers le dossier d'installation des utilitaires du MultiWorld, puis dans les dossiers suivants :
`QUsb2Snes/Qusb2Snes/LuaBridge`
6. Sélectionnez `luabridge.lua` et cliquez sur "Open".
7. Remarquez qu'un nom vous a été assigné, et que l'interface Web affiche "SNES Device: Connected", avec ce même nom
dans le coin en haut à gauche.
#### Avec une solution matérielle
@@ -105,7 +147,10 @@ le maintenant. Les utilisateurs de SD2SNES et de FXPak Pro peuvent télécharger
[sur cette page](http://usb2snes.com/#supported-platforms).
1. Fermez votre émulateur, qui s'est potentiellement lancé automatiquement.
2. Lancez votre console et chargez la ROM.
2. Fermez QUsb2Snes, qui s'est lancé automatiquement avec le client.
3. Lancez la version appropriée de QUsb2Snes (v0.7.16).
4. Lancer votre console et chargez la ROM.
5. Remarquez que l'interface Web affiche "SNES Device: Connected", avec le nom de votre appareil.
### Se connecter au MultiServer
@@ -120,6 +165,47 @@ l'interface Web.
### Jouer au jeu
Une fois que l'interface Web affiche que la SNES et le serveur sont connectés, vous êtes prêt à jouer. Félicitations,
vous venez de rejoindre un multiworld ! Vous pouvez exécuter différentes commandes dans votre client. Pour plus d'informations
sur ces commandes, vous pouvez utiliser `/help` pour les commandes locales et `!help` pour les commandes serveur.
Une fois que l'interface Web affiche que la SNES et le serveur sont connectés, vous êtes prêt à jouer. Félicitations
pour avoir rejoint un multiworld !
## Héberger un MultiWorld
La méthode recommandée pour héberger une partie est d'utiliser le service d'hébergement fourni par
[le site](https://berserkermulti.world/generate). Le processus est relativement simple :
1. Récupérez les fichiers YAML des joueurs.
2. Créez une archive zip contenant ces fichiers YAML.
3. Téléversez l'archive zip sur le lien ci-dessus.
4. Attendez un moment que les seed soient générées.
5. Lorsque les seeds sont générées, vous serez redirigé vers une page d'informations "Seed Info".
6. Cliquez sur "Create New Room". Cela vous amènera à la page du serveur. Fournissez le lien de cette page aux autres
joueurs afin qu'ils puissent récupérer leurs patchs.
**Note:** Les patchs fournis sur cette page permettront aux joueurs de se connecteur automatiquement au serveur,
tandis que ceux de la page "Seed Info" non.
7. Remarquez qu'un lien vers le traqueur du MultiWorld est en haut de la page de la salle. Vous devriez également
fournir ce lien aux joueurs pour qu'ils puissent suivre la progression de la partie. N'importe quel personne voulant
observer devrait avoir accès à ce lien.
8. Une fois que tous les joueurs ont rejoint, vous pouvez commencer à jouer.
## Auto-tracking
Si vous voulez utiliser l'auto-tracking, plusieurs logiciels offrent cette possibilité.
Le logiciel recommandé pour l'auto-tracking actuellement est
[OpenTracker](https://github.com/trippsc2/OpenTracker/releases).
### Installation
1. Téléchargez le fichier d'installation approprié pour votre ordinateur (Les utilisateurs Windows voudront le
fichier `.msi`).
2. Durant le processus d'installation, il vous sera peut-être demandé d'installer les outils "Microsoft Visual Studio
Build Tools". Un lien est fourni durant l'installation d'OpenTracker, et celle des outils doit se faire manuellement.
### Activer l'auto-tracking
1. Une fois OpenTracker démarré, cliquez sur le menu "Tracking" en haut de la fenêtre, puis choisissez **
AutoTracker...**
2. Appuyez sur le bouton **Get Devices**
3. Sélectionnez votre appareil SNES dans la liste déroulante.
4. Si vous voulez tracquer les petites clés ainsi que les objets des donjons, cochez la case **Race Illegal Tracking**
5. Cliquez sur le bouton **Start Autotracking**
6. Fermez la fenêtre "AutoTracker" maintenant, elle n'est plus nécessaire

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -684,37 +684,38 @@ class CV64PatchExtensions(APPatchExtension):
# Disable the 3HBs checking and setting flags when breaking them and enable their individual items checking and
# setting flags instead.
rom_data.write_int32(0xE87F8, 0x00000000) # NOP
rom_data.write_int16(0xE836C, 0x1000)
rom_data.write_int32(0xE8B40, 0x0C0FF3CD) # JAL 0x803FCF34
rom_data.write_int32s(0xBFCF34, patches.three_hit_item_flags_setter)
# Villa foyer chandelier-specific functions (yeah, IDK why KCEK made different functions for this one)
rom_data.write_int32(0xE7D54, 0x00000000) # NOP
rom_data.write_int16(0xE7908, 0x1000)
rom_data.write_byte(0xE7A5C, 0x10)
rom_data.write_int32(0xE7F08, 0x0C0FF3DF) # JAL 0x803FCF7C
rom_data.write_int32s(0xBFCF7C, patches.chandelier_item_flags_setter)
if options["multi_hit_breakables"]:
rom_data.write_int32(0xE87F8, 0x00000000) # NOP
rom_data.write_int16(0xE836C, 0x1000)
rom_data.write_int32(0xE8B40, 0x0C0FF3CD) # JAL 0x803FCF34
rom_data.write_int32s(0xBFCF34, patches.three_hit_item_flags_setter)
# Villa foyer chandelier-specific functions (yeah, IDK why KCEK made different functions for this one)
rom_data.write_int32(0xE7D54, 0x00000000) # NOP
rom_data.write_int16(0xE7908, 0x1000)
rom_data.write_byte(0xE7A5C, 0x10)
rom_data.write_int32(0xE7F08, 0x0C0FF3DF) # JAL 0x803FCF7C
rom_data.write_int32s(0xBFCF7C, patches.chandelier_item_flags_setter)
# New flag values to put in each 3HB vanilla flag's spot
rom_data.write_int32(0x10C7C8, 0x8000FF48) # FoS dirge maiden rock
rom_data.write_int32(0x10C7B0, 0x0200FF48) # FoS S1 bridge rock
rom_data.write_int32(0x10C86C, 0x0010FF48) # CW upper rampart save nub
rom_data.write_int32(0x10C878, 0x4000FF49) # CW Dracula switch slab
rom_data.write_int32(0x10CAD8, 0x0100FF49) # Tunnel twin arrows slab
rom_data.write_int32(0x10CAE4, 0x0004FF49) # Tunnel lonesome bucket pit rock
rom_data.write_int32(0x10CB54, 0x4000FF4A) # UW poison parkour ledge
rom_data.write_int32(0x10CB60, 0x0080FF4A) # UW skeleton crusher ledge
rom_data.write_int32(0x10CBF0, 0x0008FF4A) # CC Behemoth crate
rom_data.write_int32(0x10CC2C, 0x2000FF4B) # CC elevator pedestal
rom_data.write_int32(0x10CC70, 0x0200FF4B) # CC lizard locker slab
rom_data.write_int32(0x10CD88, 0x0010FF4B) # ToE pre-midsavepoint platforms ledge
rom_data.write_int32(0x10CE6C, 0x4000FF4C) # ToSci invisible bridge crate
rom_data.write_int32(0x10CF20, 0x0080FF4C) # CT inverted battery slab
rom_data.write_int32(0x10CF2C, 0x0008FF4C) # CT inverted door slab
rom_data.write_int32(0x10CF38, 0x8000FF4D) # CT final room door slab
rom_data.write_int32(0x10CF44, 0x1000FF4D) # CT Renon slab
rom_data.write_int32(0x10C908, 0x0008FF4D) # Villa foyer chandelier
rom_data.write_byte(0x10CF37, 0x04) # pointer for CT final room door slab item data
# New flag values to put in each 3HB vanilla flag's spot
rom_data.write_int32(0x10C7C8, 0x8000FF48) # FoS dirge maiden rock
rom_data.write_int32(0x10C7B0, 0x0200FF48) # FoS S1 bridge rock
rom_data.write_int32(0x10C86C, 0x0010FF48) # CW upper rampart save nub
rom_data.write_int32(0x10C878, 0x4000FF49) # CW Dracula switch slab
rom_data.write_int32(0x10CAD8, 0x0100FF49) # Tunnel twin arrows slab
rom_data.write_int32(0x10CAE4, 0x0004FF49) # Tunnel lonesome bucket pit rock
rom_data.write_int32(0x10CB54, 0x4000FF4A) # UW poison parkour ledge
rom_data.write_int32(0x10CB60, 0x0080FF4A) # UW skeleton crusher ledge
rom_data.write_int32(0x10CBF0, 0x0008FF4A) # CC Behemoth crate
rom_data.write_int32(0x10CC2C, 0x2000FF4B) # CC elevator pedestal
rom_data.write_int32(0x10CC70, 0x0200FF4B) # CC lizard locker slab
rom_data.write_int32(0x10CD88, 0x0010FF4B) # ToE pre-midsavepoint platforms ledge
rom_data.write_int32(0x10CE6C, 0x4000FF4C) # ToSci invisible bridge crate
rom_data.write_int32(0x10CF20, 0x0080FF4C) # CT inverted battery slab
rom_data.write_int32(0x10CF2C, 0x0008FF4C) # CT inverted door slab
rom_data.write_int32(0x10CF38, 0x8000FF4D) # CT final room door slab
rom_data.write_int32(0x10CF44, 0x1000FF4D) # CT Renon slab
rom_data.write_int32(0x10C908, 0x0008FF4D) # Villa foyer chandelier
rom_data.write_byte(0x10CF37, 0x04) # pointer for CT final room door slab item data
# Once-per-frame gameplay checks
rom_data.write_int32(0x6C848, 0x080FF40D) # J 0x803FD034

View File

@@ -72,16 +72,8 @@ class DLCqworld(World):
self.multiworld.itempool += created_items
campaign = self.options.campaign
has_both = campaign == Options.Campaign.option_both
has_base = campaign == Options.Campaign.option_basic or has_both
has_big_bundles = self.options.coinsanity and self.options.coinbundlequantity > 50
early_items = self.multiworld.early_items
if has_base:
if has_both and has_big_bundles:
early_items[self.player]["Incredibly Important Pack"] = 1
else:
early_items[self.player]["Movement Pack"] = 1
if self.options.campaign == Options.Campaign.option_basic or self.options.campaign == Options.Campaign.option_both:
self.multiworld.early_items[self.player]["Movement Pack"] = 1
for item in items_to_exclude:
if item in self.multiworld.itempool:
@@ -90,7 +82,7 @@ class DLCqworld(World):
def precollect_coinsanity(self):
if self.options.campaign == Options.Campaign.option_basic:
if self.options.coinsanity == Options.CoinSanity.option_coin and self.options.coinbundlequantity >= 5:
self.multiworld.push_precollected(self.create_item("DLC Quest: Coin Bundle"))
self.multiworld.push_precollected(self.create_item("Movement Pack"))
def create_item(self, item: Union[str, ItemData], classification: ItemClassification = None) -> DLCQuestItem:
if isinstance(item, str):

View File

@@ -112,7 +112,7 @@ class StartWithComputerAreaMaps(Toggle):
class ResetLevelOnDeath(DefaultOnToggle):
"""When dying, levels are reset and monsters respawned. But inventory and checks are kept.
Turning this setting off is considered easy mode. Good for new players that don't know the levels well."""
display_name = "Reset Level on Death"
display_name="Reset Level on Death"
class Episode1(DefaultOnToggle):

View File

@@ -102,7 +102,7 @@ class StartWithComputerAreaMaps(Toggle):
class ResetLevelOnDeath(DefaultOnToggle):
"""When dying, levels are reset and monsters respawned. But inventory and checks are kept.
Turning this setting off is considered easy mode. Good for new players that don't know the levels well."""
display_name = "Reset Level on Death"
display_message="Reset level on death"
class Episode1(DefaultOnToggle):

View File

@@ -1,58 +0,0 @@
from BaseClasses import ItemClassification
from typing import List, Optional
class ItemDef:
def __init__(self,
id: Optional[int],
name: str,
classification: ItemClassification,
count: int,
progression_count: int,
prefill_location: Optional[str]):
self.id = id
self.name = name
self.classification = classification
self.count = count
self.progression_count = progression_count
self.prefill_location = prefill_location
items: List[ItemDef] = [
ItemDef(400000, 'Progressive Sword', ItemClassification.progression, 4, 0, None),
ItemDef(400001, 'Progressive Armor', ItemClassification.progression, 3, 0, None),
ItemDef(400002, 'Progressive Shield', ItemClassification.useful, 4, 0, None),
ItemDef(400003, 'Spring Elixir', ItemClassification.progression, 1, 0, None),
ItemDef(400004, 'Mattock', ItemClassification.progression, 1, 0, None),
ItemDef(400005, 'Unlock Wingboots', ItemClassification.progression, 1, 0, None),
ItemDef(400006, 'Key Jack', ItemClassification.progression, 1, 0, None),
ItemDef(400007, 'Key Queen', ItemClassification.progression, 1, 0, None),
ItemDef(400008, 'Key King', ItemClassification.progression, 1, 0, None),
ItemDef(400009, 'Key Joker', ItemClassification.progression, 1, 0, None),
ItemDef(400010, 'Key Ace', ItemClassification.progression, 1, 0, None),
ItemDef(400011, 'Ring of Ruby', ItemClassification.progression, 1, 0, None),
ItemDef(400012, 'Ring of Dworf', ItemClassification.progression, 1, 0, None),
ItemDef(400013, 'Demons Ring', ItemClassification.progression, 1, 0, None),
ItemDef(400014, 'Black Onyx', ItemClassification.progression, 1, 0, None),
ItemDef(None, 'Sky Spring Flow', ItemClassification.progression, 1, 0, 'Sky Spring'),
ItemDef(None, 'Tower of Fortress Spring Flow', ItemClassification.progression, 1, 0, 'Tower of Fortress Spring'),
ItemDef(None, 'Joker Spring Flow', ItemClassification.progression, 1, 0, 'Joker Spring'),
ItemDef(400015, 'Deluge', ItemClassification.progression, 1, 0, None),
ItemDef(400016, 'Thunder', ItemClassification.useful, 1, 0, None),
ItemDef(400017, 'Fire', ItemClassification.useful, 1, 0, None),
ItemDef(400018, 'Death', ItemClassification.useful, 1, 0, None),
ItemDef(400019, 'Tilte', ItemClassification.useful, 1, 0, None),
ItemDef(400020, 'Ring of Elf', ItemClassification.useful, 1, 0, None),
ItemDef(400021, 'Magical Rod', ItemClassification.useful, 1, 0, None),
ItemDef(400022, 'Pendant', ItemClassification.useful, 1, 0, None),
ItemDef(400023, 'Hourglass', ItemClassification.filler, 6, 0, None),
# We need at least 4 red potions for the Tower of Red Potion. Up to the player to save them up!
ItemDef(400024, 'Red Potion', ItemClassification.filler, 15, 4, None),
ItemDef(400025, 'Elixir', ItemClassification.filler, 4, 0, None),
ItemDef(400026, 'Glove', ItemClassification.filler, 5, 0, None),
ItemDef(400027, 'Ointment', ItemClassification.filler, 8, 0, None),
ItemDef(400028, 'Poison', ItemClassification.trap, 13, 0, None),
ItemDef(None, 'Killed Evil One', ItemClassification.progression, 1, 0, 'Evil One'),
# Placeholder item so the game knows which shop slot to prefill wingboots
ItemDef(400029, 'Wingboots', ItemClassification.useful, 0, 0, None),
]

View File

@@ -1,199 +0,0 @@
from typing import List, Optional
class LocationType():
world = 1 # Just standing there in the world
hidden = 2 # Kill all monsters in the room to reveal, each "item room" counter tick.
boss_reward = 3 # Kill a boss to reveal the item
shop = 4 # Buy at a shop
give = 5 # Given by an NPC
spring = 6 # Activatable spring
boss = 7 # Entity to kill to trigger the check
class ItemType():
unknown = 0 # Or don't care
red_potion = 1
class LocationDef:
def __init__(self, id: Optional[int], name: str, region: str, type: int, original_item: int):
self.id = id
self.name = name
self.region = region
self.type = type
self.original_item = original_item
locations: List[LocationDef] = [
# Eolis
LocationDef(400100, 'Eolis Guru', 'Eolis', LocationType.give, ItemType.unknown),
LocationDef(400101, 'Eolis Key Jack', 'Eolis', LocationType.shop, ItemType.unknown),
LocationDef(400102, 'Eolis Hand Dagger', 'Eolis', LocationType.shop, ItemType.unknown),
LocationDef(400103, 'Eolis Red Potion', 'Eolis', LocationType.shop, ItemType.red_potion),
LocationDef(400104, 'Eolis Elixir', 'Eolis', LocationType.shop, ItemType.unknown),
LocationDef(400105, 'Eolis Deluge', 'Eolis', LocationType.shop, ItemType.unknown),
# Path to Apolune
LocationDef(400106, 'Path to Apolune Magic Shield', 'Path to Apolune', LocationType.shop, ItemType.unknown),
LocationDef(400107, 'Path to Apolune Death', 'Path to Apolune', LocationType.shop, ItemType.unknown),
# Apolune
LocationDef(400108, 'Apolune Small Shield', 'Apolune', LocationType.shop, ItemType.unknown),
LocationDef(400109, 'Apolune Hand Dagger', 'Apolune', LocationType.shop, ItemType.unknown),
LocationDef(400110, 'Apolune Deluge', 'Apolune', LocationType.shop, ItemType.unknown),
LocationDef(400111, 'Apolune Red Potion', 'Apolune', LocationType.shop, ItemType.red_potion),
LocationDef(400112, 'Apolune Key Jack', 'Apolune', LocationType.shop, ItemType.unknown),
# Tower of Trunk
LocationDef(400113, 'Tower of Trunk Hidden Mattock', 'Tower of Trunk', LocationType.hidden, ItemType.unknown),
LocationDef(400114, 'Tower of Trunk Hidden Hourglass', 'Tower of Trunk', LocationType.hidden, ItemType.unknown),
LocationDef(400115, 'Tower of Trunk Boss Mattock', 'Tower of Trunk', LocationType.boss_reward, ItemType.unknown),
# Path to Forepaw
LocationDef(400116, 'Path to Forepaw Hidden Red Potion', 'Path to Forepaw', LocationType.hidden, ItemType.red_potion),
LocationDef(400117, 'Path to Forepaw Glove', 'Path to Forepaw', LocationType.world, ItemType.unknown),
# Forepaw
LocationDef(400118, 'Forepaw Long Sword', 'Forepaw', LocationType.shop, ItemType.unknown),
LocationDef(400119, 'Forepaw Studded Mail', 'Forepaw', LocationType.shop, ItemType.unknown),
LocationDef(400120, 'Forepaw Small Shield', 'Forepaw', LocationType.shop, ItemType.unknown),
LocationDef(400121, 'Forepaw Red Potion', 'Forepaw', LocationType.shop, ItemType.red_potion),
LocationDef(400122, 'Forepaw Wingboots', 'Forepaw', LocationType.shop, ItemType.unknown),
LocationDef(400123, 'Forepaw Key Jack', 'Forepaw', LocationType.shop, ItemType.unknown),
LocationDef(400124, 'Forepaw Key Queen', 'Forepaw', LocationType.shop, ItemType.unknown),
# Trunk
LocationDef(400125, 'Trunk Hidden Ointment', 'Trunk', LocationType.hidden, ItemType.unknown),
LocationDef(400126, 'Trunk Hidden Red Potion', 'Trunk', LocationType.hidden, ItemType.red_potion),
LocationDef(400127, 'Trunk Red Potion', 'Trunk', LocationType.world, ItemType.red_potion),
LocationDef(None, 'Sky Spring', 'Trunk', LocationType.spring, ItemType.unknown),
# Joker Spring
LocationDef(400128, 'Joker Spring Ruby Ring', 'Joker Spring', LocationType.give, ItemType.unknown),
LocationDef(None, 'Joker Spring', 'Joker Spring', LocationType.spring, ItemType.unknown),
# Tower of Fortress
LocationDef(400129, 'Tower of Fortress Poison 1', 'Tower of Fortress', LocationType.world, ItemType.unknown),
LocationDef(400130, 'Tower of Fortress Poison 2', 'Tower of Fortress', LocationType.world, ItemType.unknown),
LocationDef(400131, 'Tower of Fortress Hidden Wingboots', 'Tower of Fortress', LocationType.world, ItemType.unknown),
LocationDef(400132, 'Tower of Fortress Ointment', 'Tower of Fortress', LocationType.world, ItemType.unknown),
LocationDef(400133, 'Tower of Fortress Boss Wingboots', 'Tower of Fortress', LocationType.boss_reward, ItemType.unknown),
LocationDef(400134, 'Tower of Fortress Elixir', 'Tower of Fortress', LocationType.world, ItemType.unknown),
LocationDef(400135, 'Tower of Fortress Guru', 'Tower of Fortress', LocationType.give, ItemType.unknown),
LocationDef(None, 'Tower of Fortress Spring', 'Tower of Fortress', LocationType.spring, ItemType.unknown),
# Path to Mascon
LocationDef(400136, 'Path to Mascon Hidden Wingboots', 'Path to Mascon', LocationType.hidden, ItemType.unknown),
# Tower of Red Potion
LocationDef(400137, 'Tower of Red Potion', 'Tower of Red Potion', LocationType.world, ItemType.red_potion),
# Mascon
LocationDef(400138, 'Mascon Large Shield', 'Mascon', LocationType.shop, ItemType.unknown),
LocationDef(400139, 'Mascon Thunder', 'Mascon', LocationType.shop, ItemType.unknown),
LocationDef(400140, 'Mascon Mattock', 'Mascon', LocationType.shop, ItemType.unknown),
LocationDef(400141, 'Mascon Red Potion', 'Mascon', LocationType.shop, ItemType.red_potion),
LocationDef(400142, 'Mascon Key Jack', 'Mascon', LocationType.shop, ItemType.unknown),
LocationDef(400143, 'Mascon Key Queen', 'Mascon', LocationType.shop, ItemType.unknown),
# Path to Victim
LocationDef(400144, 'Misty Shop Death', 'Path to Victim', LocationType.shop, ItemType.unknown),
LocationDef(400145, 'Misty Shop Hourglass', 'Path to Victim', LocationType.shop, ItemType.unknown),
LocationDef(400146, 'Misty Shop Elixir', 'Path to Victim', LocationType.shop, ItemType.unknown),
LocationDef(400147, 'Misty Shop Red Potion', 'Path to Victim', LocationType.shop, ItemType.red_potion),
LocationDef(400148, 'Misty Doctor Office', 'Path to Victim', LocationType.hidden, ItemType.unknown),
# Tower of Suffer
LocationDef(400149, 'Tower of Suffer Hidden Wingboots', 'Tower of Suffer', LocationType.hidden, ItemType.unknown),
LocationDef(400150, 'Tower of Suffer Hidden Hourglass', 'Tower of Suffer', LocationType.hidden, ItemType.unknown),
LocationDef(400151, 'Tower of Suffer Pendant', 'Tower of Suffer', LocationType.boss_reward, ItemType.unknown),
# Victim
LocationDef(400152, 'Victim Full Plate', 'Victim', LocationType.shop, ItemType.unknown),
LocationDef(400153, 'Victim Mattock', 'Victim', LocationType.shop, ItemType.unknown),
LocationDef(400154, 'Victim Red Potion', 'Victim', LocationType.shop, ItemType.red_potion),
LocationDef(400155, 'Victim Key King', 'Victim', LocationType.shop, ItemType.unknown),
LocationDef(400156, 'Victim Key Queen', 'Victim', LocationType.shop, ItemType.unknown),
LocationDef(400157, 'Victim Tavern', 'Mist', LocationType.give, ItemType.unknown),
# Mist
LocationDef(400158, 'Mist Hidden Poison 1', 'Mist', LocationType.hidden, ItemType.unknown),
LocationDef(400159, 'Mist Hidden Poison 2', 'Mist', LocationType.hidden, ItemType.unknown),
LocationDef(400160, 'Mist Hidden Wingboots', 'Mist', LocationType.hidden, ItemType.unknown),
LocationDef(400161, 'Misty Magic Hall', 'Mist', LocationType.give, ItemType.unknown),
LocationDef(400162, 'Misty House', 'Mist', LocationType.give, ItemType.unknown),
# Useless Tower
LocationDef(400163, 'Useless Tower', 'Useless Tower', LocationType.hidden, ItemType.unknown),
# Tower of Mist
LocationDef(400164, 'Tower of Mist Hidden Ointment', 'Tower of Mist', LocationType.hidden, ItemType.unknown),
LocationDef(400165, 'Tower of Mist Elixir', 'Tower of Mist', LocationType.world, ItemType.unknown),
LocationDef(400166, 'Tower of Mist Black Onyx', 'Tower of Mist', LocationType.boss_reward, ItemType.unknown),
# Path to Conflate
LocationDef(400167, 'Path to Conflate Hidden Ointment', 'Path to Conflate', LocationType.hidden, ItemType.unknown),
LocationDef(400168, 'Path to Conflate Poison', 'Path to Conflate', LocationType.hidden, ItemType.unknown),
# Helm Branch
LocationDef(400169, 'Helm Branch Hidden Glove', 'Helm Branch', LocationType.hidden, ItemType.unknown),
LocationDef(400170, 'Helm Branch Battle Helmet', 'Helm Branch', LocationType.boss_reward, ItemType.unknown),
# Conflate
LocationDef(400171, 'Conflate Giant Blade', 'Conflate', LocationType.shop, ItemType.unknown),
LocationDef(400172, 'Conflate Magic Shield', 'Conflate', LocationType.shop, ItemType.unknown),
LocationDef(400173, 'Conflate Wingboots', 'Conflate', LocationType.shop, ItemType.unknown),
LocationDef(400174, 'Conflate Red Potion', 'Conflate', LocationType.shop, ItemType.red_potion),
LocationDef(400175, 'Conflate Guru', 'Conflate', LocationType.give, ItemType.unknown),
# Branches
LocationDef(400176, 'Branches Hidden Ointment', 'Branches', LocationType.hidden, ItemType.unknown),
LocationDef(400177, 'Branches Poison', 'Branches', LocationType.world, ItemType.unknown),
LocationDef(400178, 'Branches Hidden Mattock', 'Branches', LocationType.hidden, ItemType.unknown),
LocationDef(400179, 'Branches Hidden Hourglass', 'Branches', LocationType.hidden, ItemType.unknown),
# Path to Daybreak
LocationDef(400180, 'Path to Daybreak Hidden Wingboots 1', 'Path to Daybreak', LocationType.hidden, ItemType.unknown),
LocationDef(400181, 'Path to Daybreak Magical Rod', 'Path to Daybreak', LocationType.world, ItemType.unknown),
LocationDef(400182, 'Path to Daybreak Hidden Wingboots 2', 'Path to Daybreak', LocationType.hidden, ItemType.unknown),
LocationDef(400183, 'Path to Daybreak Poison', 'Path to Daybreak', LocationType.world, ItemType.unknown),
LocationDef(400184, 'Path to Daybreak Glove', 'Path to Daybreak', LocationType.world, ItemType.unknown),
LocationDef(400185, 'Path to Daybreak Battle Suit', 'Path to Daybreak', LocationType.boss_reward, ItemType.unknown),
# Daybreak
LocationDef(400186, 'Daybreak Tilte', 'Daybreak', LocationType.shop, ItemType.unknown),
LocationDef(400187, 'Daybreak Giant Blade', 'Daybreak', LocationType.shop, ItemType.unknown),
LocationDef(400188, 'Daybreak Red Potion', 'Daybreak', LocationType.shop, ItemType.red_potion),
LocationDef(400189, 'Daybreak Key King', 'Daybreak', LocationType.shop, ItemType.unknown),
LocationDef(400190, 'Daybreak Key Queen', 'Daybreak', LocationType.shop, ItemType.unknown),
# Dartmoor Castle
LocationDef(400191, 'Dartmoor Castle Hidden Hourglass', 'Dartmoor Castle', LocationType.hidden, ItemType.unknown),
LocationDef(400192, 'Dartmoor Castle Hidden Red Potion', 'Dartmoor Castle', LocationType.hidden, ItemType.red_potion),
# Dartmoor
LocationDef(400193, 'Dartmoor Giant Blade', 'Dartmoor', LocationType.shop, ItemType.unknown),
LocationDef(400194, 'Dartmoor Red Potion', 'Dartmoor', LocationType.shop, ItemType.red_potion),
LocationDef(400195, 'Dartmoor Key King', 'Dartmoor', LocationType.shop, ItemType.unknown),
# Fraternal Castle
LocationDef(400196, 'Fraternal Castle Hidden Ointment', 'Fraternal Castle', LocationType.hidden, ItemType.unknown),
LocationDef(400197, 'Fraternal Castle Shop Hidden Ointment', 'Fraternal Castle', LocationType.hidden, ItemType.unknown),
LocationDef(400198, 'Fraternal Castle Poison 1', 'Fraternal Castle', LocationType.world, ItemType.unknown),
LocationDef(400199, 'Fraternal Castle Poison 2', 'Fraternal Castle', LocationType.world, ItemType.unknown),
LocationDef(400200, 'Fraternal Castle Poison 3', 'Fraternal Castle', LocationType.world, ItemType.unknown),
# LocationDef(400201, 'Fraternal Castle Red Potion', 'Fraternal Castle', LocationType.world, ItemType.red_potion), # This location is inaccessible. Keeping commented for context.
LocationDef(400202, 'Fraternal Castle Hidden Hourglass', 'Fraternal Castle', LocationType.hidden, ItemType.unknown),
LocationDef(400203, 'Fraternal Castle Dragon Slayer', 'Fraternal Castle', LocationType.boss_reward, ItemType.unknown),
LocationDef(400204, 'Fraternal Castle Guru', 'Fraternal Castle', LocationType.give, ItemType.unknown),
# Evil Fortress
LocationDef(400205, 'Evil Fortress Ointment', 'Evil Fortress', LocationType.world, ItemType.unknown),
LocationDef(400206, 'Evil Fortress Poison 1', 'Evil Fortress', LocationType.world, ItemType.unknown),
LocationDef(400207, 'Evil Fortress Glove', 'Evil Fortress', LocationType.world, ItemType.unknown),
LocationDef(400208, 'Evil Fortress Poison 2', 'Evil Fortress', LocationType.world, ItemType.unknown),
LocationDef(400209, 'Evil Fortress Poison 3', 'Evil Fortress', LocationType.world, ItemType.unknown),
LocationDef(400210, 'Evil Fortress Hidden Glove', 'Evil Fortress', LocationType.hidden, ItemType.unknown),
LocationDef(None, 'Evil One', 'Evil Fortress', LocationType.boss, ItemType.unknown),
]

View File

@@ -1,107 +0,0 @@
from Options import PerGameCommonOptions, Toggle, DefaultOnToggle, StartInventoryPool, Choice
from dataclasses import dataclass
class KeepShopRedPotions(Toggle):
"""
Prevents the Shop's Red Potions from being shuffled. Those locations
will have purchasable Red Potion as usual for their usual price.
"""
display_name = "Keep Shop Red Potions"
class IncludePendant(Toggle):
"""
Pendant is an item that boosts your attack power permanently when picked up.
However, due to a programming error in the original game, it has the reverse
effect. You start with the Pendant power, and lose it when picking
it up. So this item is essentially a trap.
There is a setting in the client to reverse the effect back to its original intend.
This could be used in conjunction with this option to increase or lower difficulty.
"""
display_name = "Include Pendant"
class IncludePoisons(DefaultOnToggle):
"""
Whether or not to include Poison Potions in the pool of items. Including them
effectively turn them into traps in multiplayer.
"""
display_name = "Include Poisons"
class RequireDragonSlayer(Toggle):
"""
Requires the Dragon Slayer to be available before fighting the final boss is required.
Turning this on will turn Progressive Shields into progression items.
This setting does not force you to use Dragon Slayer to kill the final boss.
Instead, it ensures that you will have the Dragon Slayer and be able to equip
it before you are expected to beat the final boss.
"""
display_name = "Require Dragon Slayer"
class RandomMusic(Toggle):
"""
All levels' music is shuffled. Except the title screen because it's finite.
This is an aesthetic option and doesn't affect gameplay.
"""
display_name = "Random Musics"
class RandomSound(Toggle):
"""
All sounds are shuffled.
This is an aesthetic option and doesn't affect gameplay.
"""
display_name = "Random Sounds"
class RandomNPC(Toggle):
"""
NPCs and their portraits are shuffled.
This is an aesthetic option and doesn't affect gameplay.
"""
display_name = "Random NPCs"
class RandomMonsters(Choice):
"""
Choose how monsters are randomized.
"Vanilla": No randomization
"Level Shuffle": Monsters are shuffled within a level
"Level Random": Monsters are picked randomly, balanced based on the ratio of the current level
"World Shuffle": Monsters are shuffled across the entire world
"World Random": Monsters are picked randomly, balanced based on the ratio of the entire world
"Chaotic": Completely random, except big vs small ratio is kept. Big are mini-bosses.
"""
display_name = "Random Monsters"
option_vanilla = 0
option_level_shuffle = 1
option_level_random = 2
option_world_shuffle = 3
option_world_random = 4
option_chaotic = 5
default = 0
class RandomRewards(Toggle):
"""
Monsters drops are shuffled.
"""
display_name = "Random Rewards"
@dataclass
class FaxanaduOptions(PerGameCommonOptions):
start_inventory_from_pool: StartInventoryPool
keep_shop_red_potions: KeepShopRedPotions
include_pendant: IncludePendant
include_poisons: IncludePoisons
require_dragon_slayer: RequireDragonSlayer
random_musics: RandomMusic
random_sounds: RandomSound
random_npcs: RandomNPC
random_monsters: RandomMonsters
random_rewards: RandomRewards

View File

@@ -1,66 +0,0 @@
from BaseClasses import Region
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from . import FaxanaduWorld
def create_region(name, player, multiworld):
region = Region(name, player, multiworld)
multiworld.regions.append(region)
return region
def create_regions(faxanadu_world: "FaxanaduWorld"):
player = faxanadu_world.player
multiworld = faxanadu_world.multiworld
# Create regions
menu = create_region("Menu", player, multiworld)
eolis = create_region("Eolis", player, multiworld)
path_to_apolune = create_region("Path to Apolune", player, multiworld)
apolune = create_region("Apolune", player, multiworld)
create_region("Tower of Trunk", player, multiworld)
path_to_forepaw = create_region("Path to Forepaw", player, multiworld)
forepaw = create_region("Forepaw", player, multiworld)
trunk = create_region("Trunk", player, multiworld)
create_region("Joker Spring", player, multiworld)
create_region("Tower of Fortress", player, multiworld)
path_to_mascon = create_region("Path to Mascon", player, multiworld)
create_region("Tower of Red Potion", player, multiworld)
mascon = create_region("Mascon", player, multiworld)
path_to_victim = create_region("Path to Victim", player, multiworld)
create_region("Tower of Suffer", player, multiworld)
victim = create_region("Victim", player, multiworld)
mist = create_region("Mist", player, multiworld)
create_region("Useless Tower", player, multiworld)
create_region("Tower of Mist", player, multiworld)
path_to_conflate = create_region("Path to Conflate", player, multiworld)
create_region("Helm Branch", player, multiworld)
create_region("Conflate", player, multiworld)
branches = create_region("Branches", player, multiworld)
path_to_daybreak = create_region("Path to Daybreak", player, multiworld)
daybreak = create_region("Daybreak", player, multiworld)
dartmoor_castle = create_region("Dartmoor Castle", player, multiworld)
create_region("Dartmoor", player, multiworld)
create_region("Fraternal Castle", player, multiworld)
create_region("Evil Fortress", player, multiworld)
# Create connections
menu.add_exits(["Eolis"])
eolis.add_exits(["Path to Apolune"])
path_to_apolune.add_exits(["Apolune"])
apolune.add_exits(["Tower of Trunk", "Path to Forepaw"])
path_to_forepaw.add_exits(["Forepaw"])
forepaw.add_exits(["Trunk"])
trunk.add_exits(["Joker Spring", "Tower of Fortress", "Path to Mascon"])
path_to_mascon.add_exits(["Tower of Red Potion", "Mascon"])
mascon.add_exits(["Path to Victim"])
path_to_victim.add_exits(["Tower of Suffer", "Victim"])
victim.add_exits(["Mist"])
mist.add_exits(["Useless Tower", "Tower of Mist", "Path to Conflate"])
path_to_conflate.add_exits(["Helm Branch", "Conflate", "Branches"])
branches.add_exits(["Path to Daybreak"])
path_to_daybreak.add_exits(["Daybreak"])
daybreak.add_exits(["Dartmoor Castle"])
dartmoor_castle.add_exits(["Dartmoor", "Fraternal Castle", "Evil Fortress"])

View File

@@ -1,79 +0,0 @@
from typing import TYPE_CHECKING
from worlds.generic.Rules import set_rule
if TYPE_CHECKING:
from . import FaxanaduWorld
def can_buy_in_eolis(state, player):
# Sword or Deluge so we can farm for gold.
# Ring of Elf so we can get 1500 from the King.
return state.has_any(["Progressive Sword", "Deluge", "Ring of Elf"], player)
def has_any_magic(state, player):
return state.has_any(["Deluge", "Thunder", "Fire", "Death", "Tilte"], player)
def set_rules(faxanadu_world: "FaxanaduWorld"):
player = faxanadu_world.player
multiworld = faxanadu_world.multiworld
# Region rules
set_rule(multiworld.get_entrance("Eolis -> Path to Apolune", player), lambda state:
state.has_all(["Key Jack", "Progressive Sword"], player)) # You can't go far with magic only
set_rule(multiworld.get_entrance("Apolune -> Tower of Trunk", player), lambda state: state.has("Key Jack", player))
set_rule(multiworld.get_entrance("Apolune -> Path to Forepaw", player), lambda state: state.has("Mattock", player))
set_rule(multiworld.get_entrance("Trunk -> Joker Spring", player), lambda state: state.has("Key Joker", player))
set_rule(multiworld.get_entrance("Trunk -> Tower of Fortress", player), lambda state: state.has("Key Jack", player))
set_rule(multiworld.get_entrance("Trunk -> Path to Mascon", player), lambda state:
state.has_all(["Key Queen", "Ring of Ruby", "Sky Spring Flow", "Tower of Fortress Spring Flow", "Joker Spring Flow"], player) and
state.has("Progressive Sword", player, 2))
set_rule(multiworld.get_entrance("Path to Mascon -> Tower of Red Potion", player), lambda state:
state.has("Key Queen", player) and
state.has("Red Potion", player, 4)) # It's impossible to go through the tower of Red Potion without at least 1-2 potions. Give them 4 for good measure.
set_rule(multiworld.get_entrance("Path to Victim -> Tower of Suffer", player), lambda state: state.has("Key Queen", player))
set_rule(multiworld.get_entrance("Path to Victim -> Victim", player), lambda state: state.has("Unlock Wingboots", player))
set_rule(multiworld.get_entrance("Mist -> Useless Tower", player), lambda state:
state.has_all(["Key King", "Unlock Wingboots"], player))
set_rule(multiworld.get_entrance("Mist -> Tower of Mist", player), lambda state: state.has("Key King", player))
set_rule(multiworld.get_entrance("Mist -> Path to Conflate", player), lambda state: state.has("Key Ace", player))
set_rule(multiworld.get_entrance("Path to Conflate -> Helm Branch", player), lambda state: state.has("Key King", player))
set_rule(multiworld.get_entrance("Path to Conflate -> Branches", player), lambda state: state.has("Key King", player))
set_rule(multiworld.get_entrance("Daybreak -> Dartmoor Castle", player), lambda state: state.has("Ring of Dworf", player))
set_rule(multiworld.get_entrance("Dartmoor Castle -> Evil Fortress", player), lambda state: state.has("Demons Ring", player))
# Location rules
set_rule(multiworld.get_location("Eolis Key Jack", player), lambda state: can_buy_in_eolis(state, player))
set_rule(multiworld.get_location("Eolis Hand Dagger", player), lambda state: can_buy_in_eolis(state, player))
set_rule(multiworld.get_location("Eolis Elixir", player), lambda state: can_buy_in_eolis(state, player))
set_rule(multiworld.get_location("Eolis Deluge", player), lambda state: can_buy_in_eolis(state, player))
set_rule(multiworld.get_location("Eolis Red Potion", player), lambda state: can_buy_in_eolis(state, player))
set_rule(multiworld.get_location("Path to Apolune Magic Shield", player), lambda state: state.has("Key King", player)) # Mid-late cost, make sure we've progressed
set_rule(multiworld.get_location("Path to Apolune Death", player), lambda state: state.has("Key Ace", player)) # Mid-late cost, make sure we've progressed
set_rule(multiworld.get_location("Tower of Trunk Hidden Mattock", player), lambda state:
# This is actually possible if the monster drop into the stairs and kill it with dagger. But it's a "pro move"
state.has("Deluge", player, 1) or
state.has("Progressive Sword", player, 2))
set_rule(multiworld.get_location("Path to Forepaw Glove", player), lambda state:
state.has_all(["Deluge", "Unlock Wingboots"], player))
set_rule(multiworld.get_location("Trunk Red Potion", player), lambda state: state.has("Unlock Wingboots", player))
set_rule(multiworld.get_location("Sky Spring", player), lambda state: state.has("Unlock Wingboots", player))
set_rule(multiworld.get_location("Tower of Fortress Spring", player), lambda state: state.has("Spring Elixir", player))
set_rule(multiworld.get_location("Tower of Fortress Guru", player), lambda state: state.has("Sky Spring Flow", player))
set_rule(multiworld.get_location("Tower of Suffer Hidden Wingboots", player), lambda state:
state.has("Deluge", player) or
state.has("Progressive Sword", player, 2))
set_rule(multiworld.get_location("Misty House", player), lambda state: state.has("Black Onyx", player))
set_rule(multiworld.get_location("Misty Doctor Office", player), lambda state: has_any_magic(state, player))
set_rule(multiworld.get_location("Conflate Guru", player), lambda state: state.has("Progressive Armor", player, 3))
set_rule(multiworld.get_location("Branches Hidden Mattock", player), lambda state: state.has("Unlock Wingboots", player))
set_rule(multiworld.get_location("Path to Daybreak Glove", player), lambda state: state.has("Unlock Wingboots", player))
set_rule(multiworld.get_location("Dartmoor Castle Hidden Hourglass", player), lambda state: state.has("Unlock Wingboots", player))
set_rule(multiworld.get_location("Dartmoor Castle Hidden Red Potion", player), lambda state: has_any_magic(state, player))
set_rule(multiworld.get_location("Fraternal Castle Guru", player), lambda state: state.has("Progressive Sword", player, 4))
set_rule(multiworld.get_location("Fraternal Castle Shop Hidden Ointment", player), lambda state: has_any_magic(state, player))
if faxanadu_world.options.require_dragon_slayer.value:
set_rule(multiworld.get_location("Evil One", player), lambda state:
state.has_all_counts({"Progressive Sword": 4, "Progressive Armor": 3, "Progressive Shield": 4}, player))

View File

@@ -1,190 +0,0 @@
from typing import Any, Dict, List
from BaseClasses import Item, Location, Tutorial, ItemClassification, MultiWorld
from worlds.AutoWorld import WebWorld, World
from . import Items, Locations, Regions, Rules
from .Options import FaxanaduOptions
from worlds.generic.Rules import set_rule
DAXANADU_VERSION = "0.3.0"
class FaxanaduLocation(Location):
game: str = "Faxanadu"
class FaxanaduItem(Item):
game: str = "Faxanadu"
class FaxanaduWeb(WebWorld):
tutorials = [Tutorial(
"Multiworld Setup Guide",
"A guide to setting up the Faxanadu randomizer connected to an Archipelago Multiworld",
"English",
"setup_en.md",
"setup/en",
["Daivuk"]
)]
theme = "dirt"
class FaxanaduWorld(World):
"""
Faxanadu is an action role-playing platform video game developed by Hudson Soft for the Nintendo Entertainment System
"""
options_dataclass = FaxanaduOptions
options: FaxanaduOptions
game = "Faxanadu"
web = FaxanaduWeb()
item_name_to_id = {item.name: item.id for item in Items.items if item.id is not None}
item_name_to_item = {item.name: item for item in Items.items}
location_name_to_id = {loc.name: loc.id for loc in Locations.locations if loc.id is not None}
def __init__(self, world: MultiWorld, player: int):
self.filler_ratios: Dict[str, int] = {}
super().__init__(world, player)
def create_regions(self):
Regions.create_regions(self)
# Add locations into regions
for region in self.multiworld.get_regions(self.player):
for loc in [location for location in Locations.locations if location.region == region.name]:
location = FaxanaduLocation(self.player, loc.name, loc.id, region)
# In Faxanadu, Poison hurts you when picked up. It makes no sense to sell them in shops
if loc.type == Locations.LocationType.shop:
location.item_rule = lambda item, player=self.player: not (player == item.player and item.name == "Poison")
region.locations.append(location)
def set_rules(self):
Rules.set_rules(self)
self.multiworld.completion_condition[self.player] = lambda state: state.has("Killed Evil One", self.player)
def create_item(self, name: str) -> FaxanaduItem:
item: Items.ItemDef = self.item_name_to_item[name]
return FaxanaduItem(name, item.classification, item.id, self.player)
# Returns how many red potions were prefilled into shops
def prefill_shop_red_potions(self) -> int:
red_potion_in_shop_count = 0
if self.options.keep_shop_red_potions:
red_potion_item = self.item_name_to_item["Red Potion"]
red_potion_shop_locations = [
loc
for loc in Locations.locations
if loc.type == Locations.LocationType.shop and loc.original_item == Locations.ItemType.red_potion
]
for loc in red_potion_shop_locations:
location = self.get_location(loc.name)
location.place_locked_item(FaxanaduItem(red_potion_item.name, red_potion_item.classification, red_potion_item.id, self.player))
red_potion_in_shop_count += 1
return red_potion_in_shop_count
def put_wingboot_in_shop(self, shops, region_name):
item = self.item_name_to_item["Wingboots"]
shop = shops.pop(region_name)
slot = self.random.randint(0, len(shop) - 1)
loc = shop[slot]
location = self.get_location(loc.name)
location.place_locked_item(FaxanaduItem(item.name, item.classification, item.id, self.player))
# Put a rule right away that we need to have to unlocked.
set_rule(location, lambda state: state.has("Unlock Wingboots", self.player))
# Returns how many wingboots were prefilled into shops
def prefill_shop_wingboots(self) -> int:
# Collect shops
shops: Dict[str, List[Locations.LocationDef]] = {}
for loc in Locations.locations:
if loc.type == Locations.LocationType.shop:
if self.options.keep_shop_red_potions and loc.original_item == Locations.ItemType.red_potion:
continue # Don't override our red potions
shops.setdefault(loc.region, []).append(loc)
shop_count = len(shops)
wingboots_count = round(shop_count / 2.5) # On 10 shops, we should have about 4 shops with wingboots
# At least one should be in the first 4 shops. Because we require wingboots to progress past that point.
must_have_regions = [region for i, region in enumerate(shops) if i < 4]
self.put_wingboot_in_shop(shops, self.random.choice(must_have_regions))
# Fill in the rest randomly in remaining shops
for i in range(wingboots_count - 1): # -1 because we added one already
region = self.random.choice(list(shops.keys()))
self.put_wingboot_in_shop(shops, region)
return wingboots_count
def create_items(self) -> None:
itempool: List[FaxanaduItem] = []
# Prefill red potions in shops if option is set
red_potion_in_shop_count = self.prefill_shop_red_potions()
# Prefill wingboots in shops
wingboots_in_shop_count = self.prefill_shop_wingboots()
# Create the item pool, excluding fillers.
prefilled_count = red_potion_in_shop_count + wingboots_in_shop_count
for item in Items.items:
# Ignore pendant if turned off
if item.name == "Pendant" and not self.options.include_pendant:
continue
# ignore fillers for now, we will fill them later
if item.classification in [ItemClassification.filler, ItemClassification.trap] and \
item.progression_count == 0:
continue
prefill_loc = None
if item.prefill_location:
prefill_loc = self.get_location(item.prefill_location)
# if require dragon slayer is turned on, we need progressive shields to be progression
item_classification = item.classification
if self.options.require_dragon_slayer and item.name == "Progressive Shield":
item_classification = ItemClassification.progression
if prefill_loc:
prefill_loc.place_locked_item(FaxanaduItem(item.name, item_classification, item.id, self.player))
prefilled_count += 1
else:
for i in range(item.count - item.progression_count):
itempool.append(FaxanaduItem(item.name, item_classification, item.id, self.player))
for i in range(item.progression_count):
itempool.append(FaxanaduItem(item.name, ItemClassification.progression, item.id, self.player))
# Set up filler ratios
self.filler_ratios = {
item.name: item.count
for item in Items.items
if item.classification in [ItemClassification.filler, ItemClassification.trap]
}
# If red potions are locked in shops, remove the count from the ratio.
self.filler_ratios["Red Potion"] -= red_potion_in_shop_count
# Remove poisons if not desired
if not self.options.include_poisons:
self.filler_ratios["Poison"] = 0
# Randomly add fillers to the pool with ratios based on og game occurrence counts.
filler_count = len(Locations.locations) - len(itempool) - prefilled_count
for i in range(filler_count):
itempool.append(self.create_item(self.get_filler_item_name()))
self.multiworld.itempool += itempool
def get_filler_item_name(self) -> str:
return self.random.choices(list(self.filler_ratios.keys()), weights=list(self.filler_ratios.values()))[0]
def fill_slot_data(self) -> Dict[str, Any]:
slot_data = self.options.as_dict("keep_shop_red_potions", "random_musics", "random_sounds", "random_npcs", "random_monsters", "random_rewards")
slot_data["daxanadu_version"] = DAXANADU_VERSION
return slot_data

View File

@@ -1,27 +0,0 @@
# Faxanadu
## Where is the settings page?
The [player options page](../player-options) contains the options needed to configure your game session.
## What does randomization do to this game?
All game items collected in the map, shops, and boss drops are randomized.
Keys are unique. Once you get the Jack Key, you can open all Jack doors; the key stays in your inventory.
Wingboots are randomized across shops only. They are LOCKED and cannot be bought until you get the item that unlocks them.
Normal Elixirs don't revive the tower spring. A new item, Spring Elixir, is necessary. This new item is unique.
## What is the goal?
The goal is to kill the Evil One.
## What is a "check" in The Faxanadu?
Shop items, item locations in the world, boss drops, and secret items.
## What "items" can you unlock in Faxanadu?
Keys, Armors, Weapons, Potions, Shields, Magics, Poisons, Gloves, etc.

View File

@@ -1,32 +0,0 @@
# Faxanadu Randomizer Setup
## Required Software
- [Daxanadu](https://github.com/Daivuk/Daxanadu/releases/)
- Faxanadu ROM, English version
## Optional Software
- [ArchipelagoTextClient](https://github.com/ArchipelagoMW/Archipelago/releases)
## Installing Daxanadu
1. Download [Daxanadu.zip](https://github.com/Daivuk/Daxanadu/releases/) and extract it.
2. Copy your rom `Faxanadu (U).nes` into the newly extracted folder.
## Joining a MultiWorld Game
1. Launch Daxanadu.exe
2. From the Main menu, go to the `ARCHIPELAGO` menu. Enter the server's address, slot name, and password. Then select `PLAY`.
3. Enjoy!
To continue a game, follow the same connection steps.
Connecting with a different seed won't erase your progress in other seeds.
## Archipelago Text Client
We recommend having Archipelago's Text Client open on the side to keep track of what items you receive and send.
Daxanadu doesn't display messages. You'll only get popups when picking them up.
## Auto-Tracking
Daxanadu has an integrated tracker that can be toggled in the options.

View File

@@ -47,17 +47,6 @@ def get_flag(data, flag):
bit = int(0x80 / (2 ** (flag % 8)))
return (data[byte] & bit) > 0
def validate_read_state(data1, data2):
validation_array = bytes([0x01, 0x46, 0x46, 0x4D, 0x51, 0x52])
if data1 is None or data2 is None:
return False
for i in range(6):
if data1[i] != validation_array[i] or data2[i] != validation_array[i]:
return False;
return True
class FFMQClient(SNIClient):
game = "Final Fantasy Mystic Quest"
@@ -78,11 +67,11 @@ class FFMQClient(SNIClient):
async def game_watcher(self, ctx):
from SNIClient import snes_buffered_write, snes_flush_writes, snes_read
check_1 = await snes_read(ctx, 0xF53749, 6)
check_1 = await snes_read(ctx, 0xF53749, 1)
received = await snes_read(ctx, RECEIVED_DATA[0], RECEIVED_DATA[1])
data = await snes_read(ctx, READ_DATA_START, READ_DATA_END - READ_DATA_START)
check_2 = await snes_read(ctx, 0xF53749, 6)
if not validate_read_state(check_1, check_2):
check_2 = await snes_read(ctx, 0xF53749, 1)
if check_1 != b'\x01' or check_2 != b'\x01':
return
def get_range(data_range):

View File

@@ -2,8 +2,8 @@
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/).
**Python 3.13 is not supported yet.**
1. Python 3.9 "universal2" or newer from the [macOS Python downloads page](https://www.python.org/downloads/macos/).
**Python 3.11 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).
4. The asset with darwin in the name from the [SNI Github releases page](https://github.com/alttpo/sni/releases).

View File

@@ -104,7 +104,7 @@ class StartWithMapScrolls(Toggle):
class ResetLevelOnDeath(DefaultOnToggle):
"""When dying, levels are reset and monsters respawned. But inventory and checks are kept.
Turning this setting off is considered easy mode. Good for new players that don't know the levels well."""
display_name = "Reset Level on Death"
display_message="Reset level on death"
class CheckSanity(Toggle):

View File

@@ -9,7 +9,11 @@ import ast
import jinja2
from ast import unparse
try:
from ast import unparse
except ImportError:
# Py 3.8 and earlier compatibility module
from astunparse import unparse
from Utils import get_text_between

View File

@@ -300,7 +300,7 @@ class PlandoCharmCosts(OptionDict):
display_name = "Charm Notch Cost Plando"
valid_keys = frozenset(charm_names)
schema = Schema({
Optional(name): And(int, lambda n: 6 >= n >= 0, error="Charm costs must be integers in the range 0-6.") for name in charm_names
Optional(name): And(int, lambda n: 6 >= n >= 0) for name in charm_names
})
def get_costs(self, charm_costs: typing.List[int]) -> typing.List[int]:

View File

@@ -231,7 +231,7 @@ class HKWorld(World):
all_event_names.update(set(godhome_event_names))
# Link regions
for event_name in sorted(all_event_names):
for event_name in all_event_names:
#if event_name in wp_exclusions:
# continue
loc = HKLocation(self.player, event_name, None, menu_region)

View File

@@ -0,0 +1 @@
astunparse>=1.6.3; python_version <= '3.8'

View File

@@ -34,7 +34,7 @@ def create_locations(player: int, regions_table: Dict[str, LandstalkerRegion], n
for data in WORLD_PATHS_JSON:
if "requiredNodes" in data:
regions_with_entrance_checks.extend([region_id for region_id in data["requiredNodes"]])
regions_with_entrance_checks = sorted(set(regions_with_entrance_checks))
regions_with_entrance_checks = list(set(regions_with_entrance_checks))
for region_id in regions_with_entrance_checks:
region = regions_table[region_id]
location = LandstalkerLocation(player, 'event_visited_' + region_id, None, region, "event")

View File

@@ -118,7 +118,7 @@ class L2ACWorld(World):
L2ACItem("Progressive chest access", ItemClassification.progression, None, self.player))
chest_access.show_in_spoiler = False
ancient_dungeon.locations.append(chest_access)
for iris in sorted(self.item_name_groups["Iris treasures"]):
for iris in self.item_name_groups["Iris treasures"]:
treasure_name: str = f"Iris treasure {self.item_name_to_id[iris] - self.item_name_to_id['Iris sword'] + 1}"
iris_treasure: Location = \
L2ACLocation(self.player, treasure_name, self.location_name_to_id[treasure_name], ancient_dungeon)

View File

@@ -1,5 +1,5 @@
import logging
from typing import Any, ClassVar, TextIO
from typing import Any, ClassVar, Dict, List, Optional, Set, TextIO
from BaseClasses import CollectionState, Entrance, Item, ItemClassification, MultiWorld, Tutorial
from Options import Accessibility
@@ -120,16 +120,16 @@ class MessengerWorld(World):
required_seals: int = 0
created_seals: int = 0
total_shards: int = 0
shop_prices: dict[str, int]
figurine_prices: dict[str, int]
_filler_items: list[str]
starting_portals: list[str]
plando_portals: list[str]
spoiler_portal_mapping: dict[str, str]
portal_mapping: list[int]
transitions: list[Entrance]
shop_prices: Dict[str, int]
figurine_prices: Dict[str, int]
_filler_items: List[str]
starting_portals: List[str]
plando_portals: List[str]
spoiler_portal_mapping: Dict[str, str]
portal_mapping: List[int]
transitions: List[Entrance]
reachable_locs: int = 0
filler: dict[str, int]
filler: Dict[str, int]
def generate_early(self) -> None:
if self.options.goal == Goal.option_power_seal_hunt:
@@ -178,7 +178,7 @@ class MessengerWorld(World):
for reg_name in sub_region]
for region in complex_regions:
region_name = region.name.removeprefix(f"{region.parent} - ")
region_name = region.name.replace(f"{region.parent} - ", "")
connection_data = CONNECTIONS[region.parent][region_name]
for exit_region in connection_data:
region.connect(self.multiworld.get_region(exit_region, self.player))
@@ -191,7 +191,7 @@ class MessengerWorld(World):
# create items that are always in the item pool
main_movement_items = ["Rope Dart", "Wingsuit"]
precollected_names = [item.name for item in self.multiworld.precollected_items[self.player]]
itempool: list[MessengerItem] = [
itempool: List[MessengerItem] = [
self.create_item(item)
for item in self.item_name_to_id
if item not in {
@@ -290,7 +290,7 @@ class MessengerWorld(World):
for portal, output in portal_info:
spoiler.set_entrance(f"{portal} Portal", output, "I can write anything I want here lmao", self.player)
def fill_slot_data(self) -> dict[str, Any]:
def fill_slot_data(self) -> Dict[str, Any]:
slot_data = {
"shop": {SHOP_ITEMS[item].internal_name: price for item, price in self.shop_prices.items()},
"figures": {FIGURINES[item].internal_name: price for item, price in self.figurine_prices.items()},
@@ -316,7 +316,7 @@ class MessengerWorld(World):
return self._filler_items.pop(0)
def create_item(self, name: str) -> MessengerItem:
item_id: int | None = self.item_name_to_id.get(name, None)
item_id: Optional[int] = self.item_name_to_id.get(name, None)
return MessengerItem(
name,
ItemClassification.progression if item_id is None else self.get_item_classification(name),
@@ -351,7 +351,7 @@ class MessengerWorld(World):
return ItemClassification.filler
@classmethod
def create_group(cls, multiworld: "MultiWorld", new_player_id: int, players: set[int]) -> World:
def create_group(cls, multiworld: "MultiWorld", new_player_id: int, players: Set[int]) -> World:
group = super().create_group(multiworld, new_player_id, players)
assert isinstance(group, MessengerWorld)

View File

@@ -5,7 +5,7 @@ import os.path
import subprocess
import urllib.request
from shutil import which
from typing import Any
from typing import Any, Optional
from zipfile import ZipFile
from Utils import open_file
@@ -17,7 +17,7 @@ from Utils import is_windows, messagebox, tuplize_version
MOD_URL = "https://api.github.com/repos/alwaysintreble/TheMessengerRandomizerModAP/releases/latest"
def ask_yes_no_cancel(title: str, text: str) -> bool | None:
def ask_yes_no_cancel(title: str, text: str) -> Optional[bool]:
"""
Wrapper for tkinter.messagebox.askyesnocancel, that creates a popup dialog box with yes, no, and cancel buttons.
@@ -33,6 +33,7 @@ def ask_yes_no_cancel(title: str, text: str) -> bool | None:
return ret
def launch_game(*args) -> None:
"""Check the game installation, then launch it"""
def courier_installed() -> bool:

View File

@@ -1,4 +1,6 @@
CONNECTIONS: dict[str, dict[str, list[str]]] = {
from typing import Dict, List
CONNECTIONS: Dict[str, Dict[str, List[str]]] = {
"Ninja Village": {
"Right": [
"Autumn Hills - Left",
@@ -638,7 +640,7 @@ CONNECTIONS: dict[str, dict[str, list[str]]] = {
},
}
RANDOMIZED_CONNECTIONS: dict[str, str] = {
RANDOMIZED_CONNECTIONS: Dict[str, str] = {
"Ninja Village - Right": "Autumn Hills - Left",
"Autumn Hills - Left": "Ninja Village - Right",
"Autumn Hills - Right": "Forlorn Temple - Left",
@@ -678,7 +680,7 @@ RANDOMIZED_CONNECTIONS: dict[str, str] = {
"Sunken Shrine - Left": "Howling Grotto - Bottom",
}
TRANSITIONS: list[str] = [
TRANSITIONS: List[str] = [
"Ninja Village - Right",
"Autumn Hills - Left",
"Autumn Hills - Right",

View File

@@ -2,7 +2,7 @@ from .shop import FIGURINES, SHOP_ITEMS
# items
# listing individual groups first for easy lookup
NOTES: list[str] = [
NOTES = [
"Key of Hope",
"Key of Chaos",
"Key of Courage",
@@ -11,7 +11,7 @@ NOTES: list[str] = [
"Key of Symbiosis",
]
PROG_ITEMS: list[str] = [
PROG_ITEMS = [
"Wingsuit",
"Rope Dart",
"Lightfoot Tabi",
@@ -28,18 +28,18 @@ PROG_ITEMS: list[str] = [
"Seashell",
]
PHOBEKINS: list[str] = [
PHOBEKINS = [
"Necro",
"Pyro",
"Claustro",
"Acro",
]
USEFUL_ITEMS: list[str] = [
USEFUL_ITEMS = [
"Windmill Shuriken",
]
FILLER: dict[str, int] = {
FILLER = {
"Time Shard": 5,
"Time Shard (10)": 10,
"Time Shard (50)": 20,
@@ -48,13 +48,13 @@ FILLER: dict[str, int] = {
"Time Shard (500)": 5,
}
TRAPS: dict[str, int] = {
TRAPS = {
"Teleport Trap": 5,
"Prophecy Trap": 10,
}
# item_name_to_id needs to be deterministic and match upstream
ALL_ITEMS: list[str] = [
ALL_ITEMS = [
*NOTES,
"Windmill Shuriken",
"Wingsuit",
@@ -83,7 +83,7 @@ ALL_ITEMS: list[str] = [
# locations
# the names of these don't actually matter, but using the upstream's names for now
# order must be exactly the same as upstream
ALWAYS_LOCATIONS: list[str] = [
ALWAYS_LOCATIONS = [
# notes
"Sunken Shrine - Key of Love",
"Corrupted Future - Key of Courage",
@@ -160,7 +160,7 @@ ALWAYS_LOCATIONS: list[str] = [
"Elemental Skylands Seal - Fire",
]
BOSS_LOCATIONS: list[str] = [
BOSS_LOCATIONS = [
"Autumn Hills - Leaf Golem",
"Catacombs - Ruxxtin",
"Howling Grotto - Emerald Golem",

View File

@@ -1,4 +1,5 @@
from dataclasses import dataclass
from typing import Dict
from schema import And, Optional, Or, Schema
@@ -166,7 +167,7 @@ class ShopPrices(Range):
default = 100
def planned_price(location: str) -> dict[Optional, Or]:
def planned_price(location: str) -> Dict[Optional, Or]:
return {
Optional(location): Or(
And(int, lambda n: n >= 0),

View File

@@ -1,5 +1,5 @@
from copy import deepcopy
from typing import TYPE_CHECKING
from typing import List, TYPE_CHECKING
from BaseClasses import CollectionState, PlandoOptions
from Options import PlandoConnection
@@ -8,7 +8,7 @@ if TYPE_CHECKING:
from . import MessengerWorld
PORTALS: list[str] = [
PORTALS = [
"Autumn Hills",
"Riviere Turquoise",
"Howling Grotto",
@@ -18,7 +18,7 @@ PORTALS: list[str] = [
]
SHOP_POINTS: dict[str, list[str]] = {
SHOP_POINTS = {
"Autumn Hills": [
"Climbing Claws",
"Hope Path",
@@ -113,7 +113,7 @@ SHOP_POINTS: dict[str, list[str]] = {
}
CHECKPOINTS: dict[str, list[str]] = {
CHECKPOINTS = {
"Autumn Hills": [
"Hope Latch",
"Key of Hope",
@@ -186,7 +186,7 @@ CHECKPOINTS: dict[str, list[str]] = {
}
REGION_ORDER: list[str] = [
REGION_ORDER = [
"Autumn Hills",
"Forlorn Temple",
"Catacombs",
@@ -228,7 +228,7 @@ def shuffle_portals(world: "MessengerWorld") -> None:
return parent
def handle_planned_portals(plando_connections: list[PlandoConnection]) -> None:
def handle_planned_portals(plando_connections: List[PlandoConnection]) -> None:
"""checks the provided plando connections for portals and connects them"""
nonlocal available_portals

View File

@@ -1,4 +1,7 @@
LOCATIONS: dict[str, list[str]] = {
from typing import Dict, List
LOCATIONS: Dict[str, List[str]] = {
"Ninja Village - Nest": [
"Ninja Village - Candle",
"Ninja Village - Astral Seed",
@@ -198,7 +201,7 @@ LOCATIONS: dict[str, list[str]] = {
}
SUB_REGIONS: dict[str, list[str]] = {
SUB_REGIONS: Dict[str, List[str]] = {
"Ninja Village": [
"Right",
],
@@ -382,7 +385,7 @@ SUB_REGIONS: dict[str, list[str]] = {
# order is slightly funky here for back compat
MEGA_SHARDS: dict[str, list[str]] = {
MEGA_SHARDS: Dict[str, List[str]] = {
"Autumn Hills - Lakeside Checkpoint": ["Autumn Hills Mega Shard"],
"Forlorn Temple - Outside Shop": ["Hidden Entrance Mega Shard"],
"Catacombs - Top Left": ["Catacombs Mega Shard"],
@@ -411,7 +414,7 @@ MEGA_SHARDS: dict[str, list[str]] = {
}
REGION_CONNECTIONS: dict[str, dict[str, str]] = {
REGION_CONNECTIONS: Dict[str, Dict[str, str]] = {
"Menu": {"Tower HQ": "Start Game"},
"Tower HQ": {
"Autumn Hills - Portal": "ToTHQ Autumn Hills Portal",
@@ -433,7 +436,7 @@ REGION_CONNECTIONS: dict[str, dict[str, str]] = {
# regions that don't have sub-regions
LEVELS: list[str] = [
LEVELS: List[str] = [
"Menu",
"Tower HQ",
"The Shop",

View File

@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import Dict, TYPE_CHECKING
from BaseClasses import CollectionState
from worlds.generic.Rules import CollectionRule, add_rule, allow_self_locking_items
@@ -12,9 +12,9 @@ if TYPE_CHECKING:
class MessengerRules:
player: int
world: "MessengerWorld"
connection_rules: dict[str, CollectionRule]
region_rules: dict[str, CollectionRule]
location_rules: dict[str, CollectionRule]
connection_rules: Dict[str, CollectionRule]
region_rules: Dict[str, CollectionRule]
location_rules: Dict[str, CollectionRule]
maximum_price: int
required_seals: int

View File

@@ -1,11 +1,11 @@
from typing import NamedTuple, TYPE_CHECKING
from typing import Dict, List, NamedTuple, Optional, Set, TYPE_CHECKING, Tuple, Union
if TYPE_CHECKING:
from . import MessengerWorld
else:
MessengerWorld = object
PROG_SHOP_ITEMS: list[str] = [
PROG_SHOP_ITEMS: List[str] = [
"Path of Resilience",
"Meditation",
"Strike of the Ninja",
@@ -14,7 +14,7 @@ PROG_SHOP_ITEMS: list[str] = [
"Aerobatics Warrior",
]
USEFUL_SHOP_ITEMS: list[str] = [
USEFUL_SHOP_ITEMS: List[str] = [
"Karuta Plates",
"Serendipitous Bodies",
"Kusari Jacket",
@@ -29,10 +29,10 @@ class ShopData(NamedTuple):
internal_name: str
min_price: int
max_price: int
prerequisite: str | set[str] | None = None
prerequisite: Optional[Union[str, Set[str]]] = None
SHOP_ITEMS: dict[str, ShopData] = {
SHOP_ITEMS: Dict[str, ShopData] = {
"Karuta Plates": ShopData("HP_UPGRADE_1", 20, 200),
"Serendipitous Bodies": ShopData("ENEMY_DROP_HP", 20, 300, "The Shop - Karuta Plates"),
"Path of Resilience": ShopData("DAMAGE_REDUCTION", 100, 500, "The Shop - Serendipitous Bodies"),
@@ -56,7 +56,7 @@ SHOP_ITEMS: dict[str, ShopData] = {
"Focused Power Sense": ShopData("POWER_SEAL_WORLD_MAP", 300, 600, "The Shop - Power Sense"),
}
FIGURINES: dict[str, ShopData] = {
FIGURINES: Dict[str, ShopData] = {
"Green Kappa Figurine": ShopData("GREEN_KAPPA", 100, 500),
"Blue Kappa Figurine": ShopData("BLUE_KAPPA", 100, 500),
"Ountarde Figurine": ShopData("OUNTARDE", 100, 500),
@@ -73,12 +73,12 @@ FIGURINES: dict[str, ShopData] = {
}
def shuffle_shop_prices(world: MessengerWorld) -> tuple[dict[str, int], dict[str, int]]:
def shuffle_shop_prices(world: MessengerWorld) -> Tuple[Dict[str, int], Dict[str, int]]:
shop_price_mod = world.options.shop_price.value
shop_price_planned = world.options.shop_price_plan
shop_prices: dict[str, int] = {}
figurine_prices: dict[str, int] = {}
shop_prices: Dict[str, int] = {}
figurine_prices: Dict[str, int] = {}
for item, price in shop_price_planned.value.items():
if not isinstance(price, int):
price = world.random.choices(list(price.keys()), weights=list(price.values()))[0]

View File

@@ -1,5 +1,5 @@
from functools import cached_property
from typing import TYPE_CHECKING
from typing import Optional, TYPE_CHECKING
from BaseClasses import CollectionState, Entrance, Item, ItemClassification, Location, Region
from .regions import LOCATIONS, MEGA_SHARDS
@@ -10,14 +10,14 @@ if TYPE_CHECKING:
class MessengerEntrance(Entrance):
world: "MessengerWorld | None" = None
world: Optional["MessengerWorld"] = None
class MessengerRegion(Region):
parent: str
entrance_type = MessengerEntrance
def __init__(self, name: str, world: "MessengerWorld", parent: str | None = None) -> None:
def __init__(self, name: str, world: "MessengerWorld", parent: Optional[str] = None) -> None:
super().__init__(name, world.player, world.multiworld)
self.parent = parent
locations = []
@@ -48,7 +48,7 @@ class MessengerRegion(Region):
class MessengerLocation(Location):
game = "The Messenger"
def __init__(self, player: int, name: str, loc_id: int | None, parent: MessengerRegion) -> None:
def __init__(self, player: int, name: str, loc_id: Optional[int], parent: MessengerRegion) -> None:
super().__init__(player, name, loc_id, parent)
if loc_id is None:
if name == "Rescue Phantom":
@@ -59,7 +59,7 @@ class MessengerLocation(Location):
class MessengerShopLocation(MessengerLocation):
@cached_property
def cost(self) -> int:
name = self.name.removeprefix("The Shop - ")
name = self.name.replace("The Shop - ", "") # TODO use `remove_prefix` when 3.8 finally gets dropped
world = self.parent_region.multiworld.worlds[self.player]
shop_data = SHOP_ITEMS[name]
if shop_data.prerequisite:

View File

@@ -77,7 +77,7 @@ class PlandoTest(MessengerTestBase):
loc = f"The Shop - {loc}"
self.assertLessEqual(price, self.multiworld.get_location(loc, self.player).cost)
self.assertTrue(loc.removeprefix("The Shop - ") in SHOP_ITEMS)
self.assertTrue(loc.replace("The Shop - ", "") in SHOP_ITEMS)
self.assertEqual(len(prices), len(SHOP_ITEMS))
figures = self.world.figurine_prices

View File

@@ -183,7 +183,7 @@ class MuseDashWorld(World):
if album:
return MuseDashSongItem(name, self.player, album)
song = self.md_collection.song_items[name]
song = self.md_collection.song_items.get(name)
return MuseDashSongItem(name, self.player, song)
def get_filler_item_name(self) -> str:

View File

@@ -1,7 +1,7 @@
import typing
import random
from dataclasses import dataclass
from Options import Option, DefaultOnToggle, Toggle, Range, OptionSet, DeathLink, PlandoConnections, \
from Options import Option, DefaultOnToggle, Toggle, Range, OptionList, OptionSet, DeathLink, PlandoConnections, \
PerGameCommonOptions, OptionGroup
from .EntranceShuffle import entrance_shuffle_table
from .LogicTricks import normalized_name_tricks
@@ -1272,7 +1272,7 @@ sfx_options: typing.Dict[str, type(Option)] = {
}
class LogicTricks(OptionSet):
class LogicTricks(OptionList):
"""Set various tricks for logic in Ocarina of Time.
Format as a comma-separated list of "nice" names: ["Fewer Tunic Requirements", "Hidden Grottos without Stone of Agony"].
A full list of supported tricks can be found at:

View File

@@ -2,7 +2,6 @@
### Features
- Added many new item and location groups.
- Added a Swedish translation of the setup guide.
- The client communicates map transitions to any trackers connected to the slot.
- Added the player's Normalize Encounter Rates option to slot data for trackers.

View File

@@ -15,11 +15,11 @@ import settings
from worlds.AutoWorld import WebWorld, World
from .client import PokemonEmeraldClient # Unused, but required to register with BizHawkClient
from .data import LEGENDARY_POKEMON, MapData, SpeciesData, TrainerData, LocationCategory, data as emerald_data
from .groups import ITEM_GROUPS, LOCATION_GROUPS
from .items import PokemonEmeraldItem, create_item_label_to_code_map, get_item_classification, offset_item_value
from .locations import (PokemonEmeraldLocation, create_location_label_to_id_map, create_locations_by_category,
set_free_fly, set_legendary_cave_entrances)
from .data import LEGENDARY_POKEMON, MapData, SpeciesData, TrainerData, data as emerald_data
from .items import (ITEM_GROUPS, PokemonEmeraldItem, create_item_label_to_code_map, get_item_classification,
offset_item_value)
from .locations import (LOCATION_GROUPS, PokemonEmeraldLocation, create_location_label_to_id_map,
create_locations_with_tags, set_free_fly, set_legendary_cave_entrances)
from .opponents import randomize_opponent_parties
from .options import (Goal, DarkCavesRequireFlash, HmRequirements, ItemPoolType, PokemonEmeraldOptions,
RandomizeWildPokemon, RandomizeBadges, RandomizeHms, NormanRequirement)
@@ -133,10 +133,9 @@ class PokemonEmeraldWorld(World):
@classmethod
def stage_assert_generate(cls, multiworld: MultiWorld) -> None:
from .sanity_check import validate_regions, validate_group_maps
from .sanity_check import validate_regions
assert validate_regions()
assert validate_group_maps()
def get_filler_item_name(self) -> str:
return "Great Ball"
@@ -238,32 +237,24 @@ class PokemonEmeraldWorld(World):
def create_regions(self) -> None:
from .regions import create_regions
all_regions = create_regions(self)
regions = create_regions(self)
# Categories with progression items always included
categories = {
LocationCategory.BADGE,
LocationCategory.HM,
LocationCategory.KEY,
LocationCategory.ROD,
LocationCategory.BIKE,
LocationCategory.TICKET
}
tags = {"Badge", "HM", "KeyItem", "Rod", "Bike", "EventTicket"} # Tags with progression items always included
if self.options.overworld_items:
categories.add(LocationCategory.OVERWORLD_ITEM)
tags.add("OverworldItem")
if self.options.hidden_items:
categories.add(LocationCategory.HIDDEN_ITEM)
tags.add("HiddenItem")
if self.options.npc_gifts:
categories.add(LocationCategory.GIFT)
tags.add("NpcGift")
if self.options.berry_trees:
categories.add(LocationCategory.BERRY_TREE)
tags.add("BerryTree")
if self.options.dexsanity:
categories.add(LocationCategory.POKEDEX)
tags.add("Pokedex")
if self.options.trainersanity:
categories.add(LocationCategory.TRAINER)
create_locations_by_category(self, all_regions, categories)
tags.add("Trainer")
create_locations_with_tags(self, regions, tags)
self.multiworld.regions.extend(all_regions.values())
self.multiworld.regions.extend(regions.values())
# Exclude locations which are always locked behind the player's goal
def exclude_locations(location_names: List[str]):
@@ -334,21 +325,21 @@ class PokemonEmeraldWorld(World):
# Filter progression items which shouldn't be shuffled into the itempool.
# Their locations will still exist, but event items will be placed and
# locked at their vanilla locations instead.
filter_categories = set()
filter_tags = set()
if not self.options.key_items:
filter_categories.add(LocationCategory.KEY)
filter_tags.add("KeyItem")
if not self.options.rods:
filter_categories.add(LocationCategory.ROD)
filter_tags.add("Rod")
if not self.options.bikes:
filter_categories.add(LocationCategory.BIKE)
filter_tags.add("Bike")
if not self.options.event_tickets:
filter_categories.add(LocationCategory.TICKET)
filter_tags.add("EventTicket")
if self.options.badges in {RandomizeBadges.option_vanilla, RandomizeBadges.option_shuffle}:
filter_categories.add(LocationCategory.BADGE)
filter_tags.add("Badge")
if self.options.hms in {RandomizeHms.option_vanilla, RandomizeHms.option_shuffle}:
filter_categories.add(LocationCategory.HM)
filter_tags.add("HM")
# If Badges and HMs are set to the `shuffle` option, don't add them to
# the normal item pool, but do create their items and save them and
@@ -356,17 +347,17 @@ class PokemonEmeraldWorld(World):
if self.options.badges == RandomizeBadges.option_shuffle:
self.badge_shuffle_info = [
(location, self.create_item_by_code(location.default_item_code))
for location in [l for l in item_locations if emerald_data.locations[l.key].category == LocationCategory.BADGE]
for location in [l for l in item_locations if "Badge" in l.tags]
]
if self.options.hms == RandomizeHms.option_shuffle:
self.hm_shuffle_info = [
(location, self.create_item_by_code(location.default_item_code))
for location in [l for l in item_locations if emerald_data.locations[l.key].category == LocationCategory.HM]
for location in [l for l in item_locations if "HM" in l.tags]
]
# Filter down locations to actual items that will be filled and create
# the itempool.
item_locations = [location for location in item_locations if emerald_data.locations[location.key].category not in filter_categories]
item_locations = [location for location in item_locations if len(filter_tags & location.tags) == 0]
default_itempool = [self.create_item_by_code(location.default_item_code) for location in item_locations]
# Take the itempool as-is
@@ -375,8 +366,7 @@ class PokemonEmeraldWorld(World):
# Recreate the itempool from random items
elif self.options.item_pool_type in (ItemPoolType.option_diverse, ItemPoolType.option_diverse_balanced):
item_categories = ["Ball", "Healing", "Rare Candy", "Vitamin", "Evolution Stone",
"Money", "TM", "Held", "Misc", "Berry"]
item_categories = ["Ball", "Heal", "Candy", "Vitamin", "EvoStone", "Money", "TM", "Held", "Misc", "Berry"]
# Count occurrences of types of vanilla items in pool
item_category_counter = Counter()
@@ -446,26 +436,25 @@ class PokemonEmeraldWorld(World):
# Key items which are considered in access rules but not randomized are converted to events and placed
# in their vanilla locations so that the player can have them in their inventory for logic.
def convert_unrandomized_items_to_events(category: LocationCategory) -> None:
def convert_unrandomized_items_to_events(tag: str) -> None:
for location in self.multiworld.get_locations(self.player):
assert isinstance(location, PokemonEmeraldLocation)
if location.key is not None and emerald_data.locations[location.key].category == category:
if location.tags is not None and tag in location.tags:
location.place_locked_item(self.create_event(self.item_id_to_name[location.default_item_code]))
location.progress_type = LocationProgressType.DEFAULT
location.address = None
if self.options.badges == RandomizeBadges.option_vanilla:
convert_unrandomized_items_to_events(LocationCategory.BADGE)
convert_unrandomized_items_to_events("Badge")
if self.options.hms == RandomizeHms.option_vanilla:
convert_unrandomized_items_to_events(LocationCategory.HM)
convert_unrandomized_items_to_events("HM")
if not self.options.rods:
convert_unrandomized_items_to_events(LocationCategory.ROD)
convert_unrandomized_items_to_events("Rod")
if not self.options.bikes:
convert_unrandomized_items_to_events(LocationCategory.BIKE)
convert_unrandomized_items_to_events("Bike")
if not self.options.event_tickets:
convert_unrandomized_items_to_events(LocationCategory.TICKET)
convert_unrandomized_items_to_events("EventTicket")
if not self.options.key_items:
convert_unrandomized_items_to_events(LocationCategory.KEY)
convert_unrandomized_items_to_events("KeyItem")
def pre_fill(self) -> None:
# Badges and HMs that are set to shuffle need to be placed at

View File

@@ -117,21 +117,6 @@ class ItemData(NamedTuple):
tags: FrozenSet[str]
class LocationCategory(IntEnum):
BADGE = 0
HM = 1
KEY = 2
ROD = 3
BIKE = 4
TICKET = 5
OVERWORLD_ITEM = 6
HIDDEN_ITEM = 7
GIFT = 8
BERRY_TREE = 9
TRAINER = 10
POKEDEX = 11
class LocationData(NamedTuple):
name: str
label: str
@@ -139,7 +124,6 @@ class LocationData(NamedTuple):
default_item: int
address: Union[int, List[int]]
flag: int
category: LocationCategory
tags: FrozenSet[str]
@@ -447,7 +431,6 @@ def _init() -> None:
location_json["default_item"],
[location_json["address"]] + [j["address"] for j in alternate_rival_jsons],
location_json["flag"],
LocationCategory[location_attributes_json[location_name]["category"]],
frozenset(location_attributes_json[location_name]["tags"])
)
else:
@@ -458,7 +441,6 @@ def _init() -> None:
location_json["default_item"],
location_json["address"],
location_json["flag"],
LocationCategory[location_attributes_json[location_name]["category"]],
frozenset(location_attributes_json[location_name]["tags"])
)
new_region.locations.append(location_name)
@@ -966,7 +948,6 @@ def _init() -> None:
evo_stage_to_ball_map[evo_stage],
data.locations[dex_location_name].address,
data.locations[dex_location_name].flag,
data.locations[dex_location_name].category,
data.locations[dex_location_name].tags
)

View File

@@ -52,49 +52,49 @@
"ITEM_HM_CUT": {
"label": "HM01 Cut",
"classification": "PROGRESSION",
"tags": ["HM", "HM01", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": 420
},
"ITEM_HM_FLY": {
"label": "HM02 Fly",
"classification": "PROGRESSION",
"tags": ["HM", "HM02", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": 421
},
"ITEM_HM_SURF": {
"label": "HM03 Surf",
"classification": "PROGRESSION",
"tags": ["HM", "HM03", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": 422
},
"ITEM_HM_STRENGTH": {
"label": "HM04 Strength",
"classification": "PROGRESSION",
"tags": ["HM", "HM04", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": 423
},
"ITEM_HM_FLASH": {
"label": "HM05 Flash",
"classification": "PROGRESSION",
"tags": ["HM", "HM05", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": 424
},
"ITEM_HM_ROCK_SMASH": {
"label": "HM06 Rock Smash",
"classification": "PROGRESSION",
"tags": ["HM", "HM06", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": 425
},
"ITEM_HM_WATERFALL": {
"label": "HM07 Waterfall",
"classification": "PROGRESSION",
"tags": ["HM", "HM07", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": 737
},
"ITEM_HM_DIVE": {
"label": "HM08 Dive",
"classification": "PROGRESSION",
"tags": ["HM", "HM08", "Unique"],
"tags": ["HM", "Unique"],
"modern_id": null
},
@@ -375,169 +375,169 @@
"ITEM_POTION": {
"label": "Potion",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 17
},
"ITEM_ANTIDOTE": {
"label": "Antidote",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 18
},
"ITEM_BURN_HEAL": {
"label": "Burn Heal",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 19
},
"ITEM_ICE_HEAL": {
"label": "Ice Heal",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 20
},
"ITEM_AWAKENING": {
"label": "Awakening",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 21
},
"ITEM_PARALYZE_HEAL": {
"label": "Paralyze Heal",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 22
},
"ITEM_FULL_RESTORE": {
"label": "Full Restore",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 23
},
"ITEM_MAX_POTION": {
"label": "Max Potion",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 24
},
"ITEM_HYPER_POTION": {
"label": "Hyper Potion",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 25
},
"ITEM_SUPER_POTION": {
"label": "Super Potion",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 26
},
"ITEM_FULL_HEAL": {
"label": "Full Heal",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 27
},
"ITEM_REVIVE": {
"label": "Revive",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 28
},
"ITEM_MAX_REVIVE": {
"label": "Max Revive",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 29
},
"ITEM_FRESH_WATER": {
"label": "Fresh Water",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 30
},
"ITEM_SODA_POP": {
"label": "Soda Pop",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 31
},
"ITEM_LEMONADE": {
"label": "Lemonade",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 32
},
"ITEM_MOOMOO_MILK": {
"label": "Moomoo Milk",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 33
},
"ITEM_ENERGY_POWDER": {
"label": "Energy Powder",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 34
},
"ITEM_ENERGY_ROOT": {
"label": "Energy Root",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 35
},
"ITEM_HEAL_POWDER": {
"label": "Heal Powder",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 36
},
"ITEM_REVIVAL_HERB": {
"label": "Revival Herb",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 37
},
"ITEM_ETHER": {
"label": "Ether",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 38
},
"ITEM_MAX_ETHER": {
"label": "Max Ether",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 39
},
"ITEM_ELIXIR": {
"label": "Elixir",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 40
},
"ITEM_MAX_ELIXIR": {
"label": "Max Elixir",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 41
},
"ITEM_LAVA_COOKIE": {
"label": "Lava Cookie",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 42
},
"ITEM_BERRY_JUICE": {
"label": "Berry Juice",
"classification": "FILLER",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 43
},
"ITEM_SACRED_ASH": {
"label": "Sacred Ash",
"classification": "USEFUL",
"tags": ["Healing"],
"tags": ["Heal"],
"modern_id": 44
},
@@ -736,19 +736,19 @@
},
"ITEM_BLACK_FLUTE": {
"label": "Black Flute",
"classification": "USEFUL",
"classification": "FILLER",
"tags": ["Misc"],
"modern_id": 68
},
"ITEM_WHITE_FLUTE": {
"label": "White Flute",
"classification": "USEFUL",
"classification": "FILLER",
"tags": ["Misc"],
"modern_id": 69
},
"ITEM_HEART_SCALE": {
"label": "Heart Scale",
"classification": "USEFUL",
"classification": "FILLER",
"tags": ["Misc"],
"modern_id": 93
},
@@ -757,37 +757,37 @@
"ITEM_SUN_STONE": {
"label": "Sun Stone",
"classification": "USEFUL",
"tags": ["Evolution Stone"],
"tags": ["EvoStone"],
"modern_id": 80
},
"ITEM_MOON_STONE": {
"label": "Moon Stone",
"classification": "USEFUL",
"tags": ["Evolution Stone"],
"tags": ["EvoStone"],
"modern_id": 81
},
"ITEM_FIRE_STONE": {
"label": "Fire Stone",
"classification": "USEFUL",
"tags": ["Evolution Stone"],
"tags": ["EvoStone"],
"modern_id": 82
},
"ITEM_THUNDER_STONE": {
"label": "Thunder Stone",
"classification": "USEFUL",
"tags": ["Evolution Stone"],
"tags": ["EvoStone"],
"modern_id": 83
},
"ITEM_WATER_STONE": {
"label": "Water Stone",
"classification": "USEFUL",
"tags": ["Evolution Stone"],
"tags": ["EvoStone"],
"modern_id": 84
},
"ITEM_LEAF_STONE": {
"label": "Leaf Stone",
"classification": "USEFUL",
"tags": ["Evolution Stone"],
"tags": ["EvoStone"],
"modern_id": 85
},
@@ -1215,7 +1215,7 @@
"ITEM_KINGS_ROCK": {
"label": "King's Rock",
"classification": "USEFUL",
"tags": ["Held", "Evolution Stone"],
"tags": ["Held"],
"modern_id": 221
},
"ITEM_SILVER_POWDER": {
@@ -1245,13 +1245,13 @@
"ITEM_DEEP_SEA_TOOTH": {
"label": "Deep Sea Tooth",
"classification": "USEFUL",
"tags": ["Held", "Evolution Stone"],
"tags": ["Held"],
"modern_id": 226
},
"ITEM_DEEP_SEA_SCALE": {
"label": "Deep Sea Scale",
"classification": "USEFUL",
"tags": ["Held", "Evolution Stone"],
"tags": ["Held"],
"modern_id": 227
},
"ITEM_SMOKE_BALL": {
@@ -1287,7 +1287,7 @@
"ITEM_METAL_COAT": {
"label": "Metal Coat",
"classification": "USEFUL",
"tags": ["Held", "Evolution Stone"],
"tags": ["Held"],
"modern_id": 233
},
"ITEM_LEFTOVERS": {
@@ -1299,7 +1299,7 @@
"ITEM_DRAGON_SCALE": {
"label": "Dragon Scale",
"classification": "USEFUL",
"tags": ["Held", "Evolution Stone"],
"tags": ["Held"],
"modern_id": 235
},
"ITEM_LIGHT_BALL": {
@@ -1401,7 +1401,7 @@
"ITEM_UP_GRADE": {
"label": "Up-Grade",
"classification": "USEFUL",
"tags": ["Held", "Evolution Stone"],
"tags": ["Held"],
"modern_id": 252
},
"ITEM_SHELL_BELL": {

File diff suppressed because it is too large Load Diff

View File

@@ -1,721 +0,0 @@
from typing import Dict, Set
from .data import LocationCategory, data
# Item Groups
ITEM_GROUPS: Dict[str, Set[str]] = {}
for item in data.items.values():
for tag in item.tags:
if tag not in ITEM_GROUPS:
ITEM_GROUPS[tag] = set()
ITEM_GROUPS[tag].add(item.label)
# Location Groups
_LOCATION_GROUP_MAPS = {
"Abandoned Ship": {
"MAP_ABANDONED_SHIP_CAPTAINS_OFFICE",
"MAP_ABANDONED_SHIP_CORRIDORS_1F",
"MAP_ABANDONED_SHIP_CORRIDORS_B1F",
"MAP_ABANDONED_SHIP_DECK",
"MAP_ABANDONED_SHIP_HIDDEN_FLOOR_CORRIDORS",
"MAP_ABANDONED_SHIP_HIDDEN_FLOOR_ROOMS",
"MAP_ABANDONED_SHIP_ROOMS2_1F",
"MAP_ABANDONED_SHIP_ROOMS2_B1F",
"MAP_ABANDONED_SHIP_ROOMS_1F",
"MAP_ABANDONED_SHIP_ROOMS_B1F",
"MAP_ABANDONED_SHIP_ROOM_B1F",
"MAP_ABANDONED_SHIP_UNDERWATER1",
"MAP_ABANDONED_SHIP_UNDERWATER2",
},
"Aqua Hideout": {
"MAP_AQUA_HIDEOUT_1F",
"MAP_AQUA_HIDEOUT_B1F",
"MAP_AQUA_HIDEOUT_B2F",
},
"Battle Frontier": {
"MAP_ARTISAN_CAVE_1F",
"MAP_ARTISAN_CAVE_B1F",
"MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_ARENA_CORRIDOR",
"MAP_BATTLE_FRONTIER_BATTLE_ARENA_LOBBY",
"MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR",
"MAP_BATTLE_FRONTIER_BATTLE_DOME_LOBBY",
"MAP_BATTLE_FRONTIER_BATTLE_DOME_PRE_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_FACTORY_LOBBY",
"MAP_BATTLE_FRONTIER_BATTLE_FACTORY_PRE_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_PALACE_CORRIDOR",
"MAP_BATTLE_FRONTIER_BATTLE_PALACE_LOBBY",
"MAP_BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR",
"MAP_BATTLE_FRONTIER_BATTLE_PIKE_LOBBY",
"MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_FINAL",
"MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL",
"MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS",
"MAP_BATTLE_FRONTIER_BATTLE_PIKE_THREE_PATH_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR",
"MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY",
"MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP",
"MAP_BATTLE_FRONTIER_BATTLE_TOWER_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_TOWER_CORRIDOR",
"MAP_BATTLE_FRONTIER_BATTLE_TOWER_ELEVATOR",
"MAP_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY",
"MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_BATTLE_ROOM",
"MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR",
"MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_PARTNER_ROOM",
"MAP_BATTLE_FRONTIER_EXCHANGE_SERVICE_CORNER",
"MAP_BATTLE_FRONTIER_LOUNGE1",
"MAP_BATTLE_FRONTIER_LOUNGE2",
"MAP_BATTLE_FRONTIER_LOUNGE3",
"MAP_BATTLE_FRONTIER_LOUNGE4",
"MAP_BATTLE_FRONTIER_LOUNGE5",
"MAP_BATTLE_FRONTIER_LOUNGE6",
"MAP_BATTLE_FRONTIER_LOUNGE7",
"MAP_BATTLE_FRONTIER_LOUNGE8",
"MAP_BATTLE_FRONTIER_LOUNGE9",
"MAP_BATTLE_FRONTIER_MART",
"MAP_BATTLE_FRONTIER_OUTSIDE_EAST",
"MAP_BATTLE_FRONTIER_OUTSIDE_WEST",
"MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F",
"MAP_BATTLE_FRONTIER_POKEMON_CENTER_2F",
"MAP_BATTLE_FRONTIER_RANKING_HALL",
"MAP_BATTLE_FRONTIER_RECEPTION_GATE",
"MAP_BATTLE_FRONTIER_SCOTTS_HOUSE",
"MAP_BATTLE_PYRAMID_SQUARE01",
"MAP_BATTLE_PYRAMID_SQUARE02",
"MAP_BATTLE_PYRAMID_SQUARE03",
"MAP_BATTLE_PYRAMID_SQUARE04",
"MAP_BATTLE_PYRAMID_SQUARE05",
"MAP_BATTLE_PYRAMID_SQUARE06",
"MAP_BATTLE_PYRAMID_SQUARE07",
"MAP_BATTLE_PYRAMID_SQUARE08",
"MAP_BATTLE_PYRAMID_SQUARE09",
"MAP_BATTLE_PYRAMID_SQUARE10",
"MAP_BATTLE_PYRAMID_SQUARE11",
"MAP_BATTLE_PYRAMID_SQUARE12",
"MAP_BATTLE_PYRAMID_SQUARE13",
"MAP_BATTLE_PYRAMID_SQUARE14",
"MAP_BATTLE_PYRAMID_SQUARE15",
"MAP_BATTLE_PYRAMID_SQUARE16",
},
"Birth Island": {
"MAP_BIRTH_ISLAND_EXTERIOR",
"MAP_BIRTH_ISLAND_HARBOR",
},
"Contest Hall": {
"MAP_CONTEST_HALL",
"MAP_CONTEST_HALL_BEAUTY",
"MAP_CONTEST_HALL_COOL",
"MAP_CONTEST_HALL_CUTE",
"MAP_CONTEST_HALL_SMART",
"MAP_CONTEST_HALL_TOUGH",
},
"Dewford Town": {
"MAP_DEWFORD_TOWN",
"MAP_DEWFORD_TOWN_GYM",
"MAP_DEWFORD_TOWN_HALL",
"MAP_DEWFORD_TOWN_HOUSE1",
"MAP_DEWFORD_TOWN_HOUSE2",
"MAP_DEWFORD_TOWN_POKEMON_CENTER_1F",
"MAP_DEWFORD_TOWN_POKEMON_CENTER_2F",
},
"Ever Grande City": {
"MAP_EVER_GRANDE_CITY",
"MAP_EVER_GRANDE_CITY_CHAMPIONS_ROOM",
"MAP_EVER_GRANDE_CITY_DRAKES_ROOM",
"MAP_EVER_GRANDE_CITY_GLACIAS_ROOM",
"MAP_EVER_GRANDE_CITY_HALL1",
"MAP_EVER_GRANDE_CITY_HALL2",
"MAP_EVER_GRANDE_CITY_HALL3",
"MAP_EVER_GRANDE_CITY_HALL4",
"MAP_EVER_GRANDE_CITY_HALL5",
"MAP_EVER_GRANDE_CITY_HALL_OF_FAME",
"MAP_EVER_GRANDE_CITY_PHOEBES_ROOM",
"MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F",
"MAP_EVER_GRANDE_CITY_POKEMON_CENTER_2F",
"MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F",
"MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_2F",
"MAP_EVER_GRANDE_CITY_SIDNEYS_ROOM",
},
"Fallarbor Town": {
"MAP_FALLARBOR_TOWN",
"MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM",
"MAP_FALLARBOR_TOWN_BATTLE_TENT_CORRIDOR",
"MAP_FALLARBOR_TOWN_BATTLE_TENT_LOBBY",
"MAP_FALLARBOR_TOWN_COZMOS_HOUSE",
"MAP_FALLARBOR_TOWN_MART",
"MAP_FALLARBOR_TOWN_MOVE_RELEARNERS_HOUSE",
"MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F",
"MAP_FALLARBOR_TOWN_POKEMON_CENTER_2F",
},
"Faraway Island": {
"MAP_FARAWAY_ISLAND_ENTRANCE",
"MAP_FARAWAY_ISLAND_INTERIOR",
},
"Fiery Path": {"MAP_FIERY_PATH"},
"Fortree City": {
"MAP_FORTREE_CITY",
"MAP_FORTREE_CITY_DECORATION_SHOP",
"MAP_FORTREE_CITY_GYM",
"MAP_FORTREE_CITY_HOUSE1",
"MAP_FORTREE_CITY_HOUSE2",
"MAP_FORTREE_CITY_HOUSE3",
"MAP_FORTREE_CITY_HOUSE4",
"MAP_FORTREE_CITY_HOUSE5",
"MAP_FORTREE_CITY_MART",
"MAP_FORTREE_CITY_POKEMON_CENTER_1F",
"MAP_FORTREE_CITY_POKEMON_CENTER_2F",
},
"Granite Cave": {
"MAP_GRANITE_CAVE_1F",
"MAP_GRANITE_CAVE_B1F",
"MAP_GRANITE_CAVE_B2F",
"MAP_GRANITE_CAVE_STEVENS_ROOM",
},
"Jagged Pass": {"MAP_JAGGED_PASS"},
"Lavaridge Town": {
"MAP_LAVARIDGE_TOWN",
"MAP_LAVARIDGE_TOWN_GYM_1F",
"MAP_LAVARIDGE_TOWN_GYM_B1F",
"MAP_LAVARIDGE_TOWN_HERB_SHOP",
"MAP_LAVARIDGE_TOWN_HOUSE",
"MAP_LAVARIDGE_TOWN_MART",
"MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F",
"MAP_LAVARIDGE_TOWN_POKEMON_CENTER_2F",
},
"Lilycove City": {
"MAP_LILYCOVE_CITY",
"MAP_LILYCOVE_CITY_CONTEST_HALL",
"MAP_LILYCOVE_CITY_CONTEST_LOBBY",
"MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_1F",
"MAP_LILYCOVE_CITY_COVE_LILY_MOTEL_2F",
"MAP_LILYCOVE_CITY_DEPARTMENT_STORE_1F",
"MAP_LILYCOVE_CITY_DEPARTMENT_STORE_2F",
"MAP_LILYCOVE_CITY_DEPARTMENT_STORE_3F",
"MAP_LILYCOVE_CITY_DEPARTMENT_STORE_4F",
"MAP_LILYCOVE_CITY_DEPARTMENT_STORE_5F",
"MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ELEVATOR",
"MAP_LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP",
"MAP_LILYCOVE_CITY_HARBOR",
"MAP_LILYCOVE_CITY_HOUSE1",
"MAP_LILYCOVE_CITY_HOUSE2",
"MAP_LILYCOVE_CITY_HOUSE3",
"MAP_LILYCOVE_CITY_HOUSE4",
"MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_1F",
"MAP_LILYCOVE_CITY_LILYCOVE_MUSEUM_2F",
"MAP_LILYCOVE_CITY_MOVE_DELETERS_HOUSE",
"MAP_LILYCOVE_CITY_POKEMON_CENTER_1F",
"MAP_LILYCOVE_CITY_POKEMON_CENTER_2F",
"MAP_LILYCOVE_CITY_POKEMON_TRAINER_FAN_CLUB",
},
"Littleroot Town": {
"MAP_INSIDE_OF_TRUCK",
"MAP_LITTLEROOT_TOWN",
"MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_1F",
"MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F",
"MAP_LITTLEROOT_TOWN_MAYS_HOUSE_1F",
"MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F",
"MAP_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB",
},
"Magma Hideout": {
"MAP_MAGMA_HIDEOUT_1F",
"MAP_MAGMA_HIDEOUT_2F_1R",
"MAP_MAGMA_HIDEOUT_2F_2R",
"MAP_MAGMA_HIDEOUT_2F_3R",
"MAP_MAGMA_HIDEOUT_3F_1R",
"MAP_MAGMA_HIDEOUT_3F_2R",
"MAP_MAGMA_HIDEOUT_3F_3R",
"MAP_MAGMA_HIDEOUT_4F",
},
"Marine Cave": {
"MAP_MARINE_CAVE_END",
"MAP_MARINE_CAVE_ENTRANCE",
"MAP_UNDERWATER_MARINE_CAVE",
},
"Mauville City": {
"MAP_MAUVILLE_CITY",
"MAP_MAUVILLE_CITY_BIKE_SHOP",
"MAP_MAUVILLE_CITY_GAME_CORNER",
"MAP_MAUVILLE_CITY_GYM",
"MAP_MAUVILLE_CITY_HOUSE1",
"MAP_MAUVILLE_CITY_HOUSE2",
"MAP_MAUVILLE_CITY_MART",
"MAP_MAUVILLE_CITY_POKEMON_CENTER_1F",
"MAP_MAUVILLE_CITY_POKEMON_CENTER_2F",
},
"Meteor Falls": {
"MAP_METEOR_FALLS_1F_1R",
"MAP_METEOR_FALLS_1F_2R",
"MAP_METEOR_FALLS_B1F_1R",
"MAP_METEOR_FALLS_B1F_2R",
"MAP_METEOR_FALLS_STEVENS_CAVE",
},
"Mirage Tower": {
"MAP_MIRAGE_TOWER_1F",
"MAP_MIRAGE_TOWER_2F",
"MAP_MIRAGE_TOWER_3F",
"MAP_MIRAGE_TOWER_4F",
},
"Mossdeep City": {
"MAP_MOSSDEEP_CITY",
"MAP_MOSSDEEP_CITY_GAME_CORNER_1F",
"MAP_MOSSDEEP_CITY_GAME_CORNER_B1F",
"MAP_MOSSDEEP_CITY_GYM",
"MAP_MOSSDEEP_CITY_HOUSE1",
"MAP_MOSSDEEP_CITY_HOUSE2",
"MAP_MOSSDEEP_CITY_HOUSE3",
"MAP_MOSSDEEP_CITY_HOUSE4",
"MAP_MOSSDEEP_CITY_MART",
"MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F",
"MAP_MOSSDEEP_CITY_POKEMON_CENTER_2F",
"MAP_MOSSDEEP_CITY_SPACE_CENTER_1F",
"MAP_MOSSDEEP_CITY_SPACE_CENTER_2F",
"MAP_MOSSDEEP_CITY_STEVENS_HOUSE",
},
"Mt. Chimney": {
"MAP_MT_CHIMNEY",
"MAP_MT_CHIMNEY_CABLE_CAR_STATION",
},
"Mt. Pyre": {
"MAP_MT_PYRE_1F",
"MAP_MT_PYRE_2F",
"MAP_MT_PYRE_3F",
"MAP_MT_PYRE_4F",
"MAP_MT_PYRE_5F",
"MAP_MT_PYRE_6F",
"MAP_MT_PYRE_EXTERIOR",
"MAP_MT_PYRE_SUMMIT",
},
"Navel Rock": {
"MAP_NAVEL_ROCK_B1F",
"MAP_NAVEL_ROCK_BOTTOM",
"MAP_NAVEL_ROCK_DOWN01",
"MAP_NAVEL_ROCK_DOWN02",
"MAP_NAVEL_ROCK_DOWN03",
"MAP_NAVEL_ROCK_DOWN04",
"MAP_NAVEL_ROCK_DOWN05",
"MAP_NAVEL_ROCK_DOWN06",
"MAP_NAVEL_ROCK_DOWN07",
"MAP_NAVEL_ROCK_DOWN08",
"MAP_NAVEL_ROCK_DOWN09",
"MAP_NAVEL_ROCK_DOWN10",
"MAP_NAVEL_ROCK_DOWN11",
"MAP_NAVEL_ROCK_ENTRANCE",
"MAP_NAVEL_ROCK_EXTERIOR",
"MAP_NAVEL_ROCK_FORK",
"MAP_NAVEL_ROCK_HARBOR",
"MAP_NAVEL_ROCK_TOP",
"MAP_NAVEL_ROCK_UP1",
"MAP_NAVEL_ROCK_UP2",
"MAP_NAVEL_ROCK_UP3",
"MAP_NAVEL_ROCK_UP4",
},
"New Mauville": {
"MAP_NEW_MAUVILLE_ENTRANCE",
"MAP_NEW_MAUVILLE_INSIDE",
},
"Oldale Town": {
"MAP_OLDALE_TOWN",
"MAP_OLDALE_TOWN_HOUSE1",
"MAP_OLDALE_TOWN_HOUSE2",
"MAP_OLDALE_TOWN_MART",
"MAP_OLDALE_TOWN_POKEMON_CENTER_1F",
"MAP_OLDALE_TOWN_POKEMON_CENTER_2F",
},
"Pacifidlog Town": {
"MAP_PACIFIDLOG_TOWN",
"MAP_PACIFIDLOG_TOWN_HOUSE1",
"MAP_PACIFIDLOG_TOWN_HOUSE2",
"MAP_PACIFIDLOG_TOWN_HOUSE3",
"MAP_PACIFIDLOG_TOWN_HOUSE4",
"MAP_PACIFIDLOG_TOWN_HOUSE5",
"MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F",
"MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_2F",
},
"Petalburg City": {
"MAP_PETALBURG_CITY",
"MAP_PETALBURG_CITY_GYM",
"MAP_PETALBURG_CITY_HOUSE1",
"MAP_PETALBURG_CITY_HOUSE2",
"MAP_PETALBURG_CITY_MART",
"MAP_PETALBURG_CITY_POKEMON_CENTER_1F",
"MAP_PETALBURG_CITY_POKEMON_CENTER_2F",
"MAP_PETALBURG_CITY_WALLYS_HOUSE",
},
"Petalburg Woods": {"MAP_PETALBURG_WOODS"},
"Route 101": {"MAP_ROUTE101"},
"Route 102": {"MAP_ROUTE102"},
"Route 103": {"MAP_ROUTE103"},
"Route 104": {
"MAP_ROUTE104",
"MAP_ROUTE104_MR_BRINEYS_HOUSE",
"MAP_ROUTE104_PRETTY_PETAL_FLOWER_SHOP",
},
"Route 105": {
"MAP_ISLAND_CAVE",
"MAP_ROUTE105",
"MAP_UNDERWATER_ROUTE105",
},
"Route 106": {"MAP_ROUTE106"},
"Route 107": {"MAP_ROUTE107"},
"Route 108": {"MAP_ROUTE108"},
"Route 109": {
"MAP_ROUTE109",
"MAP_ROUTE109_SEASHORE_HOUSE",
},
"Route 110": {
"MAP_ROUTE110",
"MAP_ROUTE110_SEASIDE_CYCLING_ROAD_NORTH_ENTRANCE",
"MAP_ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE",
},
"Trick House": {
"MAP_ROUTE110_TRICK_HOUSE_CORRIDOR",
"MAP_ROUTE110_TRICK_HOUSE_END",
"MAP_ROUTE110_TRICK_HOUSE_ENTRANCE",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE1",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE2",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE3",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE4",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE5",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE6",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE7",
"MAP_ROUTE110_TRICK_HOUSE_PUZZLE8",
},
"Route 111": {
"MAP_DESERT_RUINS",
"MAP_ROUTE111",
"MAP_ROUTE111_OLD_LADYS_REST_STOP",
"MAP_ROUTE111_WINSTRATE_FAMILYS_HOUSE",
},
"Route 112": {
"MAP_ROUTE112",
"MAP_ROUTE112_CABLE_CAR_STATION",
},
"Route 113": {
"MAP_ROUTE113",
"MAP_ROUTE113_GLASS_WORKSHOP",
},
"Route 114": {
"MAP_DESERT_UNDERPASS",
"MAP_ROUTE114",
"MAP_ROUTE114_FOSSIL_MANIACS_HOUSE",
"MAP_ROUTE114_FOSSIL_MANIACS_TUNNEL",
"MAP_ROUTE114_LANETTES_HOUSE",
},
"Route 115": {"MAP_ROUTE115"},
"Route 116": {
"MAP_ROUTE116",
"MAP_ROUTE116_TUNNELERS_REST_HOUSE",
},
"Route 117": {
"MAP_ROUTE117",
"MAP_ROUTE117_POKEMON_DAY_CARE",
},
"Route 118": {"MAP_ROUTE118"},
"Route 119": {
"MAP_ROUTE119",
"MAP_ROUTE119_HOUSE",
"MAP_ROUTE119_WEATHER_INSTITUTE_1F",
"MAP_ROUTE119_WEATHER_INSTITUTE_2F",
},
"Route 120": {
"MAP_ANCIENT_TOMB",
"MAP_ROUTE120",
"MAP_SCORCHED_SLAB",
},
"Route 121": {
"MAP_ROUTE121",
},
"Route 122": {"MAP_ROUTE122"},
"Route 123": {
"MAP_ROUTE123",
"MAP_ROUTE123_BERRY_MASTERS_HOUSE",
},
"Route 124": {
"MAP_ROUTE124",
"MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE",
"MAP_UNDERWATER_ROUTE124",
},
"Route 125": {
"MAP_ROUTE125",
"MAP_UNDERWATER_ROUTE125",
},
"Route 126": {
"MAP_ROUTE126",
"MAP_UNDERWATER_ROUTE126",
},
"Route 127": {
"MAP_ROUTE127",
"MAP_UNDERWATER_ROUTE127",
},
"Route 128": {
"MAP_ROUTE128",
"MAP_UNDERWATER_ROUTE128",
},
"Route 129": {
"MAP_ROUTE129",
"MAP_UNDERWATER_ROUTE129",
},
"Route 130": {"MAP_ROUTE130"},
"Route 131": {"MAP_ROUTE131"},
"Route 132": {"MAP_ROUTE132"},
"Route 133": {"MAP_ROUTE133"},
"Route 134": {
"MAP_ROUTE134",
"MAP_UNDERWATER_ROUTE134",
"MAP_SEALED_CHAMBER_INNER_ROOM",
"MAP_SEALED_CHAMBER_OUTER_ROOM",
"MAP_UNDERWATER_SEALED_CHAMBER",
},
"Rustboro City": {
"MAP_RUSTBORO_CITY",
"MAP_RUSTBORO_CITY_CUTTERS_HOUSE",
"MAP_RUSTBORO_CITY_DEVON_CORP_1F",
"MAP_RUSTBORO_CITY_DEVON_CORP_2F",
"MAP_RUSTBORO_CITY_DEVON_CORP_3F",
"MAP_RUSTBORO_CITY_FLAT1_1F",
"MAP_RUSTBORO_CITY_FLAT1_2F",
"MAP_RUSTBORO_CITY_FLAT2_1F",
"MAP_RUSTBORO_CITY_FLAT2_2F",
"MAP_RUSTBORO_CITY_FLAT2_3F",
"MAP_RUSTBORO_CITY_GYM",
"MAP_RUSTBORO_CITY_HOUSE1",
"MAP_RUSTBORO_CITY_HOUSE2",
"MAP_RUSTBORO_CITY_HOUSE3",
"MAP_RUSTBORO_CITY_MART",
"MAP_RUSTBORO_CITY_POKEMON_CENTER_1F",
"MAP_RUSTBORO_CITY_POKEMON_CENTER_2F",
"MAP_RUSTBORO_CITY_POKEMON_SCHOOL",
},
"Rusturf Tunnel": {"MAP_RUSTURF_TUNNEL"},
"Safari Zone": {
"MAP_ROUTE121_SAFARI_ZONE_ENTRANCE",
"MAP_SAFARI_ZONE_NORTH",
"MAP_SAFARI_ZONE_NORTHEAST",
"MAP_SAFARI_ZONE_NORTHWEST",
"MAP_SAFARI_ZONE_REST_HOUSE",
"MAP_SAFARI_ZONE_SOUTH",
"MAP_SAFARI_ZONE_SOUTHEAST",
"MAP_SAFARI_ZONE_SOUTHWEST",
},
"Seafloor Cavern": {
"MAP_SEAFLOOR_CAVERN_ENTRANCE",
"MAP_SEAFLOOR_CAVERN_ROOM1",
"MAP_SEAFLOOR_CAVERN_ROOM2",
"MAP_SEAFLOOR_CAVERN_ROOM3",
"MAP_SEAFLOOR_CAVERN_ROOM4",
"MAP_SEAFLOOR_CAVERN_ROOM5",
"MAP_SEAFLOOR_CAVERN_ROOM6",
"MAP_SEAFLOOR_CAVERN_ROOM7",
"MAP_SEAFLOOR_CAVERN_ROOM8",
"MAP_SEAFLOOR_CAVERN_ROOM9",
"MAP_UNDERWATER_SEAFLOOR_CAVERN",
},
"Shoal Cave": {
"MAP_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM",
"MAP_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM",
"MAP_SHOAL_CAVE_LOW_TIDE_ENTRANCE_ROOM",
"MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM",
"MAP_SHOAL_CAVE_LOW_TIDE_INNER_ROOM",
"MAP_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM",
"MAP_SHOAL_CAVE_LOW_TIDE_STAIRS_ROOM",
},
"Sky Pillar": {
"MAP_SKY_PILLAR_1F",
"MAP_SKY_PILLAR_2F",
"MAP_SKY_PILLAR_3F",
"MAP_SKY_PILLAR_4F",
"MAP_SKY_PILLAR_5F",
"MAP_SKY_PILLAR_ENTRANCE",
"MAP_SKY_PILLAR_OUTSIDE",
"MAP_SKY_PILLAR_TOP",
},
"Slateport City": {
"MAP_SLATEPORT_CITY",
"MAP_SLATEPORT_CITY_BATTLE_TENT_BATTLE_ROOM",
"MAP_SLATEPORT_CITY_BATTLE_TENT_CORRIDOR",
"MAP_SLATEPORT_CITY_BATTLE_TENT_LOBBY",
"MAP_SLATEPORT_CITY_HARBOR",
"MAP_SLATEPORT_CITY_HOUSE",
"MAP_SLATEPORT_CITY_MART",
"MAP_SLATEPORT_CITY_NAME_RATERS_HOUSE",
"MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_1F",
"MAP_SLATEPORT_CITY_OCEANIC_MUSEUM_2F",
"MAP_SLATEPORT_CITY_POKEMON_CENTER_1F",
"MAP_SLATEPORT_CITY_POKEMON_CENTER_2F",
"MAP_SLATEPORT_CITY_POKEMON_FAN_CLUB",
"MAP_SLATEPORT_CITY_STERNS_SHIPYARD_1F",
"MAP_SLATEPORT_CITY_STERNS_SHIPYARD_2F",
},
"Sootopolis City": {
"MAP_CAVE_OF_ORIGIN_1F",
"MAP_CAVE_OF_ORIGIN_B1F",
"MAP_CAVE_OF_ORIGIN_ENTRANCE",
"MAP_SOOTOPOLIS_CITY",
"MAP_SOOTOPOLIS_CITY_GYM_1F",
"MAP_SOOTOPOLIS_CITY_GYM_B1F",
"MAP_SOOTOPOLIS_CITY_HOUSE1",
"MAP_SOOTOPOLIS_CITY_HOUSE2",
"MAP_SOOTOPOLIS_CITY_HOUSE3",
"MAP_SOOTOPOLIS_CITY_HOUSE4",
"MAP_SOOTOPOLIS_CITY_HOUSE5",
"MAP_SOOTOPOLIS_CITY_HOUSE6",
"MAP_SOOTOPOLIS_CITY_HOUSE7",
"MAP_SOOTOPOLIS_CITY_LOTAD_AND_SEEDOT_HOUSE",
"MAP_SOOTOPOLIS_CITY_MART",
"MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F",
"MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_B1F",
"MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F",
"MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_2F",
"MAP_UNDERWATER_SOOTOPOLIS_CITY",
},
"Southern Island": {
"MAP_SOUTHERN_ISLAND_EXTERIOR",
"MAP_SOUTHERN_ISLAND_INTERIOR",
},
"S.S. Tidal": {
"MAP_SS_TIDAL_CORRIDOR",
"MAP_SS_TIDAL_LOWER_DECK",
"MAP_SS_TIDAL_ROOMS",
},
"Terra Cave": {
"MAP_TERRA_CAVE_END",
"MAP_TERRA_CAVE_ENTRANCE",
},
"Trainer Hill": {
"MAP_TRAINER_HILL_2F",
"MAP_TRAINER_HILL_3F",
"MAP_TRAINER_HILL_4F",
"MAP_TRAINER_HILL_ELEVATOR",
"MAP_TRAINER_HILL_ENTRANCE",
"MAP_TRAINER_HILL_ROOF",
},
"Verdanturf Town": {
"MAP_VERDANTURF_TOWN",
"MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM",
"MAP_VERDANTURF_TOWN_BATTLE_TENT_CORRIDOR",
"MAP_VERDANTURF_TOWN_BATTLE_TENT_LOBBY",
"MAP_VERDANTURF_TOWN_FRIENDSHIP_RATERS_HOUSE",
"MAP_VERDANTURF_TOWN_HOUSE",
"MAP_VERDANTURF_TOWN_MART",
"MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F",
"MAP_VERDANTURF_TOWN_POKEMON_CENTER_2F",
"MAP_VERDANTURF_TOWN_WANDAS_HOUSE",
},
"Victory Road": {
"MAP_VICTORY_ROAD_1F",
"MAP_VICTORY_ROAD_B1F",
"MAP_VICTORY_ROAD_B2F",
},
}
_LOCATION_CATEGORY_TO_GROUP_NAME = {
LocationCategory.BADGE: "Badges",
LocationCategory.HM: "HMs",
LocationCategory.KEY: "Key Items",
LocationCategory.ROD: "Fishing Rods",
LocationCategory.BIKE: "Bikes",
LocationCategory.TICKET: "Tickets",
LocationCategory.OVERWORLD_ITEM: "Overworld Items",
LocationCategory.HIDDEN_ITEM: "Hidden Items",
LocationCategory.GIFT: "NPC Gifts",
LocationCategory.BERRY_TREE: "Berry Trees",
LocationCategory.TRAINER: "Trainers",
LocationCategory.POKEDEX: "Pokedex",
}
LOCATION_GROUPS: Dict[str, Set[str]] = {group_name: set() for group_name in _LOCATION_CATEGORY_TO_GROUP_NAME.values()}
for location in data.locations.values():
# Category groups
LOCATION_GROUPS[_LOCATION_CATEGORY_TO_GROUP_NAME[location.category]].add(location.label)
# Tag groups
for tag in location.tags:
if tag not in LOCATION_GROUPS:
LOCATION_GROUPS[tag] = set()
LOCATION_GROUPS[tag].add(location.label)
# Geographic groups
if location.parent_region != "REGION_POKEDEX":
map_name = data.regions[location.parent_region].parent_map.name
for group, maps in _LOCATION_GROUP_MAPS.items():
if map_name in maps:
if group not in LOCATION_GROUPS:
LOCATION_GROUPS[group] = set()
LOCATION_GROUPS[group].add(location.label)
break
# Meta-groups
LOCATION_GROUPS["Cities"] = {
*LOCATION_GROUPS.get("Littleroot Town", set()),
*LOCATION_GROUPS.get("Oldale Town", set()),
*LOCATION_GROUPS.get("Petalburg City", set()),
*LOCATION_GROUPS.get("Rustboro City", set()),
*LOCATION_GROUPS.get("Dewford Town", set()),
*LOCATION_GROUPS.get("Slateport City", set()),
*LOCATION_GROUPS.get("Mauville City", set()),
*LOCATION_GROUPS.get("Verdanturf Town", set()),
*LOCATION_GROUPS.get("Fallarbor Town", set()),
*LOCATION_GROUPS.get("Lavaridge Town", set()),
*LOCATION_GROUPS.get("Fortree City", set()),
*LOCATION_GROUPS.get("Mossdeep City", set()),
*LOCATION_GROUPS.get("Sootopolis City", set()),
*LOCATION_GROUPS.get("Pacifidlog Town", set()),
*LOCATION_GROUPS.get("Ever Grande City", set()),
}
LOCATION_GROUPS["Dungeons"] = {
*LOCATION_GROUPS.get("Petalburg Woods", set()),
*LOCATION_GROUPS.get("Rusturf Tunnel", set()),
*LOCATION_GROUPS.get("Granite Cave", set()),
*LOCATION_GROUPS.get("Fiery Path", set()),
*LOCATION_GROUPS.get("Meteor Falls", set()),
*LOCATION_GROUPS.get("Jagged Pass", set()),
*LOCATION_GROUPS.get("Mt. Chimney", set()),
*LOCATION_GROUPS.get("Abandoned Ship", set()),
*LOCATION_GROUPS.get("New Mauville", set()),
*LOCATION_GROUPS.get("Mt. Pyre", set()),
*LOCATION_GROUPS.get("Seafloor Cavern", set()),
*LOCATION_GROUPS.get("Sky Pillar", set()),
*LOCATION_GROUPS.get("Victory Road", set()),
}
LOCATION_GROUPS["Routes"] = {
*LOCATION_GROUPS.get("Route 101", set()),
*LOCATION_GROUPS.get("Route 102", set()),
*LOCATION_GROUPS.get("Route 103", set()),
*LOCATION_GROUPS.get("Route 104", set()),
*LOCATION_GROUPS.get("Route 105", set()),
*LOCATION_GROUPS.get("Route 106", set()),
*LOCATION_GROUPS.get("Route 107", set()),
*LOCATION_GROUPS.get("Route 108", set()),
*LOCATION_GROUPS.get("Route 109", set()),
*LOCATION_GROUPS.get("Route 110", set()),
*LOCATION_GROUPS.get("Route 111", set()),
*LOCATION_GROUPS.get("Route 112", set()),
*LOCATION_GROUPS.get("Route 113", set()),
*LOCATION_GROUPS.get("Route 114", set()),
*LOCATION_GROUPS.get("Route 115", set()),
*LOCATION_GROUPS.get("Route 116", set()),
*LOCATION_GROUPS.get("Route 117", set()),
*LOCATION_GROUPS.get("Route 118", set()),
*LOCATION_GROUPS.get("Route 119", set()),
*LOCATION_GROUPS.get("Route 120", set()),
*LOCATION_GROUPS.get("Route 121", set()),
*LOCATION_GROUPS.get("Route 122", set()),
*LOCATION_GROUPS.get("Route 123", set()),
*LOCATION_GROUPS.get("Route 124", set()),
*LOCATION_GROUPS.get("Route 125", set()),
*LOCATION_GROUPS.get("Route 126", set()),
*LOCATION_GROUPS.get("Route 127", set()),
*LOCATION_GROUPS.get("Route 128", set()),
*LOCATION_GROUPS.get("Route 129", set()),
*LOCATION_GROUPS.get("Route 130", set()),
*LOCATION_GROUPS.get("Route 131", set()),
*LOCATION_GROUPS.get("Route 132", set()),
*LOCATION_GROUPS.get("Route 133", set()),
*LOCATION_GROUPS.get("Route 134", set()),
}

View File

@@ -1,7 +1,7 @@
"""
Classes and functions related to AP items for Pokemon Emerald
"""
from typing import Dict, FrozenSet, Set, Optional
from typing import Dict, FrozenSet, Optional
from BaseClasses import Item, ItemClassification
@@ -46,6 +46,30 @@ def create_item_label_to_code_map() -> Dict[str, int]:
return label_to_code_map
ITEM_GROUPS = {
"Badges": {
"Stone Badge", "Knuckle Badge",
"Dynamo Badge", "Heat Badge",
"Balance Badge", "Feather Badge",
"Mind Badge", "Rain Badge",
},
"HMs": {
"HM01 Cut", "HM02 Fly",
"HM03 Surf", "HM04 Strength",
"HM05 Flash", "HM06 Rock Smash",
"HM07 Waterfall", "HM08 Dive",
},
"HM01": {"HM01 Cut"},
"HM02": {"HM02 Fly"},
"HM03": {"HM03 Surf"},
"HM04": {"HM04 Strength"},
"HM05": {"HM05 Flash"},
"HM06": {"HM06 Rock Smash"},
"HM07": {"HM07 Waterfall"},
"HM08": {"HM08 Dive"},
}
def get_item_classification(item_code: int) -> ItemClassification:
"""
Returns the item classification for a given AP item id (code)

View File

@@ -1,17 +1,59 @@
"""
Classes and functions related to AP locations for Pokemon Emerald
"""
from typing import TYPE_CHECKING, Dict, Optional, Set
from typing import TYPE_CHECKING, Dict, Optional, FrozenSet, Iterable
from BaseClasses import Location, Region
from .data import BASE_OFFSET, NATIONAL_ID_TO_SPECIES_ID, POKEDEX_OFFSET, LocationCategory, data
from .data import BASE_OFFSET, NATIONAL_ID_TO_SPECIES_ID, POKEDEX_OFFSET, data
from .items import offset_item_value
if TYPE_CHECKING:
from . import PokemonEmeraldWorld
LOCATION_GROUPS = {
"Badges": {
"Rustboro Gym - Stone Badge",
"Dewford Gym - Knuckle Badge",
"Mauville Gym - Dynamo Badge",
"Lavaridge Gym - Heat Badge",
"Petalburg Gym - Balance Badge",
"Fortree Gym - Feather Badge",
"Mossdeep Gym - Mind Badge",
"Sootopolis Gym - Rain Badge",
},
"Gym TMs": {
"Rustboro Gym - TM39 from Roxanne",
"Dewford Gym - TM08 from Brawly",
"Mauville Gym - TM34 from Wattson",
"Lavaridge Gym - TM50 from Flannery",
"Petalburg Gym - TM42 from Norman",
"Fortree Gym - TM40 from Winona",
"Mossdeep Gym - TM04 from Tate and Liza",
"Sootopolis Gym - TM03 from Juan",
},
"Trick House": {
"Trick House Puzzle 1 - Item",
"Trick House Puzzle 2 - Item 1",
"Trick House Puzzle 2 - Item 2",
"Trick House Puzzle 3 - Item 1",
"Trick House Puzzle 3 - Item 2",
"Trick House Puzzle 4 - Item",
"Trick House Puzzle 6 - Item",
"Trick House Puzzle 7 - Item",
"Trick House Puzzle 8 - Item",
"Trick House Puzzle 1 - Reward",
"Trick House Puzzle 2 - Reward",
"Trick House Puzzle 3 - Reward",
"Trick House Puzzle 4 - Reward",
"Trick House Puzzle 5 - Reward",
"Trick House Puzzle 6 - Reward",
"Trick House Puzzle 7 - Reward",
}
}
VISITED_EVENT_NAME_TO_ID = {
"EVENT_VISITED_LITTLEROOT_TOWN": 0,
"EVENT_VISITED_OLDALE_TOWN": 1,
@@ -38,7 +80,7 @@ class PokemonEmeraldLocation(Location):
game: str = "Pokemon Emerald"
item_address: Optional[int]
default_item_code: Optional[int]
key: Optional[str]
tags: FrozenSet[str]
def __init__(
self,
@@ -46,13 +88,13 @@ class PokemonEmeraldLocation(Location):
name: str,
address: Optional[int],
parent: Optional[Region] = None,
key: Optional[str] = None,
item_address: Optional[int] = None,
default_item_value: Optional[int] = None) -> None:
default_item_value: Optional[int] = None,
tags: FrozenSet[str] = frozenset()) -> None:
super().__init__(player, name, address, parent)
self.default_item_code = None if default_item_value is None else offset_item_value(default_item_value)
self.item_address = item_address
self.key = key
self.tags = tags
def offset_flag(flag: int) -> int:
@@ -73,14 +115,16 @@ def reverse_offset_flag(location_id: int) -> int:
return location_id - BASE_OFFSET
def create_locations_by_category(world: "PokemonEmeraldWorld", regions: Dict[str, Region], categories: Set[LocationCategory]) -> None:
def create_locations_with_tags(world: "PokemonEmeraldWorld", regions: Dict[str, Region], tags: Iterable[str]) -> None:
"""
Iterates through region data and adds locations to the multiworld if
those locations include any of the provided tags.
"""
tags = set(tags)
for region_name, region_data in data.regions.items():
region = regions[region_name]
filtered_locations = [loc for loc in region_data.locations if data.locations[loc].category in categories]
filtered_locations = [loc for loc in region_data.locations if len(tags & data.locations[loc].tags) > 0]
for location_name in filtered_locations:
location_data = data.locations[location_name]
@@ -100,9 +144,9 @@ def create_locations_by_category(world: "PokemonEmeraldWorld", regions: Dict[str
location_data.label,
location_id,
region,
location_name,
location_data.address,
location_data.default_item
location_data.default_item,
location_data.tags
)
region.locations.append(location)

View File

@@ -6,8 +6,7 @@ from typing import TYPE_CHECKING, Callable, Dict
from BaseClasses import CollectionState
from worlds.generic.Rules import add_rule, set_rule
from .data import LocationCategory, NATIONAL_ID_TO_SPECIES_ID, NUM_REAL_SPECIES, data
from .locations import PokemonEmeraldLocation
from .data import NATIONAL_ID_TO_SPECIES_ID, NUM_REAL_SPECIES, data
from .options import DarkCavesRequireFlash, EliteFourRequirement, NormanRequirement, Goal
if TYPE_CHECKING:
@@ -24,7 +23,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
state.has(hm, world.player) and state.has_all(badges, world.player)
else:
hm_rules[hm] = lambda state, hm=hm, badges=badges: \
state.has(hm, world.player) and state.has_group_unique("Badge", world.player, badges)
state.has(hm, world.player) and state.has_group_unique("Badges", world.player, badges)
def has_acro_bike(state: CollectionState):
return state.has("Acro Bike", world.player)
@@ -237,11 +236,11 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
if world.options.norman_requirement == NormanRequirement.option_badges:
set_rule(
get_entrance("MAP_PETALBURG_CITY_GYM:2/MAP_PETALBURG_CITY_GYM:3"),
lambda state: state.has_group_unique("Badge", world.player, world.options.norman_count.value)
lambda state: state.has_group_unique("Badges", world.player, world.options.norman_count.value)
)
set_rule(
get_entrance("MAP_PETALBURG_CITY_GYM:5/MAP_PETALBURG_CITY_GYM:6"),
lambda state: state.has_group_unique("Badge", world.player, world.options.norman_count.value)
lambda state: state.has_group_unique("Badges", world.player, world.options.norman_count.value)
)
else:
set_rule(
@@ -1507,7 +1506,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
if world.options.elite_four_requirement == EliteFourRequirement.option_badges:
set_rule(
get_entrance("REGION_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F/MAIN -> REGION_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F/BEHIND_BADGE_CHECKERS"),
lambda state: state.has_group_unique("Badge", world.player, world.options.elite_four_count.value)
lambda state: state.has_group_unique("Badges", world.player, world.options.elite_four_count.value)
)
else:
set_rule(
@@ -1660,8 +1659,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
# Add Itemfinder requirement to hidden items
if world.options.require_itemfinder:
for location in world.multiworld.get_locations(world.player):
assert isinstance(location, PokemonEmeraldLocation)
if location.key is not None and data.locations[location.key].category == LocationCategory.HIDDEN_ITEM:
if location.tags is not None and "HiddenItem" in location.tags:
add_rule(
location,
lambda state: state.has("Itemfinder", world.player)

View File

@@ -5,6 +5,8 @@ duplicate claims and give warnings for unused and unignored locations or warps.
import logging
from typing import List
from .data import load_json_data, data
_IGNORABLE_LOCATIONS = frozenset({
"HIDDEN_ITEM_TRICK_HOUSE_NUGGET", # Is permanently mssiable and has special behavior that sets the flag early
@@ -245,29 +247,12 @@ _IGNORABLE_WARPS = frozenset({
})
def validate_group_maps() -> bool:
from .data import data
from .groups import _LOCATION_GROUP_MAPS
failed = False
for group_name, map_set in _LOCATION_GROUP_MAPS.items():
for map_name in map_set:
if map_name not in data.maps:
failed = True
logging.error("Pokemon Emerald: Map named %s in location group %s does not exist", map_name, group_name)
return not failed
def validate_regions() -> bool:
"""
Verifies that Emerald's data doesn't have duplicate or missing
regions/warps/locations. Meant to catch problems during development like
forgetting to add a new location or incorrectly splitting a region.
"""
from .data import load_json_data, data
extracted_data_json = load_json_data("extracted_data.json")
error_messages: List[str] = []
warn_messages: List[str] = []

View File

@@ -11,7 +11,8 @@ Al usar BizHawk, esta guía solo es aplicable en los sistemas de Windows y Linux
- Instrucciones de instalación detalladas para BizHawk se pueden encontrar en el enlace de arriba.
- Los usuarios de Windows deben ejecutar el instalador de prerrequisitos (prereq installer) primero, que también se
encuentra en el enlace de arriba.
- El cliente incorporado de Archipelago, que se puede encontrar [aquí](https://github.com/ArchipelagoMW/Archipelago/releases).
- El cliente incorporado de Archipelago, que se puede encontrar [aquí](https://github.com/ArchipelagoMW/Archipelago/releases)
(selecciona `Pokemon Client` durante la instalación).
- Los ROMs originales de Pokémon Red y/o Blue. La comunidad de Archipelago no puede proveerlos.
## Software Opcional
@@ -74,41 +75,27 @@ Y los siguientes caracteres especiales (cada uno ocupa un carácter):
## Unirse a un juego MultiWorld
### Generar y parchar un juego
### Obtener tu parche de Pokémon
1. Crea tu archivo de opciones (YAML).
2. Sigue las instrucciones generales de Archipelago para [generar un juego](../../Archipelago/setup/en#generating-a-game).
Haciendo esto se generará un archivo de salida. Tu parche tendrá la extensión de archivo `.apred` o `.apblue`.
3. Abre `ArchipelagoLauncher.exe`
4. Selecciona "Open Patch" en el lado izquierdo y selecciona tu parche.
5. Si es tu primera vez parchando, se te pedirá que selecciones tu ROM original.
6. Un archivo `.gb` parchado será creado en el mismo lugar donde está el parche.
7. La primera vez que abras un parche con BizHawk Client, también se te pedira ubicar `EmuHawk.exe` en tu
instalación de BizHawk.
Cuando te unes a un juego multiworld, se te pedirá que entregues tu archivo YAML a quien lo esté organizando.
Una vez que la generación acabe, el anfitrión te dará un enlace a tu archivo, o un .zip con los archivos de
todos. Tu archivo tiene una extensión `.apred` o `.apblue`.
Si estás jugando una semilla single-player y no te importa tener seguimiento ni pistas, puedes terminar aqui, cerrar el
cliente, y cargar el ROM parchado en cualquier emulador. Sin embargo, para multiworlds y otras funciones de Archipelago,
continúa con los pasos abajo, usando el emulador BizHawk.
Haz doble clic en tu archivo `.apred` o `.apblue` para que se ejecute el cliente y realice el parcheado del ROM.
Una vez acabe ese proceso (esto puede tardar un poco), el cliente y el emulador se abrirán automáticamente (si es que se
ha asociado la extensión al emulador tal como fue recomendado)
### Conectarse al multiserver
Por defecto, abrir un parche hará los pasos del 1 al 5 automáticamente. Incluso asi, es bueno memorizarlos en caso de
que tengas que cerrar y volver a abrir el juego por alguna razón.
Una vez ejecutado tanto el cliente como el emulador, hay que conectarlos. Abre la carpeta de instalación de Archipelago,
luego abre `data/lua`, y simplemente arrastra el archivo `connector_pkmn_rb.lua` a la ventana principal de Emuhawk.
(Alternativamente, puedes abrir la consola de Lua manualmente. En Emuhawk ir a Tools > Lua Console, luego ir al menú
`Script``Open Script`, navegar a la ubicación de `connector_pkmn_rb.lua` y seleccionarlo.)
1. Pokémon Red/Blue usa el BizHawk Client de Archipelago. Si el cliente no está abierto desde cuando parchaste tu juego,
puedes volverlo a abrir desde el Launcher.
2. Asegúrate que EmuHawk esta cargando el ROM parchado.
3. En EmuHawk, ir a `Tools > Lua Console`. Esta ventana debe quedarse abierta mientras se juega.
4. En la ventana de Lua Console, ir a `Script > Open Script…`.
5. Navegar a tu carpeta de instalación de Archipelago y abrir `data/lua/connector_bizhawk_generic.lua`.
6. El emulador se puede congelar por unos segundos hasta que logre conectarse al cliente. Esto es normal. La ventana del
BizHawk Client debería indicar que se logro conectar y reconocer Pokémon Red/Blue.
7. Para conectar el cliente al servidor, ingresa la dirección y el puerto (por ejemplo, `archipelago.gg:38281`) en el
campo de texto superior del cliente y y haz clic en Connect.
Para conectar el cliente con el servidor, simplemente pon `<dirección>:<puerto>` en la caja de texto superior y presiona
enter (si el servidor tiene contraseña, en la caja de texto inferior escribir `/connect <dirección>:<puerto> [contraseña]`)
Para conectar el cliente al multiserver simplemente escribe `<dirección>:<puerto>` en el campo de texto superior y
presiona enter (si el servidor usa contraseña, escribe en el campo de texto inferior
`/connect <dirección>:<puerto>[contraseña]`)
Ahora ya estás listo para tu aventura en Kanto.
## Auto-Tracking

View File

@@ -223,7 +223,7 @@ location_data = [
Missable(92)),
LocationData("Victory Road 2F-C", "East Item", "Full Heal", rom_addresses["Missable_Victory_Road_2F_Item_2"],
Missable(93)),
LocationData("Victory Road 2F-C", "West Item", "TM05 Mega Kick", rom_addresses["Missable_Victory_Road_2F_Item_3"],
LocationData("Victory Road 2F-W", "West Item", "TM05 Mega Kick", rom_addresses["Missable_Victory_Road_2F_Item_3"],
Missable(94)),
LocationData("Victory Road 2F-NW", "North Item Near Moltres", "Guard Spec", rom_addresses["Missable_Victory_Road_2F_Item_4"],
Missable(95)),

View File

@@ -1387,7 +1387,7 @@ def get_locations(world: Optional[World]) -> Tuple[LocationData, ...]:
lambda state: logic.templars_return_requirement(state)),
LocationData("The Host", "The Host: Victory", SC2LOTV_LOC_ID_OFFSET + 2100, LocationType.VICTORY,
lambda state: logic.the_host_requirement(state)),
LocationData("The Host", "The Host: Southeast Void Shard", SC2LOTV_LOC_ID_OFFSET + 2101, LocationType.EXTRA,
LocationData("The Host", "The Host: Southeast Void Shard", SC2LOTV_LOC_ID_OFFSET + 2101, LocationType.VICTORY,
lambda state: logic.the_host_requirement(state)),
LocationData("The Host", "The Host: South Void Shard", SC2LOTV_LOC_ID_OFFSET + 2102, LocationType.EXTRA,
lambda state: logic.the_host_requirement(state)),

View File

@@ -43,9 +43,6 @@ class SC2Campaign(Enum):
self.goal_priority = goal_priority
self.race = race
def __lt__(self, other: "SC2Campaign"):
return self.id < other.id
GLOBAL = 0, "Global", SC2CampaignGoalPriority.NONE, SC2Race.ANY
WOL = 1, "Wings of Liberty", SC2CampaignGoalPriority.VERY_HARD, SC2Race.TERRAN
PROPHECY = 2, "Prophecy", SC2CampaignGoalPriority.MINI_CAMPAIGN, SC2Race.PROTOSS

View File

@@ -50,7 +50,7 @@ def create_vanilla_regions(
names: Dict[str, int] = {}
# Generating all regions and locations for each enabled campaign
for campaign in sorted(enabled_campaigns):
for campaign in enabled_campaigns:
for region_name in vanilla_mission_req_table[campaign].keys():
regions.append(create_region(world, locations_per_region, location_cache, region_name))
world.multiworld.regions += regions

View File

@@ -1,6 +1,6 @@
import typing
from dataclasses import dataclass
from Options import DefaultOnToggle, Range, Toggle, DeathLink, Choice, PerGameCommonOptions, OptionSet, OptionGroup
from Options import DefaultOnToggle, Range, Toggle, DeathLink, Choice, PerGameCommonOptions, OptionSet
from .Items import action_item_table
class EnableCoinStars(DefaultOnToggle):
@@ -127,32 +127,6 @@ class MoveRandomizerActions(OptionSet):
valid_keys = [action for action in action_item_table if action != 'Double Jump']
default = valid_keys
sm64_options_groups = [
OptionGroup("Logic Options", [
AreaRandomizer,
BuddyChecks,
ExclamationBoxes,
ProgressiveKeys,
EnableCoinStars,
StrictCapRequirements,
StrictCannonRequirements,
]),
OptionGroup("Ability Options", [
EnableMoveRandomizer,
MoveRandomizerActions,
StrictMoveRequirements,
]),
OptionGroup("Star Options", [
AmountOfStars,
FirstBowserStarDoorCost,
BasementStarDoorCost,
SecondFloorStarDoorCost,
MIPS1Cost,
MIPS2Cost,
StarsToFinish,
]),
]
@dataclass
class SM64Options(PerGameCommonOptions):
area_rando: AreaRandomizer

View File

@@ -3,7 +3,7 @@ import os
import json
from .Items import item_table, action_item_table, cannon_item_table, SM64Item
from .Locations import location_table, SM64Location
from .Options import sm64_options_groups, SM64Options
from .Options import SM64Options
from .Rules import set_rules
from .Regions import create_regions, sm64_level_to_entrances, SM64Levels
from BaseClasses import Item, Tutorial, ItemClassification, Region
@@ -20,8 +20,6 @@ class SM64Web(WebWorld):
["N00byKing"]
)]
option_groups = sm64_options_groups
class SM64World(World):
"""

View File

@@ -1,6 +1,5 @@
import typing
from Options import Choice, Option, PerGameCommonOptions, Toggle, DefaultOnToggle, Range, ItemsAccessibility, StartInventoryPool
from Options import Choice, Option, PerGameCommonOptions, Toggle, DefaultOnToggle, Range, ItemsAccessibility
from dataclasses import dataclass
class SMLogic(Choice):
@@ -130,7 +129,6 @@ class EnergyBeep(DefaultOnToggle):
@dataclass
class SMZ3Options(PerGameCommonOptions):
start_inventory_from_pool: StartInventoryPool
accessibility: ItemsAccessibility
sm_logic: SMLogic
sword_location: SwordLocation

View File

@@ -206,10 +206,25 @@ class StardewValleyWorld(World):
self.multiworld.push_precollected(self.create_starting_item("Progressive Coop"))
def setup_player_events(self):
self.setup_construction_events()
self.setup_quest_events()
self.setup_action_events()
self.setup_logic_events()
def setup_construction_events(self):
can_construct_buildings = LocationData(None, RegionName.carpenter, Event.can_construct_buildings)
self.create_event_location(can_construct_buildings, True_(), Event.can_construct_buildings)
def setup_quest_events(self):
start_dark_talisman_quest = LocationData(None, RegionName.railroad, Event.start_dark_talisman_quest)
self.create_event_location(start_dark_talisman_quest, self.logic.wallet.has_rusty_key(), Event.start_dark_talisman_quest)
def setup_action_events(self):
can_ship_event = LocationData(None, LogicRegion.shipping, Event.can_ship_items)
self.create_event_location(can_ship_event, true_, Event.can_ship_items)
can_shop_pierre_event = LocationData(None, RegionName.pierre_store, Event.can_shop_at_pierre)
self.create_event_location(can_shop_pierre_event, true_, Event.can_shop_at_pierre)
spring_farming = LocationData(None, LogicRegion.spring_farming, Event.spring_farming)
self.create_event_location(spring_farming, true_, Event.spring_farming)
summer_farming = LocationData(None, LogicRegion.summer_farming, Event.summer_farming)
@@ -304,7 +319,7 @@ class StardewValleyWorld(World):
if override_classification is None:
override_classification = item.classification
if override_classification & ItemClassification.progression:
if override_classification == ItemClassification.progression:
self.total_progression_items += 1
return StardewItem(item.name, override_classification, item.code, self.player)

View File

@@ -1,12 +1,16 @@
from __future__ import annotations
from graphlib import TopologicalSorter
from typing import Iterable, Mapping, Callable
from .game_content import StardewContent, ContentPack, StardewFeatures
from .vanilla.base import base_game as base_game_content_pack
from ..data.game_item import GameItem, ItemSource
try:
from graphlib import TopologicalSorter
except ImportError:
from graphlib_backport import TopologicalSorter # noqa
def unpack_content(features: StardewFeatures, packs: Iterable[ContentPack]) -> StardewContent:
# Base game is always registered first.

View File

@@ -1,9 +1,9 @@
from dataclasses import dataclass
from .game_item import ItemSource
from .game_item import kw_only, ItemSource
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class MachineSource(ItemSource):
item: str # this should be optional (worm bin)
machine: str

View File

@@ -1,4 +1,5 @@
import enum
import sys
from abc import ABC
from dataclasses import dataclass, field
from types import MappingProxyType
@@ -6,6 +7,11 @@ from typing import List, Iterable, Set, ClassVar, Tuple, Mapping, Callable, Any
from ..stardew_rule.protocol import StardewRule
if sys.version_info >= (3, 10):
kw_only = {"kw_only": True}
else:
kw_only = {}
DEFAULT_REQUIREMENT_TAGS = MappingProxyType({})
@@ -30,17 +36,21 @@ class ItemTag(enum.Enum):
class ItemSource(ABC):
add_tags: ClassVar[Tuple[ItemTag]] = ()
other_requirements: Tuple[Requirement, ...] = field(kw_only=True, default_factory=tuple)
@property
def requirement_tags(self) -> Mapping[str, Tuple[ItemTag, ...]]:
return DEFAULT_REQUIREMENT_TAGS
# FIXME this should just be an optional field, but kw_only requires python 3.10...
@property
def other_requirements(self) -> Iterable[Requirement]:
return ()
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class GenericSource(ItemSource):
regions: Tuple[str, ...] = ()
"""No region means it's available everywhere."""
other_requirements: Tuple[Requirement, ...] = ()
@dataclass(frozen=True)
@@ -49,7 +59,7 @@ class CustomRuleSource(ItemSource):
create_rule: Callable[[Any], StardewRule]
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class CompoundSource(ItemSource):
sources: Tuple[ItemSource, ...] = ()

View File

@@ -1,17 +1,18 @@
from dataclasses import dataclass
from typing import Tuple, Sequence, Mapping
from .game_item import ItemSource, ItemTag
from .game_item import ItemSource, kw_only, ItemTag, Requirement
from ..strings.season_names import Season
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class ForagingSource(ItemSource):
regions: Tuple[str, ...]
seasons: Tuple[str, ...] = Season.all
other_requirements: Tuple[Requirement, ...] = ()
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class SeasonalForagingSource(ItemSource):
season: str
days: Sequence[int]
@@ -21,17 +22,17 @@ class SeasonalForagingSource(ItemSource):
return ForagingSource(seasons=(self.season,), regions=self.regions)
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class FruitBatsSource(ItemSource):
...
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class MushroomCaveSource(ItemSource):
...
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class HarvestFruitTreeSource(ItemSource):
add_tags = (ItemTag.CROPSANITY,)
@@ -45,7 +46,7 @@ class HarvestFruitTreeSource(ItemSource):
}
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class HarvestCropSource(ItemSource):
add_tags = (ItemTag.CROPSANITY,)
@@ -60,6 +61,6 @@ class HarvestCropSource(ItemSource):
}
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class ArtifactSpotSource(ItemSource):
amount: int

View File

@@ -7,7 +7,7 @@ id,name,classification,groups,mod_name
19,Glittering Boulder Removed,progression,COMMUNITY_REWARD,
20,Minecarts Repair,useful,COMMUNITY_REWARD,
21,Bus Repair,progression,COMMUNITY_REWARD,
22,Progressive Movie Theater,"progression,trap",COMMUNITY_REWARD,
22,Progressive Movie Theater,progression,COMMUNITY_REWARD,
23,Stardrop,progression,,
24,Progressive Backpack,progression,,
25,Rusty Sword,filler,"WEAPON,DEPRECATED",
1 id name classification groups mod_name
7 19 Glittering Boulder Removed progression COMMUNITY_REWARD
8 20 Minecarts Repair useful COMMUNITY_REWARD
9 21 Bus Repair progression COMMUNITY_REWARD
10 22 Progressive Movie Theater progression,trap progression COMMUNITY_REWARD
11 23 Stardrop progression
12 24 Progressive Backpack progression
13 25 Rusty Sword filler WEAPON,DEPRECATED

View File

@@ -1,39 +1,40 @@
from dataclasses import dataclass
from typing import Tuple, Optional
from .game_item import ItemSource
from .game_item import ItemSource, kw_only, Requirement
from ..strings.season_names import Season
ItemPrice = Tuple[int, str]
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class ShopSource(ItemSource):
shop_region: str
money_price: Optional[int] = None
items_price: Optional[Tuple[ItemPrice, ...]] = None
seasons: Tuple[str, ...] = Season.all
other_requirements: Tuple[Requirement, ...] = ()
def __post_init__(self):
assert self.money_price is not None or self.items_price is not None, "At least money price or items price need to be defined."
assert self.items_price is None or all(isinstance(p, tuple) for p in self.items_price), "Items price should be a tuple."
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class MysteryBoxSource(ItemSource):
amount: int
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class ArtifactTroveSource(ItemSource):
amount: int
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class PrizeMachineSource(ItemSource):
amount: int
@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, **kw_only)
class FishingTreasureChestSource(ItemSource):
amount: int

View File

@@ -1,7 +1,9 @@
from dataclasses import dataclass, field
from ..data.game_item import kw_only
@dataclass(frozen=True)
class Skill:
name: str
has_mastery: bool = field(kw_only=True)
has_mastery: bool = field(**kw_only)

Some files were not shown because too many files have changed in this diff Show More