mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13: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 {
|
return {
|
||||||
getAugmentationGraftPrice: (ctx) => (_augName) => {
|
getAugmentationGraftPrice: (ctx) => (_augName) => {
|
||||||
const augName = helpers.string(ctx, "augName", _augName);
|
const augName = helpers.string(ctx, "augName", _augName);
|
||||||
checkGraftingAPIAccess(ctx);
|
checkGraftingAPIAccess(ctx);
|
||||||
if (!getGraftingAvailableAugs().includes(augName) || augmentationExists(augName)) {
|
if (!isValidGraftingAugName(augName)) {
|
||||||
throw helpers.makeRuntimeErrorMsg(ctx, `Invalid aug: ${augName}`);
|
throw helpers.makeRuntimeErrorMsg(ctx, `Invalid aug: ${augName}`);
|
||||||
}
|
}
|
||||||
const graftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
const graftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
||||||
@ -36,7 +39,7 @@ export function NetscriptGrafting(): InternalAPI<IGrafting> {
|
|||||||
getAugmentationGraftTime: (ctx) => (_augName) => {
|
getAugmentationGraftTime: (ctx) => (_augName) => {
|
||||||
const augName = helpers.string(ctx, "augName", _augName);
|
const augName = helpers.string(ctx, "augName", _augName);
|
||||||
checkGraftingAPIAccess(ctx);
|
checkGraftingAPIAccess(ctx);
|
||||||
if (!getGraftingAvailableAugs().includes(augName) || !augmentationExists(augName)) {
|
if (!isValidGraftingAugName(augName)) {
|
||||||
throw helpers.makeRuntimeErrorMsg(ctx, `Invalid aug: ${augName}`);
|
throw helpers.makeRuntimeErrorMsg(ctx, `Invalid aug: ${augName}`);
|
||||||
}
|
}
|
||||||
const graftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
const graftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
||||||
@ -58,7 +61,7 @@ export function NetscriptGrafting(): InternalAPI<IGrafting> {
|
|||||||
if (player.city !== CityName.NewTokyo) {
|
if (player.city !== CityName.NewTokyo) {
|
||||||
throw helpers.makeRuntimeErrorMsg(ctx, "You must be in New Tokyo to begin grafting an Augmentation.");
|
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}`);
|
helpers.log(ctx, () => `Invalid aug: ${augName}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user