lodestone-parser/src/models/character.rs

126 lines
2.8 KiB
Rust

use super::GrandCompany;
#[cfg(feature = "with_serde")] use serde::{Deserialize, Serialize};
use ffxiv_types::{World, Race, Clan, Guardian};
use url::Url;
use std::collections::BTreeMap;
#[derive(Debug)]
#[cfg_attr(feature = "with_serde", derive(Deserialize, Serialize))]
pub struct Character {
pub id: u64,
pub name: String,
pub world: World,
pub race: Race,
pub clan: Clan,
pub gender: Gender,
pub title: Option<String>,
pub name_day: String,
pub guardian: Guardian,
pub city_state: CityState,
pub grand_company: Option<GrandCompanyInfo>,
#[cfg_attr(feature = "with_serde", serde(with = "crate::util::serde::opt_u64_str"))]
pub free_company_id: Option<u64>,
pub profile_text: String,
pub jobs: BTreeMap<Job, JobInfo>,
// #[cfg_attr(feature = "with_serde", serde(default))]
// pub mounts: Vec<Mount>,
// #[cfg_attr(feature = "with_serde", serde(default))]
// pub minions: Vec<Minion>,
pub face: Url,
pub portrait: Url,
}
#[derive(Debug, PartialEq)]
#[cfg_attr(feature = "with_serde", derive(Deserialize, Serialize))]
pub struct GrandCompanyInfo {
pub name: GrandCompany,
pub rank: String,
}
#[derive(Debug)]
#[cfg_attr(feature = "with_serde", derive(Deserialize, Serialize))]
pub struct JobInfo {
pub level: Option<u8>,
}
#[derive(Debug)]
#[cfg_attr(feature = "with_serde", derive(Deserialize, Serialize))]
pub struct Mount {
pub name: String,
pub icon: Url,
}
#[derive(Debug)]
#[cfg_attr(feature = "with_serde", derive(Deserialize, Serialize))]
pub struct Minion {
pub name: String,
pub icon: Url,
}
ffxiv_enum!(Gender {
Male => "",
Female => "",
});
ffxiv_enum!(CityState {
Gridania => "gridania",
LimsaLominsa => "limsa lominsa",
UlDah => "ul'dah",
});
ffxiv_enum!(
#[derive(Eq, PartialOrd, Ord)]
Job {
Gladiator => "gladiator",
Paladin => "paladin",
Marauder => "marauder",
Warrior => "warrior",
DarkKnight => "dark knight",
Gunbreaker => "gunbreaker",
Conjurer => "conjurer",
WhiteMage => "white mage",
Scholar => "scholar",
Astrologian => "astrologian",
Sage => "sage",
Pugilist => "pugilist",
Monk => "monk",
Lancer => "lancer",
Dragoon => "dragoon",
Rogue => "rogue",
Ninja => "ninja",
Samurai => "samurai",
Archer => "archer",
Bard => "bard",
Machinist => "machinist",
Thaumaturge => "thaumaturge",
BlackMage => "black mage",
Arcanist => "arcanist",
Summoner => "summoner",
RedMage => "red mage",
BlueMage => "blue mage",
Dancer => "dancer",
Reaper => "reaper",
Carpenter => "carpenter",
Blacksmith => "blacksmith",
Armorer => "armorer",
Goldsmith => "goldsmith",
Leatherworker => "leatherworker",
Weaver => "weaver",
Alchemist => "alchemist",
Culinarian => "culinarian",
Miner => "miner",
Botanist => "botanist",
Fisher => "fisher",
}
);