From 6c3cb6286ae94bc41d07d4886e93b2e7d2489a28 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 29 May 2024 13:27:48 -0400 Subject: Compatibility with not-unique IDs --- Archipelago/client.gd | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'Archipelago') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 7903df2..e89c156 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -80,6 +80,7 @@ var _team = 0 var _slot = 0 var _players = [] var _player_name_by_slot = {} +var _game_by_player = {} var _checked_locations = [] var _slot_data = {} var _paintings_mapping = {} @@ -256,6 +257,7 @@ func _on_data(): for player in _players: _player_name_by_slot[player["slot"]] = player["alias"] + _game_by_player[player["slot"]] = message["slot_info"][str(player["slot"])]["game"] _death_link = _slot_data.has("death_link") and _slot_data["death_link"] if _death_link: @@ -423,12 +425,14 @@ func _on_data(): continue var item_name = "Unknown" - if _item_id_to_name.has(message["item"]["item"]): - item_name = _item_id_to_name[message["item"]["item"]] + var item_player_game = _game_by_player[message["receiving"]] + if _item_id_to_name[item_player_game].has(message["item"]["item"]): + item_name = _item_id_to_name[item_player_game][message["item"]["item"]] var location_name = "Unknown" - if _location_id_to_name.has(message["item"]["location"]): - location_name = _location_id_to_name[message["item"]["location"]] + var location_player_game = _game_by_player[message["item"]["player"]] + if _location_id_to_name[location_player_game].has(message["item"]["location"]): + location_name = _location_id_to_name[location_player_game][message["item"]["location"]] var player_name = "Unknown" if _player_name_by_slot.has(message["receiving"]): @@ -578,12 +582,16 @@ func requestDatapackages(games): func processDatapackages(): _item_id_to_name = {} _location_id_to_name = {} - for package in _datapackages.values(): + for game in _datapackages.keys(): + var package = _datapackages[game] + + _item_id_to_name[game] = {} for name in package["item_name_to_id"].keys(): - _item_id_to_name[package["item_name_to_id"][name]] = name + _item_id_to_name[game][package["item_name_to_id"][name]] = name + _location_id_to_name[game] = {} for name in package["location_name_to_id"].keys(): - _location_id_to_name[package["location_name_to_id"][name]] = name + _location_id_to_name[game][package["location_name_to_id"][name]] = name if _datapackages.has("Lingo"): _item_name_to_id = _datapackages["Lingo"]["item_name_to_id"] @@ -672,8 +680,8 @@ func processItem(item, index, from, flags): var gamedata = $Gamedata var item_name = "Unknown" - if _item_id_to_name.has(item): - item_name = _item_id_to_name[item] + if _item_id_to_name["Lingo"].has(item): + item_name = _item_id_to_name["Lingo"][item] if gamedata.door_ids_by_item_id.has(int(item)): var doorsNode = get_tree().get_root().get_node("Spatial/Doors") @@ -711,8 +719,8 @@ func processItem(item, index, from, flags): processItem(subitem_id, null, null, null) _progressive_progress[int(item)] += 1 - if _color_shuffle and color_items.has(_item_id_to_name[item]): - var lcol = _item_id_to_name[item].to_lower() + if _color_shuffle and color_items.has(_item_id_to_name["Lingo"][item]): + var lcol = _item_id_to_name["Lingo"][item].to_lower() if not _has_colors.has(lcol): _has_colors.append(lcol) emit_signal("evaluate_solvability") -- cgit 1.4.1