Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.99 KB | None | 0 0
  1. program new;
  2. {$DEFINE SMART}
  3. {$DEFINE WALKER}
  4. {$i AeroLib/AeroLib.Simba}
  5.  
  6. var
  7. RSW: TRSWalker;
  8. path: TPointArray;
  9. failAttack, first, x, y: integer;
  10. T2: timer;
  11. DTM_Lobster: integer;
  12. Startingtime: Timer;
  13. breaklooptimer:integer;
  14.  
  15. const
  16.  
  17. NPCcol = 7055294;
  18. NPCtol = 19;
  19. NPCHue = 0.02;
  20. NPCSat = 0.61;
  21.  
  22. cBREAK_IN = 100; // How long before we take a break? (minutes)
  23. cBREAK_FOR = 60; // How long will we break for? (minutes)
  24. cR_BREAK_IN = 45; // Random minutes to add/subtract from how long until we break
  25. cR_BREAK_FOR = 12; // Random minutes to add/subjtract from break duraction
  26.  
  27. procedure declarePlayer();
  28. begin
  29. Me.Name := '';
  30. Me.Pass := '';
  31. Me.Active := True;
  32. me.Member := True;
  33. end;
  34.  
  35. procedure customMouse(point: TPoint);
  36. begin
  37. case random(0, 3) of
  38. 0..2: BrakeMMouse(point, random(5), random(5), true);
  39. 3: BrakeMMouse(point, random(5), random(5), false);
  40. end;
  41. end;
  42.  
  43.  
  44. procedure heal();
  45. var
  46. I: Integer;
  47. begin
  48. gameTab(TAB_INV);
  49. if (findDTM(DTM_Lobster, x, y, MIX1, MIY1, MIX2, MIY2)) then
  50. begin
  51. customMouse(Point(x, y));
  52. sleep(random(20, 100));
  53. case random(0, 8) of
  54. 0..7: fastClick(MOUSE_LEFT);
  55. 8:
  56. begin
  57. fastClick(MOUSE_RIGHT);
  58. waitOptionMulti(['Eat', 'Drink'], 300);
  59. end;
  60. end;
  61. sleep(random(3500, 4800));
  62. end else
  63. if (I = high(DTM_Lobster)) then
  64. begin
  65. takescreen('out of food','nofood');
  66. LogoutPlayer;
  67. end;
  68.  
  69. end;
  70.  
  71. procedure drinkpotion;
  72.  
  73. begin
  74. if (findcolor(x,y,6599036,MIX1, MIY1, MIX2, MIY2)) then
  75. begin
  76. customMouse(Point(x, y));
  77. sleep(random(20, 100));
  78. case random(0, 8) of
  79. 0..7: fastClick(MOUSE_LEFT);
  80. 8:
  81. begin
  82. fastClick(MOUSE_RIGHT);
  83. waitOptionMulti(['Eat', 'Drink'], 300);
  84. end;
  85. end;
  86. end;
  87. sleep(random(3500, 4800));
  88. end;
  89.  
  90.  
  91. procedure setCompassMM(newAngle, rand: Integer; highAngle: Boolean);
  92. var
  93. currentAngle, dist: Extended;
  94. right: Boolean;
  95. TPABox: TPointArray;
  96. mousePoint, endPoint: TPoint;
  97. x1, y1: Integer;
  98. begin
  99. newAngle := random(newAngle - rand, newAngle + rand);
  100. currentAngle := getCompassAngle();
  101. dist := __setCompass_MinCheck(currentAngle, Int(newAngle));
  102. right := (Round((360 - currentAngle) + newAngle) mod 360 <= Round((currentAngle + 360) - newAngle) mod 360);
  103. if (dist <= 15) then
  104. exit;
  105. if (right) then
  106. TPABox := TPAFromBox(intToBox(16, 103, 276, 445))
  107. else
  108. TPABox := TPAFromBox(intToBox(364, 116, 680, 430));
  109.  
  110. if (highAngle) then
  111. mousePoint := TPABox[random(0, 30000)]
  112. else
  113. mousePoint := TPABox[random(0, high(TPABox))];
  114. if(mousePoint.x < 1) or (mousePoint.y < 1) then
  115. exit;
  116. customMouse(mousePoint);
  117. getMousePos(x1, y1);
  118.  
  119. if (right) and (highAngle) then
  120. endPoint := Point(Round(x1 + (dist * 3.00)), y1 + random(80, 150))
  121. else
  122. if (right) then
  123. endPoint := Point(Round(x1 + (dist * 3.00)), y1 - random(80, 150));
  124.  
  125. if (not right) and (highAngle) then
  126. endPoint := Point(Round(x1 - (dist * 3.00)), y1 + random(80, 150))
  127. else
  128. if (not right) then
  129. endPoint := Point(Round(x1 - (dist * 3.00)), y1 - random(80, 150));
  130.  
  131. HoldMouse(x1, y1, MOUSE_MIDDLE);
  132. customMouse(endPoint);
  133. sleep(random(1, 30));
  134. getMousePos(x1, y1);
  135. ReleaseMouse(x1, y1, MOUSE_MIDDLE);
  136.  
  137. end;
  138.  
  139.  
  140.  
  141. procedure setupPlayer();
  142. begin
  143. if (not isLoggedIn()) then
  144. loginPlayer(false);
  145. if (isLoggedIn()) then
  146. begin
  147. toggleRunning(true);
  148. setAngle(ANGLE_HIGH);
  149. setRetaliate(True);
  150. end;
  151. end;
  152.  
  153. function getNPCHealth(): Integer;
  154. var
  155. gCol : TColEx;
  156. ATPA: T2DPointArray;
  157. TPA: TPointArray;
  158. hpBox: TBox;
  159. begin
  160. hpBox := toBox(6, 37, 129, 50);
  161. gCol.create(1937194, 19, 0.31, 2.13);
  162. if (not gCol.findAllIn(hpBox, TPA)) then
  163. Exit(0);
  164.  
  165. result := round(length(TPA) / 15);
  166. if (result > 100) then
  167. result := 100;
  168. if (result <= 0) then
  169. result := 1;
  170. end;
  171.  
  172. function inCombat(timeOut: Integer): boolean;
  173. var
  174. angle, I,z: Integer;
  175. t: Timer;
  176. middlePoint: TPoint;
  177. TPA: TPointArray;
  178. begin
  179. Result := false;
  180. if (0=0) then
  181. begin
  182. angle := round(getCompassAngle);
  183. case angle of
  184. 0..45: middlePoint := Point(265, 167);
  185. 46..95: middlePoint := Point(269, 160);
  186. 96..160: middlePoint := Point(265, 156);
  187. 161..200: middlePoint := Point(254, 162);
  188. 201..230: middlePoint := Point(254, 167);
  189. 231..285: middlePoint := Point(251, 175);
  190. 286..320: middlePoint := Point(259, 170);
  191. 321..360: middlePoint := Point(259, 176);
  192. end;
  193. t.start();
  194. repeat
  195. if (t.timeElapsed() >= timeOut) then
  196. break;
  197. TPA := TPAFromCircle(middlePoint.X, middlePoint.Y, 20);
  198. FillEllipse(TPA);
  199. if(high(TPA) = 0) then
  200. exit;
  201. for I := 0 to high(TPA) do
  202. if (getColor(TPA[I].X, TPA[I].Y) = 16728128) or (getColor(TPA[I].X, TPA[I].Y) = 192) then
  203. result := true;
  204. until (Result);
  205. end else
  206. result := getNPCHealth() > 0;
  207. end;
  208.  
  209.  
  210. procedure Cantreach;
  211. begin
  212.  
  213. if(GetChatBoxText(8,clBlack) = 'Icanct reach that!') then
  214. begin
  215. if (findColorSpiral(x, y, 255, MSX1,MSY1,MSX2,MSY2)) then
  216. exit;
  217.  
  218. setCompassMM(random(5, 355), 5, true);
  219. end;
  220. end;
  221.  
  222.  
  223. function findNPC(): TPoint;
  224. var
  225. tCol : TColEx;
  226. TPA: TPointArray;
  227. ATPA: T2DPointArray;
  228. I: Integer;
  229. box: TBox;
  230. BMP: string;
  231. begin
  232. tCol.create(NPCcol, NPCTol, NPCHue, NPCSat);
  233. if (not tCol.findAllIn(AREA_MS, TPA)) then
  234. exit;
  235. ATPA := FloodFillTPA(TPA);
  236. //ATPA := TPAtoATPA(TPA,10);
  237. SortATPAFrommidpoint(ATPA,TPoint([394,309]));
  238.  
  239. // debugATPA(ATPA,BMP);
  240. if (length(ATPA) <= 0) then
  241. exit;
  242. for I := 0 to high(ATPA) do
  243. begin
  244. if (length(ATPA[I]) >= 10) then
  245. begin
  246. box := toBox(ATPA[I].getBounds().X1 - 10, ATPA[I].getBounds().Y1 - 25, ATPA[I].getBounds().X2, ATPA[I].getBounds().Y2);
  247. if (box.x1 < 0) then
  248. box.x1 := 0;
  249. if (box.y1 < 0) then
  250. box.y1 := 0;
  251.  
  252. 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
  253. exit(MiddleTPA(ATPA[I]));
  254.  
  255. end;
  256. end;
  257.  
  258. result := Point(-1, -1);
  259. end;
  260.  
  261. function hoverNearestNPC(): Boolean;
  262. var
  263. I: Integer;
  264. TP: TPoint;
  265. begin
  266. TP := findNPC();
  267. if (TP.X = -1) then
  268. exit;
  269. if (pointInBox(TP, intToBox(MSX1, MSY1, MSX2, MSY2))) then
  270. begin
  271. customMouse(TP);
  272. exit(true);
  273. end;
  274. end;
  275.  
  276. function waitFight(WaitPerLoop, MaxTime: Integer): Boolean;
  277. var
  278. T: Timer;
  279. begin
  280. T.start();
  281. while (T.timeElapsed < MaxTime) do
  282. begin
  283. if (inCombat(1)) then
  284. Exit(True);
  285. Wait(WaitPerLoop);
  286. end;
  287. end;
  288.  
  289.  
  290. procedure resetaggro;
  291. var
  292. myPath:TPointArray;
  293. begin
  294. RSW.Init('Sandcrabs.png');
  295. RSW.walkStyle:= wsSPS;
  296. RSW.anyAngle:= True;
  297. 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)]);
  298. //writeln(RSW.GetMyPos());
  299. RSW.blindWalk(Point(321,163));
  300. wait(random(1000)+500);
  301. RSW.blindWalk(Point(283,160));
  302. wait(random(1000)+500);
  303. RSW.blindWalk(Point(240,179));
  304. RSW.Free();
  305. end;
  306.  
  307.  
  308.  
  309.  
  310. procedure checkreset;
  311. begin
  312.  
  313. if (inCombat(10)) then
  314. begin
  315. writeln('crabs still aggro...');
  316. t2.start();
  317. end;
  318. if(t2.timeElapsed > 20000) then
  319. begin
  320. writeln('crabs dont aggro anymore, resetting');
  321. resetaggro;
  322. t2.start();
  323. end;
  324. end;
  325.  
  326. procedure attackNPC();
  327. var
  328. I: Integer;
  329. t: Timer;
  330. begin
  331.  
  332. if (hoverNearestNPC()) then
  333. begin
  334. wait(random(10,20));
  335. case random(0, 14) of
  336. 0..14:
  337. begin
  338. wait(10+random(20));
  339. if(isUptextMulti(['1'])) then
  340. begin
  341. fastClick(MOUSE_LEFT);
  342. end else
  343. exit;
  344. end;
  345. // 8..14:
  346. // begin
  347. // fastClick(MOUSE_RIGHT);
  348. // sleep(random(30, 120));
  349. // waitOption('Attack', 350);
  350. // end;
  351. end;
  352. if (didYellowClick()) then
  353. begin
  354. while (isLoggedIn() and isPlayerWalking()) do
  355. sleep(random(2500, 3000));
  356.  
  357. // attackNPC();
  358. end;
  359. sleep(1000 + random(500));
  360. while (isLoggedIn() and isPlayerWalking()) do
  361. sleep(random(240, 300));
  362. waitFight(500 + random(50), random(2500, 3300));
  363. checkreset;
  364. first := 0;
  365. end;
  366. if (first = 0) then
  367. begin
  368. failAttack := getTimeRunning() + 60000;
  369. inc(first);
  370. Exit;
  371. end;
  372. if (failAttack < getTimeRunning()) then
  373. resetaggro;
  374. end;
  375.  
  376. function getState(): Integer;
  377. begin
  378. if (not isLoggedIn) then
  379. exit(3);
  380. if (not inCombat(1900 + 100)) then
  381. begin
  382. setCompassMM(random(5, 355), 5, true);
  383. exit(0);
  384. end;
  385. if (getHealthPercent <= 70) then
  386. exit(1);
  387. exit(2);
  388. end;
  389.  
  390. procedure checkXp();
  391. begin
  392.  
  393. end;
  394.  
  395.  
  396. procedure antiban();
  397. var
  398. TP: TPoint;
  399. rand, I: Integer;
  400. ABChance: integer;
  401. begin
  402. if ((not isUsingRun()) and (getRunEnergy() > 30)) then
  403. begin
  404. toggleRunning(true);
  405. end;
  406.  
  407. for I := 0 to 0 do
  408. begin
  409. TP := findNPC();
  410. if (TP.X = -1) then
  411. break;
  412. getMousePos(x, y);
  413. if (distance(TP.X, TP.Y, x, y) < 10) or (distance(TP.X, TP.Y, x, y) > 250) then
  414. break;
  415. // hoverNearestNPC();
  416. end;
  417. ABChance := round((random(100,300) * 5) + 13 + 37);
  418.  
  419. rand := random(0, ABChance);
  420. if (rand = 1) then
  421. begin
  422. case random(0, 120) of
  423. 0..20: compassMovement(20, 120, false);
  424. 21..35: PickUpMouse();
  425. 36..50: pickUpMouse();
  426. 51..63: CheckXP();
  427. 64..80: MMouseOffClient('random');
  428. 80..90: checkMovingObjs(false);
  429. 91..99: checkXp();
  430. 100..119: setCompassMM(random(5, 355), 5, true);
  431. end;
  432. end;
  433. end;
  434.  
  435.  
  436. procedure executeState(State: Integer);
  437. begin
  438. case (State) of
  439. 0: attackNPC();
  440. 1: heal();
  441. 2: antiban();
  442. 3: loginPlayer(false);
  443. end;
  444. sleep(random(100, 150));
  445. clickToContinue();
  446. Cantreach;
  447. end;
  448.  
  449. procedure logoutHandler(Reason: String);
  450. begin
  451. writeln('logging out, reason: ' + reason);
  452. waitFight(1000, 30000);
  453. logoutPlayer;
  454. terminateScript;
  455. end;
  456.  
  457. procedure FreeGlobals;
  458. begin
  459. FreeDTM(DTM_Lobster);
  460. RSW.Free();
  461. end;
  462.  
  463. procedure potionloop;
  464. begin
  465. if(startingtime.timeElapsed >= 300000) then
  466. begin
  467. drinkpotion;
  468. startingtime.start;
  469. end;
  470. end;
  471.  
  472.  
  473. procedure breakloop;
  474. begin
  475. if(startingtime.timeElapsed >= 300000) then
  476. begin
  477. drinkpotion;
  478. startingtime.start;
  479. end;
  480. end;
  481.  
  482.  
  483. begin
  484. setSupressExceptions(true);
  485. declarePlayer();
  486. initAL();
  487. AddOnTerminate('FreeGlobals');
  488. DTM_Lobster := DTMFromString('m6wAAAHic42ZgYHBhYmDwgmJPIHYEYhsgNodiOyB2BWIfIA5gZGCIAeIoIPYD4lAoDoPyfYDYC4idgHhHshjQdEaisAaQJBYTZyIEIwEA/ycJgA==');
  489. mouseSpeed := Random(20, 30);
  490. setupPlayer();
  491. setupBreak(cBREAK_IN, cBREAK_FOR, cR_BREAK_IN, cR_BREAK_FOR);
  492. startingtime.start;
  493. t2.start;
  494. repeat
  495. executeState(getState());
  496. potionloop;
  497. until (false);
  498. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement