Quantcast
Download
(2 Kb)
Download
Updated: 08/04/18 03:02 PM
Addon for:
Advanced Filters.
Pictures
File Info
Compatibility:
Summerset (4.0)
Dragon Bones (3.3)
Clockwork City (3.2)
Horns of the Reach (3.1)
Morrowind (3.0)
Updated:08/04/18 03:02 PM
Created:03/17/18 03:26 PM
Monthly downloads:84
Total downloads:4,539
Favorites:22
MD5:
Categories:Plug-Ins & Patches, Bags, Bank, Inventory
Advanced Filters - Duplicate Filter
Version: 1.2
by: hobicabobjob [More]
This addon adds a 'duplicate' option to Advanced Filters, which filters your items by only items for which you have at least two copies.

This is useful for hoarders when clearing bag space, helping identify items you have other copies of.

Credits:

Chuaznega for fixes to new Advanced Filters changes
Baertram for fixes to new Advanced Filters changes, German translation
Archived Files (2)
File Name
Version
Size
Uploader
Date
1.1
2kB
hobicabobjob
07/31/18 02:28 PM
1.0
2kB
03/17/18 03:26 PM


Post A Reply Comment Options
Unread 03/13/19, 02:07 AM  
Marazota

Forum posts: 145
File comments: 1126
Uploads: 0
Originally Posted by Baertram
At the time this addon plugin was build AF beta was not release so I think it's not working at crafting stations for the moment.
I'll have a look what needs to be altered in the plugin code so it supports the crafting stations as well.
thanks! will wait
Report comment to moderator  
Reply With Quote
Unread 03/10/19, 06:07 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2493
File comments: 2777
Uploads: 57
At the time this addon plugin was build AF beta was not release so I think it's not working at crafting stations for the moment.
I'll have a look what needs to be altered in the plugin code so it supports the crafting stations as well.

Problems also known:
The plugin here only compares the item names. So it's a string comparison. Items with teh same data but different names are not recognized as duplicates this way (e.g. a set item from setA which can be found as "Ring of setA" in overland/dungeons and "Ring of NPC name" from a quest won't count as duplicate this way.

-2 rings with the same name + trait just show up as well. Cannot prevent this so far.
-Items not having the same name won't count as duplicate. The plugin just checks the names.
One could do much mor complicated checks like:
-Same itemType, same itemSpecializedItemType, same level, same qualiry, same setId, same ....
But this might lag the inventories then if all this needs to be compared...
Or maybe just compare the uniqueItemIds which should be different if the trait, quality and level are d

Originally Posted by Marazota
soooo

its a bug? fix pls

i have 3 rings but filter said 0 items





same about other crafting stations
addon NOT WORKING AT ALL


im using Advanced filters - Beta
Report comment to moderator  
Reply With Quote
Unread 03/10/19, 05:47 AM  
Marazota

Forum posts: 145
File comments: 1126
Uploads: 0
soooo

its a bug? fix pls

i have 3 rings but filter said 0 items





same about other crafting stations
addon NOT WORKING AT ALL


im using Advanced filters - Beta
Last edited by Marazota : 03/10/19 at 05:50 AM.
Report comment to moderator  
Reply With Quote
Unread 08/04/18, 04:49 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2493
File comments: 2777
Uploads: 57
Re: Re: Re: Re: Fix for Summerset API Version: 100023

The error occurs only at crafting stations as the slot of each item at teh crafting station inventory is different from the normal inventorySlot. The structure of bagId and slotIndex is different.

