Skip to content

Commit 242b972

Browse files
committed
make sure sleep timer doesn't wrap around
- more efficient mm clean dots
1 parent 733a13f commit 242b972

File tree

2 files changed

+28
-38
lines changed

2 files changed

+28
-38
lines changed

osrs/antiban/antiban.simba

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ var
7373
current, res: TDateTime;
7474
begin
7575
current := TDateTime.CreateFromSystem();
76+
res := TDateTime.CreateFromISO(current.Date.ToString('YYYY-MM-DD') + 'T' + time);
7677

77-
res := (TDateTime.CreateFromISO(current.Date.ToString('YYYY-MM-DD') + 'T' + time)) - current;
78+
res -= current;
7879
if res < 0 then res += 1;
7980

8081
Result := GetTimeRunning() + UInt64(Trunc(res * ONE_DAY));
81-
Result += Trunc(GaussRand(0, randomness * 10 * ONE_DAY));
82+
Result += Trunc(Abs(GaussRand(0, randomness * 10 * ONE_DAY)));
8283
Result := Max(0, Result);
8384
end;
8485

osrs/interfaces/minimap.simba

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -861,64 +861,53 @@ end.
861861
*)
862862
function TRSMinimap.CleanImage(img: TImage; radius: Integer): TImage;
863863

864-
function _DotTPA(pt: TPoint): TPointArray;
864+
function _DotTPA(pt: TPoint; bounds: TBox): TPointArray;
865865
var
866866
q: TPoint;
867867
begin
868-
q := pt.Offset(0,-1);
869-
if img.InImage(q.X, q.Y) then
870-
Result += q;
868+
if bounds.Contains(pt) then
869+
Exit([
870+
pt.Offset(0,-1), pt.Offset(1,-1),
871+
pt.Offset(-1,0), pt, pt.Offset(1,0), pt.Offset(2,0),
872+
pt.Offset(-1,1), pt.Offset(0,1), pt.Offset(1,1), pt.Offset(2,1),
873+
pt.Offset(0,2), pt.Offset(1,2)
874+
]);
871875

876+
q := pt.Offset(0,-1);
877+
if bounds.Contains(q) then Result += q;
872878
q := pt.Offset(1,-1);
873-
if img.InImage(q.X, q.Y) then
874-
Result += q;
875-
879+
if bounds.Contains(q) then Result += q;
876880
q := pt.Offset(-1,0);
877-
if img.InImage(q.X, q.Y) then
878-
Result += q;
881+
if bounds.Contains(q) then Result += q;
879882

880-
if img.InImage(pt.X, pt.Y) then
881-
Result += pt;
883+
Result += pt;
882884

883885
q := pt.Offset(1,0);
884-
if img.InImage(q.X, q.Y) then
885-
Result += q;
886-
886+
if bounds.Contains(q) then Result += q;
887887
q := pt.Offset(2,0);
888-
if img.InImage(q.X, q.Y) then
889-
Result += q;
890-
888+
if bounds.Contains(q) then Result += q;
891889
q := pt.Offset(-1,1);
892-
if img.InImage(q.X, q.Y) then
893-
Result += q;
894-
890+
if bounds.Contains(q) then Result += q;
895891
q := pt.Offset(0,1);
896-
if img.InImage(q.X, q.Y) then
897-
Result += q;
898-
892+
if bounds.Contains(q) then Result += q;
899893
q := pt.Offset(1,1);
900-
if img.InImage(q.X, q.Y) then
901-
Result += q;
902-
894+
if bounds.Contains(q) then Result += q;
903895
q := pt.Offset(2,1);
904-
if img.InImage(q.X, q.Y) then
905-
Result += q;
906-
896+
if bounds.Contains(q) then Result += q;
907897
q := pt.Offset(0,2);
908-
if img.InImage(q.X, q.Y) then
909-
Result += q;
910-
898+
if bounds.Contains(q) then Result += q;
911899
q := pt.Offset(1,2);
912-
if img.InImage(q.X, q.Y) then
913-
Result += q;
914-
end;
900+
if bounds.Contains(q) then Result += q;
901+
end;
915902

916903
var
917904
tpa: TPointArray;
918905
pt: TPoint;
906+
bounds: TBox;
919907
begin
908+
bounds := [1,1,img.Width-2, img.Height-2];
920909
for pt in Self._GetDots(img) do
921-
tpa += _DotTPA(pt);
910+
tpa += _DotTPA(pt, bounds);
922911

923912
with img.Center do
924913
begin

0 commit comments

Comments
 (0)