diff options
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r-- | Archipelago/client.gd | 118 |
1 files changed, 67 insertions, 51 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 6f5fefe..c690986 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -7,6 +7,7 @@ var SCRIPT_multiplayer | |||
7 | var SCRIPT_mypainting | 7 | var SCRIPT_mypainting |
8 | var SCRIPT_notifier | 8 | var SCRIPT_notifier |
9 | var SCRIPT_panel | 9 | var SCRIPT_panel |
10 | var SCRIPT_pilgrimage_terminator | ||
10 | var SCRIPT_uuid | 11 | var SCRIPT_uuid |
11 | 12 | ||
12 | var ap_server = "" | 13 | var ap_server = "" |
@@ -17,59 +18,28 @@ var enable_multiplayer = false | |||
17 | var track_player = false | 18 | var track_player = false |
18 | var connection_history = [] | 19 | var connection_history = [] |
19 | 20 | ||
20 | const my_version = "2.2.0" | 21 | const my_version = "3.0.1" |
21 | const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} | 22 | const ap_version = {"major": 0, "minor": 4, "build": 6, "class": "Version"} |
22 | const color_items = [ | 23 | const color_items = [ |
23 | "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" | 24 | "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" |
24 | ] | 25 | ] |
25 | const progressive_items = { | 26 | const progressive_items = { |
26 | "Progressive Orange Tower": | 27 | "Progressive Orange Tower": |
27 | [ | 28 | ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"], |
28 | {"item": "Orange Tower - Second Floor", "display": "Second Floor"}, | ||
29 | {"item": "Orange Tower - Third Floor", "display": "Third Floor"}, | ||
30 | {"item": "Orange Tower - Fourth Floor", "display": "Fourth Floor"}, | ||
31 | {"item": "Orange Tower - Fifth Floor", "display": "Fifth Floor"}, | ||
32 | {"item": "Orange Tower - Sixth Floor", "display": "Sixth Floor"}, | ||
33 | {"item": "Orange Tower - Seventh Floor", "display": "Seventh Floor"}, | ||
34 | ], | ||
35 | "Progressive Art Gallery": | 29 | "Progressive Art Gallery": |
36 | [ | 30 | ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Exit"], |
37 | {"item": "Art Gallery - Second Floor", "display": "Second Floor"}, | 31 | "Progressive Hallway Room": ["First Door", "Second Door", "Third Door", "Fourth Door"], |
38 | {"item": "Art Gallery - Third Floor", "display": "Third Floor"}, | 32 | "Progressive Fearless": ["Second Floor", "Third Floor"], |
39 | {"item": "Art Gallery - Fourth Floor", "display": "Fourth Floor"}, | ||
40 | {"item": "Art Gallery - Fifth Floor", "display": "Fifth Floor"}, | ||
41 | {"item": "Art Gallery - Exit", "display": "Exit"}, | ||
42 | ], | ||
43 | "Progressive Hallway Room": | ||
44 | [ | ||
45 | {"item": "Outside The Agreeable - Hallway Door", "display": "First Door"}, | ||
46 | {"item": "Hallway Room (2) - Exit", "display": "Second Door"}, | ||
47 | {"item": "Hallway Room (3) - Exit", "display": "Third Door"}, | ||
48 | {"item": "Hallway Room (4) - Exit", "display": "Fourth Door"}, | ||
49 | ], | ||
50 | "Progressive Fearless": | ||
51 | [ | ||
52 | {"item": "The Fearless (First Floor) - Second Floor", "display": "Second Floor"}, | ||
53 | {"item": "The Fearless (Second Floor) - Third Floor", "display": "Third Floor"}, | ||
54 | ], | ||
55 | "Progressive Colorful": | 33 | "Progressive Colorful": |
56 | [ | 34 | ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"], |
57 | {"item": "The Colorful - White Door", "display": "White"}, | 35 | "Progressive Pilgrimage": |
58 | {"item": "The Colorful - Black Door", "display": "Black"}, | 36 | ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"] |
59 | {"item": "The Colorful - Red Door", "display": "Red"}, | ||
60 | {"item": "The Colorful - Yellow Door", "display": "Yellow"}, | ||
61 | {"item": "The Colorful - Blue Door", "display": "Blue"}, | ||
62 | {"item": "The Colorful - Purple Door", "display": "Purple"}, | ||
63 | {"item": "The Colorful - Orange Door", "display": "Orange"}, | ||
64 | {"item": "The Colorful - Green Door", "display": "Green"}, | ||
65 | {"item": "The Colorful - Brown Door", "display": "Brown"}, | ||
66 | {"item": "The Colorful - Gray Door", "display": "Gray"}, | ||
67 | ] | ||
68 | } | 37 | } |
69 | 38 | ||
70 | const kTHE_END = 0 | 39 | const kTHE_END = 0 |
71 | const kTHE_MASTER = 1 | 40 | const kTHE_MASTER = 1 |
72 | const kLEVEL_2 = 2 | 41 | const kLEVEL_2 = 2 |
42 | const kPILGRIMAGE = 3 | ||
73 | 43 | ||
74 | const kNO_PANEL_SHUFFLE = 0 | 44 | const kNO_PANEL_SHUFFLE = 0 |
75 | const kREARRANGE_PANELS = 1 | 45 | const kREARRANGE_PANELS = 1 |
@@ -83,6 +53,12 @@ const kCLASSIFICATION_REMOTE_NORMAL = 0 | |||
83 | const kCLASSIFICATION_REMOTE_REDUCED = 1 | 53 | const kCLASSIFICATION_REMOTE_REDUCED = 1 |
84 | const kCLASSIFICATION_REMOTE_INSANITY = 2 | 54 | const kCLASSIFICATION_REMOTE_INSANITY = 2 |
85 | 55 | ||
56 | const kSUNWARP_ACCESS_NORMAL = 0 | ||
57 | const kSUNWARP_ACCESS_DISABLED = 1 | ||
58 | const kSUNWARP_ACCESS_UNLOCK = 2 | ||
59 | const kSUNWARP_ACCESS_INDIVIDUAL = 3 | ||
60 | const kSUNWARP_ACCESS_PROGRESSIVE = 4 | ||
61 | |||
86 | var _client = WebSocketClient.new() | 62 | var _client = WebSocketClient.new() |
87 | var _should_process = false | 63 | var _should_process = false |
88 | var _initiated_disconnect = false | 64 | var _initiated_disconnect = false |
@@ -115,10 +91,17 @@ var _door_shuffle = false | |||
115 | var _color_shuffle = false | 91 | var _color_shuffle = false |
116 | var _panel_shuffle = 0 # none, rearrange | 92 | var _panel_shuffle = 0 # none, rearrange |
117 | var _painting_shuffle = false | 93 | var _painting_shuffle = false |
94 | var _sunwarp_access = 0 # normal, disabled, unlock, progressive | ||
118 | var _mastery_achievements = 21 | 95 | var _mastery_achievements = 21 |
119 | var _level_2_requirement = 223 | 96 | var _level_2_requirement = 223 |
120 | var _location_classification_bit = 0 | 97 | var _location_classification_bit = 0 |
121 | var _early_color_hallways = false | 98 | var _early_color_hallways = false |
99 | var _pilgrimage_compatibility = false # set to true for pre-0.4.6 | ||
100 | var _pilgrimage_enabled = false | ||
101 | var _pilgrimage_allows_roof_access = false | ||
102 | var _pilgrimage_allows_paintings = false | ||
103 | var _sunwarp_shuffle = false | ||
104 | var _sunwarp_mapping = [] | ||
122 | var _slot_seed = 0 | 105 | var _slot_seed = 0 |
123 | 106 | ||
124 | var _map_loaded = false | 107 | var _map_loaded = false |
@@ -293,6 +276,10 @@ func _on_data(): | |||
293 | _painting_shuffle = _slot_data["shuffle_paintings"] | 276 | _painting_shuffle = _slot_data["shuffle_paintings"] |
294 | if _slot_data.has("shuffle_panels"): | 277 | if _slot_data.has("shuffle_panels"): |
295 | _panel_shuffle = _slot_data["shuffle_panels"] | 278 | _panel_shuffle = _slot_data["shuffle_panels"] |
279 | if _slot_data.has("sunwarp_access"): | ||
280 | _sunwarp_access = _slot_data["sunwarp_access"] | ||
281 | else: | ||
282 | _sunwarp_access = kSUNWARP_ACCESS_NORMAL | ||
296 | if _slot_data.has("seed"): | 283 | if _slot_data.has("seed"): |
297 | _slot_seed = _slot_data["seed"] | 284 | _slot_seed = _slot_data["seed"] |
298 | if _slot_data.has("painting_entrance_to_exit"): | 285 | if _slot_data.has("painting_entrance_to_exit"): |
@@ -316,6 +303,25 @@ func _on_data(): | |||
316 | _early_color_hallways = _slot_data["early_color_hallways"] | 303 | _early_color_hallways = _slot_data["early_color_hallways"] |
317 | else: | 304 | else: |
318 | _early_color_hallways = false | 305 | _early_color_hallways = false |
306 | if _slot_data.has("enable_pilgrimage"): | ||
307 | _pilgrimage_enabled = _slot_data["enable_pilgrimage"] | ||
308 | else: | ||
309 | _pilgrimage_compatibility = true | ||
310 | _pilgrimage_enabled = true | ||
311 | if _slot_data.has("pilgrimage_allows_roof_access"): | ||
312 | _pilgrimage_allows_roof_access = _slot_data["pilgrimage_allows_roof_access"] | ||
313 | else: | ||
314 | _pilgrimage_allows_roof_access = true | ||
315 | if _slot_data.has("pilgrimage_allows_paintings"): | ||
316 | _pilgrimage_allows_paintings = _slot_data["pilgrimage_allows_paintings"] | ||
317 | else: | ||
318 | _pilgrimage_allows_paintings = true | ||
319 | if _slot_data.has("shuffle_sunwarps"): | ||
320 | _sunwarp_shuffle = _slot_data["shuffle_sunwarps"] | ||
321 | else: | ||
322 | _sunwarp_shuffle = false | ||
323 | if _slot_data.has("sunwarp_permutation"): | ||
324 | _sunwarp_mapping = _slot_data["sunwarp_permutation"] | ||
319 | 325 | ||
320 | if _door_shuffle and not _early_color_hallways: | 326 | if _door_shuffle and not _early_color_hallways: |
321 | _location_classification_bit += kCLASSIFICATION_LOCAL_SMALL_SPHERE_ONE | 327 | _location_classification_bit += kCLASSIFICATION_LOCAL_SMALL_SPHERE_ONE |
@@ -702,16 +708,22 @@ func processItem(item, index, from, flags): | |||
702 | if painting_node != null: | 708 | if painting_node != null: |
703 | painting_node.get_node("Script").movePainting() | 709 | painting_node.get_node("Script").movePainting() |
704 | 710 | ||
711 | if gamedata.warp_ids_by_item_id.has(int(item)): | ||
712 | var warpsNode = get_tree().get_root().get_node("Spatial/Warps") | ||
713 | for warp_id in gamedata.warp_ids_by_item_id[int(item)]: | ||
714 | warpsNode.get_node(warp_id).unlock_warp() | ||
715 | |||
705 | # Handle progressive items. | 716 | # Handle progressive items. |
706 | if item_name in progressive_items.keys(): | 717 | if int(item) in gamedata.items_by_progressive_id.keys(): |
707 | if not item_name in _progressive_progress: | 718 | if not int(item) in _progressive_progress: |
708 | _progressive_progress[item_name] = 0 | 719 | _progressive_progress[int(item)] = 0 |
709 | 720 | ||
710 | if _progressive_progress[item_name] < progressive_items[item_name].size(): | 721 | if _progressive_progress[int(item)] < gamedata.items_by_progressive_id[int(item)].size(): |
711 | var subitem_name = progressive_items[item_name][_progressive_progress[item_name]]["item"] | 722 | var subitems = gamedata.items_by_progressive_id[int(item)] |
712 | global._print(subitem_name) | 723 | var subitem_id = subitems[_progressive_progress[int(item)]] |
713 | processItem(_item_name_to_id[subitem_name], null, null, null) | 724 | global._print("Subitem: %d" % subitem_id) |
714 | _progressive_progress[item_name] += 1 | 725 | processItem(subitem_id, null, null, null) |
726 | _progressive_progress[int(item)] += 1 | ||
715 | 727 | ||
716 | if _color_shuffle and color_items.has(_item_id_to_name[item]): | 728 | if _color_shuffle and color_items.has(_item_id_to_name[item]): |
717 | var lcol = _item_id_to_name[item].to_lower() | 729 | var lcol = _item_id_to_name[item].to_lower() |
@@ -725,8 +737,8 @@ func processItem(item, index, from, flags): | |||
725 | saveLocaldata() | 737 | saveLocaldata() |
726 | 738 | ||
727 | if item_name in progressive_items: | 739 | if item_name in progressive_items: |
728 | var subitem = progressive_items[item_name][_progressive_progress[item_name] - 1] | 740 | var subitem = progressive_items[item_name][_progressive_progress[int(item)] - 1] |
729 | item_name += " (%s)" % subitem["display"] | 741 | item_name += " (%s)" % subitem |
730 | 742 | ||
731 | var player_name = "Unknown" | 743 | var player_name = "Unknown" |
732 | if _player_name_by_slot.has(from): | 744 | if _player_name_by_slot.has(from): |
@@ -762,6 +774,10 @@ func paintingIsVanilla(painting): | |||
762 | return !$Gamedata.mentioned_paintings.has(painting) | 774 | return !$Gamedata.mentioned_paintings.has(painting) |
763 | 775 | ||
764 | 776 | ||
777 | func warpIsVanilla(warp): | ||
778 | return !$Gamedata.mentioned_warps.has(warp) | ||
779 | |||
780 | |||
765 | func evaluateSolvability(): | 781 | func evaluateSolvability(): |
766 | emit_signal("evaluate_solvability") | 782 | emit_signal("evaluate_solvability") |
767 | 783 | ||