Advertisement
Dekita

bank v1.2 ital

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