Invité Invité
| Sujet: [VX] Inventaire limité Jeu 18 Aoû 2011 - 23:15 | |
| Limitation des objets Description: Limite les objets dans le menu "objet" Auteur: modern algebra Instruction: Placer le script eu dessus de main Screen: Script: - Code:
-
#============================================================================== # SCRIPT DE INVENTÁRIO LIMITADO # Versão: 1.1c # Autor: modern algebra # Traduzido por: Krmona # Data: 27 de setembro de 2009 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Descrição: # Este script lhe permite criar um inventário com uma capacidade máxima de # itens configurável além de um sistema de baú também limitado e a opção de # jogar itens fora ou destruí-los #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Instruções: # Cole esse script acima de Main # # As regiões editáveis estão nas linhas: #=== 62 à 73 #=== Nome das constantes do script # #=== 93 à 96 #=== Efeitos sonoros das ações no script # #=== 118 à 121 #=== Dados gerais como capacidade máxima # # Para que um item não possa ser jogado fora, vá até seu Histórico e digite: # # \NONDISCARD # # Para que um item, fuja do padrão da linha 118 do script, vá até ele no Banco # de Dados e digite em seu Histórico: # # \STACKMAX[x] # # Sendo X o valor que determinará a capacidade máxima do mesmo sem que ele ocupe 2 ou + slots # # Para mudar a carga máxima de um inventário basta que você crie um evento e # ponha em # Chamar Script: # # resize_inventory (x) # # Sendo X a carga máxima que o baú poderá suportar. #==============================================================================
#============================================================================== # *** Vocab #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Sumário: # Constantes - MA_LOOT_LABEL, MA_COMMAND_DISCARD, MA_COMMAND_EXCHANGE, # MA_AMOUNT_PREFIX, MA_COMMAND_USE, MA_COMMAND_DESTROY, # MA_WARNING_LABEL, MA_WARNING_YES, MA_WARNING_NO #==============================================================================
module Vocab #========================================================================== # * Constants #========================================================================== #////////////////////////////////////////////////////////////////////////// # Nome das constantes #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MA_AMOUNT_PREFIX = "x" # Prefixo de quantidade do item MA_LOOT_LABEL = "Descartar" # Nome da aba de descarte MA_COMMAND_DISCARD = "Jogar Fora" # Comando para jogar itens fora MA_COMMAND_EXCHANGE = "Guardar" # Nome do botão de guardar itens MA_COMMAND_TAKE = "Pegar" # Pegar itens MA_COMMAND_USE = "Usar" # Usar um item MA_COMMAND_DESTROY = "Destruir" # Destruir item (quase inutil tendo o Descartar) # Question printed when deciding whether or not to leave inventory when loot # still has items in it MA_WARNING_LABEL = "#{MA_COMMAND_DESTROY} todos os itens #{MA_LOOT_LABEL}?" MA_WARNING_YES = "Sim" # Sair do inventário (confirmação) MA_WARNING_NO = "Não" # Continua no inventário caso você tenha clicado em sair sem querer #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ # Fim da nomeação das constantes #////////////////////////////////////////////////////////////////////////// end
#============================================================================== # *** Som #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Sumário: # Constantes - MA_DISCARD_SE, MA_EXCHANGE_SE, MA_TAKE_SE, MA_DESTROY_SE #==============================================================================
module Sound #========================================================================== # * Constantes #========================================================================== #////////////////////////////////////////////////////////////////////////// # Escolha o nome dos sons #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MA_DISCARD_SE = "Move" # SE que toca quando você joga um item fora MA_EXCHANGE_SE = "Move" # SE que toca quando você guarda um item no baú MA_TAKE_SE = "Equip" # SE que toca quando você pega um item MA_DESTROY_SE = "Close1" # SE que toca quando você destrói um item #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ # Fim da escolha dos sons #////////////////////////////////////////////////////////////////////////// end
#============================================================================== # *** RPG #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Sumário: # Constantes - MA_DEFAULT_STACK_AMOUNT, MA_DEFAULT_INVENTORY_SIZE, # MA_EMPTYSLOTS_ICON_ID, MA_WARN_WINDOW # Classses Modificadas - BaseItem #==============================================================================
module RPG #========================================================================== # * Constantes #========================================================================== #////////////////////////////////////////////////////////////////////////// # Escolha as opções gerais #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MA_DEFAULT_STACK_AMOUNT = 3 # Quantidade máxima de um mesmo item para que ele seja considerado "2" no inventário MA_DEFAULT_INVENTORY_SIZE = 18 # Quantidade máxima de itens no inventário MA_EMPTYSLOTS_ICON_ID = 144 # ID do ícone nos slots vazios MA_WARN_WINDOW = true # Deseja que, quando for sair do inventário, apareça a mensagem de confirmação: Deseja mesmo sair? #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ # Fim da seleção #////////////////////////////////////////////////////////////////////////// #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ # \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #== FIM DAS CONFIGURAÇÕES - INÍCIO DO SCRIPT | # ////////////////////////////////////////////////////////////////////////// #////////////////////////////////////////////////////////////////////////// #========================================================================== # ** BaseItem #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Sumário: # Métodos - ma_stack_amount, ma_discardable? #========================================================================== class BaseItem #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Stack Amount #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def ma_stack_amount return self.note[/\\STACKMAX\[(\d+)\]/i] != nil ? $1.to_i : RPG::MA_DEFAULT_STACK_AMOUNT end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Non-Discardable #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def ma_discardable? return self.note[/\\NONDISCARD/i] == nil end end end
#============================================================================== # ** Game Temp #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # new public instance variables - slots_to_discard #==============================================================================
class Game_Temp #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variables #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_reader :slots_to_discard # A Game_LimitedInventory object #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias algmod_grafikal009_init_tmp_lim_inventory_94n6 initialize def initialize # Run Original method algmod_grafikal009_init_tmp_lim_inventory_94n6 # Create Inventory object @slots_to_discard = Game_LimitedInventory.new (-1) end end
#============================================================================== # ** Game LimInvSlot #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This class holds the data on a single slot of the inventory #==============================================================================
class Game_LimInvSlot #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variables #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_reader :item_type # The type of item held in this slot attr_reader :item_id # The ID of the item currently held attr_reader :amount # The number of items this slot holds #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def initialize @item_type = -1 @item_id = 0 @amount = 0 end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Add Item # n : the amount to add # item_type : the type of item being added # item_id : the ID of item being added #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def add_item (n, item_type = -1, item_id = 0) # Set item if that is sent through if item_type != -1 @item_type = item_type @item_id = item_id end x = space_left # Check amount if n > x # If more given than can fit @amount += x return n - x else # If the n given will fit @amount += n return 0 end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Remove Item # n : the amount to remove #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def remove_item (n) @amount -= n if @amount <= 0 n = -1*@amount # Delete item from this slot @item_type = -1 @item_id = 0 @amount = 0 return n end return 0 end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Item #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def item return case @item_type when -1 then nil # No item stored when 0 then $data_items[@item_id] # Item when 1 then $data_weapons[@item_id] # Weapon when 2 then $data_armors[@item_id] # Armour end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Space Left #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def space_left return 1 if item == nil return item.ma_stack_amount - @amount end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Equal? # other : another Game_LimInvSlot #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def == (other) return false if !other.is_a? (Game_LimInvSlot) return false if other.item_type != @item_type return false if other.item_id != @item_id return false if other.amount != @amount return super (other) end end
#============================================================================== # ** Game_LimitedInventory #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This is an array to store the party's inventory #==============================================================================
class Game_LimitedInventory #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variable #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_reader :max_size # The maximum number of slots. If -1, infinite. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization # size : the number of slots available #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def initialize (size) @max_size = size clear end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Clear #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def clear @items = [] @weapons = [] @armors = [] end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Resize # size : the number of slots available #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def resize (size) old_size = slots.size # If new size is smaller if size < old_size # Save discarded items index = slots.size - 1 while slots.size > @max_size slot = slots[index] if slot.item.ma_discardable? type, id, n = slot.item_type, slot.item_id, slot.amount # Discard additional slots remove_item (type, id, n) $game_temp.slots_to_discard.add_item (type, id, n) else index -= 1 end break if index < 0 end end @max_size = size end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Add Item # type : the type of item being added # id : the ID of item being added # n : the amount to add #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def add_item (type, id, n = 1) array = case type when 0 then @items when 1 then @weapons when 2 then @armors end sort_index = 0 # Go through all slots array.each { |slot| # If you can place the item in this slot if slot.item_id == id n = slot.add_item (n, type, id) break if n == 0 sort_index += 1 elsif slot.item_id < id sort_index += 1 else break end } if n > 0 # If there are empty slots while @max_size == -1 || ((@items.size + @weapons.size + @armors.size) < @max_size) slot = Game_LimInvSlot.new n = slot.add_item (n, type, id) array.insert (sort_index, slot) sort_index += 1 break if n == 0 end end return n end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Remove Item # type : the type of item being removed # id : the ID of item being removed # n : the amount to remove #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def remove_item (type, id, n = 1) array = case type when 0 then @items when 1 then @weapons when 2 then @armors end # Go through all slots in reverse order array.reverse.each { |slot| # If this slot has the right item in it, remove from this slot if slot.item_type == type && slot.item_id == id n = slot.remove_item (n) array.delete (slot) if slot.amount == 0 break if n == 0 end } return n end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Get Item Slots #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def slots return @items + @weapons + @armors end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Check Space # item : an RPG::Item, RPG::Weapon, or RPG::Armor object #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def enough_space? (slot) return true if @max_size == -1 || slots.size < @max_size # Check array for other instances of the item array = [@items, @weapons, @armors][slot.item_type] array.each { |i| if i.item_id > slot.item_id break elsif i.item_id == slot.item_id return true if i.space_left < slot.item.ma_stack_amount end } return false end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Equals? #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def == (other) return false unless other.is_a? (Game_LimitedInventory) return false if @max_size != other.max_size return false if slots != other.slots return super (other) end end
#============================================================================== # ** Game Actor #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased method - change_equip #==============================================================================
class Game_Actor #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Change Equip #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mdrnalgbra_gkl009_invlimits_cng_eqp_82h4 change_equip def change_equip (*args) # Run Original Method mdrnalgbra_gkl009_invlimits_cng_eqp_82h4 (*args) # Since you gain items before you lose them, check if item is Loot when it # could be in Party inventory if !$game_temp.slots_to_discard.slots.empty? # Take as many from loot as possible $game_temp.slots_to_discard.slots.reverse.each { |slot| break unless $game_party.limit_inventory.enough_space? (slot) item, type, id, n = slot.item, slot.item_type, slot.item_id, slot.amount $game_party.gain_item (item, n) $game_temp.slots_to_discard.remove_item (type, id, n) } end end end
#============================================================================== # ** Game Party #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # new instance variable - limit_inventory # aliased methods - initialize, gain_item #==============================================================================
class Game_Party #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variables #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_reader :limit_inventory # A Game_LimitedInventory object #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias modlg_lm_inv_grafkal_init_4n56 initialize def initialize # Run Original method modlg_lm_inv_grafkal_init_4n56 # Create Inventory object @limit_inventory = Game_LimitedInventory.new (RPG::MA_DEFAULT_INVENTORY_SIZE) end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Gain Items (or lose) # item : Item # n : Number # include_equip : Include equipped items #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias drnlgbr_grafikal_limited_inventory_gn_itm_94n6 gain_item def gain_item(item, n, include_equip = false) # Run Original method drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (item, n, include_equip) if item != nil type = item.is_a? (RPG::Item) ? 0 : item.is_a? (RPG::Weapon) ? 1 : 2 # Gain or lose item depending on everything. if n > 0 n2 = @limit_inventory.add_item (type, item.id, n) n -= n2 # If it is a nondiscardable item and you cannot hold all of them if !item.ma_discardable? while n2 > 0 # Find first nondiscardable item in the inventory for i in 0...@limit_inventory.slots.size slot = @limit_inventory.slots[i] if slot.item.ma_discardable? l_type, id = slot.item_type, slot.item_id # Find smallest slot of that item while l_type == slot.item_type && id == slot.item_id i += 1 slot = @limit_inventory.slots[i] end l_item, l_n = @limit_inventory.slots[i - 1].item, @limit_inventory.slots[i - 1].amount break end end # Remove that item from inventory lose_item (l_item, l_n) $game_temp.slots_to_discard.add_item (l_type, id, l_n) n3 = @limit_inventory.add_item (type, item.id, n2) n -= n3 n2 = n3 end end else n2 = @limit_inventory.remove_item (type, item.id, -1*n) n += n2 n2 *= -1 end end return if item == nil # Send rest to loot if n2 > 0 $game_temp.slots_to_discard.add_item (type, item.id, n2) elsif n2 < 0 $game_temp.slots_to_discard.remove_item (type, item.id, -1*n2) end end end
#============================================================================== # ** Game Interpreter #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased method - command_end # new method - resize_inventory #==============================================================================
class Game_Interpreter #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Resize Inventory # new_size : the size you now want the inventory to be #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def resize_inventory (new_size) $game_party.limit_inventory.resize (new_size) end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Command End #`````````````````````````````````````````````````````````````````````````` # If there are items in $game_temp.loot, open up the inventory #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias modalg_grid_inventory_open_inventory_end_command command_end def command_end # Run Original Method modalg_grid_inventory_open_inventory_end_command unless $game_temp.slots_to_discard.slots.empty? $scene = Scene_Item.new end end end
#============================================================================== # ** Window Item #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # overwritten methods - draw_item, item_rect # aliased method - item, refresh, dispose, top_row= #==============================================================================
class Window_Item #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Refresh #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mdrnalg_gral9_ivntlim_rfrsh_2n45 refresh def refresh (inventory = $game_party.limit_inventory, columns = @column_max) if self.is_a? (Window_EquipItem) mdrnalg_gral9_ivntlim_rfrsh_2n45 return end @is_loot = inventory == $game_temp.slots_to_discard @spacing = 32 @data = [] @empty_sprites.each { |sprite| sprite.dispose } unless @empty_sprites == nil @empty_sprites = [] @column_max = columns for slot in inventory.slots next unless include?(slot.item) @data.push(slot) if slot.item.is_a?(RPG::Item) and slot.item_id == $game_party.last_item_id self.index = @data.size - 1 end end @item_max = inventory.max_size == -1 ? @data.size : inventory.max_size create_contents # Calculate number of empty slots to draw empty_slots = (inventory.max_size == -1 || !$scene.is_a? (Scene_Item)) ? 0 : inventory.max_size - inventory.slots.size @wlh = (self.contents.height * @column_max) / ([@data.size + empty_slots, 1].max) @wlh = @wlh > 32 ? 32 : @wlh < WLH ? WLH : @wlh for i in 0...@data.size draw_item(i) end sprite_viewport = Viewport.new (self.x + 16, self.y + 16, self.width - 32, self.height - 32) viewport_adjusted = false for i in @data.size...empty_slots + @data.size rect = item_rect (i) if rect.y + rect.height > page_row_max*@wlh && !viewport_adjusted sprite_viewport.rect.height = rect.y viewport_adjusted = true end sprite = Sprite_Base.new (sprite_viewport) sprite.x, sprite.y = rect.x, rect.y sprite.visible = self.visible sprite.blend_type = 2 empty_bmp = Bitmap.new (rect.width, rect.height) if empty_bmp == nil sprite.bitmap = empty_bmp.dup sprite.bitmap.fill_rect (0, 1, rect.width, rect.height - 2, Color.new (127, 127, 127, 105)) @empty_sprites.push (sprite) end empty_bmp.dispose unless empty_bmp == nil end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Item Rect #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def item_rect (index) wlh = @wlh == nil ? WLH : @wlh rect = Rect.new(0, 0, 0, 0) rect.width = (contents.width + @spacing) / @column_max - @spacing rect.height = wlh rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * wlh return rect end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Set Top Row # row : row shown on top #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def top_row=(row) old_oy = self.oy super (row) @empty_sprites.each { |sprite| sprite.y -= (self.oy - old_oy) } end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Draw Item # index : item number #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mdrnalgbr_rfl009_limitedinvntry_drwitm_2hd4 draw_item def draw_item(index) if self.is_a? (Window_EquipItem) mdrnalgbr_rfl009_limitedinvntry_drwitm_2hd4 (index) return end rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index].item if item != nil n = @data[index].amount enabled = @is_loot ? true : enable?(item) rect.width -= 4 y = rect.y + ((rect.height - WLH) / 2) draw_item_name(item, rect.x, y, enabled) self.contents.draw_text(rect, sprintf("#{Vocab::MA_AMOUNT_PREFIX}%2d", n), 2) unless n < 2 end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Get Item #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias ma_grfkl_lim_nvtry_item_8rn item def item return ma_grfkl_lim_nvtry_item_8rn if self.is_a? (Window_EquipItem) return ma_grfkl_lim_nvtry_item_8rn == nil ? nil : ma_grfkl_lim_nvtry_item_8rn.item end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Sprite Disposal #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def dispose super @empty_sprites.each { |sprite| sprite.dispose } unless self.is_a? (Window_EquipItem) end end
#============================================================================== # ** Window_EmptyCount #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This window displays the number of free slots in the inventory. #==============================================================================
class Window_EmptyCount < Window_Base #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization # inventory : a Game_LimitedInventory object #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def initialize (inventory = $game_party.limit_inventory) super(Graphics.width - 128, 0, 128, WLH + 32) self.opacity = 0 refresh (inventory) end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Refresh # inv : a Game_LimitedInventory object #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def refresh (inv) self.contents.clear # Draw Icon empty_slots = inv.max_size == -1 ? "8" : (inv.max_size - inv.slots.size).to_s tw = self.contents.text_size (empty_slots).width self.contents.draw_text (0, 0, 96, WLH, empty_slots, 2) draw_icon (RPG::MA_EMPTYSLOTS_ICON_ID, 68 - tw, 0) end end
#============================================================================== # ** Window_InvCommand #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This is a Window_Command, specialized to allow for frequent resetting of the # commands #==============================================================================
class Window_InvCommand < Window_Command #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Reset Commands #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def reset_commands (commands) @commands = commands @item_max = commands.size row_max = (commands.size + @column_max - 1) / @column_max self.height = (row_max*WLH) + 32 self.create_contents refresh end end
#============================================================================== # ** Window Warning #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This window checks before destroying slot items #==============================================================================
class Window_Warning < Window_Selectable #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def initialize x = (Graphics.width - 256) / 2 y = (Graphics.height - (32 + 2*WLH)) / 2 super (x, y, 256, 32 + 2*WLH) @item_max = 2 @column_max = 2 @index = 1 create_contents # Draw Warning Label self.contents.draw_text (0, 0, contents.width, WLH, Vocab::MA_WARNING_LABEL, 1) # Draw Yes and No Options index = 0 [Vocab::MA_WARNING_YES, Vocab::MA_WARNING_NO].each { |command| rect = item_rect (index) self.contents.draw_text (rect, command, 1) index += 1 } end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Get rectangle for displaying items # index : item number #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = (self.contents.width / 4) - 10 rect.height = WLH rect.x = rect.width + (index*(20 + rect.width)) rect.y = WLH return rect end end
#============================================================================== # ** Scene Equip #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased method - return_scene #==============================================================================
class Scene_Equip #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Return Scene #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias rnalbr_grafikal009_invlimits_rtrn_scn_eqp_4wk4 return_scene def return_scene if $game_temp.slots_to_discard.slots.empty? rnalbr_grafikal009_invlimits_rtrn_scn_eqp_4wk4 else $scene = Scene_Item.new end end end
#============================================================================== # ** Scene Battle #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased method - battle_end #==============================================================================
class Scene_Battle #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * End Battle # result : Results (0: win, 1: escape, 2:lose) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mrnagbr_gkal009_vntrylim_bttlend_5dm4 battle_end def battle_end(result) # Run original Method mrnagbr_gkal009_vntrylim_bttlend_5dm4 (result) if !$game_temp.slots_to_discard.slots.empty? && !$scene.is_a? (Scene_Gameover) $scene = Scene_Item.new end end end
#============================================================================== # ** Scene Item #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased methods - start, terminate #==============================================================================
class Scene_Item #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Start processing #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def start super create_menu_background @activated_frame = false @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) @help_window = Window_Help.new @help_window.width = Graphics.width @help_window.viewport = @viewport wlh = Window_Base::WLH @item_window = Window_Item.new(0, 32 + wlh, Graphics.width, Graphics.height - 32 - wlh) @item_window.help_window = @help_window @item_window.active = false @item_window.viewport = @viewport @active_window = @item_window @target_window = Window_MenuStatus.new(0, 0) @target_window.x = Graphics.width - @target_window.width @target_window.height = Graphics.height @target_window.z = 150 hide_target_window # Create Empty Counter @emptycount_window = Window_EmptyCount.new @emptycount_window.viewport = @viewport # Create Loot Window wdth = Graphics.width / 2 hght = Graphics.height - 64 - 2*wlh @loot_window = Window_Item.new (wdth, 64 + (2*wlh), wdth, hght) @loot_window.index = -1 @loot_window.viewport = @viewport # Create Loot Label Window @lootlabel_window = Window_Base.new (wdth, 32 + wlh, wdth, 32 + wlh) @lootlabel_window.visible = false @lootlabel_window.contents.font.color = @lootlabel_window.system_color @lootlabel_window.contents.draw_text (0, 0, 240, wlh, Vocab::MA_LOOT_LABEL, 1) @lootlabel_window.viewport = @viewport commands = [Vocab::MA_COMMAND_USE, Vocab::MA_COMMAND_DISCARD] @command_window = Window_InvCommand.new (160, commands) @command_window.visible = false @command_window.active = 0 @loot_window.active = false # If no loot, hide the window if $game_temp.slots_to_discard.slots.empty? @loot_window.visible = false @loot_window.refresh ($game_temp.slots_to_discard, 1) @overloaded_initially = false else show_loot @overloaded_initially = true end @last_index = $game_party.last_item_id end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Return Scene #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias malg_grfk_inventoy_lmt_rtrnscn_1h45 return_scene def return_scene # If Still items left in Loot if RPG::MA_WARN_WINDOW && !$game_temp.slots_to_discard.slots.empty? # Give warning @warning_window = Window_Warning.new return end if @overloaded_initially $scene = Scene_Map.new else # Run Original Method malg_grfk_inventoy_lmt_rtrnscn_1h45 end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Show Target Window # right : Right justification flag (if false, left justification) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def show_target_window(right) right = @loot_window.visible ? @active_window == @item_window : right @item_window.active = false width_remain = Graphics.width - @target_window.width @target_window.x = right ? width_remain : 0 @target_window.visible = true @target_window.active = true if right @viewport.rect.set(0, 0, width_remain, @target_window.height) @viewport.ox = 0 else @viewport.rect.set(@target_window.width, 0, width_remain, @target_window.height) @viewport.ox = @target_window.width end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Hide Target Window #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def hide_target_window @item_window.active = true @target_window.visible = false @target_window.active = false @viewport.rect.set(0, 0, Graphics.width, Graphics.height) @viewport.ox = 0 end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Termination processing #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mdlg_graf009_invlimit_trmnte_itemscene_5bd3 terminate def terminate (*args) # Run Original Method mdlg_graf009_invlimit_trmnte_itemscene_5bd3 (*args) # Dispose of new windows @emptycount_window.dispose @loot_window.dispose @lootlabel_window.dispose @command_window.dispose end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Update Frame #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias malg_gfl009_limitedinventory_upt_2h45 update def update # If Warning Window Active if @warning_window != nil update_warning_window return end malg_gfl009_limitedinventory_upt_2h45 @loot_window.update @command_window.update if @activated_frame @activated_frame = false return end if @loot_window.active update_item_selection elsif @command_window.active update_command_selection end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Update Item Selection #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias moal_rfkl9_invntr_limit_upditmselect_1hr4 update_item_selection def update_item_selection @command_window.visible = false if @command_window.visible # Switch between windows by pressing Left or Right if @loot_window.visible && (Input.trigger? (Input::LEFT) || Input.trigger? (Input::RIGHT)) Sound.play_cursor @active_window.index = -1 loot_window_active = @loot_window.active @active_window.active = false @active_window = loot_window_active ? @item_window : @loot_window @active_window.active = true @active_window.index = 0 @activated_frame = true end # IF ESC pressed if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) # If exchanging if @loot_window.index > -1 && @item_window.active slot = @active_window.ma_grfkl_lim_nvtry_item_8rn slot2 = @loot_window.ma_grfkl_lim_nvtry_item_8rn type, id, n = slot2.item_type, slot2.item_id, slot2.amount if slot != nil if !slot.item.ma_discardable? # Undiscardable Item Sound.play_buzzer return else type2, id2, n2 = slot.item_type, slot.item_id, slot.amount $game_temp.slots_to_discard.add_item (type2, id2, n2) $game_party.limit_inventory.remove_item (type2, id2, n2) end end $game_party.limit_inventory.add_item (type, id, n) $game_temp.slots_to_discard.remove_item (type, id, n) RPG::SE.new (Sound::MA_EXCHANGE_SE).play check_to_hide_loot @loot_window.active = false @loot_window.index = -1 else # If selecting item = @active_window.item if item != nil && (@loot_window.active || item.ma_discardable? || $game_party.item_can_use? (item)) Sound.play_decision @active_window = @loot_window.active ? @loot_window : @item_window start_command_window else Sound.play_buzzer end end end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Update Command #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def update_command_selection removed_from_loot = false if Input.trigger?(Input::B) Sound.play_cancel # Deactivate Command Window @command_window.active = false @command_window.index = -1 @command_window.visible = false # Reactivat previous Window @active_window.active = true elsif Input.trigger?(Input::C) if @active_window == @item_window case @command_window.index when 0 # Use moal_rfkl9_invntr_limit_upditmselect_1hr4 @command_window.active = false if $game_party.item_can_use?(@item) && @item.scope != 0 when 1 # Discard # Get slot slot = @item_window.ma_grfkl_lim_nvtry_item_8rn unless slot.item.ma_discardable? Sound.play_buzzer return end type, id, n = slot.item_type, slot.item_id, slot.amount # Discard additional slots $game_party.limit_inventory.remove_item (type, id, n) $game_temp.slots_to_discard.add_item (type, id, n) # Deactivate Command Window @command_window.active = false @command_window.index = -1 @command_window.visible = false # Reactivate previous Window if @loot_window.visible @item_window.refresh ($game_party.limit_inventory, 1) @loot_window.refresh ($game_temp.slots_to_discard, 1) else show_loot end @item_window.active = true RPG::SE.new (Sound::MA_DISCARD_SE).play end @emptycount_window.refresh ($game_party.limit_inventory) else # Called from Loot Window slot = @loot_window.ma_grfkl_lim_nvtry_item_8rn # Get slot stats type, id, n = slot.item_type, slot.item_id, slot.amount case @command_window.index when 0 # Take # If inventory has empty spaces if $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn) # Remove from loot and add to Inventory n2 = $game_party.limit_inventory.add_item (type, id, n) $game_temp.slots_to_discard.remove_item (type, id, n - n2) RPG::SE.new (Sound::MA_TAKE_SE).play removed_from_loot = true else Sound.play_buzzer end when 1 # Exchange # Deactivate Command Window @command_window.visible = false @command_window.active = false # Activate Item Window @item_window.active = true @item_window.index = 0 @active_window = @item_window Sound.play_decision when 2 # Destroy $game_party.drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (slot.item, -1*n) $game_temp.slots_to_discard.remove_item (type, id, n) RPG::SE.new (Sound::MA_DESTROY_SE).play removed_from_loot = true end if removed_from_loot @command_window.active = false @command_window.visible = false check_to_hide_loot end end end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Update Warning #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def update_warning_window @warning_window.update if Input.trigger? (Input::B) # Play Cancel SE Sound.play_cancel # Dispose Warning @warning_window.dispose @warning_window = nil elsif Input.trigger? (Input::C) # Play Decision SE Sound.play_decision # When Yes if @warning_window.index == 0 # End Scene clear_loot_slots return_scene end @warning_window.dispose @warning_window = nil end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Use Item (apply effects to non-ally targets) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias modalg_grkl_liminv_ustmnntrgt_2hb4 use_item_nontarget def use_item_nontarget # Get last instance of this item in the inventory. id = @item_window.index while id == @item_window.index @item_window.index += 1 id += 1 if @item == @item_window.item end @item_window.index -= 1 modalg_grkl_liminv_ustmnntrgt_2hb4 $game_party.last_item_id = @item_window.index # Refresh Item Window if that slot is now empty if @item_window.item == nil @item_window.refresh @emptycount_window.refresh ($game_party.limit_inventory) hide_target_window end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Show Loot #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def show_loot @loot_window.refresh ($game_temp.slots_to_discard, 1) @loot_window.update @loot_window.visible = true @lootlabel_window.visible = true @item_window.width = Graphics.width / 2 @item_window.refresh ($game_party.limit_inventory, 1) end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Check to Hide Loot #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def check_to_hide_loot @loot_window.refresh ($game_temp.slots_to_discard, 1) @emptycount_window.refresh ($game_party.limit_inventory) # If there are no more items in loot if $game_temp.slots_to_discard.slots.size == 0 # Hide Loot Window @loot_window.visible = false @loot_window.active = false @loot_window.index = -1 @lootlabel_window.visible = false @item_window.width = Graphics.width @item_window.index = 0 @item_window.refresh ($game_party.limit_inventory, 2) @item_window.active = true @active_window = @item_window else @item_window.refresh ($game_party.limit_inventory, 1) @loot_window.active = true end end
Dernière édition par Garruk le Lun 19 Sep 2011 - 16:09, édité 1 fois |
|