From 2751ccdaabc7e55fdfaa68cbb1d6ea9bb1d666ce Mon Sep 17 00:00:00 2001 From: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:02:31 -0400 Subject: [PATCH 1/3] DS3: Make your own region cache (#4040) * Make your own region cache * Using a string --- worlds/dark_souls_3/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worlds/dark_souls_3/__init__.py b/worlds/dark_souls_3/__init__.py index b51668539be2..1aec6945eb8b 100644 --- a/worlds/dark_souls_3/__init__.py +++ b/worlds/dark_souls_3/__init__.py @@ -89,6 +89,7 @@ def __init__(self, multiworld: MultiWorld, player: int): self.all_excluded_locations = set() def generate_early(self) -> None: + self.created_regions = set() self.all_excluded_locations.update(self.options.exclude_locations.value) # Inform Universal Tracker where Yhorm is being randomized to. @@ -294,6 +295,7 @@ def create_region(self, region_name, location_table) -> Region: new_region.locations.append(new_location) self.multiworld.regions.append(new_region) + self.created_regions.add(region_name) return new_region def create_items(self) -> None: @@ -1305,7 +1307,7 @@ def _add_location_rule(self, location: Union[str, List[str]], rule: Union[Collec def _add_entrance_rule(self, region: str, rule: Union[CollectionRule, str]) -> None: """Sets a rule for the entrance to the given region.""" assert region in location_tables - if not any(region == reg for reg in self.multiworld.regions.region_cache[self.player]): return + if region not in self.created_regions: return if isinstance(rule, str): if " -> " not in rule: assert item_dictionary[rule].classification == ItemClassification.progression From f495bf726101e5125e73a1aabb23ee9ab6518d04 Mon Sep 17 00:00:00 2001 From: Aaron Wagener Date: Thu, 10 Oct 2024 20:05:21 -0500 Subject: [PATCH 2/3] The Messenger: fix missing money wrench rule (#4041) * The Messenger: fix missing money wrench rule * add a unit test for money wrench --- worlds/messenger/rules.py | 2 ++ worlds/messenger/test/test_shop.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/worlds/messenger/rules.py b/worlds/messenger/rules.py index 85b73dec4147..c354ad70aba6 100644 --- a/worlds/messenger/rules.py +++ b/worlds/messenger/rules.py @@ -220,6 +220,8 @@ def __init__(self, world: "MessengerWorld") -> None: } self.location_rules = { + # hq + "Money Wrench": self.can_shop, # ninja village "Ninja Village Seal - Tree House": self.has_dart, diff --git a/worlds/messenger/test/test_shop.py b/worlds/messenger/test/test_shop.py index 971ff1763b47..ce6fd19e33c8 100644 --- a/worlds/messenger/test/test_shop.py +++ b/worlds/messenger/test/test_shop.py @@ -1,5 +1,6 @@ from typing import Dict +from BaseClasses import CollectionState from . import MessengerTestBase from ..shop import SHOP_ITEMS, FIGURINES @@ -89,3 +90,15 @@ def test_costs(self) -> None: self.assertTrue(loc in FIGURINES) self.assertEqual(len(figures), len(FIGURINES)) + + max_cost_state = CollectionState(self.multiworld) + self.assertFalse(self.world.get_location("Money Wrench").can_reach(max_cost_state)) + prog_shards = [] + for item in self.multiworld.itempool: + if "Time Shard " in item.name: + value = int(item.name.strip("Time Shard ()")) + if value >= 100: + prog_shards.append(item) + for shard in prog_shards: + max_cost_state.collect(shard, True) + self.assertTrue(self.world.get_location("Money Wrench").can_reach(max_cost_state)) From ef4d1e77e3eec4ce0c7a4fe381b18487aedc8b40 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 11 Oct 2024 23:24:42 +0200 Subject: [PATCH 3/3] Core: make shlex split an attempt with regular split retry (#4046) --- MultiServer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MultiServer.py b/MultiServer.py index 0fe950b5e4f3..8dfad5040de3 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1153,7 +1153,10 @@ def __call__(self, raw: str) -> typing.Optional[bool]: if not raw: return try: - command = shlex.split(raw, comments=False) + try: + command = shlex.split(raw, comments=False) + except ValueError: # most likely: "ValueError: No closing quotation" + command = raw.split() basecommand = command[0] if basecommand[0] == self.marker: method = self.commands.get(basecommand[1:].lower(), None)