doc for sleeve api

This commit is contained in:
Olivier Gagnon
2019-03-12 19:05:38 -04:00
committed by danielyxie
parent f8f4299ed5
commit b132efbded
16 changed files with 290 additions and 0 deletions
+38
View File
@@ -97,6 +97,7 @@ var hasCorporationSF = false, //Source-File 3
hasBladeburnerSF = false, //Source-File 6
hasBladeburner2079SF = false, //Source-File 7
hasWallStreetSF = false, //Source-File 8
hasSleeveSF = false, //Source-File 10
hasBn11SF = false; //Source-File 11
var singularitySFLvl=1, wallStreetSFLvl=1;
@@ -187,6 +188,7 @@ function initSingularitySFFlags() {
hasWallStreetSF = true;
wallStreetSFLvl = Player.sourceFiles[i].lvl;
}
if (Player.sourceFiles[i].n === 10) {hasSleeveSF = true;}
if (Player.sourceFiles[i].n === 11) {hasBn11SF = true;}
}
}
@@ -4815,6 +4817,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("getNumSleeves", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "getNumSleeves() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("getNumSleeves", CONSTANTS.ScriptSleeveBaseRamCost);
return Player.sleeves.length;
},
@@ -4822,6 +4827,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("shockRecovery", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "shockRecovery() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("shockRecovery", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.shockRecovery(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4834,6 +4842,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("synchronize", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "synchronize() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("synchronize", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.synchronize(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4846,6 +4857,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("commitCrime", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "commitCrime() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("commitCrime", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.commitCrime(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4858,6 +4872,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("takeUniversityCourse", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "takeUniversityCourse() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("takeUniversityCourse", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.takeUniversityCourse(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4870,6 +4887,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("travel", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "travel() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("travel", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.travel(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4882,6 +4902,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("workForCompany", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "workForCompany() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("workForCompany", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.workForCompany(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4894,6 +4917,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("workForFaction", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "workForFaction() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("workForFaction", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.workForFaction(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4906,6 +4932,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "workoutAtGym() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.workoutAtGym(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4918,6 +4947,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "getStats() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.workoutAtGym(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4940,6 +4972,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("getTask", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "getTask() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("getTask", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.getTask(${sleeveNumber}) failed because it is an invalid sleeve number.`);
@@ -4959,6 +4994,9 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {
return updateStaticRam("getInformation", CONSTANTS.ScriptSleeveBaseRamCost);
}
if (Player.bitNodeN !== 10 && !hasSleeveSF) {
throw makeRuntimeRejectMsg(workerScript, "getInformation() failed because you do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10");
}
updateDynamicRam("getInformation", CONSTANTS.ScriptSleeveBaseRamCost);
if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {
workerScript.log(`ERROR: sleeve.getInformation(${sleeveNumber}) failed because it is an invalid sleeve number.`);