protected override void OnTick() { List <Item> spawners = new List <Item>(); foreach (NetState state in NetState.Instances) { if (state.Mobile != null) { foreach (Item item in state.Mobile.GetItemsInRange(100)) { if (item is IntelliSpawner) { spawners.Add(item); } } } } foreach (Item item in spawners) { IntelliSpawner spawner = item as IntelliSpawner; if (!spawner.Running) { spawner.Running = true; spawner.Respawn(); spawner.DoTimer(); } } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_IntelliSpawner.Deleted || state.Mobile.AccessLevel < AccessLevel.GameMaster) { return; } switch (info.ButtonID) { case 0: // Closed { return; } case 1: // Apply { m_IntelliSpawner.SpawnNames = CreateArray(info, state.Mobile); break; } case 2: // Bring to Home { m_IntelliSpawner.BringToHome(); break; } case 3: // Total Respawn { m_IntelliSpawner.Respawn(); break; } default: { int buttonID = info.ButtonID - 4; int index = buttonID / 2; int type = buttonID % 2; TextRelay entry = info.GetTextEntry(index); if (entry != null && entry.Text.Length > 0) { if (type == 0) // Spawn creature { m_IntelliSpawner.Spawn(entry.Text); } else // Remove creatures { m_IntelliSpawner.RemoveSpawned(entry.Text); } m_IntelliSpawner.SpawnNames = CreateArray(info, state.Mobile); } break; } } state.Mobile.SendGump(new IntelliSpawnerGump(m_IntelliSpawner)); }