Nicknaming from PC

This commit is contained in:
chardub
2023-01-06 21:44:54 -05:00
parent 759cfd7801
commit 4ffba4437e
2 changed files with 33 additions and 0 deletions

View File

@@ -1650,6 +1650,7 @@ class PokemonStorageScreen
cmdRelease = -1 cmdRelease = -1
cmdDebug = -1 cmdDebug = -1
cmdCancel = -1 cmdCancel = -1
cmdNickname = -1
if heldpoke if heldpoke
helptext = _INTL("{1} is selected.", heldpoke.name) helptext = _INTL("{1} is selected.", heldpoke.name)
commands[cmdMove = commands.length] = (pokemon) ? _INTL("Shift") : _INTL("Place") commands[cmdMove = commands.length] = (pokemon) ? _INTL("Shift") : _INTL("Place")
@@ -1666,6 +1667,7 @@ class PokemonStorageScreen
commands[cmdFuse = commands.length] = _INTL("Fuse") commands[cmdFuse = commands.length] = _INTL("Fuse")
end end
end end
commands[cmdNickname = commands.length] = _INTL("Nickname")
commands[cmdWithdraw = commands.length] = (selected[0] == -1) ? _INTL("Store") : _INTL("Withdraw") commands[cmdWithdraw = commands.length] = (selected[0] == -1) ? _INTL("Store") : _INTL("Withdraw")
commands[cmdItem = commands.length] = _INTL("Item") commands[cmdItem = commands.length] = _INTL("Item")
@@ -1681,6 +1683,8 @@ class PokemonStorageScreen
end end
elsif cmdSummary >= 0 && command == cmdSummary # Summary elsif cmdSummary >= 0 && command == cmdSummary # Summary
pbSummary(selected, @heldpkmn) pbSummary(selected, @heldpkmn)
elsif cmdNickname >= 0 && command == cmdNickname # Summary
renamePokemon(selected)
elsif cmdWithdraw >= 0 && command == cmdWithdraw # Store/Withdraw elsif cmdWithdraw >= 0 && command == cmdWithdraw # Store/Withdraw
(selected[0] == -1) ? pbStore(selected, @heldpkmn) : pbWithdraw(selected, @heldpkmn) (selected[0] == -1) ? pbStore(selected, @heldpkmn) : pbWithdraw(selected, @heldpkmn)
elsif cmdItem >= 0 && command == cmdItem # Item elsif cmdItem >= 0 && command == cmdItem # Item
@@ -1790,6 +1794,35 @@ class PokemonStorageScreen
end end
end end
def renamePokemon(selected)
box = selected[0]
index = selected[1]
pokemon = @storage[box, index]
speciesname = PBSpecies.getName(pokemon.species)
hasNickname = speciesname == pokemon.name
if hasNickname
pbDisplay(_INTL("{1} has no nickname.", speciesname))
else
pbDisplay(_INTL("{1} has the nickname {2}.", speciesname, pokemon.name))
end
commands = [
_INTL("Rename"),
_INTL("Quit")
]
command = pbShowCommands(
_INTL("What do you want to do?"), commands)
case command
when 0
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", speciesname), 0, Pokemon::MAX_NAME_SIZE, "", pokemon)
pokemon.name = (newname == "") ? speciesname : newname
pbDisplay(_INTL("{1} is now named {2}!", speciesname, pokemon.name))
when 1
return
end
end
def pbUpdate # For debug def pbUpdate # For debug
@scene.update @scene.update
end end

Binary file not shown.