#==============================================================================
# Made or modified by Squall
webmaster@loeher.zzn.com#==============================================================================
# ■ Window_ItemMenu
#==============================================================================
class Window_ItemMenu < Window_Selectable
#--------------------------------------------------------------------------
# ● object define
#--------------------------------------------------------------------------
def initialize
super(280, 0, 200, 480)
@column_max = 1
refresh
self.z = 200
self.active = false
self.visible = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● items define
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = 20
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● draw items
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 100, 32, item.name, 0)
self.contents.draw_text(x + 128, y, 10, 32, ":", 1)
self.contents.draw_text(x + 138, y, 22, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● help window set text settings
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Window_SkillMenu
#==============================================================================
class Window_SkillMenu < Window_Selectable
#--------------------------------------------------------------------------
# ● initialisation
#--------------------------------------------------------------------------
def initialize(actor)
super(280, 0, 200, 288)
@actor = actor
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● skill define
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in
0...@actor.skills.sizeskill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = 20
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● draw skill list
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 110, 32, skill.name, 0)
self.contents.draw_text(x + 138, y, 22, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● help_window text settings
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
#--------------------------------------------------------------------------
# ● set up the page_up function
#--------------------------------------------------------------------------
def page_up
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
#--------------------------------------------------------------------------
# ● set up the page_down function
#--------------------------------------------------------------------------
def page_down
if self.top_row > 0
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
#==============================================================================
# ■ Window_TargetMenu
#==============================================================================
class Window_TargetMenu < Window_Selectable
#--------------------------------------------------------------------------
# ● initialize the window
#--------------------------------------------------------------------------
def initialize
super(0, 0, 280, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 20
self.z = 200
self.visible = false
self.active = false
@item_max = $game_party.actors.size
refresh
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 116
actor = $game_party.actors[i]
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 114, y)
draw_actor_level(actor, x + 8, y + 32)
draw_actor_state(actor, x + 8, y + 64)
draw_actor_hp(actor, x + 114, y + 32)
draw_actor_sp(actor, x + 114, y + 64)
end
end
#--------------------------------------------------------------------------
# ● cursor update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index <= -2
self.cursor_rect.set(0, (@index + 10) * 116, self.width - 32, 96)
elsif @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#==============================================================================
# ■ Window_MenuStatusMenu
#==============================================================================
class Window_MenuStatusMenu < Window_Base
#--------------------------------------------------------------------------
# ● object define
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 280, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 21
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● define colors
#--------------------------------------------------------------------------
def plus_color
return Color.new(63, 199, 154)
end
def minus_color
return Color.new(200, 79, 62)
end
#--------------------------------------------------------------------------
# ● define draw method for character's evasion
#--------------------------------------------------------------------------
def draw_actor_eva(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, "Evasion")
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2)
end
#--------------------------------------------------------------------------
# ● define draw method for character's hp
#--------------------------------------------------------------------------
def draw_actorhp(actor, x, y, width = 144)
if actor.maxhp <= 999
w = 12
else
w = 0
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(width + w - 50, y, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(width + w, y, 12, 32, "/", 2)
self.contents.draw_text(width, y, 48, 32, actor.maxhp.to_s, 2)
end
#--------------------------------------------------------------------------
# ● define draw method for character's sp
#--------------------------------------------------------------------------
def draw_actorsp(actor, x, y, width = 144)
if actor.maxsp <= 999
w = 12
else
w = 0
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(width + w - 50, y, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(width + w, y, 12, 32, "/", 2)
self.contents.draw_text(width, y, 48, 32, actor.maxsp.to_s, 2)
end