mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Merge pull request #1192 from vmesecher/dev
Adds getAugmentationPrice() and getAugmentationReqRep() Netscript Singularity functions.
This commit is contained in:
commit
bada8a5f39
@ -55,8 +55,10 @@ The player has access to all of these functions while in BitNode-4. Completing B
|
|||||||
getOwnedAugmentations() <singularityfunctions/getOwnedAugmentations>
|
getOwnedAugmentations() <singularityfunctions/getOwnedAugmentations>
|
||||||
getOwnedSourceFiles() <singularityfunctions/getOwnedSourceFiles>
|
getOwnedSourceFiles() <singularityfunctions/getOwnedSourceFiles>
|
||||||
getAugmentationsFromFaction() <singularityfunctions/getAugmentationsFromFaction>
|
getAugmentationsFromFaction() <singularityfunctions/getAugmentationsFromFaction>
|
||||||
getAugmentationPrereq() <singularityfunctions/getAugmentationPrereq>
|
|
||||||
getAugmentationCost() <singularityfunctions/getAugmentationCost>
|
getAugmentationCost() <singularityfunctions/getAugmentationCost>
|
||||||
|
getAugmentationPrereq() <singularityfunctions/getAugmentationPrereq>
|
||||||
|
getAugmentationPrice() <singularityfunctions/getAugmentationPrice>
|
||||||
|
getAugmentationRepReq() <singularityfunctions/getAugmentationRepReq>
|
||||||
getAugmentationStats() <singularityfunctions/getAugmentationStats>
|
getAugmentationStats() <singularityfunctions/getAugmentationStats>
|
||||||
purchaseAugmentation() <singularityfunctions/purchaseAugmentation>
|
purchaseAugmentation() <singularityfunctions/purchaseAugmentation>
|
||||||
installAugmentations() <singularityfunctions/installAugmentations>
|
installAugmentations() <singularityfunctions/installAugmentations>
|
||||||
|
@ -3,12 +3,15 @@ getAugmentationCost() Netscript Function
|
|||||||
|
|
||||||
.. js:function:: getAugmentationCost(augName)
|
.. js:function:: getAugmentationCost(augName)
|
||||||
|
|
||||||
|
.. warning:: This function is deprecated.
|
||||||
|
|
||||||
:RAM cost: 5 GB
|
:RAM cost: 5 GB
|
||||||
:param string augName: Name of Augmentation. case-sensitive.
|
|
||||||
|
: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.
|
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 two elements that gives the cost for the specified Augmentation.
|
This function returns an array with two elements that gives the cost for the specified Augmentation.
|
||||||
The first element in the returned array is the reputation requirement of the Augmentation, and the second element is the money cost.
|
The first element in the returned array is the reputation requirement of the Augmentation, and the second element is the money cost.
|
||||||
|
|
||||||
If an invalid Augmentation name is passed in for the ``augName`` argument, this function will return the array [-1, -1].
|
If an invalid Augmentation name is passed in for the ``augName`` argument, this function will throw a runtime error.
|
||||||
|
@ -12,4 +12,4 @@ getAugmentationPrereq() Netscript Function
|
|||||||
This function returns an array with the names of the prerequisite Augmentation(s) for the specified Augmentation.
|
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 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.
|
If an invalid Augmentation name is passed in for the *augName* argument, this function will throw a runtime error.
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
getAugmentationPrice() Netscript Function
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
.. js:function:: getAugmentationPrice(augName)
|
||||||
|
|
||||||
|
:RAM cost: 2.5 GB
|
||||||
|
|
||||||
|
: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 the money cost for the specified Augmentation.
|
||||||
|
|
||||||
|
If an invalid Augmentation name is passed in for the *augName* argument, this function will throw a runtime error.
|
@ -0,0 +1,14 @@
|
|||||||
|
getAugmentationRepReq() Netscript Function
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
.. js:function:: getAugmentationRepReq(augName)
|
||||||
|
|
||||||
|
:RAM cost: 2.5 GB
|
||||||
|
|
||||||
|
: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 the reputation requirement for the specified Augmentation.
|
||||||
|
|
||||||
|
If an invalid Augmentation name is passed in for the *augName* argument, this function will throw a runtime error.
|
@ -214,8 +214,10 @@ export const RamCosts: IMap<any> = {
|
|||||||
getOwnedAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
getOwnedAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
getOwnedSourceFiles: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
getOwnedSourceFiles: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
getAugmentationsFromFaction: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
getAugmentationsFromFaction: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
getAugmentationPrereq: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
|
||||||
getAugmentationCost: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
getAugmentationCost: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
|
getAugmentationPrereq: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
|
getAugmentationPrice: () => RamCostConstants.ScriptSingularityFn3RamCost / 2,
|
||||||
|
getAugmentationRepReq: () => RamCostConstants.ScriptSingularityFn3RamCost / 2,
|
||||||
getAugmentationStats: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
getAugmentationStats: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
purchaseAugmentation: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
purchaseAugmentation: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
softReset: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
softReset: () => RamCostConstants.ScriptSingularityFn3RamCost,
|
||||||
|
@ -4598,6 +4598,15 @@ function NetscriptFunctions(workerScript) {
|
|||||||
|
|
||||||
return faction.augmentations.slice();
|
return faction.augmentations.slice();
|
||||||
},
|
},
|
||||||
|
getAugmentationCost: function (name) {
|
||||||
|
updateDynamicRam(
|
||||||
|
"getAugmentationCost",
|
||||||
|
getRamCost("getAugmentationCost"),
|
||||||
|
);
|
||||||
|
checkSingularityAccess("getAugmentationCost", 3);
|
||||||
|
const aug = getAugmentation("getAugmentationCost", name);
|
||||||
|
return [aug.baseRepRequirement, aug.baseCost];
|
||||||
|
},
|
||||||
getAugmentationPrereq: function (name) {
|
getAugmentationPrereq: function (name) {
|
||||||
updateDynamicRam(
|
updateDynamicRam(
|
||||||
"getAugmentationPrereq",
|
"getAugmentationPrereq",
|
||||||
@ -4607,14 +4616,23 @@ function NetscriptFunctions(workerScript) {
|
|||||||
const aug = getAugmentation("getAugmentationPrereq", name);
|
const aug = getAugmentation("getAugmentationPrereq", name);
|
||||||
return aug.prereqs.slice();
|
return aug.prereqs.slice();
|
||||||
},
|
},
|
||||||
getAugmentationCost: function (name) {
|
getAugmentationPrice: function (name) {
|
||||||
updateDynamicRam(
|
updateDynamicRam(
|
||||||
"getAugmentationCost",
|
"getAugmentationPrice",
|
||||||
getRamCost("getAugmentationCost"),
|
getRamCost("getAugmentationPrice"),
|
||||||
);
|
);
|
||||||
checkSingularityAccess("getAugmentationCost", 3);
|
checkSingularityAccess("getAugmentationPrice", 3);
|
||||||
const aug = getAugmentation("getAugmentationCost", name);
|
const aug = getAugmentation("getAugmentationPrice", name);
|
||||||
return [aug.baseRepRequirement, aug.baseCost];
|
return aug.baseCost;
|
||||||
|
},
|
||||||
|
getAugmentationRepReq: function (name) {
|
||||||
|
updateDynamicRam(
|
||||||
|
"getAugmentationRepReq",
|
||||||
|
getRamCost("getAugmentationRepReq"),
|
||||||
|
);
|
||||||
|
checkSingularityAccess("getAugmentationRepReq", 3);
|
||||||
|
const aug = getAugmentation("getAugmentationRepReq", name);
|
||||||
|
return aug.baseRepRequirement;
|
||||||
},
|
},
|
||||||
getAugmentationStats: function (name) {
|
getAugmentationStats: function (name) {
|
||||||
updateDynamicRam(
|
updateDynamicRam(
|
||||||
|
@ -146,8 +146,10 @@ export const libSource = `interface NS {
|
|||||||
getOwnedAugmentations(purchased: boolean): string[];
|
getOwnedAugmentations(purchased: boolean): string[];
|
||||||
getOwnedSourceFiles(): any; // complex type
|
getOwnedSourceFiles(): any; // complex type
|
||||||
getAugmentationsFromFaction(facname: string): string[];
|
getAugmentationsFromFaction(facname: string): string[];
|
||||||
getAugmentationPrereq(name: string): string[];
|
|
||||||
getAugmentationCost(name: string): number;
|
getAugmentationCost(name: string): number;
|
||||||
|
getAugmentationPrereq(name: string): string[];
|
||||||
|
getAugmentationPrice(name: string): number;
|
||||||
|
getAugmentationRepReq(name: string): number;
|
||||||
getAugmentationStats(name: string): any; // complex type
|
getAugmentationStats(name: string): any; // complex type
|
||||||
purchaseAugmentation(faction: string, name: string): boolean;
|
purchaseAugmentation(faction: string, name: string): boolean;
|
||||||
softReset(cbScript: string): void;
|
softReset(cbScript: string): void;
|
||||||
|
@ -812,13 +812,23 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
|||||||
await testNonzeroDynamicRamCost(f);
|
await testNonzeroDynamicRamCost(f);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("getAugmentationCost()", async function () {
|
||||||
|
const f = ["getAugmentationCost"];
|
||||||
|
await testNonzeroDynamicRamCost(f);
|
||||||
|
});
|
||||||
|
|
||||||
it("getAugmentationPrereq()", async function () {
|
it("getAugmentationPrereq()", async function () {
|
||||||
const f = ["getAugmentationPrereq"];
|
const f = ["getAugmentationPrereq"];
|
||||||
await testNonzeroDynamicRamCost(f);
|
await testNonzeroDynamicRamCost(f);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("getAugmentationCost()", async function () {
|
it("getAugmentationPrice()", async function () {
|
||||||
const f = ["getAugmentationCost"];
|
const f = ["getAugmentationPrice"];
|
||||||
|
await testNonzeroDynamicRamCost(f);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("getAugmentationRepReq()", async function () {
|
||||||
|
const f = ["getAugmentationRepReq"];
|
||||||
await testNonzeroDynamicRamCost(f);
|
await testNonzeroDynamicRamCost(f);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -756,13 +756,23 @@ describe("Netscript Static RAM Calculation/Generation Tests", function () {
|
|||||||
await expectNonZeroRamCost(f);
|
await expectNonZeroRamCost(f);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("getAugmentationCost()", async function () {
|
||||||
|
const f = ["getAugmentationCost"];
|
||||||
|
await expectNonZeroRamCost(f);
|
||||||
|
});
|
||||||
|
|
||||||
it("getAugmentationPrereq()", async function () {
|
it("getAugmentationPrereq()", async function () {
|
||||||
const f = ["getAugmentationPrereq"];
|
const f = ["getAugmentationPrereq"];
|
||||||
await expectNonZeroRamCost(f);
|
await expectNonZeroRamCost(f);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("getAugmentationCost()", async function () {
|
it("getAugmentationPrice()", async function () {
|
||||||
const f = ["getAugmentationCost"];
|
const f = ["getAugmentationPrice"];
|
||||||
|
await expectNonZeroRamCost(f);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("getAugmentationRepReq()", async function () {
|
||||||
|
const f = ["getAugmentationRepReq"];
|
||||||
await expectNonZeroRamCost(f);
|
await expectNonZeroRamCost(f);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user