Merge branch 'havocmayhem-master' into dev

This commit is contained in:
danielyxie 2018-12-30 16:36:52 -08:00
commit d2c8de3fb0
4 changed files with 38 additions and 2 deletions

@ -556,6 +556,20 @@ getAugmentationsFromFaction
Returns an array containing the names (as strings) of all Augmentations that are available from the specified faction. Returns an array containing the names (as strings) of all Augmentations that are available from the specified faction.
getAugmentationPrereq
---------------------
.. js:function:: getAugmentationPrereq(augName)
:param string augName: Name of Augmentation. CASE-SENSITIVE
If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function.
This function returns an array with the names of the prerequisite Augmentation(s) for the specified Augmentation.
If there are no prerequisites, a blank array is returned.
If an invalid Augmentation name is passed in for the *augName* argument, this function will return a blank array.
getAugmentationCost getAugmentationCost
------------------- -------------------

@ -89,7 +89,7 @@ let NetscriptFunctions =
"donateToFaction|" + "donateToFaction|" +
"createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" + "createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" +
"getOwnedSourceFiles|getAugmentationsFromFaction|" + "getOwnedSourceFiles|getAugmentationsFromFaction|" +
"getAugmentationCost|purchaseAugmentation|" + "getAugmentationPrereq|getAugmentationCost|purchaseAugmentation|" +
"installAugmentations|" + "installAugmentations|" +
// TIX API // TIX API

@ -519,7 +519,7 @@ export let CONSTANTS: IMap<any> = {
** Slightly reduced the effect "Real Estate" has on the Production Multiplier for the Agriculture industry ** Slightly reduced the effect "Real Estate" has on the Production Multiplier for the Agriculture industry
* Added getOrders() Netscript function to the TIX API * Added getOrders() Netscript function to the TIX API
* * Added getAugmentationPrereq() Singularity function (by havocmayhem)
* Stock Market, Travel, and Corporation main menu links are now properly styled * Stock Market, Travel, and Corporation main menu links are now properly styled
* Many pop-up/dialog boxes now support the 'Enter' and 'Esc' hotkeys. If you find a pop-up/dialog box that doesnt support this, let me know specifically which one ('Enter' for the default option, 'Esc' for cancelling and closing the pop-up box) * Many pop-up/dialog boxes now support the 'Enter' and 'Esc' hotkeys. If you find a pop-up/dialog box that doesnt support this, let me know specifically which one ('Enter' for the default option, 'Esc' for cancelling and closing the pop-up box)
* Added "brace_style = preserve_inline" configuration to Script Editor Beautifier * Added "brace_style = preserve_inline" configuration to Script Editor Beautifier

@ -3606,6 +3606,28 @@ function NetscriptFunctions(workerScript) {
} }
return res; return res;
}, },
getAugmentationPrereq : function(name) {
var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;
if (Player.bitNodeN !== 4) {ramCost *= CONSTANTS.ScriptSingularityFnRamMult;}
if (workerScript.checkingRam) {
return updateStaticRam("getAugmentationPrereq", ramCost);
}
updateDynamicRam("getAugmentationPrereq", ramCost);
if (Player.bitNodeN != 4) {
if (!(hasSingularitySF && singularitySFLvl >= 3)) {
throw makeRuntimeRejectMsg(workerScript, "Cannot run getAugmentationPrereq(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
return false;
}
}
if (!augmentationExists(name)) {
workerScript.scriptRef.log("ERROR: getAugmentationPrereq() failed. Invalid Augmentation name passed in (note: this is case-sensitive): " + name);
return [];
}
var aug = Augmentations[name];
return aug.prereqs.slice();
},
getAugmentationCost : function(name) { getAugmentationCost : function(name) {
var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; var ramCost = CONSTANTS.ScriptSingularityFn3RamCost;
if (Player.bitNodeN !== 4) {ramCost *= CONSTANTS.ScriptSingularityFnRamMult;} if (Player.bitNodeN !== 4) {ramCost *= CONSTANTS.ScriptSingularityFnRamMult;}