public SAV_ZygardeCell(SaveFile sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (SAV7)(Origin = sav).Clone(); // Constants @ 0x1C00 // Cell Data @ 0x1D8C // Use constants 0x18C/2 = 198 thru +95 ushort[] constants = SAV.GetAllEventWork(); var cells = constants.AsSpan(celloffset, CellCount); int cellCount = constants[cellstotal]; int cellCollected = constants[cellscollected]; NUD_Cells.Value = cellCount; NUD_Collected.Value = cellCollected; var combo = (DataGridViewComboBoxColumn)dgv.Columns[2]; combo.Items.AddRange(states); // add only the Names dgv.Columns[0].ValueType = typeof(int); // Populate Grid dgv.Rows.Add(CellCount); var locations = SAV is SAV7SM ? locationsSM : locationsUSUM; for (int i = 0; i < CellCount; i++) { if (cells[i] > 2) { throw new IndexOutOfRangeException("Unable to find cell index."); } dgv.Rows[i].Cells[0].Value = (i + 1); dgv.Rows[i].Cells[1].Value = locations[i]; dgv.Rows[i].Cells[2].Value = states[cells[i]]; } }
public BatchEditor(PKM pk, SaveFile sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); Entity = pk; SAV = sav; DragDrop += TabMain_DragDrop; DragEnter += TabMain_DragEnter; CB_Format.Items.Clear(); CB_Format.Items.Add(MsgAny); foreach (Type t in BatchEditing.Types) { CB_Format.Items.Add(t.Name.ToLowerInvariant()); } CB_Format.Items.Add(MsgAll); CB_Format.SelectedIndex = CB_Require.SelectedIndex = 0; toolTip1.SetToolTip(CB_Property, MsgBEToolTipPropName); toolTip2.SetToolTip(L_PropType, MsgBEToolTipPropType); toolTip3.SetToolTip(L_PropValue, MsgBEToolTipPropValue); }
public SAV_HoneyTree(SAV4Sinnoh sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (SAV4Sinnoh)(Origin = sav).Clone(); Table = SAV switch { SAV4DP => HoneyTreeValue.TableDP, SAV4Pt => HoneyTreeValue.TablePt, _ => throw new Exception(), }; // Get Munchlax tree for this savegame in screen MunchlaxTrees = SAV.GetMunchlaxTrees().ToArray(); const string sep = "- "; L_Tree0.Text = string.Join(Environment.NewLine, MunchlaxTrees.Select(z => sep + CB_TreeList.Items[z])); CB_TreeList.SelectedIndex = 0; }
public SAV_SimplePokedex(SaveFile sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (Origin = sav).Clone(); seen = new bool[SAV.MaxSpeciesID]; caught = new bool[SAV.MaxSpeciesID]; var speciesNames = GameInfo.Strings.specieslist; for (int i = 0; i < seen.Length; i++) { int species = i + 1; seen[i] = SAV.GetSeen(species); caught[i] = SAV.GetCaught(species); CLB_Seen.Items.Add(speciesNames[species]); CLB_Caught.Items.Add(speciesNames[species]); CLB_Seen.SetItemChecked(i, seen[i]); CLB_Caught.SetItemChecked(i, caught[i]); } initialized = true; }
public SAV_OPower(ISaveBlock6Main sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); Origin = (SaveFile)sav; SAV = Origin.Clone(); Data = ((ISaveBlock6Main)SAV).OPower; Current = Types[0]; foreach (var z in Types) { CB_Type.Items.Add(z.ToString()); } CB_Type.SelectedIndex = 0; CHK_Master.Checked = Data.MasterFlag; LoadCurrent(); CB_Type.SelectedIndexChanged += (s, e) => { SaveCurrent(); LoadCurrent(); }; B_ClearAll.Click += (s, e) => { Data.ClearAll(); LoadCurrent(); }; B_GiveAll.Click += (s, e) => { Data.UnlockRegular(); LoadCurrent(); }; B_GiveAllMAX.Click += (s, e) => { Data.UnlockAll(); LoadCurrent(); }; }
public KChart(SaveFile sav) { InitializeComponent(); Icon = Properties.Resources.Icon; WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = sav; Array.Resize(ref species, SAV.Personal.TableLength); var forms = SAV.Personal.GetFormList(species, SAV.MaxSpeciesID); species = SAV.Personal.GetPersonalEntryList(forms, species, SAV.MaxSpeciesID, out baseForm, out formVal); DGV.Rows.Clear(); for (int i = 1; i < species.Length; i++) { PopEntry(i); } DGV.DoubleBuffered(true); DGV.Sort(DGV.Columns[0], ListSortDirection.Ascending); }
public SAV_Trainer8b(SAV8BS sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (SAV8BS)(Origin = sav).Clone(); Loading = true; if (Main.Unicode) { TB_OTName.Font = TB_Rival.Font = FontUtil.GetPKXFont(); } B_MaxCash.Click += (_, _) => MT_Money.Text = SAV.MaxMoney.ToString(); CB_Gender.Items.Clear(); CB_Gender.Items.AddRange(Main.GenderSymbols.Take(2).ToArray()); // m/f depending on unicode selection GetComboBoxes(); GetTextBoxes(); TrainerStats.LoadRecords(SAV, Records.RecordList_8b); Loading = false; }
public SAV_Trainer8(SaveFile sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (SAV8SWSH)(Origin = sav).Clone(); //Loading = true; if (Main.Unicode) { TB_OTName.Font = TB_TrainerCardName.Font = FontUtil.GetPKXFont(); } B_MaxCash.Click += (sender, e) => MT_Money.Text = SAV.MaxMoney.ToString(); B_MaxWatt.Click += (sender, e) => MT_Watt.Text = MyStatus8.MaxWatt.ToString(); CB_Gender.Items.Clear(); CB_Gender.Items.AddRange(Main.GenderSymbols.Take(2).ToArray()); // m/f depending on unicode selection TrainerStats.LoadRecords(SAV, Records.RecordList_8); NUD_BP.Value = Math.Min(SAV.Misc.BP, 9999); GetComboBoxes(); GetTextBoxes(); GetMiscValues(); TC_Editor.TabPages.Remove(Tab_BadgeMap); // needs more work ChangeTitleScreenIndex(this, EventArgs.Empty); ChangeTrainerCardIndex(this, EventArgs.Empty); if (SAV.SaveRevision == 0) { B_CollectDiglett.Visible = false; } //Loading = false; }
public TrashEditor(TextBoxBase TB_NN, Span <byte> raw, SaveFile sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = sav; FinalString = TB_NN.Text; Raw = FinalBytes = raw.ToArray(); editing = true; if (raw.Length != 0) { AddTrashEditing(raw.Length); } var f = FontUtil.GetPKXFont(); AddCharEditing(f); TB_Text.MaxLength = TB_NN.MaxLength; TB_Text.Text = TB_NN.Text; TB_Text.Font = f; if (FLP_Characters.Controls.Count == 0) { FLP_Characters.Visible = false; FLP_Hex.Height *= 2; } else if (FLP_Hex.Controls.Count == 0) { FLP_Characters.Location = FLP_Hex.Location; FLP_Characters.Height *= 2; } editing = false; CenterToParent(); }
private ErrorWindow(string lang) : this() { WinFormsUtil.TranslateInterface(this, lang); }
public SAV_PokedexResearchEditorLA(SAV8LA sav, int species, int dexIdx, IReadOnlyList <string> tasks, IReadOnlyList <string> timeTasks) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (SAV8LA)(Origin = sav).Clone(); Dex = SAV.Blocks.PokedexSave; Species = species; L_Species.Text = GameInfo.Strings.Species[species]; #region Declare Arrays Label[] taskLabels = { L_Catch, L_CatchAlpha, L_CatchLarge, L_CatchSmall, L_CatchHeavy, L_CatchLight, L_CatchAtTime, L_CatchSleeping, L_CatchInAir, L_CatchNotSpotted, L_UseMove0, L_UseMove1, L_UseMove2, L_UseMove3, L_DefeatWithMove0, L_DefeatWithMove1, L_DefeatWithMove2, L_Defeat, L_StrongStyle, L_AgileStyle, L_Evolve, L_GiveFood, L_Stun, L_Scare, L_Lure, L_LeapTrees, L_LeapLeaves, L_LeapSnow, L_LeapOre, L_LeapTussocks, }; TaskNUPs = new[] { NUP_Catch, NUP_CatchAlpha, NUP_CatchLarge, NUP_CatchSmall, NUP_CatchHeavy, NUP_CatchLight, NUP_CatchAtTime, NUP_CatchSleeping, NUP_CatchInAir, NUP_CatchNotSpotted, NUP_UseMove0, NUP_UseMove1, NUP_UseMove2, NUP_UseMove3, NUP_DefeatWithMove0, NUP_DefeatWithMove1, NUP_DefeatWithMove2, NUP_Defeat, NUP_StrongStyle, NUP_AgileStyle, NUP_Evolve, NUP_GiveFood, NUP_Stun, NUP_Scare, NUP_Lure, NUP_LeapTrees, NUP_LeapLeaves, NUP_LeapSnow, NUP_LeapOre, NUP_LeapTussocks, }; TaskTypes = new[] { Catch, CatchAlpha, CatchLarge, CatchSmall, CatchHeavy, CatchLight, CatchAtTime, CatchSleeping, CatchInAir, CatchNotSpotted, UseMove, UseMove, UseMove, UseMove, DefeatWithMoveType, DefeatWithMoveType, DefeatWithMoveType, Defeat, UseStrongStyleMove, UseAgileStyleMove, Evolve, GiveFood, StunWithItems, ScareWithScatterBang, LureWithPokeshiDoll, LeapFromTrees, LeapFromLeaves, LeapFromSnow, LeapFromOre, LeapFromTussocks, }; TaskIndexes = new[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 0, 1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; TaskParameters = new int[TaskIndexes.Length]; InitializeTaskParameters(dexIdx); #endregion // Initialize labels/values for (int i = 0; i < taskLabels.Length; i++) { taskLabels[i].Text = PokedexResearchTask8aExtensions.GetGenericTaskLabelString(TaskTypes[i], TaskIndexes[i], TaskParameters[i], tasks, timeTasks); Dex.GetResearchTaskProgressByForce(Species, TaskTypes[i], TaskIndexes[i], out var curValue); TaskNUPs[i].Value = curValue; } // Detect empty WasEmpty = IsEmpty(); }
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; }
public SAV_SimpleTrainer(SaveFile sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (Origin = sav).Clone(); Loading = true; cba = new[] { CHK_1, CHK_2, CHK_3, CHK_4, CHK_5, CHK_6, CHK_7, CHK_8 }; TB_OTName.MaxLength = SAV.OTLength; B_MaxCash.Click += (sender, e) => MT_Money.Text = SAV.MaxMoney.ToString(); B_MaxCoins.Click += (sender, e) => MT_Coins.Text = SAV.MaxCoins.ToString(); MT_Money.Mask = "".PadRight((int)Math.Floor(Math.Log10(SAV.MaxMoney) + 1), '0'); MT_Coins.Mask = "".PadRight((int)Math.Floor(Math.Log10(SAV.MaxCoins) + 1), '0'); CB_Gender.Items.Clear(); CB_Gender.Items.AddRange(Main.GenderSymbols.Take(2).ToArray()); // m/f depending on unicode selection L_SID.Visible = MT_SID.Visible = SAV.Generation > 2; L_Coins.Visible = B_MaxCoins.Visible = MT_Coins.Visible = SAV.Generation < 3; CB_Gender.Visible = SAV.Generation > 1; L_PikaFriend.Visible = MT_PikaFriend.Visible = L_PikaBeach.Visible = MT_PikaBeach.Visible = SAV.Generation == 1; TB_OTName.Text = SAV.OT; CB_Gender.SelectedIndex = SAV.Gender; MT_TID.Text = SAV.TID.ToString("00000"); MT_SID.Text = SAV.SID.ToString("00000"); MT_Money.Text = SAV.Money.ToString(); MT_Hours.Text = SAV.PlayedHours.ToString(); MT_Minutes.Text = SAV.PlayedMinutes.ToString(); MT_Seconds.Text = SAV.PlayedSeconds.ToString(); int badgeval = 0; if (SAV is SAV1 sav1) { MT_Coins.Text = sav1.Coin.ToString(); badgeval = sav1.Badges; L_Started.Visible = L_Fame.Visible = false; CAL_AdventureStartDate.Visible = CAL_HoFDate.Visible = false; CAL_AdventureStartTime.Visible = CAL_HoFTime.Visible = false; GB_Map.Visible = false; GB_Options.Visible = true; CB_BattleStyle.Items.AddRange(new[] { "Switch", "Set" }); CB_SoundType.Items.AddRange(new[] { "Mono", "Stereo", "Left", "Right" }); CB_TextSpeed.Items.AddRange(new[] { "0 (Instant)", "1 (Fast)", "2", "3 (Normal)", "4", "5 (Slow)", "6", "7" }); CHK_BattleEffects.Checked = sav1.BattleEffects; CB_BattleStyle.SelectedIndex = sav1.BattleStyleSwitch ? 0 : 1; CB_SoundType.SelectedIndex = sav1.Sound; CB_TextSpeed.SelectedIndex = sav1.TextSpeed; MT_PikaFriend.Text = sav1.PikaFriendship.ToString(); MT_PikaBeach.Text = sav1.PikaBeachScore.ToString(); if (!sav1.Version.Contains(GameVersion.YW)) { L_PikaFriend.Visible = MT_PikaFriend.Visible = false; L_PikaBeach.Visible = MT_PikaBeach.Visible = false; CB_SoundType.Visible = LBL_SoundType.Visible = false; } } if (SAV is SAV2 sav2) { MT_Coins.Text = sav2.Coin.ToString(); L_Started.Visible = L_Fame.Visible = false; CAL_AdventureStartDate.Visible = CAL_HoFDate.Visible = false; CAL_AdventureStartTime.Visible = CAL_HoFTime.Visible = false; GB_Map.Visible = false; GB_Options.Visible = true; CB_BattleStyle.Items.AddRange(new[] { "Switch", "Set" }); CB_SoundType.Items.AddRange(new[] { "Mono", "Stereo" }); CB_TextSpeed.Items.AddRange(new[] { "0 (Instant)", "1 (Fast)", "2", "3 (Normal)", "4", "5 (Slow)", "6", "7" }); CHK_BattleEffects.Checked = sav2.BattleEffects; CB_BattleStyle.SelectedIndex = sav2.BattleStyleSwitch ? 0 : 1; CB_SoundType.SelectedIndex = sav2.Sound > 0 ? 1 : 0; CB_TextSpeed.SelectedIndex = sav2.TextSpeed; badgeval = sav2.Badges; cba = new[] { CHK_1, CHK_2, CHK_3, CHK_4, CHK_6, CHK_5, CHK_7, CHK_8, CHK_H1, CHK_H2, CHK_H3, CHK_H4, CHK_H5, CHK_H6, CHK_H7, CHK_H8 }; } if (SAV is SAV3 sav3) { GB_Map.Visible = false; badgeval = sav3.Badges; L_Started.Visible = L_Fame.Visible = false; CAL_AdventureStartDate.Visible = CAL_HoFDate.Visible = false; CAL_AdventureStartTime.Visible = CAL_HoFTime.Visible = false; } if (SAV is SAV3Colosseum or SAV3XD) { GB_Map.Visible = false; GB_Badges.Visible = false; L_Started.Visible = L_Fame.Visible = false; CAL_AdventureStartDate.Visible = CAL_HoFDate.Visible = false; CAL_AdventureStartTime.Visible = CAL_HoFTime.Visible = false; GB_Adventure.Visible = false; return; } if (SAV is SAV4 sav4) { NUD_M.Value = sav4.M; NUD_X.Value = sav4.X; NUD_Z.Value = sav4.Z; NUD_Y.Value = sav4.Y; badgeval = sav4.Badges; if (sav4 is SAV4HGSS hgss) { badgeval |= hgss.Badges16 << 8; cba = cba.Concat(new[] { CHK_H1, CHK_H2, CHK_H3, CHK_H4, CHK_H5, CHK_H6, CHK_H7, CHK_H8 }).ToArray(); } } else if (SAV is SAV5 s) { foreach (var control in new Control[] { L_Coins, B_MaxCoins, MT_Coins }) { var pos = control.Location; GB_Badges.Controls.Add(control); control.Location = pos; control.Visible = true; } L_Coins.Text = "BP"; // no translation boo MT_Coins.Text = s.BattleSubway.BP.ToString(); var pd = s.PlayerData; NUD_M.Value = pd.M; NUD_X.Value = pd.X; NUD_Z.Value = pd.Z; NUD_Y.Value = pd.Y; badgeval = s.Misc.Badges; } for (int i = 0; i < cba.Length; i++) { cba[i].Visible = true; cba[i].Checked = (badgeval & (1 << i)) != 0; } DateUtil.GetDateTime2000(SAV.SecondsToStart, out var date, out var time); CAL_AdventureStartDate.Value = date; CAL_AdventureStartTime.Value = time; DateUtil.GetDateTime2000(SAV.SecondsToFame, out date, out time); CAL_HoFDate.Value = date; CAL_HoFTime.Value = time; Loading = false; }
public SAV_MailBox(SaveFile sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = (Origin = sav).Clone(); Gen = SAV.Generation; p = SAV.PartyData; editing = true; Messages = new[] { new[] { NUD_Message00, NUD_Message01, NUD_Message02, NUD_Message03 }, new[] { NUD_Message10, NUD_Message11, NUD_Message12, NUD_Message13 }, new[] { NUD_Message20, NUD_Message21, NUD_Message22, NUD_Message23 }, }; PKMLabels = new[] { L_PKM1, L_PKM2, L_PKM3, L_PKM4, L_PKM5, L_PKM6 }; PKMHeldItems = new[] { L_HeldItem1, L_HeldItem2, L_HeldItem3, L_HeldItem4, L_HeldItem5, L_HeldItem6 }; PKMNUDs = new[] { NUD_MailID1, NUD_MailID2, NUD_MailID3, NUD_MailID4, NUD_MailID5, NUD_MailID6 }; AppearPKMs = new[] { CB_AppearPKM1, CB_AppearPKM2, CB_AppearPKM3 }; Miscs = new[] { NUD_Misc1, NUD_Misc2, NUD_Misc3 }; NUD_BoxSize.Visible = L_BoxSize.Visible = Gen == 2; GB_MessageTB.Visible = Gen == 2; GB_MessageNUD.Visible = Gen != 2; Messages[0][3].Visible = Messages[1][3].Visible = Messages[2][3].Visible = Gen is 4 or 5; NUD_AuthorSID.Visible = Gen != 2; Label_OTGender.Visible = CB_AuthorLang.Visible = CB_AuthorVersion.Visible = Gen is 4 or 5; L_AppearPKM.Visible = AppearPKMs[0].Visible = Gen != 5; AppearPKMs[1].Visible = AppearPKMs[2].Visible = Gen == 4; NUD_MessageEnding.Visible = Gen == 5; L_MiscValue.Visible = NUD_Misc1.Visible = NUD_Misc2.Visible = NUD_Misc3.Visible = Gen == 5; for (int i = p.Count; i < 6; i++) { PKMNUDs[i].Visible = PKMLabels[i].Visible = PKMHeldItems[i].Visible = false; } if (Gen != 3) { for (int i = 0; i < PKMNUDs.Length; i++) { PKMNUDs[i].Value = i; PKMNUDs[i].Enabled = false; } } switch (SAV) { case SAV2 sav2: m = new Mail2[6 + 10]; for (int i = 0; i < m.Length; i++) { m[i] = new Mail2(sav2, i); } NUD_BoxSize.Value = SAV.Data[0x834]; MailItemID = new[] { 0x9E, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD }; PartyBoxCount = 6; break; case SAV3 sav3: m = new Mail3[6 + 10]; for (int i = 0; i < m.Length; i++) { m[i] = sav3.GetMail(i); } MailItemID = new[] { 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132 }; PartyBoxCount = 6; break; case SAV4 sav4: m = new Mail4[p.Count + 20]; for (int i = 0; i < p.Count; i++) { m[i] = new Mail4(((PK4)p[i]).HeldMail.ToArray()); } for (int i = p.Count, j = 0; i < m.Length; i++, j++) { m[i] = sav4.GetMail(j); } var l4 = (Mail4)m[^ 1];
public SAV_Misc4(SAV4 sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); int ofsFlag; SAV = (SAV4)(Origin = sav).Clone(); switch (SAV.Version) { case GameVersion.D or GameVersion.P or GameVersion.DP: ofsFlag = 0xFDC; ofsBP = 0x65F8; ofsUGFlagCount = 0x3A60; L_CurrentMap.Visible = CB_UpgradeMap.Visible = false; GB_Prints.Visible = GB_Prints.Enabled = GB_Hall.Visible = GB_Hall.Enabled = GB_Castle.Visible = GB_Castle.Enabled = false; BFF = new[] { new[] { 0, 1, 0x5FCA, 0x04, 0x6601 } }; break; case GameVersion.Pt: ofsFlag = 0xFEC; ofsBP = 0x7234; ofsUGFlagCount = 0x3CE8; L_CurrentMap.Visible = CB_UpgradeMap.Visible = false; ofsPrints = 0xE4A; BFF = new[] { new[] { 0, 1, 0x68E0, 0x04, 0x723D }, new[] { 1, 0, 0x68F4, 0x10, 0x7EF8 }, new[] { 0, 0, 0x6924, 0x18, 0x7EFC }, new[] { 2, 0, 0x696C, 0x10, 0x7F00 }, new[] { 0, 0, 0x699C, 0x04, 0x7F04 }, }; Hall = FetchHallBlock(SAV, 0x2820); break; case GameVersion.HG or GameVersion.SS or GameVersion.HGSS: ofsFlag = 0x10C4; ofsBP = 0x5BB8; L_UGFlags.Visible = NUD_UGFlags.Visible = false; GB_Poketch.Visible = false; ofsMap = 0xBAE7; ofsPrints = 0xE7E; BFF = new[] { // { BFV, BFT, addr, 1BFTlen, checkBit new[] { 0, 1, 0x5264, 0x04, 0x5BC1 }, new[] { 1, 0, 0x5278, 0x10, 0x687C }, new[] { 0, 0, 0x52A8, 0x18, 0x6880 }, new[] { 2, 0, 0x52F0, 0x10, 0x6884 }, new[] { 0, 0, 0x5320, 0x04, 0x6888 }, }; Hall = FetchHallBlock(SAV, 0x230C); break; default: return; } ofsFly = ofsFlag + 0x136; ReadMain(); ReadBattleFrontier(); if (SAV is SAV4Sinnoh s) { TC_Misc.Controls.Remove(TAB_Walker); poffinCase4Editor1.Initialize(s); TC_Misc.Controls.Remove(Tab_PokeGear); } else { pokeGear4Editor1.Initialize((SAV4HGSS)SAV); TC_Misc.Controls.Remove(Tab_Poffins); } }
public SAV_Database(PKMEditor f1, SAVEditor saveditor) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); SAV = saveditor.SAV; BoxView = saveditor; PKME_Tabs = f1; // Preset Filters to only show PKM available for loaded save CB_FormatComparator.SelectedIndex = 3; // <= var grid = DatabasePokeGrid; var smallWidth = grid.Width; var smallHeight = grid.Height; grid.InitializeGrid(6, 11, SpriteUtil.Spriter); grid.SetBackground(Resources.box_wp_clean); var newWidth = grid.Width; var newHeight = grid.Height; var wdelta = newWidth - smallWidth; if (wdelta != 0) { Width += wdelta; } var hdelta = newHeight - smallHeight; if (hdelta != 0) { Height += hdelta; } PKXBOXES = grid.Entries.ToArray(); // Enable Scrolling when hovered over foreach (var slot in PKXBOXES) { // Enable Click slot.MouseClick += (sender, e) => { if (sender == null) { return; } switch (ModifierKeys) { case Keys.Control: ClickView(sender, e); break; case Keys.Alt: ClickDelete(sender, e); break; case Keys.Shift: ClickSet(sender, e); break; } }; slot.ContextMenuStrip = mnu; if (Main.Settings.Hover.HoverSlotShowText) { slot.MouseEnter += (o, args) => ShowHoverTextForSlot(slot, args); } } Counter = L_Count.Text; Viewed = L_Viewed.Text; L_Viewed.Text = string.Empty; // invisible for now PopulateComboBoxes(); // Load Data B_Search.Enabled = false; L_Count.Text = "Loading..."; var task = new Task(LoadDatabase); task.ContinueWith(z => { if (!z.IsFaulted) { return; } Invoke((MethodInvoker)(() => L_Count.Text = "Failed.")); if (z.Exception == null) { return; } WinFormsUtil.Error("Loading database failed.", z.Exception.InnerException ?? new Exception(z.Exception.Message)); }); task.Start(); Menu_SearchSettings.DropDown.Closing += (sender, e) => { if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked) { e.Cancel = true; } }; CB_Format.Items[0] = MsgAny; CenterToParent(); }