Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivaD173 committed Aug 23, 2024
2 parents 47578cb + 4d172e4 commit e290433
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
6 changes: 4 additions & 2 deletions play.pokemonshowdown.com/js/client-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,12 @@
return x.startsWith(prefix);
}).length : prefix != this.tabComplete.prefix);
var isCommandSearch = (text.startsWith('/') && !text.startsWith('//')) || text.startsWith('!');
if (isCommandSearch && shouldSearchCommands) {
var resultsExist = this.tabComplete.lastSearch === text && this.tabComplete.commands;
if (isCommandSearch && shouldSearchCommands && !resultsExist) {
if (this.tabComplete.searchPending) return true; // wait
this.tabComplete.isCommand = true;
this.tabComplete.searchPending = true;
this.tabComplete.lastSearch = text;
var self = this;
app.once('response:cmdsearch', function (data) {
delete self.tabComplete.searchPending;
Expand All @@ -376,7 +378,7 @@
self.handleTabComplete($textbox, reverse);
}
});
app.send('/crq cmdsearch ' + text);
this.send('/crq cmdsearch ' + text);
return true;
} else if (!isCommandSearch) {
delete this.tabComplete.isCommand;
Expand Down
22 changes: 22 additions & 0 deletions play.pokemonshowdown.com/js/client-mainmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,9 @@
var bestOfDefault = format ? BattleFormats[format] ? BattleFormats[format].bestOfDefault : false : true;
buf += '<p' + (!bestOfDefault ? ' class="hidden">' : '>');
buf += '<label class="checkbox"><input type="checkbox" name="bestof" /> <abbr title="Start a team-locked best-of-n series">Best-of-<input name="bestofvalue" type="number" min="3" max="9" step="2" value="3" style="width: 28px; vertical-align: initial;"></abbr></label></p>';
var teraPreviewDefault = format && BattleFormats[format] ? BattleFormats[format].teraPreviewDefault : false;
buf += '<p' + (!teraPreviewDefault ? ' class="hidden">' : '>');
buf += '<label class="checkbox"><input type="checkbox" name="terapreview" /> <abbr title="Start a battle with Tera Type Preview">Tera Type Preview</abbr></label></p>';
buf += '<p class="buttonbar"><button name="makeChallenge" class="button"><strong>Challenge</strong></button> <button type="button" name="dismissChallenge" class="button">Cancel</button></p></form>';
$challenge.html(buf);
},
Expand Down Expand Up @@ -955,6 +958,13 @@
format += 'Best of = ' + bestOfValue;
}

var teraPreview = $pmWindow.find('input[name=terapreview]').is(':checked');
if (teraPreview) {
var hasCustomRulesT = format.includes('@@@');
format += hasCustomRulesT ? ', ' : '@@@';
format += 'Tera Type Preview';
}

var team = null;
if (Storage.teams[teamIndex]) team = Storage.teams[teamIndex];

Expand Down Expand Up @@ -1404,6 +1414,18 @@
}
}

var $teraPreviewCheckbox = this.sourceEl.closest('form').find('input[name=terapreview]');
if ($teraPreviewCheckbox) {
var $parentTag = $teraPreviewCheckbox.parent().parent();
var teraPreviewDefault = BattleFormats[format] && BattleFormats[format].teraPreviewDefault;
if (teraPreviewDefault) {
$parentTag.removeClass('hidden');
} else {
$parentTag.addClass('hidden');
$teraPreviewCheckbox.prop('checked', false);
}
}

var $partnerLabels = $('label[name=partner]');
$partnerLabels.each(function (i, label) {
label.style.display = BattleFormats[format].partner ? '' : 'none';
Expand Down
3 changes: 3 additions & 0 deletions play.pokemonshowdown.com/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,7 @@ function toId() {
var tournamentShow = true;
var partner = false;
var bestOfDefault = false;
var teraPreviewDefault = false;
var team = null;
var teambuilderLevel = null;
var lastCommaIndex = name.lastIndexOf(',');
Expand All @@ -1355,6 +1356,7 @@ function toId() {
if (code & 16) teambuilderLevel = 50;
if (code & 32) partner = true;
if (code & 64) bestOfDefault = true;
if (code & 128) teraPreviewDefault = true;
} else {
// Backwards compatibility: late 0.9.0 -> 0.10.0
if (name.substr(name.length - 2) === ',#') { // preset teams
Expand Down Expand Up @@ -1419,6 +1421,7 @@ function toId() {
challengeShow: challengeShow,
tournamentShow: tournamentShow,
bestOfDefault: bestOfDefault,
teraPreviewDefault: teraPreviewDefault,
rated: searchShow && id.substr(4, 7) !== 'unrated',
teambuilderLevel: teambuilderLevel,
partner: partner,
Expand Down
2 changes: 1 addition & 1 deletion pokemonshowdown.com/ladder.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
<th width="60" style="text-align:center"><abbr title="Elo rating">Elo</abbr></th>
<th width="50" style="text-align:center"><abbr title="user's percentage chance of winning a random battle (aka GLIXARE)">GXE</abbr></th>
<!--th width="50" style="text-align:center"><abbr title="Win Chance vs Average Opponent">WCAO</abbr></th-->
<th width="80" style="text-align:center"><abbr title="Glicko-1 rating: rating&#177;deviation">Glicko-1</abbr></th>
<th width="90" style="text-align:center"><abbr title="Glicko-1 rating: rating&#177;deviation">Glicko-1</abbr></th>
<th width="50"><abbr title="A special rating used for suspect tests.">COIL</abbr></th>
</tr>
<?php
Expand Down

0 comments on commit e290433

Please sign in to comment.