Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- committed Sep 25, 2024
2 parents 1f7427f + d223925 commit 6643d8f
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 60 deletions.
3 changes: 0 additions & 3 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ read_globals = {
"GarrisonShipyardFollowerTooltip",
"GetAchievementInfo",
"GetArchaeologyRaceInfoByID",
"GetCategoryNumAchievements",
"GetCVarBool",
"GetGuildCategoryList",
"GetInstanceInfo",
"GetLFGCompletionReward",
"GetLFGCompletionRewardItem",
Expand Down Expand Up @@ -134,7 +132,6 @@ read_globals = {
"INVSLOT_TRINKET2",
"INVSLOT_WAIST",
"INVSLOT_WRIST",
"IsInGuild",
"IsLoggedIn",
"IsModifiedClick",
"IsShiftKeyDown",
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 6 additions & 5 deletions ls_Toasts/core/changelog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
]]
2 changes: 1 addition & 1 deletion ls_Toasts/embeds/AceConfig-3.0/AceConfig-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ls_Toasts/embeds/AceDB-3.0/AceDB-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion ls_Toasts/embeds/AceDBOptions-3.0/AceDBOptions-3.0.lua
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion ls_Toasts/embeds/AceGUI-3.0/AceGUI-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--[[ $Id$ ]]--
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1272 2022-08-29 15:56:35Z nevcairiel $ ]]--

local AceGUI = LibStub("AceGUI-3.0")

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions ls_Toasts/locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions ls_Toasts/locales/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = "Показывать кв. пр."
Expand Down
1 change: 1 addition & 0 deletions ls_Toasts/locales/zhTW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = "成就"
Expand Down
2 changes: 1 addition & 1 deletion ls_Toasts/ls_Toasts.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
120 changes: 78 additions & 42 deletions ls_Toasts/systems/achievement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -152,19 +185,15 @@ 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", {
enabled = true,
anchor = 1,
dnd = false,
tooltip = true,
filter_guild = false,
}, {
name = L["TYPE_ACHIEVEMENT"],
get = function(info)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6643d8f

Please sign in to comment.