Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hollow Knight: Clean outdated slot data code and comments #3988

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions worlds/hk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down
Loading