Download
(12 Kb)
Download
Updated: 01/17/24 10:26 AM
Compatibility:
Endless Archive (9.2.5)
Updated:01/17/24 10:26 AM
Created:04/25/22 09:08 PM
Monthly downloads:39,529
Total downloads:1,198,574
Favorites:585
MD5:
LibMapData  Popular! (More than 5000 hits)
Version: 1.12
by: Sharlikran [More]
Intent

For my use case I need one central mod to control the map information of where the player is. I don't want to call SetMapToPlayerLocation() and CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged") at various times in 5 mods.

With this library used as a dependency for the intended mods, FireCallbacks:OnWorldMapChanged is only used when GetMapTileTexture() changes. This reduces the chance that the mods it is used with are changing the map too frequently.

Grated SetMapToPlayerLocation() is called when the player closes the map and for events EVENT_ZONE_CHANGED, EVENT_LINKED_WORLD_POSITION_CHANGED, and EVENT_PLAYER_ACTIVATED to make sure the map information is current.

However, it happens within the library not the mods that depend on it resulting in fewer calls to those API commands for maps.

Intended use, for now

This will be used eventually with Destinations, Quest Map, LibQuestData, Skyshards, Lorebooks, and ScrySpy.

You could use it to convert a zoneId, mapIndex, or texture name mod to mapIds only. Although some map names and textures have multiple mapIds. You would have to manually convert anything that has multiple mapIds.

Current State

Work in progress but since it will be used with 5 mods at least then I will upload it and update it as I go.

Upcoming Additions

A pseudo mapIndex for all the various submaps in a zone. This can be used to gather pins for the entire map all at once. If you format your pin data with proper keys then you can display pins for both the mapId for the city and the zone itself without the need for two pin locations. Only needing a separate pin if the map pin information is from a Delve or Public dungeon where the player is underground.

Possible addition for a specialized scale that will place a map pin from a subZone or Dungeon map on the main zone without the need for additional pin data. This is a current system for Quest Map. The scale is created by measuring the map after placing a player waypoint. Written by CaptainBlagbird for Quest Map.

Also possible API for attaching map pins to the POI using something like GetPOIMapInfo() rather then a scale system as mentioned above. Destinations uses a table for the unknown POI built from the available POIs on the current map. As long as you know which POI you need the pin to be close to then the pin would use the POIs coordinates.

Slash Commands

NOTE: I use the DebugLogViewer's Quick View to see the player location information

/lmdgetpos : Returns the player location information and coordinates

Current API

local LMD = LibMapData

Global Variables

Note: Only use the game API for the x,y coordinates GetMapPlayerPosition("player") and if used with LibGPS then convert the local coordinates to global or whatever you need.

If you need the following access it from LMD

lib.zoneIndex
lib.mapIndex
lib.mapId
lib.zoneId
lib.mapTexture
lib.isMainZone
lib.isSubzone
lib.isWorld
lib.isDungeon
lib.zoneName
lib.mapName
lib.subzoneName
lib.currentFloor
lib.numFloors

If you do any for loops for the mapIndex, mapId, zoneIndex or zoneId you can use the following. This includes High Isle.

lib.MAPINDEX_MIN = 1
lib.MAPINDEX_MAX = 46
lib.MAX_NUM_MAPIDS = 2223
lib.MAX_NUM_ZONEINDEXES = 907
lib.MAX_NUM_ZONEIDS = 1364

for i = 1, lib.MAX_NUM_MAPIDS do
mapName = GetMapNameById(i)
if mapName ~= "" then
<< Do Stuff>>
end
end

Functions

lib:GetMapIdByTileTexture(tileTexture)
Given: String, full texture name of map see lib:GetMapTileTextureFromMapId()
Returns a table of the mapId numbers for that texture name. There can be more the one mapId.

lib:GetMapIdByMapName(mapName)
Given: String, can be obtained with GetMapNameById()
Returns a table of the mapId numbers for the given map name. There can be more the one mapId.

lib:ReturnSingleIndex(indexTable)
Given: Table
Returns a single value from a mapId table such as GetMapIdByMapName(). Returns nil and a LibDebugLogger warning if there is more then one mapId.

lib:GetZoneMapIdFromMapId(mapId)
Given: integer
Returns the mapId for the zone regardless of the map you are on. For example if you are in The Hall of the Dead it will not return the mapId of Windhelm, you will get the mapId for Eastmarch.

lib:GetZoneMapIdFromZoneId(zoneId)
Given: integer
Returns the mapId for the zone regardless of the map you are on. For example if you are in The Hall of the Dead it will not return the mapId of Windhelm, you will get the mapId for Eastmarch.

lib:GetMapTileTextureFromMapId(mapId)
Given: integer
Returns the first tile index from GetMapTileTextureForMapId() for the given mapId for use with GetMapIdByTileTexture() or for use with your mod if you prefer using map textures to mapId.

Callbacks

lib:RegisterCallback()
lib:UnregisterCallback()

lib.callbackType.EVENT_ZONE_CHANGED = "LibMapDataEventZoneChanged"
lib.callbackType.EVENT_LINKED_WORLD_POSITION_CHANGED = "LibMapDataEventLinkedWorldPositionChanged"
lib.callbackType.EVENT_PLAYER_ACTIVATED = "LibMapDataEventPlayerActivated"
lib.callbackType.OnWorldMapChanged = "LibMapDataOnWorldMapChanged"
lib.callbackType.WorldMapSceneStateChange = "LibMapDataWorldMapSceneStateChange"

Lua Code:
  1. local LMD = LibMapData
  2. LMD:RegisterCallback(LMD.callbackType.OnWorldMapChanged,
  3.   function()
  4.     RefreshPins()
  5.   end)
v112

- API Bump

v111

- Rough Draft for PTS

v110

- API Bump

v109

- Added check for arubis

v108

- Added function for overland map for Destinations

v107

- More Updates to how switching zones or areas on the map alters the internal variables for use with other mods like Lorebooks and how they get their map pin information

v106

- Updated detection routines when player moves between areas

v105

- Added new zone data for future updates

v104

- Pre PTS Version

v103

- Hotfix for version mismatch

v102

- Added RegisterCallback and UnregisterCallback for updating pins or other map related information from LibMapData without the need for the mod to check and verify the map state independently of LibMapData

v101

- Hotfix for: LibMapData.lua:160: table index is nil
Archived Files (12)
File Name
Version
Size
Uploader
Date
1.11
12kB
Sharlikran
05/07/23 12:57 PM
1.10
12kB
Sharlikran
03/27/23 07:46 PM
1.09
12kB
Sharlikran
01/27/23 11:03 PM
1.08
14kB
Sharlikran
01/16/23 12:46 AM
1.07
15kB
Sharlikran
12/27/22 09:48 AM
1.06
11kB
Sharlikran
12/22/22 03:44 PM
1.05
10kB
Sharlikran
12/22/22 06:35 AM
1.04
10kB
Sharlikran
07/31/22 09:29 AM
1.03
10kB
Sharlikran
05/01/22 02:16 PM
1.02
10kB
Sharlikran
04/30/22 07:20 PM
1.01
9kB
Sharlikran
04/26/22 02:24 AM
1.00
9kB
Sharlikran
04/25/22 09:08 PM


Post A Reply Comment Options
Unread 05/08/23, 10:47 AM  
Anceane
 
Anceane's Avatar
AddOn Author - Click to view AddOns

Forum posts: 306
File comments: 1018
Uploads: 1
when PTS go up after maintenance will go!

THank you for all the work.

May i ask how is the family health as of today ? hope it gets better by days and that you can breath away without worrying too much.

No error on pts from any of the addons you updated, at least for me. Tested with only your addons and added one by one my addons

Two addons will be removed at launch as they are still throwing errors and are perhaps discontinued

Thanks a lot
Last edited by Anceane : 05/08/23 at 01:34 PM.
Report comment to moderator  
Reply With Quote
Unread 05/08/23, 06:02 AM  
ChrisK

Forum posts: 0
File comments: 176
Uploads: 0
Thanks, Sharlikran for all the updates to soooo many addons that I love. You are truly appreciated.
Report comment to moderator  
Reply With Quote
Unread 05/02/23, 12:33 PM  
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view AddOns

Forum posts: 642
File comments: 2015
Uploads: 15
Originally Posted by Anceane
Originally Posted by Sharlikran
My son has Bells Palsy and my daughter is coming home from college this week. I still tinker with things because neither of those things take up all of my time. At some point before June 5th I should have everything tested. Even if it's only the minimum I need to update the mod.
Family first! no matter how much i like your addons, i will never ask you to push those before your family.

