modsvaskr 0.1.8 → 0.1.9
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/lib/modsvaskr/encoding.rb +29 -0
- data/lib/modsvaskr/tests_suites/exterior_cell.rb +3 -3
- data/lib/modsvaskr/tests_suites/interior_cell.rb +2 -2
- data/lib/modsvaskr/tests_suites/npc.rb +1 -1
- data/lib/modsvaskr/tests_suites/npc_head.rb +1 -1
- data/lib/modsvaskr/version.rb +1 -1
- data/lib/modsvaskr/xedit.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec8a78a2351a1b75ce524ec43bc394f32af0ca8f9f8bdcb503227ef61c67a835
|
4
|
+
data.tar.gz: 1368b7d37845214a577ce3c90a74d771921c82dd9b6e2b29ea7290c7087c503a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fcdfcb6474e23a2194c368c8eb77af05b83d8c3ded3f34d9a11ecd7e8decf0bfd33d4d2c07edd2ac0f2ce865004ce8a7b5c0fe4a205a5efb82745d2d8a38d25
|
7
|
+
data.tar.gz: cf8b50f20f69992e5830472809bdb356293f3b5d5e5c3410b4a3b996bab5234932162836f5fecf0d563af24ad9fad8cc92cc9dbb186a1458642053c662e82201
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Modsvaskr
|
2
|
+
|
3
|
+
module Encoding
|
4
|
+
|
5
|
+
# Convert a string to UTF-8
|
6
|
+
#
|
7
|
+
# Parameters::
|
8
|
+
# * *str* (String): The string to convert
|
9
|
+
# Result::
|
10
|
+
# * String: The converted string
|
11
|
+
def self.to_utf8(str)
|
12
|
+
orig_encoding = str.encoding
|
13
|
+
encoding = nil
|
14
|
+
begin
|
15
|
+
encoding = %w[
|
16
|
+
UTF-8
|
17
|
+
Windows-1252
|
18
|
+
ISO-8859-1
|
19
|
+
].find { |search_encoding| str.force_encoding(search_encoding).valid_encoding? }
|
20
|
+
ensure
|
21
|
+
str.force_encoding(orig_encoding)
|
22
|
+
end
|
23
|
+
raise "Unknown encoding for string #{str[0..127].inspect}" if encoding.nil?
|
24
|
+
str.encode('UTF-8', encoding)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -26,7 +26,7 @@ module Modsvaskr
|
|
26
26
|
# Hash< String, Hash< String, Array<[Integer, Integer]> > >
|
27
27
|
exterior_cells = {}
|
28
28
|
@game.xedit.run_script('DumpInfo', only_once: true)
|
29
|
-
|
29
|
+
@game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|
|
30
30
|
esp_name, record_type = row[0..1]
|
31
31
|
if record_type.downcase == 'cell'
|
32
32
|
cell_type, cell_name, cell_x, cell_y = row[3..6]
|
@@ -45,7 +45,7 @@ module Modsvaskr
|
|
45
45
|
# Test only exterior cells that have been changed by mods, and make sure we test the minimum, knowing that each cell loaded in game tests 5x5 cells around
|
46
46
|
vanilla_esps = @game.game_esps
|
47
47
|
vanilla_exterior_cells = vanilla_esps.inject({}) do |merged_worldspaces, esp_name|
|
48
|
-
merged_worldspaces.merge(exterior_cells[esp_name]) do |worldspace, ext_cells1, ext_cells2|
|
48
|
+
merged_worldspaces.merge(exterior_cells[esp_name] || {}) do |worldspace, ext_cells1, ext_cells2|
|
49
49
|
(ext_cells1 + ext_cells2).sort.uniq
|
50
50
|
end
|
51
51
|
end
|
@@ -87,7 +87,7 @@ module Modsvaskr
|
|
87
87
|
slice(*(candidate_cell_x - delta_cells..candidate_cell_x + delta_cells)).
|
88
88
|
inject(0) { |sum_cells, (_cur_cell_x, cur_cell_ys)| sum_cells + cur_cell_ys.slice(*(candidate_cell_y - delta_cells..candidate_cell_y + delta_cells)).size }
|
89
89
|
if best_cell_score.nil? || nbr_tested_cells > best_cell_score
|
90
|
-
|
90
|
+
best_cell_score = nbr_tested_cells
|
91
91
|
best_cell_x = candidate_cell_x
|
92
92
|
best_cell_y = candidate_cell_y
|
93
93
|
end
|
@@ -26,7 +26,7 @@ module Modsvaskr
|
|
26
26
|
# Hash< String, Array<String> >
|
27
27
|
interior_cells = {}
|
28
28
|
@game.xedit.run_script('DumpInfo', only_once: true)
|
29
|
-
|
29
|
+
@game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|
|
30
30
|
esp_name, record_type = row[0..1]
|
31
31
|
if record_type.downcase == 'cell'
|
32
32
|
cell_type, cell_name = row[3..4]
|
@@ -39,7 +39,7 @@ module Modsvaskr
|
|
39
39
|
end
|
40
40
|
# Test only interior cells that have been changed by mods
|
41
41
|
vanilla_esps = @game.game_esps
|
42
|
-
vanilla_interior_cells = vanilla_esps.map { |esp_name| interior_cells[esp_name] }.flatten.sort.uniq
|
42
|
+
vanilla_interior_cells = vanilla_esps.map { |esp_name| interior_cells[esp_name] || [] }.flatten.sort.uniq
|
43
43
|
Hash[interior_cells.
|
44
44
|
map { |esp_name, esp_cells| vanilla_esps.include?(esp_name) ? [] : vanilla_interior_cells & esp_cells }.
|
45
45
|
flatten.
|
@@ -24,7 +24,7 @@ module Modsvaskr
|
|
24
24
|
def discover_tests
|
25
25
|
tests = {}
|
26
26
|
@game.xedit.run_script('DumpInfo', only_once: true)
|
27
|
-
|
27
|
+
@game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|
|
28
28
|
tests["#{row[0].downcase}/#{row[2].to_i(16)}"] = {
|
29
29
|
name: "Take screenshot of #{row[0]} - #{row[3]}"
|
30
30
|
} if row[1].downcase == 'npc_'
|
@@ -24,7 +24,7 @@ module Modsvaskr
|
|
24
24
|
def discover_tests
|
25
25
|
tests = {}
|
26
26
|
@game.xedit.run_script('DumpInfo', only_once: true)
|
27
|
-
|
27
|
+
@game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|
|
28
28
|
tests["#{row[0].downcase}/#{row[2].to_i(16)}"] = {
|
29
29
|
name: "Take head screenshot of #{row[0]} - #{row[3]}"
|
30
30
|
} if row[1].downcase == 'npc_'
|
data/lib/modsvaskr/version.rb
CHANGED
data/lib/modsvaskr/xedit.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'modsvaskr/encoding'
|
1
2
|
require 'modsvaskr/run_cmd'
|
2
3
|
|
3
4
|
module Modsvaskr
|
@@ -47,6 +48,17 @@ module Modsvaskr
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
51
|
+
# Parse a CSV that has been dumped by a previous run of xEdit
|
52
|
+
#
|
53
|
+
# Parameters::
|
54
|
+
# * *csv* (String): Name of the CSV file (from Edit Scripts), without .csv
|
55
|
+
# * *row_block* (Proc): Code called for each CSV row
|
56
|
+
# Parameters::
|
57
|
+
# * *row* (Array<String>): CSV row
|
58
|
+
def parse_csv(csv, &row_block)
|
59
|
+
CSV.parse(Encoding.to_utf8(File.read("#{install_path}/Edit Scripts/#{csv}.csv", mode: 'rb'))).each(&row_block)
|
60
|
+
end
|
61
|
+
|
50
62
|
end
|
51
63
|
|
52
64
|
end
|
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.
|
4
|
+
version: 0.1.9
|
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-
|
11
|
+
date: 2021-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses_menu
|
@@ -104,6 +104,7 @@ extra_rdoc_files: []
|
|
104
104
|
files:
|
105
105
|
- bin/modsvaskr
|
106
106
|
- lib/modsvaskr/config.rb
|
107
|
+
- lib/modsvaskr/encoding.rb
|
107
108
|
- lib/modsvaskr/game.rb
|
108
109
|
- lib/modsvaskr/games/skyrim_se.rb
|
109
110
|
- lib/modsvaskr/in_game_tests_runner.rb
|