From a8fda65060d359b35b42c6198840b1a87e732153 Mon Sep 17 00:00:00 2001 From: Torwent Date: Wed, 1 Sep 2021 18:31:44 +0200 Subject: [PATCH] update --- osr.simba | 4 +- osr/interface/gametabs/equipment.simba | 11 -- osr/interface/gametabs/inventory.simba | 15 --- osr/interface/interface.simba | 162 +++++++++++++++++++++++++ osr/interface/interfacearea.simba | 51 -------- osr/interface/make.simba | 8 -- 6 files changed, 165 insertions(+), 86 deletions(-) create mode 100644 osr/interface/interface.simba diff --git a/osr.simba b/osr.simba index 62523a10..ce02a3da 100644 --- a/osr.simba +++ b/osr.simba @@ -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} @@ -84,6 +85,7 @@ {$ELSE}{$ENDIF} {$ELSE}{$ENDIF} {$ELSE}{$ENDIF} +{$ELSE}{$ENDIF} {$IFHASFILE overrides.simba} {$I overrides.simba} diff --git a/osr/interface/gametabs/equipment.simba b/osr/interface/gametabs/equipment.simba index 54100b78..726bdb1f 100644 --- a/osr/interface/gametabs/equipment.simba +++ b/osr/interface/gametabs/equipment.simba @@ -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; - diff --git a/osr/interface/gametabs/inventory.simba b/osr/interface/gametabs/inventory.simba index e7058e09..98b2b970 100644 --- a/osr/interface/gametabs/inventory.simba +++ b/osr/interface/gametabs/inventory.simba @@ -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; diff --git a/osr/interface/interface.simba b/osr/interface/interface.simba new file mode 100644 index 00000000..afe9ce1c --- /dev/null +++ b/osr/interface/interface.simba @@ -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; + diff --git a/osr/interface/interfacearea.simba b/osr/interface/interfacearea.simba index ad0bd2af..1342201a 100644 --- a/osr/interface/interfacearea.simba +++ b/osr/interface/interfacearea.simba @@ -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 diff --git a/osr/interface/make.simba b/osr/interface/make.simba index 79ff7279..0f9b1824 100644 --- a/osr/interface/make.simba +++ b/osr/interface/make.simba @@ -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