Skip to content

Commit

Permalink
fix: reverting recent walker changes that use the "ZoomRectangle" for…
Browse files Browse the repository at this point in the history
… random point generation

it was causing too many issues and I don't have time to debug it all right now
  • Loading branch information
Torwent committed Feb 21, 2024
1 parent 8989ff9 commit b0e9e1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
36 changes: 15 additions & 21 deletions optional/handlers/poh.simba
Original file line number Diff line number Diff line change
Expand Up @@ -794,23 +794,14 @@ begin

if Self.ScreenWalk then
begin
p := Minimap.RandomPointInZoomRectangle(minimapPoint, randomness);
if p = [0, 0] then
Exit;

p := Minimap.RandomPointOn(minimapPoint, randomness);
Mouse.Move(Minimap.PointToMsRect(p).Mean());
msUpText := MainScreen.GetUpText();
if not ('Walk here' in msUpText) then
Exit(ChooseOption.Select('Walk here'));
end
else
begin
p := Minimap.RandomPointOn(minimapPoint, randomness);
if p = [0, 0] then
Exit;

Mouse.Move(P);
end;
Mouse.Move(Minimap.RandomPointOn(minimapPoint, randomness));

if randomness > 0 then
Antiban.BioClick(MOUSE_LEFT)
Expand Down Expand Up @@ -847,12 +838,12 @@ begin

if Self.ScreenWalk then
begin
if (Self.ScreenWalk and not Minimap.PointInZoomRectangle(minimapPoint)) then
if not Minimap.PointOnZoomRectangle(minimapPoint) then
Exit;
end
else
begin
if (not Minimap.IsPointOn(minimapPoint)) then
if not Minimap.IsPointOn(minimapPoint) then
Exit;
end;

Expand All @@ -867,19 +858,19 @@ function TRSPOHHandler.WalkFinalStep(playerPoint, pohPoint: TPoint; WaitUntilDis
Internal method used by POH Handler when finishing walking a path.
You will probably never need to call this directly but it can be used to take a single step.
*)
function TRSPOHHandler.WalkFinalStep(playerPoint, pohPoint: TPoint; WaitUntilDistance: Int32): Boolean;
function TRSPOHHandler.WalkFinalStep(playerPoint, pohPoint: TPoint; waitUntilDistance: Int32): Boolean;
var
minimapPoint: TPoint;
begin
if not Self.WalkStepHelper(playerPoint, pohPoint, minimapPoint) then
Exit(not Self.Walking);

if (Minimap.Center.DistanceTo(minimapPoint) < 5) then
if (Minimap.Center().DistanceTo(minimapPoint) < 5) then
Exit(True);

Result := Self.MouseClick(minimapPoint, 0);
if Result then
Self.WaitMoving(pohPoint, WaitUntilDistance);
Self.WaitMoving(pohPoint, waitUntilDistance);
end;

(*
Expand All @@ -899,7 +890,7 @@ begin
if not Self.WalkStepHelper(playerPoint, pohPoint, minimapPoint) then
Exit(not Self.Walking);

if (Minimap.Center.DistanceTo(minimapPoint) < 5) then
if (Minimap.Center().DistanceTo(minimapPoint) < 5) then
Exit(True);

Result := Self.MouseClick(minimapPoint, Self.Randomness);
Expand Down Expand Up @@ -935,7 +926,10 @@ begin
Exit;

r := Minimap.PointToMSRect(mmPoint, 1, 1, angle);
Result := MainScreen.IsVisible(r.mean()) and (CountColor($000000, r.Bounds.Expand(0, MainScreen.Bounds())) = 0);
if not MainScreen.IsVisible(r.mean()) then
Exit;

Result := CountColor($000000, r.Bounds().Expand(0, MainScreen.Bounds())) = 0;
end;


Expand Down Expand Up @@ -1387,7 +1381,7 @@ begin
mmPoints := Self.MapToMM(me, obj.Coordinates, radians);
mmPoints := mmPoints.Sorted(Minimap.Center());

if not Minimap.PointInZoomRectangle(mmPoints[0]) then
if not Minimap.PointOnZoomRectangle(mmPoints[0]) then
Self.WebWalk(obj.Coordinates, 12, 0.2);

Result := Self.Hover(objType);
Expand All @@ -1409,7 +1403,7 @@ begin
mmPoints := Self.MapToMM(me, obj.Coordinates, radians);
mmPoints := mmPoints.Sorted(Minimap.Center());

if not Minimap.PointInZoomRectangle(mmPoints[0]) then
if not Minimap.PointOnZoomRectangle(mmPoints[0]) then
Self.WebWalk(obj.Coordinates, 12, 0.2);

Result := Self.Click(objType);
Expand All @@ -1431,7 +1425,7 @@ begin
mmPoints := Self.MapToMM(me, obj.Coordinates, radians);
mmPoints := mmPoints.Sorted(Minimap.Center());

if not Minimap.PointInZoomRectangle(mmPoints[0]) then
if not Minimap.PointOnZoomRectangle(mmPoints[0]) then
Self.WebWalk(obj.Coordinates, 12, 0.2);

Result := obj.Select(options, mmPoints, radians);
Expand Down
17 changes: 4 additions & 13 deletions osr/walker/objects/walkerobjects.simba
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ This is overriden so if we redclick our current TRSWalkerObject target while mai
When we start the walking process towards a TRSWalkerObject, TRSWalkerObject.CurrentUpText is temporarily set so we
know what we are looking for while walking. Once we click the target TRSWalkerObject.CurrentUpText is cleared.
*)
function TRSWalker.Click(minimapPoint: TPoint; Randomness: Int32): Boolean; override;
function TRSWalker.Click(minimapPoint: TPoint; randomness: Int32): Boolean; override;
var
p: TPoint;
hoveringTarget: Boolean;
Expand All @@ -130,10 +130,7 @@ begin

if Self.ScreenWalk then
begin
p := Minimap.RandomPointInZoomRectangle(minimapPoint, randomness);
if p = [0, 0] then
Exit;

p := Minimap.RandomPointOn(minimapPoint, randomness);
Mouse.Move(Minimap.PointToMsRect(p).Mean());
msUpText := MainScreen.GetUpText();

Expand Down Expand Up @@ -166,15 +163,9 @@ begin
Exit(ChooseOption.Select('Walk here'));
end
else
begin
p := Minimap.RandomPointOn(minimapPoint, randomness);
if p = [0, 0] then
Exit;

Mouse.Move(P);
end;
Mouse.Move(Minimap.RandomPointOn(minimapPoint, randomness));

if Randomness > 0 then
if randomness > 0 then
Antiban.BioClick(MOUSE_LEFT)
else
Mouse.Click(MOUSE_LEFT);
Expand Down

0 comments on commit b0e9e1c

Please sign in to comment.