diff --git a/osr/interfaces/mainscreen/collectbox.simba b/osr/interfaces/mainscreen/collectbox.simba index 6005cbd4..6729f086 100644 --- a/osr/interfaces/mainscreen/collectbox.simba +++ b/osr/interfaces/mainscreen/collectbox.simba @@ -23,22 +23,20 @@ type CHANGE ); - TRSCollectBox = record(TRSTitledInterface) - FINDER_UPTEXT: TStringArray; - FINDER_OPTION: TStringArray; - end; + TRSCollectBox = type TRSTitledInterface; function TRSCollectBox.GetButtons(): TRSButtonArray; begin Result := FindButtons([[83, 19], [21,21]]); end; -function TRSCollectBox.GetButton(Button: ERSCollectButton): TRSButton; +function TRSCollectBox.GetButton(button: ERSCollectButton): TRSButton; var - Buttons: TRSButtonArray := Self.GetButtons; + buttons: TRSButtonArray; begin - if Length(Buttons) = Length(ERSCollectButton) then - Result := Buttons[Button]; + buttons := Self.GetButtons(); + if Length(buttons) = Length(ERSCollectButton) then + Result := buttons[button]; end; @@ -134,9 +132,8 @@ end; (* ## CollectBox.Setup ```pascal -procedure CollectBox.Setup; +procedure CollectBox.Setup(); ``` - Initializes CollectBox variables. ```{note} @@ -188,7 +185,6 @@ end; ```pascal function TRSCollectBox.Close(UseKeyboard: Boolean = False): Boolean; ``` - Closes the CollectBox, Depending on `UseKeyboard` the function will either click the button or press backspace. @@ -350,7 +346,7 @@ begin end; -function TRSCollectBox.Hover(walkerObject: PRSWalkerObject = nil): Boolean; overload; +function TRSCollectBox.Hover(walkerObject: PRSWalkerObject = nil): Boolean; begin Result := Bank.Hover(walkerObject); end; @@ -408,21 +404,89 @@ begin Result := WaitUntil(Self.IsOpen(), SRL.TruncatedGauss(50, 1500), 3000); end; + +function TRSCollectBox.HoverV2(mapObj: PRSMapObject = nil): Boolean; +begin + Result := Bank.HoverV2(mapObj); +end; + +function TRSCollectBox.OpenV2(mapObj: PRSMapObject = nil): Boolean; +begin + if RSInterface.IsOpen() then + begin + if Self.IsOpen() or BankPin.IsOpen() then + Exit(True); + RSInterface.Close(True); + end; + + if mapObj = nil then + begin + if Banks = [] then + Bank._SetupMapObjects(); + if Banks = [] then + Exit; + + mapObj := Banks.GetClosest(); + end; + + Result := mapObj^.SelectOption(['Collect']) or (MainScreen.IsUpText('Bank') and ChooseOption.Select(['Collect'])); + if not Result then + Exit; + + Minimap.WaitMoving(); + Result := WaitUntil(Self.IsOpen() or BankPin.IsOpen(), SRL.TruncatedGauss(50, 1500), 3000); +end; + +function TRSCollectBox.WalkHoverV2(mapObj: PRSMapObject = nil): Boolean; +begin + Result := Bank.WalkHoverV2(mapObj); +end; + +function TRSCollectBox.WalkOpenV2(mapObj: PRSMapObject = nil): Boolean; +begin + if RSInterface.IsOpen() then + begin + if Self.IsOpen() or BankPin.IsOpen() then + Exit(True); + RSInterface.Close(True); + end; + + if mapObj = nil then + begin + if Banks = [] then + Bank._SetupMapObjects(); + if Banks = [] then + Exit; + + mapObj := Banks.GetClosest(); + end; + + Result := mapObj^.WalkSelectOption(['Collect']) or (MainScreen.IsUpText('Bank') and ChooseOption.Select(['Collect'])); + if not Result then + Exit; + + Minimap.WaitMoving(); + Result := WaitUntil(Self.IsOpen(), SRL.TruncatedGauss(50, 1500), 3000); +end; + + + (* +(CollectBox)= ## var CollectBox - Global CollectBox variable. +Global CollectBox variable. *) var CollectBox: TRSCollectBox; -procedure TRSClient.ClientModeChanged; override; +procedure TRSClient.ClientModeChanged(); override; begin inherited; CollectBox.SetupAlignment(Self.Mode); end; -procedure TSRL.Setup; override; +procedure TSRL.Setup(); override; begin inherited; diff --git a/utils.simba b/utils.simba index 651f0782..b0e9e194 100644 --- a/utils.simba +++ b/utils.simba @@ -37,7 +37,6 @@ var {$IFNDEF WL_ITEMS_EX_INCLUDED} {$I utils/items/items.simba} {$IFNDEF WL_RSREGIONS_UTILS_INCLUDED} {$I utils/rsregions/rsregionsutils.simba} {$IFNDEF WL_RSREGIONS_INCLUDED} {$I utils/rsregions/rsregions.simba} -{$IFNDEF WL_RSCHUNKS_INCLUDED} {$I utils/rschunks.simba} {$IFNDEF WL_REMOTEINPUT_INCLUDED} {$I utils/input/remoteinput.simba} {$IFNDEF WL_WEB_INCLUDED} {$I utils/web.simba} {$IFNDEF WL_BITMAPS_INCLUDED} {$I utils/bitmaps.simba} @@ -107,6 +106,5 @@ var {$ELSE}{$ENDIF} {$ELSE}{$ENDIF} {$ELSE}{$ENDIF} -{$ELSE}{$ENDIF} {$SCOPEDENUMS OFF} diff --git a/utils/rschunks.simba b/utils/rschunks.simba deleted file mode 100644 index 9af4b600..00000000 --- a/utils/rschunks.simba +++ /dev/null @@ -1,25 +0,0 @@ -{$DEFINE WL_RSCHUNKS_INCLUDED} -{$IFNDEF WL_UTILS} - {$I WaspLib/utils.simba} -{$ENDIF} - -type - TRSMapChunks = record - VARROCK, ARDOUGNE, RUINS_OF_UNKAH, TEMPOROSS_COVE, LUNAR_ISLE, - MOTHERLOADE_MINE, PRIFDDINAS: TRSMapChunk; - end; - -var - RSChunks: TRSMapChunks; - -procedure TSRL.Setup(); override; -begin - inherited; - RSChunks.VARROCK := ['Varrock', [49,54,50,53], [0]]; - RSChunks.PRIFDDINAS := ['Prifddinas', [50,95,51,94], [0]]; - RSChunks.ARDOUGNE := ['Ardougne', [40,51,41,52], [0, 3]]; - RSChunks.RUINS_OF_UNKAH := ['Ruins of Unkah', [48,44,49,44], [0]]; - RSChunks.TEMPOROSS_COVE := ['Tempoross Cove', [47,46,47,46], [0]]; - RSChunks.LUNAR_ISLE := ['Lunar Isle', [32,61,33,60], [0]]; - RSChunks.MOTHERLOADE_MINE := ['Motherloade Mine', [57,89,59,87], [0]]; -end;