* moved characters.php html code to Twig template

* moved news.php to Twig news.html template
* fixed some duplicated code in signature generators
* always check if name parameter is set when generating signatures
This commit is contained in:
slawkens 2017-09-01 17:00:29 +02:00
parent 37502c5562
commit d50fb7a291
14 changed files with 1139 additions and 1093 deletions

View File

@ -441,7 +441,7 @@ function check_name($name, &$error = '')
return false;
}
return preg_match("/[A-z ']{1,25}/", $name);
return preg_match("/[A-z ']/", $name);
}
/**

View File

@ -14,79 +14,17 @@ $title = 'Characters';
require(SYSTEM . 'item.php');
$groups = new OTS_Groups_List();
function generate_search_table($autofocus = false)
function generate_search_form($autofocus = false)
{
global $config, $template_path, $twig;
global $config, $twig;
return $twig->render('characters.form.html', array(
'link' => getPageLink('characters'),
'vdarkborder' => $config['vdarkborder'],
'darkborder' => $config['darkborder'],
'autofocus' => $autofocus,
'template_path' => $template_path
'autofocus' => $autofocus
));
}
function generate_player_lookup($player)
{
global $db;
$eq_sql = $db->query('SELECT `pid`, `itemtype` FROM player_items WHERE player_id = '.$player->getId().' AND (`pid` >= 1 and `pid` <= 10)');
$player_eq = array();
foreach($eq_sql as $eq)
$player_eq[$eq['pid']] = $eq['itemtype'];
$empty_slots = array("", "no_helmet", "no_necklace", "no_backpack", "no_armor", "no_handleft", "no_handright", "no_legs", "no_boots", "no_ring", "no_ammo");
for($i = 0; $i <= 10; $i++)
{
if(!isset($player_eq[$i]) || $player_eq[$i] == 0)
$player_eq[$i] = $empty_slots[$i];
}
/*
if(PHP_VERSION_ID == NULL || PHP_VERSION_ID < 70000) {
for($i = 1; $i < 11; $i++)
{
if(!itemImageExists($player_eq[$i]))
Items::generate($player_eq[$i]);
}
}
*/
for($i = 1; $i < 11; $i++)
{
if(check_number($player_eq[$i]))
$player_eq[$i] = getItemImage($player_eq[$i]);
else
$player_eq[$i] = '<img src="images/items/' . $player_eq[$i] . '.gif" width="32" height="32" border="0" alt=" ' . $player_eq[$i] . '" />';
}
$skulls = array(
1 => 'yellow_skull',
2 => 'green_skull',
3 => 'white_skull',
4 => 'red_skull',
5 => 'black_skull'
);
return '<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
<tr>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.$player_eq[2].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[6].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[9].'</td></tr>
<tr height="11px"><td>'.($player->getSkullTime() > 0 && ($player->getSkull() == 4 || $player->getSkull() == 5) ? '<img src="images/' . $skulls[$player->getSkull()] . '.gif">' : '').'</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.$player_eq[1].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[4].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[7].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[8].'</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.$player_eq[3].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[5].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[10].'</td></tr>
</table>
</td>
</tr>
</table>';
}
function retrieve_former_name($name)
{
global $oldName, $db;
@ -112,7 +50,7 @@ if(empty($name))
{
$tmp_link = getPlayerLink($name);
echo 'Here you can get detailed information about a certain player on ' . $config['lua']['serverName'] . '.<BR>';
echo generate_search_table(true);
echo generate_search_form(true);
return;
}
@ -141,538 +79,362 @@ if($player->isLoaded() && !$player->isDeleted())
$title = $player->getName() . ' - ' . $title;
$account = $player->getAccount();
$rows = 0;
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
<td>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<?php if($config['characters']['outfit']): ?>
<div style="width:64px;height:64px;border:2px solid #F1E0C6; border-radius:50px; padding:13px; margin-top:38px;margin-left:376px;position:absolute;"><img style="margin-left:<?php echo (in_array($player->getLookType(), array(75, 266, 302)) ? '-0px;margin-top:-0px;width:64px;height:64px;' : '-60px;margin-top:-60px;width:128px;height:128px;'); ?>" src="<?php echo $config['outfit_images_url'] . '?id=' . $player->getLookType() . (fieldExist('lookaddons', 'players') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet(); ?>"></div>
<?php endif; ?>
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td colspan="2" class="white"><b>Character Information</b></td>
</tr>
<?php
$flag = '';
if($config['account_country'])
$flag = getFlagImage($account->getCustomField('country'));
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '">'.
'<TD WIDTH=20%>Name:</TD>
<TD>' . $flag . ' <font color="'.($player->isOnline() ? 'green' : 'red').'"><b>'.$player->getName().'</b></font>'.$oldName.
'</TD></TR>';
$player_sex = 'Unknown';
if(isset($config['genders'][$player->getSex()]))
$player_sex = strtolower($config['genders'][$player->getSex()]);
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Sex:</TD><TD>' . $player_sex . '</TD></TR>';
if($config['characters']['marriage_info'] && fieldExist('marriage', 'players'))
{
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Marital status:</TD><TD>';
$marriage = new OTS_Player();
$marriage->load($player->getMarriage());
if($marriage->isLoaded())
echo 'married to ' . getPlayerLink($marriage->getName());
else
echo 'single';
echo
'</TD></TR>';
}
echo
'<TR BGCOLOR="' . getStyle(++$rows). '">'.
'<TD>Profession:</TD><TD>' . $config['vocations'][$player->getVocation()] . '</TD>'.
'</TR>';
if($config['characters']['level'])
echo '<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Level:</TD><TD>'.$player->getLevel().'</TD></TR>';
if($config['characters']['experience'])
echo '<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Experience:</TD><TD>'.$player->getExperience().'</TD></TR>';
if($config['characters']['magic_level'])
echo'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Magic Level:</TD><TD>'.$player->getMagLevel().'</TD></TR>';
//frags
if(tableExist('player_killers') && $config['characters']['frags']) {
$frags_count = 0;
$frags_query = $db->query(
'SELECT COUNT(`player_id`) as `frags`' .
'FROM `player_killers`' .
'WHERE `player_id` = ' .$player->getId() . ' ' .
'GROUP BY `player_id`' .
'ORDER BY COUNT(`player_id`) DESC');
if($frags_query->rowCount() > 0)
{
$frags_query = $frags_query->fetch();
$frags_count = $frags_query['frags'];
}
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Frags:</TD><TD>' . $frags_count . '</TD></TR>';
}
if(!empty($config['towns'][$player->getTownId()]))
echo '<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Residence:</TD><TD>' . $config['towns'][$player->getTownId()] . '</TD></TR>';
if($config['characters']['balance'])
echo '<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Balance:</TD><TD>'.$player->getBalance().' Gold Coins.</TD></TR>';
$town_field = 'town';
if(fieldExist('town_id', 'houses'))
$town_field = 'town_id';
else if(fieldExist('townid', 'houses'))
$town_field = 'townid';
else if(!fieldExist('town', 'houses'))
$town_field = false;
if(fieldExist('name', 'houses')) {
$house = $db->query('SELECT `id`, `paid`, `name`' . ($town_field != false ? ', `' . $town_field . '` as `town`' : '') . ' FROM `houses` WHERE `owner` = '.$player->getId())->fetch();
if(isset($house['id']))
{
$add = '';
if($house['paid'] > 0)
$add = ' is paid until '.date("M d Y", $house['paid']);
echo
'<TR BGCOLOR="'.getStyle(++$rows).'">
<TD>House:</TD>
<TD>
<TABLE BORDER=0><TR>
<TD>' . (isset($house['name']) ? $house['name'] : $house['id']) . (isset($house['town']) ? ' (' . $config['towns'][$house['town']] . ')' : '') . $add . '</TD>
<TD>
<FORM ACTION="?subtopic=houses&page=view" METHOD=post>
<INPUT TYPE=hidden NAME=house VALUE="'. (isset($house['name']) ? $house['name'] : $house['id']) . '">
<INPUT TYPE=image NAME="View" ALT="View" SRC="'.$template_path.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120>
</FORM>
</TD>
</TR></TABLE>
</TD>
</TR>';
}
}
$rank_of_player = $player->getRank();
if($rank_of_player->isLoaded()) {
$guild = $rank_of_player->getGuild();
if($guild->isLoaded()) {
$guild_name = $guild->getName();
echo
'<TR BGCOLOR="'.getStyle(++$rows).'">'.
'<TD>Guild membership:</TD><TD>'.$rank_of_player->getName().' of the ' . getGuildLink($guild_name) . '</TD>'.
'</TR>';
}
}
echo
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Last login:</TD><TD>';
$lastlogin = $player->getLastLogin();
if(empty($lastlogin))
echo 'Never logged in.';
else
echo date("M d Y, H:i:s", $lastlogin).' CEST';
echo '</TD></TR>';
if($config['characters']['creation_date'])
echo
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Created:</TD><TD>'.date("M d Y, H:i:s", $player->getCreated()).' CEST</TD></TR>';
$comment = $player->getComment();/*
$newlines = array("\r\n", "\n", "\r");
$comment_with_lines = str_replace($newlines, '<br />', $comment, $count);
if($count < 50)
$comment = $comment_with_lines;*/
if(!empty($comment))
echo '<TR BGCOLOR="'.getStyle(++$rows).'"><TD VALIGN=top>Comment:</TD><TD>' . wordwrap(nl2br($comment), 60, "<br />", true) . '</TD></TR>';
echo
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Account Status:</TD><TD>' . (($account->isPremium()) ? 'Premium Account' : 'Free Account') . '</TD></TR>'.
'</TABLE>';
echo '<br>'.
'<TABLE BORDER=0 WIDTH=100%><TR>';
if($config['characters']['skills'])
{
if(fieldExist('skill_fist', 'players')) {// tfs 1.0+
$skills_db = $db->query('SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch();
$skill_ids = array(
POT::SKILL_FIST => 'skill_fist',
POT::SKILL_CLUB => 'skill_club',
POT::SKILL_SWORD => 'skill_sword',
POT::SKILL_AXE => 'skill_axe',
POT::SKILL_DIST => 'skill_dist',
POT::SKILL_SHIELD => 'skill_shielding',
POT::SKILL_FISH => 'skill_fishing',
);
$skills = array();
foreach($skill_ids as $skillid => $field_name) {
$skills[] = array('skillid' => $skillid, 'value' => $skills_db[$field_name]);
}
}
else
$skills = $db->query('SELECT `skillid`, `value` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' LIMIT 7');
echo '
<TD WIDTH=30% VALIGN="TOP">'.
'<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=2 class="white"><B>Skills</B></TD>
</TR>';
$i = 0;
foreach($skills as $skill)
{
echo
'<TR BGCOLOR=' . getStyle(++$i) . '>
<TD VALIGN=top>' . getSkillName($skill['skillid']) . '</TD>
<TD>' . $skill['value'] . '</TD>
</TR>';
}
echo
'</TABLE>
</TD>';
}
if($config['characters']['quests'] && !empty($config['quests']))
{
$quests = $config['quests'];
$sql_query_in = '';
$i = 0;
foreach($quests as $quest_name => $quest_storage)
{
if($i != 0)
$sql_query_in .= ', ';
$sql_query_in .= $quest_storage;
$i++;
}
$storage_sql = $db->query('SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = '.$player->getId().' AND `key` IN (' . $sql_query_in . ')');
$player_storage = array();
foreach($storage_sql as $storage)
$player_storage[$storage['key']] = $storage['value'];
echo '
<TD WIDTH=40% VALIGN="TOP">'.
'<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=2 class="white"><B>Quests</B></TD>
</TR>';
//for($i=0; $i < count($quests); $i++)
$i = 0;
foreach($quests as $name => $storage)
{
$i++;
echo
'<TR BGCOLOR='.getStyle($i - 1).'>
<TD VALIGN=top>'.$name.'</TD>
<TD><img src="images/'.($player_storage[$storage] ? 'true' : 'false').'.png" border="0"/></TD>
</TR>';
}
echo
'</TABLE>
</TD>';
}
if($config['characters']['equipment'])
{
echo '
<TD WIDTH=100 VALIGN="TOP">'.
'<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>'.
'<TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Equipment</B></TD></TR>'.
'<TR BGCOLOR='.getStyle(1).'><TD>'.generate_player_lookup($player).'</TD></TR>
</TABLE>
</TD>';
}
echo '</TR></TABLE>';
if(tableExist('killers')) {
$player_deaths = $db->query('SELECT `id`, `date`, `level` FROM `player_deaths` WHERE `player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,10;');
if(count($player_deaths))
{
$dead_add_content = '<br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Character Deaths</B></TD></TR>';
$number_of_rows = 0;
foreach($player_deaths as $death)
{
$dead_add_content .= "<tr bgcolor=\"".getStyle($number_of_rows++)."\">
<td width=\"20%\" align=\"center\">".date("j M Y, H:i", $death['date'])."</td>
<td> ";
$killers = $db->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id
LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id
WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll();
$i = 0;
$count = count($killers);
foreach($killers as $killer)
{
$i++;
if($killer['player_name'] != "")
{
if($i == 1)
$dead_add_content .= "Killed at level <b>".$death['level']."</b>";
else if($i == $count)
$dead_add_content .= " and";
else
$dead_add_content .= ",";
$dead_add_content .= " by ";
if($killer['monster_name'] != "")
$dead_add_content .= $killer['monster_name']." summoned by ";
if($killer['player_exists'] == 0)
$dead_add_content .= getPlayerLink($killer['player_name']);
else
$dead_add_content .= $killer['player_name'];
}
else
{
if($i == 1)
$dead_add_content .= "Died at level <b>".$death['level']."</b>";
else if($i == $count)
$dead_add_content .= " and";
else
$dead_add_content .= ",";
$dead_add_content .= " by ".$killer['monster_name'];
}
}
$dead_add_content .= ".</td></tr>";
}
if($number_of_rows > 0)
echo $dead_add_content . '</TABLE>';
}
}
else {
$mostdamage = '';
if(fieldExist('mostdamage_by', 'player_deaths'))
$mostdamage = ', `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`';
$deaths = $db->query('SELECT
`player_id`, `time`, `level`, `killed_by`, `is_player`' . $mostdamage . '
FROM `player_deaths`
WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;');
if(count($deaths))
{
$dead_add_content = '<br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Character Deaths</B></TD></TR>';
$number_of_rows = 0;
foreach($deaths as $death)
{
$dead_add_content .= "<tr bgcolor=\"".getStyle($number_of_rows++)."\">
<td width=\"20%\" align=\"center\">".date("j M Y, H:i", $death['time'])."</td>
<td> ";
$lasthit = ($death['is_player']) ? getPlayerLink($death['killed_by']) : $death['killed_by'];
$dead_add_content .= 'Killed at level ' . $death['level'] . ' by ' . $lasthit;
if($death['unjustified']) {
$dead_add_content .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
}
$mostdmg = ($death['mostdamage_by'] !== $death['killed_by']) ? true : false;
if($mostdmg)
{
$mostdmg = ($death['mostdamage_is_player']) ? getPlayerLink($death['mostdamage_by']) : $death['mostdamage_by'];
$dead_add_content .= ' and by ' . $mostdmg;
if ($death['mostdamage_unjustified']) {
$dead_add_content .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
}
}
else {
$dead_add_content .= " <b>(soloed)</b>";
}
$dead_add_content .= ".</td></tr>";
}
if($number_of_rows > 0)
echo $dead_add_content . '</TABLE>';
}
}
if($config['characters']['frags'])
$outfit = $config['outfit_images_url'] . '?id=' . $player->getLookType() . (fieldExist('lookaddons', 'players') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
$flag = '';
if($config['account_country'])
$flag = getFlagImage($account->getCustomField('country'));
$player_sex = 'Unknown';
if(isset($config['genders'][$player->getSex()]))
$player_sex = strtolower($config['genders'][$player->getSex()]);
$marriage = new OTS_Player();
$marriage->load($player->getMarriage());
$marital_status = 'single';
if($marriage->isLoaded())
$marital_status = 'married to ' . getPlayerLink($marriage->getName());
$frags_enabled = tableExist('player_killers') && $config['characters']['frags'];
$frags_count = 0;
if($frags_enabled) {
$query = $db->query(
'SELECT COUNT(`player_id`) as `frags`' .
'FROM `player_killers`' .
'WHERE `player_id` = ' .$player->getId() . ' ' .
'GROUP BY `player_id`' .
'ORDER BY COUNT(`player_id`) DESC');
if($query->rowCount() > 0)
{
//frags list by Xampy
$i = 0;
$frags_limit = 10; // frags limit to show? // default: 10
$player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';');
if(count($player_frags))
{
$frags = 0;
$frag_add_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><br><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Victims</B></TD></TR>';
foreach($player_frags as $frag)
{
$frags++;
$frag_add_content .= '<tr bgcolor="' . getStyle($frags) . '">
<td width="20%" align="center">' . date("j M Y, H:i", $frag['date']) . '</td>
<td>Fragged <a href="' . getPlayerLink($frag[name], false) . '">' . $frag[name] . '</a> at level ' . $frag[level];
$frag_add_content .= ". (".(($frag['unjustified'] == 0) ? "<font size=\"1\" color=\"green\">Justified</font>" : "<font size=\"1\" color=\"red\">Unjustified</font>").")</td></tr>";
}
if($frags > 0)
echo $frag_add_content . '</TABLE>';
}
$query = $query->fetch();
$frags_count = $query['frags'];
}
//Signature
//Js
if($config['signature_enabled'])
}
$town_field = 'town';
if(fieldExist('town_id', 'houses'))
$town_field = 'town_id';
else if(fieldExist('townid', 'houses'))
$town_field = 'townid';
else if(!fieldExist('town', 'houses'))
$town_field = false;
if(fieldExist('name', 'houses')) {
$house = $db->query('SELECT `id`, `paid`, `name`' . ($town_field != false ? ', `' . $town_field . '` as `town`' : '') . ' FROM `houses` WHERE `owner` = '.$player->getId())->fetch();
if(isset($house['id']))
{
$add = '';
if($house['paid'] > 0)
$add = ' is paid until '.date("M d Y", $house['paid']);
}
}
$rank_of_player = $player->getRank();
if($rank_of_player->isLoaded()) {
$guild = $rank_of_player->getGuild();
if($guild->isLoaded()) {
$guild_name = $guild->getName();
}
}
$comment = $player->getComment();
if($config['characters']['skills'])
{
echo '<script type="text/javascript">
function showSignLinks()
{
if(document.getElementById(\'signLinks\').style.display == "none")
{
document.getElementById(\'signLinks\').style.display = "inline";
document.getElementById(\'signText\').innerHTML = "Hide links";
}
else
{
document.getElementById(\'signLinks\').style.display = "none";
document.getElementById(\'signText\').innerHTML = "Show links";
if(fieldExist('skill_fist', 'players')) {// tfs 1.0+
$skills_db = $db->query('SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch();
$skill_ids = array(
POT::SKILL_FIST => 'skill_fist',
POT::SKILL_CLUB => 'skill_club',
POT::SKILL_SWORD => 'skill_sword',
POT::SKILL_AXE => 'skill_axe',
POT::SKILL_DIST => 'skill_dist',
POT::SKILL_SHIELD => 'skill_shielding',
POT::SKILL_FISH => 'skill_fishing',
);
$skills = array();
foreach($skill_ids as $skillid => $field_name) {
$skills[] = array('skillid' => $skillid, 'value' => $skills_db[$field_name]);
}
}
</script>';
echo '<br>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Signature</B></TD></TR>
<TR BGCOLOR='.$config['lightborder'].'><TD align="center" VALIGN=top>';
$signature_url = BASE_URL . 'tools/signature/?name=' . urlencode($player->getName());
if($config['friendly_urls'])
$signature_url = BASE_URL . urlencode($player->getName()) . '.png';
echo '
<img src="' . $signature_url . '" alt="Signature for player '.$player->getName().'">
<br/>
<b><a href="#" onclick="showSignLinks(); return false;" id="signText">Show links</a></b>
<br>
<table id="signLinks" style="display: none;">
<tr>
<td>Website:</td>
<td><input type="text" value="<a href=&quot;' . getPlayerLink($player->getName(), false) . '&quot;><img src=&quot;' . $signature_url . '&quot;></a>" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Forum::</td>
<td><input type="text" value="[URL=' . getPlayerLink($player->getName(), false) . '][IMG]' . $signature_url . '[/IMG][/URL]" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Direct link::</td>
<td><input type="text" value="' . $signature_url . '" style="width: 400px;" onclick="this.select()"></td>
</tr>
</table>
</TD></TR>
</TABLE>';
else
$skills = $db->query('SELECT `skillid`, `value` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' LIMIT 7');
foreach($skills as &$skill) {
$skill['name'] = getSkillName($skill['skillid']);
}
}
$quests_enabled = $config['characters']['quests'] && !empty($config['quests']);
if($quests_enabled)
{
$quests = $config['quests'];
$sql_query_in = '';
$i = 0;
foreach($quests as $quest_name => $quest_storage)
{
if($i != 0)
$sql_query_in .= ', ';
$sql_query_in .= $quest_storage;
$i++;
}
$storage_sql = $db->query('SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = '.$player->getId().' AND `key` IN (' . $sql_query_in . ')');
$player_storage = array();
foreach($storage_sql as $storage)
$player_storage[$storage['key']] = $storage['value'];
foreach($quests as &$storage) {
$storage = isset($player_storage[$storage]) && $player_storage[$storage] > 0;
}
}
if($config['characters']['equipment'])
{
global $db;
$eq_sql = $db->query('SELECT `pid`, `itemtype` FROM player_items WHERE player_id = '.$player->getId().' AND (`pid` >= 1 and `pid` <= 10)');
$equipment = array();
foreach($eq_sql as $eq)
$equipment[$eq['pid']] = $eq['itemtype'];
$empty_slots = array("", "no_helmet", "no_necklace", "no_backpack", "no_armor", "no_handleft", "no_handright", "no_legs", "no_boots", "no_ring", "no_ammo");
for($i = 0; $i <= 10; $i++)
{
if(!isset($equipment[$i]) || $equipment[$i] == 0)
$equipment[$i] = $empty_slots[$i];
}
for($i = 1; $i < 11; $i++)
{
if(check_number($equipment[$i]))
$equipment[$i] = getItemImage($equipment[$i]);
else
$equipment[$i] = '<img src="images/items/' . $equipment[$i] . '.gif" width="32" height="32" border="0" alt=" ' . $equipment[$i] . '" />';
}
$skulls = array(
1 => 'yellow_skull',
2 => 'green_skull',
3 => 'white_skull',
4 => 'red_skull',
5 => 'black_skull'
);
}
if($player->getCustomField('hidden') != 1)
$dead_add_content = '';
if(tableExist('killers')) {
$player_deaths = $db->query('SELECT `id`, `date`, `level` FROM `player_deaths` WHERE `player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,10;');
if(count($player_deaths))
{
$rows = 0;
echo '<br/><br/>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=2 class="white"><B>Account Information</B></TD>
</TR>';
$realName = $account->getCustomField('rlname');
if(!empty($realName))
$dead_add_content = '<br/><table border=0 cellspacing=1 cellpadding=4 width=100%><tr bgcolor='.$config['vdarkborder'].'><td colspan=2 class="white"><b>Character Deaths</b></td></tr>';
$number_of_rows = 0;
foreach($player_deaths as $death)
{
echo '
<TR BGCOLOR='.getStyle(++$rows).'>
<TD WIDTH=20%>Real name:</TD>
<TD>'.$realName.'</TD>
</TR>';
}
$group = $player->getGroup();
if($group->isLoaded() && $group->getId() != 1)
{
echo
'<TR BGCOLOR='.getStyle(++$rows).'>
<TD>Position:</TD>
<TD>' . ucfirst($group->getName()) . '</TD>
</TR>';
}
$realLocation = $account->getCustomField('location');
if(isset($realLocation[0]))
{
echo
'<TR BGCOLOR='.getStyle(++$rows).'>
<TD WIDTH=20%>Location:</TD>
<TD>'.$realLocation.'</TD>
</TR>';
}
echo
'<TR BGCOLOR='.getStyle(++$rows).'>
<TD WIDTH=20%>Created:</TD>';
$bannedUntil = '';
$banned = array();
if(tableExist('account_bans'))
$banned = $db->query('SELECT `expires_at` as `expires` FROM `account_bans` WHERE `account_id` = '.$account->getId().' and `expires_at` > ' . time());
else if(tableExist('bans')) {
if(fieldExist('expires', 'bans'))
$banned = $db->query('SELECT `expires` FROM `bans` WHERE (`value` = '.$account->getId().' or `value` = '.$player->getId().') and `active` = 1 and `type` != 2 and `type` != 4 and `expires` > ' . time());
else
$banned = $db->query('SELECT `time` as `time` FROM `bans` WHERE (`account` = '.$account->getId().' or `player` = '.$player->getId().') and `type` != 2 and `type` != 4 and `time` > ' . time());
}
foreach($banned as $ban)
$dead_add_content .= '<tr bgcolor="'.getStyle($number_of_rows++).'">
<td width="20%" align="center">'.date("j M Y, H:i", $death['date']).'</td>
<td> ';
$killers = $db->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id
LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id
WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll();
$i = 0;
$count = count($killers);
foreach($killers as $killer)
{
$i++;
if($killer['player_name'] != "")
{
$bannedUntil = ' <font color="red">[Banished '.($ban['expires'] == "-1" ? 'forever' : 'until '.date("d F Y, h:s", $ban['expires'])).']</font>';
if($i == 1)
$dead_add_content .= "Killed at level <b>".$death['level']."</b>";
else if($i == $count)
$dead_add_content .= " and";
else
$dead_add_content .= ",";
$dead_add_content .= " by ";
if($killer['monster_name'] != "")
$dead_add_content .= $killer['monster_name']." summoned by ";
if($killer['player_exists'] == 0)
$dead_add_content .= getPlayerLink($killer['player_name']);
else
$dead_add_content .= $killer['player_name'];
}
echo '<TD>'.date("j F Y, g:i a", $account->getCustomField("created")).$bannedUntil.'</TD>
</TR>
</TABLE>';
echo '<br/><br/>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=4 class="white"><B>Characters</B></TD>
</TR>
<TR BGCOLOR='.$config['darkborder'].'>
<TD WIDTH=62%><B>Name</B></TD>
<TD WIDTH=30%><B>Level</B></TD>
<TD WIDTH=8%><b>Status</b></TD>
<TD><B>&#160;</B></TD>
</TR>';
else
{
if($i == 1)
$dead_add_content .= "Died at level <b>".$death['level']."</b>";
else if($i == $count)
$dead_add_content .= " and";
else
$dead_add_content .= ",";
$dead_add_content .= " by ".$killer['monster_name'];
}
}
$dead_add_content .= ".</td></tr>";
}
if($number_of_rows > 0)
$dead_add_content += '</table>';
else
$dead_add_content = '';
}
}
else {
$mostdamage = '';
if(fieldExist('mostdamage_by', 'player_deaths'))
$mostdamage = ', `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`';
$deaths_db = $db->query('SELECT
`player_id`, `time`, `level`, `killed_by`, `is_player`' . $mostdamage . '
FROM `player_deaths`
WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;');
if(count($deaths_db))
{
$dead_add_content = '<br/><table border=0 cellspacing=1 cellpadding=4 width=100%><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2" class="white"><b>Character Deaths</b></td></tr>';
$number_of_rows = 0;
foreach($deaths_db as $death)
{
$dead_add_content .= '<tr bgcolor="'.getStyle($number_of_rows++).'">
<td width="20%" align="center">'.date("j M Y, H:i", $death['time']).'</td>
<td> ';
$lasthit = ($death['is_player']) ? getPlayerLink($death['killed_by']) : $death['killed_by'];
$dead_add_content .= 'Killed at level ' . $death['level'] . ' by ' . $lasthit;
if($death['unjustified']) {
$dead_add_content .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
}
$mostdmg = ($death['mostdamage_by'] !== $death['killed_by']) ? true : false;
if($mostdmg)
{
$mostdmg = ($death['mostdamage_is_player']) ? getPlayerLink($death['mostdamage_by']) : $death['mostdamage_by'];
$dead_add_content .= ' and by ' . $mostdmg;
if ($death['mostdamage_unjustified']) {
$dead_add_content .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
}
}
else {
$dead_add_content .= " <b>(soloed)</b>";
}
$dead_add_content .= ".</td></tr>";
}
if($number_of_rows > 0)
$dead_add_content += '</table>';
else
$dead_add_content = '';
}
}
$frag_add_content = '';
if($config['characters']['frags'])
{
//frags list by Xampy
$i = 0;
$frags_limit = 10; // frags limit to show? // default: 10
$player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';');
if(count($player_frags))
{
$frags = 0;
$frag_add_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><br><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Victims</B></TD></TR>';
foreach($player_frags as $frag)
{
$frags++;
$frag_add_content .= '<tr bgcolor="' . getStyle($frags) . '">
<td width="20%" align="center">' . date("j M Y, H:i", $frag['date']) . '</td>
<td>Fragged <a href="' . getPlayerLink($frag[name], false) . '">' . $frag[name] . '</a> at level ' . $frag[level];
$frag_add_content .= ". (".(($frag['unjustified'] == 0) ? "<font size=\"1\" color=\"green\">Justified</font>" : "<font size=\"1\" color=\"red\">Unjustified</font>").")</td></tr>";
}
if($frags > 0)
$frag_add_content += '</table>';
else
$frag_add_content = '';
}
}
// signature
if($config['signature_enabled']) {
$signature_url = BASE_URL . 'tools/signature/?name=' . urlencode($player->getName());
if($config['friendly_urls'])
$signature_url = BASE_URL . urlencode($player->getName()) . '.png';
}
$hidden = $player->getCustomField('hidden');
if($hidden != 1) {
// check if account has been banned
$bannedUntil = '';
$banned = array();
if (tableExist('account_bans'))
$banned = $db->query('SELECT `expires_at` as `expires` FROM `account_bans` WHERE `account_id` = ' . $account->getId() . ' and `expires_at` > ' . time());
else if (tableExist('bans')) {
if (fieldExist('expires', 'bans'))
$banned = $db->query('SELECT `expires` FROM `bans` WHERE (`value` = ' . $account->getId() . ' or `value` = ' . $player->getId() . ') and `active` = 1 and `type` != 2 and `type` != 4 and `expires` > ' . time());
else
$banned = $db->query('SELECT `time` as `time` FROM `bans` WHERE (`account` = ' . $account->getId() . ' or `player` = ' . $player->getId() . ') and `type` != 2 and `type` != 4 and `time` > ' . time());
}
foreach ($banned as $ban) {
$bannedUntil = ' <font color="red">[Banished ' . ($ban['expires'] == "-1" ? 'forever' : 'until ' . date("d F Y, h:s", $ban['expires'])) . ']</font>';
}
$account_players = $account->getPlayersList();
$account_players->orderBy('name');
$player_number = 0;
foreach($account_players as $player_list)
{
$player_list_status = '';
if($player_list->isHidden())
continue;
$player_number++;
if($player_list->isOnline())
$player_list_status = '<b><font color="green">Online</font></b>';
echo '<TR BGCOLOR="'.getStyle($player_number).'"><TD><NOBR>'.$player_number.'.&#160;'.$player_list->getName();
echo ($player_list->isDeleted()) ? '<font color="red"> [DELETED]</font>' : '';
echo '</NOBR></TD><TD>'.$player_list->getLevel().' '.$config['vocations'][$player_list->getVocation()].'</TD><TD>' . $player_list_status . '</TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="' . internalLayoutLink('characters') . '" METHOD=post><TR><TD><INPUT TYPE=hidden NAME=name VALUE="'.$player_list->getName().'"><INPUT TYPE=image NAME="View '.$player_list->getName().'" ALT="View '.$player_list->getName().'" SRC="'.$template_path.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></TD></TR>';
}
echo '</TABLE></TD><TD><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';
}
echo '<br/><br/>' . generate_search_table();
echo '</TABLE>';
}
echo $twig->render('characters.html', array(
'outfit' => $outfit,
'player' => $player,
'account' => $account,
'config' => $config,
'flag' => $flag,
'oldName' => $oldName,
'sex' => $player_sex,
'marriage_enabled' => $config['characters']['marriage_info'] && fieldExist('marriage', 'players'),
'marital_status' => $marital_status,
'vocation' => $config['vocations'][$player->getVocation()],
'frags_enabled' => $frags_enabled,
'frags_count' => $frags_count,
'town' => isset($config['towns'][$player->getTownId()]) ? $config['towns'][$player->getTownId()] : null,
'house' => array(
'found' => isset($house['id']),
'add' => isset($house['id']) ? $add : null,
'name' => isset($house['id']) ? (isset($house['name']) ? $house['name'] : $house['id']) : null,
'town' => isset($house['town']) ? ' (' . $config['towns'][$house['town']] . ')' : ''
),
'guild' => array(
'rank' => isset($guild_name) ? $rank_of_player->getName() : null,
'link' => isset($guild_name) ? getGuildLink($guild_name) : null
),
'comment' => !empty($comment) ? wordwrap(nl2br($comment), 60, "<br/>", true) : null,
'skills' => isset($skills) ? $skills : null,
'quests_enabled' => $quests_enabled,
'quests' => isset($quests) ? $quests : null,
'equipment' => isset($equipment) ? $equipment : null,
'skull' => $player->getSkullTime() > 0 && ($player->getSkull() == 4 || $player->getSkull() == 5) ? $skulls[$player->getSkull()] : null,
'deaths' => $dead_add_content,
'frags' => $frag_add_content,
'signature_url' => isset($signature_url) ? $signature_url : null,
'player_link' => getPlayerLink($player->getName(), false),
'hidden' => $hidden,
'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null,
'characters_link' => internalLayoutLink('characters'),
'account_players' => isset($account_players) ? $account_players : null,
'search_form' => generate_search_form()
));
}
else
{
@ -702,7 +464,7 @@ else
echo '</ul>';
}
echo generate_search_table(true);
echo generate_search_form(true);
}
if(!empty($search_errors))

View File

@ -32,26 +32,40 @@ if(isset($_GET['archive']))
if($_REQUEST['id'] < 100000)
$field_name = 'id';
$news = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE type = 1 AND hidden != 1 and `' . $field_name . '` = ' . (int)$_REQUEST['id'] . '');
$news = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE `type` = 1 AND `hidden` != 1 AND `' . $field_name . '` = ' . (int)$_REQUEST['id'] . '');
if($news->rowCount() == 1)
{
if(@file_exists($template_path . '/news.php'))
require($template_path . '/news.php');
else
require(SYSTEM . 'templates/news.php');
$news = $news->fetch();
$author = '';
$query = $db->query('SELECT name FROM players WHERE id = ' . $db->quote($news['player_id'] . ' LIMIT 1'));
$query = $db->query('SELECT `name` FROM `players` WHERE id = ' . $db->quote($news['player_id'] . ' LIMIT 1;'));
if($query->rowCount() > 0) {
$query = $query->fetch();
$author = $query['name'];
}
echo news_parse($news['title'], $news['body'], $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', $news['comments'] != 0 ? getForumThreadLink($news['comments']) : NULL);
$content = $news['body'];
$firstLetter = '';
if($content[0] != '<')
{
$tmp = $template_path.'/images/letters/' . $content[0] . '.gif';
if(file_exists($tmp)) {
$firstLetter = '<img src="' . $tmp . '" alt="' . $content[0] . '" border="0" align="bottom">';
$content = $firstLetter . substr($content, 1);
}
}
echo $twig->render('news.html', array(
'title' => stripslashes($news['title']),
'content' => $content,
'date' => $news['date'],
'icon' => $categories[$news['category']]['icon_id'],
'author' => $config['news_author'] ? $author : '',
'comments' => $news['comments'] != 0 ? getForumThreadLink($news['comments']) : null,
'news_date_format' => $config['news_date_format']
));
}
else
echo 'This news doesn\'t exist or is hidden.<br>';
echo "This news doesn't exist or is hidden.<br/>";
//echo '<br /><a href="' . internalLayoutLink('news') . ($config['friendly_urls'] ? '/' : '') . 'archive' . '"><font size="2"><b>Back to Archive</b></font></a>';
?>
@ -257,12 +271,6 @@ if(isset($tickers_to_add[0]))
if(!$news_cached)
{
ob_start();
// newses
if(@file_exists($template_path . '/news.php'))
require($template_path . '/news.php');
else
require(SYSTEM . 'templates/news.php');
if($canEdit)
{
?>
@ -427,7 +435,7 @@ if(!$news_cached)
foreach($newses as $news)
{
$author = '';
$query = $db->query('SELECT name FROM players WHERE id = ' . $db->quote($news['player_id'] . ' LIMIT 1'));
$query = $db->query('SELECT `name` FROM `players` WHERE id = ' . $db->quote($news['player_id'] . ' LIMIT 1'));
if($query->rowCount() > 0) {
$query = $query->fetch();
$author = $query['name'];
@ -447,8 +455,27 @@ if(!$news_cached)
' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . '
</a>';
}
echo news_parse($news['title'], $news['body'] . $admin_options, $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', $news['comments'] != 0 ? getForumThreadLink($news['comments']) : NULL);
$content = $news['body'];
$firstLetter = '';
if($content[0] != '<')
{
$tmp = $template_path.'/images/letters/' . $content[0] . '.gif';
if(file_exists($tmp)) {
$firstLetter = '<img src="' . $tmp . '" alt="' . $content[0] . '" border="0" align="bottom">';
$content = $firstLetter . substr($content, 1);
}
}
echo $twig->render('news.html', array(
'title' => stripslashes($news['title']),
'content' => $content . $admin_options,
'date' => $news['date'],
'icon' => $categories[$news['category']]['icon_id'],
'author' => $config['news_author'] ? $author : '',
'comments' => $news['comments'] != 0 ? getForumThreadLink($news['comments']) : null,
'news_date_format' => $config['news_date_format']
));
}
}
@ -564,7 +591,7 @@ class Forum
{
global $db;
$thread_id = 0;
if($db->insert(TABLE_PREFIX . 'forum', array('id' => 'null', 'first_post' => 0, 'last_post' => time(), 'section' => $section_id, 'replies' => 0, 'views' => 0, 'author_aid' => isset($account_id) ? $account_id : 0, 'author_guid' => isset($player_id) ? $player_id : 0, 'post_text' => $body, 'post_topic' => $title, 'post_smile' => 0, 'post_date' => time(), 'last_edit_aid' => 0, 'edit_date' => 0, 'post_ip' => $_SERVER['REMOTE_ADDR']))) {
if($db->insert(TABLE_PREFIX . 'forum', array('first_post' => 0, 'last_post' => time(), 'section' => $section_id, 'replies' => 0, 'views' => 0, 'author_aid' => isset($account_id) ? $account_id : 0, 'author_guid' => isset($player_id) ? $player_id : 0, 'post_text' => $body, 'post_topic' => $title, 'post_smile' => 0, 'post_date' => time(), 'last_edit_aid' => 0, 'edit_date' => 0, 'post_ip' => $_SERVER['REMOTE_ADDR']))) {
$thread_id = $db->lastInsertId();
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
}

View File

@ -66,18 +66,39 @@ Here you can tell other players about yourself. This information will be display
</tr>
{% endif %}
</table>
</div> </table></div></td></tr><br/>
</div>
</td>
</tr>
</table>
</div>
<br/>
<table width="100%">
<tr align="center"><td><table border="0" cellspacing="0" cellpadding="0" ><tr>
<td style="border:0px;" >
<input type="hidden" name="changeinfosave" value="1" >
<div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);" ></div>
<input class="ButtonText" type="image" name="Submit" alt="Submit" src="{{ template_path }}/images/buttons/_sbutton_submit.gif" ></div></div>
</td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" >
<form action="?subtopic=accountmanagement" method="post" >
<tr><td style="border:0px;" ><div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);" ></div>
<input class="ButtonText" type="image" name="Back" alt="Back" src="{{ template_path }}/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></td></tr></table>
<tr align="center">
<td>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td style="border:0px;" >
<input type="hidden" name="changeinfosave" value="1">
<div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)"><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);" ></div>
<input class="ButtonText" type="image" name="Submit" alt="Submit" src="{{ template_path }}/images/buttons/_sbutton_submit.gif" ></div>
</div>
</td>
</tr>
</table>
</td>
<td>
</form>
<table border="0" cellspacing="0" cellpadding="0" >
<form action="?subtopic=accountmanagement" method="post" >
<tr>
<td style="border:0px;" >
<div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);"></div><input class="ButtonText" type="image" name="Back" alt="Back" src="{{ template_path }}/images/buttons/_sbutton_back.gif" ></div>
</div>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>

View File

@ -0,0 +1,351 @@
{% set rows = 0 %}
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td><img src="<{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0"></td>
<td>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
{% if config.characters.outfit %}
<div style="width:64px;height:64px;border:2px solid #F1E0C6; border-radius:50px; padding:13px; margin-top:38px;margin-left:376px;position:absolute;"><img style="margin-left:{% if player.getLookType() in [75, 266, 302] %}-0px;margin-top:-0px;width:64px;height:64px;{% else %}-60px;margin-top:-60px;width:128px;height:128px;{% endif %}" src="{{ outfit }}"></div>
{% endif %}
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><b>Character Information</b></td>
</tr>
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Name:</td>
<td>{{ flag|raw }} <font color="{% if player.isOnline() %}green{% else %}red{% endif %}"><b>{{ player.getName() }}</b></font>{{ oldName }}</td>
</tr>
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Sex:</td>
<td>{{ sex }}</td>
</tr>
{% if marriage_enabled %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Marital status:</td>
<td>{{ marital_status }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Profession:</td>
<td>{{ vocation }}</td>
</tr>
{% if config.characters.level %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Level:</td>
<td>{{ player.getLevel() }}</td>
</tr>
{% endif %}
{% if config.characters.experience %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Experience:</td>
<td>{{ player.getExperience() }}</td>
</tr>
{% endif %}
{% if config.characters.magic_level %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Magic Level:</td>
<td>{{ player.getMagLevel() }}</td>
</tr>
{% endif %}
{% if frags_enabled %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Frags:</td>
<td>{{ frags_count }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Residence:</td>
<td>{{ town }}</td>
</tr>
{% if config.characters.balance %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Balance:</td>
<td>{{ player.getBalance() }} Gold Coins.</td>
</tr>
{% endif %}
{% if house.found %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>House:</td>
<td>
<table border="0">
<tr>
<td>{{ house.name ~ house.town ~ house.add }}</td>
<td>
<form action="?subtopic=houses&page=view" method="post">
<input type="hidden" name="house" value="{{ house.name }}">
<input type="image" name="View" alt="View" src="{{ template_path }}/images/buttons/sbutton_view.gif" border="0" width="120">
</form>
</td>
</tr>
</table>
</td>
</tr>
{% endif %}
{% if guild.rank is not null %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Guild membership:</td>
<td>{{ guild.rank }} of the {{ guild.link|raw }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Last login:</td>
<td>{% if player.getLastLogin() == 0 %}Never logged in.{% else %}{{ player.getLastLogin()|date("M d Y, H:i:s") }} CEST{% endif %}</td>
</tr>
{% if config.characters.creation_date %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Created:</td>
<td>{{ player.getCreated()|date("M d Y, H:i:s") }} CEST</td>
</tr>
{% endif %}
{% if comment is not null %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td valign="top">Comment:</td>
<td>{{ comment|raw }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Account Status:</td>
<td>{% if account.isPremium() %}Premium Account{% else %}Free Account{% endif %}</td>
</tr>
</table>
<br/>
<table border="0" width="100%">
<tr>
{% if config.characters.skills %}
<td width="30%" valign="top">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><B>Skills</b></td>
</tr>
{% set i = 0 %}
{% for skill in skills %}
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td valign="top">{{ skill.name }}</td>
<td>{{ skill.value }}</td>
</tr>
{% endfor %}
</table>
</td>
{% endif %}
{% if quests_enabled %}
<td width="40%" valign="top">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><b>Quests</b></td>
</tr>
{% set i = 0 %}
{% for name, done in quests %}
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td valign="top">{{ name }}</TD>
<td><img src="images/{% if done %}true{% else %}false{% endif %}.png" border="0"/></td>
</tr>
{% endfor %}
</table>
</td>
{% endif %}
{% if config.characters.equipment %}
<td width="100" valign="top">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder}}">
<td colspan="2" class="white"><b>Equipment</b></td>
</tr>
<tr bgcolor="{{ getStyle(1) }}">
<td>
<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
<tr>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">{{ equipment[2]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[6]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[9]|raw }}</td></tr>
<tr height="11px"><td>{% if skull is not null %}<img src="images/{{ skull }}.gif">{% endif %}</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">{{ equipment[1]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[4]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[7]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[8]|raw }}</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">{{ equipment[3]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[5]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[10]|raw }}</td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
{% endif %}
</tr>
</table>
{{ deaths|raw }}
{{ frags|raw }}
{% if config.signature_enabled %}
<script type="text/javascript">
function showSignLinks()
{
if(document.getElementById('signLinks').style.display == "none")
{
document.getElementById('signLinks').style.display = "inline";
document.getElementById('signText').innerHTML = "Hide links";
}
else
{
document.getElementById('signLinks').style.display = "none";
document.getElementById('signText').innerHTML = "Show links";
}
}
</script>
<br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%"><tr bgcolor="{{ config.vdarkborder }}"><td colspan=2 class="white"><b>Signature</b></td></tr>
<tr bgcolor="{{ config.lightborder }}"><td align="center" valign="top">
<img src="{{ signature_url }}" alt="Signature for player {{ player.getName() }}">
<br/>
<b><a href="#" onclick="showSignLinks(); return false;" id="signText">Show links</a></b>
<br/>
<table id="signLinks" style="display: none;">
<tr>
<td>Website:</td>
<td><input type="text" value="<a href=&quot;{{ player_link }}&quot;><img src=&quot;{{ signature_url }}&quot;></a>" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Forum::</td>
<td><input type="text" value="[URL={{ player_link }}][IMG]{{ signature_url }}[/IMG][/URL]" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Direct link::</td>
<td><input type="text" value="{{ signature_url }}" style="width: 400px;" onclick="this.select()"></td>
</tr>
</table>
</td></tr>
</table>
{% endif %}
{% if hidden != 1 %}
{% set rows = 0 %}
<br/><br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><b>Account Information</b></td>
</tr>
{% set realName = account.getCustomField('rlname') %}
{% if realName is not empty %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Real name:</td>
<td>{{ realName }}</td>
</tr>
{% endif %}
{% set group = player.getGroup() %}
{% if group.isLoaded() and group.getId() != 1 %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Position:</td>
<td>{{ group.getName()|capitalize }}</td>
</tr>
{% endif %}
{% set realLocation = account.getCustomField('location') %}
{% if realLocation is not empty %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Location:</td>
<td>{{ realLocation }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Created:</td>
<td>{{ account.getCustomField("created")|date("j F Y, g:i a") ~bannedUntil }}</td>
</tr>
</table>
<br/><br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan=4 class="white"><b>Characters</b></td>
</tr>
<tr bgcolor="{{ config.darkborder }}">
<td width="62%"><B>Name</b></td>
<td width="30%"><B>Level</b></td>
<td width="8%"><b>Status</b></td>
<td><b>&#160;</b></td>
</tr>
{% set i = 0 %}
{% for player in account_players %}
{% if not player.isHidden() %}
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td>
<nobr>{{ i }}.&#160;{{ player.getName() }}{% if player.isDeleted() %}<font color="red"> [DELETED]</font>{% endif %}</nobr>
</td>
{% set vocation = 'Unknown' %}
{% if config.vocations[player.getVocation()] is defined %}
{% set vocation = config.vocations[player.getVocation()] %}
{% endif %}
<td>{{ player.getLevel() }} {{ vocation }}</td>
<td>{% if player.isOnline() %}<b><font color="green">Online</font></b>{% endif %}</td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ characters_link }}" method=post>
<tr>
<td>
<input type="hidden" name="name" value="{{ player.getName() }}"/>
<input type="image" name="View {{ player.getName() }}" alt="View {{ player.getName() }}" src="{{ template_path }}/images/buttons/sbutton_view.gif" border="0" width="120" height="18"/>
</td>
</tr>
</form>
</table>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% endif %}
</td>
<td>
<img src="{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0">
</td>
</tr>
</table>
<br/><br/>{{ search_form|raw }}

View File

@ -0,0 +1,23 @@
<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url({{ template_path }}/images/news/newsheadline_background.gif)">
<img src="{{ template_path }}/images/news/icon_{{ icon }}.gif" class="NewsHeadlineIcon" />
<div class="NewsHeadlineDate">{{ date|date(news_date_format) }} - </div>
<div class="NewsHeadlineText">{{ title }}</div>
{% if author is not empty %}
<div class="NewsHeadlineAuthor"><b>Author: </b><i>{{ author }}</i></div>
{% endif %}
</div>
</div>
<table style="clear:both" border=0 cellpadding=0 cellspacing=0 width="100%" >
<tr>
<td style="padding-left:10px;padding-right:10px;" >{{ content|raw }}</td>
</tr>
{% if comments is not null %}
<tr>
<td>
<div style="text-align: right; margin-right: 10px;"><a href="{{ comments }}">» Comment on this news</a></div>
</td>
</tr>
{% endif %}
</table>
<br/>

View File

@ -1,34 +0,0 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
function news_parse($title, $content, $date, $icon = 0, $author = '', $comments = '')
{
global $template_path, $config;
//$tmp = $template_path.'/images/letters/'.$content[0].'.gif';
//if(file_exists($tmp)) {
// $firstLetter = '<img src="' . $tmp . '" alt="'.$content[0].'" BORDER=0 ALIGN=bottom>';
//$content[0] = '';
//}
return '
<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url(' . $template_path . '/images/news/newsheadline_background.gif)">
<img src="' . $template_path . '/images/news/icon_' . $icon . '.gif" class=\'NewsHeadlineIcon\' />
<div class="NewsHeadlineDate">' . date($config['news_date_format'], $date) . ' - </div>
<div class="NewsHeadlineText">' . stripslashes($title) . '</div>
' . (isset($author[0]) ? '
<div class="NewsHeadlineAuthor"><b>Author: </b><i>' . $author . '</i></div>' : '') . '
</div>
</div>
<table style="clear:both" border=0 cellpadding=0 cellspacing=0 width="100%" >
<tr>
<td style="padding-left:10px;padding-right:10px;" >' . $content . '</td>
</tr>'
. (isset($comments[0]) ? '
<tr>
<td>
<div style="text-align: right; margin-right: 10px;"><a href="' . $comments . '">» Comment on this news</a></div>
</td>
</tr>' : '') .
'</table><br/>';
}
?>

View File

@ -1,42 +0,0 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
function news_parse($title, $content, $date, $icon = 0, $author = '', $comments = '')
{
global $template_path;
$firstLetter = '';
if($content[0] != '<')
{
$tmp = $template_path.'/images/letters/'.$content[0].'.gif';
if(file_exists($tmp)) {
$firstLetter = '<img src="' . $tmp . '" alt="'.$content[0].'" BORDER=0 ALIGN=bottom>';
$content = substr($content, 1);
}
}
return '
<div id="News">
<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url(' . $template_path . '/images/news/newsheadline_background.gif)">
<img src="' . $template_path . '/images/news/icon_' . $icon . '.gif" class=\'NewsHeadlineIcon\' />
<div class="NewsHeadlineDate">' . date("j.n.Y", $date) . ' - </div>
<div class="NewsHeadlineText">' . stripslashes($title) . '</div>
' . (isset($author[0]) ? '
<div class="NewsHeadlineAuthor"><b>Author: </b><i>' . $author . '</i></div>' : '') . '
</div>
</div>
</div>
<table style="clear:both" border=0 cellpadding=0 cellspacing=0 width="100%" >
<tr>
<td style="padding-left:10px;padding-right:10px;" >' . $firstLetter.$content . '</td>
</tr>'
. (isset($comments[0]) ? '
<tr>
<td>
<div style="text-align: right; margin-right: 10px;"><a href="' . $comments . '">» Comment on this news</a></div>
</td>
</tr>' : '') .
'</table><br/>';
}
?>

View File

@ -0,0 +1,25 @@
<div id="News">
<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url({{template_path }}/images/news/newsheadline_background.gif)">
<img src="{{ template_path }}/images/news/icon_{{ icon }}.gif" class="NewsHeadlineIcon" />
<div class="NewsHeadlineDate">{{ date|date(news_date_format) }} - </div>
<div class="NewsHeadlineText">{{ title }}</div>
{% if author is not empty %}
<div class="NewsHeadlineAuthor"><b>Author: </b><i>{{ author }}</i></div>
{% endif %}
</div>
</div>
</div>
<table style="clear:both" border=0 cellpadding=0 cellspacing=0 width="100%" >
<tr>
<td style="padding-left:10px;padding-right:10px;" >{{ content|raw }}</td>
</tr>
{% if comments is not null %}
<tr>
<td>
<div style="text-align: right; margin-right: 10px;"><a href="{{ comments }}">» Comment on this news</a></div>
</td>
</tr>
{% endif %}
</table>
<br/>

View File

@ -1,39 +0,0 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
function news_parse($title, $content, $date, $icon = 0, $author = '', $comments = '')
{
global $template_path;
if($content[0] != '<')
{
$tmp = $template_path.'/images/letters/'.$content[0].'.gif';
if(file_exists($tmp)) {
$firstLetter = '<img src="' . $tmp . '" alt="'.$content[0].'" BORDER=0 ALIGN=bottom>';
$content = substr($content, 1);
}
}
return '
<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url(' . $template_path . '/images/news/newsheadline_background.gif)">
<img src="' . $template_path . '/images/news/icon_' . $icon . '.gif" class=\'NewsHeadlineIcon\' />
<div class="NewsHeadlineDate">' . date("j.n.Y", $date) . ' - </div>
<div class="NewsHeadlineText">' . stripslashes($title) . '</div>
' . (isset($author[0]) ? '
<div class="NewsHeadlineAuthor"><b>Author: </b><i>' . $author . '</i></div>' : '') . '
</div>
</div>
<table style="clear:both" border=0 cellpadding=0 cellspacing=0 width="100%" >
<tr>
<td style="padding-left:10px;padding-right:10px;" >' . (isset($firstLetter) ? $firstLetter : '').$content . '</td>
</tr>'
. (isset($comments[0]) ? '
<tr>
<td>
<div style="text-align: right; margin-right: 10px;"><a href="' . $comments . '">» Comment on this news</a></div>
</td>
</tr>' : '') .
'</table><br/>';
}
?>

View File

@ -1,52 +1,32 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
$player = $ots->createObject( 'Player' );
$player->find($_GET['name']);
if(function_exists('imagecreatefrompng'))
$font = SIGNATURES_FONTS . 'font.ttf';
$fontsize = 12;
$image = imagecreatefrompng(SIGNATURES_BACKGROUNDS . 'signature.png');
$color= imagecolorallocate($image , 255, 255, 255);
imagettftext($image , 12, 0, 20, 32, $color, $font, 'Name:');
imagettftext($image , 12, 0, 70, 32, $color, $font, $player->getName());
$vocation = 'Unknown vocation';
if(isset($config['vocations'][$player->getVocation()]))
$vocation = $config['vocations'][$player->getVocation()];
imagettftext($image , $fontsize, 0, 20, 52, $color, $font, 'Level:');
imagettftext($image , $fontsize, 0, 70, 52, $color, $font, $player->getLevel() . ' ' . $vocation);
$rank = $player->getRank();
if($rank->isLoaded())
{
if($player->isLoaded())
{
$file = SIGNATURES_CACHE.$player->getId().'.png';
if ( file_exists( $file ) and ( time( ) < ( filemtime($file) + ( 60 * $config['signature_cache_time'] ) ) ) )
{
header( 'Content-type: image/png' );
readfile( SIGNATURES_CACHE.$player->getId().'.png' );
}
else
{
$image = imagecreatefrompng(SIGNATURES_BACKGROUNDS . 'signature.png');
$color= imagecolorallocate($image , 255, 255, 255);
imagettftext($image , 12, 0, 20, 32, $color, SIGNATURES_FONTS . 'font.ttf' , 'Name:');
imagettftext($image , 12, 0, 70, 32, $color, SIGNATURES_FONTS . 'font.ttf' , $player->getName());
imagettftext($image , 12, 0, 20, 52, $color, SIGNATURES_FONTS . 'font.ttf' , 'Level:');
imagettftext($image , 12, 0, 70, 52, $color, SIGNATURES_FONTS . 'font.ttf' , $player->getLevel() . ' ' . $config['vocations'][$player->getVocation()]);
$rank = $player->getRank();
if($rank->isLoaded())
{
imagettftext($image , 12, 0, 20, 75, $color, SIGNATURES_FONTS . 'font.ttf' , 'Guild:');
imagettftext($image , 12, 0, 70, 75, $color, SIGNATURES_FONTS . 'font.ttf' , $player->getRank()->getName() . ' of the ' . $$rank->getGuild()->getName());
}
imagettftext($image , 12, 0, 20, 95, $color, SIGNATURES_FONTS . 'font.ttf' , 'Last Login:');
imagettftext($image , 12, 0, 100, 95, $color, SIGNATURES_FONTS . 'font.ttf' , (($player->getLastLogin() > 0) ? date("j F Y, g:i a", $player->getLastLogin()) : 'Never logged in.'));
imagepng($image, SIGNATURES_CACHE . $player->getID() . '.png');
imagedestroy($image);
header('Content-type: image/png');
readfile(SIGNATURES_CACHE . $player->getId().'.png');
}
}
else
{
header('Content-type: image/png');
readfile(SIGNATURES_IMAGES . 'nocharacter.png');
}
}
else
{
header('Content-type: image/png');
readfile(SIGNATURES_IMAGES . 'nogd.png');
imagettftext($image , $fontsize, 0, 20, 75, $color, $font, 'Guild:');
imagettftext($image , $fontsize, 0, 70, 75, $color, $font, $player->getRank()->getName() . ' of the ' . $$rank->getGuild()->getName());
}
imagettftext($image , $fontsize, 0, 20, 95, $color, $font, 'Last Login:');
imagettftext($image , $fontsize, 0, 100, 95, $color, $font, (($player->getLastLogin() > 0) ? date("j F Y, g:i a", $player->getLastLogin()) : 'Never logged in.'));
imagepng($image, SIGNATURES_CACHE . $player->getID() . '.png');
imagedestroy($image);
header('Content-type: image/png');
readfile(SIGNATURES_CACHE . $player->getId() . '.png');
?>

View File

@ -4,20 +4,51 @@
require(SYSTEM . 'init.php');
// Definitions
define('SIGNATURES', BASE . 'tools/signature/');
define('SIGNATURES', TOOLS . 'signature/');
define('SIGNATURES_BACKGROUNDS', 'images/backgrounds/');
define('SIGNATURES_CACHE', SYSTEM . 'cache/signatures/');
define('SIGNATURES_CACHE', CACHE . 'signatures/');
define('SIGNATURES_DATA', SYSTEM . 'data/');
define('SIGNATURES_FONTS', SIGNATURES . 'fonts/');
define('SIGNATURES_IMAGES', SIGNATURES . 'images/');
define('SIGNATURES_ITEMS', BASE . 'images/items/');
if(!$config['signature_enabled'])
die('Signatures disabled.');
die('Signatures are disabled on this server.');
$file = strtolower($config['signature_type']) . '.php';
$file = trim(strtolower($config['signature_type'])) . '.php';
if(!file_exists($file))
die('ERROR: Wrong signature type in config.');
putenv('GDFONTPATH=' . SIGNATURES_FONTS);
if(!isset($_REQUEST['name']))
die('Please enter name as get or post parameter.');
$name = stripslashes(ucwords(strtolower(trim($_REQUEST['name']))));
$player = new OTS_Player();
$player->find($name);
if(!$player->isLoaded())
{
header('Content-type: image/png');
readfile(SIGNATURES_IMAGES.'nocharacter.png');
exit;
}
if(!function_exists( 'imagecreatefrompng'))
{
header('Content-type: image/png');
readfile(SIGNATURES_IMAGES.'nogd.png');
exit;
}
$cached = SIGNATURES_CACHE.$player->getId() . '.png';
if (file_exists($cached) and (time() < (filemtime($cached) + (60 * $config['signature_cache_time']))))
{
header( 'Content-type: image/png' );
readfile( SIGNATURES_CACHE.$player->getId().'.png' );
exit;
}
require($file);
?>

View File

@ -6,7 +6,7 @@
**/
/** Load the MadGD class **/
require( 'gd.class.php' );
require('gd.class.php');
/** Default values **/
list( $i, $eachRow, $percent ) = array( .5, 14, array( 'size' => 7 ) );
/** Get experience points for a certain level **/
@ -20,185 +20,153 @@
$dat_path = SIGNATURES_DATA.'Tibia.dat';
$otb_path = SIGNATURES_DATA.'items.otb';
$name = stripslashes( isset( $_GET['name'] ) ? $_GET['name'] : '-' );
$player = $ots->createObject( 'Player' );
$player->find( $name );
if ( function_exists( 'imagecreatefrompng' ) )
$background = 'default.png';
if ( file_exists( SIGNATURES_BACKGROUNDS.$background ) )
{
if ( $player->isLoaded( ) )
$MadGD = new MadGD( SIGNATURES_BACKGROUNDS.$background );
$MadGD->testMode = false;
$MadGD->setDefaultStyle( SIGNATURES_FONTS.'arial.ttf', SIGNATURES_FONTS.'arialbd.ttf', 8 );
$MadGD->setEquipmentBackground( SIGNATURES_IMAGES.'equipments.png' );
/** NAME **/
$MadGD->addText( 'Name:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $player->getName(), ( $player->isOnline() ? array( 'color' => '5df82d' ) : array( ) ) )->setPosition( ); $i++;
/** SEX **/
$MadGD->addText( 'Sex:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$player_sex = 'unknown';
if(isset($config['genders'][$player->getSex()]))
$player_sex = strtolower($config['genders'][$player->getSex()]);
$MadGD->addText($player_sex)->setPosition( ); $i++;
/** PROFESSION **/
$vocation = 'Unknown';
if(isset($config['vocations'][$player->getVocation()]))
$vocation = $config['vocations'][$player->getVocation()];
$MadGD->addText( 'Profession:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $vocation )->setPosition( ); $i++;
/** LEVEL **/
$MadGD->addText( 'Level:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $player->getLevel() )->setPosition( ); $i++;
/** WORLD **/
if($config['multiworld']) {
$MadGD->addText( 'World:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $config['worlds'][$player->getWorldId()] )->setPosition( ); $i++;
}
/** RESIDENCE **/
$MadGD->addText( 'Residence:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $config['towns'][$player->getTownId()] )->setPosition( ); $i++;
/** HOUSE **/
$town = 'town';
if(fieldExist('town_id', 'houses'))
$town = 'town_id';
$house = $db->query( 'SELECT `houses`.`name`, `houses`.`' . $town . '` as town FROM `houses` WHERE `houses`.`owner` = '.$player->getId().';' )->fetchAll();
if ( count( $house ) != 0 )
{
$file = SIGNATURES_CACHE.$player->getId().'.png';
if ( file_exists( $file ) and ( time( ) < ( filemtime($file) + ( 60 * $config['signature_cache_time'] ) ) ) )
{
header( 'Content-type: image/png' );
readfile( SIGNATURES_CACHE.$player->getId().'.png' );
}
else
{
$background = 'default.png';
if ( file_exists( SIGNATURES_BACKGROUNDS.$background ) )
{
$MadGD = new MadGD( SIGNATURES_BACKGROUNDS.$background );
$MadGD->testMode = false;
$MadGD->addText( 'House:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $house[0]['name'].' ('.$towns_list[$player->getWorldId()][$house[0]['town']].')' )->setPosition( ); $i++;
}
/** GUILD **/
$rank = $player->getRank();
if ($rank->isLoaded())
{
$MadGD->addText( 'Guild membership:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $rank->getName().' of the '.$player->getRank()->getGuild()->getName() )->setPosition( ); $i++;
}
/** LAST LOGIN **/
$MadGD->addText( 'Last login:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( ( $player->getLastLogin() == 0 ? 'Never logged in' : date( 'M d Y, H:i:s T', $player->getLastLogin() ) ) )->setPosition( ); $i++;
/** ACCOUNT STATUS **/
$MadGD->addText( 'Account Status:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( ( $player->getAccount()->getPremDays() > 0 ? 'Premium Account' : 'Free Account' ) )->setPosition( ); $i++;
$MadGD->setDefaultStyle( SIGNATURES_FONTS.'arial.ttf', SIGNATURES_FONTS.'arialbd.ttf', 8 );
$MadGD->setEquipmentBackground( SIGNATURES_IMAGES.'equipments.png' );
$MadGD->addIcon( SIGNATURES_IMAGES.'bg.png' )->setPosition( 200, 45 );
$MadGD->addIcon( SIGNATURES_IMAGES.'bg.png' )->setPosition( 200, 54 );
$MadGD->addIcon( SIGNATURES_IMAGES.'bg.png' )->setPosition( 200, 63 );
/** NAME **/
$MadGD->addText( 'Name:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $player->getName(), ( $player->isOnline() ? array( 'color' => '5df82d' ) : array( ) ) )->setPosition( ); $i++;
/** SEX **/
$MadGD->addText( 'Sex:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$player_sex = 'unknown';
if(isset($config['genders'][$player->getSex()]))
$player_sex = strtolower($config['genders'][$player->getSex()]);
$MadGD->addText($player_sex)->setPosition( ); $i++;
/** PROFESSION **/
$MadGD->addText( 'Profession:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $config['vocations'][$player->getVocation()] )->setPosition( ); $i++;
/** LEVEL **/
$MadGD->addText( 'Level:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $player->getLevel() )->setPosition( ); $i++;
/** WORLD **/
if($config['multiworld']) {
$MadGD->addText( 'World:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $config['worlds'][$player->getWorldId()] )->setPosition( ); $i++;
}
/** RESIDENCE **/
$MadGD->addText( 'Residence:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $config['towns'][$player->getTownId()] )->setPosition( ); $i++;
/** HOUSE **/
$town = 'town';
if(fieldExist('town_id', 'houses'))
$town = 'town_id';
$house = $db->query( 'SELECT `houses`.`name`, `houses`.`' . $town . '` as town FROM `houses` WHERE `houses`.`owner` = '.$player->getId().';' )->fetchAll();
if ( count( $house ) != 0 )
{
$MadGD->addText( 'House:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $house[0]['name'].' ('.$towns_list[$player->getWorldId()][$house[0]['town']].')' )->setPosition( ); $i++;
}
/** GUILD **/
$rank = $player->getRank();
if ($rank->isLoaded())
{
$MadGD->addText( 'Guild membership:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( $rank->getName().' of the '.$player->getRank()->getGuild()->getName() )->setPosition( ); $i++;
}
/** LAST LOGIN **/
$MadGD->addText( 'Last login:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( ( $player->getLastLogin() == 0 ? 'Never logged in' : date( 'M d Y, H:i:s T', $player->getLastLogin() ) ) )->setPosition( ); $i++;
/** ACCOUNT STATUS **/
$MadGD->addText( 'Account Status:', $MadGD->textBold )->setPosition( 10, $i * $eachRow );
$MadGD->addText( ( $player->getAccount()->getPremDays() > 0 ? 'Premium Account' : 'Free Account' ) )->setPosition( ); $i++;
$MadGD->addIcon( SIGNATURES_IMAGES.'bg.png' )->setPosition( 200, 45 );
$MadGD->addIcon( SIGNATURES_IMAGES.'bg.png' )->setPosition( 200, 54 );
$MadGD->addIcon( SIGNATURES_IMAGES.'bg.png' )->setPosition( 200, 63 );
/** HEALTH BAR **/
$MadGD->addText( 'HP:', $percent )->setPosition( 182, 40 );
if ( ( $player->getHealth() > $player->getHealthMax() ) or ( $player->getHealth() > 0 and $player->getHealthMax() > 0 ) )
{
$MadGD->addIcon( SIGNATURES_IMAGES.'health.png', $player->getHealth() / $player->getHealthMax() * 100 )->setPosition( 201, 46 );
$MadGD->addText( floor( $player->getHealth() / $player->getHealthMax() * 100 ).'%', $percent )->setPosition( 305, 40 );
}
else
{
$MadGD->addIcon( SIGNATURES_IMAGES.'health.png', 100 )->setPosition( 201, 46 );
$MadGD->addText( '100%', $percent )->setPosition( 305, 40 );
}
/** MANA BAR **/
$MadGD->addText( 'MP:', $percent )->setPosition( 180, 50 );
if ( ( $player->getMana() > $player->getManaMax() ) or ( $player->getMana() > 0 and $player->getManaMax() > 0 ) )
{
$MadGD->addIcon( SIGNATURES_IMAGES.'mana.png', $player->getMana() / $player->getManaMax() * 100 )->setPosition( 201, 55 );
$MadGD->addText( floor( $player->getMana() / $player->getManaMax() * 100 ).'%', $percent )->setPosition( 305, 50 );
}
else
{
$MadGD->addIcon( SIGNATURES_IMAGES.'mana.png', 100 )->setPosition( 201, 55 );
$MadGD->addText( '100%', $percent )->setPosition( 305, 50 );
}
/** EXPERIENCE BAR **/
$MadGD->addText( 'EXP:', $percent )->setPosition( 176, 60 );
if ( $player->getExperience() > 0 and ( $player->getExperience() / getExpToLevel( $player->getLevel() + 1 ) * 100 ) <= 100 )
{
$MadGD->addIcon( SIGNATURES_IMAGES.'exp.png', $player->getExperience() / getExpToLevel( $player->getLevel() + 1 ) * 100 )->setPosition( 201, 64 );
$MadGD->addText( floor( $player->getExperience() / getExpToLevel( $player->getLevel() + 1 ) * 100 ).'%', $percent )->setPosition( 305, 60 );
}
else
{
$MadGD->addIcon( SIGNATURES_IMAGES.'exp.png', 100 )->setPosition( 201, 64 );
$MadGD->addText( '100%', $percent )->setPosition( 305, 60 );
}
$slots = array(
2 => array( $MadGD->equipment['x']['amulet'], $MadGD->equipment['y']['amulet'] ),
1 => array( $MadGD->equipment['x']['helmet'], $MadGD->equipment['y']['helmet'] ),
3 => array( $MadGD->equipment['x']['backpack'], $MadGD->equipment['y']['backpack'] ),
6 => array( $MadGD->equipment['x']['lefthand'], $MadGD->equipment['y']['lefthand'] ),
4 => array( $MadGD->equipment['x']['armor'], $MadGD->equipment['y']['armor'] ),
5 => array( $MadGD->equipment['x']['righthand'], $MadGD->equipment['y']['righthand'] ),
9 => array( $MadGD->equipment['x']['ring'], $MadGD->equipment['y']['ring'] ),
7 => array( $MadGD->equipment['x']['legs'], $MadGD->equipment['y']['legs'] ),
10 => array( $MadGD->equipment['x']['ammunition'], $MadGD->equipment['y']['ammunition'] ),
8 => array( $MadGD->equipment['x']['boots'], $MadGD->equipment['y']['boots'] )
);
foreach ( $slots as $pid => $position )
{
$item = $db->query( 'SELECT `itemtype`, `attributes` FROM `player_items` WHERE `player_items`.`player_id` = '.$player->getId().' AND `player_items`.`pid` = '.$pid.';' )->fetch();
if ( $item['itemtype'] != null )
{
$count = unpack( 'C*', $item['attributes'] );
if ( isset( $count[2] ) )
{
$count = $count[2];
}
else
{
$count = 1;
}
$imagePath = SIGNATURES_ITEMS . ( $count > 1 ? $item['itemtype'].'/'.$count : $item['itemtype'] ).'.gif';
//if ( !file_exists( $imagePath ) )
//{
// require(SYSTEM . 'item.php');
// generateItem($item['itemtype'], $count);
//}
if ( file_exists( $imagePath ) )
{
$MadGD->addIcon( $imagePath )->setPosition( $position[0], $position[1] );
}
else
{
$MadGD->addIcon( SIGNATURES_IMAGES.'noitem.png' )->setPosition( $position[0], $position[1] );
}
}
}
$MadGD->save($player->getID());
header( 'Content-type: image/png' );
readfile( SIGNATURES_CACHE.$player->getId().'.png' );
}
else
{
header( 'Content-type: image/png' );
readfile( SIGNATURES_IMAGES.'nobackground.png' );
}
}
/** HEALTH BAR **/
$MadGD->addText( 'HP:', $percent )->setPosition( 182, 40 );
if ( ( $player->getHealth() > $player->getHealthMax() ) or ( $player->getHealth() > 0 and $player->getHealthMax() > 0 ) )
{
$MadGD->addIcon( SIGNATURES_IMAGES.'health.png', $player->getHealth() / $player->getHealthMax() * 100 )->setPosition( 201, 46 );
$MadGD->addText( floor( $player->getHealth() / $player->getHealthMax() * 100 ).'%', $percent )->setPosition( 305, 40 );
}
else
{
header( 'Content-type: image/png' );
readfile( SIGNATURES_IMAGES.'nocharacter.png' );
$MadGD->addIcon( SIGNATURES_IMAGES.'health.png', 100 )->setPosition( 201, 46 );
$MadGD->addText( '100%', $percent )->setPosition( 305, 40 );
}
/** MANA BAR **/
$MadGD->addText( 'MP:', $percent )->setPosition( 180, 50 );
if ( ( $player->getMana() > $player->getManaMax() ) or ( $player->getMana() > 0 and $player->getManaMax() > 0 ) )
{
$MadGD->addIcon( SIGNATURES_IMAGES.'mana.png', $player->getMana() / $player->getManaMax() * 100 )->setPosition( 201, 55 );
$MadGD->addText( floor( $player->getMana() / $player->getManaMax() * 100 ).'%', $percent )->setPosition( 305, 50 );
}
else
{
$MadGD->addIcon( SIGNATURES_IMAGES.'mana.png', 100 )->setPosition( 201, 55 );
$MadGD->addText( '100%', $percent )->setPosition( 305, 50 );
}
/** EXPERIENCE BAR **/
$MadGD->addText( 'EXP:', $percent )->setPosition( 176, 60 );
if ( $player->getExperience() > 0 and ( $player->getExperience() / getExpToLevel( $player->getLevel() + 1 ) * 100 ) <= 100 )
{
$MadGD->addIcon( SIGNATURES_IMAGES.'exp.png', $player->getExperience() / getExpToLevel( $player->getLevel() + 1 ) * 100 )->setPosition( 201, 64 );
$MadGD->addText( floor( $player->getExperience() / getExpToLevel( $player->getLevel() + 1 ) * 100 ).'%', $percent )->setPosition( 305, 60 );
}
else
{
$MadGD->addIcon( SIGNATURES_IMAGES.'exp.png', 100 )->setPosition( 201, 64 );
$MadGD->addText( '100%', $percent )->setPosition( 305, 60 );
}
$slots = array(
2 => array( $MadGD->equipment['x']['amulet'], $MadGD->equipment['y']['amulet'] ),
1 => array( $MadGD->equipment['x']['helmet'], $MadGD->equipment['y']['helmet'] ),
3 => array( $MadGD->equipment['x']['backpack'], $MadGD->equipment['y']['backpack'] ),
6 => array( $MadGD->equipment['x']['lefthand'], $MadGD->equipment['y']['lefthand'] ),
4 => array( $MadGD->equipment['x']['armor'], $MadGD->equipment['y']['armor'] ),
5 => array( $MadGD->equipment['x']['righthand'], $MadGD->equipment['y']['righthand'] ),
9 => array( $MadGD->equipment['x']['ring'], $MadGD->equipment['y']['ring'] ),
7 => array( $MadGD->equipment['x']['legs'], $MadGD->equipment['y']['legs'] ),
10 => array( $MadGD->equipment['x']['ammunition'], $MadGD->equipment['y']['ammunition'] ),
8 => array( $MadGD->equipment['x']['boots'], $MadGD->equipment['y']['boots'] )
);
foreach ( $slots as $pid => $position )
{
$item = $db->query( 'SELECT `itemtype`, `attributes` FROM `player_items` WHERE `player_items`.`player_id` = '.$player->getId().' AND `player_items`.`pid` = '.$pid.';' )->fetch();
if ( $item['itemtype'] != null )
{
$count = unpack( 'C*', $item['attributes'] );
if ( isset( $count[2] ) ) {
$count = $count[2];
}
else {
$count = 1;
}
$imagePath = SIGNATURES_ITEMS . ( $count > 1 ? $item['itemtype'].'/'.$count : $item['itemtype'] ).'.gif';
//}
if ( file_exists( $imagePath ) ) {
$MadGD->addIcon( $imagePath )->setPosition( $position[0], $position[1] );
}
else {
$MadGD->addIcon( SIGNATURES_IMAGES.'noitem.png' )->setPosition( $position[0], $position[1] );
}
}
}
$MadGD->save($player->getID());
header( 'Content-type: image/png' );
readfile( SIGNATURES_CACHE . $player->getId().'.png' );
}
else
{
header( 'Content-type: image/png' );
readfile( SIGNATURES_IMAGES.'nogd.png' );
readfile( SIGNATURES_IMAGES . 'nobackground.png' );
}
?>

View File

@ -1,160 +1,133 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
define('FONTS', TOOLS . 'signature/fonts/');
putenv('GDFONTPATH=' . FONTS);
$img = imagecreatefrompng(SIGNATURES_IMAGES . 'stats.png');
if(!$img) {
die('Error while using function imagecreatefrompng. Maybe you got php extension xdebug loaded?');
}
$font = FONTS . "arialbd.ttf";
$font = SIGNATURES_FONTS . "arialbd.ttf";
$fontsize = 8;
$name = stripslashes(ucwords(strtolower(trim($_REQUEST['name']))));
if(!check_name($name))
return;
$title = imagecolorallocate($img, 160, 160, 160);
$text = imagecolorallocate($img, 180, 180, 180);
$bar = imagecolorallocate($img, 0, 0, 0);
$barfill = imagecolorallocate($img, 200, 0, 0);
$hpfill = imagecolorallocate($img, 200, 0, 0);
$manafill = imagecolorallocate($img, 0, 0, 200);
$player = $ots->createObject('Player');
$player->find($name);
imagettftext($img, $fontsize, 0, 20, 11, $title, $font, $player->getName() . ' - ' . BASE_URL);
if(!$player->isLoaded())
{
header('Content-type: image/png');
readfile(SIGNATURES_IMAGES.'nocharacter.png');
}
// experience
$needexp = OTS_Toolbox::experienceForLevel($player->getLevel() + 1);
$experience = $player->getExperience();
if($experience > $needexp) $experience = $needexp;
imagettftext($img, $fontsize, 0, 15, 30, $text, $font, 'Experience');
imagettftext($img, $fontsize, 0, 100, 30, $text, $font, number_format($experience)." (".number_format($needexp).")");
// level
imagettftext($img, $fontsize, 0, 15, 43, $text, $font, 'Level');
imagettftext($img, $fontsize, 0, 100, 43, $text, $font, number_format($player->getLevel()));
// experience bar
$exppercent = round($experience / $needexp * 100);
imagerectangle($img, 14, 46, 166, 50, $bar);
if($exppercent > 0)
imagefilledrectangle($img, 15, 47, $exppercent * 1.5 + 15, 49, $barfill);
imagettftext($img, $fontsize, 0, 170, 51, $text, $font, $exppercent . '%');
// vocation
$vocation = 'Unknown';
if(isset($config['vocations'][$player->getVocation()]))
$vocation = $config['vocations'][$player->getVocation()];
if(!function_exists( 'imagecreatefrompng'))
{
header('Content-type: image/png');
readfile(SIGNATURES_IMAGES.'nogd.png');
}
$file = SIGNATURES_CACHE.$player->getId().'.png';
if ( file_exists( $file ) and ( time( ) < ( filemtime($file) + ( 60 * $config['signature_cache_time'] ) ) ) )
{
header( 'Content-type: image/png' );
readfile( SIGNATURES_CACHE.$player->getId().'.png' );
}
else
{
$img = imagecreatefrompng(SIGNATURES_IMAGES . 'stats.png');
if(!$img)
{
echo 'Error while using function imagecreatefrompng. Maybe you got php extension xdebug loaded?';
die();
}
$title = imagecolorallocate($img, 160, 160, 160);
$text = imagecolorallocate($img, 180, 180, 180);
$bar = imagecolorallocate($img, 0, 0, 0);
$barfill = imagecolorallocate($img, 200, 0, 0);
$hpfill = imagecolorallocate($img, 200, 0, 0);
$manafill = imagecolorallocate($img, 0, 0, 200);
imagettftext($img, $fontsize, 0, 15, 62, $text, $font, 'Vocation');
imagettftext($img, $fontsize, 0, 100, 62, $text, $font, $vocation);
imagettftext($img, $fontsize, 0, 20, 11, $title, $font, $player->getName() . ' - ' . BASE_URL);
// hit points, Mana, Soul Points, Capacity
$health = $player->getHealth();
if($health > $player->getHealthMax())
$health = $player->getHealthMax();
// experience
$needexp = OTS_Toolbox::experienceForLevel($player->getLevel() + 1);
$experience = $player->getExperience();
if($experience > $needexp) $experience = $needexp;
imagettftext($img, $fontsize, 0, 15, 30, $text, $font, 'Experience');
imagettftext($img, $fontsize, 0, 100, 30, $text, $font, number_format($experience)." (".number_format($needexp).")");
$empty = imagecreatefrompng('images/empty.png');
//imagerectangle($img, 39, 67, 141, 75, $bar);
$fillhp = round($player->getHealth()/$player->getHealthMax() * 100);
//imagefilledrectangle($img, 40, 68, 40+$fillhp, 74, $hpfill);
$healthicon = imagecreatefrompng('images/hpicon.png');
imagecopy($img, $healthicon, 15, 65, 0, 0, 12, 12);
$healthfg = imagecreatefrompng('images/healthfull.png');
imagecopy($img, $empty, 32, 65, 0, 0, 100, 12);
imagecopy($img, $healthfg, 32, 65, 0, 0, $fillhp, 12);
//imagettftext($img, $fontsize, 0, 15, 75, $text, $font, "Hit Points");
imagettftext($img, $fontsize, 0, 140, 75, $text, $font, $player->getHealth());
// level
imagettftext($img, $fontsize, 0, 15, 43, $text, $font, 'Level');
imagettftext($img, $fontsize, 0, 100, 43, $text, $font, number_format($player->getLevel()));
//imagerectangle($img, 39, 80, 141, 88, $bar);
$mana = $player->getMana();
if($mana > $player->getManaMax())
$mana = $player->getManaMax();
// experience bar
$exppercent = round($experience / $needexp * 100);
imagerectangle($img, 14, 46, 166, 50, $bar);
if($exppercent > 0)
imagefilledrectangle($img, 15, 47, $exppercent * 1.5 + 15, 49, $barfill);
$fillmana = 0;
if($player->getMana() > 0 && $player->getManaMax() > 0)
$fillmana = round($player->getMana()/$player->getManaMax() * 100);
imagettftext($img, $fontsize, 0, 170, 51, $text, $font, $exppercent . '%');
//imagefilledrectangle($img, 40, 81, 40+$fillmana, 87, $manafill);
$manaicon = imagecreatefrompng('images/manaicon.png');
imagecopy($img, $manaicon, 15, 79, 0, 0, 12, 10);
$manafg = imagecreatefrompng('images/manafull.png');
imagecopy($img, $empty, 32, 78, 0, 0, 100, 12);
imagecopy($img, $manafg, 32, 78, 0, 0, $fillmana, 12);
//imagettftext($img, $fontsize, 0, 15, 88, $text, $font, "Mana");
imagettftext($img, $fontsize, 0, 140, 88, $text, $font, $player->getMana());
// vocation
imagettftext($img, $fontsize, 0, 15, 62, $text, $font, 'Vocation');
imagettftext($img, $fontsize, 0, 100, 62, $text, $font, $config['vocations'][$player->getVocation()]);
imagettftext($img, $fontsize, 0, 15, 101, $text, $font, 'Soul Points');
imagettftext($img, $fontsize, 0, 100, 101, $text, $font, number_format($player->getSoul()));
imagettftext($img, $fontsize, 0, 15, 114, $text, $font, 'Capacity');
imagettftext($img, $fontsize, 0, 100, 114, $text, $font, number_format($player->getCap()));
// hit points, Mana, Soul Points, Capacity
$health = $player->getHealth();
if($health > $player->getHealthMax())
$health = $player->getHealthMax();
// magic Level
imagettftext($img, $fontsize, 0, 15, 127, $text, $font, 'Magic Level');
imagettftext($img, $fontsize, 0, 100, 127, $text, $font, number_format($player->getMagLevel()));
$empty = imagecreatefrompng('images/empty.png');
//imagerectangle($img, 39, 67, 141, 75, $bar);
$fillhp = round($player->getHealth()/$player->getHealthMax() * 100);
//imagefilledrectangle($img, 40, 68, 40+$fillhp, 74, $hpfill);
$healthicon = imagecreatefrompng('images/hpicon.png');
imagecopy($img, $healthicon, 15, 65, 0, 0, 12, 12);
$healthfg = imagecreatefrompng('images/healthfull.png');
imagecopy($img, $empty, 32, 65, 0, 0, 100, 12);
imagecopy($img, $healthfg, 32, 65, 0, 0, $fillhp, 12);
//imagettftext($img, $fontsize, 0, 15, 75, $text, $font, "Hit Points");
imagettftext($img, $fontsize, 0, 140, 75, $text, $font, $player->getHealth());
// premium status
$account = $player->getAccount();
imagettftext($img, $fontsize, 0, 15, 140, $text, $font, $account->getPremDays() > 0 ? 'Premium Account': 'Free Account');
//imagerectangle($img, 39, 80, 141, 88, $bar);
$mana = $player->getMana();
if($mana > $player->getManaMax())
$mana = $player->getManaMax();
$fillmana = 0;
if($player->getMana() > 0 && $player->getManaMax() > 0)
$fillmana = round($player->getMana()/$player->getManaMax() * 100);
//imagefilledrectangle($img, 40, 81, 40+$fillmana, 87, $manafill);
$manaicon = imagecreatefrompng('images/manaicon.png');
imagecopy($img, $manaicon, 15, 79, 0, 0, 12, 10);
$manafg = imagecreatefrompng('images/manafull.png');
imagecopy($img, $empty, 32, 78, 0, 0, 100, 12);
imagecopy($img, $manafg, 32, 78, 0, 0, $fillmana, 12);
//imagettftext($img, $fontsize, 0, 15, 88, $text, $font, "Mana");
imagettftext($img, $fontsize, 0, 140, 88, $text, $font, $player->getMana());
imagettftext($img, $fontsize, 0, 15, 101, $text, $font, 'Soul Points');
imagettftext($img, $fontsize, 0, 100, 101, $text, $font, number_format($player->getSoul()));
imagettftext($img, $fontsize, 0, 15, 114, $text, $font, 'Capacity');
imagettftext($img, $fontsize, 0, 100, 114, $text, $font, number_format($player->getCap()));
// magic Level
imagettftext($img, $fontsize, 0, 15, 127, $text, $font, 'Magic Level');
imagettftext($img, $fontsize, 0, 100, 127, $text, $font, number_format($player->getMagLevel()));
// premium status
$account = $player->getAccount();
imagettftext($img, $fontsize, 0, 15, 140, $text, $font, $account->getPremDays() > 0 ? 'Premium Account': 'Free Account');
imagefilledrectangle($img, 225, 40, 225, 130, $title); //seperator
$posy = 50;
imagefilledrectangle($img, 225, 40, 225, 130, $title); //seperator
$posy = 50;
if(fieldExist('skill_fist', 'players')) {// tfs 1.0+
$skills_db = $db->query('SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch();
if(fieldExist('skill_fist', 'players')) {// tfs 1.0+
$skills_db = $db->query('SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch();
$skill_ids = array(
POT::SKILL_FIST => 'skill_fist',
POT::SKILL_CLUB => 'skill_club',
POT::SKILL_SWORD => 'skill_sword',
POT::SKILL_AXE => 'skill_axe',
POT::SKILL_DIST => 'skill_dist',
POT::SKILL_SHIELD => 'skill_shielding',
POT::SKILL_FISH => 'skill_fishing',
);
$skills = array();
foreach($skill_ids as $skillid => $field_name) {
$skills[] = array('skillid' => $skillid, 'value' => $skills_db[$field_name]);
}
}
else {
$skills = $db->query('SELECT ' . $db->fieldName('skillid') . ', ' . $db->fieldName('value') . ' FROM ' . $db->tableName('player_skills') . ' WHERE ' . $db->fieldName('player_id') . ' = ' . $player->getId() . ' LIMIT 7');
}
foreach($skills as $skill)
{
imagettftext($img, $fontsize, 0, 235, $posy, $text, $font, getSkillName($skill['skillid']));
imagettftext($img, $fontsize, 0, 360, $posy, $text, $font, $skill['value']);
$posy = $posy + 13;
}
imagepng($img, SIGNATURES_CACHE . $player->getID() . '.png');
imagedestroy($img);
$skill_ids = array(
POT::SKILL_FIST => 'skill_fist',
POT::SKILL_CLUB => 'skill_club',
POT::SKILL_SWORD => 'skill_sword',
POT::SKILL_AXE => 'skill_axe',
POT::SKILL_DIST => 'skill_dist',
POT::SKILL_SHIELD => 'skill_shielding',
POT::SKILL_FISH => 'skill_fishing',
);
header('Content-type: image/png');
readfile(SIGNATURES_CACHE.$player->getId() . '.png' );
$skills = array();
foreach($skill_ids as $skillid => $field_name) {
$skills[] = array('skillid' => $skillid, 'value' => $skills_db[$field_name]);
}
}
else {
$skills = $db->query('SELECT ' . $db->fieldName('skillid') . ', ' . $db->fieldName('value') . ' FROM ' . $db->tableName('player_skills') . ' WHERE ' . $db->fieldName('player_id') . ' = ' . $player->getId() . ' LIMIT 7');
}
foreach($skills as $skill)
{
imagettftext($img, $fontsize, 0, 235, $posy, $text, $font, getSkillName($skill['skillid']));
imagettftext($img, $fontsize, 0, 360, $posy, $text, $font, $skill['value']);
$posy = $posy + 13;
}
imagepng($img, SIGNATURES_CACHE . $player->getID() . '.png');
imagedestroy($img);
header('Content-type: image/png');
readfile(SIGNATURES_CACHE.$player->getId() . '.png' );
?>