Simba Code:
program P1nkyDaviRanger_AL21_SIMBA1200;
{$H-}
{$DEFINE SMART}
{$DEFINE WALKER}
{$I AeroLib/AeroLib.simba }
const
ba := BitmapFromString(9, 9, 'meJyTNXaWNXZmZGDgNA5jEFcDMuBI' +
'SscCwgBKQRjy5u7iGsZwBXAtKrb+sgZ2gvIaQLaCggFci0Fgpo5nv' +
'CzMCmQtQCkgG2gFEEEUw21BdgmQjcZFVoNLC5DEpQXIAADr/BYQ');
at := BitmapFromString(11, 8, 'meJzLmtOUNadp8rqduFAWWAEcYSp' +
'IqF4JR1gV45KFI/yyRCrAI0sMAgAzII4j');
var
Limit, lor, minAnti, maxAnti, AntiAmount, xp, xpPerHour, tickets, x,y : Integer;
RSW : TRSWalker;
started, handleRandoms : Boolean;
target : TPoint;
DsgnForm:TForm;
UsernameBox,PasswordBox, NickBox, PinBox,AntibanBox,AmountBox,delayminBox,delaymaxBox: TEdit;
UsernameLabel, PasswordLabel, NickLabel, PinLabel, AntibanLabel, AmountLabel, delayLabel, typeLabel, seconds, seperator: TLabel;
randomsBox : TCheckBox;
PlayButton : TButton;
lastTime : Extended;
ticks, arrows: TItem;
tim, tim1: Timer;
procedure Draw(text: string);
begin
xpPerHour := round(xp * 3600 / (GetTimeRunning / 1000));
OS_Smart.__Graphics.Clear;
OS_Smart.__Graphics.DrawClippedText('Made by: Davi', 'SmallChars', point(12, 278), clWhite);
OS_Smart.__Graphics.DrawClippedText('_____________', 'SmallChars', point(12, 284), clWhite);
OS_Smart.__Graphics.DrawClippedText('Status : ' + text, 'SmallChars', point(12, 304), clWhite);
OS_Smart.__Graphics.DrawClippedText('Time Running : ' + TimeRunning, 'SmallChars', point(220, 278), clYellow);
OS_Smart.__Graphics.DrawClippedText('XP : ' + inttostr(xp),'SmallChars', point(220, 292), clYellow);
OS_Smart.__Graphics.DrawClippedText('XP per hour : ' + inttostr(xpPerHour),'SmallChars', point(220, 306), clYellow);
OS_Smart.__Graphics.DrawClippedText('Tickets earned : ' + inttostr(tickets),'SmallChars', point(220, 320), clYellow);
end;
procedure OnlyPostiveNumbers(Self, Sender: TObject; var Key:Char); // Thanks ineedbot
begin
case ToString(key) of
#8, '0'..'9': {DO NOTHING};
else Key := #0;
end;
end;
procedure Start(Self, Sender: TObject);
begin
started := true;
DsgnForm.Close;
end;
procedure OnlyNumbers(Self, Sender: TObject; var Key: Char); // Thanks ineedbot
begin
case toStr(key) of
#8, '0'..'9', '-':begin
if(toStr(key) = '-')then begin
if(AmountBox.getSelStart <> 0)then begin
Key := #0;
end;
end;
end;
else begin
Key := #0;
end;
end;
end;
procedure InitForm;
var TempFont : TFont;
begin
DsgnForm.init(nil);
with DsgnForm do
begin
setCaption('Davi''s Ranger');
setBorderStyle(bsSingle);
setLeft(25);
setTop(25);
setWidth(512);
setHeight(409);
end;
UsernameBox.init(DsgnForm);
with UsernameBox do
begin
setParent(DsgnForm);
setText('');
setLeft(200);
setTop(37);
setWidth(257);
setHeight(23);
end;
UsernameLabel.init(DsgnForm);
with UsernameLabel do
begin
setParent(DsgnForm);
setCaption('Username or eMail :');
setLeft(30);
setTop(37);
setWidth(150);
setHeight(23);
end;
PasswordBox.init(DsgnForm);
with PasswordBox do
begin
setParent(DsgnForm);
setText('');
setLeft(200);
setTop(70);
setWidth(200);
setHeight(23);
setPasswordChar('*');
setMaxLength(20);
end;
PasswordLabel.init(DsgnForm);
with PasswordLabel do
begin
setParent(DsgnForm);
setCaption('Password :');
setLeft(30);
setTop(70);
setWidth(150);
setHeight(23);
end;
NickBox.init(DsgnForm);
with NickBox do
begin
setParent(DsgnForm);
setText('');
setLeft(200);
setTop(113);
setWidth(80);
setHeight(23);
end;
NickLabel.init(DsgnForm);
with NickLabel do
begin
setParent(DsgnForm);
setCaption('Nickname (random solving) :');
setLeft(30);
setTop(113);
setWidth(150);
setHeight(23);
end;
PinBox.init(DsgnForm);
with PinBox do
begin
setParent(DsgnForm);
setText('');
setLeft(200);
setTop(156);
setWidth(80);
setHeight(23);
setMaxLength(4);
setPasswordChar('*');
setONKEYPRESS(@OnlyPostiveNumbers);
end;
PinLabel.init(DsgnForm);
with PinLabel do
begin
setParent(DsgnForm);
setCaption('Pin (If you have one) :');
setLeft(30);
setTop(156);
setWidth(150);
setHeight(23);
end;
AntibanBox.init(DsgnForm);
with AntibanBox do
begin
setParent(DsgnForm);
setText('100');
setLeft(200);
setTop(199);
setWidth(80);
setHeight(23);
setONKEYPRESS(@OnlyPostiveNumbers);
setMaxLength(3);
end;
AntibanLabel.init(DsgnForm);
with AntibanLabel do
begin
setParent(DsgnForm);
setCaption('Antiban freq (Percentage) :');
setLeft(30);
setTop(199);
setWidth(150);
setHeight(23);
end;
delayminBox.init(DsgnForm);
with delayminBox do
begin
setParent(DsgnForm);
setText('2');
setLeft(200);
setTop(242);
setWidth(80);
setHeight(23);
setONKEYPRESS(@OnlyPostiveNumbers);
setMaxLength(2);
end;
delaymaxBox.init(DsgnForm);
with delaymaxBox do
begin
setParent(DsgnForm);
setText('8');
setLeft(320);
setTop(242);
setWidth(80);
setHeight(23);
setONKEYPRESS(@OnlyPostiveNumbers);
setMaxLength(2);
end;
delayLabel.init(DsgnForm);
with delayLabel do
begin
setParent(DsgnForm);
setCaption('Minimum antiban delay :');
setLeft(30);
setTop(242);
setWidth(150);
setHeight(23);
end;
seconds.init(DsgnForm);
with seconds do
begin
setParent(DsgnForm);
setLeft(410);
setTop(242);
setWidth(100);
setHeight(23);
setCaption('seconds');
end;
seperator.init(DsgnForm);
with seperator do
begin
setParent(DsgnForm);
setLeft(295);
setTop(242);
setWidth(100);
setHeight(23);
setCaption('to');
end;
AmountBox.init(DsgnForm);
with AmountBox do
begin
setParent(DsgnForm);
setText('-1');
setLeft(200);
setTop(285);
setWidth(80);
setHeight(23);
setONKEYPRESS(@OnlyNumbers);
setMaxLength(6);
end;
AmountLabel.init(DsgnForm);
with AmountLabel do
begin
setParent(DsgnForm);
setCaption('Limit (-1 for no limit) :');
setLeft(30);
setTop(285);
setWidth(150);
setHeight(23);
end;
randomsBox.init(DsgnForm);
with randomsBox do
begin
setParent(DsgnForm);
setCaption('Handle randoms');
SetState(cbUnchecked);
setLeft(200);
setTop(328);
setWidth(90);
setHeight(19);
end;
PlayButton.init(DsgnForm);
with PlayButton do
begin
setParent(DsgnForm);
setCaption('Play');
setLeft(200);
setTop(371);
setWidth(75);
setHeight(25);
setOnClick(@Start);
end;
end;
procedure ShowFormModal();
begin
InitForm;
DsgnForm.showModal();
ticks.BMP := at;
ticks.Name := 'Archery ticket';
ticks.Wieldable := False;
ticks.BMP_TOL := 15;
arrows.BMP := ba;
arrows.Name := 'Bronze arrow';
arrows.Wieldable := True;
arrows.BMP_TOL := 15;
Me.Name := UsernameBox.getText;
Me.Pass := PasswordBox.getText;
Me.Nick := NickBox.getText;
Me.Pin := PinBox.getText;
Me.Member := True;
Me.Active := True;
SMART_ShowConsole := false;
SMART_UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0';
handleRandoms := (toStr(randomsBox.getState) = 'cbChecked');
if (Length(AmountBox.getText) > 0) then
begin
limit := StrToInt(AmountBox.getText)
end else
begin
limit := 9999999 // Arbitrarily large
end;
if (Length(AntiBanBox.getText) > 0) then
begin
AntiAmount := StrToInt(AntiBanBox.getText)
end else
begin
AntiAmount := 0;
end;
if (Length(delayminBox.getText) > 0) then
begin
minAnti := StrToInt(delayminBox.getText)
end else
begin
minAnti := 0;
end;
if (Length(delaymaxBox.getText) > 0) then
begin
maxAnti := StrToInt(delaymaxBox.getText)
end else
begin
maxAnti := 0;
end;
DsgnForm.Free;
end;
procedure SafeShowModal;
begin
sync(@showFormModal);
end;
function checkAnti(): Boolean;
var
perc : Integer;
begin
if (AntiAmount > 0) then
begin
perc := AntiAmount - 1;
Result:= Random(100) < perc;
end;
end;
procedure customAnti;
var
time : Extended;
begin
time := getTimeRunning - randomRange(minAnti*1000,maxAnti*1000);
if lastTime < time then
begin
if (checkAnti) then
begin
waitEx(10); // to handle randoms during Anti
draw('Performing antiban');
case random(9) of
0: randomMovement();
1: boredHuman();
2: pickUpMouse();
3: boredHuman();
4: hoverSkill('random', false);
5: SleepAndMoveMouse(3000);
6: compassMovement(40,120,False);
7: randomFKeys(True);
8: MMouseOffClient('rand');
end;
end;
lastTime := getTimeRunning;
end;
end;
procedure customMouse(point: TPoint);
// This methodology was inspired by rj's antiban guide
begin
case random(200) of
0..160: HumanMMouse(point, random(5), random(5));
161..190: HumanMMouse(point, random(7), random(7));
191..200: HumanMMouse(point, random(10), random(10));
end;
end;
Procedure RandomWait;
Begin
Draw('Waiting');
case random(1000) of
0..700: wait(RandomRange(400, 1000));
701..900: wait(RandomRange(600, 1600));
901..1000: wait(RandomRange(800, 3800));
End;
End;
function findNearestTarget(): Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I: Integer;
box: TBox;
begin
if not FindColorsSpiralTolerance(x, y, TPA, 5888743, MSX1, MSY1, MSX2, MSY2, 10) then
exit;
ATPA := SplitTPA(TPA, 5);
SortATPAFromFirstpoint(ATPA, Point(0, 0));
if (length(ATPA) <= 0) then
begin
result := False;
exit;
end;
//os_smart.__Graphics.DrawATPA(ATPA);
for I := 0 to high(ATPA) do
begin
if (length(ATPA[I]) >= 10) then
begin
//os_smart.__Graphics.DrawTPA(ATPA[I], 255); also for debugging purposes
box := intToBox(ATPA[I].getBounds().X1, ATPA[I].getBounds().Y1 - 25, ATPA[I].getBounds().X2, ATPA[I].getBounds().Y2);
if (box.x1 < 0) then
box.x1 := 0;
if (box.y1 < 0) then
box.y1 := 0;
target := MiddleTPA(ATPA[I]);
result := True;
exit;
end;
end;
result := False;
end;
procedure startCompetition;
var
found, repos : boolean;
begin
case random(2) of
0: lor := vk_right;
1: lor := vk_left;
end;
tim.start;
tim1.start;
repeat
if (RSW._GetPos.Y < 2767) or (RSW._GetPos.X < 2477) then
RSW.blindWalk(point(2487,2777));
if handleRandoms then
waitEx(50);
if not isLoggedIn() then
break;
if (tim.timeElapsed > 20000) then
begin
Writeln('Timed out: Could not find Judge - Terminating script');
logoutPlayer;
TerminateScript;
end;
if (tim1.timeElapsed > 5000) and (not found) then
begin
Draw('Checking under character');
customMouse(point(MSCX,MSCY));
fastClick(mouse_Right);
WaitUpText('ompetition', randomrange(300, 800));
if ChooseOptionMulti(['ompetition']) then
begin
found := True;
waitChatChange;
end;
tim1.start;
end;
draw('Looking for judge');
if(findMSObjectSimple([2180171, 1914942], ['ompetition', 'udge']) and (not found)) then
begin
fastClick(mouse_Right);
WaitUpText('ompetition', randomrange(300, 400));
if ChooseOptionMulti(['ompetition']) then
begin
found := True;
waitChatChange;
end;
end else
begin
keyDown(lor);
wait(randomRange(500,1000));
keyUp(lor);
end;
until(found = true);
DoConversation(['ure']);
arrows.Interact(mouse_Left);
end;
procedure doCompetition;
var
tim2, tim3 : Timer;
amount, namount, ticketsGained, count : integer;
shooting, found : boolean;
begin
amount := ticks.getAmount(True);
count := 0;
shooting := false;
tim.start;
tim1.start;
repeat
if (RSW._GetPos.Y < 2767) or (RSW._GetPos.X < 2477) then
RSW.blindWalk(point(2487,2777));
if handleRandoms then
waitEx(50);
if not isLoggedIn() then
break;
if tim.timeElapsed > 60000 then
begin
Writeln('Timed out: Could not complete shooting - Terminating script');
logoutPlayer;
TerminateScript;
end;
if (shooting = false) then //find target
begin
if (tim1.timeElapsed > 30000) and (not found) then
begin
Writeln('Timed out: Could not find targets - Terminating script');
logoutPlayer;
TerminateScript;
end;
setAngle(ANGLE_LOW);
draw('Looking for targets');
if (findNearestTarget = False) then
begin
keyDown(vk_left);
wait(randomRange(500,1000));
keyUp(vk_left);
end else
begin
found := true;
if (target.X < 475) or (target.X > 495) then
begin
draw('Lining up target');
if (target.X < 475) then
begin
keyDown(vk_right);
repeat
findNearestTarget;
until(target.X > 465); // comp for slide
keyUp(vk_right);
end;
if (target.X > 495) then
begin
keyDown(vk_left);
repeat
findNearestTarget;
until(target.X < 505); // comp for slide
keyUp(vk_left);
end;
end else
begin
customMouse(target);
if(isUptextMulti(['ire-at','Fire','arget'])) then
begin
draw('Target Acquired');
found := false;
shooting := True;
end;
end;
end;
end;
if (shooting = true) then //shoot target
begin
draw('Firing at target');
if (isUptextMulti(['ire-at','Fire','arget'])) then
begin
fastClick(mouse_Left);
end else
begin
if (not Interfaces[TARGETSCREEN].isVisible()) then
begin
shooting := false;
tim1.start;
continue;
end;
end;
tim2.start;
repeat
if tim2.timeElapsed > 10000 then
begin
Writeln('Misclicked - Trying to find targets');
shooting := false;
tim1.start;
break;
end;
wait(randomRange(200,500));
until(Interfaces[TARGETSCREEN].isVisible() or clickContinueEx(False));
count := count + 1;
if Interfaces[TARGETSCREEN].isVisible() and (not clickContinueEx(False)) then
begin
if(isUptextMulti(['lose'])) then
begin
fastClick(mouse_Left);
end;
tim3.start;
repeat
draw('Closing interface');
if (tim3.timeElapsed() > 1500) then
begin
customMouse(point(485,40));
if(isUptextMulti(['lose'])) then
begin
fastClick(mouse_Left);
end;
end;
until(not Interfaces[TARGETSCREEN].isVisible());
if random(2) then
begin
getMousePos(x,y);
customMouse(point(x, y));
end;
end;
end;
namount := ticks.getAmount(True);
if count > 10 then
break;
until(namount > amount);
tim.start;
repeat
if tim.timeElapsed > 1000 then
begin
Writeln('Couldn''t grab xp values - will under report');
break;
end;
namount := ticks.getAmount(True);
until(namount > amount);
ticketsGained := namount - amount;
xp := xp + ticketsGained * 5;
tickets := tickets + ticketsGained;
clickContinue(true);
end;
procedure FreeStuff;
begin
Writeln('Thanks for using Davi''s Ranger. Ran for: '+TimeRunning);
freeBitmap(at);
freeBitmap(ba);
RSW.Free;
end;
begin
AddOnTerminate('FreeStuff');
SafeShowModal;
if (Started) then
begin
initAL();
RSW.Init('WorldMap', OS_SMART.ID);
RSW.walkStyle := wsSPS;
RSW.anyAngle := True;
RSW.skipClose := 5;
OS_Smart.__Graphics.Clear;
repeat
if not isLoggedIn() then
begin
LogInPlayer(false);
end;
startCompetition;
customAnti;
doCompetition;
if handleRandoms then
randomsReport;
until (xp = limit);
LogoutPlayer;
end;
end.