rgss_db 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +5 -0
  3. data/COPYING.md +674 -0
  4. data/README.md +347 -0
  5. data/bin/rgss-db +4 -0
  6. data/bin/rgssdb +4 -0
  7. data/lib/rgss_db/app.rb +928 -0
  8. data/lib/rgss_db/controller/data_manager.rb +557 -0
  9. data/lib/rgss_db/model/data_file.rb +516 -0
  10. data/lib/rgss_db/model/data_file_factory.rb +94 -0
  11. data/lib/rgss_db/model/debug.rb +199 -0
  12. data/lib/rgss_db/model/errors.rb +17 -0
  13. data/lib/rgss_db/model/mixins/jsonable.rb +35 -0
  14. data/lib/rgss_db/model/mixins/jsonable_constructor.rb +40 -0
  15. data/lib/rgss_db/model/rpg_maker_data/vx/rgss/color.rb +72 -0
  16. data/lib/rgss_db/model/rpg_maker_data/vx/rgss/rect.rb +70 -0
  17. data/lib/rgss_db/model/rpg_maker_data/vx/rgss/table.rb +99 -0
  18. data/lib/rgss_db/model/rpg_maker_data/vx/rgss/tone.rb +72 -0
  19. data/lib/rgss_db/model/rpg_maker_data/vx/rgss.rb +11 -0
  20. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/actor.rb +44 -0
  21. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/animation.rb +31 -0
  22. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/animation_frame.rb +20 -0
  23. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/animation_timing.rb +23 -0
  24. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/area.rb +26 -0
  25. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/armor.rb +31 -0
  26. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/audio_file.rb +23 -0
  27. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/base_item.rb +25 -0
  28. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/bgm.rb +36 -0
  29. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/bgs.rb +36 -0
  30. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/class.rb +31 -0
  31. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/class_learning.rb +20 -0
  32. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/common_event.rb +25 -0
  33. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/enemy.rb +44 -0
  34. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/enemy_action.rb +29 -0
  35. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/enemy_drop_item.rb +23 -0
  36. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/event.rb +36 -0
  37. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/event_command.rb +19 -0
  38. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/event_page.rb +32 -0
  39. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/event_page_condition.rb +34 -0
  40. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/event_page_graphic.rb +25 -0
  41. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/item.rb +27 -0
  42. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/map.rb +47 -0
  43. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/map_info.rb +26 -0
  44. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/me.rb +27 -0
  45. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/move_command.rb +18 -0
  46. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/move_route.rb +20 -0
  47. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/se.rb +21 -0
  48. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/skill.rb +22 -0
  49. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/state.rb +47 -0
  50. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/system.rb +43 -0
  51. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/system_terms.rb +53 -0
  52. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/system_test_battler.rb +25 -0
  53. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/system_vehicle.rb +24 -0
  54. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/troop.rb +24 -0
  55. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/troop_member.rb +23 -0
  56. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/troop_page.rb +21 -0
  57. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/troop_page_condition.rb +33 -0
  58. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/usable_item.rb +87 -0
  59. data/lib/rgss_db/model/rpg_maker_data/vx/rpg/weapon.rb +31 -0
  60. data/lib/rgss_db/model/rpg_maker_data/vx/rpg.rb +59 -0
  61. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rgss/color.rb +72 -0
  62. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rgss/rect.rb +70 -0
  63. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rgss/table.rb +99 -0
  64. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rgss/tone.rb +72 -0
  65. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rgss.rb +11 -0
  66. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/actor.rb +27 -0
  67. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/animation.rb +31 -0
  68. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/animation_frame.rb +23 -0
  69. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/animation_timing.rb +26 -0
  70. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/armor.rb +20 -0
  71. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/audio_file.rb +23 -0
  72. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/base_item.rb +31 -0
  73. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/base_item_feature.rb +29 -0
  74. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/bgm.rb +43 -0
  75. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/bgs.rb +43 -0
  76. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/class.rb +37 -0
  77. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/class_learning.rb +24 -0
  78. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/common_event.rb +33 -0
  79. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/enemy.rb +27 -0
  80. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/enemy_action.rb +26 -0
  81. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/enemy_drop_item.rb +24 -0
  82. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/equip_item.rb +19 -0
  83. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/event.rb +36 -0
  84. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/event_command.rb +19 -0
  85. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/event_page.rb +35 -0
  86. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/event_page_condition.rb +40 -0
  87. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/event_page_graphic.rb +31 -0
  88. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/item.rb +25 -0
  89. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/map.rb +58 -0
  90. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/map_encounter.rb +23 -0
  91. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/map_info.rb +26 -0
  92. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/me.rb +27 -0
  93. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/move_command.rb +17 -0
  94. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/move_route.rb +19 -0
  95. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/se.rb +21 -0
  96. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/skill.rb +25 -0
  97. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/state.rb +34 -0
  98. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/system.rb +62 -0
  99. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/system_terms.rb +25 -0
  100. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/system_test_battler.rb +24 -0
  101. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/system_vehicle.rb +27 -0
  102. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/tileset.rb +26 -0
  103. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/troop.rb +24 -0
  104. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/troop_member.rb +25 -0
  105. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/troop_page.rb +24 -0
  106. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/troop_page_condition.rb +39 -0
  107. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/usable_item.rb +84 -0
  108. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/usable_item_damage.rb +56 -0
  109. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/usable_item_effect.rb +25 -0
  110. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/weapon.rb +25 -0
  111. data/lib/rgss_db/model/rpg_maker_data/vx_ace/rpg.rb +66 -0
  112. data/lib/rgss_db/model/rpg_maker_data/xp/rgss/color.rb +72 -0
  113. data/lib/rgss_db/model/rpg_maker_data/xp/rgss/rect.rb +70 -0
  114. data/lib/rgss_db/model/rpg_maker_data/xp/rgss/table.rb +99 -0
  115. data/lib/rgss_db/model/rpg_maker_data/xp/rgss/tone.rb +72 -0
  116. data/lib/rgss_db/model/rpg_maker_data/xp/rgss.rb +11 -0
  117. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/actor.rb +44 -0
  118. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/animation.rb +28 -0
  119. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/animation_frame.rb +20 -0
  120. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/animation_timing.rb +24 -0
  121. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/armor.rb +37 -0
  122. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/audio_file.rb +23 -0
  123. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/class.rb +28 -0
  124. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/class_learning.rb +20 -0
  125. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/common_event.rb +25 -0
  126. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/enemy.rb +47 -0
  127. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/enemy_action.rb +28 -0
  128. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/event.rb +36 -0
  129. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/event_command.rb +19 -0
  130. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/event_page.rb +32 -0
  131. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/event_page_condition.rb +30 -0
  132. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/event_page_graphic.rb +27 -0
  133. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/item.rb +48 -0
  134. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/map.rb +39 -0
  135. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/map_info.rb +26 -0
  136. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/move_command.rb +18 -0
  137. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/move_route.rb +19 -0
  138. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/skill.rb +47 -0
  139. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/state.rb +51 -0
  140. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/system.rb +56 -0
  141. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/system_test_battler.rb +25 -0
  142. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/system_words.rb +39 -0
  143. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/tileset.rb +39 -0
  144. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/troop.rb +24 -0
  145. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/troop_member.rb +23 -0
  146. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/troop_page.rb +21 -0
  147. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/troop_page_condition.rb +32 -0
  148. data/lib/rgss_db/model/rpg_maker_data/xp/rpg/weapon.rb +38 -0
  149. data/lib/rgss_db/model/rpg_maker_data/xp/rpg.rb +52 -0
  150. data/lib/rgss_db/model/strings.rb +607 -0
  151. data/lib/rgss_db/model/utilities.rb +90 -0
  152. data/lib/rgss_db/version.rb +7 -0
  153. data/lib/rgss_db/view/app_cli.rb +449 -0
  154. data/lib/rgss_db.rb +41 -0
  155. data/sig/rgss_db.rbs +5221 -0
  156. metadata +496 -0
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RPG
4
+ #
5
+ # The data class for enemy troops.
6
+ #
7
+ class Troop
8
+ #
9
+ # The data class for battle events (pages).
10
+ #
11
+ class Page
12
+ #
13
+ # The data class of battle event [Conditions].
14
+ #
15
+ class Condition
16
+ include RgssDb::Jsonable
17
+ extend RgssDb::JsonableConstructor
18
+
19
+ def initialize
20
+ @turn_ending = false
21
+ @turn_valid = false
22
+ @enemy_valid = false
23
+ @actor_valid = false
24
+ @switch_valid = false
25
+ @turn_a = 0
26
+ @turn_b = 0
27
+ @enemy_index = 0
28
+ @enemy_hp = 50
29
+ @actor_id = 1
30
+ @actor_hp = 50
31
+ @switch_id = 1
32
+ end
33
+
34
+ attr_accessor :turn_ending, :turn_valid, :enemy_valid, :actor_valid, :switch_valid,
35
+ :turn_a, :turn_b, :enemy_index, :enemy_hp, :actor_id, :actor_hp, :switch_id
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RPG
4
+ #
5
+ # The Superclass of Skill and Item.
6
+ #
7
+ class UsableItem < BaseItem
8
+ include RgssDb::Jsonable
9
+ extend RgssDb::JsonableConstructor
10
+
11
+ def initialize
12
+ super
13
+ @scope = 0
14
+ @occasion = 0
15
+ @speed = 0
16
+ @success_rate = 100
17
+ @repeats = 1
18
+ @tp_gain = 0
19
+ @hit_type = 0
20
+ @animation_id = 0
21
+ @damage = RPG::UsableItem::Damage.new
22
+ @effects = []
23
+ end
24
+
25
+ def for_opponent?
26
+ [1, 2, 3, 4, 5, 6].include?(@scope)
27
+ end
28
+
29
+ def for_friend?
30
+ [7, 8, 9, 10, 11].include?(@scope)
31
+ end
32
+
33
+ def for_dead_friend?
34
+ [9, 10].include?(@scope)
35
+ end
36
+
37
+ def for_user?
38
+ @scope == 11
39
+ end
40
+
41
+ def for_one?
42
+ [1, 3, 7, 9, 11].include?(@scope)
43
+ end
44
+
45
+ def for_random?
46
+ [3, 4, 5, 6].include?(@scope)
47
+ end
48
+
49
+ def number_of_targets
50
+ for_random? ? @scope - 2 : 0
51
+ end
52
+
53
+ def for_all?
54
+ [2, 8, 10].include?(@scope)
55
+ end
56
+
57
+ def need_selection?
58
+ [1, 7, 9].include?(@scope)
59
+ end
60
+
61
+ def battle_ok?
62
+ [0, 1].include?(@occasion)
63
+ end
64
+
65
+ def menu_ok?
66
+ [0, 2].include?(@occasion)
67
+ end
68
+
69
+ def certain?
70
+ @hit_type == 0
71
+ end
72
+
73
+ def physical?
74
+ @hit_type == 1
75
+ end
76
+
77
+ def magical?
78
+ @hit_type == 2
79
+ end
80
+
81
+ attr_accessor :scope, :occasion, :speed, :animation_id, :success_rate,
82
+ :repeats, :tp_gain, :hit_type, :damage, :effects
83
+ end
84
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RPG
4
+ #
5
+ # The Superclass of Skill and Item.
6
+ #
7
+ class UsableItem < BaseItem
8
+ #
9
+ # The data inner class for damage.
10
+ #
11
+ class Damage
12
+ include RgssDb::Jsonable
13
+ extend RgssDb::JsonableConstructor
14
+
15
+ def initialize
16
+ @type = 0
17
+ @element_id = 0
18
+ @formula = "0"
19
+ @variance = 20
20
+ @critical = false
21
+ end
22
+
23
+ def none?
24
+ @type == 0
25
+ end
26
+
27
+ def to_hp?
28
+ [1, 3, 5].include?(@type)
29
+ end
30
+
31
+ def to_mp?
32
+ [2, 4, 6].include?(@type)
33
+ end
34
+
35
+ def recover?
36
+ [3, 4].include?(@type)
37
+ end
38
+
39
+ def drain?
40
+ [5, 6].include?(@type)
41
+ end
42
+
43
+ def sign
44
+ recover? ? -1 : 1
45
+ end
46
+
47
+ def eval(a, b, v)
48
+ [Kernel.eval(@formula), 0].max * sign
49
+ rescue StandardError
50
+ 0
51
+ end
52
+
53
+ attr_accessor :type, :element_id, :formula, :variance, :critical
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RPG
4
+ #
5
+ # The Superclass of Skill and Item.
6
+ #
7
+ class UsableItem < BaseItem
8
+ #
9
+ # The data inner class for use effects.
10
+ #
11
+ class Effect
12
+ include RgssDb::Jsonable
13
+ extend RgssDb::JsonableConstructor
14
+
15
+ def initialize(code = 0, data_id = 0, value1 = 0, value2 = 0)
16
+ @code = code
17
+ @data_id = data_id
18
+ @value1 = value1
19
+ @value2 = value2
20
+ end
21
+
22
+ attr_accessor :code, :data_id, :value1, :value2
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RPG
4
+ #
5
+ # The data class for weapons.
6
+ #
7
+ class Weapon < EquipItem
8
+ include RgssDb::Jsonable
9
+ extend RgssDb::JsonableConstructor
10
+
11
+ def initialize
12
+ super
13
+ @wtype_id = 0
14
+ @animation_id = 0
15
+ @features.push(RPG::BaseItem::Feature.new(31, 1, 0))
16
+ @features.push(RPG::BaseItem::Feature.new(22, 0, 0))
17
+ end
18
+
19
+ def performance
20
+ params[2] + params[4] + params.inject(0) { |r, v| r += v }
21
+ end
22
+
23
+ attr_accessor :wtype_id, :animation_id
24
+ end
25
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Application mixins
4
+ require_relative "../../mixins/jsonable"
5
+ require_relative "../../mixins/jsonable_constructor"
6
+
7
+ # RPGVXAce Data Structures (RPGVXAce.chm::/rgss/g_rpg_data.html)
8
+ require_relative "./rpg/map"
9
+ require_relative "./rpg/map_encounter"
10
+ require_relative "./rpg/map_info"
11
+
12
+ require_relative "./rpg/event"
13
+ require_relative "./rpg/event_page"
14
+ require_relative "./rpg/event_page_condition"
15
+ require_relative "./rpg/event_page_graphic"
16
+
17
+ require_relative "./rpg/event_command"
18
+
19
+ require_relative "./rpg/move_route"
20
+ require_relative "./rpg/move_command"
21
+
22
+ require_relative "./rpg/base_item"
23
+ require_relative "./rpg/actor"
24
+ require_relative "./rpg/class"
25
+ require_relative "./rpg/usable_item"
26
+ require_relative "./rpg/skill"
27
+ require_relative "./rpg/item"
28
+ require_relative "./rpg/equip_item"
29
+ require_relative "./rpg/weapon"
30
+ require_relative "./rpg/armor"
31
+ require_relative "./rpg/enemy"
32
+ require_relative "./rpg/state"
33
+
34
+ require_relative "./rpg/base_item_feature"
35
+
36
+ require_relative "./rpg/usable_item_damage"
37
+ require_relative "./rpg/usable_item_effect"
38
+
39
+ require_relative "./rpg/class_learning"
40
+
41
+ require_relative "./rpg/enemy_drop_item"
42
+ require_relative "./rpg/enemy_action"
43
+
44
+ require_relative "./rpg/troop"
45
+ require_relative "./rpg/troop_member"
46
+ require_relative "./rpg/troop_page"
47
+ require_relative "./rpg/troop_page_condition"
48
+
49
+ require_relative "./rpg/animation"
50
+ require_relative "./rpg/animation_frame"
51
+ require_relative "./rpg/animation_timing"
52
+
53
+ require_relative "./rpg/tileset"
54
+
55
+ require_relative "./rpg/common_event"
56
+
57
+ require_relative "./rpg/system"
58
+ require_relative "./rpg/system_vehicle"
59
+ require_relative "./rpg/system_terms"
60
+ require_relative "./rpg/system_test_battler"
61
+
62
+ require_relative "./rpg/audio_file"
63
+ require_relative "./rpg/bgm"
64
+ require_relative "./rpg/bgs"
65
+ require_relative "./rpg/me"
66
+ require_relative "./rpg/se"
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # The RGBA color class.
5
+ #
6
+ # Each component is handled with a floating-point value (Float).
7
+ #
8
+ class Color
9
+ include RgssDb::Jsonable
10
+ extend RgssDb::JsonableConstructor
11
+
12
+ #
13
+ # Creates a Color object. If alpha is omitted, it is assumed to be 255.
14
+ #
15
+ # The default values when no arguments are specified are (0, 0, 0, 0).
16
+ #
17
+ # @param red [Integer]
18
+ # @param green [Integer]
19
+ # @param blue [Integer]
20
+ # @param alpha [Integer]
21
+ #
22
+ def initialize(red = 0, green = 0, blue = 0, alpha = 0)
23
+ @red = red
24
+ @green = green
25
+ @blue = blue
26
+ @alpha = [red, green, blue].sum.positive? && alpha.zero? ? 255 : alpha
27
+ end
28
+
29
+ #
30
+ # Dumps this instance into a binary string
31
+ #
32
+ # Note: needed for Marshal module support
33
+ #
34
+ # @return [String]
35
+ #
36
+ def _dump(*)
37
+ # double, double, double, double (double-precision)
38
+ [@red, @green, @blue, @alpha].pack("dddd")
39
+ end
40
+
41
+ #
42
+ # Creates a new instance using the given binary data
43
+ #
44
+ # Note: needed for Marshal module support
45
+ #
46
+ # @param serialized_string [String]
47
+ #
48
+ # @return [Color]
49
+ #
50
+ def self._load(serialized_string)
51
+ Color.new_serialized(serialized_string)
52
+ end
53
+
54
+ #
55
+ # Creates a new instance from a serialized string
56
+ #
57
+ # Note: needed for Marshal module support
58
+ #
59
+ # @param serialized_string [String]
60
+ #
61
+ # @return [Color]
62
+ #
63
+ def self.new_serialized(serialized_string)
64
+ # double, double, double, double (double-precision)
65
+ red, green, blue, alpha = serialized_string.unpack("dddd")
66
+
67
+ # Creates the instance
68
+ Color.new(red, green, blue, alpha)
69
+ end
70
+
71
+ attr_accessor :red, :green, :blue, :alpha
72
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # The rectangle class.
5
+ #
6
+ class Rect
7
+ include RgssDb::Jsonable
8
+ extend RgssDb::JsonableConstructor
9
+
10
+ #
11
+ # Creates a new Rect object.
12
+ #
13
+ # The default values when no arguments are specified are (0, 0, 0, 0).
14
+ #
15
+ # @param x [Integer]
16
+ # @param y [Integer]
17
+ # @param width [Integer]
18
+ # @param height [Integer]
19
+ #
20
+ def initialize(x = 0, y = 0, width = 0, height = 0)
21
+ @x = x
22
+ @y = y
23
+ @width = width
24
+ @height = height
25
+ end
26
+
27
+ #
28
+ # Dumps this instance into a binary string
29
+ #
30
+ # Note: needed for Marshal module support
31
+ #
32
+ # @return [String]
33
+ #
34
+ def _dump(*)
35
+ # int32_t, int32_t, int32_t, int32_t
36
+ [@x, @y, @width, @height].pack("llll")
37
+ end
38
+
39
+ #
40
+ # Creates a new instance using the given binary data
41
+ #
42
+ # Note: needed for Marshal module support
43
+ #
44
+ # @param serialized_string [String]
45
+ #
46
+ # @return [Rect]
47
+ #
48
+ def self._load(serialized_string)
49
+ Rect.new_serialized(serialized_string)
50
+ end
51
+
52
+ #
53
+ # Creates a new instance from a serialized string
54
+ #
55
+ # Note: needed for Marshal module support
56
+ #
57
+ # @param serialized_string [String]
58
+ #
59
+ # @return [Rect]
60
+ #
61
+ def self.new_serialized(serialized_string)
62
+ # int32_t, int32_t, int32_t, int32_t
63
+ x, y, width, height = serialized_string.unpack("llll")
64
+
65
+ # Creates the instance
66
+ Rect.new(x, y, width, height)
67
+ end
68
+
69
+ attr_accessor :x, :y, :width, :height
70
+ end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # The multidimensional array class.
5
+ #
6
+ # Each element is an integer of 2 signed bytes ranging from -32,768 to 32,767.
7
+ #
8
+ class Table
9
+ include RgssDb::Jsonable
10
+ extend RgssDb::JsonableConstructor
11
+
12
+ #
13
+ # Creates a Table object.
14
+ #
15
+ # Specifies the size of each dimension in the multidimensional array. 1-, 2-, and 3-dimensional arrays are possible.
16
+ #
17
+ # Arrays with no parameters are also permitted.
18
+ #
19
+ # @param xsize [Integer]
20
+ # @param ysize [Integer]
21
+ # @param zsize [Integer]
22
+ #
23
+ def initialize(xsize, ysize = 0, zsize = 0)
24
+ # RMXP needs dimensions
25
+ @dim = 1
26
+ @dim = 2 if ysize.positive?
27
+ @dim = 3 if zsize.positive?
28
+ @x = xsize
29
+ @y = ysize
30
+ @z = zsize
31
+ @data = []
32
+ end
33
+
34
+ #
35
+ # Dumps this instance into a binary string
36
+ #
37
+ # Note: needed for Marshal module support
38
+ #
39
+ # @return [String]
40
+ #
41
+ def _dump(*)
42
+ # int32_t, int32_t, int32_t, int32_t, int32_t, int16_t *
43
+ [@dim, @x, @y, @z, @x * @y * @z, *@data].pack("llllls*")
44
+ end
45
+
46
+ #
47
+ # Creates a new instance using the given binary data
48
+ #
49
+ # Note: needed for Marshal module support
50
+ #
51
+ # @param serialized_string [String]
52
+ #
53
+ # @return [Table]
54
+ #
55
+ def self._load(serialized_string)
56
+ Table.new_serialized(serialized_string)
57
+ end
58
+
59
+ #
60
+ # Creates a new instance from a serialized string
61
+ #
62
+ # Note: needed for Marshal module support
63
+ #
64
+ # @param serialized_string [String]
65
+ #
66
+ # @return [Table]
67
+ #
68
+ def self.new_serialized(serialized_string)
69
+ # int32_t, int32_t, int32_t, int32_t, int32_t, int16_t *
70
+ dim, x, y, z, size, *data = serialized_string.unpack("llllls*")
71
+
72
+ # Checks if written size value matches the actual size of the table
73
+ raise "Table: bad file format (size mismatch)" unless size == (x * y * z)
74
+ # Double check no data was lost
75
+ raise "Table: bad file format (data length mismatch)" unless size == data.length
76
+
77
+ # Creates the instance
78
+ table = Table.new(0, 0, 0)
79
+ table.dim = dim
80
+ table.x = x
81
+ table.y = y
82
+ table.z = z
83
+ table.data = data
84
+ table
85
+ end
86
+
87
+ #
88
+ # Returns a table instance for JSON deserialization
89
+ #
90
+ # @param args [Array]
91
+ #
92
+ # @return [Table]
93
+ #
94
+ def self.json_new(*args)
95
+ Table.new(0, 0, 0)
96
+ end
97
+
98
+ attr_accessor :dim, :x, :y, :z, :data
99
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # The color tone class.
5
+ #
6
+ # Each component is handled with a floating-point value (Float).
7
+ #
8
+ class Tone
9
+ include RgssDb::Jsonable
10
+ extend RgssDb::JsonableConstructor
11
+
12
+ #
13
+ # Creates a Tone object. If gray is omitted, it is assumed to be 0.
14
+ #
15
+ # The default values when no arguments are specified are (0, 0, 0, 0).
16
+ #
17
+ # @param red [Integer]
18
+ # @param green [Integer]
19
+ # @param blue [Integer]
20
+ # @param gray [Integer]
21
+ #
22
+ def initialize(red = 0, green = 0, blue = 0, gray = 0)
23
+ @red = red
24
+ @green = green
25
+ @blue = blue
26
+ @gray = gray
27
+ end
28
+
29
+ #
30
+ # Dumps this instance into a binary string
31
+ #
32
+ # Note: needed for Marshal module support
33
+ #
34
+ # @return [String]
35
+ #
36
+ def _dump(*)
37
+ # double, double, double, double (double-precision)
38
+ [@red, @green, @blue, @gray].pack("dddd")
39
+ end
40
+
41
+ #
42
+ # Creates a new instance using the given binary data
43
+ #
44
+ # Note: needed for Marshal module support
45
+ #
46
+ # @param serialized_string [String]
47
+ #
48
+ # @return [Tone]
49
+ #
50
+ def self._load(serialized_string)
51
+ Tone.new_serialized(serialized_string)
52
+ end
53
+
54
+ #
55
+ # Creates a new instance from a serialized string
56
+ #
57
+ # Note: needed for Marshal module support
58
+ #
59
+ # @param serialized_string [String]
60
+ #
61
+ # @return [Tone]
62
+ #
63
+ def self.new_serialized(serialized_string)
64
+ # double, double, double, double (double-precision)
65
+ red, green, blue, gray = serialized_string.unpack("dddd")
66
+
67
+ # Creates the instance
68
+ Tone.new(red, green, blue, gray)
69
+ end
70
+
71
+ attr_accessor :red, :green, :blue, :gray
72
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Application mixins
4
+ require_relative "../../mixins/jsonable"
5
+ require_relative "../../mixins/jsonable_constructor"
6
+
7
+ # RGSS Impl.
8
+ require_relative "./rgss/color"
9
+ require_relative "./rgss/rect"
10
+ require_relative "./rgss/table"
11
+ require_relative "./rgss/tone"
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RPG
4
+ #
5
+ # Data class for actors.
6
+ #
7
+ class Actor
8
+ include RgssDb::Jsonable
9
+ extend RgssDb::JsonableConstructor
10
+
11
+ def initialize
12
+ @id = 0
13
+ @name = ""
14
+ @class_id = 1
15
+ @initial_level = 1
16
+ @final_level = 99
17
+ @exp_basis = 30
18
+ @exp_inflation = 30
19
+ @character_name = ""
20
+ @character_hue = 0
21
+ @battler_name = ""
22
+ @battler_hue = 0
23
+ @parameters = Table.new(6, 100)
24
+ @weapon_id = 0
25
+ @armor1_id = 0
26
+ @armor2_id = 0
27
+ @armor3_id = 0
28
+ @armor4_id = 0
29
+ @weapon_fix = false
30
+ @armor1_fix = false
31
+ @armor2_fix = false
32
+ @armor3_fix = false
33
+ @armor4_fix = false
34
+ end
35
+
36
+ def to_s
37
+ @name.to_s
38
+ end
39
+
40
+ attr_accessor :id, :name, :class_id, :initial_level, :final_level, :exp_basis, :exp_inflation, :character_name,
41
+ :character_hue, :battler_name, :battler_hue, :parameters, :weapon_id, :armor1_id, :armor2_id,
42
+ :armor3_id, :armor4_id, :weapon_fix, :armor1_fix, :armor2_fix, :armor3_fix, :armor4_fix
43
+ end
44
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RPG
4
+ #
5
+ # Data class for animation.
6
+ #
7
+ class Animation
8
+ include RgssDb::Jsonable
9
+ extend RgssDb::JsonableConstructor
10
+
11
+ def initialize
12
+ @id = 0
13
+ @name = ""
14
+ @animation_name = ""
15
+ @animation_hue = 0
16
+ @position = 1
17
+ @frame_max = 1
18
+ @frames = [RPG::Animation::Frame.new]
19
+ @timings = []
20
+ end
21
+
22
+ def to_s
23
+ @name.to_s
24
+ end
25
+
26
+ attr_accessor :id, :name, :animation_name, :animation_hue, :position, :frame_max, :frames, :timings
27
+ end
28
+ end