Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # ♫ ~ Item slots by TheoAllen ~ ♫
- # Version : 1.2c
- # Requires : N/A
- # Contact : www.rpgmakerid.com
- # =============================================================================
- # ♫ UPDATES :
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2013.03.07 - Compatibility patch for YEA - Core Engine
- # - Compatibility patch for YEA - Item menu
- # - Compatibility patch for YEA - Shop Option
- # 2013.03.06 - Add force gain item method
- # - Refix slot info window
- # - Slot info window now can be seen in Scene equip
- # 2013.03.02 - Fixed bug when access equip menu
- # 2013.03.01 - Add slot_plus notetag for states, item, equip, and actor
- # - Add slot_minus notetag for states
- # 2013.02.28 - Add weight notetag for each inventory item
- # - Add slot info window at item menu
- # - Add slot info and weight info at shop processing
- # - Refixed gain item bug
- # 2013.02.27 - Fixed gain item bug
- # 2013.02.26 - Started and finished script
- #
- # =============================================================================
- # ♫ DESCRIPTION :
- # This script allow you to make maximum item by overall item possesed instead
- # of each item possesed
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ♫ INSTRUCTION :
- # Put this script below material but above main in script editor. If u use YEA
- # shop options, put this script below YEA Shop Options. Don't forget to save.
- # =============================================================================
- # ♫ HOW TO USE :
- # ---------------------------------------
- # ♫ ACTOR NOTETAG
- # ---------------------------------------
- # <slot plus: x>
- # To specify additional slots each actor. Default value is based on "slots
- # number" in configurations below.
- # ---------------------------------------
- # ♫ ITEM NOTETAGS
- # ---------------------------------------
- # <weight: x>
- # To specify weight each item, (default = 1). Floating number such as 0.5 will
- # be counted as 1
- #
- # <slot plus: x>
- # To specify additional slots each item possesed. Default value 0
- # ---------------------------------------
- # ♫ WEAPON AND ARMOR NOTETAG
- # ---------------------------------------
- # <weight: x>
- # To specify weight each item. (default = 1). Floating number such as 0.5 will
- # be counted as 1
- #
- # <slot plus: x>
- # To specify additional slots if the weapon/armor is equiped. default value is 0
- # ---------------------------------------
- # ♫ STATE NOTETAGS
- # ---------------------------------------
- # <slot plus: x>
- # To specify additional slots each status. Default value is 0
- #
- # <slot minus: x>
- # To decrease maximum slots each status if status inflicted. Default value is 0
- # ---------------------------------------
- # You can type force_gain_item(x,y) in script call if you want to add item even
- # though the slot has reached it's max.
- #
- # Other configurations can be seen below
- # =============================================================================
- # ♫ TERMS OF USE :
- # - Credit me, TheoAllen.
- # - You may use and edit this script both for commercial and non-commercial or
- # even adult game as long as u don't claim it yours.
- # - I'll be glad if you give me a free copy of your game if you use this script
- # in your commercial project.
- # =============================================================================
- $imported = {} if $imported.nil?
- $imported["Theo-ItemSlots"] = true
- # =============================================================================
- # ♫ CONFIGURATIONS ~ ♫
- # =============================================================================
- module THEOLIZED
- module ITEMSLOTS
- # ---------- General Setting ---------------
- SLOTS_CURRENCY = "S" # Currency of slot
- DEFAULT_SLOTS = 400 # Default Maximum slots
- DYNAMIC_SLOTS = true # Maximum slots depens on notetags
- DISPLAY_WEIGHT = true # Display weight at shop processing and item menu
- # ---------- Shop Processing ---------------
- WEIGHT_VOCAB = "Weight" # Weight info for each item
- SLOTS_VOCAB = "Slots: " # Current slot info
- # ---------- Item Slots info ---------------
- MAXSLOT_VOCAB = "Max: " # Vocab for maximum slot
- USED_VOCAB = "Used: " # Vocab for used slot
- WEIGHT_INFO_VOCAB = "Wght: " # Vocab for item weight
- end
- end
- # =============================================================================
- # ♫ Do not edit unless you know what to do ~ ♫
- # =============================================================================
- # SCRIPT INFOS :
- # -------------------------------------
- # Rewriten method :
- # - Game_Party
- # def gain_item
- # def item_max?
- # - Scene_Shop
- # def max_buy
- # - Scene_Item
- # def create_item_window
- # - Scene_Equip
- # def create_item_window
- # -------------------------------------
- # Aliased method :
- # - DataManager
- # def load_database
- # - Window_ItemList
- # def refresh
- # def update_help
- # - Window_ShopNumber
- # def initialize
- # def set
- # def refresh
- # - Window_ShopStatus
- # def refresh
- # def draw_equip_info (YEA-ShopOptions compatibility patch)
- # - Scene_Menu
- # def start
- # - Scene_Item
- # def use_item
- # - Scene_Equip
- # def start
- # - Scene_Shop
- # def on_buy_ok
- # def on_sell_ok
- # -------------------------------------
- # New Classes :
- # - Window_ItemSlot
- # - Window_SlotInfo
- # =============================================================================
- # ♫ NOTETAG ~ ♫
- # =============================================================================
- module THEOLIZED
- module NOTETAGS_IS
- ITEM_WEIGHT = /<(?:WEIGHT|weight):[ ]*(\d+)>/i
- SLOT_PLUS = /<(?:SLOT PLUS|slot plus):[ ]*(\d+)>/i
- SLOT_MINUS = /<(?:SLOT MINUS|slot minus):[ ]*(\d+)>/i
- end # notetags
- end # theolized
- # =============================================================================
- # ♫ Module DataManager ~ ♫
- # =============================================================================
- module DataManager
- #--------------------------------------------------------------------------
- # ♫ Aliased load database
- #--------------------------------------------------------------------------
- class <<self; alias load_database_itemslots load_database; end #self
- def self.load_database
- load_database_itemslots
- load_theolized_is_notetags
- end
- #--------------------------------------------------------------------------
- # ♫ New method : load item slot notetag
- #--------------------------------------------------------------------------
- def self.load_theolized_is_notetags
- groups = [$data_items, $data_weapons, $data_armors, $data_actors, $data_states]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_theolized_is_notetags
- end # obj
- end # group
- end # load db
- end # datamanager
- # =============================================================================
- # ♫ RPG::Item ~ ♫
- # =============================================================================
- class RPG::Actor < RPG::BaseItem
- attr_accessor :slot_plus
- #--------------------------------------------------------------------------
- # ♫ New method : load item slot notetag
- #--------------------------------------------------------------------------
- def load_theolized_is_notetags
- @slot_plus = THEOLIZED::ITEMSLOTS::DEFAULT_SLOTS
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when THEOLIZED::NOTETAGS_IS::SLOT_PLUS
- @slot_plus = $1.to_i
- end
- } # -- note split --
- end
- end #RPG::Actor
- # =============================================================================
- # ♫ RPG::Item ~ ♫
- # =============================================================================
- class RPG::Item < RPG::UsableItem
- attr_accessor :weight
- attr_accessor :slot_plus
- #--------------------------------------------------------------------------
- # ♫ New method : load item slot notetag
- #--------------------------------------------------------------------------
- def load_theolized_is_notetags
- @weight = 1
- @slot_plus = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when THEOLIZED::NOTETAGS_IS::ITEM_WEIGHT
- @weight = $1.to_i
- when THEOLIZED::NOTETAGS_IS::SLOT_PLUS
- @weight = 0
- @slot_plus = $1.to_i
- end
- } # -- note split -- #
- end
- end
- # =============================================================================
- # ♫ RPG::EquipItem ~ ♫
- # =============================================================================
- class RPG::EquipItem < RPG::BaseItem
- attr_accessor :weight
- attr_accessor :slot_plus
- #--------------------------------------------------------------------------
- # ♫ New method : load equip slot notetags
- #--------------------------------------------------------------------------
- def load_theolized_is_notetags
- @weight = 1
- @slot_plus = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when THEOLIZED::NOTETAGS_IS::ITEM_WEIGHT
- @weight = $1.to_i
- when THEOLIZED::NOTETAGS_IS::SLOT_PLUS
- @slot_plus = $1.to_i
- end
- } # -- note split -- #
- end
- end
- # =============================================================================
- # ♫ RPG::States ~ ♫
- # =============================================================================
- class RPG::State < RPG::BaseItem
- attr_accessor :slot_plus
- attr_accessor :slot_minus
- #--------------------------------------------------------------------------
- # ♫ New method : load states slot notetags
- #--------------------------------------------------------------------------
- def load_theolized_is_notetags
- @slot_plus = 0
- @slot_minus = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when THEOLIZED::NOTETAGS_IS::SLOT_PLUS
- @slot_plus = $1.to_i
- when THEOLIZED::NOTETAGS_IS::SLOT_MINUS
- @slot_minus = $1.to_i
- end
- }
- end
- end
- # =============================================================================
- # ♫ Game_Party ~ ♫
- # =============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ♫ New method : Get maximum slots
- #--------------------------------------------------------------------------
- def max_slots_number
- if THEOLIZED::ITEMSLOTS::DYNAMIC_SLOTS
- total_slots = 0
- # ------- calculate additional slots for item each and party member ----- #
- all_members.each {|actor|
- total_slots += $data_actors[actor.id].slot_plus
- actor.equips.each {|equip|
- total_slots += equip.slot_plus unless equip.nil?
- }
- }
- # -------- calculate slots change in actor's states ---------------- #
- party_member = all_members.collect{|actor| actor.id}
- party_member.each {|id|
- $game_actors[id].states.each {|state|
- total_slots += state.slot_plus
- total_slots -= state.slot_minus
- }
- }
- return total_slots
- else
- return THEOLIZED::ITEMSLOTS::DEFAULT_SLOTS
- end
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Get avalaible slots
- #--------------------------------------------------------------------------
- def avalaible_slots
- max_slots_number - all_inventory_slots
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Get all used slots
- #--------------------------------------------------------------------------
- def all_inventory_slots
- value = inventory_slots(@items, $data_items)
- value += inventory_slots(@weapons, $data_weapons)
- value += inventory_slots(@armors, $data_armors)
- value += equip_slots
- return value
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Get used equips slots
- #--------------------------------------------------------------------------
- def equip_slots
- total_amount = 0
- all_members.each {|actor|
- actor.equips.each {|equip|
- total_amount += equip.weight unless equip.nil?
- }
- }
- return total_amount
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Get used slots
- #--------------------------------------------------------------------------
- def inventory_slots(inventory, type)
- total_amount = 0
- inventory.each do |id,amount|
- total_amount += amount * type[id].weight
- end
- return total_amount
- end
- #--------------------------------------------------------------------------
- # ♫ New method : force_gain_item
- #--------------------------------------------------------------------------
- def force_gain_item(item, amount)
- container = item_container(item.class)
- return unless container || amount == 0
- container[item.id] = 0 if container[item.id].nil?
- container[item.id] += amount
- container.delete(item.id) if container[item.id] <= 0
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ♫ Overwrite : Gain item
- #--------------------------------------------------------------------------
- def gain_item(item, amount, include_equip = false)
- container = item_container(item.class)
- return unless container || amount == 0
- container[item.id] = 0 if container[item.id].nil?
- container[item.id] += [amount, avalaible_slots/item.weight].min unless item_max?(item)
- container.delete(item.id) if container[item.id] <= 0
- if include_equip
- discard_members_equip(item, amount)
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ♫ Overwrite : Item max
- #--------------------------------------------------------------------------
- def item_max?(item)
- avalaible_slots < item.weight
- end
- #--------------------------------------------------------------------------
- # ♫ New Method : Get used slots
- #--------------------------------------------------------------------------
- def used_slots
- max_slots_number - avalaible_slots
- end
- end
- # =============================================================================
- # ♫ Window_Base ~ ♫
- # =============================================================================
- class Window_Base
- #--------------------------------------------------------------------------
- # ♫ Exclusive method for slot value
- #--------------------------------------------------------------------------
- def draw_slot_value(value, unit, x, y, width)
- cx = text_size(unit).width
- change_color(normal_color)
- draw_text(x, y, width - cx - 2, line_height, value, 2)
- change_color(system_color)
- draw_text(x, y, width, line_height, unit, 2)
- end
- end
- # =============================================================================
- # ♫ New class : Window_ItemSlots ~ ♫
- # =============================================================================
- class Window_ItemSlots < Window_Base
- #--------------------------------------------------------------------------
- # ♫ Object initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, window_width, fitting_height(1))
- refresh
- end
- #--------------------------------------------------------------------------
- # ♫ Get window width
- #--------------------------------------------------------------------------
- def window_width
- return 160
- end
- #--------------------------------------------------------------------------
- # ♫ Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_slot_value(value, slots_currency, 4, 0, contents.width - 8)
- end
- #--------------------------------------------------------------------------
- # ♫ Get party avalaible slots
- #--------------------------------------------------------------------------
- def value
- return $game_party.used_slots.to_s + '/' + $game_party.max_slots_number.to_s
- end
- #--------------------------------------------------------------------------
- # ♫ Get slots currency
- #--------------------------------------------------------------------------
- def slots_currency
- THEOLIZED::ITEMSLOTS::SLOTS_CURRENCY
- end
- #--------------------------------------------------------------------------
- # ♫ Open window
- #--------------------------------------------------------------------------
- def open
- refresh
- super
- end
- end
- # =============================================================================
- # ♫ New class : Window_SlotInfo ~ ♫
- # =============================================================================
- class Window_SlotInfo < Window_Base
- #--------------------------------------------------------------------------
- # ♫ Object initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,width,fitting_height(1))
- @item = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ♫ Get window width
- #--------------------------------------------------------------------------
- def width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # ♫ Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_all_info_slot
- end
- #--------------------------------------------------------------------------
- # ♫ Draw all slots info
- #--------------------------------------------------------------------------
- def draw_all_info_slot
- if THEOLIZED::ITEMSLOTS::DISPLAY_WEIGHT
- w = width / 3
- draw_max_slot(0,w)
- draw_used_slot(w,w)
- draw_weight_info(w+w,w)
- else
- w = width / 2
- draw_max_slot(0,w)
- draw_used_slot(w,w)
- end
- end
- #--------------------------------------------------------------------------
- # ♫ Draw maximum slots
- #--------------------------------------------------------------------------
- def draw_max_slot(x,width)
- draw_info(maxslots,THEOLIZED::ITEMSLOTS::MAXSLOT_VOCAB,4+x,0,width)
- end
- #--------------------------------------------------------------------------
- # ♫ Draw used slots
- #--------------------------------------------------------------------------
- def draw_used_slot(x,width)
- draw_info(used_slots,THEOLIZED::ITEMSLOTS::USED_VOCAB,4+x,0,width)
- end
- #--------------------------------------------------------------------------
- # ♫ Draw item weight
- #--------------------------------------------------------------------------
- def draw_weight_info(x,width)
- draw_info(@item.nil? ? 0 : @item,THEOLIZED::ITEMSLOTS::WEIGHT_INFO_VOCAB,4+x,0,width)
- end
- #--------------------------------------------------------------------------
- # ♫ Draw slot info
- #--------------------------------------------------------------------------
- def draw_info(value, unit, x, y, width)
- cx = text_size(unit).width
- change_color(normal_color)
- draw_text(x, y, width - cx - 2, line_height, value, 2)
- change_color(system_color)
- draw_text(x, y, width, line_height, unit, 0)
- end
- #--------------------------------------------------------------------------
- # ♫ Get maximum slots
- #--------------------------------------------------------------------------
- def maxslots
- $game_party.max_slots_number
- end
- #--------------------------------------------------------------------------
- # ♫ Get used slots
- #--------------------------------------------------------------------------
- def used_slots
- $game_party.used_slots
- end
- #--------------------------------------------------------------------------
- # ♫ Set weight info
- #--------------------------------------------------------------------------
- def set_item(item)
- item ? @item = item.weight : @item = 0
- refresh
- end
- end
- # =============================================================================
- # ♫ Window_ItemList ~ ♫
- # =============================================================================
- class Window_ItemList < Window_Selectable
- attr_accessor :slots_info
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Update help
- #--------------------------------------------------------------------------
- alias theo_update_help update_help
- def update_help
- theo_update_help
- @slots_info.set_item(item)
- end
- end
- # =============================================================================
- # ♫ Window_EquipSlot ~ ♫
- # =============================================================================
- class Window_EquipSlot < Window_Selectable
- attr_accessor :slots_info
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Update help
- #--------------------------------------------------------------------------
- alias theo_update_help update_help
- def update_help
- theo_update_help
- @slots_info.set_item(item) if @slots_info
- end
- end
- # =============================================================================
- # ♫ Window_EquipItem ~ ♫
- # =============================================================================
- class Window_EquipItem < Window_ItemList
- attr_accessor :slots_info
- #--------------------------------------------------------------------------
- # ♫ Normalized method : Update help
- #--------------------------------------------------------------------------
- def update_help
- theo_update_help
- @slots_info.set_item(item)
- end
- end
- # =============================================================================
- # ♫ Window_ShopSell ~ ♫
- # =============================================================================
- class Window_ShopSell < Window_ItemList
- #--------------------------------------------------------------------------
- # ♫ Normalized method : Update help
- #--------------------------------------------------------------------------
- def update_help
- theo_update_help
- end
- end
- # =============================================================================
- # ♫ Window_ShopStatus ~ ♫
- # =============================================================================
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # ♫ Manually aliased method : Refresh
- #--------------------------------------------------------------------------
- def theo_refresh
- contents.clear
- draw_possession(4, 0)
- draw_equip_info(4, line_height * 2) if @item.is_a?(RPG::EquipItem)
- end
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Refresh
- #--------------------------------------------------------------------------
- def refresh
- theo_refresh
- draw_item_weight(4,line_height) if THEOLIZED::ITEMSLOTS::DISPLAY_WEIGHT
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Draw item weight
- #--------------------------------------------------------------------------
- def draw_item_weight(x,y)
- rect = Rect.new(x,y,contents.width - 4 - x, line_height)
- change_color(system_color)
- draw_text(rect,THEOLIZED::ITEMSLOTS::WEIGHT_VOCAB)
- change_color(normal_color)
- draw_text(rect,!@item.nil? ? @item.weight : 0,2)
- end
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Draw equip info
- #--------------------------------------------------------------------------
- alias theolized_equip_info draw_equip_info
- def draw_equip_info(dx, dy)
- if $imported["YEA-ShopOptions"]
- status_members.each_with_index do |actor, i|
- draw_actor_equip_info(dx, dy + line_height * i, actor)
- end
- else
- theolized_equip_info
- end
- end
- end
- # =============================================================================
- # ♫ Window_ShopNumber ~ ♫
- # =============================================================================
- class Window_ShopNumber < Window_Selectable
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Initialize
- #--------------------------------------------------------------------------
- alias theo_is_init initialize
- def initialize(x, y, height)
- theo_is_init(x, y, height)
- @slots = "0/0"
- @slots_temp = 0
- end
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Set item
- #--------------------------------------------------------------------------
- alias theolized_set set
- def set(item, max, price, currency_unit = nil)
- theolized_set(item, max, price, currency_unit)
- slot_refresh
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Get slot currency
- #--------------------------------------------------------------------------
- def slots_currency
- THEOLIZED::ITEMSLOTS::SLOTS_CURRENCY
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Get slot vocab
- #--------------------------------------------------------------------------
- def slots_vocab
- THEOLIZED::ITEMSLOTS::SLOTS_VOCAB
- end
- #--------------------------------------------------------------------------
- # ♫ Aliased method : refresh
- #--------------------------------------------------------------------------
- alias theolized_is_refresh refresh
- def refresh
- theolized_is_refresh
- slot_refresh
- draw_slot_info
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Draw slot info
- #--------------------------------------------------------------------------
- def draw_slot_info
- width = contents_width - 8
- if $imported["YEA-ShopOptions"]
- draw_slot_value(@slots,slots_currency,4,price_y+(line_height*4),width)
- draw_text(4,price_y+(line_height*4), width, line_height, slots_vocab)
- else
- draw_slot_value(@slots,slots_currency,4,price_y+(line_height*2),width)
- draw_text(4,price_y+(line_height*2), width, line_height, slots_vocab)
- end
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Set weight slot
- #--------------------------------------------------------------------------
- def set_slot(number)
- @slots_temp = number
- refresh
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Refresh slot
- #--------------------------------------------------------------------------
- def slot_refresh
- temp = $game_party.max_slots_number
- temp2 = $game_party.used_slots+(@slots_temp * @number)
- @slots = temp2.to_s + '/' + temp.to_s
- end
- end
- # =============================================================================
- # ♫ Scene_Menu ~ ♫
- # =============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ♫ Aliased start
- #--------------------------------------------------------------------------
- alias theo_itemslot_start start
- def start
- theo_itemslot_start
- create_itemslot_window
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Create item slots window
- #--------------------------------------------------------------------------
- def create_itemslot_window
- @slot_window = Window_ItemSlots.new
- @slot_window.x = 0
- @slot_window.y = Graphics.height - (@gold_window.height + @slot_window.height)
- end
- end
- # =============================================================================
- # ♫ Scene_Item ~ ♫
- # =============================================================================
- class Scene_Item < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Start
- #--------------------------------------------------------------------------
- alias theo_itemslots_start start
- def start
- theo_itemslots_start
- create_slotinfo_window
- end
- #--------------------------------------------------------------------------
- # ♫ New method : Create slot info window
- #--------------------------------------------------------------------------
- def create_slotinfo_window
- wy = @help_window.height + @category_window.height + @item_window.height
- @window_slotsinfo = Window_SlotInfo.new
- @window_slotsinfo.y = wy
- @window_slotsinfo.viewport = @viewport
- @item_window.slots_info = @window_slotsinfo
- end
- #--------------------------------------------------------------------------
- # ♫ Overwrite : Create item window
- #--------------------------------------------------------------------------
- def create_item_window
- wy = @category_window.y + @category_window.height
- wh = Graphics.height - wy - (24*2)
- @item_window = Window_ItemList.new(0, wy, Graphics.width, wh)
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @category_window.item_window = @item_window
- end
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Use item
- #--------------------------------------------------------------------------
- alias theolized_use_item use_item
- def use_item
- theolized_use_item
- @window_slotsinfo.refresh
- end
- end
- # =============================================================================
- # ♫ Scene_Equip ~ ♫
- # =============================================================================
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ♫ Aliased method : start
- #--------------------------------------------------------------------------
- alias theolized_is_start start
- def start
- theolized_is_start
- create_slotinfo_window
- end
- #--------------------------------------------------------------------------
- # ♫ New method : create slot info window
- #--------------------------------------------------------------------------
- def create_slotinfo_window
- wy = @help_window.height + @status_window.height + @item_window.height
- @window_slotsinfo = Window_SlotInfo.new
- @window_slotsinfo.y = wy
- @window_slotsinfo.viewport = @viewport
- @item_window.slots_info = @window_slotsinfo
- @slot_window.slots_info = @window_slotsinfo
- end
- #--------------------------------------------------------------------------
- # ♫ Overwrite : Create item window
- #--------------------------------------------------------------------------
- def create_item_window
- wx = 0
- wy = @slot_window.y + @slot_window.height
- ww = Graphics.width
- wh = Graphics.height - wy - (24*2)
- @item_window = Window_EquipItem.new(wx, wy, ww, wh)
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.status_window = @status_window
- @item_window.actor = @actor
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @slot_window.item_window = @item_window
- end
- end
- # =============================================================================
- # ♫ Scene_Shop ~ ♫
- # =============================================================================
- class Scene_Shop < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Sell OK
- #--------------------------------------------------------------------------
- alias theolized_sell_ok on_sell_ok
- def on_sell_ok
- theolized_sell_ok
- @number_window.set_slot(-@item.weight)
- end
- #--------------------------------------------------------------------------
- # ♫ Aliased method : Buy OK
- #--------------------------------------------------------------------------
- alias theolized_buy_ok on_buy_ok
- def on_buy_ok
- theolized_buy_ok
- @number_window.set_slot(@item.weight)
- end
- #--------------------------------------------------------------------------
- # ♫ Overwrite : max buying item
- #--------------------------------------------------------------------------
- def max_buy
- check_slot = $game_party.avalaible_slots > @item.weight
- check_slot ? max = $game_party.avalaible_slots / @item.weight : max = 0
- buying_price == 0 ? max : [max, money / buying_price].min
- end
- end
- # =============================================================================
- # ♫ Outside of class ~ ♫
- # =============================================================================
- def force_gain_item(item, amount)
- $game_party.force_gain_item(item, amount)
- end
- # =============================================================================
- # ♫ End of script ~ ♫
- # =============================================================================
Add Comment
Please, Sign In to add comment