rvpacker-txt 1.11.0 → 1.13.0
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/Gemfile +1 -0
- data/README.md +20 -24
- data/bin/rvpacker-txt +184 -126
- data/lib/classes.rb +23 -62
- data/lib/extensions.rb +195 -199
- data/lib/read.rb +342 -362
- data/lib/write.rb +247 -187
- data/rvpacker-txt.gemspec +12 -2
- metadata +4 -4
- /data/{LICENSE → LICENSE.md} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 306650077c0c96134cd8f4f1d76c3c5fc7d7b3e7745ad1ddd4a998d75b2635fe
|
|
4
|
+
data.tar.gz: f1ca20dfdcfd2392887d670aa6d9627dbdef790c33e914885e1e408f13c13204
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7c3d64504ea05478e5dbe30c6658a1c9ce7bfb6534769c4030cc2397b1288985bccb60fd88f3f8e22775d5e7abe9f8c9f749f8e256c563fab5d25d6ec99d79c
|
|
7
|
+
data.tar.gz: 101c1fd97bcd7e9e91c86e0ac7bf5746e0dc53450eebc5d518542b26a9133c8f53f7e849892a64afc32ad48a3241212bd77efc10ead33d835c52269aadf38087
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# rvpacker-txt
|
|
2
2
|
|
|
3
|
+
**This project won't longer be maintained. Consider looking into my other projects: [Rust implementation of Marshal](https://github.com/savannstm/marshal-rs) and [TypeScript implementation of Marshal](https://github.com/savannstm/marshal)**
|
|
4
|
+
|
|
3
5
|
A tool to read RPG Maker data files to .txt files and write them back to the initial form. It's a port of Darkness9724's
|
|
4
6
|
port of Ruby 1.9.x's rvpacker to Ruby 3.x to use .txt files instead of YAML, and overall improve the code quality.
|
|
5
7
|
|
|
6
|
-
rvpacker consists of 3 parts:
|
|
8
|
+
rvpacker-txt consists of 3 parts:
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
- classes.rb library - all necessary classes to properly load and dump RPG Maker files.
|
|
11
|
+
- read.rb library - all necessary functions for reading and parsing RPG Maker files to text.
|
|
12
|
+
- write.rb library - all necessary functions for writing parsed RPG Maker files back to their initial form.
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
## Installation
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
$ gem install rvpacker-txt
|
|
16
|
-
```
|
|
16
|
+
`gem install rvpacker-txt`
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## Usage
|
|
19
19
|
|
|
20
20
|
You can get a help message on usage using `rvpacker-txt -h`.
|
|
21
21
|
|
|
22
|
-
```
|
|
22
|
+
```text
|
|
23
23
|
$ rvpacker-txt -h
|
|
24
24
|
This tool allows to parse RPG Maker games to .txt files and write them back to their initial form.
|
|
25
25
|
|
|
@@ -47,44 +47,40 @@ OPTIONS:
|
|
|
47
47
|
|
|
48
48
|
For example, to read a RPG Maker VX Ace project in E:/Documents/RPGMakerGame to .txt files:
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
$ rvpacker-txt read --input-dir E:/Documents/RPGMakerGame
|
|
52
|
-
```
|
|
50
|
+
`$ rvpacker-txt read --input-dir E:/Documents/RPGMakerGame`
|
|
53
51
|
|
|
54
52
|
Program determines game engine automatically.
|
|
55
53
|
|
|
56
|
-
This will parse all text from Data
|
|
57
|
-
_trans postfix that contain original text and files with _trans postfix that contain empty lines for translation.
|
|
54
|
+
This will parse all text from Data/\* files into translation/maps and translation/other directories as files without
|
|
55
|
+
\_trans postfix that contain original text and files with \_trans postfix that contain empty lines for translation.
|
|
58
56
|
Lines from Scripts file will be parsed into translation/other/scripts.txt file as plain text, and
|
|
59
57
|
also into a scripts_plain.txt file that contains scripts contents as a whole - that's just for convenience.
|
|
60
58
|
|
|
61
59
|
To write previously parsed project back to its initial form:
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
$ rvpacker-txt write --input-dir E:/Documents/RPGMakerGame
|
|
65
|
-
```
|
|
61
|
+
`$ rvpacker-txt write --input-dir E:/Documents/RPGMakerGame`
|
|
66
62
|
|
|
67
|
-
This will take all of translation lines from _trans files from the translation subdirectories and repack all of them
|
|
63
|
+
This will take all of translation lines from \_trans files from the translation subdirectories and repack all of them
|
|
68
64
|
to their initial form in output directory.
|
|
69
65
|
|
|
70
|
-
|
|
66
|
+
### General
|
|
71
67
|
|
|
72
68
|
This is great for collaborating on translations and have clean version control.
|
|
73
69
|
You can easily push .txt files and easily merge them.
|
|
74
70
|
|
|
75
71
|
Now your translation can be forked/merged in an extremely easy way.
|
|
76
72
|
|
|
77
|
-
|
|
73
|
+
### Credit to previous authors
|
|
78
74
|
|
|
79
75
|
The RPG and RGSS libraries were originally taken from SiCrane's YAML importer/exporter on the gamedev forums.
|
|
80
76
|
|
|
81
|
-
http://www.gamedev.net/topic/646333-rpg-maker-vx-ace-data-conversion-utility
|
|
77
|
+
<http://www.gamedev.net/topic/646333-rpg-maker-vx-ace-data-conversion-utility/>
|
|
82
78
|
|
|
83
79
|
akesterson, ymaxkrapzv and BigBlueHat created an original rvpacker repository with the initial frontend for SiCrane's
|
|
84
80
|
YAML importer/exporter.
|
|
85
81
|
|
|
86
|
-
https://github.com/ymaxkrapzv/rvpacker
|
|
82
|
+
<https://github.com/ymaxkrapzv/rvpacker>
|
|
87
83
|
|
|
88
84
|
Darkness9724 forked rvpacker to rvpacker-ng, ported it to Ruby 3.x and updated dependencies.
|
|
89
85
|
|
|
90
|
-
https://gitlab.com/Darkness9724/rvpacker-ng
|
|
86
|
+
<https://gitlab.com/Darkness9724/rvpacker-ng>
|
data/bin/rvpacker-txt
CHANGED
|
@@ -7,25 +7,27 @@ require 'fileutils'
|
|
|
7
7
|
require 'classes'
|
|
8
8
|
|
|
9
9
|
def self.parse_options
|
|
10
|
-
options = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
options = {
|
|
11
|
+
action: nil,
|
|
12
|
+
input_path: './',
|
|
13
|
+
output_path: './',
|
|
14
|
+
disable_processing: {
|
|
15
|
+
maps: false,
|
|
16
|
+
other: false,
|
|
17
|
+
system: false,
|
|
18
|
+
scripts: false,
|
|
19
|
+
},
|
|
20
|
+
disable_custom_processing: false,
|
|
21
|
+
romanize: false,
|
|
22
|
+
logging: false,
|
|
23
|
+
force: false,
|
|
24
|
+
append: false,
|
|
25
|
+
shuffle_level: 0,
|
|
26
|
+
silent: false,
|
|
27
|
+
}
|
|
26
28
|
|
|
27
29
|
options[:action] = ARGV[0]
|
|
28
|
-
options[:silent] = true
|
|
30
|
+
options[:silent] = true if ARGV.delete('--silent')
|
|
29
31
|
|
|
30
32
|
unless %w[read write].include?(options[:action])
|
|
31
33
|
if %w[-h --help].include?(options[:action])
|
|
@@ -37,102 +39,136 @@ def self.parse_options
|
|
|
37
39
|
end
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
read_command_description =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
read_command_description =
|
|
43
|
+
'Parses files from "original" or "data" folders of input directory to "translation" folder of output directory.'
|
|
44
|
+
write_command_description =
|
|
45
|
+
'Writes translated files using original files from "original" or "data" folder of input directory and writes ' \
|
|
46
|
+
'results to "output" folder of output directory.'
|
|
47
|
+
banner_text =
|
|
48
|
+
"This tool allows to parse RPG Maker games to .txt files and write them back to their initial form.\n\nUsage:" \
|
|
49
|
+
" rvpacker-txt COMMAND [OPTIONS]\n\nCOMMANDS:\n read - #{read_command_description}\n write - " \
|
|
50
|
+
"#{write_command_description}\nOPTIONS:"
|
|
51
|
+
|
|
52
|
+
banner, input_dir_description, output_dir_description, =
|
|
47
53
|
case options[:action]
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
when 'read'
|
|
55
|
+
[
|
|
56
|
+
"#{read_command_description}\n\nOPTIONS:\n",
|
|
57
|
+
['Input directory, containing folders "original" or "data" with original game files.'],
|
|
58
|
+
[
|
|
59
|
+
'Output directory, where a "translation" folder will be created, containing parsed .txt files ' \
|
|
60
|
+
'with the text from the game.',
|
|
61
|
+
],
|
|
62
|
+
]
|
|
63
|
+
when 'write'
|
|
64
|
+
[
|
|
65
|
+
"#{write_command_description}\n\nOPTIONS:\n",
|
|
66
|
+
[
|
|
67
|
+
'Input directory, containing folders "original" or "data" and "translation" with original game ' \
|
|
68
|
+
'files and .txt files with translation respectively.',
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
'Output directory, where an "output" folder will be created, containing compiled RPG Maker files ' \
|
|
72
|
+
'with your translation.',
|
|
73
|
+
],
|
|
74
|
+
]
|
|
75
|
+
else
|
|
76
|
+
[
|
|
77
|
+
banner_text,
|
|
78
|
+
[
|
|
79
|
+
'When reading: Input directory, containing folders "original" or "data" with original game files.',
|
|
80
|
+
'When writing: Input directory, containing folders "original" or "data" and "translation" with ' \
|
|
81
|
+
'original game files and .txt files with translation respectively.',
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
'When reading: Output directory, where a "translation" folder will be created, containing parsed ' \
|
|
85
|
+
'.txt files with the text from the game.',
|
|
86
|
+
'When writing: Output directory, where an "output" folder will be created, containing compiled ' \
|
|
87
|
+
'RPG Maker files with your translation.',
|
|
88
|
+
],
|
|
89
|
+
]
|
|
74
90
|
end
|
|
75
91
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
files = %w[maps other system scripts]
|
|
82
|
-
index = files.find_index(file)
|
|
83
|
-
options[:disable_processing][files[index]] = true if index
|
|
92
|
+
OptionParser
|
|
93
|
+
.new(banner) do |cmd|
|
|
94
|
+
cmd.on('-i', '--input-dir PATH', String, *input_dir_description) do |dir|
|
|
95
|
+
options[:input_path] = File.exist?(dir) ? File.realpath(dir) : (raise "#{dir} not found")
|
|
96
|
+
options[:output_path] = options[:input_path]
|
|
84
97
|
end
|
|
85
|
-
end
|
|
86
98
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
'This flag will automatically be used when writing if you parsed game text with it.') do
|
|
90
|
-
options[:disable_custom_processing] = true
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
cmd.on('-r', '--romanize',
|
|
94
|
-
'If you parsing text from a Japanese game, that contains symbols like 「」, which are just the Japanese quotation marks,',
|
|
95
|
-
'it automatically replaces these symbols by their roman equivalents (in this case, "").',
|
|
96
|
-
'This flag will automatically be used when writing if you parsed game text with it.') do
|
|
97
|
-
options[:romanize] = true
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
if options[:action] == 'read'
|
|
101
|
-
cmd.on('-f', '--force',
|
|
102
|
-
'Force rewrite all files. Cannot be used with --append.',
|
|
103
|
-
'USE WITH CAUTION!') do
|
|
104
|
-
options[:force] = true
|
|
99
|
+
cmd.on('-o', '--output-dir PATH', String, *output_dir_description) do |dir|
|
|
100
|
+
options[:output_path] = File.exist?(dir) ? File.realpath(dir) : (raise "#{dir} not found")
|
|
105
101
|
end
|
|
106
102
|
|
|
107
|
-
cmd.on(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
cmd.on(
|
|
104
|
+
'--disable-processing FILES',
|
|
105
|
+
Array,
|
|
106
|
+
'Skips processing specified files.',
|
|
107
|
+
'Example: --disable-processing=maps,other,system.',
|
|
108
|
+
'[Allowed values: maps, other, system, scripts]',
|
|
109
|
+
) do |files|
|
|
110
|
+
files.each do |file|
|
|
111
|
+
files = %w[maps other system scripts]
|
|
112
|
+
index = files.find_index(file)
|
|
113
|
+
options[:disable_processing][files[index]] = true if index
|
|
114
|
+
end
|
|
113
115
|
end
|
|
114
|
-
|
|
115
|
-
cmd.on(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
|
|
117
|
+
cmd.on(
|
|
118
|
+
'--disable-custom-processing',
|
|
119
|
+
'Disables built-in custom text processing for some games.',
|
|
120
|
+
'This flag will automatically be used when writing if you parsed game text with it.',
|
|
121
|
+
) { options[:disable_custom_processing] = true }
|
|
122
|
+
|
|
123
|
+
cmd.on(
|
|
124
|
+
'-r',
|
|
125
|
+
'--romanize',
|
|
126
|
+
'If you parsing text from a Japanese game, that contains symbols like 「」, which are just the ' \
|
|
127
|
+
'Japanese quotation marks,',
|
|
128
|
+
'it automatically replaces these symbols by their roman equivalents (in this case, "").',
|
|
129
|
+
'This flag will automatically be used when writing if you parsed game text with it.',
|
|
130
|
+
) { options[:romanize] = true }
|
|
131
|
+
|
|
132
|
+
if options[:action] == 'read'
|
|
133
|
+
cmd.on('-f', '--force', 'Force rewrite all files. Cannot be used with --append.', 'USE WITH CAUTION!') do
|
|
134
|
+
options[:force] = true
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
cmd.on(
|
|
138
|
+
'-a',
|
|
139
|
+
'--append',
|
|
140
|
+
"When the rvpacker-txt or the game which files you've parsed receives an update, you probably " \
|
|
141
|
+
'should re-read game files with --append,',
|
|
142
|
+
'which will append any new text to your files without overwriting the progress.',
|
|
143
|
+
'Cannot be used with --force.',
|
|
144
|
+
) do
|
|
145
|
+
raise '--append cannot be used with --force.' if options[:force]
|
|
146
|
+
options[:append] = true
|
|
147
|
+
end
|
|
148
|
+
elsif options[:action] == 'write'
|
|
149
|
+
cmd.on(
|
|
150
|
+
'-s',
|
|
151
|
+
'--shuffle-level NUMBER',
|
|
152
|
+
Integer,
|
|
153
|
+
'With value 1, shuffles all translation lines. With value 2, shuffles all words and lines in ' \
|
|
154
|
+
'translation text.',
|
|
155
|
+
'Example: --shuffle-level 1.',
|
|
156
|
+
'[Allowed values: 0, 1, 2]',
|
|
157
|
+
'[Default value: 0]',
|
|
158
|
+
) do |num|
|
|
159
|
+
raise 'Allowed values: 0, 1, 2.' if num > 2
|
|
160
|
+
options[:shuffle_level] = num
|
|
161
|
+
end
|
|
122
162
|
end
|
|
123
|
-
end
|
|
124
163
|
|
|
125
|
-
|
|
126
|
-
'Enables logging.') do
|
|
127
|
-
options[:logging] = true
|
|
128
|
-
end
|
|
164
|
+
cmd.on('-l', '--log', 'Enables logging.') { options[:logging] = true }
|
|
129
165
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
166
|
+
cmd.on('-h', '--help', "Prints the program's help message or for the entered subcommand.") do
|
|
167
|
+
puts cmd
|
|
168
|
+
exit
|
|
169
|
+
end
|
|
134
170
|
end
|
|
135
|
-
|
|
171
|
+
.parse!
|
|
136
172
|
|
|
137
173
|
options
|
|
138
174
|
end
|
|
@@ -181,8 +217,9 @@ metadata_file_path = File.join(input_path, 'translation', '.rvpacker-txt-metadat
|
|
|
181
217
|
FileUtils.mkdir_p(maps_path)
|
|
182
218
|
FileUtils.mkdir_p(other_path)
|
|
183
219
|
|
|
184
|
-
engine =
|
|
185
|
-
|
|
220
|
+
engine =
|
|
221
|
+
extensions.each_pair { |sym, ext| break sym if File.exist?(File.join(original_directory, "System.#{ext}")) } ||
|
|
222
|
+
(raise "Couldn't determine project engine.")
|
|
186
223
|
|
|
187
224
|
files = Dir.glob("#{original_directory}/*#{extensions[engine]}")
|
|
188
225
|
|
|
@@ -195,9 +232,9 @@ files.each do |file|
|
|
|
195
232
|
basename = File.basename(file)
|
|
196
233
|
next unless basename.end_with?(extensions[engine])
|
|
197
234
|
|
|
198
|
-
if basename.
|
|
235
|
+
if basename.match?(/^Map[0-9]/)
|
|
199
236
|
maps_files_paths.push(file)
|
|
200
|
-
elsif !basename.
|
|
237
|
+
elsif !basename.match?(/^(Map|Tilesets|Animations|System|Scripts|Areas)/)
|
|
201
238
|
other_files_paths.push(file)
|
|
202
239
|
elsif basename.start_with?('System')
|
|
203
240
|
system_file_path = file
|
|
@@ -217,29 +254,41 @@ $wait_time = 0
|
|
|
217
254
|
if options[:action] == 'read'
|
|
218
255
|
require 'read'
|
|
219
256
|
|
|
220
|
-
processing_mode =
|
|
221
|
-
|
|
222
|
-
|
|
257
|
+
processing_mode =
|
|
258
|
+
if force
|
|
259
|
+
unless silent
|
|
260
|
+
wait_time_start = Time.now
|
|
223
261
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
262
|
+
puts "WARNING! You're about to forcefully rewrite all your translation files, including _trans files.",
|
|
263
|
+
"If you really want to do it, make sure you've made a backup of your _trans files, if you '\
|
|
264
|
+
'made some changes in them already.",
|
|
265
|
+
"Input 'Y' to continue."
|
|
266
|
+
exit unless $stdin.gets.chomp == 'Y'
|
|
228
267
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
268
|
+
$wait_time += Time.now - wait_time_start
|
|
269
|
+
end
|
|
270
|
+
:force
|
|
271
|
+
elsif append
|
|
272
|
+
:append
|
|
273
|
+
else
|
|
274
|
+
:default
|
|
275
|
+
end
|
|
237
276
|
|
|
238
|
-
File.binwrite(
|
|
277
|
+
File.binwrite(
|
|
278
|
+
metadata_file_path,
|
|
279
|
+
Marshal.dump({ romanize: romanize, disable_custom_processing: disable_custom_processing }),
|
|
280
|
+
)
|
|
239
281
|
|
|
240
282
|
read_map(maps_files_paths, maps_path, romanize, logging, game_type, processing_mode) unless disable_processing[:maps]
|
|
241
|
-
|
|
242
|
-
|
|
283
|
+
|
|
284
|
+
unless disable_processing[:other]
|
|
285
|
+
read_other(other_files_paths, other_path, romanize, logging, game_type, processing_mode)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
unless disable_processing[:system]
|
|
289
|
+
read_system(system_file_path, ini_file_path, other_path, romanize, logging, processing_mode)
|
|
290
|
+
end
|
|
291
|
+
|
|
243
292
|
read_scripts(scripts_file_path, other_path, romanize, logging, processing_mode) unless disable_processing[:scripts]
|
|
244
293
|
else
|
|
245
294
|
require 'write'
|
|
@@ -261,9 +310,18 @@ else
|
|
|
261
310
|
end
|
|
262
311
|
end
|
|
263
312
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
313
|
+
unless disable_processing[:maps]
|
|
314
|
+
write_map(maps_files_paths, maps_path, output_path, shuffle_level, romanize, logging, game_type)
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
unless disable_processing[:other]
|
|
318
|
+
write_other(other_files_paths, other_path, output_path, shuffle_level, romanize, logging, game_type)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
unless disable_processing[:system]
|
|
322
|
+
write_system(system_file_path, ini_file_path, other_path, output_path, shuffle_level, romanize, logging)
|
|
323
|
+
end
|
|
324
|
+
|
|
267
325
|
write_scripts(scripts_file_path, other_path, output_path, romanize, logging) unless disable_processing[:scripts]
|
|
268
326
|
end
|
|
269
327
|
|
data/lib/classes.rb
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2013 Howard Jeng
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
6
|
+
# software and associated documentation files (the "Software"), to deal in the Software
|
|
7
|
+
# without restriction, including without limitation the rights to use, copy, modify, merge,
|
|
8
|
+
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
|
9
|
+
# to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all copies or
|
|
12
|
+
# substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
15
|
+
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
16
|
+
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
|
17
|
+
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
18
|
+
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
19
|
+
# DEALINGS IN THE SOFTWARE.
|
|
20
20
|
|
|
21
21
|
class Table
|
|
22
22
|
def initialize(bytes)
|
|
@@ -75,43 +75,6 @@ class Rect
|
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
# Fuck using an array with set, that's just straight dumb and not efficient
|
|
79
|
-
class IndexSet
|
|
80
|
-
def initialize
|
|
81
|
-
@hash = Hash.new
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def add(item)
|
|
85
|
-
return if @hash.include?(item)
|
|
86
|
-
@hash[item] = @hash.size
|
|
87
|
-
@hash
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def include?(item)
|
|
91
|
-
@hash.include?(item)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def each(&block)
|
|
95
|
-
@hash.each_key(&block)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def to_a
|
|
99
|
-
@hash.dup
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def join(delimiter = '')
|
|
103
|
-
@hash.keys.join(delimiter)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def length
|
|
107
|
-
@hash.size
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def empty?
|
|
111
|
-
@hash.empty?
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
78
|
class Hash
|
|
116
79
|
def insert_at_index(index, key, value)
|
|
117
80
|
return self[key] = value if index >= size
|
|
@@ -160,11 +123,11 @@ module RPG
|
|
|
160
123
|
end
|
|
161
124
|
|
|
162
125
|
class Skill
|
|
163
|
-
attr_accessor :name, :description, :note
|
|
126
|
+
attr_accessor :name, :description, :note, :message1, :message2
|
|
164
127
|
end
|
|
165
128
|
|
|
166
129
|
class State
|
|
167
|
-
attr_accessor :name, :description, :note
|
|
130
|
+
attr_accessor :name, :description, :note, :message1, :message2, :message3, :message4
|
|
168
131
|
end
|
|
169
132
|
|
|
170
133
|
class Weapon
|
|
@@ -248,10 +211,8 @@ module RGSS
|
|
|
248
211
|
%i[RPG UsableItem],
|
|
249
212
|
%i[RPG UsableItem Damage],
|
|
250
213
|
%i[RPG UsableItem Effect],
|
|
251
|
-
%i[RPG Weapon]
|
|
214
|
+
%i[RPG Weapon],
|
|
252
215
|
].freeze
|
|
253
216
|
|
|
254
|
-
CLASSES_NESTED_ARRAY.each
|
|
255
|
-
process(Object, *symbol_array)
|
|
256
|
-
end
|
|
217
|
+
CLASSES_NESTED_ARRAY.each { |symbol_array| process(Object, *symbol_array) }
|
|
257
218
|
end
|