Example #1
0
 public void ProcessAIForNPCs()
 {
     if (!ProcessingAI)
     {
         ProcessingAI = true;
         LoadNPCs();
         //loop through each NPC and call the Update() method
         foreach (string id in _npcList)
         {
             Iactor actor = CharacterFactory.Factory.CreateCharacter(CharacterType.NPC);
             actor.Load(id);
             Inpc npc = actor as Inpc;
             if (DateTime.Now.ToUniversalTime() > npc.NextAiAction)
             {
                 npc.Update();
                 //in case the Rot Ai state cleaned this guy out of the DB.
                 if (GetAnNPCByID(id) != null)
                 {
                     actor.Save();
                 }
             }
         }
         ProcessingAI = false;
     }
 }
Example #2
0
 public void CleanupBonuses()
 {
     if (_npcList != null)
     {
         foreach (string id in _npcList)
         {
             Iactor actor = CharacterFactory.Factory.CreateCharacter(CharacterType.NPC);
             actor.Load(id);
             actor.CleanupBonuses();
             actor.Save();
         }
     }
 }
Example #3
0
 public void RegenerateAttributes()
 {
     if (_npcList != null)
     {
         foreach (string id in _npcList)
         {
             Iactor actor = CharacterFactory.Factory.CreateCharacter(CharacterType.NPC);
             actor.Load(id);
             foreach (KeyValuePair <string, Attribute> attrib in actor.GetAttributes())
             {
                 actor.ApplyRegen(attrib.Key);
             }
             actor.Save();
         }
     }
 }