module YEA
module ITEM
# The following adjusts the vocabulary used for each X Param.
XPARAMS_LIST = [
"Hit Rate", #:hit,
"Evasion", #:eva,
"Critical Hit", #:cri,
"Critical Evade", #:cev,
"Magic Evasion", #:mev,
"Magic Reflect", #:mrf,
"Counter Rate", #:cnt,
"HP Regen", #:hrg,
"SP Regen", #:mrg,
"EP Regen", #:trg,
]
# The following adjusts the vocabulary used for each S Param.
SPARAMS_LIST = [
"Target Rate", #:tgr,
"Guard Rate", #:grd,
"Recovery", #:rec,
"Item Boost", #:pha,
"SP Cost Rate", #:mcr,
"TP Charge", #:tcr,
"Physical Damage",#:pdr,
"Magical Damage", #:mdr,
"Floor Damage", #:fdr,
"EXP Rate", #:exr,
]
# For YEA Parameters, not yet implemented.
YPARAMS_LIST = [
[:hcr, "HP Cost Rate"], # Requires YEA - Skill Cost Manager
[:tcr_y, "EP Cost Rate"], # Requires YEA - Skill Cost Manager
[:cdr, "Cooldown Rate"], # Requires YEA - Skill Restrictions
[:wur, "Warmup Rate"], # Requires YEA - Skill Restrictions
]
end # ITEM
end # YEA
#==============================================================================
# ? Window_ItemStatus
#==============================================================================
class Window_ItemStatus < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(dx, dy, item_window)
super(dx, dy, Graphics.width - dx, fitting_height(8))
@item_window = item_window
@item = nil
refresh
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
update_item(@item_window.item)
end
#--------------------------------------------------------------------------
# update_item
#--------------------------------------------------------------------------
def update_item(item)
return if @item == item
@item = item
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
reset_font_settings
return draw_empty if @item.nil?
contents.font.size = YEA::ITEM::STATUS_FONT_SIZE
draw_item_image
draw_item_stats
draw_item_effects
end
#--------------------------------------------------------------------------
# draw_empty
#--------------------------------------------------------------------------
def draw_empty
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(1, 1, 94, 94)
contents.fill_rect(rect, colour)
dx = 96; dy = 0
dw = (contents.width - 96) / 4
for i in 0...28
draw_background_box(dx, dy, dw)
dx = (dx >= (96 + (3 * dw))) ? 96 : dx + dw
dy += line_height if dx == 96
end
end
#--------------------------------------------------------------------------
# draw_background_box
#--------------------------------------------------------------------------
def draw_background_box(dx, dy, dw)
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
contents.fill_rect(rect, colour)
end
#--------------------------------------------------------------------------
# draw_item_image
#--------------------------------------------------------------------------
def draw_item_image
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(1, 1, 94, 94)
contents.fill_rect(rect, colour)
if @item.image.nil?
icon_index = @item.icon_index
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
target = Rect.new(0, 0, 96, 96)
contents.stretch_blt(target, bitmap, rect)
else
bitmap = Cache.picture(@item.image)
contents.blt(0, 0, bitmap, bitmap.rect, 255)
end
end
#--------------------------------------------------------------------------
# draw_item_stats
#--------------------------------------------------------------------------
def draw_item_stats
return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
dx = 96; dy = 0
dw = (contents.width - 96) / 4
for i in 0...8
draw_equip_param(i, dx, dy, dw)
dx = (dx >= (96 + (3 * dw))) ? 96 : dx + dw
dy += line_height if dx == 96
end
# X Params
for i in 0...10
draw_ex_equip_param(i, dx, dy, dw, 1)
dx = (dx >= (96 + (3 * dw))) ? 96 : dx + dw
dy += line_height if dx == 96
end
# Y Params
for i in 0...10
draw_ex_equip_param(i, dx, dy, dw, 2)
dx = (dx >= (96 + (3 * dw))) ? 96 : dx + dw
dy += line_height if dx == 96
end
end
#--------------------------------------------------------------------------
# draw_equip_param
#--------------------------------------------------------------------------
def draw_equip_param(param_id, dx, dy, dw)
draw_background_box(dx, dy, dw)
change_color(system_color)
draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
if $imported["YEA-EquipDynamicStats"]
draw_percentage_param(param_id, dx, dy, dw)
else
draw_set_param(param_id, dx, dy, dw)
end
end
#--------------------------------------------------------------------------
# draw_ex_equip_param
#--------------------------------------------------------------------------
def draw_ex_equip_param(param_id, dx, dy, dw, which)
draw_background_box(dx, dy, dw)
change_color(system_color)
text = YEA::ITEM::XPARAMS_LIST[param_id] if which == 1
text = YEA::ITEM::SPARAMS_LIST[param_id] if which == 2
draw_text(dx+4, dy, dw-8, line_height, text)
draw_ex_param(param_id, dx, dy, dw, which)
end
#--------------------------------------------------------------------------
# draw_ex_param
#--------------------------------------------------------------------------
def draw_ex_param(param_id, dx, dy, dw, which)
if $imported["MA-Params"]
value = @item.xparams[param_id] if which == 1
value = @item.sparams[param_id] if which == 2
change_color(param_change_color(value), value != 0)
text = (value * 100).to_f.group + "%"
text = "+" + text if value > 0
draw_text(dx+4, dy, dw-8, line_height, text, 2)
return 0
end
end
#--------------------------------------------------------------------------
# draw_percentage_param
#--------------------------------------------------------------------------
def draw_percentage_param(param_id, dx, dy, dw)
if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
text = draw_set_param(param_id, dx, dy, dw)
dw -= text_size(text).width
draw_percent_param(param_id, dx, dy, dw)
elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
draw_percent_param(param_id, dx, dy, dw)
else
draw_set_param(param_id, dx, dy, dw)
end
end