diff --git a/TomTom.lua b/TomTom.lua index 8fabe04..f072dc5 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -34,14 +34,21 @@ TomTom.compat = compat do local Astrolabe = DongleStub("Astrolabe-1.0") + local orig = GetCurrentMapAreaID() + -- Create a lookup table from mapID to c,z pairs local mapcz = {} - for cid, zlist in ipairs(Astrolabe.ContinentList) do - for zid, mapid in pairs(zlist) do + for cid, zlist in ipairs{GetMapContinents()} do + for zid, mapid in ipairs{GetMapZones(cid)} do + SetMapZoom(cid, zid) + local mapid = GetCurrentMapAreaID() mapcz[mapid] = {cid, zid} + print(mapid, cid, zid, GetMapInfo()) end end + SetMapByID(orig) + -- Speed up minimap updates Astrolabe.MinimapUpdateTime = 0.1 @@ -630,6 +637,11 @@ function TomTom:InitializeDropdown(uid) UIDropDownMenu_Initialize(self.dropdown, init_dropdown) end +function TomTom:GetData(uid) + local data = waypoints[uid] + return data +end + function TomTom:UIDIsSaved(uid) local data = waypoints[uid] if data then diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua index d3c102c..3b6379b 100644 --- a/TomTom_Waypoints.lua +++ b/TomTom_Waypoints.lua @@ -439,6 +439,8 @@ do local data = self.point if data.worldmap and data.show_world and not disabled then local x,y = compat:PlaceIconOnWorldMap(TomTomMapOverlay, self, data.c, data.z, data.x, data.y) + local pdata = TomTom:GetData(data.uid) or {} + if (x and y and (0 < x and x <= 1) and (0 < y and y <= 1)) then self:Show() else diff --git a/libs/Astrolabe/Astrolabe.lua b/libs/Astrolabe/Astrolabe.lua index c9a492a..cfe8272 100644 --- a/libs/Astrolabe/Astrolabe.lua +++ b/libs/Astrolabe/Astrolabe.lua @@ -1,7 +1,7 @@ --[[ Name: Astrolabe -Revision: $Rev: 118 $ -$Date: 2010-11-28 04:18:59 +0000 (Sun, 28 Nov 2010) $ +Revision: $Rev: 121 $ +$Date: 2010-12-04 22:39:19 +0000 (Sat, 04 Dec 2010) $ Author(s): Esamynn (esamynn at wowinterface.com) Inspired By: Gatherer by Norganna MapLibrary by Kristofer Karlsson (krka at kth.se) @@ -42,7 +42,7 @@ Note: -- DO NOT MAKE CHANGES TO THIS LIBRARY WITHOUT FIRST CHANGING THE LIBRARY_VERSION_MAJOR -- STRING (to something unique) OR ELSE YOU MAY BREAK OTHER ADDONS THAT USE THIS LIBRARY!!! local LIBRARY_VERSION_MAJOR = "Astrolabe-1.0" -local LIBRARY_VERSION_MINOR = tonumber(string.match("$Revision: 118 $", "(%d+)") or 1) +local LIBRARY_VERSION_MINOR = tonumber(string.match("$Revision: 121 $", "(%d+)") or 1) if not DongleStub then error(LIBRARY_VERSION_MAJOR .. " requires DongleStub.") end if not DongleStub:IsNewerVersion(LIBRARY_VERSION_MAJOR, LIBRARY_VERSION_MINOR) then return end @@ -254,8 +254,6 @@ function Astrolabe:TranslateWorldMapPosition( M, F, xPos, yPos, nM, nF ) if ( nF ~= 0 ) then mapData = mapData[nF]; end - xPos = xPos - mapData.xOffset; - yPos = yPos - mapData.yOffset; else -- different continents, same world @@ -291,6 +289,10 @@ function Astrolabe:TranslateWorldMapPosition( M, F, xPos, yPos, nM, nF ) end end + -- need to account for the offset in the new system so we can + -- correctly translate into 0-1 style coordinates + xPos = xPos - mapData.xOffset; + yPos = yPos - mapData.yOffset; end @@ -355,6 +357,13 @@ function Astrolabe:GetMapID(continent, zone) end end +function Astrolabe:GetNumFloors( mapID ) + if ( type(mapID) == "number" ) then + local mapData = WorldMapSize[mapID] + return #mapData + end +end + function Astrolabe:GetMapInfo( mapID, mapFloor ) mapFloor = mapFloor or 0 local mapData = WorldMapSize[mapID] @@ -1461,7 +1470,7 @@ end zeroData = { xOffset = 0, height = 0, yOffset = 0, width = 0, __index = zeroDataFunc }; setmetatable(zeroData, zeroData); -function printError( ... ) +local function printError( ... ) if ( ASTROLABE_VERBOSE) then print(...) end