rvpacker-txt 1.7.1 → 1.8.1

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: 74aada023c293bbfcc7d1f6ae5938daadaf3fd0b021df0828d9ac6cd7b6c2ff5
4
- data.tar.gz: 609a0d4ebb873b9162f3999d3620419757c60724a316c6716311b3f6268fe32e
3
+ metadata.gz: d199295537aa63985fd91781ab16f369f2143e7dc31a60647800896ea554d499
4
+ data.tar.gz: 1e9875616671881fad934714622fe57f4a9f9a0c9fa8719e29b33e7e82cb9b94
5
5
  SHA512:
6
- metadata.gz: 94d500defcefee3f20a86b8ff7adc7b25379cec0561b0ef675e00b4c1153fc23e00f8e897a425848c2be77bdcb59fa3931fb8ec647a64a6b0d768d231f3161cd
7
- data.tar.gz: 00b7582689da125e19e2ec21d9b8543e40ea1d2c19a382e719a0d81a42dfd4069f65bf4ec2cee7da4ad9a8fc635bfb79747f5c6201437f20c3d4a6746348a295
6
+ metadata.gz: d5d3dcb0546223e2934632d15e0e3afb1c551ef68179a92a23d607ac2d575119948cd4e0dfff61f44f12b2dc7d0974e5ea9805c90a09a3192ca0a2e253d1e439
7
+ data.tar.gz: 971573cb4d854c8b4ca31825c86ed948a8577b73a21ccf30c8f9257c9d2e86eb44a01c2e3b51089941a0c357c94af0bd758c41309f708b2f7cfd5c6850374fd0
data/lib/classes.rb CHANGED
@@ -134,31 +134,31 @@ module RPG
134
134
  end
135
135
 
136
136
  class Armor
137
- attr_accessor :name, :nickname, :description, :note
137
+ attr_accessor :name, :description, :note
138
138
  end
139
139
 
140
140
  class Class
141
- attr_accessor :name, :nickname, :description, :note
141
+ attr_accessor :name, :description, :note
142
142
  end
143
143
 
144
144
  class Enemy
145
- attr_accessor :name, :nickname, :description, :note
145
+ attr_accessor :name, :description, :note
146
146
  end
147
147
 
148
148
  class Item
149
- attr_accessor :name, :nickname, :description, :note
149
+ attr_accessor :name, :description, :note
150
150
  end
151
151
 
152
152
  class Skill
153
- attr_accessor :name, :nickname, :description, :note
153
+ attr_accessor :name, :description, :note
154
154
  end
155
155
 
156
156
  class State
157
- attr_accessor :name, :nickname, :description, :note
157
+ attr_accessor :name, :description, :note
158
158
  end
159
159
 
160
160
  class Weapon
161
- attr_accessor :name, :nickname, :description, :note
161
+ attr_accessor :name, :description, :note
162
162
  end
163
163
 
164
164
  class CommonEvent
data/lib/read.rb CHANGED
@@ -13,7 +13,7 @@ class Hash
13
13
  end
14
14
 
15
15
  # @param [String] string A parsed scripts code string, containing raw Ruby code
16
- # @return [IndexSet<String>] Hash of parsed from code strings and their start indices
16
+ # @return [IndexSet<String>] Set of extracted strings
17
17
  def self.extract_quoted_strings(string)
18
18
  result = IndexSet.new
19
19
 
