about summary refs log tree commit diff stats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/generate_gamedata.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index bf8e3ae..72f0932 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb
@@ -4,6 +4,10 @@ require 'yaml'
4configpath = ARGV[0] 4configpath = ARGV[0]
5outputpath = ARGV[1] 5outputpath = ARGV[1]
6 6
7CLASSIFICATION_NORMAL = 1
8CLASSIFICATION_REDUCED = 2
9CLASSIFICATION_INSANITY = 4
10
7panel_to_id = {} 11panel_to_id = {}
8door_groups = {} 12door_groups = {}
9 13
@@ -11,6 +15,7 @@ panel_output = []
11door_ids_by_item_id = {} 15door_ids_by_item_id = {}
12painting_ids_by_item_id = {} 16painting_ids_by_item_id = {}
13panel_ids_by_location_id = {} 17panel_ids_by_location_id = {}
18classification_by_location_id = {}
14mentioned_doors = Set[] 19mentioned_doors = Set[]
15mentioned_paintings = Set[] 20mentioned_paintings = Set[]
16painting_output = {} 21painting_output = {}
@@ -54,8 +59,17 @@ config.each do |room_name, room_data|
54 end 59 end
55 panel_output << ret 60 panel_output << ret
56 61
62 panel_ids_by_location_id[full_name] = [panel["id"]]
63
64 classification_by_location_id[full_name] ||= 0
65 classification_by_location_id[full_name] += CLASSIFICATION_INSANITY
66
57 if panel.include? "check" and panel["check"] 67 if panel.include? "check" and panel["check"]
58 panel_ids_by_location_id[full_name] = [panel["id"]] 68 classification_by_location_id[full_name] += CLASSIFICATION_NORMAL
69
70 unless panel.include? "exclude_reduce" and panel["exclude_reduce"]
71 classification_by_location_id[full_name] += CLASSIFICATION_REDUCED
72 end
59 end 73 end
60 end 74 end
61 end 75 end
@@ -105,6 +119,13 @@ config.each do |room_name, room_data|
105 end 119 end
106 panel_to_id[other_name] 120 panel_to_id[other_name]
107 end 121 end
122
123 classification_by_location_id[chosen_name] ||= 0
124 classification_by_location_id[chosen_name] += CLASSIFICATION_NORMAL
125
126 if door.include? "include_reduce" and door["include_reduce"]
127 classification_by_location_id[chosen_name] += CLASSIFICATION_REDUCED
128 end
108 end 129 end
109 130
110 if not (door.include? "skip_item" and door["skip_item"]) and 131 if not (door.include? "skip_item" and door["skip_item"]) and
@@ -189,5 +210,9 @@ File.open(outputpath, "w") do |f|
189 f.write(painting_output.map do |painting_id, painting| 210 f.write(painting_output.map do |painting_id, painting|
190 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" 211 "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}"
191 end.join(",")) 212 end.join(","))
213 f.write "}\nvar classification_by_location_id = {"
214 f.write(classification_by_location_id.map do |location_id, classification|
215 "\"#{location_id}\":#{classification}"
216 end.join(","))
192 f.write "}" 217 f.write "}"
193end 218end