Tootoot222
2009-01-18 16:07:15
This uses the deposit box that is in all banks, is usefull for if you have a wcer that you don't need to withdraw anything for, just dump it in the deposit box. (this contains no ways to open the deposit box, just to store)
{*******************************************************************************
function GetItemCount(B: TBox): Integer;
By: Tootoot222
Description: Returns the amount of stacked items in B.
Returns 0 if nothing is there, 1 if non-stackable.
*******************************************************************************}
function GetItemCount(B: TBox): Integer;
var
X, Y, Z, T: Integer;
begin
Result:= 0;
if(FindColor(X, Y, 65536, B.X1, B.Y1, B.X2, B.Y2)) then
begin
Result:= 1;
try
if(FindColor(X, Y, 65535, B.X1, B.Y1, B.X2, B.Y2)) then
if(FindColorSpiral(Z, T, 65535, B.X1, B.Y1, B.X2, B.Y2)) then
Result:= StrToInt(TrimLetters(Replace(Replace(Lowercase(Trim(TrimOthers(GetTextAtEx(Z, Y - 1, 6, StatChars, False, False, 0, 3, 65535, 5, False, tr_AllChars)))), 'k', '000'), 'm', '000000')));
except
end;
end;
end;
{*******************************************************************************
function GetDepositBoxBounds(Slot: Integer): TBox;
By: Tootoot222
Description: Returns a TBox of the deposit box Slot.
Use: GetDepositBoxBounds(28);
*******************************************************************************}
function GetDepositBoxBounds(Slot: Integer): TBox;
var
X, Y: Integer;
begin
Slot:= Slot - 1;
X:= 106 + (48 * (Slot mod 7));
Y:= 70 + (50 * Floor(Slot div 7));
Result:= IntToBox(X, Y, X + 35, Y + 31);
end;
{*******************************************************************************
function DepositBoxRCToSlot(Row, Col: Integer): Integer;
By: Tootoot222
Description: Returns the slot of Row and Col.
Use: DepositBoxRCToSlot(3, 6); will return 28 (Row and Col start at 0)
*******************************************************************************}
function DepositBoxRCToSlot(Row, Col: Integer): Integer;
begin
Result:= (Row * 7) + Col + 1;
end;
{*******************************************************************************
procedure DepositBox(Skip: array of Integer);
By: Tootoot222
Description: Deposits all items except those in Skip (Uses the deposit box)
Use: DepositBox([1]); will deposit all except the first item
*******************************************************************************}
procedure DepositBox(Skip: array of Integer);
var
I, II, III, IV, A, T, TT, SkipL: Integer;
BlackTPA, ItemTPA, ResultTPA, SkipTPA: TPointArray;
NotAll: Boolean;
B: TBox;
begin
T:= GetSystemTime;
while(not(FindTextTPA(2070783, 20, 145, 35, 390, 50, 'posit Box', UpChars, Nothing))) do
begin
Wait(100);
if(TimeFromMark(T) > 2000) then
Exit;
end;
SkipL:= 0;
for I:= 0 to 3 do
for II:= 0 to 6 do
if(InIntArray(Skip, DepositBoxRCToSlot(I, II))) then
begin
B:= GetDepositBoxBounds(DepositBoxRCToSlot(I, II));
FindColorsTolerance(SkipTPA, 65536, B.X1, B.Y1, B.X2, B.Y2, 0);
SkipL:= SkipL + Length(SkipTPA);
end;
T:= GetSystemTime;
repeat
for I:= 0 to 3 do
for II:= 0 to 6 do
begin
FindColorsTolerance(BlackTPA, 65536, 106, 70, 429, 251, 0);
Writeln(IntToStr(High(BlackTPA)) + ' - ' + IntToStr(SkipL) + ' = ' + IntToStr((High(BlackTPA) - SkipL)));
if((High(BlackTPA) - SkipL) < 1) then
Exit;
if(InIntArray(Skip, DepositBoxRCToSlot(I, II))) then
Continue;
B:= GetDepositBoxBounds(DepositBoxRCToSlot(I, II));
A:= GetItemCount(B);
case A of
0: Continue;
1:
begin
FindColorsTolerance(ItemTPA, 65536, B.X1, B.Y1, B.X2, B.Y2, 0);
FindTPAinTPA(ItemTPA, BlackTPA, ResultTPA);
if(High(ResultTPA) > 0) then
begin
NotAll:= False;
for III:= 0 to High(Skip) do
for IV:= 0 to High(ResultTPA) do
if(PointInBox(ResultTPA[IV], GetDepositBoxBounds(Skip[III]))) then
NotAll:= True;
if(not(NotAll)) then
begin
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 2);
Wait(300 + Random(500));
ChooseOptionMulti(['All']);
end else
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
end else
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
end;
else
begin
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 2);
Wait(300 + Random(500));
ChooseOptionMulti([IntToStr(A), 'All']);
end;
end;
TT:= GetSystemTime;
while(CountColor(65536, B.X1, B.Y1, B.X2, B.Y2) > 0) do
begin
Wait(100);
if(TimeFromMark(TT) > 2000) then
Break;
end;
Wait(300 + Random(700));
end;
until(TimeFromMark(T) > 70000);
end;