R3EXS 1.1.0 → 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,1811 +1,1939 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'RGSS3'
4
-
5
- module R3EXS
6
-
7
- # 基础物品类
8
- class BaseItem
9
-
10
- # 用 RPG::BaseItem 初始化
11
- #
12
- # @param baseitem [RPG::BaseItem] 待处理的 RPG::BaseItem 对象
13
- # @param index [Integer] 在原始数组中的索引
14
- # @param with_note [Boolean] 是否处理 note 字段
15
- # @return [R3EXS::BaseItem]
16
- def initialize(baseitem, index, with_note)
17
- @index = index
18
- @name = baseitem.name
19
- @description = baseitem.description
20
- @note = baseitem.note
21
- self.remove_instance_variable(:@note) unless with_note
22
- end
23
-
24
- # 注入到 RPG::BaseItem 对象
25
- #
26
- # @param baseitem [RPG::BaseItem] 待注入的 RPG::BaseItem 对象
27
- # @return [void]
28
- def inject_to(baseitem)
29
- baseitem.name = @name
30
- baseitem.description = @description if self.instance_variable_defined?(:@description)
31
- baseitem.note = @note if self.instance_variable_defined?(:@note)
32
- end
33
-
34
- # 提取所有的字符串
35
- #
36
- # @return [Array<String>]
37
- def ex_strings
38
- strings = []
39
- strings << @name
40
- strings << @description if self.instance_variable_defined?(:@description)
41
- strings << @note if self.instance_variable_defined?(:@note)
42
- strings
43
- end
44
-
45
- # 将所有的字符串替换为指定的字符串
46
- #
47
- # @param hash [Hash<String, String>] 字符串翻译表
48
- # @return [void]
49
- def in_strings(hash)
50
- @name = hash[@name] || @name
51
- @description = hash[@description] || @description if self.instance_variable_defined?(:@description)
52
- @note = hash[@note] || @note if self.instance_variable_defined?(:@note)
53
- end
54
-
55
- # 判断是否为空
56
- #
57
- # @return [Boolean]
58
- def empty?
59
- @name.to_s.empty? && @description.to_s.empty? && @note.to_s.empty?
60
- end
61
-
62
- # 在原始数组中的索引
63
- #
64
- # @return [Integer]
65
- attr_reader :index
66
-
67
- # 物品名称
68
- #
69
- # @return [String]
70
- attr_accessor :name
71
-
72
- # 物品描述
73
- #
74
- # @return [String]
75
- attr_accessor :description
76
-
77
- # 物品注释
78
- #
79
- # @return [String]
80
- attr_accessor :note
81
- end
82
-
83
- # 角色类
84
- class Actor < BaseItem
85
-
86
- # 用 RPG::Actor 初始化
87
- #
88
- # @param actor [RPG::Actor] 待处理的 RPG::Actor 对象
89
- # @param index [Integer] 在原始数组中的索引
90
- # @param with_note [Boolean] 是否处理 note 字段
91
- # @return [R3EXS::Actor]
92
- def initialize(actor, index, with_note)
93
- super(actor, index, with_note)
94
- @nickname = actor.nickname
95
- end
96
-
97
- # 注入到 RPG::Actor 对象
98
- #
99
- # @param actor [RPG::Actor] 待注入的 RPG::Actor 对象
100
- # @return [void]
101
- def inject_to(actor)
102
- super(actor)
103
- actor.nickname = @nickname
104
- end
105
-
106
- # 提取所有的字符串
107
- #
108
- # @return [Array<String>]
109
- def ex_strings
110
- strings = super
111
- strings << @nickname
112
- strings
113
- end
114
-
115
- # 将所有的字符串替换为指定的字符串
116
- #
117
- # @param hash [Hash<String, String>] 字符串翻译表
118
- # @return [void]
119
- def in_strings(hash)
120
- super(hash)
121
- @nickname = hash[@nickname] || @nickname
122
- end
123
-
124
- # 判断是否为空
125
- #
126
- # @return [Boolean]
127
- def empty?
128
- super && @nickname.to_s.empty?
129
- end
130
-
131
- # 昵称
132
- #
133
- # @return [String]
134
- attr_accessor :nickname
135
- end
136
-
137
- # 动画类
138
- class Animation
139
-
140
- # 用 RPG::Animation 初始化
141
- #
142
- # @param animation [RPG::Animation] 待处理的 RPG::Animation 对象
143
- # @param index [Integer] 在原始数组中的索引
144
- # @return [R3EXS::Animation]
145
- def initialize(animation, index, _unused = nil)
146
- @index = index
147
- @name = animation.name
148
- end
149
-
150
- # 注入到 RPG::Animation 对象
151
- #
152
- # @param animation [RPG::Animation] 待注入的 RPG::Animation 对象
153
- # @return [void]
154
- def inject_to(animation)
155
- animation.name = @name
156
- end
157
-
158
- # 提取所有的字符串
159
- #
160
- # @return [Array<String>]
161
- def ex_strings
162
- [@name]
163
- end
164
-
165
- # 将所有的字符串替换为指定的字符串
166
- #
167
- # @param hash [Hash<String, String>] 字符串翻译表
168
- # @return [void]
169
- def in_strings(hash)
170
- @name = hash[@name] || @name
171
- end
172
-
173
- # 判断是否为空
174
- #
175
- # @return [Boolean]
176
- def empty?
177
- @name.to_s.empty?
178
- end
179
-
180
- # 在原始数组中的索引
181
- #
182
- # @return [Integer]
183
- attr_reader :index
184
-
185
- # 动画名称
186
- #
187
- # @return [String]
188
- attr_accessor :name
189
- end
190
-
191
- # 可装备物品类
192
- class EquipItem < BaseItem
193
-
194
- # RPG::EquipItem 初始化
195
- #
196
- # @param equipitem [RPG::EquipItem] 待处理的 RPG::EquipItem 对象
197
- # @param index [Integer] 在原始数组中的索引
198
- # @param with_note [Boolean] 是否处理 note 字段
199
- # @return [R3EXS::EquipItem]
200
- def initialize(equipitem, index, with_note)
201
- super(equipitem, index, with_note)
202
- end
203
-
204
- # 注入到 RPG::EquipItem 对象
205
- #
206
- # @param equipitem [RPG::EquipItem] 待注入的 RPG::EquipItem 对象
207
- # @return [void]
208
- def inject_to(equipitem)
209
- super
210
- end
211
-
212
- # 提取所有的字符串
213
- #
214
- # @return [Array<String>]
215
- def ex_strings
216
- super
217
- end
218
-
219
- # 将所有的字符串替换为指定的字符串
220
- #
221
- # @param hash [Hash<String, String>] 字符串翻译表
222
- # @return [void]
223
- def in_strings(hash)
224
- super(hash)
225
- end
226
-
227
- # 判断是否为空
228
- #
229
- # @return [Boolean]
230
- def empty?
231
- super
232
- end
233
-
234
- end
235
-
236
- # 护甲类
237
- class Armor < EquipItem
238
-
239
- # RPG::Armor 初始化
240
- #
241
- # @param armor [RPG::Armor] 待处理的 RPG::Armor 对象
242
- # @param index [Integer] 在原始数组中的索引
243
- # @param with_note [Boolean] 是否处理 note 字段
244
- # @return [R3EXS::Armor]
245
- def initialize(armor, index, with_note)
246
- super(armor, index, with_note)
247
- end
248
-
249
- # 注入到 RPG::Armor 对象
250
- #
251
- # @param armor [RPG::Armor] 待注入的 RPG::Armor 对象
252
- # @return [void]
253
- def inject_to(armor)
254
- super
255
- end
256
-
257
- # 提取所有的字符串
258
- #
259
- # @return [Array<String>]
260
- def ex_strings
261
- super
262
- end
263
-
264
- # 将所有的字符串替换为指定的字符串
265
- #
266
- # @param hash [Hash<String, String>] 字符串翻译表
267
- # @return [void]
268
- def in_strings(hash)
269
- super(hash)
270
- end
271
-
272
- # 判断是否为空
273
- #
274
- # @return [Boolean]
275
- def empty?
276
- super
277
- end
278
-
279
- end
280
-
281
- # 职业类
282
- class Class < BaseItem
283
-
284
- # 学习技能类
285
- class Learning
286
-
287
- # 用 RPG::Class::Learning 初始化
288
- #
289
- # @param learning [RPG::Class::Learning] 待处理的 RPG::Class::Learning 对象
290
- # @param index [Integer] 在原始数组中的索引
291
- # @return [R3EXS::Class::Learning]
292
- def initialize(learning, index)
293
- @index = index
294
- @note = learning.note
295
- end
296
-
297
- # 注入到 RPG::Class::Learning 对象
298
- #
299
- # @param learning [RPG::Class::Learning] 待注入的 RPG::Class::Learning 对象
300
- # @return [void]
301
- def inject_to(learning)
302
- learning.note = @note
303
- end
304
-
305
- # 提取所有的字符串
306
- #
307
- # @return [Array<String>]
308
- def ex_strings
309
- [@note]
310
- end
311
-
312
- # 将所有的字符串替换为指定的字符串
313
- #
314
- # @param hash [Hash<String, String>] 字符串翻译表
315
- # @return [void]
316
- def in_strings(hash)
317
- @note = hash[@note] || @note
318
- end
319
-
320
- # 判断是否为空
321
- #
322
- # @return [Boolean]
323
- def empty?
324
- @note.to_s.empty?
325
- end
326
-
327
- # 在原始数组中的索引
328
- #
329
- # @return [Integer]
330
- attr_reader :index
331
-
332
- # 学习技能注释
333
- #
334
- # @return [String]
335
- attr_accessor :note
336
- end
337
-
338
- # 用 RPG::Class 初始化
339
- #
340
- # @param klass [RPG::Class] 待处理的 RPG::Class 对象
341
- # @param index [Integer] 在原始数组中的索引
342
- # @param with_note [Boolean] 是否处理 note 字段
343
- # @return [R3EXS::Class]
344
- def initialize(klass, index, with_note)
345
- super(klass, index, with_note)
346
- @learnings = []
347
- klass.learnings.each_with_index do |learning, learning_index|
348
- next if learning == nil
349
- learning_r3exs = R3EXS::Class::Learning.new(learning, learning_index)
350
- @learnings << learning_r3exs unless learning_r3exs.empty?
351
- end
352
- self.remove_instance_variable(:@description)
353
- self.remove_instance_variable(:@learnings) unless with_note
354
- end
355
-
356
- # 注入到 RPG::Class 对象
357
- #
358
- # @param klass [RPG::Class] 待注入的 RPG::Class 对象
359
- # @return [void]
360
- def inject_to(klass)
361
- super(klass)
362
- if self.instance_variable_defined?(:@learnings)
363
- @learnings.each do |learning|
364
- learning.inject_to(klass.learnings[learning.index])
365
- end
366
- end
367
- end
368
-
369
- # 提取所有的字符串
370
- #
371
- # @return [Array<String>]
372
- def ex_strings
373
- strings = super
374
- if self.instance_variable_defined?(:@learnings)
375
- @learnings.each do |learning|
376
- strings.concat(learning.ex_strings)
377
- end
378
- end
379
- strings
380
- end
381
-
382
- # 将所有的字符串替换为指定的字符串
383
- #
384
- # @param hash [Hash<String, String>] 字符串翻译表
385
- # @return [void]
386
- def in_strings(hash)
387
- super(hash)
388
- if self.instance_variable_defined?(:@learnings)
389
- @learnings.each do |learning|
390
- learning.in_strings(hash)
391
- end
392
- end
393
- end
394
-
395
- # 判断是否为空
396
- #
397
- # @return [Boolean]
398
- def empty?
399
- super && @learnings.to_a.empty?
400
- end
401
-
402
- attr_accessor :learnings
403
- end
404
-
405
- # 移动指令类
406
- class MoveCommand
407
-
408
- # RPG::MoveCommand 初始化
409
- #
410
- # @param movecommand [RPG::MoveCommand] 待处理的 RPG::MoveCommand 对象
411
- # @param index [Integer] 在原始数组中的索引
412
- # @return [R3EXS::MoveCommand]
413
- def initialize(movecommand, index)
414
- if movecommand.code == 45
415
- @index = index
416
- @code = 45
417
- @usage = 'MoveCommandScript'
418
- @parameter = movecommand.parameters[0]
419
- else
420
- @index = -1
421
- end
422
- end
423
-
424
- # 注入到 RPG::MoveCommand 对象
425
- #
426
- # @param movecommand [RPG::MoveCommand] 待注入的 RPG::MoveCommand 对象
427
- # @return [void]
428
- def inject_to(movecommand)
429
- movecommand.parameters[0] = @parameter
430
- end
431
-
432
- # 提取所有的字符串
433
- #
434
- # @return [Array<String>]
435
- def ex_strings
436
- [@parameter]
437
- end
438
-
439
- # 将所有的字符串替换为指定的字符串
440
- #
441
- # @param hash [Hash<String, String>] 字符串翻译表
442
- # @return [void]
443
- def in_strings(hash)
444
- @parameter = hash[@parameter] || @parameter
445
- end
446
-
447
- # 判断是否为空
448
- #
449
- # @return [Boolean]
450
- def empty?
451
- @index == -1
452
- end
453
-
454
- # 在原始数组中的索引
455
- #
456
- # @return [Integer]
457
- attr_accessor :index
458
-
459
- # 移动指令代码
460
- #
461
- # @return [Integer]
462
- attr_accessor :code
463
-
464
- # 移动指令用途
465
- #
466
- # @return [String]
467
- attr_accessor :usage
468
-
469
- # 移动指令参数
470
- #
471
- # @return [String]
472
- attr_accessor :parameter
473
- end
474
-
475
- # 移动路线类
476
- class MoveRoute
477
-
478
- # RPG::MoveRoute 初始化
479
- #
480
- # @param moveroute [RPG::MoveRoute] 待处理的 RPG::MoveRoute 对象
481
- # @return [R3EXS::MoveRoute]
482
- def initialize(moveroute)
483
- @list = []
484
- moveroute.list.each_with_index do |movecommand, index|
485
- next if movecommand == nil
486
- movecommand_r3exs = R3EXS::MoveCommand.new(movecommand, index)
487
- @list << movecommand_r3exs unless movecommand_r3exs.empty?
488
- end
489
- end
490
-
491
- # 注入到 RPG::MoveRoute 对象
492
- #
493
- # @param moveroute [RPG::MoveRoute] 待注入的 RPG::MoveRoute 对象
494
- # @return [void]
495
- def inject_to(moveroute)
496
- @list.each do |movecommand|
497
- movecommand.inject_to(moveroute.list[movecommand.index])
498
- end
499
- end
500
-
501
- # 提取所有的字符串
502
- #
503
- # @return [Array<String>]
504
- def ex_strings
505
- strings = []
506
- @list.each do |movecommand|
507
- strings.concat(movecommand.ex_strings)
508
- end
509
- strings
510
- end
511
-
512
- # 将所有的字符串替换为指定的字符串
513
- #
514
- # @param hash [Hash<String, String>] 字符串翻译表
515
- # @return [void]
516
- def in_strings(hash)
517
- @list.each do |movecommand|
518
- movecommand.in_strings(hash)
519
- end
520
- end
521
-
522
- # 判断是否为空
523
- #
524
- # @return [Boolean]
525
- def empty?
526
- @list.empty?
527
- end
528
-
529
- # 移动指令列表
530
- #
531
- # @return [Array<R3EXS::MoveCommand>]
532
- attr_accessor :list
533
- end
534
-
535
- # 事件指令类
536
- class EventCommand
537
-
538
- # 用 RPG::EventCommand 初始化
539
- #
540
- # @param eventcommand [RPG::EventCommand] 待处理的 RPG::EventCommand 对象
541
- # @param index [Integer] 在原始数组中的索引
542
- # @return [R3EXS::EventCommand]
543
- def initialize(eventcommand, index)
544
- case eventcommand.code
545
- when 102 # ShowChoices
546
- @index = index
547
- @code = 102
548
- @usage = Utils::EVENT_COMMANDS[102]
549
- @parameter = eventcommand.parameters[0]
550
- when 108 # Comment
551
- @index = index
552
- @code = 108
553
- @usage = Utils::EVENT_COMMANDS[108]
554
- @parameter = eventcommand.parameters[0]
555
- when 111 # ConditionalBranch
556
- @index = index
557
- @code = 111
558
- @usage = Utils::EVENT_COMMANDS[111]
559
- if eventcommand.parameters[0] == 4 && eventcommand.parameters[2] == 1
560
- @parameter = eventcommand.parameters[3]
561
- elsif eventcommand.parameters[0] == 12
562
- @parameter = eventcommand.parameters[1]
563
- else
564
- @index = -1
565
- end
566
- when 118 # Label
567
- @index = index
568
- @code = 118
569
- @usage = Utils::EVENT_COMMANDS[118]
570
- @parameter = eventcommand.parameters[0]
571
- when 119 # JumpToLabel
572
- @index = index
573
- @code = 119
574
- @usage = Utils::EVENT_COMMANDS[119]
575
- @parameter = eventcommand.parameters[0]
576
- when 122 # ControlVariables
577
- if eventcommand.parameters[3] == 4
578
- @index = index
579
- @code = 122
580
- @usage = Utils::EVENT_COMMANDS[122]
581
- @parameter = eventcommand.parameters[4]
582
- else
583
- @index = -1
584
- end
585
- when 205 # SetMoveRoute
586
- moveroute_r3exs = R3EXS::MoveRoute.new(eventcommand.parameters[1])
587
- if moveroute_r3exs.empty?
588
- @index = -1 # 如果 MoveRoute 里面没有可提取的 MoveCommand ,就将索引设为-1,empty? 将据此判断是否为空
589
- else
590
- @index = index
591
- @code = 205
592
- @usage = Utils::EVENT_COMMANDS[205]
593
- @parameter = moveroute_r3exs
594
- end
595
- when 320 # ChangeActorName
596
- @index = index
597
- @code = 320
598
- @usage = Utils::EVENT_COMMANDS[320]
599
- @parameter = eventcommand.parameters[1]
600
- when 324 # ChangeActorNickname
601
- @index = index
602
- @code = 324
603
- @usage = Utils::EVENT_COMMANDS[324]
604
- @parameter = eventcommand.parameters[1]
605
- when 355 # Script
606
- @index = index
607
- @code = 355
608
- @usage = Utils::EVENT_COMMANDS[355]
609
- @parameter = eventcommand.parameters[0]
610
- when 401 # ShowText
611
- @index = index
612
- @code = 401
613
- @usage = Utils::EVENT_COMMANDS[401]
614
- @parameter = eventcommand.parameters[0]
615
- when 402 # When
616
- @index = index
617
- @code = 402
618
- @usage = Utils::EVENT_COMMANDS[402]
619
- @parameter = eventcommand.parameters[1]
620
- when 405 # ShowScrollingText
621
- @index = index
622
- @code = 405
623
- @usage = Utils::EVENT_COMMANDS[405]
624
- @parameter = eventcommand.parameters[0]
625
- when 408 # CommentMore
626
- @index = index
627
- @code = 408
628
- @usage = Utils::EVENT_COMMANDS[408]
629
- @parameter = eventcommand.parameters[0]
630
- when 505 # MoveRoute
631
- movecommand_r3exs = R3EXS::MoveCommand.new(eventcommand.parameters[0], 0)
632
- if movecommand_r3exs.empty?
633
- @index = -1
634
- else
635
- @index = index
636
- @code = 505
637
- @usage = Utils::EVENT_COMMANDS[505]
638
- @parameter = movecommand_r3exs
639
- end
640
- when 655 # ScriptMore
641
- @index = index
642
- @code = 655
643
- @usage = Utils::EVENT_COMMANDS[655]
644
- @parameter = eventcommand.parameters[0]
645
- else
646
- @index = -1 # 如果不是以上的事件指令,就将索引设为-1,empty? 将据此判断是否为空
647
- end
648
- end
649
-
650
- # 注入到 RPG::EventCommand 对象
651
- #
652
- # @param eventcommand [RPG::EventCommand] 待注入的 RPG::EventCommand 对象
653
- # @return [void]
654
- def inject_to(eventcommand)
655
- case eventcommand.code
656
- when 102 # ShowChoices
657
- eventcommand.parameters[0] = @parameter
658
- when 108 # Comment
659
- eventcommand.parameters[0] = @parameter
660
- when 111 # ConditionalBranch
661
- if eventcommand.parameters[0] == 4 && eventcommand.parameters[2] == 1
662
- eventcommand.parameters[3] = @parameter
663
- elsif eventcommand.parameters[0] == 12
664
- eventcommand.parameters[1] = @parameter
665
- end
666
- when 118 # Label
667
- eventcommand.parameters[0] = @parameter
668
- when 119 # JumpToLabel
669
- eventcommand.parameters[0] = @parameter
670
- when 122 # ControlVariables
671
- eventcommand.parameters[4] = @parameter
672
- when 205 # SetMoveRoute
673
- @parameter.inject_to(eventcommand.parameters[1])
674
- when 320 # ChangeActorName
675
- eventcommand.parameters[1] = @parameter
676
- when 324 # ChangeActorNickname
677
- eventcommand.parameters[1] = @parameter
678
- when 355 # Script
679
- eventcommand.parameters[0] = @parameter
680
- when 401 # ShowText
681
- eventcommand.parameters[0] = @parameter
682
- when 402 # When
683
- eventcommand.parameters[1] = @parameter
684
- when 405 # ShowScrollingText
685
- eventcommand.parameters[0] = @parameter
686
- when 408 # CommentMore
687
- eventcommand.parameters[0] = @parameter
688
- when 505 # MoveRoute
689
- @parameter.inject_to(eventcommand.parameters[0])
690
- when 655 # ScriptMore
691
- eventcommand.parameters[0] = @parameter
692
- else
693
- puts "Unknown code: #{eventcommand.code}"
694
- end
695
- end
696
-
697
- # 提取所有的字符串
698
- #
699
- # @return [Array<String>]
700
- def ex_strings
701
- case @code
702
- when 102 # ShowChoices 是一个特殊的事件指令,它的参数是一个数组
703
- @parameter
704
- when 108, 111, 118, 119, 122, 320, 324, 355, 401, 402, 405, 408, 655
705
- [@parameter]
706
- when 205
707
- @parameter.ex_strings
708
- when 505
709
- @parameter.ex_strings
710
- else
711
- puts "Unknown code: #{@code}"
712
- []
713
- end
714
- end
715
-
716
- # 将所有的字符串替换为指定的字符串
717
- #
718
- # @param hash [Hash<String, String>] 字符串翻译表
719
- # @return [void]
720
- def in_strings(hash)
721
- case @code
722
- when 102 # ShowChoices 是一个特殊的事件指令,它的参数是一个数组
723
- @parameter.map! { |string| hash[string] || string }
724
- when 108, 111, 118, 119, 122, 320, 324, 355, 401, 402, 405, 408, 655
725
- @parameter = hash[@parameter] || @parameter
726
- when 205
727
- @parameter.in_strings(hash)
728
- when 505
729
- @parameter.in_strings(hash)
730
- else
731
- puts "Unknown code: #{@code}"
732
- end
733
- end
734
-
735
- # 判断是否为空
736
- #
737
- # @return [Boolean]
738
- def empty?
739
- @index == -1
740
- end
741
-
742
- # 在原始数组中的索引
743
- #
744
- # @return [Integer]
745
- attr_accessor :index
746
-
747
- # 事件指令代码
748
- #
749
- # @return [Integer]
750
- attr_accessor :code
751
-
752
- # 事件指令用途
753
- #
754
- # @return [String]
755
- attr_accessor :usage
756
-
757
- # 事件指令参数
758
- #
759
- # @note '@code' 为 102 时, parameter 是一个字符串数组
760
- #
761
- # @return [String] if @code != 102
762
- # @return [Array<String>] if @code == 102
763
- attr_accessor :parameter
764
- end
765
-
766
- # 公共事件类
767
- class CommonEvent
768
-
769
- # RPG::CommonEvent 初始化
770
- #
771
- # @param commonevent [RPG::CommonEvent] 待处理的 RPG::CommonEvent 对象
772
- # @param index [Integer] 在原始数组中的索引
773
- # @return [R3EXS::CommonEvent]
774
- def initialize(commonevent, index, _unused = nil)
775
- @index = index
776
- @name = commonevent.name
777
- @list = []
778
- commonevent.list.each_with_index do |eventcommand, eventcommand_index|
779
- next if eventcommand == nil
780
- eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
781
- @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
782
- end
783
- end
784
-
785
- # 注入到 RPG::CommonEvent 对象
786
- # @param commonevent [RPG::CommonEvent] 待注入的 RPG::CommonEvent 对象
787
- # @return [void]
788
- def inject_to(commonevent)
789
- commonevent.name = @name
790
- @list.each do |eventcommand|
791
- eventcommand.inject_to(commonevent.list[eventcommand.index])
792
- end
793
- end
794
-
795
- # 提取所有的字符串
796
- #
797
- # @return [Array<String>]
798
- def ex_strings
799
- strings = [@name]
800
- @list.each do |eventcommand|
801
- strings.concat(eventcommand.ex_strings)
802
- end
803
- strings
804
- end
805
-
806
- # 将所有的字符串替换为指定的字符串
807
- #
808
- # @param hash [Hash<String, String>] 字符串翻译表
809
- # @return [void]
810
- def in_strings(hash)
811
- @name = hash[@name] || @name
812
- @list.each do |eventcommand|
813
- eventcommand.in_strings(hash)
814
- end
815
- end
816
-
817
- # 判断是否为空
818
- #
819
- # @return [Boolean]
820
- def empty?
821
- @name.to_s.empty? && @list.empty?
822
- end
823
-
824
- # 在原始数组中的索引
825
- #
826
- # @return [Integer]
827
- attr_accessor :index
828
-
829
- # 公共事件名称
830
- #
831
- # @return [String]
832
- attr_accessor :name
833
-
834
- # 事件指令列表
835
- #
836
- # @return [Array<R3EXS::EventCommand>]
837
- attr_accessor :list
838
- end
839
-
840
- # 敌人类
841
- class Enemy < BaseItem
842
-
843
- # 用 RPG::Enemy 初始化
844
- #
845
- # @param enemy [RPG::Enemy] 待处理的 RPG::Enemy 对象
846
- # @param index [Integer] 在原始数组中的索引
847
- # @param with_note [Boolean] 是否处理 note 字段
848
- # @return [R3EXS::Enemy]
849
- def initialize(enemy, index, with_note)
850
- super(enemy, index, with_note)
851
- self.remove_instance_variable(:@description)
852
- end
853
-
854
- # 注入到 RPG::Enemy 对象
855
- #
856
- # @param enemy [RPG::Enemy] 待注入的 RPG::Enemy 对象
857
- # @return [void]
858
- def inject_to(enemy)
859
- super
860
- end
861
-
862
- # 提取所有的字符串
863
- #
864
- # @return [Array<String>]
865
- def ex_strings
866
- super
867
- end
868
-
869
- # 将所有的字符串替换为指定的字符串
870
- #
871
- # @param hash [Hash<String, String>] 字符串翻译表
872
- # @return [void]
873
- def in_strings(hash)
874
- super(hash)
875
- end
876
-
877
- # 判断是否为空
878
- #
879
- # @return [Boolean]
880
- def empty?
881
- super
882
- end
883
-
884
- end
885
-
886
- # 可使用物品类
887
- class UsableItem < BaseItem
888
-
889
- # 用 RPG::UsableItem 初始化
890
- #
891
- # @param usableitem [RPG::UsableItem] 待处理的 RPG::UsableItem 对象
892
- # @param index [Integer] 在原始数组中的索引
893
- # @param with_note [Boolean] 是否处理 note 字段
894
- # @return [R3EXS::UsableItem]
895
- def initialize(usableitem, index, with_note)
896
- super(usableitem, index, with_note)
897
- end
898
-
899
- # 注入到 RPG::UsableItem 对象
900
- #
901
- # @param usableitem [RPG::UsableItem] 待注入的 RPG::UsableItem 对象
902
- # @return [void]
903
- def inject_to(usableitem)
904
- super
905
- end
906
-
907
- # 提取所有的字符串
908
- #
909
- # @return [Array<String>]
910
- def ex_strings
911
- super
912
- end
913
-
914
- # 将所有的字符串替换为指定的字符串
915
- #
916
- # @param hash [Hash<String, String>] 字符串翻译表
917
- # @return [void]
918
- def in_strings(hash)
919
- super(hash)
920
- end
921
-
922
- # 判断是否为空
923
- #
924
- # @return [Boolean]
925
- def empty?
926
- super
927
- end
928
- end
929
-
930
- # 物品类
931
- class Item < UsableItem
932
-
933
- # 用 RPG::Item 初始化
934
- #
935
- # @param item [RPG::Item] 待处理的 RPG::Item 对象
936
- # @param index [Integer] 在原始数组中的索引
937
- # @param with_note [Boolean] 是否处理 note 字段
938
- # @return [R3EXS::Item]
939
- def initialize(item, index, with_note)
940
- super(item, index, with_note)
941
- end
942
-
943
- # 注入到 RPG::Item 对象
944
- # @param item [RPG::Item] 待注入的 RPG::Item 对象
945
- # @return [void]
946
- def inject_to(item)
947
- super
948
- end
949
-
950
- # 提取所有的字符串
951
- #
952
- # @return [Array<String>]
953
- def ex_strings
954
- super
955
- end
956
-
957
- # 将所有的字符串替换为指定的字符串
958
- #
959
- # @param hash [Hash<String, String>] 字符串翻译表
960
- # @return [void]
961
- def in_strings(hash)
962
- super(hash)
963
- end
964
-
965
- # 判断是否为空
966
- #
967
- # @return [Boolean]
968
- def empty?
969
- super
970
- end
971
- end
972
-
973
- # 事件类
974
- class Event
975
-
976
- # 事件页类
977
- class Page
978
-
979
- # 用 RPG::Event::Page 初始化
980
- #
981
- # @param page [RPG::Event::Page] 待处理的 RPG::Event::Page 对象
982
- # @param index [Integer] 在原始数组中的索引
983
- # @return [R3EXS::Event::Page]
984
- def initialize(page, index)
985
- @index = index
986
- @list = []
987
- page.list.each_with_index do |eventcommand, eventcommand_index|
988
- next if eventcommand == nil
989
- eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
990
- @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
991
- end
992
- end
993
-
994
- # 注入到 RPG::Event::Page 对象
995
- #
996
- # @param page [RPG::Event::Page] 待注入的 RPG::Event::Page 对象
997
- # @return [void]
998
- def inject_to(page)
999
- @list.each do |eventcommand|
1000
- eventcommand.inject_to(page.list[eventcommand.index])
1001
- end
1002
- end
1003
-
1004
- # 提取所有的字符串
1005
- #
1006
- # @return [Array<String>]
1007
- def ex_strings
1008
- strings = []
1009
- @list.each do |eventcommand|
1010
- strings.concat(eventcommand.ex_strings)
1011
- end
1012
- strings
1013
- end
1014
-
1015
- # 将所有的字符串替换为指定的字符串
1016
- #
1017
- # @param hash [Hash<String, String>] 字符串翻译表
1018
- # @return [void]
1019
- def in_strings(hash)
1020
- @list.each do |eventcommand|
1021
- eventcommand.in_strings(hash)
1022
- end
1023
- end
1024
-
1025
- # 判断是否为空
1026
- #
1027
- # @return [Boolean]
1028
- def empty?
1029
- @list.empty?
1030
- end
1031
-
1032
- # 在原始数组中的索引
1033
- #
1034
- # @return [Integer]
1035
- attr_accessor :index
1036
-
1037
- # 事件指令列表
1038
- #
1039
- # @return [Array<R3EXS::EventCommand>]
1040
- attr_accessor :list
1041
- end
1042
-
1043
- # 用 RPG::Event 初始化
1044
- #
1045
- # @param event [RPG::Event] 待处理的 RPG::Event 对象
1046
- # @param index [Integer] 在原始哈希表中的键
1047
- # @return [R3EXS::Event]
1048
- def initialize(event, index)
1049
- @index = index
1050
- @name = event.name
1051
- @pages = []
1052
- event.pages.each_with_index do |page, page_index|
1053
- next if page == nil
1054
- page_r3exs = R3EXS::Event::Page.new(page, page_index)
1055
- @pages << page_r3exs unless page_r3exs.empty?
1056
- end
1057
- end
1058
-
1059
- # 注入到 RPG::Event 对象
1060
- #
1061
- # @param event [RPG::Event] 待注入的 RPG::Event 对象
1062
- # @return [void]
1063
- def inject_to(event)
1064
- event.name = @name
1065
- @pages.each do |page|
1066
- page.inject_to(event.pages[page.index])
1067
- end
1068
- end
1069
-
1070
- # 提取所有的字符串
1071
- #
1072
- # @return [Array<String>]
1073
- def ex_strings
1074
- strings = [@name]
1075
- @pages.each do |page|
1076
- strings.concat(page.ex_strings)
1077
- end
1078
- strings
1079
- end
1080
-
1081
- # 将所有的字符串替换为指定的字符串
1082
- #
1083
- # @param hash [Hash<String, String>] 字符串翻译表
1084
- # @return [void]
1085
- def in_strings(hash)
1086
- @name = hash[@name] || @name
1087
- @pages.each do |page|
1088
- page.in_strings(hash)
1089
- end
1090
- end
1091
-
1092
- # 判断是否为空
1093
- #
1094
- # @return [Boolean]
1095
- def empty?
1096
- @name.to_s.empty? && @pages.empty?
1097
- end
1098
-
1099
- # 在原始哈希表中的键
1100
- #
1101
- # @return [Integer]
1102
- attr_accessor :index
1103
-
1104
- # 事件名称
1105
- #
1106
- # @return [String]
1107
- attr_accessor :name
1108
-
1109
- # 事件页列表
1110
- #
1111
- # @return [Array<R3EXS::Event::Page>]
1112
- attr_accessor :pages
1113
- end
1114
-
1115
- # 地图类
1116
- class Map
1117
-
1118
- # 用 RPG::Map 初始化
1119
- # @param map [RPG::Map] 待处理的 RPG::Map 对象
1120
- # @param with_note [Boolean] 是否处理 note 字段
1121
- # @return [R3EXS::Map]
1122
- def initialize(map, with_note)
1123
- @display_name = map.display_name
1124
- @note = map.note
1125
- @events = []
1126
- map.events.each do |key, event|
1127
- next if event == nil
1128
- event_r3exs = R3EXS::Event.new(event, key)
1129
- @events << event_r3exs unless event_r3exs.empty?
1130
- end
1131
- self.remove_instance_variable(:@note) unless with_note
1132
- end
1133
-
1134
- # 注入到 RPG::Map 对象
1135
- #
1136
- # @param map [RPG::Map] 待注入的 RPG::Map 对象
1137
- # @return [void]
1138
- def inject_to(map)
1139
- map.display_name = @display_name
1140
- map.note = @note if self.instance_variable_defined?(:@note)
1141
- @events.each do |event|
1142
- event.inject_to(map.events[event.index])
1143
- end
1144
- end
1145
-
1146
- # 提取所有的字符串
1147
- #
1148
- # @return [Array<String>]
1149
- def ex_strings
1150
- strings = []
1151
- strings << @display_name
1152
- strings << @note if self.instance_variable_defined?(:@note)
1153
- @events.each do |event|
1154
- strings.concat(event.ex_strings)
1155
- end
1156
- strings
1157
- end
1158
-
1159
- # 将所有的字符串替换为指定的字符串
1160
- #
1161
- # @param hash [Hash<String, String>] 字符串翻译表
1162
- # @return [void]
1163
- def in_strings(hash)
1164
- @display_name = hash[@display_name] || @display_name
1165
- @note = hash[@note] || @note if self.instance_variable_defined?(:@note)
1166
- @events.each do |event|
1167
- event.in_strings(hash)
1168
- end
1169
- end
1170
-
1171
- # 地图显示名称
1172
- #
1173
- # @return [String]
1174
- attr_accessor :display_name
1175
-
1176
- # 地图注释
1177
- #
1178
- # @return [String]
1179
- attr_accessor :note
1180
-
1181
- # 事件列表
1182
- #
1183
- # @return [Array<R3EXS::Event>]
1184
- attr_accessor :events
1185
- end
1186
-
1187
- # 地图信息类
1188
- class MapInfo
1189
-
1190
- # 用 RPG::MapInfo 初始化
1191
- # @param mapinfo [RPG::MapInfo] 待处理的 RPG::MapInfo 对象
1192
- # @param index [Integer] 在原始哈希表中的键
1193
- # @return [R3EXS::MapInfo]
1194
- def initialize(mapinfo, index, _unused = nil)
1195
- @index = index
1196
- @name = mapinfo.name
1197
- end
1198
-
1199
- # 注入到 RPG::MapInfo 对象
1200
- #
1201
- # @param mapinfo [RPG::MapInfo] 待注入的 RPG::MapInfo 对象
1202
- # @return [void]
1203
- def inject_to(mapinfo)
1204
- mapinfo.name = @name
1205
- end
1206
-
1207
- # 提取所有的字符串
1208
- #
1209
- # @return [Array<String>]
1210
- def ex_strings
1211
- [@name]
1212
- end
1213
-
1214
- # 将所有的字符串替换为指定的字符串
1215
- #
1216
- # @param hash [Hash<String, String>] 字符串翻译表
1217
- # @return [void]
1218
- def in_strings(hash)
1219
- @name = hash[@name] || @name
1220
- end
1221
-
1222
- # 在原始哈希表中的键
1223
- #
1224
- # @return [Integer]
1225
- attr_accessor :index
1226
-
1227
- # 地图内部名称
1228
- #
1229
- # @return [String]
1230
- attr_accessor :name
1231
- end
1232
-
1233
- # 技能类
1234
- class Skill < UsableItem
1235
-
1236
- # 用 RPG::Skill 初始化
1237
- # @param skill [RPG::Skill] 待处理的 RPG::Skill 对象
1238
- # @param index [Integer] 在原始数组中的索引
1239
- # @param with_note [Boolean] 是否处理 note 字段
1240
- # @return [R3EXS::Skill]
1241
- def initialize(skill, index, with_note)
1242
- super(skill, index, with_note)
1243
- @message1 = skill.message1
1244
- @message2 = skill.message2
1245
- end
1246
-
1247
- # 注入到 RPG::Skill 对象
1248
- #
1249
- # @param skill [RPG::Skill] 待注入的 RPG::Skill 对象
1250
- # @return [void]
1251
- def inject_to(skill)
1252
- super
1253
- skill.message1 = @message1
1254
- skill.message2 = @message2
1255
- end
1256
-
1257
- # 提取所有的字符串
1258
- #
1259
- # @return [Array<String>]
1260
- def ex_strings
1261
- strings = super
1262
- strings << @message1
1263
- strings << @message2
1264
- strings
1265
- end
1266
-
1267
- # 将所有的字符串替换为指定的字符串
1268
- #
1269
- # @param hash [Hash<String, String>] 字符串翻译表
1270
- # @return [void]
1271
- def in_strings(hash)
1272
- super(hash)
1273
- @message1 = hash[@message1] || @message1
1274
- @message2 = hash[@message2] || @message2
1275
- end
1276
-
1277
- # 判断是否为空
1278
- #
1279
- # @return [Boolean]
1280
- def empty?
1281
- super && @message1.to_s.empty? && @message2.to_s.empty?
1282
- end
1283
-
1284
- # 技能使用时的消息
1285
- #
1286
- # @return [String]
1287
- attr_accessor :message1
1288
-
1289
- # 技能使用时的消息
1290
- #
1291
- # @return [String]
1292
- attr_accessor :message2
1293
- end
1294
-
1295
- # 状态类
1296
- class State < BaseItem
1297
-
1298
- # RPG::State 初始化
1299
- #
1300
- # @param state [RPG::State] 待处理的 RPG::State 对象
1301
- # @param index [Integer] 在原始数组中的索引
1302
- # @param with_note [Boolean] 是否处理 note 字段
1303
- # @return [R3EXS::State]
1304
- def initialize(state, index, with_note)
1305
- super(state, index, with_note)
1306
- @message1 = state.message1
1307
- @message2 = state.message2
1308
- @message3 = state.message3
1309
- @message4 = state.message4
1310
- self.remove_instance_variable(:@description)
1311
- end
1312
-
1313
- # 注入到 RPG::State 对象
1314
- #
1315
- # @param state [RPG::State] 待注入的 RPG::State 对象
1316
- # @return [void]
1317
- def inject_to(state)
1318
- super
1319
- state.message1 = @message1
1320
- state.message2 = @message2
1321
- state.message3 = @message3
1322
- state.message4 = @message4
1323
- end
1324
-
1325
- # 提取所有的字符串
1326
- #
1327
- # @return [Array<String>]
1328
- def ex_strings
1329
- strings = super
1330
- strings << @message1
1331
- strings << @message2
1332
- strings << @message3
1333
- strings << @message4
1334
- strings
1335
- end
1336
-
1337
- # 将所有的字符串替换为指定的字符串
1338
- #
1339
- # @param hash [Hash<String, String>] 字符串翻译表
1340
- # @return [void]
1341
- def in_strings(hash)
1342
- super(hash)
1343
- @message1 = hash[@message1] || @message1
1344
- @message2 = hash[@message2] || @message2
1345
- @message3 = hash[@message3] || @message3
1346
- @message4 = hash[@message4] || @message4
1347
- end
1348
-
1349
- # 判断是否为空
1350
- #
1351
- # @return [Boolean]
1352
- def empty?
1353
- super && @message1.to_s.empty? && @message2.to_s.empty? && @message3.to_s.empty? && @message4.to_s.empty?
1354
- end
1355
-
1356
- # 状态应用队员时的消息
1357
- #
1358
- # @return [String]
1359
- attr_accessor :message1
1360
-
1361
- # 状态应用敌人时的消息
1362
- #
1363
- # @return [String]
1364
- attr_accessor :message2
1365
-
1366
- # 状态保持时的消息
1367
- #
1368
- # @return [String]
1369
- attr_accessor :message3
1370
-
1371
- # 状态解除时的消息
1372
- #
1373
- # @return [String]
1374
- attr_accessor :message4
1375
- end
1376
-
1377
- # 系统类
1378
- class System
1379
-
1380
- # 术语类
1381
- class Terms
1382
-
1383
- # RPG::System::Terms 初始化
1384
- #
1385
- # @param terms [RPG::System::Terms] 待处理的 RPG::System::Terms 对象
1386
- # @return [R3EXS::System::Terms]
1387
- def initialize(terms)
1388
- @basic = terms.basic
1389
- @params = terms.params
1390
- @etypes = terms.etypes
1391
- @commands = terms.commands
1392
- end
1393
-
1394
- # 注入到 RPG::System::Terms 对象
1395
- #
1396
- # @param terms [RPG::System::Terms] 待注入的 RPG::System::Terms 对象
1397
- # @return [void]
1398
- def inject_to(terms)
1399
- terms.basic = @basic
1400
- terms.params = @params
1401
- terms.etypes = @etypes
1402
- terms.commands = @commands
1403
- end
1404
-
1405
- # 提取所有的字符串
1406
- #
1407
- # @return [Array<String>]
1408
- def ex_strings
1409
- strings = []
1410
- strings.concat(@basic)
1411
- strings.concat(@params)
1412
- strings.concat(@etypes)
1413
- strings.concat(@commands)
1414
- strings
1415
- end
1416
-
1417
- # 将所有的字符串替换为指定的字符串
1418
- #
1419
- # @param hash [Hash<String, String>] 字符串翻译表
1420
- # @return [void]
1421
- def in_strings(hash)
1422
- @basic.map! { |string| hash[string] || string }
1423
- @params.map! { |string| hash[string] || string }
1424
- @etypes.map! { |string| hash[string] || string }
1425
- @commands.map! { |string| hash[string] || string }
1426
- end
1427
-
1428
- # 基本术语
1429
- #
1430
- # @return [Array<String>]
1431
- attr_accessor :basic
1432
-
1433
- # 属性名称
1434
- #
1435
- # @return [Array<String>]
1436
- attr_accessor :params
1437
-
1438
- # 装备类型名称
1439
- #
1440
- # @return [Array<String>]
1441
- attr_accessor :etypes
1442
-
1443
- # 命令名称
1444
- #
1445
- # @return [Array<String>]
1446
- attr_accessor :commands
1447
- end
1448
-
1449
- # RPG::System 初始化
1450
- #
1451
- # @param system [RPG::System] 待处理的 RPG::System 对象
1452
- # @return [R3EXS::System]
1453
- def initialize(system, _unused = nil)
1454
- @game_title = system.game_title
1455
- @currency_unit = system.currency_unit
1456
- @elements = system.elements
1457
- @skill_types = system.skill_types
1458
- @weapon_types = system.weapon_types
1459
- @armor_types = system.armor_types
1460
- @switches = system.switches
1461
- @variables = system.variables
1462
- @terms = R3EXS::System::Terms.new(system.terms)
1463
- end
1464
-
1465
- # 注入到 RPG::System 对象
1466
- #
1467
- # @param system [RPG::System] 待注入的 RPG::System 对象
1468
- # @return [void]
1469
- def inject_to(system)
1470
- system.game_title = @game_title
1471
- system.currency_unit = @currency_unit
1472
- system.elements = @elements
1473
- system.skill_types = @skill_types
1474
- system.weapon_types = @weapon_types
1475
- system.armor_types = @armor_types
1476
- system.switches = @switches
1477
- system.variables = @variables
1478
- @terms.inject_to(system.terms)
1479
- end
1480
-
1481
- # 提取所有的字符串
1482
- #
1483
- # @return [Array<String>]
1484
- def ex_strings
1485
- strings = []
1486
- strings << @game_title
1487
- strings << @currency_unit
1488
- strings.concat(@elements)
1489
- strings.concat(@skill_types)
1490
- strings.concat(@weapon_types)
1491
- strings.concat(@armor_types)
1492
- strings.concat(@switches)
1493
- strings.concat(@variables)
1494
- strings.concat(@terms.ex_strings)
1495
- strings
1496
- end
1497
-
1498
- # 将所有的字符串替换为指定的字符串
1499
- #
1500
- # @param hash [Hash<String, String>] 字符串翻译表
1501
- # @return [void]
1502
- def in_strings(hash)
1503
- @game_title = hash[@game_title] || @game_title
1504
- @currency_unit = hash[@currency_unit] || @currency_unit
1505
- @elements.map! { |string| hash[string] || string }
1506
- @skill_types.map! { |string| hash[string] || string }
1507
- @weapon_types.map! { |string| hash[string] || string }
1508
- @armor_types.map! { |string| hash[string] || string }
1509
- @switches.map! { |string| hash[string] || string }
1510
- @variables.map! { |string| hash[string] || string }
1511
- @terms.in_strings(hash)
1512
- end
1513
-
1514
- # 游戏标题
1515
- #
1516
- # @return [String]
1517
- attr_accessor :game_title
1518
-
1519
- # 货币单位
1520
- #
1521
- # @return [String]
1522
- attr_accessor :currency_unit
1523
-
1524
- # 属性名称
1525
- #
1526
- # @return [Array<String>]
1527
- attr_accessor :elements
1528
-
1529
- # 技能类型名称
1530
- #
1531
- # @return [Array<String>]
1532
- attr_accessor :skill_types
1533
-
1534
- # 武器类型名称
1535
- #
1536
- # @return [Array<String>]
1537
- attr_accessor :weapon_types
1538
-
1539
- # 防具类型名称
1540
- #
1541
- # @return [Array<String>]
1542
- attr_accessor :armor_types
1543
-
1544
- # 开关名称
1545
- #
1546
- # @return [Array<String>]
1547
- attr_accessor :switches
1548
-
1549
- # 变量名称
1550
- #
1551
- # @return [Array<String>]
1552
- attr_accessor :variables
1553
-
1554
- # 系统术语
1555
- #
1556
- # @return [R3EXS::System::Terms]
1557
- attr_accessor :terms
1558
- end
1559
-
1560
- # 图块类
1561
- class Tileset
1562
-
1563
- # 用 RPG::Tileset 初始化
1564
- #
1565
- # @param tileset [RPG::Tileset] 待处理的 RPG::Tileset 对象
1566
- # @param index [Integer] 在原始数组中的索引
1567
- # @param with_note [Boolean] 是否处理 note 字段
1568
- # @return [R3EXS::Tileset]
1569
- def initialize(tileset, index, with_note)
1570
- @index = index
1571
- @name = tileset.name
1572
- @note = tileset.note
1573
- self.remove_instance_variable(:@note) unless with_note
1574
- end
1575
-
1576
- # 注入到 RPG::Tileset 对象
1577
- #
1578
- # @param tileset [RPG::Tileset] 待注入的 RPG::Tileset 对象
1579
- # @return [void]
1580
- def inject_to(tileset)
1581
- tileset.name = @name
1582
- tileset.note = @note if self.instance_variable_defined?(:@note)
1583
- end
1584
-
1585
- # 提取所有的字符串
1586
- #
1587
- # @return [Array<String>]
1588
- def ex_strings
1589
- strings = []
1590
- strings << @name
1591
- strings << @note if self.instance_variable_defined?(:@note)
1592
- strings
1593
- end
1594
-
1595
- # 将所有的字符串替换为指定的字符串
1596
- #
1597
- # @param hash [Hash<String, String>] 字符串翻译表
1598
- # @return [void]
1599
- def in_strings(hash)
1600
- @name = hash[@name] || @name
1601
- @note = hash[@note] || @note if self.instance_variable_defined?(:@note)
1602
- end
1603
-
1604
- # 判断是否为空
1605
- #
1606
- # @return [Boolean]
1607
- def empty?
1608
- @name.to_s.empty? && @note.to_s.empty?
1609
- end
1610
-
1611
- # 在原始数组中的索引
1612
- #
1613
- # @return [Integer]
1614
- attr_accessor :index
1615
-
1616
- # 图块名称
1617
- #
1618
- # @return [String]
1619
- attr_accessor :name
1620
-
1621
- # 图块注释
1622
- #
1623
- # @return [String]
1624
- attr_accessor :note
1625
- end
1626
-
1627
- # 敌群类
1628
- class Troop
1629
-
1630
- # 敌群页类
1631
- class Page
1632
-
1633
- # 用 RPG::Troop::Page 初始化
1634
- #
1635
- # @param page [RPG::Troop::Page] 待处理的 RPG::Troop::Page 对象
1636
- # @param index [Integer] 在原始数组中的索引
1637
- # @return [R3EXS::Troop::Page]
1638
- def initialize(page, index)
1639
- @index = index
1640
- @list = []
1641
- page.list.each_with_index do |eventcommand, eventcommand_index|
1642
- next if eventcommand == nil
1643
- eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
1644
- @list << eventcommand_r3exs unless eventcommand_r3exs.empty?
1645
- end
1646
- end
1647
-
1648
- # 注入到 RPG::Troop::Page 对象
1649
- #
1650
- # @param page [RPG::Troop::Page] 待注入的 RPG::Troop::Page 对象
1651
- # @return [void]
1652
- def inject_to(page)
1653
- @list.each do |eventcommand|
1654
- eventcommand.inject_to(page.list[eventcommand.index])
1655
- end
1656
- end
1657
-
1658
- # 提取所有的字符串
1659
- #
1660
- # @return [Array<String>]
1661
- def ex_strings
1662
- strings = []
1663
- @list.each do |eventcommand|
1664
- strings.concat(eventcommand.ex_strings)
1665
- end
1666
- strings
1667
- end
1668
-
1669
- # 将所有的字符串替换为指定的字符串
1670
- #
1671
- # @param hash [Hash<String, String>] 字符串翻译表
1672
- # @return [void]
1673
- def in_strings(hash)
1674
- @list.each do |eventcommand|
1675
- eventcommand.in_strings(hash)
1676
- end
1677
- end
1678
-
1679
- # 判断是否为空
1680
- #
1681
- # @return [Boolean]
1682
- def empty?
1683
- @list.empty?
1684
- end
1685
-
1686
- # 在原始数组中的索引
1687
- #
1688
- # @return [Integer]
1689
- attr_accessor :index
1690
-
1691
- # 事件指令列表
1692
- #
1693
- # @return [Array<R3EXS::EventCommand>]
1694
- attr_accessor :list
1695
- end
1696
-
1697
- # RPG::Troop 初始化
1698
- # @param troop [RPG::Troop] 待处理的 RPG::Troop 对象
1699
- # @param index [Integer] 在原始数组中的索引
1700
- # @return [R3EXS::Troop]
1701
- def initialize(troop, index, _unused = nil)
1702
- @index = index
1703
- @name = troop.name
1704
- @pages = []
1705
- troop.pages.each_with_index do |page, page_index|
1706
- next if page == nil
1707
- page_r3exs = R3EXS::Troop::Page.new(page, page_index)
1708
- @pages << page_r3exs unless page_r3exs.empty?
1709
- end
1710
- end
1711
-
1712
- # 注入到 RPG::Troop 对象
1713
- #
1714
- # @param troop [RPG::Troop] 待注入的 RPG::Troop 对象
1715
- # @return [void]
1716
- def inject_to(troop)
1717
- troop.name = @name
1718
- @pages.each do |page|
1719
- page.inject_to(troop.pages[page.index])
1720
- end
1721
- end
1722
-
1723
- # 提取所有的字符串
1724
- #
1725
- # @return [Array<String>]
1726
- def ex_strings
1727
- strings = [@name]
1728
- @pages.each do |page|
1729
- strings.concat(page.ex_strings)
1730
- end
1731
- strings
1732
- end
1733
-
1734
- # 将所有的字符串替换为指定的字符串
1735
- #
1736
- # @param hash [Hash<String, String>] 字符串翻译表
1737
- # @return [void]
1738
- def in_strings(hash)
1739
- @name = hash[@name] || @name
1740
- @pages.each do |page|
1741
- page.in_strings(hash)
1742
- end
1743
- end
1744
-
1745
- # 判断是否为空
1746
- #
1747
- # @return [Boolean]
1748
- def empty?
1749
- @name.to_s.empty? && @pages.empty?
1750
- end
1751
-
1752
- # 在原始数组中的索引
1753
- #
1754
- # @return [Integer]
1755
- attr_accessor :index
1756
-
1757
- # 敌群名称
1758
- #
1759
- # @return [String]
1760
- attr_accessor :name
1761
-
1762
- # 敌群页列表
1763
- #
1764
- # @return [Array<R3EXS::Troop::Page>]
1765
- attr_accessor :pages
1766
- end
1767
-
1768
- # 武器类
1769
- class Weapon < EquipItem
1770
-
1771
- # 用 RPG::Weapon 初始化
1772
- # @param weapon [RPG::Weapon] 待处理的 RPG::Weapon 对象
1773
- # @param index [Integer] 在原始数组中的索引
1774
- # @param with_note [Boolean] 是否处理 note 字段
1775
- # @return [R3EXS::Weapon]
1776
- def initialize(weapon, index, with_note)
1777
- super(weapon, index, with_note)
1778
- end
1779
-
1780
- # 注入到 RPG::Weapon 对象
1781
- #
1782
- # @param weapon [RPG::Weapon] 待注入的 RPG::Weapon 对象
1783
- # @return [void]
1784
- def inject_to(weapon)
1785
- super
1786
- end
1787
-
1788
- # 提取所有的字符串
1789
- #
1790
- # @return [Array<String>]
1791
- def ex_strings
1792
- super
1793
- end
1794
-
1795
- # 将所有的字符串替换为指定的字符串
1796
- #
1797
- # @param hash [Hash<String, String>] 字符串翻译表
1798
- # @return [void]
1799
- def in_strings(hash)
1800
- super(hash)
1801
- end
1802
-
1803
- # 判断是否为空
1804
- #
1805
- # @return [Boolean]
1806
- def empty?
1807
- super
1808
- end
1809
- end
1810
-
1811
- 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