# Shop Methods to interact with the shop interface. ```{figure} ../../images/shop_interface.png ``` - - - ## ERSShopQuantity ```pascal ERSShopQuantity = enum(ONE, FIVE, TEN, FIFTY); ``` Enum representing the shop quantity buttons. - - - ## TRSShop Main record to interact with the {ref}`Shop` interface. - - - ## Shop.FindItemBoundaries ```pascal 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: ```pascal ShowOnTarget(Shop.SlotBoxes); ``` And a dynamic one: ```pascal ShowOnTarget(Shop.FindItemBoundaries()); ``` There are use cases for both, internally, `Shop.FindItemBoundaries` is usually used. - - - ## Shop.SetupInterface ```pascal procedure TRSShop.SetupInterface(); ``` Internal method used to setup the {ref}`TRSShop` coordinates. This is automatically called for you on the {ref}`Shop variable`. - - - ## Shop.IsOpen ```pascal function TRSShop.IsOpen(): Boolean; ``` Returns true if the shop interface is open. Example: ```pascal WriteLn Shop.IsOpen(); ``` - - - ## Shop.WaitOpen ```pascal function TRSShop.WaitOpen(time: Integer = 600; interval: Integer = -1): Boolean; ``` Returns true if the shop opens within `time` milliseconds. Example: ```pascal WriteLn Shop.WaitOpen(); ``` - - - ## Shop.Close ```pascal function TRSShop.Close(escape: Boolean): Boolean; function TRSShop.Close(escapeProbability: Double = BioHash): Boolean; overload; ``` Closes the {ref}`Shop` interface, depending on `escape` the function will either press escape or click the close button. Example: ```pascal WriteLn Shop.Close(); ``` - - - ## Shop.Buy ```pascal 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: ```pascal WriteLn Shop.Buy('Gold ore', ERSShopQuantity.FIFTY); ``` - - - ## Shop.Sell ```pascal 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: ```pascal WriteLn Shop.Sell('Bones', ERSShopQuantity.FIVE); ``` - - - ## Shop.GetPrice ```pascal function TRSShop.GetPrice(item: TRSItem): Integer; ``` Returns the price of an item in the shop by examining it. Example: ```pascal WriteLn Shop.GetPrice('Gold ore'); ``` - - - ## Shop.SetQuantity ```pascal function TRSShop.SetQuantity(quantity: ERSShopQuantity): Boolean; ``` Sets the shop quantity button (1, 5, 10, or 50). Example: ```pascal WriteLn Shop.SetQuantity(ERSShopQuantity.TEN); ``` - - - ## Shop.Hover ```pascal function TRSShop.Hover(obj: TRSObject; walk: Boolean = True): Boolean; function TRSShop.Hover(npc: TRSEntity; walk: Boolean = True): Boolean; overload; ``` This assumes that {ref}`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 ```pascal 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 {ref}`Map` is being used and setup. Example: ```pascal {$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 {ref}`TRSShop` variable.