LibMapData-1.0

Small library that provides mapfile data. it include width,height, upper left x,y and lower right x,y. This data includes multi-floor maps such as the new instances.

API Documentation

To get the mapfile names use GetMapInfo() on the current map. Filenames are constant across localizations.

Sample usage:

     mapfiles = LibStub("LibMapData-1.0"); 
     -- get the size of Coth defaulting to the first floor size
     local width,height = mapfiles:MapArea('CoTStratholme')
     -- get the size of the 8th floor of icc 
     width,height = mapfiles:MapArea('IcecrownCitadel',8) 
     -- get the size of the Arati mapfile.
     width,height = mapfiles:MapArea('Arathi')

The floors are optional and if a given floor is not found 0,0 will be returned. This lib came about as a result of several addons needing the data, and simply copying and pasting them in each copy occupies around 44k of memory.

LibMapData now supports Mapchanged callback event. Sample usage:

mapfiles = LibStub("LibMapData-1.0"); 
mapfiles:RegisterCallback("MapChanged",function(event,map,floor,w,h) print("Map is now "..map) end

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of kagaro kagaro Jul 01, 2011 at 10:57 UTC - 0 likes

    I'll update to reflect mysticalos, the dbc data is way wrong I'm nit sure why. The dbc files only shows 2 floors period not 3 but the map drop down shows 3 floors. I wasn't able to get into the zone myself either last night I was using data provided by others as to size

  • Avatar of mysticalos mysticalos Jul 01, 2011 at 02:37 UTC - 0 likes

    firelands sizes are still wrong, the blizz api also reported wrong sizes sigh i used /dumb GetMapInfo() and those are sizes it reportegd and i plugged into dbm but they are way way WAY off in areas 2 and 3 still.

    here are real ones for area 1 and 2 at least verified in game using actual calculations and mage blink (20 yards)
    http://www.deadlybossmods.com/phpbb3/viewtopic.php?f=1&t=2269&p=12062#p12062
    oldschool methods!

        1, 1587.0, 1058.0,     -- The Firelands (this one is as cose to accurate as i could get it
        2, 1440.0, 960)        -- Sulfuron Keep (looks like this one actually was right)

    I could not find area 3 yet cause i cannot access it in game until. maybe that's the one that's 375.0, 250.0? that's what i'm gonna assume for now. WTF is up with blizzards invalid sizes in data files AND GetMapInfo() api anyways?

    Last edited Jul 01, 2011 by mysticalos
  • Avatar of kagaro kagaro Jun 30, 2011 at 23:39 UTC - 0 likes

    i updated the code to now cache, need to test before i drop it in, in either case there are no errors in game any more

  • Avatar of kagaro kagaro Jun 30, 2011 at 23:27 UTC - 0 likes

    It should be fine, i just forgot to tag it so plugins got the data.

  • Avatar of Cladhaire Cladhaire Jun 30, 2011 at 14:00 UTC - 0 likes

    Perhaps you could cache the fact that a message has been displayed and avoid displaying it more than once. I think that would be an improvement.

  • Avatar of bsmorgan bsmorgan Jun 30, 2011 at 13:54 UTC - 0 likes
    	setmetatable(mapData, { __index = function(t, k) if k then DEFAULT_CHAT_FRAME:AddMessage("LibMapData-1.0 is missing data for "..k) end; return emptyMaps end })
    	setmetatable(idToMap, { __index = function(t, k) if k then DEFAULT_CHAT_FRAME:AddMessage("LibMapData-1.0 is missing data for area id "..k) end; return k end})
    	setmetatable(mapToLocal, { __index = function(t,k) if k then DEFAULT_CHAT_FRAME:AddMessage("LibMapData-1.0 is missing localized data for "..k) end; return k end})
    

    There has got to be a better way to handle missing data than spamming chat with thousands of messages. Please find it.

  • Avatar of jamzak811 jamzak811 Jun 30, 2011 at 07:58 UTC - 0 likes

    Missing for 800 in firelands

  • Avatar of tordenflesk tordenflesk Jun 29, 2011 at 18:20 UTC - 0 likes

    Missing for 800

  • Avatar of Cybeloras Cybeloras Jun 16, 2011 at 18:12 UTC - 0 likes

    Missing data for Sethekk Halls. Getting spammed with "LibMapData-1.0 is missing data for 723" as soon as I zone in.

  • Avatar of mysticalos mysticalos Apr 24, 2011 at 18:05 UTC - 0 likes

    yeah i saw that, i went on ptr just to see what was up and was disapinoted by this, and the fact sunwell map is also only about 1/3 done.

Facts

Date created
May 30, 2010
Categories
Last update
Dec 22, 2014
Development stage
Release
Language
  • enUS
License
All Rights Reserved
Curse link
LibMapData-1.0
Reverse relationships
1
Downloads
169,146
Recent files
  • A: r147 for 6.0.3 Dec 22, 2014
  • A: r146 for 6.0.3 Nov 21, 2014
  • R: 0.31 for 6.0.2 Oct 17, 2014
  • A: r144 for 6.0.2 Oct 17, 2014
  • A: r143 for 6.0.2 Oct 16, 2014

Authors

Relationships

Tool used
DataTools
Embedded library
CallbackHandler-1.0
LibStub