marpis
2009-12-07 10:43:52
Hi.
I want this new OpenBankFast function to be tested before I'll commit it.
Because of the text it probably won't notice uptext or choose the option correctly, but just look if it hovers the right place (bank booth).
I don't have a member accuont so I didn't update P2P banks, only F2P.
The faster I get some results from others, the sooner OpenBank() will work again!
I want this new OpenBankFast function to be tested before I'll commit it.
Because of the text it probably won't notice uptext or choose the option correctly, but just look if it hovers the right place (bank booth).
I don't have a member accuont so I didn't update P2P banks, only F2P.
The faster I get some results from others, the sooner OpenBank() will work again!
function OpenBankFast2(Location: String): Boolean;
var
x, y, i, l, c, z, h: Integer;
Info: TVariantArray;
Booths, t: TPointArray;
ABooths: T2DPointArray;
B: TBox;
begin
if (not LoggedIn) then
Exit;
if BankScreen or PinScreen then
begin
Result := True;
Exit;
end;
case LowerCase(Location) of { Sort X Sort Y Color Tol Hue Sat Count SplitTPA? W H }
'akb', 'al kharid': Info := [MSCX - 50, MSCY, 11196157, 20, 0.20, 1.15, 100, False, 10, 10]; // Fixed 12/7, #40
'lb', 'lumbridge': Info := [MSCX, MSCY - 50, 6780805, 10, 0.19, 0.27, 100, False, 10, 10]; // Fixed 12/7, #40
'veb', 'varrock east': Info := [MSCX, MSCY + 50, 3037545, 5, 0.41, 1.32, 100, False, 10, 10]; // Fixed 12/7, #40
'vwb', 'varrock west': Info := [MSCX, MSCY, 3037545, 5, 0.41, 1.32, 500, True, 10, 10]; // Fixed 12/7, #40
'feb', 'falador east': Info := [MSCY, MSCY + 50, 5008519, 10, 0.22, 0.67, 100, False, 10, 10]; // Fixed 12/7, #40
'fwb', 'falador west': Info := [MSCY, MSCY + 50, 5074569, 10, 0.22, 0.67, 200, True, 10, 10]; // Fixed 12/7, #40
'db', 'draynor': Info := [MSCX - 50, MSCY, 5527389, 7, 0.20, 0.20, 10, False, 5, 10]; // Fixed 12/7, #40
'eb', 'edgeville bank': Info := [MSCX + 50, MSCY, 4347490, 15, 0.32, 0.61, 100, False, 10, 10]; // Fixed 12/7, #40
'ctb', 'catherby bank': Info := [MSCX, MSCY, 3239049, 8, 0.20, 0.20, 500, False, 10, 10];
'clt', 'camelot bank': Info := [MSCX, MSCY, 7636882, 5, 0.20, 0.20, 500, False, 10, 10];
'nab', 'north ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 0.20, 0.20, 500, False, 10, 10];
'sab', 'south ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 0.20, 0.20, 500, False, 10, 10];
'ynb', 'yanille bank': Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 500, False, 10, 10];
'ngb', 'north gnome bank': Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 500, False, 10, 10];
'sgb', 'south gnome bank': Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 500, False, 10, 10];
'wgb', 'warrior guild bank': Info := [MSCX, MSCY, 2578286, 7, 0.20, 0.20, 500, False, 10, 10];
'fgb', 'fishing guild bank': Info := [MSCX, MSCY, 2908796, 10, 0.20, 0.20, 500, False];
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;
end;
MakeCompass('n');
z := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Info[4], Info[5]);
FindColorsSpiralTolerance(Info[0], Info[1], Booths, Info[2], MSX1, MSY1, MSX2, MSY2, Info[3]);
ColorToleranceSpeed(z);
SetColorSpeed2Modifiers(0.2, 0.2);
{ Split to ATPA. }
If Info[7] Then
ABooths := SplitTPA(Booths, 1)
Else
ABooths := TPAtoATPA(Booths, 10);
SortATPAFrom(ABooths, Point(Info[0], Info[1]));
{ Go through ATPA. }
l := Min(GetArrayLength(ABooths) -1, 20);
for i := 0 to l do
begin
{ Too few pixels. }
if (Length(ABooths[i]) < Info[6]) then
Continue;
{ Too small TPA bounds. }
B := GetTPABounds(ABooths[i]);
If ((B.X2 - B.X1) < Info[8]) Or ((B.Y2 - B.Y1) < Info[9]) Then
Continue;
MiddleTPAEx(ABooths[i], X, Y);
MMouse(X, Y, 3, 3);
if WaitUpText('ooth', 300) Then
begin
GetMousePos(X, Y);
Mouse(x, y, 0, 0, False);
if WaitOption('uickly', 300) then
begin
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 10000);
Wait(Random(300));
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
end;
end;
end;
Result := (BankScreen) or (PinScreen);
end;