From f45e94f19cd66db12ea9b360c6109f4821d18803 Mon Sep 17 00:00:00 2001 From: KirbyRider1337 <39121695+KirbyRider1337@users.noreply.github.com> Date: Tue, 16 Apr 2024 03:43:56 -0400 Subject: [PATCH 1/4] Cleaning up this part, but the main part here... ...Is that with the getPokemonIcon parameters edited, it prioritizes the battle's mod when fetching an icon! --- play.pokemonshowdown.com/src/battle-animations.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/play.pokemonshowdown.com/src/battle-animations.ts b/play.pokemonshowdown.com/src/battle-animations.ts index 21056266b..a0b53aed0 100644 --- a/play.pokemonshowdown.com/src/battle-animations.ts +++ b/play.pokemonshowdown.com/src/battle-animations.ts @@ -676,14 +676,15 @@ export class BattleScene implements BattleSceneStub { pokemonhtml += ``; } else if (!poke) { pokemonhtml += ``; - } else if (!poke.ident && this.battle.teamPreviewCount && this.battle.teamPreviewCount < side.pokemon.length) { - // in VGC (bring 6 pick 4) and other pick-less-than-you-bring formats, this is - // a pokemon that's been brought but not necessarily picked - const details = this.getDetailsText(poke); - pokemonhtml += ``; } else { + pokemonhtml += ``; + if (!poke.ident && this.battle.teamPreviewCount && this.battle.teamPreviewCount < side.pokemon.length) { + // in VGC (bring 6 pick 4) and other pick-less-than-you-bring formats, this is + // a pokemon that's been brought but not necessarily picked + pokemonhtml += `;opacity:0.6`; + } + pokemonhtml += `" aria-label="${details}">`; } if (i % 3 === 2) pokemonhtml += `
`; } From 7671c89a76178843d21c9c277f6d6325cbebd2bd Mon Sep 17 00:00:00 2001 From: KirbyRider1337 <39121695+KirbyRider1337@users.noreply.github.com> Date: Tue, 16 Apr 2024 03:54:08 -0400 Subject: [PATCH 2/4] Team select in teambuilder/challenging now prioritizes that format's mod While editing the arguments for packedTeamIcons WOULD cause some ripple effects if other files used it (and problems if they're unaware of what mods we are using it for), this same file is the only one to use that method. Now when fetching team icons, it searches for a mod the format may be using. --- play.pokemonshowdown.com/js/storage.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/play.pokemonshowdown.com/js/storage.js b/play.pokemonshowdown.com/js/storage.js index 1ffaef6af..8f70894b9 100644 --- a/play.pokemonshowdown.com/js/storage.js +++ b/play.pokemonshowdown.com/js/storage.js @@ -1156,15 +1156,31 @@ Storage.packedTeamNames = function (buf) { return team; }; -Storage.packedTeamIcons = function (buf) { +Storage.packedTeamIcons = function (buf, mod) { if (!buf) return '(empty team)'; return this.packedTeamNames(buf).map(function (species) { - return '' + toID(species) + ''; + return '' + toID(species) + ''; }).join(''); }; Storage.getTeamIcons = function (team) { + let formatmod = ''; + const format = team.format; + //Bruteforcing through our list of mods to check if one has our team's format + //(For empty teams this isn't necessary) + if (team.team) { + for (const mod in window.ModConfig) { + const modformats = window.ModConfig[mod].formats; + for (const formatid in modformats) { + if (format === formatid) { + formatmod = mod; + break; + } + } + if (formatmod) break; + } + } if (team.iconCache === '!') { // an icon cache of '!' means that not only are the icons not cached, // but the packed team isn't guaranteed to be updated to the latest @@ -1176,12 +1192,12 @@ Storage.getTeamIcons = function (team) { // a packed team. team.team = Storage.packTeam(Storage.activeSetList); if ('teambuilder' in app.rooms) { - return Storage.packedTeamIcons(team.team); + return Storage.packedTeamIcons(team.team, formatmod); } Storage.activeSetList = null; - team.iconCache = Storage.packedTeamIcons(team.team); + team.iconCache = Storage.packedTeamIcons(team.team, formatmod); } else if (!team.iconCache) { - team.iconCache = Storage.packedTeamIcons(team.team); + team.iconCache = Storage.packedTeamIcons(team.team, formatmod); } return team.iconCache; }; From 5607a23d0b5e09a884ac7bea2898ee33531f7f39 Mon Sep 17 00:00:00 2001 From: KirbyRider1337 <39121695+KirbyRider1337@users.noreply.github.com> Date: Tue, 16 Apr 2024 04:11:01 -0400 Subject: [PATCH 3/4] Switch/Pick Lead/Revbless now prioritizes this battle's mod for icons --- play.pokemonshowdown.com/js/client-battle.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/play.pokemonshowdown.com/js/client-battle.js b/play.pokemonshowdown.com/js/client-battle.js index 6e2d737fe..51380fbb6 100644 --- a/play.pokemonshowdown.com/js/client-battle.js +++ b/play.pokemonshowdown.com/js/client-battle.js @@ -618,7 +618,7 @@ } else if (!pokemon || pokemon.fainted) { targetMenus[0] += ' '; } else { - targetMenus[0] += ' '; + targetMenus[0] += ' '; } } for (var i = 0; i < nearActive.length; i++) { @@ -638,7 +638,7 @@ } else if (!pokemon || pokemon.fainted) { targetMenus[1] += ' '; } else { - targetMenus[1] += ' '; + targetMenus[1] += ' '; } } @@ -778,9 +778,9 @@ pokemon.name = pokemon.ident.substr(4); var tooltipArgs = 'switchpokemon|' + i; if (pokemon.fainted || i < this.battle.pokemonControlled || this.choice.switchFlags[i] || trapped) { - party += ' '; + party += ' '; } else { - party += ' '; + party += ' '; } } if (this.battle.mySide.ally) party += this.displayAllyParty(); @@ -794,7 +794,7 @@ var pokemon = allyParty[i]; pokemon.name = pokemon.ident.substr(4); var tooltipArgs = 'allypokemon|' + i; - party += ' '; + party += ' '; } return party; }, @@ -835,11 +835,11 @@ var pokemon = this.battle.myPokemon[i]; var tooltipArgs = 'switchpokemon|' + i; if (pokemon && !pokemon.fainted || this.choice.switchOutFlags[i]) { - controls += ' '; + controls += ' '; } else if (!pokemon) { controls += ' '; } else { - controls += ' '; + controls += ' '; } } controls += '
'; @@ -875,7 +875,7 @@ switchMenu += ' '; + switchMenu += '' + BattleLog.escapeHTML(pokemon.name) + (!pokemon.fainted ? '' + (pokemon.status ? '' : '') : '') + ' '; } var controls = ( @@ -910,9 +910,9 @@ var pokemon = switchables[oIndex]; var tooltipArgs = 'switchpokemon|' + oIndex; if (i < this.choice.done) { - switchMenu += ' '; + switchMenu += ' '; } else { - switchMenu += ' '; + switchMenu += ' '; } } From cf9d0d633aa92bd038fbadf8fad61b97b7446dac Mon Sep 17 00:00:00 2001 From: KirbyRider1337 <39121695+KirbyRider1337@users.noreply.github.com> Date: Tue, 16 Apr 2024 04:42:22 -0400 Subject: [PATCH 4/4] Selecting a mon in the builder now prioritizes that mod --- play.pokemonshowdown.com/js/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/play.pokemonshowdown.com/js/search.js b/play.pokemonshowdown.com/js/search.js index 97a78878b..8b8293481 100644 --- a/play.pokemonshowdown.com/js/search.js +++ b/play.pokemonshowdown.com/js/search.js @@ -302,7 +302,7 @@ // icon buf += ''; - buf += ''; + buf += ''; buf += ' '; // name