xenua
1 year ago
4 changed files with 1397 additions and 138 deletions
@ -0,0 +1,98 @@ |
|||||||
|
use crate::general::BinaryGender; |
||||||
|
|
||||||
|
/// https://projectpokemon.org/home/docs/gen-5/bw-save-structure-r60/
|
||||||
|
pub struct PK5 { |
||||||
|
personality: u32, |
||||||
|
checksum: u16, |
||||||
|
pokedex_id: u16, |
||||||
|
|
||||||
|
// block A
|
||||||
|
held_item: u16, |
||||||
|
ot_id: u16, |
||||||
|
ot_secret_id: u16, |
||||||
|
experience: u32, |
||||||
|
friendship: u8, |
||||||
|
ability: u8, |
||||||
|
markings: u8, |
||||||
|
original_language: u8, |
||||||
|
ev_hp: u8, |
||||||
|
ev_attack: u8, |
||||||
|
ev_defense: u8, |
||||||
|
ev_speed: u8, |
||||||
|
ev_sp_attack: u8, |
||||||
|
ev_sp_defense: u8, |
||||||
|
contest_value_cool: u8, |
||||||
|
contest_value_beauty: u8, |
||||||
|
contest_value_cute: u8, |
||||||
|
contest_value_smart: u8, |
||||||
|
contest_value_tough: u8, |
||||||
|
contest_value_sheen: u8, |
||||||
|
ribbon_set_sinnoh_1: u16, |
||||||
|
ribbon_set_unova: u16, |
||||||
|
|
||||||
|
// block B
|
||||||
|
move_1_id: u16, |
||||||
|
move_2_id: u16, |
||||||
|
move_3_id: u16, |
||||||
|
move_4_id: u16, |
||||||
|
move_1_current_pp: u8, |
||||||
|
move_2_current_pp: u8, |
||||||
|
move_3_current_pp: u8, |
||||||
|
move_4_current_pp: u8, |
||||||
|
move_pp_ups: u32, |
||||||
|
ivs_isegg_isnicknamed: u32, |
||||||
|
ribbon_set_hoenn_1: u16, |
||||||
|
ribbon_set_hoenn_2: u16, |
||||||
|
fateful_gender_altform: u8, |
||||||
|
nature: u8, |
||||||
|
dreamworld_ability_n_flags: u8, |
||||||
|
unknown_1: u32, |
||||||
|
|
||||||
|
// block C
|
||||||
|
nickname: String, |
||||||
|
unknown_2: u8, |
||||||
|
origin_game: u8, |
||||||
|
ribbon_set_sinnoh_3: u16, |
||||||
|
ribbon_set_sinnoh_4: u16, |
||||||
|
|
||||||
|
// block D
|
||||||
|
ot_name: String, |
||||||
|
date_egg_received: [u8; 3], |
||||||
|
date_met: [u8; 3], |
||||||
|
egg_location_dp: u16, |
||||||
|
met_at_location_dp: u16, |
||||||
|
pokerus: u8, |
||||||
|
pokeball: u8, |
||||||
|
met_at_level_ot_gender: u8, |
||||||
|
encounter_type: u8, |
||||||
|
|
||||||
|
// battle stats
|
||||||
|
status: u8, |
||||||
|
unknown_flags: u8, // max 0xF0
|
||||||
|
unknown_3: u16, |
||||||
|
level: u8, |
||||||
|
capsule_index: u8, |
||||||
|
current_hp: u16, |
||||||
|
max_hp: u16, |
||||||
|
attack: u16, |
||||||
|
defense: u16, |
||||||
|
speed: u16, |
||||||
|
special_attack: u16, |
||||||
|
special_defense: u16, |
||||||
|
mail_message: Mail5, |
||||||
|
} |
||||||
|
|
||||||
|
pub struct Mail5 { |
||||||
|
author_tid: u16, |
||||||
|
author_sid: u16, |
||||||
|
author_gender: BinaryGender, |
||||||
|
author_language: u8, |
||||||
|
author_version: u8, |
||||||
|
mail_type: u8, |
||||||
|
author_name: String, |
||||||
|
message_ending: u16, |
||||||
|
appear_pkm: u16, |
||||||
|
message_data_1: u16, |
||||||
|
message_data_2: u16, |
||||||
|
message_data_3: u16, |
||||||
|
} |
@ -0,0 +1,76 @@ |
|||||||
|
use std::io::Read; |
||||||
|
|
||||||
|
pub mod gen5; |
||||||
|
|
||||||
|
pub trait StringConverter { |
||||||
|
fn to_string(bytes: impl Read) -> String; |
||||||
|
fn to_bytes(string: String) -> Box<dyn Read>; |
||||||
|
} |
||||||
|
|
||||||
|
pub trait Pokemon { |
||||||
|
// main
|
||||||
|
fn species(&self) -> Species; |
||||||
|
fn nickname(&self) -> String; |
||||||
|
fn held_item(&self) -> Item; |
||||||
|
fn gender(&self) -> Gender; |
||||||
|
fn nature(&self) -> Nature; |
||||||
|
fn ability(&self) -> Ability; |
||||||
|
fn form(&self) -> PokemonForm; |
||||||
|
fn is_egg(&self) -> bool; |
||||||
|
fn is_nicknamed(&self) -> bool; |
||||||
|
fn exp(&self) -> u32; |
||||||
|
fn ot_name(&self) -> String; |
||||||
|
fn ot_gender(&self) -> BinaryGender; |
||||||
|
fn level(&self) -> u8; |
||||||
|
fn met_level(&self) -> u8; |
||||||
|
|
||||||
|
// internal
|
||||||
|
fn tid16(&self) -> u16; |
||||||
|
fn sid16(&self) -> u16; |
||||||
|
fn id32(&self) -> u32; |
||||||
|
fn ball(&self) -> PokeBall; |
||||||
|
fn current_friendship(&self) -> i32; |
||||||
|
fn version(&self) -> i32; |
||||||
|
fn pokerus_strain(&self) -> i32; |
||||||
|
fn pokerus_days(&self) -> i32; |
||||||
|
fn encryption_constant(&self) -> u32; |
||||||
|
fn pid(&self) -> u32; |
||||||
|
|
||||||
|
// misc
|
||||||
|
fn language(&self) -> Language; |
||||||
|
fn is_fateful_encounter(&self) -> bool; |
||||||
|
|
||||||
|
// battle
|
||||||
|
fn move1(&self) -> u16; |
||||||
|
fn move2(&self) -> u16; |
||||||
|
fn move3(&self) -> u16; |
||||||
|
fn move4(&self) -> u16; |
||||||
|
fn pp_move1(&self) -> u8; |
||||||
|
fn pp_move2(&self) -> u8; |
||||||
|
fn pp_move3(&self) -> u8; |
||||||
|
fn pp_move4(&self) -> u8; |
||||||
|
fn pp_up_move1(&self) -> u8; |
||||||
|
fn pp_up_move2(&self) -> u8; |
||||||
|
fn pp_up_move3(&self) -> u8; |
||||||
|
fn pp_up_move4(&self) -> u8; |
||||||
|
fn ev_hp(&self) -> u8; |
||||||
|
fn ev_attack(&self) -> u8; |
||||||
|
fn ev_defense(&self) -> u8; |
||||||
|
fn ev_speed(&self) -> u8; |
||||||
|
fn ev_sp_attack(&self) -> u8; |
||||||
|
fn ev_sp_defense(&self) -> u8; |
||||||
|
fn iv_hp(&self) -> IV; |
||||||
|
fn iv_attack(&self) -> IV; |
||||||
|
fn iv_defense(&self) -> IV; |
||||||
|
fn iv_speed(&self) -> IV; |
||||||
|
fn iv_sp_attack(&self) -> IV; |
||||||
|
fn iv_sp_defense(&self) -> IV; |
||||||
|
fn status_condition(&self) -> StatusCondition; |
||||||
|
fn stat_hp_max(&self) -> u16; |
||||||
|
fn stat_hp_current(&self) -> u16; |
||||||
|
fn stat_attack(&self) -> u16; |
||||||
|
fn stat_defense(&self) -> u16; |
||||||
|
fn stat_speed(&self) -> u16; |
||||||
|
fn stat_sp_attack(&self) -> u16; |
||||||
|
fn stat_sp_defense(&self) -> u16; |
||||||
|
} |
Loading…
Reference in new issue