#================================================= ===========================
# ** Moghunter Custom Menu System
#----------------------------------------------------------------------------
# Moghunter : Kurisu : Trickster
# 1.0
# 11/5/2007
# SDK Version : (2.2) - Parts 3 and 4
#---
# Credits:
# ~ Originally created by : Moghunter
# ~ Rewrote by : Kurisu
# ~ Test/Bug Fixes by : Trickster
#================================================= ===========================
#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Moghunter CMS', 'Moghunter/Kurisu/Trickster', 1.0, '11/5/07')
#--------------------------------------------------------------------------
# Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.2, [3, 4])
#--------------------------------------------------------------------------
# * Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Moghunter CMS')
class Scene_Menu
#--------------------------------------------------------------------------
# * Aliases
#--------------------------------------------------------------------------
alias_method :mog_cms_menu_main_command_window, :main_command_window
alias_method :mog_cms_menu_main_sprite, :main_sprite
alias_method :mog_cms_menu_main_window, :main_window
alias_method :mog_cms_menu_update, :update
alias_method :mog_cms_menu_update_command, :update_command
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main_Command_Window
#--------------------------------------------------------------------------
def main_command_window
@command_window = Window_Command.new(160, Array.new(6, ''))
@command_window.visible = false
@command_window.index = @menu_index
end
#--------------------------------------------------------------------------
# * Main_Sprite
#--------------------------------------------------------------------------
def main_sprite
mog_cms_menu_main_sprite
#------------------------------------------------------------------------
# * Sprite: Layout
#------------------------------------------------------------------------
@mog_cms_layout = Sprite.new
@mog_cms_layout.bitmap = RPG::Cache.picture('Mn_lay')
@mog_cms_layout.z = 10
#------------------------------------------------------------------------
# * Sprite: Selection
#------------------------------------------------------------------------
@mog_cms_selection = Sprite.new
@mog_cms_selection.bitmap = RPG::Cache.picture('Mn_Sel')
@mog_cms_selection.z = 20
@mog_cms_selection.x = 0
@mog_cms_selection.y = 110
#------------------------------------------------------------------------
# * Sprite: Selection (Bug Fix)
#------------------------------------------------------------------------
case @menu_index
when 0
@mog_cms_selection.x = 0
@mog_cms_selection.y = 110
when 1
@mog_cms_selection.x = 25
@mog_cms_selection.y = 155
when 2
@mog_cms_selection.x = 40
@mog_cms_selection.y = 197
when 3
@mog_cms_selection.x = 45
@mog_cms_selection.y = 242
when 4
@mog_cms_selection.x = 25
@mog_cms_selection.y = 285
when 5
@mog_cms_selection.x = 0
@mog_cms_selection.y = 325
end
end
#--------------------------------------------------------------------------
# * Main_Window
#--------------------------------------------------------------------------
def main_window
main_command_window
#------------------------------------------------------------------------
# * Window: PlayTime
#------------------------------------------------------------------------
@playtime_window = Window_PlayTime.new
@playtime_window.x = 30
@playtime_window.y = 375
@playtime_window.z = 15
@playtime_window.opacity = 0
#------------------------------------------------------------------------
# * Window: Steps
#------------------------------------------------------------------------
@steps_window = Window_Steps.new
@steps_window.x = 230
@steps_window.y = 375
@steps_window.z = 15
@steps_window.opacity = 0
#------------------------------------------------------------------------
# * Window: Gold
#------------------------------------------------------------------------
@gold_window = Window_Gold.new
@gold_window.x = 440
@gold_window.y = 405
@gold_window.z = 15
@gold_window.opacity = 0
#------------------------------------------------------------------------
# * Window: MenuStatus
#------------------------------------------------------------------------
@status_window = Window_MenuStatus.new
@status_window.x = 195
@status_window.y = 110
@status_window.z = 15
@status_window.opacity = 0
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
mog_cms_menu_update
@mog_cms_scrollbackground_1.oy += 0
@mog_cms_scrollbackground_1.ox += 0
@mog_cms_scrollbackground_2.oy += 0
@mog_cms_scrollbackground_2.ox -= 0
if @command_window.active
@mog_cms_selection.bitmap = RPG::Cache.picture('Mn_Sel')
else
@mog_cms_selection.bitmap = RPG::Cache.picture('Mn_Sel_off')
@mog_cms_selection.zoom_x = 1
@mog_cms_selection.opacity = 255
end
end
#--------------------------------------------------------------------------
# * Update_Command
#--------------------------------------------------------------------------
def update_command
mog_cms_menu_update_command
if @mog_cms_selection.zoom_x <= 1.6
@mog_cms_selection.zoom_x += 0.03
@mog_cms_selection.opacity -= 10
elsif @mog_cms_selection.zoom_x > 1.6
@mog_cms_selection.zoom_x = 1.0
@mog_cms_selection.opacity = 255
end
case @command_window.index
when 0
@mog_cms_selection.x = 0
@mog_cms_selection.y = 110
when 1
@mog_cms_selection.x = 0
@mog_cms_selection.y = 155
when 2
@mog_cms_selection.x = 0
@mog_cms_selection.y = 197
when 3
@mog_cms_selection.x = 0
@mog_cms_selection.y = 242
when 4
@mog_cms_selection.x = 0
@mog_cms_selection.y = 285
when 5
@mog_cms_selection.x = 0
@mog_cms_selection.y = 325
end
end
#--------------------------------------------------------------------------
# * Main_Command_Input
#--------------------------------------------------------------------------
def main_command_input
$game_system.se_play($data_system.decision_se)
case @command_window.index
when 0
command_item
when 1
command_skill
when 2
command_equip
when 3
command_status
when 4
command_save
when 5
command_endgame
end
end
#--------------------------------------------------------------------------
# * Sub Command Input
#--------------------------------------------------------------------------
def sub_command_input
$game_system.se_play($data_system.decision_se)
case @command_window.index
when 1
command_skill
when 2
command_equip
when 3
command_status
end
end
end
#----------------------------------------------------------------------------
# * Window_PlayTime (Text Removal)
#----------------------------------------------------------------------------
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf('%02d:%02d:%02d', hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
end
#----------------------------------------------------------------------------
# * Window_Steps (Text Removal)
#----------------------------------------------------------------------------
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
end
end
#----------------------------------------------------------------------------
# * Window_MenuStatus (Replacement)
#----------------------------------------------------------------------------
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 415, 280)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.opacity = 0
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 20
y = i * 62
actor = $game_party.actors[i]
self.contents.font.name = 'Georgia'
mog_cms_draw_face(actor,x,y + 50)
mog_cms_draw_hp_bars(actor,x + 40, y - 5)
mog_cms_draw_sp_bars(actor,x + 40, y + 20 )
mog_cms_draw_exp_bars(actor,x + 140, y + 15 )
mog_cms_draw_actor_state(actor ,x + 220, y - 5)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(5, @index * 62, self.width - 32, 50)
end
end
end
#----------------------------------------------------------------------------
# * Game_Actor (Get Now/Next EXP)
#----------------------------------------------------------------------------
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Now_Exp
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Next_Exp
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#----------------------------------------------------------------------------
# * Window_Base (Get Now/Next EXP)
#----------------------------------------------------------------------------
class Window_Base < Window
#--------------------------------------------------------------------------
# * Mog_CMS_Rescue_Face
#--------------------------------------------------------------------------
def mog_cms_rescue_face
#------------------------------------------------------------------------
# * Draw Face (Rescue)
#------------------------------------------------------------------------
mog_cms_face = RPG::Cache.picture('')
end
#--------------------------------------------------------------------------
# * Mog_CMS_Draw_Face
#--------------------------------------------------------------------------
def mog_cms_draw_face(actor,x,y)
#------------------------------------------------------------------------
# * Draw Face
#------------------------------------------------------------------------
mog_cms_face = RPG::Cache.picture(actor.name + '_fc') rescue mog_cms_rescue_face
cw = mog_cms_face.width
ch = mog_cms_face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, mog_cms_face, src_rect)
end
#--------------------------------------------------------------------------
# * Mog_CMS_Draw_HP_Bars
#--------------------------------------------------------------------------
def mog_cms_draw_hp_bars(actor, x, y)
#------------------------------------------------------------------------
# * Draw Bars Back
#------------------------------------------------------------------------
mog_cms_bars_back = RPG::Cache.picture('Bar0')
cw = mog_cms_bars_back.width
ch = mog_cms_bars_back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, mog_cms_bars_back, src_rect)
#------------------------------------------------------------------------
# * Draw HP Bars (Meter)
#------------------------------------------------------------------------
mog_cms_bars_meter = RPG::Cache.picture('HP_Bar')
cw = mog_cms_bars_meter.width * actor.hp / actor.maxhp
ch = mog_cms_bars_meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, mog_cms_bars_meter, src_rect)
#------------------------------------------------------------------------
# * Draw HP Text
#------------------------------------------------------------------------
mog_cms_bars_text = RPG::Cache.picture('HP_Tx')
cw = mog_cms_bars_text.width
ch = mog_cms_bars_text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, mog_cms_bars_text, src_rect)
#------------------------------------------------------------------------
# * Set Colors
#------------------------------------------------------------------------
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)
end
#--------------------------------------------------------------------------
# * Mog_CMS_Draw_SP_Bars
#--------------------------------------------------------------------------
def mog_cms_draw_sp_bars(actor, x, y)
#------------------------------------------------------------------------
# * Draw Bars Back
#------------------------------------------------------------------------
mog_cms_bars_back = RPG::Cache.picture('Bar0')
cw = mog_cms_bars_back.width
ch = mog_cms_bars_back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, mog_cms_bars_back, src_rect)
#------------------------------------------------------------------------
# * Draw SP Bars (Meter)
#------------------------------------------------------------------------
mog_cms_bars_meter = RPG::Cache.picture('SP_Bar')
cw = mog_cms_bars_meter.width * actor.sp / actor.maxsp
ch = mog_cms_bars_meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, mog_cms_bars_meter, src_rect)
#------------------------------------------------------------------------
# * Draw SP Text
#------------------------------------------------------------------------
mog_cms_bars_text = RPG::Cache.picture('SP_Tx')
cw = mog_cms_bars_text.width
ch = mog_cms_bars_text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, mog_cms_bars_text, src_rect)
#------------------------------------------------------------------------
# * Set Colors
#------------------------------------------------------------------------
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.sp.to_s, 2)
end
#--------------------------------------------------------------------------
# * Mog_CMS_Draw_EXP_Bars
#--------------------------------------------------------------------------
def mog_cms_draw_exp_bars(actor, x, y)
#------------------------------------------------------------------------
# * Draw Bars Back
#------------------------------------------------------------------------
mog_cms_exp_bars_back = RPG::Cache.picture('Exp_Back')
cw = mog_cms_exp_bars_back.width
ch = mog_cms_exp_bars_back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60 , y - ch + 30, mog_cms_exp_bars_back, src_rect)
#------------------------------------------------------------------------
# * Get EXP Datas
#------------------------------------------------------------------------
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
#------------------------------------------------------------------------
# * Draw EXP Bars (Meter)
#------------------------------------------------------------------------
mog_cms_exp_bars_meter = RPG::Cache.picture('Exp_Meter')
if actor.level < 99
cw = mog_cms_exp_bars_meter.width * rate
else
cw = mog_cms_exp_bars_meter.width
end
ch = mog_cms_exp_bars_meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60 , y - ch + 30, mog_cms_exp_bars_meter, src_rect)
#------------------------------------------------------------------------
# * Draw EXP Text
#------------------------------------------------------------------------
mog_cms_exp_bars_text = RPG::Cache.picture('Exp_tx')
cw = mog_cms_exp_bars_text.width
ch = mog_cms_exp_bars_text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 55 , y - ch + 30, mog_cms_exp_bars_text, src_rect)
#------------------------------------------------------------------------
# * Draw Level Text
#------------------------------------------------------------------------
mog_cms_level_text = RPG::Cache.picture("LV_tx")
cw = mog_cms_level_text.width
ch = mog_cms_level_text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 125 , y - ch + 35, mog_cms_level_text, src_rect)
#------------------------------------------------------------------------
# * Set Colors
#------------------------------------------------------------------------
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 161, y + 7, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 160, y + 6, 24, 32, actor.level.to_s, 1)
end
#--------------------------------------------------------------------------
# * Mog_CMS_Draw_Actor_State
#--------------------------------------------------------------------------
def mog_cms_draw_actor_state(actor, x, y, width = 120)
#------------------------------------------------------------------------
# * Draw Actor State (Text)
#------------------------------------------------------------------------
mog_cms_state_text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, mog_cms_state_text,1)
end
end
#--------------------------------------------------------------------------
# * End SDK Enabled Check
#--------------------------------------------------------------------------
end