yolkbot
    Preparing search index...

    Class Shop

    The in-game shop behind an Account

    Index

    Constructors

    • Creates a new Shop instance. Automatically initialized with an Account

      Parameters

      • account: Account

        The account it operates with

      Returns Shop

    Methods

    • Buys an item from the shop with eggs

      Parameters

      • itemId: number

        The ID of the item to buy

      Returns Promise<
          | { currentBalance: number; itemId: number; ok: true }
          | ErrorEnum<FirebaseError | QueryServicesError | ItemBuyError>,
      >

      An object containing the result if successful, or an error if the request failed

    • Attempts to claim a URL reward (like midMonthGiveMeEggs)

      Parameters

      • reward: string

        The reward to claim

      Returns Promise<
          | { eggsGiven: number; itemIds: number[]; ok: true }
          | ErrorEnum<FirebaseError | QueryServicesError | ClaimURLError>,
      >

      An object containing the result if successful, or an error if the request failed

    • Checks if it's currently in the 2x egg weekend period

      Returns boolean

      Whether it's currently the 2x egg weekend period

    • Attempts to redeem an item code for the account

      Parameters

      • code: string

        The item code to redeem

      Returns Promise<
          | { eggsGiven: number; itemIds: number[]; ok: true }
          | ErrorEnum<FirebaseError | QueryServicesError | RedeemCodeError>,
      >

      An object containing the result if successful, or an error if the request failed

    • Refreshes the account's egg balance from the server

      Returns Promise<
          | ErrorEnum<FirebaseError | QueryServicesError>
          | { currentBalance: number; ok: true },
      >

      An object containing the current balance if successful, or an error if the request failed

    Properties

    account: Account

    The related Account instance