Commit 31d09208 authored by Neoony's avatar Neoony
Browse files

-Bugfix when there is more than 10 servers online -Maximum 20 servers -Adjust lobby down message

parent 922bd6c4
...@@ -22,13 +22,13 @@ var dbconfigs = require('./dbconfig.js'); ...@@ -22,13 +22,13 @@ var dbconfigs = require('./dbconfig.js');
const client = new Discord.Client(); const client = new Discord.Client();
var namex = ["", "", "", "", "", "", "", "", "", ""]; var namex = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
var addrx = ["", "", "", "", "", "", "", "", "", ""]; var addrx = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
var playersx = ["", "", "", "", "", "", "", "", "", ""]; var playersx = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
var maxplayersx = ["", "", "", "", "", "", "", "", "", ""]; var maxplayersx = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
var mapx = ["", "", "", "", "", "", "", "", "", ""]; var mapx = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
var xpx = ["", "", "", "", "", "", "", "", "", ""]; var xpx = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
var xpmessage = ["", "", "", "", "", "", "", "", "", ""]; var xpmessage = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""];
var numberofservers; var numberofservers;
var InfoDisplayCounter = 0; var InfoDisplayCounter = 0;
...@@ -103,8 +103,8 @@ function RefreshSQL() ...@@ -103,8 +103,8 @@ function RefreshSQL()
{ {
var LobbyUp = 0; var LobbyUp = 0;
messagex = ""; messagex = "";
messageServerOn = "```diff\n-Lobby server is down!``````diff\n-Fast refreshing might be down, info might be slightly OUTDATED (<= 5 minutes refresh time)``````diff\n-XP indication is not accurate currently```"; messageServerOn = "```diff\n-Lobby server is down!``````diff\n-Fast refreshing is down, info might be slightly OUTDATED (<= 5 minutes refresh time)```";
connection.query("SELECT COUNT(*) as cnt FROM `LobbyDB`.`servers` WHERE password=0 AND isenabled=1 AND addr!='80.112.155.100:27017' ORDER BY players DESC LIMIT 10;", function (error, results, fields) connection.query("SELECT COUNT(*) as cnt FROM `LobbyDB`.`servers` WHERE password=0 AND isenabled=1 AND addr!='80.112.155.100:27017' ORDER BY players DESC;", function (error, results, fields)
{ {
if (error) if (error)
{ {
...@@ -124,9 +124,13 @@ function RefreshSQL() ...@@ -124,9 +124,13 @@ function RefreshSQL()
HandleDisconnectOn = 0; HandleDisconnectOn = 0;
console.log('Number of servers: ', results[0].cnt); console.log('Number of servers: ', results[0].cnt);
numberofservers = results[0].cnt; numberofservers = results[0].cnt;
if (numberofservers > 20)
{
numberofservers = 20;
}
}); });
connection.query("SELECT servers.name as name, servers.addr as addr, servers.players as players, servers.maxplayers as maxplayers, servers.map as map, xpdata.xp as xp FROM `LobbyDB`.`servers` LEFT JOIN `LobbyDB`.`xpdata` ON servers.addr = xpdata.addr WHERE servers.password=0 AND servers.isenabled=1 AND servers.addr!='80.112.155.100:27017' ORDER BY xp DESC, players DESC LIMIT 10;", function (error, results, fields) connection.query("SELECT servers.name as name, servers.addr as addr, servers.players as players, servers.maxplayers as maxplayers, servers.map as map, xpdata.xp as xp FROM `LobbyDB`.`servers` LEFT JOIN `LobbyDB`.`xpdata` ON servers.addr = xpdata.addr WHERE servers.password=0 AND servers.isenabled=1 AND servers.addr!='80.112.155.100:27017' ORDER BY xp DESC, players DESC;", function (error, results, fields)
{ {
if (error) if (error)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment