modsvaskr 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/modsvaskr/game.rb +23 -0
- data/lib/modsvaskr/ui.rb +28 -1
- data/lib/modsvaskr/version.rb +1 -1
- data/lib/modsvaskr/xedit.rb +20 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05b83c21e7648319219295b25181279f2894007f5659f3696940131ebe796c20
|
4
|
+
data.tar.gz: f819b5e39f3a8e03bd92ad9cebe86974fda83f933039a18a9f26b6fb60477b84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dad72598bceb4171c1c3162f9c4ebb7844dba123f7a5ecf774904023f9325568fd83a5948624dd2648eeb97ea54b5620e2f4697be36211810dcc47ca48470d9
|
7
|
+
data.tar.gz: cf2122bd6486967918e5956d68aec907ad76baf74d629b3f2b7620437898c083ad4eb0225681cfeeb8857090e56f51d7a6a34ff988b6cbb13dda925a9e6de570
|
data/lib/modsvaskr/game.rb
CHANGED
@@ -203,6 +203,29 @@ module Modsvaskr
|
|
203
203
|
[load_order[form_id / 16_777_216], form_id % 16_777_216]
|
204
204
|
end
|
205
205
|
|
206
|
+
# Clean a list plugins.
|
207
|
+
# Make sure they are cleaned in the right order, according to the load order.
|
208
|
+
# Put the cleaned plugins in a cleaned_plugins subfolder.
|
209
|
+
# Make sure that subsequent plugins to be cleaned are cleaned with the previously cleaned plugins in the list.
|
210
|
+
#
|
211
|
+
# Parameters::
|
212
|
+
# * *plugins* (Array<String>): List of plugins to be cleaned
|
213
|
+
def clean_plugins(plugins)
|
214
|
+
return if plugins.empty?
|
215
|
+
|
216
|
+
esp = (load_order & plugins).first
|
217
|
+
log "Clean #{esp}"
|
218
|
+
FileUtils.cp "#{path}/Data/#{esp}", "#{path}/Data/#{esp}.backup"
|
219
|
+
begin
|
220
|
+
xedit.quick_auto_clean(esp)
|
221
|
+
clean_plugins(plugins - [esp])
|
222
|
+
FileUtils.mkdir_p "#{path}/Data/cleaned_plugins"
|
223
|
+
FileUtils.mv "#{path}/Data/#{esp}", "#{path}/Data/cleaned_plugins/#{esp}"
|
224
|
+
ensure
|
225
|
+
FileUtils.mv "#{path}/Data/#{esp}.backup", "#{path}/Data/#{esp}"
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
206
229
|
end
|
207
230
|
|
208
231
|
end
|
data/lib/modsvaskr/ui.rb
CHANGED
@@ -44,7 +44,13 @@ module Modsvaskr
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
CursesMenu.new(
|
47
|
-
"Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods#{
|
47
|
+
"Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods#{
|
48
|
+
if !last_modsvaskr_version.nil? && last_modsvaskr_version != Modsvaskr::VERSION
|
49
|
+
" - !!! New version available: #{last_modsvaskr_version}"
|
50
|
+
else
|
51
|
+
''
|
52
|
+
end
|
53
|
+
}",
|
48
54
|
key_presses:
|
49
55
|
) do |main_menu|
|
50
56
|
@config.games.each do |game|
|
@@ -53,6 +59,27 @@ module Modsvaskr
|
|
53
59
|
"Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods > #{game.name}",
|
54
60
|
key_presses:
|
55
61
|
) do |game_menu|
|
62
|
+
game_menu.item 'Plugins' do
|
63
|
+
selected_esps = {}
|
64
|
+
CursesMenu.new(
|
65
|
+
"Modsvaskr v#{Modsvaskr::VERSION} - Stronghold of Mods > #{game.name} > Plugins",
|
66
|
+
key_presses:
|
67
|
+
) do |plugins_menu|
|
68
|
+
game.load_order.each.with_index do |esp, idx|
|
69
|
+
plugins_menu.item "[#{selected_esps.key?(esp) ? '*' : ' '}] #{idx} - #{esp}" do
|
70
|
+
if selected_esps.key?(esp)
|
71
|
+
selected_esps.delete(esp)
|
72
|
+
else
|
73
|
+
selected_esps[esp] = nil
|
74
|
+
end
|
75
|
+
:menu_refresh
|
76
|
+
end
|
77
|
+
end
|
78
|
+
plugins_menu.item "Clean #{selected_esps.size} selected plugins" do
|
79
|
+
game.clean_plugins(selected_esps.keys)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
56
83
|
game_menu.item 'Testing' do
|
57
84
|
# Read tests info
|
58
85
|
tests_runner = TestsRunner.new(@config, game)
|
data/lib/modsvaskr/version.rb
CHANGED
data/lib/modsvaskr/xedit.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'csv'
|
2
2
|
require 'modsvaskr/encoding'
|
3
|
+
require 'modsvaskr/logger'
|
3
4
|
require 'modsvaskr/run_cmd'
|
4
5
|
|
5
6
|
module Modsvaskr
|
@@ -7,6 +8,7 @@ module Modsvaskr
|
|
7
8
|
# Helper to use an instance of xEdit
|
8
9
|
class Xedit
|
9
10
|
|
11
|
+
include Logger
|
10
12
|
include RunCmd
|
11
13
|
|
12
14
|
# String: Installation path
|
@@ -49,6 +51,24 @@ module Modsvaskr
|
|
49
51
|
@runs[script] = nil
|
50
52
|
end
|
51
53
|
|
54
|
+
# Run a QuickAutoClean of a given plugin
|
55
|
+
#
|
56
|
+
# Parameters::
|
57
|
+
# * *esp* (String): Plugin to autoclean
|
58
|
+
def quick_auto_clean(esp)
|
59
|
+
# TODO: Find a way to select the right esp automatically
|
60
|
+
out "Please double-click on the following plugin: #{esp}"
|
61
|
+
run_cmd(
|
62
|
+
{
|
63
|
+
dir: @install_path,
|
64
|
+
exe: 'SSEEdit.exe'
|
65
|
+
},
|
66
|
+
args: %w[
|
67
|
+
-quickautoclean
|
68
|
+
]
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
52
72
|
# Parse a CSV that has been dumped by a previous run of xEdit
|
53
73
|
#
|
54
74
|
# Parameters::
|