@@ -147,9 +147,8 @@ def self.read_map(maps_files_paths, output_path, logging, game_type, processing_
147
147
 
148
148
  # 401 - dialogue lines
149
149
  # 102 - dialogue choices array
150
- # 402 - one of the dialogue choices from the array
151
150
  # 356 - system lines/special texts (do they even exist before mv?)
152
- allowed_codes = [401, 102, 402, 356].freeze
151
+ allowed_codes = [401, 102, 356].freeze
153
152
 
154
153
  maps_object_map.each do |filename, object|
155
154
  display_name = object.display_name
@@ -276,9 +275,8 @@ def self.read_other(other_files_paths, output_path, logging, game_type, processi
276
275
  # 401 - dialogue lines
277
276
  # 405 - credits lines
278
277
  # 102 - dialogue choices array
279
- # 402 - one of the dialogue choices from the array
280
278
  # 356 - system lines/special texts (do they even exist before mv?)
281
- allowed_codes = [401, 405, 102, 402, 356].freeze
279
+ allowed_codes = [401, 405, 102, 356].freeze
282
280
 
283
281
  other_object_array_map.each do |filename, other_object_array|
284
282
  processed_filename = File.basename(filename, '.*').downcase
@@ -310,7 +308,7 @@ def self.read_other(other_files_paths, output_path, logging, game_type, processi
310
308
  next if object.nil?
311
309
 
312
310
  name = object.name
313
- nickname = object.nickname
311
+ nickname = object.nickname if object.is_a?(RPG::Actor)
314
312
  description = object.description
315
313
  note = object.note
316
314
 
data/lib/write.rb CHANGED
@@ -5,7 +5,6 @@ require 'zlib'
5
5
  # @param [String] string A parsed scripts code string, containing raw Ruby code
6
6
  # @return [[Array<String>, Array<Integer>]] Hash of parsed from code strings and their start indices
7
7
  def self.extract_quoted_strings(string)
8
- # Hash of string-index key-value pairs
9
8
  strings_array = []
10
9
  indices_array = []
11
10
 
@@ -140,7 +139,7 @@ def self.write_map(original_files_paths, maps_path, output_path, shuffle_level,
140
139
  line.gsub('\#', "\n").strip
141
140
  end.freeze
142
141
 
143
- maps_translated_text = File.readlines(File.join(maps_path, 'maps.txt'), encoding: 'UTF-8', chomp: true).map do |line|
142
+ maps_translated_text = File.readlines(File.join(maps_path, 'maps_trans.txt'), encoding: 'UTF-8', chomp: true).map do |line|
144
143
  line.gsub('\#', "\n").strip
145
144
  end
146
145
 
@@ -175,11 +174,11 @@ def self.write_map(original_files_paths, maps_path, output_path, shuffle_level,
175
174
  events = object.events
176
175
  next if events.nil?
177
176
 
178
- events.each_value do |event|
177
+ events.each do |ev, event|
179
178
  pages = event.pages
180
179
  next if pages.nil?
181
180
 
182
- pages.each do |page|
181
+ pages.each_with_index do |page, pg|
183
182
  list = page.list
184
183
  next if list.nil?
185
184
 
@@ -244,13 +243,21 @@ def self.write_map(original_files_paths, maps_path, output_path, shuffle_level,
244
243
  end
245
244
 
246
245
  item.parameters = parameters
246
+ list[it] = item
247
247
  end
248
+
249
+ page.list = list
250
+ pages[pg] = page
248
251
  end
252
+
253
+ event.pages = pages
254
+ events[ev] = event
249
255
  end
250
256
 
251
- puts "Written #{filename}" if logging
257
+ object.events = events
252
258
 
253
259
  File.binwrite(File.join(output_path, filename), Marshal.dump(object))
260
+ puts "Written #{filename}" if logging
254
261
  end
255
262
  end
256
263
 
@@ -293,7 +300,7 @@ def self.write_other(original_files_paths, other_path, output_path, shuffle_leve
293
300
  next if object.nil?
294
301
 
295
302
  name = object.name
296
- nickname = object.nickname
303
+ nickname = object.nickname if object.is_a?(RPG::Actor)
297
304
  description = object.description
298
305
  note = object.note
299
306
 
@@ -310,7 +317,7 @@ def self.write_other(original_files_paths, other_path, output_path, shuffle_leve
310
317
  if i.zero?
311
318
  object.name = translated
312
319
  elsif i == 1
313
- object.nickname = translated
320
+ object.nickname = translated if object.is_a?(RPG::Actor)
314
321
  elsif i == 2
315
322
  object.description = translated
316
323
  else
@@ -320,7 +327,7 @@ def self.write_other(original_files_paths, other_path, output_path, shuffle_leve
320
327
  end
321
328
  end
322
329
  else
323
- other_object_array.each do |object|
330
+ other_object_array.each_with_index do |object, obj|
324
331
  next if object.nil?
325
332
 
326
333
  pages = object.pages
@@ -391,14 +398,23 @@ def self.write_other(original_files_paths, other_path, output_path, shuffle_leve
391
398
  end
392
399
 
393
400
  item.parameters = parameters
401
+ list[it] = item
402
+ end
403
+
404
+ if pages.nil?
405
+ object.list = list
406
+ else
407
+ pages[pg].instance_variable_set(:@list, list)
408
+ object.pages = pages
394
409
  end
395
410
  end
411
+
412
+ other_object_array[obj] = object
396
413
  end
397
414
  end
398
415
 
399
- puts "Written #{filename}" if logging
400
-
401
416
  File.binwrite(File.join(output_path, filename), Marshal.dump(other_object_array))
417
+ puts "Written #{filename}" if logging
402
418
  end
403
419
  end
404
420
 
@@ -445,15 +461,15 @@ def self.write_system(system_file_path, ini_file_path, other_path, output_path,
445
461
  currency_unit = system_object.currency_unit
446
462
  terms = system_object.terms || system_object.words
447
463
 
448
- [elements, skill_types, weapon_types, armor_types].each_with_index.each do |array, i|
464
+ [elements, skill_types, weapon_types, armor_types].each_with_index do |array, i|
449
465
  next unless array.is_a?(Array)
450
466
 
451
- array.map! do |string|
452
- stripped = string.strip
453
- return string if stripped.empty?
467
+ array.each_with_index do |string, i|
468
+ string = string.strip
469
+ next if string.empty?
454
470
 
455
- translated = system_translation_map[stripped]
456
- !translated.nil? && !translated.empty? ? translated : stripped
471
+ translated = system_translation_map[string]
472
+ array[i] = translated unless translated.nil? || translated.empty?
457
473
  end
458
474
 
459
475
  if i.zero?
@@ -479,14 +495,14 @@ def self.write_system(system_file_path, ini_file_path, other_path, output_path,
479
495
  next if value.empty?
480
496
 
481
497
  translated = system_translation_map[stripped]
482
- value = !translated.nil? && !translated.empty? ? translated : value
498
+ value = translated unless translated.nil? || translated.empty?
483
499
  elsif value.is_a?(Array)
484
- value.map! do |string|
485
- stripped = string.strip
486
- return string if stripped.empty?
500
+ value.each_with_index do |string, i|
501
+ string = string.strip
502
+ next if string.empty?
487
503
 
488
- translated = system_translation_map[stripped]
489
- value = !translated.nil? && !translated.empty? ? translated : value
504
+ translated = system_translation_map[string]
505
+ value[i] = translated unless translated.nil? || translated.empty?
490
506
  end
491
507
  end
492
508
 
@@ -498,8 +514,11 @@ def self.write_system(system_file_path, ini_file_path, other_path, output_path,
498
514
  system_object.terms = terms
499
515
 
500
516
  game_title_translated = system_translated_text[-1]
501
- system_object.game_title = game_title_translated
502
- write_ini_title(ini_file_path, game_title_translated)
517
+
518
+ unless game_title_translated.nil? || game_title_translated.empty?
519
+ system_object.game_title = game_title_translated
520
+ write_ini_title(ini_file_path, game_title_translated)
521
+ end
503
522
 
504
523
  puts "Written #{system_basename}" if logging
505
524
 
@@ -558,8 +577,7 @@ def self.write_scripts(scripts_file_path, other_path, output_path, logging)
558
577
  script[2] = Zlib::Deflate.deflate(code, Zlib::BEST_COMPRESSION)
559
578
  end
560
579
 
561
- puts "Written #{scripts_basename}" if logging
562
-
563
580
  # File.binwrite(File.join(output_path, 'scripts_plain.txt'), codes.join("\n")) - debug line
564
581
  File.binwrite(File.join(output_path, scripts_basename), Marshal.dump(script_entries))
582
+ puts "Written #{scripts_basename}" if logging
565
583
  end
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.7.1'
5
+ spec.version = '1.8.1'
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.7.1
4
+ version: 1.8.1
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-17 00:00:00.000000000 Z
15
+ date: 2024-07-18 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description:
18
18
  email: