private void LegalizeActive() { var pk = PKMEditor.PreparePKM(); var la = new LegalityAnalysis(pk); if (la.Valid) { return; // already valid, don't modify it } var sav = SaveFileEditor.SAV; var result = sav.Legalize(pk); // let's double check la = new LegalityAnalysis(result); if (!la.Valid) { var res = WinFormsUtil.ALMError("Unable to make the Active Pokemon legal!", "Please refer to the wiki by clicking on the GitHub button for further help!"); if (res == DialogResult.Yes) { Process.Start("https://discord.gg/tDMvSRv"); } else if (res == DialogResult.No) { Process.Start("https://github.com/architdate/PKHeX-Plugins/wiki/Getting-Started-with-Auto-Legality-Mod"); } return; } PKMEditor.PopulateFields(result); WinFormsUtil.Alert("Legalized Active Pokemon!"); }
// Important Events private void ClickView(object sender, EventArgs e) { var pb = WinFormsUtil.GetUnderlyingControl <PictureBox>(sender); int index = Array.IndexOf(PKXBOXES, pb); if (index >= RES_MAX) { System.Media.SystemSounds.Exclamation.Play(); return; } index += SCR_Box.Value * RES_MIN; if (index >= Results.Count) { System.Media.SystemSounds.Exclamation.Play(); return; } var enc = Results[index]; var pk = enc.ConvertToPKM(SAV); pk.RefreshChecksum(); PKME_Tabs.PopulateFields(pk, false); slotSelected = index; slotColor = SpriteUtil.Spriter.View; FillPKXBoxes(SCR_Box.Value); }
private bool LoadPKM(PKM pk) { pk = PKMConverter.ConvertToType(pk, SaveFileEditor.SAV.PKMType, out _); if (pk == null) { return(false); } PKMEditor.PopulateFields(pk); return(true); }
// Important Events private void ClickView(object sender, EventArgs e) { int index = GetSenderIndex(sender); if (index < 0) { return; } PKME_Tabs.PopulateFields(Results[index].ConvertToPKM(SAV), false); slotSelected = index; slotColor = Properties.Resources.slotView; UpdateSlotColor(SCR_Box.Value); L_Viewed.Text = string.Format(Viewed, Results[index].FileName); }
// Important Events private void ClickView(object sender, EventArgs e) { sender = WinFormsUtil.GetUnderlyingControl(sender); int index = Array.IndexOf(PKXBOXES, sender); if (!GetShiftedIndex(ref index)) { System.Media.SystemSounds.Exclamation.Play(); return; } PKME_Tabs.PopulateFields(Results[index], false); slotSelected = index; slotColor = Properties.Resources.slotView; FillPKXBoxes(SCR_Box.Value); L_Viewed.Text = string.Format(Viewed, Results[index].Identifier); }
private void RandPIDCurrent(string flag) { var pkm = PKMEditor.PreparePKM(); var sav = SaveFileEditor.SAV; var result = sav.SetPIDCurrent(pkm, flag); LegalityAnalysis la = new LegalityAnalysis(result); if (!la.Valid) { WinFormUtils.Alert($"Can not Set Current Pokemon to {flag}!"); return; } PKMEditor.PopulateFields(result); WinFormUtils.Alert($"Set Current Pokemon to {flag}!"); }
private void AutoEggCurrent() { var pkm = PKMEditor.PreparePKM(); if (pkm.IsEgg) { return; // already egg, should not modify it } var sav = SaveFileEditor.SAV; var result = sav.SetEggCurrent(pkm); // Check Null if (result == null) { WinFormUtils.Alert($"Current Pokemon should not to be an Egg!"); return; } PKMEditor.PopulateFields(result); WinFormUtils.Alert($"Set Current Pokemon to Egg!"); }
// Important Events private void ClickView(object sender, EventArgs e) { int index = GetSenderIndex(sender); if (index < 0) { return; } var pk = Results[index].ConvertToPKM(SAV); pk = PKMConverter.ConvertToType(pk, SAV.PKMType, out var c); if (pk == null) { throw new FormatException(c); // shouldn't happen } SAV.AdaptPKM(pk); PKME_Tabs.PopulateFields(pk, false); slotSelected = index; slotColor = SpriteUtil.Spriter.View; UpdateSlotColor(SCR_Box.Value); L_Viewed.Text = string.Format(Viewed, Results[index].FileName); }
// Important Events private void ClickView(object sender, EventArgs e) { sender = WinFormsUtil.GetUnderlyingControl(sender); int index = Array.IndexOf(PKXBOXES, sender); if (index >= RES_MAX) { System.Media.SystemSounds.Exclamation.Play(); return; } index += SCR_Box.Value * RES_MIN; if (index >= Results.Count) { System.Media.SystemSounds.Exclamation.Play(); return; } PKME_Tabs.PopulateFields(Results[index].ConvertToPKM(SAV), false); slotSelected = index; slotColor = Properties.Resources.slotView; FillPKXBoxes(SCR_Box.Value); }
// Important Events private void ClickView(object sender, EventArgs e) { sender = ((sender as ToolStripItem)?.Owner as ContextMenuStrip)?.SourceControl ?? sender as PictureBox; int index = Array.IndexOf(PKXBOXES, sender); if (index >= RES_MAX) { System.Media.SystemSounds.Exclamation.Play(); return; } index += SCR_Box.Value * RES_MIN; if (index >= Results.Count) { System.Media.SystemSounds.Exclamation.Play(); return; } PKME_Tabs.PopulateFields(Results[index], false); slotSelected = index; slotColor = Properties.Resources.slotView; FillPKXBoxes(SCR_Box.Value); L_Viewed.Text = string.Format(Viewed, Results[index].Identifier); }
private void LegalizeActive() { var pk = PKMEditor.PreparePKM(); var la = new LegalityAnalysis(pk); if (la.Valid) { return; // already valid, don't modify it } var sav = SaveFileEditor.SAV; var result = sav.Legalize(pk); // let's double check la = new LegalityAnalysis(result); if (!la.Valid) { WinFormsUtil.Error("Unable to make the Active Pokemon legal!"); return; } PKMEditor.PopulateFields(result); WinFormsUtil.Alert("Legalized Active Pokemon!"); }