Example #1
0
 private static void Clean()
 {
     foreach (var npcTable in NPCEnmityTables.ToArray())
     {
         if (!npcTable.Value.NPCObject.IsValid)
         {
             NPCEnmityTables.Remove(npcTable.Key);
         }
     }
     foreach (var customData in CustomObjectData.ToArray())
     {
         NWObject owner = customData.Value.Owner;
         if (!owner.IsValid)
         {
             CustomObjectData.Remove(customData.Key);
         }
     }
 }
Example #2
0
        private static void Clean()
        {
            for (int index = NPCEnmityTables.Count - 1; index >= 0; index--)
            {
                var npcTable = NPCEnmityTables.ElementAt(index);
                if (!npcTable.Value.NPCObject.IsValid)
                {
                    NPCEnmityTables.Remove(npcTable.Key);
                }
            }

            for (int index = CustomObjectData.Count - 1; index >= 0; index--)
            {
                var      customData = CustomObjectData.ElementAt(index);
                NWObject owner      = customData.Value.Owner;
                if (!owner.IsValid)
                {
                    CustomObjectData.Remove(customData.Key);
                }
            }
        }