Created module MenuHandlers for the contents of various menus

This commit is contained in:
Maruno17
2021-12-31 17:45:07 +00:00
parent 7da449aec3
commit 4cf13f2942
15 changed files with 1073 additions and 1124 deletions

View File

@@ -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

View File

@@ -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."))

View File

@@ -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
}
})

View File

@@ -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] }

View File

@@ -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)