Skip to content

Commit

Permalink
fix(bank): add fail safe to bank.depositrandomitems()
Browse files Browse the repository at this point in the history
  • Loading branch information
Torwent committed Apr 9, 2024
1 parent 80b3349 commit b3f4724
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion osr/interfaces/mainscreen/bank.simba
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,19 @@ end;
function TRSBank.DepositRandomItems(items: TRSItemArray): Boolean;
var
slots: TIntegerArray;
t: UInt64;
begin
slots := Inventory.FindRandomItems(items);
t := GetTickCount() + 50000;

while slots <> [] do
begin
if GetTickCount() >= t then
Exit;
if not Self.IsOpen() then //Exit in case the bank somehow closed.
Exit;

if Self.DepositSlot([slots[0], BANK_DEPOSIT_ALL], True) then
if Self.DepositSlot([slots[0], Bank.QUANTITY_ALL], True) then
WaitUntil(not Inventory.IsSlotUsed(slots[0]), 100, 2000);

slots := Inventory.FindRandomItems(items);
Expand Down

0 comments on commit b3f4724

Please sign in to comment.