mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
Fixed various Coding Contract bugs. Added getContractType() to coding contract API
This commit is contained in:
@@ -4085,17 +4085,35 @@ function NetscriptFunctions(workerScript) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getContractType : function(fn, ip=workerScript.serverIp) {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getContractType", CONSTANTS.ScriptCodingContractBaseRamCost / 2);
|
||||
}
|
||||
updateDynamicRam("getContractType", CONSTANTS.ScriptCodingContractBaseRamCost / 2);
|
||||
let contract = getCodingContract(fn, ip);
|
||||
if (contract == null) {
|
||||
workerScript.log(`ERROR: codingcontract.getData() failed because it could find the specified contract ${fn} on server ${ip}`);
|
||||
return null;
|
||||
}
|
||||
return contract.getType();
|
||||
},
|
||||
getData : function(fn, ip=workerScript.serverIp) {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getData", CONSTANTS.ScriptCodingContractBaseRamCost / 2);
|
||||
}
|
||||
updateDynamicRam("getData", CONSTANTS.ScriptCodingContractBaseRamCost / 2);
|
||||
var contract = getCodingContract(fn, ip);
|
||||
let contract = getCodingContract(fn, ip);
|
||||
if (contract == null) {
|
||||
workerScript.log(`ERROR: codingcontract.getData() failed because it could find the specified contract ${fn} on server ${ip}`);
|
||||
return null;
|
||||
}
|
||||
return contract.getData();
|
||||
let data = contract.getData();
|
||||
if (typeof data === "object") {
|
||||
// Pass a copy
|
||||
return data.slice();
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
getDescription : function(fn, ip=workerScript.serverIp) {
|
||||
if (workerScript.checkingRam) {
|
||||
|
||||
Reference in New Issue
Block a user