Okay, Rasta. I've tried my best on it. It's pretty basic at this moment, but I hope with feedback I can beef it up; thought I would get back to you today - so i'm not slacking :p:
Function MSI_Withdraw(Items : TItemArray; Amount : TIntegerArray) : Boolean;
Var TPA : Array Of TPointArray; //The length is the same as items.colors
ATPA : T2DPointArray;
I, BX, BY, II, DX, DY, XX, YY, Tol : Integer;
BitmapCheck, TextCheck, DTMCheck : Boolean;
WithdrawP : TPoint;
TB : TBox;
Begin
If Not WaitFunc(@BankScreen, 70, 1300) Then //Just in case
Exit
Else
For I := 0 To High(Items) Do
Begin
Repeat
BitmapCheck := FindBitmapToleranceIn(Items[I].BMP, BX, BY, MBX1, MBY1, MBX2, MBY2, Tol);
Inc(Tol);
Until(BitmapCheck) xOr (Tol > 40);
If Not BitmapCheck Then
Begin
SetArrayLength(TPA, High(Items[I].Colors)+1)
For II := 0 To High(Items[I].Colors) Do
FindColors(TPA[II], Items[I].Colors[II], MBX1, MBY1, MBX2, MBY2);
TPA[0] := MergeATPA(TPA);
ATPA := SplitTPA(TPA[0], 5);
DebugATPA(ATPA, '');
For II := 0 To High(ATPA) Do
Begin
TB := IntToBox(ATPA[II][0].x - 50, ATPA[II][0].y - 50,
ATPA[II][0].x + 50, ATPA[II][0].y + 50);
DTMCheck := DTMRotated(Items[I].DTM, DX, DY, TB.x1, TB.y1, TB.x2, TB.y2);
MMouse(DX, DY, 2, 3);
TextCheck := WaitUpTextMulti(Items[I].UpText, 150+Random(30));
If TextCheck Then Break;
End;
End;
If BitmapCheck Or TextCheck Then
Begin
If BX + BY > 0 Then
MMouse(BX, BY, 2, 3);
TextCheck := WaitUpTextMulti(Items[I].UpText, 1200);
GetMousePos(XX, YY);
Result := TextCheck;
If Result Then
Begin
Items[I].ItemP := Point(XX, YY);
WithDrawP := MSTPointToBankPoint(Point(XX, YY));
Withdraw(WithDrawP.X, WithDrawP.Y, Amount[I]);
{ MSIDebug('MSI_Withdraw', 'Withdrew Amount '+IntToStr(Amount[I])+
' Of Item : ''' +Items[I].Name+'''', Debug_SmallDetails); }
End;
End;
End;
End;
I'll make Deposit tomorrow, I kinda will use the base of this for deposit. It shouldn't be hard :).