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

Wrong craft bag filter bar shown after visiting guild store #7

Open
Randactyl opened this issue Dec 16, 2017 · 2 comments
Open

Wrong craft bag filter bar shown after visiting guild store #7

Randactyl opened this issue Dec 16, 2017 · 2 comments

Comments

@Randactyl
Copy link
Owner

  1. Open inventory (I)
  2. Click craft bag
  3. Click a filter (Clothing)
  4. Click a subfilter (Materials)
  5. Close inventory (I, Alt, Esc)
  6. Talk to non-crown banker (E)
  7. Open guild store (click, 3)
  8. Close guild store (Alt, Esc)
  9. Open inventory (I)
  10. Done
@Baertram
Copy link
Collaborator

Baertram commented Dec 17, 2017

Had same problems withing FCOItemSaver e.g. opening the mail panel via keybind directly after the inventory was showing the craftbag. Depening on other addons like CraftBag Extended it was kind of a mess (depending on your last used panel,inventory or craftbag).
I've coded a check into the addon where I use the craftbag scene to save some info like the "parent panel" (= inventory if craftbag shown at inventory, = mail if craftbag shown at mail, =guildstore if cratfbag shown at guildstore) and this way I was able to determine the correct filters.

Maybe this could help you for the AF filterbars and subfilters too, or if it's only a problem at the guildstore -> Maybe put a callback to "guild store closed event" or a callback at inventory scene , check if currentStet == SCENE_SHOWING and set the right filter panel again.

@Baertram
Copy link
Collaborator

Baertram commented Oct 4, 2018

This seems to happen because the variable for the currentFilter at the craftbag inventory (PLAYER_INVENTORY.inventories[INVENTORY_CRAFT_BAG]) is 0 if you reopen the inventory after the guild store.
0 = "ALL" filter button at the craftbag.
But it should be the selected value from before then (clothing -> material ITEMFILTERTYPE = 14).

Upon opening the guild store the value is still 14, so everything is fine until the guild store gets closed.
Even after closing the guild store the value is still 14. So it must be reset as you re-open the inventory afterwards.

Edit:
This will also happen if you have opened the craftbag before and changed filters to e.g. enchanting, runes., Then switch to the mail send panel and change filters in your inventory there to armor, light armor. Then press the I key to get to your inventory -> craftbag will be shown but the enchantment entry only shows the ALL subfilter, no runes etc. anymore.

Found the problem.
Upon reopening the inventory after the guild store the craftbag scene fragment state OnShowing will call AF.util.ThrottledUpdate("ShowSubfilterBar"... properly.
But all of sudden the PreHook of function PLAYER_INVENTORY:ChangeFilter (ChangeFilterInventory) will also be called!
-> But this function won't have the actual filterTab data updated to the current CRAFTBAG filterbutton 14, it is still at the normal inventory's ALL button 0.

As the throttle function AF.util.ThrottledUpdate() will be called from function ChangeFilterInventory as well it will overwrite the before started function call to ShowSubfilterBar and pass the wrong data with inventory type 1 (Player inventory) to it, breaking the subfilter bar.

If one suppresses the 2nd call to ShowSubfilterBar from function ChangeFilterInventory at this time , the primary call to ShowSubfilterBar will have the craftbag data correctly used and show the subfilter button.

Solution:
Quite complicated as one cannot simply suppress the call to PLAYER_INVENTORY:ChangeFilter (ChangeFilterInventory) if the inventorytype is INVENTORY_CRAFT_BAG, or no subfilter button bars will work anymore.

One needs to find out why the function PLAYER_INVENTORY:ChangeFilter (ChangeFilterInventory) is called here with the wrong data!

A kind of a workaround:
One must register callback functions to the scene names (mail send, guild store, ...) where the problem starts. On SCENE_HIDING state set a prevention variable and then suppress the prehook function ChangeFilterInventory once if this variable is true + set it back to false.

Could be making trouble if you enable the addon CraftBagEnabled, have opened th craftbags at mail, vendor etc. at least once and got them opened as you closed the vendor/mail panels. Then jump between the mail, guildstore, inventory via keybind which wil lshow the last opened craftbags.
-> Tested this, and yeas, it's not working if you jump between inv->craftbag->keybind for mail->change to craftbag->keybind i for inventory->craftbag in inventory (all ok here with preventer variable in mail scene hiding=true)->keybind for mail again ->mail craftbag is not showing the subfilter panels now. Preventer variable needs to be used here too if coming from craftbag fragment and switching to another scene.
So basically the preventer variable needs to be set = true at:
-jump to craftbag fragment, coming from some scenes (LibFilter panel Ids: LF_MAIL_SEND, LF_GUILDSTORE_BROWSE, LF_GUILDSTORE_SELL, maybe LF_VENDOR_SELL as well!)
-jump between the same craftbag fragments but different scenes (from inventory craftbag to m,ail craftbag directly via keybind e.g.)

Baertram added a commit to Baertram/AdvancedFilters that referenced this issue Aug 11, 2019
--Fixed 2019-08-09, AF 1.5.1.8
--6. Guild store sell tab shows subcategories enabled where there are no items in there to sell (maybe bound items exist, or stolen ones)

--Fixed 2019-08-09, AF 1.5.1.8
--Randactyl#7. Junk in inventory: "jewelry" will show as armor AND jewelry, but should only be shown below jewelry
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

No branches or pull requests

2 participants