GrandExchange

This file is a work in progress. In other words:

  • it could be a subject to change
  • it may lack safety checks
  • it could contain bugs
  • slacky was here!

Types and Variables


type EGEInterface

EGEInterface = (geOverview, geOfferStatus, geSetupOffer);

Type that covers the interfaces


type EExchButton

EGEInterface = (ebHistory, ebAbort, ebReturn, ebCollect, ebClose);

The main buttons buttons


type EAdjustButton

EAdjustButton = (
  abDecQuant, abQuantInc, abDecPrice, abIncPrice,
  abIncQuant1, abIncQuant10, abIncQuant100, abIncQuant1K, abEnterQuantity,
  abDecPrice5Prc, abGuidePrice, abEnterPrice, abIncPrice5Prc
);

The buttons found in the offer-interface.


type EExchType

EExchType = (etEmpty, etBuy, etSell);

The type of the offer-interface (Undefined, Buy, Sell)


type EOfferState

EOfferState = (osIncomplete, osCompleted, osAborted);

The result of the offer, incomplete, completed, aborted.


type TExchangeInfo

TExchangeInfo = record
  Item: String;
  Typ: EExchType;
  Status: EOfferState;
  Progress: Int32;
  Price: Int32;
  Sum: Int32;
end;

Contains all the data regarding an offer.


var GrandExchange

The variable used to interact with the grand exchange interface.

Example

if GrandExchange.IsOpen() then
begin
  GrandExchange.PlaceOffer(0, etSell);  // slot = 0, sell it
  GrandExchange.Offer.SellItem(4);      // item at inventory slot = 4
  GrandExchange.Offer.SetPrice(1000);   // 1000 each
  GrandExchange.Offer.SetQuantity(5);   // 5 of these items
  GrandExchange.Offer.Confirm();
end;

GrandExchange Stub

These methods are available through both GrandExchange and GrandExchange.Offer.


GrandExchange.RecognizeStr

function TGrandExchStub.RecognizeStr(B:TBox; Color:Int32; Font:String; Tol:Int32=0;
                                     WSplit:Int32=3; HSplit:Int32=2): String;

Internally used to to get the text at the given coordinates.


GrandExchange.RecognizeInt

function TGrandExchStub.RecognizeInt(B:TBox; Color:Int32; Font:String; Tol:Int32=0;
                                     WSplit:Int32=3; HSplit:Int32=2): Int32;

Internally used to to get the text as an integer at the given coordinates.


GrandExchange.Title

function TGrandExchStub.Title(): String;

Get the title of the current interface


GrandExchange.CurrentInterface

function TGrandExchStub.CurrentInterface(Wtime: Int32=0): EGEInterface;

Returns the current interface, geOverview, geOfferStatus and geSetupOffer.

  • geOverview is the main interface
  • geOfferStatus is the screen where you inspect your offer
  • geSetupOffer is the screen where you place a buy/sell offer

GrandExchange.IsOpen

function TGrandExchStub.IsOpen(Screen: EGEInterface=geOverview; Wtime: Int32=0): Boolean;

Returns True if the given GE interface is open.


GrandExchange.Click

procedure TGrandExchStub.Click(Button: EExchButton);

Clicks one of the many exchange buttons.

Example

GrandExchange.Offer.Click(ebAbort); // abort the offer
GrandExchange.Click(ebCollect);     // collect items / money

GrandExchange.Debug

function TGrandExchStub.Debug(RetImage: Boolean = False): TMufasaBitmap;

Debug the GrandExchange (stub).


GrandExchange Offer

These are the methods for GE Offer Interface (Sell & Buy)


GrandExchange.Offer.LoadButtons

function TGrandExchOffer.LoadButtons(): TBoxArray;

Internally used to load the loaction of the various buttons in the GE offer-interface.


GrandExchange.Offer.Click

procedure TGrandExchOffer.Click(Button: EAdjustButton; Times: Int32=1); overload;

Click one of the adjustment buttons see [type-EAdjustButton]

Example

GrandExchange.Offer.Click(abIncPrice5Prc, 2); //click `+5%`, 2 times.

GrandExchange.Offer.Confirm

procedure TGrandExchOffer.Confirm();

Press that bigass confirm button.


GrandExchange.Offer.SelectItem

function TGrandExchOffer.SelectItem(Name: String; Exact: Boolean=False; Wtime: Int32=2000): Boolean;

Once you have searched for an item, this function is used to select it.

Example

GrandExchange.PlaceOffer(0, etBuy);              // slot = 0, buy it
GrandExchange.Offer.SearchFor('Rune scimitar');  // search for
GrandExchange.Offer.SelectItem('Rune scimitar'); // select

GrandExchange.Offer.SetQuantity

function TGrandExchOffer.SetQuantity(Quantity: Int32): Boolean;

Sets the number of items you wish to sell or buy.


GrandExchange.Offer.SetPrice

function TGrandExchOffer.SetPrice(Price: Int32): Boolean;

Sets the price per item that you wish to buy the items for.


GrandExchange.Offer.ExchangeType

function TGrandExchOffer.ExchangeType(): EExchType;

Returns the type of the offer, if it’s a sell or a buy offer, or otherwise undefined / empty.


GrandExchange.Offer.OfferIcon

function TGrandExchOffer.OfferIcon(): TMufasaBitmap;

Returns an image of the item icon that relates to this offer.


GrandExchange.Offer.ItemValue

function TGrandExchOffer.ItemValue(): Int32;

Returns the value of the item according to GE


GrandExchange.Offer.ItemName

function TGrandExchOffer.ItemName(): String;

Returns the full name of the item.


GrandExchange.Offer.ItemDesc

function TGrandExchOffer.ItemDesc(): String;

Returns the description of the item.


GrandExchange.Offer.Quantity

function TGrandExchOffer.Quantity(): Int32;

Returns the quantity set up to buy or sell.


GrandExchange.Offer.Price

function TGrandExchOffer.Price(): Int32;

Returns the price it’s set up to buy or sell at.


GrandExchange.Offer.Sum

function TGrandExchOffer.Sum(): Int32;

Returns the total cost or revenue from buying or selling this item.


GrandExchange.Offer.Status

function TGrandExchOffer.Status(): String;

Returns the current offers status message


GrandExchange.Offer.Progress

function TGrandExchOffer.Progress(): Int32;

Returns the offer’s buy/sell progress in percent.


GrandExchange.Offer.State

function TGrandExchOffer.State(): EOfferState;

Returns the offers state, as in incomplete, aborted, or completed.


GrandExchange.Offer.SearchFor

function TGrandExchOffer.SearchFor(Name: String): Boolean;

Searches for the given item when buying an item.


GrandExchange.Offer.SellItem

function TGrandExchOffer.SellItem(InvIndex: Int32): Boolean;

Selects the item from your inventory to sell.


GrandExchange.Offer.Info

function TGrandExchOffer.Info(): TExchangeInfo;

Returns all the data related to the current offer, the type of the offer, and it’s state, progress, name, price, sum.


GrandExchange.Offer.Debug

function TGrandExchOffer.Debug(RetImage: Boolean = False): TMufasaBitmap; override;

Debug the Offer-interface. Important for maintenace purposes.


GrandExchange

These are the methods for the main GE interface.


GrandExchange.ExchangeType

function TRSGrandExch.ExchangeType(Slot: Int32): EExchType;

Returns the exchange type at the given slot (etEmpty, etBuy, etSell)


GrandExchange.Available

function TRSGrandExch.Available(Slot: Int32): Boolean;

Returns True if the given exchangle slot is not currently in use.


GrandExchange.ItemName

function TRSGrandExch.ItemName(Slot: Int32): String;

Returns the name of the item in the given slot.


GrandExchange.State

function TRSGrandExch.State(Slot: Int32): EOfferState;

Returns the state of the offer at the given slot.


GrandExchange.Price

function TRSGrandExch.Price(Slot: Int32): Int32;

Returns the price of the offer at the given slot.


GrandExchange.Progress

function TRSGrandExch.Progress(Slot: Int32): Int32;

Returns the progress percent of the offer in the given slot.


GrandExchange.Sum

function TRSGrandExch.Sum(Slot: Int32): Int32;

This function is a stub, it wont give you any valuable information.


GrandExchange.Info

function TRSGrandExch.Info(Slot: Int32): TExchangeInfo;

Returns all the data related to the offer at the given slot. You get the type of the offer, and it’s state, progress, name and price. The Sum filed will be -1


GrandExchange.PlaceOffer

function TRSGrandExch.PlaceOffer(Slot: Int32; Typ: EExchType): Boolean;

Prapares to create a sell or buy offer in the given slot.


GrandExchange.PlaceOffer

function TRSGrandExch.PlaceOffer(Typ: EExchType): Boolean; overload;

Prapares to create a sell or buy offer in the first abilable slot.


GrandExchange.ViewOffer

function TRSGrandExch.ViewOffer(Slot: Int32): Boolean;

Opens the offer at the given slot.


GrandExchange.Debug

function TRSGrandExch.Debug(RetImage: Boolean = False): TMufasaBitmap; override;

Debugs any of the GE interfaces depending on which one is open.