use std::convert::{TryFrom, Into}; use serde::{Serialize, Deserialize}; #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize, enum_utils::FromStr, derive_more::Display)] pub enum ArmorType { Frame, Armor, PsyArmor, GigaFrame, SoulFrame, CrossArmor, SolidFrame, BraveArmor, HyperFrame, GrandArmor, ShockFrame, KingsFrame, DragonFrame, AbsorbArmor, ProtectFrame, GeneralArmor, PerfectFrame, ValiantFrame, ImperialArmor, HolinessArmor, GuardianArmor, DivinityArmor, UltimateFrame, CelestialArmor, HunterField, RangerField, ForceField, RevivalGarment, SpiritGarment, StinkFrame, DPartsver101, DPartsver210, ParasiteWeardeRol, ParasiteWearnelgal, ParasiteWearvajulla, SensePlate, GravitonPlate, AttributePlate, FlowensFrame, CustomFrameveroo, DbsArmor, GuardWave, DfField, LuminousField, ChuChuFever, LoveHeart, FlameGarment, VirusArmorlafuteria, BrightnessCircle, AuraField, ElectroFrame, SacredCloth, SmokingPlate, StarCuirass, BlackHoundCuirass, MorningPrayer, BlackOdoshiDomaru, RedOdoshiDomaru, BlackOdoshiRedNimaidou, BlueOdoshiVioletNimaidou, DirtyLifejacket, KroesSweater, WeddingDress, SonicteamArmor, RedCoat, Thirteen, MotherGarb, MotherGarb2, DressPlate, Sweetheart, IgnitionCloak, CongealCloak, TempestCloak, CursedCloak, SelectCloak, SpiritCuirass, RevivalCuriass, AllianceUniform, OfficerUniform, CommanderUniform, CrimsonCoat, InfantryGear, LieutenantGear, InfantryMantle, LieutenantMantle, UnionField, SamuraiArmor, StealthSuit, } impl ArmorType { pub fn value(&self) -> [u8; 3] { match self { ArmorType::Frame => [0x01, 0x01, 0x00], ArmorType::Armor => [0x01, 0x01, 0x01], ArmorType::PsyArmor => [0x01, 0x01, 0x02], ArmorType::GigaFrame => [0x01, 0x01, 0x03], ArmorType::SoulFrame => [0x01, 0x01, 0x04], ArmorType::CrossArmor => [0x01, 0x01, 0x05], ArmorType::SolidFrame => [0x01, 0x01, 0x06], ArmorType::BraveArmor => [0x01, 0x01, 0x07], ArmorType::HyperFrame => [0x01, 0x01, 0x08], ArmorType::GrandArmor => [0x01, 0x01, 0x09], ArmorType::ShockFrame => [0x01, 0x01, 0x0A], ArmorType::KingsFrame => [0x01, 0x01, 0x0B], ArmorType::DragonFrame => [0x01, 0x01, 0x0C], ArmorType::AbsorbArmor => [0x01, 0x01, 0x0D], ArmorType::ProtectFrame => [0x01, 0x01, 0x0E], ArmorType::GeneralArmor => [0x01, 0x01, 0x0F], ArmorType::PerfectFrame => [0x01, 0x01, 0x10], ArmorType::ValiantFrame => [0x01, 0x01, 0x11], ArmorType::ImperialArmor => [0x01, 0x01, 0x12], ArmorType::HolinessArmor => [0x01, 0x01, 0x13], ArmorType::GuardianArmor => [0x01, 0x01, 0x14], ArmorType::DivinityArmor => [0x01, 0x01, 0x15], ArmorType::UltimateFrame => [0x01, 0x01, 0x16], ArmorType::CelestialArmor => [0x01, 0x01, 0x17], ArmorType::HunterField => [0x01, 0x01, 0x18], ArmorType::RangerField => [0x01, 0x01, 0x19], ArmorType::ForceField => [0x01, 0x01, 0x1A], ArmorType::RevivalGarment => [0x01, 0x01, 0x1B], ArmorType::SpiritGarment => [0x01, 0x01, 0x1C], ArmorType::StinkFrame => [0x01, 0x01, 0x1D], ArmorType::DPartsver101 => [0x01, 0x01, 0x1E], ArmorType::DPartsver210 => [0x01, 0x01, 0x1F], ArmorType::ParasiteWeardeRol => [0x01, 0x01, 0x20], ArmorType::ParasiteWearnelgal => [0x01, 0x01, 0x21], ArmorType::ParasiteWearvajulla => [0x01, 0x01, 0x22], ArmorType::SensePlate => [0x01, 0x01, 0x23], ArmorType::GravitonPlate => [0x01, 0x01, 0x24], ArmorType::AttributePlate => [0x01, 0x01, 0x25], ArmorType::FlowensFrame => [0x01, 0x01, 0x26], ArmorType::CustomFrameveroo => [0x01, 0x01, 0x27], ArmorType::DbsArmor => [0x01, 0x01, 0x28], ArmorType::GuardWave => [0x01, 0x01, 0x29], ArmorType::DfField => [0x01, 0x01, 0x2A], ArmorType::LuminousField => [0x01, 0x01, 0x2B], ArmorType::ChuChuFever => [0x01, 0x01, 0x2C], ArmorType::LoveHeart => [0x01, 0x01, 0x2D], ArmorType::FlameGarment => [0x01, 0x01, 0x2E], ArmorType::VirusArmorlafuteria => [0x01, 0x01, 0x2F], ArmorType::BrightnessCircle => [0x01, 0x01, 0x30], ArmorType::AuraField => [0x01, 0x01, 0x31], ArmorType::ElectroFrame => [0x01, 0x01, 0x32], ArmorType::SacredCloth => [0x01, 0x01, 0x33], ArmorType::SmokingPlate => [0x01, 0x01, 0x34], ArmorType::StarCuirass => [0x01, 0x01, 0x35], ArmorType::BlackHoundCuirass => [0x01, 0x01, 0x36], ArmorType::MorningPrayer => [0x01, 0x01, 0x37], ArmorType::BlackOdoshiDomaru => [0x01, 0x01, 0x38], ArmorType::RedOdoshiDomaru => [0x01, 0x01, 0x39], ArmorType::BlackOdoshiRedNimaidou => [0x01, 0x01, 0x3A], ArmorType::BlueOdoshiVioletNimaidou => [0x01, 0x01, 0x3B], ArmorType::DirtyLifejacket => [0x01, 0x01, 0x3C], ArmorType::KroesSweater => [0x01, 0x01, 0x3D], ArmorType::WeddingDress => [0x01, 0x01, 0x3E], ArmorType::SonicteamArmor => [0x01, 0x01, 0x3F], ArmorType::RedCoat => [0x01, 0x01, 0x40], ArmorType::Thirteen => [0x01, 0x01, 0x41], ArmorType::MotherGarb => [0x01, 0x01, 0x42], ArmorType::MotherGarb2 => [0x01, 0x01, 0x43], ArmorType::DressPlate => [0x01, 0x01, 0x44], ArmorType::Sweetheart => [0x01, 0x01, 0x45], ArmorType::IgnitionCloak => [0x01, 0x01, 0x46], ArmorType::CongealCloak => [0x01, 0x01, 0x47], ArmorType::TempestCloak => [0x01, 0x01, 0x48], ArmorType::CursedCloak => [0x01, 0x01, 0x49], ArmorType::SelectCloak => [0x01, 0x01, 0x4A], ArmorType::SpiritCuirass => [0x01, 0x01, 0x4B], ArmorType::RevivalCuriass => [0x01, 0x01, 0x4C], ArmorType::AllianceUniform => [0x01, 0x01, 0x4D], ArmorType::OfficerUniform => [0x01, 0x01, 0x4E], ArmorType::CommanderUniform => [0x01, 0x01, 0x4F], ArmorType::CrimsonCoat => [0x01, 0x01, 0x50], ArmorType::InfantryGear => [0x01, 0x01, 0x51], ArmorType::LieutenantGear => [0x01, 0x01, 0x52], ArmorType::InfantryMantle => [0x01, 0x01, 0x53], ArmorType::LieutenantMantle => [0x01, 0x01, 0x54], ArmorType::UnionField => [0x01, 0x01, 0x55], ArmorType::SamuraiArmor => [0x01, 0x01, 0x56], ArmorType::StealthSuit => [0x01, 0x01, 0x57], } } } #[derive(Debug, Copy, Clone, PartialEq)] pub struct Armor { pub armor: ArmorType, pub dfp: u8, pub evp: u8, pub slots: u8, } impl Armor { pub fn as_bytes(&self) -> [u8; 16] { let mut result = [0; 16]; result[0..3].copy_from_slice(&self.armor.value()); // TODO: other attrs result } }