Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@ -241,24 +241,41 @@
- end
- return zo_plainstrfind(data:GetIcon(), icon) or zo_plainstrfind(data:GetIcon():gsub("light_", "_"):gsub("medium_", "_"):gsub("heavy_", "_"), icon)
- end
- +
- + local function isBaseStyle(data)
- + -- example: "/icons/gear_orc_"
- + -- base race styles:
- + -- altmer argonian bosmer breton dunmer khajiit nord orc redguard
- + names = {'altmer', 'argonian', 'bosmer', 'breton', 'dunmer', 'khajiit', 'nord', 'orc', 'redguard'}
- + for i, name in ipairs(names) do
- + if filter("/icons/gear_".. name.."_", data) then
- + return true
- + end
- + end
- + return false
- + end
- +
- local function buildSubCategory(icon, categoryIndex)
- local categoryData = ZO_COLLECTIBLE_DATA_MANAGER:GetCategoryDataByIndicies(categoryIndex)
- local list, collectibles, sublist
- for subCategoryIndex = 1, categoryData:GetNumSubcategories() do
- collectibles = categoryData:GetSubcategoryData(subCategoryIndex)
- for collectibleIndex = 1, collectibles:GetNumCollectibles() do
- - if filter(icon, collectibles:GetCollectibleDataByIndex(collectibleIndex)) then
- - list = list or {}
- - sublist = list[subCategoryIndex] or {}
- - list[subCategoryIndex] = sublist
- - sublist[collectibleIndex] = true
- + local data = collectibles:GetCollectibleDataByIndex(collectibleIndex)
- + if filter(icon, data) then
- + if not (self.filterBaseStyles and isBaseStyle(data)) then
- + list = list or {}
- + sublist = list[subCategoryIndex] or {}
- + list[subCategoryIndex] = sublist
- + sublist[collectibleIndex] = true
- + end
- end
- end
- end
- return list
- end
- function filteredCollections:GetSearchResults()
- - if not atOutfit or not addon.selectedStyle or #addon.selectedStyle == 0 then
- + if (not atOutfit or not addon.selectedStyle or #addon.selectedStyle == 0) and not addon.filterBaseStyles then
- return baseGetSearchResults(self)
- end
- @@ -268,6 +285,9 @@
- end
- local icon = addon.selectedStyle
- + if addon.filterBaseStyles and not icon then
- + icon = ""
- + end
- result = {}
- result[COLLECTIBLE_CATEGORY_TYPE_FACIAL_HAIR_HORNS] = buildSubCategory(icon, COLLECTIBLE_CATEGORY_TYPE_FACIAL_HAIR_HORNS)
- @@ -285,6 +305,14 @@
- ZO_OUTFIT_STYLES_BOOK_SCENE:RegisterCallback("StateChange", atOutfitStateChange)
- local orgOnOutfitStyleEntryRightClick = ZO_OutfitStylesPanel_Keyboard.OnOutfitStyleEntryRightClick
- + local function setFilterBaseStyles(hide)
- + self.filterBaseStyles = hide
- + -- d("filtering base styles, hide:", self.filterBaseStyles)
- +
- + if KEYBOARD_OUTFIT_STYLES_PANEL_FRAGMENT:IsShowing() then
- + ZO_OUTFIT_STYLES_PANEL_KEYBOARD:RefreshVisible()
- + end
- + end
- local function setSelectedStyle(style)
- self.selectedStyle = style
- @@ -317,6 +345,19 @@
- elseif self.selectedFashion then
- AddCustomMenuItem(GetString(SI_OUTFIT_ALL_TYPES_FILTER), allStyles)
- end
- + if self.filterBaseStyles then
- + AddCustomMenuItem("Show basic styles",
- + function()
- + setFilterBaseStyles(false)
- + end
- + )
- + else
- + AddCustomMenuItem("Hide basic styles",
- + function()
- + setFilterBaseStyles(true)
- + end
- + )
- + end
- return ShowMenu(...)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement