#==============================================================================
# Description Window Script
#==============================================================================
SDK.log('Description Window', 'Caldaron', 1.02, '2006-10-8')

if SDK.state('Description Window')
#==============================================================================
Extra_Picture = false
#==============================================================================
module RPG
#--------------------------------------------------------------------------
module Cache
#--------------------------------------------------------------------------
def self.item(filename)
if FileTest.exist?("Graphics/Items/#{filename}.png")
self.load_bitmap("Graphics/Items/", filename)
else
self.load_bitmap("Graphics/Items/", "0")
end
end
#--------------------------------------------------------------------------
def self.weapon(filename)
if FileTest.exist?("Graphics/Weapons/#{filename}.png")
self.load_bitmap("Graphics/Weapons/", filename)
else
self.load_bitmap("Graphics/Weapons/", "0")
end
end
#--------------------------------------------------------------------------
def self.armor(filename)
if FileTest.exist?("Graphics/Armors/#{filename}.png")
self.load_bitmap("Graphics/Armors/", filename)
else
self.load_bitmap("Graphics/Armors/", "0")
end
end
#--------------------------------------------------------------------------
def self.skill(filename)
if FileTest.exist?("Graphics/Skills/#{filename}.png")
self.load_bitmap("Graphics/Skills/", filename)
else
self.load_bitmap("Graphics/Skills/", "0")
end
end
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_Description < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 320)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
end
#--------------------------------------------------------------------------
def make_elem_text(item)
text = ""
flag = false
if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Item) or item.is_a?(RPG::Skill)
for i in item.element_set
if flag
text += ", "
end
text += $data_system.elements
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_element_set
if flag
text += ", "
end
text += $data_system.elements
flag = true
end
end
return text
end
#--------------------------------------------------------------------------
def make_stat_text(item)
text = ""
flag = false
if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Item) or item.is_a?(RPG::Skill)
for i in item.plus_state_set
if flag
text += ", "
end
text += "+ #{$data_states.name}"
flag = true
end
for i in item.minus_state_set
if flag
text += ", "
end
text += "- #{$data_states.name}"
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_state_set
if flag
text += ", "
end
text += $data_states.name
flag = true
end
end
if text == ""
text = "No Characteristics"
end
return text
end
#--------------------------------------------------------------------------
def item(item)
@item = item
self.contents.clear
case @item
when RPG::Item
self.height = 320
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
if Extra_Picture
draw_picture(@item.id.to_s, self.height, 0)
end
case @item.occasion
when 0; occ = 'Always'
when 1; occ = 'In Battle'
when 2; occ = 'In Menu'
when 3; occ = 'Never'
end
case @item.scope
when 0; scope = 'None'
when 1; scope = 'One Enemy'
when 2; scope = 'All Enemies'
when 3; scope = 'One Actor'
when 4; scope = 'All Actors'
when 5; scope = "Dead Actor"
when 6; scope = "All dead Actors"
when 7; scope = 'User'
end
case @item.parameter_type
when 0; parameter_type = 'No Bonus'
when 1; parameter_type = $data_system.words.hp.to_s
when 2; parameter_type = $data_system.words.sp.to_s
when 3; parameter_type = $data_system.words.str.to_s
when 4; parameter_type = $data_system.words.dex.to_s
when 5; parameter_type = $data_system.words.agi.to_s
when 6; parameter_type = $data_system.words.int.to_s
end
parameter_points = @item.parameter_points
if @item.parameter_points == 0
parameter_points = ""
end
if @item.recover_hp < 0 or @item.recover_hp_rate < 0
hp_name = "#{$data_system.words.hp.to_s} Damage"
else
hp_name = "#{$data_system.words.hp.to_s} Recovery"
end
if @item.recover_sp < 0 or @item.recover_sp_rate < 0
mp_name = "#{$data_system.words.sp.to_s} Damage"
else
mp_name = "#{$data_system.words.sp.to_s} Recovery"
end
case @item.consumable
when true; consumable = 'Yes'
when false; consumable = 'No'
end
bitmap = RPG::Cache.icon(@item.icon_name)
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(28, 0, 224, 32, @item.name)
self.contents.draw_text(384, 0, 224, 32, "Costs: #{@item.price.to_s}#{$data_system.words.gold}", 2)
self.contents.draw_text(0, 40, 272, 32, "#{hp_name}: #{@item.recover_hp.to_s} / #{@item.recover_hp_rate.to_s}%")
self.contents.draw_text(0, 64, 272, 32, "#{mp_name}: #{@item.recover_sp.to_s} / #{@item.recover_sp_rate.to_s}%")
self.contents.draw_text(0, 88, 272, 32, "Hit: #{@item.hit.to_s}%")
self.contents.draw_text(408, 40, 200, 32, "Occasion: #{occ}", 2)
self.contents.draw_text(408, 64, 200, 32, "Scope: #{scope}", 2)
self.contents.draw_text(408, 88, 200, 32, "Consumable: #{consumable}", 2)
self.contents.draw_text(0, 144, 272, 32, "#{$data_system.words.pdef.to_s}: #{@item.pdef_f.to_s}%")
self.contents.draw_text(0, 168, 272, 32, "#{$data_system.words.mdef.to_s}: #{@item.mdef_f.to_s}%")
self.contents.draw_text(0, 192, 272, 32, "Variance: #{@item.variance.to_s}%")
self.contents.draw_text(320, 144, 288, 32, "Boni: #{parameter_type.to_s} #{parameter_points.to_s}", 2)
self.contents.draw_text(0, 232, 608, 32, "Type: #{make_elem_text(@item).to_s}")
self.contents.draw_text(0, 256, 608, 32, "Characteristics: #{make_stat_text(@item).to_s}")
when RPG::Skill
self.height = 320
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
if Extra_Picture
draw_picture(@item.id.to_s, self.height, 1)
end
bitmap = RPG::Cache.icon(@item.icon_name)
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(28, 0, 224, 32, @item.name)
self.contents.draw_text(width - 32 - 160, 0, 160, 32, "#{$data_system.words.sp} Costs: #{@item.sp_cost.to_s}", 2)
self.contents.draw_text(0, 40, 272, 32, "Base Damage: #{@item.power.to_s}")
self.contents.draw_text(0, 64, 272, 32, "Hit: #{@item.hit.to_s}%")
case @item.occasion
when 0; occ = 'Always'
when 1; occ = 'In Battle'
when 2; occ = 'In Menu'
when 3; occ = 'Never'
end
self.contents.draw_text(408, 40, 200, 32, "Occasion: #{occ}", 2)
case @item.scope
when 0; scope = 'None'
when 1; scope = 'One Enemy'
when 2; scope = 'All Enemies'
when 3; scope = 'One Actor'
when 4; scope = 'All Actors'
when 5; scope = "Dead Actor"
when 6; scope = "All dead Actors"
when 7; scope = 'User'
end
self.contents.draw_text(408, 64, 200, 32, "Scope: #{scope}", 2)
self.contents.draw_text(0, 120, 272, 32, "#{$data_system.words.atk.to_s}: #{@item.atk_f.to_s}%")
self.contents.draw_text(0, 144, 272, 32, "#{$data_system.words.pdef.to_s}: #{@item.pdef_f.to_s}%")
self.contents.draw_text(0, 168, 272, 32, "#{$data_system.words.mdef.to_s}: #{@item.mdef_f.to_s}%")
self.contents.draw_text(0, 192, 272, 32, "Variance: #{@item.variance.to_s}%")
self.contents.draw_text(320, 120, 288, 32, "#{$data_system.words.str.to_s}: #{@item.str_f.to_s}%", 2)
self.contents.draw_text(320, 144, 288, 32, "#{$data_system.words.dex.to_s}: #{@item.dex_f.to_s}%", 2)
self.contents.draw_text(320, 168, 288, 32, "#{$data_system.words.agi.to_s}: #{@item.agi_f.to_s}%", 2)
self.contents.draw_text(320, 192, 288, 32, "#{$data_system.words.int.to_s}: #{@item.int_f.to_s}%", 2)
self.contents.draw_text(0, 232, 608, 32, "Type: #{make_elem_text(@item).to_s}")
self.contents.draw_text(0, 256, 608, 32, "Characteristics: #{make_stat_text(@item).to_s}")
when RPG::Weapon
self.height = 240
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
if Extra_Picture
draw_picture(@item.id.to_s, self.height, 2)
end
bitmap = RPG::Cache.icon(@item.icon_name)
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(28, 0, 224, 32, @item.name)
self.contents.draw_text(384, 0, 224, 32, "Costs: #{@item.price.to_s}#{$data_system.words.gold}", 2)
self.contents.draw_text(0, 40, 172, 32, "#{$data_system.words.atk.to_s}: #{@item.atk.to_s}")
self.contents.draw_text(0, 64, 172, 32, "#{$data_system.words.pdef.to_s}: #{@item.pdef.to_s}")
self.contents.draw_text(0, 88, 172, 32, "#{$data_system.words.mdef.to_s}: #{@item.mdef.to_s}")
self.contents.draw_text(368, 40, 240, 32, "#{$data_system.words.str.to_s}bonus: #{@item.str_plus.to_s}", 2)
self.contents.draw_text(368, 64, 240, 32, "#{$data_system.words.dex.to_s}bonus: #{@item.dex_plus.to_s}", 2)
self.contents.draw_text(368, 88, 240, 32, "#{$data_system.words.agi.to_s}bonus: #{@item.agi_plus.to_s}", 2)
self.contents.draw_text(368, 112, 240, 32, "#{$data_system.words.int.to_s}bonus: #{@item.int_plus.to_s}", 2)
self.contents.draw_text(0, 152, 608, 32, "Type: #{make_elem_text(@item).to_s}")
self.contents.draw_text(0, 176, 608, 32, "Chracteristics: #{make_stat_text(@item).to_s}")
when RPG::Armor
self.height = 240
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
if Extra_Picture
draw_picture(@item.id.to_s, self.height, 3)
end
bitmap = RPG::Cache.icon(@item.icon_name)
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(28, 0, 224, 32, @item.name)
self.contents.draw_text(384, 0, 224, 32, "Costs: #{@item.price.to_s}#{$data_system.words.gold}", 2)
self.contents.draw_text(0, 40, 172, 32, "#{$data_system.words.pdef.to_s}: #{@item.pdef.to_s}")
self.contents.draw_text(0, 64, 172, 32, "#{$data_system.words.mdef.to_s}: #{@item.mdef.to_s}")
self.contents.draw_text(0, 88, 172, 32, "Evade: #{@item.eva.to_s}")
self.contents.draw_text(368, 40, 240, 32, "#{$data_system.words.str.to_s}bonus: #{@item.str_plus.to_s}", 2)
self.contents.draw_text(368, 64, 240, 32, "#{$data_system.words.dex.to_s}bonus: #{@item.dex_plus.to_s}", 2)
self.contents.draw_text(368, 88, 240, 32, "#{$data_system.words.agi.to_s}bonus: #{@item.agi_plus.to_s}", 2)
self.contents.draw_text(368, 112, 240, 32, "#{$data_system.words.int.to_s}bonus: #{@item.int_plus.to_s}", 2)
self.contents.draw_text(0, 152, 608, 32, "Type: #{make_elem_text(@item).to_s}")
self.contents.draw_text(0, 176, 608, 32, "Characteristics: #{make_stat_text(@item).to_s}")
when nil
@nil_width = contents.text_size("No Description Available").width
@nil_height = contents.text_size("No Description Available").height
self.contents.draw_text(width/2 - @nil_width/2 - 16, height/2 - @nil_height/2 - 16, @nil_width, @nil_height, "No Description Available")
end
end
#--------------------------------------------------------------------------
def draw_picture(item_name, height, type)
case type
when 0
bitmap = RPG::Cache.item(item_name)
when 1
bitmap = RPG::Cache.skill(item_name)
when 2
bitmap = RPG::Cache.weapon(item_name)
when 3
bitmap = RPG::Cache.armor(item_name)
end
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(304 - cw / 2, (height - 16)/2 - ch/2, bitmap, src_rect, 128)
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
alias caldaron_descr_selectable_init initialize
def initialize(x, y, width, height)
caldaron_descr_selectable_init(x, y, width, height)
@old_index = -1
end
#--------------------------------------------------------------------------
alias caldaron_descr_selectable_index index
def index=(index)
@index = index
if self.active and @description_window != nil and @description_window.visible and @old_index != @index
@old_index = index
update_description
end
caldaron_descr_selectable_index
end
#--------------------------------------------------------------------------
def description_window=(description_window)
description_window.x = 0
description_window.y = 0
description_window.z = 2000
description_window.width = 640
description_window.height = 320
description_window.contents = Bitmap.new(608, 288)
description_window.contents.font.name = $fontface
description_window.contents.font.size = $fontsize
description_window.visible = false
@description_window = description_window
if self.active and @description_window != nil and @description_window.visible
update_description
end
end
#--------------------------------------------------------------------------
alias caldaron_descr_selectable_update update
def update
if self.active and @description_window != nil and @description_window.visible and @old_index != @index
@old_index = index
update_description
end
caldaron_descr_selectable_update
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
def update_description
@description_window.item(self.skill)
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
def update_description
@description_window.item(self.item)
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
def update_description
@description_window.item(self.item)
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
def update_description
@description_window.item(self.item)
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors
@help_window = Window_Help.new
@description_window = Window_Description.new
@description_window.visible = false
@show_description = false
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@skill_window.description_window = @description_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@description_window.dispose
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
alias caldaron_descr_skill_update update
def update
if @show_description == true
if @description_window.y < 0
if @description_window.y > -19
@description_window.y = 0
else
@description_window.y += 20
end
end
elsif @description_window.y > -240
if @description_window.y < -219
@description_window.y = -240
@description_window.visible = false
else
@description_window.y -= 20
end
end
@description_window.update
if Input.trigger?(Input::Z)
Audio.se_play("Audio/SE/046-Book01.ogg", 80, 100)
if @show_description == false
@description_window.visible = true
@show_description = true
else
@show_description = false
end
end
caldaron_descr_skill_update
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
def main
@help_window = Window_Help.new
@item_window = Window_Item.new
@description_window = Window_Description.new
@item_window.description_window = @description_window
@description_window.visible = false
@show_description = false
@item_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@description_window.dispose
@help_window.dispose
@item_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
alias caldaron_descr_item_update update
def update
if @show_description == true
if @description_window.y < 0
if @description_window.y > -19
@description_window.y = 0
else
@description_window.y += 20
end
end
elsif @description_window.y > -240
if @description_window.y < -219
@description_window.y = -240
@description_window.visible = false
else
@description_window.y -= 20
end
end
@description_window.update
if Input.trigger?(Input::Z)
Audio.se_play("Audio/SE/046-Book01.ogg", 80, 100)
if @show_description == false
@description_window.visible = true
@show_description = true
else
@show_description = false
end
end
caldaron_descr_item_update
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors
@help_window = Window_Help.new
@description_window = Window_Description.new
@description_window.visible = false
@show_description = false
@right = true
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@right_window.description_window = @description_window
@item_window1.description_window = @description_window
@item_window2.description_window = @description_window
@item_window3.description_window = @description_window
@item_window4.description_window = @description_window
@item_window5.description_window = @description_window
@right_window.index = @equip_index
refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@description_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
alias caldaron_descr_equip_update update
def update
if @show_description == true
if @description_window.y < 0
if @description_window.y > -19
@description_window.y = 0
else
@description_window.y += 20
end
end
elsif @description_window.y > -240
if @description_window.y < -219
@description_window.y = -240
@description_window.visible = false
else
@description_window.y -= 20
end
end
@description_window.update
if Input.trigger?(Input::Z)
Audio.se_play("Audio/SE/046-Book01.ogg", 80, 100)
if @show_description == false
@description_window.visible = true
@show_description = true
else
@show_description = false
end
end
caldaron_descr_equip_update
end
#--------------------------------------------------------------------------
alias caldaron_descr_equip_update_right update_right
def update_right
if @right == false
@right_window.update_description
@right = true
end
caldaron_descr_equip_update_right
end
#--------------------------------------------------------------------------
alias caldaron_descr_equip_update_item update_item
def update_item
if @right
@item_window.update_description
@right = false
end
caldaron_descr_equip_update_item
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
alias caldaron_descr_battle_main main
def main
@description_window = Window_Description.new
@description_window.visible = false
@show_description = false
caldaron_descr_battle_main
@description_window.dispose
end
#--------------------------------------------------------------------------
alias caldaron_descr_battle_start_skill_select start_skill_select
def start_skill_select
caldaron_descr_battle_start_skill_select
@skill_window.description_window = @description_window
end
#--------------------------------------------------------------------------
alias caldaron_descr_battle_start_item_select start_item_select
def start_item_select
caldaron_descr_battle_start_item_select
@item_window.description_window = @description_window
end
#--------------------------------------------------------------------------
def update_phase3_skill_select
if @show_description == true
if @description_window.y < 0
if @description_window.y > -19
@description_window.y = 0
else
@description_window.y += 20
end
end
elsif @description_window.y > -240
if @description_window.y < -219
@description_window.y = -240
@description_window.visible = false
else
@description_window.y -= 20
end
end
@description_window.update
if Input.trigger?(Input::Z)
Audio.se_play("Audio/SE/046-Book01.ogg", 80, 100)
if @show_description == false
@description_window.visible = true
@show_description = true
else
@show_description = false
end
end
@skill_window.visible = true
@skill_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@description_window.visible = false
@show_description = false
end_skill_select
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.skill_id = @skill.id
@description_window.visible = false
@show_description = false
@skill_window.visible = false
if @skill.scope == 1
start_enemy_select
elsif @skill.scope == 3 or @skill.scope == 5
start_actor_select
else
end_skill_select
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
def update_phase3_item_select
if @show_description == true
if @description_window.y < 0
if @description_window.y > -19
@description_window.y = 0
else
@description_window.y += 20
end
end
elsif @description_window.y > -240
if @description_window.y < -219
@description_window.y = -240
@description_window.visible = false
else
@description_window.y -= 20
end
end
@description_window.update
if Input.trigger?(Input::Z)
Audio.se_play("Audio/SE/046-Book01.ogg", 80, 100)
if @show_description == false
@description_window.visible = true
@show_description = true
else
@show_description = false
end
end
@item_window.visible = true
@item_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@description_window.visible = false
@show_description = false
end_item_select
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.item_id = @item.id
@description_window.visible = false
@show_description = false
@item_window.visible = false
if @item.scope == 1
start_enemy_select
elsif @item.scope == 3 or @item.scope == 5
start_actor_select
else
end_item_select
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
end