Skip to content

Commit

Permalink
Completed the integration for World Quest Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Slackluster committed Nov 22, 2024
1 parent 1b3af47 commit e77b30b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
40 changes: 37 additions & 3 deletions integrations/WorldQuestTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions modules/ItemOverlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e77b30b

Please sign in to comment.