add sleeve aug price and rep function

This commit is contained in:
Olivier Gagnon 2022-07-21 02:42:48 -04:00
parent dd7b5c4316
commit 693baf26df
3 changed files with 41 additions and 0 deletions

@ -303,6 +303,8 @@ const sleeve = {
getSleevePurchasableAugs: RamCostConstants.ScriptSleeveBaseRamCost, getSleevePurchasableAugs: RamCostConstants.ScriptSleeveBaseRamCost,
purchaseSleeveAug: RamCostConstants.ScriptSleeveBaseRamCost, purchaseSleeveAug: RamCostConstants.ScriptSleeveBaseRamCost,
setToBladeburnerAction: RamCostConstants.ScriptSleeveBaseRamCost, setToBladeburnerAction: RamCostConstants.ScriptSleeveBaseRamCost,
getSleeveAugmentationPrice: RamCostConstants.ScriptSleeveBaseRamCost,
getSleeveAugmentationRepReq: RamCostConstants.ScriptSleeveBaseRamCost,
}; };
// Stanek API // Stanek API

@ -4,6 +4,7 @@ import { findSleevePurchasableAugs } from "../PersonObjects/Sleeve/SleeveHelpers
import { StaticAugmentations } from "../Augmentation/StaticAugmentations"; import { StaticAugmentations } from "../Augmentation/StaticAugmentations";
import { CityName } from "../Locations/data/CityNames"; import { CityName } from "../Locations/data/CityNames";
import { findCrime } from "../Crime/CrimeHelpers"; import { findCrime } from "../Crime/CrimeHelpers";
import { Augmentation } from "../Augmentation/Augmentation";
import { import {
AugmentPair, AugmentPair,
@ -311,6 +312,22 @@ export function NetscriptSleeve(player: IPlayer): InternalAPI<ISleeve> {
return player.sleeves[sleeveNumber].tryBuyAugmentation(player, aug); return player.sleeves[sleeveNumber].tryBuyAugmentation(player, aug);
}, },
getSleeveAugmentationPrice:
(ctx: NetscriptContext) =>
(_augName: unknown): number => {
checkSleeveAPIAccess(ctx);
const augName = ctx.helper.string("augName", _augName);
const aug: Augmentation = StaticAugmentations[augName];
return aug.baseCost;
},
getSleeveAugmentationRepReq:
(ctx: NetscriptContext) =>
(_augName: unknown, _basePrice = false): number => {
checkSleeveAPIAccess(ctx);
const augName = ctx.helper.string("augName", _augName);
const aug: Augmentation = StaticAugmentations[augName];
return aug.getCost(player).repCost;
},
setToBladeburnerAction: setToBladeburnerAction:
(ctx: NetscriptContext) => (ctx: NetscriptContext) =>
(_sleeveNumber: unknown, _action: unknown, _contract?: unknown): boolean => { (_sleeveNumber: unknown, _action: unknown, _contract?: unknown): boolean => {

@ -3779,6 +3779,28 @@ export interface Sleeve {
*/ */
getSleeveAugmentations(sleeveNumber: number): string[]; getSleeveAugmentations(sleeveNumber: number): string[];
/**
* Get price of an augmentation.
* @remarks
* RAM cost: 4 GB
*
*
* @param augName - Name of Augmentation.
* @returns Price of the augmentation.
*/
getSleeveAugmentationPrice(augName: string): number;
/**
* Get reputation requirement of an augmentation.
* @remarks
* RAM cost: 4 GB
*
*
* @param augName - Name of Augmentation.
* @returns Reputation requirement of the augmentation.
*/
getSleeveAugmentationRepReq(augName: string): number;
/** /**
* List purchasable augs for a sleeve. * List purchasable augs for a sleeve.
* @remarks * @remarks