diff options
-rw-r--r-- | Archipelago/client.gd | 74 | ||||
-rw-r--r-- | util/generate_gamedata.rb | 21 |
2 files changed, 37 insertions, 58 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 2229916..853be2d 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -25,56 +25,15 @@ const color_items = [ | |||
25 | ] | 25 | ] |
26 | const progressive_items = { | 26 | const progressive_items = { |
27 | "Progressive Orange Tower": | 27 | "Progressive Orange Tower": |
28 | [ | 28 | ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Sixth Floor", "Seventh Floor"], |
29 | {"item": "Orange Tower - Second Floor", "display": "Second Floor"}, | ||
30 | {"item": "Orange Tower - Third Floor", "display": "Third Floor"}, | ||
31 | {"item": "Orange Tower - Fourth Floor", "display": "Fourth Floor"}, | ||
32 | {"item": "Orange Tower - Fifth Floor", "display": "Fifth Floor"}, | ||
33 | {"item": "Orange Tower - Sixth Floor", "display": "Sixth Floor"}, | ||
34 | {"item": "Orange Tower - Seventh Floor", "display": "Seventh Floor"}, | ||
35 | ], | ||
36 | "Progressive Art Gallery": | 29 | "Progressive Art Gallery": |
37 | [ | 30 | ["Second Floor", "Third Floor", "Fourth Floor", "Fifth Floor", "Exit"], |
38 | {"item": "Art Gallery - Second Floor", "display": "Second Floor"}, | 31 | "Progressive Hallway Room": ["First Door", "Second Door", "Third Door", "Fourth Door"], |
39 | {"item": "Art Gallery - Third Floor", "display": "Third Floor"}, | 32 | "Progressive Fearless": ["Second Floor", "Third Floor"], |
40 | {"item": "Art Gallery - Fourth Floor", "display": "Fourth Floor"}, | ||
41 | {"item": "Art Gallery - Fifth Floor", "display": "Fifth Floor"}, | ||
42 | {"item": "Art Gallery - Exit", "display": "Exit"}, | ||
43 | ], | ||
44 | "Progressive Hallway Room": | ||
45 | [ | ||
46 | {"item": "Hallway Room (1) - Exit", "display": "First Door"}, | ||
47 | {"item": "Hallway Room (2) - Exit", "display": "Second Door"}, | ||
48 | {"item": "Hallway Room (3) - Exit", "display": "Third Door"}, | ||
49 | {"item": "Hallway Room (4) - Exit", "display": "Fourth Door"}, | ||
50 | ], | ||
51 | "Progressive Fearless": | ||
52 | [ | ||
53 | {"item": "The Fearless (First Floor) - Second Floor", "display": "Second Floor"}, | ||
54 | {"item": "The Fearless (Second Floor) - Third Floor", "display": "Third Floor"}, | ||
55 | ], | ||
56 | "Progressive Colorful": | 33 | "Progressive Colorful": |
57 | [ | 34 | ["White", "Black", "Red", "Yellow", "Blue", "Purple", "Orange", "Green", "Brown", "Gray"], |
58 | {"item": "The Colorful - White Door", "display": "White"}, | ||
59 | {"item": "The Colorful - Black Door", "display": "Black"}, | ||
60 | {"item": "The Colorful - Red Door", "display": "Red"}, | ||
61 | {"item": "The Colorful - Yellow Door", "display": "Yellow"}, | ||
62 | {"item": "The Colorful - Blue Door", "display": "Blue"}, | ||
63 | {"item": "The Colorful - Purple Door", "display": "Purple"}, | ||
64 | {"item": "The Colorful - Orange Door", "display": "Orange"}, | ||
65 | {"item": "The Colorful - Green Door", "display": "Green"}, | ||
66 | {"item": "The Colorful - Brown Door", "display": "Brown"}, | ||
67 | {"item": "The Colorful - Gray Door", "display": "Gray"}, | ||
68 | ], | ||
69 | "Progressive Pilgrimage": | 35 | "Progressive Pilgrimage": |
70 | [ | 36 | ["1 Sunwarp", "2 Sunwarp", "3 Sunwarp", "4 Sunwarp", "5 Sunwarp", "6 Sunwarp"] |
71 | {"item": "1 Sunwarp", "display": "1 Sunwarp"}, | ||
72 | {"item": "2 Sunwarp", "display": "2 Sunwarp"}, | ||
73 | {"item": "3 Sunwarp", "display": "3 Sunwarp"}, | ||
74 | {"item": "4 Sunwarp", "display": "4 Sunwarp"}, | ||
75 | {"item": "5 Sunwarp", "display": "5 Sunwarp"}, | ||
76 | {"item": "6 Sunwarp", "display": "6 Sunwarp"}, | ||
77 | ] | ||
78 | } | 37 | } |
79 | 38 | ||
80 | const kTHE_END = 0 | 39 | const kTHE_END = 0 |
@@ -741,15 +700,16 @@ func processItem(item, index, from, flags): | |||
741 | warpsNode.get_node(warp_id).unlock_warp() | 700 | warpsNode.get_node(warp_id).unlock_warp() |
742 | 701 | ||
743 | # Handle progressive items. | 702 | # Handle progressive items. |
744 | if item_name in progressive_items.keys(): | 703 | if int(item) in gamedata.items_by_progressive_id.keys(): |
745 | if not item_name in _progressive_progress: | 704 | if not int(item) in _progressive_progress: |
746 | _progressive_progress[item_name] = 0 | 705 | _progressive_progress[int(item)] = 0 |
747 | 706 | ||
748 | if _progressive_progress[item_name] < progressive_items[item_name].size(): | 707 | if _progressive_progress[int(item)] < gamedata.items_by_progressive_id[int(item)].size(): |
749 | var subitem_name = progressive_items[item_name][_progressive_progress[item_name]]["item"] | 708 | var subitems = gamedata.items_by_progressive_id[int(item)] |
750 | global._print(subitem_name) | 709 | var subitem_id = subitems[_progressive_progress[int(item)]] |
751 | processItem(_item_name_to_id[subitem_name], null, null, null) | 710 | global._print("Subitem: %d" % subitem_id) |
752 | _progressive_progress[item_name] += 1 | 711 | processItem(subitem_id, null, null, null) |
712 | _progressive_progress[int(item)] += 1 | ||
753 | 713 | ||
754 | if _color_shuffle and color_items.has(_item_id_to_name[item]): | 714 | if _color_shuffle and color_items.has(_item_id_to_name[item]): |
755 | var lcol = _item_id_to_name[item].to_lower() | 715 | var lcol = _item_id_to_name[item].to_lower() |
@@ -763,8 +723,8 @@ func processItem(item, index, from, flags): | |||
763 | saveLocaldata() | 723 | saveLocaldata() |
764 | 724 | ||
765 | if item_name in progressive_items: | 725 | if item_name in progressive_items: |
766 | var subitem = progressive_items[item_name][_progressive_progress[item_name] - 1] | 726 | var subitem = progressive_items[item_name][_progressive_progress[int(item)] - 1] |
767 | item_name += " (%s)" % subitem["display"] | 727 | item_name += " (%s)" % subitem |
768 | 728 | ||
769 | var player_name = "Unknown" | 729 | var player_name = "Unknown" |
770 | if _player_name_by_slot.has(from): | 730 | if _player_name_by_slot.has(from): |
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index cf57395..1f18b7e 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb | |||
@@ -24,6 +24,7 @@ mentioned_doors = Set[] | |||
24 | mentioned_paintings = Set[] | 24 | mentioned_paintings = Set[] |
25 | mentioned_warps = Set[] | 25 | mentioned_warps = Set[] |
26 | painting_output = {} | 26 | painting_output = {} |
27 | items_by_progressive_id = {} | ||
27 | 28 | ||
28 | ids_config = YAML.load_file(idspath) | 29 | ids_config = YAML.load_file(idspath) |
29 | 30 | ||
@@ -102,6 +103,20 @@ config.each do |room_name, room_data| | |||
102 | sunwarps[index] = sunwarp | 103 | sunwarps[index] = sunwarp |
103 | end | 104 | end |
104 | end | 105 | end |
106 | |||
107 | if room_data.include? "progression" | ||
108 | room_data["progression"].each do |progressive_item_name, progression| | ||
109 | progressive_id = ids_config["progression"][progressive_item_name] | ||
110 | items_by_progressive_id[progressive_id] = [] | ||
111 | |||
112 | progression.each do |item| | ||
113 | item_room_name = (item.kind_of? Hash) ? item["room"] : room_name | ||
114 | item_item_name = (item.kind_of? Hash) ? item["door"] : item | ||
115 | |||
116 | items_by_progressive_id[progressive_id] << ids_config["doors"][item_room_name][item_item_name]["item"] | ||
117 | end | ||
118 | end | ||
119 | end | ||
105 | end | 120 | end |
106 | 121 | ||
107 | config.each do |room_name, room_data| | 122 | config.each do |room_name, room_data| |
@@ -253,5 +268,9 @@ File.open(outputpath, "w") do |f| | |||
253 | f.write(sunwarps.map do |sunwarp| | 268 | f.write(sunwarps.map do |sunwarp| |
254 | "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}" | 269 | "{\"orientation\":\"#{sunwarp["orientation"]}\",\"entrance_indicator_pos\":#{sunwarp["entrance_indicator_pos"].to_s}}" |
255 | end.join(",")) | 270 | end.join(",")) |
256 | f.write "]" | 271 | f.write "]\nvar items_by_progressive_id = {" |
272 | f.write(items_by_progressive_id.map do |item_id, progression_ids| | ||
273 | "#{item_id}:[" + progression_ids.map(&:to_s).join(",") + "]" | ||
274 | end.join(",")) | ||
275 | f.write "}" | ||
257 | end | 276 | end |