Skip to content

Commit debcb3c

Browse files
committed
Bank.IsSlotLocked
Added a bank function to check if an inventory slot is locked. Added NPC_CONTACT to RS_INSTANT_THROW_SPELLS.
1 parent ac74d37 commit debcb3c

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

osrs/interfaces/gametabs/magic.simba

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ const
7171
ERSSpell.CARRALLANGAR_TELEPORT,
7272
ERSSpell.ARCEUUS_HOME_TELEPORT,
7373
ERSSpell.WATERBIRTH_TELEPORT,
74-
ERSSpell.SENNTISTEN_TELEPORT
74+
ERSSpell.SENNTISTEN_TELEPORT,
75+
ERSSpell.NPC_CONTACT
7576
]);
7677

7778
type

osrs/interfaces/mainscreen/bank.simba

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,31 @@ begin
14391439
Result := Self.Open(npc, walk);
14401440
end;
14411441

1442+
(*
1443+
## Bank.IsSlotLocked
1444+
```pascal
1445+
function TRSBank.IsSlotLocked(slot: Integer): Boolean;
1446+
```
1447+
Checks if an inventory slot is locked.
1448+
This assumes that the bank interface is open as locked slots are only visible with the bank open.
1449+
1450+
Example:
1451+
```pascal
1452+
{$I WaspLib/osrs.simba}
1453+
begin
1454+
if Bank.IsSlotLocked(0) then
1455+
WriteLn('Slot 0 is locked');
1456+
end.
1457+
```
1458+
*)
1459+
function TRSBank.IsSlotLocked(slot: Integer): Boolean;
1460+
var
1461+
box: TBox;
1462+
begin
1463+
box := Inventory.Slots.Box(slot);
1464+
Result := Target.FindColor($0000ff, 4, box.Expand(2, 1)).Intersection(box.Expand(1, 0).Corners).Length = 4;
1465+
end;
1466+
14421467
var
14431468
(*
14441469
## Bank variable

0 commit comments

Comments
 (0)