diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-29 13:27:48 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-29 13:27:48 -0400 |
commit | 6c3cb6286ae94bc41d07d4886e93b2e7d2489a28 (patch) | |
tree | 9ab3fed51589beb96cab79a3fec249941321dcfa /Archipelago/client.gd | |
parent | a35a4f40bb7999f61b139fe415227ea7adec5e59 (diff) | |
download | lingo-archipelago-6c3cb6286ae94bc41d07d4886e93b2e7d2489a28.tar.gz lingo-archipelago-6c3cb6286ae94bc41d07d4886e93b2e7d2489a28.tar.bz2 lingo-archipelago-6c3cb6286ae94bc41d07d4886e93b2e7d2489a28.zip |
Compatibility with not-unique IDs
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r-- | Archipelago/client.gd | 30 |
1 files changed, 19 insertions, 11 deletions
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 | |||
80 | var _slot = 0 | 80 | var _slot = 0 |
81 | var _players = [] | 81 | var _players = [] |
82 | var _player_name_by_slot = {} | 82 | var _player_name_by_slot = {} |
83 | var _game_by_player = {} | ||
83 | var _checked_locations = [] | 84 | var _checked_locations = [] |
84 | var _slot_data = {} | 85 | var _slot_data = {} |
85 | var _paintings_mapping = {} | 86 | var _paintings_mapping = {} |
@@ -256,6 +257,7 @@ func _on_data(): | |||
256 | 257 | ||
257 | for player in _players: | 258 | for player in _players: |
258 | _player_name_by_slot[player["slot"]] = player["alias"] | 259 | _player_name_by_slot[player["slot"]] = player["alias"] |
260 | _game_by_player[player["slot"]] = message["slot_info"][str(player["slot"])]["game"] | ||
259 | 261 | ||
260 | _death_link = _slot_data.has("death_link") and _slot_data["death_link"] | 262 | _death_link = _slot_data.has("death_link") and _slot_data["death_link"] |
261 | if _death_link: | 263 | if _death_link: |
@@ -423,12 +425,14 @@ func _on_data(): | |||
423 | continue | 425 | continue |
424 | 426 | ||
425 | var item_name = "Unknown" | 427 | var item_name = "Unknown" |
426 | if _item_id_to_name.has(message["item"]["item"]): | 428 | var item_player_game = _game_by_player[message["receiving"]] |
427 | item_name = _item_id_to_name[message["item"]["item"]] | 429 | if _item_id_to_name[item_player_game].has(message["item"]["item"]): |
430 | item_name = _item_id_to_name[item_player_game][message["item"]["item"]] | ||
428 | 431 | ||
429 | var location_name = "Unknown" | 432 | var location_name = "Unknown" |
430 | if _location_id_to_name.has(message["item"]["location"]): | 433 | var location_player_game = _game_by_player[message["item"]["player"]] |
431 | location_name = _location_id_to_name[message["item"]["location"]] | 434 | if _location_id_to_name[location_player_game].has(message["item"]["location"]): |
435 | location_name = _location_id_to_name[location_player_game][message["item"]["location"]] | ||
432 | 436 | ||
433 | var player_name = "Unknown" | 437 | var player_name = "Unknown" |
434 | if _player_name_by_slot.has(message["receiving"]): | 438 | if _player_name_by_slot.has(message["receiving"]): |
@@ -578,12 +582,16 @@ func requestDatapackages(games): | |||
578 | func processDatapackages(): | 582 | func processDatapackages(): |
579 | _item_id_to_name = {} | 583 | _item_id_to_name = {} |
580 | _location_id_to_name = {} | 584 | _location_id_to_name = {} |
581 | for package in _datapackages.values(): | 585 | for game in _datapackages.keys(): |
586 | var package = _datapackages[game] | ||
587 | |||
588 | _item_id_to_name[game] = {} | ||
582 | for name in package["item_name_to_id"].keys(): | 589 | for name in package["item_name_to_id"].keys(): |
583 | _item_id_to_name[package["item_name_to_id"][name]] = name | 590 | _item_id_to_name[game][package["item_name_to_id"][name]] = name |
584 | 591 | ||
592 | _location_id_to_name[game] = {} | ||
585 | for name in package["location_name_to_id"].keys(): | 593 | for name in package["location_name_to_id"].keys(): |
586 | _location_id_to_name[package["location_name_to_id"][name]] = name | 594 | _location_id_to_name[game][package["location_name_to_id"][name]] = name |
587 | 595 | ||
588 | if _datapackages.has("Lingo"): | 596 | if _datapackages.has("Lingo"): |
589 | _item_name_to_id = _datapackages["Lingo"]["item_name_to_id"] | 597 | _item_name_to_id = _datapackages["Lingo"]["item_name_to_id"] |
@@ -672,8 +680,8 @@ func processItem(item, index, from, flags): | |||
672 | 680 | ||
673 | var gamedata = $Gamedata | 681 | var gamedata = $Gamedata |
674 | var item_name = "Unknown" | 682 | var item_name = "Unknown" |
675 | if _item_id_to_name.has(item): | 683 | if _item_id_to_name["Lingo"].has(item): |
676 | item_name = _item_id_to_name[item] | 684 | item_name = _item_id_to_name["Lingo"][item] |
677 | 685 | ||
678 | if gamedata.door_ids_by_item_id.has(int(item)): | 686 | if gamedata.door_ids_by_item_id.has(int(item)): |
679 | var doorsNode = get_tree().get_root().get_node("Spatial/Doors") | 687 | var doorsNode = get_tree().get_root().get_node("Spatial/Doors") |
@@ -711,8 +719,8 @@ func processItem(item, index, from, flags): | |||
711 | processItem(subitem_id, null, null, null) | 719 | processItem(subitem_id, null, null, null) |
712 | _progressive_progress[int(item)] += 1 | 720 | _progressive_progress[int(item)] += 1 |
713 | 721 | ||
714 | if _color_shuffle and color_items.has(_item_id_to_name[item]): | 722 | if _color_shuffle and color_items.has(_item_id_to_name["Lingo"][item]): |
715 | var lcol = _item_id_to_name[item].to_lower() | 723 | var lcol = _item_id_to_name["Lingo"][item].to_lower() |
716 | if not _has_colors.has(lcol): | 724 | if not _has_colors.has(lcol): |
717 | _has_colors.append(lcol) | 725 | _has_colors.append(lcol) |
718 | emit_signal("evaluate_solvability") | 726 | emit_signal("evaluate_solvability") |