diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 2903566c0..5c293e490 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -175,8 +175,10 @@ namespace PKHeX { var evs = pk6.EVs; int sum = evs.Sum(); + if (pk6.IsEgg && sum > 0) + return new LegalityCheck(Severity.Invalid, "Eggs cannot receive EVs."); if (sum == 0 && pk6.Stat_Level - pk6.Met_Level > 0) - return new LegalityCheck(Severity.Fishy, "All EVs are zero, but leveled above Met Level"); + return new LegalityCheck(Severity.Fishy, "All EVs are zero, but leveled above Met Level."); if (sum == 508) return new LegalityCheck(Severity.Fishy, "2 EVs remaining."); if (sum > 510) @@ -349,6 +351,8 @@ namespace PKHeX return new LegalityCheck(Severity.Invalid, "Met Level does not match Wonder Card level."); int lvl = pk6.CurrentLevel; + if (lvl > 1 && pk6.IsEgg) + return new LegalityCheck(Severity.Invalid, "Current level for an egg is invalid."); if (lvl < pk6.Met_Level) return new LegalityCheck(Severity.Invalid, "Current level is below met level."); if ((pk6.WasEgg || EncounterMatch == null) && !Legal.getEvolutionValid(pk6) && pk6.Species != 350) @@ -365,6 +369,28 @@ namespace PKHeX List missingRibbons = new List(); List invalidRibbons = new List(); + + if (pk6.IsEgg) + { + var RibbonNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "Ribbon"); + foreach (object RibbonValue in RibbonNames.Select(RibbonName => ReflectUtil.GetValue(pk6, RibbonName))) + { + if ((RibbonValue as int?) > 0) + return new LegalityCheck(Severity.Invalid, "Eggs should not have ribbons."); + if (RibbonValue as bool? == true) + return new LegalityCheck(Severity.Invalid, "Eggs should not have ribbons."); + } + + var DistNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "DistSuperTrain"); + if (DistNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) + return new LegalityCheck(Severity.Invalid, "Distribution Super Training missions on Egg."); + + var TrainNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "SuperTrain"); + if (TrainNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) + return new LegalityCheck(Severity.Fishy, "Super Training missions on Egg."); + + return new LegalityCheck(); + } // Check Event Ribbons bool[] EventRib = @@ -420,7 +446,13 @@ namespace PKHeX invalidRibbons.Add("Battle Memory"); // Gen3/4 Battle if (missingRibbons.Count + invalidRibbons.Count == 0) + { + var DistNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "DistSuperTrain"); + if (DistNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) + return new LegalityCheck(Severity.Fishy, "Distribution Super Training missions are not released."); + return new LegalityCheck(Severity.Valid, "All ribbons accounted for."); + } string[] result = new string[2]; if (missingRibbons.Count > 0) @@ -820,6 +852,14 @@ namespace PKHeX } private LegalityCheck verifyMisc() { + if (pk6.IsEgg) + { + if (new[] { pk6.Move1_PPUps, pk6.Move2_PPUps, pk6.Move3_PPUps, pk6.Move4_PPUps }.Any(ppup => ppup > 0)) + return new LegalityCheck(Severity.Invalid, "Cannot apply PP Ups to an Egg."); + if (pk6.CNTs.Any(stat => stat > 0)) + return new LegalityCheck(Severity.Invalid, "Cannot increase Contest Stats of an Egg."); + } + if (pk6.Gen6 && Encounter.Valid && EncounterType == typeof(WC6) ^ pk6.FatefulEncounter) { if (EncounterType == typeof(EncounterStatic) && pk6.Species == 386) // Deoxys Matched @ Sky Pillar diff --git a/PKHeX/MainWindow/Main.Designer.cs b/PKHeX/MainWindow/Main.Designer.cs index 91aaf0b79..3213eec8f 100644 --- a/PKHeX/MainWindow/Main.Designer.cs +++ b/PKHeX/MainWindow/Main.Designer.cs @@ -363,6 +363,8 @@ this.mnuLSave = new System.Windows.Forms.ToolStripMenuItem(); this.PB_Legal = new System.Windows.Forms.PictureBox(); this.L_UpdateAvailable = new System.Windows.Forms.LinkLabel(); + this.L_MetTimeOfDay = new System.Windows.Forms.Label(); + this.CB_MetTimeOfDay = new System.Windows.Forms.ComboBox(); this.tabMain.SuspendLayout(); this.Tab_Main.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).BeginInit(); @@ -1042,6 +1044,8 @@ // Tab_Met // this.Tab_Met.AllowDrop = true; + this.Tab_Met.Controls.Add(this.L_MetTimeOfDay); + this.Tab_Met.Controls.Add(this.CB_MetTimeOfDay); this.Tab_Met.Controls.Add(this.CHK_AsEgg); this.Tab_Met.Controls.Add(this.CHK_Fateful); this.Tab_Met.Controls.Add(this.GB_EggConditions); @@ -4607,6 +4611,33 @@ this.L_UpdateAvailable.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.L_UpdateAvailable.Visible = false; // + // L_MetTimeOfDay + // + this.L_MetTimeOfDay.Location = new System.Drawing.Point(25, 165); + this.L_MetTimeOfDay.Name = "L_MetTimeOfDay"; + this.L_MetTimeOfDay.Size = new System.Drawing.Size(77, 13); + this.L_MetTimeOfDay.TabIndex = 10; + this.L_MetTimeOfDay.Text = "Time of Day:"; + this.L_MetTimeOfDay.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.L_MetTimeOfDay.Visible = false; + // + // CB_MetTimeOfDay + // + this.CB_MetTimeOfDay.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_MetTimeOfDay.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_MetTimeOfDay.DropDownWidth = 150; + this.CB_MetTimeOfDay.FormattingEnabled = true; + this.CB_MetTimeOfDay.Items.AddRange(new object[] { + "(None)", + "Morning", + "Day", + "Night"}); + this.CB_MetTimeOfDay.Location = new System.Drawing.Point(105, 162); + this.CB_MetTimeOfDay.Name = "CB_MetTimeOfDay"; + this.CB_MetTimeOfDay.Size = new System.Drawing.Size(122, 21); + this.CB_MetTimeOfDay.TabIndex = 11; + this.CB_MetTimeOfDay.Visible = false; + // // Main // this.AllowDrop = true; @@ -5088,6 +5119,8 @@ private System.Windows.Forms.Button B_LinkInfo; private System.Windows.Forms.Button B_CGearSkin; private System.Windows.Forms.LinkLabel L_UpdateAvailable; + private System.Windows.Forms.Label L_MetTimeOfDay; + public System.Windows.Forms.ComboBox CB_MetTimeOfDay; } } diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index fa1a54507..553e0be7d 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -169,8 +169,8 @@ namespace PKHeX public static string[] gendersymbols = { "♂", "♀", "-" }; public static string[] specieslist, movelist, itemlist, abilitylist, types, natures, forms, memories, genloc, trainingbags, trainingstage, characteristics, - encountertypelist, gamelanguages, balllist, gamelist, pokeblocks, g3items = { }; - public static string[] metRSEFRLG_00000 = { }; + encountertypelist, gamelanguages, balllist, gamelist, pokeblocks, g3items, g2items, g1items = { }; + public static string[] metGSC_00000, metRSEFRLG_00000 = { }; public static string[] metHGSS_00000, metHGSS_02000, metHGSS_03000 = { }; public static string[] metBW2_00000, metBW2_30000, metBW2_40000, metBW2_60000 = { }; public static string[] metXY_00000, metXY_30000, metXY_40000, metXY_60000 = { }; @@ -412,9 +412,12 @@ namespace PKHeX if (Set.Species < 0) { Util.Alert("Set data not found in clipboard."); return; } - if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Import this set?", Clipboard.GetText())) + if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Import this set?", Set.getText())) { return; } + if (Set.InvalidLines.Any()) + Util.Alert("Invalid lines detected:", string.Join(Environment.NewLine, Set.InvalidLines)); + // Set Species & Nickname CB_Species.SelectedValue = Set.Species; CHK_Nicknamed.Checked = Set.Nickname != null; @@ -870,24 +873,36 @@ namespace PKHeX TB_AbilityNumber.Visible = SAV.Generation >= 6 && DEV_Ability.Enabled; CB_Ability.Visible = !DEV_Ability.Enabled && SAV.Generation >= 3; - GB_ExtraBytes.Visible = SAV.Generation > 1; + GB_ExtraBytes.Visible = SAV.Generation > 2; GB_Markings.Visible = SAV.Generation > 2; Label_HeldItem.Visible = CB_HeldItem.Visible = SAV.Generation > 1; - Label_Total.Visible = TB_IVTotal.Visible = TB_EVTotal.Visible = L_Potential.Visible = - Label_HiddenPowerPrefix.Visible = CB_HPType.Visible = SAV.Generation > 1; - Label_CharacteristicPrefix.Visible = L_Characteristic.Visible = SAV.Generation > 1; + Label_Total.Visible = TB_IVTotal.Visible = TB_EVTotal.Visible = L_Potential.Visible = SAV.Generation > 2; + Label_HiddenPowerPrefix.Visible = CB_HPType.Visible = SAV.Generation > 1; + CB_HPType.Enabled = CB_Form.Enabled = SAV.Generation > 2; + Label_CharacteristicPrefix.Visible = L_Characteristic.Visible = SAV.Generation > 2; Label_ContestStats.Visible = Label_Cool.Visible = Label_Tough.Visible = Label_Smart.Visible = Label_Sheen.Visible = Label_Beauty.Visible = Label_Cute.Visible = TB_Cool.Visible = TB_Tough.Visible = TB_Smart.Visible = TB_Sheen.Visible = TB_Beauty.Visible = TB_Cute.Visible = Label_Nature.Visible = CB_Nature.Visible = Label_Language.Visible = CB_Language.Visible = Label_Ability.Visible = - Label_Friendship.Visible = Label_HatchCounter.Visible = TB_Friendship.Visible = BTN_RerollPID.Visible = - Label_PID.Visible = TB_PID.Visible = Label_SID.Visible = TB_SID.Visible = SAV.Generation >= 3; + BTN_RerollPID.Visible = Label_PID.Visible = TB_PID.Visible = Label_SID.Visible = TB_SID.Visible = SAV.Generation >= 3; + Label_Friendship.Visible = Label_HatchCounter.Visible = TB_Friendship.Visible = SAV.Generation >= 2; // Met Tab - CHK_Fateful.Visible = Label_OriginGame.Visible = Label_Ball.Visible = Label_MetLevel.Visible = - CB_MetLocation.Visible = Label_MetLocation.Visible = SAV.Generation > 2 || (SAV.Version == GameVersion.GSC); - CB_GameOrigin.Visible = CB_Ball.Visible = TB_MetLevel.Visible = SAV.Generation > 2; + CHK_Fateful.Visible = Label_OriginGame.Visible = Label_Ball.Visible = + CB_Ball.Visible = CB_GameOrigin.Visible = SAV.Generation > 2; + Label_MetLocation.Visible = CB_MetLocation.Visible = Label_MetLevel.Visible = TB_MetLevel.Visible = Label_OTGender.Visible = + SAV.Generation > 1; + + L_MetTimeOfDay.Visible = CB_MetTimeOfDay.Visible = SAV.Generation == 2; + + if (SAV.Generation == 2) + { + var met_list = getLocationList(SAV.Version, SAV.Generation, egg: false); + CB_MetLocation.DisplayMember = "Text"; + CB_MetLocation.ValueMember = "Value"; + CB_MetLocation.DataSource = new BindingSource(met_list, null); + } CHK_Infected.Visible = CHK_Cured.Visible = SAV.Generation >= 3; @@ -896,12 +911,11 @@ namespace PKHeX CHK_IsEgg.Visible = Label_Gender.Visible = SAV.Generation > 1; - Label_OTGender.Visible = SAV.Generation > 1; - if (1 <= sav.Generation && sav.Generation <= 2) + if (sav.Generation == 1) { Label_SPD.Visible = TB_SPDEV.Visible = TB_SPDIV.Visible = Stat_SPD.Visible = false; - Label_SPA.Text = "Spc"; + Label_SPA.Text = "Spc:"; TB_HPIV.ReadOnly = true; MaskedTextBox[] evControls = { TB_SPAEV, TB_HPEV, TB_ATKEV, TB_DEFEV, TB_SPEEV, TB_SPDEV }; foreach (var ctrl in evControls) @@ -914,10 +928,28 @@ namespace PKHeX ctrl.Location = new Point(173, ctrl.Location.Y); Label_Stats.Location = new Point(168, Label_Stats.Location.Y); } + else if (sav.Generation == 2) + { + Label_SPD.Visible = TB_SPDEV.Visible = TB_SPDIV.Visible = Stat_SPD.Visible = true; + Label_SPA.Text = "SpA:"; + TB_SPDEV.ReadOnly = TB_SPDIV.ReadOnly = true; + TB_HPIV.ReadOnly = true; + MaskedTextBox[] evControls = { TB_SPAEV, TB_HPEV, TB_ATKEV, TB_DEFEV, TB_SPEEV, TB_SPDEV }; + foreach (var ctrl in evControls) + { + ctrl.Mask = "00000"; + ctrl.Size = new Size(37, 20); + } + Control[] statControls = { Stat_HP, Stat_ATK, Stat_DEF, Stat_SPA, Stat_SPD, Stat_SPE }; + foreach (Control ctrl in statControls) + ctrl.Location = new Point(173, ctrl.Location.Y); + Label_Stats.Location = new Point(168, Label_Stats.Location.Y); + } else { Label_SPD.Visible = TB_SPDEV.Visible = TB_SPDIV.Visible = Stat_SPD.Visible = true; - Label_SPA.Text = "SpA"; + Label_SPA.Text = "SpA:"; + TB_SPDEV.ReadOnly = TB_SPDIV.ReadOnly = false; TB_HPIV.ReadOnly = false; MaskedTextBox[] evControls = { TB_SPAEV, TB_HPEV, TB_ATKEV, TB_DEFEV, TB_SPEEV, TB_SPDEV }; foreach (var ctrl in evControls) @@ -941,6 +973,11 @@ namespace PKHeX getPKMfromFields = preparePK1; extraBytes = new byte[] {}; break; + case 2: + getFieldsfromPKM = populateFieldsPK2; + getPKMfromFields = preparePK2; + extraBytes = new byte[] { }; + break; case 3: getFieldsfromPKM = populateFieldsPK3; getPKMfromFields = preparePK3; @@ -970,7 +1007,7 @@ namespace PKHeX bool init = fieldsInitialized; fieldsInitialized = false; populateFilteredDataSources(); - populateFields((pkm.Format != SAV.Generation || SAV.Generation == 1) ? SAV.BlankPKM : pk); + populateFields((pkm.Format != SAV.Generation || SAV.Generation < 3) ? SAV.BlankPKM : pk); fieldsInitialized |= init; // SAV Specific Limits @@ -1046,7 +1083,10 @@ namespace PKHeX // Past Generation strings g3items = Util.getStringList("ItemsG3", "en"); + g2items = Util.getStringList("ItemsG2", "en"); + g1items = Util.getStringList("ItemsG1", "en"); metRSEFRLG_00000 = Util.getStringList("rsefrlg_00000", "en"); + metGSC_00000 = Util.getStringList("gsc_00000", "en"); // Current Generation strings string l = curlanguage; @@ -1077,7 +1117,14 @@ namespace PKHeX puffs = Util.getStringList("puff", l); } + // Gen4 Mail names not stored in future games. No clever solution like for HM's, so improvise. + for (int i = 137; i <= 148; i++) + itemlist[i] = $"Mail #{i-137+1} (G4)"; + // Fix Item Names (Duplicate entries) + int len = itemlist[425].Length; + itemlist[426] = itemlist[425].Substring(0, len-1) + (char)(itemlist[425][len-1]+1) + " (G4)"; + itemlist[427] = itemlist[425].Substring(0, len-1) + (char)(itemlist[425][len-1]+2) + " (G4)"; itemlist[456] += " (HG/SS)"; // S.S. Ticket itemlist[736] += " (OR/AS)"; // S.S. Ticket itemlist[463] += " (DPPt)"; // Storage Key @@ -1211,9 +1258,9 @@ namespace PKHeX #region Met Locations // Gen 2 { - var met_list = Util.getCBList(metRSEFRLG_00000, Enumerable.Range(0, 0x5F).ToArray()); - met_list = Util.getOffsetCBList(met_list, metRSEFRLG_00000, 00000, new[] { 253, 254, 255 }); - metGen2 = null; + var met_list = Util.getCBList(metGSC_00000, Enumerable.Range(0, 0x5F).ToArray()); + met_list = Util.getOffsetCBList(met_list, metGSC_00000, 00000, new[] { 0x7E, 0x7F }); + metGen2 = met_list; } // Gen 3 { @@ -1269,6 +1316,8 @@ namespace PKHeX string[] items = itemlist; if (SAV.Generation == 3) items = g3items; + if (SAV.Generation == 2) + items = g2items; ItemDataSource = Util.getCBList(items, (HaX ? Enumerable.Range(0, SAV.MaxItemID) : SAV.HeldItems.Select(i => (int)i)).ToArray()); CB_HeldItem.DataSource = new BindingSource(ItemDataSource.Where(i => i.Value <= SAV.MaxItemID).ToList(), null); @@ -1367,6 +1416,8 @@ namespace PKHeX bool hasForms = SAV.Personal[species].HasFormes || new[] { 201, 664, 665, 414 }.Contains(species); CB_Form.Enabled = CB_Form.Visible = Label_Form.Visible = hasForms; + if (SAV.Generation == 2) + CB_Form.Enabled = false; if (!hasForms) return; @@ -1408,7 +1459,7 @@ namespace PKHeX bool isShiny = pkm.IsShiny; // Set the Controls - BTN_Shinytize.Visible = BTN_Shinytize.Enabled = !isShiny && SAV.Generation > 2; + BTN_Shinytize.Visible = BTN_Shinytize.Enabled = !isShiny && SAV.Generation > 1; Label_IsShiny.Visible = isShiny && SAV.Generation > 1; // Refresh Markings (for Shiny Star if applicable) @@ -1705,6 +1756,17 @@ namespace PKHeX if (SAV.Generation < 3) { TB_HPIV.Text = pkm.IV_HP.ToString("00"); + TB_SPDIV.Text = TB_SPAIV.Text; + if (SAV.Generation == 2) + { + Label_Gender.Text = gendersymbols[pkm.Gender]; + Label_Gender.ForeColor = pkm.Gender == 2 + ? Label_Species.ForeColor + : (pkm.Gender == 1 ? Color.Red : Color.Blue); + CB_Form.SelectedIndex = pkm.AltForm; + setIsShiny(null); + getQuickFiller(dragout); + } } CB_HPType.SelectedValue = pkm.HPType; @@ -1741,6 +1803,9 @@ namespace PKHeX else if (sender == TB_SPAEV) pkm.EV_SPA = Util.ToInt32(TB_SPAEV.Text); else if (sender == TB_SPDEV) pkm.EV_SPD = Util.ToInt32(TB_SPDEV.Text); + if (SAV.Generation < 3) + TB_SPDEV.Text = TB_SPAEV.Text; + int evtotal = pkm.EVs.Sum(); if (evtotal > 510) // Background turns Red @@ -2053,6 +2118,13 @@ namespace PKHeX switch (Version) { + case GameVersion.GSC: + case GameVersion.GS: + case GameVersion.C: + if (SaveFormat == 2) + return metGen2; + break; + case GameVersion.CXD: if (SaveFormat == 3) return metGen3; @@ -2253,6 +2325,8 @@ namespace PKHeX { CHK_Nicknamed.Checked = false; TB_Friendship.Text = "1"; + if (SAV.Generation == 2) + pkm.IsEgg = true; // If we are an egg, it won't have a met location. CHK_AsEgg.Checked = true; @@ -2266,6 +2340,9 @@ namespace PKHeX if (!CHK_Nicknamed.Checked) updateNickname(null, null); + if (SAV.Generation == 2) + pkm.IsEgg = false; + TB_Friendship.Text = SAV.Personal[Util.getIndex(CB_Species)].BaseFriendship.ToString(); if (CB_EggLocation.SelectedIndex == 0) @@ -2277,7 +2354,7 @@ namespace PKHeX } // Display hatch counter if it is an egg, Display Friendship if it is not. Label_HatchCounter.Visible = CHK_IsEgg.Checked && SAV.Generation > 1; - Label_Friendship.Visible = !CHK_IsEgg.Checked && SAV.Generation > 2; + Label_Friendship.Visible = !CHK_IsEgg.Checked && SAV.Generation > 1; // Update image to (not) show egg. @@ -2306,7 +2383,16 @@ namespace PKHeX pkm.AltForm = CB_Form.SelectedIndex; pkm.Version = Util.getIndex(CB_GameOrigin); - pkm.setShinyPID(); + if (pkm.Format > 2) + pkm.setShinyPID(); + else + { + TB_ATKIV.Text = "15"; + TB_DEFIV.Text = "10"; + TB_SPEIV.Text = "10"; + TB_SPAIV.Text = "10"; + updateIVs(null, null); + } TB_PID.Text = pkm.PID.ToString("X8"); if (pkm.GenNumber < 6 && TB_EC.Visible) @@ -2907,7 +2993,7 @@ namespace PKHeX { SAV.setStoredSlot(SAV.BlankPKM, getPKXOffset(slot)); } else return; - SlotPictureBoxes[slot].Image = null; + getQuickFiller(SlotPictureBoxes[slot], SAV.BlankPKM); getSlotColor(slot, Properties.Resources.slotDel); } private void clickClone(object sender, EventArgs e) @@ -2944,7 +3030,7 @@ namespace PKHeX { SystemSounds.Asterisk.Play(); return; } if (typeof (PK6) != pk.GetType()) { - Util.Alert($"Checking legality of {pk.GetType()} files is not supported."); + Util.Alert($"Checking legality of {pk.GetType().Name} files is not supported."); return; } showLegality(pk as PK6, slot < 0, ModifierKeys == Keys.Control); @@ -3447,7 +3533,7 @@ namespace PKHeX new SAV_PokedexORAS().ShowDialog(); else if (SAV.XY) new SAV_PokedexXY().ShowDialog(); - else if (SAV.RBY) + else if (SAV.RBY || SAV.GSC) new SAV_SimplePokedex().ShowDialog(); } private void B_OUTPasserby_Click(object sender, EventArgs e) diff --git a/PKHeX/MainWindow/Main.resx b/PKHeX/MainWindow/Main.resx index df010947a..08b78235e 100644 --- a/PKHeX/MainWindow/Main.resx +++ b/PKHeX/MainWindow/Main.resx @@ -237,23 +237,6 @@ True - - - - iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAHhJREFUKFNjQAf/BQQ6oEzc4L+QUOh/QcH///n5jaFCmAAoKfhPUPAuWKGg4BkM - xSCroJLYMbJT/gkIzMSmCCQOVYIAQIkzKIqAzoBKoQIk98EUvoNKIQDII2AFAgKrgGwlMA3iY3gIKAAK - GigXDIB8F3QxIgADAwC7NFU/mWb72QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAHhJREFUKFNjQAf/BQQ6oEzc4L+QUOh/QcH///n5jaFCmAAoKfhPUPAuWKGg4BkM - xSCroJLYMbJT/gkIzMSmCCQOVYIAQIkzKIqAzoBKoQIk98EUvoNKIQDII2AFAgKrgGwlMA3iY3gIKAAK - GigXDIB8F3QxIgADAwC7NFU/mWb72QAAAABJRU5ErkJggg== - - True @@ -482,6 +465,347 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + + + iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHhJREFUKFNjQAf/BQQ6oEzc4L+QUOh/QcH///n5jaFCmAAoKfhPUPAuWKGg4BkM + xSCroJLYMbJT/gkIzMSmCCQOVYIAQIkzKIqAzoBKoQIk98EUvoNKIQDII2AFAgKrgGwlMA3iY3gIKAAK + GigXDIB8F3QxIgADAwC7NFU/mWb72QAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHhJREFUKFNjQAf/BQQ6oEzc4L+QUOh/QcH///n5jaFCmAAoKfhPUPAuWKGg4BkM + xSCroJLYMbJT/gkIzMSmCCQOVYIAQIkzKIqAzoBKoQIk98EUvoNKIQDII2AFAgKrgGwlMA3iY3gIKAAK + GigXDIB8F3QxIgADAwC7NFU/mWb72QAAAABJRU5ErkJggg== + + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1 @@ -553,6 +877,30 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1 @@ -675,6 +1023,48 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -687,9 +1077,27 @@ True + + True + + + True + + + True + True + + True + + + True + + + True + iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -847,6 +1255,33 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -883,6 +1318,108 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -988,6 +1525,42 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + iVBORw0KGgoAAAANSUhEUgAAAG8AAACgCAYAAAACezIBAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -1101,6 +1674,24 @@ True + + True + + + True + + + True + + + True + + + True + + + True + iVBORw0KGgoAAAANSUhEUgAAAG8AAACgCAYAAAACezIBAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -1171,6 +1762,54 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -1210,12 +1849,18 @@ True + + True + True True + + True + True @@ -1225,6 +1870,36 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -1258,6 +1933,57 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True diff --git a/PKHeX/MainWindow/MainPK2.cs b/PKHeX/MainWindow/MainPK2.cs new file mode 100644 index 000000000..4272e79d7 --- /dev/null +++ b/PKHeX/MainWindow/MainPK2.cs @@ -0,0 +1,143 @@ +using System; +using System.Drawing; + +namespace PKHeX +{ + public partial class Main + { + private void populateFieldsPK2() + { + PK2 pk2 = pkm as PK2; + if (pk2 == null) + return; + + // Do first + pk2.Stat_Level = PKX.getLevel(pk2.Species, pk2.EXP); + if (pk2.Stat_Level == 100) + pk2.EXP = PKX.getEXP(pk2.Stat_Level, pk2.Species); + + CB_Species.SelectedValue = pk2.Species; + TB_Level.Text = pk2.Stat_Level.ToString(); + TB_EXP.Text = pk2.EXP.ToString(); + CB_HeldItem.SelectedValue = pk2.HeldItem; + CB_Form.SelectedIndex = pk2.AltForm; + CHK_IsEgg.Checked = pk2.IsEgg; + TB_Friendship.Text = pk2.CurrentFriendship.ToString(); + + TB_MetLevel.Text = pk2.Met_Level.ToString(); + CB_MetLocation.SelectedValue = pk2.Met_Location; + CB_MetTimeOfDay.SelectedIndex = pk2.Met_TimeOfDay; + + // Load rest + TB_TID.Text = pk2.TID.ToString("00000"); + CHK_Nicknamed.Checked = pk2.IsNicknamed; + TB_Nickname.Text = pk2.Nickname; + TB_OT.Text = pk2.OT_Name; + GB_OT.BackgroundImage = null; + Label_OTGender.Text = gendersymbols[pk2.OT_Gender]; + Label_OTGender.ForeColor = pk2.OT_Gender == 1 ? Color.Red : Color.Blue; + // Reset Label and ComboBox visibility, as well as non-data checked status. + Label_PKRS.Visible = false; + Label_PKRSdays.Visible = false; + + TB_HPIV.Text = pk2.IV_HP.ToString(); + TB_ATKIV.Text = pk2.IV_ATK.ToString(); + TB_DEFIV.Text = pk2.IV_DEF.ToString(); + TB_SPEIV.Text = pk2.IV_SPE.ToString(); + TB_SPAIV.Text = pk2.IV_SPA.ToString(); + + TB_HPEV.Text = pk2.EV_HP.ToString(); + TB_ATKEV.Text = pk2.EV_ATK.ToString(); + TB_DEFEV.Text = pk2.EV_DEF.ToString(); + TB_SPEEV.Text = pk2.EV_SPE.ToString(); + TB_SPAEV.Text = pk2.EV_SPA.ToString(); + + CB_Move1.SelectedValue = pk2.Move1; + CB_Move2.SelectedValue = pk2.Move2; + CB_Move3.SelectedValue = pk2.Move3; + CB_Move4.SelectedValue = pk2.Move4; + CB_PPu1.SelectedIndex = pk2.Move1_PPUps; + CB_PPu2.SelectedIndex = pk2.Move2_PPUps; + CB_PPu3.SelectedIndex = pk2.Move3_PPUps; + CB_PPu4.SelectedIndex = pk2.Move4_PPUps; + TB_PP1.Text = pk2.Move1_PP.ToString(); + TB_PP2.Text = pk2.Move2_PP.ToString(); + TB_PP3.Text = pk2.Move3_PP.ToString(); + TB_PP4.Text = pk2.Move4_PP.ToString(); + + CB_Language.SelectedIndex = pk2.Japanese ? 0 : 1; + + updateStats(); + setIsShiny(null); + + Label_Gender.Text = gendersymbols[pk2.Gender]; + Label_Gender.ForeColor = pk2.Gender == 2 ? Label_Species.ForeColor : (pk2.Gender == 1 ? Color.Red : Color.Blue); + TB_EXP.Text = pk2.EXP.ToString(); + } + private PKM preparePK2() + { + PK2 pk2 = pkm as PK2; + if (pk2 == null) + return null; + + pk2.Species = Util.getIndex(CB_Species); + pk2.TID = Util.ToInt32(TB_TID.Text); + pk2.EXP = Util.ToUInt32(TB_EXP.Text); + pk2.HeldItem = Util.getIndex(CB_HeldItem); + pk2.IsEgg = CHK_IsEgg.Checked; + pk2.CurrentFriendship = Util.ToInt32(TB_Friendship.Text); + pk2.Met_Level = Util.ToInt32(TB_MetLevel.Text); + pk2.Met_Location = Util.getIndex(CB_MetLocation); + pk2.Met_TimeOfDay = CB_MetTimeOfDay.SelectedIndex; + + pk2.EV_HP = Util.ToInt32(TB_HPEV.Text); + pk2.EV_ATK = Util.ToInt32(TB_ATKEV.Text); + pk2.EV_DEF = Util.ToInt32(TB_DEFEV.Text); + pk2.EV_SPE = Util.ToInt32(TB_SPEEV.Text); + pk2.EV_SPC = Util.ToInt32(TB_SPAEV.Text); + + pk2.Nickname = TB_Nickname.Text; + pk2.Move1 = Util.getIndex(CB_Move1); + pk2.Move2 = Util.getIndex(CB_Move2); + pk2.Move3 = Util.getIndex(CB_Move3); + pk2.Move4 = Util.getIndex(CB_Move4); + pk2.Move1_PP = Util.getIndex(CB_Move1) > 0 ? Util.ToInt32(TB_PP1.Text) : 0; + pk2.Move2_PP = Util.getIndex(CB_Move2) > 0 ? Util.ToInt32(TB_PP2.Text) : 0; + pk2.Move3_PP = Util.getIndex(CB_Move3) > 0 ? Util.ToInt32(TB_PP3.Text) : 0; + pk2.Move4_PP = Util.getIndex(CB_Move4) > 0 ? Util.ToInt32(TB_PP4.Text) : 0; + pk2.Move1_PPUps = Util.getIndex(CB_Move1) > 0 ? CB_PPu1.SelectedIndex : 0; + pk2.Move2_PPUps = Util.getIndex(CB_Move2) > 0 ? CB_PPu2.SelectedIndex : 0; + pk2.Move3_PPUps = Util.getIndex(CB_Move3) > 0 ? CB_PPu3.SelectedIndex : 0; + pk2.Move4_PPUps = Util.getIndex(CB_Move4) > 0 ? CB_PPu4.SelectedIndex : 0; + + pk2.IV_HP = Util.ToInt32(TB_HPIV.Text); + pk2.IV_ATK = Util.ToInt32(TB_ATKIV.Text); + pk2.IV_DEF = Util.ToInt32(TB_DEFIV.Text); + pk2.IV_SPE = Util.ToInt32(TB_SPEIV.Text); + pk2.IV_SPA = Util.ToInt32(TB_SPAIV.Text); + + pk2.OT_Name = TB_OT.Text; + + // Toss in Party Stats + Array.Resize(ref pk2.Data, pk2.SIZE_PARTY); + pk2.Stat_Level = Util.ToInt32(TB_Level.Text); + pk2.Stat_HPCurrent = Util.ToInt32(Stat_HP.Text); + pk2.Stat_HPMax = Util.ToInt32(Stat_HP.Text); + pk2.Stat_ATK = Util.ToInt32(Stat_ATK.Text); + pk2.Stat_DEF = Util.ToInt32(Stat_DEF.Text); + pk2.Stat_SPE = Util.ToInt32(Stat_SPE.Text); + pk2.Stat_SPA = Util.ToInt32(Stat_SPA.Text); + pk2.Stat_SPD = Util.ToInt32(Stat_SPD.Text); + + if (HaX) + { + pk2.Stat_Level = (byte)Math.Min(Convert.ToInt32(MT_Level.Text), byte.MaxValue); + } + + // Fix Moves if a slot is empty + pk2.FixMoves(); + + return pk2; + } + } +} diff --git a/PKHeX/Misc/personal_gs b/PKHeX/Misc/personal_gs new file mode 100644 index 000000000..05130b80b Binary files /dev/null and b/PKHeX/Misc/personal_gs differ diff --git a/PKHeX/PKHeX.csproj b/PKHeX/PKHeX.csproj index 500c90fe1..8e68ddc52 100644 --- a/PKHeX/PKHeX.csproj +++ b/PKHeX/PKHeX.csproj @@ -101,6 +101,9 @@ + + Form + Form @@ -121,6 +124,7 @@ + @@ -128,6 +132,7 @@ + @@ -147,6 +152,7 @@ + @@ -451,6 +457,7 @@ Designer + SettingsSingleFileGenerator Settings.Designer.cs @@ -500,9 +507,11 @@ + + @@ -2769,6 +2778,16 @@ + + + + + + + + + +