Advertisement
Dekita

perfect equip screen

Nov 9th, 2012
777
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.00 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Equipment Screen™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. An Alternative (much better) Equipment screen with tons of information.
  9.  
  10. REQUIRES Dekita__CORE !
  11.  
  12. ================================================================================
  13. FEATURES:
  14. ==========
  15. - Big Numbers ^_^
  16.  
  17. ================================================================================
  18. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  19. ================================================================================
  20. 1. You must give credit to "Dekita"
  21. 2. You are NOT allowed to repost this script.(or modified versions)
  22. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  23. 4. You are NOT allowed to use this script for Commercial games.
  24. 5. ENJOY!
  25.  
  26. "FINE PRINT"
  27. By using this script you hereby agree to the above terms and conditions,
  28. if any violation of the above terms occurs "legal action" may be taken.
  29. Not understanding the above terms and conditions does NOT mean that
  30. they do not apply to you.
  31. If you wish to discuss the terms and conditions in further detail you can
  32. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  33.  
  34. ================================================================================
  35. History:
  36. =========
  37. D /M /Y
  38. 19/10/2o12 - Finished,
  39. 10/10/2o12 - Started,
  40.  
  41. ================================================================================
  42. INSTRUCTIONS:
  43. ==============
  44. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  45.  
  46. ================================================================================
  47. Script Calls:
  48. ==============
  49.  
  50. =end
  51.  
  52. module Dekita__Equip
  53.  
  54. Commands_list =[ # Do Not Remove !
  55.  
  56. #Command , Vocab , Icon_id
  57. [:equip , "Equip" , 101],
  58. [:optimize , "Optimize" , 102],
  59. [:clear , "Clear" , 103],
  60. ] #
  61.  
  62. Use_Command_Icons = true
  63.  
  64. Extra_Command_Width = 0
  65.  
  66. Toggle_Info_Button = :SHIFT
  67.  
  68. # ACTOR info shown on page one.
  69. Actor_Info =[
  70. [:name],
  71. [:nickname],
  72. [:class],
  73. [:level],
  74. [:exp_total],
  75. [:exp_to_next],
  76. [:death_counter],# <- Requires Dekita - Actor Death Counter
  77. [:atl],
  78. [:dfl],
  79. ]#
  80.  
  81. # EQUIPMENT Info shown on page one.
  82. Page_One_Info =[
  83. [:name],
  84. # [:req_lvl],# <- Requires - Dekita_Equip_Requirements, v1.2+
  85. # [:req_vit],# <- Requires - Dekita_Equip_Requirements, v1.2+
  86. # [:req_str],# <- Requires - Dekita_Equip_Requirements, v1.2+
  87. # [:req_mag],# <- Requires - Dekita_Equip_Requirements, v1.2+
  88. # [:req_dex],# <- Requires - Dekita_Equip_Requirements, v1.2+
  89. # [:req_atl],# <- Requires - Dekita_Equip_Requirements, v1.2+
  90. # [:req_dfl],# <- Requires - Dekita_Equip_Requirements, v1.2+
  91. # [:req_adc],# <- Requires - Dekita_Equip_Requirements, v1.2+ and Actor Death Counter
  92. [:vit],
  93. [:str],
  94. [:dex],
  95. [:mag],
  96. [:atl],
  97. [:dfl],
  98. ]#
  99.  
  100. Page_Two_Info =[
  101. [:mhp],
  102. [:mmp],
  103. [:mtp],# <- Requires - Dekita__TP_Limits
  104. [:atk],
  105. [:def],
  106. [:mat],
  107. [:mdf],
  108. [:agi],
  109. [:luk],
  110. ] #
  111.  
  112. Page_Three_Info =[
  113. [:hit],
  114. [:eva],
  115. [:cri],
  116. [:cev],
  117. [:mev],
  118. [:mrf],
  119. [:cnt],
  120. [:hrg],
  121. [:mrg],
  122. ] #
  123.  
  124. Page_Four_Info =[
  125. [:tgr],
  126. [:grd],
  127. [:rec],
  128. [:mcr],
  129. [:tcr],
  130. [:pdr],
  131. [:mdr],
  132. [:exr],
  133. [:fdr],
  134. ] #
  135.  
  136. # Do Not Remove this.
  137. p 'Loaded : DPBz - Equip'
  138. end # Dekita__Equip
  139.  
  140. #===============================================================================#
  141. # http://dekitarpg.wordpress.com/
  142. #===============================================================================#
  143. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  144. # YES?\.\. #
  145. # OMG, REALLY? #
  146. # WELL SLAP MY FACE AND CALL ME A DRAGON.\..\.. #
  147. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  148. #===============================================================================#
  149.  
  150. $imported = {} if $imported.nil?
  151. $imported[:Dekita__Equip] = true
  152.  
  153. unless $imported[:Dekita__CORE]
  154. msgbox("'Dekita__Equip'
  155. The Above Script Requires 'Dekita__CORE, v1.0' in order to function properly,
  156. It must also be placed below it!
  157.  
  158. You can get the latest version of all my scripts @
  159. http://dekitarpg.wordpress.com/")
  160. exit
  161. end
  162.  
  163. #==============================================================================
  164. class Window_EquipItemStatus < Window_Base
  165. #==============================================================================
  166.  
  167. #--------------------------------------------------------------------------
  168. # initialize
  169. #--------------------------------------------------------------------------
  170. def initialize(dx, dy, item_window)
  171. super(dx, dy, Graphics.width - dx, Graphics.height)
  172. @item_window = item_window
  173. @item = nil
  174. @equip_info_page = 0
  175. refresh
  176. self.opacity = 0
  177. end
  178.  
  179. #--------------------------------------------------------------------------
  180. # update
  181. #--------------------------------------------------------------------------
  182. def update
  183. super
  184. update_item(@item_window.item)
  185. change_equip_page if Input.trigger?(Dekita__Equip::Toggle_Info_Button)
  186. end
  187.  
  188.  
  189. def change_equip_page
  190. case @equip_info_page
  191. when 0
  192. @equip_info_page = 1
  193. when 1
  194. @equip_info_page = 2
  195. when 2
  196. @equip_info_page = 3
  197. when 3
  198. @equip_info_page = 0
  199. else
  200. end
  201. refresh
  202. end
  203.  
  204.  
  205. #--------------------------------------------------------------------------
  206. # update_item
  207. #--------------------------------------------------------------------------
  208. def update_item(item)
  209. return if @item == item
  210. @item = item
  211. refresh
  212. end
  213.  
  214. #--------------------------------------------------------------------------
  215. # refresh
  216. #--------------------------------------------------------------------------
  217. def refresh
  218. contents.clear
  219. reset_font_settings
  220. return change_empty_info if @item.nil?
  221. change_page_info if !@item.nil?
  222. end
  223.  
  224. def change_page_info
  225. case @equip_info_page# = 0
  226. when 0
  227. draw_page_one_equip_info
  228. when 1
  229. draw_page_two_equip_info
  230. when 2
  231. draw_page_three_equip_info
  232. when 3
  233. draw_page_four_equip_info
  234. else
  235. end
  236. end
  237.  
  238. def change_empty_info
  239. case @equip_info_page# = 0
  240. when 0
  241. draw_empty_info_column
  242. when 1
  243. draw_empty_info_column_two
  244. when 2
  245. draw_empty_info_column_three
  246. when 3
  247. draw_empty_info_column_four
  248. else
  249. end
  250. end
  251.  
  252.  
  253. def draw_page_one_equip_info
  254. dx = Graphics.width / 3 * 0
  255. dw = ((Graphics.width) / 3) - 12
  256. dy = line_height * 4.7
  257. for property in Dekita__Equip::Page_One_Info
  258. dy = draw_stat_info_DPBz(property, @item, dx, dy, dw)
  259. end
  260. end
  261.  
  262. def draw_page_two_equip_info
  263. dx = Graphics.width / 3 * 0
  264. dw = ((Graphics.width) / 3) - 12
  265. dy = line_height * 4.7
  266. for property in Dekita__Equip::Page_Two_Info
  267. dy = draw_stat_info_DPBz(property, @item, dx, dy, dw)
  268. end
  269. end
  270.  
  271. def draw_page_three_equip_info
  272. dx = Graphics.width / 3 * 0
  273. dw = ((Graphics.width) / 3) - 12
  274. dy = line_height * 4.7
  275. for property in Dekita__Equip::Page_Three_Info
  276. dy = draw_stat_info_DPBz(property, @item, dx, dy, dw)
  277. end
  278. end
  279.  
  280. def draw_page_four_equip_info
  281. dx = Graphics.width / 3 * 0
  282. dw = ((Graphics.width) / 3) - 12
  283. dy = line_height * 4.7
  284. for property in Dekita__Equip::Page_Four_Info
  285. dy = draw_stat_info_DPBz(property, @item, dx, dy, dw)
  286. end
  287. end
  288.  
  289. def draw_empty_info_column
  290. dx = Graphics.width / 3 * 0
  291. dw = ((Graphics.width) / 3) - 12
  292. dy = line_height * 4.7
  293. for property in Dekita__Equip::Page_One_Info
  294. dy = draw_stat_info_DPBz(property, false, dx, dy, dw)
  295. end
  296. end
  297. def draw_empty_info_column_two
  298. dx = Graphics.width / 3 * 0
  299. dw = ((Graphics.width) / 3) - 12
  300. dy = line_height * 4.7
  301. for property in Dekita__Equip::Page_Two_Info
  302. dy = draw_stat_info_DPBz(property, false, dx, dy, dw)
  303. end
  304. end
  305. def draw_empty_info_column_three
  306. dx = Graphics.width / 3 * 0
  307. dw = ((Graphics.width) / 3) - 12
  308. dy = line_height * 4.7
  309. for property in Dekita__Equip::Page_Three_Info
  310. dy = draw_stat_info_DPBz(property, false, dx, dy, dw)
  311. end
  312. end
  313. def draw_empty_info_column_four
  314. dx = Graphics.width / 3 * 0
  315. dw = ((Graphics.width) / 3) - 12
  316. dy = line_height * 4.7
  317. for property in Dekita__Equip::Page_Four_Info
  318. dy = draw_stat_info_DPBz(property, false, dx, dy, dw)
  319. end
  320. end
  321.  
  322. end # Window_ItemStatus
  323.  
  324. #==============================================================================
  325. class Window_EquipStatus < Window_Base
  326. #==============================================================================
  327.  
  328. def window_width
  329. return Graphics.width
  330. end
  331.  
  332. def window_height
  333. Graphics.height
  334. end
  335.  
  336. def visible_line_number
  337. return 9
  338. end
  339.  
  340. def refresh
  341. contents.clear
  342. draw_actor_face(@actor, (Graphics.width/2.5), 0) if @actor
  343. draw_horz_line(line_height * 4)
  344. draw_horz_line(Graphics.height - line_height * 4)
  345. contents.font.size = Dekita__CORE::Info_Font_Size
  346. draw_commands_infoo
  347. end
  348.  
  349. def draw_commands_infoo
  350. dx = 0
  351. dw = (Graphics.width - 24) / 5
  352. dy = 0
  353. for info in Dekita__Equip::Commands_list
  354. dy = draw_command_column_info(info, dx, dy, dw)
  355. end
  356. end
  357.  
  358. def draw_command_column_info(info, dx, dy, dw)
  359. case info[0]
  360. when :equip
  361. when :optimize
  362. when :clear
  363. else ; return dy
  364. end
  365. colour = Color.new(0, 0, 0, translucent_alpha/2)
  366. rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  367. contents.fill_rect(rect, colour)
  368. if Dekita__Equip::Use_Command_Icons
  369. draw_icon(info[2], dx, dy, enable_DPBz_icons?)
  370. draw_text(dx+25, dy, dw-8, line_height, info[1], 0)
  371. else
  372. draw_text(dx+4, dy, dw-8, line_height, info[1], 0)
  373. end
  374. return dy + line_height
  375. end
  376.  
  377. def draw_horz_line(y)
  378. line_y = y + line_height / 2 - 1
  379. contents.fill_rect(0, line_y, contents_width, 2, line_color)
  380. end
  381.  
  382. def line_color
  383. color = normal_color
  384. color.alpha = 48
  385. color
  386. end
  387.  
  388. end # Window_EquipStatus
  389.  
  390. #==============================================================================
  391. class Window_Equip_ActorStatus < Window_EquipStatus
  392. #==============================================================================
  393.  
  394. def initialize(x, y)
  395. super(x, y)
  396. @actor = nil
  397. @temp_actor = nil
  398. @equip_info_page = 0
  399. self.opacity = 0
  400. refresh
  401. end
  402.  
  403. def window_width
  404. return Graphics.width
  405. end
  406.  
  407. def window_height
  408. Graphics.height
  409. end
  410.  
  411. def visible_line_number
  412. return 9
  413. end
  414.  
  415. def refresh
  416. contents.clear
  417. end
  418.  
  419. def draw_page_one_actor_info
  420. dx = Graphics.width / 3 * 0
  421. dw = ((Graphics.width) / 3) - 12
  422. dy = line_height * 4.7
  423. for property in Dekita__Equip::Actor_Info
  424. dy = draw_stat_info_DPBz(property, @actor, dx, dy, dw)
  425. end
  426. end
  427.  
  428. def update
  429. super
  430. change_equip_page if Input.trigger?(Dekita__Equip::Toggle_Info_Button)
  431. end
  432.  
  433. def change_equip_page
  434. case @equip_info_page# =
  435. when 0
  436. @equip_info_page = 1
  437. when 1
  438. @equip_info_page = 2
  439. when 2
  440. @equip_info_page = 3
  441. when 3
  442. @equip_info_page = 0
  443. else
  444. end
  445. refresh
  446. end
  447.  
  448. def update_item(item)
  449. return if @item == item
  450. @item = item
  451. refresh
  452. end
  453.  
  454. def refresh
  455. contents.clear
  456. change_page_info if @actor
  457. end
  458.  
  459. def change_page_info
  460. case @equip_info_page
  461. when 0
  462. draw_page_one_equip_info
  463. when 1
  464. draw_page_two_equip_info
  465. when 2
  466. draw_page_three_equip_info
  467. when 3
  468. draw_page_four_equip_info
  469. else
  470. end
  471. end
  472.  
  473. def draw_page_one_equip_info
  474. dx = Graphics.width / 3 * 0
  475. dw = ((Graphics.width) / 3) - 12
  476. dy = line_height * 4.7
  477. for property in Dekita__Equip::Actor_Info
  478. dy = draw_stat_info_DPBz(property, @actor, dx, dy, dw)
  479. end
  480. end
  481.  
  482. def draw_page_two_equip_info
  483. dx = Graphics.width / 3 * 0
  484. dw = ((Graphics.width) / 3) - 12
  485. dy = line_height * 4.7
  486. for property in Dekita__Equip::Page_Two_Info
  487. dy = draw_stat_info_DPBz(property, @actor, dx, dy, dw)
  488. end
  489. end
  490.  
  491. def draw_page_three_equip_info
  492. dx = Graphics.width / 3 * 0
  493. dw = ((Graphics.width) / 3) - 12
  494. dy = line_height * 4.7
  495. for property in Dekita__Equip::Page_Three_Info
  496. dy = draw_stat_info_DPBz(property, @actor, dx, dy, dw)
  497. end
  498. end
  499.  
  500. def draw_page_four_equip_info
  501. dx = Graphics.width / 3 * 0
  502. dw = ((Graphics.width) / 3) - 12
  503. dy = line_height * 4.7
  504. for property in Dekita__Equip::Page_Four_Info
  505. dy = draw_stat_info_DPBz(property, @actor, dx, dy, dw)
  506. end
  507. end
  508.  
  509. end # Window_Equip_ActorStatus < Window_EquipStatus
  510.  
  511. #==============================================================================
  512. class Window_EquipCommand_DPBz < Window_Command
  513. #==============================================================================
  514.  
  515. def initialize(x, y, width)
  516. super(x, y)
  517. end
  518.  
  519. def window_width
  520. return (Graphics.width - 24) / 4.15 + (Dekita__Equip::Extra_Command_Width)
  521. end
  522.  
  523. def make_command_list
  524. for command in Dekita__Equip::Commands_list
  525. case command[0]
  526. when :equip ; add_command("", :equip)
  527. when :optimize ; add_command("", :optimize)
  528. when :clear ; add_command("", :clear)
  529. when :upgrade ; add_command("", :upgrade)
  530. else
  531. end
  532. end
  533. end
  534.  
  535. end # Window_EquipCommand_DPBz < Window_Command
  536.  
  537. #==============================================================================
  538. class Window_EquipSlot < Window_Selectable
  539. #==============================================================================
  540.  
  541. def initialize(x, y, width)
  542. super(((Graphics.width / 3) - 4), line_height * 4.7, width, window_height)
  543. @actor = nil
  544. refresh
  545. end
  546.  
  547. def window_height
  548. Graphics.height
  549. end
  550.  
  551. def draw_item(index)
  552. return unless @actor
  553. dx = (Graphics.width - 24) / 2 * 1
  554. dy = 0
  555. rect = item_rect_for_text(index)
  556. contents.font.size = Dekita__CORE::Info_Font_Size
  557. draw_equipments(92, 0)
  558. end
  559.  
  560. def draw_equipments(x, y)
  561. @actor.equips.each_with_index do |item, i|
  562. draw_item_name(item, x, y + (line_height * 1) * i)
  563. end
  564. change_color(Dekita__CORE::Value_Color_Settings(""))
  565. draw_actors_slots(y)
  566. end
  567.  
  568. def draw_actors_slots(y)
  569. my_x = 4
  570. slots_id = 0
  571. amount = @actor.equip_slots.size
  572. amount.times {|i|
  573. change_color(enabled_color?(slots_id))
  574. draw_text(my_x, y + line_height * i, Graphics.width / 3, line_height, slot_name(slots_id))
  575. slots_id += 1
  576. }
  577. end
  578.  
  579. def enabled_color?(index)
  580. return Color.new(111, 111, 111) unless @actor
  581. return Color.new(222, 222, 222) if @actor.equip_change_ok?(index)
  582. return Color.new(111, 111, 111)
  583. end
  584.  
  585. end # Window_EquipSlot < Window_Selectable
  586.  
  587. #==============================================================================
  588. class Window_EquipItem < Window_ItemList
  589. #==============================================================================
  590.  
  591. def col_max
  592. return 1
  593. end
  594.  
  595. def draw_item(index)
  596. contents.font.size = Dekita__CORE::Info_Font_Size
  597. super
  598. end
  599.  
  600. end # Window_EquipItem < Window_ItemList
  601.  
  602. #==============================================================================
  603. class Scene_Equip < Scene_MenuBase
  604. #==============================================================================
  605.  
  606. def start
  607. super
  608. create_status_window
  609. create_help_window
  610. create_command_window
  611. create_slot_window
  612. create_item_window
  613. create_actor_status_window
  614. create_equip_status_window
  615. create_equip_slot_status_window
  616. @help_window.y = (Graphics.height - @help_window.height)
  617. @help_window.opacity = 0
  618. end
  619.  
  620. def create_status_window
  621. @status_window = Window_EquipStatus.new(0, 0)
  622. @status_window.viewport = @viewport
  623. @status_window.actor = @actor
  624. end
  625.  
  626. def create_actor_status_window
  627. @actor_status_window = Window_Equip_ActorStatus.new(0, 0)
  628. @actor_status_window.viewport = @viewport
  629. @actor_status_window.actor = @actor
  630. end
  631.  
  632. def create_equip_status_window
  633. @equip_status_window = Window_EquipItemStatus.new(0, 0, @item_window)
  634. @equip_status_window.viewport = @viewport
  635. @equip_status_window.hide
  636. end
  637.  
  638. def create_equip_slot_status_window
  639. wx = 0
  640. wy = 0
  641. @equip_slot_status_window = Window_EquipItemStatus.new(wx, wy, @slot_window)
  642. @equip_slot_status_window.viewport = @viewport
  643. @equip_slot_status_window.hide
  644. end
  645.  
  646. def create_command_window
  647. wx = 0
  648. wy = 0
  649. ww = Graphics.width / 2
  650. @command_window = Window_EquipCommand_DPBz.new(wx, wy, ww)
  651. @command_window.viewport = @viewport
  652. @command_window.help_window = @help_window
  653. @command_window.set_handler(:equip, method(:command_equip))
  654. @command_window.set_handler(:optimize, method(:command_optimize))
  655. @command_window.set_handler(:clear, method(:command_clear))
  656. @command_window.set_handler(:cancel, method(:return_scene))
  657. @command_window.set_handler(:pagedown, method(:next_actor))
  658. @command_window.set_handler(:pageup, method(:prev_actor))
  659. @command_window.opacity =0
  660. end
  661.  
  662. def create_slot_window
  663. wx = 0
  664. wy = @command_window.y + @command_window.height
  665. ww = Graphics.width / 3 * 2
  666. @slot_window = Window_EquipSlot.new(wx, wy, ww)
  667. @slot_window.viewport = @viewport
  668. @slot_window.help_window = @help_window
  669. @slot_window.status_window = @status_window
  670. @slot_window.actor = @actor
  671. @slot_window.opacity = 0
  672. @slot_window.set_handler(:ok, method(:on_slot_ok))
  673. @slot_window.set_handler(:cancel, method(:on_slot_cancel))
  674. end
  675.  
  676. def create_item_window
  677. wx = (Graphics.width - (Graphics.width / 5 * 2))
  678. wy = 0
  679. ww = Graphics.width / 5 * 2
  680. wh = (24 * 5)
  681. @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  682. @item_window.viewport = @viewport
  683. @item_window.help_window = @help_window
  684. @item_window.status_window = @status_window
  685. @item_window.actor = @actor
  686. @item_window.set_handler(:ok, method(:on_item_ok))
  687. @item_window.set_handler(:cancel, method(:on_item_cancel))
  688. @slot_window.item_window = @item_window
  689. @item_window.opacity = 0
  690. end
  691.  
  692. alias command_equip_WHATTTT command_equip
  693. def command_equip
  694. command_equip_WHATTTT
  695. @actor_status_window.hide
  696. @equip_slot_status_window.show
  697. end
  698.  
  699. alias on_slot_ok_DPBz_Equip on_slot_ok
  700. def on_slot_ok
  701. on_slot_ok_DPBz_Equip
  702. @equip_slot_status_window.hide
  703. @equip_status_window.show
  704. end
  705.  
  706. alias on_slot_cancel_DPBz_Equip on_slot_cancel
  707. def on_slot_cancel
  708. on_slot_cancel_DPBz_Equip
  709. @equip_status_window.hide
  710. @equip_slot_status_window.hide
  711. @actor_status_window.show
  712. end
  713.  
  714. alias on_item_ok_DPBz_Equip on_item_ok
  715. def on_item_ok
  716. on_item_ok_DPBz_Equip
  717. @actor_status_window.refresh
  718. @equip_status_window.hide
  719. @equip_slot_status_window.show
  720. end
  721.  
  722. alias on_item_cancel_DPBz_Equip on_item_cancel
  723. def on_item_cancel
  724. on_item_cancel_DPBz_Equip
  725. @equip_status_window.hide
  726. @equip_slot_status_window.show
  727. end
  728.  
  729. alias on_actor_change_DPBZ_equip on_actor_change
  730. def on_actor_change
  731. on_actor_change_DPBZ_equip
  732. @actor_status_window.actor = @actor
  733. @command_window.activate
  734. end
  735.  
  736. end # Scene_Equip
  737.  
  738. #===============================================================================#
  739. # http://dekitarpg.wordpress.com/
  740. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement