#===========================================================
# -- Parameters Table de Wecoc -- Extended Equip Version
#===========================================================
=begin
Muestra una tabla con los parámetros del actor, dividida según de dónde le vengan
esos parámetros. Dibuja un icono según cual sea la procedencia.
Código para usarlo:
draw_pt_equipex(actor, x, y, ancho, alto, parámetros, separación, color1, color2)
actor => personaje del cual se muestran los parámetros
x, y => coordenadas de la tabla
ancho => ancho DE LAS BARRAS (no del total)
alto => alto tope donde pueden llegar las barras
parámetros => array con la siguiente codificación:
0 => hpmax
1 => spmax
2 => atk
3 => pdef
4 => mdef
5 => str
6 => dex
7 => agi
8 => int
(por ejemplo si parámetros es (0,1,5,6) mostrará hpmax, spmax, str y dex)
separación => separación entre las barras, por defecto 6
color1 => color de las líneas de la tabla
color2 => color del fondo ( Color.new(0,0,0,0) para tabla sin fondo)
Puedes controlar aspectos default de la tabla en el module PT_EQUIPEX
Espero que os guste este script.
=end
##########################################################
module PT_EQUIPEX
HP_COLOR = Color.new(200, 60, 120)
SP_COLOR = Color.new(60, 120, 200)
ATK_COLOR = Color.new(120, 120, 120)
PDEF_COLOR = Color.new(120, 120, 120)
MDEF_COLOR = Color.new(120, 120, 120)
STR_COLOR = Color.new(200, 120, 60)
DEX_COLOR = Color.new(120, 200, 60)
AGI_COLOR = Color.new(60, 200, 120)
INT_COLOR = Color.new(120, 60, 200)
GOOD_COLOR = Color.new(194, 245, 151)
BAD_COLOR = Color.new(245, 151, 153)
MINUS_COLOR = Color.new(200,70,60) # (Cuando la barra resta en vez de sumar)
HP_MAX = 9999
SP_MAX = 9999
ATK_MAX = 299
PDEF_MAX = 299
MDEF_MAX = 299
STR_MAX = 999
DEX_MAX = 999
AGI_MAX = 999
INT_MAX = 999
SHOW_ICONS = true # Inactivado no saldran los iconos.
ICON_OPACITY = 200
SELF_ICON = "032-Item01" # (Icono que saldrá cuando el parámetro dependa del actor)
end
##########################################################
class Bitmap
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x, y, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
def draw_square(x, y, width, height, color, line_width = 1)
fill_rect(x, y, line_width, height, color) # Izquierda
fill_rect(x, y, width, line_width, color) # Arriba
fill_rect(x + width - line_width + 1, y, line_width, height, color) # Derecha
fill_rect(x, y + height - line_width + 1, width, line_width, color) # Abajo
end
end
##########################################################
class Window_Base
def draw_pt_equipex(actor,x,y,width,height,parameters,w_space=6,
color=Color.new(192,192,192),back_color=Color.new(0,0,0,100))
table_width = (w_space+width)*parameters.size+w_space
back = Rect.new(x, y, table_width, height)
self.contents.fill_rect(back, back_color)
self.contents.draw_line(x,y,x,y+height,color)
self.contents.draw_line(x,y+height,x+table_width,y+height,color)
self.contents.font.color = color
self.contents.font.size = 12
self.contents.font.bold = true
weapon = armor1 = armor2 = armor3 = armor4 = nil
weapon = $data_weapons[@actor.weapon_id] if @actor.weapon_id != 0
armor1 = $data_armors[@actor.armor1_id] if @actor.armor1_id != 0
armor2 = $data_armors[@actor.armor2_id] if @actor.armor2_id != 0
armor3 = $data_armors[@actor.armor3_id] if @actor.armor3_id != 0
armor4 = $data_armors[@actor.armor3_id] if @actor.armor4_id != 0
weapon_height = 0
armor1_height = armor2_height = armor3_height = armor4_height = 0
for par in 0..parameters.length
new_x = x+(w_space+width)*par+w_space
new_y = y+height
goodbar_color = PT_EQUIPEX::GOOD_COLOR
badbar_color = PT_EQUIPEX::BAD_COLOR
case parameters[par]
when 0 # 0 = hpmax
self.contents.draw_text(new_x,new_y, width, 24, "hp",1)
new_height = height * actor.maxhp / PT_EQUIPEX::HP_MAX
new_y2 = y+height-new_height
rect = Rect.new(new_x, new_y2, width, new_height)
bc = PT_EQUIPEX::HP_COLOR
border_color = color
self.contents.fill_rect(rect, bc)
self.contents.draw_square(rect.x,rect.y,rect.width,rect.height,border_color)
when 1 # 1 = spmax
self.contents.draw_text(new_x,new_y, width, 24, "sp",1)
new_height = height * actor.maxsp / PT_EQUIPEX::SP_MAX
new_y2 = y+height-new_height
rect = Rect.new(new_x, new_y2, width, new_height)
bc = PT_EQUIPEX::SP_COLOR
border_color = color
self.contents.fill_rect(rect, bc)
self.contents.draw_square(rect.x,rect.y,rect.width,rect.height,border_color)
when 2 # 2 = atk
self.contents.draw_text(new_x,new_y, width, 24, "atk",1)
new_height = height * actor.atk / PT_EQUIPEX::ATK_MAX
new_y2 = y+height-new_height
rect = Rect.new(new_x, new_y2, width, new_height)
bc = PT_EQUIPEX::ATK_COLOR
border_color = color
self.contents.fill_rect(rect, bc)
self.contents.draw_square(rect.x,rect.y,rect.width,rect.height,border_color)
if @new_atk != nil and @new_atk != actor.atk
if @new_atk > actor.atk
new_height2 = height * (@new_atk-actor.atk)/PT_EQUIPEX::ATK_MAX
rect = Rect.new(new_x, new_y2-new_height2, width+1, new_height2)
self.contents.fill_rect(rect, goodbar_color)
else
new_height2 = height * (actor.atk-@new_atk) / PT_EQUIPEX::ATK_MAX
rect = Rect.new(new_x, new_y2, width+1, new_height2)
self.contents.fill_rect(rect, badbar_color)
end
end
if PT_EQUIPEX::SHOW_ICONS
unless @actor.weapon_id == 0
weapon_icon = $data_weapons[@actor.weapon_id].icon_name
bitmap = RPG::Cache.icon(weapon_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(x+w_space,new_y2+(new_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
end
when 3 # 3 = pdef
self.contents.draw_text(new_x,new_y, width, 24, "pdef",1)
bc = PT_EQUIPEX::PDEF_COLOR
border_color = color
self_pdef = @actor.pdef
self_pdef = self_pdef - weapon.pdef unless (weapon == nil)
self_pdef = self_pdef - armor1.pdef unless (armor1 == nil)
self_pdef = self_pdef - armor2.pdef unless (armor2 == nil)
self_pdef = self_pdef - armor3.pdef unless (armor3 == nil)
self_pdef = self_pdef - armor4.pdef unless (armor4 == nil)
self_height = height * self_pdef / PT_EQUIPEX::PDEF_MAX
self_y = y+height-self_height
weapon_height = height * weapon.pdef / PT_EQUIPEX::PDEF_MAX if weapon != nil
weapon_y = self_y-weapon_height
armor1_height = height * armor1.pdef / PT_EQUIPEX::PDEF_MAX if armor1 != nil
armor1_y = weapon_y-armor1_height
armor2_height = height * armor2.pdef / PT_EQUIPEX::PDEF_MAX if armor2 != nil
armor2_y = armor1_y-armor2_height
armor3_height = height * armor3.pdef / PT_EQUIPEX::PDEF_MAX if armor3 != nil
armor3_y = armor2_y-armor3_height
armor4_height = height * armor4.pdef / PT_EQUIPEX::PDEF_MAX if armor4 != nil
armor4_y = armor3_y-armor4_height
self_rect = Rect.new(new_x, self_y, width, self_height)
self_barcolor=Color.new(bc.red+60,bc.green+60,bc.blue+60,bc.alpha)
self.contents.fill_rect(self_rect, self_barcolor)
self.contents.draw_square(self_rect.x,self_rect.y,self_rect.width,
self_rect.height,border_color)
weapon_rect = Rect.new(new_x, weapon_y, width, weapon_height)
weapon_barcolor=Color.new(bc.red+20,bc.green+20,bc.blue+20,bc.alpha)
self.contents.fill_rect(weapon_rect, weapon_barcolor)
self.contents.draw_square(weapon_rect.x,weapon_rect.y,weapon_rect.width,
weapon_rect.height,border_color)
armor1_rect = Rect.new(new_x, armor1_y, width, armor1_height)
armor1_barcolor=Color.new(bc.red,bc.green,bc.blue,bc.alpha)
self.contents.fill_rect(armor1_rect, armor1_barcolor)
self.contents.draw_square(armor1_rect.x,armor1_rect.y,armor1_rect.width,
armor1_rect.height,border_color)
armor2_rect = Rect.new(new_x, armor2_y, width, armor2_height)
armor2_barcolor=Color.new(bc.red-20,bc.green-20,bc.blue-20,bc.alpha)
self.contents.fill_rect(armor2_rect, armor2_barcolor)
self.contents.draw_square(armor2_rect.x,armor2_rect.y,armor2_rect.width,
armor2_rect.height,border_color)
armor3_rect = Rect.new(new_x, armor3_y, width, armor3_height)
armor3_barcolor=Color.new(bc.red-40,bc.green-40,bc.blue-40,bc.alpha)
self.contents.fill_rect(armor3_rect, armor3_barcolor)
self.contents.draw_square(armor3_rect.x,armor3_rect.y,armor3_rect.width,
armor3_rect.height,border_color)
armor4_rect = Rect.new(new_x, armor4_y, width, armor4_height)
armor4_barcolor=Color.new(bc.red-60,bc.green-60,bc.blue-60,bc.alpha)
self.contents.fill_rect(armor4_rect, armor4_barcolor)
self.contents.draw_square(armor4_rect.x,armor4_rect.y,armor4_rect.width,
armor4_rect.height,border_color)
if @type != nil and @new_pdef != nil and @new_pdef != actor.pdef
if @new_pdef > actor.pdef
case @type
when 0 # weapon
weapon_height2 = height * (@new_pdef-actor.pdef)/PT_EQUIPEX::PDEF_MAX
weapon_y2 = y+height-self_height-weapon_height-weapon_height2
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, goodbar_color)
when 1 # armor1
armor1_height2 = height * (@new_pdef-actor.pdef)/PT_EQUIPEX::PDEF_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height-armor1_height2
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, goodbar_color)
when 2 # armor2
armor2_height2 = height * (@new_pdef-actor.pdef)/PT_EQUIPEX::PDEF_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor2_height2
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, goodbar_color)
when 3 # armor3
armor3_height2 = height * (@new_pdef-actor.pdef)/PT_EQUIPEX::PDEF_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor3_height2
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, goodbar_color)
when 4 # armor4
armor4_height2 = height * (@new_pdef-actor.pdef)/PT_EQUIPEX::PDEF_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height-armor4_height2
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, goodbar_color)
end
else
case @type
when 0 # weapon
weapon_height2 = height * (actor.pdef-@new_pdef)/PT_EQUIPEX::PDEF_MAX
weapon_y2 = y+height-self_height-weapon_height
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, badbar_color)
when 1 # armor1
armor1_height2 = height * (actor.pdef-@new_pdef)/PT_EQUIPEX::PDEF_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, badbar_color)
when 2 # armor2
armor2_height2 = height * (actor.pdef-@new_pdef)/PT_EQUIPEX::PDEF_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, badbar_color)
when 3 # armor3
armor3_height2 = height * (actor.pdef-@new_pdef)/PT_EQUIPEX::PDEF_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, badbar_color)
when 4 # armor4
armor4_height2 = height * (actor.pdef-@new_pdef)/PT_EQUIPEX::PDEF_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, badbar_color)
end
end
end
if PT_EQUIPEX::SHOW_ICONS
if self_pdef != 0
self_icon = PT_EQUIPEX::SELF_ICON
bitmap = RPG::Cache.icon(self_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,self_y+(self_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.weapon_id != 0 and $data_weapons[@actor.weapon_id].pdef != 0
weapon_icon = $data_weapons[@actor.weapon_id].icon_name
bitmap = RPG::Cache.icon(weapon_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,weapon_y+(weapon_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor1_id != 0 and $data_armors[@actor.armor1_id].pdef != 0
armor1_icon = $data_armors[@actor.armor1_id].icon_name
bitmap = RPG::Cache.icon(armor1_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor1_y+(armor1_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor2_id != 0 and $data_armors[@actor.armor2_id].pdef != 0
armor2_icon = $data_armors[@actor.armor2_id].icon_name
bitmap = RPG::Cache.icon(armor2_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor2_y+(armor2_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor3_id != 0 and $data_armors[@actor.armor3_id].pdef != 0
armor3_icon = $data_armors[@actor.armor3_id].icon_name
bitmap = RPG::Cache.icon(armor3_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor3_y+(armor3_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor4_id != 0 and $data_armors[@actor.armor4_id].pdef != 0
armor4_icon = $data_armors[@actor.armor4_id].icon_name
bitmap = RPG::Cache.icon(armor4_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor4_y+(armor4_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
end
when 4 # 4 = mdef
self.contents.draw_text(new_x,new_y, width, 24, "mdef",1)
bc = PT_EQUIPEX::MDEF_COLOR
border_color = color
self_mdef = @actor.mdef
self_mdef = self_mdef - weapon.mdef unless (weapon == nil)
self_mdef = self_mdef - armor1.mdef unless (armor1 == nil)
self_mdef = self_mdef - armor2.mdef unless (armor2 == nil)
self_mdef = self_mdef - armor3.mdef unless (armor3 == nil)
self_mdef = self_mdef - armor4.mdef unless (armor4 == nil)
self_height = height * self_mdef / PT_EQUIPEX::MDEF_MAX
self_y = y+height-self_height
weapon_height = height * weapon.mdef / PT_EQUIPEX::MDEF_MAX if weapon != nil
weapon_y = self_y-weapon_height
armor1_height = height * armor1.mdef / PT_EQUIPEX::MDEF_MAX if armor1 != nil
armor1_y = weapon_y-armor1_height
armor2_height = height * armor2.mdef / PT_EQUIPEX::MDEF_MAX if armor2 != nil
armor2_y = armor1_y-armor2_height
armor3_height = height * armor3.mdef / PT_EQUIPEX::MDEF_MAX if armor3 != nil
armor3_y = armor2_y-armor3_height
armor4_height = height * armor4.mdef / PT_EQUIPEX::MDEF_MAX if armor4 != nil
armor4_y = armor3_y-armor4_height
self_rect = Rect.new(new_x, self_y, width, self_height)
self_barcolor=Color.new(bc.red+60,bc.green+60,bc.blue+60,bc.alpha)
self.contents.fill_rect(self_rect, self_barcolor)
self.contents.draw_square(self_rect.x,self_rect.y,self_rect.width,
self_rect.height,border_color)
weapon_rect = Rect.new(new_x, weapon_y, width, weapon_height)
weapon_barcolor=Color.new(bc.red+20,bc.green+20,bc.blue+20,bc.alpha)
self.contents.fill_rect(weapon_rect, weapon_barcolor)
self.contents.draw_square(weapon_rect.x,weapon_rect.y,weapon_rect.width,
weapon_rect.height,border_color)
armor1_rect = Rect.new(new_x, armor1_y, width, armor1_height)
armor1_barcolor=Color.new(bc.red,bc.green,bc.blue,bc.alpha)
self.contents.fill_rect(armor1_rect, armor1_barcolor)
self.contents.draw_square(armor1_rect.x,armor1_rect.y,armor1_rect.width,
armor1_rect.height,border_color)
armor2_rect = Rect.new(new_x, armor2_y, width, armor2_height)
armor2_barcolor=Color.new(bc.red-20,bc.green-20,bc.blue-20,bc.alpha)
self.contents.fill_rect(armor2_rect, armor2_barcolor)
self.contents.draw_square(armor2_rect.x,armor2_rect.y,armor2_rect.width,
armor2_rect.height,border_color)
armor3_rect = Rect.new(new_x, armor3_y, width, armor3_height)
armor3_barcolor=Color.new(bc.red-40,bc.green-40,bc.blue-40,bc.alpha)
self.contents.fill_rect(armor3_rect, armor3_barcolor)
self.contents.draw_square(armor3_rect.x,armor3_rect.y,armor3_rect.width,
armor3_rect.height,border_color)
armor4_rect = Rect.new(new_x, armor4_y, width, armor4_height)
armor4_barcolor=Color.new(bc.red-60,bc.green-60,bc.blue-60,bc.alpha)
self.contents.fill_rect(armor4_rect, armor4_barcolor)
self.contents.draw_square(armor4_rect.x,armor4_rect.y,armor4_rect.width,
armor4_rect.height,border_color)
if @type != nil and @new_mdef != nil and @new_mdef != actor.mdef
if @new_mdef > actor.mdef
case @type
when 0 # weapon
weapon_height2 = height * (@new_mdef-actor.mdef)/PT_EQUIPEX::MDEF_MAX
weapon_y2 = y+height-self_height-weapon_height-weapon_height2
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, goodbar_color)
when 1 # armor1
armor1_height2 = height * (@new_mdef-actor.mdef)/PT_EQUIPEX::MDEF_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height-armor1_height2
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, goodbar_color)
when 2 # armor2
armor2_height2 = height * (@new_mdef-actor.mdef)/PT_EQUIPEX::MDEF_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor2_height2
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, goodbar_color)
when 3 # armor3
armor3_height2 = height * (@new_mdef-actor.mdef)/PT_EQUIPEX::MDEF_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor3_height2
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, goodbar_color)
when 4 # armor4
armor4_height2 = height * (@new_mdef-actor.mdef)/PT_EQUIPEX::MDEF_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height-armor4_height2
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, goodbar_color)
end
else
case @type
when 0 # weapon
weapon_height2 = height * (actor.mdef-@new_mdef)/PT_EQUIPEX::MDEF_MAX
weapon_y2 = y+height-self_height-weapon_height
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, badbar_color)
when 1 # armor1
armor1_height2 = height * (actor.mdef-@new_mdef)/PT_EQUIPEX::MDEF_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, badbar_color)
when 2 # armor2
armor2_height2 = height * (actor.mdef-@new_mdef)/PT_EQUIPEX::MDEF_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, badbar_color)
when 3 # armor3
armor3_height2 = height * (actor.mdef-@new_mdef)/PT_EQUIPEX::MDEF_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, badbar_color)
when 4 # armor4
armor4_height2 = height * (actor.mdef-@new_mdef)/PT_EQUIPEX::MDEF_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, badbar_color)
end
end
end
if PT_EQUIPEX::SHOW_ICONS
if self_mdef != 0
self_icon = PT_EQUIPEX::SELF_ICON
bitmap = RPG::Cache.icon(self_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,self_y+(self_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.weapon_id != 0 and $data_weapons[@actor.weapon_id].mdef != 0
weapon_icon = $data_weapons[@actor.weapon_id].icon_name
bitmap = RPG::Cache.icon(weapon_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,weapon_y+(weapon_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor1_id != 0 and $data_armors[@actor.armor1_id].mdef != 0
armor1_icon = $data_armors[@actor.armor1_id].icon_name
bitmap = RPG::Cache.icon(armor1_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor1_y+(armor1_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor2_id != 0 and $data_armors[@actor.armor2_id].mdef != 0
armor2_icon = $data_armors[@actor.armor2_id].icon_name
bitmap = RPG::Cache.icon(armor2_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor2_y+(armor2_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor3_id != 0 and $data_armors[@actor.armor3_id].mdef != 0
armor3_icon = $data_armors[@actor.armor3_id].icon_name
bitmap = RPG::Cache.icon(armor3_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor3_y+(armor3_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor4_id != 0 and $data_armors[@actor.armor4_id].mdef != 0
armor4_icon = $data_armors[@actor.armor4_id].icon_name
bitmap = RPG::Cache.icon(armor4_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor4_y+(armor4_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
end
when 5 # 5 = str
self.contents.draw_text(new_x,new_y, width, 24, "str",1)
bc = PT_EQUIPEX::STR_COLOR
border_color = color
self_str = @actor.str
self_str = self_str - weapon.str_plus unless (weapon == nil)
self_str = self_str - armor1.str_plus unless (armor1 == nil)
self_str = self_str - armor2.str_plus unless (armor2 == nil)
self_str = self_str - armor3.str_plus unless (armor3 == nil)
self_str = self_str - armor4.str_plus unless (armor4 == nil)
self_height = height * self_str / PT_EQUIPEX::STR_MAX
self_y = y+height-self_height
weapon_height = height * weapon.str_plus / PT_EQUIPEX::STR_MAX if weapon != nil
weapon_y = self_y-weapon_height
armor1_height = height * armor1.str_plus / PT_EQUIPEX::STR_MAX if armor1 != nil
armor1_y = weapon_y-armor1_height
armor2_height = height * armor2.str_plus / PT_EQUIPEX::STR_MAX if armor2 != nil
armor2_y = armor1_y-armor2_height
armor3_height = height * armor3.str_plus / PT_EQUIPEX::STR_MAX if armor3 != nil
armor3_y = armor2_y-armor3_height
armor4_height = height * armor4.str_plus / PT_EQUIPEX::STR_MAX if armor4 != nil
armor4_y = armor3_y-armor4_height
self_rect = Rect.new(new_x, self_y, width, self_height)
self_barcolor=Color.new(bc.red+60,bc.green+60,bc.blue+60,bc.alpha)
self.contents.fill_rect(self_rect, self_barcolor)
self.contents.draw_square(self_rect.x,self_rect.y,self_rect.width,
self_rect.height,border_color)
if weapon_height > 0
weapon_rect = Rect.new(new_x, weapon_y, width, weapon_height)
weapon_barcolor=Color.new(bc.red+20,bc.green+20,bc.blue+20,bc.alpha)
else
weapon_rect = Rect.new(new_x,weapon_y+weapon_height,width,-weapon_height)
weapon_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(weapon_rect, weapon_barcolor)
self.contents.draw_square(weapon_rect.x,weapon_rect.y,weapon_rect.width,
weapon_rect.height,border_color)
if armor1_height > 0
armor1_rect = Rect.new(new_x, armor1_y, width, armor1_height)
armor1_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor1_rect = Rect.new(new_x,armor1_y+armor1_height,width,-armor1_height)
armor1_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor1_rect, armor1_barcolor)
self.contents.draw_square(armor1_rect.x,armor1_rect.y,armor1_rect.width,
armor1_rect.height,border_color)
if armor2_height > 0
armor2_rect = Rect.new(new_x, armor2_y, width, armor2_height)
armor2_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor2_rect = Rect.new(new_x,armor2_y+armor2_height,width,-armor2_height)
armor2_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor2_rect, armor2_barcolor)
self.contents.draw_square(armor2_rect.x,armor2_rect.y,armor2_rect.width,
armor2_rect.height,border_color)
if armor3_height > 0
armor3_rect = Rect.new(new_x, armor3_y, width, armor3_height)
armor3_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor3_rect = Rect.new(new_x,armor3_y+armor3_height,width,-armor3_height)
armor3_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor3_rect, armor3_barcolor)
self.contents.draw_square(armor3_rect.x,armor3_rect.y,armor3_rect.width,
armor3_rect.height,border_color)
if armor4_height > 0
armor4_rect = Rect.new(new_x, armor4_y, width, armor4_height)
armor4_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor4_rect = Rect.new(new_x,armor4_y+armor4_height,width,-armor4_height)
armor4_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor4_rect, armor4_barcolor)
self.contents.draw_square(armor4_rect.x,armor4_rect.y,armor4_rect.width,
armor4_rect.height,border_color)
if @type != nil and @new_str != nil and @new_str != actor.str
if @new_str > actor.str
case @type
when 0 # weapon
weapon_height2 = height * (@new_str-actor.str)/PT_EQUIPEX::STR_MAX
weapon_y2 = y+height-self_height-weapon_height-weapon_height2
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, goodbar_color)
when 1 # armor1
armor1_height2 = height * (@new_str-actor.str)/PT_EQUIPEX::STR_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height-armor1_height2
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, goodbar_color)
when 2 # armor2
armor2_height2 = height * (@new_str-actor.str)/PT_EQUIPEX::STR_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor2_height2
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, goodbar_color)
when 3 # armor3
armor3_height2 = height * (@new_str-actor.str)/PT_EQUIPEX::STR_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor3_height2
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, goodbar_color)
when 4 # armor4
armor4_height2 = height * (@new_str-actor.str)/PT_EQUIPEX::STR_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height-armor4_height2
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, goodbar_color)
end
else
case @type
when 0 # weapon
weapon_height2 = height * (actor.str-@new_str)/PT_EQUIPEX::STR_MAX
weapon_y2 = y+height-self_height-weapon_height
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, badbar_color)
when 1 # armor1
armor1_height2 = height * (actor.str-@new_str)/PT_EQUIPEX::STR_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, badbar_color)
when 2 # armor2
armor2_height2 = height * (actor.str-@new_str)/PT_EQUIPEX::STR_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, badbar_color)
when 3 # armor3
armor3_height2 = height * (actor.str-@new_str)/PT_EQUIPEX::STR_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, badbar_color)
when 4 # armor4
armor4_height2 = height * (actor.str-@new_str)/PT_EQUIPEX::STR_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, badbar_color)
end
end
end
if PT_EQUIPEX::SHOW_ICONS
if self_str != 0
self_icon = PT_EQUIPEX::SELF_ICON
bitmap = RPG::Cache.icon(self_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,self_y+(self_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.weapon_id != 0 and $data_weapons[@actor.weapon_id].str_plus != 0
weapon_icon = $data_weapons[@actor.weapon_id].icon_name
bitmap = RPG::Cache.icon(weapon_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,weapon_y+(weapon_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor1_id != 0 and $data_armors[@actor.armor1_id].str_plus != 0
armor1_icon = $data_armors[@actor.armor1_id].icon_name
bitmap = RPG::Cache.icon(armor1_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor1_y+(armor1_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor2_id != 0 and $data_armors[@actor.armor2_id].str_plus != 0
armor2_icon = $data_armors[@actor.armor2_id].icon_name
bitmap = RPG::Cache.icon(armor2_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor2_y+(armor2_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor3_id != 0 and $data_armors[@actor.armor3_id].str_plus != 0
armor3_icon = $data_armors[@actor.armor3_id].icon_name
bitmap = RPG::Cache.icon(armor3_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor3_y+(armor3_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor4_id != 0 and $data_armors[@actor.armor4_id].str_plus != 0
armor4_icon = $data_armors[@actor.armor4_id].icon_name
bitmap = RPG::Cache.icon(armor4_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor4_y+(armor4_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
end
when 6 # 6 = dex
self.contents.draw_text(new_x,new_y, width, 24, "dex",1)
bc = PT_EQUIPEX::DEX_COLOR
border_color = color
self_dex = @actor.dex
self_dex = self_dex - weapon.dex_plus unless (weapon == nil)
self_dex = self_dex - armor1.dex_plus unless (armor1 == nil)
self_dex = self_dex - armor2.dex_plus unless (armor2 == nil)
self_dex = self_dex - armor3.dex_plus unless (armor3 == nil)
self_dex = self_dex - armor4.dex_plus unless (armor4 == nil)
self_height = height * self_dex / PT_EQUIPEX::DEX_MAX
self_y = y+height-self_height
weapon_height = height * weapon.dex_plus / PT_EQUIPEX::DEX_MAX if weapon != nil
weapon_y = self_y-weapon_height
armor1_height = height * armor1.dex_plus / PT_EQUIPEX::DEX_MAX if armor1 != nil
armor1_y = weapon_y-armor1_height
armor2_height = height * armor2.dex_plus / PT_EQUIPEX::DEX_MAX if armor2 != nil
armor2_y = armor1_y-armor2_height
armor3_height = height * armor3.dex_plus / PT_EQUIPEX::DEX_MAX if armor3 != nil
armor3_y = armor2_y-armor3_height
armor4_height = height * armor4.dex_plus / PT_EQUIPEX::DEX_MAX if armor4 != nil
armor4_y = armor3_y-armor4_height
self_rect = Rect.new(new_x, self_y, width, self_height)
self_barcolor=Color.new(bc.red+60,bc.green+60,bc.blue+60,bc.alpha)
self.contents.fill_rect(self_rect, self_barcolor)
self.contents.draw_square(self_rect.x,self_rect.y,self_rect.width,
self_rect.height,border_color)
if weapon_height > 0
weapon_rect = Rect.new(new_x, weapon_y, width, weapon_height)
weapon_barcolor=Color.new(bc.red+20,bc.green+20,bc.blue+20,bc.alpha)
else
weapon_rect = Rect.new(new_x,weapon_y+weapon_height,width,-weapon_height)
weapon_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(weapon_rect, weapon_barcolor)
self.contents.draw_square(weapon_rect.x,weapon_rect.y,weapon_rect.width,
weapon_rect.height,border_color)
if armor1_height > 0
armor1_rect = Rect.new(new_x, armor1_y, width, armor1_height)
armor1_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor1_rect = Rect.new(new_x,armor1_y+armor1_height,width,-armor1_height)
armor1_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor1_rect, armor1_barcolor)
self.contents.draw_square(armor1_rect.x,armor1_rect.y,armor1_rect.width,
armor1_rect.height,border_color)
if armor2_height > 0
armor2_rect = Rect.new(new_x, armor2_y, width, armor2_height)
armor2_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor2_rect = Rect.new(new_x,armor2_y+armor2_height,width,-armor2_height)
armor2_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor2_rect, armor2_barcolor)
self.contents.draw_square(armor2_rect.x,armor2_rect.y,armor2_rect.width,
armor2_rect.height,border_color)
if armor3_height > 0
armor3_rect = Rect.new(new_x, armor3_y, width, armor3_height)
armor3_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor3_rect = Rect.new(new_x,armor3_y+armor3_height,width,-armor3_height)
armor3_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor3_rect, armor3_barcolor)
self.contents.draw_square(armor3_rect.x,armor3_rect.y,armor3_rect.width,
armor3_rect.height,border_color)
if armor4_height > 0
armor4_rect = Rect.new(new_x, armor4_y, width, armor4_height)
armor4_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor4_rect = Rect.new(new_x,armor4_y+armor4_height,width,-armor4_height)
armor4_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor4_rect, armor4_barcolor)
self.contents.draw_square(armor4_rect.x,armor4_rect.y,armor4_rect.width,
armor4_rect.height,border_color)
if @type != nil and @new_dex != nil and @new_dex != actor.dex
if @new_dex > actor.dex
case @type
when 0 # weapon
weapon_height2 = height * (@new_dex-actor.dex)/PT_EQUIPEX::DEX_MAX
weapon_y2 = y+height-self_height-weapon_height-weapon_height2
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, goodbar_color)
when 1 # armor1
armor1_height2 = height * (@new_dex-actor.dex)/PT_EQUIPEX::DEX_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height-armor1_height2
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, goodbar_color)
when 2 # armor2
armor2_height2 = height * (@new_dex-actor.dex)/PT_EQUIPEX::DEX_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor2_height2
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, goodbar_color)
when 3 # armor3
armor3_height2 = height * (@new_dex-actor.dex)/PT_EQUIPEX::DEX_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor3_height2
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, goodbar_color)
when 4 # armor4
armor4_height2 = height * (@new_dex-actor.dex)/PT_EQUIPEX::DEX_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height-armor4_height2
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, goodbar_color)
end
else
case @type
when 0 # weapon
weapon_height2 = height * (actor.dex-@new_dex)/PT_EQUIPEX::DEX_MAX
weapon_y2 = y+height-self_height-weapon_height
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, badbar_color)
when 1 # armor1
armor1_height2 = height * (actor.dex-@new_dex)/PT_EQUIPEX::DEX_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, badbar_color)
when 2 # armor2
armor2_height2 = height * (actor.dex-@new_dex)/PT_EQUIPEX::DEX_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, badbar_color)
when 3 # armor3
armor3_height2 = height * (actor.dex-@new_dex)/PT_EQUIPEX::DEX_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, badbar_color)
when 4 # armor4
armor4_height2 = height * (actor.dex-@new_dex)/PT_EQUIPEX::DEX_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, badbar_color)
end
end
end
if PT_EQUIPEX::SHOW_ICONS
if self_dex != 0
self_icon = PT_EQUIPEX::SELF_ICON
bitmap = RPG::Cache.icon(self_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,self_y+(self_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.weapon_id != 0 and $data_weapons[@actor.weapon_id].dex_plus != 0
weapon_icon = $data_weapons[@actor.weapon_id].icon_name
bitmap = RPG::Cache.icon(weapon_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,weapon_y+(weapon_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor1_id != 0 and $data_armors[@actor.armor1_id].dex_plus != 0
armor1_icon = $data_armors[@actor.armor1_id].icon_name
bitmap = RPG::Cache.icon(armor1_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor1_y+(armor1_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor2_id != 0 and $data_armors[@actor.armor2_id].dex_plus != 0
armor2_icon = $data_armors[@actor.armor2_id].icon_name
bitmap = RPG::Cache.icon(armor2_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor2_y+(armor2_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor3_id != 0 and $data_armors[@actor.armor3_id].dex_plus != 0
armor3_icon = $data_armors[@actor.armor3_id].icon_name
bitmap = RPG::Cache.icon(armor3_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor3_y+(armor3_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor4_id != 0 and $data_armors[@actor.armor4_id].dex_plus != 0
armor4_icon = $data_armors[@actor.armor4_id].icon_name
bitmap = RPG::Cache.icon(armor4_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor4_y+(armor4_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
end
when 7 # 7 = agi
self.contents.draw_text(new_x,new_y, width, 24, "agi",1)
bc = PT_EQUIPEX::AGI_COLOR
border_color = color
self_agi = @actor.agi
self_agi = self_agi - weapon.agi_plus unless (weapon == nil)
self_agi = self_agi - armor1.agi_plus unless (armor1 == nil)
self_agi = self_agi - armor2.agi_plus unless (armor2 == nil)
self_agi = self_agi - armor3.agi_plus unless (armor3 == nil)
self_agi = self_agi - armor4.agi_plus unless (armor4 == nil)
self_height = height * self_agi / PT_EQUIPEX::AGI_MAX
self_y = y+height-self_height
weapon_height = height * weapon.agi_plus / PT_EQUIPEX::AGI_MAX if weapon != nil
weapon_y = self_y-weapon_height
armor1_height = height * armor1.agi_plus / PT_EQUIPEX::AGI_MAX if armor1 != nil
armor1_y = weapon_y-armor1_height
armor2_height = height * armor2.agi_plus / PT_EQUIPEX::AGI_MAX if armor2 != nil
armor2_y = armor1_y-armor2_height
armor3_height = height * armor3.agi_plus / PT_EQUIPEX::AGI_MAX if armor3 != nil
armor3_y = armor2_y-armor3_height
armor4_height = height * armor4.agi_plus / PT_EQUIPEX::AGI_MAX if armor4 != nil
armor4_y = armor3_y-armor4_height
self_rect = Rect.new(new_x, self_y, width, self_height)
self_barcolor=Color.new(bc.red+60,bc.green+60,bc.blue+60,bc.alpha)
self.contents.fill_rect(self_rect, self_barcolor)
self.contents.draw_square(self_rect.x,self_rect.y,self_rect.width,
self_rect.height,border_color)
if weapon_height > 0
weapon_rect = Rect.new(new_x, weapon_y, width, weapon_height)
weapon_barcolor=Color.new(bc.red+20,bc.green+20,bc.blue+20,bc.alpha)
else
weapon_rect = Rect.new(new_x,weapon_y+weapon_height,width,-weapon_height)
weapon_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(weapon_rect, weapon_barcolor)
self.contents.draw_square(weapon_rect.x,weapon_rect.y,weapon_rect.width,
weapon_rect.height,border_color)
if armor1_height > 0
armor1_rect = Rect.new(new_x, armor1_y, width, armor1_height)
armor1_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor1_rect = Rect.new(new_x,armor1_y+armor1_height,width,-armor1_height)
armor1_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor1_rect, armor1_barcolor)
self.contents.draw_square(armor1_rect.x,armor1_rect.y,armor1_rect.width,
armor1_rect.height,border_color)
if armor2_height > 0
armor2_rect = Rect.new(new_x, armor2_y, width, armor2_height)
armor2_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor2_rect = Rect.new(new_x,armor2_y+armor2_height,width,-armor2_height)
armor2_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor2_rect, armor2_barcolor)
self.contents.draw_square(armor2_rect.x,armor2_rect.y,armor2_rect.width,
armor2_rect.height,border_color)
if armor3_height > 0
armor3_rect = Rect.new(new_x, armor3_y, width, armor3_height)
armor3_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor3_rect = Rect.new(new_x,armor3_y+armor3_height,width,-armor3_height)
armor3_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor3_rect, armor3_barcolor)
self.contents.draw_square(armor3_rect.x,armor3_rect.y,armor3_rect.width,
armor3_rect.height,border_color)
if armor4_height > 0
armor4_rect = Rect.new(new_x, armor4_y, width, armor4_height)
armor4_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor4_rect = Rect.new(new_x,armor4_y+armor4_height,width,-armor4_height)
armor4_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor4_rect, armor4_barcolor)
self.contents.draw_square(armor4_rect.x,armor4_rect.y,armor4_rect.width,
armor4_rect.height,border_color)
if @type != nil and @new_agi != nil and @new_agi != actor.agi
if @new_agi > actor.agi
case @type
when 0 # weapon
weapon_height2 = height * (@new_agi-actor.agi)/PT_EQUIPEX::AGI_MAX
weapon_y2 = y+height-self_height-weapon_height-weapon_height2
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, goodbar_color)
when 1 # armor1
armor1_height2 = height * (@new_agi-actor.agi)/PT_EQUIPEX::AGI_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height-armor1_height2
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, goodbar_color)
when 2 # armor2
armor2_height2 = height * (@new_agi-actor.agi)/PT_EQUIPEX::AGI_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor2_height2
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, goodbar_color)
when 3 # armor3
armor3_height2 = height * (@new_agi-actor.agi)/PT_EQUIPEX::AGI_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor3_height2
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, goodbar_color)
when 4 # armor4
armor4_height2 = height * (@new_agi-actor.agi)/PT_EQUIPEX::AGI_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height-armor4_height2
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, goodbar_color)
end
else
case @type
when 0 # weapon
weapon_height2 = height * (actor.agi-@new_agi)/PT_EQUIPEX::AGI_MAX
weapon_y2 = y+height-self_height-weapon_height
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, badbar_color)
when 1 # armor1
armor1_height2 = height * (actor.agi-@new_agi)/PT_EQUIPEX::AGI_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, badbar_color)
when 2 # armor2
armor2_height2 = height * (actor.agi-@new_agi)/PT_EQUIPEX::AGI_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, badbar_color)
when 3 # armor3
armor3_height2 = height * (actor.agi-@new_agi)/PT_EQUIPEX::AGI_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, badbar_color)
when 4 # armor4
armor4_height2 = height * (actor.agi-@new_agi)/PT_EQUIPEX::AGI_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, badbar_color)
end
end
end
if PT_EQUIPEX::SHOW_ICONS
if self_agi != 0
self_icon = PT_EQUIPEX::SELF_ICON
bitmap = RPG::Cache.icon(self_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,self_y+(self_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.weapon_id != 0 and $data_weapons[@actor.weapon_id].agi_plus != 0
weapon_icon = $data_weapons[@actor.weapon_id].icon_name
bitmap = RPG::Cache.icon(weapon_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,weapon_y+(weapon_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor1_id != 0 and $data_armors[@actor.armor1_id].agi_plus != 0
armor1_icon = $data_armors[@actor.armor1_id].icon_name
bitmap = RPG::Cache.icon(armor1_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor1_y+(armor1_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor2_id != 0 and $data_armors[@actor.armor2_id].agi_plus != 0
armor2_icon = $data_armors[@actor.armor2_id].icon_name
bitmap = RPG::Cache.icon(armor2_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor2_y+(armor2_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor3_id != 0 and $data_armors[@actor.armor3_id].agi_plus != 0
armor3_icon = $data_armors[@actor.armor3_id].icon_name
bitmap = RPG::Cache.icon(armor3_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor3_y+(armor3_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor4_id != 0 and $data_armors[@actor.armor4_id].agi_plus != 0
armor4_icon = $data_armors[@actor.armor4_id].icon_name
bitmap = RPG::Cache.icon(armor4_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor4_y+(armor4_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
end
when 8 # 8 = int
self.contents.draw_text(new_x,new_y, width, 24, "int",1)
bc = PT_EQUIPEX::INT_COLOR
border_color = color
self_int = @actor.int
self_int = self_int - weapon.int_plus unless (weapon == nil)
self_int = self_int - armor1.int_plus unless (armor1 == nil)
self_int = self_int - armor2.int_plus unless (armor2 == nil)
self_int = self_int - armor3.int_plus unless (armor3 == nil)
self_int = self_int - armor4.int_plus unless (armor4 == nil)
self_height = height * self_int / PT_EQUIPEX::INT_MAX
self_y = y+height-self_height
weapon_height = height * weapon.int_plus / PT_EQUIPEX::INT_MAX if weapon != nil
weapon_y = self_y-weapon_height
armor1_height = height * armor1.int_plus / PT_EQUIPEX::INT_MAX if armor1 != nil
armor1_y = weapon_y-armor1_height
armor2_height = height * armor2.int_plus / PT_EQUIPEX::INT_MAX if armor2 != nil
armor2_y = armor1_y-armor2_height
armor3_height = height * armor3.int_plus / PT_EQUIPEX::INT_MAX if armor3 != nil
armor3_y = armor2_y-armor3_height
armor4_height = height * armor4.int_plus / PT_EQUIPEX::INT_MAX if armor4 != nil
armor4_y = armor3_y-armor4_height
self_rect = Rect.new(new_x, self_y, width, self_height)
self_barcolor=Color.new(bc.red+60,bc.green+60,bc.blue+60,bc.alpha)
self.contents.fill_rect(self_rect, self_barcolor)
self.contents.draw_square(self_rect.x,self_rect.y,self_rect.width,
self_rect.height,border_color)
if weapon_height > 0
weapon_rect = Rect.new(new_x, weapon_y, width, weapon_height)
weapon_barcolor=Color.new(bc.red+20,bc.green+20,bc.blue+20,bc.alpha)
else
weapon_rect = Rect.new(new_x,weapon_y+weapon_height,width,-weapon_height)
weapon_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(weapon_rect, weapon_barcolor)
self.contents.draw_square(weapon_rect.x,weapon_rect.y,weapon_rect.width,
weapon_rect.height,border_color)
if armor1_height > 0
armor1_rect = Rect.new(new_x, armor1_y, width, armor1_height)
armor1_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor1_rect = Rect.new(new_x,armor1_y+armor1_height,width,-armor1_height)
armor1_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor1_rect, armor1_barcolor)
self.contents.draw_square(armor1_rect.x,armor1_rect.y,armor1_rect.width,
armor1_rect.height,border_color)
if armor2_height > 0
armor2_rect = Rect.new(new_x, armor2_y, width, armor2_height)
armor2_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor2_rect = Rect.new(new_x,armor2_y+armor2_height,width,-armor2_height)
armor2_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor2_rect, armor2_barcolor)
self.contents.draw_square(armor2_rect.x,armor2_rect.y,armor2_rect.width,
armor2_rect.height,border_color)
if armor3_height > 0
armor3_rect = Rect.new(new_x, armor3_y, width, armor3_height)
armor3_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor3_rect = Rect.new(new_x,armor3_y+armor3_height,width,-armor3_height)
armor3_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor3_rect, armor3_barcolor)
self.contents.draw_square(armor3_rect.x,armor3_rect.y,armor3_rect.width,
armor3_rect.height,border_color)
if armor4_height > 0
armor4_rect = Rect.new(new_x, armor4_y, width, armor4_height)
armor4_barcolor = Color.new(bc.red,bc.green,bc.blue,bc.alpha)
else
armor4_rect = Rect.new(new_x,armor4_y+armor4_height,width,-armor4_height)
armor4_barcolor = PT_EQUIPEX::MINUS_COLOR
end
self.contents.fill_rect(armor4_rect, armor4_barcolor)
self.contents.draw_square(armor4_rect.x,armor4_rect.y,armor4_rect.width,
armor4_rect.height,border_color)
if @type != nil and @new_int != nil and @new_int != actor.int
if @new_int > actor.int
case @type
when 0 # weapon
weapon_height2 = height * (@new_int-actor.int)/PT_EQUIPEX::INT_MAX
weapon_y2 = y+height-self_height-weapon_height-weapon_height2
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, goodbar_color)
when 1 # armor1
armor1_height2 = height * (@new_int-actor.int)/PT_EQUIPEX::INT_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height-armor1_height2
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, goodbar_color)
when 2 # armor2
armor2_height2 = height * (@new_int-actor.int)/PT_EQUIPEX::INT_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor2_height2
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, goodbar_color)
when 3 # armor3
armor3_height2 = height * (@new_int-actor.int)/PT_EQUIPEX::INT_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor3_height2
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, goodbar_color)
when 4 # armor4
armor4_height2 = height * (@new_int-actor.int)/PT_EQUIPEX::INT_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height-armor4_height2
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, goodbar_color)
end
else
case @type
when 0 # weapon
weapon_height2 = height * (actor.int-@new_int)/PT_EQUIPEX::INT_MAX
weapon_y2 = y+height-self_height-weapon_height
rect = Rect.new(new_x, weapon_y2, width+1, weapon_height2)
self.contents.fill_rect(rect, badbar_color)
when 1 # armor1
armor1_height2 = height * (actor.int-@new_int)/PT_EQUIPEX::INT_MAX
armor1_y2 = y+height-self_height-weapon_height-armor1_height
rect = Rect.new(new_x, armor1_y2, width+1, armor1_height2)
self.contents.fill_rect(rect, badbar_color)
when 2 # armor2
armor2_height2 = height * (actor.int-@new_int)/PT_EQUIPEX::INT_MAX
armor2_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height
rect = Rect.new(new_x, armor2_y2, width+1, armor2_height2)
self.contents.fill_rect(rect, badbar_color)
when 3 # armor3
armor3_height2 = height * (actor.int-@new_int)/PT_EQUIPEX::INT_MAX
armor3_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height
rect = Rect.new(new_x, armor3_y2, width+1, armor3_height2)
self.contents.fill_rect(rect, badbar_color)
when 4 # armor4
armor4_height2 = height * (actor.int-@new_int)/PT_EQUIPEX::INT_MAX
armor4_y2 = y+height-self_height-weapon_height-armor1_height-
armor2_height-armor3_height-armor4_height
rect = Rect.new(new_x, armor4_y2, width+1, armor4_height2)
self.contents.fill_rect(rect, badbar_color)
end
end
end
if PT_EQUIPEX::SHOW_ICONS
if self_int != 0
self_icon = PT_EQUIPEX::SELF_ICON
bitmap = RPG::Cache.icon(self_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,self_y+(self_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.weapon_id != 0 and $data_weapons[@actor.weapon_id].int_plus != 0
weapon_icon = $data_weapons[@actor.weapon_id].icon_name
bitmap = RPG::Cache.icon(weapon_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,weapon_y+(weapon_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor1_id != 0 and $data_armors[@actor.armor1_id].int_plus != 0
armor1_icon = $data_armors[@actor.armor1_id].icon_name
bitmap = RPG::Cache.icon(armor1_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor1_y+(armor1_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor2_id != 0 and $data_armors[@actor.armor2_id].int_plus != 0
armor2_icon = $data_armors[@actor.armor2_id].icon_name
bitmap = RPG::Cache.icon(armor2_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor2_y+(armor2_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor3_id != 0 and $data_armors[@actor.armor3_id].int_plus != 0
armor3_icon = $data_armors[@actor.armor3_id].icon_name
bitmap = RPG::Cache.icon(armor3_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor3_y+(armor3_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
if @actor.armor4_id != 0 and $data_armors[@actor.armor4_id].int_plus != 0
armor4_icon = $data_armors[@actor.armor4_id].icon_name
bitmap = RPG::Cache.icon(armor4_icon)
icon_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(new_x,armor4_y+(armor4_height/2)-12,bitmap,icon_rect,
PT_EQUIPEX::ICON_OPACITY)
end
end
end
end
end
end
##########################################################
class Window_EquipLeft < Window_Base
def initialize(actor)
super(0, 64, 272, 192)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@type = 0
refresh
end
def refresh
self.contents.clear
t_parameters = [2,3,4,5,6,7,8]
draw_pt_equipex(@actor,12,0,24,140,t_parameters)
end
def set_type(type)
@type = type
end
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or
@new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or
@new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
##########################################################
class Scene_Equip
def refresh
@left_window.set_type(@right_window.index)
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk,new_pdef,new_mdef,new_str,new_dex,new_agi,new_int)
end
end
end