Compare commits
3
Commits
3e832c8446
...
LonaRPG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5123d1bc7e | ||
|
|
89f0da185b | ||
|
|
5804acfcec |
@@ -174,20 +174,21 @@ module MPIslandVoyage
|
|||||||
end
|
end
|
||||||
|
|
||||||
if defined?(Game_Player)
|
if defined?(Game_Player)
|
||||||
class Game_Player
|
module MPIslandVoyageMovementPatch
|
||||||
alias ibru_movable_without movable?
|
|
||||||
def movable?(*args, &block)
|
def movable?(*args, &block)
|
||||||
return false if MPIslandVoyage.transit? && $game_map && $game_map.map_id == 156
|
return false if MPIslandVoyage.transit? && $game_map && $game_map.map_id == 156
|
||||||
ibru_movable_without(*args, &block)
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Game_Player.prepend(MPIslandVoyageMovementPatch) unless Game_Player.ancestors.include?(MPIslandVoyageMovementPatch)
|
||||||
end
|
end
|
||||||
|
|
||||||
if defined?(WebSocket)
|
if defined?(WebSocket)
|
||||||
module WebSocket
|
# PresenceVersionGate and several other mods already prepend WebSocket.
|
||||||
class << self
|
# Aliasing their parse/disconnect methods here makes their super call return
|
||||||
alias ibru_parse_without parse
|
# to this wrapper forever. A final prepend keeps the lookup chain linear.
|
||||||
def parse(message)
|
module MPIslandVoyageWebSocketPatch
|
||||||
|
def parse(message)
|
||||||
# The server uses a distinct room ID for island interiors. Only the
|
# The server uses a distinct room ID for island interiors. Only the
|
||||||
# transport layer sees it; the game loads the original map data.
|
# transport layer sees it; the game loads the original map data.
|
||||||
if message =~ /\Abootstrap_map:(10\d{3})\z/
|
if message =~ /\Abootstrap_map:(10\d{3})\z/
|
||||||
@@ -223,36 +224,39 @@ if defined?(WebSocket)
|
|||||||
MPIslandVoyage.set_targets(list)
|
MPIslandVoyage.set_targets(list)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
ibru_parse_without(message)
|
super(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
alias ibru_noclip_without admin_noclip_enabled?
|
def disconnect(*args, &block)
|
||||||
def admin_noclip_enabled?
|
MPIslandVoyage.set_active(false)
|
||||||
MPIslandVoyage.noclip? || ibru_noclip_without
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
alias ibru_hidden_without admin_see_hidden_enabled?
|
def admin_noclip_enabled?
|
||||||
def admin_see_hidden_enabled?
|
MPIslandVoyage.noclip? || super
|
||||||
(MPIslandVoyage.active? && !!@admin_see_hidden_enabled) || ibru_hidden_without
|
end
|
||||||
end
|
|
||||||
|
|
||||||
alias ibru_ghost_without admin_can_ghost?
|
def admin_see_hidden_enabled?
|
||||||
def admin_can_ghost?
|
(MPIslandVoyage.active? && !!@admin_see_hidden_enabled) || super
|
||||||
MPIslandVoyage.active? || ibru_ghost_without
|
end
|
||||||
end
|
|
||||||
|
def admin_can_ghost?
|
||||||
|
MPIslandVoyage.active? || super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
sc = WebSocket.singleton_class
|
||||||
|
sc.prepend(MPIslandVoyageWebSocketPatch) unless sc.ancestors.include?(MPIslandVoyageWebSocketPatch)
|
||||||
end
|
end
|
||||||
|
|
||||||
if defined?(MPGodMode)
|
if defined?(MPGodMode)
|
||||||
module MPGodMode
|
module MPGodMode
|
||||||
class << self
|
class << self
|
||||||
alias ibru_active_without active?
|
alias ibru_active_without active? unless method_defined?(:ibru_active_without)
|
||||||
def active?
|
def active?
|
||||||
return !!@enabled && MPIslandVoyage.active? && Time.now.to_f < @expires.to_f if MPIslandVoyage.active?
|
return !!@enabled && MPIslandVoyage.active? && Time.now.to_f < @expires.to_f if MPIslandVoyage.active?
|
||||||
ibru_active_without
|
ibru_active_without
|
||||||
end
|
end
|
||||||
alias ibru_toggle_without request_toggle
|
alias ibru_toggle_without request_toggle unless method_defined?(:ibru_toggle_without)
|
||||||
def request_toggle
|
def request_toggle
|
||||||
return ibru_toggle_without unless MPIslandVoyage.active?
|
return ibru_toggle_without unless MPIslandVoyage.active?
|
||||||
return if pending? || !WebSocket.connected?
|
return if pending? || !WebSocket.connected?
|
||||||
@@ -260,9 +264,10 @@ if defined?(MPGodMode)
|
|||||||
WebSocket.send_line("god_toggle:#{active? ? 0 : 1}")
|
WebSocket.send_line("god_toggle:#{active? ? 0 : 1}")
|
||||||
refresh_menu
|
refresh_menu
|
||||||
end
|
end
|
||||||
alias ibru_tick_without tick
|
alias ibru_tick_without tick unless method_defined?(:ibru_tick_without)
|
||||||
def tick
|
def tick
|
||||||
ibru_tick_without
|
ibru_tick_without
|
||||||
|
MPIslandVoyage.tick
|
||||||
if MPIslandVoyage.active? && WebSocket.bootstrap_sync_unlocked? && (!@ibru_hello_at || Time.now.to_f - @ibru_hello_at > 10)
|
if MPIslandVoyage.active? && WebSocket.bootstrap_sync_unlocked? && (!@ibru_hello_at || Time.now.to_f - @ibru_hello_at > 10)
|
||||||
@ibru_hello_at = Time.now.to_f
|
@ibru_hello_at = Time.now.to_f
|
||||||
WebSocket.send_line('god_hello:1')
|
WebSocket.send_line('god_hello:1')
|
||||||
@@ -272,34 +277,23 @@ if defined?(MPGodMode)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if defined?(Scene_Map)
|
|
||||||
class Scene_Map
|
|
||||||
alias ibru_update_without update
|
|
||||||
def update(*args, &block)
|
|
||||||
result = ibru_update_without(*args, &block)
|
|
||||||
MPIslandVoyage.tick
|
|
||||||
result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Keep the island tools in the existing VIP overlay, without granting OWNER.
|
# Keep the island tools in the existing VIP overlay, without granting OWNER.
|
||||||
if defined?(Scene_Map) && Scene_Map.method_defined?(:mp_admin_open_root)
|
if defined?(Scene_Map) && Scene_Map.method_defined?(:mp_admin_open_root)
|
||||||
class Scene_Map
|
class Scene_Map
|
||||||
alias ibru_hotkey_without mp_admin_update_hotkey
|
alias ibru_hotkey_without mp_admin_update_hotkey unless method_defined?(:ibru_hotkey_without)
|
||||||
def mp_admin_update_hotkey
|
def mp_admin_update_hotkey
|
||||||
return ibru_hotkey_without unless MPIslandVoyage.active? && WebSocket.admin_role_rank <= 0
|
return ibru_hotkey_without unless MPIslandVoyage.active? && WebSocket.admin_role_rank <= 0
|
||||||
return if MPAdminMenu.blocked_by_other_ui? || !MPAdminMenu.open_triggered?
|
return if MPAdminMenu.blocked_by_other_ui? || !MPAdminMenu.open_triggered?
|
||||||
mp_admin_menu_active? ? mp_admin_dispose_menu : mp_admin_open_root
|
mp_admin_menu_active? ? mp_admin_dispose_menu : mp_admin_open_root
|
||||||
end
|
end
|
||||||
|
|
||||||
alias ibru_validate_role_without mp_admin_validate_menu_role
|
alias ibru_validate_role_without mp_admin_validate_menu_role unless method_defined?(:ibru_validate_role_without)
|
||||||
def mp_admin_validate_menu_role
|
def mp_admin_validate_menu_role
|
||||||
return if MPIslandVoyage.active? && WebSocket.connected?
|
return if MPIslandVoyage.active? && WebSocket.connected?
|
||||||
ibru_validate_role_without
|
ibru_validate_role_without
|
||||||
end
|
end
|
||||||
|
|
||||||
alias ibru_admin_root_without mp_admin_open_root
|
alias ibru_admin_root_without mp_admin_open_root unless method_defined?(:ibru_admin_root_without)
|
||||||
def mp_admin_open_root
|
def mp_admin_open_root
|
||||||
return ibru_admin_root_without unless MPIslandVoyage.active?
|
return ibru_admin_root_without unless MPIslandVoyage.active?
|
||||||
rows = []
|
rows = []
|
||||||
@@ -321,7 +315,7 @@ if defined?(Scene_Map) && Scene_Map.method_defined?(:mp_admin_open_root)
|
|||||||
@mp_admin_window.set_handler(:cancel, method(:mp_admin_dispose_menu))
|
@mp_admin_window.set_handler(:cancel, method(:mp_admin_dispose_menu))
|
||||||
end
|
end
|
||||||
|
|
||||||
alias ibru_admin_back_without mp_admin_back
|
alias ibru_admin_back_without mp_admin_back unless method_defined?(:ibru_admin_back_without)
|
||||||
def mp_admin_back
|
def mp_admin_back
|
||||||
return mp_admin_open_root if @mp_admin_state == :ibru_targets
|
return mp_admin_open_root if @mp_admin_state == :ibru_targets
|
||||||
ibru_admin_back_without
|
ibru_admin_back_without
|
||||||
@@ -372,7 +366,7 @@ end
|
|||||||
if defined?(MPAdminMenu)
|
if defined?(MPAdminMenu)
|
||||||
module MPAdminMenu
|
module MPAdminMenu
|
||||||
class << self
|
class << self
|
||||||
alias ibru_grid_title_without grid_title
|
alias ibru_grid_title_without grid_title unless method_defined?(:ibru_grid_title_without)
|
||||||
def grid_title(state)
|
def grid_title(state)
|
||||||
return 'Остров IBRU_VIZ' if state == :root && MPIslandVoyage.active?
|
return 'Остров IBRU_VIZ' if state == :root && MPIslandVoyage.active?
|
||||||
ibru_grid_title_without(state)
|
ibru_grid_title_without(state)
|
||||||
@@ -384,12 +378,12 @@ end
|
|||||||
# Gray the item entry and block both keyboard and mouse access to its page.
|
# Gray the item entry and block both keyboard and mouse access to its page.
|
||||||
if defined?(Menu_Command)
|
if defined?(Menu_Command)
|
||||||
class Menu_Command
|
class Menu_Command
|
||||||
alias ibru_menu_initialize_without initialize
|
alias ibru_menu_initialize_without initialize unless method_defined?(:ibru_menu_initialize_without)
|
||||||
def initialize(command_names)
|
def initialize(command_names)
|
||||||
@ibru_item_index = command_names.index($game_text['menu:core/items']) rescue nil
|
@ibru_item_index = command_names.index($game_text['menu:core/items']) rescue nil
|
||||||
ibru_menu_initialize_without(command_names)
|
ibru_menu_initialize_without(command_names)
|
||||||
end
|
end
|
||||||
alias ibru_menu_refresh_without refresh
|
alias ibru_menu_refresh_without refresh unless method_defined?(:ibru_menu_refresh_without)
|
||||||
def refresh
|
def refresh
|
||||||
ibru_menu_refresh_without
|
ibru_menu_refresh_without
|
||||||
if MPIslandVoyage.active? && @ibru_item_index && @menu_sprites[@ibru_item_index]
|
if MPIslandVoyage.active? && @ibru_item_index && @menu_sprites[@ibru_item_index]
|
||||||
@@ -401,7 +395,7 @@ end
|
|||||||
|
|
||||||
if defined?(Scene_Menu)
|
if defined?(Scene_Menu)
|
||||||
class Scene_Menu
|
class Scene_Menu
|
||||||
alias ibru_menu_start_without start
|
alias ibru_menu_start_without start unless method_defined?(:ibru_menu_start_without)
|
||||||
def start(*args, &block)
|
def start(*args, &block)
|
||||||
result = ibru_menu_start_without(*args, &block)
|
result = ibru_menu_start_without(*args, &block)
|
||||||
if MPIslandVoyage.active? && @contents && @contents.contents[@menu_index].is_a?(Menu_Items)
|
if MPIslandVoyage.active? && @contents && @contents.contents[@menu_index].is_a?(Menu_Items)
|
||||||
@@ -409,7 +403,7 @@ if defined?(Scene_Menu)
|
|||||||
end
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
alias ibru_menu_switch_without process_switchMenuIndex
|
alias ibru_menu_switch_without process_switchMenuIndex unless method_defined?(:ibru_menu_switch_without)
|
||||||
def process_switchMenuIndex(index)
|
def process_switchMenuIndex(index)
|
||||||
if MPIslandVoyage.active? && @contents && @contents.contents[index].is_a?(Menu_Items)
|
if MPIslandVoyage.active? && @contents && @contents.contents[index].is_a?(Menu_Items)
|
||||||
direction = index.to_i >= @menu_index.to_i ? 1 : -1
|
direction = index.to_i >= @menu_index.to_i ? 1 : -1
|
||||||
@@ -419,7 +413,7 @@ if defined?(Scene_Menu)
|
|||||||
end
|
end
|
||||||
ibru_menu_switch_without(index)
|
ibru_menu_switch_without(index)
|
||||||
end
|
end
|
||||||
alias ibru_menu_ok_without process_ok
|
alias ibru_menu_ok_without process_ok unless method_defined?(:ibru_menu_ok_without)
|
||||||
def process_ok
|
def process_ok
|
||||||
return SndLib.sys_buzzer if MPIslandVoyage.active? && @contents && @contents.contents[@menu_index].is_a?(Menu_Items)
|
return SndLib.sys_buzzer if MPIslandVoyage.active? && @contents && @contents.contents[@menu_index].is_a?(Menu_Items)
|
||||||
ibru_menu_ok_without
|
ibru_menu_ok_without
|
||||||
@@ -444,7 +438,7 @@ if defined?(Battle_System)
|
|||||||
end
|
end
|
||||||
if defined?(Game_SandboxObject)
|
if defined?(Game_SandboxObject)
|
||||||
class Game_SandboxObject
|
class Game_SandboxObject
|
||||||
alias ibru_sandbox_damage_without take_damage
|
alias ibru_sandbox_damage_without take_damage unless method_defined?(:ibru_sandbox_damage_without)
|
||||||
def take_damage(user, *args, &block)
|
def take_damage(user, *args, &block)
|
||||||
return [] if MPIslandVoyage.active? && $game_player && user.equal?($game_player.actor)
|
return [] if MPIslandVoyage.active? && $game_player && user.equal?($game_player.actor)
|
||||||
ibru_sandbox_damage_without(user, *args, &block)
|
ibru_sandbox_damage_without(user, *args, &block)
|
||||||
|
|||||||
Reference in new issue
Block a user