mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-10-02 15:53:11 -05:00
Add option to ignore opponents
Ignores chat messages from an opponent and causes their Pokemon to display species instead of nicknames
This commit is contained in:
11
js/battle.js
11
js/battle.js
@@ -520,14 +520,14 @@ var Pokemon = (function () {
|
||||
if (this.side.n === 0) {
|
||||
return Tools.escapeHTML(this.name);
|
||||
} else {
|
||||
return "The opposing " + Tools.escapeHTML(this.name);
|
||||
return "The opposing " + (this.side.battle.ignoreOpponent ? this.species : Tools.escapeHTML(this.name));
|
||||
}
|
||||
};
|
||||
Pokemon.prototype.getLowerName = function () {
|
||||
if (this.side.n === 0) {
|
||||
return Tools.escapeHTML(this.name);
|
||||
} else {
|
||||
return "the opposing " + Tools.escapeHTML(this.name);
|
||||
return "the opposing " + (this.side.battle.ignoreOpponent ? this.species : Tools.escapeHTML(this.name));
|
||||
}
|
||||
};
|
||||
Pokemon.prototype.getTitle = function () {
|
||||
@@ -540,8 +540,8 @@ var Pokemon = (function () {
|
||||
return titlestring;
|
||||
};
|
||||
Pokemon.prototype.getFullName = function (plaintext) {
|
||||
var name = Tools.escapeHTML(this.name);
|
||||
if (this.name !== this.species) {
|
||||
var name = this.side.n && this.side.battle.ignoreOpponent ? this.species : Tools.escapeHTML(this.name);
|
||||
if (name !== this.species) {
|
||||
if (plaintext) {
|
||||
name += ' (' + this.species + ')';
|
||||
} else {
|
||||
@@ -1550,7 +1550,7 @@ var Side = (function () {
|
||||
var gender = '';
|
||||
if (pokemon.gender === 'F') gender = ' <small style="color:#C57575">♀</small>';
|
||||
if (pokemon.gender === 'M') gender = ' <small style="color:#7575C0">♂</small>';
|
||||
return '<div class="statbar' + (this.n ? ' lstatbar' : ' rstatbar') + '"><strong>' + Tools.escapeHTML(pokemon.name) + gender + (pokemon.level === 100 ? '' : ' <small>L' + pokemon.level + '</small>') + '</strong><div class="hpbar"><div class="hptext"></div><div class="hptextborder"></div><div class="prevhp"><div class="hp"></div></div><div class="status"></div></div>';
|
||||
return '<div class="statbar' + (this.n ? ' lstatbar' : ' rstatbar') + '"><strong>' + (this.n && this.battle.ignoreOpponent ? pokemon.species : Tools.escapeHTML(pokemon.name)) + gender + (pokemon.level === 100 ? '' : ' <small>L' + pokemon.level + '</small>') + '</strong><div class="hpbar"><div class="hptext"></div><div class="hptextborder"></div><div class="prevhp"><div class="hp"></div></div><div class="status"></div></div>';
|
||||
};
|
||||
Side.prototype.switchIn = function (pokemon, slot) {
|
||||
if (slot === undefined) slot = pokemon.slot;
|
||||
@@ -5331,6 +5331,7 @@ var Battle = (function () {
|
||||
case 'c':
|
||||
name = args[1];
|
||||
if (this.ignoreSpects && (name.charAt(0) === ' ' || name.charAt(0) === '+')) break;
|
||||
if (this.ignoreOpponent && name.charAt(0) === '\u2605' && toUserid(name) !== app.user.get('userid')) break;
|
||||
if (window.app && app.ignore && app.ignore[toUserid(name)]) break;
|
||||
args.shift();
|
||||
args.shift();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
this.$chat = this.$chatFrame.find('.inner');
|
||||
|
||||
this.$options = this.battle.optionsElem.html('<div style="padding-top: 3px; text-align: right"><label style="font-size: 8pt; padding: 3px 5px"><input type="checkbox" name="ignorespects" /> Ignore Spectators</label></div>');
|
||||
this.$options = this.battle.optionsElem.html('<div style="padding-top: 3px; text-align: right"><label style="font-size: 8pt; padding: 3px 5px"><input type="checkbox" name="ignorespects" /> Ignore Spectators</label> <label style="font-size: 8pt; padding: 3px 5px"><input type="checkbox" name="ignoreopp" /> Ignore Opponent</label></div>');
|
||||
|
||||
this.battle.customCallback = _.bind(this.updateControls, this);
|
||||
this.battle.endCallback = _.bind(this.updateControls, this);
|
||||
@@ -32,7 +32,8 @@
|
||||
this.battle.play();
|
||||
},
|
||||
events: {
|
||||
'change input[name=ignorespects]': 'toggleIgnoreSpects'
|
||||
'change input[name=ignorespects]': 'toggleIgnoreSpects',
|
||||
'change input[name=ignoreopp]': 'toggleIgnoreOpponent'
|
||||
},
|
||||
battleEnded: false,
|
||||
join: function() {
|
||||
@@ -691,6 +692,10 @@
|
||||
toggleIgnoreSpects: function(e) {
|
||||
this.battle.ignoreSpects = !!e.currentTarget.checked;
|
||||
},
|
||||
toggleIgnoreOpponent: function(e) {
|
||||
this.battle.ignoreOpponent = !!e.currentTarget.checked;
|
||||
this.battle.add('Opponent ' + (this.battle.ignoreOpponent ? '' : 'no longer ') + 'ignored.');
|
||||
},
|
||||
forfeit: function() {
|
||||
this.send('/forfeit');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user