From 11b00b1c2aa689f2e7e62d0507b7998c450d2ee2 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Wed, 31 Jul 2013 17:33:33 -0500 Subject: [PATCH] Convert species to PS format when importing teams This fixes the bug where imported teams would sometimes have icon problems. --- js/client-teambuilder.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/client-teambuilder.js b/js/client-teambuilder.js index 5fcf8c60f..6514c861f 100644 --- a/js/client-teambuilder.js +++ b/js/client-teambuilder.js @@ -1276,15 +1276,17 @@ line = line.substr(0, line.length-4); } var parenIndex = line.lastIndexOf(' ('); + var species = ''; if (line.substr(line.length-1) === ')' && parenIndex !== -1) { line = line.substr(0, line.length-1); - curSet.species = line.substr(parenIndex+2); + species = line.substr(parenIndex+2); line = line.substr(0, parenIndex); curSet.name = line; } else { - curSet.name = line; - curSet.species = line; + species = line; } + curSet.species = BattleAliases[toId(species)] || species; + if (!curSet.name) curSet.name = curSet.species; } else if (line.substr(0, 7) === 'Trait: ') { line = line.substr(7); curSet.ability = line;