PDA

View Full Version : [OSR] AeroLib GrandExchange



Hoodz
05-01-2015, 05:37 PM
Here some Grand Exchange functions, compatible with AeroLib.

mainly posting them here so Flight; may add this in the official include.

few examples how to use it.


{GrandExchange is declared as TGrandExchange in the include}
GrandExchange.close(); {will close the GrandExchange screen}
GrandExchange.buyOffer('Wizard boots', 500000, 1); {will buy 1 wizard boots for 500k}
GrandExchange.isSlotFree(5); {will return if slot 5 is free}


Constants:

{offer types}
BUY_SLOT = 0;
SELL_SLOT = 1;
EMPTY_SLOT = 2;

{offer states}
STATE_COMPLETED = 0;
STATE_ABORTED = 1;
STATE_PENDING = 2;
STATE_BUSY = 3;
STATE_FREE = 4;

{screen types}
BUY_SCREEN = 0;
SELL_SCREEN = 1;
STATUS_SCREEN = 2;
ALL_SCREEN = 3; {buy/sell/status}



TGrandExchange.isOpen(): Boolean;
TGrandExchange.close(): Boolean;
TGrandExchange.getInterfaceBounds(): TBox;
TGrandExchange.getSlotsBounds(): TBoxArray;
TGrandExchange.getSlotBounds(slot: Integer): TBox;
TGrandExchange.getBuyButton(slot: Integer): TBox;
TGrandExchange.screenOpen(typeScreen: Integer): Boolean;
TGrandExchange.exitStatusScreen(): Boolean;
TGrandExchange.getOfferTypes(): TIntegerArray;
TGrandExchange.getOfferTypeSlot(slot: Integer): Integer;
TGrandExchange.getBuySlots(): TIntegerArray;
TGrandExchange.getEmptySlots(): TIntegerArray;
TGrandExchange.getSlotState(slot: Integer): Integer;
TGrandExchange.isSlotAborted(slot: Integer): Boolean;
TGrandExchange.isSlotCompleted(slot: Integer): Boolean;
TGrandExchange.isSlotPending(slot: Integer): Boolean;
TGrandExchange.isSlotBusy(slot: Integer): Boolean;
TGrandExchange.isSlotFree(slot: Integer): Boolean;
TGrandExchange.isSlotUnlocked(slot: Integer): Boolean;
TGrandExchange.abortOffer(slot: Integer): Boolean;
TGrandExchange.collectAll(): Boolean;
TGrandExchange.collectSlot(slot: Integer): Boolean;
TGrandExchange.buyOffer(itemName: String; price, quantity: Integer): Boolean;
TGrandExchange.sellOffer(invSlot, price, quantity: Integer): Boolean;


of course there is also some offer information.

example:

{GE_SLOT_1, GE_SLOT_2 ... GE_SLOT_6 are already declared in the include but NOT initialised
have to talk to flight if he can add it.}
var
GE_SLOT_1: TOffer;
if (GE_SLOT_1.init(1)) then {make sure you initialise your var the first time!}
writeln(GE_SLOT_1.getOfferType());



TOffer.init(slot: Integer): Boolean;
TOffer.getOfferType(): Integer;
TOffer.getItemName(): String;
TOffer.getPrice(): Integer;
TOffer.getAmount(): Integer;
TOffer.getCurrentAmount(): Integer;
TOffer.getProgessPercent(): Integer;


NOTES:
- GrandExchange.buyOffer is CASE SENSITIVE!
- GE_SLOT_1 until GE_SLOT_6 are declared but NOT initialsed.
- TGrandExchange is a type TInterface, so you'll have to add it yourself (for now)

instructions to add TGrandExchange to TInterface:
1. find: C:/simba/includes/aerolib/core/interfaces.simba
2. change line 16 to this: Interfaces: Array [0..10] of TInterface;
3. add GE_SCREEN = 10 to the constants, it should look like this:

const
BANKSCREEN = 0;
PINSCREEN = 1;
PINPENDING = 2;
DEPOSITSCREEN = 3;
SHOPSCREEN = 4;
TRADESCREEN = 5;
TRADECSCREEN = 6;
DUELSCREEN = 7;
DUELCSCREEN = 8;
TELEOTHERSCREEN = 9;
GE_SCREEN = 10;

4. finally, replace the setupInterfaces(); procedure with this:


procedure setupInterfaces();
begin
with Interfaces[BANKSCREEN] do
begin
FontType := 'SmallChars07';
FontColor := 2070783;
ColorTol := 5;
Text := 'Insert';
TxtBounds := toBox(125, 304, 170, 327);
end;
with Interfaces[PINSCREEN] do
begin
FontType := 'UpChars07';
FontColor := 2070783;
ColorTol := 5;
Text := 'Please';
TxtBounds := toBox(105, 62, 150, 75);
end;
with Interfaces[PINPENDING] do
begin
FontType := 'CharsNPC07';
FontColor := 65535;
ColorTol := 10;
Text := 'asked';
TxtBounds := toBox(114, 135, 204, 158);
end;
with Interfaces[DEPOSITSCREEN] do
begin
FontType := 'UpChars07';
FontColor := 2070783;
ColorTol := 5;
Text := 'Box';
TxtBounds := toBox(356, 47, 383, 60);
end;
with Interfaces[SHOPSCREEN] do
begin
FontType := 'SmallChars07';
FontColor := 2070783;
ColorTol := 5;
Text := 'shop';
TxtBounds := toBox(145, 295, 175, 314);
end;
with Interfaces[GE_SCREEN] do
begin
FontType := 'UpChars07';
FontColor := 2070783;
ColorTol := 5;
Text := 'Grand';
TxtBounds := toBox(207, 31, 311, 45);
end;
end;


you are free to save this somewhere in your includes folder and load this file yourself.

Lipcot
05-01-2015, 07:09 PM
great job! i was thinking of doing this for some of my scripts, was getting tired of buying stuff by hand.

begginer
05-01-2015, 07:58 PM
This looks great, actually i might try making a flipper with cheap items just for testing. Thanks a lot!

Hoodz
05-02-2015, 10:44 AM
great job! i was thinking of doing this for some of my scripts, was getting tired of buying stuff by hand.

This looks great, actually i might try making a flipper with cheap items just for testing. Thanks a lot!
thanks to both of you!