Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- Mines a single ore.
- Computers are differnt than people, they tend to repeat the same task in the
- exact same amount of time, so I've added a variance to this, ReactionTime.
- Humans, notably gamers, have a focused reactiontime of 150-250 ms.
- This kicks in when we have predicted the next ore to be mined correctly.
- *)
- function TMiner.MineOnce(out Rect: TRectangle): Boolean;
- var
- arr: TRectArray;
- R,_,next: TRectangle;
- circle: TCircle;
- i: Int32;
- HumanResponseTimer, ReactionTime: Double;
- begin
- RSClient.Image.Clear();
- HumanResponseTimer := GetTimeRunning();
- case Self.IsHyperFocused() of
- True: ReactionTime := srl.SkewedRand(150, 100, 450);
- False: ReactionTime := srl.SkewedRand(180, 150, 900);
- end;
- if Self.IsUnfocused() then
- ReactionTime *= 1.5;
- // a 7% chance that our rection time just becomes crap no matter focus
- if(Random() < 0.07) then
- ReactionTime += Random(2000);
- // It actually ended up trading one guy, idk how
- if ChooseOption.IsOpen then
- ChooseOption.Close();
- arr := Self.FindOres();
- for i:=0 to High(Self.OreLocations) do begin
- if not Self.IsOreAlive(arr[i], R) then
- continue;
- // move the mouse
- RSClient.Image.DrawRect(R, $00FF00);
- if (not R.Contains(Mouse.Position())) or (Random() < 0.1) then
- Mouse.Move(srl.rowp(mouse.Position(), R));
- Sleep(Random(10,40));
- if not WaitUntil(MainScreen.IsUpText(['Mine','Rocks']), Random(20,50), Random(200,300)) then
- Exit(False);
- // a humans reactiontime offset
- WaitUntil(GetTimeRunning() > HumanResponseTimer+ReactionTime, Random(5,15), 2000);
- // click it!
- Mouse.Click(R, MOUSE_LEFT, Random() < 0.15);
- Result := MainScreen.DidRedClick();
- if not Result then
- WriteLn('OH FUCK!! SHIT IS GOING DOWN NOW');
- // random extra clicks
- for 1 to SRL.TruncatedGauss(-2, 3) do
- begin
- circle.x := Mouse.Position().X;
- circle.y := Mouse.Position().Y;
- circle.radius := 5;
- Mouse.Click(circle, MOUSE_LEFT, True);
- Sleep(Random(0,150));
- end;
- // to ensure there is no repaid clicking due to walking
- Sleep(Random(300,600));
- Minimap.WaitPlayerMoving();
- arr := Self.FindOres();
- Self.IsOreAlive(arr[i], R);
- if not Result then
- continue;
- // update our mouse sequence
- ClickOrder.Push(R);
- //output current rectangle
- Rect := R;
- // safety mechanism
- if not Self.IsOreAlive(R,_) then
- begin
- Result := False;
- continue;
- end;
- //if we missed it, then 60% chance to do a quick swirl
- if not Result then
- if (Random() < 0.6) then
- begin
- Antiban.SwivelNear(Mouse.Position, 0.4, Random(1,2), Random(20,35), Random() > 0.5);
- Exit;
- end;
- // burst of unfocused
- if Self.IsUnfocused() and Self.BurstOfUnfocused() then
- Exit(True);
- // next ore id
- next := ClickOrder.Top();
- // move mouse to the next ore
- if (Random() > 0.3) or (Self.IsHyperFocused() and (Random() > 0.05)) then
- begin
- Sleep(srl.TruncatedGauss(0, 2000));
- if next.Mean.InBox(MainScreen.Bounds) then
- Mouse.Move(next);
- end;
- break;
- end;
- if (not Result) then
- begin
- Self.TryApplySwivel();
- end;
- end;
Add Comment
Please, Sign In to add comment