Skip to content

Commit

Permalink
Merge branch 'master' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
slackydev committed Jul 3, 2023
2 parents 0eb1619 + d3fc973 commit c7df82f
Show file tree
Hide file tree
Showing 23 changed files with 403 additions and 59 deletions.
2 changes: 2 additions & 0 deletions osr.simba
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ end;
{$IFNDEF SRL_BANKPIN_INCLUDED} {$I osr/bankpin.simba}
{$IFNDEF SRL_GRANDEXCHANGE_INCLUDED} {$I osr/grandexchange.simba}
{$IFNDEF SRL_DEPOSITBOX_INCLUDED} {$I osr/depositbox.simba}
{$IFNDEF SRL_CRAFTSCREEN_INCLUDED} {$I osr/craftscreen.simba}
{$IFNDEF SRL_WALKER_MAP_INCLUDED} {$I osr/walker/walker_map.simba}
{$IFNDEF SRL_WALKER_INCLUDED} {$I osr/walker/walker.simba}
{$IFNDEF SRL_STATS_INCLUDED} {$I osr/stats.simba}
Expand Down Expand Up @@ -120,6 +121,7 @@ end;
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}

{$IFDEF SRL_HAD_HINTS}
{$HINTS ON}
Expand Down
2 changes: 1 addition & 1 deletion osr/antiban.simba
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ begin
begin
B := Box(MainScreen.Center, 250, 100);

if OCR.LocateText(B, Name, RS_FONT_BOLD_12, TOCRColorRule.Create([$00FFFF, 0]), 0.85) then
if OCR.LocateText(B, Name, RS_FONT_BOLD_12, TOCRColorFilter.Create([$00FFFF, 0]), 0.85) then
begin
if Self.DebugRandoms then
begin
Expand Down
15 changes: 7 additions & 8 deletions osr/bank.simba
Original file line number Diff line number Diff line change
Expand Up @@ -617,15 +617,14 @@ begin

atpa.SortByY(False); //Sort the tabs text from bottom to top. This is because we are only interested in the very first above the item.


atpa := atpa[0].Cluster(1); //Now we make clusters of that single tab text. This will separate the text from the number.
atpa.SortByX(False); //Sort the tab text from right to left because now we are only interested in the number which is to the right.
tpa := atpa[0];

//Now we run OCR on the number tpa to find out what number is it and set our result
Result := OCR.RecognizeNumber(tpa.Bounds(), TOCRColorRule.Create([10672356]), RS_FONT_PLAIN_11);
ATPA := ATPA[0].Cluster(1); //Now we make clusters of that single tab text. This will separate the text from the number.
ATPA.SortByX(False); //Sort the tab text from right to left because now we are only interested in the number which is to the right.
TPA := ATPA[0];

//Now we run OCR on the number TPA to find out what number is it and set our result
Result := OCR.RecognizeNumber(TPA.Bounds, TOCRColorFilter.Create([10672356]), RS_FONT_PLAIN_11);
if Result = 0 then
Result := OCR.RecognizeNumber(tpa.Bounds(), TOCRColorRule.Create([16777215]), RS_FONT_PLAIN_11);
Result := OCR.RecognizeNumber(TPA.Bounds, TOCRColorFilter.Create([16777215]), RS_FONT_PLAIN_11);

if (Result > 0) and openTab then
Self.OpenTab(Result);
Expand Down
8 changes: 4 additions & 4 deletions osr/bankpin.simba
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ function TRSBankPin.Enter(Pin: String): Boolean;

function GetDigitToEnter: Char;
begin
if OCR.LocateText(Self.Bounds, 'FIRST', RS_FONT_BOLD_12, TOCRColorRule.Create([$FFFFFF]), 1) then Exit(Pin[1]);
if OCR.LocateText(Self.Bounds, 'SECOND', RS_FONT_BOLD_12, TOCRColorRule.Create([$FFFFFF]), 1) then Exit(Pin[2]);
if OCR.LocateText(Self.Bounds, 'THIRD', RS_FONT_BOLD_12, TOCRColorRule.Create([$FFFFFF]), 1) then Exit(Pin[3]);
if OCR.LocateText(Self.Bounds, 'FOURTH', RS_FONT_BOLD_12, TOCRColorRule.Create([$FFFFFF]), 1) then Exit(Pin[4]);
if OCR.LocateText(Self.Bounds, 'FIRST', RS_FONT_BOLD_12, TOCRColorFilter.Create([$FFFFFF]), 1) then Exit(Pin[1]);
if OCR.LocateText(Self.Bounds, 'SECOND', RS_FONT_BOLD_12, TOCRColorFilter.Create([$FFFFFF]), 1) then Exit(Pin[2]);
if OCR.LocateText(Self.Bounds, 'THIRD', RS_FONT_BOLD_12, TOCRColorFilter.Create([$FFFFFF]), 1) then Exit(Pin[3]);
if OCR.LocateText(Self.Bounds, 'FOURTH', RS_FONT_BOLD_12, TOCRColorFilter.Create([$FFFFFF]), 1) then Exit(Pin[4]);
end;

var
Expand Down
10 changes: 5 additions & 5 deletions osr/chat.simba
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ var
begin
for Color in Colors do
begin
Result := OCR.RecognizeStatic(Self.GetLineBoxes()[CHAT_INPUT_LINE], TOCRColorRule.Create([Color]), RS_FONT_PLAIN_12);
Result := OCR.RecognizeStatic(Self.GetLineBoxes()[CHAT_INPUT_LINE], TOCRColorFilter.Create([Color]), RS_FONT_PLAIN_12);
if Result <> '' then
Break;
end;
Expand Down Expand Up @@ -206,7 +206,7 @@ Example
*)
function TRSChat.GetQuery: String;
begin
Result := OCR.Recognize(Self.Bounds(), TOCRColorRule.Create([$000000]), RS_FONT_BOLD_12);
Result := OCR.Recognize(Self.Bounds(), TOCRColorFilter.Create([$000000]), RS_FONT_BOLD_12);
end;

(*
Expand All @@ -223,7 +223,7 @@ Example
*)
function TRSChat.GetQueryAnswer: String;
begin
Result := OCR.Recognize(Self.Bounds(), TOCRColorRule.Create([8388608]), RS_FONT_BOLD_12);
Result := OCR.Recognize(Self.Bounds(), TOCRColorFilter.Create([8388608]), RS_FONT_BOLD_12);
end;

(*
Expand Down Expand Up @@ -291,7 +291,7 @@ var
Boxes: TBoxArray;
I, Key: Int32;
begin
Strings := OCR.RecognizeMulti(Self.Bounds(), TOCRColorRule.Create(Colors), RS_FONT_QUILL_8, Boxes);
Strings := OCR.RecognizeLines(Self.Bounds(), TOCRColorFilter.Create(Colors), RS_FONT_QUILL_8, Boxes);

SetLength(Result, Length(Strings));
for I := 0 to High(Result) do
Expand Down Expand Up @@ -437,7 +437,7 @@ begin
if (Matrix[StaticOffset][X] = CHAT_COLOR_BLACK) theN
Matrix[StaticOffset][X] := Colors[0];

Result := OCR.RecognizeStatic(Matrix, TOCRColorRule.Create(Colors), RS_FONT_PLAIN_12);
Result := OCR._RecognizeStatic(Matrix, TOCRColorFilter.Create(Colors), RS_FONT_PLAIN_12);
end;
end;

Expand Down
2 changes: 1 addition & 1 deletion osr/chooseoption.simba
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ begin
if (B.Y2 > Bounds.Y2) then
Exit;

Result[I].Text := OCR.RecognizeStatic(B, TOCRThresholdRule.Create(-1), RS_FONT_BOLD_12_SHADOW);
Result[I].Text := OCR.RecognizeStatic(B, TOCRThresholdFilter.Create(-1), RS_FONT_BOLD_12_SHADOW);
Result[I].Bounds := B;
end;
end;
Expand Down
4 changes: 2 additions & 2 deletions osr/combat.simba
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ begin
B := Self.Bounds;
B.Y2 := B.Y1 + 25;

Result := OCR.Recognize(B, TOCRColorRule.Create([2070783]), RS_FONT_QUILL_8);
Result := OCR.Recognize(B, TOCRColorFilter.Create([2070783]), RS_FONT_QUILL_8);
end;

(*
Expand Down Expand Up @@ -307,7 +307,7 @@ begin
B.X1 += 20;
B.X2 -= 20;

Result := OCR.RecognizeNumber(B, TOCRColorRule.Create([2070783]), RS_FONT_PLAIN_11);
Result := OCR.RecognizeNumber(B, TOCRColorFilter.Create([2070783]), RS_FONT_PLAIN_11);
end;

(*
Expand Down
Loading

0 comments on commit c7df82f

Please sign in to comment.