mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Fix getAugmentationGraftPrice bug (#530)
This commit is contained in:
parent
396e71955e
commit
294603fff8
@ -22,11 +22,14 @@ export function NetscriptGrafting(): InternalAPI<IGrafting> {
|
||||
}
|
||||
};
|
||||
|
||||
const isValidGraftingAugName = (augName: string) =>
|
||||
getGraftingAvailableAugs().includes(augName) && augmentationExists(augName);
|
||||
|
||||
return {
|
||||
getAugmentationGraftPrice: (ctx) => (_augName) => {
|
||||
const augName = helpers.string(ctx, "augName", _augName);
|
||||
checkGraftingAPIAccess(ctx);
|
||||
if (!getGraftingAvailableAugs().includes(augName) || augmentationExists(augName)) {
|
||||
if (!isValidGraftingAugName(augName)) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, `Invalid aug: ${augName}`);
|
||||
}
|
||||
const graftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
||||
@ -36,7 +39,7 @@ export function NetscriptGrafting(): InternalAPI<IGrafting> {
|
||||
getAugmentationGraftTime: (ctx) => (_augName) => {
|
||||
const augName = helpers.string(ctx, "augName", _augName);
|
||||
checkGraftingAPIAccess(ctx);
|
||||
if (!getGraftingAvailableAugs().includes(augName) || !augmentationExists(augName)) {
|
||||
if (!isValidGraftingAugName(augName)) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, `Invalid aug: ${augName}`);
|
||||
}
|
||||
const graftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
||||
@ -58,7 +61,7 @@ export function NetscriptGrafting(): InternalAPI<IGrafting> {
|
||||
if (player.city !== CityName.NewTokyo) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, "You must be in New Tokyo to begin grafting an Augmentation.");
|
||||
}
|
||||
if (!getGraftingAvailableAugs().includes(augName) || !augmentationExists(augName)) {
|
||||
if (!isValidGraftingAugName(augName)) {
|
||||
helpers.log(ctx, () => `Invalid aug: ${augName}`);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user