Code:
#===============================================================================
# This Script is made specfically for usage with GTBS version 1.5.1.4 by GubiD.
#===============================================================================
#~ You need to put Yanflys script UNDER GTBS...
#~ Then put this script UNDER Yanfly's
#~ Also Note Subclassia should be UNDER all these
#~ But The GTBS Patch for it stays in
#~ GTBS ABOVE ALL THIS.
#~
#----------------------------------------------------------------------------
# Draw Skill Window and contents
#----------------------------------------------------------------------------
class TBS_Skill < Window_Skill
attr_reader :data
#----------------------------------------------------------------------------
# Initialize
#----------------------------------------------------------------------------
def initialize
if GTBS::VX
actor = $game_actors[1]
super(0, 56, 544, 360, actor)
@actor = actor
@slot = nil
@column_max = 2
else
super(nil)
end
@back = Sprite.new
self.opacity = GTBS::CONTROL_OPACITY
if FileTest.exist?('Graphics/Pictures/GTBS/TBS_Item_Skill.png')
self.opacity = 0
@back.bitmap = RPG::Cache.picture('GTBS/TBS_Item_Skill')
@back.visible = false
@back.opacity = GTBS::CONTROL_OPACITY
end
end
#~ #----------------------------------------------------------------------------
#~ # Refresh Process
#~ #----------------------------------------------------------------------------
#~ # The local refresh is run first, and then must call the super
#~ #----------------------------------------------------------------------------
#~ def refresh(actor = nil)
#~ @actor = actor
#~ super() if @actor != nil
#~ end
#~ #----------------------------------------------------------------------------
#~ # Return data for index
#~ #----------------------------------------------------------------------------
#~ def skill
#~ if @data == nil
#~ return nil
#~ else
#~ return @data[self.index]
#~ end
#~ end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
@data = []
auto_equip = 0
if YE::EQUIPSKILL::AUTO_EQUIP_SKILLS.include?(@actor.id)
for skill_id in YE::EQUIPSKILL::AUTO_EQUIP_SKILLS[@actor.id]
next unless @actor.skill_learn?($data_skills[skill_id])
auto_equip += 1
skill = $data_skills[skill_id]
@data.push(skill)
end
end
if YE::EQUIPSKILL::AUTO_CLASS_SKILLS.include?(@actor.class.id)
for skill_id in YE::EQUIPSKILL::AUTO_CLASS_SKILLS[@actor.class.id]
next unless @actor.skill_learn?($data_skills[skill_id])
auto_equip += 1
skill = $data_skills[skill_id]
@data.push(skill)
end
end
for i in 1..(@actor.max_slots)
@data.push(@actor.skill_in_slot(i))
end
@item_max = (@actor.max_slots) + auto_equip
create_contents
for i in 0..(@item_max - 1)
draw_item(i)
end
end
#--------------------------------------------------------------------------
# draw item
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
rect = item_rect(index)
enabled = true
self.contents.clear_rect(rect)
rect.width -= 4
dx = rect.x
dy = rect.y
dw = rect.width
dh = rect.height
sw = self.width - 32
if skill == nil
text = YE::EQUIPSKILL::EMPTY_SLOT
icon = YE::EQUIPSKILL::EMPTY_ICON
enabled = false
else
text = skill.name
icon = skill.icon_index
end
draw_icon(icon, dx, dy, enabled)
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(dx+24, dy, dw-72, dh, text, 0)
if skill != nil and skill.limit_type != []
dx = rect.x + rect.width - 24
for l_type in skill.limit_type
narray = YE::EQUIPSKILL::LIMIT_HASH[l_type]
next unless narray[2]
next unless narray[3]
icon = narray[0]
draw_icon(icon, dx, rect.y, enabled)
dx -= 24
end
end
end
#--------------------------------------------------------------------------
# skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#----------------------------------------------------------------------------
# Set Visibility
#----------------------------------------------------------------------------
def visible=(bool)
super(bool)
@back.visible = bool
end
#----------------------------------------------------------------------------
# Update background image if exist
#----------------------------------------------------------------------------
def update
@back.x = self.x
@back.y = self.y
@back.update
super
end
end