area lookup fixes
This commit is contained in:
@@ -45,13 +45,23 @@ ZoneDB.zoneIDs = ZoneDB.private.zoneIDs or {}
|
||||
|
||||
|
||||
-- Overrides for UiMapId to AreaId
|
||||
-- IMPORTANT: Only override specific real maps, NOT cosmic/world maps (946, 947, etc.)
|
||||
-- that span multiple zones. Overriding 946/947 to a single zone breaks all other zones.
|
||||
local UiMapIdOverrides = {
|
||||
[246] = 3713,
|
||||
[1415] = 668, -- Eastern Kingdoms (matches Undercity on Ascension)
|
||||
[947] = 668, -- Azeroth (matches Undercity on Ascension)
|
||||
[1241] = 3430, -- Sunstrider Isle (uiMapId 1241 → areaId 3430)
|
||||
[946] = 3430, -- Sunstrider Isle ghost/loading map → areaId 3430
|
||||
[1238] = 668, -- Northshire Valley child map (Conquest of Azeroth)
|
||||
[946] = 668, -- Northshire Valley zone map (Conquest of Azeroth) - GetCurrentUiMapID() returns 946, not 1238
|
||||
}
|
||||
-- Reverse mapping: areaId → uiMapId for GetUiMapIdByAreaId lookups.
|
||||
-- Northshire Valley (areaId 668) uses uiMapId 1238.
|
||||
ZoneDB.private.areaIdToUiMapId[668] = 1238
|
||||
areaIdToUiMapId[668] = 1238
|
||||
-- Also populate the cache so the fast path works without a lazy lookup.
|
||||
if uiMapIdToAreaIdCache[1238] == nil then
|
||||
uiMapIdToAreaIdCache[1238] = 668
|
||||
end
|
||||
local parentZoneToSubZone = {} -- Generated
|
||||
local zoneMap = {} -- Generated
|
||||
|
||||
|
||||
@@ -660,10 +660,10 @@ sortedTargets = {}
|
||||
if not playerX or not playerY or not playerInstance then
|
||||
-- Fallback: get map-relative position then convert to world coords via HBD.
|
||||
-- Use the player's current uiMapId as the map basis for the conversion.
|
||||
-- IMPORTANT: never use 946 (ghost window/world map) — it has no world coord data.
|
||||
-- If GetCurrentUiMapId returns 946, fall back to ZoneDB from the actual zone.
|
||||
-- IMPORTANT: never use 946/947 (world/cosmic maps) — they have no world coord data.
|
||||
-- If GetCurrentUiMapId returns a world map, fall back to ZoneDB from the actual zone.
|
||||
local pUiMapId = QuestiePlayer:GetCurrentUiMapId()
|
||||
if not pUiMapId or pUiMapId == 947 or pUiMapId == 0 or pUiMapId == 946 then
|
||||
if not pUiMapId or pUiMapId == 946 or pUiMapId == 947 or pUiMapId == 0 then
|
||||
local zoneId = QuestiePlayer:GetCurrentZoneId() or select(7, GetInstanceInfo())
|
||||
if debugArrow then
|
||||
print(string.format("UpdateNearestTargets: pUiMapId=%s (invalid), looking up via zoneId=%s", tostring(pUiMapId), tostring(zoneId)))
|
||||
@@ -672,6 +672,16 @@ if not playerX or not playerY or not playerInstance then
|
||||
pUiMapId = ZoneDB:GetUiMapIdByAreaId(zoneId)
|
||||
end
|
||||
end
|
||||
-- Additional safeguard: if pUiMapId is still a world/cosmic map, force lookup from zone
|
||||
if not pUiMapId or pUiMapId == 946 or pUiMapId == 947 or pUiMapId == 0 then
|
||||
local zoneId = QuestiePlayer:GetCurrentZoneId()
|
||||
if zoneId and zoneId ~= 0 then
|
||||
pUiMapId = ZoneDB:GetUiMapIdByAreaId(zoneId)
|
||||
if debugArrow then
|
||||
print(string.format("UpdateNearestTargets: forced pUiMapId=%s via zoneId=%s", tostring(pUiMapId), tostring(zoneId)))
|
||||
end
|
||||
end
|
||||
end
|
||||
pUiMapId = pUiMapId or 0
|
||||
|
||||
if debugArrow then
|
||||
|
||||
@@ -110,7 +110,8 @@ function QuestiePlayer.HasRequiredClass(requiredClasses)
|
||||
end
|
||||
|
||||
function QuestiePlayer:GetCurrentZoneId()
|
||||
local uiMapId = C_Map.GetBestMapForUnit("player")
|
||||
local uiMapIdOrTable = C_Map.GetBestMapForUnit("player")
|
||||
local uiMapId = type(uiMapIdOrTable) == "table" and uiMapIdOrTable.uiMapID or uiMapIdOrTable
|
||||
if uiMapId then
|
||||
local areaId = ZoneDB:GetAreaIdByUiMapId(uiMapId)
|
||||
if areaId then
|
||||
@@ -123,7 +124,8 @@ function QuestiePlayer:GetCurrentZoneId()
|
||||
end
|
||||
|
||||
function QuestiePlayer:GetCurrentUiMapId()
|
||||
local uiMapId = C_Map.GetBestMapForUnit("player")
|
||||
local uiMapIdOrTable = C_Map.GetBestMapForUnit("player")
|
||||
local uiMapId = type(uiMapIdOrTable) == "table" and uiMapIdOrTable.uiMapID or uiMapIdOrTable
|
||||
if uiMapId then
|
||||
return uiMapId
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user