mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-09 04:23:01 -05:00
Fix crash when packing a team with custom mons
Also synchronize fastUnpackTeam
This commit is contained in:
parent
e539388861
commit
cbf82c389b
|
|
@ -83,12 +83,16 @@ _Storage.prototype.packTeam = function(team) {
|
|||
var template = Tools.getTemplate(set.species || set.name);
|
||||
var abilities = template.abilities;
|
||||
id = toId(set.ability);
|
||||
if (id == toId(abilities['0'])) {
|
||||
buf += '|';
|
||||
} else if (id === toId(abilities['1'])) {
|
||||
buf += '|1';
|
||||
} else if (id === toId(abilities['H'])) {
|
||||
buf += '|H';
|
||||
if (abilities) {
|
||||
if (id == toId(abilities['0'])) {
|
||||
buf += '|';
|
||||
} else if (id === toId(abilities['1'])) {
|
||||
buf += '|1';
|
||||
} else if (id === toId(abilities['H'])) {
|
||||
buf += '|H';
|
||||
} else {
|
||||
buf += '|' + id;
|
||||
}
|
||||
} else {
|
||||
buf += '|' + id;
|
||||
}
|
||||
|
|
@ -182,7 +186,7 @@ _Storage.prototype.fastUnpackTeam = function(buf) {
|
|||
j = buf.indexOf('|', i);
|
||||
var ability = buf.substring(i, j);
|
||||
var template = Tools.getTemplate(set.species);
|
||||
set.ability = (ability in {'':1, 0:1, 1:1, H:1} ? template.abilities[ability||'0'] : ability);
|
||||
set.ability = (template.abilities && ability in {'':1, 0:1, 1:1, H:1} ? template.abilities[ability||'0'] : ability);
|
||||
i = j+1;
|
||||
|
||||
// moves
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user