mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Created module MenuHandlers for the contents of various menus
This commit is contained in:
@@ -193,13 +193,6 @@ class HandlerHash2
|
||||
return nil
|
||||
end
|
||||
|
||||
def addIf(conditionProc, handler = nil, &handlerBlock)
|
||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
||||
end
|
||||
@add_ifs.push([conditionProc, handler || handlerBlock])
|
||||
end
|
||||
|
||||
def add(sym, handler = nil, &handlerBlock)
|
||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||
raise ArgumentError, "#{self.class.name} for #{sym.inspect} has no valid handler (#{handler.inspect} was given)"
|
||||
@@ -207,12 +200,21 @@ class HandlerHash2
|
||||
@hash[sym] = handler || handlerBlock if sym
|
||||
end
|
||||
|
||||
def addIf(conditionProc, handler = nil, &handlerBlock)
|
||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
||||
end
|
||||
@add_ifs.push([conditionProc, handler || handlerBlock])
|
||||
end
|
||||
|
||||
def copy(src, *dests)
|
||||
handler = self[src]
|
||||
return if !handler
|
||||
dests.each do |dest|
|
||||
self.add(dest, handler)
|
||||
end
|
||||
dests.each { |dest| add(dest, handler) }
|
||||
end
|
||||
|
||||
def remove(key)
|
||||
@hash.delete(key)
|
||||
end
|
||||
|
||||
def clear
|
||||
@@ -222,7 +224,7 @@ class HandlerHash2
|
||||
def trigger(sym, *args)
|
||||
sym = sym.id if !sym.is_a?(Symbol) && sym.respond_to?("id")
|
||||
handler = self[sym]
|
||||
return (handler) ? handler.call(sym, *args) : nil
|
||||
return handler&.call(sym, *args)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -232,9 +234,8 @@ end
|
||||
#===============================================================================
|
||||
class HandlerHashBasic
|
||||
def initialize
|
||||
@ordered_keys = []
|
||||
@hash = {}
|
||||
@addIfs = []
|
||||
@hash = {}
|
||||
@addIfs = []
|
||||
end
|
||||
|
||||
def [](entry)
|
||||
@@ -248,16 +249,11 @@ class HandlerHashBasic
|
||||
return ret
|
||||
end
|
||||
|
||||
def each
|
||||
@ordered_keys.each { |key| yield key, @hash[key] }
|
||||
end
|
||||
|
||||
def add(entry, handler = nil, &handlerBlock)
|
||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||
raise ArgumentError, "#{self.class.name} for #{entry.inspect} has no valid handler (#{handler.inspect} was given)"
|
||||
end
|
||||
return if !entry || entry.empty?
|
||||
@ordered_keys.push(entry) if !@ordered_keys.include?(entry)
|
||||
@hash[entry] = handler || handlerBlock
|
||||
end
|
||||
|
||||
@@ -271,17 +267,28 @@ class HandlerHashBasic
|
||||
def copy(src, *dests)
|
||||
handler = self[src]
|
||||
return if !handler
|
||||
dests.each { |dest| self.add(dest, handler) }
|
||||
dests.each { |dest| add(dest, handler) }
|
||||
end
|
||||
|
||||
def remove(key)
|
||||
@hash.delete(key)
|
||||
end
|
||||
|
||||
def clear
|
||||
@hash.clear
|
||||
@ordered_keys.clear
|
||||
end
|
||||
|
||||
def each
|
||||
@hash.each_pair { |key, value| yield key, value }
|
||||
end
|
||||
|
||||
def keys
|
||||
return @hash.keys.clone
|
||||
end
|
||||
|
||||
def trigger(entry, *args)
|
||||
handler = self[entry]
|
||||
return (handler) ? handler.call(*args) : nil
|
||||
return handler&.call(*args)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -63,3 +63,59 @@ module EventHandlers
|
||||
return @@events[event]&.trigger(*args)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# This module stores the contents of various menus. Each command in a menu is a
|
||||
# hash of data (containing its name, relative order, code to run when chosen,
|
||||
# etc.).
|
||||
# Menus that use this module are:
|
||||
#-------------------------------------------------------------------------------
|
||||
# Pause menu
|
||||
# Pokégear main menu
|
||||
# PC main menu
|
||||
# Various debug menus (main, Pokémon, battle, battle Pokémon)
|
||||
#===============================================================================
|
||||
module MenuHandlers
|
||||
@@handlers = {}
|
||||
|
||||
def self.add(menu, option, hash)
|
||||
@@handlers[menu] = HandlerHashBasic.new if !@@handlers.has_key?(menu)
|
||||
@@handlers[menu].add(option, hash)
|
||||
end
|
||||
|
||||
def self.remove(menu, option)
|
||||
@@handlers[menu]&.remove(option)
|
||||
end
|
||||
|
||||
def self.clear(menu)
|
||||
@@handlers[menu]&.clear
|
||||
end
|
||||
|
||||
def self.each(menu)
|
||||
return if !@@handlers.has_key?(menu)
|
||||
@@handlers[menu].each { |option, hash| yield option, hash }
|
||||
end
|
||||
|
||||
def self.each_available(menu)
|
||||
return if !@@handlers.has_key?(menu)
|
||||
options = @@handlers[menu]
|
||||
keys = options.keys
|
||||
sorted_keys = keys.sort_by { |option| options[option]["order"] || keys.index(option) }
|
||||
sorted_keys.each do |option|
|
||||
hash = options[option]
|
||||
next if hash["condition"] && !hash["condition"].call
|
||||
if hash["name"].is_a?(Proc)
|
||||
name = hash["name"].call
|
||||
else
|
||||
name = _INTL(hash["name"])
|
||||
end
|
||||
yield option, hash, name
|
||||
end
|
||||
end
|
||||
|
||||
def self.call(menu, option, function, *args)
|
||||
option_hash = @@handlers[menu][option]
|
||||
return nil if !option_hash || !option_hash[function]
|
||||
return option_hash[function].call(*args)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -87,8 +87,8 @@ EventHandlers.add(:on_player_step_taken, :gain_happiness,
|
||||
# Poison party Pokémon
|
||||
EventHandlers.add(:on_player_step_taken_can_transfer, :poison_party,
|
||||
proc { |handled|
|
||||
# handled is an array: [nil]. If [true], a message has already been shown
|
||||
# because of this step, so don't do anything that might show another one
|
||||
# handled is an array: [nil]. If [true], a transfer has happened because of
|
||||
# this event, so don't do anything that might cause another one
|
||||
next if handled[0]
|
||||
next if !Settings::POISON_IN_FIELD || $PokemonGlobal.stepcount % 4 != 0
|
||||
flashed = false
|
||||
|
||||
@@ -467,25 +467,16 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class HallOfFamePC
|
||||
def shouldShow?
|
||||
return $PokemonGlobal.hallOfFameLastNumber > 0
|
||||
end
|
||||
|
||||
def name
|
||||
return _INTL("Hall of Fame")
|
||||
end
|
||||
|
||||
def access
|
||||
MenuHandlers.add(:pc_menu, :hall_of_fame, {
|
||||
"name" => _INTL("Hall of Fame"),
|
||||
"order" => 40,
|
||||
"condition" => proc { next $PokemonGlobal.hallOfFameLastNumber > 0 },
|
||||
"effect" => proc { |menu|
|
||||
pbMessage(_INTL("\\se[PC access]Accessed the Hall of Fame."))
|
||||
pbHallOfFamePC
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
PokemonPCList.registerPC(HallOfFamePC.new)
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
|
||||
@@ -92,6 +92,8 @@ class PokemonPauseMenu
|
||||
@scene.pbShowMenu
|
||||
end
|
||||
|
||||
def pbShowInfo; end
|
||||
|
||||
def pbStartPokemonMenu
|
||||
if !$player
|
||||
if $DEBUG
|
||||
@@ -101,198 +103,218 @@ class PokemonPauseMenu
|
||||
return
|
||||
end
|
||||
@scene.pbStartScene
|
||||
endscene = true
|
||||
# Show extra info window if relevant
|
||||
pbShowInfo
|
||||
# Get all commands
|
||||
command_list = []
|
||||
commands = []
|
||||
cmdPokedex = -1
|
||||
cmdPokemon = -1
|
||||
cmdBag = -1
|
||||
cmdTrainer = -1
|
||||
cmdSave = -1
|
||||
cmdOption = -1
|
||||
cmdPokegear = -1
|
||||
cmdTownMap = -1
|
||||
cmdDebug = -1
|
||||
cmdQuit = -1
|
||||
cmdEndGame = -1
|
||||
if $player.has_pokedex && $player.pokedex.accessible_dexes.length > 0
|
||||
commands[cmdPokedex = commands.length] = _INTL("Pokédex")
|
||||
MenuHandlers.each_available(:pause_menu) do |option, hash, name|
|
||||
command_list.push(name)
|
||||
commands.push(hash)
|
||||
end
|
||||
commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $player.party_count > 0
|
||||
commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest?
|
||||
if $player.has_pokegear
|
||||
commands[cmdPokegear = commands.length] = _INTL("Pokégear")
|
||||
elsif $bag.has?(:TOWNMAP)
|
||||
commands[cmdTownMap = commands.length] = _INTL("Town Map")
|
||||
end
|
||||
commands[cmdTrainer = commands.length] = $player.name
|
||||
if pbInSafari?
|
||||
if Settings::SAFARI_STEPS <= 0
|
||||
@scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
|
||||
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
|
||||
end
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit")
|
||||
elsif pbInBugContest?
|
||||
if pbBugContestState.lastPokemon
|
||||
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
|
||||
pbBugContestState.lastPokemon.speciesName,
|
||||
pbBugContestState.lastPokemon.level,
|
||||
pbBugContestState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
|
||||
end
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit Contest")
|
||||
elsif $game_system && !$game_system.save_disabled
|
||||
commands[cmdSave = commands.length] = _INTL("Save")
|
||||
end
|
||||
commands[cmdOption = commands.length] = _INTL("Options")
|
||||
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
|
||||
commands[cmdEndGame = commands.length] = _INTL("Quit Game")
|
||||
# Main loop
|
||||
end_scene = false
|
||||
loop do
|
||||
command = @scene.pbShowCommands(commands)
|
||||
if cmdPokedex >= 0 && command == cmdPokedex
|
||||
pbPlayDecisionSE
|
||||
if Settings::USE_CURRENT_REGION_DEX
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
screen = PokemonPokedexScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif $player.pokedex.accessible_dexes.length == 1
|
||||
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0]
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
screen = PokemonPokedexScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
@scene.pbRefresh
|
||||
}
|
||||
else
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedexMenu_Scene.new
|
||||
screen = PokemonPokedexMenuScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
@scene.pbRefresh
|
||||
}
|
||||
end
|
||||
elsif cmdPokemon >= 0 && command == cmdPokemon
|
||||
pbPlayDecisionSE
|
||||
hiddenmove = nil
|
||||
pbFadeOutIn {
|
||||
sscene = PokemonParty_Scene.new
|
||||
sscreen = PokemonPartyScreen.new(sscene, $player.party)
|
||||
hiddenmove = sscreen.pbPokemonScreen
|
||||
(hiddenmove) ? @scene.pbEndScene : @scene.pbRefresh
|
||||
}
|
||||
if hiddenmove
|
||||
$game_temp.in_menu = false
|
||||
pbUseHiddenMove(hiddenmove[0], hiddenmove[1])
|
||||
return
|
||||
end
|
||||
elsif cmdBag >= 0 && command == cmdBag
|
||||
pbPlayDecisionSE
|
||||
item = nil
|
||||
pbFadeOutIn {
|
||||
scene = PokemonBag_Scene.new
|
||||
screen = PokemonBagScreen.new(scene, $bag)
|
||||
item = screen.pbStartScreen
|
||||
(item) ? @scene.pbEndScene : @scene.pbRefresh
|
||||
}
|
||||
if item
|
||||
$game_temp.in_menu = false
|
||||
pbUseKeyItemInField(item)
|
||||
return
|
||||
end
|
||||
elsif cmdPokegear >= 0 && command == cmdPokegear
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokegear_Scene.new
|
||||
screen = PokemonPokegearScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
|
||||
}
|
||||
return if pbFlyToNewLocation
|
||||
elsif cmdTownMap >= 0 && command == cmdTownMap
|
||||
pbFadeOutIn {
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
$game_temp.fly_destination = ret if ret
|
||||
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
|
||||
}
|
||||
return if pbFlyToNewLocation
|
||||
elsif cmdTrainer >= 0 && command == cmdTrainer
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonTrainerCard_Scene.new
|
||||
screen = PokemonTrainerCardScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdQuit >= 0 && command == cmdQuit
|
||||
@scene.pbHideMenu
|
||||
if pbInSafari?
|
||||
if pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?"))
|
||||
@scene.pbEndScene
|
||||
pbSafariState.decision = 1
|
||||
pbSafariState.pbGoToStart
|
||||
return
|
||||
else
|
||||
pbShowMenu
|
||||
end
|
||||
elsif pbConfirmMessage(_INTL("Would you like to end the Contest now?"))
|
||||
@scene.pbEndScene
|
||||
pbBugContestState.pbStartJudging
|
||||
return
|
||||
else
|
||||
pbShowMenu
|
||||
end
|
||||
elsif cmdSave >= 0 && command == cmdSave
|
||||
@scene.pbHideMenu
|
||||
scene = PokemonSave_Scene.new
|
||||
screen = PokemonSaveScreen.new(scene)
|
||||
if screen.pbSaveScreen
|
||||
@scene.pbEndScene
|
||||
endscene = false
|
||||
break
|
||||
else
|
||||
pbShowMenu
|
||||
end
|
||||
elsif cmdOption >= 0 && command == cmdOption
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonOption_Scene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
pbUpdateSceneMap
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdDebug >= 0 && command == cmdDebug
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
pbDebugMenu
|
||||
@scene.pbRefresh
|
||||
}
|
||||
elsif cmdEndGame >= 0 && command == cmdEndGame
|
||||
@scene.pbHideMenu
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to quit the game?"))
|
||||
scene = PokemonSave_Scene.new
|
||||
screen = PokemonSaveScreen.new(scene)
|
||||
if screen.pbSaveScreen
|
||||
@scene.pbEndScene
|
||||
end
|
||||
@scene.pbEndScene
|
||||
$scene = nil
|
||||
return
|
||||
else
|
||||
pbShowMenu
|
||||
end
|
||||
else
|
||||
choice = @scene.pbShowCommands(command_list)
|
||||
if choice < 0
|
||||
pbPlayCloseMenuSE
|
||||
end_scene = true
|
||||
break
|
||||
end
|
||||
break if commands[choice]["effect"].call(@scene)
|
||||
end
|
||||
@scene.pbEndScene if endscene
|
||||
@scene.pbEndScene if end_scene
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Pause menu commands.
|
||||
#===============================================================================
|
||||
MenuHandlers.add(:pause_menu, :pokedex, {
|
||||
"name" => _INTL("Pokédex"),
|
||||
"order" => 10,
|
||||
"condition" => proc { next $player.has_pokedex && $player.pokedex.accessible_dexes.length > 0 },
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
if Settings::USE_CURRENT_REGION_DEX
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
screen = PokemonPokedexScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
}
|
||||
elsif $player.pokedex.accessible_dexes.length == 1
|
||||
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0]
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedex_Scene.new
|
||||
screen = PokemonPokedexScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
}
|
||||
else
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokedexMenu_Scene.new
|
||||
screen = PokemonPokedexMenuScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
}
|
||||
end
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :party, {
|
||||
"name" => _INTL("Pokémon"),
|
||||
"order" => 20,
|
||||
"condition" => proc { next $player.party_count > 0 },
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
hidden_move = nil
|
||||
pbFadeOutIn {
|
||||
sscene = PokemonParty_Scene.new
|
||||
sscreen = PokemonPartyScreen.new(sscene, $player.party)
|
||||
hidden_move = sscreen.pbPokemonScreen
|
||||
(hidden_move) ? menu.pbEndScene : menu.pbRefresh
|
||||
}
|
||||
next false if !hidden_move
|
||||
$game_temp.in_menu = false
|
||||
pbUseHiddenMove(hidden_move[0], hidden_move[1])
|
||||
next true
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :bag, {
|
||||
"name" => _INTL("Bag"),
|
||||
"order" => 30,
|
||||
"condition" => proc { next !pbInBugContest? },
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
item = nil
|
||||
pbFadeOutIn {
|
||||
scene = PokemonBag_Scene.new
|
||||
screen = PokemonBagScreen.new(scene, $bag)
|
||||
item = screen.pbStartScreen
|
||||
(item) ? menu.pbEndScene : menu.pbRefresh
|
||||
}
|
||||
next false if !item
|
||||
$game_temp.in_menu = false
|
||||
pbUseKeyItemInField(item)
|
||||
next true
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :pokegear, {
|
||||
"name" => _INTL("Pokégear"),
|
||||
"order" => 40,
|
||||
"condition" => proc { next $player.has_pokegear },
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonPokegear_Scene.new
|
||||
screen = PokemonPokegearScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
($game_temp.fly_destination) ? menu.pbEndScene : menu.pbRefresh
|
||||
}
|
||||
next pbFlyToNewLocation
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :town_map, {
|
||||
"name" => _INTL("Town Map"),
|
||||
"order" => 40,
|
||||
"condition" => proc { next !$player.has_pokegear && $bag.has?(:TOWNMAP) },
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
$game_temp.fly_destination = ret if ret
|
||||
($game_temp.fly_destination) ? menu.pbEndScene : menu.pbRefresh
|
||||
}
|
||||
next pbFlyToNewLocation
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :trainer_card, {
|
||||
"name" => proc { next $player.name },
|
||||
"order" => 50,
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonTrainerCard_Scene.new
|
||||
screen = PokemonTrainerCardScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
menu.pbRefresh
|
||||
}
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :save, {
|
||||
"name" => _INTL("Save"),
|
||||
"order" => 60,
|
||||
"condition" => proc { next $game_system && !$game_system.save_disabled &&
|
||||
!pbInSafari? && !pbInBugContest? },
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
scene = PokemonSave_Scene.new
|
||||
screen = PokemonSaveScreen.new(scene)
|
||||
if screen.pbSaveScreen
|
||||
menu.pbEndScene
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :options, {
|
||||
"name" => _INTL("Options"),
|
||||
"order" => 70,
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonOption_Scene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
pbUpdateSceneMap
|
||||
menu.pbRefresh
|
||||
}
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :debug, {
|
||||
"name" => _INTL("Debug"),
|
||||
"order" => 80,
|
||||
"condition" => proc { next $DEBUG },
|
||||
"effect" => proc { |menu|
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
pbDebugMenu
|
||||
menu.pbRefresh
|
||||
}
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pause_menu, :quit_game, {
|
||||
"name" => _INTL("Quit Game"),
|
||||
"order" => 90,
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to quit the game?"))
|
||||
scene = PokemonSave_Scene.new
|
||||
screen = PokemonSaveScreen.new(scene)
|
||||
screen.pbSaveScreen
|
||||
menu.pbEndScene
|
||||
$scene = nil
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -128,43 +128,71 @@ class PokemonPokegearScreen
|
||||
end
|
||||
|
||||
def pbStartScreen
|
||||
# Get all commands
|
||||
command_list = []
|
||||
commands = []
|
||||
cmdMap = -1
|
||||
cmdPhone = -1
|
||||
cmdJukebox = -1
|
||||
commands[cmdMap = commands.length] = ["map", _INTL("Map")]
|
||||
if $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length > 0
|
||||
commands[cmdPhone = commands.length] = ["phone", _INTL("Phone")]
|
||||
MenuHandlers.each_available(:pokegear_menu) do |option, hash, name|
|
||||
command_list.push([hash["icon_name"] || "", name])
|
||||
commands.push(hash)
|
||||
end
|
||||
commands[cmdJukebox = commands.length] = ["jukebox", _INTL("Jukebox")]
|
||||
@scene.pbStartScene(commands)
|
||||
@scene.pbStartScene(command_list)
|
||||
# Main loop
|
||||
end_scene = false
|
||||
loop do
|
||||
cmd = @scene.pbScene
|
||||
if cmd < 0
|
||||
choice = @scene.pbScene
|
||||
if choice < 0
|
||||
end_scene = true
|
||||
break
|
||||
elsif cmdMap >= 0 && cmd == cmdMap
|
||||
pbFadeOutIn {
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
if ret
|
||||
$game_temp.fly_destination = ret
|
||||
next 99999 # Ugly hack to make Pokégear scene not reappear if flying
|
||||
end
|
||||
}
|
||||
break if $game_temp.fly_destination
|
||||
elsif cmdPhone >= 0 && cmd == cmdPhone
|
||||
pbFadeOutIn {
|
||||
PokemonPhoneScene.new.start
|
||||
}
|
||||
elsif cmdJukebox >= 0 && cmd == cmdJukebox
|
||||
pbFadeOutIn {
|
||||
scene = PokemonJukebox_Scene.new
|
||||
screen = PokemonJukeboxScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
}
|
||||
end
|
||||
break if commands[choice]["effect"].call(@scene)
|
||||
end
|
||||
($game_temp.fly_destination) ? @scene.dispose : @scene.pbEndScene
|
||||
@scene.pbEndScene if end_scene
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
MenuHandlers.add(:pokegear_menu, :map, {
|
||||
"name" => _INTL("Map"),
|
||||
"icon_name" => "map",
|
||||
"order" => 10,
|
||||
"effect" => proc { |menu|
|
||||
pbFadeOutIn {
|
||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||
screen = PokemonRegionMapScreen.new(scene)
|
||||
ret = screen.pbStartScreen
|
||||
if ret
|
||||
$game_temp.fly_destination = ret
|
||||
menu.dispose
|
||||
next 99999
|
||||
end
|
||||
}
|
||||
next $game_temp.fly_destination
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pokegear_menu, :phone, {
|
||||
"name" => _INTL("Phone"),
|
||||
"icon_name" => "phone",
|
||||
"order" => 20,
|
||||
"condition" => proc { next $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length > 0 },
|
||||
"effect" => proc { |menu|
|
||||
pbFadeOutIn { PokemonPhoneScene.new.start }
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pokegear_menu, :jukebox, {
|
||||
"name" => _INTL("Jukebox"),
|
||||
"icon_name" => "jukebox",
|
||||
"order" => 30,
|
||||
"effect" => proc { |menu|
|
||||
pbFadeOutIn {
|
||||
scene = PokemonJukebox_Scene.new
|
||||
screen = PokemonJukeboxScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
}
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,116 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class TrainerPC
|
||||
def shouldShow?
|
||||
return true
|
||||
end
|
||||
|
||||
def name
|
||||
return _INTL("{1}'s PC", $player.name)
|
||||
end
|
||||
|
||||
def access
|
||||
pbMessage(_INTL("\\se[PC access]Accessed {1}'s PC.", $player.name))
|
||||
pbTrainerPCMenu
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class StorageSystemPC
|
||||
def shouldShow?
|
||||
return true
|
||||
end
|
||||
|
||||
def name
|
||||
if $player.seen_storage_creator
|
||||
return _INTL("{1}'s PC", pbGetStorageCreator)
|
||||
else
|
||||
return _INTL("Someone's PC")
|
||||
end
|
||||
end
|
||||
|
||||
def access
|
||||
pbMessage(_INTL("\\se[PC access]The Pokémon Storage System was opened."))
|
||||
command = 0
|
||||
loop do
|
||||
command = pbShowCommandsWithHelp(nil,
|
||||
[_INTL("Organize Boxes"),
|
||||
_INTL("Withdraw Pokémon"),
|
||||
_INTL("Deposit Pokémon"),
|
||||
_INTL("See ya!")],
|
||||
[_INTL("Organize the Pokémon in Boxes and in your party."),
|
||||
_INTL("Move Pokémon stored in Boxes to your party."),
|
||||
_INTL("Store Pokémon in your party in Boxes."),
|
||||
_INTL("Return to the previous menu.")], -1, command)
|
||||
if command >= 0 && command < 3
|
||||
case command
|
||||
when 1 # Withdraw
|
||||
if $PokemonStorage.party_full?
|
||||
pbMessage(_INTL("Your party is full!"))
|
||||
next
|
||||
end
|
||||
when 2 # Deposit
|
||||
count = 0
|
||||
$PokemonStorage.party.each do |p|
|
||||
count += 1 if p && !p.egg? && p.hp > 0
|
||||
end
|
||||
if count <= 1
|
||||
pbMessage(_INTL("Can't deposit the last Pokémon!"))
|
||||
next
|
||||
end
|
||||
end
|
||||
pbFadeOutIn {
|
||||
scene = PokemonStorageScene.new
|
||||
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
|
||||
screen.pbStartScreen(command)
|
||||
}
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module PokemonPCList
|
||||
@@pclist = []
|
||||
|
||||
def self.registerPC(pc)
|
||||
@@pclist.push(pc)
|
||||
end
|
||||
|
||||
def self.getCommandList
|
||||
commands = []
|
||||
@@pclist.each do |pc|
|
||||
commands.push(pc.name) if pc.shouldShow?
|
||||
end
|
||||
commands.push(_INTL("Log Off"))
|
||||
return commands
|
||||
end
|
||||
|
||||
def self.callCommand(cmd)
|
||||
return false if cmd < 0 || cmd >= @@pclist.length
|
||||
i = 0
|
||||
@@pclist.each do |pc|
|
||||
next if !pc.shouldShow?
|
||||
if i == cmd
|
||||
pc.access
|
||||
return true
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# PC menus
|
||||
#===============================================================================
|
||||
def pbPCItemStorage
|
||||
command = 0
|
||||
loop do
|
||||
@@ -162,6 +52,9 @@ def pbPCItemStorage
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbPCMailbox
|
||||
if !$PokemonGlobal.mailbox || $PokemonGlobal.mailbox.length == 0
|
||||
pbMessage(_INTL("There's no Mail here."))
|
||||
@@ -211,6 +104,15 @@ def pbPCMailbox
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbTrainerPC
|
||||
pbMessage(_INTL("\\se[PC open]{1} booted up the PC.", $player.name))
|
||||
pbTrainerPCMenu
|
||||
pbSEPlay("PC close")
|
||||
end
|
||||
|
||||
def pbTrainerPCMenu
|
||||
command = 0
|
||||
loop do
|
||||
@@ -226,20 +128,27 @@ def pbTrainerPCMenu
|
||||
end
|
||||
end
|
||||
|
||||
def pbTrainerPC
|
||||
pbMessage(_INTL("\\se[PC open]{1} booted up the PC.", $player.name))
|
||||
pbTrainerPCMenu
|
||||
pbSEPlay("PC close")
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbPokeCenterPC
|
||||
pbMessage(_INTL("\\se[PC open]{1} booted up the PC.", $player.name))
|
||||
# Get all commands
|
||||
command_list = []
|
||||
commands = []
|
||||
MenuHandlers.each_available(:pc_menu) do |option, hash, name|
|
||||
command_list.push(name)
|
||||
commands.push(hash)
|
||||
end
|
||||
# Main loop
|
||||
command = 0
|
||||
loop do
|
||||
commands = PokemonPCList.getCommandList
|
||||
command = pbMessage(_INTL("Which PC should be accessed?"), commands,
|
||||
commands.length, nil, command)
|
||||
break if !PokemonPCList.callCommand(command)
|
||||
choice = pbMessage(_INTL("Which PC should be accessed?"), command_list, -1, nil, command)
|
||||
if choice < 0
|
||||
pbPlayCloseMenuSE
|
||||
break
|
||||
end
|
||||
break if commands[choice]["effect"].call
|
||||
end
|
||||
pbSEPlay("PC close")
|
||||
end
|
||||
@@ -251,5 +160,65 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
PokemonPCList.registerPC(StorageSystemPC.new)
|
||||
PokemonPCList.registerPC(TrainerPC.new)
|
||||
MenuHandlers.add(:pc_menu, :pokemon_storage, {
|
||||
"name" => proc {
|
||||
next ($player.seen_storage_creator) ? _INTL("{1}'s PC", pbGetStorageCreator) : _INTL("Someone's PC")
|
||||
},
|
||||
"order" => 10,
|
||||
"effect" => proc { |menu|
|
||||
pbMessage(_INTL("\\se[PC access]The Pokémon Storage System was opened."))
|
||||
command = 0
|
||||
loop do
|
||||
command = pbShowCommandsWithHelp(nil,
|
||||
[_INTL("Organize Boxes"),
|
||||
_INTL("Withdraw Pokémon"),
|
||||
_INTL("Deposit Pokémon"),
|
||||
_INTL("See ya!")],
|
||||
[_INTL("Organize the Pokémon in Boxes and in your party."),
|
||||
_INTL("Move Pokémon stored in Boxes to your party."),
|
||||
_INTL("Store Pokémon in your party in Boxes."),
|
||||
_INTL("Return to the previous menu.")], -1, command)
|
||||
break if command < 0
|
||||
case command
|
||||
when 1 # Withdraw
|
||||
if $PokemonStorage.party_full?
|
||||
pbMessage(_INTL("Your party is full!"))
|
||||
next
|
||||
end
|
||||
when 2 # Deposit
|
||||
count = 0
|
||||
$PokemonStorage.party.each do |p|
|
||||
count += 1 if p && !p.egg? && p.hp > 0
|
||||
end
|
||||
if count <= 1
|
||||
pbMessage(_INTL("Can't deposit the last Pokémon!"))
|
||||
next
|
||||
end
|
||||
end
|
||||
pbFadeOutIn {
|
||||
scene = PokemonStorageScene.new
|
||||
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
|
||||
screen.pbStartScreen(command)
|
||||
}
|
||||
end
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pc_menu, :player_pc, {
|
||||
"name" => proc { next _INTL("{1}'s PC", $player.name) },
|
||||
"order" => 20,
|
||||
"effect" => proc { |menu|
|
||||
pbMessage(_INTL("\\se[PC access]Accessed {1}'s PC.", $player.name))
|
||||
pbTrainerPCMenu
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:pc_menu, :close, {
|
||||
"name" => _INTL("Log off"),
|
||||
"order" => 100,
|
||||
"effect" => proc { |menu|
|
||||
next true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1314,22 +1314,13 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PurifyChamberPC
|
||||
def shouldShow?
|
||||
return $player.seen_purify_chamber
|
||||
end
|
||||
|
||||
def name
|
||||
return _INTL("Purify Chamber")
|
||||
end
|
||||
|
||||
def access
|
||||
MenuHandlers.add(:pc_menu, :purify_chamber, {
|
||||
"name" => _INTL("Purify Chamber"),
|
||||
"order" => 30,
|
||||
"condition" => proc { next $player.seen_purify_chamber },
|
||||
"effect" => proc { |menu|
|
||||
pbMessage(_INTL("\\se[PC access]Accessed the Purify Chamber."))
|
||||
pbPurifyChamber
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
PokemonPCList.registerPC(PurifyChamberPC.new)
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class SafariState
|
||||
attr_accessor :ballcount
|
||||
attr_accessor :captures
|
||||
@@ -53,14 +56,9 @@ class SafariState
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
EventHandlers.add(:on_enter_map, :end_safari_game,
|
||||
proc { |_old_map_id|
|
||||
pbSafariState.pbEnd if !pbInSafari?
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbInSafari?
|
||||
if pbSafariState.inProgress?
|
||||
# Reception map is handled separately from safari map since the reception
|
||||
@@ -77,10 +75,19 @@ def pbSafariState
|
||||
return $PokemonGlobal.safariState
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
EventHandlers.add(:on_enter_map, :end_safari_game,
|
||||
proc { |_old_map_id|
|
||||
pbSafariState.pbEnd if !pbInSafari?
|
||||
}
|
||||
)
|
||||
|
||||
EventHandlers.add(:on_player_step_taken_can_transfer, :safari_game_counter,
|
||||
proc { |handled|
|
||||
# handled is an array: [nil]. If [true], a message has already been shown
|
||||
# because of this step, so don't do anything that might show another one
|
||||
# handled is an array: [nil]. If [true], a transfer has happened because of
|
||||
# this event, so don't do anything that might cause another one
|
||||
next if handled[0]
|
||||
next if Settings::SAFARI_STEPS == 0 || !pbInSafari? || pbSafariState.decision != 0
|
||||
pbSafariState.steps -= 1
|
||||
@@ -93,6 +100,9 @@ EventHandlers.add(:on_player_step_taken_can_transfer, :safari_game_counter,
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
EventHandlers.add(:on_calling_wild_battle, :safari_battle,
|
||||
proc { |species, level, handled|
|
||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||
@@ -149,3 +159,39 @@ def pbSafariBattle(species, level)
|
||||
# Return the outcome of the battle
|
||||
return decision
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu
|
||||
alias __safari_pbShowInfo pbShowInfo unless method_defined?(:__safari_pbShowInfo)
|
||||
|
||||
def pbShowInfo
|
||||
__safari_pbShowInfo
|
||||
return if !pbInSafari?
|
||||
if Settings::SAFARI_STEPS <= 0
|
||||
@scene.pbShowInfo(_INTL("Balls: {1}", pbSafariState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
|
||||
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MenuHandlers.add(:pause_menu, :quit_safari_game, {
|
||||
"name" => _INTL("Quit"),
|
||||
"order" => 60,
|
||||
"condition" => proc { next pbInSafari? },
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
if pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?"))
|
||||
menu.pbEndScene
|
||||
pbSafariState.decision = 1
|
||||
pbSafariState.pbGoToStart
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class BugContestState
|
||||
attr_accessor :ballcount
|
||||
attr_accessor :decision
|
||||
@@ -214,8 +217,9 @@ class BugContestState
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class TimerDisplay # :nodoc:
|
||||
def initialize(start, maxtime)
|
||||
@timer = Window_AdvancedTextPokemon.newWithSize("", Graphics.width - 120, 0, 120, 64)
|
||||
@@ -247,8 +251,9 @@ class TimerDisplay # :nodoc:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
# Returns a score for this Pokemon in the Bug Catching Contest.
|
||||
# Not exactly the HGSS calculation, but it should be decent enough.
|
||||
def pbBugContestScore(pkmn)
|
||||
@@ -286,12 +291,18 @@ def pbBugContestDecided?
|
||||
return pbBugContestState.decided?
|
||||
end
|
||||
|
||||
EventHandlers.add(:on_enter_map, :end_bug_contest,
|
||||
proc { |_old_map_id|
|
||||
pbBugContestState.pbClearIfEnded
|
||||
}
|
||||
)
|
||||
def pbBugContestStartOver
|
||||
$player.party.each do |pkmn|
|
||||
pkmn.heal
|
||||
pkmn.makeUnmega
|
||||
pkmn.makeUnprimal
|
||||
end
|
||||
pbBugContestState.pbStartJudging
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
EventHandlers.add(:on_map_or_spriteset_change, :show_bug_contest_timer,
|
||||
proc { |scene, _map_changed|
|
||||
next if !pbInBugContest? || pbBugContestState.decision != 0 || BugContestState::TIME_ALLOWED == 0
|
||||
@@ -313,6 +324,12 @@ EventHandlers.add(:on_frame_update, :bug_contest_counter,
|
||||
}
|
||||
)
|
||||
|
||||
EventHandlers.add(:on_enter_map, :end_bug_contest,
|
||||
proc { |_old_map_id|
|
||||
pbBugContestState.pbClearIfEnded
|
||||
}
|
||||
)
|
||||
|
||||
EventHandlers.add(:on_leave_map, :end_bug_contest,
|
||||
proc { |new_map_id, new_map|
|
||||
next if !pbInBugContest? || !pbBugContestState.pbOffLimits?(new_map_id)
|
||||
@@ -321,15 +338,9 @@ EventHandlers.add(:on_leave_map, :end_bug_contest,
|
||||
}
|
||||
)
|
||||
|
||||
def pbBugContestStartOver
|
||||
$player.party.each do |pkmn|
|
||||
pkmn.heal
|
||||
pkmn.makeUnmega
|
||||
pkmn.makeUnprimal
|
||||
end
|
||||
pbBugContestState.pbStartJudging
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
EventHandlers.add(:on_calling_wild_battle, :bug_contest_battle,
|
||||
proc { |species, level, handled|
|
||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||
@@ -397,3 +408,40 @@ def pbBugContestBattle(species, level)
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return (decision != 2 && decision != 5)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPauseMenu
|
||||
alias __bug_contest_pbShowInfo pbShowInfo unless method_defined?(:__bug_contest_pbShowInfo)
|
||||
|
||||
def pbShowInfo
|
||||
__bug_contest_pbShowInfo
|
||||
return if !pbInBugContest?
|
||||
if pbBugContestState.lastPokemon
|
||||
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
|
||||
pbBugContestState.lastPokemon.speciesName,
|
||||
pbBugContestState.lastPokemon.level,
|
||||
pbBugContestState.ballcount))
|
||||
else
|
||||
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MenuHandlers.add(:pause_menu, :quit_bug_contest, {
|
||||
"name" => _INTL("Quit Contest"),
|
||||
"order" => 60,
|
||||
"condition" => proc { next pbInBugContest? },
|
||||
"effect" => proc { |menu|
|
||||
menu.pbHideMenu
|
||||
if pbConfirmMessage(_INTL("Would you like to end the Contest now?"))
|
||||
menu.pbEndScene
|
||||
pbBugContestState.pbStartJudging
|
||||
next true
|
||||
end
|
||||
menu.pbRefresh
|
||||
menu.pbShowMenu
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,11 +6,11 @@ class CommandMenuList
|
||||
|
||||
def initialize
|
||||
@commands = []
|
||||
@currentList = "main"
|
||||
@currentList = :main
|
||||
end
|
||||
|
||||
def add(option, hash)
|
||||
@commands.push([option, hash["parent"], hash["name"], hash["description"]])
|
||||
def add(option, hash, name = nil, description = nil)
|
||||
@commands.push([option, hash["parent"], name || hash["name"], description || hash["description"]])
|
||||
end
|
||||
|
||||
def list
|
||||
@@ -67,10 +67,18 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
def pbDebugMenu(show_all = true)
|
||||
# Get all commands
|
||||
commands = CommandMenuList.new
|
||||
DebugMenuCommands.each do |option, hash|
|
||||
commands.add(option, hash) if show_all || hash["always_show"]
|
||||
MenuHandlers.each_available(:debug_menu) do |option, hash, name|
|
||||
next if !show_all && !hash["always_show"].nil? && !hash["always_show"]
|
||||
if hash["description"].is_a?(Proc)
|
||||
description = hash["description"].call
|
||||
elsif !hash["description"].nil?
|
||||
description = _INTL(hash["description"])
|
||||
end
|
||||
commands.add(option, hash, name, description)
|
||||
end
|
||||
# Setup windows
|
||||
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
viewport.z = 99999
|
||||
sprites = {}
|
||||
@@ -86,6 +94,7 @@ def pbDebugMenu(show_all = true)
|
||||
cmdwindow.visible = true
|
||||
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
|
||||
pbFadeInAndShow(sprites)
|
||||
# Main loop
|
||||
ret = -1
|
||||
refresh = true
|
||||
loop do
|
||||
@@ -123,10 +132,10 @@ def pbDebugMenu(show_all = true)
|
||||
cmdwindow.commands = commands.list
|
||||
cmdwindow.index = 0
|
||||
refresh = true
|
||||
elsif cmd == "warp"
|
||||
return if DebugMenuCommands.call("effect", cmd, sprites, viewport)
|
||||
elsif cmd == :warp
|
||||
return if MenuHandlers.call(:debug_menu, cmd, "effect", sprites, viewport)
|
||||
else
|
||||
DebugMenuCommands.call("effect", cmd)
|
||||
MenuHandlers.call(:debug_menu, cmd, "effect")
|
||||
end
|
||||
end
|
||||
pbPlayCloseMenuSE
|
||||
@@ -141,27 +150,27 @@ end
|
||||
#===============================================================================
|
||||
module PokemonDebugMixin
|
||||
def pbPokemonDebug(pkmn, pkmnid, heldpoke = nil, settingUpBattle = false)
|
||||
command = 0
|
||||
# Get all commands
|
||||
commands = CommandMenuList.new
|
||||
PokemonDebugMenuCommands.each do |option, hash|
|
||||
commands.add(option, hash) if !settingUpBattle || hash["always_show"]
|
||||
MenuHandlers.each_available(:pokemon_debug_menu) do |option, hash, name|
|
||||
next if settingUpBattle && !hash["always_show"].nil? && !hash["always_show"]
|
||||
commands.add(option, hash, name)
|
||||
end
|
||||
# Main loop
|
||||
command = 0
|
||||
loop do
|
||||
command = pbShowCommands(_INTL("Do what with {1}?", pkmn.name), commands.list, command)
|
||||
if command < 0
|
||||
parent = commands.getParent
|
||||
if parent
|
||||
commands.currentList = parent[0]
|
||||
command = parent[1]
|
||||
else
|
||||
break
|
||||
end
|
||||
break if !parent
|
||||
commands.currentList = parent[0]
|
||||
command = parent[1]
|
||||
else
|
||||
cmd = commands.getCommand(command)
|
||||
if commands.hasSubMenu?(cmd)
|
||||
commands.currentList = cmd
|
||||
command = 0
|
||||
elsif PokemonDebugMenuCommands.call("effect", cmd, pkmn, pkmnid, heldpoke, settingUpBattle, self)
|
||||
elsif MenuHandlers.call(:pokemon_debug_menu, cmd, "effect", pkmn, pkmnid, heldpoke, settingUpBattle, self)
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -174,10 +183,18 @@ end
|
||||
#===============================================================================
|
||||
module Battle::DebugMixin
|
||||
def pbBattleDebug(battle, show_all = true)
|
||||
# Get all commands
|
||||
commands = CommandMenuList.new
|
||||
BattleDebugMenuCommands.each do |option, hash|
|
||||
commands.add(option, hash) if show_all || hash["always_show"]
|
||||
MenuHandlers.each_available(:battle_debug_menu) do |option, hash, name|
|
||||
next if !show_all && !hash["always_show"].nil? && !hash["always_show"]
|
||||
if hash["description"].is_a?(Proc)
|
||||
description = hash["description"].call
|
||||
elsif !hash["description"].nil?
|
||||
description = _INTL(hash["description"])
|
||||
end
|
||||
commands.add(option, hash, name, description)
|
||||
end
|
||||
# Setup windows
|
||||
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
viewport.z = 99999
|
||||
sprites = {}
|
||||
@@ -191,6 +208,7 @@ module Battle::DebugMixin
|
||||
cmdwindow.viewport = viewport
|
||||
cmdwindow.visible = true
|
||||
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
|
||||
# Main loop
|
||||
ret = -1
|
||||
refresh = true
|
||||
loop do
|
||||
@@ -229,7 +247,7 @@ module Battle::DebugMixin
|
||||
cmdwindow.index = 0
|
||||
refresh = true
|
||||
else
|
||||
BattleDebugMenuCommands.call("effect", cmd, battle)
|
||||
MenuHandlers.call(:battle_debug_menu, cmd, "effect", battle)
|
||||
end
|
||||
end
|
||||
pbPlayCloseMenuSE
|
||||
@@ -325,12 +343,14 @@ module Battle::DebugMixin
|
||||
end
|
||||
|
||||
def pbBattlePokemonDebug(pkmn, battler = nil)
|
||||
# Get all commands
|
||||
commands = CommandMenuList.new
|
||||
BattlePokemonDebugMenuCommands.each do |option, hash|
|
||||
MenuHandlers.each_available(:battle_pokemon_debug_menu) do |option, hash, name|
|
||||
next if battler && hash["usage"] == :pokemon
|
||||
next if !battler && hash["usage"] == :battler
|
||||
commands.add(option, hash)
|
||||
commands.add(option, hash, name)
|
||||
end
|
||||
# Setup windows
|
||||
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
viewport.z = 99999
|
||||
sprites = {}
|
||||
@@ -346,6 +366,7 @@ module Battle::DebugMixin
|
||||
sprites["dummywindow"].y = Graphics.height
|
||||
sprites["dummywindow"].width = Graphics.width
|
||||
sprites["dummywindow"].height = 0
|
||||
# Main loop
|
||||
need_refresh = true
|
||||
cmd = 0
|
||||
loop do
|
||||
@@ -373,7 +394,7 @@ module Battle::DebugMixin
|
||||
commands.currentList = real_cmd
|
||||
cmd = 0
|
||||
else
|
||||
BattlePokemonDebugMenuCommands.call("effect", real_cmd, pkmn, battler, self)
|
||||
MenuHandlers.call(:battle_pokemon_debug_menu, real_cmd, "effect", pkmn, battler, self)
|
||||
need_refresh = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,85 +1,46 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module DebugMenuCommands
|
||||
@@commands = HandlerHashBasic.new
|
||||
|
||||
def self.register(option, hash)
|
||||
@@commands.add(option, hash)
|
||||
end
|
||||
|
||||
def self.registerIf(condition, hash)
|
||||
@@commands.addIf(condition, hash)
|
||||
end
|
||||
|
||||
def self.copy(option, *new_options)
|
||||
@@commands.copy(option, *new_options)
|
||||
end
|
||||
|
||||
def self.each
|
||||
@@commands.each { |key, hash| yield key, hash }
|
||||
end
|
||||
|
||||
def self.hasFunction?(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return option_hash&.has_key?(function)
|
||||
end
|
||||
|
||||
def self.getFunction(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return (option_hash && option_hash[function]) ? option_hash[function] : nil
|
||||
end
|
||||
|
||||
def self.call(function, option, *args)
|
||||
option_hash = @@commands[option]
|
||||
return nil if !option_hash || !option_hash[function]
|
||||
return (option_hash[function].call(*args) == true)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Field options
|
||||
#===============================================================================
|
||||
DebugMenuCommands.register("field_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Field options..."),
|
||||
"description" => _INTL("Warp to maps, edit switches/variables, use the PC, edit Day Care, etc.")
|
||||
MenuHandlers.add(:debug_menu, :field_menu, {
|
||||
"name" => _INTL("Field Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Warp to maps, edit switches/variables, use the PC, edit Day Care, etc."),
|
||||
"always_show" => false
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("warp", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :warp, {
|
||||
"name" => _INTL("Warp to Map"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Instantly warp to another map of your choice."),
|
||||
"effect" => proc { |sprites, viewport|
|
||||
map = pbWarpToMap
|
||||
if map
|
||||
pbFadeOutAndHide(sprites)
|
||||
pbDisposeMessageWindow(sprites["textbox"])
|
||||
pbDisposeSpriteHash(sprites)
|
||||
viewport.dispose
|
||||
if $scene.is_a?(Scene_Map)
|
||||
$game_temp.player_new_map_id = map[0]
|
||||
$game_temp.player_new_x = map[1]
|
||||
$game_temp.player_new_y = map[2]
|
||||
$game_temp.player_new_direction = 2
|
||||
$scene.transfer_player
|
||||
else
|
||||
pbCancelVehicles
|
||||
$map_factory.setup(map[0])
|
||||
$game_player.moveto(map[1], map[2])
|
||||
$game_player.turn_down
|
||||
$game_map.update
|
||||
$game_map.autoplay
|
||||
end
|
||||
$game_map.refresh
|
||||
next true # Closes the debug menu to allow the warp
|
||||
next false if !map
|
||||
pbFadeOutAndHide(sprites)
|
||||
pbDisposeMessageWindow(sprites["textbox"])
|
||||
pbDisposeSpriteHash(sprites)
|
||||
viewport.dispose
|
||||
if $scene.is_a?(Scene_Map)
|
||||
$game_temp.player_new_map_id = map[0]
|
||||
$game_temp.player_new_x = map[1]
|
||||
$game_temp.player_new_y = map[2]
|
||||
$game_temp.player_new_direction = 2
|
||||
$scene.transfer_player
|
||||
else
|
||||
pbCancelVehicles
|
||||
$map_factory.setup(map[0])
|
||||
$game_player.moveto(map[1], map[2])
|
||||
$game_player.turn_down
|
||||
$game_map.update
|
||||
$game_map.autoplay
|
||||
end
|
||||
$game_map.refresh
|
||||
next true # Closes the debug menu to allow the warp
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("refresh_map", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :refresh_map, {
|
||||
"name" => _INTL("Refresh Map"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Make all events on this map, and common events, refresh themselves."),
|
||||
"effect" => proc {
|
||||
$game_map.need_refresh = true
|
||||
@@ -87,36 +48,36 @@ DebugMenuCommands.register("refresh_map", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("switches", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :switches, {
|
||||
"name" => _INTL("Switches"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Edit all Game Switches (except Script Switches)."),
|
||||
"effect" => proc {
|
||||
pbDebugVariables(0)
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("variables", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :variables, {
|
||||
"name" => _INTL("Variables"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Edit all Game Variables. Can set them to numbers or text."),
|
||||
"effect" => proc {
|
||||
pbDebugVariables(1)
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("use_pc", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :use_pc, {
|
||||
"name" => _INTL("Use PC"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Use a PC to access Pokémon storage and player's PC."),
|
||||
"effect" => proc {
|
||||
pbPokeCenterPC
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("toggle_wallpapers", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :storage_wallpapers, {
|
||||
"name" => _INTL("Toggle Storage Wallpapers"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Unlock and lock special wallpapers used in Pokémon storage."),
|
||||
"effect" => proc {
|
||||
w = $PokemonStorage.allWallpapers
|
||||
@@ -152,18 +113,18 @@ DebugMenuCommands.register("toggle_wallpapers", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("day_care", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :day_care, {
|
||||
"name" => _INTL("Day Care"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("View Pokémon in the Day Care and edit them."),
|
||||
"effect" => proc {
|
||||
pbDebugDayCare
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("skip_credits", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :skip_credits, {
|
||||
"name" => _INTL("Skip Credits"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Toggle whether credits can be ended early by pressing the Use input."),
|
||||
"effect" => proc {
|
||||
$PokemonGlobal.creditsPlayed = !$PokemonGlobal.creditsPlayed
|
||||
@@ -172,18 +133,18 @@ DebugMenuCommands.register("skip_credits", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("relic_stone", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :relic_stone, {
|
||||
"name" => _INTL("Use Relic Stone"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Shadow Pokémon. Choose a Pokémon to show to the Relic Stone for purification."),
|
||||
"effect" => proc {
|
||||
pbRelicStone
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("purify_chamber", {
|
||||
"parent" => "field_menu",
|
||||
MenuHandlers.add(:debug_menu, :purify_chamber, {
|
||||
"name" => _INTL("Use Purify Chamber"),
|
||||
"parent" => :field_menu,
|
||||
"description" => _INTL("Shadow Pokémon. Open the Purify Chamber for purification."),
|
||||
"effect" => proc {
|
||||
pbPurifyChamber
|
||||
@@ -193,15 +154,16 @@ DebugMenuCommands.register("purify_chamber", {
|
||||
#===============================================================================
|
||||
# Battle options
|
||||
#===============================================================================
|
||||
DebugMenuCommands.register("battle_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Battle options..."),
|
||||
"description" => _INTL("Start battles, reset this map's trainers, ready rematches, edit roamers, etc.")
|
||||
MenuHandlers.add(:debug_menu, :battle_menu, {
|
||||
"name" => _INTL("Battle Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Start battles, reset this map's trainers, ready rematches, edit roamers, etc."),
|
||||
"always_show" => false
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("test_wild_battle", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :test_wild_battle, {
|
||||
"name" => _INTL("Test Wild Battle"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Start a single battle against a wild Pokémon. You choose the species/level."),
|
||||
"effect" => proc {
|
||||
species = pbChooseSpeciesList
|
||||
@@ -221,9 +183,9 @@ DebugMenuCommands.register("test_wild_battle", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("test_wild_battle_advanced", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :test_wild_battle_advanced, {
|
||||
"name" => _INTL("Test Wild Battle Advanced"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Start a battle against 1 or more wild Pokémon. Battle size is your choice."),
|
||||
"effect" => proc {
|
||||
pkmn = []
|
||||
@@ -285,9 +247,9 @@ DebugMenuCommands.register("test_wild_battle_advanced", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("test_trainer_battle", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :test_trainer_battle, {
|
||||
"name" => _INTL("Test Trainer Battle"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Start a single battle against a trainer of your choice."),
|
||||
"effect" => proc {
|
||||
trainerdata = pbListScreen(_INTL("SINGLE TRAINER"), TrainerBattleLister.new(0, false))
|
||||
@@ -298,9 +260,9 @@ DebugMenuCommands.register("test_trainer_battle", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("test_trainer_battle_advanced", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :test_trainer_battle_advanced, {
|
||||
"name" => _INTL("Test Trainer Battle Advanced"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Start a battle against 1 or more trainers with a battle size of your choice."),
|
||||
"effect" => proc {
|
||||
trainers = []
|
||||
@@ -389,9 +351,9 @@ DebugMenuCommands.register("test_trainer_battle_advanced", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("toggle_logging", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :toggle_logging, {
|
||||
"name" => _INTL("Toggle Battle Logging"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Record debug logs for battles in Data/debuglog.txt."),
|
||||
"effect" => proc {
|
||||
$INTERNAL = !$INTERNAL
|
||||
@@ -400,9 +362,9 @@ DebugMenuCommands.register("toggle_logging", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("reset_trainers", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :reset_trainers, {
|
||||
"name" => _INTL("Reset Map's Trainers"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Turn off Self Switches A and B for all events with \"Trainer\" in their name."),
|
||||
"effect" => proc {
|
||||
if $game_map
|
||||
@@ -420,9 +382,9 @@ DebugMenuCommands.register("reset_trainers", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("ready_rematches", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :ready_rematches, {
|
||||
"name" => _INTL("Ready All Phone Rematches"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Make all trainers in the phone ready for rematches."),
|
||||
"effect" => proc {
|
||||
if !$PokemonGlobal.phoneNumbers || $PokemonGlobal.phoneNumbers.length == 0
|
||||
@@ -438,18 +400,18 @@ DebugMenuCommands.register("ready_rematches", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("roamers", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :roamers, {
|
||||
"name" => _INTL("Roaming Pokémon"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Toggle and edit all roaming Pokémon."),
|
||||
"effect" => proc {
|
||||
pbDebugRoamers
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("encounter_version", {
|
||||
"parent" => "battle_menu",
|
||||
MenuHandlers.add(:debug_menu, :encounter_version, {
|
||||
"name" => _INTL("Set Encounters Version"),
|
||||
"parent" => :battle_menu,
|
||||
"description" => _INTL("Choose which version of wild encounters should be used."),
|
||||
"effect" => proc {
|
||||
params = ChooseNumberParams.new
|
||||
@@ -466,15 +428,16 @@ DebugMenuCommands.register("encounter_version", {
|
||||
#===============================================================================
|
||||
# Item options
|
||||
#===============================================================================
|
||||
DebugMenuCommands.register("items_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Item options..."),
|
||||
"description" => _INTL("Give and take items.")
|
||||
MenuHandlers.add(:debug_menu, :items_menu, {
|
||||
"name" => _INTL("Item Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Give and take items."),
|
||||
"always_show" => false
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("add_item", {
|
||||
"parent" => "items_menu",
|
||||
MenuHandlers.add(:debug_menu, :add_item, {
|
||||
"name" => _INTL("Add Item"),
|
||||
"parent" => :items_menu,
|
||||
"description" => _INTL("Choose an item and a quantity of it to add to the Bag."),
|
||||
"effect" => proc {
|
||||
pbListScreenBlock(_INTL("ADD ITEM"), ItemLister.new) { |button, item|
|
||||
@@ -494,9 +457,9 @@ DebugMenuCommands.register("add_item", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("fill_bag", {
|
||||
"parent" => "items_menu",
|
||||
MenuHandlers.add(:debug_menu, :fill_bag, {
|
||||
"name" => _INTL("Fill Bag"),
|
||||
"parent" => :items_menu,
|
||||
"description" => _INTL("Empties the Bag and then fills it with a certain number of every item."),
|
||||
"effect" => proc {
|
||||
params = ChooseNumberParams.new
|
||||
@@ -523,9 +486,9 @@ DebugMenuCommands.register("fill_bag", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("empty_bag", {
|
||||
"parent" => "items_menu",
|
||||
MenuHandlers.add(:debug_menu, :empty_bag, {
|
||||
"name" => _INTL("Empty Bag"),
|
||||
"parent" => :items_menu,
|
||||
"description" => _INTL("Remove all items from the Bag."),
|
||||
"effect" => proc {
|
||||
$bag.clear
|
||||
@@ -536,15 +499,16 @@ DebugMenuCommands.register("empty_bag", {
|
||||
#===============================================================================
|
||||
# Pokémon options
|
||||
#===============================================================================
|
||||
DebugMenuCommands.register("pokemon_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Pokémon options..."),
|
||||
"description" => _INTL("Give Pokémon, heal party, fill/empty PC storage, etc.")
|
||||
MenuHandlers.add(:debug_menu, :pokemon_menu, {
|
||||
"name" => _INTL("Pokémon Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Give Pokémon, heal party, fill/empty PC storage, etc."),
|
||||
"always_show" => false
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("add_pokemon", {
|
||||
"parent" => "pokemon_menu",
|
||||
MenuHandlers.add(:debug_menu, :add_pokemon, {
|
||||
"name" => _INTL("Add Pokémon"),
|
||||
"parent" => :pokemon_menu,
|
||||
"description" => _INTL("Give yourself a Pokémon of a chosen species/level. Goes to PC if party is full."),
|
||||
"effect" => proc {
|
||||
species = pbChooseSpeciesList
|
||||
@@ -559,9 +523,9 @@ DebugMenuCommands.register("add_pokemon", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("give_demo_party", {
|
||||
"parent" => "pokemon_menu",
|
||||
MenuHandlers.add(:debug_menu, :give_demo_party, {
|
||||
"name" => _INTL("Give Demo Party"),
|
||||
"parent" => :pokemon_menu,
|
||||
"description" => _INTL("Give yourself 6 preset Pokémon. They overwrite the current party."),
|
||||
"effect" => proc {
|
||||
party = []
|
||||
@@ -602,9 +566,9 @@ DebugMenuCommands.register("give_demo_party", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("heal_party", {
|
||||
"parent" => "pokemon_menu",
|
||||
MenuHandlers.add(:debug_menu, :heal_party, {
|
||||
"name" => _INTL("Heal Party"),
|
||||
"parent" => :pokemon_menu,
|
||||
"description" => _INTL("Fully heal the HP/status/PP of all Pokémon in the party."),
|
||||
"effect" => proc {
|
||||
$player.party.each { |pkmn| pkmn.heal }
|
||||
@@ -612,9 +576,9 @@ DebugMenuCommands.register("heal_party", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("quick_hatch_party_eggs", {
|
||||
"parent" => "pokemon_menu",
|
||||
MenuHandlers.add(:debug_menu, :quick_hatch_party_eggs, {
|
||||
"name" => _INTL("Quick Hatch"),
|
||||
"parent" => :pokemon_menu,
|
||||
"description" => _INTL("Make all eggs in the party require just one more step to hatch."),
|
||||
"effect" => proc {
|
||||
$player.party.each { |pkmn| pkmn.steps_to_hatch = 1 if pkmn.egg? }
|
||||
@@ -622,9 +586,9 @@ DebugMenuCommands.register("quick_hatch_party_eggs", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("fill_boxes", {
|
||||
"parent" => "pokemon_menu",
|
||||
MenuHandlers.add(:debug_menu, :fill_boxes, {
|
||||
"name" => _INTL("Fill Storage Boxes"),
|
||||
"parent" => :pokemon_menu,
|
||||
"description" => _INTL("Add one Pokémon of each species (at Level 50) to storage."),
|
||||
"effect" => proc {
|
||||
added = 0
|
||||
@@ -669,9 +633,9 @@ DebugMenuCommands.register("fill_boxes", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("clear_boxes", {
|
||||
"parent" => "pokemon_menu",
|
||||
MenuHandlers.add(:debug_menu, :clear_boxes, {
|
||||
"name" => _INTL("Clear Storage Boxes"),
|
||||
"parent" => :pokemon_menu,
|
||||
"description" => _INTL("Remove all Pokémon in storage."),
|
||||
"effect" => proc {
|
||||
$PokemonStorage.maxBoxes.times do |i|
|
||||
@@ -683,9 +647,9 @@ DebugMenuCommands.register("clear_boxes", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("open_storage", {
|
||||
"parent" => "pokemon_menu",
|
||||
MenuHandlers.add(:debug_menu, :open_storage, {
|
||||
"name" => _INTL("Access Pokémon Storage"),
|
||||
"parent" => :pokemon_menu,
|
||||
"description" => _INTL("Opens the Pokémon storage boxes in Organize Boxes mode."),
|
||||
"effect" => proc {
|
||||
pbFadeOutIn {
|
||||
@@ -699,15 +663,16 @@ DebugMenuCommands.register("open_storage", {
|
||||
#===============================================================================
|
||||
# Player options
|
||||
#===============================================================================
|
||||
DebugMenuCommands.register("player_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Player options..."),
|
||||
"description" => _INTL("Set money, badges, Pokédexes, player's appearance and name, etc.")
|
||||
MenuHandlers.add(:debug_menu, :player_menu, {
|
||||
"name" => _INTL("Player Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Set money, badges, Pokédexes, player's appearance and name, etc."),
|
||||
"always_show" => false
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_badges", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_badges, {
|
||||
"name" => _INTL("Set Badges"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Toggle possession of each Gym Badge."),
|
||||
"effect" => proc {
|
||||
badgecmd = 0
|
||||
@@ -732,9 +697,9 @@ DebugMenuCommands.register("set_badges", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_money", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_money, {
|
||||
"name" => _INTL("Set Money"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Edit how much money you have."),
|
||||
"effect" => proc {
|
||||
params = ChooseNumberParams.new
|
||||
@@ -745,9 +710,9 @@ DebugMenuCommands.register("set_money", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_coins", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_coins, {
|
||||
"name" => _INTL("Set Coins"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Edit how many Game Corner Coins you have."),
|
||||
"effect" => proc {
|
||||
params = ChooseNumberParams.new
|
||||
@@ -758,9 +723,9 @@ DebugMenuCommands.register("set_coins", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_bp", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_bp, {
|
||||
"name" => _INTL("Set Battle Points"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Edit how many Battle Points you have."),
|
||||
"effect" => proc {
|
||||
params = ChooseNumberParams.new
|
||||
@@ -771,9 +736,9 @@ DebugMenuCommands.register("set_bp", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("toggle_running_shoes", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :toggle_running_shoes, {
|
||||
"name" => _INTL("Toggle Running Shoes"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Toggle possession of running shoes."),
|
||||
"effect" => proc {
|
||||
$player.has_running_shoes = !$player.has_running_shoes
|
||||
@@ -782,9 +747,9 @@ DebugMenuCommands.register("toggle_running_shoes", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("toggle_pokegear", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :toggle_pokegear, {
|
||||
"name" => _INTL("Toggle Pokégear"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Toggle possession of the Pokégear."),
|
||||
"effect" => proc {
|
||||
$player.has_pokegear = !$player.has_pokegear
|
||||
@@ -793,9 +758,9 @@ DebugMenuCommands.register("toggle_pokegear", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("toggle_pokedex", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :toggle_pokedex, {
|
||||
"name" => _INTL("Toggle Pokédex and Dexes"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Toggle possession of the Pokédex, and edit Regional Dex accessibility."),
|
||||
"effect" => proc {
|
||||
dexescmd = 0
|
||||
@@ -822,9 +787,9 @@ DebugMenuCommands.register("toggle_pokedex", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_player_character", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_player_character, {
|
||||
"name" => _INTL("Set Player Character"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Edit the player's character, as defined in \"metadata.txt\"."),
|
||||
"effect" => proc {
|
||||
index = 0
|
||||
@@ -847,9 +812,9 @@ DebugMenuCommands.register("set_player_character", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("change_outfit", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :change_outfit, {
|
||||
"name" => _INTL("Set Player Outfit"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Edit the player's outfit number."),
|
||||
"effect" => proc {
|
||||
oldoutfit = $player.outfit
|
||||
@@ -861,9 +826,9 @@ DebugMenuCommands.register("change_outfit", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("rename_player", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :rename_player, {
|
||||
"name" => _INTL("Set Player Name"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Rename the player."),
|
||||
"effect" => proc {
|
||||
trname = pbEnterPlayerName("Your name?", 0, Settings::MAX_PLAYER_NAME_SIZE, $player.name)
|
||||
@@ -881,9 +846,9 @@ DebugMenuCommands.register("rename_player", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("random_id", {
|
||||
"parent" => "player_menu",
|
||||
MenuHandlers.add(:debug_menu, :random_id, {
|
||||
"name" => _INTL("Randomize Player ID"),
|
||||
"parent" => :player_menu,
|
||||
"description" => _INTL("Generate a random new ID for the player."),
|
||||
"effect" => proc {
|
||||
$player.id = rand(2**16) | (rand(2**16) << 16)
|
||||
@@ -894,118 +859,106 @@ DebugMenuCommands.register("random_id", {
|
||||
#===============================================================================
|
||||
# Information editors
|
||||
#===============================================================================
|
||||
DebugMenuCommands.register("editors_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Information editors..."),
|
||||
"description" => _INTL("Edit information in the PBS files, terrain tags, battle animations, etc."),
|
||||
"always_show" => true
|
||||
MenuHandlers.add(:debug_menu, :editors_menu, {
|
||||
"name" => _INTL("Information Editors..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Edit information in the PBS files, terrain tags, battle animations, etc.")
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_metadata", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_metadata, {
|
||||
"name" => _INTL("Edit Metadata"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit global metadata and player character metadata."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbMetadataScreen
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_map_metadata", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_map_metadata, {
|
||||
"name" => _INTL("Edit Map Metadata"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit map metadata."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbMapMetadataScreen(pbDefaultMap)
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_map_connections", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_map_connections, {
|
||||
"name" => _INTL("Edit Map Connections"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Connect maps using a visual interface. Can also edit map encounters/metadata."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbConnectionsEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_terrain_tags", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_terrain_tags, {
|
||||
"name" => _INTL("Edit Terrain Tags"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit the terrain tags of tiles in tilesets. Required for tags 8+."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbTilesetScreen }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_encounters", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_encounters, {
|
||||
"name" => _INTL("Edit Wild Encounters"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit the wild Pokémon that can be found on maps, and how they are encountered."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbEncountersEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_trainer_types", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_trainer_types, {
|
||||
"name" => _INTL("Edit Trainer Types"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit the properties of trainer types."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbTrainerTypeEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_trainers", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_trainers, {
|
||||
"name" => _INTL("Edit Individual Trainers"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit individual trainers, their Pokémon and items."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbTrainerBattleEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_items", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_items, {
|
||||
"name" => _INTL("Edit Items"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit item data."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbItemEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_species", {
|
||||
"parent" => "editors_menu",
|
||||
"name" => _INTL("Edit Pokémon"),
|
||||
MenuHandlers.add(:debug_menu, :set_species, {
|
||||
"name" => _INTL("Edit Pokémon Species"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit Pokémon species data."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbPokemonEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("set_pokedex_lists", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :set_pokedex_lists, {
|
||||
"name" => _INTL("Edit Regional Dexes"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Create, rearrange and delete Regional Pokédex lists."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbRegionalDexEditorMain }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("position_sprites", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :position_sprites, {
|
||||
"name" => _INTL("Edit Pokémon Sprite Positions"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Reposition Pokémon sprites in battle."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn {
|
||||
sp = SpritePositioner.new
|
||||
@@ -1015,11 +968,10 @@ DebugMenuCommands.register("position_sprites", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("auto_position_sprites", {
|
||||
"parent" => "editors_menu",
|
||||
"name" => _INTL("Auto-Position All Sprites"),
|
||||
MenuHandlers.add(:debug_menu, :auto_position_sprites, {
|
||||
"name" => _INTL("Auto-Position All Pokémon Sprites"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Automatically reposition all Pokémon sprites in battle. Don't use lightly."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to reposition all sprites?"))
|
||||
msgwindow = pbCreateMessageWindow
|
||||
@@ -1031,41 +983,37 @@ DebugMenuCommands.register("auto_position_sprites", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("animation_editor", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :animation_editor, {
|
||||
"name" => _INTL("Battle Animation Editor"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Edit the battle animations."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbAnimationEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("animation_organiser", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :animation_organiser, {
|
||||
"name" => _INTL("Battle Animation Organiser"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Rearrange/add/delete battle animations."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbAnimationsOrganiser }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("import_animations", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :import_animations, {
|
||||
"name" => _INTL("Import All Battle Animations"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Import all battle animations from the \"Animations\" folder."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbImportAllAnimations
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("export_animations", {
|
||||
"parent" => "editors_menu",
|
||||
MenuHandlers.add(:debug_menu, :export_animations, {
|
||||
"name" => _INTL("Export All Battle Animations"),
|
||||
"parent" => :editors_menu,
|
||||
"description" => _INTL("Export all battle animations individually to the \"Animations\" folder."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbExportAllAnimations
|
||||
}
|
||||
@@ -1074,48 +1022,43 @@ DebugMenuCommands.register("export_animations", {
|
||||
#===============================================================================
|
||||
# Other options
|
||||
#===============================================================================
|
||||
DebugMenuCommands.register("other_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Other options..."),
|
||||
"description" => _INTL("Mystery Gifts, translations, compile data, etc."),
|
||||
"always_show" => true
|
||||
MenuHandlers.add(:debug_menu, :other_menu, {
|
||||
"name" => _INTL("Other Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Mystery Gifts, translations, compile data, etc.")
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("mystery_gift", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :mystery_gift, {
|
||||
"name" => _INTL("Manage Mystery Gifts"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Edit and enable/disable Mystery Gifts."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbManageMysteryGifts
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("extract_text", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :extract_text, {
|
||||
"name" => _INTL("Extract Text"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Extract all text in the game to a single file for translating."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbExtractText
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("compile_text", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :compile_text, {
|
||||
"name" => _INTL("Compile Text"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Import text and converts it into a language file."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbCompileTextUI
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("compile_data", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :compile_data, {
|
||||
"name" => _INTL("Compile Data"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Fully compile all data."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
msgwindow = pbCreateMessageWindow
|
||||
Compiler.compile_all(true)
|
||||
@@ -1124,11 +1067,10 @@ DebugMenuCommands.register("compile_data", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("create_pbs_files", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :create_pbs_files, {
|
||||
"name" => _INTL("Create PBS File(s)"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Choose one or all PBS files and create it."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
cmd = 0
|
||||
cmds = [
|
||||
@@ -1185,21 +1127,19 @@ DebugMenuCommands.register("create_pbs_files", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("fix_invalid_tiles", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :fix_invalid_tiles, {
|
||||
"name" => _INTL("Fix Invalid Tiles"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Scans all maps and erases non-existent tiles."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbDebugFixInvalidTiles
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("rename_files", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :rename_files, {
|
||||
"name" => _INTL("Rename Outdated Files"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Check for files with outdated names and rename/move them. Can alter map data."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to automatically rename outdated files?"))
|
||||
FilenameUpdater.rename_files
|
||||
@@ -1208,11 +1148,10 @@ DebugMenuCommands.register("rename_files", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("reload_system_cache", {
|
||||
"parent" => "other_menu",
|
||||
MenuHandlers.add(:debug_menu, :reload_system_cache, {
|
||||
"name" => _INTL("Reload System Cache"),
|
||||
"parent" => :other_menu,
|
||||
"description" => _INTL("Refreshes the system's file cache. Use if you change a file while playing."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
System.reload_cache
|
||||
pbMessage(_INTL("Done."))
|
||||
|
||||
@@ -1,56 +1,15 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module PokemonDebugMenuCommands
|
||||
@@commands = HandlerHashBasic.new
|
||||
|
||||
def self.register(option, hash)
|
||||
@@commands.add(option, hash)
|
||||
end
|
||||
|
||||
def self.registerIf(condition, hash)
|
||||
@@commands.addIf(condition, hash)
|
||||
end
|
||||
|
||||
def self.copy(option, *new_options)
|
||||
@@commands.copy(option, *new_options)
|
||||
end
|
||||
|
||||
def self.each
|
||||
@@commands.each { |key, hash| yield key, hash }
|
||||
end
|
||||
|
||||
def self.hasFunction?(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return option_hash&.has_key?(function)
|
||||
end
|
||||
|
||||
def self.getFunction(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return (option_hash && option_hash[function]) ? option_hash[function] : nil
|
||||
end
|
||||
|
||||
def self.call(function, option, *args)
|
||||
option_hash = @@commands[option]
|
||||
return nil if !option_hash || !option_hash[function]
|
||||
return (option_hash[function].call(*args) == true)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# HP/Status options
|
||||
#===============================================================================
|
||||
PokemonDebugMenuCommands.register("hp_status_menu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("HP/Status..."),
|
||||
"always_show" => true
|
||||
MenuHandlers.add(:pokemon_debug_menu, :hp_status_menu, {
|
||||
"name" => _INTL("HP/Status..."),
|
||||
"parent" => :main
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_hp", {
|
||||
"parent" => "hp_status_menu",
|
||||
"name" => _INTL("Set HP"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_hp, {
|
||||
"name" => _INTL("Set HP"),
|
||||
"parent" => :hp_status_menu,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if pkmn.egg?
|
||||
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
||||
else
|
||||
@@ -69,11 +28,10 @@ PokemonDebugMenuCommands.register("set_hp", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_status", {
|
||||
"parent" => "hp_status_menu",
|
||||
"name" => _INTL("Set status"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_status, {
|
||||
"name" => _INTL("Set status"),
|
||||
"parent" => :hp_status_menu,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if pkmn.egg?
|
||||
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
||||
elsif pkmn.hp <= 0
|
||||
@@ -123,11 +81,10 @@ PokemonDebugMenuCommands.register("set_status", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("full_heal", {
|
||||
"parent" => "hp_status_menu",
|
||||
"name" => _INTL("Fully heal"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :full_heal, {
|
||||
"name" => _INTL("Fully heal"),
|
||||
"parent" => :hp_status_menu,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if pkmn.egg?
|
||||
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
||||
else
|
||||
@@ -139,11 +96,10 @@ PokemonDebugMenuCommands.register("full_heal", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("make_fainted", {
|
||||
"parent" => "hp_status_menu",
|
||||
"name" => _INTL("Make fainted"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :make_fainted, {
|
||||
"name" => _INTL("Make fainted"),
|
||||
"parent" => :hp_status_menu,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if pkmn.egg?
|
||||
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
||||
else
|
||||
@@ -154,11 +110,10 @@ PokemonDebugMenuCommands.register("make_fainted", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_pokerus", {
|
||||
"parent" => "hp_status_menu",
|
||||
"name" => _INTL("Set Pokérus"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_pokerus, {
|
||||
"name" => _INTL("Set Pokérus"),
|
||||
"parent" => :hp_status_menu,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
pokerus = (pkmn.pokerus) ? pkmn.pokerus : 0
|
||||
@@ -193,17 +148,15 @@ PokemonDebugMenuCommands.register("set_pokerus", {
|
||||
#===============================================================================
|
||||
# Level/stats options
|
||||
#===============================================================================
|
||||
PokemonDebugMenuCommands.register("level_stats", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Level/stats..."),
|
||||
"always_show" => true
|
||||
MenuHandlers.add(:pokemon_debug_menu, :level_stats, {
|
||||
"name" => _INTL("Level/stats..."),
|
||||
"parent" => :main
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_level", {
|
||||
"parent" => "level_stats",
|
||||
"name" => _INTL("Set level"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_level, {
|
||||
"name" => _INTL("Set level"),
|
||||
"parent" => :level_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if pkmn.egg?
|
||||
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
||||
else
|
||||
@@ -223,11 +176,10 @@ PokemonDebugMenuCommands.register("set_level", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_exp", {
|
||||
"parent" => "level_stats",
|
||||
"name" => _INTL("Set Exp"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_exp, {
|
||||
"name" => _INTL("Set Exp"),
|
||||
"parent" => :level_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if pkmn.egg?
|
||||
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
|
||||
else
|
||||
@@ -253,11 +205,10 @@ PokemonDebugMenuCommands.register("set_exp", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("hidden_values", {
|
||||
"parent" => "level_stats",
|
||||
"name" => _INTL("EV/IV/pID..."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :hidden_values, {
|
||||
"name" => _INTL("EV/IV/pID..."),
|
||||
"parent" => :level_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
persid = sprintf("0x%08X", pkmn.personalID)
|
||||
@@ -367,11 +318,10 @@ PokemonDebugMenuCommands.register("hidden_values", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_happiness", {
|
||||
"parent" => "level_stats",
|
||||
"name" => _INTL("Set happiness"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_happiness, {
|
||||
"name" => _INTL("Set happiness"),
|
||||
"parent" => :level_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 255)
|
||||
params.setDefaultValue(pkmn.happiness)
|
||||
@@ -386,17 +336,15 @@ PokemonDebugMenuCommands.register("set_happiness", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("contest_stats", {
|
||||
"parent" => "level_stats",
|
||||
"name" => _INTL("Contest stats..."),
|
||||
"always_show" => true
|
||||
MenuHandlers.add(:pokemon_debug_menu, :contest_stats, {
|
||||
"name" => _INTL("Contest stats..."),
|
||||
"parent" => :level_stats
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_beauty", {
|
||||
"parent" => "contest_stats",
|
||||
"name" => _INTL("Set Beauty"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_beauty, {
|
||||
"name" => _INTL("Set Beauty"),
|
||||
"parent" => :contest_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 255)
|
||||
params.setDefaultValue(pkmn.beauty)
|
||||
@@ -411,11 +359,10 @@ PokemonDebugMenuCommands.register("set_beauty", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_cool", {
|
||||
"parent" => "contest_stats",
|
||||
"name" => _INTL("Set Cool"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_cool, {
|
||||
"name" => _INTL("Set Cool"),
|
||||
"parent" => :contest_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 255)
|
||||
params.setDefaultValue(pkmn.cool)
|
||||
@@ -430,11 +377,10 @@ PokemonDebugMenuCommands.register("set_cool", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_cute", {
|
||||
"parent" => "contest_stats",
|
||||
"name" => _INTL("Set Cute"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_cute, {
|
||||
"name" => _INTL("Set Cute"),
|
||||
"parent" => :contest_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 255)
|
||||
params.setDefaultValue(pkmn.cute)
|
||||
@@ -449,11 +395,10 @@ PokemonDebugMenuCommands.register("set_cute", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_smart", {
|
||||
"parent" => "contest_stats",
|
||||
"name" => _INTL("Set Smart"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_smart, {
|
||||
"name" => _INTL("Set Smart"),
|
||||
"parent" => :contest_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 255)
|
||||
params.setDefaultValue(pkmn.smart)
|
||||
@@ -468,11 +413,10 @@ PokemonDebugMenuCommands.register("set_smart", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_tough", {
|
||||
"parent" => "contest_stats",
|
||||
"name" => _INTL("Set Tough"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_tough, {
|
||||
"name" => _INTL("Set Tough"),
|
||||
"parent" => :contest_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 255)
|
||||
params.setDefaultValue(pkmn.tough)
|
||||
@@ -487,11 +431,10 @@ PokemonDebugMenuCommands.register("set_tough", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_sheen", {
|
||||
"parent" => "contest_stats",
|
||||
"name" => _INTL("Set Sheen"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_sheen, {
|
||||
"name" => _INTL("Set Sheen"),
|
||||
"parent" => :contest_stats,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 255)
|
||||
params.setDefaultValue(pkmn.sheen)
|
||||
@@ -509,17 +452,15 @@ PokemonDebugMenuCommands.register("set_sheen", {
|
||||
#===============================================================================
|
||||
# Moves options
|
||||
#===============================================================================
|
||||
PokemonDebugMenuCommands.register("moves", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Moves..."),
|
||||
"always_show" => true
|
||||
MenuHandlers.add(:pokemon_debug_menu, :moves, {
|
||||
"name" => _INTL("Moves..."),
|
||||
"parent" => :main
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("teach_move", {
|
||||
"parent" => "moves",
|
||||
"name" => _INTL("Teach move"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :teach_move, {
|
||||
"name" => _INTL("Teach move"),
|
||||
"parent" => :moves,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
move = pbChooseMoveList
|
||||
if move
|
||||
pbLearnMove(pkmn, move)
|
||||
@@ -529,11 +470,10 @@ PokemonDebugMenuCommands.register("teach_move", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("forget_move", {
|
||||
"parent" => "moves",
|
||||
"name" => _INTL("Forget move"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :forget_move, {
|
||||
"name" => _INTL("Forget move"),
|
||||
"parent" => :moves,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
moveindex = screen.pbChooseMove(pkmn, _INTL("Choose move to forget."))
|
||||
if moveindex >= 0
|
||||
movename = pkmn.moves[moveindex].name
|
||||
@@ -545,11 +485,10 @@ PokemonDebugMenuCommands.register("forget_move", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("reset_moves", {
|
||||
"parent" => "moves",
|
||||
"name" => _INTL("Reset moves"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :reset_moves, {
|
||||
"name" => _INTL("Reset moves"),
|
||||
"parent" => :moves,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
pkmn.reset_moves
|
||||
screen.pbDisplay(_INTL("{1}'s moves were reset.", pkmn.name))
|
||||
screen.pbRefreshSingle(pkmnid)
|
||||
@@ -557,11 +496,10 @@ PokemonDebugMenuCommands.register("reset_moves", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_move_pp", {
|
||||
"parent" => "moves",
|
||||
"name" => _INTL("Set move PP"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_move_pp, {
|
||||
"name" => _INTL("Set move PP"),
|
||||
"parent" => :moves,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
commands = []
|
||||
@@ -621,11 +559,10 @@ PokemonDebugMenuCommands.register("set_move_pp", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_initial_moves", {
|
||||
"parent" => "moves",
|
||||
"name" => _INTL("Reset initial moves"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_initial_moves, {
|
||||
"name" => _INTL("Reset initial moves"),
|
||||
"parent" => :moves,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
pkmn.record_first_moves
|
||||
screen.pbDisplay(_INTL("{1}'s moves were set as its first-known moves.", pkmn.name))
|
||||
screen.pbRefreshSingle(pkmnid)
|
||||
@@ -636,11 +573,10 @@ PokemonDebugMenuCommands.register("set_initial_moves", {
|
||||
#===============================================================================
|
||||
# Other options
|
||||
#===============================================================================
|
||||
PokemonDebugMenuCommands.register("set_item", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Set item"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_item, {
|
||||
"name" => _INTL("Set item"),
|
||||
"parent" => :main,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
commands = [
|
||||
_INTL("Change item"),
|
||||
@@ -674,11 +610,10 @@ PokemonDebugMenuCommands.register("set_item", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_ability", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Set ability"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_ability, {
|
||||
"name" => _INTL("Set ability"),
|
||||
"parent" => :main,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
commands = [
|
||||
_INTL("Set possible ability"),
|
||||
@@ -723,11 +658,10 @@ PokemonDebugMenuCommands.register("set_ability", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_nature", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Set nature"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_nature, {
|
||||
"name" => _INTL("Set nature"),
|
||||
"parent" => :main,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
commands = []
|
||||
ids = []
|
||||
GameData::Nature.each do |nature|
|
||||
@@ -766,11 +700,10 @@ PokemonDebugMenuCommands.register("set_nature", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_gender", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Set gender"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_gender, {
|
||||
"name" => _INTL("Set gender"),
|
||||
"parent" => :main,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if pkmn.singleGendered?
|
||||
screen.pbDisplay(_INTL("{1} is single-gendered or genderless.", pkmn.speciesName))
|
||||
else
|
||||
@@ -804,11 +737,10 @@ PokemonDebugMenuCommands.register("set_gender", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("species_and_form", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Species/form..."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :species_and_form, {
|
||||
"name" => _INTL("Species/form..."),
|
||||
"parent" => :main,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
msg = [_INTL("Species {1}, form {2}.", pkmn.speciesName, pkmn.form),
|
||||
@@ -867,17 +799,15 @@ PokemonDebugMenuCommands.register("species_and_form", {
|
||||
#===============================================================================
|
||||
# Cosmetic options
|
||||
#===============================================================================
|
||||
PokemonDebugMenuCommands.register("cosmetic", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Cosmetic info..."),
|
||||
"always_show" => true
|
||||
MenuHandlers.add(:pokemon_debug_menu, :cosmetic, {
|
||||
"name" => _INTL("Cosmetic info..."),
|
||||
"parent" => :main
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_shininess", {
|
||||
"parent" => "cosmetic",
|
||||
"name" => _INTL("Set shininess"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_shininess, {
|
||||
"name" => _INTL("Set shininess"),
|
||||
"parent" => :cosmetic,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
msg_idx = pkmn.shiny? ? (pkmn.super_shiny? ? 1 : 0) : 2
|
||||
@@ -905,11 +835,10 @@ PokemonDebugMenuCommands.register("set_shininess", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_pokeball", {
|
||||
"parent" => "cosmetic",
|
||||
"name" => _INTL("Set Poké Ball"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_pokeball, {
|
||||
"name" => _INTL("Set Poké Ball"),
|
||||
"parent" => :cosmetic,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
commands = []
|
||||
balls = []
|
||||
GameData::Item.each do |item_data|
|
||||
@@ -933,11 +862,10 @@ PokemonDebugMenuCommands.register("set_pokeball", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_ribbons", {
|
||||
"parent" => "cosmetic",
|
||||
"name" => _INTL("Set ribbons"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_ribbons, {
|
||||
"name" => _INTL("Set ribbons"),
|
||||
"parent" => :cosmetic,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
commands = []
|
||||
@@ -969,11 +897,10 @@ PokemonDebugMenuCommands.register("set_ribbons", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("set_nickname", {
|
||||
"parent" => "cosmetic",
|
||||
"name" => _INTL("Set nickname"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_nickname, {
|
||||
"name" => _INTL("Set nickname"),
|
||||
"parent" => :cosmetic,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
speciesname = pkmn.speciesName
|
||||
@@ -997,11 +924,10 @@ PokemonDebugMenuCommands.register("set_nickname", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("ownership", {
|
||||
"parent" => "cosmetic",
|
||||
"name" => _INTL("Ownership..."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :ownership, {
|
||||
"name" => _INTL("Ownership..."),
|
||||
"parent" => :cosmetic,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
gender = [_INTL("Male"), _INTL("Female"), _INTL("Unknown")][pkmn.owner.gender]
|
||||
@@ -1044,11 +970,10 @@ PokemonDebugMenuCommands.register("ownership", {
|
||||
#===============================================================================
|
||||
# Can store/release/trade
|
||||
#===============================================================================
|
||||
PokemonDebugMenuCommands.register("set_discardable", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Set discardable"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_discardable, {
|
||||
"name" => _INTL("Set discardable"),
|
||||
"parent" => :main,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
msg = _INTL("Click option to toggle.")
|
||||
@@ -1074,10 +999,10 @@ PokemonDebugMenuCommands.register("set_discardable", {
|
||||
#===============================================================================
|
||||
# Other options
|
||||
#===============================================================================
|
||||
PokemonDebugMenuCommands.register("set_egg", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:pokemon_debug_menu, :set_egg, {
|
||||
"name" => _INTL("Set egg"),
|
||||
"always_show" => true,
|
||||
"parent" => :main,
|
||||
"always_show" => false,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
@@ -1116,11 +1041,10 @@ PokemonDebugMenuCommands.register("set_egg", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("shadow_pkmn", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Shadow Pkmn..."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
MenuHandlers.add(:pokemon_debug_menu, :shadow_pkmn, {
|
||||
"name" => _INTL("Shadow Pkmn..."),
|
||||
"parent" => :main,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
cmd = 0
|
||||
loop do
|
||||
msg = [_INTL("Not a Shadow Pokémon."),
|
||||
@@ -1158,65 +1082,64 @@ PokemonDebugMenuCommands.register("shadow_pkmn", {
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("mystery_gift", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:pokemon_debug_menu, :mystery_gift, {
|
||||
"name" => _INTL("Mystery Gift"),
|
||||
"parent" => :main,
|
||||
"always_show" => false,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
pbCreateMysteryGift(0, pkmn)
|
||||
next false
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("duplicate", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:pokemon_debug_menu, :duplicate, {
|
||||
"name" => _INTL("Duplicate"),
|
||||
"parent" => :main,
|
||||
"always_show" => false,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if screen.pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
|
||||
clonedpkmn = pkmn.clone
|
||||
case screen
|
||||
when PokemonPartyScreen
|
||||
pbStorePokemon(clonedpkmn)
|
||||
screen.pbHardRefresh
|
||||
screen.pbDisplay(_INTL("The Pokémon was duplicated."))
|
||||
when PokemonStorageScreen
|
||||
if screen.storage.pbMoveCaughtToParty(clonedpkmn)
|
||||
if pkmnid[0] != -1
|
||||
screen.pbDisplay(_INTL("The duplicated Pokémon was moved to your party."))
|
||||
end
|
||||
else
|
||||
oldbox = screen.storage.currentBox
|
||||
newbox = screen.storage.pbStoreCaught(clonedpkmn)
|
||||
if newbox < 0
|
||||
screen.pbDisplay(_INTL("All boxes are full."))
|
||||
elsif newbox != oldbox
|
||||
screen.pbDisplay(_INTL("The duplicated Pokémon was moved to box \"{1}.\"", screen.storage[newbox].name))
|
||||
screen.storage.currentBox = oldbox
|
||||
end
|
||||
next false if !screen.pbConfirm(_INTL("Are you sure you want to copy this Pokémon?"))
|
||||
clonedpkmn = pkmn.clone
|
||||
case screen
|
||||
when PokemonPartyScreen
|
||||
pbStorePokemon(clonedpkmn)
|
||||
screen.pbHardRefresh
|
||||
screen.pbDisplay(_INTL("The Pokémon was duplicated."))
|
||||
when PokemonStorageScreen
|
||||
if screen.storage.pbMoveCaughtToParty(clonedpkmn)
|
||||
if pkmnid[0] != -1
|
||||
screen.pbDisplay(_INTL("The duplicated Pokémon was moved to your party."))
|
||||
end
|
||||
else
|
||||
oldbox = screen.storage.currentBox
|
||||
newbox = screen.storage.pbStoreCaught(clonedpkmn)
|
||||
if newbox < 0
|
||||
screen.pbDisplay(_INTL("All boxes are full."))
|
||||
elsif newbox != oldbox
|
||||
screen.pbDisplay(_INTL("The duplicated Pokémon was moved to box \"{1}.\"", screen.storage[newbox].name))
|
||||
screen.storage.currentBox = oldbox
|
||||
end
|
||||
screen.pbHardRefresh
|
||||
end
|
||||
next true
|
||||
screen.pbHardRefresh
|
||||
end
|
||||
next false
|
||||
next true
|
||||
}
|
||||
})
|
||||
|
||||
PokemonDebugMenuCommands.register("delete", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:pokemon_debug_menu, :delete, {
|
||||
"name" => _INTL("Delete"),
|
||||
"parent" => :main,
|
||||
"always_show" => false,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
if screen.pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
|
||||
case screen
|
||||
when PokemonPartyScreen
|
||||
screen.party.delete_at(pkmnid)
|
||||
screen.pbHardRefresh
|
||||
when PokemonStorageScreen
|
||||
screen.scene.pbRelease(pkmnid, heldpoke)
|
||||
(heldpoke) ? screen.heldpkmn = nil : screen.storage.pbDelete(pkmnid[0], pkmnid[1])
|
||||
screen.scene.pbRefresh
|
||||
end
|
||||
next true
|
||||
next false if !screen.pbConfirm(_INTL("Are you sure you want to delete this Pokémon?"))
|
||||
case screen
|
||||
when PokemonPartyScreen
|
||||
screen.party.delete_at(pkmnid)
|
||||
screen.pbHardRefresh
|
||||
when PokemonStorageScreen
|
||||
screen.scene.pbRelease(pkmnid, heldpoke)
|
||||
(heldpoke) ? screen.heldpkmn = nil : screen.storage.pbDelete(pkmnid[0], pkmnid[1])
|
||||
screen.scene.pbRefresh
|
||||
end
|
||||
next false
|
||||
next true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -20,60 +20,19 @@ Choose each battler's next action.
|
||||
|
||||
=end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module BattleDebugMenuCommands
|
||||
@@commands = HandlerHashBasic.new
|
||||
|
||||
def self.register(option, hash)
|
||||
@@commands.add(option, hash)
|
||||
end
|
||||
|
||||
def self.registerIf(condition, hash)
|
||||
@@commands.addIf(condition, hash)
|
||||
end
|
||||
|
||||
def self.copy(option, *new_options)
|
||||
@@commands.copy(option, *new_options)
|
||||
end
|
||||
|
||||
def self.each
|
||||
@@commands.each { |key, hash| yield key, hash }
|
||||
end
|
||||
|
||||
def self.hasFunction?(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return option_hash&.has_key?(function)
|
||||
end
|
||||
|
||||
def self.getFunction(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return (option_hash && option_hash[function]) ? option_hash[function] : nil
|
||||
end
|
||||
|
||||
def self.call(function, option, *args)
|
||||
option_hash = @@commands[option]
|
||||
return nil if !option_hash || !option_hash[function]
|
||||
return (option_hash[function].call(*args) == true)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Battler Options
|
||||
#===============================================================================
|
||||
BattleDebugMenuCommands.register("battlers", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_debug_menu, :battlers, {
|
||||
"name" => _INTL("Battlers..."),
|
||||
"description" => _INTL("Look at Pokémon in battle and change their properties."),
|
||||
"always_show" => true
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Look at Pokémon in battle and change their properties.")
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("list_player_battlers", {
|
||||
"parent" => "battlers",
|
||||
MenuHandlers.add(:battle_debug_menu, :list_player_battlers, {
|
||||
"name" => _INTL("Player-Side Battlers"),
|
||||
"parent" => :battlers,
|
||||
"description" => _INTL("Edit Pokémon on the player's side of battle."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
battlers = []
|
||||
cmds = []
|
||||
@@ -96,11 +55,10 @@ BattleDebugMenuCommands.register("list_player_battlers", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("list_foe_battlers", {
|
||||
"parent" => "battlers",
|
||||
MenuHandlers.add(:battle_debug_menu, :list_foe_battlers, {
|
||||
"name" => _INTL("Foe-Side Battlers"),
|
||||
"parent" => :battlers,
|
||||
"description" => _INTL("Edit Pokémon on the opposing side of battle."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
battlers = []
|
||||
cmds = []
|
||||
@@ -120,18 +78,16 @@ BattleDebugMenuCommands.register("list_foe_battlers", {
|
||||
#===============================================================================
|
||||
# Field Options
|
||||
#===============================================================================
|
||||
BattleDebugMenuCommands.register("field", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_debug_menu, :field, {
|
||||
"name" => _INTL("Field Effects..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Effects that apply to the whole battlefield."),
|
||||
"always_show" => true
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("weather", {
|
||||
"parent" => "field",
|
||||
MenuHandlers.add(:battle_debug_menu, :weather, {
|
||||
"name" => _INTL("Weather"),
|
||||
"parent" => :field,
|
||||
"description" => _INTL("Set weather and duration."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
weather_types = []
|
||||
weather_cmds = []
|
||||
@@ -190,11 +146,10 @@ BattleDebugMenuCommands.register("weather", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("terrain", {
|
||||
"parent" => "field",
|
||||
MenuHandlers.add(:battle_debug_menu, :terrain, {
|
||||
"name" => _INTL("Terrain"),
|
||||
"parent" => :field,
|
||||
"description" => _INTL("Set terrain and duration."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
terrain_types = []
|
||||
terrain_cmds = []
|
||||
@@ -253,11 +208,10 @@ BattleDebugMenuCommands.register("terrain", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("environment", {
|
||||
"parent" => "field",
|
||||
MenuHandlers.add(:battle_debug_menu, :environment_time, {
|
||||
"name" => _INTL("Environment/Time"),
|
||||
"parent" => :field,
|
||||
"description" => _INTL("Set the battle's environment and time of day."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
environment_types = []
|
||||
environment_cmds = []
|
||||
@@ -292,11 +246,10 @@ BattleDebugMenuCommands.register("environment", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("backdrop", {
|
||||
"parent" => "field",
|
||||
MenuHandlers.add(:battle_debug_menu, :backdrop, {
|
||||
"name" => _INTL("Backdrop Names"),
|
||||
"parent" => :field,
|
||||
"description" => _INTL("Set the names of the backdrop and base graphics."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
loop do
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Set which backdrop name?"),
|
||||
@@ -317,11 +270,10 @@ BattleDebugMenuCommands.register("backdrop", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("set_field_effects", {
|
||||
"parent" => "field",
|
||||
MenuHandlers.add(:battle_debug_menu, :set_field_effects, {
|
||||
"name" => _INTL("Other Field Effects..."),
|
||||
"parent" => :field,
|
||||
"description" => _INTL("View/set other effects that apply to the whole battlefield."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
editor = Battle::DebugSetEffects.new(battle, :field)
|
||||
editor.update
|
||||
@@ -329,11 +281,10 @@ BattleDebugMenuCommands.register("set_field_effects", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("player_side", {
|
||||
"parent" => "field",
|
||||
MenuHandlers.add(:battle_debug_menu, :player_side, {
|
||||
"name" => _INTL("Player's Side Effects..."),
|
||||
"parent" => :field,
|
||||
"description" => _INTL("Effects that apply to the side the player is on."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
editor = Battle::DebugSetEffects.new(battle, :side, 0)
|
||||
editor.update
|
||||
@@ -341,11 +292,10 @@ BattleDebugMenuCommands.register("player_side", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("opposing_side", {
|
||||
"parent" => "field",
|
||||
MenuHandlers.add(:battle_debug_menu, :opposing_side, {
|
||||
"name" => _INTL("Foe's Side Effects..."),
|
||||
"parent" => :field,
|
||||
"description" => _INTL("Effects that apply to the opposing side."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
editor = Battle::DebugSetEffects.new(battle, :side, 1)
|
||||
editor.update
|
||||
@@ -356,18 +306,16 @@ BattleDebugMenuCommands.register("opposing_side", {
|
||||
#===============================================================================
|
||||
# Trainer Options
|
||||
#===============================================================================
|
||||
BattleDebugMenuCommands.register("trainers", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_debug_menu, :trainers, {
|
||||
"name" => _INTL("Trainer Options..."),
|
||||
"description" => _INTL("Variables that apply to trainers."),
|
||||
"always_show" => true
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Variables that apply to trainers.")
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("mega_evolution", {
|
||||
"parent" => "trainers",
|
||||
MenuHandlers.add(:battle_debug_menu, :mega_evolution, {
|
||||
"name" => _INTL("Mega Evolution"),
|
||||
"parent" => :trainers,
|
||||
"description" => _INTL("Whether each trainer is allowed to Mega Evolve."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
cmd = 0
|
||||
loop do
|
||||
@@ -399,11 +347,10 @@ BattleDebugMenuCommands.register("mega_evolution", {
|
||||
}
|
||||
})
|
||||
|
||||
BattleDebugMenuCommands.register("speed_order", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_debug_menu, :speed_order, {
|
||||
"name" => _INTL("Battler Speed Order"),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Show all battlers in order from fastest to slowest."),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |battle|
|
||||
battlers = battle.allBattlers.map { |b| [b, b.pbSpeed] }
|
||||
battlers.sort! { |a, b| b[1] <=> a[1] }
|
||||
|
||||
@@ -8,57 +8,18 @@ Actual stats? @attack, @defense, etc.
|
||||
|
||||
=end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module BattlePokemonDebugMenuCommands
|
||||
@@commands = HandlerHashBasic.new
|
||||
|
||||
def self.register(option, hash)
|
||||
@@commands.add(option, hash)
|
||||
end
|
||||
|
||||
def self.registerIf(condition, hash)
|
||||
@@commands.addIf(condition, hash)
|
||||
end
|
||||
|
||||
def self.copy(option, *new_options)
|
||||
@@commands.copy(option, *new_options)
|
||||
end
|
||||
|
||||
def self.each
|
||||
@@commands.each { |key, hash| yield key, hash }
|
||||
end
|
||||
|
||||
def self.hasFunction?(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return option_hash&.has_key?(function)
|
||||
end
|
||||
|
||||
def self.getFunction(option, function)
|
||||
option_hash = @@commands[option]
|
||||
return (option_hash && option_hash[function]) ? option_hash[function] : nil
|
||||
end
|
||||
|
||||
def self.call(function, option, *args)
|
||||
option_hash = @@commands[option]
|
||||
return nil if !option_hash || !option_hash[function]
|
||||
return (option_hash[function].call(*args) == true)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# HP/Status options
|
||||
#===============================================================================
|
||||
BattlePokemonDebugMenuCommands.register("hp_status_menu", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :hp_status_menu, {
|
||||
"name" => _INTL("HP/Status..."),
|
||||
"parent" => :main,
|
||||
"usage" => :both
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_hp", {
|
||||
"parent" => "hp_status_menu",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_hp, {
|
||||
"name" => _INTL("Set HP"),
|
||||
"parent" => :hp_status_menu,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.egg?
|
||||
@@ -79,9 +40,9 @@ BattlePokemonDebugMenuCommands.register("set_hp", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_status", {
|
||||
"parent" => "hp_status_menu",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_status, {
|
||||
"name" => _INTL("Set status"),
|
||||
"parent" => :hp_status_menu,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.egg?
|
||||
@@ -156,9 +117,9 @@ BattlePokemonDebugMenuCommands.register("set_status", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("full_heal", {
|
||||
"parent" => "hp_status_menu",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :full_heal, {
|
||||
"name" => _INTL("Heal HP and status"),
|
||||
"parent" => :hp_status_menu,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.egg?
|
||||
@@ -178,15 +139,15 @@ BattlePokemonDebugMenuCommands.register("full_heal", {
|
||||
#===============================================================================
|
||||
# Level/stats options
|
||||
#===============================================================================
|
||||
BattlePokemonDebugMenuCommands.register("level_stats", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :level_stats, {
|
||||
"name" => _INTL("Stats/level..."),
|
||||
"parent" => :main,
|
||||
"usage" => :both
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_stat_stages", {
|
||||
"parent" => "level_stats",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_stat_stages, {
|
||||
"name" => _INTL("Set stat stages"),
|
||||
"parent" => :level_stats,
|
||||
"usage" => :battler,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.egg?
|
||||
@@ -223,9 +184,9 @@ BattlePokemonDebugMenuCommands.register("set_stat_stages", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_level", {
|
||||
"parent" => "level_stats",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_level, {
|
||||
"name" => _INTL("Set level"),
|
||||
"parent" => :level_stats,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.egg?
|
||||
@@ -246,9 +207,9 @@ BattlePokemonDebugMenuCommands.register("set_level", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_exp", {
|
||||
"parent" => "level_stats",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_exp, {
|
||||
"name" => _INTL("Set Exp"),
|
||||
"parent" => :level_stats,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.egg?
|
||||
@@ -271,9 +232,9 @@ BattlePokemonDebugMenuCommands.register("set_exp", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("hidden_values", {
|
||||
"parent" => "level_stats",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :hidden_values, {
|
||||
"name" => _INTL("EV/IV..."),
|
||||
"parent" => :level_stats,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
cmd = 0
|
||||
@@ -378,9 +339,9 @@ BattlePokemonDebugMenuCommands.register("hidden_values", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_happiness", {
|
||||
"parent" => "level_stats",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_happiness, {
|
||||
"name" => _INTL("Set happiness"),
|
||||
"parent" => :level_stats,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
params = ChooseNumberParams.new
|
||||
@@ -394,9 +355,9 @@ BattlePokemonDebugMenuCommands.register("set_happiness", {
|
||||
#===============================================================================
|
||||
# Types
|
||||
#===============================================================================
|
||||
BattlePokemonDebugMenuCommands.register("set_types", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_types, {
|
||||
"name" => _INTL("Set types"),
|
||||
"parent" => :main,
|
||||
"usage" => :battler,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
max_main_types = 2 # The most types a Pokémon can have normally
|
||||
@@ -443,15 +404,15 @@ BattlePokemonDebugMenuCommands.register("set_types", {
|
||||
#===============================================================================
|
||||
# Moves options
|
||||
#===============================================================================
|
||||
BattlePokemonDebugMenuCommands.register("moves", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :moves, {
|
||||
"name" => _INTL("Moves..."),
|
||||
"parent" => :main,
|
||||
"usage" => :both
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("teach_move", {
|
||||
"parent" => "moves",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :teach_move, {
|
||||
"name" => _INTL("Teach move"),
|
||||
"parent" => :moves,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.numMoves >= Pokemon::MAX_MOVES
|
||||
@@ -472,9 +433,9 @@ BattlePokemonDebugMenuCommands.register("teach_move", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("forget_move", {
|
||||
"parent" => "moves",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :forget_move, {
|
||||
"name" => _INTL("Forget move"),
|
||||
"parent" => :moves,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
move_names = []
|
||||
@@ -497,9 +458,9 @@ BattlePokemonDebugMenuCommands.register("forget_move", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_move_pp", {
|
||||
"parent" => "moves",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_move_pp, {
|
||||
"name" => _INTL("Set move PP"),
|
||||
"parent" => :moves,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
cmd = 0
|
||||
@@ -575,9 +536,9 @@ BattlePokemonDebugMenuCommands.register("set_move_pp", {
|
||||
#===============================================================================
|
||||
# Other options
|
||||
#===============================================================================
|
||||
BattlePokemonDebugMenuCommands.register("set_item", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_item, {
|
||||
"name" => _INTL("Set item"),
|
||||
"parent" => :main,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
cmd = 0
|
||||
@@ -610,9 +571,9 @@ BattlePokemonDebugMenuCommands.register("set_item", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_ability", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_ability, {
|
||||
"name" => _INTL("Set ability"),
|
||||
"parent" => :main,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
cmd = 0
|
||||
@@ -651,9 +612,9 @@ BattlePokemonDebugMenuCommands.register("set_ability", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_nature", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_nature, {
|
||||
"name" => _INTL("Set nature"),
|
||||
"parent" => :main,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
commands = []
|
||||
@@ -693,9 +654,9 @@ BattlePokemonDebugMenuCommands.register("set_nature", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_gender", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_gender, {
|
||||
"name" => _INTL("Set gender"),
|
||||
"parent" => :main,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
if pkmn.singleGendered?
|
||||
@@ -722,9 +683,9 @@ BattlePokemonDebugMenuCommands.register("set_gender", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("form", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_form, {
|
||||
"name" => _INTL("Set form"),
|
||||
"parent" => :main,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
cmd = 0
|
||||
@@ -759,9 +720,9 @@ BattlePokemonDebugMenuCommands.register("form", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_shininess", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_shininess, {
|
||||
"name" => _INTL("Set shininess"),
|
||||
"parent" => :main,
|
||||
"usage" => :both,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
cmd = 0
|
||||
@@ -791,9 +752,9 @@ BattlePokemonDebugMenuCommands.register("set_shininess", {
|
||||
}
|
||||
})
|
||||
|
||||
BattlePokemonDebugMenuCommands.register("set_effects", {
|
||||
"parent" => "main",
|
||||
MenuHandlers.add(:battle_pokemon_debug_menu, :set_effects, {
|
||||
"name" => _INTL("Set effects"),
|
||||
"parent" => :main,
|
||||
"usage" => :battler,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
editor = Battle::DebugSetEffects.new(battle, :battler, battler.index)
|
||||
Reference in New Issue
Block a user