public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case 0:                     // Close Gump
            {
                switch (Select)
                {
                case 1: { MessagesTitle = "Delete All Settings"; Messages = "You have chosen not to delete all settings on the Mega Spawner."; break; }

                case 2: { MessagesTitle = "Delete Selected Settings"; Messages = "You have chosen not to delete selected settings on the Mega Spawner."; break; }
                }

                SetArgsList();

                gumpMobile.SendGump(new SettingsGump(gumpMobile, ArgsList));

                break;
            }

            case 1:                     // Delete Settings
            {
                if (CheckProcess())
                {
                    break;
                }

                switch (Select)
                {
                case 1:                                 // Delete All Settings
                {
                    if (megaSpawner.OverrideIndividualEntries)
                    {
                        MegaSpawnerOverride.DeleteEntries(megaSpawner);
                        MegaSpawnerOverride.RemoveRespawnEntries(megaSpawner);
                        megaSpawner.RemoveRespawnEntries();
                        megaSpawner.SpawnedEntries.Clear();
                        megaSpawner.LastMovedList.Clear();

                        for (int i = 0; i < megaSpawner.EntryList.Count; i++)
                        {
                            int amount = (int)megaSpawner.AmountList[i];

                            ArrayList respawnEntryList  = new ArrayList();
                            ArrayList respawnTimeList   = new ArrayList();
                            ArrayList spawnCounterList  = new ArrayList();
                            ArrayList spawnTimeList     = new ArrayList();
                            ArrayList respawnOnSaveList = new ArrayList();
                            ArrayList despawnTimeList   = new ArrayList();

                            for (int j = 0; j < amount; j++)
                            {
                                respawnEntryList.Add((string)megaSpawner.EntryList[i]);
                                respawnTimeList.Add(0);
                                spawnCounterList.Add(DateTime.Now);
                                spawnTimeList.Add(0);
                                respawnOnSaveList.Add((bool)false);
                                despawnTimeList.Add(0);
                            }

                            megaSpawner.RespawnEntryList.Add(respawnEntryList);
                            megaSpawner.RespawnTimeList.Add(respawnTimeList);
                            megaSpawner.SpawnCounterList.Add(spawnCounterList);
                            megaSpawner.SpawnTimeList.Add(spawnTimeList);
                            megaSpawner.RespawnOnSaveList.Add(respawnOnSaveList);
                            megaSpawner.DespawnTimeList.Add(despawnTimeList);
                            megaSpawner.SpawnedEntries.Add(new ArrayList());
                            megaSpawner.LastMovedList.Add(new ArrayList());
                        }
                    }

                    megaSpawner.ResetSettingValues();
                    megaSpawner.SettingsList.Clear();
                    SettingsCheckBoxesList.Clear();
                    megaSpawner.Respawn();

                    MessagesTitle = "Delete All Settings";
                    Messages      = "All of the settings on the Mega Spawner have been deleted.";

                    break;
                }

                case 2:                                 // Delete Selected Settings
                {
                    for (int i = 0; i < megaSpawner.SettingsList.Count; i++)
                    {
                        if ((bool)SettingsCheckBoxesList[i])
                        {
                            ArrayList settingList = (ArrayList)megaSpawner.SettingsList[i];

                            if ((Setting)settingList[0] == Setting.OverrideIndividualEntries)
                            {
                                MegaSpawnerOverride.DeleteEntries(megaSpawner);
                                MegaSpawnerOverride.RemoveRespawnEntries(megaSpawner);
                                megaSpawner.RemoveRespawnEntries();
                                megaSpawner.SpawnedEntries.Clear();
                                megaSpawner.LastMovedList.Clear();

                                for (int j = 0; j < megaSpawner.EntryList.Count; j++)
                                {
                                    int amount = (int)megaSpawner.AmountList[j];

                                    ArrayList respawnEntryList  = new ArrayList();
                                    ArrayList respawnTimeList   = new ArrayList();
                                    ArrayList spawnCounterList  = new ArrayList();
                                    ArrayList spawnTimeList     = new ArrayList();
                                    ArrayList respawnOnSaveList = new ArrayList();
                                    ArrayList despawnTimeList   = new ArrayList();

                                    for (int k = 0; k < amount; k++)
                                    {
                                        respawnEntryList.Add((string)megaSpawner.EntryList[j]);
                                        respawnTimeList.Add(0);
                                        spawnCounterList.Add(DateTime.Now);
                                        spawnTimeList.Add(0);
                                        respawnOnSaveList.Add((bool)false);
                                        despawnTimeList.Add(0);
                                    }

                                    megaSpawner.RespawnEntryList.Add(respawnEntryList);
                                    megaSpawner.RespawnTimeList.Add(respawnTimeList);
                                    megaSpawner.SpawnCounterList.Add(spawnCounterList);
                                    megaSpawner.SpawnTimeList.Add(spawnTimeList);
                                    megaSpawner.RespawnOnSaveList.Add(respawnOnSaveList);
                                    megaSpawner.DespawnTimeList.Add(despawnTimeList);
                                    megaSpawner.SpawnedEntries.Add(new ArrayList());
                                    megaSpawner.LastMovedList.Add(new ArrayList());
                                }
                            }

                            megaSpawner.ResetSetting(i);
                            megaSpawner.SettingsList.RemoveAt(i);
                            SettingsCheckBoxesList.RemoveAt(i);
                            megaSpawner.Respawn();

                            i--;
                        }
                    }

                    megaSpawner.Respawn();

                    MessagesTitle = "Delete Selected Settings";
                    Messages      = "All selected settings on the Mega Spawner have been deleted.";

                    break;
                }
                }

                SetArgsList();

                gumpMobile.SendGump(new SettingsGump(gumpMobile, ArgsList));

                break;
            }
            }
        }
