Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Dekita's=======================================================================
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #===============================================================================
- # v1.1
- # ★ Perfect Password Protection™ ★
- #
- #===============================================================================
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #===============================================================================
- #
- # -- Last updated: 04/09/2o12
- #
- # -- Difficulty: Plug'n'play - (Easy)
- #
- # -- Customisation: Better than a kick in the nuts! - (low)
- #
- # -- Requires: An actor in your database,
- #
- # -- Recommended: N/A
- #
- # -- Compatable: RPG Maker VX Ace ONLY!
- #
- #===============================================================================
- #===============================================================================
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #===============================================================================
- #===============================================================================
- # ☆ Script Information:
- #=======================
- # A simple script to enable password protection on game files by using
- # [x] actors name & nickname as a username & password (or two passwords),
- # This script will limit you to 3 save files, these saves will be in
- # Slots 2, 3 and 4.
- # This script almost completely overwrites scene title.
- #
- # NOTE:
- # for the purposes of this script i will refer to the actor that you choose
- # to use as your password(s) as "password actor" .
- #===============================================================================
- #===============================================================================
- # ☆ TERMS OF USE:
- #===============================================================================
- #
- # 1. You must give credit to Dekita.
- #
- # 2. This script is for NON-Commercial use ONLY!*
- #
- # 3. You CANNOT give credit to yourself for Re-posting this script
- # or Posting a modified version.*
- #
- # 4. Do not Re-Distribute this script.
- #
- # 5. You are NOT allowed to convert this script to any other engine,
- # E.G converting it from RGSS3 into RGSS2.*
- #
- # 6. ENJOY!
- #
- #-------------------------------------------------------------------------------
- # * = Unless permissions are given by Dekita. < e-mail DekitaRPG@gmail.com
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #===============================================================================
- #===============================================================================
- # ☆ History:
- #============
- # D - M - Y
- # 04/09/2o12 - improved efficency,
- # Released v1.0
- # 03/09/2o12 - Added Animation,
- # Added second password,
- # Fixed a few bugs,
- # Added Customisation,
- # 02/09/2o12 - Finished Login,
- # Finished Autosave,
- # Started
- #===============================================================================
- # ☆ Credit and Thanks to :
- #==========================
- # Mobychan - helping me solve my "saving far too often" dilemma :)
- #===============================================================================
- #===============================================================================
- # ☆ INSTRUCTIONS:
- #=================
- # Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
- #===============================================================================
- #===============================================================================
- # ☆ Import:
- #===========
- $imported = {} if $imported.nil?
- $imported["DPB-PERFECTLOGIN"] = true
- #
- #===============================================================================
- module DPB
- module LOGIN
- ######################################################################
- ### CUSTOMISATION ###
- ######################################################################
- # COMMAND WINDOW VOCAB SETTINGS
- # Main Title Window Vocab.
- LOGIN = "Login"
- NEW_ACCOUNT = "New File"
- # File Vocab.
- FILE1 = "File 1"
- FILE2 = "File 2"
- FILE3 = "File 3"
- #HELP INFO VOCAB SETTINGS
- #Help info for login command
- HELP_VOCAB1 = "Log In To Exsisting File."
- #Help info for create new file command
- HELP_VOCAB2 = "Create A New File."
- #Help info for selecting a file
- HELP_VOCAB3 = "Select File."
- #Help info for creating a username (password 1)
- CREATE_USERNAME = "Choose Your Username."
- #Help info for creating a password (password 2)
- CREATE_PASSWORD = "Choose Your Password."
- #Help info for inputting username (password 1)
- INPUT_USERNAME = "Input Username"
- #Help info for inputting password (password 2)
- INPUT_PASSWORD = "Input Password"
- #Help info when username(password 1) is incorrect.
- FAILED_USERNAME = "User Does Not Exsist!"
- #Help info when password(password 2) is incorrect.
- FAILED_PASSWORD = "Password Incorrect!"
- #ADDITIONAL SETTINGS
- # Adjust the command window width here.
- WINDOW_WIDTH = 120
- # Adjust the window opacity(transparancy) here.
- OPACITY = 0
- # Use this to set your password actor's id.
- PASSWORD_ACTOR_ID = 11
- # Maximum Username/Password Length.
- PASSWORD_MAX = 8
- # The time you wait after a failed password input.
- FAILED_WAIT = (60) #frames. (60 frames = 1 second)
- #Set this to "true" to use a second password
- USE_SECOND_PASSWORD = true
- #Set this to "false" if you dont want to start a new game automaically
- #when a new file is made.
- START_NEWGAME_ON_CREATE_FILE = false
- # The main background, make sure its in the "Parallaxes" folder of your game.
- TITLE_PICTURE = "StarlitSky"#"SeaOfClouds" #"Sunset" #"StartlitSky"
- #The speed that the background moves, make it "-" to change direction.
- TITLE_MOVE_X = -1
- TITLE_MOVE_Y = 1
- # The image used for the game title, also must be in the "Parallaxes" folder.
- TITLE_IMAGE2 = "Dekita_Title" # "Sunset"
- # Game title image move speed.
- IMAGE2_MOVE_X = 0
- IMAGE2_MOVE_Y = 0
- # I Reccomend you keep this on and disable the save option for your game.
- USE_AUTOSAVE = true
- SAVE_FREQ = 360 # the time (in frames) per each autosave
- ######################################################################
- ### CUSTOMISATION END ###
- ######################################################################
- end#module
- end#module
- #===============================================================================
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #===============================================================================
- #
- # ★ Perfect Password Protection™ ★
- # ★ SCRIPT BEGIN ★
- #
- #===============================================================================
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #===============================================================================
- #==============================================================================
- # ** Window_TitleCommand
- #------------------------------------------------------------------------------
- # This window is for selecting New Game/Continue on the title screen.
- #==============================================================================
- class Window_TitleCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- update_placement
- self.openness = 0
- self.opacity = DPB::LOGIN::OPACITY
- open
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return DPB::LOGIN::WINDOW_WIDTH
- end
- #--------------------------------------------------------------------------
- # * Update Window Position
- #--------------------------------------------------------------------------
- def update_placement
- self.x = 0
- self.y = (Graphics.height - height)
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(DPB::LOGIN::LOGIN, :login_account, continue_enabled)
- add_command(DPB::LOGIN::NEW_ACCOUNT, :create_account)
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Continue
- #--------------------------------------------------------------------------
- def continue_enabled
- DataManager.save_file_exists?
- end
- end # scene end
- #==============================================================================
- # ** Window_TitleLoginCommand
- #------------------------------------------------------------------------------
- # This window is for selecting New Game/Continue on the title screen.
- #==============================================================================
- class Window_TitleLoginCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- update_placement
- self.openness = 0
- self.opacity = DPB::LOGIN::OPACITY
- open
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return DPB::LOGIN::WINDOW_WIDTH
- end
- #--------------------------------------------------------------------------
- # * Update Window Position
- #--------------------------------------------------------------------------
- def update_placement
- self.x = 0
- self.y = (Graphics.height - height)
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(DPB::LOGIN::FILE1, :login_file1, file1_enabled)
- add_command(DPB::LOGIN::FILE2, :login_file2, file2_enabled)
- add_command(DPB::LOGIN::FILE3, :login_file3, file3_enabled)
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Continue
- #--------------------------------------------------------------------------
- def file1_enabled
- header = DataManager.load_header(1)
- return false if header.nil?
- return true
- end
- def file2_enabled
- header = DataManager.load_header(2)
- return false if header.nil?
- return true
- end
- def file3_enabled
- header = DataManager.load_header(3)
- return false if header.nil?
- return true
- end
- end # scene end
- #==============================================================================
- # ** Window_TitleLoginCommand
- #------------------------------------------------------------------------------
- # This window is for selecting New Game/Continue on the title screen.
- #==============================================================================
- class Window_TitleCreateCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- update_placement
- self.openness = 0
- self.opacity = DPB::LOGIN::OPACITY
- open
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return DPB::LOGIN::WINDOW_WIDTH
- end
- #--------------------------------------------------------------------------
- # * Update Window Position
- #--------------------------------------------------------------------------
- def update_placement
- self.x = 0
- self.y = (Graphics.height - height)
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(DPB::LOGIN::FILE1, :create_file1, file1_enabled)
- add_command(DPB::LOGIN::FILE2, :create_file2, file2_enabled)
- add_command(DPB::LOGIN::FILE3, :create_file3, file3_enabled)
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Files
- #--------------------------------------------------------------------------
- def file1_enabled
- header = DataManager.load_header(1)
- return true if header.nil?
- return false
- end
- def file2_enabled
- header = DataManager.load_header(2)
- return true if header.nil?
- return false
- end
- def file3_enabled
- header = DataManager.load_header(3)
- return true if header.nil?
- return false
- end
- end # scene end
- #==============================================================================
- # ** Window_NameEdit
- #------------------------------------------------------------------------------
- # This window is used to edit an actor's name on the name input screen.
- #==============================================================================
- class Window_PasswordEdit < Window_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :name # name
- attr_reader :index # cursor position
- attr_reader :max_char # maximum number of characters
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(actor, max_char)
- x = (Graphics.width - 360) / 2
- y = (Graphics.height - (fitting_height(4) + fitting_height(9) + 8)) / 2
- super(x, y, 360, fitting_height(4))
- @actor = actor
- @max_char = max_char
- if SceneManager.scene_is?(Scene_CreateSecondPassword)
- @default_name = @name = actor.nickname[0, @max_char]
- elsif SceneManager.scene_is?(Scene_SecondPasswordConfirm)
- @default_name = @name = actor.nickname[0, @max_char]
- else
- @default_name = @name = actor.name[0, @max_char]
- end
- @index = @name.size
- deactivate
- refresh
- self.opacity = DPB::LOGIN::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Revert to Default Name
- #--------------------------------------------------------------------------
- def restore_default
- @name = @default_name
- @index = @name.size
- refresh
- return !@name.empty?
- end
- #--------------------------------------------------------------------------
- # * Add Text Character
- # ch : character to add
- #--------------------------------------------------------------------------
- def add(ch)
- return false if @index >= @max_char
- @name += ch
- @index += 1
- refresh
- return true
- end
- #--------------------------------------------------------------------------
- # * Go Back One Character
- #--------------------------------------------------------------------------
- def back
- return false if @index == 0
- @index -= 1
- @name = @name[0, @index]
- refresh
- return true
- end
- #--------------------------------------------------------------------------
- # * Get Character Width
- #--------------------------------------------------------------------------
- def char_width
- text_size($game_system.japanese? ? "あ" : "A").width
- end
- #--------------------------------------------------------------------------
- # * Get Coordinates of Left Side for Drawing Name
- #--------------------------------------------------------------------------
- def left
- name_center = (contents_width) / 2
- name_width = (@max_char + 1) * char_width
- return [name_center - name_width / 2, contents_width - name_width].min
- end
- #--------------------------------------------------------------------------
- # * Get Rectangle for Displaying Item
- #--------------------------------------------------------------------------
- def item_rect(index)
- Rect.new(left + index * char_width, 36, char_width, line_height)
- end
- #--------------------------------------------------------------------------
- # * Get Underline Rectangle
- #--------------------------------------------------------------------------
- def underline_rect(index)
- rect = item_rect(index)
- rect.x += 1
- rect.y += rect.height - 4
- rect.width -= 2
- rect.height = 2
- rect
- end
- #--------------------------------------------------------------------------
- # * Get Underline Color
- #--------------------------------------------------------------------------
- def underline_color
- color = normal_color
- color.alpha = 48
- color
- end
- #--------------------------------------------------------------------------
- # * Draw Underline
- #--------------------------------------------------------------------------
- def draw_underline(index)
- contents.fill_rect(underline_rect(index), underline_color)
- end
- #--------------------------------------------------------------------------
- # * Draw Text
- #--------------------------------------------------------------------------
- def draw_char(index)
- rect = item_rect(index)
- rect.x -= 1
- rect.width += 4
- change_color(normal_color)
- draw_text(rect, @name[index] || "")
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_actor_face(@actor, 0, 0)
- @max_char.times {|i| draw_underline(i) }
- @name.size.times {|i| draw_char(i) }
- cursor_rect.set(item_rect(@index))
- end
- end
- #==============================================================================
- # ** Window_NameInput
- #------------------------------------------------------------------------------
- # This window is used to select text characters on the name input screen.
- #==============================================================================
- class Window_PasswordInput < Window_Selectable
- #--------------------------------------------------------------------------
- # * Character Tables (Latin)
- #--------------------------------------------------------------------------
- PASSWORD = [
- 'A','B','C','D','E', 'a','b','c','d','e',
- 'F','G','H','I','J', 'f','g','h','i','j',
- 'K','L','M','N','O', 'k','l','m','n','o',
- 'P','Q','R','S','T', 'p','q','r','s','t',
- 'U','V','W','X','Y', 'u','v','w','x','y',
- 'Z',' ',' ',' ',' ', 'z',' ',' ',' ',' ',
- '0','1','2','3','4', ' ',' ',' ',' ',' ',
- '5','6','7','8','9', ' ',' ',' ',' ',' ',
- ' ',' ',' ',' ',' ', ' ',' ','«','Page','OK']
- PASSWORD2 = [
- 'Á','É','Í','Ó','Ú', 'á','é','í','ó','ú',
- 'À','È','Ì','Ò','Ù', 'à','è','ì','ò','ù',
- 'Â','Ê','Î','Ô','Û', 'â','ê','î','ô','û',
- 'Ä','Ë','Ï','Ö','Ü', 'ä','ë','ï','ö','ü',
- 'Ā','Ē','Ī','Ō','Ū', 'ā','ē','ī','ō','ū',
- 'Ã','Å','Æ','Ç','Ð', 'ã','å','æ','ç','ð',
- 'Ñ','Õ','Ø','Š','Ŵ', 'ñ','õ','ø','š','ŵ',
- 'Ý','Ŷ','Ÿ','Ž','Þ', 'ý','ÿ','ŷ','ž','þ',
- 'IJ','Œ','ij','œ','ß', ' ',' ','«','Page','OK']
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(edit_window)
- super(edit_window.x, edit_window.y + edit_window.height + 8,
- edit_window.width, fitting_height(9))
- @edit_window = edit_window
- @page = 0
- @index = 0
- refresh
- update_cursor
- activate
- self.opacity = DPB::LOGIN::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Get Text Table
- #--------------------------------------------------------------------------
- def table
- return [PASSWORD, PASSWORD2]
- end
- #--------------------------------------------------------------------------
- # * Get Text Character
- #--------------------------------------------------------------------------
- def character
- @index < 88 ? table[@page][@index] : ""
- end
- #--------------------------------------------------------------------------
- # * Determining if Page Changed and Cursor Location
- #--------------------------------------------------------------------------
- def is_page_change?
- @index == 88
- end
- #--------------------------------------------------------------------------
- # * Determine Cursor Location: Confirmation
- #--------------------------------------------------------------------------
- def is_ok?
- @index == 89
- end
- #--------------------------------------------------------------------------
- # * Get Rectangle for Displaying Item
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new
- rect.x = index % 10 * 32 + index % 10 / 5 * 16
- rect.y = index / 10 * line_height
- rect.width = 32
- rect.height = line_height
- rect
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- change_color(normal_color)
- 90.times {|i| draw_text(item_rect(i), table[@page][i], 1) }
- end
- #--------------------------------------------------------------------------
- # * Update Cursor
- #--------------------------------------------------------------------------
- def update_cursor
- cursor_rect.set(item_rect(@index))
- end
- #--------------------------------------------------------------------------
- # * Determine if Cursor is Moveable
- #--------------------------------------------------------------------------
- def cursor_movable?
- active
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Down
- # wrap : Wraparound allowed
- #--------------------------------------------------------------------------
- def cursor_down(wrap)
- if @index < 80 or wrap
- @index = (index + 10) % 90
- end
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Up
- # wrap : Wraparound allowed
- #--------------------------------------------------------------------------
- def cursor_up(wrap)
- if @index >= 10 or wrap
- @index = (index + 80) % 90
- end
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Right
- # wrap : Wraparound allowed
- #--------------------------------------------------------------------------
- def cursor_right(wrap)
- if @index % 10 < 9
- @index += 1
- elsif wrap
- @index -= 9
- end
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Left
- # wrap : Wraparound allowed
- #--------------------------------------------------------------------------
- def cursor_left(wrap)
- if @index % 10 > 0
- @index -= 1
- elsif wrap
- @index += 9
- end
- end
- #--------------------------------------------------------------------------
- # * Move to Next Page
- #--------------------------------------------------------------------------
- def cursor_pagedown
- @page = (@page + 1) % table.size
- refresh
- end
- #--------------------------------------------------------------------------
- # * Move to Previous Page
- #--------------------------------------------------------------------------
- def cursor_pageup
- @page = (@page + table.size - 1) % table.size
- refresh
- end
- #--------------------------------------------------------------------------
- # * Cursor Movement Processing
- #--------------------------------------------------------------------------
- def process_cursor_move
- last_page = @page
- super
- update_cursor
- Sound.play_cursor if @page != last_page
- end
- #--------------------------------------------------------------------------
- # * Handling Processing for OK and Cancel Etc.
- #--------------------------------------------------------------------------
- def process_handling
- return unless open? && active
- process_jump if Input.trigger?(:A)
- process_back if Input.repeat?(:B)
- process_ok if Input.trigger?(:C)
- end
- #--------------------------------------------------------------------------
- # * Jump to OK
- #--------------------------------------------------------------------------
- def process_jump
- if @index != 89
- @index = 89
- Sound.play_cursor
- end
- end
- #--------------------------------------------------------------------------
- # * Go Back One Character
- #--------------------------------------------------------------------------
- def process_back
- Sound.play_cancel if @edit_window.back
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- if character == "«"
- process_back
- elsif !character.empty?
- on_name_add
- elsif is_page_change?
- Sound.play_ok
- cursor_pagedown
- elsif is_ok?
- on_name_ok
- end
- end
- #--------------------------------------------------------------------------
- # * Add Text to Name
- #--------------------------------------------------------------------------
- def on_name_add
- if @edit_window.add(character)
- Sound.play_ok
- else
- Sound.play_buzzer
- end
- end
- #--------------------------------------------------------------------------
- # * Decide Name
- #--------------------------------------------------------------------------
- def on_name_ok
- if @edit_window.name.empty?
- if @edit_window.restore_default
- Sound.play_ok
- else
- Sound.play_buzzer
- end
- else
- Sound.play_ok
- call_ok_handler
- end
- end
- end
- #==============================================================================
- # ** Scene_Title
- #------------------------------------------------------------------------------
- # This class performs the title screen processing.
- #==============================================================================
- class Scene_Title < Scene_Base
- def msg
- s = [
- "#{DPB::LOGIN::HELP_VOCAB1}
- #{""} #{""}",
- "#{DPB::LOGIN::HELP_VOCAB2}
- #{""} #{""}"]
- return s
- end
- def sndmsg
- s = [
- "#{DPB::LOGIN::HELP_VOCAB3}
- #{""} #{""}",
- "#{DPB::LOGIN::HELP_VOCAB3}
- #{""} #{""}",
- "#{DPB::LOGIN::HELP_VOCAB3}
- #{""} #{""}"]
- return s
- end
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- alias dpbztitlestart start
- def start
- # super
- dpbztitlestart
- create_help_window
- @help_window.opacity = DPB::LOGIN::OPACITY
- end
- alias dpbztitleupdate update
- def update
- # super
- dpbztitleupdate
- @sprite1.ox += DPB::LOGIN::TITLE_MOVE_X
- @sprite1.oy += DPB::LOGIN::TITLE_MOVE_Y
- @sprite2.ox -= DPB::LOGIN::IMAGE2_MOVE_X
- @sprite2.oy += DPB::LOGIN::IMAGE2_MOVE_Y
- if $dpbzpasswordhelpwindowinfo == 1
- @help_window.set_text(sndmsg[@command_window.index])
- else
- @help_window.set_text(msg[@command_window.index])
- end
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new
- @help_window.visible = true
- @help_window.set_text(msg[@command_window.index])
- end
- #--------------------------------------------------------------------------
- # * Create Background
- #--------------------------------------------------------------------------
- def create_background
- @sprite1 = Plane.new
- @sprite1.bitmap = Cache.parallax(DPB::LOGIN::TITLE_PICTURE)
- @sprite2 = Plane.new
- @sprite2.bitmap = Cache.parallax(DPB::LOGIN::TITLE_IMAGE2)
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_TitleCommand.new
- # @command_window.set_handler(:new_game, method(:command_new_game))
- # @command_window.set_handler(:continue, method(:command_continue))
- # @command_window.set_handler(:shutdown, method(:command_shutdown))
- @command_window.set_handler(:login_account, method(:command_login_account))
- @command_window.set_handler(:create_account, method(:command_create_account))
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_login_window
- @command_window = Window_TitleLoginCommand.new
- @command_window.set_handler(:login_file1, method(:command_login_file1))
- @command_window.set_handler(:login_file2, method(:command_login_file2))
- @command_window.set_handler(:login_file3, method(:command_login_file3))
- @command_window.set_handler(:cancel, method(:command_backtotitle))
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_create_window
- @command_window = Window_TitleCreateCommand.new
- @command_window.set_handler(:create_file1, method(:command_create_file1))
- @command_window.set_handler(:create_file2, method(:command_create_file2))
- @command_window.set_handler(:create_file3, method(:command_create_file3))
- @command_window.set_handler(:cancel, method(:command_backtotitle))
- end
- #--------------------------------------------------------------------------
- # * Close Command Window
- #--------------------------------------------------------------------------
- def close_command_window
- @command_window.close
- update until @command_window.close?
- end
- def command_backtotitle
- @command_window.hide
- $dpbzpasswordhelpwindowinfo = 0
- create_command_window
- end
- ################################################################################
- #--------------------------------------------------------------------------
- # * [Login] Command
- #--------------------------------------------------------------------------
- def command_login_account
- $dpbzpasswordhelpwindowinfo = 1
- DataManager.setup_new_game
- close_command_window
- create_login_window
- end
- #--------------------------------------------------------------------------
- # * [Create] Command
- #--------------------------------------------------------------------------
- def command_create_account
- $dpbzpasswordhelpwindowinfo = 1
- DataManager.setup_new_game
- close_command_window
- create_create_window
- end
- ################################################################################
- #--------------------------------------------------------------------------
- # * [Login File1] Command
- #--------------------------------------------------------------------------
- def command_login_file1
- close_command_window
- SceneManager.call(Scene_PasswordConfirm)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, 1)
- end
- #--------------------------------------------------------------------------
- # * [Login File2] Command
- #--------------------------------------------------------------------------
- def command_login_file2
- close_command_window
- SceneManager.call(Scene_PasswordConfirm)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, 2)
- end
- #--------------------------------------------------------------------------
- # * [Login File3] Command
- #--------------------------------------------------------------------------
- def command_login_file3
- close_command_window
- SceneManager.call(Scene_PasswordConfirm)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, 3)
- end
- ################################################################################
- #--------------------------------------------------------------------------
- # * [Create File1] Command
- #--------------------------------------------------------------------------
- def command_create_file1
- close_command_window
- SceneManager.call(Scene_CreatePassword)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, 1)
- end
- #--------------------------------------------------------------------------
- # * [Create File2] Command
- #--------------------------------------------------------------------------
- def command_create_file2
- close_command_window
- SceneManager.call(Scene_CreatePassword)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, 2)
- end
- #--------------------------------------------------------------------------
- # * [Create File3] Command
- #--------------------------------------------------------------------------
- def command_create_file3
- close_command_window
- SceneManager.call(Scene_CreatePassword)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, 3)
- end
- end# end scene title
- ##################################
- class Scene_MenuBase < Scene_Base#
- #--------------------------------------------------------------------------
- # * Processing When Load Is Successful
- #--------------------------------------------------------------------------
- def on_load_success
- Sound.play_load
- fadeout_all
- $game_system.on_after_load
- SceneManager.goto(Scene_Map)
- end
- def dpbzpasswordwait(time)
- t = 0
- loop do
- Graphics.update
- if t == time
- break
- end
- t += 1
- end
- end
- end # end class
- #==============================================================================
- # ** Scene_Name
- #------------------------------------------------------------------------------
- # This class performs name input screen processing.
- #==============================================================================
- class Scene_CreatePassword < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Prepare
- #--------------------------------------------------------------------------
- def prepare(actor_id, max_char, file)
- @actor_id = actor_id
- @max_char = max_char
- @file = file
- end
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- @actor = $game_actors[@actor_id]
- @edit_window = Window_PasswordEdit.new(@actor, @max_char)
- @input_window = Window_PasswordInput.new(@edit_window)
- @input_window.set_handler(:ok, method(:on_input_ok))
- create_help_window
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new
- @help_window.visible = true
- @help_window.set_text(DPB::LOGIN::CREATE_USERNAME)
- @help_window.opacity = DPB::LOGIN::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Input [OK]
- #--------------------------------------------------------------------------
- def on_input_ok
- @actor.name = @edit_window.name
- return_scene
- $dpbzpasswordhelpwindowinfo = 0
- if DPB::LOGIN::USE_SECOND_PASSWORD
- SceneManager.call(Scene_CreateSecondPassword)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, @file)
- else
- DataManager.save_game(@file)
- if DPB::LOGIN::START_NEWGAME_ON_CREATE_FILE
- on_load_success
- else
- return_scene
- SceneManager.call(Scene_Title)
- end
- end
- end
- end#scene
- #==============================================================================
- # ** Scene_Name
- #------------------------------------------------------------------------------
- # This class performs name input screen processing.
- #==============================================================================
- class Scene_CreateSecondPassword < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Prepare
- #--------------------------------------------------------------------------
- def prepare(actor_id, max_char, file)
- @actor_id = actor_id
- @max_char = max_char
- @file = file
- end
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- @actor = $game_actors[@actor_id]
- @edit_window = Window_PasswordEdit.new(@actor, @max_char)
- @input_window = Window_PasswordInput.new(@edit_window)
- @input_window.set_handler(:ok, method(:on_input_ok))
- create_help_window
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new
- @help_window.visible = true
- @help_window.set_text(DPB::LOGIN::CREATE_PASSWORD)
- @help_window.opacity = DPB::LOGIN::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Input [OK]
- #--------------------------------------------------------------------------
- def on_input_ok
- @actor.nickname = @edit_window.name
- DataManager.save_game(@file)
- if DPB::LOGIN::START_NEWGAME_ON_CREATE_FILE
- on_load_success
- else
- return_scene
- SceneManager.call(Scene_Title)
- end
- end
- end#scene
- #==============================================================================
- # ** Scene_Name
- #------------------------------------------------------------------------------
- # This class performs name input screen processing.
- #==============================================================================
- class Scene_PasswordConfirm < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Prepare
- #--------------------------------------------------------------------------
- def prepare(actor_id, max_char,file)
- @actor_id = actor_id
- @max_char = max_char
- @account = file
- end
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- @actor = $game_actors[@actor_id]
- @edit_window = Window_PasswordEdit.new(@actor, @max_char)
- @input_window = Window_PasswordInput.new(@edit_window)
- @input_window.set_handler(:ok, method(:on_input_ok))
- create_help_window
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new
- @help_window.visible = true
- @help_window.set_text(DPB::LOGIN::INPUT_USERNAME)
- @help_window.opacity = DPB::LOGIN::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Input [OK]
- #--------------------------------------------------------------------------
- def on_input_ok
- DataManager.load_game(@account)
- @actor = $game_actors[DPB::LOGIN::PASSWORD_ACTOR_ID]
- if @edit_window.name == @actor.name
- return_scene
- $dpbzpasswordhelpwindowinfo = 0
- if DPB::LOGIN::USE_SECOND_PASSWORD
- SceneManager.call(Scene_SecondPasswordConfirm)
- SceneManager.scene.prepare(DPB::LOGIN::PASSWORD_ACTOR_ID, DPB::LOGIN::PASSWORD_MAX, @account)
- else
- on_load_success
- end
- else
- @help_window.set_text(DPB::LOGIN::FAILED_USERNAME)
- dpbzpasswordwait(DPB::LOGIN::FAILED_WAIT)
- return_scene
- end
- end
- ######
- end # scene
- #==============================================================================
- # ** Scene_Name
- #------------------------------------------------------------------------------
- # This class performs name input screen processing.
- #==============================================================================
- class Scene_SecondPasswordConfirm < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Prepare
- #--------------------------------------------------------------------------
- def prepare(actor_id, max_char, file)
- @actor_id = actor_id
- @max_char = max_char
- @account = file
- end
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- DataManager.setup_new_game
- @actor = $game_actors[@actor_id]
- @edit_window = Window_PasswordEdit.new(@actor, @max_char)
- @input_window = Window_PasswordInput.new(@edit_window)
- @input_window.set_handler(:ok, method(:on_input_ok))
- create_help_window
- @help_window.opacity = DPB::LOGIN::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new
- @help_window.visible = true
- @help_window.set_text(DPB::LOGIN::INPUT_PASSWORD)
- @help_window.opacity = DPB::LOGIN::OPACITY
- end
- #--------------------------------------------------------------------------
- # * Input [OK]
- #--------------------------------------------------------------------------
- def on_input_ok
- DataManager.load_game(@account)
- @actor = $game_actors[DPB::LOGIN::PASSWORD_ACTOR_ID]
- if @edit_window.name == @actor.nickname
- on_load_success
- else
- return_scene
- @help_window.set_text(DPB::LOGIN::FAILED_PASSWORD)
- dpbzpasswordwait(DPB::LOGIN::FAILED_WAIT)
- end
- end
- end # scene
- ####################
- # Awesome Autosave #
- ####################
- if DPB::LOGIN::USE_AUTOSAVE
- # Keyboard four de map ? no
- class Scene_Map < Scene_Base
- alias dpbzautosavestart start
- def start
- # super
- dpbzautosavestart
- @dpbzautosavecounter = 0
- end
- #@dpbzautosavecounter = 0
- alias dpbzautosave update_scene
- def update_scene
- dpbzautosave
- @dpbzautosavecounter += 1
- if @dpbzautosavecounter == DPB::LOGIN::SAVE_FREQ
- update_call_autosave
- @dpbzautosavecounter = 0
- end
- end # update scene
- # Define call
- def update_call_autosave
- if !$game_player.moving?
- call_autosave
- end
- end
- # Define call
- def call_autosave
- @file = DataManager.last_savefile_index
- DataManager.save_game(@file)
- end
- end# scenemap
- end
- #==============================================================================
- # ** Scene_Load
- #------------------------------------------------------------------------------
- # This class performs load screen processing.
- #==============================================================================
- class Scene_Load < Scene_File
- #--------------------------------------------------------------------------
- # * Processing When Load Is Successful
- #--------------------------------------------------------------------------
- alias dpbzawsomeautosaveonloadsuccess on_load_success
- def on_load_success
- @file = DataManager.last_savefile_index
- DataManager.save_game(@file)
- dpbzawsomeautosaveonloadsuccess
- end
- end
- #===============================================================================
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #===============================================================================
- #
- # ★ Perfect Password Protection™ ★
- # ★ SCRIPT END ★
- #
- #===============================================================================
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #===============================================================================
- ################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement