Code:
#============================================================
# ToS Menu_Compilations
# Compilated By: Vash (aka Vash-X)
# Released on: Dec. 27, 2005
# Last Updates: Jan. 4, 2006, March 2, 2006
# Recent Updates: April 14, 2006
# Version: 1.3.1
# Credits: Many Sources (Don't remember all)
# Cursor Script by squall
#============================================================
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Window_Base < Window
def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
w = width * actor.hp / actor.maxhp
hp_color_1 = Color.new(255, 0, 0, 192)
hp_color_2 = Color.new(255, 255, 0, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
w = width * actor.sp / actor.maxsp
hp_color_1 = Color.new( 0, 0, 255, 192)
hp_color_2 = Color.new( 0, 255, 255, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
self.contents.fill_rect(x, y, width, width, start_color)
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 40, 32, " Lv.")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Sprite_Cursor < Sprite
#--------------------------------------------------------------------------
# ● instances
#--------------------------------------------------------------------------
attr_accessor :true_x
attr_accessor :true_y
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(x = 0, y = 0)
super()
self.x = @true_x = x
self.y = @true_y = y
self.z = 10000
self.bitmap = RPG::Cache.windowskin("cursor") rescue Bitmap.new(32, 32)
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
super
if self.y < @true_y
n = (@true_y - self.y) / 3
n = 1 if n == 0
self.y += n
elsif self.y > @true_y
n = (self.y - @true_y) / 3
n = 1 if n == 0
self.y -= n
end
if self.x < @true_x
n = (@true_x - self.x) / 3
n = 1 if n == 0
self.x += n
elsif self.x > @true_x
n = (self.x - @true_x) / 3
n = 1 if n == 0
self.x -= n
end
end
end
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# ● instances
#--------------------------------------------------------------------------
attr_reader :index
attr_reader :help_window
attr_accessor :cursor
alias update_cursor_moves update
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
@cursor = Sprite_Cursor.new(x, y)
update_cursor
end
#--------------------------------------------------------------------------
# ● x=
#--------------------------------------------------------------------------
def x=(x)
super
@cursor.x = x if !@cursor.nil?
end
#--------------------------------------------------------------------------
# ● y=
#--------------------------------------------------------------------------
def y=(y)
super
@cursor.y = y if !@cursor.nil?
end
#--------------------------------------------------------------------------
# ● visible=
#--------------------------------------------------------------------------
def visible=(visible)
super
if !@cursor.nil? and visible == false
@cursor.visible = false
end
end
#--------------------------------------------------------------------------
# ● dispose
#--------------------------------------------------------------------------
def dispose
@cursor.dispose
super
end
#--------------------------------------------------------------------------
# ● update_cursor_rect
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x, y, cursor_width, 32)
end
#--------------------------------------------------------------------------
# ● update_cursor
#--------------------------------------------------------------------------
def update_cursor
@cursor.true_x = self.cursor_rect.x + self.x - 8
@cursor.true_y = self.cursor_rect.y + self.y + 16
@cursor.update
@cursor.visible = (self.visible and self.index >= 0)
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
update_cursor_moves
update_cursor
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Game_Party
attr_reader :battle_count
alias initialize_para_battle_count initialize
def initialize
initialize_para_battle_count
@battle_count = 0
end
def increase_battle_count
@battle_count = [@battle_count + 1, 9999999].min
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Scene_Battle
alias start_phase1_para_battle_count start_phase1
def start_phase1
@enemies_count = $game_troop.enemies.size
start_phase1_para_battle_count
end
alias battle_end_para_battle_count battle_end
def battle_end(result)
case result
when 0
$game_party.increase_battle_count
when 1
$game_party.increase_battle_count
exist_enemy = 0
for enemy in $game_troop.enemies
if enemy.exist?
exist_enemy += 1
end
end
@enemies_count = @enemies_count - exist_enemy
end
battle_end_para_battle_count(result)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Window_Info < Window_Base
def initialize
super(0, 0, 170, 384)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(1, -7, 120, 32, "Spielzeit")
@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, 10, 120, 32, text, 2)
self.contents.font.color = system_color
self.contents.draw_text(1, 30, 120, 32, "Schritte")
self.contents.font.color = normal_color
self.contents.draw_text(2, 32, 120, 32, $game_party.steps.to_s, 2)
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 216, 122.5-cx-6, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 220, cx, 25, $data_system.words.gold, 2)
self.contents.font.color = system_color
self.contents.draw_text(2, 64, 120, 32, "Monster erledigt")
self.contents.font.color = normal_color
self.contents.draw_text(3, 66, 120, 32, $game_party.battle_count.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(2, 95, 120, 32, "Standort")
self.contents.font.color = normal_color
self.contents.draw_text(- 2, 115, 124, 32, $data_map_infos[$game_map.map_id].name, 2)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Window_MenuStatus < Window_Selectable
def initialize
super(0, 0, 470, 386)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 93
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 32, y + 65)
draw_actor_name(actor, x + 5, y - 8)
draw_actor_class(actor, x + 5, y + 18)
draw_actor_level(actor, x, y + 45)
draw_actor_state(actor, x + 95, y + 45)
draw_actor_hp_meter_line(actor, x + 223, y + 9, 116, 8)
draw_actor_sp_meter_line(actor, x + 223, y + 37, 116, 8)
draw_actor_hp(actor, x + 195, y + - 8)
draw_actor_sp(actor, x + 195, y + 20)
self.contents.font.color = system_color
self.contents.draw_text(x + 175, y + 45, 84, 32, "Nächste")
self.contents.font.color = normal_color
self.contents.draw_text(x + 310, y + 45, 84, 32, actor.next_exp_s)
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(5, @index * 90, 32, 32)
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Window_MenuCommand < Window_Selectable
#--------------------------------------------------------------------------
def initialize(commands)
col_max = 4
super(0, 0, 640, (commands.size / col_max + 2) * 21.5 + 32)
@column_max = col_max
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def refresh(commands = nil)
@commands = commands if commands != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new((index % @column_max) * ((width - 32) / @column_max),
index / @column_max * 32, (width - 32) / @column_max, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = (self.width - 55) / @column_max
x = @index % @column_max * (cursor_width + 3)
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x, y, 32, 32)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
@changer = 0
@where = 0
@checker = 0
end
def main
@commands = []
@commands[0] = $data_system.words.item
@commands[1] = $data_system.words.skill
@commands[2] = $data_system.words.equip
@commands[7] = "Log"
@commands[3] = "Status"
@commands[4] = "Gruppe"
@commands[5] = "Speichern"
@commands[6] = "Beenden"
@command_window = Window_MenuCommand.new(@commands)
@command_window.back_opacity = 180
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(5)
end
@info_window = Window_Info.new
@info_window.back_opacity = 180
@info_window.x = 470
@info_window.y = 96
@status_window = Window_MenuStatus.new
@status_window.back_opacity = 180
@status_window.x = 0
@status_window.y = 96
@mapset = Spriteset_Map.new
win1=Window_Base.new(0, 96, 470, 100)
win2=Window_Base.new(0, 196, 470, 93)
win3=Window_Base.new(0, 289, 470, 93)
win4=Window_Base.new(0, 382, 470, 98)
win1.back_opacity= 0
win2.back_opacity= 0
win3.back_opacity= 0
win4.back_opacity= 0
win1.z=9999
win2.z=9999
win3.z=9999
win4.z=9999
Graphics.transition(30, "Graphics/Transitions/" + "015-Diamond01")
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
win1.dispose
win2.dispose
win3.dispose
win4.dispose
@command_window.dispose
@info_window.dispose
@status_window.dispose
end
def update
@command_window.update
@info_window.update
@status_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
def update_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)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0 # Item
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1 # Skill
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # Equip
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 7
#Play Descision SE
$game_system.se_play($data_system.decision_se)
$scene = Scene_Questlog.new
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # Status
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # Party Changer
$game_system.se_play($data_system.decision_se)
@checker = 0
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # Save
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 6 # End
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
# --------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
when 4
$game_system.se_play($data_system.decision_se)
if @checker == 0
@changer = $game_party.actors[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.actors[@where] = $game_party.actors[@status_window.index]
$game_party.actors[@status_window.index] = @changer
@checker = 0
@status_window.refresh
end
end
return
end
end
end
in kurzform wurde folgendes eingefügt(der "command(7)" und die funktion "when 7"):