Skip to content

Commit 4401fd1

Browse files
committed
Prepare data for S3, which will automatically update on patch day
1 parent b86835a commit 4401fd1

File tree

4 files changed

+42
-24
lines changed

4 files changed

+42
-24
lines changed

Utils_Achievement.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ end
121121
--- @param achievementID number
122122
--- @return string
123123
function AchiementUtil:ReplaceKeywordWithAchievementLink(message, keyword, achievementID)
124+
if not GetAchievementLink(achievementID) then return message end
124125
keyword = strupper(keyword)
125126
if message:find(keyword) then
126127
local found = findKeywordInMessage(message, keyword)

Utils_Module.lua

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ local LibStub = _G.LibStub
44
local C_LFGList = _G.C_LFGList
55
local ipairs = _G.ipairs
66

7-
87
local name = ...
8+
9+
local currentPatch = select(4, GetBuildInfo())
10+
911
--- @class LazyCurve
1012
local LazyCurve = LibStub('AceAddon-3.0'):GetAddon(name)
1113
if not LazyCurve then return end
@@ -18,42 +20,55 @@ ModuleUtil.moduleInfoTables = {}
1820
--- @param module LazyCurveModule
1921
--- @return LazyCurveActivityTable_enriched
2022
function ModuleUtil:GetLatestModuleRaid(module)
21-
return self:GetModuleInfoTable(module)[1]
23+
return self:GetModuleInfoTable(module)[1]
2224
end
2325

2426
--- @param module LazyCurveModule
2527
--- @return boolean
2628
function ModuleUtil:ModuleHasLatestRaid(module)
27-
return LazyCurve.CURRENT_EXPANSION == module.EXPANSION and module.type == LazyCurve.MODULE_TYPE_RAID
29+
return LazyCurve.CURRENT_EXPANSION == module.EXPANSION and module.type == LazyCurve.MODULE_TYPE_RAID
2830
end
2931

3032
--- @param module LazyCurveModule
3133
--- @param groupId number
3234
--- @return LazyCurveActivityTable_enriched|false
3335
function ModuleUtil:GetModuleInfoTableByActivityGroup(module, groupId)
34-
for _, activityTable in ipairs(self:GetModuleInfoTable(module)) do
35-
if activityTable.groupId == groupId then
36-
return activityTable
37-
end
38-
end
39-
return false
36+
for _, activityTable in ipairs(self:GetModuleInfoTable(module)) do
37+
if activityTable.groupId == groupId then
38+
return activityTable
39+
end
40+
end
41+
return false
4042
end
4143

4244
--- @param module LazyCurveModule
4345
--- @return LazyCurveActivityTable_enriched[]
4446
function ModuleUtil:GetModuleInfoTable(module)
45-
local moduleName = module.moduleName
46-
if not self.moduleInfoTables[moduleName] then
47-
--- @class LazyCurveActivityTable_enriched[]: LazyCurveActivityTable[]
48-
local infoTable = module:GetInfoTable()
49-
for _, activityTable in ipairs(infoTable) do
50-
local localName, _ = C_LFGList.GetActivityGroupInfo(activityTable.groupId)
51-
activityTable.longName = localName or activityTable.shortName
52-
activityTable.module = module
53-
activityTable.isLatest = self:ModuleHasLatestRaid(module) and infoTable[1] == activityTable
54-
end
55-
self.moduleInfoTables[moduleName] = infoTable
56-
end
57-
58-
return self.moduleInfoTables[moduleName]
59-
end
47+
local moduleName = module.moduleName
48+
if not self.moduleInfoTables[moduleName] then
49+
local firstValidTable = nil
50+
--- @class LazyCurveActivityTable_enriched[]: LazyCurveActivityTable[]
51+
local infoTable = module:GetInfoTable()
52+
for i, activityTable in ipairs(infoTable) do
53+
if activityTable.minPatch and currentPatch < activityTable.minPatch then
54+
-- Skip activities that are not available in the current patch
55+
infoTable[i] = nil
56+
else
57+
firstValidTable = firstValidTable or activityTable
58+
local localName, _ = C_LFGList.GetActivityGroupInfo(activityTable.groupId)
59+
activityTable.longName = localName or activityTable.shortName
60+
activityTable.module = module
61+
activityTable.isLatest = self:ModuleHasLatestRaid(module) and firstValidTable == activityTable
62+
end
63+
end
64+
-- Remove nil entries from the table
65+
for i = #infoTable, 1, -1 do
66+
if not infoTable[i] then
67+
table.remove(infoTable, i)
68+
end
69+
end
70+
self.moduleInfoTables[moduleName] = infoTable
71+
end
72+
73+
return self.moduleInfoTables[moduleName]
74+
end

modules/WarWithin/TheWarWIthin.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function Module:GetInfoTable()
1616
--- @type LazyCurveActivityTable[]
1717
local infoTable = {
1818
{
19+
minPatch = 110200,
1920
shortName = "MFO",
2021
alternativeKeyword = "dimensius",
2122
groupId = 378,

types.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
---@field GetInfoTable fun():LazyCurveActivityTable[] # ordered list of activities, most recent first
55

66
---@class LazyCurveActivityTable
7+
---@field minPatch number|nil # if set, the activity is ignored if the current patch is lower than this value
78
---@field shortName string
89
---@field alternativeKeyword string
910
---@field groupId number # Activity Group ID

0 commit comments

Comments
 (0)