From 4dd898870242cc80cdcf6d5e5bb5b80f789494f7 Mon Sep 17 00:00:00 2001 From: Sean Dempsey Date: Sun, 22 Sep 2024 17:20:06 -0700 Subject: [PATCH] Clean outdated slot data code and comments --- worlds/hk/__init__.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/worlds/hk/__init__.py b/worlds/hk/__init__.py index 15addefef50..9ec77e6bf0c 100644 --- a/worlds/hk/__init__.py +++ b/worlds/hk/__init__.py @@ -534,26 +534,16 @@ def fill_slot_data(self): for option_name in hollow_knight_options: option = getattr(self.options, option_name) try: + # exclude more complex types - we only care about int, bool, enum for player options; the client + # can get them back to the necessary type. optionvalue = int(option.value) - except TypeError: - pass # C# side is currently typed as dict[str, int], drop what doesn't fit - else: options[option_name] = optionvalue + except TypeError: + pass # 32 bit int slot_data["seed"] = self.random.randint(-2147483647, 2147483646) - # Backwards compatibility for shop cost data (HKAP < 0.1.0) - if not self.options.CostSanity: - for shop, terms in shop_cost_types.items(): - unit = cost_terms[next(iter(terms))].option - if unit == "Geo": - continue - slot_data[f"{unit}_costs"] = { - loc.name: next(iter(loc.costs.values())) - for loc in self.created_multi_locations[shop] - } - # HKAP 0.1.0 and later cost data. location_costs = {} for region in self.multiworld.get_regions(self.player): @@ -566,7 +556,7 @@ def fill_slot_data(self): slot_data["grub_count"] = self.grub_count - slot_data["is_race"] = int(self.settings.disable_spoilers or self.multiworld.is_race) + slot_data["is_race"] = self.settings.disable_spoilers or self.multiworld.is_race return slot_data