public ZoneConfiguration(string zoneId, int mapSize)
        {
            m_zoneId = zoneId;

            // Get expansion from zones.xml
            m_expansion = DataWrapper.GetExpansionByZone(zoneId);

            // Zone Directory
            m_zoneDirectory = this.GetZoneDirectory();

            // Some mpk files
            m_datMpk = string.Format("{0}\\dat{1}.mpk", m_zoneDirectory, m_zoneId);
            m_cvsMpk = string.Format("{0}\\csv{1}.mpk", m_zoneDirectory, m_zoneId);
            m_lodMpk = string.Format("{0}\\lod{1}.mpk", m_zoneDirectory, m_zoneId);
            m_terMpk = string.Format("{0}\\ter{1}.mpk", m_zoneDirectory, m_zoneId);
            m_texMpk = string.Format("{0}\\tex{1}.mpk", m_zoneDirectory, m_zoneId);

            // Check if the zone gets its data from an other zone

            // Check if file exists, else map to datXXX.mpk
            if (!File.Exists(m_cvsMpk))
            {
                m_cvsMpk = m_datMpk;
            }
            if (!File.Exists(m_lodMpk))
            {
                m_lodMpk = m_datMpk;
            }
            if (!File.Exists(m_terMpk))
            {
                m_terMpk = m_datMpk;
            }
            if (!File.Exists(m_texMpk))
            {
                m_texMpk = m_datMpk;
            }

            // Useful for everything, so open it
            m_sectorDatStreamReader = MpkWrapper.GetFileFromMpk(m_datMpk, "sector.dat");

            // for math
            m_targetMapSize = mapSize;
            m_mapScale      = m_targetMapSize / 256.0;
            m_locsPerPixel  = zoneMaxCoordinate / mapSize;
            m_locScale      = m_targetMapSize / zoneMaxCoordinate;

            // Heightmap
            this.m_heightmap = new MapHeightmap(this);

            // Prepare river heights array
            m_riverHeights = new double[m_targetMapSize, m_targetMapSize];
        }
Beispiel #2
0
        /// <summary>
        /// Gets the raw lines from bound.csv
        /// </summary>
        /// <returns></returns>
        private List <string> GetCoordinateLines()
        {
            List <string> lines = new List <string>();

            using (StreamReader csv = MpkWrapper.GetFileFromMpk(zoneConfiguration.DatMpk, "bound.csv"))
            {
                string row;
                while ((row = csv.ReadLine()) != null)
                {
                    lines.Add(row);
                }
            }

            return(lines);
        }
Beispiel #3
0
        public static List <string> GetFileContent(string mpkFile, string filename)
        {
            List <string> lines = new List <string>();

            using (StreamReader csv = MpkWrapper.GetFileFromMpk(mpkFile, filename))
            {
                string row;
                while ((row = csv.ReadLine()) != null)
                {
                    lines.Add(row);
                }
            }

            return(lines);
        }
Beispiel #4
0
        /// <summary>
        /// Gets a value from a sector.dat in an MPK file
        /// </summary>
        /// <param name="mpkFile"></param>
        /// <param name="iniRegion"></param>
        /// <param name="iniProperty"></param>
        /// <returns></returns>
        public static string GetSectorDatValue(string mpkFile, string iniRegion, string iniProperty)
        {
            StreamReader sectorDatFile = MpkWrapper.GetFileFromMpk(mpkFile, "sector.dat");

            return(GetDatFileProperty(sectorDatFile, iniRegion, iniProperty));
        }