Simba Code:
{*******************************************************************************
procedure AccurateMMouse(eX, eY, ranX, ranY: Integer);
By: Flight
Description: Same as MMouse but uses a much straighter path; required
for choosing tabbed options.
*******************************************************************************}
Procedure AccurateMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,MS: integer;
begin
MS := MouseSpeed;
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
GetMousePos(X, Y);
WindMouse(X, Y, RandomRange(eX-ranX, eX+ranX), RandomRange(eY-ranY,eY+ranY), 14, 3, 10.0/randSpeed, 15.0/randSpeed, 10.0*randSpeed, 10.0*randSpeed);
MouseSpeed := MS;
end;
Simba Code:
{*******************************************************************************
Function GetTabbedOptions(BigBox: TBox; TextType: string): Array of TOptions;
By: Flight
Description: Grabs all the options of the right-click tab menu, if visible.
*******************************************************************************}
Function GetTabbedOptions(BigBox: TBox; TextType: string): Array of TOptions;
var
B, BB, sB, TabBox: TBox;
FilteredTPA, TPA, TPA1, TPA2: TPointArray;
ATPA, tempatpa: T2DPointArray;
I, L, target, bmp,w,h, cts: Integer;
BoxColors: TIntegerArray;
begin
target := GetImageTarget;
GetClientDimensions(B.X2, B.Y2);
B := IntToBox(0, 0, B.X2-1, B.Y2-1);
//Start tab box
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
BoxColors := [131843, 3682593, 3552822];
SetLength(ATPA, Length(BoxColors));
for i := 0 to High(BoxColors) do
FindColorsTolerance(ATPA[i], BoxColors[i], B.X1, B.Y1, B.X2, B.Y2, 0);
TPA := MergeATPA(ATPA);
//Remove the initial bigbox
ClearTPAFromTPAWrap(TPA,TPAFromBox(BigBox),FilteredTPA);
If Length(FilteredTPA) < 100 Then
begin
ColorToleranceSpeed(cts);
Exit;
end;
ATPA := SplitTPA(FilteredTPA, 4);
For i := 0 to High(ATPA) do
begin
B := GetTPABounds(ATPA[i]);
if ((B.x2-B.x1) > 90) and ((B.y2-B.y1) > 18) then
Break
else
B := IntToBox(0, 0, 0, 0);
end;
If (B.x2 = 0) then
begin
ColorToleranceSpeed(cts);
Exit;
end;
TabBox := B;
SetColorToleranceSpeed(3);
FindColorsTolerance(TPA1, 4996381, B.X1, B.Y1, B.X2, B.Y2, 18);
sB := GetTPABounds(TPA1);
ReturnPointsNotInTPAWrap(TPA1, sB, TPA);
FindColorsTolerance(TPA2, 460291, B.X1, B.Y1, B.X2, B.Y2, 6);
SetColorToleranceSpeed(cts);
bmp := CreateBitmap(B.X2-B.X1+2, B.Y2-B.Y1+2);
OffsetTPA(TPA, Point(-B.X1, -B.Y1));
OffsetTPA(TPA2, Point(-B.X1, -B.Y1));
FastDrawClear(bmp, 0);
DrawTPABitmap(bmp, TPA, clRed);
DrawTPABitmap(bmp, TPA2, clPurple);
ocr_FilterUpTextByCharacteristics(GetMufasaBitmap(bmp));
GetbitmapSize(bmp,w,h);
SetTargetBitmap(bmp);
SetLength(ATPA, H div 16);
for i := 0 to High(ATPA) do
FindColorsTolerance(ATPA[i], clRed, 0, 2+i*16, W-1, 18+i*16, 0);
L := High(ATPA);
SortATPAFromFirstPointY(ATPA, Point(w div 2,0));
SetArrayLength(Result, Length(ATPA));
Result[0].BigBox := TabBox;
for i := 0 to high(ATPA) do
begin
TPA := ATPA[i];
tempatpa := SplitTPAEx(TPA, 1, 10);
SortATPAFromFirstPointX(tempatpa, Point(0, 0));
Result[i].Str := GetTextATPA(tempatpa, 5, 'UpCharsEx');
BB := GetTPABounds(ATPA[i]);
Result[i].Bounds := IntToBox(BB.X1+B.X1, BB.Y1+B.Y1, BB.X2+B.X1, BB.Y2+B.Y1);
setlength(tempatpa,0);
setlength(TPA,0);
end;
ColorToleranceSpeed(cts);
SetImageTarget(target);
FreeBitmap(bmp);
end;
Simba Code:
function ChooseTabbedOptionMulti(OptionsA, OptionsB: TStringArray): Boolean;
var
T: TPoint;
B,BigBox,TabBox: TBox;
i, H, ii, L, x: Integer;
Options,TOptions: array of TOptions;
begin
Result := False;
Options := GetChooseOptions('All');
if (Length(Options) < 1) then
Exit;
BigBox := Options[0].BigBox;
//Initially check TextsB
if OptionsExist(OptionsB, False) then
begin
Result := ChooseOptionMulti(OptionsB);
Exit;
end;
//Mouse first set of text options
H := High(Options);
L := High(OptionsA);
for i := 0 To L do
begin
for ii := 0 to H do
If Pos(OptionsA[i], Options[ii].Str) > 0 Then
begin
Result := True;
B := Options[ii].Bounds;
GetMousePos(T.x, T.y);
if (not PointInBox(T, B)) then
MouseBoxEx(B.x1 + 5, B.Y1, B.x2 - 5, B.Y1 + 5,5, mouse_move);
end;
end;
//Secondary options
TOptions := GetTabbedOptions(BigBox,'All');
if (Length(TOptions) < 1) then
Exit;
L := High(OptionsB);
H := High(TOptions);
for i := 0 To L do
begin
for ii := 0 to H do
If Pos(OptionsB[i], TOptions[ii].Str) > 0 Then
begin
Result := True;
TabBox := TOptions[0].BigBox;
GetMousePos(T.x, T.y);
AccurateMMouse(RandomRange(TabBox.X1, TabBox.X2), T.Y, 0, 3);
Wait(200 + Random(100));
B := TOptions[ii].Bounds;
GetMousePos(T.x, T.y);
if PointInBox(T, B) then
ClickMouse2(Mouse_left)
else
MouseBoxEx(B.x1 + 5, B.Y1, B.x2 - 5, B.Y1 + 5,5,mouse_left);
Exit;
end;
end;
B := TOptions[0].BigBox;
x := Max(B.X1 - 52, 0);
if x = 0 then
x := B.X2+10;
MMouse(x, Max(B.Y1 - 50, 0), 40, B.Y2-B.Y1);
Wait(200 + Random(100));
end;