diff --git a/doc/source/netscript/singularityfunctions/getCrimeStats.rst b/doc/source/netscript/singularityfunctions/getCrimeStats.rst new file mode 100644 index 000000000..46a22d4b6 --- /dev/null +++ b/doc/source/netscript/singularityfunctions/getCrimeStats.rst @@ -0,0 +1,37 @@ +getCrimeStats() Netscript Function +=================================== + +.. js:function:: getCrimeStats(crime) + + :RAM cost: 5 GB + + :param string crime: + Name of crime. Not case-sensitive. This argument is fairlyn lenient in terms of what inputs it accepts. + Check the documentation for the *commitCrime()* function for a list of example inputs. + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + :return The stats of the crime + + { + "difficulty": 0.2, + "karma": 0.25, + "kills": 0, + "money": 36000, + "name": "Mug", + "time": 4000, + "type": "mug someone", + "hacking_success_weight": 0, + "strength_success_weight": 1.5, + "defense_success_weight": 0.5, + "dexterity_success_weight": 1.5, + "agility_success_weight": 0.5, + "charisma_success_weight": 0, + "hacking_exp": 0, + "strength_exp": 3, + "defense_exp": 3, + "dexterity_exp": 3, + "agility_exp": 3, + "charisma_exp": 0, + "intelligence_exp": 0 + } diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 394ad35ea..e40c06186 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -197,6 +197,7 @@ export const RamCosts: IMap = { createProgram: () => RamCostConstants.ScriptSingularityFn3RamCost, commitCrime: () => RamCostConstants.ScriptSingularityFn3RamCost, getCrimeChance: () => RamCostConstants.ScriptSingularityFn3RamCost, + getCrimeStats: () => RamCostConstants.ScriptSingularityFn3RamCost, getOwnedAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost, getOwnedSourceFiles: () => RamCostConstants.ScriptSingularityFn3RamCost, getAugmentationsFromFaction: () => RamCostConstants.ScriptSingularityFn3RamCost, diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index c6a5e9ff7..acec50ca4 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -3332,6 +3332,22 @@ function NetscriptFunctions(workerScript) { return crime.successRate(Player); }, + getCrimeStats: function(crimeRoughName) { + updateDynamicRam("getCrimeStats", getRamCost("getCrimeStats")); + if (Player.bitNodeN !== 4) { + if (SourceFileFlags[4] <= 2) { + throw makeRuntimeRejectMsg(workerScript, "Cannot run getCrimeStats(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); + return; + } + } + + const crime = findCrime(crimeRoughName.toLowerCase()); + if(crime == null) { + throw makeRuntimeRejectMsg(workerScript, "Invalid crime passed into getCrimeStats(): " + crime); + } + + return Object.assign({}, crime); + }, getOwnedAugmentations: function(purchased=false) { updateDynamicRam("getOwnedAugmentations", getRamCost("getOwnedAugmentations")); if (Player.bitNodeN !== 4) { diff --git a/src/ScriptEditor/AceNetscriptMode.js b/src/ScriptEditor/AceNetscriptMode.js index e9c81dd98..054d30314 100644 --- a/src/ScriptEditor/AceNetscriptMode.js +++ b/src/ScriptEditor/AceNetscriptMode.js @@ -87,11 +87,11 @@ let NetscriptFunctions = "getCompanyFavor|stopAction|getFactionFavor|" + "getFavorToDonate|getFactionFavorGain|getCompanyFavorGain|" + "checkFactionInvitations|joinFaction|workForFaction|getFactionRep|" + - "donateToFaction|" + + "donateToFaction|getCrimeStats|" + "createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" + "getOwnedSourceFiles|getAugmentationsFromFaction|" + "getAugmentationPrereq|getAugmentationCost|purchaseAugmentation|" + - "softReset|installAugmentations|getAugmentationStats|" + + "softReset|installAugmentations|getAugmentationStats|" + // TIX API "getStockPrice|getStockPosition|getStockSymbols|getStockMaxShares|" +