diff --git a/AF_FilterBar.lua b/AF_FilterBar.lua
index c9f1978..56ab0cd 100644
--- a/AF_FilterBar.lua
+++ b/AF_FilterBar.lua
@@ -3,6 +3,8 @@ local AF = AdvancedFilters
AF.AF_FilterBar = ZO_Object:Subclass()
local AF_FilterBar = AF.AF_FilterBar
local BuildDropdownCallbacks = AF.util.BuildDropdownCallbacks
+local showChatDebug = AF.showChatDebug
+local util = AF.util
function AF_FilterBar:New(inventoryName, tradeSkillname, groupName, subfilterNames, excludeTheseButtons)
local obj = ZO_Object.New(self)
@@ -35,7 +37,12 @@ function AF_FilterBar:Initialize(inventoryName, tradeSkillname, groupName, subfi
self.label = self.control:GetNamedChild("Label")
self.label:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
- local allText = AF.strings[AF_CONST_ALL] or AF_CONST_ALL
+ local allText = AF_CONST_ALL
+ if AF.strings and AF.strings[AF_CONST_ALL] then
+ allText = AF.strings[AF_CONST_ALL]
+ else
+ showChatDebug("AF_FilterBar:Initialize", "AF.strings missing for: " ..tostring(AF_CONST_ALL) .. ", language: " .. tostring(AF.clientLang) .. ", inventoryName: " .. tostring(inventoryName) .. ", tradeSkillname: " ..tostring(tradeSkillname) .. ",groupName: " ..tostring(groupName))
+ end
self.label:SetText(allText)
self.divider = self.control:GetNamedChild("Divider")
@@ -57,39 +64,47 @@ function AF_FilterBar:Initialize(inventoryName, tradeSkillname, groupName, subfi
comboBox:ShowDropdownInternal()
end
elseif mouseButton == MOUSE_BUTTON_INDEX_RIGHT and upInside then
+ --Get the current LibFilters filterPanelId
+ local filterPanelIdActive = util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
--Add the currently active filtername to the dropdown "Invert" entry
local button = self:GetCurrentButton()
if not button then return end
- local currentActiveFilterName = button.previousDropdownSelection.name or ""
+--d("[AF]AF_FilterBar:Initialize - DropdownOnMouseUpHandler, 2: " .. tostring(button.name) .. ", filterPanelId: " ..tostring(filterPanelIdActive))
+ local previousDropdownSelection = (button.previousDropdownSelection ~= nil and button.previousDropdownSelection[filterPanelIdActive]) or nil
+ local currentActiveFilterName = previousDropdownSelection.name or ""
local invertFilterText = string.format(AF.strings.InvertDropdownFilter, currentActiveFilterName)
local entries = {
[1] = {
name = AF.strings.ResetToAll,
callback = function()
comboBox:SelectFirstItem()
- button.previousDropdownSelection = comboBox.m_sortedItems[1]
+ filterPanelIdActive = util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
+ button.previousDropdownSelection[filterPanelIdActive] = comboBox.m_sortedItems[1]
PlaySound(SOUNDS.MENU_BAR_CLICK)
- local filterType = AF.util.GetCurrentFilterTypeForInventory(self.inventoryType)
- AF.util.LibFilters:RequestUpdate(filterType)
+ local filterType = util.GetCurrentFilterTypeForInventory(self.inventoryType)
+ util.LibFilters:RequestUpdate(filterType)
end,
},
[2] = {
name = invertFilterText,
callback = function()
- local filterType = AF.util.GetCurrentFilterTypeForInventory(self.inventoryType)
- local lastSelectedItem = button.previousDropdownSelection
+ filterPanelIdActive = util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
+ local filterType = util.GetCurrentFilterTypeForInventory(self.inventoryType)
+ local lastSelectedItem = (button.previousDropdownSelection ~= nil and button.previousDropdownSelection[filterPanelIdActive]) or nil
local currentlySelectedDropdownItem = comboBox.m_selectedItemData
if not currentlySelectedDropdownItem then return end
- local originalCallback = AF.util.LibFilters:GetFilterCallback("AF_DropdownFilter", filterType)
+ local originalCallback = util.LibFilters:GetFilterCallback("AF_DropdownFilter", filterType)
local filterCallback = function(slot, slotIndex)
return not originalCallback(slot, slotIndex)
end
--Build the now new selected item of the dropdown with the inverted data
local newSelectedItem = {}
newSelectedItem.callback = filterCallback
+ newSelectedItem.filterCallback = filterCallback -- For AF.util.ApplyFilter
+ newSelectedItem.filterEndCallback = currentlySelectedDropdownItem.filterEndCallback -- For AF.util.ApplyFilter
--Remove all old <> (unequal) signs
currentlySelectedDropdownItem.name = string.gsub(currentlySelectedDropdownItem.name, "≠", "")
if lastSelectedItem and lastSelectedItem.isInverted then
@@ -99,14 +114,17 @@ function AF_FilterBar:Initialize(inventoryName, tradeSkillname, groupName, subfi
newSelectedItem.isInverted = true
newSelectedItem.name = "≠" .. currentlySelectedDropdownItem.name
end
- button.previousDropdownSelection = newSelectedItem
+ button.previousDropdownSelection[filterPanelIdActive] = newSelectedItem
comboBox.m_selectedItemText:SetText(newSelectedItem.name)
PlaySound(SOUNDS.MENU_BAR_CLICK)
- AF.util.LibFilters:UnregisterFilter("AF_DropdownFilter", filterType)
- AF.util.LibFilters:RegisterFilter("AF_DropdownFilter", filterType, filterCallback)
- AF.util.LibFilters:RequestUpdate(filterType)
+ --[[
+ util.LibFilters:UnregisterFilter("AF_DropdownFilter", filterType)
+ util.LibFilters:RegisterFilter("AF_DropdownFilter", filterType, filterCallback)
+ util.LibFilters:RequestUpdate(filterType)
+ ]]
+ util.ApplyFilter(newSelectedItem, "AF_DropdownFilter", true, filterType)
end,
},
}
@@ -144,8 +162,10 @@ function AF_FilterBar:Initialize(inventoryName, tradeSkillname, groupName, subfi
local function OnSelect()
ZO_ComboBox_Base_ItemSelectedClickHelper(self, item)
-
- button.previousDropdownSelection = item
+ --Get the current LibFilters filterPanelId
+ local filterPanelIdActive = util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
+ button.previousDropdownSelection = button.previousDropdownSelection or {}
+ button.previousDropdownSelection[filterPanelIdActive] = item
PlaySound(SOUNDS.MENU_BAR_CLICK)
end
@@ -162,16 +182,22 @@ function AF_FilterBar:Initialize(inventoryName, tradeSkillname, groupName, subfi
local entry = {
label = AF.strings[callbackEntry.name],
callback = function()
- AF.util.ApplyFilter(callbackEntry, "AF_DropdownFilter", true)
+ util.ApplyFilter(callbackEntry, "AF_DropdownFilter", true)
button.forceNextDropdownRefresh = true
self.m_selectedItemText:SetText(AF.strings[callbackEntry.name])
self.m_selectedItemData = self:CreateItemEntry(AF.strings[callbackEntry.name],
function(comboBox, itemName, item, selectionChanged)
- AF.util.ApplyFilter(callbackEntry,
+ util.ApplyFilter(callbackEntry,
"AF_DropdownFilter",
selectionChanged or button.forceNextDropdownRefresh)
end)
- button.previousDropdownSelection = self.m_selectedItemData
+ if callbackEntry.filterEndCallback then
+ self.m_selectedItemData.filterEndCallback = callbackEntry.filterEndCallback
+ end
+ --Get the current LibFilters filterPanelId
+ local filterPanelIdActive = util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
+ button.previousDropdownSelection = button.previousDropdownSelection or {}
+ button.previousDropdownSelection[filterPanelIdActive] = self.m_selectedItemData
PlaySound(SOUNDS.MENU_BAR_CLICK)
@@ -276,12 +302,13 @@ function AF_FilterBar:AddSubfilter(groupName, subfilterName)
end
function AF_FilterBar:ActivateButton(newButton)
- local function PopulateDropdown()
+ --------------------------------------------------------------------------------------------------------------------
+ local function PopulateDropdown(p_newButton)
local comboBox = self.dropdown.m_comboBox
- newButton.dropdownCallbacks = BuildDropdownCallbacks(newButton.groupName, newButton.name)
+ p_newButton.dropdownCallbacks = BuildDropdownCallbacks(p_newButton.groupName, p_newButton.name)
comboBox.submenuCandidates = {}
- for _, v in ipairs(newButton.dropdownCallbacks) do
+ for _, v in ipairs(p_newButton.dropdownCallbacks) do
if v.submenuName then
table.insert(comboBox.submenuCandidates, v)
else
@@ -307,8 +334,11 @@ function AF_FilterBar:ActivateButton(newButton)
end
local itemEntry = ZO_ComboBox:CreateItemEntry(itemEntryName,
function(comboBox, itemName, item, selectionChanged)
- AF.util.ApplyFilter(v, "AF_DropdownFilter", selectionChanged or newButton.forceNextDropdownRefresh)
+ util.ApplyFilter(v, "AF_DropdownFilter", selectionChanged or p_newButton.forceNextDropdownRefresh)
end)
+ if v.filterEndCallback then
+ itemEntry.filterEndCallback = v.filterEndCallback
+ end
comboBox:AddItem(itemEntry)
end
end
@@ -316,9 +346,16 @@ function AF_FilterBar:ActivateButton(newButton)
comboBox:SetSelectedItemFont("ZoFontGameSmall")
comboBox:SetDropdownFont("ZoFontGameSmall")
end
-
+ --------------------------------------------------------------------------------------------------------------------
local name = newButton.name
- self.label:SetText(AF.strings[name])
+ local nameText
+ if AF.strings and AF.strings[name] then
+ nameText = AF.strings[name]
+ else
+ showChatDebug("AF_FilterBar:ActivateButton", "AF.strings missing for name: " ..tostring(name) .. ", language: " .. tostring(AF.clientLang))
+ nameText = "ERROR: n/a"
+ end
+ self.label:SetText(nameText)
local settings = AF.settings
self.label:SetHidden(settings.hideSubFilterLabel)
@@ -333,34 +370,39 @@ function AF_FilterBar:ActivateButton(newButton)
newButton:SetEnabled(false)
--refresh filter
- AF.util.ApplyFilter(newButton, "AF_ButtonFilter", true)
+ util.ApplyFilter(newButton, "AF_ButtonFilter", true)
--set new active button reference
self.activeButton = newButton
--clear old dropdown data
self.dropdown.m_comboBox.m_sortedItems = {}
+ --Get the current LibFilters filterPanelId
+ local filterPanelIdActive = util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
+--d("[AF]AF_FilterBar:ActivateButton: " .. tostring(newButton.name) .. ", filterPanelId: " ..tostring(filterPanelIdActive))
--add new dropdown data
- PopulateDropdown()
- --select the first item if there is no previos selection
- if not newButton.previousDropdownSelection then
+ PopulateDropdown(newButton)
+ --select the first item if there is no previous selection or the setting to remember the last selection is disabled
+ if not AF.settings.rememberFilterDropdownsLastSelection or not newButton.previousDropdownSelection or not newButton.previousDropdownSelection[filterPanelIdActive] then
+ --Select the first entry
self.dropdown.m_comboBox:SelectFirstItem()
- newButton.previousDropdownSelection = self.dropdown.m_comboBox.m_sortedItems[1]
+ newButton.previousDropdownSelection = newButton.previousDropdownSelection or {}
+ newButton.previousDropdownSelection[filterPanelIdActive] = self.dropdown.m_comboBox.m_sortedItems[1]
else
- local previousDropdownSelection = newButton.previousDropdownSelection
- --restore previous dropdown selection
+ --restore previous dropdown selection if the settings is enabled for this
+ local previousDropdownSelection = newButton.previousDropdownSelection[filterPanelIdActive]
--Check if the previous selection was a right mouse context menu "invert" option
if previousDropdownSelection.isInverted then
--Reapply the filter of the inversion
- local filterType = AF.util.GetCurrentFilterTypeForInventory(self.inventoryType)
- --local originalCallback = AF.util.LibFilters:GetFilterCallback("AF_DropdownFilter", filterType)
+ local filterType = util.GetCurrentFilterTypeForInventory(self.inventoryType)
+ --local originalCallback = util.LibFilters:GetFilterCallback("AF_DropdownFilter", filterType)
local originalCallback = previousDropdownSelection.callback
local filterCallback = function(slot, slotIndex)
return originalCallback(slot, slotIndex)
end
- AF.util.LibFilters:UnregisterFilter("AF_DropdownFilter", filterType)
- AF.util.LibFilters:RegisterFilter("AF_DropdownFilter", filterType, filterCallback)
- AF.util.LibFilters:RequestUpdate(filterType)
+ util.LibFilters:UnregisterFilter("AF_DropdownFilter", filterType)
+ util.LibFilters:RegisterFilter("AF_DropdownFilter", filterType, filterCallback)
+ util.LibFilters:RequestUpdate(filterType)
--Select the dropdown entry but do not call the callback function as the filter was updated above already
self.dropdown.m_comboBox:SelectItem(previousDropdownSelection, true)
else
diff --git a/AdvancedFilters.txt b/AdvancedFilters.txt
index e34f326..9cd93dc 100644
--- a/AdvancedFilters.txt
+++ b/AdvancedFilters.txt
@@ -1,10 +1,10 @@
## Title: Advanced Filters
## Author: Randactyl
-## Version: 1.5.1.8
-## AddOnVersion: 1518
+## Version: 1.5.2.1
+## AddOnVersion: 1521
## APIVersion: 100028 100029
## DependsOn: LibFilters-3.0 LibCustomMenu libCommonInventoryFilters LibMotifCategories
-## OptionalDependsOn: LibAddonMenu-2.0 CraftBagExtended
+## OptionalDependsOn: LibAddonMenu-2.0 CraftBagExtended Multicraft
## SavedVariables: AdvancedFilters_Settings
constants.lua
diff --git a/constants.lua b/constants.lua
index 9749426..b901041 100644
--- a/constants.lua
+++ b/constants.lua
@@ -4,11 +4,31 @@ local AF = AdvancedFilters
--Addon base variables
AF.name = "AdvancedFilters"
AF.author = "ingeniousclown, Randactyl, Baertram"
-AF.version = "1.5.1.8"
+AF.version = "1.5.2.1"
AF.savedVarsVersion = 1.511
AF.website = "http://www.esoui.com/downloads/info245-AdvancedFilters.html"
+AF.feedback = "https://www.esoui.com/portal.php?id=136&a=faq"
+AF.donation = "https://www.esoui.com/portal.php?id=136&a=faq&faqid=131"
AF.currentInventoryType = INVENTORY_BACKPACK
+AF.clientLang = GetCVar("language.2")
+
+--SavedVariables default settings
+AF.defaultSettings = {
+ doDebugOutput = false,
+ hideItemCount = false,
+ itemCountLabelColor = {
+ ["r"] = 1,
+ ["g"] = 1,
+ ["b"] = 1,
+ ["a"] = 1,
+ },
+ hideSubFilterLabel = false,
+ grayOutSubFiltersWithNoItems = true,
+ showIconsInFilterDropdowns = true,
+ rememberFilterDropdownsLastSelection = true,
+}
+
--Libraries
AF.util = AF.util or {}
local util = AF.util
@@ -33,6 +53,13 @@ if not util.LibMotifCategories then d("[AdvancedFilters]ERROR: Needed library Li
-- Libraries - END
---------------------------------------------------------------------------------------------------------------------------
+--Other addons
+AF.otherAddons = {}
+
+--Error strings for thrown addon errors and chat output
+AF.errorStrings = {}
+AF.errorStrings["MultiCraft"] = "PLEASE DISABLE THE ADDON \'MultiCraft\'! AdvancedFilters cannot work if this addon is enabled. \'Multicraft\' has been replaced by ZOs own multi crafting UI so you do not need it anymore!"
+
--Scene names for the SCENE_MANAGER.currentScene.name check
local scenesForChecks = {
storeVendor = "store",
diff --git a/data.lua b/data.lua
index 89be4df..98e8390 100644
--- a/data.lua
+++ b/data.lua
@@ -674,7 +674,9 @@ AF.subfilterCallbacks = {
dropdownCallbacks = {},
},
Container = {
- filterCallback = GetFilterCallbackForItemTypeAndSpecializedItemtype({ITEMTYPE_CONTAINER, ITEMTYPE_CONTAINER_CURRENCY, ITEMFILTERTYPE_PROVISIONING}, {SPECIALIZED_ITEMTYPE_CONTAINER}),
+ filterCallback = GetFilterCallbackForItemTypeAndSpecializedItemtype(
+ {ITEMTYPE_CONTAINER, ITEMTYPE_CONTAINER_CURRENCY, ITEMFILTERTYPE_PROVISIONING},
+ {SPECIALIZED_ITEMTYPE_CONTAINER, SPECIALIZED_ITEMTYPE_CONTAINER_EVENT, SPECIALIZED_ITEMTYPE_CONTAINER_STYLE_PAGE}),
dropdownCallbacks = {},
},
Repair = {
diff --git a/main.lua b/main.lua
index 9819650..b3aec7d 100644
--- a/main.lua
+++ b/main.lua
@@ -1,45 +1,19 @@
--ToDo: 11.08.2019
---Max bugs: #9
+--Max todos: #10
--______________________________________________________________________________________________________________________
--- FIXED
+-- TODO
--______________________________________________________________________________________________________________________
---Fixed 2019-08-09, AF 1.5.1.8
---3. Error message upon loading of the game on live (User: darkedone02)
---Got this error when I launched.
---[[
-user:/AddOns/AdvancedFilters/AF_FilterBar.lua:38: attempt to index a nil value
-stack traceback:
-user:/AddOns/AdvancedFilters/AF_FilterBar.lua:38: in function 'AF_FilterBar:Initialize'
-|caaaaaa self = tbl, inventoryName = "SmithingDeconstruction", tradeSkillname = "_BLACKSMITH_", groupName = "All", subfilterNames = tbl, _ = true, _ = 9, _ = ud, _ = 9, _ = 0, offsetY = 63, parents = tbl, parent = ud |r
-user:/AddOns/AdvancedFilters/AF_FilterBar.lua:9: in function 'AF_FilterBar:New'
-|caaaaaa self = tbl, inventoryName = "SmithingDeconstruction", tradeSkillname = "_BLACKSMITH_", groupName = "All", subfilterNames = tbl, obj = tbl |r
-user:/AddOns/AdvancedFilters/AF_FilterBar.lua:364: in function 'AF.CreateSubfilterBars'
-|caaaaaa doDebugOutput = false, inventoryNames = tbl, tradeSkillNames = tbl, filterTypeNames = tbl, subfilterGroups = tbl, subfilterButtonNames = tbl, inventoryType = 16, tradeSkillTypeSubFilterGroup = tbl, tradeSkillType = 1, subfilterGroup = tbl, itemFilterType = 0, _ = tbl |r
-user:/AddOns/AdvancedFilters/main.lua:890: in function 'AdvancedFilters_Loaded'
-|caaaaaa eventCode = 65536, addonName = "AdvancedFilters" |r
-]]
+--#10: 2019-08-16 - feature - Baertram
+--Move the dropdown filter boixes from the subFilter buttons to a table containing the possible LibFiltes filterPanelIds
+--for the submenu button. e.g. Move dropdown filter box of subFilter button Armor->All in the inventory to subFilter button
+--Armor->All->LF_INVENTORY and also add LF_MAIL_SEND and LF_PLAYER_TRADE etc. so the dropdown boxes remember their filters
+--differently for each active filterPanlId
---Fixed 2019-08-09, AF 1.5.1.8
---5. Error upon opening vendor BUY panel
---[[
-user:/AddOns/AdvancedFilters/main.lua:218: function expected instead of nil
-stack traceback:
-user:/AddOns/AdvancedFilters/main.lua:218: in function 'UpdateListAnchors'
-|caaaaaa self = tbl, shiftY = 40, layoutData = tbl, list = ud |r
-user:/AddOns/AdvancedFilters/main.lua:277: in function 'ShowSubfilterBar'
-|caaaaaa currentFilter = 0, craftingType = 0, UpdateListAnchors = user:/AddOns/AdvancedFilters/main.lua:205, doDebugOutput = false, subfilterGroup = tbl, subfilterBar = tbl, isCraftingInventoryType = false |r
-user:/AddOns/AdvancedFilters/util.lua:732: in function 'Update'
-]]
-
---Fixed 2019-08-09, AF 1.5.1.8
---6. Guild store sell tab shows subcategories enabled where there are no items in there to sell (maybe bound items exist, or stolen ones)
-
---Fixed 2019-08-09, AF 1.5.1.8
---#7. Junk in inventory: "jewelry" will show as armor AND jewelry, but should only be shown below jewelry
+--______________________________________________________________________________________________________________________
+-- FIXED
+--______________________________________________________________________________________________________________________
---#8: In dropdown box context menu show "Invert filter: " and the current filter name behind
---#9: In dropdown box context menu show, after "Invert filter: %s" was applied, the name of the filter with a <> (unequal) in front so one can directly see it is inverted
--______________________________________________________________________________________________________________________
-- NOT REPLICABLE
@@ -108,10 +82,25 @@ local GetInventoryFromCraftingPanel = util.GetInventoryFromCraftingPanel
local IsCraftingStationInventoryType = util.IsCraftingStationInventoryType
local IsCraftingPanelShown = util.IsCraftingPanelShown
-local function showChatDebug(functionName, chatOutputVars)
+function AF.showChatDebug(functionName, chatOutputVars)
local functionNameStr = tostring(functionName) or "n/a"
functionNameStr = " " .. functionNameStr
chatOutputVars = chatOutputVars or ""
+ --Center screen annonucenment
+ local csaText
+ if AF.strings and AF.strings["errorCheckChatPlease"] then
+ csaText = AF.strings["errorCheckChatPlease"]
+ else
+ csaText = "|cFF0000[AdvancedFilters ERROR]|r Please read the error message in the chat!"
+ end
+ if csaText ~= "" then
+ local params = CENTER_SCREEN_ANNOUNCE:CreateMessageParams(CSA_CATEGORY_LARGE_TEXT, SOUNDS.GROUP_KICK)
+ params:SetCSAType(CENTER_SCREEN_ANNOUNCE_TYPE_DISPLAY_ANNOUNCEMENT)
+ params:SetText(csaText)
+ CENTER_SCREEN_ANNOUNCE:AddMessageWithParams(params)
+ end
+
+ --Chat output
d(">====================================>")
d("[AdvancedFilters - ERROR]" .. tostring(functionNameStr))
d("!> Please answer the following 4 questions and send the answers (and if given: the variables shown in the lines, starting with ->, after the questions) to the addon's comments of AdvancedFilters @www.esoui.com:\n https://bit.ly/2IlJ56J")
@@ -122,6 +111,7 @@ local function showChatDebug(functionName, chatOutputVars)
d("Thank you very much for your invested time and the will to fix this addon!")
d("<====================================<")
end
+local showChatDebug = AF.showChatDebug
local function InitializeHooks()
AF.blockOnInventoryFilterChangedPreHookForCraftBag = false
@@ -283,10 +273,6 @@ local function InitializeHooks()
end
if currentFilter == nil then
showErrorInChat = true
- else
- if AF.subFiltersBarInactive[currentFilter] == nil then
- showErrorInChat = true
- end
end
if craftingType == nil then
showErrorInChat = true
@@ -295,11 +281,12 @@ local function InitializeHooks()
local nextSubfilterBar = AF.subfilterGroups[AF.currentInventoryType][craftingType][currentFilter]
if nextSubfilterBar == nil then
subfilterBarMissing = true
+ showErrorInChat = true
end
end
--Show a debug message now and abort here?
if showErrorInChat then
- showChatDebug("ShowSubfilterBar", "InventoryType: " ..tostring(AF.currentInventoryType) .. ", craftingType: " ..tostring(craftingType) .. "/" .. GetCraftingInteractionType() .. ", currentFilter: " .. tostring(currentFilter) .. ", subFilterGroupMissing: " ..tostring(subfilterGroupMissingForInvType) .. ", subfilterBarMissing: " ..tostring(subfilterBarMissing))
+ showChatDebug("ShowSubfilterBar - BEGIN", "InventoryType: " ..tostring(AF.currentInventoryType) .. ", craftingType: " ..tostring(craftingType) .. "/" .. GetCraftingInteractionType() .. ", currentFilter: " .. tostring(currentFilter) .. ", subFilterGroupMissing: " ..tostring(subfilterGroupMissingForInvType) .. ", subfilterBarMissing: " ..tostring(subfilterBarMissing))
end
return false
end
@@ -382,7 +369,7 @@ local function InitializeHooks()
--Error handling: Showing new subfilter bar
if doDebugOutput then
if currentFilter == nil or (currentFilter ~= nil and AF.subFiltersBarInactive[currentFilter] == nil) then
- showChatDebug("ShowSubfilterBar", "InventoryType: " ..tostring(AF.currentInventoryType) .. ", craftingType: " ..tostring(craftingType) .. "/" .. GetCraftingInteractionType() .. ", currentFilter: " .. tostring(currentFilter))
+ showChatDebug("ShowSubfilterBar - END", "InventoryType: " ..tostring(AF.currentInventoryType) .. ", craftingType: " ..tostring(craftingType) .. "/" .. GetCraftingInteractionType() .. ", currentFilter: " .. tostring(currentFilter))
end
end
end
@@ -563,6 +550,11 @@ local function InitializeHooks()
end
return false
end
+ --Multicraft addon breaks this addon! Disable it before you can use AdvancedFilters
+ if AF.otherAddons["MultiCraft"] or MultiCraft ~= nil then
+ showChatDebug("PostHook ZO_Enchanting OnModeUpdated -> PLEASE DISABLE THE ADDON \'MultiCraft\'!", AF.errorStrings["MultiCraft"])
+ return
+ end
--ZO_PreHook(ZO_Enchanting, "SetEnchantingMode", HookEnchantingSetEnchantingMode)
local origEnchantingSetEnchantMode = ZO_Enchanting.SetEnchantingMode
if origEnchantingSetEnchantMode ~= nil then
@@ -975,9 +967,27 @@ elseif bankType == "hb" then
end
end
+--Check if other addons are activated and output an error message if they brak AdvancedFilters
+function AF.checkForOtherAddonErrors(eventName, initial)
+ if not AF.otherAddons then return end
+ if AF.otherAddons["MultiCraft"] or MultiCraft ~= nil then
+ showChatDebug("Other addon breaks \'AdvancedFilters\' -> PLEASE DISABLE THE ADDON \'MultiCraft\'!", AF.errorStrings["MultiCraft"])
+ return
+ end
+end
+
local function AdvancedFilters_Loaded(eventCode, addonName)
+ if addonName == "MultiCraft" then
+ AF.otherAddons[addonName] = true
+ end
if addonName ~= AF.name then return end
EVENT_MANAGER:UnregisterForEvent(AF.name .. "_Loaded", EVENT_ADD_ON_LOADED)
+ EVENT_MANAGER:RegisterForEvent(AF.name .. "_PlayerActivated", EVENT_PLAYER_ACTIVATED, AF.checkForOtherAddonErrors)
+ --Do not load anything further if the addon MultiCraft is enabled
+ if AF.otherAddons["MultiCraft"] or MultiCraft ~= nil then
+ return
+ end
+
--Register a callback function for crafting stations: If you leave them reseet the current inventory type to INVENTORY_BACKPACK
EVENT_MANAGER:RegisterForEvent(AF.name .. "_CraftingStationLeave", EVENT_END_CRAFTING_STATION_INTERACT, onEndCraftingStationInteract)
EVENT_MANAGER:RegisterForEvent(AF.name .. "_CraftingStationCraftFinished", EVENT_CRAFT_COMPLETED, onCraftingComplete)
@@ -992,22 +1002,9 @@ local function AdvancedFilters_Loaded(eventCode, addonName)
EVENT_MANAGER:RegisterForEvent(AF.name .. "_GuildBankClosed", EVENT_CLOSE_GUILD_BANK, function() SetBankEventVariable("gb", false) end)
--Bufix to reset "store"'s currentFilter as stable closes
EVENT_MANAGER:RegisterForEvent(AF.name .. "_StableClosed", EVENT_STABLE_INTERACT_END, function() controlsForChecks.store.currentFilter = ITEMFILTERTYPE_ALL end)
+
--Create instance of library libFilters
util.LibFilters:InitializeLibFilters()
- --SavedVariables default settings
- AF.defaultSettings = {
- doDebugOutput = false,
- hideItemCount = false,
- itemCountLabelColor = {
- ["r"] = 1,
- ["g"] = 1,
- ["b"] = 1,
- ["a"] = 1,
- },
- hideSubFilterLabel = false,
- grayOutSubFiltersWithNoItems = true,
- showIconsInFilterDropdowns = true,
- }
--SavedVariables
AF.settings = ZO_SavedVars:NewAccountWide(AF.name .. "_Settings", AF.savedVarsVersion, "Settings", AF.defaultSettings, GetWorldName())
--Create the subfilter bars below the normal inventories filters
diff --git a/menu.lua b/menu.lua
index e2ff6d9..8d9bcbb 100644
--- a/menu.lua
+++ b/menu.lua
@@ -25,7 +25,9 @@ function AF.LAMSettingsMenu()
registerForRefresh = true,
registerForDefaults = true,
slashCommand = "/afs",
- website = AF.website
+ website = AF.website,
+ feedback = AF.feedback,
+ donation = AF.donation,
}
--The LibAddonMenu2.0 settings panel reference variable
AF.LAMsettingsPanel = AF.LAM:RegisterAddonPanel(AF.name .. "_LAM", panelData)
@@ -97,6 +99,17 @@ function AF.LAMSettingsMenu()
default = defSettings.showIconsInFilterDropdowns,
},
--==============================================================================
+ {
+ type = "checkbox",
+ name = strings.lamRememberFilterDropdownsLastSelection,
+ tooltip = strings.lamRememberFilterDropdownsLastSelectionTT,
+ getFunc = function() return settings.rememberFilterDropdownsLastSelection end,
+ setFunc = function(value)
+ AF.settings.rememberFilterDropdownsLastSelection = value
+ end,
+ default = defSettings.rememberFilterDropdownsLastSelection,
+ },
+ --==============================================================================
-- DEBUG
--==============================================================================
{
diff --git a/strings/de.lua b/strings/de.lua
index 59905fa..9d84f4d 100644
--- a/strings/de.lua
+++ b/strings/de.lua
@@ -1,5 +1,5 @@
local util = AdvancedFilters.util
-local enStrings = AdvancedFilters.strings
+local enStrings = AdvancedFilters.ENstrings
local strings = {
TwoHandAxe = util.Localize(zo_strformat("<<1>> <<2>>", GetString(SI_EQUIPTYPE6), GetString(SI_WEAPONTYPE1))),
TwoHandSword = util.Localize(zo_strformat("<<1>> <<2>>", GetString(SI_EQUIPTYPE6), GetString(SI_WEAPONTYPE3))),
@@ -21,6 +21,11 @@ local strings = {
lamGrayOutSubFiltersWithNoItemsTT = "Deaktiviert die Filter Kategorien, welche aktuell keine Gegegnstände besitzen.",
lamShowIconsInFilterDropdowns = "Zeige Symbole in Filter Boxen",
lamShowIconsInFilterDropdownsTT = "Zeige Symbole in den Filter Aufklapp Boxen an",
+ lamRememberFilterDropdownsLastSelection = "Merke letzte Filter Box Auswahl",
+ lamRememberFilterDropdownsLastSelectionTT = "Merkt sich je Unterfilter und Filter Panel (Inventar, Mail senden, Handerksstation, ...) die letzte Filter Box Auswahl und stellt diese wieder her, wenn du den Unterfilter auf diesem Filter Panel das nächste mal besuchst.\NDies wird NICHT über eine Ausloggen/Benutzeroberfläche Neuladen hinweg gemerkt!",
+
+ --Error messages
+ errorCheckChatPlease = "|cFF0000[AdvancedFilters FEHLER]|r Bitte lese die Fehlermeldung im Chat!",
}
setmetatable(strings, {__index = enStrings})
AdvancedFilters.strings = strings
diff --git a/strings/en.lua b/strings/en.lua
index 6e95a06..668fdc2 100644
--- a/strings/en.lua
+++ b/strings/en.lua
@@ -190,7 +190,12 @@ local strings = {
lamGrayOutSubFiltersWithNoItemsTT = "Disable the subfilter buttons where no items are available.",
lamShowIconsInFilterDropdowns = "Show icons in dropdown box",
lamShowIconsInFilterDropdownsTT = "Show icons for the filter entries in the filter dropdown boxes",
- lamDebugOutput = "Debug"
+ lamRememberFilterDropdownsLastSelection = "Remember last filter dropdown selection",
+ lamRememberFilterDropdownsLastSelectionTT = "Remenber the last filter dropdown box at each subfilter and filterpanel (inventory, mail, crafting table, ...) and re-apply this filter in the dropdown entry if you return to this filterpanel and subfilter.\nThis will NOT be saved if you logout/do a reload of the UI!",
+ lamDebugOutput = "Debug",
+
+ --Error messages
+ errorCheckChatPlease = "|cFF0000[AdvancedFilters ERROR]|r Please read the chat error message!",
}
strings.Vanity = strings.Disguise
@@ -235,4 +240,5 @@ strings.Swift_Neck = strings.Swift .. neckStr
strings.Triune_Neck = strings.Triune .. neckStr
strings.Protective_Neck = strings.Protective .. neckStr
+AdvancedFilters.ENstrings = strings
AdvancedFilters.strings = strings
\ No newline at end of file
diff --git a/strings/es.lua b/strings/es.lua
index 71a3ff3..85c2950 100644
--- a/strings/es.lua
+++ b/strings/es.lua
@@ -1,5 +1,5 @@
local util = AdvancedFilters.util
-local enStrings = AdvancedFilters.strings
+local enStrings = AdvancedFilters.ENstrings
local strings = {
--WEAPON
OneHand = "Una Mano",
diff --git a/strings/fr.lua b/strings/fr.lua
index df4fc57..109ba83 100644
--- a/strings/fr.lua
+++ b/strings/fr.lua
@@ -1,5 +1,5 @@
local util = AdvancedFilters.util
-local enStrings = AdvancedFilters.strings
+local enStrings = AdvancedFilters.ENstrings
local strings = {
--WEAPON
OneHand = "Une main",
@@ -36,7 +36,10 @@ local strings = {
lamGrayOutSubFiltersWithNoItemsTT = "Masque le bouton des sous-catégories ne comportant aucun objet.",
lamShowIconsInFilterDropdowns = "Afficher les icônes dans le menu déroulant",
lamShowIconsInFilterDropdownsTT = "Affiche les icônes des sous-catégories d'objet dans le menu déroulant de filtrage par type d'objet.",
- lamDebugOutput = "Déboguage"
+ lamDebugOutput = "Déboguage",
+
+ --Error messages
+ errorCheckChatPlease = "|cFF0000[AdvancedFilters ERREUR]|r Veuillez lire le message d'erreur du chat!",
}
setmetatable(strings, {__index = enStrings})
diff --git a/strings/jp.lua b/strings/jp.lua
index ee8caa5..34577f3 100644
--- a/strings/jp.lua
+++ b/strings/jp.lua
@@ -1,5 +1,5 @@
local util = AdvancedFilters.util
-local enStrings = AdvancedFilters.strings
+local enStrings = AdvancedFilters.ENstrings
local strings = {
--WEAPON
OneHand = "片手武器",
@@ -43,6 +43,9 @@ local strings = {
--DROPDOWN CONTEXT MENU
ResetToAll = "全てリセット",
InvertDropdownFilter = "フィルターを反転: %s",
+
+ --Error messages
+ errorCheckChatPlease = "|cFF0000[AdvancedFilters エラー]|r チャットエラーメッセージをお読みください!",
}
setmetatable(strings, {__index = enStrings})
AdvancedFilters.strings = strings
\ No newline at end of file
diff --git a/strings/ru.lua b/strings/ru.lua
index 182bbee..7ebfb03 100644
--- a/strings/ru.lua
+++ b/strings/ru.lua
@@ -1,5 +1,5 @@
local util = AdvancedFilters.util
-local enStrings = AdvancedFilters.strings
+local enStrings = AdvancedFilters.ENstrings
local strings = {
--SHARED
All = "Все",
@@ -54,6 +54,9 @@ local strings = {
lamHideItemCountColorTT = "Установить цвет количество предметов в нижней строке инвентаря",
lamHideSubFilterLabel = "Скрыть метку подфильтра",
lamHideSubFilterLabelTT = "Скрыть метку описания подфильтра в верхней строке инвентаря (слева от кнопок подфильтров).",
+
+ --Error messages
+ errorCheckChatPlease = "|cFF0000[AdvancedFilters ОШИБКА]|r Пожалуйста, прочитайте сообщение об ошибке чата!",
}
setmetatable(strings, {__index = enStrings})
diff --git a/util.lua b/util.lua
index 331646b..bede013 100644
--- a/util.lua
+++ b/util.lua
@@ -45,11 +45,11 @@ function util.AbortSubfilterRefresh(inventoryType)
return doAbort
end
-function util.ApplyFilter(button, filterTag, requestUpdate)
+function util.ApplyFilter(button, filterTag, requestUpdate, filterType)
- local LibFilters = util.LibFilters
- local callback = button.filterCallback
- local filterType = util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
+ local LibFilters = util.LibFilters
+ local callback = button.filterCallback
+ local filterTypeToUse = filterType or util.GetCurrentFilterTypeForInventory(AF.currentInventoryType)
--d("[AF]Apply " .. button.name .. " from " .. filterTag .. " for filterType " .. filterType .. " and inventoryType " .. AF.currentInventoryType)
@@ -58,7 +58,7 @@ function util.ApplyFilter(button, filterTag, requestUpdate)
d("callback was nil for " .. filterTag)
return
end
- if filterType == nil then
+ if filterTypeToUse == nil then
d("filterType was nil for " .. filterTag)
return
end
@@ -66,13 +66,20 @@ function util.ApplyFilter(button, filterTag, requestUpdate)
--first, clear current filters without an update
LibFilters:UnregisterFilter(filterTag)
--then register new one and hand off update parameter
- LibFilters:RegisterFilter(filterTag, filterType, callback)
- if requestUpdate == true then LibFilters:RequestUpdate(filterType) end
+ LibFilters:RegisterFilter(filterTag, filterTypeToUse, callback)
+ if requestUpdate == true then LibFilters:RequestUpdate(filterTypeToUse) end
--Update the count of filtered/shown items in the inventory FreeSlot label
--Delay this function call as the data needs to be filtered first!
zo_callLater(function()
util.updateInventoryInfoBarCountLabel(AF.currentInventoryType)
+
+ --Run an end callback function now?
+ local endCallback = button.filterEndCallback
+ if endCallback and type(endCallback) == "function" then
+d("[AF]blubb")
+ endCallback()
+ end
end, 50)
end