#===========================================================================#
# #*****************# Equipable Items Window #
# #*** By Falcao ***# - Window selectable aliased #
# #*****************# #
# RMXP #
# makerpalace.onlinegoo.com #
#===========================================================================#
# Windows font name
Equipable_Window_Font = "Georgia"
class Window_Selectable < Window_Base
alias falcao_rect_update update_cursor_rect
def update_cursor_rect
falcao_rect_update
if $scene.is_a?(Scene_Map)
cursor_width = self.width / @column_max - 10
x = @index % @column_max * (cursor_width)
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x - 6, y, cursor_width , 32)
end
end
end
#--------------------------------------------------------------------------
# * Weapon equip window
#--------------------------------------------------------------------------
class Window_Weapon_Select < Window_Selectable
attr_reader :data
def initialize
super(16, 224, 240, 160)
@column_max = 2
self.z = 900
self.opacity = 150
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
actor = $game_party.actors[0]
weapon_set = $data_classes[actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
number = $game_party.weapon_number(item.id)
x = 4 + index % 2 * (80 + 32)
y = index / 2 * 32
self.contents.font.size = 14
self.contents.font.name = Equipable_Window_Font
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 - 5, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)#opacity
self.contents.draw_text(x + 22, y, 212, 32, item.name, 0)
self.contents.font.size = 12
self.contents.font.color = Color.new(0,0,0,255) #black
self.contents.draw_text(x, y + 12, 24, 32, number.to_s)
self.contents.font.color = Color.new(250,255,255,255) #white
self.contents.draw_text(x - 1, y + 11, 24, 32, number.to_s)
end
end
#--------------------------------------------------------------------------
# * Equip Shield
#--------------------------------------------------------------------------
class Window_Shield_Select < Window_Selectable
attr_reader :data
def initialize
super(48, 224, 240, 160)
self.z = 900
@column_max = 2
self.opacity = 150
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
actor = $game_party.actors[0]
armor_set = $data_classes[actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == 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)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
number = $game_party.armor_number(item.id)
x = 4 + index % 2 * (80 + 32)
y = index / 2 * 32
self.contents.font.size = 14
self.contents.font.name = Equipable_Window_Font
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 - 5, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 22, y, 212, 32, item.name, 0)
self.contents.font.size = 12
self.contents.font.color = Color.new(0,0,0,255) #black
self.contents.draw_text(x, y + 12, 24, 32, number.to_s)
self.contents.font.color = Color.new(250,255,255,255) #white
self.contents.draw_text(x - 1, y + 11, 24, 32, number.to_s)
end
end
#--------------------------------------------------------------------------
# * Skills equip window
#--------------------------------------------------------------------------
class Window_Skill_Select < Window_Selectable
attr_reader :data
def initialize
super(80, 224, 240, 160)
self.z = 900
@column_max = 2
self.opacity = 150
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
actor = $game_party.actors[0]
for i in 0...actor.skills.size
skill = $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)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
actor = $game_party.actors[0]
if actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (80 + 32)
y = index / 2 * 32
self.contents.font.size = 14
self.contents.font.name = Equipable_Window_Font
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 - 5, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 22, y, 204, 32, skill.name, 0)
end
end
#--------------------------------------------------------------------------
# * Items equip window
#--------------------------------------------------------------------------
class Window_Item_Select < Window_Selectable
attr_reader :data
def initialize
super(112, 224, 240, 160)
self.z = 900
@column_max = 2
self.opacity = 150
refresh
self.index = 0
end
def item
return @data[self.index]
end
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
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
if $game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (80 + 32)
y = index / 2 * 32
self.contents.font.size = 14
self.contents.font.name = Equipable_Window_Font
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 - 5, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 22, y, 212, 32, item.name, 0)
self.contents.font.size = 12
self.contents.font.color = Color.new(0,0,0,255) #black
self.contents.draw_text(x, y + 12, 24, 32, number.to_s)
self.contents.font.color = Color.new(250,255,255,255) #white
self.contents.draw_text(x - 1, y + 11, 24, 32, number.to_s)
end
end
class Item_Descript < Window_Base
def initialize
super(0, 0, 240, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 900
self.opacity = 200
end
def set_text(wx, wy, text = "", name = "")
self.contents.clear
self.contents.font.bold = false
self.contents.font.size = 14
self.x = wx
self.y = wy
self.contents.draw_text(0, 10, self.width + 60, 32, text)
self.contents.font.size = 16
self.contents.font.bold = true
self.contents.draw_text(-20, -10 , self.width, 32, name, 1)
end
end
#------------------------------------------------------------------------------
class Scene_Map
alias falitem_window_main main
def main
falitem_window_main
dispose_window_tools
end
def create_weapon_window
@fweapon_window = Window_Weapon_Select.new
@ihelp_window = Item_Descript.new
end
def create_shield_window
@fshield_window = Window_Shield_Select.new
@ihelp_window = Item_Descript.new
end
def create_skill_window
@fskill_window = Window_Skill_Select.new
@ihelp_window = Item_Descript.new
end
def create_item_window
@fitem_window = Window_Item_Select.new
@ihelp_window = Item_Descript.new
end
def dispose_window_tools
@fitem_window.dispose if not @fitem_window.nil?
@fitem_window = nil
@ihelp_window.dispose if not @ihelp_window.nil?
@ihelp_window = nil
@fweapon_window.dispose if not @fweapon_window.nil?
@fweapon_window = nil
@fshield_window.dispose if not @fshield_window.nil?
@fshield_window = nil
@fskill_window.dispose if not @fskill_window.nil?
@fskill_window = nil
$game_system.menu_disabled = $game_map.check_itemmenu_active[1]
$game_map.check_itemmenu_active[0] = false
end
alias falitem_window_update update
def update
falitem_window_update
update_items_system
end
def update_items_system
if Mouse.trigger?(0)
return if $game_switches[MOG_ACTIVE_HUD::DISABLE_HUD_SWITCH]
case $game_map.falgrid_cube
#weapon
when 5
dispose_window_tools
create_weapon_window
@fweapon_window.refresh
$game_map.check_itemmenu_active[0] = true
$game_system.se_play($data_system.decision_se)
#shield
when 6
dispose_window_tools
create_shield_window
@fshield_window.refresh
$game_map.check_itemmenu_active[0] = true
$game_system.se_play($data_system.decision_se)
# skills
when 7
dispose_window_tools
create_skill_window
@fskill_window.refresh
$game_map.check_itemmenu_active[0] = true
$game_system.se_play($data_system.decision_se)
#item
when 8
dispose_window_tools
create_item_window
@fitem_window.refresh
$game_map.check_itemmenu_active[0] = true
$game_system.se_play($data_system.decision_se)
end
end
# item
if not @fitem_window.nil?
@fitem_window.update
if @fitem != nil
if @fitem_window.data.size > 8 and @fitem_window.data.size < 15
@fitem_window.height = 256
@fitem_window.y = 128
@ihelp_window.set_text(112, 65, @fitem.description, "Items")
elsif @fitem_window.data.size > 14
@fitem_window.height = 320
@fitem_window.y = 65
@ihelp_window.set_text(112, 2, @fitem.description, "Items")
else
@ihelp_window.set_text(112, 161, @fitem.description, "Items")
end
else
@ihelp_window.set_text(112, 161,"", "Items")
end
@fitem = @fitem_window.item
fupdate_item
#weapon
elsif not @fweapon_window.nil?
@fweapon_window.update
if @fweapon != nil
if @fweapon_window.data.size > 8 and @fweapon_window.data.size < 15
@fweapon_window.height = 256
@fweapon_window.y = 128
@ihelp_window.set_text(16, 65, @fweapon.description, "Weapons")
elsif @fweapon_window.data.size > 14
@fweapon_window.height = 320
@fweapon_window.y = 65
@ihelp_window.set_text(16, 2, @fweapon.description, "Weapons")
else
@ihelp_window.set_text(16, 161, @fweapon.description, "Weapons")
end
else
@ihelp_window.set_text(16, 161,"", "Weapons")
end
@fweapon = @fweapon_window.item
fupdate_item
#shield
elsif not @fshield_window.nil?
@fshield_window.update
if @shieldcc != nil
if @fshield_window.data.size > 8 and @fshield_window.data.size < 15
@fshield_window.height = 256
@fshield_window.y = 128
@ihelp_window.set_text(48, 65, @shieldcc.description, "Armor")
elsif @fshield_window.data.size > 14
@fshield_window.height = 320
@fshield_window.y = 65
@ihelp_window.set_text(48, 2, @shieldcc.description, "Armor")
else
@ihelp_window.set_text(48, 161, @shieldcc.description, "Armor")
end
else
@ihelp_window.set_text(48, 161,"", "Armor")
end
@shieldcc = @fshield_window.item
fupdate_item
#skill
elsif not @fskill_window.nil?
@fskill_window.update
if @fskills != nil
if @fskill_window.data.size > 8 and @fskill_window.data.size < 15
@fskill_window.height = 256
@fskill_window.y = 128
@ihelp_window.set_text(80, 65, @fskills.description, "Skills")
elsif @fskill_window.data.size > 14
@fskill_window.height = 320
@fskill_window.y = 65
@ihelp_window.set_text(80, 2, @fskills.description, "Skills")
else
@ihelp_window.set_text(80, 161, @fskills.description, "Skills")
end
else
@ihelp_window.set_text(80, 161,"", "Skills")
end
@fskills = @fskill_window.item
fupdate_item
end
end
def fupdate_item
if $game_switches[MOG_ACTIVE_HUD::DISABLE_HUD_SWITCH]
dispose_window_tools
return
end
$game_system.menu_disabled = true
# If input press B clear everything
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
dispose_window_tools
end
return if $game_map.over_the_cube?
if Mouse.trigger?(0)
# Equip Items
if not @fitem_window.nil?
if @fitem == nil
$game_system.se_play($data_system.cancel_se)
dispose_window_tools
return
end
item_id = @fitem.id
item_tool_id = XAS::XASITEM_ID[@fitem.id]
if item_tool_id != nil
$game_system.se_play($data_system.equip_se)
$game_system.xas_item_id = @fitem.id
end
dispose_window_tools
return
# Equip Weapons
elsif not @fweapon_window.nil?
if @fweapon == nil
$game_system.se_play($data_system.cancel_se)
dispose_window_tools
return
end
actor = $game_party.actors[0]
actor.equip(0, @fweapon.id)
$game_system.se_play($data_system.equip_se)
dispose_window_tools
# Equip secundary weapon xas shield
elsif not @fshield_window.nil?
if @shieldcc == nil
$game_system.se_play($data_system.cancel_se)
dispose_window_tools
return
end
actor = $game_party.actors[0]
actor.equip(1, @shieldcc.id)
$game_system.se_play($data_system.equip_se)
dispose_window_tools
# Equip skills
elsif not @fskill_window.nil?
if @fskills == nil
$game_system.se_play($data_system.cancel_se)
dispose_window_tools
return
end
$game_system.se_play($data_system.equip_se)
dispose_window_tools
end
end
end
end
class Interpreter
alias fal_command_135 command_135
def command_135
$game_map.check_itemmenu_active[1] = (@parameters[0] == 0)
fal_command_135
end
end