mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 16:52:55 +02:00
Added threading capabilities when running manually. Need to add for run(0 and exec() in netscript. Also fixed some bugs
This commit is contained in:
+8
-6
@@ -126,6 +126,8 @@ function Script() {
|
||||
this.numTimesHackMap = new AllServersMap();
|
||||
this.numTimesGrowMap = new AllServersMap();
|
||||
this.numTimesWeakenMap = new AllServersMap();
|
||||
|
||||
this.threads = 1;
|
||||
};
|
||||
|
||||
//Get the script data from the Script Editor and save it to the object
|
||||
@@ -291,7 +293,7 @@ Script.prototype.displayLog = function() {
|
||||
}
|
||||
|
||||
//Update the moneyStolen and numTimesHack maps when hacking
|
||||
Script.prototype.recordHack = function(serverIp, moneyGained) {
|
||||
Script.prototype.recordHack = function(serverIp, moneyGained, n=1) {
|
||||
if (this.moneyStolenMap == null) {
|
||||
this.moneyStolenMap = new AllServersMap();
|
||||
}
|
||||
@@ -299,23 +301,23 @@ Script.prototype.recordHack = function(serverIp, moneyGained) {
|
||||
this.numTimesHackMap = new AllServersMap();
|
||||
}
|
||||
this.moneyStolenMap[serverIp] += moneyGained;
|
||||
this.numTimesHackMap[serverIp] += 1;
|
||||
this.numTimesHackMap[serverIp] += n;
|
||||
}
|
||||
|
||||
//Update the grow map when calling grow()
|
||||
Script.prototype.recordGrow = function(serverIp) {
|
||||
Script.prototype.recordGrow = function(serverIp, n=1) {
|
||||
if (this.numTimesGrowMap == null) {
|
||||
this.numTimesGrowMap = new AllServersMap();
|
||||
}
|
||||
this.numTimesGrowMap[serverIp] += 1;
|
||||
this.numTimesGrowMap[serverIp] += n;
|
||||
}
|
||||
|
||||
//Update the weaken map when calling weaken() {
|
||||
Script.prototype.recordWeaken = function(serverIp) {
|
||||
Script.prototype.recordWeaken = function(serverIp, n=1) {
|
||||
if (this.numTimesWeakenMap == null) {
|
||||
this.numTimesWeakenMap = new AllServersMap();
|
||||
}
|
||||
this.numTimesWeakenMap[serverIp] += 1;
|
||||
this.numTimesWeakenMap[serverIp] += n;
|
||||
}
|
||||
|
||||
Script.prototype.toJSON = function() {
|
||||
|
||||
Reference in New Issue
Block a user