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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29dad9a5413e803a1980b6d0d9aa4f71e66c8c233c0398b30eacb03c3a35d563
4
- data.tar.gz: 0b9fb7f2efd87394746327fd79783717cb0871eb83f5447a395b411e8c8adfd9
3
+ metadata.gz: 05b83c21e7648319219295b25181279f2894007f5659f3696940131ebe796c20
4
+ data.tar.gz: f819b5e39f3a8e03bd92ad9cebe86974fda83f933039a18a9f26b6fb60477b84
5
5
  SHA512:
6
- metadata.gz: 55cc0a939035ec8dbebb92f4d2e96f168faeb81b486370122951c795933088214ec90585fb6fe2a62d2cb6be55a86a1ab4d7062c43a5a7056abe4292ecbb82d5
7
- data.tar.gz: aeb1f38ccfa4cf5f1e0362b350ad8f219e6ac92b2a3c5bf1027e4a03a3f45242d5a00fc02fc3425d420e8e72669e3c3135f415ad4b926692ef45581bb494af24
6
+ metadata.gz: 9dad72598bceb4171c1c3162f9c4ebb7844dba123f7a5ecf774904023f9325568fd83a5948624dd2648eeb97ea54b5620e2f4697be36211810dcc47ca48470d9
7
+ data.tar.gz: cf2122bd6486967918e5956d68aec907ad76baf74d629b3f2b7620437898c083ad4eb0225681cfeeb8857090e56f51d7a6a34ff988b6cbb13dda925a9e6de570
@@ -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#{!last_modsvaskr_version.nil? && last_modsvaskr_version != Modsvaskr::VERSION ? " - !!! New version available: #{last_modsvaskr_version}" : ''}",
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)
@@ -1,5 +1,5 @@
1
1
  module Modsvaskr
2
2
 
3
- VERSION = '0.2.1'
3
+ VERSION = '1.0.0'
4
4
 
5
5
  end
@@ -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::
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modsvaskr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan