'.chr(10).$skill.chr(10).'<'); if(strpos($str1, 'd co')<30) return '--'; $pos1 = strpos($str1, 't"',strpos($str1, 't"')+1)+3; return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);} function GetXP($skill) { $str1 = strstr($GLOBALS['contents'], '>'.chr(10).$skill.chr(10).'<'); if(strpos($str1, 'd co')<30) return '--'; $pos1 = strpos($str1, 't"',strpos($str1, 't"',strpos($str1, 't"')+1)+1)+3; return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);} function GetRank($skill) { $str1 = strstr($GLOBALS['contents'], '>'.chr(10).$skill.chr(10).'<'); if(strpos($str1, 'd co')<30) return '--'; $pos1 = strpos($str1, 't"')+3; return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);} function getExperience($exp, $goal){ $goal--; for($i = 1; $i <= $goal; $i++){ $e += intval($i + 300 * pow(2, $i / 7)); } return intval($e / 4) - $exp; } function getPercent($exp, $goal){ $goal--; for($i = 1; $i <= $goal; $i++){ $e += intval($i + 300 * pow(2, $i / 7)); } return round(($exp / intval($e / 4)) * 100 ,0); } $font="./images/font1.ttf"; if ($stat == 'runecrafting' ) { $lvl = GetLvl(Runecraft); $xp = GetXP(Runecraft); } else { $lvl = GetLvl(ucfirst(strtolower($stat))); $xp = GetXP(ucfirst(strtolower($stat))); } $xp = str_replace(",","",$xp); $temp = getExperience($xp, $pgoal); if ($temp < 0 ) { $imgfile = './images/100.png'; $imgfile2 = './images/'.$stat.'.png'; $im_size = getimagesize($imgfile); $image_width = $im_size[0]; $image_height = $im_size[1]; $im = imagecreatetruecolor($image_width, $image_height); $im2 = imagecreatefrompng($imgfile); $im3 = imagecreatefrompng($imgfile2); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagecopy($im, $im2, 0, 0, 0, 0, $image_width, $image_height); imagedestroy($im2); imagettftext($im, 8, 0, 180, 13, $black, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal); imagettftext($im, 8, 0, 179, 12, $white, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal); imagettftext($im, 8, 0, 180, 24, $black, $font, "Goal Achived!"); imagettftext($im, 8, 0, 179, 23, $white, $font, "Goal Achived!"); imagettftext($im, 10, 0, 70, 20, $black, $font, 'Goal Achived!'); imagettftext($im, 10, 0, 70, 19, $white, $font, 'Goal Achived!'); } else { $imgfile = './images/main.png'; $imgfile2 = './images/'.$stat.'.png'; $bar = './images/bar.png'; $im_size = getimagesize($imgfile); $image_width = $im_size[0]; $image_height = $im_size[1]; $im = imagecreatetruecolor($image_width, $image_height); $im2 = imagecreatefrompng($imgfile); $im3 = imagecreatefrompng($imgfile2); $im4 = imagecreatefrompng($bar); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagecopy($im, $im2, 0, 0, 0, 0, $image_width, $image_height); imagedestroy($im2); $percent = getPercent($xp, $pgoal); if ( $percent > 99) { $percent = 99; } if ( $percent < 0) { $percent = 0; } imagecopy($im, $im4, 31, 8, 0, 0, (0.444444*$percent)+$percent, 14); imagedestroy($im4); imagettftext($im, 8, 0, 180, 13, $black, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal); imagettftext($im, 8, 0, 179, 12, $white, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal); imagettftext($im, 8, 0, 180, 24, $black, $font, 'XP to go: '.number_format($temp)); imagettftext($im, 8, 0, 179, 23, $white, $font, 'XP to go: '.number_format($temp)); imagettftext($im, 10, 0, 90, 20, $black, $font, $percent.'%'); imagettftext($im, 10, 0, 90, 19, $white, $font, $percent.'%'); } //Paste image of stat imagecopy($im, $im3, 0,0, 0, 0, 31, 29); imagedestroy($im3); header("Content-type: image/png"); imagepng($im); imagedestroy($im); ?>