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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b61d150da547df7d50d3920d89812ccbd4f238fd49b17524693ac78870018818
4
- data.tar.gz: 8bdcf3ec6fef656d1b8e883a485f29d9ff56466c53bfbb1d5208adee13fb218d
3
+ metadata.gz: 4be9adddaac27a84654c48292e0fa8949daf9b48a6b97520585e5bc9678c4593
4
+ data.tar.gz: a108f9445ec1e2151c39eeda9f262c2505e763efbbc790b8c7a788bf9ffdd1bf
5
5
  SHA512:
6
- metadata.gz: 6fe8e5c012762b40c85b843f428b966d24fadd5129fce757ce8f164f0779c27affda5959e85914f0d3e98dd920a85c4b50a4384004685558e6d2bd032b3916eb
7
- data.tar.gz: b36cd1b4af5a0ec1e0fccfd520472ecc4596ac6a93bc88d30c51170f690d4269bd8bb0d9d0414b26b16e3301fec7b78943202b826bd2d91f6cff4faafc24d815
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
- OptionParser.new do |cmd|
13
- cmd.banner = "This tool allows to parse RPG Maker project to .txt files and back.\n\nUsage: rvpacker-txt COMMAND [options]\n\nCOMMANDS:\n read - Parses RPG Maker game files to .txt\n write - Writes parsed files back to their initial form\nOPTIONS:\n"
14
-
15
- cmd.on('-i', '--input-dir DIR', String, 'Input directory of RPG Maker project') do |dir|
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 DIR', String, 'Output directory of parsed/written files') do |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, "Don't process specified files (maps, other, system, scripts)") do |files|
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 NUM', Integer, 'Shuffle level when writing (1: lines, 2: lines and words)') do |num|
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', 'Log information while processing') do
55
+ cmd.on('-l', '--log', 'Enables logging.') do
41
56
  options[:logging] = true
42
57
  end
43
58
 
44
- cmd.on('-f', '--force', 'Force rewrite all files. Cannot be used with --append', 'USE WITH CAUTION!') do
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', "When the rvpacker-txt or the game which files you've parsed receives an update,",
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') do
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.4'
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 or writes RPG Maker XP/VX/VXAce game text to .txt files'
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
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-21 00:00:00.000000000 Z
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 or writes RPG Maker XP/VX/VXAce game text to .txt files
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: []