private void SetForms() { int species = WinFormsUtil.GetIndex(CB_Species); bool hasForms = FormConverter.HasFormSelection(PersonalTable.AO[species], species, 6); CB_Form.Enabled = CB_Form.Visible = hasForms; CB_Form.InitializeBinding(); CB_Form.DataSource = PKX.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList(); }
private bool FillLBForms() { if (allModifying) { return(false); } LB_Forms.DataSource = null; LB_Forms.Items.Clear(); int fspecies = LB_Species.SelectedIndex + 1; var bspecies = Dex.GetBaseSpecies(fspecies); bool hasForms = FormConverter.HasFormSelection(SAV.Personal[bspecies], bspecies, 7); LB_Forms.Enabled = hasForms; if (!hasForms) { return(false); } var ds = FormConverter.GetFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList(); if (ds.Count == 1 && string.IsNullOrEmpty(ds[0])) { // empty LB_Forms.Enabled = false; return(false); } // sanity check formes -- SM does not have totem form dex bits int count = SAV.Personal[bspecies].FormeCount; if (count < ds.Count) { ds.RemoveAt(count); // remove last } LB_Forms.DataSource = ds; if (fspecies <= SAV.MaxSpeciesID) { LB_Forms.SelectedIndex = 0; } else { int fc = SAV.Personal[bspecies].FormeCount; if (fc <= 1) { return(true); } int f = Dex.DexFormIndexFetcher(bspecies, fc, SAV.MaxSpeciesID - 1); if (f < 0) { return(true); // bit index valid } if (f > fspecies - LB_Forms.Items.Count - 1) { LB_Forms.SelectedIndex = fspecies - f - 1; } else { LB_Forms.SelectedIndex = -1; } } return(true); }