All v0.26.0 changes

This commit is contained in:
danielyxie
2017-07-21 17:54:55 -05:00
parent e6b15ed4ab
commit e653b7b315
30 changed files with 1529 additions and 589 deletions
+9 -1
View File
@@ -187,6 +187,8 @@ function calculateRamUsage(codeCopy) {
numOccurrences(codeCopy, "sellStock(");
var scriptPurchaseServerCount = numOccurrences(codeCopy, "purchaseServer(");
var scriptRoundCount = numOccurrences(codeCopy, "round(");
var scriptWriteCount = numOccurrences(codeCopy, "write(");
var scriptReadCount = numOccurrences(codeCopy, "read(");
return baseRam +
((whileCount * CONSTANTS.ScriptWhileRamCost) +
@@ -224,7 +226,9 @@ function calculateRamUsage(codeCopy) {
(scriptGetStockCount * CONSTANTS.ScriptGetStockRamCost) +
(scriptBuySellStockCount * CONSTANTS.ScriptBuySellStockRamCost) +
(scriptPurchaseServerCount * CONSTANTS.ScriptPurchaseServerRamCost) +
(scriptRoundCount * CONSTANTS.ScriptRoundRamCost));
(scriptRoundCount * CONSTANTS.ScriptRoundRamCost) +
(scriptWriteCount * CONSTANTS.ScriptReadWriteRamCost) +
(scriptReadCount * CONSTANTS.ScriptReadWriteRamCost));
}
Script.prototype.toJSON = function() {
@@ -416,6 +420,10 @@ RunningScript.prototype.displayLog = function() {
post(this.logs[i]);
}
}
RunningScript.prototype.clearLog = function() {
this.logs.length = 0;
}
//Update the moneyStolen and numTimesHack maps when hacking
RunningScript.prototype.recordHack = function(serverIp, moneyGained, n=1) {