Skip to content

Commit

Permalink
fix: Ensure potion storage properly closed when entering quest bank tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoinkwiz committed Jan 20, 2025
1 parent 31f8213 commit fb1d4bd
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ public void init()

if (questTabActive)
{
boolean wasInPotionStorage = client.getVarbitValue(Varbits.CURRENT_BANK_TAB) == BANKTAB_POTIONSTORE;
questTabActive = false;
clientThread.invokeLater(this::activateTab);
clientThread.invokeLater(() -> activateTab(wasInPotionStorage));
}
}

Expand Down Expand Up @@ -160,6 +161,7 @@ private void handleTagTab(ScriptEvent event)
{
if (event.getOp() == 2)
{
boolean wasInPotionStorage = client.getVarbitValue(Varbits.CURRENT_BANK_TAB) == BANKTAB_POTIONSTORE;
client.setVarbit(Varbits.CURRENT_BANK_TAB, 0);

if (questTabActive)
Expand All @@ -169,7 +171,7 @@ private void handleTagTab(ScriptEvent event)
}
else
{
activateTab();
activateTab(wasInPotionStorage);
// openTag will reset and relayout
}

Expand Down Expand Up @@ -210,14 +212,14 @@ public void refreshTab()
}
}

private void activateTab()
private void activateTab(boolean wasInPotionStorage)
{
if (questTabActive)
{
return;
}

if (client.getVarbitValue(Varbits.CURRENT_BANK_TAB) == BANKTAB_POTIONSTORE)
if (wasInPotionStorage)
{
// Opening a tag tab with the potion store open would leave the store open in the bankground,
// making deposits not work. Force close the potion store.
Expand Down

0 comments on commit fb1d4bd

Please sign in to comment.