Drakan
2008-05-25 21:05:37
Hey these are my Grand Exchange functions! I'm adding more as i go along, so give me ideas or post your functions and I'll add them to the list! Tell me what you think ;)
// » procedure LoadGEDtm(which: string); | by The[Cheese]
// » procedure FreeGeDTM; | by The[Cheese]
// » function InGE: boolean; | by The[Cheese]
// » function InGEOffer: boolean; | by The[Cheese]
// » function OpenSlot(slot: integer): boolean; | by The[Cheese]
// » function OpenGE(side: string): boolean; | by The[Cheese]
// » function OpenAvailableBuySlot: boolean; | by The[Cheese]
// » function OpenAvailableSellSlot: boolean; | by The[Cheese]
{*******************************************************************************
procedure LoadGEDtm(which: string);
By: The[Cheese]
Description: Loads GE Dtms.
*******************************************************************************}
procedure LoadGEDtm(which: string);
begin
case lowercase(which) of
'buydtm': GeDTM := DTMFromString('78DA637CCCC0C0D0C78002361F6366E002D28' +
'C40FC1F0818416A96A1AA51E382D08C503EE37B20319F809AEB40' +
'62010135F781442B0135CF09AB0100A3F50F4E');
'selldtm': GeDTM := DTMFromString('78DA6354666460E8664001C7329919B880345' +
'086E13F103082D4B4A0AA51E382D08C503EA31E90359F801A3120' +
'6B010135E240D644026A7480AC4904D4280259CBF0AB0100B9650' +
'B73');
end;
end;
{*******************************************************************************
procedure FreeGeDTM;
By: The[Cheese]
Description: Frees GE Dtms.
*******************************************************************************}
procedure FreeGeDTM;
begin
FreeDTM(GeDTM);
end;
{*******************************************************************************
function InGE: boolean;
By: The[Cheese]
Description: Checks to see if we are in the GE by looking for the coins in the
top left corner of the GE screen.
*******************************************************************************}
function InGE: boolean;
var
gesymbol, x1, y1: integer;
begin
gesymbol := BitmapFromString(5, 9, 'beNpby7C1mOH5Wobnexn+/3' +
'8PZFgaSrRYQhEDAz7ZIEtNUmWrnTggslGWqCYDAEYsOlU=');
Result := false;
Result := (FindBitMapToleranceIn(gesymbol, x1, y1, 24, 24, 58, 58, 15))
Writeln(booltostr(Result));
FreeBitmap(gesymbol);
end;
{*******************************************************************************
function InGEOffer: boolean;
By: The[Cheese]
Description: Checks to see if we are in an offer screen by looking for the
arrow in the bottom left corner.
*******************************************************************************}
function InGEOffer: boolean;
var
x1, y1: integer;
begin
Result := false;
Result := (FindColorTolerance(x1, y1, 11909574, 29, 279, 69, 312, 10));
Writeln(booltostr(Result));
end;
{*******************************************************************************
function OpenSlot(slot: integer): boolean;
By: The[Cheese]
Description: Opens a slot [1 to 12]
*******************************************************************************}
function OpenSlot(slot: integer): boolean;
var
SlotArray: TPointArray;
begin
if(InGEOffer)then MouseBox(39, 287, 56, 303, 1);
wait(500+Random(500));
SetLength(SlotArray, 12);
SlotArray[0].x := 70; SlotArray[0].y := 151;
SlotArray[1].x := 134; SlotArray[1].y := 151;
SlotArray[2].x := 226; SlotArray[2].y := 151;
SlotArray[3].x := 289; SlotArray[3].y := 151;
SlotArray[4].x := 383; SlotArray[4].y := 151;
SlotArray[5].x := 447; SlotArray[5].y := 151;
SlotArray[6].x := 70; SlotArray[6].y := 273;
SlotArray[7].x := 134; SlotArray[7].y := 273;
SlotArray[8].x := 226; SlotArray[8].y := 273;
SlotArray[9].x := 289; SlotArray[9].y := 273;
SlotArray[10].x := 383; SlotArray[10].y := 273;
SlotArray[11].x := 447; SlotArray[11].y := 273;
Mouse(SlotArray[(slot-1)].x, SlotArray[(slot-1)].y, 10, 10, true);
repeat
wait(500);
until(InGEOffer);
Writeln('We are in the trade screen!');
end;
{*******************************************************************************
function OpenAvailableBuySlot: boolean;
By: The[Cheese]
Description: Opens an available buy slot.
*******************************************************************************}
function OpenAvailableBuySlot: boolean;
var
xx, yy: integer;
begin
LoadGEDtm('buydtm');
if(DTMRotated(GeDTM, xx, yy, MSX1, MSY1, MSX2, MSY2))then
begin
Mouse(xx, yy, 5, 5, true);
Result := true;
end else Result := false;
FreeGEDtm;
end;
{*******************************************************************************
function OpenAvailableSellSlot: boolean;
By: The[Cheese]
Description: Opens an available sell slot.
*******************************************************************************}
function OpenAvailableSellSlot: boolean;
var
xx, yy: integer;
begin
LoadGEDtm('selldtm');
if(DTMRotated(GeDTM, xx, yy, MSX1, MSY1, MSX2, MSY2))then
begin
Mouse(xx, yy, 5, 5, true);
Result := true;
end else Result := false;
FreeGEDtm;
end;
{*******************************************************************************
function OpenGE(side: string): boolean;
By: The[Cheese]
Description: Opens the Grand Exchange by clicking one of the GE Clerks.
*******************************************************************************}
function OpenGE(side: string): boolean;
var
TheTPA: TPointArray;
UpTextArray: TStringArray;
i, time: integer;
begin
case Lowercase(side) of
'n': MakeCompass('s');
's': MakeCompass('n');
'e': MakeCompass('w');
'w': MakeCompass('e');
end;
FindColorsSpiralTolerance(15, 41, TheTPA, 3744043, MSX1, MSY1, MSX2,MSY2, 10);
MarkTime(Time);
if(Length(TheTPA) > 0)then
begin
for i:= 0 to High(TheTPA) do
begin
MMouse(TheTPA[i].x, TheTPA[i].y, 0, 0);
wait(100);
if(IsUpTextMultiCustom(['Grand Exchange','Clerk','xchan']))then
begin
Mouse(TheTPA[i].x, TheTPA[i].y, 0, 0, false);
ChooseOption('Exchange');
Flag;
repeat
wait(500);
until((InGE) or (TimeFromMark(Time) > 10000));
if(TimeFromMark(Time) > 10000)then
begin
Writeln('***Failed to open GE!***');
Result := false;
Exit;
end;
Writeln('Found the banker or clerk!');
Result := true;
wait(500 + Random(500));
Exit;
end else Result := false;
if(TimeFromMark(Time) > 10000)then Exit;
end;
end else Result := false;
end;