Janilabo

Janilabo | MSSL - Fatigue.scar

Aug 10th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 11.30 KB | None | 0 0
  1. function RSCE_GetF2Fatigue(var fatiguePercent: Integer): Boolean;
  2. begin
  3.   fatiguePercent := StrToIntDef(Between('Fatigue: ', '%', GetTextAtEx(6, 160, 0, MSSL_MM.st[RSCE_MMS].font[RSCE_MainFont].obj, False, False, 0, 0, -1, 13, True, tr_AllChars)), -1);
  4.   Result := InRange(fatiguePercent, 0, 100);
  5. end;
  6.  
  7. function RSCE_GetFatigue(var fatiguePercent: Integer): Boolean;
  8. var
  9.   tm, tm2: Integer;
  10.   questTab: Boolean;
  11.   pt: TPoint;
  12. begin
  13.   if RSCE_GetF2Fatigue(fatiguePercent) then
  14.     Exit;
  15.   if not RSCE_MouseInsideApplet then
  16.     pt := Point(13, 20)
  17.   else
  18.     GetMousePos(pt.X, pt.Y);
  19.   if RSCE_OpenGameTab(RSCE_GAMETAB_STATS) then
  20.   begin
  21.     tm := GetSystemTime;
  22.     questTab := (CountColor(11894627, 499, 63, 506, 68) >= 17);
  23.     while (CountColor(11894627, 499, 63, 506, 68) >= 17) do
  24.     begin
  25.       if ((GetSystemTime - tm) >= 5000) then
  26.         Exit;
  27.       if ((GetSystemTime - tm2) > 333) then
  28.       begin
  29.         RSCE_Click(319, 42, 84, 11, True);
  30.         tm2 := GetSystemTime;  
  31.       end;
  32.     end;  
  33.     fatiguePercent := StrToIntDef(GetNumbers(GetTextAtEx(365, 192, 0, MSSL_MM.st[RSCE_MMS].font[RSCE_MainFont].obj, False, False, 0, 0, 65535, 3, True, tr_AllChars)), -1);
  34.     Result := fatiguePercent > -1;
  35.     if questTab then
  36.       RSCE_Click(419, 42, 84, 11, True);  
  37.     RSCE_Mouse(pt.X, pt.Y, 0, 0);
  38.   end else
  39.     RSCE_Mouse(pt.X, pt.Y, 0, 0);
  40. end;
  41.  
  42. function RSCE_TooTired: Boolean;
  43. var
  44.   xArr, yArr: TIntArray;
  45.   tmp, yaTPA: TPointArray;
  46. begin          
  47.   if (FindColorEx(tmp, 65280, 7, 183, 48, 315) or
  48.       FindColorEx(tmp, 16777215, 7, 183, 48, 315)) then
  49.     if (High(tmp) > 150) then
  50.     begin  
  51.       xArr := [7, 12, 13, 7, 8, 11, 12, 7, 8, 11, 12, 15, 16, 17, 18, 21, 22, 25, 26, 32, 33, 34, 35, 38, 39, 40, 41, 44, 45, 46, 47, 8, 9, 10, 11, 14, 15, 18, 19, 21, 22, 25, 26, 31, 35, 36, 38, 39, 43, 44, 47, 48, 9, 10, 14, 15, 18, 19, 21, 22, 25, 26, 33, 34, 35, 36, 38, 39, 43, 44, 47, 48, 9, 10, 14, 15, 18, 19, 21, 22, 25, 26, 32, 33, 35, 36, 38, 39, 43, 44, 45, 46, 47, 48, 9, 10, 14, 15, 18, 19, 21, 22, 25, 26, 31, 32, 35, 36, 38, 39, 43, 44, 9, 10, 14, 15, 18, 19, 21, 22, 24, 25, 26, 31, 32, 35, 36, 38, 39, 43, 44, 47, 48, 9, 10, 15, 16, 17, 18, 22, 23, 25, 26, 32, 33, 34, 35, 36, 38, 39, 44, 45, 46, 47];
  52.       yArr := [307, 307, 307, 308, 308, 308, 308, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315];
  53.       if MSSL_TPAFromXYArrays(yaTPA, xArr, yArr) then
  54.       begin                          
  55.         SetLength(yArr, 0);
  56.         yArr := [0, -12, -24, -36, -48, -60, -72, -84, -96, -108, -120];
  57.         Result := MSSL_TPAInTPAByYOffsets(yaTPA, tmp, yArr);    
  58.       end;                                                                      
  59.       SetLength(yaTPA, 0);
  60.       SetLength(xArr, 0);
  61.       SetLength(yArr, 0);
  62.     end;
  63.   SetLength(tmp, 0);
  64. end;
  65.  
  66. function RSCE_Sleeping: Boolean;
  67. begin
  68.   Result := (CountColor(65535, 160, 33, 349, 54) = 1215) and
  69.             (CountColor(0, 160, 33, 349, 54) = 2965);
  70. end;
  71.  
  72. function RSCE_GetSleepingWord(var word: string): Boolean;
  73. var
  74.   tmp: TIntArray;
  75.   str, fs: string;
  76.   bmp: TSCARBitmap;
  77.   h, i, f, tm, whiteCount: Integer;  
  78. begin
  79.   word := '';
  80.   tmp := GetColors(TPAFromBox(Box(129, 230, 383, 269)));
  81.   TIAUnique(tmp);
  82.   h := High(tmp);
  83.   if (h > 0) then
  84.   begin
  85.     for i := 0 to h do
  86.       if ((tmp[i] <> 0) and (tmp[i] <> 15527148)) then
  87.       begin
  88.         SetLength(tmp, 0);
  89.         Exit;
  90.       end;
  91.     SetLength(tmp, 0);
  92.     whiteCount := CountColor(15527148, 129, 230, 383, 269);  
  93.     if (whiteCount > 300) then  
  94.     begin
  95.       fs := (RSCE_LEOSLEEP_PATH + 'slword.txt');
  96.       if FileExists(fs) then
  97.         if not DeleteFile(fs) then
  98.           Exit;
  99.       if FileExists(RSCE_LEOSLEEP_PATH + 'temp.bmp') then
  100.         if not DeleteFile(RSCE_LEOSLEEP_PATH + 'temp.bmp') then
  101.           Exit;
  102.       bmp := GetClient.CaptureEx(129, 230, 383, 269);
  103.       bmp.SaveToBMP(RSCE_LEOSLEEP_PATH + 'hc.bmp');
  104.       bmp.Free;
  105.       Wait(100);    
  106.       tm := GetSystemTime;  
  107.       repeat
  108.         if FileExists(fs) then
  109.         try
  110.           f := OpenFile(fs, False);
  111.           if ReadFileString(f, str, FileSize(f)) then
  112.           begin                    
  113.             word := GetLetters(str);
  114.             Result := (word <> '');            
  115.           end;
  116.           CloseFile(f);
  117.         except        
  118.           CloseFile(f);
  119.           Exit;
  120.         end;
  121.         Wait(10);
  122.       until (Result or ((GetSystemTime - tm) > 10000));
  123.     end;
  124.   end else
  125.     SetLength(tmp, 0);  
  126. end;
  127.  
  128. function RSCE_GetDifferentSleepingWord: Boolean;
  129. var
  130.   p, p2, tm, tm2, tm3: Integer;
  131.   tmp, tmp2: TIntArray;
  132.   pts, pts2: TPointArray;
  133. begin
  134.   tm := GetSystemTime;
  135.   repeat    
  136.     if not RSCE_Sleeping then
  137.       Exit;
  138.     tmp := GetColors(TPAFromBox(Box(129, 230, 383, 269)));
  139.     p := Length(tmp);
  140.     if p > 0 then
  141.     begin
  142.       TIAUnique(tmp);
  143.       if High(tmp) > 0 then    
  144.         if MSSL_TIABuiltWith(tmp, [0, 15527148]) then
  145.           if FindColorEx(pts, 15527148, 129, 230, 383, 269) then
  146.             if GetTextAtEx(168, 269, 0, MSSL_MM.st[RSCE_MMS].font[RSCE_MainFont].obj, False, False, 0, 0, 65535, 10, True, tr_AllChars) = 'click here' then
  147.             begin
  148.               RSCE_Click(171, 298, 51, 6, True);
  149.               tm2 := GetSystemTime;
  150.               repeat  
  151.                 if ((GetSystemTime - tm2) >= 10000) then
  152.                   Break;
  153.                 if ((GetSystemTime - tm3) > 250) then
  154.                 begin  
  155.                   tmp2 := GetColors(TPAFromBox(Box(129, 230, 383, 269)));
  156.                   p2 := Length(tmp2);
  157.                   if (p2 > 0) then
  158.                   begin
  159.                     TIAUnique(tmp2);
  160.                     if (High(tmp2) > 0) then
  161.                       if MSSL_TIABuiltWith(tmp, [0, 15527148]) then
  162.                         if FindColorEx(pts2, 15527148, 129, 230, 383, 269) then
  163.                           Result := ((p <> p2) or not MSSL_TPASame(pts, pts2));
  164.                   end;
  165.                   SetLength(pts2, 0);                    
  166.                   SetLength(tmp2, 0);
  167.                   tm3 := GetSystemTime;
  168.                 end;
  169.               until (Result or ((GetSystemTime - tm) >= 180000));
  170.             end;                        
  171.     end;          
  172.     SetLength(pts, 0);                                                  
  173.     SetLength(tmp, 0);
  174.   until (Result or ((GetSystemTime - tm) >= 180000));      
  175.   SetLength(tmp, 0);          
  176. end;
  177.  
  178. function RSCE_Sleep(word: string): Boolean;
  179. var
  180.   p, p2, tm, tm2: Integer;
  181.   tmp, tmp2: TIntArray;
  182.   pts, pts2: TPointArray;
  183.   incorrect: Boolean;
  184. begin
  185.   if (not RSCE_Sleeping or (word = '')) then
  186.     Exit;  
  187.   tm := GetSystemTime;
  188.   tmp := GetColors(TPAFromBox(Box(129, 230, 383, 269)));
  189.   p := Length(tmp);
  190.   if (p > 0) then
  191.   begin  
  192.     TIAUnique(tmp);
  193.     if (High(tmp) > 0) then    
  194.       if MSSL_TIABuiltWith(tmp, [0, 15527148]) then
  195.         if FindColorEx(pts, 15527148, 129, 230, 383, 269) then
  196.         begin
  197.           TypeText(word + #13);
  198.           tm2 := GetSystemTime;
  199.           repeat  
  200.             if ((GetSystemTime - tm2) > 250) then
  201.             begin  
  202.               tmp2 := GetColors(TPAFromBox(Box(129, 230, 383, 269)));
  203.               p2 := Length(tmp2);
  204.               if (p2 > 0) then
  205.               begin
  206.                 TIAUnique(tmp2);
  207.                 if (High(tmp2) > 0) then
  208.                   if MSSL_TIABuiltWith(tmp, [0, 15527148]) then
  209.                     if FindColorEx(pts2, 15527148, 129, 230, 383, 269) then
  210.                       incorrect := ((p <> p2) or not MSSL_TPASame(pts, pts2));
  211.               end;
  212.               SetLength(pts2, 0);                    
  213.               SetLength(tmp2, 0);
  214.               tm2 := GetSystemTime;
  215.             end;
  216.             if not incorrect then
  217.               Result := RSCE_LoggedIn and not RSCE_Sleeping;
  218.           until (Result or incorrect or ((GetSystemTime - tm) >= 60000));
  219.         end;                        
  220.   end;          
  221.   SetLength(pts, 0);                                                  
  222.   SetLength(tmp, 0);  
  223. end;
  224.  
  225. function RSCE_UseSleepingBag: Boolean;
  226. var
  227.   TPA: TPointArray;
  228.   ATPA: T2DPointArray;
  229.   tm, tm2, l: Integer;
  230.   pt: TPoint;
  231. begin
  232.   if RSCE_OpenGameTab(RSCE_GAMETAB_INVENTORY) then
  233.     if FindColorEx(TPA, 3036283, RSCE_Inventory.slot.grid[0].bx.X1, RSCE_Inventory.slot.grid[0].bx.Y1, RSCE_Inventory.slot.grid[(RSCE_INVENTORY_SLOT_COUNT - 1)].bx.X2, RSCE_Inventory.slot.grid[(RSCE_INVENTORY_SLOT_COUNT - 1)].bx.Y2) then
  234.     begin
  235.       ATPA := SplitTPA(TPA, 1);
  236.       SetLength(TPA, 0);      
  237.       SortATPABySize(ATPA);
  238.       MSSL_ATPAExtractSize(ATPA, 131);
  239.       l := Length(ATPA);            
  240.       if (l > 0) then
  241.       begin
  242.         MSSL_ATPAExtractDimension(ATPA, 17, 17);
  243.         l := Length(ATPA);
  244.         if (l = 0) then
  245.           Exit;    
  246.         TPA := CopyTPA(ATPA[(l - 1)]);
  247.         SetLength(ATPA, 0);
  248.         pt := TPAMiddle(TPA);
  249.         tm := GetSystemTime;
  250.         repeat
  251.           Result := RSCE_Sleeping;
  252.           if not Result then
  253.             if ((GetSystemTime - tm2) >= 5000) then
  254.               if RSCE_OpenGameTab(RSCE_GAMETAB_INVENTORY) then  
  255.                 if RSCE_Click(pt.X, pt.Y, RandomRange(-9, 9), RandomRange(-5, 5), True) then
  256.                   tm2 := GetSystemTime;
  257.         until (Result or ((GetSystemTime - tm) >= 60000));
  258.       end;        
  259.     end;  
  260. end;
  261.  
  262. function RSCE_ReadyToSendWord: Boolean;
  263. var
  264.   w, h: Integer;
  265.   TPA: TPointArray;
  266. begin
  267.   if FindColorEx(TPA, 65535, 300, 72, 320, 90) then
  268.   begin
  269.     TPADimensions(TPA, w, h);                            
  270.     Result := ((Length(TPA) = 147) and (w = 21) and (h = 18));
  271.     SetLength(TPA, 0);
  272.   end;
  273. end;
  274.  
  275. function RSCE_Sleep2: Boolean;
  276. var
  277.   s: string;
  278.   tm, tm2: Integer;
  279. begin
  280.   if not RSCE_Sleeping then
  281.     Exit;
  282.   tm := GetSystemTime;
  283.   repeat      
  284.     if RSCE_GetSleepingWord(s) then
  285.       if ((s <> '') and (s <> 'unknown')) then
  286.       begin
  287.         tm2 := GetSystemTime;
  288.         while not RSCE_ReadyToSendWord do
  289.         begin
  290.           Wait(100);
  291.           if ((GetSystemTime - tm2) >= 60000) then
  292.             Break;
  293.         end;
  294.         if RSCE_ReadyToSendWord then
  295.           Result := RSCE_Sleep(s);
  296.       end else
  297.         RSCE_GetDifferentSleepingWord;
  298.     Wait(10);
  299.   until (Result or ((GetSystemTime - tm) >= 300000));  
  300. end;
  301.  
  302. function RSCE_Slept: Boolean;
  303. var
  304.   fp: Integer;
  305. begin        
  306.   RSCE_GetF2Fatigue(fp);
  307.   if (not (fp = 100) and not RSCE_TooTired and not RSCE_Sleeping) then
  308.     Exit;
  309.   if not RSCE_Sleeping then
  310.     if not RSCE_UseSleepingBag then
  311.       Exit;
  312.   if RSCE_Sleeping then
  313.     Result := RSCE_Sleep2;  
  314. end;
Advertisement
Add Comment
Please, Sign In to add comment