<?php
header ("Content-type: image/png");

//load required files
$handle = imagecreatetruecolor (200, 80) or die ("Cannot Create image"); //image size
$host = file("_pmhost.php", FILE_IGNORE_NEW_LINES); 		//DO NOT CHANGE
$stats = file("$host[0]", FILE_IGNORE_NEW_LINES);  		    //DO NOT CHANGE THIS EITHER
$background = imagecreatefrompng("statimg/$stats[528].png"); //Load the background banner   	***EDIT***
$avatar = imagecreatefrompng("players/ava$stats[539].png");  //Load the Avatar				***EDIT***
$HPimg = imagecreatefrompng("statimg/HP.png"); 				//Load the HP Logo
$FPimg = imagecreatefrompng("statimg/FP.png"); 				//Load the FP Logo
$ATKimg = imagecreatefrompng("statimg/ATK.png"); 			//Load the ATK Logo
$DEFimg = imagecreatefrompng("statimg/DEF.png"); 			//Load the DEF Logo
$SPEimg = imagecreatefrompng("statimg/SPE.png"); 			//Load the SPE book
$starimg = imagecreatefrompng("statimg/starshard.png");		//Load the Star Shard
$BPimg = imagecreatefrompng("statimg/BP.png");    			//Load the BP badge
$stacheimg = imagecreatefrompng("statimg/stache.png");		//Load the 'stache
$sp1 = imagecreatefrompng("statimg/sp1$stats[530].png");	//Load the first SP dot			***EDIT***
$sp2 = imagecreatefrompng("statimg/sp2$stats[531].png");	//Load the second SP dot		***EDIT***
$sp3 = imagecreatefrompng("statimg/sp3$stats[532].png");	//Load the third SP dot			***EDIT***
$sp4 = imagecreatefrompng("statimg/sp4$stats[533].png");	//Load the fourth SP dot		***EDIT***
$sp5 = imagecreatefrompng("statimg/sp5$stats[534].png");	//Load the fifth SP dot			***EDIT***
$sp6 = imagecreatefrompng("statimg/sp6$stats[535].png");	//Load the sixth SP dot			***EDIT***
$sp7 = imagecreatefrompng("statimg/sp7$stats[536].png");	//Load the seventh SP dot		***EDIT***
$sp8 = imagecreatefrompng("statimg/sp8$stats[537].png");	//Load the eighth SP dot		***EDIT***
$slash = imagecreatefrompng("statimg/slash.png");			//Load the Slash character		

// Get dimensions of images
$bgWidth=imagesx($background);
$bgHeight=imagesy($background);
$avatarw=imagesx($avatar);
$avatarh=imagesy($avatar);
$HPimgw=imagesx($HPimg);
$HPimgh=imagesy($HPimg);
$FPimgw=imagesx($FPimg);
$FPimgh=imagesy($FPimg);
$ATKimgw=imagesx($ATKimg);
$ATKimgh=imagesy($ATKimg);
$DEFimgw=imagesx($DEFimg);
$DEFimgh=imagesy($DEFimg);
$SPEimgw=imagesx($SPEimg);
$SPEimgh=imagesy($SPEimg);
$starimgw=imagesx($starimg);
$starimgh=imagesy($starimg);
$BPimgw=imagesx($BPimg);
$BPimgh=imagesy($BPimg);
$stacheimgw=imagesx($stacheimg);
$stacheimgh=imagesy($stacheimg);
$sp1imgw=imagesx($sp1);
$sp1imgh=imagesy($sp1);
$sp2imgw=imagesx($sp2);
$sp2imgh=imagesy($sp2);
$sp3imgw=imagesx($sp3);
$sp3imgh=imagesy($sp3);
$sp4imgw=imagesx($sp4);
$sp4imgh=imagesy($sp4);
$sp5imgw=imagesx($sp5);
$sp5imgh=imagesy($sp5);
$sp6imgw=imagesx($sp6);
$sp6imgh=imagesy($sp6);
$sp7imgw=imagesx($sp7);
$sp7imgh=imagesy($sp7);
$sp8imgw=imagesx($sp8);
$sp8imgh=imagesy($sp8);
$slashw=imagesx($slash);
$slashh=imagesy($slash);

