Daniel
2012-08-08 11:43:14
Hey guys,
I was just browsing through the include when I saw a few things which I thought were a little iffy. So, I decided to fix them up (as shown below) :)
CompassMovement: [indent]Location: /Core/AntiBan.simba
Reason: Result is redundant.
Change function -> procedure.[/indent]
DidClick: [indent]Location: /Core/Mouse.simba
Reason: Just removed some unnecessary clutter :)
InvFull: [indent]Location: /Core/Inventory.simba
Reason: Shorter lines with minimal performance impact.
DropArray: [indent]Location: /Core/Inventory.simba
Reason: There is a possible runtime error (out of range) in the current implementation. Also, removed unnecessary array randomisation (should be left up to the user/another method).
FindFlag2: [indent]Location: /Core/Flag.simba
Reason: No need to waste precious CPU cycles copying and creating bitmaps from memory, changing Simba's focus window, etc, when we have Freeze and Unfreeze :)
FindObjTPAMulti and FindObjTPA: [indent]Location: /Core/Object.simba
Reason: Perhaps replace everything in FindObjTPA with one call to FindObjTPAMulti (or rename it to Ex), for consistency?[/indent]
stats_Form: [indent]Location: /Core/GlobalStats.simba
Reason: Cut all the crap and just use InputQuery/MessageBox.
[/indent]
GetColorsBox: [indent]Location: /Core/Color.simba
Reason: Just added an 'and' to the conditional statement. Not really necessary, though.
ReturnTPAExceptColours: [indent]Location: /Core/Color.simba
Reason: Documentation error. Wrong example provided. Change 'InverseColors' to 'ReturnTPAExceptColors'.[/indent]
GetColorArrayInfo & GetBestColor & CreateAutoColorInfo & SRL_GetBlackBackground: [indent]Location: /Core/Color.simba
Reason: Move to AutoColor.simba?[/indent]
Bitmaps.simba: [indent]Do these even still work? They're all from '09. Does anybody ever use these anyway?[/indent]
ClosePinScreen: [indent]Location: /Core/Bank.simba
Reason: Kinda unsafe (?) waiting 'exactly' 500ms before every mouse action. Also improved performance by not making as many calls to PinScreen.
DepositItemBox: [indent]Location: /Core/Bank.simba
Documentation error: "surround" should be "around" or "of".[/indent]
I'll browse through more files in-depth tomorrow to see what I could find, but just skimming through this is what I could see.
Night night :)
Regards,
~ Daniel.
I was just browsing through the include when I saw a few things which I thought were a little iffy. So, I decided to fix them up (as shown below) :)
- MultiMouse [indent]Location: /Core/AntiBan.simba Reason: Easily bannable as it spam clicks (only uses wait time from Mouse), as-well as having flawed logic if 'True' was passed to the 'red' argument.
function MultiMouse(const X, Y, rX, rY: Integer; const Chance, maxClicks: Integer; const Red: Boolean): Boolean;
var
clickAmount, sleepTime, tmpInt: Integer;
currPos: TPoint;
begin
// Initialisation
Result := (not(Red));
clickAmount := 0;
sleepTime := 130;
// Check if the mouse is already at the location.
GetMousePos(currPos.X, currPos.Y);
if(not((currPos.X = X) and (currPos.Y = Y))) then
MMouse(X, Y, rX, rY);
repeat
ClickMouse2(mouse_Left);
Result := (Red and DidRedClick);
if(Red and Result) then
Exit;
if(Random(100) > Chance) then
Break;
clickAmount := clickAmount + 1;
Sleep(sleepTime + RandomRange(-3, 3));
// Gradually increase the wait time
if(Random(6) = 0) then
begin
tmpInt := (clickAmount + 10) shr 1;
sleepTime := sleepTime + RandomRange(tmpInt, tmpInt + Random(5));
end;
Until(clickAmount >= maxClicks);
end;
I ran several self tests to determine how a human actually handles spam clicking. I found that the interval between clicks gradually increases by a small amount (also, gradually increasing) every 4-8 clicks, so I decided to include it in. I also added the rX and rY arguments :)[/indent]
function DidClick(const Red: Boolean; const Time: Integer): Boolean;
var
currPos: TPoint;
srchBox: TBox;
exitTime: Cardinal;
fR, fG: Byte;
begin
Result := False;
GetMousePos(currPos.X, currPos.Y);
srchBox := IntToBox(currPos.X - 15, currPos.Y - 15, currPos.X + 15, currPos.Y + 15);
exitTime := GetTimeRunning + Time;
while(exitTime > GetTimeRunning) do
begin
fR := CountColorTolerance(395675, srchBox.x1, srchBox.y1, srchBox.x2, srchBox.y2, 15);
fG := CountColorTolerance(1695663, srchBox.x1, srchBox.y1, srchBox.x2, srchBox.y2, 15);
if(Red and not(gG > 8)) then
Result := (fR > 20) else
if(not(fR > 5)) then
Result := (fG > 35);
if(Result) then
Break;
end;
end;
[/indent]
function InvFull: Boolean;
begin
Result := InvCount = 28;
end;
[/indent]
procedure DropArray(const AInvSlots: TIntegerArray);
var
I, arrHi: Integer;
begin
arrHi := High(AInvSlots);
for I := Low(AInvSlots) to arrHi do
DropItem(AInvSlots[I]);
end;[/indent]
function FindFlag2(var X, Y: Integer): Boolean;
var
TPA: TPointArray;
arrHi, I: Integer;
begin
Result := False;
Freeze;
FindColors(TPA, $10000, MMX1, MMY1, MMX2, MMY2);
FilterPointsDist(TPA, 0, 75.5, (MMX2 - MMX1) shr 1, (MMY2 - MMY1) shr 1);
arrHi := High(TPA);
for I := 0 to arrHi do
if((GetColor(TPA[I].X - 1, TPA[I].Y - 1) and GetColor(TPA[I].X, TPA[I].Y - 1)) = 6381921) then
begin
Result := True;
X := TPA[I].X;
Y := TPA[I].Y;
Break;
end;
Unfreeze;
end;
[/indent]
function GetColorsBox(x1, y1, x2, y2: Integer; ClearSameColors: Boolean): TIntegerArray;
begin
Result := GetColors(TPAFromBox(IntToBox(x1, y1, x2, y2)));
if (ClearSameColors and (Length(Result) > 0)) then
ClearSameIntegers(Result);
end;[/indent]
function ClosePinScreen: Boolean;
var
exitTime: Cardinal;
begin
exitTime := GetTimeRunning + 10000;
while (PinScreen and (exitTime > GetTimeRunning)) do
begin
MouseBox(332, 258, 489, 281, mouse_Left);
Sleep(400 + Random(300));
end;
Result := (not(exitTime > GetTimeRunning));
end;
[/indent]
I'll browse through more files in-depth tomorrow to see what I could find, but just skimming through this is what I could see.
Night night :)
Regards,
~ Daniel.
