Repository navigation
Conversation
| let data = this.cache.gen[type][gen.num]; | ||
| if (!data) { | ||
| if (this.minimal) { | ||
| if (isChampions) format = 'champions' + format; |
There was a problem hiding this comment.
forgive me, but why can't a user just pass champions as part of the format?
There was a problem hiding this comment.
Yeah, I had this kind of backwards. I didn't internalize that we pass in gen8ou and not just ou so I switched it to championsou now meaning we can use that to figure out isChampions instead of the user having to pass it in always (they will still need to pass it in if there's no format).
I also fixed a bug that had champions and the regulations for the VGC formats in the master champions.json file and format file names, made baseFormat handle champions VGC / BSS formats, added more tests, fixed a caching bug (champions formats now cache to 0).
For the stats function it expects champions<format> (like the analyses & sets functions) but on the Smogon disk they are gen9champions<format> (equiv to the PS format name) if you want me to switch to match that format lmk.
| @@ -227,7 +227,8 @@ export class Smogon { | |||
| * Returns Analysis objects for the given Pokémon species and gen, optionally scoped to a | |||
| * particular format. | |||
| */ | |||
| async analyses(gen: Generation, species: string | Specie, format?: ID) { | |||
| async analyses(gen: Generation, species: string | Specie, format?: ID, isChampions = false) { | |||
| isChampions = isChampions || !!format?.startsWith('champions'); | |||
There was a problem hiding this comment.
why is answered on discord also, this param should be mentioned in the doc comment isChampions still needed as a param?if it is necessary (ie/ "scoped to a particular format or champions"). as a final nit, i prefer just champions even if its a boolean
There was a problem hiding this comment.
also, im wondering if we should just make the format param format | 'champions'? avoids the extra arg, can still just check startsWith('champions') to detect champions. need to do a literal string check on the format arg and it also is effectively using an inband sentinel instead of another arg, but might be cleaner?
| @@ -102,12 +104,13 @@ function eligible(gen, species) { | |||
|
|
|||
| (async () => { | |||
| const index = {analyses: {}, sets: {}}; | |||
| for (let gen = 1; gen <= 9; gen++) { | |||
| const dex = Dex.forGen(gen); | |||
| for (let gen = 0; gen <= 9; gen++) { | |||
There was a problem hiding this comment.
i think this should just be i or whatever and psGen should be renamed gen
| @@ -208,7 +208,7 @@ export const Analyses = new (class { | |||
| * Returns Smogon's display representation of the given gen. | |||
| */ | |||
| gen(gen: GenerationNum) { | |||
There was a problem hiding this comment.
this wont work, it needs to be 0 | GenerationNum, no? in which case it maybe should just be 'champions' | GenerationNum probably?
There was a problem hiding this comment.
actually just pretty sure we shouldnt be calling this function with champions (or 0) at all and should just handle champions at a higher level
| await serialize(data.gen.analyses, `analyses/gen${gen}.json`); | ||
| index.sets[`gen${gen}.json`] = | ||
| await serialize(data.gen.sets, `sets/gen${gen}.json`); | ||
| const genFname = gen === 0 ? `champions.json` : `gen${gen}.json`; |
There was a problem hiding this comment.
genFname -> file? I like terser names :)
closes #19 Co-authored-by: Waleed Hassan <waleed.hassan.aidid@gmail.com>
No description provided.