Quantcast
Download
(4 Kb)
Download
Updated: 04/21/17 12:19 AM
Pictures
File Info
Compatibility:
Homestead (2.7)
Updated:04/21/17 12:19 AM
Created:03/31/17 10:18 PM
Monthly downloads:113
Total downloads:1,846
Favorites:8
MD5:
Categories:Bags, Bank, Inventory, Plug-Ins & Patches
Advanced Filters - Crafted Set plugin
Version: 2.0.1
by: Marsouin [More]
Crafted set filter plugin for Advanced Filters

This is a filter plugin for the dynamic filters of the "Advanced Filters" addon.
You are able to filter the crafted weapons and armor by their name from the dropdown box.

v2.0.1 : submenu "all crafted sets" + sort by name, by Baertram
v2.0.0 : Many thanks to Baertram, for the idea and his help in rewriting the code

TODO :
russian translation
sub sub menus
- Sort the set names by name
- All Crafted Set entry
- translation fixed
Optional Files (0)


Archived Files (3)
File Name
Version
Size
Author
Date
2.0.0
3kB
Marsouin
04/13/17 10:29 PM
1.0.1
6kB
Marsouin
04/02/17 12:49 AM
1.0
5kB
Marsouin
03/31/17 10:18 PM


Post A Reply Comment Options
Unread 04/08/17, 03:12 AM  
Marsouin
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 3
Uploads: 2
I started working on your code.

The problem with working with Ids is that we can not access with itemId; There is one by piece and by line.

For example, you give me the itemId 76106 :

the itemId 76106 is for the Pelinal's chest,
but the Infused Pelinal's chest have the itemId 76141, and so on...
Report comment to moderator  
Reply With Quote
Unread 04/03/17, 11:49 AM  
Marsouin
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 3
Uploads: 2
Thx a lot Baertram, I'll have a big look at your code.

As you can see, the skelet of my plugin come from your work
Report comment to moderator  
Reply With Quote
Unread 04/02/17, 05:13 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1217
File comments: 1134
Uploads: 43
Thanks for the plugin.

Maybe this helps you to get the set names dynamically by help of their itemId.
You won't need to build localized EN.lua, FR.lua, DE.lua files anymore then:

Lua Code:
  1. --The itemIds of the craftable sets
  2. local SetIds = {
  3. [49575] = true,  -- Aschengriff
  4. [43805] = true,  -- Todeswind
  5. [47279] = true,  -- Stille der Nacht
  6.  
  7. [43808] = true,  -- Zwielicht
  8. [48042] = true,  -- Verführung
  9. [43979] = true,  -- Torugs Pakt
  10. [69942] = true,  -- Prüfungen
  11.  
  12. [51105] = true,  -- Histrinde
  13. [47663] = true,  -- Weißplanke
  14. [43849] = true,  -- Magnus
  15.  
  16. [48425] = true,  -- Kuss des Vampirs
  17. [52243] = true,  -- Lied der Lamien
  18. [52624] = true,  -- Alessias Bollwerk
  19. [60280] = true,  -- Adelssieg
  20. [71806] = true,  -- Tavas Gunst
  21. [75406] = true,  -- DB:Kwatch Gladiator
  22.  
  23. [51486] = true,  -- Weidenpfad
  24. [51864] = true,  -- Hundings Zorn
  25. [49195] = true,  -- Mutter der Nacht
  26. [69592] = true,  -- Julianos
  27.  
  28. [60630] = true,  -- Umverteilung
  29. [72156] = true,  -- Schlauer Alchemist
  30. [75756] = true,  -- DB:Varen's Legacy
  31.  
  32. [43968] = true,  -- Erinnerung
  33. [43972] = true,  -- Schemenauge
  34. [44053] = true,  -- Augen von Mara
  35. [54149] = true,  -- Shalidor's Fluch
  36. [53772] = true,  -- Karegnas Hoffnung
  37. [53006] = true,  -- Ogrumms Schuppen
  38. [54963] = true,  -- Arena
  39.  
  40. [58174] = true,  -- Doppelstern
  41. [60980] = true,  -- Rüstungsmeister
  42. [70642] = true,  -- Morkuldin
  43. [72506] = true,  -- Ewige Jagd
  44. [76106] = true,  -- DB:Pelinal's Aptitude
  45. }
  46.  
  47. local fullLevelDropdownSetsCallbacks = {}
  48. local setNames = {}
  49. --Get the name of the sets
  50. for setItemId, _ in pairs(SetIds) do
  51.     local link = '|H1:item:'..setItemId..':370:50:0:370:50:0:0:0:0:0:0:0:0:0:28:0:0:0:10000:0|h|h'
  52.     local _,setName = GetItemLinkSetInfo(link, false)
  53.  
  54.     --Put the id and name in a table
  55.     setNames[setId] = setName
  56.     table.insert(fullLevelDropdownSetsCallbacks, { name = setName, filterCallback = GetFilterCallbackForSets(setId) })
  57. end

You need to adjust your function GetfilterCallbackForSets(setNames) so it uses the setId as parameter instead.
Maybe you can also strip the itemId from the itemlink and compare just the itemId instead of the name?

Lua Code:
  1. local function GetFilterCallbackForSets( setId )
  2.     -- equalsBonus = equalsBonus or false
  3.  
  4.     return function( slot )
  5.         --get the item link
  6.         local itemLink = GetItemLink(slot.bagId, slot.slotIndex)
  7.         --Get the set item information
  8.         local _, setName, _, _, _ = GetItemLinkSetInfo(itemLink)
  9.  
  10. --      local lFlavor = GetItemId(slot.bagId, slot.slotIndex)
  11. --      df("%s %s %s",setName, lFlavor, setNames)
  12.  
  13.         return false or (string.find(setName, setNames[setId]))
  14.     end
  15. end


And then put this table into the localized tables like this:

Lua Code:
  1. --Loop over the standard set names and add them to the returnTable
  2. local function getSetNames(returnTable)
  3.  if returnTable == nil then return end
  4.  for setKey, setName in pairs(setNames) do
  5.    returnTable[setKey] = setName
  6.  end
  7. end
  8.  
  9. local stringsEN = {
  10.     ["SNUSetFiltersSubmenuCraftedSet"] = "Sets - crafted",
  11. }
  12. getSetNames(stringsEN)
  13.  
  14. local stringsDE = {
  15.     ["SNUSetFiltersSubmenuCraftedSet"] = "Sets - hergestellt",
  16. }
  17. getSetNames(stringsDE )
  18. ...

I hope it works!

Baertram
Last edited by Baertram : 04/02/17 at 05:42 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: