Janilabo

Janilabo | RS07_DepositEverything(Ex)

Mar 30th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 4.19 KB | None | 0 0
  1. function RS07_DepositEverythingEx(exceptions: TIntArray): Boolean;
  2. {==============================================================================]  
  3.   Created: March 29th, 2013.
  4.   Updated: March 30th, 2013.
  5.   Contributors: Janilabo
  6.   Explanation: Deposits everything, except slots that are in exceptions, from inventory.
  7.                Returns true with success.  
  8.   NOTE: This function uses "Store/Deposit All" Choose Option item on each slot!
  9.         So that means, items from exceptions might get deposited aswell (if you are using Store all for same items)
  10. [==============================================================================}
  11. var
  12.   u: TIntArray;
  13.   h, i, t, m, s, w, r: Integer;
  14.   cf, b, d: Boolean;
  15. begin
  16.   Result := False;
  17.   b := RS07_BankOpen;
  18.   if (b or RS07_DepositBoxOpen) then
  19.   begin      
  20.     cf := RS07_ChooseOptionFailsafe;
  21.     RS07_ChooseOptionFailsafe := False;
  22.     if (not cf or RS07_PreventChooseOptionCollisions([RS07_InventoryBx, RS07_DepositBoxBx])) then
  23.     begin            
  24.       TIAUnique(exceptions);
  25.       s := GetSystemTime;
  26.       repeat    
  27.         if not (RS07_BankOpen or RS07_DepositBoxOpen) then
  28.         begin
  29.           RS07_ChooseOptionFailsafe := cf;
  30.           Exit;
  31.         end;  
  32.         case b of        
  33.           True: u := RS07_GetUsedInventorySlots;
  34.           False: u := RS07_GetUsedDepositBoxSlots;
  35.         end;      
  36.         MSSL_TIARemoveEx(u, exceptions);
  37.         h := High(u);
  38.         Result := (h = -1);
  39.         if not Result then
  40.         begin
  41.           case (h > -1) of
  42.             True:
  43.             begin  
  44.               i := TIAMax(u);
  45.               SetLength(u, 0);            
  46.               t := (GetSystemTime - GetSystemTime);  
  47.               w := GetSystemTime;
  48.               repeat
  49.                 if (not (RS07_BankOpen or RS07_DepositBoxOpen) or ((GetSystemTime - w) > 30000)) then
  50.                 begin  
  51.                   RS07_ChooseOptionFailsafe := cf;
  52.                   Exit;
  53.                 end;
  54.                 case b of
  55.                   True: d := RS07_InventorySlotUsed(i);
  56.                   False: d := RS07_DepositBoxSlotUsed(i);
  57.                 end;      
  58.                 if (d and ((GetSystemTime - t) > (5000 + r))) then
  59.                 case RS07_DepositEx(i, -1) of  
  60.                   True:
  61.                   begin                        
  62.                     m := GetSystemTime;      
  63.                     repeat          
  64.                       if not (RS07_BankOpen or RS07_DepositBoxOpen) then
  65.                       begin
  66.                         RS07_ChooseOptionFailsafe := cf;
  67.                         Exit;                        
  68.                       end;
  69.                       MSSL_Wait(0);
  70.                     until (((GetSystemTime - m) > 5000) or not RS07_ChooseOptionAvailable);
  71.                     MSSL_Wait(150);
  72.                     m := GetSystemTime;
  73.                     repeat    
  74.                       case b of
  75.                         True: d := RS07_InventorySlotUsed(i);
  76.                         False: d := RS07_DepositBoxSlotUsed(i);
  77.                       end;                                                              
  78.                       MSSL_Wait(0);
  79.                     until (((GetSystemTime - m) > 150) or d);
  80.                     t := GetSystemTime;
  81.                     r := Random(2500);  
  82.                   end;
  83.                   False: RS07_HideChooseOption;
  84.                 end;
  85.                 if d then  
  86.                   MSSL_Wait(0);
  87.               until not d;
  88.             end;
  89.             False: RS07_HideChooseOption;                
  90.           end;
  91.           if not Result then
  92.             MSSL_Wait(0);
  93.         end;  
  94.       until (Result or ((GetSystemTime - s) > 300000));  
  95.     end;
  96.     RS07_ChooseOptionFailsafe := cf;
  97.   end;
  98. end;
  99.  
  100. function RS07_DepositEverything: Boolean;
  101. {==============================================================================]  
  102.   Created: March 29th, 2013.
  103.   Contributors: Janilabo
  104.   Explanation: Deposits EVERYTHING from inventory. Returns true with success.  
  105. [==============================================================================}
  106. begin
  107.   Result := RS07_DepositEverythingEx([]);
  108. end;
Advertisement
Add Comment
Please, Sign In to add comment