Advertisement
Guest User

Untitled

a guest
Dec 21st, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.18 KB | None | 0 0
  1. @@ -241,24 +241,41 @@
  2.         end
  3.         return zo_plainstrfind(data:GetIcon(), icon) or zo_plainstrfind(data:GetIcon():gsub("light_", "_"):gsub("medium_", "_"):gsub("heavy_", "_"), icon)
  4.     end
  5. +
  6. +   local function isBaseStyle(data)
  7. +       -- example: "/icons/gear_orc_"
  8. +       -- base race styles:
  9. +       -- altmer argonian bosmer breton dunmer khajiit nord orc redguard
  10. +       names = {'altmer', 'argonian', 'bosmer', 'breton', 'dunmer', 'khajiit', 'nord', 'orc', 'redguard'}
  11. +       for i, name in ipairs(names) do
  12. +           if filter("/icons/gear_".. name.."_", data) then
  13. +               return true
  14. +           end
  15. +       end
  16. +       return false
  17. +   end
  18. +
  19.     local function buildSubCategory(icon, categoryIndex)
  20.         local categoryData = ZO_COLLECTIBLE_DATA_MANAGER:GetCategoryDataByIndicies(categoryIndex)
  21.         local list, collectibles, sublist
  22.         for subCategoryIndex = 1, categoryData:GetNumSubcategories() do
  23.             collectibles = categoryData:GetSubcategoryData(subCategoryIndex)
  24.             for collectibleIndex = 1, collectibles:GetNumCollectibles() do
  25. -               if filter(icon, collectibles:GetCollectibleDataByIndex(collectibleIndex)) then
  26. -                   list = list or {}
  27. -                   sublist = list[subCategoryIndex] or {}
  28. -                   list[subCategoryIndex] = sublist
  29. -                   sublist[collectibleIndex] = true
  30. +               local data = collectibles:GetCollectibleDataByIndex(collectibleIndex)
  31. +               if filter(icon, data) then
  32. +                   if not (self.filterBaseStyles and isBaseStyle(data)) then
  33. +                       list = list or {}
  34. +                       sublist = list[subCategoryIndex] or {}
  35. +                       list[subCategoryIndex] = sublist
  36. +                       sublist[collectibleIndex] = true
  37. +                   end
  38.                 end
  39.             end
  40.         end
  41.         return list
  42.     end
  43.     function filteredCollections:GetSearchResults()
  44. -       if not atOutfit or not addon.selectedStyle or #addon.selectedStyle == 0 then
  45. +       if (not atOutfit or not addon.selectedStyle or #addon.selectedStyle == 0) and not addon.filterBaseStyles then
  46.             return baseGetSearchResults(self)
  47.         end
  48.  
  49. @@ -268,6 +285,9 @@
  50.         end
  51.  
  52.         local icon = addon.selectedStyle
  53. +       if addon.filterBaseStyles and not icon then
  54. +           icon = ""
  55. +       end
  56.  
  57.         result = {}
  58.         result[COLLECTIBLE_CATEGORY_TYPE_FACIAL_HAIR_HORNS] = buildSubCategory(icon, COLLECTIBLE_CATEGORY_TYPE_FACIAL_HAIR_HORNS)
  59. @@ -285,6 +305,14 @@
  60.     ZO_OUTFIT_STYLES_BOOK_SCENE:RegisterCallback("StateChange", atOutfitStateChange)
  61.  
  62.     local orgOnOutfitStyleEntryRightClick = ZO_OutfitStylesPanel_Keyboard.OnOutfitStyleEntryRightClick
  63. +   local function setFilterBaseStyles(hide)
  64. +       self.filterBaseStyles = hide
  65. +       -- d("filtering base styles, hide:", self.filterBaseStyles)
  66. +
  67. +       if KEYBOARD_OUTFIT_STYLES_PANEL_FRAGMENT:IsShowing() then
  68. +           ZO_OUTFIT_STYLES_PANEL_KEYBOARD:RefreshVisible()
  69. +       end
  70. +   end
  71.     local function setSelectedStyle(style)
  72.         self.selectedStyle = style
  73.  
  74. @@ -317,6 +345,19 @@
  75.                 elseif self.selectedFashion then
  76.                     AddCustomMenuItem(GetString(SI_OUTFIT_ALL_TYPES_FILTER), allStyles)
  77.                 end
  78. +               if self.filterBaseStyles then
  79. +                   AddCustomMenuItem("Show basic styles",
  80. +                       function()
  81. +                           setFilterBaseStyles(false)
  82. +                       end
  83. +                   )
  84. +               else
  85. +                   AddCustomMenuItem("Hide basic styles",
  86. +                       function()
  87. +                           setFilterBaseStyles(true)
  88. +                       end
  89. +                   )
  90. +               end
  91.                 return ShowMenu(...)
  92.             end
  93.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement