Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions osrs/interfaces/mainscreen/depositbox.simba
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
(*
# DepositBox
DepositBox interface.
```{figure} ../../images/deposit_box_interface.png
```
*)

{$DEFINE WL_DEPOSITBOX_INCLUDED}
Expand Down Expand Up @@ -30,6 +32,20 @@ Main record to interact with the {ref}`DepositBox` interface.
QuantityButtons: array [ERSItemQuantity] of TRSButton;
end;

(*
## DepositBox.FindItemBoundaries
```pascal
function TRSDepositBox.FindItemBoundaries(): TBoxArray;
```
Finds and returns the bounding boxes of items currently visible in the deposit box slots.
Used internally by the slot interface for item detection.

Example:
```pascal
WriteLn DepositBox.FindItemBoundaries();
```
*)

function TRSDepositBox.FindItemBoundaries(): TBoxArray;
var
tpa, final: TPointArray;
Expand Down Expand Up @@ -225,6 +241,21 @@ begin
end;
end;

(*
## DepositBox.DepositItem
```pascal
function TRSDepositBox.DepositItem(item: TRSBankItem; useQuantityButtons: Boolean): Boolean;
function TRSDepositBox.DepositItem(item: TRSItem; useQuantityButtons: Boolean): Boolean; overload;
```
Deposits the specified item into the deposit box.
If useQuantityButton is False it will use {ref}`ChooseOption`

Example:
```pascal
DepositBox.DepositItem('Lobster', True);
```
*)

function TRSDepositBox.DepositItem(item: TRSBankItem; useQuantityButtons: Boolean): Boolean;
var
ba: TBoxArray;
Expand All @@ -238,6 +269,21 @@ begin
Result := Self.DepositItem(new TRSBankItem(item), useQuantityButtons);
end;

(*
## DepositBox.DepositItemArray
```pascal
function TRSDepositBox.DepositItemArray(items: array of TRSBankItem; useQuantityButtons: Boolean): Boolean;
function TRSDepositBox.DepositItemArray(items: TRSItemArray; useQuantityButtons: Boolean): Boolean; overload;
```
Deposits an array of items into the deposit box. Returns `True` if all items were successfully deposited.
If useQuantityButton is False it will use {ref}`ChooseOption`

Example:
```pascal
DepositBox.DepositItemArray(['Lobster', 'Swordfish'], True);
```
*)

function TRSDepositBox.DepositItemArray(items: array of TRSBankItem; useQuantityButtons: Boolean): Boolean;
var
item: TRSBankItem;
Expand All @@ -258,24 +304,102 @@ begin
Result := False;
end;

(*
## DepositBox.DepositInventory
```pascal
procedure TRSDepositBox.DepositInventory();
```
Clicks the deposit inventory button to deposit all inventory items at once.

Example:
```pascal
DepositBox.DepositInventory();
```
*)

procedure TRSDepositBox.DepositInventory();
begin
if Self.IsOpen then
Self.DepositButtons[ERSDepositButtons.INVENTORY].Click;
end;

(*
## DepositBox.DepositLootBag
```pascal
procedure TRSDepositBox.DepositLootBag();
```
Clicks the deposit loot bag button to deposit all items from the looting bag.

Example:
```pascal
DepositBox.DepositLootBag();
```
*)

procedure TRSDepositBox.DepositLootBag();
begin
if Self.IsOpen then
Self.DepositButtons[ERSDepositButtons.LOOT].Click;
end;

(*
## DepositBox.DepositEquipment
```pascal
procedure TRSDepositBox.DepositEquipment();
```
Clicks the deposit worn items button to deposit all currently equipped items.

Example:
```pascal
DepositBox.DepositEquipment();
```
*)

procedure TRSDepositBox.DepositEquipment();
begin
if Self.IsOpen then
Self.DepositButtons[ERSDepositButtons.WORN].Click;
end;

procedure TRSDepositBox.Draw(img: TImage);
var
i: Integer;
items: TBoxArray;
begin
if not Self.IsOpen() then Exit;

img.DrawColor := $00FFFF;
img.DrawBox(Self.Bounds);
img.DrawColor := $FFFFFF;
img.DrawBox(Self.SlotsArea);
img.DrawColor := $00FF00;
img.DrawBoxArray(Self.InvSlotBoxes, False);
img.DrawColor := $FF0000;
img.DrawBoxArray(Self.EquipSlotBoxes, False);
img.DrawColor := $FFFF00;
img.DrawBoxArray(Self.FindItemBoundaries(), False);
img.DrawColor := $00FF00;

for i := 0 to 4 do
begin
Self.QuantityButtons[i].Draw(img);
end;

for i := 0 to 2 do
begin
Self.DepositButtons[i].Draw(img);
end;
end;

procedure ShowOnTarget(depositBox: TRSDepositBox); overload;
var
img: TImage;
begin
img := Target.GetImage();
depositBox.Draw(img);
img.Show();
end;

var
(*
## DepositBox variable
Expand Down