Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Torwent committed Sep 1, 2021
1 parent d8aecaa commit a8fda65
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 86 deletions.
4 changes: 3 additions & 1 deletion osr.simba
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

{$IFNDEF WL_BIOMETRICS_INCLUDED} {$I osr/antiban/biometrics.simba}
{$IFNDEF WL_PROGRESS_INCLUDED} {$I osr/progress.simba}
{$IFNDEF WL_XPDROP_INCLUDED} {$I osr/interface/xpdrop.simba}
{$IFNDEF WL_XPDROP_INCLUDED} {$I osr/interface/xpdrop.simba}
{$IFNDEF WL_RSCLIENT_INCLUDED} {$I osr/rsclient.simba}
{$IFNDEF WL_INTERFACE_INCLUDED} {$I osr/interface/interface.simba}
{$IFNDEF WL_INTERFACEAREA_INCLUDED} {$I osr/interface/interfacearea.simba}

{$IFNDEF WL_OPTIONS_INCLUDED} {$I osr/interface/gametabs/options.simba}
Expand Down Expand Up @@ -84,6 +85,7 @@
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}

{$IFHASFILE overrides.simba}
{$I overrides.simba}
Expand Down
11 changes: 0 additions & 11 deletions osr/interface/gametabs/equipment.simba
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,3 @@
{$I WaspLib/osr.simba}
{$ENDIF}

function TRSEquipment.HoverItem(Item: TRSItem): Boolean;
var
B: TBox;
begin
if Self.FindItem(Item, B) then
begin
Mouse.Move(B);
Result := True;
end;
end;

15 changes: 0 additions & 15 deletions osr/interface/gametabs/inventory.simba
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ begin
end;


function TRSInventory.RandomPattern: TIntegerArray;
var
Patterns: T2DIntegerArray;
begin

Patterns := [
DROP_PATTERN_SNAKE, DROP_PATTERN_SPIRAL,
DROP_PATTERN_REGULAR, DROP_PATTERN_TOPDOWN,
DROP_PATTERN_SNAKE_R, DROP_PATTERN_TOPDOWN_R
];

Result := Patterns[Random(0, High(Patterns))];
end;


function TRSInventory.FindAllItems(Items: TRSItemArray; out Slots: TIntegerArray): Boolean;
var
Item: TRSItem;
Expand Down
162 changes: 162 additions & 0 deletions osr/interface/interface.simba
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{$DEFINE WL_INTERFACE_INCLUDED}
{$IFNDEF WL_OSR}
{$I WaspLib/osr.simba}
{$ENDIF}

type
TRSDropDown = record
Index: Int32;
Bounds: TBox;
Middle: TPoint;
end;

TRSDropDownArray = array of TRSDropDown;

//overriden to be able to pick Scroll UI Close button
function TRSInterface.FindButtons(Dimensions: TRSButtonDimensions): TRSButtonArray; override;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, W, H: Int32;
B: TBox;
Color: TCTS1Color;
Boxes: TBoxArray;
begin
B := Self.Bounds();

for Color in Self.ButtonColors do
if SRL.FindColors(TPA, Color, B) > 0 then
ATPA += TPA;

ATPA := ATPA.Merge().Cluster(1);

for TPA in ATPA do
begin
if Length(TPA) < 50 then
Continue;

B := TPA.Bounds();
B.GetDimensions(W, H);

for I := 0 to High(Dimensions) do
begin
if ((W = Dimensions[I].Width) or (Dimensions[I].Width = 0)) and
((H = Dimensions[I].Height) or (Dimensions[I].Height = 0)) and
(TPA.Frameness > 57) then
Boxes += B;
end;

{$IFDEF SRL_DEBUG_FINDBUTTONS}
Writeln(W, ', ', H);
{$ENDIF}
end;

Boxes.SortByXY(10);

SetLength(Result, Length(Boxes));
for I := 0 to High(Boxes) do
begin
Result[I].Index := I;
Result[I].Bounds := Boxes[I];
Result[I].Middle := Boxes[I].Middle;
Result[I].EnabledColors := Self.ButtonEnabledColors;
end;
end;

function TRSInterface.FindDropDown(Dimensions: TRSButtonDimensions): TRSDropDownArray;
function FindArrow(Bounds: TBox; Color: TCTS0Color; Dimensions: TRSButtonDimensions): TRSButtonArray; overload;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, W, H: Int32;
B: TBox;
Color: TCTS1Color;
Boxes: TBoxArray;
begin
B := Bounds;

