Ejemplo n.º 1
0
        public override async Task Execute()
        {
            var task = new Task(async() => {
                var ofn = $"/cache/{ZoneName}.zip";
                if (!await VirtualFileSystem.FileExistsAsync(ofn))
                {
                    WriteLine($"Attempting to convert zone {ZoneName} for first use.");

                    var taskS3dObjFiles = S3DConverter.ReadS3DAsync($@"{EverquestPath}\{ZoneName}_obj.s3d");
                    var taskS3dFiles    = S3DConverter.ReadS3DAsync($@"{EverquestPath}\{ZoneName}.s3d");

                    Task.WaitAll(taskS3dObjFiles, taskS3dFiles);
                    var s3dObjFilesDict = taskS3dObjFiles.Result.Merge(taskS3dFiles.Result);
                    var s3dFilesDict    = taskS3dFiles.Result.Merge(taskS3dObjFiles.Result);

                    var zone = new Zone();

                    ConvertObjects(s3dObjFilesDict, $"{ZoneName}_obj.wld", zone);
                    ConvertObjects(s3dFilesDict, "objects.wld", zone);
                    ConvertLights(s3dFilesDict, "lights.wld", zone);
                    ConvertZone(s3dFilesDict, $"{ZoneName}.wld", zone);

                    using (var stream = VirtualFileSystem.OpenStream(ofn, VirtualFileMode.Create, VirtualFileAccess.Write))
                        zone.Output(stream);
                }
                WriteLine("Loading zone");
                var rstream    = VirtualFileSystem.OpenStream(ofn, VirtualFileMode.Open, VirtualFileAccess.Read);
                var zoneEntity = OEQZoneReader.Read((Game)Game, ZoneName, rstream);
                Entity.AddChild(zoneEntity);
            });

            task.Start();
            await task;
        }
Ejemplo n.º 2
0
        public override async Task Execute()
        {
            var task = new Task(() => {
                var zoneEntity = OEQZoneReader.Read((Game)Game, ZoneName);
                Entity.AddChild(zoneEntity);
            });

            task.Start();
            await task;
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            var engine         = new CoreEngine();
            var zonePlaceables = OEQZoneReader.Read(args[0]);

            foreach (var placeable in zonePlaceables)
            {
                engine.AddPlaceable(placeable);
            }
            engine.Run();
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            var engine = new CoreEngine();
            var gui    = engine.Gui;

            /*var code = @"
             *  function testfunc()
             *      print(""Test"")
             *      print(textbox.Text)
             *  end
             *  win = gui.CreateWindow('Test')
             *  textbox = win.CreateTextbox()
             *  button = win.CreateButton('Test button')
             *  button.Click.add(testfunc)
             * ";
             * UserData.RegisterAssembly();
             * var script = new Script();
             * script.Globals["gui"] = gui;
             * script.DoString(code);*/

            var window    = gui.CreateWindow("The Zone Zone");
            var zoneinput = window.CreateTextbox(maxLength: 50);
            var button    = window.CreateButton("Load");

            button.Click += () => {
                WriteLine($"Loading zone {zoneinput.Text}");
                engine.DeleteAll();
                var zonePlaceables = OEQZoneReader.Read($"{zoneinput.Text}.zip");
                foreach (var placeable in zonePlaceables)
                {
                    engine.AddPlaceable(placeable);
                }
            };

            window = gui.CreateWindow("Debug");
            window.CreateLabel(() => $"Position: {engine.Camera.Position.X} {engine.Camera.Position.Y} {engine.Camera.Position.Z}");

            var charmodel = OEQCharReader.Read("orc_chr.zip")["ORC_ACTORDEF"];

            charmodel.Animation = "L02";
            engine.AddMob(new Mob(charmodel));

            engine.Run();
        }