Advertisement
Dekita

Bank

Jan 29th, 2013
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.75 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Perfect BANK™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This script simply creates a "bank" scene, you can deposit / withdraw
  9. items, weapons, armors and cash.
  10. You can also set the bank to already have items ect at the start of the game.
  11.  
  12. ================================================================================
  13. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  14. ================================================================================
  15. 1. You must give credit to "Dekita"
  16. 2. You are NOT allowed to repost this script.(or modified versions)
  17. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  18. 4. You are NOT allowed to use this script for Commercial games.
  19. 5. ENJOY!
  20.  
  21. "FINE PRINT"
  22. By using this script you hereby agree to the above terms and conditions,
  23. if any violation of the above terms occurs "legal action" may be taken.
  24. Not understanding the above terms and conditions does NOT mean that
  25. they do not apply to you.
  26. If you wish to discuss the terms and conditions in further detail you can
  27. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  28.  
  29. ================================================================================
  30. History:
  31. =========
  32. D /M /Y
  33. 22/o1/2o13 - Re-wired Player PC (pokemon script), into a full bank,
  34.  
  35. ================================================================================
  36. Credit and Thanks to :
  37. =======================
  38.  
  39. ================================================================================
  40. Known Bugs:
  41. ============
  42. N/A
  43.  
  44. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  45. If a new bug is found please contact me at
  46. http://dekitarpg.wordpress.com/
  47.  
  48. ================================================================================
  49. INSTRUCTIONS:
  50. ==============
  51. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  52.  
  53. ================================================================================
  54. Script Calls :
  55. ==========
  56. $game_storage.gain_cash(amount)
  57. $game_storage.add_to_items(id, amount)
  58. $game_storage.add_to_weapons(id, amount)
  59. $game_storage.add_to_armors(id, amount)
  60.  
  61. The above script calls *should* be fairly obvious, replace id with the id of
  62. the item (found in the database). replace amount with the amount you want.
  63.  
  64. SceneManager.call(Scene_BANK)
  65. This script call , calls the bank scene.
  66.  
  67. =end #=========================================================================#
  68. module Game_Storage
  69.  
  70. Initial_CASH = 2000
  71.  
  72. # Format = [ [item id, amount], [item id, amount] ]
  73. Initial_Items = [ [1, 1], [2, 2], [3, 3], [4, 4], [5, 4], [6, 4] ]
  74.  
  75. # Format = Same As Above.
  76. Initial_Weapons = [ [1, 1], [2, 2], [3, 3], [4, 4], [5, 4], [6, 4] ]
  77.  
  78. # Format = Same As Above.
  79. Initial_Armors = [ [1, 1], [2, 2], [3, 3], [4, 4], [5, 4], [6, 4] ]
  80.  
  81. end ; module PC_Scene # DO NOT DELETE THIS LINE !!
  82.  
  83. Money_Vocab = "Money"
  84. Money_Prefix = "£ "
  85. Money_Icon = 361
  86.  
  87. Items_Vocab = "Items"
  88. Weapons_Vocab = "Weapons"
  89. Armors_Vocab = "Armors"
  90.  
  91. Current_Money_Vocab = "In Pocket :"
  92. Banked_Money_Vocab = "In Bank :"
  93.  
  94. Deposit_Vocab = "Deposit"
  95. Deposit_Info = "Deposit Money, Items or Equipment into your account."
  96. Deposit_Cash = "Deposit Money into your account."
  97. Deposit_Items = "Deposit Items into your account."
  98. Deposit_Weapons = "Deposit Weapons into your account."
  99. Deposit_Armors = "Deposit Armors into your account."
  100.  
  101. Withdraw_Vocab = "Withdraw"
  102. Withdraw_Info = "Withdraw Money, Items or Equipment from your account."
  103. Withdraw_Cash = "Withdraw Money from your account."
  104. Withdraw_Items = "Withdraw Items from your account."
  105. Withdraw_Weapons = "Withdraw Weapons into your account."
  106. Withdraw_Armors = "Withdraw Armors into your account."
  107.  
  108. # If you hold this key, while on the NUMBER screen, it will increase / decrease
  109. # the selection amount faster.
  110. Key = :SHIFT
  111.  
  112. end #####################
  113. # CUSTOMISATION END #
  114. #####################
  115. #===============================================================================#
  116. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  117. # #
  118. # http://dekitarpg.wordpress.com/ #
  119. # #
  120. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  121. #===============================================================================#
  122. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  123. # YES?\.\. #
  124. # OMG, REALLY? \| #
  125. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  126. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  127. #################################################################################
  128. # PC Scene Script 1 :~ Player PC Scene # http://dekitarpg.wordpress.com/ #
  129. #################################################################################
  130.  
  131. $imported = {} if $imported.nil?
  132. $imported[:Dekita_BANK] = true
  133.  
  134. #===============================================================================#
  135. class Window_Player_PC_Number < Window_ShopNumber #
  136. #===============================================================================#
  137.  
  138. def initialize(x, y)
  139. super(x, y, window_height)
  140. end
  141.  
  142. def window_width
  143. return Graphics.width / 2
  144. end
  145.  
  146. def window_height
  147. return line_height + 24
  148. end
  149.  
  150. def refresh
  151. contents.clear
  152. draw_the_item
  153. draw_number
  154. end
  155.  
  156. def draw_number
  157. change_color(normal_color)
  158. draw_text(cursor_x - 28, item_y, 22, line_height, "×")
  159. draw_text(cursor_x, item_y, cursor_width - 4, line_height, @number, 2)
  160. end
  161.  
  162. def draw_the_item
  163. if @item == $data_items[0]
  164. draw_icon(PC_Scene::Money_Icon, 0, item_y, true)
  165. draw_text(25, item_y, window_width, line_height, PC_Scene::Money_Vocab)
  166. else
  167. draw_item_name(@item, 0, item_y)
  168. end
  169. end
  170.  
  171. def item_y
  172. return 0
  173. end
  174.  
  175. def figures
  176. return 4
  177. end
  178.  
  179. def update_number
  180. if Input.press?(PC_Scene::Key)
  181. change_number(100) if Input.repeat?(:UP)
  182. change_number(-100) if Input.repeat?(:DOWN)
  183. change_number(10) if Input.repeat?(:RIGHT)
  184. change_number(-10) if Input.repeat?(:LEFT)
  185. else
  186. super
  187. end
  188. end
  189.  
  190. def update_cursor
  191. cursor_rect.set(0, 0, 0, 0)
  192. end
  193.  
  194. def change_number(amount)
  195. @number = [[@number + amount, @max].min, 0].max
  196. end
  197.  
  198. def set(item, max, price, currency_unit = nil)
  199. @item = item
  200. @max = max
  201. @price = price
  202. @currency_unit = currency_unit if currency_unit
  203. @number = @item == $data_items[0] ? 0 : 1
  204. refresh
  205. end
  206.  
  207. end
  208.  
  209. #==============================================================================
  210. class Window_PC_GOLD < Window_Gold
  211. #==============================================================================
  212.  
  213. def window_width
  214. return ((Graphics.width / 4 * 2))
  215. end
  216.  
  217. def refresh
  218. contents.clear
  219. draw_gold
  220. end
  221.  
  222. def draw_gold
  223. x = 0 ; y = 0
  224. change_color(normal_color)
  225. draw_text(x, y, window_width, line_height, PC_Scene::Current_Money_Vocab)
  226. draw_text(x, y, window_width-24, line_height, unit + value.to_s, 2)
  227. end
  228.  
  229. def unit
  230. PC_Scene::Money_Prefix
  231. end
  232.  
  233. end
  234. #==============================================================================
  235. class Window_PC_GOLD_InBank < Window_PC_GOLD
  236. #==============================================================================
  237.  
  238. def draw_gold
  239. x = 0 ; y = 0
  240. change_color(normal_color)
  241. draw_text(x, y, window_width, line_height, PC_Scene::Banked_Money_Vocab)
  242. draw_text(x, y, window_width-24, line_height, unit + value.to_s, 2)
  243. end
  244.  
  245. def value
  246. $game_storage.cash
  247. end
  248.  
  249. end
  250.  
  251. #==============================================================================
  252. class Window_Player_PC_Command < Window_Command
  253. #==============================================================================
  254.  
  255. def initialize(x, y)
  256. super(x, y)
  257. draw_items_info
  258. type
  259. end
  260.  
  261. def change_type(type = :items)
  262. @type = type
  263. end
  264.  
  265. def type
  266. @type
  267. end
  268.  
  269. def window_width
  270. return Graphics.width - (Graphics.width / 4 * 2)
  271. end
  272.  
  273. def window_height
  274. return Graphics.height - fitting_height(6)
  275. end
  276.  
  277. def make_command_list
  278. case @type
  279. when :items
  280. for item in $game_storage.items
  281. add_item_command(item)
  282. end
  283. when :weapons
  284. for item in $game_storage.weapons
  285. add_item_command(item)
  286. end
  287. when :armors
  288. for item in $game_storage.armors
  289. add_item_command(item)
  290. end
  291. end
  292. end
  293.  
  294. def add_item_command(item)
  295. add_command("" , :avail_item, true)
  296. end
  297.  
  298. def draw_items_info
  299. x = 0 ; y = 0
  300. case @type
  301. when :items
  302. for item in $game_storage.items
  303. y = draw_infoo(x, y, item)
  304. end
  305. when :weapons
  306. for item in $game_storage.weapons
  307. y = draw_infoo(x, y, item)
  308. end
  309. when :armors
  310. for item in $game_storage.armors
  311. y = draw_infoo(x, y, item)
  312. end
  313. end
  314. end
  315.  
  316. def draw_infoo(x, y, item)
  317. draw_icon(item[0].icon_index, x, y, true)
  318. draw_text(x+25, y, window_width-50, line_height, item[0].name, 0)
  319. draw_text(x, y, window_width-25, line_height, "×#{item[1]} ", 2)
  320. return y + line_height
  321. end
  322.  
  323. def refresh
  324. super
  325. draw_items_info
  326. end
  327.  
  328. end
  329.  
  330. #==============================================================================
  331. class Window_Player_PC_Bag_Command < Window_Player_PC_Command
  332. #==============================================================================
  333.  
  334. def make_command_list
  335. case @type
  336. when :items
  337. for item in $game_party.items
  338. add_item_command(item)
  339. end
  340. when :weapons
  341. for item in $game_party.weapons
  342. add_item_command(item)
  343. end
  344. when :armors
  345. for item in $game_party.armors
  346. add_item_command(item)
  347. end
  348. end
  349. end
  350.  
  351. def add_item_command(item)
  352. add_command("" , :avail_item, true)
  353. end
  354.  
  355. def draw_items_info
  356. x = 0
  357. y = 0
  358. case @type
  359. when :items
  360. for item in $game_party.items
  361. y = draw_infoo(x, y, item)
  362. end
  363. when :weapons
  364. for item in $game_party.weapons
  365. y = draw_infoo(x, y, item)
  366. end
  367. when :armors
  368. for item in $game_party.armors
  369. y = draw_infoo(x, y, item)
  370. end
  371. end
  372. end
  373.  
  374. def draw_infoo(x, y, item)
  375. item_count = $game_party.item_number(item)
  376. draw_icon(item.icon_index, x, y, true)
  377. draw_text(x+25, y, window_width-50, line_height, item.name, 0)
  378. draw_text(x, y, window_width-25, line_height, "×#{item_count} ", 2)
  379. return y + line_height
  380. end
  381.  
  382. end
  383.  
  384. #==============================================================================
  385. class Window_Player_PC_Action_Command < Window_HorzCommand
  386. #==============================================================================
  387.  
  388. def window_width
  389. return Graphics.width
  390. end
  391.  
  392. def make_command_list
  393. add_command(PC_Scene::Deposit_Vocab, :deposit)
  394. add_command(PC_Scene::Withdraw_Vocab, :withdraw)
  395. end
  396.  
  397. def col_max
  398. return 2
  399. end
  400.  
  401. end
  402.  
  403. #==============================================================================
  404. class Window_Player_PC_Action_Command_2 < Window_Player_PC_Action_Command
  405. #==============================================================================
  406.  
  407. def make_command_list
  408. add_command(PC_Scene::Money_Vocab, :cash)
  409. add_command(PC_Scene::Items_Vocab, :items)
  410. add_command(PC_Scene::Weapons_Vocab, :weapons)
  411. add_command(PC_Scene::Armors_Vocab, :armors)
  412. end
  413.  
  414. def col_max
  415. return 4
  416. end
  417.  
  418. end
  419.  
  420. #==============================================================================
  421. class Scene_BANK < Scene_Base
  422. #==============================================================================
  423.  
  424. def start
  425. super
  426. create_help_window
  427. create_action_commands
  428. create_action_commands_2
  429. create_main_commands
  430. create_player_bag_commands
  431. create_number_window
  432. create_gold_window
  433. create_bankgold_window
  434. end
  435.  
  436. def create_help_window
  437. @help_window = Window_Help.new
  438. @help_window.viewport = @viewport
  439. end
  440.  
  441. def create_gold_window
  442. @gold_window = Window_PC_GOLD.new
  443. @gold_window.x = 0
  444. @gold_window.y = @action_com_wind.y + @action_com_wind.height
  445. end
  446.  
  447. def create_bankgold_window
  448. @bankgold_window = Window_PC_GOLD_InBank.new
  449. @bankgold_window.x = ((Graphics.width / 4 * 2))
  450. @bankgold_window.y = @action_com_wind.y + @action_com_wind.height
  451. end
  452.  
  453. def create_action_commands
  454. wx = 0
  455. wy = @help_window.height
  456. @action_com_wind = Window_Player_PC_Action_Command.new(wx, wy)
  457. @action_com_wind.set_handler(:deposit, method(:command_trigger_nxt_choice))
  458. @action_com_wind.set_handler(:withdraw, method(:command_trigger_nxt_choice))
  459. @action_com_wind.set_handler(:cancel, method(:return_scene))
  460. @my_current_symbol = :deposit
  461. end
  462.  
  463. def create_action_commands_2
  464. wx = 0
  465. wy = @help_window.height
  466. @action_com_wind_2 = Window_Player_PC_Action_Command_2.new(wx, wy)
  467. @action_com_wind_2.set_handler(:cash, method(:command_trigger_cash))
  468. @action_com_wind_2.set_handler(:items, method(:command_trigger_items))
  469. @action_com_wind_2.set_handler(:weapons, method(:command_trigger_weapons))
  470. @action_com_wind_2.set_handler(:armors, method(:command_trigger_armors))
  471. @action_com_wind_2.set_handler(:cancel, method(:command_back_to_firstchoice))
  472. @action_com_wind_2.deactivate
  473. @action_com_wind_2.select(-1)
  474. @action_com_wind_2.hide
  475. end
  476.  
  477. def create_main_commands
  478. wx = Graphics.width / 2
  479. wy = @action_com_wind.y + (@action_com_wind.height * 2)
  480. @main_com_wind = Window_Player_PC_Command.new(wx, wy)
  481. @main_com_wind.set_handler(:avail_item, method(:command_items))
  482. @main_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
  483. @main_com_wind.deactivate
  484. @main_com_wind.select(-1)
  485. end
  486.  
  487. def create_player_bag_commands
  488. wx = 0
  489. wy = @action_com_wind.y + (@action_com_wind.height * 2)
  490. @bag_com_wind = Window_Player_PC_Bag_Command.new(wx, wy)
  491. @bag_com_wind.set_handler(:avail_item, method(:command_items))
  492. @bag_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
  493. @bag_com_wind.deactivate
  494. @bag_com_wind.select(-1)
  495. end
  496.  
  497. def create_number_window
  498. wx = Graphics.width / 4
  499. wy = @action_com_wind.y + @action_com_wind.height
  500. @number_window = Window_Player_PC_Number.new(wx, wy)
  501. @number_window.viewport = @viewport
  502. @number_window.set_handler(:ok, method(:confirm_numbers))
  503. @number_window.set_handler(:cancel, method(:cancel_numbers))
  504. @number_window.hide
  505. end
  506.  
  507. def command_trigger_nxt_choice
  508. @action_com_wind.hide
  509. @action_com_wind_2.show
  510. @action_com_wind_2.activate
  511. @action_com_wind_2.select(0)
  512. end
  513.  
  514. def command_trigger_cash
  515. item = $data_items[0]
  516. case @action_com_wind.current_symbol
  517. when :deposit ; max = $game_party.gold
  518. price = $game_party.gold == 0 ? 0 : 1
  519. when :withdraw ; max = $game_storage.cash
  520. price = $game_storage.cash == 0 ? 0 : 1
  521. end
  522. @action_com_wind_2.deactivate
  523. @number_window.set(item, max, price)
  524. @number_window.open
  525. @number_window.activate
  526. @number_window.show
  527. end
  528.  
  529. def command_trigger_items
  530. @action_com_wind_2.deactivate
  531. case @action_com_wind.current_symbol
  532. when :deposit
  533. @bag_com_wind.activate
  534. @bag_com_wind.select(0)
  535. when :withdraw
  536. @main_com_wind.activate
  537. @main_com_wind.select(0)
  538. end
  539. end
  540.  
  541. def command_trigger_weapons
  542. @action_com_wind_2.deactivate
  543. case @action_com_wind.current_symbol
  544. when :deposit
  545. @bag_com_wind.activate
  546. @bag_com_wind.select(0)
  547. when :withdraw
  548. @main_com_wind.activate
  549. @main_com_wind.select(0)
  550. end
  551. end
  552.  
  553. def command_trigger_armors
  554. @action_com_wind_2.deactivate
  555. case @action_com_wind.current_symbol
  556. when :deposit
  557. @bag_com_wind.activate
  558. @bag_com_wind.select(0)
  559. when :withdraw
  560. @main_com_wind.activate
  561. @main_com_wind.select(0)
  562. end
  563. end
  564.  
  565. def command_back_to_firstchoice
  566. @action_com_wind_2.deactivate
  567. @action_com_wind_2.select(-1)
  568. @action_com_wind_2.hide
  569. @action_com_wind.show
  570. @action_com_wind.activate
  571. end
  572.  
  573. def command_back_to_2nd_choice
  574. @main_com_wind.deactivate
  575. @main_com_wind.select(-1)
  576. @bag_com_wind.deactivate
  577. @bag_com_wind.select(-1)
  578. @action_com_wind_2.activate
  579. end
  580.  
  581. def command_items
  582. case @action_com_wind_2.current_symbol
  583. when:items
  584. case @action_com_wind.current_symbol
  585. when :deposit
  586. item = $data_items[$game_party.items[@bag_com_wind.index].id]
  587. max = $game_party.item_number(item)
  588. when :withdraw
  589. item = $game_storage.items[@main_com_wind.index][0]
  590. max = $game_storage.items[@main_com_wind.index][1]
  591. end
  592. when :weapons
  593. case @action_com_wind.current_symbol
  594. when :deposit
  595. item = $data_weapons[$game_party.weapons[@bag_com_wind.index].id]
  596. max = $game_party.item_number(item)
  597. when :withdraw
  598. item = $game_storage.weapons[@main_com_wind.index][0]
  599. max = $game_storage.weapons[@main_com_wind.index][1]
  600. end
  601. when :armors
  602. case @action_com_wind.current_symbol
  603. when :deposit
  604. item = $data_armors[$game_party.armors[@bag_com_wind.index].id]
  605. max = $game_party.item_number(item)
  606. when :withdraw
  607. item = $game_storage.armors[@main_com_wind.index][0]
  608. max = $game_storage.armors[@main_com_wind.index][1]
  609. end
  610. end
  611. price = 1
  612. @number_window.set(item, max, price)
  613. @number_window.activate
  614. @number_window.show
  615. end
  616.  
  617. def confirm_numbers
  618. case @action_com_wind.current_symbol
  619. when :deposit
  620. case @action_com_wind_2.current_symbol
  621. when :cash
  622. deposit_cash(@number_window.number)
  623. @action_com_wind_2.activate
  624. when :items
  625. deposit_items(@number_window.number)
  626. @bag_com_wind.activate
  627. when :weapons
  628. deposit_weapons(@number_window.number)
  629. @bag_com_wind.activate
  630. when :armors
  631. deposit_armors(@number_window.number)
  632. @bag_com_wind.activate
  633. end
  634. when :withdraw
  635. case @action_com_wind_2.current_symbol
  636. when :cash
  637. withdraw_cash(@number_window.number)
  638. @action_com_wind_2.activate
  639. when :items
  640. withdraw_items(@number_window.number)
  641. @main_com_wind.activate
  642. when :weapons
  643. withdraw_weapons(@number_window.number)
  644. @main_com_wind.activate
  645. when :armors
  646. withdraw_armors(@number_window.number)
  647. @main_com_wind.activate
  648. end
  649. end
  650. @number_window.deactivate
  651. @number_window.hide
  652. end
  653.  
  654. def cancel_numbers
  655. case @action_com_wind.current_symbol
  656. when :deposit
  657. case @action_com_wind_2.current_symbol
  658. when :cash
  659. @action_com_wind_2.activate
  660. when :items, :weapons, :armors
  661. @bag_com_wind.activate
  662. end
  663. when :withdraw
  664. case @action_com_wind_2.current_symbol
  665. when :cash
  666. @action_com_wind_2.activate
  667. when :items, :weapons, :armors
  668. @main_com_wind.activate
  669. end
  670. end
  671. @number_window.deactivate
  672. @number_window.hide
  673. end
  674.  
  675. def deposit_cash(amount)
  676. $game_party.lose_gold(amount)
  677. $game_storage.gain_cash(amount)
  678. @gold_window.refresh
  679. @bankgold_window.refresh
  680. end
  681.  
  682. def withdraw_cash(amount)
  683. $game_party.gain_gold(amount)
  684. $game_storage.lose_cash(amount)
  685. @gold_window.refresh
  686. @bankgold_window.refresh
  687. end
  688.  
  689. def deposit_items(amount)
  690. inv_item = $game_party.items[@bag_com_wind.index].id
  691. $game_party.lose_item($data_items[inv_item], amount)
  692. already_had_item = false
  693. $game_storage.items.each {|item|
  694. item[1] += amount if item[0].id == inv_item
  695. already_had_item = true if item[0].id == inv_item ; }
  696. $game_storage.add_to_items(inv_item, amount) if !already_had_item
  697. @bag_com_wind.refresh
  698. @main_com_wind.refresh
  699. @bag_com_wind.activate
  700. end
  701.  
  702. def withdraw_items(amount)
  703. gsi = $game_storage.items[@main_com_wind.index]
  704. gsi[1] -= amount
  705. $game_party.gain_item(gsi[0], amount)
  706. if gsi[1] < 1
  707. $game_storage.items.delete_at(@main_com_wind.index)
  708. @main_com_wind.index -= 1
  709. end
  710. @main_com_wind.refresh
  711. @bag_com_wind.refresh
  712. @main_com_wind.activate
  713. end
  714.  
  715. def deposit_weapons(amount)
  716. inv_item = $game_party.weapons[@bag_com_wind.index].id
  717. $game_party.lose_item($data_weapons[inv_item], amount)
  718. already_had_item = false
  719. $game_storage.weapons.each {|item|
  720. item[1] += amount if item[0].id == inv_item
  721. already_had_item = true if item[0].id == inv_item ; }
  722. $game_storage.add_to_weapons(inv_item, amount) if !already_had_item
  723. @bag_com_wind.refresh
  724. @main_com_wind.refresh
  725. @bag_com_wind.activate
  726. end
  727.  
  728. def withdraw_weapons(amount)
  729. gsi = $game_storage.weapons[@main_com_wind.index]
  730. gsi[1] -= amount
  731. $game_party.gain_item(gsi[0], amount)
  732. if gsi[1] < 1
  733. $game_storage.weapons.delete_at(@main_com_wind.index)
  734. @main_com_wind.index -= 1
  735. end
  736. @main_com_wind.refresh
  737. @bag_com_wind.refresh
  738. @main_com_wind.activate
  739. end
  740.  
  741. def deposit_armors(amount)
  742. inv_item = $game_party.armors[@bag_com_wind.index].id
  743. $game_party.lose_item($data_armors[inv_item], amount)
  744. already_had_item = false
  745. $game_storage.items.each {|item|
  746. item[1] += amount if item[0].id == inv_item
  747. already_had_item = true if item[0].id == inv_item ; }
  748. $game_storage.add_to_armors(inv_item, amount) if !already_had_item
  749. @bag_com_wind.refresh
  750. @main_com_wind.refresh
  751. @bag_com_wind.activate
  752. end
  753.  
  754. def withdraw_armors(amount)
  755. gsi = $game_storage.armors[@main_com_wind.index]
  756. gsi[1] -= amount
  757. $game_party.gain_item(gsi[0], amount)
  758. if gsi[1] < 1
  759. $game_storage.armors.delete_at(@main_com_wind.index)
  760. @main_com_wind.index -= 1
  761. end
  762. @main_com_wind.refresh
  763. @bag_com_wind.refresh
  764. @main_com_wind.activate
  765. end
  766.  
  767. def update
  768. super
  769. update_help_text
  770. update_wind_type
  771. end
  772.  
  773. def update_help_text
  774. if @action_com_wind.active
  775. update_text_one
  776. elsif @action_com_wind_2.active
  777. update_text_two
  778. elsif @main_com_wind.active
  779. update_text_three
  780. end
  781. end
  782.  
  783. def update_text_one
  784. text = @action_com_wind.current_symbol == :deposit ?
  785. PC_Scene::Deposit_Info : PC_Scene::Withdraw_Info
  786. @help_window.set_text(text)
  787. end
  788.  
  789. def update_text_two
  790. case @action_com_wind_2.current_symbol
  791. when :cash ;
  792. text = @action_com_wind.current_symbol == :deposit ?
  793. PC_Scene::Deposit_Cash : PC_Scene::Withdraw_Cash
  794. when :items ; text = PC_Scene::Withdraw_Info
  795. text = @action_com_wind.current_symbol == :deposit ?
  796. PC_Scene::Deposit_Items : PC_Scene::Withdraw_Items
  797. when :weapons ; text = PC_Scene::Withdraw_Info
  798. text = @action_com_wind.current_symbol == :deposit ?
  799. PC_Scene::Deposit_Weapons : PC_Scene::Withdraw_Weapons
  800. when :armors ; text = PC_Scene::Withdraw_Info
  801. text = @action_com_wind.current_symbol == :deposit ?
  802. PC_Scene::Deposit_Armors : PC_Scene::Withdraw_Armors
  803. end
  804. @help_window.set_text(text)
  805. end
  806.  
  807. def update_text_three
  808. case @action_com_wind_2.current_symbol
  809. # when :cash ;
  810. when :items ; text = PC_Scene::Withdraw_Info
  811. text = $game_storage.items[@main_com_wind.index][0]
  812. when :weapons ; text = PC_Scene::Withdraw_Info
  813. text = $game_storage.weapons[@main_com_wind.index][0]
  814. when :armors ; text = PC_Scene::Withdraw_Info
  815. text = $game_storage.armors[@main_com_wind.index][0]
  816. end
  817. @help_window.set_item(text)
  818. end
  819.  
  820.  
  821. def update_wind_type
  822. if @main_com_wind.type != @action_com_wind_2.current_symbol
  823. @main_com_wind.change_type(@action_com_wind_2.current_symbol)
  824. @main_com_wind.refresh
  825. end
  826. if @bag_com_wind.type != @action_com_wind_2.current_symbol
  827. @bag_com_wind.change_type(@action_com_wind_2.current_symbol)
  828. @bag_com_wind.refresh
  829. end
  830. end
  831.  
  832. end
  833. #===============================================================================#
  834. # PC Scene Script 1(Player PC Scene) END #
  835. #===============================================================================#
  836. # http://dekitarpg.wordpress.com/ #
  837. #===============================================================================#
  838. module DataManager
  839. #===============================================================================#
  840.  
  841. class << self ;
  842. alias :cgo_game_storage :create_game_objects
  843. alias :msc_game_storage :make_save_contents
  844. alias :esc_game_storage :extract_save_contents
  845. end
  846.  
  847. def self.create_game_objects
  848. cgo_game_storage
  849. $game_storage = PC_Storage.new
  850. end
  851.  
  852. def self.make_save_contents
  853. contents = msc_game_storage
  854. contents[:game_storage] = $game_storage
  855. contents
  856. end
  857.  
  858. def self.extract_save_contents(contents)
  859. esc_game_storage(contents)
  860. $game_storage = contents[:game_storage]
  861. end
  862.  
  863. end
  864.  
  865. #==============================================================================
  866. class PC_Storage
  867. #==============================================================================
  868.  
  869. attr_reader :cash
  870. attr_reader :items
  871. attr_reader :weapons
  872. attr_reader :armors
  873.  
  874. def initialize
  875. setup
  876. end
  877.  
  878. def setup
  879. @cash = get_initial_stored_cash
  880. @items = get_initial_stored_items
  881. @weapons = get_initial_stored_weapons
  882. @armors = get_initial_stored_armors
  883. end
  884.  
  885. def get_initial_stored_cash
  886. Game_Storage::Initial_CASH
  887. end
  888.  
  889. def get_initial_stored_items
  890. items = []
  891. for item_info in Game_Storage::Initial_Items
  892. next if item_info[0] == nil || item_info[0] <= 0
  893. items.push([ $data_items[item_info[0]] , item_info[1] ])
  894. end
  895. items
  896. end
  897.  
  898. def get_initial_stored_weapons
  899. items = []
  900. for item_info in Game_Storage::Initial_Weapons
  901. next if item_info[0] == nil || item_info[0] <= 0
  902. items.push([ $data_weapons[item_info[0]] , item_info[1] ])
  903. end
  904. items
  905. end
  906.  
  907. def get_initial_stored_armors
  908. items = []
  909. for item_info in Game_Storage::Initial_Armors
  910. next if item_info[0] == nil || item_info[0] <= 0
  911. items.push([ $data_armors[item_info[0]] , item_info[1] ])
  912. end
  913. items
  914. end
  915.  
  916. def add_to_items(item_id, amount)
  917. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  918. @items.push([$data_items[item_id], amount])
  919. end
  920.  
  921. def add_to_weapons(item_id, amount)
  922. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  923. @items.push([$data_weapons[item_id], amount])
  924. end
  925.  
  926. def add_to_armors(item_id, amount)
  927. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  928. @items.push([$data_armors[item_id], amount])
  929. end
  930.  
  931. def gain_cash(amount)
  932. @cash += amount
  933. end
  934.  
  935. def lose_cash(amount)
  936. @cash -= amount
  937. @cash = 0 if @cash < 0
  938. end
  939.  
  940. end
  941.  
  942. #===============================================================================#
  943. # - SCRIPT END - #
  944. #===============================================================================#
  945. # http://dekitarpg.wordpress.com/ #
  946. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement