Randactyl / AdvancedFilters

ESO addon - Advanced Filters (original work by ingeniousclown)
http://www.esoui.com/downloads/info245-AdvancedFilters.html
5 stars 4 forks source link

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

Open Randactyl opened 6 years ago

Randactyl commented 6 years ago
  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 commented 6 years ago

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 commented 6 years ago

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.)