I hope your son will get better soon
No worries. Neither you nor Marazota were demanding anything. The two of you are just mentioning it's not working on the PTS. However, this way everyone knows to keep the library inactive. Even though I already mentioned it.
Last edited by Sharlikran : 05/02/23 at 12:55 PM.
Report comment to moderator  
Reply With Quote
Unread 05/02/23, 07:51 AM  
Anceane
 
Anceane's Avatar
AddOn Author - Click to view AddOns

Forum posts: 306
File comments: 1018
Uploads: 1
Originally Posted by Sharlikran
My son has Bells Palsy and my daughter is coming home from college this week. I still tinker with things because neither of those things take up all of my time. At some point before June 5th I should have everything tested. Even if it's only the minimum I need to update the mod.
Family first! no matter how much i like your addons, i will never ask you to push those before your family.

I hope your son will get better soon
Report comment to moderator  
Reply With Quote
Unread 05/02/23, 12:54 AM  
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view AddOns

Forum posts: 642
File comments: 2015
Uploads: 15
My son has Bells Palsy and my daughter is coming home from college this week. I still tinker with things because neither of those things take up all of my time. At some point before June 5th I should have everything tested. Even if it's only the minimum I need to update the mod.
Report comment to moderator  
Reply With Quote
Unread 05/02/23, 12:23 AM  
Anceane
 
Anceane's Avatar
AddOn Author - Click to view AddOns

Forum posts: 306
File comments: 1018
Uploads: 1
Do you think you will have time to upate the lib for pts or you will just do it for June 5 launch ?

Just to know if i go on trying pts or just wait for later (and no worry, but if no update pts i will just remove my folder and dont bother with it
Report comment to moderator  
Reply With Quote
Unread 05/01/23, 06:30 PM  
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view AddOns

Forum posts: 642
File comments: 2015
Uploads: 15
Thanks for the feedback and I'm sorry that's happening however, be sure to disable this mod on the PTS and any mod that depends on it please. I appreciate it thank you.
Report comment to moderator  
Reply With Quote
Unread 05/01/23, 05:06 PM  
Marazota
AddOn Author - Click to view AddOns

Forum posts: 257
File comments: 1519
Uploads: 2
error gone with new version on PTS
but instead when opening a map game become unusable, because no map appearing at all, and you cannot enter any other menus after opening an invisible map

only able to run, and use chat
Last edited by Marazota : 05/01/23 at 05:06 PM.
Report comment to moderator  
Reply With Quote
Unread 04/24/23, 05:16 AM  
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view AddOns

Forum posts: 642
File comments: 2015
Uploads: 15
Sorry about that it isn't updated for the pts so the library and anything that depends on it should be disabled.
Report comment to moderator  
Reply With Quote
Unread 04/24/23, 04:05 AM  
Marazota
AddOn Author - Click to view AddOns

Forum posts: 257
File comments: 1519
Uploads: 2
when clicking on Apocrypha map on PTS

Code:
user:/AddOns/LibMapData/LibMapData.lua:129: attempt to index a nil value
stack traceback:
user:/AddOns/LibMapData/LibMapData.lua:129: in function 'lib:IsOverlandMap'
user:/AddOns/Destinations/Destinations.lua:2336: in function 'ChampionpinTypeCallback'
/EsoUI/Ingame/Map/MapPin_Manager.lua:297: in function 'ZO_WorldMapPins_Manager:RefreshCustomPins'
/EsoUI/Ingame/Map/WorldMap.lua:2394: in function 'ZO_WorldMap_UpdateMap'
(tail call): ?
(tail call): ?
/EsoUI/Ingame/Map/WorldMap.lua:3914: in function 'callback'
/EsoUI/Libraries/Utility/ZO_CallbackObject.lua:132: in function 'ZO_CallbackObjectMixin:FireCallbacks'
/EsoUI/Ingame/Map/WorldMap.lua:2533: in function 'PlayerChosenMapUpdate'
/EsoUI/Ingame/Map/WorldMap.lua:2718: in function 'ZO_WorldMap_MouseUp'
ZO_WorldMapContainer_MouseUp:3: in function '(main chunk)'
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: