23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/sc2ai/cli/cli.rb', line 23
def setup410
say " "
say "This script sets up SC2 at version 4.10, which we use competitively."
say "Press any key to continue..."
ask ""
say "You must accept the Blizzard® StarCraft® II AI and Machine Learning License at"
say "https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html"
say "It is PERMISSIVE and grants you freedoms over the standard EULA."
say "We do not record this action, but depend on software goverend by that license to continue."
puts 'If you accept, type "iagreetotheeula" (without quotes) and press ENTER to continue:'
while $stdin.gets.chomp != "iagreetotheeula"
say ""
puts 'Type "iagreetotheeula" (without quotes) and press ENTER to continue:'
end
say ""
say ""
say "Great decision."
require "sc2ai"
Async do
Sc2.logger.level = :fatal
say "SC2 will launch a blank window, be unresponsive, but download about 100mb in the background."
say "Let it finish and close itself."
say "Press ENTER if you understand."
ask ""
say ""
say ""
say "This will only take a minute..."
Sc2.config.version = nil
client = Sc2::ClientManager.obtain(0)
if Gem.win_platform?
sleep(10)
end
observer = Sc2::Player::Observer.new
observer.connect(host: client.host, port: client.port)
setup_replay = Sc2::Paths.gem_root.join("data", "setup", "setup.SC2Replay")
observer.api.replay_info(
replay_data: File.binread(setup_replay),
download_data: true
)
base_build = "75689"
path = Sc2::Paths.executable(base_build: base_build)
if path.include?(base_build) && Pathname(path).exist?
say " "
say "Success. Download complete.", :green
say " "
else
say "Error. Slightly worrying, but no fear.", :red
say "To manually setup, grab the latest ladder maps and add them to your map folder."
say "Grab the latest maps from https://aiarena.net/wiki/maps/"
say "Detected map folder: #{Sc2::Paths.maps_dir}"
say "Then, download any recent replay from https://aiarena.net/ and double click to launch"
end
observer.api.quit
observer.disconnect
say "Generating sc2ai.yml to always use 4.10..."
Sc2.config.config_file.write({"version" => "4.10"}.to_yaml.to_s)
say ""
say "Done. You're good to go.", :green
ensure
Sc2::ClientManager.stop(0)
end
end
|