rvpacker-txt 1.8.4 → 1.8.5
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/bin/rvpacker-txt +32 -12
- data/lib/read.rb +4 -1
- data/rvpacker-txt.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4be9adddaac27a84654c48292e0fa8949daf9b48a6b97520585e5bc9678c4593
|
|
4
|
+
data.tar.gz: a108f9445ec1e2151c39eeda9f262c2505e763efbbc790b8c7a788bf9ffdd1bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 318bedbdef111ee55225cb8cc71c5cb9f0751c186daa314722f6f09900e69ee2ffaedf11850185d484189c7879630c900d19a586dad6b0c948daa023991c8d45
|
|
7
|
+
data.tar.gz: ffb4a43103686e875a3de87964c53f2d7ae81b1d64f06433164992bc25a7f31a603837a8358a8e33b7b84be9fb3343e4690f5f9c901d1c50cfbe9c3192bdc243
|
data/bin/rvpacker-txt
CHANGED
|
@@ -9,19 +9,28 @@ require 'classes'
|
|
|
9
9
|
def self.parse_options
|
|
10
10
|
options = { disable_processing: {}, input_dir: './', output_dir: './', shuffle_level: 0 }
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
read_command_description = 'Parses files from "original" or "data" folders of input directory to "translation" folder of output directory.'
|
|
13
|
+
write_command_description = 'Writes translated files using original files from "original" or "data" folder of input directory and writes results to "output" folder of output directory.'
|
|
14
|
+
banner_text = "This tool allows to parse RPG Maker games to .txt files and write them back to their initial form.\n\nUsage: rvpacker-txt COMMAND [options]\n\nCOMMANDS:\n read - #{read_command_description}\n write - #{write_command_description}\nOPTIONS:\n"
|
|
15
|
+
|
|
16
|
+
OptionParser.new(banner_text) do |cmd|
|
|
17
|
+
cmd.on('-i', '--input-dir PATH', String,
|
|
18
|
+
'When reading: Input directory, containing folders "original" or "data" with original game files.',
|
|
19
|
+
'When writing: Input directory, containing folders "original" or "data" and "translation" with original game files and .txt files with translation respectively.') do |dir|
|
|
16
20
|
options[:input_dir] = File.exist?(dir) ? File.realpath(dir) : (raise "#{dir} not found")
|
|
17
21
|
options[:output_dir] = options[:input_dir]
|
|
18
22
|
end
|
|
19
23
|
|
|
20
|
-
cmd.on('-o', '--output-dir
|
|
24
|
+
cmd.on('-o', '--output-dir PATH', String,
|
|
25
|
+
'When reading: Output directory, where an "output" folder will be created, containing compiled RPG Maker files with your translation.',
|
|
26
|
+
'When writing: Output directory, where a "translation" folder will be created, containing parsed .txt files with the text from the game.') do |dir|
|
|
21
27
|
options[:output_dir] = File.exist?(dir) ? File.realpath(dir) : (raise "#{dir} not found")
|
|
22
28
|
end
|
|
23
29
|
|
|
24
|
-
cmd.on('--disable-processing FILES', Array,
|
|
30
|
+
cmd.on('--disable-processing FILES', Array,
|
|
31
|
+
'Skips processing the specified files.',
|
|
32
|
+
'Example: --disable-processing=maps,other,system.',
|
|
33
|
+
'[Allowed values: maps, other, system, scripts]') do |files|
|
|
25
34
|
files.each do |file|
|
|
26
35
|
files = %w[maps other system scripts]
|
|
27
36
|
index = files.find_index(file)
|
|
@@ -29,25 +38,36 @@ def self.parse_options
|
|
|
29
38
|
end
|
|
30
39
|
end
|
|
31
40
|
|
|
32
|
-
cmd.on('-s', '--shuffle
|
|
41
|
+
cmd.on('-s', '--shuffle-level NUMBER', Integer,
|
|
42
|
+
'With value 1, shuffles all translation lines. With value 2, shuffles all words and lines in translation text.',
|
|
43
|
+
'Example: --shuffle-level 1.',
|
|
44
|
+
'[Allowed values: 0, 1, 2]',
|
|
45
|
+
'[Default value: 0]',
|
|
46
|
+
'[Write flag]') do |num|
|
|
47
|
+
raise 'Allowed values: 0, 1, 2' if num > 2
|
|
33
48
|
options[:shuffle_level] = num
|
|
34
49
|
end
|
|
35
50
|
|
|
36
|
-
cmd.on('--disable-custom-processing', 'Disables built-in custom parsing/writing for some games') do
|
|
51
|
+
cmd.on('--disable-custom-processing', 'Disables built-in custom parsing/writing for some games.') do
|
|
37
52
|
options[:disable_custom_processing] = true
|
|
38
53
|
end
|
|
39
54
|
|
|
40
|
-
cmd.on('-l', '--log', '
|
|
55
|
+
cmd.on('-l', '--log', 'Enables logging.') do
|
|
41
56
|
options[:logging] = true
|
|
42
57
|
end
|
|
43
58
|
|
|
44
|
-
cmd.on('-f', '--force',
|
|
59
|
+
cmd.on('-f', '--force',
|
|
60
|
+
'Force rewrite all files. Cannot be used with --append.',
|
|
61
|
+
'USE WITH CAUTION!',
|
|
62
|
+
'[Read flag]') do
|
|
45
63
|
options[:force] = true
|
|
46
64
|
end
|
|
47
65
|
|
|
48
|
-
cmd.on('-a', '--append',
|
|
66
|
+
cmd.on('-a', '--append',
|
|
67
|
+
"When the rvpacker-txt or the game which files you've parsed receives an update,",
|
|
49
68
|
'you probably should re-read game files with --append, which will append any new text to your files without overwriting the progress',
|
|
50
|
-
'Cannot be used with --force'
|
|
69
|
+
'Cannot be used with --force',
|
|
70
|
+
'[Read flag]') do
|
|
51
71
|
raise '--append cannot be used with --force.' if options[:force]
|
|
52
72
|
options[:append] = true
|
|
53
73
|
end
|
data/lib/read.rb
CHANGED
|
@@ -70,6 +70,8 @@ end
|
|
|
70
70
|
# @param [String] game_type
|
|
71
71
|
# @return [String]
|
|
72
72
|
def self.parse_parameter(code, parameter, game_type)
|
|
73
|
+
return nil if parameter.match?(/^[.()+-:;\[\]^~%&!*\/→×??x%▼| ]+$/)
|
|
74
|
+
|
|
73
75
|
unless game_type.nil?
|
|
74
76
|
case code
|
|
75
77
|
when 401, 405
|
|
@@ -97,6 +99,7 @@ end
|
|
|
97
99
|
# @param [String] _game_type
|
|
98
100
|
# @return [String]
|
|
99
101
|
def self.parse_variable(variable, _game_type)
|
|
102
|
+
return nil if parameter.match?(/^[.()+-:;\[\]^~%&!*\/→×??x%▼| ]+$/)
|
|
100
103
|
variable = variable.gsub(/\r?\n/, '\#') if variable.count("\n").positive?
|
|
101
104
|
|
|
102
105
|
return nil if variable.split('\#').all? { |line| line.strip.match?(/(^#? ?<.*>\.?$)|^$/) }
|
|
@@ -618,7 +621,7 @@ def self.read_scripts(scripts_file_path, output_path, logging, processing_type)
|
|
|
618
621
|
string.match?(/^(?=.*\d)[A-Za-z0-9\-]+$/) ||
|
|
619
622
|
string.match?(/^[a-z\-()\/ +'&]*$/) ||
|
|
620
623
|
string.match?(/^[A-Za-z]+[+-]$/) ||
|
|
621
|
-
string.match?(/^[.()+-:;\[\]^~%&!*\/→×??x%▼|]
|
|
624
|
+
string.match?(/^[.()+-:;\[\]^~%&!*\/→×??x%▼| ]+$/) ||
|
|
622
625
|
string.match?(/^Tile.*[A-Z]$/) ||
|
|
623
626
|
string.match?(/^[a-zA-Z][a-z]+([A-Z][a-z]*)+$/) ||
|
|
624
627
|
string.match?(/^Cancel Action$|^Invert$|^End$|^Individual$|^Missed File$|^Bitmap$|^Audio$/) ||
|
data/rvpacker-txt.gemspec
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'rvpacker-txt'
|
|
5
|
-
spec.version = '1.8.
|
|
5
|
+
spec.version = '1.8.5'
|
|
6
6
|
spec.authors = ['Howard Jeng', 'Andrew Kesterson', 'Solistra', 'Darkness9724', 'savannstm']
|
|
7
7
|
spec.email = ['savannstm@gmail.com']
|
|
8
|
-
spec.summary = 'Reads
|
|
8
|
+
spec.summary = 'Reads RPG Maker XP/VX/VXAce game text to .txt files and writes them to their initial form.'
|
|
9
9
|
spec.homepage = 'https://github.com/savannstm/rvpacker-txt'
|
|
10
10
|
spec.license = 'MIT'
|
|
11
11
|
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rvpacker-txt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.8.
|
|
4
|
+
version: 1.8.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Howard Jeng
|
|
@@ -12,7 +12,7 @@ authors:
|
|
|
12
12
|
autorequire:
|
|
13
13
|
bindir: bin
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date: 2024-07-
|
|
15
|
+
date: 2024-07-23 00:00:00.000000000 Z
|
|
16
16
|
dependencies: []
|
|
17
17
|
description:
|
|
18
18
|
email:
|
|
@@ -53,5 +53,6 @@ requirements: []
|
|
|
53
53
|
rubygems_version: 3.5.14
|
|
54
54
|
signing_key:
|
|
55
55
|
specification_version: 4
|
|
56
|
-
summary: Reads
|
|
56
|
+
summary: Reads RPG Maker XP/VX/VXAce game text to .txt files and writes them to their
|
|
57
|
+
initial form.
|
|
57
58
|
test_files: []
|