// Display the BG and other images. Destination, Link, x destination, y destination, x source, y source, width, height
imagecopy($handle, $background, 0, 0, 0, 0, $bgWidth, $bgHeight);
imagecopy($handle, $avatar, 0, 0, 0, 0, $avatarw, $avatarh); 
imagecopy($handle, $HPimg, 41, 24, 0, 0, $HPimgw, $HPimgh);
imagecopy($handle, $FPimg, 41, 35, 0, 0, $FPimgw, $FPimgh);
imagecopy($handle, $ATKimg, 153, 23, 0, 0, $ATKimgw, $ATKimgh);
imagecopy($handle, $DEFimg, 153, 33, 0, 0, $DEFimgw, $DEFimgh);
imagecopy($handle, $SPEimg, 153, 43, 0, 0, $SPEimgw, $SPEimgh);
imagecopy($handle, $starimg, 84, 48, 0, 0, $starimgw, $starimgh);
imagecopy($handle, $BPimg, 153, 63, 0, 0, $BPimgw, $BPimgh);
imagecopy($handle, $stacheimg, 153, 53, 0, 0, $stacheimgw, $stacheimgh);
imagecopy($handle, $sp1, 121, 27, 0, 0, $sp1imgw, $sp1imgh);
imagecopy($handle, $sp2, 128, 27, 0, 0, $sp2imgw, $sp2imgh);
imagecopy($handle, $sp3, 135, 27, 0, 0, $sp3imgw, $sp3imgh);
imagecopy($handle, $sp4, 142, 27, 0, 0, $sp4imgw, $sp4imgh);
imagecopy($handle, $sp5, 121, 37, 0, 0, $sp5imgw, $sp5imgh);
imagecopy($handle, $sp6, 128, 37, 0, 0, $sp6imgw, $sp6imgh);
imagecopy($handle, $sp7, 135, 37, 0, 0, $sp7imgw, $sp7imgh);
imagecopy($handle, $sp8, 142, 37, 0, 0, $sp8imgw, $sp8imgh);

//Colors: RGB format
$black = ImageColorAllocate ($handle, 0, 0, 0);          	//Black
$white = ImageColorAllocate ($handle, 255, 255, 255);    	//White
$shadow = ImageColorAllocate ($handle, 25, 25, 25);      	//Gray for Shadow
$line_color = ImageColorAllocate ($handle, 100, 100, 100);	//Lines
$name1 = ImageColorAllocate ($handle, 152, 173, 237);     	//(Names)Light Blue 			
$name2 = ImageColorAllocate ($handle, 240, 132, 198);     	//(Names)Pink
$name3 = ImageColorAllocate ($handle, 99, 76, 158);       	//(Names)Unspecified aka Purple	***EDIT IF CUSTOM NAME COLOR IS NEEDED***
$green = ImageColorAllocate ($handle, 0, 204, 51);      	//HP Bar
$blue = ImageColorAllocate ($handle, 113, 149, 255);      	//FP Bar
$yellow = ImageColorAllocate ($handle, 255, 255, 0);     	//Levels
$red = ImageColorAllocate ($handle, 255, 0, 0);     		//Stat Effect
$starmeter = ImageColorAllocate ($handle, 200, 200, 200);	//Star Meter, unfilled

//HP Bar
$current = isset($_GET['c']) ? $_GET['c'] : 16.3;
$start = isset($_GET['s']) ? $_GET['s'] : 28;
$end = isset($_GET['e']) ? $_GET['e'] : 57.5;
$pos = round(((($stats[508]/$stats[512])*17.7)+16.3)/($end - $start) * 100);     		//***EDIT***
imagefilledrectangle($handle, 55, 33, $pos, 25, $green);

//FP Bar
$current = isset($_GET['c']) ? $_GET['c'] : 16.3;
$start = isset($_GET['s']) ? $_GET['s'] : 28;
$end = isset($_GET['e']) ? $_GET['e'] : 57.5;
$pos = round(((($stats[510]/$stats[514])*17.7)+16.3)/($end - $start) * 100);			//***EDIT***
imagefilledrectangle($handle, 55, 44, $pos, 36, $blue);

