rmxp_extractor 1.8 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (411) hide show
  1. checksums.yaml +4 -4
  2. data/CODE_OF_CONDUCT.md +74 -74
  3. data/Gemfile +13 -13
  4. data/Gemfile.lock +40 -40
  5. data/LICENSE.txt +21 -21
  6. data/README.md +37 -35
  7. data/Rakefile +6 -6
  8. data/bin/rmxp_extractor +13 -13
  9. data/bin/setup +8 -8
  10. data/diff_check.rb +13 -13
  11. data/lib/rmxp_extractor/classnames.rb +227 -245
  12. data/lib/rmxp_extractor/data_export.rb +80 -82
  13. data/lib/rmxp_extractor/data_import.rb +74 -69
  14. data/lib/rmxp_extractor/ron.rb +144 -144
  15. data/lib/rmxp_extractor/script_handler.rb +85 -85
  16. data/lib/rmxp_extractor/version.rb +3 -3
  17. data/lib/rmxp_extractor.rb +46 -46
  18. data/rmxp_extractor.gemspec +30 -30
  19. data/spec/spec_helper.rb +100 -100
  20. metadata +2 -393
  21. data/Data/Actors.rxdata +0 -0
  22. data/Data/Animations.rxdata +0 -0
  23. data/Data/Armors.rxdata +0 -0
  24. data/Data/Classes.rxdata +0 -0
  25. data/Data/CommonEvents.rxdata +0 -0
  26. data/Data/Enemies.rxdata +0 -0
  27. data/Data/Items.rxdata +0 -0
  28. data/Data/Map001.rxdata +0 -0
  29. data/Data/Map002.rxdata +0 -0
  30. data/Data/Map003.rxdata +0 -0
  31. data/Data/Map004.rxdata +0 -0
  32. data/Data/Map005.rxdata +0 -0
  33. data/Data/Map006.rxdata +0 -0
  34. data/Data/Map007.rxdata +0 -0
  35. data/Data/Map008.rxdata +0 -0
  36. data/Data/Map009.rxdata +0 -0
  37. data/Data/Map010.rxdata +0 -0
  38. data/Data/Map011.rxdata +0 -0
  39. data/Data/Map012.rxdata +0 -0
  40. data/Data/Map013.rxdata +0 -0
  41. data/Data/Map014.rxdata +0 -0
  42. data/Data/Map015.rxdata +0 -0
  43. data/Data/Map016.rxdata +0 -0
  44. data/Data/Map017.rxdata +0 -0
  45. data/Data/Map018.rxdata +0 -0
  46. data/Data/Map019.rxdata +0 -0
  47. data/Data/Map020.rxdata +0 -0
  48. data/Data/Map021.rxdata +0 -0
  49. data/Data/Map022.rxdata +0 -0
  50. data/Data/Map023.rxdata +0 -0
  51. data/Data/Map024.rxdata +0 -0
  52. data/Data/Map025.rxdata +0 -0
  53. data/Data/Map026.rxdata +0 -0
  54. data/Data/Map027.rxdata +0 -0
  55. data/Data/Map028.rxdata +0 -0
  56. data/Data/Map029.rxdata +0 -0
  57. data/Data/Map030.rxdata +0 -0
  58. data/Data/Map031.rxdata +0 -0
  59. data/Data/Map032.rxdata +0 -0
  60. data/Data/Map033.rxdata +0 -0
  61. data/Data/Map034.rxdata +0 -0
  62. data/Data/Map035.rxdata +0 -0
  63. data/Data/Map036.rxdata +0 -0
  64. data/Data/Map037.rxdata +0 -0
  65. data/Data/Map038.rxdata +0 -0
  66. data/Data/Map039.rxdata +0 -0
  67. data/Data/Map040.rxdata +0 -0
  68. data/Data/Map041.rxdata +0 -0
  69. data/Data/Map042.rxdata +0 -0
  70. data/Data/Map043.rxdata +0 -0
  71. data/Data/Map044.rxdata +0 -0
  72. data/Data/Map045.rxdata +0 -0
  73. data/Data/Map046.rxdata +0 -0
  74. data/Data/Map047.rxdata +0 -0
  75. data/Data/Map048.rxdata +0 -0
  76. data/Data/Map049.rxdata +0 -0
  77. data/Data/Map050.rxdata +0 -0
  78. data/Data/Map051.rxdata +0 -0
  79. data/Data/Map052.rxdata +0 -0
  80. data/Data/Map053.rxdata +0 -0
  81. data/Data/Map054.rxdata +0 -0
  82. data/Data/Map055.rxdata +0 -0
  83. data/Data/Map056.rxdata +0 -0
  84. data/Data/Map057.rxdata +0 -0
  85. data/Data/Map058.rxdata +0 -0
  86. data/Data/Map059.rxdata +0 -0
  87. data/Data/Map060.rxdata +0 -0
  88. data/Data/Map061.rxdata +0 -0
  89. data/Data/Map062.rxdata +0 -0
  90. data/Data/Map063.rxdata +0 -0
  91. data/Data/Map064.rxdata +0 -0
  92. data/Data/Map065.rxdata +0 -0
  93. data/Data/Map066.rxdata +0 -0
  94. data/Data/Map067.rxdata +0 -0
  95. data/Data/Map068.rxdata +0 -0
  96. data/Data/Map069.rxdata +0 -0
  97. data/Data/Map070.rxdata +0 -0
  98. data/Data/Map071.rxdata +0 -0
  99. data/Data/Map072.rxdata +0 -0
  100. data/Data/Map073.rxdata +0 -0
  101. data/Data/Map074.rxdata +0 -0
  102. data/Data/Map075.rxdata +0 -0
  103. data/Data/Map076.rxdata +0 -0
  104. data/Data/Map077.rxdata +0 -0
  105. data/Data/Map078.rxdata +0 -0
  106. data/Data/Map079.rxdata +0 -0
  107. data/Data/Map080.rxdata +0 -0
  108. data/Data/Map081.rxdata +0 -0
  109. data/Data/Map082.rxdata +0 -0
  110. data/Data/Map083.rxdata +0 -0
  111. data/Data/Map084.rxdata +0 -0
  112. data/Data/Map085.rxdata +0 -0
  113. data/Data/Map086.rxdata +0 -0
  114. data/Data/Map087.rxdata +0 -0
  115. data/Data/Map088.rxdata +0 -0
  116. data/Data/Map089.rxdata +0 -0
  117. data/Data/Map090.rxdata +0 -0
  118. data/Data/Map091.rxdata +0 -0
  119. data/Data/Map092.rxdata +0 -0
  120. data/Data/Map093.rxdata +0 -0
  121. data/Data/Map094.rxdata +0 -0
  122. data/Data/Map095.rxdata +0 -0
  123. data/Data/Map096.rxdata +0 -0
  124. data/Data/Map097.rxdata +0 -0
  125. data/Data/Map098.rxdata +0 -0
  126. data/Data/Map099.rxdata +0 -0
  127. data/Data/Map100.rxdata +0 -0
  128. data/Data/Map101.rxdata +0 -0
  129. data/Data/Map102.rxdata +0 -0
  130. data/Data/Map103.rxdata +0 -0
  131. data/Data/Map104.rxdata +0 -0
  132. data/Data/Map105.rxdata +0 -0
  133. data/Data/Map106.rxdata +0 -0
  134. data/Data/Map107.rxdata +0 -0
  135. data/Data/Map108.rxdata +0 -0
  136. data/Data/Map109.rxdata +0 -0
  137. data/Data/Map110.rxdata +0 -0
  138. data/Data/Map111.rxdata +0 -0
  139. data/Data/Map112.rxdata +0 -0
  140. data/Data/Map113.rxdata +0 -0
  141. data/Data/Map114.rxdata +0 -0
  142. data/Data/Map115.rxdata +0 -0
  143. data/Data/Map116.rxdata +0 -0
  144. data/Data/Map117.rxdata +0 -0
  145. data/Data/Map118.rxdata +0 -0
  146. data/Data/Map119.rxdata +0 -0
  147. data/Data/Map120.rxdata +0 -0
  148. data/Data/Map121.rxdata +0 -0
  149. data/Data/Map122.rxdata +0 -0
  150. data/Data/Map123.rxdata +0 -0
  151. data/Data/Map124.rxdata +0 -0
  152. data/Data/Map125.rxdata +0 -0
  153. data/Data/Map126.rxdata +0 -0
  154. data/Data/Map127.rxdata +0 -0
  155. data/Data/Map128.rxdata +0 -0
  156. data/Data/Map129.rxdata +0 -0
  157. data/Data/Map130.rxdata +0 -0
  158. data/Data/Map131.rxdata +0 -0
  159. data/Data/Map132.rxdata +0 -0
  160. data/Data/Map133.rxdata +0 -0
  161. data/Data/Map134.rxdata +0 -0
  162. data/Data/Map135.rxdata +0 -0
  163. data/Data/Map136.rxdata +0 -0
  164. data/Data/Map137.rxdata +0 -0
  165. data/Data/Map138.rxdata +0 -0
  166. data/Data/Map139.rxdata +0 -0
  167. data/Data/Map140.rxdata +0 -0
  168. data/Data/Map141.rxdata +0 -0
  169. data/Data/Map142.rxdata +0 -0
  170. data/Data/Map143.rxdata +0 -0
  171. data/Data/Map144.rxdata +0 -0
  172. data/Data/Map145.rxdata +0 -0
  173. data/Data/Map146.rxdata +0 -0
  174. data/Data/Map147.rxdata +0 -0
  175. data/Data/Map148.rxdata +0 -0
  176. data/Data/Map149.rxdata +0 -0
  177. data/Data/Map150.rxdata +0 -0
  178. data/Data/Map151.rxdata +0 -0
  179. data/Data/Map152.rxdata +0 -0
  180. data/Data/Map153.rxdata +0 -0
  181. data/Data/Map154.rxdata +0 -0
  182. data/Data/Map155.rxdata +0 -0
  183. data/Data/Map156.rxdata +0 -0
  184. data/Data/Map157.rxdata +0 -0
  185. data/Data/Map158.rxdata +0 -0
  186. data/Data/Map159.rxdata +0 -0
  187. data/Data/Map160.rxdata +0 -0
  188. data/Data/Map161.rxdata +0 -0
  189. data/Data/Map162.rxdata +0 -0
  190. data/Data/Map163.rxdata +0 -0
  191. data/Data/Map164.rxdata +0 -0
  192. data/Data/Map165.rxdata +0 -0
  193. data/Data/Map166.rxdata +0 -0
  194. data/Data/Map167.rxdata +0 -0
  195. data/Data/Map168.rxdata +0 -0
  196. data/Data/Map169.rxdata +0 -0
  197. data/Data/Map170.rxdata +0 -0
  198. data/Data/Map171.rxdata +0 -0
  199. data/Data/Map172.rxdata +0 -0
  200. data/Data/Map173.rxdata +0 -0
  201. data/Data/Map174.rxdata +0 -0
  202. data/Data/Map175.rxdata +0 -0
  203. data/Data/Map176.rxdata +0 -0
  204. data/Data/Map177.rxdata +0 -0
  205. data/Data/Map178.rxdata +0 -0
  206. data/Data/Map179.rxdata +0 -0
  207. data/Data/Map180.rxdata +0 -0
  208. data/Data/Map181.rxdata +0 -0
  209. data/Data/Map182.rxdata +0 -0
  210. data/Data/Map183.rxdata +0 -0
  211. data/Data/Map184.rxdata +0 -0
  212. data/Data/Map185.rxdata +0 -0
  213. data/Data/Map186.rxdata +0 -0
  214. data/Data/Map187.rxdata +0 -0
  215. data/Data/Map188.rxdata +0 -0
  216. data/Data/Map189.rxdata +0 -0
  217. data/Data/Map190.rxdata +0 -0
  218. data/Data/Map191.rxdata +0 -0
  219. data/Data/Map192.rxdata +0 -0
  220. data/Data/Map193.rxdata +0 -0
  221. data/Data/Map194.rxdata +0 -0
  222. data/Data/Map195.rxdata +0 -0
  223. data/Data/Map196.rxdata +0 -0
  224. data/Data/Map197.rxdata +0 -0
  225. data/Data/Map198.rxdata +0 -0
  226. data/Data/Map199.rxdata +0 -0
  227. data/Data/Map200.rxdata +0 -0
  228. data/Data/Map201.rxdata +0 -0
  229. data/Data/Map202.rxdata +0 -0
  230. data/Data/Map203.rxdata +0 -0
  231. data/Data/Map204.rxdata +0 -0
  232. data/Data/Map205.rxdata +0 -0
  233. data/Data/Map206.rxdata +0 -0
  234. data/Data/Map207.rxdata +0 -0
  235. data/Data/Map208.rxdata +0 -0
  236. data/Data/Map209.rxdata +0 -0
  237. data/Data/Map210.rxdata +0 -0
  238. data/Data/Map211.rxdata +0 -0
  239. data/Data/Map212.rxdata +0 -0
  240. data/Data/Map213.rxdata +0 -0
  241. data/Data/Map214.rxdata +0 -0
  242. data/Data/Map215.rxdata +0 -0
  243. data/Data/Map216.rxdata +0 -0
  244. data/Data/Map217.rxdata +0 -0
  245. data/Data/Map218.rxdata +0 -0
  246. data/Data/Map219.rxdata +0 -0
  247. data/Data/Map220.rxdata +0 -0
  248. data/Data/Map221.rxdata +0 -0
  249. data/Data/Map222.rxdata +0 -0
  250. data/Data/Map223.rxdata +0 -0
  251. data/Data/Map224.rxdata +0 -0
  252. data/Data/Map225.rxdata +0 -0
  253. data/Data/Map226.rxdata +0 -0
  254. data/Data/Map227.rxdata +0 -0
  255. data/Data/Map228.rxdata +0 -0
  256. data/Data/Map229.rxdata +0 -0
  257. data/Data/Map230.rxdata +0 -0
  258. data/Data/Map231.rxdata +0 -0
  259. data/Data/Map232.rxdata +0 -0
  260. data/Data/Map233.rxdata +0 -0
  261. data/Data/Map234.rxdata +0 -0
  262. data/Data/Map235.rxdata +0 -0
  263. data/Data/Map236.rxdata +0 -0
  264. data/Data/Map237.rxdata +0 -0
  265. data/Data/Map238.rxdata +0 -0
  266. data/Data/Map239.rxdata +0 -0
  267. data/Data/Map240.rxdata +0 -0
  268. data/Data/Map241.rxdata +0 -0
  269. data/Data/Map242.rxdata +0 -0
  270. data/Data/Map243.rxdata +0 -0
  271. data/Data/Map244.rxdata +0 -0
  272. data/Data/Map245.rxdata +0 -0
  273. data/Data/Map246.rxdata +0 -0
  274. data/Data/Map247.rxdata +0 -0
  275. data/Data/Map248.rxdata +0 -0
  276. data/Data/Map249.rxdata +0 -0
  277. data/Data/Map250.rxdata +0 -0
  278. data/Data/Map251.rxdata +0 -0
  279. data/Data/Map252.rxdata +0 -0
  280. data/Data/Map253.rxdata +0 -0
  281. data/Data/Map254.rxdata +0 -0
  282. data/Data/Map255.rxdata +0 -0
  283. data/Data/Map256.rxdata +0 -0
  284. data/Data/Map257.rxdata +0 -0
  285. data/Data/Map258.rxdata +0 -0
  286. data/Data/Map259.rxdata +0 -0
  287. data/Data/Map260.rxdata +0 -0
  288. data/Data/Map261.rxdata +0 -0
  289. data/Data/Map262.rxdata +0 -0
  290. data/Data/Map263.rxdata +0 -0
  291. data/Data/MapInfos.rxdata +0 -0
  292. data/Data/Scripts.rxdata +0 -0
  293. data/Data/Skills.rxdata +0 -0
  294. data/Data/States.rxdata +0 -0
  295. data/Data/System.rxdata +0 -0
  296. data/Data/Tilesets.rxdata +0 -0
  297. data/Data/Troops.rxdata +0 -0
  298. data/Data/Weapons.rxdata +0 -0
  299. data/Data/xScripts.rxdata +0 -0
  300. data/Scripts/Credits_Message.rb +0 -259
  301. data/Scripts/Data_FastTravel.rb +0 -50
  302. data/Scripts/Data_Footsteps.rb +0 -77
  303. data/Scripts/Data_Item.rb +0 -50
  304. data/Scripts/Data_SpecialEventData.rb +0 -60
  305. data/Scripts/Demo.rb +0 -7
  306. data/Scripts/Desktop_Message.rb +0 -210
  307. data/Scripts/Doc_Message.rb +0 -273
  308. data/Scripts/EdText.rb +0 -50
  309. data/Scripts/Ed_Message.rb +0 -234
  310. data/Scripts/FastTravel.rb +0 -175
  311. data/Scripts/Game_Actor.rb +0 -156
  312. data/Scripts/Game_Actors.rb +0 -28
  313. data/Scripts/Game_BattleAction.rb +0 -145
  314. data/Scripts/Game_Battler 1.rb +0 -307
  315. data/Scripts/Game_Battler 2.rb +0 -294
  316. data/Scripts/Game_Battler 3.rb +0 -354
  317. data/Scripts/Game_Character 1.rb +0 -291
  318. data/Scripts/Game_Character 2.rb +0 -355
  319. data/Scripts/Game_Character 3.rb +0 -505
  320. data/Scripts/Game_CommonEvent.rb +0 -70
  321. data/Scripts/Game_Enemy.rb +0 -317
  322. data/Scripts/Game_Event.rb +0 -264
  323. data/Scripts/Game_FastTravel.rb +0 -40
  324. data/Scripts/Game_Follower.rb +0 -76
  325. data/Scripts/Game_Light.rb +0 -13
  326. data/Scripts/Game_Map.rb +0 -551
  327. data/Scripts/Game_Oneshot.rb +0 -83
  328. data/Scripts/Game_Party.rb +0 -380
  329. data/Scripts/Game_Picture.rb +0 -164
  330. data/Scripts/Game_Player.rb +0 -298
  331. data/Scripts/Game_Screen.rb +0 -148
  332. data/Scripts/Game_SelfSwitches.rb +0 -30
  333. data/Scripts/Game_Switches.rb +0 -45
  334. data/Scripts/Game_System.rb +0 -210
  335. data/Scripts/Game_Temp.rb +0 -145
  336. data/Scripts/Game_Variables.rb +0 -36
  337. data/Scripts/Interpreter 1.rb +0 -320
  338. data/Scripts/Interpreter 2.rb +0 -286
  339. data/Scripts/Interpreter 3.rb +0 -474
  340. data/Scripts/Interpreter 4.rb +0 -327
  341. data/Scripts/Interpreter 5.rb +0 -448
  342. data/Scripts/Interpreter 6.rb +0 -307
  343. data/Scripts/Interpreter 7.rb +0 -282
  344. data/Scripts/Main.rb +0 -50
  345. data/Scripts/Particles.rb +0 -141
  346. data/Scripts/Persistent.rb +0 -71
  347. data/Scripts/Puzzle_Film.rb +0 -14
  348. data/Scripts/Puzzle_Pixel.rb +0 -210
  349. data/Scripts/Puzzle_Safe.rb +0 -152
  350. data/Scripts/Puzzle_Sokoban.rb +0 -14
  351. data/Scripts/RPG.rb +0 -55
  352. data/Scripts/SaveLoad.rb +0 -275
  353. data/Scripts/Scene_Debug.rb +0 -190
  354. data/Scripts/Scene_End.rb +0 -108
  355. data/Scripts/Scene_Equip.rb +0 -222
  356. data/Scripts/Scene_File.rb +0 -111
  357. data/Scripts/Scene_Item.rb +0 -205
  358. data/Scripts/Scene_Load.rb +0 -106
  359. data/Scripts/Scene_Map.rb +0 -540
  360. data/Scripts/Scene_Menu.rb +0 -213
  361. data/Scripts/Scene_Name.rb +0 -113
  362. data/Scripts/Scene_Save.rb +0 -88
  363. data/Scripts/Scene_Skill.rb +0 -232
  364. data/Scripts/Scene_Status.rb +0 -78
  365. data/Scripts/Scene_Title.rb +0 -237
  366. data/Scripts/Script.rb +0 -780
  367. data/Scripts/Sprite_Battler.rb +0 -131
  368. data/Scripts/Sprite_Character.rb +0 -192
  369. data/Scripts/Sprite_Footprint.rb +0 -35
  370. data/Scripts/Sprite_Footsplash.rb +0 -54
  371. data/Scripts/Sprite_Light.rb +0 -18
  372. data/Scripts/Sprite_MapText.rb +0 -63
  373. data/Scripts/Sprite_Picture.rb +0 -72
  374. data/Scripts/Sprite_Timer.rb +0 -52
  375. data/Scripts/Spriteset_Map.rb +0 -370
  376. data/Scripts/Window_Base.rb +0 -327
  377. data/Scripts/Window_BattleResult.rb +0 -51
  378. data/Scripts/Window_BattleStatus.rb +0 -62
  379. data/Scripts/Window_Command.rb +0 -49
  380. data/Scripts/Window_DebugLeft.rb +0 -57
  381. data/Scripts/Window_DebugRight.rb +0 -69
  382. data/Scripts/Window_EquipItem.rb +0 -94
  383. data/Scripts/Window_EquipLeft.rb +0 -61
  384. data/Scripts/Window_EquipRight.rb +0 -56
  385. data/Scripts/Window_Gold.rb +0 -27
  386. data/Scripts/Window_Help.rb +0 -33
  387. data/Scripts/Window_InputNumber.rb +0 -111
  388. data/Scripts/Window_Item.rb +0 -229
  389. data/Scripts/Window_MainMenu.rb +0 -150
  390. data/Scripts/Window_MenuStatus.rb +0 -48
  391. data/Scripts/Window_Message.rb +0 -459
  392. data/Scripts/Window_NameEdit.rb +0 -108
  393. data/Scripts/Window_NameInput.rb +0 -262
  394. data/Scripts/Window_PartyCommand.rb +0 -42
  395. data/Scripts/Window_PlayTime.rb +0 -40
  396. data/Scripts/Window_SaveFile.rb +0 -91
  397. data/Scripts/Window_Selectable.rb +0 -203
  398. data/Scripts/Window_Settings.rb +0 -469
  399. data/Scripts/Window_ShopBuy.rb +0 -93
  400. data/Scripts/Window_ShopCommand.rb +0 -37
  401. data/Scripts/Window_ShopNumber.rb +0 -87
  402. data/Scripts/Window_ShopSell.rb +0 -94
  403. data/Scripts/Window_ShopStatus.rb +0 -107
  404. data/Scripts/Window_Skill.rb +0 -83
  405. data/Scripts/Window_SkillStatus.rb +0 -28
  406. data/Scripts/Window_Status.rb +0 -64
  407. data/Scripts/Window_Steps.rb +0 -26
  408. data/Scripts/Window_Target.rb +0 -49
  409. data/Scripts/_scripts.txt +0 -111
  410. data/Scripts/i18n_English.rb +0 -59
  411. data/Scripts/i18n_Language.rb +0 -130
@@ -1,245 +1,227 @@
1
- def const_from_string(str)
2
- str.split("::").inject(Object) do |mod, class_name|
3
- mod.const_get(class_name)
4
- end
5
- end
6
-
7
- def create_from_rmxp_serialize(obj)
8
- if obj.is_a?(Hash)
9
- ret = {}
10
- # Hashes have no map method. Why? I dunno!
11
- obj.each do |key, value|
12
- if key.is_a?(String) && key.start_with?("class ")
13
- const = const_from_string(key.delete_prefix("class "))
14
- ret = const.new.from_rmxp_serialize(value)
15
- else
16
- if key.is_a?(String) && key =~ /\A[0-9]+\z/ # Key is an integer
17
- key = key.to_i
18
- end
19
- ret[key] = create_from_rmxp_serialize(value)
20
- end
21
- end
22
- return ret
23
- end
24
- if obj.is_a?(Array)
25
- obj.map! do |value|
26
- create_from_rmxp_serialize(value)
27
- end
28
- end
29
- ret = obj
30
- end
31
-
32
- class Object
33
- def rmxp_serialize
34
- hash = {}
35
- self.instance_variables.each { |var| hash[var.to_s.delete("@")] = self.instance_variable_get(var).rmxp_serialize }
36
- { "class #{self.class.name}" => hash }
37
- end
38
-
39
- def from_rmxp_serialize(hash)
40
- hash.each { |key, value| self.instance_variable_set("@#{key}", create_from_rmxp_serialize(value)) }
41
- self
42
- end
43
- end
44
-
45
- class Numeric
46
- def rmxp_serialize
47
- self
48
- end
49
- end
50
-
51
- class String
52
- def rmxp_serialize
53
- self
54
- end
55
- end
56
-
57
- class Array
58
- def rmxp_serialize
59
- arr = []
60
- self.each { |e| arr << e.rmxp_serialize }
61
- arr
62
- end
63
- end
64
-
65
- class Hash
66
- def rmxp_serialize
67
- hash = {}
68
- self.each { |key, value| hash[key] = value.rmxp_serialize }
69
- hash
70
- end
71
- end
72
-
73
- class TrueClass
74
- def rmxp_serialize
75
- self
76
- end
77
- end
78
-
79
- class FalseClass
80
- def rmxp_serialize
81
- self
82
- end
83
- end
84
-
85
- class NilClass
86
- def rmxp_serialize
87
- self
88
- end
89
- end
90
-
91
- class Color
92
- attr_accessor :red, :green, :blue, :alpha
93
-
94
- def _dump(limit)
95
- [@red, @green, @blue, @alpha].pack("EEEE")
96
- end
97
-
98
- def self._load(obj)
99
- red, green, blue, alpha = *obj.unpack("EEEE")
100
- obj = Color.new
101
- obj.red = red; obj.green = green; obj.blue = blue; obj.alpha = alpha
102
- obj
103
- end
104
- end
105
-
106
- class Table
107
- attr_accessor :num_of_dimensions, :xsize, :ysize, :zsize, :num_of_elements, :elements
108
-
109
- def _dump(limit)
110
- [@num_of_dimensions, @xsize, @ysize, @zsize, @num_of_elements, *@elements.flatten].pack("VVVVVv*")
111
- end
112
-
113
- def self._load(obj)
114
- data = obj.unpack("VVVVVv*")
115
- obj = self.new
116
- num_of_dimensions, xsize, ysize, zsize, num_of_elements, *elements = *data
117
- if num_of_dimensions > 1
118
- if xsize > 1
119
- elements = elements.each_slice(xsize).to_a
120
- else
121
- elements = elements.map { |element| [element] }
122
- end
123
- end
124
- if num_of_dimensions > 2
125
- if ysize > 1
126
- elements = elements.each_slice(ysize).to_a
127
- else
128
- elements = elements.map { |element| [element] }
129
- end
130
- end
131
- obj.num_of_dimensions = num_of_dimensions; obj.xsize = xsize; obj.ysize = ysize; obj.zsize = zsize; obj.elements = elements
132
- obj
133
- end
134
- end
135
-
136
- class Tone
137
- attr_accessor :red, :green, :blue, :gray
138
-
139
- def _dump(limit)
140
- [@red, @green, @blue, @gray].pack("EEEE")
141
- end
142
-
143
- def self._load(obj)
144
- red, green, blue, gray = *obj.unpack("EEEE")
145
- obj = Tone.new
146
- obj.red = red; obj.green = green; obj.blue = blue; obj.gray = gray
147
- obj
148
- end
149
- end
150
-
151
- module RPG
152
- class Event
153
- class Page
154
- class Condition
155
- end
156
-
157
- class Graphic
158
- end
159
- end
160
- end
161
-
162
- class EventCommand
163
- end
164
-
165
- class MoveRoute
166
- end
167
-
168
- class MoveCommand
169
- end
170
-
171
- class Map
172
- end
173
-
174
- class MapInfo
175
- end
176
-
177
- class AudioFile
178
- end
179
-
180
- class System
181
- class Words
182
- end
183
-
184
- class TestBattler
185
- end
186
- end
187
-
188
- class CommonEvent
189
- end
190
-
191
- class Tileset
192
- end
193
-
194
- class State
195
- end
196
-
197
- class Animation
198
- class Frame
199
- end
200
-
201
- class Timing
202
- end
203
- end
204
-
205
- class Class
206
- class Learning
207
- end
208
- end
209
-
210
- class Actor
211
- end
212
-
213
- class Skill
214
- end
215
-
216
- class Item
217
- end
218
-
219
- class Weapon
220
- end
221
-
222
- class Armor
223
- end
224
-
225
- class Enemy
226
- class Action
227
- end
228
- end
229
-
230
- class Troop
231
- class Member
232
- end
233
-
234
- class Page
235
- class Condition
236
- end
237
- end
238
- end
239
- end
240
-
241
- class Script
242
- attr_accessor :id
243
- attr_accessor :name
244
- attr_accessor :data
245
- end
1
+ def const_from_string(str)
2
+ str.split("::").inject(Object) do |mod, class_name|
3
+ mod.const_get(class_name)
4
+ end
5
+ end
6
+
7
+ def create_from_rmxp_serialize(obj)
8
+ if obj.is_a?(Hash)
9
+ ret = {}
10
+ # Hashes have no map method. Why? I dunno!
11
+ obj.each do |key, value|
12
+ if key.is_a?(String) && key.start_with?("class ")
13
+ const = const_from_string(key.delete_prefix("class "))
14
+ ret = const.new.from_rmxp_serialize(value)
15
+ else
16
+ if key.is_a?(String) && key =~ /\A[0-9]+\z/ # Key is an integer
17
+ key = key.to_i
18
+ end
19
+ ret[key] = create_from_rmxp_serialize(value)
20
+ end
21
+ end
22
+ return ret
23
+ end
24
+ if obj.is_a?(Array)
25
+ obj.map! do |value|
26
+ create_from_rmxp_serialize(value)
27
+ end
28
+ end
29
+ ret = obj
30
+ end
31
+
32
+ class Object
33
+ def rmxp_serialize
34
+ hash = {}
35
+ self.instance_variables.sort.each { |var| hash[var.to_s.delete("@")] = self.instance_variable_get(var).rmxp_serialize }
36
+ { "class #{self.class.name}" => hash }
37
+ end
38
+
39
+ def from_rmxp_serialize(hash)
40
+ hash.each { |key, value| self.instance_variable_set("@#{key}", create_from_rmxp_serialize(value)) }
41
+ self
42
+ end
43
+ end
44
+
45
+ class Numeric
46
+ def rmxp_serialize
47
+ self
48
+ end
49
+ end
50
+
51
+ class String
52
+ def rmxp_serialize
53
+ self
54
+ end
55
+ end
56
+
57
+ class Array
58
+ def rmxp_serialize
59
+ arr = []
60
+ self.each { |e| arr << e.rmxp_serialize }
61
+ arr
62
+ end
63
+ end
64
+
65
+ class Hash
66
+ def rmxp_serialize
67
+ hash = {}
68
+ self.sort.each { |key, value| hash[key] = value.rmxp_serialize }
69
+ hash
70
+ end
71
+ end
72
+
73
+ class TrueClass
74
+ def rmxp_serialize
75
+ self
76
+ end
77
+ end
78
+
79
+ class FalseClass
80
+ def rmxp_serialize
81
+ self
82
+ end
83
+ end
84
+
85
+ class NilClass
86
+ def rmxp_serialize
87
+ self
88
+ end
89
+ end
90
+
91
+ class Color
92
+ attr_accessor :red, :green, :blue, :alpha
93
+
94
+ def _dump(limit)
95
+ [@red, @green, @blue, @alpha].pack("d4")
96
+ end
97
+
98
+ def self._load(data)
99
+ obj = Color.new
100
+ obj.red, obj.green, obj.blue, obj.alpha = *data.unpack("d4")
101
+ obj
102
+ end
103
+ end
104
+
105
+ class Table
106
+ attr_accessor :num_of_dimensions, :xsize, :ysize, :zsize, :num_of_elements, :elements
107
+
108
+ def _dump(limit)
109
+ [@num_of_dimensions, @xsize, @ysize, @zsize, @num_of_elements, @elements].flatten.pack("VVVVVv*")
110
+ end
111
+
112
+ def self._load(data)
113
+ obj = self.new
114
+ obj.num_of_dimensions, obj.xsize, obj.ysize, obj.zsize, obj.num_of_elements, *obj.elements = *data.unpack("VVVVVv*")
115
+ obj
116
+ end
117
+ end
118
+
119
+ class Tone
120
+ attr_accessor :red, :green, :blue, :gray
121
+
122
+ def _dump(limit)
123
+ [@red, @green, @blue, @gray].pack("d4")
124
+ end
125
+
126
+ def self._load(data)
127
+ obj = Tone.new
128
+ obj.red, obj.green, obj.blue, obj.gray = *data.unpack("d4")
129
+ obj
130
+ end
131
+ end
132
+
133
+ module RPG
134
+ class Event
135
+ class Page
136
+ class Condition
137
+ end
138
+
139
+ class Graphic
140
+ end
141
+ end
142
+ end
143
+
144
+ class EventCommand
145
+ end
146
+
147
+ class MoveRoute
148
+ end
149
+
150
+ class MoveCommand
151
+ end
152
+
153
+ class Map
154
+ end
155
+
156
+ class MapInfo
157
+ end
158
+
159
+ class AudioFile
160
+ end
161
+
162
+ class System
163
+ class Words
164
+ end
165
+
166
+ class TestBattler
167
+ end
168
+ end
169
+
170
+ class CommonEvent
171
+ end
172
+
173
+ class Tileset
174
+ end
175
+
176
+ class State
177
+ end
178
+
179
+ class Animation
180
+ class Frame
181
+ end
182
+
183
+ class Timing
184
+ end
185
+ end
186
+
187
+ class Class
188
+ class Learning
189
+ end
190
+ end
191
+
192
+ class Actor
193
+ end
194
+
195
+ class Skill
196
+ end
197
+
198
+ class Item
199
+ end
200
+
201
+ class Weapon
202
+ end
203
+
204
+ class Armor
205
+ end
206
+
207
+ class Enemy
208
+ class Action
209
+ end
210
+ end
211
+
212
+ class Troop
213
+ class Member
214
+ end
215
+
216
+ class Page
217
+ class Condition
218
+ end
219
+ end
220
+ end
221
+ end
222
+
223
+ class Script
224
+ attr_accessor :id
225
+ attr_accessor :name
226
+ attr_accessor :data
227
+ end
@@ -1,82 +1,80 @@
1
- module RMXPExtractor
2
- def self.export(format)
3
- format ||= "json"
4
- STDERR.puts "No Data Directory!" unless Dir.exists? "./Data"
5
- exit 1 unless Dir.exists? "./Data"
6
-
7
- require "json"
8
- require "yaml"
9
- require "amazing_print"
10
- require "ruby-progressbar"
11
- require "fileutils"
12
- require "pathname"
13
- require "readline"
14
- require_relative "classnames"
15
- require_relative "script_handler"
16
-
17
- if format == "ron"
18
- require_relative "ron"
19
- end
20
-
21
- window_size = 120
22
- progress_format = "%a /%e |%B| %p%% %c/%C %r files/sec %t, currently processing: "
23
- progress = ProgressBar.create(
24
- format: progress_format,
25
- starting_at: 0,
26
- total: nil,
27
- output: $stderr,
28
- length: window_size,
29
- title: "exported",
30
- remainder_mark: "\e[0;30m█\e[0m",
31
- progress_mark: "█",
32
- unknown_progress_animation_steps: ["==>", ">==", "=>="],
33
- )
34
- Dir.mkdir "./Data_#{format.upcase}" unless Dir.exists? "./Data_#{format.upcase}"
35
- paths = Pathname.glob(("./Data/" + ("*" + ".rxdata")))
36
- count = paths.size
37
- progress.total = count
38
- paths.each_with_index do |path, i|
39
- content = Hash.new
40
-
41
- name = path.basename(".rxdata")
42
- begin
43
- rxdata = Marshal.load(path.read(mode: "rb"))
44
- rescue TypeError => e # Failed to load
45
- puts "Failed to load file #{path}.\n"
46
- next
47
- end
48
-
49
- progress.format = progress_format + name.to_s
50
- case name.to_s
51
- when "xScripts", "Scripts"
52
- RMXPExtractor.rpgscript("./", "./Scripts", "#{name.to_s}.rxdata", true)
53
- content["data"] = rxdata.map do |a|
54
- s = Script.new
55
- s.id, s.name, s.data = a
56
- s.data = s.data.bytes
57
- s
58
- end.rmxp_serialize
59
- content["version"] = VERSION
60
- else
61
- content["data"] = rxdata.rmxp_serialize
62
- content["version"] = VERSION
63
- end
64
-
65
- file = File.open("./Data_#{format.upcase}/" + name.sub_ext(".#{format}").to_s, "wb")
66
- file.puts case format
67
- when "yaml"
68
- content.to_yaml
69
- when "json"
70
- JSON.pretty_generate(content)
71
- when "toml"
72
- TomlRB.dump(content)
73
- when "rb"
74
- content.ai(index: false, indent: 2, plain: true)
75
- when "ron"
76
- content["data"]
77
- end
78
-
79
- progress.increment
80
- end
81
- end
82
- end
1
+ module RMXPExtractor
2
+ def self.export(format)
3
+ format ||= "json"
4
+ STDERR.puts "No Data Directory!" unless Dir.exist? "./Data"
5
+ exit 1 unless Dir.exist? "./Data"
6
+
7
+ require "json"
8
+ require "yaml"
9
+ require "amazing_print"
10
+ require "ruby-progressbar"
11
+ require "fileutils"
12
+ require "pathname"
13
+ require "readline"
14
+ require_relative "classnames"
15
+ require_relative "script_handler"
16
+
17
+ if format == "ron"
18
+ require_relative "ron"
19
+ end
20
+
21
+ window_size = 120
22
+ progress_format = "%a /%e |%B| %p%% %c/%C %r files/sec %t, currently processing: "
23
+ progress = ProgressBar.create(
24
+ format: progress_format,
25
+ starting_at: 0,
26
+ total: nil,
27
+ output: $stderr,
28
+ length: window_size,
29
+ title: "exported",
30
+ remainder_mark: "\e[0;30m█\e[0m",
31
+ progress_mark: "█",
32
+ unknown_progress_animation_steps: ["==>", ">==", "=>="],
33
+ )
34
+ Dir.mkdir "./Data_#{format.upcase}" unless Dir.exist? "./Data_#{format.upcase}"
35
+ paths = Pathname.glob(("./Data/" + ("*" + ".rxdata")))
36
+ count = paths.size
37
+ progress.total = count
38
+ paths.each_with_index do |path, i|
39
+ content = Hash.new
40
+
41
+ name = path.basename(".rxdata")
42
+ begin
43
+ rxdata = Marshal.load(path.read(mode: "rb"))
44
+ rescue TypeError => e # Failed to load
45
+ puts "Failed to load file #{path}.\n"
46
+ next
47
+ end
48
+
49
+ progress.format = progress_format + name.to_s
50
+ case name.to_s
51
+ when "xScripts", "Scripts"
52
+ RMXPExtractor.rpgscript("./", "./Scripts", "#{name.to_s}.rxdata", true)
53
+ content["data"] = rxdata.map do |a|
54
+ s = Script.new
55
+ s.id, s.name, s.data = a
56
+ s.data = s.data.bytes
57
+ s
58
+ end.rmxp_serialize
59
+ content["version"] = VERSION
60
+ else
61
+ content["data"] = rxdata.rmxp_serialize
62
+ content["version"] = VERSION
63
+ end
64
+
65
+ file = File.open("./Data_#{format.upcase}/" + name.sub_ext(".#{format}").to_s, "wb")
66
+ file.puts case format
67
+ when "yaml"
68
+ content.to_yaml
69
+ when "json"
70
+ JSON.pretty_generate(content)
71
+ when "rb"
72
+ content.ai(index: false, indent: 2, plain: true)
73
+ when "ron"
74
+ content["data"]
75
+ end
76
+
77
+ progress.increment
78
+ end
79
+ end
80
+ end