All pastes #816602 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-14 21:33 UTC
rendered paste body
<?
$stats = @file("http://hiscore.runescape.com/index_lite.ws?player=".$_GET["n"]) or die("User not found!\r\n\r\n");
foreach ($stats as $n => $l) {
	$nums = explode(",",trim($l));
	if ($n == 0) $totxp = $nums[2];
	if ($n > 0 && $n < 8) {
		$cmbsk .= " ".$nums[1];
		$cmbxp += $nums[2];
	}
	echo getSkill($n)." ".(($nums[1] == "-1")? "Not ranked":$nums[1]." ".$nums[0]." ".$nums[2])."\r\n";
}
echo "Combat ".cmb($cmbsk)."\r\n";



function cmb($bla) {
	$stats = explode(' ',$bla);
	$c0 = ($stats[2] * 100) + ($stats[4] * 100);
	if (preg_match("/\d+[02468]$/",$stats[6])) {
		$r0 = $stats[6];
	} else {
		$r0 = ($stats[6] - 1);
	}
	$rsc0 = ($c0 + ($r0 * 50)) / 400;
	$rsc1 = $rsc0 + ((($stats[1] * 130) + ($stats[3] * 130)) / 400);
	if (preg_match("/\d+[02468]$/",$stats[5])) {
		$rsc2 = $rsc0 + (($stats[5] * 195) / 400);
	} else {
		$rsc2 = $rsc0 + (((($stats[5] - 1) + ($stats[5] * 2)) * 65) / 400);
	}
	if (preg_match("/\d+[02468]$/",$stats[7])) {
		$rsc3 = $rsc0 + (($stats[7] * 195) / 400);
	} else {
		$rsc3 = $rsc0 + (((($stats[7] - 1) + ($stats[7] * 2)) * 65) / 400);
	}
	if ($rsc1 > $rsc2 && $rsc1 > $rsc3) {
		return $rsc1." Melee Based";
	} elseif ($rsc2 > $rsc1 && $rsc2 > $rsc3) {
		return $rsc2." Ranged Based";
	} else {
		return $rsc3." Magic Based";
	}
}

function getSkill($n) {
	$skills = array("Overall","Attack","Defence","Strength","Hitpoints","Ranged","Prayer","Magic","Cooking","Woodcutting","Fletching","Fishing","Firemaking","Crafting","Smithing","Mining","Herblore","Agility","Thieving","Slayer","Farming","Runecraft","Hunter","Construction","Duel+Tournament","Bounty+Hunters","Bounty+Hunter+Rogues");
	return $skills[$n];
}
?>