Skip to content

Commit

Permalink
Check parent maps
Browse files Browse the repository at this point in the history
This adds support for caves and other special areas within a zone
that have their own map.
  • Loading branch information
Phanx committed Jul 29, 2018
1 parent b389513 commit e479c5c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ZoneAchievementTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,18 @@ f:SetScript("OnEvent", function(self, event)
local mapID = C_Map.GetBestMapForUnit("player")
if not mapID then return end

local achievementID, achievementName, completed, _ = AchievementForZone[zoneID]
local achievementID = AchievementForZone[mapID]
if not achievementID then
-- Check parents in case we're in a cave.
local mapInfo = C_Map.GetMapInfo(mapID)
while mapInfo and mapInfo.parentMapID and not achievementID do
mapID = mapInfo.parentMapID
mapInfo = C_Map.GetMapInfo(mapID)
achievementID = AchievementForZone[mapID]
end
end

local achievementName, completed, _
if type(achievementID) == "number" then
_, achievementName, _, _, _, _, _, _, _, _, _, _, completed = GetAchievementInfo(achievementID)
elseif achievementID then
Expand Down

0 comments on commit e479c5c

Please sign in to comment.