Exemplo n.º 2
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case 0:                     // Close Gump
            {
                MessagesTitle = "Delete Override Settings";
                Messages      = "You have chosen not to delete the override setting for selected spawners.";

                SetArgsList();

                gumpMobile.SendGump(new PlugInsGump(gumpMobile, ArgsList));

                break;
            }

            case 1:                     // Delete Override Settings
            {
                int count = 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.SettingsList.Count; j++)
                        {
                            ArrayList settingList = (ArrayList)megaSpawner.SettingsList[j];

                            if ((Setting)settingList[0] == Setting.OverrideIndividualEntries)
                            {
                                success = true;

                                MegaSpawnerOverride.DeleteEntries(megaSpawner);
                                MegaSpawnerOverride.RemoveRespawnEntries(megaSpawner);
                                megaSpawner.RemoveRespawnEntries();
                                megaSpawner.SpawnedEntries.Clear();
                                megaSpawner.LastMovedList.Clear();

                                for (int k = 0; k < megaSpawner.EntryList.Count; k++)
                                {
                                    int amount = (int)megaSpawner.AmountList[k];

                                    ArrayList respawnEntryList  = new ArrayList();
                                    ArrayList respawnTimeList   = new ArrayList();
                                    ArrayList spawnCounterList  = new ArrayList();
                                    ArrayList spawnTimeList     = new ArrayList();
                                    ArrayList respawnOnSaveList = new ArrayList();
                                    ArrayList despawnTimeList   = new ArrayList();

                                    for (int l = 0; l < amount; l++)
                                    {
                                        respawnEntryList.Add((string)megaSpawner.EntryList[k]);
                                        respawnTimeList.Add(0);
                                        spawnCounterList.Add(DateTime.Now);
                                        spawnTimeList.Add(0);
                                        respawnOnSaveList.Add((bool)false);
                                        despawnTimeList.Add(0);
                                    }

                                    megaSpawner.RespawnEntryList.Add(respawnEntryList);
                                    megaSpawner.RespawnTimeList.Add(respawnTimeList);
                                    megaSpawner.SpawnCounterList.Add(spawnCounterList);
                                    megaSpawner.SpawnTimeList.Add(spawnTimeList);
                                    megaSpawner.RespawnOnSaveList.Add(respawnOnSaveList);
                                    megaSpawner.DespawnTimeList.Add(despawnTimeList);
                                    megaSpawner.SpawnedEntries.Add(new ArrayList());
                                    megaSpawner.LastMovedList.Add(new ArrayList());
                                }

                                megaSpawner.ResetSetting(j);
                                megaSpawner.SettingsList.RemoveAt(j);
                                megaSpawner.Respawn();
                                j--;
                            }
                        }

                        if (success)
                        {
                            count++;
                        }
                    }
                }

                MessagesTitle = "Delete Override Settings";

                if (count > 0)
                {
                    Messages = String.Format("\"Override Individual Entries\" setting has been removed on {0} Mega Spawner{1}.", count, count == 1 ? "" : "s");
                }
                else
                {
                    Messages = "Either no Mega Spawners have been selected or none of them had the \"Override Individual Entries\" setting.";
                }

                SetArgsList();

                gumpMobile.SendGump(new PlugInsGump(gumpMobile, ArgsList));

                break;
            }
            }
        }