Added a PGD Connect Toggler

PGD Connect can now be enabled/disabled via a global variable in
serverControl.cs, in the event the system is re-enabled, simply turn the
var off.
This commit is contained in:
Robert Fritzen 2014-06-02 14:15:07 -05:00
parent f950c4d026
commit 3f80def5c1
9 changed files with 77 additions and 1 deletions

View file

@ -935,6 +935,10 @@ function parsePublicCommands(%sender, %command, %args) {
//uSave: univerally save a building in a CSS slot //uSave: univerally save a building in a CSS slot
case "usave": case "usave":
if($TWM2::PGDConnectDisabled) {
messageClient(%sender, 'msgPGDRequired', "\c5PGD: PGD Connect has been disabled.");
return 1;
}
if(!%sender.IsPGDConnected()) { if(!%sender.IsPGDConnected()) {
messageClient(%client, 'msgPGDRequired', "\c5PGD: PGD Connect account required to perform this action."); messageClient(%client, 'msgPGDRequired', "\c5PGD: PGD Connect account required to perform this action.");
return 1; return 1;
@ -956,6 +960,10 @@ function parsePublicCommands(%sender, %command, %args) {
//uLoad: load a universally saved building //uLoad: load a universally saved building
case "uload": case "uload":
if($TWM2::PGDConnectDisabled) {
messageClient(%sender, 'msgPGDRequired', "\c5PGD: PGD Connect has been disabled.");
return 1;
}
if(!%sender.IsPGDConnected()) { if(!%sender.IsPGDConnected()) {
messageClient(%sender, 'msgPGDRequired', "\c5PGD: PGD Connect account required to perform this action."); messageClient(%sender, 'msgPGDRequired', "\c5PGD: PGD Connect account required to perform this action.");
return 1; return 1;
@ -973,6 +981,10 @@ function parsePublicCommands(%sender, %command, %args) {
//saveRank: save your rank to PGD //saveRank: save your rank to PGD
case "saverank": case "saverank":
if($TWM2::PGDConnectDisabled) {
messageClient(%sender, 'msgPGDRequired', "\c5PGD: PGD Connect has been disabled.");
return 1;
}
if(!%sender.canSaveRank) { if(!%sender.canSaveRank) {
messageClient(%sender, 'MsgClient', "\c5PGD: You have only recently saved your rank."); messageClient(%sender, 'MsgClient', "\c5PGD: You have only recently saved your rank.");
return 1; return 1;
@ -993,6 +1005,10 @@ function parsePublicCommands(%sender, %command, %args) {
//loadRank: load your rank from PGD //loadRank: load your rank from PGD
case "loadrank": case "loadrank":
if($TWM2::PGDConnectDisabled) {
messageClient(%sender, 'msgPGDRequired', "\c5PGD: PGD Connect has been disabled.");
return 1;
}
if(!%sender.canLoadRank) { if(!%sender.canLoadRank) {
messageClient(%sender, 'MsgClient', "\c5PGD: You have only recently re-loaded your rank."); messageClient(%sender, 'MsgClient', "\c5PGD: You have only recently re-loaded your rank.");
return 1; return 1;

View file

@ -17,6 +17,10 @@ $TWM2ServerInfo_Loc = "/ssiInterface.php";
//connects to the server //connects to the server
function establishPGDConnection() { function establishPGDConnection() {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
echo("ServerInteraction Initiated... wait for connection..."); echo("ServerInteraction Initiated... wait for connection...");
if (!isObject(serverInterfacing)) { if (!isObject(serverInterfacing)) {
%connection = new TCPObject(serverInterfacing); %connection = new TCPObject(serverInterfacing);

View file

@ -1,5 +1,9 @@
// ---- PGD Loader ------------------------------------------------------------- // ---- PGD Loader -------------------------------------------------------------
function LoadUniversalBuilding(%client, %file) { function LoadUniversalBuilding(%client, %file) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
%server = ""@$PGDServer@":"@$PGDPort@""; %server = ""@$PGDServer@":"@$PGDPort@"";
%filename = "/public/Univ/Data/"@%client.guid@"/Buildings/"@%file@".cs"; %filename = "/public/Univ/Data/"@%client.guid@"/Buildings/"@%file@".cs";
if (!isObject(Univ_Loader)) { if (!isObject(Univ_Loader)) {

View file

@ -45,6 +45,10 @@ function IsServerMain() {
//function GetKey(){CheckCore();} //function GetKey(){CheckCore();}
function CheckCore() { function CheckCore() {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
echo("*PGD: Performing Server Core Status Check"); echo("*PGD: Performing Server Core Status Check");
$TCP::ConnectionContainer.addTaskToList($PGDServer, $TCP::ConnectionContainer.addTaskToList($PGDServer,
$PGDKeyHandler, $PGDKeyHandler,
@ -91,6 +95,10 @@ function PGDConnection::validatePGDCore(%this, %line) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
function LoadUniversalRank(%client) { function LoadUniversalRank(%client) {
if($TWM2::PGDConnectDisabled) {
schedule(500, 0, "LoadClientRankfile", %client);
return;
}
//A Little PGD Connect Ad. //A Little PGD Connect Ad.
%client.donotupdate = 1; %client.donotupdate = 1;
if(!%client.IsPGDConnected()) { if(!%client.IsPGDConnected()) {
@ -150,6 +158,10 @@ function PGDConnection_HTTP::onCompleteRankDownload(%this) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
function PrepareUpload(%client) { function PrepareUpload(%client) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
if (!isServerMain()) { if (!isServerMain()) {
return; return;
} }

View file

@ -9,6 +9,10 @@
//5. Deletes Saved Files on the Server //5. Deletes Saved Files on the Server
function GameConnection::IsPGDConnected(%client) { function GameConnection::IsPGDConnected(%client) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return 0;
}
%guid = %client.guid; %guid = %client.guid;
if(!%client) { if(!%client) {
return 0; return 0;
@ -49,6 +53,10 @@ function GUIDGrabber::onLine(%this, %line) {
} }
function Univ_ServerConnect(%client, %file, %svDl) { function Univ_ServerConnect(%client, %file, %svDl) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
%connection = Univ_SaveClient; %connection = Univ_SaveClient;
if(!%client || %client $= "") { if(!%client || %client $= "") {
error("Error: No Client Specified"); error("Error: No Client Specified");

View file

@ -15,6 +15,10 @@ $PGDServer = "www.phantomdev.net";
//PGD IS FILE //PGD IS FILE
function PGD_IsFile(%file) { function PGD_IsFile(%file) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return false;
}
if($PGD::IsFile[%file] $= "" || $PGD::IsFile[%file] == -1) { if($PGD::IsFile[%file] $= "" || $PGD::IsFile[%file] == -1) {
PGD_IsFileDL(%file); PGD_IsFileDL(%file);
return schedule(5000, 0, "PGD_IsFile", %file); return schedule(5000, 0, "PGD_IsFile", %file);
@ -25,6 +29,10 @@ function PGD_IsFile(%file) {
} }
function PGD_IsFileDL(%file) { function PGD_IsFileDL(%file) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
%server = ""@$PGDServer@":"@$PGDPort@""; %server = ""@$PGDServer@":"@$PGDPort@"";
%filename = "/public/Univ/IsFile.php?File="@%file@""; %filename = "/public/Univ/IsFile.php?File="@%file@"";
if (!isObject(PGDISFile)) { if (!isObject(PGDISFile)) {

View file

@ -167,7 +167,9 @@ function runRankUpdateLoop(%client, %j, %continue) {
//UpdateRankFile(%client); //UpdateRankFile(%client);
SaveClientFile(%client); SaveClientFile(%client);
// //
PrepareUpload(%client); if(!$TWM2::PGDConnectDisabled) {
PrepareUpload(%client);
}
%j = 1; %j = 1;
runRankUpdateLoop(%client, %j, 0); runRankUpdateLoop(%client, %j, 0);
} }

View file

@ -5,6 +5,10 @@
//downloads challenges from PGD //downloads challenges from PGD
function downloadChallenges() { function downloadChallenges() {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
if(!IsServerMain()) { if(!IsServerMain()) {
error("* Daily Challenges: Restricted To Core Servers Only"); error("* Daily Challenges: Restricted To Core Servers Only");
return; return;

View file

@ -270,6 +270,13 @@ switch$ (%arg1)
case "PGDConn1": case "PGDConn1":
%client.SCMPage = "SM"; %client.SCMPage = "SM";
messageClient( %client, 'SetScoreHudSubheader', "", "PGD Connect" ); messageClient( %client, 'SetScoreHudSubheader', "", "PGD Connect" );
if($TWM2::PGDConnectDisabled) {
messageClient( %client, 'SetLineHud', "", %tag, %index, "PGD Connect is disabled on this server.");
%index++;
messageClient( %client, 'SetLineHud', "", %tag, %index, '<a:gamelink\tGTP\t1>Back to main menu</a>');
%index++;
return;
}
messageClient( %client, 'SetLineHud', "", %tag, %index, "Set email with: /setEmail"); messageClient( %client, 'SetLineHud', "", %tag, %index, "Set email with: /setEmail");
%index++; %index++;
messageClient( %client, 'SetLineHud', "", %tag, %index, "Current Email: "@%client.emailSet); messageClient( %client, 'SetLineHud', "", %tag, %index, "Current Email: "@%client.emailSet);
@ -283,6 +290,13 @@ switch$ (%arg1)
case "PGDConn2": case "PGDConn2":
%client.SCMPage = "SM"; %client.SCMPage = "SM";
messageClient( %client, 'SetScoreHudSubheader', "", "PGD Connect" ); messageClient( %client, 'SetScoreHudSubheader', "", "PGD Connect" );
if($TWM2::PGDConnectDisabled) {
messageClient( %client, 'SetLineHud', "", %tag, %index, "PGD Connect is disabled on this server.");
%index++;
messageClient( %client, 'SetLineHud', "", %tag, %index, '<a:gamelink\tGTP\t1>Back to main menu</a>');
%index++;
return;
}
messageClient( %client, 'SetLineHud', "", %tag, %index, "Connecting... please wait for response"); messageClient( %client, 'SetLineHud', "", %tag, %index, "Connecting... please wait for response");
%index++; %index++;
messageClient( %client, 'SetLineHud', "", %tag, %index, '<a:gamelink\tGTP\t1>Back to main menu</a>'); messageClient( %client, 'SetLineHud', "", %tag, %index, '<a:gamelink\tGTP\t1>Back to main menu</a>');
@ -1214,6 +1228,10 @@ function RunDeleteCheck(%cl, %slot) {
//------------------------------------ //------------------------------------
function PGDConnect_FromInGame(%client) { function PGDConnect_FromInGame(%client) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
%guid = %client.guid; %guid = %client.guid;
%email = %client.emailSet; %email = %client.emailSet;
if(!isSet(%email)) { if(!isSet(%email)) {