What It Is:
MapTables is a standalone support add-on that is used to dynamically create and/or update information, reference, and/or cross-reference tables for each and every one of the Maps in the game world. And then to save all that Map information so it does not have to be created again the next time you play ESO.
Unlike the game API functions, which operate on the current Map where the player (your character) is located, the MapTables API functions allow you to retrieve the same information for any Map, at anytime, regardless of where your character is located. Information can be retrieved either by Index or by Identifier and MapTables provides the cross-reference tables that help you switch from Index to Identifier.
MapTables uses LibGPS2 to accumulate and save all the coordinate information for every Map in the game the first time that you load it, or the first time after ZOS changes the game version or adds new Maps, or I enhance or correct the MapTables code, or you delete the .lua file in the game's .../SavedVariables/... directory. All this is done automagically without any prompting from you.
Because MapTables saves its tables, after they have been created or updated, neither MapTables nor LibGPS2 have to repeat that tedious and time consuming code the second and successive times you play the game... until ZOS or you change their environments.
Because it is a support add-on, MapTables has been designed for use by developers rather than users. The reason we developed MapTables and are developing its two relatives, ZoneTables and QuestTables, is so you don't have to hard-code Map, Zone, POI, or Quest tables any more!
"Standalone" means that MapTables should not be embedded. Please load only one instance of MapTables from your ".../Addons/" directory and add a "##DependsOn: MapTables" directive to your add-on's manifest file to instruct the game to verify that a MapTables process exists and is running before the game loads your add-on.
WARNING: You must be running ESO game code for the Wrathstone API (100026), or greater, for this add-on to function correctly.
What It Does:
MapTables creates its reference tables dynamically every time: the game changes its APIVersion number; MapTables changes its AddOnVersion number; MapTables detects missing or empty Maps tables; or, the game adds new or deletes old maps. Otherwise, MapTables retrieves the most current reference tables from its saved variables file. If MapTables finds any discrepancies, it automatically reloads or updates all its tables.
MapTables uses Map Indexes and Map Identifiers to access its reference tables just like the game does. In fact, most if not all of the MapTables indexes and identifiers use the same values the game does. The difference is that MapTables creates several index to identifier and identifier to index cross-reference tables that are not visible to the add-on developer in the game's version 100026 API functions.
MapTables uses game API functions to automatically create and maintain reference and/or cross-reference tables for each and every Map in the game:
- It creates new or updates existing reference table entries by iterating through every Map index (e.g. 1 (Tamriel) through the current maximum number of Maps in the game (See the game GetNumMaps() API function).
- It creates new or updates existing reference tables for which the game API functions return information that the MapTables API functions require.
- It creates Information and Location reference tables for every Map.
- It creates Map Name to Map Index reference tables.
- It creates a Map Index to Zone Identifier cross-reference table.
- It creates Map Identifier to Map Name and Map Name to Map Identifier reference tables that the game API does not provide currently (as of 100026).
- It creates Map Index to Map Identifier and Map Identifier to Map Index cross-reference tables that the game API does not provide currently (as of 100026).
Please use the Comments tab to report MapTables bugs or to request MapTables enhancements.
What It Uses:
Please use ESOUI (or Minion) to download and install these library add-ons BEFORE you download and install MapsTables.
* LibAddOnMenu-2.0
* LibGPS2
* LibManifest
* LibMapPing
MapTables uses LibManifest to retrieve and save its AddOnVersion: number to determine whether the code has been changed or not.
MapTables uses LibGPS2 and its dependencies (e.g. LibMapPing, LibAddOnMenu-2.0, etc.) to generate and return global x, y location coordinates for the top left corner of each map according to its relative position inside of, or outside of, the Tamriel map.
MapTables uses the SetMapToMapListIndex(luaindex index) game API function to iterate through the game's list of active Maps to make each iteration the current Map so LibGPS2 can measure it.
MapTables uses but does not duplicate existing game API functions like:
- GetCyrodiilMapIndex()
- GetImperialCityMapIndex()
- GetMapNameByIndex(luaindex mapIndex)
- GetAutoMapNavigationCommonZoomOutMapIndex()
- SetMapToMapListIndex(luaindex index)
- GetMapNumTilesForMapId(integer mapId)
- GetMapTileTextureForMapId(integer mapId, luaindex tileIndex)
- GetCurrentMapId()
- GetCurrentMapIndex()
- GetMapName()
API Functions:
This is the list of MapTables API functions; we expect this list to grow and change as the game matures. Please use this link to refer to the
MapTables documentation wiki to get all the information about MapTables, its API functions, their input parameters, and their return values.
Get the content type for this Map
Lua Code:
function MapTables:GetContentType( mapIndex: number )
return infoByIndex[mapIndex].content or nil
end
Get the global x,y coordinates for this Map
Lua Code:
function MapTables:GetCoord( mapIndex: number )
return coordByIndex[mapIndex][1] or nil, coordByIndex[mapIndex][2] or nil
end
Get the Map Identifier for this Map Index
Lua Code:
function MapTables:GetIdByIndex( mapIndex: number )
return mapIdByIndex[mapIndex] or nil
end
Get the Map Identifier for this Map Name
Lua Code:
function MapTables:GetIdByName( mapName: string )
return mapIdByName[mapName] or nil
end
Get the Map Index for this Map Name
Lua Code:
function MapTables:GetIndex( mapName: string )
return indexByName[mapName] or nil
end
Get the Map Index for this Map Identifier
Lua Code:
function MapTables:GetIndexById( mapId: number )
return indexByMapId[mapId] or nil
end
Get the Map Type for this Map
Lua Code:
function MapTables:GetMapType( mapIndex: number )
return infoByIndex[mapIndex].mapType or nil
end
Get the Map Name for this Map Identifier
Lua Code:
function MapTables:GetNameById( mapId: number )
return nameByMapId[mapId] or nil
end
Get the Zone Identifier for this Map
Lua Code:
function MapTables:GetZoneId( mapIndex: number )
return zoneIdByIndex[mapIndex] or nil
end
WARNING: Because the game handles the "Tamriel" and "The Aurbis" maps differently, it is possible for the MapTables API functions to return nil or zero (0) values. For these reasons, I believe you will find that some cross-reference tables are missing entries for indexes (1) and (24) (i.e. the Map Indexes for the "Tamriel" and "The Aurbis" maps).
Examples:
This code snippet illustrates the start up interactions between the game, MapTables, and their resultant error messages.
Lua Code:
--[[-------------------------------------------------------------------------------------------------------------------
Local variables shared by multiple functions within this add-on.
---------------------------------------------------------------------------------------------------------------------]]
local ADDON_NAME = "MapTables" -- The name of this add-on
local addon = {} -- Every add-on control entry begins as an empty table
--[[-------------------------------------------------------------------------------------------------------------------
Bootstrap code to load this add-on.
---------------------------------------------------------------------------------------------------------------------]]
assert( not _G[ADDON_NAME], ADDON_NAME.. ": This add-on is already loaded. Do NOT load it multiple times!" )
_G[ADDON_NAME] = addon
assert( _G[ADDON_NAME], ADDON_NAME.. ": the game failed to create a control entry!" )
--[[-------------------------------------------------------------------------------------------------------------------
... And add-on initialization continues on from here...
---------------------------------------------------------------------------------------------------------------------]]
These code snippets illustrate the start up interactions between the game, MapTables, LibManifest, LibGPS2, and their resultant error messages, if any.
Lua Code:
--[[-------------------------------------------------------------------------------------------------------------------
Get the MapTables manifest information and update our control entry with it. Necessary to get the AddOnVersion: directive value.
---------------------------------------------------------------------------------------------------------------------]]
local LM = LibManifest
assert( LM, ADDON_NAME.. ": Failed! Could not find a running LibManifest." )
local manifest = {
-- These values are retrieved from existing manifest directives
author, -- From the Author: directive Without any special characters
description, -- From the Description: directive
fileName, -- The name of this add-on's folder and manifest file
isEnabled, -- ESO boolean value
isOutOfDate, -- ESO boolean value
loadState, -- ESO load state (i.e. loaded; not loaded)
title, -- From the Title: directive without any special characters
-- These values are retrieved from 100026 manifest directives
addOnVersion, -- From the AddOnVersion: directive
filePath, -- Path to this add-on's folder/directory
-- These values are retrieved from 100027 manifest directives
isLibrary, -- From the IsLibrary: directive
}
manifest = LM:Create( ADDON_NAME )
assert( manifest, ADDON_NAME.. ": LibManifest did not return an information table!" )
Lua Code:
--[[-------------------------------------------------------------------------------------------------------------------
Obtain a local link to "LibGPS2" and define a measurements table for its use.
---------------------------------------------------------------------------------------------------------------------]]
local GPS = LibGPS2
assert( GPS, ADDON_NAME.. ": Failed! Could not find a running LibGPS2." )
local measurement = {
scaleX = 0,
scaleY = 0,
offsetX = 0,
offsetY = 0,
mapIndex = 0,
zoneIndex = 0,
}
Lua Code:
-- Wait for a player to become active; LibGPS2 needs this
EVENT_MANAGER:RegisterForEvent( ADDON_NAME, EVENT_PLAYER_ACTIVATED,
function( event, initial )
EVENT_MANAGER:UnregisterForEvent( ADDON_NAME, EVENT_PLAYER_ACTIVATED )
end
)
assert( GPS:IsReady(), ADDON_NAME.. ": LibGPS2 cannot function until a player is active!" )
Lua Code:
--[[-------------------------------------------------------------------------------------------------------------------
And the last thing we do in this add-on is to wait for ESO to notify us that our add-on modules and support
add-ons (i.e. libraries) have been loaded.
---------------------------------------------------------------------------------------------------------------------]]
EVENT_MANAGER:RegisterForEvent( ADDON_NAME, EVENT_ADD_ON_LOADED, OnAddonLoaded )