I was trying to automate my PVP fighting and I couldn't find any existing scripts for the new PVP fighting, and the old CLI commands didn't seem to work, so here's some basic code which will automate your PVP fighting for you.
Notes:
-The excise function comes from zlib so you will need to include that.
-The Announce function is just a simple function that makes the text pretty - you can replace it with "print"
-This code will do a random fight using moxie and will try to steal a flower. It should be fairly trivial to modify the URL as needed to suit your character.
-I hard-coded my character name for determining winning or losing because I was lazy.
As I said before - this is quick and dirty - feel free to modify to suit.
Notes:
-The excise function comes from zlib so you will need to include that.
-The Announce function is just a simple function that makes the text pretty - you can replace it with "print"
-This code will do a random fight using moxie and will try to steal a flower. It should be fairly trivial to modify the URL as needed to suit your character.
-I hard-coded my character name for determining winning or losing because I was lazy.
Code:
// Find out how many PVP fights we have left
string pvpPage1 = visit_url("peevpee.php?place=fight");
matcher pvpMatcher = create_matcher("You have \\d+ fights remaining today.", pvpPage1);
// Are there PVP fights left
if (pvpMatcher.find()) {
int numPVPFights = to_int(excise(pvpMatcher.group(0), "have ", " fight"));
announce(2, "You have " + numPVPFights + " PVP Fights");
for i from 1 to numPVPFights {
string tmp6 = visit_url("peevpee.php?action=fight&place=fight&pwd=&ranked=1&stance=3&attacktype=flowers&winmessage=raaaaaaaaar&losemessage=meep");
if (contains_text(tmp6, "<b>TheCarrot</b> won the fight")) {
announce(2, "Won PVP Fight");
} else {
announce(2, "Lost PVP Fight");
}
}
} else {
// No PVP fights left
announce(2, "No PVP fights left");
}
announce(2, "Done PVP Fighting");
As I said before - this is quick and dirty - feel free to modify to suit.