diff --git a/integrations/WorldQuestTab.lua b/integrations/WorldQuestTab.lua index 553065c..8c1a852 100644 --- a/integrations/WorldQuestTab.lua +++ b/integrations/WorldQuestTab.lua @@ -2,7 +2,7 @@ local appName, app = ... -- Returns the AddOn name and a unique table app.Event:Register("ADDON_LOADED", function(addOnName, containsBindings) if addOnName == "WorldQuestTab" then - local function worldquesttabIntegration() + local function wqtRewardsList() -- Put our icon on the rewards list if WQT_QuestScrollFrame then local wqtRewards = { WQT_QuestScrollFrame.Contents:GetChildren() } @@ -30,10 +30,44 @@ app.Event:Register("ADDON_LOADED", function(addOnName, containsBindings) end end end + end + + WQT_WorldQuestFrame:RegisterCallback("UpdateQuestList", wqtRewardsList, appName) - -- TODO: icon on world quest pins + -- Hook our overlay onto the world quest pins + local function wqtMapPins() + C_Timer.After(0.1, function() + for k, v in pairs({ WorldMapFrame.ScrollContainer.Child:GetChildren() }) do + if v.RingBG then + local pin = v + if not pin.TLHOverlay then + pin.TLHOverlay = CreateFrame("Frame", nil, pin) + pin.TLHOverlay:SetAllPoints(pin) + pin.TLHOverlay:SetScale(0.8) -- Make it a little smaller + end + pin.TLHOverlay:Hide() -- Hide our overlay initially, updating doesn't work like for regular itemButtons + + if pin.questID then + local bestIndex, bestType = QuestUtils_GetBestQualityItemRewardIndex(pin.questID) + if bestIndex and bestType then + local itemLink = GetQuestLogItemLink(bestType, bestIndex, pin.questID) + if itemLink then + app.ItemOverlay(pin.TLHOverlay, itemLink) + pin.TLHOverlay.text:SetText("") -- No bind text for these + else + pin.TLHOverlay:Hide() + end + else + pin.TLHOverlay:Hide() + end + end + end + end + end) end - WQT_WorldQuestFrame:RegisterCallback("UpdateQuestList", worldquesttabIntegration, appName) + WorldMapFrame:HookScript("OnShow", wqtMapPins) + EventRegistry:RegisterCallback("MapCanvas.MapSet", wqtMapPins) + WQT_WorldQuestFrame:RegisterCallback("UpdateQuestList", wqtMapPins, appName) end end) \ No newline at end of file diff --git a/modules/ItemOverlay.lua b/modules/ItemOverlay.lua index e7f22da..d540c8d 100644 --- a/modules/ItemOverlay.lua +++ b/modules/ItemOverlay.lua @@ -783,6 +783,7 @@ function app.ItemOverlayHooks() if not pin.TLHOverlay then pin.TLHOverlay = CreateFrame("Frame", nil, pin) pin.TLHOverlay:SetAllPoints(pin) + pin.TLHOverlay:SetScale(0.8) -- Make it a little smaller end pin.TLHOverlay:Hide() -- Hide our overlay initially, updating doesn't work like for regular itemButtons