R3EXS 1.1.1 → 2.0.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.
@@ -1,2027 +1,1939 @@
1
- # frozen_string_literal: true
2
-
3
- module R3EXS
4
-
5
- # 基础物品类
6
- class BaseItem
7
-
8
- # 在原始数组中的索引
9
- #
10
- # @return [Integer]
11
- attr_reader :index
12
-
13
- # 物品名称
14
- #
15
- # @return [String]
16
- attr_accessor :name
17
-
18
- # 物品描述
19
- #
20
- # @return [String]
21
- attr_accessor :description
22
-
23
- # 物品注释
24
- #
25
- # @return [String]
26
- attr_accessor :note
27
-
28
- # RPG::BaseItem 初始化
29
- #
30
- # @param baseitem [RPG::BaseItem] 待处理的 RPG::BaseItem 对象
31
- # @param index [Integer] 在原始数组中的索引
32
- # @param with_note [Boolean] 是否处理 note 字段
33
- #
34
- # @return [R3EXS::BaseItem]
35
- def initialize(baseitem, index, with_note)
36
- @index = index
37
- @name = baseitem.name
38
- @description = baseitem.description
39
- @note = baseitem.note
40
- self.remove_instance_variable(:@note) unless with_note
41
- end
42
-
43
- # 注入到 RPG::BaseItem 对象
44
- #
45
- # @param baseitem [RPG::BaseItem] 待注入的 RPG::BaseItem 对象
46
- #
47
- # @return [void]
48
- def inject_to(baseitem)
49
- baseitem.name = @name
50
- baseitem.description = @description if self.instance_variable_defined?(:@description)
51
- baseitem.note = @note if self.instance_variable_defined?(:@note)
52
- end
53
-
54
- # 提取所有的字符串
55
- #
56
- # @return [Array<String>]
57
- def ex_strings
58
- strings = []
59
- strings << @name
60
- strings << @description if self.instance_variable_defined?(:@description)
61
- strings << @note if self.instance_variable_defined?(:@note)
62
- strings
63
- end
64
-
65
- # 将所有的字符串替换为指定的字符串
66
- #
67
- # @param hash [Hash<String, String>] 字符串翻译表
68
- #
69
- # @return [void]
70
- def in_strings(hash)
71
- @name = hash[@name] || @name
72
- @description = hash[@description] || @description if self.instance_variable_defined?(:@description)
73
- @note = hash[@note] || @note if self.instance_variable_defined?(:@note)
74
- end
75
-
76
- # 判断是否为空
77
- #
78
- # @return [Boolean]
79
- def empty?
80
- @name.to_s.empty? && @description.to_s.empty? && @note.to_s.empty?
81
- end
82
- end
83
-
84
- # 角色类
85
- class Actor < BaseItem
86
-
87
- # 昵称
88
- #
89
- # @return [String]
90
- attr_accessor :nickname
91
-
92
- # RPG::Actor 初始化
93
- #
94
- # @param actor [RPG::Actor] 待处理的 RPG::Actor 对象
95
- # @param index [Integer] 在原始数组中的索引
96
- # @param with_note [Boolean] 是否处理 note 字段
97
- #
98
- # @return [R3EXS::Actor]
99
- def initialize(actor, index, with_note)
100
- super(actor, index, with_note)
101
- @nickname = actor.nickname
102
- end
103
-
104
- # 注入到 RPG::Actor 对象
105
- #
106
- # @param actor [RPG::Actor] 待注入的 RPG::Actor 对象
107
- #
108
- # @return [void]
109
- def inject_to(actor)
110
- super(actor)
111
- actor.nickname = @nickname
112
- end
113
-
114
- # 提取所有的字符串
115
- #
116
- # @return [Array<String>]
117
- def ex_strings
118
- strings = super
119
- strings << @nickname
120
- strings
121
- end
122
-
123
- # 提取术语表
124
- #
125
- # @return [Array<GlossaryItem>]
126
- def ex_glossary
127
- glossary = []
128
- glossary << GlossaryItem.new(@name, '角色名称')
129
- glossary << GlossaryItem.new(@nickname, '角色昵称')
130
- glossary
131
- end
132
-
133
- # 将所有的字符串替换为指定的字符串
134
- #
135
- # @param hash [Hash<String, String>] 字符串翻译表
136
- #
137
- # @return [void]
138
- def in_strings(hash)
139
- super(hash)
140
- @nickname = hash[@nickname] || @nickname
141
- end
142
-
143
- # 判断是否为空
144
- #
145
- # @return [Boolean]
146
- def empty?
147
- super && @nickname.to_s.empty?
148
- end
149
- end
150
-
151
- # 动画类
152
- class Animation
153
-
154
- # 在原始数组中的索引
155
- #
156
- # @return [Integer]
157
- attr_reader :index
158
-
159
- # 动画名称
160
- #
161
- # @return [String]
162
- attr_accessor :name
163
-
164
- # 用 RPG::Animation 初始化
165
- #
166
- # @param animation [RPG::Animation] 待处理的 RPG::Animation 对象
167
- # @param index [Integer] 在原始数组中的索引
168
- #
169
- # @return [R3EXS::Animation]
170
- def initialize(animation, index, _unused = nil)
171
- @index = index
172
- @name = animation.name
173
- end
174
-
175
- # 注入到 RPG::Animation 对象
176
- #
177
- # @param animation [RPG::Animation] 待注入的 RPG::Animation 对象
178
- #
179
- # @return [void]
180
- def inject_to(animation)
181
- animation.name = @name
182
- end
183
-
184
- # 提取所有的字符串
185
- #
186
- # @return [Array<String>]
187
- def ex_strings
188
- [@name]
189
- end
190
-
191
- # 将所有的字符串替换为指定的字符串
192
- #
193
- # @param hash [Hash<String, String>] 字符串翻译表
194
- #
195
- # @return [void]
196
- def in_strings(hash)
197
- @name = hash[@name] || @name
198
- end
199
-
200
- # 判断是否为空
201
- #
202
- # @return [Boolean]
203
- def empty?
204
- @name.to_s.empty?
205
- end
206
- end
207
-
208
- # 可装备物品类
209
- class EquipItem < BaseItem
210
-
211
- # RPG::EquipItem 初始化
212
- #
213
- # @param equipitem [RPG::EquipItem] 待处理的 RPG::EquipItem 对象
214
- # @param index [Integer] 在原始数组中的索引
215
- # @param with_note [Boolean] 是否处理 note 字段
216
- #
217
- # @return [R3EXS::EquipItem]
218
- def initialize(equipitem, index, with_note)
219
- super(equipitem, index, with_note)
220
- end
221
-
222
- # 注入到 RPG::EquipItem 对象
223
- #
224
- # @param equipitem [RPG::EquipItem] 待注入的 RPG::EquipItem 对象
225
- #
226
- # @return [void]
227
- def inject_to(equipitem)
228
- super
229
- end
230
-
231
- # 提取所有的字符串
232
- #
233
- # @return [Array<String>]
234
- def ex_strings
235
- super
236
- end
237
-
238
- # 将所有的字符串替换为指定的字符串
239
- #
240
- # @param hash [Hash<String, String>] 字符串翻译表
241
- #
242
- # @return [void]
243
- def in_strings(hash)
244
- super(hash)
245
- end
246
-
247
- # 判断是否为空
248
- #
249
- # @return [Boolean]
250
- def empty?
251
- super
252
- end
253
- end
254
-
255
- # 护甲类
256
- class Armor < EquipItem
257
-
258
- #RPG::Armor 初始化
259
- #
260
- # @param armor [RPG::Armor] 待处理的 RPG::Armor 对象
261
- # @param index [Integer] 在原始数组中的索引
262
- # @param with_note [Boolean] 是否处理 note 字段
263
- #
264
- # @return [R3EXS::Armor]
265
- def initialize(armor, index, with_note)
266
- super(armor, index, with_note)
267
- end
268
-
269
- # 注入到 RPG::Armor 对象
270
- #
271
- # @param armor [RPG::Armor] 待注入的 RPG::Armor 对象
272
- #
273
- # @return [void]
274
- def inject_to(armor)
275
- super
276
- end
277
-
278
- # 提取所有的字符串
279
- #
280
- # @return [Array<String>]
281
- def ex_strings
282
- super
283
- end
284
-
285
- # 提取术语表
286
- #
287
- # @return [Array<GlossaryItem>]
288
- def ex_glossary
289
- glossary = []
290
- glossary << GlossaryItem.new(@name, '护甲名称')
291
- glossary
292
- end
293
-
294
- # 将所有的字符串替换为指定的字符串
295
- #
296
- # @param hash [Hash<String, String>] 字符串翻译表
297
- #
298
- # @return [void]
299
- def in_strings(hash)
300
- super(hash)
301
- end
302
-
303
- # 判断是否为空
304
- #
305
- # @return [Boolean]
306
- def empty?
307
- super
308
- end
309
- end
310
-
311
- # 职业类
312
- class Class < BaseItem
313
-
314
- # 职业的学习技能列表
315
- #
316
- # @return [Array<R3EXS::Class::Learning>]
317
- attr_accessor :learnings
318
-
319
- # 学习技能类
320
- class Learning
321
-
322
- # 在原始数组中的索引
323
- #
324
- # @return [Integer]
325
- attr_reader :index
326
-
327
- # 学习技能注释
328
- #
329
- # @return [String]
330
- attr_accessor :note
331
-
332
- # RPG::Class::Learning 初始化
333
- #
334
- # @param learning [RPG::Class::Learning] 待处理的 RPG::Class::Learning 对象
335
- # @param index [Integer] 在原始数组中的索引
336
- #
337
- # @return [R3EXS::Class::Learning]
338
- def initialize(learning, index)
339
- @index = index
340
- @note = learning.note
341
- end
342
-
343
- # 注入到 RPG::Class::Learning 对象
344
- #
345
- # @param learning [RPG::Class::Learning] 待注入的 RPG::Class::Learning 对象
346
- #
347
- # @return [void]
348
- def inject_to(learning)
349
- learning.note = @note
350
- end
351
-
352
- # 提取所有的字符串
353
- #
354
- # @return [Array<String>]
355
- def ex_strings
356
- [@note]
357
- end
358
-
359
- # 将所有的字符串替换为指定的字符串
360
- #
361
- # @param hash [Hash<String, String>] 字符串翻译表
362
- #
363
- # @return [void]
364
- def in_strings(hash)
365
- @note = hash[@note] || @note
366
- end
367
-
368
- # 判断是否为空
369
- #
370
- # @return [Boolean]
371
- def empty?
372
- @note.to_s.empty?
373
- end
374
- end
375
-
376
- # 用 RPG::Class 初始化
377
- #
378
- # @param klass [RPG::Class] 待处理的 RPG::Class 对象
379
- # @param index [Integer] 在原始数组中的索引
380
- # @param with_note [Boolean] 是否处理 note 字段
381
- #
382
- # @return [R3EXS::Class]
383
- def initialize(klass, index, with_note)
384
- super(klass, index, with_note)
385
- @learnings = []
386
- klass.learnings.each_with_index do |learning, learning_index|
387
- next if learning == nil
388
- learning_r3exs = R3EXS::Class::Learning.new(learning, learning_index)
389
- @learnings << learning_r3exs unless learning_r3exs.empty?
390
- end
391
- self.remove_instance_variable(:@description)
392
- self.remove_instance_variable(:@learnings) unless with_note
393
- end
394
-
395
- # 注入到 RPG::Class 对象
396
- #
397
- # @param klass [RPG::Class] 待注入的 RPG::Class 对象
398
- #
399
- # @return [void]
400
- def inject_to(klass)
401
- super(klass)
402
- if self.instance_variable_defined?(:@learnings)
403
- @learnings.each do |learning|
404
- learning.inject_to(klass.learnings[learning.index])
405
- end
406
- end
407
- end
408
-
409
- # 提取所有的字符串
410
- #
411
- # @return [Array<String>]
412
- def ex_strings
413
- strings = super
414
- if self.instance_variable_defined?(:@learnings)
415
- @learnings.each do |learning|
416
- strings.concat(learning.ex_strings)
417
- end
418
- end
419
- strings
420
- end
421
-
422
- # 提取术语表
423
- #
424
- # @return [Array<GlossaryItem>]
425
- def ex_glossary
426
- glossary = []
427
- glossary << GlossaryItem.new(@name, '职业名称')
428
- glossary
429
- end
430
-
431
- # 将所有的字符串替换为指定的字符串
432
- #
433
- # @param hash [Hash<String, String>] 字符串翻译表
434
- #
435
- # @return [void]
436
- def in_strings(hash)
437
- super(hash)
438
- if self.instance_variable_defined?(:@learnings)
439
- @learnings.each do |learning|
440
- learning.in_strings(hash)
441
- end
442
- end
443
- end
444
-
445
- # 判断是否为空
446
- #
447
- # @return [Boolean]
448
- def empty?
449
- super && @learnings.to_a.empty?
450
- end
451
- end
452
-
453
- # 移动指令类
454
- class MoveCommand
455
-
456
- # 在原始数组中的索引
457
- #
458
- # @return [Integer]
459
- attr_accessor :index
460
-
461
- # 移动指令代码
462
- #
463
- # @return [Integer]
464
- attr_accessor :code
465
-
466
- # 移动指令用途
467
- #
468
- # @return [String]
469
- attr_accessor :usage
470
-
471
- # 移动指令参数
472
- #
473
- # @return [String]
474
- attr_accessor :parameter
475
-
476
- # 用 RPG::MoveCommand 初始化
477
- #
478
- # @param movecommand [RPG::MoveCommand] 待处理的 RPG::MoveCommand 对象
479
- # @param index [Integer] 在原始数组中的索引
480
- #
481
- # @return [R3EXS::MoveCommand]
482
- def initialize(movecommand, index)
483
- if movecommand.code == 45
484
- @index = index
485
- @code = 45
486
- @usage = 'MoveCommandScript'
487
- @parameter = movecommand.parameters[0]
488
- else
489
- @index = -1
490
- end
491
- end
492
-
493
- # 注入到 RPG::MoveCommand 对象
494
- #
495
- # @param movecommand [RPG::MoveCommand] 待注入的 RPG::MoveCommand 对象
496
- #
497
- # @return [void]
498
- def inject_to(movecommand)
499
- movecommand.parameters[0] = @parameter
500
- end
501
-
502
- # 提取所有的字符串
503
- #
504
- # @return [Array<String>]
505
- def ex_strings
506
- [@parameter]
507
- end
508
-
509
- # 将所有的字符串替换为指定的字符串
510
- #
511
- # @param hash [Hash<String, String>] 字符串翻译表
512
- #
513
- # @return [void]
514
- def in_strings(hash)
515
- @parameter = hash[@parameter] || @parameter
516
- end
517
-
518
- # 判断是否为空
519
- #
520
- # @return [Boolean]
521
- def empty?
522
- @index == -1
523
- end
524
- end
525
-
526
- # 移动路线类
527
- class MoveRoute
528
-
529
- # 移动指令列表
530
- #
531
- # @return [Array<R3EXS::MoveCommand>]
532
- attr_accessor :list
533
-
534
- # 用 RPG::MoveRoute 初始化
535
- #
536
- # @param moveroute [RPG::MoveRoute] 待处理的 RPG::MoveRoute 对象
537
- #
538
- # @return [R3EXS::MoveRoute]
539
- def initialize(moveroute)
540
- @list = []
541
- moveroute.list.each_with_index do |movecommand, index|
542
- next if movecommand == nil
543
- movecommand_r3exs = R3EXS::MoveCommand.new(movecommand, index)
544
- @list << movecommand_r3exs unless movecommand_r3exs.empty?
545
- end
546
- end
547
-
548
- # 注入到 RPG::MoveRoute 对象
549
- #
550
- # @param moveroute [RPG::MoveRoute] 待注入的 RPG::MoveRoute 对象
551
- #
552
- # @return [void]
553
- def inject_to(moveroute)
554
- @list.each do |movecommand|
555
- movecommand.inject_to(moveroute.list[movecommand.index])
556
- end
557
- end
558
-
559
- # 提取所有的字符串
560
- #
561
- # @return [Array<String>]
562
- def ex_strings
563
- strings = []
564
- @list.each do |movecommand|
565
- strings.concat(movecommand.ex_strings)
566
- end
567
- strings
568
- end
569
-
570
- # 将所有的字符串替换为指定的字符串
571
- #
572
- # @param hash [Hash<String, String>] 字符串翻译表
573
- #
574
- # @return [void]
575
- def in_strings(hash)
576
- @list.each do |movecommand|
577
- movecommand.in_strings(hash)
578
- end
579
- end
580
-
581
- # 判断是否为空
582
- #
583
- # @return [Boolean]
584
- def empty?
585
- @list.empty?
586
- end
587
- end
588
-
589
- # 事件指令类
590
- class EventCommand
591
-
592
- # 在原始数组中的索引
593
- #
594
- # @return [Integer]
595
- attr_accessor :index
596
-
597
- # 事件指令代码
598
- #
599
- # @return [Integer]
600
- attr_accessor :code
601
-
602
- # 事件指令用途
603
- #
604
- # @return [String]
605
- attr_accessor :usage
606
-
607
- # 事件指令参数
608
- #
609
- # @note 当 '@code' 为 102 时, parameter 是一个字符串数组
610
- #
611
- # @return [String] if @code != 102
612
- # @return [Array<String>] if @code == 102
613
- attr_accessor :parameter
614
-
615
- # RPG::EventCommand 初始化
616
- #
617
- # @param eventcommand [RPG::EventCommand] 待处理的 RPG::EventCommand 对象
618
- # @param index [Integer] 在原始数组中的索引
619
- #
620
- # @return [R3EXS::EventCommand]
621
- def initialize(eventcommand, index)
622
- case eventcommand.code
623
- when 102 # ShowChoices
624
- @index = index
625
- @code = 102
626
- @usage = Utils::EVENT_COMMANDS[102]
627
- @parameter = eventcommand.parameters[0]
628
- when 108 # Comment
629
- @index = index
630
- @code = 108
631
- @usage = Utils::EVENT_COMMANDS[108]
632
- @parameter = eventcommand.parameters[0]
633
- when 111 # ConditionalBranch
634
- @index = index
635
- @code = 111
636
- @usage = Utils::EVENT_COMMANDS[111]
637
- if eventcommand.parameters[0] == 4 && eventcommand.parameters[2] == 1
638
- @parameter = eventcommand.parameters[3]
639
- elsif eventcommand.parameters[0] == 12
640
- @parameter = eventcommand.parameters[1]
641
- else
642
- @index = -1
643
- end
644
- when 118 # Label
645
- @index = index
646
- @code = 118
647
- @usage = Utils::EVENT_COMMANDS[118]
648
- @parameter = eventcommand.parameters[0]
649
- when 119 # JumpToLabel
650
- @index = index
651
- @code = 119
652
- @usage = Utils::EVENT_COMMANDS[119]
653
- @parameter = eventcommand.parameters[0]
654
- when 122 # ControlVariables
655
- if eventcommand.parameters[3] == 4
656
- @index = index
657
- @code = 122
658
- @usage = Utils::EVENT_COMMANDS[122]
659
- @parameter = eventcommand.parameters[4]
660
- else
661
- @index = -1
662
- end
663
- when 205 # SetMoveRoute
664
- moveroute_r3exs = R3EXS::MoveRoute.new(eventcommand.parameters[1])
665
- if moveroute_r3exs.empty?
666
- @index = -1 # 如果 MoveRoute 里面没有可提取的 MoveCommand ,就将索引设为-1,empty? 将据此判断是否为空
667
- else
668
- @index = index
669
- @code = 205
670
- @usage = Utils::EVENT_COMMANDS[205]
671
- @parameter = moveroute_r3exs
672
- end
673
- when 320 # ChangeActorName
674
- @index = index
675
- @code = 320
676
- @usage = Utils::EVENT_COMMANDS[320]
677
- @parameter = eventcommand.parameters[1]
678
- when 324 # ChangeActorNickname
679
- @index = index
680
- @code = 324
681
- @usage = Utils::EVENT_COMMANDS[324]
682
- @parameter = eventcommand.parameters[1]
683
- when 355 # Script
684
- @index = index
685
- @code = 355
686
- @usage = Utils::EVENT_COMMANDS[355]
687
- @parameter = eventcommand.parameters[0]
688
- when 401 # ShowText
689
- @index = index
690
- @code = 401
691
- @usage = Utils::EVENT_COMMANDS[401]
692
- @parameter = eventcommand.parameters[0]
693
- when 402 # When
694
- @index = index
695
- @code = 402
696
- @usage = Utils::EVENT_COMMANDS[402]
697
- @parameter = eventcommand.parameters[1]
698
- when 405 # ShowScrollingText
699
- @index = index
700
- @code = 405
701
- @usage = Utils::EVENT_COMMANDS[405]
702
- @parameter = eventcommand.parameters[0]
703
- when 408 # CommentMore
704
- @index = index
705
- @code = 408
706
- @usage = Utils::EVENT_COMMANDS[408]
707
- @parameter = eventcommand.parameters[0]
708
- when 505 # MoveRoute
709
- movecommand_r3exs = R3EXS::MoveCommand.new(eventcommand.parameters[0], 0)
710
- if movecommand_r3exs.empty?
711
- @index = -1
712
- else
713
- @index = index
714
- @code = 505
715
- @usage = Utils::EVENT_COMMANDS[505]
716
- @parameter = movecommand_r3exs
717
- end
718
- when 655 # ScriptMore
719
- @index = index
720
- @code = 655
721
- @usage = Utils::EVENT_COMMANDS[655]
722
- @parameter = eventcommand.parameters[0]
723
- else
724
- @index = -1 # 如果不是以上的事件指令,就将索引设为-1,empty? 将据此判断是否为空
725
- end
726
- end
727
-
728
- # 注入到 RPG::EventCommand 对象
729
- #
730
- # @param eventcommand [RPG::EventCommand] 待注入的 RPG::EventCommand 对象
731
- #
732
- # @return [void]
733
- def inject_to(eventcommand)
734
- case eventcommand.code
735
- when 102 # ShowChoices
736
- eventcommand.parameters[0] = @parameter
737
- when 108 # Comment
738
- eventcommand.parameters[0] = @parameter
739
- when 111 # ConditionalBranch
740
- if eventcommand.parameters[0] == 4 && eventcommand.parameters[2] == 1
741
- eventcommand.parameters[3] = @parameter
742
- elsif eventcommand.parameters[0] == 12
743
- eventcommand.parameters[1] = @parameter
744
- end
745
- when 118 # Label
746
- eventcommand.parameters[0] = @parameter
747
- when 119 # JumpToLabel
748
- eventcommand.parameters[0] = @parameter
749
- when 122 # ControlVariables
750
- eventcommand.parameters[4] = @parameter
751
- when 205 # SetMoveRoute
752
- @parameter.inject_to(eventcommand.parameters[1])
753
- when 320 # ChangeActorName
754
- eventcommand.parameters[1] = @parameter
755
- when 324 # ChangeActorNickname
756
- eventcommand.parameters[1] = @parameter
757
- when 355 # Script
758
- eventcommand.parameters[0] = @parameter
759
- when 401 # ShowText
760
- eventcommand.parameters[0] = @parameter
761
- when 402 # When
762
- eventcommand.parameters[1] = @parameter
763
- when 405 # ShowScrollingText
764
- eventcommand.parameters[0] = @parameter
765
- when 408 # CommentMore
766
- eventcommand.parameters[0] = @parameter
767
- when 505 # MoveRoute
768
- @parameter.inject_to(eventcommand.parameters[0])
769
- when 655 # ScriptMore
770
- eventcommand.parameters[0] = @parameter
771
- else
772
- puts "Unknown code: #{eventcommand.code}"
773
- end
774
- end
775
-
776
- # 提取所有的字符串
777
- #
778
- # @return [Array<String>]
779
- def ex_strings
780
- case @code
781
- when 102 # ShowChoices 是一个特殊的事件指令,它的参数是一个数组
782
- @parameter
783
- when 108, 111, 118, 119, 122, 320, 324, 355, 401, 402, 405, 408, 655
784
- [@parameter]
785
- when 205
786
- @parameter.ex_strings
787
- when 505
788
- @parameter.ex_strings
789
- else
790
- puts "Unknown code: #{@code}"
791
- []
792
- end
793
- end
794
-
795
- # 将所有的字符串替换为指定的字符串
796
- #
797
- # @param hash [Hash<String, String>] 字符串翻译表
798
- #
799
- # @return [void]
800
- def in_strings(hash)
801
- case @code
802
- when 102 # ShowChoices 是一个特殊的事件指令,它的参数是一个数组
803
- @parameter.map! { |string| hash[string] || string }
804
- when 108, 111, 118, 119, 122, 320, 324, 355, 401, 402, 405, 408, 655
805
- @parameter = hash[@parameter] || @parameter
806
- when 205
807
- @parameter.in_strings(hash)
808
- when 505
809
- @parameter.in_strings(hash)
810
- else
811
- puts "Unknown code: #{@code}"
812
- end
813
- end
814
-
815
- # 判断是否为空
816
- #
817
- # @return [Boolean]
818
- def empty?
819
- @index == -1
820
- end
821
- end
822
-
823
- # 公共事件类
824
- class CommonEvent
825
-
826
- # 在原始数组中的索引
827
- #
828
- # @return [Integer]
829
- attr_accessor :index
830
-
831
- # 公共事件名称
832
- #
833
- # @return [String]
834
- attr_accessor :name
835
-
836
- # 事件指令列表
837
- #
838
- # @return [Array<R3EXS::EventCommand>]
839
- attr_accessor :list
840
-
841
- # 用 RPG::CommonEvent 初始化
842
- #
843
- # @param commonevent [RPG::CommonEvent] 待处理的 RPG::CommonEvent 对象
844
- # @param index [Integer] 在原始数组中的索引
845
- #
846
- # @return [R3EXS::CommonEvent]
847
- def initialize(commonevent, index, _unused = nil)
848
- @index = index
849
- @name = commonevent.name
850
- @list = []
851
- commonevent.list.each_with_index do |eventcommand, eventcommand_index|
852
- next if eventcommand == nil
853
- eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
854
- @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
855
- end
856
- end
857
-
858
- # 注入到 RPG::CommonEvent 对象
859
- #
860
- # @param commonevent [RPG::CommonEvent] 待注入的 RPG::CommonEvent 对象
861
- #
862
- # @return [void]
863
- def inject_to(commonevent)
864
- commonevent.name = @name
865
- @list.each do |eventcommand|
866
- eventcommand.inject_to(commonevent.list[eventcommand.index])
867
- end
868
- end
869
-
870
- # 提取所有的字符串
871
- #
872
- # @return [Array<String>]
873
- def ex_strings
874
- strings = [@name]
875
- @list.each do |eventcommand|
876
- strings.concat(eventcommand.ex_strings)
877
- end
878
- strings
879
- end
880
-
881
- # 将所有的字符串替换为指定的字符串
882
- #
883
- # @param hash [Hash<String, String>] 字符串翻译表
884
- #
885
- # @return [void]
886
- def in_strings(hash)
887
- @name = hash[@name] || @name
888
- @list.each do |eventcommand|
889
- eventcommand.in_strings(hash)
890
- end
891
- end
892
-
893
- # 判断是否为空
894
- #
895
- # @return [Boolean]
896
- def empty?
897
- @name.to_s.empty? && @list.empty?
898
- end
899
- end
900
-
901
- # 敌人类
902
- class Enemy < BaseItem
903
-
904
- # 用 RPG::Enemy 初始化
905
- #
906
- # @param enemy [RPG::Enemy] 待处理的 RPG::Enemy 对象
907
- # @param index [Integer] 在原始数组中的索引
908
- # @param with_note [Boolean] 是否处理 note 字段
909
- #
910
- # @return [R3EXS::Enemy]
911
- def initialize(enemy, index, with_note)
912
- super(enemy, index, with_note)
913
- self.remove_instance_variable(:@description)
914
- end
915
-
916
- # 注入到 RPG::Enemy 对象
917
- #
918
- # @param enemy [RPG::Enemy] 待注入的 RPG::Enemy 对象
919
- #
920
- # @return [void]
921
- def inject_to(enemy)
922
- super
923
- end
924
-
925
- # 提取所有的字符串
926
- #
927
- # @return [Array<String>]
928
- def ex_strings
929
- super
930
- end
931
-
932
- # 提取术语表
933
- #
934
- # @return [Array<GlossaryItem>]
935
- def ex_glossary
936
- glossary = []
937
- glossary << GlossaryItem.new(@name, '敌人名称')
938
- glossary
939
- end
940
-
941
- # 将所有的字符串替换为指定的字符串
942
- #
943
- # @param hash [Hash<String, String>] 字符串翻译表
944
- #
945
- # @return [void]
946
- def in_strings(hash)
947
- super(hash)
948
- end
949
-
950
- # 判断是否为空
951
- #
952
- # @return [Boolean]
953
- def empty?
954
- super
955
- end
956
- end
957
-
958
- # 可使用物品类
959
- class UsableItem < BaseItem
960
-
961
- # RPG::UsableItem 初始化
962
- #
963
- # @param usableitem [RPG::UsableItem] 待处理的 RPG::UsableItem 对象
964
- # @param index [Integer] 在原始数组中的索引
965
- # @param with_note [Boolean] 是否处理 note 字段
966
- #
967
- # @return [R3EXS::UsableItem]
968
- def initialize(usableitem, index, with_note)
969
- super(usableitem, index, with_note)
970
- end
971
-
972
- # 注入到 RPG::UsableItem 对象
973
- #
974
- # @param usableitem [RPG::UsableItem] 待注入的 RPG::UsableItem 对象
975
- #
976
- # @return [void]
977
- def inject_to(usableitem)
978
- super
979
- end
980
-
981
- # 提取所有的字符串
982
- #
983
- # @return [Array<String>]
984
- def ex_strings
985
- super
986
- end
987
-
988
- # 将所有的字符串替换为指定的字符串
989
- #
990
- # @param hash [Hash<String, String>] 字符串翻译表
991
- #
992
- # @return [void]
993
- def in_strings(hash)
994
- super(hash)
995
- end
996
-
997
- # 判断是否为空
998
- #
999
- # @return [Boolean]
1000
- def empty?
1001
- super
1002
- end
1003
- end
1004
-
1005
- # 物品类
1006
- class Item < UsableItem
1007
-
1008
- # 用 RPG::Item 初始化
1009
- #
1010
- # @param item [RPG::Item] 待处理的 RPG::Item 对象
1011
- # @param index [Integer] 在原始数组中的索引
1012
- # @param with_note [Boolean] 是否处理 note 字段
1013
- #
1014
- # @return [R3EXS::Item]
1015
- def initialize(item, index, with_note)
1016
- super(item, index, with_note)
1017
- end
1018
-
1019
- # 注入到 RPG::Item 对象
1020
- #
1021
- # @param item [RPG::Item] 待注入的 RPG::Item 对象
1022
- #
1023
- # @return [void]
1024
- def inject_to(item)
1025
- super
1026
- end
1027
-
1028
- # 提取所有的字符串
1029
- #
1030
- # @return [Array<String>]
1031
- def ex_strings
1032
- super
1033
- end
1034
-
1035
- # 提取术语表
1036
- #
1037
- # @return [Array<GlossaryItem>]
1038
- def ex_glossary
1039
- glossary = []
1040
- glossary << GlossaryItem.new(@name, '物品名称')
1041
- glossary
1042
- end
1043
-
1044
- # 将所有的字符串替换为指定的字符串
1045
- #
1046
- # @param hash [Hash<String, String>] 字符串翻译表
1047
- #
1048
- # @return [void]
1049
- def in_strings(hash)
1050
- super(hash)
1051
- end
1052
-
1053
- # 判断是否为空
1054
- #
1055
- # @return [Boolean]
1056
- def empty?
1057
- super
1058
- end
1059
- end
1060
-
1061
- # 事件类
1062
- class Event
1063
-
1064
- # 在原始哈希表中的键
1065
- #
1066
- # @return [Integer]
1067
- attr_accessor :index
1068
-
1069
- # 事件名称
1070
- #
1071
- # @return [String]
1072
- attr_accessor :name
1073
-
1074
- # 事件页列表
1075
- #
1076
- # @return [Array<R3EXS::Event::Page>]
1077
- attr_accessor :pages
1078
-
1079
- # 事件页类
1080
- class Page
1081
-
1082
- # 在原始数组中的索引
1083
- #
1084
- # @return [Integer]
1085
- attr_accessor :index
1086
-
1087
- # 事件指令列表
1088
- #
1089
- # @return [Array<R3EXS::EventCommand>]
1090
- attr_accessor :list
1091
-
1092
- # RPG::Event::Page 初始化
1093
- #
1094
- # @param page [RPG::Event::Page] 待处理的 RPG::Event::Page 对象
1095
- # @param index [Integer] 在原始数组中的索引
1096
- #
1097
- # @return [R3EXS::Event::Page]
1098
- def initialize(page, index)
1099
- @index = index
1100
- @list = []
1101
- page.list.each_with_index do |eventcommand, eventcommand_index|
1102
- next if eventcommand == nil
1103
- eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
1104
- @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
1105
- end
1106
- end
1107
-
1108
- # 注入到 RPG::Event::Page 对象
1109
- #
1110
- # @param page [RPG::Event::Page] 待注入的 RPG::Event::Page 对象
1111
- #
1112
- # @return [void]
1113
- def inject_to(page)
1114
- @list.each do |eventcommand|
1115
- eventcommand.inject_to(page.list[eventcommand.index])
1116
- end
1117
- end
1118
-
1119
- # 提取所有的字符串
1120
- #
1121
- # @return [Array<String>]
1122
- def ex_strings
1123
- strings = []
1124
- @list.each do |eventcommand|
1125
- strings.concat(eventcommand.ex_strings)
1126
- end
1127
- strings
1128
- end
1129
-
1130
- # 将所有的字符串替换为指定的字符串
1131
- #
1132
- # @param hash [Hash<String, String>] 字符串翻译表
1133
- #
1134
- # @return [void]
1135
- def in_strings(hash)
1136
- @list.each do |eventcommand|
1137
- eventcommand.in_strings(hash)
1138
- end
1139
- end
1140
-
1141
- # 判断是否为空
1142
- #
1143
- # @return [Boolean]
1144
- def empty?
1145
- @list.empty?
1146
- end
1147
- end
1148
-
1149
- # 用 RPG::Event 初始化
1150
- #
1151
- # @param event [RPG::Event] 待处理的 RPG::Event 对象
1152
- # @param index [Integer] 在原始哈希表中的键
1153
- #
1154
- # @return [R3EXS::Event]
1155
- def initialize(event, index)
1156
- @index = index
1157
- @name = event.name
1158
- @pages = []
1159
- event.pages.each_with_index do |page, page_index|
1160
- next if page == nil
1161
- page_r3exs = R3EXS::Event::Page.new(page, page_index)
1162
- @pages << page_r3exs unless page_r3exs.empty?
1163
- end
1164
- end
1165
-
1166
- # 注入到 RPG::Event 对象
1167
- #
1168
- # @param event [RPG::Event] 待注入的 RPG::Event 对象
1169
- #
1170
- # @return [void]
1171
- def inject_to(event)
1172
- event.name = @name
1173
- @pages.each do |page|
1174
- page.inject_to(event.pages[page.index])
1175
- end
1176
- end
1177
-
1178
- # 提取所有的字符串
1179
- #
1180
- # @return [Array<String>]
1181
- def ex_strings
1182
- strings = [@name]
1183
- @pages.each do |page|
1184
- strings.concat(page.ex_strings)
1185
- end
1186
- strings
1187
- end
1188
-
1189
- # 将所有的字符串替换为指定的字符串
1190
- #
1191
- # @param hash [Hash<String, String>] 字符串翻译表
1192
- #
1193
- # @return [void]
1194
- def in_strings(hash)
1195
- @name = hash[@name] || @name
1196
- @pages.each do |page|
1197
- page.in_strings(hash)
1198
- end
1199
- end
1200
-
1201
- # 判断是否为空
1202
- #
1203
- # @return [Boolean]
1204
- def empty?
1205
- @name.to_s.empty? && @pages.empty?
1206
- end
1207
- end
1208
-
1209
- # 地图类
1210
- class Map
1211
-
1212
- # 地图显示名称
1213
- #
1214
- # @return [String]
1215
- attr_accessor :display_name
1216
-
1217
- # 地图注释
1218
- #
1219
- # @return [String]
1220
- attr_accessor :note
1221
-
1222
- # 事件列表
1223
- #
1224
- # @return [Array<R3EXS::Event>]
1225
- attr_accessor :events
1226
-
1227
- # RPG::Map 初始化
1228
- #
1229
- # @param map [RPG::Map] 待处理的 RPG::Map 对象
1230
- # @param with_note [Boolean] 是否处理 note 字段
1231
- #
1232
- # @return [R3EXS::Map]
1233
- def initialize(map, with_note)
1234
- @display_name = map.display_name
1235
- @note = map.note
1236
- @events = []
1237
- map.events.each do |key, event|
1238
- next if event == nil
1239
- event_r3exs = R3EXS::Event.new(event, key)
1240
- @events << event_r3exs unless event_r3exs.empty?
1241
- end
1242
- self.remove_instance_variable(:@note) unless with_note
1243
- end
1244
-
1245
- # 注入到 RPG::Map 对象
1246
- #
1247
- # @param map [RPG::Map] 待注入的 RPG::Map 对象
1248
- #
1249
- # @return [void]
1250
- def inject_to(map)
1251
- map.display_name = @display_name
1252
- map.note = @note if self.instance_variable_defined?(:@note)
1253
- @events.each do |event|
1254
- event.inject_to(map.events[event.index])
1255
- end
1256
- end
1257
-
1258
- # 提取所有的字符串
1259
- #
1260
- # @return [Array<String>]
1261
- def ex_strings
1262
- strings = []
1263
- strings << @display_name
1264
- strings << @note if self.instance_variable_defined?(:@note)
1265
- @events.each do |event|
1266
- strings.concat(event.ex_strings)
1267
- end
1268
- strings
1269
- end
1270
-
1271
- # 提取术语表
1272
- #
1273
- # @return [Array<GlossaryItem>]
1274
- def ex_glossary
1275
- glossary = []
1276
- glossary << GlossaryItem.new(@display_name, '地图名称')
1277
- glossary
1278
- end
1279
-
1280
- # 将所有的字符串替换为指定的字符串
1281
- #
1282
- # @param hash [Hash<String, String>] 字符串翻译表
1283
- #
1284
- # @return [void]
1285
- def in_strings(hash)
1286
- @display_name = hash[@display_name] || @display_name
1287
- @note = hash[@note] || @note if self.instance_variable_defined?(:@note)
1288
- @events.each do |event|
1289
- event.in_strings(hash)
1290
- end
1291
- end
1292
- end
1293
-
1294
- # 地图信息类
1295
- class MapInfo
1296
-
1297
- # 在原始哈希表中的键
1298
- #
1299
- # @return [Integer]
1300
- attr_accessor :index
1301
-
1302
- # 地图内部名称
1303
- #
1304
- # @return [String]
1305
- attr_accessor :name
1306
-
1307
- # 用 RPG::MapInfo 初始化
1308
- #
1309
- # @param mapinfo [RPG::MapInfo] 待处理的 RPG::MapInfo 对象
1310
- # @param index [Integer] 在原始哈希表中的键
1311
- #
1312
- # @return [R3EXS::MapInfo]
1313
- def initialize(mapinfo, index, _unused = nil)
1314
- @index = index
1315
- @name = mapinfo.name
1316
- end
1317
-
1318
- # 注入到 RPG::MapInfo 对象
1319
- #
1320
- # @param mapinfo [RPG::MapInfo] 待注入的 RPG::MapInfo 对象
1321
- #
1322
- # @return [void]
1323
- def inject_to(mapinfo)
1324
- mapinfo.name = @name
1325
- end
1326
-
1327
- # 提取所有的字符串
1328
- #
1329
- # @return [Array<String>]
1330
- def ex_strings
1331
- [@name]
1332
- end
1333
-
1334
- # 提取术语表
1335
- #
1336
- # @return [Array<GlossaryItem>]
1337
- def ex_glossary
1338
- glossary = []
1339
- glossary << GlossaryItem.new(@name, '地图名称')
1340
- glossary
1341
- end
1342
-
1343
- # 将所有的字符串替换为指定的字符串
1344
- #
1345
- # @param hash [Hash<String, String>] 字符串翻译表
1346
- #
1347
- # @return [void]
1348
- def in_strings(hash)
1349
- @name = hash[@name] || @name
1350
- end
1351
- end
1352
-
1353
- # 技能类
1354
- class Skill < UsableItem
1355
-
1356
- # 技能使用时的消息
1357
- #
1358
- # @return [String]
1359
- attr_accessor :message1
1360
-
1361
- # 技能使用时的消息
1362
- #
1363
- # @return [String]
1364
- attr_accessor :message2
1365
-
1366
- # 用 RPG::Skill 初始化
1367
- #
1368
- # @param skill [RPG::Skill] 待处理的 RPG::Skill 对象
1369
- # @param index [Integer] 在原始数组中的索引
1370
- # @param with_note [Boolean] 是否处理 note 字段
1371
- #
1372
- # @return [R3EXS::Skill]
1373
- def initialize(skill, index, with_note)
1374
- super(skill, index, with_note)
1375
- @message1 = skill.message1
1376
- @message2 = skill.message2
1377
- end
1378
-
1379
- # 注入到 RPG::Skill 对象
1380
- #
1381
- # @param skill [RPG::Skill] 待注入的 RPG::Skill 对象
1382
- #
1383
- # @return [void]
1384
- def inject_to(skill)
1385
- super
1386
- skill.message1 = @message1
1387
- skill.message2 = @message2
1388
- end
1389
-
1390
- # 提取所有的字符串
1391
- #
1392
- # @return [Array<String>]
1393
- def ex_strings
1394
- strings = super
1395
- strings << @message1
1396
- strings << @message2
1397
- strings
1398
- end
1399
-
1400
- # 提取术语表
1401
- #
1402
- # @return [Array<GlossaryItem>]
1403
- def ex_glossary
1404
- glossary = []
1405
- glossary << GlossaryItem.new(@name, '技能名称')
1406
- glossary
1407
- end
1408
-
1409
- # 将所有的字符串替换为指定的字符串
1410
- #
1411
- # @param hash [Hash<String, String>] 字符串翻译表
1412
- #
1413
- # @return [void]
1414
- def in_strings(hash)
1415
- super(hash)
1416
- @message1 = hash[@message1] || @message1
1417
- @message2 = hash[@message2] || @message2
1418
- end
1419
-
1420
- # 判断是否为空
1421
- #
1422
- # @return [Boolean]
1423
- def empty?
1424
- super && @message1.to_s.empty? && @message2.to_s.empty?
1425
- end
1426
- end
1427
-
1428
- # 状态类
1429
- class State < BaseItem
1430
-
1431
- # 状态应用队员时的消息
1432
- #
1433
- # @return [String]
1434
- attr_accessor :message1
1435
-
1436
- # 状态应用敌人时的消息
1437
- #
1438
- # @return [String]
1439
- attr_accessor :message2
1440
-
1441
- # 状态保持时的消息
1442
- #
1443
- # @return [String]
1444
- attr_accessor :message3
1445
-
1446
- # 状态解除时的消息
1447
- #
1448
- # @return [String]
1449
- attr_accessor :message4
1450
-
1451
- # RPG::State 初始化
1452
- #
1453
- # @param state [RPG::State] 待处理的 RPG::State 对象
1454
- # @param index [Integer] 在原始数组中的索引
1455
- # @param with_note [Boolean] 是否处理 note 字段
1456
- #
1457
- # @return [R3EXS::State]
1458
- def initialize(state, index, with_note)
1459
- super(state, index, with_note)
1460
- @message1 = state.message1
1461
- @message2 = state.message2
1462
- @message3 = state.message3
1463
- @message4 = state.message4
1464
- self.remove_instance_variable(:@description)
1465
- end
1466
-
1467
- # 注入到 RPG::State 对象
1468
- #
1469
- # @param state [RPG::State] 待注入的 RPG::State 对象
1470
- #
1471
- # @return [void]
1472
- def inject_to(state)
1473
- super
1474
- state.message1 = @message1
1475
- state.message2 = @message2
1476
- state.message3 = @message3
1477
- state.message4 = @message4
1478
- end
1479
-
1480
- # 提取所有的字符串
1481
- #
1482
- # @return [Array<String>]
1483
- def ex_strings
1484
- strings = super
1485
- strings << @message1
1486
- strings << @message2
1487
- strings << @message3
1488
- strings << @message4
1489
- strings
1490
- end
1491
-
1492
- # 提取术语表
1493
- #
1494
- # @return [Array<GlossaryItem>]
1495
- def ex_glossary
1496
- glossary = []
1497
- glossary << GlossaryItem.new(@name, '状态名称')
1498
- glossary
1499
- end
1500
-
1501
- # 将所有的字符串替换为指定的字符串
1502
- #
1503
- # @param hash [Hash<String, String>] 字符串翻译表
1504
- #
1505
- # @return [void]
1506
- def in_strings(hash)
1507
- super(hash)
1508
- @message1 = hash[@message1] || @message1
1509
- @message2 = hash[@message2] || @message2
1510
- @message3 = hash[@message3] || @message3
1511
- @message4 = hash[@message4] || @message4
1512
- end
1513
-
1514
- # 判断是否为空
1515
- #
1516
- # @return [Boolean]
1517
- def empty?
1518
- super && @message1.to_s.empty? && @message2.to_s.empty? && @message3.to_s.empty? && @message4.to_s.empty?
1519
- end
1520
- end
1521
-
1522
- # 系统类
1523
- class System
1524
-
1525
- # 游戏标题
1526
- #
1527
- # @return [String]
1528
- attr_accessor :game_title
1529
-
1530
- # 货币单位
1531
- #
1532
- # @return [String]
1533
- attr_accessor :currency_unit
1534
-
1535
- # 属性名称
1536
- #
1537
- # @return [Array<String>]
1538
- attr_accessor :elements
1539
-
1540
- # 技能类型名称
1541
- #
1542
- # @return [Array<String>]
1543
- attr_accessor :skill_types
1544
-
1545
- # 武器类型名称
1546
- #
1547
- # @return [Array<String>]
1548
- attr_accessor :weapon_types
1549
-
1550
- # 防具类型名称
1551
- #
1552
- # @return [Array<String>]
1553
- attr_accessor :armor_types
1554
-
1555
- # 开关名称
1556
- #
1557
- # @return [Array<String>]
1558
- attr_accessor :switches
1559
-
1560
- # 变量名称
1561
- #
1562
- # @return [Array<String>]
1563
- attr_accessor :variables
1564
-
1565
- # 系统术语
1566
- #
1567
- # @return [R3EXS::System::Terms]
1568
- attr_accessor :terms
1569
-
1570
- # 术语类
1571
- class Terms
1572
-
1573
- # 基本术语
1574
- #
1575
- # @return [Array<String>]
1576
- attr_accessor :basic
1577
-
1578
- # 属性名称
1579
- #
1580
- # @return [Array<String>]
1581
- attr_accessor :params
1582
-
1583
- # 装备类型名称
1584
- #
1585
- # @return [Array<String>]
1586
- attr_accessor :etypes
1587
-
1588
- # 命令名称
1589
- #
1590
- # @return [Array<String>]
1591
- attr_accessor :commands
1592
-
1593
- # 用 RPG::System::Terms 初始化
1594
- #
1595
- # @param terms [RPG::System::Terms] 待处理的 RPG::System::Terms 对象
1596
- #
1597
- # @return [R3EXS::System::Terms]
1598
- def initialize(terms)
1599
- @basic = terms.basic
1600
- @params = terms.params
1601
- @etypes = terms.etypes
1602
- @commands = terms.commands
1603
- end
1604
-
1605
- # 注入到 RPG::System::Terms 对象
1606
- #
1607
- # @param terms [RPG::System::Terms] 待注入的 RPG::System::Terms 对象
1608
- #
1609
- # @return [void]
1610
- def inject_to(terms)
1611
- terms.basic = @basic
1612
- terms.params = @params
1613
- terms.etypes = @etypes
1614
- terms.commands = @commands
1615
- end
1616
-
1617
- # 提取所有的字符串
1618
- #
1619
- # @return [Array<String>]
1620
- def ex_strings
1621
- strings = []
1622
- strings.concat(@basic)
1623
- strings.concat(@params)
1624
- strings.concat(@etypes)
1625
- strings.concat(@commands)
1626
- strings
1627
- end
1628
-
1629
- # 提取术语表
1630
- #
1631
- # @return [Array<GlossaryItem>]
1632
- def ex_glossary
1633
- glossary = []
1634
- @basic.each do |string|
1635
- glossary << GlossaryItem.new(string, '基本术语')
1636
- end
1637
- @params.each do |string|
1638
- glossary << GlossaryItem.new(string, '计量单位名称')
1639
- end
1640
- @etypes.each do |string|
1641
- glossary << GlossaryItem.new(string, '装备类型名称')
1642
- end
1643
- @commands.each do |string|
1644
- glossary << GlossaryItem.new(string, '指令名称')
1645
- end
1646
- glossary
1647
- end
1648
-
1649
- # 将所有的字符串替换为指定的字符串
1650
- #
1651
- # @param hash [Hash<String, String>] 字符串翻译表
1652
- #
1653
- # @return [void]
1654
- def in_strings(hash)
1655
- @basic.map! { |string| hash[string] || string }
1656
- @params.map! { |string| hash[string] || string }
1657
- @etypes.map! { |string| hash[string] || string }
1658
- @commands.map! { |string| hash[string] || string }
1659
- end
1660
- end
1661
-
1662
- # 用 RPG::System 初始化
1663
- #
1664
- # @param system [RPG::System] 待处理的 RPG::System 对象
1665
- #
1666
- # @return [R3EXS::System]
1667
- def initialize(system, _unused = nil)
1668
- @game_title = system.game_title
1669
- @currency_unit = system.currency_unit
1670
- @elements = system.elements
1671
- @skill_types = system.skill_types
1672
- @weapon_types = system.weapon_types
1673
- @armor_types = system.armor_types
1674
- @switches = system.switches
1675
- @variables = system.variables
1676
- @terms = R3EXS::System::Terms.new(system.terms)
1677
- end
1678
-
1679
- # 注入到 RPG::System 对象
1680
- #
1681
- # @param system [RPG::System] 待注入的 RPG::System 对象
1682
- #
1683
- # @return [void]
1684
- def inject_to(system)
1685
- system.game_title = @game_title
1686
- system.currency_unit = @currency_unit
1687
- system.elements = @elements
1688
- system.skill_types = @skill_types
1689
- system.weapon_types = @weapon_types
1690
- system.armor_types = @armor_types
1691
- system.switches = @switches
1692
- system.variables = @variables
1693
- @terms.inject_to(system.terms)
1694
- end
1695
-
1696
- # 提取所有的字符串
1697
- #
1698
- # @return [Array<String>]
1699
- def ex_strings
1700
- strings = []
1701
- strings << @game_title
1702
- strings << @currency_unit
1703
- strings.concat(@elements)
1704
- strings.concat(@skill_types)
1705
- strings.concat(@weapon_types)
1706
- strings.concat(@armor_types)
1707
- strings.concat(@switches)
1708
- strings.concat(@variables)
1709
- strings.concat(@terms.ex_strings)
1710
- strings
1711
- end
1712
-
1713
- # 提取术语表
1714
- #
1715
- # @return [Array<GlossaryItem>]
1716
- def ex_glossary
1717
- glossary = []
1718
- glossary << GlossaryItem.new(@game_title, '游戏标题')
1719
- glossary << GlossaryItem.new(@currency_unit, '货币单位')
1720
- @elements.each do |element|
1721
- glossary << GlossaryItem.new(element, '属性名称')
1722
- end
1723
- @skill_types.each do |skill_type|
1724
- glossary << GlossaryItem.new(skill_type, '技能类型名称')
1725
- end
1726
- @weapon_types.each do |weapon_type|
1727
- glossary << GlossaryItem.new(weapon_type, '武器类型名称')
1728
- end
1729
- @armor_types.each do |armor_type|
1730
- glossary << GlossaryItem.new(armor_type, '防具类型名称')
1731
- end
1732
- glossary.concat(@terms.ex_glossary)
1733
- end
1734
-
1735
- # 将所有的字符串替换为指定的字符串
1736
- #
1737
- # @param hash [Hash<String, String>] 字符串翻译表
1738
- #
1739
- # @return [void]
1740
- def in_strings(hash)
1741
- @game_title = hash[@game_title] || @game_title
1742
- @currency_unit = hash[@currency_unit] || @currency_unit
1743
- @elements.map! { |string| hash[string] || string }
1744
- @skill_types.map! { |string| hash[string] || string }
1745
- @weapon_types.map! { |string| hash[string] || string }
1746
- @armor_types.map! { |string| hash[string] || string }
1747
- @switches.map! { |string| hash[string] || string }
1748
- @variables.map! { |string| hash[string] || string }
1749
- @terms.in_strings(hash)
1750
- end
1751
- end
1752
-
1753
- # 图块类
1754
- class Tileset
1755
-
1756
- # 在原始数组中的索引
1757
- #
1758
- # @return [Integer]
1759
- attr_accessor :index
1760
-
1761
- # 图块名称
1762
- #
1763
- # @return [String]
1764
- attr_accessor :name
1765
-
1766
- # 图块注释
1767
- #
1768
- # @return [String]
1769
- attr_accessor :note
1770
-
1771
- # 用 RPG::Tileset 初始化
1772
- #
1773
- # @param tileset [RPG::Tileset] 待处理的 RPG::Tileset 对象
1774
- # @param index [Integer] 在原始数组中的索引
1775
- # @param with_note [Boolean] 是否处理 note 字段
1776
- #
1777
- # @return [R3EXS::Tileset]
1778
- def initialize(tileset, index, with_note)
1779
- @index = index
1780
- @name = tileset.name
1781
- @note = tileset.note
1782
- self.remove_instance_variable(:@note) unless with_note
1783
- end
1784
-
1785
- # 注入到 RPG::Tileset 对象
1786
- #
1787
- # @param tileset [RPG::Tileset] 待注入的 RPG::Tileset 对象
1788
- #
1789
- # @return [void]
1790
- def inject_to(tileset)
1791
- tileset.name = @name
1792
- tileset.note = @note if self.instance_variable_defined?(:@note)
1793
- end
1794
-
1795
- # 提取所有的字符串
1796
- #
1797
- # @return [Array<String>]
1798
- def ex_strings
1799
- strings = []
1800
- strings << @name
1801
- strings << @note if self.instance_variable_defined?(:@note)
1802
- strings
1803
- end
1804
-
1805
- # 将所有的字符串替换为指定的字符串
1806
- #
1807
- # @param hash [Hash<String, String>] 字符串翻译表
1808
- #
1809
- # @return [void]
1810
- def in_strings(hash)
1811
- @name = hash[@name] || @name
1812
- @note = hash[@note] || @note if self.instance_variable_defined?(:@note)
1813
- end
1814
-
1815
- # 判断是否为空
1816
- #
1817
- # @return [Boolean]
1818
- def empty?
1819
- @name.to_s.empty? && @note.to_s.empty?
1820
- end
1821
- end
1822
-
1823
- # 敌群类
1824
- class Troop
1825
-
1826
- # 在原始数组中的索引
1827
- #
1828
- # @return [Integer]
1829
- attr_accessor :index
1830
-
1831
- # 敌群名称
1832
- #
1833
- # @return [String]
1834
- attr_accessor :name
1835
-
1836
- # 敌群页列表
1837
- #
1838
- # @return [Array<R3EXS::Troop::Page>]
1839
- attr_accessor :pages
1840
-
1841
- # 敌群页类
1842
- class Page
1843
-
1844
- # 在原始数组中的索引
1845
- #
1846
- # @return [Integer]
1847
- attr_accessor :index
1848
-
1849
- # 事件指令列表
1850
- #
1851
- # @return [Array<R3EXS::EventCommand>]
1852
- attr_accessor :list
1853
-
1854
- # RPG::Troop::Page 初始化
1855
- #
1856
- # @param page [RPG::Troop::Page] 待处理的 RPG::Troop::Page 对象
1857
- # @param index [Integer] 在原始数组中的索引
1858
- #
1859
- # @return [R3EXS::Troop::Page]
1860
- def initialize(page, index)
1861
- @index = index
1862
- @list = []
1863
- page.list.each_with_index do |eventcommand, eventcommand_index|
1864
- next if eventcommand == nil
1865
- eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
1866
- @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
1867
- end
1868
- end
1869
-
1870
- # 注入到 RPG::Troop::Page 对象
1871
- #
1872
- # @param page [RPG::Troop::Page] 待注入的 RPG::Troop::Page 对象
1873
- #
1874
- # @return [void]
1875
- def inject_to(page)
1876
- @list.each do |eventcommand|
1877
- eventcommand.inject_to(page.list[eventcommand.index])
1878
- end
1879
- end
1880
-
1881
- # 提取所有的字符串
1882
- #
1883
- # @return [Array<String>]
1884
- def ex_strings
1885
- strings = []
1886
- @list.each do |eventcommand|
1887
- strings.concat(eventcommand.ex_strings)
1888
- end
1889
- strings
1890
- end
1891
-
1892
- # 将所有的字符串替换为指定的字符串
1893
- #
1894
- # @param hash [Hash<String, String>] 字符串翻译表
1895
- #
1896
- # @return [void]
1897
- def in_strings(hash)
1898
- @list.each do |eventcommand|
1899
- eventcommand.in_strings(hash)
1900
- end
1901
- end
1902
-
1903
- # 判断是否为空
1904
- #
1905
- # @return [Boolean]
1906
- def empty?
1907
- @list.empty?
1908
- end
1909
- end
1910
-
1911
- # RPG::Troop 初始化
1912
- #
1913
- # @param troop [RPG::Troop] 待处理的 RPG::Troop 对象
1914
- # @param index [Integer] 在原始数组中的索引
1915
- #
1916
- # @return [R3EXS::Troop]
1917
- def initialize(troop, index, _unused = nil)
1918
- @index = index
1919
- @name = troop.name
1920
- @pages = []
1921
- troop.pages.each_with_index do |page, page_index|
1922
- next if page == nil
1923
- page_r3exs = R3EXS::Troop::Page.new(page, page_index)
1924
- @pages << page_r3exs unless page_r3exs.empty?
1925
- end
1926
- end
1927
-
1928
- # 注入到 RPG::Troop 对象
1929
- #
1930
- # @param troop [RPG::Troop] 待注入的 RPG::Troop 对象
1931
- #
1932
- # @return [void]
1933
- def inject_to(troop)
1934
- troop.name = @name
1935
- @pages.each do |page|
1936
- page.inject_to(troop.pages[page.index])
1937
- end
1938
- end
1939
-
1940
- # 提取所有的字符串
1941
- #
1942
- # @return [Array<String>]
1943
- def ex_strings
1944
- strings = [@name]
1945
- @pages.each do |page|
1946
- strings.concat(page.ex_strings)
1947
- end
1948
- strings
1949
- end
1950
-
1951
- # 将所有的字符串替换为指定的字符串
1952
- #
1953
- # @param hash [Hash<String, String>] 字符串翻译表
1954
- #
1955
- # @return [void]
1956
- def in_strings(hash)
1957
- @name = hash[@name] || @name
1958
- @pages.each do |page|
1959
- page.in_strings(hash)
1960
- end
1961
- end
1962
-
1963
- # 判断是否为空
1964
- #
1965
- # @return [Boolean]
1966
- def empty?
1967
- @name.to_s.empty? && @pages.empty?
1968
- end
1969
- end
1970
-
1971
- # 武器类
1972
- class Weapon < EquipItem
1973
-
1974
- # 用 RPG::Weapon 初始化
1975
- #
1976
- # @param weapon [RPG::Weapon] 待处理的 RPG::Weapon 对象
1977
- # @param index [Integer] 在原始数组中的索引
1978
- # @param with_note [Boolean] 是否处理 note 字段
1979
- #
1980
- # @return [R3EXS::Weapon]
1981
- def initialize(weapon, index, with_note)
1982
- super(weapon, index, with_note)
1983
- end
1984
-
1985
- # 注入到 RPG::Weapon 对象
1986
- #
1987
- # @param weapon [RPG::Weapon] 待注入的 RPG::Weapon 对象
1988
- #
1989
- # @return [void]
1990
- def inject_to(weapon)
1991
- super
1992
- end
1993
-
1994
- # 提取所有的字符串
1995
- #
1996
- # @return [Array<String>]
1997
- def ex_strings
1998
- super
1999
- end
2000
-
2001
- # 提取术语表
2002
- #
2003
- # @return [Array<GlossaryItem>]
2004
- def ex_glossary
2005
- glossary = []
2006
- glossary << GlossaryItem.new(@name, '武器名称')
2007
- glossary
2008
- end
2009
-
2010
- # 将所有的字符串替换为指定的字符串
2011
- #
2012
- # @param hash [Hash<String, String>] 字符串翻译表
2013
- #
2014
- # @return [void]
2015
- def in_strings(hash)
2016
- super(hash)
2017
- end
2018
-
2019
- # 判断是否为空
2020
- #
2021
- # @return [Boolean]
2022
- def empty?
2023
- super
2024
- end
2025
- end
2026
-
2027
- end
1
+ # frozen_string_literal: true
2
+
3
+ module R3EXS
4
+ # 事件指令的命令名称
5
+ EVENT_COMMANDS = {
6
+ 0 => 'Empty',
7
+
8
+ # [string(Face Graphic name)]---[int(Face Graphic index)]---[int:{0:Normal Window, 1:Dim Background, 2:Transparent}]---[int:{0:Top, 1:Middle, 2:Bottom}]---END
9
+ 101 => 'ShowTextAttributes',
10
+
11
+ # [Array<string>(Choices Array)]---[int:{0:Disallow, 1:Choice 1, 2:Choice 2, 3:Choice 3, 4:Choice 4, 5:Branch}(When Cancel)]---END
12
+ 102 => 'ShowChoices',
13
+
14
+ # [int(Variable for Number)]---[int:{1~8}(Digits)]---END
15
+ 103 => 'InputNumber',
16
+
17
+ # [int(Variable for Item ID)]---END
18
+ 104 => 'SelectKeyItem',
19
+
20
+ # [int:{1~8}(Speed)]---[bool(No Fast Forward)]---END
21
+ 105 => 'ShowScrollingTextAttributes',
22
+
23
+ # [string]---END
24
+ 108 => 'Comment',
25
+
26
+ # |--[int:0(Switch)]---[int(Switch ID)]---[int{0:ON, 1:OFF}]---END
27
+ # |
28
+ # | |--[int:0(Compare to Constant)]---[int(Number)]-------|
29
+ # |--[int:1(Variable)]---[int(Variable ID)]--| |--[int{0:==, 1:>=, 2:<=, 3:>, 4:<, 5:!=}]---END
30
+ # | |--[int:1(Compare to Variable)]---[int(Variable ID)]--|
31
+ # |
32
+ # |--[int:2(Self Switch)]---[string{'A', 'B', 'C', 'D'}]---[int{0:ON, 1:OFF}]---END
33
+ # |
34
+ # |--[int:3(Timer)]---[int:{0~5999}(sec)]---[int{0:>=, 1:<=}]---END
35
+ # |
36
+ # | |--[int:0(In the Party)]---END
37
+ # | |
38
+ # | |--[int:1(Name)]---[string]---END
39
+ # | |
40
+ # | |--[int:2(Class)]---[int(Class ID)]---END
41
+ # | |
42
+ # |--[int:4(Actor)]---[int(Actor ID)]--------|--[int:3(Skill)]---[int(Skill ID)]---END
43
+ # | |
44
+ # | |--[int:4(Weapon)]---[int(Weapon ID)]---END
45
+ # | |
46
+ # | |--[int:5(Armor)]---[int(Armor ID)]---END
47
+ # | |
48
+ # | |--[int:6(State)]---[int(State ID)]---END
49
+ # |
50
+ # | |--[int:0(Appeared)---END
51
+ # |--[int:5(Enemy)]---[int(Enemy ID)]--------|
52
+ # | |--[int:1(State)]---[int(State ID)]---END
53
+ # |
54
+ # |--[int:6(Character)]---[int:{-1:Player, 0:This event, 1:EV001, ...}]---[int:{2:Down, 4:Left, 6:Right, 8:Up}]---END
55
+ # |
56
+ # |--[int:7(Gold)]---[int(Money)]---[int{0:>=, 1:<=, 2:<}]---END
57
+ # |
58
+ # |--[int:8(Item)]---[int(Item ID)]---END
59
+ # |
60
+ # |--[int:9(Weapon)]---[int(Weapon ID)]---[bool(Include Equipments)]---END
61
+ # |
62
+ # |--[int:10(Armor)]---[int(Armor ID)]---[bool(Include Equipments)]---END
63
+ # |
64
+ # |--[int:11(Button)]---[int:{2:Down, 4:Left, 6:Right, 8:Up, 11:A, 12:B, 13:C, 14:X, 15:Y, 16:Z, 17:L, 18:R}]---END
65
+ # |
66
+ # |--[int:12(Script)]---[string]---END
67
+ # |
68
+ # |--[int:13(Vehicle)]---[int:{0:Boat, 1:Ship, 2:Airship}]---END
69
+ 111 => 'ConditionalBranch',
70
+ 112 => 'Loop',
71
+ 113 => 'BreakLoop',
72
+ 115 => 'ExitEventProcessing',
73
+
74
+ # [int(Common Event ID)]---END
75
+ 117 => 'CallCommonEvent',
76
+
77
+ # [string]---END
78
+ 118 => 'Label',
79
+
80
+ # [string]---END
81
+ 119 => 'JumpToLabel',
82
+
83
+ # [int(Switch Begin ID)]---[int(Switch End ID)]---[int:{0:ON, 1:OFF}]---END
84
+ 121 => 'ControlSwitches',
85
+
86
+ # |--[int:0(Constant)]---[int(Number)]---END
87
+ # |
88
+ # |--[int:1(Variable)]---[int(Variable ID)]---END
89
+ # |
90
+ # |--[int:2(Random)]---[int(Min)]---[int(Max)]---END
91
+ # |
92
+ # | |--[int:{0:Item, 1:Weapon, 2:Armor}]---[int(Corresponded Item ID)]---[int:0]---END
93
+ # | |
94
+ # [int(Variable Begin ID)]---[int(Variable End ID)]---[int:{0:Set, 1:Add, 2:Sub, 3:Mul, 4:Div, 5:Mod}]--| |--[int:3(Actor)]---[int:(Actor ID)]---[int:{0:Level, 1:EXP, 2:HP, 3:MP, 4:MHP, 5:MMP, 6:ATK, 7:DEF, 8:MAT, 9:MDF, 10:AGI, 11:LUK}]---END
95
+ # | |
96
+ # | |--[int:4(Enemy)]---[int:(Enemy ID)]---[int:{0:HP, 1:MP, 2:MHP, 3:MMP, 4:ATK, 5:DEF, 6:MAT, 7:MDF, 8:AGI, 9:LUK}]---END
97
+ # |--[int:3(Game Data)]--|
98
+ # | |--[int:5(Character)]---[int:{-1:Player, 0:This Event, 1:EV001, ...}]---[int:{0:Map X, 1:Map Y, 2:Direction, 3:Screen X ,4:Screen Y}]---END
99
+ # | |
100
+ # | |--[int:6(Party)]---[int:{0~7}(Member ID)]---[int:0]---END
101
+ # | |
102
+ # | |--[int:7(Other)]---[int:{0(Map ID), 1(Party Members), 2(Gold), 3(Steps), 4(Play Time), 5(Timer), 6(Save Count), 7(Battle Count)}]---[int:0]---END
103
+ # |
104
+ # |--[int:4(Scripts)]---[string]---END
105
+ 122 => 'ControlVariables',
106
+
107
+ # [string:{'A', 'B', 'C', 'D'}(Self Switch Name)]---[int:{0:ON, 1:OFF}]---END
108
+ 123 => 'ControlSelfSwitch',
109
+
110
+ # [int:{0:Start, 1:Stop}]---[int:{0~5999}(sec)]---END
111
+ 124 => 'ControlTimer',
112
+
113
+ # |--[int:0(Constant)]---[int:{0~9999999}(Number)]---END
114
+ # [int:{0:Increase, 1:Decrease}]--|
115
+ # |--[int:1(Variable)]---[int(Variable ID)]---END
116
+ 125 => 'ChangeGold',
117
+
118
+ # |--[int:0(Constant)]---[int:{0~9999999}(Number)]---END
119
+ # [int(Item ID)]---[int:{0:Increase, 1:Decrease}]--|
120
+ # |--[int:1(Variable)]---[int(Variable ID)]---END
121
+ 126 => 'ChangeItems',
122
+
123
+ # |--[int:0(Constant)]---[int:{0~9999999}(Number)]--|
124
+ # |--[int:0(Increase)]--| |--[bool:false(Include Equipment)]---END
125
+ # | |--[int:1(Variable)]---[int(Variable ID)]---------|
126
+ # [int(Weapon ID)]--|
127
+ # | |--[int:0(Constant)]---[int:{0~9999999}(Number)]--|
128
+ # |--[int:1(Decrease)]--| |--[bool(Include Equipment)]---END
129
+ # |--[int:1(Variable)]---[int(Variable ID)]---------|
130
+ 127 => 'ChangeWeapons',
131
+
132
+ # |--[int:0(Constant)]---[int:{0~9999999}(Number)]--|
133
+ # |--[int:0(Increase)]--| |--[bool:false(Include Equipment)]---END
134
+ # | |--[int:1(Variable)]---[int(Variable ID)]---------|
135
+ # [int(Armor ID)]--|
136
+ # | |--[int:0(Constant)]---[int:{0~9999999}(Number)]--|
137
+ # |--[int:1(Decrease)]--| |--[bool(Include Equipment)]---END
138
+ # |--[int:1(Variable)]---[int(Variable ID)]---------|
139
+ 128 => 'ChangeArmor',
140
+
141
+ # [int(Actor ID)]---[int:{0:Add, 1:Remove}]---[int:{0:NO, 1:YES}(Initialize)]---END
142
+ 129 => 'ChangePartyMember',
143
+
144
+ # [RPG::BGM]---END
145
+ 132 => 'ChangeBattleBGM',
146
+
147
+ # [RPG::ME]---END
148
+ 133 => 'ChangeBattleEndME',
149
+
150
+ # [int:{0:Disable, 1:Enable}]---END
151
+ 134 => 'ChangeSaveAccess',
152
+
153
+ # [int:{0:Disable, 1:Enable}]---END
154
+ 135 => 'ChangeMenuAccess',
155
+
156
+ # [int:{0:Disable, 1:Enable}]---END
157
+ 136 => 'ChangeEncounter',
158
+
159
+ # [int:{0:Disable, 1:Enable}]---END
160
+ 137 => 'ChangeFormationAccess',
161
+
162
+ # [RPG::Tone]---END
163
+ 138 => 'ChangeWindowColor',
164
+
165
+ # |--[int:0(Direct Designation)]---[int(Map ID)]---[int(Map X)]---[int(Map Y)]-------------------------------------------------------------------------------------|
166
+ # | |--[int:{0:Retain, 2:Down, 4:Left, 6:Right, 8:Up}(Direction)]---[int:{0:Normal, 1:White, 2:None}(Fade)]---END
167
+ # |--[int:1(Designation with Variables)]---[int(Map ID Corresponded Variable ID)]---[int(Map X Corresponded Variable ID)]---[int(Map Y Corresponded Variable ID)]--|
168
+ 201 => 'TransferPlayer',
169
+
170
+ # |--[int:0(Direct Designation)]---[int(Map ID)]---[int(Map X)]---[int(Map Y)]---END
171
+ # [int:{0:Boat, 1:Ship, 2:Airship}]--|
172
+ # |--[int:1(Designation with Variables)]---[int(Map ID Corresponded Variable ID)]---[int(Map X Corresponded Variable ID)]---[int(Map Y Corresponded Variable ID)]---END
173
+ 202 => 'SetVehicleLocation',
174
+
175
+ # |--[int:0(Direct Designation)]---[int(Map X)]---[int(Map Y)]------------------------------------------------------------|
176
+ # | |
177
+ # [int:{0:This Event, 1:EV001, ...}]----------|--[int:1(Designation with Variables)]---[int(Map X Corresponded Variable ID)]---[int(Map Y Corresponded Variable ID)]--|--[int:{0:Retain, 2:Down, 4:Left, 6:Right, 8:Up}(Direction)]---END
178
+ # | |
179
+ # |--[int:2(Exchange with Another Event)]---[int(Exchanged Event ID)]---[int:0]-------------------------------------------|
180
+ 203 => 'SetEventLocation',
181
+
182
+ # [int:{2:Down, 4:Left, 6:Right, 8:Up}]---[int:{0~100}(Distance)]---[int:{1:1/8 Speed, 2:1/4 Speed, 3:1/2 Speed, 4:Normal, 5:2 Speed, 6:4 Speed}]---END
183
+ 204 => 'ScrollMap',
184
+
185
+ # [int:{-1:Player, 0:This Event, 1:EV001, ...}]---[RPG::MoveRoute(45 is Script)]---END
186
+ 205 => 'SetMoveRoute',
187
+
188
+ # END
189
+ 206 => 'GetSwitchVehicle',
190
+
191
+ # [int:{0:ON, 1:OFF}]---END
192
+ 211 => 'ChangeTransparency',
193
+
194
+ # [int:{-1:Player, 0:This Event, 1:EV001, ...}]---[int(Animation ID)]---[bool(Wait for Completion)]---END
195
+ 212 => 'ShowAnimation',
196
+
197
+ # [int:{-1:Player, 0:This Event, 1:EV001, ...}]---[int(Ballon Icon ID)]---[bool(Wait for Completion)]---END
198
+ 213 => 'ShowBalloonIcon',
199
+ 214 => 'EraseEvent',
200
+
201
+ # [int:{0:ON, 1:OFF}]---END
202
+ 216 => 'ChangePlayerFollowers',
203
+ 217 => 'GatherFollowers',
204
+ 221 => 'FadeoutScreen',
205
+ 222 => 'FadeinScreen',
206
+
207
+ # [RPG::Tone]---[int:{0~600}(Time 1/60 sec)]---[bool(Wait for Completion)]---END
208
+ 223 => 'TintScreen',
209
+
210
+ # [RPG::Color]---[int:{0~600}(Time 1/60 sec)]---[bool(Wait for Completion)]---END
211
+ 224 => 'FlashScreen',
212
+
213
+ # [int:{1~9}(Power)]---[int:{1~9}(Speed)]---[int:{0~600}(Time 1/60 sec)]---[bool(Wait for Completion)]---END
214
+ 225 => 'ShakeScreen',
215
+
216
+ # [int:{0~999}(Time 1/60 sec)]---END
217
+ 230 => 'Wait',
218
+
219
+ # |--[int:0(Constant)]---[int:{-9999~9999}(Map X)]---[int:{-9999~9999}(Map Y)]--------------------------|
220
+ # [int:{1~100}(Number)]---[string(Picture Graphic Name)]---[int:{0:Upper Left, 1:Center}(Origin)]--| |--[int:{0~2000}(Width %)]---[int:{0~2000}(Height %)]---[int:{0~255}(Opacity)]---[int:{0:Normal, 1:Add, 2:Sub}]---END
221
+ # |--[int:1(Variable)]---[int(Map X Corresponded Variable ID)]---[int(Map Y Corresponded Variable ID)]--|
222
+ 231 => 'ShowPicture',
223
+
224
+ # |--[int:0(Constant)]---[int:{-9999~9999}(Map X)]---[int:{-9999~9999}(Map Y)]--------------------------|
225
+ # [int:{1~100}(Number)]---[int:{0:Upper Left, 1:Center}(Origin)]--| |--[int:{0~2000}(Width %)]---[int:{0~2000}(Height %)]---[int:{0~255}(Opacity)]---[int:{0:Normal, 1:Add, 2:Sub}]---[int:{0~600}(Time 1/60 sec)]---[bool(Wait for Completion)]---END
226
+ # |--[int:1(Variable)]---[int(Map X Corresponded Variable ID)]---[int(Map Y Corresponded Variable ID)]--|
227
+ 232 => 'MovePicture',
228
+
229
+ # [int:{1~100}(Number)]-[int:{-90~90}(Speed)]--END
230
+ 233 => 'RotatePicture',
231
+
232
+ # [int:{1~100}(Number)]---[RPG::Tone]---[int:{0~600}(Time 1/60 sec)]---[bool(Wait for Completion)]---END
233
+ 234 => 'TintPicture',
234
+
235
+ # [int:{1~100}(Number)]---END
236
+ 235 => 'ErasePicture',
237
+
238
+ # [string:{":none", ":rain", ":storm", ":snow"}]---[int:{0~9}(Power)]---[int:{0~600}(Time 1/60 sec)]---[bool(Wait for Completion)]---END
239
+ 236 => 'SetWeatherEffects',
240
+
241
+ # [RPG::BGM]---END
242
+ 241 => 'PlayBGM',
243
+
244
+ # [int:{1~60}(Time sec)]---END
245
+ 242 => 'FadeoutBGM',
246
+ 243 => 'SaveBGM',
247
+ 244 => 'ReplayBGM',
248
+
249
+ # [RPG::BGM]---END
250
+ 245 => 'PlayBGS',
251
+
252
+ # [int:{1~60}(Time sec)]---END
253
+ 246 => 'FadeoutBGS',
254
+
255
+ # [RPG::ME]---END
256
+ 249 => 'PlayME',
257
+
258
+ # [RPG::SE]---END
259
+ 250 => 'PlaySE',
260
+ 251 => 'StopSE',
261
+
262
+ # [string(Movie Name)]---END
263
+ 261 => 'PlayMovie',
264
+
265
+ # [int:{0:ON, 1:OFF}]---END
266
+ 281 => 'ChangeMapNameDisplay',
267
+
268
+ # [int(Tileset ID)]---END
269
+ 282 => 'ChangeTileset',
270
+
271
+ # [string(Floor Picture)]---[string(Wall Picture)]---END
272
+ 283 => 'ChangeBattleBack',
273
+
274
+ # [string(Distant view Picture)]---[bool(Loop Horizontal)]---[bool(Loop Vertical)]---[int(-32~32)(Horizontal Scroll)]---[int(-32~32)(Vertical Scroll)]---END
275
+ 284 => 'ChangeParallaxBack',
276
+
277
+ # |--[int:0(Direct Designation)]---[int(Map X)]---[int(Map Y)]---END
278
+ # [int(Variable for Info)]---[int:{0:Terrain, 1:Event ID, 2:Tile ID(Layer 1), 3:Tile ID(Layer 2), 4:Tile ID(Layer 3), 5:Region ID}(Info Type)]--|
279
+ # |--[int:1(Designation with Variables)]---[int(Map X Corresponded Variable ID)]---[int(Map Y Corresponded Variable ID)]---END
280
+ 285 => 'GetLocationInfo',
281
+
282
+ # |--[int:0(Direct Designation)]---[int(Enemy ID)]-----------------------------------|
283
+ # | |--[bool(Can Escape)]---[bool(Continue Even When Loser)]---END
284
+ # |--[int:1(Designation with Variables)]---[int(Enemy ID Corresponded Variable ID)]--|
285
+ 301 => 'BattleProcessing',
286
+
287
+ # |--[int:0(Price: Standard)]---[int:0]------------------|
288
+ # [int:{0:Item, 1:Weapon, 2:Armor}]---[int(Corresponded Item ID)]--| |--[bool(Purchase Only)]---END
289
+ # |--[int:1(Price: Specify)]---[int:{0~9999999}(Price)]--|
290
+ 302 => 'ShopProcessing',
291
+
292
+ # [int(Actor ID)]---[int:{1~16}(Max Characters)]---END
293
+ 303 => 'NameInputProcessing',
294
+
295
+ # |--[int:0(Constant)]---[int:{1~9999}(Number)]--|
296
+ # |--[int:0(Increase)]--| |--[bool:false(Allow Knockout)]---END
297
+ # | |--[int:1(Variable)]---[int(Variable ID)]------|
298
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]--|
299
+ # | | |--[int:0(Constant)]---[int:{1~9999}(Number)]--|
300
+ # | |--[int:1(Decrease)]--| |--[bool(Allow Knockout)]---END
301
+ # | |--[int:1(Variable)]---[int(Variable ID)]------|
302
+ # |
303
+ # | |--[int:0(Constant)]---[int:{1~9999}(Number)]--|
304
+ # | |--[int:0(Increase)]--| |--[bool:false(Allow Knockout)]---END
305
+ # | | |--[int:1(Variable)]---[int(Variable ID)]------|
306
+ # |--[int:1(Variable)]---[int(Variable ID)]-----------------------|
307
+ # | |--[int:0(Constant)]---[int:{1~9999}(Number)]--|
308
+ # |--[int:1(Decrease)]--| |--[bool(Allow Knockout)]---END
309
+ # |--[int:1(Variable)]---[int(Variable ID)]------|
310
+ 311 => 'ChangeHP',
311
+
312
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]--| |--[int:0(Constant)]---[int:{1~9999}(Number)]---END
313
+ # | |--[int:{0:Increase, 1:Decrease}]--|
314
+ # |--[int:1(Variable)]---[int(Variable ID)]---------------------| |--[int:1(Variable)]---[int(Variable ID)]---END
315
+ 312 => 'ChangeMP',
316
+
317
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]--|
318
+ # | |--[int:{0:Add, 1:Remove}]---[int(State ID)]---END
319
+ # |--[int:1(Variable)]---[int(Variable ID)]---------------------|
320
+ 313 => 'ChangeState',
321
+
322
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]---END
323
+ # |
324
+ # |--[int:1(Variable)]---[int(Variable ID)]---END
325
+ 314 => 'RecoverAll',
326
+
327
+ # |--[int:0(:Constant)]---[int:{1~9999999}(Number)]--|
328
+ # |--[int:0(Increase)]--| |--[bool(Show Level Up Message)]---END
329
+ # | |--[int:1(Variable)]---[int(Variable ID)]----------|
330
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]--|
331
+ # | | |--[int:0(Constant)]---[int:{1~9999999}(Number)]--|
332
+ # | |--[int:1(Decrease)]--| |--[bool:false(Show Level Up Message)]---END
333
+ # | |--[int:1(Variable)]------------------------------|
334
+ # |
335
+ # | |--[int:0(Constant)]---[int:{1~9999999}(Number)]--|
336
+ # | |--[int:0(Increase)]--| |--[bool(Show Level Up Message)]---END
337
+ # | | |--[int:1(Variable)]---[int(Variable ID)]---------|
338
+ # |--[int:1(Variable)]---[int(Variable ID)]---------------------|
339
+ # | |--[int:0(Constant)]---[int:{1~9999999}(Number)]--|
340
+ # |--[int:1(Decrease)]--| |--[bool:false(Show Level Up Message)]---END
341
+ # |--[int:1(Variable)]---[int(Variable ID)]---------|
342
+ 315 => 'ChangeEXP',
343
+
344
+ # |--[int:0(Constant)]---[int:{1~98}(Number)]--|
345
+ # |--[int:0(Increase)]--| |--[bool(Show Level Up Message)]---END
346
+ # | |--[int:1(Variable)]---[int(Variable ID)]----|
347
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]--|
348
+ # | | |--[int:0(Constant)]---[int:{1~98}(Number)]--|
349
+ # | |--[int:1(Decrease)]--| |--[bool:false(Show Level Up Message)]---END
350
+ # | |--[int:1(Variable)]---[int(Variable ID)]----|
351
+ # |
352
+ # | |--[int:0(Constant)]---[int:{1~98}(Number)]--|
353
+ # | |--[int:0(Increase)]--| |--[bool(Show Level Up Message)]---END
354
+ # | | |--[int:1(Variable)]---[int(Variable ID)]----|
355
+ # |--[int:1(Variable)]---[int(Variable ID)]---------------------|
356
+ # | |--[int:0(Constant)]---[int:{1~98}(Number)]--|
357
+ # |--[int:1(Decrease)]--| |--[bool:false(Show Level Up Message)]---END
358
+ # |--[int:1(Variable)]---[int(Variable ID)]------|
359
+ 316 => 'ChangeLevel',
360
+
361
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]--| |--[int:0(Constant)]---[int:{0~9999999}(Number)]---END
362
+ # | |--[int:{0:MHP, 1:MMP, 2:ATK, 3:DEF, 4:MAT, 5:MDF, 6:AGI, 7:LUK}]---[int:{0:Increase, 1:Decrease}]--|
363
+ # |--[int:1(Variable)]---[int(Variable ID)]---------------------| |--[int:1(Variable)]---[int(Variable ID)]---END
364
+ 317 => 'ChangeParameters',
365
+
366
+ # |--[int:0(Fixed)]---[int:{0:Entire Party, 1:Actor 001, ...}]--|
367
+ # | |--[int:{0:Learn, 1:Forget}]---[int(Skill ID)]---END
368
+ # |--[int:1(Variable)]---[int(Variable ID)]---------------------|
369
+ 318 => 'ChangeSkills',
370
+
371
+ # [int(Actor ID)]---[int:{0:Weapon, 1:Shield, 2:Head, 3:Boby, 4:Accessory}]---[int:{0:None, 1:Equipment 001, ...}(Equipment ID)]---END
372
+ 319 => 'ChangeEquipment',
373
+
374
+ # [int(Actor ID)]---[string(New Actor Name)]---END
375
+ 320 => 'ChangeActorName',
376
+
377
+ # [int(Actor ID)]---[int(New Class ID)]---END
378
+ 321 => 'ChangeActorClass',
379
+
380
+ # [int(Actor ID)]---[string(New Actor walking Picture Name)]---[int(New Actor Walking Picture Index)]---[string(New Actor Portrait Picture Name)]---[int(New Actor Portrait Picture Index)]---END
381
+ 322 => 'ChangeActorGraphic',
382
+
383
+ # [int:{0:Boat, 1:Ship, 2:Airship}]---[string(New Vehicle Picture Name)]---[int(New Vehicle Picture Index)]---END
384
+ 323 => 'ChangeVehicleGraphic',
385
+
386
+ # [int(Actor ID)]---[string(New Actor Nickname)]---END
387
+ 324 => 'ChangeActorNickname',
388
+
389
+ # |--[int:0(Constant)]---[int:{1~999999}(Number)]--|
390
+ # |--[int:0(Increase)]--| |--[bool:false(Allow Knockout)]---END
391
+ # | |--[int:1(Variable)]---[int(Variable ID)]--------|
392
+ # [int:{-1:Entire Troop, 0:Troop 001, ...}]--|
393
+ # | |--[int:0(Constant)]---[int:{1~999999}(Number)]--|
394
+ # |--[int:1(Decrease)]--| |--[bool(Allow Knockout)]---END
395
+ # |--[int:1(Variable)]---[int(Variable ID)]--------|
396
+ #
397
+ 331 => 'ChangeEnemyHP',
398
+
399
+ # |--[int:0(Constant)]---[int:{1~9999}(Number)]---END
400
+ # [int:{-1:Entire Troop, 0:Troop 001, ...}]---[int:{0:Increase, 1:Decrease}]--|
401
+ # |--[int:1(Variable)]---[int(Variable ID)]---END
402
+ 332 => 'ChangeEnemyMP',
403
+
404
+ # [int:{-1:Entire Troop, 0:Troop 001, ...}]---[int:{0:Add, 1:Remove}]---[int(State ID)]---END
405
+ 333 => 'ChangeEnemyState',
406
+
407
+ # [int:{-1:Entire Troop, 0:Troop 001, ...}]---END
408
+ 334 => 'EnemyRecoverAll',
409
+
410
+ # [int:{-1:Entire Troop, 0:Troop 001, ...}]---END
411
+ 335 => 'EnemyAppear',
412
+
413
+ # [int(Troop ID)]---[int(Enemy ID)]---END
414
+ 336 => 'EnemyTransform',
415
+
416
+ # [int:{-1:Entire Troop, 0:Troop 001, ...}]---[int(Animation ID)]---END
417
+ 337 => 'ShowBattleAnimation',
418
+
419
+ # |--[int:0(Enemy)]---[int(Troop ID)]--|
420
+ # | |--[int(Skill ID)]---[int:{-2:Last Target, -1:Random, 0:Index 1,...}]---END
421
+ # |--[int:1(Actor)]---[int(Actor ID)]--|
422
+ 339 => 'ForceAction',
423
+ 340 => 'AbortBattle',
424
+ 351 => 'OpenMenuScreen',
425
+ 352 => 'OpenSaveScreen',
426
+ 353 => 'GameOver',
427
+ 354 => 'ReturnToTitleScreen',
428
+
429
+ # [string]---END
430
+ 355 => 'Script',
431
+
432
+ # [string]---END
433
+ 401 => 'ShowText',
434
+
435
+ # [int(Choice Index)]---[string(Choice Name)]---END
436
+ 402 => 'When',
437
+ 403 => 'WhenCancel',
438
+ 404 => 'ChoicesEnd',
439
+
440
+ # [string]---END
441
+ 405 => 'ShowScrollingText',
442
+
443
+ # [string]---END
444
+ 408 => 'CommentMore',
445
+ 411 => 'Else',
446
+ 412 => 'BranchEnd',
447
+ 413 => 'RepeatAbove',
448
+
449
+ # [RPG::MoveCommand(45 is script)]---END
450
+ 505 => 'MoveRoute',
451
+ 601 => 'IfWin',
452
+ 602 => 'IfEscape',
453
+ 603 => 'IfLose',
454
+ 604 => 'BattleProcessingEnd',
455
+
456
+ # |--[int:0(Price: Standard)]---[int:0]---END
457
+ # [int:{0:Item, 1:Weapon, 2:Armor}]---[int(Corresponded Item ID)]--|
458
+ # |--[int:1(Price: Specify)]---[int:{0~9999999}(Price)]---END
459
+ 605 => 'ShopItem',
460
+
461
+ # [string]---END
462
+ 655 => 'ScriptMore'
463
+ }.freeze
464
+ # 地图数据类
465
+ class Map
466
+ # 地图显示名
467
+ #
468
+ # @return [String]
469
+ attr_accessor :display_name
470
+
471
+ # 备注
472
+ #
473
+ # @return [String]
474
+ attr_accessor :note
475
+
476
+ # 地图事件
477
+ #
478
+ # @return [Hash{Integer => R3EXS::Event}]
479
+ attr_accessor :events
480
+
481
+ # RPG::Map 初始化
482
+ #
483
+ # @param map [RPG::Map] 待处理的 RPG::Map 对象
484
+ #
485
+ # @return [R3EXS::Map]
486
+ def initialize(map)
487
+ @display_name = map.display_name
488
+ @note = map.note
489
+ @events = {}
490
+ map.events.each do |key, event|
491
+ next if event.nil?
492
+
493
+ event_r3exs = R3EXS::Event.new(event)
494
+ @events[key] = event_r3exs unless event_r3exs.empty?
495
+ end
496
+ end
497
+
498
+ # 注入到 RPG::Map 对象
499
+ #
500
+ # @param map [RPG::Map] 待注入的 RPG::Map 对象
501
+ #
502
+ # @return [void]
503
+ def inject_to(map)
504
+ map.display_name = @display_name
505
+ map.note = @note
506
+ @events.each { |key, event| event.inject_to(map.events[key]) }
507
+ end
508
+
509
+ # 提取所有的字符串
510
+ #
511
+ # @return [Array<String>]
512
+ def ex_strings
513
+ strings = [@display_name]
514
+ strings << @note
515
+ @events.each_value { |event| strings.concat(event.ex_strings) }
516
+ strings
517
+ end
518
+
519
+ # 将所有的字符串替换为指定的字符串
520
+ #
521
+ # @param hash [Hash{String => String}] 字符串翻译表
522
+ #
523
+ # @return [void]
524
+ def in_strings(hash)
525
+ @display_name = hash.fetch(@display_name, @display_name)
526
+ @note = hash.fetch(@note, @note)
527
+ @events.each_value { |event| event.in_strings(hash) }
528
+ end
529
+ end
530
+
531
+ # 地图信息的数据类
532
+ class MapInfo
533
+ # 地图名称
534
+ #
535
+ # @return [String]
536
+ attr_accessor :name
537
+
538
+ # RPG::MapInfo 初始化
539
+ #
540
+ # @param mapinfo [RPG::MapInfo] 待处理的 RPG::MapInfo 对象
541
+ #
542
+ # @return [R3EXS::MapInfo]
543
+ def initialize(mapinfo)
544
+ @name = mapinfo.name
545
+ end
546
+
547
+ # 注入到 RPG::MapInfo 对象
548
+ #
549
+ # @param mapinfo [RPG::MapInfo] 待注入的 RPG::MapInfo 对象
550
+ #
551
+ # @return [void]
552
+ def inject_to(mapinfo)
553
+ mapinfo.name = @name
554
+ end
555
+
556
+ # 提取所有的字符串
557
+ #
558
+ # @return [Array<String>]
559
+ def ex_strings
560
+ [@name]
561
+ end
562
+
563
+ # 将所有的字符串替换为指定的字符串
564
+ #
565
+ # @param hash [Hash{String => String}] 字符串翻译表
566
+ #
567
+ # @return [void]
568
+ def in_strings(hash)
569
+ @name = hash.fetch(@name, @name)
570
+ end
571
+
572
+ # 判断是否为空
573
+ #
574
+ # @return [Boolean]
575
+ def empty?
576
+ @name.blank?
577
+ end
578
+ end
579
+
580
+ # 地图事件的数据类
581
+ class Event
582
+ # 名称
583
+ #
584
+ # @return [String]
585
+ attr_accessor :name
586
+
587
+ # 事件页数组
588
+ #
589
+ # @return [Array<R3EXS::Event::Page>]
590
+ attr_accessor :pages
591
+
592
+ # 用 RPG::Event 初始化
593
+ #
594
+ # @param event [RPG::Event] 待处理的 RPG::Event 对象
595
+ #
596
+ # @return [R3EXS::Event]
597
+ def initialize(event)
598
+ @name = event.name
599
+ @pages = []
600
+ event.pages.each_with_index do |page, page_index|
601
+ next if page.nil?
602
+
603
+ page_r3exs = R3EXS::Event::Page.new(page, page_index)
604
+ @pages << page_r3exs unless page_r3exs.empty?
605
+ end
606
+ end
607
+
608
+ # 注入到 RPG::Event 对象
609
+ #
610
+ # @param event [RPG::Event] 待注入的 RPG::Event 对象
611
+ #
612
+ # @return [void]
613
+ def inject_to(event)
614
+ event.name = @name
615
+ @pages.each { |page| page.inject_to(event.pages[page.index]) }
616
+ end
617
+
618
+ # 提取所有的字符串
619
+ #
620
+ # @return [Array<String>]
621
+ def ex_strings
622
+ strings = [@name]
623
+ @pages.each { |page| strings.concat(page.ex_strings) }
624
+ strings
625
+ end
626
+
627
+ # 将所有的字符串替换为指定的字符串
628
+ #
629
+ # @param hash [Hash{String => String}] 字符串翻译表
630
+ #
631
+ # @return [void]
632
+ def in_strings(hash)
633
+ @name = hash.fetch(@name, @name)
634
+ @pages.each { |page| page.in_strings(hash) }
635
+ end
636
+
637
+ # 判断是否为空
638
+ #
639
+ # @return [Boolean]
640
+ def empty?
641
+ @name.blank? && @pages.empty?
642
+ end
643
+
644
+ # 地图事件块事件页资料
645
+ class Page
646
+ # 在原始数组中的索引
647
+ #
648
+ # @return [Integer]
649
+ attr_accessor :index
650
+
651
+ # 执行内容
652
+ #
653
+ # @return [Array<R3EXS::EventCommand>]
654
+ attr_accessor :list
655
+
656
+ # 用 RPG::Event::Page 初始化
657
+ #
658
+ # @param page [RPG::Event::Page] 待处理的 RPG::Event::Page 对象
659
+ # @param index [Integer] 在原始数组中的索引
660
+ #
661
+ # @return [R3EXS::Event::Page]
662
+ def initialize(page, index)
663
+ @index = index
664
+ @list = []
665
+ page.list.each_with_index do |eventcommand, eventcommand_index|
666
+ next if eventcommand.nil?
667
+
668
+ eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
669
+ @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
670
+ end
671
+ end
672
+
673
+ # 注入到 RPG::Event::Page 对象
674
+ #
675
+ # @param page [RPG::Event::Page] 待注入的 RPG::Event::Page 对象
676
+ #
677
+ # @return [void]
678
+ def inject_to(page)
679
+ @list.each { |eventcommand| eventcommand.inject_to(page.list[eventcommand.index]) }
680
+ end
681
+
682
+ # 提取所有的字符串
683
+ #
684
+ # @return [Array<String>]
685
+ def ex_strings
686
+ strings = []
687
+ @list.each { |eventcommand| strings.concat(eventcommand.ex_strings) }
688
+ strings
689
+ end
690
+
691
+ # 将所有的字符串替换为指定的字符串
692
+ #
693
+ # @param hash [Hash{String => String}] 字符串翻译表
694
+ #
695
+ # @return [void]
696
+ def in_strings(hash)
697
+ @list.each { |eventcommand| eventcommand.in_strings(hash) }
698
+ end
699
+
700
+ # 判断是否为空
701
+ #
702
+ # @return [Boolean]
703
+ def empty?
704
+ @list.empty?
705
+ end
706
+ end
707
+ end
708
+
709
+ # 事件指令的数据类
710
+ class EventCommand
711
+ # 在原始数组中的索引
712
+ #
713
+ # @return [Integer]
714
+ attr_accessor :index
715
+
716
+ # 事件指令代码
717
+ #
718
+ # @return [Integer]
719
+ attr_accessor :code
720
+
721
+ # 事件指令用途
722
+ #
723
+ # @return [String]
724
+ attr_accessor :usage
725
+
726
+ # 事件指令参数
727
+ #
728
+ # @return [Array<String, R3EXS::MoveRoute>]
729
+ attr_accessor :parameter
730
+
731
+ # 用 RPG::EventCommand 初始化
732
+ #
733
+ # @param eventcommand [RPG::EventCommand] 待处理的 RPG::EventCommand 对象
734
+ # @param index [Integer] 在原始数组中的索引
735
+ #
736
+ # @return [R3EXS::EventCommand]
737
+ def initialize(eventcommand, index)
738
+ @index = index
739
+ @code = eventcommand.code
740
+ @parameter = []
741
+ case @code
742
+ when 102 # ShowChoices
743
+ @usage = EVENT_COMMANDS[102]
744
+ @parameter.concat(eventcommand.parameters[0])
745
+ when 108 # Comment
746
+ @usage = EVENT_COMMANDS[108]
747
+ @parameter << eventcommand.parameters[0]
748
+ when 111 # ConditionalBranch
749
+ @usage = EVENT_COMMANDS[111]
750
+ if eventcommand.parameters[0] == 4 && eventcommand.parameters[2] == 1
751
+ @parameter << eventcommand.parameters[3]
752
+ elsif eventcommand.parameters[0] == 12
753
+ @parameter << eventcommand.parameters[1]
754
+ end
755
+ when 118 # Label
756
+ @usage = EVENT_COMMANDS[118]
757
+ @parameter << eventcommand.parameters[0]
758
+ when 119 # JumpToLabel
759
+ @usage = EVENT_COMMANDS[119]
760
+ @parameter << eventcommand.parameters[0]
761
+ when 122 # ControlVariables
762
+ if eventcommand.parameters[3] == 4
763
+ @usage = EVENT_COMMANDS[122]
764
+ @parameter << eventcommand.parameters[4]
765
+ end
766
+ when 205 # SetMoveRoute
767
+ moveroute_r3exs = R3EXS::MoveRoute.new(eventcommand.parameters[1])
768
+ unless moveroute_r3exs.empty?
769
+ @usage = EVENT_COMMANDS[205]
770
+ @parameter << moveroute_r3exs
771
+ end
772
+ when 320 # ChangeActorName
773
+ @usage = EVENT_COMMANDS[320]
774
+ @parameter << eventcommand.parameters[1]
775
+ when 324 # ChangeActorNickname
776
+ @usage = EVENT_COMMANDS[324]
777
+ @parameter << eventcommand.parameters[1]
778
+ when 355 # Script
779
+ @usage = EVENT_COMMANDS[355]
780
+ @parameter << eventcommand.parameters[0]
781
+ when 401 # ShowText
782
+ @usage = EVENT_COMMANDS[401]
783
+ @parameter << eventcommand.parameters[0]
784
+ when 402 # When
785
+ @usage = EVENT_COMMANDS[402]
786
+ @parameter << eventcommand.parameters[1]
787
+ when 405 # ShowScrollingText
788
+ @usage = EVENT_COMMANDS[405]
789
+ @parameter << eventcommand.parameters[0]
790
+ when 408 # CommentMore
791
+ @usage = EVENT_COMMANDS[408]
792
+ @parameter << eventcommand.parameters[0]
793
+ when 655 # ScriptMore
794
+ @usage = EVENT_COMMANDS[655]
795
+ @parameter << eventcommand.parameters[0]
796
+ end
797
+ end
798
+
799
+ # 注入到 RPG::EventCommand 对象
800
+ #
801
+ # @param eventcommand [RPG::EventCommand] 待注入的 RPG::EventCommand 对象
802
+ #
803
+ # @return [void]
804
+ def inject_to(eventcommand)
805
+ case eventcommand.code
806
+ when 102 # ShowChoices
807
+ eventcommand.parameters[0] = @parameter
808
+ when 108 # Comment
809
+ eventcommand.parameters[0] = @parameter[0]
810
+ when 111 # ConditionalBranch
811
+ if eventcommand.parameters[0] == 4 && eventcommand.parameters[2] == 1
812
+ eventcommand.parameters[3] = @parameter[0]
813
+ elsif eventcommand.parameters[0] == 12
814
+ eventcommand.parameters[1] = @parameter[0]
815
+ end
816
+ when 118 # Label
817
+ eventcommand.parameters[0] = @parameter[0]
818
+ when 119 # JumpToLabel
819
+ eventcommand.parameters[0] = @parameter[0]
820
+ when 122 # ControlVariables
821
+ eventcommand.parameters[4] = @parameter[0]
822
+ when 205 # SetMoveRoute
823
+ @parameter[0].inject_to(eventcommand.parameters[1])
824
+ when 320 # ChangeActorName
825
+ eventcommand.parameters[1] = @parameter[0]
826
+ when 324 # ChangeActorNickname
827
+ eventcommand.parameters[1] = @parameter[0]
828
+ when 355 # Script
829
+ eventcommand.parameters[0] = @parameter[0]
830
+ when 401 # ShowText
831
+ eventcommand.parameters[0] = @parameter[0]
832
+ when 402 # When
833
+ eventcommand.parameters[1] = @parameter[0]
834
+ when 405 # ShowScrollingText
835
+ eventcommand.parameters[0] = @parameter[0]
836
+ when 408 # CommentMore
837
+ eventcommand.parameters[0] = @parameter[0]
838
+ when 655 # ScriptMore
839
+ eventcommand.parameters[0] = @parameter[0]
840
+ end
841
+ end
842
+
843
+ # 提取所有的字符串
844
+ #
845
+ # @return [Array<String>]
846
+ def ex_strings
847
+ strings = []
848
+ if @code == 205
849
+ strings.concat(@parameter[0].ex_strings)
850
+ else
851
+ strings.concat(@parameter)
852
+ end
853
+ strings
854
+ end
855
+
856
+ # 将所有的字符串替换为指定的字符串
857
+ #
858
+ # @param hash [Hash{String => String}] 字符串翻译表
859
+ #
860
+ # @return [void]
861
+ def in_strings(hash)
862
+ if @code == 205
863
+ @parameter[0].in_strings(hash)
864
+ else
865
+ @parameter.map! { |string| hash.fetch(string, string) }
866
+ end
867
+ end
868
+
869
+ # 判断是否为空
870
+ #
871
+ # @return [Boolean]
872
+ def empty?
873
+ @parameter.empty?
874
+ end
875
+ end
876
+
877
+ # 移动路线的数据类
878
+ class MoveRoute
879
+ # 移动路线内容
880
+ #
881
+ # @return [Array<R3EXS::MoveCommand>]
882
+ attr_accessor :list
883
+
884
+ # 用 RPG::MoveRoute 初始化
885
+ #
886
+ # @param moveroute [RPG::MoveRoute] 待处理的 RPG::MoveRoute 对象
887
+ #
888
+ # @return [R3EXS::MoveRoute]
889
+ def initialize(moveroute)
890
+ @list = []
891
+ moveroute.list.each_with_index do |movecommand, index|
892
+ next if movecommand.nil?
893
+
894
+ movecommand_r3exs = R3EXS::MoveCommand.new(movecommand, index)
895
+ @list << movecommand_r3exs unless movecommand_r3exs.empty?
896
+ end
897
+ end
898
+
899
+ # 注入到 RPG::MoveRoute 对象
900
+ #
901
+ # @param moveroute [RPG::MoveRoute] 待注入的 RPG::MoveRoute 对象
902
+ #
903
+ # @return [void]
904
+ def inject_to(moveroute)
905
+ @list.each { |movecommand| movecommand.inject_to(moveroute.list[movecommand.index]) }
906
+ end
907
+
908
+ # 提取所有的字符串
909
+ #
910
+ # @return [Array<String>]
911
+ def ex_strings
912
+ strings = []
913
+ @list.each { |movecommand| strings.concat(movecommand.ex_strings) }
914
+ strings
915
+ end
916
+
917
+ # 将所有的字符串替换为指定的字符串
918
+ #
919
+ # @param hash [Hash{String => String}] 字符串翻译表
920
+ #
921
+ # @return [void]
922
+ def in_strings(hash)
923
+ @list.each { |movecommand| movecommand.in_strings(hash) }
924
+ end
925
+
926
+ # 判断是否为空
927
+ #
928
+ # @return [Boolean]
929
+ def empty?
930
+ @list.empty?
931
+ end
932
+ end
933
+
934
+ # 移动路线指令的数据类
935
+ class MoveCommand
936
+ # 在原始数组中的索引
937
+ #
938
+ # @return [Integer]
939
+ attr_accessor :index
940
+
941
+ # 移动路线指令代码
942
+ #
943
+ # @return [Integer]
944
+ attr_accessor :code
945
+
946
+ # 移动指令用途
947
+ #
948
+ # @return [String]
949
+ attr_accessor :usage
950
+
951
+ # 移动指令参数
952
+ #
953
+ # @return [Array<String>]
954
+ attr_accessor :parameter
955
+
956
+ # 用 RPG::MoveCommand 初始化
957
+ #
958
+ # @param movecommand [RPG::MoveCommand] 待处理的 RPG::MoveCommand 对象
959
+ # @param index [Integer] 在原始数组中的索引
960
+ #
961
+ # @return [R3EXS::MoveCommand]
962
+ def initialize(movecommand, index)
963
+ @index = index
964
+ @code = movecommand.code
965
+ @parameter = []
966
+ return unless @code == 45
967
+
968
+ @usage = 'MoveCommandScript'
969
+ @parameter << movecommand.parameters[0]
970
+ end
971
+
972
+ # 注入到 RPG::MoveCommand 对象
973
+ #
974
+ # @param movecommand [RPG::MoveCommand] 待注入的 RPG::MoveCommand 对象
975
+ #
976
+ # @return [void]
977
+ def inject_to(movecommand)
978
+ return unless movecommand.code == 45
979
+
980
+ movecommand.parameters[0] = @parameter[0]
981
+ end
982
+
983
+ # 提取所有的字符串
984
+ #
985
+ # @return [Array<String>]
986
+ def ex_strings
987
+ @parameter
988
+ end
989
+
990
+ # 将所有的字符串替换为指定的字符串
991
+ #
992
+ # @param hash [Hash{String => String}] 字符串翻译表
993
+ #
994
+ # @return [void]
995
+ def in_strings(hash)
996
+ @parameter.map! { |string| hash.fetch(string, string) }
997
+ end
998
+
999
+ # 判断是否为空
1000
+ #
1001
+ # @return [Boolean]
1002
+ def empty?
1003
+ @parameter.empty?
1004
+ end
1005
+ end
1006
+
1007
+ # 角色、职业、技能、物品、武器、护甲、敌人和状态的超类
1008
+ class BaseItem
1009
+ # 在原始数组中的索引
1010
+ #
1011
+ # @return [Integer]
1012
+ attr_reader :index
1013
+
1014
+ # 名称
1015
+ #
1016
+ # @return [String]
1017
+ attr_accessor :name
1018
+
1019
+ # 说明
1020
+ #
1021
+ # @return [String]
1022
+ attr_accessor :description
1023
+
1024
+ # 备注
1025
+ #
1026
+ # @return [String]
1027
+ attr_accessor :note
1028
+
1029
+ # 用 RPG::BaseItem 初始化
1030
+ #
1031
+ # @param baseitem [RPG::BaseItem] 待处理的 RPG::BaseItem 对象
1032
+ # @param index [Integer] 在原始数组中的索引
1033
+ #
1034
+ # @return [R3EXS::BaseItem]
1035
+ def initialize(baseitem, index)
1036
+ @index = index
1037
+ @name = baseitem.name
1038
+ @description = baseitem.description
1039
+ @note = baseitem.note
1040
+ end
1041
+
1042
+ # 注入到 RPG::BaseItem 对象
1043
+ #
1044
+ # @param baseitem [RPG::BaseItem] 待注入的 RPG::BaseItem 对象
1045
+ #
1046
+ # @return [void]
1047
+ def inject_to(baseitem)
1048
+ baseitem.name = @name
1049
+ baseitem.description = @description
1050
+ baseitem.note = @note
1051
+ end
1052
+
1053
+ # 提取所有的字符串
1054
+ #
1055
+ # @return [Array<String>]
1056
+ def ex_strings
1057
+ strings = []
1058
+ strings << @name
1059
+ strings << @description
1060
+ strings << @note
1061
+ strings
1062
+ end
1063
+
1064
+ # 将所有的字符串替换为指定的字符串
1065
+ #
1066
+ # @param hash [Hash{String => String}] 字符串翻译表
1067
+ #
1068
+ # @return [void]
1069
+ def in_strings(hash)
1070
+ @name = hash.fetch(@name, @name)
1071
+ @description = hash.fetch(@description, @description)
1072
+ @note = hash.fetch(@note, @note)
1073
+ end
1074
+
1075
+ # 判断是否为空
1076
+ #
1077
+ # @return [Boolean]
1078
+ def empty?
1079
+ @name.blank? && @description.blank? && @note.blank?
1080
+ end
1081
+ end
1082
+
1083
+ # 角色的数据类
1084
+ class Actor < BaseItem
1085
+ # 称号
1086
+ #
1087
+ # @return [String]
1088
+ attr_accessor :nickname
1089
+
1090
+ # 用 RPG::Actor 初始化
1091
+ #
1092
+ # @param actor [RPG::Actor] 待处理的 RPG::Actor 对象
1093
+ # @param index [Integer] 在原始数组中的索引
1094
+ #
1095
+ # @return [R3EXS::Actor]
1096
+ def initialize(actor, index)
1097
+ super(actor, index)
1098
+ @nickname = actor.nickname
1099
+ end
1100
+
1101
+ # 注入到 RPG::Actor 对象
1102
+ #
1103
+ # @param actor [RPG::Actor] 待注入的 RPG::Actor 对象
1104
+ #
1105
+ # @return [void]
1106
+ def inject_to(actor)
1107
+ super(actor)
1108
+ actor.nickname = @nickname
1109
+ end
1110
+
1111
+ # 提取所有的字符串
1112
+ #
1113
+ # @return [Array<String>]
1114
+ def ex_strings
1115
+ strings = super
1116
+ strings << @nickname
1117
+ strings
1118
+ end
1119
+
1120
+ # 将所有的字符串替换为指定的字符串
1121
+ #
1122
+ # @param hash [Hash{String => String}] 字符串翻译表
1123
+ #
1124
+ # @return [void]
1125
+ def in_strings(hash)
1126
+ super(hash)
1127
+ @nickname = hash.fetch(@nickname, @nickname)
1128
+ end
1129
+
1130
+ # 判断是否为空
1131
+ #
1132
+ # @return [Boolean]
1133
+ def empty?
1134
+ super && @nickname.blank?
1135
+ end
1136
+ end
1137
+
1138
+ # 职业的数据类
1139
+ class Class < BaseItem
1140
+ # 习得技能
1141
+ #
1142
+ # @return [Array<R3EXS::Class::Learning>]
1143
+ attr_accessor :learnings
1144
+
1145
+ # 用 RPG::Class 初始化
1146
+ #
1147
+ # @param klass [RPG::Class] 待处理的 RPG::Class 对象
1148
+ # @param index [Integer] 在原始数组中的索引
1149
+ #
1150
+ # @return [R3EXS::Class]
1151
+ def initialize(klass, index)
1152
+ super(klass, index)
1153
+ @learnings = []
1154
+ klass.learnings.each_with_index do |learning, learning_index|
1155
+ next if learning.nil?
1156
+
1157
+ learning_r3exs = R3EXS::Class::Learning.new(learning, learning_index)
1158
+ @learnings << learning_r3exs unless learning_r3exs.empty?
1159
+ end
1160
+ end
1161
+
1162
+ # 注入到 RPG::Class 对象
1163
+ #
1164
+ # @param klass [RPG::Class] 待注入的 RPG::Class 对象
1165
+ #
1166
+ # @return [void]
1167
+ def inject_to(klass)
1168
+ super(klass)
1169
+ @learnings.each { |learning| learning.inject_to(klass.learnings[learning.index]) }
1170
+ end
1171
+
1172
+ # 提取所有的字符串
1173
+ #
1174
+ # @return [Array<String>]
1175
+ def ex_strings
1176
+ strings = super
1177
+ @learnings.each { |learning| strings.concat(learning.ex_strings) }
1178
+ strings
1179
+ end
1180
+
1181
+ # 将所有的字符串替换为指定的字符串
1182
+ #
1183
+ # @param hash [Hash{String => String}] 字符串翻译表
1184
+ #
1185
+ # @return [void]
1186
+ def in_strings(hash)
1187
+ super(hash)
1188
+ @learnings.each { |learning| learning.in_strings(hash) }
1189
+ end
1190
+
1191
+ # 判断是否为空
1192
+ #
1193
+ # @return [Boolean]
1194
+ def empty?
1195
+ super && @learnings.empty?
1196
+ end
1197
+
1198
+ # 职业[技能]的数据类
1199
+ class Learning
1200
+ # 在原始数组中的索引
1201
+ #
1202
+ # @return [Integer]
1203
+ attr_reader :index
1204
+
1205
+ # 备注
1206
+ #
1207
+ # @return [String]
1208
+ attr_accessor :note
1209
+
1210
+ # 用 RPG::Class::Learning 初始化
1211
+ #
1212
+ # @param learning [RPG::Class::Learning] 待处理的 RPG::Class::Learning 对象
1213
+ # @param index [Integer] 在原始数组中的索引
1214
+ #
1215
+ # @return [R3EXS::Class::Learning]
1216
+ def initialize(learning, index)
1217
+ @index = index
1218
+ @note = learning.note
1219
+ end
1220
+
1221
+ # 注入到 RPG::Class::Learning 对象
1222
+ #
1223
+ # @param learning [RPG::Class::Learning] 待注入的 RPG::Class::Learning 对象
1224
+ #
1225
+ # @return [void]
1226
+ def inject_to(learning)
1227
+ learning.note = @note
1228
+ end
1229
+
1230
+ # 提取所有的字符串
1231
+ #
1232
+ # @return [Array<String>]
1233
+ def ex_strings
1234
+ [@note]
1235
+ end
1236
+
1237
+ # 将所有的字符串替换为指定的字符串
1238
+ #
1239
+ # @param hash [Hash{String => String}] 字符串翻译表
1240
+ #
1241
+ # @return [void]
1242
+ def in_strings(hash)
1243
+ @note = hash.fetch(@note, @note)
1244
+ end
1245
+
1246
+ # 判断是否为空
1247
+ #
1248
+ # @return [Boolean]
1249
+ def empty?
1250
+ @note.blank?
1251
+ end
1252
+ end
1253
+ end
1254
+
1255
+ # 技能和物品的超类
1256
+ class UsableItem < BaseItem
1257
+ end
1258
+
1259
+ # 技能的数据类
1260
+ class Skill < UsableItem
1261
+ # 使用时的信息
1262
+ #
1263
+ # @return [String]
1264
+ attr_accessor :message1
1265
+
1266
+ # 使用时的信息
1267
+ #
1268
+ # @return [String]
1269
+ attr_accessor :message2
1270
+
1271
+ # 用 RPG::Skill 初始化
1272
+ #
1273
+ # @param skill [RPG::Skill] 待处理的 RPG::Skill 对象
1274
+ # @param index [Integer] 在原始数组中的索引
1275
+ #
1276
+ # @return [R3EXS::Skill]
1277
+ def initialize(skill, index)
1278
+ super(skill, index)
1279
+ @message1 = skill.message1
1280
+ @message2 = skill.message2
1281
+ end
1282
+
1283
+ # 注入到 RPG::Skill 对象
1284
+ #
1285
+ # @param skill [RPG::Skill] 待注入的 RPG::Skill 对象
1286
+ #
1287
+ # @return [void]
1288
+ def inject_to(skill)
1289
+ super
1290
+ skill.message1 = @message1
1291
+ skill.message2 = @message2
1292
+ end
1293
+
1294
+ # 提取所有的字符串
1295
+ #
1296
+ # @return [Array<String>]
1297
+ def ex_strings
1298
+ strings = super
1299
+ strings << @message1
1300
+ strings << @message2
1301
+ strings
1302
+ end
1303
+
1304
+ # 将所有的字符串替换为指定的字符串
1305
+ #
1306
+ # @param hash [Hash{String => String}] 字符串翻译表
1307
+ #
1308
+ # @return [void]
1309
+ def in_strings(hash)
1310
+ super(hash)
1311
+ @message1 = hash.fetch(@message1, @message1)
1312
+ @message2 = hash.fetch(@message2, @message2)
1313
+ end
1314
+
1315
+ # 判断是否为空
1316
+ #
1317
+ # @return [Boolean]
1318
+ def empty?
1319
+ super && @message1.blank? && @message2.blank?
1320
+ end
1321
+ end
1322
+
1323
+ # 物品的数据类
1324
+ class Item < UsableItem
1325
+ end
1326
+
1327
+ # 武器与护甲的超类
1328
+ class EquipItem < BaseItem
1329
+ end
1330
+
1331
+ # 武器的数据类
1332
+ class Weapon < EquipItem
1333
+ end
1334
+
1335
+ # 护甲的数据类
1336
+ class Armor < EquipItem
1337
+ end
1338
+
1339
+ # 敌人的数据类
1340
+ class Enemy < BaseItem
1341
+ end
1342
+
1343
+ # 状态的数据类
1344
+ class State < BaseItem
1345
+ # 状态提示信息, 附加到队友
1346
+ #
1347
+ # @return [String]
1348
+ attr_accessor :message1
1349
+
1350
+ # 状态提示信息, 附加到敌人
1351
+ #
1352
+ # @return [String]
1353
+ attr_accessor :message2
1354
+
1355
+ # 状态提示信息, 状态持续
1356
+ #
1357
+ # @return [String]
1358
+ attr_accessor :message3
1359
+
1360
+ # 状态提示信息, 状态解除
1361
+ #
1362
+ # @return [String]
1363
+ attr_accessor :message4
1364
+
1365
+ # 用 RPG::State 初始化
1366
+ #
1367
+ # @param state [RPG::State] 待处理的 RPG::State 对象
1368
+ # @param index [Integer] 在原始数组中的索引
1369
+ #
1370
+ # @return [R3EXS::State]
1371
+ def initialize(state, index)
1372
+ super(state, index)
1373
+ @message1 = state.message1
1374
+ @message2 = state.message2
1375
+ @message3 = state.message3
1376
+ @message4 = state.message4
1377
+ end
1378
+
1379
+ # 注入到 RPG::State 对象
1380
+ #
1381
+ # @param state [RPG::State] 待注入的 RPG::State 对象
1382
+ #
1383
+ # @return [void]
1384
+ def inject_to(state)
1385
+ super
1386
+ state.message1 = @message1
1387
+ state.message2 = @message2
1388
+ state.message3 = @message3
1389
+ state.message4 = @message4
1390
+ end
1391
+
1392
+ # 提取所有的字符串
1393
+ #
1394
+ # @return [Array<String>]
1395
+ def ex_strings
1396
+ strings = super
1397
+ strings << @message1
1398
+ strings << @message2
1399
+ strings << @message3
1400
+ strings << @message4
1401
+ strings
1402
+ end
1403
+
1404
+ # 将所有的字符串替换为指定的字符串
1405
+ #
1406
+ # @param hash [Hash{String => String}] 字符串翻译表
1407
+ #
1408
+ # @return [void]
1409
+ def in_strings(hash)
1410
+ super(hash)
1411
+ @message1 = hash.fetch(@message1, @message1)
1412
+ @message2 = hash.fetch(@message2, @message2)
1413
+ @message3 = hash.fetch(@message3, @message3)
1414
+ @message4 = hash.fetch(@message4, @message4)
1415
+ end
1416
+
1417
+ # 判断是否为空
1418
+ #
1419
+ # @return [Boolean]
1420
+ def empty?
1421
+ super && @message1.blank? && @message2.blank? && @message3.blank? && @message4.blank?
1422
+ end
1423
+ end
1424
+
1425
+ # 敌人队伍的数据类
1426
+ class Troop
1427
+ # 在原始数组中的索引
1428
+ #
1429
+ # @return [Integer]
1430
+ attr_accessor :index
1431
+
1432
+ # 敌人队伍名称
1433
+ #
1434
+ # @return [String]
1435
+ attr_accessor :name
1436
+
1437
+ # 战斗事件
1438
+ #
1439
+ # @return [Array<R3EXS::Troop::Page>]
1440
+ attr_accessor :pages
1441
+
1442
+ # 用 RPG::Troop 初始化
1443
+ #
1444
+ # @param troop [RPG::Troop] 待处理的 RPG::Troop 对象
1445
+ # @param index [Integer] 在原始数组中的索引
1446
+ #
1447
+ # @return [R3EXS::Troop]
1448
+ def initialize(troop, index, _unused = nil)
1449
+ @index = index
1450
+ @name = troop.name
1451
+ @pages = []
1452
+ troop.pages.each_with_index do |page, page_index|
1453
+ next if page.nil?
1454
+
1455
+ page_r3exs = R3EXS::Troop::Page.new(page, page_index)
1456
+ @pages << page_r3exs unless page_r3exs.empty?
1457
+ end
1458
+ end
1459
+
1460
+ # 注入到 RPG::Troop 对象
1461
+ #
1462
+ # @param troop [RPG::Troop] 待注入的 RPG::Troop 对象
1463
+ #
1464
+ # @return [void]
1465
+ def inject_to(troop)
1466
+ troop.name = @name
1467
+ @pages.each { |page| page.inject_to(troop.pages[page.index]) }
1468
+ end
1469
+
1470
+ # 提取所有的字符串
1471
+ #
1472
+ # @return [Array<String>]
1473
+ def ex_strings
1474
+ strings = [@name]
1475
+ @pages.each { |page| strings.concat(page.ex_strings) }
1476
+ strings
1477
+ end
1478
+
1479
+ # 将所有的字符串替换为指定的字符串
1480
+ #
1481
+ # @param hash [Hash{String => String}] 字符串翻译表
1482
+ #
1483
+ # @return [void]
1484
+ def in_strings(hash)
1485
+ @name = hash.fetch(@name, @name)
1486
+ @pages.each { |page| page.in_strings(hash) }
1487
+ end
1488
+
1489
+ # 判断是否为空
1490
+ #
1491
+ # @return [Boolean]
1492
+ def empty?
1493
+ @name.blank? && @pages.empty?
1494
+ end
1495
+
1496
+ # 战斗事件(页)的数据类
1497
+ class Page
1498
+ # 在原始数组中的索引
1499
+ #
1500
+ # @return [Integer]
1501
+ attr_accessor :index
1502
+
1503
+ # 执行内容
1504
+ #
1505
+ # @return [Array<R3EXS::EventCommand>]
1506
+ attr_accessor :list
1507
+
1508
+ # RPG::Troop::Page 初始化
1509
+ #
1510
+ # @param page [RPG::Troop::Page] 待处理的 RPG::Troop::Page 对象
1511
+ # @param index [Integer] 在原始数组中的索引
1512
+ #
1513
+ # @return [R3EXS::Troop::Page]
1514
+ def initialize(page, index)
1515
+ @index = index
1516
+ @list = []
1517
+ page.list.each_with_index do |eventcommand, eventcommand_index|
1518
+ next if eventcommand.nil?
1519
+
1520
+ eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
1521
+ @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
1522
+ end
1523
+ end
1524
+
1525
+ # 注入到 RPG::Troop::Page 对象
1526
+ #
1527
+ # @param page [RPG::Troop::Page] 待注入的 RPG::Troop::Page 对象
1528
+ #
1529
+ # @return [void]
1530
+ def inject_to(page)
1531
+ @list.each { |eventcommand| eventcommand.inject_to(page.list[eventcommand.index]) }
1532
+ end
1533
+
1534
+ # 提取所有的字符串
1535
+ #
1536
+ # @return [Array<String>]
1537
+ def ex_strings
1538
+ strings = []
1539
+ @list.each { |eventcommand| strings.concat(eventcommand.ex_strings) }
1540
+ strings
1541
+ end
1542
+
1543
+ # 将所有的字符串替换为指定的字符串
1544
+ #
1545
+ # @param hash [Hash{String => String}] 字符串翻译表
1546
+ #
1547
+ # @return [void]
1548
+ def in_strings(hash)
1549
+ @list.each { |eventcommand| eventcommand.in_strings(hash) }
1550
+ end
1551
+
1552
+ # 判断是否为空
1553
+ #
1554
+ # @return [Boolean]
1555
+ def empty?
1556
+ @list.empty?
1557
+ end
1558
+ end
1559
+ end
1560
+
1561
+ # 动画的数据类
1562
+ class Animation
1563
+ # 在原始数组中的索引
1564
+ #
1565
+ # @return [Integer]
1566
+ attr_reader :index
1567
+
1568
+ # 名称
1569
+ #
1570
+ # @return [String]
1571
+ attr_accessor :name
1572
+
1573
+ # 用 RPG::Animation 初始化
1574
+ #
1575
+ # @param animation [RPG::Animation] 待处理的 RPG::Animation 对象
1576
+ # @param index [Integer] 在原始数组中的索引
1577
+ #
1578
+ # @return [R3EXS::Animation]
1579
+ def initialize(animation, index, _unused = nil)
1580
+ @index = index
1581
+ @name = animation.name
1582
+ end
1583
+
1584
+ # 注入到 RPG::Animation 对象
1585
+ #
1586
+ # @param animation [RPG::Animation] 待注入的 RPG::Animation 对象
1587
+ #
1588
+ # @return [void]
1589
+ def inject_to(animation)
1590
+ animation.name = @name
1591
+ end
1592
+
1593
+ # 提取所有的字符串
1594
+ #
1595
+ # @return [Array<String>]
1596
+ def ex_strings
1597
+ [@name]
1598
+ end
1599
+
1600
+ # 将所有的字符串替换为指定的字符串
1601
+ #
1602
+ # @param hash [Hash{String => String}] 字符串翻译表
1603
+ #
1604
+ # @return [void]
1605
+ def in_strings(hash)
1606
+ @name = hash.fetch(@name, @name)
1607
+ end
1608
+
1609
+ # 判断是否为空
1610
+ #
1611
+ # @return [Boolean]
1612
+ def empty?
1613
+ @name.blank?
1614
+ end
1615
+ end
1616
+
1617
+ # 图块的数据类
1618
+ class Tileset
1619
+ # 在原始数组中的索引
1620
+ #
1621
+ # @return [Integer]
1622
+ attr_accessor :index
1623
+
1624
+ # 图块页名称
1625
+ #
1626
+ # @return [String]
1627
+ attr_accessor :name
1628
+
1629
+ # 备注
1630
+ #
1631
+ # @return [String]
1632
+ attr_accessor :note
1633
+
1634
+ # RPG::Tileset 初始化
1635
+ #
1636
+ # @param tileset [RPG::Tileset] 待处理的 RPG::Tileset 对象
1637
+ # @param index [Integer] 在原始数组中的索引
1638
+ #
1639
+ # @return [R3EXS::Tileset]
1640
+ def initialize(tileset, index)
1641
+ @index = index
1642
+ @name = tileset.name
1643
+ @note = tileset.note
1644
+ end
1645
+
1646
+ # 注入到 RPG::Tileset 对象
1647
+ #
1648
+ # @param tileset [RPG::Tileset] 待注入的 RPG::Tileset 对象
1649
+ #
1650
+ # @return [void]
1651
+ def inject_to(tileset)
1652
+ tileset.name = @name
1653
+ tileset.note = @note
1654
+ end
1655
+
1656
+ # 提取所有的字符串
1657
+ #
1658
+ # @return [Array<String>]
1659
+ def ex_strings
1660
+ strings = [@name]
1661
+ strings << @note
1662
+ strings
1663
+ end
1664
+
1665
+ # 将所有的字符串替换为指定的字符串
1666
+ #
1667
+ # @param hash [Hash{String => String}] 字符串翻译表
1668
+ #
1669
+ # @return [void]
1670
+ def in_strings(hash)
1671
+ @name = hash.fetch(@name, @name)
1672
+ @note = hash.fetch(@note, @note)
1673
+ end
1674
+
1675
+ # 判断是否为空
1676
+ #
1677
+ # @return [Boolean]
1678
+ def empty?
1679
+ @name.blank? && @note.blank?
1680
+ end
1681
+ end
1682
+
1683
+ # 公共事件的数据类
1684
+ class CommonEvent
1685
+ # 在原始数组中的索引
1686
+ #
1687
+ # @return [Integer]
1688
+ attr_accessor :index
1689
+
1690
+ # 名称
1691
+ #
1692
+ # @return [String]
1693
+ attr_accessor :name
1694
+
1695
+ # 执行内容
1696
+ #
1697
+ # @return [Array<R3EXS::EventCommand>]
1698
+ attr_accessor :list
1699
+
1700
+ # RPG::CommonEvent 初始化
1701
+ #
1702
+ # @param commonevent [RPG::CommonEvent] 待处理的 RPG::CommonEvent 对象
1703
+ # @param index [Integer] 在原始数组中的索引
1704
+ #
1705
+ # @return [R3EXS::CommonEvent]
1706
+ def initialize(commonevent, index, _unused = nil)
1707
+ @index = index
1708
+ @name = commonevent.name
1709
+ @list = []
1710
+ commonevent.list.each_with_index do |eventcommand, eventcommand_index|
1711
+ next if eventcommand.nil?
1712
+
1713
+ eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
1714
+ @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
1715
+ end
1716
+ end
1717
+
1718
+ # 注入到 RPG::CommonEvent 对象
1719
+ #
1720
+ # @param commonevent [RPG::CommonEvent] 待注入的 RPG::CommonEvent 对象
1721
+ #
1722
+ # @return [void]
1723
+ def inject_to(commonevent)
1724
+ commonevent.name = @name
1725
+ @list.each { |eventcommand| eventcommand.inject_to(commonevent.list[eventcommand.index]) }
1726
+ end
1727
+
1728
+ # 提取所有的字符串
1729
+ #
1730
+ # @return [Array<String>]
1731
+ def ex_strings
1732
+ strings = [@name]
1733
+ @list.each { |eventcommand| strings.concat(eventcommand.ex_strings) }
1734
+ strings
1735
+ end
1736
+
1737
+ # 将所有的字符串替换为指定的字符串
1738
+ #
1739
+ # @param hash [Hash{String => String}] 字符串翻译表
1740
+ #
1741
+ # @return [void]
1742
+ def in_strings(hash)
1743
+ @name = hash.fetch(@name, @name)
1744
+ @list.each { |eventcommand| eventcommand.in_strings(hash) }
1745
+ end
1746
+
1747
+ # 判断是否为空
1748
+ #
1749
+ # @return [Boolean]
1750
+ def empty?
1751
+ @name.blank? && @list.empty?
1752
+ end
1753
+ end
1754
+
1755
+ # 系统的数据类
1756
+ class System
1757
+ # 游戏标题
1758
+ #
1759
+ # @return [String]
1760
+ attr_accessor :game_title
1761
+
1762
+ # 货币单位
1763
+ #
1764
+ # @return [String]
1765
+ attr_accessor :currency_unit
1766
+
1767
+ # 属性列表
1768
+ #
1769
+ # @return [Array<String>]
1770
+ attr_accessor :elements
1771
+
1772
+ # 技能类型列表
1773
+ #
1774
+ # @return [Array<String>]
1775
+ attr_accessor :skill_types
1776
+
1777
+ # 武器类型列表
1778
+ #
1779
+ # @return [Array<String>]
1780
+ attr_accessor :weapon_types
1781
+
1782
+ # 护甲类型列表
1783
+ #
1784
+ # @return [Array<String>]
1785
+ attr_accessor :armor_types
1786
+
1787
+ # 开关列表
1788
+ #
1789
+ # @return [Array<String>]
1790
+ attr_accessor :switches
1791
+
1792
+ # 变量列表
1793
+ #
1794
+ # @return [Array<String>]
1795
+ attr_accessor :variables
1796
+
1797
+ # 用语
1798
+ #
1799
+ # @return [R3EXS::System::Terms]
1800
+ attr_accessor :terms
1801
+
1802
+ # 用 RPG::System 初始化
1803
+ #
1804
+ # @param system [RPG::System] 待处理的 RPG::System 对象
1805
+ #
1806
+ # @return [R3EXS::System]
1807
+ def initialize(system, _unused = nil)
1808
+ @game_title = system.game_title
1809
+ @currency_unit = system.currency_unit
1810
+ @elements = system.elements
1811
+ @skill_types = system.skill_types
1812
+ @weapon_types = system.weapon_types
1813
+ @armor_types = system.armor_types
1814
+ @switches = system.switches
1815
+ @variables = system.variables
1816
+ @terms = R3EXS::System::Terms.new(system.terms)
1817
+ end
1818
+
1819
+ # 注入到 RPG::System 对象
1820
+ #
1821
+ # @param system [RPG::System] 待注入的 RPG::System 对象
1822
+ #
1823
+ # @return [void]
1824
+ def inject_to(system)
1825
+ system.game_title = @game_title
1826
+ system.currency_unit = @currency_unit
1827
+ system.elements = @elements
1828
+ system.skill_types = @skill_types
1829
+ system.weapon_types = @weapon_types
1830
+ system.armor_types = @armor_types
1831
+ system.switches = @switches
1832
+ system.variables = @variables
1833
+ @terms.inject_to(system.terms)
1834
+ end
1835
+
1836
+ # 提取所有的字符串
1837
+ #
1838
+ # @return [Array<String>]
1839
+ def ex_strings
1840
+ strings = [@game_title]
1841
+ strings << @currency_unit
1842
+ strings.concat(@elements)
1843
+ strings.concat(@skill_types)
1844
+ strings.concat(@weapon_types)
1845
+ strings.concat(@armor_types)
1846
+ strings.concat(@switches)
1847
+ strings.concat(@variables)
1848
+ strings.concat(@terms.ex_strings)
1849
+ strings
1850
+ end
1851
+
1852
+ # 将所有的字符串替换为指定的字符串
1853
+ #
1854
+ # @param hash [Hash{String => String}] 字符串翻译表
1855
+ #
1856
+ # @return [void]
1857
+ def in_strings(hash)
1858
+ @game_title = hash.fetch(@game_title, @game_title)
1859
+ @currency_unit = hash.fetch(@currency_unit, @currency_unit)
1860
+ @elements.map! { |string| hash.fetch(string, string) }
1861
+ @skill_types.map! { |string| hash.fetch(string, string) }
1862
+ @weapon_types.map! { |string| hash.fetch(string, string) }
1863
+ @armor_types.map! { |string| hash.fetch(string, string) }
1864
+ @switches.map! { |string| hash.fetch(string, string) }
1865
+ @variables.map! { |string| hash.fetch(string, string) }
1866
+ @terms.in_strings(hash)
1867
+ end
1868
+
1869
+ # 用语的资料类
1870
+ class Terms
1871
+ # 基本状态
1872
+ #
1873
+ # @return [Array<String>]
1874
+ attr_accessor :basic
1875
+
1876
+ # 能力
1877
+ #
1878
+ # @return [Array<String>]
1879
+ attr_accessor :params
1880
+
1881
+ # 装备位置
1882
+ #
1883
+ # @return [Array<String>]
1884
+ attr_accessor :etypes
1885
+
1886
+ # 指令
1887
+ #
1888
+ # @return [Array<String>]
1889
+ attr_accessor :commands
1890
+
1891
+ # 用 RPG::System::Terms 初始化
1892
+ #
1893
+ # @param terms [RPG::System::Terms] 待处理的 RPG::System::Terms 对象
1894
+ #
1895
+ # @return [R3EXS::System::Terms]
1896
+ def initialize(terms)
1897
+ @basic = terms.basic
1898
+ @params = terms.params
1899
+ @etypes = terms.etypes
1900
+ @commands = terms.commands
1901
+ end
1902
+
1903
+ # 注入到 RPG::System::Terms 对象
1904
+ #
1905
+ # @param terms [RPG::System::Terms] 待注入的 RPG::System::Terms 对象
1906
+ #
1907
+ # @return [void]
1908
+ def inject_to(terms)
1909
+ terms.basic = @basic
1910
+ terms.params = @params
1911
+ terms.etypes = @etypes
1912
+ terms.commands = @commands
1913
+ end
1914
+
1915
+ # 提取所有的字符串
1916
+ #
1917
+ # @return [Array<String>]
1918
+ def ex_strings
1919
+ strings = @basic
1920
+ strings.concat(@params)
1921
+ strings.concat(@etypes)
1922
+ strings.concat(@commands)
1923
+ strings
1924
+ end
1925
+
1926
+ # 将所有的字符串替换为指定的字符串
1927
+ #
1928
+ # @param hash [Hash{String => String}] 字符串翻译表
1929
+ #
1930
+ # @return [void]
1931
+ def in_strings(hash)
1932
+ @basic.map! { |string| hash.fetch(string, string) }
1933
+ @params.map! { |string| hash.fetch(string, string) }
1934
+ @etypes.map! { |string| hash.fetch(string, string) }
1935
+ @commands.map! { |string| hash.fetch(string, string) }
1936
+ end
1937
+ end
1938
+ end
1939
+ end