Пример #1
0
        public bool Run(params object[] args)
        {
            string nowString = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");

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

            Console.WriteLine("Starting background thread manager...");
            _backgroundThreadManager.Start();

            _nwnxChat.RegisterChatScript("mod_on_nwnxchat");
            SetModuleEventScripts();
            SetAreaEventScripts();
            SetWeaponSettings();

            // Bioware default
            _.ExecuteScript("x2_mod_def_load", Object.OBJECT_SELF);
            _objectProcessing.RegisterProcessingEvent <AppStateProcessor>();
            _objectProcessing.RegisterProcessingEvent <ServerRestartProcessor>();
            _objectProcessing.OnModuleLoad();
            _dataPackage.OnModuleLoad();
            _farming.OnModuleLoad();
            _base.OnModuleLoad();
            _area.OnModuleLoad();
            _spawn.OnModuleLoad();
            _customEffect.OnModuleLoad();
            _objectVisibility.OnModuleLoad();

            nowString = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");
            Console.WriteLine(nowString + ": Module OnLoad finished!");
            return(true);
        }
Пример #2
0
        public string RegisterBehaviour(IBehaviourTreeNode node)
        {
            TimeData time        = new TimeData(_objProc.ProcessingTickInterval);
            string   behaviourID = _objProc.RegisterProcessingEvent(() => node.Tick(time));

            return(behaviourID);
        }
Пример #3
0
        public void OnModuleLoad()
        {
            _ops.RegisterProcessingEvent(() =>
            {
                foreach (var npcTable in _state.NPCEnmityTables.ToArray())
                {
                    if (!npcTable.Value.NPCObject.IsValid)
                    {
                        _state.NPCEnmityTables.Remove(npcTable.Key);
                    }
                }
                for (int x = _state.NPCBehaviours.Count - 1; x >= 0; x--)
                {
                    var npcBehaviour = _state.NPCBehaviours.ElementAt(x);
                    if (!npcBehaviour.Value.IsValid)
                    {
                        _state.NPCBehaviours.Remove(npcBehaviour.Key);
                        _ops.UnregisterProcessingEvent(npcBehaviour.Key);
                    }
                }
                foreach (var customData in _state.CustomObjectData.ToArray())
                {
                    NWObject owner = customData.Value.Owner;
                    if (!owner.IsValid)
                    {
                        _state.CustomObjectData.Remove(customData.Key);
                    }
                }

                //int count = NWModule.Get().GetLocalInt("current_count") + 1;
                //if (count >= 20)
                //{
                //    Console.WriteLine("******************");

                //    Console.WriteLine("PlayerDialogs: " + _state.PlayerDialogs.Count);
                //    Console.WriteLine("DialogFilesInUse: " + _state.DialogFilesInUse.Count);
                //    Console.WriteLine("EffectTicks: " + _state.EffectTicks.Count);
                //    Console.WriteLine("CreatureSkillRegistrations: " + _state.CreatureSkillRegistrations.Count);
                //    Console.WriteLine("NPCEffects: " + _state.NPCEffects.Count);
                //    Console.WriteLine("EffectsToRemove: " + _state.EffectsToRemove.Count);
                //    Console.WriteLine("ProcessingEvents: " + _state.ProcessingEvents.Count);
                //    Console.WriteLine("UnregisterProcessingEvents: " + _state.UnregisterProcessingEvents.Count);
                //    Console.WriteLine("NPCEnmityTables: " + _state.NPCEnmityTables.Count);
                //    Console.WriteLine("CustomObjectData: " + _state.CustomObjectData.Count);
                //    Console.WriteLine("NPCBehaviours: " + _state.NPCBehaviours.Count);

                //    Console.WriteLine("******************");
                //    count = 0;
                //}
                //NWModule.Get().SetLocalInt("current_count", count);
            });
        }
Пример #4
0
        public void RegisterBehaviour(IBehaviourTreeNode node, NWCreature creature)
        {
            TimeData time        = new TimeData(_objProc.ProcessingTickInterval);
            string   behaviourID = _objProc.RegisterProcessingEvent(() =>
            {
                if (creature.IsValid)
                {
                    node.Tick(time);
                }
            });

            _state.NPCBehaviours.Add(behaviourID, creature);
        }
Пример #5
0
        public void RegisterBehaviour(IBehaviourTreeNode node, NWCreature creature)
        {
            string behaviourID = _objProc.RegisterProcessingEvent <BehaviourProcessor>(node, creature);

            _cache.NPCBehaviours.Add(behaviourID, creature);
        }
Пример #6
0
 public void OnModuleLoad()
 {
     _ops.RegisterProcessingEvent <CustomEffectProcessor>();
 }
Пример #7
0
 public void OnModuleLoad()
 {
     InitializeSpawns();
     _processor.RegisterProcessingEvent <SpawnProcessor>();
 }