Last active
August 29, 2015 13:57
-
-
Save ericvaladas/9501542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-type: text/xml"); | |
require_once('classes/class_dbo.php'); | |
include('items.php'); | |
$dbo = new DatabaseObject; | |
$name = $dbo->sanitize($_GET['n']); | |
function xmlitem($tag, $item, $tooltip) | |
{ | |
$margin = 5; | |
if (file_exists("items/" . $item . ".png")) | |
{ | |
$margin = getimagesize("items/" . $item . ".png"); | |
$margin = (35-$margin[1])/2; | |
} | |
$xmlitem = "\t<".$tag."> [div id='item' title='".$tooltip."'][img style='margin-top:".$margin.";' src='items/" . $item . ".png' /][/div] </".$tag.">\n"; | |
return $xmlitem; | |
} | |
$resultSet = $dbo->query("SELECT name, class, guild, guildrank, hp, mp, accessorya, accessoryb, armor, belt, boots, displayhelm, earring, greaves, helm, leftgauntlet, leftring, necklace, overcoat, rightgauntlet, rightring, shield, weapon, avatar, DATE_FORMAT(modified,'%m.%d.%y') AS modified FROM tblPlayers WHERE name = '".$name."';"); | |
$playerdata = $resultSet->fetch_object(); | |
$name=$playerdata->name; | |
$class=$playerdata->class; | |
$guild=$playerdata->guild; | |
$guildrank=$playerdata->guildrank; | |
$hp=$playerdata->hp; | |
$mp=$playerdata->mp; | |
$ac=$playerdata->ac; | |
$accessorya=$playerdata->accessorya; | |
$accessoryb=$playerdata->accessoryb; | |
$armor=$playerdata->armor; | |
$belt=$playerdata->belt; | |
$boots=$playerdata->boots; | |
$displayhelm=$playerdata->displayhelm; | |
$earring=$playerdata->earring; | |
$greaves=$playerdata->greaves; | |
$helm=$playerdata->helm; | |
$leftgauntlet=$playerdata->leftgauntlet; | |
$necklace=$playerdata->necklace; | |
$leftring=$playerdata->leftring; | |
$necklace=$playerdata->necklace; | |
$overcoat=$playerdata->overcoat; | |
$rightgauntlet=$playerdata->rightgauntlet; | |
$rightring=$playerdata->rightring; | |
$shield=$playerdata->shield; | |
$weapon=$playerdata->weapon; | |
$avatar=$playerdata->avatar; | |
$modified=$playerdata->modified; | |
if ( $class == "Priest" || $class == "Bard" ){ | |
if ( $weapon == 32952 || $weapon == 32953 || $weapon == 32902 ){ | |
$weapon = $weapon."1"; | |
} | |
} | |
$tearring = queryItem($earring); | |
$tnecklace = queryItem($necklace); | |
$thelm = queryItem($helm); | |
$tdisplayhelm = queryItem($displayhelm); | |
$taccessorya = queryItem($accessorya); | |
$taccessoryb = queryItem($accessoryb); | |
$tleftgauntlet = queryItem($leftgauntlet); | |
$tweapon = queryItem($weapon); | |
$tovercoat = queryItem($overcoat); | |
$tarmor = queryItem($armor); | |
$tshield = queryItem($shield); | |
$trightgauntlet = queryItem($rightgauntlet); | |
$tleftring = queryItem($leftring); | |
$tgreaves = queryItem($greaves); | |
$tboots = queryItem($boots); | |
$tbelt = queryItem($belt); | |
$trightring = queryItem($rightring); | |
$xml_output = "<?xml version=\"1.0\"?>\n"; | |
$xml_output .= "<player>\n"; | |
//for($i = 0 ; $i < $resultSet->num_rows ; $i++) | |
//{ | |
// $row = $resultSet->fetch_object(); | |
$xml_output .= "\t<name>" . $name . "</name>\n"; | |
$xml_output .= "\t<class>" . $class . "</class>\n"; | |
$xml_output .= "\t<hp>" . $hp . " </hp>\n"; | |
$xml_output .= "\t<mp>" . $mp . " </mp>\n"; | |
$margin = 0; | |
$xml_output .= xmlitem("earrings", $earring, $tearring); | |
$xml_output .= xmlitem("necklace", $necklace, $tnecklace); | |
$xml_output .= xmlitem("displayhelm", $displayhelm, $tdisplayhelm); | |
$xml_output .= xmlitem("helm", $helm, $thelm); | |
$xml_output .= xmlitem("accessorya", $accessorya, $taccessorya); | |
$xml_output .= xmlitem("accessoryb", $accessoryb, $taccessoryb); | |
$xml_output .= xmlitem("leftgauntlet", $leftgauntlet, $tleftgauntlet); | |
$xml_output .= xmlitem("weapon", $weapon, $tweapon); | |
$xml_output .= xmlitem("overcoat", $overcoat, $tovercoat); | |
$xml_output .= xmlitem("armor", $armor, $tarmor); | |
$xml_output .= xmlitem("shield", $shield, $tshield); | |
$xml_output .= xmlitem("rightgauntlet", $rightgauntlet, $trightgauntlet); | |
$xml_output .= xmlitem("leftring", $leftring, $tleftring); | |
$xml_output .= xmlitem("greaves", $greaves, $tgreaves); | |
$xml_output .= xmlitem("boots", $boots, $tboots); | |
$xml_output .= xmlitem("belt", $belt, $tbelt); | |
$xml_output .= xmlitem("rightring", $rightring, $trightring); | |
if (file_exists('sprites/' . strtolower($name) . '.png')) | |
{ | |
$xml_output .= "\t<sprite> [img id='sprite' src='sprites/" . $name . ".png' onload='tooltip.init();'/]</sprite>\n"; | |
} | |
else | |
{ | |
$xml_output .= "\t<sprite> [img src='items/0.png' onload='tooltip.init();'/]</sprite>\n"; | |
} | |
$xml_output .= "\t<modified>" . $modified . "</modified>\n"; | |
$xml_output .= "\t<link>[a id='player_link' href='http://dastats.com/" . strtolower($name) . "']http://dastats.com/" . strtolower($name) . "[/a]</link>\n"; | |
//} | |
$xml_output .= "</player>"; | |
echo strtolower($xml_output); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment