#==============================================================================
# ¡ Window_VictorySpoils
#==============================================================================
class Window_VictorySpoils < Window_ItemList
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, fitting_height(1), Graphics.width, window_height)
self.z = 200
hide
end
#--------------------------------------------------------------------------
# window_height
#--------------------------------------------------------------------------
def window_height
return Graphics.height - fitting_height(4) - fitting_height(1)
end
#--------------------------------------------------------------------------
# spacing
#--------------------------------------------------------------------------
def spacing; return 32; end
#--------------------------------------------------------------------------
# make
#--------------------------------------------------------------------------
def make(gold, drops)
@gold = gold
@drops = drops
refresh
unselect
end
#--------------------------------------------------------------------------
# make_item_list
#--------------------------------------------------------------------------
def make_item_list
@data = [nil]
items = {}
weapons = {}
armours = {}
@goods = {}
for item in @drops
case item
when RPG::Item
items[item] = 0 if items[item].nil?
items[item] += 1
when RPG::Weapon
weapons[item] = 0 if weapons[item].nil?
weapons[item] += 1
when RPG::Armor
armours[item] = 0 if armours[item].nil?
armours[item] += 1
end
end
items = items.sort { |a,b| a[0].id <=> b[0].id }
weapons = weapons.sort { |a,b| a[0].id <=> b[0].id }
armours = armours.sort { |a,b| a[0].id <=> b[0].id }
for key in items; @goods[key[0]] = key[1]; @data.push(key[0]); end
for key in weapons; @goods[key[0]] = key[1]; @data.push(key[0]); end
for key in armours; @goods[key[0]] = key[1]; @data.push(key[0]); end
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = item_rect(index)
reset_font_settings
if item.nil?
draw_gold(rect)
return
end
rect.width -= 4
draw_item_name(item, 20, 24*index, true, rect.width - 24)
draw_item_number(rect, item)
end
#--------------------------------------------------------------------------
# draw_gold
#--------------------------------------------------------------------------
def draw_gold(rect)
text = Vocab.currency_unit
draw_currency_value(@gold, text, rect.x, rect.y, rect.width)
end
#--------------------------------------------------------------------------
# draw_item_number
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
number = @goods[item].group
if $imported["YEA-AdjustLimits"]
contents.font.size = YEA::LIMIT::ITEM_FONT
text = sprintf(YEA::LIMIT::ITEM_PREFIX, number)
draw_text(20, rect.y+20, rect.width, rect.height, text, 2)
else
draw_text(20, rect.y, rect.width, rect.height, sprintf(":%s", number), 2)
end
end
end # Window_VictorySpoils