411 lines
18 KiB
Rust
411 lines
18 KiB
Rust
use std::convert::{TryFrom, Into};
|
|
|
|
pub enum ArmorTypeError {
|
|
UnknownArmor(String)
|
|
}
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
|
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],
|
|
}
|
|
}
|
|
}
|
|
|
|
impl TryFrom<&str> for ArmorType {
|
|
type Error = ArmorTypeError;
|
|
fn try_from(value: &str) -> Result<ArmorType, ArmorTypeError> {
|
|
match value {
|
|
"Frame" => Ok(ArmorType::Frame),
|
|
"Armor" => Ok(ArmorType::Armor),
|
|
"PsyArmor" => Ok(ArmorType::PsyArmor),
|
|
"GigaFrame" => Ok(ArmorType::GigaFrame),
|
|
"SoulFrame" => Ok(ArmorType::SoulFrame),
|
|
"CrossArmor" => Ok(ArmorType::CrossArmor),
|
|
"SolidFrame" => Ok(ArmorType::SolidFrame),
|
|
"BraveArmor" => Ok(ArmorType::BraveArmor),
|
|
"HyperFrame" => Ok(ArmorType::HyperFrame),
|
|
"GrandArmor" => Ok(ArmorType::GrandArmor),
|
|
"ShockFrame" => Ok(ArmorType::ShockFrame),
|
|
"KingsFrame" => Ok(ArmorType::KingsFrame),
|
|
"DragonFrame" => Ok(ArmorType::DragonFrame),
|
|
"AbsorbArmor" => Ok(ArmorType::AbsorbArmor),
|
|
"ProtectFrame" => Ok(ArmorType::ProtectFrame),
|
|
"GeneralArmor" => Ok(ArmorType::GeneralArmor),
|
|
"PerfectFrame" => Ok(ArmorType::PerfectFrame),
|
|
"ValiantFrame" => Ok(ArmorType::ValiantFrame),
|
|
"ImperialArmor" => Ok(ArmorType::ImperialArmor),
|
|
"HolinessArmor" => Ok(ArmorType::HolinessArmor),
|
|
"GuardianArmor" => Ok(ArmorType::GuardianArmor),
|
|
"DivinityArmor" => Ok(ArmorType::DivinityArmor),
|
|
"UltimateFrame" => Ok(ArmorType::UltimateFrame),
|
|
"CelestialArmor" => Ok(ArmorType::CelestialArmor),
|
|
"HunterField" => Ok(ArmorType::HunterField),
|
|
"RangerField" => Ok(ArmorType::RangerField),
|
|
"ForceField" => Ok(ArmorType::ForceField),
|
|
"RevivalGarment" => Ok(ArmorType::RevivalGarment),
|
|
"SpiritGarment" => Ok(ArmorType::SpiritGarment),
|
|
"StinkFrame" => Ok(ArmorType::StinkFrame),
|
|
"DPartsver101" => Ok(ArmorType::DPartsver101),
|
|
"DPartsver210" => Ok(ArmorType::DPartsver210),
|
|
"ParasiteWeardeRol" => Ok(ArmorType::ParasiteWeardeRol),
|
|
"ParasiteWearnelgal" => Ok(ArmorType::ParasiteWearnelgal),
|
|
"ParasiteWearvajulla" => Ok(ArmorType::ParasiteWearvajulla),
|
|
"SensePlate" => Ok(ArmorType::SensePlate),
|
|
"GravitonPlate" => Ok(ArmorType::GravitonPlate),
|
|
"AttributePlate" => Ok(ArmorType::AttributePlate),
|
|
"FlowensFrame" => Ok(ArmorType::FlowensFrame),
|
|
"CustomFrameveroo" => Ok(ArmorType::CustomFrameveroo),
|
|
"DbsArmor" => Ok(ArmorType::DbsArmor),
|
|
"GuardWave" => Ok(ArmorType::GuardWave),
|
|
"DfField" => Ok(ArmorType::DfField),
|
|
"LuminousField" => Ok(ArmorType::LuminousField),
|
|
"ChuChuFever" => Ok(ArmorType::ChuChuFever),
|
|
"LoveHeart" => Ok(ArmorType::LoveHeart),
|
|
"FlameGarment" => Ok(ArmorType::FlameGarment),
|
|
"VirusArmorlafuteria" => Ok(ArmorType::VirusArmorlafuteria),
|
|
"BrightnessCircle" => Ok(ArmorType::BrightnessCircle),
|
|
"AuraField" => Ok(ArmorType::AuraField),
|
|
"ElectroFrame" => Ok(ArmorType::ElectroFrame),
|
|
"SacredCloth" => Ok(ArmorType::SacredCloth),
|
|
"SmokingPlate" => Ok(ArmorType::SmokingPlate),
|
|
"StarCuirass" => Ok(ArmorType::StarCuirass),
|
|
"BlackHoundCuirass" => Ok(ArmorType::BlackHoundCuirass),
|
|
"MorningPrayer" => Ok(ArmorType::MorningPrayer),
|
|
"BlackOdoshiDomaru" => Ok(ArmorType::BlackOdoshiDomaru),
|
|
"RedOdoshiDomaru" => Ok(ArmorType::RedOdoshiDomaru),
|
|
"BlackOdoshiRedNimaidou" => Ok(ArmorType::BlackOdoshiRedNimaidou),
|
|
"BlueOdoshiVioletNimaidou" => Ok(ArmorType::BlueOdoshiVioletNimaidou),
|
|
"DirtyLifejacket" => Ok(ArmorType::DirtyLifejacket),
|
|
"KroesSweater" => Ok(ArmorType::KroesSweater),
|
|
"WeddingDress" => Ok(ArmorType::WeddingDress),
|
|
"SonicteamArmor" => Ok(ArmorType::SonicteamArmor),
|
|
"RedCoat" => Ok(ArmorType::RedCoat),
|
|
"Thirteen" => Ok(ArmorType::Thirteen),
|
|
"MotherGarb" => Ok(ArmorType::MotherGarb),
|
|
"MotherGarb2" => Ok(ArmorType::MotherGarb2),
|
|
"DressPlate" => Ok(ArmorType::DressPlate),
|
|
"Sweetheart" => Ok(ArmorType::Sweetheart),
|
|
"IgnitionCloak" => Ok(ArmorType::IgnitionCloak),
|
|
"CongealCloak" => Ok(ArmorType::CongealCloak),
|
|
"TempestCloak" => Ok(ArmorType::TempestCloak),
|
|
"CursedCloak" => Ok(ArmorType::CursedCloak),
|
|
"SelectCloak" => Ok(ArmorType::SelectCloak),
|
|
"SpiritCuirass" => Ok(ArmorType::SpiritCuirass),
|
|
"RevivalCuriass" => Ok(ArmorType::RevivalCuriass),
|
|
"AllianceUniform" => Ok(ArmorType::AllianceUniform),
|
|
"OfficerUniform" => Ok(ArmorType::OfficerUniform),
|
|
"CommanderUniform" => Ok(ArmorType::CommanderUniform),
|
|
"CrimsonCoat" => Ok(ArmorType::CrimsonCoat),
|
|
"InfantryGear" => Ok(ArmorType::InfantryGear),
|
|
"LieutenantGear" => Ok(ArmorType::LieutenantGear),
|
|
"InfantryMantle" => Ok(ArmorType::InfantryMantle),
|
|
"LieutenantMantle" => Ok(ArmorType::LieutenantMantle),
|
|
"UnionField" => Ok(ArmorType::UnionField),
|
|
"SamuraiArmor" => Ok(ArmorType::SamuraiArmor),
|
|
"StealthSuit" => Ok(ArmorType::StealthSuit),
|
|
_ => Err(ArmorTypeError::UnknownArmor(value.to_string()))
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Into<String> for ArmorType {
|
|
fn into(self) -> String {
|
|
match self {
|
|
ArmorType::Frame => "Frame",
|
|
ArmorType::Armor => "Armor",
|
|
ArmorType::PsyArmor => "PsyArmor",
|
|
ArmorType::GigaFrame => "GigaFrame",
|
|
ArmorType::SoulFrame => "SoulFrame",
|
|
ArmorType::CrossArmor => "CrossArmor",
|
|
ArmorType::SolidFrame => "SolidFrame",
|
|
ArmorType::BraveArmor => "BraveArmor",
|
|
ArmorType::HyperFrame => "HyperFrame",
|
|
ArmorType::GrandArmor => "GrandArmor",
|
|
ArmorType::ShockFrame => "ShockFrame",
|
|
ArmorType::KingsFrame => "KingsFrame",
|
|
ArmorType::DragonFrame => "DragonFrame",
|
|
ArmorType::AbsorbArmor => "AbsorbArmor",
|
|
ArmorType::ProtectFrame => "ProtectFrame",
|
|
ArmorType::GeneralArmor => "GeneralArmor",
|
|
ArmorType::PerfectFrame => "PerfectFrame",
|
|
ArmorType::ValiantFrame => "ValiantFrame",
|
|
ArmorType::ImperialArmor => "ImperialArmor",
|
|
ArmorType::HolinessArmor => "HolinessArmor",
|
|
ArmorType::GuardianArmor => "GuardianArmor",
|
|
ArmorType::DivinityArmor => "DivinityArmor",
|
|
ArmorType::UltimateFrame => "UltimateFrame",
|
|
ArmorType::CelestialArmor => "CelestialArmor",
|
|
ArmorType::HunterField => "HunterField",
|
|
ArmorType::RangerField => "RangerField",
|
|
ArmorType::ForceField => "ForceField",
|
|
ArmorType::RevivalGarment => "RevivalGarment",
|
|
ArmorType::SpiritGarment => "SpiritGarment",
|
|
ArmorType::StinkFrame => "StinkFrame",
|
|
ArmorType::DPartsver101 => "DPartsver101",
|
|
ArmorType::DPartsver210 => "DPartsver210",
|
|
ArmorType::ParasiteWeardeRol => "ParasiteWeardeRol",
|
|
ArmorType::ParasiteWearnelgal => "ParasiteWearnelgal",
|
|
ArmorType::ParasiteWearvajulla => "ParasiteWearvajulla",
|
|
ArmorType::SensePlate => "SensePlate",
|
|
ArmorType::GravitonPlate => "GravitonPlate",
|
|
ArmorType::AttributePlate => "AttributePlate",
|
|
ArmorType::FlowensFrame => "FlowensFrame",
|
|
ArmorType::CustomFrameveroo => "CustomFrameveroo",
|
|
ArmorType::DbsArmor => "DbsArmor",
|
|
ArmorType::GuardWave => "GuardWave",
|
|
ArmorType::DfField => "DfField",
|
|
ArmorType::LuminousField => "LuminousField",
|
|
ArmorType::ChuChuFever => "ChuChuFever",
|
|
ArmorType::LoveHeart => "LoveHeart",
|
|
ArmorType::FlameGarment => "FlameGarment",
|
|
ArmorType::VirusArmorlafuteria => "VirusArmorlafuteria",
|
|
ArmorType::BrightnessCircle => "BrightnessCircle",
|
|
ArmorType::AuraField => "AuraField",
|
|
ArmorType::ElectroFrame => "ElectroFrame",
|
|
ArmorType::SacredCloth => "SacredCloth",
|
|
ArmorType::SmokingPlate => "SmokingPlate",
|
|
ArmorType::StarCuirass => "StarCuirass",
|
|
ArmorType::BlackHoundCuirass => "BlackHoundCuirass",
|
|
ArmorType::MorningPrayer => "MorningPrayer",
|
|
ArmorType::BlackOdoshiDomaru => "BlackOdoshiDomaru",
|
|
ArmorType::RedOdoshiDomaru => "RedOdoshiDomaru",
|
|
ArmorType::BlackOdoshiRedNimaidou => "BlackOdoshiRedNimaidou",
|
|
ArmorType::BlueOdoshiVioletNimaidou => "BlueOdoshiVioletNimaidou",
|
|
ArmorType::DirtyLifejacket => "DirtyLifejacket",
|
|
ArmorType::KroesSweater => "KroesSweater",
|
|
ArmorType::WeddingDress => "WeddingDress",
|
|
ArmorType::SonicteamArmor => "SonicteamArmor",
|
|
ArmorType::RedCoat => "RedCoat",
|
|
ArmorType::Thirteen => "Thirteen",
|
|
ArmorType::MotherGarb => "MotherGarb",
|
|
ArmorType::MotherGarb2 => "MotherGarb2",
|
|
ArmorType::DressPlate => "DressPlate",
|
|
ArmorType::Sweetheart => "Sweetheart",
|
|
ArmorType::IgnitionCloak => "IgnitionCloak",
|
|
ArmorType::CongealCloak => "CongealCloak",
|
|
ArmorType::TempestCloak => "TempestCloak",
|
|
ArmorType::CursedCloak => "CursedCloak",
|
|
ArmorType::SelectCloak => "SelectCloak",
|
|
ArmorType::SpiritCuirass => "SpiritCuirass",
|
|
ArmorType::RevivalCuriass => "RevivalCuriass",
|
|
ArmorType::AllianceUniform => "AllianceUniform",
|
|
ArmorType::OfficerUniform => "OfficerUniform",
|
|
ArmorType::CommanderUniform => "CommanderUniform",
|
|
ArmorType::CrimsonCoat => "CrimsonCoat",
|
|
ArmorType::InfantryGear => "InfantryGear",
|
|
ArmorType::LieutenantGear => "LieutenantGear",
|
|
ArmorType::InfantryMantle => "InfantryMantle",
|
|
ArmorType::LieutenantMantle => "LieutenantMantle",
|
|
ArmorType::UnionField => "UnionField",
|
|
ArmorType::SamuraiArmor => "SamuraiArmor",
|
|
ArmorType::StealthSuit => "StealthSuit",
|
|
}.to_string()
|
|
}
|
|
}
|
|
|
|
// TODO: TryFrom<&str> maybe done check please
|
|
// TODO Into<String> ^^
|
|
|
|
|
|
#[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
|
|
}
|
|
}
|