class Game_Party < Game_Unit
def all_item_number
ans = 0
@items.each{|idx|ans += idx[1]}
@armors.each{|idx|ans += idx[1]}
@weapons.each{|idx|ans += idx[1]}
ans
end
def max_item_number(item)
return 0 unless item_container(item.class)
return max_all_item_number - all_item_number unless item_container(item.class)[item.id]
return max_all_item_number - all_item_number + item_container(item.class)[item.id]
end
def max_all_item_number
99
end
def item_max?(item)
all_item_number >= max_all_item_number
end
def gain_item(item, amount, include_equip = false)
container = item_container(item.class)
return unless container
container[item.id] = 0 unless container[item.id]
container[item.id] += [amount,max_item_number(item) - container[item.id]].min
container.delete(item.id) if container[item.id] <= 0
if include_equip && container[item] + amount < 0
discard_members_equip(item, -container[item] - amount)
end
$game_map.need_refresh = true
end
end
class Window_ItemList < Window_Selectable
def draw_item_number(rect, item)
draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
end
end