Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Bank Account
- # -- Author : Dekita
- # -- Version : 1.0
- # -- Level : Easy / Normal
- # -- Requires : N/A
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Bank_Account]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 17/o3/2o13 - Ported Script to $D13x Engine,
- # 1o/o3/2o13 - Added x position option for money icon and text,
- # o6/o3/2o13 - Fixed bug (equip vanish when deposit),
- # - Added sprintf txt options for value and gold prefix,
- # 22/o1/2o13 - Re-wired Player PC (pokemon script), into a full bank,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script simply creates a "bank" scene, you can deposit && withdraw
- # items, weapons, armors and cash.
- # You can also set the bank to already have items ect at the start of the game.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # $bank.gain_cash(amount)
- # $bank.lose_cash(amount)
- # $bank.add_to_items(id, amount)
- # $bank.add_to_weapons(id, amount)
- # $bank.add_to_armors(id, amount)
- #
- # The above script calls *should* be fairly obvious, replace id with the id of
- # the item (found in the database). replace amount with the amount you want.
- #
- # NOTE:
- # If using my $D13x Random Equip, the amount (for weapons and armors) will set
- # the tier, rather than the amount.
- #
- #===============================================================================
- module Game_Storage
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Initial_CASH = 2000
- #-----------------------------------------------------------------------------
- # Format = [ [item id, amount], [item id, amount] ]
- #-----------------------------------------------------------------------------
- Initial_Items = [ [1, 1], [2, 2] ]
- #-----------------------------------------------------------------------------
- # Format = Same As Above.
- #-----------------------------------------------------------------------------
- Initial_Weapons = [ [1, 1] ]
- #-----------------------------------------------------------------------------
- # Format = Same As Above.
- #-----------------------------------------------------------------------------
- Initial_Armors = [ [1, 1] ]
- Menu_Access = [true, 'Bank Account']
- end
- #===============================================================================
- module PC_Scene # DO NOT DELETE THIS LINE !!
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Money_Vocab = "Money"
- Money_Prefix = "%s Gold" # (shows as £ value)
- Money_Icon = 361
- # X position for money icon and text.
- Money_Icon_x = 0 # 60
- Money_Text_x = 25 # 0
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Value_Prefix = "×%s" # (for showing selected item amounts)
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Items_Vocab = "Items"
- Weapons_Vocab = "Weapons"
- Armors_Vocab = "Armors"
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Current_Money_Vocab = "In Pocket :"
- Banked_Money_Vocab = "In Bank :"
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Deposit_Vocab = "Deposit"
- Deposit_Info = "Deposit Money, Items or Equipment into your account."
- Deposit_Cash = "Deposit Money into your account."
- Deposit_Items = "Deposit Items into your account."
- Deposit_Weapons = "Deposit Weapons into your account."
- Deposit_Armors = "Deposit Armors into your account."
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Withdraw_Vocab = "Withdraw"
- Withdraw_Info = "Withdraw Money, Items or Equipment from your account."
- Withdraw_Cash = "Withdraw Money from your account."
- Withdraw_Items = "Withdraw Items from your account."
- Withdraw_Weapons = "Withdraw Weapons from your account."
- Withdraw_Armors = "Withdraw Armors from your account."
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- # If you hold this key, while on the NUMBER screen, it will increase / decrease
- # the selection amount faster.
- Key = :SHIFT
- #--------------------------------------------------------------------------
- # This option only works if using my $D13x Scene Backgrounds Script.
- # The background folder is set in the Scene BackGrounds script.
- #--------------------------------------------------------------------------
- BGs=[
- # ['NAME' , x, y, x scroll, y scroll, z, hue, init opac, max opac],
- ['Sunbeam_Overlay_by ShinGamix',0,0, 0, 0, 1, 0, 105, 255],
- ['ShinGamox_by ShinGamix',0,0, 0, 0, 1, 0, 105, 245],
- ['Fog_By_hyde' , 100, 100, 2, -2, 1, 0, 74, 125],
- ['$Dekita_II' , 0, 0, 1, 1, 2, 0, 0, 255],
- ]# << end
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Window Settings
- #--------------------------------------------------------------------------
- # This is where you set the windowskin for each window.
- # Simply put a # at the start of lines you want to keep the default
- # NOTE : This setting requires $D13x Window Skins Script.
- # The windowskin folder is set in the WindowSkins script also.
- #--------------------------------------------------------------------------
- Skins = ["PWI_Style_Blu", 0, 225] # ["Skin Name" , hue, opacity]
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- module DataManager
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- class << self ;
- alias :cgo_bank_account :create_game_objects
- alias :msc_bank_account :make_save_contents
- alias :esc_bank_account :extract_save_contents
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def self.create_game_objects
- cgo_bank_account
- $bank = Bank_Account.new
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def self.make_save_contents
- contents = msc_bank_account
- contents[:bank] = $bank
- contents
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def self.extract_save_contents(contents)
- esc_bank_account(contents)
- $bank = contents[:bank].nil? ? Bank_Account.new : contents[:bank]
- end
- end
- #==============================================================================
- class Bank_Account
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- include Game_Storage
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_reader :cash
- attr_reader :items
- attr_reader :weapons
- attr_reader :armors
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize
- init_pis
- get_initial_stored_items
- get_initial_stored_weapons
- get_initial_stored_armors
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def init_pis
- @cash = Initial_CASH
- @items = []
- @weapons = []
- @armors = []
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def get_initial_stored_items
- for info in Game_Storage::Initial_Items
- next if info[0] == nil || info[0] <= 0
- add_to_items(info[0], info[1])
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def get_initial_stored_weapons
- for info in Game_Storage::Initial_Weapons
- next if info[0] == nil || info[0] <= 0
- add_to_weapons(info[0], info[1])
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def get_initial_stored_armors
- for info in Game_Storage::Initial_Armors
- next if info[0] == nil || info[0] <= 0
- add_to_armors(info[0], info[1])
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_to_items(item_id, amount)
- return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
- @items.push([ $data_items[item_id] , amount ])
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_to_weapons(item_id, amount)
- return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
- if $D13x[:UniEquip]
- if $data_weapons[item_id].database_id == $data_weapons[item_id].id
- weapon = [Cloning_101.start_clone(:weapon,item_id,amount,true), 1]
- Cloning_101.delete_clone(:weapon, weapon[0].id)
- else
- weapon = [$data_weapons[item_id], 1]
- end
- else
- weapon = [$data_weapons[item_id], armount]
- end
- @weapons.push(weapon)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_to_armors(item_id, amount)
- return if item_id == nil || item_id <= 0 || amount == nil || amount <= 0
- if $D13x[:UniEquip]
- if $data_armors[item_id].database_id == $data_armors[item_id].id
- armor = [Cloning_101.start_clone(:armor,item_id,amount,true), 1]
- Cloning_101.delete_clone(:armor, armor[0].id)
- else
- armor = [$data_armors[item_id], 1]
- end
- else
- armor = [$data_armors[item_id],amount]
- end
- @armors.push(armor)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def gain_cash(amount)
- @cash += amount
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def lose_cash(amount)
- @cash -= amount
- @cash = 0 if @cash < 0
- end
- end
- #===============================================================================
- class Window_Player_PC_Number < Window_ShopNumber
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, window_height)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width / 2
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_height
- return line_height + 24
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_the_item
- draw_number
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_number
- change_color(normal_color)
- if @item
- change_color(@item.item_disp_color, true)
- end
- tx = sprintf(PC_Scene::Value_Prefix, @number)
- draw_text(0,0,window_width-(standard_padding*2), line_height, tx, 2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_the_item
- change_color(normal_color)
- x = PC_Scene::Money_Text_x
- ix = PC_Scene::Money_Icon_x
- y = item_y
- w = window_width
- if @item == $data_items[0]
- draw_icon(PC_Scene::Money_Icon, ix, y, true)
- draw_text(x, y, w, line_height, PC_Scene::Money_Vocab)
- else
- draw_icon(@item.icon_index, ix, y, true)
- change_color(@item.item_disp_color, true)
- draw_text(x, y, w, line_height, @item.name)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def item_y
- return 0
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def figures
- return 4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_number
- if Keys.press?(PC_Scene::Key)
- change_number(100) if Keys.trigger?(:UP)
- change_number(-100) if Keys.trigger?(:DOWN)
- change_number(10) if Keys.trigger?(:RIGHT)
- change_number(-10) if Keys.trigger?(:LEFT)
- else
- super
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_cursor
- cursor_rect.set(0, 0, 0, 0)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def change_number(amount)
- @number = [[@number + amount, @max].min, 0].max
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def set(item, max, price, currency_unit = nil)
- @item = item
- @max = max
- @price = price
- @currency_unit = currency_unit if currency_unit
- @number = @item == $data_items[0] ? 0 : 1
- refresh
- end
- #--------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #--------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #===============================================================================
- class Window_Bank_Help < Deki_Help
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #-----------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #==============================================================================
- class Window_PC_GOLD < Window_Gold
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return ((Graphics.width / 4 * 2))
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_gold
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_gold
- x = 0 ; y = 0
- change_color(normal_color)
- draw_text(x, y, window_width, line_height, PC_Scene::Current_Money_Vocab)
- draw_text(x, y, window_width-24, line_height, unit, 2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def unit
- sprintf(PC_Scene::Money_Prefix, value)
- end
- #--------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #--------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #==============================================================================
- class Window_PC_GOLD_InBank < Window_PC_GOLD
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_gold
- x = 0 ; y = 0
- change_color(normal_color)
- draw_text(x, y, window_width, line_height, PC_Scene::Banked_Money_Vocab)
- draw_text(x, y, window_width-24, line_height, unit, 2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def value
- $bank.cash
- end
- #--------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #--------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #==============================================================================
- class Window_Player_PC_Command < Window_Command
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y)
- draw_items_info
- type
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def change_type(type = :items)
- @type = type
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def type
- @type
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width - (Graphics.width / 4 * 2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_height
- return Graphics.height - fitting_height(6)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command_list
- case @type
- when :items
- for item in $bank.items
- add_item_command(item)
- end
- when :weapons
- for item in $bank.weapons
- add_item_command(item)
- end
- when :armors
- for item in $bank.armors
- add_item_command(item)
- end
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_item_command(item)
- add_command("" , :avail_item, true)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_items_info
- x = 0 ; y = 0
- case @type
- when :items
- for item in $bank.items
- y = draw_infoo(x, y, item)
- end
- when :weapons
- for item in $bank.weapons
- y = draw_infoo(x, y, item)
- end
- when :armors
- for item in $bank.armors
- y = draw_infoo(x, y, item)
- end
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_infoo(x, y, item)
- draw_icon(item[0].icon_index, x, y, true)
- change_color(item[0].item_disp_color)
- draw_text(x+25, y, window_width-50, line_height, item[0].name, 0)
- if $D13x[:UniEquip] && $D13x[:Equip_Levels] && item.is_a?(RPG::EquipItem)
- lv = Equip_Exp::Level_Names[item[0].level]
- draw_text(x, y, window_width-25, line_height, lv, 2)
- else
- draw_text(x, y, window_width-25, line_height, "×#{item[1]} ", 2)
- end
- return y + line_height
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh
- super
- draw_items_info
- end
- #--------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #--------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #==============================================================================
- class Window_Player_PC_Bag_Command < Window_Player_PC_Command
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command_list
- case @type
- when :items
- for item in $game_party.items
- add_item_command(item)
- end
- when :weapons
- for item in $game_party.weapons
- add_item_command(item)
- end
- when :armors
- for item in $game_party.armors
- add_item_command(item)
- end
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_item_command(item)
- add_command("" , :avail_item, true)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_items_info
- x = 0
- y = 0
- case @type
- when :items
- for item in $game_party.items
- y = draw_infoo(x, y, item)
- end
- when :weapons
- for item in $game_party.weapons
- y = draw_infoo(x, y, item)
- end
- when :armors
- for item in $game_party.armors
- y = draw_infoo(x, y, item)
- end
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_infoo(x, y, item)
- draw_icon(item.icon_index, x, y, true)
- change_color(item.item_disp_color)
- draw_text(x+25, y, window_width-50, line_height, item.name, 0)
- if $D13x[:UniEquip] && $D13x[:Equip_Levels] && item.is_a?(RPG::EquipItem)
- lv = Equip_Exp::Level_Names[item.level]
- draw_text(x, y, window_width-25, line_height, lv, 2)
- else
- item_count = $game_party.item_number(item)
- draw_text(x, y, window_width-25, line_height, "×#{item_count} ", 2)
- end
- return y + line_height
- end
- #--------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #--------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #==============================================================================
- class Window_Player_PC_Action_Command < Window_Command
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width/4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command_list
- add_command(PC_Scene::Deposit_Vocab, :deposit)
- add_command(PC_Scene::Withdraw_Vocab, :withdraw)
- end
- #--------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #--------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #==============================================================================
- class Window_Player_PC_Action_Command_2 < Window_HorzCommand
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command_list
- add_command(PC_Scene::Money_Vocab, :cash)
- add_command(PC_Scene::Items_Vocab, :items)
- add_command(PC_Scene::Weapons_Vocab, :weapons)
- add_command(PC_Scene::Armors_Vocab, :armors)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def col_max
- return 4
- end
- #--------------------------------------------------------------------------
- # Set Windowskin (overwrite from super)
- #--------------------------------------------------------------------------
- def set_the_skin
- @skin = PC_Scene::Skins
- end
- end
- #===============================================================================
- class Scene_BANK < Scene_MenuBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_action_commands
- create_action_commands_2
- create_main_commands
- create_player_bag_commands
- create_number_window
- create_gold_window
- create_bankgold_window
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Bank_Help.new
- @help_window.viewport = @viewport
- @help_window.x = Graphics.width / 4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_PC_GOLD.new
- @gold_window.x = 0
- @gold_window.y = @action_com_wind_2.y + @action_com_wind_2.height
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_bankgold_window
- @bankgold_window = Window_PC_GOLD_InBank.new
- @bankgold_window.x = ((Graphics.width / 4 * 2))
- @bankgold_window.y = @action_com_wind_2.y + @action_com_wind_2.height
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_action_commands
- wx = @help_window.x
- wy = @help_window.height
- @action_com_wind = Window_Player_PC_Action_Command.new(0, 0)
- @action_com_wind.set_handler(:deposit, method(:command_trigger_nxt_choice))
- @action_com_wind.set_handler(:withdraw, method(:command_trigger_nxt_choice))
- @action_com_wind.set_handler(:cancel, method(:return_scene))
- @my_current_symbol = :deposit
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_action_commands_2
- y = @help_window.height
- @action_com_wind_2 = Window_Player_PC_Action_Command_2.new(0, y)
- @action_com_wind_2.set_handler(:cash, method(:command_trigger_cash))
- @action_com_wind_2.set_handler(:items, method(:command_trigger_items))
- @action_com_wind_2.set_handler(:weapons, method(:command_trigger_weapons))
- @action_com_wind_2.set_handler(:armors, method(:command_trigger_armors))
- @action_com_wind_2.set_handler(:cancel, method(:command_back_to_firstchoice))
- @action_com_wind_2.deactivate
- @action_com_wind_2.select(-1)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_main_commands
- wx = Graphics.width / 2
- wy = @action_com_wind_2.y + (@action_com_wind_2.height * 2)
- @main_com_wind = Window_Player_PC_Command.new(wx, wy)
- @main_com_wind.set_handler(:avail_item, method(:command_items))
- @main_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
- @main_com_wind.deactivate
- @main_com_wind.select(-1)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_player_bag_commands
- wx = 0
- wy = @action_com_wind_2.y + (@action_com_wind_2.height * 2)
- @bag_com_wind = Window_Player_PC_Bag_Command.new(wx, wy)
- @bag_com_wind.set_handler(:avail_item, method(:command_items))
- @bag_com_wind.set_handler(:cancel, method(:command_back_to_2nd_choice))
- @bag_com_wind.deactivate
- @bag_com_wind.select(-1)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_number_window
- wx = Graphics.width / 4
- wy = @action_com_wind.y + @action_com_wind.height
- @number_window = Window_Player_PC_Number.new(wx, wy)
- @number_window.viewport = @viewport
- @number_window.set_handler(:ok, method(:confirm_numbers))
- @number_window.set_handler(:cancel, method(:cancel_numbers))
- @number_window.hide
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_trigger_nxt_choice
- @action_com_wind_2.activate
- @action_com_wind_2.select(0)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_trigger_cash
- item = $data_items[0]
- case @action_com_wind.current_symbol
- when :deposit ; max = $game_party.gold
- price = $game_party.gold == 0 ? 0 : 1
- when :withdraw ; max = $bank.cash
- price = $bank.cash == 0 ? 0 : 1
- end
- @action_com_wind_2.deactivate
- @number_window.set(item, max, price)
- @number_window.open
- @number_window.activate
- @number_window.show
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_trigger_items
- @action_com_wind_2.deactivate
- case @action_com_wind.current_symbol
- when :deposit
- @bag_com_wind.activate
- @bag_com_wind.select(0)
- when :withdraw
- @main_com_wind.activate
- @main_com_wind.select(0)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_trigger_weapons
- @action_com_wind_2.deactivate
- case @action_com_wind.current_symbol
- when :deposit
- @bag_com_wind.activate
- @bag_com_wind.select(0)
- when :withdraw
- @main_com_wind.activate
- @main_com_wind.select(0)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_trigger_armors
- @action_com_wind_2.deactivate
- case @action_com_wind.current_symbol
- when :deposit
- @bag_com_wind.activate
- @bag_com_wind.select(0)
- when :withdraw
- @main_com_wind.activate
- @main_com_wind.select(0)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_back_to_firstchoice
- @action_com_wind_2.deactivate
- @action_com_wind_2.select(-1)
- @action_com_wind.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_back_to_2nd_choice
- @main_com_wind.deactivate
- @main_com_wind.select(-1)
- @bag_com_wind.deactivate
- @bag_com_wind.select(-1)
- @action_com_wind_2.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_items
- case @action_com_wind_2.current_symbol
- when:items
- case @action_com_wind.current_symbol
- when :deposit
- item = $data_items[$game_party.items[@bag_com_wind.index].id]
- max = $game_party.item_number(item)
- when :withdraw
- item = $bank.items[@main_com_wind.index][0]
- max = $bank.items[@main_com_wind.index][1]
- end
- when :weapons
- case @action_com_wind.current_symbol
- when :deposit
- item = $data_weapons[$game_party.weapons[@bag_com_wind.index].id]
- max = $game_party.item_number(item)
- when :withdraw
- item = $bank.weapons[@main_com_wind.index][0]
- max = $bank.weapons[@main_com_wind.index][1]
- end
- when :armors
- case @action_com_wind.current_symbol
- when :deposit
- item = $data_armors[$game_party.armors[@bag_com_wind.index].id]
- max = $game_party.item_number(item)
- when :withdraw
- item = $bank.armors[@main_com_wind.index][0]
- max = $bank.armors[@main_com_wind.index][1]
- end
- end
- price = 1
- @number_window.set(item, max, price)
- @number_window.activate
- @number_window.show
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def confirm_numbers
- case @action_com_wind.current_symbol
- when :deposit
- case @action_com_wind_2.current_symbol
- when :cash
- deposit_cash(@number_window.number)
- @action_com_wind_2.activate
- when :items
- deposit_items(@number_window.number)
- @bag_com_wind.activate
- when :weapons
- deposit_weapons(@number_window.number)
- @bag_com_wind.activate
- when :armors
- deposit_armors(@number_window.number)
- @bag_com_wind.activate
- end
- when :withdraw
- case @action_com_wind_2.current_symbol
- when :cash
- withdraw_cash(@number_window.number)
- @action_com_wind_2.activate
- when :items
- withdraw_items(@number_window.number)
- @main_com_wind.activate
- when :weapons
- withdraw_weapons(@number_window.number)
- @main_com_wind.activate
- when :armors
- withdraw_armors(@number_window.number)
- @main_com_wind.activate
- end
- end
- @number_window.deactivate
- @number_window.hide
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def cancel_numbers
- case @action_com_wind.current_symbol
- when :deposit
- case @action_com_wind_2.current_symbol
- when :cash
- @action_com_wind_2.activate
- when :items, :weapons, :armors
- @bag_com_wind.activate
- end
- when :withdraw
- case @action_com_wind_2.current_symbol
- when :cash
- @action_com_wind_2.activate
- when :items, :weapons, :armors
- @main_com_wind.activate
- end
- end
- @number_window.deactivate
- @number_window.hide
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def deposit_cash(amount)
- $game_party.lose_gold(amount)
- $bank.gain_cash(amount)
- @gold_window.refresh
- @bankgold_window.refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def withdraw_cash(amount)
- $game_party.gain_gold(amount)
- $bank.lose_cash(amount)
- @gold_window.refresh
- @bankgold_window.refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def deposit_items(amount)
- inv_item = $game_party.items[@bag_com_wind.index].id
- $game_party.lose_item($data_items[inv_item], amount)
- already_had_item = false
- $bank.items.each {|item|
- item[1] += amount if item[0].id == inv_item
- already_had_item = true if item[0].id == inv_item ; }
- $bank.add_to_items(inv_item, amount) if !already_had_item
- @bag_com_wind.refresh
- @main_com_wind.refresh
- @bag_com_wind.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def withdraw_items(amount)
- gsi = $bank.items[@main_com_wind.index]
- gsi[1] -= amount
- $game_party.gain_item(gsi[0], amount)
- if gsi[1] < 1
- $bank.items.delete_at(@main_com_wind.index)
- @main_com_wind.index = 0
- end
- @main_com_wind.refresh
- @bag_com_wind.refresh
- @main_com_wind.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def deposit_weapons(amount)
- inv_item = $game_party.weapons[@bag_com_wind.index].id
- $game_party.lose_item($data_weapons[inv_item], amount)
- already_had_item = false
- $bank.weapons.each {|item|
- item[1] += amount if item[0].id == inv_item
- already_had_item = true if item[0].id == inv_item ; }
- $bank.add_to_weapons(inv_item, amount) if !already_had_item
- @bag_com_wind.refresh
- @main_com_wind.refresh
- @bag_com_wind.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def withdraw_weapons(amount)
- gsi = $bank.weapons[@main_com_wind.index]
- gsi[1] -= amount
- $game_party.gain_item(gsi[0], amount)
- if gsi[1] < 1
- $bank.weapons.delete_at(@main_com_wind.index)
- @main_com_wind.index = 0
- end
- @main_com_wind.refresh
- @bag_com_wind.refresh
- @main_com_wind.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def deposit_armors(amount)
- inv_item = $game_party.armors[@bag_com_wind.index].id
- $game_party.lose_item($data_armors[inv_item], amount)
- already_had_item = false
- $bank.items.each {|item|
- item[1] += amount if item[0].id == inv_item
- already_had_item = true if item[0].id == inv_item ; }
- $bank.add_to_armors(inv_item, amount) if !already_had_item
- @bag_com_wind.refresh
- @main_com_wind.refresh
- @bag_com_wind.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def withdraw_armors(amount)
- gsi = $bank.armors[@main_com_wind.index]
- gsi[1] -= amount
- $game_party.gain_item(gsi[0], amount)
- if gsi[1] < 1
- $bank.armors.delete_at(@main_com_wind.index)
- @main_com_wind.index = 0
- end
- @main_com_wind.refresh
- @bag_com_wind.refresh
- @main_com_wind.activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update
- super
- update_help_text
- update_wind_type
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_help_text
- if @action_com_wind.active
- update_text_one
- elsif @action_com_wind_2.active
- update_text_two
- elsif @main_com_wind.active
- update_text_three
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_text_one
- text = @action_com_wind.current_symbol == :deposit ?
- PC_Scene::Deposit_Info : PC_Scene::Withdraw_Info
- @help_window.set_text(text)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_text_two
- case @action_com_wind_2.current_symbol
- when :cash ;
- text = @action_com_wind.current_symbol == :deposit ?
- PC_Scene::Deposit_Cash : PC_Scene::Withdraw_Cash
- when :items ; text = PC_Scene::Withdraw_Info
- text = @action_com_wind.current_symbol == :deposit ?
- PC_Scene::Deposit_Items : PC_Scene::Withdraw_Items
- when :weapons ; text = PC_Scene::Withdraw_Info
- text = @action_com_wind.current_symbol == :deposit ?
- PC_Scene::Deposit_Weapons : PC_Scene::Withdraw_Weapons
- when :armors ; text = PC_Scene::Withdraw_Info
- text = @action_com_wind.current_symbol == :deposit ?
- PC_Scene::Deposit_Armors : PC_Scene::Withdraw_Armors
- end
- @help_window.set_text(text)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_text_three
- case @action_com_wind_2.current_symbol
- # when :cash ;
- when :items ; text = PC_Scene::Withdraw_Info
- text = $bank.items[@main_com_wind.index] == nil ?
- "" : $bank.items[@main_com_wind.index][0]
- when :weapons ; text = PC_Scene::Withdraw_Info
- text = $bank.weapons[@main_com_wind.index] == nil ?
- "" : $bank.weapons[@main_com_wind.index][0]
- when :armors ; text = PC_Scene::Withdraw_Info
- text = $bank.armors[@main_com_wind.index] == nil ?
- "" : $bank.armors[@main_com_wind.index][0]
- end
- return if text = ""
- @help_window.set_item(text)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_wind_type
- if @main_com_wind.type != @action_com_wind_2.current_symbol
- @main_com_wind.change_type(@action_com_wind_2.current_symbol)
- @main_com_wind.refresh
- end
- if @bag_com_wind.type != @action_com_wind_2.current_symbol
- @bag_com_wind.change_type(@action_com_wind_2.current_symbol)
- @bag_com_wind.refresh
- end
- end
- #-----------------------------------------------------------------------------
- # Create Backgrounds
- #-----------------------------------------------------------------------------
- def get_all_bgs
- return unless $D13x[:Scene_BGs]
- @bg_set = PC_Scene::BGs
- end
- end
- if Game_Storage::Menu_Access[0]
- #===============================================================================
- class Window_MenuCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :aoc_scene_bnk :add_original_commands
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_original_commands
- aoc_scene_bnk
- add_bank_command
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_bank_command
- add_command(Game_Storage::Menu_Access[1],:game_bank)
- end
- end
- #===============================================================================
- class Scene_Menu < Scene_MenuBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :ccw_scene_bank :create_command_window
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_command_window
- ccw_scene_bank
- @command_window.set_handler(:game_bank, method(:open_bank))
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def open_bank
- SceneManager.call(Scene_BANK)
- end
- end
- end# if Game_Storage::Menu_Access[0]
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement