module DARKCAMPER
module SWORDSUMMON
SWORDS ={
#:key => ["name to appear", weapon_id, armor_id, icon, switch]
:windsword => ["Hertia", 1, 253, "001-Weapon01.png", 25],
:earthsword => ["Ryzheus", 2, 254, "002-Weapon02.png", 26]
:firesword => ["Fenix", 3, 255, "003-Weapon03.png", 27]
:watersword => ["Elena", 4, 256, "004-Weapon04.png", 28]
}
end
end
class Scene_Swordcondense
def initialize(menu_index=0)
@menu_index = menu_index
@actor = $game_actors[1]
end
def main
# Variable Declarations
c1 = "Main-hand"
c2 = "Off-hand"
# Object Declarations and Initializations
@swordcondense = Window_Command.new(150, [c1, c2])
@schelp = Window_Schelp.new
# Configuring the window(s)
@swordcondense.y = 150
@swordcondense.index = @menu_index
#Pre-processing
@spriteset = Spriteset_Map.new
# Processing
Graphics.transition
# Looping
update_objects.each {|s| s.update} while $scene == self
# Dispose
Graphics.freeze
all_dispose
end
def update_objects
[Graphics, Input, @swordcondense, self]
end
def all_dispose
all = instance_variables.map {|s| instance_variable_get("#{s}")}.flatten
all.delete_if {|s| s.not.respond_to?(:dispose) }
all.delete_if {|s| s.respond_to?(:disposed?) && s.disposed?}
all.dispose
end
def sc_return(id)
case id
# Weapons
when 1 then return "Hertia"
when 2 then return "Ryzheus"
when 3 then return "Fenix"
when 4 then return "Elena"
# Armors
when 253 then return "Hertia"
when 254 then return "Ryzheus"
when 255 then return "Fenix"
when 256 then return "Elena"
# else
else return "None equipped."
end
end
#Update Methods
def update
case @swordcondense.index
when 0 then @schelp.update(sc_return(@actor.weapon_id))
when 1 then @schelp.update(sc_return(@actor.armor1_id))
end
@swordcondense.active && update_sc_command
end
def update_sc_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
# I believe the main problem is in this part, but I don't even
# understand what are you trying to accomplish here
case (@actor && @swordcondense.index)
when 0
$game_variables[11] = $game_variables[10]
$game_variables[10] = @actor.weapon_id
@actor.equip(0,0)
when 1
$game_variables[13] = $game_variables[12]
$game_variables[12] = @actor.armor1_id
@actor.equip(1,0)
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
return
end
end
end
# Help Window
class Window_Schelp < Window_Base
def initialize
super(0,430,640,50)
self.contents = Bitmap.new(width-32,height-32)
end
def update(help_text)
self.contents.clear
self.contents.draw_text(0, 0, 90, 20, help_text)
end
end
#Scene_Map Display
class Sword_Condense_Display < Window_Base
def initialize
super(604,0,36,100)
self.opacity = 100
self.contents = Bitmap.new(width-32,height-32)
for i in 11..14
$game_variables[i] = 0
end
end
#returns the icon
def scs_variable_check(variable_id)
case $game_variables[variable_id]
when 1 then return DARKCAMPER::SWORDSUMMON::SWORDS[:windsword][3]
when 2 then return DARKCAMPER::SWORDSUMMON::SWORDS[:earthsword][3]
when 3 then return DARKCAMPER::SWORDSUMMON::SWORDS[:firesword][3]
when 4 then return DARKCAMPER::SWORDSUMMON::SWORDS[:watersword][3]
end
return ""
end
def scs_return_icon_display(slot)
case slot
when 1 then return scs_variable_check(10)
when 2 then return scs_variable_check(11)
when 3 then return scs_variable_check(12)
when 4 then return scs_variable_check(13)
end
end
def refresh
self.contents.clear
reset_variables
draw_scs_icons
end
def reset_variables
@scs_file1 = scs_return_icon_display(1)
@scs_file2 = scs_return_icon_display(2)
@scs_file3 = scs_return_icon_display(3)
@scs_file4 = scs_return_icon_display(4)
@scs_slot1 = RPG::Cache.icon(@scs_file1)
@scs_slot2 = RPG::Cache.icon(@scs_file2)
@scs_slot3 = RPG::Cache.icon(@scs_file3)
@scs_slot4 = RPG::Cache.icon(@scs_file4)
end
def draw_scs_icons
self.contents.blt(2,2, @scs_slot1, Rect.new(0,0,32, 32))
self.contents.blt(2,34,@scs_slot2, Rect.new(0,0,32, 32))
self.contents.blt(2,66,@scs_slot3, Rect.new(0,0,32, 32))
self.contents.blt(2,98,@scs_slot4, Rect.new(0,0,32, 32))
end
def update
if(@scs_file1 != scs_return_icon_display(1) or
@scs_file2 != scs_return_icon_display(2) or
@scs_file3 != scs_return_icon_display(3) or
@scs_file4 != scs_return_icon_display(4)
) then refresh end
end
end
class Scene_Map
alias_method :dkc_ss_main, :main
alias_method :dkc_ss_update, :update
def main
dkc_ss_main
@scs_display && @scs_display.dispose
end
def update(*args)
dkc_ss_update(*args)
@scs_display ||= Sword_Condense_Display.new
@scs_display.update
end
end