private void AddTrashEditing(int count) { FLP_Hex.Visible = true; GB_Trash.Visible = true; NUD_Generation.Value = SAV.Generation; Font courier = new Font("Courier New", 8); for (int i = 0; i < count; i++) { var l = GetLabel($"${i:X2}"); l.Font = courier; var n = GetNUD(min: 0, max: 255, hex: true); n.Click += (s, e) => { switch (ModifierKeys) { case Keys.Shift: n.Value = n.Maximum; break; case Keys.Alt: n.Value = n.Minimum; break; } }; n.Value = Raw[i]; n.ValueChanged += UpdateNUD; FLP_Hex.Controls.Add(l); FLP_Hex.Controls.Add(n); Bytes.Add(n); } TB_Text.TextChanged += UpdateString; CB_Species.InitializeBinding(); CB_Species.DataSource = new BindingSource(GameInfo.SpeciesDataSource, null); CB_Language.InitializeBinding(); CB_Language.DataSource = GameInfo.LanguageDataSource(SAV.Generation); }
private void SetupComboBoxes() { CB_Ball.InitializeBinding(); CB_HeldItem.InitializeBinding(); CB_Species.InitializeBinding(); CB_Nature.InitializeBinding(); CB_Ball.DataSource = new BindingSource(GameInfo.BallDataSource.Where(b => b.Value <= SAV.MaxBallID).ToList(), null); CB_HeldItem.DataSource = new BindingSource(GameInfo.ItemDataSource.Where(i => i.Value < SAV.MaxItemID).ToList(), null); CB_Species.DataSource = new BindingSource(GameInfo.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID).ToList(), null); CB_Nature.DataSource = new BindingSource(GameInfo.NatureDataSource, null); CB_Move1.InitializeBinding(); CB_Move2.InitializeBinding(); CB_Move3.InitializeBinding(); CB_Move4.InitializeBinding(); var MoveList = GameInfo.MoveDataSource; CB_Move1.DataSource = new BindingSource(MoveList, null); CB_Move2.DataSource = new BindingSource(MoveList, null); CB_Move3.DataSource = new BindingSource(MoveList, null); CB_Move4.DataSource = new BindingSource(MoveList, null); }
private void PopulateComboBoxes() { // Set the Text CB_HeldItem.InitializeBinding(); CB_Species.InitializeBinding(); var Any = new ComboItem(MsgAny, -1); var DS_Species = new List <ComboItem>(GameInfo.SpeciesDataSource); DS_Species.RemoveAt(0); var filteredSpecies = DS_Species.Where(spec => RawDB.Any(mg => mg.Species == spec.Value)).ToList(); filteredSpecies.Insert(0, Any); CB_Species.DataSource = filteredSpecies; var DS_Item = new List <ComboItem>(GameInfo.ItemDataSource); DS_Item.Insert(0, Any); CB_HeldItem.DataSource = DS_Item; // Set the Move ComboBoxes too.. var DS_Move = new List <ComboItem>(GameInfo.MoveDataSource); DS_Move.RemoveAt(0); DS_Move.Insert(0, Any); { foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4 }) { cb.InitializeBinding(); cb.DataSource = new BindingSource(DS_Move, null); } } // Trigger a Reset ResetFilters(null, EventArgs.Empty); B_Search.Enabled = true; }
public SAV_PokedexLA(SAV8LA sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (SAV8LA)(Origin = sav).Clone(); Dex = SAV.Blocks.PokedexSave; var speciesNames = GameInfo.Strings.Species; CHK_SeenWild = new[] { CHK_S0, CHK_S1, CHK_S2, CHK_S3, CHK_S4, CHK_S5, CHK_S6, CHK_S7 }; CHK_Obtained = new[] { CHK_O0, CHK_O1, CHK_O2, CHK_O3, CHK_O4, CHK_O5, CHK_O6, CHK_O7 }; CHK_CaughtWild = new[] { CHK_C0, CHK_C1, CHK_C2, CHK_C3, CHK_C4, CHK_C5, CHK_C6, CHK_C7 }; TaskControls = new [] { PRT_1, PRT_2, PRT_3, PRT_4, PRT_5, PRT_6, PRT_7, PRT_8, PRT_9, PRT_10, }; foreach (var tc in TaskControls) { tc.Visible = false; tc.SetStrings(TaskDescriptions, SpeciesQuests, TimeTaskDescriptions); } SpeciesToDex = new int[SAV.Personal.MaxSpeciesID + 1]; var maxDex = 0; for (var s = 1; s <= SAV.Personal.MaxSpeciesID; s++) { var hisuiDex = PokedexSave8a.GetDexIndex(PokedexType8a.Hisui, s); if (hisuiDex == 0) { continue; } SpeciesToDex[s] = hisuiDex; if (hisuiDex > maxDex) { maxDex = hisuiDex; } } DexToSpecies = new int[maxDex + 1]; for (var s = 1; s <= SAV.Personal.MaxSpeciesID; s++) { if (SpeciesToDex[s] != 0) { DexToSpecies[SpeciesToDex[s]] = s; } } Editing = true; // Clear Listbox and ComboBox LB_Species.Items.Clear(); CB_Species.Items.Clear(); // Fill List CB_Species.InitializeBinding(); var species = GameInfo.FilteredSources.Species.Where(z => PokedexSave8a.GetDexIndex(PokedexType8a.Hisui, z.Value) != 0).ToArray(); CB_Species.DataSource = new BindingSource(species, null); CB_DisplayForm.InitializeBinding(); DisplayedForms = new List <ComboItem> { new(GameInfo.Strings.types[0], 0) }; CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, null); for (var d = 1; d < DexToSpecies.Length; d++) { LB_Species.Items.Add($"{d:000} - {speciesNames[DexToSpecies[d]]}"); } Editing = false; LB_Species.SelectedIndex = 0; CB_Species.KeyDown += WinFormsUtil.RemoveDropCB; CanSave = true; }
private void ReadBattleFrontier() { BFV = new[] { new[] { 2, 0 }, // Max, Current new[] { 2, 0, 3, 1 }, // Max, Current, Max(Trade), Current(Trade) new[] { 2, 0, 1, -1, 3 }, // Max, Current, Current(CP), (UsedCP), Max(CP) }; BFT = new[] { new[] { "Singles", "Doubles", "Multi" }, new[] { "Singles", "Doubles", "Multi (Trainer)", "Multi (Friend)", "Wi-Fi" }, }; BFN = new[] { "Tower", "Factory", "Hall", "Castle", "Arcade" }; if (SAV.DP) { BFN = BFN.Take(1).ToArray(); } StatNUDA = new[] { NUD_Stat0, NUD_Stat1, NUD_Stat2, NUD_Stat3 }; StatLabelA = new[] { L_Stat0, L_Stat1, L_Stat2, L_Stat3 }; StatRBA = new[] { RB_Stats3_01, RB_Stats3_02 }; if (ofsPrints > 0) { PrintColorA = new[] { Color.Transparent, Color.Silver, Color.Gold }; PrintButtonA = new[] { BTN_PrintTower, BTN_PrintFactory, BTN_PrintHall, BTN_PrintCastle, BTN_PrintArcade }; Prints = new int[PrintButtonA.Length]; for (int i = 0; i < Prints.Length; i++) { Prints[i] = 1 + Math.Sign((BitConverter.ToUInt16(SAV.General, ofsPrints + (i << 1)) >> 1) - 1); } SetPrints(); HallNUDA = new[] { NUD_HallType01, NUD_HallType02, NUD_HallType03, NUD_HallType04, NUD_HallType05, NUD_HallType06, NUD_HallType07, NUD_HallType08, NUD_HallType09, NUD_HallType10, NUD_HallType11, NUD_HallType12, NUD_HallType13, NUD_HallType14, NUD_HallType15, NUD_HallType16, NUD_HallType17 }; string[] TypeName = Util.GetTypesList("en"); int[] typenameIndex = new[] { 0, 9, 10, 12, 11, 14, 1, 3, 4, 2, 13, 6, 5, 7, 15, 16, 8 }; for (int i = 0; i < HallNUDA.Length; i++) { tip2.SetToolTip(HallNUDA[i], TypeName[typenameIndex[i]]); } } if (ofsHallStat > 0) { bool f = false; for (int i = 0; i < 2; i++, ofsHallStat += 0x14) { var h = BitConverter.ToInt32(SAV.Data, ofsHallStat); if (h == -1) { continue; } for (int j = 0; j < 0x20; j++) { for (int k = 0, a = j + 0x20 << 12; k < 2; k++, a += 0x40000) { if (h != BitConverter.ToInt32(SAV.Data, a) || BitConverter.ToInt16(SAV.Data, a + 0xBA8) != 0xBA0) { continue; } f = true; ofsHallStat = a; break; } if (f) { break; } } if (f) { break; } } if (!f) { ofsHallStat = -1; NUD_HallStreaks.Visible = NUD_HallStreaks.Enabled = false; } } editing = true; CB_Stats1.Items.Clear(); foreach (string t in BFN) { CB_Stats1.Items.Add(t); } StatRBA[0].Checked = true; // Clear Listbox and ComboBox CB_Species.Items.Clear(); // Fill List CB_Species.InitializeBinding(); CB_Species.DataSource = new BindingSource(GameInfo.SpeciesDataSource.Skip(1).Where(id => id.Value <= SAV.MaxSpeciesID).ToList(), null); editing = false; CB_Stats1.SelectedIndex = 0; }