mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-17 18:24:33 +02:00
Revamped online page
This commit is contained in:
parent
ba4ed6a04b
commit
9a90e4aae2
BIN
images/order_asc.gif
Normal file
BIN
images/order_asc.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 B |
BIN
images/order_desc.gif
Normal file
BIN
images/order_desc.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 B |
@ -22,13 +22,16 @@ $promotion = '';
|
||||
if($db->hasColumn('players', 'promotion'))
|
||||
$promotion = '`promotion`,';
|
||||
|
||||
$order = $_GET['order'] ?? 'name';
|
||||
if(!in_array($order, array('country', 'name', 'level', 'vocation')))
|
||||
$order = $db->fieldName('name');
|
||||
else if($order == 'country')
|
||||
$order = $db->tableName('accounts') . '.' . $db->fieldName('country');
|
||||
else if($order == 'vocation')
|
||||
$order = $promotion . 'vocation ASC';
|
||||
$order = $_GET['order'] ?? 'name_asc';
|
||||
if(!in_array($order, ['country_asc', 'country_desc', 'name_asc', 'name_desc', 'level_asc', 'level_desc', 'vocation_asc', 'vocation_desc'])) {
|
||||
$order = 'name_asc';
|
||||
}
|
||||
else if($order == 'vocation_asc' || $order == 'vocation_desc') {
|
||||
$order = $promotion . 'vocation_' . (str_contains($order, 'asc') ? 'asc' : 'desc');
|
||||
}
|
||||
|
||||
$orderExplode = explode('_', $order);
|
||||
$orderSql = $orderExplode[0] . ' ' . $orderExplode[1];
|
||||
|
||||
$skull_type = 'skull';
|
||||
if($db->hasColumn('players', 'skull_type')) {
|
||||
@ -58,11 +61,11 @@ if (setting('core.online_vocations')) {
|
||||
}
|
||||
|
||||
if($db->hasTable('players_online')) // tfs 1.0
|
||||
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
|
||||
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $orderSql);
|
||||
else
|
||||
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`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);
|
||||
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`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 ' . $orderSql);
|
||||
|
||||
$players_data = array();
|
||||
$players_data = [];
|
||||
$players = 0;
|
||||
$data = '';
|
||||
foreach($playersOnline as $player) {
|
||||
@ -115,7 +118,7 @@ if(count($players_data) > 0) {
|
||||
}
|
||||
|
||||
if($result) {
|
||||
$record = 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');
|
||||
$record = $result['record'] . ' player' . ($result['record'] > 1 ? 's' : '') . ($timestamp ? ' (on ' . date("M d Y, H:i:s", $result['timestamp']) . ')' : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -124,6 +127,7 @@ $twig->display('online.html.twig', array(
|
||||
'players' => $players_data,
|
||||
'record' => $record,
|
||||
'vocs' => $vocs,
|
||||
'order' => $order,
|
||||
));
|
||||
|
||||
//search bar
|
||||
|
@ -1264,6 +1264,12 @@ Sent by MyAAC,<br/>
|
||||
'desc' => '',
|
||||
'default' => false,
|
||||
],
|
||||
'online_datacenter' => [
|
||||
'name' => 'Data Center',
|
||||
'type' => 'text',
|
||||
'desc' => 'Server Location, will be shown on online page',
|
||||
'default' => 'Frankfurt - Germany',
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Team Page'
|
||||
|
@ -1,39 +1,7 @@
|
||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||
<tr bgcolor="{{ config.vdarkborder }}">
|
||||
<td class="white"><b>Server Status</b></td>
|
||||
</tr>
|
||||
{% if players|length == 0 %}
|
||||
<tr bgcolor="{{ config.darkborder }}"><td>Currently no one is playing on {{ config.lua.serverName }}.</td></tr></table>
|
||||
{% else %}
|
||||
<tr bgcolor="{{ config.darkborder }}">
|
||||
<td>
|
||||
{% if not status.online %}
|
||||
Server is offline.<br/>
|
||||
{% else %}
|
||||
{% if setting('core.online_afk') %}
|
||||
{% set players_count = players|length %}
|
||||
{% set afk = players_count - status.players %}
|
||||
{% if afk < 0 %}
|
||||
{% set players_count = players_count + afk|abs %}
|
||||
{% set afk = 0 %}
|
||||
{% endif %}
|
||||
Currently there are <b>{{ status.players }}</b> active and <b>{{ afk }}</b> AFK players.<br/>
|
||||
Total number of players: <b>{{ players_count }}</b>.<br/>
|
||||
{% else %}
|
||||
Currently {{ players|length }} players are online.<br/>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if setting('core.online_record') %}
|
||||
{{ record }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{# vocation statistics #}
|
||||
{% if setting('core.online_vocations') %}
|
||||
<br/>
|
||||
{# vocation statistics #}
|
||||
{% if setting('core.online_vocations') %}
|
||||
<br/>
|
||||
{% if setting('core.online_vocations_images') %}
|
||||
{% if setting('core.online_vocations_images') %}
|
||||
<table width="200" cellspacing="1" cellpadding="0" border="0" align="center">
|
||||
<tr bgcolor="{{ config.darkborder }}">
|
||||
<td><img src="images/sorcerer.png" /></td>
|
||||
@ -69,11 +37,13 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
<br/>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# show skulls #}
|
||||
{% if setting('core.online_skulls') %}
|
||||
<br/>
|
||||
|
||||
{# show skulls #}
|
||||
{% if setting('core.online_skulls') %}
|
||||
<table width="100%" cellspacing="1">
|
||||
<tr>
|
||||
<td style="background: {{ config.darkborder }};" align="center">
|
||||
@ -83,34 +53,114 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
<br/>
|
||||
|
||||
{% set title = 'World Information' %}
|
||||
{% set tableClass = 'Table3' %}
|
||||
{% set background = config('darkborder') %}
|
||||
{% set content %}
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class="LabelV150"><b>Status:</b></td>
|
||||
<td>{% if not status.online %}Offline{% else %}Online{% endif %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="LabelV150"><b>Players Online:</b></td>
|
||||
<td>
|
||||
{% if setting('core.online_afk') %}
|
||||
{% set players_count = players|length %}
|
||||
{% set afk = players_count - status.players %}
|
||||
{% if afk < 0 %}
|
||||
{% set players_count = players_count + afk|abs %}
|
||||
{% set afk = 0 %}
|
||||
{% endif %}
|
||||
Currently there are <b>{{ status.players }}</b> active and <b>{{ afk }}</b> AFK players.<br/>
|
||||
Total number of players: <b>{{ players_count }}</b>.<br/>
|
||||
{% else %}
|
||||
{{ players|length }} Players Online.
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% if setting('core.online_record') %}
|
||||
<tr>
|
||||
<td class="LabelV150"><b>Online Record:</b></td>
|
||||
<td>
|
||||
{{ record }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||
<tr bgcolor="{{ config.vdarkborder }}">
|
||||
<tr>
|
||||
<td class="LabelV150"><b>Location Datacenter:</b></td>
|
||||
<td>{{ setting('core.online_datacenter') }} <small>(Server date & time: - {{ "now"|date("d/m/Y H:i:s") }})</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="LabelV150"><b>PvP Type:</b></td>
|
||||
<td>
|
||||
{% set worldType = config('lua')['worldType']|lower %}
|
||||
{% if worldType in ['pvp','2','normal','open','openpvp'] %}
|
||||
Open PvP
|
||||
{% elseif worldType in ['no-pvp','nopvp','non-pvp','nonpvp','1','safe','optional','optionalpvp'] %}
|
||||
Optional PvP
|
||||
{% elseif worldType in ['pvp-enforced','pvpenforced','pvp-enfo','pvpenfo','pvpe','enforced','enfo','3','war','hardcore','hardcorepvp'] %}
|
||||
Hardcore PvP
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endset %}
|
||||
{% include 'tables.headline.html.twig' %}
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
{% set title = 'Players Online' %}
|
||||
{% set tableClass = 'Table2' %}
|
||||
{% set content %}
|
||||
<table width="100%">
|
||||
<tr class="LabelH" style="position: relative; z-index: 20;">
|
||||
{% if setting('core.account_country') %}
|
||||
<td width="11px"><a href="{{ getLink('online?order=country') }}" class="white">#</A></td>
|
||||
<td width="11px"><a href="{{ getLink('online')}}?order=country_{{ order == 'country_asc' ? 'desc' : 'asc' }}">#  </a>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% if setting('core.online_outfit') %}
|
||||
<td class="white"><b>Outfit</b></td>
|
||||
<td><b>Outfit</b></td>
|
||||
{% endif %}
|
||||
<td width="60%"><a href="{{ getLink('online?order=name') }}" class="white">Name</A></td>
|
||||
<td width="20%"><a href="{{ getLink('online?order=level') }}" class="white">Level</A></td>
|
||||
<td width="20%"><a href="{{ getLink('online?order=vocation') }}" class="white">Vocation</td>
|
||||
<td style="text-align:left; width:50%">Name  
|
||||
<small style="font-weight:normal">[<a href="{{ getLink('online')}}?order=name_{{ order == 'name_asc' ? 'desc' : 'asc' }}">sort</a>]</small>
|
||||
<img class="sortarrow" src="images/{{ order == 'name_asc' ? 'order_desc' : (order == 'name_desc' ? 'order_asc' : 'news/blank') }}.gif"/></td>
|
||||
<td style="text-align:left;width:30%">Level  
|
||||
<small style="font-weight:normal">[<a href="{{ getLink('online')}}?order=level_{{ order == 'level_asc' ? 'desc' : 'asc' }}">sort</a>]</small>
|
||||
<img class="sortarrow" src="images/{{ order == 'level_asc' ? 'order_desc' : (order == 'level_desc' ? 'order_asc' : 'news/blank') }}.gif"/>
|
||||
</td>
|
||||
<td style="text-align:left;width:50%">Vocation  
|
||||
<small style="font-weight:normal">[<a href="{{ getLink('online')}}?order=vocation_{{ order == 'vocation_asc' ? 'desc' : 'asc' }}">sort</a>]</small>
|
||||
<img class="sortarrow" src="images/{{ order == 'vocation_asc' ? 'order_desc' : (order == 'vocation_desc' ? 'order_asc' : 'news/blank') }}.gif"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% set i = 0 %}
|
||||
{% for player in players %}
|
||||
{% set i = i + 1 %}
|
||||
<tr bgcolor="{{ getStyle(i) }}">
|
||||
{% if setting('core.account_country') %}
|
||||
<td>{{ player.country_image|raw }}</td>
|
||||
{% endif %}
|
||||
{% if setting('core.online_outfit') %}
|
||||
<td width="5%"><img style="position:absolute;margin-top:{% if player.player.looktype in setting('core.outfit_images_wrong_looktypes') %}-20px;margin-left:-0px;{% else %}-45px;margin-left:-25px;{% endif %}" src="{{ player.outfit }}" alt="player outfit"/></td>
|
||||
{% endif %}
|
||||
<td>{{ player.name|raw }}{{ player.skull }}</td>
|
||||
<td>{{ player.level }}</td>
|
||||
<td>{{ player.vocation }}</td>
|
||||
|
||||
<tr style="background: {{ getStyle(i) }}; text-align: right; height: 40px;">
|
||||
{% if setting('core.account_country') %}
|
||||
<td>{{ player.country_image|raw }}</td>
|
||||
{% endif %}
|
||||
|
||||
{% if setting('core.online_outfit') %}
|
||||
<td width="5%"><img style="position:absolute;margin-top:-48px;margin-left:-70px;" src="{{ player.outfit }}" alt="player outfit"/></td>
|
||||
{% endif %}
|
||||
|
||||
<td style="width:70%; text-align:left">
|
||||
{{ player.name|raw }}{{ player.skull }}
|
||||
</td>
|
||||
<td style="width:10%">{{ player.level }}</td>
|
||||
<td style="width:20%">{{ player.vocation }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endset %}
|
||||
{{ include('tables.headline.html.twig') }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user