Commit c31a11b6 authored by Neoony's avatar Neoony
Browse files

v0.6.2 -Add updating of servertype, os, password and vac, as that was...

v0.6.2 -Add updating of servertype, os, password and vac, as that was forgotten to be added after reworking the way of checking servers
parent 5681c15b
Pipeline #15427 failed with stages
in 8 minutes and 17 seconds
......@@ -128,4 +128,7 @@
- Slightly improved re-checking of servers which Lobby lost connection to
**v0.6.1**
- Fix escape character issue with SQL update
\ No newline at end of file
- Fix escape character issue with SQL update
**v0.6.2**
- Add updating of servertype, os, password and vac, as that was forgotten to be added after reworking the way of checking servers
\ No newline at end of file
......@@ -23,7 +23,7 @@
#include <cURL>
#include <SteamWorks>
#define PluginVer "v0.6.1"
#define PluginVer "v0.6.2"
public Plugin myinfo =
{
......@@ -125,6 +125,11 @@ int maxPlayersSQL[10];
char mapSQL[10][256];
int RSbots[10];
int RSservertype[10];
int RSos[10];
int RSpassword[10];
int RSvac[10];
int appidSQL[10];
char versionSQL[10][256];
......@@ -144,6 +149,11 @@ int botsintS[10];
char mapNameS[10][256];
char serverNameS[10][160];
int serverTypeS[10];
int serverOsS[10];
int passwordS[10];
int vacS[10];
int appIdS[10];
char versionS[10][256];
......@@ -2191,7 +2201,7 @@ public Action InfoOfServers()
if (hDatabase != null)
{
char RSGetAllServersAddrEach[1024];
Format(RSGetAllServersAddrEach, sizeof(RSGetAllServersAddrEach), "SELECT servers.addr as addr, servers.name as name, servers.players as players, servers.maxplayers, servers.map, servers.bots as bots, IFNULL(xpdata.xp,'-1') as xp, IFNULL(appid.appid,'-1') as appid, IFNULL(version.version,'-1') as version FROM `LobbyDB`.`servers` LEFT JOIN `LobbyDB`.`xpdata` ON servers.addr = xpdata.addr LEFT JOIN `LobbyDB`.`appid` ON servers.addr = appid.addr LEFT JOIN `LobbyDB`.`version` ON servers.addr = version.addr WHERE servers.password=0 AND servers.isenabled=1 AND servers.addr!='80.112.155.100:27017' ORDER BY players DESC LIMIT 10;");
Format(RSGetAllServersAddrEach, sizeof(RSGetAllServersAddrEach), "SELECT servers.addr as addr, servers.name as name, servers.players as players, servers.maxplayers, servers.map, servers.bots as bots, IFNULL(xpdata.xp,'-1') as xp, IFNULL(appid.appid,'-1') as appid, IFNULL(version.version,'-1') as version, servers.servertype, servers.os, servers.password, servers.vac FROM `LobbyDB`.`servers` LEFT JOIN `LobbyDB`.`xpdata` ON servers.addr = xpdata.addr LEFT JOIN `LobbyDB`.`appid` ON servers.addr = appid.addr LEFT JOIN `LobbyDB`.`version` ON servers.addr = version.addr WHERE servers.password=0 AND servers.isenabled=1 AND servers.addr!='80.112.155.100:27017' ORDER BY players DESC LIMIT 10;");
//PrintToServer("%s", ServerIndexChar);
SQL_TQuery(hDatabase, RSInfoOfServer, RSGetAllServersAddrEach);
}
......@@ -2250,6 +2260,11 @@ public void RSInfoOfServer(Handle RShDriver, Handle RShResult, const char[] sErr
RSXPsqlon[rowNumber] = SQL_FetchInt(RShResult, 6);
appidSQL[rowNumber] = SQL_FetchInt(RShResult, 7);
SQL_FetchString(RShResult, 8, versionSQL[rowNumber], 256);
RSservertype[rowNumber] = SQL_FetchInt(RShResult, 9);
RSos[rowNumber] = SQL_FetchInt(RShResult, 10);
RSpassword[rowNumber] = SQL_FetchInt(RShResult, 11);
RSvac[rowNumber] = SQL_FetchInt(RShResult, 12);
if (GetConVarInt(l_debug) == 2)
{
......@@ -2262,6 +2277,10 @@ public void RSInfoOfServer(Handle RShDriver, Handle RShResult, const char[] sErr
PrintToServer("RSXPsqlon[%i]: %i", rowNumber, RSXPsqlon[rowNumber]);
PrintToServer("appidSQL[%i]: %i", rowNumber, appidSQL[rowNumber]);
PrintToServer("versionSQL[%i]: %s", rowNumber, versionSQL[rowNumber]);
PrintToServer("RSservertype[%i]: %i", rowNumber, RSservertype[rowNumber]);
PrintToServer("RSos[%i]: %i", rowNumber, RSos[rowNumber]);
PrintToServer("RSpassword[%i]: %i", rowNumber, RSpassword[rowNumber]);
PrintToServer("RSvac[%i]: %i", rowNumber, RSvac[rowNumber]);
}
if (XPcheckcounter[rowNumber] == 0)
......@@ -2643,7 +2662,11 @@ public OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, in
char bots[160];
int type;
char os[160];
int os;
int password;
int vac;
char version[256];
int UE4appID;
......@@ -2681,11 +2704,13 @@ public OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, in
type = GetByte(receiveData, offset);
offset++;
//int offsetos = offset + 2;
os = GetString(receiveData, dataSize, offset);
os = GetByte(receiveData, offset);
offset++;
//I guess visibility
password = GetByte(receiveData, offset);
offset++;
//VAC
vac = GetByte(receiveData, offset);
offset++;
version = GetString(receiveData, dataSize, offset);
offset += strlen(version) + 1;
......@@ -2731,8 +2756,10 @@ public OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, in
PrintToServer("numPlayers : %s", numPlayers);
PrintToServer("maxPlayers : %s", maxPlayers);
PrintToServer("bots : %s", bots);
PrintToServer("type : %s", type);
PrintToServer("os : %s", os);
PrintToServer("type : %i", type);
PrintToServer("os : %i", os);
PrintToServer("password : %i", password);
PrintToServer("vac : %i", vac);
PrintToServer("version : %s", version);
PrintToServer("UE4appID : %i", UE4appID);
PrintToServer("---------------------------------------------------");
......@@ -2748,6 +2775,11 @@ public OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, in
versionS[ServerIndexx] = version;
serverNameS[ServerIndexx] = srvName;
serverTypeS[ServerIndexx] = type;
serverOsS[ServerIndexx] = os;
passwordS[ServerIndexx] = password;
vacS[ServerIndexx] = vac;
//Appid detection
if (appID == 17740 && StrEqual(gameDir, "empires"))
{
......@@ -2786,14 +2818,14 @@ public OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, in
//XPCheckURL(ServerIndexx);
if (!StrEqual(RSnamex[ServerIndexx], serverNameS[ServerIndexx]) || curPlayersSQL[ServerIndexx] != numPlayersS[ServerIndexx] || maxPlayersSQL[ServerIndexx] != maxPlayersS[ServerIndexx] || RSbots[ServerIndexx] != botsintS[ServerIndexx] || !StrEqual(mapSQL[ServerIndexx], mapNameS[ServerIndexx]) || appidSQL[ServerIndexx] != appIdS[ServerIndexx] || !StrEqual(versionSQL[ServerIndexx], versionS[ServerIndexx]))
if (!StrEqual(RSnamex[ServerIndexx], serverNameS[ServerIndexx]) || curPlayersSQL[ServerIndexx] != numPlayersS[ServerIndexx] || maxPlayersSQL[ServerIndexx] != maxPlayersS[ServerIndexx] || RSbots[ServerIndexx] != botsintS[ServerIndexx] || !StrEqual(mapSQL[ServerIndexx], mapNameS[ServerIndexx]) || appidSQL[ServerIndexx] != appIdS[ServerIndexx] || !StrEqual(versionSQL[ServerIndexx], versionS[ServerIndexx]) || RSservertype[ServerIndexx] != serverTypeS[ServerIndexx] || RSos[ServerIndexx] != serverOsS[ServerIndexx] || RSpassword[ServerIndexx] != passwordS[ServerIndexx] || RSvac[ServerIndexx] != vacS[ServerIndexx])
{
UpdateSQL(ServerIndexx);
if (GetConVarInt(l_debug) == 1)
{
PrintToServer("[L] SQL Update!!");
PrintToServer("[L] %s != %s || %i != %i || %i != %i || %i != %i || %s != %s || %i != %i || %s != %s", RSnamex[ServerIndexx], serverNameS[ServerIndexx], curPlayersSQL[ServerIndexx], numPlayersS[ServerIndexx], maxPlayersSQL[ServerIndexx], maxPlayersS[ServerIndexx], RSbots[ServerIndexx], botsintS[ServerIndexx], mapSQL[ServerIndexx], mapNameS[ServerIndexx], appidSQL[ServerIndexx], appIdS[ServerIndexx], versionSQL[ServerIndexx], versionS[ServerIndexx]);
PrintToServer("[L] %s != %s || %i != %i || %i != %i || %i != %i || %s != %s || %i != %i || %s != %s || %i != %i || %i != %i || %i != %i || %i != %i", RSnamex[ServerIndexx], serverNameS[ServerIndexx], curPlayersSQL[ServerIndexx], numPlayersS[ServerIndexx], maxPlayersSQL[ServerIndexx], maxPlayersS[ServerIndexx], RSbots[ServerIndexx], botsintS[ServerIndexx], mapSQL[ServerIndexx], mapNameS[ServerIndexx], appidSQL[ServerIndexx], appIdS[ServerIndexx], versionSQL[ServerIndexx], versionS[ServerIndexx], RSservertype[ServerIndexx], serverTypeS[ServerIndexx], RSos[ServerIndexx], serverOsS[ServerIndexx], RSpassword[ServerIndexx], passwordS[ServerIndexx], RSvac[ServerIndexx], vacS[ServerIndexx]);
}
}
......@@ -3187,9 +3219,14 @@ public Action UpdateSQL(int ServerIndexx)
//PrintToServer("%s", EscapedServerName);
char UpdateServer[512];
Format(UpdateServer, sizeof(UpdateServer), "UPDATE `LobbyDB`.`servers` SET last_update = '%i', name = '%s', players = '%i', maxplayers = '%i', bots = '%i', map = '%s' WHERE addr = '%s';", GetTime(), EscapedServerName, numPlayersS[ServerIndexx], maxPlayersS[ServerIndexx], botsintS[ServerIndexx], mapNameS[ServerIndexx], RSaddrx[ServerIndexx]);
Format(UpdateServer, sizeof(UpdateServer), "UPDATE `LobbyDB`.`servers` SET last_update = '%i', name = '%s', players = '%i', maxplayers = '%i', bots = '%i', map = '%s', servertype = '%i', os = '%i', password = '%i', vac = '%i' WHERE addr = '%s';", GetTime(), EscapedServerName, numPlayersS[ServerIndexx], maxPlayersS[ServerIndexx], botsintS[ServerIndexx], mapNameS[ServerIndexx], serverTypeS[ServerIndexx], serverOsS[ServerIndexx], passwordS[ServerIndexx], vacS[ServerIndexx], RSaddrx[ServerIndexx]);
SQL_TQuery(hDatabase, UpdateServer_Handle, UpdateServer, ServerIndexx);
if (GetConVarInt(l_debug) == 1)
{
PrintToServer("[L] UPDATE `LobbyDB`.`servers` SET last_update = '%i', name = '%s', players = '%i', maxplayers = '%i', bots = '%i', map = '%s', servertype = '%i', os = '%i', password = '%i', vac = '%i' WHERE addr = '%s';", GetTime(), EscapedServerName, numPlayersS[ServerIndexx], maxPlayersS[ServerIndexx], botsintS[ServerIndexx], mapNameS[ServerIndexx], RSaddrx[ServerIndexx], serverTypeS[ServerIndexx], serverOsS[ServerIndexx], passwordS[ServerIndexx], vacS[ServerIndexx]);
}
//Update appid
if (appidSQL[ServerIndexx] != appIdS[ServerIndexx])
{
......
......@@ -4,10 +4,10 @@
{
"Version"
{
"Latest" "v0.6.1"
"Latest" "v0.6.2"
}
"Notes" "Fix escape character issue with SQL update"
"Notes" "Add updating of servertype, os, password and vac, as that was forgotten to be added after reworking the way of checking servers"
}
"Files"
......
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