Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.78 KB | None | 0 0
  1.  
  2.         [Description("Removes SmartSpawning on Quester XmlSpawners.")]
  3.         public static void RemoveSmartSpawningFromQuesters_OnCommand(CommandEventArgs e)
  4.         {
  5.             int count = 0;
  6.             foreach (Item item in World.Items.Values)
  7.             {
  8.                 if (item is XmlSpawner)
  9.                 {
  10.  
  11.                     XmlSpawner spawner = (XmlSpawner)item;
  12.                     if (spawner.Deleted) continue;
  13.                     if (spawner.SmartSpawning)
  14.                     {
  15.                         int nso = 0;
  16.  
  17.                         if (spawner.m_SpawnObjects != null) nso = spawner.m_SpawnObjects.Count;
  18.                         System.Console.WriteLine("NSO: " + nso);
  19.  
  20.                         // empty spawner so skip it
  21.                         if (nso == 0) continue;
  22.  
  23.                         // check the spawn types
  24.                         for (int i = 0; i < nso; ++i)
  25.                         {
  26.                             SpawnObject so = spawner.m_SpawnObjects[i];
  27.  
  28.                             if (so == null) continue;
  29.  
  30.                             string typestr = so.TypeName;
  31.  
  32.                             Type type = SpawnerType.GetType(typestr);
  33.                            
  34.                             if (typestr == null || (type != null && (type == typeof(MondainQuester) || type.IsSubclassOf(typeof(MondainQuester)))))
  35.                             {
  36.                                 spawner.SmartSpawning = false;
  37.                                 count++;
  38.                                 break;
  39.                             }
  40.                         }
  41.                     }              
  42.                 }
  43.             }
  44.             e.Mobile.SendMessage("Found {0} Questers and removed smart spawning from them.", count);
  45.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement