Skip to content

Commit b072fe9

Browse files
committed
Add LockSlot and UnlockSlot functions to TRSBank
1 parent debcb3c commit b072fe9

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

osrs/interfaces/mainscreen/bank.simba

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,51 @@ begin
14641464
Result := Target.FindColor($0000ff, 4, box.Expand(2, 1)).Intersection(box.Expand(1, 0).Corners).Length = 4;
14651465
end;
14661466

1467+
1468+
(*
1469+
## Bank.LockSlot
1470+
```pascal
1471+
function TRSBank.LockSlot(slot: Integer): Boolean;
1472+
```
1473+
Locks an inventory slot and returns confirmation the slot was locked.
1474+
1475+
Example:
1476+
```pascal
1477+
{$I WaspLib/osrs.simba}
1478+
begin
1479+
if Bank.LockSlot(0) then
1480+
WriteLn('Slot 0 has been locked');
1481+
end.
1482+
```
1483+
*)
1484+
function TRSBank.LockSlot(slot: Integer): Boolean;
1485+
begin
1486+
if Self.IsSlotLocked(slot) then Exit(True);
1487+
Result := Self.Slots.Interact(slot, 'Lock-slot') and SleepUntil(Self.IsSlotLocked(slot), Random(100, 300), 1200);
1488+
end;
1489+
1490+
(*
1491+
## Bank.LockSlot
1492+
```pascal
1493+
function TRSBank.UnlockSlot(slot: Integer): Boolean;
1494+
```
1495+
Unlocks an inventory slot and returns confirmation the slot was unlocked.
1496+
1497+
Example:
1498+
```pascal
1499+
{$I WaspLib/osrs.simba}
1500+
begin
1501+
if Bank.UnlockSlot(0) then
1502+
WriteLn('Slot 0 has been unlocked');
1503+
end.
1504+
```
1505+
*)
1506+
function TRSBank.UnlockSlot(slot: Integer): Boolean;
1507+
begin
1508+
if not Self.IsSlotLocked(slot) then Exit(True);
1509+
Result := Self.Slots.Interact(slot, 'Unlock-slot') and SleepUntil(not Self.IsSlotLocked(slot), Random(100, 300), 1200);
1510+
end;
1511+
14671512
var
14681513
(*
14691514
## Bank variable

0 commit comments

Comments
 (0)