about summary refs log tree commit diff stats
path: root/Archipelago/client.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd118
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
7var SCRIPT_mypainting 7var SCRIPT_mypainting
8var SCRIPT_notifier 8var SCRIPT_notifier
9var SCRIPT_panel 9var SCRIPT_panel
10var SCRIPT_pilgrimage_terminator
10var SCRIPT_uuid 11var SCRIPT_uuid
11 12
12var ap_server = "" 13var ap_server = ""
@@ -17,59 +18,28 @@ var enable_multiplayer = false
17var track_player = false 18var track_player = false
18var connection_history = [] 19var connection_history = []
19 20
20const my_version = "2.2.0" 21const my_version = "3.0.1"
21const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} 22const ap_version = {"major": 0, "minor": 4, "build": 6, "class": "Version"}
22const color_items = [ 23const 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]
25const progressive_items = { 26const 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
70const kTHE_END = 0 39const kTHE_END = 0
71const kTHE_MASTER = 1 40const kTHE_MASTER = 1
72const kLEVEL_2 = 2 41const kLEVEL_2 = 2
42const kPILGRIMAGE = 3
73 43
74const kNO_PANEL_SHUFFLE = 0 44const kNO_PANEL_SHUFFLE = 0
75const kREARRANGE_PANELS = 1 45const kREARRANGE_PANELS = 1
@@ -83,6 +53,12 @@ const kCLASSIFICATION_REMOTE_NORMAL = 0
83const kCLASSIFICATION_REMOTE_REDUCED = 1 53const kCLASSIFICATION_REMOTE_REDUCED = 1
84const kCLASSIFICATION_REMOTE_INSANITY = 2 54const kCLASSIFICATION_REMOTE_INSANITY = 2
85 55
56const kSUNWARP_ACCESS_NORMAL = 0
57const kSUNWARP_ACCESS_DISABLED = 1
58const kSUNWARP_ACCESS_UNLOCK = 2
59const kSUNWARP_ACCESS_INDIVIDUAL = 3
60const kSUNWARP_ACCESS_PROGRESSIVE = 4
61
86var _client = WebSocketClient.new() 62var _client = WebSocketClient.new()
87var _should_process = false 63var _should_process = false
88var _initiated_disconnect = false 64var _initiated_disconnect = false
@@ -115,10 +91,17 @@ var _door_shuffle = false
115var _color_shuffle = false 91var _color_shuffle = false
116var _panel_shuffle = 0 # none, rearrange 92var _panel_shuffle = 0 # none, rearrange
117var _painting_shuffle = false 93var _painting_shuffle = false
94var _sunwarp_access = 0 # normal, disabled, unlock, progressive
118var _mastery_achievements = 21 95var _mastery_achievements = 21
119var _level_2_requirement = 223 96var _level_2_requirement = 223
120var _location_classification_bit = 0 97var _location_classification_bit = 0
121var _early_color_hallways = false 98var _early_color_hallways = false
99var _pilgrimage_compatibility = false # set to true for pre-0.4.6
100var _pilgrimage_enabled = false
101var _pilgrimage_allows_roof_access = false
102var _pilgrimage_allows_paintings = false
103var _sunwarp_shuffle = false
104var _sunwarp_mapping = []
122var _slot_seed = 0 105var _slot_seed = 0
123 106
124var _map_loaded = false 107var _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
777func warpIsVanilla(warp):
778 return !$Gamedata.mentioned_warps.has(warp)
779
780
765func evaluateSolvability(): 781func evaluateSolvability():
766 emit_signal("evaluate_solvability") 782 emit_signal("evaluate_solvability")
767 783