Added Options button to top right overview. Script object optimization by deleting server maps when not active. Fixed issue with servers getting negative money

This commit is contained in:
Daniel Xie
2017-06-13 10:58:31 -05:00
parent 6b2d6b5ded
commit 69d4af01ff
8 changed files with 50 additions and 30 deletions
+14 -16
View File
@@ -372,8 +372,20 @@ scriptCalculateOfflineProduction = function(script) {
//4 hours (14400 sec) then we are completely confident in its ability
var confidence = (script.onlineRunningTime) / 14400;
if (confidence >= 1) {confidence = 1;}
console.log("onlineRunningTime: " + script.onlineRunningTime);
console.log("Confidence: " + confidence);
//Grow
for (var ip in script.numTimesGrowMap) {
if (script.numTimesGrowMap.hasOwnProperty(ip)) {
if (script.numTimesGrowMap[ip] == 0 || script.numTimesGrowMap[ip] == null) {continue;}
var serv = AllServers[ip];
if (serv == null) {continue;}
var timesGrown = Math.round(0.5 * script.numTimesGrowMap[ip] / script.onlineRunningTime * timePassed);
console.log(script.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
script.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
var growth = processSingleServerGrowth(serv, timesGrown * 450);
script.log(serv.hostname + " grown by " + formatNumber(growth * 100 - 100, 6) + "% from grow() calls made while offline");
}
}
var totalOfflineProduction = 0;
for (var ip in script.moneyStolenMap) {
@@ -433,20 +445,6 @@ scriptCalculateOfflineProduction = function(script) {
}
}
//Grow
for (var ip in script.numTimesGrowMap) {
if (script.numTimesGrowMap.hasOwnProperty(ip)) {
if (script.numTimesGrowMap[ip] == 0 || script.numTimesGrowMap[ip] == null) {continue;}
var serv = AllServers[ip];
if (serv == null) {continue;}
var timesGrown = Math.round(0.5 * script.numTimesGrowMap[ip] / script.onlineRunningTime * timePassed);
console.log(script.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
script.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
var growth = processSingleServerGrowth(serv, timesGrown * 450);
script.log(serv.hostname + " grown by " + formatNumber(growth * 100 - 100, 6) + "% from grow() calls made while offline");
}
}
return totalOfflineProduction;
}