diff --git a/js/client-teambuilder.js b/js/client-teambuilder.js index 8ab4cafba..91efdde7e 100644 --- a/js/client-teambuilder.js +++ b/js/client-teambuilder.js @@ -18,6 +18,7 @@ this.buildMovelists(); if (this.curTeam) { this.curTeam.iconCache = '!'; + this.curTeam.gen = this.getGen(this.curTeam.format); Storage.activeSetList = this.curSetList; } }, @@ -721,8 +722,9 @@ }, formatChange: function (e) { this.curTeam.format = e.currentTarget.value; + this.curTeam.gen = this.getGen(this.curTeam.format); this.save(); - if (this.curTeam.format.substr(0, 4) === 'gen5' && !Tools.loadedSpriteData['bw']) Tools.loadSpriteData('bw'); + if (this.curTeam.gen === 5 && !Tools.loadedSpriteData['bw']) Tools.loadSpriteData('bw'); }, nicknameChange: function (e) { var i = +$(e.currentTarget).closest('li').attr('value'); @@ -2325,6 +2327,11 @@ this.movelist = Tools.movelists[speciesid]; } }, + getGen: function (format) { + format = '' + format; + if (format.substr(0, 3) !== 'gen') return 6; + return parseInt(format.substr(3, 1)) || 6; + }, destroy: function () { app.clearGlobalListeners(); Room.prototype.destroy.call(this);