add per-slot data and embed HK options in it
This commit is contained in:
		
							parent
							
								
									a5efed83b9
								
							
						
					
					
						commit
						501c55cc26
					
				
							
								
								
									
										11
									
								
								Main.py
								
								
								
								
							
							
						
						
									
										11
									
								
								Main.py
								
								
								
								
							| 
						 | 
				
			
			@ -492,8 +492,9 @@ def main(args, seed=None):
 | 
			
		|||
            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)
 | 
			
		||||
| 
						 | 
				
			
			@ -505,8 +506,14 @@ def main(args, seed=None):
 | 
			
		|||
                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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -146,6 +146,7 @@ class Context(Node):
 | 
			
		|||
        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"]
 | 
			
		||||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue