public static void CheckDupedEntries(MegaSpawner megaSpawner) { for (int i = 0; i < megaSpawner.EntryList.Count; i++) { string entryType = (string)megaSpawner.EntryList[i]; int count = 0; for (int j = 0; j < megaSpawner.EntryList.Count; j++) { string entryCompare = (string)megaSpawner.EntryList[j]; if (entryType == entryCompare) { count++; } if (count > 1) { megaSpawner.DeleteEntry(i); i--; break; } } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { switch (info.ButtonID) { case 0: // Close Gump { MessagesTitle = "Delete Entry"; Messages = "You have chosen not to delete the entry."; SetArgsList(); gumpMobile.SendGump(new EditSpawnGump(gumpMobile, ArgsList)); break; } case 1: // Delete Entry { if (CheckProcess()) { break; } MSEGCheckBoxesList.RemoveAt(index); megaSpawner.DeleteEntry(index); MessagesTitle = "Delete Entry"; Messages = "Entry has been removed."; SetArgsList(); gumpMobile.SendGump(new MegaSpawnerEditGump(gumpMobile, ArgsList)); break; } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { switch (info.ButtonID) { case 0: // Close Gump { MessagesTitle = "Delete Bad Entries"; Messages = "You have chosen not to delete all bad entries for selected spawners."; SetArgsList(); gumpMobile.SendGump(new PlugInsGump(gumpMobile, ArgsList)); break; } case 1: // Delete Bad Entries { int count = 0, badEntries = 0; for (int i = 0; i < MC.SpawnerList.Count; i++) { MegaSpawner megaSpawner = (MegaSpawner)MC.SpawnerList[i]; if ((bool)MSGCheckBoxesList[i]) { bool success = false; for (int j = 0; j < megaSpawner.EntryList.Count; j++) { string checkEntryType = Convert.ToString(ScriptCompiler.FindTypeByName(megaSpawner.EntryList[j].ToString())); if (checkEntryType == "") { badEntries++; success = true; megaSpawner.DeleteEntry(j); j--; } } if (success) { count++; } } } MessagesTitle = "Delete Bad Entries"; if (count > 0) { Messages = String.Format("{0} bad entr{1} have been removed from {2} Mega Spawner{3}.", badEntries, badEntries == 1 ? "y" : "ies", count, count == 1 ? "" : "s"); } else { Messages = "Either no Mega Spawners have been selected or none of them had bad entries."; } SetArgsList(); gumpMobile.SendGump(new PlugInsGump(gumpMobile, ArgsList)); break; } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { switch (info.ButtonID) { case 0: // Close Gump { switch (Select) { case 1: { MessagesTitle = "Delete All Entries"; Messages = "You have chosen not to delete all entries on the Mega Spawner."; break; } case 2: { MessagesTitle = "Delete Selected Entries"; Messages = "You have chosen not to delete selected entries on the Mega Spawner."; break; } } SetArgsList(); gumpMobile.SendGump(new MegaSpawnerEditGump(gumpMobile, ArgsList)); break; } case 1: // Delete Entries { if (CheckProcess()) { break; } switch (Select) { case 1: // Delete All Entries { megaSpawner.ClearSpawner(); MSEGCheckBoxesList.Clear(); MessagesTitle = "Delete All Entries"; Messages = "All of the entries on the Mega Spawner have been deleted."; break; } case 2: // Delete Selected Entries { for (int i = 0; i < megaSpawner.EntryList.Count; i++) { if ((bool)MSEGCheckBoxesList[i]) { MSEGCheckBoxesList.RemoveAt(i); megaSpawner.DeleteEntry(i); i--; } } MessagesTitle = "Delete Selected Entries"; Messages = "All selected entries on the Mega Spawner have been deleted."; break; } } SetArgsList(); gumpMobile.SendGump(new MegaSpawnerEditGump(gumpMobile, ArgsList)); break; } } }