public PokerusWindow() { InitializeComponent(); this.strain = PokeManager.PokerusStrains[0]; this.textBlockDays.Text = "This strain will last for " + ((int)this.strain.Strain + 1).ToString() + " day" + ((int)this.strain.Strain + 1 > 1 ? "s" : "") + "."; foreach (PokerusStrain strain in PokeManager.PokerusStrains) { ComboBoxItem item = new ComboBoxItem(); item.Content = strain.ToString(); item.Tag = strain; comboBoxPokerus.Items.Add(item); } comboBoxPokerus.SelectedIndex = 0; }
private void OnStrainSelectionChanged(object sender, SelectionChangedEventArgs e) { strain = (PokerusStrain)((ComboBoxItem)comboBoxPokerus.SelectedItem).Tag; this.textBlockDays.Text = "This strain will last for " + ((int)this.strain.Strain + 1).ToString() + " day" + ((int)this.strain.Strain + 1 > 1 ? "s" : "") + "."; }
public List<PokerusStrain> CheckAllPokemonForPokerus() { List<PokerusStrain> foundStrains = new List<PokerusStrain>(); for (int i = -1; i < PokeManager.NumGameSaves; i++) { IGameSave gameSave = PokeManager.GetGameSaveAt(i); if (gameSave is ManagerGameSave) { for (int j = 0; j < (gameSave as ManagerGameSave).NumPokePCRows; j++) { foreach (IPokemon pokemon in (gameSave as ManagerGameSave).GetPokePCRow(j)) { PokerusStrain strain = new PokerusStrain(pokemon.PokerusStrain); if (pokemon.PokerusStrain != 0 && pokemon.PokerusStatus == PokerusStatuses.Infected && !PokeManager.PokerusStrains.Contains(strain) && !foundStrains.Contains(strain)) { foundStrains.Add(strain); } } } } else { foreach (IPokemon pokemon in gameSave.PokePC) { PokerusStrain strain = new PokerusStrain(pokemon.PokerusStrain); if (pokemon.PokerusStrain != 0 && pokemon.PokerusStatus == PokerusStatuses.Infected && !PokeManager.PokerusStrains.Contains(strain) && !foundStrains.Contains(strain)) { foundStrains.Add(strain); } } } } foundStrains.Sort((strain1, strain2) => (strain1.Order - strain2.Order)); return foundStrains; }