Skip to content

Commit

Permalink
Merge pull request #29 from mleo1/master
Browse files Browse the repository at this point in the history
update to server status
  • Loading branch information
FlippAcademy committed Aug 18, 2015
2 parents 06f6248 + f506b1f commit 8070f9e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lang/en_us.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@
'ServerStatusCharLabel' => 'Character Server',
'ServerStatusMapLabel' => 'Map Server',
'ServerStatusOnlineLabel' => 'Players Online',
'ServerStatusATMerchantsLabel' => 'Autotrade Merchants',
'ServerStatusPopulationLabel' => 'Population',

// Module: service
// - service/tos
Expand Down
2 changes: 2 additions & 0 deletions lang/es_es.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@
'ServerStatusCharLabel' => 'Character Server',
'ServerStatusMapLabel' => 'Map Server',
'ServerStatusOnlineLabel' => 'Jugadores Conectados',
'ServerStatusATMerchantsLabel' => 'Comerciantes Autotrade',
'ServerStatusPopulationLabel' => 'Población',

// Module: service
// - service/tos
Expand Down
2 changes: 2 additions & 0 deletions lang/pt_br.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,8 @@
'ServerStatusCharLabel' => 'Character Server',
'ServerStatusMapLabel' => 'Map Server',
'ServerStatusOnlineLabel' => 'Jogadores Online',
'ServerStatusATMerchantsLabel' => 'Comerciantes Autotrade',
'ServerStatusPopulationLabel' => 'População',

// Module: service
// - service/tos
Expand Down
6 changes: 6 additions & 0 deletions modules/server/status-xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@
$cserv = $dom->createAttribute('charServer');
$mserv = $dom->createAttribute('mapServer');
$online = $dom->createAttribute('playersOnline');
$atmerc = $dom->createAttribute('autotradeMerchants');
$population = $dom->createAttribute('population');

$lserv->nodeValue = (int)$gameServer['loginServerUp'];
$cserv->nodeValue = (int)$gameServer['charServerUp'];
$mserv->nodeValue = (int)$gameServer['mapServerUp'];
$online->nodeValue = (int)$gameServer['playersOnline'];
$atmerc->nodeValue = (int)$gameServer['autotradeMerchants'];
$population->nodeValue = (int)$gameServer['population'];

$serv->appendChild($lserv);
$serv->appendChild($cserv);
$serv->appendChild($mserv);
$serv->appendChild($online);
$serv->appendChild($atmerc);
$serv->appendChild($population);
$group->appendChild($serv);
}

Expand Down
17 changes: 13 additions & 4 deletions modules/server/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,26 @@

foreach ($loginAthenaGroup->athenaServers as $athenaServer) {
$serverName = $athenaServer->serverName;

$sql = "SELECT COUNT(char_id) AS players_online FROM {$athenaServer->charMapDatabase}.char WHERE online > 0";
$sql = "SELECT COUNT(char_id) AS population FROM {$athenaServer->charMapDatabase}.char WHERE online > 0";
$sth = $loginAthenaGroup->connection->getStatement($sql);
$sth->execute();
$res = $sth->fetch();

$population = intval($res ? $res->population : 0);

$sql = "SELECT COUNT(char_id) AS autotrade_merchants FROM {$athenaServer->charMapDatabase}.autotrade_merchants";
$sth = $loginAthenaGroup->connection->getStatement($sql);
$sth->execute();
$res = $sth->fetch();
$autotrade_merchants = intval($res ? $res->autotrade_merchants : 0);

$serverStatus[$groupName][$serverName] = array(
'loginServerUp' => $loginServerUp,
'charServerUp' => $athenaServer->charServer->isUp(),
'mapServerUp' => $athenaServer->mapServer->isUp(),
'playersOnline' => intval($res ? $res->players_online : 0)
'playersOnline' => $population - $autotrade_merchants,
'autotradeMerchants' => $autotrade_merchants,
'population' => $population
);
}
}
Expand Down
4 changes: 4 additions & 0 deletions themes/default/server/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<td class="status"><?php echo htmlspecialchars(Flux::message('ServerStatusCharLabel')) ?></td>
<td class="status"><?php echo htmlspecialchars(Flux::message('ServerStatusMapLabel')) ?></td>
<td class="status"><?php echo htmlspecialchars(Flux::message('ServerStatusOnlineLabel')) ?></td>
<td class="status"><?php echo htmlspecialchars(Flux::message('ServerStatusATMerchantsLabel')) ?></td>
<td class="status"><?php echo htmlspecialchars(Flux::message('ServerStatusPopulationLabel')) ?></td>
</tr>
<?php foreach ($gameServers as $serverName => $gameServer): ?>
<tr>
Expand All @@ -18,6 +20,8 @@
<td class="status"><?php echo $this->serverUpDown($gameServer['charServerUp']) ?></td>
<td class="status"><?php echo $this->serverUpDown($gameServer['mapServerUp']) ?></td>
<td class="status"><?php echo $gameServer['playersOnline'] ?></td>
<td class="status"><?php echo $gameServer['autotradeMerchants'] ?></td>
<td class="status"><?php echo $gameServer['population'] ?></td>
</tr>
<?php endforeach ?>
</table>
Expand Down

0 comments on commit 8070f9e

Please sign in to comment.