Guest User

S6 Falcao

a guest
Jan 22nd, 2016
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.09 KB | None | 0 0
  1. #===============================================================================
  2. # * Falcao Pearl ABS script shelf # 6
  3. #
  4. # This script handles all scenes related in pearl ABS
  5. #===============================================================================
  6.  
  7. module PearlScenes
  8.  
  9. # Cursor icon displayed when selecting a target
  10. CursorIcon = 389
  11.  
  12. # Status text displayed in the player selection menu
  13. DeathStatus = 'Death' # Displayed when death
  14. BadStatus = 'Bad' # Displayed when 0 to 25% of hp
  15. OverageStatus = 'Overage' # Displayed when 25 to 50% of hp
  16. GoodStatus = 'Good' # Displayed when 50 to 75% of hp
  17. ExellentStatus = 'Exellent' # Displayed when 75 to 100% of hp
  18. end
  19.  
  20. #===============================================================================
  21. # target slection engine
  22.  
  23. class Window_EventSelect < Window_Selectable
  24. attr_reader :participants
  25. def initialize(object)
  26. super(0, 0, 150, 192)
  27. self.z = 101
  28. @participants = []
  29. refresh(object)
  30. self.index = 0
  31. self.visible = false
  32. activate
  33. end
  34.  
  35. def item
  36. return @data[self.index]
  37. end
  38.  
  39. def refresh(object)
  40. self.contents.clear if self.contents != nil
  41. @data = []
  42. for character in object
  43. if character.is_a?(Game_Event)
  44. if character.on_battle_screen? and character.enemy_ready?
  45. @data.push(character)
  46. character.target_index = @data.size - 1
  47. @participants.push(character)
  48. end
  49. elsif character.on_battle_screen?
  50. next if character.battler.deadposing != nil and
  51. $game_map.map_id != character.battler.deadposing
  52. @data.push(character)
  53. character.target_index = @data.size - 1
  54. @participants.push(character)
  55. end
  56. end
  57. @item_max = @data.size
  58. if @item_max > 0
  59. self.contents = Bitmap.new(width - 32, row_max * 26)
  60. for i in 0...@item_max
  61. draw_item(i)
  62. end
  63. end
  64. end
  65.  
  66. def draw_item(index)
  67. item = @data[index]
  68. x, y = index % col_max * (120 + 32), index / col_max * 24
  69. self.contents.font.size = 16
  70. self.contents.draw_text(x + 24, y, 212, 32, 'none', 0)
  71. end
  72.  
  73. def item_max
  74. return @item_max.nil? ? 0 : @item_max
  75. end
  76. end
  77.  
  78. # Scenen events selection target
  79. class Scene_BattlerSelection < Scene_MenuBase
  80.  
  81. def start
  82. super
  83. @mouse_exist = defined?(Map_Buttons).is_a?(String)
  84. item = $game_player.targeting[1]
  85. if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
  86. load_target(item)
  87. else
  88. invoke = item.tool_data("Tool Invoke Skill = ")
  89. if invoke != 0
  90. load_target($data_skills[invoke])
  91. else
  92. @event_window = Window_EventSelect.new($game_map.events.values)
  93. end
  94. end
  95.  
  96. # info window
  97. @info_window = Sprite.new
  98. @event_window.item.nil? ? t = 'No targets!' : t = 'Select target'
  99. @info_window.bitmap = Bitmap.new(300, 60)
  100. @info_window.z = 900
  101. x, y = Graphics.width / 2 - 300 / 2, Graphics.height / 2 - 60 / 2
  102. @info_window.x = x; @info_window.y = y
  103. @info_window.bitmap.font.size = 30
  104. @info_window.bitmap.font.shadow = true
  105. @info_window.bitmap.draw_text(0, 0, @info_window.width, 32, t, 1)
  106. @info_time = 60
  107. create_cursor unless @event_window.item.nil?
  108. @background_sprite.color.set(16, 16, 16, 70)
  109. end
  110.  
  111. def create_name_sprites
  112. return if !@name_text.nil?
  113. @name_text = Sprite.new
  114. @name_text.bitmap = Bitmap.new(200, 60)
  115. @name_text.bitmap.font.size = 20
  116. @name_text.bitmap.font.shadow = true
  117. @name_text.x = @event_window.item.screen_x - 100
  118. @name_text.y = @event_window.item.screen_y - 58
  119. text = @event_window.item.battler.name
  120. @name_text.bitmap.draw_text(0, 0, @name_text.width, 32, text, 1)
  121. end
  122.  
  123. def dispose_name_sprites
  124. return if @name_text.nil?
  125. @name_text.bitmap.dispose
  126. @name_text.dispose
  127. @name_text = nil
  128. end
  129.  
  130. # load item target
  131. def load_target(item)
  132. if item.scope.between?(1, 6)
  133. @event_window = Window_EventSelect.new($game_map.events.values)
  134. else
  135. targets = []
  136. $game_player.followers.each {|i| targets << i if i.visible?}
  137. targets << $game_player
  138. @event_window = Window_EventSelect.new(targets)
  139. end
  140. end
  141.  
  142. def refresh_info(type)
  143. @info_window.bitmap.clear
  144. t = 'Invalid Target!' if type == 2
  145. @info_window.bitmap.draw_text(-30, 0, @info_window.width, 32, t, 1)
  146. end
  147.  
  148. def create_cursor
  149. if @mouse_exist
  150. @cursor = $mouse_cursor
  151. @cursor_zooming = 0 ; update_cursor_position
  152. return
  153. end
  154. @cursor = Sprite.new
  155. icon = PearlScenes::CursorIcon
  156. @cursor.bitmap = Bitmap.new(24, 24)
  157. bitmap = Cache.system("Iconset")
  158. rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
  159. @cursor.bitmap.blt(0, 0, bitmap, rect)
  160. @cursor_zooming = 0
  161. update_cursor_position
  162. end
  163.  
  164. def update
  165. super
  166. if Input.trigger?(:B)
  167. $game_player.targeting = [false, item=nil, char=nil]
  168. SceneManager.return
  169. Sound.play_cancel
  170. end
  171.  
  172. @info_time -= 1 if @info_time > 0
  173. if @info_time == 0
  174. @info_window.opacity -= 8 if @info_window.opacity > 0
  175. if @info_window.opacity == 0 and @event_window.item.nil?
  176. Sound.play_cancel
  177. $game_player.targeting = [false, item=nil, char=nil]
  178. SceneManager.return
  179. end
  180. end
  181. return if @event_window.item.nil?
  182. if @mouse_exist
  183. for target in @event_window.participants
  184. if Mouse.map_grid[0] == target.x and Mouse.map_grid[1] == target.y
  185. @event_window.select(target.target_index)
  186. end
  187. end
  188. end
  189.  
  190. if @current_index != @event_window.index
  191. @current_index = @event_window.index
  192. dispose_name_sprites
  193. create_name_sprites
  194. end
  195.  
  196. update_cursor_position
  197. update_target_selection
  198. end
  199.  
  200. # target selection
  201. def update_target_selection
  202. if Input.trigger?(:C)
  203. if @mouse_exist
  204. for event in @event_window.participants
  205. if Mouse.map_grid[0] == event.x and Mouse.map_grid[1] == event.y
  206. @event_window.select(event.target_index)
  207. @selected = true
  208. end
  209. end
  210.  
  211. if @selected.nil?
  212. refresh_info(2)
  213. @info_time = 60; @info_window.opacity = 255
  214. Sound.play_buzzer
  215. return
  216. end
  217. end
  218. Sound.play_ok
  219. $game_player.targeting[2] = @event_window.item
  220. SceneManager.return
  221. end
  222. end
  223.  
  224. def update_cursor_position
  225. if @mouse_exist
  226. @cursor.x = Mouse.pos[0]
  227. @cursor.y = Mouse.pos[1]
  228. else
  229. @cursor.x = @event_window.item.screen_x
  230. @cursor.y = @event_window.item.screen_y - 16
  231. end
  232. @cursor_zooming += 1
  233. case @cursor_zooming
  234. when 1..10 ; @cursor.zoom_x -= 0.01 ; @cursor.zoom_y -= 0.01
  235. when 11..20; @cursor.zoom_x += 0.01 ; @cursor.zoom_y += 0.01
  236. when 21..30; @cursor.zoom_x = 1.0 ; @cursor.zoom_y = 1.0
  237. @cursor_zooming = 0
  238. end
  239. end
  240.  
  241. def terminate
  242. super
  243. @event_window.dispose
  244. @info_window.dispose
  245. @info_window.bitmap.dispose
  246. dispose_name_sprites
  247. if @mouse_exist and [email protected]?
  248. @cursor.zoom_x = 1.0 ; @cursor.zoom_y = 1.0 ; @selected = nil
  249. else
  250. @cursor.dispose unless @cursor.nil?
  251. @cursor.bitmap.dispose unless @cursor.nil?
  252. end
  253. end
  254. end
  255.  
  256. #===============================================================================
  257. #===============================================================================
  258. # * Player slection engine
  259.  
  260. # Primary use selection
  261. class Window_Primaryuse < Window_Command
  262. attr_accessor :actor
  263. def initialize(x, y, actor)
  264. @actor = actor
  265. super(x, y)
  266. deactivate ; unselect
  267. end
  268.  
  269. def window_width() return 544 end
  270. def window_height() return 80 end
  271.  
  272. def make_command_list
  273. add_command('Weapon ' + Key::Weapon[1], 'Weapon ' + Key::Weapon[1])
  274. add_command('Armor ' + Key::Armor[1], 'Armor ' + Key::Armor[1])
  275. add_command('Item ' + Key::Item[1], 'Item ' + Key::Item[1])
  276. add_command('Item ' + Key::Item2[1], 'Item ' + Key::Item2[1])
  277. add_command('Skill ' + Key::Skill[1], 'Skill ' + Key::Skill[1])
  278. add_command('Skill ' + Key::Skill2[1], 'Skill ' + Key::Skill2[1])
  279. add_command('Skill ' + Key::Skill3[1], 'Skill ' + Key::Skill3[1])
  280. add_command('Skill ' + Key::Skill4[1], 'Skill ' + Key::Skill4[1])
  281. end
  282.  
  283. def refresh_actor(actor)
  284. @actor = actor
  285. refresh
  286. end
  287.  
  288. def col_max
  289. return 4
  290. end
  291.  
  292. def draw_item(index)
  293. contents.font.size = 20
  294. if @actor.primary_use == index + 1
  295. contents.font.color = Color.new(255, 120, 0, 255)
  296. draw_text(item_rect_for_text(index), command_name(index), alignment)
  297. change_color(normal_color, command_enabled?(index))
  298. return
  299. end
  300. super
  301. end
  302. end
  303.  
  304. class Window_CharacterSet < Window_Selectable
  305. include PearlScenes
  306. def initialize(x=0, y=0)
  307. super(x, y, 544, 156)
  308. refresh
  309. self.index = 0
  310. activate
  311. end
  312.  
  313. def item
  314. return @data[self.index]
  315. end
  316.  
  317. def refresh
  318. self.contents.clear if self.contents != nil
  319. @data = []
  320. $game_party.battle_members.each {|actor| @data.push(actor)}
  321. @item_max = @data.size
  322. if @item_max > 0
  323. self.contents = Bitmap.new(width - 26, row_max * 128)
  324. for i in 0...@item_max
  325. draw_item(i)
  326. end
  327. end
  328. end
  329.  
  330. def draw_item(index)
  331. item = @data[index]
  332. x, y = index % col_max * (138), index / col_max * 130
  333. self.contents.font.size = 20
  334. contents.fill_rect(x, y, item_width, item_height, Color.new(0, 0, 0, 60))
  335. draw_character(item.character_name, item.character_index, x + 22, y + 56)
  336. hp_color = [Color.new(205, 255, 205, 200), Color.new(10, 220, 45, 200)]
  337. mp_color = [Color.new(180, 225, 245, 200), Color.new(20, 160, 225, 200)]
  338. PearlKernel.draw_hp(self.contents, item, x + 4, y + 66, 96, 12, hp_color)
  339. PearlKernel.draw_mp(self.contents, item, x + 4, y + 86, 96, 12, mp_color)
  340. contents.draw_text(x - 2, y, item_width, 32, item.name, 2)
  341. contents.draw_text(x - 2, y + 20, item_width, 32, item.class.name, 2)
  342. case (item.hp.to_f / item.mhp.to_f * 100.0)
  343. when 0 ; text = DeathStatus
  344. when 1..25 ; text = BadStatus
  345. when 26..50 ; text = OverageStatus
  346. when 51..75 ; text = GoodStatus
  347. when 76..100 ; text = ExellentStatus
  348. end
  349. if item.state?(1)
  350. draw_icon($data_states[1].icon_index, x + 50, y + 100)
  351. end
  352. contents.draw_text(x + 4, y + 100, item_width, 32, text) rescue nil
  353. end
  354.  
  355. def item_max
  356. return @item_max.nil? ? 0 : @item_max
  357. end
  358.  
  359. def col_max
  360. return 4
  361. end
  362.  
  363. def line_height
  364. return 130
  365. end
  366. end
  367.  
  368. class Scene_CharacterSet < Scene_MenuBase
  369. def start
  370. super
  371. x, y = Graphics.width / 2 - 544 / 2, Graphics.height / 2 - 60 / 2
  372. @top_text = Window_Base.new(x, y - 170, 544, 60)
  373. @top_text.draw_text(0, 0, @top_text.width, 32, 'Select your Player', 1)
  374. @window_charset = Window_CharacterSet.new(@top_text.x, @top_text.y + 60)
  375. @primary_info = Window_Base.new(@top_text.x,@window_charset.y + 156, 544,60)
  376. @timer = 0
  377. refresh_primary_info('Press A to set up')
  378. @primary_use = Window_Primaryuse.new(@top_text.x,@primary_info.y + 60,actor)
  379. @primary_use.set_handler('Weapon ' + Key::Weapon[1], method(:apply_item))
  380. @primary_use.set_handler('Armor ' + Key::Armor[1], method(:apply_item))
  381. @primary_use.set_handler('Item ' + Key::Item[1], method(:apply_item))
  382. @primary_use.set_handler('Item ' + Key::Item2[1], method(:apply_item))
  383. @primary_use.set_handler('Skill ' + Key::Skill[1], method(:apply_item))
  384. @primary_use.set_handler('Skill ' + Key::Skill2[1], method(:apply_item))
  385. @primary_use.set_handler('Skill ' + Key::Skill3[1], method(:apply_item))
  386. @primary_use.set_handler('Skill ' + Key::Skill4[1], method(:apply_item))
  387. DisplayTools.create(@primary_use.x + 94, @primary_use.y + 85)
  388. if $game_player.in_combat_mode?
  389. $game_temp.pop_w(180, 'Pearl ABS',
  390. 'You cannot switch player while in combat!')
  391. end
  392. @index_char = @window_charset.index
  393. @background_sprite.color.set(16, 16, 16, 70)
  394. end
  395.  
  396. def apply_item
  397. case @primary_use.current_symbol
  398. when 'Weapon ' + Key::Weapon[1] then actor.primary_use = 1
  399. when 'Armor ' + Key::Armor[1] then actor.primary_use = 2
  400. when 'Item ' + Key::Item[1] then actor.primary_use = 3
  401. when 'Item ' + Key::Item2[1] then actor.primary_use = 4
  402. when 'Skill ' + Key::Skill[1] then actor.primary_use = 5
  403. when 'Skill ' + Key::Skill2[1] then actor.primary_use = 6
  404. when 'Skill ' + Key::Skill3[1] then actor.primary_use = 7
  405. when 'Skill ' + Key::Skill4[1] then actor.primary_use = 8
  406. end
  407. refresh_primary_info(actor.name+ " now use #{@primary_use.current_symbol}!")
  408. @primary_use.refresh_actor(actor)
  409. cancel_setup; @timer = 120
  410. end
  411.  
  412. def actor
  413. @window_charset.item
  414. end
  415.  
  416. def refresh_primary_info(text)
  417. @primary_info.contents.clear
  418. @primary_info.contents.font.size = 20
  419. @primary_info.draw_text(0, 0, 544, 32, 'As a follower primarily use tool?')
  420. @primary_info.draw_text(-26, 0, 544, 32, text, 2)
  421. end
  422.  
  423. def update
  424. super
  425. if $game_player.in_combat_mode?
  426. SceneManager.return if $game_temp.pop_windowdata[0] == 4
  427. return
  428. end
  429. if @timer > 0
  430. @timer -= 1
  431. refresh_primary_info('Press A to set up') if @timer == 0
  432. end
  433. DisplayTools.update
  434. if @index_char != @window_charset.index
  435. @index_char = @window_charset.index
  436. DisplayTools.sprite.actor = actor
  437. DisplayTools.sprite.refresh_icons
  438. DisplayTools.sprite.refresh_texts
  439. @primary_use.refresh_actor(actor)
  440. end
  441. update_cancel if Input.trigger?(:B)
  442. update_player_selection if Input.trigger?(:C)
  443. update_setup if Input.trigger?(:X)
  444. end
  445.  
  446. def update_setup
  447. return if @primary_use.active
  448. Sound.play_ok
  449. @window_charset.deactivate
  450. @primary_use.activate
  451. @primary_use.select(0)
  452. end
  453.  
  454. def cancel_setup
  455. @window_charset.activate
  456. @primary_use.deactivate
  457. @primary_use.unselect
  458. end
  459.  
  460. def update_cancel
  461. Sound.play_cancel
  462. if @window_charset.active
  463. if $game_player.actor.dead?
  464. Sound.play_buzzer
  465. return
  466. end
  467. SceneManager.return
  468. else
  469. cancel_setup
  470. end
  471. end
  472.  
  473. def update_player_selection
  474. if @window_charset.active
  475. if @window_charset.item.dead?
  476. Sound.play_buzzer
  477. return
  478. end
  479. Sound.play_ok
  480. $game_party.swap_order(0, @window_charset.index)
  481. SceneManager.return
  482. end
  483. end
  484.  
  485. def terminate
  486. super
  487. @window_charset.dispose
  488. @top_text.dispose
  489. @primary_use.dispose
  490. @primary_info.dispose
  491. DisplayTools.dispose
  492. end
  493. end
  494.  
  495. #===============================================================================
  496. #===============================================================================
  497. # * Quick tool se3lection engine
  498.  
  499. class Window_Base < Window
  500. def draw_text_ex2(x, y, text)
  501. text = convert_escape_characters(text)
  502. pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  503. process_character(text.slice!(0, 1), text, pos) until text.empty?
  504. end
  505. end
  506.  
  507. # window horizon
  508. class Window_ItemSelect < Window_HorzCommand
  509. def initialize(x=0, y=0)
  510. super(x, y)
  511. end
  512.  
  513. def window_width() return 460 end
  514. def window_height() return 50 end
  515.  
  516. def make_command_list
  517. add_command("Weapons", :weapon)
  518. add_command("Left Hand", :armor)
  519. add_command("Items", :item)
  520. add_command("Skills", :skill)
  521. end
  522.  
  523. def draw_item(index)
  524. contents.font.size = 20
  525. super
  526. end
  527. end
  528.  
  529. # window slot ask
  530. class Window_SlotConfirm < Window_Command
  531. def initialize(x, y, kind)
  532. @kind = kind
  533. super(x, y)
  534. activate
  535. end
  536.  
  537. def window_width() return 130 end
  538. def window_height() return @kind == :item ? 80 : 120 end
  539.  
  540. def make_command_list
  541. case @kind
  542. when :item
  543. add_command('Slot ' + Key::Item[1], :slot1)
  544. add_command('Slot ' + Key::Item2[1], :slot2)
  545. when :skill
  546. add_command('Slot ' + Key::Skill[1], :slot1)
  547. add_command('Slot ' + Key::Skill2[1], :slot2)
  548. add_command('Slot ' + Key::Skill3[1], :slot3)
  549. add_command('Slot ' + Key::Skill4[1], :slot4)
  550. end
  551. end
  552.  
  553. def draw_item(index)
  554. contents.font.size = 20
  555. super
  556. end
  557. end
  558.  
  559. # Actor quick tool
  560. class Window_ActorQuickTool < Window_Selectable
  561. def initialize(x=0, y=124, w=460, h=148)
  562. super(x, y, w, h)
  563. unselect
  564. end
  565.  
  566. def item() return @data[self.index] end
  567. def col_max() return 2 end
  568. def spacing() return 6 end
  569.  
  570. def refresh(actor, kind)
  571. self.contents.clear if self.contents != nil
  572. @data = []
  573. if kind == :weapon
  574. operand = $game_party.weapons
  575. operand.push(actor.equips[0]) if actor.equips[0] != nil
  576. end
  577. if kind == :armor
  578. operand = $game_party.armors
  579. operand.push(actor.equips[1]) if actor.equips[1] != nil
  580. end
  581. operand = $game_party.items if kind == :item
  582. operand = actor.skills if kind == :skill
  583. for item in operand
  584. if kind == :weapon || kind == :armor
  585. next unless actor.equippable?(item)
  586. next if item.etype_id > 1
  587. end
  588.  
  589. unless @data.include?(item)
  590. next if item.tool_data("Exclude From Tool Menu = ", false) == "true"
  591. @data.push(item)
  592. end
  593.  
  594.  
  595.  
  596.  
  597. end
  598. @item_max = @data.size
  599. if @item_max > 0
  600. self.contents = Bitmap.new(width - 32, row_max * 24)
  601. for i in 0...@item_max
  602. draw_item(i)
  603. end
  604. end
  605. end
  606.  
  607. def draw_item(index)
  608. item = @data[index]
  609. x, y = index % col_max * (190 + 32), index / col_max * 24
  610. self.contents.font.size = 20
  611. draw_icon(item.icon_index, x, y)
  612. contents.draw_text(x + 24, y, 212, 32, item.name)
  613. end
  614.  
  615. def item_max
  616. return @item_max.nil? ? 0 : @item_max
  617. end
  618. end
  619.  
  620. module DisplayTools
  621.  
  622. def self.create(x, y)
  623. @viewport2 = Viewport.new ; @viewport2.z = 999
  624. @pearl_tool_sprite = Sprite_PearlTool.new(@viewport2, [x, y])
  625. end
  626.  
  627. def self.sprite
  628. return @pearl_tool_sprite
  629. end
  630.  
  631. def self.update
  632. @pearl_tool_sprite.update
  633. end
  634. def self.dispose
  635. @pearl_tool_sprite.dispose ; @viewport2.dispose
  636. @viewport2 = nil ; @pearl_tool_sprite = nil
  637. end
  638. end
  639.  
  640.  
  641. # Scene quick tool
  642. class Scene_QuickTool < Scene_MenuBase
  643. def start
  644. super
  645. x, y = Graphics.width / 2 - 460 / 2, Graphics.height / 2 - 85 / 2
  646. @top_text = Window_Base.new(x, y - 156, 460, 85)
  647. @statust = ['Ready', 0]
  648. refresh_top_info
  649. @type_select = Window_ItemSelect.new(@top_text.x, @top_text.y + 85)
  650. @type_select.set_handler(:weapon, method(:refresh_tools))
  651. @type_select.set_handler(:armor, method(:refresh_tools))
  652. @type_select.set_handler(:item, method(:refresh_tools))
  653. @type_select.set_handler(:skill, method(:refresh_tools))
  654. @type_select.set_handler(:cancel, method(:refresh_cancel))
  655. @type_index = @type_select.index
  656. @items_w = Window_ActorQuickTool.new(@type_select.x, @type_select.y + 50)
  657. @items_w.refresh($game_player.actor, @type_select.current_symbol)
  658. @description = Window_Base.new(@items_w.x, @items_w.y + 148, 460, 75)
  659. DisplayTools.create(@description.x + 75, @description.y + 80)
  660. @background_sprite.color.set(16, 16, 16, 70)
  661. end
  662.  
  663. # create slot confirm
  664. def create_slot_confirm
  665. @slot_confirm = Window_SlotConfirm.new(@items_w.x + 144, @items_w.y + 36,
  666. @type_select.current_symbol)
  667. if @type_select.current_symbol == :item
  668. @slot_confirm.set_handler(:slot1, method(:open_slots))
  669. @slot_confirm.set_handler(:slot2, method(:open_slots))
  670. else
  671. @slot_confirm.set_handler(:slot1, method(:open_slots))
  672. @slot_confirm.set_handler(:slot2, method(:open_slots))
  673. @slot_confirm.set_handler(:slot3, method(:open_slots))
  674. @slot_confirm.set_handler(:slot4, method(:open_slots))
  675. end
  676. end
  677.  
  678. # dispose slot confirm
  679. def dispose_slot_confirm
  680. return if @slot_confirm.nil?
  681. @slot_confirm.dispose
  682. @slot_confirm = nil
  683. end
  684.  
  685. # top info
  686. def refresh_top_info
  687. @top_text.contents.clear
  688. @top_text.contents.font.size = 20
  689. @top_text.contents.fill_rect(0, 0, 58, 74, Color.new(0, 0, 0, 60))
  690. @top_text.draw_character(actor.character_name,actor.character_index, 26, 60)
  691. @top_text.draw_text(62, 0, @top_text.width, 32, actor.name + ' Equippment')
  692. @top_text.draw_text(62, 22, @top_text.width, 32, actor.class.name)
  693. @top_text.draw_text(-22, 30, @top_text.width, 32, @statust[0], 2)
  694. @top_text.draw_text(-22, 0,@top_text.width,32, 'M = Switch Player',2) unless
  695. PearlKernel::SinglePlayer
  696. end
  697.  
  698. def refresh_tools
  699. enable_items
  700. end
  701.  
  702. def refresh_cancel
  703. SceneManager.return
  704. end
  705.  
  706. def enable_items
  707. @items_w.activate
  708. @items_w.select(0)
  709. end
  710.  
  711. def refresh_description
  712. @description.contents.clear
  713. @desc_index = @items_w.index
  714. return if @items_w.item.nil? || @items_w.index < 0
  715. @description.contents.font.size = 20
  716. @description.draw_text_ex2(0, -4, @items_w.item.description)
  717. end
  718.  
  719. def update
  720. super
  721. perform_item_ok if Input.trigger?(:C)
  722. perform_canceling if Input.trigger?(:B)
  723. if PearlKey.trigger?(Key::PlayerSelect) and !PearlKernel::SinglePlayer
  724. Sound.play_ok
  725. SceneManager.call(Scene_CharacterSet)
  726. end
  727. DisplayTools.update
  728. perform_refresh
  729. end
  730.  
  731. def perform_item_ok
  732. return if @items_w.item.nil?
  733. case @type_select.current_symbol
  734. when :weapon
  735. actor.change_equip_by_id(0, @items_w.item.id)
  736. equip_play
  737. when :armor
  738. actor.change_equip_by_id(1, @items_w.item.id)
  739. equip_play
  740. when :item
  741. activate_slots
  742. when :skill
  743. activate_slots
  744. end
  745. DisplayTools.sprite.refresh_texts
  746. end
  747.  
  748. def activate_slots
  749. @items_w.deactivate
  750. create_slot_confirm
  751. Sound.play_ok
  752. end
  753.  
  754. def deactivate_slots
  755. @items_w.activate
  756. dispose_slot_confirm
  757. end
  758.  
  759. def actor
  760. return $game_player.actor
  761. end
  762.  
  763. def equip_play
  764. Sound.play_equip
  765. @statust[1] = 80
  766. end
  767.  
  768. # open slots
  769. def open_slots
  770. if @type_select.current_symbol == :item
  771. case @slot_confirm.current_symbol
  772. when :slot1 then actor.assigned_item = @items_w.item
  773. when :slot2 then actor.assigned_item2 = @items_w.item
  774. end
  775. else
  776. case @slot_confirm.current_symbol
  777. when :slot1 then actor.assigned_skill = @items_w.item
  778. when :slot2 then actor.assigned_skill2 = @items_w.item
  779. when :slot3 then actor.assigned_skill3 = @items_w.item
  780. when :slot4 then actor.assigned_skill4 = @items_w.item
  781. end
  782. end
  783. equip_play ; deactivate_slots
  784. DisplayTools.sprite.refresh_texts
  785. end
  786.  
  787. def perform_canceling
  788. Sound.play_cancel
  789. if @items_w.active
  790. @items_w.deactivate
  791. @items_w.unselect
  792. @type_select.activate
  793. else
  794. deactivate_slots
  795. end
  796. end
  797.  
  798. def perform_refresh
  799. if @type_index != @type_select.index
  800. @type_index = @type_select.index
  801. @items_w.refresh($game_player.actor, @type_select.current_symbol)
  802. refresh_description
  803. end
  804. if @desc_index != @items_w.index
  805. @desc_index = @items_w.index
  806. refresh_description
  807. end
  808. if @statust[1] > 0
  809. @statust[1] -= 1
  810. if @statust[1] == 78
  811. @statust[0] = @items_w.item.name + ' Equipped'
  812. refresh_top_info
  813. elsif @statust[1] == 0
  814. @statust = ['Ready', 0]
  815. refresh_top_info
  816. end
  817. end
  818. end
  819.  
  820. def terminate
  821. super
  822. @top_text.dispose
  823. @type_select.dispose
  824. @items_w.dispose
  825. @description.dispose
  826. dispose_slot_confirm
  827. DisplayTools.dispose
  828. end
  829. end
Add Comment
Please, Sign In to add comment