Плохо! Плохо!:  0
Страница 1 из 2 12 ПоследняяПоследняя
Показано с 1 по 10 из 16

Тема: Bravo Storage System + Modified Version

  1. #1
    Супер-модератор Аватар для dirge
    Информация о пользователе
    Регистрация
    25.02.2013
    Сообщений
    924
    Репутация: 79 Добавить или отнять репутацию

    VX Ace Game Icon Bravo Storage System + Modified Version

    Bravo Storage System



    Автор: Bravo2Kilo
    Автор аддона: Dirge

    Описание:
    Собственно, название говорит само за себя, скрипт для хранения вещей. Мне нужен был такой скрипт, но он не до конца мне подходил. Так что я решил прокачать его.
    Модифицированная версия позволяет:
    - Устанавливать максимальное количество хранимых вещей
    - Окно доступного места в хранилище.
    - Скрипт стал более гибкий, теперь можно запрещать класть определенные вещи в хранилище и не только вещи, а целые категории предметов.
    Это основные изменения для тех кто уже знаком с данным скриптом. А так со всеми возможностями можно ознакомиться в шапке скрипта, переведенной на русский.
    Установка: Ниже Materials выше main, использование находится в шапке скрипта.

    Спойлер Скрины с оригинала:





    Спойлер Скрипт, Модифицированная версия:
    Код:
    #==============================================================================
    # Bravo Storage System (modified version)
    #------------------------------------------------------------------------------
    # Автор скрипта: Bravo2Kilo
    # Автор аддона: Dirge
    # Version: 2.0
    # Addon Version: 1.2
    #
    # Version History:
    #   v1.0 = Initial Release
    #   v1.1 = Fixed a bug and added some commands.
    #   v2.0 = Added the ability to have multiple storage containers.
    # Addon History:
    #   v1.0 = релиз, расширение возможностей скрипта, больше настроек. Русский перевод xD
    #   v1.1 = Добавлено больше всяких штук типа статистики хранилища.
    #   v1.2 = Правка некоторых багов и расширение допустимого кол-ва предметов в инвентаре.
    #==============================================================================
    # Заметки:
    #   Если category и gold выставлены в значение false - доступен только обмен 
    #   вещей. Если же category стоит false, а gold true, то в хранилище можно 
    #   будет положить только деньги.
    #==============================================================================
    # Для вызова хранилища используйте приведенный ниже скрипт(call script)
    #  open_storage("name", name_window, category, gold, free_slot)
    #    Где:
    #    "name" = имя хранилища
    #    name_window = (true или false) true - для показа имени хранилища на экране.
    #    category = (true или false)true - для показа категорий предметов, если 
    #    вы используете категории ОБЯЗАТЕЛЬНО перед open_storage вызовите allowed_category(скрипт который описан под этим). 
    #    gold = (true или false)true - для показа ячейки с золотом.
    #    free_slot = введите число свободного места в хранилище, поставьте 0, если вам это не нужно.
    #    По-умолчанию, не указывая name_window, category, gold, они устанавливаются на значение true, а free_slot = 0.
    #  
    # Если вы используете category в скрипте выше, то ОБЯЗАТЕЛЬНО перед ним 
    # вызовите этот(ОБЯЗАТЕЛЬНО, при каждом вызове open_storage с включенными категориями). 
    # Он позволяет определять какие категории предметов можно класть в данное хранилище.
    #  allowed_category(items, weapons, armors)
    #     Где:
    #     items = (true или false) категория - вещи, при true видна.
    #     weapons = (true или false) категория - оружие, при true видна.
    #     armors = (true или false) категория - броня, при true видна.
    # 
    # Для запрета внесения определенных вещей в определенное хранилище. 
    # Впишите, через запятую, ID-предметов с базы данных, доступны только вещи(броня
    # и оружие не поддерживается). Оставьте скобки пустыми, если запрещать нечего. 
    # ОБЯЗАТЕЛЬНО вызывать перед open_storage, если использовали хоть раз. Иначе 
    # старые настройки будут влиять и на другие хранилища.
    #  $not_allowed_items = []
    #
    # Для добавления\удаления определенного предмета в нужном хранилище в ручном режиме.
    #   storage_add_item("name", type, id, amount) - добавление
    #   storage_remove_item("name", type, id, amount) - удаление
    #     Где:
    #     "name" = имя хранилища
    #     type = тип предмета, может быть(:item, :weapon, :armor)
    #     id = id предмета в базе данных
    #     amount = количество
    #
    # Для удаления всех предметов из определенного хранилища
    #   clear_storage("name")
    #     "name" = имя хранилища
    #
    # Для получения количества определенного предмета в нужном хранилище.
    #   storage_item_number("name", type, id)
    #     "name" = имя хранилища
    #     type = тип предмета, может быть(:item, :weapon, :armor)
    #     id = id предмета в базе данных
    #
    # Для добавления\удаления золота из определенного хранилища
    #   storage_add_gold("name", amount) - добавление
    #   storage_remove_gold("name", amount) - удаление
    #     "name" = имя хранилища
    #     amount = количество
    #
    # Для получения количества золота в определенном хранилище.
    #   storage_gold_number("name")
    #     "name" = имя хранилища
    #
    # Если вы хотите установить максимальное количество определенного предмета в 
    # хранилищах, используйте этот тег в заметка к предмету. В противном случае 
    # будет использоваться значение по-умолчанию(ITEM_MAX) идущее ниже.
    #   <storagemax: X> где X = максимум.
    #==============================================================================
    module BRAVO_STORAGE
      
      # Показывать окно с количеством свободного места в хранилище true\false
      FREE_SLOTS_WINDOW = true
      
      # Максимальное количество предметов в стаке инвентаря.
      INV_ITEM_MAX = 99
      
      # Переменная максимально доступного количества предметов в хранилище
      ITEMS_MAX_VAR = 12
      
      # Назначте переключатель показывающий есть ли вещи в хранилище.
      # Переключатель включается, в случае, если в последнем открытом хранилище что-то есть.
      STORAGE_SWITCH = 69 # поставить 0 если вам это не нужно.
    
      # Максимальное количество определенного предмета в хранилище, это значение будет 
      # применено ко всем предметам, кроме тех у которых стоит тег <storagemax: X>
      # в базе данных игры.
      ITEM_MAX = 9999
      
      # Макс. количество золота которое может храниться в хранилище.
      GOLD_MAX = 9999999
      
      # Название команды для того, чтобы забрать вещи с хранилища.
      WITHDRAW_TEXT = "Забрать"
      
      # Название команды для того, чтобы положить вещи в хранилище.
      STORE_TEXT = "Положить"
      
      # Название команды для того, чтобы выйти с хранилища.
      CANCEL_TEXT = "Выход"
      
      # Обозначение денег вашей группы при обмене с хранилищем.
      PARTY_CUR_GOLD = "В кармане "
      
      # Обозначение денег находящихся в хранилище.
      STOR_CUR_GOLD = "В хранилище "
      
      # Обозначение статистики хранилища
      STORAGE_STAT = "В хранилище:"
      
      # Номер иконки денег для хранилища
      GOLD_ICON = 361
      
      # Номер иконки предметов для хранилища
      ITEMS_ICON = 270
      
      # Длина окна имени
      NAME_WIDTH = 160
      
      # Длина окна свободного места в хранилище
      FREE_SLOT_WIDTH = 120
      
      # 
      
      
    
    #==============================================================================
    # End of Configuration
    #==============================================================================
    end
    $imported ||= {}
    $imported[:Bravo_Storage] = true
    $not_allowed_items = []
    #==============================================================================
    # ** RPG::BaseItem
    #==============================================================================
    class RPG::BaseItem
      #--------------------------------------------------------------------------
      # * Item Storage Max
      #--------------------------------------------------------------------------
      def storage_max
        if @note =~ /<storagemax: (.*)>/i
          return $1.to_i
        else
          return BRAVO_STORAGE::ITEM_MAX
        end
      end
    
    end
    
    #==============================================================================
    # ** Game_Temp
    #==============================================================================
    
    class Game_Temp
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :storage_gold
      attr_accessor :storage_category
      attr_accessor :storage_name_window
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      alias bravo_storage_initialize initialize
      def initialize
        bravo_storage_initialize
        @storage_gold = true
        @storage_category = true
        @storage_name_window = true
      end
    end
    
    #==============================================================================
    # ** Game_Party
    #==============================================================================
    
    class Game_Party < Game_Unit
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :storage_name
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      alias bravo_storage_initialize initialize
      def initialize
        bravo_storage_initialize
        @storage_gold = {}
        @storage_items = {}
        @storage_weapons = {}
        @storage_armors = {}
        @storage_name = nil
      end
      #--------------------------------------------------------------------------
      # * Initialize Storage
      #--------------------------------------------------------------------------
      def init_storage(name)
        @storage_gold[name] ||= 0
        @storage_items[name] ||= {}
        @storage_weapons[name] ||= {}
        @storage_armors[name] ||= {}
      end
      #--------------------------------------------------------------------------
      # * Storage Name =
      #--------------------------------------------------------------------------
      def storage_name=(name)
        return if @storage_name == name
        @storage_name = name
        init_storage(name)
      end
      #--------------------------------------------------------------------------
      # * Clear Storage
      #--------------------------------------------------------------------------
      def clear_storage(name)
        @storage_gold[name] = 0
        @storage_items[name] = {}
        @storage_weapons[name] = {}
        @storage_armors[name] = {}
      end
      #--------------------------------------------------------------------------
      # * Get Item Object Array 
      #--------------------------------------------------------------------------
      def storage_items
        @storage_items[@storage_name].keys.sort.collect {|id| $data_items[id] }
      end
      #--------------------------------------------------------------------------
      # * Get Weapon Object Array 
      #--------------------------------------------------------------------------
      def storage_weapons
        @storage_weapons[@storage_name].keys.sort.collect {|id| $data_weapons[id] }
      end
      #--------------------------------------------------------------------------
      # * Get Armor Object Array 
      #--------------------------------------------------------------------------
      def storage_armors
        @storage_armors[@storage_name].keys.sort.collect {|id| $data_armors[id] }
      end
      #--------------------------------------------------------------------------
      # * Get Array of All Equipment Objects
      #--------------------------------------------------------------------------
      def storage_equip_items
        storage_weapons + storage_armors
      end
      #--------------------------------------------------------------------------
      # * Get Array of All Item Objects
      #--------------------------------------------------------------------------
      def storage_all_items
        storage_items + storage_equip_items
      end
      #--------------------------------------------------------------------------
      # * Get Container Object Corresponding to Item Class
      #--------------------------------------------------------------------------
      def storage_item_container(item_class)
        return @storage_items[@storage_name]   if item_class == RPG::Item
        return @storage_weapons[@storage_name] if item_class == RPG::Weapon
        return @storage_armors[@storage_name]  if item_class == RPG::Armor
        return nil
      end
      #--------------------------------------------------------------------------
      # * Storage Gold
      #--------------------------------------------------------------------------
      def storage_gold
        @storage_gold[@storage_name]
      end
      #--------------------------------------------------------------------------
      # * Increase Storage Gold
      #--------------------------------------------------------------------------
      def storage_gain_gold(amount)
        @storage_gold[@storage_name] = [[@storage_gold[@storage_name] + amount, 0].max, BRAVO_STORAGE::GOLD_MAX].min
      end
      #--------------------------------------------------------------------------
      # * Decrease Storage Gold
      #--------------------------------------------------------------------------
      def storage_lose_gold(amount)
        storage_gain_gold(-amount)
      end
      
      #--------------------------------------------------------------------------
      # * Get Number of All Items in Box
      #--------------------------------------------------------------------------
      def storage_all_items_in_box?(name)
        all_items_in_box = 0
        @storage_items[name].each_value {|i| all_items_in_box += i}
        @storage_weapons[name].each_value {|i| all_items_in_box += i}
        @storage_armors[name].each_value {|i| all_items_in_box += i}
        return all_items_in_box
      end
      
      #--------------------------------------------------------------------------
      # * Get Maximum Number of Items in Storage
      #--------------------------------------------------------------------------
      def storage_max_item_number(item)
        return item.storage_max
      end
      #--------------------------------------------------------------------------
      # * Determine if Maximum Number of Items Are Possessed
      #--------------------------------------------------------------------------
      def storage_item_max?(item)
        storage_item_number(item) >= storage_max_item_number(item)
      end
      
      #--------------------------------------------------------------------------
      # * Get Number of Items Possessed
      #--------------------------------------------------------------------------
      def storage_item_number(item)
        container = storage_item_container(item.class)
        container ? container[item.id] || 0 : 0
      end
      #--------------------------------------------------------------------------
      # * Increase/Decrease Storage Items
      #--------------------------------------------------------------------------
      def storage_gain_item(item, amount)
        container = storage_item_container(item.class)
        return unless container
        last_number = storage_item_number(item)
        new_number = last_number + amount
        container[item.id] = [[new_number, 0].max, storage_max_item_number(item)].min
        container.delete(item.id) if container[item.id] == 0
      end
      #--------------------------------------------------------------------------
      # * Remove Storage Items
      #--------------------------------------------------------------------------
      def storage_lose_item(item, amount)
        storage_gain_item(item, -amount)
      end
      
      def max_item_number(item)
        return BRAVO_STORAGE::INV_ITEM_MAX
      end
      
      
    end
    
    #==============================================================================
    # ** Game_Interpreter
    #==============================================================================
    
    class Game_Interpreter
    
      #--------------------------------------------------------------------------
      # * Open Storage Scene
      #--------------------------------------------------------------------------
      def open_storage(name, name_window = true, category = true, gold = true, free_slot = 0)
        $game_party.storage_name = name
        $game_temp.storage_name_window = name_window
        $game_temp.storage_category = category
        $game_temp.storage_gold = gold
        $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] = free_slot
        SceneManager.call(Scene_Storage)
      end
      
      #--------------------------------------------------------------------------
      # * allowed_category
      #--------------------------------------------------------------------------
      
      def allowed_category(items = true, weapons = true, armors = true)
        $allow_items = items
        $allow_weapons = weapons
        $allow_armors = armors
      end
      
      #--------------------------------------------------------------------------
      # * Clear Storage
      #--------------------------------------------------------------------------
      def clear_storage(name)
        $game_party.clear_storage(name)
      end
      #--------------------------------------------------------------------------
      # * Storage Add Item
      #--------------------------------------------------------------------------
      def storage_add_item(name, type, id, amount)
        $game_party.storage_name = name
        case type
        when :item
          item = $data_items[id]
        when :weapon
          item = $data_weapons[id]
        when :armor
          item = $data_armors[id]
        end
        $game_party.storage_gain_item(item, amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Remove Item
      #--------------------------------------------------------------------------
      def storage_remove_item(name, type, id, amount)
        $game_party.storage_name = name
        case type
        when :item
          item = $data_items[id]
        when :weapon
          item = $data_weapons[id]
        when :armor
          item = $data_armors[id]
        end
        $game_party.storage_lose_item(item, amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Item Number
      #--------------------------------------------------------------------------
      def storage_item_number(name, type, id)
        $game_party.storage_name = name
        case type
        when :item
          item = $data_items[id]
        when :weapon
          item = $data_weapons[id]
        when :armor
          item = $data_armors[id]
        end
        $game_party.storage_item_number(item)
      end
      
      def storage_all_items_in_box(name)
        return $game_party.storage_all_items_in_box?(name)
      end
      
      #--------------------------------------------------------------------------
      # * Storage Add Gold
      #--------------------------------------------------------------------------
      def storage_add_gold(name, amount)
        $game_party.storage_name = name
        $game_party.storage_gain_gold(amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Remove Gold
      #--------------------------------------------------------------------------
      def storage_remove_gold(name, amount)
        $game_party.storage_name = name
        $game_party.storage_lose_gold(amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Gold Number
      #--------------------------------------------------------------------------
      def storage_gold_number(name)
        $game_party.storage_name = name
        $game_party.storage_gold
      end
    end
    
    #==============================================================================
    # ** Window_StorageCategory
    #==============================================================================
    
    $allow_items = true
    $allow_weapons = true
    $allow_armors = true
    
    class Window_StorageCategory < Window_ItemCategory
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(gold)
        @gold = gold
        super()
        $allow_items = true
        $allow_weapons = true
        $allow_armors = true
      end
      #--------------------------------------------------------------------------
      # * Get Digit Count
      #--------------------------------------------------------------------------
      def col_max
        if @gold == true
          return 4
        else
          return 3
        end
      end
      #--------------------------------------------------------------------------
      # * Create Command List
      #--------------------------------------------------------------------------
      def make_command_list
        add_command(Vocab::item, :item) if $allow_items == true
        add_command(Vocab::weapon, :weapon) if $allow_weapons == true
        add_command(Vocab::armor, :armor) if $allow_armors == true
        add_command(Vocab::currency_unit, :gold) if @gold == true
      end
    end
    
    #==============================================================================
    # ** Window_ItemList
    #------------------------------------------------------------------------------
    #  This window displays a list of party items on the item screen.
    #==============================================================================
    
    class Window_StorageItemList < Window_ItemList
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x, y, width, height)
        super(x, y, width, height)
        @storage = :none
      end
      #--------------------------------------------------------------------------
      # * Set Storage Flag
      #--------------------------------------------------------------------------
      def storage=(storage)
        return if @storage == storage
        @storage = storage
        refresh
        self.oy = 0
      end
      #--------------------------------------------------------------------------
      # * Include in Item List?
      #--------------------------------------------------------------------------
      def include?(item)
        case @category
        when :item
          item.is_a?(RPG::Item)
        when :weapon
          item.is_a?(RPG::Weapon)
        when :armor
          item.is_a?(RPG::Armor)
        when :all
          item
        else
          false
        end
      end
      
      #--------------------------------------------------------------------------
      # * Display in Enabled State?
      #--------------------------------------------------------------------------
      def enable?(item)
        if item.is_a?(RPG::Item)
          $not_allowed_items.each do |items_id|
            return false if item.id == items_id
          end
          case @storage
          when :store
            box_name = $game_party.storage_name 
            return false if $game_party.storage_item_number(item) >= $game_party.storage_max_item_number(item)
            if $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR]  > 0
              return false if $game_party.storage_all_items_in_box?(box_name) >= $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR]
            end
          when :withdraw
            box_name = $game_party.storage_name
            return false if $game_party.item_number(item) == $game_party.max_item_number(item)
          end
          return true if !item.key_item?
        elsif item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
          case @storage
          when :store
            box_name = $game_party.storage_name 
            return false if $game_party.storage_item_number(item) >= $game_party.storage_max_item_number(item)
            if $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] > 0
              return false if $game_party.storage_all_items_in_box?(box_name) >= $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR]
            end
          end
          return true
        else
          return false
        end
      end
      #--------------------------------------------------------------------------
      # * Create Item List
      #--------------------------------------------------------------------------
      def make_item_list
        case @storage
        when :store
          @data = $game_party.all_items.select {|item| include?(item) }
          @data.push(nil) if include?(nil)
        when :withdraw
          @data = $game_party.storage_all_items.select {|item| include?(item) }
          @data.push(nil) if include?(nil)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Number of Items
      #--------------------------------------------------------------------------
      def draw_item_number(rect, item)
        case @storage
        when :store
          draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
        when :withdraw
          draw_text(rect, sprintf(":%2d", $game_party.storage_item_number(item)), 2)
        end
      end
    end
    
    #==============================================================================
    # ** Window_StorageCommand
    #==============================================================================
    
    class Window_StorageCommand < Window_HorzCommand
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0)
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        if $game_temp.storage_name_window == false
          return Graphics.width
        else
          Graphics.width - BRAVO_STORAGE::NAME_WIDTH
        end
      end
      #--------------------------------------------------------------------------
      # * Get Digit Count
      #--------------------------------------------------------------------------
      def col_max
        return 3
      end
      #--------------------------------------------------------------------------
      # * Create Command List
      #--------------------------------------------------------------------------
      def make_command_list
        add_command(BRAVO_STORAGE::WITHDRAW_TEXT, :withdraw)
        add_command(BRAVO_STORAGE::STORE_TEXT, :store)
        add_command(BRAVO_STORAGE::CANCEL_TEXT, :cancel)
      end
    end
    
    #==============================================================================
    # ** Window_StorageName
    #==============================================================================
    class Window_StorageName < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, fitting_height(1))
        refresh
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return BRAVO_STORAGE::NAME_WIDTH
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        name = $game_party.storage_name
        draw_text(0, 0, window_width, line_height, name)
      end
      #--------------------------------------------------------------------------
      # * Open Window
      #--------------------------------------------------------------------------
      def open
        refresh
        super
      end
    end
    
    #==============================================================================
    # ** Window_StorageNumber
    #==============================================================================
    
    class Window_StorageNumber < Window_Selectable
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :number                   # quantity entered
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, window_height) 
        @item = nil
        @max = 1
        @number = 1
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return 304
      end
      #--------------------------------------------------------------------------
      # * Get Window Height
      #--------------------------------------------------------------------------
      def window_height
        return 48
      end
      #--------------------------------------------------------------------------
      # * Set Item, Max Quantity
      #--------------------------------------------------------------------------
      def set(item, max)
        @item = item
        @max = max
        @number = 1
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        draw_item_name(@item, 0, 0)
        draw_number
      end
      #--------------------------------------------------------------------------
      # * Draw Quantity
      #--------------------------------------------------------------------------
      def draw_number
        change_color(normal_color)
        draw_text(cursor_x - 28, 0, 22, line_height, "×")
        draw_text(cursor_x, 0, cursor_width - 4, line_height, @number, 2)
      end
      #--------------------------------------------------------------------------
      # * Get Cursor Width
      #--------------------------------------------------------------------------
      def cursor_width
        figures * 10 + 12
      end
      #--------------------------------------------------------------------------
      # * Get X Coordinate of Cursor
      #--------------------------------------------------------------------------
      def cursor_x
        contents_width - cursor_width - 4
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Number of Digits for Quantity Display
      #--------------------------------------------------------------------------
      def figures
        return 2
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        if active
          last_number = @number
          update_number
          if @number != last_number
            Sound.play_cursor
            refresh
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Update Quantity
      #--------------------------------------------------------------------------
      def update_number
        change_number(1)   if Input.repeat?(:RIGHT)
        change_number(-1)  if Input.repeat?(:LEFT)
        change_number(10)  if Input.repeat?(:UP)
        change_number(-10) if Input.repeat?(:DOWN)
      end
      #--------------------------------------------------------------------------
      # * Change Quantity
      #--------------------------------------------------------------------------
      def change_number(amount)
        @number = [[@number + amount, @max].min, 1].max
      end
      #--------------------------------------------------------------------------
      # * Update Cursor
      #--------------------------------------------------------------------------
      def update_cursor
        cursor_rect.set(cursor_x, 0, cursor_width, line_height)
      end
    end
    
    #==============================================================================
    # ** Window_GoldTransfer
    #==============================================================================
    
    class Window_GoldTransfer < Window_Selectable
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :number                   # quantity entered
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, window_height) 
        @item = nil
        @max = 1
        @number = 1
        @cursor_y = 0
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return 330
      end
      #--------------------------------------------------------------------------
      # * Get Window Height
      #--------------------------------------------------------------------------
      def window_height
        return 72
      end
      #--------------------------------------------------------------------------
      # * Set Item, Max Quantity
      #--------------------------------------------------------------------------
      def set(max, position)
        @max = max
        @number = 1
        @cursor_y = position
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        draw_gold_info
        draw_number
      end
      #--------------------------------------------------------------------------
      # * Display in Enabled State?
      #--------------------------------------------------------------------------
      def enabled?
        if @cursor_y == 0
          return true if $game_party.gold > 0
        else
          return true if $game_party.storage_gold > 0
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Processing When OK Button Is Pressed
      #--------------------------------------------------------------------------
      def process_ok
        if enabled?
          Sound.play_ok
          Input.update
          deactivate
          call_ok_handler
        else
          Sound.play_buzzer
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Gold Info
      #--------------------------------------------------------------------------
      def draw_gold_info
        party = BRAVO_STORAGE::PARTY_CUR_GOLD + Vocab::currency_unit + " :"
        storage = BRAVO_STORAGE::STOR_CUR_GOLD + Vocab::currency_unit + " :"
        draw_text(0, 0, 280, line_height, party)
        draw_text(0, 24, 280, line_height, storage)
        draw_text(0, 0, 225, line_height, $game_party.gold, 2)
        draw_text(0, 24, 225, line_height, $game_party.storage_gold, 2)
      end
      #--------------------------------------------------------------------------
      # * Draw Quantity
      #--------------------------------------------------------------------------
      def draw_number
        change_color(normal_color)
        draw_text(cursor_x - 28, @cursor_y, 22, line_height, "×")
        draw_text(cursor_x, @cursor_y, cursor_width - 4, line_height, @number, 2)
      end
      #--------------------------------------------------------------------------
      # * Get Cursor Width
      #--------------------------------------------------------------------------
      def cursor_width
        figures * 10 + 12
      end
      #--------------------------------------------------------------------------
      # * Get X Coordinate of Cursor
      #--------------------------------------------------------------------------
      def cursor_x
        contents_width - cursor_width - 4
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Number of Digits for Quantity Display
      #--------------------------------------------------------------------------
      def figures
        return 3
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        if active
          last_number = @number
          update_number
          if @number != last_number
            Sound.play_cursor
            refresh
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Update Quantity
      #--------------------------------------------------------------------------
      def update_number
        change_number(1)   if Input.repeat?(:RIGHT)
        change_number(-1)  if Input.repeat?(:LEFT)
        change_number(10)  if Input.repeat?(:UP)
        change_number(-10) if Input.repeat?(:DOWN)
      end
      #--------------------------------------------------------------------------
      # * Change Quantity
      #--------------------------------------------------------------------------
      def change_number(amount)
        @number = [[@number + amount, @max].min, 1].max
      end
      #--------------------------------------------------------------------------
      # * Update Cursor
      #--------------------------------------------------------------------------
      def update_cursor
        @cursor_y ||= 0
        cursor_rect.set(cursor_x, @cursor_y, cursor_width, line_height)
      end
    end
    
    
    #==============================================================================
    # ** Window_FreeSlots
    #==============================================================================
    
    
    class Window_FreeSlots < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, fitting_height(1))
        refresh
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return BRAVO_STORAGE::FREE_SLOT_WIDTH
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        box_name = $game_party.storage_name 
        items_info = $game_party.storage_all_items_in_box?(box_name).to_s + "/" + $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR].to_s
        draw_text(0, 0, window_width, line_height, items_info) 
      end
      #--------------------------------------------------------------------------
      # * Open Window
      #--------------------------------------------------------------------------
      def open
        refresh
        super
      end
    end
    
    class Window_StorageInfo < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, fitting_height(3))
        self.opacity = 0
        refresh
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return Graphics.width / 2
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        box_name = $game_party.storage_name 
        draw_text(0, 0, window_width, line_height, BRAVO_STORAGE::STORAGE_STAT)
        gold_info = $game_party.storage_gold.to_s #+ " - " #+ BRAVO_STORAGE::STOR_CUR_GOLD
        draw_text(24, 24, window_width, line_height, gold_info)
        draw_icon(BRAVO_STORAGE::GOLD_ICON, 0, 24, true)
        if $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] > 0
          items_info = $game_party.storage_all_items_in_box?(box_name).to_s + "/" + $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR].to_s
        else
          items_info = $game_party.storage_all_items_in_box?(box_name).to_s
        end
        draw_text(24, 48, window_width, line_height, items_info)
        draw_icon(BRAVO_STORAGE::ITEMS_ICON, 0, 48, true)
      end
      #--------------------------------------------------------------------------
      # * Open Window
      #--------------------------------------------------------------------------
      def open
        refresh
        super
      end
    end
    
    
    
    #==============================================================================
    # ** Scene_Storage
    #==============================================================================
    
    class Scene_Storage < Scene_MenuBase
      #--------------------------------------------------------------------------
      # * Start Processing
      #--------------------------------------------------------------------------
      def start
        super
        @storage_gold = $game_temp.storage_gold
        @storage_category = $game_temp.storage_category
        @storage_name_window = $game_temp.storage_name_window
        create_help_window
        create_command_window
        create_name_window
        create_dummy_window
        create_freeslot_window  
        create_category_window
        create_item_window
        create_number_window
        create_gold_window
        create_storageinfo_window
      end
      
      #--------------------------------------------------------------------------
      # * Create Command Window
      #--------------------------------------------------------------------------
      def create_command_window
        @command_window = Window_StorageCommand.new
        @command_window.viewport = @viewport
        @command_window.y = @help_window.height
        @command_window.set_handler(:withdraw, method(:command_withdraw))
        @command_window.set_handler(:store, method(:command_store))
        @command_window.set_handler(:cancel, method(:return_scene))
      end
      #--------------------------------------------------------------------------
      # * Create Storage Name Window
      #--------------------------------------------------------------------------
      def create_name_window
        @name_window = Window_StorageName.new
        @name_window.viewport = @viewport
        @name_window.x = @command_window.width
        @name_window.y = @help_window.height
        if @storage_name_window == true 
          @name_window.show
        end
      end
      #--------------------------------------------------------------------------
      # * Create Storage Free Slot Window
      #--------------------------------------------------------------------------
      def create_freeslot_window
        @freeslot_window = Window_FreeSlots.new
        @freeslot_window.viewport = @viewport
        @freeslot_window.x = Graphics.width - @freeslot_window.width
        @freeslot_window.y = Graphics.height - @freeslot_window.height
        @freeslot_window.z = 1000
        @freeslot_window.hide
      end
      
      def create_storageinfo_window
        @storageinfo_window = Window_StorageInfo.new
        @storageinfo_window.viewport = @viewport
        @storageinfo_window.x = 0
        @storageinfo_window.y = Graphics.height - @dummy_window.height
        @storageinfo_window.z = 1000
      end
      
      #--------------------------------------------------------------------------
      # * Create Dummy Window
      #--------------------------------------------------------------------------
      def create_dummy_window
        wy = @command_window.y + @command_window.height
        wh = Graphics.height - wy
        @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
        @dummy_window.viewport = @viewport
      end
      #--------------------------------------------------------------------------
      # * Create Quantity Input Window
      #--------------------------------------------------------------------------
      def create_number_window
        @number_window = Window_StorageNumber.new
        @number_window.viewport = @viewport
        @number_window.x = ((Graphics.width / 2) - (@number_window.width / 2)) 
        @number_window.y = ((Graphics.height / 2) - (@number_window.height / 2)) 
        @number_window.hide
        @number_window.set_handler(:ok,     method(:on_number_ok))
        @number_window.set_handler(:cancel, method(:on_number_cancel))
      end
      #--------------------------------------------------------------------------
      # * Create Category Window
      #--------------------------------------------------------------------------
      def create_category_window
        @category_window = Window_StorageCategory.new(@storage_gold)
        @category_window.viewport = @viewport
        @category_window.help_window = @help_window
        @category_window.y = @dummy_window.y
        @category_window.hide.deactivate
        @category_window.set_handler(:ok,     method(:on_category_ok))
        @category_window.set_handler(:cancel, method(:on_category_cancel))
      end
      #--------------------------------------------------------------------------
      # * Create Item Window
      #--------------------------------------------------------------------------
      def create_item_window
        if @storage_category == false
          wy = @command_window.y + @command_window.height
        else
          wy = @category_window.y + @category_window.height
        end
        wh = Graphics.height - wy 
        @item_window = Window_StorageItemList.new(0, wy, Graphics.width, wh)
        @item_window.viewport = @viewport
        @item_window.help_window = @help_window
        @item_window.hide
        @item_window.set_handler(:ok,     method(:on_item_ok))
        @item_window.set_handler(:cancel, method(:on_item_cancel))
        if @storage_category == false
          @item_window.category = :all
        else
          @category_window.item_window = @item_window
        end
      end
      #--------------------------------------------------------------------------
      # * Create Item Window
      #--------------------------------------------------------------------------
      def create_gold_window
        @gold_window = Window_GoldTransfer.new
        @gold_window.viewport = @viewport
        @gold_window.x = ((Graphics.width / 2) - (@gold_window.width / 2)) 
        @gold_window.y = ((Graphics.height / 2) - (@gold_window.height / 2)) 
        @gold_window.hide
        @gold_window.set_handler(:ok,     method(:on_gold_ok))
        @gold_window.set_handler(:cancel, method(:on_gold_cancel))
      end
      #--------------------------------------------------------------------------
      # * Start Category Selection
      #--------------------------------------------------------------------------
      def start_category_selection
        @dummy_window.hide
        @storageinfo_window.hide
        @freeslot_window.show if ($game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] > 0) && (BRAVO_STORAGE::FREE_SLOTS_WINDOW == true)
        @item_window.show
        @item_window.unselect
        @item_window.refresh
        @item_window.storage = @command_window.current_symbol
        @category_window.show.activate
      end
      #--------------------------------------------------------------------------
      # * [Withdraw] Command
      #--------------------------------------------------------------------------
      def command_withdraw
        if @storage_category == false and @storage_gold == true
          case @command_window.current_symbol
          when :withdraw
            @gold_window.set(max_withdraw, 24)
          when :store
            @gold_window.set(max_store, 0)
          end
          @gold_window.show.activate
        elsif @storage_category == false
          @dummy_window.hide
          @storageinfo_window.hide
          @freeslot_window.show if ($game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] > 0) && (BRAVO_STORAGE::FREE_SLOTS_WINDOW == true)
          @item_window.show.activate
          @item_window.storage = @command_window.current_symbol
          @item_window.select_last
        else
          start_category_selection
        end
      end
      #--------------------------------------------------------------------------
      # * [Store] Command
      #--------------------------------------------------------------------------
      def command_store
        if @storage_category == false and @storage_gold == true
          case @command_window.current_symbol
          when :withdraw
            @gold_window.set(max_withdraw, 24)
          when :store
            @gold_window.set(max_store, 0)
          end
          @gold_window.show.activate
        elsif @storage_category == false
          @dummy_window.hide
          @storageinfo_window.hide
          @freeslot_window.show if ($game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] > 0) && (BRAVO_STORAGE::FREE_SLOTS_WINDOW == true)
          @item_window.show.activate
          @item_window.storage = @command_window.current_symbol
          @item_window.select_last
        else
          start_category_selection
        end
      end
      #--------------------------------------------------------------------------
      # * Category [OK]
      #--------------------------------------------------------------------------
      def on_category_ok
        case @category_window.current_symbol
        when :item, :weapon, :armor
          @item_window.activate
          @item_window.select_last
        when :gold
          case @command_window.current_symbol
          when :withdraw
            @gold_window.set(max_withdraw, 24)
          when :store
            @gold_window.set(max_store, 0)
          end
          @gold_window.show.activate
        end
      end
      #--------------------------------------------------------------------------
      # * Category [Cancel]
      #--------------------------------------------------------------------------
      def on_category_cancel
        @command_window.activate
        @dummy_window.show
        @storageinfo_window.show
        @freeslot_window.hide
        @item_window.hide
        @category_window.hide
      end
      #--------------------------------------------------------------------------
      # * Item [OK]
      #--------------------------------------------------------------------------
      def on_item_ok
        @item = @item_window.item
        case @command_window.current_symbol
        when :withdraw
          @number_window.set(@item, max_withdraw)
        when :store
          @number_window.set(@item, max_store)
        end
        @number_window.show.activate
      end
      #--------------------------------------------------------------------------
      # * Item [Cancel]
      #--------------------------------------------------------------------------
      def on_item_cancel
        @item_window.unselect
        if @storage_category == false
          @item_window.hide
          @dummy_window.show
          @storageinfo_window.show
          @freeslot_window.hide
          @command_window.activate
        else
          @category_window.activate
        end
      end
      #--------------------------------------------------------------------------
      # * Quantity Input [OK]
      #--------------------------------------------------------------------------
      def on_number_ok
        Sound.play_ok
        case @command_window.current_symbol
        when :withdraw
          do_withdraw(@number_window.number)
        when :store
          do_store(@number_window.number)
        end
        @number_window.hide
        @freeslot_window.refresh
        @storageinfo_window.refresh
        @item_window.refresh
        @item_window.activate
        @item_window.select_last
      end
      #--------------------------------------------------------------------------
      # * Quantity Input [Cancel]
      #--------------------------------------------------------------------------
      def on_number_cancel
        Sound.play_cancel
        @number_window.hide
        @item_window.activate
      end
      #--------------------------------------------------------------------------
      # * Gold Quantity Input [OK]
      #--------------------------------------------------------------------------
      def on_gold_ok
        case @command_window.current_symbol
        when :withdraw
          gold_withdraw(@gold_window.number)
          @gold_window.set(max_withdraw, 24)
        when :store
          gold_store(@gold_window.number)
          @gold_window.set(max_store, 0)
        end
        @gold_window.show.activate
        @gold_window.refresh
        @storageinfo_window.refresh
        Sound.play_ok
      end
      #--------------------------------------------------------------------------
      # * Gold Quantity Input [Cancel]
      #--------------------------------------------------------------------------
      def on_gold_cancel
        Sound.play_cancel
        if @storage_category == false && @storage_gold == true
          @command_window.activate
        else
          start_category_selection
        end
        @gold_window.hide
      end
      #--------------------------------------------------------------------------
      # * Execute Withdraw
      #--------------------------------------------------------------------------
      def do_withdraw(number)
        $game_party.storage_lose_item(@item, number)
        $game_party.gain_item(@item, number)
      end
      #--------------------------------------------------------------------------
      # * Execute Store
      #--------------------------------------------------------------------------
      def do_store(number)
        $game_party.storage_gain_item(@item, number)
        $game_party.lose_item(@item, number)
      end
      #--------------------------------------------------------------------------
      # * Gold Withdraw
      #--------------------------------------------------------------------------
      def gold_withdraw(number)
        $game_party.storage_lose_gold(number)
        $game_party.gain_gold(number)
      end
      #--------------------------------------------------------------------------
      # * Gold Store
      #--------------------------------------------------------------------------
      def gold_store(number)
        $game_party.lose_gold(number)
        $game_party.storage_gain_gold(number)
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Quantity Withdrawable
      #--------------------------------------------------------------------------
      def max_withdraw
        case @category_window.current_symbol
        when :item, :weapon, :armor
          available_inv_slots = $game_party.max_item_number(@item) - $game_party.item_number(@item)
          if $game_party.storage_item_number(@item) > available_inv_slots
            return available_inv_slots
          else
            $game_party.storage_item_number(@item)
          end
        when :gold
          if $game_party.storage_gold > 999
            return 999
          else
            $game_party.storage_gold
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Quantity Storable
      #--------------------------------------------------------------------------
      def max_store
        case @category_window.current_symbol
        when :item, :weapon, :armor
          box_name = $game_party.storage_name
          if $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] > 0
            if $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] - $game_party.storage_all_items_in_box?(box_name) >= $game_party.item_number(@item)
              available_slots_in_box = 99
            elsif $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] - $game_party.storage_all_items_in_box?(box_name) <= 99
              available_slots_in_box = $game_variables[BRAVO_STORAGE::ITEMS_MAX_VAR] - $game_party.storage_all_items_in_box?(box_name)
            else
              available_slots_in_box = 99
            end
          else
            available_slots_in_box = 99
          end
          if $game_party.item_number(@item) > available_slots_in_box
            return available_slots_in_box
          else
            $game_party.item_number(@item)
          end
        when :gold
          if $game_party.gold > 999
            return 999
          else
            $game_party.gold
          end
        end
      end
    end
    
    class Scene_Map < Scene_Base
      alias stor_flag_update update
      def update
        stor_flag_update
        upd_name = $game_party.storage_name
        if upd_name != nil
          check_storage = $game_party.storage_all_items_in_box?(upd_name) + $game_party.storage_gold
          if check_storage > 0
            $game_switches[BRAVO_STORAGE::STORAGE_SWITCH] = true if BRAVO_STORAGE::STORAGE_SWITCH != 0
          else
            $game_switches[BRAVO_STORAGE::STORAGE_SWITCH] = false if BRAVO_STORAGE::STORAGE_SWITCH != 0
          end
        end
      end
    end


    Спойлер Скрипт, оригинал+демка оригинала:
    Спойлер скрипт:
    Код:
    #==============================================================================
    # Bravo Storage System
    #------------------------------------------------------------------------------
    # Author: Bravo2Kilo
    # Version: 2.0
    #
    # Version History:
    #   v1.0 = Initial Release
    #   v1.1 = Fixed a bug and added some commands.
    #   v2.0 = Added the ability to have multiple storage containers.
    #==============================================================================
    # Notes
    #   If category and gold are both set to false, you can only exchange items,
    #   if category is set to false and gold is set to true, you can only exchange
    #   gold.
    #==============================================================================
    # To open the storage scene use this command in a script call.
    #   open_storage(name, name_window, category, gold)
    #     name = the name of the storage
    #     name_window = (true or false)true to show the name window
    #     category = (true or false)true to show the category window
    #     gold = (true or false)true to show gold in the category window
    #
    # To add or remove items from a certain storage use this command in a script call
    #   storage_add_item(name, type, id, amount)
    #   storage_remove_item(name, type, id, amount)
    #     name = the name of the storage
    #     type = the type of item, can be(:item, :weapon, :armor)
    #     id = the database id of the item
    #     amount = the amount to add or remove
    #
    # To remove all items and gold in a certain storage use this command in a script call
    #   clear_storage(name)
    #     name = the name of the storage
    #
    # To check the amount of an item in a certain storage use this command in a script call
    #   storage_item_number(name, type, id)
    #     name = the name of the storage
    #     type = the type of item, can be(:item, :weapon, :armor)
    #     id = the database id of the item
    #
    # To add or remove gold from a certain storage use this command in a script call
    #   storage_add_gold(name, amount)
    #   storage_remove_gold(name, amount)
    #     name = the name of the storage
    #     amount = the amount to add or remove
    #
    # To check the amount of gold in a certain storage use this command in a script call
    #   storage_gold_number(name)
    #     name = the name of the storage
    #
    # If you want to set the max ammount of each item that can be in the storage,
    # use this notetag, if a notetage isn't used it will use the default max that
    # is defined below.
    #   <storagemax: X> were X = the max.
    #==============================================================================
    module BRAVO_STORAGE
      # The default max of an item that can be in storage.
      ITEM_MAX = 99
      # The max amount of gold that can be stored.
      GOLD_MAX = 99999999
      # The command name for removing items from storage.
      WITHDRAW_TEXT = "Take Out"
      # The command name for putting items into storage.
      STORE_TEXT = "Put In"
      # The command name for leaving the storage scene.
      CANCEL_TEXT = "Leave"
      # The storage name window width
      NAME_WIDTH = 160
    #==============================================================================
    # End of Configuration
    #==============================================================================
    end
    $imported ||= {}
    $imported[:Bravo_Storage] = true
    
    #==============================================================================
    # ** RPG::BaseItem
    #==============================================================================
    class RPG::BaseItem
      #--------------------------------------------------------------------------
      # * Item Storage Max
      #--------------------------------------------------------------------------
      def storage_max
        if @note =~ /<storagemax: (.*)>/i
          return $1.to_i
        else
          return BRAVO_STORAGE::ITEM_MAX
        end
      end
    end
    
    #==============================================================================
    # ** Game_Temp
    #==============================================================================
    
    class Game_Temp
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :storage_gold
      attr_accessor :storage_category
      attr_accessor :storage_name_window
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      alias bravo_storage_initialize initialize
      def initialize
        bravo_storage_initialize
        @storage_gold = true
        @storage_category = true
        @storage_name_window = true
      end
    end
    
    #==============================================================================
    # ** Game_Party
    #==============================================================================
    
    class Game_Party < Game_Unit
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :storage_name
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      alias bravo_storage_initialize initialize
      def initialize
        bravo_storage_initialize
        @storage_gold = {}
        @storage_items = {}
        @storage_weapons = {}
        @storage_armors = {}
        @storage_name = nil
      end
      #--------------------------------------------------------------------------
      # * Initialize Storage
      #--------------------------------------------------------------------------
      def init_storage(name)
        @storage_gold[name] ||= 0
        @storage_items[name] ||= {}
        @storage_weapons[name] ||= {}
        @storage_armors[name] ||= {}
      end
      #--------------------------------------------------------------------------
      # * Storage Name =
      #--------------------------------------------------------------------------
      def storage_name=(name)
        return if @storage_name == name
        @storage_name = name
        init_storage(name)
      end
      #--------------------------------------------------------------------------
      # * Clear Storage
      #--------------------------------------------------------------------------
      def clear_storage(name)
        @storage_gold[name] = 0
        @storage_items[name] = {}
        @storage_weapons[name] = {}
        @storage_armors[name] = {}
      end
      #--------------------------------------------------------------------------
      # * Get Item Object Array 
      #--------------------------------------------------------------------------
      def storage_items
        @storage_items[@storage_name].keys.sort.collect {|id| $data_items[id] }
      end
      #--------------------------------------------------------------------------
      # * Get Weapon Object Array 
      #--------------------------------------------------------------------------
      def storage_weapons
        @storage_weapons[@storage_name].keys.sort.collect {|id| $data_weapons[id] }
      end
      #--------------------------------------------------------------------------
      # * Get Armor Object Array 
      #--------------------------------------------------------------------------
      def storage_armors
        @storage_armors[@storage_name].keys.sort.collect {|id| $data_armors[id] }
      end
      #--------------------------------------------------------------------------
      # * Get Array of All Equipment Objects
      #--------------------------------------------------------------------------
      def storage_equip_items
        storage_weapons + storage_armors
      end
      #--------------------------------------------------------------------------
      # * Get Array of All Item Objects
      #--------------------------------------------------------------------------
      def storage_all_items
        storage_items + storage_equip_items
      end
      #--------------------------------------------------------------------------
      # * Get Container Object Corresponding to Item Class
      #--------------------------------------------------------------------------
      def storage_item_container(item_class)
        return @storage_items[@storage_name]   if item_class == RPG::Item
        return @storage_weapons[@storage_name] if item_class == RPG::Weapon
        return @storage_armors[@storage_name]  if item_class == RPG::Armor
        return nil
      end
      #--------------------------------------------------------------------------
      # * Storage Gold
      #--------------------------------------------------------------------------
      def storage_gold
        @storage_gold[@storage_name]
      end
      #--------------------------------------------------------------------------
      # * Increase Storage Gold
      #--------------------------------------------------------------------------
      def storage_gain_gold(amount)
        @storage_gold[@storage_name] = [[@storage_gold[@storage_name] + amount, 0].max, BRAVO_STORAGE::GOLD_MAX].min
      end
      #--------------------------------------------------------------------------
      # * Decrease Storage Gold
      #--------------------------------------------------------------------------
      def storage_lose_gold(amount)
        storage_gain_gold(-amount)
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Number of Items in Storage
      #--------------------------------------------------------------------------
      def storage_max_item_number(item)
        return item.storage_max
      end
      #--------------------------------------------------------------------------
      # * Determine if Maximum Number of Items Are Possessed
      #--------------------------------------------------------------------------
      def storage_item_max?(item)
        storage_item_number(item) >= storage_max_item_number(item)
      end
      #--------------------------------------------------------------------------
      # * Get Number of Items Possessed
      #--------------------------------------------------------------------------
      def storage_item_number(item)
        container = storage_item_container(item.class)
        container ? container[item.id] || 0 : 0
      end
      #--------------------------------------------------------------------------
      # * Increase/Decrease Storage Items
      #--------------------------------------------------------------------------
      def storage_gain_item(item, amount)
        container = storage_item_container(item.class)
        return unless container
        last_number = storage_item_number(item)
        new_number = last_number + amount
        container[item.id] = [[new_number, 0].max, storage_max_item_number(item)].min
        container.delete(item.id) if container[item.id] == 0
      end
      #--------------------------------------------------------------------------
      # * Remove Storage Items
      #--------------------------------------------------------------------------
      def storage_lose_item(item, amount)
        storage_gain_item(item, -amount)
      end
    end
    
    #==============================================================================
    # ** Game_Interpreter
    #==============================================================================
    
    class Game_Interpreter
      #--------------------------------------------------------------------------
      # * Open Storage Scene
      #--------------------------------------------------------------------------
      def open_storage(name, name_window = true, category = true, gold = true)
        $game_party.storage_name = name
        $game_temp.storage_name_window = name_window
        $game_temp.storage_category = category
        $game_temp.storage_gold = gold
        SceneManager.call(Scene_Storage)
      end
      #--------------------------------------------------------------------------
      # * Clear Storage
      #--------------------------------------------------------------------------
      def clear_storage(name)
        $game_party.clear_storage(name)
      end
      #--------------------------------------------------------------------------
      # * Storage Add Item
      #--------------------------------------------------------------------------
      def storage_add_item(name, type, id, amount)
        $game_party.storage_name = name
        case type
        when :item
          item = $data_items[id]
        when :weapon
          item = $data_weapons[id]
        when :armor
          item = $data_armors[id]
        end
        $game_party.storage_gain_item(item, amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Remove Item
      #--------------------------------------------------------------------------
      def storage_remove_item(name, type, id, amount)
        $game_party.storage_name = name
        case type
        when :item
          item = $data_items[id]
        when :weapon
          item = $data_weapons[id]
        when :armor
          item = $data_armors[id]
        end
        $game_party.storage_lose_item(item, amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Item Number
      #--------------------------------------------------------------------------
      def storage_item_number(name, type, id)
        $game_party.storage_name = name
        case type
        when :item
          item = $data_items[id]
        when :weapon
          item = $data_weapons[id]
        when :armor
          item = $data_armors[id]
        end
        $game_party.storage_item_number(item)
      end
      #--------------------------------------------------------------------------
      # * Storage Add Gold
      #--------------------------------------------------------------------------
      def storage_add_gold(name, amount)
        $game_party.storage_name = name
        $game_party.storage_gain_gold(amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Remove Gold
      #--------------------------------------------------------------------------
      def storage_remove_gold(name, amount)
        $game_party.storage_name = name
        $game_party.storage_lose_gold(amount)
      end
      #--------------------------------------------------------------------------
      # * Storage Gold Number
      #--------------------------------------------------------------------------
      def storage_gold_number(name)
        $game_party.storage_name = name
        $game_party.storage_gold
      end
    end
    
    #==============================================================================
    # ** Window_StorageCategory
    #==============================================================================
    
    class Window_StorageCategory < Window_ItemCategory
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(gold)
        @gold = gold
        super()
      end
      #--------------------------------------------------------------------------
      # * Get Digit Count
      #--------------------------------------------------------------------------
      def col_max
        if @gold == true
          return 4
        else
          return 3
        end
      end
      #--------------------------------------------------------------------------
      # * Create Command List
      #--------------------------------------------------------------------------
      def make_command_list
        add_command(Vocab::item, :item)
        add_command(Vocab::weapon, :weapon)
        add_command(Vocab::armor, :armor)
        add_command(Vocab::currency_unit, :gold) if @gold == true
      end
    end
    
    #==============================================================================
    # ** Window_ItemList
    #------------------------------------------------------------------------------
    #  This window displays a list of party items on the item screen.
    #==============================================================================
    
    class Window_StorageItemList < Window_ItemList
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x, y, width, height)
        super(x, y, width, height)
        @storage = :none
      end
      #--------------------------------------------------------------------------
      # * Set Storage Flag
      #--------------------------------------------------------------------------
      def storage=(storage)
        return if @storage == storage
        @storage = storage
        refresh
        self.oy = 0
      end
      #--------------------------------------------------------------------------
      # * Include in Item List?
      #--------------------------------------------------------------------------
      def include?(item)
        case @category
        when :item
          item.is_a?(RPG::Item)
        when :weapon
          item.is_a?(RPG::Weapon)
        when :armor
          item.is_a?(RPG::Armor)
        when :all
          item
        else
          false
        end
      end
      #--------------------------------------------------------------------------
      # * Display in Enabled State?
      #--------------------------------------------------------------------------
      def enable?(item)
        if item.is_a?(RPG::Item)
          return true if !item.key_item?
        elsif item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
          return true
        else
          return false
        end
      end
      #--------------------------------------------------------------------------
      # * Create Item List
      #--------------------------------------------------------------------------
      def make_item_list
        case @storage
        when :store
          @data = $game_party.all_items.select {|item| include?(item) }
          @data.push(nil) if include?(nil)
        when :withdraw
          @data = $game_party.storage_all_items.select {|item| include?(item) }
          @data.push(nil) if include?(nil)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Number of Items
      #--------------------------------------------------------------------------
      def draw_item_number(rect, item)
        case @storage
        when :store
          draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
        when :withdraw
          draw_text(rect, sprintf(":%2d", $game_party.storage_item_number(item)), 2)
        end
      end
    end
    
    #==============================================================================
    # ** Window_StorageCommand
    #==============================================================================
    
    class Window_StorageCommand < Window_HorzCommand
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0)
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        if $game_temp.storage_name_window == false
          return 544
        else
          Graphics.width - BRAVO_STORAGE::NAME_WIDTH
        end
      end
      #--------------------------------------------------------------------------
      # * Get Digit Count
      #--------------------------------------------------------------------------
      def col_max
        return 3
      end
      #--------------------------------------------------------------------------
      # * Create Command List
      #--------------------------------------------------------------------------
      def make_command_list
        add_command(BRAVO_STORAGE::WITHDRAW_TEXT, :withdraw)
        add_command(BRAVO_STORAGE::STORE_TEXT, :store)
        add_command(BRAVO_STORAGE::CANCEL_TEXT, :cancel)
      end
    end
    
    #==============================================================================
    # ** Window_StorageName
    #==============================================================================
    class Window_StorageName < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, fitting_height(1))
        refresh
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return BRAVO_STORAGE::NAME_WIDTH
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        name = $game_party.storage_name
        draw_text(0, 0, window_width, line_height, name)
      end
      #--------------------------------------------------------------------------
      # * Open Window
      #--------------------------------------------------------------------------
      def open
        refresh
        super
      end
    end
    
    #==============================================================================
    # ** Window_StorageNumber
    #==============================================================================
    
    class Window_StorageNumber < Window_Selectable
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :number                   # quantity entered
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, window_height) 
        @item = nil
        @max = 1
        @number = 1
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return 304
      end
      #--------------------------------------------------------------------------
      # * Get Window Height
      #--------------------------------------------------------------------------
      def window_height
        return 48
      end
      #--------------------------------------------------------------------------
      # * Set Item, Max Quantity
      #--------------------------------------------------------------------------
      def set(item, max)
        @item = item
        @max = max
        @number = 1
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        draw_item_name(@item, 0, 0)
        draw_number
      end
      #--------------------------------------------------------------------------
      # * Draw Quantity
      #--------------------------------------------------------------------------
      def draw_number
        change_color(normal_color)
        draw_text(cursor_x - 28, 0, 22, line_height, "×")
        draw_text(cursor_x, 0, cursor_width - 4, line_height, @number, 2)
      end
      #--------------------------------------------------------------------------
      # * Get Cursor Width
      #--------------------------------------------------------------------------
      def cursor_width
        figures * 10 + 12
      end
      #--------------------------------------------------------------------------
      # * Get X Coordinate of Cursor
      #--------------------------------------------------------------------------
      def cursor_x
        contents_width - cursor_width - 4
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Number of Digits for Quantity Display
      #--------------------------------------------------------------------------
      def figures
        return 2
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        if active
          last_number = @number
          update_number
          if @number != last_number
            Sound.play_cursor
            refresh
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Update Quantity
      #--------------------------------------------------------------------------
      def update_number
        change_number(1)   if Input.repeat?(:RIGHT)
        change_number(-1)  if Input.repeat?(:LEFT)
        change_number(10)  if Input.repeat?(:UP)
        change_number(-10) if Input.repeat?(:DOWN)
      end
      #--------------------------------------------------------------------------
      # * Change Quantity
      #--------------------------------------------------------------------------
      def change_number(amount)
        @number = [[@number + amount, @max].min, 1].max
      end
      #--------------------------------------------------------------------------
      # * Update Cursor
      #--------------------------------------------------------------------------
      def update_cursor
        cursor_rect.set(cursor_x, 0, cursor_width, line_height)
      end
    end
    
    #==============================================================================
    # ** Window_GoldTransfer
    #==============================================================================
    
    class Window_GoldTransfer < Window_Selectable
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :number                   # quantity entered
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, window_width, window_height) 
        @item = nil
        @max = 1
        @number = 1
        @cursor_y = 0
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return 330
      end
      #--------------------------------------------------------------------------
      # * Get Window Height
      #--------------------------------------------------------------------------
      def window_height
        return 72
      end
      #--------------------------------------------------------------------------
      # * Set Item, Max Quantity
      #--------------------------------------------------------------------------
      def set(max, position)
        @max = max
        @number = 1
        @cursor_y = position
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        draw_gold_info
        draw_number
      end
      #--------------------------------------------------------------------------
      # * Display in Enabled State?
      #--------------------------------------------------------------------------
      def enabled?
        if @cursor_y == 0
          return true if $game_party.gold > 0
        else
          return true if $game_party.storage_gold > 0
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Processing When OK Button Is Pressed
      #--------------------------------------------------------------------------
      def process_ok
        if enabled?
          Sound.play_ok
          Input.update
          deactivate
          call_ok_handler
        else
          Sound.play_buzzer
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Gold Info
      #--------------------------------------------------------------------------
      def draw_gold_info
        party = "Party " + Vocab::currency_unit + " :"
        storage = "Storage " + Vocab::currency_unit + " :"
        draw_text(0, 0, 280, line_height, party)
        draw_text(0, 24, 280, line_height, storage)
        draw_text(0, 0, 225, line_height, $game_party.gold, 2)
        draw_text(0, 24, 225, line_height, $game_party.storage_gold, 2)
      end
      #--------------------------------------------------------------------------
      # * Draw Quantity
      #--------------------------------------------------------------------------
      def draw_number
        change_color(normal_color)
        draw_text(cursor_x - 28, @cursor_y, 22, line_height, "×")
        draw_text(cursor_x, @cursor_y, cursor_width - 4, line_height, @number, 2)
      end
      #--------------------------------------------------------------------------
      # * Get Cursor Width
      #--------------------------------------------------------------------------
      def cursor_width
        figures * 10 + 12
      end
      #--------------------------------------------------------------------------
      # * Get X Coordinate of Cursor
      #--------------------------------------------------------------------------
      def cursor_x
        contents_width - cursor_width - 4
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Number of Digits for Quantity Display
      #--------------------------------------------------------------------------
      def figures
        return 3
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        if active
          last_number = @number
          update_number
          if @number != last_number
            Sound.play_cursor
            refresh
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Update Quantity
      #--------------------------------------------------------------------------
      def update_number
        change_number(1)   if Input.repeat?(:RIGHT)
        change_number(-1)  if Input.repeat?(:LEFT)
        change_number(10)  if Input.repeat?(:UP)
        change_number(-10) if Input.repeat?(:DOWN)
      end
      #--------------------------------------------------------------------------
      # * Change Quantity
      #--------------------------------------------------------------------------
      def change_number(amount)
        @number = [[@number + amount, @max].min, 1].max
      end
      #--------------------------------------------------------------------------
      # * Update Cursor
      #--------------------------------------------------------------------------
      def update_cursor
        @cursor_y ||= 0
        cursor_rect.set(cursor_x, @cursor_y, cursor_width, line_height)
      end
    end
    
    #==============================================================================
    # ** Scene_Storage
    #==============================================================================
    
    class Scene_Storage < Scene_MenuBase
      #--------------------------------------------------------------------------
      # * Start Processing
      #--------------------------------------------------------------------------
      def start
        super
        @storage_gold = $game_temp.storage_gold
        @storage_category = $game_temp.storage_category
        @storage_name_window = $game_temp.storage_name_window
        create_help_window
        create_command_window
        create_name_window
        create_dummy_window
        create_category_window
        create_item_window
        create_number_window
        create_gold_window
      end
      #--------------------------------------------------------------------------
      # * Create Command Window
      #--------------------------------------------------------------------------
      def create_command_window
        @command_window = Window_StorageCommand.new
        @command_window.viewport = @viewport
        @command_window.y = @help_window.height
        @command_window.set_handler(:withdraw, method(:command_withdraw))
        @command_window.set_handler(:store, method(:command_store))
        @command_window.set_handler(:cancel, method(:return_scene))
      end
      #--------------------------------------------------------------------------
      # * Create Storage Name Window
      #--------------------------------------------------------------------------
      def create_name_window
        @name_window = Window_StorageName.new
        @name_window.viewport = @viewport
        @name_window.x = @command_window.width
        @name_window.y = @help_window.height
        if @storage_name_window == true
          @name_window.show
        end
      end
      #--------------------------------------------------------------------------
      # * Create Dummy Window
      #--------------------------------------------------------------------------
      def create_dummy_window
        wy = @command_window.y + @command_window.height
        wh = Graphics.height - wy
        @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
        @dummy_window.viewport = @viewport
      end
      #--------------------------------------------------------------------------
      # * Create Quantity Input Window
      #--------------------------------------------------------------------------
      def create_number_window
        @number_window = Window_StorageNumber.new
        @number_window.viewport = @viewport
        @number_window.x = ((Graphics.width / 2) - (@number_window.width / 2)) 
        @number_window.y = ((Graphics.height / 2) - (@number_window.height / 2)) 
        @number_window.hide
        @number_window.set_handler(:ok,     method(:on_number_ok))
        @number_window.set_handler(:cancel, method(:on_number_cancel))
      end
      #--------------------------------------------------------------------------
      # * Create Category Window
      #--------------------------------------------------------------------------
      def create_category_window
        @category_window = Window_StorageCategory.new(@storage_gold)
        @category_window.viewport = @viewport
        @category_window.help_window = @help_window
        @category_window.y = @dummy_window.y
        @category_window.hide.deactivate
        @category_window.set_handler(:ok,     method(:on_category_ok))
        @category_window.set_handler(:cancel, method(:on_category_cancel))
      end
      #--------------------------------------------------------------------------
      # * Create Item Window
      #--------------------------------------------------------------------------
      def create_item_window
        if @storage_category == false
          wy = @command_window.y + @command_window.height
        else
          wy = @category_window.y + @category_window.height
        end
        wh = Graphics.height - wy
        @item_window = Window_StorageItemList.new(0, wy, Graphics.width, wh)
        @item_window.viewport = @viewport
        @item_window.help_window = @help_window
        @item_window.hide
        @item_window.set_handler(:ok,     method(:on_item_ok))
        @item_window.set_handler(:cancel, method(:on_item_cancel))
        if @storage_category == false
          @item_window.category = :all
        else
          @category_window.item_window = @item_window
        end
      end
      #--------------------------------------------------------------------------
      # * Create Item Window
      #--------------------------------------------------------------------------
      def create_gold_window
        @gold_window = Window_GoldTransfer.new
        @gold_window.viewport = @viewport
        @gold_window.x = ((Graphics.width / 2) - (@gold_window.width / 2)) 
        @gold_window.y = ((Graphics.height / 2) - (@gold_window.height / 2)) 
        @gold_window.hide
        @gold_window.set_handler(:ok,     method(:on_gold_ok))
        @gold_window.set_handler(:cancel, method(:on_gold_cancel))
      end
      #--------------------------------------------------------------------------
      # * Start Category Selection
      #--------------------------------------------------------------------------
      def start_category_selection
        @dummy_window.hide
        @item_window.show
        @item_window.unselect
        @item_window.refresh
        @item_window.storage = @command_window.current_symbol
        @category_window.show.activate
      end
      #--------------------------------------------------------------------------
      # * [Withdraw] Command
      #--------------------------------------------------------------------------
      def command_withdraw
        if @storage_category == false and @storage_gold == true
          case @command_window.current_symbol
          when :withdraw
            @gold_window.set(max_withdraw, 24)
          when :store
            @gold_window.set(max_store, 0)
          end
          @gold_window.show.activate
        elsif @storage_category == false
          @dummy_window.hide
          @item_window.show.activate
          @item_window.storage = @command_window.current_symbol
          @item_window.select_last
        else
          start_category_selection
        end
      end
      #--------------------------------------------------------------------------
      # * [Store] Command
      #--------------------------------------------------------------------------
      def command_store
        if @storage_category == false and @storage_gold == true
          case @command_window.current_symbol
          when :withdraw
            @gold_window.set(max_withdraw, 24)
          when :store
            @gold_window.set(max_store, 0)
          end
          @gold_window.show.activate
        elsif @storage_category == false
          @dummy_window.hide
          @item_window.show.activate
          @item_window.storage = @command_window.current_symbol
          @item_window.select_last
        else
          start_category_selection
        end
      end
      #--------------------------------------------------------------------------
      # * Category [OK]
      #--------------------------------------------------------------------------
      def on_category_ok
        case @category_window.current_symbol
        when :item, :weapon, :armor
          @item_window.activate
          @item_window.select_last
        when :gold
          case @command_window.current_symbol
          when :withdraw
            @gold_window.set(max_withdraw, 24)
          when :store
            @gold_window.set(max_store, 0)
          end
          @gold_window.show.activate
        end
      end
      #--------------------------------------------------------------------------
      # * Category [Cancel]
      #--------------------------------------------------------------------------
      def on_category_cancel
        @command_window.activate
        @dummy_window.show
        @item_window.hide
        @category_window.hide
      end
      #--------------------------------------------------------------------------
      # * Item [OK]
      #--------------------------------------------------------------------------
      def on_item_ok
        @item = @item_window.item
        case @command_window.current_symbol
        when :withdraw
          @number_window.set(@item, max_withdraw)
        when :store
          @number_window.set(@item, max_store)
        end
        @number_window.show.activate
      end
      #--------------------------------------------------------------------------
      # * Item [Cancel]
      #--------------------------------------------------------------------------
      def on_item_cancel
        @item_window.unselect
        if @storage_category == false
          @item_window.hide
          @dummy_window.show
          @command_window.activate
        else
          @category_window.activate
        end
      end
      #--------------------------------------------------------------------------
      # * Quantity Input [OK]
      #--------------------------------------------------------------------------
      def on_number_ok
        Sound.play_ok
        case @command_window.current_symbol
        when :withdraw
          do_withdraw(@number_window.number)
        when :store
          do_store(@number_window.number)
        end
        @number_window.hide
        @item_window.refresh
        @item_window.activate
        @item_window.select_last
      end
      #--------------------------------------------------------------------------
      # * Quantity Input [Cancel]
      #--------------------------------------------------------------------------
      def on_number_cancel
        Sound.play_cancel
        @number_window.hide
        @item_window.activate
      end
      #--------------------------------------------------------------------------
      # * Gold Quantity Input [OK]
      #--------------------------------------------------------------------------
      def on_gold_ok
        case @command_window.current_symbol
        when :withdraw
          gold_withdraw(@gold_window.number)
          @gold_window.set(max_withdraw, 24)
        when :store
          gold_store(@gold_window.number)
          @gold_window.set(max_store, 0)
        end
        @gold_window.show.activate
        @gold_window.refresh
        Sound.play_ok
      end
      #--------------------------------------------------------------------------
      # * Gold Quantity Input [Cancel]
      #--------------------------------------------------------------------------
      def on_gold_cancel
        Sound.play_cancel
        if @storage_category == false && @storage_gold == true
          @command_window.activate
        else
          start_category_selection
        end
        @gold_window.hide
      end
      #--------------------------------------------------------------------------
      # * Execute Withdraw
      #--------------------------------------------------------------------------
      def do_withdraw(number)
        $game_party.storage_lose_item(@item, number)
        $game_party.gain_item(@item, number)
      end
      #--------------------------------------------------------------------------
      # * Execute Store
      #--------------------------------------------------------------------------
      def do_store(number)
        $game_party.storage_gain_item(@item, number)
        $game_party.lose_item(@item, number)
      end
      #--------------------------------------------------------------------------
      # * Gold Withdraw
      #--------------------------------------------------------------------------
      def gold_withdraw(number)
        $game_party.storage_lose_gold(number)
        $game_party.gain_gold(number)
      end
      #--------------------------------------------------------------------------
      # * Gold Store
      #--------------------------------------------------------------------------
      def gold_store(number)
        $game_party.lose_gold(number)
        $game_party.storage_gain_gold(number)
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Quantity Withdrawable
      #--------------------------------------------------------------------------
      def max_withdraw
        case @category_window.current_symbol
        when :item, :weapon, :armor
          if $game_party.storage_item_number(@item) > 99
            return 99
          else
            $game_party.storage_item_number(@item)
          end
        when :gold
          if $game_party.storage_gold > 999
            return 999
          else
            $game_party.storage_gold
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Get Maximum Quantity Storable
      #--------------------------------------------------------------------------
      def max_store
        case @category_window.current_symbol
        when :item, :weapon, :armor
          if $game_party.item_number(@item) > 99
            return 99
          else
            $game_party.item_number(@item)
          end
        when :gold
          if $game_party.gold > 999
            return 999
          else
            $game_party.gold
          end
        end
      end
    end
    Демка - тык



    Принимаю правки по переводу модифицированной версии, если в ней будут косяки, что вполне возможно xD Позже, если нужно конечно, сделаю демку для модифицированной версии скрипта.
    Последний раз редактировалось dirge; 30.10.2014 в 21:34.

  2. #2
    Познающий Аватар для JackCL
    Информация о пользователе
    Регистрация
    27.07.2013
    Адрес
    Дальний Восток
    Сообщений
    554
    Записей в дневнике
    85
    Репутация: 30 Добавить или отнять репутацию

    По умолчанию

    Спасибо, интересно.
    Во-первых, у меня есть замечание по описанию, оно не совсем точное, насколько я понял.

    теперь можно запрещать класть определенные вещи в хранилище и не только вещи, а целые категории предметов.
    - скрипт позволяет определять через allowed_category какие категории предметов можно класть в определенное хранилище;
    - скрипт позволяет определять через NOT_ALLOWED_ITEM список вещей (items), которые нельзя класть в хранилища вообще.

    Скрипт НЕ позволяет запрещать класть определенные вещи в хранилище - запрет на определенные вещи идет для всех хранилищ сразу (в отличии от категорий).


    Во-вторых, благие пожелания по дальнейшему расширению возможностей скрипта (ну а вдруг есть желание, наконец, довести его до ума):

    1.
    Подружить скрипт с Yanfly Engine Ace - Equip Engine, позволив ему работать не только с категорией armors целиком, но и с кастомными ноте-тэгами <equip type: x>.
    Зачем?
    Появится возможность создавать полноценные "тематические хранилища" вещей, например, можно будет сделать вешалку для шляп или стойку для брони и т.п., вкупе с уже введенным free_slot это означает полноценную интерактивную обстановку дома.

    2.
    Подружить скрипт с Yanfly Engine Ace - Ace Item Menu, позволив ему работать не только с категорией items целиком, но и с кастомными ноте-тэгами: <category: string>
    Зачем?
    Появится возможность создавать полноценный "тематические хранилища" предметов, например, ящики для хранения овощей (кто о чем, а я о ферме) или полки для бакалеи или холодильники и т.п.

    В идеале при переборе вещей в хранилище хорошо бы вообще запрашивать интерфейс Ace Item Menu с отображением всех свойств предмета.

    3.
    Добавить возможность проверки на наличие предметов в хранилище (не через конкретный запрос storage_item_number), а некий общий флаг/свитч который показывал бы пустое хранилище или что-то в нем есть.
    Зачем?
    Это позволит менять графику хранилища в зависимости от заполнения, пускай и примитивным способом: пустая полка/заполненная полка.
    Фактически Lipton научил меня это делать, но через изменения в class Game_Interpreter, что не очень удобно.

    4.
    Сделать отображение количества денег в хранилище сразу после его открытия.
    Зачем?
    Когда хранилище открывается не видно сколько там денег. Нужно сперва выбрать "Забрать" и только потом открывается окно из которого можно понять сколько денег там лежит и лежит ли вообще. Это терпимо когда речь идет о разных категориях предметов, но в случае с деньгами неудобно.



  3. #3
    Супер-модератор Аватар для dirge
    Информация о пользователе
    Регистрация
    25.02.2013
    Сообщений
    924
    Репутация: 79 Добавить или отнять репутацию

    По умолчанию

    Цитата Сообщение от JackCL Посмотреть сообщение
    - скрипт позволяет определять через allowed_category какие категории предметов можно класть в определенное хранилище;
    - скрипт позволяет определять через NOT_ALLOWED_ITEM список вещей (items), которые нельзя класть в хранилища вообще.
    Все правильно, возможно я не так написал, просто мне не нужно было определенное хранилище, мне нужен был запрет в целом. Но если требуется, могу заменить на еще один вызов, который нужно будет самому всегда контролировать, перед вызовом open_storage, так же как и allowed_category.

    Дальше по пожеланиям. Дружить скрипты я не уверен, что когда-нибудь буду это делать, но кто знает может и заморочусь. Основная проблема, я не являюсь скриптером, все что я делаю больше похоже на огромные костыли xD Хоть и рабочие. Из-за того, что я многого не знаю - попросту не смогу сделать, ну либо сделаю, но при больших усилиях. Да это такое, все в мире относительно, поэтому я не буду говорить наотрез, что я этого не сделаю.
    По повод 3 и 4 пункта, в принципе можно сделать. Придумать бы только куда это окно с золотом прицепить.

  4. #4
    Супер-модератор Аватар для dirge
    Информация о пользователе
    Регистрация
    25.02.2013
    Сообщений
    924
    Репутация: 79 Добавить или отнять репутацию

    По умолчанию

    UPDATE!
    Скрипт обновился.
    Версия в первый посте обновлена.
    Сильно кардинальных изменений обновление не принесло, но добавило некоторые новые возможности.

  5. #5
    Местный Аватар для Potato
    Информация о пользователе
    Регистрация
    12.04.2012
    Адрес
    Вторая палатка слева
    Сообщений
    243
    Записей в дневнике
    1
    Репутация: 5 Добавить или отнять репутацию

    По умолчанию

    Может хоть демка будет?

  6. #6
    Супер-модератор Аватар для dirge
    Информация о пользователе
    Регистрация
    25.02.2013
    Сообщений
    924
    Репутация: 79 Добавить или отнять репутацию

    По умолчанию

    тебе оригинальной недостаточно? чтобы понять как оно работает? А дополнительные вещи и так описаны.

  7. #7
    Местный Аватар для Potato
    Информация о пользователе
    Регистрация
    12.04.2012
    Адрес
    Вторая палатка слева
    Сообщений
    243
    Записей в дневнике
    1
    Репутация: 5 Добавить или отнять репутацию

    По умолчанию


  8. #8
    Супер-модератор Аватар для dirge
    Информация о пользователе
    Регистрация
    25.02.2013
    Сообщений
    924
    Репутация: 79 Добавить или отнять репутацию

    По умолчанию

    При каких условиях это тебе показывает?

  9. #9
    Местный Аватар для Potato
    Информация о пользователе
    Регистрация
    12.04.2012
    Адрес
    Вторая палатка слева
    Сообщений
    243
    Записей в дневнике
    1
    Репутация: 5 Добавить или отнять репутацию

    По умолчанию

    В своём проекте при попытке открыть ящик со скриптом, в демке когда пытался открыть красные ящики

  10. #10
    Супер-модератор Аватар для dirge
    Информация о пользователе
    Регистрация
    25.02.2013
    Сообщений
    924
    Репутация: 79 Добавить или отнять репутацию

    По умолчанию

    Что у тебя в ивенте сундука стоит?

Страница 1 из 2 12 ПоследняяПоследняя

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Социальные закладки

Социальные закладки

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •  
Bravo Storage System + Modified Version