1
1
-- globals
2
2
local C_MythicPlus , C_ChallengeMode , C_WeeklyRewards = C_MythicPlus , C_ChallengeMode , C_WeeklyRewards
3
- local C_Item , DifficultyUtil , PVPUtil , CreateFrame , max , tostring = C_Item , DifficultyUtil , PVPUtil , CreateFrame , max , tostring
3
+ local C_Item , DifficultyUtil , PVPUtil , CreateFrame , max , tostring , C_Timer = C_Item , DifficultyUtil , PVPUtil , CreateFrame , max , tostring , C_Timer
4
4
local WeeklyRewardsFrame , GameTooltip , Enum = WeeklyRewardsFrame , GameTooltip , Enum
5
5
local GameTooltip_SetTitle , GameTooltip_AddNormalLine , GameTooltip_AddHighlightLine , GameTooltip_AddColoredLine , GameTooltip_AddBlankLineToTooltip = GameTooltip_SetTitle , GameTooltip_AddNormalLine , GameTooltip_AddHighlightLine , GameTooltip_AddColoredLine , GameTooltip_AddBlankLineToTooltip
6
6
local WEEKLY_REWARDS_MYTHIC_TOP_RUNS , WEEKLY_REWARDS_IMPROVE_ITEM_LEVEL , WEEKLY_REWARDS_COMPLETE_MYTHIC_SHORT , WEEKLY_REWARDS_COMPLETE_MYTHIC = WEEKLY_REWARDS_MYTHIC_TOP_RUNS , WEEKLY_REWARDS_IMPROVE_ITEM_LEVEL , WEEKLY_REWARDS_COMPLETE_MYTHIC_SHORT , WEEKLY_REWARDS_COMPLETE_MYTHIC
@@ -131,6 +131,10 @@ local ItemTierNumRanksBySeason = {
131
131
[" myth" ] = 6 ,
132
132
},
133
133
}
134
+ local ExampleRaidRewardItemIDBySeason = {
135
+ -- The War Within Season 3
136
+ [108 ] = 237567 , -- Logic Gate: Alpha
137
+ }
134
138
-- fallback value
135
139
local WEEKLY_MAX_DUNGEON_THRESHOLD = 8
136
140
@@ -170,11 +174,16 @@ local GetCurrentSeasonRewardLevels = function()
170
174
return currentSeasonRewardLevels .HEROIC , currentSeasonRewardLevels .MYTHIC
171
175
end
172
176
end
177
+ local GetExampleRaidRewardItemID = function ()
178
+ local rewardSeasonID = GetRewardSeasonID ()
179
+ return ExampleRaidRewardItemIDBySeason [rewardSeasonID ]
180
+ end
173
181
local GetRewardLevelFromRaidLevel = function (raidLevel , blizzItemLevel )
174
182
local rewardSeasonID = GetRewardSeasonID ()
175
183
local currentSeasonRewardLevels = RaidItemLevelsBySeason [rewardSeasonID ]
176
184
if currentSeasonRewardLevels then
177
- return currentSeasonRewardLevels [raidLevel ] or blizzItemLevel or 0
185
+ -- prefer the blizz item level because it takes into account bosses killed
186
+ return blizzItemLevel or currentSeasonRewardLevels [raidLevel ] or 0
178
187
end
179
188
return blizzItemLevel or 0
180
189
end
@@ -466,9 +475,23 @@ local ShowPreviewItemTooltip = function(self)
466
475
GameTooltip :Show ()
467
476
end
468
477
478
+ local pendingActivity = {}
479
+ function GreatVaultKeyInfoFrame :ITEM_DATA_LOAD_RESULT (event , id , success )
480
+ local exampleRaidRewardItemID = GetExampleRaidRewardItemID ()
481
+ if not exampleRaidRewardItemID or id == exampleRaidRewardItemID then
482
+ self :UnregisterEvent (event )
483
+ if id == exampleRaidRewardItemID and success then
484
+ for i = 1 , # pendingActivity do
485
+ pendingActivity [i ]:Refresh (pendingActivity [i ].info )
486
+ end
487
+ pendingActivity = {}
488
+ end
489
+ end
490
+ end
491
+
469
492
-- overrides SetProgressText
470
493
-- original: https://github.com/BigWigsMods/WoWUI/blob/live/AddOns/Blizzard_WeeklyRewards/Blizzard_WeeklyRewards.lua
471
- local SetProgressText = function (self , text )
494
+ local SetProgressText = function (self , text , isRetry )
472
495
local activityInfo = self .info
473
496
if text then
474
497
self .Progress :SetText (text )
@@ -477,7 +500,24 @@ local SetProgressText = function(self, text)
477
500
elseif self .unlocked then
478
501
if activityInfo .type == Enum .WeeklyRewardChestThresholdType .Raid then
479
502
local itemLink = C_WeeklyRewards .GetExampleRewardItemHyperlinks (activityInfo .id )
480
- local itemLevel = itemLink and C_Item .GetDetailedItemLevelInfo (itemLink ) or nil
503
+ local detailedItemLevelInfo = itemLink and C_Item .GetDetailedItemLevelInfo (itemLink )
504
+ if not detailedItemLevelInfo then
505
+ pendingActivity [# pendingActivity + 1 ] = self
506
+ if # pendingActivity == 1 then
507
+ local exampleRaidRewardItemID = GetExampleRaidRewardItemID ()
508
+ if exampleRaidRewardItemID then
509
+ GreatVaultKeyInfoFrame :RegisterEvent (" ITEM_DATA_LOAD_RESULT" )
510
+ C_Item .RequestLoadItemDataByID (exampleRaidRewardItemID )
511
+ elseif not isRetry then
512
+ -- missing season data, try again once
513
+ pendingActivity = {}
514
+ C_Timer .After (2 , function ()
515
+ self :SetProgressText (nil , true )
516
+ end )
517
+ end
518
+ end
519
+ end
520
+ local itemLevel = itemLink and detailedItemLevelInfo or nil
481
521
local rewardLevel = GetRewardLevelFromRaidLevel (activityInfo .level , itemLevel )
482
522
self .Progress :SetJustifyH (" RIGHT" )
483
523
self .Progress :SetFormattedText (" %s\n %s" , DifficultyUtil .GetDifficultyName (activityInfo .level ), GetItemTierFromItemLevel (rewardLevel ))
0 commit comments