From c1fb09fcb53ca5682a2cc1cce38dbdbcfd38e5c7 Mon Sep 17 00:00:00 2001 From: tdixon Date: Tue, 1 Aug 2017 23:29:42 -0300 Subject: [PATCH] Use POSIX path separators --- scripts/Script.rb | 150 +++++++++++++++++++++++----------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/scripts/Script.rb b/scripts/Script.rb index 8288cb4..e60ec21 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -140,7 +140,7 @@ module Script end return false end - + def self.countdown_extend_over equinox = Time.new(2017, 03, 27) diff = equinox - Time.now @@ -149,7 +149,7 @@ module Script end return false end - + def self.cdown_update(equinox) diff = equinox - Time.now if(diff < 0) @@ -217,7 +217,7 @@ module Script def self.countdown_update return cdown_update(Time.new(2017, 03, 27)) end - + def self.countdown_extend_update return cdown_update(Time.new(2017, 03, 27)) end @@ -254,7 +254,7 @@ module Script end end end - + def self.niko_reflection_enc_update for event in $game_map.events.values if event.name == "niko reflection" @@ -268,7 +268,7 @@ module Script if event.real_y > 19*128 event.real_y = 19*128 end - + if event.x > 14 event.x = 14 elsif event.x < 6 @@ -279,7 +279,7 @@ module Script elsif event.real_x < (6*128) + 32 event.real_x = (6*128) + 32 end - + event.direction = $game_player.direction event.pattern = $game_player.pattern case event.direction @@ -292,8 +292,8 @@ module Script end end end - - + + def self.niko_reflection_peng_update for event in $game_map.events.values if event.name == "niko reflection" @@ -307,7 +307,7 @@ module Script if event.real_y > 19*128 event.real_y = 19*128 end - + if event.x > 14 event.x = 14 elsif event.x < 6 @@ -318,7 +318,7 @@ module Script elsif event.real_x < (6*128) + 32 event.real_x = (6*128) + 32 end - + return end end @@ -373,11 +373,11 @@ module Script end def self.copy_journal - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games") unless File.exists?(Oneshot::DOCS_PATH + "/My Games") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot") begin File.open("_______.exe", "rb") do |input| - File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\_______.exe","wb") do |output| + File.open(Oneshot::DOCS_PATH + "/My Games/Oneshot/_______.exe","wb") do |output| while buff = input.read(4096) output.write(buff) end @@ -388,7 +388,7 @@ module Script end if File.exists?("README.txt") File.open("README.txt", "rb") do |input| - File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\README.txt","wb") do |output| + File.open(Oneshot::DOCS_PATH + "/My Games/Oneshot/README.txt","wb") do |output| while buff = input.read(4096) output.write(buff) end @@ -396,43 +396,43 @@ module Script end end end - + def self.create_boxes - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games") unless File.exists?(Oneshot::DOCS_PATH + "/My Games") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal1") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal1") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal2") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal2") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal3") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal3") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal") end - + def self.delete_if_exists(f_name) File.delete(f_name) unless !File.exists?(f_name) end - + def self.clear_boxes for i in 1..3 - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + i.to_s + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + i.to_s case i when 1 - delete_if_exists(portal_path + "\\blue_npc_prototype.png") - delete_if_exists(portal_path + "\\proto1.png") - delete_if_exists(portal_path + "\\keyB.txt") + delete_if_exists(portal_path + "/blue_npc_prototype.png") + delete_if_exists(portal_path + "/proto1.png") + delete_if_exists(portal_path + "/keyB.txt") when 2 - delete_if_exists(portal_path + "\\green_npc_cedric.png") - delete_if_exists(portal_path + "\\cedric.png") - delete_if_exists(portal_path + "\\keyG.txt") + delete_if_exists(portal_path + "/green_npc_cedric.png") + delete_if_exists(portal_path + "/cedric.png") + delete_if_exists(portal_path + "/keyG.txt") when 3 - delete_if_exists(portal_path + "\\red_rue.png") - delete_if_exists(portal_path + "\\rue.png") - delete_if_exists(portal_path + "\\keyR.txt") + delete_if_exists(portal_path + "/red_rue.png") + delete_if_exists(portal_path + "/rue.png") + delete_if_exists(portal_path + "/keyR.txt") end end - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyB.txt") - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyG.txt") - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyR.txt") + delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyB.txt") + delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyG.txt") + delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyR.txt") end - + def self.copy_file(src, dst) begin File.open(src, "rb") do |input| @@ -446,79 +446,79 @@ module Script #this probably means the file already exists and is open, so no need to create it again end end - + def self.write_key(dst, str) File.open(dst, 'w') do |file| file.puts(str) end end - + def self.put_key_in_box(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + numb.to_s case numb when 1 - copy_file("Graphics\\Characters\\blue_npc_prototype.png", portal_path + "\\blue_npc_prototype.png") - copy_file("Graphics\\Faces\\proto1.png", portal_path + "\\proto1.png") - write_key(portal_path + "\\keyB.txt", PROTO_TEXT) + copy_file("Graphics/Characters/blue_npc_prototype.png", portal_path + "/blue_npc_prototype.png") + copy_file("Graphics/Faces/proto1.png", portal_path + "/proto1.png") + write_key(portal_path + "/keyB.txt", PROTO_TEXT) when 2 - copy_file("Graphics\\Characters\\green_npc_cedric.png", portal_path + "\\green_npc_cedric.png") - copy_file("Graphics\\Faces\\cedric.png", portal_path + "\\cedric.png") - write_key(portal_path + "\\keyG.txt", CEDRIC_TEXT) + copy_file("Graphics/Characters/green_npc_cedric.png", portal_path + "/green_npc_cedric.png") + copy_file("Graphics/Faces/cedric.png", portal_path + "/cedric.png") + write_key(portal_path + "/keyG.txt", CEDRIC_TEXT) when 3 - copy_file("Graphics\\Characters\\red_rue.png", portal_path + "\\red_rue.png") - copy_file("Graphics\\Faces\\rue.png", portal_path + "\\rue.png") - write_key(portal_path + "\\keyR.txt", RUE_TEXT) + copy_file("Graphics/Characters/red_rue.png", portal_path + "/red_rue.png") + copy_file("Graphics/Faces/rue.png", portal_path + "/rue.png") + write_key(portal_path + "/keyR.txt", RUE_TEXT) end - + end - + def self.password1 - copy_file("Graphics\\Fogs\\_\\scenario1\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") + copy_file("Graphics/Fogs/_/scenario1/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png") + copy_file("Graphics/Fogs/_/scenario1/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png") + copy_file("Graphics/Fogs/_/scenario1/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png") + copy_file("Graphics/Fogs/_/scenario1/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png") end - + def self.password2 - copy_file("Graphics\\Fogs\\_\\scenario2\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") + copy_file("Graphics/Fogs/_/scenario2/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png") + copy_file("Graphics/Fogs/_/scenario2/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png") + copy_file("Graphics/Fogs/_/scenario2/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png") + copy_file("Graphics/Fogs/_/scenario2/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png") end - + =begin def self.take_key_out_of_box(numb) - if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") - File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") + if File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png") + File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png") end - if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") - File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") + if File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigBox/key" + numb.to_s + ".png") + File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigBox/key" + numb.to_s + ".png") end end =end - + def self.is_key_in_box(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + numb.to_s case numb when 1 - return File.exists?(portal_path + "\\keyB.txt") + return File.exists?(portal_path + "/keyB.txt") when 2 - return File.exists?(portal_path + "\\keyG.txt") + return File.exists?(portal_path + "/keyG.txt") when 3 - return File.exists?(portal_path + "\\keyR.txt") + return File.exists?(portal_path + "/keyR.txt") end return false end - + def self.is_key_in_bigbox(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal" + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal" case numb when 1 - return File.exists?(portal_path + "\\keyB.txt") + return File.exists?(portal_path + "/keyB.txt") when 2 - return File.exists?(portal_path + "\\keyG.txt") + return File.exists?(portal_path + "/keyG.txt") when 3 - return File.exists?(portal_path + "\\keyR.txt") + return File.exists?(portal_path + "/keyR.txt") end return false end