Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program new;
- {$DEFINE SMART}
- {$DEFINE WALKER}
- {$i AeroLib/AeroLib.Simba}
- var
- RSW: TRSWalker;
- path: TPointArray;
- failAttack, first, x, y: integer;
- T2: timer;
- DTM_Lobster: integer;
- Startingtime: Timer;
- breaklooptimer:integer;
- const
- NPCcol = 7055294;
- NPCtol = 19;
- NPCHue = 0.02;
- NPCSat = 0.61;
- cBREAK_IN = 100; // How long before we take a break? (minutes)
- cBREAK_FOR = 60; // How long will we break for? (minutes)
- cR_BREAK_IN = 45; // Random minutes to add/subtract from how long until we break
- cR_BREAK_FOR = 12; // Random minutes to add/subjtract from break duraction
- procedure declarePlayer();
- begin
- Me.Name := '';
- Me.Pass := '';
- Me.Active := True;
- me.Member := True;
- end;
- procedure customMouse(point: TPoint);
- begin
- case random(0, 3) of
- 0..2: BrakeMMouse(point, random(5), random(5), true);
- 3: BrakeMMouse(point, random(5), random(5), false);
- end;
- end;
- procedure heal();
- var
- I: Integer;
- begin
- gameTab(TAB_INV);
- if (findDTM(DTM_Lobster, x, y, MIX1, MIY1, MIX2, MIY2)) then
- begin
- customMouse(Point(x, y));
- sleep(random(20, 100));
- case random(0, 8) of
- 0..7: fastClick(MOUSE_LEFT);
- 8:
- begin
- fastClick(MOUSE_RIGHT);
- waitOptionMulti(['Eat', 'Drink'], 300);
- end;
- end;
- sleep(random(3500, 4800));
- end else
- if (I = high(DTM_Lobster)) then
- begin
- takescreen('out of food','nofood');
- LogoutPlayer;
- end;
- end;
- procedure drinkpotion;
- begin
- if (findcolor(x,y,6599036,MIX1, MIY1, MIX2, MIY2)) then
- begin
- customMouse(Point(x, y));
- sleep(random(20, 100));
- case random(0, 8) of
- 0..7: fastClick(MOUSE_LEFT);
- 8:
- begin
- fastClick(MOUSE_RIGHT);
- waitOptionMulti(['Eat', 'Drink'], 300);
- end;
- end;
- end;
- sleep(random(3500, 4800));
- end;
- procedure setCompassMM(newAngle, rand: Integer; highAngle: Boolean);
- var
- currentAngle, dist: Extended;
- right: Boolean;
- TPABox: TPointArray;
- mousePoint, endPoint: TPoint;
- x1, y1: Integer;
- begin
- newAngle := random(newAngle - rand, newAngle + rand);
- currentAngle := getCompassAngle();
- dist := __setCompass_MinCheck(currentAngle, Int(newAngle));
- right := (Round((360 - currentAngle) + newAngle) mod 360 <= Round((currentAngle + 360) - newAngle) mod 360);
- if (dist <= 15) then
- exit;
- if (right) then
- TPABox := TPAFromBox(intToBox(16, 103, 276, 445))
- else
- TPABox := TPAFromBox(intToBox(364, 116, 680, 430));
- if (highAngle) then
- mousePoint := TPABox[random(0, 30000)]
- else
- mousePoint := TPABox[random(0, high(TPABox))];
- if(mousePoint.x < 1) or (mousePoint.y < 1) then
- exit;
- customMouse(mousePoint);
- getMousePos(x1, y1);
- if (right) and (highAngle) then
- endPoint := Point(Round(x1 + (dist * 3.00)), y1 + random(80, 150))
- else
- if (right) then
- endPoint := Point(Round(x1 + (dist * 3.00)), y1 - random(80, 150));
- if (not right) and (highAngle) then
- endPoint := Point(Round(x1 - (dist * 3.00)), y1 + random(80, 150))
- else
- if (not right) then
- endPoint := Point(Round(x1 - (dist * 3.00)), y1 - random(80, 150));
- HoldMouse(x1, y1, MOUSE_MIDDLE);
- customMouse(endPoint);
- sleep(random(1, 30));
- getMousePos(x1, y1);
- ReleaseMouse(x1, y1, MOUSE_MIDDLE);
- end;
- procedure setupPlayer();
- begin
- if (not isLoggedIn()) then
- loginPlayer(false);
- if (isLoggedIn()) then
- begin
- toggleRunning(true);
- setAngle(ANGLE_HIGH);
- setRetaliate(True);
- end;
- end;
- function getNPCHealth(): Integer;
- var
- gCol : TColEx;
- ATPA: T2DPointArray;
- TPA: TPointArray;
- hpBox: TBox;
- begin
- hpBox := toBox(6, 37, 129, 50);
- gCol.create(1937194, 19, 0.31, 2.13);
- if (not gCol.findAllIn(hpBox, TPA)) then
- Exit(0);
- result := round(length(TPA) / 15);
- if (result > 100) then
- result := 100;
- if (result <= 0) then
- result := 1;
- end;
- function inCombat(timeOut: Integer): boolean;
- var
- angle, I,z: Integer;
- t: Timer;
- middlePoint: TPoint;
- TPA: TPointArray;
- begin
- Result := false;
- if (0=0) then
- begin
- angle := round(getCompassAngle);
- case angle of
- 0..45: middlePoint := Point(265, 167);
- 46..95: middlePoint := Point(269, 160);
- 96..160: middlePoint := Point(265, 156);
- 161..200: middlePoint := Point(254, 162);
- 201..230: middlePoint := Point(254, 167);
- 231..285: middlePoint := Point(251, 175);
- 286..320: middlePoint := Point(259, 170);
- 321..360: middlePoint := Point(259, 176);
- end;
- t.start();
- repeat
- if (t.timeElapsed() >= timeOut) then
- break;
- TPA := TPAFromCircle(middlePoint.X, middlePoint.Y, 20);
- FillEllipse(TPA);
- if(high(TPA) = 0) then
- exit;
- for I := 0 to high(TPA) do
- if (getColor(TPA[I].X, TPA[I].Y) = 16728128) or (getColor(TPA[I].X, TPA[I].Y) = 192) then
- result := true;
- until (Result);
- end else
- result := getNPCHealth() > 0;
- end;
- procedure Cantreach;
- begin
- if(GetChatBoxText(8,clBlack) = 'Icanct reach that!') then
- begin
- if (findColorSpiral(x, y, 255, MSX1,MSY1,MSX2,MSY2)) then
- exit;
- setCompassMM(random(5, 355), 5, true);
- end;
- end;
- function findNPC(): TPoint;
- var
- tCol : TColEx;
- TPA: TPointArray;
- ATPA: T2DPointArray;
- I: Integer;
- box: TBox;
- BMP: string;
- begin
- tCol.create(NPCcol, NPCTol, NPCHue, NPCSat);
- if (not tCol.findAllIn(AREA_MS, TPA)) then
- exit;
- ATPA := FloodFillTPA(TPA);
- //ATPA := TPAtoATPA(TPA,10);
- SortATPAFrommidpoint(ATPA,TPoint([394,309]));
- // debugATPA(ATPA,BMP);
- if (length(ATPA) <= 0) then
- exit;
- for I := 0 to high(ATPA) do
- begin
- if (length(ATPA[I]) >= 10) then
- begin
- box := toBox(ATPA[I].getBounds().X1 - 10, 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;
- if (not findColorSpiral(x, y, 255, box.X1, box.Y1, box.X2, box.Y2)) and (not findColorSpiral(x, y, 65280, box.X1, box.Y1, box.X2, box.Y2)) then
- exit(MiddleTPA(ATPA[I]));
- end;
- end;
- result := Point(-1, -1);
- end;
- function hoverNearestNPC(): Boolean;
- var
- I: Integer;
- TP: TPoint;
- begin
- TP := findNPC();
- if (TP.X = -1) then
- exit;
- if (pointInBox(TP, intToBox(MSX1, MSY1, MSX2, MSY2))) then
- begin
- customMouse(TP);
- exit(true);
- end;
- end;
- function waitFight(WaitPerLoop, MaxTime: Integer): Boolean;
- var
- T: Timer;
- begin
- T.start();
- while (T.timeElapsed < MaxTime) do
- begin
- if (inCombat(1)) then
- Exit(True);
- Wait(WaitPerLoop);
- end;
- end;
- procedure resetaggro;
- var
- myPath:TPointArray;
- begin
- RSW.Init('Sandcrabs.png');
- RSW.walkStyle:= wsSPS;
- RSW.anyAngle:= True;
- myPath:= ([Point(357,178),Point(356,178),Point(353,178),Point(232,112),Point(323,32),Point(323,44),Point(323,50),Point(323,44),Point(323,32),Point(232,112),Point(353,178),Point(356,178),Point(357,178)]);
- //writeln(RSW.GetMyPos());
- RSW.blindWalk(Point(321,163));
- wait(random(1000)+500);
- RSW.blindWalk(Point(283,160));
- wait(random(1000)+500);
- RSW.blindWalk(Point(240,179));
- RSW.Free();
- end;
- procedure checkreset;
- begin
- if (inCombat(10)) then
- begin
- writeln('crabs still aggro...');
- t2.start();
- end;
- if(t2.timeElapsed > 20000) then
- begin
- writeln('crabs dont aggro anymore, resetting');
- resetaggro;
- t2.start();
- end;
- end;
- procedure attackNPC();
- var
- I: Integer;
- t: Timer;
- begin
- if (hoverNearestNPC()) then
- begin
- wait(random(10,20));
- case random(0, 14) of
- 0..14:
- begin
- wait(10+random(20));
- if(isUptextMulti(['1'])) then
- begin
- fastClick(MOUSE_LEFT);
- end else
- exit;
- end;
- // 8..14:
- // begin
- // fastClick(MOUSE_RIGHT);
- // sleep(random(30, 120));
- // waitOption('Attack', 350);
- // end;
- end;
- if (didYellowClick()) then
- begin
- while (isLoggedIn() and isPlayerWalking()) do
- sleep(random(2500, 3000));
- // attackNPC();
- end;
- sleep(1000 + random(500));
- while (isLoggedIn() and isPlayerWalking()) do
- sleep(random(240, 300));
- waitFight(500 + random(50), random(2500, 3300));
- checkreset;
- first := 0;
- end;
- if (first = 0) then
- begin
- failAttack := getTimeRunning() + 60000;
- inc(first);
- Exit;
- end;
- if (failAttack < getTimeRunning()) then
- resetaggro;
- end;
- function getState(): Integer;
- begin
- if (not isLoggedIn) then
- exit(3);
- if (not inCombat(1900 + 100)) then
- begin
- setCompassMM(random(5, 355), 5, true);
- exit(0);
- end;
- if (getHealthPercent <= 70) then
- exit(1);
- exit(2);
- end;
- procedure checkXp();
- begin
- end;
- procedure antiban();
- var
- TP: TPoint;
- rand, I: Integer;
- ABChance: integer;
- begin
- if ((not isUsingRun()) and (getRunEnergy() > 30)) then
- begin
- toggleRunning(true);
- end;
- for I := 0 to 0 do
- begin
- TP := findNPC();
- if (TP.X = -1) then
- break;
- getMousePos(x, y);
- if (distance(TP.X, TP.Y, x, y) < 10) or (distance(TP.X, TP.Y, x, y) > 250) then
- break;
- // hoverNearestNPC();
- end;
- ABChance := round((random(100,300) * 5) + 13 + 37);
- rand := random(0, ABChance);
- if (rand = 1) then
- begin
- case random(0, 120) of
- 0..20: compassMovement(20, 120, false);
- 21..35: PickUpMouse();
- 36..50: pickUpMouse();
- 51..63: CheckXP();
- 64..80: MMouseOffClient('random');
- 80..90: checkMovingObjs(false);
- 91..99: checkXp();
- 100..119: setCompassMM(random(5, 355), 5, true);
- end;
- end;
- end;
- procedure executeState(State: Integer);
- begin
- case (State) of
- 0: attackNPC();
- 1: heal();
- 2: antiban();
- 3: loginPlayer(false);
- end;
- sleep(random(100, 150));
- clickToContinue();
- Cantreach;
- end;
- procedure logoutHandler(Reason: String);
- begin
- writeln('logging out, reason: ' + reason);
- waitFight(1000, 30000);
- logoutPlayer;
- terminateScript;
- end;
- procedure FreeGlobals;
- begin
- FreeDTM(DTM_Lobster);
- RSW.Free();
- end;
- procedure potionloop;
- begin
- if(startingtime.timeElapsed >= 300000) then
- begin
- drinkpotion;
- startingtime.start;
- end;
- end;
- procedure breakloop;
- begin
- if(startingtime.timeElapsed >= 300000) then
- begin
- drinkpotion;
- startingtime.start;
- end;
- end;
- begin
- setSupressExceptions(true);
- declarePlayer();
- initAL();
- AddOnTerminate('FreeGlobals');
- DTM_Lobster := DTMFromString('m6wAAAHic42ZgYHBhYmDwgmJPIHYEYhsgNodiOyB2BWIfIA5gZGCIAeIoIPYD4lAoDoPyfYDYC4idgHhHshjQdEaisAaQJBYTZyIEIwEA/ycJgA==');
- mouseSpeed := Random(20, 30);
- setupPlayer();
- setupBreak(cBREAK_IN, cBREAK_FOR, cR_BREAK_IN, cR_BREAK_FOR);
- startingtime.start;
- t2.start;
- repeat
- executeState(getState());
- potionloop;
- until (false);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement