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 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.

  • Avatar of kagaro kagaro Apr 24, 2011 at 14:26 UTC - 0 likes

    if you zone into BT you dont get a map, and it reports its zone as ShadowMoonValley. then to boot you dont even get coords inside

  • Avatar of mysticalos mysticalos Apr 24, 2011 at 00:17 UTC - 0 likes

    wtb black temple and sunwell data not being half assed/incomplete. sigh at blizzard leaving things unfinsihed

    Last edited Apr 24, 2011 by mysticalos

Facts

Date created
May 30, 2010
Categories
Last update
Oct 17, 2014
Development stage
Release
Language
  • enUS
License
All Rights Reserved
Curse link
LibMapData-1.0
Reverse relationships
1
Downloads
162,525
Recent files
  • 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
  • A: r142 for 5.4.8 Oct 10, 2014
  • A: r141 for 5.4.0 Sep 12, 2013

Authors

Relationships

Tool used
DataTools
Embedded library
CallbackHandler-1.0
LibStub