adding GameMode enum

This commit is contained in:
Mingwei Samuel 2019-10-25 19:41:41 -07:00
parent adec5f0df8
commit aece28af4d
4 changed files with 98 additions and 0 deletions

67
src/consts/game_mode.rs Normal file
View file

@ -0,0 +1,67 @@
// This file is automatically generated.
// Do not directly edit.
use strum_macros::{ EnumString, Display, AsRefStr };
/// League of Legends game mode, such as Classic,
/// ARAM, URF, One For All, Ascension, etc.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash)]
#[derive(EnumString, Display, AsRefStr)]
#[repr(u8)]
pub enum GameMode {
/// Classic Summoner's Rift and Twisted Treeline games
#[strum(to_string="CLASSIC")]
Classic,
/// Dominion/Crystal Scar games
#[strum(to_string="ODIN")]
Odin,
/// ARAM games
#[strum(to_string="ARAM")]
Aram,
/// Tutorial games
#[strum(to_string="TUTORIAL")]
Tutorial,
/// URF games
#[strum(to_string="URF")]
Urf,
/// Doom Bot games
#[strum(to_string="DOOMBOTSTEEMO")]
Doombotsteemo,
/// One for All games
#[strum(to_string="ONEFORALL")]
Oneforall,
/// Ascension games
#[strum(to_string="ASCENSION")]
Ascension,
/// Snowdown Showdown games
#[strum(to_string="FIRSTBLOOD")]
Firstblood,
/// Legend of the Poro King games
#[strum(to_string="KINGPORO")]
Kingporo,
/// Nexus Siege games
#[strum(to_string="SIEGE")]
Siege,
/// Blood Hunt Assassin games
#[strum(to_string="ASSASSINATE")]
Assassinate,
/// All Random Summoner's Rift games
#[strum(to_string="ARSR")]
Arsr,
/// Dark Star: Singularity games
#[strum(to_string="DARKSTAR")]
Darkstar,
/// Star Guardian Invasion games
#[strum(to_string="STARGUARDIAN")]
Starguardian,
/// PROJECT: Hunters games
#[strum(to_string="PROJECT")]
Project,
/// Nexus Blitz games
#[strum(to_string="GAMEMODEX")]
Gamemodex,
/// Odyssey: Extraction games
#[strum(to_string="ODYSSEY")]
Odyssey,
}

View file

@ -6,6 +6,9 @@ pub use champion::*;
mod division;
pub use division::*;
mod game_mode;
pub use game_mode::*;
mod game_type;
pub use game_type::*;

View file

@ -0,0 +1,24 @@
{{
const dotUtils = require('./dotUtils.js');
const gameModes = require('./.gameModes.json');
}}{{= dotUtils.preamble() }}
use strum_macros::{ EnumString, Display, AsRefStr };
/// League of Legends game mode, such as Classic,
/// ARAM, URF, One For All, Ascension, etc.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash)]
#[derive(EnumString, Display, AsRefStr)]
#[repr(u8)]
pub enum GameMode {
{{
for (const { gameMode, description } of gameModes) {
}}
/// {{= description }}
#[strum(to_string="{{= gameMode }}")]
{{= dotUtils.changeCase.pascalCase(gameMode) }},
{{
}
}}
}

View file

@ -26,6 +26,10 @@ const files = [
[
'http://static.developer.riotgames.com/docs/lol/gameTypes.json',
'.gameTypes.json'
],
[
'http://static.developer.riotgames.com/docs/lol/gameModes.json',
'.gameModes.json'
]
]