cookietouch

CookieTouch API Documentation

Summary | Single page summary


Table of Contents

BID

All functions related to bid.

The lots can be equal to 1, 10 or 100.

yield*bid.startBuying()

Activates the purchase in bid, must be executed before buying items.

Returns true if enabled, otherwise returns false.

Example:

yield* bid.startBuying(); // Activates buying.

yield*bid.buyItem(gid: number, lot: number)

Allows you to buy a lot of a given item.

Returns true if the item lot can be purchased, otherwise returns false.

Example:

yield* bid.startBuying(); // Activates buying.
yield* bid.buyItem(423, 10); // Buy 10 Flax.

yield*bid.startSelling()

Activates the sale in bid, must be executed before all the functions below.

Returns true if the sale is enabled, otherwise returns false.

Example:

yield* bid.startSelling(); // Activates selling.

bid.itemsInSaleCount

Returns the number of items in sale.

Example:

const itemsInSale = bid.itemsInSaleCount;

bid.getItemPrice(gid: number, lot: number)

Returns the price of a lot of items for sale.

Example:

const wheatPrice = bid.getItemPrice(289, 100); // Returns the price of the lot of 100 wheat.

bid.getItemsInSale()

Returns a list of lots of items for sale and the price of the lot.

Example:

bid.getItemsInSale().forEach((itemInSale) => {
  const gid = itemInSale.gid;
  const uid = itemInSale.uid;
  const lot = itemInSale.lot;
  const price = itemInSale.price;
});

yield*bid.sellItem(gid: number, lot: number, price: number)

Allows you to sell a lot of a given item at a given price.

Returns true if the item was put on sale, otherwise returns false.

Example:

yield* bid.sellItem(289, 100, 200); // Puts on sell 100 wheat for 200 kamas.

yield*bid.editItemInSalePrice(uid: number, newPrice: number)

Allows you to edit the price of a given item for sale.

Returns true if the price of the item has been changed, otherwise returns false.

Example:

bid.getItemsInSale().forEach((itemInSale) => {
  if ((itemInSale.gid === 289) && (itemInSale.price <= 1000) && (itemInSale.lot <= 100)) {
    yield* bid.editItemInSalePrice(itemInSale.uid, 1200); // Increase price of 100 wheat.
  }
});

Note: the uid can be found in getItemsInSale. The uid is unique to each item (or item lot).

yield*bid.removeItemsInSale(uid: number)

Removes a given item from the sale.

Returns true if the item is removed from the sale, otherwise returns false.

Example:

bid.getItemsInSale().forEach((itemInSale) => {
  if (itemInSale.gid === 289) {
    yield* bid.removeItemsInSale(itemInSale.uid); // Remove all wheat in sale
  }
});

Note: the uid can be found in getItemsInSale. The uid is unique to each item (or item lot).