Add array of all champions

pull/27/head
Mingwei Samuel 2021-06-30 17:06:33 -07:00
parent 6307a0aa13
commit 07348a5c53
2 changed files with 208 additions and 318 deletions

View File

@ -22,316 +22,188 @@ use serde::{ Serialize, Deserialize };
pub struct Champion(pub i16); pub struct Champion(pub i16);
impl Champion { impl Champion {
/// Aatrox (`Aatrox`, 266). /** Aatrox (`Aatrox`, 266) */ pub const AATROX: Self = Self(266);
pub const AATROX: Self = Self(266); /** Ahri (`Ahri`, 103) */ pub const AHRI: Self = Self(103);
/// Ahri (`Ahri`, 103). /** Akali (`Akali`, 84) */ pub const AKALI: Self = Self(84);
pub const AHRI: Self = Self(103); /** Alistar (`Alistar`, 12) */ pub const ALISTAR: Self = Self(12);
/// Akali (`Akali`, 84). /** Amumu (`Amumu`, 32) */ pub const AMUMU: Self = Self(32);
pub const AKALI: Self = Self(84); /** Anivia (`Anivia`, 34) */ pub const ANIVIA: Self = Self(34);
/// Alistar (`Alistar`, 12). /** Annie (`Annie`, 1) */ pub const ANNIE: Self = Self(1);
pub const ALISTAR: Self = Self(12); /** Aphelios (`Aphelios`, 523) */ pub const APHELIOS: Self = Self(523);
/// Amumu (`Amumu`, 32). /** Ashe (`Ashe`, 22) */ pub const ASHE: Self = Self(22);
pub const AMUMU: Self = Self(32); /** Aurelion Sol (`AurelionSol`, 136) */ pub const AURELION_SOL: Self = Self(136);
/// Anivia (`Anivia`, 34). /** Azir (`Azir`, 268) */ pub const AZIR: Self = Self(268);
pub const ANIVIA: Self = Self(34); /** Bard (`Bard`, 432) */ pub const BARD: Self = Self(432);
/// Annie (`Annie`, 1). /** Blitzcrank (`Blitzcrank`, 53) */ pub const BLITZCRANK: Self = Self(53);
pub const ANNIE: Self = Self(1); /** Brand (`Brand`, 63) */ pub const BRAND: Self = Self(63);
/// Aphelios (`Aphelios`, 523). /** Braum (`Braum`, 201) */ pub const BRAUM: Self = Self(201);
pub const APHELIOS: Self = Self(523); /** Caitlyn (`Caitlyn`, 51) */ pub const CAITLYN: Self = Self(51);
/// Ashe (`Ashe`, 22). /** Camille (`Camille`, 164) */ pub const CAMILLE: Self = Self(164);
pub const ASHE: Self = Self(22); /** Cassiopeia (`Cassiopeia`, 69) */ pub const CASSIOPEIA: Self = Self(69);
/// Aurelion Sol (`AurelionSol`, 136). /** Cho'Gath (`Chogath`, 31) */ pub const CHO_GATH: Self = Self(31);
pub const AURELION_SOL: Self = Self(136); /** Corki (`Corki`, 42) */ pub const CORKI: Self = Self(42);
/// Azir (`Azir`, 268). /** Darius (`Darius`, 122) */ pub const DARIUS: Self = Self(122);
pub const AZIR: Self = Self(268); /** Diana (`Diana`, 131) */ pub const DIANA: Self = Self(131);
/// Bard (`Bard`, 432). /** Dr. Mundo (`DrMundo`, 36) */ pub const DR_MUNDO: Self = Self(36);
pub const BARD: Self = Self(432); /** Draven (`Draven`, 119) */ pub const DRAVEN: Self = Self(119);
/// Blitzcrank (`Blitzcrank`, 53). /** Ekko (`Ekko`, 245) */ pub const EKKO: Self = Self(245);
pub const BLITZCRANK: Self = Self(53); /** Elise (`Elise`, 60) */ pub const ELISE: Self = Self(60);
/// Brand (`Brand`, 63). /** Evelynn (`Evelynn`, 28) */ pub const EVELYNN: Self = Self(28);
pub const BRAND: Self = Self(63); /** Ezreal (`Ezreal`, 81) */ pub const EZREAL: Self = Self(81);
/// Braum (`Braum`, 201). /** Fiddlesticks (`FiddleSticks`, 9) */ pub const FIDDLESTICKS: Self = Self(9);
pub const BRAUM: Self = Self(201); /** Fiora (`Fiora`, 114) */ pub const FIORA: Self = Self(114);
/// Caitlyn (`Caitlyn`, 51). /** Fizz (`Fizz`, 105) */ pub const FIZZ: Self = Self(105);
pub const CAITLYN: Self = Self(51); /** Galio (`Galio`, 3) */ pub const GALIO: Self = Self(3);
/// Camille (`Camille`, 164). /** Gangplank (`Gangplank`, 41) */ pub const GANGPLANK: Self = Self(41);
pub const CAMILLE: Self = Self(164); /** Garen (`Garen`, 86) */ pub const GAREN: Self = Self(86);
/// Cassiopeia (`Cassiopeia`, 69). /** Gnar (`Gnar`, 150) */ pub const GNAR: Self = Self(150);
pub const CASSIOPEIA: Self = Self(69); /** Gragas (`Gragas`, 79) */ pub const GRAGAS: Self = Self(79);
/// Cho'Gath (`Chogath`, 31). /** Graves (`Graves`, 104) */ pub const GRAVES: Self = Self(104);
pub const CHO_GATH: Self = Self(31); /** Gwen (`Gwen`, 887) */ pub const GWEN: Self = Self(887);
/// Corki (`Corki`, 42). /** Hecarim (`Hecarim`, 120) */ pub const HECARIM: Self = Self(120);
pub const CORKI: Self = Self(42); /** Heimerdinger (`Heimerdinger`, 74) */ pub const HEIMERDINGER: Self = Self(74);
/// Darius (`Darius`, 122). /** Illaoi (`Illaoi`, 420) */ pub const ILLAOI: Self = Self(420);
pub const DARIUS: Self = Self(122); /** Irelia (`Irelia`, 39) */ pub const IRELIA: Self = Self(39);
/// Diana (`Diana`, 131). /** Ivern (`Ivern`, 427) */ pub const IVERN: Self = Self(427);
pub const DIANA: Self = Self(131); /** Janna (`Janna`, 40) */ pub const JANNA: Self = Self(40);
/// Dr. Mundo (`DrMundo`, 36). /** Jarvan IV (`JarvanIV`, 59) */ pub const JARVAN_IV: Self = Self(59);
pub const DR_MUNDO: Self = Self(36); /** Jax (`Jax`, 24) */ pub const JAX: Self = Self(24);
/// Draven (`Draven`, 119). /** Jayce (`Jayce`, 126) */ pub const JAYCE: Self = Self(126);
pub const DRAVEN: Self = Self(119); /** Jhin (`Jhin`, 202) */ pub const JHIN: Self = Self(202);
/// Ekko (`Ekko`, 245). /** Jinx (`Jinx`, 222) */ pub const JINX: Self = Self(222);
pub const EKKO: Self = Self(245); /** Kai'Sa (`Kaisa`, 145) */ pub const KAI_SA: Self = Self(145);
/// Elise (`Elise`, 60). /** Kalista (`Kalista`, 429) */ pub const KALISTA: Self = Self(429);
pub const ELISE: Self = Self(60); /** Karma (`Karma`, 43) */ pub const KARMA: Self = Self(43);
/// Evelynn (`Evelynn`, 28). /** Karthus (`Karthus`, 30) */ pub const KARTHUS: Self = Self(30);
pub const EVELYNN: Self = Self(28); /** Kassadin (`Kassadin`, 38) */ pub const KASSADIN: Self = Self(38);
/// Ezreal (`Ezreal`, 81). /** Katarina (`Katarina`, 55) */ pub const KATARINA: Self = Self(55);
pub const EZREAL: Self = Self(81); /** Kayle (`Kayle`, 10) */ pub const KAYLE: Self = Self(10);
/// Fiddlesticks (`FiddleSticks`, 9). /** Kayn (`Kayn`, 141) */ pub const KAYN: Self = Self(141);
pub const FIDDLESTICKS: Self = Self(9); /** Kennen (`Kennen`, 85) */ pub const KENNEN: Self = Self(85);
/// Fiora (`Fiora`, 114). /** Kha'Zix (`Khazix`, 121) */ pub const KHA_ZIX: Self = Self(121);
pub const FIORA: Self = Self(114); /** Kindred (`Kindred`, 203) */ pub const KINDRED: Self = Self(203);
/// Fizz (`Fizz`, 105). /** Kled (`Kled`, 240) */ pub const KLED: Self = Self(240);
pub const FIZZ: Self = Self(105); /** Kog'Maw (`KogMaw`, 96) */ pub const KOG_MAW: Self = Self(96);
/// Galio (`Galio`, 3). /** LeBlanc (`Leblanc`, 7) */ pub const LE_BLANC: Self = Self(7);
pub const GALIO: Self = Self(3); /** Lee Sin (`LeeSin`, 64) */ pub const LEE_SIN: Self = Self(64);
/// Gangplank (`Gangplank`, 41). /** Leona (`Leona`, 89) */ pub const LEONA: Self = Self(89);
pub const GANGPLANK: Self = Self(41); /** Lillia (`Lillia`, 876) */ pub const LILLIA: Self = Self(876);
/// Garen (`Garen`, 86). /** Lissandra (`Lissandra`, 127) */ pub const LISSANDRA: Self = Self(127);
pub const GAREN: Self = Self(86); /** Lucian (`Lucian`, 236) */ pub const LUCIAN: Self = Self(236);
/// Gnar (`Gnar`, 150). /** Lulu (`Lulu`, 117) */ pub const LULU: Self = Self(117);
pub const GNAR: Self = Self(150); /** Lux (`Lux`, 99) */ pub const LUX: Self = Self(99);
/// Gragas (`Gragas`, 79). /** Malphite (`Malphite`, 54) */ pub const MALPHITE: Self = Self(54);
pub const GRAGAS: Self = Self(79); /** Malzahar (`Malzahar`, 90) */ pub const MALZAHAR: Self = Self(90);
/// Graves (`Graves`, 104). /** Maokai (`Maokai`, 57) */ pub const MAOKAI: Self = Self(57);
pub const GRAVES: Self = Self(104); /** Master Yi (`MasterYi`, 11) */ pub const MASTER_YI: Self = Self(11);
/// Gwen (`Gwen`, 887). /** Miss Fortune (`MissFortune`, 21) */ pub const MISS_FORTUNE: Self = Self(21);
pub const GWEN: Self = Self(887); /** Mordekaiser (`Mordekaiser`, 82) */ pub const MORDEKAISER: Self = Self(82);
/// Hecarim (`Hecarim`, 120). /** Morgana (`Morgana`, 25) */ pub const MORGANA: Self = Self(25);
pub const HECARIM: Self = Self(120); /** Nami (`Nami`, 267) */ pub const NAMI: Self = Self(267);
/// Heimerdinger (`Heimerdinger`, 74). /** Nasus (`Nasus`, 75) */ pub const NASUS: Self = Self(75);
pub const HEIMERDINGER: Self = Self(74); /** Nautilus (`Nautilus`, 111) */ pub const NAUTILUS: Self = Self(111);
/// Illaoi (`Illaoi`, 420). /** Neeko (`Neeko`, 518) */ pub const NEEKO: Self = Self(518);
pub const ILLAOI: Self = Self(420); /** Nidalee (`Nidalee`, 76) */ pub const NIDALEE: Self = Self(76);
/// Irelia (`Irelia`, 39). /** Nocturne (`Nocturne`, 56) */ pub const NOCTURNE: Self = Self(56);
pub const IRELIA: Self = Self(39); /** Nunu & Willump (`Nunu`, 20) */ pub const NUNU_WILLUMP: Self = Self(20);
/// Ivern (`Ivern`, 427). /** Olaf (`Olaf`, 2) */ pub const OLAF: Self = Self(2);
pub const IVERN: Self = Self(427); /** Orianna (`Orianna`, 61) */ pub const ORIANNA: Self = Self(61);
/// Janna (`Janna`, 40). /** Ornn (`Ornn`, 516) */ pub const ORNN: Self = Self(516);
pub const JANNA: Self = Self(40); /** Pantheon (`Pantheon`, 80) */ pub const PANTHEON: Self = Self(80);
/// Jarvan IV (`JarvanIV`, 59). /** Poppy (`Poppy`, 78) */ pub const POPPY: Self = Self(78);
pub const JARVAN_IV: Self = Self(59); /** Pyke (`Pyke`, 555) */ pub const PYKE: Self = Self(555);
/// Jax (`Jax`, 24). /** Qiyana (`Qiyana`, 246) */ pub const QIYANA: Self = Self(246);
pub const JAX: Self = Self(24); /** Quinn (`Quinn`, 133) */ pub const QUINN: Self = Self(133);
/// Jayce (`Jayce`, 126). /** Rakan (`Rakan`, 497) */ pub const RAKAN: Self = Self(497);
pub const JAYCE: Self = Self(126); /** Rammus (`Rammus`, 33) */ pub const RAMMUS: Self = Self(33);
/// Jhin (`Jhin`, 202). /** Rek'Sai (`RekSai`, 421) */ pub const REK_SAI: Self = Self(421);
pub const JHIN: Self = Self(202); /** Rell (`Rell`, 526) */ pub const RELL: Self = Self(526);
/// Jinx (`Jinx`, 222). /** Renekton (`Renekton`, 58) */ pub const RENEKTON: Self = Self(58);
pub const JINX: Self = Self(222); /** Rengar (`Rengar`, 107) */ pub const RENGAR: Self = Self(107);
/// Kai'Sa (`Kaisa`, 145). /** Riven (`Riven`, 92) */ pub const RIVEN: Self = Self(92);
pub const KAI_SA: Self = Self(145); /** Rumble (`Rumble`, 68) */ pub const RUMBLE: Self = Self(68);
/// Kalista (`Kalista`, 429). /** Ryze (`Ryze`, 13) */ pub const RYZE: Self = Self(13);
pub const KALISTA: Self = Self(429); /** Samira (`Samira`, 360) */ pub const SAMIRA: Self = Self(360);
/// Karma (`Karma`, 43). /** Sejuani (`Sejuani`, 113) */ pub const SEJUANI: Self = Self(113);
pub const KARMA: Self = Self(43); /** Senna (`Senna`, 235) */ pub const SENNA: Self = Self(235);
/// Karthus (`Karthus`, 30). /** Seraphine (`Seraphine`, 147) */ pub const SERAPHINE: Self = Self(147);
pub const KARTHUS: Self = Self(30); /** Sett (`Sett`, 875) */ pub const SETT: Self = Self(875);
/// Kassadin (`Kassadin`, 38). /** Shaco (`Shaco`, 35) */ pub const SHACO: Self = Self(35);
pub const KASSADIN: Self = Self(38); /** Shen (`Shen`, 98) */ pub const SHEN: Self = Self(98);
/// Katarina (`Katarina`, 55). /** Shyvana (`Shyvana`, 102) */ pub const SHYVANA: Self = Self(102);
pub const KATARINA: Self = Self(55); /** Singed (`Singed`, 27) */ pub const SINGED: Self = Self(27);
/// Kayle (`Kayle`, 10). /** Sion (`Sion`, 14) */ pub const SION: Self = Self(14);
pub const KAYLE: Self = Self(10); /** Sivir (`Sivir`, 15) */ pub const SIVIR: Self = Self(15);
/// Kayn (`Kayn`, 141). /** Skarner (`Skarner`, 72) */ pub const SKARNER: Self = Self(72);
pub const KAYN: Self = Self(141); /** Sona (`Sona`, 37) */ pub const SONA: Self = Self(37);
/// Kennen (`Kennen`, 85). /** Soraka (`Soraka`, 16) */ pub const SORAKA: Self = Self(16);
pub const KENNEN: Self = Self(85); /** Swain (`Swain`, 50) */ pub const SWAIN: Self = Self(50);
/// Kha'Zix (`Khazix`, 121). /** Sylas (`Sylas`, 517) */ pub const SYLAS: Self = Self(517);
pub const KHA_ZIX: Self = Self(121); /** Syndra (`Syndra`, 134) */ pub const SYNDRA: Self = Self(134);
/// Kindred (`Kindred`, 203). /** Tahm Kench (`TahmKench`, 223) */ pub const TAHM_KENCH: Self = Self(223);
pub const KINDRED: Self = Self(203); /** Taliyah (`Taliyah`, 163) */ pub const TALIYAH: Self = Self(163);
/// Kled (`Kled`, 240). /** Talon (`Talon`, 91) */ pub const TALON: Self = Self(91);
pub const KLED: Self = Self(240); /** Taric (`Taric`, 44) */ pub const TARIC: Self = Self(44);
/// Kog'Maw (`KogMaw`, 96). /** Teemo (`Teemo`, 17) */ pub const TEEMO: Self = Self(17);
pub const KOG_MAW: Self = Self(96); /** Thresh (`Thresh`, 412) */ pub const THRESH: Self = Self(412);
/// LeBlanc (`Leblanc`, 7). /** Tristana (`Tristana`, 18) */ pub const TRISTANA: Self = Self(18);
pub const LE_BLANC: Self = Self(7); /** Trundle (`Trundle`, 48) */ pub const TRUNDLE: Self = Self(48);
/// Lee Sin (`LeeSin`, 64). /** Tryndamere (`Tryndamere`, 23) */ pub const TRYNDAMERE: Self = Self(23);
pub const LEE_SIN: Self = Self(64); /** Twisted Fate (`TwistedFate`, 4) */ pub const TWISTED_FATE: Self = Self(4);
/// Leona (`Leona`, 89). /** Twitch (`Twitch`, 29) */ pub const TWITCH: Self = Self(29);
pub const LEONA: Self = Self(89); /** Udyr (`Udyr`, 77) */ pub const UDYR: Self = Self(77);
/// Lillia (`Lillia`, 876). /** Urgot (`Urgot`, 6) */ pub const URGOT: Self = Self(6);
pub const LILLIA: Self = Self(876); /** Varus (`Varus`, 110) */ pub const VARUS: Self = Self(110);
/// Lissandra (`Lissandra`, 127). /** Vayne (`Vayne`, 67) */ pub const VAYNE: Self = Self(67);
pub const LISSANDRA: Self = Self(127); /** Veigar (`Veigar`, 45) */ pub const VEIGAR: Self = Self(45);
/// Lucian (`Lucian`, 236). /** Vel'Koz (`Velkoz`, 161) */ pub const VEL_KOZ: Self = Self(161);
pub const LUCIAN: Self = Self(236); /** Vi (`Vi`, 254) */ pub const VI: Self = Self(254);
/// Lulu (`Lulu`, 117). /** Viego (`Viego`, 234) */ pub const VIEGO: Self = Self(234);
pub const LULU: Self = Self(117); /** Viktor (`Viktor`, 112) */ pub const VIKTOR: Self = Self(112);
/// Lux (`Lux`, 99). /** Vladimir (`Vladimir`, 8) */ pub const VLADIMIR: Self = Self(8);
pub const LUX: Self = Self(99); /** Volibear (`Volibear`, 106) */ pub const VOLIBEAR: Self = Self(106);
/// Malphite (`Malphite`, 54). /** Warwick (`Warwick`, 19) */ pub const WARWICK: Self = Self(19);
pub const MALPHITE: Self = Self(54); /** Wukong (`MonkeyKing`, 62) */ pub const WUKONG: Self = Self(62);
/// Malzahar (`Malzahar`, 90). /** Xayah (`Xayah`, 498) */ pub const XAYAH: Self = Self(498);
pub const MALZAHAR: Self = Self(90); /** Xerath (`Xerath`, 101) */ pub const XERATH: Self = Self(101);
/// Maokai (`Maokai`, 57). /** Xin Zhao (`XinZhao`, 5) */ pub const XIN_ZHAO: Self = Self(5);
pub const MAOKAI: Self = Self(57); /** Yasuo (`Yasuo`, 157) */ pub const YASUO: Self = Self(157);
/// Master Yi (`MasterYi`, 11). /** Yone (`Yone`, 777) */ pub const YONE: Self = Self(777);
pub const MASTER_YI: Self = Self(11); /** Yorick (`Yorick`, 83) */ pub const YORICK: Self = Self(83);
/// Miss Fortune (`MissFortune`, 21). /** Yuumi (`Yuumi`, 350) */ pub const YUUMI: Self = Self(350);
pub const MISS_FORTUNE: Self = Self(21); /** Zac (`Zac`, 154) */ pub const ZAC: Self = Self(154);
/// Mordekaiser (`Mordekaiser`, 82). /** Zed (`Zed`, 238) */ pub const ZED: Self = Self(238);
pub const MORDEKAISER: Self = Self(82); /** Ziggs (`Ziggs`, 115) */ pub const ZIGGS: Self = Self(115);
/// Morgana (`Morgana`, 25). /** Zilean (`Zilean`, 26) */ pub const ZILEAN: Self = Self(26);
pub const MORGANA: Self = Self(25); /** Zoe (`Zoe`, 142) */ pub const ZOE: Self = Self(142);
/// Nami (`Nami`, 267). /** Zyra (`Zyra`, 143) */ pub const ZYRA: Self = Self(143);
pub const NAMI: Self = Self(267); }
/// Nasus (`Nasus`, 75).
pub const NASUS: Self = Self(75);
/// Nautilus (`Nautilus`, 111). impl Champion {
pub const NAUTILUS: Self = Self(111); /// Array containing all Champion variants, ordered by their id value.
/// Neeko (`Neeko`, 518). pub const ALL: [Self; 155] = [
pub const NEEKO: Self = Self(518); Self::ANNIE, Self::OLAF, Self::GALIO, Self::TWISTED_FATE, Self::XIN_ZHAO, Self::URGOT, Self::LE_BLANC, Self::VLADIMIR,
/// Nidalee (`Nidalee`, 76). Self::FIDDLESTICKS, Self::KAYLE, Self::MASTER_YI, Self::ALISTAR, Self::RYZE, Self::SION, Self::SIVIR, Self::SORAKA,
pub const NIDALEE: Self = Self(76); Self::TEEMO, Self::TRISTANA, Self::WARWICK, Self::NUNU_WILLUMP, Self::MISS_FORTUNE, Self::ASHE, Self::TRYNDAMERE, Self::JAX,
/// Nocturne (`Nocturne`, 56). Self::MORGANA, Self::ZILEAN, Self::SINGED, Self::EVELYNN, Self::TWITCH, Self::KARTHUS, Self::CHO_GATH, Self::AMUMU,
pub const NOCTURNE: Self = Self(56); Self::RAMMUS, Self::ANIVIA, Self::SHACO, Self::DR_MUNDO, Self::SONA, Self::KASSADIN, Self::IRELIA, Self::JANNA,
/// Nunu & Willump (`Nunu`, 20). Self::GANGPLANK, Self::CORKI, Self::KARMA, Self::TARIC, Self::VEIGAR, Self::TRUNDLE, Self::SWAIN, Self::CAITLYN,
pub const NUNU_WILLUMP: Self = Self(20); Self::BLITZCRANK, Self::MALPHITE, Self::KATARINA, Self::NOCTURNE, Self::MAOKAI, Self::RENEKTON, Self::JARVAN_IV, Self::ELISE,
/// Olaf (`Olaf`, 2). Self::ORIANNA, Self::WUKONG, Self::BRAND, Self::LEE_SIN, Self::VAYNE, Self::RUMBLE, Self::CASSIOPEIA, Self::SKARNER,
pub const OLAF: Self = Self(2); Self::HEIMERDINGER, Self::NASUS, Self::NIDALEE, Self::UDYR, Self::POPPY, Self::GRAGAS, Self::PANTHEON, Self::EZREAL,
/// Orianna (`Orianna`, 61). Self::MORDEKAISER, Self::YORICK, Self::AKALI, Self::KENNEN, Self::GAREN, Self::LEONA, Self::MALZAHAR, Self::TALON,
pub const ORIANNA: Self = Self(61); Self::RIVEN, Self::KOG_MAW, Self::SHEN, Self::LUX, Self::XERATH, Self::SHYVANA, Self::AHRI, Self::GRAVES,
/// Ornn (`Ornn`, 516). Self::FIZZ, Self::VOLIBEAR, Self::RENGAR, Self::VARUS, Self::NAUTILUS, Self::VIKTOR, Self::SEJUANI, Self::FIORA,
pub const ORNN: Self = Self(516); Self::ZIGGS, Self::LULU, Self::DRAVEN, Self::HECARIM, Self::KHA_ZIX, Self::DARIUS, Self::JAYCE, Self::LISSANDRA,
/// Pantheon (`Pantheon`, 80). Self::DIANA, Self::QUINN, Self::SYNDRA, Self::AURELION_SOL, Self::KAYN, Self::ZOE, Self::ZYRA, Self::KAI_SA,
pub const PANTHEON: Self = Self(80); Self::SERAPHINE, Self::GNAR, Self::ZAC, Self::YASUO, Self::VEL_KOZ, Self::TALIYAH, Self::CAMILLE, Self::BRAUM,
/// Poppy (`Poppy`, 78). Self::JHIN, Self::KINDRED, Self::JINX, Self::TAHM_KENCH, Self::VIEGO, Self::SENNA, Self::LUCIAN, Self::ZED,
pub const POPPY: Self = Self(78); Self::KLED, Self::EKKO, Self::QIYANA, Self::VI, Self::AATROX, Self::NAMI, Self::AZIR, Self::YUUMI,
/// Pyke (`Pyke`, 555). Self::SAMIRA, Self::THRESH, Self::ILLAOI, Self::REK_SAI, Self::IVERN, Self::KALISTA, Self::BARD, Self::RAKAN,
pub const PYKE: Self = Self(555); Self::XAYAH, Self::ORNN, Self::SYLAS, Self::NEEKO, Self::APHELIOS, Self::RELL, Self::PYKE, Self::YONE,
/// Qiyana (`Qiyana`, 246). Self::SETT, Self::LILLIA, Self::GWEN,
pub const QIYANA: Self = Self(246); ];
/// Quinn (`Quinn`, 133).
pub const QUINN: Self = Self(133);
/// Rakan (`Rakan`, 497).
pub const RAKAN: Self = Self(497);
/// Rammus (`Rammus`, 33).
pub const RAMMUS: Self = Self(33);
/// Rek'Sai (`RekSai`, 421).
pub const REK_SAI: Self = Self(421);
/// Rell (`Rell`, 526).
pub const RELL: Self = Self(526);
/// Renekton (`Renekton`, 58).
pub const RENEKTON: Self = Self(58);
/// Rengar (`Rengar`, 107).
pub const RENGAR: Self = Self(107);
/// Riven (`Riven`, 92).
pub const RIVEN: Self = Self(92);
/// Rumble (`Rumble`, 68).
pub const RUMBLE: Self = Self(68);
/// Ryze (`Ryze`, 13).
pub const RYZE: Self = Self(13);
/// Samira (`Samira`, 360).
pub const SAMIRA: Self = Self(360);
/// Sejuani (`Sejuani`, 113).
pub const SEJUANI: Self = Self(113);
/// Senna (`Senna`, 235).
pub const SENNA: Self = Self(235);
/// Seraphine (`Seraphine`, 147).
pub const SERAPHINE: Self = Self(147);
/// Sett (`Sett`, 875).
pub const SETT: Self = Self(875);
/// Shaco (`Shaco`, 35).
pub const SHACO: Self = Self(35);
/// Shen (`Shen`, 98).
pub const SHEN: Self = Self(98);
/// Shyvana (`Shyvana`, 102).
pub const SHYVANA: Self = Self(102);
/// Singed (`Singed`, 27).
pub const SINGED: Self = Self(27);
/// Sion (`Sion`, 14).
pub const SION: Self = Self(14);
/// Sivir (`Sivir`, 15).
pub const SIVIR: Self = Self(15);
/// Skarner (`Skarner`, 72).
pub const SKARNER: Self = Self(72);
/// Sona (`Sona`, 37).
pub const SONA: Self = Self(37);
/// Soraka (`Soraka`, 16).
pub const SORAKA: Self = Self(16);
/// Swain (`Swain`, 50).
pub const SWAIN: Self = Self(50);
/// Sylas (`Sylas`, 517).
pub const SYLAS: Self = Self(517);
/// Syndra (`Syndra`, 134).
pub const SYNDRA: Self = Self(134);
/// Tahm Kench (`TahmKench`, 223).
pub const TAHM_KENCH: Self = Self(223);
/// Taliyah (`Taliyah`, 163).
pub const TALIYAH: Self = Self(163);
/// Talon (`Talon`, 91).
pub const TALON: Self = Self(91);
/// Taric (`Taric`, 44).
pub const TARIC: Self = Self(44);
/// Teemo (`Teemo`, 17).
pub const TEEMO: Self = Self(17);
/// Thresh (`Thresh`, 412).
pub const THRESH: Self = Self(412);
/// Tristana (`Tristana`, 18).
pub const TRISTANA: Self = Self(18);
/// Trundle (`Trundle`, 48).
pub const TRUNDLE: Self = Self(48);
/// Tryndamere (`Tryndamere`, 23).
pub const TRYNDAMERE: Self = Self(23);
/// Twisted Fate (`TwistedFate`, 4).
pub const TWISTED_FATE: Self = Self(4);
/// Twitch (`Twitch`, 29).
pub const TWITCH: Self = Self(29);
/// Udyr (`Udyr`, 77).
pub const UDYR: Self = Self(77);
/// Urgot (`Urgot`, 6).
pub const URGOT: Self = Self(6);
/// Varus (`Varus`, 110).
pub const VARUS: Self = Self(110);
/// Vayne (`Vayne`, 67).
pub const VAYNE: Self = Self(67);
/// Veigar (`Veigar`, 45).
pub const VEIGAR: Self = Self(45);
/// Vel'Koz (`Velkoz`, 161).
pub const VEL_KOZ: Self = Self(161);
/// Vi (`Vi`, 254).
pub const VI: Self = Self(254);
/// Viego (`Viego`, 234).
pub const VIEGO: Self = Self(234);
/// Viktor (`Viktor`, 112).
pub const VIKTOR: Self = Self(112);
/// Vladimir (`Vladimir`, 8).
pub const VLADIMIR: Self = Self(8);
/// Volibear (`Volibear`, 106).
pub const VOLIBEAR: Self = Self(106);
/// Warwick (`Warwick`, 19).
pub const WARWICK: Self = Self(19);
/// Wukong (`MonkeyKing`, 62).
pub const WUKONG: Self = Self(62);
/// Xayah (`Xayah`, 498).
pub const XAYAH: Self = Self(498);
/// Xerath (`Xerath`, 101).
pub const XERATH: Self = Self(101);
/// Xin Zhao (`XinZhao`, 5).
pub const XIN_ZHAO: Self = Self(5);
/// Yasuo (`Yasuo`, 157).
pub const YASUO: Self = Self(157);
/// Yone (`Yone`, 777).
pub const YONE: Self = Self(777);
/// Yorick (`Yorick`, 83).
pub const YORICK: Self = Self(83);
/// Yuumi (`Yuumi`, 350).
pub const YUUMI: Self = Self(350);
/// Zac (`Zac`, 154).
pub const ZAC: Self = Self(154);
/// Zed (`Zed`, 238).
pub const ZED: Self = Self(238);
/// Ziggs (`Ziggs`, 115).
pub const ZIGGS: Self = Self(115);
/// Zilean (`Zilean`, 26).
pub const ZILEAN: Self = Self(26);
/// Zoe (`Zoe`, 142).
pub const ZOE: Self = Self(142);
/// Zyra (`Zyra`, 143).
pub const ZYRA: Self = Self(143);
pub const fn is_known(self) -> bool { pub const fn is_known(self) -> bool {
match self { match self {

View File

@ -3,13 +3,14 @@
const champions = require('./.champion.json') const champions = require('./.champion.json')
.filter(({ id }) => id > 0) .filter(({ id }) => id > 0)
.sortBy(({ name }) => name); .sortBy(({ name }) => name);
const constName = name => dotUtils.changeCase.constantCase(name).replace(/[^_A-Z0-9]+/g, ''); const constName = name => dotUtils.changeCase.constantCase(name).replace(/[^_A-Z0-9]+/g, '');
const constNamePad = 12; const constNamePad = 12;
const hashFactor = 256; const hashFactor = 256;
const strHash = (str) => { const strHash = (str) => {
let h = 0; let h = 0;
for (let c of str) for (const c of str)
h = hashFactor * h + c.charCodeAt(0); h = hashFactor * h + c.charCodeAt(0);
return h; return h;
}; };
@ -32,18 +33,35 @@ pub struct Champion(pub i16);
impl Champion { impl Champion {
{{ {{
for (let { id, alias, name } of champions) { for (const { id, alias, name } of champions) {
}} }}
/// {{= name }} (`{{= alias }}`, {{= id }}). /** {{= `${name} (\`${alias}\`, ${id})`.padEnd(33) }} */ pub const {{= `${constName(name)}:`.padEnd(1 + constNamePad) }} Self = Self({{= id }});
pub const {{= constName(name) }}: Self = Self({{= id }});
{{ {{
} }
}} }}
}
impl Champion {
/// Array containing all Champion variants, ordered by their id value.
pub const ALL: [Self; {{= champions.length }}] = [
{{
{
const champNames = require('./.champion.json').slice(1).map(({ name }) => `Self::${constName(name)},`.padEnd(8 + constNamePad));
const step = 8;
for (let i = 0; i < champNames.length; i += step) {
}}
{{= champNames.slice(i, i + step).join('').trim() }}
{{
}
}
}}
];
pub const fn is_known(self) -> bool { pub const fn is_known(self) -> bool {
match self { match self {
{{ {{
for (let { name, alias } of champions) { for (const { name, alias } of champions) {
}} }}
Self::{{= constName(name).padEnd(constNamePad) }} => true, Self::{{= constName(name).padEnd(constNamePad) }} => true,
{{ {{
@ -57,7 +75,7 @@ impl Champion {
pub const fn name(self) -> Option<&'static str> { pub const fn name(self) -> Option<&'static str> {
match self { match self {
{{ {{
for (let { name } of champions) { for (const { name } of champions) {
}} }}
Self::{{= constName(name).padEnd(constNamePad) }} => Some("{{= name }}"), Self::{{= constName(name).padEnd(constNamePad) }} => Some("{{= name }}"),
{{ {{
@ -76,7 +94,7 @@ impl Champion {
/// Field | Name | Identifier /// Field | Name | Identifier
/// --------|------|----------- /// --------|------|-----------
{{ {{
for (let { name, alias } of champions) { for (const { name, alias } of champions) {
if (name.replace(/[^a-zA-Z0-9]+/, '') !== alias) { if (name.replace(/[^a-zA-Z0-9]+/, '') !== alias) {
}} }}
/// `{{= constName(name) }}` | "{{= name }}" | "{{= alias }}" /// `{{= constName(name) }}` | "{{= name }}" | "{{= alias }}"
@ -87,7 +105,7 @@ impl Champion {
pub const fn identifier(self) -> Option<&'static str> { pub const fn identifier(self) -> Option<&'static str> {
match self { match self {
{{ {{
for (let { name, alias } of champions) { for (const { name, alias } of champions) {
}} }}
Self::{{= constName(name).padEnd(constNamePad) }} => Some("{{= alias }}"), Self::{{= constName(name).padEnd(constNamePad) }} => Some("{{= alias }}"),
{{ {{