Show / Hide Table of Contents

# Class MapUtil

Utility helper class for game maps and coordinate translations that don't require state.

The conversion methods were found in 89 54 24 10 56 41 55 41 56 48 81 EC, which itself was found by looking for uses of AddonText 1631.

##### Inheritance

System.Object
MapUtil

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace: Dalamud.Utility

###### Assembly: Dalamud.dll

##### Syntax

    public static class MapUtil

### Methods

| Improve this Doc View Source

#### ConvertWorldCoordXZToMapCoord(Single, UInt32, Int32)

Helper method to convert one of the game's Vector3 X/Z provided by the game to a map coordinate suitable for display to the player.

##### Declaration

    public static float ConvertWorldCoordXZToMapCoord(float value, uint scale, int offset)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Single | value | The raw float of a game Vector3 X or Z coordinate to convert.
System.UInt32 | scale | The scale factor of the map, generally retrieved from Lumina.
System.Int32 | offset | The dimension offset for either X or Z, generally retrieved from Lumina.

##### Returns

Type | Description
--- | ---
System.Single | Returns a converted float for display to the player.

| Improve this Doc View Source

#### ConvertWorldCoordYToMapCoord(Single, Int32, Boolean)

Helper method to convert a game Vector3 Y coordinate to a map coordinate suitable for display to the player.

##### Declaration

    public static float ConvertWorldCoordYToMapCoord(float value, int zOffset, bool correctZOffset = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Single | value | The raw float of a game Vector3 Y coordinate to convert.
System.Int32 | zOffset | The zOffset for this map. Retrieved from TerritoryTypeTransient.
System.Boolean | correctZOffset | Optionally enable Z offset correction. When a Z offset of -10,000 is set, replace it with 0 for calculation purposes to show a more sane Z coordinate.

##### Returns

Type | Description
--- | ---
System.Single | Returns a converted float for display to the player.

| Improve this Doc View Source

#### WorldToMap(Vector2, Map)

All-in-one helper method to convert a World Coordinate (internal to the game) to a Map Coordinate (visible to players in the minimap/elsewhere).

##### Declaration

    public static Vector2 WorldToMap(Vector2 worldCoordinates, Map map)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Numerics.Vector2 | worldCoordinates | A Vector2 of raw World coordinates from the game.
Lumina.Excel.GeneratedSheets.Map | map | A Lumina map to use for offset/scale information.

##### Returns

Type | Description
--- | ---
System.Numerics.Vector2 | Returns a Vector2 representing visible map coordinates.

| Improve this Doc View Source

#### WorldToMap(Vector2, Int32, Int32, UInt32)

All-in-one helper method to convert a World Coordinate (internal to the game) to a Map Coordinate (visible to players in the minimap/elsewhere).

##### Declaration

    public static Vector2 WorldToMap(Vector2 worldCoordinates, int xOffset = 0, int yOffset = 0, uint scale = 100U)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Numerics.Vector2 | worldCoordinates | A Vector2 of raw World coordinates from the game.
System.Int32 | xOffset | The offset to apply to the incoming X parameter, generally Lumina's Map.OffsetX.
System.Int32 | yOffset | The offset to apply to the incoming Y parameter, generally Lumina's Map.OffsetY.
System.UInt32 | scale | The global scale to apply to the incoming X and Y parameters, generally Lumina's Map.SizeFactor.

##### Returns

Type | Description
--- | ---
System.Numerics.Vector2 | Returns a Vector2 representing visible map coordinates.

| Improve this Doc View Source

#### WorldToMap(Vector3, Map, TerritoryTypeTransient, Boolean)

All-in-one helper method to convert a World Coordinate (internal to the game) to a Map Coordinate (visible to players in the minimap/elsewhere).

##### Declaration

    public static Vector3 WorldToMap(Vector3 worldCoordinates, Map map, TerritoryTypeTransient territoryTransient, bool correctZOffset = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Numerics.Vector3 | worldCoordinates | A Vector3 of raw World coordinates from the game.
Lumina.Excel.GeneratedSheets.Map | map | A Lumina map to use for offset/scale information.
Lumina.Excel.GeneratedSheets.TerritoryTypeTransient | territoryTransient | A TerritoryTypeTransient to use for Z offset information.
System.Boolean | correctZOffset | An optional mode to "correct" a Z offset of -10000 to be a more human-friendly value.

##### Returns

Type | Description
--- | ---
System.Numerics.Vector3 | Returns a Vector3 representing visible map coordinates.

##### Remarks

Note that this method will swap Y and Z to appropriately reflect the game's display.

| Improve this Doc View Source

#### WorldToMap(Vector3, Int32, Int32, Int32, UInt32, Boolean)

All-in-one helper method to convert a World Coordinate (internal to the game) to a Map Coordinate (visible to players in the minimap/elsewhere).

##### Declaration

    public static Vector3 WorldToMap(Vector3 worldCoordinates, int xOffset = 0, int yOffset = 0, int zOffset = 0, uint scale = 100U, bool correctZOffset = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Numerics.Vector3 | worldCoordinates | A Vector3 of raw World coordinates from the game.
System.Int32 | xOffset | The offset to apply to the incoming X parameter, generally Lumina's Map.OffsetX.
System.Int32 | yOffset | The offset to apply to the incoming Y parameter, generally Lumina's Map.OffsetY.
System.Int32 | zOffset | The offset to apply to the incoming Z parameter, generally Lumina's TerritoryTypeTransient.OffsetZ.
System.UInt32 | scale | The global scale to apply to the incoming X and Y parameters, generally Lumina's Map.SizeFactor.
System.Boolean | correctZOffset | An optional mode to "correct" a Z offset of -10000 to be a more human-friendly value.

##### Returns

Type | Description
--- | ---
System.Numerics.Vector3 | Returns a Vector3 representing visible map coordinates.

##### Remarks

Note that this method will swap Y and Z in the resulting Vector3 to appropriately reflect the game's display.