Moved serverinfo to twig

This commit is contained in:
whiteblXK 2019-04-15 18:14:17 +02:00
parent 8c50a84516
commit 13199744ef
2 changed files with 195 additions and 172 deletions

View File

@ -5,184 +5,105 @@
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @author whiteblXK
* @copyright 2019 MyAAC
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Server info';
if(isset($config['lua']['experience_stages']))
$config['lua']['experienceStages'] = $config['lua']['experience_stages'];
$config['lua']['experienceStages'] = $config['lua']['experience_stages'];
if(isset($config['lua']['min_pvp_level']))
$config['lua']['protectionLevel'] = $config['lua']['min_pvp_level'];
$rent = trim(strtolower($config['lua']['houseRentPeriod']));
if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily')
$rent = 'never';
if(isset($config['lua']['houseCleanOld']))
$cleanOld = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
if(isset($config['lua']['rate_exp']))
$config['lua']['rateExp'] = $config['lua']['rate_exp'];
if(isset($config['lua']['rateExperience']))
$config['lua']['rateExp'] = $config['lua']['rateExperience'];
if(isset($config['lua']['rate_mag']))
$config['lua']['rateMagic'] = $config['lua']['rate_mag'];
if(isset($config['lua']['rate_skill']))
$config['lua']['rateSkill'] = $config['lua']['rate_skill'];
if(isset($config['lua']['rate_loot']))
$config['lua']['rateLoot'] = $config['lua']['rate_loot'];
if(isset($config['lua']['rate_spawn']))
$config['lua']['rateSpawn'] = $config['lua']['rate_spawn'];
$house_level = NULL;
if(isset($config['lua']['levelToBuyHouse']))
$house_level = $config['lua']['levelToBuyHouse'];
else if(isset($config['lua']['house_level']))
$house_level = $config['lua']['house_level'];
if(isset($config['lua']['in_fight_duration']))
$config['lua']['pzLocked'] = $config['lua']['in_fight_duration'];
$pzLocked = eval('return ' . $config['lua']['pzLocked'] . ';');
$whiteSkullTime = isset($config['lua']['whiteSkullTime']) ? $config['lua']['whiteSkullTime'] : NULL;
if(!isset($whiteSkullTime) && isset($config['lua']['unjust_skull_duration']))
$whiteSkullTime = $config['lua']['unjust_skull_duration'];
if(isset($whiteSkullTime))
$whiteSkullTime = eval('return ' . $whiteSkullTime . ';');
$redSkullLength = isset($config['lua']['redSkullLength']) ? $config['lua']['redSkullLength'] : NULL;
if(!isset($redSkullLength) && isset($config['lua']['red_skull_duration']))
$redSkullLength = $config['lua']['red_skull_duration'];
if(isset($redSkullLength))
$redSkullLength = eval('return ' . $redSkullLength . ';');
$blackSkull = false;
$blackSkullLength = NULL;
if(isset($config['lua']['useBlackSkull']) && getBoolean($config['lua']['useBlackSkull']))
{
$blackSkullLength = $config['lua']['blackSkullLength'];
$blackSkull = true;
}
else if(isset($config['lua']['black_skull_duration'])) {
$blackSkullLength = eval('return ' . $config['lua']['blackSkullLength'] . ';');
$blackSkull = true;
}
$twig->display('serverinfo.html.twig', array(
'experienceStages' => isset($config['lua']['experienceStages']) && getBoolean($config['lua']['experienceStages']) ? $config['lua']['experienceStages'] : null,
'serverIp' => str_replace('/', '', str_replace('http://', '', $config['lua']['url'])),
'clientVersion' => isset($status['online']) ? $status['clientVersion'] : null,
'globalSaveHour' => isset($config['lua']['globalSaveEnabled']) && getBoolean($config['lua']['globalSaveEnabled']) ? $config['lua']['globalSaveHour'] : null,
'protectionLevel' => $config['lua']['protectionLevel'],
'houseRent' => $rent == 'never' ? 'disabled' : $rent,
'houseOld' => isset($cleanOld) ? $cleanOld : null,
'rateExp' => $config['lua']['rateExp'],
'rateExpFromPlayers' => isset($config['lua']['rateExperienceFromPlayers']) ? $config['lua']['rateExperienceFromPlayers'] : null,
'rateMagic' => $config['lua']['rateMagic'],
'rateSkill' => $config['lua']['rateSkill'],
'rateLoot' => $config['lua']['rateLoot'],
'rateSpawn' => $config['lua']['rateSpawn'],
'houseLevel' => $house_level,
'pzLocked' => $pzLocked,
'whiteSkullTime' => $whiteSkullTime,
'redSkullLength' => $redSkullLength,
'blackSkull' => $blackSkull,
'blackSkullLength' => $blackSkullLength,
'dailyFragsToRedSkull' => isset($config['lua']['dailyFragsToRedSkull']) ? $config['lua']['dailyFragsToRedSkull'] : $config['lua']['kills_per_day_red_skull'],
'weeklyFragsToRedSkull' => isset($config['lua']['weeklyFragsToRedSkull']) ? $config['lua']['weeklyFragsToRedSkull'] : $config['lua']['kills_per_week_red_skull'],
'monthlyFragsToRedSkull' => isset($config['lua']['monthlyFragsToRedSkull']) ? $config['lua']['monthlyFragsToRedSkull'] : $config['lua']['kills_per_month_red_skull'],
'dailyFragsToBlackSkull' => isset($config['lua']['dailyFragsToBlackSkull']) ? $config['lua']['dailyFragsToBlackSkull'] : $config['lua']['kills_per_day_black_skull'],
'weeklyFragsToBlackSkull' => isset($config['lua']['weeklyFragsToBlackSkull']) ? $config['lua']['weeklyFragsToBlackSkull'] : $config['lua']['kills_per_week_black_skull'],
'monthlyFragsToBlackSkull' => isset($config['lua']['monthlyFragsToBlackSkull']) ? $config['lua']['monthlyFragsToBlackSkull'] : $config['lua']['kills_per_month_black_skull'],
'banishmentLength' => isset($config['lua']['banishment_length']) ? eval('return (' . $config['lua']['banishment_length'] . ') / (24 * 60 * 60);') : null,
'finalBanishmentLength' => isset($config['lua']['final_banishment_length']) ? eval('return (' . $config['lua']['final_banishment_length'] . ') / (24 * 60 * 60);') : null,
'ipBanishmentLength' => isset($config['lua']['ip_banishment_length']) ? eval('return (' . $config['lua']['ip_banishment_length'] . ') / (24 * 60 * 60);') : null,
));
?>
<div style="text-align:center">
<h1><?php echo $config['lua']['serverName']; ?></h1>
<h3>
<?php if(isset($config['lua']['experienceStages']) && getBoolean($config['lua']['experienceStages'])): ?>
Experience stages: <a href="<?php echo getLink('experienceStages'); ?>">Look here</a><br/>
<?php endif; ?>
Commands: <a href="<?php echo getLink('commands'); ?>">Look here</a><br/>
Team: <a href="<?php echo getLink('team'); ?>">Look here</a><br/>
</h3>
</div>
<ul>
<h2>Server Info:</h2>
<li>IP: <b><?php echo str_replace('/', '', str_replace('http://', '', $config['lua']['url'])); ?></b> (Port: <b><?php echo $config['lua']['loginPort']; ?></b>)</li>
<?php
if($status['online'])
echo '<li>Client: <b>' . $status['clientVersion'] . '</b></li>';
?>
<li>Online: <b>24/7</b></li>
<?php
if(isset($config['lua']['globalSaveEnabled']) && getBoolean($config['lua']['globalSaveEnabled']))
echo '<li>Global save: <b>' . $config['lua']['globalSaveHour'] . ':00</b></li>';
if(isset($config['lua']['min_pvp_level'])){
$config['lua']['protectionLevel'] = $config['lua']['min_pvp_level'];
}
if(isset($config['lua']['protectionLevel'])):
?>
<li>World type: <b>PVP <i>(Protection level: ><?php echo $config['lua']['protectionLevel']; ?>)</i></b></li>
<?php
endif;
$rent = trim(strtolower($config['lua']['houseRentPeriod']));
if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily')
$rent = 'never';
echo '<li>House rent: ' . ($rent == 'never' ? 'disabled' : $rent) . '.</li>';
if(isset($config['lua']['houseCleanOld'])) {
$cleanOld = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
if($cleanOld > 0)
echo '<li>Houses with inactive owners are cleaned after 30 days.</li>';
}
if(isset($config['lua']['rate_exp']))
$config['lua']['rateExp'] = $config['lua']['rate_exp'];
if(isset($config['lua']['rate_mag']))
$config['lua']['rateMagic'] = $config['lua']['rate_mag'];
if(isset($config['lua']['rate_skill']))
$config['lua']['rateSkill'] = $config['lua']['rate_skill'];
if(isset($config['lua']['rate_loot']))
$config['lua']['rateLoot'] = $config['lua']['rate_loot'];
if(isset($config['lua']['rate_spawn']))
$config['lua']['rateSpawn'] = $config['lua']['rate_spawn'];
?>
<br/>
<h2>Rates</h2>
<?php if(isset($config['lua']['rateExp'])): ?>
<li>Exp Rate: <b>x<?php echo $config['lua']['rateExp']; ?></b></li>
<?php endif;
if(isset($config['lua']['rateMagic'])): ?>
<li>Magic Level: <b>x<?php echo $config['lua']['rateMagic']; ?></b></li>
<?php endif;
if(isset($config['lua']['rateSkill'])): ?>
<li>Skills: <b>x<?php echo $config['lua']['rateSkill']; ?></b></li>
<?php endif;
if(isset($config['lua']['rateLoot'])): ?>
<li>Loot: <b>x<?php echo $config['lua']['rateLoot']; ?></b></li>
<?php endif;
if(isset($config['lua']['rateSpawn'])): ?>
<li>Spawn: <b>x<?php echo $config['lua']['rateSpawn']; ?></b></li>
<?php endif; ?>
<?php
$house_level = NULL;
if(isset($config['lua']['levelToBuyHouse']))
$house_level = $config['lua']['levelToBuyHouse'];
else if(isset($config['lua']['house_level']))
$house_level = $config['lua']['house_level'];
if(isset($house_level)):
?>
<li>Houses: <b><?php echo $house_level; ?> level</b></li>
<?php endif; ?>
<li>Guilds: <b><?php echo $config['guild_need_level']; ?> level</b> (Create via website)</li>
<br>
<?php
if(isset($config['lua']['in_fight_duration']))
$config['lua']['pzLocked'] = $config['lua']['in_fight_duration'];
$pzLocked = eval('return ' . $config['lua']['pzLocked'] . ';');
$whiteSkullTime = isset($config['lua']['whiteSkullTime']) ? $config['lua']['whiteSkullTime'] : NULL;
if(!isset($whiteSkullTime) && isset($config['lua']['unjust_skull_duration']))
$whiteSkullTime = $config['lua']['unjust_skull_duration'];
if(isset($whiteSkullTime))
$whiteSkullTime = eval('return ' . $whiteSkullTime . ';');
$redSkullLength = isset($config['lua']['redSkullLength']) ? $config['lua']['redSkullLength'] : NULL;
if(!isset($redSkullLength) && isset($config['lua']['red_skull_duration']))
$redSkullLength = $config['lua']['red_skull_duration'];
if(isset($redSkullLength))
$redSkullLength = eval('return ' . $redSkullLength . ';');
$blackSkull = false;
$blackSkullLength = NULL;
if(isset($config['lua']['useBlackSkull']) && getBoolean($config['lua']['useBlackSkull']))
{
$blackSkullLength = $config['lua']['blackSkullLength'];
$blackSkull = true;
}
else if(isset($config['lua']['black_skull_duration'])) {
$blackSkullLength = eval('return ' . $config['lua']['blackSkullLength'] . ';');
$blackSkull = true;
}
?>
<h2>Frags & Skull system</h2>
<li>PZ Lock: <b><?php echo ($pzLocked / (60 * 1000)); ?> min</b></li>
<?php if(isset($whiteSkullTime)):?>
<li>White Skull Time: <b><?php echo ($whiteSkullTime / (60 * 1000)); ?> min</b></li>
<?php endif; ?>
<li>Red skull length: <b><?php echo ($redSkullLength / (24 * 60 * 60)); ?> days</b></li>
<?php if($blackSkull): ?>
<li>Black skull length: <b><?php echo ($blackSkullLength / (24 * 60 * 60)); ?> days</b></li>
<?php endif;
if(isset($config['killsToRedSkull'])): ?>
<li>Kills to red skull: <b><?php echo $config['lua']['killsToRedSkull']; ?></b></li>
<?php elseif(isset($config['lua']['dailyFragsToRedSkull']) || isset($config['lua']['kills_per_day_red_skull'])): ?>
<li>
<h3>Red skull</h3>
<ul>
<li><?php echo (isset($config['lua']['dailyFragsToRedSkull']) ? $config['lua']['dailyFragsToRedSkull'] : $config['lua']['kills_per_day_red_skull']); ?> frags daily</li>
<li><?php echo (isset($config['lua']['weeklyFragsToRedSkull']) ? $config['lua']['weeklyFragsToRedSkull'] : $config['lua']['kills_per_week_red_skull']); ?> frags weekly</li>
<li><?php echo (isset($config['lua']['monthlyFragsToRedSkull']) ? $config['lua']['monthlyFragsToRedSkull'] : $config['lua']['kills_per_month_red_skull']); ?> frags monthly</li>
</ul>
<?php if($blackSkull && (isset($config['lua']['dailyFragsToBlackSkull']) || isset($config['lua']['kills_per_day_black_skull']))): ?>
<h3>Black skull</h3>
<ul>
<li><?php echo (isset($config['lua']['dailyFragsToBlackSkull']) ? $config['lua']['dailyFragsToBlackSkull'] : $config['lua']['kills_per_day_black_skull']); ?> frags daily</li>
<li><?php echo (isset($config['lua']['weeklyFragsToBlackSkull']) ? $config['lua']['weeklyFragsToBlackSkull'] : $config['lua']['kills_per_week_black_skull']); ?> frags weekly</li>
<li><?php echo (isset($config['lua']['monthlyFragsToBlackSkull']) ? $config['lua']['monthlyFragsToBlackSkull'] : $config['lua']['kills_per_month_black_skull']); ?> frags monthly</li>
</ul>
<?php else:
if(isset($config['lua']['dailyFragsToBanishment'])): ?>
<h3>Banishment</h3>
<ul>
<li><?php echo $config['lua']['dailyFragsToBanishment']; ?> frags daily</li>
<li><?php echo $config['lua']['weeklyFragsToBanishment']; ?> frags weekly</li>
<li><?php echo $config['lua']['monthlyFragsToBanishment']; ?> frags monthly</li>
</ul>
<?php endif;
endif; ?>
</li>
<?php
endif;
if(isset($config['lua']['banishment_length'])): ?>
<li>Banishment length: <b><?php echo eval('return (' . $config['lua']['banishment_length'] . ') / (24 * 60 * 60);'); ?> days</b></li>
<?php endif;
if(isset($config['lua']['final_banishment_length'])): ?>
<li>Final banishment length: <b><?php echo eval('return (' . $config['lua']['final_banishment_length'] . ') / (24 * 60 * 60);'); ?> days</b></li>
<?php endif;
if(isset($config['lua']['ip_banishment_length'])): ?>
<li>IP banishment length: <b><?php echo eval('return (' . $config['lua']['ip_banishment_length'] . ') / (24 * 60 * 60);'); ?> days</b></li>
<?php endif; ?>
<br/>
<h2>Other</h2>
<li>Respect our <a href="<?php echo getLink('rules'); ?>">rules</a>.</li>
<li>Please report rule violations (Botters, players breaking rules etc) with <b>CTRL + R</b>.</li>
</ul>

View File

@ -0,0 +1,102 @@
<div style="text-align:center">
<h1>{{ config.lua.serverName }}</h1>
<h3>
{% if experienceStages %}
Experience stages: {{ experienceStages }}<br>
{% endif %}
Commands: <a href="{{ getLink('commands') }}">Look here</a><br>
Team: <a href="{{ getLink('team') }}">Look here</a><br>
</h3>
</div>
<ul>
<h2>Server Info:</h2>
<li>IP: <b>{{ serverIp }}</b> (Port: <b>{{ config.lua.loginPort }}</b>)</li>
{% if clientVersion %}
<li>Client: <b>{{ clientVersion }}</b></li>
{% endif %}
<li>Online: <b>24/7</b></li>
{% if globalSaveHour %}
<li>Global save: <b>{{ globalSaveHour }}:00</b></li>
{% endif %}
<li>World type: <b>{{ config.lua.worldType|upper }} <i>(Protection level: {{ protectionLevel }})</i></b></li>
<li>House rent: {{ houseRent }}.</li><br>
{% if houseOld %}
<li>Houses with inactive owners are cleaned after 30 days.</li>
{% endif %}
<h2>Rates</h2>
{% if rateExp is defined %}
<li>Exp Rate: <b>x{{ rateExp }}</b></li>
{% endif %}
{% if rateExpFromPlayers %}
<li>Exp Rate from Players: <b>x{{ rateExpFromPlayers }}</b></li>
{% endif %}
{% if rateMagic is defined %}
<li>Magic Level: <b>x{{ rateMagic }}</b></li>
{% endif %}
{% if rateSkill is defined %}
<li>Skills: <b>x{{ rateSkill }}</b></li>
{% endif %}
{% if rateLoot is defined %}
<li>Loot: <b>x{{ rateLoot }}</b></li>
{% endif %}
{% if rateSpawn is defined %}
<li>Spawn: <b>x{{ rateSpawn }}</b></li>
{% endif %}
{% if houseLevel %}
<li>Houses: <b>{{ houseLevel }} level</b></li>
{% endif %}
<li>Guilds: <b>{{ config.guild_need_level }} level</b> (Create via website)</li>
<br>
<h2>Frags & Skull system</h2>
<li>PZ Lock: <b>{{ pzLocked / (60 * 1000) }} min</b></li>
{% if whiteSkullTime %}
<li>White Skull Time: <b>{{ whiteSkullTime }} min</b></li>
{% endif %}
<li>Red skull length: <b>{{ redSkullLength / (24 * 60 * 60) }} days</b></li>
{% if blackSkull %}
<li>Black skull length: <b>{{ blackSkullLength / (24 * 60 * 60) }} days</b></li>
{% endif %}
{% if killsToRedSkull is defined %}
<li>Kills to red skull: <b>{{ config.lua.killsToRedSkull }}</b></li>
{% elseif config.lua.dailyFragsToRedSkull is defined or config.lua.kills_per_day_red_skull is defined %}
<li>
<h3>Red skull</h3>
<ul>
<li>{{ dailyFragsToRedSkull }} frags daily</li>
<li>{{ weeklyFragsToRedSkull }} frags weekly</li>
<li>{{ monthlyFragsToRedSkull }} frags monthly</li>
</ul>
{% if blackSkull and config.lua.dailyFragsToBlackSkull is defined or config.lua.kills_per_day_black_skull is defined %}
<h3>Black skull</h3>
<ul>
<li>{{ dailyFragsToBlackSkull }} frags daily</li>
<li>{{ weeklyFragsToBlackSkull }} frags weekly</li>
<li>{{ monthlyFragsToBlackSkull }} frags monthly</li>
</ul>
{% elseif config.lua.dailyFragsToBanishment is defined %}
<h3>Banishment</h3>
<ul>
<li>{{ config.lua.dailyFragsToBanishment }} frags daily</li>
<li>{{ config.lua.weeklyFragsToBanishment }} frags weekly</li>
<li>{{ config.lua.monthlyFragsToBanishment }} frags monthly</li>
</ul>
{% endif %}
</li>
{% endif %}
{% if banishmentLength %}
<li>Banishment length: <b>{{ banishmentLength }} days</b></li>
{% endif %}
{% if finalBanishmentLength %}
<li>Final banishment length: <b>{{ finalBanishmentLength }} days</b></li>
{% endif %}
{% if ipBanishmentLength %}
<li>IP banishment length: <b>{{ ipBanishmentLength }} days</b></li>
{% endif %}
<br>
<h2>Other</h2>
<li>Respect our <a href="{{ getLink('rules') }}">rules</a>.</li>
<li>Please report rule violations (Botters, players breaking rules etc) with <b>CTRL + R</b>.</li>
</ul>