modsvaskr 0.1.9 → 0.1.10

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: ec8a78a2351a1b75ce524ec43bc394f32af0ca8f9f8bdcb503227ef61c67a835
4
- data.tar.gz: 1368b7d37845214a577ce3c90a74d771921c82dd9b6e2b29ea7290c7087c503a
3
+ metadata.gz: 8d247b6d5b73f10426d5769b031213c408bc6ac8c390baea5e9f6a1b0af7495d
4
+ data.tar.gz: 97d98a1e6d93088e7a63f9a07ac31b01c3ed8e0aba4e4159a842fff9af8efaae
5
5
  SHA512:
6
- metadata.gz: 7fcdfcb6474e23a2194c368c8eb77af05b83d8c3ded3f34d9a11ecd7e8decf0bfd33d4d2c07edd2ac0f2ce865004ce8a7b5c0fe4a205a5efb82745d2d8a38d25
7
- data.tar.gz: cf8b50f20f69992e5830472809bdb356293f3b5d5e5c3410b4a3b996bab5234932162836f5fecf0d563af24ad9fad8cc92cc9dbb186a1458642053c662e82201
6
+ metadata.gz: d17a2422af5a5428266c5586887ab5210e0ad7026c8c07fced929b2731aafb07c97bad7c4c8be5886cac8d19ae7e51e1f3f386da6d00d64536e0032bde004e76
7
+ data.tar.gz: 775b864997420ad4e78af51e4511d0ad579a236781cbc30c1f1c577992ae3f486d3ab40f701acf4937d51b2bf4397d02fb54c409d37965a03596e0acc57ad799
@@ -174,6 +174,30 @@ module Modsvaskr
174
174
  end
175
175
  end
176
176
 
177
+ # Get the load order.
178
+ # Keep a cache of it.
179
+ #
180
+ # Result::
181
+ # * Array<String>: List of all active plugins, including masters
182
+ def get_load_order
183
+ @cache_load_order = load_order unless defined?(@cache_load_order)
184
+ @cache_load_order
185
+ end
186
+
187
+ # Get the mod and base id corresponding to a given form id.
188
+ # Uses load order to determine it.
189
+ #
190
+ # Parameters::
191
+ # * *form_id* (String or Integer): Form ID, either as hexadecimal string, or numercial value
192
+ # Result::
193
+ # * String: Plugin name
194
+ # * Integer: Base form id, independent from the load order
195
+ def decode_form_id(form_id)
196
+ form_id = form_id.to_i(16) if form_id.is_a?(String)
197
+ [get_load_order[form_id / 16_777_216], form_id % 16_777_216]
198
+ end
199
+
200
+
177
201
  end
178
202
 
179
203
  end
@@ -37,7 +37,9 @@ module Modsvaskr
37
37
  'SkyrimSE.exe'
38
38
  end
39
39
 
40
- # List of default esps present in the game (the ones in the Data folder when 0 mod is being used)
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
41
43
  #
42
44
  # Result::
43
45
  # * Array<String>: List of esp/esm/esl base file names.
@@ -51,6 +53,18 @@ module Modsvaskr
51
53
  ]
52
54
  end
53
55
 
56
+ # Get the load order.
57
+ # [API] - This method is mandatory
58
+ #
59
+ # Result::
60
+ # * Array<String>: List of all active plugins, including masters
61
+ def load_order
62
+ game_esps +
63
+ File.read("#{ENV['USERPROFILE']}/AppData/Local/Skyrim Special Edition/plugins.txt").split("\n").map do |line|
64
+ line =~ /^\*(.+)$/ ? $1.downcase : nil
65
+ end.compact
66
+ end
67
+
54
68
  private
55
69
 
56
70
  # Install SKSE64 corresponding to our game
@@ -25,9 +25,19 @@ module Modsvaskr
25
25
  tests = {}
26
26
  @game.xedit.run_script('DumpInfo', only_once: true)
27
27
  @game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|
28
- tests["#{row[0].downcase}/#{row[2].to_i(16)}"] = {
29
- name: "Take screenshot of #{row[0]} - #{row[3]}"
30
- } if row[1].downcase == 'npc_'
28
+ if row[1].downcase == 'npc_'
29
+ # Know from which mod this ID comes from
30
+ plugin, base_form_id = @game.decode_form_id(row[2])
31
+ test_name = "#{plugin}/#{base_form_id}"
32
+ if tests.key?(test_name)
33
+ # Add the name of the mod to the description, so that we know which mod modifies which NPC.
34
+ tests[test_name][:name] << "/#{row[0].downcase}"
35
+ else
36
+ tests[test_name] = {
37
+ name: "Take screenshot of #{row[3]} - #{row[0].downcase}"
38
+ }
39
+ end
40
+ end
31
41
  end
32
42
  tests
33
43
  end
@@ -25,9 +25,19 @@ module Modsvaskr
25
25
  tests = {}
26
26
  @game.xedit.run_script('DumpInfo', only_once: true)
27
27
  @game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|
28
- tests["#{row[0].downcase}/#{row[2].to_i(16)}"] = {
29
- name: "Take head screenshot of #{row[0]} - #{row[3]}"
30
- } if row[1].downcase == 'npc_'
28
+ if row[1].downcase == 'npc_'
29
+ # Know from which mod this ID comes from
30
+ plugin, base_form_id = @game.decode_form_id(row[2])
31
+ test_name = "#{plugin}/#{base_form_id}"
32
+ if tests.key?(test_name)
33
+ # Add the name of the mod to the description, so that we know which mod modifies which NPC.
34
+ tests[test_name][:name] << "/#{row[0].downcase}"
35
+ else
36
+ tests[test_name] = {
37
+ name: "Take head screenshot of #{row[3]} - #{row[0].downcase}"
38
+ }
39
+ end
40
+ end
31
41
  end
32
42
  tests
33
43
  end
data/lib/modsvaskr/ui.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'csv'
2
1
  require 'curses_menu'
3
2
  require 'modsvaskr/logger'
4
3
  require 'modsvaskr/tests_runner'
@@ -1,5 +1,5 @@
1
1
  module Modsvaskr
2
2
 
3
- VERSION = '0.1.9'
3
+ VERSION = '0.1.10'
4
4
 
5
5
  end
@@ -1,3 +1,4 @@
1
+ require 'csv'
1
2
  require 'modsvaskr/encoding'
2
3
  require 'modsvaskr/run_cmd'
3
4
 
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.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-21 00:00:00.000000000 Z
11
+ date: 2021-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses_menu