More info in serverlist

This commit is contained in:
proller 2013-08-03 03:02:59 +04:00
parent 0b77588e87
commit 5e433fa913
2 changed files with 17 additions and 7 deletions

@ -210,8 +210,6 @@ void sendAnnounce(std::string action, u16 clients, double uptime, std::string ga
server["url"] = g_settings->get("server_url"); server["url"] = g_settings->get("server_url");
server["creative"] = g_settings->get("creative_mode"); server["creative"] = g_settings->get("creative_mode");
server["damage"] = g_settings->get("enable_damage"); server["damage"] = g_settings->get("enable_damage");
server["dedicated"] = g_settings->get("server_dedicated");
server["rollback"] = g_settings->getBool("enable_rollback_recording");
server["password"] = g_settings->getBool("disallow_empty_password"); server["password"] = g_settings->getBool("disallow_empty_password");
server["pvp"] = g_settings->getBool("enable_pvp"); server["pvp"] = g_settings->getBool("enable_pvp");
server["clients"] = clients; server["clients"] = clients;
@ -221,6 +219,10 @@ void sendAnnounce(std::string action, u16 clients, double uptime, std::string ga
} }
if(server["action"] == "start") { if(server["action"] == "start") {
server["dedicated"] = g_settings->get("server_dedicated");
server["rollback"] = g_settings->getBool("enable_rollback_recording");
server["liquid_finite"] = g_settings->getBool("liquid_finite");
server["mapgen"] = g_settings->get("mg_name");
server["mods"] = Json::Value(Json::arrayValue); server["mods"] = Json::Value(Json::arrayValue);
for(std::vector<ModSpec>::iterator m = m_mods.begin(); m != m_mods.end(); m++) { for(std::vector<ModSpec>::iterator m = m_mods.begin(); m != m_mods.end(); m++) {
server["mods"].append(m->name); server["mods"].append(m->name);

@ -41,7 +41,7 @@ function human_time(t, abs) {
function success(r) { function success(r) {
if (!r || !r.list) return; if (!r || !r.list) return;
var h = '<table class="mts_table"><tr class="mts_head"><th>ip[:port]</th><th>clients/max</th><th>version gameid</th><th>name</th><th>description</th><th>flags</th><th>uptime</th><th>ping</th></tr>'; var h = '<table class="mts_table"><tr class="mts_head"><th>ip[:port]</th><th>clients/max</th><th>version gameid mapgen</th><th>name</th><th>description</th><th>flags</th><th>uptime</th><th>ping</th></tr>';
for (var i = 0; i < r.list.length; ++i) { for (var i = 0; i < r.list.length; ++i) {
var s = r.list[i]; var s = r.list[i];
if (!s) continue; if (!s) continue;
@ -49,13 +49,13 @@ function success(r) {
h += '<tr class="mts_row">'; h += '<tr class="mts_row">';
h += '<td class="mts_address">' + e(s.address) + (s.port != 30000 ? (':' + e(s.port)) : '') + '</td>'; h += '<td class="mts_address">' + e(s.address) + (s.port != 30000 ? (':' + e(s.port)) : '') + '</td>';
h += '<td class="mts_clients">' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + '</td>'; h += '<td class="mts_clients">' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + '</td>';
var mods; var mods = 0;
if (s.mods && jQuery.isArray(s.mods)) { if (s.mods && jQuery.isArray(s.mods)) {
mods = s.mods.length; mods = s.mods.length;
} }
h += '<td class="mts_version' + (mods ? ' mts_ismods' : '') + '">' + e(s.version) + ' ' + e(s.gameid); h += '<td class="mts_version' + (mods ? ' mts_ismods' : '') + '">' + e(s.version) + ' ' + e(s.gameid) ' ' + e(s.mapgen);
if (mods) { if (mods) {
h += '<div class="mts_mods">Mods:<br/>'; h += '<div class="mts_mods">Mods ('+mods+'):<br/>';
for (m in s.mods) { for (m in s.mods) {
h += s.mods[m] + '<br/>'; h += s.mods[m] + '<br/>';
} }
@ -70,7 +70,15 @@ function success(r) {
if (s.url) h += '</a>'; if (s.url) h += '</a>';
h += '</td>'; h += '</td>';
h += '<td class="mts_description">' + e(s.description) + '</td>'; h += '<td class="mts_description">' + e(s.description) + '</td>';
h += '<td class="mts_flags">' + e(s.password ? 'Pwd ' : '') + (s.creative ? 'Cre ' : '') + (s.damage ? 'Dmg ' : '') + (s.pvp ? 'Pvp ' : '') + (s.dedicated ? 'Ded ' : '') + (s.rollback ? 'Rol ' : '') + '</td>'; h += '<td class="mts_flags">' +
(s.password ? 'Pwd ' : '') +
(s.creative ? 'Cre ' : '') +
(s.damage ? 'Dmg ' : '') +
(s.pvp ? 'Pvp ' : '') +
(s.dedicated ? 'Ded ' : '') +
(s.rollback ? 'Rol ' : '') +
(s.liquid_finite ? 'Liq ' : '') +
'</td>';
if (!s.start || s.start < 0) s.start = 0; if (!s.start || s.start < 0) s.start = 0;
h += '<td class="mts_time">' + (s.uptime ? human_time(s.uptime, 1) : s.start ? human_time(s.start) : '') + '</td>'; h += '<td class="mts_time">' + (s.uptime ? human_time(s.uptime, 1) : s.start ? human_time(s.start) : '') + '</td>';
h += '<td class="mts_ping">' + (s.ping ? parseFloat(s.ping).toFixed(3) * 1000 : '') + '</td>'; h += '<td class="mts_ping">' + (s.ping ? parseFloat(s.ping).toFixed(3) * 1000 : '') + '</td>';