rvpacker-txt 1.8.3 → 1.8.4
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 +11 -9
- data/lib/read.rb +12 -17
- data/lib/write.rb +5 -12
- data/rvpacker-txt.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b61d150da547df7d50d3920d89812ccbd4f238fd49b17524693ac78870018818
|
|
4
|
+
data.tar.gz: 8bdcf3ec6fef656d1b8e883a485f29d9ff56466c53bfbb1d5208adee13fb218d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fe8e5c012762b40c85b843f428b966d24fadd5129fce757ce8f164f0779c27affda5959e85914f0d3e98dd920a85c4b50a4384004685558e6d2bd032b3916eb
|
|
7
|
+
data.tar.gz: b36cd1b4af5a0ec1e0fccfd520472ecc4596ac6a93bc88d30c51170f690d4269bd8bb0d9d0414b26b16e3301fec7b78943202b826bd2d91f6cff4faafc24d815
|
data/bin/rvpacker-txt
CHANGED
|
@@ -24,12 +24,12 @@ def self.parse_options
|
|
|
24
24
|
cmd.on('--disable-processing FILES', Array, "Don't process specified files (maps, other, system, scripts)") do |files|
|
|
25
25
|
files.each do |file|
|
|
26
26
|
files = %w[maps other system scripts]
|
|
27
|
-
index = files.
|
|
27
|
+
index = files.find_index(file)
|
|
28
28
|
options[:disable_processing][files[index]] = true if index
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
cmd.on('-s', '--shuffle NUM', Integer, 'Shuffle level (1: lines, 2: lines and words)') do |num|
|
|
32
|
+
cmd.on('-s', '--shuffle NUM', Integer, 'Shuffle level when writing (1: lines, 2: lines and words)') do |num|
|
|
33
33
|
options[:shuffle_level] = num
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -45,9 +45,10 @@ def self.parse_options
|
|
|
45
45
|
options[:force] = true
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
cmd.on('-a', '--append',
|
|
49
|
-
'
|
|
50
|
-
|
|
48
|
+
cmd.on('-a', '--append', "When the rvpacker-txt or the game which files you've parsed receives an update,",
|
|
49
|
+
'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
|
|
51
|
+
raise '--append cannot be used with --force.' if options[:force]
|
|
51
52
|
options[:append] = true
|
|
52
53
|
end
|
|
53
54
|
|
|
@@ -95,9 +96,8 @@ other_path = File.join(input_dir, 'translation', 'other')
|
|
|
95
96
|
FileUtils.mkdir_p(maps_path)
|
|
96
97
|
FileUtils.mkdir_p(other_path)
|
|
97
98
|
|
|
98
|
-
engine = extensions.each
|
|
99
|
-
|
|
100
|
-
end || (raise "Couldn't determine project engine.")
|
|
99
|
+
engine = extensions.each { |sym, ext| break sym if File.exist?(File.join(original_directory, "System.#{ext}")) } ||
|
|
100
|
+
(raise "Couldn't determine project engine.")
|
|
101
101
|
|
|
102
102
|
files = Dir.glob("#{original_directory}/*#{extensions[engine]}")
|
|
103
103
|
|
|
@@ -129,7 +129,9 @@ wait_time = 0
|
|
|
129
129
|
processing_type = if force
|
|
130
130
|
wait_time_start = Time.now
|
|
131
131
|
|
|
132
|
-
puts "WARNING! You're about to forcefully rewrite all your translation files, including _trans files
|
|
132
|
+
puts "WARNING! You're about to forcefully rewrite all your translation files, including _trans files.",
|
|
133
|
+
"If you really want to do it, make sure you've made a backup of your _trans files, if you made some changes in them already.",
|
|
134
|
+
"Input 'Y' to continue."
|
|
133
135
|
exit unless gets.chomp == 'Y'
|
|
134
136
|
|
|
135
137
|
wait_time = Time.now - wait_time_start
|
data/lib/read.rb
CHANGED
|
@@ -98,6 +98,7 @@ end
|
|
|
98
98
|
# @return [String]
|
|
99
99
|
def self.parse_variable(variable, _game_type)
|
|
100
100
|
variable = variable.gsub(/\r?\n/, '\#') if variable.count("\n").positive?
|
|
101
|
+
|
|
101
102
|
return nil if variable.split('\#').all? { |line| line.strip.match?(/(^#? ?<.*>\.?$)|^$/) }
|
|
102
103
|
return nil if variable.match?(/^[+-]?[0-9]*$/) ||
|
|
103
104
|
variable.match?(/---/) ||
|
|
@@ -122,9 +123,7 @@ def self.read_map(maps_files_paths, output_path, logging, game_type, processing_
|
|
|
122
123
|
return
|
|
123
124
|
end
|
|
124
125
|
|
|
125
|
-
maps_object_map = Hash[maps_files_paths.map
|
|
126
|
-
[File.basename(filename), Marshal.load(File.binread(filename))]
|
|
127
|
-
end]
|
|
126
|
+
maps_object_map = Hash[maps_files_paths.map { |f| [File.basename(f), Marshal.load(File.binread(f))] }]
|
|
128
127
|
|
|
129
128
|
maps_lines = IndexSet.new
|
|
130
129
|
names_lines = IndexSet.new
|
|
@@ -266,9 +265,7 @@ end
|
|
|
266
265
|
# @param [String] game_type
|
|
267
266
|
# @param [String] processing_type
|
|
268
267
|
def self.read_other(other_files_paths, output_path, logging, game_type, processing_type)
|
|
269
|
-
other_object_array_map = Hash[other_files_paths.map
|
|
270
|
-
[File.basename(filename), Marshal.load(File.binread(filename))]
|
|
271
|
-
end]
|
|
268
|
+
other_object_array_map = Hash[other_files_paths.map { |f| [File.basename(f), Marshal.load(File.binread(f))] }]
|
|
272
269
|
|
|
273
270
|
inner_processing_type = processing_type
|
|
274
271
|
# 401 - dialogue lines
|
|
@@ -510,20 +507,18 @@ def self.read_system(system_file_path, ini_file_path, output_path, logging, proc
|
|
|
510
507
|
|
|
511
508
|
system_lines.add(value)
|
|
512
509
|
end
|
|
510
|
+
elsif value.is_a?(Array)
|
|
511
|
+
value.each do |string|
|
|
512
|
+
next unless string.is_a?(String)
|
|
513
513
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
value.each do |string|
|
|
518
|
-
next unless string.is_a?(String)
|
|
519
|
-
|
|
520
|
-
string = string.strip
|
|
521
|
-
next if string.empty?
|
|
514
|
+
string = string.strip
|
|
515
|
+
next if string.empty?
|
|
522
516
|
|
|
523
|
-
|
|
524
|
-
|
|
517
|
+
system_translation_map.insert_at_index(system_lines.length, string, '') if processing_type == :append &&
|
|
518
|
+
!system_translation_map.include?(string)
|
|
525
519
|
|
|
526
|
-
|
|
520
|
+
system_lines.add(string)
|
|
521
|
+
end
|
|
527
522
|
end
|
|
528
523
|
end
|
|
529
524
|
|
data/lib/write.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require 'zlib'
|
|
4
4
|
|
|
5
5
|
# @param [String] string A parsed scripts code string, containing raw Ruby code
|
|
6
|
-
# @return [
|
|
6
|
+
# @return [Array<Array<String, Integer>>] Hash of parsed from code strings and their start indices
|
|
7
7
|
def self.extract_quoted_strings(string)
|
|
8
8
|
strings_array = []
|
|
9
9
|
indices_array = []
|
|
@@ -129,9 +129,7 @@ end
|
|
|
129
129
|
# @param [Boolean] logging
|
|
130
130
|
# @param [String] game_type
|
|
131
131
|
def self.write_map(original_files_paths, maps_path, output_path, shuffle_level, logging, game_type)
|
|
132
|
-
maps_object_map = Hash[original_files_paths.map
|
|
133
|
-
[File.basename(filename), Marshal.load(File.binread(filename))]
|
|
134
|
-
end]
|
|
132
|
+
maps_object_map = Hash[original_files_paths.map { |f| [File.basename(f), Marshal.load(File.binread(f))] }]
|
|
135
133
|
|
|
136
134
|
maps_original_text = File.readlines(File.join(maps_path, 'maps.txt'), encoding: 'UTF-8', chomp: true).map do |line|
|
|
137
135
|
line.gsub('\#', "\n").strip
|
|
@@ -270,9 +268,7 @@ end
|
|
|
270
268
|
# @param [Boolean] logging
|
|
271
269
|
# @param [String] game_type
|
|
272
270
|
def self.write_other(original_files_paths, other_path, output_path, shuffle_level, logging, game_type)
|
|
273
|
-
other_object_array_map = Hash[original_files_paths.map
|
|
274
|
-
[File.basename(filename), Marshal.load(File.binread(filename))]
|
|
275
|
-
end]
|
|
271
|
+
other_object_array_map = Hash[original_files_paths.map { |f| [File.basename(f), Marshal.load(File.binread(f))] }]
|
|
276
272
|
|
|
277
273
|
# 401 - dialogue lines
|
|
278
274
|
# 405 - credits lines
|
|
@@ -424,9 +420,7 @@ end
|
|
|
424
420
|
# @param [String] translated
|
|
425
421
|
def self.write_ini_title(ini_file_path, translated)
|
|
426
422
|
file_lines = File.readlines(ini_file_path, chomp: true)
|
|
427
|
-
title_line_index = file_lines.each_with_index
|
|
428
|
-
break i if line.downcase.start_with?('title')
|
|
429
|
-
end
|
|
423
|
+
title_line_index = file_lines.each_with_index { |line, i| break i if line.downcase.start_with?('title') }
|
|
430
424
|
|
|
431
425
|
file_lines[title_line_index] = translated
|
|
432
426
|
File.binwrite(ini_file_path, file_lines.join("\n"))
|
|
@@ -522,9 +516,8 @@ def self.write_system(system_file_path, ini_file_path, other_path, output_path,
|
|
|
522
516
|
write_ini_title(ini_file_path, game_title_translated)
|
|
523
517
|
end
|
|
524
518
|
|
|
525
|
-
puts "Written #{system_basename}" if logging
|
|
526
|
-
|
|
527
519
|
File.binwrite(File.join(output_path, system_basename), Marshal.dump(system_object))
|
|
520
|
+
puts "Written #{system_basename}" if logging
|
|
528
521
|
end
|
|
529
522
|
|
|
530
523
|
# @param [String] scripts_file_path Path to Scripts.*data file
|
data/rvpacker-txt.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.4'
|
|
6
6
|
spec.authors = ['Howard Jeng', 'Andrew Kesterson', 'Solistra', 'Darkness9724', 'savannstm']
|
|
7
7
|
spec.email = ['savannstm@gmail.com']
|
|
8
8
|
spec.summary = 'Reads or writes RPG Maker XP/VX/VXAce game text to .txt files'
|
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.4
|
|
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-21 00:00:00.000000000 Z
|
|
16
16
|
dependencies: []
|
|
17
17
|
description:
|
|
18
18
|
email:
|