Simba Code:
(*
Bank
====
The Bank include contains Bank finders, and all banking routines.
.. contents::
*)
const
Bank_FE = 1; // (Falador East Bank)
Bank_FW = 2; // (Falador West Bank)
Bank_VE = 3; // (Varrock East Bank)
Bank_VW = 4; // (Varrock West Bank)
Bank_GE = 5; // (Varrock GE Bank)
Bank_DR = 6; // (Draynor Bank)
Bank_AK = 7; // (Al-Kharid Bank)
Bank_EV = 8; // (Edgeville Bank)
Bank_CT = 9; // (Catherby bank)
Bank_CM = 10; // (Camelot bank)
Bank_NA = 11; // (North Ardougne bank)
Bank_SA = 12; // (South Ardougne bank)
Bank_YN = 13; // (Yanille bank)
Bank_NG = 14; // (North gnome bank)
Bank_SG = 15; // (South gnome bank)
Bank_WG = 16; // (Warrior guild bank)
Bank_FG = 17; // (Fishing guild bank)
BANK_LB = 18; // (Lumbridge Castle Bank);
BANK_CG = 19; // (Cooking Guild Bank);
BANK_TV = 20; // (Taverly Bank);
SRL_BANK_SW = 21; // Soul Wars chest
SRL_BANK_CW = 22; // Castle Wars chest
SRL_BANK_B = 23; // Burthrope chest (outside warriors guild)
SRL_BANK_GG = 24; // Gamer's Grotto (north of Falador)
(*
BankScreen
~~~~~~~~~~
.. code-block:: pascal
function BankScreen: Boolean;
Finds Bankscreen. Returns true if Found.
.. note::
Author: SRL Dev Team
Last Modified: Feb. 14th, 2012 by Coh3n
Example:
.. code-block:: pascal
BankOpen := BankScreen;
*)
function BankScreen: Boolean;
begin
result := findTextTPA(4106994, 20, 20, 22, 400, 45, 'Bank', upCharsEx, nothing);
end;
(*
DepositScreen
~~~~~~~~~~~~~
.. code-block:: pascal
function DepositScreen: Boolean;
Returns true if deposit screen is Found.
.. note::
Author: Shuttleu
Last Modified: Unknown
Example:
.. code-block:: pascal
BankOpen := (not DepositScreen);
*)
function DepositScreen: Boolean;
var
X, Y: Integer;
begin
Result := FindText(x, y, 'Deposit Box', UpCharsEx, 92, 29, 396, 54);
end;
(*
PinScreen
~~~~~~~~~
.. code-block:: pascal
function PinScreen: Boolean;
Finds Pin Screen. Returns true if Found.
.. note::
Author: Naum
Last Modified: Unknown
Example:
.. code-block:: pascal
if PinScreen then
InPin();
*)
function PinScreen : Boolean;
begin
Result := FindTextTPA(2070783, 0, 105, 62, 150, 75, 'Please', UpCharsEx, Nothing);
end;
(*
ClosePinScreen
~~~~~~~~~~~~~~
.. code-block:: pascal
function ClosePinScreen: Boolean;
Results true is PinScreen is not open.
.. note::
Author: SRL
Last Modified: Unknown
Example:
.. code-block:: pascal
if PinScreen then
Result := ClosePinScreen;
*)
function ClosePinScreen: Boolean;
var
Timer : Integer;
begin
Result := False;
Timer := GetSystemTime + 10000;
while PinScreen do
begin
if Timer > GetSystemTime then
Break;
MouseBox(332, 258, 489, 281, mouse_left);
Wait(500);
end;
Result := not PinScreen;
end;
(*
InPin
~~~~~
.. code-block:: pascal
function Inpin(Pin: string): Boolean;
Enters bank pin. Will try 3 times, returns true if bank is opened.
.. note::
Author: ZephyrsFury and Nava2
Last Modified: Unknown
Example:
.. code-block:: pascal
if PinScreen then
InPin('1234');
*)
function InPin(Pin: string): Boolean;
var
Tx, Ty, X, Y, H, I, J, Tries, ColorCount : Integer;
Boxes: array of TBox;
begin
Result := False;
if not PinScreen then Exit;
if (GetNumbers(Pin) <> Pin) then
begin
srl_Warn('InPin', '''' + Pin + ''' is not a valid Pin', warn_AllVersions);
Exit;
end;
if (Length(Pin) <> 4) then
begin
srl_Warn('InPin', 'Pin must be 4 digits long', warn_AllVersions);
Exit;
end;
Boxes := [IntToBox(37, 107, 100, 170), IntToBox(127, 107, 190, 170), IntToBox(217, 107, 280, 170), IntToBox(307, 107, 370, 170),
IntToBox(37, 179, 100, 242), IntToBox(127, 179, 190, 242), IntToBox(217, 179, 280, 242),
IntToBox(37, 251, 100, 314), IntToBox(127, 251, 190, 314), IntToBox(217, 251, 280, 314)];
while PinScreen do
begin
for I := 1 to 4 do
begin
if not PinScreen then Break;
ColorCount := CountColorTolerance(clWhite, 150, 80, 380, 100, 10);
// Counts the "Now click the NUM_X digit.". This is used later on.
GetMousePos(X, Y);
if (FindText(Tx, Ty, Pin[I], UpCharsEx, 30, 100, 383, 319)) then
begin
H := High(Boxes);
for J := 0 to H do
if IntInBox(Tx, Ty, Boxes[J]) then
begin
with Boxes[J] do
if PinScreen then
MouseBox(x1, y1, x2, y2, mouse_left);
Break;
end;
end else
begin
H := High(Boxes);
for J := 0 to H do
if IntInBox(X, Y, Boxes[J]) then
begin
with Boxes[J] do
if PinScreen then
MouseBox(x1, y1, x2, y2, mouse_left);
Break;
end;
end;
Wait(100);
while (CountColorTolerance(clWhite, 150, 80, 380, 100, 10) = ColorCount) do
Wait(500);
Wait(RandomRange(300, 600));
if BankScreen or not PinScreen then
begin
Result := True;
Exit;
end;
end;
WaitFunc(@BankScreen, 50, 300);
ClickContinue(True, True);
while not FindColor(Tx, Ty, 0, 7, 460, 69, 474) do
begin
Wait(500);
if not LoggedIn then
Exit;
end;
Inc(Tries);
if Tries > 2 then
begin
srl_Warn('InPin', '''' + Pin + ''' is not the correct Pin', warn_AllVersions);
ClosePinScreen;
Exit;
end;
end;
Result := BankScreen;
end;
(*
MSTPointToBankPoint
~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function MSTPointToBankPoint(P: TPoint): TPoint;
Converts a point on the Mainscreen to the point in the Bank.
.. note::
Author: Wizzup
Last Modified: Unknown
Example:
.. code-block:: pascal
ItemSlot := MSTPointToBankPoint(Point);
*)
function MSTPointToBankPoint(MSP: TPoint): TPoint;
begin
Result.X := (MSP.X - 38) div 44;
Result.Y := (MSP.Y - 90) div 45;
end;
(*
BankPointToBankIndex
~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function BankPointToBankIndex(P: TPoint): Integer;
Converts a Bank Point (Row,Col) to Bank Index (spot in bank). (0, 0) = 1
.. note::
Author: Wizzup?
Last Modified: Unknown
Example:
.. code-block:: pascal
BankSlot := BankPointToBankIndex(itemPoint);
*)
function BankPointToBankIndex(P: TPoint): Integer;
begin
Result := P.Y * 10 + P.X + 1;
end;
(*
BankIndexToBankPoint
~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function BankIndexToBankPoint(ind: Integer): TPoint;
Converts the Bank Index (spot in bank) to a Bank Point (Row,Col). 1 = (0, 0)
.. note::
Author: Wizzup?
Last Modified: Unknown
Example:
.. code-block:: pascal
BankPoint := BankIndexToBankPoint(index);
*)
function BankIndexToBankPoint(Index: Integer): TPoint;
begin
Index := Index - 1;
Result := Point((Index mod 10), Floor(Index div 10));
end;
(*
BankIndexToMSPoint
~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function BankIndexToMSPoint(Index: Integer): TPoint;
Converts the Bank Index (spot in bank) to a Mainscreen TPoint of the Index. (Top Left)
.. note::
Author: Wizzup?
Last Modified: Unknown
Example:
.. code-block:: pascal
msPoint := BankIndexToMSPoint(index);
*)
function BankIndexToMSPoint(Index: Integer): TPoint;
begin
Index := Index - 1;
Result := Point(38 + (Index mod 10) * 44, 90 + Floor(Index div 10) * 45);
end;
(*
BankIndexToMSBox
~~~~~~~~~~~~~~~~
.. code-block:: pascal
function BankIndexToMSBox(Ind: Integer): TBox;
Converts the Bank Index (spot in bank) to a Mainscreen TBox of the Index.
.. note::
Author: Wizzup?
Last Modified: Unknown
Example:
.. code-block:: pascal
msBox := BankIndexToMSBox(index);
*)
function BankIndexToMSBox(Index: Integer): TBox;
var
P: TPoint;
begin
P := BankIndexToMSPoint(Index);
Result.X1 := P.X;
Result.Y1 := P.Y;
Result.X2 := Result.X1 + 31;
Result.Y2 := Result.Y1 + 32;
end;
(*
GetBankItemAmount
~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function GetBankIndexItemAmount(const Index: Integer): Integer;
Returns the amount of an item in the bank at bank index, Index.
.. note::
Author: Daniel
Last Modified: Jan. 03, 2012 by Daniel
Example:
.. code-block:: pascal
amt := GetBankIndexItemAmount(13);
*)
function GetBankIndexItemAmount(const Index: Integer): Integer;
begin
Result := getAmountBox(BankIndexToMSBox(Index));
end;
(*
GetBankItemAmount
~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function GetBankItemAmount(const Row, Col: Integer): Integer;
Returns the amount of an item in the bank at bank screen coordinates (Row, Col).
.. note::
Author: Daniel
Last Modified: Jan. 03, 2012 by Daniel
Example:
.. code-block:: pascal
amt := GetBankItemAmount(0, 5);
*)
function GetBankItemAmount(const Row, Col: Integer): Integer;
begin
Result := GetBankIndexItemAmount(BankPointToBankIndex(Point(Row, Col)));
end;
(*
GetMSBankItemAmount
~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function GetMSBankItemAmount(const x, y: Integer): Integer;
Returns the amount of an item in the bank at main screen coordinates x, y.
.. note::
Author: Daniel
Last Modified: Jan. 03, 2012 by Daniel
Example:
.. code-block:: pascal
amt := GetMSBankItemAmount(250, 100);
*)
function GetMSBankItemAmount(const x, y: Integer): Integer;
begin
Result := GetBankIndexItemAmount(BankPointToBankIndex(MSTPointToBankPoint(Point(x, y))));
end;
(*
DepositItemBox
~~~~~~~~~~~~~~
.. code-block:: pascal
function DepositItemBox(Item: Integer): TBox;
Returns a TBox surround Item (1 to 28) in the Deposit Box screen.
.. note::
Author: ZephyrsFury
Last Modified: Unknown
Example:
.. code-block:: pascal
currentItem := DepositItemBox(itemSlot);
*)
function DepositItemBox(Item: Integer): TBox;
begin
Result.X1 := 97 + (Item - 1) mod 7 * 48;
Result.Y1 := 60 + (Item - 1) div 7 * 50;
Result.X2 := Result.X1 + 48;
Result.Y2 := Result.Y1 + 50;
end;
(*
FixBank
~~~~~~~
.. code-block:: pascal
procedure FixBank;
Scrolls the bank screen up.
.. note::
Author: lordsaturn, Nava2, IceFire908 & Bixby Sayz
Last Modified: Unknown
Example:
.. code-block:: pascal
FixBank;
*)
procedure FixBank;
var
Timer : Integer;
begin
if (SimilarColors(GetColor(481, 110), 723981, 20)) then
if (BankScreen) then
if (not (SimilarColors(GetColor(489, 101), 1316634, 5))) then
begin
Timer := GetTimeRunning + 5000;
MouseBox(482, 101, 488, 111, mouse_left);
while ((not (SimilarColors(GetColor(489, 101), 1316634, 5))) and (GetTimeRunning < Timer)) do
Wait(50 + Random(50));
Wait(RandomRange(100, 200));
end;
end;
(*
FixBankTab
~~~~~~~~~~
.. code-block:: pascal
procedure FixBankTab;
Fixes the BankTab to 'View All'
.. note::
Author: Wizzup?
Last Modified: Unknown
Example:
.. code-block:: pascal
if FixBankTab then
SearchForItem;
*)
function FixBankTab: Boolean;
var
activeTPA, notactiveTPA: TPointArray;
T: Integer;
begin
Result := False;
FindColorsTolerance(activeTPA, 2896954, 25, 45, 70, 80, 5);
FindColorsTolerance(notactiveTPA, 2437688, 25, 45, 70, 80, 5);
if Length(activeTPA) > Length(notactiveTPA) then
begin
Result := True;
Exit;
end;
Mouse(40, 60, 10, 10, mouse_left);
T := GetSystemTime;
while Length(activeTPA) <= Length(notactiveTPA) do
begin
FindColorsTolerance(activeTPA, 2896954, 25, 45, 70, 80, 5);
FindColorsTolerance(notactiveTPA, 2437688, 25, 45, 70, 80, 5);
Wait(500);
if ((GetSystemTime - T) div 1500) mod 2 = 0 then
Mouse(40, 60, 10, 10, mouse_left);
if GetSystemTime - T > 10000 then
Exit;
end;
end;
(*
CurrentBankTab
~~~~~~~~~~~~~~
.. code-block:: pascal
function CurrentBankTab: Integer;
Returns Current Bank Tab selected
.. note::
Author: Narcle
Last Modified: Unknown
Example:
.. code-block:: pascal
curTab := GetCurrentBankTab;
*)
function CurrentBankTab: Integer;
begin
Result := -1;
if not BankScreen then
Exit;
for Result := 1 to 9 do
if GetColor(40 + 48 * (Result - 1), 83) = 2896954 then
Exit;
Result := 0;
end;
(*
ExistsBankTab
~~~~~~~~~~~~~
.. code-block:: pascal
function ExistsBankTab(T: Integer): Boolean;
Returns true if Bank Tab Exists
.. note::
Author: Narcle
Last Modified: Unknown
Example:
.. code-block:: pascal
if ExistsBankTab(2) then
BankTab(2);
*)
function ExistsBankTab(T: Integer): Boolean;
var
x, y: integer;
begin
Result := False;
if not BankScreen then
begin
srl_Warn('ExistsBankTab', 'Bank not open.', warn_AllVersions);
Exit;
end;
if (not(InRange(T, 1, 9))) then
begin
srl_Warn('ExistsBankTab', 'Bank Tab: ' + IntToStr(T) + ' is not possible (1..9) only.', warn_AllVersions);
Exit;
end;
if T = 1 then
Result := true;
if FindColor(x, y, srl_outline_black, 27+(T-1)*48, 51, 70+(T-1)*48, 81) then
Result := true;
end;
(*
BankTab
~~~~~~~
.. code-block:: pascal
function BankTab(T: Integer): Boolean;
If Bank Tab is there will switch to it.
.. note::
Author: Narcle
Last Modified: Unknown
Example:
.. code-block:: pascal
if ExistsBankTab(2) then
BankTab(2);
*)
function BankTab(T: Integer): Boolean;
begin
result := false;
if not BankScreen then
Exit;
if T = CurrentBankTab then
Begin
Result := true;
Exit;
end;
if not ExistsBankTab(T) then
srl_Warn('BankTab', 'Bank Tab '+inttostr(T) +' does not Exist.', warn_AllVersions)
else
Mouse(48 * T, 57, 10, 10, mouse_left);
Result := T = CurrentBankTab;
end;
(*
SearchBank
~~~~~~~~~~
.. code-block:: pascal
procedure SearchBank(Item: string);
Searches for Item in your bank.
.. note::
Author: ZephyrsFury
Last Modified: Unknown
Example:
.. code-block:: pascal
SearchBank('air rune');
if FindDTM(..) then
*)
procedure SearchBank(Item: string);
var
T, II: Integer;
begin
if (not(BankScreen)) then Exit;
for II := 0 to 2 do
begin
FixBankTab;
Mouse(75, 300, 20, 10, mouse_left);
T := GetSystemTime;
while (BankScreen) and (GetSystemTime - T < 5000) do
begin
Wait(500 + Random(500));
if (FindTextTpa(0, 0, 350, 392, 399, 410, 'search', UpCharsEx, Nothing)) then
begin
TypeSend(Item);
Exit;
end;
end;
Wait(500 + Random(500));
end;
end;
(*
MouseBankSlot
~~~~~~~~~~~~~
.. code-block:: pascal
procedure MouseBankSlot(BankSlot, Action: integer);
.. note::
by Fwd Motion
Last Modified: Feb. 09, 2012 by Fwd Motion
Example:
.. code-block:: pascal
MouseBankSlot(1, mouse_Right);
if (WaitOption('ithdraw-All', 500)) then
Writeln('Withdrew item');
*)
procedure MouseBankSlot(BankSlot, Action: integer);
var
BankBox: TBox;
X, Y: Integer;
begin
BankBox := BankIndexToMSBox(BankSlot);
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BankBox)) then
MouseBox(BankBox.X1, BankBox.Y1, BankBox.X2, BankBox.Y2, Action);
end;
(*
QuickDeposit
~~~~~~~~~~~~
.. code-block:: pascal
function QuickDeposit(Which: Integer): Boolean;
Uses the quick deposit buttons in the bottom right of the bank. Valid
arguments for 'Which' are:
* SRL_DEPOSIT_ALL
* SRL_DEPOSIT_COINS
* SRL_DEPOSIT_EQUIPMENT
* SRL_DEPOSIT_FOLLOWER
.. note::
Author: ZephyrsFury & Quickmarch & Shuttleu
Last Modified: January 08, 2012 by Coh3n
Example:
.. code-block:: pascal
QuickDeposit(SRL_DEPOSIT_COINS);
*)
const
SRL_DEPOSIT_ALL = 0;
SRL_DEPOSIT_COINS = 1;
SRL_DEPOSIT_EQUIPMENT = 2;
SRL_DEPOSIT_FOLLOWER = 3;
procedure QuickDeposit(Which: Integer);
var
StartX: Integer;
begin
if (BankScreen) or (DepositScreen) then
begin
case Which of
SRL_DEPOSIT_ALL: StartX := 362;
SRL_DEPOSIT_EQUIPMENT: StartX := 395;
SRL_DEPOSIT_FOLLOWER: StartX := 431;
SRL_DEPOSIT_COINS: StartX := 467;
else
SRL_Warn('QuickDeposit', 'Invalid deposit method ', WARN_ALLVERSIONS);
end;
Mouse(StartX - 58 * Integer(DepositScreen), 303 - 29 * Integer(DepositScreen), 15, 10, True);
Wait(200 + Random(300));
end;
end;
(*
DepositAll
~~~~~~~~~~
.. code-block:: pascal
function DepositAll: Boolean;
Deposits all items in your inventory.
.. note::
Author: Shuttleu
Last Modified: January 08, 2012 by Coh3n
Example:
.. code-block:: pascal
DepositAll();
*)
function DepositAll: Boolean;
begin
if (InvEmpty) then
begin
Result := True;
Exit;
end;
QuickDeposit(SRL_DEPOSIT_ALL);
Result := WaitFunc(@InvEmpty, 50, 3000);
end;
(*
Deposit
~~~~~~~
.. code-block:: pascal
Procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);
Deposits from Slot to ToSlot.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)
.. note::
Author: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town
Last Modified: Unknown
Example:
.. code-block:: pascal
Deposit(1, 28, True);
*)
procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);
var
DepositX, BScreen, DScreen: Boolean;
All: Variant;
I, T, x, y: Integer;
B: TBox;
begin
BScreen := BankScreen;
if (not(BScreen)) then
DScreen := DepositScreen;
if not (BScreen or DScreen) then
Exit;
if vType = 2 then
srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
DepositX := False;
case VarType(vType) of
varInteger: begin
DepositX := not InIntArray([1, 5, 10], vType);
if vType = 1 then
All := False
else
All := True;
end;
varBoolean: All := vType;
end;
if (SlotFrom = 1) and (SlotTo = 28) and (All = true) then
if DepositAll then
exit;
for I := SlotFrom to SlotTo do
begin
if (BScreen) then
begin
If Not ExistsItem(I) Then
Continue;
if (not All) then
MouseItem(I, mouse_left)
else
MouseItem(I, mouse_right);
end else
begin
B := DepositItemBox(I);
if (not(FindColor(X, Y, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2))) then
Continue;
if (not All) then
Mouse((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1, 0, 0, mouse_left)
else
Mouse((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1, 0, 0, mouse_right);
end;
if DepositX then
begin
WaitOptionMulti(['Deposit-X', 'Deposit'], 200);
T := GetSystemTime;
while (not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) and (GetSystemTime - T < 3000) do
Wait(100);
TypeSend(vType);
end else if VarType(vType) = varInteger then
WaitOptionMulti(['Deposit-' + inttostr(vType), 'Deposit'], 200)
else
WaitOptionMulti(['Deposit-All', 'All', 'osit'], 200);
T := GetSystemTime;
Wait(RandomRange(200, 300));
repeat
if (BScreen) then
if (not(ExistsItem(I))) then Break;
if (DScreen) then
if (not(FindColor(X, Y, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2))) then Break;
Wait(50);
until(GetSystemTime - T > 2000);
end;
end;
(*
WithdrawEx
~~~~~~~~~~
.. code-block:: pascal
function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
Withdraws Amount at Column/Row.
.. note::
Author: Starblaster100, Town, Wizzup? and Narcle, small fixes by r!ch!e & EvilChicken!
Last Modified: Unknown
Example:
.. code-block:: pascal
WithdrawEx(1, 3, 28, ['ron ore', 'ore', 'on or']);
*)
function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;
BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_move);
if (Length(Uptexts) > 0) then
if (not WaitUptextMulti(Uptexts, 500)) then
Exit;
if (Amount = 1) then
ClickMouse2(mouse_left)
else
ClickMouse2(mouse_right);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;
if (Amount = -1) then
begin
if (WaitOptionMultiEx(['Withdraw-All but', 'l b'], 'All', Nothing, 300)) then
Result := ChooseOptionMulti(['Withdraw-All but', 'l b']);
end else
if (Amount = 0) then
begin
if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
Result := ChooseOptionMulti(['Withdraw-All', 'w-A']);
end else
if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)], 'All', Nothing, 300)) then
Result := ChooseOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)]);
if (not (Result)) and (Amount > 0) then
begin
if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], nothing)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);
if WaitOptionMulti(['Withdraw-X', 'w-X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;
(*
Withdraw
~~~~~~~~
.. code-block:: pascal
function Withdraw(Col, Row, Amount: Integer): Boolean;
Withdraws Amount at Column/Row.
.. note::
Author: Starblaster100, Town, Wizzup? and Narcle
Last Modified: Unknown
Example:
.. code-block:: pascal
Withdraw(1, 3, 28);
*)
function Withdraw(col, row, Amount: Integer): Boolean;
begin
Result := WithdrawEx(Col, Row, Amount,[]);
end;
(*
WithdrawItemEx
~~~~~~~~~~~~~~
.. code-block:: pascal
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer;
Amount: integer; UpText: String; Tol: TIntegerArray): boolean;
Withdraws an item from the bank by using "Ident" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp
masks, or the count of colors for TPA item finding.
Valid IdentTypes are all in FindItem.
Index:
The Bank Index where the item is found, must be a variable.
Speeds up future withdraws.
Amount:
Amount to withdraw from bank.
UpText:
The UpText which the function checks for.
.. note::
Author: Nava2
Last Modified: Unknown
Example:
.. code-block:: pascal
if WithdrawItemEx(theColor, 'color', itemSlot, 27, 'ew log', [3]) then
CloseBank;
*)
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: string; Tol: TIntegerArray): Boolean;
var
x, y: integer;
BPoint: TPoint;
BankBox: TBox;
Found: Boolean;
t: TPointArray;
label
Start;
begin
Result := False;
if not BankScreen then Exit;
FixBank;
if (Index = 0) then
begin
Start:
for Index := 1 to 50 do
begin
if FindItemEx(x, y, IdentType, Ident, BankIndexToMSBox(Index), Tol) then
begin
MMouse(x, y, 4, 4);
if WaitUpText(UpText, 300) then
begin
Writeln('Found Item at Bank Slot ' + IntToStr(Index) + '.');
Found := True;
Break;
end else
Writeln('Found Incorrect Item, Moving to new Bank Spot.');
end;
end;
end else
begin
BankBox := BankIndexToMSBox(Index);
FindColors(t, srl_outline_black, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2);
BankBox := GetTPABounds(t);
MouseBox(BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, mouse_move);
if WaitUpText(UpText, 300) then
Found := true
else
begin
Writeln('Item Moved from Bank Slot ' + IntToStr(Index) + ', checking bank again.');
GoTo Start;
end;
end;
Wait(RandomRange(200, 350));
if Found then
begin
BPoint := BankIndexToBankPoint(Index);
//Writeln(IntToStr(BPoint.x) + ', ' + IntToStr(BPoint.y));
Withdraw(BPoint.x, BPoint.y, Amount);
Result := True;
end else
begin
Index := 0;
SRL_Warn('WithdrawItem', 'Could not Find ' + IdentType + ' in Bank. [Uptext: ' + UpText + ']', Warn_AllVersions);
end;
end;
(*
WithdrawItem
~~~~~~~~~~~~
.. code-block:: pascal
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer;
UpText: TStringArray; Tol: TIntegerArray): boolean;
Withdraws an item using WithdrawItemEx, but removes the Index check.
.. note::
Author: Nava2
Last Modified: Unknown
Example:
.. code-block:: pascal
if WithdrawItem(theColor, 'color', 27, ['ew log', 'ew l'], [3]) then
CloseBank;
*)
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;
var
I : Integer;
begin
Result := WithdrawItemEx(Ident, IdentType, I, Amount, UpText, Tol);
end;
(*
Notes
~~~~~
.. code-block:: pascal
procedure Notes(SwitchOn: Boolean);
Toggles note withdrawal on or off.
.. note::
Author: lordsaturn, idea by R1ch
Last Modified: Unknown
Example:
.. code-block:: pascal
Notes(True);
Withdraw(Col, Row, 100);
*)
procedure Notes(SwitchOn: Boolean);
begin
if BankScreen then
if (getColor(225, 302) = 0) xor switchOn then
Mouse(228, 306, 10, 10, mouse_left);
end;
(*
CloseBank
~~~~~~~~~
.. code-block:: pascal
function CloseBank: Boolean;
Closes the bank window - Tries twice before exiting
.. note::
Author: Starblaster100
Last Modified: Unknown
Example:
.. code-block:: pascal
if Withdraw(Col, Row, 100) then
CloseBank;
*)
function CloseBank: Boolean;
var
i, Timer: Integer;
begin
Result := False;
if BankScreen then
begin
Timer := GetTimeRunning + 8000;
repeat
Mouse(483, 28, 10, 12, mouse_left);
for i := 0 to 30 do
begin
if not BankScreen then
begin
Result:= True;
Break;
end;
Wait(100);
end;
Wait(Random(100));
until (GetTimeRunning > Timer) or Result;
end;
end;
(*
OpenBankQuiet
~~~~~~~~~~~~~
.. code-block:: pascal
function OpenBankQuiet(WhichBank: Integer): Boolean;
Opens any given bank in the free world using
FindDeformedBitmapToleranceIn. Avoids strange mouse movements. Will cause
significant lag (approx. 1 second), but finds the bank with one click.
Valid arguments are:
BANK_FE (Falador East Bank)
BANK_FW (Falador West Bank)
BANK_VE (Varrock East Bank)
Bank_VW (Varrock West Bank)
BANK_DR (Draynor Bank)
Bank_EV (Edgeville Bank)
BANK_AK (Al-Kharid Bank)
.. note::
Author: WT-Fakawi and modified by Ron
Last Modified: Unknown
Example:
.. code-block:: pascal
if OpenBankQuiet(BANK_FE) then
Withdraw(...);
*)
function OpenBankQuiet(WhichBank: Integer): Boolean;
var
TheCounter, dx, dy, tol, Mark2, Mark3: Integer;
acc, accthres: Extended;
begin
result := false;
case WhichBank of
BANK_FE, BANK_FW: TheCounter := BitmapFromString(1, 10, '6C583296897A948779948779736' +
'C63A59E968C7F6F9686749B8A7685663E');
// varrock west
BANK_VW: TheCounter:= BitmapFromString(10, 1, 'A0997F504A49504A49504A495E4' +
'F215E4F215E4F215E4F212C250EA0997F');
// varrock east
BANK_VE: TheCounter := BitmapFromString(1, 10, '5E4D1589826D88806D88806D867' +
'F6C9996907C7664847D648C836891876B');
// draynor and this works too for alkharid
BANK_AK, BANK_DR, Bank_EV: TheCounter:= BitmapFromString(12, 1, '584209735C29735C29735C29605' +
'85558504D60504D58504D58504D58504D58504D605855');
else
begin
srl_Warn('OpenBankQuiet', 'Unknown bank: ' + IntToStr(WhichBank), warn_AllVersions);
Exit;
end;
end;
MarkTime(Mark3);
tol := 1;
accthres := 0.6;
repeat
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
if WaitUpTextMulti(['ank', 'Bo', 'ot'], 1000) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, mouse_left);
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
FindDeformedBitmapToleranceIn(TheCounter, dx, dy, MSX1 + 50, MSY1 + 50, MSX2
- 50, MSY2 - 50, tol, 4, True, acc);
if (acc >= accthres) then
begin
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
MMouse(dx, dy, 0, 0);
if WaitUptextMulti(['ank', 'Bo', 'ot'], 1000) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, mouse_left);
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
Wait(100);
tol := tol + 4;
if tol >= 20 then
begin
tol := 1;
accthres := accthres - 0.1;
if accthres < 0.2 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
end;
until TimeFromMark(Mark3) > 60000;
FreeBitmap(TheCounter);
end;
(*
OpenBankGlass
~~~~~~~~~~~~~
.. code-block:: pascal
function OpenBankGlass(WhichBank: Integer; ChangeCompass, ChangeAngle: Boolean): Boolean;
Opens the bank.
Valid arguments are:
BANK_FE (Falador East Bank)
BANK_FW (Falador West Bank)
BANK_VE (Varrock East Bank)
BANK_VW (Varrock West Bank)
BANK_DR (Draynor Bank)
BANK_AK (Al-Kharid Bank)
Bank_EV (Edgeville Bank)
BANK_CT (Catherby bank)
Bank_CM (Camelot bank)
Bank_NA (North Ardougne bank)
Bank_SA (South Ardougne bank)
Bank_YN (Yanille bank)
Bank_NG (North gnome bank)
Bank_SG (South gnome bank)
Bank_WG (Warrior guild bank)
Bank_FG (Fishing guild bank)
.. note::
Author: Wizzup? and modified by Ron
Last Modified: Unknown
Example:
.. code-block:: pascal
if OpenBankGlass(BANK_FE, True, False) then
Withdraw(...);
*)
function OpenBankGlass(WhichBank: Integer; ChangeCompass, ChangeAngle: Boolean): Boolean;
var
OBC: TPoint;
c, Speed, Col: Integer;
begin
result := false;
Speed := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if ChangeAngle then SetAngle(SRL_ANGLE_HIGH);
if ChangeCompass then
begin
c := Random(2);
case WhichBank of
BANK_FE, BANK_FW, BANK_VE, BANK_CT, Bank_CM, Bank_NA: if c = 0 then MakeCompass('N') else MakeCompass('S');
BANK_AK, BANK_DR, Bank_EV, BANK_VW, Bank_SA, Bank_YN, Bank_SG, Bank_WG, Bank_FG: if c = 0 then MakeCompass('E') else MakeCompass('W');
Bank_NG: if c = 0 then MakeCompass(45) else MakeCompass(225);
end;
end;
Col := 10070458;
If (WhichBank = Bank_NA) or (WhichBank = Bank_SA)then
Col := 8095371;
if FindColorSpiralTolerance(OBC.x, OBC.y, Col, MSX1, MSY1, MSX2, MSY2, 10) then
begin
if WaitUpTextMulti(['nk', 'bo', 'ot'], 1000) then
begin
Mouse(OBC.x, OBC.y, 0, 0, mouse_left);
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
end else
if FindObj(OBC.x, OBC.y, 'ank', 10070458, 20) then
begin
Mouse(OBC.x, OBC.y, 0, 0, mouse_left);
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
ColorToleranceSpeed(Speed);
end;
(*
OpenBankFast
~~~~~~~~~~~~
.. code-block:: pascal
function OpenBankFast(Location: Integer): Boolean;
Opens the bank.
Valid arguments are:
BANK_FE, 'falador east bank'
BANK_FW, 'falador west bank'
BANK_VE, 'varrock east bank'
BANK_VW, 'varrock west bank'
BANK_DR , 'draynor bank'
BANK_AK, 'al-kharid bank'
Bank_EV (Edgeville Bank)
BANK_CT, 'catherby bank'
Bank_CM, 'camelot bank'
Bank_NA, 'north ardougne bank'
Bank_SA, 'south ardougne bank'
Bank_YN, 'yanille bank'
Bank_NG, 'north gnome bank'
Bank_SG, 'south gnome bank'
Bank_WG, 'warrior guild bank'
Bank_FG, 'fishing guild bank'
BANK_TV, 'taverly bank'
.. note::
Author: Wizzup? and Nielsie95
Last Modified: Unknown
Example:
.. code-block:: pascal
if OpenBankFast(BANK_FE) then
Withdraw(...);
*)
function OpenBankFast(Location: Integer): Boolean;
var
bo, i, l, c, z: Integer;
Info: TVariantArray;
Booths: TPointArray;
ABooths: T2DPointArray;
UpText: TStringArray;
B: TBox;
begin
result := false;
if (not LoggedIn) then
Exit;
if BankScreen or PinScreen then
begin
Result := True;
Exit;
end;
UpText := ['Bank booth', 'ank boo'];
case Location of { Sort X Sort Y Color Tol Hue Sat Count SplitTPA? W H }
BANK_CG: Info := [MSCX, MSCY, 5666708, 17, 0.06, 0.77, 100, False, 10, 10];
BANK_AK: Info := [MSCX - 50, MSCY, 11196157, 20, 0.20, 1.15, 100, False, 10, 10]; // Fixed 12/7, #40
BANK_LB: Info := [MSCX, MSCY - 50, 6780805, 10, 0.19, 0.27, 100, False, 10, 10]; // Fixed 12/7, #40
BANK_VE: Info := [MSCX, MSCY + 50, 3037545, 5, 0.41, 1.32, 100, False, 10, 10]; // Fixed 12/7, #40
BANK_VW: Info := [MSCX, MSCY, 3037545, 5, 0.41, 1.32, 100, False, 10, 10]; // Fixed 12/7, #40
BANK_FE: Info := [MSCX, MSCY + 50, 5008519, 10, 0.22, 0.67, 100, False, 10, 10]; // Fixed 12/7, #40
BANK_FW: Info := [MSCX, MSCY + 50, 5074569, 15, 0.22, 0.67, 50, False, 10, 10]; // Fixed 12/7, #40
BANK_DR: begin UpText := ['ount', 'unte', 'oun', 'unter'];
Info := [MSCX - 50, MSCY, 5136741, 5, 0.73, 0.49, 15, False, 10, 10]; // Fixed 12/7, #40
end;
Bank_EV: Info := [MSCX + 20, MSCY, 3561835, 20, 0.32, 0.61, 50, False, 10, 10]; // Fixed 12/7, #40
BANK_CT: Info := [MSCX, MSCY, 3239049, 8, 0.20, 0.20, 100, False, 10, 10];
Bank_CM: Info := [MSCX, MSCY, 7636882, 5, 0.20, 0.20, 100, False, 10, 10];
Bank_NA: Info := [MSCX, MSCY, 4084572, 5, 0.20, 0.20, 100, False, 10, 10];
Bank_SA: Info := [MSCX, MSCY, 4084572, 5, 0.20, 0.20, 100, False, 10, 10];
Bank_YN: Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 100, False, 10, 10];
Bank_NG: Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 100, False, 10, 10];
Bank_SG: Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 100, False, 10, 10];
Bank_WG: Info := [MSCX, MSCY, 2578286, 7, 0.20, 0.20, 100, False, 10, 10];
Bank_FG: Info := [MSCX, MSCY, 2908796, 10, 0.20, 0.20, 100, False, 10, 10];
BANK_TV: begin UpText := ['ount','unte','oun','unter'];
Info := [MSCX, MSCY, 3556433, 7, 0.20, 0.20, 100, False, 10, 10];
end;
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+ IntToStr(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);
Booths := [];
{ Go through ATPA. }
l := GetArrayLength(ABooths) -1;
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;
Inc(bo);
SetArrayLength(Booths, bo);
Booths[bo-1] := MiddleTPA(ABooths[i]);
end;
SortTPAFrom(Booths, Point(Info[0], Info[1]));
l := GetArrayLength(Booths) -1;
for i := 0 to l do
begin
MMouse(Booths[i].X, Booths[i].Y, 3, 3);
if WaitUpTextMulti(UpText, 1000) Then
begin
GetMousePos(Booths[i].X, Booths[i].Y);
Mouse(Booths[i].X, Booths[i].Y, 0, 0, mouse_left);
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 10000);
Wait(Random(300));
if (HowManyPlayers > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
if (Result) then Exit;
end;
end;
end;
(*
OpenBankNPC
~~~~~~~~~~~
.. code-block:: pascal
function OpenBankNPC: Boolean;
Opens the bank by using Banker.
.. note::
Author: Home
Last Modified: December 28 by Narcle
Example:
.. code-block:: pascal
if OpenBankNPC then
Withdraw(...);
*)
function OpenBankNPC: Boolean;
var
NPCBox :TBox;
Colors, NPCArray :TPointArray;
ATPA: T2DPointArray;
MSNPC, NPCPoint :TPoint;
CTS, C, II, I :Integer;
begin
Result := False;
Result := (BankScreen) or (PinScreen);
If Result then
Exit;
NPCArray := GetMinimapDots('NPC');
If Length(NPCArray) < 1 then
Exit;
SortTPAFrom(NPCArray, Point(MMCX, MMCY));
for I := 0 to High(NPCArray) do
begin
NPCPoint := MMToMS(NPCArray[I])
If NPCPoint = Point(-1, -1) then
Continue;
with NPCPoint do
NPCBox := IntToBox(Max(X - 40, MSX1), Max(Y - 40, MSY1), Min(X + 40, MSX2), Min(Y + 40, MSY2));
If PixelShift(NPCBox, 200) > 500 then
Continue;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 1.52);
FindColorsTolerance(Colors, 6067652, NPCBox.X1, NPCBox.Y1, NPCBox.X2, NPCBox.Y2, 13);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(Colors, 15, 20);
SortATPASize(ATPA, True);
for II := 0 to High(ATPA) do
begin
MSNPC := MiddleTPA(ATPA[II]);
MMouse(MSNPC.X, MSNPC.Y, 3, 3);
If WaitUpTextMulti(['ooth', 'anker'], 200) then
begin
ClickMouse2(False);
If WaitOptionMulti(['Bank B', 'nk B'], 600) then
MarkTime(c);
Repeat
Wait(RandomRange(50, 100));
Until (BankScreen) or (PinScreen) or (TimeFromMark(C) > 4500);
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
If Result then
Exit;
end;
end;
end;
end;
(*
OpenBankChestEdge
~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function OpenBankChestEdge(Location: Integer): Boolean;
Opens the bank. Valid arguments are:
* SRL_BANK_SW (Soul Wars Bank)
* SRL_BANK_CW (Castle Wars Bank)
* SRL_BANK_B (Burthrope)
.. note::
Author: -daazndagger- (kept WT-Fakawi's structure)
Last Modified: 18/01/2012
Example:
.. code-block:: pascal
if OpenBankChestEdge(SRL_BANK_SW) then
Withdraw(...);
*)
function OpenBankChestEdge(Location: Integer): Boolean;
var
bo, i, l, c, z: Integer;
Info: TVariantArray;
Chests: TPointArray;
AChests: T2DPointArray;
UpText: TStringArray;
B: TBox;
begin
result := false;
if (not LoggedIn) then
Exit;
if BankScreen or PinScreen then
begin
Result := True;
Exit;
end;
UpText := ['Bank', 'chest', 'nk che'];
{ 0 1 2 3 4 5 6 7 8 9 10 }
case Location of { Sort X Sort Y Color Tol Hue Sat Count SplitTPA? W H Compass}
SRL_BANK_SW : Info := [MSCX , MSCY, 10198185, 21, 0.08, 0.25, 50, True , 10, 10, 'w'];
SRL_BANK_CW : Info := [MSCX , MSCY, 10198185, 21, 0.08, 0.25, 50, True , 10, 10, 'n'];
SRL_BANK_B : Info := [MSCX , MSCY, 10198185, 21, 0.08, 0.25, 50, True , 10, 10, 'n'];
SRL_BANK_GG : Info := [MSCX , MSCY, 5921630, 9 , 0.47, 0.08, 50, True , 10, 10, 'n'];
else
begin
srl_Warn('OpenBankChestEdge', 'Unknown bank: '+IntToStr(Location), warn_AllVersions); //will output loc as int (no longer string)
Exit;
end;
end;
MakeCompass(Info[10]);
//SetAngle(SRL_ANGLE_HIGH); //??
z := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Info[4], Info[5]);
FindColorsSpiralTolerance(Info[0], Info[1], Chests, Info[2], MSX1, MSY1, MSX2, MSY2, Info[3]);
ColorToleranceSpeed(z);
SetColorSpeed2Modifiers(0.2, 0.2);
{ Split to ATPA. }
if Info[7] then
AChests := SplitTPA(Chests, 3)
else
AChests := TPAtoATPA(Chests, 10);
Chests := [];
{ Go through ATPA. }
l := GetArrayLength(AChests) -1;
for i := 0 to l do
begin
{ Too few pixels. }
if (Length(AChests[i]) < Info[6]) then
Continue;
{ Too small TPA bounds. }
B := GetTPABounds(AChests[i]);
If ((B.X2 - B.X1) < Info[8]) Or ((B.Y2 - B.Y1) < Info[9]) Then
Continue;
Inc(bo);
SetArrayLength(Chests, bo);
Chests[bo-1] := MiddleBox(GetTPABounds(AChests[i]));
end;
SortTPAFrom(Chests, Point(Info[0], Info[1]));
l := GetArrayLength(Chests) -1;
for i := 0 to l do
begin
MMouse(Chests[i].X, Chests[i].Y, 3, 3);
if WaitUpTextMulti(UpText, 1000) Then
begin
GetMousePos(Chests[i].X, Chests[i].Y);
Case Random(9) of
0..7: Mouse(Chests[i].X, Chests[i].Y, 0, 0, mouse_left);
8: begin
Mouse(Chests[i].X, Chests[i].Y, 0, 0, mouse_right);
if not WaitOptionMulti(['Use', 'se'], 1000) then Exit;
end;
end;
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 10000);
Wait(Random(300));
if (HowManyPlayers > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
if (Result) then Exit;
end;
end;
end;
(*
OpenBankChest
~~~~~~~~~~~~~
.. code-block:: pascal
function OpenBankChest(WhichBank: Integer): Boolean;
Opens the bank. Valid arguments are:
* SRL_BANK_SW (Soul Wars Bank)
* SRL_BANK_CW (Castle Wars Bank)
* SRL_BANK_B (Burthrope)
.. note::
Author: SRL Dev Team
Last Modified: 18/01/2012
Example:
.. code-block:: pascal
if OpenBankChest(SRL_BANK_SW) then
Withdraw(...);
*)
function OpenBankChest(WhichBank: Integer): Boolean;
begin
result := false;
if BankScreen or PinScreen then
begin
Result := True;
Exit;
end;
Result := OpenBankChestEdge(WhichBank);
end;
(*
OpenBank
~~~~~~~~
.. code-block:: pascal
function OpenBank(WhichBank: Integer, ChangeCompass, ChangeAngle: Boolean): Boolean;
Opens the bank if possible.
Valid arguments are:
BANK_FE (Falador East Bank)
BANK_FW (Falador West Bank)
BANK_VE (Varrock East Bank)
BANK_VW (Varrock West Bank)
BANK_DR (Draynor Bank)
BANK_AK (Al-Kharid Bank)
Bank_EV (Edgeville Bank)
BANK_LB (Lumbridge Bank)
BANK_CT (Catherby bank)
Bank_CM (Camelot bank)
Bank_NA (North Ardougne bank)
Bank_SA (South Ardougne bank)
Bank_YN (Yanille bank)
Bank_NG (North gnome bank)
Bank_SG (South gnome bank)
Bank_WG (Warrior guild bank)
Bank_FG (Fishing guild bank)
.. note::
Author: SRL Dev Team
Last Modified: January 31st, 2012 by Coh3n
Example:
.. code-block:: pascal
if OpenBank(BANK_FE, False, True) then
Withdraw(...);
*)
function OpenBank(WhichBank: Integer; ChangeCompass, ChangeAngle: Boolean): Boolean;
var
I: Integer;
begin
result := false;
if BankScreen then
begin
Result := True;
Exit;
end;
Case WhichBank Of
SRL_BANK_SW, SRL_BANK_CW, SRL_BANK_GG, SRL_BANK_B:
if (OpenBankChest(WhichBank)) then
begin
Result := true;
Exit;
end;
end;
for I := 0 to 3 do
begin
case I of
0: Result := OpenBankFast(WhichBank);
1: Result := OpenBankGlass(WhichBank, ChangeCompass, ChangeAngle);
2: Result := OpenBankQuiet(WhichBank);
3: Result := OpenBankNPC;
end;
if Result then
Exit;
end;
end;
(*
FindBank
~~~~~~~~
.. code-block:: pascal
function FindBank(TheBank: Integer): Boolean;
Valid arguments are:
BANK_FE (Falador East Bank)
BANK_FW (Falador West Bank)
BANK_VE (Varrock East Bank)
BANK_VW (Varrock West Bank)
BANK_DR (Draynor Bank)
BANK_AK (Al-Kharid Bank)
BANK_CT (Catherby bank)
Bank_CM (Camelot bank)
Bank_NA (North Ardougne bank)
Bank_SA (South Ardougne bank)
Bank_YN (Yanille bank)
Bank_NG (North gnome bank)
Bank_SG (South gnome bank)
Bank_FG (Fishing guild bank)
.. note::
Author: WT-Fakawi and modified by Ron
Last Modified: Unknown
Example:
.. code-block:: pascal
if FindBank(BANK_FE) then
Withdraw(...);
*)
function FindBank(TheBank: Integer): Boolean;
var
bx, by, TheDTM: Integer;
WhichAngle: Extended;
begin
result := false;
case TheBank of
BANK_FE: TheDTM := DTMFromString('78DA63AC67626088634001FFFFFD63F80FA41' +
'9416C2060AC01AA4987C83141D5FCF9C3C4C0055503028CAD44A8' +
'E924AC0600131E11B5');
BANK_FW: TheDTM := DTMFromString('78DA636C676260086540038C0CFFC12403C37' +
'F206004A98986C8304155FCF9C3C4C0055503D6D14C849A6EC26A' +
'009F5A0EA1');
BANK_DR: TheDTM := DTMFromString('78DA632C6162608866400181DEDE0CFF81342' +
'310FF0702C62CA09A4454357FFE30313043D58000584D1C116AC2' +
'F0AB0100EC370F0C');
BANK_VE: TheDTM := DTMFromString('78DA63EC61626008624001FFFFFD63F80FA41' +
'9416C2060EC00AA8982C83141D5FCF9C3C4C0055503028C138850' +
'D343580D00122211A9');
BANK_VW: TheDTM := DTMFromString('78DA63EC606260B066C000FF819811440301E' +
'354A01A3B88381354FECF1F260611A81A1000AB3125428D2E7E35' +
'0087F80E5E');
BANK_AK: TheDTM := DTMFromString('78DA636C606260F06140019D9D710CFF81342' +
'310FF0702C652A01A37881C1354CD9F3F4C0C5C5035200056E345' +
'841A3FFC6A002A3B0F97');
BANK_CT: TheDTM := DTMFromString('78DA63CC63626008624001478F1E65F80FA41' +
'981F83F1030A602D578A0AAF9F387898119AA060418F388505344' +
'849A32C26A00FE5D12EE');
Bank_CM: TheDTM := DTMFromString('78DA63CC67626008604001E78E1F67F80FA41' +
'981F83F10306601D5B8A2AAF9F387898119AA060418CB88505345' +
'849A3AC26A000B52130B');
Bank_NA: TheDTM := DTMFromString('78DA63AC61626008654001135A8B19FE03694' +
'620FE0F048C454035B1A86AFEFC61626086AA0101C66A22D47400' +
'D5C4E057030045F20FE7');
Bank_SA: TheDTM := DTMFromString('78DA632C656260086040017DCD850CFF81342' +
'310FF0702C63AA09A6454357FFE30313043D58000584D180135F5' +
'40359EF8D500003F560FC7');
Bank_YN: TheDTM := DTMFromString('78DA632C60626008654001E78E1F67F80FA41' +
'981F83F10305601D5F8A2AAF9F387898119AA0604182B31CDC1AA' +
'260ABF1A009CFB108C');
Bank_NG: TheDTM := DTMFromString('78DA632C66626008654001FFFFFF67F80FA41' +
'921ECFF8CB94035B1A86AFEFC61626086AA0101C632C26A00AD6D' +
'0E64');
Bank_SG: TheDTM := DTMFromString('78DA632C606260086640038C0CFFC12403C37' +
'F20604C05AA894255F1E70F130333540D5807484D18116AFCF0AB' +
'01006D100DF4');
Bank_FG: TheDTM := DTMFromString('78DA632C626260F0654001F5311E0CFF81342' +
'310FF0702C64CA01A1754357FFE30313043D58000588D27116A02' +
'8950138A5F0D0041A911BD');
Bank_EV : TheDTM := DTMFromString('78DA63E4666060E0614001EF2F2832FC07D28' +
'C40FC1F0818E5800C7154355FBF426846289F51124848A3AAF9F3' +
'8709558D0490504255F3EF9F20A6395AF8D500008FCC0FE1');
else
begin
srl_Warn('FindBank', 'Invalid bank name', warn_Warning);
Exit;
end;
end;
if FindDtmRotated(TheDTM, bx, by, MMX1, MMY1, MMX2, MMY2, Radians(-30), Radians(30), 0.05, WhichAngle) then
begin
Mouse(bx, by, 0, 0, mouse_left);
FFlag(0);
Wait(300+Random(400));
Result := OpenBank(TheBank, False, False);
end;
FreeDTM(TheDTM);
end;
(*
OpenDepositBox
~~~~~~~~~~~~~~
.. code-block:: pascal
function OpenDepositBox : Boolean;
Opens the deposit box.
.. note::
Author: Shuttleu
Last Modified: Unknown
Example:
.. code-block:: pascal
if OpenDepositBox then
DepositAll;
*)
function OpenDepositBox : Boolean;
var
X, Y, T:integer;
begin
result := false;
If(not(LoggedIn)) then exit;
begin
if FindObjTPA(x, y, 739167, 10, -1, 30, 30, 200, ['deposit']) then
begin
GetMousePos(X, Y);
Mouse(x, y, 0, 0, mouse_left);
Result := True;
T :=0;
repeat
Inc(T);
Wait(500+random(500));
until (DepositScreen) or (T>=30);
end else
Writeln('Could not find the deposit box');
end;
end;
(*
WithdrawFromPouch
~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function WithdrawFromPouch(Amount :Integer) :Boolean;
Withdraws amount from pouch.
.. note ::
by Home
*)
function WithdrawFromPouch(Amount :Integer) :Boolean;
var
T :Integer;
begin
Result := False;
MouseBox(528, 94, 533, 107, mouse_Right);
If WaitOption('draw', 500) then
begin
T := GetSystemTime + 10000;
repeat
wait(50);
InPin(Players[CurrentPlayer].Pin);
until (T <= GetSystemTime) or (InRange(CountColor(0, 250, 396, 307, 410), 160, 175));
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;