public ImageMagick.MagickImage GetWaterMap()
        {
            ImageMagick.MagickImage watermap = new ImageMagick.MagickImage(MpkWrapper.GetFileBytesFromMpk(this.m_datMpk, "water.pcx"));
            watermap.Resize(this.m_targetMapSize, this.m_targetMapSize);

            return(watermap);
        }
Esempio n. 2
0
        /// <summary>
        /// Start rendering the zone(s)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void renderButton_Click(object sender, EventArgs e)
        {
            if (MpkWrapper.CheckGamePath())
            {
                Log("Game found...", LogLevel.notice);

                if (SelectedZones.Count == 0)
                {
                    Log("Please select at least one Zone to render.", LogLevel.error);
                }
                else
                {
                    HandleRenderButton(false);

                    foreach (ZoneSelection zone in SelectedZones)
                    {
                        Log(string.Format("Rendering {0} ({1})...", zone.Name, zone.Id), LogLevel.notice);
                        drawMapBackgroundWorker.RunWorkerAsync(zone);

                        while (drawMapBackgroundWorker.IsBusy)
                        {
                            Application.DoEvents();
                        }
                    }

                    HandleRenderButton(true);
                }
            }
        }
        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];
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
 public ImageMagick.MagickImage GetOffsetMap()
 {
     ImageMagick.MagickImage offsetmap = new ImageMagick.MagickImage(MpkWrapper.GetFileBytesFromMpk(this.m_datMpk, "offset.pcx"));
     return(offsetmap);
 }
 public ImageMagick.MagickImage GetTerrainMap()
 {
     ImageMagick.MagickImage terrainmap = new ImageMagick.MagickImage(MpkWrapper.GetFileBytesFromMpk(this.m_datMpk, "terrain.pcx"));
     return(terrainmap);
 }
Esempio n. 8
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));
        }