Guest User

Untitled

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