diff --git a/.eslintrc.js b/.eslintrc.js index 2f83eb3845..9c820e10ce 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,10 +19,10 @@ module.exports = { "BattleAbilities": false, "BattleAliases": false, "BattleBackdrops": false, "BattleBackdropsFour": false, "BattleBackdropsThree": false, "BattleEffects": false, "BattleFormats": false, "BattleFormatsData": false, "BattleLearnsets": false, "BattleItems": false, "BattleMoveAnims": false, "BattleMovedex": false, "BattleNatures": false, "BattleOtherAnims": false, "BattlePokedex": false,"BattlePokemonSprites": false, "BattlePokemonSpritesBW": false, "BattleSearchCountIndex": false, "BattleSearchIndex": false, - "BattleSearchIndexOffset": false, "BattleSearchIndexType": false, "BattleStatIDs": false, "BattleStatNames": false, "BattleStats": false, "BattleStatusAnims": false, "BattleStatuses": false, + "BattleSearchIndexOffset": false, "BattleSearchIndexType": false, "BattleStatIDs": false, "BattleStatNames": false, "BattleStats": false, "BattleStatusAnims": false, "BattleStatuses": false, "BattleTeambuilderTable": false, // Generic global variables - "Config": false, "Chart": false, "soundManager": false, "Storage": false, "Tools": false, + "Config": false, "BattleSearch": false, "soundManager": false, "Storage": false, "Tools": false, "app": false, "toId": false, "toRoomid": false, "toUserid": false, "toName": false, "hashColor": false, "MD5": false, "ChatHistory": false, "Topbar": false, "UserList": false, diff --git a/githooks/build-indexes b/githooks/build-indexes index c90318ced2..1f4bf185c0 100755 --- a/githooks/build-indexes +++ b/githooks/build-indexes @@ -103,3 +103,51 @@ const fs = require("fs"); } console.log("DONE"); + +/********************************************************* + * Build teambuilder-tables.js + *********************************************************/ + +process.stdout.write("Building `data/teambuilder-tables.js`... "); + +{ + const BattleTeambuilderTable = {}; + + let buf = '// automatically built with githooks/build-indexes\n\n'; + + const pokemon = Object.keys(Tools.data.Pokedex); + pokemon.sort(); + const tierTable = {}; + for (const id of pokemon) { + const tier = Tools.getTemplate(id).tier; + + if (!tierTable[tier]) tierTable[tier] = []; + tierTable[tier].push(id); + } + + const tiers = BattleTeambuilderTable.tiers = []; + const formatSlices = BattleTeambuilderTable.formatSlices = {}; + + const tierOrder = ["Uber", "OU", "BL", "(OU)", "UU", "BL2", "RU", "BL3", "NU", "BL4", "PU", "NFE", "LC Uber", "LC"]; + + for (const tier of tierOrder) { + if (tier === "OU" || tier === "Uber" || tier === "UU" || tier === "RU" || tier === "NU" || tier === "PU" || tier === "LC") { + formatSlices[tier] = tiers.length; + } + if (!tierTable[tier]) continue; + if (tier.charAt(0) === '(') { + tiers.push(['header', tier.slice(1, -1) + " by technicality"]); + } else if (tier === "NFE") { + tiers.push(['header', "NFEs not in a higher tier"]); + } else { + tiers.push(['header', tier]); + } + tiers.push(...tierTable[tier]); + } + + buf += 'exports.BattleTeambuilderTable = ' + JSON.stringify(BattleTeambuilderTable) + ';\n\n'; + + fs.writeFileSync('data/teambuilder-tables.js', buf); +} + +console.log("DONE"); diff --git a/index.template.html b/index.template.html index 5667b90968..da9269fc27 100644 --- a/index.template.html +++ b/index.template.html @@ -164,7 +164,9 @@
Filters: '; for (var i = 0; i < this.filters.length; i++) { - if (i) buf += ', '; var text = this.filters[i][1]; - if (this.filters[i][0] === 'moves') text = Tools.getMove(text).name; + if (this.filters[i][0] === 'move') text = Tools.getMove(text).name; if (this.filters[i][0] === 'pokemon') text = Tools.getTemplate(text).name; - buf += '' + text + ''; + buf += '' + text + ' '; } - if (!q) buf += ' (backspace = delete filter)'; - return buf; + if (!q) buf += '(backspace = delete filter)'; + return buf + '
Will be ' + Tools.escapeHTML(template.abilities['0']) + ' after Mega Evolving.