From 174932f9965c9d2719d2f51e599610b2bdf35c42 Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 3 Dec 2019 21:40:31 -0800 Subject: [PATCH] Class and SectionID enums --- src/character/character.rs | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/character/character.rs b/src/character/character.rs index 4d5a7ac..47b9f5d 100644 --- a/src/character/character.rs +++ b/src/character/character.rs @@ -5,6 +5,61 @@ use psopacket::PSOPacketData; use crate::{PSOPacketData, PacketParseError}; //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 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)] #[repr(C)] pub struct Character {