//Slashes for HP, FP and BP counter
imagecopy($handle, $slash, 82, 24, 0, 0, $slashw, $slashh);
imagecopy($handle, $slash, 82, 36, 0, 0, $slashw, $slashh);
imagecopy($handle, $slash, 179, 65, 0, 0, $slashw, $slashh);

//Text Format: $handle, font size (1-5), starting X ordinate, starting Y ordinate, the text itself, and finally it's color.
ImageString ($handle, 5, 39, 1, "$stats[500]", $shadow);	//Name Shadow <------------------------------
ImageString ($handle, 5, 38, 0, "$stats[500]", $name1); 	//Name ********(don't forget to change the color) *****************
ImageString ($handle, 1, 38, 15, "$stats[502]", $black); 	//Status									|
ImageString ($handle, 3, 45, 48, "COINS", $black); 			//Coins Tag									|
ImageString ($handle, 2, 50, 60, "$stats[504]", $black); 	//Coins									***EDIT***
ImageString ($handle, 2, 83, 60, "$stats[545]", $black); 	//Star Shards								|
ImageString ($handle, 3, 5, 48, "LEVEL", $black); 			//Level Tag									|
ImageString ($handle, 2, 14, 60, "$stats[506]", $black); 	//Level										|
ImageString ($handle, 2, 67, 22, "$stats[508]", $black); 	//HP										|
ImageString ($handle, 2, 89, 22, "$stats[512]", $black); 	//HP Max								***EDIT***
ImageString ($handle, 2, 67, 34, "$stats[510]", $black); 	//FP										|
ImageString ($handle, 2, 89, 34, "$stats[514]", $black); 	//FP Max									|
ImageString ($handle, 2, 169, 23, "$stats[516]", $black); 	//ATK										|
ImageString ($handle, 2, 169, 33, "$stats[518]", $black); 	//DEF										|
ImageString ($handle, 2, 169, 43, "$stats[520]", $black); 	//SPE										|
ImageString ($handle, 2, 169, 53, "$stats[522]", $black); 	//Stache									|
ImageString ($handle, 2, 169, 63, "$stats[524]", $black); 	//BP										|
ImageString ($handle, 2, 185, 63, "$stats[526]", $black); 	//BP Max								***EDIT***
ImageString ($handle, 1, 183, 23, "$stats[541]", $red); 	//Stat Effect ATK							|
ImageString ($handle, 1, 183, 33, "$stats[542]", $red); 	//Stat Effect DEF							|
ImageString ($handle, 1, 183, 43, "$stats[543]", $red); 	//Stat Effect SPE							|
ImageString ($handle, 3, 103, 48, "$stats[547]", $black); 	//Custom text line 1						|
ImageString ($handle, 2, 103, 60, "$stats[548]", $black); 	//Custom test line 2<-----------------------|
										 							
//Line Format: $handle, starting X and Y, our ending X and Y, and finally our color.
ImageLine($handle, 55, 24, 115, 24, $line_color);	//HP Hor Line top
ImageLine($handle, 55, 33, 115, 33, $line_color);	//HP Hor Line bottom
ImageLine($handle, 55, 36, 115, 36, $line_color);	//FP Hor Line top
ImageLine($handle, 55, 45, 115, 45, $line_color);	//FP Hor Line bottom
ImageLine($handle, 55, 24, 55, 33, $line_color);  	//HP Hor Line left
ImageLine($handle, 115, 24, 115, 33, $line_color);  //HP Hor Line right
ImageLine($handle, 55, 36, 55, 45, $line_color);	//FP Hor Line left
ImageLine($handle, 115, 36, 115, 45, $line_color);	//FP Hor Line right

//End
ImagePng ($handle);
imagedestroy ($avatar);
imagedestroy ($HPimg);
imagedestroy ($FPimg);
imagedestroy ($ATKimg);
imagedestroy ($DEFimg);
imagedestroy ($SPEimg);
imagedestroy ($coinimg);
imagedestroy ($BPimg);
imagedestroy ($stacheimg);
imagedestroy ($sp1);
imagedestroy ($sp2);
imagedestroy ($sp3);
imagedestroy ($sp4);
imagedestroy ($sp5);
imagedestroy ($sp6);
imagedestroy ($sp7);
imagedestroy ($sp8);
imagedestroy ($slash);
?> 

