Skip to content

Commit

Permalink
add per-slot data and embed HK options in it
Browse files Browse the repository at this point in the history
  • Loading branch information
Berserker66 committed Apr 17, 2021
1 parent a5efed8 commit 501c55c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,9 @@ def write_multidata(roms, mods):
for future in roms:
rom_name = future.result()
rom_names.append(rom_name)
slot_data = {}
client_versions = {}
minimum_versions = {"server": (0, 0, 3), "clients": client_versions}
minimum_versions = {"server": (0, 0, 4), "clients": client_versions}
games = {}
for slot in world.player_ids:
client_versions[slot] = (0, 0, 3)
Expand All @@ -505,8 +506,14 @@ def write_multidata(roms, mods):
for player, name in enumerate(team, 1):
if player not in world.alttp_player_ids:
connect_names[name] = (i, player)

for slot in world.hk_player_ids:
slots_data = slot_data[slot] = {}
slots_options = slots_data["options"] = {}
for option_name in Options.hollow_knight_options:
option = getattr(world, option_name)[slot]
slots_options[option_name] = option.value
multidata = zlib.compress(pickle.dumps({
"slot_data" : slot_data,
"games": games,
"names": parsed_names,
"connect_names": connect_names,
Expand Down
2 changes: 2 additions & 0 deletions MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def _load(self, decoded_obj: dict, use_embedded_server_options: bool):
self.connect_names = decoded_obj['connect_names']
self.remote_items = decoded_obj['remote_items']
self.locations = decoded_obj['locations']
self.slot_data = decoded_obj['slot_data']
self.er_hint_data = {int(player): {int(address): name for address, name in loc_data.items()}
for player, loc_data in decoded_obj["er_hint_data"].items()}
self.games = decoded_obj["games"]
Expand Down Expand Up @@ -1023,6 +1024,7 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict):
"players": ctx.get_players_package(),
"missing_locations": get_missing_checks(ctx, client),
"checked_locations": get_checked_checks(ctx, client),
"slot_data": ctx.slot_data.get(client.slot, {})
}]
items = get_received_items(ctx, client.team, client.slot)
if items:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ colorama>=0.4.4
websockets>=8.1
PyYAML>=5.4.1
fuzzywuzzy>=0.18.0
bsdiff4>=1.2.0
bsdiff4>=1.2.1
prompt_toolkit>=3.0.18
appdirs>=1.4.4
maseya-z3pr>=1.0.0rc1
Expand Down

0 comments on commit 501c55c

Please sign in to comment.