if SRL.FindColors(TPA, Color, B) > 0 then
ATPA += TPA;

ATPA := ATPA.Merge().Cluster(1);

for TPA in ATPA do
begin
if Length(TPA) < 50 then
Continue;

B := TPA.Bounds();
B.GetDimensions(W, H);

for I := 0 to High(Dimensions) do
begin
if ((W = Dimensions[I].Width) or (Dimensions[I].Width = 0)) and
((H = Dimensions[I].Height) or (Dimensions[I].Height = 0)) and
(TPA.Frameness > 57) then
Boxes += B;
end;

{$IFDEF SRL_DEBUG_FINDBUTTONS}
Writeln(W, ', ', H);
{$ENDIF}
end;

Boxes.SortByXY(10);

SetLength(Result, Length(Boxes));
for I := 0 to High(Boxes) do
begin
Result[I].Index := I;
Result[I].Bounds := Boxes[I];
Result[I].Middle := Boxes[I].Middle;
Result[I].EnabledColors := Self.ButtonEnabledColors;
end;
end;


var
TPA: TPointArray;
ATPA: T2DPointArray;
I, W, H: Int32;
B: TBox;
Boxes: TBoxArray;
begin
B := Self.Bounds;

if SRL.FindColors(TPA, CTS0(4474438, 5), B) > 0 then
ATPA += TPA;

ATPA := ATPA.Merge().Cluster(1);

for TPA in ATPA do
begin
if Length(TPA) < 50 then
Continue;

B := TPA.Bounds();
B.GetDimensions(W, H);

for I := 0 to High(Dimensions) do
begin
if ((W = Dimensions[I].Width) or (Dimensions[I].Width = 0)) and
((H = Dimensions[I].Height) or (Dimensions[I].Height = 0)) and
(TPA.Frameness > 100) and (Length(FindArrow(B, CTS0(65536, 1), [16, 16])) = 1) then
Boxes += B;
end;

{$IFDEF SRL_DEBUG_FINDBUTTONS}
Writeln(W, ', ', H);
{$ENDIF}
end;

Boxes.SortByXY(10);

SetLength(Result, Length(Boxes));
for I := 0 to High(Boxes) do
begin
Result[I].Index := I;
Result[I].Bounds := Boxes[I];
Result[I].Middle := Boxes[I].Middle;
end;
end;

51 changes: 0 additions & 51 deletions osr/interface/interfacearea.simba
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,6 @@
{$I WaspLib/osr.simba}
{$ENDIF}

//overriden to be able to pick Scroll UI Close button
function TRSInterface.FindButtons(Dimensions: TRSButtonDimensions): TRSButtonArray; override;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, W, H: Int32;
B: TBox;
Color: TCTS1Color;
Boxes: TBoxArray;
begin
B := Self.Bounds();

for Color in Self.ButtonColors do
if SRL.FindColors(TPA, Color, B) > 0 then
ATPA += TPA;

ATPA := ATPA.Merge().Cluster(1);

for TPA in ATPA do
begin
if Length(TPA) < 50 then
Continue;

B := TPA.Bounds();
B.GetDimensions(W, H);

for I := 0 to High(Dimensions) do
begin
if ((W = Dimensions[I].Width) or (Dimensions[I].Width = 0)) and
((H = Dimensions[I].Height) or (Dimensions[I].Height = 0)) and
(TPA.Frameness > 57) then
Boxes += B;
end;

{$IFDEF SRL_DEBUG_FINDBUTTONS}
Writeln(W, ', ', H);
{$ENDIF}
end;

Boxes.SortByXY(10);

SetLength(Result, Length(Boxes));
for I := 0 to High(Boxes) do
begin
Result[I].Index := I;
Result[I].Bounds := Boxes[I];
Result[I].Middle := Boxes[I].Middle;
Result[I].EnabledColors := Self.ButtonEnabledColors;
end;
end;

//Get buttons on any interface
function TRSMainScreen.GetButton: TRSButton;
var
Expand Down
8 changes: 0 additions & 8 deletions osr/interface/make.simba
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ begin
Result[i].Index := i;
end;

function TRSMake.IsOpen(WaitTime: Int32; Interval: Int32 = -1): Boolean; overload;
begin
if (Interval = -1) then
Interval := SRL.TruncatedGauss(50, 1500);

Result := WaitUntil(Self.IsOpen(), Interval, WaitTime);
end;

procedure TRSMake.Draw(Bitmap: TMufasaBitmap); override;
begin
if not Self.IsOpen then
Expand Down

0 comments on commit a8fda65

Please sign in to comment.