From a2138459de0ef60fa446be9b70310b11aaf78610 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 22 Aug 2023 12:20:28 -0400 Subject: Only necessary checks are sent out now i.e. the checks for every individual panel are not sent out if you are not playing panelsanity. --- util/generate_gamedata.rb | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'util/generate_gamedata.rb') 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' configpath = ARGV[0] outputpath = ARGV[1] +CLASSIFICATION_NORMAL = 1 +CLASSIFICATION_REDUCED = 2 +CLASSIFICATION_INSANITY = 4 + panel_to_id = {} door_groups = {} @@ -11,6 +15,7 @@ panel_output = [] door_ids_by_item_id = {} painting_ids_by_item_id = {} panel_ids_by_location_id = {} +classification_by_location_id = {} mentioned_doors = Set[] mentioned_paintings = Set[] painting_output = {} @@ -54,8 +59,17 @@ config.each do |room_name, room_data| end panel_output << ret + panel_ids_by_location_id[full_name] = [panel["id"]] + + classification_by_location_id[full_name] ||= 0 + classification_by_location_id[full_name] += CLASSIFICATION_INSANITY + if panel.include? "check" and panel["check"] - panel_ids_by_location_id[full_name] = [panel["id"]] + classification_by_location_id[full_name] += CLASSIFICATION_NORMAL + + unless panel.include? "exclude_reduce" and panel["exclude_reduce"] + classification_by_location_id[full_name] += CLASSIFICATION_REDUCED + end end end end @@ -105,6 +119,13 @@ config.each do |room_name, room_data| end panel_to_id[other_name] end + + classification_by_location_id[chosen_name] ||= 0 + classification_by_location_id[chosen_name] += CLASSIFICATION_NORMAL + + if door.include? "include_reduce" and door["include_reduce"] + classification_by_location_id[chosen_name] += CLASSIFICATION_REDUCED + end end if not (door.include? "skip_item" and door["skip_item"]) and @@ -189,5 +210,9 @@ File.open(outputpath, "w") do |f| f.write(painting_output.map do |painting_id, painting| "\"#{painting_id}\":{\"orientation\":\"#{painting["orientation"]}\",\"move\":#{painting.include? "move" and painting["move"]}}" end.join(",")) + f.write "}\nvar classification_by_location_id = {" + f.write(classification_by_location_id.map do |location_id, classification| + "\"#{location_id}\":#{classification}" + end.join(",")) f.write "}" end -- cgit 1.4.1