daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Sep 24th, 2016 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program EvasivConstructionT;
  2.  
  3. {$DEFINE SMART}
  4. {$i AeroLib/AeroLib.Simba}
  5. {$i Reflection/Reflection.simba}
  6.  
  7. var
  8.   reflectPlayer: TReflectLocalPlayer;
  9.   phase,currentId,currentNoteId,currentState,currentFurnitureSId,currentFurnitureOId,nrNeeded,x,y:Integer;
  10.   phials: TReflectNpc;
  11.   currentString:String;
  12.   plankI,planknoteI,oakI,oaknoteI,currentPlankI,currentPlankNoteI: TReflectInvItem;
  13.   portalHO,portalOO,chairSpace,chair,currentFurnitureS,currentFurnitureO,bookCaseSpace,bookCase,larder,larderSpace: TReflectObject;
  14.   coords:TPoint;
  15.   tia:TReflectInvItemArray;
  16.  
  17. const
  18.   plankId = 960;
  19.   plankNoteId = 961;
  20.   oak = 8778;
  21.   oakNote = 8779;
  22.   portalH = 4525;
  23.   portalO = 15478;
  24.   chair1 = 4517;
  25.   chair2 = 4516;
  26.   bookCaseId = 4521;
  27.  
  28. procedure updateIds();
  29. begin
  30.   if(phase=1)then
  31.     begin
  32.       currentId:=plankId;
  33.       currentNoteId:=plankNoteId;
  34.       currentString:='Plank';
  35.       currentFurnitureS:=chairSpace;
  36.       currentFurnitureO:=chair;
  37.       nrNeeded:=2;
  38.       currentFurnitureSId:=4517;
  39.       currentFurnitureOId:=6752;
  40.       coords:=Point(294, 46);
  41.     end;
  42.   if(phase=2 or phase=3) then
  43.     begin
  44.       currentId:=oak;
  45.       currentNoteId:=oakNote;
  46.       if(phase=2)then
  47.         begin
  48.           coords:=Point(50, 114);
  49.           currentFurnitureS:=bookCaseSpace;
  50.           currentFurnitureO:=bookCase;
  51.           nrNeeded:=4;
  52.         end else if(phase=3) then
  53.           begin
  54.             currentFurnitureS:=larderSpace;
  55.             currentFurnitureO:=larder;
  56.             nrNeeded:=8;
  57.           end;
  58.       currentId:=oak;
  59.       currentNoteId:=oakNote;
  60.       currentString:='Oak Plank';
  61.     end;
  62. end;
  63.  
  64. function DistFromPlayer(tile : TTile) : single;
  65. var
  66.   playerTile: TTile;
  67. begin
  68.   playerTile := reflectPlayer.GetTile;
  69.   exit (Sqrt(power(playerTile.X - tile.X, 2) + power(playerTile.Y - tile.Y, 2)));
  70. end;
  71.  
  72. procedure walk(tile : TTile; acc : integer);
  73.  
  74. begin
  75.   repeat
  76.     reflectPlayer.BlindWalkMM(tile,acc);
  77.     sleep(1000+random(100));
  78.   until(DistFromPlayer(tile)<=acc);
  79. end;
  80.  
  81. procedure removeFurniture(id:integer);
  82. var
  83.   furniture:TReflectObject;
  84. begin
  85.   repeat
  86.     WriteLn('Removing A Piece of Furniture!');
  87.     sleep(1000+random(100));
  88.     furniture.Find(objGame,id,8);
  89.     repeat
  90.       HumanMMouse(furniture.GetMSPoint,3,3);
  91.       sleep(100+random(39));
  92.     until(not(Reflect.Text.IsUpText('Walk here')));
  93.     fastClick(Mouse_Right);
  94.     while(not(chooseOption('Remove'))) do sleep(100+random(22));
  95.     while(not(Reflect.Chat.NpcChooseOption('Yes'))) do sleep(100+random(33));
  96.     Reflect.Chat.NpcChooseOption('Yes');
  97.     sleep(1000+random(121));
  98.   until(not(furniture.Find(objGame,id,8)));
  99. end;
  100.  
  101. procedure getPlanks();
  102. begin
  103.   phials.Find('Phials');
  104.   walk(phials.GetTile,1);
  105.   gameTab(TAB_INV);
  106.   currentPlankNoteI.Find(currentNoteId);
  107.   repeat
  108.     WriteLn(currentNoteId);
  109.     HumanMMouse(currentPlankNoteI.GetMSPoint,3,3);
  110.     sleep(300+random(100));
  111.   until(Reflect.Text.IsUpText(currentString));
  112.     fastClick(Mouse_Left);
  113.   repeat
  114.     humanMMouse(phials.GetMSPoint,2,2);
  115.     sleep(100+random(10));
  116.   until(Reflect.Text.IsUpText('Phials'));
  117.   Reflect.Mouse.Click(Mouse_Left);
  118.   While(Reflect.Chat.NpcChooseOption('Exchange All')=false) do sleep(100);
  119.   Reflect.Chat.NpcChooseOption('110');
  120.   exit;
  121. end;
  122.  
  123. procedure toPortal();
  124. begin
  125.   if(not(portalOO.Find(objGame,portalO,30))) then
  126.     begin
  127.       WriteLn('Couldnt find outside portal');
  128.       terminatescript;
  129.     end;
  130.   walk(portalOO.GetTile,2);
  131.   repeat
  132.     HumanMMouse(portalOO.GetMSPoint,3,3);
  133.     sleep(300+random(100));
  134.   until(Reflect.Text.IsUpText('Portal'));
  135.   fastClick(Mouse_left);
  136.   while(not(Reflect.Chat.NpcChooseOption('(building mode)'))) do sleep(100);
  137.   Reflect.Chat.NpcChooseOption('(building mode)');
  138.   while(not(portalHO.Find(objGame,portalH,10))) do sleep(100);
  139. end;
  140.  
  141. procedure switchChair();
  142. begin
  143.   if(currentFurnitureSid=4517) then
  144.     begin
  145.       currentFurnitureSId:= 4516;
  146.     end else if(currentFurnitureSid=4516) then
  147.       currentFurnitureSId:=4517;
  148. end;
  149. procedure work();
  150. var
  151.   tile:TTile;
  152.   tempPlank:integer;
  153.  
  154. begin
  155.  
  156.     tile:=portalHO.GetTile;
  157.     if(DistFromPlayer(Point(tile.X+1,tile.Y+9))>0)then
  158.       walk(Point(tile.X+1,tile.Y+9),0);
  159.     currentFurnitureS.Find(objGame,currentFurnitureSId,20);
  160.   repeat
  161.     tia.Get(currentId);
  162.     if(length(tia)<=nrNeeded)then
  163.       exit;
  164.     if(phase=1) then
  165.       begin
  166.         currentFurnitureS.Find(objGame,chair1,10);
  167.         repeat
  168.           sleep(100+random(10));
  169.           while(reflectPlayer.IsMoving) do sleep(100);
  170.           repeat
  171.             HumanMMouse(currentFurnitureS.GetMSPoint,2,3);
  172.             sleep(300+random(30));
  173.             while(reflectPlayer.IsMoving) do sleep(100);
  174.             fastClick(Mouse_Right);
  175.             while(reflectPlayer.IsMoving) do sleep(100);
  176.           until(chooseOption('Build Chair'));
  177.           chooseOption('Build Chair');
  178.           Wait(RandomRange(1200, 1500));
  179.           GaussMouseBox(49, 69, 58, 90, 1);
  180.           if(Reflect.Text.IsUpText('Build'))then
  181.             begin
  182.               tempPlank:=Reflect.Inv.Count;
  183.               WriteLn('tempplank',tempPlank);
  184.               fastClick(Mouse_Left);
  185.               repeat
  186.                 sleep(100);
  187.               until(Reflect.Inv.Count<>tempPlank);
  188.               removeFurniture(currentFurnitureOId);
  189.             end;
  190.         until (currentPlankI.GetQuantity<nrNeeded);
  191.         WriteLn('SAIU DO REPEAT');
  192.       end else
  193.         begin
  194.           repeat
  195.  
  196.           until (not(currentFurnitureS.Find(objGame,currentFurnitureSId,10)));
  197.         end;
  198.       tia.Get(currentId);
  199.   until(length(tia));
  200. end;
  201.  
  202. procedure workDone();
  203.  
  204. begin
  205.   walk(portalHO.GetTile,1);
  206.   portalHO.Find(objGame,portalH,5);
  207.   repeat
  208.     HumanMMouse(portalHO.GetMSPoint,3,3);
  209.     sleep(300+random(100));
  210.   until(Reflect.Text.IsUpText('Portal'));
  211.   fastClick(Mouse_left);
  212.   while(not(portalOO.Find(objGame,portalO,5))) do sleep(100);
  213.  
  214. end;
  215.  
  216. function getState():integer;
  217. begin
  218.   updateIds;
  219.   if(not(Reflect.Inv.IsFull)) and (phials.Find('Phials')) then
  220.     begin
  221.       exit(1);
  222.     end else if((Reflect.Inv.Count=28) and (phials.Find('Phials'))) then
  223.     begin
  224.       exit(2);
  225.     end else if((currentPlankI.Find(currentId)) and (portalHO.Find(objGame,portalH,30))) then
  226.     begin
  227.       exit(3);
  228.     end else if((not((currentPlankI.Find(currentId))) and (portalHO.Find(objGame,portalH,30))) or (currentPlankI.GetQuantity<nrNeeded)) then
  229.     begin
  230.       exit(4);
  231.     end;
  232.   terminatescript;
  233. end;
  234.  
  235. procedure executeState(State: Integer);
  236. begin
  237.   case (State) of
  238.     1: getPlanks();// Get more planks from phials
  239.     2: toPortal(); // Got planks, going back home
  240.     3: work();     // build
  241.     4: workDone(); // no more planks exiting portal
  242.   end;
  243.   sleep(Random(100,200));
  244. end;
  245.  
  246. begin
  247.  
  248.   initAL('C:\Javas\Java3\jre1.8.0_91\bin\javaw.exe');
  249.   Reflect.Setup;
  250.   reflectPlayer.Username := 'stijnvanloom@gmail.com';
  251.   reflectPlayer.Password := 'weedpw123';
  252.   reflectPlayer.Active := True;
  253.   Me.Member := True;
  254.   reflectPlayer.Create;
  255.   reflectPlayer.Login;
  256.   phase:=1;
  257.   repeat
  258.     //getRealMousePos(x, y);
  259.     //smartGetMousePos(OS_SMART.__TARGET, x, y);
  260.     WriteLn('portal',portalHO.GetTile);
  261.     WriteLn(reflectPlayer.GetTile);
  262.     //WriteLn('Anim ',reflectPlayer.IsAnimating);
  263.     currentState:=getState();
  264.     WriteLn('State: ',currentState);
  265.     executeState(currentState);
  266.     sleep(500);
  267.   until(false);
  268. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top