From 8df7f8de4b3b86c1afcbed68a5fa651ec155d081 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 12 Mar 2019 03:40:48 -0400 Subject: [PATCH 1/7] basic sleeve api --- src/Constants.ts | 1 + src/NetscriptFunctions.js | 107 +++++++++++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/src/Constants.ts b/src/Constants.ts index cb34aeb8a..0a42627a6 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -90,6 +90,7 @@ export let CONSTANTS: IMap = { ScriptGetHackTimeRamCost: 0.05, ScriptGetFavorToDonate: 0.10, ScriptCodingContractBaseRamCost:10, + ScriptSleeveBaseRamCost: 0, // TODO: let big boss figure out balance. ScriptSingularityFn1RamCost: 1, ScriptSingularityFn2RamCost: 2, diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 38e6e3a7a..0f45bf5dc 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -4807,7 +4807,112 @@ function NetscriptFunctions(workerScript) { } return contract.getMaxNumTries() - contract.tries; }, - } + }, // End coding contracts + sleeve : { + getNumSleeves: function() { + if (workerScript.checkingRam) { + return updateStaticRam("getNumSleeves", CONSTANTS.ScriptSleeveBaseRamCost); + } + updateDynamicRam("getNumSleeves", CONSTANTS.ScriptSleeveBaseRamCost); + return Player.sleeves.length; + }, + shockRecovery : function(sleeveNumber=0) { + if (workerScript.checkingRam) { + return updateStaticRam("shockRecovery", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].shockRecovery(Player); + }, + synchronize : function(sleeveNumber=0) { + if (workerScript.checkingRam) { + return updateStaticRam("synchronize", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].synchronize(Player); + }, + commitCrime : function(sleeveNumber=0, crimeName="") { + if (workerScript.checkingRam) { + return updateStaticRam("commitCrime", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].commitCrime(Player, crimeName); + }, + takeUniversityCourse : function(sleeveNumber=0, universityName="", className="") { + if (workerScript.checkingRam) { + return updateStaticRam("takeUniversityCourse", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].takeUniversityCourse(Player, universityName, className); + }, + travel : function(sleeveNumber=0, cityName="") { + if (workerScript.checkingRam) { + return updateStaticRam("travel", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].travel(Player, cityName); + }, + workForCompany : function(sleeveNumber=0, companyName="") { + if (workerScript.checkingRam) { + return updateStaticRam("workForCompany", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].workForCompany(Player, companyName); + }, + workForFaction : function(sleeveNumber=0, factionName="", workType="") { + if (workerScript.checkingRam) { + return updateStaticRam("workForFaction", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].workForFaction(Player, factionName, workType); + }, + workoutAtGym : function(sleeveNumber=0, gymName="", stat="") { + if (workerScript.checkingRam) { + return updateStaticRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + return Player.sleeves[sleeveNumber].workoutAtGym(Player, gymName, stat); + }, + } // End sleeve } //End return } //End NetscriptFunction() From 060e0f7bfc37199680375f32e0facea84200150c Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 12 Mar 2019 03:46:54 -0400 Subject: [PATCH 2/7] get sync/shock --- src/NetscriptFunctions.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 0f45bf5dc..eaada6ee0 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -4828,6 +4828,18 @@ function NetscriptFunctions(workerScript) { return Player.sleeves[sleeveNumber].shockRecovery(Player); }, + getShock : function(sleeveNumber=0) { + if (workerScript.checkingRam) { + return updateStaticRam("getShock", CONSTANTS.ScriptSleeveBaseRamCost); + } + updateDynamicRam("getShock", CONSTANTS.ScriptSleeveBaseRamCost); + if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) { + workerScript.log(`ERROR: sleeve.getShock(${sleeveNumber}) failed because it is an invalid sleeve number.`); + return false; + } + + return Player.sleeves[sleeveNumber].shock; + }, synchronize : function(sleeveNumber=0) { if (workerScript.checkingRam) { return updateStaticRam("synchronize", CONSTANTS.ScriptSleeveBaseRamCost); @@ -4840,6 +4852,18 @@ function NetscriptFunctions(workerScript) { return Player.sleeves[sleeveNumber].synchronize(Player); }, + getSync : function(sleeveNumber=0) { + if (workerScript.checkingRam) { + return updateStaticRam("getSync", CONSTANTS.ScriptSleeveBaseRamCost); + } + updateDynamicRam("getSync", CONSTANTS.ScriptSleeveBaseRamCost); + if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) { + workerScript.log(`ERROR: sleeve.getSync(${sleeveNumber}) failed because it is an invalid sleeve number.`); + return false; + } + + return Player.sleeves[sleeveNumber].sync; + }, commitCrime : function(sleeveNumber=0, crimeName="") { if (workerScript.checkingRam) { return updateStaticRam("commitCrime", CONSTANTS.ScriptSleeveBaseRamCost); From 9f715020df63db5d59eca8c90f044367b93ff9f2 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 12 Mar 2019 03:53:29 -0400 Subject: [PATCH 3/7] syntax highlight some sleeve api --- src/ScriptEditor/AceNetscriptMode.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ScriptEditor/AceNetscriptMode.js b/src/ScriptEditor/AceNetscriptMode.js index f67e9e6a5..3c53ac4b1 100644 --- a/src/ScriptEditor/AceNetscriptMode.js +++ b/src/ScriptEditor/AceNetscriptMode.js @@ -125,7 +125,12 @@ let NetscriptFunctions = // Coding Contract API "codingcontract|attempt|getContractType|getData|getDescription|" + - "getNumTriesRemaining"; + "getNumTriesRemaining|" + + + // Sleeve API + "sleeve|getNumSleeves|shockRecovery|getShock|synchronize|" + + "getSync|commitCrime|takeUniversityCourse|travel|" + + "workForCompany|workForFaction|workoutAtGym"; var NetscriptHighlightRules = function(options) { var keywordMapper = this.createKeywordMapper({ From f8f4299ed5cb4cf1b296d0a456d38be985e1e556 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 12 Mar 2019 18:10:12 -0400 Subject: [PATCH 4/7] getInfo and getTask sleeve api --- src/NetscriptFunctions.js | 137 ++++++++++++++++++++++----- src/ScriptEditor/AceNetscriptMode.js | 6 +- 2 files changed, 115 insertions(+), 28 deletions(-) diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index eaada6ee0..4d573ae2e 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -28,6 +28,7 @@ import { Factions, factionExists } from "./Faction/Factions"; import { joinFaction, purchaseAugmentation } from "./Faction/FactionHelpers"; +import { FactionWorkType } from "./Faction/FactionWorkTypeEnum"; import { getCostOfNextHacknetNode, purchaseHacknet } from "./HacknetNode"; import {Locations} from "./Locations"; @@ -71,6 +72,7 @@ import {WorkerScript, workerScripts, import {makeRuntimeRejectMsg, netscriptDelay, runScriptFromScript} from "./NetscriptEvaluator"; import {NetscriptPort} from "./NetscriptPort"; +import {SleeveTaskType} from "./PersonObjects/Sleeve/SleeveTaskTypesEnum" import {Page, routing} from "./ui/navigationTracking"; import {numeralWrapper} from "./ui/numeralFormat"; @@ -4809,7 +4811,7 @@ function NetscriptFunctions(workerScript) { }, }, // End coding contracts sleeve : { - getNumSleeves: function() { + getNumSleeves : function() { if (workerScript.checkingRam) { return updateStaticRam("getNumSleeves", CONSTANTS.ScriptSleeveBaseRamCost); } @@ -4828,18 +4830,6 @@ function NetscriptFunctions(workerScript) { return Player.sleeves[sleeveNumber].shockRecovery(Player); }, - getShock : function(sleeveNumber=0) { - if (workerScript.checkingRam) { - return updateStaticRam("getShock", CONSTANTS.ScriptSleeveBaseRamCost); - } - updateDynamicRam("getShock", CONSTANTS.ScriptSleeveBaseRamCost); - if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) { - workerScript.log(`ERROR: sleeve.getShock(${sleeveNumber}) failed because it is an invalid sleeve number.`); - return false; - } - - return Player.sleeves[sleeveNumber].shock; - }, synchronize : function(sleeveNumber=0) { if (workerScript.checkingRam) { return updateStaticRam("synchronize", CONSTANTS.ScriptSleeveBaseRamCost); @@ -4852,18 +4842,6 @@ function NetscriptFunctions(workerScript) { return Player.sleeves[sleeveNumber].synchronize(Player); }, - getSync : function(sleeveNumber=0) { - if (workerScript.checkingRam) { - return updateStaticRam("getSync", CONSTANTS.ScriptSleeveBaseRamCost); - } - updateDynamicRam("getSync", CONSTANTS.ScriptSleeveBaseRamCost); - if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) { - workerScript.log(`ERROR: sleeve.getSync(${sleeveNumber}) failed because it is an invalid sleeve number.`); - return false; - } - - return Player.sleeves[sleeveNumber].sync; - }, commitCrime : function(sleeveNumber=0, crimeName="") { if (workerScript.checkingRam) { return updateStaticRam("commitCrime", CONSTANTS.ScriptSleeveBaseRamCost); @@ -4936,6 +4914,115 @@ function NetscriptFunctions(workerScript) { return Player.sleeves[sleeveNumber].workoutAtGym(Player, gymName, stat); }, + getStats : function(sleeveNumber=0) { + if (workerScript.checkingRam) { + return updateStaticRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + const sl = Player.sleeves[i]; + return { + shock: sl.shock, + sync: sl.sync, + hacking_skill: sl.hacking_skill, + strength: sl.strength, + defense: sl.defense, + dexterity: sl.dexterity, + agility: sl.agility, + charisma: sl.charisma, + }; + }, + getTask : function(sleeveNumber=0) { + if (workerScript.checkingRam) { + return updateStaticRam("getTask", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + const sl = Player.sleeves[sleeveNumber]; + return { + task: SleeveTaskType[sl.currentTask], + crime: sl.crimeType, + location: sl.currentTaskLocation, + gymStatType: sl.gymStatType, + factionWorkType: FactionWorkType[sl.factionWorkType], + }; + }, + getInformation : function(sleeveNumber=0) { + if (workerScript.checkingRam) { + return updateStaticRam("getInformation", CONSTANTS.ScriptSleeveBaseRamCost); + } + 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.`); + return false; + } + + const sl = Player.sleeves[sleeveNumber]; + return { + city: sl.city, + hp: sl.hp, + jobs: Object.keys(Player.jobs), // technically sleeves have the same jobs as the player. + jobTitle: Object.values(Player.jobs), + maxHp: sl.max_hp, + tor: SpecialServerIps.hasOwnProperty("Darkweb Server"), // There's no reason not to give that infomation here as well. Worst case scenario it isn't used. + + mult: { + agility: sl.agility_mult, + agilityExp: sl.agility_exp_mult, + companyRep: sl.company_rep_mult, + crimeMoney: sl.crime_money_mult, + crimeSuccess: sl.crime_success_mult, + defense: sl.defense_mult, + defenseExp: sl.defense_exp_mult, + dexterity: sl.dexterity_mult, + dexterityExp: sl.dexterity_exp_mult, + factionRep: sl.faction_rep_mult, + hacking: sl.hacking_mult, + hackingExp: sl.hacking_exp_mult, + strength: sl.strength_mult, + strengthExp: sl.strength_exp_mult, + workMoney: sl.work_money_mult, + }, + + timeWorked: sl.currentTaskTime, + earningsForSleeves : { + workHackExpGain: sl.earningsForSleeves.hack, + workStrExpGain: sl.earningsForSleeves.str, + workDefExpGain: sl.earningsForSleeves.def, + workDexExpGain: sl.earningsForSleeves.dex, + workAgiExpGain: sl.earningsForSleeves.agi, + workChaExpGain: sl.earningsForSleeves.cha, + workMoneyGain: sl.earningsForSleeves.money, + }, + earningsForPlayer : { + workHackExpGain: sl.earningsForPlayer.hack, + workStrExpGain: sl.earningsForPlayer.str, + workDefExpGain: sl.earningsForPlayer.def, + workDexExpGain: sl.earningsForPlayer.dex, + workAgiExpGain: sl.earningsForPlayer.agi, + workChaExpGain: sl.earningsForPlayer.cha, + workMoneyGain: sl.earningsForPlayer.money, + }, + earningsForTask : { + workHackExpGain: sl.earningsForTask.hack, + workStrExpGain: sl.earningsForTask.str, + workDefExpGain: sl.earningsForTask.def, + workDexExpGain: sl.earningsForTask.dex, + workAgiExpGain: sl.earningsForTask.agi, + workChaExpGain: sl.earningsForTask.cha, + workMoneyGain: sl.earningsForTask.money, + }, + workRepGain: sl.getRepGain(), + } + }, } // End sleeve } //End return } //End NetscriptFunction() diff --git a/src/ScriptEditor/AceNetscriptMode.js b/src/ScriptEditor/AceNetscriptMode.js index 3c53ac4b1..70d7de56f 100644 --- a/src/ScriptEditor/AceNetscriptMode.js +++ b/src/ScriptEditor/AceNetscriptMode.js @@ -128,9 +128,9 @@ let NetscriptFunctions = "getNumTriesRemaining|" + // Sleeve API - "sleeve|getNumSleeves|shockRecovery|getShock|synchronize|" + - "getSync|commitCrime|takeUniversityCourse|travel|" + - "workForCompany|workForFaction|workoutAtGym"; + "sleeve|getNumSleeves|shockRecovery|synchronize|commitCrime|" + + "takeUniversityCourse|travel|workForCompany|workForFaction|workoutAtGym|" + + "getStats|getTask|getInformation"; var NetscriptHighlightRules = function(options) { var keywordMapper = this.createKeywordMapper({ From b132efbdedec08bffbdfbdb960b1b9476662a3f1 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 12 Mar 2019 19:05:38 -0400 Subject: [PATCH 5/7] doc for sleeve api --- doc/source/advancedgameplay/sourcefiles.rst | 1 + doc/source/netscript.rst | 1 + doc/source/netscript/netscriptsleeveapi.rst | 65 +++++++++++++++++++ .../netscript/sleeveapi/commitCrime.rst | 11 ++++ .../netscript/sleeveapi/getInformation.rst | 65 +++++++++++++++++++ .../netscript/sleeveapi/getNumSleeves.rst | 6 ++ doc/source/netscript/sleeveapi/getStats.rst | 21 ++++++ doc/source/netscript/sleeveapi/getTask.rst | 18 +++++ .../netscript/sleeveapi/shockRecovery.rst | 8 +++ .../netscript/sleeveapi/synchronize.rst | 8 +++ .../sleeveapi/takeUniversityCourse.rst | 10 +++ doc/source/netscript/sleeveapi/travel.rst | 9 +++ .../netscript/sleeveapi/workForCompany.rst | 9 +++ .../netscript/sleeveapi/workForFaction.rst | 10 +++ .../netscript/sleeveapi/workoutAtGym.rst | 10 +++ src/NetscriptFunctions.js | 38 +++++++++++ 16 files changed, 290 insertions(+) create mode 100644 doc/source/netscript/netscriptsleeveapi.rst create mode 100644 doc/source/netscript/sleeveapi/commitCrime.rst create mode 100644 doc/source/netscript/sleeveapi/getInformation.rst create mode 100644 doc/source/netscript/sleeveapi/getNumSleeves.rst create mode 100644 doc/source/netscript/sleeveapi/getStats.rst create mode 100644 doc/source/netscript/sleeveapi/getTask.rst create mode 100644 doc/source/netscript/sleeveapi/shockRecovery.rst create mode 100644 doc/source/netscript/sleeveapi/synchronize.rst create mode 100644 doc/source/netscript/sleeveapi/takeUniversityCourse.rst create mode 100644 doc/source/netscript/sleeveapi/travel.rst create mode 100644 doc/source/netscript/sleeveapi/workForCompany.rst create mode 100644 doc/source/netscript/sleeveapi/workForFaction.rst create mode 100644 doc/source/netscript/sleeveapi/workoutAtGym.rst diff --git a/doc/source/advancedgameplay/sourcefiles.rst b/doc/source/advancedgameplay/sourcefiles.rst index bc7d46c91..b33bca7fa 100644 --- a/doc/source/advancedgameplay/sourcefiles.rst +++ b/doc/source/advancedgameplay/sourcefiles.rst @@ -48,6 +48,7 @@ List of all Source-Files | BitNode-9: Coming Soon | | +------------------------------------+-------------------------------------------------------------------------------------+ | BitNode-10: Digital Carbon | * Each level of this grants a Duplicate Sleeve | +| | * Allows the player to access the :ref:`netscript_sleeveapi` in other BitNodes | +------------------------------------+-------------------------------------------------------------------------------------+ | BitNode-11: The Big Crash | * Company favor increases both the player's salary and reputation gain at that | | | company by 1% per favor (rather than just the reputation gain) | diff --git a/doc/source/netscript.rst b/doc/source/netscript.rst index f2f1b9aa0..073d38323 100644 --- a/doc/source/netscript.rst +++ b/doc/source/netscript.rst @@ -29,4 +29,5 @@ to reach out to the developer! Bladeburner API Gang API Coding Contract API + Sleeve API Miscellaneous diff --git a/doc/source/netscript/netscriptsleeveapi.rst b/doc/source/netscript/netscriptsleeveapi.rst new file mode 100644 index 000000000..8f776b7b8 --- /dev/null +++ b/doc/source/netscript/netscriptsleeveapi.rst @@ -0,0 +1,65 @@ +.. _netscript_sleeveapi: + +Netscript Sleeve API +========================= +Netscript provides the following API for interacting with the game's Sleeve mechanic. + +The Sleeve API is **not** immediately available to the player and must be unlocked +later in the game. + +**WARNING: This page contains spoilers for the game** + +The Sleeve API is unlocked in BitNode-10. If you are in BitNode-10, you will +automatically gain access to this API. Otherwise, you must have Source-File 10 in +order to use this API in other BitNodes + +**Sleeve API functions must be accessed through the 'sleeve' namespace** + +In :ref:`netscript1`:: + + sleeve.synchronize(0); + sleeve.commitCrime(0, "shoplift"); + +In :ref:`netscriptjs`:: + + ns.sleeve.synchronize(0); + ns.sleeve.commitCrime(0, "shoplift"); + +.. toctree:: + :caption: Functions: + + commitCrime() + getNumSleeves() + getTask() + synchronize() + travel() + workForFaction() + getInformation() + getStats() + shockRecovery() + takeUniversityCourse() + workForCompany() + workoutAtGym() + + +Examples +-------- + +**Basic example usage**:: + + for(let i = 0; i < sleeve.getNumSleeves(); i++) { + sleeve.shockRecovery(i); + } + + await sleep(10*60*60); // wait 10h + + for(let i = 0; i < sleeve.getNumSleeves(); i++) { + sleeve.synchronize(i); + } + + await sleep(10*60*60); // wait 10h + + for(let i = 0; i < sleeve.getNumSleeves(); i++) { + sleeve.commitCrime(i, 'shoplift'); + } + diff --git a/doc/source/netscript/sleeveapi/commitCrime.rst b/doc/source/netscript/sleeveapi/commitCrime.rst new file mode 100644 index 000000000..7b8652f8a --- /dev/null +++ b/doc/source/netscript/sleeveapi/commitCrime.rst @@ -0,0 +1,11 @@ +commitCrime() Netscript Function +======================================= + +.. js:function:: commitCrime(sleeveNumber, name) + + :param int sleeveNumber: index of the sleeve to start commiting crime. + :param string name: Name of the crime. Must be an exact match. + + Return a boolean indicating whether or not this action was set successfully. + + Returns false if an invalid action is specified. diff --git a/doc/source/netscript/sleeveapi/getInformation.rst b/doc/source/netscript/sleeveapi/getInformation.rst new file mode 100644 index 000000000..de11ec982 --- /dev/null +++ b/doc/source/netscript/sleeveapi/getInformation.rst @@ -0,0 +1,65 @@ +getInformation() Netscript Function +======================================= + +.. js:function:: getInformation(sleeveNumber) + + :param int sleeveNumber: index of the sleeve to retrieve information. + + Return a struct containing tons of information about this sleeve + +.. code-block:: javascript + + { + city: location of the sleeve, + hp: current hp of the sleeve, + maxHp: max hp of the sleeve, + jobs: jobs available to the sleeve, + jobTitle: job titles available to the sleeve, + tor: does this sleeve have access to the tor router, + mult: { + agility: agility multiplier, + agilityExp: agility exp multiplier, + companyRep: company reputation multiplier, + crimeMoney: crime money multiplier, + crimeSuccess: crime success chance multiplier, + defense: defense multiplier, + defenseExp: defense exp multiplier, + dexterity: dexterity multiplier, + dexterityExp: dexterity exp multiplier, + factionRep: faction reputation multiplier, + hacking: hacking skill multiplier, + hackingExp: hacking exp multiplier, + strength: strength multiplier, + strengthExp: strength exp multiplier, + workMoney: work money multiplier, + }, + timeWorked: time spent on the current task in milliseconds, + earningsForSleeves : { earnings synchronized to other sleeves + workHackExpGain: hacking exp gained from work, + workStrExpGain: strength exp gained from work, + workDefExpGain: defense exp gained from work, + workDexExpGain: dexterity exp gained from work, + workAgiExpGain: agility exp gained from work, + workChaExpGain: charisma exp gained from work, + workMoneyGain: money gained from work, + }, + earningsForPlayer : { earnings synchronized to the player + workHackExpGain: hacking exp gained from work, + workStrExpGain: strength exp gained from work, + workDefExpGain: defense exp gained from work, + workDexExpGain: dexterity exp gained from work, + workAgiExpGain: agility exp gained from work, + workChaExpGain: charisma exp gained from work, + workMoneyGain: money gained from work, + }, + earningsForTask : { earnings for this sleeve + workHackExpGain: hacking exp gained from work, + workStrExpGain: strength exp gained from work, + workDefExpGain: defense exp gained from work, + workDexExpGain: dexterity exp gained from work, + workAgiExpGain: agility exp gained from work, + workChaExpGain: charisma exp gained from work, + workMoneyGain: money gained from work, + }, + workRepGain: sl.getRepGain(), + } diff --git a/doc/source/netscript/sleeveapi/getNumSleeves.rst b/doc/source/netscript/sleeveapi/getNumSleeves.rst new file mode 100644 index 000000000..25640992c --- /dev/null +++ b/doc/source/netscript/sleeveapi/getNumSleeves.rst @@ -0,0 +1,6 @@ +getNumSleeves() Netscript Function +======================================= + +.. js:function:: getNumSleeves() + + Return the number of duplicate sleeves the player has. diff --git a/doc/source/netscript/sleeveapi/getStats.rst b/doc/source/netscript/sleeveapi/getStats.rst new file mode 100644 index 000000000..f121ae475 --- /dev/null +++ b/doc/source/netscript/sleeveapi/getStats.rst @@ -0,0 +1,21 @@ +getStats() Netscript Function +======================================= + +.. js:function:: getStatus(sleeveNumber) + + :param int sleeveNumber: index of the sleeve to get stats of. + + Return a structure containing the stats of the sleeve + +.. code-block:: javascript + + { + shock: current shock of the sleeve [0-1], + sync: current sync of the sleeve [0-1], + hacking_skill: current hacking skill of the sleeve, + strength: current strength of the sleeve, + defense: current defense of the sleeve, + dexterity: current dexterity of the sleeve, + agility: current agility of the sleeve, + charisma: current charisma of the sleeve, + } diff --git a/doc/source/netscript/sleeveapi/getTask.rst b/doc/source/netscript/sleeveapi/getTask.rst new file mode 100644 index 000000000..e380da629 --- /dev/null +++ b/doc/source/netscript/sleeveapi/getTask.rst @@ -0,0 +1,18 @@ +getTask() Netscript Function +======================================= + +.. js:function:: getTask(sleeveNumber) + + :param int sleeveNumber: index of the sleeve to retrieve task from. + + Return the current task that the sleeve is performing. type is set to "Idle" if the sleeve isn't doing anything + +.. code-block:: javascript + + { + task: number, // task type + crime: number, // crime currently attempting, if any + location: number, // location of the task, if any + gymStatType: number, // stat being trained at the gym, if any + factionWorkType: number, // faction work type being performed, if any + } diff --git a/doc/source/netscript/sleeveapi/shockRecovery.rst b/doc/source/netscript/sleeveapi/shockRecovery.rst new file mode 100644 index 000000000..d176030f7 --- /dev/null +++ b/doc/source/netscript/sleeveapi/shockRecovery.rst @@ -0,0 +1,8 @@ +shockRecovery() Netscript Function +======================================= + +.. js:function:: shockRecovery(sleeveNumber) + + :param int sleeveNumber: index of the sleeve to start recovery. + + Return a boolean indicating whether or not this action was set successfully. \ No newline at end of file diff --git a/doc/source/netscript/sleeveapi/synchronize.rst b/doc/source/netscript/sleeveapi/synchronize.rst new file mode 100644 index 000000000..41af0165d --- /dev/null +++ b/doc/source/netscript/sleeveapi/synchronize.rst @@ -0,0 +1,8 @@ +synchronize() Netscript Function +======================================= + +.. js:function:: synchronize(sleeveNumber) + + :param int sleeveNumber: index of the sleeve to start synchronizing. + + Return a boolean indicating whether or not this action was set successfully. \ No newline at end of file diff --git a/doc/source/netscript/sleeveapi/takeUniversityCourse.rst b/doc/source/netscript/sleeveapi/takeUniversityCourse.rst new file mode 100644 index 000000000..9a87648de --- /dev/null +++ b/doc/source/netscript/sleeveapi/takeUniversityCourse.rst @@ -0,0 +1,10 @@ +takeUniversityCourse() Netscript Function +======================================= + +.. js:function:: takeUniversityCourse(sleeveNumber, university, className) + + :param int sleeveNumber: index of the sleeve to start taking class. + :param string university: name of the university to attend. + :param string className: name of the class to follow. + + Return a boolean indicating whether or not this action was set successfully. \ No newline at end of file diff --git a/doc/source/netscript/sleeveapi/travel.rst b/doc/source/netscript/sleeveapi/travel.rst new file mode 100644 index 000000000..fdae988eb --- /dev/null +++ b/doc/source/netscript/sleeveapi/travel.rst @@ -0,0 +1,9 @@ +travel() Netscript Function +======================================= + +.. js:function:: travel(sleeveNumber, cityName) + + :param int sleeveNumber: index of the sleeve to travel. + :param string cityName: name of the destination city. + + Return a boolean indicating whether or not the sleeve reached destination. \ No newline at end of file diff --git a/doc/source/netscript/sleeveapi/workForCompany.rst b/doc/source/netscript/sleeveapi/workForCompany.rst new file mode 100644 index 000000000..301bc04a7 --- /dev/null +++ b/doc/source/netscript/sleeveapi/workForCompany.rst @@ -0,0 +1,9 @@ +workForCompany() Netscript Function +======================================= + +.. js:function:: workForCompany(sleeveNumber, companyName) + + :param int sleeveNumber: index of the sleeve to work for the company. + :param string companyName: name of the company to work for. + + Return a boolean indicating whether or not the sleeve started working or this company. \ No newline at end of file diff --git a/doc/source/netscript/sleeveapi/workForFaction.rst b/doc/source/netscript/sleeveapi/workForFaction.rst new file mode 100644 index 000000000..2b94e99dd --- /dev/null +++ b/doc/source/netscript/sleeveapi/workForFaction.rst @@ -0,0 +1,10 @@ +workForFaction() Netscript Function +======================================= + +.. js:function:: workForFaction(sleeveNumber, factionName, factionWorkType) + + :param int sleeveNumber: index of the sleeve to work for the faction. + :param string factionName: name of the faction to work for. + :param string factionWorkType: name of the action to perform for this faction. + + Return a boolean indicating whether or not the sleeve started working or this faction. \ No newline at end of file diff --git a/doc/source/netscript/sleeveapi/workoutAtGym.rst b/doc/source/netscript/sleeveapi/workoutAtGym.rst new file mode 100644 index 000000000..f1207bc7a --- /dev/null +++ b/doc/source/netscript/sleeveapi/workoutAtGym.rst @@ -0,0 +1,10 @@ +workoutAtGym() Netscript Function +======================================= + +.. js:function:: workoutAtGym(sleeveNumber, gymName, stat) + + :param int sleeveNumber: index of the sleeve to workout at the gym. + :param string gymName: name of the gym. + :param string stat: name of the stat to train. + + Return a boolean indicating whether or not the sleeve started working out. \ No newline at end of file diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 4d573ae2e..2a06d7747 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -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.`); From 261abdea78faa0e08f6292c4acd4555d711add6a Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 12 Mar 2019 19:32:20 -0400 Subject: [PATCH 6/7] typo in sleeve getTask doc --- doc/source/netscript/sleeveapi/getTask.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/netscript/sleeveapi/getTask.rst b/doc/source/netscript/sleeveapi/getTask.rst index e380da629..025ee045a 100644 --- a/doc/source/netscript/sleeveapi/getTask.rst +++ b/doc/source/netscript/sleeveapi/getTask.rst @@ -10,9 +10,9 @@ getTask() Netscript Function .. code-block:: javascript { - task: number, // task type - crime: number, // crime currently attempting, if any - location: number, // location of the task, if any - gymStatType: number, // stat being trained at the gym, if any - factionWorkType: number, // faction work type being performed, if any + task: string, // task type + crime: string, // crime currently attempting, if any + location: string, // location of the task, if any + gymStatType: string, // stat being trained at the gym, if any + factionWorkType: string, // faction work type being performed, if any } From 08136524bea3681da199be37fc1699daf0e5f68e Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 12 Mar 2019 19:35:44 -0400 Subject: [PATCH 7/7] use SourceFileFlags instead of hasSleeveSF --- src/NetscriptFunctions.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 2a06d7747..a417f199e 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -61,6 +61,7 @@ import {StockMarket, StockSymbols, SymbolToStockMap, PositionTypes, placeOrder, cancelOrder} from "./StockMarket/StockMarket"; import { getStockmarket4SDataCost, getStockMarket4STixApiCost } from "./StockMarket/StockMarketCosts"; +import { SourceFileFlags } from "./SourceFile/SourceFileFlags" import {TextFile, getTextFile, createTextFile} from "./TextFile"; import {unknownBladeburnerActionErrorMessage, @@ -97,7 +98,6 @@ 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; @@ -188,7 +188,6 @@ 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;} } } @@ -4817,7 +4816,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("getNumSleeves", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4827,7 +4826,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("shockRecovery", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4842,7 +4841,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("synchronize", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4857,7 +4856,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("commitCrime", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4872,7 +4871,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("takeUniversityCourse", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4887,7 +4886,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("travel", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4902,7 +4901,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("workForCompany", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4917,7 +4916,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("workForFaction", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4932,7 +4931,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4947,7 +4946,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("workoutAtGym", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4972,7 +4971,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("getTask", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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); @@ -4994,7 +4993,7 @@ function NetscriptFunctions(workerScript) { if (workerScript.checkingRam) { return updateStaticRam("getInformation", CONSTANTS.ScriptSleeveBaseRamCost); } - if (Player.bitNodeN !== 10 && !hasSleeveSF) { + if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) { 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);