diff --git a/.luacheckrc b/.luacheckrc index 1e491cc..89e7851 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -95,9 +95,7 @@ read_globals = { "GarrisonShipyardFollowerTooltip", "GetAchievementInfo", "GetArchaeologyRaceInfoByID", - "GetCategoryNumAchievements", "GetCVarBool", - "GetGuildCategoryList", "GetInstanceInfo", "GetLFGCompletionReward", "GetLFGCompletionRewardItem", @@ -134,7 +132,6 @@ read_globals = { "INVSLOT_TRINKET2", "INVSLOT_WAIST", "INVSLOT_WRIST", - "IsInGuild", "IsLoggedIn", "IsModifiedClick", "IsShiftKeyDown", diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d2bd3c..56a42b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +## Version 110002.02 + +- Reworked the workaround for the guild achievement spam. After further investigating the issue it became apparent that + it's impossible to reliably automate it without affecting newer smaller guilds that might want to see toasts for these + achievements. For this reason I'm adding a toggle to enable filtering for guild achievements if your guild is + experiencing it. This will block toasts for a bunch of faction-specific PvP and reputation achievements. Can be found + at /LST > Toast Types > Achievement > Filter Guild Achievements, disabled by default. +- Updated Traditional Chinese translation. Translated by BNS333@Curse. + ## Version 110002.01 - Added a workaround for buggy guild achievement spam. If your character is in a guild, the addon will add already diff --git a/ls_Toasts/core/changelog.lua b/ls_Toasts/core/changelog.lua index a8607a0..394c356 100644 --- a/ls_Toasts/core/changelog.lua +++ b/ls_Toasts/core/changelog.lua @@ -6,9 +6,10 @@ local _G = getfenv(0) -- Mine E.CHANGELOG = [[ -- Added a workaround for buggy guild achievement spam. If your character is in a guild, the addon will add already - completed guild achievements to the blacklist on log in, you still will be able to see guild achievements if they're - earned for the first time. If you join a guild at some point, reload the UI, the achievement API is super laggy, so I - avoid rebuilding the blacklist during the actual game session. -- Added an option to disable tooltips on mouseover. +- Reworked the workaround for the guild achievement spam. After further investigating the issue it became apparent that + it's impossible to reliably automate it without affecting newer smaller guilds that might want to see toasts for these + achievements. For this reason I'm adding a toggle to enable filtering for guild achievements if your guild is + experiencing it. This will block toasts for a bunch of faction-specific PvP and reputation achievements. Can be found + at /LST > Toast Types > Achievement > Filter Guild Achievements, disabled by default. +- Updated Traditional Chinese translation. Translated by BNS333@Curse. ]] diff --git a/ls_Toasts/embeds/AceConfig-3.0/AceConfig-3.0.lua b/ls_Toasts/embeds/AceConfig-3.0/AceConfig-3.0.lua index 1c9454a..ab91c9e 100644 --- a/ls_Toasts/embeds/AceConfig-3.0/AceConfig-3.0.lua +++ b/ls_Toasts/embeds/AceConfig-3.0/AceConfig-3.0.lua @@ -3,7 +3,7 @@ -- as well as associate it with a slash command. -- @class file -- @name AceConfig-3.0 --- @release $Id$ +-- @release $Id: AceConfig-3.0.lua 1335 2024-05-05 19:35:16Z nevcairiel $ --[[ AceConfig-3.0 diff --git a/ls_Toasts/embeds/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua b/ls_Toasts/embeds/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua index 9e883a2..6dd6438 100644 --- a/ls_Toasts/embeds/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua +++ b/ls_Toasts/embeds/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua @@ -1,7 +1,7 @@ --- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames. -- @class file -- @name AceConfigCmd-3.0 --- @release $Id$ +-- @release $Id: AceConfigCmd-3.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ --[[ AceConfigCmd-3.0 diff --git a/ls_Toasts/embeds/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua b/ls_Toasts/embeds/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua index 06d1d41..9400465 100644 --- a/ls_Toasts/embeds/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua +++ b/ls_Toasts/embeds/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua @@ -1,7 +1,7 @@ --- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables. -- @class file -- @name AceConfigDialog-3.0 --- @release $Id$ +-- @release $Id: AceConfigDialog-3.0.lua 1351 2024-07-24 18:23:24Z funkehdude $ local LibStub = LibStub local gui = LibStub("AceGUI-3.0") diff --git a/ls_Toasts/embeds/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua b/ls_Toasts/embeds/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua index 7d0d108..e0f5962 100644 --- a/ls_Toasts/embeds/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua +++ b/ls_Toasts/embeds/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua @@ -8,7 +8,7 @@ -- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName". -- @class file -- @name AceConfigRegistry-3.0 --- @release $Id$ +-- @release $Id: AceConfigRegistry-3.0.lua 1296 2022-11-04 18:50:10Z nevcairiel $ local CallbackHandler = LibStub("CallbackHandler-1.0") local MAJOR, MINOR = "AceConfigRegistry-3.0", 21 diff --git a/ls_Toasts/embeds/AceDB-3.0/AceDB-3.0.lua b/ls_Toasts/embeds/AceDB-3.0/AceDB-3.0.lua index a0a8936..75fda62 100644 --- a/ls_Toasts/embeds/AceDB-3.0/AceDB-3.0.lua +++ b/ls_Toasts/embeds/AceDB-3.0/AceDB-3.0.lua @@ -40,7 +40,7 @@ -- end -- @class file -- @name AceDB-3.0.lua --- @release $Id$ +-- @release $Id: AceDB-3.0.lua 1353 2024-08-27 13:37:35Z nevcairiel $ local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 30 local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR) diff --git a/ls_Toasts/embeds/AceDBOptions-3.0/AceDBOptions-3.0.lua b/ls_Toasts/embeds/AceDBOptions-3.0/AceDBOptions-3.0.lua index b91082b..46a85bf 100644 --- a/ls_Toasts/embeds/AceDBOptions-3.0/AceDBOptions-3.0.lua +++ b/ls_Toasts/embeds/AceDBOptions-3.0/AceDBOptions-3.0.lua @@ -1,7 +1,7 @@ --- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles. -- @class file -- @name AceDBOptions-3.0 --- @release $Id$ +-- @release $Id: AceDBOptions-3.0.lua 1304 2023-05-19 19:50:10Z nevcairiel $ local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 15 local AceDBOptions = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR) diff --git a/ls_Toasts/embeds/AceGUI-3.0/AceGUI-3.0.lua b/ls_Toasts/embeds/AceGUI-3.0/AceGUI-3.0.lua index 35b176e..f05b1ed 100644 --- a/ls_Toasts/embeds/AceGUI-3.0/AceGUI-3.0.lua +++ b/ls_Toasts/embeds/AceGUI-3.0/AceGUI-3.0.lua @@ -24,7 +24,7 @@ -- f:AddChild(btn) -- @class file -- @name AceGUI-3.0 --- @release $Id$ +-- @release $Id: AceGUI-3.0.lua 1288 2022-09-25 14:19:00Z funkehdude $ local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 41 local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) diff --git a/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua b/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua index 6fe30ea..947184c 100644 --- a/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua +++ b/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua @@ -1,4 +1,4 @@ ---[[ $Id$ ]]-- +--[[ $Id: AceGUIWidget-DropDown-Items.lua 1272 2022-08-29 15:56:35Z nevcairiel $ ]]-- local AceGUI = LibStub("AceGUI-3.0") diff --git a/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua b/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua index 9fde707..59c7f53 100644 --- a/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua +++ b/ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua @@ -1,4 +1,4 @@ ---[[ $Id$ ]]-- +--[[ $Id: AceGUIWidget-DropDown.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]-- local AceGUI = LibStub("AceGUI-3.0") -- Lua APIs diff --git a/ls_Toasts/locales/enUS.lua b/ls_Toasts/locales/enUS.lua index 7fbda2e..7bdd044 100644 --- a/ls_Toasts/locales/enUS.lua +++ b/ls_Toasts/locales/enUS.lua @@ -111,6 +111,8 @@ L["YOU_RECEIVED"] = "You Received" -- Retail L["CURRENCY_THRESHOLD_DESC"] = "Enter |cffffd200-1|r to ignore the currency, |cffffd2000|r to disable the filter, or |cffffd200any number above 0|r to set the threshold below which no toasts will be created." +L["FILTER_GUILD_ACHIEVEMENTS"] = "Filter Guild Achievements" +L["FILTER_GUILD_ACHIEVEMENTS_DESC"] = "Enabling this option will block toasts for faction-specific guild achievements. They're the cause of the achievement spam in big cross-faction guilds." L["HANDLE_LEFT_CLICK"] = "Handle Left Click" L["NEW_CURRENCY_FILTER_DESC"] = "Enter a currency ID." L["SHOW_QUEST_ITEMS"] = "Show Quest Items" diff --git a/ls_Toasts/locales/ruRU.lua b/ls_Toasts/locales/ruRU.lua index 8e1055d..3ed98b3 100644 --- a/ls_Toasts/locales/ruRU.lua +++ b/ls_Toasts/locales/ruRU.lua @@ -58,6 +58,8 @@ L["YOU_RECEIVED"] = "Вы получили" -- Retail L["CURRENCY_THRESHOLD_DESC"] = "Введите |cffffd200-1|r, чтобы игнорировать валюту, |cffffd2000|r, чтобы отключить фильтр, или |cffffd200любое число больше 0|r, чтобы установить порог, ниже которого уведомления не будут показываться." +L["FILTER_GUILD_ACHIEVEMENTS"] = "Фильтр достижений гильдии" +L["FILTER_GUILD_ACHIEVEMENTS_DESC"] = "Включение данной настройки заблокирует уведомления для достижений гильдии, которые связанны с фракциями. Они являются причиной спама достижений в крупных межфракционных гильдиях." L["HANDLE_LEFT_CLICK"] = "Обрабатывать левый щелчок" L["NEW_CURRENCY_FILTER_DESC"] = "Введите ID валюты." L["SHOW_QUEST_ITEMS"] = "Показывать кв. пр." diff --git a/ls_Toasts/locales/zhTW.lua b/ls_Toasts/locales/zhTW.lua index 135f93e..7d6bc74 100644 --- a/ls_Toasts/locales/zhTW.lua +++ b/ls_Toasts/locales/zhTW.lua @@ -64,6 +64,7 @@ L["SHOW_QUEST_ITEMS"] = "顯示任務物品" L["SHOW_QUEST_ITEMS_DESC"] = "不論品質都要顯示任務物品。" L["TAINT_WARNING"] = "啟用此選項可能會在戰鬥中打開或關閉某些UI面板時導致錯誤。" L["THRESHOLD"] = "數量最少要" +L["TOOLTIPS"] = "工具提示" L["TRANSMOG_ADDED"] = "外觀已加入" L["TRANSMOG_REMOVED"] = "外觀已移除" L["TYPE_ACHIEVEMENT"] = "成就" diff --git a/ls_Toasts/ls_Toasts.toc b/ls_Toasts/ls_Toasts.toc index 3f72577..ff0dd49 100644 --- a/ls_Toasts/ls_Toasts.toc +++ b/ls_Toasts/ls_Toasts.toc @@ -1,6 +1,6 @@ ## Interface: 110002, 110005 ## Author: lightspark -## Version: 110002.01 +## Version: 110002.02 ## Title: LS: |cff00cc99Toasts|r ## Notes: Better toasts, cheers! ## IconTexture: Interface\AddOns\ls_Toasts\assets\logo-64 diff --git a/ls_Toasts/systems/achievement.lua b/ls_Toasts/systems/achievement.lua index 749e5c9..e106bb7 100644 --- a/ls_Toasts/systems/achievement.lua +++ b/ls_Toasts/systems/achievement.lua @@ -3,25 +3,76 @@ local E, L, C = addonTable.E, addonTable.L, addonTable.C -- Lua local _G = getfenv(0) -local next = _G.next -- Mine -local guildAchievements = {} - -local function updateGuildAchievementList() - if not IsInGuild() then - return - end - - for _, categoryID in next, GetGuildCategoryList() do - for i = 1, (GetCategoryNumAchievements(categoryID)) do - local id, _, _, completed = GetAchievementInfo(categoryID, i) - if id then - guildAchievements[id] = completed - end - end - end -end +local FACTION_ACHIEVEMENTS = { + [ 4912] = true, -- Guild Level 25 (Alliance) + [ 5014] = true, -- Guild Northrend Dungeon Hero (Alliance) + [ 5031] = true, -- Horde Slayer (Alliance) + [ 5110] = true, -- Heroic: Trial of the Champion Guild Run (Horde) + [ 5111] = true, -- Heroic: Trial of the Champion Guild Run (Alliance) + [ 5124] = true, -- Guild Northrend Dungeon Hero (Horde) + [ 5126] = true, -- Dungeon Diplomat (Alliance) + [ 5128] = true, -- Classic Battles (Horde) + [ 5129] = true, -- Ambassadors (Alliance) + [ 5130] = true, -- Diplomacy (Alliance) + [ 5131] = true, -- Classic Battles (Alliance) + [ 5145] = true, -- Dungeon Diplomat (Horde) + [ 5151] = true, -- Classy Humans (Alliance) + [ 5152] = true, -- Stay Classy (Alliance) + [ 5153] = true, -- Classy Night Elves (Alliance) + [ 5154] = true, -- Classy Gnomes (Alliance) + [ 5155] = true, -- Classy Dwarves (Alliance) + [ 5156] = true, -- Classy Draenei (Alliance) + [ 5157] = true, -- Classy Worgen (Alliance) + [ 5158] = true, -- Stay Classy (Horde) + [ 5160] = true, -- Classy Orcs (Horde) + [ 5161] = true, -- Classy Tauren (Horde) + [ 5162] = true, -- Classy Trolls (Horde) + [ 5163] = true, -- Classy Blood Elves (Horde) + [ 5164] = true, -- Classy Undead (Horde) + [ 5165] = true, -- Classy Goblins (Horde) + [ 5167] = true, -- Orc Slayer (Alliance) + [ 5168] = true, -- Tauren Slayer (Alliance) + [ 5169] = true, -- Undead Slayer (Alliance) + [ 5170] = true, -- Troll Slayer (Alliance) + [ 5171] = true, -- Blood Elf Slayer (Alliance) + [ 5172] = true, -- Goblin Slayer (Alliance) + [ 5173] = true, -- Human Slayer (Horde) + [ 5174] = true, -- Night Elf Slayer (Horde) + [ 5175] = true, -- Dwarf Slayer (Horde) + [ 5176] = true, -- Gnome Slayer (Horde) + [ 5177] = true, -- Draenei Slayer (Horde) + [ 5178] = true, -- Worgen Slayer (Horde) + [ 5179] = true, -- Alliance Slayer (Horde) + [ 5194] = true, -- City Attacker (Horde) + [ 5195] = true, -- City Attacker (Alliance) + [ 5432] = true, -- Guild Commanders (Alliance) + [ 5433] = true, -- Guild Champions (Horde) + [ 5434] = true, -- Guild Marshals (Alliance) + [ 5435] = true, -- Guild Generals (Horde) + [ 5436] = true, -- Guild Field Marshals (Alliance) + [ 5437] = true, -- Guild Warlords (Horde) + [ 5438] = true, -- Guild Grand Marshals (Alliance) + [ 5439] = true, -- Guild High Warlords (Horde) + [ 5440] = true, -- Guild Battlemasters (Horde) + [ 5441] = true, -- Guild Battlemasters (Alliance) + [ 5492] = true, -- Guild Level 25 (Horde) + [ 5812] = true, -- United Nations (Alliance) + [ 5892] = true, -- United Nations (Horde) + [ 6532] = true, -- Pandaren Slayer (Alliance) + [ 6533] = true, -- Pandaren Slayer (Horde) + [ 6624] = true, -- Classy Pandaren (Alliance) + [ 6625] = true, -- Classy Pandaren (Horde) + [ 6644] = true, -- Pandaren Embassy (Alliance) + [ 6664] = true, -- Pandaren Embassy (Horde) + [ 7448] = true, -- Scenario Roundup (Alliance) + [ 7449] = true, -- Scenario Roundup (Horde) + [ 7843] = true, -- Diplomacy (Horde) + [ 7844] = true, -- Ambassadors (Horde) + [13319] = true, -- Battle of Dazar'alor Guild Run (Horde) + [13320] = true, -- Battle of Dazar'alor Guild Run (Alliance) +} local function Toast_OnClick(self) if self._data.ach_id and not InCombatLockdown() then @@ -57,13 +108,8 @@ end local function Toast_SetUp(event, achievementID, eventArg, isCriteria) -- eventArg is alreadyEarned or criteriaString local _, name, points, _, _, _, _, _, _, icon, _, isGuildAchievement = GetAchievementInfo(achievementID) - if isGuildAchievement then - eventArg = guildAchievements[achievementID] - guildAchievements[achievementID] = true - - if eventArg then - return - end + if isGuildAchievement and FACTION_ACHIEVEMENTS[achievementID] and C.db.profile.types.achievement.filter_guild then + return end local toast = E:GetToast() @@ -119,29 +165,16 @@ local function CRITERIA_EARNED(achievementID, criteriaString) Toast_SetUp("CRITERIA_EARNED", achievementID, criteriaString, true) end -local function PLAYER_ENTERING_WORLD(isInitialLogin) - -- the achievement data might not be available before the initial login, but it's fully available after /reload - if isInitialLogin then - updateGuildAchievementList() - end - - E:UnregisterEvent("PLAYER_ENTERING_WORLD", PLAYER_ENTERING_WORLD) -end - local function Enable() if C.db.profile.types.achievement.enabled then - updateGuildAchievementList() - E:RegisterEvent("ACHIEVEMENT_EARNED", ACHIEVEMENT_EARNED) E:RegisterEvent("CRITERIA_EARNED", CRITERIA_EARNED) - E:RegisterEvent("PLAYER_ENTERING_WORLD", PLAYER_ENTERING_WORLD) end end local function Disable() E:UnregisterEvent("ACHIEVEMENT_EARNED", ACHIEVEMENT_EARNED) E:UnregisterEvent("CRITERIA_EARNED", CRITERIA_EARNED) - E:UnregisterEvent("PLAYER_ENTERING_WORLD", PLAYER_ENTERING_WORLD) end local function Test() @@ -152,12 +185,7 @@ local function Test() Toast_SetUp("ACHIEVEMENT_TEST", 6, true) -- guild, Everyone Needs a Logo - local old = guildAchievements[5362] - guildAchievements[5362] = false - Toast_SetUp("ACHIEVEMENT_TEST", 5362) - - guildAchievements[5362] = old end E:RegisterOptions("achievement", { @@ -165,6 +193,7 @@ E:RegisterOptions("achievement", { anchor = 1, dnd = false, tooltip = true, + filter_guild = false, }, { name = L["TYPE_ACHIEVEMENT"], get = function(info) @@ -199,6 +228,13 @@ E:RegisterOptions("achievement", { type = "toggle", name = L["TOOLTIPS"], }, + filter_guild = { + order = 4, + type = "toggle", + name = L["FILTER_GUILD_ACHIEVEMENTS"], + desc = L["FILTER_GUILD_ACHIEVEMENTS_DESC"], + width = 1.25, + }, test = { type = "execute", order = 99,