Advertisement
M3rein

RGSS classes

Aug 12th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.29 KB | None | 0 0
  1. require 'rubygems'
  2. require 'rgss'
  3. require 'zliby'
  4.  
  5. module RPG
  6. class Map
  7. def initialize(width, height)
  8. @tileset_id = 1
  9. @width = width
  10. @height = height
  11. @autoplay_bgm = false
  12. @bgm = RPG::AudioFile.new
  13. @autoplay_bgs = false
  14. @bgs = RPG::AudioFile.new("", 80)
  15. @encounter_list = []
  16. @encounter_step = 30
  17. @data = Table.new(width, height, 3)
  18. @events = {}
  19. end
  20. attr_accessor :tileset_id
  21. attr_accessor :width
  22. attr_accessor :height
  23. attr_accessor :autoplay_bgm
  24. attr_accessor :bgm
  25. attr_accessor :autoplay_bgs
  26. attr_accessor :bgs
  27. attr_accessor :encounter_list
  28. attr_accessor :encounter_step
  29. attr_accessor :data
  30. attr_accessor :events
  31. end
  32.  
  33. class MapInfo
  34. def initialize
  35. @name = ""
  36. @parent_id = 0
  37. @order = 0
  38. @expanded = false
  39. @scroll_x = 0
  40. @scroll_y = 0
  41. end
  42. attr_accessor :name
  43. attr_accessor :parent_id
  44. attr_accessor :order
  45. attr_accessor :expanded
  46. attr_accessor :scroll_x
  47. attr_accessor :scroll_y
  48. end
  49.  
  50. class Event
  51. def initialize(x, y)
  52. @id = 0
  53. @name = ""
  54. @x = x
  55. @y = y
  56. @pages = [RPG::Event::Page.new]
  57. end
  58. attr_accessor :id
  59. attr_accessor :name
  60. attr_accessor :x
  61. attr_accessor :y
  62. attr_accessor :pages
  63.  
  64. class Page
  65. def initialize
  66. @condition = RPG::Event::Page::Condition.new
  67. @graphic = RPG::Event::Page::Graphic.new
  68. @move_type = 0
  69. @move_speed = 3
  70. @move_frequency = 3
  71. @move_route = RPG::MoveRoute.new
  72. @walk_anime = true
  73. @step_anime = false
  74. @direction_fix = false
  75. @through = false
  76. @always_on_top = false
  77. @trigger = 0
  78. @list = [RPG::EventCommand.new]
  79. end
  80. attr_accessor :condition
  81. attr_accessor :graphic
  82. attr_accessor :move_type
  83. attr_accessor :move_speed
  84. attr_accessor :move_frequency
  85. attr_accessor :move_route
  86. attr_accessor :walk_anime
  87. attr_accessor :step_anime
  88. attr_accessor :direction_fix
  89. attr_accessor :through
  90. attr_accessor :always_on_top
  91. attr_accessor :trigger
  92. attr_accessor :list
  93.  
  94. class Condition
  95. def initialize
  96. @switch1_valid = false
  97. @switch2_valid = false
  98. @variable_valid = false
  99. @self_switch_valid = false
  100. @switch1_id = 1
  101. @switch2_id = 1
  102. @variable_id = 1
  103. @variable_value = 0
  104. @self_switch_ch = "A"
  105. end
  106. attr_accessor :switch1_valid
  107. attr_accessor :switch2_valid
  108. attr_accessor :variable_valid
  109. attr_accessor :self_switch_valid
  110. attr_accessor :switch1_id
  111. attr_accessor :switch2_id
  112. attr_accessor :variable_id
  113. attr_accessor :variable_value
  114. attr_accessor :self_switch_ch
  115. end
  116.  
  117. class Graphic
  118. def initialize
  119. @tile_id = 0
  120. @character_name = ""
  121. @character_hue = 0
  122. @direction = 2
  123. @pattern = 0
  124. @opacity = 255
  125. @blend_type = 0
  126. end
  127. attr_accessor :tile_id
  128. attr_accessor :character_name
  129. attr_accessor :character_hue
  130. attr_accessor :direction
  131. attr_accessor :pattern
  132. attr_accessor :opacity
  133. attr_accessor :blend_type
  134. end
  135. end
  136. end
  137. class EventCommand
  138. def initialize(code = 0, indent = 0, parameters = [])
  139. @code = code
  140. @indent = indent
  141. @parameters = parameters
  142. end
  143. attr_accessor :code
  144. attr_accessor :indent
  145. attr_accessor :parameters
  146. end
  147.  
  148. class MoveRoute
  149. def initialize
  150. @repeat = true
  151. @skippable = false
  152. @list = [RPG::MoveCommand.new]
  153. end
  154. attr_accessor :repeat
  155. attr_accessor :skippable
  156. attr_accessor :list
  157. end
  158.  
  159. class MoveCommand
  160. def initialize(code = 0, parameters = [])
  161. @code = code
  162. @parameters = parameters
  163. end
  164. attr_accessor :code
  165. attr_accessor :parameters
  166. end
  167.  
  168. class Actor
  169. def initialize
  170. @id = 0
  171. @name = ""
  172. @class_id = 1
  173. @initial_level = 1
  174. @final_level = 99
  175. @exp_basis = 30
  176. @exp_inflation = 30
  177. @character_name = ""
  178. @character_hue = 0
  179. @battler_name = ""
  180. @battler_hue = 0
  181. @parameters = Table.new(6,100)
  182. for i in 1..99
  183. @parameters[0,i] = 500+i*50
  184. @parameters[1,i] = 500+i*50
  185. @parameters[2,i] = 50+i*5
  186. @parameters[3,i] = 50+i*5
  187. @parameters[4,i] = 50+i*5
  188. @parameters[5,i] = 50+i*5
  189. end
  190. @weapon_id = 0
  191. @armor1_id = 0
  192. @armor2_id = 0
  193. @armor3_id = 0
  194. @armor4_id = 0
  195. @weapon_fix = false
  196. @armor1_fix = false
  197. @armor2_fix = false
  198. @armor3_fix = false
  199. @armor4_fix = false
  200. end
  201. attr_accessor :id
  202. attr_accessor :name
  203. attr_accessor :class_id
  204. attr_accessor :initial_level
  205. attr_accessor :final_level
  206. attr_accessor :exp_basis
  207. attr_accessor :exp_inflation
  208. attr_accessor :character_name
  209. attr_accessor :character_hue
  210. attr_accessor :battler_name
  211. attr_accessor :battler_hue
  212. attr_accessor :parameters
  213. attr_accessor :weapon_id
  214. attr_accessor :armor1_id
  215. attr_accessor :armor2_id
  216. attr_accessor :armor3_id
  217. attr_accessor :armor4_id
  218. attr_accessor :weapon_fix
  219. attr_accessor :armor1_fix
  220. attr_accessor :armor2_fix
  221. attr_accessor :armor3_fix
  222. attr_accessor :armor4_fix
  223. end
  224.  
  225. class Class
  226. def initialize
  227. @id = 0
  228. @name = ""
  229. @position = 0
  230. @weapon_set = []
  231. @armor_set = []
  232. @element_ranks = Table.new(1)
  233. @state_ranks = Table.new(1)
  234. @learnings = []
  235. end
  236. attr_accessor :id
  237. attr_accessor :name
  238. attr_accessor :position
  239. attr_accessor :weapon_set
  240. attr_accessor :armor_set
  241. attr_accessor :element_ranks
  242. attr_accessor :state_ranks
  243. attr_accessor :learnings
  244.  
  245. class Learning
  246. def initialize
  247. @level = 1
  248. @skill_id = 1
  249. end
  250. attr_accessor :level
  251. attr_accessor :skill_id
  252. end
  253. end
  254.  
  255. class Skill
  256. def initialize
  257. @id = 0
  258. @name = ""
  259. @icon_name = ""
  260. @description = ""
  261. @scope = 0
  262. @occasion = 1
  263. @animation1_id = 0
  264. @animation2_id = 0
  265. @menu_se = RPG::AudioFile.new("", 80)
  266. @common_event_id = 0
  267. @sp_cost = 0
  268. @power = 0
  269. @atk_f = 0
  270. @eva_f = 0
  271. @str_f = 0
  272. @dex_f = 0
  273. @agi_f = 0
  274. @int_f = 100
  275. @hit = 100
  276. @pdef_f = 0
  277. @mdef_f = 100
  278. @variance = 15
  279. @element_set = []
  280. @plus_state_set = []
  281. @minus_state_set = []
  282. end
  283. attr_accessor :id
  284. attr_accessor :name
  285. attr_accessor :icon_name
  286. attr_accessor :description
  287. attr_accessor :scope
  288. attr_accessor :occasion
  289. attr_accessor :animation1_id
  290. attr_accessor :animation2_id
  291. attr_accessor :menu_se
  292. attr_accessor :common_event_id
  293. attr_accessor :sp_cost
  294. attr_accessor :power
  295. attr_accessor :atk_f
  296. attr_accessor :eva_f
  297. attr_accessor :str_f
  298. attr_accessor :dex_f
  299. attr_accessor :agi_f
  300. attr_accessor :int_f
  301. attr_accessor :hit
  302. attr_accessor :pdef_f
  303. attr_accessor :mdef_f
  304. attr_accessor :variance
  305. attr_accessor :element_set
  306. attr_accessor :plus_state_set
  307. attr_accessor :minus_state_set
  308. end
  309.  
  310. class Item
  311. def initialize
  312. @id = 0
  313. @name = ""
  314. @icon_name = ""
  315. @description = ""
  316. @scope = 0
  317. @occasion = 0
  318. @animation1_id = 0
  319. @animation2_id = 0
  320. @menu_se = RPG::AudioFile.new("", 80)
  321. @common_event_id = 0
  322. @price = 0
  323. @consumable = true
  324. @parameter_type = 0
  325. @parameter_points = 0
  326. @recover_hp_rate = 0
  327. @recover_hp = 0
  328. @recover_sp_rate = 0
  329. @recover_sp = 0
  330. @hit = 100
  331. @pdef_f = 0
  332. @mdef_f = 0
  333. @variance = 0
  334. @element_set = []
  335. @plus_state_set = []
  336. @minus_state_set = []
  337. end
  338. attr_accessor :id
  339. attr_accessor :name
  340. attr_accessor :icon_name
  341. attr_accessor :description
  342. attr_accessor :scope
  343. attr_accessor :occasion
  344. attr_accessor :animation1_id
  345. attr_accessor :animation2_id
  346. attr_accessor :menu_se
  347. attr_accessor :common_event_id
  348. attr_accessor :price
  349. attr_accessor :consumable
  350. attr_accessor :parameter_type
  351. attr_accessor :parameter_points
  352. attr_accessor :recover_hp_rate
  353. attr_accessor :recover_hp
  354. attr_accessor :recover_sp_rate
  355. attr_accessor :recover_sp
  356. attr_accessor :hit
  357. attr_accessor :pdef_f
  358. attr_accessor :mdef_f
  359. attr_accessor :variance
  360. attr_accessor :element_set
  361. attr_accessor :plus_state_set
  362. attr_accessor :minus_state_set
  363. end
  364.  
  365. class Weapon
  366. def initialize
  367. @id = 0
  368. @name = ""
  369. @icon_name = ""
  370. @description = ""
  371. @animation1_id = 0
  372. @animation2_id = 0
  373. @price = 0
  374. @atk = 0
  375. @pdef = 0
  376. @mdef = 0
  377. @str_plus = 0
  378. @dex_plus = 0
  379. @agi_plus = 0
  380. @int_plus = 0
  381. @element_set = []
  382. @plus_state_set = []
  383. @minus_state_set = []
  384. end
  385. attr_accessor :id
  386. attr_accessor :name
  387. attr_accessor :icon_name
  388. attr_accessor :description
  389. attr_accessor :animation1_id
  390. attr_accessor :animation2_id
  391. attr_accessor :price
  392. attr_accessor :atk
  393. attr_accessor :pdef
  394. attr_accessor :mdef
  395. attr_accessor :str_plus
  396. attr_accessor :dex_plus
  397. attr_accessor :agi_plus
  398. attr_accessor :int_plus
  399. attr_accessor :element_set
  400. attr_accessor :plus_state_set
  401. attr_accessor :minus_state_set
  402. end
  403.  
  404. class Armor
  405. def initialize
  406. @id = 0
  407. @name = ""
  408. @icon_name = ""
  409. @description = ""
  410. @kind = 0
  411. @auto_state_id = 0
  412. @price = 0
  413. @pdef = 0
  414. @mdef = 0
  415. @eva = 0
  416. @str_plus = 0
  417. @dex_plus = 0
  418. @agi_plus = 0
  419. @int_plus = 0
  420. @guard_element_set = []
  421. @guard_state_set = []
  422. end
  423. attr_accessor :id
  424. attr_accessor :name
  425. attr_accessor :icon_name
  426. attr_accessor :description
  427. attr_accessor :kind
  428. attr_accessor :auto_state_id
  429. attr_accessor :price
  430. attr_accessor :pdef
  431. attr_accessor :mdef
  432. attr_accessor :eva
  433. attr_accessor :str_plus
  434. attr_accessor :dex_plus
  435. attr_accessor :agi_plus
  436. attr_accessor :int_plus
  437. attr_accessor :guard_element_set
  438. attr_accessor :guard_state_set
  439. end
  440.  
  441. class Enemy
  442. def initialize
  443. @id = 0
  444. @name = ""
  445. @battler_name = ""
  446. @battler_hue = 0
  447. @maxhp = 500
  448. @maxsp = 500
  449. @str = 50
  450. @dex = 50
  451. @agi = 50
  452. @int = 50
  453. @atk = 100
  454. @pdef = 100
  455. @mdef = 100
  456. @eva = 0
  457. @animation1_id = 0
  458. @animation2_id = 0
  459. @element_ranks = Table.new(1)
  460. @state_ranks = Table.new(1)
  461. @actions = [RPG::Enemy::Action.new]
  462. @exp = 0
  463. @gold = 0
  464. @item_id = 0
  465. @weapon_id = 0
  466. @armor_id = 0
  467. @treasure_prob = 100
  468. end
  469. attr_accessor :id
  470. attr_accessor :name
  471. attr_accessor :battler_name
  472. attr_accessor :battler_hue
  473. attr_accessor :maxhp
  474. attr_accessor :maxsp
  475. attr_accessor :str
  476. attr_accessor :dex
  477. attr_accessor :agi
  478. attr_accessor :int
  479. attr_accessor :atk
  480. attr_accessor :pdef
  481. attr_accessor :mdef
  482. attr_accessor :eva
  483. attr_accessor :animation1_id
  484. attr_accessor :animation2_id
  485. attr_accessor :element_ranks
  486. attr_accessor :state_ranks
  487. attr_accessor :actions
  488. attr_accessor :exp
  489. attr_accessor :gold
  490. attr_accessor :item_id
  491. attr_accessor :weapon_id
  492. attr_accessor :armor_id
  493. attr_accessor :treasure_prob
  494.  
  495. class Action
  496. def initialize
  497. @kind = 0
  498. @basic = 0
  499. @skill_id = 1
  500. @condition_turn_a = 0
  501. @condition_turn_b = 1
  502. @condition_hp = 100
  503. @condition_level = 1
  504. @condition_switch_id = 0
  505. @rating = 5
  506. end
  507. attr_accessor :kind
  508. attr_accessor :basic
  509. attr_accessor :skill_id
  510. attr_accessor :condition_turn_a
  511. attr_accessor :condition_turn_b
  512. attr_accessor :condition_hp
  513. attr_accessor :condition_level
  514. attr_accessor :condition_switch_id
  515. attr_accessor :rating
  516. end
  517. end
  518.  
  519. class Troop
  520. def initialize
  521. @id = 0
  522. @name = ""
  523. @members = []
  524. @pages = [RPG::BattleEventPage.new]
  525. end
  526. attr_accessor :id
  527. attr_accessor :name
  528. attr_accessor :members
  529. attr_accessor :pages
  530.  
  531. class Member
  532. def initialize
  533. @enemy_id = 1
  534. @x = 0
  535. @y = 0
  536. @hidden = false
  537. @immortal = false
  538. end
  539. attr_accessor :enemy_id
  540. attr_accessor :x
  541. attr_accessor :y
  542. attr_accessor :hidden
  543. attr_accessor :immortal
  544. end
  545.  
  546. class Page
  547. def initialize
  548. @condition = RPG::Troop::Page::Condition.new
  549. @span = 0
  550. @list = [RPG::EventCommand.new]
  551. end
  552. attr_accessor :condition
  553. attr_accessor :span
  554. attr_accessor :list
  555.  
  556. class Condition
  557. def initialize
  558. @turn_valid = false
  559. @enemy_valid = false
  560. @actor_valid = false
  561. @switch_valid = false
  562. @turn_a = 0
  563. @turn_b = 0
  564. @enemy_index = 0
  565. @enemy_hp = 50
  566. @actor_id = 1
  567. @actor_hp = 50
  568. @switch_id = 1
  569. end
  570. attr_accessor :turn_valid
  571. attr_accessor :enemy_valid
  572. attr_accessor :actor_valid
  573. attr_accessor :switch_valid
  574. attr_accessor :turn_a
  575. attr_accessor :turn_b
  576. attr_accessor :enemy_index
  577. attr_accessor :enemy_hp
  578. attr_accessor :actor_id
  579. attr_accessor :actor_hp
  580. attr_accessor :switch_id
  581. end
  582. end
  583. end
  584.  
  585. class State
  586. def initialize
  587. @id = 0
  588. @name = ""
  589. @animation_id = 0
  590. @restriction = 0
  591. @nonresistance = false
  592. @zero_hp = false
  593. @cant_get_exp = false
  594. @cant_evade = false
  595. @slip_damage = false
  596. @rating = 5
  597. @hit_rate = 100
  598. @maxhp_rate = 100
  599. @maxsp_rate = 100
  600. @str_rate = 100
  601. @dex_rate = 100
  602. @agi_rate = 100
  603. @int_rate = 100
  604. @atk_rate = 100
  605. @pdef_rate = 100
  606. @mdef_rate = 100
  607. @eva = 0
  608. @battle_only = true
  609. @hold_turn = 0
  610. @auto_release_prob = 0
  611. @shock_release_prob = 0
  612. @guard_element_set = []
  613. @plus_state_set = []
  614. @minus_state_set = []
  615. end
  616. attr_accessor :id
  617. attr_accessor :name
  618. attr_accessor :animation_id
  619. attr_accessor :restriction
  620. attr_accessor :nonresistance
  621. attr_accessor :zero_hp
  622. attr_accessor :cant_get_exp
  623. attr_accessor :cant_evade
  624. attr_accessor :slip_damage
  625. attr_accessor :rating
  626. attr_accessor :hit_rate
  627. attr_accessor :maxhp_rate
  628. attr_accessor :maxsp_rate
  629. attr_accessor :str_rate
  630. attr_accessor :dex_rate
  631. attr_accessor :agi_rate
  632. attr_accessor :int_rate
  633. attr_accessor :atk_rate
  634. attr_accessor :pdef_rate
  635. attr_accessor :mdef_rate
  636. attr_accessor :eva
  637. attr_accessor :battle_only
  638. attr_accessor :hold_turn
  639. attr_accessor :auto_release_prob
  640. attr_accessor :shock_release_prob
  641. attr_accessor :guard_element_set
  642. attr_accessor :plus_state_set
  643. attr_accessor :minus_state_set
  644. end
  645. class Animation
  646. def initialize
  647. @id = 0
  648. @name = ""
  649. @animation_name = ""
  650. @animation_hue = 0
  651. @position = 1
  652. @frame_max = 1
  653. @frames = [RPG::Animation::Frame.new]
  654. @timings = []
  655. end
  656. attr_accessor :id
  657. attr_accessor :name
  658. attr_accessor :animation_name
  659. attr_accessor :animation_hue
  660. attr_accessor :position
  661. attr_accessor :frame_max
  662. attr_accessor :frames
  663. attr_accessor :timings
  664.  
  665. class Frame
  666. def initialize
  667. @cell_max = 0
  668. @cell_data = Table.new(0, 0)
  669. end
  670. attr_accessor :cell_max
  671. attr_accessor :cell_data
  672. end
  673.  
  674. class Timing
  675. def initialize
  676. @frame = 0
  677. @se = RPG::AudioFile.new("", 80)
  678. @flash_scope = 0
  679. @flash_color = Color.new(255,255,255,255)
  680. @flash_duration = 5
  681. @condition = 0
  682. end
  683. attr_accessor :frame
  684. attr_accessor :se
  685. attr_accessor :flash_scope
  686. attr_accessor :flash_color
  687. attr_accessor :flash_duration
  688. attr_accessor :condition
  689. end
  690. end
  691.  
  692. class Tileset
  693. def initialize
  694. @id = 0
  695. @name = ""
  696. @tileset_name = ""
  697. @autotile_names = [""]*7
  698. @panorama_name = ""
  699. @panorama_hue = 0
  700. @fog_name = ""
  701. @fog_hue = 0
  702. @fog_opacity = 64
  703. @fog_blend_type = 0
  704. @fog_zoom = 200
  705. @fog_sx = 0
  706. @fog_sy = 0
  707. @battleback_name = ""
  708. @passages = Table.new(384)
  709. @priorities = Table.new(384)
  710. @priorities[0] = 5
  711. @terrain_tags = Table.new(384)
  712. end
  713. attr_accessor :id
  714. attr_accessor :name
  715. attr_accessor :tileset_name
  716. attr_accessor :autotile_names
  717. attr_accessor :panorama_name
  718. attr_accessor :panorama_hue
  719. attr_accessor :fog_name
  720. attr_accessor :fog_hue
  721. attr_accessor :fog_opacity
  722. attr_accessor :fog_blend_type
  723. attr_accessor :fog_zoom
  724. attr_accessor :fog_sx
  725. attr_accessor :fog_sy
  726. attr_accessor :battleback_name
  727. attr_accessor :passages
  728. attr_accessor :priorities
  729. attr_accessor :terrain_tags
  730. end
  731.  
  732. class CommonEvent
  733. def initialize
  734. @id = 0
  735. @name = ""
  736. @trigger = 0
  737. @switch_id = 1
  738. @list = [RPG::EventCommand.new]
  739. end
  740. attr_accessor :id
  741. attr_accessor :name
  742. attr_accessor :trigger
  743. attr_accessor :switch_id
  744. attr_accessor :list
  745. end
  746.  
  747. class System
  748. def initialize
  749. @magic_number = 0
  750. @party_members = [1]
  751. @elements = [nil, ""]
  752. @switches = [nil, ""]
  753. @variables = [nil, ""]
  754. @windowskin_name = ""
  755. @title_name = ""
  756. @gameover_name = ""
  757. @battle_transition = ""
  758. @title_bgm = RPG::AudioFile.new
  759. @battle_bgm = RPG::AudioFile.new
  760. @battle_end_me = RPG::AudioFile.new
  761. @gameover_me = RPG::AudioFile.new
  762. @cursor_se = RPG::AudioFile.new("", 80)
  763. @decision_se = RPG::AudioFile.new("", 80)
  764. @cancel_se = RPG::AudioFile.new("", 80)
  765. @buzzer_se = RPG::AudioFile.new("", 80)
  766. @equip_se = RPG::AudioFile.new("", 80)
  767. @shop_se = RPG::AudioFile.new("", 80)
  768. @save_se = RPG::AudioFile.new("", 80)
  769. @load_se = RPG::AudioFile.new("", 80)
  770. @battle_start_se = RPG::AudioFile.new("", 80)
  771. @escape_se = RPG::AudioFile.new("", 80)
  772. @actor_collapse_se = RPG::AudioFile.new("", 80)
  773. @enemy_collapse_se = RPG::AudioFile.new("", 80)
  774. @words = RPG::System::Words.new
  775. @test_battlers = []
  776. @test_troop_id = 1
  777. @start_map_id = 1
  778. @start_x = 0
  779. @start_y = 0
  780. @battleback_name = ""
  781. @battler_name = ""
  782. @battler_hue = 0
  783. @edit_map_id = 1
  784. end
  785. attr_accessor :magic_number
  786. attr_accessor :party_members
  787. attr_accessor :elements
  788. attr_accessor :switches
  789. attr_accessor :variables
  790. attr_accessor :windowskin_name
  791. attr_accessor :title_name
  792. attr_accessor :gameover_name
  793. attr_accessor :battle_transition
  794. attr_accessor :title_bgm
  795. attr_accessor :battle_bgm
  796. attr_accessor :battle_end_me
  797. attr_accessor :gameover_me
  798. attr_accessor :cursor_se
  799. attr_accessor :decision_se
  800. attr_accessor :cancel_se
  801. attr_accessor :buzzer_se
  802. attr_accessor :equip_se
  803. attr_accessor :shop_se
  804. attr_accessor :save_se
  805. attr_accessor :load_se
  806. attr_accessor :battle_start_se
  807. attr_accessor :escape_se
  808. attr_accessor :actor_collapse_se
  809. attr_accessor :enemy_collapse_se
  810. attr_accessor :words
  811. attr_accessor :test_battlers
  812. attr_accessor :test_troop_id
  813. attr_accessor :start_map_id
  814. attr_accessor :start_x
  815. attr_accessor :start_y
  816. attr_accessor :battleback_name
  817. attr_accessor :battler_name
  818. attr_accessor :battler_hue
  819. attr_accessor :edit_map_id
  820.  
  821. class Words
  822. def initialize
  823. @gold = ""
  824. @hp = ""
  825. @sp = ""
  826. @str = ""
  827. @dex = ""
  828. @agi = ""
  829. @int = ""
  830. @atk = ""
  831. @pdef = ""
  832. @mdef = ""
  833. @weapon = ""
  834. @armor1 = ""
  835. @armor2 = ""
  836. @armor3 = ""
  837. @armor4 = ""
  838. @attack = ""
  839. @skill = ""
  840. @guard = ""
  841. @item = ""
  842. @equip = ""
  843. end
  844. attr_accessor :gold
  845. attr_accessor :hp
  846. attr_accessor :sp
  847. attr_accessor :str
  848. attr_accessor :dex
  849. attr_accessor :agi
  850. attr_accessor :int
  851. attr_accessor :atk
  852. attr_accessor :pdef
  853. attr_accessor :mdef
  854. attr_accessor :weapon
  855. attr_accessor :armor1
  856. attr_accessor :armor2
  857. attr_accessor :armor3
  858. attr_accessor :armor4
  859. attr_accessor :attack
  860. attr_accessor :skill
  861. attr_accessor :guard
  862. attr_accessor :item
  863. attr_accessor :equip
  864. end
  865.  
  866. class TestBattler
  867. def initialize
  868. @actor_id = 1
  869. @level = 1
  870. @weapon_id = 0
  871. @armor1_id = 0
  872. @armor2_id = 0
  873. @armor3_id = 0
  874. @armor4_id = 0
  875. end
  876. attr_accessor :actor_id
  877. attr_accessor :level
  878. attr_accessor :weapon_id
  879. attr_accessor :armor1_id
  880. attr_accessor :armor2_id
  881. attr_accessor :armor3_id
  882. attr_accessor :armor4_id
  883. end
  884. end
  885.  
  886. class AudioFile
  887. def initialize(name = "", volume = 100, pitch = 100)
  888. @name = name
  889. @volume = volume
  890. @pitch = pitch
  891. end
  892. attr_accessor :name
  893. attr_accessor :volume
  894. attr_accessor :pitch
  895. end
  896. end
  897.  
  898.  
  899. class Table # by vgvgf
  900. def initialize(x,y=1,z=1)
  901. @xsize,@ysize,@zsize=x,y,z
  902. @data=Array.new(x*y*z, 0)
  903. end
  904. def [](x,y=0,z=0)
  905. @data[x+y*@xsize+z*@xsize*@ysize]
  906. end
  907. def []=(*args)
  908. x=args[0]
  909. y=args.size>2 ?args[1]:0
  910. z=args.size>3 ?args[2]:0
  911. v=args.pop
  912. @data[x+y*@xsize+z*@xsize*@ysize]=v
  913. end
  914. def _dump(d=0)
  915. s=[3].pack('L')
  916. s+=[@xsize].pack('L')+[@ysize].pack('L')+[@zsize].pack('L')
  917. s+=[@xsize*@ysize*@zsize].pack('L')
  918. for z in 0...@zsize
  919. for y in 0...@ysize
  920. for x in 0...@xsize
  921. s+=[@data[x+y*@xsize+z*@xsize*@ysize],0,0].pack('L')[0,2]
  922. end
  923. end
  924. end
  925. s
  926. end
  927. attr_reader(:xsize,:ysize,:zsize,:data)
  928. class << self
  929. def _load(s)
  930. size=s[0,4].unpack('L')[0]
  931. nx=s[4,4].unpack('L')[0]
  932. ny=s[8,4].unpack('L')[0]
  933. nz=s[12,4].unpack('L')[0]
  934. data=[]
  935. pointer=20
  936. loop do
  937. data.push((s[pointer,2]+"\000\000").unpack('L')[0])
  938. pointer+=2
  939. break if pointer > s.size-1
  940. end
  941. t=Table.new(nx,ny,nz)
  942. n=0
  943. for z in 0...nz
  944. for y in 0...ny
  945. for x in 0...nx
  946. t[x,y,z]=data[n]
  947. n+=1
  948. end
  949. end
  950. end
  951. t
  952. end
  953. end
  954. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement