예제 #1
0
 public Zeta()
 {
     Id         = -22;
     Name       = "Zeta";
     Background = 0;
     FromWorldMap(new MemoryStream(Json2Wmap.Convert2(this.GetType().Assembly.GetManifestResourceStream("wServer.realm.worlds.zeta.jm").ToString())));
 }
예제 #2
0
        protected void LoadMap(string embeddedResource, MapType type)
        {
            if (embeddedResource == null)
            {
                return;
            }
            string mapType  = type == MapType.Json ? "json" : "wmap";
            string resource = embeddedResource.Replace($".{mapType}", "");
            var    stream   = typeof(RealmManager).Assembly.GetManifestResourceStream($"LoESoft.GameServer.realm.world.maps.{mapType}.{resource}.{mapType}");

            if (stream == null)
            {
                throw new ArgumentException($"{mapType.ToUpper()} map resource " + nameof(resource) + " not found!");
            }

            switch (type)
            {
            case MapType.Wmap:
                FromWorldMap(stream);
                break;

            case MapType.Json:
                FromWorldMap(new MemoryStream(Json2Wmap.Convert(GameServer.Manager.GameData, new StreamReader(stream).ReadToEnd())));
                break;

            default:
                throw new ArgumentException("Invalid MapType");
            }
        }
예제 #3
0
        private void startconversion_Click(object sender, EventArgs e)
        {
            var savePath = string.Empty;

            if (_selectedMapsObjectses == null || _selectedMapsObjectses.Count <= 0)
            {
                return;
            }

            using (var sod = new FolderBrowserDialog())
            {
                sod.Description = "Select a folder to save WMaps";

                if (sod.ShowDialog() == DialogResult.OK)
                {
                    savePath = sod.SelectedPath;
                }
            }

            if (savePath == string.Empty)
            {
                return;
            }
            foreach (var map in _selectedMapsObjectses)
            {
                Json2Wmap.Convert(_xmldata, map.Filepath, Path.Combine(savePath, map.WmapName));
            }

            savePath = string.Empty;
            MessageBox.Show("Finished converting the things :D");
        }
예제 #4
0
        protected void LoadMap(string embeddedResource, MapType type)
        {
            if (embeddedResource == null)
            {
                return;
            }
            var stream = typeof(RealmManager).Assembly.GetManifestResourceStream(embeddedResource);

            if (stream == null)
            {
                throw new ArgumentException("Resource not found", nameof(embeddedResource));
            }

            switch (type)
            {
            case MapType.Wmap:
                FromWorldMap(stream);
                break;

            case MapType.Json:
                FromWorldMap(new MemoryStream(Json2Wmap.Convert(Manager, new StreamReader(stream).ReadToEnd())));
                break;

            default:
                throw new ArgumentException("Invalid MapType");
            }
        }
예제 #5
0
        public void FromJsonStream(Stream dat)
        {
            byte[] data = {};
            dat.Read(data, 0, (int)dat.Length);
            var json = Encoding.ASCII.GetString(data);
            var wmap = Json2Wmap.Convert(json);

            FromWorldMap(new MemoryStream(wmap));
        } //not working
예제 #6
0
 public ExportedMap(string json, string n)
 {
     js            = json;
     name          = n;
     Name          = n;
     Background    = 0;
     AllowTeleport = true;
     base.FromWorldMap(new MemoryStream(Json2Wmap.Convert(json)));
 }
예제 #7
0
        public void LoadJson(string json)
        {
            if (!JsonLoaded)
            {
                FromWorldMap(new MemoryStream(Json2Wmap.Convert(Manager.Resources.GameData, json)));
                JsonLoaded = true;
            }

            InitShops();
        }
예제 #8
0
        public XMLWorld(DungeonDesc desc)
        {
            this.d = desc;
            string json = new WebClient().DownloadString(desc.Json);

            Name          = desc.Name;
            Background    = desc.Background;
            AllowTeleport = desc.AllowTeleport;
            base.FromWorldMap(new MemoryStream(Json2Wmap.Convert(json)));
        }
예제 #9
0
        public void FromJsonMap(string file)
        {
            if (File.Exists(file))
            {
                var wmap = Json2Wmap.Convert(File.ReadAllText(file));

                FromWorldMap(new MemoryStream(wmap));
            }
            else
            {
                throw new FileNotFoundException("Json file not found!", file);
            }
        }
예제 #10
0
        protected void LoadFromJson(string embeddedResource)
        {
            if (embeddedResource == null)
            {
                return;
            }
            var stream = typeof(RealmManager).Assembly.GetManifestResourceStream(embeddedResource);

            if (stream == null)
            {
                throw new ArgumentException("Resource not found", nameof(embeddedResource));
            }
            FromWorldMap(new MemoryStream(Json2Wmap.Convert(Manager.GameData, new StreamReader(stream).ReadToEnd())));
        }
예제 #11
0
        public unsafe void LoadJson(void *world, string embeddedResource, IntPoint *pos, void *wmap)
        {
            if (embeddedResource == null)
            {
                return;
            }
            string resource = embeddedResource.Replace(".jm", "");
            Stream stream   = typeof(RealmManager).Assembly.GetManifestResourceStream("gameserver.realm.mapsetpiece.maps." + resource + ".jm");

            if (stream == null)
            {
                throw new ArgumentException("JSON map resource " + nameof(resource) + " not found!");
            }
            FromWorldMap(new MemoryStream(Json2Wmap.Convert((GCHandle.FromIntPtr(new IntPtr(world)).Target as World).Manager.GameData, new StreamReader(stream).ReadToEnd())), world, pos, wmap);
        }
예제 #12
0
        public WorldData(string dir, XmlData gameData)
        {
            Dictionary <string, ProtoWorld> worlds;

            Data =
                new ReadOnlyDictionary <string, ProtoWorld>(
                    worlds = new Dictionary <string, ProtoWorld>());

            // load up worlds
            string basePath = Path.GetFullPath(dir);
            var    jwFiles  = Directory.EnumerateFiles(basePath, "*.jw", SearchOption.TopDirectoryOnly).ToArray();

            for (var i = 0; i < jwFiles.Length; i++)
            {
                Log.InfoFormat("Initializing world data: " + Path.GetFileName(jwFiles[i]) + " {0}/{1}...", i + 1, jwFiles.Length);

                var jw    = File.ReadAllText(jwFiles[i]);
                var world = JsonConvert.DeserializeObject <ProtoWorld>(jw);

                if (world.maps == null)
                {
                    var jm = File.ReadAllText(jwFiles[i].Substring(0, jwFiles[i].Length - 1) + "m");
                    world.wmap    = new byte[1][];
                    world.wmap[0] = Json2Wmap.Convert(gameData, jm);
                    worlds.Add(world.name, world);
                    continue;
                }

                world.wmap = new byte[world.maps.Length][];
                var di = Directory.GetParent(jwFiles[i]);
                for (var j = 0; j < world.maps.Length; j++)
                {
                    var mapFile = Path.Combine(di.FullName, world.maps[j]);
                    if (world.maps[j].EndsWith(".wmap"))
                    {
                        world.wmap[j] = File.ReadAllBytes(mapFile);
                    }
                    else
                    {
                        var jm = File.ReadAllText(mapFile);
                        world.wmap[j] = Json2Wmap.Convert(gameData, jm);
                    }
                }
                worlds.Add(world.name, world);
            }
        }
예제 #13
0
파일: World.cs 프로젝트: Bog624s/Rotux
        protected void LoadMap(string embeddedResource, MapType type)
        {
            Stream stream = null;

            if (embeddedResource == null)
            {
                return;
            }
            if (embeddedResource == "nexus.dll")
            {
                stream = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "\\nexus.dll").GetManifestResourceStream("Nexus.map.nexus.jm");
                if (stream == null)
                {
                    throw new ArgumentException("Resource not found", nameof(embeddedResource));
                }
            }
            else
            {
                stream = typeof(RealmManager).Assembly.GetManifestResourceStream(embeddedResource);
                if (stream == null)
                {
                    throw new ArgumentException("Resource not found", nameof(embeddedResource));
                }
            }
            switch (type)
            {
            case MapType.Wmap:
                FromWorldMap(stream);
                break;

            case MapType.Json:
                FromWorldMap(new MemoryStream(Json2Wmap.Convert(Manager, new StreamReader(stream).ReadToEnd())));
                break;

            default:
                throw new ArgumentException("Invalid MapType");
            }
        }
예제 #14
0
 public void LoadJson(string json)
 {
     FromWorldMap(new MemoryStream(Json2Wmap.Convert(Manager.GameData, json)));
 }
예제 #15
0
 protected void LoadMap(string json)
 {
     FromWorldMap(new MemoryStream(Json2Wmap.Convert(GameServer.Manager.GameData, json)));
 }
예제 #16
0
 public void LoadJson(string json)
 {
     js = json;
     FromWorldMap(new MemoryStream(Json2Wmap.Convert(json)));
 }
예제 #17
0
 protected void LoadMap(string json)
 {
     FromWorldMap(new MemoryStream(Json2Wmap.Convert(Manager, json)));
 }
예제 #18
0
 public void LoadJson(string json)
 {
     SetMusic("");
     FromWorldMap(new MemoryStream(Json2Wmap.Convert(Manager, json)));
 }