Skip to content

Commit f6b520f

Browse files
committed
fix(walker): mainscreen walking should be contained on the mainscreem now
1 parent 48f5964 commit f6b520f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

osrs/walker.simba

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ var
540540
upText: String;
541541
hoveringTarget: Boolean;
542542
quad: TQuad;
543+
tile: TPointArray;
543544
begin
544545
Self.RedClicked := False;
545546
if MainScreen.IsUpText('>') and not Self.ActionUpText.AnyContains('>') then
@@ -562,8 +563,11 @@ begin
562563
Exit;
563564

564565
quad := Self.GetQuadMS(me, pt, [0.9,0.9], Minimap.CompassRadians);
566+
tile := quad.Corners.Connect().ShapeFill();
567+
tile := tile.ExtractBox(MainScreen.Bounds);
568+
if tile = [] then Exit;
565569

566-
Mouse.Move(quad);
570+
Mouse.Move(tile.RandomMean());
567571
upText := MainScreen.UpText;
568572

569573
hoveringTarget := upText.ContainsAny(Self.TargetUpText);
@@ -621,15 +625,20 @@ You will probably never need to call this directly.
621625
*)
622626
function TRSWalker.IsWalkable(mapPoint, me: TPoint; out mmPoint: TPoint; radians: Double): Boolean;
623627
var
624-
corner: TPoint;
628+
tile: TPointArray;
629+
count: Integer;
625630
begin
626631
mmPoint := Self.Point2MM(me, mapPoint, radians);
627632
if not Self.ScreenWalk then
628633
Exit(Minimap.Polygon.Expand(-1).Contains(mmPoint));
629634

630-
for corner in Self.GetQuadMS(me, mapPoint, [0.9,0.9], radians).Corners do
631-
if MainScreen.Bounds.Contains(corner) then
632-
Exit(True);
635+
tile := Self.GetQuadMS(me, mapPoint, [0.9,0.9], radians).Corners.Connect().ShapeFill();
636+
count := Length(tile);
637+
638+
tile := tile.ExtractBox(MainScreen.Bounds);
639+
if tile = [] then Exit;
640+
641+
Result := (Length(tile) / count * 100) > 50;
633642
end;
634643

635644
function TRSWalker._WalkStepHelper(me, mapPoint: TPoint; randomness: Integer; out minimapPoint: TPoint; out shouldExit: Boolean): Boolean;

0 commit comments

Comments
 (0)