<?php
if(!isset($_GET["xp"]) || !isset($_GET["target"])) {
getLevels();
} else {
printOutput();
}
function getLevels() {
echo(
"<form method=\"get\">".
"Current XP:".
"<br>".
"<input type=\"text\" name=\"xp\">".
"<br><br>".
"Target level:".
"<br>".
"<input type=\"text\" name=\"target\">".
"<br>".
"<input type=\"submit\">".
"</form>");
}
function printOutput() {
for($L=1;$L<100;$L++) {
if(!isset($targetXP)) {
if(experiance($L+1) > experiance($_GET["target"])) {
$targetXP = experiance($L);
$casts = round(($targetXP - $_GET["xp"])/150);
echo($casts);
echo("<br>That's <b>".$casts."</b> soul runes, <b>".$casts."</b> Nature runes and <b>".($casts * 5)."</b> Fire runes!");
}
}
}
}
function experiance($L) {
$a=0;
for($x=1; $x<$L; $x++) {
$a += floor($x+300*pow(2, ($x/7)));
}
return floor($a/4);
}
?>