#==============================================================================
# Guide System Administration Scripts Ver1.01 (Update: 2008.01.24)
#
# URL: http://f53.aaa.livedoor.jp/ ~ momomo /
#------------------------------------------------------------------------------
# Script to guide the system when the script will be required.
# Script than any book on the series, please paste.
#==============================================================================
#==============================================================================
# MoMo_Book_Shelf
#==============================================================================
class MoMo_Book_Shelf
@@books = []
#--------------------------------------------------------------------------
# Reference to the bookshelf
#--------------------------------------------------------------------------
def books
@@books
end
#--------------------------------------------------------------------------
# Moving scene
#--------------------------------------------------------------------------
def move_scene(str)
# All of this processing
for book in @@books
# All this calls for processing name
for name in book.call_names
# The name of the call to run move_scene
if (name == str)
book.move_scene
flag = true
return
end
end
end
end
#--------------------------------------------------------------------------
# Moving scenes (in one easy-to-call definition)
#--------------------------------------------------------------------------
def scene=(str)
# Calls to move the scene
self.move_scene(str)
end
end
#==============================================================================
# MoMo_Book_Data
#==============================================================================
class MoMo_Book_Data
attr_accessor: title
attr_accessor: show_switch
attr_accessor: contents_type
attr_accessor: call_name
#--------------------------------------------------------------------------
# Object initialization
#--------------------------------------------------------------------------
def initialize
@title = "" # Title
@show_switch = 0 # Emergence switch
@contents_type = "" # Type
@call_name = [] # Calling Name
end
#--------------------------------------------------------------------------
# Moving scene
#--------------------------------------------------------------------------
def move_scene
# Inherited at the definition
end
#--------------------------------------------------------------------------
# Registration information to save
#--------------------------------------------------------------------------
def data
# Inherited at the definition
end
#--------------------------------------------------------------------------
# Calling name acquisition
#--------------------------------------------------------------------------
def call_names
# + Title sequence of calls to return
return [@title] + @call_name
end
end
#==============================================================================
# MoMo_Window_Book_Title
#==============================================================================
class MoMo_Window_Book_Title < Window_Base
#--------------------------------------------------------------------------
# Object initialization
#--------------------------------------------------------------------------
def initialize(book)
super(0, 0, 544, 24 + 32)
@book = book
self.refresh
end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------
def refresh
# Clear contents
self.contents.clear
# Draw title
self.draw_title(0, 0)
end
#--------------------------------------------------------------------------
# Title to appear
#--------------------------------------------------------------------------
def draw_title(x, y)
title = @book.title
self.contents.draw_text(x, y, 256, WLH, title, 0)
end
#--------------------------------------------------------------------------
# Show completion rate
# 0: Type display type: Hide
# 1: The current / maximum number of
# 2: Completion rate
# 3: Current / maximum number (completion rate)
#--------------------------------------------------------------------------
def draw_comp(x, y, type)
# If you do not be back
return if (type == 0)
# Various figures obtained
max = @book.data.max_item
now = @book.data.now_item
comp = @book.data.comp_item
str = ""
# Strings to obtain completion rate
case type
when 1
str = sprintf( "% d /% d", now, max)
when 2
str = sprintf( "% d%%", comp)
when 3
str = sprintf( "% d /% d (% d %%)", now, max, comp)
end
# Show completion rate
self.contents.draw_text(x, y, 256, WLH, str, 2)
end
end
#==============================================================================
# MoMo_Scene_Book_Shelf
#==============================================================================
class MoMo_Scene_Book_Shelf < Scene_Base
#--------------------------------------------------------------------------
# Object initialization
# Menu_index: initial position of the cursor command
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
# Create the bookshelf
@book_shelf = MoMo_Book_Shelf.new
end
#--------------------------------------------------------------------------
# Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
end
#--------------------------------------------------------------------------
# Termination
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
end
#--------------------------------------------------------------------------
# Frame update
#--------------------------------------------------------------------------
def update
super
update_menu_background
# Update window #
@command_window.update
# B if the button is pressed.
if Input.trigger?(Input:: B)
# Cancel the sound of a bell
Sound.play_cancel
# Map screen
$scene = Scene_Map.new
return
end
# C if the button is pressed.
if Input.trigger?(Input:: C)
# Play a sound decision
Sound.play_decision
# Selected in the call to move the scene
@book_shelf.move_scene(@command_window.commands[@command_window.index])
return
end
end
#--------------------------------------------------------------------------
# Create a command window
#--------------------------------------------------------------------------
def create_command_window
data = []
# Registered on the bookshelves of all of this process
for book in @book_shelf.books
# 0 or appearance of the switch ID is the emergence of ID switch if the switch is ON
if book.show_switch == 0 or $game_switches[book.show_switch]
# Add to show the command #
data.push(book.title)
end
end
# To create a command window #
@command_window = Window_Command.new(160, data)
@command_window.index = @menu_index
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# Run transition
#--------------------------------------------------------------------------
alias momo_book_shelf_update_scene_change: update_scene_change
def update_scene_change
return if $game_player.moving? # Players moving?
case $game_temp.next_scene
when "book", "bookshelf"
call_bookshelf
when "monsterbook", "monster", "mbk"
call_monsterbook
end
# Original process
momo_book_shelf_update_scene_change
end
#--------------------------------------------------------------------------
# Screen switching to the bookshelf
#--------------------------------------------------------------------------
def call_bookshelf
$game_temp.next_scene = nil
$scene = MoMo_Scene_Book_Shelf.new
end
#--------------------------------------------------------------------------
# Mamono screen guide to the switch
#--------------------------------------------------------------------------
def call_monsterbook
$game_temp.next_scene = nil
$book_shelf.move_scene(Mod_MoMo_Monster_Book::TITLE)
end
end
# Create and keep a bookcase
$book_shelf = MoMo_Book_Shelf.new