modsvaskr 0.2.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6caea974a5397c715e9db769996a3f54743087b12fbdacb99afd362ade4f8ede
4
- data.tar.gz: 8af266d6861b5a3b8c44b0ddbb9d73771b6afe731edd0637d27f4426d7552119
3
+ metadata.gz: 05b83c21e7648319219295b25181279f2894007f5659f3696940131ebe796c20
4
+ data.tar.gz: f819b5e39f3a8e03bd92ad9cebe86974fda83f933039a18a9f26b6fb60477b84
5
5
  SHA512:
6
- metadata.gz: 55f3a256e428d8ac50dce938915f0eb4910f6b9281a56ef69eb140556a7d41058d431cc28520bfe982e859be4e083afedbe39f9d7897caf6ad7f952672b61ced
7
- data.tar.gz: e444a4bc0e219245a3b29ce9d01183f64792fbed1d6e4fe7e8a09cffa124577a19af100309e85b237315bd6d3c5b46544507989e9f08e8ac542f7b04386eb6ec
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
@@ -74,11 +74,11 @@ module Modsvaskr
74
74
  # Install SKSE64 corresponding to our game
75
75
  def install_skse64
76
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$/ }
77
+ p_element = doc.css('p').find { |el| el.text.strip =~ /^Current Anniversary Edition build .+ Download 7z File$/m }
78
78
  if p_element.nil?
79
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
80
  else
81
- url = "https://skse.silverlock.org/#{p_element.at('a')['href']}"
81
+ url = p_element.at('a')['href']
82
82
  path = "#{@tmp_dir}/skse64.7z"
83
83
  FileUtils.mkdir_p File.dirname(path)
84
84
  log "Download from #{url} => #{path}..."
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.0'
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modsvaskr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-30 00:00:00.000000000 Z
11
+ date: 2022-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses_menu