/// <summary> /// Build dictionary of locations. /// </summary> private void EnumerateMaps() { mapDict = new Dictionary<int, MapSummary>(); for (int region = 0; region < mapFileReader.RegionCount; region++) { DFRegion dfRegion = mapFileReader.GetRegion(region); for (int location = 0; location < dfRegion.LocationCount; location++) { MapSummary summary = new MapSummary(); DFRegion.RegionMapTable mapTable = dfRegion.MapTable[location]; summary.ID = mapTable.MapId & 0x000fffff; summary.RegionIndex = region; summary.MapIndex = location; summary.LocationType = mapTable.LocationType; summary.DungeonType = mapTable.DungeonType; mapDict.Add(summary.ID, summary); } } }
/// <summary> /// Determines if the current WorldCoord has a location. /// </summary> /// <param name="mapPixelX">Map pixel X.</param> /// <param name="mapPixelY">Map pixel Y.</param> /// <returns>True if there is a location at this map pixel.</returns> public bool HasLocation(int mapPixelX, int mapPixelY, out MapSummary summaryOut) { if (!isReady) { summaryOut = new MapSummary(); return false; } int id = MapsFile.GetMapPixelID(mapPixelX, mapPixelY); if (mapDict.ContainsKey(id)) { summaryOut = mapDict[id]; return true; } summaryOut = new MapSummary(); return false; }