Options
All
  • Public
  • Public/Protected
  • All
Menu

Layer on top of NS to simplify augmentation purchasing.

Hierarchy

  • Store<AugmentationPurchaseParams, null>
    • AugmentationStore

Index

Constructors

  • Creates a new Augmentation store instance which allows for purchasing and upgrading augmentations.

    Parameters

    • ns: NS

      The Netscript object.

    Returns AugmentationStore

Properties

_factionManager: FactionManager

Faction manager to help determine what to buy.

_ns: NS

The Netscript object.

Methods

  • _checkParams(params: AugmentationPurchaseParams): boolean
  • Verifies that the augmentation is set

    override

    Parameters

    • params: AugmentationPurchaseParams

      Parameters for this transaction.

    Returns boolean

    Whether the parameters are valid.

  • _hasEnoughRep(params: AugmentationPurchaseParams): boolean
  • Check if user has enough rep for this augmentation.

    Parameters

    • params: AugmentationPurchaseParams

      Params for this transaction.

    Returns boolean

    True if user has enough rep, false otherwise.

  • _purchase(params: AugmentationPurchaseParams): Promise<boolean>
  • Purchase a new augmentation params.augmentation from params.faction.

    override
    async

    Parameters

    • params: AugmentationPurchaseParams

      Parameters for this transaction.

    Returns Promise<boolean>

    Whether the transaction was successful.

  • _sell(params: null): Promise<boolean>
  • Sell an item with params params, must be overridden by implementing classes if supported.

    virtual

    Must be overridden by implementing classes.

    async

    Parameters

    • params: null

      Parameters for this sale.

    Returns Promise<boolean>

    Whether the transaction was successful.

  • canPurchase(params: AugmentationPurchaseParams): boolean
  • Check if user has enough money and reputation to purchase this augmentation.

    override

    Parameters

    • params: AugmentationPurchaseParams

      Params for this transaction.

    Returns boolean

    True if user can purchase, false otherwise.

  • getAugmentationToPurchase(): null | AugmentationPurchaseParams
  • Get the most expensive augmentation to purchase.

    Returns null | AugmentationPurchaseParams

    Augmentation to purchase, null if none are available.

  • getAvailableMoney(): number
  • Gets the amount of money available to this store.

    Returns number

    Available money according to this._budget.

  • getPurchaseCost(params: AugmentationPurchaseParams): number
  • Get cost of purchasing params.augmentation.

    override

    Parameters

    • params: AugmentationPurchaseParams

      Parameters for this transaction.

    Returns number

    Cost of the transaction.

  • purchase(params: AugmentationPurchaseParams): Promise<boolean>
  • Purchase an item with parameters params if there is money available.

    virtual

    Must be overridden by implementing classes.

    async

    Parameters

    • params: AugmentationPurchaseParams

      Parameters for this transaction.

    Returns Promise<boolean>

    Whether the transaction was successful.

  • sell(params: null): Promise<boolean>
  • Sell an item with params params, if possible.

    async

    Parameters

    • params: null

      Parameters for this sale.

    Returns Promise<boolean>

    Whether the transaction was successful.

Generated using TypeDoc