Rsaves/examples/change_sex.pl

31 lines
1.0 KiB
Perl
Raw Permalink Normal View History

2023-01-29 20:59:55 +01:00
#!/usr/bin/env perl
use v5.34.1;
use strict;
use warnings;
use Rsaves
2023-02-01 01:09:36 +01:00
qw/read_save check_correct_size get_saves find_current_save_index check_correct_size find_pokemon_substruct change_gender read_pc_storage save_pc_changes enable_eon_ticket save_changes pokemon_set_shiny read_pkm_file_box parse_version_name/;
2023-01-29 20:59:55 +01:00
use Rsaves::Constants::Ruby::Global qw/$MALE $FEMALE/;
2023-02-01 01:09:36 +01:00
my $input = $ARGV[0] or die "No input save";
my $output = $ARGV[1] or die "No output save";
my $version = parse_version_name($ARGV[2]) // parse_version_name('ruby');
2023-01-29 20:59:55 +01:00
sub start {
my ( @saves_raw, $extra );
2023-02-01 01:09:36 +01:00
( @saves_raw[ 0, 1 ], $extra ) = read_save($input);
2023-01-29 20:59:55 +01:00
check_correct_size( @saves_raw, $extra );
2023-02-01 01:09:36 +01:00
my @saves = get_saves(@saves_raw, $version);
2023-01-29 20:59:55 +01:00
my $current_save_index = find_current_save_index(@saves);
my $save = $saves[$current_save_index];
# Easier than in real life.
# You will need to change room and voila.
change_gender( $save, $FEMALE );
2023-02-01 01:09:36 +01:00
save_changes( @saves, $extra, $output );
2023-01-29 20:59:55 +01:00
}
start;