diff --git a/src/consts/champion.rs b/src/consts/champion.rs index e261278..efa56dd 100644 --- a/src/consts/champion.rs +++ b/src/consts/champion.rs @@ -8,7 +8,7 @@ use num_derive; /// /// The documentation of each variant specifies:
/// NAME (`IDENTIFIER`, ID). -#[derive(fmt::Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone)] #[derive(num_derive::FromPrimitive, num_derive::ToPrimitive)] pub enum Champion { /** Aatrox (`Aatrox`, 266). */ Aatrox = 266, diff --git a/src/consts/division.rs b/src/consts/division.rs index 8e74577..28a4764 100644 --- a/src/consts/division.rs +++ b/src/consts/division.rs @@ -1,7 +1,5 @@ #![allow(deprecated)] -use std::fmt::Debug; - use strum_macros::{ EnumString, Display, AsRefStr }; #[derive(Debug, Copy, Clone)] @@ -13,7 +11,6 @@ pub enum Division { II = 2, III = 3, IV = 4, - #[deprecated(note="Removed for 2019.")] V = 5, } diff --git a/src/consts/game_type.rs b/src/consts/game_type.rs new file mode 100644 index 0000000..0b0f219 --- /dev/null +++ b/src/consts/game_type.rs @@ -0,0 +1,21 @@ +// This file is automatically generated. +// Do not directly edit. + +use strum_macros::{ EnumString, Display, AsRefStr }; + +/// League of Legends game type: matched game, custom game, or tutorial game. +#[derive(Debug, Copy, Clone)] +#[derive(Eq, PartialEq, Hash)] +#[derive(EnumString, Display, AsRefStr)] +#[repr(u8)] +pub enum GameType { + /// Custom games + #[strum(to_string="CUSTOM_GAME")] + CustomGame, + /// Tutorial games + #[strum(to_string="TUTORIAL_GAME")] + TutorialGame, + /// all other games + #[strum(to_string="MATCHED_GAME")] + MatchedGame, +} diff --git a/src/consts/mod.rs b/src/consts/mod.rs index 08ee694..ad95fab 100644 --- a/src/consts/mod.rs +++ b/src/consts/mod.rs @@ -6,6 +6,9 @@ pub use champion::*; mod division; pub use division::*; +mod game_type; +pub use game_type::*; + mod queue_type; pub use queue_type::*; diff --git a/src/consts/queue_type.rs b/src/consts/queue_type.rs index 036fb7a..163ae2f 100644 --- a/src/consts/queue_type.rs +++ b/src/consts/queue_type.rs @@ -1,5 +1,3 @@ -use std::fmt::Debug; - use strum_macros::{ EnumString, Display, AsRefStr }; #[derive(Debug, Copy, Clone)] diff --git a/src/consts/tier.rs b/src/consts/tier.rs index e9aeaf7..2450455 100644 --- a/src/consts/tier.rs +++ b/src/consts/tier.rs @@ -1,7 +1,5 @@ #![allow(deprecated)] -use std::fmt::Debug; - use strum_macros::{ EnumString, Display, AsRefStr }; #[derive(Debug, Copy, Clone)] diff --git a/srcgen/consts/champion.rs.dt b/srcgen/consts/champion.rs.dt index 72e8cf0..f4383ba 100644 --- a/srcgen/consts/champion.rs.dt +++ b/srcgen/consts/champion.rs.dt @@ -20,7 +20,7 @@ use num_derive; /// /// The documentation of each variant specifies:
/// NAME (`IDENTIFIER`, ID). -#[derive(fmt::Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone)] #[derive(num_derive::FromPrimitive, num_derive::ToPrimitive)] pub enum Champion { {{ diff --git a/srcgen/consts/game_type.rs.dt b/srcgen/consts/game_type.rs.dt new file mode 100644 index 0000000..c8ea9aa --- /dev/null +++ b/srcgen/consts/game_type.rs.dt @@ -0,0 +1,23 @@ +{{ + const dotUtils = require('./dotUtils.js'); + const gameTypes = require('./.gameTypes.json'); +}}{{= dotUtils.preamble() }} + +use strum_macros::{ EnumString, Display, AsRefStr }; + +/// League of Legends game type: matched game, custom game, or tutorial game. +#[derive(Debug, Copy, Clone)] +#[derive(Eq, PartialEq, Hash)] +#[derive(EnumString, Display, AsRefStr)] +#[repr(u8)] +pub enum GameType { +{{ + for (const { gametype: gameType, description } of gameTypes) { +}} + /// {{= description }} + #[strum(to_string="{{= gameType }}")] + {{= dotUtils.changeCase.pascalCase(gameType) }}, +{{ + } +}} +} diff --git a/srcgen/index.js b/srcgen/index.js index 263c805..faf2651 100644 --- a/srcgen/index.js +++ b/srcgen/index.js @@ -22,6 +22,10 @@ const files = [ [ 'http://static.developer.riotgames.com/docs/lol/queues.json', '.queues.json' + ], + [ + 'http://static.developer.riotgames.com/docs/lol/gameTypes.json', + '.gameTypes.json' ] ]