示例#1
0
        /// <summary>
        /// Registers all of the NWNX event scripts.
        /// </summary>
        private static void RegisterNWNXEvents()
        {
            NWNXEvents.SubscribeEvent(NWNXEventType.StartCombatRoundBefore, "mod_on_attack");
            NWNXEvents.SubscribeEvent(NWNXEventType.ExamineObjectBefore, "mod_on_examine");
            NWNXEvents.SubscribeEvent(NWNXEventType.UseFeatBefore, "mod_on_usefeat");
            NWNXEvents.SubscribeEvent(NWNXEventType.UseItemBefore, "mod_on_useitem");
            NWNXEvents.SubscribeEvent(NWNXEventType.ItemEquipBefore, "mod_nwnx_equip");
            NWNXEvents.SubscribeEvent(NWNXEventType.ItemUnequipBefore, "mod_nwnx_unequip");

            NWNXChat.RegisterChatScript("mod_on_nwnxchat");
        }
示例#2
0
        // ReSharper disable once UnusedMember.Local
        public static void Main()
        {
            string nowString = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");

            Console.WriteLine(nowString + ": Module OnLoad executing...");

            using (new Profiler(nameof(mod_on_load) + ":DatabaseMigrator"))
            {
                DatabaseMigrationRunner.Start();
            }

            using (new Profiler(nameof(mod_on_load) + ":DBBackgroundThread"))
            {
                Console.WriteLine("Starting background thread manager...");
                BackgroundThreadManager.Start();
            }

            using (new Profiler(nameof(mod_on_load) + ":SetEventScripts"))
            {
                NWNXChat.RegisterChatScript("mod_on_nwnxchat");
                SetModuleEventScripts();
                SetAreaEventScripts();
                SetWeaponSettings();
            }
            // Bioware default
            _.ExecuteScript("x2_mod_def_load", _.OBJECT_SELF);

            using (new Profiler(nameof(mod_on_load) + ":RegisterSubscribeEvents"))
            {
                RegisterServiceSubscribeEvents();
            }

            ScriptService.Initialize();
            MessageHub.Instance.Publish(new OnModuleLoad());

            nowString = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");
            Console.WriteLine(nowString + ": Module OnLoad finished!");
        }