Moves ';
for (var i = 0; i <= 3; i++) {
+ var move = Dex.moves.get(set.moves[i]);
if (i > 0) buf += '
';
buf += ' ';
buf += ''
- for (var j = 0; j <= 3; j++) {
- var movePPUps = isNaN(set.movePPUps[i]) ? 3 : set.movePPUps[i];
- buf += '' + j + ' '
+ if (!move.exists) {
+ buf += ' ';
+ } else if (!move.isZ && !move.noPPBoosts) {
+ for (var j = 0; j <= 3; j++) {
+ var movePPUps = isNaN(set.movePPUps[i]) ? 3 : set.movePPUps[i];
+ var movePP = (move.pp / 5) * (5 + j);
+ buf += '' + movePP + ' ';
+ }
+ } else {
+ buf += '' + move.pp + ' ';
}
buf += '
'
}
@@ -2974,6 +2982,7 @@
this.$('input[name=move' + Math.min(moves.length + 1, 4) + ']').focus();
this.curSet.moves = moves;
this.search.find('');
+ this.updateMovePP();
return;
}
}
@@ -3216,6 +3225,7 @@
this.unChooseMove(this.curSet.moves[0]);
this.curSet.moves[0] = val;
this.chooseMove(val);
+ this.updateMovePP();
if (selectNext) this.$('input[name=move2]').select();
break;
case 'move2':
@@ -3223,6 +3233,7 @@
this.unChooseMove(this.curSet.moves[1]);
this.curSet.moves[1] = val;
this.chooseMove(val);
+ this.updateMovePP();
if (selectNext) this.$('input[name=move3]').select();
break;
case 'move3':
@@ -3231,6 +3242,7 @@
this.unChooseMove(this.curSet.moves[2]);
this.curSet.moves[2] = val;
this.chooseMove(val);
+ this.updateMovePP();
if (selectNext) this.$('input[name=move4]').select();
break;
case 'move4':
@@ -3240,6 +3252,7 @@
this.unChooseMove(this.curSet.moves[3]);
this.curSet.moves[3] = val;
this.chooseMove(val);
+ this.updateMovePP();
if (selectNext) {
this.stats();
this.$('button.setstats').focus();
@@ -3248,6 +3261,24 @@
}
this.save();
},
+ updateMovePP: function () {
+ if (!this.curSet) return;
+ for (var i = 0; i <= 3; i++) {
+ var buf = '';
+ var move = Dex.moves.get(this.curSet.moves[i]);
+ if (!move.exists) {
+ buf += '
';
+ } else if (!move.isZ && !move.noPPBoosts) {
+ for (var j = 0; j <= 3; j++) {
+ var movePP = (move.pp / 5) * (5 + j);
+ buf += '
' + movePP + ' ';
+ }
+ } else {
+ buf += '
' + move.pp + ' ';
+ }
+ this.$('select[name=move' + (i + 1) + 'pp]').html(buf);
+ }
+ },
unChooseMove: function (moveName) {
var set = this.curSet;
if (!moveName || !set || this.curTeam.format === 'gen7hiddentype') return;
From ab6c6dee4022a4d8f7e93a7233a7b8a265b12897 Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Fri, 16 Feb 2024 00:01:11 -0800
Subject: [PATCH 06/15] Update client-teambuilder.js
---
play.pokemonshowdown.com/js/client-teambuilder.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/play.pokemonshowdown.com/js/client-teambuilder.js b/play.pokemonshowdown.com/js/client-teambuilder.js
index 33cfc21306..5387e424bc 100644
--- a/play.pokemonshowdown.com/js/client-teambuilder.js
+++ b/play.pokemonshowdown.com/js/client-teambuilder.js
@@ -2965,6 +2965,7 @@
if (this.curChartType === 'move' && e.currentTarget.className === 'cur') {
// clicked a move, remove it if we already have it
var moves = [];
+ var movePPUps = [];
for (var i = 0; i < this.curSet.moves.length; i++) {
var curVal = this.curSet.moves[i];
if (curVal === val) {
@@ -2972,6 +2973,7 @@
delete this.search.cur[toID(val)];
} else if (curVal) {
moves.push(curVal);
+ movePPUps.push(this.curSet.movePPUps[i]);
}
}
if (moves.length < this.curSet.moves.length) {
@@ -2981,6 +2983,7 @@
this.$('input[name=move4]').val(moves[3] || '');
this.$('input[name=move' + Math.min(moves.length + 1, 4) + ']').focus();
this.curSet.moves = moves;
+ this.curSet.movePPUps = movePPUps;
this.search.find('');
this.updateMovePP();
return;
@@ -3270,8 +3273,9 @@
buf += '
';
} else if (!move.isZ && !move.noPPBoosts) {
for (var j = 0; j <= 3; j++) {
+ var movePPUps = isNaN(this.curSet.movePPUps[i]) ? 3 : this.curSet.movePPUps[i];
var movePP = (move.pp / 5) * (5 + j);
- buf += '
' + movePP + ' ';
+ buf += '
' + movePP + ' ';
}
} else {
buf += '
' + move.pp + ' ';
From 65137bf679f24983a7322b67fbd9528ded5d7eb6 Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Fri, 16 Feb 2024 08:41:53 -0800
Subject: [PATCH 07/15] Remove UI
Only editable in the import/export interface now, which can be done by adding ';2', ';1', or ';0' after a move.
---
.../js/client-teambuilder.js | 57 +------------------
play.pokemonshowdown.com/style/client.css | 23 +++-----
2 files changed, 9 insertions(+), 71 deletions(-)
diff --git a/play.pokemonshowdown.com/js/client-teambuilder.js b/play.pokemonshowdown.com/js/client-teambuilder.js
index 5387e424bc..4a6d733fc8 100644
--- a/play.pokemonshowdown.com/js/client-teambuilder.js
+++ b/play.pokemonshowdown.com/js/client-teambuilder.js
@@ -62,7 +62,6 @@
'change select[name=ivspread]': 'ivSpreadChange',
'change .evslider': 'statSlided',
'input .evslider': 'statSlide',
- 'change .movepp': 'movePPChange',
// teambuilder events
'click .utilichart a': 'chartClick',
@@ -1341,25 +1340,10 @@
// moves
if (!set.moves) set.moves = [];
- if (!set.movePPUps) set.movePPUps = [3, 3, 3, 3];
buf += '
';
@@ -2697,18 +2681,6 @@
this.save();
this.updateStatGraph();
},
- movePPChange: function (e) {
- var set = this.curSet;
- if (!set) set = this.curSetList[e.currentTarget.offsetParent.value];
-
- var movePPUps = parseInt(e.currentTarget.value);
- if (!set.movePPUps) set.movePPUps = [3, 3, 3, 3];
- var boxName = e.currentTarget.name;
- set.movePPUps[parseInt(boxName.charAt(4)) - 1] = movePPUps;
-
- this.save();
- this.updateStatGraph();
- },
/*********************************************************
* Set details form
@@ -2965,7 +2937,6 @@
if (this.curChartType === 'move' && e.currentTarget.className === 'cur') {
// clicked a move, remove it if we already have it
var moves = [];
- var movePPUps = [];
for (var i = 0; i < this.curSet.moves.length; i++) {
var curVal = this.curSet.moves[i];
if (curVal === val) {
@@ -2973,7 +2944,6 @@
delete this.search.cur[toID(val)];
} else if (curVal) {
moves.push(curVal);
- movePPUps.push(this.curSet.movePPUps[i]);
}
}
if (moves.length < this.curSet.moves.length) {
@@ -2983,9 +2953,7 @@
this.$('input[name=move4]').val(moves[3] || '');
this.$('input[name=move' + Math.min(moves.length + 1, 4) + ']').focus();
this.curSet.moves = moves;
- this.curSet.movePPUps = movePPUps;
this.search.find('');
- this.updateMovePP();
return;
}
}
@@ -3228,7 +3196,6 @@
this.unChooseMove(this.curSet.moves[0]);
this.curSet.moves[0] = val;
this.chooseMove(val);
- this.updateMovePP();
if (selectNext) this.$('input[name=move2]').select();
break;
case 'move2':
@@ -3236,7 +3203,6 @@
this.unChooseMove(this.curSet.moves[1]);
this.curSet.moves[1] = val;
this.chooseMove(val);
- this.updateMovePP();
if (selectNext) this.$('input[name=move3]').select();
break;
case 'move3':
@@ -3245,7 +3211,6 @@
this.unChooseMove(this.curSet.moves[2]);
this.curSet.moves[2] = val;
this.chooseMove(val);
- this.updateMovePP();
if (selectNext) this.$('input[name=move4]').select();
break;
case 'move4':
@@ -3255,7 +3220,6 @@
this.unChooseMove(this.curSet.moves[3]);
this.curSet.moves[3] = val;
this.chooseMove(val);
- this.updateMovePP();
if (selectNext) {
this.stats();
this.$('button.setstats').focus();
@@ -3264,25 +3228,6 @@
}
this.save();
},
- updateMovePP: function () {
- if (!this.curSet) return;
- for (var i = 0; i <= 3; i++) {
- var buf = '';
- var move = Dex.moves.get(this.curSet.moves[i]);
- if (!move.exists) {
- buf += '
';
- } else if (!move.isZ && !move.noPPBoosts) {
- for (var j = 0; j <= 3; j++) {
- var movePPUps = isNaN(this.curSet.movePPUps[i]) ? 3 : this.curSet.movePPUps[i];
- var movePP = (move.pp / 5) * (5 + j);
- buf += '
' + movePP + ' ';
- }
- } else {
- buf += '
' + move.pp + ' ';
- }
- this.$('select[name=move' + (i + 1) + 'pp]').html(buf);
- }
- },
unChooseMove: function (moveName) {
var set = this.curSet;
if (!moveName || !set || this.curTeam.format === 'gen7hiddentype') return;
diff --git a/play.pokemonshowdown.com/style/client.css b/play.pokemonshowdown.com/style/client.css
index d5df284994..80ed47b035 100644
--- a/play.pokemonshowdown.com/style/client.css
+++ b/play.pokemonshowdown.com/style/client.css
@@ -2343,7 +2343,7 @@ a.ilink.yours {
background: #CBD6E1;
border-radius: 5px;
padding: 1px 0 0 0;
- width: 100px;
+ width: 110px;
box-shadow: inset 1px 1px 0 rgba(255,255,255,.6);
}
@@ -2360,14 +2360,14 @@ a.ilink.yours {
}
.setcol {
height: 127px;
- width: 102px;
+ width: 112px;
float: left;
}
.setcol-icon {
background: transparent none no-repeat scroll center top;
}
.setcol-details {
- width: 209px;
+ width: 234px;
}
.setcell {
float: left;
@@ -2425,7 +2425,7 @@ a.ilink.yours {
margin-bottom: -1px;
}
.setcol-moves {
- width: 172px;
+ width: 137px;
}
.setcol-stats {
width: 142px;
@@ -2466,7 +2466,7 @@ a.ilink.yours {
outline: 0 none;
}
.setdetails {
- width: 205px;
+ width: 230px;
height: 34px;
}
.setdetails:focus,.setdetails:active {
@@ -2556,13 +2556,12 @@ a.ilink.yours {
display: block;
}
.setchart input,
-.setchart select,
.setchart-nickname input,
.statform input.inputform {
display: block;
padding: 1px;
margin: 2px 3px 1px 1px;
- width: 94px;
+ width: 104px;
height: 20px;
}
.setchart input.incomplete {
@@ -2573,20 +2572,14 @@ a.ilink.yours {
width: 216px;
}
.setchart .setcell-item input {
- width: 99px;
+ width: 114px;
margin-right: 0px;
}
.setchart .setcell-ability input {
margin-left: 0px;
}
.setchart .setcol-moves input {
- width: 109px;
- display: inline-block;
-}
-.setchart .setcol-moves select {
- width: 50px;
- height: 23.6px;
- display: inline-block;
+ width: 129px;
}
.teambuilder-clipboard-container {
From c815bbc655c32a0aa353cf271758244dc7811788 Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Sat, 12 Oct 2024 00:11:00 -0700
Subject: [PATCH 08/15] A little less ugly export formatting
Given that the original thread that suggested PP Up editing is still getting likes to this day, it's still a relevant suggestion and I wanted to revive this PR by making the export look less ugly. Not sure if we still want to have a UI in the teambuilder, as the PR thread suggests starting with changing the export format: https://www.smogon.com/forums/threads/editing-pp-on-showdown.3735890/
I'd also like to see if this works for server-side team storage, but I haven't figured out a way to test that.
---
play.pokemonshowdown.com/js/storage.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js
index fecea8eb26..b70098d46d 100644
--- a/play.pokemonshowdown.com/js/storage.js
+++ b/play.pokemonshowdown.com/js/storage.js
@@ -1369,9 +1369,10 @@ Storage.importTeam = function (buffer, teams) {
if (line === 'Frustration' && curSet.happiness === undefined) {
curSet.happiness = 0;
}
- var [move, movePPUps] = line.split(';', 2);
+ var [move, movePPUps] = line.split(' (PP Ups: ', 2);
curSet.moves.push(move);
if (!curSet.movePPUps) curSet.movePPUps = [];
+ if (movePPUps && movePPUps.length > 1) movePPUps = movePPUps.charAt(0);
if (isNaN(movePPUps)) {
curSet.movePPUps.push(3);
} else {
@@ -1526,7 +1527,7 @@ Storage.exportTeam = function (team, gen, hidestats) {
}
if (move) {
text += '- ' + move;
- if (curSet.movePPUps && curSet.movePPUps[j] < 3) text += ";" + curSet.movePPUps[j];
+ if (curSet.movePPUps && curSet.movePPUps[j] < 3) text += " (PP Ups: " + curSet.movePPUps[j] + ")";
text += " \n";
}
}
From b696d2d9b8da1f181799a928d53acda7936e2dad Mon Sep 17 00:00:00 2001
From: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
Date: Sat, 12 Oct 2024 10:41:47 -0600
Subject: [PATCH 09/15] Update play.pokemonshowdown.com/js/storage.js
---
play.pokemonshowdown.com/js/storage.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js
index b70098d46d..14de6b1858 100644
--- a/play.pokemonshowdown.com/js/storage.js
+++ b/play.pokemonshowdown.com/js/storage.js
@@ -1527,7 +1527,9 @@ Storage.exportTeam = function (team, gen, hidestats) {
}
if (move) {
text += '- ' + move;
- if (curSet.movePPUps && curSet.movePPUps[j] < 3) text += " (PP Ups: " + curSet.movePPUps[j] + ")";
+ if (curSet.movePPUps && curSet.movePPUps[j] && curSet.movePPUps[j] < 3) {
+ text += " (PP Ups: " + curSet.movePPUps[j] + ")";
+ }
text += " \n";
}
}
From 06dcea9dbe614839a88c3dd0f8a4b4c432e098fe Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Sat, 12 Oct 2024 10:33:16 -0700
Subject: [PATCH 10/15] Update storage.js
---
play.pokemonshowdown.com/js/storage.js | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js
index 14de6b1858..b29b5a7134 100644
--- a/play.pokemonshowdown.com/js/storage.js
+++ b/play.pokemonshowdown.com/js/storage.js
@@ -926,7 +926,10 @@ Storage.fastUnpackTeam = function (buf) {
// move PP ups
if (buf.charAt(j) === ';') {
j = buf.indexOf('|', i);
- set.movePPUps = buf.substring(i, j).split(',').map(number => parseInt(number));
+ set.movePPUps = buf.substring(i, j).split(',');
+ for (var index = 0; index < set.movePPUps.length; index++) {
+ set.movePPUps[index] = parseInt(set.movePPUps[index], 10);
+ }
i = j + 1;
}
@@ -1056,7 +1059,10 @@ Storage.unpackTeam = function (buf) {
if (buf.charAt(j) === ';') {
j = buf.indexOf('|', i);
if (j < 0) return null;
- set.movePPUps = buf.substring(i, j).split(',').map(number => parseInt(number));
+ set.movePPUps = buf.substring(i, j).split(',');
+ for (var index = 0; index < set.movePPUps.length; index++) {
+ set.movePPUps[index] = parseInt(set.movePPUps[index], 10);
+ }
i = j + 1;
}
@@ -1369,14 +1375,14 @@ Storage.importTeam = function (buffer, teams) {
if (line === 'Frustration' && curSet.happiness === undefined) {
curSet.happiness = 0;
}
- var [move, movePPUps] = line.split(' (PP Ups: ', 2);
- curSet.moves.push(move);
+ var moveAndPPUps = line.split(' (PP Ups: ', 2);
+ curSet.moves.push(moveAndPPUps[0]);
if (!curSet.movePPUps) curSet.movePPUps = [];
- if (movePPUps && movePPUps.length > 1) movePPUps = movePPUps.charAt(0);
- if (isNaN(movePPUps)) {
+ if (moveAndPPUps[1] && moveAndPPUps[1].length > 1) moveAndPPUps[1] = moveAndPPUps[1].charAt(0);
+ if (isNaN(moveAndPPUps[1])) {
curSet.movePPUps.push(3);
} else {
- curSet.movePPUps.push(parseInt(movePPUps));
+ curSet.movePPUps.push(parseInt(moveAndPPUps[1], 10));
}
}
}
From b3615d7b2c5a2ecb8716c7b179e1fef90a9de218 Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Sat, 12 Oct 2024 22:12:02 -0700
Subject: [PATCH 11/15] Fix unpacking
This should hopefully cover everything needed to implement PP Ups.
---
play.pokemonshowdown.com/js/storage.js | 12 ++++---
.../src/battle-tooltips.ts | 2 ++
.../src/panel-teamdropdown.tsx | 31 ++++++++++++++-----
3 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js
index b29b5a7134..e3ea5e8f9c 100644
--- a/play.pokemonshowdown.com/js/storage.js
+++ b/play.pokemonshowdown.com/js/storage.js
@@ -888,7 +888,7 @@ Storage.fastUnpackTeam = function (buf) {
if (!buf) return [];
var team = [];
- var i = 0, j = 0;
+ var i = 0, j = 0, k = 0;
while (true) {
var set = {};
@@ -919,7 +919,8 @@ Storage.fastUnpackTeam = function (buf) {
// moves
j = buf.indexOf(';', i);
- if (j < 0) j = buf.indexOf('|', i);
+ k = buf.indexOf('|', i);
+ if (j < 0 || j > k) j = k;
set.moves = buf.substring(i, j).split(',');
i = j + 1;
@@ -1016,7 +1017,7 @@ Storage.unpackTeam = function (buf) {
if (!buf) return [];
var team = [];
- var i = 0, j = 0;
+ var i = 0, j = 0, k = 0;
while (true) {
var set = {};
@@ -1046,8 +1047,9 @@ Storage.unpackTeam = function (buf) {
// moves
j = buf.indexOf(';', i);
- if (j < 0) {
- j = buf.indexOf('|', i);
+ k = buf.indexOf('|', i);
+ if (j < 0 || j > k) {
+ j = k;
if (j < 0) return null;
}
set.moves = buf.substring(i, j).split(',').map(function (moveid) {
diff --git a/play.pokemonshowdown.com/src/battle-tooltips.ts b/play.pokemonshowdown.com/src/battle-tooltips.ts
index ebeb171361..4e8a748dc7 100644
--- a/play.pokemonshowdown.com/src/battle-tooltips.ts
+++ b/play.pokemonshowdown.com/src/battle-tooltips.ts
@@ -2517,6 +2517,8 @@ interface PokemonSet {
/** Defaults to no ability (error in Gen 3+) */
ability?: string;
moves: string[];
+ /** Defaults to 3 */
+ movePPUps?: number[];
/** Defaults to no nature (error in Gen 3+) */
nature?: NatureName;
/** Defaults to random legal gender, NOT subject to gender ratios */
diff --git a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
index 0794f16cab..0885a7f807 100644
--- a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
+++ b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
@@ -41,6 +41,10 @@ class PSTeambuilder {
}
}
+ if (set.movePPUps) {
+ buf += ';' + set.movePPUps.join(',');
+ }
+
// nature
buf += '|' + (set.nature || '');
@@ -140,11 +144,16 @@ class PSTeambuilder {
species.abilities[parts[3] as '0' || '0'] || (parts[3] === '' ? '' : '!!!ERROR!!!') :
Dex.abilities.get(parts[3]).name;
- // moves
- set.moves = parts[4].split(',').map(moveid =>
+ // moves and PP ups
+ const [moves, PPUps] = parts[4].split(';', 2);
+ set.moves = moves.split(',').map(moveid =>
Dex.moves.get(moveid).name
);
+ if (PPUps) {
+ set.movePPUps = PPUps.split(',').map(number => parseInt(number));
+ }
+
// nature
set.nature = parts[5] as NatureName;
if (set.nature as any === 'undefined') set.nature = undefined;
@@ -224,14 +233,19 @@ class PSTeambuilder {
text += `Ability: ${set.ability} \n`;
}
if (set.moves) {
- for (let move of set.moves) {
+ for (let i = 0; i < set.moves.length; i++) {
+ let move = set.moves[i];
+ let PPUps = ``;
if (move.substr(0, 13) === 'Hidden Power ') {
const hpType = move.slice(13);
move = move.slice(0, 13);
move = `${move}[${hpType}]`;
}
+ if (set.movePPUps && !isNaN(set.movePPUps[i]) && set.movePPUps[i] < 3) {
+ PPUps = ` (PP Ups: ${set.movePPUps[i]})`;
+ }
if (move) {
- text += `- ${move} \n`;
+ text += `- ${move}${PPUps} \n`;
}
}
}
@@ -395,9 +409,10 @@ class PSTeambuilder {
if (line !== 'undefined') set.nature = line as NatureName;
} else if (line.charAt(0) === '-' || line.charAt(0) === '~') {
line = line.slice(line.charAt(1) === ' ' ? 2 : 1);
- if (line.startsWith('Hidden Power [')) {
- const hpType = line.slice(14, -1) as TypeName;
- line = 'Hidden Power ' + hpType;
+ let [move, PPUps] = line.split(' (PP Ups: ');
+ if (move.startsWith('Hidden Power [')) {
+ const hpType = move.slice(14, -1) as TypeName;
+ move = 'Hidden Power ' + hpType;
if (!set.ivs && Dex.types.isName(hpType)) {
set.ivs = {hp: 31, atk: 31, def: 31, spa: 31, spd: 31, spe: 31};
const hpIVs = Dex.types.get(hpType).HPivs || {};
@@ -406,6 +421,8 @@ class PSTeambuilder {
}
}
}
+ if (!set.movePPUps) set.movePPUps = [];
+ set.movePPUps.push(parseInt(PPUps?.charAt(0)) || 3);
if (line === 'Frustration' && set.happiness === undefined) {
set.happiness = 0;
}
From 8feea82dd91562c49b0321e483a966961f7286c0 Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Sat, 12 Oct 2024 22:15:19 -0700
Subject: [PATCH 12/15] Update panel-teamdropdown.tsx
---
play.pokemonshowdown.com/src/panel-teamdropdown.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
index 0885a7f807..4235c864b3 100644
--- a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
+++ b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
@@ -151,7 +151,7 @@ class PSTeambuilder {
);
if (PPUps) {
- set.movePPUps = PPUps.split(',').map(number => parseInt(number));
+ set.movePPUps = PPUps.split(',').map(n => parseInt(n, 10));
}
// nature
@@ -422,7 +422,7 @@ class PSTeambuilder {
}
}
if (!set.movePPUps) set.movePPUps = [];
- set.movePPUps.push(parseInt(PPUps?.charAt(0)) || 3);
+ set.movePPUps.push(parseInt(PPUps?.charAt(0), 10) || 3);
if (line === 'Frustration' && set.happiness === undefined) {
set.happiness = 0;
}
From 2aa94bbec83c87962ad5de85b410845f2a00929b Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Mon, 14 Oct 2024 21:40:27 -0700
Subject: [PATCH 13/15] Change PP Ups display in packed format
PP Ups values that are 3 will now be shown as empty in the packed format, and if every value would be empty, PP Ups do not get displayed. I made this change to be consistent with how EVs and IVs are handled.
---
play.pokemonshowdown.com/js/storage.js | 17 ++++++++++++++---
.../src/panel-teamdropdown.tsx | 13 ++++++++++---
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js
index e3ea5e8f9c..be5d7adb0b 100644
--- a/play.pokemonshowdown.com/js/storage.js
+++ b/play.pokemonshowdown.com/js/storage.js
@@ -814,7 +814,16 @@ Storage.packTeam = function (team) {
// move PP ups
if (set.movePPUps) {
- buf += ';' + set.movePPUps.join(',');
+ var PPUps = '';
+ var showPPUps = false;
+ for (var j = 0; j < set.movePPUps.length; j++) {
+ if (j) PPUps += ','
+ if (set.movePPUps[j] < 3) {
+ PPUps += set.movePPUps[j];
+ showPPUps = true;
+ }
+ }
+ if (showPPUps) buf += ';' + PPUps;
}
// nature
@@ -930,6 +939,7 @@ Storage.fastUnpackTeam = function (buf) {
set.movePPUps = buf.substring(i, j).split(',');
for (var index = 0; index < set.movePPUps.length; index++) {
set.movePPUps[index] = parseInt(set.movePPUps[index], 10);
+ if (!set.movePPUps[index]) set.movePPUps[index] === 3;
}
i = j + 1;
}
@@ -1064,6 +1074,7 @@ Storage.unpackTeam = function (buf) {
set.movePPUps = buf.substring(i, j).split(',');
for (var index = 0; index < set.movePPUps.length; index++) {
set.movePPUps[index] = parseInt(set.movePPUps[index], 10);
+ if (!set.movePPUps[index]) set.movePPUps[index] === 3;
}
i = j + 1;
}
@@ -1380,7 +1391,7 @@ Storage.importTeam = function (buffer, teams) {
var moveAndPPUps = line.split(' (PP Ups: ', 2);
curSet.moves.push(moveAndPPUps[0]);
if (!curSet.movePPUps) curSet.movePPUps = [];
- if (moveAndPPUps[1] && moveAndPPUps[1].length > 1) moveAndPPUps[1] = moveAndPPUps[1].charAt(0);
+ if (moveAndPPUps[1]) moveAndPPUps[1] = moveAndPPUps[1].charAt(0);
if (isNaN(moveAndPPUps[1])) {
curSet.movePPUps.push(3);
} else {
@@ -1535,7 +1546,7 @@ Storage.exportTeam = function (team, gen, hidestats) {
}
if (move) {
text += '- ' + move;
- if (curSet.movePPUps && curSet.movePPUps[j] && curSet.movePPUps[j] < 3) {
+ if (curSet.movePPUps && !isNaN(curSet.movePPUps[j]) && curSet.movePPUps[j] < 3) {
text += " (PP Ups: " + curSet.movePPUps[j] + ")";
}
text += " \n";
diff --git a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
index 4235c864b3..df48b9335e 100644
--- a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
+++ b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
@@ -41,8 +41,12 @@ class PSTeambuilder {
}
}
- if (set.movePPUps) {
- buf += ';' + set.movePPUps.join(',');
+ if (set.movePPUps && set.movePPUps.some(n => n < 3)) {
+ const PPUps = set.movePPUps.map(n => {
+ if (n === 3) return '';
+ return n.toString();
+ })
+ buf += ';' + PPUps.join(',');
}
// nature
@@ -151,7 +155,10 @@ class PSTeambuilder {
);
if (PPUps) {
- set.movePPUps = PPUps.split(',').map(n => parseInt(n, 10));
+ set.movePPUps = PPUps.split(',').map(n => {
+ if (!n) return 3;
+ return parseInt(n, 10);
+ });
}
// nature
From bf8f4e4f38cd569794cf15e44d9688f921064949 Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Mon, 14 Oct 2024 21:47:34 -0700
Subject: [PATCH 14/15] Format errors
---
play.pokemonshowdown.com/js/storage.js | 6 +++---
play.pokemonshowdown.com/src/panel-teamdropdown.tsx | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js
index be5d7adb0b..a4a35c1391 100644
--- a/play.pokemonshowdown.com/js/storage.js
+++ b/play.pokemonshowdown.com/js/storage.js
@@ -817,7 +817,7 @@ Storage.packTeam = function (team) {
var PPUps = '';
var showPPUps = false;
for (var j = 0; j < set.movePPUps.length; j++) {
- if (j) PPUps += ','
+ if (j) PPUps += ',';
if (set.movePPUps[j] < 3) {
PPUps += set.movePPUps[j];
showPPUps = true;
@@ -939,7 +939,7 @@ Storage.fastUnpackTeam = function (buf) {
set.movePPUps = buf.substring(i, j).split(',');
for (var index = 0; index < set.movePPUps.length; index++) {
set.movePPUps[index] = parseInt(set.movePPUps[index], 10);
- if (!set.movePPUps[index]) set.movePPUps[index] === 3;
+ if (!set.movePPUps[index]) set.movePPUps[index] = 3;
}
i = j + 1;
}
@@ -1074,7 +1074,7 @@ Storage.unpackTeam = function (buf) {
set.movePPUps = buf.substring(i, j).split(',');
for (var index = 0; index < set.movePPUps.length; index++) {
set.movePPUps[index] = parseInt(set.movePPUps[index], 10);
- if (!set.movePPUps[index]) set.movePPUps[index] === 3;
+ if (!set.movePPUps[index]) set.movePPUps[index] = 3;
}
i = j + 1;
}
diff --git a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
index df48b9335e..e343bc2674 100644
--- a/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
+++ b/play.pokemonshowdown.com/src/panel-teamdropdown.tsx
@@ -45,7 +45,7 @@ class PSTeambuilder {
const PPUps = set.movePPUps.map(n => {
if (n === 3) return '';
return n.toString();
- })
+ });
buf += ';' + PPUps.join(',');
}
From 243b92f3fd8cb51f8cf587ba5a4483afff9416ad Mon Sep 17 00:00:00 2001
From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com>
Date: Mon, 14 Oct 2024 22:35:29 -0700
Subject: [PATCH 15/15] Update storage.js
---
play.pokemonshowdown.com/js/storage.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js
index a4a35c1391..e0f02a3529 100644
--- a/play.pokemonshowdown.com/js/storage.js
+++ b/play.pokemonshowdown.com/js/storage.js
@@ -1074,7 +1074,7 @@ Storage.unpackTeam = function (buf) {
set.movePPUps = buf.substring(i, j).split(',');
for (var index = 0; index < set.movePPUps.length; index++) {
set.movePPUps[index] = parseInt(set.movePPUps[index], 10);
- if (!set.movePPUps[index]) set.movePPUps[index] = 3;
+ if (isNaN(set.movePPUps[index])) set.movePPUps[index] = 3;
}
i = j + 1;
}