Browse Source

Class and SectionID enums

pull/3/head
jake 5 years ago
parent
commit
174932f996
  1. 55
      src/character/character.rs

55
src/character/character.rs

@ -5,6 +5,61 @@ use psopacket::PSOPacketData;
use crate::{PSOPacketData, PacketParseError}; use crate::{PSOPacketData, PacketParseError};
//use crate::PSOPacketData; //use crate::PSOPacketData;
#[repr(u32)]
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
pub enum Class {
HUmar,
HUnewearl,
HUcast,
HUcaseal,
RAmar,
RAmarl,
RAcast,
RAcaseal,
FOmar,
FOmarl,
FOnewm,
FOnewearl,
}
impl std::convert::From<u8> for Class {
fn from(f: u8) -> Class {
match f {
0 => Class::HUmar,
1 => Class::HUnewearl,
2 => Class::HUcast,
3 => Class::RAmar,
4 => Class::RAcast,
5 => Class::RAcaseal,
6 => Class::FOmarl,
7 => Class::FOnewm,
8 => Class::FOnewm,
9 => Class::HUcaseal,
10 => Class::RAmarl,
11 => Class::FOmar,
_ => panic!("unknown class")
}
}
}
pub enum SectionID {
Viridia,
Greenill,
Skyly,
Bluefull,
Purplenum,
Pinkal,
Redria,
Oran,
Yellowboze,
Whitill,
}
#[derive(PSOPacketData, Copy, Clone)] #[derive(PSOPacketData, Copy, Clone)]
#[repr(C)] #[repr(C)]
pub struct Character { pub struct Character {

Loading…
Cancel
Save