mirror of
https://github.com/PhantomGamesDevelopment/TWM2.git
synced 2026-01-19 19:44:47 +00:00
6/22 Changes
Changes from 6/22, print command adjustments, Universal support library-ification, and new rank file load script preventer.
This commit is contained in:
parent
81dd30a446
commit
c270a1c343
|
|
@ -1097,51 +1097,51 @@ function parsePublicCommands(%sender, %command, %args) {
|
||||||
|
|
||||||
//checkStats: check the current rank information on a player
|
//checkStats: check the current rank information on a player
|
||||||
case "checkstats":
|
case "checkstats":
|
||||||
%clientController = %sender.TWM2Core;
|
%clientController = %sender.TWM2Core;
|
||||||
%todaysDate = sha1sum(formattimestring("yymmdd"));
|
%todaysDate = sha1sum(formattimestring("yymmdd"));
|
||||||
if(%args $= "") {
|
if(%args $= "") {
|
||||||
if(%clientController.officer $= "") {
|
if(%clientController.officer $= "") {
|
||||||
%clientController.officer = 0;
|
%clientController.officer = 0;
|
||||||
}
|
}
|
||||||
%name = %sender.NameBase;
|
%name = %sender.NameBase;
|
||||||
%Rank = ""@$Prestige::Name[%clientController.officer]@""@%clientController.rank@"";
|
%Rank = ""@$Prestige::Name[%clientController.officer]@""@%clientController.rank@"";
|
||||||
%Stats = getCurrentEXP(%sender);
|
%Stats = getCurrentEXP(%sender);
|
||||||
for(%i = $Rank::RankCount; %i >= 0; %i--){
|
for(%i = $Rank::RankCount; %i >= 0; %i--){
|
||||||
if(%stats >= $Ranks::MinPoints[%i]){
|
if(%stats >= $Ranks::MinPoints[%i]){
|
||||||
%nextrank = ""@$Prestige::Name[%clientController.officer]@""@$Ranks::NewRank[(%i + 1)]@"";
|
%nextrank = ""@$Prestige::Name[%clientController.officer]@""@$Ranks::NewRank[(%i + 1)]@"";
|
||||||
%nextrankXP = $Ranks::MinPoints[(%i + 1)];
|
%nextrankXP = $Ranks::MinPoints[(%i + 1)];
|
||||||
%i = 0;
|
%i = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(%Stats >= $Ranks::MinPoints[$Rank::RankCount]) {
|
if(%Stats >= $Ranks::MinPoints[$Rank::RankCount]) {
|
||||||
messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@", You Currently Have "@%stats@" XP, and you have gained "@%clientController.xpGain[%todaysDate]@" EXP today.");
|
messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@", You Currently Have "@printCurrentEXP(%sender)@" XP.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@", You Currently Have "@%stats@" XP, and you have gained "@%clientController.xpGain[%todaysDate]@" EXP today. Your next rank is "@%nextrank@" and you need "@(%nextrankXP - %stats)@" XP.");
|
messageClient(%sender, 'MsgClient', "\c2Your Rank is "@%Rank@", You Currently Have "@printCurrentEXP(%sender)@" XP. Your next rank is "@%nextrank@" and you need "@(%nextrankXP - %stats)@" XP.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
%nametotest = getword(%args, 0);
|
%nametotest = getword(%args, 0);
|
||||||
%target = plnametocid(%nametotest);
|
%target = plnametocid(%nametotest);
|
||||||
if (%target==0) {
|
if (%target==0) {
|
||||||
messageclient(%sender, 'MsgClient', '\c2No such player.');
|
messageclient(%sender, 'MsgClient', '\c2No such player.');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
%targetController = %target.TWM2Core;
|
%targetController = %target.TWM2Core;
|
||||||
if(%targetController.officer $= "") {
|
if(%targetController.officer $= "") {
|
||||||
%targetController.officer = 0;
|
%targetController.officer = 0;
|
||||||
}
|
}
|
||||||
%Rank = ""@$Prestige::Name[%targetController.officer]@""@%targetController.rank@"";
|
%Rank = ""@$Prestige::Name[%targetController.officer]@""@%targetController.rank@"";
|
||||||
%Stats = getCurrentEXP(%target);
|
%Stats = printCurrentEXP(%target);
|
||||||
messageClient(%sender, 'MsgClient', "\c2"@%target.namebase@"'s Rank is "@%Rank@" and "@%target.namebase@"'s XP is "@%stats@".");
|
messageClient(%sender, 'MsgClient', "\c2"@%target.namebase@"'s Rank is "@%Rank@" and "@%target.namebase@"'s XP is "@%stats@".");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//setEmail: used for the PGD IGC interface
|
//setEmail: used for the PGD IGC interface
|
||||||
case "setemail":
|
case "setemail":
|
||||||
if(!isSet(%args)) {
|
if(!isSet(%args)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,7 @@ exec("scripts/TWM2/Systems/DChalg.cs"); //Daily Challenges
|
||||||
exec("scripts/TWM2/Systems/ArmorEnergyShields.cs"); //Armor Shields
|
exec("scripts/TWM2/Systems/ArmorEnergyShields.cs"); //Armor Shields
|
||||||
exec("scripts/TWM2/Systems/Store.cs"); //Mula
|
exec("scripts/TWM2/Systems/Store.cs"); //Mula
|
||||||
exec("scripts/TWM2/Systems/weaponModes.cs"); //Global Defines for Weapon Modes
|
exec("scripts/TWM2/Systems/weaponModes.cs"); //Global Defines for Weapon Modes
|
||||||
|
|
||||||
exec("scripts/TWM2/AI/DroneAI.cs"); //Drones
|
exec("scripts/TWM2/AI/DroneAI.cs"); //Drones
|
||||||
|
|
||||||
exec("scripts/TWM2/Objects/MissileSatellite.cs"); //Missile Satellite
|
|
||||||
exec("scripts/TWM2/Systems/HarbingersWrath.cs"); //Harbinger's Wrath
|
exec("scripts/TWM2/Systems/HarbingersWrath.cs"); //Harbinger's Wrath
|
||||||
|
|
||||||
//Mod Dependancies
|
//Mod Dependancies
|
||||||
|
|
|
||||||
|
|
@ -23,16 +23,17 @@ function LoadUniversalBuilding(%client, %file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Univ_Loader::onLine(%this, %line) {
|
function Univ_Loader::onLine(%this, %line) {
|
||||||
%validity = ScanForValidLine(%line);
|
%validity = TWM2Lib_PGDConnect_Support("fileValidator_Building", %line);
|
||||||
if(!%validity) {
|
if(!%validity) {
|
||||||
messageClient(%this.client, 'MsgClient', "\c5PGD: ERROR, you are requesting a corrupted file.");
|
error("Building load validity check failed for "@ %this.client.namebase @" ("@%this.client@"), client may be attempting to load unfriendly code.");
|
||||||
messageClient(%this.client, 'MsgClient', "\c5Corrupted files contain custom content not signed by the server.");
|
messageClient(%this.client, 'MsgClient', "\c5PGD: ERROR, you are requesting a corrupted file.");
|
||||||
messageClient(%this.client, 'MsgClient', "\c5ABORTING CONNECTION.");
|
messageClient(%this.client, 'MsgClient', "\c5Corrupted files contain custom content not signed by the server.");
|
||||||
%this.valid = 0;
|
messageClient(%this.client, 'MsgClient', "\c5ABORTING CONNECTION.");
|
||||||
%this.disconnect();
|
%this.valid = 0;
|
||||||
return;
|
%this.disconnect();
|
||||||
}
|
return;
|
||||||
$PGDBuffer[%this.client, %this.load] = $PGDBuffer[%this.client, %this.load] @ "\n" @ %line;
|
}
|
||||||
|
$PGDBuffer[%this.client, %this.load] = $PGDBuffer[%this.client, %this.load] @ "\n" @ %line;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Univ_Loader::onConnectFailed(%this) {
|
function Univ_Loader::onConnectFailed(%this) {
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ function LoadUniversalRank(%client) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//IS FILE
|
//IS FILE
|
||||||
if(!PGD_IsFile("Data/"@%client.guid@"/Ranks/TWM2/Saved.TWMSave")) {
|
if(!TWM2Lib_PGDConnect_Support("isServerFile", "Data/"@%client.guid@"/Ranks/TWM2/Saved.TWMSave")) {
|
||||||
%client.donotupdate = 0;
|
%client.donotupdate = 0;
|
||||||
messageClient(%client, 'msgPGDRequired', "\c5PGD: PGD Connect confirms you do not have a universal rank.");
|
messageClient(%client, 'msgPGDRequired', "\c5PGD: PGD Connect confirms you do not have a universal rank.");
|
||||||
messageClient(%client, 'msgPGDRequired', "\c5PGD: Play on a |CORE| server to start progressing one today!");
|
messageClient(%client, 'msgPGDRequired', "\c5PGD: Play on a |CORE| server to start progressing one today!");
|
||||||
|
|
@ -133,22 +133,44 @@ function LoadUniversalRank(%client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PGDConnection_HTTP::onCompleteRankDownload(%this) {
|
function PGDConnection_HTTP::onCompleteRankDownload(%this) {
|
||||||
echo("download complete... evaluating and applying rank");
|
echo("download complete... evaluating and applying rank");
|
||||||
%client = %this.client;
|
%client = %this.client;
|
||||||
|
|
||||||
%fileO = new FileObject();
|
for (%i = 0; %i < $Buffer[%this]; %i++) {
|
||||||
%fileO.openForWrite($TWM::RanksDirectory@"/"@%this.client.guid@"/Saved.TWMSave");
|
//Scan the line
|
||||||
for (%i = 0; %i < $Buffer[%this]; %i++) {
|
if (!TWM2Lib_PGDConnect_Support("fileValidator_Rank", $Buffer[%this, %i])) {
|
||||||
%fileO.writeLine($Buffer[%this, %i]);
|
error("Rank load validity check failed for "@ %this.client.namebase @" ("@%this.client@"), client may be attempting to load unfriendly code.");
|
||||||
$Buffer[%this, %i] = "";
|
messageClient(%client, 'msgComplete', "\c3PGD Error: Your rank file has failed load validation, and cannot load...");
|
||||||
}
|
messageClient(%client, 'msgComplete', "\c3A backup copy of your file has been saved to the local server, please contact Phantom139 to address...");
|
||||||
$Buffer[%this] = 0;
|
messageClient(%client, 'msgComplete', "\c3In the mean time, a blank file has been created so you may continue playing...");
|
||||||
%fileO.close();
|
%fileOB = new FileObject();
|
||||||
%fileO.delete();
|
%fileOB.openForWrite($TWM::RanksDirectory@"/"@%this.client.guid@"/Backup_Corrupted.TWMSave");
|
||||||
|
for (%i = 0; %i < $Buffer[%this]; %i++) {
|
||||||
|
%fileOB.writeLine($Buffer[%this, %i]);
|
||||||
|
$Buffer[%this, %i] = "";
|
||||||
|
}
|
||||||
|
$Buffer[%this] = 0;
|
||||||
|
%fileOB.close();
|
||||||
|
%fileOB.delete();
|
||||||
|
%client.donotupdate = 0;
|
||||||
|
CreateClientRankFile(%client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%fileO = new FileObject();
|
||||||
|
%fileO.openForWrite($TWM::RanksDirectory@"/"@%this.client.guid@"/Saved.TWMSave");
|
||||||
|
for (%i = 0; %i < $Buffer[%this]; %i++) {
|
||||||
|
%fileO.writeLine($Buffer[%this, %i]);
|
||||||
|
$Buffer[%this, %i] = "";
|
||||||
|
}
|
||||||
|
$Buffer[%this] = 0;
|
||||||
|
%fileO.close();
|
||||||
|
%fileO.delete();
|
||||||
|
|
||||||
schedule(100, 0, LoadClientRankFile, %client);
|
schedule(100, 0, LoadClientRankFile, %client);
|
||||||
|
|
||||||
messageClient(%client, 'msgComplete', "\c3PGD: Your rank has been successfully downloaded.");
|
messageClient(%client, 'msgComplete', "\c3PGD: Your rank has been successfully downloaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
@ -184,7 +206,7 @@ function TCPConnectionList::GeneratePGDUploadRequest(%this) {
|
||||||
%client = %this.client;
|
%client = %this.client;
|
||||||
%file = $TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave";
|
%file = $TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave";
|
||||||
%fileBase = FileBase(%file) @ ".TWMSave";
|
%fileBase = FileBase(%file) @ ".TWMSave";
|
||||||
%fileCont = getFileContents(%file);
|
%fileCont = TWM2Lib_PGDConnect_Support("fileContents", %file);
|
||||||
|
|
||||||
%user = getField($TWM2::PGDCredentials, 0);
|
%user = getField($TWM2::PGDCredentials, 0);
|
||||||
%password = getField($TWM2::PGDCredentials, 1);
|
%password = getField($TWM2::PGDCredentials, 1);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ function Univ_ServerConnect(%client, %file, %svDl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
%len = GetFileLength(%file);
|
%len = TWM2Lib_PGDConnect_Support("fileLength", %file);
|
||||||
%connection.orgfile = %file;
|
%connection.orgfile = %file;
|
||||||
%connection.file = %file; //what are we sending?
|
%connection.file = %file; //what are we sending?
|
||||||
%connection.filebase = FileBase(%file) @ ".cs";
|
%connection.filebase = FileBase(%file) @ ".cs";
|
||||||
|
|
@ -99,7 +99,7 @@ function Univ_SaveClient::onConnected(%this) {
|
||||||
%this.schedule(15000, "disconnect");
|
%this.schedule(15000, "disconnect");
|
||||||
if(%this.save == 1) {
|
if(%this.save == 1) {
|
||||||
%sep = getRandomSeparator(16);
|
%sep = getRandomSeparator(16);
|
||||||
%filecont = getFileContents(%this.orgfile);
|
%filecont = TWM2Lib_PGDConnect_Support("fileContents", %this.orgfile);
|
||||||
%loc = $PGDPHPUploadHandler;
|
%loc = $PGDPHPUploadHandler;
|
||||||
%header1 = "POST" SPC %loc SPC "HTTP/1.1\r\n";
|
%header1 = "POST" SPC %loc SPC "HTTP/1.1\r\n";
|
||||||
%host = "Host: "@$PGDServer@"\r\n";
|
%host = "Host: "@$PGDServer@"\r\n";
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
//Support Script, Allows this to work
|
//UniversalSupport.cs
|
||||||
//Updated 2.1, Signal360's Changes implemented
|
//PGD Connect support functions library
|
||||||
//Universal Ranks Implemented
|
//TWM2 3.9a Update, Library style function and new validation methods
|
||||||
|
//TWM2 2.1 Update, Signal360's Changes implemented
|
||||||
|
|
||||||
//We keep these files hidden so no outsiders can fuck with our stuff
|
//We keep these files hidden so no outsiders can mess with our stuff
|
||||||
$PGDPHPUploadHandler = "/public/Univ/Buildings/upload.php"; //no touchy
|
$PGDPHPUploadHandler = "/public/Univ/Buildings/upload.php"; //no touchy
|
||||||
$PGDPHPDelHandler = "/public/Univ/Buildings/delete.php?Filetokill=";
|
$PGDPHPDelHandler = "/public/Univ/Buildings/delete.php?Filetokill=";
|
||||||
$PGDKeyHandler = "/public/Univ/Ranks/key.php";
|
$PGDKeyHandler = "/public/Univ/Ranks/key.php";
|
||||||
|
|
@ -13,39 +14,109 @@ $PGDPHPRankUploadHandler = "/public/Univ/Ranks/upload.php";
|
||||||
$PGDPort = 80; //TCP
|
$PGDPort = 80; //TCP
|
||||||
$PGDServer = "www.phantomdev.net";
|
$PGDServer = "www.phantomdev.net";
|
||||||
|
|
||||||
//PGD IS FILE
|
function TWM2Lib_PGDConnect_Support(%functionName, %arg1, %arg2, %arg3, %arg4) {
|
||||||
function PGD_IsFile(%file) {
|
switch$(strlwr(%functionName)) {
|
||||||
if($TWM2::PGDConnectDisabled) {
|
case "isserverfile":
|
||||||
echo("PGD Connect is disabled.");
|
if ($TWM2::PGDConnectDisabled) {
|
||||||
return false;
|
echo("PGD Connect is disabled.");
|
||||||
}
|
return false;
|
||||||
if($PGD::IsFile[%file] $= "" || $PGD::IsFile[%file] == -1) {
|
}
|
||||||
PGD_IsFileDL(%file);
|
%file = %arg1;
|
||||||
return schedule(5000, 0, "PGD_IsFile", %file);
|
if ($PGD::IsFile[%file] $= "" || $PGD::IsFile[%file] == -1) {
|
||||||
}
|
TWM2Lib_PGDConnect_Support("performFileCheck", %file);
|
||||||
else {
|
return schedule(5000, 0, "TWM2Lib_PGDConnect_Support", "isServerFile", %file);
|
||||||
return $PGD::IsFile[%file];
|
}
|
||||||
}
|
else {
|
||||||
}
|
return $PGD::IsFile[%file];
|
||||||
|
}
|
||||||
function PGD_IsFileDL(%file) {
|
|
||||||
if($TWM2::PGDConnectDisabled) {
|
case "performfilecheck":
|
||||||
echo("PGD Connect is disabled.");
|
if ($TWM2::PGDConnectDisabled) {
|
||||||
return;
|
echo("PGD Connect is disabled.");
|
||||||
}
|
return;
|
||||||
%server = ""@$PGDServer@":"@$PGDPort@"";
|
}
|
||||||
%filename = "/public/Univ/IsFile.php?File="@%file@"";
|
%file = %arg1;
|
||||||
if (!isObject(PGDISFile)) {
|
%server = $PGDServer@":"@$PGDPort;
|
||||||
%Downloader = new HTTPObject(PGDISFile){};
|
%filename = "/public/Univ/IsFile.php?File="@%file;
|
||||||
}
|
if (!isObject(PGDISFile)) {
|
||||||
else {
|
%Downloader = new HTTPObject(PGDISFile) { };
|
||||||
%Downloader = PGDISFile;
|
}
|
||||||
}
|
else {
|
||||||
%Downloader.File = %file;
|
%Downloader = PGDISFile;
|
||||||
echo("Getting");
|
}
|
||||||
%Downloader.get(%server, %filename);
|
%Downloader.File = %file;
|
||||||
|
echo("Connecting to PGD, testing file "@ %file);
|
||||||
|
%Downloader.get(%server, %filename);
|
||||||
|
|
||||||
|
case "filelength":
|
||||||
|
%file = %arg1;
|
||||||
|
new fileobject(LengthReader);
|
||||||
|
LengthReader.openforread(%file);
|
||||||
|
%bool = 0;
|
||||||
|
while (!%bool) {
|
||||||
|
%bool = LengthReader.isEOF();
|
||||||
|
%Msg = LengthReader.readLine();
|
||||||
|
$message = $message@"\n"@%Msg;
|
||||||
|
}
|
||||||
|
%count = strLen($message);
|
||||||
|
$message = "";
|
||||||
|
return %count;
|
||||||
|
|
||||||
|
case "filecontents":
|
||||||
|
%file = %arg1;
|
||||||
|
new fileobject(filereader);
|
||||||
|
filereader.openforread(%file);
|
||||||
|
%bool = 0;
|
||||||
|
while (!%bool) {
|
||||||
|
%bool = filereader.isEOF();
|
||||||
|
%Msgget = filereader.readLine();
|
||||||
|
%msg = %msg @ "\n" @ %Msgget;
|
||||||
|
}
|
||||||
|
return %msg;
|
||||||
|
|
||||||
|
case "filevalidator_building":
|
||||||
|
%line = %arg1;
|
||||||
|
if (getsubstr(%line, 0, 2) $= "//") {
|
||||||
|
//commented lines like this cannot possibly deliver custom content.
|
||||||
|
//thus they must be alloted.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (getsubstr(trim(%line), 0, 1) $= "") {
|
||||||
|
//Blank lines are completely harmless
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (getsubstr(%line, 0, 29) $= "%building = new (StaticShape)" ||
|
||||||
|
getsubstr(%line, 0, 32) $= "%building = new (ForceFieldBare)" ||
|
||||||
|
getsubstr(%line, 0, 24) $= "%building = new (Turret)" ||
|
||||||
|
getsubstr(%line, 0, 30) $= "%building = new (BeaconObject)") {
|
||||||
|
//this is our official line check, if it's a building DB line
|
||||||
|
//it is safe, and valid.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//this line has been tampered with, and is invalid.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "filevalidator_rank":
|
||||||
|
%line = %arg1;
|
||||||
|
%trimmed = strlwr(stripChars(trim(%line), " "));
|
||||||
|
if(getsubstr(%trimmed, 0, 7) $= "phrase=" || getsubstr(%trimmed, 0, 2) $= "//") {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!strStr(%line, "function") || !strStr(%line, "eval") || !strStr(%line, "call") || !strStr(%line, "schedule")) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
error("TWM2Lib_PGDConnect_Support(): error, unknown function "@ %functionName @" called.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//PGDISFILE Object Functions
|
||||||
function PGDISFile::onLine(%this, %line) {
|
function PGDISFile::onLine(%this, %line) {
|
||||||
echo(%line);
|
echo(%line);
|
||||||
if(strStr(%line, "Not") != -1) {
|
if(strStr(%line, "Not") != -1) {
|
||||||
|
|
@ -72,57 +143,4 @@ function PGDISFile::onConnectFailed(%this) {
|
||||||
function PGDISFile::onDisconnect(%this) {
|
function PGDISFile::onDisconnect(%this) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//END
|
||||||
//END PGD IS FILE
|
|
||||||
|
|
||||||
function GetFileLength(%file) {
|
|
||||||
new fileobject(LengthReader);
|
|
||||||
LengthReader.openforread(%file);
|
|
||||||
%bool = 0;
|
|
||||||
while(!%bool) {
|
|
||||||
%bool = LengthReader.isEOF();
|
|
||||||
%Msg = LengthReader.readLine();
|
|
||||||
$message = ""@$message@"\n"@%Msg@"";
|
|
||||||
}
|
|
||||||
%count = strLen($message);
|
|
||||||
$message = "";
|
|
||||||
return %count;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileContents(%file) {
|
|
||||||
new fileobject(filereader);
|
|
||||||
filereader.openforread(%file);
|
|
||||||
%bool = 0;
|
|
||||||
while(!%bool) {
|
|
||||||
%bool = filereader.isEOF();
|
|
||||||
%Msgget = filereader.readLine();
|
|
||||||
%msg = ""@%msg@""NL""@%Msgget@"";
|
|
||||||
}
|
|
||||||
return %msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
//added 2.4
|
|
||||||
//Prevent custom (unwanted) content in universal loads
|
|
||||||
function ScanForValidLine(%line) {
|
|
||||||
if (getsubstr(%line, 0, 2) $= "//") {
|
|
||||||
//commented lines like this cannot possibly deliver custom content.
|
|
||||||
//thus they must be alloted.
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if(getsubstr(trim(%line), 0, 1) $= "") {
|
|
||||||
//Blank lines are completely harmless
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if(getsubstr(%line, 0, 29) $= "%building = new (StaticShape)" ||
|
|
||||||
getsubstr(%line, 0, 32) $= "%building = new (ForceFieldBare)" ||
|
|
||||||
getsubstr(%line, 0, 24) $= "%building = new (Turret)" ||
|
|
||||||
getsubstr(%line, 0, 30) $= "%building = new (BeaconObject)") {
|
|
||||||
//this is our official line check, if it's a building DB line
|
|
||||||
//it is safe, and valid.
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//this line has been tampered with, and is invalid.
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -87,7 +87,6 @@ function UpdateClientRank(%client) {
|
||||||
%scriptController.officer = 0;
|
%scriptController.officer = 0;
|
||||||
}
|
}
|
||||||
//anti-Hack system.
|
//anti-Hack system.
|
||||||
%todaysDate = sha1sum(formattimestring("yymmdd"));
|
|
||||||
%file = ""@$TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave";
|
%file = ""@$TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave";
|
||||||
//If I ever do so implement an EXP cap, here is where it is placed
|
//If I ever do so implement an EXP cap, here is where it is placed
|
||||||
%multi = $EXPMulti[$TWM2Core_Code, formattimestring("yymmdd"), sha1sum($TWM2Core_Code TAB TWM2Lib_MainControl("FormatTWM2Time", formattimestring("yymmdd")))];
|
%multi = $EXPMulti[$TWM2Core_Code, formattimestring("yymmdd"), sha1sum($TWM2Core_Code TAB TWM2Lib_MainControl("FormatTWM2Time", formattimestring("yymmdd")))];
|
||||||
|
|
@ -103,8 +102,7 @@ function UpdateClientRank(%client) {
|
||||||
%scriptController.millionxp++;
|
%scriptController.millionxp++;
|
||||||
}
|
}
|
||||||
%scriptController.xp += $XPArray[%client];
|
%scriptController.xp += $XPArray[%client];
|
||||||
//%scriptController.xpGain[%todaysDate] += $XPArray[%client]; //Phantom139: Removed daily EXP Cap (TWM2 3.9)
|
|
||||||
//%scriptController.save(%file);
|
|
||||||
checkForXPAwards(%client);
|
checkForXPAwards(%client);
|
||||||
$XPArray[%client] = 0;
|
$XPArray[%client] = 0;
|
||||||
%j = $Rank::RankCount;
|
%j = $Rank::RankCount;
|
||||||
|
|
@ -131,7 +129,7 @@ function runRankUpdateLoop(%client, %j, %continue) {
|
||||||
if($Prestige::Name[%scriptController.officer] >= 1) {
|
if($Prestige::Name[%scriptController.officer] >= 1) {
|
||||||
$Prestige::Name[%scriptController.officer] = "";
|
$Prestige::Name[%scriptController.officer] = "";
|
||||||
}
|
}
|
||||||
messageAll('msgclient',"\c2"@%name@" has become a "@$Prestige::Name[%scriptController.officer]@""@$Ranks::NewRank[%j]@" with a XP of "@getCurrentEXP(%client)@"!");
|
messageAll('msgclient',"\c2"@%name@" has become a "@$Prestige::Name[%scriptController.officer]@""@$Ranks::NewRank[%j]@" with a XP of "@printCurrentEXP(%client)@"!");
|
||||||
messageclient(%client, 'Msgclient', "~wfx/Bonuses/Nouns/General.wav");
|
messageclient(%client, 'Msgclient', "~wfx/Bonuses/Nouns/General.wav");
|
||||||
bottomPrint(%client, "Excelent work "@%name@", you have been promoted to the rank of: "@$Prestige::Name[%scriptController.officer]@""@$Ranks::NewRank[%j]@"!", 5, 2 );
|
bottomPrint(%client, "Excelent work "@%name@", you have been promoted to the rank of: "@$Prestige::Name[%scriptController.officer]@""@$Ranks::NewRank[%j]@"!", 5, 2 );
|
||||||
echo("Promotion: "@%name@" to Rank "@$Ranks::NewRank[%j]@", XP: "@getCurrentEXP(%client)@".");
|
echo("Promotion: "@%name@" to Rank "@$Ranks::NewRank[%j]@", XP: "@getCurrentEXP(%client)@".");
|
||||||
|
|
@ -207,6 +205,14 @@ function getCurrentEXP(%client) {
|
||||||
return %xp;
|
return %xp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function printCurrentEXP(%client) {
|
||||||
|
//print function shows a more readable version of EXP
|
||||||
|
%scriptController = %client.TWM2Core;
|
||||||
|
%milXP = %scriptController.millionxp;
|
||||||
|
%nonMilXP = %scriptControler.xp;
|
||||||
|
return %milXP @ "" @ %nonMilXP;
|
||||||
|
}
|
||||||
|
|
||||||
//PRESTIGE RANKS
|
//PRESTIGE RANKS
|
||||||
function PromoteToPrestige(%client) {
|
function PromoteToPrestige(%client) {
|
||||||
%scriptController = %client.TWM2Core;
|
%scriptController = %client.TWM2Core;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function TWM2Lib_MainControl(%functionName, %arguments) {
|
||||||
%client = %arguments;
|
%client = %arguments;
|
||||||
$XPArray[%client] = 0;
|
$XPArray[%client] = 0;
|
||||||
%client.CheckPGDConnect(); // <-- Used for Universal features
|
%client.CheckPGDConnect(); // <-- Used for Universal features
|
||||||
PGD_IsFileDL("Data/"@%client.guid@"/Ranks/TWM2/Saved.TWMSave");
|
TWM2Lib_PGDConnect_Support("performFileCheck", "Data/"@%client.guid@"/Ranks/TWM2/Saved.TWMSave");
|
||||||
schedule(5000, 0, "LoadUniversalRank", %client);
|
schedule(5000, 0, "LoadUniversalRank", %client);
|
||||||
|
|
||||||
setDefaultInventory(%client);
|
setDefaultInventory(%client);
|
||||||
|
|
|
||||||
|
|
@ -841,13 +841,13 @@ switch$ (%arg1)
|
||||||
case "RanksSM":
|
case "RanksSM":
|
||||||
messageClient( %client, 'SetScoreHudSubheader', "", ""@%arg2.namebase@"'s Stats Card" );
|
messageClient( %client, 'SetScoreHudSubheader', "", ""@%arg2.namebase@"'s Stats Card" );
|
||||||
%client.SCMPage = "SM";
|
%client.SCMPage = "SM";
|
||||||
%targetController = %arg2.TWM2Core;
|
%targetController = %arg2.TWM2Core;
|
||||||
//Specs
|
//Specs
|
||||||
if(%targetController.officer $= "") {
|
if(%targetController.officer $= "") {
|
||||||
%targetController.officer = 0;
|
%targetController.officer = 0;
|
||||||
}
|
}
|
||||||
%rank = ""@$Prestige::Name[%targetController.officer]@""@%targetController.rank@"";
|
%rank = ""@$Prestige::Name[%targetController.officer]@""@%targetController.rank@"";
|
||||||
%XP = ((%targetController.millionxp) * 1000000) + %targetController.xp;
|
%XP = printCurrentEXP(%arg2);
|
||||||
%mula = %targetController.money;
|
%mula = %targetController.money;
|
||||||
%phrs = %targetController.phrase;
|
%phrs = %targetController.phrase;
|
||||||
%gmeTime = %targetController.gameTime;
|
%gmeTime = %targetController.gameTime;
|
||||||
|
|
|
||||||
|
|
@ -7,48 +7,48 @@ package loadmodinfo
|
||||||
{
|
{
|
||||||
|
|
||||||
function GetTipMessage() {
|
function GetTipMessage() {
|
||||||
%r = getRandom(1,19);
|
%r = getRandom(1,19);
|
||||||
switch(%r) {
|
switch(%r) {
|
||||||
case 1:
|
case 1:
|
||||||
%tip = "Watch the sniper trails, the R700 Leaves a trail, so you can easily find the shooter.";
|
%tip = "High powered sniper rifles, such as the R700 leave a trail. This can help you to identify hostile snipers";
|
||||||
case 2:
|
case 2:
|
||||||
%tip = "Check your ammo! People with limited ammo on their primary weapons are more likely to be killed";
|
%tip = "Check your ammo! People with limited ammo on their weapons are more likely to be killed";
|
||||||
case 3:
|
case 3:
|
||||||
%tip = "Use /help to view commands. /Checkstats to view your Stats, and the [F2] Menu to check other info";
|
%tip = "Use /help to view commands. /Checkstats to view your Stats, and the [F2] Menu to check other info";
|
||||||
case 4:
|
case 4:
|
||||||
%tip = "To level up, Kill enemies and zombies. Killing teammates holds a harsh penalty! Use /checkstats to see your info";
|
%tip = "Want to unlock new gear? Level up by defeating enemy combatants, or securing combat medals through tough tasks";
|
||||||
case 5:
|
case 5:
|
||||||
%tip = "The easiest way to deal with a zombie lord is to deliver a head shot with a sniper rifle.";
|
%tip = "Got zombie problems? Aim high! One shot to the head with a strong enough weapon will dispatch of most enemy combatants";
|
||||||
case 6:
|
case 6:
|
||||||
%tip = "To check what weapons you can use. Open up your [F2] Menu and select weapons information";
|
%tip = "Looking to earn a lot of XP points? Invite some of your friends and take on the bosses of TWM2 for large EXP sums";
|
||||||
case 7:
|
case 7:
|
||||||
%tip = "Beware Demon Lord Zombies! They are quick, decisive, and are armed with many abilities";
|
%tip = "Be sure to frequently access the [F2] menu, additional player setting options such as perks and killstreaks can be found inside";
|
||||||
case 8:
|
case 8:
|
||||||
%tip = "Prioritize your tasks! Focus on the greatest threats to you first";
|
%tip = "Prioritize your tasks! Focus on the greatest threats to you first";
|
||||||
case 9:
|
case 9:
|
||||||
%tip = "Watch your flanks in sabotage, if you have the bomb, you are visible to everyone, including the enemy";
|
%tip = "Watch your flanks in sabotage, if you have the bomb, you are visible to everyone, including the enemy";
|
||||||
case 10:
|
case 10:
|
||||||
%tip = "What weapons will work best for you? check out the Weapons information in your [F2] Menu";
|
%tip = "What weapons will work best for you? check out the weapons information tab in your [F2] Menu";
|
||||||
case 11:
|
case 11:
|
||||||
%tip = "Enemies coming in a group? use the C4 Mines to blow them all up";
|
%tip = "Large groups taking you on? Try using advanced equipment such as Satchel Charges, Mines, and C4 to dwindle enemy numbers";
|
||||||
case 12:
|
case 12:
|
||||||
%tip = "Challenges are good! Complete them to unlock vehicles, weapon attachments, and more!";
|
%tip = "Try to tackle individual challenges at a time, challenges sometimes have unique awards such as weapons, armors, and even vehicles!";
|
||||||
case 13:
|
case 13:
|
||||||
%tip = "Ultra Drones, Killers of the SKY. To kill them, stay out of the sky, hit them with SAM's";
|
%tip = "Ultra Drones are expert airhunters and should not be triffled with, if one is giving you problems, try using SAM weapons";
|
||||||
case 14:
|
case 14:
|
||||||
%tip = "Bothered by enemy vehicles? Grab the Javalin, and blast those suckers";
|
%tip = "Got vehicle problems? Try using a weapon like the Stinger or Javelin to pound it with heavy explosive damage";
|
||||||
case 15:
|
case 15:
|
||||||
%tip = "Infected? use your health kit, it comes preloaded with an infection cure";
|
%tip = "Zombie got you infected? use your health kit or the medic pack, both of which have a built in infection cure";
|
||||||
case 16:
|
case 16:
|
||||||
%tip = "XP Points are earned differently by killing players and zombies, stronger enemies give more XP.";
|
%tip = "XP Points are earned differently by killing players and zombies, stronger enemies give more XP.";
|
||||||
case 17:
|
case 17:
|
||||||
%tip = "When do I get a certian weapon? check the [F2] Menu to find that out";
|
%tip = "Want to know when you're going to unlock that next piece of sweet gear? Check out the weapon information page in the [F2] menu";
|
||||||
case 18:
|
case 18:
|
||||||
%tip = "Killstealing is bad, and should never be done, protection is enabled in horde/helljump to block those theives!";
|
%tip = "Killstealing is bad, and should never be done, protection is enabled in horde/helljump to block those theives!";
|
||||||
case 19:
|
case 19:
|
||||||
%tip = "Perks and Killstreaks can be set in the [F2] Menu by clicking Settings and then the respective category";
|
%tip = "Air rapiers sometimes spell doom once grabbed, but if you aim directly up with a strong enough weapon, you can escape their lethal grasp!";
|
||||||
}
|
}
|
||||||
return %tip;
|
return %tip;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendLoadInfoToClient( %client ) {
|
function sendLoadInfoToClient( %client ) {
|
||||||
|
|
@ -72,8 +72,9 @@ package loadmodinfo
|
||||||
messageClient(%client, 'MsgDebriefResult', "", "<Font:Arial Bold:14><Just:CENTER>Server Type: "@%STO@"");
|
messageClient(%client, 'MsgDebriefResult', "", "<Font:Arial Bold:14><Just:CENTER>Server Type: "@%STO@"");
|
||||||
|
|
||||||
%Credits = "\n<Font:Arial:16>Version v"@$TWM2::ModVersionString@"" @
|
%Credits = "\n<Font:Arial:16>Version v"@$TWM2::ModVersionString@"" @
|
||||||
"\n<Font:Arial:14>TWM 2 Developer: Phantom139"@
|
"\n<Font:Arial:14>TWM 2 Creator (Lead Developer): Phantom139"@
|
||||||
"\n<Font:Arial:14>TWM 2 Co-Devs: Dark Dragon DX, DarknessOfLight, Signal360";
|
"\n<Font:Arial:14>TWM 2 Co-Devs: Dark Dragon DX, DarknessOfLight, and Signal360"@
|
||||||
|
"\n<Font:Arial:14>CCM Developers: Dondelium_X, FalconBlade, and Ur_A_Dum";
|
||||||
|
|
||||||
// this callback adds content to the bulk of the gui
|
// this callback adds content to the bulk of the gui
|
||||||
messageClient(%client, 'MsgDebriefAddLine', "", %Credits);
|
messageClient(%client, 'MsgDebriefAddLine', "", %Credits);
|
||||||
|
|
@ -83,15 +84,9 @@ package loadmodinfo
|
||||||
// this callback adds content to the bulk of the gui
|
// this callback adds content to the bulk of the gui
|
||||||
messageClient(%client, 'MsgDebriefAddLine', "", %Site);
|
messageClient(%client, 'MsgDebriefAddLine', "", %Site);
|
||||||
|
|
||||||
%Thanks = "\n<Font:Arial:14>Thanks: Thyth, -Linker-, Cons Mod Devs"@
|
%Thanks = "\n<Font:Arial:14>Additional Thanks: Thyth, -Linker-, Construction Mod Developers"@
|
||||||
"\n";
|
"\n";
|
||||||
messageClient(%client, 'MsgDebriefAddLine', "", %Thanks);
|
messageClient(%client, 'MsgDebriefAddLine', "", %Thanks);
|
||||||
|
|
||||||
%MoreCredits = "\n<Font:Arial:16>CCM Developer: Dondelium_X" @
|
|
||||||
"\n<Font:Arial:14>CCM Co-Devs: FalconBlade, Ur_A_Dum"@
|
|
||||||
"\n";
|
|
||||||
|
|
||||||
messageClient(%client, 'MsgDebriefAddLine', "", %MoreCredits);
|
|
||||||
|
|
||||||
if($Rank::Top[1] $= "") {
|
if($Rank::Top[1] $= "") {
|
||||||
%TopRanks = "\n<Font:Arial:14>Top 5 Ranks:" @
|
%TopRanks = "\n<Font:Arial:14>Top 5 Ranks:" @
|
||||||
|
|
@ -119,13 +114,13 @@ package loadmodinfo
|
||||||
"\n";
|
"\n";
|
||||||
messageClient(%client, 'MsgDebriefAddLine', "", %tipMsg);
|
messageClient(%client, 'MsgDebriefAddLine', "", %tipMsg);
|
||||||
|
|
||||||
%MOTDMsg = "\n<Font:Arial:14>Message Of The Day:" @
|
%MOTDMsg = "\n<Font:Arial:14>Server Message Of The Day:" @
|
||||||
"\n<Font:Arial:12>"@$Server::MOTD@"."@
|
"\n<Font:Arial:12>"@$Server::MOTD@"."@
|
||||||
"\n\n\n";
|
"\n\n\n";
|
||||||
messageClient(%client, 'MsgDebriefAddLine', "", %MOTDMsg);
|
messageClient(%client, 'MsgDebriefAddLine', "", %MOTDMsg);
|
||||||
|
|
||||||
%PGDMsg = "\n<Font:Arial:14>Join the Phantom Games Development community for up to the minute news on TWM2 and our other projects! " @
|
%PGDMsg = "\n<Font:Arial:14>Join the Phantom Games Development community for up to the minute news on TWM2 and our other projects! " @
|
||||||
"\n http://www.public.phantomdev.net";
|
"\n http://www.forums.phantomdev.net";
|
||||||
messageClient(%client, 'MsgDebriefAddLine', "", %PGDMsg);
|
messageClient(%client, 'MsgDebriefAddLine', "", %PGDMsg);
|
||||||
|
|
||||||
%gettingStarted = "\n<Font:Arial:14>First time playing TWM2? Use the /help command for a list of chat commands and access the " @
|
%gettingStarted = "\n<Font:Arial:14>First time playing TWM2? Use the /help command for a list of chat commands and access the " @
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue