#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
#
# Showdown Exporter v3 for Pokémon Essentials by Cilerba, rewritten by M3rein, rerewritten by lavendersiren
#
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
SDWN_ALOLAN = { # What forms of what species are seen as Alolan.
:RATTATA => 1,
:RATICATE => 1,
:RAICHU => 1,
:SANDSHREW => 1,
:SANDSLASH => 1,
:VULPIX => 1,
:NINETALES => 1,
:DIGLETT => 1,
:DUGTRIO => 1,
:MEOWTH => 1,
:PERSIAN => 1,
:GEODUDE => 1,
:GRAVELER => 1,
:GOLEM => 1,
:GRIMER => 1,
:MUK => 1,
:EXEGGUTOR => 1,
:MAROWAK => 1
}
SDWN_MOVES = { # Turns the left move into the right move. This for compatibility with custom moves.
:CUSTOM1 => :TACKLE,
:CUSTOM2 => :POUND,
:CUSTOM3 => :SLAM
}
def getShowdownName(pkmn)
for key in SDWN_ALOLAN.keys
if pkmn.species == getConst(GameData::Species,key) && pkmn.form == SDWN_ALOLAN[key] #PBSpecies
return "#{GameData::Species.get(pkmn.species).name}-Alola" #PBSpecies.getName(pkmn.species)
end
end
return GameData::Species.get(pkmn.species).name #PBSpecies.getName(pkmn.species)
end
def getShowdownMove(m)
for key in SDWN_MOVES.keys
if m.id == getConst(GameData::Move,key)
return GameData::Move.get(pkmn.moves).name(getConst(GameData::Move,SDWN_MOVES[key])) #PBMoves.getName(getConst(PBMoves,SDWN_MOVES[key]))
#get the name of the moves ( get a constant (the moves, that hash up there[key]) )
end
end
return GameData::Move.get(m.id).name #PBMoves.getName(m.id)
end
def pbShowdown
ret = ""
for i in 0...$Trainer.party.size
pkmn = $Trainer.party[i]
next if !pkmn || pkmn.egg? #chaged to egg instead of isEgg?
if pkmn.name != "" && pkmn.name != GameData::Species.get(pkmn.species).name #PBSpecies.getName(pkmn.species) old thing
ret += "#{pkmn.name} (#{getShowdownName(pkmn)}) "
else
ret += "#{getShowdownName(pkmn)} "
end
ret += pkmn.gender == 0 ? "(M) " : pkmn.gender == 1 ? "(F) " : ""
ret += "@ #{GameData::Item.get(pkmn.item).name}" if pkmn.item != nil #> 0 #PBItems.getName(pkmn.item)
ret += "\n"
ret += "Ability: #{GameData::Ability.get(pkmn.ability).name}\n" #PBAbilities.getName(pkmn.ability)
ret += "Level: #{pkmn.level}\n" if pkmn.level < 100
ret += "Shiny: Yes\n" if pkmn.shiny?
ret += "Happiness: #{pkmn.happiness}\n" if pkmn.happiness < 255
evs = [pkmn.ev[:HP],pkmn.ev[:ATTACK],pkmn.ev[:DEFENSE],pkmn.ev[:SPECIAL_DEFENSE],pkmn.ev[:SPEED],pkmn.ev[:SPECIAL_ATTACK]] #evs = [pkmn.ev[0],pkmn.ev[1],pkmn.ev[2],pkmn.ev[4],pkmn.ev[5],pkmn.ev[3]]
stats = ["HP", "Atk", "Def", "SpA", "SpD", "Spe"]
p evs #print the effort values
p pkmn.ev
if evs[0] > 0 || evs[1] > 0 || evs[2] > 0 || evs[3] > 0 || evs[4] > 0 || evs[5] > 0
ret += "EVs:"
for i in 0...6
ret += " #{evs[i]} #{stats[i]} /" if evs[i] > 0
end
ret = ret[0, ret.size - 2] + "\n"
end
ret += "#{GameData::Nature.get(pkmn.nature).name} Nature\n" #PBNatures.getName(pkmn.nature)
ivs = [pkmn.iv[:HP],pkmn.iv[:ATTACK],pkmn.iv[:DEFENSE],pkmn.iv[:SPECIAL_DEFENSE],pkmn.iv[:SPEED],pkmn.iv[:SPECIAL_ATTACK]]
if ivs[0] < 31 || ivs[1] < 31 || ivs[2] < 31 || ivs[3] < 31 || ivs[4] < 31 || ivs[5] < 31
ret += "IVs:"
for i in 0...6
ret += " #{ivs[i]} #{stats[i]} /" if ivs[i] < 31
end
ret = ret[0, ret.size - 2] + "\n"
end
for j in 0...pkmn.moves.size
next if !pkmn.moves[j] || pkmn.moves[j].id == 0
ret += "- #{getShowdownMove(pkmn.moves[j])}\n"
end
ret += "\n"
end
file = File.new("showdown.txt", "w+")
file.write(ret)
file.close
end