Release 0.0.1.8.8.7
This commit is contained in:
1 parent
3c8a17aa78
commit
c7beab414c
16283 files changed
+768761
-2
No files matched your search
@@ -0,0 +1,205 @@
|
||||
# encoding: UTF-8
|
||||
#==============================================================================
|
||||
# Wrong password dialogue.
|
||||
# Reacts only to the authoritative server packet auth_error:wrong_password.
|
||||
# It does not alter auth_ok, connection order or cloud bootstrap.
|
||||
#==============================================================================
|
||||
|
||||
module MPWrongPasswordTeller
|
||||
@blocked = false
|
||||
@reason = :wrong_password
|
||||
|
||||
def self.blocked?
|
||||
@blocked ? true : false
|
||||
rescue
|
||||
false
|
||||
end
|
||||
|
||||
def self.dismiss_overlays
|
||||
begin
|
||||
MPGameLoadProgress.dispose if defined?(MPGameLoadProgress) && MPGameLoadProgress.respond_to?(:dispose)
|
||||
rescue
|
||||
end
|
||||
begin
|
||||
System_NotificationOverlay.dispose if defined?(System_NotificationOverlay) && System_NotificationOverlay.respond_to?(:dispose)
|
||||
rescue
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def self.show!(reason=:wrong_password)
|
||||
return true if blocked?
|
||||
@blocked = true
|
||||
@reason = reason.to_s.start_with?('integrity_') ? :integrity : :wrong_password
|
||||
$mp_pending_auth_error_text = nil
|
||||
$mp_pending_auth_error_lock_frames = 0
|
||||
$mp_wrong_password_open_settings = false
|
||||
|
||||
begin
|
||||
MPConnectStatus.instance_variable_set(:@manual_disconnect, true) if defined?(MPConnectStatus)
|
||||
rescue
|
||||
end
|
||||
|
||||
dismiss_overlays
|
||||
Graphics.update rescue nil
|
||||
unless ensure_scene
|
||||
@blocked = false
|
||||
return false
|
||||
end
|
||||
|
||||
begin
|
||||
if defined?(WebSocket) && WebSocket.respond_to?(:connected?) && WebSocket.connected?
|
||||
WebSocket.disconnect
|
||||
end
|
||||
rescue
|
||||
end
|
||||
true
|
||||
rescue => e
|
||||
puts "[WRONG-PASSWORD] Teller scene failed: #{e.class}: #{e.message}" rescue nil
|
||||
false
|
||||
end
|
||||
|
||||
def self.integrity_failure?
|
||||
@reason == :integrity
|
||||
rescue
|
||||
false
|
||||
end
|
||||
|
||||
def self.ensure_scene
|
||||
return false unless blocked?
|
||||
return false unless defined?(SceneManager) && defined?(Scene_MPWrongPasswordTeller)
|
||||
current = SceneManager.scene rescue nil
|
||||
return true if current && current.is_a?(Scene_MPWrongPasswordTeller)
|
||||
SceneManager.snapshot_for_background(false) rescue nil
|
||||
SceneManager.goto(Scene_MPWrongPasswordTeller)
|
||||
true
|
||||
rescue => e
|
||||
puts "[WRONG-PASSWORD] Scene transition failed: #{e.class}: #{e.message}" rescue nil
|
||||
false
|
||||
end
|
||||
|
||||
def self.release!
|
||||
@blocked = false
|
||||
true
|
||||
rescue
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
class Scene_MPWrongPasswordTeller < Scene_Base
|
||||
def start
|
||||
MPWrongPasswordTeller.dismiss_overlays
|
||||
super
|
||||
create_wrong_password_background
|
||||
create_wrong_password_dialog
|
||||
end
|
||||
|
||||
def create_wrong_password_background
|
||||
@wrong_password_background = Sprite.new
|
||||
@wrong_password_background.z = 0
|
||||
@wrong_password_bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||
@wrong_password_bitmap.fill_rect(
|
||||
0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 255)
|
||||
)
|
||||
@wrong_password_background.bitmap = @wrong_password_bitmap
|
||||
rescue => e
|
||||
puts "[WRONG-PASSWORD] Background failed: #{e.class}: #{e.message}" rescue nil
|
||||
end
|
||||
|
||||
def create_wrong_password_dialog
|
||||
@wrong_password_choice = nil
|
||||
@message_window = Window_Message.new
|
||||
$game_message.clear
|
||||
$game_message.background = 0
|
||||
$game_message.position = 2
|
||||
|
||||
if MPWrongPasswordTeller.integrity_failure?
|
||||
$game_message.add("\\ph\\SETpl[TellerConfused]\\SETpr[nil]\\c[4]Гадалка:\\C[0] Мой друг... вокруг тебя вьётся\\n \\C[2]запрещённое заклинание\\C[0].\f" +
|
||||
"\\SETpl[TellerNormal]\\c[4]Гадалка:\\C[0] Нити судьбы заметили изменённые\\n или незваные файлы игры.\f" +
|
||||
"\\SETpl[TellerOkay]\\c[4]Гадалка:\\C[0] Пока игре не вернут истинный облик,\\n врата сервера тебя не впустят.")
|
||||
$game_message.choices.push("Вернуться в главное меню")
|
||||
$game_message.choice_cancel_type = 0
|
||||
else
|
||||
$game_message.add("\\ph\\SETpl[TellerNormal]\\SETpr[nil]\\c[4]Гадалка:\\C[0] Увы...\\n Нити судьбы не узнают тебя с этим тайным словом.\f" +
|
||||
"\\SETpl[TellerConfused]\\c[4]Гадалка:\\C[0] Сервер ответил:\\n \\C[2]Пароль неверный\\C[0].\\n Врата в LonaRPG Online остались закрыты.\f" +
|
||||
"\\SETpl[TellerOkay]\\c[4]Гадалка:\\C[0] Хочешь перейти в настройки и изменить пароль?")
|
||||
$game_message.choices.push("Перейти в настройки")
|
||||
$game_message.choices.push("Выйти в главное меню")
|
||||
$game_message.choice_cancel_type = 1
|
||||
end
|
||||
$game_message.choice_proc = Proc.new { |index| @wrong_password_choice = index.to_i }
|
||||
rescue => e
|
||||
puts "[WRONG-PASSWORD] Dialogue failed: #{e.class}: #{e.message}" rescue nil
|
||||
end
|
||||
|
||||
def update
|
||||
super
|
||||
$game_portraits.update if defined?($game_portraits) && $game_portraits
|
||||
finish_wrong_password_dialog if !@wrong_password_choice.nil? && !$game_message.busy?
|
||||
end
|
||||
|
||||
def finish_wrong_password_dialog
|
||||
choice = @wrong_password_choice
|
||||
@wrong_password_choice = nil
|
||||
$game_message.clear rescue nil
|
||||
$game_portraits.hide_all_portraits(true) rescue nil
|
||||
MPWrongPasswordTeller.release!
|
||||
|
||||
if choice == 0 && !MPWrongPasswordTeller.integrity_failure?
|
||||
$mp_wrong_password_open_settings = true
|
||||
SceneManager.goto(Scene_TitleOptions)
|
||||
else
|
||||
$mp_wrong_password_open_settings = false
|
||||
SceneManager.goto(Scene_MapTitle)
|
||||
end
|
||||
rescue => e
|
||||
puts "[WRONG-PASSWORD] Dialogue exit failed: #{e.class}: #{e.message}" rescue nil
|
||||
end
|
||||
|
||||
def terminate
|
||||
@wrong_password_background.dispose if @wrong_password_background && !@wrong_password_background.disposed? rescue nil
|
||||
@wrong_password_bitmap.dispose if @wrong_password_bitmap && !@wrong_password_bitmap.disposed? rescue nil
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
# A socket-close callback must not replace the Teller scene before the player
|
||||
# chooses one of its two explicit actions.
|
||||
if defined?(SceneManager)
|
||||
module SceneManager
|
||||
class << self
|
||||
unless method_defined?(:mp_wrong_password_goto_without_lock)
|
||||
alias mp_wrong_password_goto_without_lock goto
|
||||
def goto(scene_class)
|
||||
if defined?(MPWrongPasswordTeller) && MPWrongPasswordTeller.blocked? &&
|
||||
defined?(Scene_MPWrongPasswordTeller) && scene_class != Scene_MPWrongPasswordTeller
|
||||
scene_class = Scene_MPWrongPasswordTeller
|
||||
end
|
||||
mp_wrong_password_goto_without_lock(scene_class)
|
||||
end
|
||||
end
|
||||
|
||||
if method_defined?(:call) && !method_defined?(:mp_wrong_password_call_without_lock)
|
||||
alias mp_wrong_password_call_without_lock call
|
||||
def call(scene_class)
|
||||
if defined?(MPWrongPasswordTeller) && MPWrongPasswordTeller.blocked? &&
|
||||
defined?(Scene_MPWrongPasswordTeller)
|
||||
return goto(Scene_MPWrongPasswordTeller)
|
||||
end
|
||||
mp_wrong_password_call_without_lock(scene_class)
|
||||
end
|
||||
end
|
||||
|
||||
if method_defined?(:return) && !method_defined?(:mp_wrong_password_return_without_lock)
|
||||
alias mp_wrong_password_return_without_lock return
|
||||
def return
|
||||
if defined?(MPWrongPasswordTeller) && MPWrongPasswordTeller.blocked? &&
|
||||
defined?(Scene_MPWrongPasswordTeller)
|
||||
return goto(Scene_MPWrongPasswordTeller)
|
||||
end
|
||||
mp_wrong_password_return_without_lock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user