About your counter within the function GetFilterCallbackForDuplicate(9:
I think you do not understand how the function works in detail.
Your counter just counts the number of duplicate items internally in the function and then returns true or false to tell the filter system in ESO that this filter function should hide/filter (false) the item, or show it (true).
It will be run on EACH item in your inventory.
So the counter is just useless as it will check on the first inventory item if there are duplictes, counts to maybe 10 if you got 10 duplicate items, and even checks ALL other items in your inventory (thus not increasing the counter if not duplicate). After this you got the counter = 10 and the return value = true -> item is duplicate so show it.

Then the next item will get the same check, comparing all other items again in your inventory.
And so on.

So you are just increasing the workload for the checks as each item will be compared multiple times with another item, increasinga non used counter internally, for each inventory row.

If you just return true as the item is duplicate the other items won't be compared to this item anymore and the filtering takes place as it should.

Hope this explains the filtering methods better to you.

Originally Posted by hobicabobjob
I was unable to reproduce the error you got, but did see the different function sig in the new version of Advanced Filters. I've updated the code to handle the new param.

I opted to continue keeping count on items and finishing the entire list, as the time complexity remains the same, and it will display all duplicates instead of only the first, which I believe is useful.

Thank you for the translation, it is now included. Please let me know if you still get any errors.
Report comment to moderator  
Reply With Quote
Unread 08/04/18, 02:59 PM  
hobicabobjob
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 4
Uploads: 1
Re: Re: Re: Fix for Summerset API Version: 100023

I was unable to reproduce the error you got, but did see the different function sig in the new version of Advanced Filters. I've updated the code to handle the new param.

I opted to continue keeping count on items and finishing the entire list, as the time complexity remains the same, and it will display all duplicates instead of only the first, which I believe is useful.

Thank you for the translation, it is now included. Please let me know if you still get any errors.
Report comment to moderator  
Reply With Quote
Unread 07/31/18, 03:15 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2493
File comments: 2777
Uploads: 57
Re: Re: Fix for Summerset API Version: 100023

I think the plugin is still not compatible with the most actual AdvancedFilter version!
You forgot to add the 2nd parameter to the GetFilterCallBackForDuplicate() function like the other plugions have now.

And you could even speed it up a lot if you exit the loop after the first found duplicate entry as otherwise it's checking EACH inventory item and is just increasing the counter i for nothing!

Plus you do not need this plugin to load with the event manager onaddon loaded. Just let it be DependingOn AdvancedFilters in the manifest txt file like it is, and that is enough

Oh and I've added the German translation for you.

Please test this version, it should be compatible and faster:

Lua Code:
  1. local util = AdvancedFilters.util
  2.  
  3. --[[----------------------------------------------------------------------------
  4.     The anonymous function returned by this function handles the actual
  5.         filtering.
  6.     Use whatever parameters for "GetFilterCallback..." and whatever logic you
  7.         need to in "function(slot)".
  8.     "slot" is a table of item data. A typical slot can be found in
  9.         PLAYER_INVENTORY.inventories[bagId].slots[slotIndex].
  10.     A return value of true means the item in question will be shown while the
  11.         filter is active. False means the item will be hidden while the filter
  12.         is active.
  13. --]]----------------------------------------------------------------------------
  14. local function GetFilterCallbackForDuplicate()
  15.     return function(slot, slotIndex)
  16.             if util.prepareSlot ~= nil then
  17.                 if slotIndex ~= nil and type(slot) ~= "table" then
  18.                     slot = util.prepareSlot(slot, slotIndex)
  19.                 end
  20.             end
  21.     for _, s in pairs(SHARED_INVENTORY.bagCache[slot.bagId]) do
  22.         if slot.name == s.name then
  23.         return true
  24.         end
  25.         end
  26.     return false
  27.     end
  28. end
  29.  
  30.  
  31. local dropdownCallbacks = {
  32.     {name = "DuplicateFilter", filterCallback = GetFilterCallbackForDuplicate()},
  33. }
  34.  
  35. local strings = {
  36.     ["DuplicateFilter"] = "Duplicates",
  37. }
  38. local stringsDE = {
  39.     ["DuplicateFilter"] = "Doppelte",
  40. }
  41.  
  42.  
  43. --[[----------------------------------------------------------------------------
  44.     This section packages the data for Advanced Filters to use.
  45.     All keys are required except for xxStrings, where xx is any implemented
  46.         language shortcode that is not "en". A few language keys are assigned
  47.         the same table here only for demonstrative purposes. You do not need to
  48.         do this.
  49.     The filterType key expects an ITEMFILTERTYPE constant provided by the game.
  50.     The values for key/value pairs in the "subfilters" table can be any of the
  51.         string keys from the "masterSubfilterData" table in data.lua such as
  52.         "All", "OneHanded", "Body", or "Blacksmithing".
  53.     If your filterType is ITEMFILTERTYPE_ALL then the "subfilters" table must
  54.         only contain the value "All".
  55.     If the field "submenuName" is defined, your filters will be placed into a
  56.         submenu in the dropdown list rather then in the root dropdown list
  57.         itself. "submenuName" takes a string which matches a key in your strings
  58.         table(s).
  59. --]]----------------------------------------------------------------------------
  60.     local filterInformation = {
  61.         filterType = ITEMFILTERTYPE_ALL,
  62.         subfilters = {"All",},
  63.         callbackTable = dropdownCallbacks,
  64.         enStrings = strings,
  65.     deStrings = stringsDE,
  66.     }
  67.     AdvancedFilters_RegisterFilter(filterInformation)


Originally Posted by hobicabobjob
Thanks for debugging, sorry I was late to update it.
Last edited by Baertram : 07/31/18 at 03:16 PM.
Report comment to moderator  
Reply With Quote
Unread 07/31/18, 02:25 PM  
hobicabobjob
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 4
Uploads: 1
Re: Fix for Summerset API Version: 100023

Thanks for debugging, sorry I was late to update it.
Report comment to moderator  
Reply With Quote
Unread 06/13/18, 03:10 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2493
File comments: 2777
Uploads: 57
Error posted in AF comments for updated version from beta zip archive:

user:/AddOns/AdvancedFilters/data.lua:1027: attempt to index a nil value
stack traceback:
user:/AddOns/AdvancedFilters/data.lua:1027: in function 'AdvancedFilters_RemoveDuplicateAddonPlugin'
user:/AddOns/AdvancedFilters/data.lua:1073: in function 'AdvancedFilters_RegisterFilter'
user:/AddOns/AF_FCODuplicateFilter/AF_FCODuplicateFilter.lua:66: in function 'onLoaded
Report comment to moderator  
Reply With Quote
Unread 06/10/18, 03:21 PM  
Chuaznega

Forum posts: 1
File comments: 11
Uploads: 0
Fix for Summerset API Version: 100023

This is the fix for this addon to work based on the new changes on Advanced Filters:

For AF_FCODuplicateFilter.txt
Just change the line 4 and add at the end: 100022 100023

For AF_FCODuplicateFilter.lua
Code:
local util = AdvancedFilters.util

--[[----------------------------------------------------------------------------
    The anonymous function returned by this function handles the actual
        filtering.
    Use whatever parameters for "GetFilterCallback..." and whatever logic you
        need to in "function(slot)".
    "slot" is a table of item data. A typical slot can be found in
        PLAYER_INVENTORY.inventories[bagId].slots[slotIndex].
    A return value of true means the item in question will be shown while the
        filter is active. False means the item will be hidden while the filter
        is active.
--]]----------------------------------------------------------------------------
local function GetFilterCallbackForDuplicate()
    return function(slot)
        --local itemLink = util.GetItemLink(slot)
	--local itemName = zo_strformat(SI_TOOLTIP_ITEM_NAME, itemLink)
	local i = 0
	for k, s in pairs(SHARED_INVENTORY.bagCache[slot.bagId]) do
	    if slot.name == s.name then
		i = i + 1
	    end
        end
    return false or i > 1
    end
end


local dropdownCallbacks = {
    {name = "DuplicateFilter", filterCallback = GetFilterCallbackForDuplicate()},
}

local strings = {
    ["DuplicateFilter"] = "Duplicates",
}


--[[----------------------------------------------------------------------------
    This section packages the data for Advanced Filters to use.
    All keys are required except for xxStrings, where xx is any implemented
        language shortcode that is not "en". A few language keys are assigned
        the same table here only for demonstrative purposes. You do not need to
        do this.
    The filterType key expects an ITEMFILTERTYPE constant provided by the game.
    The values for key/value pairs in the "subfilters" table can be any of the
        string keys from the "masterSubfilterData" table in data.lua such as
        "All", "OneHanded", "Body", or "Blacksmithing".
    If your filterType is ITEMFILTERTYPE_ALL then the "subfilters" table must
        only contain the value "All".
    If the field "submenuName" is defined, your filters will be placed into a
        submenu in the dropdown list rather then in the root dropdown list
        itself. "submenuName" takes a string which matches a key in your strings
        table(s).
--]]----------------------------------------------------------------------------
local function onLoaded(eventCode, addonName)
    if addonName ~= "AF_FCODuplicateFilter" then return end

    local filterInformation = {
        filterType = ITEMFILTERTYPE_ALL,
        subfilters = {"All",},
        callbackTable = dropdownCallbacks,
        enStrings = strings,
    }
    AdvancedFilters_RegisterFilter(filterInformation)
end
EVENT_MANAGER:RegisterForEvent("AF_FCODuplicateFilter_OnLoaded", EVENT_ADD_ON_LOADED, onLoaded)
Last edited by Chuaznega : 06/10/18 at 03:30 PM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: