feat: add more name processing

Also correctly detect more PvP.
This commit is contained in:
Anna 2021-10-07 00:14:17 -04:00
parent da6c8b2c21
commit bf562c8354
5 changed files with 183 additions and 53 deletions

View File

@ -3,6 +3,7 @@ pub mod duties;
pub mod jobs;
pub mod roulettes;
pub mod territory_names;
pub mod treasure_maps;
pub mod worlds;
pub use self::{
@ -11,5 +12,6 @@ pub use self::{
jobs::JOBS,
roulettes::ROULETTES,
territory_names::TERRITORY_NAMES,
treasure_maps::TREASURE_MAPS,
worlds::WORLDS,
};

View File

@ -8,6 +8,7 @@ pub struct DutyInfo {
}
#[derive(Debug, Clone, Copy)]
#[allow(unused)]
#[repr(u32)]
pub enum ContentKind {
DutyRoulette = 1,

View File

@ -1,41 +1,152 @@
use std::collections::HashMap;
#[derive(Debug)]
pub struct RouletteInfo {
pub name: &'static str,
pub pvp: bool,
}
lazy_static::lazy_static! {
pub static ref ROULETTES: HashMap<u32, &'static str> = maplit::hashmap! {
1 => "Duty Roulette: Leveling",
2 => "Duty Roulette: Level 50/60/70 Dungeons",
3 => "Duty Roulette: Main Scenario",
4 => "Duty Roulette: Guildhests",
5 => "Duty Roulette: Expert",
6 => "Duty Roulette: Trials",
7 => "Daily Challenge: Frontline",
8 => "Duty Roulette: Level 80 Dungeons",
9 => "Duty Roulette: Mentor",
11 => "The Feast (Training Match)",
13 => "The Feast (Ranked Match)",
15 => "Duty Roulette: Alliance Raids",
16 => "The Feast (Team Ranked Match)",
17 => "Duty Roulette: Normal Raids",
18 => "Chocobo Race: Sagolii Road",
19 => "Chocobo Race: Costa del Sol",
20 => "Chocobo Race: Tranquil Paths",
21 => "Chocobo Race: Random",
22 => "Chocobo Race: Sagolii Road (No Rewards)",
23 => "Chocobo Race: Costa del Sol (No Rewards)",
24 => "Chocobo Race: Tranquil Paths (No Rewards)",
25 => "Chocobo Race: Random (No Rewards)",
26 => "Chocobo Race: Random",
27 => "Chocobo Race: Random",
28 => "Chocobo Race: Random",
29 => "Chocobo Race: Random",
30 => "Chocobo Race: Random",
31 => "Chocobo Race: Random",
32 => "Chocobo Race: Random",
33 => "Chocobo Race: Random",
34 => "Chocobo Race: Random",
35 => "Chocobo Race: Random",
36 => "Chocobo Race: Random",
37 => "Chocobo Race: Random",
38 => "Chocobo Race: Random",
pub static ref ROULETTES: HashMap<u32, RouletteInfo> = maplit::hashmap! {
1 => RouletteInfo {
name: "Duty Roulette: Leveling",
pvp: false,
},
2 => RouletteInfo {
name: "Duty Roulette: Level 50/60/70 Dungeons",
pvp: false,
},
3 => RouletteInfo {
name: "Duty Roulette: Main Scenario",
pvp: false,
},
4 => RouletteInfo {
name: "Duty Roulette: Guildhests",
pvp: false,
},
5 => RouletteInfo {
name: "Duty Roulette: Expert",
pvp: false,
},
6 => RouletteInfo {
name: "Duty Roulette: Trials",
pvp: false,
},
7 => RouletteInfo {
name: "Daily Challenge: Frontline",
pvp: false,
},
8 => RouletteInfo {
name: "Duty Roulette: Level 80 Dungeons",
pvp: false,
},
9 => RouletteInfo {
name: "Duty Roulette: Mentor",
pvp: false,
},
11 => RouletteInfo {
name: "The Feast (Training Match)",
pvp: true,
},
13 => RouletteInfo {
name: "The Feast (Ranked Match)",
pvp: true,
},
15 => RouletteInfo {
name: "Duty Roulette: Alliance Raids",
pvp: false,
},
16 => RouletteInfo {
name: "The Feast (Team Ranked Match)",
pvp: true,
},
17 => RouletteInfo {
name: "Duty Roulette: Normal Raids",
pvp: false,
},
18 => RouletteInfo {
name: "Chocobo Race: Sagolii Road",
pvp: false,
},
19 => RouletteInfo {
name: "Chocobo Race: Costa del Sol",
pvp: false,
},
20 => RouletteInfo {
name: "Chocobo Race: Tranquil Paths",
pvp: false,
},
21 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
22 => RouletteInfo {
name: "Chocobo Race: Sagolii Road (No Rewards)",
pvp: false,
},
23 => RouletteInfo {
name: "Chocobo Race: Costa del Sol (No Rewards)",
pvp: false,
},
24 => RouletteInfo {
name: "Chocobo Race: Tranquil Paths (No Rewards)",
pvp: false,
},
25 => RouletteInfo {
name: "Chocobo Race: Random (No Rewards)",
pvp: false,
},
26 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
27 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
28 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
29 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
30 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
31 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
32 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
33 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
34 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
35 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
36 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
37 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
38 => RouletteInfo {
name: "Chocobo Race: Random",
pvp: false,
},
};
}

View File

@ -0,0 +1,23 @@
use std::collections::HashMap;
lazy_static::lazy_static! {
pub static ref TREASURE_MAPS: HashMap<u32, &'static str> = maplit::hashmap! {
0 => "All Levels",
1 => "Leather Treasure Map",
2 => "Leather Treasure Map",
3 => "Goatskin Treasure Map",
4 => "Toadskin Treasure Map",
5 => "Boarskin Treasure Map",
6 => "Peisteskin Treasure Map",
7 => "Leather Buried Treasure Map",
8 => "Archaeoskin Treasure Map",
9 => "Wyvernskin Treasure Map",
10 => "Dragonskin Treasure Map",
11 => "Gaganaskin Treasure Map",
12 => "Gazelleskin Treasure Map",
13 => "Seemingly Special Treasure Map",
14 => "Gliderskin Treasure Map",
15 => "Zonureskin Treasure Map",
16 => "Presumably Special Treasure Map",
};
}

View File

@ -63,10 +63,14 @@ impl PartyFinderListing {
}
}
(DutyType::Roulette, _) => {
if let Some(&name) = crate::ffxiv::ROULETTES.get(&u32::from(self.duty)) {
return Cow::from(name);
if let Some(info) = crate::ffxiv::ROULETTES.get(&u32::from(self.duty)) {
return Cow::from(info.name);
}
}
(_, DutyCategory::QuestBattles) => return Cow::from("Quest Battles"),
(_, DutyCategory::TreasureHunt) => if let Some(&name) = crate::ffxiv::TREASURE_MAPS.get(&u32::from(self.duty)) {
return Cow::from(name);
}
_ => {}
}
@ -178,7 +182,10 @@ impl PartyFinderListing {
let duty_category = self.category;
let category = match (duty_type, duty_info, duty_category) {
(DutyType::Roulette, _, _) => PartyFinderCategory::DutyRoulette,
(DutyType::Roulette, _, _) => match crate::ffxiv::ROULETTES.get(&u32::from(self.duty)) {
Some(info) if info.pvp => PartyFinderCategory::Pvp,
_ => PartyFinderCategory::DutyRoulette,
},
(DutyType::Normal, _, DutyCategory::GatheringForays) => PartyFinderCategory::GatheringForays,
(DutyType::Other, _, DutyCategory::DeepDungeons) => PartyFinderCategory::DeepDungeons,
(DutyType::Normal, _, DutyCategory::AdventuringForays) => PartyFinderCategory::AdventuringForays,
@ -193,20 +200,6 @@ impl PartyFinderListing {
(_, _, DutyCategory::TreasureHunt) => PartyFinderCategory::TreasureHunt,
(_, _, DutyCategory::TheHunt) => PartyFinderCategory::TheHunt,
(DutyType::Other, None, _) => PartyFinderCategory::None,
(DutyType::Roulette, _, _) => PartyFinderCategory::DutyRoulette,
(DutyType::Normal, Some(DutyInfo { high_end: true, .. }), _) => PartyFinderCategory::HighEndDuty,
(DutyType::Normal, Some(DutyInfo { content_kind: ContentKind::Dungeons, .. }), _) => PartyFinderCategory::Dungeons,
(DutyType::Normal, Some(DutyInfo { content_kind: ContentKind::Guildhests, .. }), _) => PartyFinderCategory::Guildhests,
(DutyType::Normal, Some(DutyInfo { content_kind: ContentKind::Trials, .. }), _) => PartyFinderCategory::Trials,
(DutyType::Normal, Some(DutyInfo { content_kind: ContentKind::Raids, .. }), _) => PartyFinderCategory::Raids,
(DutyType::Normal, Some(DutyInfo { content_kind: ContentKind::PvP, .. }), _) => PartyFinderCategory::Pvp,
(_, _, DutyCategory::QuestBattles) => PartyFinderCategory::QuestBattles,
(_, _, DutyCategory::Fates) => PartyFinderCategory::Fates,
(_, _, DutyCategory::TreasureHunt) => PartyFinderCategory::TreasureHunt,
(_, _, DutyCategory::TheHunt) => PartyFinderCategory::TheHunt,
(DutyType::Normal, _, DutyCategory::GatheringForays) => PartyFinderCategory::GatheringForays,
(DutyType::Other, _, DutyCategory::DeepDungeons) => PartyFinderCategory::DeepDungeons,
(DutyType::Normal, _, DutyCategory::AdventuringForays) => PartyFinderCategory::AdventuringForays,
_ => return None,
};