#==============================================================================
# Window_BattleResult Add-on by Blizzard
# Version: 1.0
# Date 27.8.2006
#
#
# Compatibility:
#
# 99% chance of compatibility with everything.
#
#
# Features:
#
# - instead of displaying each item seperatedly, it displays now item and
# quantity
# - the most compatible script add-on ever
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr/
# or send me an e-mail:
# boris_blizzard@yahoo.de
#
#==============================================================================
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
set_treasures(treasures)
super(160, 0, 320, @treasures[0].size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for i in 0...@treasures.size
draw_item(@treasures[0][i], 4, y, @treasures[1][i])
y += 32
end
end
def set_treasures(treasures)
items = []
weapons = []
armors = []
stuff = []
qua = []
for i in treasures
items.push(i.id) if i.is_a?(RPG::Item)
weapons.push(i.id) if i.is_a?(RPG::Weapon)
armors.push(i.id) if i.is_a?(RPG::Armor)
end
for id in items
if stuff.include?($data_items[id])
qua[stuff.index($data_items[id])] += 1
else
stuff.push($data_items[id])
qua.push(1)
end
end
for id in weapons
if stuff.include?($data_weapons[id])
qua[stuff.index($data_weapons[id])] += 1
else
stuff.push($data_weapons[id])
qua.push(1)
end
end
for id in armors
if stuff.include?($data_armors[id])
qua[stuff.index($data_armors[id])] += 1
else
stuff.push($data_armors[id])
qua.push(1)
end
end
@treasures = []
@treasures.push(stuff)
@treasures.push(qua)
end
def draw_item(item, x, y, qua = 1)
if item == nil
return
end
w1 = self.contents.text_size("0").width
w2 = self.contents.text_size("x ").width
x += w1 + w2 + 4
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.font.color = normal_color
self.contents.draw_text(4, y, w1, 32, qua.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(w1 + 8, y, w2, 32, "x")
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end