Options
All
  • Public
  • Public/Protected
  • All
Menu

Layer on top of NS and Hacknet to simplify upgrades on "home".

Note: Requires access to singularity functions, either in BN4 or with SF4.

Hierarchy

  • Store<HomeParams, null>
    • HomeStore

Index

Constructors

  • Creates a new Home store which allows for upgrading RAM and purchasing darkweb upgrades.

    Parameters

    • ns: NS

      The Netscript object.

    Returns HomeStore

Properties

_ns: NS

The Netscript object.

Methods

  • _checkParams(params: null | HomeParams): boolean
  • Verify the purchase parameters, must be overridden by implementing classes.

    virtual

    Must be overridden by implementing classes.

    Parameters

    • params: null | HomeParams

      Parameters for this transaction.

    Returns boolean

    Whether the parameters are valid.

  • _purchase(params: HomeParams): Promise<boolean>
  • Purchase an upgrade, using singularity functions.

    override
    async

    Parameters

    • params: HomeParams

      The parameters of this transaction.

    Returns Promise<boolean>

    Whether the purchase 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: HomeParams): boolean
  • Checks that user can buy "tor" or Darkweb programs.

    override

    Parameters

    • params: HomeParams

      Parameters for this transaction.

    Returns boolean

    Whether the user can purchase this upgrade.

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

    Returns number

    Available money according to this._budget.

  • getCheapestUpgrade(): null | HomeUpgrade
  • Gets the cheapest available upgrade.

    Note: Will not include utility programs (AutoLink.exe, etc).

    Returns null | HomeUpgrade

    The cheapest upgrade, either "ram", "tor", or a program name. null if none is purchaseable.

  • getPurchaseCost(params: HomeParams): number
  • Gets purchase cost of upgrade, either "ram" for home RAM, "tor" for Tor router, or a program name.

    override

    Parameters

    • params: HomeParams

      The parameters for this transaction.

    Returns number

    The cost of this upgrade.

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

    virtual

    Must be overridden by implementing classes.

    async

    Parameters

    • params: HomeParams

      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