mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-07 19:38:02 -05:00
Fix broken avatar change messsage when using avatar numbers (#1379)
This commit is contained in:
@@ -923,8 +923,12 @@
|
||||
case 'avatar':
|
||||
var parts = target.split(',');
|
||||
var avatar = parts[0].toLowerCase().replace(/[^a-z0-9-]+/g, '');
|
||||
// Replace avatar number with name before sending it to the server, only the client knows what to do with the numbers
|
||||
if (window.BattleAvatarNumbers && Object.prototype.hasOwnProperty.call(window.BattleAvatarNumbers, avatar)) {
|
||||
avatar = window.BattleAvatarNumbers[avatar];
|
||||
}
|
||||
Dex.prefs('avatar', avatar);
|
||||
return text; // Send the /avatar command through to the server.
|
||||
return '/avatar ' + avatar; // Send the command through to the server.
|
||||
|
||||
case 'afd':
|
||||
var cleanedTarget = toID(target);
|
||||
|
||||
@@ -670,10 +670,14 @@
|
||||
buf += '<p><button name="close">Cancel</button></p>';
|
||||
this.$el.html(buf).css('max-width', 780);
|
||||
},
|
||||
setAvatar: function (i) {
|
||||
app.send('/avatar ' + i);
|
||||
setAvatar: function (avatar) {
|
||||
// Replace avatar number with name before sending it to the server, only the client knows what to do with the numbers
|
||||
if (window.BattleAvatarNumbers && Object.prototype.hasOwnProperty.call(window.BattleAvatarNumbers, avatar)) {
|
||||
avatar = window.BattleAvatarNumbers[avatar];
|
||||
}
|
||||
app.send('/avatar ' + avatar);
|
||||
app.send('/cmd userdetails ' + app.user.get('userid'));
|
||||
Dex.prefs('avatar', i);
|
||||
Dex.prefs('avatar', avatar);
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user