Class MapsFile
Connects to MAPS.BSA to enumerate locations within a specific region and extract their layouts.
Namespace: DaggerfallConnect.Arena2
Assembly: Assembly-CSharp.dll
Syntax
public class MapsFile
Constructors
| Improve this Doc View SourceMapsFile()
Default constructor.
Declaration
public MapsFile()
MapsFile(String, FileUsage, Boolean)
Load constructor.
Declaration
public MapsFile(string filePath, FileUsage usage, bool readOnly)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | Absolute path to MAPS.BSA. |
FileUsage | usage | Determines if the BSA file will read from disk or memory. |
Boolean | readOnly | File will be read-only if true, read-write if false. |
Fields
| Improve this Doc View SourceMaxMapPixelX
Declaration
public const int MaxMapPixelX = 1000
Field Value
Type | Description |
---|---|
Int32 |
MaxMapPixelY
Declaration
public const int MaxMapPixelY = 500
Field Value
Type | Description |
---|---|
Int32 |
MaxWorldCoordX
Declaration
public const int MaxWorldCoordX = 32768000
Field Value
Type | Description |
---|---|
Int32 |
MaxWorldCoordZ
Declaration
public const int MaxWorldCoordZ = 16384000
Field Value
Type | Description |
---|---|
Int32 |
MaxWorldTileCoordX
Declaration
public const int MaxWorldTileCoordX = 128000
Field Value
Type | Description |
---|---|
Int32 |
MaxWorldTileCoordZ
Declaration
public const int MaxWorldTileCoordZ = 64000
Field Value
Type | Description |
---|---|
Int32 |
MinMapPixelX
Declaration
public const int MinMapPixelX = 0
Field Value
Type | Description |
---|---|
Int32 |
MinMapPixelY
Declaration
public const int MinMapPixelY = 0
Field Value
Type | Description |
---|---|
Int32 |
MinWorldCoordX
Declaration
public const int MinWorldCoordX = 0
Field Value
Type | Description |
---|---|
Int32 |
MinWorldCoordZ
Declaration
public const int MinWorldCoordZ = 0
Field Value
Type | Description |
---|---|
Int32 |
MinWorldTileCoordX
Declaration
public const int MinWorldTileCoordX = 0
Field Value
Type | Description |
---|---|
Int32 |
MinWorldTileCoordZ
Declaration
public const int MinWorldTileCoordZ = 0
Field Value
Type | Description |
---|---|
Int32 |
WorldMapRMBDim
Declaration
public const int WorldMapRMBDim = 4096
Field Value
Type | Description |
---|---|
Int32 |
WorldMapTerrainDim
Declaration
public const int WorldMapTerrainDim = 32768
Field Value
Type | Description |
---|---|
Int32 |
WorldMapTileDim
Declaration
public const int WorldMapTileDim = 128
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceAutoDiscard
If true then decomposed regions will be destroyed every time a different region is fetched. If false then decomposed regions will be maintained until DiscardRegion() or DiscardAllRegions() is called. Turning off auto-discard will speed up region retrieval times at the expense of RAM. For best results, disable auto-discard and impose your own caching scheme using LoadRecord() and DiscardRecord() based on your application needs.
Declaration
public bool AutoDiscard { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
BsaFile
Gets raw MAPS.BSA file.
Declaration
public BsaFile BsaFile { get; }
Property Value
Type | Description |
---|---|
BsaFile |
ClimateFile
Gets internal climate data.
Declaration
public PakFile ClimateFile { get; }
Property Value
Type | Description |
---|---|
PakFile |
DefaultClimate
Gets default climate index.
Declaration
public static int DefaultClimate { get; }
Property Value
Type | Description |
---|---|
Int32 |
DefaultClimateSettings
Gets default climate settings.
Declaration
public static DFLocation.ClimateSettings DefaultClimateSettings { get; }
Property Value
Type | Description |
---|---|
DFLocation.ClimateSettings |
Filename
Gets default MAPS.BSA filename.
Declaration
public static string Filename { get; }
Property Value
Type | Description |
---|---|
String |
Ready
True when ready to load regions and locations, otherwise false.
Declaration
public bool Ready { get; }
Property Value
Type | Description |
---|---|
Boolean |
RegionCount
Number of regions in MAPS.BSA.
Declaration
public int RegionCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
RegionNames
Gets all region names as string array.
Declaration
public static string[] RegionNames { get; }
Property Value
Type | Description |
---|---|
String[] |
RegionRaces
Gets all region races as byte array.
Declaration
public static byte[] RegionRaces { get; }
Property Value
Type | Description |
---|---|
Byte[] |
RegionTemples
Gets region temple faction IDs.
Declaration
public static int[] RegionTemples { get; }
Property Value
Type | Description |
---|---|
Int32[] |
Methods
| Improve this Doc View SourceDiscardAllRegions()
Discard all regions.
Declaration
public void DiscardAllRegions()
DiscardRegion(Int32)
Discard a region from memory.
Declaration
public void DiscardRegion(int region)
Parameters
Type | Name | Description |
---|---|---|
Int32 | region | Index of region to discard. |
GetClimateIndex(Int32, Int32)
Reads climate index from CLIMATE.PAK based on world pixel.
Declaration
public int GetClimateIndex(int mapPixelX, int mapPixelY)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapPixelX | Map pixel X position. |
Int32 | mapPixelY | Map pixel Y position. |
Returns
Type | Description |
---|---|
Int32 |
GetLocation(Int32, Int32)
Gets a DFLocation representation of a location.
Declaration
public DFLocation GetLocation(int region, int location)
Parameters
Type | Name | Description |
---|---|---|
Int32 | region | Index of region. |
Int32 | location | Index of location. |
Returns
Type | Description |
---|---|
DFLocation | DFLocation. |
GetLocation(String, String)
Gets DFLocation representation of a location.
Declaration
public DFLocation GetLocation(string regionName, string locationName)
Parameters
Type | Name | Description |
---|---|---|
String | regionName | Name of region. |
String | locationName | Name of location. |
Returns
Type | Description |
---|---|
DFLocation | DFLocation. |
GetMapPixelID(Int32, Int32)
Gets ID of map pixel. This can be mapped to location IDs and quest IDs. MapTableData.MapId & 0x000fffff = WorldPixelID.
Declaration
public static int GetMapPixelID(int mapPixelX, int mapPixelY)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapPixelX | Map pixel X. |
Int32 | mapPixelY | Map pixel Y. |
Returns
Type | Description |
---|---|
Int32 | Map pixel ID. |
GetMapPixelIDFromLongitudeLatitude(Int32, Int32)
Gets ID of map pixel using latitude and longitude. This can be mapped to location IDs and quest IDs. MapTableData.MapId & 0x000fffff = WorldPixelID.
Declaration
public static int GetMapPixelIDFromLongitudeLatitude(int longitude, int latitude)
Parameters
Type | Name | Description |
---|---|---|
Int32 | longitude | Longitude position. |
Int32 | latitude | Latitude position. |
Returns
Type | Description |
---|---|
Int32 | Map pixel ID. |
GetPixelFromPixelID(Int32)
Declaration
public static DFPosition GetPixelFromPixelID(int pixelID)
Parameters
Type | Name | Description |
---|---|---|
Int32 | pixelID |
Returns
Type | Description |
---|---|
DFPosition |
GetPoliticIndex(Int32, Int32)
Reads politic index from POLITIC.PAK based on world pixel.
Declaration
public int GetPoliticIndex(int mapPixelX, int mapPixelY)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapPixelX | Map pixel X position. |
Int32 | mapPixelY | Map pixel Y position. |
Returns
Type | Description |
---|---|
Int32 |
GetRegion(Int32)
Gets a DFRegion by index.
Declaration
public DFRegion GetRegion(int region)
Parameters
Type | Name | Description |
---|---|---|
Int32 | region | Index of region. |
Returns
Type | Description |
---|---|
DFRegion | DFRegion. |
GetRegion(String)
Gets a DFRegion by name.
Declaration
public DFRegion GetRegion(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of region. |
Returns
Type | Description |
---|---|
DFRegion | DFRegion. |
GetRegionIndex(String)
Gets index of region with specified name. Does not change the currently loaded region.
Declaration
public int GetRegionIndex(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of region. |
Returns
Type | Description |
---|---|
Int32 | Index of found region, or -1 if not found. |
GetRegionName(Int32)
Gets the name of specified region. Does not change the currently loaded region.
Declaration
public string GetRegionName(int region)
Parameters
Type | Name | Description |
---|---|---|
Int32 | region | Index of region. |
Returns
Type | Description |
---|---|
String | Name of the region. |
GetRmbBlockName(in DFLocation, Int32, Int32)
Lookup block name for exterior block from location data provided.
Declaration
public string GetRmbBlockName(in DFLocation dfLocation, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
DFLocation | dfLocation | DFLocation to read block name. |
Int32 | x | Block X coordinate. |
Int32 | y | Block Y coordinate. |
Returns
Type | Description |
---|---|
String | Block name. |
GetWorldClimateSettings(Int32)
Gets settings for specified map climate.
Declaration
public static DFLocation.ClimateSettings GetWorldClimateSettings(int worldClimate)
Parameters
Type | Name | Description |
---|---|---|
Int32 | worldClimate | Climate value from CLIMATE.PAK. Valid range is 223-232. |
Returns
Type | Description |
---|---|
DFLocation.ClimateSettings | Climate settings for specified world climate value. |
Load(String, FileUsage, Boolean)
Load MAPS.BSA file.
Declaration
public bool Load(string filePath, FileUsage usage, bool readOnly)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | Absolute path to MAPS.BSA file. |
FileUsage | usage | Specify if file will be accessed from disk, or loaded into RAM. |
Boolean | readOnly | File will be read-only if true, read-write if false. |
Returns
Type | Description |
---|---|
Boolean | True if successful, otherwise false. |
LoadRegion(Int32)
Load a region into memory by index and decompose it for use.
Declaration
public bool LoadRegion(int region)
Parameters
Type | Name | Description |
---|---|---|
Int32 | region | Index of region to load. |
Returns
Type | Description |
---|---|
Boolean | True if successful, otherwise false. |
LoadRegion(String)
Load a region into memory by name and decompose it for use.
Declaration
public bool LoadRegion(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of region. |
Returns
Type | Description |
---|---|
Boolean | True if successful, otherwise false. |
LongitudeLatitudeToMapPixel(Int32, Int32)
Converts longitude and latitude to map pixel coordinates. The world is 1000x500 map pixels.
Declaration
public static DFPosition LongitudeLatitudeToMapPixel(int longitude, int latitude)
Parameters
Type | Name | Description |
---|---|---|
Int32 | longitude | Longitude position. |
Int32 | latitude | Latitude position. |
Returns
Type | Description |
---|---|
DFPosition | Map pixel position. |
MapPixelToLongitudeLatitude(Int32, Int32)
Converts map pixel coord to longitude and latitude.
Declaration
public static DFPosition MapPixelToLongitudeLatitude(int mapPixelX, int mapPixelY)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapPixelX | Map pixel X. |
Int32 | mapPixelY | Map pixel Y. |
Returns
Type | Description |
---|---|
DFPosition |
MapPixelToWorldCoord(Int32, Int32)
Converts map pixel to world coord.
Declaration
public static DFPosition MapPixelToWorldCoord(int mapPixelX, int mapPixelY)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapPixelX | Map pixel X. |
Int32 | mapPixelY | Map pixel Y. |
Returns
Type | Description |
---|---|
DFPosition | World position. |
ReadLocationIdFast(Int32, Int32)
Quickly reads the LocationId with minimal overhead. Region must be loaded before calling this method.
Declaration
public int ReadLocationIdFast(int region, int location)
Parameters
Type | Name | Description |
---|---|---|
Int32 | region | Region index. |
Int32 | location | Location index. |
Returns
Type | Description |
---|---|
Int32 | LocationId. |
ResolveRmbBlockName(in DFLocation, Byte, Byte, Byte)
Resolve block name from raw components.
Declaration
public string ResolveRmbBlockName(in DFLocation dfLocation, byte blockIndex, byte blockNumber, byte blockCharacter)
Parameters
Type | Name | Description |
---|---|---|
DFLocation | dfLocation | DFLocation to resolve block name. |
Byte | blockIndex | Block index. |
Byte | blockNumber | Block number. |
Byte | blockCharacter | Block character. |
Returns
Type | Description |
---|---|
String | Block name. |
ResolveRmbBlockName(in DFLocation, Int32, Int32)
Resolve block name for exterior block from X, Y coordinates.
Declaration
public string ResolveRmbBlockName(in DFLocation dfLocation, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
DFLocation | dfLocation | DFLocation to resolve block name. |
Int32 | x | Block X coordinate. |
Int32 | y | Block Y coordinate. |
Returns
Type | Description |
---|---|
String | Block name. |
SetClimateIndex(Int32, Int32, MapsFile.Climates)
Sets climate index from CLIMATE.PAK based on world pixel. Allows loaded climate data from Pak file to be modified by mods.
Declaration
public bool SetClimateIndex(int mapPixelX, int mapPixelY, MapsFile.Climates value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapPixelX | Map pixel X position. |
Int32 | mapPixelY | Map pixel Y position. |
MapsFile.Climates | value | The climate to set for the specified map pixel. |
Returns
Type | Description |
---|---|
Boolean | True if climate index was set, false otherwise. |
SetPoliticIndex(Int32, Int32, Byte)
Reads politic index from POLITIC.PAK based on world pixel. Allows loaded region data from Pak file to be modified by mods.
Declaration
public bool SetPoliticIndex(int mapPixelX, int mapPixelY, byte value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapPixelX | Map pixel X position. |
Int32 | mapPixelY | Map pixel Y position. |
Byte | value | The politic index to set for the specified map pixel. |
Returns
Type | Description |
---|---|
Boolean | True if politic index was set, false otherwise. |
WorldCoordToLongitudeLatitude(Int32, Int32)
Converts world coord back to longitude and latitude.
Declaration
public static DFPosition WorldCoordToLongitudeLatitude(int worldX, int worldZ)
Parameters
Type | Name | Description |
---|---|---|
Int32 | worldX | World X position in native Daggerfall units. |
Int32 | worldZ | World Z position in native Daggerfall units. |
Returns
Type | Description |
---|---|
DFPosition | Longitude and latitude. |
WorldCoordToMapPixel(Int32, Int32)
Converts world coord to nearest map pixel.
Declaration
public static DFPosition WorldCoordToMapPixel(int worldX, int worldZ)
Parameters
Type | Name | Description |
---|---|---|
Int32 | worldX | World X position in native Daggerfall units. |
Int32 | worldZ | World Z position in native Daggerfall units. |
Returns
Type | Description |
---|---|
DFPosition | Map pixel position. |