getCrimeStats returns the inner stats of a crime

This commit is contained in:
Olivier Gagnon 2021-03-07 22:22:23 -05:00
parent 381ea915f7
commit e1aec379c1
4 changed files with 56 additions and 2 deletions

@ -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
}

@ -197,6 +197,7 @@ export const RamCosts: IMap<any> = {
createProgram: () => RamCostConstants.ScriptSingularityFn3RamCost, createProgram: () => RamCostConstants.ScriptSingularityFn3RamCost,
commitCrime: () => RamCostConstants.ScriptSingularityFn3RamCost, commitCrime: () => RamCostConstants.ScriptSingularityFn3RamCost,
getCrimeChance: () => RamCostConstants.ScriptSingularityFn3RamCost, getCrimeChance: () => RamCostConstants.ScriptSingularityFn3RamCost,
getCrimeStats: () => RamCostConstants.ScriptSingularityFn3RamCost,
getOwnedAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost, getOwnedAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost,
getOwnedSourceFiles: () => RamCostConstants.ScriptSingularityFn3RamCost, getOwnedSourceFiles: () => RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationsFromFaction: () => RamCostConstants.ScriptSingularityFn3RamCost, getAugmentationsFromFaction: () => RamCostConstants.ScriptSingularityFn3RamCost,

@ -3332,6 +3332,22 @@ function NetscriptFunctions(workerScript) {
return crime.successRate(Player); 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) { getOwnedAugmentations: function(purchased=false) {
updateDynamicRam("getOwnedAugmentations", getRamCost("getOwnedAugmentations")); updateDynamicRam("getOwnedAugmentations", getRamCost("getOwnedAugmentations"));
if (Player.bitNodeN !== 4) { if (Player.bitNodeN !== 4) {

@ -87,11 +87,11 @@ let NetscriptFunctions =
"getCompanyFavor|stopAction|getFactionFavor|" + "getCompanyFavor|stopAction|getFactionFavor|" +
"getFavorToDonate|getFactionFavorGain|getCompanyFavorGain|" + "getFavorToDonate|getFactionFavorGain|getCompanyFavorGain|" +
"checkFactionInvitations|joinFaction|workForFaction|getFactionRep|" + "checkFactionInvitations|joinFaction|workForFaction|getFactionRep|" +
"donateToFaction|" + "donateToFaction|getCrimeStats|" +
"createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" + "createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" +
"getOwnedSourceFiles|getAugmentationsFromFaction|" + "getOwnedSourceFiles|getAugmentationsFromFaction|" +
"getAugmentationPrereq|getAugmentationCost|purchaseAugmentation|" + "getAugmentationPrereq|getAugmentationCost|purchaseAugmentation|" +
"softReset|installAugmentations|getAugmentationStats|" + "softReset|installAugmentations|getAugmentationStats|" +
// TIX API // TIX API
"getStockPrice|getStockPosition|getStockSymbols|getStockMaxShares|" + "getStockPrice|getStockPosition|getStockSymbols|getStockMaxShares|" +