feat: add short codes

This commit is contained in:
Anna 2018-04-01 02:09:19 -04:00
parent a4e994f394
commit 707fab48bd
2 changed files with 42 additions and 0 deletions

View File

@ -85,6 +85,31 @@ impl Job {
}
}
/// Returns the short code of this job.
///
/// Short codes are fully capitalized (e.g. "BRD", "BLM").
pub fn as_code(&self) -> &'static str {
match *self {
Job::Bard => "BRD",
Job::BlackMage => "BLM",
Job::Dragoon => "DRG",
Job::Machinist => "MCH",
Job::Monk => "MNK",
Job::Ninja => "NIN",
Job::RedMage => "RDM",
Job::Samurai => "SAM",
Job::Summoner => "SMN",
Job::Astrologian => "AST",
Job::Scholar => "SCH",
Job::WhiteMage => "WHM",
Job::DarkKnight => "DRK",
Job::Paladin => "PLD",
Job::Warrior => "WAR",
}
}
/// Returns the [`Role`] for this job.
#[cfg(feature = "roles")]
pub fn role(&self) -> Role {

View File

@ -61,6 +61,23 @@ impl NonCombatJob {
}
}
pub fn as_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",
}
}
#[cfg(feature = "job_classifications")]
pub fn classification(&self) -> Classification {
match *self {