* moved some more pages to twig

* moved online, movies, google_analytics code, faq, experience_table, downloads to twig
* added new global variabl to twig (status)
* removed some unused page (custom.php)
* automatically append trailing slash at config.item_images_url
* moved downloads from clients.halfaway.net to tibia-clients.com
* show some more info on monster loot (currently only on TFS 0.3 and those that use item.id in monster files instead of item name)
* some more unimportant fixes
This commit is contained in:
slawkens
2017-10-04 17:49:54 +02:00
parent e94b9006e6
commit b6ccde075d
24 changed files with 327 additions and 351 deletions

View File

@@ -56,7 +56,7 @@ $name = str_replace('/', '', $name);
$oldName = '';
$player = $ots->createObject('Player');
$player = new OTS_Player();
$player->find($name);
if(!$player->isLoaded())
{

View File

@@ -43,15 +43,16 @@ function printLoot($level, $itemid, $count, $chance)
$chance *= $lootRate;
}
foreach($rarity as $lootRarity => $percent){
if($chance >= $percent)
{
//echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> ' . $itemid . ' <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br />';
foreach($rarity as $lootRarity => $percent) {
if($chance >= $percent) {
if(isset($itemid))
echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> ' . $itemid . ' <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br />';
if($i % 6 == 0)
{
if($i != 0)
echo '</td></tr>';
echo '<tr BGCOLOR="'.getStyle(0).'"><td width="100">';
echo '<tr bgcolor="'.getStyle(0).'"><td width="100">';
}
echo getItemImage($itemid);
$i++;

View File

@@ -1,28 +0,0 @@
<?php
/**
* Custom pages loader
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.4.2
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$query = $db->query('SELECT `title`, `body`, `php` FROM `' . TABLE_PREFIX . 'pages` WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1');
if($query->rowCount() > 0) // found page
{
$query = $query->fetch();
$title = $query['title'];
if($query['php'] == '1') // execute it as php code
eval($query['body']);
else
echo $query['body']; // plain html
return true;
}
return false;
?>

View File

@@ -3,21 +3,12 @@
* Downloads
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.4.2
* @link http://my-aac.org
*/
$title = 'Downloads';
?>
<br/><br/>
<center>
We're using official Tibia Client <strong><?php echo $config['client'] / 100; ?></strong><br/>
<p>Download Tibia client <?php echo ($config['client'] / 100); ?> for windows <a href="<?php echo $config['client_download']; ?>">HERE</a>.</p>
<p>Download Tibia client <?php echo ($config['client'] / 100); ?> for linux <a href="<?php echo $config['client_download_linux']; ?>">HERE</a>.</p>
<h2>IP Changer:</h2>
<a href="https://static.otland.net/ipchanger.exe" target="_blank">HERE</a>
</center>
echo $twig->render('downloads.html.twig');
?>

View File

@@ -3,7 +3,6 @@
* Experience table
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.4.2
@@ -11,42 +10,16 @@
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Experience Table';
?>
This is a list of the experience points that are required to advance to the various levels.
Remember you can also check the respective skill bar in your skill window of the client to check your progress towards the next level.<br/><br/>
<table bgcolor="<?php echo $config['darkborder']; ?>" border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white" colspan="5"><b>Experience Table</b></td>
</tr>
<tr>
<?php
$columns = $config['experiencetable_columns'];
for($i = 0; $i < $columns; $i++)
{
?>
<td>
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr bgcolor="<?php echo $config['lightborder']; ?>">
<td><b>Level</b></td>
<td><b>Experience</b></td>
</tr>
<?php
for($level = $i * $config['experiencetable_rows'] + 1; $level < $i * $config['experiencetable_rows'] + ($config['experiencetable_rows'] + 1); $level++)
{
?>
<tr bgcolor="<?php echo $config['lightborder']; ?>">
<td><?php echo $level; ?></td>
<td><?php echo OTS_Toolbox::experienceForLevel($level); ?></td>
</tr>
<?php
}
?>
</table>
</td>
<?php
$experience = array();
$columns = $config['experiencetable_columns'];
for($i = 0; $i < $columns; $i++) {
for($level = $i * $config['experiencetable_rows'] + 1; $level < $i * $config['experiencetable_rows'] + ($config['experiencetable_rows'] + 1); $level++) {
$experience[$level] = OTS_Toolbox::experienceForLevel($level);
}
}
echo $twig->render('experience_table.html.twig', array(
'experience' => $experience
));
?>
</tr>
</table>

View File

@@ -20,47 +20,10 @@ if(!$faqs->rowCount())
There are no questions added yet.
<?php
if(admin())
echo ' You can add new faq questions in phpmyadmin under ' . TABLE_PREFIX . 'faq table.';
echo ' You can add new faq questions in phpmyadmin under <b>' . TABLE_PREFIX . 'faq</b> table.';
}
echo $twig->render('faq.html.twig', array(
'faqs' => $faqs
));
?>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white">
<b>FAQ</b>
</td>
<td align="right">
<a href="#" onclick="toggleAll(); return false;">Toggle all</a>
</td>
</tr>
<?php
$i = 0;
foreach($faqs as $faq): ?>
<tr bgcolor="<?php echo getStyle(++$i); ?>">
<td colspan="2" style="cursor: pointer;" onclick="toggleVisibility('faq_<?php echo $i; ?>'); return false;">
<b><?php echo $faq['question']; ?></b>
<div id="faq_<?php echo $i; ?>" style="display: none;"><?php echo $faq['answer']; ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<script type="text/javascript">
var expanded = false;
function toggleVisibility(id)
{
var tmp = document.getElementById(id);
if(tmp)
tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
}
function toggleAll()
{
for(i = 1; i < <?php echo $i + 1; ?>; i++)
{
document.getElementById('faq_' + i).style.display = expanded ? 'none' : '';
}
expanded = !expanded;
}
</script>

View File

@@ -21,11 +21,8 @@ There are no movies added yet.
echo ' You can add new movies in phpmyadmin under ' . TABLE_PREFIX . 'movies table.';
return;
}
echo $twig->render('movies.html.twig', array(
'movies' => $movies
));
?>
<div style="text-align: center;">
<?php foreach($movies as $movie): ?>
<?php echo $movie['title']; ?><br/>
Author: <?php echo $movie['author']; ?><br/>
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php echo $movie['youtube_id']; ?>" frameborder="0" allowfullscreen></iframe><br/><br/>
<?php endforeach; ?>
</div>

View File

@@ -14,13 +14,7 @@ $title = 'Who is online?';
if($config['account_country'])
require(SYSTEM . 'countries.conf.php');
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white"><b>Server Status</b></td>
</tr>
<?php
$promotion = '';
if(fieldExist('promotion', 'players'))
$promotion = '`promotion`,';
@@ -63,6 +57,7 @@ if(tableExist('players_online')) // tfs 1.0
else
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
$players_data = array();
$players = 0;
$data = '';
foreach($playersOnline as $player)
@@ -70,202 +65,91 @@ foreach($playersOnline as $player)
$skull = '';
if($config['online_skulls'])
{
if($player['skulltime'] > 0 && $player['skull'] == 3)
$skull = ' <img style="border: 0;" src="images/white_skull.gif"/>';
elseif($player['skulltime'] > 0 && $player['skull'] == 4)
$skull = ' <img style="border: 0;" src="images/red_skull.gif"/>';
elseif($player['skulltime'] > 0 && $player['skull'] == 5)
$skull = ' <img style="border: 0;" src="images/black_skull.gif"/>';
if($player['skulltime'] > 0)
{
if($player['skull'] == 3)
$skull = ' <img style="border: 0;" src="images/white_skull.gif"/>';
elseif($player['skull'] == 4)
$skull = ' <img style="border: 0;" src="images/red_skull.gif"/>';
elseif($player['skull'] == 5)
$skull = ' <img style="border: 0;" src="images/black_skull.gif"/>';
}
}
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0)
$player['vocation'] += ($player['promotion'] * $config['vocations_amount']);
}
$data .= '<tr bgcolor="' . getStyle(++$players) . '">';
if($config['account_country'])
$data .= '<td>' . getFlagImage($player['country']) . '</td>';
if($config['online_outfit'])
$data .= '<TD WIDTH=5%><img style="position:absolute;margin-top:' . (in_array($player['looktype'], array(75, 266, 302)) ? '-20px;margin-left:-0px;' : '-45px;margin-left:-25px;') . '" src="' . $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" /></td>';
$data .= '<td>' . getPlayerLink($player['name']) . $skull . '</td>
<td>'.$player['level'].'</td>
<td>'.$config['vocations'][$player['vocation']].'</td>
</tr>';
$players_data[] = array(
'name' => getPlayerLink($player['name']),
'player' => $player,
'level' => $player['level'],
'vocation' => $config['vocations'][$player['vocation']],
'country_image' => $config['account_country'] ? getFlagImage($player['country']) : null,
'outfit' => $config['online_outfit'] ? $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] : null
);
if($config['online_vocations'])
$vocs[($player['vocation'] > $config['vocations_amount'] ? $player['vocation'] - $config['vocations_amount'] : $player['vocation'])]++;
}
if(!$players): ?>
<tr bgcolor="<?php echo $config['darkborder']; ?>"><td>Currently no one is playing on <?php echo $config['lua']['serverName']; ?>.</td></tr></table>
<?php else:
?>
<tr bgcolor="<?php echo $config['darkborder']; ?>">
<td>
<?php
if(!$status['online'])
echo 'Server is offline.<br/>';
else
{
if($config['online_afk'])
{
$afk = $players - $status['players'];
if($afk < 0) {
$players += abs($afk);
$afk = 0;
}
?>
Currently there are <b><?php echo $status['players']; ?></b> active and <b><?php echo $afk ?></b> AFK players.<br/>
Total number of players: <b><?php echo $players; ?></b>.<br/>
<?php
}
else
echo 'Currently ' . $players . ' players are online.<br/>';
}
if($config['online_record'])
{
$timestamp = false;
if(tableExist('server_record')) {
$record = '';
if($players > 0)
{
if($config['online_record'])
{
$timestamp = false;
if(tableExist('server_record')) {
$query =
$db->query(
'SELECT ' . $db->fieldName('record') . ', ' . $db->fieldName('timestamp') .
' FROM ' . $db->tableName('server_record') .
' WHERE ' . $db->fieldName('world_id') . ' = ' . (int)$config['lua']['worldId'] .
' ORDER BY ' . $db->fieldName('record') . ' DESC LIMIT 1');
$timestamp = true;
}
else if(tableExist('server_config')) { // tfs 1.0
$query = $db->query('SELECT `value` as `record` FROM `server_config` WHERE `config` = ' . $db->quote('players_record'));
}
else
$query = NULL;
if(isset($query) && $query->rowCount() > 0)
{
$result = $query->fetch();
echo 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');
}
'SELECT `record`, `timestamp` FROM `server_record` WHERE `world_id` = ' . (int)$config['lua']['worldId'] .
' ORDER BY `record` DESC LIMIT 1');
$timestamp = true;
}
?>
</td>
</tr>
</table>
else if(tableExist('server_config')) { // tfs 1.0
$query = $db->query('SELECT `value` as `record` FROM `server_config` WHERE `config` = ' . $db->quote('players_record'));
}
else
$query = NULL;
if(isset($query) && $query->rowCount() > 0)
{
$result = $query->fetch();
$record = 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');
}
}
}
<?php
// vocation statistics
if($config['online_vocations']): ?>
<br/>
<?php if($config['online_vocations_images']): ?>
<table width="200" cellspacing="1" cellpadding="0" border="0" align="center">
<tr bgcolor="<?php echo $config['darkborder']; ?>">
<td><img src="images/sorcerer.png" /></td>
<td><img src="images/druid.png" /></td>
<td><img src="images/palladin.png" /></td>
<td><img src="images/knight.png" /></td>
</tr>
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white" style="text-align: center;"><strong>Sorcerers<br /></strong></td>
<td class="white" style="text-align: center;"><strong>Druids</strong></td>
<td class="white" style="text-align: center;"><strong>Paladins</strong></td>
<td class="white" style="text-align: center;"><strong>Knights</strong></td>
</tr>
<tr bgcolor="<?php echo $config['lightborder']; ?>">
<td style="text-align: center;"><?php echo $vocs[1]; ?></td>
<td style="text-align: center;"><?php echo $vocs[2]; ?></td>
<td style="text-align: center;"><?php echo $vocs[3]; ?></td>
<td style="text-align: center;"><?php echo $vocs[4]; ?></td>
</tr>
</table>
<div style="text-align: center;">&nbsp;</div>
<?php else: ?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white" colspan="2"><b>Vocation statistics</b></td>
</tr>
<?php
for($i = 1; $i <= $config['vocations_amount']; $i++)
echo '<tr bgcolor="' . getStyle($i) . '">
<td width="25%">' . $config['vocations'][$i] . '</td>
<td width="75%">' . $vocs[$i] . '</td>
</tr>';
?>
</table><br/>
<?php endif;
endif;
// frags counter
if($config['online_skulls']): ?>
<table width="100%" cellspacing="1">
<tr>
<td style="background: <?php echo $config['darkborder']; ?>;" align="center">
<img src="images/white_skull.gif"/> - 1 - 6 Frags<br/>
<img src="images/red_skull.gif"/> - 6+ Frags or Red Skull<br/>
<img src="images/black_skull.gif"/> - 10+ Frags or Black Skull
</td>
</tr>
</table>
<?php endif; ?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<?php if($config['account_country']): ?>
<td width="11px"><a href="?subtopic=online&order=country" class="white">#</A></td>
<?php endif; ?>
<?php if($config['online_outfit']): ?>
<td class="white"><b>Outfit</b></td>
<?php endif; ?>
<td width="60%"><a href="?subtopic=online&order=name" class="white">Name</A></td>
<td width="20%"><a href="?subtopic=online&order=level" class="white">Level</A></td>
<td width="20%"><a href="?subtopic=online&order=vocation" class="white">Vocation</td>
</tr>
<?php echo $data; ?>
</table>
<?php
endif;
echo $twig->render('online.html.twig', array(
'players' => $players_data,
'record' => $record
));
//search bar
echo '<br/>
<FORM ACTION="?subtopic=characters" METHOD=post>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR>
<TD BGCOLOR="'.$config['vdarkborder'].'" class="white">
<B>Search Character</B>
</TD>
</TR>
<TR>
<TD BGCOLOR="'.$config['darkborder'].'">
<TABLE BORDER=0 CELLPADDING=1>
<TR>
<TD>Name:</TD>
<TD>
<INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29>
</TD>
<TD>
<INPUT TYPE=image NAME="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</FORM>';
/* temporary disable it - shows server offline
// update online players counter
if($players > 0)
{
$status['players'] = $players;
if($cache->enabled())
$cache->set('status', serialize($status));
else
{
foreach($status as $key => $value)
updateDatabaseConfig('serverStatus_' . $key, $value);
}
}*/
<form action="?subtopic=characters" method=post>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td bgcolor="'.$config['vdarkborder'].'" class="white">
<b>Search Character</b>
</td>
</tr>
<tr>
<td bgcolor="'.$config['darkborder'].'">
<table border=0 cellpadding=1>
<tr>
<td>Name:</td>
<td>
<input name="name" value=""size=29 maxlength=29>
</td>
<td>
<input type="image" name="Submit" src="'.$template_path.'/images/buttons/sbutton_submit.gif" border="0" width="120" height="18">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>';
?>