CODE
#===============================================================================
# Window_Command_Centered
#===============================================================================
class Window_Command_Centered < Window_Command
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
end # Window_Command_Centered
#===============================================================================
# Window_SaveFile
#===============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# alias method: draw_playtime
#--------------------------------------------------------------------------
alias draw_playtime_pss draw_playtime unless $@
def draw_playtime(x, y, width, align)
draw_playtime_pss(x, 0, width, align)
end
end # Window_SaveFile
#==============================================================================
# Window_MenuStatus
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: refresh
#--------------------------------------------------------------------------
def refresh
@item_max = $game_party.members.size
create_contents
colour_non_battler_background
for i in 0..$game_party.members.size
draw_item(i)
end
end
#--------------------------------------------------------------------------
# overwrite method: create_contents
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * 96].max)
self.contents.font.color = normal_color
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.members[index]
return if actor == nil
draw_actor_face(actor, 2, index * 96 + 2, 92)
x = 104
y = index * 96
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 120, y)
draw_actor_level(actor, x, y + WLH * 1)
draw_actor_state(actor, x, y + WLH * 2)
draw_stun_indicator(x, y + WLH * 3, actor) if $imported["ClassStatDUR"]
draw_actor_hp(actor, x + 120, y + WLH * 1, 120)
draw_actor_mp(actor, x + 120, y + WLH * 2, 120)
draw_menu_exp(actor, x + 120, y + WLH * 3, 120)
end
#--------------------------------------------------------------------------
# new method: draw_menu_exp
#--------------------------------------------------------------------------
def draw_menu_exp(actor, x, y, size = 120)
if actor.next_exp != 0
gw = size * actor.now_exp
gw /= actor.next_exp
else
gw = size
end
gc1 = text_color(YEZ::PARTY::EXP_GAUGE_1)
gc2 = text_color(YEZ::PARTY::EXP_GAUGE_2)
self.contents.fill_rect(x, y + WLH - 8, size, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 40, WLH, YEZ::PARTY::EXP_TEXT)
self.contents.font.color = normal_color
if actor.next_exp != 0
expercent = actor.now_exp * 100.0
expercent /= actor.next_exp
else
expercent = 100.0
end
expercent = 100.0 if expercent > 100.0
text = sprintf(YEZ::PARTY::PERCENT_EXP, expercent)
self.contents.draw_text(x, y, size, WLH, text, 2)
end
#--------------------------------------------------------------------------
# new method: colour_non_battler_background
#--------------------------------------------------------------------------
def colour_non_battler_background
color = Color.new(0, 0, 0, YEZ::PARTY::BACK_OPACITY)
dy = $game_party.battle_members.size * 96
dh = $game_party.reserve_members.size * 96
self.contents.fill_rect(0, dy, self.width - 32, dh, color) if dh > 0
end
#--------------------------------------------------------------------------
# overwrite method: top_row
#--------------------------------------------------------------------------
def top_row; return self.oy / 96; end
#--------------------------------------------------------------------------
# overwrite method: top_row=
#--------------------------------------------------------------------------
def top_row=(row); super(row); self.oy = self.oy / WLH * 96; end
#--------------------------------------------------------------------------
# overwrite method: page_row_max
#--------------------------------------------------------------------------
def page_row_max; return (self.height - 32) / 96; end
#--------------------------------------------------------------------------
# overwrite method: item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = super(index)
rect.height = 96
rect.y = index / @column_max * 96
return rect
end
#--------------------------------------------------------------------------
# overwrite method: update_cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0
self.cursor_rect.empty
elsif @index < @item_max
super
elsif @index >= 100
self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
else
self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
end
end
end # Window_MenuStatus
#===============================================================================
# Window_PartyBattlers
#===============================================================================
class Window_PartyBattlers < Window_Selectable
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :selected_index
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, 416, 128)
@column_max = YEZ::PARTY::BATTLE_MAX
@spacing = 0
refresh
self.index = 0
self.active = true
end
#--------------------------------------------------------------------------
# new method: item
#--------------------------------------------------------------------------
def item; return @data[self.index]; end
#--------------------------------------------------------------------------
# new method: selected_item
#--------------------------------------------------------------------------
def selected_item; return @data[@selected_index]; end
#--------------------------------------------------------------------------
# overwrite method: create_contents
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * 96].max)
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
$game_party.battle_members if $game_party.battlers == nil
@data = []
for id in $game_party.battlers; @data.push(id); end
@item_max = YEZ::PARTY::BATTLE_MAX
create_contents
for i in 0..(@item_max-1); draw_item(i); end
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_actors[@data[index]]
rect = item_rect(index)
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
if actor == nil
color = Color.new(0, 0, 0, YEZ::PARTY::BACK_OPACITY)
self.contents.fill_rect(rect.x+2, rect.y+2, rect.width-4, rect.height-4, color)
if @selected_index != nil and @selected_index == index
self.contents.font.color = text_color(YEZ::PARTY::ACTIVE_COLOUR)
else
self.contents.font.color = system_color
end
text = YEZ::PARTY::VOCAB[:empty]
self.contents.draw_text(rect.x, WLH*3/2, rect.width, WLH, text, 1)
return
end
draw_actor_face(actor, rect.x+2, rect.y+2, 92)
draw_actor_name(actor, rect.x, rect.y)
if $game_party.fixed_members.include?(actor)
draw_icon(YEZ::PARTY::LOCKED_ICON, rect.x, rect.y + WLH*3)
end
end
#--------------------------------------------------------------------------
# draw_actor_face
#--------------------------------------------------------------------------
def draw_actor_face(actor, x, y, size = 96)
opacity = YEZ::PARTY::FACE_OPACITY
face_name = actor.face_name
face_index = actor.face_index
bitmap = Cache.face(face_name)
rect = Rect.new(0, 0, 0, 0)
rect.x = face_index % 4 * 96 + (96 - size) / 2
rect.y = face_index / 4 * 96 + (96 - size) / 2
rect.width = size
rect.height = size
self.contents.blt(x, y, bitmap, rect, opacity)
bitmap.dispose
end
#--------------------------------------------------------------------------
# draw_actor_name
#--------------------------------------------------------------------------
def draw_actor_name(actor, dx, dy)
dx += 4; dw = 88
if @selected_index != nil and @selected_index == actor.index
self.contents.font.color = text_color(YEZ::PARTY::ACTIVE_COLOUR)
else
self.contents.font.color = hp_color(actor)
end
self.contents.draw_text(dx, dy, dw, WLH, actor.name, 0)
end
#--------------------------------------------------------------------------
# overwrite method: top_row
#--------------------------------------------------------------------------
def top_row; return self.oy / 96; end
#--------------------------------------------------------------------------
# overwrite method: top_row=
#--------------------------------------------------------------------------
def top_row=(row); super(row); self.oy = self.oy / WLH * 96; end
#--------------------------------------------------------------------------
# overwrite method: page_row_max
#--------------------------------------------------------------------------
def page_row_max; return (self.height - 32) / 96; end
#--------------------------------------------------------------------------
# overwrite method: item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 96, 96)
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * 96
return rect
end
#--------------------------------------------------------------------------
# overwrite method: update_cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0
self.cursor_rect.empty
elsif @index < @item_max
super
elsif @index >= 100
self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
else
self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
end
end
end # Window_PartyBattlers
#===============================================================================
# Window_PartyActors
#===============================================================================
class Window_PartyActors < Window_Selectable
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :selected_index
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, 128, 160, 288)
self.index = -1
refresh
end
#--------------------------------------------------------------------------
# new method: item
#--------------------------------------------------------------------------
def item; return @data[self.index]; end
#--------------------------------------------------------------------------
# new method: selected_item
#--------------------------------------------------------------------------
def selected_item; return @data[@selected_index]; end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for actor in $game_party.all_members; @data.push(actor.id); end
@data = @data + [0]
@item_max = @data.size
create_contents
for i in 0..(@item_max-1); draw_item(i); end
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
actor = $game_actors[@data[index]]
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
if actor == nil
draw_icon(YEZ::PARTY::CLEAR_ICON, rect.x+6, rect.y)
rect.x += 32; rect.width -= 34
text = YEZ::PARTY::VOCAB[:clear]
self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text)
return
end
offset = YEZ::PARTY::SPRITE_OFFSET
draw_actor_graphic(actor, rect.x + 16, rect.y + rect.height + offset)
rect.x += 32
rect.width -= 34
self.contents.font.color = hp_color(actor)
enabled = !$game_party.battle_members.include?(actor)
enabled = false if $game_party.fixed_reserve.to_a.include?(actor.id)
self.contents.font.color.alpha = enabled ? 255 : 128
if @selected_index != nil and @selected_index == index
self.contents.font.color = text_color(YEZ::PARTY::ACTIVE_COLOUR)
end
self.contents.draw_text(rect.x, rect.y, rect.width, WLH, actor.name)
end
end # Window_PartyActors
#===============================================================================
# Window_PartyHelp
#===============================================================================
class Window_PartyHelp < Window_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :type
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(416, 0, 128, 128)
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(type = 1)
self.contents.clear
@type = type
vocab = YEZ::PARTY::VOCAB
keys = YEZ::PARTY::KEYS
buttons = YEZ::ICONS[:buttons] if $imported["Icons"]
dx = 4; dw = 120
if @type == 1
text1 = vocab[:c_battler]
text2 = vocab[:b_battler]
text3 = vocab[:a_battler]
text4 = vocab[:x_battler]
if $imported["Icons"]
draw_icon(buttons[:c], 0, WLH*0)
draw_icon(buttons[:b], 0, WLH*1)
draw_icon(buttons[:a], 0, WLH*2)
draw_icon(buttons[:x], 0, WLH*3)
dx = 24; dw = 100
else
text1 = sprintf(keys[:c], text1)
text2 = sprintf(keys[:b], text2)
text3 = sprintf(keys[:a], text3)
text4 = sprintf(keys[:x], text4)
end
elsif @type == 2
text1 = vocab[:c_actors]
text2 = vocab[:b_actors]
text3 = vocab[:a_actors]
text4 = vocab[:x_actors]
if $imported["Icons"]
draw_icon(buttons[:c], 0, WLH*0)
draw_icon(buttons[:b], 0, WLH*1)
draw_icon(buttons[:a], 0, WLH*2)
draw_icon(buttons[:x], 0, WLH*3)
dx = 24; dw = 100
else
text1 = sprintf(keys[:c], text1)
text2 = sprintf(keys[:b], text2)
text3 = sprintf(keys[:a], text3)
text4 = sprintf(keys[:x], text4)
end
end
self.contents.draw_text(dx, WLH*0, dw, WLH, text1)
self.contents.draw_text(dx, WLH*1, dw, WLH, text2)
self.contents.draw_text(dx, WLH*2, dw, WLH, text3)
self.contents.draw_text(dx, WLH*3, dw, WLH, text4)
end
end # Window_PartyHelp