Janilabo

Untitled

Aug 1st, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 9.28 KB | None | 0 0
  1. program SWFish0r;
  2.  
  3. const
  4.   {Player Detection Thingys:}
  5.   NameColor = 62208; // Color of the name?
  6.   nXS = 194;
  7.   nYS = 203;
  8.   nXE = 238;
  9.   nYE = 220;
  10.   // NOTE: Both up there are in SECONDS! (LogBackIn's)
  11.   {-------------------------}
  12.  
  13.   MobX = 233;
  14.   MobY = 256;
  15.  
  16.   {Fishing Stoof:}
  17.   NetInInventoryBox = 1; // Is it in 1, 2 or 3? Keep other 2 empty for fishes.
  18.   FishingSpotXS = 88;
  19.   FishingSpotYS = 325;
  20.   FishingSpotXE = 303;
  21.   FishingSpotYE = 379;
  22.   AlideFioling = True; // Fishing with alide fioling or not.. False for not.
  23.   FiolingFKey = 'F1'; // The F* for alide fioles? Can be between F1-F8.
  24.   {--------------}
  25.  
  26.   UntargetHP = 80;
  27.   TargetHP = 180;
  28.  
  29. var
  30.   AFKey, EmptyColor1, efX, efY, EmptyColor2, Fish1X, Fish1Y, Fish2X, Fish2Y,
  31.    targMark, afMark, FNetX, FNetY, MPMark, MyChars, wordCount, alarmMark, sayMark: Integer;
  32.   PlayerIsDetected: Boolean;
  33.   words: TStringArray;
  34.  
  35. procedure TimeMark(var Mark: Integer);
  36. begin
  37.   Mark:= GetSystemTime;
  38. end;
  39.  
  40. function TimeFromTimeMark(var Mark: Integer): Integer;
  41. begin
  42.   Result:= GetSystemTime - Mark;
  43. end;
  44.  
  45. function FindColorInSkipBox(var x, y: Integer; TheColor: Integer; xFs, yFs, xFe, yFe, xIs, yIs, xIe, yIe: Integer): Boolean;
  46. begin
  47.   if(FindColorSpiral(x, y, TheColor, xFs, yFs, xFe, yIs - 1))or
  48.    (FindColorSpiral(x, y, TheColor, xFs, yIs, xIs - 1, yIe))or
  49.    (FindColorSpiral(x, y, TheColor, xFs + 1, yIe + 1, xFe, yFe))or
  50.    (FindColorSpiral(x, y, TheColor, xIe + 1, yIs, xFe, yIe))then
  51.     Result:= True
  52.   else
  53.     Result:= False;
  54. end;
  55.  
  56. function GetHP: Integer;
  57. begin
  58.   Result := StrToIntDef(Trim(Copy(GetTextAtEx(462, 386, 0, MyChars, False, False, 0, 0, 16316664, 8, True, tr_AllChars), 0, 8)), -1);
  59. end;
  60.  
  61. function GetMP: Integer;
  62. begin
  63.   Result := StrToIntDef(Trim(Copy(GetTextAtEx(531, 386, 0, MyChars, False, False, 0, 0, 16316664, 8, True, tr_AllChars), 0, 8)), -1);
  64. end;
  65.  
  66. function PlayerDetected: Boolean;
  67. var
  68.   x, y: Integer;
  69. begin
  70.   Result:= FindColorInSkipBox(x, y, NameColor, 3, 29, 442, 449, nXS, nYS, nXE, nYE);
  71. end;
  72.  
  73. procedure SitDown;
  74. begin
  75.   KeyDown(18);
  76.   Wait(10);
  77.   KeyDown(GetKeyCode('s'));
  78.   Wait(25 + Random(15));
  79.   KeyUp(GetKeyCode('s'));
  80.   Wait(10);
  81.   KeyUp(18);
  82. end;
  83.  
  84. function TargetSet: Boolean;
  85. var
  86.   TPA: TPointArray;
  87. begin
  88.   if FindColors(TPA, 255, 142, 147, 289, 296) then
  89.     Result := (Length(TPA) >= 50);
  90.   SetLength(TPA, 0);
  91. end;
  92.  
  93. procedure Target;
  94. var
  95.   cur_HP, c_tm, c_tm2: Integer;
  96. begin
  97.   cur_HP := GetHP;
  98.   if (cur_HP <= UntargetHP) then
  99.   begin                  
  100.     KeyDown(17);
  101.     Wait(20);
  102.     repeat
  103.       if ((GetSystemTime - c_tm) >= 800) then
  104.       begin
  105.         ClickMouse(214, 236, True);
  106.         Wait(20);
  107.         MoveMouse(615, 553);
  108.         Wait(50);
  109.         c_tm := GetSystemTime;
  110.       end;
  111.       if IsFKeyDown(12) then
  112.       begin                  
  113.         KeyUp(17);
  114.         TerminateScript;      
  115.       end;
  116.       Wait(1);
  117.     until not TargetSet;
  118.     KeyUp(17);
  119.     SitDown;
  120.   end;
  121.   if not TargetSet then
  122.     if (cur_HP >= TargetHP) then
  123.       if ((GetSystemTime - targMark) >= 700) then
  124.       begin    
  125.         KeyDown(16);
  126.         Wait(25);
  127.         ClickMouse(MobX, MobY, True);
  128.         Wait(50);
  129.         MoveMouse(615, 553);
  130.         Wait(25);
  131.         KeyUp(16);
  132.         Wait(15);
  133.         SitDown;
  134.       end;  
  135. end;
  136.  
  137. procedure PDWait(Time: Integer);
  138. var
  139.   Mark: Integer;
  140. begin
  141.   TimeMark(Mark);
  142.   repeat              
  143.     Target;
  144.     if IsFKeyDown(12) then
  145.       TerminateScript;
  146.     if(PlayerDetected)then
  147.     begin
  148.       PlayerIsDetected := True;
  149.       Break;
  150.     end;
  151.     Target;
  152.     Wait(1);
  153.   until (TimeFromTimeMark(Mark) >= Time);
  154. end;
  155.  
  156. procedure TakeABreak;
  157. var
  158.   m, c_tm: Integer;
  159. begin    
  160.   if ((GetSystemTime - sayMark) <= 300000) then
  161.     Exit;
  162.   PlaySound(ScriptPath + 'siren.wav');
  163.   alarmMark := GetSystemTime;
  164.   KeyDown(17);
  165.   Wait(20);
  166.   repeat
  167.     if ((GetSystemTime - c_tm) >= 800) then
  168.     begin
  169.       ClickMouse(214, 236, True);
  170.       Wait(20);
  171.       MoveMouse(615, 553);
  172.       Wait(50);
  173.       c_tm := GetSystemTime;
  174.     end;
  175.     if IsFKeyDown(12) then
  176.       TerminateScript;
  177.     Wait(1);
  178.   until not TargetSet;
  179.   KeyUp(17);
  180.   SitDown;
  181.   m := GetSystemTime;          
  182.   repeat
  183.     if IsFKeyDown(12) then
  184.       TerminateScript;
  185.   until ((GetSystemTime - m) >= 7000);
  186.   SendKeys(words[Random(wordCount)] + Chr(13));
  187.   sayMark := GetSystemTime;
  188.   repeat
  189.     Wait(1);
  190.     if IsFKeyDown(12) then
  191.       TerminateScript;
  192.     if PlayerDetected then
  193.       if ((GetSystemTime - alarmMark) >= 3000) then
  194.       begin
  195.         PlaySound(ScriptPath + 'siren.wav');
  196.         alarmMark := GetSystemTime;
  197.       end;
  198.   until ((GetSystemTime - sayMark) >= 20000);
  199. end;      
  200.  
  201. procedure Warning;
  202. begin
  203.   TakeABreak;
  204.   if ((GetSystemTime - alarmMark) >= 3000) then
  205.     begin
  206.       PlaySound(ScriptPath + 'siren.wav');
  207.       alarmMark := GetSystemTime;
  208.     end;
  209. end;  
  210.  
  211. procedure SetupIT;
  212. begin
  213.   MyChars := LoadChars2(ScriptPath + 'SWFont\');
  214. end;
  215.  
  216. procedure UnSetupIT;
  217. begin
  218.   FreeChars2(MyChars);
  219. end;
  220.  
  221. procedure FishingSetup;
  222. begin
  223.   case NetInInventoryBox of
  224.     1: begin
  225.          EmptyColor1 := 5395018;
  226.          EmptyColor2 := 3750193;
  227.          FNetX := 490;
  228.          FNetY := 257;
  229.          Fish1X := 526;
  230.          Fish1Y := 256;
  231.          Fish2X := 567;
  232.          Fish2Y := 257;
  233.        end;
  234.     2: begin
  235.          EmptyColor1 := 4541513;
  236.          EmptyColor2 := 4344394;
  237.          FNetX := 525;
  238.          FNetY := 380;
  239.          Fish1X := 495;
  240.          Fish1Y := 385;
  241.          Fish2X := 565;
  242.          Fish2Y := 385;
  243.        end;
  244.     3: begin
  245.          EmptyColor1 := 4541513;
  246.          EmptyColor2 := 5397082;
  247.          FNetX := 562;
  248.          FNetY := 380;
  249.          Fish1X := 495;
  250.          Fish1Y := 385;
  251.          Fish2X := 530;
  252.          Fish2Y := 385;
  253.        end;
  254.   else
  255.     begin
  256.       WriteLn('Unknown inventory box... Terminating.');
  257.       TerminateScript;
  258.     end;
  259.   end;
  260. end;
  261.  
  262. procedure FiolingSetup;
  263. begin
  264.   case LowerCase(FiolingFKey) of
  265.     'f1': AFKey:= 112;
  266.     'f2': AFKey:= 113;
  267.     'f3': AFKey:= 114;
  268.     'f4': AFKey:= 115;
  269.     'f5': AFKey:= 116;
  270.     'f6': AFKey:= 117;
  271.     'f7': AFKey:= 118;
  272.     'f8': AFKey:= 119;
  273.   else
  274.     begin
  275.       WriteLn('Unknown alide fioling FKey... Terminating.');
  276.       TerminateScript;
  277.     end
  278.   end
  279. end;
  280.  
  281. function CaughtFish:  Boolean;
  282. begin
  283.   if(not(GetColor(526, 262) <> 10865889  ))or
  284.     (not(GetColor(564, 263) <> 6524065 ))or
  285.     (not(GetColor(530, 263) <> 7049634 ))or
  286.       (not(GetColor(525, 263) <> 4348256 ))or
  287.     (not(GetColor(526, 263) <> 3952727 ))or
  288.    (not(GetColor(561, 261) <> 11916518 ))then
  289.     Result:= True
  290.   else
  291.     Result:= False;
  292. end;
  293.  
  294. procedure EatFish;
  295. begin
  296.   if IsFKeyDown(12) then
  297.     TerminateScript;
  298.   Target;
  299.   MoveMouse(Fish1X - 5 + Random(15), Fish1Y - 5 + Random(15));
  300.   GetMousePos(efX, efY);
  301.   ClickMouse(efX, efY, False);
  302.   MoveMouse(Fish2X - 5 + Random(15), Fish2Y - 5 + Random(15));
  303.   GetMousePos(efX, efY);
  304.   ClickMouse(efX, efY, False);
  305.   PDWait(50);
  306.   if PlayerIsDetected then
  307.     Warning;
  308. end;
  309.  
  310. procedure Fish;
  311. var
  312.   fnX, fnY, fX, fY, rXf, rYf: Integer;
  313. begin
  314.   Target;          
  315.   PDWait(1);
  316.   if PlayerIsDetected then
  317.     Warning;
  318.   Target;
  319.   rXf:= FishingSpotXE - FishingSpotXS;
  320.   rYf:= FishingSpotYE - FishingSpotYS;
  321.   PDWait(1);
  322.   if PlayerIsDetected then
  323.     Warning;
  324.   MoveMouse(FNetX + Random(15), FNetY + Random(15));
  325.   GetMousePos(fnX, fnY);
  326.   ClickMouse(fnX, fnY, False);
  327.   PDWait(30);
  328.   if PlayerIsDetected then
  329.     Warning;
  330.   MoveMouse(FishingSpotXS + Random(rXf), FishingSpotYS + Random(rYf));
  331.   GetMousePos(fX, fY);
  332.   ClickMouse(fX, fY, True);
  333.   PDWait(90);
  334.   if PlayerIsDetected then
  335.     Warning;
  336. end;
  337.  
  338. procedure AlideFioleAndFish;
  339. begin
  340.   while (GetMp >= 20) do
  341.   begin
  342.     PDWait(8);
  343.     if PlayerIsDetected then
  344.       Warning;
  345.     if ((GetSystemTime - afMark) >= 2000) then
  346.     begin
  347.       KeyDown(AFKey);
  348.       Wait(8);
  349.       KeyUp(AFKey);
  350.       afMark := GetSystemTime;
  351.     end;
  352.     PDWait(15);
  353.     if PlayerIsDetected then
  354.       Break;
  355.     TimeMark(MPMark);
  356.     repeat
  357.       PDWait(15);
  358.       if PlayerIsDetected then
  359.         Warning;
  360.       Fish;
  361.       PDWait(15);
  362.       if PlayerIsDetected then
  363.         Warning;
  364.       if (CaughtFish) then
  365.         EatFish;
  366.       PDWait(150 + Random(15));
  367.       if PlayerIsDetected then
  368.         Warning;
  369.     until (TimeFromTimeMark(MPMark) >= 2000);
  370.     PDWait(40);
  371.   end;
  372.   Target;
  373.   if PlayerIsDetected then
  374.     Warning;
  375.   Fish;
  376.   if CaughtFish then
  377.     EatFish;
  378.   PDWait(25 + Random(15));
  379.   if PlayerIsDetected then
  380.     Warning;
  381. end;
  382.  
  383. procedure ScriptTerminate;
  384. begin
  385.   PlaySound(ScriptPath + 'empty.wav');
  386. end;
  387.  
  388. begin  
  389.   words := ['ey', 'eyyyy', 'sup', 'yoooo', 'hia', '=)', 'ello', 'hiya', '=p', 'MeOw',
  390.             'yo', 'allo!', 'hey.', 'oi', 'hi', 'hello', '=D'];
  391.   wordCount := Length(words);
  392.   FishingSetup;
  393.   ActivateClient;
  394.   Wait(100);
  395.   if(AlideFioling)then
  396.     FiolingSetup;
  397.   SetupIT;
  398.   repeat
  399.     Target;
  400.     PDWait(1);
  401.     if PlayerIsDetected then
  402.       Warning;
  403.     if AlideFioling then
  404.       AlideFioleAndFish
  405.     else
  406.     begin
  407.       Target;
  408.       Fish;
  409.       if CaughtFish then
  410.         EatFish;
  411.     end;
  412.     Target;              
  413.   until IsFKeyDown(12);
  414.   UnSetupIT;
  415. end.
Advertisement
Add Comment
Please, Sign In to add comment