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

This commit is contained in:
BadMagic100 2024-09-26 16:27:22 -07:00 committed by GitHub
parent a2d585ba5c
commit 5c4e81d046
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 15 deletions

View File

@ -534,26 +534,16 @@ class HKWorld(World):
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 @@ class HKWorld(World):
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