Skip to content

Commit

Permalink
Show world quests on child maps correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Aug 28, 2024
1 parent cb8becf commit c279332
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
11 changes: 10 additions & 1 deletion provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ function provider:GetPinTemplate()
return 'BetterWorldQuestPinTemplate'
end

-- override ShouldShowQuest method to also show on parent maps
-- override ShouldOverrideShowQuest method to show pins on continent maps
function provider:ShouldOverrideShowQuest(mapID) --, questInfo)
local mapInfo = C_Map.GetMapInfo(mapID)
return mapInfo.mapType == Enum.UIMapType.Continent
end

-- override ShouldShowQuest method to show pins on parent maps
function provider:ShouldShowQuest(questInfo)
if WorldQuestDataProviderMixin.ShouldShowQuest(self, questInfo) then -- super

Check warning on line 21 in provider.lua

View workflow job for this annotation

GitHub Actions / lint

accessing undefined variable 'WorldQuestDataProviderMixin'
return true
end

return addon:IsChildMap(self:GetMap():GetMapID(), questInfo.mapID)
end

WorldMapFrame:AddDataProvider(provider)

-- remove the default provider
Expand Down
13 changes: 7 additions & 6 deletions utils.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
local _, addon = ...

local PARENT_MAPS = {
local CONTINENTS = {
-- list of all continents and their sub-zones that have world quests
[2274] = { -- Khaz Algar
[2248] = true, -- Isle of Dorn
[2215] = true, -- Hallowfall
[2214] = true, -- The Ringing Deeps
[2255] = true, -- Azj-Kahet
[2256] = true, -- Azj-Kahet - Lower (don't know how this works yet)
[2213] = true, -- City of Threads (not really representable on Algar, TBD)
[2216] = true, -- City of Threads - Lower (again, don't know how this works)
[2256] = true, -- Azj-Kahet - Lower
[2213] = true, -- City of Threads
[2216] = true, -- City of Threads - Lower
},
[1978] = { -- Dragon Isles
[2022] = true, -- The Walking Shores
Expand Down Expand Up @@ -54,9 +54,10 @@ local PARENT_MAPS = {
}

function addon:IsParentMap(mapID)
return not not PARENT_MAPS[mapID]
return not not CONTINENTS[mapID]
end

function addon:IsChildMap(parentMapID, mapID)
return not not (PARENT_MAPS[parentMapID] and PARENT_MAPS[parentMapID][mapID])
local mapInfo = C_Map.GetMapInfo(mapID)
return parentMapID and mapID and mapInfo and mapInfo.parentMapID and mapInfo.parentMapID == parentMapID
end

0 comments on commit c279332

Please sign in to comment.