From fec522606f593b498d12628449f2d3172cb95745 Mon Sep 17 00:00:00 2001 From: Robert Fritzen Date: Sat, 1 Jul 2017 15:52:11 -0500 Subject: [PATCH] Bug fixes, removal of rank requirements on officer guns --- README.md | 4 +- scripts/TWM2/Systems/AdvancedRankSystem.cs | 139 +++++++++++---------- scripts/weapons/Other/PlasmaTorpedo.cs | 2 +- scripts/weapons/Pistols/CrimsonHawk.cs | 2 +- scripts/weapons/Rifles/PulseRifle.cs | 2 +- scripts/weapons/SMGs/PulseSMG.cs | 2 +- serverControl.cs | 3 - 7 files changed, 82 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 40395da..3c4140b 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ PLEASE NOTE: For the Legacy (Pre-GitHub Versions) Changelogs, please see LEGACY * Addressed the bug with Vardison 2.0 that made his Shadow Rift invincible * Removed two un-used game objects that were never completed, the Medal Seal and the UAV Control Panel * Removed a few erraneous exec calls to non-existent files in the mod load script +* Fixed a bug when users reached an EXP value over 1,000,000 that would cause all of the EXP to be processed additionally from 1,000,000 + * For example, let's say I was 900,001 and gained 100,000 EXP, I would be placed at 1,100,000 instead of the correct value of 1,000,001 * Depricated the F2 Inventory Screen (Nobody ever used this) * Fixed a few bugs in the F2 Menu * Incorrect links @@ -122,7 +124,7 @@ PLEASE NOTE: For the Legacy (Pre-GitHub Versions) Changelogs, please see LEGACY * Fixed a console warning bug caused by zombie objects despawning and then calling a scan method * Shifter Zombies now have a randomzied element in their teleport method * Fixed a code bug with Lord Yvex which caused his death pulse to be replaced by nightmare missiles -* Plasma Torpedo Cannon now requires officer level 9 (Was 4) +* Officer Weapons no longer require a rank to use, you only need to reach the officer level in question and you've got it! * Addressed the bug preventing the challenges for reaching officer ranks from completing * Weapon Balancing Pass * Grapple Hook diff --git a/scripts/TWM2/Systems/AdvancedRankSystem.cs b/scripts/TWM2/Systems/AdvancedRankSystem.cs index e9108e4..6571028 100644 --- a/scripts/TWM2/Systems/AdvancedRankSystem.cs +++ b/scripts/TWM2/Systems/AdvancedRankSystem.cs @@ -9,7 +9,7 @@ function LoadRanksBase() { } function CreateClientRankFile(%client) { - if(!isSet(%client)) { + if(!isSet(%client) || %client.guid $= "") { return; } if(%client.donotupdate) { @@ -44,72 +44,80 @@ function CreateClientRankFile(%client) { } function LoadClientRankfile(%client) { - %client.donotupdate = 0; - echo("Attempting To Load "@%client.namebase@"'s Ranks File"); - %file = ""@$TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave"; - if(!isFile(%file)) { - echo(""@%client.namebase@" does not have a save file, creating one."); - CreateClientRankFile(%client); - } - else { - LoadClientFile(%client); - } - //define a new script object for the client, if it does not yet exist - %soNAME = "Container_"@%client.guid@"/TWM2Client_"@%client.guid@""; - %object = nameToId(%soNAME); - if(!isObject(%object)) { - echo("TWM2 Rank/Setting Client Controller Object is non-existant, creating"); - %client.TWM2Core = new ScriptObject("TWM2Client_"@%client.guid) {}; - %client.container.add(%client.TWM2Core); - } - else { - echo("Found TWM2 Rank/Setting Client Controller for "@%client@" -> "@%object@""); - %client.TWM2Core = %object; - } - //Check Officer Challenges. - for(%i = %client.TWM2Core.officer; %i > 0; %i--) { - %oChN = "Prestige"@%i; - CompleteNWChallenge(%client, %oChN); - } - TWM2Lib_MainControl("PlayerTimeLoop", %client); //post load functions + if(!isSet(%client) || %client.guide $= "") { + messageClient(%player.client, 'LeaveMissionArea', '\c1Alert: No GUID detected on your client object, please re-connect to the server...~wfx/misc/warning_beep.wav'); + return; + } + %client.donotupdate = 0; + echo("Attempting To Load "@%client.namebase@"'s Ranks File"); + %file = ""@$TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave"; + if(!isFile(%file)) { + echo(""@%client.namebase@" does not have a save file, creating one."); + CreateClientRankFile(%client); + } + else { + LoadClientFile(%client); + } + //define a new script object for the client, if it does not yet exist + %soNAME = "Container_"@%client.guid@"/TWM2Client_"@%client.guid@""; + %object = nameToId(%soNAME); + if(!isObject(%object)) { + echo("TWM2 Rank/Setting Client Controller Object is non-existant, creating"); + %client.TWM2Core = new ScriptObject("TWM2Client_"@%client.guid) {}; + %client.container.add(%client.TWM2Core); + } + else { + echo("Found TWM2 Rank/Setting Client Controller for "@%client@" -> "@%object@""); + %client.TWM2Core = %object; + } + //Check Officer Challenges. + for(%i = %client.TWM2Core.officer; %i > 0; %i--) { + %oChN = "Prestige"@%i; + CompleteNWChallenge(%client, %oChN); + } + TWM2Lib_MainControl("PlayerTimeLoop", %client); //post load functions } function UpdateClientRank(%client) { - if(!isSet(%client) || %client.guid $= "") { - return; - } - if(%client.donotupdate) { - echo("Stopped rank up check on "@%client@", server denies access (probably loading univ rank)"); - return; - } - %scriptController = %client.TWM2Core; - if($XPArray[%client] <= 0) { - return; //kill it here, no need to go into the loop - } - if(%scriptController.officer $= "") { - %scriptController.officer = 0; - } - //anti-Hack system. - %file = ""@$TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave"; - //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")))]; - if(!isSet(%multi) || %multi < 1) { - %multi = 1; - } - // convert it to second form - if(!isSet(%scriptController.millionxp)) { - %scriptController.millionxp = 0; - } - if((%scriptController.xp + $XPArray[%client]) >= 1000000) { - %scriptController.xp = 0; - %scriptController.millionxp++; - } - %scriptController.xp += $XPArray[%client]; + if(!isSet(%client) || %client.guid $= "") { + return; + } + if(%client.donotupdate) { + echo("Stopped rank up check on "@%client@", server denies access (probably loading univ rank)"); + return; + } + %scriptController = %client.TWM2Core; + if($XPArray[%client] <= 0) { + return; //kill it here, no need to go into the loop + } + if(%scriptController.officer $= "") { + %scriptController.officer = 0; + } + %file = ""@$TWM::RanksDirectory@"/"@%client.guid@"/Saved.TWMSave"; + //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")))]; + if(!isSet(%multi) || %multi < 1) { + %multi = 1; + } + // convert it to second form + if(!isSet(%scriptController.millionxp)) { + %scriptController.millionxp = 0; + } + if((%scriptController.xp + $XPArray[%client]) >= 1000000) { + %scriptController.xp = 0; + %scriptController.millionxp++; + $XPArray[%client] = (%scriptController.xp + $XPArray[%client]) - 1000000; + if($XPArray[%client] < 0) { + //Hmmm.... something wierd going on here... + $XPArray[%client] = 0; + } + } + %scriptController.xp += $XPArray[%client]; - checkForXPAwards(%client); - $XPArray[%client] = 0; - %j = $Rank::RankCount; - runRankUpdateLoop(%client, %j, 1); + checkForXPAwards(%client); + $XPArray[%client] = 0; + %j = $Rank::RankCount; + runRankUpdateLoop(%client, %j, 1); } function runRankUpdateLoop(%client, %j, %continue) { @@ -136,6 +144,9 @@ function runRankUpdateLoop(%client, %j, %continue) { 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 ); echo("Promotion: "@%name@" to Rank "@$Ranks::NewRank[%j]@", XP: "@getCurrentEXP(%client)@"."); + if(%j == $Rank::RankCount && %scriptController.officer < $OfficerCap[$TWM2Core_Code, sha1sum(formattimestring("yymmdd"))]) { + messageclient(%client, 'Msgclient', "\c5Congratulations, you have reached the maximum rank in TWM2 and have unlocked the ability to enter an officer rank. To proceed, open the [F2] menu and select the Settings option."); + } SaveClientFile(%client); // if(!$TWM2::PGDConnectDisabled) { @@ -294,7 +305,7 @@ function GainExperience(%client, %variable, %tagToGain) { %variable = mFloor(%variable); // if(%multi > 1) { - messageClient(%client, 'msgClient', "\c5TWM2: "@%tagToGain@"\c3+"@%variable@" EXP (X"@%multi@")"); + messageClient(%client, 'msgClient', "\c5TWM2: "@%tagToGain@"\c3+"@%variable@" EXP (Bonus Multiplier: "@%multi@")"); } else { messageClient(%client, 'msgClient', "\c5TWM2: "@%tagToGain@"\c3+"@%variable@" EXP"); diff --git a/scripts/weapons/Other/PlasmaTorpedo.cs b/scripts/weapons/Other/PlasmaTorpedo.cs index d72c793..055f365 100644 --- a/scripts/weapons/Other/PlasmaTorpedo.cs +++ b/scripts/weapons/Other/PlasmaTorpedo.cs @@ -50,7 +50,7 @@ datablock ShapeBaseImageData(PlasmaTorpedoImage) { emap = true; - RankRequire = $TWM2::RankRequire["SCD343"]; + //RankRequire = $TWM2::RankRequire["SCD343"]; PrestigeRequire = 9; HasChallenges = 1; diff --git a/scripts/weapons/Pistols/CrimsonHawk.cs b/scripts/weapons/Pistols/CrimsonHawk.cs index cd1ad91..1b7ac09 100644 --- a/scripts/weapons/Pistols/CrimsonHawk.cs +++ b/scripts/weapons/Pistols/CrimsonHawk.cs @@ -90,7 +90,7 @@ datablock ShapeBaseImageData(CrimsonHawkImage) HellClipCount = 10; // - RankRequire = $TWM2::RankRequire["CrimsonHawk"]; + //RankRequire = $TWM2::RankRequire["CrimsonHawk"]; PrestigeRequire = 5; //Challenges diff --git a/scripts/weapons/Rifles/PulseRifle.cs b/scripts/weapons/Rifles/PulseRifle.cs index 1a0f565..966fd4f 100644 --- a/scripts/weapons/Rifles/PulseRifle.cs +++ b/scripts/weapons/Rifles/PulseRifle.cs @@ -87,7 +87,7 @@ datablock ShapeBaseImageData(PulseRifleImage) GunName = "Pulse Semi-Automatic Rifle"; // - RankRequire = $TWM2::RankRequire["G41"]; + //RankRequire = $TWM2::RankRequire["G41"]; PrestigeRequire = 2; casing = ShellDebris; diff --git a/scripts/weapons/SMGs/PulseSMG.cs b/scripts/weapons/SMGs/PulseSMG.cs index 4d6f748..90f2967 100644 --- a/scripts/weapons/SMGs/PulseSMG.cs +++ b/scripts/weapons/SMGs/PulseSMG.cs @@ -94,7 +94,7 @@ datablock ShapeBaseImageData(PulseSMGImage) Upgrade[3] = "Silencer"; GunName = "Pulse SMG"; - RankRequire = $TWM2::RankRequire["Pg700"]; + //RankRequire = $TWM2::RankRequire["Pg700"]; PrestigeRequire = 3; casing = ShellDebris; diff --git a/serverControl.cs b/serverControl.cs index 276aaab..74d028e 100644 --- a/serverControl.cs +++ b/serverControl.cs @@ -156,7 +156,6 @@ $TWM2::BossName["GoL"] = "The Ghost Of Lightning"; $TWM2::BossName["Vegenor"] = "General Vegenor"; $TWM2::BossName["Insignia"] = "Major Insignia"; $TWM2::BossName["Vardison"] = "Lord Vardison"; -$TWM2::BossName["DAVardison"] = "Dark Archmage Vardison"; $TWM2::BossName["Trevor"] = "Lordranius Trevor"; $TWM2::BossName["GoF"] = CollapseEscape("\c7The Ghost Of Fire"); $TWM2::BossName["Stormrider"] = "Commander Stormrider"; @@ -204,7 +203,6 @@ $TWM2::BossXPAward["Insignia"] = 35000; // 35000 $TWM2::BossXPAward["Stormrider"] = 45000; // 45000 $TWM2::BossXPAward["GhostOfFire"] = 65000; // 65000 $TWM2::BossXPAward["ShadeLord"] = 70000; // 70000 -$TWM2::BossXPAward["DAVardison"] = 75000; // 75000 $TWM2::BossXPAward["Vardison3"] = 75000; // 75000 $Host::UseDevelopersList = 1; @@ -261,7 +259,6 @@ $TWM2::RankRequire["M4A1"] = 15; $TWM2::RankRequire["SCD343"] = 59; $TWM2::RankRequire["P90"] = 56; $TWM2::RankRequire["ALSWP"] = 49; -$TWM2::RankRequire["CrimsonHawk"] = 61; $TWM2::RankRequire["Stinger"] = 30; $TWM2::RankRequire["MRXX"] = 35; $TWM2::RankRequire["NapalmLauncher"] = 42;