Skip to content

Commit

Permalink
feat(collectbox): collectbox.openv2
Browse files Browse the repository at this point in the history
- removed RSChunks from WL
  • Loading branch information
Torwent committed Jun 5, 2024
1 parent 87f76f7 commit 3b39dae
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 42 deletions.
94 changes: 79 additions & 15 deletions osr/interfaces/mainscreen/collectbox.simba
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down Expand Up @@ -134,9 +132,8 @@ end;
(*
## CollectBox.Setup
```pascal
procedure CollectBox.Setup;
procedure CollectBox.Setup();
```
Initializes CollectBox variables.
```{note}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions utils.simba
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -107,6 +106,5 @@ var
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}

{$SCOPEDENUMS OFF}
25 changes: 0 additions & 25 deletions utils/rschunks.simba

This file was deleted.

0 comments on commit 3b39dae

Please sign in to comment.