Advertisement
Guest User

Spoof battle

a guest
May 29th, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.31 KB | None | 0 0
  1. :=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # CBS Layout by Spoofus
  3. #
  4. # Version: 1.0b
  5. # Date 3/1/08
  6. #
  7. # Compatibility:
  8. #
  9. # May not be compatible with SDK's not tested though.
  10. # your old savegames. Can cause incompatibilty issues with following scripts
  11. # and/or systems:
  12. # - exotic CBS-es
  13. # Features:
  14. # Enemy and Ally Health bars
  15. # CBS Facesets
  16. # Nifty nice layout
  17. #
  18. # Instructions:
  19. # For a charecters faceset you must write their faces in the picture folder
  20. # but with _Face at the end of the actors name, remember to put the two health
  21. # bar scripts in this into your project as well
  22. #F
  23. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  24. # Credits and thanks:
  25. # Nortos
  26. #Yin
  27. # and of course me
  28. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  29. #
  30. # If you find any bugs, please report them here:
  31. # http://www.chaosproject.co.nr
  32. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  33. #==============================================================================
  34. # ** class Window_Base
  35. #------------------------------------------------------------------------------
  36. # Face functions, the charecters face is just their name than _face e.g Arshes_Face
  37. #==============================================================================
  38.  
  39. #===================================================
  40.  
  41. class Window_Base < Window
  42. def face
  43. face = RPG::Cache.picture("")
  44. end
  45.  
  46. def draw_face(actor,x,y)
  47. face = RPG::Cache.picture(actor.character_name + "_face") rescue face
  48. fw = face.width
  49. fh = face.height
  50. src_rect = Rect.new(0, 0, fw, fh)
  51. self.contents.blt(x , y - fh, face, src_rect)
  52. end
  53. end
  54. #==============================================================================
  55. # ** Window_BattleStatus
  56. #------------------------------------------------------------------------------
  57. # This window displays the status of all party members on the battle screen.
  58. #==============================================================================
  59.  
  60. class Window_BattleStatus < Window_Base
  61. #--------------------------------------------------------------------------
  62. # * Object Initialization
  63. #--------------------------------------------------------------------------
  64. def initialize
  65. super(450, 270, 190, 280)
  66. self.contents = Bitmap.new(width - 32, height - 32)
  67. self.contents.font.size = 17
  68. self.back_opacity = 0
  69. #self.back_opacity = $game_system.window_opacity #**
  70. self.contents.font.bold = true
  71. self.contents.font.name = "Tahoma"
  72. @level_up_flags = [false, false, false, false]
  73. refresh
  74. end
  75. #--------------------------------------------------------------------------
  76. # * Dispose
  77. #--------------------------------------------------------------------------
  78. def dispose
  79. super
  80. end
  81. #--------------------------------------------------------------------------
  82. # * Set Level Up Flag
  83. # actor_index : actor index
  84. #--------------------------------------------------------------------------
  85. def level_up(actor_index)
  86. @level_up_flags[actor_index] = true
  87. end
  88. #--------------------------------------------------------------------------
  89. # * Refresh
  90. #--------------------------------------------------------------------------
  91. def refresh
  92. self.contents.clear
  93. @item_max = $game_party.actors.size
  94. for i in 0...$game_party.actors.size
  95. actor = $game_party.actors[i]
  96. actor_y = i * 82 + 0
  97. draw_actor_name(actor, 47, actor_y + 4)
  98. self.contents.font.size = 17
  99. draw_actor_hp(actor, 45, actor_y + 20, 100)
  100. draw_actor_sp(actor, 61, actor_y + 45, 100)
  101. draw_face(actor, 120, actor_y + 27)
  102. self.back_opacity = 0
  103. if @level_up_flags[i]
  104. self.contents.font.color = normal_color
  105. self.contents.draw_text(125, actor_y, 50, 32, "Lvl.Up!")
  106. else
  107. #draw_actor_state(actor, 215, actor_y)
  108. #draw_actor_state(actor, actor_x + 20, 20)
  109. end
  110. end
  111. end
  112. end
  113. #=================================
  114. #new windows below
  115. #============================================
  116. class Window_ActorStatus < Window_Base
  117. def initialize(actor, x, y)
  118. super(x, y - 30, 190, 135)
  119. #super(x, y, 190, 105)
  120. @actor = actor
  121. self.contents = Bitmap.new(width - 32, height - 32)
  122. @level_up_flags = false
  123. refresh
  124. end
  125. def refresh
  126. self.contents.clear
  127. actor = $game_party.actors[@actor]
  128. actor_y = 0
  129. actor_x = 8
  130. draw_actor_name(actor, actor_x, actor_y - 10)
  131. self.contents.font.size = 17
  132. draw_actor_hp(actor, actor_x, actor_y + 10, 100)
  133. draw_actor_sp(actor, actor_x + 15, actor_y + 40, 100)
  134. draw_face(actor, actor_x + 110, actor_y + 40)
  135. self.back_opacity = 0
  136. if @level_up_flags
  137. self.contents.font.color = normal_color
  138. self.contents.draw_text(125, actor_y + 20, 120, 32, "Lvl.Up!")
  139. else
  140. draw_actor_state(actor, 0, actor_y + 80)
  141. end
  142. end
  143. def update
  144. if $game_temp.battle_main_phase
  145. self.contents_opacity -= 4 if self.contents_opacity > 0
  146. else
  147. self.contents_opacity += 4 if self.contents_opacity < 0
  148. end
  149. end
  150. end
  151. #==============================================================================
  152. # ** Window_BattleStatus
  153. #------------------------------------------------------------------------------
  154. # This window displays the status of all party members on the battle screen.
  155. #==============================================================================
  156.  
  157. #==============================================================================
  158. # ** Game_Actor
  159. #------------------------------------------------------------------------------
  160. # This class determines the x and y coordinates of each of the battlers
  161. # to change them yourself should be easy enough
  162. #==============================================================================
  163. class Game_Actor
  164. def screen_x
  165. x_positions = [600, 469, 485, 485]
  166. if self.index != nil
  167. return x_positions[self.index]
  168. else
  169. return 0
  170. end
  171. end
  172. # #--------------------------------------------------------------------------
  173. def screen_y
  174. y_positions = [270, 405, 445, 445]
  175. if self.index != nil
  176. return y_positions[self.index]
  177. else
  178. return 0
  179. end
  180. end
  181. end
  182.  
  183. #==============================================================================
  184. # ** Scene_Battle
  185. #------------------------------------------------------------------------------
  186. # This class is all the kinks I had to change to the battle scene
  187. # I edited the windows mainly a bit
  188. #==============================================================================
  189.  
  190. class Scene_Battle
  191. def main
  192. # Initialize each kind of temporary battle data
  193. $game_temp.in_battle = true
  194. $game_temp.battle_turn = 0
  195. $game_temp.battle_event_flags.clear
  196. $game_temp.battle_abort = false
  197. $game_temp.battle_main_phase = false
  198. $game_temp.battleback_name = $game_map.battleback_name
  199. $game_temp.forcing_battler = nil
  200. # Initialize battle event interpreter
  201. $game_system.battle_interpreter.setup(nil, 0)
  202. # Prepare troop
  203. @troop_id = $game_temp.battle_troop_id
  204. $game_troop.setup(@troop_id)
  205. # Make actor command window
  206. s1 = $data_system.words.attack
  207. s2 = $data_system.words.skill
  208. s3 = $data_system.words.guard
  209. s4 = $data_system.words.item
  210. @actor_command_window = Window_Command.new(100, [s1, s2, s3, s4])
  211. @actor_command_window.new_items($game_party.actors[0].generate_commands)
  212. @actor_command_window.x = 120
  213. @actor_command_window.y = 320
  214. @actor_command_window.active = false
  215. @actor_command_window.visible = false
  216. @actor_command_window.index = -1
  217. @actor_command_window.back_opacity = 255
  218. # Make other windows
  219. @party_command_window = Window_PartyCommand.new
  220. @help_window = Window_Help.new
  221. #@help_window.back_opacity = 255
  222. @help_window.back_opacity = $game_system.window_opacity #**
  223. @party_command_window.back_opacity = 255
  224. #@party_command_window.back_opacity = $game_system.window_opacity #**
  225. @help_window.visible = false
  226. @status_window = Window_BattleStatus.new
  227. @status_window.visible = false
  228. @actor1_window = Window_ActorStatus.new(0, 450, 240) #**
  229. @actor2_window = Window_ActorStatus.new(1, 320, 375) #**
  230. @actor3_window = Window_ActorStatus.new(2, 120, 175)
  231. #@actor1_window = Window_ActorStatus.new(0, 450, 250) #**
  232. #@actor2_window = Window_ActorStatus.new(1, 320, 375) #**
  233. @message_window = Window_Message.new
  234. # Make sprite set
  235. @spriteset = Spriteset_Battle.new
  236. # Initialize wait count
  237. @wait_count = 0
  238. # Execute transition
  239. if $data_system.battle_transition == ""
  240. Graphics.transition(20)
  241. else
  242. Graphics.transition(40, "Graphics/Transitions/" +
  243. $data_system.battle_transition)
  244. end
  245. # Start pre-battle phase
  246. start_phase1
  247. # Main loop
  248. loop do
  249. # Update game screen
  250. Graphics.update
  251. # Update input information
  252. Input.update
  253. # Frame update
  254. update
  255. # Abort loop if screen is changed
  256. if $scene != self
  257. break
  258. end
  259. end
  260. # Refresh map
  261. $game_map.refresh
  262. # Prepare for transition
  263. Graphics.freeze
  264. # Dispose of windows
  265. @actor_command_window.dispose
  266. @party_command_window.dispose
  267. @help_window.dispose
  268. @status_window.dispose
  269. @message_window.dispose
  270. @actor1_window.dispose
  271. @actor2_window.dispose
  272. @actor3_window.dispose
  273. if @skill_window != nil
  274. @skill_window.dispose
  275. end
  276. if @item_window != nil
  277. @item_window.dispose
  278. end
  279. if @result_window != nil
  280. @result_window.dispose
  281. end
  282. # Dispose of sprite set
  283. @spriteset.dispose
  284. # If switching to title screen
  285. if $scene.is_a?(Scene_Title)
  286. # Fade out screen
  287. Graphics.transition
  288. Graphics.freeze
  289. end
  290. # If switching from battle test to any screen other than game over screen
  291. if $BTEST and not $scene.is_a?(Scene_Gameover)
  292. $scene = nil
  293. end
  294. end
  295.  
  296. #--------------------------------------------------------------------------
  297. # * Frame Update (actor command phase : skill selection)
  298. #--------------------------------------------------------------------------
  299. def update_phase3_skill_select
  300. # Make skill window visible
  301. @actor_command_window.index = 0
  302. @actor_command_window.visible = true
  303. @skill_window.visible = true
  304. @skill_window.z = 255
  305. # Update skill window
  306. @skill_window.update
  307. # If B button was pressed
  308. if Input.trigger?(Input::B)
  309. # Play cancel SE
  310. $game_system.se_play($data_system.cancel_se)
  311. # End skill selection
  312. end_skill_select
  313. return
  314. end
  315. # If C button was pressed
  316. if Input.trigger?(Input::C)
  317. # Get currently selected data on the skill window
  318. @skill = @skill_window.skill
  319. # If it can't be used
  320. if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
  321. # Play buzzer SE
  322. $game_system.se_play($data_system.buzzer_se)
  323. return
  324. end
  325. # Play decision SE
  326. $game_system.se_play($data_system.decision_se)
  327. # Set action
  328. @active_battler.current_action.skill_id = @skill.id
  329. # Make skill window invisible
  330. @skill_window.visible = false
  331. # If effect scope is single enemy
  332. if @skill.scope == 1
  333. # Start enemy selection
  334. start_enemy_select
  335. # If effect scope is single ally
  336. elsif @skill.scope == 3 or @skill.scope == 5
  337. # Start actor selection
  338. start_actor_select
  339. # If effect scope is not single
  340. else
  341. # End skill selection
  342. end_skill_select
  343. # Go to command input for next actor
  344. phase3_next_actor
  345. end
  346. return
  347. end
  348. end
  349. #--------------------------------------------------------------------------
  350. # * Frame Update (actor command phase : item selection)
  351. #--------------------------------------------------------------------------
  352. def update_phase3_item_select
  353. # Make item window visible
  354. @actor_command_window.index = 0
  355. @actor_command_window.visible = true
  356. @item_window.visible = true
  357. @item_window.z = 255
  358. # Update item window
  359. @item_window.update
  360. # If B button was pressed
  361. if Input.trigger?(Input::B)
  362. # Play cancel SE
  363. $game_system.se_play($data_system.cancel_se)
  364. # End item selection
  365. end_item_select
  366. return
  367. end
  368. # If C button was pressed
  369. if Input.trigger?(Input::C)
  370. # Get currently selected data on the item window
  371. @item = @item_window.item
  372. # If it can't be used
  373. unless $game_party.item_can_use?(@item.id)
  374. # Play buzzer SE
  375. $game_system.se_play($data_system.buzzer_se)
  376. return
  377. end
  378. # Play decision SE
  379. $game_system.se_play($data_system.decision_se)
  380. # Set action
  381. @active_battler.current_action.item_id = @item.id
  382. # Make item window invisible
  383. @item_window.visible = false
  384. # If effect scope is single enemy
  385. if @item.scope == 1
  386. # Start enemy selection
  387. start_enemy_select
  388. # If effect scope is single ally
  389. elsif @item.scope == 3 or @item.scope == 5
  390. # Start actor selection
  391. start_actor_select
  392. # If effect scope is not single
  393. else
  394. # End item selection
  395. end_item_select
  396. # Go to command input for next actor
  397. phase3_next_actor
  398. end
  399. return
  400. end
  401. end
  402.  
  403. def start_phase2
  404. # Shift to phase 2
  405. @phase = 2
  406. # Set actor to non-selecting
  407. @actor_index = -1
  408. @active_battler = nil
  409. # Enable party command window
  410. @party_command_window.active = true
  411. @party_command_window.visible = true
  412. @party_command_window.index = 0
  413. # Disable actor command window
  414. @actor_command_window.active = false
  415. @actor_command_window.visible = false
  416. @actor_command_window.index = -1
  417. # Clear main phase flag
  418. $game_temp.battle_main_phase = false
  419. # Clear all party member actions
  420. $game_party.clear_actions
  421. # If impossible to input command
  422. unless $game_party.inputable?
  423. # Start main phase
  424. start_phase4
  425. end
  426. end
  427.  
  428. def update_phase3_basic_command
  429. # If B button was pressed
  430. if Input.trigger?(Input::B)
  431. # Play cancel SE
  432. $game_system.se_play($data_system.cancel_se)
  433. @actor_command_window.index = 0
  434. # Go to command input for previous actor
  435. phase3_prior_actor
  436. return
  437. end
  438. # If C button was pressed
  439. if Input.trigger?(Input::C)
  440. # Branch by actor command window cursor position
  441. case @actor_command_window.index
  442. when 0 # attack
  443. # Play decision SE
  444. $game_system.se_play($data_system.decision_se)
  445. # Set action
  446. @active_battler.current_action.kind = 0
  447. @active_battler.current_action.basic = 0
  448. # Start enemy selection
  449. start_enemy_select
  450. when 1 # skill
  451. # Play decision SE
  452. $game_system.se_play($data_system.decision_se)
  453. # Set action
  454. @active_battler.current_action.kind = 1
  455. # Start skill selection
  456. start_skill_select
  457. when 2 # guard
  458. # Play decision SE
  459. $game_system.se_play($data_system.decision_se)
  460. # Set action
  461. @active_battler.current_action.kind = 0
  462. @active_battler.current_action.basic = 1
  463. # Go to command input for next actor
  464. phase3_next_actor
  465. when 3 # item
  466. # Play decision SE
  467. $game_system.se_play($data_system.decision_se)
  468. # Set action
  469. @active_battler.current_action.kind = 2
  470. # Start item selection
  471. start_item_select
  472. end
  473. return
  474. end
  475. end
  476.  
  477. def phase3_setup_command_window
  478. # Disable party command window
  479. @party_command_window.active = false
  480. @party_command_window.visible = false
  481. #@party_command_window.opacity = 160
  482. @party_command_window.index = -2
  483. # Enable actor command window
  484. @actor_command_window.active = true
  485. @actor_command_window.visible = true
  486. # Set actor command window position
  487. # Set index to 0
  488. @actor_command_window.index = 0
  489. end
  490. end
  491.  
  492. #==============================================================================
  493. # ** Window_Command
  494. #------------------------------------------------------------------------------
  495. # This window deals with general command choices.
  496. #==============================================================================
  497.  
  498. class Window_Command_New < Window_Selectable
  499. #--------------------------------------------------------------------------
  500. # * Object Initialization
  501. # width : window width
  502. # commands : command text string array
  503. #--------------------------------------------------------------------------
  504. def initialize(width, commands)
  505. # Compute window height from command quantity
  506. #super(120, 128, 190, 90 * 32 + 32)
  507. #super(120, 128, width, commands.size * 32 + 32)
  508. super(0, 0, width, commands.size * 32 + 32)
  509. @item_max = commands.size
  510. @commands = commands
  511. self.back_opacity = 255
  512. #self.back_opacity = $game_system.window_opacity #**
  513. self.contents = Bitmap.new(width - 32, @item_max * 32)
  514. refresh
  515. self.index = 0
  516. end
  517. #--------------------------------------------------------------------------
  518. # * Refresh
  519. #--------------------------------------------------------------------------
  520. def refresh
  521. self.contents.clear
  522. for i in 0...@item_max
  523. draw_item(i, normal_color)
  524. end
  525. end
  526. #--------------------------------------------------------------------------
  527. # * Draw Item
  528. # index : item number
  529. # color : text color
  530. #--------------------------------------------------------------------------
  531. def draw_item(index, color)
  532. self.contents.font.color = color
  533. rect = Rect.new(3, 32 * index, self.contents.width - 6, 32)
  534. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  535. self.contents.draw_text(rect, @commands[index])
  536. end
  537. #--------------------------------------------------------------------------
  538. # * Disable Item
  539. # index : item number
  540. #--------------------------------------------------------------------------
  541. def disable_item(index)
  542. draw_item(index, disabled_color)
  543. end
  544. end
  545. #remove below if not working
  546. #+==================
  547. #==============================================================================
  548. # ** Window_Skill
  549. #------------------------------------------------------------------------------
  550. # This window displays usable skills on the skill and battle screens.
  551. #==============================================================================
  552.  
  553. class Window_Skill < Window_Selectable
  554. #--------------------------------------------------------------------------
  555. # * Object Initialization
  556. # actor : actor
  557. #--------------------------------------------------------------------------
  558. def initialize(actor)
  559. super(120, 128, 190, 90)
  560. @actor = actor
  561. if $game_temp.in_battle
  562. @column_max = 1
  563. else
  564. @column_max = 2
  565. end
  566. refresh
  567. self.index = 0
  568. # If in battle, move window to center of screen
  569. # and make it semi-transparent
  570. if $game_temp.in_battle
  571. self.y = 320
  572. self.height = 160
  573. self.back_opacity = 255
  574. #self.back_opacity = $game_system.window_opacity #**
  575. end
  576. end
  577. #--------------------------------------------------------------------------
  578. # * Acquiring Skill
  579. #--------------------------------------------------------------------------
  580. def skill
  581. return @data[self.index]
  582. end
  583. #--------------------------------------------------------------------------
  584. # * Refresh
  585. #--------------------------------------------------------------------------
  586. def refresh
  587. if self.contents != nil
  588. self.contents.dispose
  589. self.contents = nil
  590. end
  591. @data = []
  592. for i in 0...@actor.skills.size
  593. skill = $data_skills[@actor.skills[i]]
  594. if skill != nil
  595. @data.push(skill)
  596. end
  597. end
  598. # If item count is not 0, make a bit map and draw all items
  599. @item_max = @data.size
  600. if @item_max > 0
  601. self.contents = Bitmap.new(width - 32, row_max * 32)
  602. for i in 0...@item_max
  603. draw_item(i)
  604. end
  605. end
  606. end
  607. #--------------------------------------------------------------------------
  608. # * Draw Item
  609. # index : item number
  610. #--------------------------------------------------------------------------
  611. def draw_item(index)
  612. skill = @data[index]
  613. if @actor.skill_can_use?(skill.id)
  614. self.contents.font.color = normal_color
  615. else
  616. self.contents.font.color = disabled_color
  617. end
  618. if $game_temp.in_battle
  619. x = 4 + index % 1 * (288 + 32)
  620. y = index / 1 * 32
  621. else
  622. x = 4 + index % 2 * (288 + 32)
  623. y = index / 2 * 32
  624. end
  625. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  626. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  627. bitmap = RPG::Cache.icon(skill.icon_name)
  628. opacity = self.contents.font.color == normal_color ? 255 : 128
  629. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  630. self.contents.font.size = 14
  631. self.contents.font.bold = true
  632. self.contents.draw_text(x + 28, y, 200, 32, skill.name, 0)
  633. skill = @data[index]
  634. # decide color depending on the fact if currently usable
  635. if @actor.skill_can_use?(skill.id)
  636. self.contents.font.color = normal_color
  637. else
  638. self.contents.font.color = disabled_color
  639. end
  640. # remove old SP display
  641. self.contents.fill_rect(236 + index % 1 * 320, index / 1 * 32, 48, 32,
  642. Color.new(0, 0, 0, 0))
  643. # calculate SP cost considering skill level
  644. sp_cost = (skill.sp_cost * @actor.get_skill_sp_cost_factor(skill.id)).to_i
  645. # draw SP cost
  646. self.contents.draw_text(107 + index % 1 * 320, index / 1 * 32, 48, 32,
  647. sp_cost.to_s, 2)
  648. #self.contents.draw_text(x + 100, y, 48, 32, skill.sp_cost.to_s, 2)
  649. end
  650. #--------------------------------------------------------------------------
  651. # * Help Text Update
  652. #--------------------------------------------------------------------------
  653. def update_help
  654. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  655. end
  656. end
  657. #================================================
  658. #=================================================
  659. #==============================================================================
  660. # ** Window_Item
  661. #------------------------------------------------------------------------------
  662. # This window displays items in possession on the item and battle screens.
  663. #==============================================================================
  664.  
  665. class Window_Item < Window_Selectable
  666. #--------------------------------------------------------------------------
  667. # * Object Initialization
  668. #--------------------------------------------------------------------------
  669. def initialize
  670. super(120, 128, 190, 90)
  671. if $game_temp.in_battle
  672. @column_max = 1
  673. end
  674. refresh
  675. self.index = 0
  676. # If in battle, move window to center of screen
  677. # and make it semi-transparent
  678. if $game_temp.in_battle
  679. self.y = 320
  680. self.height = 160
  681. self.back_opacity = 255
  682. #self.back_opacity = $game_system.window_opacity #**
  683. end
  684. end
  685. #--------------------------------------------------------------------------
  686. # * Get Item
  687. #--------------------------------------------------------------------------
  688. def item
  689. return @data[self.index]
  690. end
  691. #--------------------------------------------------------------------------
  692. # * Refresh
  693. #--------------------------------------------------------------------------
  694. def refresh
  695. if self.contents != nil
  696. self.contents.dispose
  697. self.contents = nil
  698. end
  699. @data = []
  700. # Add item
  701. for i in 1...$data_items.size
  702. if $game_party.item_number(i) > 0
  703. @data.push($data_items[i])
  704. end
  705. end
  706. # Also add weapons and items if outside of battle
  707. unless $game_temp.in_battle
  708. for i in 1...$data_weapons.size
  709. if $game_party.weapon_number(i) > 0
  710. @data.push($data_weapons[i])
  711. end
  712. end
  713. for i in 1...$data_armors.size
  714. if $game_party.armor_number(i) > 0
  715. @data.push($data_armors[i])
  716. end
  717. end
  718. end
  719. # If item count is not 0, make a bit map and draw all items
  720. @item_max = @data.size
  721. if @item_max > 0
  722. self.contents = Bitmap.new(width - 32, row_max * 32)
  723. for i in 0...@item_max
  724. draw_item(i)
  725. end
  726. end
  727. end
  728. #--------------------------------------------------------------------------
  729. # * Draw Item
  730. # index : item number
  731. #--------------------------------------------------------------------------
  732. def draw_item(index)
  733. item = @data[index]
  734. case item
  735. when RPG::Item
  736. number = $game_party.item_number(item.id)
  737. when RPG::Weapon
  738. number = $game_party.weapon_number(item.id)
  739. when RPG::Armor
  740. number = $game_party.armor_number(item.id)
  741. end
  742. if item.is_a?(RPG::Item) and
  743. $game_party.item_can_use?(item.id)
  744. self.contents.font.color = normal_color
  745. else
  746. self.contents.font.color = disabled_color
  747. end
  748. x = 4 + index % 1 * (288 + 32)
  749. y = index / 1 * 32
  750. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  751. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  752. bitmap = RPG::Cache.icon(item.icon_name)
  753. self.contents.font.size = 14
  754. self.contents.font.bold = true
  755. opacity = self.contents.font.color == normal_color ? 255 : 128
  756. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  757. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  758. self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  759. self.contents.draw_text(x + 100, y, 48, 32, number.to_s, 2)
  760. end
  761. #--------------------------------------------------------------------------
  762. # * Help Text Update
  763. #--------------------------------------------------------------------------
  764. def update_help
  765. @help_window.set_text(self.item == nil ? "" : self.item.description)
  766. end
  767. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement