diff options
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r-- | Archipelago/client.gd | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 0625c82..19fcee1 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -18,7 +18,7 @@ var enable_multiplayer = false | |||
18 | var track_player = false | 18 | var track_player = false |
19 | var connection_history = [] | 19 | var connection_history = [] |
20 | 20 | ||
21 | const my_version = "3.0.1" | 21 | const my_version = "3.0.3" |
22 | const ap_version = {"major": 0, "minor": 4, "build": 6, "class": "Version"} | 22 | const ap_version = {"major": 0, "minor": 4, "build": 6, "class": "Version"} |
23 | const color_items = [ | 23 | const color_items = [ |
24 | "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" | 24 | "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" |
@@ -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 = {} |
@@ -133,6 +134,10 @@ func _init(): | |||
133 | var data = file.get_var(true) | 134 | var data = file.get_var(true) |
134 | file.close() | 135 | file.close() |
135 | 136 | ||
137 | if typeof(data) != TYPE_ARRAY: | ||
138 | global._print("AP settings file is corrupted") | ||
139 | data = [] | ||
140 | |||
136 | if data.size() > 0: | 141 | if data.size() > 0: |
137 | ap_server = data[0] | 142 | ap_server = data[0] |
138 | if data.size() > 1: | 143 | if data.size() > 1: |
@@ -257,6 +262,7 @@ func _on_data(): | |||
257 | 262 | ||
258 | for player in _players: | 263 | for player in _players: |
259 | _player_name_by_slot[player["slot"]] = player["alias"] | 264 | _player_name_by_slot[player["slot"]] = player["alias"] |
265 | _game_by_player[player["slot"]] = message["slot_info"][str(player["slot"])]["game"] | ||
260 | 266 | ||
261 | _death_link = _slot_data.has("death_link") and _slot_data["death_link"] | 267 | _death_link = _slot_data.has("death_link") and _slot_data["death_link"] |
262 | if _death_link: | 268 | if _death_link: |
@@ -327,6 +333,10 @@ func _on_data(): | |||
327 | var localdata = ap_file.get_var(true) | 333 | var localdata = ap_file.get_var(true) |
328 | ap_file.close() | 334 | ap_file.close() |
329 | 335 | ||
336 | if typeof(localdata) != TYPE_ARRAY: | ||
337 | global._print("AP localdata file is corrupted") | ||
338 | localdata = [] | ||
339 | |||
330 | if localdata.size() > 0: | 340 | if localdata.size() > 0: |
331 | _last_new_item = localdata[0] | 341 | _last_new_item = localdata[0] |
332 | else: | 342 | else: |
@@ -436,12 +446,14 @@ func _on_data(): | |||
436 | continue | 446 | continue |
437 | 447 | ||
438 | var item_name = "Unknown" | 448 | var item_name = "Unknown" |
439 | if _item_id_to_name.has(message["item"]["item"]): | 449 | var item_player_game = _game_by_player[message["receiving"]] |
440 | item_name = _item_id_to_name[message["item"]["item"]] | 450 | if _item_id_to_name[item_player_game].has(message["item"]["item"]): |
451 | item_name = _item_id_to_name[item_player_game][message["item"]["item"]] | ||
441 | 452 | ||
442 | var location_name = "Unknown" | 453 | var location_name = "Unknown" |
443 | if _location_id_to_name.has(message["item"]["location"]): | 454 | var location_player_game = _game_by_player[message["item"]["player"]] |
444 | location_name = _location_id_to_name[message["item"]["location"]] | 455 | if _location_id_to_name[location_player_game].has(message["item"]["location"]): |
456 | location_name = _location_id_to_name[location_player_game][message["item"]["location"]] | ||
445 | 457 | ||
446 | var player_name = "Unknown" | 458 | var player_name = "Unknown" |
447 | if _player_name_by_slot.has(message["receiving"]): | 459 | if _player_name_by_slot.has(message["receiving"]): |
@@ -595,12 +607,16 @@ func requestDatapackages(games): | |||
595 | func processDatapackages(): | 607 | func processDatapackages(): |
596 | _item_id_to_name = {} | 608 | _item_id_to_name = {} |
597 | _location_id_to_name = {} | 609 | _location_id_to_name = {} |
598 | for package in _datapackages.values(): | 610 | for game in _datapackages.keys(): |
611 | var package = _datapackages[game] | ||
612 | |||
613 | _item_id_to_name[game] = {} | ||
599 | for name in package["item_name_to_id"].keys(): | 614 | for name in package["item_name_to_id"].keys(): |
600 | _item_id_to_name[package["item_name_to_id"][name]] = name | 615 | _item_id_to_name[game][package["item_name_to_id"][name]] = name |
601 | 616 | ||
617 | _location_id_to_name[game] = {} | ||
602 | for name in package["location_name_to_id"].keys(): | 618 | for name in package["location_name_to_id"].keys(): |
603 | _location_id_to_name[package["location_name_to_id"][name]] = name | 619 | _location_id_to_name[game][package["location_name_to_id"][name]] = name |
604 | 620 | ||
605 | if _datapackages.has("Lingo"): | 621 | if _datapackages.has("Lingo"): |
606 | _item_name_to_id = _datapackages["Lingo"]["item_name_to_id"] | 622 | _item_name_to_id = _datapackages["Lingo"]["item_name_to_id"] |
@@ -690,8 +706,8 @@ func processItem(item, index, from, flags): | |||
690 | 706 | ||
691 | var gamedata = $Gamedata | 707 | var gamedata = $Gamedata |
692 | var item_name = "Unknown" | 708 | var item_name = "Unknown" |
693 | if _item_id_to_name.has(item): | 709 | if _item_id_to_name["Lingo"].has(item): |
694 | item_name = _item_id_to_name[item] | 710 | item_name = _item_id_to_name["Lingo"][item] |
695 | 711 | ||
696 | if gamedata.door_ids_by_item_id.has(int(item)): | 712 | if gamedata.door_ids_by_item_id.has(int(item)): |
697 | var doorsNode = get_tree().get_root().get_node("Spatial/Doors") | 713 | var doorsNode = get_tree().get_root().get_node("Spatial/Doors") |
@@ -729,8 +745,8 @@ func processItem(item, index, from, flags): | |||
729 | processItem(subitem_id, null, null, null) | 745 | processItem(subitem_id, null, null, null) |
730 | _progressive_progress[int(item)] += 1 | 746 | _progressive_progress[int(item)] += 1 |
731 | 747 | ||
732 | if _color_shuffle and color_items.has(_item_id_to_name[item]): | 748 | if _color_shuffle and color_items.has(_item_id_to_name["Lingo"][item]): |
733 | var lcol = _item_id_to_name[item].to_lower() | 749 | var lcol = _item_id_to_name["Lingo"][item].to_lower() |
734 | if not _has_colors.has(lcol): | 750 | if not _has_colors.has(lcol): |
735 | _has_colors.append(lcol) | 751 | _has_colors.append(lcol) |
736 | emit_signal("evaluate_solvability") | 752 | emit_signal("evaluate_solvability") |