Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:MapGetPlayerLocationMaps

From RoR Wiki

UI Lua API · Map functions
Version: WAR 1.4.8

Returns the maps that contain the player's current position, one per map level.

maps = MapGetPlayerLocationMaps()

Arguments

None.

Returns

maps
table – Map numbers keyed by map level. Levels for which no map is found are missing.
Key Type Meaning
0 number World map: always 1.
1 number Pairing map: the pairing of the current zone (as from GetZonePairing). Missing if the zone has no pairing.
2 number Zone map: the current zone id. Missing if the player has no zone.
3 number Area map: the first area map in the client's map data that matches the player's location. Its number is the zone id × 1000 plus a sub-id. Missing if there is none.

Details

  • The keys are map levels; the stock UI indexes the table with GameDefs.MapLevel values (WORLD_MAP, PAIRING_MAP, ZONE_MAP, AREA_MAP).
  • Key 0 is not reached by ipairs. Index the table directly.
  • If the player or the client's map data is not available, an empty table is returned.

Errors

None.

Example

From default/ea_worldmapwindow/source/worldmapwindow.lua:

function EA_Window_WorldMap.ZoomIn()
    -- We're zooming to the child map which we're in.
    local playerMaps = MapGetPlayerLocationMaps()
    local newZoom = EA_Window_WorldMap.currentLevel+1

    if (newZoom <= GameDefs.MapLevel.ZONE_MAP and playerMaps[newZoom] ~= nil) then
        EA_Window_WorldMap.SetMap(newZoom, playerMaps[newZoom])
    end
end

See also