Exemple #1
0
        private static void CSConfig()
        {
            EventSink.CharacterCreated += e => Register(e.Mobile as PlayerMobile);
            EventSink.Login            += e =>
            {
                Register(e.Mobile as PlayerMobile);
                ValidateSharedName(e.Mobile as PlayerMobile);
            };
            EventSink.Logout      += e => Register(e.Mobile as PlayerMobile);
            EventSink.PlayerDeath += e => Register(e.Mobile as PlayerMobile);

            CommandUtility.Register(
                "PlayerNames",
                Access,
                e =>
            {
                if (e.Arguments != null && e.Arguments.Length > 0 && Insensitive.Equals(e.Arguments[0], "index"))
                {
                    e.Mobile.SendMessage("Indexing player names, please wait...");

                    Index();

                    e.Mobile.SendMessage(
                        "Player name indexing complete, there are {0:#,0} registered names by {1:#,0} players.",
                        Registry.Count,
                        Registry.Values.Aggregate(0, (c, list) => c + list.Count));
                }
                else
                {
                    e.Mobile.SendGump(new PropertiesGump(e.Mobile, CSOptions));
                }
            });
        }
Exemple #2
0
        private static void CSConfig()
        {
            CommandUtility.Register("ExportCliloc", AccessLevel.Administrator, ExportCommand);

            var tables = new List <ClilocTable>(Tables.Values);

            //bool noFind = false;

            Core.DataDirectories.TakeWhile(path => !tables.TrueForAll(t => t.Loaded))
            .Where(path => !String.IsNullOrWhiteSpace(path))
            .ForEach(
                path => Parallel.ForEach(
                    Tables,
                    kvp =>
            {
                if (kvp.Value.Loaded)
                {
                    return;
                }

                var file = "Cliloc." + kvp.Key.ToString().ToLower();
                var stub = IOUtility.GetSafeFilePath(path + "/" + file, true);

                if (!File.Exists(stub))
                {
                    //CSOptions.ToConsole("WARNING: {0} not found!", file);
                    //noFind = true;
                    return;
                }

                kvp.Value.Load(new FileInfo(stub));
            }));

            /*if (noFind)
             * {
             *      CSOptions.ToConsole(
             *              "WARNING: One or more required cliloc files could not be loaded, any features that rely on this service will not work as expected and/or may cause a fatal exception!");
             * }*/

            tables.Free(true);
        }
Exemple #3
0
        public static void Configure()
        {
            if (Configured)
            {
                return;
            }

            DisplayRetroBoot();

            CommandUtility.Register("VNC", AccessLevel.Administrator, OnCoreCommand);

            OutgoingPacketOverrides.Init();
            ExtendedOPL.Init();

            DateTime now = DateTime.UtcNow;

            ToConsole(String.Empty);
            ToConsole("Compile action started...");

            TryCatch(CompileServices, ToConsole);
            TryCatch(CompileModules, ToConsole);

            Compiled = true;

            if (OnCompiled != null)
            {
                TryCatch(OnCompiled, ToConsole);
            }

            double time = (DateTime.UtcNow - now).TotalSeconds;

            ToConsole("Compile action completed in {0:F2} second{1}", time, (time != 1) ? "s" : String.Empty);

            now = DateTime.UtcNow;

            ToConsole(String.Empty);
            ToConsole("Configure action started...");

            TryCatch(ConfigureServices, ToConsole);
            TryCatch(ConfigureModules, ToConsole);

            Configured = true;

            if (OnConfigured != null)
            {
                TryCatch(OnConfigured, ToConsole);
            }

            time = (DateTime.UtcNow - now).TotalSeconds;

            ToConsole("Configure action completed in {0:F2} second{1}", time, (time != 1) ? "s" : String.Empty);

            ProcessINIT();

            EventSink.ServerStarted += () =>
            {
                EventSink.WorldSave += e =>
                {
                    TryCatch(Backup, ToConsole);
                    TryCatch(Save, ToConsole);
                };
                EventSink.Shutdown += e => TryCatch(Dispose, ToConsole);
                EventSink.Crashed  += e => TryCatch(Dispose, ToConsole);
            };
        }
 private static void CSConfig()
 {
     CommandUtility.Register("ExportCliloc", AccessLevel.Administrator, ExportCommand);
 }
Exemple #5
0
        public static void Configure()
        {
            if (Configured)
            {
                return;
            }

            DisplayRetroBoot();

            CommandUtility.Register("VNC", AccessLevel.Administrator, OnCoreCommand);

            OutgoingPacketOverrides.Init();
            ExtendedOPL.Init();

            var now = DateTime.UtcNow;

            ToConsole(String.Empty);
            ToConsole("Compile action started...");

            TryCatch(CompileServices, ToConsole);
            TryCatch(CompileModules, ToConsole);

            Compiled = true;

            InvokeByPriority(OnCompiled);

            var time = (DateTime.UtcNow - now).TotalSeconds;

            ToConsole("Compile action completed in {0:F2} second{1}", time, (time != 1) ? "s" : String.Empty);

            now = DateTime.UtcNow;

            ToConsole(String.Empty);
            ToConsole("Configure action started...");

            TryCatch(ConfigureServices, ToConsole);
            TryCatch(ConfigureModules, ToConsole);

            Configured = true;

            InvokeByPriority(OnConfigured);

            time = (DateTime.UtcNow - now).TotalSeconds;

            ToConsole("Configure action completed in {0:F2} second{1}", time, (time != 1) ? "s" : String.Empty);

            ProcessINIT();

            EventSink.ServerStarted += () =>
            {
                EventSink.WorldSave += e =>
                {
                    TryCatch(Backup, ToConsole);
                    TryCatch(Save, ToConsole);
                };
                EventSink.Shutdown += e => TryCatch(Dispose, ToConsole);
                EventSink.Crashed  += e => TryCatch(Dispose, ToConsole);
            };

            try
            {
                var crashed = typeof(EventSink).GetEventDelegates("Crashed");

                foreach (var m in crashed.OfType <CrashedEventHandler>())
                {
                    EventSink.Crashed -= m;
                }

                EventSink.Crashed += e => Crashed = true;

                foreach (var m in crashed.OfType <CrashedEventHandler>())
                {
                    EventSink.Crashed += m;
                }
            }
            catch (Exception x)
            {
                ToConsole(x);

                EventSink.Crashed += e => Crashed = true;
            }
        }