modsvaskr 0.1.11 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/modsvaskr +11 -11
- data/lib/modsvaskr/config.rb +78 -79
- data/lib/modsvaskr/encoding.rb +3 -1
- data/lib/modsvaskr/game.rb +208 -203
- data/lib/modsvaskr/games/skyrim_se.rb +110 -106
- data/lib/modsvaskr/in_game_tests_runner.rb +348 -348
- data/lib/modsvaskr/logger.rb +45 -44
- data/lib/modsvaskr/run_cmd.rb +23 -22
- data/lib/modsvaskr/tests_runner.rb +204 -205
- data/lib/modsvaskr/tests_suite.rb +70 -69
- data/lib/modsvaskr/tests_suites/exterior_cell.rb +120 -117
- data/lib/modsvaskr/tests_suites/interior_cell.rb +63 -63
- data/lib/modsvaskr/tests_suites/npc.rb +67 -64
- data/lib/modsvaskr/tests_suites/npc_head.rb +2 -1
- data/lib/modsvaskr/ui.rb +205 -204
- data/lib/modsvaskr/version.rb +5 -5
- data/lib/modsvaskr/xedit.rb +65 -65
- metadata +42 -13
@@ -1,106 +1,110 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
require 'tmpdir'
|
3
|
-
require 'nokogiri'
|
4
|
-
|
5
|
-
module Modsvaskr
|
6
|
-
|
7
|
-
module Games
|
8
|
-
|
9
|
-
# Handle a Skyrim installation
|
10
|
-
class SkyrimSe < Game
|
11
|
-
|
12
|
-
# Initialize the game
|
13
|
-
# [API] - This method is optional
|
14
|
-
def init
|
15
|
-
@tmp_dir = "#{Dir.tmpdir}/modsvaskr"
|
16
|
-
end
|
17
|
-
|
18
|
-
# Complete the game menu
|
19
|
-
# [API] - This method is optional
|
20
|
-
#
|
21
|
-
# Parameters::
|
22
|
-
# * *menu* (CursesMenu): Menu to complete
|
23
|
-
def complete_game_menu(menu)
|
24
|
-
menu.item 'Install SKSE64' do
|
25
|
-
install_skse64
|
26
|
-
out 'Press Enter to continue...'
|
27
|
-
wait_for_user_enter
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Get the game running executable name (that can be found in a tasks manager)
|
32
|
-
# [API] - This method is mandatory
|
33
|
-
#
|
34
|
-
# Result::
|
35
|
-
# * String: The running exe name
|
36
|
-
def running_exe
|
37
|
-
'SkyrimSE.exe'
|
38
|
-
end
|
39
|
-
|
40
|
-
# Ordered list of default esps present in the game (the ones in the Data folder when 0 mod is being used).
|
41
|
-
# The list is ordered according to the game's load order.
|
42
|
-
# [API] - This method is mandatory
|
43
|
-
#
|
44
|
-
# Result::
|
45
|
-
# * Array<String>: List of esp/esm/esl base file names.
|
46
|
-
def game_esps
|
47
|
-
%w[
|
48
|
-
skyrim.esm
|
49
|
-
update.esm
|
50
|
-
dawnguard.esm
|
51
|
-
hearthfires.esm
|
52
|
-
dragonborn.esm
|
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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
1
|
+
require 'open-uri'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
module Modsvaskr
|
6
|
+
|
7
|
+
module Games
|
8
|
+
|
9
|
+
# Handle a Skyrim installation
|
10
|
+
class SkyrimSe < Game
|
11
|
+
|
12
|
+
# Initialize the game
|
13
|
+
# [API] - This method is optional
|
14
|
+
def init
|
15
|
+
@tmp_dir = "#{Dir.tmpdir}/modsvaskr"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Complete the game menu
|
19
|
+
# [API] - This method is optional
|
20
|
+
#
|
21
|
+
# Parameters::
|
22
|
+
# * *menu* (CursesMenu): Menu to complete
|
23
|
+
def complete_game_menu(menu)
|
24
|
+
menu.item 'Install SKSE64' do
|
25
|
+
install_skse64
|
26
|
+
out 'Press Enter to continue...'
|
27
|
+
wait_for_user_enter
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get the game running executable name (that can be found in a tasks manager)
|
32
|
+
# [API] - This method is mandatory
|
33
|
+
#
|
34
|
+
# Result::
|
35
|
+
# * String: The running exe name
|
36
|
+
def running_exe
|
37
|
+
'SkyrimSE.exe'
|
38
|
+
end
|
39
|
+
|
40
|
+
# Ordered list of default esps present in the game (the ones in the Data folder when 0 mod is being used).
|
41
|
+
# The list is ordered according to the game's load order.
|
42
|
+
# [API] - This method is mandatory
|
43
|
+
#
|
44
|
+
# Result::
|
45
|
+
# * Array<String>: List of esp/esm/esl base file names.
|
46
|
+
def game_esps
|
47
|
+
%w[
|
48
|
+
skyrim.esm
|
49
|
+
update.esm
|
50
|
+
dawnguard.esm
|
51
|
+
hearthfires.esm
|
52
|
+
dragonborn.esm
|
53
|
+
ccbgssse001-fish.esm
|
54
|
+
ccqdrsse001-survivalmode.esl
|
55
|
+
ccbgssse037-curios.esl
|
56
|
+
ccbgssse025-advdsgs.esm
|
57
|
+
]
|
58
|
+
end
|
59
|
+
|
60
|
+
# Read the load order.
|
61
|
+
# [API] - This method is mandatory
|
62
|
+
#
|
63
|
+
# Result::
|
64
|
+
# * Array<String>: List of all active plugins, including masters
|
65
|
+
def read_load_order
|
66
|
+
game_esps +
|
67
|
+
File.read("#{ENV.fetch('USERPROFILE')}/AppData/Local/Skyrim Special Edition/plugins.txt").split("\n").map do |line|
|
68
|
+
line =~ /^\*(.+)$/ ? Regexp.last_match(1).downcase : nil
|
69
|
+
end.compact
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
# Install SKSE64 corresponding to our game
|
75
|
+
def install_skse64
|
76
|
+
doc = Nokogiri::HTML(URI.open('https://skse.silverlock.org/'))
|
77
|
+
p_element = doc.css('p').find { |el| el.text.strip =~ /^Current SE build .+: 7z archive$/ }
|
78
|
+
if p_element.nil?
|
79
|
+
log '!!! Can\'t get SKSE64 from https://skse.silverlock.org/. It looks like the page structure has changed. Please update the code or install it manually.'
|
80
|
+
else
|
81
|
+
url = "https://skse.silverlock.org/#{p_element.at('a')['href']}"
|
82
|
+
path = "#{@tmp_dir}/skse64.7z"
|
83
|
+
FileUtils.mkdir_p File.dirname(path)
|
84
|
+
log "Download from #{url} => #{path}..."
|
85
|
+
URI.parse(url).open('rb') do |web_io|
|
86
|
+
File.write(path, web_io.read, mode: 'wb')
|
87
|
+
end
|
88
|
+
skse64_tmp_dir = "#{@tmp_dir}/skse64"
|
89
|
+
log "Unzip into #{skse64_tmp_dir}..."
|
90
|
+
FileUtils.rm_rf skse64_tmp_dir
|
91
|
+
FileUtils.mkdir_p skse64_tmp_dir
|
92
|
+
run_cmd(
|
93
|
+
{
|
94
|
+
dir: @config.seven_zip_path,
|
95
|
+
exe: '7z.exe'
|
96
|
+
},
|
97
|
+
args: ['x', "\"#{path}\"", "-o\"#{skse64_tmp_dir}\"", '-r']
|
98
|
+
)
|
99
|
+
skse64_subdir = Dir.glob("#{skse64_tmp_dir}/*").first
|
100
|
+
log "Move files from #{skse64_subdir} to #{self.path}..."
|
101
|
+
FileUtils.cp_r "#{skse64_subdir}/.", self.path, remove_destination: true
|
102
|
+
log 'SKSE64 installed successfully.'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|