Advertisement
imk0tter

Untitled

Jul 22nd, 2011
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 3.19 KB | None | 0 0
  1. program new;
  2.   var
  3.     socket : Integer;
  4.     instanceJoinBitmap : Integer;
  5.     skirmishBitmap : Integer;
  6.     siegeOfGondamonBitmap : Integer;
  7.     createBitmap : Integer;
  8.     travelNowBitmap : Integer;
  9.     continueQuestBitmap : Integer;
  10.     endQuestBitmap : Integer;
  11.     reviveBitmap : Integer;
  12.     retreatBitmap : Integer;
  13.   procedure FindAndClickBitmap(bitmap, tolerance : Integer);
  14.   var
  15.     x, y: Integer;
  16.     ox, oy: Integer;
  17.     w, h: Integer;
  18.   begin
  19.     while (FindBitmap(bitmap, x, y) = false) or ((x = 0) and (y = 0)) do
  20.     begin
  21.       Writeln('Searching for bitmap: ' + inttostr(tolerance));
  22.       Sleep(1000);
  23.       dec(tolerance);
  24.       if tolerance < 0 then
  25.       begin
  26.         break;
  27.       end
  28.     end;
  29.     GetBitmapSize(bitmap,w,h);
  30.     if (x > 0) and (y > 0) then
  31.     begin
  32.       ActivateClient();
  33.       Wait(200);
  34.       GetMousePos(ox,oy);
  35.       x := x + (w/2);
  36.       y := y + (h/2);
  37.       Writeln('Bitmap found.. Clicking Bitmap: ' + inttostr(w) + '/' + inttostr(h) + ' (' + inttostr(x) + ', ' + inttostr(y) +')');
  38.       MoveMouse(x,y);
  39.       Wait(50);
  40.       ClickMouse(x,y,mouse_Left);
  41.       MoveMouse(ox, oy);
  42.     end
  43.   end;
  44.   procedure Death;
  45.   begin
  46.     FindAndClickBitmap(retreatBitmap,2);
  47.   end;
  48.   procedure MathiBegin;
  49.   begin
  50.     FindAndClickBitmap(continueQuestBitmap,2);
  51.     Wait(100);
  52.   end;
  53.   procedure MathiEnd;
  54.   var
  55.     x, y: Integer;
  56.   begin
  57.     FindAndClickBitmap(endQuestBitmap,5);
  58.     Wait(1000);
  59.     FindAndClickBitmap(instanceJoinBitMap,100);
  60.     Wait(1000);
  61.     FindAndClickBitmap(skirmishBitmap,2);
  62.     Wait(1000);
  63.     FindAndClickBitmap(siegeOfGondamonBitmap,2);
  64.     Wait(1000);
  65.     FindAndClickBitmap(createBitmap,2);
  66.     Wait(1000);
  67.     FindAndClickBitmap(travelNowBitmap,2);
  68.   end;
  69.   procedure HandleSockRead(socket : Integer);
  70.   var
  71.     packet : String;
  72.   begin
  73.       packet := RecvSocketStr(socket);
  74.       if packet = 'Died' then
  75.       begin
  76.         Writeln('Handeling death packet');
  77.         Death();
  78.       end;
  79.       if packet = 'MathiEnd' then
  80.       begin
  81.         Writeln('Handeling Mathi End packet');
  82.         MathiEnd();
  83.       end;
  84.       if packet = 'MathiBegin' then
  85.       begin
  86.         Writeln('Handeling Mathi Begin packet');
  87.         MathiBegin();
  88.       end;
  89.   end;
  90.   var
  91.      listenSock, mainSocket: Integer;
  92. begin
  93.     mainSocket := CreateSocket();
  94.     instanceJoinBitmap := LoadBitmap(ScriptPath + 'FINDCLICKINSTANCEJOIN.bmp');
  95.     skirmishBitmap :=  LoadBitmap(ScriptPath + 'FINDCLICKSKIRMISH.bmp');
  96.     siegeOfGondamonBitmap := LoadBitmap(ScriptPath +'FINDCLICKSIEGEOFGONDAMON.bmp');
  97.     createBitmap := LoadBitmap(ScriptPath +'FINDCLICKCREATE.bmp');
  98.     travelNowBitmap := LoadBitmap(ScriptPath + 'FINDCLICKTRAVELNOW.bmp');
  99.     continueQuestBitmap := LoadBitmap(ScriptPath + 'FINDCLICKCONTINUEQUEST.bmp');
  100.     endQuestBitmap := LoadBitmap(ScriptPath +'FINDCLICKTRAVELNOWEND.bmp');
  101.     reviveBitmap := LoadBitmap(ScriptPath + 'FINDCLICKREVIVE.bmp');
  102.     retreatBitmap := LoadBitmap(ScriptPath + 'FINDCLICKRETREAT.bmp');
  103.     SetTimeout(mainSocket,3600000);
  104.     ConnectSocket(mainSocket,'127.0.0.1','1337');
  105.     Wait(1000);
  106.     while true do
  107.     begin
  108.        HandleSockRead(mainSocket);
  109.     end;
  110. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement