Skip to content

Commit aec4002

Browse files
committed
Added DepositBox Draw and ShowOnTarget
As well as missing documentation for core functions.
1 parent f2a2b3f commit aec4002

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

osrs/interfaces/mainscreen/depositbox.simba

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(*
22
# DepositBox
33
DepositBox interface.
4+
```{figure} ../../images/deposit_box_interface.png
5+
```
46
*)
57

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

35+
(*
36+
## DepositBox.FindItemBoundaries
37+
```pascal
38+
function TRSDepositBox.FindItemBoundaries(): TBoxArray;
39+
```
40+
Finds and returns the bounding boxes of items currently visible in the deposit box slots.
41+
Used internally by the slot interface for item detection.
42+
43+
Example:
44+
```pascal
45+
WriteLn DepositBox.FindItemBoundaries();
46+
```
47+
*)
48+
3349
function TRSDepositBox.FindItemBoundaries(): TBoxArray;
3450
var
3551
tpa, final: TPointArray;
@@ -225,6 +241,21 @@ begin
225241
end;
226242
end;
227243

244+
(*
245+
## DepositBox.DepositItem
246+
```pascal
247+
function TRSDepositBox.DepositItem(item: TRSBankItem; useQuantityButtons: Boolean): Boolean;
248+
function TRSDepositBox.DepositItem(item: TRSItem; useQuantityButtons: Boolean): Boolean; overload;
249+
```
250+
Deposits the specified item into the deposit box.
251+
If useQuantityButton is False it will use {ref}`ChooseOption`
252+
253+
Example:
254+
```pascal
255+
DepositBox.DepositItem('Lobster', True);
256+
```
257+
*)
258+
228259
function TRSDepositBox.DepositItem(item: TRSBankItem; useQuantityButtons: Boolean): Boolean;
229260
var
230261
ba: TBoxArray;
@@ -238,6 +269,21 @@ begin
238269
Result := Self.DepositItem(new TRSBankItem(item), useQuantityButtons);
239270
end;
240271

272+
(*
273+
## DepositBox.DepositItemArray
274+
```pascal
275+
function TRSDepositBox.DepositItemArray(items: array of TRSBankItem; useQuantityButtons: Boolean): Boolean;
276+
function TRSDepositBox.DepositItemArray(items: TRSItemArray; useQuantityButtons: Boolean): Boolean; overload;
277+
```
278+
Deposits an array of items into the deposit box. Returns `True` if all items were successfully deposited.
279+
If useQuantityButton is False it will use {ref}`ChooseOption`
280+
281+
Example:
282+
```pascal
283+
DepositBox.DepositItemArray(['Lobster', 'Swordfish'], True);
284+
```
285+
*)
286+
241287
function TRSDepositBox.DepositItemArray(items: array of TRSBankItem; useQuantityButtons: Boolean): Boolean;
242288
var
243289
item: TRSBankItem;
@@ -258,24 +304,102 @@ begin
258304
Result := False;
259305
end;
260306

307+
(*
308+
## DepositBox.DepositInventory
309+
```pascal
310+
procedure TRSDepositBox.DepositInventory();
311+
```
312+
Clicks the deposit inventory button to deposit all inventory items at once.
313+
314+
Example:
315+
```pascal
316+
DepositBox.DepositInventory();
317+
```
318+
*)
319+
261320
procedure TRSDepositBox.DepositInventory();
262321
begin
263322
if Self.IsOpen then
264323
Self.DepositButtons[ERSDepositButtons.INVENTORY].Click;
265324
end;
266325

326+
(*
327+
## DepositBox.DepositLootBag
328+
```pascal
329+
procedure TRSDepositBox.DepositLootBag();
330+
```
331+
Clicks the deposit loot bag button to deposit all items from the looting bag.
332+
333+
Example:
334+
```pascal
335+
DepositBox.DepositLootBag();
336+
```
337+
*)
338+
267339
procedure TRSDepositBox.DepositLootBag();
268340
begin
269341
if Self.IsOpen then
270342
Self.DepositButtons[ERSDepositButtons.LOOT].Click;
271343
end;
272344

345+
(*
346+
## DepositBox.DepositEquipment
347+
```pascal
348+
procedure TRSDepositBox.DepositEquipment();
349+
```
350+
Clicks the deposit worn items button to deposit all currently equipped items.
351+
352+
Example:
353+
```pascal
354+
DepositBox.DepositEquipment();
355+
```
356+
*)
357+
273358
procedure TRSDepositBox.DepositEquipment();
274359
begin
275360
if Self.IsOpen then
276361
Self.DepositButtons[ERSDepositButtons.WORN].Click;
277362
end;
278363

364+
procedure TRSDepositBox.Draw(img: TImage);
365+
var
366+
i: Integer;
367+
items: TBoxArray;
368+
begin
369+
if not Self.IsOpen() then Exit;
370+
371+
img.DrawColor := $00FFFF;
372+
img.DrawBox(Self.Bounds);
373+
img.DrawColor := $FFFFFF;
374+
img.DrawBox(Self.SlotsArea);
375+
img.DrawColor := $00FF00;
376+
img.DrawBoxArray(Self.InvSlotBoxes, False);
377+
img.DrawColor := $FF0000;
378+
img.DrawBoxArray(Self.EquipSlotBoxes, False);
379+
img.DrawColor := $FFFF00;
380+
img.DrawBoxArray(Self.FindItemBoundaries(), False);
381+
img.DrawColor := $00FF00;
382+
383+
for i := 0 to 4 do
384+
begin
385+
Self.QuantityButtons[i].Draw(img);
386+
end;
387+
388+
for i := 0 to 2 do
389+
begin
390+
Self.DepositButtons[i].Draw(img);
391+
end;
392+
end;
393+
394+
procedure ShowOnTarget(depositBox: TRSDepositBox); overload;
395+
var
396+
img: TImage;
397+
begin
398+
img := Target.GetImage();
399+
depositBox.Draw(img);
400+
img.Show();
401+
end;
402+
279403
var
280404
(*
281405
## DepositBox variable

0 commit comments

Comments
 (0)