Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bank improvements #1873

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Bank improvements #1873

wants to merge 10 commits into from

Conversation

Zoinkwiz
Copy link
Owner

@Zoinkwiz Zoinkwiz commented Nov 27, 2024

This PR allows for the potion storage to be considered for requirements, as well as for the bank filtering for removing/adding potions from it. The bank work is based on the way the core Bank Tags plugin has done it for Layouts.

In tandem based on this, this also moves the Quest Helper filter for the bank from moving real bank items around to instead just making items into the items we're interested in, now that it's an allowed method due to implementation in the core client. This generally means quite a lot less processing per bank event.

Widgets which are still made (section headers and dividers, numbers for quantities needed) will now be trimmed off the size of the bank. From across my accounts the max element in BANK_ITEM_CONTAINER is always 1248, BUT this is a bit sketchy as it's possible that 1. this might change, making quest helper cut stuff off improperly, or 2. It's already wrong for some people (maybe more possible with more bank extension things?). Maybe looking at capturing the size on load before doing anything may be a better play here to ensure it's correct in more scenarios.

  • I've updated this now to be dynamic based on initial load.

Finally, to help further with performance, I've removed the non-bank items from being part of quest filtered bank.

Across these changes I'm seeing a massive performance improvement when adding/removing items, so hopefully this is a good step in the right direction, in addition to it being good to support a new container.

Note: The quest bank can wiggle a little bit when removing items, hopefully not a big change needed to fix this but would be good to before releasing.

@Zoinkwiz
Copy link
Owner Author

Main thing is I need to work out the best way to handle the scrolling when at the bottom of a section, as it always seems to jump up a bit.

Copy link
Contributor

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small documentation/naming things, I have not tested this in-game (I don't have potion storage 😢 )

}
public void register(EventBus eventBus)
{
potionStorage.setQuestBankTabInterface(questBankTabInterface);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this being set in register, should it also be unset in unregister?

private final BankSearch bankSearch;

private Potion[] potions;
public boolean cachePotions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/documentation

If I understand it correctly, it's a hint to the PotionStorage's onClientTick function that we should look for the potion storage widget & note down what types of potions are stored in it.

private Potion[] potions;
public boolean cachePotions;
private boolean layout;
private Set<Integer> potionStoreVars;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List of potion ItemIDs(?), or varbits(?) that are interested to us?


private Potion[] potions;
public boolean cachePotions;
private boolean layout;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming - as with the cachePotions, maybe an additional verb saying that "hey, this variable denotes that we'd like something to happen".

boolean foundItem = false;
return count;
}
return potionStorage.count(itemId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you not store the same potion both in the bank & in the potion storage?

@@ -540,7 +539,8 @@ private boolean checkContainersOnPlayer(Client client)

public boolean checkWithBank(Client client)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to checkAllContainers?

@@ -607,7 +611,11 @@ private ItemAndLastUpdated[] containersToCheckDefault()
containers.add(QuestContainerManager.getEquippedData());

if (!equip) containers.add(QuestContainerManager.getInventoryData());
if (shouldCheckBank) containers.add(QuestContainerManager.getBankData());
if (shouldCheckBank)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo the name of containersToCheckDefault is a bit misleading, I would personally move the logic of this function to the check function

@@ -0,0 +1,247 @@
/*
* Copyright (c) 2024, Adam <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add yourself too - looks like you've done enough to warrant it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants