forked from mirror/Riven
1
0
Fork 0
Riven/srcgen/consts/queue.rs.dt

43 lines
1.2 KiB
Plaintext

{{
const dotUtils = require('./dotUtils.js');
const queues = require('./.queues.json');
const groupedQueues = queues.groupBy(({ map, description }) => {
const name = dotUtils.changeCase.pascalCase((map || '').replace("'", ''))
+ dotUtils.changeCase.pascalCase((description || '').replace(/\s+(?=\d)/g, ''));
return name;
});
}}{{= dotUtils.preamble() }}
#![allow(deprecated)]
use serde_repr::{ Serialize_repr, Deserialize_repr };
/// League of Legends matchmaking queue.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq)]
#[derive(Serialize_repr, Deserialize_repr)]
#[repr(u16)]
pub enum Queue {
{{
for (let [ groupName, colQueues ] of groupedQueues) {
}}
{{
for (let { queueId, map, description, notes } of colQueues) {
const doc = (description ? description + ' games on ' : '') + map;
const deprecated = (notes || '').toUpperCase().indexOf('DEPRECATED') >= 0;
const name = groupName + ((colQueues.length > 1 && deprecated) ? 'Deprecated' : '');
}}
/// {{= doc }}.
{{? notes }}
/// <br>{{= notes }}
{{?}}
{{? deprecated}}
#[deprecated(note="{{= notes }}")]
{{?}}
{{= name }} = {{= queueId }},
{{
}
}
}}
}