style: format
This commit is contained in:
parent
5f7dd956ca
commit
86f1c182c6
246
src/clans.rs
246
src/clans.rs
|
@ -12,144 +12,144 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Clan {
|
||||
// Au Ra
|
||||
Raen,
|
||||
Xaela,
|
||||
// Elezen
|
||||
Duskwight,
|
||||
Wildwood,
|
||||
// Hrothgar
|
||||
Helion,
|
||||
TheLost,
|
||||
// Hyur
|
||||
Highlander,
|
||||
Midlander,
|
||||
// Lalafell
|
||||
Dunesfolk,
|
||||
Plainsfolk,
|
||||
// Miqo'te
|
||||
KeeperOfTheMoon,
|
||||
SeekerOfTheSun,
|
||||
// Roegadyn
|
||||
Hellsguard,
|
||||
SeaWolf,
|
||||
// Viera
|
||||
Rava,
|
||||
Veena,
|
||||
// Au Ra
|
||||
Raen,
|
||||
Xaela,
|
||||
// Elezen
|
||||
Duskwight,
|
||||
Wildwood,
|
||||
// Hrothgar
|
||||
Helion,
|
||||
TheLost,
|
||||
// Hyur
|
||||
Highlander,
|
||||
Midlander,
|
||||
// Lalafell
|
||||
Dunesfolk,
|
||||
Plainsfolk,
|
||||
// Miqo'te
|
||||
KeeperOfTheMoon,
|
||||
SeekerOfTheSun,
|
||||
// Roegadyn
|
||||
Hellsguard,
|
||||
SeaWolf,
|
||||
// Viera
|
||||
Rava,
|
||||
Veena,
|
||||
}
|
||||
|
||||
impl Clan {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Clan; 16] = [
|
||||
Clan::Raen,
|
||||
Clan::Xaela,
|
||||
Clan::Duskwight,
|
||||
Clan::Wildwood,
|
||||
Clan::Helion,
|
||||
Clan::TheLost,
|
||||
Clan::Highlander,
|
||||
Clan::Midlander,
|
||||
Clan::Dunesfolk,
|
||||
Clan::Plainsfolk,
|
||||
Clan::KeeperOfTheMoon,
|
||||
Clan::SeekerOfTheSun,
|
||||
Clan::Hellsguard,
|
||||
Clan::SeaWolf,
|
||||
Clan::Rava,
|
||||
Clan::Veena,
|
||||
];
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Clan; 16] = [
|
||||
Clan::Raen,
|
||||
Clan::Xaela,
|
||||
Clan::Duskwight,
|
||||
Clan::Wildwood,
|
||||
Clan::Helion,
|
||||
Clan::TheLost,
|
||||
Clan::Highlander,
|
||||
Clan::Midlander,
|
||||
Clan::Dunesfolk,
|
||||
Clan::Plainsfolk,
|
||||
Clan::KeeperOfTheMoon,
|
||||
Clan::SeekerOfTheSun,
|
||||
Clan::Hellsguard,
|
||||
Clan::SeaWolf,
|
||||
Clan::Rava,
|
||||
Clan::Veena,
|
||||
];
|
||||
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Clan::Raen => "Raen",
|
||||
Clan::Xaela => "Xaela",
|
||||
Clan::Duskwight => "Duskwight",
|
||||
Clan::Wildwood => "Wildwood",
|
||||
Clan::Helion => "Helion",
|
||||
Clan::TheLost => "TheLost",
|
||||
Clan::Highlander => "Highlander",
|
||||
Clan::Midlander => "Midlander",
|
||||
Clan::Dunesfolk => "Dunesfolk",
|
||||
Clan::Plainsfolk => "Plainsfolk",
|
||||
Clan::KeeperOfTheMoon => "KeeperOfTheMoon",
|
||||
Clan::SeekerOfTheSun => "SeekerOfTheSun",
|
||||
Clan::Hellsguard => "Hellsguard",
|
||||
Clan::SeaWolf => "SeaWolf",
|
||||
Clan::Rava => "Rava",
|
||||
Clan::Veena => "Veena",
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Clan::Raen => "Raen",
|
||||
Clan::Xaela => "Xaela",
|
||||
Clan::Duskwight => "Duskwight",
|
||||
Clan::Wildwood => "Wildwood",
|
||||
Clan::Helion => "Helion",
|
||||
Clan::TheLost => "TheLost",
|
||||
Clan::Highlander => "Highlander",
|
||||
Clan::Midlander => "Midlander",
|
||||
Clan::Dunesfolk => "Dunesfolk",
|
||||
Clan::Plainsfolk => "Plainsfolk",
|
||||
Clan::KeeperOfTheMoon => "KeeperOfTheMoon",
|
||||
Clan::SeekerOfTheSun => "SeekerOfTheSun",
|
||||
Clan::Hellsguard => "Hellsguard",
|
||||
Clan::SeaWolf => "SeaWolf",
|
||||
Clan::Rava => "Rava",
|
||||
Clan::Veena => "Veena",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Clan::Raen => "Raen",
|
||||
Clan::Xaela => "Xaela",
|
||||
Clan::Duskwight => "Duskwight",
|
||||
Clan::Wildwood => "Wildwood",
|
||||
Clan::Helion => "Helion",
|
||||
Clan::TheLost => "The Lost",
|
||||
Clan::Highlander => "Highlander",
|
||||
Clan::Midlander => "Midlander",
|
||||
Clan::Dunesfolk => "Dunesfolk",
|
||||
Clan::Plainsfolk => "Plainsfolk",
|
||||
Clan::KeeperOfTheMoon => "Keeper of the Moon",
|
||||
Clan::SeekerOfTheSun => "Seeker of the Sun",
|
||||
Clan::Hellsguard => "Hellsguard",
|
||||
Clan::SeaWolf => "Sea Wolf",
|
||||
Clan::Rava => "Rava",
|
||||
Clan::Veena => "Veena",
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Clan::Raen => "Raen",
|
||||
Clan::Xaela => "Xaela",
|
||||
Clan::Duskwight => "Duskwight",
|
||||
Clan::Wildwood => "Wildwood",
|
||||
Clan::Helion => "Helion",
|
||||
Clan::TheLost => "The Lost",
|
||||
Clan::Highlander => "Highlander",
|
||||
Clan::Midlander => "Midlander",
|
||||
Clan::Dunesfolk => "Dunesfolk",
|
||||
Clan::Plainsfolk => "Plainsfolk",
|
||||
Clan::KeeperOfTheMoon => "Keeper of the Moon",
|
||||
Clan::SeekerOfTheSun => "Seeker of the Sun",
|
||||
Clan::Hellsguard => "Hellsguard",
|
||||
Clan::SeaWolf => "Sea Wolf",
|
||||
Clan::Rava => "Rava",
|
||||
Clan::Veena => "Veena",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "races")]
|
||||
pub fn race(&self) -> Race {
|
||||
match *self {
|
||||
Clan::Raen | Clan::Xaela => Race::AuRa,
|
||||
Clan::Duskwight | Clan::Wildwood => Race::Elezen,
|
||||
Clan::Helion | Clan::TheLost => Race::Hrothgar,
|
||||
Clan::Highlander | Clan::Midlander => Race::Hyur,
|
||||
Clan::Dunesfolk | Clan::Plainsfolk => Race::Lalafell,
|
||||
Clan::KeeperOfTheMoon | Clan::SeekerOfTheSun => Race::Miqote,
|
||||
Clan::Hellsguard | Clan::SeaWolf => Race::Roegadyn,
|
||||
Clan::Rava | Clan::Veena => Race::Viera,
|
||||
#[cfg(feature = "races")]
|
||||
pub fn race(&self) -> Race {
|
||||
match *self {
|
||||
Clan::Raen | Clan::Xaela => Race::AuRa,
|
||||
Clan::Duskwight | Clan::Wildwood => Race::Elezen,
|
||||
Clan::Helion | Clan::TheLost => Race::Hrothgar,
|
||||
Clan::Highlander | Clan::Midlander => Race::Hyur,
|
||||
Clan::Dunesfolk | Clan::Plainsfolk => Race::Lalafell,
|
||||
Clan::KeeperOfTheMoon | Clan::SeekerOfTheSun => Race::Miqote,
|
||||
Clan::Hellsguard | Clan::SeaWolf => Race::Roegadyn,
|
||||
Clan::Rava | Clan::Veena => Race::Viera,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Clan {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let world = match s.to_lowercase().as_str() {
|
||||
"raen" => Clan::Raen,
|
||||
"xaela" => Clan::Xaela,
|
||||
"duskwight" => Clan::Duskwight,
|
||||
"wildwood" => Clan::Wildwood,
|
||||
"helion" => Clan::Helion,
|
||||
"thelost" | "the lost" => Clan::TheLost,
|
||||
"highlander" => Clan::Highlander,
|
||||
"midlander" => Clan::Midlander,
|
||||
"dunesfolk" => Clan::Dunesfolk,
|
||||
"plainsfolk" => Clan::Plainsfolk,
|
||||
"keeperofthemoon" | "keeper of the moon" => Clan::KeeperOfTheMoon,
|
||||
"seekerofthesun" | "seeker of the sun" => Clan::SeekerOfTheSun,
|
||||
"hellsguard" => Clan::Hellsguard,
|
||||
"seawolf" | "sea wolf" => Clan::SeaWolf,
|
||||
"rava" => Clan::Rava,
|
||||
"veena" => Clan::Veena,
|
||||
_ => return Err(UnknownVariant("Clan", s.into()))
|
||||
};
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let world = match s.to_lowercase().as_str() {
|
||||
"raen" => Clan::Raen,
|
||||
"xaela" => Clan::Xaela,
|
||||
"duskwight" => Clan::Duskwight,
|
||||
"wildwood" => Clan::Wildwood,
|
||||
"helion" => Clan::Helion,
|
||||
"thelost" | "the lost" => Clan::TheLost,
|
||||
"highlander" => Clan::Highlander,
|
||||
"midlander" => Clan::Midlander,
|
||||
"dunesfolk" => Clan::Dunesfolk,
|
||||
"plainsfolk" => Clan::Plainsfolk,
|
||||
"keeperofthemoon" | "keeper of the moon" => Clan::KeeperOfTheMoon,
|
||||
"seekerofthesun" | "seeker of the sun" => Clan::SeekerOfTheSun,
|
||||
"hellsguard" => Clan::Hellsguard,
|
||||
"seawolf" | "sea wolf" => Clan::SeaWolf,
|
||||
"rava" => Clan::Rava,
|
||||
"veena" => Clan::Veena,
|
||||
_ => return Err(UnknownVariant("Clan", s.into()))
|
||||
};
|
||||
|
||||
Ok(world)
|
||||
}
|
||||
Ok(world)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Clan {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,70 +8,70 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum DataCenter {
|
||||
Aether,
|
||||
Chaos,
|
||||
Crystal,
|
||||
Elemental,
|
||||
Gaia,
|
||||
Light,
|
||||
Mana,
|
||||
Primal,
|
||||
Aether,
|
||||
Chaos,
|
||||
Crystal,
|
||||
Elemental,
|
||||
Gaia,
|
||||
Light,
|
||||
Mana,
|
||||
Primal,
|
||||
}
|
||||
|
||||
impl DataCenter {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [DataCenter; 8] = [
|
||||
DataCenter::Aether,
|
||||
DataCenter::Chaos,
|
||||
DataCenter::Crystal,
|
||||
DataCenter::Elemental,
|
||||
DataCenter::Gaia,
|
||||
DataCenter::Light,
|
||||
DataCenter::Mana,
|
||||
DataCenter::Primal,
|
||||
];
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [DataCenter; 8] = [
|
||||
DataCenter::Aether,
|
||||
DataCenter::Chaos,
|
||||
DataCenter::Crystal,
|
||||
DataCenter::Elemental,
|
||||
DataCenter::Gaia,
|
||||
DataCenter::Light,
|
||||
DataCenter::Mana,
|
||||
DataCenter::Primal,
|
||||
];
|
||||
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
DataCenter::Aether => "Aether",
|
||||
DataCenter::Chaos => "Chaos",
|
||||
DataCenter::Crystal => "Crystal",
|
||||
DataCenter::Elemental => "Elemental",
|
||||
DataCenter::Gaia => "Gaia",
|
||||
DataCenter::Light => "Light",
|
||||
DataCenter::Mana => "Mana",
|
||||
DataCenter::Primal => "Primal",
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
DataCenter::Aether => "Aether",
|
||||
DataCenter::Chaos => "Chaos",
|
||||
DataCenter::Crystal => "Crystal",
|
||||
DataCenter::Elemental => "Elemental",
|
||||
DataCenter::Gaia => "Gaia",
|
||||
DataCenter::Light => "Light",
|
||||
DataCenter::Mana => "Mana",
|
||||
DataCenter::Primal => "Primal",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
// if any variants with spaces are added, this must be changed
|
||||
self.as_str()
|
||||
}
|
||||
pub fn name(&self) -> &'static str {
|
||||
// if any variants with spaces are added, this must be changed
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for DataCenter {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let data_center = match s.to_lowercase().as_str() {
|
||||
"aether" => DataCenter::Aether,
|
||||
"chaos" => DataCenter::Chaos,
|
||||
"crystal" => DataCenter::Crystal,
|
||||
"elemental" => DataCenter::Elemental,
|
||||
"gaia" => DataCenter::Gaia,
|
||||
"light" => DataCenter::Light,
|
||||
"mana" => DataCenter::Mana,
|
||||
"primal" => DataCenter::Primal,
|
||||
_ => return Err(UnknownVariant("DataCenter", s.into()))
|
||||
};
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let data_center = match s.to_lowercase().as_str() {
|
||||
"aether" => DataCenter::Aether,
|
||||
"chaos" => DataCenter::Chaos,
|
||||
"crystal" => DataCenter::Crystal,
|
||||
"elemental" => DataCenter::Elemental,
|
||||
"gaia" => DataCenter::Gaia,
|
||||
"light" => DataCenter::Light,
|
||||
"mana" => DataCenter::Mana,
|
||||
"primal" => DataCenter::Primal,
|
||||
_ => return Err(UnknownVariant("DataCenter", s.into()))
|
||||
};
|
||||
|
||||
Ok(data_center)
|
||||
}
|
||||
Ok(data_center)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for DataCenter {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,14 @@ use std::fmt::{Display, Formatter, Result as FmtResult};
|
|||
/// [`FromStr`]: ::std::str::FromStr
|
||||
#[derive(Debug)]
|
||||
pub struct UnknownVariant(
|
||||
/// The `enum` name (e.g. `"DataCenter"`)
|
||||
pub &'static str,
|
||||
/// The unknown variant given
|
||||
pub String
|
||||
/// The `enum` name (e.g. `"DataCenter"`)
|
||||
pub &'static str,
|
||||
/// The unknown variant given
|
||||
pub String,
|
||||
);
|
||||
|
||||
impl Display for UnknownVariant {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "unknown variant {} for type {}", self.1, self.0)
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "unknown variant {} for type {}", self.1, self.0)
|
||||
}
|
||||
}
|
||||
|
|
196
src/guardians.rs
196
src/guardians.rs
|
@ -9,119 +9,119 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Guardian {
|
||||
Althyk,
|
||||
Azeyma,
|
||||
Byregot,
|
||||
Halone,
|
||||
Llymlaen,
|
||||
Menphina,
|
||||
NaldThal,
|
||||
Nophica,
|
||||
Nymeia,
|
||||
Oschon,
|
||||
Rhalgr,
|
||||
Thaliak,
|
||||
Althyk,
|
||||
Azeyma,
|
||||
Byregot,
|
||||
Halone,
|
||||
Llymlaen,
|
||||
Menphina,
|
||||
NaldThal,
|
||||
Nophica,
|
||||
Nymeia,
|
||||
Oschon,
|
||||
Rhalgr,
|
||||
Thaliak,
|
||||
}
|
||||
|
||||
impl Guardian {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Guardian; 12] = [
|
||||
Guardian::Althyk,
|
||||
Guardian::Azeyma,
|
||||
Guardian::Byregot,
|
||||
Guardian::Halone,
|
||||
Guardian::Llymlaen,
|
||||
Guardian::Menphina,
|
||||
Guardian::NaldThal,
|
||||
Guardian::Nophica,
|
||||
Guardian::Nymeia,
|
||||
Guardian::Oschon,
|
||||
Guardian::Rhalgr,
|
||||
Guardian::Thaliak,
|
||||
];
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Guardian; 12] = [
|
||||
Guardian::Althyk,
|
||||
Guardian::Azeyma,
|
||||
Guardian::Byregot,
|
||||
Guardian::Halone,
|
||||
Guardian::Llymlaen,
|
||||
Guardian::Menphina,
|
||||
Guardian::NaldThal,
|
||||
Guardian::Nophica,
|
||||
Guardian::Nymeia,
|
||||
Guardian::Oschon,
|
||||
Guardian::Rhalgr,
|
||||
Guardian::Thaliak,
|
||||
];
|
||||
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Guardian::Althyk => "Althyk",
|
||||
Guardian::Azeyma => "Azeyma",
|
||||
Guardian::Byregot => "Byregot",
|
||||
Guardian::Halone => "Halone",
|
||||
Guardian::Llymlaen => "Llymlaen",
|
||||
Guardian::Menphina => "Menphina",
|
||||
Guardian::NaldThal => "NaldThal",
|
||||
Guardian::Nophica => "Nophica",
|
||||
Guardian::Nymeia => "Nymeia",
|
||||
Guardian::Oschon => "Oschon",
|
||||
Guardian::Rhalgr => "Rhalgr",
|
||||
Guardian::Thaliak => "Thaliak",
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Guardian::Althyk => "Althyk",
|
||||
Guardian::Azeyma => "Azeyma",
|
||||
Guardian::Byregot => "Byregot",
|
||||
Guardian::Halone => "Halone",
|
||||
Guardian::Llymlaen => "Llymlaen",
|
||||
Guardian::Menphina => "Menphina",
|
||||
Guardian::NaldThal => "NaldThal",
|
||||
Guardian::Nophica => "Nophica",
|
||||
Guardian::Nymeia => "Nymeia",
|
||||
Guardian::Oschon => "Oschon",
|
||||
Guardian::Rhalgr => "Rhalgr",
|
||||
Guardian::Thaliak => "Thaliak",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Guardian::Althyk => "Althyk",
|
||||
Guardian::Azeyma => "Azeyma",
|
||||
Guardian::Byregot => "Byregot",
|
||||
Guardian::Halone => "Halone",
|
||||
Guardian::Llymlaen => "Llymlaen",
|
||||
Guardian::Menphina => "Menphina",
|
||||
Guardian::NaldThal => "Nald'thal",
|
||||
Guardian::Nophica => "Nophica",
|
||||
Guardian::Nymeia => "Nymeia",
|
||||
Guardian::Oschon => "Oschon",
|
||||
Guardian::Rhalgr => "Rhalgr",
|
||||
Guardian::Thaliak => "Thaliak",
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Guardian::Althyk => "Althyk",
|
||||
Guardian::Azeyma => "Azeyma",
|
||||
Guardian::Byregot => "Byregot",
|
||||
Guardian::Halone => "Halone",
|
||||
Guardian::Llymlaen => "Llymlaen",
|
||||
Guardian::Menphina => "Menphina",
|
||||
Guardian::NaldThal => "Nald'thal",
|
||||
Guardian::Nophica => "Nophica",
|
||||
Guardian::Nymeia => "Nymeia",
|
||||
Guardian::Oschon => "Oschon",
|
||||
Guardian::Rhalgr => "Rhalgr",
|
||||
Guardian::Thaliak => "Thaliak",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn epithet(&self) -> &'static str {
|
||||
match *self {
|
||||
Guardian::Althyk => "the Keeper",
|
||||
Guardian::Azeyma => "the Warden",
|
||||
Guardian::Byregot => "the Builder",
|
||||
Guardian::Halone => "the Fury",
|
||||
Guardian::Llymlaen => "the Navigator",
|
||||
Guardian::Menphina => "the Lover",
|
||||
Guardian::NaldThal => "the Traders",
|
||||
Guardian::Nophica => "the Matron",
|
||||
Guardian::Nymeia => "the Spinner",
|
||||
Guardian::Oschon => "the Wanderer",
|
||||
Guardian::Rhalgr => "the Destroyer",
|
||||
Guardian::Thaliak => "the Scholar",
|
||||
pub fn epithet(&self) -> &'static str {
|
||||
match *self {
|
||||
Guardian::Althyk => "the Keeper",
|
||||
Guardian::Azeyma => "the Warden",
|
||||
Guardian::Byregot => "the Builder",
|
||||
Guardian::Halone => "the Fury",
|
||||
Guardian::Llymlaen => "the Navigator",
|
||||
Guardian::Menphina => "the Lover",
|
||||
Guardian::NaldThal => "the Traders",
|
||||
Guardian::Nophica => "the Matron",
|
||||
Guardian::Nymeia => "the Spinner",
|
||||
Guardian::Oschon => "the Wanderer",
|
||||
Guardian::Rhalgr => "the Destroyer",
|
||||
Guardian::Thaliak => "the Scholar",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Guardian {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let guardian = match s.to_lowercase().as_str() {
|
||||
"althyk" => Guardian::Althyk,
|
||||
"azeyma" => Guardian::Azeyma,
|
||||
"byregot" => Guardian::Byregot,
|
||||
"halone" => Guardian::Halone,
|
||||
"llymlaen" => Guardian::Llymlaen,
|
||||
"menphina" => Guardian::Menphina,
|
||||
"naldthal" | "nald'thal" => Guardian::NaldThal,
|
||||
"nophica" => Guardian::Nophica,
|
||||
"nymeia" => Guardian::Nymeia,
|
||||
"oschon" => Guardian::Oschon,
|
||||
"rhalgr" => Guardian::Rhalgr,
|
||||
"thaliak" => Guardian::Thaliak,
|
||||
_ => return Err(UnknownVariant("Guardian", s.into()))
|
||||
};
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let guardian = match s.to_lowercase().as_str() {
|
||||
"althyk" => Guardian::Althyk,
|
||||
"azeyma" => Guardian::Azeyma,
|
||||
"byregot" => Guardian::Byregot,
|
||||
"halone" => Guardian::Halone,
|
||||
"llymlaen" => Guardian::Llymlaen,
|
||||
"menphina" => Guardian::Menphina,
|
||||
"naldthal" | "nald'thal" => Guardian::NaldThal,
|
||||
"nophica" => Guardian::Nophica,
|
||||
"nymeia" => Guardian::Nymeia,
|
||||
"oschon" => Guardian::Oschon,
|
||||
"rhalgr" => Guardian::Rhalgr,
|
||||
"thaliak" => Guardian::Thaliak,
|
||||
_ => return Err(UnknownVariant("Guardian", s.into()))
|
||||
};
|
||||
|
||||
Ok(guardian)
|
||||
}
|
||||
Ok(guardian)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Guardian {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,58 +14,58 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Classification {
|
||||
War,
|
||||
Magic,
|
||||
Land,
|
||||
Hand,
|
||||
War,
|
||||
Magic,
|
||||
Land,
|
||||
Hand,
|
||||
}
|
||||
|
||||
impl Classification {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Classification; 4] = [
|
||||
Classification::War,
|
||||
Classification::Magic,
|
||||
Classification::Land,
|
||||
Classification::Hand,
|
||||
];
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Classification; 4] = [
|
||||
Classification::War,
|
||||
Classification::Magic,
|
||||
Classification::Land,
|
||||
Classification::Hand,
|
||||
];
|
||||
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Classification::War => "War",
|
||||
Classification::Magic => "Magic",
|
||||
Classification::Land => "Land",
|
||||
Classification::Hand => "Hand",
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Classification::War => "War",
|
||||
Classification::Magic => "Magic",
|
||||
Classification::Land => "Land",
|
||||
Classification::Hand => "Hand",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Classification::War => "Disciple of War",
|
||||
Classification::Magic => "Disciple of Magic",
|
||||
Classification::Land => "Disciple of the Land",
|
||||
Classification::Hand => "Disciple of the Hand",
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Classification::War => "Disciple of War",
|
||||
Classification::Magic => "Disciple of Magic",
|
||||
Classification::Land => "Disciple of the Land",
|
||||
Classification::Hand => "Disciple of the Hand",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Classification {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let class = match s.to_lowercase().as_str() {
|
||||
"disciple of war" | "war" => Classification::War,
|
||||
"disciple of magic" | "magic" => Classification::Magic,
|
||||
"disciple of the land" | "land" => Classification::Land,
|
||||
"disciple of the hand" | "hand" => Classification::Hand,
|
||||
_ => return Err(UnknownVariant("Classification", s.into()))
|
||||
};
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let class = match s.to_lowercase().as_str() {
|
||||
"disciple of war" | "war" => Classification::War,
|
||||
"disciple of magic" | "magic" => Classification::Magic,
|
||||
"disciple of the land" | "land" => Classification::Land,
|
||||
"disciple of the hand" | "hand" => Classification::Hand,
|
||||
_ => return Err(UnknownVariant("Classification", s.into()))
|
||||
};
|
||||
|
||||
Ok(class)
|
||||
}
|
||||
Ok(class)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Classification {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,123 +11,122 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum NonCombatJob {
|
||||
// Gatherers
|
||||
Botanist,
|
||||
Fisher,
|
||||
Miner,
|
||||
// Gatherers
|
||||
Botanist,
|
||||
Fisher,
|
||||
Miner,
|
||||
|
||||
// Crafters
|
||||
Alchemist,
|
||||
Armorer,
|
||||
Blacksmith,
|
||||
Carpenter,
|
||||
Culinarian,
|
||||
Goldsmith,
|
||||
Leatherworker,
|
||||
Weaver,
|
||||
// Crafters
|
||||
Alchemist,
|
||||
Armorer,
|
||||
Blacksmith,
|
||||
Carpenter,
|
||||
Culinarian,
|
||||
Goldsmith,
|
||||
Leatherworker,
|
||||
Weaver,
|
||||
}
|
||||
|
||||
impl NonCombatJob {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [NonCombatJob; 11] = [
|
||||
NonCombatJob::Botanist,
|
||||
NonCombatJob::Fisher,
|
||||
NonCombatJob::Miner,
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [NonCombatJob; 11] = [
|
||||
NonCombatJob::Botanist,
|
||||
NonCombatJob::Fisher,
|
||||
NonCombatJob::Miner,
|
||||
NonCombatJob::Alchemist,
|
||||
NonCombatJob::Armorer,
|
||||
NonCombatJob::Blacksmith,
|
||||
NonCombatJob::Carpenter,
|
||||
NonCombatJob::Culinarian,
|
||||
NonCombatJob::Goldsmith,
|
||||
NonCombatJob::Leatherworker,
|
||||
NonCombatJob::Weaver,
|
||||
];
|
||||
|
||||
NonCombatJob::Alchemist,
|
||||
NonCombatJob::Armorer,
|
||||
NonCombatJob::Blacksmith,
|
||||
NonCombatJob::Carpenter,
|
||||
NonCombatJob::Culinarian,
|
||||
NonCombatJob::Goldsmith,
|
||||
NonCombatJob::Leatherworker,
|
||||
NonCombatJob::Weaver,
|
||||
];
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
NonCombatJob::Botanist => "Botanist",
|
||||
NonCombatJob::Fisher => "Fisher",
|
||||
NonCombatJob::Miner => "Miner",
|
||||
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
NonCombatJob::Botanist => "Botanist",
|
||||
NonCombatJob::Fisher => "Fisher",
|
||||
NonCombatJob::Miner => "Miner",
|
||||
|
||||
NonCombatJob::Alchemist => "Alchemist",
|
||||
NonCombatJob::Armorer => "Armorer",
|
||||
NonCombatJob::Blacksmith => "Blacksmith",
|
||||
NonCombatJob::Carpenter => "Carpenter",
|
||||
NonCombatJob::Culinarian => "Culinarian",
|
||||
NonCombatJob::Goldsmith => "Goldsmith",
|
||||
NonCombatJob::Leatherworker => "Leatherworker",
|
||||
NonCombatJob::Weaver => "Weaver",
|
||||
NonCombatJob::Alchemist => "Alchemist",
|
||||
NonCombatJob::Armorer => "Armorer",
|
||||
NonCombatJob::Blacksmith => "Blacksmith",
|
||||
NonCombatJob::Carpenter => "Carpenter",
|
||||
NonCombatJob::Culinarian => "Culinarian",
|
||||
NonCombatJob::Goldsmith => "Goldsmith",
|
||||
NonCombatJob::Leatherworker => "Leatherworker",
|
||||
NonCombatJob::Weaver => "Weaver",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
// if any variants with spaces are added, this must be changed
|
||||
self.as_str()
|
||||
}
|
||||
|
||||
pub fn code(&self) -> &'static str {
|
||||
match *self {
|
||||
NonCombatJob::Botanist => "BTN",
|
||||
NonCombatJob::Fisher => "FSH",
|
||||
NonCombatJob::Miner => "MIN",
|
||||
|
||||
NonCombatJob::Alchemist => "ALC",
|
||||
NonCombatJob::Armorer => "ARM",
|
||||
NonCombatJob::Blacksmith => "BSM",
|
||||
NonCombatJob::Carpenter => "CRP",
|
||||
NonCombatJob::Culinarian => "CUL",
|
||||
NonCombatJob::Goldsmith => "GSM",
|
||||
NonCombatJob::Leatherworker => "LTW",
|
||||
NonCombatJob::Weaver => "WVR",
|
||||
pub fn name(&self) -> &'static str {
|
||||
// if any variants with spaces are added, this must be changed
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "job_classifications")]
|
||||
pub fn classification(&self) -> Classification {
|
||||
match *self {
|
||||
NonCombatJob::Botanist |
|
||||
NonCombatJob::Fisher |
|
||||
NonCombatJob::Miner => Classification::Land,
|
||||
pub fn code(&self) -> &'static str {
|
||||
match *self {
|
||||
NonCombatJob::Botanist => "BTN",
|
||||
NonCombatJob::Fisher => "FSH",
|
||||
NonCombatJob::Miner => "MIN",
|
||||
|
||||
NonCombatJob::Alchemist |
|
||||
NonCombatJob::Armorer |
|
||||
NonCombatJob::Blacksmith |
|
||||
NonCombatJob::Carpenter |
|
||||
NonCombatJob::Culinarian |
|
||||
NonCombatJob::Goldsmith |
|
||||
NonCombatJob::Leatherworker |
|
||||
NonCombatJob::Weaver => Classification::Hand,
|
||||
NonCombatJob::Alchemist => "ALC",
|
||||
NonCombatJob::Armorer => "ARM",
|
||||
NonCombatJob::Blacksmith => "BSM",
|
||||
NonCombatJob::Carpenter => "CRP",
|
||||
NonCombatJob::Culinarian => "CUL",
|
||||
NonCombatJob::Goldsmith => "GSM",
|
||||
NonCombatJob::Leatherworker => "LTW",
|
||||
NonCombatJob::Weaver => "WVR",
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "job_classifications")]
|
||||
pub fn classification(&self) -> Classification {
|
||||
match *self {
|
||||
NonCombatJob::Botanist |
|
||||
NonCombatJob::Fisher |
|
||||
NonCombatJob::Miner => Classification::Land,
|
||||
|
||||
NonCombatJob::Alchemist |
|
||||
NonCombatJob::Armorer |
|
||||
NonCombatJob::Blacksmith |
|
||||
NonCombatJob::Carpenter |
|
||||
NonCombatJob::Culinarian |
|
||||
NonCombatJob::Goldsmith |
|
||||
NonCombatJob::Leatherworker |
|
||||
NonCombatJob::Weaver => Classification::Hand,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for NonCombatJob {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let job = match s.to_lowercase().as_str() {
|
||||
"botanist" | "btn" => NonCombatJob::Botanist,
|
||||
"fisher" | "fsh" => NonCombatJob::Fisher,
|
||||
"miner" | "min" => NonCombatJob::Miner,
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let job = match s.to_lowercase().as_str() {
|
||||
"botanist" | "btn" => NonCombatJob::Botanist,
|
||||
"fisher" | "fsh" => NonCombatJob::Fisher,
|
||||
"miner" | "min" => NonCombatJob::Miner,
|
||||
|
||||
"alchemist" | "alc" => NonCombatJob::Alchemist,
|
||||
"armorer" | "arm" => NonCombatJob::Armorer,
|
||||
"blacksmith" | "bsm" => NonCombatJob::Blacksmith,
|
||||
"carpenter" | "crp" => NonCombatJob::Carpenter,
|
||||
"culinarian" | "cul" => NonCombatJob::Culinarian,
|
||||
"goldsmith" | "gsm" => NonCombatJob::Goldsmith,
|
||||
"leatherworker" | "ltw" => NonCombatJob::Leatherworker,
|
||||
"weaver" | "wvr" => NonCombatJob::Weaver,
|
||||
_ => return Err(UnknownVariant("NonCombatJob", s.into()))
|
||||
};
|
||||
"alchemist" | "alc" => NonCombatJob::Alchemist,
|
||||
"armorer" | "arm" => NonCombatJob::Armorer,
|
||||
"blacksmith" | "bsm" => NonCombatJob::Blacksmith,
|
||||
"carpenter" | "crp" => NonCombatJob::Carpenter,
|
||||
"culinarian" | "cul" => NonCombatJob::Culinarian,
|
||||
"goldsmith" | "gsm" => NonCombatJob::Goldsmith,
|
||||
"leatherworker" | "ltw" => NonCombatJob::Leatherworker,
|
||||
"weaver" | "wvr" => NonCombatJob::Weaver,
|
||||
_ => return Err(UnknownVariant("NonCombatJob", s.into()))
|
||||
};
|
||||
|
||||
Ok(job)
|
||||
}
|
||||
Ok(job)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for NonCombatJob {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
150
src/races.rs
150
src/races.rs
|
@ -12,96 +12,96 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Race {
|
||||
AuRa,
|
||||
Elezen,
|
||||
Hrothgar,
|
||||
Hyur,
|
||||
Lalafell,
|
||||
Miqote,
|
||||
Roegadyn,
|
||||
Viera,
|
||||
AuRa,
|
||||
Elezen,
|
||||
Hrothgar,
|
||||
Hyur,
|
||||
Lalafell,
|
||||
Miqote,
|
||||
Roegadyn,
|
||||
Viera,
|
||||
}
|
||||
|
||||
impl Race {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Race; 8] = [
|
||||
Race::AuRa,
|
||||
Race::Elezen,
|
||||
Race::Hrothgar,
|
||||
Race::Hyur,
|
||||
Race::Lalafell,
|
||||
Race::Miqote,
|
||||
Race::Roegadyn,
|
||||
Race::Viera,
|
||||
];
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Race; 8] = [
|
||||
Race::AuRa,
|
||||
Race::Elezen,
|
||||
Race::Hrothgar,
|
||||
Race::Hyur,
|
||||
Race::Lalafell,
|
||||
Race::Miqote,
|
||||
Race::Roegadyn,
|
||||
Race::Viera,
|
||||
];
|
||||
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Race::AuRa => "AuRa",
|
||||
Race::Elezen => "Elezen",
|
||||
Race::Hrothgar => "Hrothgar",
|
||||
Race::Hyur => "Hyur",
|
||||
Race::Lalafell => "Lalafell",
|
||||
Race::Miqote => "Miqote",
|
||||
Race::Roegadyn => "Roegadyn",
|
||||
Race::Viera => "Viera",
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Race::AuRa => "AuRa",
|
||||
Race::Elezen => "Elezen",
|
||||
Race::Hrothgar => "Hrothgar",
|
||||
Race::Hyur => "Hyur",
|
||||
Race::Lalafell => "Lalafell",
|
||||
Race::Miqote => "Miqote",
|
||||
Race::Roegadyn => "Roegadyn",
|
||||
Race::Viera => "Viera",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Race::AuRa => "Au Ra",
|
||||
Race::Elezen => "Elezen",
|
||||
Race::Hrothgar => "Hrothgar",
|
||||
Race::Hyur => "Hyur",
|
||||
Race::Lalafell => "Lalafell",
|
||||
Race::Miqote => "Miqo'te",
|
||||
Race::Roegadyn => "Roegadyn",
|
||||
Race::Viera => "Viera",
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Race::AuRa => "Au Ra",
|
||||
Race::Elezen => "Elezen",
|
||||
Race::Hrothgar => "Hrothgar",
|
||||
Race::Hyur => "Hyur",
|
||||
Race::Lalafell => "Lalafell",
|
||||
Race::Miqote => "Miqo'te",
|
||||
Race::Roegadyn => "Roegadyn",
|
||||
Race::Viera => "Viera",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "clans")]
|
||||
pub fn clans(&self) -> [Clan; 2] {
|
||||
match *self {
|
||||
Race::AuRa => [Clan::Raen, Clan::Xaela],
|
||||
Race::Elezen => [Clan::Duskwight, Clan::Wildwood],
|
||||
Race::Hrothgar => [Clan::Helion, Clan::TheLost],
|
||||
Race::Hyur => [Clan::Highlander, Clan::Midlander],
|
||||
Race::Lalafell => [Clan::Dunesfolk, Clan::Plainsfolk],
|
||||
Race::Miqote => [Clan::KeeperOfTheMoon, Clan::SeekerOfTheSun],
|
||||
Race::Roegadyn => [Clan::Hellsguard, Clan::SeaWolf],
|
||||
Race::Viera => [Clan::Rava, Clan::Veena],
|
||||
#[cfg(feature = "clans")]
|
||||
pub fn clans(&self) -> [Clan; 2] {
|
||||
match *self {
|
||||
Race::AuRa => [Clan::Raen, Clan::Xaela],
|
||||
Race::Elezen => [Clan::Duskwight, Clan::Wildwood],
|
||||
Race::Hrothgar => [Clan::Helion, Clan::TheLost],
|
||||
Race::Hyur => [Clan::Highlander, Clan::Midlander],
|
||||
Race::Lalafell => [Clan::Dunesfolk, Clan::Plainsfolk],
|
||||
Race::Miqote => [Clan::KeeperOfTheMoon, Clan::SeekerOfTheSun],
|
||||
Race::Roegadyn => [Clan::Hellsguard, Clan::SeaWolf],
|
||||
Race::Viera => [Clan::Rava, Clan::Veena],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Race {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let world = match s.to_lowercase().as_str() {
|
||||
"aura" | "au ra" => Race::AuRa,
|
||||
"elezen" => Race::Elezen,
|
||||
"hrothgar" => Race::Hrothgar,
|
||||
"hyur" => Race::Hyur,
|
||||
"lalafell" => Race::Lalafell,
|
||||
"miqote" | "miqo'te" => Race::Miqote,
|
||||
"roegadyn" => Race::Roegadyn,
|
||||
"viera" => Race::Viera,
|
||||
_ => return Err(UnknownVariant("Race", s.into()))
|
||||
};
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let world = match s.to_lowercase().as_str() {
|
||||
"aura" | "au ra" => Race::AuRa,
|
||||
"elezen" => Race::Elezen,
|
||||
"hrothgar" => Race::Hrothgar,
|
||||
"hyur" => Race::Hyur,
|
||||
"lalafell" => Race::Lalafell,
|
||||
"miqote" | "miqo'te" => Race::Miqote,
|
||||
"roegadyn" => Race::Roegadyn,
|
||||
"viera" => Race::Viera,
|
||||
_ => return Err(UnknownVariant("Race", s.into()))
|
||||
};
|
||||
|
||||
Ok(world)
|
||||
}
|
||||
Ok(world)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Race {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
60
src/roles.rs
60
src/roles.rs
|
@ -13,49 +13,49 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Role {
|
||||
Dps,
|
||||
Healer,
|
||||
Tank,
|
||||
Dps,
|
||||
Healer,
|
||||
Tank,
|
||||
}
|
||||
|
||||
impl Role {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Role; 3] = [Role::Dps, Role::Healer, Role::Tank];
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [Role; 3] = [Role::Dps, Role::Healer, Role::Tank];
|
||||
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Role::Dps => "Dps",
|
||||
Role::Healer => "Healer",
|
||||
Role::Tank => "Tank",
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Role::Dps => "Dps",
|
||||
Role::Healer => "Healer",
|
||||
Role::Tank => "Tank",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Role::Dps => "DPS",
|
||||
Role::Healer => "Healer",
|
||||
Role::Tank => "Tank",
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
Role::Dps => "DPS",
|
||||
Role::Healer => "Healer",
|
||||
Role::Tank => "Tank",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Role {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let role = match s.to_lowercase().as_str() {
|
||||
"dps" => Role::Dps,
|
||||
"healer" => Role::Healer,
|
||||
"tank" => Role::Tank,
|
||||
_ => return Err(UnknownVariant("Role", s.into()))
|
||||
};
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let role = match s.to_lowercase().as_str() {
|
||||
"dps" => Role::Dps,
|
||||
"healer" => Role::Healer,
|
||||
"tank" => Role::Tank,
|
||||
_ => return Err(UnknownVariant("Role", s.into()))
|
||||
};
|
||||
|
||||
Ok(role)
|
||||
}
|
||||
Ok(role)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Role {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
788
src/worlds.rs
788
src/worlds.rs
|
@ -13,442 +13,442 @@ use std::str::FromStr;
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum World {
|
||||
// Aether
|
||||
Adamantoise,
|
||||
Cactuar,
|
||||
Faerie,
|
||||
Gilgamesh,
|
||||
Jenova,
|
||||
Midgardsormr,
|
||||
Sargatanas,
|
||||
Siren,
|
||||
// Aether
|
||||
Adamantoise,
|
||||
Cactuar,
|
||||
Faerie,
|
||||
Gilgamesh,
|
||||
Jenova,
|
||||
Midgardsormr,
|
||||
Sargatanas,
|
||||
Siren,
|
||||
|
||||
// Chaos
|
||||
Cerberus,
|
||||
Louisoix,
|
||||
Moogle,
|
||||
Omega,
|
||||
Ragnarok,
|
||||
Spriggan,
|
||||
// Chaos
|
||||
Cerberus,
|
||||
Louisoix,
|
||||
Moogle,
|
||||
Omega,
|
||||
Ragnarok,
|
||||
Spriggan,
|
||||
|
||||
// Crystal
|
||||
Balmung,
|
||||
Brynhildr,
|
||||
Coeurl,
|
||||
Diabolos,
|
||||
Goblin,
|
||||
Malboro,
|
||||
Mateus,
|
||||
Zalera,
|
||||
// Crystal
|
||||
Balmung,
|
||||
Brynhildr,
|
||||
Coeurl,
|
||||
Diabolos,
|
||||
Goblin,
|
||||
Malboro,
|
||||
Mateus,
|
||||
Zalera,
|
||||
|
||||
// Elemental
|
||||
Aegis,
|
||||
Atomos,
|
||||
Carbuncle,
|
||||
Garuda,
|
||||
Gungnir,
|
||||
Kujata,
|
||||
Ramuh,
|
||||
Tonberry,
|
||||
Typhon,
|
||||
Unicorn,
|
||||
// Elemental
|
||||
Aegis,
|
||||
Atomos,
|
||||
Carbuncle,
|
||||
Garuda,
|
||||
Gungnir,
|
||||
Kujata,
|
||||
Ramuh,
|
||||
Tonberry,
|
||||
Typhon,
|
||||
Unicorn,
|
||||
|
||||
// Gaia
|
||||
Alexander,
|
||||
Bahamut,
|
||||
Durandal,
|
||||
Fenrir,
|
||||
Ifrit,
|
||||
Ridill,
|
||||
Tiamat,
|
||||
Ultima,
|
||||
Valefor,
|
||||
Yojimbo,
|
||||
Zeromus,
|
||||
// Gaia
|
||||
Alexander,
|
||||
Bahamut,
|
||||
Durandal,
|
||||
Fenrir,
|
||||
Ifrit,
|
||||
Ridill,
|
||||
Tiamat,
|
||||
Ultima,
|
||||
Valefor,
|
||||
Yojimbo,
|
||||
Zeromus,
|
||||
|
||||
// Light
|
||||
Lich,
|
||||
Odin,
|
||||
Phoenix,
|
||||
Shiva,
|
||||
Twintania,
|
||||
Zodiark,
|
||||
// Light
|
||||
Lich,
|
||||
Odin,
|
||||
Phoenix,
|
||||
Shiva,
|
||||
Twintania,
|
||||
Zodiark,
|
||||
|
||||
// Mana
|
||||
Anima,
|
||||
Asura,
|
||||
Belias,
|
||||
Chocobo,
|
||||
Hades,
|
||||
Ixion,
|
||||
Mandragora,
|
||||
Masamune,
|
||||
Pandaemonium,
|
||||
Shinryu,
|
||||
Titan,
|
||||
// Mana
|
||||
Anima,
|
||||
Asura,
|
||||
Belias,
|
||||
Chocobo,
|
||||
Hades,
|
||||
Ixion,
|
||||
Mandragora,
|
||||
Masamune,
|
||||
Pandaemonium,
|
||||
Shinryu,
|
||||
Titan,
|
||||
|
||||
// Primal
|
||||
Behemoth,
|
||||
Excalibur,
|
||||
Exodus,
|
||||
Famfrit,
|
||||
Hyperion,
|
||||
Lamia,
|
||||
Leviathan,
|
||||
Ultros,
|
||||
// Primal
|
||||
Behemoth,
|
||||
Excalibur,
|
||||
Exodus,
|
||||
Famfrit,
|
||||
Hyperion,
|
||||
Lamia,
|
||||
Leviathan,
|
||||
Ultros,
|
||||
}
|
||||
|
||||
impl World {
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [World; 68] = [
|
||||
// Aether
|
||||
World::Adamantoise,
|
||||
World::Cactuar,
|
||||
World::Faerie,
|
||||
World::Gilgamesh,
|
||||
World::Jenova,
|
||||
World::Midgardsormr,
|
||||
World::Sargatanas,
|
||||
World::Siren,
|
||||
#[cfg(feature = "all_const")]
|
||||
pub const ALL: [World; 68] = [
|
||||
// Aether
|
||||
World::Adamantoise,
|
||||
World::Cactuar,
|
||||
World::Faerie,
|
||||
World::Gilgamesh,
|
||||
World::Jenova,
|
||||
World::Midgardsormr,
|
||||
World::Sargatanas,
|
||||
World::Siren,
|
||||
|
||||
// Chaos
|
||||
World::Cerberus,
|
||||
World::Louisoix,
|
||||
World::Moogle,
|
||||
World::Omega,
|
||||
World::Ragnarok,
|
||||
World::Spriggan,
|
||||
// Chaos
|
||||
World::Cerberus,
|
||||
World::Louisoix,
|
||||
World::Moogle,
|
||||
World::Omega,
|
||||
World::Ragnarok,
|
||||
World::Spriggan,
|
||||
|
||||
// Crystal
|
||||
World::Balmung,
|
||||
World::Brynhildr,
|
||||
World::Coeurl,
|
||||
World::Diabolos,
|
||||
World::Goblin,
|
||||
World::Malboro,
|
||||
World::Mateus,
|
||||
World::Zalera,
|
||||
// Crystal
|
||||
World::Balmung,
|
||||
World::Brynhildr,
|
||||
World::Coeurl,
|
||||
World::Diabolos,
|
||||
World::Goblin,
|
||||
World::Malboro,
|
||||
World::Mateus,
|
||||
World::Zalera,
|
||||
|
||||
// Elemental
|
||||
World::Aegis,
|
||||
World::Atomos,
|
||||
World::Carbuncle,
|
||||
World::Garuda,
|
||||
World::Gungnir,
|
||||
World::Kujata,
|
||||
World::Ramuh,
|
||||
World::Tonberry,
|
||||
World::Typhon,
|
||||
World::Unicorn,
|
||||
// Elemental
|
||||
World::Aegis,
|
||||
World::Atomos,
|
||||
World::Carbuncle,
|
||||
World::Garuda,
|
||||
World::Gungnir,
|
||||
World::Kujata,
|
||||
World::Ramuh,
|
||||
World::Tonberry,
|
||||
World::Typhon,
|
||||
World::Unicorn,
|
||||
|
||||
// Gaia
|
||||
World::Alexander,
|
||||
World::Bahamut,
|
||||
World::Durandal,
|
||||
World::Fenrir,
|
||||
World::Ifrit,
|
||||
World::Ridill,
|
||||
World::Tiamat,
|
||||
World::Ultima,
|
||||
World::Valefor,
|
||||
World::Yojimbo,
|
||||
World::Zeromus,
|
||||
// Gaia
|
||||
World::Alexander,
|
||||
World::Bahamut,
|
||||
World::Durandal,
|
||||
World::Fenrir,
|
||||
World::Ifrit,
|
||||
World::Ridill,
|
||||
World::Tiamat,
|
||||
World::Ultima,
|
||||
World::Valefor,
|
||||
World::Yojimbo,
|
||||
World::Zeromus,
|
||||
|
||||
// Light
|
||||
World::Lich,
|
||||
World::Odin,
|
||||
World::Phoenix,
|
||||
World::Shiva,
|
||||
World::Twintania,
|
||||
World::Zodiark,
|
||||
// Light
|
||||
World::Lich,
|
||||
World::Odin,
|
||||
World::Phoenix,
|
||||
World::Shiva,
|
||||
World::Twintania,
|
||||
World::Zodiark,
|
||||
|
||||
// Mana
|
||||
World::Anima,
|
||||
World::Asura,
|
||||
World::Belias,
|
||||
World::Chocobo,
|
||||
World::Hades,
|
||||
World::Ixion,
|
||||
World::Mandragora,
|
||||
World::Masamune,
|
||||
World::Pandaemonium,
|
||||
World::Shinryu,
|
||||
World::Titan,
|
||||
// Mana
|
||||
World::Anima,
|
||||
World::Asura,
|
||||
World::Belias,
|
||||
World::Chocobo,
|
||||
World::Hades,
|
||||
World::Ixion,
|
||||
World::Mandragora,
|
||||
World::Masamune,
|
||||
World::Pandaemonium,
|
||||
World::Shinryu,
|
||||
World::Titan,
|
||||
|
||||
// Primal
|
||||
World::Behemoth,
|
||||
World::Excalibur,
|
||||
World::Exodus,
|
||||
World::Famfrit,
|
||||
World::Hyperion,
|
||||
World::Lamia,
|
||||
World::Leviathan,
|
||||
World::Ultros,
|
||||
];
|
||||
// Primal
|
||||
World::Behemoth,
|
||||
World::Excalibur,
|
||||
World::Exodus,
|
||||
World::Famfrit,
|
||||
World::Hyperion,
|
||||
World::Lamia,
|
||||
World::Leviathan,
|
||||
World::Ultros,
|
||||
];
|
||||
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
World::Adamantoise => "Adamantoise",
|
||||
World::Cactuar => "Cactuar",
|
||||
World::Faerie => "Faerie",
|
||||
World::Gilgamesh => "Gilgamesh",
|
||||
World::Jenova => "Jenova",
|
||||
World::Midgardsormr => "Midgardsormr",
|
||||
World::Sargatanas => "Sargatanas",
|
||||
World::Siren => "Siren",
|
||||
/// Returns the string variant of this world.
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
World::Adamantoise => "Adamantoise",
|
||||
World::Cactuar => "Cactuar",
|
||||
World::Faerie => "Faerie",
|
||||
World::Gilgamesh => "Gilgamesh",
|
||||
World::Jenova => "Jenova",
|
||||
World::Midgardsormr => "Midgardsormr",
|
||||
World::Sargatanas => "Sargatanas",
|
||||
World::Siren => "Siren",
|
||||
|
||||
World::Cerberus => "Cerberus",
|
||||
World::Louisoix => "Louisoix",
|
||||
World::Moogle => "Moogle",
|
||||
World::Omega => "Omega",
|
||||
World::Ragnarok => "Ragnarok",
|
||||
World::Spriggan => "Spriggan",
|
||||
World::Cerberus => "Cerberus",
|
||||
World::Louisoix => "Louisoix",
|
||||
World::Moogle => "Moogle",
|
||||
World::Omega => "Omega",
|
||||
World::Ragnarok => "Ragnarok",
|
||||
World::Spriggan => "Spriggan",
|
||||
|
||||
World::Balmung => "Balmung",
|
||||
World::Brynhildr => "Brynhildr",
|
||||
World::Coeurl => "Coeurl",
|
||||
World::Diabolos => "Diabolos",
|
||||
World::Goblin => "Goblin",
|
||||
World::Malboro => "Malboro",
|
||||
World::Mateus => "Mateus",
|
||||
World::Zalera => "Zalera",
|
||||
World::Balmung => "Balmung",
|
||||
World::Brynhildr => "Brynhildr",
|
||||
World::Coeurl => "Coeurl",
|
||||
World::Diabolos => "Diabolos",
|
||||
World::Goblin => "Goblin",
|
||||
World::Malboro => "Malboro",
|
||||
World::Mateus => "Mateus",
|
||||
World::Zalera => "Zalera",
|
||||
|
||||
World::Aegis => "Aegis",
|
||||
World::Atomos => "Atomos",
|
||||
World::Carbuncle => "Carbuncle",
|
||||
World::Garuda => "Garuda",
|
||||
World::Gungnir => "Gungnir",
|
||||
World::Kujata => "Kujata",
|
||||
World::Ramuh => "Ramuh",
|
||||
World::Tonberry => "Tonberry",
|
||||
World::Typhon => "Typhon",
|
||||
World::Unicorn => "Unicorn",
|
||||
World::Aegis => "Aegis",
|
||||
World::Atomos => "Atomos",
|
||||
World::Carbuncle => "Carbuncle",
|
||||
World::Garuda => "Garuda",
|
||||
World::Gungnir => "Gungnir",
|
||||
World::Kujata => "Kujata",
|
||||
World::Ramuh => "Ramuh",
|
||||
World::Tonberry => "Tonberry",
|
||||
World::Typhon => "Typhon",
|
||||
World::Unicorn => "Unicorn",
|
||||
|
||||
World::Alexander => "Alexander",
|
||||
World::Bahamut => "Bahamut",
|
||||
World::Durandal => "Durandal",
|
||||
World::Fenrir => "Fenrir",
|
||||
World::Ifrit => "Ifrit",
|
||||
World::Ridill => "Ridill",
|
||||
World::Tiamat => "Tiamat",
|
||||
World::Ultima => "Ultima",
|
||||
World::Valefor => "Valefor",
|
||||
World::Yojimbo => "Yojimbo",
|
||||
World::Zeromus => "Zeromus",
|
||||
World::Alexander => "Alexander",
|
||||
World::Bahamut => "Bahamut",
|
||||
World::Durandal => "Durandal",
|
||||
World::Fenrir => "Fenrir",
|
||||
World::Ifrit => "Ifrit",
|
||||
World::Ridill => "Ridill",
|
||||
World::Tiamat => "Tiamat",
|
||||
World::Ultima => "Ultima",
|
||||
World::Valefor => "Valefor",
|
||||
World::Yojimbo => "Yojimbo",
|
||||
World::Zeromus => "Zeromus",
|
||||
|
||||
World::Lich => "Lich",
|
||||
World::Odin => "Odin",
|
||||
World::Phoenix => "Phoenix",
|
||||
World::Shiva => "Shiva",
|
||||
World::Twintania => "Twintania",
|
||||
World::Zodiark => "Zodiark",
|
||||
World::Lich => "Lich",
|
||||
World::Odin => "Odin",
|
||||
World::Phoenix => "Phoenix",
|
||||
World::Shiva => "Shiva",
|
||||
World::Twintania => "Twintania",
|
||||
World::Zodiark => "Zodiark",
|
||||
|
||||
World::Anima => "Anima",
|
||||
World::Asura => "Asura",
|
||||
World::Belias => "Belias",
|
||||
World::Chocobo => "Chocobo",
|
||||
World::Hades => "Hades",
|
||||
World::Ixion => "Ixion",
|
||||
World::Mandragora => "Mandragora",
|
||||
World::Masamune => "Masamune",
|
||||
World::Pandaemonium => "Pandaemonium",
|
||||
World::Shinryu => "Shinryu",
|
||||
World::Titan => "Titan",
|
||||
World::Anima => "Anima",
|
||||
World::Asura => "Asura",
|
||||
World::Belias => "Belias",
|
||||
World::Chocobo => "Chocobo",
|
||||
World::Hades => "Hades",
|
||||
World::Ixion => "Ixion",
|
||||
World::Mandragora => "Mandragora",
|
||||
World::Masamune => "Masamune",
|
||||
World::Pandaemonium => "Pandaemonium",
|
||||
World::Shinryu => "Shinryu",
|
||||
World::Titan => "Titan",
|
||||
|
||||
World::Behemoth => "Behemoth",
|
||||
World::Excalibur => "Excalibur",
|
||||
World::Exodus => "Exodus",
|
||||
World::Famfrit => "Famfrit",
|
||||
World::Hyperion => "Hyperion",
|
||||
World::Lamia => "Lamia",
|
||||
World::Leviathan => "Leviathan",
|
||||
World::Ultros => "Ultros",
|
||||
World::Behemoth => "Behemoth",
|
||||
World::Excalibur => "Excalibur",
|
||||
World::Exodus => "Exodus",
|
||||
World::Famfrit => "Famfrit",
|
||||
World::Hyperion => "Hyperion",
|
||||
World::Lamia => "Lamia",
|
||||
World::Leviathan => "Leviathan",
|
||||
World::Ultros => "Ultros",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
// if any variants with spaces are added, this must be changed
|
||||
self.as_str()
|
||||
}
|
||||
|
||||
/// Returns the [`DataCenter`] this world is on.
|
||||
#[cfg(feature = "data_centers")]
|
||||
pub fn data_center(&self) -> DataCenter {
|
||||
match *self {
|
||||
World::Adamantoise |
|
||||
World::Cactuar |
|
||||
World::Faerie |
|
||||
World::Gilgamesh |
|
||||
World::Jenova |
|
||||
World::Midgardsormr |
|
||||
World::Sargatanas |
|
||||
World::Siren => DataCenter::Aether,
|
||||
|
||||
World::Cerberus |
|
||||
World::Louisoix |
|
||||
World::Moogle |
|
||||
World::Omega |
|
||||
World::Ragnarok |
|
||||
World::Spriggan => DataCenter::Chaos,
|
||||
|
||||
World::Balmung |
|
||||
World::Brynhildr |
|
||||
World::Coeurl |
|
||||
World::Diabolos |
|
||||
World::Goblin |
|
||||
World::Malboro |
|
||||
World::Mateus |
|
||||
World::Zalera => DataCenter::Crystal,
|
||||
|
||||
World::Aegis |
|
||||
World::Atomos |
|
||||
World::Carbuncle |
|
||||
World::Garuda |
|
||||
World::Gungnir |
|
||||
World::Kujata |
|
||||
World::Ramuh |
|
||||
World::Tonberry |
|
||||
World::Typhon |
|
||||
World::Unicorn => DataCenter::Elemental,
|
||||
|
||||
World::Alexander |
|
||||
World::Bahamut |
|
||||
World::Durandal |
|
||||
World::Fenrir |
|
||||
World::Ifrit |
|
||||
World::Ridill |
|
||||
World::Tiamat |
|
||||
World::Ultima |
|
||||
World::Valefor |
|
||||
World::Yojimbo |
|
||||
World::Zeromus => DataCenter::Gaia,
|
||||
|
||||
World::Lich |
|
||||
World::Odin |
|
||||
World::Phoenix |
|
||||
World::Shiva |
|
||||
World::Twintania |
|
||||
World::Zodiark => DataCenter::Light,
|
||||
|
||||
World::Anima |
|
||||
World::Asura |
|
||||
World::Belias |
|
||||
World::Chocobo |
|
||||
World::Hades |
|
||||
World::Ixion |
|
||||
World::Mandragora |
|
||||
World::Masamune |
|
||||
World::Pandaemonium |
|
||||
World::Shinryu |
|
||||
World::Titan => DataCenter::Mana,
|
||||
|
||||
// Primal
|
||||
World::Behemoth |
|
||||
World::Excalibur |
|
||||
World::Exodus |
|
||||
World::Famfrit |
|
||||
World::Hyperion |
|
||||
World::Lamia |
|
||||
World::Leviathan |
|
||||
World::Ultros => DataCenter::Primal,
|
||||
pub fn name(&self) -> &'static str {
|
||||
// if any variants with spaces are added, this must be changed
|
||||
self.as_str()
|
||||
}
|
||||
|
||||
/// Returns the [`DataCenter`] this world is on.
|
||||
#[cfg(feature = "data_centers")]
|
||||
pub fn data_center(&self) -> DataCenter {
|
||||
match *self {
|
||||
World::Adamantoise |
|
||||
World::Cactuar |
|
||||
World::Faerie |
|
||||
World::Gilgamesh |
|
||||
World::Jenova |
|
||||
World::Midgardsormr |
|
||||
World::Sargatanas |
|
||||
World::Siren => DataCenter::Aether,
|
||||
|
||||
World::Cerberus |
|
||||
World::Louisoix |
|
||||
World::Moogle |
|
||||
World::Omega |
|
||||
World::Ragnarok |
|
||||
World::Spriggan => DataCenter::Chaos,
|
||||
|
||||
World::Balmung |
|
||||
World::Brynhildr |
|
||||
World::Coeurl |
|
||||
World::Diabolos |
|
||||
World::Goblin |
|
||||
World::Malboro |
|
||||
World::Mateus |
|
||||
World::Zalera => DataCenter::Crystal,
|
||||
|
||||
World::Aegis |
|
||||
World::Atomos |
|
||||
World::Carbuncle |
|
||||
World::Garuda |
|
||||
World::Gungnir |
|
||||
World::Kujata |
|
||||
World::Ramuh |
|
||||
World::Tonberry |
|
||||
World::Typhon |
|
||||
World::Unicorn => DataCenter::Elemental,
|
||||
|
||||
World::Alexander |
|
||||
World::Bahamut |
|
||||
World::Durandal |
|
||||
World::Fenrir |
|
||||
World::Ifrit |
|
||||
World::Ridill |
|
||||
World::Tiamat |
|
||||
World::Ultima |
|
||||
World::Valefor |
|
||||
World::Yojimbo |
|
||||
World::Zeromus => DataCenter::Gaia,
|
||||
|
||||
World::Lich |
|
||||
World::Odin |
|
||||
World::Phoenix |
|
||||
World::Shiva |
|
||||
World::Twintania |
|
||||
World::Zodiark => DataCenter::Light,
|
||||
|
||||
World::Anima |
|
||||
World::Asura |
|
||||
World::Belias |
|
||||
World::Chocobo |
|
||||
World::Hades |
|
||||
World::Ixion |
|
||||
World::Mandragora |
|
||||
World::Masamune |
|
||||
World::Pandaemonium |
|
||||
World::Shinryu |
|
||||
World::Titan => DataCenter::Mana,
|
||||
|
||||
// Primal
|
||||
World::Behemoth |
|
||||
World::Excalibur |
|
||||
World::Exodus |
|
||||
World::Famfrit |
|
||||
World::Hyperion |
|
||||
World::Lamia |
|
||||
World::Leviathan |
|
||||
World::Ultros => DataCenter::Primal,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for World {
|
||||
type Err = UnknownVariant;
|
||||
type Err = UnknownVariant;
|
||||
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let world = match s.to_lowercase().as_str() {
|
||||
"adamantoise" => World::Adamantoise,
|
||||
"cactuar" => World::Cactuar,
|
||||
"faerie" => World::Faerie,
|
||||
"gilgamesh" => World::Gilgamesh,
|
||||
"jenova" => World::Jenova,
|
||||
"midgardsormr" => World::Midgardsormr,
|
||||
"sargatanas" => World::Sargatanas,
|
||||
"siren" => World::Siren,
|
||||
/// Parses a string `s` to return a value of this type.
|
||||
///
|
||||
/// This is case-insensitive.
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let world = match s.to_lowercase().as_str() {
|
||||
"adamantoise" => World::Adamantoise,
|
||||
"cactuar" => World::Cactuar,
|
||||
"faerie" => World::Faerie,
|
||||
"gilgamesh" => World::Gilgamesh,
|
||||
"jenova" => World::Jenova,
|
||||
"midgardsormr" => World::Midgardsormr,
|
||||
"sargatanas" => World::Sargatanas,
|
||||
"siren" => World::Siren,
|
||||
|
||||
"cerberus" => World::Cerberus,
|
||||
"louisoix" => World::Louisoix,
|
||||
"moogle" => World::Moogle,
|
||||
"omega" => World::Omega,
|
||||
"ragnarok" => World::Ragnarok,
|
||||
"spriggan" => World::Spriggan,
|
||||
"cerberus" => World::Cerberus,
|
||||
"louisoix" => World::Louisoix,
|
||||
"moogle" => World::Moogle,
|
||||
"omega" => World::Omega,
|
||||
"ragnarok" => World::Ragnarok,
|
||||
"spriggan" => World::Spriggan,
|
||||
|
||||
"balmung" => World::Balmung,
|
||||
"brynhildr" => World::Brynhildr,
|
||||
"coeurl" => World::Coeurl,
|
||||
"diabolos" => World::Diabolos,
|
||||
"goblin" => World::Goblin,
|
||||
"malboro" => World::Malboro,
|
||||
"mateus" => World::Mateus,
|
||||
"zalera" => World::Zalera,
|
||||
"balmung" => World::Balmung,
|
||||
"brynhildr" => World::Brynhildr,
|
||||
"coeurl" => World::Coeurl,
|
||||
"diabolos" => World::Diabolos,
|
||||
"goblin" => World::Goblin,
|
||||
"malboro" => World::Malboro,
|
||||
"mateus" => World::Mateus,
|
||||
"zalera" => World::Zalera,
|
||||
|
||||
"aegis" => World::Aegis,
|
||||
"atomos" => World::Atomos,
|
||||
"carbuncle" => World::Carbuncle,
|
||||
"garuda" => World::Garuda,
|
||||
"gungnir" => World::Gungnir,
|
||||
"kujata" => World::Kujata,
|
||||
"ramuh" => World::Ramuh,
|
||||
"tonberry" => World::Tonberry,
|
||||
"typhon" => World::Typhon,
|
||||
"unicorn" => World::Unicorn,
|
||||
"aegis" => World::Aegis,
|
||||
"atomos" => World::Atomos,
|
||||
"carbuncle" => World::Carbuncle,
|
||||
"garuda" => World::Garuda,
|
||||
"gungnir" => World::Gungnir,
|
||||
"kujata" => World::Kujata,
|
||||
"ramuh" => World::Ramuh,
|
||||
"tonberry" => World::Tonberry,
|
||||
"typhon" => World::Typhon,
|
||||
"unicorn" => World::Unicorn,
|
||||
|
||||
"alexander" => World::Alexander,
|
||||
"bahamut" => World::Bahamut,
|
||||
"durandal" => World::Durandal,
|
||||
"fenrir" => World::Fenrir,
|
||||
"ifrit" => World::Ifrit,
|
||||
"ridill" => World::Ridill,
|
||||
"tiamat" => World::Tiamat,
|
||||
"ultima" => World::Ultima,
|
||||
"valefor" => World::Valefor,
|
||||
"yojimbo" => World::Yojimbo,
|
||||
"zeromus" => World::Zeromus,
|
||||
"alexander" => World::Alexander,
|
||||
"bahamut" => World::Bahamut,
|
||||
"durandal" => World::Durandal,
|
||||
"fenrir" => World::Fenrir,
|
||||
"ifrit" => World::Ifrit,
|
||||
"ridill" => World::Ridill,
|
||||
"tiamat" => World::Tiamat,
|
||||
"ultima" => World::Ultima,
|
||||
"valefor" => World::Valefor,
|
||||
"yojimbo" => World::Yojimbo,
|
||||
"zeromus" => World::Zeromus,
|
||||
|
||||
"lich" => World::Lich,
|
||||
"odin" => World::Odin,
|
||||
"phoenix" => World::Phoenix,
|
||||
"shiva" => World::Shiva,
|
||||
"twintania" => World::Twintania,
|
||||
"zodiark" => World::Zodiark,
|
||||
"lich" => World::Lich,
|
||||
"odin" => World::Odin,
|
||||
"phoenix" => World::Phoenix,
|
||||
"shiva" => World::Shiva,
|
||||
"twintania" => World::Twintania,
|
||||
"zodiark" => World::Zodiark,
|
||||
|
||||
"anima" => World::Anima,
|
||||
"asura" => World::Asura,
|
||||
"belias" => World::Belias,
|
||||
"chocobo" => World::Chocobo,
|
||||
"hades" => World::Hades,
|
||||
"ixion" => World::Ixion,
|
||||
"mandragora" => World::Mandragora,
|
||||
"masamune" => World::Masamune,
|
||||
"pandaemonium" => World::Pandaemonium,
|
||||
"shinryu" => World::Shinryu,
|
||||
"titan" => World::Titan,
|
||||
"anima" => World::Anima,
|
||||
"asura" => World::Asura,
|
||||
"belias" => World::Belias,
|
||||
"chocobo" => World::Chocobo,
|
||||
"hades" => World::Hades,
|
||||
"ixion" => World::Ixion,
|
||||
"mandragora" => World::Mandragora,
|
||||
"masamune" => World::Masamune,
|
||||
"pandaemonium" => World::Pandaemonium,
|
||||
"shinryu" => World::Shinryu,
|
||||
"titan" => World::Titan,
|
||||
|
||||
"behemoth" => World::Behemoth,
|
||||
"excalibur" => World::Excalibur,
|
||||
"exodus" => World::Exodus,
|
||||
"famfrit" => World::Famfrit,
|
||||
"hyperion" => World::Hyperion,
|
||||
"lamia" => World::Lamia,
|
||||
"leviathan" => World::Leviathan,
|
||||
"ultros" => World::Ultros,
|
||||
"behemoth" => World::Behemoth,
|
||||
"excalibur" => World::Excalibur,
|
||||
"exodus" => World::Exodus,
|
||||
"famfrit" => World::Famfrit,
|
||||
"hyperion" => World::Hyperion,
|
||||
"lamia" => World::Lamia,
|
||||
"leviathan" => World::Leviathan,
|
||||
"ultros" => World::Ultros,
|
||||
|
||||
_ => return Err(UnknownVariant("World", s.into()))
|
||||
};
|
||||
_ => return Err(UnknownVariant("World", s.into()))
|
||||
};
|
||||
|
||||
Ok(world)
|
||||
}
|
||||
Ok(world)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for World {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
write!(f, "{}", self.name())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue