Skip to content

Commit

Permalink
fix(TBaseBankScript): should properly trigger bankempty when there's …
Browse files Browse the repository at this point in the history
…not enough of the item we need
  • Loading branch information
Torwent committed Sep 14, 2024
1 parent 7c37dcf commit 224f138
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
30 changes: 21 additions & 9 deletions osr/basescript.simba
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ function TBaseBankScript.Withdraw(out item: TRSBankItem; attempts: Int32 = 3): B
var
count, stack, attempt: Int32;
invItem: TRSItem;
b: TBox;
begin
if item.Noted then
invItem := 'Noted ' + item.Item
Expand All @@ -671,18 +672,29 @@ begin
Exit;

count := Inventory.CountItem(invItem);
Result := Bank.WithdrawItem(item, item.Quantity <> 1) and
WaitUntil(
(Inventory.CountItemStack(invItem) > stack) or
(Inventory.CountItem(invItem) > count), 300, 3000
);

if Result then
Exit;
if Bank.FindItem(item, b) then
begin
if Bank.CountItemStack(item.Item) < item.Quantity then
begin
Self.BankEmpty := Bank.IsOpen();
if Self.BankEmpty then
SaveScreenshot('bankempty' + DIRECTORYSEPARATOR + 'bankempty', MainScreen.Bounds());
if Self.CollectEmpty and Self.CollectTimer.IsFinished() then
Self.CollectEmpty := False;
Exit;
end;

Result := Bank.WithdrawHelper(b, item.Quantity, item.Noted, item.Quantity <> 1);
end;

Result := Result and
WaitUntil((Inventory.CountItemStack(invItem) > stack) or
(Inventory.CountItem(invItem) > count), 300, 3000);
if Result then Exit;

Bank.UnHoverIncinerator();
if Bank.IsSearchOpen() then
Bank.CloseSearch();
if Bank.IsSearchOpen() then Bank.CloseSearch();

if attempt > 1 then
Mouse.Move(Bank.GetSlotBoxes().Merge(), True);
Expand Down
4 changes: 0 additions & 4 deletions osr/interfaces/mainscreen/mainscreen.simba
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ end;
```pascal
function TRSMainScreen.FindEnemyHitsplats(): Boolean;
```
Returns the hitsplats on screen that don't belong to the player.
Example:
Expand Down Expand Up @@ -306,7 +305,6 @@ end;
```pascal
function TRSMainScreen.InCombat: Boolean;
```
Returns true if we are currently in combat.
With slow attack speed between you and the enemy this might return false negatives.
Expand All @@ -325,7 +323,6 @@ end;
```pascal
function TRSMainScreen.WaitInCombat(waitTime: Int32; interval: Int32 = -1): Boolean;
```
Waits the specified **waitTime** until we are in combat.
Example:
Expand All @@ -346,7 +343,6 @@ end;
```pascal
function TRSMainScreen.WaitNotInCombat(waitTime: Int32; interval: Int32 = -1): Boolean;
```
Waits the specified **waitTime** until we are nto in combat.
Example:
Expand Down

0 comments on commit 224f138

Please sign in to comment.