Advertisement
zamaro

Plank Maker

Mar 29th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.04 KB | None | 0 0
  1. program PlankMaker;
  2. {$DEFINE SMART8}
  3. {$I SRL-OSR/SRL.Simba}
  4. {$I SRL-OSR/SRL/Reflection/Reflection.simba}
  5. {$i SRL-OSR\SRL\misc\debug.simba}
  6. {$i SRL-OSR\SRL\misc\SmartGraphics.simba}
  7.  
  8. var
  9. BankCord, shopcord: tpointarray;
  10. planksmade, cx, cy: integer;
  11.  
  12. const
  13. bankpin = '1234';
  14.  
  15. procedure playerSetup;
  16. begin
  17. HowManyPlayers := 1;
  18. NumberOfPlayers(HowManyPlayers);
  19. CurrentPlayer := 0;
  20. Players[0].Name := 'zezima';
  21. Players[0].Pass := 'iscool';
  22. Players[0].Nick := 'ezim';
  23. Players[0].Active := True;
  24. end;
  25.  
  26. procedure WaitShortClick;
  27. begin
  28. case random(600) of
  29. 1..450: Wait(RandomRange(100, 150));
  30. 451..570: Wait(RandomRange(150, 200));
  31. 571..590: Wait(RandomRange(200, 250));
  32. 591..600: Wait(RandomRange(250, 400));
  33. end;
  34. end;
  35.  
  36. procedure Keyboards;
  37. begin
  38. case random(5) of
  39. 0..2:
  40. begin
  41. KeyDown(37);
  42. WaitShortClick KeyUp(37);
  43. WaitShortClick KeyDown(40);
  44. WaitShortClick KeyUp(40);
  45. end;
  46. 3..4:
  47. begin
  48. KeyDown(39);
  49. WaitShortClick KeyUp(39);
  50. WaitShortClick KeyDown(38);
  51. WaitShortClick KeyUp(38);
  52. end;
  53. 5:
  54. begin
  55. KeyDown(38);
  56. WaitShortClick KeyUp(38);
  57. WaitShortClick KeyDown(39);
  58. WaitShortClick KeyUp(39);
  59. end;
  60. end;
  61. end;
  62.  
  63. function HoverNearbyNpc: boolean;
  64. var
  65. I: Tpointarray;
  66. P: Integer;
  67. begin
  68. I := GetMiniMapDots('npc');
  69. if (length(I) > 6) then
  70. begin
  71. SortTPAFrom(i, Point(MMCX, MMCY));
  72. P := random(length(I)) Mmouse(I[0].x, I[0].y, 3, 3);
  73. result := true;
  74. end;
  75. end;
  76.  
  77. procedure Antiban;
  78. begin
  79. case random(140) of
  80. 0..2: hoverskill(skill_hitpoints, false);
  81. 3..7.: HoverSkill(skill_strength, False);
  82. 12..15: hoverskill(skill_attack, false);
  83. 16..19: HoverOnlineFriend;
  84. 20: BoredHuman;
  85. 30: MMouseOffClient('top');
  86. 40: MMouseOffClient('left');
  87. 50: MMouseOffClient('right');
  88. 60: MMouseOffClient('bottom');
  89. 70: SmallRandomMouse;
  90. 80: RandomAngle(1);
  91. 90: RandomAngle(2);
  92. 100: PickUpMouse;
  93. 110: CompassMovement(10, 70, true);
  94. 120: HoverNearbyNpc;
  95. 130: Keyboards;
  96. 140: writeln('hi');
  97. end;
  98. end;
  99.  
  100. procedure SecondAntiban2;
  101. begin
  102. case random(20) of
  103. 1: PickUpMouse;
  104. 2: BoredHuman;
  105. 3: MMouseOffClient('left');
  106. 4: MMouseOffClient('right');
  107. 5: MMouseOffClient('bottom');
  108. 6: SmallRandomMouse;
  109. 7: boredhuman;
  110. 8: SmallRandomMouse;
  111. 10: keyboards;
  112. end;
  113. end;
  114.  
  115. procedure WaitHumanClick;
  116. begin
  117. case random(600) of
  118. 1..450: Wait(RandomRange(400, 600));
  119. 451..570: Wait(RandomRange(400, 600));
  120. 571..590: Wait(RandomRange(600, 800));
  121. 591..600: Wait(RandomRange(800, 1000));
  122. end;
  123. end;
  124.  
  125. procedure WaitHumanClick2;
  126. begin
  127. case random(600) of
  128. 1..450: Wait(RandomRange(1000, 1500));
  129. 451..570: Wait(RandomRange(1500, 2000));
  130. 571..590: Wait(RandomRange(2000, 2500));
  131. 591..600: Wait(RandomRange(2500, 3000));
  132. end;
  133. end;
  134.  
  135. procedure WaitHumanClick3;
  136. begin
  137. case random(600) of
  138. 1..450: Wait(RandomRange(3000, 5000));
  139. 451..570: Wait(RandomRange(5000, 5500));
  140. 571..590: Wait(RandomRange(6000, 6500));
  141. 591..600: Wait(RandomRange(7000, 7500));
  142. end;
  143. end;
  144.  
  145. var
  146. BankCords, SawmilCord: array of Tpoint;
  147.  
  148. procedure myvars;
  149. begin
  150. SawmilCord := [Point(3253, 3420), Point(3253, 3425), Point(3257, 3428), Point(3262, 3428), Point(3267, 3428), Point(3272, 3429), Point(3275, 3433), Point(3275, 3438), Point(3279, 3441), Point(3281, 3446), Point(3281, 3451), Point(3281, 3456), Point(3281, 3461), Point(3284, 3465), Point(3287, 3469), Point(3290, 3473), Point(3293, 3478), Point(3295, 3483), Point(3300, 3486), Point(3303, 3490)] BankCords := [Point(3302, 3491), Point(3302, 3486), Point(3299, 3481), Point(3295, 3477), Point(3291, 3473), Point(3290, 3468), Point(3287, 3464), Point(3285, 3459), Point(3285, 3454), Point(3284, 3449), Point(3282, 3444), Point(3279, 3440), Point(3275, 3437), Point(3275, 3432), Point(3270, 3430), Point(3265, 3430), Point(3260, 3430), Point(3255, 3427), Point(3253, 3422)] BankCord := [point(2843, 3542)];
  151. shopcord := [point(2838, 3549)];
  152. end;
  153.  
  154. function GetGreenUptext: string;
  155. var
  156. WhiteT, BlueT, YellowT, OrangeT, GreenT, FoundText: string;
  157. begin
  158. WhiteT := GetTextAtExWrap(8, 8, 300, 21, 0, 5, 1, 14541281, 55, 'UpChars07');
  159. BlueT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 13423640, 65, 'UpChars07');
  160. YellowT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 1235160, 40, 'UpChars07');
  161. OrangeT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 4687583, 53, 'UpChars07');
  162. GreenT := GetTextAtExWrap(8, 8, 300, 21, 0, 5, 1, 120577, 65, 'UpChars07');
  163. FoundText := WhiteT + ' ' + BlueT + YellowT + OrangeT + GreenT;
  164. FoundText := ReplaceWrap(FoundText, '.', '', [rfReplaceAll]);
  165. FoundText := ReplaceWrap(FoundText, '/', '', [rfReplaceAll]);
  166. FoundText := ReplaceWrap(FoundText, '\', '', [rfReplaceAll]);
  167. FoundText := ReplaceWrap(FoundText, ',', '', [rfReplaceAll]);
  168. FoundText := ReplaceWrap(FoundText, '*', '', [rfReplaceAll]);
  169. FoundText := ReplaceWrap(FoundText, '^', '', [rfReplaceAll]);
  170. FoundText := ReplaceWrap(FoundText, '"', '', [rfReplaceAll]);
  171. Result := FoundText;
  172. end;
  173.  
  174. function IsUpTextMultiCustom2(Text: TStringArray): Boolean;
  175. var
  176. TheText: string;
  177. i, n: Integer;
  178. begin
  179. TheText := GetGreenUptext;
  180. n := High(Text);
  181. for i := 0 to n do
  182. if (Pos(Text[i], TheText) > 0) then
  183. begin
  184. Result := True;
  185. Exit;
  186. end;
  187. end;
  188.  
  189. function WaitUpTextMulti2(S: TStringArray; Time: Integer): Boolean;
  190. var
  191. T: Integer;
  192. begin
  193. Result := false;
  194. T := GetSystemTime + Time;
  195. while (GetSystemTime < T) do
  196. begin
  197. if (IsUpTextMultiCustom2(S)) then
  198. begin
  199. Result := True;
  200. Exit;
  201. end;
  202. Wait(20 + Random(20));
  203. end;
  204. end;
  205.  
  206. function OpenWScreen: Boolean;
  207. begin
  208. Result := False;
  209. if WorldScreen then
  210. exit;
  211. if Loggedin then
  212. Exit;
  213. if not WorldScreen then
  214. begin
  215. Mmouse(54, 475, 1, 1);
  216. WaitHumanClick;
  217. ClickMouse2(Mouse_Left);
  218. waithumanclick;
  219. Result := True;
  220. end;
  221. end;
  222.  
  223. function whitecolor: boolean;
  224. var
  225. Monster: TpointArray;
  226. TmpCts: Integer;
  227. begin
  228. tmpcts := GetColorToleranceSpeed;
  229. ColorToleranceSpeed(2);
  230. SetColorSpeed2Modifiers(0.22, 1.69);
  231. result := FindColorsTolerance(Monster, 9163999, 192, 67, 583, 469, 4);
  232. ColorToleranceSpeed(tmpcts);
  233. SetColorSpeed2Modifiers(0.2, 0.2);
  234. end;
  235.  
  236. procedure ProgressReport;
  237. begin
  238. if (not (loggedin)) then
  239. exit;
  240. ClearDebug;
  241. WriteLn('* FPlanker');
  242. WriteLn('* Runtime: ' + TimeRunning);
  243. Writeln('*');
  244. writeln('* Planks Made ' + IntToStr(PlanksMade));
  245. end;
  246.  
  247. function FindObjExX(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol, CTS: integer; Hue, Sat: Extended; Step, xs, ys, xe, ye: Integer): Boolean;
  248. var
  249. MidX, MidY, i, j, k, x, y, width, height, HalfWidth, HalfHeight: Integer;
  250. ColorFound: Boolean;
  251. SearchBoxes: array of array of TBox;
  252. p: TPointArray;
  253. begin
  254. if (not (loggedin)) then
  255. exit;
  256. Result := False;
  257. for i := 0 to (GetArrayLength(Color) - 1) do
  258. begin
  259. ColorToleranceSpeed(CTS);
  260. SetColorSpeed2Modifiers(Hue, sat);
  261. if (FindColorSpiralTolerance(cx, cy, Color[i], xs, ys, xe, ye, Tol)) then
  262. begin
  263. ColorToleranceSpeed(1);
  264. SetColorSpeed2Modifiers(0.2, 0.2);
  265. ColorFound := True;
  266. Break;
  267. end;
  268. end;
  269. ColorToleranceSpeed(1);
  270. SetColorSpeed2Modifiers(0.2, 0.2);
  271. if not (ColorFound) then
  272. Exit;
  273. MidX := Round((xe - xs) / 2);
  274. MidY := Round((ye - ys) / 2);
  275. Width := Ceil(abs(xe - xs) / 2 / Step - 0.5) * 2 + 1;
  276. Height := Ceil(abs(ye - ys) / 2 / Step - 0.5) * 2 + 1;
  277. SetLength(SearchBoxes, Width);
  278. HalfWidth := Floor(Width / 2);
  279. HalfHeight := Floor(Height / 2) for x := - 1 * HalfWidth to HalfWidth do
  280. begin
  281. SetLength(SearchBoxes[x + HalfWidth], Height);
  282. for y := - 1 * HalfHeight to HalfHeight do
  283. SearchBoxes[x + HalfWidth][y + HalfHeight] := IntToBox(Max(xs, xs + Round(MidX + ((x - 0.5) * Step))), Max(ys, ys + Round(MidY + ((y - 0.5) * Step))), Min(xe, xs + Round(MidX + ((x + 0.5) * Step))), Min(ye, ys + Round(MidY + ((y + 0.5) * Step))));
  284. end;
  285. p := TPAFromBox(IntToBox(0, 0, Width - 1, Height - 1));
  286. SortTPAFrom(p, Point(floor(Width / 2), floor(Height / 2)));
  287. for k := 0 to High(Color) do
  288. for j := 0 to High(p) do
  289. begin
  290. ColorToleranceSpeed(CTS);
  291. SetColorSpeed2Modifiers(Hue, sat);
  292. if (FindColorTolerance(cx, cy, Color[k], SearchBoxes[p[j].x][p[j].y].x1, SearchBoxes[p[j].x][p[j].y].y1, SearchBoxes[p[j].x][p[j].y].x2, SearchBoxes[p[j].x][p[j].y].y2, Tol)) then
  293. begin
  294. ColorToleranceSpeed(1);
  295. SetColorSpeed2Modifiers(0.2, 0.2);
  296. MMouse(cx, cy, 3, 3);
  297. wait(randomrange(200, 300));
  298. if (WaitUptextMulti2(Text, 300)) then
  299. begin
  300. ColorToleranceSpeed(1);
  301. SetColorSpeed2Modifiers(0.2, 0.2);
  302. GetMousePos(cx, cy);
  303. Result := True;
  304. Exit;
  305. end;
  306. end;
  307. ColorToleranceSpeed(1);
  308. SetColorSpeed2Modifiers(0.2, 0.2);
  309. end;
  310. ColorToleranceSpeed(1);
  311. SetColorSpeed2Modifiers(0.2, 0.2);
  312. end;
  313.  
  314. procedure loginloop;
  315. begin
  316. OpenWorldScreen;
  317. repeat
  318. if whitecolor then
  319. break;
  320. if whitecolor then
  321. writeln('yeaya');
  322. if not whitecolor then
  323. writeln('yea22ya');
  324. case random(10) of
  325. 0..2: mouse(randomrange(397, 554), randomrange(78, 394), 1, 1, mouse_move);
  326. 3..4: mouse(randomrange(298, 462), randomrange(200, 392), 1, 1, mouse_move);
  327. 5..6: mouse(randomrange(205, 555), randomrange(80, 154), 1, 1, mouse_move);
  328. 7..10: mouse(randomrange(211, 555), randomrange(246, 367), 1, 1, mouse_move);
  329. end;
  330. until (whitecolor) if whitecolor then
  331. begin
  332. clickmouse2(mouse_left);
  333. waithumanclick;
  334. currentworld;
  335. waithumanclick;
  336. if (CurrentWorldLS = 365) then
  337. exit;
  338. waithumanclick;
  339. loginplayer;
  340. exit;
  341. end;
  342. end;
  343.  
  344. function FindObject2(Color: TintegerArray; Tol, CTS: integer; hMoD, sMoD: extended; split, sort: integer; Uptext: array of string; WaitUptextWait, WaitUptextRandom: Integer; x, y, xs, ys: integer): boolean;
  345. var
  346. III, i, tmpcts: integer;
  347. TPA: tpointarray;
  348. TPAA: T2DPointArray;
  349. begin
  350. if (not (loggedin)) then
  351. exit;
  352. gametab(tab_inv);
  353. tmpcts := GetColorToleranceSpeed;
  354. ColorToleranceSpeed(CTS);
  355. SetColorSpeed2Modifiers(hMoD, SMoD);
  356. FindColorsSpiralTolerance(MSCX, MSCY, TPA, color[III], x, y, xs, ys, Tol) ColorToleranceSpeed(tmpCTS);
  357. SetColorSpeed2Modifiers(0.2, 0.2);
  358. if (length(TPA) > 0) then
  359. begin
  360. Result := True;
  361. end;
  362. end;
  363.  
  364. function LocateNPC(Name, Uptext: string): boolean;
  365. var
  366. Tp: Tpoint;
  367. NpcName: tnpc;
  368. begin
  369. if R_FindNpc(Name, NpcName) then
  370. begin
  371. if NpcName.InCombat then
  372. exit;
  373. Tp := NpcName.Tile;
  374. Tp := R_TileToMs(Tp);
  375. Mmouse(Tp.x, Tp.y, 0, 0);
  376. if R_WaitUptext(Uptext, 200) then
  377. begin
  378. result := true;
  379. end;
  380. end;
  381. end;
  382.  
  383. procedure buyplanks;
  384. begin
  385. if not R_IsRunOn then
  386. begin
  387. Mouse(570, 148, 3, 3, mouse_left);
  388. waithumanclick2;
  389. end;
  390. R_FindNormalRandoms;
  391. R_WebWalk(Point(3303, 3490));
  392. R_FindNormalRandoms;
  393. waithumanclick;
  394. if LocateNPC('Sawmill', 'Sawmill') then
  395. begin
  396. clickmouse2(mouse_right);
  397. WaitOptionMulti(['uy', 'Buy', 'Plank'], 500);
  398. waithumanclick2;
  399. R_FindNormalRandoms;
  400. if FindObjExX(cx, cy, ['Buy', 'uy', '1'], [5008518], 1, 2, 0.04, 0.44, 50, msx1, msy1, msx2, msy2) then
  401. begin
  402. clickmouse2(mouse_right);
  403. WaitOptionMulti(['All', 'll'], 500);
  404. waithumanclick2;
  405. R_FindNormalRandoms;
  406. end;
  407. end;
  408. end;
  409.  
  410. procedure bankthings;
  411. begin
  412. if bankscreen then
  413. begin
  414. waithumanclick2;
  415. MouseItem(2, mouse_right);
  416. waithumanclick;
  417. if (WaitOptionMulti(['All', 'll'], 500)) then
  418. waithumanclick;
  419. MouseBankSlot(1, mouse_Right);
  420. waithumanclick;
  421. if (WaitOption('ut-one', 500)) then
  422. writeln('we did it');
  423. end;
  424. end;
  425.  
  426. procedure bankplanks;
  427. begin
  428. if not R_IsRunOn then
  429. begin
  430. Mouse(570, 148, 3, 3, mouse_left);
  431. waithumanclick2;
  432. end;
  433. MakeCompass('s');
  434. R_WebWalk(Point(3253, 3422));
  435. if LocateNPC('Banker', 'Bank') then
  436. begin
  437. clickmouse2(mouse_right);
  438. waitoption('ank', 1000);
  439. waithumanclick2;
  440. if pinscreen then
  441. begin
  442. InPin(bankpin);
  443. end;
  444. waithumanclick2;
  445. if BankScreen then
  446. begin
  447. bankthings;
  448. CloseBank;
  449. IncEx(planksmade, 28)
  450. end;
  451. end;
  452. end;
  453.  
  454. procedure Antibans;
  455. begin
  456. if not loggedin then
  457. exit;
  458. R_FindNormalRandoms;
  459. progressreport;
  460. gametab(tab_inv);
  461. if not R_IsRunOn then
  462. begin
  463. Mouse(570, 148, 3, 3, mouse_left);
  464. waithumanclick2;
  465. end;
  466.  
  467. case random(20) of
  468. 0..3: Antiban;
  469. 4..20: writeln('not doing antiban');
  470. end;
  471.  
  472.  
  473. case random(10) of
  474. 1..8: writeln('doing nothing');
  475. 9: setangle(0);
  476. 10: setangle(1);
  477. end;
  478.  
  479. case random(20) of
  480. 1..16: writeln('doing nothingx2');
  481. 17: MakeCompass('n');
  482. 18: MakeCompass('s');
  483. 19: MakeCompass('w');
  484. 20: MakeCompass('e');
  485. end;
  486.  
  487. end;
  488.  
  489. procedure mainloop;
  490. begin
  491.  
  492. progressreport;
  493.  
  494. if FindObject2([5077144], 8, 2, 0.01, 0.51, 0, 0, ['Logs'], 300, 500, MIX1, MIY1, MIX2, MIY2) then
  495. Buyplanks;
  496. if FindObject2([4810880], 3, 2, 0.09, 0.46, 0, 0, ['Logs'], 300, 500, MIX1, MIY1, MIX2, MIY2) then
  497. bankplanks;
  498. if (not FindObject2([4810880], 3, 2, 0.09, 0.46, 0, 0, ['Logs'], 300, 500, MIX1, MIY1, MIX2, MIY2)) and (not FindObject2([5077144], 8, 2, 0.01, 0.51, 0, 0, ['Logs'], 300, 500, MIX1, MIY1, MIX2, MIY2)) then
  499. bankplanks;
  500.  
  501. case random (100) of
  502. 0..95: writeln('nada');
  503. 96..100: antibans;
  504. end;
  505. end;
  506.  
  507.  
  508. begin
  509. playerSetup;
  510. setupsrl;
  511. SetupReflection;
  512. addonterminate('progressreport');
  513. R_Reincarnate := true;
  514. ReinCarnate := false;
  515. R_CombatRandoms := true;
  516. myvars;
  517. repeat
  518. wait(400);
  519. if not loggedin then
  520. loginloop;
  521. wait(400);
  522. if loggedin then
  523. mainloop;
  524. until (false);
  525. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement