forked from mirror/Riven
1
0
Fork 0

Adding Map enum

users/mingwei/surf
Mingwei Samuel 2019-10-25 19:52:43 -07:00
parent aece28af4d
commit 9c4d3608eb
6 changed files with 101 additions and 2 deletions

62
src/consts/map.rs Normal file
View File

@ -0,0 +1,62 @@
// This file is automatically generated.
// Do not directly edit.
/// League of Legends maps.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash, PartialOrd, Ord)]
#[repr(u8)]
pub enum Map {
/// Summoner's Rift
/// <br>Original Summer variant
SummonersRiftOriginalSummerVariant = 1,
/// Summoner's Rift
/// <br>Original Autumn variant
SummonersRiftOriginalAutumnVariant = 2,
/// Summoner's Rift
/// <br>Current Version
SummonersRift = 11,
/// The Proving Grounds
/// <br>Tutorial Map
TheProvingGrounds = 3,
/// Twisted Treeline
/// <br>Original Version
TwistedTreelineOriginalVersion = 4,
/// Twisted Treeline
/// <br>Last TT map
TwistedTreeline = 10,
/// The Crystal Scar
/// <br>Dominion map
TheCrystalScar = 8,
/// Howling Abyss
/// <br>ARAM map
HowlingAbyss = 12,
/// Butcher's Bridge
/// <br>Alternate ARAM map
ButchersBridge = 14,
/// Cosmic Ruins
/// <br>Dark Star: Singularity map
CosmicRuins = 16,
/// Valoran City Park
/// <br>Star Guardian Invasion map
ValoranCityPark = 18,
/// Substructure 43
/// <br>PROJECT: Hunters map
Substructure43 = 19,
/// Crash Site
/// <br>Odyssey: Extraction map
CrashSite = 20,
/// Nexus Blitz
/// <br>Nexus Blitz map
NexusBlitz = 21,
}

View File

@ -12,6 +12,9 @@ pub use game_mode::*;
mod game_type;
pub use game_type::*;
mod map;
pub use map::*;
mod queue_type;
pub use queue_type::*;

View File

@ -20,4 +20,4 @@ pub enum Season {
Season2018 = 11,
Preseason2019 = 12,
Season2019 = 13,
}
}

30
srcgen/consts/map.rs.dt Normal file
View File

@ -0,0 +1,30 @@
{{
const dotUtils = require('./dotUtils.js');
const maps = require('./.maps.json');
const groupedMaps = maps.groupBy(({ mapName }) =>
dotUtils.changeCase.pascalCase(mapName.replace(/[ ']+/, '')));
}}{{= dotUtils.preamble() }}
/// League of Legends maps.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash, PartialOrd, Ord)]
#[repr(u8)]
pub enum Map {
{{
for (const [ groupName, colMaps ] of groupedMaps) {
}}
{{
for (const [ i, { mapId, mapName, notes } ] of colMaps.entries()) {
let name = groupName;
if (i != colMaps.length - 1)
name += dotUtils.changeCase.pascalCase(notes);
}}
/// {{= mapName }}
/// <br>{{= notes }}
{{= name }} = {{= mapId }},
{{
}
}
}}
}

View File

@ -17,4 +17,4 @@ pub enum Season {
{{
}
}}
}
}

View File

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