zamaro

Pizza buyer

Jan 24th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.68 KB | None | 0 0
  1. program Pizbuyer;
  2. {$DEFINE SMART8}
  3. {$I SRL-OSR/SRL.Simba}
  4. {$I SRL-OSR/SRL/misc/al_functions.simba}
  5. {$I SRL-OSR/SRL/core/antirandoms/C_AntiRandoms.simba}
  6. {$I SRL-OSR/SRL/Reflection/Reflection.simba}
  7.  
  8.  
  9. var
  10. BankCord,shopcord:tpointarray;
  11. cx, cy, pizzasbought, potatobought, T, WorldsHopped, W: integer;
  12. Myloc:tpoint;
  13.  
  14. const
  15. bankpin = '3389';
  16. BankIconColor = 2138555;
  17. BankIconTol = 25;
  18. BankIconHue = 0.11;
  19. BankIconSat = 1.15;
  20.  
  21.  
  22. BW1 = 308;
  23. Bw2 = 316;
  24. Bw3 = 325;
  25. Bw4 = 337;
  26.  
  27. procedure playerSetup;
  28. begin
  29. HowManyPlayers := 1;
  30. NumberOfPlayers(HowManyPlayers);
  31. CurrentPlayer := 0;
  32. Players[0].Name := 'user';
  33. Players[0].Pass := 'pass';
  34. Players[0].Nick := 'nec';
  35. Players[0].Active := True;
  36. end;
  37.  
  38. procedure MMouseRandom(x, y: integer);
  39. var
  40. Cx, Cy: Integer;
  41. begin
  42. GetMousePos(Cx, Cy);
  43. AL_SetMouseSpeed(20);
  44. case Random(5) of
  45. 0: AL_BrakeWindMouse(Cx, Cy, x, y, 15 + Random(10), 5 + Random(15), 5, 10, 5, True);
  46. 1: AL_HumanWindMouse(Cx, Cy, x, y, 15 + Random(10), 5 + Random(15), 5, 10, 5);
  47. 2: AL_AccurateMMouse(IntToPoint(x, y), 2, 2);
  48. 3: AL_HumanMMouse(IntToPoint(x, y), 2, 2);
  49. 4: AL_ShiftWindMouse(Cx, Cy, x, y, 15 + Random(10), 5 + Random(15), 5, 10, 20, 5);
  50. 5: AL_MissMouse(IntToPoint(x, y), 2, 2);
  51. end;
  52. end;
  53.  
  54.  
  55. procedure WaitHumanClick3;
  56. begin
  57. case random(600) of
  58. 1..450: Wait(RandomRange(3000, 5000));
  59. 451..570: Wait(RandomRange(5000, 5500));
  60. 571..590: Wait(RandomRange(6000, 6500));
  61. 591..600: Wait(RandomRange(7000, 7500));
  62. end;
  63. end;
  64.  
  65. procedure myvars;
  66. begin
  67. BankCord := [point(2843, 3542)];
  68. shopcord := [point(2838, 3549)];
  69. end;
  70.  
  71. procedure DebugPosition;
  72. begin
  73. repeat
  74. wait(400);
  75. Myloc := R_GetTileGlobal;
  76. writeln(Myloc);
  77. until (false);
  78. end;
  79.  
  80. function GetGreenUptext: string;
  81. var
  82. WhiteT, BlueT, YellowT, OrangeT, GreenT, FoundText: string;
  83. begin
  84. WhiteT := GetTextAtExWrap(8, 8, 300, 21, 0, 5, 1, 14541281, 55, 'UpChars07');
  85. BlueT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 13423640, 65, 'UpChars07');
  86. YellowT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 1235160, 40, 'UpChars07');
  87. OrangeT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 4687583, 53, 'UpChars07');
  88. GreenT := GetTextAtExWrap(8, 8, 300, 21, 0, 5, 1, 120577, 65, 'UpChars07');
  89. FoundText := WhiteT + ' ' + BlueT + YellowT + OrangeT + GreenT;
  90. FoundText := ReplaceWrap(FoundText, '.', '', [rfReplaceAll]);
  91. FoundText := ReplaceWrap(FoundText, '/', '', [rfReplaceAll]);
  92. FoundText := ReplaceWrap(FoundText, '\', '', [rfReplaceAll]);
  93. FoundText := ReplaceWrap(FoundText, ',', '', [rfReplaceAll]);
  94. FoundText := ReplaceWrap(FoundText, '*', '', [rfReplaceAll]);
  95. FoundText := ReplaceWrap(FoundText, '^', '', [rfReplaceAll]);
  96. FoundText := ReplaceWrap(FoundText, '"', '', [rfReplaceAll]);
  97. Result := FoundText;
  98. end;
  99.  
  100. function IsUpTextMultiCustom2(Text: TStringArray): Boolean;
  101. var
  102. TheText: string;
  103. i, n: Integer;
  104. begin
  105. TheText := GetGreenUptext;
  106. n := High(Text);
  107. for i := 0 to n do
  108. if (Pos(Text[i], TheText) > 0) then
  109. begin
  110. Result := True;
  111. Exit;
  112. end;
  113. end;
  114.  
  115. function WaitUpTextMulti2(S: TStringArray; Time: Integer): Boolean;
  116. var
  117. T: Integer;
  118. begin
  119. Result := false;
  120. T := GetSystemTime + Time;
  121. while (GetSystemTime < T) do
  122. begin
  123. if (IsUpTextMultiCustom2(S)) then
  124. begin
  125. Result := True;
  126. Exit;
  127. end;
  128. Wait(20 + Random(20));
  129. end;
  130. end;
  131.  
  132. procedure WaitHumanClick;
  133. begin
  134. case random(600) of
  135. 1..450: Wait(RandomRange(400, 600));
  136. 451..570: Wait(RandomRange(400, 600));
  137. 571..590: Wait(RandomRange(600, 800));
  138. 591..600: Wait(RandomRange(800, 1000));
  139. end;
  140. end;
  141.  
  142. procedure WaitHumanClick2;
  143. begin
  144. case random(600) of
  145. 1..450: Wait(RandomRange(1000, 1500));
  146. 451..570: Wait(RandomRange(1500, 2000));
  147. 571..590: Wait(RandomRange(2000, 2500));
  148. 591..600: Wait(RandomRange(2500, 3000));
  149. end;
  150. end;
  151.  
  152. function FindObjExX(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol, CTS: integer; Hue, Sat: Extended; Step, xs, ys, xe, ye: Integer): Boolean;
  153. var
  154. MidX, MidY, i, j, k, x, y, width, height, HalfWidth, HalfHeight: Integer;
  155. ColorFound: Boolean;
  156. SearchBoxes: array of array of TBox;
  157. p: TPointArray;
  158. begin
  159. if (not (loggedin)) then
  160. exit;
  161. Result := False;
  162. for i := 0 to (GetArrayLength(Color) - 1) do
  163. begin
  164. ColorToleranceSpeed(CTS);
  165. SetColorSpeed2Modifiers(Hue, sat);
  166. if (FindColorSpiralTolerance(cx, cy, Color[i], xs, ys, xe, ye, Tol)) then
  167. begin
  168. ColorToleranceSpeed(1);
  169. SetColorSpeed2Modifiers(0.2, 0.2);
  170. ColorFound := True;
  171. Break;
  172. end;
  173. end;
  174. ColorToleranceSpeed(1);
  175. SetColorSpeed2Modifiers(0.2, 0.2);
  176. if not (ColorFound) then
  177. Exit;
  178. MidX := Round((xe - xs) / 2);
  179. MidY := Round((ye - ys) / 2);
  180. Width := Ceil(abs(xe - xs) / 2 / Step - 0.5) * 2 + 1;
  181. Height := Ceil(abs(ye - ys) / 2 / Step - 0.5) * 2 + 1;
  182. SetLength(SearchBoxes, Width);
  183. HalfWidth := Floor(Width / 2);
  184. HalfHeight := Floor(Height / 2) for x := - 1 * HalfWidth to HalfWidth do
  185. begin
  186. SetLength(SearchBoxes[x + HalfWidth], Height);
  187. for y := - 1 * HalfHeight to HalfHeight do
  188. 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))));
  189. end;
  190. p := TPAFromBox(IntToBox(0, 0, Width - 1, Height - 1));
  191. SortTPAFrom(p, Point(floor(Width / 2), floor(Height / 2)));
  192. for k := 0 to High(Color) do
  193. for j := 0 to High(p) do
  194. begin
  195. ColorToleranceSpeed(CTS);
  196. SetColorSpeed2Modifiers(Hue, sat);
  197. 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
  198. begin
  199. ColorToleranceSpeed(1);
  200. SetColorSpeed2Modifiers(0.2, 0.2);
  201. MMouse(cx, cy, 3, 3);
  202. wait(randomrange(200, 300));
  203. if (WaitUptextMulti2(Text, 300)) then
  204. begin
  205. ColorToleranceSpeed(1);
  206. SetColorSpeed2Modifiers(0.2, 0.2);
  207. GetMousePos(cx, cy);
  208. Result := True;
  209. Exit;
  210. end;
  211. end;
  212. ColorToleranceSpeed(1);
  213. SetColorSpeed2Modifiers(0.2, 0.2);
  214. end;
  215. ColorToleranceSpeed(1);
  216. SetColorSpeed2Modifiers(0.2, 0.2);
  217. end;
  218.  
  219.  
  220. function onshopscreen: boolean;
  221. var
  222. tpa: tpointarray;
  223. begin
  224. result := FindColorsTolerance(tpa, 65535, 254, 60, 292, 82, 0);
  225. end;
  226.  
  227. function ShopScreenS: Boolean;
  228. begin
  229. Result := (FindTextTPA(2070783, 10, 22, 30, 476, 52, 'Store', 'UpChars07', Nothing) or (GetColor(482, 36) = 65536));
  230. end;
  231.  
  232. function BuyPizza(): integer;
  233. var
  234. s: string;
  235. PizzaCount: integer;
  236. begin
  237. wait(randomrange(200, 400));
  238. s := GetTextAtExWrap(160, 60, 200, 82, 0, 5, 1, 65535, 0, statchars07);
  239. PizzaCount := StrToIntDef(GetNumbers(s), - 1);
  240. writeln(PizzaCount);
  241. if (PizzaCount > 0) then
  242. begin
  243. IncEx(pizzasbought, pizzacount) mouse(randomrange(185, 190), randomrange(75, 83), 0, 0, mouse_right);
  244. wait(randomrange(200, 300));
  245. mouse(randomrange(145, 149), randomrange(150, 154), 0, 0, mouse_left);
  246. waithumanclick;
  247. end;
  248. end;
  249.  
  250. function BuyPotato(): integer;
  251. var
  252. s: string;
  253. i, PizzaCount: integer;
  254. begin
  255. wait(randomrange(200, 400));
  256. s := GetTextAtExWrap(200, 60, 240, 82, 0, 5, 1, 65535, 0, statchars07);
  257. PizzaCount := StrToIntDef(GetNumbers(s), - 1);
  258. writeln(PizzaCount);
  259. if (PizzaCount > 0) then
  260. begin
  261. IncEx(potatobought, pizzacount) mouse(randomrange(235, 240), randomrange(75, 83), 0, 0, mouse_right);
  262. wait(randomrange(200, 300));
  263. mouse(randomrange(235, 240), randomrange(150, 154), 0, 0, mouse_left);
  264. waithumanclick;
  265. end;
  266. end;
  267.  
  268.  
  269. function Getpizza(): Integer;
  270. var
  271. ss, s: string;
  272. ii, i, potatocount, PizzaCount: integer;
  273. begin
  274. if shopscreens then
  275. begin
  276. waithumanclick2;
  277. BuyPizza;
  278. BuyPotato;
  279. waithumanclick;
  280. mouse(randomrange(486, 487), randomrange(40, 41), 0, 0, mouse_right);
  281. WaitOption('lose', 1000);
  282. waithumanclick2;
  283. if shopscreens then
  284. mouse(randomrange(486, 487), randomrange(40, 41), 0, 0, mouse_left);
  285. if InvFull then
  286. exit;
  287. if not (ExistsItem(28)) then
  288. begin
  289. repeat
  290. wait(400);
  291. logout;
  292. if shopscreens then
  293. mouse(randomrange(486, 487), randomrange(40, 41), 0, 0, mouse_left);
  294. logout;
  295. if not loggedin then
  296. exit;
  297. until (not loggedin);
  298. end;
  299. end;
  300. end;
  301.  
  302.  
  303.  
  304. procedure ProgressReport;
  305. begin
  306. if (not (loggedin)) then
  307. exit;
  308. ClearDebug;
  309. WriteLn('* Pizza buyer');
  310. WriteLn('* Runtime: ' + TimeRunning);
  311. Writeln('*');
  312. writeln('* Worlds Hopped: ' + IntToStr(WorldsHopped));
  313. writeln('* Pizzas Bought: ' + IntToStr(pizzasbought));
  314. Writeln('* Potato Bought: ' + IntToStr(pizzasbought));
  315. end;
  316.  
  317. procedure bankthings;
  318. begin
  319. if pinscreen then
  320.  
  321. begin
  322. InPin(bankpin);
  323. waithumanclick;
  324. end;
  325.  
  326. if bankscreen then
  327. begin
  328. QuickDeposit('inv');
  329. waithumanclick2;
  330. MouseBankSlot(1, mouse_Right);
  331. waithumanclick;
  332. if (WaitOption('ut-one', 500)) then
  333. writeln('we did it');
  334. waithumanclick;
  335. R_WalkPath(shopcord);
  336. end;
  337. end;
  338.  
  339.  
  340.  
  341.  
  342.  
  343. function OpenWScreen: Boolean;
  344. var
  345. x, y: integer;
  346. begin
  347. Result := False;
  348. if WorldScreen then
  349. exit;
  350. if Loggedin then
  351. Exit;
  352. if not WorldScreen then
  353. begin
  354. Mmouse(54, 475, 1, 1);
  355. WaitHumanClick;
  356. ClickMouse2(Mouse_Left);
  357. waithumanclick;
  358. Result := True;
  359. end;
  360. end;
  361.  
  362.  
  363. function whitecolor:boolean;
  364. var
  365. Monster: TpointArray;
  366. TmpCts: Integer;
  367. begin
  368. tmpcts := GetColorToleranceSpeed;
  369. ColorToleranceSpeed(2);
  370. SetColorSpeed2Modifiers(0.22, 1.69);
  371. result := FindColorsTolerance(Monster, 9163999, 192, 67, 583, 469 , 4);
  372. ColorToleranceSpeed(tmpcts);
  373. SetColorSpeed2Modifiers(0.2, 0.2);
  374.  
  375. //FindColorsTolerance(Monster, 92292279, 192, 67, 583, 469 , 17);
  376. end;
  377.  
  378.  
  379.  
  380.  
  381. procedure loginloop;
  382. begin
  383. OpenWorldScreen;
  384. repeat
  385. if whitecolor then break;
  386. if whitecolor then
  387. writeln('yeaya');
  388. if not whitecolor then
  389. writeln('yea22ya');
  390.  
  391. case random(10) of
  392. 0..2: mouse(randomrange(397,554),randomrange(78,394),1,1,mouse_move);
  393. 3..4: mouse(randomrange(298,462),randomrange(200,392),1,1,mouse_move);
  394. 5..6: mouse(randomrange(205,555),randomrange(80,154),1,1,mouse_move);
  395. 7..10: mouse(randomrange(211,555),randomrange(246,367),1,1,mouse_move);
  396. end;
  397. until (whitecolor)
  398. if whitecolor then
  399. begin
  400. clickmouse2(mouse_left);
  401. waithumanclick;
  402. if not (CurrentWorldLS = 365) then
  403. begin
  404. loginplayer;
  405. exit;
  406. end;
  407. end;
  408. end;
  409.  
  410.  
  411.  
  412.  
  413. procedure getfood;
  414. begin
  415. MakeCompass('N');
  416. setangle(0);
  417. wait(400);
  418.  
  419. if shopscreens then
  420. begin
  421. Getpizza;
  422. end
  423. else
  424. begin
  425. if not FindObjExX(cx, cy, ['Lidio', 'Lid', 'dio', 'idio', 'talk', 'talk-to', 'alk-t', 'alk-to', 'alk', 'to'], [6179915], 15, 2, 0.06, 0.09, 50, MSX1, MSY1, MSX2, MSY2) then
  426. begin
  427. R_WalkPath(shopcord);
  428. end;
  429.  
  430.  
  431.  
  432. if FindObjExX(cx, cy, ['Lidio', 'Lid', 'dio', 'idio', 'talk', 'talk-to', 'alk-t', 'alk-to', 'alk', 'to'], [6179915], 15, 2, 0.06, 0.09, 50, MSX1, MSY1, MSX2, MSY2) then
  433. begin
  434. clickmouse2(mouse_right);
  435. waitoption('rade', 1000);
  436. waithumanclick3;
  437. end;
  438.  
  439.  
  440.  
  441. end;
  442. end;
  443.  
  444. procedure bankstuff;
  445. begin
  446.  
  447. R_WalkPath(bankcord);
  448. if bankscreen then
  449. begin
  450. if pinscreen then
  451. begin
  452. InPin(bankpin);
  453. end;
  454. waithumanclick;
  455. bankthings;
  456. end
  457. else
  458. begin
  459. if not FindObjExX(cx, cy, ['jade', 'ade'], [6182999], 15, 2, 0.16, 0.06, 50, MSX1, MSY1, MSX2, MSY2) then
  460. begin
  461. R_WalkPath(bankcord);
  462. end;
  463.  
  464. if FindObjExX(cx, cy, ['jade', 'ade'], [6182999], 15, 2, 0.16, 0.06, 50, MSX1, MSY1, MSX2, MSY2) then
  465. begin
  466. writeln('yes2');
  467. clickmouse2(mouse_right);
  468. waitoption('ank', 1000);
  469. waithumanclick3;
  470. if pinscreen then
  471. begin
  472. InPin(bankpin);
  473. waithumanclick;
  474. end;
  475. bankthings;
  476. end;
  477.  
  478.  
  479.  
  480.  
  481. if bankscreen then
  482. bankthings;
  483.  
  484.  
  485. end;
  486. end;
  487.  
  488.  
  489.  
  490. procedure mainloop;
  491. begin
  492. if not loggedin then exit;
  493.  
  494. findnormalrandoms;
  495.  
  496. if pinscreen then
  497. begin
  498. InPin(bankpin);
  499. end;
  500.  
  501. if (not(ExistsItem(28))) then
  502. getfood;
  503.  
  504. if (ExistsItem(28)) then
  505. bankstuff;
  506.  
  507.  
  508. end;
  509.  
  510. begin
  511. playerSetup;
  512. setupsrl;
  513. SetupReflection;
  514. BankCord := [point(2843, 3542)];
  515. shopcord := [point(2838, 3549)];
  516. addonterminate('progressreport');
  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.
  526.  
  527. //[point(2843, 3542)]; bank cord
  528. //[point(2843, 3542)]; shop cord.
  529. //R_WalkPath(BankCord);
Advertisement
Add Comment
Please, Sign In to add comment