Advertisement
WarPie90

Untitled

Dec 28th, 2022
1,792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.96 KB | None | 0 0
  1. (*
  2.   This function is used to drop the lot in your inventory.
  3.  
  4.   Technically, this can be done in very few lines of code,
  5.   but as an anti pattern mechanism it breaks the drop-cycle
  6.   into smaller slices of the pattern, allowing for Anitban to be activated
  7.   while dropping, including breaks, and also will potensially stall a little
  8.   more between some items.
  9. *)
  10. var tmpCount: Int32;
  11. function TMiner.DropInventory(): Boolean;
  12. var
  13.   ptrn: TIntegerArray;
  14.   slices,itemsToKeep: TIntegerArray;
  15.   sequences: T2DIntArray;
  16.   slot,i,hi: Int32;
  17. begin
  18.   ptrn := Inventory.ErrorPattern(DROP_PATTERN_REGULAR, 10);
  19.  
  20.   // make sub-patterns (sequences)
  21.   hi := 0;
  22.   while hi <> Length(ptrn) do
  23.   begin
  24.     if Self.IsUnfocused() then
  25.       slices += Random(hi, Length(ptrn))
  26.     else
  27.       slices += srl.TruncatedGauss(Length(ptrn), hi, 6);
  28.     hi := slices[High(slices)];
  29.   end;
  30.  
  31.   sequences += Copy(ptrn, 0, slices[0]);
  32.   for i:=1 to High(slices) do
  33.     sequences += Copy(ptrn, slices[i-1], 28-slices[i-1]);
  34.  
  35.   //for each sequence do
  36.   for i:=0 to High(sequences) do
  37.   begin
  38.     ptrn := sequences[i];
  39.  
  40.     // check if we have an antiban ready and lined up
  41.     Self.DoAntiban();
  42.  
  43.     // here we can add filter-rules, something like this
  44.     Inventory.FindItems(KEEP_THESE_ITEMS, itemsToKeep);
  45.     for slot in itemsToKeep do
  46.       ptrn.Remove(slot);
  47.  
  48.     // shift-drop the rest of our ores
  49.     Inventory.ShiftDrop(ptrn);
  50.     if Self.IsUnfocused() then Self.BurstOfUnfocused();
  51.  
  52.     // do not delay before completing if we are hyper focued
  53.     if (Self.IsHyperFocused()) and (i = High(sequences))  then
  54.       break;
  55.  
  56.     // delay before next sequence or before completing
  57.     Sleep(srl.TruncatedGauss(0, 6000, 6));
  58.  
  59.     // if we are unfocused shit might happen.
  60.     if Self.IsUnfocused() then
  61.     begin
  62.       Self.BurstOfUnfocused();
  63.       if (Random() < 0.1) then break;
  64.     end;
  65.   end;
  66.  
  67.   tmpCount += 28;
  68.   WriteLn('Mined: ', tmpCount, 'ores');
  69. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement