GEmeTool/lib/GEmeTool/Save/Pokemon.pm

47 lines
1.3 KiB
Perl

package GEmeTool::Save::Pokemon;
use v5.16.3;
use strict;
use warnings;
use Moo;
use Rsaves;
use Rsaves::Constants::Emerald::Species;
has _pokemon => (
is => 'rw',
);
sub species {
my $self = shift;
my $pokemon = $self->_pokemon;
my $substruct_0 = Rsaves::find_pokemon_substruct($pokemon->{substructures}, 0);
return $substruct_0->{species};
}
sub get_icon {
my $self = shift;
my $pokemon_name = $Rsaves::Constants::Emerald::Species::SPECIES[$self->species];
if (lc($pokemon_name) eq 'unown') {
return "pokeemerald/graphics/pokemon/@{[lc($pokemon_name)]}/z/icon.png";
}
return "pokeemerald/graphics/pokemon/@{[lc($pokemon_name)]}/icon.png";
}
sub get_front {
my $self = shift;
my $pokemon_name = $Rsaves::Constants::Emerald::Species::SPECIES[$self->species];
if (Rsaves::pokemon_is_shiny($self->_pokemon)) {
return "resources/shiny/@{[lc($pokemon_name)]}.png";
}
if (lc($pokemon_name) eq 'castform') {
return "pokeemerald/graphics/pokemon/@{[lc($pokemon_name)]}/normal/front.png";
}
if (lc($pokemon_name) eq 'unown') {
return "pokeemerald/graphics/pokemon/@{[lc($pokemon_name)]}/z/front.png";
}
return "pokeemerald/graphics/pokemon/@{[lc($pokemon_name)]}/front.png";
}
1;