R3EXS 1.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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +260 -0
- data/README_EN.md +260 -0
- data/bin/R3EXS +217 -0
- data/ext/rgss3a_rvdata2/extconf.rb +3 -0
- data/ext/rgss3a_rvdata2/rgss3a_rvdata2.c +565 -0
- data/lib/R3EXS/RGSS3.rb +1457 -0
- data/lib/R3EXS/RGSS3_R3EXS.rb +1804 -0
- data/lib/R3EXS/ast.rb +154 -0
- data/lib/R3EXS/error.rb +209 -0
- data/lib/R3EXS/extract_strings.rb +80 -0
- data/lib/R3EXS/inject_strings.rb +73 -0
- data/lib/R3EXS/json_rvdata2.rb +105 -0
- data/lib/R3EXS/rvdata2_json.rb +66 -0
- data/lib/R3EXS/utils.rb +971 -0
- data/lib/R3EXS/version.rb +7 -0
- data/lib/R3EXS.rb +12 -0
- metadata +157 -0
@@ -0,0 +1,1804 @@
|
|
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
|
+
@index = index
|
587
|
+
@code = 205
|
588
|
+
@usage = Utils::EVENT_COMMANDS[205]
|
589
|
+
moveroute_r3exs = R3EXS::MoveRoute.new(eventcommand.parameters[1])
|
590
|
+
@parameter = moveroute_r3exs.list unless moveroute_r3exs.empty?
|
591
|
+
if @parameter.nil?
|
592
|
+
@index = -1 # 如果没有可提取的 MoveCommand ,就将索引设为-1,empty? 将据此判断是否为空
|
593
|
+
end
|
594
|
+
when 320 # ChangeActorName
|
595
|
+
@index = index
|
596
|
+
@code = 320
|
597
|
+
@usage = Utils::EVENT_COMMANDS[320]
|
598
|
+
@parameter = eventcommand.parameters[1]
|
599
|
+
when 324 # ChangeActorNickname
|
600
|
+
@index = index
|
601
|
+
@code = 324
|
602
|
+
@usage = Utils::EVENT_COMMANDS[324]
|
603
|
+
@parameter = eventcommand.parameters[1]
|
604
|
+
when 355 # Script
|
605
|
+
@index = index
|
606
|
+
@code = 355
|
607
|
+
@usage = Utils::EVENT_COMMANDS[355]
|
608
|
+
@parameter = eventcommand.parameters[0]
|
609
|
+
when 401 # ShowText
|
610
|
+
@index = index
|
611
|
+
@code = 401
|
612
|
+
@usage = Utils::EVENT_COMMANDS[401]
|
613
|
+
@parameter = eventcommand.parameters[0]
|
614
|
+
when 402 # When
|
615
|
+
@index = index
|
616
|
+
@code = 402
|
617
|
+
@usage = Utils::EVENT_COMMANDS[402]
|
618
|
+
@parameter = eventcommand.parameters[1]
|
619
|
+
when 405 # ShowScrollingText
|
620
|
+
@index = index
|
621
|
+
@code = 405
|
622
|
+
@usage = Utils::EVENT_COMMANDS[405]
|
623
|
+
@parameter = eventcommand.parameters[0]
|
624
|
+
when 408 # CommentMore
|
625
|
+
@index = index
|
626
|
+
@code = 408
|
627
|
+
@usage = Utils::EVENT_COMMANDS[408]
|
628
|
+
@parameter = eventcommand.parameters[0]
|
629
|
+
when 505 # MoveRoute
|
630
|
+
if eventcommand.parameters[0].code == 45
|
631
|
+
@index = index
|
632
|
+
@code = 505
|
633
|
+
@usage = Utils::EVENT_COMMANDS[505]
|
634
|
+
@parameter = eventcommand.parameters[0].parameters[0]
|
635
|
+
else
|
636
|
+
@index = -1
|
637
|
+
end
|
638
|
+
when 655 # ScriptMore
|
639
|
+
@index = index
|
640
|
+
@code = 655
|
641
|
+
@usage = Utils::EVENT_COMMANDS[655]
|
642
|
+
@parameter = eventcommand.parameters[0]
|
643
|
+
else
|
644
|
+
@index = -1 # 如果不是以上的事件指令,就将索引设为-1,empty? 将据此判断是否为空
|
645
|
+
end
|
646
|
+
end
|
647
|
+
|
648
|
+
# 注入到 RPG::EventCommand 对象
|
649
|
+
#
|
650
|
+
# @param eventcommand [RPG::EventCommand] 待注入的 RPG::EventCommand 对象
|
651
|
+
# @return [void]
|
652
|
+
def inject_to(eventcommand)
|
653
|
+
case eventcommand.code
|
654
|
+
when 102 # ShowChoices
|
655
|
+
eventcommand.parameters[0] = @parameter
|
656
|
+
when 108 # Comment
|
657
|
+
eventcommand.parameters[0] = @parameter
|
658
|
+
when 111 # ConditionalBranch
|
659
|
+
if eventcommand.parameters[0] == 4 && eventcommand.parameters[2] == 1
|
660
|
+
eventcommand.parameters[3] = @parameter
|
661
|
+
elsif eventcommand.parameters[0] == 12
|
662
|
+
eventcommand.parameters[1] = @parameter
|
663
|
+
end
|
664
|
+
when 118 # Label
|
665
|
+
eventcommand.parameters[0] = @parameter
|
666
|
+
when 119 # JumpToLabel
|
667
|
+
eventcommand.parameters[0] = @parameter
|
668
|
+
when 122 # ControlVariables
|
669
|
+
eventcommand.parameters[4] = @parameter
|
670
|
+
when 205 # SetMoveRoute
|
671
|
+
@parameter.inject_to(eventcommand.parameters[1])
|
672
|
+
when 320 # ChangeActorName
|
673
|
+
eventcommand.parameters[1] = @parameter
|
674
|
+
when 324 # ChangeActorNickname
|
675
|
+
eventcommand.parameters[1] = @parameter
|
676
|
+
when 355 # Script
|
677
|
+
eventcommand.parameters[0] = @parameter
|
678
|
+
when 401 # ShowText
|
679
|
+
eventcommand.parameters[0] = @parameter
|
680
|
+
when 402 # When
|
681
|
+
eventcommand.parameters[1] = @parameter
|
682
|
+
when 405 # ShowScrollingText
|
683
|
+
eventcommand.parameters[0] = @parameter
|
684
|
+
when 408 # CommentMore
|
685
|
+
eventcommand.parameters[0] = @parameter
|
686
|
+
when 505 # MoveRoute
|
687
|
+
eventcommand.parameters[0].parameters[0] = @parameter
|
688
|
+
when 655 # ScriptMore
|
689
|
+
eventcommand.parameters[0] = @parameter
|
690
|
+
else
|
691
|
+
puts "Unknown code: #{eventcommand.code}"
|
692
|
+
end
|
693
|
+
end
|
694
|
+
|
695
|
+
# 提取所有的字符串
|
696
|
+
#
|
697
|
+
# @return [Array<String>]
|
698
|
+
def ex_strings
|
699
|
+
case @code
|
700
|
+
when 102 # ShowChoices 是一个特殊的事件指令,它的参数是一个数组
|
701
|
+
@parameter
|
702
|
+
when 108, 111, 118, 119, 122, 320, 324, 355, 401, 402, 405, 408, 655
|
703
|
+
[@parameter]
|
704
|
+
when 205
|
705
|
+
@parameter.ex_strings
|
706
|
+
else
|
707
|
+
puts "Unknown code: #{@code}"
|
708
|
+
[]
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
# 将所有的字符串替换为指定的字符串
|
713
|
+
#
|
714
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
715
|
+
# @return [void]
|
716
|
+
def in_strings(hash)
|
717
|
+
case @code
|
718
|
+
when 102 # ShowChoices 是一个特殊的事件指令,它的参数是一个数组
|
719
|
+
@parameter.map! { |string| hash[string] || string }
|
720
|
+
when 108, 111, 118, 119, 122, 320, 324, 355, 401, 402, 405, 408, 655
|
721
|
+
@parameter = hash[@parameter] || @parameter
|
722
|
+
when 205
|
723
|
+
@parameter.in_strings(hash)
|
724
|
+
else
|
725
|
+
puts "Unknown code: #{@code}"
|
726
|
+
end
|
727
|
+
end
|
728
|
+
|
729
|
+
# 判断是否为空
|
730
|
+
#
|
731
|
+
# @return [Boolean]
|
732
|
+
def empty?
|
733
|
+
@index == -1
|
734
|
+
end
|
735
|
+
|
736
|
+
# 在原始数组中的索引
|
737
|
+
#
|
738
|
+
# @return [Integer]
|
739
|
+
attr_accessor :index
|
740
|
+
|
741
|
+
# 事件指令代码
|
742
|
+
#
|
743
|
+
# @return [Integer]
|
744
|
+
attr_accessor :code
|
745
|
+
|
746
|
+
# 事件指令用途
|
747
|
+
#
|
748
|
+
# @return [String]
|
749
|
+
attr_accessor :usage
|
750
|
+
|
751
|
+
# 事件指令参数
|
752
|
+
#
|
753
|
+
# @note 当 '@code' 为 102 时,parameter 是一个字符串数组
|
754
|
+
# @return [String] if @code != 102
|
755
|
+
# @return [Array<String>] if @code == 102
|
756
|
+
attr_accessor :parameter
|
757
|
+
end
|
758
|
+
|
759
|
+
# 公共事件类
|
760
|
+
class CommonEvent
|
761
|
+
|
762
|
+
# 用 RPG::CommonEvent 初始化
|
763
|
+
#
|
764
|
+
# @param commonevent [RPG::CommonEvent] 待处理的 RPG::CommonEvent 对象
|
765
|
+
# @param index [Integer] 在原始数组中的索引
|
766
|
+
# @return [R3EXS::CommonEvent]
|
767
|
+
def initialize(commonevent, index, _unused = nil)
|
768
|
+
@index = index
|
769
|
+
@name = commonevent.name
|
770
|
+
@list = []
|
771
|
+
commonevent.list.each_with_index do |eventcommand, eventcommand_index|
|
772
|
+
next if eventcommand == nil
|
773
|
+
eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
|
774
|
+
@list << eventcommand_r3exs unless eventcommand_r3exs.empty?
|
775
|
+
end
|
776
|
+
end
|
777
|
+
|
778
|
+
# 注入到 RPG::CommonEvent 对象
|
779
|
+
# @param commonevent [RPG::CommonEvent] 待注入的 RPG::CommonEvent 对象
|
780
|
+
# @return [void]
|
781
|
+
def inject_to(commonevent)
|
782
|
+
commonevent.name = @name
|
783
|
+
@list.each do |eventcommand|
|
784
|
+
eventcommand.inject_to(commonevent.list[eventcommand.index])
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
# 提取所有的字符串
|
789
|
+
#
|
790
|
+
# @return [Array<String>]
|
791
|
+
def ex_strings
|
792
|
+
strings = [@name]
|
793
|
+
@list.each do |eventcommand|
|
794
|
+
strings.concat(eventcommand.ex_strings)
|
795
|
+
end
|
796
|
+
strings
|
797
|
+
end
|
798
|
+
|
799
|
+
# 将所有的字符串替换为指定的字符串
|
800
|
+
#
|
801
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
802
|
+
# @return [void]
|
803
|
+
def in_strings(hash)
|
804
|
+
@name = hash[@name] || @name
|
805
|
+
@list.each do |eventcommand|
|
806
|
+
eventcommand.in_strings(hash)
|
807
|
+
end
|
808
|
+
end
|
809
|
+
|
810
|
+
# 判断是否为空
|
811
|
+
#
|
812
|
+
# @return [Boolean]
|
813
|
+
def empty?
|
814
|
+
@name.to_s.empty? && @list.empty?
|
815
|
+
end
|
816
|
+
|
817
|
+
# 在原始数组中的索引
|
818
|
+
#
|
819
|
+
# @return [Integer]
|
820
|
+
attr_accessor :index
|
821
|
+
|
822
|
+
# 公共事件名称
|
823
|
+
#
|
824
|
+
# @return [String]
|
825
|
+
attr_accessor :name
|
826
|
+
|
827
|
+
# 事件指令列表
|
828
|
+
#
|
829
|
+
# @return [Array<R3EXS::EventCommand>]
|
830
|
+
attr_accessor :list
|
831
|
+
end
|
832
|
+
|
833
|
+
# 敌人类
|
834
|
+
class Enemy < BaseItem
|
835
|
+
|
836
|
+
# 用 RPG::Enemy 初始化
|
837
|
+
#
|
838
|
+
# @param enemy [RPG::Enemy] 待处理的 RPG::Enemy 对象
|
839
|
+
# @param index [Integer] 在原始数组中的索引
|
840
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
841
|
+
# @return [R3EXS::Enemy]
|
842
|
+
def initialize(enemy, index, with_note)
|
843
|
+
super(enemy, index, with_note)
|
844
|
+
self.remove_instance_variable(:@description)
|
845
|
+
end
|
846
|
+
|
847
|
+
# 注入到 RPG::Enemy 对象
|
848
|
+
#
|
849
|
+
# @param enemy [RPG::Enemy] 待注入的 RPG::Enemy 对象
|
850
|
+
# @return [void]
|
851
|
+
def inject_to(enemy)
|
852
|
+
super
|
853
|
+
end
|
854
|
+
|
855
|
+
# 提取所有的字符串
|
856
|
+
#
|
857
|
+
# @return [Array<String>]
|
858
|
+
def ex_strings
|
859
|
+
super
|
860
|
+
end
|
861
|
+
|
862
|
+
# 将所有的字符串替换为指定的字符串
|
863
|
+
#
|
864
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
865
|
+
# @return [void]
|
866
|
+
def in_strings(hash)
|
867
|
+
super(hash)
|
868
|
+
end
|
869
|
+
|
870
|
+
# 判断是否为空
|
871
|
+
#
|
872
|
+
# @return [Boolean]
|
873
|
+
def empty?
|
874
|
+
super
|
875
|
+
end
|
876
|
+
|
877
|
+
end
|
878
|
+
|
879
|
+
# 可使用物品类
|
880
|
+
class UsableItem < BaseItem
|
881
|
+
|
882
|
+
# 用 RPG::UsableItem 初始化
|
883
|
+
#
|
884
|
+
# @param usableitem [RPG::UsableItem] 待处理的 RPG::UsableItem 对象
|
885
|
+
# @param index [Integer] 在原始数组中的索引
|
886
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
887
|
+
# @return [R3EXS::UsableItem]
|
888
|
+
def initialize(usableitem, index, with_note)
|
889
|
+
super(usableitem, index, with_note)
|
890
|
+
end
|
891
|
+
|
892
|
+
# 注入到 RPG::UsableItem 对象
|
893
|
+
#
|
894
|
+
# @param usableitem [RPG::UsableItem] 待注入的 RPG::UsableItem 对象
|
895
|
+
# @return [void]
|
896
|
+
def inject_to(usableitem)
|
897
|
+
super
|
898
|
+
end
|
899
|
+
|
900
|
+
# 提取所有的字符串
|
901
|
+
#
|
902
|
+
# @return [Array<String>]
|
903
|
+
def ex_strings
|
904
|
+
super
|
905
|
+
end
|
906
|
+
|
907
|
+
# 将所有的字符串替换为指定的字符串
|
908
|
+
#
|
909
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
910
|
+
# @return [void]
|
911
|
+
def in_strings(hash)
|
912
|
+
super(hash)
|
913
|
+
end
|
914
|
+
|
915
|
+
# 判断是否为空
|
916
|
+
#
|
917
|
+
# @return [Boolean]
|
918
|
+
def empty?
|
919
|
+
super
|
920
|
+
end
|
921
|
+
end
|
922
|
+
|
923
|
+
# 物品类
|
924
|
+
class Item < UsableItem
|
925
|
+
|
926
|
+
# 用 RPG::Item 初始化
|
927
|
+
#
|
928
|
+
# @param item [RPG::Item] 待处理的 RPG::Item 对象
|
929
|
+
# @param index [Integer] 在原始数组中的索引
|
930
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
931
|
+
# @return [R3EXS::Item]
|
932
|
+
def initialize(item, index, with_note)
|
933
|
+
super(item, index, with_note)
|
934
|
+
end
|
935
|
+
|
936
|
+
# 注入到 RPG::Item 对象
|
937
|
+
# @param item [RPG::Item] 待注入的 RPG::Item 对象
|
938
|
+
# @return [void]
|
939
|
+
def inject_to(item)
|
940
|
+
super
|
941
|
+
end
|
942
|
+
|
943
|
+
# 提取所有的字符串
|
944
|
+
#
|
945
|
+
# @return [Array<String>]
|
946
|
+
def ex_strings
|
947
|
+
super
|
948
|
+
end
|
949
|
+
|
950
|
+
# 将所有的字符串替换为指定的字符串
|
951
|
+
#
|
952
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
953
|
+
# @return [void]
|
954
|
+
def in_strings(hash)
|
955
|
+
super(hash)
|
956
|
+
end
|
957
|
+
|
958
|
+
# 判断是否为空
|
959
|
+
#
|
960
|
+
# @return [Boolean]
|
961
|
+
def empty?
|
962
|
+
super
|
963
|
+
end
|
964
|
+
end
|
965
|
+
|
966
|
+
# 事件类
|
967
|
+
class Event
|
968
|
+
|
969
|
+
# 事件页类
|
970
|
+
class Page
|
971
|
+
|
972
|
+
# 用 RPG::Event::Page 初始化
|
973
|
+
#
|
974
|
+
# @param page [RPG::Event::Page] 待处理的 RPG::Event::Page 对象
|
975
|
+
# @param index [Integer] 在原始数组中的索引
|
976
|
+
# @return [R3EXS::Event::Page]
|
977
|
+
def initialize(page, index)
|
978
|
+
@index = index
|
979
|
+
@list = []
|
980
|
+
page.list.each_with_index do |eventcommand, eventcommand_index|
|
981
|
+
next if eventcommand == nil
|
982
|
+
eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
|
983
|
+
@list << eventcommand_r3exs unless eventcommand_r3exs.empty?
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
# 注入到 RPG::Event::Page 对象
|
988
|
+
#
|
989
|
+
# @param page [RPG::Event::Page] 待注入的 RPG::Event::Page 对象
|
990
|
+
# @return [void]
|
991
|
+
def inject_to(page)
|
992
|
+
@list.each do |eventcommand|
|
993
|
+
eventcommand.inject_to(page.list[eventcommand.index])
|
994
|
+
end
|
995
|
+
end
|
996
|
+
|
997
|
+
# 提取所有的字符串
|
998
|
+
#
|
999
|
+
# @return [Array<String>]
|
1000
|
+
def ex_strings
|
1001
|
+
strings = []
|
1002
|
+
@list.each do |eventcommand|
|
1003
|
+
strings.concat(eventcommand.ex_strings)
|
1004
|
+
end
|
1005
|
+
strings
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
# 将所有的字符串替换为指定的字符串
|
1009
|
+
#
|
1010
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1011
|
+
# @return [void]
|
1012
|
+
def in_strings(hash)
|
1013
|
+
@list.each do |eventcommand|
|
1014
|
+
eventcommand.in_strings(hash)
|
1015
|
+
end
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
# 判断是否为空
|
1019
|
+
#
|
1020
|
+
# @return [Boolean]
|
1021
|
+
def empty?
|
1022
|
+
@list.empty?
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
# 在原始数组中的索引
|
1026
|
+
#
|
1027
|
+
# @return [Integer]
|
1028
|
+
attr_accessor :index
|
1029
|
+
|
1030
|
+
# 事件指令列表
|
1031
|
+
#
|
1032
|
+
# @return [Array<R3EXS::EventCommand>]
|
1033
|
+
attr_accessor :list
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
# 用 RPG::Event 初始化
|
1037
|
+
#
|
1038
|
+
# @param event [RPG::Event] 待处理的 RPG::Event 对象
|
1039
|
+
# @param index [Integer] 在原始哈希表中的键
|
1040
|
+
# @return [R3EXS::Event]
|
1041
|
+
def initialize(event, index)
|
1042
|
+
@index = index
|
1043
|
+
@name = event.name
|
1044
|
+
@pages = []
|
1045
|
+
event.pages.each_with_index do |page, page_index|
|
1046
|
+
next if page == nil
|
1047
|
+
page_r3exs = R3EXS::Event::Page.new(page, page_index)
|
1048
|
+
@pages << page_r3exs unless page_r3exs.empty?
|
1049
|
+
end
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
# 注入到 RPG::Event 对象
|
1053
|
+
#
|
1054
|
+
# @param event [RPG::Event] 待注入的 RPG::Event 对象
|
1055
|
+
# @return [void]
|
1056
|
+
def inject_to(event)
|
1057
|
+
event.name = @name
|
1058
|
+
@pages.each do |page|
|
1059
|
+
page.inject_to(event.pages[page.index])
|
1060
|
+
end
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
# 提取所有的字符串
|
1064
|
+
#
|
1065
|
+
# @return [Array<String>]
|
1066
|
+
def ex_strings
|
1067
|
+
strings = [@name]
|
1068
|
+
@pages.each do |page|
|
1069
|
+
strings.concat(page.ex_strings)
|
1070
|
+
end
|
1071
|
+
strings
|
1072
|
+
end
|
1073
|
+
|
1074
|
+
# 将所有的字符串替换为指定的字符串
|
1075
|
+
#
|
1076
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1077
|
+
# @return [void]
|
1078
|
+
def in_strings(hash)
|
1079
|
+
@name = hash[@name] || @name
|
1080
|
+
@pages.each do |page|
|
1081
|
+
page.in_strings(hash)
|
1082
|
+
end
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
# 判断是否为空
|
1086
|
+
#
|
1087
|
+
# @return [Boolean]
|
1088
|
+
def empty?
|
1089
|
+
@name.to_s.empty? && @pages.empty?
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
# 在原始哈希表中的键
|
1093
|
+
#
|
1094
|
+
# @return [Integer]
|
1095
|
+
attr_accessor :index
|
1096
|
+
|
1097
|
+
# 事件名称
|
1098
|
+
#
|
1099
|
+
# @return [String]
|
1100
|
+
attr_accessor :name
|
1101
|
+
|
1102
|
+
# 事件页列表
|
1103
|
+
#
|
1104
|
+
# @return [Array<R3EXS::Event::Page>]
|
1105
|
+
attr_accessor :pages
|
1106
|
+
end
|
1107
|
+
|
1108
|
+
# 地图类
|
1109
|
+
class Map
|
1110
|
+
|
1111
|
+
# 用 RPG::Map 初始化
|
1112
|
+
# @param map [RPG::Map] 待处理的 RPG::Map 对象
|
1113
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
1114
|
+
# @return [R3EXS::Map]
|
1115
|
+
def initialize(map, with_note)
|
1116
|
+
@display_name = map.display_name
|
1117
|
+
@note = map.note
|
1118
|
+
@events = []
|
1119
|
+
map.events.each do |key, event|
|
1120
|
+
next if event == nil
|
1121
|
+
event_r3exs = R3EXS::Event.new(event, key)
|
1122
|
+
@events << event_r3exs unless event_r3exs.empty?
|
1123
|
+
end
|
1124
|
+
self.remove_instance_variable(:@note) unless with_note
|
1125
|
+
end
|
1126
|
+
|
1127
|
+
# 注入到 RPG::Map 对象
|
1128
|
+
#
|
1129
|
+
# @param map [RPG::Map] 待注入的 RPG::Map 对象
|
1130
|
+
# @return [void]
|
1131
|
+
def inject_to(map)
|
1132
|
+
map.display_name = @display_name
|
1133
|
+
map.note = @note if self.instance_variable_defined?(:@note)
|
1134
|
+
@events.each do |event|
|
1135
|
+
event.inject_to(map.events[event.index])
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
# 提取所有的字符串
|
1140
|
+
#
|
1141
|
+
# @return [Array<String>]
|
1142
|
+
def ex_strings
|
1143
|
+
strings = []
|
1144
|
+
strings << @display_name
|
1145
|
+
strings << @note if self.instance_variable_defined?(:@note)
|
1146
|
+
@events.each do |event|
|
1147
|
+
strings.concat(event.ex_strings)
|
1148
|
+
end
|
1149
|
+
strings
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
# 将所有的字符串替换为指定的字符串
|
1153
|
+
#
|
1154
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1155
|
+
# @return [void]
|
1156
|
+
def in_strings(hash)
|
1157
|
+
@display_name = hash[@display_name] || @display_name
|
1158
|
+
@note = hash[@note] || @note if self.instance_variable_defined?(:@note)
|
1159
|
+
@events.each do |event|
|
1160
|
+
event.in_strings(hash)
|
1161
|
+
end
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
# 地图显示名称
|
1165
|
+
#
|
1166
|
+
# @return [String]
|
1167
|
+
attr_accessor :display_name
|
1168
|
+
|
1169
|
+
# 地图注释
|
1170
|
+
#
|
1171
|
+
# @return [String]
|
1172
|
+
attr_accessor :note
|
1173
|
+
|
1174
|
+
# 事件列表
|
1175
|
+
#
|
1176
|
+
# @return [Array<R3EXS::Event>]
|
1177
|
+
attr_accessor :events
|
1178
|
+
end
|
1179
|
+
|
1180
|
+
# 地图信息类
|
1181
|
+
class MapInfo
|
1182
|
+
|
1183
|
+
# 用 RPG::MapInfo 初始化
|
1184
|
+
# @param mapinfo [RPG::MapInfo] 待处理的 RPG::MapInfo 对象
|
1185
|
+
# @param index [Integer] 在原始哈希表中的键
|
1186
|
+
# @return [R3EXS::MapInfo]
|
1187
|
+
def initialize(mapinfo, index, _unused = nil)
|
1188
|
+
@index = index
|
1189
|
+
@name = mapinfo.name
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
# 注入到 RPG::MapInfo 对象
|
1193
|
+
#
|
1194
|
+
# @param mapinfo [RPG::MapInfo] 待注入的 RPG::MapInfo 对象
|
1195
|
+
# @return [void]
|
1196
|
+
def inject_to(mapinfo)
|
1197
|
+
mapinfo.name = @name
|
1198
|
+
end
|
1199
|
+
|
1200
|
+
# 提取所有的字符串
|
1201
|
+
#
|
1202
|
+
# @return [Array<String>]
|
1203
|
+
def ex_strings
|
1204
|
+
[@name]
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
# 将所有的字符串替换为指定的字符串
|
1208
|
+
#
|
1209
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1210
|
+
# @return [void]
|
1211
|
+
def in_strings(hash)
|
1212
|
+
@name = hash[@name] || @name
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
# 在原始哈希表中的键
|
1216
|
+
#
|
1217
|
+
# @return [Integer]
|
1218
|
+
attr_accessor :index
|
1219
|
+
|
1220
|
+
# 地图内部名称
|
1221
|
+
#
|
1222
|
+
# @return [String]
|
1223
|
+
attr_accessor :name
|
1224
|
+
end
|
1225
|
+
|
1226
|
+
# 技能类
|
1227
|
+
class Skill < UsableItem
|
1228
|
+
|
1229
|
+
# 用 RPG::Skill 初始化
|
1230
|
+
# @param skill [RPG::Skill] 待处理的 RPG::Skill 对象
|
1231
|
+
# @param index [Integer] 在原始数组中的索引
|
1232
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
1233
|
+
# @return [R3EXS::Skill]
|
1234
|
+
def initialize(skill, index, with_note)
|
1235
|
+
super(skill, index, with_note)
|
1236
|
+
@message1 = skill.message1
|
1237
|
+
@message2 = skill.message2
|
1238
|
+
end
|
1239
|
+
|
1240
|
+
# 注入到 RPG::Skill 对象
|
1241
|
+
#
|
1242
|
+
# @param skill [RPG::Skill] 待注入的 RPG::Skill 对象
|
1243
|
+
# @return [void]
|
1244
|
+
def inject_to(skill)
|
1245
|
+
super
|
1246
|
+
skill.message1 = @message1
|
1247
|
+
skill.message2 = @message2
|
1248
|
+
end
|
1249
|
+
|
1250
|
+
# 提取所有的字符串
|
1251
|
+
#
|
1252
|
+
# @return [Array<String>]
|
1253
|
+
def ex_strings
|
1254
|
+
strings = super
|
1255
|
+
strings << @message1
|
1256
|
+
strings << @message2
|
1257
|
+
strings
|
1258
|
+
end
|
1259
|
+
|
1260
|
+
# 将所有的字符串替换为指定的字符串
|
1261
|
+
#
|
1262
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1263
|
+
# @return [void]
|
1264
|
+
def in_strings(hash)
|
1265
|
+
super(hash)
|
1266
|
+
@message1 = hash[@message1] || @message1
|
1267
|
+
@message2 = hash[@message2] || @message2
|
1268
|
+
end
|
1269
|
+
|
1270
|
+
# 判断是否为空
|
1271
|
+
#
|
1272
|
+
# @return [Boolean]
|
1273
|
+
def empty?
|
1274
|
+
super && @message1.to_s.empty? && @message2.to_s.empty?
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
# 技能使用时的消息
|
1278
|
+
#
|
1279
|
+
# @return [String]
|
1280
|
+
attr_accessor :message1
|
1281
|
+
|
1282
|
+
# 技能使用时的消息
|
1283
|
+
#
|
1284
|
+
# @return [String]
|
1285
|
+
attr_accessor :message2
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
# 状态类
|
1289
|
+
class State < BaseItem
|
1290
|
+
|
1291
|
+
# 用 RPG::State 初始化
|
1292
|
+
#
|
1293
|
+
# @param state [RPG::State] 待处理的 RPG::State 对象
|
1294
|
+
# @param index [Integer] 在原始数组中的索引
|
1295
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
1296
|
+
# @return [R3EXS::State]
|
1297
|
+
def initialize(state, index, with_note)
|
1298
|
+
super(state, index, with_note)
|
1299
|
+
@message1 = state.message1
|
1300
|
+
@message2 = state.message2
|
1301
|
+
@message3 = state.message3
|
1302
|
+
@message4 = state.message4
|
1303
|
+
self.remove_instance_variable(:@description)
|
1304
|
+
end
|
1305
|
+
|
1306
|
+
# 注入到 RPG::State 对象
|
1307
|
+
#
|
1308
|
+
# @param state [RPG::State] 待注入的 RPG::State 对象
|
1309
|
+
# @return [void]
|
1310
|
+
def inject_to(state)
|
1311
|
+
super
|
1312
|
+
state.message1 = @message1
|
1313
|
+
state.message2 = @message2
|
1314
|
+
state.message3 = @message3
|
1315
|
+
state.message4 = @message4
|
1316
|
+
end
|
1317
|
+
|
1318
|
+
# 提取所有的字符串
|
1319
|
+
#
|
1320
|
+
# @return [Array<String>]
|
1321
|
+
def ex_strings
|
1322
|
+
strings = super
|
1323
|
+
strings << @message1
|
1324
|
+
strings << @message2
|
1325
|
+
strings << @message3
|
1326
|
+
strings << @message4
|
1327
|
+
strings
|
1328
|
+
end
|
1329
|
+
|
1330
|
+
# 将所有的字符串替换为指定的字符串
|
1331
|
+
#
|
1332
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1333
|
+
# @return [void]
|
1334
|
+
def in_strings(hash)
|
1335
|
+
super(hash)
|
1336
|
+
@message1 = hash[@message1] || @message1
|
1337
|
+
@message2 = hash[@message2] || @message2
|
1338
|
+
@message3 = hash[@message3] || @message3
|
1339
|
+
@message4 = hash[@message4] || @message4
|
1340
|
+
end
|
1341
|
+
|
1342
|
+
# 判断是否为空
|
1343
|
+
#
|
1344
|
+
# @return [Boolean]
|
1345
|
+
def empty?
|
1346
|
+
super && @message1.to_s.empty? && @message2.to_s.empty? && @message3.to_s.empty? && @message4.to_s.empty?
|
1347
|
+
end
|
1348
|
+
|
1349
|
+
# 状态应用队员时的消息
|
1350
|
+
#
|
1351
|
+
# @return [String]
|
1352
|
+
attr_accessor :message1
|
1353
|
+
|
1354
|
+
# 状态应用敌人时的消息
|
1355
|
+
#
|
1356
|
+
# @return [String]
|
1357
|
+
attr_accessor :message2
|
1358
|
+
|
1359
|
+
# 状态保持时的消息
|
1360
|
+
#
|
1361
|
+
# @return [String]
|
1362
|
+
attr_accessor :message3
|
1363
|
+
|
1364
|
+
# 状态解除时的消息
|
1365
|
+
#
|
1366
|
+
# @return [String]
|
1367
|
+
attr_accessor :message4
|
1368
|
+
end
|
1369
|
+
|
1370
|
+
# 系统类
|
1371
|
+
class System
|
1372
|
+
|
1373
|
+
# 术语类
|
1374
|
+
class Terms
|
1375
|
+
|
1376
|
+
# 用 RPG::System::Terms 初始化
|
1377
|
+
#
|
1378
|
+
# @param terms [RPG::System::Terms] 待处理的 RPG::System::Terms 对象
|
1379
|
+
# @return [R3EXS::System::Terms]
|
1380
|
+
def initialize(terms)
|
1381
|
+
@basic = terms.basic
|
1382
|
+
@params = terms.params
|
1383
|
+
@etypes = terms.etypes
|
1384
|
+
@commands = terms.commands
|
1385
|
+
end
|
1386
|
+
|
1387
|
+
# 注入到 RPG::System::Terms 对象
|
1388
|
+
#
|
1389
|
+
# @param terms [RPG::System::Terms] 待注入的 RPG::System::Terms 对象
|
1390
|
+
# @return [void]
|
1391
|
+
def inject_to(terms)
|
1392
|
+
terms.basic = @basic
|
1393
|
+
terms.params = @params
|
1394
|
+
terms.etypes = @etypes
|
1395
|
+
terms.commands = @commands
|
1396
|
+
end
|
1397
|
+
|
1398
|
+
# 提取所有的字符串
|
1399
|
+
#
|
1400
|
+
# @return [Array<String>]
|
1401
|
+
def ex_strings
|
1402
|
+
strings = []
|
1403
|
+
strings.concat(@basic)
|
1404
|
+
strings.concat(@params)
|
1405
|
+
strings.concat(@etypes)
|
1406
|
+
strings.concat(@commands)
|
1407
|
+
strings
|
1408
|
+
end
|
1409
|
+
|
1410
|
+
# 将所有的字符串替换为指定的字符串
|
1411
|
+
#
|
1412
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1413
|
+
# @return [void]
|
1414
|
+
def in_strings(hash)
|
1415
|
+
@basic.map! { |string| hash[string] || string }
|
1416
|
+
@params.map! { |string| hash[string] || string }
|
1417
|
+
@etypes.map! { |string| hash[string] || string }
|
1418
|
+
@commands.map! { |string| hash[string] || string }
|
1419
|
+
end
|
1420
|
+
|
1421
|
+
# 基本术语
|
1422
|
+
#
|
1423
|
+
# @return [Array<String>]
|
1424
|
+
attr_accessor :basic
|
1425
|
+
|
1426
|
+
# 属性名称
|
1427
|
+
#
|
1428
|
+
# @return [Array<String>]
|
1429
|
+
attr_accessor :params
|
1430
|
+
|
1431
|
+
# 装备类型名称
|
1432
|
+
#
|
1433
|
+
# @return [Array<String>]
|
1434
|
+
attr_accessor :etypes
|
1435
|
+
|
1436
|
+
# 命令名称
|
1437
|
+
#
|
1438
|
+
# @return [Array<String>]
|
1439
|
+
attr_accessor :commands
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
# 用 RPG::System 初始化
|
1443
|
+
#
|
1444
|
+
# @param system [RPG::System] 待处理的 RPG::System 对象
|
1445
|
+
# @return [R3EXS::System]
|
1446
|
+
def initialize(system, _unused = nil)
|
1447
|
+
@game_title = system.game_title
|
1448
|
+
@currency_unit = system.currency_unit
|
1449
|
+
@elements = system.elements
|
1450
|
+
@skill_types = system.skill_types
|
1451
|
+
@weapon_types = system.weapon_types
|
1452
|
+
@armor_types = system.armor_types
|
1453
|
+
@switches = system.switches
|
1454
|
+
@variables = system.variables
|
1455
|
+
@terms = R3EXS::System::Terms.new(system.terms)
|
1456
|
+
end
|
1457
|
+
|
1458
|
+
# 注入到 RPG::System 对象
|
1459
|
+
#
|
1460
|
+
# @param system [RPG::System] 待注入的 RPG::System 对象
|
1461
|
+
# @return [void]
|
1462
|
+
def inject_to(system)
|
1463
|
+
system.game_title = @game_title
|
1464
|
+
system.currency_unit = @currency_unit
|
1465
|
+
system.elements = @elements
|
1466
|
+
system.skill_types = @skill_types
|
1467
|
+
system.weapon_types = @weapon_types
|
1468
|
+
system.armor_types = @armor_types
|
1469
|
+
system.switches = @switches
|
1470
|
+
system.variables = @variables
|
1471
|
+
@terms.inject_to(system.terms)
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
# 提取所有的字符串
|
1475
|
+
#
|
1476
|
+
# @return [Array<String>]
|
1477
|
+
def ex_strings
|
1478
|
+
strings = []
|
1479
|
+
strings << @game_title
|
1480
|
+
strings << @currency_unit
|
1481
|
+
strings.concat(@elements)
|
1482
|
+
strings.concat(@skill_types)
|
1483
|
+
strings.concat(@weapon_types)
|
1484
|
+
strings.concat(@armor_types)
|
1485
|
+
strings.concat(@switches)
|
1486
|
+
strings.concat(@variables)
|
1487
|
+
strings.concat(@terms.ex_strings)
|
1488
|
+
strings
|
1489
|
+
end
|
1490
|
+
|
1491
|
+
# 将所有的字符串替换为指定的字符串
|
1492
|
+
#
|
1493
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1494
|
+
# @return [void]
|
1495
|
+
def in_strings(hash)
|
1496
|
+
@game_title = hash[@game_title] || @game_title
|
1497
|
+
@currency_unit = hash[@currency_unit] || @currency_unit
|
1498
|
+
@elements.map! { |string| hash[string] || string }
|
1499
|
+
@skill_types.map! { |string| hash[string] || string }
|
1500
|
+
@weapon_types.map! { |string| hash[string] || string }
|
1501
|
+
@armor_types.map! { |string| hash[string] || string }
|
1502
|
+
@switches.map! { |string| hash[string] || string }
|
1503
|
+
@variables.map! { |string| hash[string] || string }
|
1504
|
+
@terms.in_strings(hash)
|
1505
|
+
end
|
1506
|
+
|
1507
|
+
# 游戏标题
|
1508
|
+
#
|
1509
|
+
# @return [String]
|
1510
|
+
attr_accessor :game_title
|
1511
|
+
|
1512
|
+
# 货币单位
|
1513
|
+
#
|
1514
|
+
# @return [String]
|
1515
|
+
attr_accessor :currency_unit
|
1516
|
+
|
1517
|
+
# 属性名称
|
1518
|
+
#
|
1519
|
+
# @return [Array<String>]
|
1520
|
+
attr_accessor :elements
|
1521
|
+
|
1522
|
+
# 技能类型名称
|
1523
|
+
#
|
1524
|
+
# @return [Array<String>]
|
1525
|
+
attr_accessor :skill_types
|
1526
|
+
|
1527
|
+
# 武器类型名称
|
1528
|
+
#
|
1529
|
+
# @return [Array<String>]
|
1530
|
+
attr_accessor :weapon_types
|
1531
|
+
|
1532
|
+
# 防具类型名称
|
1533
|
+
#
|
1534
|
+
# @return [Array<String>]
|
1535
|
+
attr_accessor :armor_types
|
1536
|
+
|
1537
|
+
# 开关名称
|
1538
|
+
#
|
1539
|
+
# @return [Array<String>]
|
1540
|
+
attr_accessor :switches
|
1541
|
+
|
1542
|
+
# 变量名称
|
1543
|
+
#
|
1544
|
+
# @return [Array<String>]
|
1545
|
+
attr_accessor :variables
|
1546
|
+
|
1547
|
+
# 系统术语
|
1548
|
+
#
|
1549
|
+
# @return [R3EXS::System::Terms]
|
1550
|
+
attr_accessor :terms
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
# 图块类
|
1554
|
+
class Tileset
|
1555
|
+
|
1556
|
+
# 用 RPG::Tileset 初始化
|
1557
|
+
#
|
1558
|
+
# @param tileset [RPG::Tileset] 待处理的 RPG::Tileset 对象
|
1559
|
+
# @param index [Integer] 在原始数组中的索引
|
1560
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
1561
|
+
# @return [R3EXS::Tileset]
|
1562
|
+
def initialize(tileset, index, with_note)
|
1563
|
+
@index = index
|
1564
|
+
@name = tileset.name
|
1565
|
+
@note = tileset.note
|
1566
|
+
self.remove_instance_variable(:@note) unless with_note
|
1567
|
+
end
|
1568
|
+
|
1569
|
+
# 注入到 RPG::Tileset 对象
|
1570
|
+
#
|
1571
|
+
# @param tileset [RPG::Tileset] 待注入的 RPG::Tileset 对象
|
1572
|
+
# @return [void]
|
1573
|
+
def inject_to(tileset)
|
1574
|
+
tileset.name = @name
|
1575
|
+
tileset.note = @note if self.instance_variable_defined?(:@note)
|
1576
|
+
end
|
1577
|
+
|
1578
|
+
# 提取所有的字符串
|
1579
|
+
#
|
1580
|
+
# @return [Array<String>]
|
1581
|
+
def ex_strings
|
1582
|
+
strings = []
|
1583
|
+
strings << @name
|
1584
|
+
strings << @note if self.instance_variable_defined?(:@note)
|
1585
|
+
strings
|
1586
|
+
end
|
1587
|
+
|
1588
|
+
# 将所有的字符串替换为指定的字符串
|
1589
|
+
#
|
1590
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1591
|
+
# @return [void]
|
1592
|
+
def in_strings(hash)
|
1593
|
+
@name = hash[@name] || @name
|
1594
|
+
@note = hash[@note] || @note if self.instance_variable_defined?(:@note)
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
# 判断是否为空
|
1598
|
+
#
|
1599
|
+
# @return [Boolean]
|
1600
|
+
def empty?
|
1601
|
+
@name.to_s.empty? && @note.to_s.empty?
|
1602
|
+
end
|
1603
|
+
|
1604
|
+
# 在原始数组中的索引
|
1605
|
+
#
|
1606
|
+
# @return [Integer]
|
1607
|
+
attr_accessor :index
|
1608
|
+
|
1609
|
+
# 图块名称
|
1610
|
+
#
|
1611
|
+
# @return [String]
|
1612
|
+
attr_accessor :name
|
1613
|
+
|
1614
|
+
# 图块注释
|
1615
|
+
#
|
1616
|
+
# @return [String]
|
1617
|
+
attr_accessor :note
|
1618
|
+
end
|
1619
|
+
|
1620
|
+
# 敌群类
|
1621
|
+
class Troop
|
1622
|
+
|
1623
|
+
# 敌群页类
|
1624
|
+
class Page
|
1625
|
+
|
1626
|
+
# 用 RPG::Troop::Page 初始化
|
1627
|
+
#
|
1628
|
+
# @param page [RPG::Troop::Page] 待处理的 RPG::Troop::Page 对象
|
1629
|
+
# @param index [Integer] 在原始数组中的索引
|
1630
|
+
# @return [R3EXS::Troop::Page]
|
1631
|
+
def initialize(page, index)
|
1632
|
+
@index = index
|
1633
|
+
@list = []
|
1634
|
+
page.list.each_with_index do |eventcommand, eventcommand_index|
|
1635
|
+
next if eventcommand == nil
|
1636
|
+
eventcommand_r3exs = R3EXS::EventCommand.new(eventcommand, eventcommand_index)
|
1637
|
+
@list << eventcommand_r3exs unless eventcommand_r3exs.empty?
|
1638
|
+
end
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
# 注入到 RPG::Troop::Page 对象
|
1642
|
+
#
|
1643
|
+
# @param page [RPG::Troop::Page] 待注入的 RPG::Troop::Page 对象
|
1644
|
+
# @return [void]
|
1645
|
+
def inject_to(page)
|
1646
|
+
@list.each do |eventcommand|
|
1647
|
+
eventcommand.inject_to(page.list[eventcommand.index])
|
1648
|
+
end
|
1649
|
+
end
|
1650
|
+
|
1651
|
+
# 提取所有的字符串
|
1652
|
+
#
|
1653
|
+
# @return [Array<String>]
|
1654
|
+
def ex_strings
|
1655
|
+
strings = []
|
1656
|
+
@list.each do |eventcommand|
|
1657
|
+
strings.concat(eventcommand.ex_strings)
|
1658
|
+
end
|
1659
|
+
strings
|
1660
|
+
end
|
1661
|
+
|
1662
|
+
# 将所有的字符串替换为指定的字符串
|
1663
|
+
#
|
1664
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1665
|
+
# @return [void]
|
1666
|
+
def in_strings(hash)
|
1667
|
+
@list.each do |eventcommand|
|
1668
|
+
eventcommand.in_strings(hash)
|
1669
|
+
end
|
1670
|
+
end
|
1671
|
+
|
1672
|
+
# 判断是否为空
|
1673
|
+
#
|
1674
|
+
# @return [Boolean]
|
1675
|
+
def empty?
|
1676
|
+
@list.empty?
|
1677
|
+
end
|
1678
|
+
|
1679
|
+
# 在原始数组中的索引
|
1680
|
+
#
|
1681
|
+
# @return [Integer]
|
1682
|
+
attr_accessor :index
|
1683
|
+
|
1684
|
+
# 事件指令列表
|
1685
|
+
#
|
1686
|
+
# @return [Array<R3EXS::EventCommand>]
|
1687
|
+
attr_accessor :list
|
1688
|
+
end
|
1689
|
+
|
1690
|
+
# 用 RPG::Troop 初始化
|
1691
|
+
# @param troop [RPG::Troop] 待处理的 RPG::Troop 对象
|
1692
|
+
# @param index [Integer] 在原始数组中的索引
|
1693
|
+
# @return [R3EXS::Troop]
|
1694
|
+
def initialize(troop, index, _unused = nil)
|
1695
|
+
@index = index
|
1696
|
+
@name = troop.name
|
1697
|
+
@pages = []
|
1698
|
+
troop.pages.each_with_index do |page, page_index|
|
1699
|
+
next if page == nil
|
1700
|
+
page_r3exs = R3EXS::Troop::Page.new(page, page_index)
|
1701
|
+
@pages << page_r3exs unless page_r3exs.empty?
|
1702
|
+
end
|
1703
|
+
end
|
1704
|
+
|
1705
|
+
# 注入到 RPG::Troop 对象
|
1706
|
+
#
|
1707
|
+
# @param troop [RPG::Troop] 待注入的 RPG::Troop 对象
|
1708
|
+
# @return [void]
|
1709
|
+
def inject_to(troop)
|
1710
|
+
troop.name = @name
|
1711
|
+
@pages.each do |page|
|
1712
|
+
page.inject_to(troop.pages[page.index])
|
1713
|
+
end
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
# 提取所有的字符串
|
1717
|
+
#
|
1718
|
+
# @return [Array<String>]
|
1719
|
+
def ex_strings
|
1720
|
+
strings = [@name]
|
1721
|
+
@pages.each do |page|
|
1722
|
+
strings.concat(page.ex_strings)
|
1723
|
+
end
|
1724
|
+
strings
|
1725
|
+
end
|
1726
|
+
|
1727
|
+
# 将所有的字符串替换为指定的字符串
|
1728
|
+
#
|
1729
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1730
|
+
# @return [void]
|
1731
|
+
def in_strings(hash)
|
1732
|
+
@name = hash[@name] || @name
|
1733
|
+
@pages.each do |page|
|
1734
|
+
page.in_strings(hash)
|
1735
|
+
end
|
1736
|
+
end
|
1737
|
+
|
1738
|
+
# 判断是否为空
|
1739
|
+
#
|
1740
|
+
# @return [Boolean]
|
1741
|
+
def empty?
|
1742
|
+
@name.to_s.empty? && @pages.empty?
|
1743
|
+
end
|
1744
|
+
|
1745
|
+
# 在原始数组中的索引
|
1746
|
+
#
|
1747
|
+
# @return [Integer]
|
1748
|
+
attr_accessor :index
|
1749
|
+
|
1750
|
+
# 敌群名称
|
1751
|
+
#
|
1752
|
+
# @return [String]
|
1753
|
+
attr_accessor :name
|
1754
|
+
|
1755
|
+
# 敌群页列表
|
1756
|
+
#
|
1757
|
+
# @return [Array<R3EXS::Troop::Page>]
|
1758
|
+
attr_accessor :pages
|
1759
|
+
end
|
1760
|
+
|
1761
|
+
# 武器类
|
1762
|
+
class Weapon < EquipItem
|
1763
|
+
|
1764
|
+
# 用 RPG::Weapon 初始化
|
1765
|
+
# @param weapon [RPG::Weapon] 待处理的 RPG::Weapon 对象
|
1766
|
+
# @param index [Integer] 在原始数组中的索引
|
1767
|
+
# @param with_note [Boolean] 是否处理 note 字段
|
1768
|
+
# @return [R3EXS::Weapon]
|
1769
|
+
def initialize(weapon, index, with_note)
|
1770
|
+
super(weapon, index, with_note)
|
1771
|
+
end
|
1772
|
+
|
1773
|
+
# 注入到 RPG::Weapon 对象
|
1774
|
+
#
|
1775
|
+
# @param weapon [RPG::Weapon] 待注入的 RPG::Weapon 对象
|
1776
|
+
# @return [void]
|
1777
|
+
def inject_to(weapon)
|
1778
|
+
super
|
1779
|
+
end
|
1780
|
+
|
1781
|
+
# 提取所有的字符串
|
1782
|
+
#
|
1783
|
+
# @return [Array<String>]
|
1784
|
+
def ex_strings
|
1785
|
+
super
|
1786
|
+
end
|
1787
|
+
|
1788
|
+
# 将所有的字符串替换为指定的字符串
|
1789
|
+
#
|
1790
|
+
# @param hash [Hash<String, String>] 字符串翻译表
|
1791
|
+
# @return [void]
|
1792
|
+
def in_strings(hash)
|
1793
|
+
super(hash)
|
1794
|
+
end
|
1795
|
+
|
1796
|
+
# 判断是否为空
|
1797
|
+
#
|
1798
|
+
# @return [Boolean]
|
1799
|
+
def empty?
|
1800
|
+
super
|
1801
|
+
end
|
1802
|
+
end
|
1803
|
+
|
1804
|
+
end
|