Advertisement
Dekita

bank ital 1.1

Mar 15th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.84 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.1
  3. ★ Perfect BANK™ ★
  4.  
  5. ================================================================================
  6. Informazioni dello Script:
  7. ====================
  8. Questo script semplicemente crea una scena "banca", puoi depositare / ritirare
  9. oggetti, armi, armature e denaro.
  10. Puoi anche settare la banca in modo di avere già, oggetti ect all'avvio del gioco.
  11.  
  12. ================================================================================
  13. ★☆★☆★☆★☆★☆★☆★☆★ TERMINI E CONDIZIONI: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  14. ================================================================================
  15. 1. Devi creditare "Dekita"
  16. 2. NON hai il permesso di ripostare questo script.(o versioni modificate)
  17. 3. NON hai il permesso di convertire questo script.(in altri tool e.g RGSS2)
  18. 4. NON hai il permesso di usare questo script per giochi commerciali.
  19. 5. DIVERTITI!
  20.  
  21. "STAMPA FINE"
  22. Usando questo script accetti i termini e le condizioni sopra riportate,
  23. se avviene qualsiasi violazione dei termini sopra, un'"azione legale" potrebbe essere presa.
  24. Non capendo i termini e le condizioni sopra NON significa che
  25. non si applichino a te.
  26. Se desideri discutere i termini e le condizioni in maggior dettaglio puoi
  27. contattarmi a http://dekitarpg.wordpress.com/ o via e-mail a DekitaRPG@gmail.com
  28.  
  29. ================================================================================
  30. Storia:
  31. =========
  32. G /M /A
  33. o6/o3/2o13 - Fissato bug (equipaggiamento scompare quando depositi),
  34. - Aggiunte opzioni sprintf txt per valuta e prefisso oro,
  35. 22/o1/2o13 - Ri-scritto Player PC (pokemon script), in una banca completa,
  36.  
  37. ================================================================================
  38. Crediti e Ringraziamenti a :
  39. =======================
  40.  
  41. ================================================================================
  42. Bug Noti:
  43. ============
  44. Incopatibilità Yanfly Shop Menu
  45. Incopatibilità Yanfly Item Menu
  46.  
  47. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  48. Se un nuovo bug viene trovato per favore contattami a
  49. http://dekitarpg.wordpress.com/
  50.  
  51. ================================================================================
  52. ISTRUZIONI:
  53. ==============
  54. Metti lo script SOTTO "▼ Materials" e SOPRA "▼ Main" nel tuo script editor.
  55.  
  56. ================================================================================
  57. Call Script :
  58. ==========
  59. $game_storage.gain_cash(amount)
  60. $game_storage.add_to_items(id, amount)
  61. $game_storage.add_to_weapons(id, amount)
  62. $game_storage.add_to_armors(id, amount)
  63.  
  64. I call script sopra *dovrebbero* essere abbastanza ovvi, sostituisci id con l'id
  65. dell'oggetto (trovato nel database). Sostituisci amount con la quantità che vuoi.
  66.  
  67. $scene=Scene_BANK
  68.  
  69. L'ultimo call script chiama la scena della banca in un evento.
  70. =end #=========================================================================#
  71. ##########################
  72. # INIZIO CUSTOMIZZAZIONE #
  73. ##########################
  74. module Game_Storage
  75.  
  76. Initial_CASH = 2000
  77.  
  78. # Formato = [ [item id, amount], [item id, amount] ]
  79. Initial_Items = [ [1, 1], [2, 2], [3, 3], [4, 4], [5, 4], [6, 4] ]
  80.  
  81. # Formato = Come Sopra.
  82. Initial_Weapons = [ [1, 1], [2, 2], [3, 3], [4, 4], [5, 4], [6, 4] ]
  83.  
  84. # Formato = Come Sopra.
  85. Initial_Armors = [ [1, 1], [2, 2], [3, 3], [4, 4], [5, 4], [6, 4] ]
  86.  
  87. end ; module PC_Scene # NON TOGLIERE QUESTA LINEA !!
  88.  
  89. Money_Vocab = "Money"
  90. Money_Prefix = "£ %s" # (mostra £ come valuta)
  91. Money_Align = :left
  92. Money_Icon = 361
  93.  
  94. Value_Prefix = "×%s" # (per mostrare la quantità degli oggetti selezionati)
  95.  
  96. Items_Vocab = "Items"
  97. Weapons_Vocab = "Weapons"
  98. Armors_Vocab = "Armors"
  99.  
  100. Current_Money_Vocab = "In Pocket :"
  101. Banked_Money_Vocab = "In Bank :"
  102.  
  103. Deposit_Vocab = "Deposit"
  104. Deposit_Info = "Deposit Money, Items or Equipment into your account."
  105. Deposit_Cash = "Deposit Money into your account."
  106. Deposit_Items = "Deposit Items into your account."
  107. Deposit_Weapons = "Deposit Weapons into your account."
  108. Deposit_Armors = "Deposit Armors into your account."
  109.  
  110. Withdraw_Vocab = "Withdraw"
  111. Withdraw_Info = "Withdraw Money, Items or Equipment from your account."
  112. Withdraw_Cash = "Withdraw Money from your account."
  113. Withdraw_Items = "Withdraw Items from your account."
  114. Withdraw_Weapons = "Withdraw Weapons into your account."
  115. Withdraw_Armors = "Withdraw Armors into your account."
  116.  
  117. # Se tieni premuto questo tasto, mentre sei nella schermata del NUMERO, incrementerà / diminuirà
  118. # la quantità della selezione più velocemente.
  119. Key = :SHIFT
  120.  
  121. end #######################
  122. # FINE CUSTOMIZZAZION #
  123. #######################
  124. #===============================================================================#
  125. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  126. # #
  127. # http://dekitarpg.wordpress.com/ #
  128. # #
  129. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  130. #===============================================================================#
  131. # STAI MODIFICANDO OLTRE QUESTO PUNTO? \.\. #
  132. # SI?\.\. #
  133. # OMG, VERAMENTE? \| #
  134. # BENE TIRAMI UNO SCHIAFFO IN FACCIA E CHIAMAMI DRAGONITE.\..\.. #
  135. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  136. #################################################################################
  137. # PC Scene Script 1 :~ Player PC Scene # http://dekitarpg.wordpress.com/ #
  138. #################################################################################
  139.  
  140. $imported = {} if $imported.nil?
  141. $imported[:Dekita_BANK] = true
  142.  
  143. #===============================================================================#
  144. class Window_Player_PC_Number < Window_ShopNumber #
  145. #===============================================================================#
  146.  
  147. def initialize(x, y)
  148. super(x, y, window_height)
  149. end
  150.  
  151. def window_width
  152. return Graphics.width / 2
  153. end
  154.  
  155. def window_height
  156. return line_height + 24
  157. end
  158.  
  159. def refresh
  160. contents.clear
  161. draw_the_item
  162. draw_number
  163. end
  164.  
  165. def draw_number
  166. change_color(normal_color)
  167. tx = sprintf(PC_Scene::Value_Prefix, @number)
  168. draw_text(0,0,window_width-(standard_padding*2), line_height, tx, 2)
  169. end
  170.  
  171. def draw_the_item
  172. if @item == $data_items[0]
  173. draw_icon(PC_Scene::Money_Icon, 0, item_y, true)
  174. draw_text(25, item_y, window_width, line_height, PC_Scene::Money_Vocab)
  175. else
  176. draw_item_name(@item, 0, item_y)
  177. end
  178. end
  179.  
  180. def item_y
  181. return 0
  182. end
  183.  
  184. def figures
  185. return 4
  186. end
  187.  
  188. def update_number
  189. if Input.press?(PC_Scene::Key)
  190. change_number(100) if Input.repeat?(:UP)
  191. change_number(-100) if Input.repeat?(:DOWN)
  192. change_number(10) if Input.repeat?(:RIGHT)
  193. change_number(-10) if Input.repeat?(:LEFT)
  194. else
  195. super
  196. end
  197. end
  198.  
  199. def update_cursor
  200. cursor_rect.set(0, 0, 0, 0)
  201. end
  202.  
  203. def change_number(amount)
  204. @number = [[@number + amount, @max].min, 0].max
  205. end
  206.  
  207. def set(item, max, price, currency_unit = nil)
  208. @item = item
  209. @max = max
  210. @price = price
  211. @currency_unit = currency_unit if currency_unit
  212. @number = @item == $data_items[0] ? 0 : 1
  213. refresh
  214. end
  215.  
  216. end
  217.  
  218. #==============================================================================
  219. class Window_PC_GOLD < Window_Gold
  220. #==============================================================================
  221.  
  222. def window_width
  223. return ((Graphics.width / 4 * 2))
  224. end
  225.  
  226. def refresh
  227. contents.clear
  228. draw_gold
  229. end
  230.  
  231. def draw_gold
  232. x = 0 ; y = 0
  233. change_color(normal_color)
  234. draw_text(x, y, window_width, line_height, PC_Scene::Current_Money_Vocab)
  235. # draw_text(x, y, window_width-24, line_height, unit + value.to_s, 2)
  236. draw_text(x, y, window_width-24, line_height, unit, 2)
  237. end
  238.  
  239. def unit
  240. sprintf(PC_Scene::Money_Prefix, value)
  241. # PC_Scene::Money_Prefix
  242. end
  243.  
  244. end
  245. #==============================================================================
  246. class Window_PC_GOLD_InBank < Window_PC_GOLD
  247. #==============================================================================
  248.  
  249. def draw_gold
  250. x = 0 ; y = 0
  251. change_color(normal_color)
  252. draw_text(x, y, window_width, line_height, PC_Scene::Banked_Money_Vocab)
  253. # draw_text(x, y, window_width-24, line_height, unit + value.to_s, 2)
  254. draw_text(x, y, window_width-24, line_height, unit, 2)
  255. end
  256.  
  257. def value
  258. $game_storage.cash
  259. end
  260.  
  261. end
  262.  
  263. #==============================================================================
  264. class Window_Player_PC_Command < Window_Command
  265. #==============================================================================
  266.  
  267. def initialize(x, y)
  268. super(x, y)
  269. draw_items_info
  270. type
  271. end
  272.  
  273. def change_type(type = :items)
  274. @type = type
  275. end
  276.  
  277. def type
  278. @type
  279. end
  280.  
  281. def window_width
  282. return Graphics.width - (Graphics.width / 4 * 2)
  283. end
  284.  
  285. def window_height
  286. return Graphics.height - fitting_height(6)
  287. end
  288.  
  289. def make_command_list
  290. case @type
  291. when :items
  292. for item in $game_storage.items
  293. add_item_command(item)
  294. end
  295. when :weapons
  296. for item in $game_storage.weapons
  297. add_item_command(item)
  298. end
  299. when :armors
  300. for item in $game_storage.armors
  301. add_item_command(item)
  302. end
  303. end
  304. end
  305.  
  306. def add_item_command(item)
  307. add_command("" , :avail_item, true)
  308. end
  309.  
  310. def draw_items_info
  311. x = 0 ; y = 0
  312. case @type
  313. when :items
  314. for item in $game_storage.items
  315. y = draw_infoo(x, y, item)
  316. end
  317. when :weapons
  318. for item in $game_storage.weapons
  319. y = draw_infoo(x, y, item)
  320. end
  321. when :armors
  322. for item in $game_storage.armors
  323. y = draw_infoo(x, y, item)
  324. end
  325. end
  326. end
  327.  
  328. def draw_infoo(x, y, item)
  329. draw_icon(item[0].icon_index, x, y, true)
  330. draw_text(x+25, y, window_width-50, line_height, item[0].name, 0)
  331. draw_text(x, y, window_width-25, line_height, "×#{item[1]} ", 2)
  332. return y + line_height
  333. end
  334.  
  335. def refresh
  336. super
  337. draw_items_info
  338. end
  339.  
  340. end
  341.  
  342. #==============================================================================
  343. class Window_Player_PC_Bag_Command < Window_Player_PC_Command
  344. #==============================================================================
  345.  
  346. def make_command_list
  347. case @type
  348. when :items
  349. for item in $game_party.items
  350. add_item_command(item)
  351. end
  352. when :weapons
  353. for item in $game_party.weapons
  354. add_item_command(item)
  355. end
  356. when :armors
  357. for item in $game_party.armors
  358. add_item_command(item)
  359. end
  360. end
  361. end
  362.  
  363. def add_item_command(item)
  364. add_command("" , :avail_item, true)
  365. end
  366.  
  367. def draw_items_info
  368. x = 0
  369. y = 0
  370. case @type
  371. when :items
  372. for item in $game_party.items
  373. y = draw_infoo(x, y, item)
  374. end
  375. when :weapons
  376. for item in $game_party.weapons
  377. y = draw_infoo(x, y, item)
  378. end
  379. when :armors
  380. for item in $game_party.armors
  381. y = draw_infoo(x, y, item)
  382. end
  383. end
  384. end
  385.  
  386. def draw_infoo(x, y, item)
  387. item_count = $game_party.item_number(item)
  388. draw_icon(item.icon_index, x, y, true)
  389. draw_text(x+25, y, window_width-50, line_height, item.name, 0)
  390. draw_text(x, y, window_width-25, line_height, "×#{item_count} ", 2)
  391. return y + line_height
  392. end
  393.  
  394. end
  395.  
  396. #==============================================================================
  397. class Window_Player_PC_Action_Command < Window_HorzCommand
  398. #==============================================================================
  399.  
  400. def window_width
  401. return Graphics.width
  402. end
  403.  
  404. def make_command_list
  405. add_command(PC_Scene::Deposit_Vocab, :deposit)
  406. add_command(PC_Scene::Withdraw_Vocab, :withdraw)
  407. end
  408.  
  409. def col_max
  410. return 2
  411. end
  412.  
  413. end
  414.  
  415. #==============================================================================
  416. class Window_Player_PC_Action_Command_2 < Window_Player_PC_Action_Command
  417. #==============================================================================
  418.  
  419. def make_command_list
  420. add_command(PC_Scene::Money_Vocab, :cash)
  421. add_command(PC_Scene::Items_Vocab, :items)
  422. add_command(PC_Scene::Weapons_Vocab, :weapons)
  423. add_command(PC_Scene::Armors_Vocab, :armors)
  424. end
  425.  
  426. def col_max
  427. return 4
  428. end
  429.  
  430. end
  431.  
  432. #==============================================================================
  433. class Scene_BANK < Scene_Base
  434. #==============================================================================
  435.  
  436. def start
  437. super
  438. create_help_window
  439. create_action_commands
  440. create_action_commands_2
  441. create_main_commands
  442. create_player_bag_commands
  443. create_number_window
  444. create_gold_window
  445. create_bankgold_window
  446. end
  447.  
  448. def create_help_window
  449. @help_window = Window_Help.new
  450. @help_window.viewport = @viewport
  451. end
  452.  
  453. def create_gold_window
  454. @gold_window = Window_PC_GOLD.new
  455. @gold_window.x = 0
  456. @gold_window.y = @action_com_wind.y + @action_com_wind.height
  457. end
  458.  
  459. def create_bankgold_window
  460. @bankgold_window = Window_PC_GOLD_InBank.new
  461. @bankgold_window.x = ((Graphics.width / 4 * 2))
  462. @bankgold_window.y = @action_com_wind.y + @action_com_wind.height
  463. end
  464.  
  465. def create_action_commands
  466. wx = 0
  467. wy = @help_window.height
  468. @action_com_wind = Window_Player_PC_Action_Command.new(wx, wy)
  469. @action_com_wind.set_handler(:deposit, method(:command_trigger_nxt_choice))
  470. @action_com_wind.set_handler(:withdraw, method(:command_trigger_nxt_choice))
  471. @action_com_wind.set_handler(:cancel, method(:return_scene))
  472. @my_current_symbol = :deposit
  473. end
  474.  
  475. def create_action_commands_2
  476. wx = 0
  477. wy = @help_window.height
  478. @action_com_wind_2 = Window_Player_PC_Action_Command_2.new(wx, wy)
  479. @action_com_wind_2.set_handler(:cash, method(:command_trigger_cash))
  480. @action_com_wind_2.set_handler(:items, method(:command_trigger_items))
  481. @action_com_wind_2.set_handler(:weapons, method(:command_trigger_weapons))
  482. @action_com_wind_2.set_handler(:armors, method(:command_trigger_armors))
  483. @action_com_wind_2.set_handler(:cancel, method(:command_back_to_firstchoice))
  484. @action_com_wind_2.deactivate
  485. @action_com_wind_2.select(-1)
  486. @action_com_wind_2.hide
  487. end
  488.  
  489. def create_main_commands
  490. wx = Graphics.width / 2
  491. wy = @action_com_wind.y + (@action_com_wind.height * 2)
  492. @main_com_wind = Window_Player_PC_Command.new(wx, wy)
  493. @main_com_wind.set_handler(:avail_item, method(:command_items))
  494. @main_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
  495. @main_com_wind.deactivate
  496. @main_com_wind.select(-1)
  497. end
  498.  
  499. def create_player_bag_commands
  500. wx = 0
  501. wy = @action_com_wind.y + (@action_com_wind.height * 2)
  502. @bag_com_wind = Window_Player_PC_Bag_Command.new(wx, wy)
  503. @bag_com_wind.set_handler(:avail_item, method(:command_items))
  504. @bag_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
  505. @bag_com_wind.deactivate
  506. @bag_com_wind.select(-1)
  507. end
  508.  
  509. def create_number_window
  510. wx = Graphics.width / 4
  511. wy = @action_com_wind.y + @action_com_wind.height
  512. @number_window = Window_Player_PC_Number.new(wx, wy)
  513. @number_window.viewport = @viewport
  514. @number_window.set_handler(:ok, method(:confirm_numbers))
  515. @number_window.set_handler(:cancel, method(:cancel_numbers))
  516. @number_window.hide
  517. end
  518.  
  519. def command_trigger_nxt_choice
  520. @action_com_wind.hide
  521. @action_com_wind_2.show
  522. @action_com_wind_2.activate
  523. @action_com_wind_2.select(0)
  524. end
  525.  
  526. def command_trigger_cash
  527. item = $data_items[0]
  528. case @action_com_wind.current_symbol
  529. when :deposit ; max = $game_party.gold
  530. price = $game_party.gold == 0 ? 0 : 1
  531. when :withdraw ; max = $game_storage.cash
  532. price = $game_storage.cash == 0 ? 0 : 1
  533. end
  534. @action_com_wind_2.deactivate
  535. @number_window.set(item, max, price)
  536. @number_window.open
  537. @number_window.activate
  538. @number_window.show
  539. end
  540.  
  541. def command_trigger_items
  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_weapons
  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_trigger_armors
  566. @action_com_wind_2.deactivate
  567. case @action_com_wind.current_symbol
  568. when :deposit
  569. @bag_com_wind.activate
  570. @bag_com_wind.select(0)
  571. when :withdraw
  572. @main_com_wind.activate
  573. @main_com_wind.select(0)
  574. end
  575. end
  576.  
  577. def command_back_to_firstchoice
  578. @action_com_wind_2.deactivate
  579. @action_com_wind_2.select(-1)
  580. @action_com_wind_2.hide
  581. @action_com_wind.show
  582. @action_com_wind.activate
  583. end
  584.  
  585. def command_back_to_2nd_choice
  586. @main_com_wind.deactivate
  587. @main_com_wind.select(-1)
  588. @bag_com_wind.deactivate
  589. @bag_com_wind.select(-1)
  590. @action_com_wind_2.activate
  591. end
  592.  
  593. def command_items
  594. case @action_com_wind_2.current_symbol
  595. when:items
  596. case @action_com_wind.current_symbol
  597. when :deposit
  598. item = $data_items[$game_party.items[@bag_com_wind.index].id]
  599. max = $game_party.item_number(item)
  600. when :withdraw
  601. item = $game_storage.items[@main_com_wind.index][0]
  602. max = $game_storage.items[@main_com_wind.index][1]
  603. end
  604. when :weapons
  605. case @action_com_wind.current_symbol
  606. when :deposit
  607. item = $data_weapons[$game_party.weapons[@bag_com_wind.index].id]
  608. max = $game_party.item_number(item)
  609. when :withdraw
  610. item = $game_storage.weapons[@main_com_wind.index][0]
  611. max = $game_storage.weapons[@main_com_wind.index][1]
  612. end
  613. when :armors
  614. case @action_com_wind.current_symbol
  615. when :deposit
  616. item = $data_armors[$game_party.armors[@bag_com_wind.index].id]
  617. max = $game_party.item_number(item)
  618. when :withdraw
  619. item = $game_storage.armors[@main_com_wind.index][0]
  620. max = $game_storage.armors[@main_com_wind.index][1]
  621. end
  622. end
  623. price = 1
  624. @number_window.set(item, max, price)
  625. @number_window.activate
  626. @number_window.show
  627. end
  628.  
  629. def confirm_numbers
  630. case @action_com_wind.current_symbol
  631. when :deposit
  632. case @action_com_wind_2.current_symbol
  633. when :cash
  634. deposit_cash(@number_window.number)
  635. @action_com_wind_2.activate
  636. when :items
  637. deposit_items(@number_window.number)
  638. @bag_com_wind.activate
  639. when :weapons
  640. deposit_weapons(@number_window.number)
  641. @bag_com_wind.activate
  642. when :armors
  643. deposit_armors(@number_window.number)
  644. @bag_com_wind.activate
  645. end
  646. when :withdraw
  647. case @action_com_wind_2.current_symbol
  648. when :cash
  649. withdraw_cash(@number_window.number)
  650. @action_com_wind_2.activate
  651. when :items
  652. withdraw_items(@number_window.number)
  653. @main_com_wind.activate
  654. when :weapons
  655. withdraw_weapons(@number_window.number)
  656. @main_com_wind.activate
  657. when :armors
  658. withdraw_armors(@number_window.number)
  659. @main_com_wind.activate
  660. end
  661. end
  662. @number_window.deactivate
  663. @number_window.hide
  664. end
  665.  
  666. def cancel_numbers
  667. case @action_com_wind.current_symbol
  668. when :deposit
  669. case @action_com_wind_2.current_symbol
  670. when :cash
  671. @action_com_wind_2.activate
  672. when :items, :weapons, :armors
  673. @bag_com_wind.activate
  674. end
  675. when :withdraw
  676. case @action_com_wind_2.current_symbol
  677. when :cash
  678. @action_com_wind_2.activate
  679. when :items, :weapons, :armors
  680. @main_com_wind.activate
  681. end
  682. end
  683. @number_window.deactivate
  684. @number_window.hide
  685. end
  686.  
  687. def deposit_cash(amount)
  688. $game_party.lose_gold(amount)
  689. $game_storage.gain_cash(amount)
  690. @gold_window.refresh
  691. @bankgold_window.refresh
  692. end
  693.  
  694. def withdraw_cash(amount)
  695. $game_party.gain_gold(amount)
  696. $game_storage.lose_cash(amount)
  697. @gold_window.refresh
  698. @bankgold_window.refresh
  699. end
  700.  
  701. def deposit_items(amount)
  702. inv_item = $game_party.items[@bag_com_wind.index].id
  703. $game_party.lose_item($data_items[inv_item], amount)
  704. already_had_item = false
  705. $game_storage.items.each {|item|
  706. item[1] += amount if item[0].id == inv_item
  707. already_had_item = true if item[0].id == inv_item ; }
  708. $game_storage.add_to_items(inv_item, amount) if !already_had_item
  709. @bag_com_wind.refresh
  710. @main_com_wind.refresh
  711. @bag_com_wind.activate
  712. end
  713.  
  714. def withdraw_items(amount)
  715. gsi = $game_storage.items[@main_com_wind.index]
  716. gsi[1] -= amount
  717. $game_party.gain_item(gsi[0], amount)
  718. if gsi[1] < 1
  719. $game_storage.items.delete_at(@main_com_wind.index)
  720. @main_com_wind.index = 0
  721. end
  722. @main_com_wind.refresh
  723. @bag_com_wind.refresh
  724. @main_com_wind.activate
  725. end
  726.  
  727. def deposit_weapons(amount)
  728. inv_item = $game_party.weapons[@bag_com_wind.index].id
  729. $game_party.lose_item($data_weapons[inv_item], amount)
  730. already_had_item = false
  731. $game_storage.weapons.each {|item|
  732. item[1] += amount if item[0].id == inv_item
  733. already_had_item = true if item[0].id == inv_item ; }
  734. $game_storage.add_to_weapons(inv_item, amount) if !already_had_item
  735. @bag_com_wind.refresh
  736. @main_com_wind.refresh
  737. @bag_com_wind.activate
  738. end
  739.  
  740. def withdraw_weapons(amount)
  741. gsi = $game_storage.weapons[@main_com_wind.index]
  742. gsi[1] -= amount
  743. $game_party.gain_item(gsi[0], amount)
  744. if gsi[1] < 1
  745. $game_storage.weapons.delete_at(@main_com_wind.index)
  746. @main_com_wind.index = 0
  747. end
  748. @main_com_wind.refresh
  749. @bag_com_wind.refresh
  750. @main_com_wind.activate
  751. end
  752.  
  753. def deposit_armors(amount)
  754. inv_item = $game_party.armors[@bag_com_wind.index].id
  755. $game_party.lose_item($data_armors[inv_item], amount)
  756. already_had_item = false
  757. $game_storage.items.each {|item|
  758. item[1] += amount if item[0].id == inv_item
  759. already_had_item = true if item[0].id == inv_item ; }
  760. $game_storage.add_to_armors(inv_item, amount) if !already_had_item
  761. @bag_com_wind.refresh
  762. @main_com_wind.refresh
  763. @bag_com_wind.activate
  764. end
  765.  
  766. def withdraw_armors(amount)
  767. gsi = $game_storage.armors[@main_com_wind.index]
  768. gsi[1] -= amount
  769. $game_party.gain_item(gsi[0], amount)
  770. if gsi[1] < 1
  771. $game_storage.armors.delete_at(@main_com_wind.index)
  772. @main_com_wind.index = 0
  773. end
  774. @main_com_wind.refresh
  775. @bag_com_wind.refresh
  776. @main_com_wind.activate
  777. end
  778.  
  779. def update
  780. super
  781. update_help_text
  782. update_wind_type
  783. end
  784.  
  785. def update_help_text
  786. if @action_com_wind.active
  787. update_text_one
  788. elsif @action_com_wind_2.active
  789. update_text_two
  790. elsif @main_com_wind.active
  791. update_text_three
  792. end
  793. end
  794.  
  795. def update_text_one
  796. text = @action_com_wind.current_symbol == :deposit ?
  797. PC_Scene::Deposit_Info : PC_Scene::Withdraw_Info
  798. @help_window.set_text(text)
  799. end
  800.  
  801. def update_text_two
  802. case @action_com_wind_2.current_symbol
  803. when :cash ;
  804. text = @action_com_wind.current_symbol == :deposit ?
  805. PC_Scene::Deposit_Cash : PC_Scene::Withdraw_Cash
  806. when :items ; text = PC_Scene::Withdraw_Info
  807. text = @action_com_wind.current_symbol == :deposit ?
  808. PC_Scene::Deposit_Items : PC_Scene::Withdraw_Items
  809. when :weapons ; text = PC_Scene::Withdraw_Info
  810. text = @action_com_wind.current_symbol == :deposit ?
  811. PC_Scene::Deposit_Weapons : PC_Scene::Withdraw_Weapons
  812. when :armors ; text = PC_Scene::Withdraw_Info
  813. text = @action_com_wind.current_symbol == :deposit ?
  814. PC_Scene::Deposit_Armors : PC_Scene::Withdraw_Armors
  815. end
  816. @help_window.set_text(text)
  817. end
  818.  
  819. def update_text_three
  820. case @action_com_wind_2.current_symbol
  821. # when :cash ;
  822. when :items ; text = PC_Scene::Withdraw_Info
  823. text = $game_storage.items[@main_com_wind.index] == nil ?
  824. "" : $game_storage.items[@main_com_wind.index][0]
  825. when :weapons ; text = PC_Scene::Withdraw_Info
  826. text = $game_storage.weapons[@main_com_wind.index] == nil ?
  827. "" : $game_storage.weapons[@main_com_wind.index][0]
  828. when :armors ; text = PC_Scene::Withdraw_Info
  829. text = $game_storage.armors[@main_com_wind.index] == nil ?
  830. "" : $game_storage.armors[@main_com_wind.index][0]
  831. end
  832. return if text = ""
  833. @help_window.set_item(text)
  834. end
  835.  
  836.  
  837. def update_wind_type
  838. if @main_com_wind.type != @action_com_wind_2.current_symbol
  839. @main_com_wind.change_type(@action_com_wind_2.current_symbol)
  840. @main_com_wind.refresh
  841. end
  842. if @bag_com_wind.type != @action_com_wind_2.current_symbol
  843. @bag_com_wind.change_type(@action_com_wind_2.current_symbol)
  844. @bag_com_wind.refresh
  845. end
  846. end
  847.  
  848. end
  849. #===============================================================================#
  850. # PC Scene Script 1(Player PC Scene) END #
  851. #===============================================================================#
  852. # http://dekitarpg.wordpress.com/ #
  853. #===============================================================================#
  854. module DataManager
  855. #===============================================================================#
  856.  
  857. class << self ;
  858. alias :cgo_game_storage :create_game_objects
  859. alias :msc_game_storage :make_save_contents
  860. alias :esc_game_storage :extract_save_contents
  861. end
  862.  
  863. def self.create_game_objects
  864. cgo_game_storage
  865. $game_storage = PC_Storage.new
  866. end
  867.  
  868. def self.make_save_contents
  869. contents = msc_game_storage
  870. contents[:game_storage] = $game_storage
  871. contents
  872. end
  873.  
  874. def self.extract_save_contents(contents)
  875. esc_game_storage(contents)
  876. $game_storage = contents[:game_storage]
  877. end
  878.  
  879. end
  880.  
  881. #==============================================================================
  882. class PC_Storage
  883. #==============================================================================
  884.  
  885. attr_reader :cash
  886. attr_reader :items
  887. attr_reader :weapons
  888. attr_reader :armors
  889.  
  890. def initialize
  891. setup
  892. end
  893.  
  894. def setup
  895. @cash = get_initial_stored_cash
  896. @items = get_initial_stored_items
  897. @weapons = get_initial_stored_weapons
  898. @armors = get_initial_stored_armors
  899. end
  900.  
  901. def get_initial_stored_cash
  902. Game_Storage::Initial_CASH
  903. end
  904.  
  905. def get_initial_stored_items
  906. items = []
  907. for item_info in Game_Storage::Initial_Items
  908. next if item_info[0] == nil || item_info[0] <= 0
  909. items.push([ $data_items[item_info[0]] , item_info[1] ])
  910. end
  911. items
  912. end
  913.  
  914. def get_initial_stored_weapons
  915. items = []
  916. for item_info in Game_Storage::Initial_Weapons
  917. next if item_info[0] == nil || item_info[0] <= 0
  918. items.push([ $data_weapons[item_info[0]] , item_info[1] ])
  919. end
  920. items
  921. end
  922.  
  923. def get_initial_stored_armors
  924. items = []
  925. for item_info in Game_Storage::Initial_Armors
  926. next if item_info[0] == nil || item_info[0] <= 0
  927. items.push([ $data_armors[item_info[0]] , item_info[1] ])
  928. end
  929. items
  930. end
  931.  
  932. def add_to_items(item_id, amount)
  933. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  934. @items.push([$data_items[item_id], amount])
  935. end
  936.  
  937. def add_to_weapons(item_id, amount)
  938. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  939. @weapons.push([$data_weapons[item_id], amount])
  940. end
  941.  
  942. def add_to_armors(item_id, amount)
  943. return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
  944. @armors.push([$data_armors[item_id], amount])
  945. end
  946.  
  947. def gain_cash(amount)
  948. @cash += amount
  949. end
  950.  
  951. def lose_cash(amount)
  952. @cash -= amount
  953. @cash = 0 if @cash < 0
  954. end
  955.  
  956. end
  957.  
  958. #===============================================================================#
  959. # - SCRIPT END - #
  960. #===============================================================================#
  961. # http://dekitarpg.wordpress.com/ #
  962. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement