ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Inventory search boxes & guild store sell tab filters (https://www.esoui.com/forums/showthread.php?t=4913)

merlight 07/20/15 10:23 AM

Inventory search boxes & guild store sell tab filters
 
The basic UI deliberately hides either the filters (guild store sell tab), or the search box (everywhere else). It's not a bug, it's just a feature that doesn't make any sense.

Then there are search box bugs circonian discovered. I guess #2 and #3 are normally hidden because the search box is hidden.

Fun comment from ingame/inventory/inventory.xml
Lua Code:
  1. <!-- not dead, but dreaming... -->
  2. <EditBox name="$(parent)SearchBox"

Now we have a multitude of scattered fixes:
  • AdvancedFilters -- shows+moves search boxes and fixes bug #2
  • AwesomeGuildStore -- adds its own filters to guild store sell tab
  • Circonian's FilterIt -- shows search boxes and fixes bugs
  • Votan's Search Box -- shows+moves+decorates search boxes

Please fill in what I got wrong or missing, out of these add-ons I only use AdvancedFilters, and am so used to it that I sometimes can't tell what's the default behavior.

For me the most annoying part is missing filters at the guild store sell tab. And that's coming from someone who only sells common racial motifs when he finds some, or small stacks of green improvement mats. Like twice a month. It's been even more frustrating since (many months ago) I somehow bugged it in such a way that sometimes the filters were there.

Yesterday I managed to make the default filters show up on the sell tab with very little code, and AdvancedFilters simply work there with no additional changes.

Now I have a dilemma: to fix or not to fix. It's not a bug, but so inherently broken that I want it fixed ;) But I will have to check the presence of AwesomeGuildStore at least, as I don't want to screw other add-ons. Are there any other?

sirinsidiator 07/20/15 01:34 PM

The last time I tried to activate the default sell tab filters for the guild store, I got consistent crashes. It was easier to roll my own version in AGS than to debug the ingame ui code because I already had them made for the search tab.
I won't remove them from AGS, but I can add a setting to disable them if you want to offer a different addon that allows AF to work on the sell tab. Keep in mind that the AGS version of the filters hides items that cannot be sold on the store in addition to filtering categories and uses the same icons as on the search tab though so I don't see any reason to not use them. :P

circonian 07/20/15 02:25 PM

That was something I said I was going to add to FilterIt a long time ago, but never did.
As you said it takes very little code:
EDIT 1: I forgot to hide the quest filter, added.
EDIT 2: Heres one for you...I just realized the trading house additional filter does NOT filter out bound items? Might as well fix that too.
Removed EDIT 2. I just realized it will mess up the filtering libraries for the trading house.
Lua Code:
  1. local function InitTradingHouseLayout()
  2.     BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData.inventoryTopOffsetY = 43  
  3.     BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData.hiddenFilters = { [ITEMFILTERTYPE_QUEST] = true }
  4. end
  5.  
  6. local origSetTradingHouseMode = ZO_InventoryManager.SetTradingHouseModeEnabled
  7. function ZO_InventoryManager:SetTradingHouseModeEnabled(enabled)
  8.     origSetTradingHouseMode(self, enabled)
  9.     ZO_PlayerInventoryTabs:SetHidden(false)
  10. end

Although now that I'm thinking about it. I might as well add it to FilterIt.

QuadroTony 07/20/15 02:43 PM

btw how to filter bound items in your deposit tab when at the guild bank?
you cant deposit em anyway

Randactyl 07/20/15 02:51 PM

Quote:

Originally Posted by QuadroTony (Post 22144)
btw how to filter bound items in your deposit tab when at the guild bank?
you cant deposit em anyway

https://github.com/Randactyl/HideBoundItems

Randactyl 07/20/15 03:09 PM

Quote:

Originally Posted by sirinsidiator (Post 22142)
Keep in mind that the AGS version of the filters hides items that cannot be sold on the store in addition to filtering categories and uses the same icons as on the search tab though so I don't see any reason to not use them. :P

Neither do I. I've been putting off fixing up AF to make guild selling behave because I always just recommend downloading AGS. However, now that circonian has shown how easy it is to make it work, I may go ahead and do something just for completeness.

circonian 07/20/15 03:26 PM

One thing I just thought of though:
Lua Code:
  1. BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData.additionalFilter = function (slot)
  2.             return (slot.quality ~= ITEM_QUALITY_TRASH) and (not slot.stolen) and (not IsItemBound(slot.bagId, slot.slotIndex))
  3.         end
That was a bad idea, don't use it.
It will mess up addons using either of the filtering libraries for the trading house if the library gets loaded first & sets the additional filter and then some other addon changes it. That could of course be fixed, by saving the original additional filter & calling it with the new function, but you'de never be able to remove the changes. Although would that be necessary? Do you ever need to see bound items...well I guess it would be ok.
Lua Code:
  1. local origAdditionalFilter = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData.additionalFilter
  2. BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData.additionalFilter = function (slot)
  3.             return origAdditionalFilter(slot) and (not IsItemBound(slot.bagId, slot.slotIndex))
  4.         end

sirinsidiator 07/20/15 03:29 PM

Okay. In this case I suggest everyone adds a setting to disable it and on updating the addon checks if there is already another addon running that offers this feature.
Instead of checking for specific addons we could set a flag on BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData. The first to set it stays active, all the others deactivate themselves until the user activates them again and reloads the UI. That way there should not be any conflicts and the user can decide which version he prefers.

circonian 07/20/15 04:59 PM

How about sellFiltersEnabled
I would also recommend then no one hooks SetTradingHouseModeEnabled like I suggested. No reason for every addon to be hooking into that if their not even going to use it.
Switched to prehook the HandleTabSwitch(...) that way only the addon who is handling the sell filters will need to set a hook.
Lua Code:
  1. local function InitTradingHouseLayout()
  2.     local layoutData = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData
  3.     local sellFiltersEnabled = layoutData.sellFiltersEnabled
  4.     -- Check if someone has already enabled it:
  5.     if sellFiltersEnabled then return end
  6.    
  7.     -- Check if its turned on in my addon:
  8.     if not MY_ADDON_SETTING_ON then return end
  9.    
  10.     -- Set flag:
  11.     layoutData.sellFiltersEnabled = true
  12.    
  13.     -- Set the new layoutData:
  14.     layoutData.inventoryTopOffsetY = 43
  15.     layoutData.hiddenFilters = { [ITEMFILTERTYPE_QUEST] = true }  
  16.     local origAdditionalFilter = layoutData.additionalFilter
  17.     layoutData.additionalFilter = function (slot)
  18.                 return origAdditionalFilter(slot) and (not IsItemBound(slot.bagId, slot.slotIndex))
  19.             end
  20.    
  21.     -- Prehook HandleTabSwitch for sell mode:
  22.     local function OnHandleTabSwitch(self, tabData)
  23.         local mode = tabData.descriptor
  24.        
  25.         if mode == ZO_TRADING_HOUSE_MODE_SELL then
  26.             ZO_PlayerInventoryTabs:SetHidden(false)
  27.         end
  28.         return false
  29.     end
  30.     ZO_PreHook(TRADING_HOUSE, "HandleTabSwitch", OnHandleTabSwitch)
  31. end

merlight 07/20/15 05:08 PM

@circonian: I have the code, including bound items filtering and hiding statValue column, I just need to make sure it doesn't break other add-ons. I'm a little off-focus now, hopefully I can test later this week.

@sirinsidiator: I'm not a fan of unnecessary toggles, keep it simple for users. And yourself as well. Guild store scene seems to be AwesomeGuildStore's domain, I can easily check for its presence and skip tackling with it.

circonian 07/20/15 05:31 PM

Quote:

Originally Posted by merlight (Post 22150)
Guild store scene seems to be AwesomeGuildStore's domain, I can easily check for its presence and skip tackling with it.

I agree, that would be the best method. If they want to use AGS they might as well use those filters and as you said it will keep it simple. AGS is actually the reason I never added this feature, but now I figure it might as well for those that dont use it.

sirinsidiator 07/21/15 04:20 AM

@merlight of course you can add code to watch out for a specific addon, but I always try to achieve compatibility in a generic way that can be reused by new addons in the future

Maybe you can make a small library instead of everyone making their own version?
That way you don't have to do anything special to make it work between your addons.

circonian 07/21/15 11:16 AM

Quote:

Originally Posted by sirinsidiator (Post 22165)
Maybe you can make a small library instead of everyone making their own version?
That way you don't have to do anything special to make it work between your addons.

For our addons it would need the same code, both Advanced Filters & FilterIt use the default inventory menu bar (with a subBar), but how would AGS or other addons that want to use their own menu bar handle it? Do you still want to use a flag to decide which filter bars get shown? If were doing it in a library I'de rather not watch for loading addons. That would force library updates if addons make changes or new addons are released wanting to use their own bars as well like AGS.

Example Lib:
Warning: Spoiler

Then for an addon like AGS that doesn't want to use those bars you could check to see if the flag is set & if not set it and use your bars.

One other problem, if we use a library, it will pretty much be whichever addon loads first wins without giving the user an option to select which bars to use, unless someone has a suggestion on how to handle that part.

merlight 07/21/15 01:54 PM

Quote:

Originally Posted by circonian (Post 22172)
One other problem, if we use a library, it will pretty much be whichever addon loads first wins without giving the user an option to select which bars to use, unless someone has a suggestion on how to handle that part.

Perhaps I found a way. My lib does its overrides in EVENT_PLAYER_ACTIVATED. Unless an add-on calls lib:disableGuildStoreSellFilters() in their EVENT_ADD_ON_LOADED handler, the lib proceeds to enable the default filters.

circonian 07/21/15 03:37 PM

Quote:

Originally Posted by merlight (Post 22180)
Perhaps I found a way. My lib does its overrides in EVENT_PLAYER_ACTIVATED. Unless an add-on calls lib:disableGuildStoreSellFilters() in their EVENT_ADD_ON_LOADED handler, the lib proceeds to enable the default filters.

  1. That would put all of the work on AGS (and any other addon) to have a setting to turn it off & not call that function if they want to see the filter bars of another addon though. Another addon wanting to use the default inventory menu bar would have no way of overriding anyone else who runs that function if the user wants to display those bars via a setting they chose (unless that setting is in AGS, everyone else would be dependent upon the setting in AGS).
  2. It would also not solve any problems if more than one addon called that so they could each display their own menu bars.

No matter what though there is going to be an unsolvable conflict if the user chooses to show the menu bars for multiple addons...although ??? would it be a good thing to allow it? Yes it would be a mess several menu bars showing, but it would help the user figure out whats wrong rather than wondering why xxx addons menu bars aren't visible and some other menu bars are.

How about instead of using a lib function to "block" the default inventory menu bars create a function that must be called to enable the defualt menu bars. This way each addon can handle its own code & not worry about any other addon. Each addon would be required only to have a setting that would allow users to turn the given addons menu bars ON/OFF.
  • If ON the addon does what it needs to show its menu bars. If their custom, run whatever code you need. If its the default menu bars call that lib function.
  • If OFF the addon just does nothing & does not call the lib function and does not create its own menu bars.

If a user turns on menu bars from multiple addons then they just need to turn some of them off in the settings.

circonian 07/21/15 03:54 PM

Actually forget that last post....I have a better idea.

How about we create a settings menu panel just for the menu bars. Register the panel with LibAddonMenu just like its an addon and only have 1 setting, which menu bars to display. Each addon could call something like:
Lua Code:
  1. lib:RegisterTradeHouseSellMenuBars(string displayText, function:nillable callback)
to register that it has menu bars to be shown for the trade house sell filters and the user chooses in the settings menu which one they want, but the setting would be in its own panel and then we don't all need to create our own ON/OFF settings. This would eliminate the problem of needing to know which addons are turned ON/OFF and would prevent multiple menu bars from getting shown.

The callback would be nillable and any addon wanting the default menu bars could just pass nill for the callback and then the library could just handle that code on its own.

FilterIt does not have filters for the browse category in the trade house. I know AGS does, do any other addons? While were at it we might as well add a register function for that as well. They should be separate registrations so that, for example, A user could choose to display the FilterIt menu bars for the sell tab, but still have the AGS filters on the browse tab.

sirinsidiator 07/21/15 04:19 PM

I think a dedicated settings menu is over-complicating it a bit.

If I understood it correctly, we currently have two different sell tab bars. My AGS custom bar and the default ingame bar.
You are trying to activate the ingame bar through the code posted by merlight in 3 separate addons.
If a user has more than one of these the other two do not need to run the same code to activate the ingame bar again, so I said we could put it in a library because it will only load once by design.

The only problem left is to handle if a user has the AGS bar running, which I would solve by including the library too and offering a setting in AGS. If it is set to show the my bar, I will call a method on the library to deactivate its functionality and call my own code. If it is set to off, I won't do anything and the library will work normally.

Unless you have plans to make a custom sell tab bar this should be all that is necessary.

circonian 07/21/15 04:30 PM

Quote:

Originally Posted by sirinsidiator (Post 22188)
I think a dedicated settings menu is over-complicating it a bit.

It was just an idea I thought would be a simple solution. I'm ok with whatever.

Quote:

Originally Posted by sirinsidiator (Post 22188)
You are trying to activate the ingame bar through the code posted by merlight in 3 separate addons.
If a user has more than one of these the other two do not need to run the same code to activate the ingame bar again, so I said we could put it in a library because it will only load once by design.

I'm not sure what you mean, merlight hasn't posted any code. But if your talking about the first code I posted it only activates 1 time regardless of how many addons have it. I was using the idea you suggested of setting a flag which prevents the other addons from running the same code:
Quote:

Originally Posted by sirinsidiator (Post 22188)
Instead of checking for specific addons we could set a flag on BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData

Lua Code:
  1. local sellFiltersEnabled = layoutData.sellFiltersEnabled
  2.     -- Check if someone has already enabled it:
  3.     if sellFiltersEnabled then return end
  4.    
  5.     -- Check if its turned on in my addon:
  6.     if not MY_ADDON_SETTING_ON then return end
  7.    
  8.     -- Set flag -- prevents other addons from running
  9.     -- this code because of check above:
  10.     layoutData.sellFiltersEnabled = true

Quote:

Originally Posted by sirinsidiator (Post 22188)
Unless you have plans to make a custom sell tab bar this should be all that is necessary.

But no I have no plans of doing so and as I said I'm good with whatever you guys want to do. I was just offering some ideas.

sirinsidiator 07/21/15 04:39 PM

Ah. Sorry. I was somehow thinking that he had some code in his initial post. :o

merlight 07/22/15 08:13 AM

I'll try to better explain my thought process. I'll post the "libCommonInventoryFilters" later today.

Currently on the SELL tab we either have no filters (because the basic UI hides them), or custom AGS filters. AGS doesn't need to worry about conflicts, it just fills empty space. If another add-on wanted to put its own custom filters there, it would have to talk to AGS, or they would both need a toggle -- similar to how numerous combat add-ons have a toggle for every feature, and people mix them up in the most unimaginable ways. The idea of a centralized "pick one" setting is interesting, but it seems overkill for what we currently have. Perhaps if there were many contestants, but I doubt that will happen.

So, I wanted the default filters on the SELL tab, when AGS is not there. With AGS I don't really care, as long as there's exactly one set of filters :)
The library says: "If you load me, I'm going to put filters on the SELL tab, unless you intend to put something better in there, in which case you need to explicitly tell me!" (does that make sense?)
You may have 3 add-ons wanting to put their controls in there, the library doesn't care how they get along, it just won't interfere if at least one of them tells it not to.

AF can include the library and do nothing else, it will just work.
FilterIt can include it and it will almost work (I just need to figure out why it's wrongly anchored).
AGS can include it, but must also call libCIF:disableGuildStoreSellFilters() in its EVENT_ADD_ON_LOADED, otherwise both sets would show up and overlap. It doesn't need to have a toggle, it can simply prefer its own filters.

---

Now the difficult part: the search box. When filters are enabled on the SELL tab, there's no room for it.

AF moves the search box to the top, above filters. Which kinda makes sense, since the search persists as you switch filters. Btw, AF shows the search box on startup only, if you open/close the guild store, it won't appear in inventory/bank again. But don't worry, libCIF solves that, too.

AGS moves the search box below its filters on EVENT_OPEN_TRADING_HOUSE, and moves it back to the original location on EVENT_CLOSE_TRADING_HOUSE. This will probably need to be changed. I don't know when exactly these events occur, but if the CLOSE happens after SCENE_HIDING, I'd need to find a way to run another move function after that. But as with AF the search persists while switching filters, it'd probably be best to move it to the top.

FilterIt enables the search box, but uses it differently. It only works on the generic ALL filter, other top-level filters and sub-filters don't have a search box. Which means in the case of FilterIt, having the search box down there next to sub-filters actually makes sense. So I added libCIF:disableSearchBoxes(), which prevents the lib from showing search boxes and moving them to the top. Now I'm trying to figure out how to make FilterIt look nice on the SELL tab.

---

And because adding filters forced me to play with the search box, the lib (by default) also moves search boxes to the AF location, and contains circonian's bug fixes as a bonus.

merlight 07/22/15 12:24 PM

I've done some tests combining libCommonInventoryFilters with the following:
  • AF ... no problem
  • AGS ... after leaving guild store, search box in inventory overlaps with sort headers
  • AGS + AF ... same problem as AGS alone, only worse because now it overlaps with AF sub-filters
  • FilterIt ... no problem
  • AGS + FilterIt ... no problem

Here's what I changed in AwesomeGuildStore:

diff Code:
  1. diff -ru autoupdate/unpacked/AwesomeGuildStore/SalesCategorySelector.lua modified/AwesomeGuildStore/SalesCategorySelector.lua
  2. --- autoupdate/unpacked/AwesomeGuildStore/SalesCategorySelector.lua 2015-07-05 14:25:22.000000000 +0200
  3. +++ modified/AwesomeGuildStore/SalesCategorySelector.lua    2015-07-24 02:28:17.000000000 +0200
  4. @@ -70,20 +70,13 @@
  5.         selector:CreateSubcategory(name, category, preset)
  6.     end
  7.  
  8. -   local searchBoxControl = ZO_PlayerInventorySearchBox
  9. -   searchBoxControl:SetDrawLayer(3) -- make sure the text box is above the sort by name field
  10.     local filterDividerControl = ZO_PlayerInventoryFilterDivider
  11. -   local sortByControl = ZO_PlayerInventorySortBy
  12.     local wasFilterDividerHidden
  13.     local function Activate()
  14. -       searchBoxControl:ClearAnchors()
  15. -       searchBoxControl:SetAnchor(TOPLEFT, sortByControl, TOPLEFT, 220, 3)
  16.         wasFilterDividerHidden = filterDividerControl:IsHidden()
  17.         filterDividerControl:SetHidden(true)
  18.     end
  19.     local function Deactivate()
  20. -       searchBoxControl:ClearAnchors()
  21. -       searchBoxControl:SetAnchor(TOPRIGHT, searchBoxControl:GetParent(), TOPRIGHT, -26, 68)
  22.         filterDividerControl:SetHidden(wasFilterDividerHidden)
  23.     end
  24.     RegisterForEvent(EVENT_OPEN_TRADING_HOUSE, Activate)
  25. @@ -221,8 +214,9 @@
  26.  local BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT_BASIC = ZO_BackpackLayoutFragment:New(
  27.     {
  28.         width = 670,
  29. -       backpackOffsetY = 145,
  30. -       sortByOffsetY = 114,
  31. +       inventoryTopOffsetY = -20 + 65,
  32. +       backpackOffsetY = 145 - 65,
  33. +       sortByOffsetY = 114 - 65,
  34.         sortByHeaderWidth = 670,
  35.         sortByNameWidth = 352,
  36.         hideAlliancePoints = true,
  37. @@ -232,8 +226,9 @@
  38.  local BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT_ADVANCED = ZO_BackpackLayoutFragment:New(
  39.     {
  40.         width = 670,
  41. -       backpackOffsetY = 181,
  42. -       sortByOffsetY = 149,
  43. +       inventoryTopOffsetY = -20 + 65,
  44. +       backpackOffsetY = 181 - 65,
  45. +       sortByOffsetY = 149 - 65,
  46.         sortByHeaderWidth = 670,
  47.         sortByNameWidth = 352,
  48.         hideAlliancePoints = true,

diff Code:
  1. diff -ru autoupdate/unpacked/AwesomeGuildStore/wrappers/TradingHouseWrapper.lua modified/AwesomeGuildStore/wrappers/TradingHouseWrapper.lua
  2. --- autoupdate/unpacked/AwesomeGuildStore/wrappers/TradingHouseWrapper.lua  2015-07-05 14:25:22.000000000 +0200
  3. +++ modified/AwesomeGuildStore/wrappers/TradingHouseWrapper.lua 2015-07-24 02:36:33.000000000 +0200
  4. @@ -10,6 +10,11 @@
  5.  end
  6.  
  7.  function TradingHouseWrapper:Initialize(saveData)
  8. +    local libCIF = LibStub:GetLibrary("libCommonInventoryFilters", "SILENT")
  9. +    if libCIF then
  10. +        libCIF:disableGuildStoreSellFilters()
  11. +    end
  12. +
  13.     self.saveData = saveData
  14.     local tradingHouse = TRADING_HOUSE
  15.     self.tradingHouse = tradingHouse


And here's what I changed in FilterIt:

diff Code:
  1. diff -ru autoupdate/unpacked/FilterIt/Layout/FilterIt_InvLayout.lua modified/FilterIt/Layout/FilterIt_InvLayout.lua
  2. --- autoupdate/unpacked/FilterIt/Layout/FilterIt_InvLayout.lua  2015-03-08 21:31:18.000000000 +0100
  3. +++ modified/FilterIt/Layout/FilterIt_InvLayout.lua 2015-07-22 19:42:39.000000000 +0200
  4. @@ -8,22 +8,28 @@
  5.  local function LayoutBackpack()
  6.     ZO_PlayerInventorySearchBox:SetDimensions(SEARCH_BOX_WIDTH, SEARCH_BOX_HEIGHT)
  7.    
  8. -   local tBackpackLayouts = {
  9. -   [1] = BACKPACK_BANK_LAYOUT_FRAGMENT.layoutData,
  10. -   [2] = BACKPACK_MENU_BAR_LAYOUT_FRAGMENT.layoutData,
  11. -   [3] = BACKPACK_MAIL_LAYOUT_FRAGMENT.layoutData,
  12. -   [4] = BACKPACK_PLAYER_TRADE_LAYOUT_FRAGMENT.layoutData,
  13. -   [5] = BACKPACK_STORE_LAYOUT_FRAGMENT.layoutData,
  14. -   [6] = BACKPACK_FENCE_LAYOUT_FRAGMENT.layoutData,
  15. -   [7] = BACKPACK_LAUNDER_LAYOUT_FRAGMENT.layoutData,
  16. -   --[5] = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData,
  17. -   }
  18. -   for k,v in pairs(tBackpackLayouts) do
  19. -       v.backpackOffsetY = 136
  20. -       v.sortByOffsetY = 103
  21. -   end
  22. +    local libCIF = LibStub:GetLibrary("libCommonInventoryFilters", "SILENT")
  23. +    if libCIF then
  24. +        libCIF:addBackpackLayoutShiftY(40)
  25. +        libCIF:disableSearchBoxes()
  26. +    else
  27. +        local tBackpackLayouts = {
  28. +        [1] = BACKPACK_BANK_LAYOUT_FRAGMENT.layoutData,
  29. +        [2] = BACKPACK_MENU_BAR_LAYOUT_FRAGMENT.layoutData,
  30. +        [3] = BACKPACK_MAIL_LAYOUT_FRAGMENT.layoutData,
  31. +        [4] = BACKPACK_PLAYER_TRADE_LAYOUT_FRAGMENT.layoutData,
  32. +        [5] = BACKPACK_STORE_LAYOUT_FRAGMENT.layoutData,
  33. +        [6] = BACKPACK_FENCE_LAYOUT_FRAGMENT.layoutData,
  34. +        [7] = BACKPACK_LAUNDER_LAYOUT_FRAGMENT.layoutData,
  35. +        --[5] = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData,
  36. +        }
  37. +        for k,v in pairs(tBackpackLayouts) do
  38. +            v.backpackOffsetY = 136
  39. +            v.sortByOffsetY = 103
  40. +        end
  41. +    end
  42.    
  43. -   local FilterItInventoryDivider = CreateControlFromVirtual("FilterIt_InventoryDivider", ZO_PlayerInventory, "ZO_InventoryFilterDivider")
  44. +   local FilterItInventoryDivider = CreateControlFromVirtual("FilterIt_InventoryDivider", ZO_PlayerInventoryTabs, "ZO_InventoryFilterDivider")
  45.     local isValidAnchor, point3, relativeTo3, relativePoint3, offsetX3, offsetY3 = ZO_PlayerInventoryBackpack:GetAnchor(0)
  46.     FilterItInventoryDivider:SetAnchor(point3, relativeTo3, relativePoint3, offsetX3, offsetY3+5)
  47.  end

Note: changing the divider's parent to ZO_PlayerInventoryTabs prevents it from showing in the guild store sell tab when it shouldn't (i.e. with AGS enabled).

circonian 07/22/15 03:29 PM

This code is unnecessary:
Warning: Spoiler


Those columns are already hidden. If your seeing them then some other addon is messing it up:
Warning: Spoiler


Bug? Or are you only counting on me to call this function in FilterIt?
Lua Code:
  1. -- What if multiple addons call this:
  2. function libCIF:addBackpackLayoutShiftY(shiftY)
  3.     libCIF._backpackLayoutShiftY = (libCIF._backpackLayoutShiftY or 0) + shiftY
  4. end
  5. libCIF._backpackLayoutShiftY = nil
  6. libCIF:addBackpackLayoutShiftY(40) -- now its 40
  7. libCIF:addBackpackLayoutShiftY(40) -- now 80
  8. libCIF:addBackpackLayoutShiftY(40) -- now 120


Are we sure these items you left out aren't needed anywhere else?
I know that currentFilter = TradingHouseFilter is used in ShouldAddSlotToList(..) to filter out bound items...although we are breaking that by allowing the menu bar to be shown & buttons to be clicked (yes we also fixed it by adding to the additional filter to hide bound items), but are we sure its not also needed somewhere else? What about code we don't have access to?
Warning: Spoiler

This may be trivial, but by leaving those out it prevents code from knowing which btn was previously selected & returning to it. By saving the current filter, then reloading it, & then calling ZO_MenuBar_SelectDescriptor(inventory.filterBar, inventory.currentFilter) It returns the menu bar to its previously selected descriptor.

circonian 07/22/15 03:31 PM

Quote:

Originally Posted by circonian (Post 22206)
This may be trivial, but by leaving those out it prevents code from knowing which btn was previously selected & returning to it. By saving the current filter, then reloading it, & then calling ZO_MenuBar_SelectDescriptor(inventory.filterBar, inventory.currentFilter) It returns the menu bar to its previously selected descriptor.

Well nevermind on that one, I guess that really doesn't matter because it gets reset in the apply layout
Lua Code:
  1. function ZO_InventoryManager:ApplyBackpackLayout(layoutData)
  2.    ...
  3.     ZO_MenuBar_SelectDescriptor(self.inventories[INVENTORY_BACKPACK].filterBar, ITEMFILTERTYPE_ALL)

merlight 07/22/15 04:04 PM

Hiding those columns is necessary, because this line in inventory.lua
Lua Code:
  1. CreateNewTabFilterData(TradingHouseFilter, INVENTORY_BACKPACK, "", "", "", tradingHouseHiddenColumns),
is essentially a hack. It adds a filter with no button texture, so you can't click it. This filter is only activated from SetTradingHouseModeEnabled, and you can't "escape" that filter because the buttons are hidden.

My override of SetTradingHouseModeEnabled doesn't switch to TradingHouseFilter, it leaves the buttons shown (that's also why I had to add not IsBound to additionalFilter, because that was done by the now-unused TradingHouseFilter). After I did this, those columns showed up, because hiddenColumns are tied to buttons. I wasn't sure about the "statValue" column, but the "age" column really doesn't fit in the SELL tab, that's why I've overridden GetTabFilterInfo.

---

libCIF._backpackLayoutShiftY -- since I haven't initialized it explicitly, and calling addBackpackLayoutShiftY is not required, it could be nil. It was a not-so-important choice where to apply laziness.

---

ZO_MenuBar_SelectDescriptor -- yes you're right. I too was wondering why swapping previousFilter/currentFilter in the original SetTradingHouseModeEnabled doesn't seem to work, I put some debug output in and found the filter was being reset before it had a hance to be remembered :)

---

Anyway, I forgot to add that if you guys decide to use the library, please wait until AGS is ready for it. The search box location must be sorted out first. Perhaps it would suffice if AGS didn't move the search box and just let the lib do it. I'm going to test, but tonight we've got troube with electricity due to a windstorm, can't run ESO on battery :D

circonian 07/22/15 04:25 PM

Quote:

Originally Posted by merlight (Post 22210)
My override of SetTradingHouseModeEnabled doesn't switch to TradingHouseFilter...

Oh, duh. My bad your right. Why don't you want to show the statValue column though?

Quote:

Originally Posted by merlight (Post 22210)
libCIF._backpackLayoutShiftY -- since I haven't initialized it explicitly, and calling addBackpackLayoutShiftY is not required, it could be nil. It was a not-so-important choice where to apply laziness.

Yes, a while later I realized I was wrong & removed that one from the post.

sirinsidiator 07/22/15 04:28 PM

I don't mind if the library handles the searchbox.
The only reason I put it into that place was because some time ago the text filter on the searchtab was also in a similar location. Since I put that one into the filter bar like all the others, there is not really a reason to keep it there.
I will try to implement the necessary changes tomorrow.

merlight 07/22/15 04:42 PM

Quote:

Originally Posted by circonian (Post 22211)
Oh, duh. My bad your right. Why don't you want to show the statValue column though?

Now I suspect myself of choosing the easy way out. That column is only valid for weapons and armor, so the function would need to be smarter than it is :D But yea, it it's desired, it could be added. Although personally I wouldn't miss that column if it disappeared from all inventories, I never read it. Weapon damage/armor rating are arguably the least important properties of gear, maybe after vendor value in gold.

sirinsidiator 07/23/15 12:55 PM

I removed the code that reanchors the search box from AGS, but the library does not move it when I call the disable call. Can you change that, or should I look into it myself?


merlight 07/23/15 06:05 PM

You probably have another add-on moving it then. For me the search box is right beneath the top-most horizontal divider by default, I checked the anchor in Zgoo and it's the one from xml <Anchor point="TOPRIGHT" offsetX="-26" offsetY="68" />

Anyway, don't call libCIF:disableSearchBoxes() from AGS. It's there for FilterIt, which has its own handling.


edit: Ah ok, now I'm staring at my instance of your picture. Ok I need to figure out how it got there :D

edit2: I think it's the layout offsets. I just need to crunch some numbers.

merlight 07/23/15 06:45 PM

I edited the diff for AGS above. The original BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT had inventoryTopOffsetY == -20, the default. In libCIF it is set to 45, the value other layouts use. So I added that to your BASIC and ADVANCED layouts, and moved the other two offsets (which are relative to the Top), 65 units up.

There's still an issue with AGS+FilterIt, where the search box remains in "FilterIt location".

circonian 07/28/15 07:40 PM

Quote:

Originally Posted by merlight (Post 22137)
Fun comment from ingame/inventory/inventory.xml
Lua Code:
  1. <!-- not dead, but dreaming... -->
  2. <EditBox name="$(parent)SearchBox"

lol hadn't seen this one before: libraries/globals/debugutils.lua
Lua Code:
  1. -- Because typing is painful.
  2. e = ZO_Debug_EventNotification

merlight 08/12/15 11:10 AM

Quote:

Originally Posted by merlight (Post 22210)
Anyway, I forgot to add that if you guys decide to use the library, please wait until AGS is ready for it. The search box location must be sorted out first. Perhaps it would suffice if AGS didn't move the search box and just let the lib do it. I'm going to test, but tonight we've got troube with electricity due to a windstorm, can't run ESO on battery :D

I should've emphasized that more :mad:

circonian 08/14/15 04:03 PM

I didn't add it yet. I was waiting for this discussion to finish. Just post here when everything is straightened out & I'll add it to FilterIt.

circonian 08/24/15 07:11 PM

Quote:

Originally Posted by merlight (Post 22210)
Anyway, I forgot to add that if you guys decide to use the library, please wait until AGS is ready for it. The search box location must be sorted out first. Perhaps it would suffice if AGS didn't move the search box and just let the lib do it. I'm going to test, but tonight we've got troube with electricity due to a windstorm, can't run ESO on battery :D

It looks like it has been added to AGS, but the search box location problem looks like it still exists.


It looks like we need something like this to move the search box anchor for AGS and move it back when the trading house (AGS) is done with it:
Warning: Spoiler


Does the search box need to be hidden when AGS is done with it & the trading house closes? Is it supposed to remain visible on other layouts if the user is only using AGS & not FilterIt or Advanced Filters?

merlight 08/25/15 02:44 AM

Quote:

Originally Posted by circonian (Post 22934)
Does the search box need to be hidden when AGS is done with it & the trading house closes? Is it supposed to remain visible on other layouts if the user is only using AGS & not FilterIt or Advanced Filters?

I've just updated AGS, will test it ingame shortly.

FilterIt has added filters to the sell tab after libCIF was conceived, and that might actually solve everything. Basically if the user disables AGS custom sell filters in its settings, and you make the change to FilterIt I posted earlier (addBackpackLayoutShiftY and disableSearchBoxes; edit: and disableGuildStoreSellFilters, because you want FilterIt there, right?), it should be ok. I think you don't even have to include the lib in FilterIt, just try to get it with LibStub.SILENT, and only call those functions if it's there; but perhaps it'll be less error-prone if you include it.

merlight 08/25/15 05:50 AM

Here's my current diff against FilterIt 2.9
diff Code:
  1. diff -ru autoupdate/unpacked/FilterIt/FilterIt.lua modified/FilterIt/FilterIt.lua
  2. --- autoupdate/unpacked/FilterIt/FilterIt.lua   2015-08-10 05:24:30.000000000 +0200
  3. +++ modified/FilterIt/FilterIt.lua  2015-08-25 13:28:05.000000000 +0200
  4. @@ -77,10 +77,6 @@
  5.     FilterIt.SetFilterActivation(ZO_PlayerBankTabs.m_object.m_currentSubMenuBar)
  6.     FilterIt.SetFilterActivation(ZO_GuildBankTabs.m_object.m_currentSubMenuBar)
  7.    
  8. -   -- Changes the layouts for the inventories: Trading House
  9. -   -- Moved to player activation to watch & see if AGS gets loaded
  10. -   FilterIt.LayoutTradingHouse()
  11. -  
  12.     -- Unregister here to catch loaded addons
  13.     EVENT_MANAGER:UnregisterForEvent(FilterIt.name, EVENT_ADD_ON_LOADED)
  14.    
  15. @@ -164,7 +160,6 @@
  16.     FilterIt.HookInvButtons()
  17.    
  18.     -- Changes the layouts for the inventories: backpack, bank, & guild bank, mail, exc..
  19. -   -- Trading House layout is called in player Activation for AGS compatability
  20.     FilterIt.SetLayouts()
  21.    
  22.     FilterIt.BuildImprovementPanelTabMenu()
diff Code:
  1. diff -ru autoupdate/unpacked/FilterIt/Layout/FilterIt_InvLayout.lua modified/FilterIt/Layout/FilterIt_InvLayout.lua
  2. --- autoupdate/unpacked/FilterIt/Layout/FilterIt_InvLayout.lua  2015-07-22 20:27:20.000000000 +0200
  3. +++ modified/FilterIt/Layout/FilterIt_InvLayout.lua 2015-08-25 13:41:47.000000000 +0200
  4. @@ -7,22 +7,10 @@
  5.  local function LayoutBackpack()
  6.     ZO_PlayerInventorySearchBox:SetDimensions(SEARCH_BOX_WIDTH, SEARCH_BOX_HEIGHT)
  7.    
  8. -   -- Trading house is handled in a separate function due to other checks
  9. -   -- that need to be made for AGS & other code that needs to be run.
  10. -   local tBackpackLayouts = {
  11. -   [1] = BACKPACK_BANK_LAYOUT_FRAGMENT.layoutData,
  12. -   [2] = BACKPACK_MENU_BAR_LAYOUT_FRAGMENT.layoutData,
  13. -   [3] = BACKPACK_MAIL_LAYOUT_FRAGMENT.layoutData,
  14. -   [4] = BACKPACK_PLAYER_TRADE_LAYOUT_FRAGMENT.layoutData,
  15. -   [5] = BACKPACK_STORE_LAYOUT_FRAGMENT.layoutData,
  16. -   [6] = BACKPACK_FENCE_LAYOUT_FRAGMENT.layoutData,
  17. -   [7] = BACKPACK_LAUNDER_LAYOUT_FRAGMENT.layoutData,
  18. -   --[5] = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData,
  19. -   }
  20. -   for k,v in pairs(tBackpackLayouts) do
  21. -       v.backpackOffsetY = 136
  22. -       v.sortByOffsetY = 103
  23. -   end
  24. +    -- this enables filters on guild store SELL tab
  25. +    local libCIF = LibStub:GetLibrary("libCommonInventoryFilters")
  26. +    libCIF:addBackpackLayoutShiftY(40)
  27. +    libCIF:disableSearchBoxes()
  28.    
  29.     --local FilterItInventoryDivider = CreateControlFromVirtual("FilterIt_InventoryDivider", ZO_PlayerInventory, "ZO_InventoryFilterDivider")
  30.     -- Changed Parent for AGS
  31. @@ -75,45 +63,10 @@
  32.     FilterItBankDivider:SetAnchor(point0, relativeTo0, relativePoint0, offsetX0, offsetY0+5)
  33.  end
  34.  
  35. -function FilterIt.LayoutTradingHouse()
  36. -   if FilterIt.loadedAddons["AwesomeGuildStore"] then return end
  37. -  
  38. -   local layoutData = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData
  39. -   local sellFiltersEnabled = layoutData.sellFiltersEnabled
  40. -   -- Check if someone has already enabled it:
  41. -   if sellFiltersEnabled then return end
  42. -  
  43. -   -- Check if its turned on in my addon:
  44. -   --if not MY_ADDON_SETTING_ON then return end
  45. -  
  46. -   -- Set flag:
  47. -   layoutData.sellFiltersEnabled = true
  48. -  
  49. -   -- Set the new layoutData:
  50. -   layoutData.inventoryTopOffsetY = 43
  51. -   layoutData.hiddenFilters = { [ITEMFILTERTYPE_QUEST] = true }  
  52. -   local origAdditionalFilter = layoutData.additionalFilter
  53. -   layoutData.additionalFilter = function (slot)
  54. -               return origAdditionalFilter(slot) and (not IsItemBound(slot.bagId, slot.slotIndex))
  55. -           end
  56. -  
  57. -   -- Prehook HandleTabSwitch for sell mode:
  58. -   local function OnHandleTabSwitch(self, tabData)
  59. -       local mode = tabData.descriptor
  60. -      
  61. -       if mode == ZO_TRADING_HOUSE_MODE_SELL then
  62. -           ZO_PlayerInventoryTabs:SetHidden(false)
  63. -       end
  64. -       return false
  65. -   end
  66. -   ZO_PreHook(TRADING_HOUSE, "HandleTabSwitch", OnHandleTabSwitch)
  67. -end
  68.  
  69.  function FilterIt.SetLayouts()
  70.     LayoutBackpack()
  71.     LayoutBank()
  72.     LayoutGuildBank()
  73. -   -- Changed, this is now called in player Activation for AGS compatability
  74. -   --LayoutTradingHouse()
  75.  end

It works regardless of AGS setting "disable custom selltab filter". Although with that setting OFF, the search box slightly overlaps subfilters or items, because it's at FilterIt position. But once you turn it ON, FilterIt shows up on the sell tab, and it looks good.

circonian 08/25/15 12:19 PM

Quote:

Originally Posted by merlight (Post 22936)
I've just updated AGS, will test it ingame shortly.

FilterIt has added filters to the sell tab after libCIF was conceived, and that might actually solve everything. Basically if the user disables AGS custom sell filters in its settings, and you make the change to FilterIt I posted earlier (addBackpackLayoutShiftY and disableSearchBoxes; edit: and disableGuildStoreSellFilters, because you want FilterIt there, right?), it should be ok.

Yes, I made those changes as a temporary measure until this was finished.
Yes it is OK for me, I'm thinking of the problem it is causing AGS when both addons are turned on the search box location is wrong for AGS in the trading house.


Quote:

Originally Posted by merlight (Post 22942)
Here's my current diff against FilterIt 2.9

Yes, I had made those code changes (its not posted, I was just testing on my own).


Quote:

Originally Posted by merlight (Post 22942)
It works regardless of AGS setting "disable custom selltab filter". Although with that setting OFF, the search box slightly overlaps subfilters or items, because it's at FilterIt position. But once you turn it ON FilterIt shows up on the sell tab, and it looks good.

I think your ON/OFF are backwards, but yes that is the problem I was referring to When both settings are ON disableGuildStoreSellFilters & disableSearchBoxes
Quote:

Originally Posted by merlight (Post 22942)
the search box slightly overlaps subfilters or items, because it's at FilterIt position.

The code I posted was an idea to fix that problem by moving the search box for AGS when the trading house is enabled and the disableGuildStoreSellFilters is ON (because that means AGS is going to handle the trading house filters).

Then restore the original search box position when the trading house becomes disabled and the disableGuildStoreSellFilters is ON (because that means we previously moved the search box for AGS when the trading house became enabled).

That way the search box would be in the correct position at all times for everyone.

merlight 08/25/15 02:10 PM

Quote:

Originally Posted by circonian (Post 22952)
I think your ON/OFF are backwards, but yes that is the problem I was referring to When both settings are ON disableGuildStoreSellFilters & disableSearchBoxes

That's kind of a naming confusion -- AGS["disable custom selltab filter"] is inverse to libCIF["disableGuildStoreSellFilters"] because AGS talks about its custom filters, libCIF talks about the default UI filters ;)

Quote:

Originally Posted by circonian (Post 22952)
The code I posted was an idea to fix that problem by moving the search box for AGS when the trading house is enabled and the disableGuildStoreSellFilters is ON (because that means AGS is going to handle the trading house filters).

Then restore the original search box position when the trading house becomes disabled and the disableGuildStoreSellFilters is ON (because that means we previously moved the search box for AGS when the trading house became enabled).

That way the search box would be in the correct position at all times for everyone.

I see, seems to be the best way to fix it without touching AGS itself.

merlight 08/25/15 03:21 PM

Yet another issue with the search box. I added saving/restoring the anchor, enabled AGS custom filters and FilterIt -- and everytime I click an AGS (sub)filter, the search box is cleared. It's all so intertwined :D

circonian 08/25/15 05:40 PM

Quote:

Originally Posted by merlight (Post 22955)
Yet another issue with the search box. I added saving/restoring the anchor, enabled AGS custom filters and FilterIt -- and everytime I click an AGS (sub)filter, the search box is cleared. It's all so intertwined :D

Eew, yeah that's FilterIt clearing the searchBox. Since it only displays the search box on the All tab it has to clear the search box whenever you click a different filter or else the search text would still apply, you would not see everything, & there would be no way to remove it since the search box is hidden on other tabs.

I'm actually surprised the search box isn't getting hidden when using AGS and switching off of the "ALL" tab because FilterIt hides the searchBox. He must have code somewhere else un-hiding it.

circonian 08/25/15 06:03 PM

The only thing I can think of is you could add something like this so I know when AGS has taken over & my filters are not going to be used in the Trading House:
Lua Code:
  1. function libCIF:IsGuildStoreSellFiltersDisabled()
  2.     return libCIF._guildStoreSellFiltersDisabled
  3. end


and then I could add this in FilterIt_MenuBars.lua:
Lua Code:
  1. -- I could add this check before performing clear or SetHidden:
  2. if not (GetInteractionType() == INTERACTION_TRADINGHOUSE and libCIF:IsGuildStoreSellFiltersDisabled()) then
  3.     if currentInvFilter ~= ITEMFILTERTYPE_ALL then
  4.         PLAYER_INVENTORY.inventories[iInventory].searchBox:SetHidden(true)
  5.         PLAYER_INVENTORY.inventories[iInventory].searchBox:Clear()
  6.     else
  7.         -- no submenu or Show ALL filter tab so show the search box.
  8.         PLAYER_INVENTORY.inventories[iInventory].searchBox:SetHidden(false)
  9.         PLAYER_INVENTORY.inventories[iInventory].searchBox:Clear()
  10.     end
  11. end
and that should solve that problem

merlight 08/26/15 03:28 AM

It appears that InvTabSwitch in FilterIt_MenuBars.lua gets called twice per click on AGS filter, always with ITEMFILTERTYPE_ALL. How about removing the :Clear from the else (filter==ALL) branch? I think clearing is only necessary when you're hiding the box.

circonian 08/26/15 04:56 PM

Quote:

Originally Posted by merlight (Post 22960)
It appears that InvTabSwitch in FilterIt_MenuBars.lua gets called twice per click on AGS filter, always with ITEMFILTERTYPE_ALL.

Yeah I noticed that. That function is fired from the games menu bar button callbacks. Since AGS has its own custom menu bar I was actually confused as to why it was firing at all. AGS must be forcing button clicks on the hidden menu bar to do the sorting and clicking it more than once?

Quote:

Originally Posted by merlight (Post 22960)
How about removing the :Clear from the else (filter==ALL) branch? I think clearing is only necessary when you're hiding the box.

That looks like it would work. It looks like the extra :Clear() call is something left over from earlier code when it functioned differently & I was checking to see if a subMenuBar (newMenuBar) existed. I must have just not noticed & moved it up into the else statement when I rewrote it.

merlight 08/27/15 04:33 AM

I've pushed libCIF version 1.1 on github

Quote:

Originally Posted by circonian (Post 22934)
Does the search box need to be hidden when AGS is done with it & the trading house closes? Is it supposed to remain visible on other layouts if the user is only using AGS & not FilterIt or Advanced Filters?

Forgot to reply to this one. I don't use the search box myself. ZOS UI gives you either filter buttons or search box. I prefer consistency.

QuadroTony 08/27/15 05:24 AM

thing is i like AGS search box ar the Trade house
but they must be disabled at the other scenes like inventory, and we will see FilterIt search box there, etc

merlight 08/27/15 05:41 AM

Quote:

Originally Posted by QuadroTony (Post 22992)
thing is i like AGS search box ar the Trade house
but they must be disabled at the other scenes like inventory, and we will see FilterIt search box there, etc

Have you even tried? AGS has a setting now that lets you choose whether you want AGS filters or not (in which case you'll have basic or AdvancedFilters or FilterIt, depending on what you have enabled).

QuadroTony 08/29/15 01:53 AM

Quote:

Originally Posted by merlight (Post 22993)
Have you even tried? AGS has a setting now that lets you choose whether you want AGS filters or not (in which case you'll have basic or AdvancedFilters or FilterIt, depending on what you have enabled).

:D you think i am newb with 140 addons?
ofc i tried
there is no way to change AGS search field from inventory/bank etc for search field from FilterIt without disabling AGS completely

merlight 08/29/15 05:45 AM

Quote:

Originally Posted by QuadroTony (Post 23012)
:D you think i am newb with 140 addons?
ofc i tried
there is no way to change AGS search field from inventory/bank etc for search field from FilterIt without disabling AGS completely

Ah, you mean the wrong placement. That'll be fixed, just be patient. But the search itself works, yes?

QuadroTony 08/29/15 09:58 AM

Quote:

Originally Posted by merlight (Post 22993)
Have you even tried? AGS has a setting now that lets you choose whether you want AGS filters or not (in which case you'll have basic or AdvancedFilters or FilterIt, depending on what you have enabled).

search function woring ofc
also in the guildbank too, thanks to the Circonian fix addon :)


All times are GMT -6. The time now is 02:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI