Shop¶
Methods to interact with the shop interface.
ERSShopQuantity¶
ERSShopQuantity = enum(ONE, FIVE, TEN, FIFTY);
Enum representing the shop quantity buttons.
TRSShop¶
Main record to interact with the Shop interface.
Shop.FindItemBoundaries¶
function TRSShop.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);
And a dynamic one:
ShowOnTarget(Shop.FindItemBoundaries());
There are use cases for both, internally, Shop.FindItemBoundaries is usually used.
Shop.SetupInterface¶
procedure TRSShop.SetupInterface();
Internal method used to setup the TRSShop coordinates. This is automatically called for you on the Shop variable.
Shop.IsOpen¶
function TRSShop.IsOpen(): Boolean;
Returns true if the shop interface is open.
Example:
WriteLn Shop.IsOpen();
Shop.WaitOpen¶
function TRSShop.WaitOpen(time: Integer = 600; interval: Integer = -1): Boolean;
Returns true if the shop opens within time milliseconds.
Example:
WriteLn Shop.WaitOpen();
Shop.Close¶
function TRSShop.Close(escape: Boolean): Boolean;
function TRSShop.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 TRSShop.Buy(item: TRSItem; quantity: ERSShopQuantity = ERSShopQuantity.ONE): Boolean;
Attempts to buy the specified item from the shop. With the proper quantity button enabled.
Example:
WriteLn Shop.Buy('Gold ore', ERSShopQuantity.FIFTY);
Shop.Sell¶
function TRSShop.Sell(item: TRSItem; quantity: ERSShopQuantity = ERSShopQuantity.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', ERSShopQuantity.FIVE);
Shop.GetPrice¶
function TRSShop.GetPrice(item: TRSItem): Integer;
Returns the price of an item in the shop by examining it.
Example:
WriteLn Shop.GetPrice('Gold ore');
Shop.SetQuantity¶
function TRSShop.SetQuantity(quantity: ERSShopQuantity): Boolean;
Sets the shop quantity button (1, 5, 10, or 50).
Example:
WriteLn Shop.SetQuantity(ERSShopQuantity.TEN);
Shop.Hover¶
function TRSShop.Hover(obj: TRSObject; walk: Boolean = True): Boolean;
function TRSShop.Hover(npc: TRSEntity; 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 TRSShop.Open(obj: TRSObject; walk: Boolean = True): Boolean;
function TRSShop.Open(npc: TRSEntity; walk: Boolean = True): Boolean; overload;
Opens the shop for you. This assumes that Map is being used and setup.
Example:
{$I WaspLib/osrs.simba}
begin
Map.Setup([Map.Setup([ERSChunk.BLAST_FURNACE]));
Shop.Open(TRSEntity.Create(NPCsJSON.GetByName('Ordan', 1).Item[0]));
end.
Shop variable¶
Global TRSShop variable.