38 lines
1.6 KiB
Perl
38 lines
1.6 KiB
Perl
#!/usr/bin/env perl
|
|
use v5.34.1;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use feature 'signatures';
|
|
|
|
use Rsaves
|
|
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 enable_mirage_island_for_pokemon parse_version_name pokemon_fill_pp to_3rd_encoding translate_3rd_encoding/;
|
|
use Rsaves::Constants::Global
|
|
qw/$MOVE_SPIKES $MOVE_DRILL_PECK $MOVE_HIDDEN_POWER $MOVE_TAUNT $MOVE_THUNDERBOLT $MOVE_ROAR $MOVE_THUNDER_WAVE $ITEM_LEFTOVERS $MOVE_DRAGON_DANCE $MOVE_ROCK_SLIDE $MOVE_EARTHQUAKE $MOVE_TAUNT $MOVE_FLAMETHROWER $MOVE_WILL_O_WISP $MOVE_HYDRO_PUMP $MOVE_ICE_BEAM $MOVE_FOCUS_PUNCH $MOVE_PSYCHIC $MOVE_FIRE_PUNCH $MOVE_WISH $MOVE_PROTECT $MOVE_TOXIC $MOVE_LEECH_SEED $MOVE_RECOVER/;
|
|
|
|
use Rsaves::Constants::Ruby::Global qw/$MALE $FEMALE/;
|
|
|
|
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');
|
|
|
|
sub start {
|
|
my ( @saves_raw, $extra );
|
|
( @saves_raw[ 0, 1 ], $extra ) = read_save($input);
|
|
my @saves = get_saves( @saves_raw, $version );
|
|
my $current_save_index = find_current_save_index(@saves);
|
|
my $save = $saves[$current_save_index];
|
|
|
|
my $pc = read_pc_storage($save);
|
|
my $box = $pc->{boxes}[0];
|
|
my @pokemons = $box->@[0..5];
|
|
for my $pokemon (@pokemons) {
|
|
$pokemon->{substructures}[0]{held_item} = $ITEM_LEFTOVERS;
|
|
}
|
|
|
|
save_pc_changes( $save, $pc );
|
|
save_changes( @saves, $extra, $output );
|
|
}
|
|
start;
|