Guest User

Untitled

a guest
May 23rd, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.77 KB | None | 0 0
  1. program HoodzFletcher;
  2. {$DEFINE SMART}
  3. {$i AeroLib/AeroLib.Simba}
  4.  
  5. var
  6. x, y, failCount, bowsMade, xp: Integer;
  7. DTM_longBowU, DTM_1st, DTM_2nd: Integer;
  8. breakAfterTime, breakLength: Integer;
  9.  
  10. const
  11. P_USERNAME = '';
  12. P_PASSWORD = '';
  13. P_PIN = '';
  14.  
  15. LOG = 'yew'; {oak, willow, maple, yew, magic}
  16. MODE = 'string'; {cut, string}
  17.  
  18. USEBREAKS = true;
  19. breakAfterHours_MIN = 2;
  20. breakAfterHours_MAX = 3; {breaks after random (MIN, MAX) hours}
  21. breakForMinutes_MIN = 30;
  22. breakForMinutes_MAX = 90; {for random (MIN, MAX) minutes}
  23.  
  24. VERSION = '2';
  25.  
  26. procedure declarePlayer();
  27. begin
  28. Me.Name := P_USERNAME;
  29. Me.Pass := P_PASSWORD;
  30. Me.Pin := P_PIN;
  31. Me.Active := True;
  32. Me.Member := True;
  33. end;
  34.  
  35. procedure free;
  36. begin
  37. freeDTM(DTM_longBowU);
  38. if (MODE = 'cut') then
  39. freeDTM(DTM_1st);
  40. freeDTM(DTM_2nd);
  41. end;
  42.  
  43. procedure randomBreakTime();
  44. begin
  45. breakAfterTime := GetTimeRunning + (RandomRange(breakAfterHours_MIN, breakAfterHours_MAX) * 3600000) + RandomRange(2000, 3500000);
  46. Writeln('breakAfterTime = ' + MsToTime(breakAfterTime, 3));
  47. breakLength := (RandomRange(breakForMinutes_MIN, breakForMinutes_MAX) * 60000) + RandomRange(2000, 59000);
  48. Writeln('breakLength = ' + MsToTime(breakLength, 3));
  49. end;
  50.  
  51. procedure breakHandlerCustom();
  52. begin
  53. writeln('starting breakhandler');
  54. while (isLoggedIn) do
  55. logoutPlayer;
  56. while not (getTimeRunning >= (breakAfterTime + breakLength)) do
  57. begin
  58. Writeln('Break handler active');
  59. Writeln('TimeRunning: ' + MsToTime(getTimeRunning, 3));
  60. Writeln('Breaking till: ' + MsToTime((breakAfterTime + breakLength), 3));
  61. Writeln('Time left until break is done: ' + MsToTime(((breakAfterTime + breakLength) - getTimeRunning), 3));
  62. Sleep(5000);
  63. ClearDebug;
  64. end;
  65. randomBreakTime;
  66. end;
  67.  
  68. procedure setupPlayer();
  69. begin
  70. writeln('player setup...');
  71. if (not isLoggedIn()) then
  72. loginPlayer(false);
  73. if (isLoggedIn()) then
  74. begin
  75. toggleRunning(true);
  76. setAngle(ANGLE_HIGH);
  77. end;
  78. end;
  79.  
  80. procedure setup();
  81. begin
  82. mouseSpeed := Random(18, 25);
  83. writeln('mouseSpeed set at: ' + intToStr(mouseSpeed));
  84. {1st = log, 2nd knife or bs}
  85. case LOG of
  86. 'oak':
  87. begin
  88. if (mode = 'cut') then
  89. DTM_1st := DTMFromString('mggAAAHicY2NgYKhhZmAoBuIWIM4G4nYgrgJiTyYGhhAgDgBiPyD2AOJgIC6JNAXqYsTA7AzYAaZKCIYAAFa7Be4=');
  90. DTM_longBowU := DTMFromString('mggAAAHicY2NgYAhmZmAIA+IoII6Gsv2AeBsjA8MuID4KxIeAeC8QbwbifbPEGHqKBIA6GVEwO5AEYXTAiANDAABMoQkc');
  91. xp := 25;
  92. end;
  93. 'willow':
  94. begin
  95. if (mode = 'cut') then
  96. DTM_1st := DTMFromString('mbQAAAHicY2VgYPBkZGDwAOIgILYE4nAgfgAUfwXEz4H4KQOE7+EgASQZUTA7AyZgxILBAAATEQak');
  97. DTM_longBowU := DTMFromString('mWAAAAHicY2FgYPBmZGAIBuIAIHYD4kSgWAEQZwBxHBBvXOEAJBnhmJ0BFTCiYRAAABdJBHs=');
  98. xp := 42;
  99. end;
  100. 'maple':
  101. begin
  102. if (MODE = 'cut') then
  103. DTM_1st := DTMFromString('mggAAAHicY2NgYHgOxE+A+BYQvwfit0B8BYgrgbgBiOuBuBaIi4G4HIizPXiBJCMGFmHADjBVQjAEAAC3NQka');
  104. DTM_longBowU := DTMFromString('mWAAAAHicY2FgYLjLzMDwBIgfQGkjRgYGRyA2B2IbIN63ZDZQFSMcszOgAkY0DAIAt4MGiw==');
  105. xp := 58;
  106. end;
  107. 'yew':
  108. begin
  109. if (MODE = 'cut') then
  110. DTM_1st := DTMFromString('mlwAAAHicY2dgYKhkZGCoAeJWIM4E4hIgbgPiHCCeA5RfAsSzgHgeEC8H4oVAPBOI/W04gCQjVszFgBtg1wHBUAAAzqcIWw==');
  111. DTM_longBowU := DTMFromString('mlwAAAHicY2dgYHBlYmCwAWJHIPYEYl8o7QTEj4DyN4D4ARC/AuKPQPwMiG8D8b5lYkCSESvmYsANsOuAYCgAAC0gCcA=');
  112. xp := 75;
  113. end;
  114. 'magic':
  115. begin
  116. if (MODE = 'cut') then
  117. DTM_1st := DTMFromString('mggAAAHicY2NgYNBkZmCQZobQckBsDMSmQHyPkYHhARA/h+InQHwXiPNTbRk0l84A6mREwexAEoTRASMODAEAHvkI7g==');
  118. DTM_longBowU := DTMFromString('mbQAAAHicY2VgYFBmYWBQA2ItINYEYj0gvsnIwHAXiJ8D8X0gfgnECl31DALOtkAdjHDMDiRBGBkwYsFgAAAYYwcd');
  119. xp := 92;
  120. end;
  121. end;
  122.  
  123. if (MODE = 'cut') then
  124. DTM_2nd := DTMFromString('mlwAAAHicY2dgYHjAzMBwA4gfA/FzIH4ExLeA+DoQOzEyMAQCsSMQmwOxBRC7AbEPEOelpQF1M2LF/Ay4AXYdEAwFAIDWCWQ=')
  125. else
  126. begin
  127. DTM_1st := DTM_longBowU;
  128. DTM_2nd := DTMFromString('mWAAAAHicY2FgYHgJxJ+B+B4Q3wbiYCAOgdKxQNxcHgkkGeFYhAEVMKJhEAAAs7wGXw==');
  129. end;
  130. addOnTerminate('free');
  131. randomBreakTime();
  132. setupPlayer();
  133. end;
  134.  
  135. procedure stats_check;
  136. begin
  137. if (STATS_ID = '') then
  138. begin
  139. writeln('You MUST have a stats account registered to use this script');
  140. writeln('You can register for free here: http://stats.grats.pw/reg.php');
  141. writeln('More information about stats here: https://villavu.com/forum/showthread.php?t=112103&p=1332139');
  142. TerminateScript;
  143. end;
  144. end;
  145.  
  146. procedure updater();
  147. var
  148. NewFile: integer;
  149. OnlineVersion, NewScript, NewFileName: string;
  150. begin
  151. writeln('Checking for script updates...');
  152. OnlineVersion := GetPage('http://pastebin.com/raw.php?i=KEDqiLid');
  153. if (trim(OnlineVersion) > VERSION) then
  154. begin
  155. writeLn('Script update available!');
  156. writeLn('Updating script to v' + OnlineVersion);
  157. NewScript := GetPage('http://pastebin.com/raw.php?i=gktWX9u8');
  158. NewFileName := 'C:\Simba\Scripts\' + 'HoodzFletcher Aero V' + Trim(OnlineVersion) + '.simba';
  159. NewFile := Rewritefile(NewFileName, true);
  160. try
  161. WriteFileString(NewFile, NewScript);
  162. except
  163. begin
  164. writeLn('Fatal error writing to ' + NewFileName + '!!');
  165. terminatescript;
  166. end;
  167. end;
  168. CloseFile(NewFile);
  169. writeLn('New script downloaded to ' + NewFileName + '. Please restart Simba.');
  170. TerminateScript;
  171. end
  172. else
  173. writeLn('You have the latest version of the script!');
  174. end;
  175.  
  176. procedure customMouse(point: TPoint);
  177. begin
  178. case random(0, 6) of
  179. 0..2: BrakeMMouse(point, random(5), random(5), true);
  180. 3: BrakeMMouse(point, random(5), random(5), false);
  181. 4..5: MissMouse(point, random(5), random(5));
  182. 6: HumanMMouse(point, random(5), random(5));
  183. end;
  184. end;
  185.  
  186. function waitForPixelShift(amount, timeOut: Integer; box: TBox): Boolean;
  187. var
  188. x1, y1, BMP, BMP2, tempShift: Integer;
  189. t: Timer;
  190. begin
  191. result := false;
  192. t.start();
  193. BMP := bitmapFromClient(box.x1, box.y1, box.x2, box.y2);
  194. repeat
  195. if (t.timeElapsed() >= timeOut) then
  196. break;
  197. sleep(250);
  198. BMP2 := bitmapFromClient(box.x1, box.y1, box.x2, box.y2);
  199. tempShift := calculatePixelShift(BMP, BMP2, IntToBox(0,0,(box.x2 - box.x1),(box.y2-box.y1)));
  200. if (calculatePixelShift(BMP, BMP2, IntToBox(0,0,(box.x2 - box.x1),(box.y2-box.y1))) >= amount) then
  201. result := true;
  202. freeBitmap(BMP2);
  203. until (Result);
  204. { if (Result) then
  205. writeln(toStr(tempShift) + ' pixels (amount: ' + toStr(amount) + ') changed after: ' + toString(t.timeElapsed()) + ' result: true')
  206. else
  207. writeln('less than ' + toString(amount) + ' pixels changed after: ' + toStr(timeOut) + ' (timeout) result: false');
  208. } freeBitmap(BMP);
  209. end;
  210.  
  211. function getLocations(DTM, slots: Integer): TIntegerArray;
  212. var
  213. I: Integer;
  214. tempArray: TIntegerArray;
  215. begin
  216. setLength(tempArray, 0);
  217. for I := 1 to slots do
  218. begin
  219. if (FindDTM(DTM, x, y, invBox(I).x1, invBox(I).y1, invBox(I).x2, invBox(I).y2)) then
  220. begin
  221. SetLength(tempArray, Length(tempArray) + 1);
  222. tempArray[High(tempArray)] := I;
  223. end;
  224. end;
  225. result := tempArray;
  226. end;
  227.  
  228. function textVisible(): Boolean;
  229. var
  230. t: Timer;
  231. numb: Integer;
  232. begin
  233. result := false;
  234. numb := random(2000, 3000);
  235. t.start();
  236. repeat
  237. if (t.timeElapsed() > numb) then
  238. break;
  239. sleep(random(320, 600));
  240. if (countColor(0, 211, 392, 307, 411) = 277) then
  241. result := true;
  242. until (result);
  243. end;
  244.  
  245. procedure fletchHandler();
  246. var
  247. randomNumb, count, I: Integer;
  248. ARRAY_DTMs, ARRAY_locs: TIntegerArray;
  249. mousePoint: TPoint;
  250. begin
  251. if (MODE = 'cut') then
  252. ARRAY_DTMs := [DTM_1st, DTM_2nd]
  253. else
  254. ARRAY_DTMs := [DTM_longBowU, DTM_2nd];
  255. randomNumb := random(0, 1);
  256. repeat
  257. ARRAY_locs := getLocations(ARRAY_DTMs[randomNumb], 28);
  258. if (length(ARRAY_locs) = 0) then
  259. exit;
  260. for I := 0 to high(ARRAY_locs) do
  261. begin
  262. writeln(mode + ' randomNumb: ' + toStr(randomNumb) + ' count: ' + toStr(countColor(clOutline_black, invBox(ARRAY_locs[I]).X1, invBox(ARRAY_locs[I]).Y1, invBox(ARRAY_locs[I]).X2, invBox(ARRAY_locs[I]).Y2)));
  263. if (MODE = 'string') and (randomNumb = 0) and (countColor(clOutline_black, invBox(ARRAY_locs[I]).X1, invBox(ARRAY_locs[I]).Y1, invBox(ARRAY_locs[I]).X2, invBox(ARRAY_locs[I]).Y2) = 106) then
  264. continue;
  265. mousePoint := MiddleBox(invBox(ARRAY_locs[I]));
  266. customMouse(mousePoint);
  267. sleep(random(20, 100));
  268. if (isUpText('epo')) then
  269. exit;
  270. case random(0, 12) of
  271. 0..11: fastClick(MOUSE_LEFT);
  272. 12:
  273. begin
  274. fastClick(MOUSE_RIGHT);
  275. waitOption('Use', 300);
  276. end;
  277. end;
  278. sleep(random(30, 100));
  279. break;
  280. end;
  281. if (randomNumb > 0) then
  282. randomNumb := 0
  283. else
  284. randomNumb := 1;
  285. inc(count);
  286. until (count = 2);
  287. customMouse(point(260 + random(-22, 22), 400 + random(-17, 30)));
  288. if (waitUptext('ake', 670)) then
  289. begin
  290. fastClick(MOUSE_RIGHT);
  291. if (MODE = 'cut') then
  292. begin
  293. waitOption('Make X', 300);
  294. if (textVisible()) then
  295. typeSend(toStr(random(28, 99)), true);
  296. end else
  297. waitOption('Make All', 300);
  298. end else
  299. begin
  300. inc(failCount);
  301. if (failCount > 3) then
  302. begin
  303. compassMovement(-30, 30, false);
  304. failCount := 0;
  305. end;
  306. end;
  307. end;
  308.  
  309. procedure antiban();
  310. begin
  311. if (random(0, 20) = 0) then
  312. case random(0, 50) of
  313. 0..35:
  314. if (pointInBox(getMousePnt(), intToBox(1, 1, 765, 500))) then
  315. MMouseOffClient('random');
  316. 41..45: hoverSkill(SKILL_FLETCHING, false);
  317. 46..50: pickUpMouse;
  318. end;
  319. end;
  320.  
  321. procedure terminate(reason: string);
  322. begin
  323. writeln('**TERMINATING** reason: ' + reason);
  324. closeInterface;
  325. logoutPlayer;
  326. terminateScript;
  327. end;
  328.  
  329. procedure incVars();
  330. var
  331. totalXP: Integer;
  332. begin
  333. if (MODE = 'cut') then
  334. totalXP := round(27 * xp)
  335. else
  336. totalXP := round(14 * xp);
  337. stats_incVariable('65', totalXP);
  338. end;
  339.  
  340. procedure openBank();
  341. var
  342. TPA: TPointArray;
  343. ATPA: T2DPointArray;
  344. I: Integer;
  345. spot: TPoint;
  346. t: Timer;
  347. tCol : TColEx;
  348. begin
  349. if (Interfaces[PINSCREEN].isVisible()) then
  350. inPin(P_PIN);
  351. if (isBankOpen()) then
  352. exit;
  353. tCol.create(3425887, 21, 0.04, 0.09);
  354. if (not tCol.findAllIn(AREA_MS, TPA)) then
  355. exit;
  356. ATPA := FloodFillTPA(TPA);
  357. if (length(ATPA) <= 0) then
  358. exit;
  359. SortATPAfromFirstPoint(ATPA, Point(275, 155));
  360. for I := 0 to high(ATPA) do
  361. begin
  362. if (length(ATPA[I]) < 36) then
  363. continue;
  364. spot := middleTPA(ATPA[I]);
  365. customMouse(spot);
  366. if (waitUptextMulti(['ank', 'ast'], 300)) then
  367. begin
  368. fastClick(MOUSE_LEFT);
  369. break;
  370. end;
  371. end;
  372. t.start();
  373. while ((not isBankOpen()) and (not Interfaces[PINSCREEN].isVisible())) and (t.TimeElapsed() < 3000) do
  374. sleep(random(150, 250));
  375. incVars();
  376. end;
  377.  
  378. procedure bankHandler();
  379. var
  380. locs, ARRAY_DTMs: TIntegerArray;
  381. I, randomNumb, count: Integer;
  382. begin
  383. if (not isBankOpen()) and (not Interfaces[PINSCREEN].isVisible() ) then
  384. exit;
  385. if (Interfaces[PINSCREEN].isVisible()) then
  386. inPin(P_PIN);
  387. if (mode = 'cut') then
  388. begin
  389. locs := getLocations(DTM_longbowU, 14);
  390. if (length(locs) < 1) then
  391. begin
  392. SetLength(locs, Length(locs) + 1);
  393. locs[High(locs)] := 1;
  394. end;
  395. I := random(locs[0], locs[high(locs)]);
  396. if (findDTM(DTM_longBowU, x, y, invBox(I).X1, invBox(I).Y1, invBox(I).X2, invBox(I).Y2)) then
  397. begin
  398. customMouse(point(x, y));
  399. sleep(random(20, 100));
  400. fastClick(MOUSE_RIGHT);
  401. waitOption('Deposit-All', 300);
  402. end;
  403. end else
  404. begin
  405. case random(0, 10) of
  406. 0..9: quickDeposit('inv');
  407. 10:
  408. begin
  409. locs := getLocations(DTM_longbowU, 14);
  410. if (length(locs) < 1) then
  411. begin
  412. SetLength(locs, Length(locs) + 1);
  413. locs[High(locs)] := 1;
  414. end;
  415. I := random(locs[0], locs[high(locs)]);
  416. if (findDTM(DTM_longBowU, x, y, invBox(I).X1, invBox(I).Y1, invBox(I).X2, invBox(I).Y2)) then
  417. begin
  418. customMouse(point(x, y));
  419. sleep(random(20, 100));
  420. fastClick(MOUSE_RIGHT);
  421. waitOption('Deposit-All', 300);
  422. end;
  423. end;
  424. end;
  425. end;
  426. if (MODE = 'cut') then
  427. begin
  428. if (findDTM(DTM_1st, x, y, MSX1, MSY1, MSX2, MSY2)) then
  429. begin
  430. customMouse(point(x, y));
  431. sleep(random(20, 100));
  432. fastClick(MOUSE_RIGHT);
  433. if (random(0, 1) = 0) then
  434. waitOption('Withdraw-All ', 300)
  435. else
  436. waitOption('Withdraw-All-but-one', 300);
  437. end;
  438. end else
  439. begin
  440. ARRAY_DTMs := [DTM_longBowU, DTM_2nd];
  441. randomNumb := random(0, 1);
  442. repeat
  443. if (findDTM(ARRAY_DTMs[randomNumb], x, y, MSX1, MSY1, MSX2, MSY2)) then
  444. begin
  445. customMouse(point(x, y));
  446. sleep(random(20, 100));
  447. fastClick(MOUSE_RIGHT);
  448. waitOption('Withdraw-14', 300);
  449. sleep(RandomRange(200, 350));
  450. end;
  451. if (randomNumb > 0) then
  452. randomNumb := 0
  453. else
  454. randomNumb := 1;
  455. inc(count);
  456. until (count = 2);
  457. end;
  458. closeInterface();
  459. fletchHandler();
  460. end;
  461.  
  462. procedure recoverKnife();
  463. begin
  464. if (not isBankOpen()) then
  465. openBank();
  466. if (isBankOpen()) then
  467. begin
  468. if (getInvCount() > 1) then
  469. quickDeposit('inv');
  470. if (getInvCount() = 0) then
  471. begin
  472. if (FindDTM(DTM_2nd, x, y, MSX1, MSY1, MSX2, MSY2)) then
  473. begin
  474. customMouse(Point(x, y));
  475. sleep(random(20, 50));
  476. fastClick(MOUSE_LEFT);
  477. sleep(2500 + random(500));
  478. end;
  479. end;
  480. end;
  481. end;
  482.  
  483. procedure progress();
  484. var
  485. bowsHour, xpGained, xpHour: Integer;
  486. begin
  487. clearDebug;
  488. bowsHour := Round((bowsMade) / (GetTimeRunning / 3600000.0));
  489. xpGained := (xp * bowsMade);
  490. xpHour := Round((xpGained) / (GetTimeRunning / 3600000.0));
  491. writeln('Time running: ' + MsToTime(GetTimeRunning, 3));
  492. writeln('Bows made: ' + toStr(bowsMade) + ' (' + toStr(bowsHour) + ' p/h)');
  493. writeln('Xp gained: ' + toStr(xpGained) + ' (' + toStr(xpHour) + ' p/h)');
  494. end;
  495.  
  496. function getState(): Integer;
  497. begin
  498. if (getTimeRunning >= breakAfterTime) and (USEBREAKS) then
  499. exit(8);
  500. if (not isLoggedIn()) then
  501. exit(0);
  502. if ((getCurrentTab <> TAB_INV) and (not isBankOpen())) then
  503. exit(1);
  504. if ((not FindDTM(DTM_2nd, x, y, MIX1, MIY1, MIX2, MIY2)) and (MODE = 'cut')) then
  505. exit(7);
  506. if ((not FindDTM(DTM_1st, x, y, MIX1, MIY1, MIX2, MIY2)) or (not FindDTM(DTM_2nd, x, y, MIX1, MIY1, MIX2, MIY2))) and (not isBankOpen()) then
  507. exit(5);
  508. if ((not FindDTM(DTM_1st, x, y, MIX1, MIY1, MIX2, MIY2)) or (not FindDTM(DTM_2nd, x, y, MIX1, MIY1, MIX2, MIY2))) and (isBankOpen()) then
  509. exit(6);
  510. if (FindDTM(DTM_1st, x, y, MIX1, MIY1, MIX2, MIY2) and (FindDTM(DTM_2nd, x, y, MIX1, MIY1, MIX2, MIY2)) and (isBankOpen())) then
  511. exit(2);
  512. if (FindDTM(DTM_1st, x, y, MIX1, MIY1, MIX2, MIY2) and (FindDTM(DTM_2nd, x, y, MIX1, MIY1, MIX2, MIY2)) and (not isBankOpen()) and (not waitForPixelShift(10, 2500, intToBox(MIX1, MIY1, MIX2, MIY2)))) then
  513. exit(3);
  514. inc(bowsMade);
  515. exit(4);
  516. end;
  517.  
  518. procedure executeState(State: Integer);
  519. begin
  520. case (State) of
  521. 0: setupPlayer();
  522. 1: gameTab(TAB_INV);
  523. 2: closeInterface();
  524. 3: fletchHandler();
  525. 4: antiban();
  526. 5: openBank();
  527. 6: bankHandler();
  528. 7: recoverKnife();
  529. 8: breakHandlerCustom();
  530. end;
  531. stats_Commit();
  532. progress();
  533. sleep(random(150, 200));
  534. end;
  535.  
  536. begin
  537. updater();
  538. declarePlayer();
  539. initAL();
  540. setup();
  541. stats_setup('12');
  542. stats_check;
  543. stats_initVariable('65', 0);
  544. repeat
  545. executeState(getState());
  546. until (false);
  547. end.
Add Comment
Please, Sign In to add comment