From 141e94ef7cd029cc63c680a42d8f429edfa4b7bc Mon Sep 17 00:00:00 2001 From: Robert Fritzen Date: Tue, 17 Oct 2017 14:24:54 -0500 Subject: [PATCH] Address Rank Bug Fixed the bug where gaining more than 1 million EXP would result in loss of any exp over the one million mark. --- README.md | 4 ++- scripts/TWM2/Systems/AdvancedRankSystem.cs | 39 +++++++++++----------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d997a43..0d0b886 100644 --- a/README.md +++ b/README.md @@ -106,4 +106,6 @@ PLEASE NOTE: I've moved all old changelogs into the version_history folder. This * Stormrider * Re-did his ground detection script to "hopefully" eradicate those funny moments when he suicide bombs the ground, ending the fight * Lord Vardison - * Fixed an erraneous text prompt that would appear when the shadow rift detonated outside of WTF difficulty stating vardison had healed when in fact he did not \ No newline at end of file + * Fixed an erraneous text prompt that would appear when the shadow rift detonated outside of WTF difficulty stating vardison had healed when in fact he did not +* General Bug Fixes + * Addressed the issue when gaining more than 1 million EXP that would result in your total EXP being reset by the difference between 1 million exp and your current exp. \ No newline at end of file diff --git a/scripts/TWM2/Systems/AdvancedRankSystem.cs b/scripts/TWM2/Systems/AdvancedRankSystem.cs index 94744cb..1dcda22 100644 --- a/scripts/TWM2/Systems/AdvancedRankSystem.cs +++ b/scripts/TWM2/Systems/AdvancedRankSystem.cs @@ -88,34 +88,34 @@ function UpdateClientRank(%client) { } %scriptController = %client.TWM2Core; if($XPArray[%client] <= 0) { + $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); + // TWM2 3.9.2: If the total gain is more than 1 million, store the millions in a separate field. + %millions = mFloor($XPArray[%client] / 1000000); + %netLeft = $XPArray[%client] % 1000000; + // Once we capture the fields, reset this immediately so other gains are non gobbled into this. $XPArray[%client] = 0; + + %newNonMillions = %scriptController.xp + %netLeft; + if(%newNonMillions >= 1000000) { + %newNonMillions -= 1000000; + %millions++; + } + %newMillions = %scriptController.millionxp + %millions; + + %scriptController.millionxp = %newMillions; + %scriptController.xp += newNonMillions; + //End + checkForXPAwards(%client); %j = $Rank::RankCount; runRankUpdateLoop(%client, %j, 1); } @@ -152,8 +152,9 @@ function runRankUpdateLoop(%client, %j, %continue) { if(!$TWM2::PGDConnectDisabled) { PrepareUpload(%client); } - %j = 1; - runRankUpdateLoop(%client, %j, 0); + //Phantom139: 10/17/17: Why is this block here??? It's just a NOP on the next call... + //%j = 1; + //runRankUpdateLoop(%client, %j, 0); } } else {