Shop

Methods to interact with the shop interface.

../../images/shop_interface.png

Note

Credits to GodTierKappa a.k.a. jacz24


EShopQuantity

EShopQuantity = enum(ONE, FIVE, TEN, FIFTY);

Enum representing the shop quantity buttons.


TShop

Main record to interact with the Shop interface.


Shop.FindItemBoundaries

function TShop.FindItemBoundaries(): TBoxArray;

Finds item boundaries and returns them as a TBoxArray.

You have 2 ways of getting the shop item slots, a static one:

ShowOnTarget(Shop.SlotBoxes);
../../images/shop_static_slots.png

The shop static slots.

And a dynamic one:

ShowOnTarget(Shop.FindItemBoundaries());
../../images/shop_item_boundaries.png

The shop “dynamic” slots.

There are use cases for both, internally, Shop.FindItemBoundaries is usually used.


Shop.SetupInterface

procedure TShop.SetupInterface();

Internal method used to setup the TShop coordinates. This is automatically called for you on the Shop variable.


Shop.IsOpen

function TShop.IsOpen(): Boolean;

Returns true if the shop interface is open.

Example:

WriteLn Shop.IsOpen();

Shop.WaitOpen

function TShop.WaitOpen(time: Integer = 600; interval: Integer = -1): Boolean;

Returns true if the shop opens within time milliseconds.

Example:

WriteLn Shop.WaitOpen();

Shop.Close

function TShop.Close(escape: Boolean): Boolean;
function TShop.Close(escapeProbability: Double = BioHash): Boolean; overload;

Closes the Shop interface, depending on escape the function will either press escape or click the close button.

Example:

WriteLn Shop.Close();

Shop.Buy

function TShop.Buy(
  item: TItem; quantity: EShopQuantity = EShopQuantity.ONE
): Boolean;

Attempts to buy the specified item from the shop. With the proper quantity button enabled.

Example:

WriteLn Shop.Buy('Gold ore', EShopQuantity.FIFTY);

Shop.Sell

function TShop.Sell(
  item: TItem; quantity: EShopQuantity = EShopQuantity.ONE
): Boolean;

Attempts to sell the specified item to the shop from your inventory. With the proper quantity button enabled.

Example:

WriteLn Shop.Sell('Bones', EShopQuantity.FIVE);

Shop.GetPrice

function TShop.GetPrice(item: TItem): Integer;

Returns the price of an item in the shop by examining it.

Example:

WriteLn Shop.GetPrice('Gold ore');

Shop.SetQuantity

function TShop.SetQuantity(quantity: EShopQuantity): Boolean;

Sets the shop quantity button (1, 5, 10, or 50).

Example:

WriteLn Shop.SetQuantity(EShopQuantity.TEN);

Shop.Hover

function TShop.Hover(obj: TGObject; walk: Boolean = True): Boolean;
function TShop.Hover(npc: TEntity; walk: Boolean = True): Boolean; overload;

This assumes that Map is being used and setup. It’s possible to use this with other systems but you need to configure it all manually.

If you are too far, it will attempt to walk closer to it.


Shop.Open

function TShop.Open(obj: TGObject; walk: Boolean = True): Boolean;
function TShop.Open(npc: TEntity; walk: Boolean = True): Boolean; overload;

Opens the shop for you. This assumes that Map is being used and setup.

Example:

{$I WaspLib/main.simba}
begin
  Map.Setup([Map.Setup([EChunk.BLAST_FURNACE]));
  Shop.Open(TEntity.Create(NPCsJSON.GetByName('Ordan', 1).Item[0]));
end.

Shop variable

Global TShop variable.