Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Description("Removes SmartSpawning on Quester XmlSpawners.")]
- public static void RemoveSmartSpawningFromQuesters_OnCommand(CommandEventArgs e)
- {
- int count = 0;
- foreach (Item item in World.Items.Values)
- {
- if (item is XmlSpawner)
- {
- XmlSpawner spawner = (XmlSpawner)item;
- if (spawner.Deleted) continue;
- if (spawner.SmartSpawning)
- {
- int nso = 0;
- if (spawner.m_SpawnObjects != null) nso = spawner.m_SpawnObjects.Count;
- System.Console.WriteLine("NSO: " + nso);
- // empty spawner so skip it
- if (nso == 0) continue;
- // check the spawn types
- for (int i = 0; i < nso; ++i)
- {
- SpawnObject so = spawner.m_SpawnObjects[i];
- if (so == null) continue;
- string typestr = so.TypeName;
- Type type = SpawnerType.GetType(typestr);
- if (typestr == null || (type != null && (type == typeof(MondainQuester) || type.IsSubclassOf(typeof(MondainQuester)))))
- {
- spawner.SmartSpawning = false;
- count++;
- break;
- }
- }
- }
- }
- }
- e.Mobile.SendMessage("Found {0} Questers and removed smart spawning from them.", count);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement