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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -270,6 +270,13 @@ switch$ (%arg1)
case "PGDConn1":
%client.SCMPage = "SM";
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");
%index++;
messageClient( %client, 'SetLineHud', "", %tag, %index, "Current Email: "@%client.emailSet);
@ -283,6 +290,13 @@ switch$ (%arg1)
case "PGDConn2":
%client.SCMPage = "SM";
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");
%index++;
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) {
if($TWM2::PGDConnectDisabled) {
echo("PGD Connect is disabled.");
return;
}
%guid = %client.guid;
%email = %client.emailSet;
if(!isSet(%email)) {