Advertisement
Dekita

bank1.0

Mar 29th, 2014
1,733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.17 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Bank Account
  5. # -- Author : Dekita
  6. # -- Version : 1.0
  7. # -- Level : Easy / Normal
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Bank_Account]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 17/o3/2o13 - Ported Script to $D13x Engine,
  21. # 1o/o3/2o13 - Added x position option for money icon and text,
  22. # o6/o3/2o13 - Fixed bug (equip vanish when deposit),
  23. # - Added sprintf txt options for value and gold prefix,
  24. # 22/o1/2o13 - Re-wired Player PC (pokemon script), into a full bank,
  25. #
  26. #===============================================================================
  27. # ☆ Introduction
  28. #-------------------------------------------------------------------------------
  29. # This script simply creates a "bank" scene, you can deposit && withdraw
  30. # items, weapons, armors and cash.
  31. # You can also set the bank to already have items ect at the start of the game.
  32. #
  33. #===============================================================================
  34. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  35. #===============================================================================
  36. # 1. You MUST give credit to "Dekita" !!
  37. # 2. You are NOT allowed to repost this script.(or modified versions)
  38. # 3. You are NOT allowed to convert this script.
  39. # 4. You are NOT allowed to use this script for Commercial games.
  40. # 5. ENJOY!
  41. #
  42. # "FINE PRINT"
  43. # By using this script you hereby agree to the above terms and conditions,
  44. # if any violation of the above terms occurs "legal action" may be taken.
  45. # Not understanding the above terms and conditions does NOT mean that
  46. # they do not apply to you.
  47. # If you wish to discuss the terms and conditions in further detail you can
  48. # contact me at http://dekitarpg.wordpress.com/
  49. #
  50. #===============================================================================
  51. # ☆ Instructions
  52. #-------------------------------------------------------------------------------
  53. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  54. #
  55. #===============================================================================
  56. # ☆ Script Calls
  57. #-------------------------------------------------------------------------------
  58. # $bank.gain_cash(amount)
  59. # $bank.lose_cash(amount)
  60. # $bank.add_to_items(id, amount)
  61. # $bank.add_to_weapons(id, amount)
  62. # $bank.add_to_armors(id, amount)
  63. #
  64. # The above script calls *should* be fairly obvious, replace id with the id of
  65. # the item (found in the database). replace amount with the amount you want.
  66. #
  67. # NOTE:
  68. # If using my $D13x Random Equip, the amount (for weapons and armors) will set
  69. # the tier, rather than the amount.
  70. #
  71. #===============================================================================
  72. module Game_Storage
  73. #===============================================================================
  74. #-----------------------------------------------------------------------------
  75. #
  76. #-----------------------------------------------------------------------------
  77. Initial_CASH = 2000
  78. #-----------------------------------------------------------------------------
  79. # Format = [ [item id, amount], [item id, amount] ]
  80. #-----------------------------------------------------------------------------
  81. Initial_Items = [ [1, 1], [2, 2] ]
  82. #-----------------------------------------------------------------------------
  83. # Format = Same As Above.
  84. #-----------------------------------------------------------------------------
  85. Initial_Weapons = [ [1, 1] ]
  86. #-----------------------------------------------------------------------------
  87. # Format = Same As Above.
  88. #-----------------------------------------------------------------------------
  89. Initial_Armors = [ [1, 1] ]
  90.  
  91. Menu_Access = [true, 'Bank Account']
  92.  
  93. end
  94. #===============================================================================
  95. module PC_Scene # DO NOT DELETE THIS LINE !!
  96. #===============================================================================
  97. #-----------------------------------------------------------------------------
  98. #
  99. #-----------------------------------------------------------------------------
  100. Money_Vocab = "Money"
  101. Money_Prefix = "%s Gold" # (shows as £ value)
  102. Money_Icon = 361
  103. # X position for money icon and text.
  104. Money_Icon_x = 0 # 60
  105. Money_Text_x = 25 # 0
  106. #-----------------------------------------------------------------------------
  107. #
  108. #-----------------------------------------------------------------------------
  109. Value_Prefix = "×%s" # (for showing selected item amounts)
  110. #-----------------------------------------------------------------------------
  111. #
  112. #-----------------------------------------------------------------------------
  113. Items_Vocab = "Items"
  114. Weapons_Vocab = "Weapons"
  115. Armors_Vocab = "Armors"
  116. #-----------------------------------------------------------------------------
  117. #
  118. #-----------------------------------------------------------------------------
  119. Current_Money_Vocab = "In Pocket :"
  120. Banked_Money_Vocab = "In Bank :"
  121. #-----------------------------------------------------------------------------
  122. #
  123. #-----------------------------------------------------------------------------
  124. Deposit_Vocab = "Deposit"
  125. Deposit_Info = "Deposit Money, Items or Equipment into your account."
  126. Deposit_Cash = "Deposit Money into your account."
  127. Deposit_Items = "Deposit Items into your account."
  128. Deposit_Weapons = "Deposit Weapons into your account."
  129. Deposit_Armors = "Deposit Armors into your account."
  130. #-----------------------------------------------------------------------------
  131. #
  132. #-----------------------------------------------------------------------------
  133. Withdraw_Vocab = "Withdraw"
  134. Withdraw_Info = "Withdraw Money, Items or Equipment from your account."
  135. Withdraw_Cash = "Withdraw Money from your account."
  136. Withdraw_Items = "Withdraw Items from your account."
  137. Withdraw_Weapons = "Withdraw Weapons from your account."
  138. Withdraw_Armors = "Withdraw Armors from your account."
  139. #-----------------------------------------------------------------------------
  140. #
  141. #-----------------------------------------------------------------------------
  142. # If you hold this key, while on the NUMBER screen, it will increase / decrease
  143. # the selection amount faster.
  144. Key = :SHIFT
  145. #--------------------------------------------------------------------------
  146. # This option only works if using my $D13x Scene Backgrounds Script.
  147. # The background folder is set in the Scene BackGrounds script.
  148. #--------------------------------------------------------------------------
  149. BGs=[
  150. # ['NAME' , x, y, x scroll, y scroll, z, hue, init opac, max opac],
  151. ['Sunbeam_Overlay_by ShinGamix',0,0, 0, 0, 1, 0, 105, 255],
  152. ['ShinGamox_by ShinGamix',0,0, 0, 0, 1, 0, 105, 245],
  153. ['Fog_By_hyde' , 100, 100, 2, -2, 1, 0, 74, 125],
  154. ['$Dekita_II' , 0, 0, 1, 1, 2, 0, 0, 255],
  155. ]# << end
  156.  
  157. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  158. # ☆ Window Settings
  159. #--------------------------------------------------------------------------
  160. # This is where you set the windowskin for each window.
  161. # Simply put a # at the start of lines you want to keep the default
  162. # NOTE : This setting requires $D13x Window Skins Script.
  163. # The windowskin folder is set in the WindowSkins script also.
  164. #--------------------------------------------------------------------------
  165. Skins = ["PWI_Style_Blu", 0, 225] # ["Skin Name" , hue, opacity]
  166.  
  167. #####################
  168. # CUSTOMISATION END #
  169. end #####################
  170. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  171. # #
  172. # http://dekitarpg.wordpress.com/ #
  173. # #
  174. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  175. #===============================================================================#
  176. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  177. # YES?\.\. #
  178. # OMG, REALLY? \| #
  179. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  180. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  181. #===============================================================================#
  182. module DataManager
  183. #===============================================================================
  184. #-----------------------------------------------------------------------------
  185. #
  186. #-----------------------------------------------------------------------------
  187. class << self ;
  188. alias :cgo_bank_account :create_game_objects
  189. alias :msc_bank_account :make_save_contents
  190. alias :esc_bank_account :extract_save_contents
  191. end
  192. #-----------------------------------------------------------------------------
  193. #
  194. #-----------------------------------------------------------------------------
  195. def self.create_game_objects
  196. cgo_bank_account
  197. $bank = Bank_Account.new
  198. end
  199. #-----------------------------------------------------------------------------
  200. #
  201. #-----------------------------------------------------------------------------
  202. def self.make_save_contents
  203. contents = msc_bank_account
  204. contents[:bank] = $bank
  205. contents
  206. end
  207. #-----------------------------------------------------------------------------
  208. #
  209. #-----------------------------------------------------------------------------
  210. def self.extract_save_contents(contents)
  211. esc_bank_account(contents)
  212. $bank = contents[:bank].nil? ? Bank_Account.new : contents[:bank]
  213. end
  214. end
  215. #==============================================================================
  216. class Bank_Account
  217. #==============================================================================
  218. #-----------------------------------------------------------------------------
  219. #
  220. #-----------------------------------------------------------------------------
  221. include Game_Storage
  222. #-----------------------------------------------------------------------------
  223. #
  224. #-----------------------------------------------------------------------------
  225. attr_reader :cash
  226. attr_reader :items
  227. attr_reader :weapons
  228. attr_reader :armors
  229. #-----------------------------------------------------------------------------
  230. #
  231. #-----------------------------------------------------------------------------
  232. def initialize
  233. init_pis
  234. get_initial_stored_items
  235. get_initial_stored_weapons
  236. get_initial_stored_armors
  237. end
  238. #-----------------------------------------------------------------------------
  239. #
  240. #-----------------------------------------------------------------------------
  241. def init_pis
  242. @cash = Initial_CASH
  243. @items = []
  244. @weapons = []
  245. @armors = []
  246. end
  247. #-----------------------------------------------------------------------------
  248. #
  249. #-----------------------------------------------------------------------------
  250. def get_initial_stored_items
  251. for info in Game_Storage::Initial_Items
  252. next if info[0] == nil || info[0] <= 0
  253. add_to_items(info[0], info[1])
  254. end
  255. end
  256. #-----------------------------------------------------------------------------
  257. #
  258. #-----------------------------------------------------------------------------
  259. def get_initial_stored_weapons
  260. for info in Game_Storage::Initial_Weapons
  261. next if info[0] == nil || info[0] <= 0
  262. add_to_weapons(info[0], info[1])
  263. end
  264. end
  265. #-----------------------------------------------------------------------------
  266. #
  267. #-----------------------------------------------------------------------------
  268. def get_initial_stored_armors
  269. for info in Game_Storage::Initial_Armors
  270. next if info[0] == nil || info[0] <= 0
  271. add_to_armors(info[0], info[1])
  272. end
  273. end
  274. #-----------------------------------------------------------------------------
  275. #
  276. #-----------------------------------------------------------------------------
  277. def add_to_items(item_id, amount)
  278. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  279. @items.push([ $data_items[item_id] , amount ])
  280. end
  281. #-----------------------------------------------------------------------------
  282. #
  283. #-----------------------------------------------------------------------------
  284. def add_to_weapons(item_id, amount)
  285. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  286. if $D13x[:UniEquip]
  287. if $data_weapons[item_id].database_id == $data_weapons[item_id].id
  288. weapon = [Cloning_101.start_clone(:weapon,item_id,amount,true), 1]
  289. Cloning_101.delete_clone(:weapon, weapon[0].id)
  290. else
  291. weapon = [$data_weapons[item_id], 1]
  292. end
  293. else
  294. weapon = [$data_weapons[item_id], armount]
  295. end
  296. @weapons.push(weapon)
  297. end
  298. #-----------------------------------------------------------------------------
  299. #
  300. #-----------------------------------------------------------------------------
  301. def add_to_armors(item_id, amount)
  302. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  303. if $D13x[:UniEquip]
  304. if $data_armors[item_id].database_id == $data_armors[item_id].id
  305. armor = [Cloning_101.start_clone(:armor,item_id,amount,true), 1]
  306. Cloning_101.delete_clone(:armor, armor[0].id)
  307. else
  308. armor = [$data_armors[item_id], 1]
  309. end
  310. else
  311. armor = [$data_armors[item_id],amount]
  312. end
  313. @armors.push(armor)
  314. end
  315. #-----------------------------------------------------------------------------
  316. #
  317. #-----------------------------------------------------------------------------
  318. def gain_cash(amount)
  319. @cash += amount
  320. end
  321. #-----------------------------------------------------------------------------
  322. #
  323. #-----------------------------------------------------------------------------
  324. def lose_cash(amount)
  325. @cash -= amount
  326. @cash = 0 if @cash < 0
  327. end
  328. end
  329. #===============================================================================
  330. class Window_Player_PC_Number < Window_ShopNumber
  331. #===============================================================================
  332. #-----------------------------------------------------------------------------
  333. #
  334. #-----------------------------------------------------------------------------
  335. def initialize(x, y)
  336. super(x, y, window_height)
  337. end
  338. #-----------------------------------------------------------------------------
  339. #
  340. #-----------------------------------------------------------------------------
  341. def window_width
  342. return Graphics.width / 2
  343. end
  344. #-----------------------------------------------------------------------------
  345. #
  346. #-----------------------------------------------------------------------------
  347. def window_height
  348. return line_height + 24
  349. end
  350. #-----------------------------------------------------------------------------
  351. #
  352. #-----------------------------------------------------------------------------
  353. def refresh
  354. contents.clear
  355. draw_the_item
  356. draw_number
  357. end
  358. #-----------------------------------------------------------------------------
  359. #
  360. #-----------------------------------------------------------------------------
  361. def draw_number
  362. change_color(normal_color)
  363. if @item
  364. change_color(@item.item_disp_color, true)
  365. end
  366. tx = sprintf(PC_Scene::Value_Prefix, @number)
  367. draw_text(0,0,window_width-(standard_padding*2), line_height, tx, 2)
  368. end
  369. #-----------------------------------------------------------------------------
  370. #
  371. #-----------------------------------------------------------------------------
  372. def draw_the_item
  373. change_color(normal_color)
  374. x = PC_Scene::Money_Text_x
  375. ix = PC_Scene::Money_Icon_x
  376. y = item_y
  377. w = window_width
  378. if @item == $data_items[0]
  379. draw_icon(PC_Scene::Money_Icon, ix, y, true)
  380. draw_text(x, y, w, line_height, PC_Scene::Money_Vocab)
  381.  
  382. else
  383. draw_icon(@item.icon_index, ix, y, true)
  384. change_color(@item.item_disp_color, true)
  385. draw_text(x, y, w, line_height, @item.name)
  386. end
  387. end
  388. #-----------------------------------------------------------------------------
  389. #
  390. #-----------------------------------------------------------------------------
  391. def item_y
  392. return 0
  393. end
  394. #-----------------------------------------------------------------------------
  395. #
  396. #-----------------------------------------------------------------------------
  397. def figures
  398. return 4
  399. end
  400. #-----------------------------------------------------------------------------
  401. #
  402. #-----------------------------------------------------------------------------
  403. def update_number
  404. if Keys.press?(PC_Scene::Key)
  405. change_number(100) if Keys.trigger?(:UP)
  406. change_number(-100) if Keys.trigger?(:DOWN)
  407. change_number(10) if Keys.trigger?(:RIGHT)
  408. change_number(-10) if Keys.trigger?(:LEFT)
  409. else
  410. super
  411. end
  412. end
  413. #-----------------------------------------------------------------------------
  414. #
  415. #-----------------------------------------------------------------------------
  416. def update_cursor
  417. cursor_rect.set(0, 0, 0, 0)
  418. end
  419. #-----------------------------------------------------------------------------
  420. #
  421. #-----------------------------------------------------------------------------
  422. def change_number(amount)
  423. @number = [[@number + amount, @max].min, 0].max
  424. end
  425. #-----------------------------------------------------------------------------
  426. #
  427. #-----------------------------------------------------------------------------
  428. def set(item, max, price, currency_unit = nil)
  429. @item = item
  430. @max = max
  431. @price = price
  432. @currency_unit = currency_unit if currency_unit
  433. @number = @item == $data_items[0] ? 0 : 1
  434. refresh
  435. end
  436. #--------------------------------------------------------------------------
  437. # Set Windowskin (overwrite from super)
  438. #--------------------------------------------------------------------------
  439. def set_the_skin
  440. @skin = PC_Scene::Skins
  441. end
  442. end
  443. #===============================================================================
  444. class Window_Bank_Help < Deki_Help
  445. #===============================================================================
  446. #-----------------------------------------------------------------------------
  447. # Set Windowskin (overwrite from super)
  448. #-----------------------------------------------------------------------------
  449. def set_the_skin
  450. @skin = PC_Scene::Skins
  451. end
  452. end
  453. #==============================================================================
  454. class Window_PC_GOLD < Window_Gold
  455. #==============================================================================
  456. #-----------------------------------------------------------------------------
  457. #
  458. #-----------------------------------------------------------------------------
  459. def window_width
  460. return ((Graphics.width / 4 * 2))
  461. end
  462. #-----------------------------------------------------------------------------
  463. #
  464. #-----------------------------------------------------------------------------
  465. def refresh
  466. contents.clear
  467. draw_gold
  468. end
  469. #-----------------------------------------------------------------------------
  470. #
  471. #-----------------------------------------------------------------------------
  472. def draw_gold
  473. x = 0 ; y = 0
  474. change_color(normal_color)
  475. draw_text(x, y, window_width, line_height, PC_Scene::Current_Money_Vocab)
  476. draw_text(x, y, window_width-24, line_height, unit, 2)
  477. end
  478. #-----------------------------------------------------------------------------
  479. #
  480. #-----------------------------------------------------------------------------
  481. def unit
  482. sprintf(PC_Scene::Money_Prefix, value)
  483. end
  484. #--------------------------------------------------------------------------
  485. # Set Windowskin (overwrite from super)
  486. #--------------------------------------------------------------------------
  487. def set_the_skin
  488. @skin = PC_Scene::Skins
  489. end
  490. end
  491. #==============================================================================
  492. class Window_PC_GOLD_InBank < Window_PC_GOLD
  493. #==============================================================================
  494. #-----------------------------------------------------------------------------
  495. #
  496. #-----------------------------------------------------------------------------
  497. def draw_gold
  498. x = 0 ; y = 0
  499. change_color(normal_color)
  500. draw_text(x, y, window_width, line_height, PC_Scene::Banked_Money_Vocab)
  501. draw_text(x, y, window_width-24, line_height, unit, 2)
  502. end
  503. #-----------------------------------------------------------------------------
  504. #
  505. #-----------------------------------------------------------------------------
  506. def value
  507. $bank.cash
  508. end
  509. #--------------------------------------------------------------------------
  510. # Set Windowskin (overwrite from super)
  511. #--------------------------------------------------------------------------
  512. def set_the_skin
  513. @skin = PC_Scene::Skins
  514. end
  515. end
  516. #==============================================================================
  517. class Window_Player_PC_Command < Window_Command
  518. #==============================================================================
  519. #-----------------------------------------------------------------------------
  520. #
  521. #-----------------------------------------------------------------------------
  522. def initialize(x, y)
  523. super(x, y)
  524. draw_items_info
  525. type
  526. end
  527. #-----------------------------------------------------------------------------
  528. #
  529. #-----------------------------------------------------------------------------
  530. def change_type(type = :items)
  531. @type = type
  532. end
  533. #-----------------------------------------------------------------------------
  534. #
  535. #-----------------------------------------------------------------------------
  536. def type
  537. @type
  538. end
  539. #-----------------------------------------------------------------------------
  540. #
  541. #-----------------------------------------------------------------------------
  542. def window_width
  543. return Graphics.width - (Graphics.width / 4 * 2)
  544. end
  545. #-----------------------------------------------------------------------------
  546. #
  547. #-----------------------------------------------------------------------------
  548. def window_height
  549. return Graphics.height - fitting_height(6)
  550. end
  551. #-----------------------------------------------------------------------------
  552. #
  553. #-----------------------------------------------------------------------------
  554. def make_command_list
  555. case @type
  556. when :items
  557. for item in $bank.items
  558. add_item_command(item)
  559. end
  560. when :weapons
  561. for item in $bank.weapons
  562. add_item_command(item)
  563. end
  564. when :armors
  565. for item in $bank.armors
  566. add_item_command(item)
  567. end
  568. end
  569. end
  570. #-----------------------------------------------------------------------------
  571. #
  572. #-----------------------------------------------------------------------------
  573. def add_item_command(item)
  574. add_command("" , :avail_item, true)
  575. end
  576. #-----------------------------------------------------------------------------
  577. #
  578. #-----------------------------------------------------------------------------
  579. def draw_items_info
  580. x = 0 ; y = 0
  581. case @type
  582. when :items
  583. for item in $bank.items
  584. y = draw_infoo(x, y, item)
  585. end
  586. when :weapons
  587. for item in $bank.weapons
  588. y = draw_infoo(x, y, item)
  589. end
  590. when :armors
  591. for item in $bank.armors
  592. y = draw_infoo(x, y, item)
  593. end
  594. end
  595. end
  596. #-----------------------------------------------------------------------------
  597. #
  598. #-----------------------------------------------------------------------------
  599. def draw_infoo(x, y, item)
  600. draw_icon(item[0].icon_index, x, y, true)
  601. change_color(item[0].item_disp_color)
  602. draw_text(x+25, y, window_width-50, line_height, item[0].name, 0)
  603. if $D13x[:UniEquip] && $D13x[:Equip_Levels] && item.is_a?(RPG::EquipItem)
  604. lv = Equip_Exp::Level_Names[item[0].level]
  605. draw_text(x, y, window_width-25, line_height, lv, 2)
  606. else
  607. draw_text(x, y, window_width-25, line_height, "×#{item[1]} ", 2)
  608. end
  609. return y + line_height
  610. end
  611. #-----------------------------------------------------------------------------
  612. #
  613. #-----------------------------------------------------------------------------
  614. def refresh
  615. super
  616. draw_items_info
  617. end
  618. #--------------------------------------------------------------------------
  619. # Set Windowskin (overwrite from super)
  620. #--------------------------------------------------------------------------
  621. def set_the_skin
  622. @skin = PC_Scene::Skins
  623. end
  624. end
  625. #==============================================================================
  626. class Window_Player_PC_Bag_Command < Window_Player_PC_Command
  627. #==============================================================================
  628. #-----------------------------------------------------------------------------
  629. #
  630. #-----------------------------------------------------------------------------
  631. def make_command_list
  632. case @type
  633. when :items
  634. for item in $game_party.items
  635. add_item_command(item)
  636. end
  637. when :weapons
  638. for item in $game_party.weapons
  639. add_item_command(item)
  640. end
  641. when :armors
  642. for item in $game_party.armors
  643. add_item_command(item)
  644. end
  645. end
  646. end
  647. #-----------------------------------------------------------------------------
  648. #
  649. #-----------------------------------------------------------------------------
  650. def add_item_command(item)
  651. add_command("" , :avail_item, true)
  652. end
  653. #-----------------------------------------------------------------------------
  654. #
  655. #-----------------------------------------------------------------------------
  656. def draw_items_info
  657. x = 0
  658. y = 0
  659. case @type
  660. when :items
  661. for item in $game_party.items
  662. y = draw_infoo(x, y, item)
  663. end
  664. when :weapons
  665. for item in $game_party.weapons
  666. y = draw_infoo(x, y, item)
  667. end
  668. when :armors
  669. for item in $game_party.armors
  670. y = draw_infoo(x, y, item)
  671. end
  672. end
  673. end
  674. #-----------------------------------------------------------------------------
  675. #
  676. #-----------------------------------------------------------------------------
  677. def draw_infoo(x, y, item)
  678. draw_icon(item.icon_index, x, y, true)
  679. change_color(item.item_disp_color)
  680. draw_text(x+25, y, window_width-50, line_height, item.name, 0)
  681. if $D13x[:UniEquip] && $D13x[:Equip_Levels] && item.is_a?(RPG::EquipItem)
  682. lv = Equip_Exp::Level_Names[item.level]
  683. draw_text(x, y, window_width-25, line_height, lv, 2)
  684. else
  685. item_count = $game_party.item_number(item)
  686. draw_text(x, y, window_width-25, line_height, "×#{item_count} ", 2)
  687. end
  688. return y + line_height
  689. end
  690. #--------------------------------------------------------------------------
  691. # Set Windowskin (overwrite from super)
  692. #--------------------------------------------------------------------------
  693. def set_the_skin
  694. @skin = PC_Scene::Skins
  695. end
  696. end
  697. #==============================================================================
  698. class Window_Player_PC_Action_Command < Window_Command
  699. #==============================================================================
  700. #-----------------------------------------------------------------------------
  701. #
  702. #-----------------------------------------------------------------------------
  703. def window_width
  704. return Graphics.width/4
  705. end
  706. #-----------------------------------------------------------------------------
  707. #
  708. #-----------------------------------------------------------------------------
  709. def make_command_list
  710. add_command(PC_Scene::Deposit_Vocab, :deposit)
  711. add_command(PC_Scene::Withdraw_Vocab, :withdraw)
  712. end
  713. #--------------------------------------------------------------------------
  714. # Set Windowskin (overwrite from super)
  715. #--------------------------------------------------------------------------
  716. def set_the_skin
  717. @skin = PC_Scene::Skins
  718. end
  719. end
  720. #==============================================================================
  721. class Window_Player_PC_Action_Command_2 < Window_HorzCommand
  722. #==============================================================================
  723. #-----------------------------------------------------------------------------
  724. #
  725. #-----------------------------------------------------------------------------
  726. def window_width
  727. return Graphics.width
  728. end
  729. #-----------------------------------------------------------------------------
  730. #
  731. #-----------------------------------------------------------------------------
  732. def make_command_list
  733. add_command(PC_Scene::Money_Vocab, :cash)
  734. add_command(PC_Scene::Items_Vocab, :items)
  735. add_command(PC_Scene::Weapons_Vocab, :weapons)
  736. add_command(PC_Scene::Armors_Vocab, :armors)
  737. end
  738. #-----------------------------------------------------------------------------
  739. #
  740. #-----------------------------------------------------------------------------
  741. def col_max
  742. return 4
  743. end
  744. #--------------------------------------------------------------------------
  745. # Set Windowskin (overwrite from super)
  746. #--------------------------------------------------------------------------
  747. def set_the_skin
  748. @skin = PC_Scene::Skins
  749. end
  750. end
  751. #===============================================================================
  752. class Scene_BANK < Scene_MenuBase
  753. #===============================================================================
  754. #-----------------------------------------------------------------------------
  755. #
  756. #-----------------------------------------------------------------------------
  757. def start
  758. super
  759. create_help_window
  760. create_action_commands
  761. create_action_commands_2
  762. create_main_commands
  763. create_player_bag_commands
  764. create_number_window
  765. create_gold_window
  766. create_bankgold_window
  767. end
  768. #-----------------------------------------------------------------------------
  769. #
  770. #-----------------------------------------------------------------------------
  771. def create_help_window
  772. @help_window = Window_Bank_Help.new
  773. @help_window.viewport = @viewport
  774. @help_window.x = Graphics.width / 4
  775. end
  776. #-----------------------------------------------------------------------------
  777. #
  778. #-----------------------------------------------------------------------------
  779. def create_gold_window
  780. @gold_window = Window_PC_GOLD.new
  781. @gold_window.x = 0
  782. @gold_window.y = @action_com_wind_2.y + @action_com_wind_2.height
  783. end
  784. #-----------------------------------------------------------------------------
  785. #
  786. #-----------------------------------------------------------------------------
  787. def create_bankgold_window
  788. @bankgold_window = Window_PC_GOLD_InBank.new
  789. @bankgold_window.x = ((Graphics.width / 4 * 2))
  790. @bankgold_window.y = @action_com_wind_2.y + @action_com_wind_2.height
  791. end
  792. #-----------------------------------------------------------------------------
  793. #
  794. #-----------------------------------------------------------------------------
  795. def create_action_commands
  796. wx = @help_window.x
  797. wy = @help_window.height
  798. @action_com_wind = Window_Player_PC_Action_Command.new(0, 0)
  799. @action_com_wind.set_handler(:deposit, method(:command_trigger_nxt_choice))
  800. @action_com_wind.set_handler(:withdraw, method(:command_trigger_nxt_choice))
  801. @action_com_wind.set_handler(:cancel, method(:return_scene))
  802. @my_current_symbol = :deposit
  803. end
  804. #-----------------------------------------------------------------------------
  805. #
  806. #-----------------------------------------------------------------------------
  807. def create_action_commands_2
  808. y = @help_window.height
  809. @action_com_wind_2 = Window_Player_PC_Action_Command_2.new(0, y)
  810. @action_com_wind_2.set_handler(:cash, method(:command_trigger_cash))
  811. @action_com_wind_2.set_handler(:items, method(:command_trigger_items))
  812. @action_com_wind_2.set_handler(:weapons, method(:command_trigger_weapons))
  813. @action_com_wind_2.set_handler(:armors, method(:command_trigger_armors))
  814. @action_com_wind_2.set_handler(:cancel, method(:command_back_to_firstchoice))
  815. @action_com_wind_2.deactivate
  816. @action_com_wind_2.select(-1)
  817. end
  818. #-----------------------------------------------------------------------------
  819. #
  820. #-----------------------------------------------------------------------------
  821. def create_main_commands
  822. wx = Graphics.width / 2
  823. wy = @action_com_wind_2.y + (@action_com_wind_2.height * 2)
  824. @main_com_wind = Window_Player_PC_Command.new(wx, wy)
  825. @main_com_wind.set_handler(:avail_item, method(:command_items))
  826. @main_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
  827. @main_com_wind.deactivate
  828. @main_com_wind.select(-1)
  829. end
  830. #-----------------------------------------------------------------------------
  831. #
  832. #-----------------------------------------------------------------------------
  833. def create_player_bag_commands
  834. wx = 0
  835. wy = @action_com_wind_2.y + (@action_com_wind_2.height * 2)
  836. @bag_com_wind = Window_Player_PC_Bag_Command.new(wx, wy)
  837. @bag_com_wind.set_handler(:avail_item, method(:command_items))
  838. @bag_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
  839. @bag_com_wind.deactivate
  840. @bag_com_wind.select(-1)
  841. end
  842. #-----------------------------------------------------------------------------
  843. #
  844. #-----------------------------------------------------------------------------
  845. def create_number_window
  846. wx = Graphics.width / 4
  847. wy = @action_com_wind.y + @action_com_wind.height
  848. @number_window = Window_Player_PC_Number.new(wx, wy)
  849. @number_window.viewport = @viewport
  850. @number_window.set_handler(:ok, method(:confirm_numbers))
  851. @number_window.set_handler(:cancel, method(:cancel_numbers))
  852. @number_window.hide
  853. end
  854. #-----------------------------------------------------------------------------
  855. #
  856. #-----------------------------------------------------------------------------
  857. def command_trigger_nxt_choice
  858. @action_com_wind_2.activate
  859. @action_com_wind_2.select(0)
  860. end
  861. #-----------------------------------------------------------------------------
  862. #
  863. #-----------------------------------------------------------------------------
  864. def command_trigger_cash
  865. item = $data_items[0]
  866. case @action_com_wind.current_symbol
  867. when :deposit ; max = $game_party.gold
  868. price = $game_party.gold == 0 ? 0 : 1
  869. when :withdraw ; max = $bank.cash
  870. price = $bank.cash == 0 ? 0 : 1
  871. end
  872. @action_com_wind_2.deactivate
  873. @number_window.set(item, max, price)
  874. @number_window.open
  875. @number_window.activate
  876. @number_window.show
  877. end
  878. #-----------------------------------------------------------------------------
  879. #
  880. #-----------------------------------------------------------------------------
  881. def command_trigger_items
  882. @action_com_wind_2.deactivate
  883. case @action_com_wind.current_symbol
  884. when :deposit
  885. @bag_com_wind.activate
  886. @bag_com_wind.select(0)
  887. when :withdraw
  888. @main_com_wind.activate
  889. @main_com_wind.select(0)
  890. end
  891. end
  892. #-----------------------------------------------------------------------------
  893. #
  894. #-----------------------------------------------------------------------------
  895. def command_trigger_weapons
  896. @action_com_wind_2.deactivate
  897. case @action_com_wind.current_symbol
  898. when :deposit
  899. @bag_com_wind.activate
  900. @bag_com_wind.select(0)
  901. when :withdraw
  902. @main_com_wind.activate
  903. @main_com_wind.select(0)
  904. end
  905. end
  906. #-----------------------------------------------------------------------------
  907. #
  908. #-----------------------------------------------------------------------------
  909. def command_trigger_armors
  910. @action_com_wind_2.deactivate
  911. case @action_com_wind.current_symbol
  912. when :deposit
  913. @bag_com_wind.activate
  914. @bag_com_wind.select(0)
  915. when :withdraw
  916. @main_com_wind.activate
  917. @main_com_wind.select(0)
  918. end
  919. end
  920. #-----------------------------------------------------------------------------
  921. #
  922. #-----------------------------------------------------------------------------
  923. def command_back_to_firstchoice
  924. @action_com_wind_2.deactivate
  925. @action_com_wind_2.select(-1)
  926. @action_com_wind.activate
  927. end
  928. #-----------------------------------------------------------------------------
  929. #
  930. #-----------------------------------------------------------------------------
  931. def command_back_to_2nd_choice
  932. @main_com_wind.deactivate
  933. @main_com_wind.select(-1)
  934. @bag_com_wind.deactivate
  935. @bag_com_wind.select(-1)
  936. @action_com_wind_2.activate
  937. end
  938. #-----------------------------------------------------------------------------
  939. #
  940. #-----------------------------------------------------------------------------
  941. def command_items
  942. case @action_com_wind_2.current_symbol
  943. when:items
  944. case @action_com_wind.current_symbol
  945. when :deposit
  946. item = $data_items[$game_party.items[@bag_com_wind.index].id]
  947. max = $game_party.item_number(item)
  948. when :withdraw
  949. item = $bank.items[@main_com_wind.index][0]
  950. max = $bank.items[@main_com_wind.index][1]
  951. end
  952. when :weapons
  953. case @action_com_wind.current_symbol
  954. when :deposit
  955. item = $data_weapons[$game_party.weapons[@bag_com_wind.index].id]
  956. max = $game_party.item_number(item)
  957. when :withdraw
  958. item = $bank.weapons[@main_com_wind.index][0]
  959. max = $bank.weapons[@main_com_wind.index][1]
  960. end
  961. when :armors
  962. case @action_com_wind.current_symbol
  963. when :deposit
  964. item = $data_armors[$game_party.armors[@bag_com_wind.index].id]
  965. max = $game_party.item_number(item)
  966. when :withdraw
  967. item = $bank.armors[@main_com_wind.index][0]
  968. max = $bank.armors[@main_com_wind.index][1]
  969. end
  970. end
  971. price = 1
  972. @number_window.set(item, max, price)
  973. @number_window.activate
  974. @number_window.show
  975. end
  976. #-----------------------------------------------------------------------------
  977. #
  978. #-----------------------------------------------------------------------------
  979. def confirm_numbers
  980. case @action_com_wind.current_symbol
  981. when :deposit
  982. case @action_com_wind_2.current_symbol
  983. when :cash
  984. deposit_cash(@number_window.number)
  985. @action_com_wind_2.activate
  986. when :items
  987. deposit_items(@number_window.number)
  988. @bag_com_wind.activate
  989. when :weapons
  990. deposit_weapons(@number_window.number)
  991. @bag_com_wind.activate
  992. when :armors
  993. deposit_armors(@number_window.number)
  994. @bag_com_wind.activate
  995. end
  996. when :withdraw
  997. case @action_com_wind_2.current_symbol
  998. when :cash
  999. withdraw_cash(@number_window.number)
  1000. @action_com_wind_2.activate
  1001. when :items
  1002. withdraw_items(@number_window.number)
  1003. @main_com_wind.activate
  1004. when :weapons
  1005. withdraw_weapons(@number_window.number)
  1006. @main_com_wind.activate
  1007. when :armors
  1008. withdraw_armors(@number_window.number)
  1009. @main_com_wind.activate
  1010. end
  1011. end
  1012. @number_window.deactivate
  1013. @number_window.hide
  1014. end
  1015. #-----------------------------------------------------------------------------
  1016. #
  1017. #-----------------------------------------------------------------------------
  1018. def cancel_numbers
  1019. case @action_com_wind.current_symbol
  1020. when :deposit
  1021. case @action_com_wind_2.current_symbol
  1022. when :cash
  1023. @action_com_wind_2.activate
  1024. when :items, :weapons, :armors
  1025. @bag_com_wind.activate
  1026. end
  1027. when :withdraw
  1028. case @action_com_wind_2.current_symbol
  1029. when :cash
  1030. @action_com_wind_2.activate
  1031. when :items, :weapons, :armors
  1032. @main_com_wind.activate
  1033. end
  1034. end
  1035. @number_window.deactivate
  1036. @number_window.hide
  1037. end
  1038. #-----------------------------------------------------------------------------
  1039. #
  1040. #-----------------------------------------------------------------------------
  1041. def deposit_cash(amount)
  1042. $game_party.lose_gold(amount)
  1043. $bank.gain_cash(amount)
  1044. @gold_window.refresh
  1045. @bankgold_window.refresh
  1046. end
  1047. #-----------------------------------------------------------------------------
  1048. #
  1049. #-----------------------------------------------------------------------------
  1050. def withdraw_cash(amount)
  1051. $game_party.gain_gold(amount)
  1052. $bank.lose_cash(amount)
  1053. @gold_window.refresh
  1054. @bankgold_window.refresh
  1055. end
  1056. #-----------------------------------------------------------------------------
  1057. #
  1058. #-----------------------------------------------------------------------------
  1059. def deposit_items(amount)
  1060. inv_item = $game_party.items[@bag_com_wind.index].id
  1061. $game_party.lose_item($data_items[inv_item], amount)
  1062. already_had_item = false
  1063. $bank.items.each {|item|
  1064. item[1] += amount if item[0].id == inv_item
  1065. already_had_item = true if item[0].id == inv_item ; }
  1066. $bank.add_to_items(inv_item, amount) if !already_had_item
  1067. @bag_com_wind.refresh
  1068. @main_com_wind.refresh
  1069. @bag_com_wind.activate
  1070. end
  1071. #-----------------------------------------------------------------------------
  1072. #
  1073. #-----------------------------------------------------------------------------
  1074. def withdraw_items(amount)
  1075. gsi = $bank.items[@main_com_wind.index]
  1076. gsi[1] -= amount
  1077. $game_party.gain_item(gsi[0], amount)
  1078. if gsi[1] < 1
  1079. $bank.items.delete_at(@main_com_wind.index)
  1080. @main_com_wind.index = 0
  1081. end
  1082. @main_com_wind.refresh
  1083. @bag_com_wind.refresh
  1084. @main_com_wind.activate
  1085. end
  1086. #-----------------------------------------------------------------------------
  1087. #
  1088. #-----------------------------------------------------------------------------
  1089. def deposit_weapons(amount)
  1090. inv_item = $game_party.weapons[@bag_com_wind.index].id
  1091. $game_party.lose_item($data_weapons[inv_item], amount)
  1092. already_had_item = false
  1093. $bank.weapons.each {|item|
  1094. item[1] += amount if item[0].id == inv_item
  1095. already_had_item = true if item[0].id == inv_item ; }
  1096. $bank.add_to_weapons(inv_item, amount) if !already_had_item
  1097. @bag_com_wind.refresh
  1098. @main_com_wind.refresh
  1099. @bag_com_wind.activate
  1100. end
  1101. #-----------------------------------------------------------------------------
  1102. #
  1103. #-----------------------------------------------------------------------------
  1104. def withdraw_weapons(amount)
  1105. gsi = $bank.weapons[@main_com_wind.index]
  1106. gsi[1] -= amount
  1107. $game_party.gain_item(gsi[0], amount)
  1108. if gsi[1] < 1
  1109. $bank.weapons.delete_at(@main_com_wind.index)
  1110. @main_com_wind.index = 0
  1111. end
  1112. @main_com_wind.refresh
  1113. @bag_com_wind.refresh
  1114. @main_com_wind.activate
  1115. end
  1116. #-----------------------------------------------------------------------------
  1117. #
  1118. #-----------------------------------------------------------------------------
  1119. def deposit_armors(amount)
  1120. inv_item = $game_party.armors[@bag_com_wind.index].id
  1121. $game_party.lose_item($data_armors[inv_item], amount)
  1122. already_had_item = false
  1123. $bank.items.each {|item|
  1124. item[1] += amount if item[0].id == inv_item
  1125. already_had_item = true if item[0].id == inv_item ; }
  1126. $bank.add_to_armors(inv_item, amount) if !already_had_item
  1127. @bag_com_wind.refresh
  1128. @main_com_wind.refresh
  1129. @bag_com_wind.activate
  1130. end
  1131. #-----------------------------------------------------------------------------
  1132. #
  1133. #-----------------------------------------------------------------------------
  1134. def withdraw_armors(amount)
  1135. gsi = $bank.armors[@main_com_wind.index]
  1136. gsi[1] -= amount
  1137. $game_party.gain_item(gsi[0], amount)
  1138. if gsi[1] < 1
  1139. $bank.armors.delete_at(@main_com_wind.index)
  1140. @main_com_wind.index = 0
  1141. end
  1142. @main_com_wind.refresh
  1143. @bag_com_wind.refresh
  1144. @main_com_wind.activate
  1145. end
  1146. #-----------------------------------------------------------------------------
  1147. #
  1148. #-----------------------------------------------------------------------------
  1149. def update
  1150. super
  1151. update_help_text
  1152. update_wind_type
  1153. end
  1154. #-----------------------------------------------------------------------------
  1155. #
  1156. #-----------------------------------------------------------------------------
  1157. def update_help_text
  1158. if @action_com_wind.active
  1159. update_text_one
  1160. elsif @action_com_wind_2.active
  1161. update_text_two
  1162. elsif @main_com_wind.active
  1163. update_text_three
  1164. end
  1165. end
  1166. #-----------------------------------------------------------------------------
  1167. #
  1168. #-----------------------------------------------------------------------------
  1169. def update_text_one
  1170. text = @action_com_wind.current_symbol == :deposit ?
  1171. PC_Scene::Deposit_Info : PC_Scene::Withdraw_Info
  1172. @help_window.set_text(text)
  1173. end
  1174. #-----------------------------------------------------------------------------
  1175. #
  1176. #-----------------------------------------------------------------------------
  1177. def update_text_two
  1178. case @action_com_wind_2.current_symbol
  1179. when :cash ;
  1180. text = @action_com_wind.current_symbol == :deposit ?
  1181. PC_Scene::Deposit_Cash : PC_Scene::Withdraw_Cash
  1182. when :items ; text = PC_Scene::Withdraw_Info
  1183. text = @action_com_wind.current_symbol == :deposit ?
  1184. PC_Scene::Deposit_Items : PC_Scene::Withdraw_Items
  1185. when :weapons ; text = PC_Scene::Withdraw_Info
  1186. text = @action_com_wind.current_symbol == :deposit ?
  1187. PC_Scene::Deposit_Weapons : PC_Scene::Withdraw_Weapons
  1188. when :armors ; text = PC_Scene::Withdraw_Info
  1189. text = @action_com_wind.current_symbol == :deposit ?
  1190. PC_Scene::Deposit_Armors : PC_Scene::Withdraw_Armors
  1191. end
  1192. @help_window.set_text(text)
  1193. end
  1194. #-----------------------------------------------------------------------------
  1195. #
  1196. #-----------------------------------------------------------------------------
  1197. def update_text_three
  1198. case @action_com_wind_2.current_symbol
  1199. # when :cash ;
  1200. when :items ; text = PC_Scene::Withdraw_Info
  1201. text = $bank.items[@main_com_wind.index] == nil ?
  1202. "" : $bank.items[@main_com_wind.index][0]
  1203. when :weapons ; text = PC_Scene::Withdraw_Info
  1204. text = $bank.weapons[@main_com_wind.index] == nil ?
  1205. "" : $bank.weapons[@main_com_wind.index][0]
  1206. when :armors ; text = PC_Scene::Withdraw_Info
  1207. text = $bank.armors[@main_com_wind.index] == nil ?
  1208. "" : $bank.armors[@main_com_wind.index][0]
  1209. end
  1210. return if text = ""
  1211. @help_window.set_item(text)
  1212. end
  1213. #-----------------------------------------------------------------------------
  1214. #
  1215. #-----------------------------------------------------------------------------
  1216. def update_wind_type
  1217. if @main_com_wind.type != @action_com_wind_2.current_symbol
  1218. @main_com_wind.change_type(@action_com_wind_2.current_symbol)
  1219. @main_com_wind.refresh
  1220. end
  1221. if @bag_com_wind.type != @action_com_wind_2.current_symbol
  1222. @bag_com_wind.change_type(@action_com_wind_2.current_symbol)
  1223. @bag_com_wind.refresh
  1224. end
  1225. end
  1226. #-----------------------------------------------------------------------------
  1227. # Create Backgrounds
  1228. #-----------------------------------------------------------------------------
  1229. def get_all_bgs
  1230. return unless $D13x[:Scene_BGs]
  1231. @bg_set = PC_Scene::BGs
  1232. end
  1233. end
  1234. if Game_Storage::Menu_Access[0]
  1235. #===============================================================================
  1236. class Window_MenuCommand < Window_Command
  1237. #===============================================================================
  1238. #-----------------------------------------------------------------------------
  1239. #
  1240. #-----------------------------------------------------------------------------
  1241. alias :aoc_scene_bnk :add_original_commands
  1242. #-----------------------------------------------------------------------------
  1243. #
  1244. #-----------------------------------------------------------------------------
  1245. def add_original_commands
  1246. aoc_scene_bnk
  1247. add_bank_command
  1248. end
  1249. #-----------------------------------------------------------------------------
  1250. #
  1251. #-----------------------------------------------------------------------------
  1252. def add_bank_command
  1253. add_command(Game_Storage::Menu_Access[1],:game_bank)
  1254. end
  1255. end
  1256. #===============================================================================
  1257. class Scene_Menu < Scene_MenuBase
  1258. #===============================================================================
  1259. #-----------------------------------------------------------------------------
  1260. #
  1261. #-----------------------------------------------------------------------------
  1262. alias :ccw_scene_bank :create_command_window
  1263. #-----------------------------------------------------------------------------
  1264. #
  1265. #-----------------------------------------------------------------------------
  1266. def create_command_window
  1267. ccw_scene_bank
  1268. @command_window.set_handler(:game_bank, method(:open_bank))
  1269. end
  1270. #-----------------------------------------------------------------------------
  1271. #
  1272. #-----------------------------------------------------------------------------
  1273. def open_bank
  1274. SceneManager.call(Scene_BANK)
  1275. end
  1276. end
  1277. end# if Game_Storage::Menu_Access[0]
  1278. #==============================================================================#
  1279. # http://dekitarpg.wordpress.com/ #
  1280. #==============================================================================#
  1281. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement