This commit is contained in:
Robin Appelman 2025-04-14 23:30:03 +02:00
commit 9de346f078
3 changed files with 25 additions and 10 deletions

4
api-server/Cargo.lock generated
View file

@ -1964,7 +1964,7 @@ dependencies = [
[[package]] [[package]]
name = "ugc-scraper" name = "ugc-scraper"
version = "0.5.0" version = "0.5.0"
source = "git+https://github.com/icewind1991/ugc-scaper#11fd39295c24cabb6198be51f0107df9cfb740e7" source = "git+https://github.com/icewind1991/ugc-scaper#ed4a50532898638fd20168057c291655418c3019"
dependencies = [ dependencies = [
"regex", "regex",
"reqwest", "reqwest",
@ -1979,7 +1979,7 @@ dependencies = [
[[package]] [[package]]
name = "ugc-scraper-types" name = "ugc-scraper-types"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/icewind1991/ugc-scaper#11fd39295c24cabb6198be51f0107df9cfb740e7" source = "git+https://github.com/icewind1991/ugc-scaper#ed4a50532898638fd20168057c291655418c3019"
dependencies = [ dependencies = [
"serde", "serde",
"steamid-ng", "steamid-ng",

View file

@ -30,7 +30,7 @@ rustPlatform.buildRustPackage rec {
cargoLock = { cargoLock = {
lockFile = ./api-server/Cargo.lock; lockFile = ./api-server/Cargo.lock;
outputHashes = { outputHashes = {
"ugc-scraper-0.5.0" = "sha256-PvGlLEVS/C9j3TfhzFPtD2/0pDMqmZnaD2rm2xKgtw4="; "ugc-scraper-0.5.0" = "sha256-TJ1gRsQpKaLY8JXR5Bh2DP6Y0MSd8dy7VkFjHm5Cd4s=";
}; };
}; };
} }

View file

@ -328,6 +328,7 @@ pub enum GameMode {
Sixes, Sixes,
Fours, Fours,
Ultiduo, Ultiduo,
FFFours,
} }
impl FromStr for GameMode { impl FromStr for GameMode {
@ -346,6 +347,7 @@ impl FromStr for GameMode {
"TF2 6vs6" => Ok(GameMode::Sixes), "TF2 6vs6" => Ok(GameMode::Sixes),
"TF2 4vs4" => Ok(GameMode::Fours), "TF2 4vs4" => Ok(GameMode::Fours),
"TF2 2vs2" => Ok(GameMode::Ultiduo), "TF2 2vs2" => Ok(GameMode::Ultiduo),
"FF 4vs4 OvsD" => Ok(GameMode::FFFours),
_ => Err(InvalidGameMode { _ => Err(InvalidGameMode {
text: s.to_string(), text: s.to_string(),
}), }),
@ -354,23 +356,36 @@ impl FromStr for GameMode {
} }
impl GameMode { impl GameMode {
pub fn letter(&self) -> char { pub fn letter(&self) -> &'static str {
match self { match self {
GameMode::Highlander => 'h', GameMode::Highlander => "h",
GameMode::Eights => '8', GameMode::Eights => "8",
GameMode::Sixes => '6', GameMode::Sixes => "6",
GameMode::Fours => '4', GameMode::Fours => "4",
GameMode::Ultiduo => '2', GameMode::Ultiduo => "2",
GameMode::FFFours => "ff4",
} }
} }
fn as_str(&self) -> &'static str { pub fn as_str(&self) -> &'static str {
match self { match self {
GameMode::Highlander => "9v9", GameMode::Highlander => "9v9",
GameMode::Eights => "8v8", GameMode::Eights => "8v8",
GameMode::Sixes => "6v6", GameMode::Sixes => "6v6",
GameMode::Fours => "4v4", GameMode::Fours => "4v4",
GameMode::Ultiduo => "2v2", GameMode::Ultiduo => "2v2",
GameMode::FFFours => "ff4v4",
}
}
pub fn is_tf2(&self) -> bool {
match self {
GameMode::Highlander => true,
GameMode::Eights => true,
GameMode::Sixes => true,
GameMode::Fours => true,
GameMode::Ultiduo => true,
_ => false,
} }
} }
} }