from Pokemon Nerd Dan
In the course of trying to (nearly) automate downloading matchup information from PvPoke I had to decipher what, exactly, the path parameters in the URL meant.
To step back: let's say you go to the Battle page. You choose Multi Battle, and then Jungle Cup. You choose Vigoroth as the attacking Pokemon, and — because you're finicky — even enter the specific IVs and level of your Vigoroth, the one you'll be using in your tournament. You click “battle”, et voila: you have the results.
But! Look at the URL. It's changed! For me, it's now
That's a lot of numbers! It's nice, though, because I knew I could change the URL itself to change the battle. In the past I've done that to avoid going through menus, but now my use case is that I want my code to launch the specific URL I want. You may have a similar use case! So let's decypher the parameters.
Some are easy enough to figure out:
https://pvpoke.com/battle/multi/(CP limit)/(cup name)/(Pokemon)-(level)-(attack IV)-(defense IV)-(stamina IV)-4-4-1/11/0-1-3/2-1/
RewriteRule battle/multi/(\d+)/([a-zA-Z0-9-]+)/([a-zA-Z_\d\.-]+)/([\d-]+)/([\da-zA-Z_-]+)/([\d-]+).*$ battle.php?mode=multi&cp=$1&cup=$2&p1=$3&s=$4&m1=$5&cms=$6 [L,QSA]
So now I know that elsewhere in the code:
4-4-1after my Pokemon is part of
m1(I had suspected it was the moveset, so this tracks)
2-1is something called
I'll spare you the minutiae of tracking everything else down (odd to stop now, I know), but it's all in Interface.js.
https://pvpoke.com/battle/multi/(CP limit)/(cup name)/<P1>/<S>/<M1>/<CMS>/
defmod are in-battle modifiers, like from Power Up Punch or Ominous Wind.
4 means no modifier.
baitshields is whether to bait shields, ie with Thunder Punch instead of Wild Charge.
1 for yes,
0 for no.
Shields! This isn't actually one number but two digits: the first is how many shields you use, the second is your opponent. So
01 means you don't use any shields and your opponent uses 1.
2 is treated as
0. I was hoping I could sim something where I had 9 shields, but alas. Empoleon_Dynamite is too smart for me.
Three numbers: fast move, charge move 1, charge move 2.
Of the available moves for your Pokemon, this is their index in the html form. This comes from the PvPoke gamemaster.json file, which I'm a big fan of because it's taking the gamemaster file scraped from the game itself and parsing it into something more usable.
Of note: the available moves are alphabetized, and the fast moves start at index 0 while the charge starts at 1. This is because a charge move of
0 means no move.
And so, since Viggy can learn
"BODY_SLAM", "BRICK_BREAK", "BULLDOZE", since mine has Body Slam and Bulldoze the charge moves are 1 and 3.
Two numbers: the first is how many fast moves your opponents know. The second is whether they bait shields.
Here I thought I had found a bug, because you can sim against an entire cup and set your opponents' known charge moves to
0! Spoiler alert: you do really well when your opponent never uses a charge move.
Feeling like I had really hackerman'd my way into the mainframe, I opened an issue on the PvPoke Github. It turns out that simming against 0 charge moves is intended: this way you can see if your opponent can farm you for energy.
This is just for one specific battle type (multi battle vs a cup). The
.htaccess file I linked to above has others, but since I don't care about them at the moment you'll have to write your own blog post.
Also: PvPoke has a Patreon. Considering this website is basically the de facto authority when it comes to Pokemon Go PVP and is referenced in most if not all discussions, the fact that as of this writing only 52 people support the website financially is an absolute crime.