Janilabo

Untitled

Aug 2nd, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 9.57 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, c_tm, 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. function HitBarExists: Boolean;
  94. var
  95.   TPA: TPointArray;
  96. begin
  97.   if FindColors(TPA, 65280, 195, 201, 234, 202) then
  98.     Result := (Length(TPA) >= 4);
  99.   SetLength(TPA, 0);
  100. end;
  101.  
  102. procedure Target;
  103. var
  104.   cur_HP: Integer;
  105. begin
  106.   cur_HP := GetHP;
  107.   if (cur_HP <= UntargetHP) then
  108.   begin                  
  109.     KeyDown(17);
  110.     Wait(20);
  111.     repeat  
  112.       if not HitBarExists then
  113.         if ((GetSystemTime - c_tm) >= 900) then
  114.         begin
  115.           ClickMouse(214, 236, True);
  116.           Wait(20);
  117.           MoveMouse(615, 553);
  118.           Wait(50);
  119.           c_tm := GetSystemTime;
  120.         end;
  121.       if IsFKeyDown(12) then
  122.       begin                  
  123.         KeyUp(17);
  124.         TerminateScript;      
  125.       end;
  126.       Wait(1);
  127.     until not TargetSet or HitBarExists;
  128.     KeyUp(17);
  129.     SitDown;
  130.   end;
  131.   if not TargetSet then
  132.     if (cur_HP >= TargetHP) then
  133.       if ((GetSystemTime - targMark) >= 700) then
  134.       begin    
  135.         KeyDown(16);
  136.         Wait(25);
  137.         ClickMouse(MobX, MobY, True);
  138.         Wait(50);
  139.         MoveMouse(615, 553);
  140.         Wait(25);
  141.         KeyUp(16);
  142.         Wait(15);
  143.         SitDown;
  144.       end;  
  145. end;
  146.  
  147. procedure PDWait(Time: Integer);
  148. var
  149.   Mark: Integer;
  150. begin
  151.   TimeMark(Mark);
  152.   repeat              
  153.     Target;
  154.     if IsFKeyDown(12) then
  155.       TerminateScript;
  156.     if(PlayerDetected)then
  157.     begin
  158.       PlayerIsDetected := True;
  159.       Break;
  160.     end;
  161.     Target;
  162.     Wait(1);
  163.   until (TimeFromTimeMark(Mark) >= Time);
  164. end;
  165.  
  166. procedure TakeABreak;
  167. var
  168.   m: Integer;
  169. begin    
  170.   if ((GetSystemTime - sayMark) <= 300000) then
  171.     Exit;
  172.   PlaySound(ScriptPath + 'siren.wav');
  173.   alarmMark := GetSystemTime;
  174.   KeyDown(17);
  175.   Wait(20);
  176.   repeat
  177.     if not HitBarExists then
  178.       if ((GetSystemTime - c_tm) >= 900) then
  179.       begin
  180.         ClickMouse(214, 236, True);
  181.         Wait(20);
  182.         MoveMouse(615, 553);
  183.         Wait(50);
  184.         c_tm := GetSystemTime;
  185.       end;
  186.     if IsFKeyDown(12) then
  187.       TerminateScript;
  188.     Wait(1);
  189.   until not TargetSet or HitBarExists;
  190.   KeyUp(17);
  191.   SitDown;
  192.   m := GetSystemTime;          
  193.   repeat
  194.     if IsFKeyDown(12) then
  195.       TerminateScript;
  196.   until ((GetSystemTime - m) >= 7000);
  197.   SendKeys(words[Random(wordCount)] + Chr(13));
  198.   sayMark := GetSystemTime;
  199.   repeat
  200.     Wait(1);
  201.     if IsFKeyDown(12) then
  202.       TerminateScript;
  203.     if PlayerDetected then
  204.       if ((GetSystemTime - alarmMark) >= 3000) then
  205.       begin
  206.         PlaySound(ScriptPath + 'siren.wav');
  207.         alarmMark := GetSystemTime;
  208.       end;
  209.   until ((GetSystemTime - sayMark) >= 20000);
  210. end;      
  211.  
  212. procedure Warning;
  213. begin
  214.   TakeABreak;
  215.   if ((GetSystemTime - alarmMark) >= 3000) then
  216.     begin
  217.       PlaySound(ScriptPath + 'siren.wav');
  218.       alarmMark := GetSystemTime;
  219.     end;
  220. end;  
  221.  
  222. procedure SetupIT;
  223. begin
  224.   MyChars := LoadChars2(ScriptPath + 'SWFont\');
  225. end;
  226.  
  227. procedure UnSetupIT;
  228. begin
  229.   FreeChars2(MyChars);
  230. end;
  231.  
  232. procedure FishingSetup;
  233. begin
  234.   case NetInInventoryBox of
  235.     1: begin
  236.          EmptyColor1 := 5395018;
  237.          EmptyColor2 := 3750193;
  238.          FNetX := 490;
  239.          FNetY := 257;
  240.          Fish1X := 526;
  241.          Fish1Y := 256;
  242.          Fish2X := 567;
  243.          Fish2Y := 257;
  244.        end;
  245.     2: begin
  246.          EmptyColor1 := 4541513;
  247.          EmptyColor2 := 4344394;
  248.          FNetX := 525;
  249.          FNetY := 380;
  250.          Fish1X := 495;
  251.          Fish1Y := 385;
  252.          Fish2X := 565;
  253.          Fish2Y := 385;
  254.        end;
  255.     3: begin
  256.          EmptyColor1 := 4541513;
  257.          EmptyColor2 := 5397082;
  258.          FNetX := 562;
  259.          FNetY := 380;
  260.          Fish1X := 495;
  261.          Fish1Y := 385;
  262.          Fish2X := 530;
  263.          Fish2Y := 385;
  264.        end;
  265.   else
  266.     begin
  267.       WriteLn('Unknown inventory box... Terminating.');
  268.       TerminateScript;
  269.     end;
  270.   end;
  271. end;
  272.  
  273. procedure FiolingSetup;
  274. begin
  275.   case LowerCase(FiolingFKey) of
  276.     'f1': AFKey:= 112;
  277.     'f2': AFKey:= 113;
  278.     'f3': AFKey:= 114;
  279.     'f4': AFKey:= 115;
  280.     'f5': AFKey:= 116;
  281.     'f6': AFKey:= 117;
  282.     'f7': AFKey:= 118;
  283.     'f8': AFKey:= 119;
  284.   else
  285.     begin
  286.       WriteLn('Unknown alide fioling FKey... Terminating.');
  287.       TerminateScript;
  288.     end
  289.   end
  290. end;
  291.  
  292. function CaughtFish:  Boolean;
  293. begin
  294.   if(not(GetColor(526, 262) <> 10865889  ))or
  295.     (not(GetColor(564, 263) <> 6524065 ))or
  296.     (not(GetColor(530, 263) <> 7049634 ))or
  297.       (not(GetColor(525, 263) <> 4348256 ))or
  298.     (not(GetColor(526, 263) <> 3952727 ))or
  299.    (not(GetColor(561, 261) <> 11916518 ))then
  300.     Result:= True
  301.   else
  302.     Result:= False;
  303. end;
  304.  
  305. procedure EatFish;
  306. begin
  307.   if IsFKeyDown(12) then
  308.     TerminateScript;
  309.   Target;
  310.   MoveMouse(Fish1X - 5 + Random(15), Fish1Y - 5 + Random(15));
  311.   GetMousePos(efX, efY);
  312.   ClickMouse(efX, efY, False);
  313.   MoveMouse(Fish2X - 5 + Random(15), Fish2Y - 5 + Random(15));
  314.   GetMousePos(efX, efY);
  315.   ClickMouse(efX, efY, False);
  316.   PDWait(50);
  317.   if PlayerIsDetected then
  318.     Warning;
  319. end;
  320.  
  321. procedure Fish;
  322. var
  323.   fnX, fnY, fX, fY, rXf, rYf: Integer;
  324. begin
  325.   Target;          
  326.   PDWait(1);
  327.   if PlayerIsDetected then
  328.     Warning;
  329.   Target;
  330.   rXf:= FishingSpotXE - FishingSpotXS;
  331.   rYf:= FishingSpotYE - FishingSpotYS;
  332.   PDWait(1);
  333.   if PlayerIsDetected then
  334.     Warning;
  335.   MoveMouse(FNetX + Random(15), FNetY + Random(15));
  336.   GetMousePos(fnX, fnY);
  337.   ClickMouse(fnX, fnY, False);
  338.   PDWait(30);
  339.   if PlayerIsDetected then
  340.     Warning;
  341.   MoveMouse(FishingSpotXS + Random(rXf), FishingSpotYS + Random(rYf));
  342.   GetMousePos(fX, fY);
  343.   ClickMouse(fX, fY, True);
  344.   PDWait(90);
  345.   if PlayerIsDetected then
  346.     Warning;
  347. end;
  348.  
  349. procedure AlideFioleAndFish;
  350. begin
  351.   while (GetMp >= 20) do
  352.   begin
  353.     PDWait(8);
  354.     if PlayerIsDetected then
  355.       Warning;
  356.     if ((GetSystemTime - afMark) >= 2000) then
  357.     begin
  358.       KeyDown(AFKey);
  359.       Wait(8);
  360.       KeyUp(AFKey);
  361.       afMark := GetSystemTime;
  362.     end;
  363.     PDWait(15);
  364.     if PlayerIsDetected then
  365.       Break;
  366.     TimeMark(MPMark);
  367.     repeat
  368.       PDWait(15);
  369.       if PlayerIsDetected then
  370.         Warning;
  371.       Fish;
  372.       PDWait(15);
  373.       if PlayerIsDetected then
  374.         Warning;
  375.       if (CaughtFish) then
  376.         EatFish;
  377.       PDWait(150 + Random(15));
  378.       if PlayerIsDetected then
  379.         Warning;
  380.     until (TimeFromTimeMark(MPMark) >= 2000);
  381.     PDWait(40);
  382.   end;
  383.   Target;
  384.   if PlayerIsDetected then
  385.     Warning;
  386.   Fish;
  387.   if CaughtFish then
  388.     EatFish;
  389.   PDWait(25 + Random(15));
  390.   if PlayerIsDetected then
  391.     Warning;
  392. end;
  393.  
  394. procedure ScriptTerminate;
  395. begin
  396.   PlaySound(ScriptPath + 'empty.wav');
  397. end;
  398.  
  399. begin  
  400.   words := ['ey', 'eyyyy', 'sup', 'yoooo', 'hia', '=)', 'ello', 'hiya', '=p', 'MeOw',
  401.             'yo', 'allo!', 'hey.', 'oi', 'hi', 'hello', '=D'];
  402.   wordCount := Length(words);
  403.   FishingSetup;
  404.   ActivateClient;
  405.   Wait(100);
  406.   if(AlideFioling)then
  407.     FiolingSetup;
  408.   SetupIT;
  409.   repeat
  410.     Target;
  411.     PDWait(1);
  412.     if PlayerIsDetected then
  413.       Warning;
  414.     if AlideFioling then
  415.       AlideFioleAndFish
  416.     else
  417.     begin
  418.       Target;
  419.       Fish;
  420.       if CaughtFish then
  421.         EatFish;
  422.     end;
  423.     Target;              
  424.   until IsFKeyDown(12);
  425.   UnSetupIT;
  426. end.
Advertisement
Add Comment
Please, Sign In to add comment