From 72489a6fabd94bc37ea9966e9436e442af48d458 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Tue, 5 Dec 2017 17:00:51 -0500 Subject: [PATCH 001/191] Fix SMTE CurrentAttack --- pk3DS/Subforms/Gen7/SMTE.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 4f8871ff35..4e3cc78a49 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -700,7 +700,7 @@ private void B_CurrentAttack_Click(object sender, EventArgs e) pkm.Species = CB_Species.SelectedIndex; pkm.Level = (int)NUD_Level.Value; pkm.Form = CB_Forme.SelectedIndex; - var moves = learn.GetCurrentMoves(pkm.Species, pkm.Form, 4); + var moves = learn.GetCurrentMoves(pkm.Species, pkm.Form, pkm.Level, 4); SetMoves(moves); } private void B_Clear_Click(object sender, EventArgs e) => SetMoves(new int[4]); From ca43387e5e50bb5eecb655d21ce5c8a50e7bd637 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 6 Dec 2017 17:48:13 -0500 Subject: [PATCH 002/191] Misc fixes (pt. 1) --- pk3DS.Core/Game/GameConfig.cs | 6 +++--- pk3DS.Core/Game/GameInfo.cs | 12 ++++++------ pk3DS.Core/Legality/Tables7.cs | 28 ++++++++++++++++++---------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index deae5d5bad..f57e9d7e6a 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -12,8 +12,8 @@ public class GameConfig private const int FILECOUNT_ORASDEMO = 301; private const int FILECOUNT_ORAS = 299; private const int FILECOUNT_SMDEMO = 239; - private const int FILECOUNT_SM = 311; // only a guess for now - private const int FILECOUNT_USUM = 333; // only a guess for now + private const int FILECOUNT_SM = 311; + private const int FILECOUNT_USUM = 333; public readonly GameVersion Version = GameVersion.Invalid; public GARCReference[] Files { get; private set; } @@ -237,7 +237,7 @@ public string getGARCFileName(string requestedGARC) public bool ORAS => Version == GameVersion.ORAS || Version == GameVersion.ORASDEMO; public bool SM => Version == GameVersion.SM || Version == GameVersion.SMDEMO; public bool USUM => Version == GameVersion.USUM; - public int MaxSpeciesID => XY || ORAS ? 721 : SM ? 802 : 807; + public int MaxSpeciesID => XY || ORAS ? Legal.MaxSpeciesID_6 : SM ? Legal.MaxSpeciesID_7_SM : Legal.MaxSpeciesID_7_USUM; public int GARCVersion => XY || ORAS ? GARC.VER_4 : GARC.VER_6; public int Generation { diff --git a/pk3DS.Core/Game/GameInfo.cs b/pk3DS.Core/Game/GameInfo.cs index af6ac1c02f..80c001345c 100644 --- a/pk3DS.Core/Game/GameInfo.cs +++ b/pk3DS.Core/Game/GameInfo.cs @@ -41,11 +41,11 @@ private void LoadAO() private void LoadSM() { - MaxSpeciesID = Legal.MaxSpeciesID_7; - MaxMoveID = Legal.MaxMoveID_7; - MaxItemID = Legal.MaxItemID_7; + MaxSpeciesID = Legal.MaxSpeciesID_7_SM; + MaxMoveID = Legal.MaxMoveID_7_SM; + MaxItemID = Legal.MaxItemID_7_SM; HeldItems = Legal.HeldItems_SM; - MaxAbilityID = Legal.MaxAbilityID_7; + MaxAbilityID = Legal.MaxAbilityID_7_SM; } private void LoadUSUM() @@ -53,8 +53,8 @@ private void LoadUSUM() MaxSpeciesID = Legal.MaxSpeciesID_7_USUM; MaxMoveID = Legal.MaxMoveID_7_USUM; MaxItemID = Legal.MaxItemID_7_USUM; - HeldItems = Legal.HeldItems_SM; - MaxAbilityID = Legal.MaxAbilityID_7; + HeldItems = Legal.HeldItems_USUM; + MaxAbilityID = Legal.MaxAbilityID_7_USUM; } } } diff --git a/pk3DS.Core/Legality/Tables7.cs b/pk3DS.Core/Legality/Tables7.cs index 4b6e60bd2f..b2d7a4907f 100644 --- a/pk3DS.Core/Legality/Tables7.cs +++ b/pk3DS.Core/Legality/Tables7.cs @@ -5,16 +5,17 @@ namespace pk3DS.Core { public static partial class Legal { - internal const int MaxSpeciesID_7 = 802; - internal const int MaxMoveID_7 = 720; - internal const int MaxItemID_7 = 920; - internal const int MaxAbilityID_7 = 232; - internal const int MaxBallID_7 = 0x1A; // 26 + internal const int MaxSpeciesID_7_SM = 802; + internal const int MaxMoveID_7_SM = 719; + internal const int MaxItemID_7_SM = 920; + internal const int MaxAbilityID_7_SM = 232; + internal const int MaxBallID_7_SM = 0x1A; // 26 internal const int MaxGameID_7 = 41; // Crystal (VC?) - internal const int MaxSpeciesID_7_USUM = 802; - internal const int MaxMoveID_7_USUM = 720; - internal const int MaxItemID_7_USUM = 920; + internal const int MaxSpeciesID_7_USUM = 807; + internal const int MaxMoveID_7_USUM = 728; + internal const int MaxItemID_7_USUM = 959; + internal const int MaxAbilityID_7_USUM = 233; #region Met Locations @@ -106,7 +107,14 @@ public static partial class Legal internal static readonly ushort[] Pouch_ZCrystalHeld_SM = { // Piece 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 798, 799, 800, 801, 802, 803, 804, 805, 806, 836 }; + internal static readonly ushort[] Pouch_ZCrystal_USUM = { // Bead + 927, 928, 929, 930, 931, 932 + }; + internal static readonly ushort[] Pouch_ZCrystalHeld_USUM = { // Piece + 921, 922, 923, 924, 925, 926 + }; internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray(); + internal static readonly ushort[] HeldItems_USUM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_USUM).ToArray(); internal static readonly int[] AlolanOriginForms = { 019, // Rattata @@ -114,7 +122,7 @@ public static partial class Legal 027, // Sandshrew 028, // Sandslash 037, // Vulpix - 038, // Ninetails + 038, // Ninetales 050, // Diglett 051, // Dugtrio 052, // Meowth @@ -204,7 +212,7 @@ public static partial class Legal 715, // Fairy Gem }; #endregion - internal static readonly bool[] ReleasedHeldItems_7 = Enumerable.Range(0, MaxItemID_7+1).Select(i => HeldItems_SM.Contains((ushort)i) && !UnreleasedHeldItems_7.Contains(i)).ToArray(); + internal static readonly bool[] ReleasedHeldItems_7 = Enumerable.Range(0, MaxItemID_7_SM+1).Select(i => HeldItems_SM.Contains((ushort)i) && !UnreleasedHeldItems_7.Contains(i)).ToArray(); public static readonly HashSet Totem_Alolan = new HashSet { From f6c2f152e77e5831434688b1bb609e9d097a685e Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 6 Dec 2017 18:08:08 -0500 Subject: [PATCH 003/191] Misc fixes (pt. 2) --- pk3DS.Core/Legality/Legal.cs | 1 + pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index e51489ee8a..b8d93f920b 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -225,6 +225,7 @@ public static partial class Legal 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 695, 696, 697, 698, 699, 700, 701, 702, 703, 719, + 723, 724, 725, 726, 727, 728 }; } } diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 429dfbc4f9..af7f908aaf 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -193,6 +193,13 @@ private void AddGen7Species(List list) list.AddRange(Enumerable.Range(722, 67)); if (L) list.AddRange(Enumerable.Range(785, 16)); // Tapus, Legends, UBs if (E) list.AddRange(Enumerable.Range(801, 2)); // Magearna, Marshadow + + if (MaxSpeciesID == 807) // USUM + { + if (L) list.AddRange(Enumerable.Range(803, 4)); // USUM UBs + if (E) list.AddRange(Enumerable.Range(807, 1)); // Zeraora + } + } public int[] RandomSpeciesList => Enumerable.Range(1, MaxSpeciesID).ToArray(); From bde6144ad45aac66e6e8a98c344cc1da95ecad84 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 6 Dec 2017 19:39:59 -0500 Subject: [PATCH 004/191] Revise legal/randomizer changes --- pk3DS.Core/Legality/Tables7.cs | 2 +- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pk3DS.Core/Legality/Tables7.cs b/pk3DS.Core/Legality/Tables7.cs index b2d7a4907f..888e7fb4fe 100644 --- a/pk3DS.Core/Legality/Tables7.cs +++ b/pk3DS.Core/Legality/Tables7.cs @@ -114,7 +114,7 @@ public static partial class Legal 921, 922, 923, 924, 925, 926 }; internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray(); - internal static readonly ushort[] HeldItems_USUM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_USUM).ToArray(); + internal static readonly ushort[] HeldItems_USUM = new ushort[1].Concat(HeldItems_SM).Concat(Pouch_ZCrystalHeld_USUM).ToArray(); internal static readonly int[] AlolanOriginForms = { 019, // Rattata diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index af7f908aaf..686819a1aa 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -157,7 +157,7 @@ private void AddGen2Species(List list) if (L) { - list.AddRange(Enumerable.Range(243, 3)); // Dogs + list.AddRange(Enumerable.Range(243, 3)); // Beasts list.AddRange(Enumerable.Range(249, 2)); // Lugia & Ho-Oh } if (E) list.Add(251); // Celebi @@ -173,20 +173,20 @@ private void AddGen3Species(List list) private void AddGen4Species(List list) { list.AddRange(Enumerable.Range(387, 93)); - if (L) list.AddRange(Enumerable.Range(480, 9)); // - if (E) list.AddRange(Enumerable.Range(489, 5)); // + if (L) list.AddRange(Enumerable.Range(480, 9)); // Sinnoh Legends + if (E) list.AddRange(Enumerable.Range(489, 5)); // Phione, Manaphy, Darkrai, Shaymin, Arceus } private void AddGen5Species(List list) { list.AddRange(Enumerable.Range(495, 143)); - if (L) list.AddRange(Enumerable.Range(638, 9)); list.Add(494); // - if (E) list.AddRange(Enumerable.Range(647, 3)); // + if (L) list.AddRange(Enumerable.Range(638, 9)); list.Add(494); // Unova Legends + if (E) list.AddRange(Enumerable.Range(647, 3)); // Keldeo, Meloetta, Genesect } private void AddGen6Species(List list) { list.AddRange(Enumerable.Range(650, 66)); - if (L) list.AddRange(Enumerable.Range(716, 3)); // - if (E) list.AddRange(Enumerable.Range(719, 3)); // + if (L) list.AddRange(Enumerable.Range(716, 3)); // Kalos Legends + if (E) list.AddRange(Enumerable.Range(719, 3)); // Diancie, Hoopa, Volcanion } private void AddGen7Species(List list) { @@ -196,8 +196,8 @@ private void AddGen7Species(List list) if (MaxSpeciesID == 807) // USUM { - if (L) list.AddRange(Enumerable.Range(803, 4)); // USUM UBs - if (E) list.AddRange(Enumerable.Range(807, 1)); // Zeraora + if (L) list.AddRange(Enumerable.Range(803, 4)); // Poipole, Naganadel, Stakataka, Blacephalon + if (E) list.Add(807); // Zeraora } } From d022f37f47299c7ddecd199e6ad09170ac11f52f Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 7 Dec 2017 19:22:07 -0800 Subject: [PATCH 005/191] Add varcode escape Closes #246 --- pk3DS.Core/TextFile.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/pk3DS.Core/TextFile.cs b/pk3DS.Core/TextFile.cs index 1a8b56eea3..b831090c99 100644 --- a/pk3DS.Core/TextFile.cs +++ b/pk3DS.Core/TextFile.cs @@ -271,6 +271,7 @@ private IEnumerable getEscapeValues(char esc) { case 'n': vals.Add('\n'); return vals; case '\\': vals.Add('\\'); return vals; + case '[': vals.Add('['); return vals; case 'r': vals.AddRange(new ushort[] { KEY_VARIABLE, 1, KEY_TEXTRETURN }); return vals; case 'c': vals.AddRange(new ushort[] { KEY_VARIABLE, 1, KEY_TEXTCLEAR }); return vals; default: throw new Exception("Invalid terminated line: \\" + esc); From eee90a3871aa3c237a884ef8872f3ccacca7c677 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Fri, 8 Dec 2017 12:00:55 -0500 Subject: [PATCH 006/191] Implement item randomization for static/gift PKM --- pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 19 ++++- pk3DS/Subforms/Gen6/GiftEditor6.cs | 11 ++- .../Gen6/StaticEncounterEditor6.Designer.cs | 15 +++- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 4 ++ .../Gen7/StaticEncounterEditor7.Designer.cs | 71 +++++++++++-------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 14 ++++ 6 files changed, 99 insertions(+), 35 deletions(-) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index 3a3593387e..50f3222bc2 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -78,6 +78,7 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); + this.CHK_Item = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); @@ -561,9 +562,9 @@ private void InitializeComponent() // this.L_Mega.Location = new System.Drawing.Point(26, 190); this.L_Mega.Name = "L_Mega"; - this.L_Mega.Size = new System.Drawing.Size(101, 33); + this.L_Mega.Size = new System.Drawing.Size(113, 33); this.L_Mega.TabIndex = 512; - this.L_Mega.Text = "XY - Lucario\nORAS - Lati@s"; + this.L_Mega.Text = "XY - Lucario\nORAS - Latias/Latios"; this.L_Mega.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // CHK_Mega @@ -580,6 +581,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); this.GB_Tweak.Controls.Add(this.CHK_E); @@ -592,7 +594,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(7, 62); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 100); + this.GB_Tweak.Size = new System.Drawing.Size(258, 108); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -747,6 +749,16 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // + // CHK_Item + // + this.CHK_Item.AutoSize = true; + this.CHK_Item.Location = new System.Drawing.Point(9, 81); + this.CHK_Item.Name = "CHK_Item"; + this.CHK_Item.Size = new System.Drawing.Size(119, 17); + this.CHK_Item.TabIndex = 296; + this.CHK_Item.Text = "Random Held Items"; + this.CHK_Item.UseVisualStyleBackColor = true; + // // GiftEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -839,5 +851,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G1; private System.Windows.Forms.CheckBox CHK_Mega; private System.Windows.Forms.Label L_Mega; + private System.Windows.Forms.CheckBox CHK_Item; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 59c675c3f3..64fe45d553 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -187,21 +187,28 @@ private void B_RandAll_Click(object sender, EventArgs e) rBST = CHK_BST.Checked, }; specrand.Initialize(); + var helditems = Randomizer.getRandomItemList(); for (int i = 0; i < LB_Gifts.Items.Count; i++) { LB_Gifts.SelectedIndex = i; int species = CB_Species.SelectedIndex; - if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex))) // mega stone gift pkm (only lucario?) + + if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex))) // Mega Stone Gifts (Lucario, Latias/Latios) { if (!CHK_Mega.Checked) - continue; // skip Lucario, battle needs to mega evolve + continue; // skip Lucario, battle needs to Mega Evolve int[] items = GetRandomMega(out species); CB_HeldItem.SelectedIndex = items[Util.rand.Next(0, items.Length)]; } else + { species = specrand.GetRandomSpecies(species); + if (CHK_Item.Checked) + CB_HeldItem.SelectedIndex = helditems[Util.rnd32() % helditems.Length]; + } + CB_Species.SelectedIndex = species; NUD_Form.Value = formrand.GetRandomForme(species); NUD_Gender.Value = 0; // random diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index fca531630f..9a159f304d 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -65,6 +65,7 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); + this.CHK_Item = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); @@ -334,6 +335,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); this.GB_Tweak.Controls.Add(this.CHK_E); @@ -346,7 +348,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(7, 67); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 100); + this.GB_Tweak.Size = new System.Drawing.Size(258, 107); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -501,6 +503,16 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // + // CHK_Item + // + this.CHK_Item.AutoSize = true; + this.CHK_Item.Location = new System.Drawing.Point(9, 81); + this.CHK_Item.Name = "CHK_Item"; + this.CHK_Item.Size = new System.Drawing.Size(119, 17); + this.CHK_Item.TabIndex = 295; + this.CHK_Item.Text = "Random Held Items"; + this.CHK_Item.UseVisualStyleBackColor = true; + // // StaticEncounterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -573,5 +585,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G3; private System.Windows.Forms.CheckBox CHK_G2; private System.Windows.Forms.CheckBox CHK_G1; + private System.Windows.Forms.CheckBox CHK_Item; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index c11f8e7ab3..bc05af7ca4 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -139,6 +139,7 @@ private void B_RandAll_Click(object sender, EventArgs e) rBST = CHK_BST.Checked, }; specrand.Initialize(); + var items = Randomizer.getRandomItemList(); for (int i = 0; i < LB_Encounters.Items.Count; i++) { LB_Encounters.SelectedIndex = i; @@ -149,6 +150,9 @@ private void B_RandAll_Click(object sender, EventArgs e) NUD_Form.Value = formrand.GetRandomForme(species); NUD_Gender.Value = 0; // random + if (CHK_Item.Checked) + CB_HeldItem.SelectedIndex = items[Util.rnd32() % items.Length]; + if (CHK_Level.Checked) NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 99718d3640..35b9b6063c 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -30,6 +30,8 @@ private void InitializeComponent() { this.TC_Tabs = new System.Windows.Forms.TabControl(); this.Tab_Gifts = new System.Windows.Forms.TabPage(); + this.NUD_GGender = new System.Windows.Forms.NumericUpDown(); + this.CHK_G_Lock = new System.Windows.Forms.CheckBox(); this.CB_GHeldItem = new System.Windows.Forms.ComboBox(); this.L_GHeldItem = new System.Windows.Forms.Label(); this.CB_GSpecies = new System.Windows.Forms.ComboBox(); @@ -89,10 +91,10 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_G_Lock = new System.Windows.Forms.CheckBox(); - this.NUD_GGender = new System.Windows.Forms.NumericUpDown(); + this.CHK_Item = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).BeginInit(); this.Tab_Encounters.SuspendLayout(); @@ -106,7 +108,6 @@ private void InitializeComponent() this.Tab_Randomizer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.GB_Tweak.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); this.SuspendLayout(); // // TC_Tabs @@ -144,6 +145,33 @@ private void InitializeComponent() this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; // + // NUD_GGender + // + this.NUD_GGender.Location = new System.Drawing.Point(230, 137); + this.NUD_GGender.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_GGender.Name = "NUD_GGender"; + this.NUD_GGender.Size = new System.Drawing.Size(48, 20); + this.NUD_GGender.TabIndex = 20; + this.NUD_GGender.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + // + // CHK_G_Lock + // + this.CHK_G_Lock.AutoSize = true; + this.CHK_G_Lock.Location = new System.Drawing.Point(230, 114); + this.CHK_G_Lock.Name = "CHK_G_Lock"; + this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); + this.CHK_G_Lock.TabIndex = 19; + this.CHK_G_Lock.Text = "Shiny Lock"; + this.CHK_G_Lock.UseVisualStyleBackColor = true; + // // CB_GHeldItem // this.CB_GHeldItem.FormattingEnabled = true; @@ -654,6 +682,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.CHK_G7); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); @@ -829,32 +858,15 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_G_Lock + // CHK_Item // - this.CHK_G_Lock.AutoSize = true; - this.CHK_G_Lock.Location = new System.Drawing.Point(230, 114); - this.CHK_G_Lock.Name = "CHK_G_Lock"; - this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); - this.CHK_G_Lock.TabIndex = 19; - this.CHK_G_Lock.Text = "Shiny Lock"; - this.CHK_G_Lock.UseVisualStyleBackColor = true; - // - // NUD_GGender - // - this.NUD_GGender.Location = new System.Drawing.Point(230, 137); - this.NUD_GGender.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_GGender.Name = "NUD_GGender"; - this.NUD_GGender.Size = new System.Drawing.Size(48, 20); - this.NUD_GGender.TabIndex = 20; - this.NUD_GGender.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); + this.CHK_Item.AutoSize = true; + this.CHK_Item.Location = new System.Drawing.Point(128, 79); + this.CHK_Item.Name = "CHK_Item"; + this.CHK_Item.Size = new System.Drawing.Size(119, 17); + this.CHK_Item.TabIndex = 297; + this.CHK_Item.Text = "Random Held Items"; + this.CHK_Item.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -869,6 +881,7 @@ private void InitializeComponent() this.TC_Tabs.ResumeLayout(false); this.Tab_Gifts.ResumeLayout(false); this.Tab_Gifts.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).EndInit(); this.Tab_Encounters.ResumeLayout(false); @@ -886,7 +899,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).EndInit(); this.ResumeLayout(false); } @@ -956,5 +968,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_ShinyLock; private System.Windows.Forms.NumericUpDown NUD_GGender; private System.Windows.Forms.CheckBox CHK_G_Lock; + private System.Windows.Forms.CheckBox CHK_Item; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 7183b67026..0a495b114f 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -334,6 +334,7 @@ private void B_Starters_Click(object sender, EventArgs e) var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; + var items = Randomizer.getRandomItemList(); // Assign Species for (int i = 0; i < 3; i++) @@ -342,6 +343,9 @@ private void B_Starters_Click(object sender, EventArgs e) t.Species = specrand.GetRandomSpecies(oldStarters[i]); t.Form = formrand.GetRandomForme(t.Species); + if (CHK_Item.Checked) + t.HeldItem = items[Util.rnd32() % items.Length]; + // no level boosting } @@ -362,6 +366,7 @@ private void B_RandAll_Click(object sender, EventArgs e) var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); + var items = Randomizer.getRandomItemList(); for (int i = 3; i < Gifts.Length; i++) // Skip Starters { @@ -369,6 +374,9 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); + if (CHK_Item.Checked) + t.HeldItem = items[Util.rnd32() % items.Length]; + if (CHK_Level.Checked) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } @@ -378,6 +386,9 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Form = formrand.GetRandomForme(t.Species); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); + if (CHK_Item.Checked) + t.HeldItem = items[Util.rnd32() % items.Length]; + if (CHK_Level.Checked) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } @@ -387,6 +398,9 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Form = formrand.GetRandomForme(t.Species); t.TradeRequestSpecies = specrand.GetRandomSpecies(t.TradeRequestSpecies); + if (CHK_Item.Checked) + t.HeldItem = items[Util.rnd32() % items.Length]; + if (CHK_Level.Checked) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } From e46cc3579426451845040638f9179e98abaa8938 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 9 Dec 2017 10:54:47 -0500 Subject: [PATCH 007/191] Random Mega Form option for Static Editors --- pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 26 +++++++------ .../Gen6/StaticEncounterEditor6.Designer.cs | 37 +++++++++++++------ pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 3 ++ .../Gen7/StaticEncounterEditor7.Designer.cs | 35 +++++++++++++----- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 3 ++ 5 files changed, 71 insertions(+), 33 deletions(-) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index 50f3222bc2..de66812e66 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -66,6 +66,7 @@ private void InitializeComponent() this.L_Mega = new System.Windows.Forms.Label(); this.CHK_Mega = new System.Windows.Forms.CheckBox(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_Item = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); this.CHK_BST = new System.Windows.Forms.CheckBox(); this.CHK_E = new System.Windows.Forms.CheckBox(); @@ -78,7 +79,6 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_Item = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); @@ -594,11 +594,23 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(7, 62); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 108); + this.GB_Tweak.Size = new System.Drawing.Size(258, 99); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_Item + // + this.CHK_Item.AutoSize = true; + this.CHK_Item.Checked = true; + this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Item.Location = new System.Drawing.Point(9, 79); + this.CHK_Item.Name = "CHK_Item"; + this.CHK_Item.Size = new System.Drawing.Size(119, 17); + this.CHK_Item.TabIndex = 296; + this.CHK_Item.Text = "Random Held Items"; + this.CHK_Item.UseVisualStyleBackColor = true; + // // L_RandOpt // this.L_RandOpt.AutoSize = true; @@ -749,16 +761,6 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // CHK_Item - // - this.CHK_Item.AutoSize = true; - this.CHK_Item.Location = new System.Drawing.Point(9, 81); - this.CHK_Item.Name = "CHK_Item"; - this.CHK_Item.Size = new System.Drawing.Size(119, 17); - this.CHK_Item.TabIndex = 296; - this.CHK_Item.Text = "Random Held Items"; - this.CHK_Item.UseVisualStyleBackColor = true; - // // GiftEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index 9a159f304d..1a8c87080b 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -53,6 +53,7 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_Item = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); this.CHK_BST = new System.Windows.Forms.CheckBox(); this.CHK_E = new System.Windows.Forms.CheckBox(); @@ -65,7 +66,7 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_Item = new System.Windows.Forms.CheckBox(); + this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); @@ -335,6 +336,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); @@ -346,13 +348,25 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(7, 67); + this.GB_Tweak.Location = new System.Drawing.Point(7, 58); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 107); + this.GB_Tweak.Size = new System.Drawing.Size(258, 114); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_Item + // + this.CHK_Item.AutoSize = true; + this.CHK_Item.Checked = true; + this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Item.Location = new System.Drawing.Point(9, 79); + this.CHK_Item.Name = "CHK_Item"; + this.CHK_Item.Size = new System.Drawing.Size(119, 17); + this.CHK_Item.TabIndex = 295; + this.CHK_Item.Text = "Random Held Items"; + this.CHK_Item.UseVisualStyleBackColor = true; + // // L_RandOpt // this.L_RandOpt.AutoSize = true; @@ -503,15 +517,15 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // CHK_Item + // CHK_AllowMega // - this.CHK_Item.AutoSize = true; - this.CHK_Item.Location = new System.Drawing.Point(9, 81); - this.CHK_Item.Name = "CHK_Item"; - this.CHK_Item.Size = new System.Drawing.Size(119, 17); - this.CHK_Item.TabIndex = 295; - this.CHK_Item.Text = "Random Held Items"; - this.CHK_Item.UseVisualStyleBackColor = true; + this.CHK_AllowMega.AutoSize = true; + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 94); + this.CHK_AllowMega.Name = "CHK_AllowMega"; + this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); + this.CHK_AllowMega.TabIndex = 296; + this.CHK_AllowMega.Text = "Allow Random Mega Forms"; + this.CHK_AllowMega.UseVisualStyleBackColor = true; // // StaticEncounterEditor6 // @@ -586,5 +600,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G2; private System.Windows.Forms.CheckBox CHK_G1; private System.Windows.Forms.CheckBox CHK_Item; + private System.Windows.Forms.CheckBox CHK_AllowMega; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index bc05af7ca4..619a32b7f0 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -150,6 +150,9 @@ private void B_RandAll_Click(object sender, EventArgs e) NUD_Form.Value = formrand.GetRandomForme(species); NUD_Gender.Value = 0; // random + if (CHK_AllowMega.Checked) + formrand.AllowMega = true; + if (CHK_Item.Checked) CB_HeldItem.SelectedIndex = items[Util.rnd32() % items.Length]; diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 35b9b6063c..bc890852a6 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -77,6 +77,7 @@ private void InitializeComponent() this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_Item = new System.Windows.Forms.CheckBox(); this.CHK_G7 = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); this.CHK_BST = new System.Windows.Forms.CheckBox(); @@ -91,7 +92,7 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_Item = new System.Windows.Forms.CheckBox(); + this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); @@ -682,6 +683,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.CHK_G7); this.GB_Tweak.Controls.Add(this.L_RandOpt); @@ -696,11 +698,23 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(52, 100); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 100); + this.GB_Tweak.Size = new System.Drawing.Size(258, 130); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_Item + // + this.CHK_Item.AutoSize = true; + this.CHK_Item.Checked = true; + this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Item.Location = new System.Drawing.Point(9, 94); + this.CHK_Item.Name = "CHK_Item"; + this.CHK_Item.Size = new System.Drawing.Size(119, 17); + this.CHK_Item.TabIndex = 297; + this.CHK_Item.Text = "Random Held Items"; + this.CHK_Item.UseVisualStyleBackColor = true; + // // CHK_G7 // this.CHK_G7.AutoSize = true; @@ -858,15 +872,15 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_Item + // CHK_AllowMega // - this.CHK_Item.AutoSize = true; - this.CHK_Item.Location = new System.Drawing.Point(128, 79); - this.CHK_Item.Name = "CHK_Item"; - this.CHK_Item.Size = new System.Drawing.Size(119, 17); - this.CHK_Item.TabIndex = 297; - this.CHK_Item.Text = "Random Held Items"; - this.CHK_Item.UseVisualStyleBackColor = true; + this.CHK_AllowMega.AutoSize = true; + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 109); + this.CHK_AllowMega.Name = "CHK_AllowMega"; + this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); + this.CHK_AllowMega.TabIndex = 298; + this.CHK_AllowMega.Text = "Allow Random Mega Forms"; + this.CHK_AllowMega.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -969,5 +983,6 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_GGender; private System.Windows.Forms.CheckBox CHK_G_Lock; private System.Windows.Forms.CheckBox CHK_Item; + private System.Windows.Forms.CheckBox CHK_AllowMega; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 0a495b114f..859533df6b 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -343,6 +343,9 @@ private void B_Starters_Click(object sender, EventArgs e) t.Species = specrand.GetRandomSpecies(oldStarters[i]); t.Form = formrand.GetRandomForme(t.Species); + if (CHK_AllowMega.Checked) + formrand.AllowMega = true; + if (CHK_Item.Checked) t.HeldItem = items[Util.rnd32() % items.Length]; From fec4fd4ca552a9627aca3c934f455caad80b9d86 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 9 Dec 2017 22:34:53 -0500 Subject: [PATCH 008/191] Add XY trainer class blacklist for ORAS --- pk3DS.Core/Legality/Legal.cs | 17 ++++++++++------- pk3DS/Subforms/Gen6/RSTE.cs | 10 +++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index b8d93f920b..7038d901e5 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -193,9 +193,9 @@ public static partial class Legal 055, // Pokémon Trainer (Shauna) 056, // Pokémon Trainer (Tierno) 057, // Pokémon Trainer (Trevor) - 077, // Team Flare (Admin)* + 077, // Team Flare (Admin) 078, // Team Flare (Admin) - 079, // Team Flare (Grunt)* + 079, // Team Flare (Grunt) 080, // Team Flare (Grunt) 081, // Team Flare (Lysandre) 102, // Pokémon Trainer (AZ) @@ -203,7 +203,6 @@ public static partial class Legal 104, // Pokémon Trainer (Serena) 105, // Pokémon Profoessor (Sycamore) 175, // Team Flare Boss (Lysandre) - // * = Female }; public static readonly int[] Model_AO = { @@ -215,10 +214,14 @@ public static partial class Legal 219, // Pokémon Trainer (Steven) 221, // Lorekeeper (Zinnia) 267, // Pokémon Trainer (Zinnia) - 272, // Pokémon Trainer (Wally)* - 278, // Pokémon Trainer (Brendan)* - 279, // Pokémon Trainer (May)* - // * = has Mega Pendant/Bracelet + 272, // Pokémon Trainer (Wally) + }; + public static readonly int[] Ignore_AO = + { + 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, + 038, 039, 040, 041, 042, 043, 044, 045, 046, 047, 048, 049, 050, 051, 052, 053, 054, 055, 056, 057, 058, 059, 060, 061, 062, 063, 064, 065, 066, 067, 068, 069, 070, 071, 072, 073, 074, + 075, 076, 077, 078, 079, 080, 081, 082, 083, 084, 085, 086, 087, 088, 089, 090, 091, 092, 093, 094, 095, 096, 097, 098, 099, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126 }; public static readonly int[] Z_Moves = { diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index c0d30f3055..db32d6f54f 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -23,6 +23,7 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); rModelRestricted = Main.Config.ORAS ? Legal.Model_AO : Legal.Model_XY; + rXYBlacklist = Legal.Ignore_AO; InitializeComponent(); // String Fetching @@ -533,6 +534,7 @@ private void Setup() public static int rDMGCount, rSTABCount; private int[] mEvoTypes; private static int[] rModelRestricted; + private static int[] rXYBlacklist; private string[] rImportant; private readonly List Tags = new List(); private readonly Dictionary TagTypes = new Dictionary(); @@ -726,7 +728,7 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) int randClass() => (int) (rnd32() % rModelRestricted.Length); t.Class = rModelRestricted[randClass()]; } - else + else if ( rClass // Classes selected to be randomized && (!rOnlySingles || t.BattleType == 0) // Nonsingles only get changed if rOnlySingles @@ -738,6 +740,12 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) // Ensure the Random Class isn't an exclusive class while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~")); // don't allow disallowed classes t.Class = rv; + + if (Main.Config.ORAS && rXYBlacklist.Contains(t.Class)) // Classes 0-126 are leftover from XY and some can crash the game; skip all of them + { + for (int i = 127; i <= 279; i++) + t.Class = i; + } } } private static void RandomizeTrainerPrizeItem(trdata6 t) From 0bc9ee74d312b5b92d7bfdbe5c1fe2315b74544c Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 9 Dec 2017 23:42:07 -0500 Subject: [PATCH 009/191] Add more TM/HM rand options --- pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs | 17 +++++++++++++++-- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 18 +++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs index a5b7d33d69..edbfe01c44 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.L_HM = new System.Windows.Forms.Label(); this.B_RTM = new System.Windows.Forms.Button(); this.CHK_RandomizeHM = new System.Windows.Forms.CheckBox(); + this.CHK_RandomizeField = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.dgvTM)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvHM)).BeginInit(); this.SuspendLayout(); @@ -72,7 +73,7 @@ private void InitializeComponent() this.dgvHM.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvHM.Location = new System.Drawing.Point(256, 25); this.dgvHM.Name = "dgvHM"; - this.dgvHM.Size = new System.Drawing.Size(240, 277); + this.dgvHM.Size = new System.Drawing.Size(240, 265); this.dgvHM.TabIndex = 3; // // L_HM @@ -97,18 +98,29 @@ private void InitializeComponent() // CHK_RandomizeHM // this.CHK_RandomizeHM.AutoSize = true; - this.CHK_RandomizeHM.Location = new System.Drawing.Point(256, 308); + this.CHK_RandomizeHM.Location = new System.Drawing.Point(256, 294); this.CHK_RandomizeHM.Name = "CHK_RandomizeHM"; this.CHK_RandomizeHM.Size = new System.Drawing.Size(104, 17); this.CHK_RandomizeHM.TabIndex = 280; this.CHK_RandomizeHM.Text = "Randomize HMs"; this.CHK_RandomizeHM.UseVisualStyleBackColor = true; // + // CHK_RandomizeField + // + this.CHK_RandomizeField.AutoSize = true; + this.CHK_RandomizeField.Location = new System.Drawing.Point(256, 311); + this.CHK_RandomizeField.Name = "CHK_RandomizeField"; + this.CHK_RandomizeField.Size = new System.Drawing.Size(139, 17); + this.CHK_RandomizeField.TabIndex = 281; + this.CHK_RandomizeField.Text = "Randomize Field Moves"; + this.CHK_RandomizeField.UseVisualStyleBackColor = true; + // // TMHMEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(504, 332); + this.Controls.Add(this.CHK_RandomizeField); this.Controls.Add(this.CHK_RandomizeHM); this.Controls.Add(this.B_RTM); this.Controls.Add(this.L_HM); @@ -137,5 +149,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_HM; private System.Windows.Forms.Button B_RTM; private System.Windows.Forms.CheckBox CHK_RandomizeHM; + private System.Windows.Forms.CheckBox CHK_RandomizeField; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index 1bd98f484d..09bf8335f4 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -157,22 +157,30 @@ private void formClosing(object sender, FormClosingEventArgs e) private void B_RandomTM_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize TMs?", "Move compatibility will be the same as the base TMs.") != DialogResult.Yes) return; - if(CHK_RandomizeHM.Checked) + if (CHK_RandomizeHM.Checked) if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomizing HMs can halt story progression!", "Continue anyway?") != DialogResult.Yes) return; int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray(); Util.Shuffle(randomMoves); - int[] banned = { 15, 19, 57, 70, 127, 249, 291, 148, 290 }; // Moves with overworld effects + int[] hm_xy = { 15, 19, 57, 70, 127 }; // Cut, Fly, Surf, Strength, Waterfall + int[] hm_oras = { 15, 19, 57, 70, 127, 249, 291 }; // + Rock Smash, Dive + int[] field = { 148, 249, 290 }; // Flash (TM70), Rock Smash (XY TM94), Secret Power (ORAS TM94) int ctr = 0; for (int i = 0; i < dgvTM.Rows.Count; i++) { int val = Array.IndexOf(movelist, dgvTM.Rows[i].Cells[1].Value); - if (banned.Contains(val)) continue; - while (banned.Contains(randomMoves[ctr])) ctr++; - dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; + if (CHK_RandomizeField.Checked) + dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; // randomize everything + + else + { + if (hm_xy.Contains(val) || hm_oras.Contains(val) || field.Contains(val)) continue; // skip HMs and Field Moves + while (hm_xy.Contains(randomMoves[ctr]) || hm_oras.Contains(randomMoves[ctr]) || field.Contains(randomMoves[ctr])) ctr++; + dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; + } } if (CHK_RandomizeHM.Checked) From a6f19c2496daecbe3e8be904edcf01464e0b1f9e Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 10 Dec 2017 00:11:36 -0500 Subject: [PATCH 010/191] Update readme screenshots --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d0db0014f7..f030ef92eb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # pk3DS pk3DS: A package of Pokémon (3DS) ROM Editing Tools by various contributors. -![RomFS Editing Tools](https://i.imgur.com/WxWOrhd.png) -![ExeFS Editing Tools](https://i.imgur.com/4jYIIHy.png) -![CRO Editing Tools](https://i.imgur.com/1bghcwx.png) +![RomFS Editing Tools](https://i.imgur.com/IDVCMfx.png) +![ExeFS Editing Tools](https://i.imgur.com/Ied0sVV.png) +![CRO Editing Tools](https://i.imgur.com/lUSGbw5.png) From 9bb32a7187495764b1fd58a39f49b359427a64db Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sun, 10 Dec 2017 10:05:37 -0500 Subject: [PATCH 011/191] Add USUM special classes --- pk3DS.Core/Legality/Legal.cs | 68 ++++++++++++++++++++++++++++++++++++ pk3DS/Subforms/Gen7/SMTE.cs | 10 ++++-- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 7038d901e5..d8046a5cf5 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -183,6 +183,74 @@ public static partial class Legal 185, // Aether Foundation: Faba }; + public static readonly int[] SpecialClasses_USUM = +{ + 030, // Pokémon Trainer: Hau + 031, // Island Kahuna: Hala + 038, // Captain: Ilima + 042, // Trial Guide: Ben + 044, // Captain: Lana + 045, // Captain: Mallow + 049, // Island Kahuna: Olivia + 051, // Island Kahuna: Hapu + 071, // Aether President: Lusamine + 072, // Aether Branch Chief: Faba + 076, // Team Skull Boss: Guzma + 078, // Team Skull Admin: Plumeria + 079, // Pokémon Trainer: Plumeria + 080, // Elite Four: Kahili + 081, // Pokémon Trainer: [~ 157] + 082, // Aether President: Lusamine + 083, // Pokémon Trainer: Red + 084, // Pokémon Trainer: Blue + 085, // Pokémon Trainer: Sina + 086, // Pokémon Trainer: Dexio + 088, // Pokémon Trainer: Anabel + 092, // Pro Wrestler: The Royal + 093, // Pokémon Trainer: Molayne + 099, // Pokémon Trainer: Molayne + 100, // Pokémon Trainer: Hau + 101, // Pokémon Trainer: Hau + 102, // Pokémon Trainer: Gladion + 103, // Pokémon Trainer: Gladion + 107, // Elite Four: Acerola + 109, // Elite Four: Hala + 110, // Elite Four: Olivia + 111, // Pokémon Professor: Kukui + 139, // GAME FREAK: Morimoto + 140, // Pokémon Trainer: Guzma + 141, // Island Kahuna: Nanu + 142, // Captain: Sophocles + 143, // Pokémon Trainer: Ryuki + 153, // Captain: Mina + 162, // Aether Foundation: Faba + 164, // Island Kahuna: Hapu + 165, // Pokémon Professor: Kukui + 185, // Aether Foundation: Faba + 186, // Pokémon Trainer: Sophocles + 187, // Pokémon Trainer: Giovanni + 188, // Pokémon Trainer: Kukui + 189, // Pokémon Trainer: Lillie + 190, // Pokémon Trainer: Giovanni + 191, // Elite Four: Molayne + 192, // Ultra Recon Squad: Soliera + 193, // Ultra Recon Squad: Dulse + 194, // Pokémon Trainer: Hau + 198, // Team Aqua: Archie + 199, // Team Galactic: Cyrus + 200, // Team Magma: Maxie + 201, // Team Plasma: Ghetsis + 202, // Team Flare: Lysandre + 204, // Kantonian Gym: Leader + 205, // GAME FREAK: Iwao + 206, // Team Rainbow Rocket: Giovanni + 207, // Pokémon Trainer: Lillie + 219, // Pokémon Trainer: Guzma + 220, // Aether President: Lusamine + 221, // Pokémon Trainer: Hau + 222, // Pokémon Trainer: Hau + }; + public static readonly int[] Model_XY = { 018, // Team Flare (Aliana) diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 4e3cc78a49..03f38911fd 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -18,6 +18,7 @@ public partial class SMTE : Form private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); private readonly trdata7[] Trainers; private string[][] AltForms; + private static int[] TrainerClasses_7; private int index = -1; private PictureBox[] pba; @@ -52,6 +53,8 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) CB_TrainerID.SelectedIndex = 0; CB_Moves.SelectedIndex = 0; + + TrainerClasses_7 = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; } private int GetSlot(object sender) @@ -617,8 +620,11 @@ private void B_Randomize_Click(object sender, EventArgs e) do { rv = (int) (Util.rnd32()%CB_Trainer_Class.Items.Count); - } while (/*trClass[rv].StartsWith("[~") || */Legal.SpecialClasses_SM.Contains(rv) && !CHK_IgnoreSpecialClass.Checked); - // don't allow disallowed classes + } while (/*trClass[rv].StartsWith("[~") || */TrainerClasses_7.Contains(rv) && CHK_IgnoreSpecialClass.Checked); // don't allow disallowed classes + + if (Main.Config.USUM && rv == 082) // Mother Beast Lusamine; unused in USUM and can crash game + continue; + tr.TrainerClass = (byte) rv; } From dd5dc2cabd09fce058988b16ee2c0b7d8af68345 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 10 Dec 2017 20:57:21 -0800 Subject: [PATCH 012/191] Refactoring increase diagnostic ability for a textfile, pull out some properties that aren't used outside of the library #253 --- pk3DS.Core/TextFile.cs | 86 ++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 25 deletions(-) diff --git a/pk3DS.Core/TextFile.cs b/pk3DS.Core/TextFile.cs index b831090c99..f22a9bf7c7 100644 --- a/pk3DS.Core/TextFile.cs +++ b/pk3DS.Core/TextFile.cs @@ -73,60 +73,96 @@ private class LineInfo public int Offset, Length; } - public string[] Lines + public byte[] this[int index] + { + get + { + ushort key = GetLineKey(index); + var line = LineOffsets[index]; + byte[] EncryptedLineData = new byte[line.Length * 2]; + Array.Copy(Data, line.Offset, EncryptedLineData, 0, EncryptedLineData.Length); + + return cryptLineData(EncryptedLineData, key); + } + } + + private static ushort GetLineKey(int index) + { + ushort key = KEY_BASE; + for (int i = 0; i < index; i++) + key += KEY_ADVANCE; + return key; + } + + public byte[][] LineData { get { ushort key = KEY_BASE; - string[] result = new string[LineCount]; + byte[][] result = new byte[LineCount][]; LineInfo[] lines = LineOffsets; for (int i = 0; i < lines.Length; i++) { byte[] EncryptedLineData = new byte[lines[i].Length * 2]; Array.Copy(Data, lines[i].Offset, EncryptedLineData, 0, EncryptedLineData.Length); - byte[] DecryptedLineData = cryptLineData(EncryptedLineData, key); - result[i] = getLineString(Config, DecryptedLineData); + + result[i] = cryptLineData(EncryptedLineData, key); key += KEY_ADVANCE; } return result; } set { - if (value == null) - value = new string[0]; - - ushort key = KEY_BASE; + // rebuild LineInfo LineInfo[] lines = new LineInfo[value.Length]; - - // Get Line Data - byte[][] lineData = new byte[lines.Length][]; - int sdo = (int)SectionDataOffset; int bytesUsed = 0; for (int i = 0; i < lines.Length; i++) { - string text = (value[i] ?? "").Trim(); - if (text.Length == 0 && SETEMPTYTEXT) - text = $"[~ {i}]"; - byte[] DecryptedLineData = getLineData(Config, text); - lineData[i] = cryptLineData(DecryptedLineData, key); - if (lineData[i].Length % 4 == 2) - Array.Resize(ref lineData[i], lineData[i].Length + 2); - key += KEY_ADVANCE; - lines[i] = new LineInfo { Offset = 4 + 8 * value.Length + bytesUsed, Length = DecryptedLineData.Length / 2 }; - bytesUsed += lineData[i].Length; + lines[i] = new LineInfo {Offset = 4 + 8 * value.Length + bytesUsed, Length = value[i].Length / 2}; + bytesUsed += value[i].Length; } // Apply Line Data + int sdo = (int)SectionDataOffset; Array.Resize(ref Data, sdo + 4 + 8 * value.Length + bytesUsed); - LineOffsets = lines; // Handled by LineInfo[] set {} - lineData.SelectMany(i => i).ToArray().CopyTo(Data, Data.Length - bytesUsed); + LineOffsets = lines; + value.SelectMany(i => i).ToArray().CopyTo(Data, Data.Length - bytesUsed); TotalLength = SectionLength = (uint)(Data.Length - sdo); LineCount = (ushort)value.Length; } } + public string[] Lines + { + get => LineData.Select(z => getLineString(Config, z)).ToArray(); + set => LineData = ConvertLinesToData(value); + } + + private byte[][] ConvertLinesToData(string[] value) + { + if (value == null) + value = new string[0]; + ushort key = KEY_BASE; + + // Get Line Data + byte[][] lineData = new byte[value.Length][]; + for (int i = 0; i < value.Length; i++) + { + string text = (value[i] ?? "").Trim(); + if (text.Length == 0 && SETEMPTYTEXT) + text = $"[~ {i}]"; + byte[] DecryptedLineData = getLineData(Config, text); + lineData[i] = cryptLineData(DecryptedLineData, key); + if (lineData[i].Length % 4 == 2) + Array.Resize(ref lineData[i], lineData[i].Length + 2); + key += KEY_ADVANCE; + } + + return lineData; + } + public byte[] Data; - private byte[] cryptLineData(byte[] data, ushort key) + private static byte[] cryptLineData(byte[] data, ushort key) { byte[] result = new byte[data.Length]; for (int i = 0; i < result.Length; i += 2) From 57d98a4c9e4170a505447a6d47917ea81266ca44 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 13 Dec 2017 18:56:19 -0800 Subject: [PATCH 013/191] Relocate script handling to core --- pk3DS.Core/Structures/Script.cs | 56 ++ pk3DS.Core/Structures/Scripts.cs | 866 ++++++++++++++++++ .../Subforms/Gen6/Experimental/OWSEStructs.cs | 49 - 3 files changed, 922 insertions(+), 49 deletions(-) create mode 100644 pk3DS.Core/Structures/Script.cs create mode 100644 pk3DS.Core/Structures/Scripts.cs diff --git a/pk3DS.Core/Structures/Script.cs b/pk3DS.Core/Structures/Script.cs new file mode 100644 index 0000000000..dbdffcad2e --- /dev/null +++ b/pk3DS.Core/Structures/Script.cs @@ -0,0 +1,56 @@ +using System; +using System.Linq; + +namespace pk3DS.Core +{ + public class Script + { + public int Length => BitConverter.ToInt32(Raw, 0x00); + public uint Magic => BitConverter.ToUInt32(Raw, 0x04); + // case 0x0A0AF1E0: code = read_code_block(f); break; + // case 0x0A0AF1EF: debug = read_debug_block(f); break; + public bool Debug => Magic == 0x0A0AF1EF; + + public ushort PtrOffset => BitConverter.ToUInt16(Raw, 0x08); + public ushort PtrCount => BitConverter.ToUInt16(Raw, 0x0A); + + public int ScriptInstructionStart => BitConverter.ToInt32(Raw, 0x0C); + public int ScriptMovementStart => BitConverter.ToInt32(Raw, 0x10); + public int FinalOffset => BitConverter.ToInt32(Raw, 0x14); + public int AllocatedMemory => BitConverter.ToInt32(Raw, 0x18); + + // Generated Attributes + public int CompressedLength => Length - ScriptInstructionStart; + public byte[] CompressedBytes => Raw.Skip(ScriptInstructionStart).ToArray(); + public int DecompressedLength => FinalOffset - ScriptInstructionStart; + public uint[] DecompressedInstructions => Scripts.quickDecompress(CompressedBytes, DecompressedLength/4); + + public uint[] ScriptCommands => DecompressedInstructions.Take((ScriptMovementStart - ScriptInstructionStart) / 4).ToArray(); + public uint[] MoveCommands => DecompressedInstructions.Skip((ScriptMovementStart - ScriptInstructionStart) / 4).ToArray(); + public string[] ParseScript => Scripts.parseScript(ScriptCommands); + public string[] ParseMoves => Scripts.parseMovement(MoveCommands); + + public string Info => "Data Start: 0x" + ScriptInstructionStart.ToString("X4") + + Environment.NewLine + "Movement Offset: 0x" + ScriptMovementStart.ToString("X4") + + Environment.NewLine + "Total Used Size: 0x" + FinalOffset.ToString("X4") + + Environment.NewLine + "Reserved Size: 0x" + AllocatedMemory.ToString("X4") + + Environment.NewLine + "Compressed Len: 0x" + CompressedLength.ToString("X4") + + Environment.NewLine + "Decompressed Len: 0x" + DecompressedLength.ToString("X4") + + Environment.NewLine + "Compression Ratio: " + + ((DecompressedLength - CompressedLength)/(decimal)DecompressedLength).ToString("p1"); + + public byte[] Raw; + public Script(byte[] data = null) + { + Raw = data ?? new byte[0]; + + // sub_51AAFC + if ((Raw[8] & 1) != 0) + throw new ArgumentException("Multi-environment script!?"); + } + public byte[] Write() + { + return Raw; + } + } +} \ No newline at end of file diff --git a/pk3DS.Core/Structures/Scripts.cs b/pk3DS.Core/Structures/Scripts.cs new file mode 100644 index 0000000000..25a20c9860 --- /dev/null +++ b/pk3DS.Core/Structures/Scripts.cs @@ -0,0 +1,866 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace pk3DS.Core +{ + // Big thanks to FireFly for figuring out the 7/6-bit compression routine for scripts. + public static class Scripts + { + // Decompression - Deprecated: Use FireFly's method. + internal static byte[] decompressScript(byte[] data) + { + data = data ?? new byte[0]; // Bad Input + + using (MemoryStream mn = new MemoryStream()) + using (BinaryWriter bw = new BinaryWriter(mn)) + { + // Read away! + int pos = 0; + while (pos < data.Length) + { + // Read until the top bit is not set + byte[] cb = readCompressed(data, pos); + pos += cb.Length; + // Interpret the bytecode + byte[] db = decompressBytes(cb); + // Write Bytes + bw.Write(db); + } + return mn.ToArray(); + } + } + internal static byte[] readCompressed(byte[] data, int pos) + { + byte[] c1 = data.Skip(pos).TakeWhile(b => b >> 7 > 0).ToArray(); // Take while >= 0x80 + return c1.Concat(data.Skip(pos + c1.Length).Take(1)).ToArray(); // Take another + } + internal static byte[] decompressBytes(byte[] cb) + { + byte[] db = new byte[0]; + + if ((cb[0] & 0x40) > 0) // Signed Parameter + { + // Check the next bytecode + if (cb.Length > 1 && cb[1] >> 7 > 0) // Many-bits-required command + { + // 2 Byte Signed Parameter + int cmd = (cb[0] & 0x3 << 14) | (cb[1] & 0x7F << 7) | cb[2]; // 16 Bits total + db = db.Concat(BitConverter.GetBytes(cmd).Take(2)).ToArray(); // 16 Bits + + int dev = ((cb[0] & 0x3F) - 0x40) >> 2; // Lowest 2 bits have already been used for the command + db = db.Concat(BitConverter.GetBytes(dev).Take(2)).ToArray(); // 16 Bits + } + else if (cb[0] >> 7 > 0) // Signed Command + { + // 3 Byte Signed Parameter + int cmd = (cb[0] << 7) | cb[1]; + db = db.Concat(BitConverter.GetBytes(cmd).Take(1)).ToArray(); // 8 Bits Total + + int dev = ((cb[0] & 0x3F) - 0x40) >> 1; // Lowest bit has already been used for the command + db = db.Concat(BitConverter.GetBytes(dev).Take(3)).ToArray(); // 24 Bits + } + else // Signed Value + { + // 4 Byte Signed Parameter + int dev = ((cb[0] & 0x3F) - 0x40) >> 0; // No bits have already been used; no command + db = db.Concat(BitConverter.GetBytes(dev).Take(4)).ToArray(); // 32 Bits + } + } + else if (cb[0] >> 7 > 0) // Manybit + { + Array.Reverse(cb); + int cmd = 0; + for (int i = 0; i < cb.Length; i++) + cmd |= (cb[i] & 0x7F) << (7 * i); + + db = db.Concat(BitConverter.GetBytes((uint)cmd).Take(4)).ToArray(); + } + else // Literal + { + db = db.Concat(BitConverter.GetBytes((uint)cb[0]).Take(4)).ToArray(); + } + return db; + } + // FireFly's (github.com/FireyFly) concise decompression (ported c->c#): + // https://github.com/FireyFly/poketools/blob/e74538a5b5e5dab1e78c1cd313c55d158f37534d/src/formats/script.c#L61 + internal static uint[] quickDecompress(byte[] data, int count) + { + uint[] code = new uint[count]; + uint i = 0, j = 0, x = 0, f = 0; + while (i < code.Length) { + int b = data[f++], + v = b & 0x7F; + if (++j == 1) // sign extension possible + x = (uint)((((v >> 6 == 0 ? 1 : 0) - 1) << 6) | v); // only for bit6 being set + else x = (x << 7) | (byte)v; // shift data into place + + if ((b & 0x80) != 0) continue; // more data to read + code[i++] = x; j = 0; // write finalized instruction + } + return code; + } + + // Compression + internal static byte[] compressScript(byte[] data) + { + if (data == null || data.Length % 4 != 0) // Bad Input + return null; + using (MemoryStream mn = new MemoryStream()) + using (BinaryWriter bw = new BinaryWriter(mn)) + { + int pos = 0; + while (pos < data.Length) + { + byte[] db = data.Skip(pos+=4).Take(4).ToArray(); + byte[] cb = compressBytes(db); + bw.Write(cb); + } + return mn.ToArray(); + } + } + internal static byte[] compressBytes(byte[] db) + { + short cmd = BitConverter.ToInt16(db, 0); + short val = BitConverter.ToInt16(db, 2); + + byte[] cb = new byte[0]; + bool sign4 = val < 0 && cmd < 0 && db[0] >= 0xC0; // 4 byte signed + bool sign3 = val < 0 && cmd < 0 && db[0] < 0xC0; // 3 byte signed + bool sign2 = val < 0 && cmd > 0; // 2 byte signed + bool liter = cmd >= 0 && cmd < 0x40; // Literal + bool manyb = cmd >= 0x40; // manybit + + if (sign4) + { + int dev = 0x40 + BitConverter.ToInt32(db, 0); + if (dev < 0) // BADLOGIC + return cb; + cb = new[] {(byte)((dev & 0x3F) | 0x40)}; + } + else if (sign3) + { + byte dev = (byte)(((db[1] << 1) + 0x40) | 0xC0 | db[0] >> 7); + byte low = db[0]; + cb = new[] {dev, low}; + } + else if (sign2) + { + if (manyb) + { + byte dev = (byte)(((db[2] << 2) + 0x40) | 0xC0 | db[1] >> 7); + byte low1 = (byte)(0x80 | (db[0] >> 7) | (db[1] & 0x80)); + byte low0 = (byte)(db[0] & 0x80); + cb = new[] {low0, low1, dev}; + } + else // Dunno if this ever naturally happens; the command reader may ignore db[1] if db[0] < 0x80... needs verification. + { + byte dev = (byte)(((db[1] << 2) + 0x40) | 0xC0 | db[0] >> 6); + byte low0 = (byte)(db[0] & 0x3F); + cb = new[] {low0, dev}; + } + } + else if (manyb) + { + ulong bitStorage = 0; + + uint dv = BitConverter.ToUInt32(db, 0); + int ctr = 0; + while (dv != 0) // bits remaining + { + byte bits = (byte)((byte)dv & 0x7F); dv >>= 7; // Take off 7 bits at a time + bitStorage |= (byte)(bits << (ctr*8)); // Write the 7 bits into storage + bitStorage |= (byte)(1 << (7 + ctr++*8)); // continue reading flag + } + byte[] compressedBits = BitConverter.GetBytes(bitStorage); + + Array.Reverse(compressedBits); + // Trim off leading zero-bytes + cb = compressedBits.SkipWhile(v => v == 0).ToArray(); + } + else if (liter) + { + cb = new[] { (byte)cmd }; + } + return cb; + } + + // General Utility + internal static string[] getHexLines(byte[] data, int count = 4) + { + data = data ?? new byte[0]; + // Generates an x-byte wide space separated string array; leftovers included at the end. + string[] s = new string[data.Length/count + (data.Length % count > 0 ? 1 : 0)]; + for (int i = 0; i < s.Length;i++) + s[i] = BitConverter.ToString(data.Skip(i*count).Take(count).ToArray()).Replace('-', ' '); + return s; + } + internal static string[] getHexLines(uint[] data) + { + data = data ?? new uint[0]; + // Generates an 4-byte wide space separated string array. + string[] s = new string[data.Length]; + for (int i = 0; i < s.Length; i++) + s[i] = BitConverter.ToString(BitConverter.GetBytes(data[i])).Replace('-', ' '); + return s; + } + internal static byte[] getBytes(uint[] data) + { + return data.Aggregate(new byte[0], (current, t) => current.Concat(BitConverter.GetBytes(t)).ToArray()); + } + + // Interpreting + internal static string[] parseScript(uint[] cmd, int sanity = -1) + { + // sub_148CBC Moon v1.0 + List parse = new List(); + int sanityMode = 0; + + int i = 0; // Current Offset of decompressed instructions + while (i < cmd.Length) // read away + { + // Read a Command + int line = i; + uint c = cmd[i++]; + + string op; + switch (c & 0x7FFF) + { + default: + throw new ArgumentException("Invalid Command ID"); + case 0x01: + case 0x02: + case 0x05: + case 0x06: + case 0x0F: + case 0x10: + case 0x13: + case 0x14: + case 0x6D: + case 0x72: + { + // Peek at next value + var next = (int)cmd[i++]; + // Check Value against negative and zero... ? + + op = eA(c, next); + break; + } + case 0x03: + case 0x04: + case 0x07: + case 0x08: + case 0x11: + case 0x12: + case 0x15: + case 0x16: + case 0x6E: + case 0x73: + { + // Peek at next value + var next = (int)cmd[i++]; + // Check Value against negative... ? + + op = eA(c, next); + break; + } + case 0x09: + case 0x17: + case 0x19: + case 0x1B: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x2A: + case 0x2B: + case 0x2E: // Begin + case 0x2F: + case 0x30: // Return + case 0x41: + case 0x42: + case 0x43: + case 0x48: + case 0x49: + case 0x4A: + case 0x4B: + case 0x4C: + case 0x4D: + case 0x4E: // Add? + case 0x4F: + case 0x50: + case 0x51: // Cmp? + case 0x52: + case 0x53: + case 0x54: + case 0x55: + case 0x56: + case 0x59: // ClearAll + case 0x5A: + case 0x5D: + case 0x5E: + case 0x5F: + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + case 0x67: + case 0x68: + case 0x6B: + case 0x6C: + case 0x6F: + case 0x70: + case 0x71: + case 0x74: + case 0x7A: + case 0x83: + case 0x84: + case 0x86: + case 0x89: // LineNo? + case 0xAA: + case 0xAB: // PushConst2 + case 0xAC: // CmpConst2 + case 0xAD: + case 0xAE: + case 0xB7: + case 0xB8: + case 0xB9: + case 0xBA: + case 0xBB: + case 0xBC: // PushConst + case 0xBD: + case 0xBE: + case 0xBF: // AdjustStack + case 0xC0: + case 0xC1: + case 0xC2: + case 0xC3: + case 0xC4: + case 0xC5: + case 0xC6: + case 0xC7: + case 0xC8: // CmpLocal + case 0xC9: // CmpConst + case 0xCA: + case 0xCF: + case 0xD0: + case 0xD1: + case 0xD2: + case 0xD3: + case 0xD4: + { + // no sanity checks + var arg = (short)(c >> 16); + + op = eA(c & 0xFF, arg); + + if ((c & 0xFF) == 0x30) // return + op += Environment.NewLine; + break; + } + case 0x0A: + case 0x0B: + case 0x0C: + case 0x0D: + case 0x0E: + case 0x18: + case 0x1A: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: + case 0x20: + case 0x26: + case 0x27: // PushConst + case 0x28: + case 0x29: + case 0x2C: + case 0x2D: + case 0x34: + case 0x44: + case 0x45: + case 0x46: + case 0x47: + case 0x57: + case 0x58: + case 0x5B: + case 0x5C: + case 0x69: + case 0x6A: + case 0x75: + case 0x76: + case 0x77: + case 0x78: + case 0x79: + case 0x85: + { + var next = (int)cmd[i++]; + // No sanity check needed + + op = eA(c, next); + break; + } + + case 0x31: // CallFunc + case 0x33: + case 0x35: // Jump!= + case 0x36: // Jump== + case 0x37: + case 0x38: + case 0x39: + case 0x3A: + case 0x3B: + case 0x3C: + case 0x3D: + case 0x3E: + case 0x3F: + case 0x40: + case 0x81: // Jump + { + var delta = (int)cmd[i++]; + // sanity check range... + // negative.. weird + + int newOfs = line*4 + delta; + op = $"{Commands[c]} => 0x{newOfs:X4} ({delta})"; + break; + } + case 0x7B: + { + var next = (int)cmd[i++]; + sanityMode |= 1; // flag mode 1 + + op = eA(c, next); + break; + } + case 0x82: // JumpIfElse + { + var jOffset = i*4 -4; // todo: this may be the correct jump start point... + var count = cmd[i++]; // switch case table + // sanity check + + // Populate If-Case Tree + var tree = new List(); + + // Cases + for (int j = 0; j < count; j++) + { + var jmp = (int)cmd[i++]; + var toOffset = (i-2)*4 + jmp; + var ifValue = (int)cmd[i++]; + tree.Add($"\t{ifValue} => 0x{toOffset:X4} ({jmp})"); + } + // Default + { + int jmp = (int)cmd[i++]; + var toOffset = (i-2)*4 + jmp; + tree.Add($"\t{"*"} => 0x{toOffset:X4} ({jmp})"); + } + + op = Commands[c] + Environment.NewLine + string.Join(Environment.NewLine, tree); + break; + } + case 0x87: + { + var next1 = (int)cmd[i++]; + var next2 = (int)cmd[i++]; + sanityMode |= 2; // flag mode 2 + + op = eA(c, next1, next2); + break; + } + + case 0x8A: + case 0x8B: + case 0x8C: + case 0x8D: + case 0x9C: + case 0x9D: + { + var next1 = (int)cmd[i++]; + var next2 = (int)cmd[i++]; + + op = eA(c, next1, next2); + break; + } + + case 0x8E: + case 0x8F: + case 0x90: + case 0x91: + { + var next1 = cmd[i++]; + var next2 = cmd[i++]; + var next3 = cmd[i++]; + + op = eF(c, next1, next2, next3); + break; + } + + case 0x92: + case 0x93: + case 0x94: + case 0x95: + { + var next1 = (int)cmd[i++]; + var next2 = (int)cmd[i++]; + var next3 = (int)cmd[i++]; + var next4 = (int)cmd[i++]; + + op = eA(c, next1, next2, next3, next4); + break; + } + + case 0x96: // float + case 0x97: + case 0x98: + case 0x99: + { + var next1 = cmd[i++]; + var next2 = cmd[i++]; + var next3 = cmd[i++]; + var next4 = cmd[i++]; + var next5 = cmd[i++]; + + op = eF(c, next1, next2, next3, next4, next5); + break; + } + + case 0x9A: + { + var next1 = (int)cmd[i++]; + var next2 = (int)cmd[i++]; + // a bunch of sanity checking + + op = eA(c, next1, next2); + break; + } + + case 0x9B: // Copy + { + var next1 = (int)cmd[i++]; + var next2 = (int)cmd[i++]; + // a bunch of sanity checking + + op = eA(c, next1, next2); + break; + } + + case 0x9E: + { + var next1 = (int)cmd[i++]; + // perm check a1 + 0x14 + // can return error code 0x1C + + op = eA(c, next1); + break; + } + + case 0x9F: + { + // perm check a1 + 0x14 + // same permission checking as 0x9E + // can return error code 0x1C + + op = eA(c); + break; + } + + case 0xA1: // Goto + { + // minimal sanity checks + // can return error code 0x1C + int newPos = i + (int)(1 + 2*(cmd[i]/4) + 1); + + op = eA(c, newPos); + break; + } + + case 0xA2: // GetGlobal2 + case 0xA3: // GetGlobal + case 0xA6: + case 0xA7: + case 0xAF: // SetGlobal + case 0xB0: + case 0xB3: + case 0xB4: + case 0xCB: + case 0xCD: + { + // sanity check arg + var arg = (short)(c >> 16); + + op = eA(c & 0xFF, arg); + break; + } + case 0xA4: // GetGlobal4 + case 0xA5: + case 0xA8: + case 0xA9: + case 0xB1: // SetLocal + case 0xB2: + case 0xB5: + case 0xB6: + case 0xCC: + case 0xCE: + { + // sanity check arg, slightly different + var arg = (short)(c >> 16); + + op = eA(c & 0xFF, arg); + break; + } + } + parse.Add($"0x{line*4:X4}: [{c & 0x7FF:X2}] {op}"); + } + + if (sanity >= 0 && sanity != sanityMode) + throw new ArgumentException(); + + return parse.ToArray(); + } + + internal static string[] parseMovement(uint[] cmd) + { + return getHexLines(cmd); + } + + internal static string eA(uint c, params int[] arr) + { + string cmd = Commands[c]; + string parameters = arr.Length == 0 ? "" : string.Join(", ", arr.Select(z => $"{(Math.Abs(z) < 100 ? z.ToString() : "0x"+z.ToString("X4"))}")); + return $"{cmd}({parameters})"; + } + private static readonly Func getFloat = val => BitConverter.ToSingle(BitConverter.GetBytes(val), 0); + internal static string eF(uint c, params uint[] arr) + { + string cmd = Commands[c]; + string parameters = arr.Length == 1 ? "" : string.Join(", ", arr.Select(z => getFloat(z))); + return $"{cmd}({parameters})"; + } + + internal static readonly Dictionary Commands = new Dictionary + {// { 0x00, "$00" }, // Invalid Code + { 0x01, "$01" }, + { 0x02, "$02" }, + { 0x03, "$03" }, + { 0x04, "$04" }, + { 0x05, "$05" }, + { 0x06, "$06" }, + { 0x07, "$07" }, + { 0x08, "$08" }, + { 0x09, "$09" }, + { 0x0A, "$0A" }, + { 0x0B, "$0B" }, + { 0x0C, "$0C" }, + { 0x0D, "$0D" }, + { 0x0E, "$0E" }, + { 0x0F, "$0F" }, + { 0x10, "$10" }, + { 0x11, "$11" }, + { 0x12, "$12" }, + { 0x13, "$13" }, + { 0x14, "$14" }, + { 0x15, "$15" }, + { 0x16, "$16" }, + { 0x17, "$17" }, + { 0x18, "$18" }, + { 0x19, "$19" }, + { 0x1A, "$1A" }, + { 0x1B, "$1B" }, + { 0x1C, "$1C" }, + { 0x1D, "$1D" }, + { 0x1E, "$1E" }, + { 0x1F, "$1F" }, + { 0x20, "$20" }, + { 0x21, "$21" }, + { 0x22, "$22" }, + { 0x23, "$23" }, + { 0x24, "$24" }, + { 0x25, "$25" }, + { 0x26, "$26" }, + { 0x27, "PushConst" }, + { 0x28, "$28" }, + { 0x29, "$29" }, + { 0x2A, "$2A" }, + { 0x2B, "$2B" }, + { 0x2C, "$2C" }, + { 0x2D, "$2D" }, + { 0x2E, "Begin" }, + { 0x2F, "$2F" }, + { 0x30, "Return" }, + { 0x31, "CallFunc" }, + { 0x32, "$32" }, + { 0x33, "$33" }, + { 0x34, "$34" }, + { 0x35, "BNE" }, + { 0x36, "BEQ" }, + { 0x37, "$37" }, + { 0x38, "$38" }, + { 0x39, "$39" }, + { 0x3A, "$3A" }, + { 0x3B, "$3B" }, + { 0x3C, "$3C" }, + { 0x3D, "$3D" }, + { 0x3E, "$3E" }, + { 0x3F, "$3F" }, + { 0x40, "$40" }, + { 0x41, "$41" }, + { 0x42, "$42" }, + { 0x43, "$43" }, + { 0x44, "$44" }, + { 0x45, "$45" }, + { 0x46, "$46" }, + { 0x47, "$47" }, + { 0x48, "$48" }, + { 0x49, "$49" }, + { 0x4A, "$4A" }, + { 0x4B, "$4B" }, + { 0x4C, "$4C" }, + { 0x4D, "$4D" }, + { 0x4E, "Add?" }, + { 0x4F, "$4F" }, + { 0x50, "$50" }, + { 0x51, "Cmp?" }, + { 0x52, "$52" }, + { 0x53, "$53" }, + { 0x54, "$54" }, + { 0x55, "$55" }, + { 0x56, "$56" }, + { 0x57, "$57" }, + { 0x58, "$58" }, + { 0x59, "ClearAll" }, + { 0x5A, "$5A" }, + { 0x5B, "$5B" }, + { 0x5C, "$5C" }, + { 0x5D, "$5D" }, + { 0x5E, "$5E" }, + { 0x5F, "$5F" }, + { 0x60, "$60" }, + { 0x61, "$61" }, + { 0x62, "$62" }, + { 0x63, "$63" }, + { 0x64, "$64" }, + { 0x65, "$65" }, + { 0x66, "$66" }, + { 0x67, "$67" }, + { 0x68, "$68" }, + { 0x69, "$69" }, + { 0x6A, "$6A" }, + { 0x6B, "$6B" }, + { 0x6C, "$6C" }, + { 0x6D, "$6D" }, + { 0x6E, "$6E" }, + { 0x6F, "$6F" }, + { 0x70, "$70" }, + { 0x71, "$71" }, + { 0x72, "$72" }, + { 0x73, "$73" }, + { 0x74, "$74" }, + { 0x75, "$75" }, + { 0x76, "$76" }, + { 0x77, "$77" }, + { 0x78, "$78" }, + { 0x79, "$79" }, + { 0x7A, "$7A" }, + { 0x7B, "$7B" }, + // { 0x7C, "$7C" }, // Invalid Code + // { 0x7D, "$7D" }, // Invalid Code + // { 0x7E, "$7E" }, // Invalid Code + // { 0x7F, "$7F" }, // Invalid Code + // { 0x80, "$80" }, // Invalid Code + { 0x81, "JMP" }, + { 0x82, "switch" }, + { 0x83, "$83" }, + { 0x84, "$84" }, + { 0x85, "$85" }, + { 0x86, "$86" }, + { 0x87, "DoCommand?" }, + // { 0x88, "$88" }, // Invalid Code + { 0x89, "LineNo?" }, + { 0x8A, "$8A" }, + { 0x8B, "$8B" }, + { 0x8C, "$8C" }, + { 0x8D, "$8D" }, + { 0x8E, "$8E" }, + { 0x8F, "$8F" }, + { 0x90, "$90" }, + { 0x91, "$91" }, + { 0x92, "$92" }, + { 0x93, "$93" }, + { 0x94, "$94" }, + { 0x95, "$95" }, + { 0x96, "$96" }, + { 0x97, "$97" }, + { 0x98, "$98" }, + { 0x99, "$99" }, + { 0x9A, "$9A" }, + { 0x9B, "Copy" }, + { 0x9C, "$9C" }, + { 0x9D, "$9D" }, + { 0x9E, "$9E" }, + { 0x9F, "$9F" }, + { 0xA0, "$A0" }, + { 0xA1, "$A1" }, + { 0xA2, "GetGlobal2" }, + { 0xA3, "GetGlobal" }, + { 0xA4, "GetGlobal4" }, + { 0xA5, "$A5" }, + { 0xA6, "$A6" }, + { 0xA7, "$A7" }, + { 0xA8, "$A8" }, + { 0xA9, "$A9" }, + { 0xAA, "$AA" }, + { 0xAB, "PushConst2" }, + { 0xAC, "CmpConst2" }, + { 0xAD, "$AD" }, + { 0xAE, "$AE" }, + { 0xAF, "SetGlobal" }, + { 0xB0, "$B0" }, + { 0xB1, "SetLocal" }, + { 0xB2, "$B2" }, + { 0xB3, "$B3" }, + { 0xB4, "$B4" }, + { 0xB5, "$B5" }, + { 0xB6, "$B6" }, + { 0xB7, "$B7" }, + { 0xB8, "$B8" }, + { 0xB9, "$B9" }, + { 0xBA, "$BA" }, + { 0xBB, "$BB" }, + { 0xBC, "PushConst" }, + { 0xBD, "GetGlobal3" }, + { 0xBE, "GetArg" }, + { 0xBF, "AdjustStack" }, + { 0xC0, "$C0" }, + { 0xC1, "$C1" }, + { 0xC2, "$C2" }, + { 0xC3, "$C3" }, + { 0xC4, "$C4" }, + { 0xC5, "$C5" }, + { 0xC6, "$C6" }, + { 0xC7, "$C7" }, + { 0xC8, "CmpLocal" }, + { 0xC9, "CmpConst" }, + { 0xCA, "$CA" }, + { 0xCB, "$CB" }, + { 0xCC, "$CC" }, + { 0xCD, "$CD" }, + { 0xCE, "$CE" }, + { 0xCF, "$CF" }, + { 0xD0, "$D0" }, + + { 0xD1, "$D1" }, + { 0xD2, "$D2" }, + { 0xD3, "$D3" }, + { 0xD4, "$D4" }, + { 0xD5, "Mode1" }, + { 0xD6, "Mode2" }, + }; + } +} diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs index 1e91a38262..3fe01ba137 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs @@ -699,55 +699,6 @@ public byte[] Write() } } } - public class Script - { - public int Length => BitConverter.ToInt32(Raw, 0x00); - public uint Magic => BitConverter.ToUInt32(Raw, 0x04); - // case 0x0A0AF1E0: code = read_code_block(f); break; - // case 0x0A0AF1EF: debug = read_debug_block(f); break; - public bool Debug => Magic == 0x0A0AF1EF; - - public ushort PtrOffset => BitConverter.ToUInt16(Raw, 0x08); - public ushort PtrCount => BitConverter.ToUInt16(Raw, 0x0A); - - public int ScriptInstructionStart => BitConverter.ToInt32(Raw, 0x0C); - public int ScriptMovementStart => BitConverter.ToInt32(Raw, 0x10); - public int FinalOffset => BitConverter.ToInt32(Raw, 0x14); - public int AllocatedMemory => BitConverter.ToInt32(Raw, 0x18); - - // Generated Attributes - public int CompressedLength => Length - ScriptInstructionStart; - public byte[] CompressedBytes => Raw.Skip(ScriptInstructionStart).ToArray(); - public int DecompressedLength => FinalOffset - ScriptInstructionStart; - public uint[] DecompressedInstructions => Scripts.quickDecompress(CompressedBytes, DecompressedLength/4); - - public uint[] ScriptCommands => DecompressedInstructions.Take((ScriptMovementStart - ScriptInstructionStart) / 4).ToArray(); - public uint[] MoveCommands => DecompressedInstructions.Skip((ScriptMovementStart - ScriptInstructionStart) / 4).ToArray(); - public string[] ParseScript => Scripts.parseScript(ScriptCommands); - public string[] ParseMoves => Scripts.parseMovement(MoveCommands); - - public string Info => "Data Start: 0x" + ScriptInstructionStart.ToString("X4") - + Environment.NewLine + "Movement Offset: 0x" + ScriptMovementStart.ToString("X4") - + Environment.NewLine + "Total Used Size: 0x" + FinalOffset.ToString("X4") - + Environment.NewLine + "Reserved Size: 0x" + AllocatedMemory.ToString("X4") - + Environment.NewLine + "Compressed Len: 0x" + CompressedLength.ToString("X4") - + Environment.NewLine + "Decompressed Len: 0x" + DecompressedLength.ToString("X4") - + Environment.NewLine + "Compression Ratio: " + - ((DecompressedLength - CompressedLength)/(decimal)DecompressedLength).ToString("p1"); - - public byte[] Raw; - public Script(byte[] data = null) - { - Raw = data ?? new byte[0]; - // sub_51AAFC - if ((Raw[8] & 1) != 0) - throw new ArgumentException("Multi-environment script!?"); - } - public byte[] Write() - { - return Raw; - } - } #endregion } From caa2327b53cd56ac22b245fc496dd2d43669077e Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sun, 17 Dec 2017 13:45:33 -0500 Subject: [PATCH 014/191] Add static/gift shiny lock removal option --- .../Gen6/StaticEncounterEditor6.Designer.cs | 33 +++++++++++----- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 3 ++ .../Gen7/StaticEncounterEditor7.Designer.cs | 39 ++++++++++++------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 9 +++++ 4 files changed, 61 insertions(+), 23 deletions(-) diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index 1a8c87080b..dac85c14ee 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -53,6 +53,7 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); this.CHK_BST = new System.Windows.Forms.CheckBox(); @@ -66,7 +67,7 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); + this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); @@ -336,6 +337,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); @@ -350,11 +352,21 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(7, 58); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 114); + this.GB_Tweak.Size = new System.Drawing.Size(258, 129); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_AllowMega + // + this.CHK_AllowMega.AutoSize = true; + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 94); + this.CHK_AllowMega.Name = "CHK_AllowMega"; + this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); + this.CHK_AllowMega.TabIndex = 296; + this.CHK_AllowMega.Text = "Allow Random Mega Forms"; + this.CHK_AllowMega.UseVisualStyleBackColor = true; + // // CHK_Item // this.CHK_Item.AutoSize = true; @@ -517,15 +529,15 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // CHK_AllowMega + // CHK_RemoveShinyLock // - this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 94); - this.CHK_AllowMega.Name = "CHK_AllowMega"; - this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); - this.CHK_AllowMega.TabIndex = 296; - this.CHK_AllowMega.Text = "Allow Random Mega Forms"; - this.CHK_AllowMega.UseVisualStyleBackColor = true; + this.CHK_RemoveShinyLock.AutoSize = true; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); + this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.TabIndex = 297; + this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; + this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; // // StaticEncounterEditor6 // @@ -601,5 +613,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G1; private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.CheckBox CHK_AllowMega; + private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 619a32b7f0..27506aa941 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -158,6 +158,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_Level.Checked) NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + + if (CHK_RemoveShinyLock.Checked) + CHK_NoShiny.Checked = false; } WinFormsUtil.Alert("Randomized all Static Encounters according to specification!"); } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index bc890852a6..60866672a8 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -77,6 +77,7 @@ private void InitializeComponent() this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); this.CHK_G7 = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); @@ -92,7 +93,7 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); + this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); @@ -644,7 +645,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(231, 74); + this.NUD_LevelBoost.Location = new System.Drawing.Point(231, 65); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -664,7 +665,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(99, 75); + this.CHK_Level.Location = new System.Drawing.Point(99, 66); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 510; @@ -683,6 +684,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.CHK_G7); @@ -696,13 +698,23 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(52, 100); + this.GB_Tweak.Location = new System.Drawing.Point(52, 91); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 130); + this.GB_Tweak.Size = new System.Drawing.Size(258, 144); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_AllowMega + // + this.CHK_AllowMega.AutoSize = true; + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 109); + this.CHK_AllowMega.Name = "CHK_AllowMega"; + this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); + this.CHK_AllowMega.TabIndex = 298; + this.CHK_AllowMega.Text = "Allow Random Mega Forms"; + this.CHK_AllowMega.UseVisualStyleBackColor = true; + // // CHK_Item // this.CHK_Item.AutoSize = true; @@ -872,15 +884,15 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_AllowMega + // CHK_RemoveShinyLock // - this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 109); - this.CHK_AllowMega.Name = "CHK_AllowMega"; - this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); - this.CHK_AllowMega.TabIndex = 298; - this.CHK_AllowMega.Text = "Allow Random Mega Forms"; - this.CHK_AllowMega.UseVisualStyleBackColor = true; + this.CHK_RemoveShinyLock.AutoSize = true; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 124); + this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.TabIndex = 299; + this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; + this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -984,5 +996,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G_Lock; private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.CheckBox CHK_AllowMega; + private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 859533df6b..4bbe0a36f9 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -349,6 +349,9 @@ private void B_Starters_Click(object sender, EventArgs e) if (CHK_Item.Checked) t.HeldItem = items[Util.rnd32() % items.Length]; + if (CHK_RemoveShinyLock.Checked) + t.ShinyLock = false; // in case any user modifications locked the starters + // no level boosting } @@ -382,6 +385,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_Level.Checked) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); + + if (CHK_RemoveShinyLock.Checked) + t.ShinyLock = false; } foreach (EncounterStatic7 t in Encounters) { @@ -394,6 +400,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_Level.Checked) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); + + if (CHK_RemoveShinyLock.Checked) + t.ShinyLock = false; } foreach (EncounterTrade7 t in Trades) { From 98d763d592fabb1815b019e92e6bc785746a03da Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 17 Dec 2017 12:33:41 -0800 Subject: [PATCH 015/191] Misc fixes range check on click move for typechart --- pk3DS/Subforms/Gen6/TypeChart6.cs | 8 +++++++- pk3DS/Subforms/Gen7/TMEditor7.Designer.cs | 9 +++++---- pk3DS/Subforms/Gen7/TypeChart7.cs | 9 +++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pk3DS/Subforms/Gen6/TypeChart6.cs b/pk3DS/Subforms/Gen6/TypeChart6.cs index 88dbb6fd5e..459de25f43 100644 --- a/pk3DS/Subforms/Gen6/TypeChart6.cs +++ b/pk3DS/Subforms/Gen6/TypeChart6.cs @@ -48,13 +48,17 @@ private void moveMouse(object sender, MouseEventArgs e) { GetCoordinate((PictureBox)sender, e, out int X, out int Y); int index = Y * TypeCount + X; - + if (index >= chart.Length) + return; updateLabel(X, Y, chart[index]); } private void clickMouse(object sender, MouseEventArgs e) { GetCoordinate((PictureBox)sender, e, out int X, out int Y); int index = Y * TypeCount + X; + if (index >= chart.Length) + return; + chart[index] = ToggleEffectiveness(chart[index], e.Button == MouseButtons.Left); updateLabel(X, Y, chart[index]); @@ -62,6 +66,8 @@ private void clickMouse(object sender, MouseEventArgs e) } private void updateLabel(int X, int Y, int value) { + if (value >= effects.Length || X >= types.Length || Y >= types.Length) + return; // clicking and moving outside the box has invalid values L_Hover.Text = $"[{X:00}x{Y:00}: {value:00}] {types[Y]} attacking {types[X]} {effects[value]}"; } private readonly string[] effects = diff --git a/pk3DS/Subforms/Gen7/TMEditor7.Designer.cs b/pk3DS/Subforms/Gen7/TMEditor7.Designer.cs index 350bf49e05..ea7b5c9e8a 100644 --- a/pk3DS/Subforms/Gen7/TMEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/TMEditor7.Designer.cs @@ -40,8 +40,9 @@ private void InitializeComponent() this.dgvTM.AllowUserToDeleteRows = false; this.dgvTM.AllowUserToResizeColumns = false; this.dgvTM.AllowUserToResizeRows = false; - this.dgvTM.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); + this.dgvTM.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.dgvTM.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvTM.Location = new System.Drawing.Point(9, 25); this.dgvTM.Name = "dgvTM"; @@ -67,7 +68,7 @@ private void InitializeComponent() this.B_RTM.UseVisualStyleBackColor = true; this.B_RTM.Click += new System.EventHandler(this.B_RandomTM_Click); // - // TMHMEditor7 + // TMEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -78,7 +79,7 @@ private void InitializeComponent() this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(520, 670); this.MinimumSize = new System.Drawing.Size(275, 370); - this.Name = "TMHMEditor7"; + this.Name = "TMEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "TM Editor"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); diff --git a/pk3DS/Subforms/Gen7/TypeChart7.cs b/pk3DS/Subforms/Gen7/TypeChart7.cs index 1e109b3fc9..499fab27fe 100644 --- a/pk3DS/Subforms/Gen7/TypeChart7.cs +++ b/pk3DS/Subforms/Gen7/TypeChart7.cs @@ -62,21 +62,26 @@ private void moveMouse(object sender, MouseEventArgs e) { TypeChart6.GetCoordinate((PictureBox)sender, e, out int X, out int Y); int index = Y*TypeCount + X; - + if (index >= chart.Length) + return; updateLabel(X, Y, chart[index]); } private void clickMouse(object sender, MouseEventArgs e) { TypeChart6.GetCoordinate((PictureBox)sender, e, out int X, out int Y); int index = Y * TypeCount + X; + if (index >= chart.Length) + return; + chart[index] = TypeChart6.ToggleEffectiveness(chart[index], e.Button == MouseButtons.Left); updateLabel(X, Y, chart[index]); populateChart(); } - private void updateLabel(int X, int Y, int value) { + if (value >= effects.Length || X >= types.Length || Y >= types.Length) + return; // clicking and moving outside the box has invalid values L_Hover.Text = $"[{X:00}x{Y:00}: {value:00}] {types[Y]} attacking {types[X]} {effects[value]}"; } private readonly string[] effects = From 5c567a559b85142f3bf046d91461e3230c55f82b Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 18 Dec 2017 00:06:07 -0500 Subject: [PATCH 016/191] Expose Gen 6 gift shiny locks --- pk3DS.Core/Structures/Gen6/EncounterGift6.cs | 2 + pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 61 ++++++++++++-------- pk3DS/Subforms/Gen6/GiftEditor6.cs | 2 + 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs index 24237480df..08e47a0acc 100644 --- a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs +++ b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs @@ -29,6 +29,8 @@ public class EncounterGift6 // All public byte uLast; + public bool ShinyLock { get { return (Data[0x6] & 2) >> 1 == 1; } set { Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0)); } } + public EncounterGift6(byte[] data, bool oras) { Data = data; diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index de66812e66..7a4fddf438 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -79,6 +79,7 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); + this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); @@ -142,14 +143,14 @@ private void InitializeComponent() // CB_HeldItem // this.CB_HeldItem.FormattingEnabled = true; - this.CB_HeldItem.Location = new System.Drawing.Point(106, 30); + this.CB_HeldItem.Location = new System.Drawing.Point(106, 28); this.CB_HeldItem.Name = "CB_HeldItem"; this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); this.CB_HeldItem.TabIndex = 470; // // NUD_IV0 // - this.NUD_IV0.Location = new System.Drawing.Point(112, 141); + this.NUD_IV0.Location = new System.Drawing.Point(139, 152); this.NUD_IV0.Maximum = new decimal(new int[] { 31, 0, @@ -171,7 +172,7 @@ private void InitializeComponent() // // NUD_IV1 // - this.NUD_IV1.Location = new System.Drawing.Point(112, 164); + this.NUD_IV1.Location = new System.Drawing.Point(139, 175); this.NUD_IV1.Maximum = new decimal(new int[] { 31, 0, @@ -193,7 +194,7 @@ private void InitializeComponent() // // NUD_IV2 // - this.NUD_IV2.Location = new System.Drawing.Point(112, 187); + this.NUD_IV2.Location = new System.Drawing.Point(139, 198); this.NUD_IV2.Maximum = new decimal(new int[] { 31, 0, @@ -215,7 +216,7 @@ private void InitializeComponent() // // NUD_IV3 // - this.NUD_IV3.Location = new System.Drawing.Point(193, 141); + this.NUD_IV3.Location = new System.Drawing.Point(220, 152); this.NUD_IV3.Maximum = new decimal(new int[] { 31, 0, @@ -237,7 +238,7 @@ private void InitializeComponent() // // NUD_IV4 // - this.NUD_IV4.Location = new System.Drawing.Point(193, 164); + this.NUD_IV4.Location = new System.Drawing.Point(220, 175); this.NUD_IV4.Maximum = new decimal(new int[] { 31, 0, @@ -259,7 +260,7 @@ private void InitializeComponent() // // NUD_IV5 // - this.NUD_IV5.Location = new System.Drawing.Point(193, 187); + this.NUD_IV5.Location = new System.Drawing.Point(220, 198); this.NUD_IV5.Maximum = new decimal(new int[] { 31, 0, @@ -290,7 +291,7 @@ private void InitializeComponent() // // L_HeldItem // - this.L_HeldItem.Location = new System.Drawing.Point(6, 29); + this.L_HeldItem.Location = new System.Drawing.Point(6, 27); this.L_HeldItem.Name = "L_HeldItem"; this.L_HeldItem.Size = new System.Drawing.Size(94, 21); this.L_HeldItem.TabIndex = 478; @@ -299,7 +300,7 @@ private void InitializeComponent() // // NUD_Level // - this.NUD_Level.Location = new System.Drawing.Point(106, 57); + this.NUD_Level.Location = new System.Drawing.Point(133, 77); this.NUD_Level.Name = "NUD_Level"; this.NUD_Level.Size = new System.Drawing.Size(41, 20); this.NUD_Level.TabIndex = 479; @@ -311,7 +312,7 @@ private void InitializeComponent() // // L_Level // - this.L_Level.Location = new System.Drawing.Point(7, 55); + this.L_Level.Location = new System.Drawing.Point(38, 75); this.L_Level.Name = "L_Level"; this.L_Level.Size = new System.Drawing.Size(94, 21); this.L_Level.TabIndex = 480; @@ -320,14 +321,14 @@ private void InitializeComponent() // // NUD_Form // - this.NUD_Form.Location = new System.Drawing.Point(193, 57); + this.NUD_Form.Location = new System.Drawing.Point(220, 77); this.NUD_Form.Name = "NUD_Form"; this.NUD_Form.Size = new System.Drawing.Size(34, 20); this.NUD_Form.TabIndex = 481; // // L_Form // - this.L_Form.Location = new System.Drawing.Point(99, 55); + this.L_Form.Location = new System.Drawing.Point(126, 75); this.L_Form.Name = "L_Form"; this.L_Form.Size = new System.Drawing.Size(94, 21); this.L_Form.TabIndex = 482; @@ -336,7 +337,7 @@ private void InitializeComponent() // // L_HP // - this.L_HP.Location = new System.Drawing.Point(18, 139); + this.L_HP.Location = new System.Drawing.Point(45, 150); this.L_HP.Name = "L_HP"; this.L_HP.Size = new System.Drawing.Size(94, 21); this.L_HP.TabIndex = 483; @@ -345,7 +346,7 @@ private void InitializeComponent() // // L_ATK // - this.L_ATK.Location = new System.Drawing.Point(18, 162); + this.L_ATK.Location = new System.Drawing.Point(45, 173); this.L_ATK.Name = "L_ATK"; this.L_ATK.Size = new System.Drawing.Size(94, 21); this.L_ATK.TabIndex = 484; @@ -354,7 +355,7 @@ private void InitializeComponent() // // L_DEF // - this.L_DEF.Location = new System.Drawing.Point(18, 185); + this.L_DEF.Location = new System.Drawing.Point(45, 196); this.L_DEF.Name = "L_DEF"; this.L_DEF.Size = new System.Drawing.Size(94, 21); this.L_DEF.TabIndex = 485; @@ -363,7 +364,7 @@ private void InitializeComponent() // // L_SPA // - this.L_SPA.Location = new System.Drawing.Point(99, 139); + this.L_SPA.Location = new System.Drawing.Point(126, 150); this.L_SPA.Name = "L_SPA"; this.L_SPA.Size = new System.Drawing.Size(94, 21); this.L_SPA.TabIndex = 486; @@ -372,7 +373,7 @@ private void InitializeComponent() // // L_SPE // - this.L_SPE.Location = new System.Drawing.Point(99, 185); + this.L_SPE.Location = new System.Drawing.Point(126, 196); this.L_SPE.Name = "L_SPE"; this.L_SPE.Size = new System.Drawing.Size(94, 21); this.L_SPE.TabIndex = 487; @@ -381,7 +382,7 @@ private void InitializeComponent() // // L_SPD // - this.L_SPD.Location = new System.Drawing.Point(99, 162); + this.L_SPD.Location = new System.Drawing.Point(126, 173); this.L_SPD.Name = "L_SPD"; this.L_SPD.Size = new System.Drawing.Size(94, 21); this.L_SPD.TabIndex = 488; @@ -390,7 +391,7 @@ private void InitializeComponent() // // L_Nature // - this.L_Nature.Location = new System.Drawing.Point(7, 77); + this.L_Nature.Location = new System.Drawing.Point(37, 97); this.L_Nature.Name = "L_Nature"; this.L_Nature.Size = new System.Drawing.Size(94, 21); this.L_Nature.TabIndex = 490; @@ -399,7 +400,7 @@ private void InitializeComponent() // // NUD_Nature // - this.NUD_Nature.Location = new System.Drawing.Point(106, 79); + this.NUD_Nature.Location = new System.Drawing.Point(133, 99); this.NUD_Nature.Maximum = new decimal(new int[] { 24, 0, @@ -421,7 +422,7 @@ private void InitializeComponent() // // L_Ability // - this.L_Ability.Location = new System.Drawing.Point(99, 77); + this.L_Ability.Location = new System.Drawing.Point(126, 97); this.L_Ability.Name = "L_Ability"; this.L_Ability.Size = new System.Drawing.Size(94, 21); this.L_Ability.TabIndex = 493; @@ -430,7 +431,7 @@ private void InitializeComponent() // // NUD_Ability // - this.NUD_Ability.Location = new System.Drawing.Point(193, 79); + this.NUD_Ability.Location = new System.Drawing.Point(220, 99); this.NUD_Ability.Maximum = new decimal(new int[] { 2, 0, @@ -447,7 +448,7 @@ private void InitializeComponent() // // L_Gender // - this.L_Gender.Location = new System.Drawing.Point(99, 100); + this.L_Gender.Location = new System.Drawing.Point(126, 120); this.L_Gender.Name = "L_Gender"; this.L_Gender.Size = new System.Drawing.Size(94, 21); this.L_Gender.TabIndex = 495; @@ -456,7 +457,7 @@ private void InitializeComponent() // // NUD_Gender // - this.NUD_Gender.Location = new System.Drawing.Point(193, 102); + this.NUD_Gender.Location = new System.Drawing.Point(220, 122); this.NUD_Gender.Maximum = new decimal(new int[] { 2, 0, @@ -489,6 +490,7 @@ private void InitializeComponent() // // tabPage1 // + this.tabPage1.Controls.Add(this.CHK_ShinyLock); this.tabPage1.Controls.Add(this.label1); this.tabPage1.Controls.Add(this.L_DEF); this.tabPage1.Controls.Add(this.L_ATK); @@ -761,6 +763,16 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // + // CHK_ShinyLock + // + this.CHK_ShinyLock.AutoSize = true; + this.CHK_ShinyLock.Location = new System.Drawing.Point(106, 54); + this.CHK_ShinyLock.Name = "CHK_ShinyLock"; + this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); + this.CHK_ShinyLock.TabIndex = 503; + this.CHK_ShinyLock.Text = "Shiny Lock"; + this.CHK_ShinyLock.UseVisualStyleBackColor = true; + // // GiftEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -854,5 +866,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Mega; private System.Windows.Forms.Label L_Mega; private System.Windows.Forms.CheckBox CHK_Item; + private System.Windows.Forms.CheckBox CHK_ShinyLock; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 64fe45d553..b9531953cd 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -139,6 +139,7 @@ private void loadEntry() NUD_Nature.Value = GiftData[entry].Nature; NUD_Ability.Value = GiftData[entry].Ability; NUD_Gender.Value = GiftData[entry].Gender; + CHK_ShinyLock.Checked = GiftData[entry].ShinyLock; NUD_IV0.Value = GiftData[entry].IVs[0]; NUD_IV1.Value = GiftData[entry].IVs[1]; @@ -157,6 +158,7 @@ private void saveEntry() GiftData[entry].Nature = (sbyte)NUD_Nature.Value; GiftData[entry].Ability = (sbyte)NUD_Ability.Value; GiftData[entry].Gender = (sbyte)NUD_Gender.Value; + GiftData[entry].ShinyLock = CHK_ShinyLock.Checked; GiftData[entry].IVs[0] = (sbyte)NUD_IV0.Value; GiftData[entry].IVs[1] = (sbyte)NUD_IV1.Value; From d448426c16b7e7800c4c7347cb0f365644e4c6d6 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 18 Dec 2017 13:13:48 -0500 Subject: [PATCH 017/191] Misc changes --- .../Structures/Gen7/EncounterStatic7.cs | 19 + pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 35 +- pk3DS/Subforms/Gen6/GiftEditor6.cs | 3 + .../Gen7/StaticEncounterEditor7.Designer.cs | 603 ++++++++++++++++-- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 45 ++ 5 files changed, 655 insertions(+), 50 deletions(-) diff --git a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs index e89a04f17b..6b4213dcea 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs @@ -108,6 +108,25 @@ public int[] IVs Data[i + 0x15] = (byte)Convert.ToSByte(value[i]); } } + public int[] EVs { + get => new int[] + { + (byte) Data[0x1B], (byte) Data[0x1C], (byte) Data[0x1D], (byte) Data[0x1E], (byte) Data[0x1F], (byte) Data[0x20] + }; + set + { + if (value.Length != 6) + return; + for (int i = 0; i < 6; i++) + Data[i + 0x15] = (byte)Convert.ToSByte(value[i]); + } + } + public int Aura + { + get => Data[0x25]; + set => Data[0x25] = (byte)value; + } + public bool IV3 => (sbyte) Data[0x15] < 0 && (sbyte) Data[0x15] + 1 == -3; public string GetSummary() diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index 7a4fddf438..77c5d01f56 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -60,6 +60,7 @@ private void InitializeComponent() this.B_RandAll = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label(); this.L_Hint = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); @@ -79,7 +80,7 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); + this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); @@ -527,6 +528,16 @@ private void InitializeComponent() this.tabPage1.Text = "Editor"; this.tabPage1.UseVisualStyleBackColor = true; // + // CHK_ShinyLock + // + this.CHK_ShinyLock.AutoSize = true; + this.CHK_ShinyLock.Location = new System.Drawing.Point(106, 54); + this.CHK_ShinyLock.Name = "CHK_ShinyLock"; + this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); + this.CHK_ShinyLock.TabIndex = 503; + this.CHK_ShinyLock.Text = "Shiny Lock"; + this.CHK_ShinyLock.UseVisualStyleBackColor = true; + // // label1 // this.label1.AutoSize = true; @@ -583,6 +594,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); @@ -594,9 +606,9 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(7, 62); + this.GB_Tweak.Location = new System.Drawing.Point(7, 52); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 99); + this.GB_Tweak.Size = new System.Drawing.Size(258, 113); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -763,15 +775,15 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // CHK_ShinyLock + // CHK_RemoveShinyLock // - this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(106, 54); - this.CHK_ShinyLock.Name = "CHK_ShinyLock"; - this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); - this.CHK_ShinyLock.TabIndex = 503; - this.CHK_ShinyLock.Text = "Shiny Lock"; - this.CHK_ShinyLock.UseVisualStyleBackColor = true; + this.CHK_RemoveShinyLock.AutoSize = true; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 94); + this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.TabIndex = 297; + this.CHK_RemoveShinyLock.Text = "Random Shiny Locks"; + this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; // // GiftEditor6 // @@ -867,5 +879,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Mega; private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.CheckBox CHK_ShinyLock; + private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index b9531953cd..8344334537 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -215,6 +215,9 @@ private void B_RandAll_Click(object sender, EventArgs e) NUD_Form.Value = formrand.GetRandomForme(species); NUD_Gender.Value = 0; // random + if (CHK_RemoveShinyLock.Checked) + CHK_ShinyLock.Checked = false; + if (CHK_Level.Checked) NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 60866672a8..b6ebf2dc0b 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -42,6 +42,36 @@ private void InitializeComponent() this.NUD_GLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); + this.CB_Nature = new System.Windows.Forms.ComboBox(); + this.L_Nature = new System.Windows.Forms.Label(); + this.GB_EVs = new System.Windows.Forms.GroupBox(); + this.NUD_EV5 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EV4 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EV3 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EV2 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EV1 = new System.Windows.Forms.NumericUpDown(); + this.label2 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.NUD_EV0 = new System.Windows.Forms.NumericUpDown(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.GB_IVs = new System.Windows.Forms.GroupBox(); + this.L_HP = new System.Windows.Forms.Label(); + this.NUD_IV3 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV4 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV5 = new System.Windows.Forms.NumericUpDown(); + this.L_SPD = new System.Windows.Forms.Label(); + this.L_SPE = new System.Windows.Forms.Label(); + this.L_SPA = new System.Windows.Forms.Label(); + this.NUD_IV2 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV1 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV0 = new System.Windows.Forms.NumericUpDown(); + this.L_ATK = new System.Windows.Forms.Label(); + this.L_DEF = new System.Windows.Forms.Label(); + this.L_Aura = new System.Windows.Forms.Label(); + this.CB_Aura = new System.Windows.Forms.ComboBox(); this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); this.GB_EMoves = new System.Windows.Forms.GroupBox(); this.CB_EMove3 = new System.Windows.Forms.ComboBox(); @@ -77,6 +107,7 @@ private void InitializeComponent() this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); this.CHK_G7 = new System.Windows.Forms.CheckBox(); @@ -93,13 +124,27 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); + this.CHK_IV3 = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).BeginInit(); this.Tab_Encounters.SuspendLayout(); + this.GB_EVs.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV0)).BeginInit(); + this.GB_IVs.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); this.GB_EMoves.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).BeginInit(); @@ -124,7 +169,7 @@ private void InitializeComponent() this.TC_Tabs.Location = new System.Drawing.Point(12, 12); this.TC_Tabs.Name = "TC_Tabs"; this.TC_Tabs.SelectedIndex = 0; - this.TC_Tabs.Size = new System.Drawing.Size(395, 347); + this.TC_Tabs.Size = new System.Drawing.Size(506, 463); this.TC_Tabs.TabIndex = 0; // // Tab_Gifts @@ -142,7 +187,7 @@ private void InitializeComponent() this.Tab_Gifts.Controls.Add(this.LB_Gift); this.Tab_Gifts.Location = new System.Drawing.Point(4, 22); this.Tab_Gifts.Name = "Tab_Gifts"; - this.Tab_Gifts.Size = new System.Drawing.Size(387, 321); + this.Tab_Gifts.Size = new System.Drawing.Size(498, 437); this.Tab_Gifts.TabIndex = 2; this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; @@ -268,12 +313,19 @@ private void InitializeComponent() this.LB_Gift.FormattingEnabled = true; this.LB_Gift.Location = new System.Drawing.Point(3, 3); this.LB_Gift.Name = "LB_Gift"; - this.LB_Gift.Size = new System.Drawing.Size(115, 316); + this.LB_Gift.Size = new System.Drawing.Size(115, 420); this.LB_Gift.TabIndex = 0; this.LB_Gift.SelectedIndexChanged += new System.EventHandler(this.LB_Gift_SelectedIndexChanged); // // Tab_Encounters // + this.Tab_Encounters.Controls.Add(this.CHK_IV3); + this.Tab_Encounters.Controls.Add(this.CB_Nature); + this.Tab_Encounters.Controls.Add(this.L_Nature); + this.Tab_Encounters.Controls.Add(this.GB_EVs); + this.Tab_Encounters.Controls.Add(this.GB_IVs); + this.Tab_Encounters.Controls.Add(this.L_Aura); + this.Tab_Encounters.Controls.Add(this.CB_Aura); this.Tab_Encounters.Controls.Add(this.CHK_ShinyLock); this.Tab_Encounters.Controls.Add(this.GB_EMoves); this.Tab_Encounters.Controls.Add(this.CB_EHeldItem); @@ -288,15 +340,433 @@ private void InitializeComponent() this.Tab_Encounters.Location = new System.Drawing.Point(4, 22); this.Tab_Encounters.Name = "Tab_Encounters"; this.Tab_Encounters.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Encounters.Size = new System.Drawing.Size(387, 321); + this.Tab_Encounters.Size = new System.Drawing.Size(498, 437); this.Tab_Encounters.TabIndex = 0; this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // + // CB_Nature + // + this.CB_Nature.FormattingEnabled = true; + this.CB_Nature.Location = new System.Drawing.Point(187, 98); + this.CB_Nature.Name = "CB_Nature"; + this.CB_Nature.Size = new System.Drawing.Size(121, 21); + this.CB_Nature.TabIndex = 503; + // + // L_Nature + // + this.L_Nature.Location = new System.Drawing.Point(124, 96); + this.L_Nature.Name = "L_Nature"; + this.L_Nature.Size = new System.Drawing.Size(62, 23); + this.L_Nature.TabIndex = 502; + this.L_Nature.Text = "Nature:"; + this.L_Nature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // GB_EVs + // + this.GB_EVs.Controls.Add(this.NUD_EV5); + this.GB_EVs.Controls.Add(this.NUD_EV4); + this.GB_EVs.Controls.Add(this.NUD_EV3); + this.GB_EVs.Controls.Add(this.NUD_EV2); + this.GB_EVs.Controls.Add(this.NUD_EV1); + this.GB_EVs.Controls.Add(this.label2); + this.GB_EVs.Controls.Add(this.label7); + this.GB_EVs.Controls.Add(this.label6); + this.GB_EVs.Controls.Add(this.NUD_EV0); + this.GB_EVs.Controls.Add(this.label3); + this.GB_EVs.Controls.Add(this.label4); + this.GB_EVs.Controls.Add(this.label5); + this.GB_EVs.Location = new System.Drawing.Point(284, 295); + this.GB_EVs.Name = "GB_EVs"; + this.GB_EVs.Size = new System.Drawing.Size(160, 112); + this.GB_EVs.TabIndex = 501; + this.GB_EVs.TabStop = false; + this.GB_EVs.Text = "EVs"; + // + // NUD_EV5 + // + this.NUD_EV5.Location = new System.Drawing.Point(111, 82); + this.NUD_EV5.Maximum = new decimal(new int[] { + 252, + 0, + 0, + 0}); + this.NUD_EV5.Name = "NUD_EV5"; + this.NUD_EV5.Size = new System.Drawing.Size(40, 20); + this.NUD_EV5.TabIndex = 515; + this.NUD_EV5.Value = new decimal(new int[] { + 252, + 0, + 0, + 0}); + // + // NUD_EV4 + // + this.NUD_EV4.Location = new System.Drawing.Point(111, 51); + this.NUD_EV4.Maximum = new decimal(new int[] { + 252, + 0, + 0, + 0}); + this.NUD_EV4.Name = "NUD_EV4"; + this.NUD_EV4.Size = new System.Drawing.Size(40, 20); + this.NUD_EV4.TabIndex = 516; + this.NUD_EV4.Value = new decimal(new int[] { + 252, + 0, + 0, + 0}); + // + // NUD_EV3 + // + this.NUD_EV3.Location = new System.Drawing.Point(111, 20); + this.NUD_EV3.Maximum = new decimal(new int[] { + 252, + 0, + 0, + 0}); + this.NUD_EV3.Name = "NUD_EV3"; + this.NUD_EV3.Size = new System.Drawing.Size(40, 20); + this.NUD_EV3.TabIndex = 514; + this.NUD_EV3.Value = new decimal(new int[] { + 252, + 0, + 0, + 0}); + // + // NUD_EV2 + // + this.NUD_EV2.Location = new System.Drawing.Point(33, 82); + this.NUD_EV2.Maximum = new decimal(new int[] { + 252, + 0, + 0, + 0}); + this.NUD_EV2.Name = "NUD_EV2"; + this.NUD_EV2.Size = new System.Drawing.Size(40, 20); + this.NUD_EV2.TabIndex = 502; + this.NUD_EV2.Value = new decimal(new int[] { + 252, + 0, + 0, + 0}); + // + // NUD_EV1 + // + this.NUD_EV1.Location = new System.Drawing.Point(33, 51); + this.NUD_EV1.Maximum = new decimal(new int[] { + 252, + 0, + 0, + 0}); + this.NUD_EV1.Name = "NUD_EV1"; + this.NUD_EV1.Size = new System.Drawing.Size(40, 20); + this.NUD_EV1.TabIndex = 513; + this.NUD_EV1.Value = new decimal(new int[] { + 252, + 0, + 0, + 0}); + // + // label2 + // + this.label2.Location = new System.Drawing.Point(4, 18); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(29, 21); + this.label2.TabIndex = 507; + this.label2.Text = "HP:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label7 + // + this.label7.Location = new System.Drawing.Point(4, 80); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(29, 21); + this.label7.TabIndex = 509; + this.label7.Text = "Def:"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label6 + // + this.label6.Location = new System.Drawing.Point(7, 49); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(26, 21); + this.label6.TabIndex = 508; + this.label6.Text = "Atk:"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_EV0 + // + this.NUD_EV0.Location = new System.Drawing.Point(33, 20); + this.NUD_EV0.Maximum = new decimal(new int[] { + 252, + 0, + 0, + 0}); + this.NUD_EV0.Name = "NUD_EV0"; + this.NUD_EV0.Size = new System.Drawing.Size(40, 20); + this.NUD_EV0.TabIndex = 501; + this.NUD_EV0.Value = new decimal(new int[] { + 252, + 0, + 0, + 0}); + // + // label3 + // + this.label3.Location = new System.Drawing.Point(79, 49); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(31, 21); + this.label3.TabIndex = 512; + this.label3.Text = "SpD:"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label4 + // + this.label4.Location = new System.Drawing.Point(79, 80); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(31, 21); + this.label4.TabIndex = 511; + this.label4.Text = "Spe:"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label5 + // + this.label5.Location = new System.Drawing.Point(79, 18); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(31, 21); + this.label5.TabIndex = 510; + this.label5.Text = "SpA:"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // GB_IVs + // + this.GB_IVs.Controls.Add(this.L_HP); + this.GB_IVs.Controls.Add(this.NUD_IV3); + this.GB_IVs.Controls.Add(this.NUD_IV4); + this.GB_IVs.Controls.Add(this.NUD_IV5); + this.GB_IVs.Controls.Add(this.L_SPD); + this.GB_IVs.Controls.Add(this.L_SPE); + this.GB_IVs.Controls.Add(this.L_SPA); + this.GB_IVs.Controls.Add(this.NUD_IV2); + this.GB_IVs.Controls.Add(this.NUD_IV1); + this.GB_IVs.Controls.Add(this.NUD_IV0); + this.GB_IVs.Controls.Add(this.L_ATK); + this.GB_IVs.Controls.Add(this.L_DEF); + this.GB_IVs.Location = new System.Drawing.Point(129, 295); + this.GB_IVs.Name = "GB_IVs"; + this.GB_IVs.Size = new System.Drawing.Size(148, 112); + this.GB_IVs.TabIndex = 21; + this.GB_IVs.TabStop = false; + this.GB_IVs.Text = "IVs"; + // + // L_HP + // + this.L_HP.Location = new System.Drawing.Point(4, 16); + this.L_HP.Name = "L_HP"; + this.L_HP.Size = new System.Drawing.Size(29, 21); + this.L_HP.TabIndex = 495; + this.L_HP.Text = "HP:"; + this.L_HP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_IV3 + // + this.NUD_IV3.Location = new System.Drawing.Point(104, 18); + this.NUD_IV3.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV3.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_IV3.Name = "NUD_IV3"; + this.NUD_IV3.Size = new System.Drawing.Size(34, 20); + this.NUD_IV3.TabIndex = 492; + this.NUD_IV3.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV4 + // + this.NUD_IV4.Location = new System.Drawing.Point(104, 49); + this.NUD_IV4.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV4.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_IV4.Name = "NUD_IV4"; + this.NUD_IV4.Size = new System.Drawing.Size(34, 20); + this.NUD_IV4.TabIndex = 493; + this.NUD_IV4.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV5 + // + this.NUD_IV5.Location = new System.Drawing.Point(104, 80); + this.NUD_IV5.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV5.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_IV5.Name = "NUD_IV5"; + this.NUD_IV5.Size = new System.Drawing.Size(34, 20); + this.NUD_IV5.TabIndex = 494; + this.NUD_IV5.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // L_SPD + // + this.L_SPD.Location = new System.Drawing.Point(73, 47); + this.L_SPD.Name = "L_SPD"; + this.L_SPD.Size = new System.Drawing.Size(31, 21); + this.L_SPD.TabIndex = 500; + this.L_SPD.Text = "SpD:"; + this.L_SPD.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_SPE + // + this.L_SPE.Location = new System.Drawing.Point(73, 78); + this.L_SPE.Name = "L_SPE"; + this.L_SPE.Size = new System.Drawing.Size(31, 21); + this.L_SPE.TabIndex = 499; + this.L_SPE.Text = "Spe:"; + this.L_SPE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_SPA + // + this.L_SPA.Location = new System.Drawing.Point(73, 16); + this.L_SPA.Name = "L_SPA"; + this.L_SPA.Size = new System.Drawing.Size(31, 21); + this.L_SPA.TabIndex = 498; + this.L_SPA.Text = "SpA:"; + this.L_SPA.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_IV2 + // + this.NUD_IV2.Location = new System.Drawing.Point(33, 80); + this.NUD_IV2.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV2.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_IV2.Name = "NUD_IV2"; + this.NUD_IV2.Size = new System.Drawing.Size(34, 20); + this.NUD_IV2.TabIndex = 491; + this.NUD_IV2.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV1 + // + this.NUD_IV1.Location = new System.Drawing.Point(33, 49); + this.NUD_IV1.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV1.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_IV1.Name = "NUD_IV1"; + this.NUD_IV1.Size = new System.Drawing.Size(34, 20); + this.NUD_IV1.TabIndex = 490; + this.NUD_IV1.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV0 + // + this.NUD_IV0.Location = new System.Drawing.Point(33, 18); + this.NUD_IV0.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV0.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_IV0.Name = "NUD_IV0"; + this.NUD_IV0.Size = new System.Drawing.Size(34, 20); + this.NUD_IV0.TabIndex = 489; + this.NUD_IV0.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // L_ATK + // + this.L_ATK.Location = new System.Drawing.Point(7, 47); + this.L_ATK.Name = "L_ATK"; + this.L_ATK.Size = new System.Drawing.Size(26, 21); + this.L_ATK.TabIndex = 496; + this.L_ATK.Text = "Atk:"; + this.L_ATK.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_DEF + // + this.L_DEF.Location = new System.Drawing.Point(4, 78); + this.L_DEF.Name = "L_DEF"; + this.L_DEF.Size = new System.Drawing.Size(29, 21); + this.L_DEF.TabIndex = 497; + this.L_DEF.Text = "Def:"; + this.L_DEF.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_Aura + // + this.L_Aura.Location = new System.Drawing.Point(147, 119); + this.L_Aura.Name = "L_Aura"; + this.L_Aura.Size = new System.Drawing.Size(40, 23); + this.L_Aura.TabIndex = 22; + this.L_Aura.Text = "Aura:"; + this.L_Aura.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Aura + // + this.CB_Aura.FormattingEnabled = true; + this.CB_Aura.Location = new System.Drawing.Point(187, 121); + this.CB_Aura.Name = "CB_Aura"; + this.CB_Aura.Size = new System.Drawing.Size(121, 21); + this.CB_Aura.TabIndex = 21; + // // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(218, 232); + this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 146); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); this.CHK_ShinyLock.TabIndex = 18; @@ -309,7 +779,7 @@ private void InitializeComponent() this.GB_EMoves.Controls.Add(this.CB_EMove2); this.GB_EMoves.Controls.Add(this.CB_EMove1); this.GB_EMoves.Controls.Add(this.CB_EMove0); - this.GB_EMoves.Location = new System.Drawing.Point(218, 114); + this.GB_EMoves.Location = new System.Drawing.Point(129, 177); this.GB_EMoves.Name = "GB_EMoves"; this.GB_EMoves.Size = new System.Drawing.Size(133, 112); this.GB_EMoves.TabIndex = 17; @@ -351,16 +821,16 @@ private void InitializeComponent() // CB_EHeldItem // this.CB_EHeldItem.FormattingEnabled = true; - this.CB_EHeldItem.Location = new System.Drawing.Point(230, 87); + this.CB_EHeldItem.Location = new System.Drawing.Point(187, 75); this.CB_EHeldItem.Name = "CB_EHeldItem"; this.CB_EHeldItem.Size = new System.Drawing.Size(121, 21); this.CB_EHeldItem.TabIndex = 16; // // L_EHeldItem // - this.L_EHeldItem.Location = new System.Drawing.Point(124, 85); + this.L_EHeldItem.Location = new System.Drawing.Point(124, 73); this.L_EHeldItem.Name = "L_EHeldItem"; - this.L_EHeldItem.Size = new System.Drawing.Size(100, 23); + this.L_EHeldItem.Size = new System.Drawing.Size(62, 23); this.L_EHeldItem.TabIndex = 15; this.L_EHeldItem.Text = "Held Item:"; this.L_EHeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -368,7 +838,7 @@ private void InitializeComponent() // CB_ESpecies // this.CB_ESpecies.FormattingEnabled = true; - this.CB_ESpecies.Location = new System.Drawing.Point(230, 18); + this.CB_ESpecies.Location = new System.Drawing.Point(187, 7); this.CB_ESpecies.Name = "CB_ESpecies"; this.CB_ESpecies.Size = new System.Drawing.Size(121, 21); this.CB_ESpecies.TabIndex = 14; @@ -376,16 +846,16 @@ private void InitializeComponent() // // L_EForm // - this.L_EForm.Location = new System.Drawing.Point(124, 62); + this.L_EForm.Location = new System.Drawing.Point(143, 50); this.L_EForm.Name = "L_EForm"; - this.L_EForm.Size = new System.Drawing.Size(100, 23); + this.L_EForm.Size = new System.Drawing.Size(43, 23); this.L_EForm.TabIndex = 13; this.L_EForm.Text = "Form:"; this.L_EForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_EForm // - this.NUD_EForm.Location = new System.Drawing.Point(230, 65); + this.NUD_EForm.Location = new System.Drawing.Point(187, 53); this.NUD_EForm.Maximum = new decimal(new int[] { 255, 0, @@ -402,25 +872,25 @@ private void InitializeComponent() // // L_ELevel // - this.L_ELevel.Location = new System.Drawing.Point(124, 39); + this.L_ELevel.Location = new System.Drawing.Point(140, 27); this.L_ELevel.Name = "L_ELevel"; - this.L_ELevel.Size = new System.Drawing.Size(100, 23); + this.L_ELevel.Size = new System.Drawing.Size(46, 23); this.L_ELevel.TabIndex = 11; this.L_ELevel.Text = "Level:"; this.L_ELevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_ESpecies // - this.L_ESpecies.Location = new System.Drawing.Point(124, 16); + this.L_ESpecies.Location = new System.Drawing.Point(131, 5); this.L_ESpecies.Name = "L_ESpecies"; - this.L_ESpecies.Size = new System.Drawing.Size(100, 23); + this.L_ESpecies.Size = new System.Drawing.Size(55, 23); this.L_ESpecies.TabIndex = 10; this.L_ESpecies.Text = "Species:"; this.L_ESpecies.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_ELevel // - this.NUD_ELevel.Location = new System.Drawing.Point(230, 42); + this.NUD_ELevel.Location = new System.Drawing.Point(187, 30); this.NUD_ELevel.Maximum = new decimal(new int[] { 255, 0, @@ -442,7 +912,7 @@ private void InitializeComponent() this.LB_Encounter.FormattingEnabled = true; this.LB_Encounter.Location = new System.Drawing.Point(3, 3); this.LB_Encounter.Name = "LB_Encounter"; - this.LB_Encounter.Size = new System.Drawing.Size(115, 316); + this.LB_Encounter.Size = new System.Drawing.Size(115, 407); this.LB_Encounter.TabIndex = 1; this.LB_Encounter.SelectedIndexChanged += new System.EventHandler(this.LB_Encounter_SelectedIndexChanged); // @@ -465,7 +935,7 @@ private void InitializeComponent() this.Tab_Trades.Location = new System.Drawing.Point(4, 22); this.Tab_Trades.Name = "Tab_Trades"; this.Tab_Trades.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Trades.Size = new System.Drawing.Size(387, 321); + this.Tab_Trades.Size = new System.Drawing.Size(498, 437); this.Tab_Trades.TabIndex = 1; this.Tab_Trades.Text = "Trades"; this.Tab_Trades.UseVisualStyleBackColor = true; @@ -618,7 +1088,7 @@ private void InitializeComponent() this.LB_Trade.FormattingEnabled = true; this.LB_Trade.Location = new System.Drawing.Point(3, 3); this.LB_Trade.Name = "LB_Trade"; - this.LB_Trade.Size = new System.Drawing.Size(115, 316); + this.LB_Trade.Size = new System.Drawing.Size(115, 420); this.LB_Trade.TabIndex = 2; this.LB_Trade.SelectedIndexChanged += new System.EventHandler(this.LB_Trade_SelectedIndexChanged); // @@ -632,7 +1102,7 @@ private void InitializeComponent() this.Tab_Randomizer.Location = new System.Drawing.Point(4, 22); this.Tab_Randomizer.Name = "Tab_Randomizer"; this.Tab_Randomizer.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Randomizer.Size = new System.Drawing.Size(387, 321); + this.Tab_Randomizer.Size = new System.Drawing.Size(498, 437); this.Tab_Randomizer.TabIndex = 3; this.Tab_Randomizer.Text = "Randomizer Options"; this.Tab_Randomizer.UseVisualStyleBackColor = true; @@ -645,7 +1115,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(231, 65); + this.NUD_LevelBoost.Location = new System.Drawing.Point(301, 111); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -665,7 +1135,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(99, 66); + this.CHK_Level.Location = new System.Drawing.Point(169, 112); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 510; @@ -674,7 +1144,7 @@ private void InitializeComponent() // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(132, 243); + this.B_RandAll.Location = new System.Drawing.Point(202, 289); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(122, 23); this.B_RandAll.TabIndex = 509; @@ -698,13 +1168,23 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(52, 91); + this.GB_Tweak.Location = new System.Drawing.Point(122, 137); this.GB_Tweak.Name = "GB_Tweak"; this.GB_Tweak.Size = new System.Drawing.Size(258, 144); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_RemoveShinyLock + // + this.CHK_RemoveShinyLock.AutoSize = true; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 124); + this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.TabIndex = 299; + this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; + this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; + // // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; @@ -856,7 +1336,7 @@ private void InitializeComponent() // // B_Starters // - this.B_Starters.Location = new System.Drawing.Point(132, 272); + this.B_Starters.Location = new System.Drawing.Point(202, 318); this.B_Starters.Name = "B_Starters"; this.B_Starters.Size = new System.Drawing.Size(122, 23); this.B_Starters.TabIndex = 9; @@ -866,7 +1346,7 @@ private void InitializeComponent() // // B_Save // - this.B_Save.Location = new System.Drawing.Point(328, 365); + this.B_Save.Location = new System.Drawing.Point(435, 445); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(75, 23); this.B_Save.TabIndex = 1; @@ -876,7 +1356,7 @@ private void InitializeComponent() // // B_Cancel // - this.B_Cancel.Location = new System.Drawing.Point(247, 365); + this.B_Cancel.Location = new System.Drawing.Point(354, 445); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(75, 23); this.B_Cancel.TabIndex = 2; @@ -884,21 +1364,21 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_RemoveShinyLock + // CHK_IV3 // - this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 124); - this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; - this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); - this.CHK_RemoveShinyLock.TabIndex = 299; - this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; - this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; + this.CHK_IV3.AutoSize = true; + this.CHK_IV3.Location = new System.Drawing.Point(187, 161); + this.CHK_IV3.Name = "CHK_IV3"; + this.CHK_IV3.Size = new System.Drawing.Size(42, 17); + this.CHK_IV3.TabIndex = 504; + this.CHK_IV3.Text = "3IV"; + this.CHK_IV3.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(419, 395); + this.ClientSize = new System.Drawing.Size(530, 511); this.Controls.Add(this.B_Cancel); this.Controls.Add(this.B_Save); this.Controls.Add(this.TC_Tabs); @@ -912,6 +1392,20 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).EndInit(); this.Tab_Encounters.ResumeLayout(false); this.Tab_Encounters.PerformLayout(); + this.GB_EVs.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EV0)).EndInit(); + this.GB_IVs.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).EndInit(); this.GB_EMoves.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).EndInit(); @@ -997,5 +1491,36 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.CheckBox CHK_AllowMega; private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; + private System.Windows.Forms.Label L_Aura; + private System.Windows.Forms.ComboBox CB_Aura; + private System.Windows.Forms.Label L_DEF; + private System.Windows.Forms.Label L_ATK; + private System.Windows.Forms.Label L_HP; + private System.Windows.Forms.NumericUpDown NUD_IV0; + private System.Windows.Forms.NumericUpDown NUD_IV1; + private System.Windows.Forms.NumericUpDown NUD_IV2; + private System.Windows.Forms.Label L_SPA; + private System.Windows.Forms.Label L_SPE; + private System.Windows.Forms.Label L_SPD; + private System.Windows.Forms.NumericUpDown NUD_IV5; + private System.Windows.Forms.NumericUpDown NUD_IV4; + private System.Windows.Forms.NumericUpDown NUD_IV3; + private System.Windows.Forms.GroupBox GB_EVs; + private System.Windows.Forms.NumericUpDown NUD_EV5; + private System.Windows.Forms.NumericUpDown NUD_EV4; + private System.Windows.Forms.NumericUpDown NUD_EV3; + private System.Windows.Forms.NumericUpDown NUD_EV2; + private System.Windows.Forms.NumericUpDown NUD_EV1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.NumericUpDown NUD_EV0; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.GroupBox GB_IVs; + private System.Windows.Forms.ComboBox CB_Nature; + private System.Windows.Forms.Label L_Nature; + private System.Windows.Forms.CheckBox CHK_IV3; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 4bbe0a36f9..aa9e9b7b43 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -21,6 +21,29 @@ public partial class StaticEncounterEditor7 : Form private readonly string[] types = Main.Config.getText(TextName.Types); private readonly int[] oldStarters; + private readonly string[] aura = + { + "(None)", + "Attack (+1)", + "Attack (+2)", + "Attack (+3)", + "Defense (+1)", + "Defense (+2)", + "Defense (+3)", + "Sp. Attack (+1)", + "Sp. Attack (+2)", + "Sp. Attack (+3)", + "Sp. Defense (+1)", + "Sp. Defense (+2)", + "Sp. Defense (+3)", + "Speed (+1)", + "Speed (+2)", + "Speed (+3)", + "All Stats (+1)", + "All Stats (+2)", + "All Stats (+3)", + }; + public StaticEncounterEditor7(byte[][] infiles) { InitializeComponent(); @@ -85,6 +108,11 @@ public StaticEncounterEditor7(byte[][] infiles) CB_EMove3.Items.Add(s); } + CB_Nature.Items.Add("Random"); + CB_Nature.Items.AddRange(natures.Take(25).ToArray()); + + foreach (string s in aura) CB_Aura.Items.Add(s); + getListBoxEntries(); LB_Gift.SelectedIndex = 0; LB_Encounter.SelectedIndex = 0; @@ -216,7 +244,22 @@ private void getEncounter() CB_EMove1.SelectedIndex = moves[1]; CB_EMove2.SelectedIndex = moves[2]; CB_EMove3.SelectedIndex = moves[3]; + NUD_IV0.Value = entry.IVs[0]; + NUD_IV1.Value = entry.IVs[1]; + NUD_IV2.Value = entry.IVs[2]; + NUD_IV3.Value = entry.IVs[3]; + NUD_IV4.Value = entry.IVs[4]; + NUD_IV5.Value = entry.IVs[5]; + NUD_EV0.Value = entry.EVs[0]; + NUD_EV1.Value = entry.EVs[1]; + NUD_EV2.Value = entry.EVs[2]; + NUD_EV3.Value = entry.EVs[3]; + NUD_EV4.Value = entry.EVs[4]; + NUD_EV5.Value = entry.EVs[5]; CHK_ShinyLock.Checked = entry.ShinyLock; + CHK_IV3.Checked = entry.IV3; + CB_Nature.SelectedIndex = entry.Nature; + CB_Aura.SelectedIndex = entry.Aura; loading = false; } @@ -239,6 +282,8 @@ private void setEncounter() CB_EMove3.SelectedIndex, }; entry.ShinyLock = CHK_ShinyLock.Checked; + entry.Nature = CB_Nature.SelectedIndex; + entry.Aura = CB_Aura.SelectedIndex; } private void getTrade() { From 1078a6431543ca5a373383d01ddd9e3ab5c27cee Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 18 Dec 2017 13:29:06 -0500 Subject: [PATCH 018/191] Fix IV/EV set --- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index aa9e9b7b43..8b8654feed 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -281,6 +281,18 @@ private void setEncounter() CB_EMove2.SelectedIndex, CB_EMove3.SelectedIndex, }; + entry.IVs[0] = (int)NUD_IV0.Value; + entry.IVs[1] = (int)NUD_IV1.Value; + entry.IVs[2] = (int)NUD_IV2.Value; + entry.IVs[3] = (int)NUD_IV3.Value; + entry.IVs[4] = (int)NUD_IV4.Value; + entry.IVs[5] = (int)NUD_IV5.Value; + entry.EVs[0] = (int)NUD_EV0.Value; + entry.EVs[1] = (int)NUD_EV1.Value; + entry.EVs[2] = (int)NUD_EV2.Value; + entry.EVs[3] = (int)NUD_EV3.Value; + entry.EVs[4] = (int)NUD_EV4.Value; + entry.EVs[5] = (int)NUD_EV5.Value; entry.ShinyLock = CHK_ShinyLock.Checked; entry.Nature = CB_Nature.SelectedIndex; entry.Aura = CB_Aura.SelectedIndex; From 865d0693ca66fc0e99593f0799b901799920df71 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 18 Dec 2017 12:23:23 -0800 Subject: [PATCH 019/191] Fix bst rand Closes #255 --- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 10 +++++----- pk3DS/Subforms/Gen6/TrainerRand.cs | 1 + pk3DS/Subforms/Gen7/SMTE.cs | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 686819a1aa..20cc884ab5 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -73,7 +73,7 @@ public int GetRandomSpeciesType(int oldSpecies, int type) loopctr++; return newSpecies; } - private bool GetIsTypeMatch(int newSpecies, int type) => SpeciesStat[newSpecies].Types.Any(z => z == type) || loopctr > 9000; + private bool GetIsTypeMatch(int newSpecies, int type) => type == -1 || SpeciesStat[newSpecies].Types.Any(z => z == type) || loopctr > 9000; public int GetRandomSpecies(int oldSpecies) { @@ -118,11 +118,11 @@ private bool IsSpeciesBSTBad(PersonalInfo oldpkm, PersonalInfo pkm) { if (!rBST) return false; - // Base stat total has to be close + // Base stat total has to be close to original BST int expand = loopctr / MaxSpeciesID; - int lo = pkm.BST * l / (h + expand); - int hi = pkm.BST * (h + expand) / l; - return lo > oldpkm.BST || oldpkm.BST > hi; + int lo = oldpkm.BST * l / (h + expand); + int hi = oldpkm.BST * (h + expand) / l; + return lo > pkm.BST || pkm.BST > hi; } private int[] InitializeSpeciesList() diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index 121101721c..0222b50a1d 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -98,6 +98,7 @@ private void B_Save_Click(object sender, EventArgs e) Shedinja = true, rBST = CHK_BST.Checked, + rEXP = false, }; RSTE.rSpeciesRand.Initialize(); diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 03f38911fd..17205c27d1 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -592,6 +592,7 @@ private void B_Randomize_Click(object sender, EventArgs e) E = CHK_E.Checked, L = CHK_L.Checked, rBST = CHK_BST.Checked, + rEXP = false, }; rnd.Initialize(); From aaa5d8043e388cde7aabd2054da7719788e6b7e5 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 18 Dec 2017 18:32:01 -0500 Subject: [PATCH 020/191] Actually fix IV/EV set --- .../Structures/Gen7/EncounterStatic7.cs | 5 +- .../Gen7/StaticEncounterEditor7.Designer.cs | 136 ++++++++++-------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 61 ++++---- 3 files changed, 113 insertions(+), 89 deletions(-) diff --git a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs index 6b4213dcea..c00b911b44 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs @@ -108,7 +108,8 @@ public int[] IVs Data[i + 0x15] = (byte)Convert.ToSByte(value[i]); } } - public int[] EVs { + public int[] EVs + { get => new int[] { (byte) Data[0x1B], (byte) Data[0x1C], (byte) Data[0x1D], (byte) Data[0x1E], (byte) Data[0x1F], (byte) Data[0x20] @@ -118,7 +119,7 @@ public int[] EVs { if (value.Length != 6) return; for (int i = 0; i < 6; i++) - Data[i + 0x15] = (byte)Convert.ToSByte(value[i]); + Data[i + 0x1B] = (byte)value[i]; } } public int Aura diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index b6ebf2dc0b..087a0f74cd 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -42,6 +42,7 @@ private void InitializeComponent() this.NUD_GLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); + this.CHK_IV3 = new System.Windows.Forms.CheckBox(); this.CB_Nature = new System.Windows.Forms.ComboBox(); this.L_Nature = new System.Windows.Forms.Label(); this.GB_EVs = new System.Windows.Forms.GroupBox(); @@ -124,7 +125,7 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_IV3 = new System.Windows.Forms.CheckBox(); + this.L_GGender = new System.Windows.Forms.Label(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); @@ -174,6 +175,7 @@ private void InitializeComponent() // // Tab_Gifts // + this.Tab_Gifts.Controls.Add(this.L_GGender); this.Tab_Gifts.Controls.Add(this.NUD_GGender); this.Tab_Gifts.Controls.Add(this.CHK_G_Lock); this.Tab_Gifts.Controls.Add(this.CB_GHeldItem); @@ -194,17 +196,17 @@ private void InitializeComponent() // // NUD_GGender // - this.NUD_GGender.Location = new System.Drawing.Point(230, 137); + this.NUD_GGender.Location = new System.Drawing.Point(187, 74); this.NUD_GGender.Maximum = new decimal(new int[] { - 255, + 2, 0, 0, 0}); this.NUD_GGender.Name = "NUD_GGender"; - this.NUD_GGender.Size = new System.Drawing.Size(48, 20); + this.NUD_GGender.Size = new System.Drawing.Size(34, 20); this.NUD_GGender.TabIndex = 20; this.NUD_GGender.Value = new decimal(new int[] { - 100, + 2, 0, 0, 0}); @@ -212,7 +214,7 @@ private void InitializeComponent() // CHK_G_Lock // this.CHK_G_Lock.AutoSize = true; - this.CHK_G_Lock.Location = new System.Drawing.Point(230, 114); + this.CHK_G_Lock.Location = new System.Drawing.Point(187, 119); this.CHK_G_Lock.Name = "CHK_G_Lock"; this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); this.CHK_G_Lock.TabIndex = 19; @@ -222,16 +224,16 @@ private void InitializeComponent() // CB_GHeldItem // this.CB_GHeldItem.FormattingEnabled = true; - this.CB_GHeldItem.Location = new System.Drawing.Point(230, 87); + this.CB_GHeldItem.Location = new System.Drawing.Point(187, 96); this.CB_GHeldItem.Name = "CB_GHeldItem"; this.CB_GHeldItem.Size = new System.Drawing.Size(121, 21); this.CB_GHeldItem.TabIndex = 8; // // L_GHeldItem // - this.L_GHeldItem.Location = new System.Drawing.Point(124, 85); + this.L_GHeldItem.Location = new System.Drawing.Point(131, 94); this.L_GHeldItem.Name = "L_GHeldItem"; - this.L_GHeldItem.Size = new System.Drawing.Size(100, 23); + this.L_GHeldItem.Size = new System.Drawing.Size(55, 23); this.L_GHeldItem.TabIndex = 7; this.L_GHeldItem.Text = "Held Item:"; this.L_GHeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -239,7 +241,7 @@ private void InitializeComponent() // CB_GSpecies // this.CB_GSpecies.FormattingEnabled = true; - this.CB_GSpecies.Location = new System.Drawing.Point(230, 18); + this.CB_GSpecies.Location = new System.Drawing.Point(187, 7); this.CB_GSpecies.Name = "CB_GSpecies"; this.CB_GSpecies.Size = new System.Drawing.Size(121, 21); this.CB_GSpecies.TabIndex = 6; @@ -247,16 +249,16 @@ private void InitializeComponent() // // L_GForm // - this.L_GForm.Location = new System.Drawing.Point(124, 62); + this.L_GForm.Location = new System.Drawing.Point(131, 49); this.L_GForm.Name = "L_GForm"; - this.L_GForm.Size = new System.Drawing.Size(100, 23); + this.L_GForm.Size = new System.Drawing.Size(55, 23); this.L_GForm.TabIndex = 5; this.L_GForm.Text = "Form:"; this.L_GForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_GForm // - this.NUD_GForm.Location = new System.Drawing.Point(230, 65); + this.NUD_GForm.Location = new System.Drawing.Point(187, 52); this.NUD_GForm.Maximum = new decimal(new int[] { 255, 0, @@ -273,25 +275,25 @@ private void InitializeComponent() // // L_GLevel // - this.L_GLevel.Location = new System.Drawing.Point(124, 39); + this.L_GLevel.Location = new System.Drawing.Point(131, 27); this.L_GLevel.Name = "L_GLevel"; - this.L_GLevel.Size = new System.Drawing.Size(100, 23); + this.L_GLevel.Size = new System.Drawing.Size(55, 23); this.L_GLevel.TabIndex = 3; this.L_GLevel.Text = "Level:"; this.L_GLevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_GSpecies // - this.L_GSpecies.Location = new System.Drawing.Point(124, 16); + this.L_GSpecies.Location = new System.Drawing.Point(131, 5); this.L_GSpecies.Name = "L_GSpecies"; - this.L_GSpecies.Size = new System.Drawing.Size(100, 23); + this.L_GSpecies.Size = new System.Drawing.Size(55, 23); this.L_GSpecies.TabIndex = 2; this.L_GSpecies.Text = "Species:"; this.L_GSpecies.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_GLevel // - this.NUD_GLevel.Location = new System.Drawing.Point(230, 42); + this.NUD_GLevel.Location = new System.Drawing.Point(187, 30); this.NUD_GLevel.Maximum = new decimal(new int[] { 255, 0, @@ -313,7 +315,7 @@ private void InitializeComponent() this.LB_Gift.FormattingEnabled = true; this.LB_Gift.Location = new System.Drawing.Point(3, 3); this.LB_Gift.Name = "LB_Gift"; - this.LB_Gift.Size = new System.Drawing.Size(115, 420); + this.LB_Gift.Size = new System.Drawing.Size(115, 433); this.LB_Gift.TabIndex = 0; this.LB_Gift.SelectedIndexChanged += new System.EventHandler(this.LB_Gift_SelectedIndexChanged); // @@ -345,19 +347,29 @@ private void InitializeComponent() this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // + // CHK_IV3 + // + this.CHK_IV3.AutoSize = true; + this.CHK_IV3.Location = new System.Drawing.Point(187, 160); + this.CHK_IV3.Name = "CHK_IV3"; + this.CHK_IV3.Size = new System.Drawing.Size(42, 17); + this.CHK_IV3.TabIndex = 504; + this.CHK_IV3.Text = "3IV"; + this.CHK_IV3.UseVisualStyleBackColor = true; + // // CB_Nature // this.CB_Nature.FormattingEnabled = true; - this.CB_Nature.Location = new System.Drawing.Point(187, 98); + this.CB_Nature.Location = new System.Drawing.Point(187, 97); this.CB_Nature.Name = "CB_Nature"; this.CB_Nature.Size = new System.Drawing.Size(121, 21); this.CB_Nature.TabIndex = 503; // // L_Nature // - this.L_Nature.Location = new System.Drawing.Point(124, 96); + this.L_Nature.Location = new System.Drawing.Point(131, 95); this.L_Nature.Name = "L_Nature"; - this.L_Nature.Size = new System.Drawing.Size(62, 23); + this.L_Nature.Size = new System.Drawing.Size(55, 23); this.L_Nature.TabIndex = 502; this.L_Nature.Text = "Nature:"; this.L_Nature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -748,9 +760,9 @@ private void InitializeComponent() // // L_Aura // - this.L_Aura.Location = new System.Drawing.Point(147, 119); + this.L_Aura.Location = new System.Drawing.Point(131, 118); this.L_Aura.Name = "L_Aura"; - this.L_Aura.Size = new System.Drawing.Size(40, 23); + this.L_Aura.Size = new System.Drawing.Size(55, 23); this.L_Aura.TabIndex = 22; this.L_Aura.Text = "Aura:"; this.L_Aura.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -758,7 +770,7 @@ private void InitializeComponent() // CB_Aura // this.CB_Aura.FormattingEnabled = true; - this.CB_Aura.Location = new System.Drawing.Point(187, 121); + this.CB_Aura.Location = new System.Drawing.Point(187, 120); this.CB_Aura.Name = "CB_Aura"; this.CB_Aura.Size = new System.Drawing.Size(121, 21); this.CB_Aura.TabIndex = 21; @@ -766,7 +778,7 @@ private void InitializeComponent() // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 146); + this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 145); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); this.CHK_ShinyLock.TabIndex = 18; @@ -821,16 +833,16 @@ private void InitializeComponent() // CB_EHeldItem // this.CB_EHeldItem.FormattingEnabled = true; - this.CB_EHeldItem.Location = new System.Drawing.Point(187, 75); + this.CB_EHeldItem.Location = new System.Drawing.Point(187, 74); this.CB_EHeldItem.Name = "CB_EHeldItem"; this.CB_EHeldItem.Size = new System.Drawing.Size(121, 21); this.CB_EHeldItem.TabIndex = 16; // // L_EHeldItem // - this.L_EHeldItem.Location = new System.Drawing.Point(124, 73); + this.L_EHeldItem.Location = new System.Drawing.Point(131, 72); this.L_EHeldItem.Name = "L_EHeldItem"; - this.L_EHeldItem.Size = new System.Drawing.Size(62, 23); + this.L_EHeldItem.Size = new System.Drawing.Size(55, 23); this.L_EHeldItem.TabIndex = 15; this.L_EHeldItem.Text = "Held Item:"; this.L_EHeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -846,16 +858,16 @@ private void InitializeComponent() // // L_EForm // - this.L_EForm.Location = new System.Drawing.Point(143, 50); + this.L_EForm.Location = new System.Drawing.Point(131, 49); this.L_EForm.Name = "L_EForm"; - this.L_EForm.Size = new System.Drawing.Size(43, 23); + this.L_EForm.Size = new System.Drawing.Size(55, 23); this.L_EForm.TabIndex = 13; this.L_EForm.Text = "Form:"; this.L_EForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_EForm // - this.NUD_EForm.Location = new System.Drawing.Point(187, 53); + this.NUD_EForm.Location = new System.Drawing.Point(187, 52); this.NUD_EForm.Maximum = new decimal(new int[] { 255, 0, @@ -872,9 +884,9 @@ private void InitializeComponent() // // L_ELevel // - this.L_ELevel.Location = new System.Drawing.Point(140, 27); + this.L_ELevel.Location = new System.Drawing.Point(131, 27); this.L_ELevel.Name = "L_ELevel"; - this.L_ELevel.Size = new System.Drawing.Size(46, 23); + this.L_ELevel.Size = new System.Drawing.Size(55, 23); this.L_ELevel.TabIndex = 11; this.L_ELevel.Text = "Level:"; this.L_ELevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -912,7 +924,7 @@ private void InitializeComponent() this.LB_Encounter.FormattingEnabled = true; this.LB_Encounter.Location = new System.Drawing.Point(3, 3); this.LB_Encounter.Name = "LB_Encounter"; - this.LB_Encounter.Size = new System.Drawing.Size(115, 407); + this.LB_Encounter.Size = new System.Drawing.Size(115, 433); this.LB_Encounter.TabIndex = 1; this.LB_Encounter.SelectedIndexChanged += new System.EventHandler(this.LB_Encounter_SelectedIndexChanged); // @@ -960,7 +972,7 @@ private void InitializeComponent() // L_TTID // this.L_TTID.AutoSize = true; - this.L_TTID.Location = new System.Drawing.Point(268, 113); + this.L_TTID.Location = new System.Drawing.Point(250, 100); this.L_TTID.Name = "L_TTID"; this.L_TTID.Size = new System.Drawing.Size(28, 13); this.L_TTID.TabIndex = 27; @@ -969,7 +981,7 @@ private void InitializeComponent() // // L_TID // - this.L_TID.Location = new System.Drawing.Point(124, 108); + this.L_TID.Location = new System.Drawing.Point(136, 94); this.L_TID.Name = "L_TID"; this.L_TID.Size = new System.Drawing.Size(50, 23); this.L_TID.TabIndex = 26; @@ -978,17 +990,17 @@ private void InitializeComponent() // // NUD_TID // - this.NUD_TID.Location = new System.Drawing.Point(180, 111); + this.NUD_TID.Location = new System.Drawing.Point(187, 97); this.NUD_TID.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.NUD_TID.Name = "NUD_TID"; - this.NUD_TID.Size = new System.Drawing.Size(82, 20); + this.NUD_TID.Size = new System.Drawing.Size(59, 20); this.NUD_TID.TabIndex = 25; this.NUD_TID.Value = new decimal(new int[] { - -1, + 123456, 0, 0, 0}); @@ -997,16 +1009,16 @@ private void InitializeComponent() // CB_THeldItem // this.CB_THeldItem.FormattingEnabled = true; - this.CB_THeldItem.Location = new System.Drawing.Point(230, 87); + this.CB_THeldItem.Location = new System.Drawing.Point(187, 74); this.CB_THeldItem.Name = "CB_THeldItem"; this.CB_THeldItem.Size = new System.Drawing.Size(121, 21); this.CB_THeldItem.TabIndex = 24; // // L_THeldItem // - this.L_THeldItem.Location = new System.Drawing.Point(124, 85); + this.L_THeldItem.Location = new System.Drawing.Point(131, 72); this.L_THeldItem.Name = "L_THeldItem"; - this.L_THeldItem.Size = new System.Drawing.Size(100, 23); + this.L_THeldItem.Size = new System.Drawing.Size(55, 23); this.L_THeldItem.TabIndex = 23; this.L_THeldItem.Text = "Held Item:"; this.L_THeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -1014,7 +1026,7 @@ private void InitializeComponent() // CB_TSpecies // this.CB_TSpecies.FormattingEnabled = true; - this.CB_TSpecies.Location = new System.Drawing.Point(230, 18); + this.CB_TSpecies.Location = new System.Drawing.Point(187, 7); this.CB_TSpecies.Name = "CB_TSpecies"; this.CB_TSpecies.Size = new System.Drawing.Size(121, 21); this.CB_TSpecies.TabIndex = 22; @@ -1022,16 +1034,16 @@ private void InitializeComponent() // // L_TForm // - this.L_TForm.Location = new System.Drawing.Point(124, 62); + this.L_TForm.Location = new System.Drawing.Point(131, 49); this.L_TForm.Name = "L_TForm"; - this.L_TForm.Size = new System.Drawing.Size(100, 23); + this.L_TForm.Size = new System.Drawing.Size(55, 23); this.L_TForm.TabIndex = 21; this.L_TForm.Text = "Form:"; this.L_TForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TForm // - this.NUD_TForm.Location = new System.Drawing.Point(230, 65); + this.NUD_TForm.Location = new System.Drawing.Point(187, 52); this.NUD_TForm.Maximum = new decimal(new int[] { 255, 0, @@ -1048,25 +1060,25 @@ private void InitializeComponent() // // L_TLevel // - this.L_TLevel.Location = new System.Drawing.Point(124, 39); + this.L_TLevel.Location = new System.Drawing.Point(131, 27); this.L_TLevel.Name = "L_TLevel"; - this.L_TLevel.Size = new System.Drawing.Size(100, 23); + this.L_TLevel.Size = new System.Drawing.Size(55, 23); this.L_TLevel.TabIndex = 19; this.L_TLevel.Text = "Level:"; this.L_TLevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_TSpecies // - this.L_TSpecies.Location = new System.Drawing.Point(124, 16); + this.L_TSpecies.Location = new System.Drawing.Point(131, 5); this.L_TSpecies.Name = "L_TSpecies"; - this.L_TSpecies.Size = new System.Drawing.Size(100, 23); + this.L_TSpecies.Size = new System.Drawing.Size(55, 23); this.L_TSpecies.TabIndex = 18; this.L_TSpecies.Text = "Species:"; this.L_TSpecies.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TLevel // - this.NUD_TLevel.Location = new System.Drawing.Point(230, 42); + this.NUD_TLevel.Location = new System.Drawing.Point(187, 30); this.NUD_TLevel.Maximum = new decimal(new int[] { 255, 0, @@ -1088,7 +1100,7 @@ private void InitializeComponent() this.LB_Trade.FormattingEnabled = true; this.LB_Trade.Location = new System.Drawing.Point(3, 3); this.LB_Trade.Name = "LB_Trade"; - this.LB_Trade.Size = new System.Drawing.Size(115, 420); + this.LB_Trade.Size = new System.Drawing.Size(115, 433); this.LB_Trade.TabIndex = 2; this.LB_Trade.SelectedIndexChanged += new System.EventHandler(this.LB_Trade_SelectedIndexChanged); // @@ -1364,15 +1376,14 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_IV3 + // L_GGender // - this.CHK_IV3.AutoSize = true; - this.CHK_IV3.Location = new System.Drawing.Point(187, 161); - this.CHK_IV3.Name = "CHK_IV3"; - this.CHK_IV3.Size = new System.Drawing.Size(42, 17); - this.CHK_IV3.TabIndex = 504; - this.CHK_IV3.Text = "3IV"; - this.CHK_IV3.UseVisualStyleBackColor = true; + this.L_GGender.Location = new System.Drawing.Point(131, 71); + this.L_GGender.Name = "L_GGender"; + this.L_GGender.Size = new System.Drawing.Size(55, 23); + this.L_GGender.TabIndex = 21; + this.L_GGender.Text = "Gender:"; + this.L_GGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // StaticEncounterEditor7 // @@ -1522,5 +1533,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_Nature; private System.Windows.Forms.Label L_Nature; private System.Windows.Forms.CheckBox CHK_IV3; + private System.Windows.Forms.Label L_GGender; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 8b8654feed..cb0db67107 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -234,6 +234,8 @@ private void getEncounter() loading = true; var entry = Encounters[eEntry]; + var iv = entry.IVs; + var ev = entry.EVs; CB_ESpecies.SelectedIndex = entry.Species; CB_EHeldItem.SelectedIndex = entry.HeldItem; NUD_ELevel.Value = entry.Level; @@ -244,18 +246,21 @@ private void getEncounter() CB_EMove1.SelectedIndex = moves[1]; CB_EMove2.SelectedIndex = moves[2]; CB_EMove3.SelectedIndex = moves[3]; - NUD_IV0.Value = entry.IVs[0]; - NUD_IV1.Value = entry.IVs[1]; - NUD_IV2.Value = entry.IVs[2]; - NUD_IV3.Value = entry.IVs[3]; - NUD_IV4.Value = entry.IVs[4]; - NUD_IV5.Value = entry.IVs[5]; - NUD_EV0.Value = entry.EVs[0]; - NUD_EV1.Value = entry.EVs[1]; - NUD_EV2.Value = entry.EVs[2]; - NUD_EV3.Value = entry.EVs[3]; - NUD_EV4.Value = entry.EVs[4]; - NUD_EV5.Value = entry.EVs[5]; + + NUD_IV0.Value = iv[0]; + NUD_IV1.Value = iv[1]; + NUD_IV2.Value = iv[2]; + NUD_IV3.Value = iv[3]; + NUD_IV4.Value = iv[4]; + NUD_IV5.Value = iv[5]; + + NUD_EV0.Value = ev[0]; + NUD_EV1.Value = ev[1]; + NUD_EV2.Value = ev[2]; + NUD_EV3.Value = ev[3]; + NUD_EV4.Value = ev[4]; + NUD_EV5.Value = ev[5]; + CHK_ShinyLock.Checked = entry.ShinyLock; CHK_IV3.Checked = entry.IV3; CB_Nature.SelectedIndex = entry.Nature; @@ -269,11 +274,12 @@ private void setEncounter() return; var entry = Encounters[eEntry]; + var iv = entry.IVs; + var ev = entry.EVs; entry.Species = CB_ESpecies.SelectedIndex; entry.HeldItem = CB_EHeldItem.SelectedIndex; entry.Level = (int)NUD_ELevel.Value; entry.Form = (int)NUD_EForm.Value; - entry.RelearnMoves = new[] { CB_EMove0.SelectedIndex, @@ -281,18 +287,23 @@ private void setEncounter() CB_EMove2.SelectedIndex, CB_EMove3.SelectedIndex, }; - entry.IVs[0] = (int)NUD_IV0.Value; - entry.IVs[1] = (int)NUD_IV1.Value; - entry.IVs[2] = (int)NUD_IV2.Value; - entry.IVs[3] = (int)NUD_IV3.Value; - entry.IVs[4] = (int)NUD_IV4.Value; - entry.IVs[5] = (int)NUD_IV5.Value; - entry.EVs[0] = (int)NUD_EV0.Value; - entry.EVs[1] = (int)NUD_EV1.Value; - entry.EVs[2] = (int)NUD_EV2.Value; - entry.EVs[3] = (int)NUD_EV3.Value; - entry.EVs[4] = (int)NUD_EV4.Value; - entry.EVs[5] = (int)NUD_EV5.Value; + + iv[0] = (int)NUD_IV0.Value; + iv[1] = (int)NUD_IV1.Value; + iv[2] = (int)NUD_IV2.Value; + iv[3] = (int)NUD_IV3.Value; + iv[4] = (int)NUD_IV4.Value; + iv[5] = (int)NUD_IV5.Value; + entry.IVs = iv; + + ev[0] = (int)NUD_EV0.Value; + ev[1] = (int)NUD_EV1.Value; + ev[2] = (int)NUD_EV2.Value; + ev[3] = (int)NUD_EV3.Value; + ev[4] = (int)NUD_EV4.Value; + ev[5] = (int)NUD_EV5.Value; + entry.EVs = ev; + entry.ShinyLock = CHK_ShinyLock.Checked; entry.Nature = CB_Nature.SelectedIndex; entry.Aura = CB_Aura.SelectedIndex; From dde684ee85a46060e8ec6de85a445f1ac2812e58 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 18 Dec 2017 20:53:37 -0500 Subject: [PATCH 021/191] Expose more gen7 gift/trade features --- .../Gen7/StaticEncounterEditor7.Designer.cs | 674 +++++++++++++----- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 70 +- 2 files changed, 546 insertions(+), 198 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 087a0f74cd..ccbfd9c275 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -30,6 +30,7 @@ private void InitializeComponent() { this.TC_Tabs = new System.Windows.Forms.TabControl(); this.Tab_Gifts = new System.Windows.Forms.TabPage(); + this.L_GGender = new System.Windows.Forms.Label(); this.NUD_GGender = new System.Windows.Forms.NumericUpDown(); this.CHK_G_Lock = new System.Windows.Forms.CheckBox(); this.CB_GHeldItem = new System.Windows.Forms.ComboBox(); @@ -42,10 +43,10 @@ private void InitializeComponent() this.NUD_GLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); - this.CHK_IV3 = new System.Windows.Forms.CheckBox(); - this.CB_Nature = new System.Windows.Forms.ComboBox(); - this.L_Nature = new System.Windows.Forms.Label(); - this.GB_EVs = new System.Windows.Forms.GroupBox(); + this.CHK_EIV3 = new System.Windows.Forms.CheckBox(); + this.CB_ENature = new System.Windows.Forms.ComboBox(); + this.L_ENature = new System.Windows.Forms.Label(); + this.GB_EEVs = new System.Windows.Forms.GroupBox(); this.NUD_EV5 = new System.Windows.Forms.NumericUpDown(); this.NUD_EV4 = new System.Windows.Forms.NumericUpDown(); this.NUD_EV3 = new System.Windows.Forms.NumericUpDown(); @@ -58,17 +59,17 @@ private void InitializeComponent() this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); - this.GB_IVs = new System.Windows.Forms.GroupBox(); + this.GB_EIVs = new System.Windows.Forms.GroupBox(); this.L_HP = new System.Windows.Forms.Label(); - this.NUD_IV3 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV4 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV5 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EIV3 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EIV4 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EIV5 = new System.Windows.Forms.NumericUpDown(); this.L_SPD = new System.Windows.Forms.Label(); this.L_SPE = new System.Windows.Forms.Label(); this.L_SPA = new System.Windows.Forms.Label(); - this.NUD_IV2 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV1 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV0 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EIV2 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EIV1 = new System.Windows.Forms.NumericUpDown(); + this.NUD_EIV0 = new System.Windows.Forms.NumericUpDown(); this.L_ATK = new System.Windows.Forms.Label(); this.L_DEF = new System.Windows.Forms.Label(); this.L_Aura = new System.Windows.Forms.Label(); @@ -125,27 +126,45 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.L_GGender = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label8 = new System.Windows.Forms.Label(); + this.NUD_TIV3 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV4 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV5 = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.NUD_TIV2 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV1 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV0 = new System.Windows.Forms.NumericUpDown(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.CB_TNature = new System.Windows.Forms.ComboBox(); + this.L_TNature = new System.Windows.Forms.Label(); + this.CB_SpecialMove = new System.Windows.Forms.ComboBox(); + this.L_SpecialMove = new System.Windows.Forms.Label(); + this.CHK_GIV3 = new System.Windows.Forms.CheckBox(); + this.CHK_IsEgg = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).BeginInit(); this.Tab_Encounters.SuspendLayout(); - this.GB_EVs.SuspendLayout(); + this.GB_EEVs.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV0)).BeginInit(); - this.GB_IVs.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); + this.GB_EIVs.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV0)).BeginInit(); this.GB_EMoves.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).BeginInit(); @@ -156,6 +175,13 @@ private void InitializeComponent() this.Tab_Randomizer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.GB_Tweak.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV0)).BeginInit(); this.SuspendLayout(); // // TC_Tabs @@ -175,6 +201,10 @@ private void InitializeComponent() // // Tab_Gifts // + this.Tab_Gifts.Controls.Add(this.CHK_IsEgg); + this.Tab_Gifts.Controls.Add(this.CHK_GIV3); + this.Tab_Gifts.Controls.Add(this.CB_SpecialMove); + this.Tab_Gifts.Controls.Add(this.L_SpecialMove); this.Tab_Gifts.Controls.Add(this.L_GGender); this.Tab_Gifts.Controls.Add(this.NUD_GGender); this.Tab_Gifts.Controls.Add(this.CHK_G_Lock); @@ -194,6 +224,15 @@ private void InitializeComponent() this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; // + // L_GGender + // + this.L_GGender.Location = new System.Drawing.Point(131, 71); + this.L_GGender.Name = "L_GGender"; + this.L_GGender.Size = new System.Drawing.Size(55, 23); + this.L_GGender.TabIndex = 21; + this.L_GGender.Text = "Gender:"; + this.L_GGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // NUD_GGender // this.NUD_GGender.Location = new System.Drawing.Point(187, 74); @@ -214,7 +253,7 @@ private void InitializeComponent() // CHK_G_Lock // this.CHK_G_Lock.AutoSize = true; - this.CHK_G_Lock.Location = new System.Drawing.Point(187, 119); + this.CHK_G_Lock.Location = new System.Drawing.Point(187, 144); this.CHK_G_Lock.Name = "CHK_G_Lock"; this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); this.CHK_G_Lock.TabIndex = 19; @@ -321,11 +360,11 @@ private void InitializeComponent() // // Tab_Encounters // - this.Tab_Encounters.Controls.Add(this.CHK_IV3); - this.Tab_Encounters.Controls.Add(this.CB_Nature); - this.Tab_Encounters.Controls.Add(this.L_Nature); - this.Tab_Encounters.Controls.Add(this.GB_EVs); - this.Tab_Encounters.Controls.Add(this.GB_IVs); + this.Tab_Encounters.Controls.Add(this.CHK_EIV3); + this.Tab_Encounters.Controls.Add(this.CB_ENature); + this.Tab_Encounters.Controls.Add(this.L_ENature); + this.Tab_Encounters.Controls.Add(this.GB_EEVs); + this.Tab_Encounters.Controls.Add(this.GB_EIVs); this.Tab_Encounters.Controls.Add(this.L_Aura); this.Tab_Encounters.Controls.Add(this.CB_Aura); this.Tab_Encounters.Controls.Add(this.CHK_ShinyLock); @@ -347,53 +386,53 @@ private void InitializeComponent() this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // - // CHK_IV3 - // - this.CHK_IV3.AutoSize = true; - this.CHK_IV3.Location = new System.Drawing.Point(187, 160); - this.CHK_IV3.Name = "CHK_IV3"; - this.CHK_IV3.Size = new System.Drawing.Size(42, 17); - this.CHK_IV3.TabIndex = 504; - this.CHK_IV3.Text = "3IV"; - this.CHK_IV3.UseVisualStyleBackColor = true; - // - // CB_Nature - // - this.CB_Nature.FormattingEnabled = true; - this.CB_Nature.Location = new System.Drawing.Point(187, 97); - this.CB_Nature.Name = "CB_Nature"; - this.CB_Nature.Size = new System.Drawing.Size(121, 21); - this.CB_Nature.TabIndex = 503; - // - // L_Nature - // - this.L_Nature.Location = new System.Drawing.Point(131, 95); - this.L_Nature.Name = "L_Nature"; - this.L_Nature.Size = new System.Drawing.Size(55, 23); - this.L_Nature.TabIndex = 502; - this.L_Nature.Text = "Nature:"; - this.L_Nature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // GB_EVs - // - this.GB_EVs.Controls.Add(this.NUD_EV5); - this.GB_EVs.Controls.Add(this.NUD_EV4); - this.GB_EVs.Controls.Add(this.NUD_EV3); - this.GB_EVs.Controls.Add(this.NUD_EV2); - this.GB_EVs.Controls.Add(this.NUD_EV1); - this.GB_EVs.Controls.Add(this.label2); - this.GB_EVs.Controls.Add(this.label7); - this.GB_EVs.Controls.Add(this.label6); - this.GB_EVs.Controls.Add(this.NUD_EV0); - this.GB_EVs.Controls.Add(this.label3); - this.GB_EVs.Controls.Add(this.label4); - this.GB_EVs.Controls.Add(this.label5); - this.GB_EVs.Location = new System.Drawing.Point(284, 295); - this.GB_EVs.Name = "GB_EVs"; - this.GB_EVs.Size = new System.Drawing.Size(160, 112); - this.GB_EVs.TabIndex = 501; - this.GB_EVs.TabStop = false; - this.GB_EVs.Text = "EVs"; + // CHK_EIV3 + // + this.CHK_EIV3.AutoSize = true; + this.CHK_EIV3.Location = new System.Drawing.Point(187, 160); + this.CHK_EIV3.Name = "CHK_EIV3"; + this.CHK_EIV3.Size = new System.Drawing.Size(42, 17); + this.CHK_EIV3.TabIndex = 504; + this.CHK_EIV3.Text = "3IV"; + this.CHK_EIV3.UseVisualStyleBackColor = true; + // + // CB_ENature + // + this.CB_ENature.FormattingEnabled = true; + this.CB_ENature.Location = new System.Drawing.Point(187, 97); + this.CB_ENature.Name = "CB_ENature"; + this.CB_ENature.Size = new System.Drawing.Size(121, 21); + this.CB_ENature.TabIndex = 503; + // + // L_ENature + // + this.L_ENature.Location = new System.Drawing.Point(131, 95); + this.L_ENature.Name = "L_ENature"; + this.L_ENature.Size = new System.Drawing.Size(55, 23); + this.L_ENature.TabIndex = 502; + this.L_ENature.Text = "Nature:"; + this.L_ENature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // GB_EEVs + // + this.GB_EEVs.Controls.Add(this.NUD_EV5); + this.GB_EEVs.Controls.Add(this.NUD_EV4); + this.GB_EEVs.Controls.Add(this.NUD_EV3); + this.GB_EEVs.Controls.Add(this.NUD_EV2); + this.GB_EEVs.Controls.Add(this.NUD_EV1); + this.GB_EEVs.Controls.Add(this.label2); + this.GB_EEVs.Controls.Add(this.label7); + this.GB_EEVs.Controls.Add(this.label6); + this.GB_EEVs.Controls.Add(this.NUD_EV0); + this.GB_EEVs.Controls.Add(this.label3); + this.GB_EEVs.Controls.Add(this.label4); + this.GB_EEVs.Controls.Add(this.label5); + this.GB_EEVs.Location = new System.Drawing.Point(284, 295); + this.GB_EEVs.Name = "GB_EEVs"; + this.GB_EEVs.Size = new System.Drawing.Size(160, 112); + this.GB_EEVs.TabIndex = 501; + this.GB_EEVs.TabStop = false; + this.GB_EEVs.Text = "EVs"; // // NUD_EV5 // @@ -551,26 +590,26 @@ private void InitializeComponent() this.label5.Text = "SpA:"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // GB_IVs - // - this.GB_IVs.Controls.Add(this.L_HP); - this.GB_IVs.Controls.Add(this.NUD_IV3); - this.GB_IVs.Controls.Add(this.NUD_IV4); - this.GB_IVs.Controls.Add(this.NUD_IV5); - this.GB_IVs.Controls.Add(this.L_SPD); - this.GB_IVs.Controls.Add(this.L_SPE); - this.GB_IVs.Controls.Add(this.L_SPA); - this.GB_IVs.Controls.Add(this.NUD_IV2); - this.GB_IVs.Controls.Add(this.NUD_IV1); - this.GB_IVs.Controls.Add(this.NUD_IV0); - this.GB_IVs.Controls.Add(this.L_ATK); - this.GB_IVs.Controls.Add(this.L_DEF); - this.GB_IVs.Location = new System.Drawing.Point(129, 295); - this.GB_IVs.Name = "GB_IVs"; - this.GB_IVs.Size = new System.Drawing.Size(148, 112); - this.GB_IVs.TabIndex = 21; - this.GB_IVs.TabStop = false; - this.GB_IVs.Text = "IVs"; + // GB_EIVs + // + this.GB_EIVs.Controls.Add(this.L_HP); + this.GB_EIVs.Controls.Add(this.NUD_EIV3); + this.GB_EIVs.Controls.Add(this.NUD_EIV4); + this.GB_EIVs.Controls.Add(this.NUD_EIV5); + this.GB_EIVs.Controls.Add(this.L_SPD); + this.GB_EIVs.Controls.Add(this.L_SPE); + this.GB_EIVs.Controls.Add(this.L_SPA); + this.GB_EIVs.Controls.Add(this.NUD_EIV2); + this.GB_EIVs.Controls.Add(this.NUD_EIV1); + this.GB_EIVs.Controls.Add(this.NUD_EIV0); + this.GB_EIVs.Controls.Add(this.L_ATK); + this.GB_EIVs.Controls.Add(this.L_DEF); + this.GB_EIVs.Location = new System.Drawing.Point(129, 295); + this.GB_EIVs.Name = "GB_EIVs"; + this.GB_EIVs.Size = new System.Drawing.Size(148, 112); + this.GB_EIVs.TabIndex = 21; + this.GB_EIVs.TabStop = false; + this.GB_EIVs.Text = "IVs"; // // L_HP // @@ -581,67 +620,67 @@ private void InitializeComponent() this.L_HP.Text = "HP:"; this.L_HP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // NUD_IV3 + // NUD_EIV3 // - this.NUD_IV3.Location = new System.Drawing.Point(104, 18); - this.NUD_IV3.Maximum = new decimal(new int[] { + this.NUD_EIV3.Location = new System.Drawing.Point(104, 18); + this.NUD_EIV3.Maximum = new decimal(new int[] { 31, 0, 0, 0}); - this.NUD_IV3.Minimum = new decimal(new int[] { + this.NUD_EIV3.Minimum = new decimal(new int[] { 4, 0, 0, -2147483648}); - this.NUD_IV3.Name = "NUD_IV3"; - this.NUD_IV3.Size = new System.Drawing.Size(34, 20); - this.NUD_IV3.TabIndex = 492; - this.NUD_IV3.Value = new decimal(new int[] { + this.NUD_EIV3.Name = "NUD_EIV3"; + this.NUD_EIV3.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV3.TabIndex = 492; + this.NUD_EIV3.Value = new decimal(new int[] { 31, 0, 0, 0}); // - // NUD_IV4 + // NUD_EIV4 // - this.NUD_IV4.Location = new System.Drawing.Point(104, 49); - this.NUD_IV4.Maximum = new decimal(new int[] { + this.NUD_EIV4.Location = new System.Drawing.Point(104, 49); + this.NUD_EIV4.Maximum = new decimal(new int[] { 31, 0, 0, 0}); - this.NUD_IV4.Minimum = new decimal(new int[] { + this.NUD_EIV4.Minimum = new decimal(new int[] { 4, 0, 0, -2147483648}); - this.NUD_IV4.Name = "NUD_IV4"; - this.NUD_IV4.Size = new System.Drawing.Size(34, 20); - this.NUD_IV4.TabIndex = 493; - this.NUD_IV4.Value = new decimal(new int[] { + this.NUD_EIV4.Name = "NUD_EIV4"; + this.NUD_EIV4.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV4.TabIndex = 493; + this.NUD_EIV4.Value = new decimal(new int[] { 31, 0, 0, 0}); // - // NUD_IV5 + // NUD_EIV5 // - this.NUD_IV5.Location = new System.Drawing.Point(104, 80); - this.NUD_IV5.Maximum = new decimal(new int[] { + this.NUD_EIV5.Location = new System.Drawing.Point(104, 80); + this.NUD_EIV5.Maximum = new decimal(new int[] { 31, 0, 0, 0}); - this.NUD_IV5.Minimum = new decimal(new int[] { + this.NUD_EIV5.Minimum = new decimal(new int[] { 4, 0, 0, -2147483648}); - this.NUD_IV5.Name = "NUD_IV5"; - this.NUD_IV5.Size = new System.Drawing.Size(34, 20); - this.NUD_IV5.TabIndex = 494; - this.NUD_IV5.Value = new decimal(new int[] { + this.NUD_EIV5.Name = "NUD_EIV5"; + this.NUD_EIV5.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV5.TabIndex = 494; + this.NUD_EIV5.Value = new decimal(new int[] { 31, 0, 0, @@ -674,67 +713,67 @@ private void InitializeComponent() this.L_SPA.Text = "SpA:"; this.L_SPA.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // NUD_IV2 + // NUD_EIV2 // - this.NUD_IV2.Location = new System.Drawing.Point(33, 80); - this.NUD_IV2.Maximum = new decimal(new int[] { + this.NUD_EIV2.Location = new System.Drawing.Point(33, 80); + this.NUD_EIV2.Maximum = new decimal(new int[] { 31, 0, 0, 0}); - this.NUD_IV2.Minimum = new decimal(new int[] { + this.NUD_EIV2.Minimum = new decimal(new int[] { 4, 0, 0, -2147483648}); - this.NUD_IV2.Name = "NUD_IV2"; - this.NUD_IV2.Size = new System.Drawing.Size(34, 20); - this.NUD_IV2.TabIndex = 491; - this.NUD_IV2.Value = new decimal(new int[] { + this.NUD_EIV2.Name = "NUD_EIV2"; + this.NUD_EIV2.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV2.TabIndex = 491; + this.NUD_EIV2.Value = new decimal(new int[] { 31, 0, 0, 0}); // - // NUD_IV1 + // NUD_EIV1 // - this.NUD_IV1.Location = new System.Drawing.Point(33, 49); - this.NUD_IV1.Maximum = new decimal(new int[] { + this.NUD_EIV1.Location = new System.Drawing.Point(33, 49); + this.NUD_EIV1.Maximum = new decimal(new int[] { 31, 0, 0, 0}); - this.NUD_IV1.Minimum = new decimal(new int[] { + this.NUD_EIV1.Minimum = new decimal(new int[] { 4, 0, 0, -2147483648}); - this.NUD_IV1.Name = "NUD_IV1"; - this.NUD_IV1.Size = new System.Drawing.Size(34, 20); - this.NUD_IV1.TabIndex = 490; - this.NUD_IV1.Value = new decimal(new int[] { + this.NUD_EIV1.Name = "NUD_EIV1"; + this.NUD_EIV1.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV1.TabIndex = 490; + this.NUD_EIV1.Value = new decimal(new int[] { 31, 0, 0, 0}); // - // NUD_IV0 + // NUD_EIV0 // - this.NUD_IV0.Location = new System.Drawing.Point(33, 18); - this.NUD_IV0.Maximum = new decimal(new int[] { + this.NUD_EIV0.Location = new System.Drawing.Point(33, 18); + this.NUD_EIV0.Maximum = new decimal(new int[] { 31, 0, 0, 0}); - this.NUD_IV0.Minimum = new decimal(new int[] { + this.NUD_EIV0.Minimum = new decimal(new int[] { 4, 0, 0, -2147483648}); - this.NUD_IV0.Name = "NUD_IV0"; - this.NUD_IV0.Size = new System.Drawing.Size(34, 20); - this.NUD_IV0.TabIndex = 489; - this.NUD_IV0.Value = new decimal(new int[] { + this.NUD_EIV0.Name = "NUD_EIV0"; + this.NUD_EIV0.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV0.TabIndex = 489; + this.NUD_EIV0.Value = new decimal(new int[] { 31, 0, 0, @@ -930,6 +969,9 @@ private void InitializeComponent() // // Tab_Trades // + this.Tab_Trades.Controls.Add(this.CB_TNature); + this.Tab_Trades.Controls.Add(this.L_TNature); + this.Tab_Trades.Controls.Add(this.groupBox1); this.Tab_Trades.Controls.Add(this.CB_TRequest); this.Tab_Trades.Controls.Add(this.label1); this.Tab_Trades.Controls.Add(this.L_TTID); @@ -955,14 +997,14 @@ private void InitializeComponent() // CB_TRequest // this.CB_TRequest.FormattingEnabled = true; - this.CB_TRequest.Location = new System.Drawing.Point(230, 137); + this.CB_TRequest.Location = new System.Drawing.Point(230, 147); this.CB_TRequest.Name = "CB_TRequest"; this.CB_TRequest.Size = new System.Drawing.Size(121, 21); this.CB_TRequest.TabIndex = 29; // // label1 // - this.label1.Location = new System.Drawing.Point(121, 135); + this.label1.Location = new System.Drawing.Point(121, 145); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(106, 23); this.label1.TabIndex = 28; @@ -972,7 +1014,7 @@ private void InitializeComponent() // L_TTID // this.L_TTID.AutoSize = true; - this.L_TTID.Location = new System.Drawing.Point(250, 100); + this.L_TTID.Location = new System.Drawing.Point(252, 123); this.L_TTID.Name = "L_TTID"; this.L_TTID.Size = new System.Drawing.Size(28, 13); this.L_TTID.TabIndex = 27; @@ -981,7 +1023,7 @@ private void InitializeComponent() // // L_TID // - this.L_TID.Location = new System.Drawing.Point(136, 94); + this.L_TID.Location = new System.Drawing.Point(136, 117); this.L_TID.Name = "L_TID"; this.L_TID.Size = new System.Drawing.Size(50, 23); this.L_TID.TabIndex = 26; @@ -990,17 +1032,17 @@ private void InitializeComponent() // // NUD_TID // - this.NUD_TID.Location = new System.Drawing.Point(187, 97); + this.NUD_TID.Location = new System.Drawing.Point(187, 120); this.NUD_TID.Maximum = new decimal(new int[] { 999999, 0, 0, 0}); this.NUD_TID.Name = "NUD_TID"; - this.NUD_TID.Size = new System.Drawing.Size(59, 20); + this.NUD_TID.Size = new System.Drawing.Size(60, 20); this.NUD_TID.TabIndex = 25; this.NUD_TID.Value = new decimal(new int[] { - 123456, + 999999, 0, 0, 0}); @@ -1127,7 +1169,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(301, 111); + this.NUD_LevelBoost.Location = new System.Drawing.Point(301, 110); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -1147,7 +1189,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(169, 112); + this.CHK_Level.Location = new System.Drawing.Point(169, 111); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 510; @@ -1180,7 +1222,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(122, 137); + this.GB_Tweak.Location = new System.Drawing.Point(122, 136); this.GB_Tweak.Name = "GB_Tweak"; this.GB_Tweak.Size = new System.Drawing.Size(258, 144); this.GB_Tweak.TabIndex = 508; @@ -1376,14 +1418,266 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // L_GGender + // groupBox1 + // + this.groupBox1.Controls.Add(this.label8); + this.groupBox1.Controls.Add(this.NUD_TIV3); + this.groupBox1.Controls.Add(this.NUD_TIV4); + this.groupBox1.Controls.Add(this.NUD_TIV5); + this.groupBox1.Controls.Add(this.label9); + this.groupBox1.Controls.Add(this.label10); + this.groupBox1.Controls.Add(this.label11); + this.groupBox1.Controls.Add(this.NUD_TIV2); + this.groupBox1.Controls.Add(this.NUD_TIV1); + this.groupBox1.Controls.Add(this.NUD_TIV0); + this.groupBox1.Controls.Add(this.label12); + this.groupBox1.Controls.Add(this.label13); + this.groupBox1.Location = new System.Drawing.Point(129, 177); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(148, 112); + this.groupBox1.TabIndex = 30; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "IVs"; + // + // label8 + // + this.label8.Location = new System.Drawing.Point(4, 16); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(29, 21); + this.label8.TabIndex = 495; + this.label8.Text = "HP:"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_TIV3 + // + this.NUD_TIV3.Location = new System.Drawing.Point(104, 18); + this.NUD_TIV3.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV3.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV3.Name = "NUD_TIV3"; + this.NUD_TIV3.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV3.TabIndex = 492; + this.NUD_TIV3.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); // - this.L_GGender.Location = new System.Drawing.Point(131, 71); - this.L_GGender.Name = "L_GGender"; - this.L_GGender.Size = new System.Drawing.Size(55, 23); - this.L_GGender.TabIndex = 21; - this.L_GGender.Text = "Gender:"; - this.L_GGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // NUD_TIV4 + // + this.NUD_TIV4.Location = new System.Drawing.Point(104, 49); + this.NUD_TIV4.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV4.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV4.Name = "NUD_TIV4"; + this.NUD_TIV4.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV4.TabIndex = 493; + this.NUD_TIV4.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_TIV5 + // + this.NUD_TIV5.Location = new System.Drawing.Point(104, 80); + this.NUD_TIV5.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV5.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV5.Name = "NUD_TIV5"; + this.NUD_TIV5.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV5.TabIndex = 494; + this.NUD_TIV5.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // label9 + // + this.label9.Location = new System.Drawing.Point(73, 47); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(31, 21); + this.label9.TabIndex = 500; + this.label9.Text = "SpD:"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label10 + // + this.label10.Location = new System.Drawing.Point(73, 78); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(31, 21); + this.label10.TabIndex = 499; + this.label10.Text = "Spe:"; + this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label11 + // + this.label11.Location = new System.Drawing.Point(73, 16); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(31, 21); + this.label11.TabIndex = 498; + this.label11.Text = "SpA:"; + this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_TIV2 + // + this.NUD_TIV2.Location = new System.Drawing.Point(33, 80); + this.NUD_TIV2.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV2.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV2.Name = "NUD_TIV2"; + this.NUD_TIV2.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV2.TabIndex = 491; + this.NUD_TIV2.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_TIV1 + // + this.NUD_TIV1.Location = new System.Drawing.Point(33, 49); + this.NUD_TIV1.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV1.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV1.Name = "NUD_TIV1"; + this.NUD_TIV1.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV1.TabIndex = 490; + this.NUD_TIV1.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_TIV0 + // + this.NUD_TIV0.Location = new System.Drawing.Point(33, 18); + this.NUD_TIV0.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV0.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV0.Name = "NUD_TIV0"; + this.NUD_TIV0.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV0.TabIndex = 489; + this.NUD_TIV0.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // label12 + // + this.label12.Location = new System.Drawing.Point(7, 47); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(26, 21); + this.label12.TabIndex = 496; + this.label12.Text = "Atk:"; + this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label13 + // + this.label13.Location = new System.Drawing.Point(4, 78); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(29, 21); + this.label13.TabIndex = 497; + this.label13.Text = "Def:"; + this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_TNature + // + this.CB_TNature.FormattingEnabled = true; + this.CB_TNature.Location = new System.Drawing.Point(187, 97); + this.CB_TNature.Name = "CB_TNature"; + this.CB_TNature.Size = new System.Drawing.Size(121, 21); + this.CB_TNature.TabIndex = 505; + // + // L_TNature + // + this.L_TNature.Location = new System.Drawing.Point(131, 95); + this.L_TNature.Name = "L_TNature"; + this.L_TNature.Size = new System.Drawing.Size(55, 23); + this.L_TNature.TabIndex = 504; + this.L_TNature.Text = "Nature:"; + this.L_TNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_SpecialMove + // + this.CB_SpecialMove.FormattingEnabled = true; + this.CB_SpecialMove.Location = new System.Drawing.Point(187, 119); + this.CB_SpecialMove.Name = "CB_SpecialMove"; + this.CB_SpecialMove.Size = new System.Drawing.Size(121, 21); + this.CB_SpecialMove.TabIndex = 507; + // + // L_SpecialMove + // + this.L_SpecialMove.Location = new System.Drawing.Point(121, 117); + this.L_SpecialMove.Name = "L_SpecialMove"; + this.L_SpecialMove.Size = new System.Drawing.Size(65, 23); + this.L_SpecialMove.TabIndex = 506; + this.L_SpecialMove.Text = "Gift Move:"; + this.L_SpecialMove.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CHK_GIV3 + // + this.CHK_GIV3.AutoSize = true; + this.CHK_GIV3.Location = new System.Drawing.Point(187, 159); + this.CHK_GIV3.Name = "CHK_GIV3"; + this.CHK_GIV3.Size = new System.Drawing.Size(42, 17); + this.CHK_GIV3.TabIndex = 508; + this.CHK_GIV3.Text = "3IV"; + this.CHK_GIV3.UseVisualStyleBackColor = true; + // + // CHK_IsEgg + // + this.CHK_IsEgg.AutoSize = true; + this.CHK_IsEgg.Location = new System.Drawing.Point(187, 174); + this.CHK_IsEgg.Name = "CHK_IsEgg"; + this.CHK_IsEgg.Size = new System.Drawing.Size(56, 17); + this.CHK_IsEgg.TabIndex = 509; + this.CHK_IsEgg.Text = "Is Egg"; + this.CHK_IsEgg.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -1403,20 +1697,20 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).EndInit(); this.Tab_Encounters.ResumeLayout(false); this.Tab_Encounters.PerformLayout(); - this.GB_EVs.ResumeLayout(false); + this.GB_EEVs.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV0)).EndInit(); - this.GB_IVs.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).EndInit(); + this.GB_EIVs.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EIV0)).EndInit(); this.GB_EMoves.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).EndInit(); @@ -1430,6 +1724,13 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV0)).EndInit(); this.ResumeLayout(false); } @@ -1507,16 +1808,16 @@ private void InitializeComponent() private System.Windows.Forms.Label L_DEF; private System.Windows.Forms.Label L_ATK; private System.Windows.Forms.Label L_HP; - private System.Windows.Forms.NumericUpDown NUD_IV0; - private System.Windows.Forms.NumericUpDown NUD_IV1; - private System.Windows.Forms.NumericUpDown NUD_IV2; + private System.Windows.Forms.NumericUpDown NUD_EIV0; + private System.Windows.Forms.NumericUpDown NUD_EIV1; + private System.Windows.Forms.NumericUpDown NUD_EIV2; private System.Windows.Forms.Label L_SPA; private System.Windows.Forms.Label L_SPE; private System.Windows.Forms.Label L_SPD; - private System.Windows.Forms.NumericUpDown NUD_IV5; - private System.Windows.Forms.NumericUpDown NUD_IV4; - private System.Windows.Forms.NumericUpDown NUD_IV3; - private System.Windows.Forms.GroupBox GB_EVs; + private System.Windows.Forms.NumericUpDown NUD_EIV5; + private System.Windows.Forms.NumericUpDown NUD_EIV4; + private System.Windows.Forms.NumericUpDown NUD_EIV3; + private System.Windows.Forms.GroupBox GB_EEVs; private System.Windows.Forms.NumericUpDown NUD_EV5; private System.Windows.Forms.NumericUpDown NUD_EV4; private System.Windows.Forms.NumericUpDown NUD_EV3; @@ -1529,10 +1830,29 @@ private void InitializeComponent() private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; - private System.Windows.Forms.GroupBox GB_IVs; - private System.Windows.Forms.ComboBox CB_Nature; - private System.Windows.Forms.Label L_Nature; - private System.Windows.Forms.CheckBox CHK_IV3; + private System.Windows.Forms.GroupBox GB_EIVs; + private System.Windows.Forms.ComboBox CB_ENature; + private System.Windows.Forms.Label L_ENature; + private System.Windows.Forms.CheckBox CHK_EIV3; private System.Windows.Forms.Label L_GGender; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.NumericUpDown NUD_TIV3; + private System.Windows.Forms.NumericUpDown NUD_TIV4; + private System.Windows.Forms.NumericUpDown NUD_TIV5; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.NumericUpDown NUD_TIV2; + private System.Windows.Forms.NumericUpDown NUD_TIV1; + private System.Windows.Forms.NumericUpDown NUD_TIV0; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.ComboBox CB_TNature; + private System.Windows.Forms.Label L_TNature; + private System.Windows.Forms.ComboBox CB_SpecialMove; + private System.Windows.Forms.Label L_SpecialMove; + private System.Windows.Forms.CheckBox CHK_IsEgg; + private System.Windows.Forms.CheckBox CHK_GIV3; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index cb0db67107..07c540c9ee 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -106,10 +106,12 @@ public StaticEncounterEditor7(byte[][] infiles) CB_EMove1.Items.Add(s); CB_EMove2.Items.Add(s); CB_EMove3.Items.Add(s); + CB_SpecialMove.Items.Add(s); } - - CB_Nature.Items.Add("Random"); - CB_Nature.Items.AddRange(natures.Take(25).ToArray()); + + CB_ENature.Items.Add("Random"); + CB_ENature.Items.AddRange(natures.Take(25).ToArray()); + CB_TNature.Items.AddRange(natures.Take(25).ToArray()); foreach (string s in aura) CB_Aura.Items.Add(s); @@ -211,7 +213,11 @@ private void getGift() NUD_GLevel.Value = entry.Level; NUD_GForm.Value = entry.Form; NUD_GGender.Value = entry.Gender; + CB_SpecialMove.SelectedIndex = entry.SpecialMove; CHK_G_Lock.Checked = entry.ShinyLock; + CHK_GIV3.Checked = entry.IV3; + CHK_IsEgg.Checked = entry.IsEgg; + loading = false; } private void setGift() @@ -225,7 +231,9 @@ private void setGift() entry.Level = (int)NUD_GLevel.Value; entry.Form = (int)NUD_GForm.Value; entry.Gender = (int) NUD_GGender.Value; + entry.SpecialMove = CB_SpecialMove.SelectedIndex; entry.ShinyLock = CHK_G_Lock.Checked; + entry.IsEgg = CHK_IsEgg.Checked; } private void getEncounter() { @@ -247,12 +255,12 @@ private void getEncounter() CB_EMove2.SelectedIndex = moves[2]; CB_EMove3.SelectedIndex = moves[3]; - NUD_IV0.Value = iv[0]; - NUD_IV1.Value = iv[1]; - NUD_IV2.Value = iv[2]; - NUD_IV3.Value = iv[3]; - NUD_IV4.Value = iv[4]; - NUD_IV5.Value = iv[5]; + NUD_EIV0.Value = iv[0]; + NUD_EIV1.Value = iv[1]; + NUD_EIV2.Value = iv[2]; + NUD_EIV3.Value = iv[3]; + NUD_EIV4.Value = iv[4]; + NUD_EIV5.Value = iv[5]; NUD_EV0.Value = ev[0]; NUD_EV1.Value = ev[1]; @@ -262,8 +270,8 @@ private void getEncounter() NUD_EV5.Value = ev[5]; CHK_ShinyLock.Checked = entry.ShinyLock; - CHK_IV3.Checked = entry.IV3; - CB_Nature.SelectedIndex = entry.Nature; + CHK_EIV3.Checked = entry.IV3; + CB_ENature.SelectedIndex = entry.Nature; CB_Aura.SelectedIndex = entry.Aura; loading = false; @@ -288,12 +296,12 @@ private void setEncounter() CB_EMove3.SelectedIndex, }; - iv[0] = (int)NUD_IV0.Value; - iv[1] = (int)NUD_IV1.Value; - iv[2] = (int)NUD_IV2.Value; - iv[3] = (int)NUD_IV3.Value; - iv[4] = (int)NUD_IV4.Value; - iv[5] = (int)NUD_IV5.Value; + iv[0] = (int)NUD_EIV0.Value; + iv[1] = (int)NUD_EIV1.Value; + iv[2] = (int)NUD_EIV2.Value; + iv[3] = (int)NUD_EIV3.Value; + iv[4] = (int)NUD_EIV4.Value; + iv[5] = (int)NUD_EIV5.Value; entry.IVs = iv; ev[0] = (int)NUD_EV0.Value; @@ -305,7 +313,7 @@ private void setEncounter() entry.EVs = ev; entry.ShinyLock = CHK_ShinyLock.Checked; - entry.Nature = CB_Nature.SelectedIndex; + entry.Nature = CB_ENature.SelectedIndex; entry.Aura = CB_Aura.SelectedIndex; } private void getTrade() @@ -315,14 +323,23 @@ private void getTrade() loading = true; var entry = Trades[tEntry]; + var iv = entry.IVs; CB_TSpecies.SelectedIndex = entry.Species; CB_THeldItem.SelectedIndex = entry.HeldItem; NUD_TLevel.Value = entry.Level; NUD_TForm.Value = entry.Form; - + CB_TNature.SelectedIndex = entry.Nature; + NUD_TID.Value = entry.ID; CB_TRequest.SelectedIndex = entry.TradeRequestSpecies; + NUD_TIV0.Value = iv[0]; + NUD_TIV1.Value = iv[1]; + NUD_TIV2.Value = iv[2]; + NUD_TIV3.Value = iv[3]; + NUD_TIV4.Value = iv[4]; + NUD_TIV5.Value = iv[5]; + loading = false; } private void setTrade() @@ -331,13 +348,23 @@ private void setTrade() return; var entry = Trades[tEntry]; + var iv = entry.IVs; entry.Species = CB_TSpecies.SelectedIndex; entry.HeldItem = CB_THeldItem.SelectedIndex; entry.Level = (int)NUD_TLevel.Value; entry.Form = (int)NUD_TForm.Value; + entry.Nature = CB_TNature.SelectedIndex; - entry.ID = (uint)NUD_TID.Value; + entry.TID = (int)NUD_TID.Value; entry.TradeRequestSpecies = CB_TRequest.SelectedIndex; + + iv[0] = (int)NUD_TIV0.Value; + iv[1] = (int)NUD_TIV1.Value; + iv[2] = (int)NUD_TIV2.Value; + iv[3] = (int)NUD_TIV3.Value; + iv[4] = (int)NUD_TIV4.Value; + iv[5] = (int)NUD_TIV5.Value; + entry.IVs = iv; } private void changeSpecies(object sender, EventArgs e) @@ -369,7 +396,7 @@ private void changeSpecies(object sender, EventArgs e) } private void changeTID(object sender, EventArgs e) { - L_TTID.Text = $"TID: {NUD_TID.Value % 100000:000000}"; + L_TTID.Text = $"Gen 7 ID: {NUD_TID.Value % 100000:000000}"; } // Randomization @@ -441,6 +468,7 @@ private void B_RandAll_Click(object sender, EventArgs e) var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); + var aurarand = aura; for (int i = 3; i < Gifts.Length; i++) // Skip Starters { From 76307c66bf8722cfd1529cb3da4ae077e1a5a608 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 18 Dec 2017 22:25:27 -0500 Subject: [PATCH 022/191] Add gen7 gift nature --- .../Gen7/StaticEncounterEditor7.Designer.cs | 773 +++++++++--------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 8 +- 2 files changed, 404 insertions(+), 377 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index ccbfd9c275..28c3737ba4 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -30,6 +30,10 @@ private void InitializeComponent() { this.TC_Tabs = new System.Windows.Forms.TabControl(); this.Tab_Gifts = new System.Windows.Forms.TabPage(); + this.CHK_IsEgg = new System.Windows.Forms.CheckBox(); + this.CHK_GIV3 = new System.Windows.Forms.CheckBox(); + this.CB_SpecialMove = new System.Windows.Forms.ComboBox(); + this.L_SpecialMove = new System.Windows.Forms.Label(); this.L_GGender = new System.Windows.Forms.Label(); this.NUD_GGender = new System.Windows.Forms.NumericUpDown(); this.CHK_G_Lock = new System.Windows.Forms.CheckBox(); @@ -90,6 +94,21 @@ private void InitializeComponent() this.NUD_ELevel = new System.Windows.Forms.NumericUpDown(); this.LB_Encounter = new System.Windows.Forms.ListBox(); this.Tab_Trades = new System.Windows.Forms.TabPage(); + this.CB_TNature = new System.Windows.Forms.ComboBox(); + this.L_TNature = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label8 = new System.Windows.Forms.Label(); + this.NUD_TIV3 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV4 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV5 = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.NUD_TIV2 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV1 = new System.Windows.Forms.NumericUpDown(); + this.NUD_TIV0 = new System.Windows.Forms.NumericUpDown(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); this.CB_TRequest = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.L_TTID = new System.Windows.Forms.Label(); @@ -126,25 +145,8 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label8 = new System.Windows.Forms.Label(); - this.NUD_TIV3 = new System.Windows.Forms.NumericUpDown(); - this.NUD_TIV4 = new System.Windows.Forms.NumericUpDown(); - this.NUD_TIV5 = new System.Windows.Forms.NumericUpDown(); - this.label9 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.NUD_TIV2 = new System.Windows.Forms.NumericUpDown(); - this.NUD_TIV1 = new System.Windows.Forms.NumericUpDown(); - this.NUD_TIV0 = new System.Windows.Forms.NumericUpDown(); - this.label12 = new System.Windows.Forms.Label(); - this.label13 = new System.Windows.Forms.Label(); - this.CB_TNature = new System.Windows.Forms.ComboBox(); - this.L_TNature = new System.Windows.Forms.Label(); - this.CB_SpecialMove = new System.Windows.Forms.ComboBox(); - this.L_SpecialMove = new System.Windows.Forms.Label(); - this.CHK_GIV3 = new System.Windows.Forms.CheckBox(); - this.CHK_IsEgg = new System.Windows.Forms.CheckBox(); + this.CB_GNature = new System.Windows.Forms.ComboBox(); + this.L_GNature = new System.Windows.Forms.Label(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); @@ -169,12 +171,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).BeginInit(); this.Tab_Trades.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TID)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TForm)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TLevel)).BeginInit(); - this.Tab_Randomizer.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); - this.GB_Tweak.SuspendLayout(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).BeginInit(); @@ -182,6 +178,12 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV0)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TID)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TForm)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TLevel)).BeginInit(); + this.Tab_Randomizer.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); + this.GB_Tweak.SuspendLayout(); this.SuspendLayout(); // // TC_Tabs @@ -201,6 +203,8 @@ private void InitializeComponent() // // Tab_Gifts // + this.Tab_Gifts.Controls.Add(this.CB_GNature); + this.Tab_Gifts.Controls.Add(this.L_GNature); this.Tab_Gifts.Controls.Add(this.CHK_IsEgg); this.Tab_Gifts.Controls.Add(this.CHK_GIV3); this.Tab_Gifts.Controls.Add(this.CB_SpecialMove); @@ -224,6 +228,43 @@ private void InitializeComponent() this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; // + // CHK_IsEgg + // + this.CHK_IsEgg.AutoSize = true; + this.CHK_IsEgg.Location = new System.Drawing.Point(187, 197); + this.CHK_IsEgg.Name = "CHK_IsEgg"; + this.CHK_IsEgg.Size = new System.Drawing.Size(56, 17); + this.CHK_IsEgg.TabIndex = 509; + this.CHK_IsEgg.Text = "Is Egg"; + this.CHK_IsEgg.UseVisualStyleBackColor = true; + // + // CHK_GIV3 + // + this.CHK_GIV3.AutoSize = true; + this.CHK_GIV3.Location = new System.Drawing.Point(187, 182); + this.CHK_GIV3.Name = "CHK_GIV3"; + this.CHK_GIV3.Size = new System.Drawing.Size(42, 17); + this.CHK_GIV3.TabIndex = 508; + this.CHK_GIV3.Text = "3IV"; + this.CHK_GIV3.UseVisualStyleBackColor = true; + // + // CB_SpecialMove + // + this.CB_SpecialMove.FormattingEnabled = true; + this.CB_SpecialMove.Location = new System.Drawing.Point(187, 142); + this.CB_SpecialMove.Name = "CB_SpecialMove"; + this.CB_SpecialMove.Size = new System.Drawing.Size(121, 21); + this.CB_SpecialMove.TabIndex = 507; + // + // L_SpecialMove + // + this.L_SpecialMove.Location = new System.Drawing.Point(121, 140); + this.L_SpecialMove.Name = "L_SpecialMove"; + this.L_SpecialMove.Size = new System.Drawing.Size(65, 23); + this.L_SpecialMove.TabIndex = 506; + this.L_SpecialMove.Text = "Gift Move:"; + this.L_SpecialMove.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // L_GGender // this.L_GGender.Location = new System.Drawing.Point(131, 71); @@ -253,7 +294,7 @@ private void InitializeComponent() // CHK_G_Lock // this.CHK_G_Lock.AutoSize = true; - this.CHK_G_Lock.Location = new System.Drawing.Point(187, 144); + this.CHK_G_Lock.Location = new System.Drawing.Point(187, 167); this.CHK_G_Lock.Name = "CHK_G_Lock"; this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); this.CHK_G_Lock.TabIndex = 19; @@ -994,118 +1035,342 @@ private void InitializeComponent() this.Tab_Trades.Text = "Trades"; this.Tab_Trades.UseVisualStyleBackColor = true; // - // CB_TRequest + // CB_TNature // - this.CB_TRequest.FormattingEnabled = true; - this.CB_TRequest.Location = new System.Drawing.Point(230, 147); - this.CB_TRequest.Name = "CB_TRequest"; - this.CB_TRequest.Size = new System.Drawing.Size(121, 21); - this.CB_TRequest.TabIndex = 29; + this.CB_TNature.FormattingEnabled = true; + this.CB_TNature.Location = new System.Drawing.Point(187, 97); + this.CB_TNature.Name = "CB_TNature"; + this.CB_TNature.Size = new System.Drawing.Size(121, 21); + this.CB_TNature.TabIndex = 505; // - // label1 + // L_TNature // - this.label1.Location = new System.Drawing.Point(121, 145); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(106, 23); - this.label1.TabIndex = 28; - this.label1.Text = "Requested Species:"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.L_TNature.Location = new System.Drawing.Point(131, 95); + this.L_TNature.Name = "L_TNature"; + this.L_TNature.Size = new System.Drawing.Size(55, 23); + this.L_TNature.TabIndex = 504; + this.L_TNature.Text = "Nature:"; + this.L_TNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // L_TTID + // groupBox1 // - this.L_TTID.AutoSize = true; - this.L_TTID.Location = new System.Drawing.Point(252, 123); - this.L_TTID.Name = "L_TTID"; - this.L_TTID.Size = new System.Drawing.Size(28, 13); - this.L_TTID.TabIndex = 27; - this.L_TTID.Text = "TID:"; - this.L_TTID.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.groupBox1.Controls.Add(this.label8); + this.groupBox1.Controls.Add(this.NUD_TIV3); + this.groupBox1.Controls.Add(this.NUD_TIV4); + this.groupBox1.Controls.Add(this.NUD_TIV5); + this.groupBox1.Controls.Add(this.label9); + this.groupBox1.Controls.Add(this.label10); + this.groupBox1.Controls.Add(this.label11); + this.groupBox1.Controls.Add(this.NUD_TIV2); + this.groupBox1.Controls.Add(this.NUD_TIV1); + this.groupBox1.Controls.Add(this.NUD_TIV0); + this.groupBox1.Controls.Add(this.label12); + this.groupBox1.Controls.Add(this.label13); + this.groupBox1.Location = new System.Drawing.Point(129, 177); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(148, 112); + this.groupBox1.TabIndex = 30; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "IVs"; // - // L_TID + // label8 // - this.L_TID.Location = new System.Drawing.Point(136, 117); - this.L_TID.Name = "L_TID"; - this.L_TID.Size = new System.Drawing.Size(50, 23); - this.L_TID.TabIndex = 26; - this.L_TID.Text = "ID:"; - this.L_TID.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.label8.Location = new System.Drawing.Point(4, 16); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(29, 21); + this.label8.TabIndex = 495; + this.label8.Text = "HP:"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // NUD_TID + // NUD_TIV3 // - this.NUD_TID.Location = new System.Drawing.Point(187, 120); - this.NUD_TID.Maximum = new decimal(new int[] { - 999999, + this.NUD_TIV3.Location = new System.Drawing.Point(104, 18); + this.NUD_TIV3.Maximum = new decimal(new int[] { + 31, 0, 0, 0}); - this.NUD_TID.Name = "NUD_TID"; - this.NUD_TID.Size = new System.Drawing.Size(60, 20); - this.NUD_TID.TabIndex = 25; - this.NUD_TID.Value = new decimal(new int[] { - 999999, + this.NUD_TIV3.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV3.Name = "NUD_TIV3"; + this.NUD_TIV3.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV3.TabIndex = 492; + this.NUD_TIV3.Value = new decimal(new int[] { + 31, 0, 0, 0}); - this.NUD_TID.ValueChanged += new System.EventHandler(this.changeTID); - // - // CB_THeldItem - // - this.CB_THeldItem.FormattingEnabled = true; - this.CB_THeldItem.Location = new System.Drawing.Point(187, 74); - this.CB_THeldItem.Name = "CB_THeldItem"; - this.CB_THeldItem.Size = new System.Drawing.Size(121, 21); - this.CB_THeldItem.TabIndex = 24; - // - // L_THeldItem - // - this.L_THeldItem.Location = new System.Drawing.Point(131, 72); - this.L_THeldItem.Name = "L_THeldItem"; - this.L_THeldItem.Size = new System.Drawing.Size(55, 23); - this.L_THeldItem.TabIndex = 23; - this.L_THeldItem.Text = "Held Item:"; - this.L_THeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // CB_TSpecies - // - this.CB_TSpecies.FormattingEnabled = true; - this.CB_TSpecies.Location = new System.Drawing.Point(187, 7); - this.CB_TSpecies.Name = "CB_TSpecies"; - this.CB_TSpecies.Size = new System.Drawing.Size(121, 21); - this.CB_TSpecies.TabIndex = 22; - this.CB_TSpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); // - // L_TForm + // NUD_TIV4 // - this.L_TForm.Location = new System.Drawing.Point(131, 49); - this.L_TForm.Name = "L_TForm"; - this.L_TForm.Size = new System.Drawing.Size(55, 23); - this.L_TForm.TabIndex = 21; - this.L_TForm.Text = "Form:"; - this.L_TForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.NUD_TIV4.Location = new System.Drawing.Point(104, 49); + this.NUD_TIV4.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV4.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV4.Name = "NUD_TIV4"; + this.NUD_TIV4.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV4.TabIndex = 493; + this.NUD_TIV4.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); // - // NUD_TForm + // NUD_TIV5 // - this.NUD_TForm.Location = new System.Drawing.Point(187, 52); - this.NUD_TForm.Maximum = new decimal(new int[] { - 255, + this.NUD_TIV5.Location = new System.Drawing.Point(104, 80); + this.NUD_TIV5.Maximum = new decimal(new int[] { + 31, 0, 0, 0}); - this.NUD_TForm.Name = "NUD_TForm"; - this.NUD_TForm.Size = new System.Drawing.Size(48, 20); - this.NUD_TForm.TabIndex = 20; - this.NUD_TForm.Value = new decimal(new int[] { - 100, + this.NUD_TIV5.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV5.Name = "NUD_TIV5"; + this.NUD_TIV5.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV5.TabIndex = 494; + this.NUD_TIV5.Value = new decimal(new int[] { + 31, 0, 0, 0}); // - // L_TLevel + // label9 // - this.L_TLevel.Location = new System.Drawing.Point(131, 27); - this.L_TLevel.Name = "L_TLevel"; - this.L_TLevel.Size = new System.Drawing.Size(55, 23); - this.L_TLevel.TabIndex = 19; + this.label9.Location = new System.Drawing.Point(73, 47); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(31, 21); + this.label9.TabIndex = 500; + this.label9.Text = "SpD:"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label10 + // + this.label10.Location = new System.Drawing.Point(73, 78); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(31, 21); + this.label10.TabIndex = 499; + this.label10.Text = "Spe:"; + this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label11 + // + this.label11.Location = new System.Drawing.Point(73, 16); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(31, 21); + this.label11.TabIndex = 498; + this.label11.Text = "SpA:"; + this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_TIV2 + // + this.NUD_TIV2.Location = new System.Drawing.Point(33, 80); + this.NUD_TIV2.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV2.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV2.Name = "NUD_TIV2"; + this.NUD_TIV2.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV2.TabIndex = 491; + this.NUD_TIV2.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_TIV1 + // + this.NUD_TIV1.Location = new System.Drawing.Point(33, 49); + this.NUD_TIV1.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV1.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV1.Name = "NUD_TIV1"; + this.NUD_TIV1.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV1.TabIndex = 490; + this.NUD_TIV1.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_TIV0 + // + this.NUD_TIV0.Location = new System.Drawing.Point(33, 18); + this.NUD_TIV0.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_TIV0.Minimum = new decimal(new int[] { + 4, + 0, + 0, + -2147483648}); + this.NUD_TIV0.Name = "NUD_TIV0"; + this.NUD_TIV0.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV0.TabIndex = 489; + this.NUD_TIV0.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // label12 + // + this.label12.Location = new System.Drawing.Point(7, 47); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(26, 21); + this.label12.TabIndex = 496; + this.label12.Text = "Atk:"; + this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label13 + // + this.label13.Location = new System.Drawing.Point(4, 78); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(29, 21); + this.label13.TabIndex = 497; + this.label13.Text = "Def:"; + this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_TRequest + // + this.CB_TRequest.FormattingEnabled = true; + this.CB_TRequest.Location = new System.Drawing.Point(230, 147); + this.CB_TRequest.Name = "CB_TRequest"; + this.CB_TRequest.Size = new System.Drawing.Size(121, 21); + this.CB_TRequest.TabIndex = 29; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(121, 145); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(106, 23); + this.label1.TabIndex = 28; + this.label1.Text = "Requested Species:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_TTID + // + this.L_TTID.AutoSize = true; + this.L_TTID.Location = new System.Drawing.Point(252, 123); + this.L_TTID.Name = "L_TTID"; + this.L_TTID.Size = new System.Drawing.Size(28, 13); + this.L_TTID.TabIndex = 27; + this.L_TTID.Text = "TID:"; + this.L_TTID.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // L_TID + // + this.L_TID.Location = new System.Drawing.Point(136, 117); + this.L_TID.Name = "L_TID"; + this.L_TID.Size = new System.Drawing.Size(50, 23); + this.L_TID.TabIndex = 26; + this.L_TID.Text = "ID:"; + this.L_TID.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_TID + // + this.NUD_TID.Location = new System.Drawing.Point(187, 120); + this.NUD_TID.Maximum = new decimal(new int[] { + 999999, + 0, + 0, + 0}); + this.NUD_TID.Name = "NUD_TID"; + this.NUD_TID.Size = new System.Drawing.Size(60, 20); + this.NUD_TID.TabIndex = 25; + this.NUD_TID.Value = new decimal(new int[] { + 999999, + 0, + 0, + 0}); + this.NUD_TID.ValueChanged += new System.EventHandler(this.changeTID); + // + // CB_THeldItem + // + this.CB_THeldItem.FormattingEnabled = true; + this.CB_THeldItem.Location = new System.Drawing.Point(187, 74); + this.CB_THeldItem.Name = "CB_THeldItem"; + this.CB_THeldItem.Size = new System.Drawing.Size(121, 21); + this.CB_THeldItem.TabIndex = 24; + // + // L_THeldItem + // + this.L_THeldItem.Location = new System.Drawing.Point(131, 72); + this.L_THeldItem.Name = "L_THeldItem"; + this.L_THeldItem.Size = new System.Drawing.Size(55, 23); + this.L_THeldItem.TabIndex = 23; + this.L_THeldItem.Text = "Held Item:"; + this.L_THeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_TSpecies + // + this.CB_TSpecies.FormattingEnabled = true; + this.CB_TSpecies.Location = new System.Drawing.Point(187, 7); + this.CB_TSpecies.Name = "CB_TSpecies"; + this.CB_TSpecies.Size = new System.Drawing.Size(121, 21); + this.CB_TSpecies.TabIndex = 22; + this.CB_TSpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // L_TForm + // + this.L_TForm.Location = new System.Drawing.Point(131, 49); + this.L_TForm.Name = "L_TForm"; + this.L_TForm.Size = new System.Drawing.Size(55, 23); + this.L_TForm.TabIndex = 21; + this.L_TForm.Text = "Form:"; + this.L_TForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_TForm + // + this.NUD_TForm.Location = new System.Drawing.Point(187, 52); + this.NUD_TForm.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_TForm.Name = "NUD_TForm"; + this.NUD_TForm.Size = new System.Drawing.Size(48, 20); + this.NUD_TForm.TabIndex = 20; + this.NUD_TForm.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + // + // L_TLevel + // + this.L_TLevel.Location = new System.Drawing.Point(131, 27); + this.L_TLevel.Name = "L_TLevel"; + this.L_TLevel.Size = new System.Drawing.Size(55, 23); + this.L_TLevel.TabIndex = 19; this.L_TLevel.Text = "Level:"; this.L_TLevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -1418,266 +1683,22 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Controls.Add(this.NUD_TIV3); - this.groupBox1.Controls.Add(this.NUD_TIV4); - this.groupBox1.Controls.Add(this.NUD_TIV5); - this.groupBox1.Controls.Add(this.label9); - this.groupBox1.Controls.Add(this.label10); - this.groupBox1.Controls.Add(this.label11); - this.groupBox1.Controls.Add(this.NUD_TIV2); - this.groupBox1.Controls.Add(this.NUD_TIV1); - this.groupBox1.Controls.Add(this.NUD_TIV0); - this.groupBox1.Controls.Add(this.label12); - this.groupBox1.Controls.Add(this.label13); - this.groupBox1.Location = new System.Drawing.Point(129, 177); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(148, 112); - this.groupBox1.TabIndex = 30; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "IVs"; - // - // label8 - // - this.label8.Location = new System.Drawing.Point(4, 16); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(29, 21); - this.label8.TabIndex = 495; - this.label8.Text = "HP:"; - this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_TIV3 - // - this.NUD_TIV3.Location = new System.Drawing.Point(104, 18); - this.NUD_TIV3.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_TIV3.Minimum = new decimal(new int[] { - 4, - 0, - 0, - -2147483648}); - this.NUD_TIV3.Name = "NUD_TIV3"; - this.NUD_TIV3.Size = new System.Drawing.Size(34, 20); - this.NUD_TIV3.TabIndex = 492; - this.NUD_TIV3.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_TIV4 - // - this.NUD_TIV4.Location = new System.Drawing.Point(104, 49); - this.NUD_TIV4.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_TIV4.Minimum = new decimal(new int[] { - 4, - 0, - 0, - -2147483648}); - this.NUD_TIV4.Name = "NUD_TIV4"; - this.NUD_TIV4.Size = new System.Drawing.Size(34, 20); - this.NUD_TIV4.TabIndex = 493; - this.NUD_TIV4.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_TIV5 - // - this.NUD_TIV5.Location = new System.Drawing.Point(104, 80); - this.NUD_TIV5.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_TIV5.Minimum = new decimal(new int[] { - 4, - 0, - 0, - -2147483648}); - this.NUD_TIV5.Name = "NUD_TIV5"; - this.NUD_TIV5.Size = new System.Drawing.Size(34, 20); - this.NUD_TIV5.TabIndex = 494; - this.NUD_TIV5.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // label9 - // - this.label9.Location = new System.Drawing.Point(73, 47); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(31, 21); - this.label9.TabIndex = 500; - this.label9.Text = "SpD:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label10 - // - this.label10.Location = new System.Drawing.Point(73, 78); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(31, 21); - this.label10.TabIndex = 499; - this.label10.Text = "Spe:"; - this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label11 - // - this.label11.Location = new System.Drawing.Point(73, 16); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(31, 21); - this.label11.TabIndex = 498; - this.label11.Text = "SpA:"; - this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_TIV2 - // - this.NUD_TIV2.Location = new System.Drawing.Point(33, 80); - this.NUD_TIV2.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_TIV2.Minimum = new decimal(new int[] { - 4, - 0, - 0, - -2147483648}); - this.NUD_TIV2.Name = "NUD_TIV2"; - this.NUD_TIV2.Size = new System.Drawing.Size(34, 20); - this.NUD_TIV2.TabIndex = 491; - this.NUD_TIV2.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_TIV1 - // - this.NUD_TIV1.Location = new System.Drawing.Point(33, 49); - this.NUD_TIV1.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_TIV1.Minimum = new decimal(new int[] { - 4, - 0, - 0, - -2147483648}); - this.NUD_TIV1.Name = "NUD_TIV1"; - this.NUD_TIV1.Size = new System.Drawing.Size(34, 20); - this.NUD_TIV1.TabIndex = 490; - this.NUD_TIV1.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_TIV0 - // - this.NUD_TIV0.Location = new System.Drawing.Point(33, 18); - this.NUD_TIV0.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_TIV0.Minimum = new decimal(new int[] { - 4, - 0, - 0, - -2147483648}); - this.NUD_TIV0.Name = "NUD_TIV0"; - this.NUD_TIV0.Size = new System.Drawing.Size(34, 20); - this.NUD_TIV0.TabIndex = 489; - this.NUD_TIV0.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // label12 - // - this.label12.Location = new System.Drawing.Point(7, 47); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(26, 21); - this.label12.TabIndex = 496; - this.label12.Text = "Atk:"; - this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label13 - // - this.label13.Location = new System.Drawing.Point(4, 78); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(29, 21); - this.label13.TabIndex = 497; - this.label13.Text = "Def:"; - this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // CB_GNature // - // CB_TNature - // - this.CB_TNature.FormattingEnabled = true; - this.CB_TNature.Location = new System.Drawing.Point(187, 97); - this.CB_TNature.Name = "CB_TNature"; - this.CB_TNature.Size = new System.Drawing.Size(121, 21); - this.CB_TNature.TabIndex = 505; - // - // L_TNature + this.CB_GNature.FormattingEnabled = true; + this.CB_GNature.Location = new System.Drawing.Point(187, 119); + this.CB_GNature.Name = "CB_GNature"; + this.CB_GNature.Size = new System.Drawing.Size(121, 21); + this.CB_GNature.TabIndex = 511; // - this.L_TNature.Location = new System.Drawing.Point(131, 95); - this.L_TNature.Name = "L_TNature"; - this.L_TNature.Size = new System.Drawing.Size(55, 23); - this.L_TNature.TabIndex = 504; - this.L_TNature.Text = "Nature:"; - this.L_TNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // L_GNature // - // CB_SpecialMove - // - this.CB_SpecialMove.FormattingEnabled = true; - this.CB_SpecialMove.Location = new System.Drawing.Point(187, 119); - this.CB_SpecialMove.Name = "CB_SpecialMove"; - this.CB_SpecialMove.Size = new System.Drawing.Size(121, 21); - this.CB_SpecialMove.TabIndex = 507; - // - // L_SpecialMove - // - this.L_SpecialMove.Location = new System.Drawing.Point(121, 117); - this.L_SpecialMove.Name = "L_SpecialMove"; - this.L_SpecialMove.Size = new System.Drawing.Size(65, 23); - this.L_SpecialMove.TabIndex = 506; - this.L_SpecialMove.Text = "Gift Move:"; - this.L_SpecialMove.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // CHK_GIV3 - // - this.CHK_GIV3.AutoSize = true; - this.CHK_GIV3.Location = new System.Drawing.Point(187, 159); - this.CHK_GIV3.Name = "CHK_GIV3"; - this.CHK_GIV3.Size = new System.Drawing.Size(42, 17); - this.CHK_GIV3.TabIndex = 508; - this.CHK_GIV3.Text = "3IV"; - this.CHK_GIV3.UseVisualStyleBackColor = true; - // - // CHK_IsEgg - // - this.CHK_IsEgg.AutoSize = true; - this.CHK_IsEgg.Location = new System.Drawing.Point(187, 174); - this.CHK_IsEgg.Name = "CHK_IsEgg"; - this.CHK_IsEgg.Size = new System.Drawing.Size(56, 17); - this.CHK_IsEgg.TabIndex = 509; - this.CHK_IsEgg.Text = "Is Egg"; - this.CHK_IsEgg.UseVisualStyleBackColor = true; + this.L_GNature.Location = new System.Drawing.Point(131, 117); + this.L_GNature.Name = "L_GNature"; + this.L_GNature.Size = new System.Drawing.Size(55, 23); + this.L_GNature.TabIndex = 510; + this.L_GNature.Text = "Nature:"; + this.L_GNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // StaticEncounterEditor7 // @@ -1716,6 +1737,13 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).EndInit(); this.Tab_Trades.ResumeLayout(false); this.Tab_Trades.PerformLayout(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV0)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TLevel)).EndInit(); @@ -1724,13 +1752,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); - this.groupBox1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV5)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV0)).EndInit(); this.ResumeLayout(false); } @@ -1854,5 +1875,7 @@ private void InitializeComponent() private System.Windows.Forms.Label L_SpecialMove; private System.Windows.Forms.CheckBox CHK_IsEgg; private System.Windows.Forms.CheckBox CHK_GIV3; + private System.Windows.Forms.ComboBox CB_GNature; + private System.Windows.Forms.Label L_GNature; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 07c540c9ee..94c8fc5ce1 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -108,7 +108,9 @@ public StaticEncounterEditor7(byte[][] infiles) CB_EMove3.Items.Add(s); CB_SpecialMove.Items.Add(s); } - + + CB_GNature.Items.Add("Random"); + CB_GNature.Items.AddRange(natures.Take(25).ToArray()); CB_ENature.Items.Add("Random"); CB_ENature.Items.AddRange(natures.Take(25).ToArray()); CB_TNature.Items.AddRange(natures.Take(25).ToArray()); @@ -213,6 +215,7 @@ private void getGift() NUD_GLevel.Value = entry.Level; NUD_GForm.Value = entry.Form; NUD_GGender.Value = entry.Gender; + CB_GNature.SelectedIndex = entry.Nature + 1; CB_SpecialMove.SelectedIndex = entry.SpecialMove; CHK_G_Lock.Checked = entry.ShinyLock; CHK_GIV3.Checked = entry.IV3; @@ -231,6 +234,7 @@ private void setGift() entry.Level = (int)NUD_GLevel.Value; entry.Form = (int)NUD_GForm.Value; entry.Gender = (int) NUD_GGender.Value; + entry.Nature = (sbyte)(CB_GNature.SelectedIndex - 1); entry.SpecialMove = CB_SpecialMove.SelectedIndex; entry.ShinyLock = CHK_G_Lock.Checked; entry.IsEgg = CHK_IsEgg.Checked; @@ -387,7 +391,7 @@ private void changeSpecies(object sender, EventArgs e) entry.Species = cb.SelectedIndex; LB_Encounter.Items[eEntry] = getEntryText(entry, eEntry); } - else if(sender == CB_TSpecies) + else if (sender == CB_TSpecies) { var entry = Trades[tEntry]; entry.Species = cb.SelectedIndex; From 99b51f84d0a29598ad752c0a526f8f65ac9c7ee8 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Tue, 19 Dec 2017 20:56:50 -0500 Subject: [PATCH 023/191] Update gen6 static/gift editors --- pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 778 +++++++++--------- pk3DS/Subforms/Gen6/GiftEditor6.cs | 35 +- .../Gen6/StaticEncounterEditor6.Designer.cs | 426 +++++----- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 29 +- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 1 - 5 files changed, 644 insertions(+), 625 deletions(-) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index 77c5d01f56..a1d3aed3c6 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -33,26 +33,13 @@ private void InitializeComponent() this.LB_Gifts = new System.Windows.Forms.ListBox(); this.CB_Species = new System.Windows.Forms.ComboBox(); this.CB_HeldItem = new System.Windows.Forms.ComboBox(); - this.NUD_IV0 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV1 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV2 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV3 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV4 = new System.Windows.Forms.NumericUpDown(); - this.NUD_IV5 = new System.Windows.Forms.NumericUpDown(); this.L_Species = new System.Windows.Forms.Label(); this.L_HeldItem = new System.Windows.Forms.Label(); this.NUD_Level = new System.Windows.Forms.NumericUpDown(); this.L_Level = new System.Windows.Forms.Label(); this.NUD_Form = new System.Windows.Forms.NumericUpDown(); this.L_Form = new System.Windows.Forms.Label(); - this.L_HP = new System.Windows.Forms.Label(); - this.L_ATK = new System.Windows.Forms.Label(); - this.L_DEF = new System.Windows.Forms.Label(); - this.L_SPA = new System.Windows.Forms.Label(); - this.L_SPE = new System.Windows.Forms.Label(); - this.L_SPD = new System.Windows.Forms.Label(); this.L_Nature = new System.Windows.Forms.Label(); - this.NUD_Nature = new System.Windows.Forms.NumericUpDown(); this.L_Ability = new System.Windows.Forms.Label(); this.NUD_Ability = new System.Windows.Forms.NumericUpDown(); this.L_Gender = new System.Windows.Forms.Label(); @@ -61,12 +48,28 @@ private void InitializeComponent() this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); - this.label1 = new System.Windows.Forms.Label(); - this.L_Hint = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.L_Mega = new System.Windows.Forms.Label(); - this.CHK_Mega = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); + this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); + this.CHK_Level = new System.Windows.Forms.CheckBox(); + this.GB_EIVs = new System.Windows.Forms.GroupBox(); + this.L_HP = new System.Windows.Forms.Label(); + this.NUD_IV3 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV4 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV5 = new System.Windows.Forms.NumericUpDown(); + this.L_SPD = new System.Windows.Forms.Label(); + this.L_SPE = new System.Windows.Forms.Label(); + this.L_SPA = new System.Windows.Forms.Label(); + this.NUD_IV2 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV1 = new System.Windows.Forms.NumericUpDown(); + this.NUD_IV0 = new System.Windows.Forms.NumericUpDown(); + this.L_ATK = new System.Windows.Forms.Label(); + this.L_DEF = new System.Windows.Forms.Label(); + this.CB_Nature = new System.Windows.Forms.ComboBox(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); + this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); this.CHK_BST = new System.Windows.Forms.CheckBox(); @@ -78,31 +81,29 @@ private void InitializeComponent() this.CHK_G3 = new System.Windows.Forms.CheckBox(); this.CHK_G2 = new System.Windows.Forms.CheckBox(); this.CHK_G1 = new System.Windows.Forms.CheckBox(); - this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); - this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).BeginInit(); + this.B_ModifyLevel = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Nature)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); - this.GB_Tweak.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); + this.GB_EIVs.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); + this.GB_Tweak.SuspendLayout(); this.SuspendLayout(); // // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(264, 269); + this.B_Cancel.Location = new System.Drawing.Point(264, 338); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(70, 23); this.B_Cancel.TabIndex = 467; @@ -113,7 +114,7 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(335, 269); + this.B_Save.Location = new System.Drawing.Point(335, 338); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(70, 23); this.B_Save.TabIndex = 466; @@ -128,14 +129,14 @@ private void InitializeComponent() this.LB_Gifts.FormattingEnabled = true; this.LB_Gifts.Location = new System.Drawing.Point(12, 12); this.LB_Gifts.Name = "LB_Gifts"; - this.LB_Gifts.Size = new System.Drawing.Size(110, 277); + this.LB_Gifts.Size = new System.Drawing.Size(110, 342); this.LB_Gifts.TabIndex = 468; this.LB_Gifts.SelectedIndexChanged += new System.EventHandler(this.changeIndex); // // CB_Species // this.CB_Species.FormattingEnabled = true; - this.CB_Species.Location = new System.Drawing.Point(106, 3); + this.CB_Species.Location = new System.Drawing.Point(65, 7); this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 469; @@ -144,164 +145,32 @@ private void InitializeComponent() // CB_HeldItem // this.CB_HeldItem.FormattingEnabled = true; - this.CB_HeldItem.Location = new System.Drawing.Point(106, 28); + this.CB_HeldItem.Location = new System.Drawing.Point(65, 118); this.CB_HeldItem.Name = "CB_HeldItem"; this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); this.CB_HeldItem.TabIndex = 470; // - // NUD_IV0 - // - this.NUD_IV0.Location = new System.Drawing.Point(139, 152); - this.NUD_IV0.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_IV0.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_IV0.Name = "NUD_IV0"; - this.NUD_IV0.Size = new System.Drawing.Size(34, 20); - this.NUD_IV0.TabIndex = 471; - this.NUD_IV0.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_IV1 - // - this.NUD_IV1.Location = new System.Drawing.Point(139, 175); - this.NUD_IV1.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_IV1.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_IV1.Name = "NUD_IV1"; - this.NUD_IV1.Size = new System.Drawing.Size(34, 20); - this.NUD_IV1.TabIndex = 472; - this.NUD_IV1.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_IV2 - // - this.NUD_IV2.Location = new System.Drawing.Point(139, 198); - this.NUD_IV2.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_IV2.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_IV2.Name = "NUD_IV2"; - this.NUD_IV2.Size = new System.Drawing.Size(34, 20); - this.NUD_IV2.TabIndex = 473; - this.NUD_IV2.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_IV3 - // - this.NUD_IV3.Location = new System.Drawing.Point(220, 152); - this.NUD_IV3.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_IV3.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_IV3.Name = "NUD_IV3"; - this.NUD_IV3.Size = new System.Drawing.Size(34, 20); - this.NUD_IV3.TabIndex = 474; - this.NUD_IV3.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_IV4 - // - this.NUD_IV4.Location = new System.Drawing.Point(220, 175); - this.NUD_IV4.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_IV4.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_IV4.Name = "NUD_IV4"; - this.NUD_IV4.Size = new System.Drawing.Size(34, 20); - this.NUD_IV4.TabIndex = 475; - this.NUD_IV4.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // - // NUD_IV5 - // - this.NUD_IV5.Location = new System.Drawing.Point(220, 198); - this.NUD_IV5.Maximum = new decimal(new int[] { - 31, - 0, - 0, - 0}); - this.NUD_IV5.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_IV5.Name = "NUD_IV5"; - this.NUD_IV5.Size = new System.Drawing.Size(34, 20); - this.NUD_IV5.TabIndex = 476; - this.NUD_IV5.Value = new decimal(new int[] { - 31, - 0, - 0, - 0}); - // // L_Species // - this.L_Species.Location = new System.Drawing.Point(6, 2); + this.L_Species.Location = new System.Drawing.Point(9, 6); this.L_Species.Name = "L_Species"; - this.L_Species.Size = new System.Drawing.Size(94, 21); + this.L_Species.Size = new System.Drawing.Size(55, 23); this.L_Species.TabIndex = 477; this.L_Species.Text = "Species:"; this.L_Species.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_HeldItem // - this.L_HeldItem.Location = new System.Drawing.Point(6, 27); + this.L_HeldItem.Location = new System.Drawing.Point(9, 117); this.L_HeldItem.Name = "L_HeldItem"; - this.L_HeldItem.Size = new System.Drawing.Size(94, 21); + this.L_HeldItem.Size = new System.Drawing.Size(55, 23); this.L_HeldItem.TabIndex = 478; this.L_HeldItem.Text = "Held Item:"; this.L_HeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Level // - this.NUD_Level.Location = new System.Drawing.Point(133, 77); + this.NUD_Level.Location = new System.Drawing.Point(65, 30); this.NUD_Level.Name = "NUD_Level"; this.NUD_Level.Size = new System.Drawing.Size(41, 20); this.NUD_Level.TabIndex = 479; @@ -313,128 +182,52 @@ private void InitializeComponent() // // L_Level // - this.L_Level.Location = new System.Drawing.Point(38, 75); + this.L_Level.Location = new System.Drawing.Point(9, 27); this.L_Level.Name = "L_Level"; - this.L_Level.Size = new System.Drawing.Size(94, 21); + this.L_Level.Size = new System.Drawing.Size(55, 23); this.L_Level.TabIndex = 480; this.L_Level.Text = "Level:"; this.L_Level.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Form // - this.NUD_Form.Location = new System.Drawing.Point(220, 77); + this.NUD_Form.Location = new System.Drawing.Point(65, 52); this.NUD_Form.Name = "NUD_Form"; - this.NUD_Form.Size = new System.Drawing.Size(34, 20); + this.NUD_Form.Size = new System.Drawing.Size(41, 20); this.NUD_Form.TabIndex = 481; // // L_Form // - this.L_Form.Location = new System.Drawing.Point(126, 75); + this.L_Form.Location = new System.Drawing.Point(9, 49); this.L_Form.Name = "L_Form"; - this.L_Form.Size = new System.Drawing.Size(94, 21); + this.L_Form.Size = new System.Drawing.Size(55, 23); this.L_Form.TabIndex = 482; this.L_Form.Text = "Form:"; this.L_Form.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // L_HP - // - this.L_HP.Location = new System.Drawing.Point(45, 150); - this.L_HP.Name = "L_HP"; - this.L_HP.Size = new System.Drawing.Size(94, 21); - this.L_HP.TabIndex = 483; - this.L_HP.Text = "HP:"; - this.L_HP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_ATK - // - this.L_ATK.Location = new System.Drawing.Point(45, 173); - this.L_ATK.Name = "L_ATK"; - this.L_ATK.Size = new System.Drawing.Size(94, 21); - this.L_ATK.TabIndex = 484; - this.L_ATK.Text = "Atk:"; - this.L_ATK.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_DEF - // - this.L_DEF.Location = new System.Drawing.Point(45, 196); - this.L_DEF.Name = "L_DEF"; - this.L_DEF.Size = new System.Drawing.Size(94, 21); - this.L_DEF.TabIndex = 485; - this.L_DEF.Text = "Def:"; - this.L_DEF.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_SPA - // - this.L_SPA.Location = new System.Drawing.Point(126, 150); - this.L_SPA.Name = "L_SPA"; - this.L_SPA.Size = new System.Drawing.Size(94, 21); - this.L_SPA.TabIndex = 486; - this.L_SPA.Text = "SpA:"; - this.L_SPA.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_SPE - // - this.L_SPE.Location = new System.Drawing.Point(126, 196); - this.L_SPE.Name = "L_SPE"; - this.L_SPE.Size = new System.Drawing.Size(94, 21); - this.L_SPE.TabIndex = 487; - this.L_SPE.Text = "Spe:"; - this.L_SPE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_SPD - // - this.L_SPD.Location = new System.Drawing.Point(126, 173); - this.L_SPD.Name = "L_SPD"; - this.L_SPD.Size = new System.Drawing.Size(94, 21); - this.L_SPD.TabIndex = 488; - this.L_SPD.Text = "SpD:"; - this.L_SPD.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // L_Nature // - this.L_Nature.Location = new System.Drawing.Point(37, 97); + this.L_Nature.Location = new System.Drawing.Point(9, 140); this.L_Nature.Name = "L_Nature"; - this.L_Nature.Size = new System.Drawing.Size(94, 21); + this.L_Nature.Size = new System.Drawing.Size(55, 23); this.L_Nature.TabIndex = 490; this.L_Nature.Text = "Nature:"; this.L_Nature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // NUD_Nature - // - this.NUD_Nature.Location = new System.Drawing.Point(133, 99); - this.NUD_Nature.Maximum = new decimal(new int[] { - 24, - 0, - 0, - 0}); - this.NUD_Nature.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_Nature.Name = "NUD_Nature"; - this.NUD_Nature.Size = new System.Drawing.Size(34, 20); - this.NUD_Nature.TabIndex = 491; - this.NUD_Nature.Value = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - // // L_Ability // - this.L_Ability.Location = new System.Drawing.Point(126, 97); + this.L_Ability.Location = new System.Drawing.Point(9, 71); this.L_Ability.Name = "L_Ability"; - this.L_Ability.Size = new System.Drawing.Size(94, 21); + this.L_Ability.Size = new System.Drawing.Size(55, 23); this.L_Ability.TabIndex = 493; this.L_Ability.Text = "Ability:"; this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Ability // - this.NUD_Ability.Location = new System.Drawing.Point(220, 99); + this.NUD_Ability.Location = new System.Drawing.Point(65, 74); this.NUD_Ability.Maximum = new decimal(new int[] { - 2, + 3, 0, 0, 0}); @@ -444,34 +237,34 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_Ability.Name = "NUD_Ability"; - this.NUD_Ability.Size = new System.Drawing.Size(34, 20); + this.NUD_Ability.Size = new System.Drawing.Size(41, 20); this.NUD_Ability.TabIndex = 492; // // L_Gender // - this.L_Gender.Location = new System.Drawing.Point(126, 120); + this.L_Gender.Location = new System.Drawing.Point(9, 96); this.L_Gender.Name = "L_Gender"; - this.L_Gender.Size = new System.Drawing.Size(94, 21); + this.L_Gender.Size = new System.Drawing.Size(55, 23); this.L_Gender.TabIndex = 495; this.L_Gender.Text = "Gender:"; this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Gender // - this.NUD_Gender.Location = new System.Drawing.Point(220, 122); + this.NUD_Gender.Location = new System.Drawing.Point(65, 96); this.NUD_Gender.Maximum = new decimal(new int[] { 2, 0, 0, 0}); this.NUD_Gender.Name = "NUD_Gender"; - this.NUD_Gender.Size = new System.Drawing.Size(34, 20); + this.NUD_Gender.Size = new System.Drawing.Size(41, 20); this.NUD_Gender.TabIndex = 494; // // B_RandAll // this.B_RandAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_RandAll.Location = new System.Drawing.Point(181, 269); + this.B_RandAll.Location = new System.Drawing.Point(181, 338); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(83, 23); this.B_RandAll.TabIndex = 496; @@ -486,30 +279,20 @@ private void InitializeComponent() this.tabControl1.Location = new System.Drawing.Point(128, 12); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(280, 251); + this.tabControl1.Size = new System.Drawing.Size(277, 322); this.tabControl1.TabIndex = 502; // // tabPage1 // + this.tabPage1.Controls.Add(this.CB_Nature); + this.tabPage1.Controls.Add(this.GB_EIVs); this.tabPage1.Controls.Add(this.CHK_ShinyLock); - this.tabPage1.Controls.Add(this.label1); - this.tabPage1.Controls.Add(this.L_DEF); - this.tabPage1.Controls.Add(this.L_ATK); - this.tabPage1.Controls.Add(this.L_Hint); - this.tabPage1.Controls.Add(this.L_HP); - this.tabPage1.Controls.Add(this.NUD_IV0); - this.tabPage1.Controls.Add(this.NUD_IV1); - this.tabPage1.Controls.Add(this.NUD_IV2); this.tabPage1.Controls.Add(this.L_Gender); this.tabPage1.Controls.Add(this.CB_Species); this.tabPage1.Controls.Add(this.NUD_Gender); this.tabPage1.Controls.Add(this.NUD_Ability); - this.tabPage1.Controls.Add(this.NUD_Nature); this.tabPage1.Controls.Add(this.L_Ability); - this.tabPage1.Controls.Add(this.L_SPA); this.tabPage1.Controls.Add(this.L_Nature); - this.tabPage1.Controls.Add(this.L_SPE); - this.tabPage1.Controls.Add(this.L_SPD); this.tabPage1.Controls.Add(this.L_Species); this.tabPage1.Controls.Add(this.L_HeldItem); this.tabPage1.Controls.Add(this.NUD_Level); @@ -517,13 +300,10 @@ private void InitializeComponent() this.tabPage1.Controls.Add(this.L_Form); this.tabPage1.Controls.Add(this.CB_HeldItem); this.tabPage1.Controls.Add(this.NUD_Form); - this.tabPage1.Controls.Add(this.NUD_IV5); - this.tabPage1.Controls.Add(this.NUD_IV4); - this.tabPage1.Controls.Add(this.NUD_IV3); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(272, 225); + this.tabPage1.Size = new System.Drawing.Size(269, 296); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Editor"; this.tabPage1.UseVisualStyleBackColor = true; @@ -531,70 +311,304 @@ private void InitializeComponent() // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(106, 54); + this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 165); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); this.CHK_ShinyLock.TabIndex = 503; this.CHK_ShinyLock.Text = "Shiny Lock"; this.CHK_ShinyLock.UseVisualStyleBackColor = true; // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 155); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 65); - this.label1.TabIndex = 502; - this.label1.Text = "Ability:\r\n0: Random\r\n1: Ability 1\r\n2: Ability 2\r\n3: Hidden Ability"; - // - // L_Hint - // - this.L_Hint.AutoSize = true; - this.L_Hint.Location = new System.Drawing.Point(7, 99); - this.L_Hint.Name = "L_Hint"; - this.L_Hint.Size = new System.Drawing.Size(67, 52); - this.L_Hint.TabIndex = 500; - this.L_Hint.Text = "Gender:\r\n0: Random/-\r\n1: Male\r\n2: Female"; - // // tabPage2 // - this.tabPage2.Controls.Add(this.L_Mega); - this.tabPage2.Controls.Add(this.CHK_Mega); + this.tabPage2.Controls.Add(this.B_ModifyLevel); this.tabPage2.Controls.Add(this.GB_Tweak); + this.tabPage2.Controls.Add(this.L_Mega); + this.tabPage2.Controls.Add(this.CHK_ReplaceMega); this.tabPage2.Controls.Add(this.NUD_LevelBoost); this.tabPage2.Controls.Add(this.CHK_Level); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(272, 225); + this.tabPage2.Size = new System.Drawing.Size(269, 296); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Randomizer Options"; this.tabPage2.UseVisualStyleBackColor = true; // // L_Mega // - this.L_Mega.Location = new System.Drawing.Point(26, 190); + this.L_Mega.Location = new System.Drawing.Point(24, 261); this.L_Mega.Name = "L_Mega"; this.L_Mega.Size = new System.Drawing.Size(113, 33); this.L_Mega.TabIndex = 512; this.L_Mega.Text = "XY - Lucario\nORAS - Latias/Latios"; this.L_Mega.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // CHK_Mega + // CHK_ReplaceMega + // + this.CHK_ReplaceMega.AutoSize = true; + this.CHK_ReplaceMega.Checked = true; + this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceMega.Location = new System.Drawing.Point(7, 247); + this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; + this.CHK_ReplaceMega.Size = new System.Drawing.Size(264, 17); + this.CHK_ReplaceMega.TabIndex = 511; + this.CHK_ReplaceMega.Text = "Replace Megas with Another Mega (via Held Item)"; + this.CHK_ReplaceMega.UseVisualStyleBackColor = true; + // + // NUD_LevelBoost + // + this.NUD_LevelBoost.DecimalPlaces = 2; + this.NUD_LevelBoost.Increment = new decimal(new int[] { + 5, + 0, + 0, + 131072}); + this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 6); + this.NUD_LevelBoost.Maximum = new decimal(new int[] { + 3, + 0, + 0, + 0}); + this.NUD_LevelBoost.Name = "NUD_LevelBoost"; + this.NUD_LevelBoost.Size = new System.Drawing.Size(43, 20); + this.NUD_LevelBoost.TabIndex = 303; + this.NUD_LevelBoost.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // CHK_Level + // + this.CHK_Level.AutoSize = true; + this.CHK_Level.Checked = true; + this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Level.Location = new System.Drawing.Point(9, 7); + this.CHK_Level.Name = "CHK_Level"; + this.CHK_Level.Size = new System.Drawing.Size(130, 17); + this.CHK_Level.TabIndex = 302; + this.CHK_Level.Text = "Multiply PKM Level by"; + this.CHK_Level.UseVisualStyleBackColor = true; + // + // GB_EIVs + // + this.GB_EIVs.Controls.Add(this.L_HP); + this.GB_EIVs.Controls.Add(this.NUD_IV3); + this.GB_EIVs.Controls.Add(this.NUD_IV4); + this.GB_EIVs.Controls.Add(this.NUD_IV5); + this.GB_EIVs.Controls.Add(this.L_SPD); + this.GB_EIVs.Controls.Add(this.L_SPE); + this.GB_EIVs.Controls.Add(this.L_SPA); + this.GB_EIVs.Controls.Add(this.NUD_IV2); + this.GB_EIVs.Controls.Add(this.NUD_IV1); + this.GB_EIVs.Controls.Add(this.NUD_IV0); + this.GB_EIVs.Controls.Add(this.L_ATK); + this.GB_EIVs.Controls.Add(this.L_DEF); + this.GB_EIVs.Location = new System.Drawing.Point(12, 179); + this.GB_EIVs.Name = "GB_EIVs"; + this.GB_EIVs.Size = new System.Drawing.Size(148, 112); + this.GB_EIVs.TabIndex = 504; + this.GB_EIVs.TabStop = false; + this.GB_EIVs.Text = "IVs"; + // + // L_HP + // + this.L_HP.Location = new System.Drawing.Point(4, 16); + this.L_HP.Name = "L_HP"; + this.L_HP.Size = new System.Drawing.Size(29, 21); + this.L_HP.TabIndex = 495; + this.L_HP.Text = "HP:"; + this.L_HP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_IV3 + // + this.NUD_IV3.Location = new System.Drawing.Point(104, 18); + this.NUD_IV3.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV3.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_IV3.Name = "NUD_IV3"; + this.NUD_IV3.Size = new System.Drawing.Size(34, 20); + this.NUD_IV3.TabIndex = 492; + this.NUD_IV3.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV4 + // + this.NUD_IV4.Location = new System.Drawing.Point(104, 49); + this.NUD_IV4.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV4.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_IV4.Name = "NUD_IV4"; + this.NUD_IV4.Size = new System.Drawing.Size(34, 20); + this.NUD_IV4.TabIndex = 493; + this.NUD_IV4.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV5 + // + this.NUD_IV5.Location = new System.Drawing.Point(104, 80); + this.NUD_IV5.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV5.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_IV5.Name = "NUD_IV5"; + this.NUD_IV5.Size = new System.Drawing.Size(34, 20); + this.NUD_IV5.TabIndex = 494; + this.NUD_IV5.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // L_SPD + // + this.L_SPD.Location = new System.Drawing.Point(73, 47); + this.L_SPD.Name = "L_SPD"; + this.L_SPD.Size = new System.Drawing.Size(31, 21); + this.L_SPD.TabIndex = 500; + this.L_SPD.Text = "SpD:"; + this.L_SPD.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_SPE + // + this.L_SPE.Location = new System.Drawing.Point(73, 78); + this.L_SPE.Name = "L_SPE"; + this.L_SPE.Size = new System.Drawing.Size(31, 21); + this.L_SPE.TabIndex = 499; + this.L_SPE.Text = "Spe:"; + this.L_SPE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_SPA + // + this.L_SPA.Location = new System.Drawing.Point(73, 16); + this.L_SPA.Name = "L_SPA"; + this.L_SPA.Size = new System.Drawing.Size(31, 21); + this.L_SPA.TabIndex = 498; + this.L_SPA.Text = "SpA:"; + this.L_SPA.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_IV2 + // + this.NUD_IV2.Location = new System.Drawing.Point(33, 80); + this.NUD_IV2.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV2.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_IV2.Name = "NUD_IV2"; + this.NUD_IV2.Size = new System.Drawing.Size(34, 20); + this.NUD_IV2.TabIndex = 491; + this.NUD_IV2.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV1 + // + this.NUD_IV1.Location = new System.Drawing.Point(33, 49); + this.NUD_IV1.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV1.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_IV1.Name = "NUD_IV1"; + this.NUD_IV1.Size = new System.Drawing.Size(34, 20); + this.NUD_IV1.TabIndex = 490; + this.NUD_IV1.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // NUD_IV0 + // + this.NUD_IV0.Location = new System.Drawing.Point(33, 18); + this.NUD_IV0.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.NUD_IV0.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_IV0.Name = "NUD_IV0"; + this.NUD_IV0.Size = new System.Drawing.Size(34, 20); + this.NUD_IV0.TabIndex = 489; + this.NUD_IV0.Value = new decimal(new int[] { + 31, + 0, + 0, + 0}); + // + // L_ATK + // + this.L_ATK.Location = new System.Drawing.Point(7, 47); + this.L_ATK.Name = "L_ATK"; + this.L_ATK.Size = new System.Drawing.Size(26, 21); + this.L_ATK.TabIndex = 496; + this.L_ATK.Text = "Atk:"; + this.L_ATK.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_DEF + // + this.L_DEF.Location = new System.Drawing.Point(4, 78); + this.L_DEF.Name = "L_DEF"; + this.L_DEF.Size = new System.Drawing.Size(29, 21); + this.L_DEF.TabIndex = 497; + this.L_DEF.Text = "Def:"; + this.L_DEF.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Nature // - this.CHK_Mega.AutoSize = true; - this.CHK_Mega.Checked = true; - this.CHK_Mega.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Mega.Location = new System.Drawing.Point(9, 176); - this.CHK_Mega.Name = "CHK_Mega"; - this.CHK_Mega.Size = new System.Drawing.Size(264, 17); - this.CHK_Mega.TabIndex = 511; - this.CHK_Mega.Text = "Replace Megas with Another Mega (via Held Item)"; - this.CHK_Mega.UseVisualStyleBackColor = true; + this.CB_Nature.FormattingEnabled = true; + this.CB_Nature.Location = new System.Drawing.Point(65, 141); + this.CB_Nature.Name = "CB_Nature"; + this.CB_Nature.Size = new System.Drawing.Size(121, 21); + this.CB_Nature.TabIndex = 505; // // GB_Tweak // this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); + this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); @@ -606,13 +620,33 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(7, 52); + this.GB_Tweak.Location = new System.Drawing.Point(5, 83); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 113); - this.GB_Tweak.TabIndex = 509; + this.GB_Tweak.Size = new System.Drawing.Size(258, 129); + this.GB_Tweak.TabIndex = 513; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_RemoveShinyLock + // + this.CHK_RemoveShinyLock.AutoSize = true; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); + this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.TabIndex = 297; + this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; + this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; + // + // CHK_AllowMega + // + this.CHK_AllowMega.AutoSize = true; + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 94); + this.CHK_AllowMega.Name = "CHK_AllowMega"; + this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); + this.CHK_AllowMega.TabIndex = 296; + this.CHK_AllowMega.Text = "Allow Random Mega Forms"; + this.CHK_AllowMega.UseVisualStyleBackColor = true; + // // CHK_Item // this.CHK_Item.AutoSize = true; @@ -621,7 +655,7 @@ private void InitializeComponent() this.CHK_Item.Location = new System.Drawing.Point(9, 79); this.CHK_Item.Name = "CHK_Item"; this.CHK_Item.Size = new System.Drawing.Size(119, 17); - this.CHK_Item.TabIndex = 296; + this.CHK_Item.TabIndex = 295; this.CHK_Item.Text = "Random Held Items"; this.CHK_Item.UseVisualStyleBackColor = true; // @@ -740,56 +774,21 @@ private void InitializeComponent() this.CHK_G1.Text = "Gen 1"; this.CHK_G1.UseVisualStyleBackColor = true; // - // NUD_LevelBoost - // - this.NUD_LevelBoost.DecimalPlaces = 2; - this.NUD_LevelBoost.Increment = new decimal(new int[] { - 5, - 0, - 0, - 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 6); - this.NUD_LevelBoost.Maximum = new decimal(new int[] { - 3, - 0, - 0, - 0}); - this.NUD_LevelBoost.Name = "NUD_LevelBoost"; - this.NUD_LevelBoost.Size = new System.Drawing.Size(43, 20); - this.NUD_LevelBoost.TabIndex = 303; - this.NUD_LevelBoost.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // CHK_Level - // - this.CHK_Level.AutoSize = true; - this.CHK_Level.Checked = true; - this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(9, 7); - this.CHK_Level.Name = "CHK_Level"; - this.CHK_Level.Size = new System.Drawing.Size(130, 17); - this.CHK_Level.TabIndex = 302; - this.CHK_Level.Text = "Multiply PKM Level by"; - this.CHK_Level.UseVisualStyleBackColor = true; - // - // CHK_RemoveShinyLock + // B_ModifyLevel // - this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 94); - this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; - this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); - this.CHK_RemoveShinyLock.TabIndex = 297; - this.CHK_RemoveShinyLock.Text = "Random Shiny Locks"; - this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; + this.B_ModifyLevel.Location = new System.Drawing.Point(189, 5); + this.B_ModifyLevel.Name = "B_ModifyLevel"; + this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); + this.B_ModifyLevel.TabIndex = 514; + this.B_ModifyLevel.Text = "× Current"; + this.B_ModifyLevel.UseVisualStyleBackColor = true; + this.B_ModifyLevel.Click += new System.EventHandler(this.ModifyLevels); // // GiftEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(417, 304); + this.ClientSize = new System.Drawing.Size(417, 370); this.Controls.Add(this.tabControl1); this.Controls.Add(this.B_RandAll); this.Controls.Add(this.LB_Gifts); @@ -802,15 +801,8 @@ private void InitializeComponent() this.Name = "GiftEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Gift Editor"; - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Nature)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).EndInit(); this.tabControl1.ResumeLayout(false); @@ -818,9 +810,16 @@ private void InitializeComponent() this.tabPage1.PerformLayout(); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); + this.GB_EIVs.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).EndInit(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.ResumeLayout(false); } @@ -832,26 +831,13 @@ private void InitializeComponent() private System.Windows.Forms.ListBox LB_Gifts; private System.Windows.Forms.ComboBox CB_Species; private System.Windows.Forms.ComboBox CB_HeldItem; - private System.Windows.Forms.NumericUpDown NUD_IV0; - private System.Windows.Forms.NumericUpDown NUD_IV1; - private System.Windows.Forms.NumericUpDown NUD_IV2; - private System.Windows.Forms.NumericUpDown NUD_IV3; - private System.Windows.Forms.NumericUpDown NUD_IV4; - private System.Windows.Forms.NumericUpDown NUD_IV5; private System.Windows.Forms.Label L_Species; private System.Windows.Forms.Label L_HeldItem; private System.Windows.Forms.NumericUpDown NUD_Level; private System.Windows.Forms.Label L_Level; private System.Windows.Forms.NumericUpDown NUD_Form; private System.Windows.Forms.Label L_Form; - private System.Windows.Forms.Label L_HP; - private System.Windows.Forms.Label L_ATK; - private System.Windows.Forms.Label L_DEF; - private System.Windows.Forms.Label L_SPA; - private System.Windows.Forms.Label L_SPE; - private System.Windows.Forms.Label L_SPD; private System.Windows.Forms.Label L_Nature; - private System.Windows.Forms.NumericUpDown NUD_Nature; private System.Windows.Forms.Label L_Ability; private System.Windows.Forms.NumericUpDown NUD_Ability; private System.Windows.Forms.Label L_Gender; @@ -862,9 +848,27 @@ private void InitializeComponent() private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.NumericUpDown NUD_LevelBoost; private System.Windows.Forms.CheckBox CHK_Level; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label L_Hint; + private System.Windows.Forms.CheckBox CHK_ReplaceMega; + private System.Windows.Forms.Label L_Mega; + private System.Windows.Forms.CheckBox CHK_ShinyLock; + private System.Windows.Forms.GroupBox GB_EIVs; + private System.Windows.Forms.Label L_HP; + private System.Windows.Forms.NumericUpDown NUD_IV3; + private System.Windows.Forms.NumericUpDown NUD_IV4; + private System.Windows.Forms.NumericUpDown NUD_IV5; + private System.Windows.Forms.Label L_SPD; + private System.Windows.Forms.Label L_SPE; + private System.Windows.Forms.Label L_SPA; + private System.Windows.Forms.NumericUpDown NUD_IV2; + private System.Windows.Forms.NumericUpDown NUD_IV1; + private System.Windows.Forms.NumericUpDown NUD_IV0; + private System.Windows.Forms.Label L_ATK; + private System.Windows.Forms.Label L_DEF; + private System.Windows.Forms.ComboBox CB_Nature; private System.Windows.Forms.GroupBox GB_Tweak; + private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; + private System.Windows.Forms.CheckBox CHK_AllowMega; + private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.Label L_RandOpt; private System.Windows.Forms.CheckBox CHK_BST; private System.Windows.Forms.CheckBox CHK_E; @@ -875,10 +879,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G3; private System.Windows.Forms.CheckBox CHK_G2; private System.Windows.Forms.CheckBox CHK_G1; - private System.Windows.Forms.CheckBox CHK_Mega; - private System.Windows.Forms.Label L_Mega; - private System.Windows.Forms.CheckBox CHK_Item; - private System.Windows.Forms.CheckBox CHK_ShinyLock; - private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; + private System.Windows.Forms.Button B_ModifyLevel; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 8344334537..2c57d88953 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -26,7 +26,7 @@ public GiftEditor6() MegaDictionary = megaDictionary; specieslist[0] = "---"; - abilitylist[0] = itemlist[0] = movelist[0] = "(None)"; // blank == -1 + itemlist[0] = "(None)"; // blank == -1 CB_Species.Items.Clear(); foreach (string s in specieslist) @@ -34,6 +34,8 @@ public GiftEditor6() CB_HeldItem.Items.Clear(); foreach (string s in itemlist) CB_HeldItem.Items.Add(s); + CB_Nature.Items.Add("Random"); + CB_Nature.Items.AddRange(natureslist.Take(25).ToArray()); loadData(); } @@ -54,6 +56,7 @@ public static Dictionary GetMegaDictionary(GameConfig config) private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); + private readonly string[] natureslist = Main.Config.getText(TextName.Natures); private readonly Dictionary MegaDictionary; private void B_Save_Click(object sender, EventArgs e) { @@ -132,11 +135,12 @@ private void loadEntry() { bool oldloaded = loaded; loaded = false; + CB_Species.SelectedIndex = GiftData[entry].Species; CB_HeldItem.SelectedIndex = GiftData[entry].HeldItem; NUD_Level.Value = GiftData[entry].Level; NUD_Form.Value = GiftData[entry].Form; - NUD_Nature.Value = GiftData[entry].Nature; + CB_Nature.SelectedIndex = GiftData[entry].Nature + 1; NUD_Ability.Value = GiftData[entry].Ability; NUD_Gender.Value = GiftData[entry].Gender; CHK_ShinyLock.Checked = GiftData[entry].ShinyLock; @@ -147,6 +151,10 @@ private void loadEntry() NUD_IV3.Value = GiftData[entry].IVs[3]; NUD_IV4.Value = GiftData[entry].IVs[4]; NUD_IV5.Value = GiftData[entry].IVs[5]; + + if (GiftData[entry].HeldItem < 0) + CB_HeldItem.SelectedIndex = 0; // no item = 0xFFFF, set to 0 (None) + loaded |= oldloaded; } private void saveEntry() @@ -155,7 +163,7 @@ private void saveEntry() GiftData[entry].HeldItem = CB_HeldItem.SelectedIndex; GiftData[entry].Level = (byte)NUD_Level.Value; GiftData[entry].Form = (byte)NUD_Form.Value; - GiftData[entry].Nature = (sbyte)NUD_Nature.Value; + GiftData[entry].Nature = (sbyte)(CB_Nature.SelectedIndex - 1); GiftData[entry].Ability = (sbyte)NUD_Ability.Value; GiftData[entry].Gender = (sbyte)NUD_Gender.Value; GiftData[entry].ShinyLock = CHK_ShinyLock.Checked; @@ -197,7 +205,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex))) // Mega Stone Gifts (Lucario, Latias/Latios) { - if (!CHK_Mega.Checked) + if (!CHK_ReplaceMega.Checked) continue; // skip Lucario, battle needs to Mega Evolve int[] items = GetRandomMega(out species); @@ -211,9 +219,16 @@ private void B_RandAll_Click(object sender, EventArgs e) CB_HeldItem.SelectedIndex = helditems[Util.rnd32() % helditems.Length]; } + if (CHK_AllowMega.Checked) + formrand.AllowMega = true; + CB_Species.SelectedIndex = species; NUD_Form.Value = formrand.GetRandomForme(species); NUD_Gender.Value = 0; // random + CB_Nature.SelectedIndex = 0; // random + + if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex)) && NUD_Form.Value > 0) + NUD_Form.Value = 0; // don't allow Mega Stone Gifts to be form 1 if (CHK_RemoveShinyLock.Checked) CHK_ShinyLock.Checked = false; @@ -289,5 +304,17 @@ private void changeSpecies(object sender, EventArgs e) int index = LB_Gifts.SelectedIndex; LB_Gifts.Items[index] = index.ToString("00") + " - " + CB_Species.Text; } + + private void ModifyLevels(object sender, EventArgs e) + { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Levels?", "Cannot undo.") != DialogResult.Yes) return; + + for (int i = 0; i < LB_Gifts.Items.Count; i++) + { + LB_Gifts.SelectedIndex = i; + NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + } + WinFormsUtil.Alert("Modified all Levels according to specification!"); + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index dac85c14ee..f53a3d60f8 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -31,28 +31,26 @@ private void InitializeComponent() this.B_Cancel = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.LB_Encounters = new System.Windows.Forms.ListBox(); + this.B_RandAll = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); + this.L_Gender = new System.Windows.Forms.Label(); this.CB_Species = new System.Windows.Forms.ComboBox(); + this.NUD_Gender = new System.Windows.Forms.NumericUpDown(); + this.NUD_Ability = new System.Windows.Forms.NumericUpDown(); + this.L_Ability = new System.Windows.Forms.Label(); this.L_Species = new System.Windows.Forms.Label(); + this.L_HeldItem = new System.Windows.Forms.Label(); this.NUD_Level = new System.Windows.Forms.NumericUpDown(); this.L_Level = new System.Windows.Forms.Label(); - this.NUD_Form = new System.Windows.Forms.NumericUpDown(); this.L_Form = new System.Windows.Forms.Label(); - this.B_RandAll = new System.Windows.Forms.Button(); - this.L_HeldItem = new System.Windows.Forms.Label(); this.CB_HeldItem = new System.Windows.Forms.ComboBox(); - this.NUD_Ability = new System.Windows.Forms.NumericUpDown(); - this.L_Ability = new System.Windows.Forms.Label(); - this.NUD_Gender = new System.Windows.Forms.NumericUpDown(); - this.L_Gender = new System.Windows.Forms.Label(); - this.CHK_3IV = new System.Windows.Forms.CheckBox(); - this.CHK_NoShiny = new System.Windows.Forms.CheckBox(); - this.CHK_3IV_2 = new System.Windows.Forms.CheckBox(); - this.L_Hint = new System.Windows.Forms.Label(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.label1 = new System.Windows.Forms.Label(); + this.NUD_Form = new System.Windows.Forms.NumericUpDown(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.B_ModifyLevel = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); @@ -67,13 +65,13 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).BeginInit(); + this.CHK_IV3 = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); this.tabPage2.SuspendLayout(); this.GB_Tweak.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); @@ -82,7 +80,7 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(261, 296); + this.B_Cancel.Location = new System.Drawing.Point(264, 338); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(70, 23); this.B_Cancel.TabIndex = 467; @@ -93,7 +91,7 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(332, 296); + this.B_Save.Location = new System.Drawing.Point(335, 338); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(70, 23); this.B_Save.TabIndex = 466; @@ -108,69 +106,14 @@ private void InitializeComponent() this.LB_Encounters.FormattingEnabled = true; this.LB_Encounters.Location = new System.Drawing.Point(12, 12); this.LB_Encounters.Name = "LB_Encounters"; - this.LB_Encounters.Size = new System.Drawing.Size(110, 303); + this.LB_Encounters.Size = new System.Drawing.Size(110, 342); this.LB_Encounters.TabIndex = 468; this.LB_Encounters.SelectedIndexChanged += new System.EventHandler(this.changeIndex); // - // CB_Species - // - this.CB_Species.FormattingEnabled = true; - this.CB_Species.Location = new System.Drawing.Point(106, 3); - this.CB_Species.Name = "CB_Species"; - this.CB_Species.Size = new System.Drawing.Size(121, 21); - this.CB_Species.TabIndex = 469; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); - // - // L_Species - // - this.L_Species.Location = new System.Drawing.Point(6, 3); - this.L_Species.Name = "L_Species"; - this.L_Species.Size = new System.Drawing.Size(94, 21); - this.L_Species.TabIndex = 477; - this.L_Species.Text = "Species:"; - this.L_Species.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_Level - // - this.NUD_Level.Location = new System.Drawing.Point(106, 57); - this.NUD_Level.Name = "NUD_Level"; - this.NUD_Level.Size = new System.Drawing.Size(41, 20); - this.NUD_Level.TabIndex = 479; - this.NUD_Level.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); - // - // L_Level - // - this.L_Level.Location = new System.Drawing.Point(9, 55); - this.L_Level.Name = "L_Level"; - this.L_Level.Size = new System.Drawing.Size(92, 21); - this.L_Level.TabIndex = 480; - this.L_Level.Text = "Level:"; - this.L_Level.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_Form - // - this.NUD_Form.Location = new System.Drawing.Point(193, 57); - this.NUD_Form.Name = "NUD_Form"; - this.NUD_Form.Size = new System.Drawing.Size(34, 20); - this.NUD_Form.TabIndex = 481; - // - // L_Form - // - this.L_Form.Location = new System.Drawing.Point(99, 55); - this.L_Form.Name = "L_Form"; - this.L_Form.Size = new System.Drawing.Size(94, 21); - this.L_Form.TabIndex = 482; - this.L_Form.Text = "Form:"; - this.L_Form.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // B_RandAll // this.B_RandAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_RandAll.Location = new System.Drawing.Point(178, 296); + this.B_RandAll.Location = new System.Drawing.Point(181, 338); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(83, 23); this.B_RandAll.TabIndex = 496; @@ -178,163 +121,192 @@ private void InitializeComponent() this.B_RandAll.UseVisualStyleBackColor = true; this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click); // - // L_HeldItem + // tabControl1 // - this.L_HeldItem.Location = new System.Drawing.Point(6, 29); - this.L_HeldItem.Name = "L_HeldItem"; - this.L_HeldItem.Size = new System.Drawing.Size(94, 21); - this.L_HeldItem.TabIndex = 478; - this.L_HeldItem.Text = "Held Item:"; - this.L_HeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(128, 12); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(277, 322); + this.tabControl1.TabIndex = 501; // - // CB_HeldItem + // tabPage1 // - this.CB_HeldItem.FormattingEnabled = true; - this.CB_HeldItem.Location = new System.Drawing.Point(106, 30); - this.CB_HeldItem.Name = "CB_HeldItem"; - this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); - this.CB_HeldItem.TabIndex = 470; + this.tabPage1.Controls.Add(this.CHK_IV3); + this.tabPage1.Controls.Add(this.CHK_ShinyLock); + this.tabPage1.Controls.Add(this.L_Gender); + this.tabPage1.Controls.Add(this.CB_Species); + this.tabPage1.Controls.Add(this.NUD_Gender); + this.tabPage1.Controls.Add(this.NUD_Ability); + this.tabPage1.Controls.Add(this.L_Ability); + this.tabPage1.Controls.Add(this.L_Species); + this.tabPage1.Controls.Add(this.L_HeldItem); + this.tabPage1.Controls.Add(this.NUD_Level); + this.tabPage1.Controls.Add(this.L_Level); + this.tabPage1.Controls.Add(this.L_Form); + this.tabPage1.Controls.Add(this.CB_HeldItem); + this.tabPage1.Controls.Add(this.NUD_Form); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(269, 296); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Editor"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // CHK_ShinyLock + // + this.CHK_ShinyLock.AutoSize = true; + this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 141); + this.CHK_ShinyLock.Name = "CHK_ShinyLock"; + this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); + this.CHK_ShinyLock.TabIndex = 519; + this.CHK_ShinyLock.Text = "Shiny Lock"; + this.CHK_ShinyLock.UseVisualStyleBackColor = true; + // + // L_Gender + // + this.L_Gender.Location = new System.Drawing.Point(9, 96); + this.L_Gender.Name = "L_Gender"; + this.L_Gender.Size = new System.Drawing.Size(55, 23); + this.L_Gender.TabIndex = 518; + this.L_Gender.Text = "Gender:"; + this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Species + // + this.CB_Species.FormattingEnabled = true; + this.CB_Species.Location = new System.Drawing.Point(65, 7); + this.CB_Species.Name = "CB_Species"; + this.CB_Species.Size = new System.Drawing.Size(121, 21); + this.CB_Species.TabIndex = 506; + // + // NUD_Gender + // + this.NUD_Gender.Location = new System.Drawing.Point(65, 96); + this.NUD_Gender.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.NUD_Gender.Name = "NUD_Gender"; + this.NUD_Gender.Size = new System.Drawing.Size(41, 20); + this.NUD_Gender.TabIndex = 517; // // NUD_Ability // - this.NUD_Ability.Location = new System.Drawing.Point(194, 82); + this.NUD_Ability.Location = new System.Drawing.Point(65, 74); this.NUD_Ability.Maximum = new decimal(new int[] { 3, 0, 0, 0}); + this.NUD_Ability.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); this.NUD_Ability.Name = "NUD_Ability"; - this.NUD_Ability.Size = new System.Drawing.Size(34, 20); - this.NUD_Ability.TabIndex = 492; + this.NUD_Ability.Size = new System.Drawing.Size(41, 20); + this.NUD_Ability.TabIndex = 515; // // L_Ability // - this.L_Ability.Location = new System.Drawing.Point(100, 80); + this.L_Ability.Location = new System.Drawing.Point(9, 71); this.L_Ability.Name = "L_Ability"; - this.L_Ability.Size = new System.Drawing.Size(94, 21); - this.L_Ability.TabIndex = 493; + this.L_Ability.Size = new System.Drawing.Size(55, 23); + this.L_Ability.TabIndex = 516; this.L_Ability.Text = "Ability:"; this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // NUD_Gender + // L_Species // - this.NUD_Gender.Location = new System.Drawing.Point(194, 108); - this.NUD_Gender.Maximum = new decimal(new int[] { - 2, + this.L_Species.Location = new System.Drawing.Point(9, 6); + this.L_Species.Name = "L_Species"; + this.L_Species.Size = new System.Drawing.Size(55, 23); + this.L_Species.TabIndex = 508; + this.L_Species.Text = "Species:"; + this.L_Species.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_HeldItem + // + this.L_HeldItem.Location = new System.Drawing.Point(9, 117); + this.L_HeldItem.Name = "L_HeldItem"; + this.L_HeldItem.Size = new System.Drawing.Size(55, 23); + this.L_HeldItem.TabIndex = 509; + this.L_HeldItem.Text = "Held Item:"; + this.L_HeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_Level + // + this.NUD_Level.Location = new System.Drawing.Point(65, 30); + this.NUD_Level.Name = "NUD_Level"; + this.NUD_Level.Size = new System.Drawing.Size(41, 20); + this.NUD_Level.TabIndex = 510; + this.NUD_Level.Value = new decimal(new int[] { + 100, 0, 0, 0}); - this.NUD_Gender.Name = "NUD_Gender"; - this.NUD_Gender.Size = new System.Drawing.Size(34, 20); - this.NUD_Gender.TabIndex = 494; - // - // L_Gender // - this.L_Gender.Location = new System.Drawing.Point(100, 106); - this.L_Gender.Name = "L_Gender"; - this.L_Gender.Size = new System.Drawing.Size(94, 21); - this.L_Gender.TabIndex = 495; - this.L_Gender.Text = "Gender:"; - this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // L_Level // - // CHK_3IV - // - this.CHK_3IV.AutoSize = true; - this.CHK_3IV.Location = new System.Drawing.Point(9, 106); - this.CHK_3IV.Name = "CHK_3IV"; - this.CHK_3IV.Size = new System.Drawing.Size(42, 17); - this.CHK_3IV.TabIndex = 497; - this.CHK_3IV.Text = "3IV"; - this.CHK_3IV.UseVisualStyleBackColor = true; - // - // CHK_NoShiny - // - this.CHK_NoShiny.AutoSize = true; - this.CHK_NoShiny.Location = new System.Drawing.Point(9, 83); - this.CHK_NoShiny.Name = "CHK_NoShiny"; - this.CHK_NoShiny.Size = new System.Drawing.Size(79, 17); - this.CHK_NoShiny.TabIndex = 498; - this.CHK_NoShiny.Text = "Shiny Lock"; - this.CHK_NoShiny.UseVisualStyleBackColor = true; - // - // CHK_3IV_2 - // - this.CHK_3IV_2.AutoSize = true; - this.CHK_3IV_2.Location = new System.Drawing.Point(9, 129); - this.CHK_3IV_2.Name = "CHK_3IV_2"; - this.CHK_3IV_2.Size = new System.Drawing.Size(54, 17); - this.CHK_3IV_2.TabIndex = 499; - this.CHK_3IV_2.Text = "3IV_2"; - this.CHK_3IV_2.UseVisualStyleBackColor = true; - // - // L_Hint - // - this.L_Hint.AutoSize = true; - this.L_Hint.Location = new System.Drawing.Point(161, 148); - this.L_Hint.Name = "L_Hint"; - this.L_Hint.Size = new System.Drawing.Size(67, 52); - this.L_Hint.TabIndex = 500; - this.L_Hint.Text = "Gender:\r\n0: Random/-\r\n1: Male\r\n2: Female"; + this.L_Level.Location = new System.Drawing.Point(9, 27); + this.L_Level.Name = "L_Level"; + this.L_Level.Size = new System.Drawing.Size(55, 23); + this.L_Level.TabIndex = 511; + this.L_Level.Text = "Level:"; + this.L_Level.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // tabControl1 + // L_Form // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(128, 12); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(280, 260); - this.tabControl1.TabIndex = 501; + this.L_Form.Location = new System.Drawing.Point(9, 49); + this.L_Form.Name = "L_Form"; + this.L_Form.Size = new System.Drawing.Size(55, 23); + this.L_Form.TabIndex = 513; + this.L_Form.Text = "Form:"; + this.L_Form.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // tabPage1 + // CB_HeldItem // - this.tabPage1.Controls.Add(this.label1); - this.tabPage1.Controls.Add(this.L_Hint); - this.tabPage1.Controls.Add(this.CB_Species); - this.tabPage1.Controls.Add(this.NUD_Ability); - this.tabPage1.Controls.Add(this.CHK_3IV_2); - this.tabPage1.Controls.Add(this.CHK_NoShiny); - this.tabPage1.Controls.Add(this.L_Species); - this.tabPage1.Controls.Add(this.CHK_3IV); - this.tabPage1.Controls.Add(this.L_HeldItem); - this.tabPage1.Controls.Add(this.L_Level); - this.tabPage1.Controls.Add(this.L_Gender); - this.tabPage1.Controls.Add(this.CB_HeldItem); - this.tabPage1.Controls.Add(this.NUD_Gender); - this.tabPage1.Controls.Add(this.NUD_Form); - this.tabPage1.Controls.Add(this.NUD_Level); - this.tabPage1.Controls.Add(this.L_Ability); - this.tabPage1.Controls.Add(this.L_Form); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(272, 234); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Editor"; - this.tabPage1.UseVisualStyleBackColor = true; + this.CB_HeldItem.FormattingEnabled = true; + this.CB_HeldItem.Location = new System.Drawing.Point(65, 118); + this.CB_HeldItem.Name = "CB_HeldItem"; + this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); + this.CB_HeldItem.TabIndex = 507; // - // label1 + // NUD_Form // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(90, 148); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(59, 65); - this.label1.TabIndex = 502; - this.label1.Text = "Ability:\r\n0: Random\r\n1: Ability 0\r\n2: Ability 1\r\n3: Hidden"; + this.NUD_Form.Location = new System.Drawing.Point(65, 52); + this.NUD_Form.Name = "NUD_Form"; + this.NUD_Form.Size = new System.Drawing.Size(41, 20); + this.NUD_Form.TabIndex = 512; // // tabPage2 // + this.tabPage2.Controls.Add(this.B_ModifyLevel); this.tabPage2.Controls.Add(this.GB_Tweak); this.tabPage2.Controls.Add(this.NUD_LevelBoost); this.tabPage2.Controls.Add(this.CHK_Level); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(272, 234); + this.tabPage2.Size = new System.Drawing.Size(269, 296); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Randomizer Options"; this.tabPage2.UseVisualStyleBackColor = true; // + // B_ModifyLevel + // + this.B_ModifyLevel.Location = new System.Drawing.Point(189, 5); + this.B_ModifyLevel.Name = "B_ModifyLevel"; + this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); + this.B_ModifyLevel.TabIndex = 502; + this.B_ModifyLevel.Text = "× Current"; + this.B_ModifyLevel.UseVisualStyleBackColor = true; + this.B_ModifyLevel.Click += new System.EventHandler(this.ModifyLevels); + // // GB_Tweak // this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); @@ -350,13 +322,23 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(7, 58); + this.GB_Tweak.Location = new System.Drawing.Point(5, 83); this.GB_Tweak.Name = "GB_Tweak"; this.GB_Tweak.Size = new System.Drawing.Size(258, 129); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_RemoveShinyLock + // + this.CHK_RemoveShinyLock.AutoSize = true; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); + this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.TabIndex = 297; + this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; + this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; + // // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; @@ -522,28 +504,28 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(8, 7); + this.CHK_Level.Location = new System.Drawing.Point(9, 7); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 302; this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // CHK_RemoveShinyLock + // CHK_IV3 // - this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); - this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; - this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); - this.CHK_RemoveShinyLock.TabIndex = 297; - this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; - this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; + this.CHK_IV3.AutoSize = true; + this.CHK_IV3.Location = new System.Drawing.Point(65, 156); + this.CHK_IV3.Name = "CHK_IV3"; + this.CHK_IV3.Size = new System.Drawing.Size(42, 17); + this.CHK_IV3.TabIndex = 522; + this.CHK_IV3.Text = "3IV"; + this.CHK_IV3.UseVisualStyleBackColor = true; // // StaticEncounterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(414, 331); + this.ClientSize = new System.Drawing.Size(417, 370); this.Controls.Add(this.tabControl1); this.Controls.Add(this.B_RandAll); this.Controls.Add(this.LB_Encounters); @@ -556,13 +538,13 @@ private void InitializeComponent() this.Name = "StaticEncounterEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Static Encounter Editor"; - ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).EndInit(); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).EndInit(); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); this.GB_Tweak.ResumeLayout(false); @@ -577,27 +559,10 @@ private void InitializeComponent() private System.Windows.Forms.Button B_Cancel; private System.Windows.Forms.Button B_Save; private System.Windows.Forms.ListBox LB_Encounters; - private System.Windows.Forms.ComboBox CB_Species; - private System.Windows.Forms.Label L_Species; - private System.Windows.Forms.NumericUpDown NUD_Level; - private System.Windows.Forms.Label L_Level; - private System.Windows.Forms.NumericUpDown NUD_Form; - private System.Windows.Forms.Label L_Form; private System.Windows.Forms.Button B_RandAll; - private System.Windows.Forms.Label L_Gender; - private System.Windows.Forms.NumericUpDown NUD_Gender; - private System.Windows.Forms.Label L_Ability; - private System.Windows.Forms.NumericUpDown NUD_Ability; - private System.Windows.Forms.ComboBox CB_HeldItem; - private System.Windows.Forms.Label L_HeldItem; - private System.Windows.Forms.CheckBox CHK_3IV; - private System.Windows.Forms.CheckBox CHK_NoShiny; - private System.Windows.Forms.CheckBox CHK_3IV_2; - private System.Windows.Forms.Label L_Hint; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Label label1; private System.Windows.Forms.NumericUpDown NUD_LevelBoost; private System.Windows.Forms.CheckBox CHK_Level; private System.Windows.Forms.GroupBox GB_Tweak; @@ -614,5 +579,20 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.CheckBox CHK_AllowMega; private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; + private System.Windows.Forms.CheckBox CHK_ShinyLock; + private System.Windows.Forms.Label L_Gender; + private System.Windows.Forms.ComboBox CB_Species; + private System.Windows.Forms.NumericUpDown NUD_Gender; + private System.Windows.Forms.NumericUpDown NUD_Ability; + private System.Windows.Forms.Label L_Ability; + private System.Windows.Forms.Label L_Species; + private System.Windows.Forms.Label L_HeldItem; + private System.Windows.Forms.NumericUpDown NUD_Level; + private System.Windows.Forms.Label L_Level; + private System.Windows.Forms.Label L_Form; + private System.Windows.Forms.ComboBox CB_HeldItem; + private System.Windows.Forms.NumericUpDown NUD_Form; + private System.Windows.Forms.Button B_ModifyLevel; + private System.Windows.Forms.CheckBox CHK_IV3; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 27506aa941..3fdde0b766 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -92,16 +92,19 @@ private void loadEntry() { bool oldloaded = loaded; loaded = false; + CB_Species.SelectedIndex = EncounterData[entry].Species; CB_HeldItem.SelectedIndex = EncounterData[entry].HeldItem; NUD_Level.Value = EncounterData[entry].Level; NUD_Form.Value = EncounterData[entry].Form; NUD_Ability.Value = EncounterData[entry].Ability; NUD_Gender.Value = EncounterData[entry].Gender; + CHK_ShinyLock.Checked = EncounterData[entry].ShinyLock; + CHK_IV3.Checked = EncounterData[entry].IV3; + + if (EncounterData[entry].HeldItem < 0) + CB_HeldItem.SelectedIndex = 0; // no item = 0xFFFF, set to 0 (None) - CHK_NoShiny.Checked = EncounterData[entry].ShinyLock; - CHK_3IV.Checked = EncounterData[entry].IV3; - CHK_3IV_2.Checked = EncounterData[entry].IV3_1; loaded |= oldloaded; } private void saveEntry() @@ -112,10 +115,8 @@ private void saveEntry() EncounterData[entry].Form = (byte)NUD_Form.Value; EncounterData[entry].Ability = (sbyte)NUD_Ability.Value; EncounterData[entry].Gender = (sbyte)NUD_Gender.Value; - - EncounterData[entry].ShinyLock = CHK_NoShiny.Checked; - EncounterData[entry].IV3 = CHK_3IV.Checked; - EncounterData[entry].IV3_1 = CHK_3IV_2.Checked; + EncounterData[entry].ShinyLock = CHK_ShinyLock.Checked; + EncounterData[entry].IV3 = CHK_IV3.Checked; } private void B_RandAll_Click(object sender, EventArgs e) @@ -160,7 +161,7 @@ private void B_RandAll_Click(object sender, EventArgs e) NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); if (CHK_RemoveShinyLock.Checked) - CHK_NoShiny.Checked = false; + CHK_ShinyLock.Checked = false; } WinFormsUtil.Alert("Randomized all Static Encounters according to specification!"); } @@ -170,5 +171,17 @@ private void changeSpecies(object sender, EventArgs e) int index = LB_Encounters.SelectedIndex; LB_Encounters.Items[index] = index.ToString("00") + " - " + CB_Species.Text; } + + private void ModifyLevels(object sender, EventArgs e) + { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Levels?", "Cannot undo.") != DialogResult.Yes) return; + + for (int i = 0; i < LB_Encounters.Items.Count; i++) + { + LB_Encounters.SelectedIndex = i; + NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + } + WinFormsUtil.Alert("Modified all Levels according to specification!"); + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 94c8fc5ce1..647d543a4d 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -472,7 +472,6 @@ private void B_RandAll_Click(object sender, EventArgs e) var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); - var aurarand = aura; for (int i = 3; i < Gifts.Length; i++) // Skip Starters { From 67f67ac6e97cb54a379e3722a35eb5e5edfe3f72 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Tue, 19 Dec 2017 22:09:13 -0500 Subject: [PATCH 024/191] Add static7 level boost button --- .../Gen7/StaticEncounterEditor7.Designer.cs | 83 +++++++++---------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 41 ++++++++- 2 files changed, 76 insertions(+), 48 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 28c3737ba4..06734a2af5 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -30,6 +30,8 @@ private void InitializeComponent() { this.TC_Tabs = new System.Windows.Forms.TabControl(); this.Tab_Gifts = new System.Windows.Forms.TabPage(); + this.CB_GNature = new System.Windows.Forms.ComboBox(); + this.L_GNature = new System.Windows.Forms.Label(); this.CHK_IsEgg = new System.Windows.Forms.CheckBox(); this.CHK_GIV3 = new System.Windows.Forms.CheckBox(); this.CB_SpecialMove = new System.Windows.Forms.ComboBox(); @@ -124,6 +126,7 @@ private void InitializeComponent() this.NUD_TLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Trade = new System.Windows.Forms.ListBox(); this.Tab_Randomizer = new System.Windows.Forms.TabPage(); + this.B_ModifyLevel = new System.Windows.Forms.Button(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); @@ -145,8 +148,6 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CB_GNature = new System.Windows.Forms.ComboBox(); - this.L_GNature = new System.Windows.Forms.Label(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); @@ -228,6 +229,23 @@ private void InitializeComponent() this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; // + // CB_GNature + // + this.CB_GNature.FormattingEnabled = true; + this.CB_GNature.Location = new System.Drawing.Point(187, 119); + this.CB_GNature.Name = "CB_GNature"; + this.CB_GNature.Size = new System.Drawing.Size(121, 21); + this.CB_GNature.TabIndex = 511; + // + // L_GNature + // + this.L_GNature.Location = new System.Drawing.Point(131, 117); + this.L_GNature.Name = "L_GNature"; + this.L_GNature.Size = new System.Drawing.Size(55, 23); + this.L_GNature.TabIndex = 510; + this.L_GNature.Text = "Nature:"; + this.L_GNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // CHK_IsEgg // this.CHK_IsEgg.AutoSize = true; @@ -285,11 +303,6 @@ private void InitializeComponent() this.NUD_GGender.Name = "NUD_GGender"; this.NUD_GGender.Size = new System.Drawing.Size(34, 20); this.NUD_GGender.TabIndex = 20; - this.NUD_GGender.Value = new decimal(new int[] { - 2, - 0, - 0, - 0}); // // CHK_G_Lock // @@ -374,11 +387,6 @@ private void InitializeComponent() // NUD_GLevel // this.NUD_GLevel.Location = new System.Drawing.Point(187, 30); - this.NUD_GLevel.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); this.NUD_GLevel.Name = "NUD_GLevel"; this.NUD_GLevel.Size = new System.Drawing.Size(48, 20); this.NUD_GLevel.TabIndex = 1; @@ -983,11 +991,6 @@ private void InitializeComponent() // NUD_ELevel // this.NUD_ELevel.Location = new System.Drawing.Point(187, 30); - this.NUD_ELevel.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); this.NUD_ELevel.Name = "NUD_ELevel"; this.NUD_ELevel.Size = new System.Drawing.Size(48, 20); this.NUD_ELevel.TabIndex = 9; @@ -1281,9 +1284,9 @@ private void InitializeComponent() this.L_TTID.AutoSize = true; this.L_TTID.Location = new System.Drawing.Point(252, 123); this.L_TTID.Name = "L_TTID"; - this.L_TTID.Size = new System.Drawing.Size(28, 13); + this.L_TTID.Size = new System.Drawing.Size(53, 13); this.L_TTID.TabIndex = 27; - this.L_TTID.Text = "TID:"; + this.L_TTID.Text = "Gen 7 ID:"; this.L_TTID.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // L_TID @@ -1386,11 +1389,6 @@ private void InitializeComponent() // NUD_TLevel // this.NUD_TLevel.Location = new System.Drawing.Point(187, 30); - this.NUD_TLevel.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); this.NUD_TLevel.Name = "NUD_TLevel"; this.NUD_TLevel.Size = new System.Drawing.Size(48, 20); this.NUD_TLevel.TabIndex = 17; @@ -1413,6 +1411,7 @@ private void InitializeComponent() // // Tab_Randomizer // + this.Tab_Randomizer.Controls.Add(this.B_ModifyLevel); this.Tab_Randomizer.Controls.Add(this.NUD_LevelBoost); this.Tab_Randomizer.Controls.Add(this.CHK_Level); this.Tab_Randomizer.Controls.Add(this.B_RandAll); @@ -1426,6 +1425,16 @@ private void InitializeComponent() this.Tab_Randomizer.Text = "Randomizer Options"; this.Tab_Randomizer.UseVisualStyleBackColor = true; // + // B_ModifyLevel + // + this.B_ModifyLevel.Location = new System.Drawing.Point(316, 111); + this.B_ModifyLevel.Name = "B_ModifyLevel"; + this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); + this.B_ModifyLevel.TabIndex = 512; + this.B_ModifyLevel.Text = "× Current"; + this.B_ModifyLevel.UseVisualStyleBackColor = true; + this.B_ModifyLevel.Click += new System.EventHandler(this.ModifyLevels); + // // NUD_LevelBoost // this.NUD_LevelBoost.DecimalPlaces = 2; @@ -1434,7 +1443,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(301, 110); + this.NUD_LevelBoost.Location = new System.Drawing.Point(267, 112); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -1454,7 +1463,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(169, 111); + this.CHK_Level.Location = new System.Drawing.Point(135, 113); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 510; @@ -1487,9 +1496,9 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(122, 136); + this.GB_Tweak.Location = new System.Drawing.Point(129, 135); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 144); + this.GB_Tweak.Size = new System.Drawing.Size(258, 145); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -1683,23 +1692,6 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CB_GNature - // - this.CB_GNature.FormattingEnabled = true; - this.CB_GNature.Location = new System.Drawing.Point(187, 119); - this.CB_GNature.Name = "CB_GNature"; - this.CB_GNature.Size = new System.Drawing.Size(121, 21); - this.CB_GNature.TabIndex = 511; - // - // L_GNature - // - this.L_GNature.Location = new System.Drawing.Point(131, 117); - this.L_GNature.Name = "L_GNature"; - this.L_GNature.Size = new System.Drawing.Size(55, 23); - this.L_GNature.TabIndex = 510; - this.L_GNature.Text = "Nature:"; - this.L_GNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // StaticEncounterEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1877,5 +1869,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_GIV3; private System.Windows.Forms.ComboBox CB_GNature; private System.Windows.Forms.Label L_GNature; + private System.Windows.Forms.Button B_ModifyLevel; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 647d543a4d..33c7e2e330 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -448,10 +448,11 @@ private void B_Starters_Click(object sender, EventArgs e) if (CHK_Item.Checked) t.HeldItem = items[Util.rnd32() % items.Length]; + if (CHK_Level.Checked) + t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); + if (CHK_RemoveShinyLock.Checked) t.ShinyLock = false; // in case any user modifications locked the starters - - // no level boosting } getListBoxEntries(); @@ -479,6 +480,9 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); + if (CHK_AllowMega.Checked) + formrand.AllowMega = true; + if (CHK_Item.Checked) t.HeldItem = items[Util.rnd32() % items.Length]; @@ -494,6 +498,9 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Form = formrand.GetRandomForme(t.Species); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); + if (CHK_AllowMega.Checked) + formrand.AllowMega = true; + if (CHK_Item.Checked) t.HeldItem = items[Util.rnd32() % items.Length]; @@ -509,6 +516,9 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Form = formrand.GetRandomForme(t.Species); t.TradeRequestSpecies = specrand.GetRandomSpecies(t.TradeRequestSpecies); + if (CHK_AllowMega.Checked) + formrand.AllowMega = true; + if (CHK_Item.Checked) t.HeldItem = items[Util.rnd32() % items.Length]; @@ -576,5 +586,30 @@ private void ExportEncounters() var s = Encounters.Select(z => z.GetSummary() + $" // {specieslist[z.Species]} @ ???"); Clipboard.SetText(string.Join(Environment.NewLine, g.Concat(s))); } + + private void ModifyLevels(object sender, EventArgs e) + { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Levels?", "Cannot undo.") != DialogResult.Yes) return; + + // encounter + for (int i = 0; i < LB_Encounter.Items.Count; i++) + { + LB_Encounter.SelectedIndex = i; + NUD_ELevel.Value = Randomizer.getModifiedLevel((int)NUD_ELevel.Value, NUD_LevelBoost.Value); + } + // gift + for (int i = 0; i < LB_Gift.Items.Count; i++) + { + LB_Gift.SelectedIndex = i; + NUD_GLevel.Value = Randomizer.getModifiedLevel((int)NUD_GLevel.Value, NUD_LevelBoost.Value); + } + // trade + for (int i = 0; i < LB_Trade.Items.Count; i++) + { + LB_Trade.SelectedIndex = i; + NUD_TLevel.Value = Randomizer.getModifiedLevel((int)NUD_TLevel.Value, NUD_LevelBoost.Value); + } + WinFormsUtil.Alert("Modified all Levels according to specification!"); + } } -} +} \ No newline at end of file From 0c4757b0310304affc48906814e9bb78c76ea2e0 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 19 Dec 2017 20:55:35 -0800 Subject: [PATCH 025/191] Add table copy/paste(all) closes #182 --- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 2 +- pk3DS/Subforms/Gen7/SMTE.cs | 1 - pk3DS/Subforms/Gen7/SMWE.Designer.cs | 71 +++++++++++---- pk3DS/Subforms/Gen7/SMWE.cs | 95 +++++++++++++++++---- pk3DS/Subforms/Gen7/Wild/EncounterTable.cs | 16 +++- 5 files changed, 148 insertions(+), 37 deletions(-) diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 20cc884ab5..ed7769cc98 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -38,7 +38,7 @@ public void Initialize() public bool L = false; public bool E = false; public bool Shedinja = false; - public bool rEXP = true; + public bool rEXP = false; public bool rBST = true; public bool rType = false; #endregion diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 17205c27d1..03f38911fd 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -592,7 +592,6 @@ private void B_Randomize_Click(object sender, EventArgs e) E = CHK_E.Checked, L = CHK_L.Checked, rBST = CHK_BST.Checked, - rEXP = false, }; rnd.Initialize(); diff --git a/pk3DS/Subforms/Gen7/SMWE.Designer.cs b/pk3DS/Subforms/Gen7/SMWE.Designer.cs index ef83517242..777ea3f050 100644 --- a/pk3DS/Subforms/Gen7/SMWE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMWE.Designer.cs @@ -256,6 +256,9 @@ private void InitializeComponent() this.CB_TableID = new System.Windows.Forms.ComboBox(); this.B_Export = new System.Windows.Forms.Button(); this.CopySOS = new System.Windows.Forms.Button(); + this.B_Copy = new System.Windows.Forms.Button(); + this.B_Paste = new System.Windows.Forms.Button(); + this.B_PasteAll = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.NUP_Min)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUP_Max)).BeginInit(); this.GB_Encounters.SuspendLayout(); @@ -478,6 +481,9 @@ private void InitializeComponent() // // GB_Encounters // + this.GB_Encounters.Controls.Add(this.B_PasteAll); + this.GB_Encounters.Controls.Add(this.B_Paste); + this.GB_Encounters.Controls.Add(this.B_Copy); this.GB_Encounters.Controls.Add(this.GB_Tweak); this.GB_Encounters.Controls.Add(this.PB_NightIcon); this.GB_Encounters.Controls.Add(this.PB_DayIcon); @@ -701,9 +707,9 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.B_LevelPlus); this.GB_Tweak.Controls.Add(this.NUD_LevelAmp); this.GB_Tweak.Controls.Add(this.CHK_Level); - this.GB_Tweak.Location = new System.Drawing.Point(14, 388); + this.GB_Tweak.Location = new System.Drawing.Point(14, 405); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(282, 159); + this.GB_Tweak.Size = new System.Drawing.Size(282, 150); this.GB_Tweak.TabIndex = 507; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -937,7 +943,7 @@ private void InitializeComponent() // // NUP_WeatherForme6 // - this.NUP_WeatherForme6.Location = new System.Drawing.Point(216, 346); + this.NUP_WeatherForme6.Location = new System.Drawing.Point(219, 333); this.NUP_WeatherForme6.Maximum = new decimal(new int[] { 31, 0, @@ -949,7 +955,7 @@ private void InitializeComponent() // // NUP_WeatherForme3 // - this.NUP_WeatherForme3.Location = new System.Drawing.Point(108, 320); + this.NUP_WeatherForme3.Location = new System.Drawing.Point(111, 307); this.NUP_WeatherForme3.Maximum = new decimal(new int[] { 31, 0, @@ -964,14 +970,14 @@ private void InitializeComponent() this.CB_WeatherEnc6.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_WeatherEnc6.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_WeatherEnc6.FormattingEnabled = true; - this.CB_WeatherEnc6.Location = new System.Drawing.Point(141, 345); + this.CB_WeatherEnc6.Location = new System.Drawing.Point(144, 332); this.CB_WeatherEnc6.Name = "CB_WeatherEnc6"; this.CB_WeatherEnc6.Size = new System.Drawing.Size(72, 21); this.CB_WeatherEnc6.TabIndex = 502; // // NUP_WeatherForme5 // - this.NUP_WeatherForme5.Location = new System.Drawing.Point(108, 346); + this.NUP_WeatherForme5.Location = new System.Drawing.Point(111, 333); this.NUP_WeatherForme5.Maximum = new decimal(new int[] { 31, 0, @@ -986,14 +992,14 @@ private void InitializeComponent() this.CB_WeatherEnc5.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_WeatherEnc5.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_WeatherEnc5.FormattingEnabled = true; - this.CB_WeatherEnc5.Location = new System.Drawing.Point(33, 345); + this.CB_WeatherEnc5.Location = new System.Drawing.Point(36, 332); this.CB_WeatherEnc5.Name = "CB_WeatherEnc5"; this.CB_WeatherEnc5.Size = new System.Drawing.Size(72, 21); this.CB_WeatherEnc5.TabIndex = 500; // // NUP_WeatherForme4 // - this.NUP_WeatherForme4.Location = new System.Drawing.Point(217, 320); + this.NUP_WeatherForme4.Location = new System.Drawing.Point(220, 307); this.NUP_WeatherForme4.Maximum = new decimal(new int[] { 31, 0, @@ -1008,7 +1014,7 @@ private void InitializeComponent() this.CB_WeatherEnc4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_WeatherEnc4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_WeatherEnc4.FormattingEnabled = true; - this.CB_WeatherEnc4.Location = new System.Drawing.Point(142, 319); + this.CB_WeatherEnc4.Location = new System.Drawing.Point(145, 306); this.CB_WeatherEnc4.Name = "CB_WeatherEnc4"; this.CB_WeatherEnc4.Size = new System.Drawing.Size(72, 21); this.CB_WeatherEnc4.TabIndex = 498; @@ -1018,14 +1024,14 @@ private void InitializeComponent() this.CB_WeatherEnc3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_WeatherEnc3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_WeatherEnc3.FormattingEnabled = true; - this.CB_WeatherEnc3.Location = new System.Drawing.Point(33, 319); + this.CB_WeatherEnc3.Location = new System.Drawing.Point(36, 306); this.CB_WeatherEnc3.Name = "CB_WeatherEnc3"; this.CB_WeatherEnc3.Size = new System.Drawing.Size(72, 21); this.CB_WeatherEnc3.TabIndex = 497; // // NUP_WeatherForme2 // - this.NUP_WeatherForme2.Location = new System.Drawing.Point(217, 293); + this.NUP_WeatherForme2.Location = new System.Drawing.Point(220, 280); this.NUP_WeatherForme2.Maximum = new decimal(new int[] { 31, 0, @@ -1040,14 +1046,14 @@ private void InitializeComponent() this.CB_WeatherEnc2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_WeatherEnc2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_WeatherEnc2.FormattingEnabled = true; - this.CB_WeatherEnc2.Location = new System.Drawing.Point(142, 292); + this.CB_WeatherEnc2.Location = new System.Drawing.Point(145, 279); this.CB_WeatherEnc2.Name = "CB_WeatherEnc2"; this.CB_WeatherEnc2.Size = new System.Drawing.Size(72, 21); this.CB_WeatherEnc2.TabIndex = 495; // // NUP_WeatherForme1 // - this.NUP_WeatherForme1.Location = new System.Drawing.Point(108, 293); + this.NUP_WeatherForme1.Location = new System.Drawing.Point(111, 280); this.NUP_WeatherForme1.Maximum = new decimal(new int[] { 31, 0, @@ -1062,7 +1068,7 @@ private void InitializeComponent() this.CB_WeatherEnc1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_WeatherEnc1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_WeatherEnc1.FormattingEnabled = true; - this.CB_WeatherEnc1.Location = new System.Drawing.Point(33, 292); + this.CB_WeatherEnc1.Location = new System.Drawing.Point(36, 279); this.CB_WeatherEnc1.Name = "CB_WeatherEnc1"; this.CB_WeatherEnc1.Size = new System.Drawing.Size(72, 21); this.CB_WeatherEnc1.TabIndex = 493; @@ -1070,7 +1076,7 @@ private void InitializeComponent() // L_AddSOS // this.L_AddSOS.AutoSize = true; - this.L_AddSOS.Location = new System.Drawing.Point(12, 269); + this.L_AddSOS.Location = new System.Drawing.Point(15, 256); this.L_AddSOS.Name = "L_AddSOS"; this.L_AddSOS.Size = new System.Drawing.Size(76, 13); this.L_AddSOS.TabIndex = 492; @@ -3046,6 +3052,38 @@ private void InitializeComponent() this.CopySOS.UseVisualStyleBackColor = true; this.CopySOS.Click += new System.EventHandler(this.CopySOS_Click); // + // B_Copy + // + this.B_Copy.Location = new System.Drawing.Point(14, 359); + this.B_Copy.Name = "B_Copy"; + this.B_Copy.Size = new System.Drawing.Size(90, 40); + this.B_Copy.TabIndex = 508; + this.B_Copy.Text = "Copy Current Table"; + this.B_Copy.UseVisualStyleBackColor = true; + this.B_Copy.Click += new System.EventHandler(this.B_Copy_Click); + // + // B_Paste + // + this.B_Paste.Enabled = false; + this.B_Paste.Location = new System.Drawing.Point(110, 359); + this.B_Paste.Name = "B_Paste"; + this.B_Paste.Size = new System.Drawing.Size(90, 40); + this.B_Paste.TabIndex = 509; + this.B_Paste.Text = "Paste Current Table"; + this.B_Paste.UseVisualStyleBackColor = true; + this.B_Paste.Click += new System.EventHandler(this.B_Paste_Click); + // + // B_PasteAll + // + this.B_PasteAll.Enabled = false; + this.B_PasteAll.Location = new System.Drawing.Point(206, 359); + this.B_PasteAll.Name = "B_PasteAll"; + this.B_PasteAll.Size = new System.Drawing.Size(90, 40); + this.B_PasteAll.TabIndex = 510; + this.B_PasteAll.Text = "Paste To All (Location)"; + this.B_PasteAll.UseVisualStyleBackColor = true; + this.B_PasteAll.Click += new System.EventHandler(this.B_PasteAll_Click); + // // SMWE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -3409,5 +3447,8 @@ private void InitializeComponent() private System.Windows.Forms.Button CopySOS; private System.Windows.Forms.Label L_SOS; private System.Windows.Forms.ComboBox CB_SlotRand; + private System.Windows.Forms.Button B_PasteAll; + private System.Windows.Forms.Button B_Paste; + private System.Windows.Forms.Button B_Copy; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/SMWE.cs b/pk3DS/Subforms/Gen7/SMWE.cs index d270488457..a6348eb02d 100644 --- a/pk3DS/Subforms/Gen7/SMWE.cs +++ b/pk3DS/Subforms/Gen7/SMWE.cs @@ -143,6 +143,7 @@ private void UpdatePanel(object sender, EventArgs e) if (loadingdata) return; loadingdata = true; + var Map = Areas[CB_LocationID.SelectedIndex]; GB_Encounters.Enabled = Map.HasTables; if (!Map.HasTables) @@ -151,26 +152,37 @@ private void UpdatePanel(object sender, EventArgs e) return; } CurrentTable = new EncounterTable(Map.Tables[CB_TableID.SelectedIndex].Data); - NUP_Min.Value = CurrentTable.MinLevel; - NUP_Max.Minimum = CurrentTable.MinLevel; - NUP_Max.Value = CurrentTable.MaxLevel; - for (int slot = 0; slot < CurrentTable.Encounter7s.Length; slot++) - for (int i = 0; i < CurrentTable.Encounter7s[slot].Length; i++) - { - var sl = CurrentTable.Encounter7s[slot]; - if (slot == 8) - sl = CurrentTable.AdditionalSOS; - rate_spec[i].Value = CurrentTable.Rates[i]; - cb_spec[slot][i].SelectedIndex = (int)sl[i].Species; - nup_spec[slot][i].Value = (int)sl[i].Forme; - } + LoadTable(CurrentTable); + loadingdata = false; + RefreshTableImages(Map); + } - int base_id = CB_TableID.SelectedIndex/2; + private void RefreshTableImages(Area7 Map) + { + int base_id = CB_TableID.SelectedIndex / 2; base_id *= 2; PB_DayTable.Image = Map.Tables[base_id].GetTableImg(font); PB_NightTable.Image = Map.Tables[base_id + 1].GetTableImg(font); } + + private void LoadTable(EncounterTable table) + { + NUP_Min.Value = table.MinLevel; + NUP_Max.Minimum = table.MinLevel; + NUP_Max.Value = table.MaxLevel; + for (int slot = 0; slot < table.Encounter7s.Length; slot++) + for (int i = 0; i < table.Encounter7s[slot].Length; i++) + { + var sl = table.Encounter7s[slot]; + if (slot == 8) + sl = table.AdditionalSOS; + rate_spec[i].Value = table.Rates[i]; + cb_spec[slot][i].SelectedIndex = (int)sl[i].Species; + nup_spec[slot][i].Value = (int)sl[i].Forme; + } + } + private void UpdateMinMax(object sender, EventArgs e) { if (loadingdata) @@ -202,13 +214,15 @@ private void UpdateSpeciesForm(object sender, EventArgs e) var cb_l = cb_spec[table]; var nup_l = nup_spec[table]; + var species = (uint) cb_l[slot].SelectedIndex; + var form = (uint) nup_l[slot].Value; if (table == 8) { - CurrentTable.AdditionalSOS[slot].Species = (uint)cb_l[slot].SelectedIndex; - CurrentTable.AdditionalSOS[slot].Forme = (uint)nup_l[slot].Value; + CurrentTable.AdditionalSOS[slot].Species = species; + CurrentTable.AdditionalSOS[slot].Forme = form; } - CurrentTable.Encounter7s[table][slot].Species = (uint)cb_l[slot].SelectedIndex; - CurrentTable.Encounter7s[table][slot].Forme = (uint)nup_l[slot].Value; + CurrentTable.Encounter7s[table][slot].Species = species; + CurrentTable.Encounter7s[table][slot].Forme = form; using (var g = Graphics.FromImage(cur_img)) { @@ -255,6 +269,51 @@ private void UpdateEncounterRate(object sender, EventArgs e) GB_Encounters.Text = $"Encounters ({sum}%)"; } + private byte[] CopyTable; + private int CopyCount; + private void B_Copy_Click(object sender, EventArgs e) + { + var Map = Areas[CB_LocationID.SelectedIndex]; + if (!Map.HasTables) + { + WinFormsUtil.Alert("No tables to copy."); + return; + } + CurrentTable.Write(); + CopyTable = (byte[])CurrentTable.Data.Clone(); + CopyCount = CurrentTable.Encounter7s[0].Count(z => z.Species != 0); + B_Paste.Enabled = B_PasteAll.Enabled = true; + WinFormsUtil.Alert("Copied table data."); + } + private void B_Paste_Click(object sender, EventArgs e) + { + var Map = Areas[CB_LocationID.SelectedIndex]; + if (!Map.HasTables) + { + WinFormsUtil.Alert("No table to paste to."); + return; + } + CurrentTable.Reset(CopyTable); + loadingdata = true; + LoadTable(CurrentTable); + var area = Areas[CB_LocationID.SelectedIndex]; + area.Tables[CB_TableID.SelectedIndex] = CurrentTable; + loadingdata = false; + RefreshTableImages(Map); + System.Media.SystemSounds.Asterisk.Play(); + } + private void B_PasteAll_Click(object sender, EventArgs e) + { + var Map = Areas[CB_LocationID.SelectedIndex]; + if (!Map.HasTables) + { + WinFormsUtil.Alert("No table to paste to."); + return; + } + B_Paste_Click(sender, e); + foreach (var t in Map.Tables.Where(t => CopyCount == t.Encounter7s[0].Count(z => z.Species != 0))) + t.Reset(CopyTable); + } private void B_Save_Click(object sender, EventArgs e) { var sum = TotalEncounterRate; diff --git a/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs b/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs index 03d8f39d5c..a104b51f95 100644 --- a/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs +++ b/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs @@ -19,6 +19,14 @@ public EncounterTable(byte[] t) { Rates = new int[10]; Encounter7s = new Encounter7[9][]; + AdditionalSOS = new Encounter7[6]; + Data = (byte[])t.Clone(); + Reset(); + } + + public void Reset() + { + var t = Data; MinLevel = t[0]; MaxLevel = t[1]; @@ -33,12 +41,10 @@ public EncounterTable(byte[] t) Encounter7s[i][j] = new Encounter7(BitConverter.ToUInt32(t, ofs + 4 * j)); } - AdditionalSOS = new Encounter7[6]; for (var i = 0; i < AdditionalSOS.Length; i++) AdditionalSOS[i] = new Encounter7(BitConverter.ToUInt32(t, 0x14C + 4 * i)); Encounter7s[8] = AdditionalSOS; - Data = (byte[])t.Clone(); } /// @@ -119,5 +125,11 @@ private string GetSlotSetSummary(string[] speciesList, int setNumber) var summaries = list.Select(e => $"{e.GetSummary(speciesList)} ({specToRate[e.RawValue]}%)"); return string.Join(", ", summaries); } + + public void Reset(byte[] data) + { + Buffer.BlockCopy(data, 0, Data, 0, 0x164); + Reset(); + } } } From 1e6047205e31b541373e3d03d8eee5ea0ee93377 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Dec 2017 00:07:18 -0800 Subject: [PATCH 026/191] Misc tweaks standardize rand usage to single instance, no functional changes --- pk3DS.Core/Randomizers/PersonalRandomizer.cs | 2 +- .../Structures/Gen6/EncounterStatic6.cs | 51 ++++++++++++++----- .../Structures/Gen7/EncounterStatic7.cs | 16 +++--- pk3DS.Core/Util.cs | 8 ++- pk3DS/ARCUtil.cs | 2 +- pk3DS/Subforms/Gen6/MoveEditor6.cs | 2 +- pk3DS/Subforms/Gen6/RSTE.cs | 6 +-- pk3DS/Subforms/Gen6/RSWE.cs | 6 +-- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 2 +- pk3DS/Subforms/Gen6/XYWE.cs | 7 +-- pk3DS/Subforms/Gen7/MoveEditor7.cs | 2 +- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 2 +- 12 files changed, 56 insertions(+), 50 deletions(-) diff --git a/pk3DS.Core/Randomizers/PersonalRandomizer.cs b/pk3DS.Core/Randomizers/PersonalRandomizer.cs index b59be51e5c..48985346f6 100644 --- a/pk3DS.Core/Randomizers/PersonalRandomizer.cs +++ b/pk3DS.Core/Randomizers/PersonalRandomizer.cs @@ -8,7 +8,7 @@ namespace pk3DS.Core.Randomizers { public class PersonalRandomizer : IRandomizer { - private static readonly Random rnd = new Random(); + private readonly Random rnd = Util.rand; private const decimal LearnTMPercent = 35; // Average Learnable TMs is 35.260. private const decimal LearnTypeTutorPercent = 2; //136 special tutor moves learnable by species in Untouched ORAS. diff --git a/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs b/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs index cad65d23f6..03a19b8ead 100644 --- a/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs +++ b/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs @@ -9,11 +9,20 @@ public class EncounterStatic6 public ushort Species { - get { return BitConverter.ToUInt16(Data, 0x0); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x0); } + get => BitConverter.ToUInt16(Data, 0x0); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x0); + } + + public byte Form + { + get => Data[0x2]; + set => Data[0x2] = value; + } + public byte Level + { + get => Data[0x3]; + set => Data[0x3] = value; } - public byte Form { get { return Data[0x2]; } set { Data[0x2] = value; } } - public byte Level { get { return Data[0x3]; } set { Data[0x3] = value; } } public int HeldItem { get @@ -29,20 +38,34 @@ public int HeldItem } } - public bool ShinyLock { get { return (Data[0x6] & 2) >> 1 == 1; } set { Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0)); } } - public int Gender { get { return (Data[0x6] & 0xC) >> 2; } set { Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2)); } } - public int Ability { get { return (Data[0x6] & 0x70) >> 4; } set { Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4)); } } - - public bool IV3 { get { return (Data[0x7] & 1) >> 0 == 1; } set { Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0)); } } - public bool IV3_1 { get { return (Data[0x7] & 2) >> 1 == 1; } set { Data[0x7] = (byte)(Data[0x7] & ~2 | (value ? 2 : 0)); } } + public bool ShinyLock + { + get => (Data[0x6] & 2) >> 1 == 1; + set => Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0)); + } + public int Gender + { + get => (Data[0x6] & 0xC) >> 2; + set => Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2)); + } - public EncounterStatic6(byte[] data) + public int Ability { - Data = (byte[])data.Clone(); + get => (Data[0x6] & 0x70) >> 4; + set => Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4)); } - public byte[] Write() + public bool IV3 { - return (byte[])Data.Clone(); + get => (Data[0x7] & 1) >> 0 == 1; + set => Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0)); } + public bool IV3_1 + { + get => (Data[0x7] & 2) >> 1 == 1; + set => Data[0x7] = (byte)(Data[0x7] & ~2 | (value ? 2 : 0)); + } + + public EncounterStatic6(byte[] data) => Data = (byte[])data.Clone(); + public byte[] Write() => (byte[])Data.Clone(); } } diff --git a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs index c00b911b44..25cb686c8f 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs @@ -52,12 +52,14 @@ public int Gender set => Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2)); } public int Ability - { get => (Data[0x6] & 0x70) >> 4; + { + get => (Data[0x6] & 0x70) >> 4; set => Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4)); } public bool _7 - { get => (Data[0x7] & 1) >> 0 == 1; + { + get => (Data[0x7] & 1) >> 0 == 1; set => Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0)); } public bool _7_1 @@ -96,10 +98,7 @@ public int Nature public int[] IVs { - get => new int[] - { - (sbyte) Data[0x15], (sbyte) Data[0x16], (sbyte) Data[0x17], (sbyte) Data[0x18], (sbyte) Data[0x19], (sbyte) Data[0x1A] - }; + get => new int[] { (sbyte) Data[0x15], (sbyte) Data[0x16], (sbyte) Data[0x17], (sbyte) Data[0x18], (sbyte) Data[0x19], (sbyte) Data[0x1A] }; set { if (value.Length != 6) @@ -110,10 +109,7 @@ public int[] IVs } public int[] EVs { - get => new int[] - { - (byte) Data[0x1B], (byte) Data[0x1C], (byte) Data[0x1D], (byte) Data[0x1E], (byte) Data[0x1F], (byte) Data[0x20] - }; + get => new int[] { Data[0x1B], Data[0x1C], Data[0x1D], Data[0x1E], Data[0x1F], Data[0x20] }; set { if (value.Length != 6) diff --git a/pk3DS.Core/Util.cs b/pk3DS.Core/Util.cs index f01690416a..d5bcd9259b 100644 --- a/pk3DS.Core/Util.cs +++ b/pk3DS.Core/Util.cs @@ -33,11 +33,9 @@ public static string TrimFromZero(string input) } // Randomization - public static Random rand = new Random(); - public static uint rnd32() - { - return (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2); - } + public static Random rand { get; private set; } = new Random(); + public static void ReseedRand(int seed) => rand = new Random(seed); + public static uint rnd32() => (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2); // Data Retrieval public static int ToInt32(string value) diff --git a/pk3DS/ARCUtil.cs b/pk3DS/ARCUtil.cs index c1b53be84b..045cab3c5e 100644 --- a/pk3DS/ARCUtil.cs +++ b/pk3DS/ARCUtil.cs @@ -6,7 +6,7 @@ namespace pk3DS.ARCUtil { - public class ARC + public static class ARC { // Multi Type Archive Handling internal static bool onefile = true; diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index a200a5255a..49738b5c60 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -174,7 +174,7 @@ private void B_RandAll_Click(object sender, EventArgs e) } if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Moves? Cannot undo.", "Double check options on the right before continuing.") != DialogResult.Yes) return; - Random rnd = new Random(); + Random rnd = Util.rand; for (int i = 0; i < CB_Move.Items.Count; i++) { CB_Move.SelectedIndex = i; // Get new Move diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index db32d6f54f..ea824375c9 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -131,11 +131,7 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) Setup(); } private string[][] AltForms; - internal static readonly Random rand = new Random(); - internal static uint rnd32() - { - return (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2); - } + internal static uint rnd32() => Util.rnd32(); private bool start = true; private bool loading = true; private int index = -1; diff --git a/pk3DS/Subforms/Gen6/RSWE.cs b/pk3DS/Subforms/Gen6/RSWE.cs index 93fca682e1..e21bd2fb61 100644 --- a/pk3DS/Subforms/Gen6/RSWE.cs +++ b/pk3DS/Subforms/Gen6/RSWE.cs @@ -304,11 +304,7 @@ private void RSWE_Load() //Preload Tabs PreloadTabs(); } - internal static Random rand = new Random(); - internal static uint rnd32() - { - return (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2); - } + internal static uint rnd32() => Util.rnd32(); private void openQuick(string[] encdata) { diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 3fdde0b766..07db88a0eb 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -59,7 +59,7 @@ private void loadData() for (int i = 0; i < EncounterData.Length; i++) { EncounterData[i] = new EncounterStatic6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray()); - LB_Encounters.Items.Add($"{i.ToString("00")} - {specieslist[EncounterData[i].Species]}"); + LB_Encounters.Items.Add($"{i:00} - {specieslist[EncounterData[i].Species]}"); } loaded = true; LB_Encounters.SelectedIndex = 0; diff --git a/pk3DS/Subforms/Gen6/XYWE.cs b/pk3DS/Subforms/Gen6/XYWE.cs index 8ab384a959..a55c58c41c 100644 --- a/pk3DS/Subforms/Gen6/XYWE.cs +++ b/pk3DS/Subforms/Gen6/XYWE.cs @@ -495,11 +495,8 @@ private void PreloadTabs(object sender, EventArgs e) } TabControl_EncounterData.TabPages[0].Show(); } - internal static Random rand = new Random(); - internal static uint rnd32() - { - return (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2); - } + + internal static uint rnd32() => Util.rnd32(); private void B_Randomize_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index 289f72cbb1..761c0c19e3 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -175,7 +175,7 @@ private void B_RandAll_Click(object sender, EventArgs e) } if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Moves? Cannot undo.", "Double check options on the right before continuing.") != DialogResult.Yes) return; - Random rnd = new Random(); + Random rnd = Util.rand; for (int i = 0; i < CB_Move.Items.Count; i++) { CB_Move.SelectedIndex = i; // Get new Move diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 33c7e2e330..020c7a03fc 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -176,7 +176,7 @@ private void saveData() private string getEntryText(int species, int entry) { - return $"{entry.ToString("00")} - {specieslist[species]}"; + return $"{entry:00} - {specieslist[species]}"; } private string getEntryText(EncounterStatic enc, int entry) { From b467a0e8e31aaa8d26c3f6617d032746f734abc6 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Dec 2017 00:07:51 -0800 Subject: [PATCH 027/191] add randsettings utility for saving settings across sessions --- pk3DS/Main.cs | 10 +++ pk3DS/Tools/RandSettings.cs | 135 ++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 pk3DS/Tools/RandSettings.cs diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index b522b7a431..6d46bd68c0 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using System.Threading; using System.Windows.Forms; @@ -54,6 +55,9 @@ public Main() string[] args = Environment.GetCommandLineArgs(); string filename = args.Length > 0 ? Path.GetFileNameWithoutExtension(args[0])?.ToLower() : ""; skipBoth = filename.IndexOf("3DSkip", StringComparison.Ordinal) >= 0; + + if (File.Exists(RandSettings.FileName)) + RandSettings.Load(File.ReadAllLines(RandSettings.FileName)); } internal static GameConfig Config; public static string RomFSPath; @@ -128,6 +132,12 @@ private void formClosing(object sender, FormClosingEventArgs e) string[][] files = Config.GameTextStrings; g.Files = files.Select(x => TextFile.getBytes(Config, x)).ToArray(); g.Save(); + + try + { + File.WriteAllLines(RandSettings.FileName, RandSettings.Save(), Encoding.Unicode); + } + catch { } } private void openQuick(string path) diff --git a/pk3DS/Tools/RandSettings.cs b/pk3DS/Tools/RandSettings.cs new file mode 100644 index 0000000000..dd5c6fced3 --- /dev/null +++ b/pk3DS/Tools/RandSettings.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Windows.Forms; + +namespace pk3DS +{ + public static class RandSettings + { + public const string FileName = "randsettings.txt"; + private static readonly Dictionary> Settings = new Dictionary>(); + public static void Load(string[] lines) + { + Settings.Clear(); + int ctr = 0; + while (ctr < lines.Length) + { + string formname = lines[0]; + int end = Array.FindIndex(lines, ctr, string.IsNullOrWhiteSpace); + var list = GetList(lines, ctr + 1, end - 1); + Settings.Add(formname, list); + ctr = end + 1; + } + } + public static string[] Save() + { + var result = new List(); + foreach (var list in Settings) + { + result.Add(list.Key); + result.AddRange(list.Value.Select(val => val.Write())); + result.Add(string.Empty); + } + return result.ToArray(); + } + + public static void LoadFormSettings(Form form, Control.ControlCollection controls) + { + if (!Settings.TryGetValue(form.Name, out var list)) + return; + + foreach (Control ctrl in controls) + { + LoadFormSettings(form, ctrl.Controls); + var pair = list.FirstOrDefault(z => ctrl.Name == z.Name); + if (pair == null) + continue; + + TryGetValue(ctrl, pair.Value); + } + } + public static void SaveFormSettings(Form form, Control.ControlCollection controls) + { + if (!Settings.TryGetValue(form.Name, out var list)) + return; + + foreach (Control ctrl in controls) + { + SaveFormSettings(form, ctrl.Controls); + var pair = list.FirstOrDefault(z => ctrl.Name == z.Name) ?? new NameValue(ctrl.Name); + TrySetValue(ctrl, pair); + } + } + private static void TryGetValue(Control ctrl, string s) + { + switch (ctrl) + { + case NumericUpDown nud: + if (decimal.TryParse(s, out var n)) + nud.Value = n; + break; + case ComboBox cb: + if (int.TryParse(s, out var c)) + cb.SelectedIndex = c; + break; + case CheckBox ck: + if (bool.TryParse(s, out var b)) + ck.Checked = b; + break; + default: + System.Diagnostics.Debug.WriteLine($"{ctrl.Name}: unknown control type."); + break; + } + } + private static void TrySetValue(Control ctrl, NameValue v) + { + switch (ctrl) + { + case NumericUpDown nud: + v.Value = nud.Value.ToString(CultureInfo.InvariantCulture); + break; + case ComboBox cb: + v.Value = cb.SelectedIndex.ToString(); + break; + case CheckBox ck: + v.Value = ck.Checked.ToString(); + break; + default: + System.Diagnostics.Debug.WriteLine($"{ctrl.Name}: unknown control type."); + break; + } + } + + private static List GetList(IList lines, int start, int end) + { + var list = new List(); + for (int i = start; i <= end; i++) + { + var val = new NameValue(lines[i]); + if (val.Name != null) + list.Add(val); + } + return list; + } + + private class NameValue + { + public readonly string Name; + public string Value; + + private const char Separator = '\t'; + public string Write() => Name + Separator + Value; + + public NameValue(string s) + { + var split = s.Split(Separator); + Name = split[0]; + if (split.Length < 2) + return; + Value = split[1]; + } + } + } +} From bf94aef729a732f3d4bac377d550d52b50c0d44b Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Dec 2017 00:16:41 -0800 Subject: [PATCH 028/191] sync missing changes oops --- pk3DS/Tools/RandSettings.cs | 18 +++++++++++------- pk3DS/pk3DS.csproj | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pk3DS/Tools/RandSettings.cs b/pk3DS/Tools/RandSettings.cs index dd5c6fced3..d79c9bcae4 100644 --- a/pk3DS/Tools/RandSettings.cs +++ b/pk3DS/Tools/RandSettings.cs @@ -53,13 +53,17 @@ public static void LoadFormSettings(Form form, Control.ControlCollection control public static void SaveFormSettings(Form form, Control.ControlCollection controls) { if (!Settings.TryGetValue(form.Name, out var list)) - return; + { + list = new List(); + Settings.Add(form.Name, list); + } foreach (Control ctrl in controls) { SaveFormSettings(form, ctrl.Controls); var pair = list.FirstOrDefault(z => ctrl.Name == z.Name) ?? new NameValue(ctrl.Name); - TrySetValue(ctrl, pair); + if (TrySetValue(ctrl, pair) && !list.Contains(pair)) + list.Add(pair); } } private static void TryGetValue(Control ctrl, string s) @@ -83,22 +87,22 @@ private static void TryGetValue(Control ctrl, string s) break; } } - private static void TrySetValue(Control ctrl, NameValue v) + private static bool TrySetValue(Control ctrl, NameValue v) { switch (ctrl) { case NumericUpDown nud: v.Value = nud.Value.ToString(CultureInfo.InvariantCulture); - break; + return true; case ComboBox cb: v.Value = cb.SelectedIndex.ToString(); - break; + return true; case CheckBox ck: v.Value = ck.Checked.ToString(); - break; + return true; default: System.Diagnostics.Debug.WriteLine($"{ctrl.Name}: unknown control type."); - break; + return false; } } diff --git a/pk3DS/pk3DS.csproj b/pk3DS/pk3DS.csproj index 94850c1508..c6af6503bd 100644 --- a/pk3DS/pk3DS.csproj +++ b/pk3DS/pk3DS.csproj @@ -84,6 +84,7 @@ + Form From b9e0bf355b1779bd07f0c225fc3dfd7ca2d2bfbb Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Dec 2017 01:28:02 -0800 Subject: [PATCH 029/191] Add rand settings persistence Closes #129 --- pk3DS/Subforms/Gen6/EggMoveEditor6.cs | 2 + pk3DS/Subforms/Gen6/EvolutionEditor6.cs | 2 + pk3DS/Subforms/Gen6/GiftEditor6.cs | 2 + pk3DS/Subforms/Gen6/LevelUpEditor6.cs | 2 + pk3DS/Subforms/Gen6/MoveEditor6.cs | 2 + pk3DS/Subforms/Gen6/PersonalEditor6.cs | 2 + pk3DS/Subforms/Gen6/RSWE.cs | 1 + .../Subforms/Gen6/StarterEditor6.Designer.cs | 26 +++++-- pk3DS/Subforms/Gen6/StarterEditor6.cs | 2 + pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 2 + pk3DS/Subforms/Gen6/TrainerRand.cs | 2 + pk3DS/Subforms/Gen6/XYWE.Designer.cs | 23 +++--- pk3DS/Subforms/Gen6/XYWE.cs | 6 ++ pk3DS/Subforms/Gen7/EggMoveEditor7.cs | 2 + pk3DS/Subforms/Gen7/EvolutionEditor7.cs | 2 + pk3DS/Subforms/Gen7/LevelUpEditor7.cs | 2 + pk3DS/Subforms/Gen7/MoveEditor7.cs | 2 + pk3DS/Subforms/Gen7/PersonalEditor7.cs | 2 + pk3DS/Subforms/Gen7/SMTE.cs | 2 + pk3DS/Subforms/Gen7/SMWE.Designer.cs | 71 ++++++++++--------- pk3DS/Subforms/Gen7/SMWE.cs | 6 ++ pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 2 + pk3DS/Tools/RandSettings.cs | 12 ++-- 23 files changed, 121 insertions(+), 56 deletions(-) diff --git a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs index 418d5e29eb..3f7826189c 100644 --- a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs @@ -34,6 +34,7 @@ public EggMoveEditor6(byte[][] infiles) CB_Species.ValueMember = "Value"; CB_Species.DataSource = newlist; CB_Species.SelectedIndex = 0; + RandSettings.GetFormSettings(this, groupBox1.Controls); } private readonly byte[][] files; private int entry = -1; @@ -154,6 +155,7 @@ private void B_Dump_Click(object sender, EventArgs e) private void formClosing(object sender, FormClosingEventArgs e) { setList(); + RandSettings.SetFormSettings(this, groupBox1.Controls); } private void calcStats() { diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs index 95d4813179..7221d402b6 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs @@ -77,6 +77,7 @@ public EvolutionEditor6(byte[][] infiles) CB_Species.Items.RemoveAt(0); CB_Species.SelectedIndex = 0; + RandSettings.GetFormSettings(this, GB_Randomizer.Controls); } private readonly byte[][] files; private readonly ComboBox[] pb; @@ -181,6 +182,7 @@ private void B_Dump_Click(object sender, EventArgs e) private void formClosing(object sender, FormClosingEventArgs e) { setList(); + RandSettings.SetFormSettings(this, GB_Randomizer.Controls); } private void changeMethod(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 2c57d88953..8640b9fbac 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -36,6 +36,7 @@ public GiftEditor6() CB_HeldItem.Items.Add(s); CB_Nature.Items.Add("Random"); CB_Nature.Items.AddRange(natureslist.Take(25).ToArray()); + RandSettings.GetFormSettings(this, tabPage2.Controls); loadData(); } @@ -62,6 +63,7 @@ private void B_Save_Click(object sender, EventArgs e) { saveEntry(); saveData(); + RandSettings.SetFormSettings(this, tabPage2.Controls); Close(); } private void B_Cancel_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs index 08f0536824..d20376222a 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs @@ -39,6 +39,7 @@ public LevelUpEditor6(byte[][] infiles) CB_Species.ValueMember = "Value"; CB_Species.DataSource = newlist; CB_Species.SelectedIndex = 0; + RandSettings.GetFormSettings(this, groupBox1.Controls); } private readonly byte[][] files; @@ -186,6 +187,7 @@ private void B_Dump_Click(object sender, EventArgs e) private void formClosing(object sender, FormClosingEventArgs e) { setList(); + RandSettings.SetFormSettings(this, groupBox1.Controls); } private void CHK_TypeBias_CheckedChanged(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index 49738b5c60..2fb130d5ef 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -15,6 +15,7 @@ public MoveEditor6(byte[][] infiles) InitializeComponent(); Setup(); + RandSettings.GetFormSettings(this, groupBox1.Controls); } private byte[][] files; private readonly string[] types = Main.Config.getText(TextName.Types); @@ -163,6 +164,7 @@ private void setEntry() private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); + RandSettings.SetFormSettings(this, groupBox1.Controls); } private void B_RandAll_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index a6812534ee..9518851390 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -38,6 +38,7 @@ public PersonalEditor6(byte[][] infiles) Setup(); //Turn string resources into arrays CB_Species.SelectedIndex = 1; + RandSettings.GetFormSettings(this, TP_Randomizer.Controls); } #region Global Variables private readonly string mode = Main.Config.ORAS ? "ORAS" : "XY"; @@ -441,6 +442,7 @@ private void CHK_Ability_CheckedChanged(object sender, EventArgs e) private void formClosing(object sender, FormClosingEventArgs e) { if (entry > -1) saveEntry(); + RandSettings.SetFormSettings(this, TP_Randomizer.Controls); } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/RSWE.cs b/pk3DS/Subforms/Gen6/RSWE.cs index e21bd2fb61..8e761e0d0d 100644 --- a/pk3DS/Subforms/Gen6/RSWE.cs +++ b/pk3DS/Subforms/Gen6/RSWE.cs @@ -270,6 +270,7 @@ public RSWE() }; RSWE_Load(); openQuick(Directory.GetFiles("encdata")); + RandSettings.GetFormSettings(this, GB_Tweak.Controls); } private readonly ComboBox[] spec; private readonly NumericUpDown[] min; diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs index 1b5545a6af..ccbd841350 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs @@ -61,6 +61,7 @@ private void InitializeComponent() this.L_Set2 = new System.Windows.Forms.Label(); this.CHK_Gen = new System.Windows.Forms.CheckBox(); this.CHK_BST = new System.Windows.Forms.CheckBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_2)).BeginInit(); @@ -73,6 +74,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.PB_G4_2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G4_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G4_0)).BeginInit(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // PB_G1_0 @@ -413,7 +415,7 @@ private void InitializeComponent() // CHK_Gen // this.CHK_Gen.AutoSize = true; - this.CHK_Gen.Location = new System.Drawing.Point(93, 314); + this.CHK_Gen.Location = new System.Drawing.Point(16, 15); this.CHK_Gen.Name = "CHK_Gen"; this.CHK_Gen.Size = new System.Drawing.Size(104, 17); this.CHK_Gen.TabIndex = 471; @@ -425,20 +427,30 @@ private void InitializeComponent() this.CHK_BST.AutoSize = true; this.CHK_BST.Checked = true; this.CHK_BST.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BST.Location = new System.Drawing.Point(93, 328); + this.CHK_BST.Location = new System.Drawing.Point(16, 29); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(108, 17); this.CHK_BST.TabIndex = 472; this.CHK_BST.Text = "Keep Similar BST"; this.CHK_BST.UseVisualStyleBackColor = true; // - // Starters + // groupBox1 + // + this.groupBox1.Controls.Add(this.CHK_BST); + this.groupBox1.Controls.Add(this.CHK_Gen); + this.groupBox1.Location = new System.Drawing.Point(93, 306); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(200, 45); + this.groupBox1.TabIndex = 473; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Randomizer Settings"; + // + // StarterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(804, 352); - this.Controls.Add(this.CHK_BST); - this.Controls.Add(this.CHK_Gen); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.L_Set2); this.Controls.Add(this.L_Set4); this.Controls.Add(this.L_Set3); @@ -488,6 +500,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.PB_G4_2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G4_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G4_0)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -528,6 +542,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Set2; private System.Windows.Forms.CheckBox CHK_Gen; private System.Windows.Forms.CheckBox CHK_BST; - + private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index 388ab41494..68c984ba8c 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -45,6 +45,7 @@ public StarterEditor6() Width = Main.Config.ORAS ? Width : Width/2 + 2; loadData(); + RandSettings.GetFormSettings(this, groupBox1.Controls); } private readonly string CROPath = Path.Combine(Main.RomFSPath, "DllPoke3Select.cro"); private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro"); @@ -62,6 +63,7 @@ public StarterEditor6() private void B_Save_Click(object sender, EventArgs e) { saveData(); + RandSettings.SetFormSettings(this, groupBox1.Controls); Close(); } private void B_Cancel_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 07db88a0eb..8c6a9a2785 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -32,6 +32,7 @@ public StaticEncounterEditor6() foreach (string s in itemlist) CB_HeldItem.Items.Add(s); loadData(); + RandSettings.GetFormSettings(this, tabPage2.Controls); } private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro"); private byte[] FieldData; @@ -45,6 +46,7 @@ private void B_Save_Click(object sender, EventArgs e) { saveEntry(); saveData(); + RandSettings.SetFormSettings(this, tabPage2.Controls); Close(); } private void B_Cancel_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index 0222b50a1d..b73ed2d3d5 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -17,6 +17,7 @@ public TrainerRand() foreach (string tclass in trClass.Where(tclass => !trClassnorep.Contains(tclass) && !tclass.StartsWith("[~"))) trClassnorep.Add(tclass); trClassnorep.Sort(); + RandSettings.GetFormSettings(this, Controls); } private string[] trName = Main.Config.getText(TextName.TrainerNames); @@ -103,6 +104,7 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.rSpeciesRand.Initialize(); RSTE.rDoRand = true; + RandSettings.SetFormSettings(this, Controls); Close(); } diff --git a/pk3DS/Subforms/Gen6/XYWE.Designer.cs b/pk3DS/Subforms/Gen6/XYWE.Designer.cs index 31fac8e593..2df7f8d033 100644 --- a/pk3DS/Subforms/Gen6/XYWE.Designer.cs +++ b/pk3DS/Subforms/Gen6/XYWE.Designer.cs @@ -276,6 +276,7 @@ private void InitializeComponent() this.label25 = new System.Windows.Forms.Label(); this.TabPage_Horde = new System.Windows.Forms.TabPage(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_HomogeneousHordes = new System.Windows.Forms.CheckBox(); this.CHK_MegaForm = new System.Windows.Forms.CheckBox(); this.L_RandOpt = new System.Windows.Forms.Label(); this.CHK_BST = new System.Windows.Forms.CheckBox(); @@ -562,7 +563,6 @@ private void InitializeComponent() this.CB_FormeList = new System.Windows.Forms.ComboBox(); this.B_Randomize = new System.Windows.Forms.Button(); this.B_Dump = new System.Windows.Forms.Button(); - this.CHK_HomogeneousHordes = new System.Windows.Forms.CheckBox(); this.TabControl_EncounterData.SuspendLayout(); this.TabPage_Land.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUP_RockSmashMax5)).BeginInit(); @@ -15529,6 +15529,16 @@ private void InitializeComponent() this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Tweaks"; // + // CHK_HomogeneousHordes + // + this.CHK_HomogeneousHordes.AutoSize = true; + this.CHK_HomogeneousHordes.Location = new System.Drawing.Point(18, 97); + this.CHK_HomogeneousHordes.Name = "CHK_HomogeneousHordes"; + this.CHK_HomogeneousHordes.Size = new System.Drawing.Size(133, 17); + this.CHK_HomogeneousHordes.TabIndex = 297; + this.CHK_HomogeneousHordes.Text = "Single Species Hordes"; + this.CHK_HomogeneousHordes.UseVisualStyleBackColor = true; + // // CHK_MegaForm // this.CHK_MegaForm.AutoSize = true; @@ -27918,16 +27928,6 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // CHK_HomogeneousHordes - // - this.CHK_HomogeneousHordes.AutoSize = true; - this.CHK_HomogeneousHordes.Location = new System.Drawing.Point(18, 97); - this.CHK_HomogeneousHordes.Name = "CHK_HomogeneousHordes"; - this.CHK_HomogeneousHordes.Size = new System.Drawing.Size(133, 17); - this.CHK_HomogeneousHordes.TabIndex = 297; - this.CHK_HomogeneousHordes.Text = "Single Species Hordes"; - this.CHK_HomogeneousHordes.UseVisualStyleBackColor = true; - // // XYWE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -27946,6 +27946,7 @@ private void InitializeComponent() this.MinimumSize = new System.Drawing.Size(964, 454); this.Name = "XYWE"; this.Text = "XY Wild Editor"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.XYWE_FormClosing); this.Load += new System.EventHandler(this.PreloadTabs); this.TabControl_EncounterData.ResumeLayout(false); this.TabPage_Land.ResumeLayout(false); diff --git a/pk3DS/Subforms/Gen6/XYWE.cs b/pk3DS/Subforms/Gen6/XYWE.cs index a55c58c41c..d94f7f6669 100644 --- a/pk3DS/Subforms/Gen6/XYWE.cs +++ b/pk3DS/Subforms/Gen6/XYWE.cs @@ -275,6 +275,7 @@ public XYWE() }; Load_XYWE(); openQuick(Directory.GetFiles("encdata")); + RandSettings.GetFormSettings(this, GB_Tweak.Controls); } private readonly ComboBox[] spec; private readonly NumericUpDown[] min; @@ -660,5 +661,10 @@ private void modifyLevels(object sender, EventArgs e) Enabled = true; WinFormsUtil.Alert("Modified all Level ranges according to specification!", "Press the Dump Tables button to view the new Level ranges!"); } + + private void XYWE_FormClosing(object sender, FormClosingEventArgs e) + { + RandSettings.SetFormSettings(this, GB_Tweak.Controls); + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs index 7056d9d2a8..070525d0ed 100644 --- a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs @@ -51,6 +51,7 @@ public EggMoveEditor7(byte[][] infiles) CB_Species.DataSource = newlist; CB_Species.SelectedIndex = 0; + RandSettings.GetFormSettings(this, groupBox1.Controls); } private readonly EggMoves7[] entries; @@ -170,6 +171,7 @@ private void formClosing(object sender, FormClosingEventArgs e) { setList(); entries.Select(z => z.Write()).ToArray().CopyTo(files, 0); + RandSettings.SetFormSettings(this, groupBox1.Controls); } private void B_Goto_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs index 5ab2bc421e..903b300bfc 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs @@ -97,6 +97,7 @@ public EvolutionEditor7(byte[][] infiles) CB_Species.Items.RemoveAt(0); CB_Species.SelectedIndex = 0; + RandSettings.GetFormSettings(this, GB_Randomizer.Controls); } private readonly byte[][] files; private readonly ComboBox[] pb, mb, rb; @@ -221,6 +222,7 @@ private void B_Dump_Click(object sender, EventArgs e) private void formClosing(object sender, FormClosingEventArgs e) { setList(); + RandSettings.SetFormSettings(this, GB_Randomizer.Controls); } private void changeMethod(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs index 96b8e25a13..dd2ed047ef 100644 --- a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs +++ b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs @@ -40,6 +40,7 @@ public LevelUpEditor7(byte[][] infiles) CB_Species.ValueMember = "Value"; CB_Species.DataSource = newlist; CB_Species.SelectedIndex = 0; + RandSettings.GetFormSettings(this, groupBox1.Controls); } private readonly byte[][] files; @@ -183,6 +184,7 @@ private void B_Dump_Click(object sender, EventArgs e) private void formClosing(object sender, FormClosingEventArgs e) { setList(); + RandSettings.SetFormSettings(this, groupBox1.Controls); } private void CHK_TypeBias_CheckedChanged(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index 761c0c19e3..388ca3bf81 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -16,6 +16,7 @@ public MoveEditor7(byte[][] infiles) InitializeComponent(); Setup(); + RandSettings.GetFormSettings(this, groupBox1.Controls); } private byte[][] files; private readonly string[] types = Main.Config.getText(TextName.Types); @@ -164,6 +165,7 @@ private void setEntry() private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); + RandSettings.SetFormSettings(this, groupBox1.Controls); } private void B_RandAll_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.cs index dbb8e0f749..b3e8dc5fac 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.cs @@ -33,6 +33,7 @@ public PersonalEditor7(byte[][] infiles) Setup(); CB_Species.SelectedIndex = 1; + RandSettings.GetFormSettings(this, TP_Randomizer.Controls); } #region Global Variables private readonly byte[][] files; @@ -431,6 +432,7 @@ private void CHK_Ability_CheckedChanged(object sender, EventArgs e) private void formClosing(object sender, FormClosingEventArgs e) { if (entry > -1) saveEntry(); + RandSettings.SetFormSettings(this, TP_Randomizer.Controls); } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 03f38911fd..0fb16fa21c 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -55,6 +55,7 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) CB_Moves.SelectedIndex = 0; TrainerClasses_7 = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; + RandSettings.GetFormSettings(this, Tab_Misc.Controls); } private int GetSlot(object sender) @@ -401,6 +402,7 @@ protected override void OnFormClosing(FormClosingEventArgs e) if (TrainerNames.Modified) Main.Config.setText(TextName.TrainerNames, TrainerNames.Lines); base.OnFormClosing(e); + RandSettings.SetFormSettings(this, Tab_Misc.Controls); } // Dumping diff --git a/pk3DS/Subforms/Gen7/SMWE.Designer.cs b/pk3DS/Subforms/Gen7/SMWE.Designer.cs index 777ea3f050..c95fb6b099 100644 --- a/pk3DS/Subforms/Gen7/SMWE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMWE.Designer.cs @@ -39,6 +39,9 @@ private void InitializeComponent() this.L_Max = new System.Windows.Forms.Label(); this.L_Table = new System.Windows.Forms.Label(); this.GB_Encounters = new System.Windows.Forms.GroupBox(); + this.B_PasteAll = new System.Windows.Forms.Button(); + this.B_Paste = new System.Windows.Forms.Button(); + this.B_Copy = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); this.CB_SlotRand = new System.Windows.Forms.ComboBox(); this.L_SOS = new System.Windows.Forms.Label(); @@ -256,9 +259,6 @@ private void InitializeComponent() this.CB_TableID = new System.Windows.Forms.ComboBox(); this.B_Export = new System.Windows.Forms.Button(); this.CopySOS = new System.Windows.Forms.Button(); - this.B_Copy = new System.Windows.Forms.Button(); - this.B_Paste = new System.Windows.Forms.Button(); - this.B_PasteAll = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.NUP_Min)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUP_Max)).BeginInit(); this.GB_Encounters.SuspendLayout(); @@ -688,6 +688,38 @@ private void InitializeComponent() this.GB_Encounters.TabStop = false; this.GB_Encounters.Text = "Encounters (100%)"; // + // B_PasteAll + // + this.B_PasteAll.Enabled = false; + this.B_PasteAll.Location = new System.Drawing.Point(206, 359); + this.B_PasteAll.Name = "B_PasteAll"; + this.B_PasteAll.Size = new System.Drawing.Size(90, 40); + this.B_PasteAll.TabIndex = 510; + this.B_PasteAll.Text = "Paste To All (Location)"; + this.B_PasteAll.UseVisualStyleBackColor = true; + this.B_PasteAll.Click += new System.EventHandler(this.B_PasteAll_Click); + // + // B_Paste + // + this.B_Paste.Enabled = false; + this.B_Paste.Location = new System.Drawing.Point(110, 359); + this.B_Paste.Name = "B_Paste"; + this.B_Paste.Size = new System.Drawing.Size(90, 40); + this.B_Paste.TabIndex = 509; + this.B_Paste.Text = "Paste Current Table"; + this.B_Paste.UseVisualStyleBackColor = true; + this.B_Paste.Click += new System.EventHandler(this.B_Paste_Click); + // + // B_Copy + // + this.B_Copy.Location = new System.Drawing.Point(14, 359); + this.B_Copy.Name = "B_Copy"; + this.B_Copy.Size = new System.Drawing.Size(90, 40); + this.B_Copy.TabIndex = 508; + this.B_Copy.Text = "Copy Current Table"; + this.B_Copy.UseVisualStyleBackColor = true; + this.B_Copy.Click += new System.EventHandler(this.B_Copy_Click); + // // GB_Tweak // this.GB_Tweak.Controls.Add(this.CB_SlotRand); @@ -3052,38 +3084,6 @@ private void InitializeComponent() this.CopySOS.UseVisualStyleBackColor = true; this.CopySOS.Click += new System.EventHandler(this.CopySOS_Click); // - // B_Copy - // - this.B_Copy.Location = new System.Drawing.Point(14, 359); - this.B_Copy.Name = "B_Copy"; - this.B_Copy.Size = new System.Drawing.Size(90, 40); - this.B_Copy.TabIndex = 508; - this.B_Copy.Text = "Copy Current Table"; - this.B_Copy.UseVisualStyleBackColor = true; - this.B_Copy.Click += new System.EventHandler(this.B_Copy_Click); - // - // B_Paste - // - this.B_Paste.Enabled = false; - this.B_Paste.Location = new System.Drawing.Point(110, 359); - this.B_Paste.Name = "B_Paste"; - this.B_Paste.Size = new System.Drawing.Size(90, 40); - this.B_Paste.TabIndex = 509; - this.B_Paste.Text = "Paste Current Table"; - this.B_Paste.UseVisualStyleBackColor = true; - this.B_Paste.Click += new System.EventHandler(this.B_Paste_Click); - // - // B_PasteAll - // - this.B_PasteAll.Enabled = false; - this.B_PasteAll.Location = new System.Drawing.Point(206, 359); - this.B_PasteAll.Name = "B_PasteAll"; - this.B_PasteAll.Size = new System.Drawing.Size(90, 40); - this.B_PasteAll.TabIndex = 510; - this.B_PasteAll.Text = "Paste To All (Location)"; - this.B_PasteAll.UseVisualStyleBackColor = true; - this.B_PasteAll.Click += new System.EventHandler(this.B_PasteAll_Click); - // // SMWE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -3105,6 +3105,7 @@ private void InitializeComponent() this.Controls.Add(this.CB_LocationID); this.Name = "SMWE"; this.Text = "Sun/Moon Wild Editor"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SMWE_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.NUP_Min)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUP_Max)).EndInit(); this.GB_Encounters.ResumeLayout(false); diff --git a/pk3DS/Subforms/Gen7/SMWE.cs b/pk3DS/Subforms/Gen7/SMWE.cs index a6348eb02d..24359a350c 100644 --- a/pk3DS/Subforms/Gen7/SMWE.cs +++ b/pk3DS/Subforms/Gen7/SMWE.cs @@ -39,6 +39,7 @@ public SMWE(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd) Areas = areas.OrderBy(a => a.Zones[0].Name).ToArray(); LoadData(); + RandSettings.GetFormSettings(this, GB_Tweak.Controls); // ExportEncounters("um", "uu"); } @@ -530,6 +531,11 @@ private IEnumerable GetLocationDump(Dictionary> dict) } } } + + private void SMWE_FormClosing(object sender, FormClosingEventArgs e) + { + RandSettings.SetFormSettings(this, GB_Tweak.Controls); + } } public static partial class Extensions diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 020c7a03fc..e7bf085fc9 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -125,6 +125,7 @@ public StaticEncounterEditor7(byte[][] infiles) // Select last tab (Randomization) by default in case info already randomized. TC_Tabs.SelectedIndex = TC_Tabs.TabCount - 1; + RandSettings.GetFormSettings(this, Tab_Randomizer.Controls); // ExportEncounters(); } private void getListBoxEntries() @@ -153,6 +154,7 @@ private void B_Save_Click(object sender, EventArgs e) setEncounter(); setTrade(); saveData(); + RandSettings.SetFormSettings(this, Tab_Randomizer.Controls); Close(); } private void B_Cancel_Click(object sender, EventArgs e) diff --git a/pk3DS/Tools/RandSettings.cs b/pk3DS/Tools/RandSettings.cs index d79c9bcae4..05a7ccc3f9 100644 --- a/pk3DS/Tools/RandSettings.cs +++ b/pk3DS/Tools/RandSettings.cs @@ -35,14 +35,16 @@ public static string[] Save() return result.ToArray(); } - public static void LoadFormSettings(Form form, Control.ControlCollection controls) + public static void GetFormSettings(Form form, Control.ControlCollection controls) { if (!Settings.TryGetValue(form.Name, out var list)) return; foreach (Control ctrl in controls) { - LoadFormSettings(form, ctrl.Controls); + GetFormSettings(form, ctrl.Controls); + if (string.IsNullOrWhiteSpace(ctrl.Name)) + continue; var pair = list.FirstOrDefault(z => ctrl.Name == z.Name); if (pair == null) continue; @@ -50,7 +52,7 @@ public static void LoadFormSettings(Form form, Control.ControlCollection control TryGetValue(ctrl, pair.Value); } } - public static void SaveFormSettings(Form form, Control.ControlCollection controls) + public static void SetFormSettings(Form form, Control.ControlCollection controls) { if (!Settings.TryGetValue(form.Name, out var list)) { @@ -60,7 +62,9 @@ public static void SaveFormSettings(Form form, Control.ControlCollection control foreach (Control ctrl in controls) { - SaveFormSettings(form, ctrl.Controls); + SetFormSettings(form, ctrl.Controls); + if (string.IsNullOrWhiteSpace(ctrl.Name)) + continue; var pair = list.FirstOrDefault(z => ctrl.Name == z.Name) ?? new NameValue(ctrl.Name); if (TrySetValue(ctrl, pair) && !list.Contains(pair)) list.Add(pair); From 2ebfc53ad45191a8f04dbb062bc52ab78456526b Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Dec 2017 01:34:58 -0800 Subject: [PATCH 030/191] Add RNG reseeding pick seed, randomize rom, share seed & settings (after form closes) to be able to replicate final ROM state from another session/PC. #129 --- pk3DS/Main.Designer.cs | 28 ++++++++++++++++++++++++---- pk3DS/Main.cs | 17 +++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index d3174719af..8a561a8ad9 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -90,6 +90,8 @@ private void InitializeComponent() this.B_Static = new System.Windows.Forms.Button(); this.Tab_Output = new System.Windows.Forms.TabPage(); this.L_Status = new System.Windows.Forms.Label(); + this.randomizationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.setInt32SeedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.TC_RomFS.SuspendLayout(); this.Tab_RomFS.SuspendLayout(); @@ -236,7 +238,8 @@ private void InitializeComponent() this.Menu_Restore, this.Menu_Misc, this.Menu_Rebuild, - this.Menu_SMDH}); + this.Menu_SMDH, + this.randomizationToolStripMenuItem}); this.Menu_Tools.Name = "Menu_Tools"; this.Menu_Tools.Size = new System.Drawing.Size(47, 20); this.Menu_Tools.Text = "Tools"; @@ -363,7 +366,7 @@ private void InitializeComponent() this.Menu_Language.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.CB_Lang}); this.Menu_Language.Name = "Menu_Language"; - this.Menu_Language.Size = new System.Drawing.Size(146, 22); + this.Menu_Language.Size = new System.Drawing.Size(152, 22); this.Menu_Language.Text = "Language"; // // CB_Lang @@ -389,14 +392,14 @@ private void InitializeComponent() this.Menu_About.Name = "Menu_About"; this.Menu_About.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_About.ShowShortcutKeys = false; - this.Menu_About.Size = new System.Drawing.Size(146, 22); + this.Menu_About.Size = new System.Drawing.Size(152, 22); this.Menu_About.Text = "A&bout pk3DS"; this.Menu_About.Click += new System.EventHandler(this.L_About_Click); // // Menu_GARCs // this.Menu_GARCs.Name = "Menu_GARCs"; - this.Menu_GARCs.Size = new System.Drawing.Size(146, 22); + this.Menu_GARCs.Size = new System.Drawing.Size(152, 22); this.Menu_GARCs.Text = "About GARCs"; this.Menu_GARCs.Click += new System.EventHandler(this.L_GARCInfo_Click); // @@ -728,6 +731,21 @@ private void InitializeComponent() this.L_Status.TabIndex = 14; this.L_Status.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // randomizationToolStripMenuItem + // + this.randomizationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.setInt32SeedToolStripMenuItem}); + this.randomizationToolStripMenuItem.Name = "randomizationToolStripMenuItem"; + this.randomizationToolStripMenuItem.Size = new System.Drawing.Size(184, 22); + this.randomizationToolStripMenuItem.Text = "Randomization"; + // + // setInt32SeedToolStripMenuItem + // + this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem"; + this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed"; + this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -824,5 +842,7 @@ private void InitializeComponent() private System.Windows.Forms.Button B_ShinyRate; private System.Windows.Forms.Button B_Royal; private System.Windows.Forms.Button B_TM; + private System.Windows.Forms.ToolStripMenuItem randomizationToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem setInt32SeedToolStripMenuItem; } } \ No newline at end of file diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 6d46bd68c0..7f3486be2e 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -1241,5 +1241,22 @@ private void resetStatus() } catch { } } + + private void setInt32SeedToolStripMenuItem_Click(object sender, EventArgs e) + { + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Reseed RNG?", "If yes, copy the 32 bit (not hex) integer seed to the clipboard before hitting Yes.")) + return; + + string val = string.Empty; + try { val = Clipboard.GetText(); } + catch { } + if (int.TryParse(val, out int seed)) + { + Util.ReseedRand(seed); + WinFormsUtil.Alert($"Reseeded RNG to seed: {seed}"); + return; + } + WinFormsUtil.Alert("Unable to set seed."); + } } } \ No newline at end of file From b43c08ca65e5d6bc77a318dd9d06aada6f1e44e5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Dec 2017 11:48:42 -0800 Subject: [PATCH 031/191] Add randsettings groupbox #263 --- pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs | 25 ++++++++++++++++----- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 2 ++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs index edbfe01c44..76617ca7e2 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs @@ -35,8 +35,10 @@ private void InitializeComponent() this.B_RTM = new System.Windows.Forms.Button(); this.CHK_RandomizeHM = new System.Windows.Forms.CheckBox(); this.CHK_RandomizeField = new System.Windows.Forms.CheckBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); ((System.ComponentModel.ISupportInitialize)(this.dgvTM)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvHM)).BeginInit(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // dgvTM @@ -73,7 +75,7 @@ private void InitializeComponent() this.dgvHM.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvHM.Location = new System.Drawing.Point(256, 25); this.dgvHM.Name = "dgvHM"; - this.dgvHM.Size = new System.Drawing.Size(240, 265); + this.dgvHM.Size = new System.Drawing.Size(240, 231); this.dgvHM.TabIndex = 3; // // L_HM @@ -98,7 +100,7 @@ private void InitializeComponent() // CHK_RandomizeHM // this.CHK_RandomizeHM.AutoSize = true; - this.CHK_RandomizeHM.Location = new System.Drawing.Point(256, 294); + this.CHK_RandomizeHM.Location = new System.Drawing.Point(13, 19); this.CHK_RandomizeHM.Name = "CHK_RandomizeHM"; this.CHK_RandomizeHM.Size = new System.Drawing.Size(104, 17); this.CHK_RandomizeHM.TabIndex = 280; @@ -108,20 +110,30 @@ private void InitializeComponent() // CHK_RandomizeField // this.CHK_RandomizeField.AutoSize = true; - this.CHK_RandomizeField.Location = new System.Drawing.Point(256, 311); + this.CHK_RandomizeField.Location = new System.Drawing.Point(13, 36); this.CHK_RandomizeField.Name = "CHK_RandomizeField"; this.CHK_RandomizeField.Size = new System.Drawing.Size(139, 17); this.CHK_RandomizeField.TabIndex = 281; this.CHK_RandomizeField.Text = "Randomize Field Moves"; this.CHK_RandomizeField.UseVisualStyleBackColor = true; // + // groupBox1 + // + this.groupBox1.Controls.Add(this.CHK_RandomizeHM); + this.groupBox1.Controls.Add(this.CHK_RandomizeField); + this.groupBox1.Location = new System.Drawing.Point(256, 262); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(240, 63); + this.groupBox1.TabIndex = 282; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Randomization Settings"; + // // TMHMEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(504, 332); - this.Controls.Add(this.CHK_RandomizeField); - this.Controls.Add(this.CHK_RandomizeHM); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_RTM); this.Controls.Add(this.L_HM); this.Controls.Add(this.dgvHM); @@ -136,6 +148,8 @@ private void InitializeComponent() this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); ((System.ComponentModel.ISupportInitialize)(this.dgvTM)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvHM)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -150,5 +164,6 @@ private void InitializeComponent() private System.Windows.Forms.Button B_RTM; private System.Windows.Forms.CheckBox CHK_RandomizeHM; private System.Windows.Forms.CheckBox CHK_RandomizeField; + private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index 09bf8335f4..87c7de3131 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -22,6 +22,7 @@ public TMHMEditor6() movelist[0] = ""; setupDGV(); getList(); + RandSettings.GetFormSettings(this, groupBox1.Controls); } private static readonly byte[] Signature = {0xD4, 0x00, 0xAE, 0x02, 0xAF, 0x02, 0xB0, 0x02}; @@ -152,6 +153,7 @@ private void formClosing(object sender, FormClosingEventArgs e) { setList(); File.WriteAllBytes(codebin, data); + RandSettings.SetFormSettings(this, groupBox1.Controls); } private void B_RandomTM_Click(object sender, EventArgs e) From 02d137de892863c6dc0c20764a8262ce7f7a43ad Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Dec 2017 11:53:27 -0800 Subject: [PATCH 032/191] Fix randsettings load closes #263 --- pk3DS/Tools/RandSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Tools/RandSettings.cs b/pk3DS/Tools/RandSettings.cs index 05a7ccc3f9..62ce7f39fa 100644 --- a/pk3DS/Tools/RandSettings.cs +++ b/pk3DS/Tools/RandSettings.cs @@ -16,7 +16,7 @@ public static void Load(string[] lines) int ctr = 0; while (ctr < lines.Length) { - string formname = lines[0]; + string formname = lines[ctr]; int end = Array.FindIndex(lines, ctr, string.IsNullOrWhiteSpace); var list = GetList(lines, ctr + 1, end - 1); Settings.Add(formname, list); From 1a7b07fa1b3b7a33f38c07e33d9521e62f79b138 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Thu, 21 Dec 2017 23:09:32 -0500 Subject: [PATCH 033/191] Add aura randomization --- .../Gen7/StaticEncounterEditor7.Designer.cs | 27 ++++++++++++++----- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 9 +++++++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 06734a2af5..91d334a1a3 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -148,6 +148,7 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); + this.CHK_RandomAura = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); @@ -1427,7 +1428,7 @@ private void InitializeComponent() // // B_ModifyLevel // - this.B_ModifyLevel.Location = new System.Drawing.Point(316, 111); + this.B_ModifyLevel.Location = new System.Drawing.Point(306, 101); this.B_ModifyLevel.Name = "B_ModifyLevel"; this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); this.B_ModifyLevel.TabIndex = 512; @@ -1443,7 +1444,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(267, 112); + this.NUD_LevelBoost.Location = new System.Drawing.Point(257, 102); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -1463,7 +1464,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(135, 113); + this.CHK_Level.Location = new System.Drawing.Point(125, 103); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 510; @@ -1472,7 +1473,7 @@ private void InitializeComponent() // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(202, 289); + this.B_RandAll.Location = new System.Drawing.Point(192, 289); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(122, 23); this.B_RandAll.TabIndex = 509; @@ -1482,6 +1483,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_RandomAura); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); @@ -1496,9 +1498,9 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(129, 135); + this.GB_Tweak.Location = new System.Drawing.Point(119, 125); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 145); + this.GB_Tweak.Size = new System.Drawing.Size(258, 160); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -1664,7 +1666,7 @@ private void InitializeComponent() // // B_Starters // - this.B_Starters.Location = new System.Drawing.Point(202, 318); + this.B_Starters.Location = new System.Drawing.Point(192, 318); this.B_Starters.Name = "B_Starters"; this.B_Starters.Size = new System.Drawing.Size(122, 23); this.B_Starters.TabIndex = 9; @@ -1692,6 +1694,16 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // + // CHK_RandomAura + // + this.CHK_RandomAura.AutoSize = true; + this.CHK_RandomAura.Location = new System.Drawing.Point(9, 139); + this.CHK_RandomAura.Name = "CHK_RandomAura"; + this.CHK_RandomAura.Size = new System.Drawing.Size(172, 17); + this.CHK_RandomAura.TabIndex = 300; + this.CHK_RandomAura.Text = "Random Totem Pokémon Aura"; + this.CHK_RandomAura.UseVisualStyleBackColor = true; + // // StaticEncounterEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1870,5 +1882,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_GNature; private System.Windows.Forms.Label L_GNature; private System.Windows.Forms.Button B_ModifyLevel; + private System.Windows.Forms.CheckBox CHK_RandomAura; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index e7bf085fc9..d3cb1123f7 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -511,6 +511,15 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RemoveShinyLock.Checked) t.ShinyLock = false; + + if (CHK_RandomAura.Checked) + { + if (t.Aura == 0) + continue; // don't apply aura to a pkm without it + + CB_Aura.Items.AddRange(aura.Take(0).ToArray()); // don't allow (None) as an option; temporarily remove + t.Aura = (int)(Util.rnd32() % CB_Aura.Items.Count); + } } foreach (EncounterTrade7 t in Trades) { From 2e0eafadaa7de1189463f2bab6747359b76881ed Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 21 Dec 2017 23:00:45 -0800 Subject: [PATCH 034/191] simplify aura rand --- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index d3cb1123f7..910039ab42 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -512,14 +512,8 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RemoveShinyLock.Checked) t.ShinyLock = false; - if (CHK_RandomAura.Checked) - { - if (t.Aura == 0) - continue; // don't apply aura to a pkm without it - - CB_Aura.Items.AddRange(aura.Take(0).ToArray()); // don't allow (None) as an option; temporarily remove - t.Aura = (int)(Util.rnd32() % CB_Aura.Items.Count); - } + if (CHK_RandomAura.Checked && t.Aura != 0) // don't apply aura to a pkm without it + t.Aura = Util.rand.Next(1, CB_Aura.Items.Count); // don't allow none } foreach (EncounterTrade7 t in Trades) { From 335a606f6438bdc3eb057bb941d8e2d1ee858fc9 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Fri, 22 Dec 2017 11:30:07 -0500 Subject: [PATCH 035/191] More StaticEncounterEditor7 additions --- .../Gen7/StaticEncounterEditor7.Designer.cs | 43 ++++++++++++------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 15 +++++-- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 91d334a1a3..22e660494f 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -131,6 +131,7 @@ private void InitializeComponent() this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RandomAura = new System.Windows.Forms.CheckBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); @@ -148,7 +149,7 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_RandomAura = new System.Windows.Forms.CheckBox(); + this.CHK_SpecialMove = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); @@ -1292,7 +1293,7 @@ private void InitializeComponent() // // L_TID // - this.L_TID.Location = new System.Drawing.Point(136, 117); + this.L_TID.Location = new System.Drawing.Point(136, 118); this.L_TID.Name = "L_TID"; this.L_TID.Size = new System.Drawing.Size(50, 23); this.L_TID.TabIndex = 26; @@ -1428,7 +1429,7 @@ private void InitializeComponent() // // B_ModifyLevel // - this.B_ModifyLevel.Location = new System.Drawing.Point(306, 101); + this.B_ModifyLevel.Location = new System.Drawing.Point(306, 89); this.B_ModifyLevel.Name = "B_ModifyLevel"; this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); this.B_ModifyLevel.TabIndex = 512; @@ -1444,7 +1445,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(257, 102); + this.NUD_LevelBoost.Location = new System.Drawing.Point(257, 90); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -1464,7 +1465,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(125, 103); + this.CHK_Level.Location = new System.Drawing.Point(125, 91); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 510; @@ -1483,6 +1484,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_SpecialMove); this.GB_Tweak.Controls.Add(this.CHK_RandomAura); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); @@ -1498,13 +1500,23 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(119, 125); + this.GB_Tweak.Location = new System.Drawing.Point(119, 113); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 160); + this.GB_Tweak.Size = new System.Drawing.Size(258, 173); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_RandomAura + // + this.CHK_RandomAura.AutoSize = true; + this.CHK_RandomAura.Location = new System.Drawing.Point(9, 139); + this.CHK_RandomAura.Name = "CHK_RandomAura"; + this.CHK_RandomAura.Size = new System.Drawing.Size(172, 17); + this.CHK_RandomAura.TabIndex = 300; + this.CHK_RandomAura.Text = "Random Totem Pokémon Aura"; + this.CHK_RandomAura.UseVisualStyleBackColor = true; + // // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; @@ -1694,15 +1706,15 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_RandomAura + // CHK_SpecialMove // - this.CHK_RandomAura.AutoSize = true; - this.CHK_RandomAura.Location = new System.Drawing.Point(9, 139); - this.CHK_RandomAura.Name = "CHK_RandomAura"; - this.CHK_RandomAura.Size = new System.Drawing.Size(172, 17); - this.CHK_RandomAura.TabIndex = 300; - this.CHK_RandomAura.Text = "Random Totem Pokémon Aura"; - this.CHK_RandomAura.UseVisualStyleBackColor = true; + this.CHK_SpecialMove.AutoSize = true; + this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 154); + this.CHK_SpecialMove.Name = "CHK_SpecialMove"; + this.CHK_SpecialMove.Size = new System.Drawing.Size(197, 17); + this.CHK_SpecialMove.TabIndex = 301; + this.CHK_SpecialMove.Text = "Random Gift Move for Gift Pokémon"; + this.CHK_SpecialMove.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -1883,5 +1895,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_GNature; private System.Windows.Forms.Button B_ModifyLevel; private System.Windows.Forms.CheckBox CHK_RandomAura; + private System.Windows.Forms.CheckBox CHK_SpecialMove; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 910039ab42..bc0e60f70f 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -108,6 +108,7 @@ public StaticEncounterEditor7(byte[][] infiles) CB_EMove3.Items.Add(s); CB_SpecialMove.Items.Add(s); } + foreach (string s in aura) CB_Aura.Items.Add(s); CB_GNature.Items.Add("Random"); CB_GNature.Items.AddRange(natures.Take(25).ToArray()); @@ -115,8 +116,6 @@ public StaticEncounterEditor7(byte[][] infiles) CB_ENature.Items.AddRange(natures.Take(25).ToArray()); CB_TNature.Items.AddRange(natures.Take(25).ToArray()); - foreach (string s in aura) CB_Aura.Items.Add(s); - getListBoxEntries(); LB_Gift.SelectedIndex = 0; LB_Encounter.SelectedIndex = 0; @@ -416,7 +415,7 @@ private SpeciesRandomizer getRandomizer() G4 = CHK_G4.Checked, G5 = CHK_G5.Checked, G6 = CHK_G6.Checked, - G7 = false, + G7 = CHK_G7.Checked, E = CHK_E.Checked, L = CHK_L.Checked, @@ -443,6 +442,7 @@ private void B_Starters_Click(object sender, EventArgs e) var t = Gifts[i]; t.Species = specrand.GetRandomSpecies(oldStarters[i]); t.Form = formrand.GetRandomForme(t.Species); + t.Nature = -1; // random if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -455,6 +455,9 @@ private void B_Starters_Click(object sender, EventArgs e) if (CHK_RemoveShinyLock.Checked) t.ShinyLock = false; // in case any user modifications locked the starters + + if (CHK_SpecialMove.Checked) + t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none } getListBoxEntries(); @@ -481,6 +484,7 @@ private void B_RandAll_Click(object sender, EventArgs e) var t = Gifts[i]; t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); + t.Nature = -1; // random if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -493,12 +497,16 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RemoveShinyLock.Checked) t.ShinyLock = false; + + if (CHK_SpecialMove.Checked) + t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none } foreach (EncounterStatic7 t in Encounters) { t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); + t.Nature = 0; // random if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -520,6 +528,7 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.TradeRequestSpecies = specrand.GetRandomSpecies(t.TradeRequestSpecies); + t.Nature = (int)(Util.rnd32() % CB_TNature.Items.Count); // randomly selected if (CHK_AllowMega.Checked) formrand.AllowMega = true; From 8940c8c3b888b1607fd031bf9a59d6eed03f6fc8 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 23 Dec 2017 14:13:01 -0500 Subject: [PATCH 036/191] Add nature (1,2,H) randomizer for static/gift/trade --- pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 352 +++++++++--------- pk3DS/Subforms/Gen6/GiftEditor6.cs | 31 +- .../Gen6/StaticEncounterEditor6.Designer.cs | 156 ++++---- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 31 +- .../Gen7/StaticEncounterEditor7.Designer.cs | 281 +++++++++----- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 38 +- 6 files changed, 534 insertions(+), 355 deletions(-) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index a1d3aed3c6..10818de666 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -40,19 +40,10 @@ private void InitializeComponent() this.NUD_Form = new System.Windows.Forms.NumericUpDown(); this.L_Form = new System.Windows.Forms.Label(); this.L_Nature = new System.Windows.Forms.Label(); - this.L_Ability = new System.Windows.Forms.Label(); - this.NUD_Ability = new System.Windows.Forms.NumericUpDown(); - this.L_Gender = new System.Windows.Forms.Label(); - this.NUD_Gender = new System.Windows.Forms.NumericUpDown(); this.B_RandAll = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.L_Mega = new System.Windows.Forms.Label(); - this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); - this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); - this.CHK_Level = new System.Windows.Forms.CheckBox(); + this.CB_Nature = new System.Windows.Forms.ComboBox(); this.GB_EIVs = new System.Windows.Forms.GroupBox(); this.L_HP = new System.Windows.Forms.Label(); this.NUD_IV3 = new System.Windows.Forms.NumericUpDown(); @@ -66,7 +57,9 @@ private void InitializeComponent() this.NUD_IV0 = new System.Windows.Forms.NumericUpDown(); this.L_ATK = new System.Windows.Forms.Label(); this.L_DEF = new System.Windows.Forms.Label(); - this.CB_Nature = new System.Windows.Forms.ComboBox(); + this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.B_ModifyLevel = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); @@ -81,15 +74,19 @@ private void InitializeComponent() this.CHK_G3 = new System.Windows.Forms.CheckBox(); this.CHK_G2 = new System.Windows.Forms.CheckBox(); this.CHK_G1 = new System.Windows.Forms.CheckBox(); - this.B_ModifyLevel = new System.Windows.Forms.Button(); + this.L_Mega = new System.Windows.Forms.Label(); + this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); + this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); + this.CHK_Level = new System.Windows.Forms.CheckBox(); + this.L_Gender = new System.Windows.Forms.Label(); + this.CB_Gender = new System.Windows.Forms.ComboBox(); + this.L_Ability = new System.Windows.Forms.Label(); + this.CB_Ability = new System.Windows.Forms.ComboBox(); + this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.GB_EIVs.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).BeginInit(); @@ -97,7 +94,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); + this.tabPage2.SuspendLayout(); this.GB_Tweak.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.SuspendLayout(); // // B_Cancel @@ -145,7 +144,7 @@ private void InitializeComponent() // CB_HeldItem // this.CB_HeldItem.FormattingEnabled = true; - this.CB_HeldItem.Location = new System.Drawing.Point(65, 118); + this.CB_HeldItem.Location = new System.Drawing.Point(65, 120); this.CB_HeldItem.Name = "CB_HeldItem"; this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); this.CB_HeldItem.TabIndex = 470; @@ -161,7 +160,7 @@ private void InitializeComponent() // // L_HeldItem // - this.L_HeldItem.Location = new System.Drawing.Point(9, 117); + this.L_HeldItem.Location = new System.Drawing.Point(9, 119); this.L_HeldItem.Name = "L_HeldItem"; this.L_HeldItem.Size = new System.Drawing.Size(55, 23); this.L_HeldItem.TabIndex = 478; @@ -207,60 +206,13 @@ private void InitializeComponent() // // L_Nature // - this.L_Nature.Location = new System.Drawing.Point(9, 140); + this.L_Nature.Location = new System.Drawing.Point(9, 142); this.L_Nature.Name = "L_Nature"; this.L_Nature.Size = new System.Drawing.Size(55, 23); this.L_Nature.TabIndex = 490; this.L_Nature.Text = "Nature:"; this.L_Nature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // L_Ability - // - this.L_Ability.Location = new System.Drawing.Point(9, 71); - this.L_Ability.Name = "L_Ability"; - this.L_Ability.Size = new System.Drawing.Size(55, 23); - this.L_Ability.TabIndex = 493; - this.L_Ability.Text = "Ability:"; - this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_Ability - // - this.NUD_Ability.Location = new System.Drawing.Point(65, 74); - this.NUD_Ability.Maximum = new decimal(new int[] { - 3, - 0, - 0, - 0}); - this.NUD_Ability.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_Ability.Name = "NUD_Ability"; - this.NUD_Ability.Size = new System.Drawing.Size(41, 20); - this.NUD_Ability.TabIndex = 492; - // - // L_Gender - // - this.L_Gender.Location = new System.Drawing.Point(9, 96); - this.L_Gender.Name = "L_Gender"; - this.L_Gender.Size = new System.Drawing.Size(55, 23); - this.L_Gender.TabIndex = 495; - this.L_Gender.Text = "Gender:"; - this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_Gender - // - this.NUD_Gender.Location = new System.Drawing.Point(65, 96); - this.NUD_Gender.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.NUD_Gender.Name = "NUD_Gender"; - this.NUD_Gender.Size = new System.Drawing.Size(41, 20); - this.NUD_Gender.TabIndex = 494; - // // B_RandAll // this.B_RandAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -284,14 +236,14 @@ private void InitializeComponent() // // tabPage1 // + this.tabPage1.Controls.Add(this.L_Gender); + this.tabPage1.Controls.Add(this.CB_Gender); + this.tabPage1.Controls.Add(this.L_Ability); + this.tabPage1.Controls.Add(this.CB_Ability); this.tabPage1.Controls.Add(this.CB_Nature); this.tabPage1.Controls.Add(this.GB_EIVs); this.tabPage1.Controls.Add(this.CHK_ShinyLock); - this.tabPage1.Controls.Add(this.L_Gender); this.tabPage1.Controls.Add(this.CB_Species); - this.tabPage1.Controls.Add(this.NUD_Gender); - this.tabPage1.Controls.Add(this.NUD_Ability); - this.tabPage1.Controls.Add(this.L_Ability); this.tabPage1.Controls.Add(this.L_Nature); this.tabPage1.Controls.Add(this.L_Species); this.tabPage1.Controls.Add(this.L_HeldItem); @@ -308,87 +260,13 @@ private void InitializeComponent() this.tabPage1.Text = "Editor"; this.tabPage1.UseVisualStyleBackColor = true; // - // CHK_ShinyLock - // - this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 165); - this.CHK_ShinyLock.Name = "CHK_ShinyLock"; - this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); - this.CHK_ShinyLock.TabIndex = 503; - this.CHK_ShinyLock.Text = "Shiny Lock"; - this.CHK_ShinyLock.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.B_ModifyLevel); - this.tabPage2.Controls.Add(this.GB_Tweak); - this.tabPage2.Controls.Add(this.L_Mega); - this.tabPage2.Controls.Add(this.CHK_ReplaceMega); - this.tabPage2.Controls.Add(this.NUD_LevelBoost); - this.tabPage2.Controls.Add(this.CHK_Level); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(269, 296); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Randomizer Options"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // L_Mega - // - this.L_Mega.Location = new System.Drawing.Point(24, 261); - this.L_Mega.Name = "L_Mega"; - this.L_Mega.Size = new System.Drawing.Size(113, 33); - this.L_Mega.TabIndex = 512; - this.L_Mega.Text = "XY - Lucario\nORAS - Latias/Latios"; - this.L_Mega.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // CHK_ReplaceMega - // - this.CHK_ReplaceMega.AutoSize = true; - this.CHK_ReplaceMega.Checked = true; - this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceMega.Location = new System.Drawing.Point(7, 247); - this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; - this.CHK_ReplaceMega.Size = new System.Drawing.Size(264, 17); - this.CHK_ReplaceMega.TabIndex = 511; - this.CHK_ReplaceMega.Text = "Replace Megas with Another Mega (via Held Item)"; - this.CHK_ReplaceMega.UseVisualStyleBackColor = true; - // - // NUD_LevelBoost - // - this.NUD_LevelBoost.DecimalPlaces = 2; - this.NUD_LevelBoost.Increment = new decimal(new int[] { - 5, - 0, - 0, - 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 6); - this.NUD_LevelBoost.Maximum = new decimal(new int[] { - 3, - 0, - 0, - 0}); - this.NUD_LevelBoost.Name = "NUD_LevelBoost"; - this.NUD_LevelBoost.Size = new System.Drawing.Size(43, 20); - this.NUD_LevelBoost.TabIndex = 303; - this.NUD_LevelBoost.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // CHK_Level + // CB_Nature // - this.CHK_Level.AutoSize = true; - this.CHK_Level.Checked = true; - this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(9, 7); - this.CHK_Level.Name = "CHK_Level"; - this.CHK_Level.Size = new System.Drawing.Size(130, 17); - this.CHK_Level.TabIndex = 302; - this.CHK_Level.Text = "Multiply PKM Level by"; - this.CHK_Level.UseVisualStyleBackColor = true; + this.CB_Nature.FormattingEnabled = true; + this.CB_Nature.Location = new System.Drawing.Point(65, 143); + this.CB_Nature.Name = "CB_Nature"; + this.CB_Nature.Size = new System.Drawing.Size(121, 21); + this.CB_Nature.TabIndex = 505; // // GB_EIVs // @@ -404,7 +282,7 @@ private void InitializeComponent() this.GB_EIVs.Controls.Add(this.NUD_IV0); this.GB_EIVs.Controls.Add(this.L_ATK); this.GB_EIVs.Controls.Add(this.L_DEF); - this.GB_EIVs.Location = new System.Drawing.Point(12, 179); + this.GB_EIVs.Location = new System.Drawing.Point(12, 181); this.GB_EIVs.Name = "GB_EIVs"; this.GB_EIVs.Size = new System.Drawing.Size(148, 112); this.GB_EIVs.TabIndex = 504; @@ -597,16 +475,45 @@ private void InitializeComponent() this.L_DEF.Text = "Def:"; this.L_DEF.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // CB_Nature + // CHK_ShinyLock // - this.CB_Nature.FormattingEnabled = true; - this.CB_Nature.Location = new System.Drawing.Point(65, 141); - this.CB_Nature.Name = "CB_Nature"; - this.CB_Nature.Size = new System.Drawing.Size(121, 21); - this.CB_Nature.TabIndex = 505; + this.CHK_ShinyLock.AutoSize = true; + this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 167); + this.CHK_ShinyLock.Name = "CHK_ShinyLock"; + this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); + this.CHK_ShinyLock.TabIndex = 503; + this.CHK_ShinyLock.Text = "Shiny Lock"; + this.CHK_ShinyLock.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.B_ModifyLevel); + this.tabPage2.Controls.Add(this.GB_Tweak); + this.tabPage2.Controls.Add(this.L_Mega); + this.tabPage2.Controls.Add(this.CHK_ReplaceMega); + this.tabPage2.Controls.Add(this.NUD_LevelBoost); + this.tabPage2.Controls.Add(this.CHK_Level); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(269, 296); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Randomizer Options"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // B_ModifyLevel + // + this.B_ModifyLevel.Location = new System.Drawing.Point(189, 5); + this.B_ModifyLevel.Name = "B_ModifyLevel"; + this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); + this.B_ModifyLevel.TabIndex = 514; + this.B_ModifyLevel.Text = "× Current"; + this.B_ModifyLevel.UseVisualStyleBackColor = true; + this.B_ModifyLevel.Click += new System.EventHandler(this.ModifyLevels); // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); @@ -620,9 +527,9 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(5, 83); + this.GB_Tweak.Location = new System.Drawing.Point(5, 71); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 129); + this.GB_Tweak.Size = new System.Drawing.Size(258, 147); this.GB_Tweak.TabIndex = 513; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -630,7 +537,7 @@ private void InitializeComponent() // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 94); this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); this.CHK_RemoveShinyLock.TabIndex = 297; @@ -640,7 +547,7 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 94); + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 126); this.CHK_AllowMega.Name = "CHK_AllowMega"; this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); this.CHK_AllowMega.TabIndex = 296; @@ -774,15 +681,105 @@ private void InitializeComponent() this.CHK_G1.Text = "Gen 1"; this.CHK_G1.UseVisualStyleBackColor = true; // - // B_ModifyLevel + // L_Mega // - this.B_ModifyLevel.Location = new System.Drawing.Point(189, 5); - this.B_ModifyLevel.Name = "B_ModifyLevel"; - this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); - this.B_ModifyLevel.TabIndex = 514; - this.B_ModifyLevel.Text = "× Current"; - this.B_ModifyLevel.UseVisualStyleBackColor = true; - this.B_ModifyLevel.Click += new System.EventHandler(this.ModifyLevels); + this.L_Mega.Location = new System.Drawing.Point(24, 261); + this.L_Mega.Name = "L_Mega"; + this.L_Mega.Size = new System.Drawing.Size(113, 33); + this.L_Mega.TabIndex = 512; + this.L_Mega.Text = "XY - Lucario\nORAS - Latias/Latios"; + this.L_Mega.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // CHK_ReplaceMega + // + this.CHK_ReplaceMega.AutoSize = true; + this.CHK_ReplaceMega.Checked = true; + this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceMega.Location = new System.Drawing.Point(7, 247); + this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; + this.CHK_ReplaceMega.Size = new System.Drawing.Size(264, 17); + this.CHK_ReplaceMega.TabIndex = 511; + this.CHK_ReplaceMega.Text = "Replace Megas with Another Mega (via Held Item)"; + this.CHK_ReplaceMega.UseVisualStyleBackColor = true; + // + // NUD_LevelBoost + // + this.NUD_LevelBoost.DecimalPlaces = 2; + this.NUD_LevelBoost.Increment = new decimal(new int[] { + 5, + 0, + 0, + 131072}); + this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 6); + this.NUD_LevelBoost.Maximum = new decimal(new int[] { + 3, + 0, + 0, + 0}); + this.NUD_LevelBoost.Name = "NUD_LevelBoost"; + this.NUD_LevelBoost.Size = new System.Drawing.Size(43, 20); + this.NUD_LevelBoost.TabIndex = 303; + this.NUD_LevelBoost.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // CHK_Level + // + this.CHK_Level.AutoSize = true; + this.CHK_Level.Checked = true; + this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Level.Location = new System.Drawing.Point(9, 7); + this.CHK_Level.Name = "CHK_Level"; + this.CHK_Level.Size = new System.Drawing.Size(130, 17); + this.CHK_Level.TabIndex = 302; + this.CHK_Level.Text = "Multiply PKM Level by"; + this.CHK_Level.UseVisualStyleBackColor = true; + // + // L_Gender + // + this.L_Gender.Location = new System.Drawing.Point(9, 96); + this.L_Gender.Name = "L_Gender"; + this.L_Gender.Size = new System.Drawing.Size(55, 23); + this.L_Gender.TabIndex = 532; + this.L_Gender.Text = "Gender:"; + this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Gender + // + this.CB_Gender.FormattingEnabled = true; + this.CB_Gender.Location = new System.Drawing.Point(65, 97); + this.CB_Gender.Name = "CB_Gender"; + this.CB_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Gender.TabIndex = 531; + // + // L_Ability + // + this.L_Ability.Location = new System.Drawing.Point(9, 73); + this.L_Ability.Name = "L_Ability"; + this.L_Ability.Size = new System.Drawing.Size(55, 23); + this.L_Ability.TabIndex = 530; + this.L_Ability.Text = "Ability:"; + this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Ability + // + this.CB_Ability.FormattingEnabled = true; + this.CB_Ability.Location = new System.Drawing.Point(65, 74); + this.CB_Ability.Name = "CB_Ability"; + this.CB_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Ability.TabIndex = 529; + // + // CHK_RandomAbility + // + this.CHK_RandomAbility.AutoSize = true; + this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 110); + this.CHK_RandomAbility.Name = "CHK_RandomAbility"; + this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); + this.CHK_RandomAbility.TabIndex = 298; + this.CHK_RandomAbility.Text = "Random Abilities (1, 2, or Hidden)"; + this.CHK_RandomAbility.UseVisualStyleBackColor = true; // // GiftEditor6 // @@ -803,14 +800,9 @@ private void InitializeComponent() this.Text = "Gift Editor"; ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).EndInit(); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.GB_EIVs.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV4)).EndInit(); @@ -818,8 +810,11 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_IV2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).EndInit(); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.ResumeLayout(false); } @@ -838,10 +833,6 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_Form; private System.Windows.Forms.Label L_Form; private System.Windows.Forms.Label L_Nature; - private System.Windows.Forms.Label L_Ability; - private System.Windows.Forms.NumericUpDown NUD_Ability; - private System.Windows.Forms.Label L_Gender; - private System.Windows.Forms.NumericUpDown NUD_Gender; private System.Windows.Forms.Button B_RandAll; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; @@ -880,5 +871,10 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G2; private System.Windows.Forms.CheckBox CHK_G1; private System.Windows.Forms.Button B_ModifyLevel; + private System.Windows.Forms.Label L_Gender; + private System.Windows.Forms.ComboBox CB_Gender; + private System.Windows.Forms.Label L_Ability; + private System.Windows.Forms.ComboBox CB_Ability; + private System.Windows.Forms.CheckBox CHK_RandomAbility; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 8640b9fbac..def62cdcec 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -59,6 +59,20 @@ public static Dictionary GetMegaDictionary(GameConfig config) private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private readonly string[] natureslist = Main.Config.getText(TextName.Natures); private readonly Dictionary MegaDictionary; + + private readonly string[] ability = + { + "Random (1 or 2)", + "Ability 1", + "Ability 2", + "Hidden Ability", + }; + private readonly string[] gender = + { + "Random/Genderless", + "Male", + "Female", + }; private void B_Save_Click(object sender, EventArgs e) { saveEntry(); @@ -80,6 +94,10 @@ private void loadData() GiftData[i] = new EncounterGift6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray(), Main.Config.ORAS); LB_Gifts.Items.Add($"{i:00} - {specieslist[GiftData[i].Species]}"); } + + foreach (var s in ability) CB_Ability.Items.Add(s); + foreach (var s in gender) CB_Gender.Items.Add(s); + loaded = true; LB_Gifts.SelectedIndex = 0; } @@ -143,8 +161,8 @@ private void loadEntry() NUD_Level.Value = GiftData[entry].Level; NUD_Form.Value = GiftData[entry].Form; CB_Nature.SelectedIndex = GiftData[entry].Nature + 1; - NUD_Ability.Value = GiftData[entry].Ability; - NUD_Gender.Value = GiftData[entry].Gender; + CB_Ability.SelectedIndex = GiftData[entry].Ability + 1; + CB_Gender.SelectedIndex = GiftData[entry].Gender; CHK_ShinyLock.Checked = GiftData[entry].ShinyLock; NUD_IV0.Value = GiftData[entry].IVs[0]; @@ -166,8 +184,8 @@ private void saveEntry() GiftData[entry].Level = (byte)NUD_Level.Value; GiftData[entry].Form = (byte)NUD_Form.Value; GiftData[entry].Nature = (sbyte)(CB_Nature.SelectedIndex - 1); - GiftData[entry].Ability = (sbyte)NUD_Ability.Value; - GiftData[entry].Gender = (sbyte)NUD_Gender.Value; + GiftData[entry].Ability = (sbyte)(CB_Ability.SelectedIndex - 1); + GiftData[entry].Gender = (sbyte)CB_Gender.SelectedIndex; GiftData[entry].ShinyLock = CHK_ShinyLock.Checked; GiftData[entry].IVs[0] = (sbyte)NUD_IV0.Value; @@ -226,7 +244,7 @@ private void B_RandAll_Click(object sender, EventArgs e) CB_Species.SelectedIndex = species; NUD_Form.Value = formrand.GetRandomForme(species); - NUD_Gender.Value = 0; // random + CB_Gender.SelectedIndex = 0; // random CB_Nature.SelectedIndex = 0; // random if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex)) && NUD_Form.Value > 0) @@ -237,6 +255,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_Level.Checked) NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + + if (CHK_RandomAbility.Checked) + CB_Ability.SelectedIndex = (Util.rand.Next(1, 4)); // 1, 2 , or H } WinFormsUtil.Alert("Randomized all Gift Pokémon according to specification!"); } diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index f53a3d60f8..5b0835db6a 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -34,12 +34,13 @@ private void InitializeComponent() this.B_RandAll = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); this.L_Gender = new System.Windows.Forms.Label(); - this.CB_Species = new System.Windows.Forms.ComboBox(); - this.NUD_Gender = new System.Windows.Forms.NumericUpDown(); - this.NUD_Ability = new System.Windows.Forms.NumericUpDown(); + this.CB_Gender = new System.Windows.Forms.ComboBox(); this.L_Ability = new System.Windows.Forms.Label(); + this.CB_Ability = new System.Windows.Forms.ComboBox(); + this.CHK_IV3 = new System.Windows.Forms.CheckBox(); + this.CHK_ShinyLock = new System.Windows.Forms.CheckBox(); + this.CB_Species = new System.Windows.Forms.ComboBox(); this.L_Species = new System.Windows.Forms.Label(); this.L_HeldItem = new System.Windows.Forms.Label(); this.NUD_Level = new System.Windows.Forms.NumericUpDown(); @@ -50,6 +51,7 @@ private void InitializeComponent() this.tabPage2 = new System.Windows.Forms.TabPage(); this.B_ModifyLevel = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); @@ -65,11 +67,8 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_IV3 = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); this.tabPage2.SuspendLayout(); @@ -133,13 +132,13 @@ private void InitializeComponent() // // tabPage1 // + this.tabPage1.Controls.Add(this.L_Gender); + this.tabPage1.Controls.Add(this.CB_Gender); + this.tabPage1.Controls.Add(this.L_Ability); + this.tabPage1.Controls.Add(this.CB_Ability); this.tabPage1.Controls.Add(this.CHK_IV3); this.tabPage1.Controls.Add(this.CHK_ShinyLock); - this.tabPage1.Controls.Add(this.L_Gender); this.tabPage1.Controls.Add(this.CB_Species); - this.tabPage1.Controls.Add(this.NUD_Gender); - this.tabPage1.Controls.Add(this.NUD_Ability); - this.tabPage1.Controls.Add(this.L_Ability); this.tabPage1.Controls.Add(this.L_Species); this.tabPage1.Controls.Add(this.L_HeldItem); this.tabPage1.Controls.Add(this.NUD_Level); @@ -155,71 +154,68 @@ private void InitializeComponent() this.tabPage1.Text = "Editor"; this.tabPage1.UseVisualStyleBackColor = true; // - // CHK_ShinyLock - // - this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 141); - this.CHK_ShinyLock.Name = "CHK_ShinyLock"; - this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); - this.CHK_ShinyLock.TabIndex = 519; - this.CHK_ShinyLock.Text = "Shiny Lock"; - this.CHK_ShinyLock.UseVisualStyleBackColor = true; - // // L_Gender // this.L_Gender.Location = new System.Drawing.Point(9, 96); this.L_Gender.Name = "L_Gender"; this.L_Gender.Size = new System.Drawing.Size(55, 23); - this.L_Gender.TabIndex = 518; + this.L_Gender.TabIndex = 526; this.L_Gender.Text = "Gender:"; this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // CB_Species + // CB_Gender // - this.CB_Species.FormattingEnabled = true; - this.CB_Species.Location = new System.Drawing.Point(65, 7); - this.CB_Species.Name = "CB_Species"; - this.CB_Species.Size = new System.Drawing.Size(121, 21); - this.CB_Species.TabIndex = 506; - // - // NUD_Gender - // - this.NUD_Gender.Location = new System.Drawing.Point(65, 96); - this.NUD_Gender.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.NUD_Gender.Name = "NUD_Gender"; - this.NUD_Gender.Size = new System.Drawing.Size(41, 20); - this.NUD_Gender.TabIndex = 517; - // - // NUD_Ability - // - this.NUD_Ability.Location = new System.Drawing.Point(65, 74); - this.NUD_Ability.Maximum = new decimal(new int[] { - 3, - 0, - 0, - 0}); - this.NUD_Ability.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NUD_Ability.Name = "NUD_Ability"; - this.NUD_Ability.Size = new System.Drawing.Size(41, 20); - this.NUD_Ability.TabIndex = 515; + this.CB_Gender.FormattingEnabled = true; + this.CB_Gender.Location = new System.Drawing.Point(65, 97); + this.CB_Gender.Name = "CB_Gender"; + this.CB_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Gender.TabIndex = 525; // // L_Ability // - this.L_Ability.Location = new System.Drawing.Point(9, 71); + this.L_Ability.Location = new System.Drawing.Point(9, 73); this.L_Ability.Name = "L_Ability"; this.L_Ability.Size = new System.Drawing.Size(55, 23); - this.L_Ability.TabIndex = 516; + this.L_Ability.TabIndex = 524; this.L_Ability.Text = "Ability:"; this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // CB_Ability + // + this.CB_Ability.FormattingEnabled = true; + this.CB_Ability.Location = new System.Drawing.Point(65, 74); + this.CB_Ability.Name = "CB_Ability"; + this.CB_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Ability.TabIndex = 523; + // + // CHK_IV3 + // + this.CHK_IV3.AutoSize = true; + this.CHK_IV3.Location = new System.Drawing.Point(65, 158); + this.CHK_IV3.Name = "CHK_IV3"; + this.CHK_IV3.Size = new System.Drawing.Size(42, 17); + this.CHK_IV3.TabIndex = 522; + this.CHK_IV3.Text = "3IV"; + this.CHK_IV3.UseVisualStyleBackColor = true; + // + // CHK_ShinyLock + // + this.CHK_ShinyLock.AutoSize = true; + this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 143); + this.CHK_ShinyLock.Name = "CHK_ShinyLock"; + this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); + this.CHK_ShinyLock.TabIndex = 519; + this.CHK_ShinyLock.Text = "Shiny Lock"; + this.CHK_ShinyLock.UseVisualStyleBackColor = true; + // + // CB_Species + // + this.CB_Species.FormattingEnabled = true; + this.CB_Species.Location = new System.Drawing.Point(65, 7); + this.CB_Species.Name = "CB_Species"; + this.CB_Species.Size = new System.Drawing.Size(121, 21); + this.CB_Species.TabIndex = 506; + // // L_Species // this.L_Species.Location = new System.Drawing.Point(9, 6); @@ -231,7 +227,7 @@ private void InitializeComponent() // // L_HeldItem // - this.L_HeldItem.Location = new System.Drawing.Point(9, 117); + this.L_HeldItem.Location = new System.Drawing.Point(9, 119); this.L_HeldItem.Name = "L_HeldItem"; this.L_HeldItem.Size = new System.Drawing.Size(55, 23); this.L_HeldItem.TabIndex = 509; @@ -271,7 +267,7 @@ private void InitializeComponent() // CB_HeldItem // this.CB_HeldItem.FormattingEnabled = true; - this.CB_HeldItem.Location = new System.Drawing.Point(65, 118); + this.CB_HeldItem.Location = new System.Drawing.Point(65, 120); this.CB_HeldItem.Name = "CB_HeldItem"; this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); this.CB_HeldItem.TabIndex = 507; @@ -309,6 +305,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); @@ -324,15 +321,25 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(5, 83); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 129); + this.GB_Tweak.Size = new System.Drawing.Size(258, 147); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_RandomAbility + // + this.CHK_RandomAbility.AutoSize = true; + this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 109); + this.CHK_RandomAbility.Name = "CHK_RandomAbility"; + this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); + this.CHK_RandomAbility.TabIndex = 303; + this.CHK_RandomAbility.Text = "Random Abilities (1, 2, or Hidden)"; + this.CHK_RandomAbility.UseVisualStyleBackColor = true; + // // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 94); this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); this.CHK_RemoveShinyLock.TabIndex = 297; @@ -342,7 +349,7 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 94); + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 125); this.CHK_AllowMega.Name = "CHK_AllowMega"; this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); this.CHK_AllowMega.TabIndex = 296; @@ -511,16 +518,6 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // CHK_IV3 - // - this.CHK_IV3.AutoSize = true; - this.CHK_IV3.Location = new System.Drawing.Point(65, 156); - this.CHK_IV3.Name = "CHK_IV3"; - this.CHK_IV3.Size = new System.Drawing.Size(42, 17); - this.CHK_IV3.TabIndex = 522; - this.CHK_IV3.Text = "3IV"; - this.CHK_IV3.UseVisualStyleBackColor = true; - // // StaticEncounterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -541,8 +538,6 @@ private void InitializeComponent() this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).EndInit(); this.tabPage2.ResumeLayout(false); @@ -580,11 +575,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_AllowMega; private System.Windows.Forms.CheckBox CHK_RemoveShinyLock; private System.Windows.Forms.CheckBox CHK_ShinyLock; - private System.Windows.Forms.Label L_Gender; private System.Windows.Forms.ComboBox CB_Species; - private System.Windows.Forms.NumericUpDown NUD_Gender; - private System.Windows.Forms.NumericUpDown NUD_Ability; - private System.Windows.Forms.Label L_Ability; private System.Windows.Forms.Label L_Species; private System.Windows.Forms.Label L_HeldItem; private System.Windows.Forms.NumericUpDown NUD_Level; @@ -594,5 +585,10 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_Form; private System.Windows.Forms.Button B_ModifyLevel; private System.Windows.Forms.CheckBox CHK_IV3; + private System.Windows.Forms.Label L_Gender; + private System.Windows.Forms.ComboBox CB_Gender; + private System.Windows.Forms.Label L_Ability; + private System.Windows.Forms.ComboBox CB_Ability; + private System.Windows.Forms.CheckBox CHK_RandomAbility; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 8c6a9a2785..9d6bcacb81 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -42,6 +42,20 @@ public StaticEncounterEditor6() private EncounterStatic6[] EncounterData; private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); + + private readonly string[] ability = + { + "Random (1 or 2)", + "Ability 1", + "Ability 2", + "Hidden Ability", + }; + private readonly string[] gender = + { + "Random/Genderless", + "Male", + "Female", + }; private void B_Save_Click(object sender, EventArgs e) { saveEntry(); @@ -63,6 +77,10 @@ private void loadData() EncounterData[i] = new EncounterStatic6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray()); LB_Encounters.Items.Add($"{i:00} - {specieslist[EncounterData[i].Species]}"); } + + foreach (var s in ability) CB_Ability.Items.Add(s); + foreach (var s in gender) CB_Gender.Items.Add(s); + loaded = true; LB_Encounters.SelectedIndex = 0; } @@ -99,8 +117,8 @@ private void loadEntry() CB_HeldItem.SelectedIndex = EncounterData[entry].HeldItem; NUD_Level.Value = EncounterData[entry].Level; NUD_Form.Value = EncounterData[entry].Form; - NUD_Ability.Value = EncounterData[entry].Ability; - NUD_Gender.Value = EncounterData[entry].Gender; + CB_Ability.SelectedIndex = EncounterData[entry].Ability; + CB_Gender.SelectedIndex = EncounterData[entry].Gender; CHK_ShinyLock.Checked = EncounterData[entry].ShinyLock; CHK_IV3.Checked = EncounterData[entry].IV3; @@ -115,8 +133,8 @@ private void saveEntry() EncounterData[entry].HeldItem = CB_HeldItem.SelectedIndex; EncounterData[entry].Level = (byte)NUD_Level.Value; EncounterData[entry].Form = (byte)NUD_Form.Value; - EncounterData[entry].Ability = (sbyte)NUD_Ability.Value; - EncounterData[entry].Gender = (sbyte)NUD_Gender.Value; + EncounterData[entry].Ability = (sbyte)CB_Ability.SelectedIndex; + EncounterData[entry].Gender = (sbyte)CB_Gender.SelectedIndex; EncounterData[entry].ShinyLock = CHK_ShinyLock.Checked; EncounterData[entry].IV3 = CHK_IV3.Checked; } @@ -151,7 +169,7 @@ private void B_RandAll_Click(object sender, EventArgs e) species = specrand.GetRandomSpecies(species); CB_Species.SelectedIndex = species; NUD_Form.Value = formrand.GetRandomForme(species); - NUD_Gender.Value = 0; // random + CB_Gender.SelectedIndex = 0; // random if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -164,6 +182,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RemoveShinyLock.Checked) CHK_ShinyLock.Checked = false; + + if (CHK_RandomAbility.Checked) + CB_Ability.SelectedIndex = (Util.rand.Next(1, 4)); // 1, 2 , or H } WinFormsUtil.Alert("Randomized all Static Encounters according to specification!"); } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 22e660494f..2d5a420968 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -30,14 +30,14 @@ private void InitializeComponent() { this.TC_Tabs = new System.Windows.Forms.TabControl(); this.Tab_Gifts = new System.Windows.Forms.TabPage(); + this.CB_GAbility = new System.Windows.Forms.ComboBox(); + this.L_GAbility = new System.Windows.Forms.Label(); this.CB_GNature = new System.Windows.Forms.ComboBox(); this.L_GNature = new System.Windows.Forms.Label(); this.CHK_IsEgg = new System.Windows.Forms.CheckBox(); this.CHK_GIV3 = new System.Windows.Forms.CheckBox(); this.CB_SpecialMove = new System.Windows.Forms.ComboBox(); this.L_SpecialMove = new System.Windows.Forms.Label(); - this.L_GGender = new System.Windows.Forms.Label(); - this.NUD_GGender = new System.Windows.Forms.NumericUpDown(); this.CHK_G_Lock = new System.Windows.Forms.CheckBox(); this.CB_GHeldItem = new System.Windows.Forms.ComboBox(); this.L_GHeldItem = new System.Windows.Forms.Label(); @@ -49,6 +49,8 @@ private void InitializeComponent() this.NUD_GLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); + this.CB_EAbility = new System.Windows.Forms.ComboBox(); + this.L_EAbility = new System.Windows.Forms.Label(); this.CHK_EIV3 = new System.Windows.Forms.CheckBox(); this.CB_ENature = new System.Windows.Forms.ComboBox(); this.L_ENature = new System.Windows.Forms.Label(); @@ -96,6 +98,8 @@ private void InitializeComponent() this.NUD_ELevel = new System.Windows.Forms.NumericUpDown(); this.LB_Encounter = new System.Windows.Forms.ListBox(); this.Tab_Trades = new System.Windows.Forms.TabPage(); + this.CB_TAbility = new System.Windows.Forms.ComboBox(); + this.L_TAbility = new System.Windows.Forms.Label(); this.CB_TNature = new System.Windows.Forms.ComboBox(); this.L_TNature = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); @@ -131,6 +135,8 @@ private void InitializeComponent() this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); + this.CHK_SpecialMove = new System.Windows.Forms.CheckBox(); this.CHK_RandomAura = new System.Windows.Forms.CheckBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); @@ -149,10 +155,12 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_SpecialMove = new System.Windows.Forms.CheckBox(); + this.L_EGender = new System.Windows.Forms.Label(); + this.NUD_EGender = new System.Windows.Forms.NumericUpDown(); + this.L_TGender = new System.Windows.Forms.Label(); + this.NUD_TGender = new System.Windows.Forms.NumericUpDown(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).BeginInit(); this.Tab_Encounters.SuspendLayout(); @@ -187,6 +195,8 @@ private void InitializeComponent() this.Tab_Randomizer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.GB_Tweak.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).BeginInit(); this.SuspendLayout(); // // TC_Tabs @@ -201,19 +211,19 @@ private void InitializeComponent() this.TC_Tabs.Location = new System.Drawing.Point(12, 12); this.TC_Tabs.Name = "TC_Tabs"; this.TC_Tabs.SelectedIndex = 0; - this.TC_Tabs.Size = new System.Drawing.Size(506, 463); + this.TC_Tabs.Size = new System.Drawing.Size(506, 502); this.TC_Tabs.TabIndex = 0; // // Tab_Gifts // + this.Tab_Gifts.Controls.Add(this.CB_GAbility); + this.Tab_Gifts.Controls.Add(this.L_GAbility); this.Tab_Gifts.Controls.Add(this.CB_GNature); this.Tab_Gifts.Controls.Add(this.L_GNature); this.Tab_Gifts.Controls.Add(this.CHK_IsEgg); this.Tab_Gifts.Controls.Add(this.CHK_GIV3); this.Tab_Gifts.Controls.Add(this.CB_SpecialMove); this.Tab_Gifts.Controls.Add(this.L_SpecialMove); - this.Tab_Gifts.Controls.Add(this.L_GGender); - this.Tab_Gifts.Controls.Add(this.NUD_GGender); this.Tab_Gifts.Controls.Add(this.CHK_G_Lock); this.Tab_Gifts.Controls.Add(this.CB_GHeldItem); this.Tab_Gifts.Controls.Add(this.L_GHeldItem); @@ -226,22 +236,39 @@ private void InitializeComponent() this.Tab_Gifts.Controls.Add(this.LB_Gift); this.Tab_Gifts.Location = new System.Drawing.Point(4, 22); this.Tab_Gifts.Name = "Tab_Gifts"; - this.Tab_Gifts.Size = new System.Drawing.Size(498, 437); + this.Tab_Gifts.Size = new System.Drawing.Size(498, 476); this.Tab_Gifts.TabIndex = 2; this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; // + // CB_GAbility + // + this.CB_GAbility.FormattingEnabled = true; + this.CB_GAbility.Location = new System.Drawing.Point(187, 74); + this.CB_GAbility.Name = "CB_GAbility"; + this.CB_GAbility.Size = new System.Drawing.Size(121, 21); + this.CB_GAbility.TabIndex = 513; + // + // L_GAbility + // + this.L_GAbility.Location = new System.Drawing.Point(131, 72); + this.L_GAbility.Name = "L_GAbility"; + this.L_GAbility.Size = new System.Drawing.Size(55, 23); + this.L_GAbility.TabIndex = 512; + this.L_GAbility.Text = "Ability:"; + this.L_GAbility.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // CB_GNature // this.CB_GNature.FormattingEnabled = true; - this.CB_GNature.Location = new System.Drawing.Point(187, 119); + this.CB_GNature.Location = new System.Drawing.Point(187, 120); this.CB_GNature.Name = "CB_GNature"; this.CB_GNature.Size = new System.Drawing.Size(121, 21); this.CB_GNature.TabIndex = 511; // // L_GNature // - this.L_GNature.Location = new System.Drawing.Point(131, 117); + this.L_GNature.Location = new System.Drawing.Point(131, 118); this.L_GNature.Name = "L_GNature"; this.L_GNature.Size = new System.Drawing.Size(55, 23); this.L_GNature.TabIndex = 510; @@ -251,7 +278,7 @@ private void InitializeComponent() // CHK_IsEgg // this.CHK_IsEgg.AutoSize = true; - this.CHK_IsEgg.Location = new System.Drawing.Point(187, 197); + this.CHK_IsEgg.Location = new System.Drawing.Point(187, 198); this.CHK_IsEgg.Name = "CHK_IsEgg"; this.CHK_IsEgg.Size = new System.Drawing.Size(56, 17); this.CHK_IsEgg.TabIndex = 509; @@ -261,7 +288,7 @@ private void InitializeComponent() // CHK_GIV3 // this.CHK_GIV3.AutoSize = true; - this.CHK_GIV3.Location = new System.Drawing.Point(187, 182); + this.CHK_GIV3.Location = new System.Drawing.Point(187, 183); this.CHK_GIV3.Name = "CHK_GIV3"; this.CHK_GIV3.Size = new System.Drawing.Size(42, 17); this.CHK_GIV3.TabIndex = 508; @@ -271,45 +298,24 @@ private void InitializeComponent() // CB_SpecialMove // this.CB_SpecialMove.FormattingEnabled = true; - this.CB_SpecialMove.Location = new System.Drawing.Point(187, 142); + this.CB_SpecialMove.Location = new System.Drawing.Point(187, 143); this.CB_SpecialMove.Name = "CB_SpecialMove"; this.CB_SpecialMove.Size = new System.Drawing.Size(121, 21); this.CB_SpecialMove.TabIndex = 507; // // L_SpecialMove // - this.L_SpecialMove.Location = new System.Drawing.Point(121, 140); + this.L_SpecialMove.Location = new System.Drawing.Point(121, 141); this.L_SpecialMove.Name = "L_SpecialMove"; this.L_SpecialMove.Size = new System.Drawing.Size(65, 23); this.L_SpecialMove.TabIndex = 506; this.L_SpecialMove.Text = "Gift Move:"; this.L_SpecialMove.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // L_GGender - // - this.L_GGender.Location = new System.Drawing.Point(131, 71); - this.L_GGender.Name = "L_GGender"; - this.L_GGender.Size = new System.Drawing.Size(55, 23); - this.L_GGender.TabIndex = 21; - this.L_GGender.Text = "Gender:"; - this.L_GGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_GGender - // - this.NUD_GGender.Location = new System.Drawing.Point(187, 74); - this.NUD_GGender.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.NUD_GGender.Name = "NUD_GGender"; - this.NUD_GGender.Size = new System.Drawing.Size(34, 20); - this.NUD_GGender.TabIndex = 20; - // // CHK_G_Lock // this.CHK_G_Lock.AutoSize = true; - this.CHK_G_Lock.Location = new System.Drawing.Point(187, 167); + this.CHK_G_Lock.Location = new System.Drawing.Point(187, 168); this.CHK_G_Lock.Name = "CHK_G_Lock"; this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); this.CHK_G_Lock.TabIndex = 19; @@ -319,14 +325,14 @@ private void InitializeComponent() // CB_GHeldItem // this.CB_GHeldItem.FormattingEnabled = true; - this.CB_GHeldItem.Location = new System.Drawing.Point(187, 96); + this.CB_GHeldItem.Location = new System.Drawing.Point(187, 97); this.CB_GHeldItem.Name = "CB_GHeldItem"; this.CB_GHeldItem.Size = new System.Drawing.Size(121, 21); this.CB_GHeldItem.TabIndex = 8; // // L_GHeldItem // - this.L_GHeldItem.Location = new System.Drawing.Point(131, 94); + this.L_GHeldItem.Location = new System.Drawing.Point(131, 95); this.L_GHeldItem.Name = "L_GHeldItem"; this.L_GHeldItem.Size = new System.Drawing.Size(55, 23); this.L_GHeldItem.TabIndex = 7; @@ -405,12 +411,16 @@ private void InitializeComponent() this.LB_Gift.FormattingEnabled = true; this.LB_Gift.Location = new System.Drawing.Point(3, 3); this.LB_Gift.Name = "LB_Gift"; - this.LB_Gift.Size = new System.Drawing.Size(115, 433); + this.LB_Gift.Size = new System.Drawing.Size(115, 472); this.LB_Gift.TabIndex = 0; this.LB_Gift.SelectedIndexChanged += new System.EventHandler(this.LB_Gift_SelectedIndexChanged); // // Tab_Encounters // + this.Tab_Encounters.Controls.Add(this.L_EGender); + this.Tab_Encounters.Controls.Add(this.NUD_EGender); + this.Tab_Encounters.Controls.Add(this.CB_EAbility); + this.Tab_Encounters.Controls.Add(this.L_EAbility); this.Tab_Encounters.Controls.Add(this.CHK_EIV3); this.Tab_Encounters.Controls.Add(this.CB_ENature); this.Tab_Encounters.Controls.Add(this.L_ENature); @@ -432,15 +442,32 @@ private void InitializeComponent() this.Tab_Encounters.Location = new System.Drawing.Point(4, 22); this.Tab_Encounters.Name = "Tab_Encounters"; this.Tab_Encounters.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Encounters.Size = new System.Drawing.Size(498, 437); + this.Tab_Encounters.Size = new System.Drawing.Size(498, 476); this.Tab_Encounters.TabIndex = 0; this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // + // CB_EAbility + // + this.CB_EAbility.FormattingEnabled = true; + this.CB_EAbility.Location = new System.Drawing.Point(187, 96); + this.CB_EAbility.Name = "CB_EAbility"; + this.CB_EAbility.Size = new System.Drawing.Size(121, 21); + this.CB_EAbility.TabIndex = 517; + // + // L_EAbility + // + this.L_EAbility.Location = new System.Drawing.Point(131, 94); + this.L_EAbility.Name = "L_EAbility"; + this.L_EAbility.Size = new System.Drawing.Size(55, 23); + this.L_EAbility.TabIndex = 516; + this.L_EAbility.Text = "Ability:"; + this.L_EAbility.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // CHK_EIV3 // this.CHK_EIV3.AutoSize = true; - this.CHK_EIV3.Location = new System.Drawing.Point(187, 160); + this.CHK_EIV3.Location = new System.Drawing.Point(187, 205); this.CHK_EIV3.Name = "CHK_EIV3"; this.CHK_EIV3.Size = new System.Drawing.Size(42, 17); this.CHK_EIV3.TabIndex = 504; @@ -450,14 +477,14 @@ private void InitializeComponent() // CB_ENature // this.CB_ENature.FormattingEnabled = true; - this.CB_ENature.Location = new System.Drawing.Point(187, 97); + this.CB_ENature.Location = new System.Drawing.Point(187, 142); this.CB_ENature.Name = "CB_ENature"; this.CB_ENature.Size = new System.Drawing.Size(121, 21); this.CB_ENature.TabIndex = 503; // // L_ENature // - this.L_ENature.Location = new System.Drawing.Point(131, 95); + this.L_ENature.Location = new System.Drawing.Point(131, 140); this.L_ENature.Name = "L_ENature"; this.L_ENature.Size = new System.Drawing.Size(55, 23); this.L_ENature.TabIndex = 502; @@ -478,7 +505,7 @@ private void InitializeComponent() this.GB_EEVs.Controls.Add(this.label3); this.GB_EEVs.Controls.Add(this.label4); this.GB_EEVs.Controls.Add(this.label5); - this.GB_EEVs.Location = new System.Drawing.Point(284, 295); + this.GB_EEVs.Location = new System.Drawing.Point(284, 333); this.GB_EEVs.Name = "GB_EEVs"; this.GB_EEVs.Size = new System.Drawing.Size(160, 112); this.GB_EEVs.TabIndex = 501; @@ -655,7 +682,7 @@ private void InitializeComponent() this.GB_EIVs.Controls.Add(this.NUD_EIV0); this.GB_EIVs.Controls.Add(this.L_ATK); this.GB_EIVs.Controls.Add(this.L_DEF); - this.GB_EIVs.Location = new System.Drawing.Point(129, 295); + this.GB_EIVs.Location = new System.Drawing.Point(129, 333); this.GB_EIVs.Name = "GB_EIVs"; this.GB_EIVs.Size = new System.Drawing.Size(148, 112); this.GB_EIVs.TabIndex = 21; @@ -850,7 +877,7 @@ private void InitializeComponent() // // L_Aura // - this.L_Aura.Location = new System.Drawing.Point(131, 118); + this.L_Aura.Location = new System.Drawing.Point(131, 163); this.L_Aura.Name = "L_Aura"; this.L_Aura.Size = new System.Drawing.Size(55, 23); this.L_Aura.TabIndex = 22; @@ -860,7 +887,7 @@ private void InitializeComponent() // CB_Aura // this.CB_Aura.FormattingEnabled = true; - this.CB_Aura.Location = new System.Drawing.Point(187, 120); + this.CB_Aura.Location = new System.Drawing.Point(187, 165); this.CB_Aura.Name = "CB_Aura"; this.CB_Aura.Size = new System.Drawing.Size(121, 21); this.CB_Aura.TabIndex = 21; @@ -868,7 +895,7 @@ private void InitializeComponent() // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 145); + this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 190); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); this.CHK_ShinyLock.TabIndex = 18; @@ -881,7 +908,7 @@ private void InitializeComponent() this.GB_EMoves.Controls.Add(this.CB_EMove2); this.GB_EMoves.Controls.Add(this.CB_EMove1); this.GB_EMoves.Controls.Add(this.CB_EMove0); - this.GB_EMoves.Location = new System.Drawing.Point(129, 177); + this.GB_EMoves.Location = new System.Drawing.Point(129, 220); this.GB_EMoves.Name = "GB_EMoves"; this.GB_EMoves.Size = new System.Drawing.Size(133, 112); this.GB_EMoves.TabIndex = 17; @@ -923,14 +950,14 @@ private void InitializeComponent() // CB_EHeldItem // this.CB_EHeldItem.FormattingEnabled = true; - this.CB_EHeldItem.Location = new System.Drawing.Point(187, 74); + this.CB_EHeldItem.Location = new System.Drawing.Point(187, 119); this.CB_EHeldItem.Name = "CB_EHeldItem"; this.CB_EHeldItem.Size = new System.Drawing.Size(121, 21); this.CB_EHeldItem.TabIndex = 16; // // L_EHeldItem // - this.L_EHeldItem.Location = new System.Drawing.Point(131, 72); + this.L_EHeldItem.Location = new System.Drawing.Point(131, 117); this.L_EHeldItem.Name = "L_EHeldItem"; this.L_EHeldItem.Size = new System.Drawing.Size(55, 23); this.L_EHeldItem.TabIndex = 15; @@ -1009,12 +1036,16 @@ private void InitializeComponent() this.LB_Encounter.FormattingEnabled = true; this.LB_Encounter.Location = new System.Drawing.Point(3, 3); this.LB_Encounter.Name = "LB_Encounter"; - this.LB_Encounter.Size = new System.Drawing.Size(115, 433); + this.LB_Encounter.Size = new System.Drawing.Size(115, 472); this.LB_Encounter.TabIndex = 1; this.LB_Encounter.SelectedIndexChanged += new System.EventHandler(this.LB_Encounter_SelectedIndexChanged); // // Tab_Trades // + this.Tab_Trades.Controls.Add(this.L_TGender); + this.Tab_Trades.Controls.Add(this.NUD_TGender); + this.Tab_Trades.Controls.Add(this.CB_TAbility); + this.Tab_Trades.Controls.Add(this.L_TAbility); this.Tab_Trades.Controls.Add(this.CB_TNature); this.Tab_Trades.Controls.Add(this.L_TNature); this.Tab_Trades.Controls.Add(this.groupBox1); @@ -1035,22 +1066,39 @@ private void InitializeComponent() this.Tab_Trades.Location = new System.Drawing.Point(4, 22); this.Tab_Trades.Name = "Tab_Trades"; this.Tab_Trades.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Trades.Size = new System.Drawing.Size(498, 437); + this.Tab_Trades.Size = new System.Drawing.Size(498, 476); this.Tab_Trades.TabIndex = 1; this.Tab_Trades.Text = "Trades"; this.Tab_Trades.UseVisualStyleBackColor = true; // + // CB_TAbility + // + this.CB_TAbility.FormattingEnabled = true; + this.CB_TAbility.Location = new System.Drawing.Point(187, 96); + this.CB_TAbility.Name = "CB_TAbility"; + this.CB_TAbility.Size = new System.Drawing.Size(121, 21); + this.CB_TAbility.TabIndex = 521; + // + // L_TAbility + // + this.L_TAbility.Location = new System.Drawing.Point(131, 94); + this.L_TAbility.Name = "L_TAbility"; + this.L_TAbility.Size = new System.Drawing.Size(55, 23); + this.L_TAbility.TabIndex = 520; + this.L_TAbility.Text = "Ability:"; + this.L_TAbility.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // CB_TNature // this.CB_TNature.FormattingEnabled = true; - this.CB_TNature.Location = new System.Drawing.Point(187, 97); + this.CB_TNature.Location = new System.Drawing.Point(187, 142); this.CB_TNature.Name = "CB_TNature"; this.CB_TNature.Size = new System.Drawing.Size(121, 21); this.CB_TNature.TabIndex = 505; // // L_TNature // - this.L_TNature.Location = new System.Drawing.Point(131, 95); + this.L_TNature.Location = new System.Drawing.Point(131, 140); this.L_TNature.Name = "L_TNature"; this.L_TNature.Size = new System.Drawing.Size(55, 23); this.L_TNature.TabIndex = 504; @@ -1071,7 +1119,7 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.NUD_TIV0); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); - this.groupBox1.Location = new System.Drawing.Point(129, 177); + this.groupBox1.Location = new System.Drawing.Point(129, 222); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(148, 112); this.groupBox1.TabIndex = 30; @@ -1267,14 +1315,14 @@ private void InitializeComponent() // CB_TRequest // this.CB_TRequest.FormattingEnabled = true; - this.CB_TRequest.Location = new System.Drawing.Point(230, 147); + this.CB_TRequest.Location = new System.Drawing.Point(230, 194); this.CB_TRequest.Name = "CB_TRequest"; this.CB_TRequest.Size = new System.Drawing.Size(121, 21); this.CB_TRequest.TabIndex = 29; // // label1 // - this.label1.Location = new System.Drawing.Point(121, 145); + this.label1.Location = new System.Drawing.Point(121, 192); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(106, 23); this.label1.TabIndex = 28; @@ -1284,7 +1332,7 @@ private void InitializeComponent() // L_TTID // this.L_TTID.AutoSize = true; - this.L_TTID.Location = new System.Drawing.Point(252, 123); + this.L_TTID.Location = new System.Drawing.Point(252, 170); this.L_TTID.Name = "L_TTID"; this.L_TTID.Size = new System.Drawing.Size(53, 13); this.L_TTID.TabIndex = 27; @@ -1293,7 +1341,7 @@ private void InitializeComponent() // // L_TID // - this.L_TID.Location = new System.Drawing.Point(136, 118); + this.L_TID.Location = new System.Drawing.Point(136, 165); this.L_TID.Name = "L_TID"; this.L_TID.Size = new System.Drawing.Size(50, 23); this.L_TID.TabIndex = 26; @@ -1302,7 +1350,7 @@ private void InitializeComponent() // // NUD_TID // - this.NUD_TID.Location = new System.Drawing.Point(187, 120); + this.NUD_TID.Location = new System.Drawing.Point(187, 167); this.NUD_TID.Maximum = new decimal(new int[] { 999999, 0, @@ -1321,14 +1369,14 @@ private void InitializeComponent() // CB_THeldItem // this.CB_THeldItem.FormattingEnabled = true; - this.CB_THeldItem.Location = new System.Drawing.Point(187, 74); + this.CB_THeldItem.Location = new System.Drawing.Point(187, 119); this.CB_THeldItem.Name = "CB_THeldItem"; this.CB_THeldItem.Size = new System.Drawing.Size(121, 21); this.CB_THeldItem.TabIndex = 24; // // L_THeldItem // - this.L_THeldItem.Location = new System.Drawing.Point(131, 72); + this.L_THeldItem.Location = new System.Drawing.Point(131, 117); this.L_THeldItem.Name = "L_THeldItem"; this.L_THeldItem.Size = new System.Drawing.Size(55, 23); this.L_THeldItem.TabIndex = 23; @@ -1407,7 +1455,7 @@ private void InitializeComponent() this.LB_Trade.FormattingEnabled = true; this.LB_Trade.Location = new System.Drawing.Point(3, 3); this.LB_Trade.Name = "LB_Trade"; - this.LB_Trade.Size = new System.Drawing.Size(115, 433); + this.LB_Trade.Size = new System.Drawing.Size(115, 472); this.LB_Trade.TabIndex = 2; this.LB_Trade.SelectedIndexChanged += new System.EventHandler(this.LB_Trade_SelectedIndexChanged); // @@ -1422,7 +1470,7 @@ private void InitializeComponent() this.Tab_Randomizer.Location = new System.Drawing.Point(4, 22); this.Tab_Randomizer.Name = "Tab_Randomizer"; this.Tab_Randomizer.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Randomizer.Size = new System.Drawing.Size(498, 437); + this.Tab_Randomizer.Size = new System.Drawing.Size(498, 476); this.Tab_Randomizer.TabIndex = 3; this.Tab_Randomizer.Text = "Randomizer Options"; this.Tab_Randomizer.UseVisualStyleBackColor = true; @@ -1474,7 +1522,7 @@ private void InitializeComponent() // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(192, 289); + this.B_RandAll.Location = new System.Drawing.Point(192, 321); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(122, 23); this.B_RandAll.TabIndex = 509; @@ -1484,6 +1532,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_SpecialMove); this.GB_Tweak.Controls.Add(this.CHK_RandomAura); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); @@ -1502,15 +1551,35 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(119, 113); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 173); + this.GB_Tweak.Size = new System.Drawing.Size(258, 193); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_RandomAbility + // + this.CHK_RandomAbility.AutoSize = true; + this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 124); + this.CHK_RandomAbility.Name = "CHK_RandomAbility"; + this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); + this.CHK_RandomAbility.TabIndex = 302; + this.CHK_RandomAbility.Text = "Random Abilities (1, 2, or Hidden)"; + this.CHK_RandomAbility.UseVisualStyleBackColor = true; + // + // CHK_SpecialMove + // + this.CHK_SpecialMove.AutoSize = true; + this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 155); + this.CHK_SpecialMove.Name = "CHK_SpecialMove"; + this.CHK_SpecialMove.Size = new System.Drawing.Size(197, 17); + this.CHK_SpecialMove.TabIndex = 301; + this.CHK_SpecialMove.Text = "Random Gift Move for Gift Pokémon"; + this.CHK_SpecialMove.UseVisualStyleBackColor = true; + // // CHK_RandomAura // this.CHK_RandomAura.AutoSize = true; - this.CHK_RandomAura.Location = new System.Drawing.Point(9, 139); + this.CHK_RandomAura.Location = new System.Drawing.Point(9, 140); this.CHK_RandomAura.Name = "CHK_RandomAura"; this.CHK_RandomAura.Size = new System.Drawing.Size(172, 17); this.CHK_RandomAura.TabIndex = 300; @@ -1520,7 +1589,7 @@ private void InitializeComponent() // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 124); + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); this.CHK_RemoveShinyLock.TabIndex = 299; @@ -1530,7 +1599,7 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 109); + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 171); this.CHK_AllowMega.Name = "CHK_AllowMega"; this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); this.CHK_AllowMega.TabIndex = 298; @@ -1678,7 +1747,7 @@ private void InitializeComponent() // // B_Starters // - this.B_Starters.Location = new System.Drawing.Point(192, 318); + this.B_Starters.Location = new System.Drawing.Point(192, 350); this.B_Starters.Name = "B_Starters"; this.B_Starters.Size = new System.Drawing.Size(122, 23); this.B_Starters.TabIndex = 9; @@ -1688,7 +1757,7 @@ private void InitializeComponent() // // B_Save // - this.B_Save.Location = new System.Drawing.Point(435, 445); + this.B_Save.Location = new System.Drawing.Point(435, 481); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(75, 23); this.B_Save.TabIndex = 1; @@ -1698,7 +1767,7 @@ private void InitializeComponent() // // B_Cancel // - this.B_Cancel.Location = new System.Drawing.Point(354, 445); + this.B_Cancel.Location = new System.Drawing.Point(354, 481); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(75, 23); this.B_Cancel.TabIndex = 2; @@ -1706,21 +1775,53 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_SpecialMove + // L_EGender // - this.CHK_SpecialMove.AutoSize = true; - this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 154); - this.CHK_SpecialMove.Name = "CHK_SpecialMove"; - this.CHK_SpecialMove.Size = new System.Drawing.Size(197, 17); - this.CHK_SpecialMove.TabIndex = 301; - this.CHK_SpecialMove.Text = "Random Gift Move for Gift Pokémon"; - this.CHK_SpecialMove.UseVisualStyleBackColor = true; + this.L_EGender.Location = new System.Drawing.Point(131, 71); + this.L_EGender.Name = "L_EGender"; + this.L_EGender.Size = new System.Drawing.Size(55, 23); + this.L_EGender.TabIndex = 519; + this.L_EGender.Text = "Gender:"; + this.L_EGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_EGender + // + this.NUD_EGender.Location = new System.Drawing.Point(187, 74); + this.NUD_EGender.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.NUD_EGender.Name = "NUD_EGender"; + this.NUD_EGender.Size = new System.Drawing.Size(34, 20); + this.NUD_EGender.TabIndex = 518; + // + // L_TGender + // + this.L_TGender.Location = new System.Drawing.Point(131, 71); + this.L_TGender.Name = "L_TGender"; + this.L_TGender.Size = new System.Drawing.Size(55, 23); + this.L_TGender.TabIndex = 523; + this.L_TGender.Text = "Gender:"; + this.L_TGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_TGender + // + this.NUD_TGender.Location = new System.Drawing.Point(187, 74); + this.NUD_TGender.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.NUD_TGender.Name = "NUD_TGender"; + this.NUD_TGender.Size = new System.Drawing.Size(34, 20); + this.NUD_TGender.TabIndex = 522; // // StaticEncounterEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(530, 511); + this.ClientSize = new System.Drawing.Size(530, 535); this.Controls.Add(this.B_Cancel); this.Controls.Add(this.B_Save); this.Controls.Add(this.TC_Tabs); @@ -1729,7 +1830,6 @@ private void InitializeComponent() this.TC_Tabs.ResumeLayout(false); this.Tab_Gifts.ResumeLayout(false); this.Tab_Gifts.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_GGender)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).EndInit(); this.Tab_Encounters.ResumeLayout(false); @@ -1768,6 +1868,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).EndInit(); this.ResumeLayout(false); } @@ -1835,7 +1937,6 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_LevelBoost; private System.Windows.Forms.CheckBox CHK_Level; private System.Windows.Forms.CheckBox CHK_ShinyLock; - private System.Windows.Forms.NumericUpDown NUD_GGender; private System.Windows.Forms.CheckBox CHK_G_Lock; private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.CheckBox CHK_AllowMega; @@ -1871,7 +1972,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_ENature; private System.Windows.Forms.Label L_ENature; private System.Windows.Forms.CheckBox CHK_EIV3; - private System.Windows.Forms.Label L_GGender; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label8; private System.Windows.Forms.NumericUpDown NUD_TIV3; @@ -1896,5 +1996,16 @@ private void InitializeComponent() private System.Windows.Forms.Button B_ModifyLevel; private System.Windows.Forms.CheckBox CHK_RandomAura; private System.Windows.Forms.CheckBox CHK_SpecialMove; + private System.Windows.Forms.ComboBox CB_GAbility; + private System.Windows.Forms.Label L_GAbility; + private System.Windows.Forms.ComboBox CB_EAbility; + private System.Windows.Forms.Label L_EAbility; + private System.Windows.Forms.ComboBox CB_TAbility; + private System.Windows.Forms.Label L_TAbility; + private System.Windows.Forms.CheckBox CHK_RandomAbility; + private System.Windows.Forms.Label L_EGender; + private System.Windows.Forms.NumericUpDown NUD_EGender; + private System.Windows.Forms.Label L_TGender; + private System.Windows.Forms.NumericUpDown NUD_TGender; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index bc0e60f70f..dbb5028913 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -21,6 +21,13 @@ public partial class StaticEncounterEditor7 : Form private readonly string[] types = Main.Config.getText(TextName.Types); private readonly int[] oldStarters; + private readonly string[] ability = + { + "Random (1 or 2)", + "Ability 1", + "Ability 2", + "Hidden Ability", + }; private readonly string[] aura = { "(None)", @@ -94,6 +101,12 @@ public StaticEncounterEditor7(byte[][] infiles) CB_TSpecies.Items.Add(s); CB_TRequest.Items.Add(s); } + foreach (var s in ability) + { + CB_GAbility.Items.Add(s); + CB_EAbility.Items.Add(s); + CB_TAbility.Items.Add(s); + } foreach (var s in itemlist) { CB_GHeldItem.Items.Add(s); @@ -215,7 +228,7 @@ private void getGift() CB_GHeldItem.SelectedIndex = entry.HeldItem; NUD_GLevel.Value = entry.Level; NUD_GForm.Value = entry.Form; - NUD_GGender.Value = entry.Gender; + CB_GAbility.SelectedIndex = entry.Ability + 1; CB_GNature.SelectedIndex = entry.Nature + 1; CB_SpecialMove.SelectedIndex = entry.SpecialMove; CHK_G_Lock.Checked = entry.ShinyLock; @@ -234,7 +247,7 @@ private void setGift() entry.HeldItem = CB_GHeldItem.SelectedIndex; entry.Level = (int)NUD_GLevel.Value; entry.Form = (int)NUD_GForm.Value; - entry.Gender = (int) NUD_GGender.Value; + entry.Ability = (sbyte)(CB_GAbility.SelectedIndex - 1); entry.Nature = (sbyte)(CB_GNature.SelectedIndex - 1); entry.SpecialMove = CB_SpecialMove.SelectedIndex; entry.ShinyLock = CHK_G_Lock.Checked; @@ -253,6 +266,8 @@ private void getEncounter() CB_EHeldItem.SelectedIndex = entry.HeldItem; NUD_ELevel.Value = entry.Level; NUD_EForm.Value = entry.Form; + NUD_EGender.Value = entry.Gender; + CB_EAbility.SelectedIndex = entry.Ability; int[] moves = entry.RelearnMoves; CB_EMove0.SelectedIndex = moves[0]; @@ -293,6 +308,8 @@ private void setEncounter() entry.HeldItem = CB_EHeldItem.SelectedIndex; entry.Level = (int)NUD_ELevel.Value; entry.Form = (int)NUD_EForm.Value; + entry.Gender = (int)NUD_EGender.Value; + entry.Ability = CB_EAbility.SelectedIndex; entry.RelearnMoves = new[] { CB_EMove0.SelectedIndex, @@ -333,6 +350,8 @@ private void getTrade() CB_THeldItem.SelectedIndex = entry.HeldItem; NUD_TLevel.Value = entry.Level; NUD_TForm.Value = entry.Form; + NUD_TGender.Value = entry.Gender; + CB_TAbility.SelectedIndex = entry.Ability + 1; CB_TNature.SelectedIndex = entry.Nature; NUD_TID.Value = entry.ID; @@ -358,6 +377,8 @@ private void setTrade() entry.HeldItem = CB_THeldItem.SelectedIndex; entry.Level = (int)NUD_TLevel.Value; entry.Form = (int)NUD_TForm.Value; + entry.Gender = (int)NUD_TGender.Value; + entry.Ability = (CB_TAbility.SelectedIndex - 1); entry.Nature = CB_TNature.SelectedIndex; entry.TID = (int)NUD_TID.Value; @@ -458,6 +479,9 @@ private void B_Starters_Click(object sender, EventArgs e) if (CHK_SpecialMove.Checked) t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none + + if (CHK_RandomAbility.Checked) + t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2 , or H } getListBoxEntries(); @@ -500,12 +524,16 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_SpecialMove.Checked) t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none + + if (CHK_RandomAbility.Checked) + t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2 , or H } foreach (EncounterStatic7 t in Encounters) { t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); + t.Gender = 0; // random t.Nature = 0; // random if (CHK_AllowMega.Checked) @@ -522,6 +550,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAura.Checked && t.Aura != 0) // don't apply aura to a pkm without it t.Aura = Util.rand.Next(1, CB_Aura.Items.Count); // don't allow none + + if (CHK_RandomAbility.Checked) + t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2 , or H } foreach (EncounterTrade7 t in Trades) { @@ -538,6 +569,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_Level.Checked) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); + + if (CHK_RandomAbility.Checked) + t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2 , or H } getListBoxEntries(); From 28c29a30d71d8711a2a00ca603e12d93f342ab76 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 25 Dec 2017 18:48:58 -0500 Subject: [PATCH 037/191] Revise Lusamine 2 blacklist --- pk3DS/Subforms/Gen7/SMTE.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 0fb16fa21c..01067a9bd5 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -624,7 +624,7 @@ private void B_Randomize_Click(object sender, EventArgs e) rv = (int) (Util.rnd32()%CB_Trainer_Class.Items.Count); } while (/*trClass[rv].StartsWith("[~") || */TrainerClasses_7.Contains(rv) && CHK_IgnoreSpecialClass.Checked); // don't allow disallowed classes - if (Main.Config.USUM && rv == 082) // Mother Beast Lusamine; unused in USUM and can crash game + if (rv == 082) // Lusamine 2 (Aether President - 082) can crash Multi Battles, skip continue; tr.TrainerClass = (byte) rv; From dd6aeb8137064f940d9ba40f368bdf102f839186 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Thu, 28 Dec 2017 00:23:04 -0500 Subject: [PATCH 038/191] Add SMTE options --- pk3DS.Core/Legality/Legal.cs | 41 +++++ pk3DS/Subforms/Gen7/SMTE.Designer.cs | 52 +++++- pk3DS/Subforms/Gen7/SMTE.cs | 40 ++++- pk3DS/Subforms/Gen7/SMTE.resx | 228 +++++++++++++++++++++++++++ 4 files changed, 353 insertions(+), 8 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index d8046a5cf5..b0ac292434 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -298,5 +298,46 @@ public static partial class Legal 719, 723, 724, 725, 726, 727, 728 }; + + public static readonly int[] ImportantTrainers_SM = + { + 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 129, 131, 132, 138, 144, 146, 149, 152, 153, 154, 155, 156, 158, 159, 160, 164, 167, 185, 215, 216, + 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 371, 372, 392, 396, 398, 400, 401, 403, 405, 409, 410, 413, 414, 415, 416, 417, + 418, 419, 435, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 481, 482, 483, 484, + }; + + public static readonly int[] ImportantTrainers_USUM = + { + 012, 013, 014, 023, 052, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 185, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, + 238, 239, 240, 241, 350, 351, 352, 356, 358, 359, 371, 372, 396, 398, 401, 405, 409, 410, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 489, + 490, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 630, 644, 645, 647, + 648, 649, 650, 651, 652, + }; + + public static readonly int[] FinalEvolutions_6 = + { + 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, + 091, 094, 097, 099, 101, 103, 105, 106, 107, 110, 115, 119, 121, 122, 124, 127, 128, 130, 131, 132, 134, 135, 136, 139, 141, 142, 143, 144, 145, 146, 149, 150, 151, 154, 157, 160, 162, + 164, 166, 168, 169, 171, 178, 181, 182, 184, 185, 186, 189, 192, 195, 196, 197, 199, 201, 202, 203, 205, 206, 208, 210, 211, 212, 213, 214, 217, 219, 222, 224, 225, 226, 227, 229, 230, + 232, 234, 235, 237, 241, 242, 243, 244, 245, 248, 249, 250, 251, 254, 257, 260, 262, 264, 267, 269, 272, 275, 277, 279, 282, 284, 286, 289, 291, 292, 295, 297, 301, 302, 303, 306, 308, + 310, 311, 312, 313, 314, 317, 319, 321, 323, 324, 326, 327, 330, 332, 334, 335, 336, 337, 338, 340, 342, 344, 346, 348, 350, 351, 352, 354, 357, 358, 359, 362, 365, 367, 368, 369, 370, + 373, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 389, 392, 395, 398, 400, 402, 405, 407, 409, 411, 413, 414, 416, 417, 419, 421, 423, 424, 426, 428, 429, 430, 432, 435, 437, + 441, 442, 445, 448, 450, 452, 454, 455, 457, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 386, 487, + 488, 489, 490, 491, 492, 493, 494, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, + 561, 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, + 635, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, + 701, 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, + }; + + public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[] + { + 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, + 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, + }).ToArray(); + + public static readonly int[] FinalEvolutions_USUM = FinalEvolutions_SM.Concat(new int[] + { + 804, 805, 806, 807, + }).ToArray(); } } diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 69bb7f204d..d9f86936c8 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -180,6 +180,8 @@ private void InitializeComponent() this.CHK_RandomItems = new System.Windows.Forms.CheckBox(); this.CHK_STAB = new System.Windows.Forms.CheckBox(); this.Tab_Trainer1 = new System.Windows.Forms.TabPage(); + this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); this.L_MinPKM = new System.Windows.Forms.Label(); this.L_MaxPKM = new System.Windows.Forms.Label(); this.NUD_RMin = new System.Windows.Forms.NumericUpDown(); @@ -188,6 +190,7 @@ private void InitializeComponent() this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); + this.CHK_6PKM = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -235,6 +238,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); this.Tab_Trainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).BeginInit(); this.SuspendLayout(); @@ -1979,6 +1983,9 @@ private void InitializeComponent() // // Tab_Trainer1 // + this.Tab_Trainer1.Controls.Add(this.CHK_6PKM); + this.Tab_Trainer1.Controls.Add(this.NUD_ForceFullyEvolved); + this.Tab_Trainer1.Controls.Add(this.CHK_ForceFullyEvolved); this.Tab_Trainer1.Controls.Add(this.L_MinPKM); this.Tab_Trainer1.Controls.Add(this.L_MaxPKM); this.Tab_Trainer1.Controls.Add(this.NUD_RMin); @@ -1994,6 +2001,34 @@ private void InitializeComponent() this.Tab_Trainer1.Text = "Trainer"; this.Tab_Trainer1.UseVisualStyleBackColor = true; // + // NUD_ForceFullyEvolved + // + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 111); + this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.TabIndex = 340; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 113); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 339; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; + // // L_MinPKM // this.L_MinPKM.Location = new System.Drawing.Point(191, 6); @@ -2060,7 +2095,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 73); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 76); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 333; @@ -2107,6 +2142,17 @@ private void InitializeComponent() this.CHK_RandomClass.UseVisualStyleBackColor = true; this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); // + // CHK_6PKM + // + this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_6PKM.AutoSize = true; + this.CHK_6PKM.Location = new System.Drawing.Point(6, 94); + this.CHK_6PKM.Name = "CHK_6PKM"; + this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); + this.CHK_6PKM.TabIndex = 341; + this.CHK_6PKM.Text = "6 Pokémon for Important Trainers"; + this.CHK_6PKM.UseVisualStyleBackColor = true; + // // SMTE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2184,6 +2230,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); this.Tab_Trainer1.ResumeLayout(false); this.Tab_Trainer1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).EndInit(); this.ResumeLayout(false); @@ -2350,6 +2397,9 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_Damage; private System.Windows.Forms.CheckBox CHK_Flag; private System.Windows.Forms.CheckBox CHK_NoFixedDamage; + private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; + private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; + private System.Windows.Forms.CheckBox CHK_6PKM; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 01067a9bd5..74620b93d2 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -18,7 +18,9 @@ public partial class SMTE : Form private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); private readonly trdata7[] Trainers; private string[][] AltForms; - private static int[] TrainerClasses_7; + private static int[] TrainerClasses; + private static int[] ImportantTrainers; + private static int[] FinalEvo; private int index = -1; private PictureBox[] pba; @@ -34,6 +36,7 @@ public partial class SMTE : Form private readonly string[] trClass = Main.Config.getText(TextName.TrainerClasses); private readonly TextData trText = Main.Config.getTextData(TextName.TrainerText); private readonly TextData TrainerNames; + public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) { @@ -54,7 +57,9 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) CB_TrainerID.SelectedIndex = 0; CB_Moves.SelectedIndex = 0; - TrainerClasses_7 = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; + TrainerClasses = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; + ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; + FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; RandSettings.GetFormSettings(this, Tab_Misc.Controls); } @@ -622,7 +627,7 @@ private void B_Randomize_Click(object sender, EventArgs e) do { rv = (int) (Util.rnd32()%CB_Trainer_Class.Items.Count); - } while (/*trClass[rv].StartsWith("[~") || */TrainerClasses_7.Contains(rv) && CHK_IgnoreSpecialClass.Checked); // don't allow disallowed classes + } while (/*trClass[rv].StartsWith("[~") || */TrainerClasses.Contains(rv) && CHK_IgnoreSpecialClass.Checked); // don't allow disallowed classes if (rv == 082) // Lusamine 2 (Aether President - 082) can crash Multi Battles, skip continue; @@ -630,12 +635,13 @@ private void B_Randomize_Click(object sender, EventArgs e) tr.TrainerClass = (byte) rv; } + var avgBST = (int)tr.Pokemon.Average(pk => Main.SpeciesStat[pk.Species].BST); + int avgLevel = (int)tr.Pokemon.Average(pk => pk.Level); + var pinfo = Main.SpeciesStat.OrderBy(pk => Math.Abs(avgBST - pk.BST)).First(); + int avgSpec = Array.IndexOf(Main.SpeciesStat, pinfo); + if (tr.NumPokemon < NUD_RMin.Value) { - var avgBST = (int)tr.Pokemon.Average(pk => Main.SpeciesStat[pk.Species].BST); - int avgLevel = (int)tr.Pokemon.Average(pk => pk.Level); - var pinfo = Main.SpeciesStat.OrderBy(pk => Math.Abs(avgBST - pk.BST)).First(); - int avgSpec = Array.IndexOf(Main.SpeciesStat, pinfo); for (int p = tr.NumPokemon; p < NUD_RMin.Value; p++) tr.Pokemon.Add(new trpoke7 { @@ -649,6 +655,16 @@ private void B_Randomize_Click(object sender, EventArgs e) tr.Pokemon.RemoveRange((int)NUD_RMax.Value, (int)(tr.NumPokemon - NUD_RMax.Value)); tr.NumPokemon = (int)NUD_RMax.Value; } + if (CHK_6PKM.Checked && ImportantTrainers.Contains(tr.ID)) + { + for (int g = tr.NumPokemon; g < 6; g++) + tr.Pokemon.Add(new trpoke7 + { + Species = rnd.GetRandomSpecies(avgSpec), + Level = avgLevel, + }); + tr.NumPokemon = 6; + } // PKM Properties foreach (var pk in tr.Pokemon) @@ -671,6 +687,16 @@ private void B_Randomize_Click(object sender, EventArgs e) if (CHK_MaxDiffPKM.Checked) pk.IVs = new[] {31, 31, 31, 31, 31, 31}; + if (CHK_ForceFullyEvolved.Checked && pk.Level >= NUD_ForceFullyEvolved.Value) + { + if (!FinalEvo.Contains(pk.Species)) + { + int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); + pk.Species = FinalEvo[randFinalEvo()]; + pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + } + } + switch (CB_Moves.SelectedIndex) { case 1: // Random diff --git a/pk3DS/Subforms/Gen7/SMTE.resx b/pk3DS/Subforms/Gen7/SMTE.resx index 0161958b99..05589a384b 100644 --- a/pk3DS/Subforms/Gen7/SMTE.resx +++ b/pk3DS/Subforms/Gen7/SMTE.resx @@ -150,12 +150,54 @@ True + + True + + + True + + + True + + + True + True True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -171,6 +213,12 @@ True + + True + + + True + True @@ -180,6 +228,12 @@ True + + True + + + True + True @@ -189,6 +243,12 @@ True + + True + + + True + True @@ -198,6 +258,12 @@ True + + True + + + True + True @@ -207,6 +273,12 @@ True + + True + + + True + True @@ -216,6 +288,12 @@ True + + True + + + True + True @@ -225,18 +303,66 @@ True + + True + + + True + True True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True True + + True + + + True + + + True + + + True + True @@ -261,6 +387,18 @@ True + + True + + + True + + + True + + + True + True @@ -276,6 +414,18 @@ True + + True + + + True + + + True + + + True + True @@ -291,6 +441,18 @@ True + + True + + + True + + + True + + + True + True @@ -306,6 +468,18 @@ True + + True + + + True + + + True + + + True + True @@ -321,6 +495,18 @@ True + + True + + + True + + + True + + + True + True @@ -336,6 +522,18 @@ True + + True + + + True + + + True + + + True + True @@ -348,6 +546,15 @@ True + + True + + + True + + + True + True @@ -357,12 +564,33 @@ True + + True + + + True + True True + + True + + + True + + + True + + + True + + + True + True From 1c4c2b358d374e22804c51d294e55c1d55efeabe Mon Sep 17 00:00:00 2001 From: sora10pls Date: Thu, 28 Dec 2017 19:43:14 -0500 Subject: [PATCH 039/191] Revise RSTE levelup move get --- pk3DS/Subforms/Gen6/RSTE.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index ea824375c9..cb13bec680 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -15,6 +15,7 @@ namespace pk3DS { public partial class RSTE : Form { + private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) { trclass = trc; @@ -630,7 +631,7 @@ private void Randomize() InitializeTrainerTeamInfo(t, rImportant[i] == null); RandomizeTrainerAIClass(t, trClass); RandomizeTrainerPrizeItem(t); - RandomizeTeam(t, move, itemvals, type, mevo, typerand); + RandomizeTeam(t, move, learn, itemvals, type, mevo, typerand); trdata[i] = t.Write(); trpoke[i] = t.WriteTeam(); @@ -639,7 +640,7 @@ private void Randomize() WinFormsUtil.Alert("Randomized all Trainers according to specification!", "Press the Dump to .TXT button to view the new Trainer information!"); } - private static void RandomizeTeam(trdata6 t, MoveRandomizer move, ushort[] itemvals, int type, bool mevo, bool typerand) + private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandomizer learn, ushort[] itemvals, int type, bool mevo, bool typerand) { int last = t.Team.Length - 1; for (int p = 0; p < t.Team.Length; p++) @@ -682,12 +683,22 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, ushort[] itemv else if (rItem) pk.Item = itemvals[rnd32() % itemvals.Length]; + // random if (rMove) { var pkMoves = move.GetRandomMoveset(pk.Species, 4); for (int m = 0; m < 4; m++) pk.Moves[m] = (ushort)pkMoves[m]; } + + // levelup + if (rNoMove) + { + t.Moves = true; + var pkMoves = learn.GetCurrentMoves(pk.Species, pk.Form, pk.Level, 4); + for (int m = 0; m < 4; m++) + pk.Moves[m] = (ushort)pkMoves[m]; + } } } private static void InitializeTrainerTeamInfo(trdata6 t, bool important) From 035f0310628fe99e2fa972df6c38fc725d31292d Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 30 Dec 2017 00:17:42 -0800 Subject: [PATCH 040/191] Move SARC to core --- pk3DS.Core/CTR/SARC.cs | 125 ++++++++++++++++++++++ pk3DS/ARCUtil.cs | 228 ++++++++++++++--------------------------- 2 files changed, 202 insertions(+), 151 deletions(-) create mode 100644 pk3DS.Core/CTR/SARC.cs diff --git a/pk3DS.Core/CTR/SARC.cs b/pk3DS.Core/CTR/SARC.cs new file mode 100644 index 0000000000..80bfeb91c0 --- /dev/null +++ b/pk3DS.Core/CTR/SARC.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.IO; + +namespace pk3DS.Core.CTR +{ + public class SARC + { + private const string Identifier = nameof(SARC); + + public string Magic; + public ushort HeaderSize; + public ushort Endianness; + public uint FileSize; + public uint DataOffset; + public uint Unknown; + + public SFAT SFAT; + public SFNT SFNT; + + // Assigned Properties + public string FileName; + public string FilePath; + public string Extension; + public readonly bool Valid; + + public bool SigMatches => Magic == Identifier; + + public SARC() + { + SFAT = new SFAT(); + SFNT = new SFNT(); + } + public SARC(string path) + { + FileName = Path.GetFileNameWithoutExtension(path); + FilePath = Path.GetDirectoryName(path); + Extension = Path.GetExtension(path); + + using (var br = new BinaryReader(File.OpenRead(path))) + { + ReadHeader(br); + SFAT = new SFAT(br); + SFNT = new SFNT(br); + } + Valid = true; + } + private void ReadHeader(BinaryReader br) + { + Magic = new string(br.ReadChars(4)); + if (!SigMatches) + return; + + HeaderSize = br.ReadUInt16(); + Endianness = br.ReadUInt16(); + FileSize = br.ReadUInt32(); + DataOffset = br.ReadUInt32(); + Unknown = br.ReadUInt32(); + } + } + public class SFAT + { + public const string Identifier = nameof(SFAT); + public bool SigMatches => Magic == Identifier; + + public string Magic; + public ushort HeaderSize; + public ushort EntryCount; + public uint HashMult; + public List Entries; + + public SFAT() { } + public SFAT(BinaryReader br) + { + Magic = new string(br.ReadChars(4)); + if (!SigMatches) + throw new FormatException(nameof(SFAT)); + + HeaderSize = br.ReadUInt16(); + EntryCount = br.ReadUInt16(); + HashMult = br.ReadUInt32(); + Entries = new List(); + + for (int i = 0; i < EntryCount; i++) + Entries.Add(new SFATEntry(br)); + } + } + public class SFNT + { + public const string Identifier = nameof(SFNT); + public bool SigMatches => Magic == Identifier; + + public string Magic; + public ushort HeaderSize; + public ushort Unknown; + public uint StringOffset; + + public SFNT() { } + public SFNT(BinaryReader br) + { + Magic = new string(br.ReadChars(4)); + if (!SigMatches) + throw new FormatException(nameof(SFNT)); + + HeaderSize = br.ReadUInt16(); + Unknown = br.ReadUInt16(); + StringOffset = (uint)br.BaseStream.Position; + } + } + public class SFATEntry + { + public uint FileNameHash; + public uint FileNameOffset; + public uint FileDataStart; + public uint FileDataEnd; + + public SFATEntry(BinaryReader br) + { + FileNameHash = br.ReadUInt32(); + FileNameOffset = br.ReadUInt32(); + FileDataStart = br.ReadUInt32(); + FileDataEnd = br.ReadUInt32(); + } + } +} \ No newline at end of file diff --git a/pk3DS/ARCUtil.cs b/pk3DS/ARCUtil.cs index 045cab3c5e..d33ea4dbd0 100644 --- a/pk3DS/ARCUtil.cs +++ b/pk3DS/ARCUtil.cs @@ -1,67 +1,19 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Text; +using pk3DS.Core.CTR; namespace pk3DS.ARCUtil { public static class ARC { - // Multi Type Archive Handling - internal static bool onefile = true; - internal static SARC analyzeSARC(string path) + private static SARC analyzeSARC(string path) { - SARC sarc = new SARC - { - FileName = Path.GetFileNameWithoutExtension(path), - FilePath = Path.GetDirectoryName(path), - Extension = Path.GetExtension(path) - }; - BinaryReader br = new BinaryReader(File.OpenRead(path)); - sarc.valid = true; - sarc.Signature = new string(br.ReadChars(4)); - if (sarc.Signature != "SARC") - { - sarc.valid = false; - return sarc; - } - sarc.HeaderSize = br.ReadUInt16(); - sarc.Endianness = br.ReadUInt16(); - sarc.FileSize = br.ReadUInt32(); - sarc.DataOffset = br.ReadUInt32(); - sarc.Unknown = br.ReadUInt32(); - sarc.SFat = new SFAT { Signature = new string(br.ReadChars(4)) }; - if (sarc.SFat.Signature != "SFAT") - { - sarc.valid = false; - return sarc; - } - sarc.SFat.HeaderSize = br.ReadUInt16(); - sarc.SFat.EntryCount = br.ReadUInt16(); - sarc.SFat.HashMult = br.ReadUInt32(); - sarc.SFat.Entries = new List(); - for (int i = 0; i < sarc.SFat.EntryCount; i++) - { - SFATEntry s = new SFATEntry - { - FileNameHash = br.ReadUInt32(), - FileNameOffset = br.ReadUInt32(), - FileDataStart = br.ReadUInt32(), - FileDataEnd = br.ReadUInt32() - }; - sarc.SFat.Entries.Add(s); - } - sarc.SFnt = new SFNT { Signature = new string(br.ReadChars(4)) }; - if (sarc.SFnt.Signature != "SFNT") - { - sarc.valid = false; - return sarc; - } - sarc.SFnt.HeaderSize = br.ReadUInt16(); - sarc.SFnt.Unknown = br.ReadUInt16(); - sarc.SFnt.StringOffset = (uint)br.BaseStream.Position; - return sarc; + try { return new SARC(path); } + catch { return new SARC(); } } internal static ShuffleARC AnalyzeShuffle(string path) { @@ -430,73 +382,86 @@ internal static string Interpret(string path) } else if (sharc.valid) { - ret += "New Shuffle Archive with " + sharc.FileCount + " files." + Environment.NewLine; - string dir = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + sharc.FileName + "_" + Path.DirectorySeparatorChar; - if (!Directory.Exists(dir)) - { - Console.WriteLine("Making dir: " + dir); - Directory.CreateDirectory(dir); - } + UnpackShuffleARC(path, sharc, ret); + } + else if (sarc.Valid) + UnpackSARC(path, sarc); + else + { + ret = "Not a valid .DARC/.FARC/.SARC/.GAR/Shuffle Archive file"; + } + return ret; + } - string diglen = "".PadLeft((int)(Math.Log10(sharc.FileCount) + 1), '0'); - for (int i = 0; i < sharc.FileCount; i++) - { - var fs = File.OpenRead(path); - fs.Seek(sharc.Files[i].Offset, SeekOrigin.Begin); - byte[] fileBuffer = new byte[sharc.Files[i].Length]; - fs.Read(fileBuffer, 0, fileBuffer.Length); - fs.Close(); - uint check = 0; - for (int j = 0; j < fileBuffer.Length; j += 4) - check += BitConverter.ToUInt32(fileBuffer, j); - Console.WriteLine(i.ToString(diglen) + ": " + check.ToString("X8")); - File.WriteAllBytes(dir + i.ToString(diglen) + ".zip", fileBuffer); - ret += "Extracted " + i.ToString(diglen) + " (Offset: " + sharc.Files[i].Offset.ToString("X8") + ", Len: " + sharc.Files[i].Length.ToString("X8") + ")." + Environment.NewLine; - } - ret += Environment.NewLine; + private static bool UnpackShuffleARC(string path, ShuffleARC sharc, string ret) + { + Debug.WriteLine($"New Shuffle Archive with {sharc.FileCount} files."); + string dir = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + sharc.FileName + "_" + Path.DirectorySeparatorChar; + if (!Directory.Exists(dir)) + { + Console.WriteLine("Making dir: " + dir); + Directory.CreateDirectory(dir); } - else if (sarc.valid) + + string diglen = "".PadLeft((int)(Math.Log10(sharc.FileCount) + 1), '0'); + for (int i = 0; i < sharc.FileCount; i++) { - ret = "New SARC with " + sarc.SFat.EntryCount + " files." + Environment.NewLine; - string dir = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + sarc.FileName + "_" + Path.DirectorySeparatorChar; - if (!Directory.Exists(dir)) - { - Console.WriteLine("Making dir: " + dir); - Directory.CreateDirectory(dir); - } + var fs = File.OpenRead(path); + fs.Seek(sharc.Files[i].Offset, SeekOrigin.Begin); + byte[] fileBuffer = new byte[sharc.Files[i].Length]; + fs.Read(fileBuffer, 0, fileBuffer.Length); + fs.Close(); + uint check = 0; + for (int j = 0; j < fileBuffer.Length; j += 4) + check += BitConverter.ToUInt32(fileBuffer, j); + Console.WriteLine(i.ToString(diglen) + ": " + check.ToString("X8")); + File.WriteAllBytes(dir + i.ToString(diglen) + ".zip", fileBuffer); + Debug.WriteLine($"Extracted {i.ToString(diglen)} (Offset: {sharc.Files[i].Offset:X8}, Len: {sharc.Files[i].Length:X8})."); + } + return true; + } - foreach (SFATEntry t in sarc.SFat.Entries) - { - var fs = File.OpenRead(path); - uint FileLen = t.FileDataEnd - t.FileDataStart; - fs.Seek(t.FileDataStart + sarc.DataOffset, SeekOrigin.Begin); - byte[] fileBuffer = new byte[FileLen]; - fs.Read(fileBuffer, 0, (int)FileLen); - fs.Seek(sarc.SFnt.StringOffset, SeekOrigin.Begin); - fs.Seek((t.FileNameOffset & 0x00FFFFFF) * 4, SeekOrigin.Current); - StringBuilder sb = new StringBuilder(); - for (char c = (char)fs.ReadByte(); c != 0; c = (char)fs.ReadByte()) - { - sb.Append(c); - } - string FileName = sb.ToString().Replace('/', Path.DirectorySeparatorChar); - fs.Close(); - string FileDir = Path.GetDirectoryName(dir + FileName) + Path.DirectorySeparatorChar; - if (!Directory.Exists(FileDir)) - { - Console.WriteLine("Making dir: " + FileDir); - Directory.CreateDirectory(FileDir); - } - File.WriteAllBytes(dir + FileName, fileBuffer); - } + private static bool UnpackSARC(string path, SARC sarc) + { + Debug.WriteLine($"New SARC with {sarc.SFAT.EntryCount} files."); + string dir = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + sarc.FileName + "_" + Path.DirectorySeparatorChar; + if (!Directory.Exists(dir)) + { + Debug.WriteLine($"Making dir: {dir}"); + Directory.CreateDirectory(dir); } - else + + var fs = File.OpenRead(path); + foreach (SFATEntry t in sarc.SFAT.Entries) { - ret = "Not a valid .DARC/.FARC/.SARC/.GAR/Shuffle Archive file"; + // Read File Data + uint FileLen = t.FileDataEnd - t.FileDataStart; + fs.Seek(t.FileDataStart + sarc.DataOffset, SeekOrigin.Begin); + byte[] fileBuffer = new byte[FileLen]; + fs.Read(fileBuffer, 0, (int)FileLen); + + // Read File Name + fs.Seek(sarc.SFNT.StringOffset, SeekOrigin.Begin); + fs.Seek((t.FileNameOffset & 0x00FFFFFF) * 4, SeekOrigin.Current); + StringBuilder sb = new StringBuilder(); + for (char c = (char)fs.ReadByte(); c != 0; c = (char)fs.ReadByte()) + sb.Append(c); + + // Write File + string FileName = sb.ToString().Replace('/', Path.DirectorySeparatorChar); + string FileDir = Path.GetDirectoryName(dir + FileName) + Path.DirectorySeparatorChar; + if (!Directory.Exists(FileDir)) + { + Console.WriteLine($"Making dir: {FileDir}"); + Directory.CreateDirectory(FileDir); + } + File.WriteAllBytes(dir + FileName, fileBuffer); } - return ret; + fs.Close(); + + return true; } - + // Unpacking internal static string unpackDARC(string path, string outFolder = null, bool delete = true) { @@ -668,45 +633,6 @@ public struct FARCFile public string Name; } - public class SARC - { - public string Signature; - public ushort HeaderSize = 0x14; - public ushort Endianness; - public uint FileSize; - public uint DataOffset; - public uint Unknown; - public SFAT SFat; - public SFNT SFnt; - - public string FileName; - public string FilePath; - public string Extension; - public bool valid; - } - public class SFAT - { - public string Signature; - public ushort HeaderSize; - public ushort EntryCount; - public uint HashMult; - public List Entries; - } - public class SFATEntry - { - public uint FileNameHash; - public uint FileNameOffset; - public uint FileDataStart; - public uint FileDataEnd; - } - public class SFNT - { - public string Signature; - public ushort HeaderSize; - public ushort Unknown; - public uint StringOffset; - } - public class ShuffleARC { public uint magic; //0xB From 22b79168b221d3d802717d63dc4da188e8623d10 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 30 Dec 2017 00:25:28 -0800 Subject: [PATCH 041/191] Add ALYT reading static method also provided to jump to just the interior contents, since gamefreak loves their container inception (ALYT->single SARC->files) usage: var alyt = new ALYT(path); File.WriteAllBytes(outpath1, alyt.Data); File.WriteAllBytes(outpath2, ALYT.GetData(path)); supports input of filepath/byte[]/stream --- pk3DS.Core/CTR/ALYT.cs | 236 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 232 insertions(+), 4 deletions(-) diff --git a/pk3DS.Core/CTR/ALYT.cs b/pk3DS.Core/CTR/ALYT.cs index a61734c6cf..01b66240b5 100644 --- a/pk3DS.Core/CTR/ALYT.cs +++ b/pk3DS.Core/CTR/ALYT.cs @@ -1,12 +1,240 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Collections.Generic; +using System.IO; using System.Text; -namespace CTR +namespace pk3DS.Core.CTR { + /// + /// Archive LaYouT container + /// + /// File length is padded to nearest 0x80 public class ALYT { + private const string Identifier = nameof(ALYT); + public string Magic; // 0x00 + public short unk4; // 0x04 + public short unk6; // 0x06 + public int LTBLOffset; // 0x08 + public int LTBLSize; // 0x0C + public int LMTLOffset; // 0x10 + public int LMTLSize; // 0x14 + public int LFNLOffset; // 0x18 + public int LFNLSize; // 0x1C + public int DataOffset; // 0x20 + public int DataSize; // 0x24 + + public LTBL LTBL; + public LMTL LMTL; + public LFNL LFNL; + public Contents Content; + public byte[] Data; + + public string FileName { get; } + public string FilePath { get; } + public string Extension { get; } + public bool SigMatches => Magic == Identifier; + + public ALYT(string path) + { + FileName = Path.GetFileNameWithoutExtension(path); + FilePath = Path.GetDirectoryName(path); + Extension = Path.GetExtension(path); + + using (var br = new BinaryReader(File.OpenRead(path))) + ReadALYT(br); + } + + public ALYT(byte[] data) + { + using (var ms = new MemoryStream(data)) + using (var br = new BinaryReader(ms)) + ReadALYT(br); + } + + public ALYT(Stream ms) + { + using (var br = new BinaryReader(ms)) + ReadALYT(br); + } + + private void ReadALYT(BinaryReader br) + { + ReadHeader(br); + LTBL = new LTBL(br, (LTBLSize - 8) / 4); + LMTL = new LMTL(br, (LMTLSize - 8) / 4); + LFNL = new LFNL(br, (LFNLSize - 8) / 4); + Content = new Contents(br, this); + } + + private void ReadHeader(BinaryReader br) + { + Magic = new string(br.ReadChars(4)); + if (!SigMatches) + return; + unk4 = br.ReadInt16(); + unk6 = br.ReadInt16(); + LTBLOffset = br.ReadInt32(); + LTBLSize = br.ReadInt32(); + LMTLOffset = br.ReadInt32(); + LMTLSize = br.ReadInt32(); + LFNLOffset = br.ReadInt32(); + LFNLSize = br.ReadInt32(); + DataOffset = br.ReadInt32(); + DataSize = br.ReadInt32(); + } + + public class Contents + { + public readonly string[] Labels; + public readonly string[] Symbols; + + public Contents(BinaryReader br, ALYT alyt) + { + br.BaseStream.Position = alyt.DataOffset; + Labels = new string[br.ReadInt32()]; + for (int i = 0; i < Labels.Length; i++) + Labels[i] = ReadString(br, 0x40); + + Symbols = new string[br.ReadInt32()]; + for (int i = 0; i < Symbols.Length; i++) + Symbols[i] = ReadString(br, 0x20); + + // skip to end of section + // this is bad + while (br.PeekChar() == 0) + br.ReadByte(); + + int len = (int)br.BaseStream.Position - alyt.DataOffset; + len = alyt.DataSize - len; + alyt.Data = br.ReadBytes(len); + } + + public static string ReadString(BinaryReader br, int skip) + { + var sb = new StringBuilder(); + var ofs = br.BaseStream.Position; + while (true) + { + var c = (char)br.ReadByte(); + if (c == 0) + { + br.BaseStream.Position = ofs + skip; + return sb.ToString(); + } + sb.Append(c); + } + } + } + + /// + /// Rips out the data portion of the ALYT, assuming the ALYT is partially valid. + /// + public static byte[] GetData(string path) + { + using (var br = new BinaryReader(File.OpenRead(path))) + return GetData(br); + } + /// + /// Rips out the data portion of the ALYT, assuming the ALYT is partially valid. + /// + public static byte[] GetData(byte[] data) + { + using (var ms = new MemoryStream(data)) + using (var br = new BinaryReader(ms)) + return GetData(br); + } + /// + /// Rips out the data portion of the ALYT, assuming the ALYT is partially valid. + /// + public static byte[] GetData(Stream ms) + { + using (var br = new BinaryReader(ms)) + return GetData(br); + } + private static byte[] GetData(BinaryReader br) + { + if (br.BaseStream.Length <= 0x80) + return null; + if (Identifier != new string(br.ReadChars(4))) + return null; // not ALYT + + br.BaseStream.Position = 0x20; // DataOffset + int start = br.ReadInt32(); + int length = br.ReadInt32(); + + br.BaseStream.Position = start; + int count40 = br.ReadInt32(); + br.BaseStream.Position += count40 * 0x40; + + int count20 = br.ReadInt32(); + br.BaseStream.Position += count20 * 0x20; + + // skip to end of section + // this is bad + while (br.PeekChar() == 0) + br.ReadByte(); + + int len = (int)br.BaseStream.Position - start; + len = length - len; + return br.ReadBytes(len); + } + } + + public class LTBL + { + private const string Identifier = nameof(LTBL); + public string Magic; // 0x00 + public short unk4; // 0x04 + public short unk6; // 0x06 + public List Values; + + public LTBL(BinaryReader br, int count) + { + Magic = new string(br.ReadChars(Identifier.Length)); + unk4 = br.ReadInt16(); + unk6 = br.ReadInt16(); + Values = new List(count); + for (int i = 0; i < count; i++) + Values.Add((short)br.ReadInt32()); + } + } + + public class LMTL + { + private const string Identifier = nameof(LMTL); + public string Magic; // 0x00 + public short unk4; // 0x04 + public short unk6; // 0x06 + public List Values; + + public LMTL(BinaryReader br, int count) + { + Magic = new string(br.ReadChars(Identifier.Length)); + unk4 = br.ReadInt16(); + unk6 = br.ReadInt16(); + Values = new List(count); + for (int i = 0; i < count; i++) + Values.Add((short)br.ReadInt32()); + } + } + + public class LFNL + { + private const string Identifier = nameof(LFNL); + public string Magic; // 0x00 + public short unk4; // 0x04 + public short unk6; // 0x06 + public List Values; + + public LFNL(BinaryReader br, int count) + { + Magic = new string(br.ReadChars(Identifier.Length)); + unk4 = br.ReadInt16(); + unk6 = br.ReadInt16(); + Values = new List(count); + for (int i = 0; i < count; i++) + Values.Add((short)br.ReadInt32()); + } } } From 327178a2cd914ae65f3dbc8893ee88f3db175e6f Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 30 Dec 2017 13:01:50 -0500 Subject: [PATCH 042/191] Revise ORAS trainer class blacklisting --- pk3DS.Core/Legality/Legal.cs | 11 ++++++----- pk3DS/Subforms/Gen6/RSTE.cs | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index b0ac292434..bc649d9d9e 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -284,12 +284,13 @@ public static partial class Legal 267, // Pokémon Trainer (Zinnia) 272, // Pokémon Trainer (Wally) }; - public static readonly int[] Ignore_AO = + public static readonly int[] TrainerClasses_AO = { - 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, - 038, 039, 040, 041, 042, 043, 044, 045, 046, 047, 048, 049, 050, 051, 052, 053, 054, 055, 056, 057, 058, 059, 060, 061, 062, 063, 064, 065, 066, 067, 068, 069, 070, 071, 072, 073, 074, - 075, 076, 077, 078, 079, 080, 081, 082, 083, 084, 085, 086, 087, 088, 089, 090, 091, 092, 093, 094, 095, 096, 097, 098, 099, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126 + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, }; public static readonly int[] Z_Moves = { diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index cb13bec680..adb9f81816 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -24,7 +24,7 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); rModelRestricted = Main.Config.ORAS ? Legal.Model_AO : Legal.Model_XY; - rXYBlacklist = Legal.Ignore_AO; + rTrainerClasses = Legal.TrainerClasses_AO; InitializeComponent(); // String Fetching @@ -531,7 +531,7 @@ private void Setup() public static int rDMGCount, rSTABCount; private int[] mEvoTypes; private static int[] rModelRestricted; - private static int[] rXYBlacklist; + private static int[] rTrainerClasses; private string[] rImportant; private readonly List Tags = new List(); private readonly Dictionary TagTypes = new Dictionary(); @@ -748,10 +748,10 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~")); // don't allow disallowed classes t.Class = rv; - if (Main.Config.ORAS && rXYBlacklist.Contains(t.Class)) // Classes 0-126 are leftover from XY and some can crash the game; skip all of them + if (Main.Config.ORAS && t.Class <= 126) // 0 to 126 from XY, re-randomize to something from ORAS { - for (int i = 127; i <= 279; i++) - t.Class = i; + int fixClass() => (int)(rnd32() % rTrainerClasses.Length); + t.Class = rTrainerClasses[fixClass()]; } } } From 2fcf879ea1a2e1930d41eb9ae8cafc5d62afe3ed Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 30 Dec 2017 12:40:41 -0800 Subject: [PATCH 043/191] Move SARC dump code into core project more logic in sarc object; maintain stream inside object until disposed add xmldoc --- pk3DS.Core/CTR/SARC.cs | 191 +++++++++++++++++++++++++++++++++++++---- pk3DS/ARCUtil.cs | 41 ++------- 2 files changed, 181 insertions(+), 51 deletions(-) diff --git a/pk3DS.Core/CTR/SARC.cs b/pk3DS.Core/CTR/SARC.cs index 80bfeb91c0..7ef4f79e89 100644 --- a/pk3DS.Core/CTR/SARC.cs +++ b/pk3DS.Core/CTR/SARC.cs @@ -1,10 +1,15 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; +using System.Text; namespace pk3DS.Core.CTR { - public class SARC + /// + /// Simple (?) ARChive + /// + public class SARC : IDisposable { private const string Identifier = nameof(SARC); @@ -24,28 +29,61 @@ public class SARC public string Extension; public readonly bool Valid; + /// + /// The required matches the first 4 bytes of the file data. + /// public bool SigMatches => Magic == Identifier; + private readonly Stream stream; + private readonly BinaryReader br; + /// + /// Initializes an empty . + /// public SARC() { SFAT = new SFAT(); SFNT = new SFNT(); } + /// + /// Initializes a from a file location. + /// + /// public SARC(string path) { - FileName = Path.GetFileNameWithoutExtension(path); - FilePath = Path.GetDirectoryName(path); - Extension = Path.GetExtension(path); + SetFileInfo(path); - using (var br = new BinaryReader(File.OpenRead(path))) - { - ReadHeader(br); - SFAT = new SFAT(br); - SFNT = new SFNT(br); - } + stream = File.OpenRead(path); + br = new BinaryReader(stream); + ReadSARC(); + Valid = true; + } + /// + /// Initializes a from a provided stream. + /// + /// + public SARC(Stream fs) + { + stream = fs; + br = new BinaryReader(stream); + ReadSARC(); Valid = true; } - private void ReadHeader(BinaryReader br) + /// + /// Initializes a from a provided array. + /// + /// + public SARC(byte[] data) + { + stream = new MemoryStream(data); + br = new BinaryReader(stream); + ReadSARC(); + Valid = true; + } + + /// + /// Reads the contents of the header and file info tables. + /// + private void ReadSARC() { Magic = new string(br.ReadChars(4)); if (!SigMatches) @@ -56,11 +94,119 @@ private void ReadHeader(BinaryReader br) FileSize = br.ReadUInt32(); DataOffset = br.ReadUInt32(); Unknown = br.ReadUInt32(); + + SFAT = new SFAT(br); + SFNT = new SFNT(br); + } + + /// + /// Sets File information for the original file. + /// + /// + public void SetFileInfo(string path) + { + FileName = Path.GetFileNameWithoutExtension(path); + FilePath = Path.GetDirectoryName(path); + Extension = Path.GetExtension(path); + } + + /// + /// Gets the entry filename for a given . + /// + /// Entry to fetch data for + /// File Name + public string GetFileName(SFATEntry entry) => GetFileName(entry.FileNameOffset); + + /// + /// Gets the entry data for a given , + /// + /// Entry to fetch data for + /// Data array + public byte[] GetData(SFATEntry entry) => GetData(entry.FileDataStart, entry.FileDataLength); + /// + /// Overwrites the entry data, assuming the size is the exact same. + /// + /// File entry to overwrite + /// Data to write + public void SetData(SFATEntry entry, byte[] data) + { + if (data.Length != entry.FileDataLength) + throw new ArgumentException(nameof(data.Length)); + SetData(entry.FileDataStart, data); + } + /// + /// Exports the entry data for a given at a provided path with its assigned file name via the name table. + /// + /// Entry to export + /// Path to export to. If left null, will output to the FilePath, if it is assigned. + public void ExportFile(SFATEntry t, string outpath = null) + { + outpath = outpath ?? FilePath; + byte[] data = GetData(t); + string name = GetFileName(t); + + string dir = Path.GetDirectoryName(name); + if (dir == null) + throw new ArgumentException(name); + string location = Path.Combine(outpath, dir); + Directory.CreateDirectory(location); + + var filepath = Path.Combine(outpath, name); + File.WriteAllBytes(filepath, data); + } + + private string GetFileName(int offset) + { + stream.Seek(SFNT.StringOffset, SeekOrigin.Begin); + stream.Seek((offset & 0x00FFFFFF) * 4, SeekOrigin.Current); + StringBuilder sb = new StringBuilder(); + for (char c = (char)stream.ReadByte(); c != 0; c = (char)stream.ReadByte()) + sb.Append(c); + + string name = sb.ToString().Replace('/', Path.DirectorySeparatorChar); + return name; + } + private void SetFileName(int offset, string value) + { + var str = value.Replace(Path.DirectorySeparatorChar, '/'); + stream.Seek(SFNT.StringOffset, SeekOrigin.Begin); + stream.Seek((offset & 0x00FFFFFF) * 4, SeekOrigin.Current); + foreach (var b in str) + stream.WriteByte((byte)b); + stream.WriteByte((byte)'\0'); + } + private byte[] GetData(int offset, int length) + { + byte[] fileBuffer = new byte[length]; + stream.Seek(offset + DataOffset, SeekOrigin.Begin); + stream.Read(fileBuffer, 0, length); + return fileBuffer; + } + private void SetData(int offset, byte[] data) + { + stream.Seek(offset + DataOffset, SeekOrigin.Begin); + stream.Write(data, 0, data.Length); + } + + /// + /// Disposes of the and objects and frees the if originally loaded from that location. + /// + public void Dispose() + { + stream?.Dispose(); + br?.Dispose(); } } + + /// + /// File Access Table + /// public class SFAT { public const string Identifier = nameof(SFAT); + /// + /// The required matches the first 4 bytes of the file data. + /// public bool SigMatches => Magic == Identifier; public string Magic; @@ -85,9 +231,15 @@ public SFAT(BinaryReader br) Entries.Add(new SFATEntry(br)); } } + /// + /// File Name Table + /// public class SFNT { public const string Identifier = nameof(SFNT); + /// + /// The required matches the first 4 bytes of the file data. + /// public bool SigMatches => Magic == Identifier; public string Magic; @@ -107,19 +259,24 @@ public SFNT(BinaryReader br) StringOffset = (uint)br.BaseStream.Position; } } + /// + /// File Access Table () Entry + /// public class SFATEntry { public uint FileNameHash; - public uint FileNameOffset; - public uint FileDataStart; - public uint FileDataEnd; + public int FileNameOffset; + public int FileDataStart; + public int FileDataEnd; + + public int FileDataLength => FileDataEnd - FileDataStart; public SFATEntry(BinaryReader br) { FileNameHash = br.ReadUInt32(); - FileNameOffset = br.ReadUInt32(); - FileDataStart = br.ReadUInt32(); - FileDataEnd = br.ReadUInt32(); + FileNameOffset = br.ReadInt32(); + FileDataStart = br.ReadInt32(); + FileDataEnd = br.ReadInt32(); } } } \ No newline at end of file diff --git a/pk3DS/ARCUtil.cs b/pk3DS/ARCUtil.cs index d33ea4dbd0..a84c6d6f0d 100644 --- a/pk3DS/ARCUtil.cs +++ b/pk3DS/ARCUtil.cs @@ -385,7 +385,7 @@ internal static string Interpret(string path) UnpackShuffleARC(path, sharc, ret); } else if (sarc.Valid) - UnpackSARC(path, sarc); + UnpackSARC(sarc); else { ret = "Not a valid .DARC/.FARC/.SARC/.GAR/Shuffle Archive file"; @@ -421,43 +421,16 @@ private static bool UnpackShuffleARC(string path, ShuffleARC sharc, string ret) return true; } - private static bool UnpackSARC(string path, SARC sarc) + public static bool UnpackSARC(SARC sarc) { Debug.WriteLine($"New SARC with {sarc.SFAT.EntryCount} files."); - string dir = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + sarc.FileName + "_" + Path.DirectorySeparatorChar; - if (!Directory.Exists(dir)) - { - Debug.WriteLine($"Making dir: {dir}"); - Directory.CreateDirectory(dir); - } - var fs = File.OpenRead(path); - foreach (SFATEntry t in sarc.SFAT.Entries) - { - // Read File Data - uint FileLen = t.FileDataEnd - t.FileDataStart; - fs.Seek(t.FileDataStart + sarc.DataOffset, SeekOrigin.Begin); - byte[] fileBuffer = new byte[FileLen]; - fs.Read(fileBuffer, 0, (int)FileLen); + string outfolder = $"{sarc.FileName}_sarc"; + string outpath = Path.Combine(sarc.FilePath, outfolder); + Directory.CreateDirectory(outpath); - // Read File Name - fs.Seek(sarc.SFNT.StringOffset, SeekOrigin.Begin); - fs.Seek((t.FileNameOffset & 0x00FFFFFF) * 4, SeekOrigin.Current); - StringBuilder sb = new StringBuilder(); - for (char c = (char)fs.ReadByte(); c != 0; c = (char)fs.ReadByte()) - sb.Append(c); - - // Write File - string FileName = sb.ToString().Replace('/', Path.DirectorySeparatorChar); - string FileDir = Path.GetDirectoryName(dir + FileName) + Path.DirectorySeparatorChar; - if (!Directory.Exists(FileDir)) - { - Console.WriteLine($"Making dir: {FileDir}"); - Directory.CreateDirectory(FileDir); - } - File.WriteAllBytes(dir + FileName, fileBuffer); - } - fs.Close(); + foreach (SFATEntry t in sarc.SFAT.Entries) + sarc.ExportFile(t, outpath); return true; } From 50ce46e9f67c18e395193c4abf8bad71917e3a5d Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 30 Dec 2017 12:48:03 -0800 Subject: [PATCH 044/191] Add SARC dumping in core project as easy as: new SARC(path).Dump(); --- pk3DS.Core/CTR/SARC.cs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/pk3DS.Core/CTR/SARC.cs b/pk3DS.Core/CTR/SARC.cs index 7ef4f79e89..433185db02 100644 --- a/pk3DS.Core/CTR/SARC.cs +++ b/pk3DS.Core/CTR/SARC.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Text; @@ -155,6 +154,30 @@ public void ExportFile(SFATEntry t, string outpath = null) File.WriteAllBytes(filepath, data); } + /// + /// Dumps the contents of the to a provided folder. If no location is provided, it will dump to the SARC's location. + /// + /// Path to create dump folder in + /// Folder to dump contents to + public void Dump(string path = null, string folder = null) + { + path = path ?? FilePath; + if (path == null) + throw new ArgumentNullException(nameof(path)); + if (File.Exists(path)) + path = Path.GetDirectoryName(path); + if (path == null) + throw new ArgumentNullException(nameof(path)); + + folder = folder ?? FileName ?? "sarc"; + string dir = Path.Combine(path, folder); + + Directory.CreateDirectory(dir); + + foreach (SFATEntry t in SFAT.Entries) + ExportFile(t, dir); + } + private string GetFileName(int offset) { stream.Seek(SFNT.StringOffset, SeekOrigin.Begin); From ff44078b3b3456156e04e6cb329d122e86896883 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 30 Dec 2017 17:23:54 -0800 Subject: [PATCH 045/191] add bflim reading can't convert to image, can only rip out data portions no plans on continuing, might just rely on other projects --- pk3DS.Core/CTR/BFLIM.cs | 315 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 pk3DS.Core/CTR/BFLIM.cs diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs new file mode 100644 index 0000000000..0a42ed8381 --- /dev/null +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -0,0 +1,315 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace pk3DS.Core.CTR +{ + public class BFLIM + { + public byte[] PixelData; + public FLIM Footer; + + public BFLIM(Stream data) => ReadBFLIM(data); + public BFLIM(byte[] data) + { + using (var ms = new MemoryStream(data)) + ReadBFLIM(ms); + } + public BFLIM(string path) + { + var data = File.ReadAllBytes(path); + using (var ms = new MemoryStream(data)) + ReadBFLIM(ms); + } + + private void ReadBFLIM(Stream ms) + { + PixelData = new byte[ms.Length - FLIM.SIZE]; + ms.Read(PixelData, 0, PixelData.Length); + var footer = new byte[FLIM.SIZE]; + ms.Read(footer, 0, footer.Length); + Footer = footer.ToStructure(); + } + + /// + /// ARGB 32bpp + /// + public byte[] GetImageData() + { + uint[] pixels = GetPixels(); + + int p = gcm(Footer.Width, 8) / 8; + if (p == 0) p = 1; + // uint[] -> byte[] + byte[] array = new byte[Footer.Width * Footer.Height * 4]; + for (int i = 0; i < array.Length; i += 4) + { + int o = GetOffset((uint)i, Footer.Width, p); + if (o + 3 >= array.Length) + continue; + var val = pixels[i / 4]; + array[o + 0] = (byte)(val & 0xFF); + array[o + 1] = (byte)(val >> 8 & 0xFF); + array[o + 2] = (byte)(val >> 16 & 0xFF); + array[o + 3] = (byte)(val >> 24 & 0xFF); + } + return array; + } + public uint[] GetPixels() + { + return PixelConverter.GetPixels(PixelData, (BFLIMEncoding)Footer.Format).ToArray(); + } + + internal static int gcm(int n, int m) + { + return (n + m - 1) / m * m; + } + private int GetOffset(uint i, ushort footerWidth, int p) + { + BCLIM.d2xy(i % 64, out uint x, out uint y); + var tile = i / 64; + + // Shift Tile Coordinate into Tilemap + x += (uint)(tile % p) * 8; + y += (uint)(tile / p) * 8; + if (x > footerWidth) + return int.MaxValue; + + return 4 * (int)(x + y * footerWidth); + } + + /// + /// Decimal Ordinate In to X / Y Coordinate Out + /// + /// Loop integer which will be decoded to X/Y + /// Output X coordinate + /// Output Y coordinate + internal static void d2xy(uint d, out uint x, out uint y) + { + x = d; + y = x >> 1; + x &= 0x55555555; + y &= 0x55555555; + x |= x >> 1; + y |= y >> 1; + x &= 0x33333333; + y &= 0x33333333; + x |= x >> 2; + y |= y >> 2; + x &= 0x0f0f0f0f; + y &= 0x0f0f0f0f; + x |= x >> 4; + y |= y >> 4; + x &= 0x00ff00ff; + y &= 0x00ff00ff; + x |= x >> 8; + y |= y >> 8; + x &= 0x0000ffff; + y &= 0x0000ffff; + } + } + + public struct FLIM + { + public const int SIZE = 40; + public bool Valid => LittleEndian && Magic == 0x4D_49_4C_46; // FLIM + public bool LittleEndian => BOM == 0xFEFF; + public bool BigEndian => BOM == 0xFFFE; + + public uint Magic; // FLIM + public ushort BOM; // 0xFFFE + public ushort HeaderLength; // always 0x14 + public int Version; + public uint TotalLength; + public uint Count; + + public uint imag; // imag = 67616D69 + public uint imagLength; // always 0x10 + public ushort Width; + public ushort Height; + public short Alignment; + public byte Format; + public byte Orientation; + public uint DataSize; + } + + public enum BFLIMEncoding + { + L8_UNORM = 0x00, // 8 Luminance + A8_UNORM = 0x01, // 8 Alpha + LA4_UNORM = 0x02, // 8 Luminance + Alpha + LA8_UNORM = 0x03, // 16 Luminance + Alpha + HILO8 = 0x04, // 16 ? + RGB565_UNORM = 0x05, // 16 Color + RGBX8_UNORM = 0x06, // 32 Color + RGB5A1_UNORM = 0x07, // 16 Color + Alpha + RGBA4_UNORM = 0x08, // 16 Color + Alpha + RGBA8_UNORM = 0x09, // 32 Color + Alpha + ETC1_UNORM = 0x0A, // 4 Color + ETC1A4_UNORM = 0x0B, // 8 Color + Alpha + BC1_UNORM = 0x0C, // 4 Color + Alpha + BC2_UNORM = 0x0D, // 8 Color + Alpha + BC3_UNORM = 0x0E, // 8 Color + Alpha + BC4L_UNORM = 0x0F, // 4 Luminance + BC4A_UNORM = 0x10, // 4 Alpha + BC5_UNORM = 0x11, // 8 Red + Green + Alpha + L4_UNORM = 0x12, // 4 Luminance + A4_UNORM = 0x13, // 4 Alpha + RGBA8_SRGB = 0x14, // 32 Color + Alpha + BC1_SRGB = 0x15, // 4 Color + Alpha + BC2_SRGB = 0x16, // 8 Color + Alpha + BC3_SRGB = 0x17, // 8 Color + Alpha + RGB10A2_UNORM = 0x18, // 32 Color + Alpha + RGB565_INDIRECT_UNORM = 0x19, // 16 Color? + } + + public static class PixelConverter + { + public static IEnumerable GetPixels(byte[] raw, BFLIMEncoding e) + { + int bpp = e.GetBitsPerPixel(); + if (bpp == BPP_4) + { + foreach (byte b in raw) + { + byte _0 = (byte)(b & 0xF); + byte _1 = (byte)(b >> 4); + yield return GetDecodedPixelValue(_0, e); + yield return GetDecodedPixelValue(_1, e); + } + yield break; + } + + for (int i = 0; i < raw.Length; i += bpp / 8) + { + uint val = GetEncodedPixelValue(raw, i, bpp); + yield return GetDecodedPixelValue(val, e); + } + } + + internal static readonly byte[] Convert5To8 = { + 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, + 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, + 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, + 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF + }; + + private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) + { + byte a = byte.MaxValue, r = 0, g = 0, b = 0; + switch (e) + { + case BFLIMEncoding.L8_UNORM: + { + r = g = b = (byte)val; + break; + } + case BFLIMEncoding.A8_UNORM: + { + r = g = b = 0xFF; + a = (byte)val; + break; + } + case BFLIMEncoding.LA4_UNORM: + { + r = g = b = (byte)(val >> 4); + a = (byte)(val & 0x0F); + break; + } + case BFLIMEncoding.LA8_UNORM: + { + r = g = b = (byte)(val >> 8); + a = (byte)val; + break; + } + case BFLIMEncoding.RGBA8_UNORM: + { + return val; + } + case BFLIMEncoding.RGBA4_UNORM: + { + a = (byte)(0x11 * (val & 0xf)); + r = (byte)(0x11 * ((val >> 12) & 0xf)); + g = (byte)(0x11 * ((val >> 8) & 0xf)); + b= (byte)(0x11 * ((val >> 4) & 0xf)); + break; + } + case BFLIMEncoding.RGB565_UNORM: + { + r = Convert5To8[(val >> 11) & 0x1F]; + g = (byte)(((val >> 5) & 0x3F) * 4); + b = Convert5To8[val & 0x1F]; + break; + } + case BFLIMEncoding.RGB5A1_UNORM: + { + r = Convert5To8[(val >> 11) & 0x1F]; + g = Convert5To8[(val >> 6) & 0x1F]; + b = Convert5To8[(val >> 1) & 0x1F]; + a = (val & 0x0001) == 1 ? byte.MaxValue : byte.MinValue; + break; + } + default: + throw new FormatException($"Unsupported {nameof(BFLIMEncoding)} value = {e}"); + } + return (uint)((a << 24) | (r << 16) | (g << 8) | b); + } + + public static uint GetEncodedPixelValue(byte[] raw, int offset, int size) + { + switch (size) + { + case BPP_32: + return BitConverter.ToUInt32(raw, offset); + case BPP_16: + return BitConverter.ToUInt16(raw, offset); + default: + return raw[offset]; + } + } + public static int GetBitsPerPixel(this BFLIMEncoding e) + { + if (_32.Contains(e)) + return BPP_32; + if (_16.Contains(e)) + return BPP_16; + if (_8.Contains(e)) + return BPP_8; + return BPP_4; + } + private const int BPP_32 = 32; + private const int BPP_16 = 16; + private const int BPP_8 = 8; + private const int BPP_4 = 4; + private static readonly HashSet _32 = new HashSet + { + BFLIMEncoding.RGBX8_UNORM, + BFLIMEncoding.RGBA8_UNORM, + BFLIMEncoding.RGBA8_SRGB, + BFLIMEncoding.RGB10A2_UNORM, + }; + private static readonly HashSet _16 = new HashSet + { + BFLIMEncoding.LA8_UNORM, + BFLIMEncoding.HILO8, + BFLIMEncoding.RGB565_UNORM, + BFLIMEncoding.RGB565_INDIRECT_UNORM, + BFLIMEncoding.RGB5A1_UNORM, + BFLIMEncoding.RGBA4_UNORM, + }; + private static readonly HashSet _8 = new HashSet + { + BFLIMEncoding.L8_UNORM, + BFLIMEncoding.A8_UNORM, + BFLIMEncoding.LA4_UNORM, + BFLIMEncoding.ETC1A4_UNORM, + BFLIMEncoding.BC2_UNORM, + BFLIMEncoding.BC3_UNORM, + BFLIMEncoding.BC5_UNORM, + BFLIMEncoding.BC2_SRGB, + BFLIMEncoding.BC3_SRGB, + }; + } +} From ffc9b69b7b5039b15b27494a1d2bfe23fc4f562b Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 30 Dec 2017 21:40:59 -0500 Subject: [PATCH 046/191] Add force fully evolved for RSTE --- pk3DS/Subforms/Gen6/RSTE.cs | 21 +++- pk3DS/Subforms/Gen6/TrainerRand.Designer.cs | 124 ++++++++++++-------- pk3DS/Subforms/Gen6/TrainerRand.cs | 2 + 3 files changed, 97 insertions(+), 50 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index adb9f81816..3eebe25807 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -25,6 +25,7 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); rModelRestricted = Main.Config.ORAS ? Legal.Model_AO : Legal.Model_XY; rTrainerClasses = Legal.TrainerClasses_AO; + rFinalEvo = Legal.FinalEvolutions_6; InitializeComponent(); // String Fetching @@ -510,7 +511,7 @@ private void Setup() CB_Battle_Type.Items.Add("Double"); CB_Battle_Type.Items.Add("Triple"); CB_Battle_Type.Items.Add("Rotation"); - CB_Battle_Type.Items.Add("Horde"); + if (Main.Config.ORAS) CB_Battle_Type.Items.Add("Horde"); megaEvos = Main.Config.ORAS ? new[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 } : new[] { 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 }; @@ -522,7 +523,7 @@ private void Setup() public static bool rPKM, rSmart, rLevel, rMove, rNoMove, rAbility, rDiffAI, rDiffIV, rClass, rGift, rItem, rDoRand, rRandomMegas, rGymE4Only, - rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM; + rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM, rForceFullyEvolved; public static bool rNoFixedDamage; internal static bool[] rThemedClasses = { }; private static string[] rTags; @@ -532,15 +533,17 @@ private void Setup() private int[] mEvoTypes; private static int[] rModelRestricted; private static int[] rTrainerClasses; + private static int[] rFinalEvo; private string[] rImportant; private readonly List Tags = new List(); private readonly Dictionary TagTypes = new Dictionary(); public static int[] sL; // Random Species List - public static decimal rGiftPercent, rLevelMultiplier; + public static decimal rGiftPercent, rLevelMultiplier, rForceFullyEvolvedLevel; private void B_Randomize_Click(object sender, EventArgs e) { rPKM = rMove = rAbility = rDiffAI = rDiffIV = rClass = rGift = rItem = rDoRand = false; // init to false - rGiftPercent = 0; // 0 + rGiftPercent = 0; + rForceFullyEvolvedLevel = 0; new TrainerRand().ShowDialog(); // Open Randomizer Config to get config vals if (rDoRand) Randomize(); @@ -699,6 +702,16 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom for (int m = 0; m < 4; m++) pk.Moves[m] = (ushort)pkMoves[m]; } + + if (rForceFullyEvolved && pk.Level >= rForceFullyEvolvedLevel) + { + if (!rFinalEvo.Contains(pk.Species)) + { + int randFinalEvo() => (int)(Util.rnd32() % rFinalEvo.Length); + pk.Species = (ushort)rFinalEvo[randFinalEvo()]; + pk.Form = (ushort)Randomizer.GetRandomForme(pk.Species, rRandomMegas, true, Main.SpeciesStat); + } + } } } private static void InitializeTrainerTeamInfo(trdata6 t, bool important) diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index c4819b781f..f550289883 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -66,11 +66,14 @@ private void InitializeComponent() this.CB_Moves = new System.Windows.Forms.ComboBox(); this.L_Moves = new System.Windows.Forms.Label(); this.CHK_NoFixedDamage = new System.Windows.Forms.CheckBox(); + this.NUD_Force = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GiftPercent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); this.GB_Tweak.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Force)).BeginInit(); this.SuspendLayout(); // // CHK_RandomPKM @@ -78,7 +81,7 @@ private void InitializeComponent() this.CHK_RandomPKM.AutoSize = true; this.CHK_RandomPKM.Checked = true; this.CHK_RandomPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomPKM.Location = new System.Drawing.Point(12, 31); + this.CHK_RandomPKM.Location = new System.Drawing.Point(12, 26); this.CHK_RandomPKM.Name = "CHK_RandomPKM"; this.CHK_RandomPKM.Size = new System.Drawing.Size(114, 17); this.CHK_RandomPKM.TabIndex = 0; @@ -92,7 +95,7 @@ private void InitializeComponent() this.CHK_RandomItems.AutoSize = true; this.CHK_RandomItems.Checked = true; this.CHK_RandomItems.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomItems.Location = new System.Drawing.Point(21, 295); + this.CHK_RandomItems.Location = new System.Drawing.Point(21, 314); this.CHK_RandomItems.Name = "CHK_RandomItems"; this.CHK_RandomItems.Size = new System.Drawing.Size(119, 17); this.CHK_RandomItems.TabIndex = 6; @@ -105,7 +108,7 @@ private void InitializeComponent() this.CHK_RandomAbilities.AutoSize = true; this.CHK_RandomAbilities.Checked = true; this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 310); + this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 329); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); this.CHK_RandomAbilities.TabIndex = 7; @@ -118,7 +121,7 @@ private void InitializeComponent() this.CHK_RandomGift.AutoSize = true; this.CHK_RandomGift.Checked = true; this.CHK_RandomGift.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomGift.Location = new System.Drawing.Point(21, 389); + this.CHK_RandomGift.Location = new System.Drawing.Point(21, 408); this.CHK_RandomGift.Name = "CHK_RandomGift"; this.CHK_RandomGift.Size = new System.Drawing.Size(145, 17); this.CHK_RandomGift.TabIndex = 10; @@ -132,7 +135,7 @@ private void InitializeComponent() this.CHK_RandomClass.AutoSize = true; this.CHK_RandomClass.Checked = true; this.CHK_RandomClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomClass.Location = new System.Drawing.Point(21, 342); + this.CHK_RandomClass.Location = new System.Drawing.Point(21, 361); this.CHK_RandomClass.Name = "CHK_RandomClass"; this.CHK_RandomClass.Size = new System.Drawing.Size(141, 17); this.CHK_RandomClass.TabIndex = 9; @@ -146,7 +149,7 @@ private void InitializeComponent() this.CHK_MaxDiffAI.AutoSize = true; this.CHK_MaxDiffAI.Checked = true; this.CHK_MaxDiffAI.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffAI.Location = new System.Drawing.Point(21, 404); + this.CHK_MaxDiffAI.Location = new System.Drawing.Point(21, 423); this.CHK_MaxDiffAI.Name = "CHK_MaxDiffAI"; this.CHK_MaxDiffAI.Size = new System.Drawing.Size(95, 17); this.CHK_MaxDiffAI.TabIndex = 13; @@ -159,7 +162,7 @@ private void InitializeComponent() this.CHK_MaxDiffPKM.AutoSize = true; this.CHK_MaxDiffPKM.Checked = true; this.CHK_MaxDiffPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(21, 325); + this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(21, 344); this.CHK_MaxDiffPKM.Name = "CHK_MaxDiffPKM"; this.CHK_MaxDiffPKM.Size = new System.Drawing.Size(64, 17); this.CHK_MaxDiffPKM.TabIndex = 8; @@ -169,7 +172,7 @@ private void InitializeComponent() // B_OK // this.B_OK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.B_OK.Location = new System.Drawing.Point(250, 374); + this.B_OK.Location = new System.Drawing.Point(250, 385); this.B_OK.Name = "B_OK"; this.B_OK.Size = new System.Drawing.Size(50, 23); this.B_OK.TabIndex = 14; @@ -180,7 +183,7 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.B_Cancel.Location = new System.Drawing.Point(250, 396); + this.B_Cancel.Location = new System.Drawing.Point(250, 407); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(50, 23); this.B_Cancel.TabIndex = 15; @@ -191,7 +194,7 @@ private void InitializeComponent() // NUD_GiftPercent // this.NUD_GiftPercent.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_GiftPercent.Location = new System.Drawing.Point(166, 386); + this.NUD_GiftPercent.Location = new System.Drawing.Point(166, 405); this.NUD_GiftPercent.Name = "NUD_GiftPercent"; this.NUD_GiftPercent.Size = new System.Drawing.Size(43, 20); this.NUD_GiftPercent.TabIndex = 11; @@ -206,7 +209,7 @@ private void InitializeComponent() // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(211, 388); + this.label1.Location = new System.Drawing.Point(211, 407); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(15, 13); this.label1.TabIndex = 12; @@ -221,7 +224,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_Level.Location = new System.Drawing.Point(141, 11); + this.NUD_Level.Location = new System.Drawing.Point(141, 6); this.NUD_Level.Maximum = new decimal(new int[] { 3, 0, @@ -245,7 +248,7 @@ private void InitializeComponent() // CHK_Level // this.CHK_Level.AutoSize = true; - this.CHK_Level.Location = new System.Drawing.Point(12, 12); + this.CHK_Level.Location = new System.Drawing.Point(12, 7); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 2; @@ -257,11 +260,12 @@ private void InitializeComponent() // this.GB_Tweak.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); + this.GB_Tweak.Controls.Add(this.NUD_Force); this.GB_Tweak.Controls.Add(this.CHK_GymE4Only); - this.GB_Tweak.Controls.Add(this.CHK_RandomMegaForm); - this.GB_Tweak.Controls.Add(this.CHK_6PKM); + this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); this.GB_Tweak.Controls.Add(this.CHK_GymTrainers); this.GB_Tweak.Controls.Add(this.CHK_StoryMEvos); + this.GB_Tweak.Controls.Add(this.CHK_RandomMegaForm); this.GB_Tweak.Controls.Add(this.CHK_TypeTheme); this.GB_Tweak.Controls.Add(this.CHK_BST); this.GB_Tweak.Controls.Add(this.CHK_E); @@ -272,9 +276,9 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(12, 54); + this.GB_Tweak.Location = new System.Drawing.Point(12, 49); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(270, 150); + this.GB_Tweak.Size = new System.Drawing.Size(270, 163); this.GB_Tweak.TabIndex = 323; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Options"; @@ -284,7 +288,7 @@ private void InitializeComponent() this.CHK_GymE4Only.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_GymE4Only.AutoSize = true; this.CHK_GymE4Only.Enabled = false; - this.CHK_GymE4Only.Location = new System.Drawing.Point(141, 126); + this.CHK_GymE4Only.Location = new System.Drawing.Point(141, 134); this.CHK_GymE4Only.Name = "CHK_GymE4Only"; this.CHK_GymE4Only.Size = new System.Drawing.Size(125, 17); this.CHK_GymE4Only.TabIndex = 295; @@ -295,7 +299,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 79); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 81); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 294; @@ -306,11 +310,11 @@ private void InitializeComponent() // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(141, 72); + this.CHK_6PKM.Location = new System.Drawing.Point(21, 215); this.CHK_6PKM.Name = "CHK_6PKM"; - this.CHK_6PKM.Size = new System.Drawing.Size(111, 30); + this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 293; - this.CHK_6PKM.Text = "Have 6 PKM for \r\nImportant Trainers"; + this.CHK_6PKM.Text = "6 Pokémon for Important Trainers"; this.CHK_6PKM.UseVisualStyleBackColor = true; this.CHK_6PKM.CheckedChanged += new System.EventHandler(this.CHK_6PKM_CheckedChanged); // @@ -319,7 +323,7 @@ private void InitializeComponent() this.CHK_GymTrainers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_GymTrainers.AutoSize = true; this.CHK_GymTrainers.Enabled = false; - this.CHK_GymTrainers.Location = new System.Drawing.Point(9, 126); + this.CHK_GymTrainers.Location = new System.Drawing.Point(9, 134); this.CHK_GymTrainers.Name = "CHK_GymTrainers"; this.CHK_GymTrainers.Size = new System.Drawing.Size(124, 17); this.CHK_GymTrainers.TabIndex = 292; @@ -332,18 +336,18 @@ private void InitializeComponent() this.CHK_StoryMEvos.AutoSize = true; this.CHK_StoryMEvos.Checked = true; this.CHK_StoryMEvos.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_StoryMEvos.Location = new System.Drawing.Point(141, 110); + this.CHK_StoryMEvos.Location = new System.Drawing.Point(9, 63); this.CHK_StoryMEvos.Name = "CHK_StoryMEvos"; - this.CHK_StoryMEvos.Size = new System.Drawing.Size(122, 17); + this.CHK_StoryMEvos.Size = new System.Drawing.Size(168, 17); this.CHK_StoryMEvos.TabIndex = 291; - this.CHK_StoryMEvos.Text = "Ensure Story MEvos"; + this.CHK_StoryMEvos.Text = "Ensure Story Mega Evolutions"; this.CHK_StoryMEvos.UseVisualStyleBackColor = true; // // CHK_TypeTheme // this.CHK_TypeTheme.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_TypeTheme.AutoSize = true; - this.CHK_TypeTheme.Location = new System.Drawing.Point(9, 110); + this.CHK_TypeTheme.Location = new System.Drawing.Point(9, 118); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); this.CHK_TypeTheme.TabIndex = 289; @@ -354,7 +358,7 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(141, 51); + this.CHK_BST.Location = new System.Drawing.Point(141, 46); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 288; @@ -366,7 +370,7 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(141, 36); + this.CHK_E.Location = new System.Drawing.Point(141, 31); this.CHK_E.Name = "CHK_E"; this.CHK_E.Size = new System.Drawing.Size(98, 17); this.CHK_E.TabIndex = 287; @@ -378,7 +382,7 @@ private void InitializeComponent() this.CHK_L.AutoSize = true; this.CHK_L.Checked = true; this.CHK_L.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_L.Location = new System.Drawing.Point(141, 21); + this.CHK_L.Location = new System.Drawing.Point(141, 16); this.CHK_L.Name = "CHK_L"; this.CHK_L.Size = new System.Drawing.Size(98, 17); this.CHK_L.TabIndex = 286; @@ -390,7 +394,7 @@ private void InitializeComponent() this.CHK_G6.AutoSize = true; this.CHK_G6.Checked = true; this.CHK_G6.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G6.Location = new System.Drawing.Point(75, 51); + this.CHK_G6.Location = new System.Drawing.Point(75, 46); this.CHK_G6.Name = "CHK_G6"; this.CHK_G6.Size = new System.Drawing.Size(55, 17); this.CHK_G6.TabIndex = 285; @@ -402,7 +406,7 @@ private void InitializeComponent() this.CHK_G5.AutoSize = true; this.CHK_G5.Checked = true; this.CHK_G5.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G5.Location = new System.Drawing.Point(75, 36); + this.CHK_G5.Location = new System.Drawing.Point(75, 31); this.CHK_G5.Name = "CHK_G5"; this.CHK_G5.Size = new System.Drawing.Size(55, 17); this.CHK_G5.TabIndex = 284; @@ -414,7 +418,7 @@ private void InitializeComponent() this.CHK_G4.AutoSize = true; this.CHK_G4.Checked = true; this.CHK_G4.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G4.Location = new System.Drawing.Point(75, 21); + this.CHK_G4.Location = new System.Drawing.Point(75, 16); this.CHK_G4.Name = "CHK_G4"; this.CHK_G4.Size = new System.Drawing.Size(55, 17); this.CHK_G4.TabIndex = 283; @@ -426,7 +430,7 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(9, 51); + this.CHK_G3.Location = new System.Drawing.Point(9, 46); this.CHK_G3.Name = "CHK_G3"; this.CHK_G3.Size = new System.Drawing.Size(55, 17); this.CHK_G3.TabIndex = 282; @@ -438,7 +442,7 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(9, 36); + this.CHK_G2.Location = new System.Drawing.Point(9, 31); this.CHK_G2.Name = "CHK_G2"; this.CHK_G2.Size = new System.Drawing.Size(55, 17); this.CHK_G2.TabIndex = 281; @@ -450,7 +454,7 @@ private void InitializeComponent() this.CHK_G1.AutoSize = true; this.CHK_G1.Checked = true; this.CHK_G1.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G1.Location = new System.Drawing.Point(9, 21); + this.CHK_G1.Location = new System.Drawing.Point(9, 16); this.CHK_G1.Name = "CHK_G1"; this.CHK_G1.Size = new System.Drawing.Size(55, 17); this.CHK_G1.TabIndex = 280; @@ -463,7 +467,7 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass.AutoSize = true; this.CHK_IgnoreSpecialClass.Checked = true; this.CHK_IgnoreSpecialClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(40, 358); + this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(40, 377); this.CHK_IgnoreSpecialClass.Name = "CHK_IgnoreSpecialClass"; this.CHK_IgnoreSpecialClass.Size = new System.Drawing.Size(133, 17); this.CHK_IgnoreSpecialClass.TabIndex = 324; @@ -476,7 +480,7 @@ private void InitializeComponent() this.CHK_OnlySingles.AutoSize = true; this.CHK_OnlySingles.Checked = true; this.CHK_OnlySingles.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_OnlySingles.Location = new System.Drawing.Point(40, 372); + this.CHK_OnlySingles.Location = new System.Drawing.Point(40, 391); this.CHK_OnlySingles.Name = "CHK_OnlySingles"; this.CHK_OnlySingles.Size = new System.Drawing.Size(114, 17); this.CHK_OnlySingles.TabIndex = 325; @@ -486,7 +490,7 @@ private void InitializeComponent() // NUD_Damage // this.NUD_Damage.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_Damage.Location = new System.Drawing.Point(213, 254); + this.NUD_Damage.Location = new System.Drawing.Point(213, 275); this.NUD_Damage.Maximum = new decimal(new int[] { 4, 0, @@ -507,7 +511,7 @@ private void InitializeComponent() this.CHK_Damage.AutoSize = true; this.CHK_Damage.Checked = true; this.CHK_Damage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Damage.Location = new System.Drawing.Point(21, 256); + this.CHK_Damage.Location = new System.Drawing.Point(21, 276); this.CHK_Damage.Name = "CHK_Damage"; this.CHK_Damage.Size = new System.Drawing.Size(192, 17); this.CHK_Damage.TabIndex = 327; @@ -520,7 +524,7 @@ private void InitializeComponent() this.CHK_STAB.AutoSize = true; this.CHK_STAB.Checked = true; this.CHK_STAB.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_STAB.Location = new System.Drawing.Point(21, 275); + this.CHK_STAB.Location = new System.Drawing.Point(21, 295); this.CHK_STAB.Name = "CHK_STAB"; this.CHK_STAB.Size = new System.Drawing.Size(172, 17); this.CHK_STAB.TabIndex = 328; @@ -530,7 +534,7 @@ private void InitializeComponent() // NUD_STAB // this.NUD_STAB.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_STAB.Location = new System.Drawing.Point(213, 275); + this.NUD_STAB.Location = new System.Drawing.Point(213, 296); this.NUD_STAB.Maximum = new decimal(new int[] { 4, 0, @@ -554,7 +558,7 @@ private void InitializeComponent() "Don\'t Modify", "Randomize All", "Use Levelup Only"}); - this.CB_Moves.Location = new System.Drawing.Point(67, 210); + this.CB_Moves.Location = new System.Drawing.Point(67, 251); this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(121, 21); this.CB_Moves.TabIndex = 330; @@ -564,7 +568,7 @@ private void InitializeComponent() // this.L_Moves.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.L_Moves.AutoSize = true; - this.L_Moves.Location = new System.Drawing.Point(19, 213); + this.L_Moves.Location = new System.Drawing.Point(19, 254); this.L_Moves.Name = "L_Moves"; this.L_Moves.Size = new System.Drawing.Size(42, 13); this.L_Moves.TabIndex = 331; @@ -575,20 +579,45 @@ private void InitializeComponent() this.CHK_NoFixedDamage.AutoSize = true; this.CHK_NoFixedDamage.Checked = true; this.CHK_NoFixedDamage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_NoFixedDamage.Location = new System.Drawing.Point(21, 237); + this.CHK_NoFixedDamage.Location = new System.Drawing.Point(21, 231); this.CHK_NoFixedDamage.Name = "CHK_NoFixedDamage"; this.CHK_NoFixedDamage.Size = new System.Drawing.Size(281, 17); this.CHK_NoFixedDamage.TabIndex = 332; this.CHK_NoFixedDamage.Text = "No Fixed Damage Moves (Dragon Rage/Sonic Boom)"; this.CHK_NoFixedDamage.UseVisualStyleBackColor = true; // + // NUD_Force + // + this.NUD_Force.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.NUD_Force.Location = new System.Drawing.Point(169, 98); + this.NUD_Force.Name = "NUD_Force"; + this.NUD_Force.Size = new System.Drawing.Size(43, 20); + this.NUD_Force.TabIndex = 334; + this.NUD_Force.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 99); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 333; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; + // // TrainerRand // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(304, 431); + this.ClientSize = new System.Drawing.Size(304, 447); this.Controls.Add(this.CHK_NoFixedDamage); this.Controls.Add(this.L_Moves); + this.Controls.Add(this.CHK_6PKM); this.Controls.Add(this.CB_Moves); this.Controls.Add(this.CHK_OnlySingles); this.Controls.Add(this.GB_Tweak); @@ -623,6 +652,7 @@ private void InitializeComponent() this.GB_Tweak.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Force)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -668,5 +698,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_RandomMegaForm; private System.Windows.Forms.CheckBox CHK_GymE4Only; private System.Windows.Forms.CheckBox CHK_NoFixedDamage; + private System.Windows.Forms.NumericUpDown NUD_Force; + private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index b73ed2d3d5..6b334a4535 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -72,6 +72,8 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.rGymE4Only = CHK_GymE4Only.Checked; RSTE.r6PKM = CHK_6PKM.Checked; RSTE.rRandomMegas = CHK_RandomMegaForm.Checked; + RSTE.rForceFullyEvolved = CHK_ForceFullyEvolved.Checked; + RSTE.rForceFullyEvolvedLevel = NUD_Force.Value; if (CHK_StoryMEvos.Checked) { From 3347feca2aedfe80be36d102a36788b62758f3d9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 30 Dec 2017 19:06:57 -0800 Subject: [PATCH 047/191] Cleanup remove non-3DS formats --- pk3DS.Core/CTR/BFLIM.cs | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs index 0a42ed8381..6b2b016ff0 100644 --- a/pk3DS.Core/CTR/BFLIM.cs +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; @@ -143,26 +142,14 @@ public enum BFLIMEncoding LA8_UNORM = 0x03, // 16 Luminance + Alpha HILO8 = 0x04, // 16 ? RGB565_UNORM = 0x05, // 16 Color - RGBX8_UNORM = 0x06, // 32 Color + RGBX8_UNORM = 0x06, // 24 Color RGB5A1_UNORM = 0x07, // 16 Color + Alpha RGBA4_UNORM = 0x08, // 16 Color + Alpha RGBA8_UNORM = 0x09, // 32 Color + Alpha ETC1_UNORM = 0x0A, // 4 Color ETC1A4_UNORM = 0x0B, // 8 Color + Alpha - BC1_UNORM = 0x0C, // 4 Color + Alpha - BC2_UNORM = 0x0D, // 8 Color + Alpha - BC3_UNORM = 0x0E, // 8 Color + Alpha - BC4L_UNORM = 0x0F, // 4 Luminance - BC4A_UNORM = 0x10, // 4 Alpha - BC5_UNORM = 0x11, // 8 Red + Green + Alpha - L4_UNORM = 0x12, // 4 Luminance - A4_UNORM = 0x13, // 4 Alpha - RGBA8_SRGB = 0x14, // 32 Color + Alpha - BC1_SRGB = 0x15, // 4 Color + Alpha - BC2_SRGB = 0x16, // 8 Color + Alpha - BC3_SRGB = 0x17, // 8 Color + Alpha - RGB10A2_UNORM = 0x18, // 32 Color + Alpha - RGB565_INDIRECT_UNORM = 0x19, // 16 Color? + L4_UNORM = 0x0C, // 4 Luminance + A4_UNORM = 0x0D, // 4 Alpha } public static class PixelConverter @@ -201,17 +188,26 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) byte a = byte.MaxValue, r = 0, g = 0, b = 0; switch (e) { + case BFLIMEncoding.L4_UNORM: case BFLIMEncoding.L8_UNORM: { r = g = b = (byte)val; break; } + case BFLIMEncoding.A4_UNORM: case BFLIMEncoding.A8_UNORM: { r = g = b = 0xFF; a = (byte)val; break; } + case BFLIMEncoding.HILO8: + { + r = (byte)(val >> 8); + g = (byte)(val & 0xFF); + b = byte.MaxValue; + break; + } case BFLIMEncoding.LA4_UNORM: { r = g = b = (byte)(val >> 4); @@ -224,6 +220,10 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) a = (byte)val; break; } + case BFLIMEncoding.RGBX8_UNORM: + { + return val | 0xFF000000; + } case BFLIMEncoding.RGBA8_UNORM: { return val; @@ -233,7 +233,7 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) a = (byte)(0x11 * (val & 0xf)); r = (byte)(0x11 * ((val >> 12) & 0xf)); g = (byte)(0x11 * ((val >> 8) & 0xf)); - b= (byte)(0x11 * ((val >> 4) & 0xf)); + b = (byte)(0x11 * ((val >> 4) & 0xf)); break; } case BFLIMEncoding.RGB565_UNORM: @@ -248,7 +248,7 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) r = Convert5To8[(val >> 11) & 0x1F]; g = Convert5To8[(val >> 6) & 0x1F]; b = Convert5To8[(val >> 1) & 0x1F]; - a = (val & 0x0001) == 1 ? byte.MaxValue : byte.MinValue; + a = (val & 1) == 1 ? byte.MaxValue : byte.MinValue; break; } default: @@ -263,6 +263,8 @@ public static uint GetEncodedPixelValue(byte[] raw, int offset, int size) { case BPP_32: return BitConverter.ToUInt32(raw, offset); + case BPP_24: + return BitConverter.ToUInt32(raw, offset) & 0x00FFFFFF; case BPP_16: return BitConverter.ToUInt16(raw, offset); default: @@ -273,6 +275,8 @@ public static int GetBitsPerPixel(this BFLIMEncoding e) { if (_32.Contains(e)) return BPP_32; + if (_24.Contains(e)) + return BPP_24; if (_16.Contains(e)) return BPP_16; if (_8.Contains(e)) @@ -280,22 +284,23 @@ public static int GetBitsPerPixel(this BFLIMEncoding e) return BPP_4; } private const int BPP_32 = 32; + private const int BPP_24 = 24; private const int BPP_16 = 16; private const int BPP_8 = 8; private const int BPP_4 = 4; private static readonly HashSet _32 = new HashSet { - BFLIMEncoding.RGBX8_UNORM, BFLIMEncoding.RGBA8_UNORM, - BFLIMEncoding.RGBA8_SRGB, - BFLIMEncoding.RGB10A2_UNORM, + }; + private static readonly HashSet _24 = new HashSet + { + BFLIMEncoding.RGBX8_UNORM, }; private static readonly HashSet _16 = new HashSet { BFLIMEncoding.LA8_UNORM, BFLIMEncoding.HILO8, BFLIMEncoding.RGB565_UNORM, - BFLIMEncoding.RGB565_INDIRECT_UNORM, BFLIMEncoding.RGB5A1_UNORM, BFLIMEncoding.RGBA4_UNORM, }; @@ -305,11 +310,6 @@ public static int GetBitsPerPixel(this BFLIMEncoding e) BFLIMEncoding.A8_UNORM, BFLIMEncoding.LA4_UNORM, BFLIMEncoding.ETC1A4_UNORM, - BFLIMEncoding.BC2_UNORM, - BFLIMEncoding.BC3_UNORM, - BFLIMEncoding.BC5_UNORM, - BFLIMEncoding.BC2_SRGB, - BFLIMEncoding.BC3_SRGB, }; } } From fc588e00db0086abd812572c165ee933fbada9f2 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 00:14:35 -0800 Subject: [PATCH 048/191] continued improvements can now convert some bflims to png, some are still tile scrambled (too fried atm to finish) --- pk3DS.Core/CTR/BFLIM.cs | 216 ++++++++++++++++++++++------------------ 1 file changed, 121 insertions(+), 95 deletions(-) diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs index 6b2b016ff0..d66fc19d82 100644 --- a/pk3DS.Core/CTR/BFLIM.cs +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.InteropServices; namespace pk3DS.Core.CTR { @@ -37,18 +39,20 @@ private void ReadBFLIM(Stream ms) /// public byte[] GetImageData() { + var orienter = new BFLIMOrienter(Footer.Width, Footer.Height, Footer.Orientation); uint[] pixels = GetPixels(); - int p = gcm(Footer.Width, 8) / 8; - if (p == 0) p = 1; // uint[] -> byte[] byte[] array = new byte[Footer.Width * Footer.Height * 4]; - for (int i = 0; i < array.Length; i += 4) + for (uint i = 0; i < pixels.Length; i++) { - int o = GetOffset((uint)i, Footer.Width, p); - if (o + 3 >= array.Length) + var coord = orienter.Get(i); + if (coord.X >= Footer.Width || coord.Y >= Footer.Height) continue; - var val = pixels[i / 4]; + + var val = pixels[i]; + Debug.WriteLine($"Writing {val:X8} for coord: X:{coord.X} | Y{coord.Y}"); + uint o = 4 * (coord.X + coord.Y * Footer.Width); array[o + 0] = (byte)(val & 0xFF); array[o + 1] = (byte)(val >> 8 & 0xFF); array[o + 2] = (byte)(val >> 16 & 0xFF); @@ -58,66 +62,19 @@ public byte[] GetImageData() } public uint[] GetPixels() { - return PixelConverter.GetPixels(PixelData, (BFLIMEncoding)Footer.Format).ToArray(); - } - - internal static int gcm(int n, int m) - { - return (n + m - 1) / m * m; - } - private int GetOffset(uint i, ushort footerWidth, int p) - { - BCLIM.d2xy(i % 64, out uint x, out uint y); - var tile = i / 64; - - // Shift Tile Coordinate into Tilemap - x += (uint)(tile % p) * 8; - y += (uint)(tile / p) * 8; - if (x > footerWidth) - return int.MaxValue; - - return 4 * (int)(x + y * footerWidth); - } - - /// - /// Decimal Ordinate In to X / Y Coordinate Out - /// - /// Loop integer which will be decoded to X/Y - /// Output X coordinate - /// Output Y coordinate - internal static void d2xy(uint d, out uint x, out uint y) - { - x = d; - y = x >> 1; - x &= 0x55555555; - y &= 0x55555555; - x |= x >> 1; - y |= y >> 1; - x &= 0x33333333; - y &= 0x33333333; - x |= x >> 2; - y |= y >> 2; - x &= 0x0f0f0f0f; - y &= 0x0f0f0f0f; - x |= x >> 4; - y |= y >> 4; - x &= 0x00ff00ff; - y &= 0x00ff00ff; - x |= x >> 8; - y |= y >> 8; - x &= 0x0000ffff; - y &= 0x0000ffff; + return PixelConverter.GetPixels(PixelData, Footer.Format).ToArray(); } } - + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct FLIM { public const int SIZE = 40; + public const string Identifier = "FLIM"; public bool Valid => LittleEndian && Magic == 0x4D_49_4C_46; // FLIM public bool LittleEndian => BOM == 0xFEFF; public bool BigEndian => BOM == 0xFFFE; - public uint Magic; // FLIM + public uint Magic; // FLIM public ushort BOM; // 0xFFFE public ushort HeaderLength; // always 0x14 public int Version; @@ -129,27 +86,27 @@ public struct FLIM public ushort Width; public ushort Height; public short Alignment; - public byte Format; - public byte Orientation; + public BFLIMEncoding Format; + public BFLIMOrientation Orientation; public uint DataSize; } - public enum BFLIMEncoding + public enum BFLIMEncoding : byte { - L8_UNORM = 0x00, // 8 Luminance - A8_UNORM = 0x01, // 8 Alpha - LA4_UNORM = 0x02, // 8 Luminance + Alpha - LA8_UNORM = 0x03, // 16 Luminance + Alpha - HILO8 = 0x04, // 16 ? - RGB565_UNORM = 0x05, // 16 Color - RGBX8_UNORM = 0x06, // 24 Color - RGB5A1_UNORM = 0x07, // 16 Color + Alpha - RGBA4_UNORM = 0x08, // 16 Color + Alpha - RGBA8_UNORM = 0x09, // 32 Color + Alpha - ETC1_UNORM = 0x0A, // 4 Color - ETC1A4_UNORM = 0x0B, // 8 Color + Alpha - L4_UNORM = 0x0C, // 4 Luminance - A4_UNORM = 0x0D, // 4 Alpha + L8 = 0x00, // 8 Luminance + A8 = 0x01, // 8 Alpha + LA4 = 0x02, // 8 Luminance + Alpha + LA8 = 0x03, // 16 Luminance + Alpha + HILO8 = 0x04, // 16 ? + RGB565 = 0x05, // 16 Color + RGBX8 = 0x06, // 24 Color + RGB5A1 = 0x07, // 16 Color + Alpha + RGBA4 = 0x08, // 16 Color + Alpha + RGBA8 = 0x09, // 32 Color + Alpha + ETC1 = 0x0A, // 4 Color + ETC1A4 = 0x0B, // 8 Color + Alpha + L4 = 0x0C, // 4 Luminance + A4 = 0x0D, // 4 Alpha } public static class PixelConverter @@ -188,14 +145,14 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) byte a = byte.MaxValue, r = 0, g = 0, b = 0; switch (e) { - case BFLIMEncoding.L4_UNORM: - case BFLIMEncoding.L8_UNORM: + case BFLIMEncoding.L4: + case BFLIMEncoding.L8: { r = g = b = (byte)val; break; } - case BFLIMEncoding.A4_UNORM: - case BFLIMEncoding.A8_UNORM: + case BFLIMEncoding.A4: + case BFLIMEncoding.A8: { r = g = b = 0xFF; a = (byte)val; @@ -208,27 +165,27 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) b = byte.MaxValue; break; } - case BFLIMEncoding.LA4_UNORM: + case BFLIMEncoding.LA4: { r = g = b = (byte)(val >> 4); a = (byte)(val & 0x0F); break; } - case BFLIMEncoding.LA8_UNORM: + case BFLIMEncoding.LA8: { r = g = b = (byte)(val >> 8); a = (byte)val; break; } - case BFLIMEncoding.RGBX8_UNORM: + case BFLIMEncoding.RGBX8: { return val | 0xFF000000; } - case BFLIMEncoding.RGBA8_UNORM: + case BFLIMEncoding.RGBA8: { return val; } - case BFLIMEncoding.RGBA4_UNORM: + case BFLIMEncoding.RGBA4: { a = (byte)(0x11 * (val & 0xf)); r = (byte)(0x11 * ((val >> 12) & 0xf)); @@ -236,14 +193,14 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) b = (byte)(0x11 * ((val >> 4) & 0xf)); break; } - case BFLIMEncoding.RGB565_UNORM: + case BFLIMEncoding.RGB565: { r = Convert5To8[(val >> 11) & 0x1F]; g = (byte)(((val >> 5) & 0x3F) * 4); b = Convert5To8[val & 0x1F]; break; } - case BFLIMEncoding.RGB5A1_UNORM: + case BFLIMEncoding.RGB5A1: { r = Convert5To8[(val >> 11) & 0x1F]; g = Convert5To8[(val >> 6) & 0x1F]; @@ -290,26 +247,95 @@ public static int GetBitsPerPixel(this BFLIMEncoding e) private const int BPP_4 = 4; private static readonly HashSet _32 = new HashSet { - BFLIMEncoding.RGBA8_UNORM, + BFLIMEncoding.RGBA8, }; private static readonly HashSet _24 = new HashSet { - BFLIMEncoding.RGBX8_UNORM, + BFLIMEncoding.RGBX8, }; private static readonly HashSet _16 = new HashSet { - BFLIMEncoding.LA8_UNORM, + BFLIMEncoding.LA8, BFLIMEncoding.HILO8, - BFLIMEncoding.RGB565_UNORM, - BFLIMEncoding.RGB5A1_UNORM, - BFLIMEncoding.RGBA4_UNORM, + BFLIMEncoding.RGB565, + BFLIMEncoding.RGB5A1, + BFLIMEncoding.RGBA4, }; private static readonly HashSet _8 = new HashSet { - BFLIMEncoding.L8_UNORM, - BFLIMEncoding.A8_UNORM, - BFLIMEncoding.LA4_UNORM, - BFLIMEncoding.ETC1A4_UNORM, + BFLIMEncoding.L8, + BFLIMEncoding.A8, + BFLIMEncoding.LA4, + BFLIMEncoding.ETC1A4, }; } + + [Flags] + public enum BFLIMOrientation : byte + { + None = 0, + Rotate90 = 4, + Transpose = 8, + } + + public class BFLIMOrienter + { + readonly BFLIMOrientation _orientation; + + public uint Width { get; } + public uint Height { get; } + public uint PanelsPerWidth { get; } + + public BFLIMOrienter(int width, int height, BFLIMOrientation orientation) + { + Width = (uint)BCLIM.nlpo2(BCLIM.gcm(width, 8)); + Height = (uint)BCLIM.nlpo2(BCLIM.gcm(height, 8)); + Debug.WriteLine($"Base Size = Width: {Width}, Height = {Height}"); + + PanelsPerWidth = (uint)BCLIM.gcm(orientation == BFLIMOrientation.None ? width : height, 8) / 8; + Debug.WriteLine($"PPW: {PanelsPerWidth}"); + + _orientation = orientation; + } + + public Coordinate Get(uint i) + { + BCLIM.d2xy(i & 0x3F, out uint x, out uint y); + + // Shift Tile Coordinate into Tilemap + var tile = i >> 6; + x |= (tile % PanelsPerWidth) << 3; + y |= (tile / PanelsPerWidth) << 3; + + var coord = new Coordinate(x, y); + if (_orientation.HasFlag(BFLIMOrientation.Rotate90)) + coord.Rotate90(Height); + if (_orientation.HasFlag(BFLIMOrientation.Transpose)) + coord.Transpose(); + return coord; + } + } + + public class Coordinate + { + public uint X { get; private set; } + public uint Y { get; private set; } + + public Coordinate(uint x, uint y) + { + X = x; Y = y; + } + public void Transpose() + { + var tmp = X; + X = Y; + Y = tmp; + } + public void Rotate90(uint height) + { + var tmp = X; + X = Y; + Y = height - 1 - tmp; + } + } } From 15b8b87ca9b01257f89f530585723714c43d4c13 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 10:01:01 -0800 Subject: [PATCH 049/191] add crop override can now choose to not crop the resulting image (showing unused pixel data) --- pk3DS.Core/CTR/BFLIM.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs index d66fc19d82..2f228271d7 100644 --- a/pk3DS.Core/CTR/BFLIM.cs +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -37,11 +37,17 @@ private void ReadBFLIM(Stream ms) /// /// ARGB 32bpp /// - public byte[] GetImageData() + public byte[] GetImageData(bool crop = true) { var orienter = new BFLIMOrienter(Footer.Width, Footer.Height, Footer.Orientation); uint[] pixels = GetPixels(); + if (!crop) + { + Footer.Width = (ushort)orienter.Width; + Footer.Height = (ushort)orienter.Height; + } + // uint[] -> byte[] byte[] array = new byte[Footer.Width * Footer.Height * 4]; for (uint i = 0; i < pixels.Length; i++) From 71b6d95ec535ead654e34200caf75d4b800f37d9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 13:25:07 -0800 Subject: [PATCH 050/191] Fix tile shuffling reference calculated "Width" instead of cropped "width" property --- pk3DS.Core/CTR/BFLIM.cs | 16 ++++++++++------ pk3DS.Core/ImageUtil.cs | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 pk3DS.Core/ImageUtil.cs diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs index 2f228271d7..a6fafa3597 100644 --- a/pk3DS.Core/CTR/BFLIM.cs +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -57,7 +56,6 @@ public byte[] GetImageData(bool crop = true) continue; var val = pixels[i]; - Debug.WriteLine($"Writing {val:X8} for coord: X:{coord.X} | Y{coord.Y}"); uint o = 4 * (coord.X + coord.Y * Footer.Width); array[o + 0] = (byte)(val & 0xFF); array[o + 1] = (byte)(val >> 8 & 0xFF); @@ -70,6 +68,13 @@ public uint[] GetPixels() { return PixelConverter.GetPixels(PixelData, Footer.Format).ToArray(); } + public byte[] GetPixelsRaw() + { + var pix = GetPixels(); + byte[] raw = new byte[pix.Length * 4]; + Buffer.BlockCopy(pix, 0, raw, 0, raw.Length); + return raw; + } } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct FLIM @@ -296,10 +301,9 @@ public BFLIMOrienter(int width, int height, BFLIMOrientation orientation) { Width = (uint)BCLIM.nlpo2(BCLIM.gcm(width, 8)); Height = (uint)BCLIM.nlpo2(BCLIM.gcm(height, 8)); - Debug.WriteLine($"Base Size = Width: {Width}, Height = {Height}"); - PanelsPerWidth = (uint)BCLIM.gcm(orientation == BFLIMOrientation.None ? width : height, 8) / 8; - Debug.WriteLine($"PPW: {PanelsPerWidth}"); + uint stride = orientation == BFLIMOrientation.None ? Width : Height; + PanelsPerWidth = (uint)BCLIM.gcm((int)stride, 8) / 8; _orientation = orientation; } @@ -322,7 +326,7 @@ public Coordinate Get(uint i) } } - public class Coordinate + public struct Coordinate { public uint X { get; private set; } public uint Y { get; private set; } diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs new file mode 100644 index 0000000000..e9f76cf08a --- /dev/null +++ b/pk3DS.Core/ImageUtil.cs @@ -0,0 +1,36 @@ +using System.Drawing; +using System.Drawing.Imaging; +using pk3DS.Core.CTR; + +namespace pk3DS.Core +{ + /// + /// Image Utility class using . + /// + public static class ImageUtil + { + /// + /// Converts a to via the 32bit/pixel data. + /// + /// Image data + /// Crop the image area to the actual dimensions + /// Human visible data + public static Bitmap GetBitmap(this BFLIM bflim, bool crop = true) + { + var data = bflim.GetImageData(crop); + return GetBitmap(data, bflim.Footer.Width, bflim.Footer.Height); + } + public static Bitmap GetBitmap(byte[] data, int width, int height) + { + var bmp = new Bitmap(width, height); + var rect = new Rectangle(0, 0, width, height); + var bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + + var ptr = bmpData.Scan0; + System.Runtime.InteropServices.Marshal.Copy(data, 0, ptr, data.Length); + bmp.UnlockBits(bmpData); + + return bmp; + } + } +} From abef306ffcafb98abb985548efa45c591664400c Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 13:50:37 -0800 Subject: [PATCH 051/191] Migrate out etc handling currently only works for bclim, dunno if I want to try and fix the swizzling / standardize the reading basically just outputs scrambled ETC1 images rather than throwing an exception --- pk3DS.Core/CTR/BCLIM.cs | 114 +++------------------------------------- pk3DS.Core/CTR/BFLIM.cs | 15 ++++-- pk3DS.Core/CTR/ETC1.cs | 11 ++++ pk3DS.Core/CTR/IXLIM.cs | 12 +++++ pk3DS.Core/ImageUtil.cs | 114 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 153 insertions(+), 113 deletions(-) create mode 100644 pk3DS.Core/CTR/IXLIM.cs diff --git a/pk3DS.Core/CTR/BCLIM.cs b/pk3DS.Core/CTR/BCLIM.cs index 5cc4942472..61dcdfbf2b 100644 --- a/pk3DS.Core/CTR/BCLIM.cs +++ b/pk3DS.Core/CTR/BCLIM.cs @@ -2,8 +2,6 @@ using System.Drawing; using System.Drawing.Imaging; using System.IO; -using System.Runtime.InteropServices; -using pk3DS.Core.Properties; // For other projects, replace this line with the namespace that contains your ETC1Lib.dll resource. namespace pk3DS.Core.CTR { @@ -103,7 +101,7 @@ public static Image makeBMP(string path, bool autosave = false, bool crop = true // PKM XY Format 7 (Color Palette) img = getIMG_XY7(bclim); else if (f == 10 || f == 11) - img = getIMG_ETC(bclim); + img = ImageUtil.GetBitmapETC(bclim); else img = getIMG(bclim); @@ -190,7 +188,7 @@ public static Bitmap getIMG(CLIM bclim) if (bclim.FileFormat == 7 && BitConverter.ToUInt16(bclim.Data, 0) == 2) // XY7 return getIMG_XY7(bclim); if (bclim.FileFormat == 10 || bclim.FileFormat == 11) // Use ETC1 to get image instead. - return getIMG_ETC(bclim); + return ImageUtil.GetBitmapETC(bclim); // New Image int w = nlpo2(gcm(bclim.Width, 8)); int h = nlpo2(gcm(bclim.Height, 8)); @@ -251,102 +249,6 @@ public static Bitmap getIMG_XY7(CLIM bclim) } return img; } - public static Bitmap getIMG_ETC(CLIM bclim) - { - Bitmap img = new Bitmap(Math.Max(nlpo2(bclim.Width), 16), Math.Max(nlpo2(bclim.Height), 16)); - string dllpath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\ETC1Lib.dll"; - if (!File.Exists(dllpath)) File.WriteAllBytes(dllpath, Resources.ETC1Lib); - - try - { - /* http://jul.rustedlogic.net/thread.php?id=17312 - * Much of this code is taken/modified from Tharsis. Thank you to Tharsis's creator, xdaniel. - * https://github.com/xdanieldzd/Tharsis - */ - - /* Get compressed data & handle to it */ - byte[] textureData = bclim.Data; - //textureData = switchEndianness(textureData, 0x10); - ushort[] input = new ushort[textureData.Length/sizeof (ushort)]; - Buffer.BlockCopy(textureData, 0, input, 0, textureData.Length); - GCHandle pInput = GCHandle.Alloc(input, GCHandleType.Pinned); - - /* Marshal data around, invoke ETC1.dll for conversion, etc */ - uint size1 = 0; - UInt16 w = (ushort)img.Width, h = (ushort)img.Height; - - ETC1.ConvertETC1(IntPtr.Zero, ref size1, IntPtr.Zero, w, h, bclim.FileFormat == 0xB); // true = etc1a4, false = etc1 - // System.Diagnostics.Debug.WriteLine(size1); - uint[] output = new uint[size1]; - GCHandle pOutput = GCHandle.Alloc(output, GCHandleType.Pinned); - ETC1.ConvertETC1(pOutput.AddrOfPinnedObject(), ref size1, pInput.AddrOfPinnedObject(), w, h, bclim.FileFormat == 0xB); - pOutput.Free(); - pInput.Free(); - - - /* Unscramble if needed // could probably be done in ETC1Lib.dll, it's probably pretty ugly, but whatever... */ - /* Non-square code blocks could need some cleanup, verification, etc. as well... */ - uint[] finalized = new uint[output.Length]; - - // Act if it's square because BCLIM swizzling is stupid - Buffer.BlockCopy(output, 0, finalized, 0, finalized.Length); - - byte[] tmp = new byte[finalized.Length]; - Buffer.BlockCopy(finalized, 0, tmp, 0, tmp.Length); - byte[] imgData = tmp; - - for (int i = 0; i < w; i++) - { - for (int j = 0; j < h; j++) - { - int k = (j + i*img.Height)*4; - img.SetPixel(i, j, Color.FromArgb(imgData[k + 3], imgData[k], imgData[k + 1], imgData[k + 2])); - } - } - // Image is 13 instead of 12 - // 24 34 - img.RotateFlip(RotateFlipType.Rotate90FlipX); - if (w > h) - { - // Image is now in appropriate order, but the shifting is messed up. Let's fix that. - Bitmap img2 = new Bitmap(Math.Max(nlpo2(bclim.Width), 16), Math.Max(nlpo2(bclim.Height), 16)); - for (int y = 0; y < Math.Max(nlpo2(bclim.Width), 16); y += 8) - { - for (int x = 0; x < Math.Max(nlpo2(bclim.Height), 16); x++) - { - for (int j = 0; j < 8; j++) - // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. - { - int x1 = (x + y/8*h)%img2.Width; // Reshift x - int y1 = (x + y/8*h)/img2.Width*8; // Reshift y - img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle - } - } - } - img = img2; - } - else if (h > w) - { - Bitmap img2 = new Bitmap(Math.Max(nlpo2(bclim.Width), 16), Math.Max(nlpo2(bclim.Height), 16)); - for (int y = 0; y < Math.Max(nlpo2(bclim.Width), 16); y += 8) - { - for (int x = 0; x < Math.Max(nlpo2(bclim.Height), 16); x++) - { - for (int j = 0; j < 8; j++) - // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. - { - int x1 = x%img2.Width; // Reshift x - int y1 = (x + y/8*h)/img2.Width*8; // Reshift y - img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle - } - } - } - img = img2; - } - } - catch { } - return img; - } // BCLIM Data Writing public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) @@ -865,10 +767,10 @@ public static CLIM analyze(string path) return bclim; } } - public struct CLIM + public struct CLIM : IXLIM { - public uint Magic; // CLIM = 0x4D494C43 - public UInt16 BOM; // 0xFFFE + public uint Magic { get; set; }// CLIM = 0x4D494C43 + public ushort BOM; // 0xFFFE public uint CLIMLength; // HeaderLength - 14 public int TileWidth; // 1<<[[n]] public int TileHeight; // 1<<[[n]] @@ -877,12 +779,12 @@ public struct CLIM public char[] imag; // imag = 0x67616D69 public uint imagLength; // HeaderLength - 10 - public UInt16 Width; // Final Dimensions - public UInt16 Height; // Final Dimensions + public ushort Width { get; set; } // Final Dimensions + public ushort Height { get; set; } // Final Dimensions public int FileFormat; // ?? public uint dataLength; // Pixel Data Region Length - public byte[] Data; + public byte[] Data { get; set; } public int BaseSize; diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs index a6fafa3597..f86c6d10b6 100644 --- a/pk3DS.Core/CTR/BFLIM.cs +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -6,11 +6,16 @@ namespace pk3DS.Core.CTR { - public class BFLIM + public class BFLIM : IXLIM { public byte[] PixelData; public FLIM Footer; + public uint Magic { get => Footer.Magic; set => Footer.Magic = value; } + public ushort Width { get => Footer.Width; set => Footer.Width = value; } + public ushort Height { get => Footer.Height; set => Footer.Height = value; } + public BFLIMEncoding Format { get => Footer.Format; set => Footer.Format = value; } + public BFLIM(Stream data) => ReadBFLIM(data); public BFLIM(byte[] data) { @@ -77,7 +82,7 @@ public byte[] GetPixelsRaw() } } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct FLIM + public struct FLIM : IXLIM { public const int SIZE = 40; public const string Identifier = "FLIM"; @@ -85,7 +90,7 @@ public struct FLIM public bool LittleEndian => BOM == 0xFEFF; public bool BigEndian => BOM == 0xFFFE; - public uint Magic; // FLIM + public uint Magic { get; set; } // FLIM public ushort BOM; // 0xFFFE public ushort HeaderLength; // always 0x14 public int Version; @@ -94,8 +99,8 @@ public struct FLIM public uint imag; // imag = 67616D69 public uint imagLength; // always 0x10 - public ushort Width; - public ushort Height; + public ushort Width { get; set; } + public ushort Height { get; set; } public short Alignment; public BFLIMEncoding Format; public BFLIMOrientation Orientation; diff --git a/pk3DS.Core/CTR/ETC1.cs b/pk3DS.Core/CTR/ETC1.cs index 2a940de73d..f8bb31a9b9 100644 --- a/pk3DS.Core/CTR/ETC1.cs +++ b/pk3DS.Core/CTR/ETC1.cs @@ -1,5 +1,8 @@ using System; +using System.IO; +using System.Reflection; using System.Runtime.InteropServices; +using pk3DS.Core.Properties; namespace pk3DS.Core.CTR { @@ -7,5 +10,13 @@ internal static class ETC1 { [DllImport("ETC1Lib.dll", EntryPoint = "ConvertETC1", CallingConvention = CallingConvention.Cdecl)] public static extern void ConvertETC1(IntPtr dataOut, ref uint dataOutSize, IntPtr dataIn, ushort width, ushort height, bool alpha); + + public static void CheckETC1Lib() + { + var loc = Assembly.GetEntryAssembly()?.Location ?? typeof(ETC1).Assembly.Location; + string dllpath = Path.GetDirectoryName(loc) + "\\ETC1Lib.dll"; + if (!File.Exists(dllpath)) + File.WriteAllBytes(dllpath, Resources.ETC1Lib); + } } } \ No newline at end of file diff --git a/pk3DS.Core/CTR/IXLIM.cs b/pk3DS.Core/CTR/IXLIM.cs new file mode 100644 index 0000000000..9147657538 --- /dev/null +++ b/pk3DS.Core/CTR/IXLIM.cs @@ -0,0 +1,12 @@ +namespace pk3DS.Core.CTR +{ + /// + /// and header interface. + /// + public interface IXLIM + { + uint Magic { get; set; } + ushort Width { get; set; } + ushort Height { get; set; } + } +} \ No newline at end of file diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs index e9f76cf08a..94e0256ea6 100644 --- a/pk3DS.Core/ImageUtil.cs +++ b/pk3DS.Core/ImageUtil.cs @@ -1,5 +1,7 @@ -using System.Drawing; +using System; +using System.Drawing; using System.Drawing.Imaging; +using System.Runtime.InteropServices; using pk3DS.Core.CTR; namespace pk3DS.Core @@ -17,6 +19,8 @@ public static class ImageUtil /// Human visible data public static Bitmap GetBitmap(this BFLIM bflim, bool crop = true) { + if (bflim.Format == BFLIMEncoding.ETC1 || bflim.Format == BFLIMEncoding.ETC1A4) + return GetBitmapETC(bflim); var data = bflim.GetImageData(crop); return GetBitmap(data, bflim.Footer.Width, bflim.Footer.Height); } @@ -27,10 +31,116 @@ public static Bitmap GetBitmap(byte[] data, int width, int height) var bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); var ptr = bmpData.Scan0; - System.Runtime.InteropServices.Marshal.Copy(data, 0, ptr, data.Length); + Marshal.Copy(data, 0, ptr, data.Length); bmp.UnlockBits(bmpData); return bmp; } + + public static Bitmap GetBitmapETC(BCLIM.CLIM bclim) + { + ETC1.CheckETC1Lib(); + + Bitmap img = new Bitmap(Math.Max(BCLIM.nlpo2(bclim.Width), 16), Math.Max(BCLIM.nlpo2(bclim.Height), 16)); + try { return DecodeETC(bclim, img, bclim.Data, bclim.FileFormat == 0x0B); } + catch { return img; } + } + public static Bitmap GetBitmapETC(BFLIM bflim) + { + ETC1.CheckETC1Lib(); + + Bitmap img = new Bitmap(Math.Max(BCLIM.nlpo2(bflim.Width), 16), Math.Max(BCLIM.nlpo2(bflim.Height), 16)); + try { return DecodeETC(bflim, img, bflim.PixelData, bflim.Footer.Format == BFLIMEncoding.ETC1A4); } + catch { return img; } + } + + private static Bitmap DecodeETC(IXLIM bclim, Bitmap img, byte[] textureData, bool etc1A4) + { + /* http://jul.rustedlogic.net/thread.php?id=17312 + * Much of this code is taken/modified from Tharsis. Thank you to Tharsis's creator, xdaniel. + * https://github.com/xdanieldzd/Tharsis + */ + + /* Get compressed data & handle to it */ + + //textureData = switchEndianness(textureData, 0x10); + ushort[] input = new ushort[textureData.Length / sizeof(ushort)]; + Buffer.BlockCopy(textureData, 0, input, 0, textureData.Length); + GCHandle pInput = GCHandle.Alloc(input, GCHandleType.Pinned); + + /* Marshal data around, invoke ETC1.dll for conversion, etc */ + uint size1 = 0; + var w = (ushort)img.Width; + var h = (ushort)img.Height; + + ETC1.ConvertETC1(IntPtr.Zero, ref size1, IntPtr.Zero, w, h, etc1A4); // true = etc1a4, false = etc1 + uint[] output = new uint[size1]; + GCHandle pOutput = GCHandle.Alloc(output, GCHandleType.Pinned); + ETC1.ConvertETC1(pOutput.AddrOfPinnedObject(), ref size1, pInput.AddrOfPinnedObject(), w, h, etc1A4); + pOutput.Free(); + pInput.Free(); + + /* Unscramble if needed // could probably be done in ETC1Lib.dll, it's probably pretty ugly, but whatever... */ + /* Non-square code blocks could need some cleanup, verification, etc. as well... */ + uint[] finalized = new uint[output.Length]; + + // Act if it's square because BCLIM swizzling is stupid + Buffer.BlockCopy(output, 0, finalized, 0, finalized.Length); + + byte[] tmp = new byte[finalized.Length]; + Buffer.BlockCopy(finalized, 0, tmp, 0, tmp.Length); + byte[] imgData = tmp; + + for (int i = 0; i < w; i++) + { + for (int j = 0; j < h; j++) + { + int k = (j + i * img.Height) * 4; + img.SetPixel(i, j, Color.FromArgb(imgData[k + 3], imgData[k], imgData[k + 1], imgData[k + 2])); + } + } + // Image is 13 instead of 12 + // 24 34 + img.RotateFlip(RotateFlipType.Rotate90FlipX); + if (w > h) + { + // Image is now in appropriate order, but the shifting is messed up. Let's fix that. + Bitmap img2 = new Bitmap(Math.Max(BCLIM.nlpo2(bclim.Width), 16), Math.Max(BCLIM.nlpo2(bclim.Height), 16)); + for (int y = 0; y < Math.Max(BCLIM.nlpo2(bclim.Width), 16); y += 8) + { + for (int x = 0; x < Math.Max(BCLIM.nlpo2(bclim.Height), 16); x++) + { + for (int j = 0; j < 8; j++) + // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. + { + int x1 = (x + y / 8 * h) % img2.Width; // Reshift x + int y1 = (x + y / 8 * h) / img2.Width * 8; // Reshift y + img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle + } + } + } + img = img2; + } + else if (h > w) + { + Bitmap img2 = new Bitmap(Math.Max(BCLIM.nlpo2(bclim.Width), 16), Math.Max(BCLIM.nlpo2(bclim.Height), 16)); + for (int y = 0; y < Math.Max(BCLIM.nlpo2(bclim.Width), 16); y += 8) + { + for (int x = 0; x < Math.Max(BCLIM.nlpo2(bclim.Height), 16); x++) + { + for (int j = 0; j < 8; j++) + // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. + { + int x1 = x % img2.Width; // Reshift x + int y1 = (x + y / 8 * h) / img2.Width * 8; // Reshift y + img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle + } + } + } + img = img2; + } + + return img; + } } } From f1f01ad10d4f5a77eb3d7c37d281adf851c65dd3 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 15:52:02 -0800 Subject: [PATCH 052/191] skip etc1 swizzling images come out fine for BFLIM lul add cropping https://i.imgur.com/RLgfnrS.png --- pk3DS.Core/ImageUtil.cs | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs index 94e0256ea6..8d06593ae8 100644 --- a/pk3DS.Core/ImageUtil.cs +++ b/pk3DS.Core/ImageUtil.cs @@ -20,7 +20,7 @@ public static class ImageUtil public static Bitmap GetBitmap(this BFLIM bflim, bool crop = true) { if (bflim.Format == BFLIMEncoding.ETC1 || bflim.Format == BFLIMEncoding.ETC1A4) - return GetBitmapETC(bflim); + return GetBitmapETC(bflim, crop); var data = bflim.GetImageData(crop); return GetBitmap(data, bflim.Footer.Width, bflim.Footer.Height); } @@ -37,21 +37,37 @@ public static Bitmap GetBitmap(byte[] data, int width, int height) return bmp; } - public static Bitmap GetBitmapETC(BCLIM.CLIM bclim) + public static Bitmap GetBitmapETC(BCLIM.CLIM bclim, bool crop = true) => GetBitmapETC(bclim, bclim.Data, bclim.FileFormat == 0x0B, crop); + public static Bitmap GetBitmapETC(BFLIM bflim, bool crop = true) => GetBitmapETC(bflim, bflim.PixelData, bflim.Footer.Format == BFLIMEncoding.ETC1A4, crop); + + private static Bitmap GetBitmapETC(IXLIM bflim, byte[] data, bool etc1a4, bool crop = true) { ETC1.CheckETC1Lib(); - - Bitmap img = new Bitmap(Math.Max(BCLIM.nlpo2(bclim.Width), 16), Math.Max(BCLIM.nlpo2(bclim.Height), 16)); - try { return DecodeETC(bclim, img, bclim.Data, bclim.FileFormat == 0x0B); } - catch { return img; } + try + { + var width = Math.Max(BCLIM.nlpo2(bflim.Width), 16); + var height = Math.Max(BCLIM.nlpo2(bflim.Height), 16); + Bitmap img = new Bitmap(width, height); + img = DecodeETC(bflim, img, data, etc1a4); + return crop ? CropBMP(bflim, img) : img; + } + catch { return null; } } - public static Bitmap GetBitmapETC(BFLIM bflim) + + private static Bitmap CropBMP(IXLIM bclim, Bitmap img) { - ETC1.CheckETC1Lib(); + Rectangle cropRect = new Rectangle(0, 0, bclim.Width, bclim.Height); + Bitmap src = img; + Bitmap target = new Bitmap(cropRect.Width, cropRect.Height); - Bitmap img = new Bitmap(Math.Max(BCLIM.nlpo2(bflim.Width), 16), Math.Max(BCLIM.nlpo2(bflim.Height), 16)); - try { return DecodeETC(bflim, img, bflim.PixelData, bflim.Footer.Format == BFLIMEncoding.ETC1A4); } - catch { return img; } + using (Graphics g = Graphics.FromImage(target)) + { + g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height), + cropRect, + GraphicsUnit.Pixel); + } + Console.WriteLine($"Returning cropped {target.Width}"); + return target; } private static Bitmap DecodeETC(IXLIM bclim, Bitmap img, byte[] textureData, bool etc1A4) @@ -99,6 +115,9 @@ private static Bitmap DecodeETC(IXLIM bclim, Bitmap img, byte[] textureData, boo img.SetPixel(i, j, Color.FromArgb(imgData[k + 3], imgData[k], imgData[k + 1], imgData[k + 2])); } } + if (bclim is BFLIM) + return img; + // Image is 13 instead of 12 // 24 34 img.RotateFlip(RotateFlipType.Rotate90FlipX); From 0fe1b0825e9d20a7ef905c4f7a88ce950c334a0c Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 16:08:02 -0800 Subject: [PATCH 053/191] Add bflim viewing to tools UI really should refactor bclim to pull out shared code --- pk3DS/Tools/ToolsUI.cs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index 179dcc7909..233206184e 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -2,10 +2,12 @@ using pk3DS.Core.CTR; using System; using System.Drawing; +using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Threading; using System.Windows.Forms; +using pk3DS.Core; namespace pk3DS { @@ -64,7 +66,35 @@ private void dropLeave(object sender, EventArgs e) private void openIMG(string path) { var img = BCLIM.makeBMP(path, CHK_PNG.Checked); - if (img == null) return; + if (img == null) + { + try + { + var flim = new BFLIM(path); + if (!flim.Footer.Valid) + return; + img = flim.GetBitmap(); + } + catch (Exception ree) + { + Console.WriteLine(ree.Message); + return; + } + if (CHK_PNG.Checked) + { + var dir = Path.GetDirectoryName(path); + var fn = Path.GetFileNameWithoutExtension(path); + var outpath = Path.Combine(dir, $"{fn}.png"); + + using (MemoryStream ms = new MemoryStream()) + { + //error will throw from here + ((Bitmap)img).Save(ms, ImageFormat.Png); + byte[] data = ms.ToArray(); + File.WriteAllBytes(outpath, data); + } + } + } PB_BCLIM.Size = new Size(img.Width + 2, img.Height + 2); PB_BCLIM.BackgroundImage = img; } From c3a6d676f8eb6fbe7fd0ceba94b636033784c086 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 16:20:28 -0800 Subject: [PATCH 054/191] Misc ui improvements add hotkeys & show them in main window (ctrl T brings up bxlim / tools UI) auto size tools window larger if large image loaded --- pk3DS/Main.Designer.cs | 63 +++++++++++++++++---------------- pk3DS/Tools/ToolsUI.Designer.cs | 4 +++ pk3DS/Tools/ToolsUI.cs | 8 +++++ 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index 8a561a8ad9..aec91249c7 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -55,6 +55,8 @@ private void InitializeComponent() this.Menu_3DS = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Patch = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_SMDH = new System.Windows.Forms.ToolStripMenuItem(); + this.randomizationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.setInt32SeedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Options = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Language = new System.Windows.Forms.ToolStripMenuItem(); this.CB_Lang = new System.Windows.Forms.ToolStripComboBox(); @@ -90,8 +92,6 @@ private void InitializeComponent() this.B_Static = new System.Windows.Forms.Button(); this.Tab_Output = new System.Windows.Forms.TabPage(); this.L_Status = new System.Windows.Forms.Label(); - this.randomizationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.setInt32SeedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.TC_RomFS.SuspendLayout(); this.Tab_RomFS.SuspendLayout(); @@ -218,17 +218,15 @@ private void InitializeComponent() // this.Menu_Open.Name = "Menu_Open"; this.Menu_Open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.Menu_Open.ShowShortcutKeys = false; - this.Menu_Open.Size = new System.Drawing.Size(105, 22); + this.Menu_Open.Size = new System.Drawing.Size(155, 22); this.Menu_Open.Text = "&Open..."; this.Menu_Open.Click += new System.EventHandler(this.B_Open_Click); // // Menu_Exit // this.Menu_Exit.Name = "Menu_Exit"; - this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); - this.Menu_Exit.ShowShortcutKeys = false; - this.Menu_Exit.Size = new System.Drawing.Size(105, 22); + this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); + this.Menu_Exit.Size = new System.Drawing.Size(155, 22); this.Menu_Exit.Text = "&Exit"; this.Menu_Exit.Click += new System.EventHandler(this.Menu_Exit_Click); // @@ -266,21 +264,24 @@ private void InitializeComponent() // unPackBCLIMToolStripMenuItem // this.unPackBCLIMToolStripMenuItem.Name = "unPackBCLIMToolStripMenuItem"; - this.unPackBCLIMToolStripMenuItem.Size = new System.Drawing.Size(176, 22); + this.unPackBCLIMToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T))); + this.unPackBCLIMToolStripMenuItem.Size = new System.Drawing.Size(216, 22); this.unPackBCLIMToolStripMenuItem.Text = "(un)Pack + BCLIM"; this.unPackBCLIMToolStripMenuItem.Click += new System.EventHandler(this.L_SubTools_Click); // // Menu_BLZ // this.Menu_BLZ.Name = "Menu_BLZ"; - this.Menu_BLZ.Size = new System.Drawing.Size(176, 22); + this.Menu_BLZ.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); + this.Menu_BLZ.Size = new System.Drawing.Size(216, 22); this.Menu_BLZ.Text = "(de)Compress BLZ"; this.Menu_BLZ.Click += new System.EventHandler(this.Menu_BLZ_Click); // // Menu_LZ11 // this.Menu_LZ11.Name = "Menu_LZ11"; - this.Menu_LZ11.Size = new System.Drawing.Size(176, 22); + this.Menu_LZ11.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L))); + this.Menu_LZ11.Size = new System.Drawing.Size(216, 22); this.Menu_LZ11.Text = "(de)Compress LZ11"; this.Menu_LZ11.Click += new System.EventHandler(this.Menu_LZ11_Click); // @@ -288,7 +289,7 @@ private void InitializeComponent() // this.Menu_Shuffler.Enabled = false; this.Menu_Shuffler.Name = "Menu_Shuffler"; - this.Menu_Shuffler.Size = new System.Drawing.Size(176, 22); + this.Menu_Shuffler.Size = new System.Drawing.Size(216, 22); this.Menu_Shuffler.Text = "GARC Shuffler"; this.Menu_Shuffler.Click += new System.EventHandler(this.Menu_Shuffler_Click); // @@ -308,7 +309,7 @@ private void InitializeComponent() // this.Menu_RomFS.Enabled = false; this.Menu_RomFS.Name = "Menu_RomFS"; - this.Menu_RomFS.Size = new System.Drawing.Size(111, 22); + this.Menu_RomFS.Size = new System.Drawing.Size(152, 22); this.Menu_RomFS.Text = "RomFS"; this.Menu_RomFS.Click += new System.EventHandler(this.rebuildRomFS); // @@ -316,7 +317,7 @@ private void InitializeComponent() // this.Menu_ExeFS.Enabled = false; this.Menu_ExeFS.Name = "Menu_ExeFS"; - this.Menu_ExeFS.Size = new System.Drawing.Size(111, 22); + this.Menu_ExeFS.Size = new System.Drawing.Size(152, 22); this.Menu_ExeFS.Text = "ExeFS"; this.Menu_ExeFS.Click += new System.EventHandler(this.rebuildExeFS); // @@ -324,7 +325,7 @@ private void InitializeComponent() // this.Menu_CRO.Enabled = false; this.Menu_CRO.Name = "Menu_CRO"; - this.Menu_CRO.Size = new System.Drawing.Size(111, 22); + this.Menu_CRO.Size = new System.Drawing.Size(152, 22); this.Menu_CRO.Text = "CRO"; this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR); // @@ -332,7 +333,7 @@ private void InitializeComponent() // this.Menu_3DS.Enabled = false; this.Menu_3DS.Name = "Menu_3DS"; - this.Menu_3DS.Size = new System.Drawing.Size(111, 22); + this.Menu_3DS.Size = new System.Drawing.Size(152, 22); this.Menu_3DS.Text = ".3DS"; this.Menu_3DS.Click += new System.EventHandler(this.B_Rebuild3DS_Click); // @@ -340,7 +341,7 @@ private void InitializeComponent() // this.Menu_Patch.Enabled = false; this.Menu_Patch.Name = "Menu_Patch"; - this.Menu_Patch.Size = new System.Drawing.Size(111, 22); + this.Menu_Patch.Size = new System.Drawing.Size(152, 22); this.Menu_Patch.Text = "Patch"; this.Menu_Patch.Click += new System.EventHandler(this.B_Patch_Click); // @@ -351,6 +352,21 @@ private void InitializeComponent() this.Menu_SMDH.Text = "SMDH Editor (Icon)"; this.Menu_SMDH.Click += new System.EventHandler(this.Menu_SMDH_Click); // + // randomizationToolStripMenuItem + // + this.randomizationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.setInt32SeedToolStripMenuItem}); + this.randomizationToolStripMenuItem.Name = "randomizationToolStripMenuItem"; + this.randomizationToolStripMenuItem.Size = new System.Drawing.Size(184, 22); + this.randomizationToolStripMenuItem.Text = "Randomization"; + // + // setInt32SeedToolStripMenuItem + // + this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem"; + this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed"; + this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click); + // // Menu_Options // this.Menu_Options.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -731,21 +747,6 @@ private void InitializeComponent() this.L_Status.TabIndex = 14; this.L_Status.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // randomizationToolStripMenuItem - // - this.randomizationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.setInt32SeedToolStripMenuItem}); - this.randomizationToolStripMenuItem.Name = "randomizationToolStripMenuItem"; - this.randomizationToolStripMenuItem.Size = new System.Drawing.Size(184, 22); - this.randomizationToolStripMenuItem.Text = "Randomization"; - // - // setInt32SeedToolStripMenuItem - // - this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem"; - this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed"; - this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click); - // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/pk3DS/Tools/ToolsUI.Designer.cs b/pk3DS/Tools/ToolsUI.Designer.cs index e1cb703f80..8593ed548c 100644 --- a/pk3DS/Tools/ToolsUI.Designer.cs +++ b/pk3DS/Tools/ToolsUI.Designer.cs @@ -47,6 +47,8 @@ private void InitializeComponent() // // PB_Unpack // + this.PB_Unpack.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.PB_Unpack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Unpack.Location = new System.Drawing.Point(12, 25); this.PB_Unpack.Name = "PB_Unpack"; @@ -85,6 +87,8 @@ private void InitializeComponent() // // PB_Repack // + this.PB_Repack.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.PB_Repack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Repack.Location = new System.Drawing.Point(168, 124); this.PB_Repack.Name = "PB_Repack"; diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index 233206184e..bfe35b50ca 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -97,6 +97,14 @@ private void openIMG(string path) } PB_BCLIM.Size = new Size(img.Width + 2, img.Height + 2); PB_BCLIM.BackgroundImage = img; + int leftpad = PB_BCLIM.Location.X; + int suggestedWidth = leftpad * 2 + PB_BCLIM.Width + 10; + if (Width < suggestedWidth) + Width = suggestedWidth; + + int suggestedHeight = PB_BCLIM.Location.Y + PB_BCLIM.Height + leftpad + 30; + if (Height < suggestedHeight) + Height = suggestedHeight; } internal static volatile int threads; From 0ccc74480d4cec76f5395a505a76274acfae03f7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 17:38:14 -0800 Subject: [PATCH 055/191] Emit dumped file paths as enumerable --- pk3DS.Core/CTR/SARC.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pk3DS.Core/CTR/SARC.cs b/pk3DS.Core/CTR/SARC.cs index 433185db02..794ac6fbb9 100644 --- a/pk3DS.Core/CTR/SARC.cs +++ b/pk3DS.Core/CTR/SARC.cs @@ -138,7 +138,7 @@ public void SetData(SFATEntry entry, byte[] data) /// /// Entry to export /// Path to export to. If left null, will output to the FilePath, if it is assigned. - public void ExportFile(SFATEntry t, string outpath = null) + public string ExportFile(SFATEntry t, string outpath = null) { outpath = outpath ?? FilePath; byte[] data = GetData(t); @@ -152,6 +152,7 @@ public void ExportFile(SFATEntry t, string outpath = null) var filepath = Path.Combine(outpath, name); File.WriteAllBytes(filepath, data); + return outpath; } /// @@ -159,7 +160,7 @@ public void ExportFile(SFATEntry t, string outpath = null) /// /// Path to create dump folder in /// Folder to dump contents to - public void Dump(string path = null, string folder = null) + public IEnumerable Dump(string path = null, string folder = null) { path = path ?? FilePath; if (path == null) @@ -175,7 +176,7 @@ public void Dump(string path = null, string folder = null) Directory.CreateDirectory(dir); foreach (SFATEntry t in SFAT.Entries) - ExportFile(t, dir); + yield return ExportFile(t, dir); } private string GetFileName(int offset) From 1f5accff21e83e4cd615b18aebf76145f381ff0f Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 17:51:59 -0800 Subject: [PATCH 056/191] Add ALYT dumping assuming it's just an alyt->sarc, obviously tweak dragdrop to iterate over all dumped files, cuz why not --- pk3DS/Tools/ToolsUI.cs | 70 +++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index bfe35b50ca..7f4f84d043 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -39,30 +39,44 @@ private void tabMain_DragEnter(object sender, DragEventArgs e) private void tabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - string path = files[0]; // open first D&D + foreach (var path in files) + HandleDrop(sender, path); + System.Media.SystemSounds.Asterisk.Play(); + } + private void HandleDrop(object sender, string path) + { if (sender == PB_Unpack) openARC(path, pBar1); else if (sender == PB_BCLIM) openIMG(path); else if (sender == PB_Repack) saveARC(path); - else try { - LZSS.Decompress(path, Path.Combine(Path.GetDirectoryName(path), "dec_" + Path.GetFileName(path))); - File.Delete(path); - System.Media.SystemSounds.Asterisk.Play(); - } catch { try { if (threads < 1) - new Thread(() => { threads++; new BLZCoder(new[] { "-d", path }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start(); - } catch { WinFormsUtil.Error("Unable to process file."); threads = 0; } } - } - private void dropHover(object sender, EventArgs e) - { - (sender as Panel).BackColor = Color.Gray; + else + DecompressLZSS_BLZ(path); } - private void dropLeave(object sender, EventArgs e) + + private void DecompressLZSS_BLZ(string path) { - (sender as Panel).BackColor = Color.Transparent; + try + { + LZSS.Decompress(path, Path.Combine(Path.GetDirectoryName(path), "dec_" + Path.GetFileName(path))); + File.Delete(path); + } + catch + { + try + { + if (threads < 1) + new Thread(() => { threads++; new BLZCoder(new[] { "-d", path }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start(); + } + catch { WinFormsUtil.Error("Unable to process file."); threads = 0; } + } } + + private void dropHover(object sender, EventArgs e) => ((Panel) sender).BackColor = Color.Gray; + private void dropLeave(object sender, EventArgs e) => ((Panel) sender).BackColor = Color.Transparent; + private void openIMG(string path) { var img = BCLIM.makeBMP(path, CHK_PNG.Checked); @@ -145,6 +159,28 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa batchRenameExtension(newFolder); } } + else if (first4.SequenceEqual(BitConverter.GetBytes(0x54594C41))) // ALYT + { + if (threads > 0) { WinFormsUtil.Alert("Please wait for all operations to finish first."); return; } + new Thread(() => + { + threads++; + var alyt = new ALYT(File.ReadAllBytes(path)); + var sarc = new SARC(alyt.Data) // rip out sarc + { + FileName = Path.GetFileNameWithoutExtension(path) + "_sarc", + FilePath = Path.GetDirectoryName(path) + }; + if (!sarc.Valid) + return; + var files = sarc.Dump(); + foreach (string file in files) + { + // openARC(file, pBar1, true); + } + threads--; + }).Start(); + } else if (first4.SequenceEqual(BitConverter.GetBytes(0x47415243))) // GARC { if (threads > 0) { WinFormsUtil.Alert("Please wait for all operations to finish first."); return; } @@ -160,7 +196,6 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa { WinFormsUtil.Alert("Unpacking failed."); return; } System.Media.SystemSounds.Asterisk.Play(); }).Start(); - return; } else if (ARC.analyze(path).valid) // DARC { @@ -175,10 +210,10 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa newFolder = folderPath + "_d"; bool r = Core.CTR.DARC.darc2files(darcData, newFolder); if (!r) - { WinFormsUtil.Alert("Unpacking failed."); return; } + { WinFormsUtil.Alert("Unpacking failed."); } } else if (!recursing) - { WinFormsUtil.Alert("File is not a darc or a mini packed file:" + Environment.NewLine + path); return;} + { WinFormsUtil.Alert("File is not a darc or a mini packed file:" + Environment.NewLine + path);;} } catch (Exception e) @@ -187,7 +222,6 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa WinFormsUtil.Error("File error:" + Environment.NewLine + path, e.ToString()); threads = 0; } - System.Media.SystemSounds.Asterisk.Play(); } private void saveARC(string path) { From a4a817abcda267d79189f0c53f30fddcc6958440 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 18:51:42 -0800 Subject: [PATCH 057/191] Cleanup dis codebase like jenga --- pk3DS.Core/CTR/BCLIM.cs | 60 +++++++++++++++++------------------------ pk3DS/Tools/ToolsUI.cs | 9 +------ 2 files changed, 25 insertions(+), 44 deletions(-) diff --git a/pk3DS.Core/CTR/BCLIM.cs b/pk3DS.Core/CTR/BCLIM.cs index 61dcdfbf2b..9a5801bdc3 100644 --- a/pk3DS.Core/CTR/BCLIM.cs +++ b/pk3DS.Core/CTR/BCLIM.cs @@ -1,6 +1,5 @@ using System; using System.Drawing; -using System.Drawing.Imaging; using System.IO; namespace pk3DS.Core.CTR @@ -84,48 +83,37 @@ public static Image makeBMP(string path, bool autosave = false, bool crop = true CLIM bclim = analyze(path); if (bclim.Magic != 0x4D494C43) { - System.Media.SystemSounds.Beep.Play(); + System.Media.SystemSounds.Beep.Play(); return null; } - // Interpret data. - int f = bclim.FileFormat; - if (f > 13) - { - System.Media.SystemSounds.Exclamation.Play(); - return null; - } - Bitmap img; - if (f == 7 && BitConverter.ToUInt16(bclim.Data, 0) == 2) - // PKM XY Format 7 (Color Palette) - img = getIMG_XY7(bclim); - else if (f == 10 || f == 11) - img = ImageUtil.GetBitmapETC(bclim); - else - img = getIMG(bclim); - - if (img == null) return null; - Rectangle cropRect = new Rectangle(0, 0, bclim.Width, bclim.Height); - Bitmap CropBMP = new Bitmap(cropRect.Width, cropRect.Height); - using (Graphics g = Graphics.FromImage(CropBMP)) - { - g.DrawImage(img, - new Rectangle(0, 0, CropBMP.Width, CropBMP.Height), - cropRect, - GraphicsUnit.Pixel); - } - if (!autosave) return !crop ? img : CropBMP; + Bitmap img = GetBCLIMImage(bclim); + if (img == null) + return null; + if (crop) + img = ImageUtil.CropBMP(bclim, img); + if (autosave) + img.Save(Path.Combine(bclim.FilePath, $"{bclim.FileName}.png")); + return img; + } - using (MemoryStream ms = new MemoryStream()) + private static Bitmap GetBCLIMImage(CLIM bclim) + { + int f = bclim.FileFormat; + switch (f) { - //error will throw from here - CropBMP.Save(ms, ImageFormat.Png); - byte[] data = ms.ToArray(); - File.WriteAllBytes(bclim.FilePath + "\\" + bclim.FileName + ".png", data); + case 7 when BitConverter.ToUInt16(bclim.Data, 0) == 2: // PKM XY Format 7 (Color Palette) + return getIMG_XY7(bclim); + case 0xA: case 0xB: + return ImageUtil.GetBitmapETC(bclim); + default: + if (f > 0xD) // unsupported formats + return null; + return getIMG(bclim); } - return !crop ? img : CropBMP; } + // Bitmap Data Writing public static Bitmap getIMG(int width, int height, byte[] bytes, int f) { @@ -272,7 +260,7 @@ public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) int h = gcm(img.Height, 8); w = Math.Max(nlpo2(w), nlpo2(h)); h = w; - byte[] pixelarray = new Byte[w * h]; + byte[] pixelarray = new byte[w * h]; const int colorformat = 2; int ctr = 1; diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index 7f4f84d043..0773dbfd27 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -99,14 +99,7 @@ private void openIMG(string path) var dir = Path.GetDirectoryName(path); var fn = Path.GetFileNameWithoutExtension(path); var outpath = Path.Combine(dir, $"{fn}.png"); - - using (MemoryStream ms = new MemoryStream()) - { - //error will throw from here - ((Bitmap)img).Save(ms, ImageFormat.Png); - byte[] data = ms.ToArray(); - File.WriteAllBytes(outpath, data); - } + img.Save(outpath); } } PB_BCLIM.Size = new Size(img.Width + 2, img.Height + 2); From 775955af99d6b7e630874e7ea436d1c8c0438682 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 Dec 2017 22:49:26 -0800 Subject: [PATCH 058/191] Fix rgb8 export oops --- pk3DS.Core/CTR/BFLIM.cs | 11 +++++++++-- pk3DS.Core/ImageUtil.cs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs index f86c6d10b6..5e538e76d5 100644 --- a/pk3DS.Core/CTR/BFLIM.cs +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -195,11 +195,18 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) } case BFLIMEncoding.RGBX8: { - return val | 0xFF000000; + r = (byte)(val >> 16); + g = (byte)(val >> 8); + b = (byte)(val >> 0); + break; } case BFLIMEncoding.RGBA8: { - return val; + r = (byte)(val >> 24); + g = (byte)(val >> 16); + b = (byte)(val >> 8); + a = (byte) val; + break; } case BFLIMEncoding.RGBA4: { diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs index 8d06593ae8..ca84a75624 100644 --- a/pk3DS.Core/ImageUtil.cs +++ b/pk3DS.Core/ImageUtil.cs @@ -54,7 +54,7 @@ private static Bitmap GetBitmapETC(IXLIM bflim, byte[] data, bool etc1a4, bool c catch { return null; } } - private static Bitmap CropBMP(IXLIM bclim, Bitmap img) + public static Bitmap CropBMP(IXLIM bclim, Bitmap img) { Rectangle cropRect = new Rectangle(0, 0, bclim.Width, bclim.Height); Bitmap src = img; From 13a06a0651da0f2a14f44dc03f95bd23ca4921ee Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 1 Jan 2018 00:54:25 -0800 Subject: [PATCH 059/191] fix yield path --- pk3DS.Core/CTR/SARC.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS.Core/CTR/SARC.cs b/pk3DS.Core/CTR/SARC.cs index 794ac6fbb9..6a23bd1bcd 100644 --- a/pk3DS.Core/CTR/SARC.cs +++ b/pk3DS.Core/CTR/SARC.cs @@ -152,7 +152,7 @@ public string ExportFile(SFATEntry t, string outpath = null) var filepath = Path.Combine(outpath, name); File.WriteAllBytes(filepath, data); - return outpath; + return filepath; } /// From a852730ab752cffc5f196d8ea2d9aeca99eb8982 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 1 Jan 2018 17:00:48 -0800 Subject: [PATCH 060/191] Refactoring part 1 --- pk3DS.Core/CTR/BFLIM.cs | 93 +++++++++++++++++++++-------------------- pk3DS.Core/ImageUtil.cs | 16 ++----- 2 files changed, 52 insertions(+), 57 deletions(-) diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/BFLIM.cs index 5e538e76d5..b58d0db3c5 100644 --- a/pk3DS.Core/CTR/BFLIM.cs +++ b/pk3DS.Core/CTR/BFLIM.cs @@ -14,7 +14,7 @@ public class BFLIM : IXLIM public uint Magic { get => Footer.Magic; set => Footer.Magic = value; } public ushort Width { get => Footer.Width; set => Footer.Width = value; } public ushort Height { get => Footer.Height; set => Footer.Height = value; } - public BFLIMEncoding Format { get => Footer.Format; set => Footer.Format = value; } + public XLIMEncoding Format { get => Footer.Format; set => Footer.Format = value; } public BFLIM(Stream data) => ReadBFLIM(data); public BFLIM(byte[] data) @@ -102,12 +102,12 @@ public struct FLIM : IXLIM public ushort Width { get; set; } public ushort Height { get; set; } public short Alignment; - public BFLIMEncoding Format; + public XLIMEncoding Format; public BFLIMOrientation Orientation; public uint DataSize; } - public enum BFLIMEncoding : byte + public enum XLIMEncoding : byte { L8 = 0x00, // 8 Luminance A8 = 0x01, // 8 Alpha @@ -127,7 +127,20 @@ public enum BFLIMEncoding : byte public static class PixelConverter { - public static IEnumerable GetPixels(byte[] raw, BFLIMEncoding e) + private const int BPP_32 = 32; + private const int BPP_24 = 24; + private const int BPP_16 = 16; + private const int BPP_8 = 8; + private const int BPP_4 = 4; + + internal static readonly byte[] Convert5To8 = { + 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, + 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, + 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, + 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF + }; + + public static IEnumerable GetPixels(byte[] raw, XLIMEncoding e) { int bpp = e.GetBitsPerPixel(); if (bpp == BPP_4) @@ -149,58 +162,52 @@ public static IEnumerable GetPixels(byte[] raw, BFLIMEncoding e) } } - internal static readonly byte[] Convert5To8 = { - 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, - 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, - 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, - 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF - }; - private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) + private static uint GetDecodedPixelValue(uint val, XLIMEncoding e) { byte a = byte.MaxValue, r = 0, g = 0, b = 0; switch (e) { - case BFLIMEncoding.L4: - case BFLIMEncoding.L8: + case XLIMEncoding.L4: + case XLIMEncoding.L8: { r = g = b = (byte)val; break; } - case BFLIMEncoding.A4: - case BFLIMEncoding.A8: + case XLIMEncoding.A4: + case XLIMEncoding.A8: { r = g = b = 0xFF; a = (byte)val; break; } - case BFLIMEncoding.HILO8: + case XLIMEncoding.HILO8: { r = (byte)(val >> 8); g = (byte)(val & 0xFF); b = byte.MaxValue; break; } - case BFLIMEncoding.LA4: + case XLIMEncoding.LA4: { r = g = b = (byte)(val >> 4); a = (byte)(val & 0x0F); break; } - case BFLIMEncoding.LA8: + case XLIMEncoding.LA8: { r = g = b = (byte)(val >> 8); a = (byte)val; break; } - case BFLIMEncoding.RGBX8: + case XLIMEncoding.RGBX8: { r = (byte)(val >> 16); g = (byte)(val >> 8); b = (byte)(val >> 0); break; } - case BFLIMEncoding.RGBA8: + case XLIMEncoding.RGBA8: { r = (byte)(val >> 24); g = (byte)(val >> 16); @@ -208,7 +215,7 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) a = (byte) val; break; } - case BFLIMEncoding.RGBA4: + case XLIMEncoding.RGBA4: { a = (byte)(0x11 * (val & 0xf)); r = (byte)(0x11 * ((val >> 12) & 0xf)); @@ -216,14 +223,14 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) b = (byte)(0x11 * ((val >> 4) & 0xf)); break; } - case BFLIMEncoding.RGB565: + case XLIMEncoding.RGB565: { r = Convert5To8[(val >> 11) & 0x1F]; g = (byte)(((val >> 5) & 0x3F) * 4); b = Convert5To8[val & 0x1F]; break; } - case BFLIMEncoding.RGB5A1: + case XLIMEncoding.RGB5A1: { r = Convert5To8[(val >> 11) & 0x1F]; g = Convert5To8[(val >> 6) & 0x1F]; @@ -232,7 +239,7 @@ private static uint GetDecodedPixelValue(uint val, BFLIMEncoding e) break; } default: - throw new FormatException($"Unsupported {nameof(BFLIMEncoding)} value = {e}"); + throw new FormatException($"Unsupported {nameof(XLIMEncoding)} value = {e}"); } return (uint)((a << 24) | (r << 16) | (g << 8) | b); } @@ -251,7 +258,7 @@ public static uint GetEncodedPixelValue(byte[] raw, int offset, int size) return raw[offset]; } } - public static int GetBitsPerPixel(this BFLIMEncoding e) + public static int GetBitsPerPixel(this XLIMEncoding e) { if (_32.Contains(e)) return BPP_32; @@ -263,33 +270,29 @@ public static int GetBitsPerPixel(this BFLIMEncoding e) return BPP_8; return BPP_4; } - private const int BPP_32 = 32; - private const int BPP_24 = 24; - private const int BPP_16 = 16; - private const int BPP_8 = 8; - private const int BPP_4 = 4; - private static readonly HashSet _32 = new HashSet + + private static readonly HashSet _32 = new HashSet { - BFLIMEncoding.RGBA8, + XLIMEncoding.RGBA8, }; - private static readonly HashSet _24 = new HashSet + private static readonly HashSet _24 = new HashSet { - BFLIMEncoding.RGBX8, + XLIMEncoding.RGBX8, }; - private static readonly HashSet _16 = new HashSet + private static readonly HashSet _16 = new HashSet { - BFLIMEncoding.LA8, - BFLIMEncoding.HILO8, - BFLIMEncoding.RGB565, - BFLIMEncoding.RGB5A1, - BFLIMEncoding.RGBA4, + XLIMEncoding.LA8, + XLIMEncoding.HILO8, + XLIMEncoding.RGB565, + XLIMEncoding.RGB5A1, + XLIMEncoding.RGBA4, }; - private static readonly HashSet _8 = new HashSet + private static readonly HashSet _8 = new HashSet { - BFLIMEncoding.L8, - BFLIMEncoding.A8, - BFLIMEncoding.LA4, - BFLIMEncoding.ETC1A4, + XLIMEncoding.L8, + XLIMEncoding.A8, + XLIMEncoding.LA4, + XLIMEncoding.ETC1A4, }; } diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs index ca84a75624..a9cf65c3f0 100644 --- a/pk3DS.Core/ImageUtil.cs +++ b/pk3DS.Core/ImageUtil.cs @@ -19,26 +19,18 @@ public static class ImageUtil /// Human visible data public static Bitmap GetBitmap(this BFLIM bflim, bool crop = true) { - if (bflim.Format == BFLIMEncoding.ETC1 || bflim.Format == BFLIMEncoding.ETC1A4) + if (bflim.Format == XLIMEncoding.ETC1 || bflim.Format == XLIMEncoding.ETC1A4) return GetBitmapETC(bflim, crop); var data = bflim.GetImageData(crop); return GetBitmap(data, bflim.Footer.Width, bflim.Footer.Height); } - public static Bitmap GetBitmap(byte[] data, int width, int height) + public static Bitmap GetBitmap(byte[] data, int width, int height, int stride = 4, PixelFormat format = PixelFormat.Format32bppArgb) { - var bmp = new Bitmap(width, height); - var rect = new Rectangle(0, 0, width, height); - var bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - - var ptr = bmpData.Scan0; - Marshal.Copy(data, 0, ptr, data.Length); - bmp.UnlockBits(bmpData); - - return bmp; + return new Bitmap(width, height, stride, format, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0)); } public static Bitmap GetBitmapETC(BCLIM.CLIM bclim, bool crop = true) => GetBitmapETC(bclim, bclim.Data, bclim.FileFormat == 0x0B, crop); - public static Bitmap GetBitmapETC(BFLIM bflim, bool crop = true) => GetBitmapETC(bflim, bflim.PixelData, bflim.Footer.Format == BFLIMEncoding.ETC1A4, crop); + public static Bitmap GetBitmapETC(BFLIM bflim, bool crop = true) => GetBitmapETC(bflim, bflim.PixelData, bflim.Footer.Format == XLIMEncoding.ETC1A4, crop); private static Bitmap GetBitmapETC(IXLIM bflim, byte[] data, bool etc1a4, bool crop = true) { From eb69d468801137815ad1e6cfba47555c240360ac Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 1 Jan 2018 17:01:11 -0800 Subject: [PATCH 061/191] Move files --- pk3DS.Core/CTR/{ => Images}/BCLIM.cs | 0 pk3DS.Core/CTR/{ => Images}/BFLIM.cs | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename pk3DS.Core/CTR/{ => Images}/BCLIM.cs (100%) rename pk3DS.Core/CTR/{ => Images}/BFLIM.cs (100%) diff --git a/pk3DS.Core/CTR/BCLIM.cs b/pk3DS.Core/CTR/Images/BCLIM.cs similarity index 100% rename from pk3DS.Core/CTR/BCLIM.cs rename to pk3DS.Core/CTR/Images/BCLIM.cs diff --git a/pk3DS.Core/CTR/BFLIM.cs b/pk3DS.Core/CTR/Images/BFLIM.cs similarity index 100% rename from pk3DS.Core/CTR/BFLIM.cs rename to pk3DS.Core/CTR/Images/BFLIM.cs From a31571d1d655740beae3e6da1929db647eb765d9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 1 Jan 2018 20:29:26 -0800 Subject: [PATCH 062/191] Rearranging need to make bclim code generic (bmp data -> encoded swizzle) CLIM is now --- pk3DS.Core/CTR/Images/BCLIM.cs | 593 ++++-------------- pk3DS.Core/CTR/Images/BFLIM.cs | 345 +--------- pk3DS.Core/CTR/Images/BXLIM.cs | 67 ++ pk3DS.Core/CTR/Images/CLIMHeader.cs | 31 + pk3DS.Core/CTR/Images/Coordinate.cs | 25 + pk3DS.Core/CTR/Images/FLIMHeader.cs | 30 + .../CTR/{IXLIM.cs => Images/IXLIMHeader.cs} | 6 +- pk3DS.Core/CTR/Images/PixelConverter.cs | 176 ++++++ pk3DS.Core/CTR/Images/XLIMEncoding.cs | 20 + pk3DS.Core/CTR/Images/XLIMOrientation.cs | 12 + pk3DS.Core/CTR/Images/XLIMOrienter.cs | 112 ++++ pk3DS.Core/CTR/Images/XLIMUtil.cs | 31 + pk3DS.Core/CTR/SMDH.cs | 8 +- pk3DS.Core/ImageUtil.cs | 44 +- pk3DS/Subforms/Gen6/TitleScreenEditor6.cs | 15 +- 15 files changed, 680 insertions(+), 835 deletions(-) create mode 100644 pk3DS.Core/CTR/Images/BXLIM.cs create mode 100644 pk3DS.Core/CTR/Images/CLIMHeader.cs create mode 100644 pk3DS.Core/CTR/Images/Coordinate.cs create mode 100644 pk3DS.Core/CTR/Images/FLIMHeader.cs rename pk3DS.Core/CTR/{IXLIM.cs => Images/IXLIMHeader.cs} (62%) create mode 100644 pk3DS.Core/CTR/Images/PixelConverter.cs create mode 100644 pk3DS.Core/CTR/Images/XLIMEncoding.cs create mode 100644 pk3DS.Core/CTR/Images/XLIMOrientation.cs create mode 100644 pk3DS.Core/CTR/Images/XLIMOrienter.cs create mode 100644 pk3DS.Core/CTR/Images/XLIMUtil.cs diff --git a/pk3DS.Core/CTR/Images/BCLIM.cs b/pk3DS.Core/CTR/Images/BCLIM.cs index 9a5801bdc3..3abf345426 100644 --- a/pk3DS.Core/CTR/Images/BCLIM.cs +++ b/pk3DS.Core/CTR/Images/BCLIM.cs @@ -1,22 +1,75 @@ using System; using System.Drawing; using System.IO; +using pk3DS.Core.CTR.Images; namespace pk3DS.Core.CTR { - public static class BCLIM + public class BCLIM : BXLIM { - public static void openFile(string path, bool autosave = false, bool crop = true, char format = 'X') + public BCLIM(Stream data) => ReadBCLIM(data); + public BCLIM(byte[] data) { - // Handle file - if (!File.Exists(path)) throw new Exception("Can only accept files, not folders"); - string ext = Path.GetExtension(path); - if (ext == ".png") - makeBCLIM(path, format); - else if (ext == ".bin" || ext == ".bclim") - makeBMP(path, autosave, crop); + using (var ms = new MemoryStream(data)) + ReadBCLIM(ms); + } + public BCLIM(string path) + { + var data = File.ReadAllBytes(path); + using (var ms = new MemoryStream(data)) + ReadBCLIM(ms); + } + + private void ReadBCLIM(Stream ms) + { + PixelData = new byte[ms.Length - FLIMHeader.SIZE]; + ms.Read(PixelData, 0, PixelData.Length); + var footer = new byte[FLIMHeader.SIZE]; + ms.Read(footer, 0, footer.Length); + Footer = footer.ToStructure(); + } + + public override uint[] GetPixels() + { + if (Format == (XLIMEncoding)7 && BitConverter.ToUInt16(PixelData, 0) == 2) // Gen6 Palette + return GetPixelsViaPalette(); + return base.GetPixels(); + } + + private uint[] GetPixelsViaPalette() + { + using (var ms = new MemoryStream(PixelData)) + using (var br = new BinaryReader(ms)) + { + if (br.ReadUInt16() != 2) return null; + + // read palette + int count = br.ReadUInt16(); + uint[] colors = new uint[count]; + for (int i = 0; i < colors.Length; i++) + colors[i] = PixelConverter.GetDecodedPixelValue(br.ReadUInt16(), XLIMEncoding.RGB565); + + // read pixels + bool half = colors.Length < 0x10; + uint[] pixels = new uint[BaseSize * BaseSize]; + for (int i = 0; i < pixels.Length; i++) + { + var b = br.ReadByte(); + if (!half) + { + pixels[i] = colors[b]; + } + else + { + pixels[i++] = colors[b & 0xF]; + pixels[i] = colors[b >> 4]; + } + } + return pixels; + } } + // todo: move System.Drawing utilization out, make encoding generic for bflim public static byte[] IMGToBCLIM(Image img, char fc) { Bitmap mBitmap = new Bitmap(img); @@ -80,15 +133,14 @@ public static Image makeBCLIM(string path, char fc) } public static Image makeBMP(string path, bool autosave = false, bool crop = true) { - CLIM bclim = analyze(path); + BCLIM bclim = analyze(path); if (bclim.Magic != 0x4D494C43) { System.Media.SystemSounds.Beep.Play(); return null; } - - Bitmap img = GetBCLIMImage(bclim); + Bitmap img = bclim.GetBitmap(crop); if (img == null) return null; if (crop) @@ -98,146 +150,6 @@ public static Image makeBMP(string path, bool autosave = false, bool crop = true return img; } - private static Bitmap GetBCLIMImage(CLIM bclim) - { - int f = bclim.FileFormat; - switch (f) - { - case 7 when BitConverter.ToUInt16(bclim.Data, 0) == 2: // PKM XY Format 7 (Color Palette) - return getIMG_XY7(bclim); - case 0xA: case 0xB: - return ImageUtil.GetBitmapETC(bclim); - default: - if (f > 0xD) // unsupported formats - return null; - return getIMG(bclim); - } - } - - // Bitmap Data Writing - public static Bitmap getIMG(int width, int height, byte[] bytes, int f) - { - Bitmap img = new Bitmap(width, height); - int area = img.Width * img.Height; - // Tiles Per Width - int p = gcm(img.Width, 8) / 8; - if (p == 0) p = 1; - using (Stream BitmapStream = new MemoryStream(bytes)) - using (BinaryReader br = new BinaryReader(BitmapStream)) - for (uint i = 0; i < area; i++) // for every pixel - { - uint x; - uint y; - d2xy(i % 64, out x, out y); - uint tile = i / 64; - - // Shift Tile Coordinate into Tilemap - x += (uint)(tile % p) * 8; - y += (uint)(tile / p) * 8; - - // Get Color - Color c; - switch (f) - { - case 0x0: // L8 // 8bit/1 byte - case 0x1: // A8 - case 0x2: // LA4 - c = DecodeColor(br.ReadByte(), f); - break; - case 0x3: // LA8 // 16bit/2 byte - case 0x4: // HILO8 - case 0x5: // RGB565 - case 0x8: // RGBA4444 - case 0x7: // RGBA5551 - c = DecodeColor(br.ReadUInt16(), f); - break; - case 0x6: // RGB8: // 24bit - byte[] data = br.ReadBytes(3); Array.Resize(ref data, 4); - c = DecodeColor(BitConverter.ToUInt32(data, 0), f); - break; - case 0x9: // RGBA8888 - c = DecodeColor(br.ReadUInt32(), f); - break; - case 0xC: // L4 - case 0xD: // A4 // 4bit - Do 2 pixels at a time. - uint val = br.ReadByte(); - img.SetPixel((int)x, (int)y, DecodeColor(val & 0xF, f)); // lowest bits for the low pixel - i++; x++; - c = DecodeColor(val >> 4, f); // highest bits for the high pixel - break; - default: throw new Exception("Invalid FileFormat."); - } - img.SetPixel((int)x, (int)y, c); - } - return img; - } - public static Bitmap getIMG(CLIM bclim) - { - if (bclim.FileFormat == 7 && BitConverter.ToUInt16(bclim.Data, 0) == 2) // XY7 - return getIMG_XY7(bclim); - if (bclim.FileFormat == 10 || bclim.FileFormat == 11) // Use ETC1 to get image instead. - return ImageUtil.GetBitmapETC(bclim); - // New Image - int w = nlpo2(gcm(bclim.Width, 8)); - int h = nlpo2(gcm(bclim.Height, 8)); - int f = bclim.FileFormat; - int area = w * h; - if (f == 9 && area > bclim.Data.Length / 4) - { - w = gcm(bclim.Width, 8); - h = gcm(bclim.Height, 8); - } - // Build Image - return getIMG(w, h, bclim.Data, f); - } - public static Bitmap getIMG_XY7(CLIM bclim) - { - Bitmap img = new Bitmap(bclim.BaseSize, bclim.BaseSize); - using (Stream BitmapStream = new MemoryStream(bclim.Data)) - using (BinaryReader br = new BinaryReader(BitmapStream)) - { - // Fetch Color stuff. - if (br.ReadUInt16() != 2) return null; - ushort colors = br.ReadUInt16(); - Color[] ca = new Color[colors]; - for (int i = 0; i < colors; i++) - ca[i] = DecodeColor(br.ReadUInt16(), 7); - - // Coordinates - // Colors - // Tiles Per Width - int p = gcm(img.Width, 8) / 8; - if (p == 0) p = 1; - - for (uint i = 0; i < bclim.BaseSize * bclim.BaseSize; i++) // for every pixel - { - uint x; - uint y; - d2xy(i % 64, out x, out y); - uint tile = i / 64; - - // Shift Tile Coordinate into Tilemap - x += (uint)(tile % p) * 8; - y += (uint)(tile / p) * 8; - - byte val = br.ReadByte(); - if (colors <= 0x10) // Handle 2 pixels at a time - { - img.SetPixel((int)x, (int)y, ca[val >> 4]); - x++; i++; val &= 0xF; - img.SetPixel((int)x, (int)y, ca[val]); - } - else //1bpp instead of .5, handle 2 pixels at a time the same way for no reason - { - img.SetPixel((int)x, (int)y, ca[val]); - x++; i++; val = br.ReadByte(); - img.SetPixel((int)x, (int)y, ca[val]); - } - } - } - return img; - } - // BCLIM Data Writing public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) { @@ -256,10 +168,10 @@ public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) if (colors > 70) throw new Exception("Too many colors"); // Set up a new reverse image to build into. - int w = gcm(img.Width, 8); - int h = gcm(img.Height, 8); - w = Math.Max(nlpo2(w), nlpo2(h)); - h = w; + int w = XLIMUtil.gcm(img.Width, 8); + int h = XLIMUtil.gcm(img.Height, 8); + w = Math.Max(XLIMUtil.nlpo2(w), XLIMUtil.nlpo2(h)); + h = w; byte[] pixelarray = new byte[w * h]; const int colorformat = 2; @@ -267,7 +179,7 @@ public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) pcs[0] = Color.FromArgb(0, 0xFF, 0xFF, 0xFF); - int p = gcm(w, 8) / 8; + int p = XLIMUtil.gcm(w, 8) / 8; if (p == 0) p = 1; int d = 0; for (uint i = 0; i < pixelarray.Length; i++) @@ -276,7 +188,7 @@ public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) // Get Tile Coordinate uint x; uint y; - d2xy(i % 64, out x, out y); + XLIMOrienter.d2xy(i % 64, out x, out y); // Get Shift Tile uint tile = i / 64; @@ -314,12 +226,12 @@ public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) bz.Write((ushort)colorformat); bz.Write((ushort)ctr); // Write Colors for (int i = 0; i < ctr; i++) - bz.Write(GetRGBA5551(pcs[i])); // Write byte array. + bz.Write((ushort)GetRGBA5551(pcs[i])); // Write byte array. // Write Pixel Data for (uint i = 0; i < d; i++) bz.Write(pixelarray[i]); // Write Padding - while (pixelcolors.Length < nlpo2((int)pixelcolors.Length)) + while (pixelcolors.Length < XLIMUtil.nlpo2((int)pixelcolors.Length)) bz.Write((byte)0); // Copy to main CLIM. pixelcolors.Position = 0; pixelcolors.CopyTo(ms); @@ -333,6 +245,24 @@ public static void writeGeneric(int format, Bitmap img, ref MemoryStream ms, boo bz.Flush(); } + public static byte[] MakePixelData(byte[] input, ref int w, ref int h, XLIMOrientation x = XLIMOrientation.None) + { + int width = w; + w = XLIMUtil.nlpo2(w); + h = XLIMUtil.nlpo2(h); + if (!(Math.Min(w, h) < 32)) + w = h = Math.Max(w, h); // resize + + byte[] pixels = new byte[w * h * 4]; + var orienter = new XLIMOrienter(w, h, x); + for (uint i = 0; i < pixels.Length / 4; i++) + { + var c = orienter.Get(i); + var offset = c.X * 4 + c.Y * width; + Array.Copy(input, offset, pixels, i * 4, 4); + } + return pixels; + } public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true) { int w = img.Width; @@ -344,25 +274,23 @@ public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true) // Square Format Checks if (rectangle && Math.Min(img.Width, img.Height) < 32) { - w = nlpo2(img.Width); - h = nlpo2(img.Height); + w = XLIMUtil.nlpo2(img.Width); + h = XLIMUtil.nlpo2(img.Height); } else { - w = h = Math.Max(nlpo2(w), nlpo2(h)); // else resize + w = h = Math.Max(XLIMUtil.nlpo2(w), XLIMUtil.nlpo2(h)); // else resize } } using (MemoryStream mz = new MemoryStream()) using (BinaryWriter bz = new BinaryWriter(mz)) { - int p = gcm(w, 8) / 8; + int p = XLIMUtil.gcm(w, 8) / 8; if (p == 0) p = 1; for (uint i = 0; i < w * h; i++) { - uint x; - uint y; - d2xy(i % 64, out x, out y); + XLIMOrienter.d2xy(i % 64, out uint x, out uint y); // Get Shift Tile uint tile = i / 64; @@ -380,44 +308,44 @@ public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true) switch (format) { - case 0: bz.Write(GetL8(c)); break; // L8 - case 1: bz.Write(GetA8(c)); break; // A8 - case 2: bz.Write(GetLA4(c)); break; // LA4(4) - case 3: bz.Write(GetLA8(c)); break; // LA8(8) - case 4: bz.Write(GetHILO8(c)); break; // HILO8 - case 5: bz.Write(GetRGB565(c)); break; // RGB565 + case 0: bz.Write((byte)GetL8(c)); break; // L8 + case 1: bz.Write((byte)GetA8(c)); break; // A8 + case 2: bz.Write((byte)GetLA4(c)); break; // LA4(4) + case 3: bz.Write((ushort)GetLA8(c)); break; // LA8(8) + case 4: bz.Write((ushort)GetHILO8(c)); break; // HILO8 + case 5: bz.Write((ushort)GetRGB565(c)); break; // RGB565 case 6: - { - bz.Write(c.B); - bz.Write(c.G); - bz.Write(c.R); break; - } - case 7: bz.Write(GetRGBA5551(c)); break; // RGBA5551 - case 8: bz.Write(GetRGBA4444(c)); break; // RGBA4444 - case 9: bz.Write(GetRGBA8888(c)); break; // RGBA8 + { + bz.Write(c.B); + bz.Write(c.G); + bz.Write(c.R); break; + } + case 7: bz.Write((ushort)GetRGBA5551(c)); break; // RGBA5551 + case 8: bz.Write((ushort)GetRGBA4444(c)); break; // RGBA4444 + case 9: bz.Write((uint)GetRGBA8888(c)); break; // RGBA8 case 10: throw new Exception("ETC1 not supported."); case 11: throw new Exception("ETC1A4 not supported."); case 12: - { - byte val = (byte)(GetL8(c) / 0x11); // First Pix // L4 - { c = img.GetPixel((int)x, (int)y); if (c.A == 0) c = Color.FromArgb(0, 0, 0, 0); } - val |= (byte)((GetL8(c) / 0x11) << 4); i++; - bz.Write(val); break; - } + { + byte val = (byte)(GetL8(c) / 0x11); // First Pix // L4 + { c = img.GetPixel((int)x, (int)y); if (c.A == 0) c = Color.FromArgb(0, 0, 0, 0); } + val |= (byte)((GetL8(c) / 0x11) << 4); i++; + bz.Write(val); break; + } case 13: - { - byte val = (byte)(GetA8(c) / 0x11); // First Pix // L4 - { c = img.GetPixel((int)x, (int)y); } - val |= (byte)((GetA8(c) / 0x11) << 4); i++; - bz.Write(val); break; - } + { + byte val = (byte)(GetA8(c) / 0x11); // First Pix // L4 + { c = img.GetPixel((int)x, (int)y); } + val |= (byte)((GetA8(c) / 0x11) << 4); i++; + bz.Write(val); break; + } } } if (!perfect) - while (mz.Length < nlpo2((int)mz.Length)) // pad + while (mz.Length < XLIMUtil.nlpo2((int)mz.Length)) // pad bz.Write((byte)0); return mz.ToArray(); - } + } } public static int getColorCount(Bitmap img) { @@ -437,72 +365,6 @@ public static int getColorCount(Bitmap img) return colorct; } - - internal static readonly int[] Convert5To8 = { 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, - 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, - 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, - 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF }; - - private static Color DecodeColor(uint val, int format) - { - int alpha = 0xFF, red, green, blue; - switch (format) - { - case 0: // L8 - return Color.FromArgb(alpha, (byte)val, (byte)val, (byte)val); - case 1: // A8 - return Color.FromArgb((byte)val, alpha, alpha, alpha); - case 2: // LA4 - red = (byte)(val >> 4); - alpha = (byte)(val & 0x0F); - return Color.FromArgb(alpha, red, red, red); - case 3: // LA8 - red = (byte)(val >> 8 & 0xFF); - alpha = (byte)(val & 0xFF); - return Color.FromArgb(alpha, red, red, red); - case 4: // HILO8 - red = (byte)(val >> 8); - green = (byte)(val & 0xFF); - return Color.FromArgb(alpha, red, green, 0xFF); - case 5: // RGB565 - red = Convert5To8[(val >> 11) & 0x1F]; - green = (byte)(((val >> 5) & 0x3F) * 4); - blue = Convert5To8[val & 0x1F]; - return Color.FromArgb(alpha, red, green, blue); - case 6: // RGB8 - red = (byte)((val >> 16) & 0xFF); - green = (byte)((val >> 8) & 0xFF); - blue = (byte)(val & 0xFF); - return Color.FromArgb(alpha, red, green, blue); - case 7: // RGBA5551 - red = Convert5To8[(val >> 11) & 0x1F]; - green = Convert5To8[(val >> 6) & 0x1F]; - blue = Convert5To8[(val >> 1) & 0x1F]; - alpha = (val & 0x0001) == 1 ? 0xFF : 0x00; - return Color.FromArgb(alpha, red, green, blue); - case 8: // RGBA4444 - alpha = (byte)(0x11 * (val & 0xf)); - red = (byte)(0x11 * ((val >> 12) & 0xf)); - green = (byte)(0x11 * ((val >> 8) & 0xf)); - blue = (byte)(0x11 * ((val >> 4) & 0xf)); - return Color.FromArgb(alpha, red, green, blue); - case 9: // RGBA8888 - red = (byte)((val >> 24) & 0xFF); - green = (byte)((val >> 16) & 0xFF); - blue = (byte)((val >> 8) & 0xFF); - alpha = (byte)(val & 0xFF); - return Color.FromArgb(alpha, red, green, blue); - // case 10: - // case 11: - case 12: // L4 - return Color.FromArgb(alpha, (byte)(val * 0x11), (byte)(val * 0x11), (byte)(val * 0x11)); - case 13: // A4 - return Color.FromArgb((byte)(val * 0x11), alpha, alpha, alpha); - default: - return Color.White; - } - } - // Color Conversion internal static byte GetL8(Color c) { @@ -573,219 +435,28 @@ internal static byte convert8to5(int colorval) { byte[] Convert8to5 = { 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, - 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, - 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, - 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF }; + 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, + 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, + 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF }; byte i = 0; while (colorval > Convert8to5[i]) i++; return i; } - internal static uint DM2X(uint code) - { - return C11(code >> 0); - } - internal static uint DM2Y(uint code) - { - return C11(code >> 1); - } - internal static uint C11(uint x) - { - x &= 0x55555555; // x = -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 - x = (x ^ (x >> 1)) & 0x33333333; // x = --fe --dc --ba --98 --76 --54 --32 --10 - x = (x ^ (x >> 2)) & 0x0f0f0f0f; // x = ---- fedc ---- ba98 ---- 7654 ---- 3210 - x = (x ^ (x >> 4)) & 0x00ff00ff; // x = ---- ---- fedc ba98 ---- ---- 7654 3210 - x = (x ^ (x >> 8)) & 0x0000ffff; // x = ---- ---- ---- ---- fedc ba98 7654 3210 - return x; - } - - /// - /// Greatest common multiple (to round up) - /// - /// Number to round-up. - /// Multiple to round-up to. - /// Rounded up number. - internal static int gcm(int n, int m) - { - return (n + m - 1) / m * m; - } - /// - /// Next Largest Power of 2 - /// - /// Input to round up to next 2^n - /// 2^n > x && x > 2^(n-1) - internal static int nlpo2(int x) - { - x--; // comment out to always take the next biggest power of two, even if x is already a power of two - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - x |= x >> 8; - x |= x >> 16; - return x+1; - } - - // Morton Translation - /// - /// Combines X/Y Coordinates to a decimal ordinate. - /// - /// - /// - /// - internal static uint xy2d(uint x, uint y) - { - x &= 0x0000ffff; - y &= 0x0000ffff; - x |= x << 8; - y |= y << 8; - x &= 0x00ff00ff; - y &= 0x00ff00ff; - x |= x << 4; - y |= y << 4; - x &= 0x0f0f0f0f; - y &= 0x0f0f0f0f; - x |= x << 2; - y |= y << 2; - x &= 0x33333333; - y &= 0x33333333; - x |= x << 1; - y |= y << 1; - x &= 0x55555555; - y &= 0x55555555; - return x | (y << 1); - } - /// - /// Decimal Ordinate In to X / Y Coordinate Out - /// - /// Loop integer which will be decoded to X/Y - /// Output X coordinate - /// Output Y coordinate - internal static void d2xy(uint d, out uint x, out uint y) - { - x = d; - y = x >> 1; - x &= 0x55555555; - y &= 0x55555555; - x |= x >> 1; - y |= y >> 1; - x &= 0x33333333; - y &= 0x33333333; - x |= x >> 2; - y |= y >> 2; - x &= 0x0f0f0f0f; - y &= 0x0f0f0f0f; - x |= x >> 4; - y |= y >> 4; - x &= 0x00ff00ff; - y &= 0x00ff00ff; - x |= x >> 8; - y |= y >> 8; - x &= 0x0000ffff; - y &= 0x0000ffff; - } - public static CLIM analyze(byte[] data, string shortPath) + public static BCLIM analyze(byte[] data, string shortPath) { - CLIM bclim = new CLIM + BCLIM bclim = new BCLIM(data) { FileName = Path.GetFileNameWithoutExtension(shortPath), FilePath = Path.GetDirectoryName(shortPath), Extension = Path.GetExtension(shortPath) }; - byte[] byteArray = data; - using (BinaryReader br = new BinaryReader(new MemoryStream(byteArray))) - { - br.BaseStream.Seek(br.BaseStream.Length - 0x28, SeekOrigin.Begin); - bclim.Magic = br.ReadUInt32(); - - bclim.BOM = br.ReadUInt16(); - bclim.CLIMLength = br.ReadUInt32(); - bclim.TileWidth = 2 << br.ReadByte(); - bclim.TileHeight = 2 << br.ReadByte(); - bclim.totalLength = br.ReadUInt32(); - bclim.Count = br.ReadUInt32(); - - bclim.imag = br.ReadChars(4); - bclim.imagLength = br.ReadUInt32(); - bclim.Width = br.ReadUInt16(); - bclim.Height = br.ReadUInt16(); - bclim.FileFormat = br.ReadInt32(); - bclim.dataLength = br.ReadUInt32(); - - bclim.BaseSize = Math.Max(nlpo2(bclim.Width), nlpo2(bclim.Height)); - - br.BaseStream.Seek(0, SeekOrigin.Begin); - bclim.Data = br.ReadBytes((int)bclim.dataLength); - - return bclim; - } - } - public static CLIM analyze(string path) - { - CLIM bclim = new CLIM - { - FileName = Path.GetFileNameWithoutExtension(path), - FilePath = Path.GetDirectoryName(path), - Extension = Path.GetExtension(path) - }; - byte[] byteArray = File.ReadAllBytes(path); - using (BinaryReader br = new BinaryReader(new MemoryStream(byteArray))) - { - br.BaseStream.Seek(br.BaseStream.Length - 0x28, SeekOrigin.Begin); - bclim.Magic = br.ReadUInt32(); - - bclim.BOM = br.ReadUInt16(); - bclim.CLIMLength = br.ReadUInt32(); - bclim.TileWidth = 2 << br.ReadByte(); - bclim.TileHeight = 2 << br.ReadByte(); - bclim.totalLength = br.ReadUInt32(); - bclim.Count = br.ReadUInt32(); - - bclim.imag = br.ReadChars(4); - bclim.imagLength = br.ReadUInt32(); - bclim.Width = br.ReadUInt16(); - bclim.Height = br.ReadUInt16(); - bclim.FileFormat = br.ReadInt32(); - bclim.dataLength = br.ReadUInt32(); - - bclim.BaseSize = Math.Max(nlpo2(bclim.Width), nlpo2(bclim.Height)); - - br.BaseStream.Seek(0, SeekOrigin.Begin); - bclim.Data = br.ReadBytes((int)bclim.dataLength); - - return bclim; - } + return bclim; } - public struct CLIM : IXLIM + public static BCLIM analyze(string path) { - public uint Magic { get; set; }// CLIM = 0x4D494C43 - public ushort BOM; // 0xFFFE - public uint CLIMLength; // HeaderLength - 14 - public int TileWidth; // 1<<[[n]] - public int TileHeight; // 1<<[[n]] - public uint totalLength; // Total Length of file - public uint Count; // "1" , guessing it's just Count. - - public char[] imag; // imag = 0x67616D69 - public uint imagLength; // HeaderLength - 10 - public ushort Width { get; set; } // Final Dimensions - public ushort Height { get; set; } // Final Dimensions - public int FileFormat; // ?? - public uint dataLength; // Pixel Data Region Length - - public byte[] Data { get; set; } - - public int BaseSize; - - //// Contained Data - //public int ColorFormat; - //public int ColorCount; - //public Color[] Colors; - - //public int[] Pixels; - - public string FileName; - public string FilePath; - public string Extension; + byte[] data = File.ReadAllBytes(path); + return analyze(data, path); } } } \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/BFLIM.cs b/pk3DS.Core/CTR/Images/BFLIM.cs index b58d0db3c5..1aa9838b03 100644 --- a/pk3DS.Core/CTR/Images/BFLIM.cs +++ b/pk3DS.Core/CTR/Images/BFLIM.cs @@ -1,21 +1,11 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Runtime.InteropServices; +using pk3DS.Core.CTR.Images; namespace pk3DS.Core.CTR { - public class BFLIM : IXLIM + public class BFLIM : BXLIM { - public byte[] PixelData; - public FLIM Footer; - - public uint Magic { get => Footer.Magic; set => Footer.Magic = value; } - public ushort Width { get => Footer.Width; set => Footer.Width = value; } - public ushort Height { get => Footer.Height; set => Footer.Height = value; } - public XLIMEncoding Format { get => Footer.Format; set => Footer.Format = value; } - public BFLIM(Stream data) => ReadBFLIM(data); public BFLIM(byte[] data) { @@ -31,336 +21,11 @@ public BFLIM(string path) private void ReadBFLIM(Stream ms) { - PixelData = new byte[ms.Length - FLIM.SIZE]; + PixelData = new byte[ms.Length - FLIMHeader.SIZE]; ms.Read(PixelData, 0, PixelData.Length); - var footer = new byte[FLIM.SIZE]; + var footer = new byte[FLIMHeader.SIZE]; ms.Read(footer, 0, footer.Length); - Footer = footer.ToStructure(); - } - - /// - /// ARGB 32bpp - /// - public byte[] GetImageData(bool crop = true) - { - var orienter = new BFLIMOrienter(Footer.Width, Footer.Height, Footer.Orientation); - uint[] pixels = GetPixels(); - - if (!crop) - { - Footer.Width = (ushort)orienter.Width; - Footer.Height = (ushort)orienter.Height; - } - - // uint[] -> byte[] - byte[] array = new byte[Footer.Width * Footer.Height * 4]; - for (uint i = 0; i < pixels.Length; i++) - { - var coord = orienter.Get(i); - if (coord.X >= Footer.Width || coord.Y >= Footer.Height) - continue; - - var val = pixels[i]; - uint o = 4 * (coord.X + coord.Y * Footer.Width); - array[o + 0] = (byte)(val & 0xFF); - array[o + 1] = (byte)(val >> 8 & 0xFF); - array[o + 2] = (byte)(val >> 16 & 0xFF); - array[o + 3] = (byte)(val >> 24 & 0xFF); - } - return array; - } - public uint[] GetPixels() - { - return PixelConverter.GetPixels(PixelData, Footer.Format).ToArray(); - } - public byte[] GetPixelsRaw() - { - var pix = GetPixels(); - byte[] raw = new byte[pix.Length * 4]; - Buffer.BlockCopy(pix, 0, raw, 0, raw.Length); - return raw; - } - } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct FLIM : IXLIM - { - public const int SIZE = 40; - public const string Identifier = "FLIM"; - public bool Valid => LittleEndian && Magic == 0x4D_49_4C_46; // FLIM - public bool LittleEndian => BOM == 0xFEFF; - public bool BigEndian => BOM == 0xFFFE; - - public uint Magic { get; set; } // FLIM - public ushort BOM; // 0xFFFE - public ushort HeaderLength; // always 0x14 - public int Version; - public uint TotalLength; - public uint Count; - - public uint imag; // imag = 67616D69 - public uint imagLength; // always 0x10 - public ushort Width { get; set; } - public ushort Height { get; set; } - public short Alignment; - public XLIMEncoding Format; - public BFLIMOrientation Orientation; - public uint DataSize; - } - - public enum XLIMEncoding : byte - { - L8 = 0x00, // 8 Luminance - A8 = 0x01, // 8 Alpha - LA4 = 0x02, // 8 Luminance + Alpha - LA8 = 0x03, // 16 Luminance + Alpha - HILO8 = 0x04, // 16 ? - RGB565 = 0x05, // 16 Color - RGBX8 = 0x06, // 24 Color - RGB5A1 = 0x07, // 16 Color + Alpha - RGBA4 = 0x08, // 16 Color + Alpha - RGBA8 = 0x09, // 32 Color + Alpha - ETC1 = 0x0A, // 4 Color - ETC1A4 = 0x0B, // 8 Color + Alpha - L4 = 0x0C, // 4 Luminance - A4 = 0x0D, // 4 Alpha - } - - public static class PixelConverter - { - private const int BPP_32 = 32; - private const int BPP_24 = 24; - private const int BPP_16 = 16; - private const int BPP_8 = 8; - private const int BPP_4 = 4; - - internal static readonly byte[] Convert5To8 = { - 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, - 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, - 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, - 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF - }; - - public static IEnumerable GetPixels(byte[] raw, XLIMEncoding e) - { - int bpp = e.GetBitsPerPixel(); - if (bpp == BPP_4) - { - foreach (byte b in raw) - { - byte _0 = (byte)(b & 0xF); - byte _1 = (byte)(b >> 4); - yield return GetDecodedPixelValue(_0, e); - yield return GetDecodedPixelValue(_1, e); - } - yield break; - } - - for (int i = 0; i < raw.Length; i += bpp / 8) - { - uint val = GetEncodedPixelValue(raw, i, bpp); - yield return GetDecodedPixelValue(val, e); - } - } - - - private static uint GetDecodedPixelValue(uint val, XLIMEncoding e) - { - byte a = byte.MaxValue, r = 0, g = 0, b = 0; - switch (e) - { - case XLIMEncoding.L4: - case XLIMEncoding.L8: - { - r = g = b = (byte)val; - break; - } - case XLIMEncoding.A4: - case XLIMEncoding.A8: - { - r = g = b = 0xFF; - a = (byte)val; - break; - } - case XLIMEncoding.HILO8: - { - r = (byte)(val >> 8); - g = (byte)(val & 0xFF); - b = byte.MaxValue; - break; - } - case XLIMEncoding.LA4: - { - r = g = b = (byte)(val >> 4); - a = (byte)(val & 0x0F); - break; - } - case XLIMEncoding.LA8: - { - r = g = b = (byte)(val >> 8); - a = (byte)val; - break; - } - case XLIMEncoding.RGBX8: - { - r = (byte)(val >> 16); - g = (byte)(val >> 8); - b = (byte)(val >> 0); - break; - } - case XLIMEncoding.RGBA8: - { - r = (byte)(val >> 24); - g = (byte)(val >> 16); - b = (byte)(val >> 8); - a = (byte) val; - break; - } - case XLIMEncoding.RGBA4: - { - a = (byte)(0x11 * (val & 0xf)); - r = (byte)(0x11 * ((val >> 12) & 0xf)); - g = (byte)(0x11 * ((val >> 8) & 0xf)); - b = (byte)(0x11 * ((val >> 4) & 0xf)); - break; - } - case XLIMEncoding.RGB565: - { - r = Convert5To8[(val >> 11) & 0x1F]; - g = (byte)(((val >> 5) & 0x3F) * 4); - b = Convert5To8[val & 0x1F]; - break; - } - case XLIMEncoding.RGB5A1: - { - r = Convert5To8[(val >> 11) & 0x1F]; - g = Convert5To8[(val >> 6) & 0x1F]; - b = Convert5To8[(val >> 1) & 0x1F]; - a = (val & 1) == 1 ? byte.MaxValue : byte.MinValue; - break; - } - default: - throw new FormatException($"Unsupported {nameof(XLIMEncoding)} value = {e}"); - } - return (uint)((a << 24) | (r << 16) | (g << 8) | b); - } - - public static uint GetEncodedPixelValue(byte[] raw, int offset, int size) - { - switch (size) - { - case BPP_32: - return BitConverter.ToUInt32(raw, offset); - case BPP_24: - return BitConverter.ToUInt32(raw, offset) & 0x00FFFFFF; - case BPP_16: - return BitConverter.ToUInt16(raw, offset); - default: - return raw[offset]; - } - } - public static int GetBitsPerPixel(this XLIMEncoding e) - { - if (_32.Contains(e)) - return BPP_32; - if (_24.Contains(e)) - return BPP_24; - if (_16.Contains(e)) - return BPP_16; - if (_8.Contains(e)) - return BPP_8; - return BPP_4; - } - - private static readonly HashSet _32 = new HashSet - { - XLIMEncoding.RGBA8, - }; - private static readonly HashSet _24 = new HashSet - { - XLIMEncoding.RGBX8, - }; - private static readonly HashSet _16 = new HashSet - { - XLIMEncoding.LA8, - XLIMEncoding.HILO8, - XLIMEncoding.RGB565, - XLIMEncoding.RGB5A1, - XLIMEncoding.RGBA4, - }; - private static readonly HashSet _8 = new HashSet - { - XLIMEncoding.L8, - XLIMEncoding.A8, - XLIMEncoding.LA4, - XLIMEncoding.ETC1A4, - }; - } - - [Flags] - public enum BFLIMOrientation : byte - { - None = 0, - Rotate90 = 4, - Transpose = 8, - } - - public class BFLIMOrienter - { - readonly BFLIMOrientation _orientation; - - public uint Width { get; } - public uint Height { get; } - public uint PanelsPerWidth { get; } - - public BFLIMOrienter(int width, int height, BFLIMOrientation orientation) - { - Width = (uint)BCLIM.nlpo2(BCLIM.gcm(width, 8)); - Height = (uint)BCLIM.nlpo2(BCLIM.gcm(height, 8)); - - uint stride = orientation == BFLIMOrientation.None ? Width : Height; - PanelsPerWidth = (uint)BCLIM.gcm((int)stride, 8) / 8; - - _orientation = orientation; - } - - public Coordinate Get(uint i) - { - BCLIM.d2xy(i & 0x3F, out uint x, out uint y); - - // Shift Tile Coordinate into Tilemap - var tile = i >> 6; - x |= (tile % PanelsPerWidth) << 3; - y |= (tile / PanelsPerWidth) << 3; - - var coord = new Coordinate(x, y); - if (_orientation.HasFlag(BFLIMOrientation.Rotate90)) - coord.Rotate90(Height); - if (_orientation.HasFlag(BFLIMOrientation.Transpose)) - coord.Transpose(); - return coord; - } - } - - public struct Coordinate - { - public uint X { get; private set; } - public uint Y { get; private set; } - - public Coordinate(uint x, uint y) - { - X = x; Y = y; - } - public void Transpose() - { - var tmp = X; - X = Y; - Y = tmp; - } - public void Rotate90(uint height) - { - var tmp = X; - X = Y; - Y = height - 1 - tmp; + Footer = footer.ToStructure(); } } } diff --git a/pk3DS.Core/CTR/Images/BXLIM.cs b/pk3DS.Core/CTR/Images/BXLIM.cs new file mode 100644 index 0000000000..ebd1e34fbd --- /dev/null +++ b/pk3DS.Core/CTR/Images/BXLIM.cs @@ -0,0 +1,67 @@ +using System; +using System.Linq; + +namespace pk3DS.Core.CTR.Images +{ + public abstract class BXLIM : IXLIMHeader + { + public byte[] PixelData; + public IXLIMHeader Footer { get; protected set; } + + public uint Magic { get => Footer.Magic; set => Footer.Magic = value; } + public ushort Width { get => Footer.Width; set => Footer.Width = value; } + public ushort Height { get => Footer.Height; set => Footer.Height = value; } + public XLIMEncoding Format { get => Footer.Format; set => Footer.Format = value; } + public XLIMOrientation Orientation { get => Footer.Orientation; set => Footer.Orientation = value; } + public bool Valid => Footer.Valid && PixelData != null; + + public string FileName { get; set; } + public string FilePath { get; set; } + public string Extension { get; set; } + public int BaseSize => Math.Max(XLIMUtil.nlpo2(Width), XLIMUtil.nlpo2(Height)); + + /// + /// ARGB 32bpp + /// + public byte[] GetImageData(bool crop = true) + { + var orienter = new XLIMOrienter(Footer.Width, Footer.Height, Footer.Orientation); + uint[] pixels = GetPixels(); + + if (!crop) + { + Footer.Width = (ushort)orienter.Width; + Footer.Height = (ushort)orienter.Height; + } + + // uint[] -> byte[] + byte[] array = new byte[Footer.Width * Footer.Height * 4]; + for (uint i = 0; i < pixels.Length; i++) + { + var coord = orienter.Get(i); + if (coord.X >= Footer.Width || coord.Y >= Footer.Height) + continue; + + var val = pixels[i]; + uint o = 4 * (coord.X + coord.Y * Footer.Width); + array[o + 0] = (byte)(val & 0xFF); + array[o + 1] = (byte)(val >> 8 & 0xFF); + array[o + 2] = (byte)(val >> 16 & 0xFF); + array[o + 3] = (byte)(val >> 24 & 0xFF); + } + return array; + } + + public virtual uint[] GetPixels() + { + return PixelConverter.GetPixels(PixelData, Footer.Format).ToArray(); + } + public byte[] GetPixelsRaw() + { + var pix = GetPixels(); + byte[] raw = new byte[pix.Length * 4]; + Buffer.BlockCopy(pix, 0, raw, 0, raw.Length); + return raw; + } + } +} diff --git a/pk3DS.Core/CTR/Images/CLIMHeader.cs b/pk3DS.Core/CTR/Images/CLIMHeader.cs new file mode 100644 index 0000000000..c28dee415d --- /dev/null +++ b/pk3DS.Core/CTR/Images/CLIMHeader.cs @@ -0,0 +1,31 @@ +using System.Runtime.InteropServices; + +namespace pk3DS.Core.CTR +{ + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] + public struct CLIMHeader : IXLIMHeader + { + public const int SIZE = 40; + public const string Identifier = "CLIM"; + public bool Valid => LittleEndian && Magic == 0x4D_49_4C_43; // CLIM + public bool LittleEndian => BOM == 0xFEFF; + public bool BigEndian => BOM == 0xFFFE; + + public uint Magic { get; set; }// CLIM = 0x4D494C43 + public ushort BOM; // 0xFFFE + public uint HeaderLength; // always 0x14 + public byte TileWidth; // 1<<[[n]] + public byte TileHeight; // 1<<[[n]] + public uint totalLength; // Total Length of file + public uint Count; // "1" , guessing it's just Count. + + public uint imag; // imag = 0x67616D69 + public uint imagLength; // HeaderLength - 10 + public ushort Width { get; set; } // Final Dimensions + public ushort Height { get; set; } // Final Dimensions + public XLIMEncoding Format { get; set; } + public XLIMOrientation Orientation { get; set; } // unused + public short Alignment; // unused + public uint DataSize; // Pixel Data Region Length + } +} \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/Coordinate.cs b/pk3DS.Core/CTR/Images/Coordinate.cs new file mode 100644 index 0000000000..c4f6fe5e8d --- /dev/null +++ b/pk3DS.Core/CTR/Images/Coordinate.cs @@ -0,0 +1,25 @@ +namespace pk3DS.Core.CTR +{ + public struct Coordinate + { + public uint X { get; private set; } + public uint Y { get; private set; } + + public Coordinate(uint x, uint y) + { + X = x; Y = y; + } + public void Transpose() + { + var tmp = X; + X = Y; + Y = tmp; + } + public void Rotate90(uint height) + { + var tmp = X; + X = Y; + Y = height - 1 - tmp; + } + } +} \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/FLIMHeader.cs b/pk3DS.Core/CTR/Images/FLIMHeader.cs new file mode 100644 index 0000000000..d03b1173e5 --- /dev/null +++ b/pk3DS.Core/CTR/Images/FLIMHeader.cs @@ -0,0 +1,30 @@ +using System.Runtime.InteropServices; + +namespace pk3DS.Core.CTR +{ + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] + public struct FLIMHeader : IXLIMHeader + { + public const int SIZE = 40; + public const string Identifier = "FLIM"; + public bool Valid => LittleEndian && Magic == 0x4D_49_4C_46; // FLIM + public bool LittleEndian => BOM == 0xFEFF; + public bool BigEndian => BOM == 0xFFFE; + + public uint Magic { get; set; } // FLIM + public ushort BOM; // 0xFFFE + public ushort HeaderLength; // always 0x14 + public int Version; + public uint TotalLength; + public uint Count; + + public uint imag; // imag = 67616D69 + public uint imagLength; // always 0x10 + public ushort Width { get; set; } + public ushort Height { get; set; } + public short Alignment; + public XLIMEncoding Format { get; set; } + public XLIMOrientation Orientation { get; set; } + public uint DataSize; + } +} \ No newline at end of file diff --git a/pk3DS.Core/CTR/IXLIM.cs b/pk3DS.Core/CTR/Images/IXLIMHeader.cs similarity index 62% rename from pk3DS.Core/CTR/IXLIM.cs rename to pk3DS.Core/CTR/Images/IXLIMHeader.cs index 9147657538..12f37500fb 100644 --- a/pk3DS.Core/CTR/IXLIM.cs +++ b/pk3DS.Core/CTR/Images/IXLIMHeader.cs @@ -3,10 +3,14 @@ /// /// and header interface. /// - public interface IXLIM + public interface IXLIMHeader { uint Magic { get; set; } ushort Width { get; set; } ushort Height { get; set; } + XLIMEncoding Format { get; set; } + XLIMOrientation Orientation { get; set; } + + bool Valid { get; } } } \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/PixelConverter.cs b/pk3DS.Core/CTR/Images/PixelConverter.cs new file mode 100644 index 0000000000..64d20829b0 --- /dev/null +++ b/pk3DS.Core/CTR/Images/PixelConverter.cs @@ -0,0 +1,176 @@ +using System; +using System.Collections.Generic; + +namespace pk3DS.Core.CTR +{ + public static class PixelConverter + { + private const int BPP_32 = 32; + private const int BPP_24 = 24; + private const int BPP_16 = 16; + private const int BPP_8 = 8; + private const int BPP_4 = 4; + + internal static readonly byte[] Convert5To8 = { + 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, + 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, + 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, + 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF + }; + + public static IEnumerable GetPixels(byte[] raw, XLIMEncoding e) + { + int bpp = e.GetBitsPerPixel(); + if (bpp == BPP_4) + { + foreach (byte b in raw) + { + byte _0 = (byte)(b & 0xF); + byte _1 = (byte)(b >> 4); + yield return GetDecodedPixelValue(_0, e); + yield return GetDecodedPixelValue(_1, e); + } + yield break; + } + + for (int i = 0; i < raw.Length; i += bpp / 8) + { + uint val = GetEncodedPixelValue(raw, i, bpp); + yield return GetDecodedPixelValue(val, e); + } + } + + + internal static uint GetDecodedPixelValue(uint val, XLIMEncoding e) + { + byte a = byte.MaxValue, r = 0, g = 0, b = 0; + switch (e) + { + case XLIMEncoding.L4: + case XLIMEncoding.L8: + { + r = g = b = (byte)val; + break; + } + case XLIMEncoding.A4: + case XLIMEncoding.A8: + { + r = g = b = 0xFF; + a = (byte)val; + break; + } + case XLIMEncoding.HILO8: + { + r = (byte)(val >> 8); + g = (byte)(val & 0xFF); + b = byte.MaxValue; + break; + } + case XLIMEncoding.LA4: + { + r = g = b = (byte)(val >> 4); + a = (byte)(val & 0x0F); + break; + } + case XLIMEncoding.LA8: + { + r = g = b = (byte)(val >> 8); + a = (byte)val; + break; + } + case XLIMEncoding.RGBX8: + { + r = (byte)(val >> 16); + g = (byte)(val >> 8); + b = (byte)(val >> 0); + break; + } + case XLIMEncoding.RGBA8: + { + r = (byte)(val >> 24); + g = (byte)(val >> 16); + b = (byte)(val >> 8); + a = (byte) val; + break; + } + case XLIMEncoding.RGBA4: + { + a = (byte)(0x11 * (val & 0xf)); + r = (byte)(0x11 * ((val >> 12) & 0xf)); + g = (byte)(0x11 * ((val >> 8) & 0xf)); + b = (byte)(0x11 * ((val >> 4) & 0xf)); + break; + } + case XLIMEncoding.RGB565: + { + r = Convert5To8[(val >> 11) & 0x1F]; + g = (byte)(((val >> 5) & 0x3F) * 4); + b = Convert5To8[val & 0x1F]; + break; + } + case XLIMEncoding.RGB5A1: + { + r = Convert5To8[(val >> 11) & 0x1F]; + g = Convert5To8[(val >> 6) & 0x1F]; + b = Convert5To8[(val >> 1) & 0x1F]; + a = (val & 1) == 1 ? byte.MaxValue : byte.MinValue; + break; + } + default: + throw new FormatException($"Unsupported {nameof(XLIMEncoding)} value = {e}"); + } + return (uint)((a << 24) | (r << 16) | (g << 8) | b); + } + + public static uint GetEncodedPixelValue(byte[] raw, int offset, int size) + { + switch (size) + { + case BPP_32: + return BitConverter.ToUInt32(raw, offset); + case BPP_24: + return BitConverter.ToUInt32(raw, offset) & 0x00FFFFFF; + case BPP_16: + return BitConverter.ToUInt16(raw, offset); + default: + return raw[offset]; + } + } + public static int GetBitsPerPixel(this XLIMEncoding e) + { + if (_32.Contains(e)) + return BPP_32; + if (_24.Contains(e)) + return BPP_24; + if (_16.Contains(e)) + return BPP_16; + if (_8.Contains(e)) + return BPP_8; + return BPP_4; + } + + private static readonly HashSet _32 = new HashSet + { + XLIMEncoding.RGBA8, + }; + private static readonly HashSet _24 = new HashSet + { + XLIMEncoding.RGBX8, + }; + private static readonly HashSet _16 = new HashSet + { + XLIMEncoding.LA8, + XLIMEncoding.HILO8, + XLIMEncoding.RGB565, + XLIMEncoding.RGB5A1, + XLIMEncoding.RGBA4, + }; + private static readonly HashSet _8 = new HashSet + { + XLIMEncoding.L8, + XLIMEncoding.A8, + XLIMEncoding.LA4, + XLIMEncoding.ETC1A4, + }; + } +} \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/XLIMEncoding.cs b/pk3DS.Core/CTR/Images/XLIMEncoding.cs new file mode 100644 index 0000000000..f214114e2b --- /dev/null +++ b/pk3DS.Core/CTR/Images/XLIMEncoding.cs @@ -0,0 +1,20 @@ +namespace pk3DS.Core.CTR +{ + public enum XLIMEncoding : byte + { + L8 = 0x00, // 8 Luminance + A8 = 0x01, // 8 Alpha + LA4 = 0x02, // 8 Luminance + Alpha + LA8 = 0x03, // 16 Luminance + Alpha + HILO8 = 0x04, // 16 ? + RGB565 = 0x05, // 16 Color + RGBX8 = 0x06, // 24 Color + RGB5A1 = 0x07, // 16 Color + Alpha + RGBA4 = 0x08, // 16 Color + Alpha + RGBA8 = 0x09, // 32 Color + Alpha + ETC1 = 0x0A, // 4 Color + ETC1A4 = 0x0B, // 8 Color + Alpha + L4 = 0x0C, // 4 Luminance + A4 = 0x0D, // 4 Alpha + } +} \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/XLIMOrientation.cs b/pk3DS.Core/CTR/Images/XLIMOrientation.cs new file mode 100644 index 0000000000..3426c497b2 --- /dev/null +++ b/pk3DS.Core/CTR/Images/XLIMOrientation.cs @@ -0,0 +1,12 @@ +using System; + +namespace pk3DS.Core.CTR +{ + [Flags] + public enum XLIMOrientation : byte + { + None = 0, + Rotate90 = 4, + Transpose = 8, + } +} \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/XLIMOrienter.cs b/pk3DS.Core/CTR/Images/XLIMOrienter.cs new file mode 100644 index 0000000000..f37e0d2c7d --- /dev/null +++ b/pk3DS.Core/CTR/Images/XLIMOrienter.cs @@ -0,0 +1,112 @@ +using static pk3DS.Core.CTR.Images.XLIMUtil; + +namespace pk3DS.Core.CTR +{ + public class XLIMOrienter + { + readonly XLIMOrientation _orientation; + + public uint Width { get; } + public uint Height { get; } + public uint PanelsPerWidth { get; } + + public XLIMOrienter(int width, int height, XLIMOrientation orientation) + { + Width = (uint)nlpo2(gcm(width, 8)); + Height = (uint)nlpo2(gcm(height, 8)); + + uint stride = orientation == XLIMOrientation.None ? Width : Height; + PanelsPerWidth = (uint)gcm((int)stride, 8) / 8; + + _orientation = orientation; + } + + public Coordinate Get(uint i) + { + d2xy(i & 0x3F, out uint x, out uint y); + + // Shift Tile Coordinate into Tilemap + var tile = i >> 6; + x |= (tile % PanelsPerWidth) << 3; + y |= (tile / PanelsPerWidth) << 3; + + var coord = new Coordinate(x, y); + if (_orientation.HasFlag(XLIMOrientation.Rotate90)) + coord.Rotate90(Height); + if (_orientation.HasFlag(XLIMOrientation.Transpose)) + coord.Transpose(); + return coord; + } + + internal static uint C11(uint x) + { + x &= 0x55555555; // x = -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 + x = (x ^ (x >> 1)) & 0x33333333; // x = --fe --dc --ba --98 --76 --54 --32 --10 + x = (x ^ (x >> 2)) & 0x0f0f0f0f; // x = ---- fedc ---- ba98 ---- 7654 ---- 3210 + x = (x ^ (x >> 4)) & 0x00ff00ff; // x = ---- ---- fedc ba98 ---- ---- 7654 3210 + x = (x ^ (x >> 8)) & 0x0000ffff; // x = ---- ---- ---- ---- fedc ba98 7654 3210 + return x; + } + + // Morton Translation + + /// + /// Combines X/Y Coordinates to a decimal ordinate. + /// + /// + /// + /// + internal static uint xy2d(uint x, uint y) + { + x &= 0x0000ffff; + y &= 0x0000ffff; + x |= x << 8; + y |= y << 8; + x &= 0x00ff00ff; + y &= 0x00ff00ff; + x |= x << 4; + y |= y << 4; + x &= 0x0f0f0f0f; + y &= 0x0f0f0f0f; + x |= x << 2; + y |= y << 2; + x &= 0x33333333; + y &= 0x33333333; + x |= x << 1; + y |= y << 1; + x &= 0x55555555; + y &= 0x55555555; + return x | (y << 1); + } + + /// + /// Decimal Ordinate In to X / Y Coordinate Out + /// + /// Loop integer which will be decoded to X/Y + /// Output X coordinate + /// Output Y coordinate + internal static void d2xy(uint d, out uint x, out uint y) + { + x = d; + y = x >> 1; + x &= 0x55555555; + y &= 0x55555555; + x |= x >> 1; + y |= y >> 1; + x &= 0x33333333; + y &= 0x33333333; + x |= x >> 2; + y |= y >> 2; + x &= 0x0f0f0f0f; + y &= 0x0f0f0f0f; + x |= x >> 4; + y |= y >> 4; + x &= 0x00ff00ff; + y &= 0x00ff00ff; + x |= x >> 8; + y |= y >> 8; + x &= 0x0000ffff; + y &= 0x0000ffff; + } + } +} \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/XLIMUtil.cs b/pk3DS.Core/CTR/Images/XLIMUtil.cs new file mode 100644 index 0000000000..8698bfdf3f --- /dev/null +++ b/pk3DS.Core/CTR/Images/XLIMUtil.cs @@ -0,0 +1,31 @@ +namespace pk3DS.Core.CTR.Images +{ + public static class XLIMUtil + { + /// + /// Greatest common multiple (to round up) + /// + /// Number to round-up. + /// Multiple to round-up to. + /// Rounded up number. + internal static int gcm(int n, int m) + { + return (n + m - 1) / m * m; + } + /// + /// Next Largest Power of 2 + /// + /// Input to round up to next 2^n + /// 2^n > x && x > 2^(n-1) + internal static int nlpo2(int x) + { + x--; // comment out to always take the next biggest power of two, even if x is already a power of two + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; + return x + 1; + } + } +} diff --git a/pk3DS.Core/CTR/SMDH.cs b/pk3DS.Core/CTR/SMDH.cs index 7929e35661..c7d4e845cf 100644 --- a/pk3DS.Core/CTR/SMDH.cs +++ b/pk3DS.Core/CTR/SMDH.cs @@ -147,7 +147,7 @@ public class SmallIcon // 24x24 public SmallIcon(BinaryReader br) { Bytes = br.ReadBytes(0x480); - Icon = BCLIM.getIMG(24, 24, Bytes, 0x5); + Icon = ImageUtil.GetBitmap(Bytes, 24, 24); } public void Write(BinaryWriter bw) { @@ -157,7 +157,7 @@ public bool ChangeIcon(Bitmap img) { if (img.Width != Icon.Width || img.Height != Icon.Height) return false; Icon = img; - Bytes = BCLIM.getPixelData(Icon, 0x5); + Bytes = ImageUtil.GetPixelData(Icon); return true; } } @@ -169,7 +169,7 @@ public class LargeIcon // 48x48 public LargeIcon(BinaryReader br) { Bytes = br.ReadBytes(0x1200); - Icon = BCLIM.getIMG(48, 48, Bytes, 0x5); + Icon = ImageUtil.GetBitmap(Bytes, 48, 48); } public void Write(BinaryWriter bw) { @@ -179,7 +179,7 @@ public bool ChangeIcon(Bitmap img) { if (img.Width != Icon.Width || img.Height != Icon.Height) return false; Icon = img; - Bytes = BCLIM.getPixelData(Icon, 0x5); + Bytes = ImageUtil.GetPixelData(Icon); return true; } } diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs index a9cf65c3f0..27de836be2 100644 --- a/pk3DS.Core/ImageUtil.cs +++ b/pk3DS.Core/ImageUtil.cs @@ -3,6 +3,8 @@ using System.Drawing.Imaging; using System.Runtime.InteropServices; using pk3DS.Core.CTR; +using pk3DS.Core.CTR.Images; +using static pk3DS.Core.CTR.Images.XLIMUtil; namespace pk3DS.Core { @@ -17,7 +19,7 @@ public static class ImageUtil /// Image data /// Crop the image area to the actual dimensions /// Human visible data - public static Bitmap GetBitmap(this BFLIM bflim, bool crop = true) + public static Bitmap GetBitmap(this BXLIM bflim, bool crop = true) { if (bflim.Format == XLIMEncoding.ETC1 || bflim.Format == XLIMEncoding.ETC1A4) return GetBitmapETC(bflim, crop); @@ -28,25 +30,33 @@ public static Bitmap GetBitmap(byte[] data, int width, int height, int stride = { return new Bitmap(width, height, stride, format, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0)); } + public static byte[] GetPixelData(Bitmap bitmap) + { + var argbData = new byte[bitmap.Width * bitmap.Height * 4]; + var bd = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat); + Marshal.Copy(bd.Scan0, argbData, 0, bitmap.Width * bitmap.Height * 4); + bitmap.UnlockBits(bd); + return argbData; + } - public static Bitmap GetBitmapETC(BCLIM.CLIM bclim, bool crop = true) => GetBitmapETC(bclim, bclim.Data, bclim.FileFormat == 0x0B, crop); - public static Bitmap GetBitmapETC(BFLIM bflim, bool crop = true) => GetBitmapETC(bflim, bflim.PixelData, bflim.Footer.Format == XLIMEncoding.ETC1A4, crop); - - private static Bitmap GetBitmapETC(IXLIM bflim, byte[] data, bool etc1a4, bool crop = true) + public static Bitmap GetBitmapETC(BXLIM bxlim, bool crop = true) { + bool etc1a4 = bxlim.Footer.Format == XLIMEncoding.ETC1A4; + byte[] data = bxlim.PixelData; ETC1.CheckETC1Lib(); + try { - var width = Math.Max(BCLIM.nlpo2(bflim.Width), 16); - var height = Math.Max(BCLIM.nlpo2(bflim.Height), 16); + var width = Math.Max(nlpo2(bxlim.Width), 16); + var height = Math.Max(nlpo2(bxlim.Height), 16); Bitmap img = new Bitmap(width, height); - img = DecodeETC(bflim, img, data, etc1a4); - return crop ? CropBMP(bflim, img) : img; + img = DecodeETC(bxlim, img, data, etc1a4); + return crop ? CropBMP(bxlim, img) : img; } catch { return null; } } - public static Bitmap CropBMP(IXLIM bclim, Bitmap img) + public static Bitmap CropBMP(IXLIMHeader bclim, Bitmap img) { Rectangle cropRect = new Rectangle(0, 0, bclim.Width, bclim.Height); Bitmap src = img; @@ -62,7 +72,7 @@ public static Bitmap CropBMP(IXLIM bclim, Bitmap img) return target; } - private static Bitmap DecodeETC(IXLIM bclim, Bitmap img, byte[] textureData, bool etc1A4) + private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureData, bool etc1A4) { /* http://jul.rustedlogic.net/thread.php?id=17312 * Much of this code is taken/modified from Tharsis. Thank you to Tharsis's creator, xdaniel. @@ -116,10 +126,10 @@ private static Bitmap DecodeETC(IXLIM bclim, Bitmap img, byte[] textureData, boo if (w > h) { // Image is now in appropriate order, but the shifting is messed up. Let's fix that. - Bitmap img2 = new Bitmap(Math.Max(BCLIM.nlpo2(bclim.Width), 16), Math.Max(BCLIM.nlpo2(bclim.Height), 16)); - for (int y = 0; y < Math.Max(BCLIM.nlpo2(bclim.Width), 16); y += 8) + Bitmap img2 = new Bitmap(Math.Max(nlpo2(bclim.Width), 16), Math.Max(nlpo2(bclim.Height), 16)); + for (int y = 0; y < Math.Max(nlpo2(bclim.Width), 16); y += 8) { - for (int x = 0; x < Math.Max(BCLIM.nlpo2(bclim.Height), 16); x++) + for (int x = 0; x < Math.Max(nlpo2(bclim.Height), 16); x++) { for (int j = 0; j < 8; j++) // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. @@ -134,10 +144,10 @@ private static Bitmap DecodeETC(IXLIM bclim, Bitmap img, byte[] textureData, boo } else if (h > w) { - Bitmap img2 = new Bitmap(Math.Max(BCLIM.nlpo2(bclim.Width), 16), Math.Max(BCLIM.nlpo2(bclim.Height), 16)); - for (int y = 0; y < Math.Max(BCLIM.nlpo2(bclim.Width), 16); y += 8) + Bitmap img2 = new Bitmap(Math.Max(nlpo2(bclim.Width), 16), Math.Max(nlpo2(bclim.Height), 16)); + for (int y = 0; y < Math.Max(nlpo2(bclim.Width), 16); y += 8) { - for (int x = 0; x < Math.Max(BCLIM.nlpo2(bclim.Height), 16); x++) + for (int x = 0; x < Math.Max(nlpo2(bclim.Height), 16); x++) { for (int j = 0; j < 8; j++) // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. diff --git a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs index a12931a19c..4e928a581a 100644 --- a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs +++ b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Windows.Forms; +using pk3DS.Core; namespace pk3DS { @@ -113,18 +114,8 @@ private void changeFile(object sender, EventArgs e) // Load file byte[] data = darc.Data.Skip((int)(darc.Entries[entry].DataOffset - darc.Header.FileDataOffset)).Take((int)darc.Entries[entry].DataLength).ToArray(); - BCLIM.CLIM bclim = BCLIM.analyze(data, filename); - Image img = BCLIM.getIMG(bclim); - - Rectangle cropRect = new Rectangle(0, 0, bclim.Width, bclim.Height); - Bitmap CropBMP = new Bitmap(cropRect.Width, cropRect.Height); - using (Graphics g = Graphics.FromImage(CropBMP)) - { - g.DrawImage(img, - new Rectangle(0, 0, CropBMP.Width, CropBMP.Height), - cropRect, - GraphicsUnit.Pixel); - } + BCLIM bclim = BCLIM.analyze(data, filename); + Image CropBMP = bclim.GetBitmap(); PB_Image.Image = CropBMP; // store image locally for saving if need be From e32472e02be55354f6352ad11e00428a2d92b77e Mon Sep 17 00:00:00 2001 From: sora10pls Date: Tue, 2 Jan 2018 19:01:52 -0500 Subject: [PATCH 063/191] Various updates --- pk3DS.Core/Legality/Legal.cs | 48 +------- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 16 +-- pk3DS/Main.cs | 7 ++ pk3DS/Subforms/Gen6/GiftEditor6.cs | 2 - pk3DS/Subforms/Gen6/RSTE.cs | 21 ++-- pk3DS/Subforms/Gen6/RSWE.Designer.cs | 1 + pk3DS/Subforms/Gen6/RSWE.cs | 5 + pk3DS/Subforms/Gen6/TrainerRand.Designer.cs | 111 +++++++++--------- pk3DS/Subforms/Gen6/TrainerRand.cs | 3 +- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 26 ++-- pk3DS/Subforms/Gen7/SMTE.cs | 21 ++-- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 8 +- 12 files changed, 123 insertions(+), 146 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index bc649d9d9e..a2bd17b558 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -66,41 +66,6 @@ public static partial class Legal public static readonly int[] SpecialClasses_ORAS = { #region Classes - 000, // Pokémon Trainer - 001, // Pokémon Trainer - 004, // Leader - 035, // Elite Four - 036, // Elite Four - 037, // Elite Four - 038, // Elite Four - 039, // Leader - 040, // Leader - 041, // Leader - 042, // Leader - 043, // Leader - 044, // Leader - 045, // Leader - 053, // Champion - 055, // Pokémon Trainer - 056, // Pokémon Trainer - 057, // Pokémon Trainer - 064, // Battle Chatelaine - 065, // Battle Chatelaine - 066, // Battle Chatelaine - 067, // Battle Chatelaine - 081, // Team Flare Boss - 102, // Pokémon Trainer - 103, // Pokémon Trainer - 104, // Pokémon Trainer - 105, // Pokémon Professor - 109, // Pokémon Trainer - 110, // Pokémon Trainer - 119, // Pokémon Trainer - 120, // Pokémon Trainer - 121, // Pokémon Trainer - 124, // Team Flare Boss - 125, // Successor - 126, // Leader 127, // Pokémon Trainer 128, // Pokémon Trainer 174, // Aqua Leader @@ -137,7 +102,6 @@ public static partial class Legal 279, // Pokémon Trainer #endregion }; - public static readonly int[] SpecialClasses_SM = { 030, // Pokémon Trainer: Hau @@ -184,7 +148,7 @@ public static partial class Legal }; public static readonly int[] SpecialClasses_USUM = -{ + { 030, // Pokémon Trainer: Hau 031, // Island Kahuna: Hala 038, // Captain: Ilima @@ -250,7 +214,6 @@ public static partial class Legal 221, // Pokémon Trainer: Hau 222, // Pokémon Trainer: Hau }; - public static readonly int[] Model_XY = { 018, // Team Flare (Aliana) @@ -281,7 +244,6 @@ public static partial class Legal 192, // Pokémon Trainer (Wally) 219, // Pokémon Trainer (Steven) 221, // Lorekeeper (Zinnia) - 267, // Pokémon Trainer (Zinnia) 272, // Pokémon Trainer (Wally) }; public static readonly int[] TrainerClasses_AO = @@ -306,7 +268,6 @@ public static partial class Legal 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 371, 372, 392, 396, 398, 400, 401, 403, 405, 409, 410, 413, 414, 415, 416, 417, 418, 419, 435, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 481, 482, 483, 484, }; - public static readonly int[] ImportantTrainers_USUM = { 012, 013, 014, 023, 052, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 185, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, @@ -314,7 +275,10 @@ public static partial class Legal 490, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 630, 644, 645, 647, 648, 649, 650, 651, 652, }; - + /// + /// All final evolutions, excluding Event-exclusive Forms that do not evolve (Pikachu, Floette, etc). Used for forcing fully evolved species. + /// Overrides all other randomizer settings, allowing all Generations and Legendary/Mythical Pokemon as well. + /// public static readonly int[] FinalEvolutions_6 = { 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, @@ -329,13 +293,11 @@ public static partial class Legal 635, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, }; - public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[] { 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, }).ToArray(); - public static readonly int[] FinalEvolutions_USUM = FinalEvolutions_SM.Concat(new int[] { 804, 805, 806, 807, diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index ed7769cc98..186376767d 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -164,33 +164,33 @@ private void AddGen2Species(List list) } private void AddGen3Species(List list) { - list.AddRange(Enumerable.Range(252, 40)); - list.AddRange(Enumerable.Range(293, 84)); + list.AddRange(Enumerable.Range(252, 40)); // Treecko - Ninjask + list.AddRange(Enumerable.Range(293, 84)); // Whismur - Metagross if (Shedinja) list.Add(292); // Shedinja if (L) list.AddRange(Enumerable.Range(377, 8)); // Regi, Lati, Mascot if (E) list.AddRange(Enumerable.Range(385, 2)); // Jirachi/Deoxys } private void AddGen4Species(List list) { - list.AddRange(Enumerable.Range(387, 93)); + list.AddRange(Enumerable.Range(387, 93)); // Turtwig - Rotom if (L) list.AddRange(Enumerable.Range(480, 9)); // Sinnoh Legends if (E) list.AddRange(Enumerable.Range(489, 5)); // Phione, Manaphy, Darkrai, Shaymin, Arceus } private void AddGen5Species(List list) { - list.AddRange(Enumerable.Range(495, 143)); - if (L) list.AddRange(Enumerable.Range(638, 9)); list.Add(494); // Unova Legends - if (E) list.AddRange(Enumerable.Range(647, 3)); // Keldeo, Meloetta, Genesect + list.AddRange(Enumerable.Range(495, 143)); // Snivy - Volcarona + if (L) list.AddRange(Enumerable.Range(638, 9)); // Unova Legends + if (E) list.Add(494); list.AddRange(Enumerable.Range(647, 3)); // Victini, Keldeo, Meloetta, Genesect } private void AddGen6Species(List list) { - list.AddRange(Enumerable.Range(650, 66)); + list.AddRange(Enumerable.Range(650, 66)); // Chespin - Noivern if (L) list.AddRange(Enumerable.Range(716, 3)); // Kalos Legends if (E) list.AddRange(Enumerable.Range(719, 3)); // Diancie, Hoopa, Volcanion } private void AddGen7Species(List list) { - list.AddRange(Enumerable.Range(722, 67)); + list.AddRange(Enumerable.Range(722, 67)); // Rowlet - Kommo-o if (L) list.AddRange(Enumerable.Range(785, 16)); // Tapus, Legends, UBs if (E) list.AddRange(Enumerable.Range(801, 2)); // Magearna, Marshadow diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 7f3486be2e..005070debe 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -599,14 +599,21 @@ private void B_Wild_Click(object sender, EventArgs e) case 6: files = new[] { "encdata" }; if (Config.ORAS) + { + Enabled = false; action = () => new RSWE().ShowDialog(); + } else if (Config.XY) + { + Enabled = false; action = () => new XYWE().ShowDialog(); + } else return; fileGet(files, false); Invoke(action); fileSet(files); + Enabled = true; break; case 7: Invoke((MethodInvoker)delegate { Enabled = false; }); diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index def62cdcec..b7b3bdec88 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -319,8 +319,6 @@ private int[] GetRandomMega(out int species) {475, new[] {756}}, // Gallade @ Galladite {531, new[] {757}}, // Audino @ Audinite {719, new[] {764}}, // Diancie @ Diancite - - {384, new[] {-620}}, // Rayquaza @ Dragon Ascent }; private void changeSpecies(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 3eebe25807..0f035e1ca2 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -521,7 +521,7 @@ private void Setup() readFile(); } - public static bool rPKM, rSmart, rLevel, rMove, rNoMove, rAbility, rDiffAI, + public static bool rPKM, rSmart, rLevel, rMove, rNoMove, rHighPower, rAbility, rDiffAI, rDiffIV, rClass, rGift, rItem, rDoRand, rRandomMegas, rGymE4Only, rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM, rForceFullyEvolved; public static bool rNoFixedDamage; @@ -686,6 +686,13 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom else if (rItem) pk.Item = itemvals[rnd32() % itemvals.Length]; + if (rForceFullyEvolved && pk.Level >= rForceFullyEvolvedLevel && !rFinalEvo.Contains(pk.Species)) + { + int randFinalEvo() => (int)(Util.rnd32() % rFinalEvo.Length); + pk.Species = (ushort)rFinalEvo[randFinalEvo()]; + pk.Form = (ushort)Randomizer.GetRandomForme(pk.Species, rRandomMegas, true, Main.SpeciesStat); + } + // random if (rMove) { @@ -703,14 +710,12 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom pk.Moves[m] = (ushort)pkMoves[m]; } - if (rForceFullyEvolved && pk.Level >= rForceFullyEvolvedLevel) + // high-power attacks + if (rHighPower) { - if (!rFinalEvo.Contains(pk.Species)) - { - int randFinalEvo() => (int)(Util.rnd32() % rFinalEvo.Length); - pk.Species = (ushort)rFinalEvo[randFinalEvo()]; - pk.Form = (ushort)Randomizer.GetRandomForme(pk.Species, rRandomMegas, true, Main.SpeciesStat); - } + var pkMoves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); + for (int m = 0; m < 4; m++) + pk.Moves[m] = (ushort)pkMoves[m]; } } } diff --git a/pk3DS/Subforms/Gen6/RSWE.Designer.cs b/pk3DS/Subforms/Gen6/RSWE.Designer.cs index 9f5ce482b2..3146fd7dfd 100644 --- a/pk3DS/Subforms/Gen6/RSWE.Designer.cs +++ b/pk3DS/Subforms/Gen6/RSWE.Designer.cs @@ -26218,6 +26218,7 @@ private void InitializeComponent() this.MinimumSize = new System.Drawing.Size(964, 454); this.Name = "RSWE"; this.Text = "ORAS Wild Editor"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RSWE_FormClosing); this.TabPage_Horde.ResumeLayout(false); this.TabPage_Horde.PerformLayout(); this.GB_Tweak.ResumeLayout(false); diff --git a/pk3DS/Subforms/Gen6/RSWE.cs b/pk3DS/Subforms/Gen6/RSWE.cs index 8e761e0d0d..456cc4a776 100644 --- a/pk3DS/Subforms/Gen6/RSWE.cs +++ b/pk3DS/Subforms/Gen6/RSWE.cs @@ -803,5 +803,10 @@ private void modifyLevels(object sender, EventArgs e) Enabled = true; WinFormsUtil.Alert("Modified all Level ranges according to specification!", "Press the Dump Tables button to view the new Level ranges!"); } + + private void RSWE_FormClosing(object sender, FormClosingEventArgs e) + { + RandSettings.SetFormSettings(this, GB_Tweak.Controls); + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index f550289883..5017b7faa0 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -42,11 +42,12 @@ private void InitializeComponent() this.NUD_Level = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); this.CHK_GymE4Only = new System.Windows.Forms.CheckBox(); - this.CHK_RandomMegaForm = new System.Windows.Forms.CheckBox(); - this.CHK_6PKM = new System.Windows.Forms.CheckBox(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); this.CHK_GymTrainers = new System.Windows.Forms.CheckBox(); this.CHK_StoryMEvos = new System.Windows.Forms.CheckBox(); + this.CHK_RandomMegaForm = new System.Windows.Forms.CheckBox(); this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_BST = new System.Windows.Forms.CheckBox(); this.CHK_E = new System.Windows.Forms.CheckBox(); @@ -57,6 +58,7 @@ private void InitializeComponent() this.CHK_G3 = new System.Windows.Forms.CheckBox(); this.CHK_G2 = new System.Windows.Forms.CheckBox(); this.CHK_G1 = new System.Windows.Forms.CheckBox(); + this.CHK_6PKM = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_OnlySingles = new System.Windows.Forms.CheckBox(); this.NUD_Damage = new System.Windows.Forms.NumericUpDown(); @@ -66,14 +68,12 @@ private void InitializeComponent() this.CB_Moves = new System.Windows.Forms.ComboBox(); this.L_Moves = new System.Windows.Forms.Label(); this.CHK_NoFixedDamage = new System.Windows.Forms.CheckBox(); - this.NUD_Force = new System.Windows.Forms.NumericUpDown(); - this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GiftPercent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); this.GB_Tweak.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Force)).BeginInit(); this.SuspendLayout(); // // CHK_RandomPKM @@ -260,7 +260,7 @@ private void InitializeComponent() // this.GB_Tweak.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); - this.GB_Tweak.Controls.Add(this.NUD_Force); + this.GB_Tweak.Controls.Add(this.NUD_ForceFullyEvolved); this.GB_Tweak.Controls.Add(this.CHK_GymE4Only); this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); this.GB_Tweak.Controls.Add(this.CHK_GymTrainers); @@ -283,6 +283,19 @@ private void InitializeComponent() this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Options"; // + // NUD_ForceFullyEvolved + // + this.NUD_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 97); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(43, 20); + this.NUD_ForceFullyEvolved.TabIndex = 334; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // // CHK_GymE4Only // this.CHK_GymE4Only.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -295,28 +308,16 @@ private void InitializeComponent() this.CHK_GymE4Only.Text = "Theme Gym/E4 Only"; this.CHK_GymE4Only.UseVisualStyleBackColor = true; // - // CHK_RandomMegaForm - // - this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 81); - this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; - this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); - this.CHK_RandomMegaForm.TabIndex = 294; - this.CHK_RandomMegaForm.Text = "Random Mega Forms"; - this.CHK_RandomMegaForm.UseVisualStyleBackColor = true; - // - // CHK_6PKM + // CHK_ForceFullyEvolved // - this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(21, 215); - this.CHK_6PKM.Name = "CHK_6PKM"; - this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); - this.CHK_6PKM.TabIndex = 293; - this.CHK_6PKM.Text = "6 Pokémon for Important Trainers"; - this.CHK_6PKM.UseVisualStyleBackColor = true; - this.CHK_6PKM.CheckedChanged += new System.EventHandler(this.CHK_6PKM_CheckedChanged); + this.CHK_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 99); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 333; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; // // CHK_GymTrainers // @@ -343,6 +344,17 @@ private void InitializeComponent() this.CHK_StoryMEvos.Text = "Ensure Story Mega Evolutions"; this.CHK_StoryMEvos.UseVisualStyleBackColor = true; // + // CHK_RandomMegaForm + // + this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_RandomMegaForm.AutoSize = true; + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 81); + this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; + this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); + this.CHK_RandomMegaForm.TabIndex = 294; + this.CHK_RandomMegaForm.Text = "Random Mega Forms"; + this.CHK_RandomMegaForm.UseVisualStyleBackColor = true; + // // CHK_TypeTheme // this.CHK_TypeTheme.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -461,6 +473,18 @@ private void InitializeComponent() this.CHK_G1.Text = "Gen 1"; this.CHK_G1.UseVisualStyleBackColor = true; // + // CHK_6PKM + // + this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_6PKM.AutoSize = true; + this.CHK_6PKM.Location = new System.Drawing.Point(21, 215); + this.CHK_6PKM.Name = "CHK_6PKM"; + this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); + this.CHK_6PKM.TabIndex = 293; + this.CHK_6PKM.Text = "6 Pokémon for Important Trainers"; + this.CHK_6PKM.UseVisualStyleBackColor = true; + this.CHK_6PKM.CheckedChanged += new System.EventHandler(this.CHK_6PKM_CheckedChanged); + // // CHK_IgnoreSpecialClass // this.CHK_IgnoreSpecialClass.Anchor = System.Windows.Forms.AnchorStyles.Bottom; @@ -557,10 +581,11 @@ private void InitializeComponent() this.CB_Moves.Items.AddRange(new object[] { "Don\'t Modify", "Randomize All", - "Use Levelup Only"}); + "Use Levelup Only", + "High Powered Attacks"}); this.CB_Moves.Location = new System.Drawing.Point(67, 251); this.CB_Moves.Name = "CB_Moves"; - this.CB_Moves.Size = new System.Drawing.Size(121, 21); + this.CB_Moves.Size = new System.Drawing.Size(135, 21); this.CB_Moves.TabIndex = 330; this.CB_Moves.SelectedIndexChanged += new System.EventHandler(this.changeMoveRandomization); // @@ -586,30 +611,6 @@ private void InitializeComponent() this.CHK_NoFixedDamage.Text = "No Fixed Damage Moves (Dragon Rage/Sonic Boom)"; this.CHK_NoFixedDamage.UseVisualStyleBackColor = true; // - // NUD_Force - // - this.NUD_Force.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_Force.Location = new System.Drawing.Point(169, 98); - this.NUD_Force.Name = "NUD_Force"; - this.NUD_Force.Size = new System.Drawing.Size(43, 20); - this.NUD_Force.TabIndex = 334; - this.NUD_Force.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); - // - // CHK_ForceFullyEvolved - // - this.CHK_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 99); - this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; - this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); - this.CHK_ForceFullyEvolved.TabIndex = 333; - this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; - this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; - // // TrainerRand // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -650,9 +651,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_Force)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -698,7 +699,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_RandomMegaForm; private System.Windows.Forms.CheckBox CHK_GymE4Only; private System.Windows.Forms.CheckBox CHK_NoFixedDamage; - private System.Windows.Forms.NumericUpDown NUD_Force; + private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index 6b334a4535..827c17af78 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -41,6 +41,7 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.rMove = CB_Moves.SelectedIndex == 1; RSTE.rNoMove = CB_Moves.SelectedIndex == 2; + RSTE.rHighPower = CB_Moves.SelectedIndex == 3; if (RSTE.rMove) { RSTE.rDMG = CHK_Damage.Checked; @@ -73,7 +74,7 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.r6PKM = CHK_6PKM.Checked; RSTE.rRandomMegas = CHK_RandomMegaForm.Checked; RSTE.rForceFullyEvolved = CHK_ForceFullyEvolved.Checked; - RSTE.rForceFullyEvolvedLevel = NUD_Force.Value; + RSTE.rForceFullyEvolvedLevel = NUD_ForceFullyEvolved.Value; if (CHK_StoryMEvos.Checked) { diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index d9f86936c8..87a8e2ece6 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -180,6 +180,7 @@ private void InitializeComponent() this.CHK_RandomItems = new System.Windows.Forms.CheckBox(); this.CHK_STAB = new System.Windows.Forms.CheckBox(); this.Tab_Trainer1 = new System.Windows.Forms.TabPage(); + this.CHK_6PKM = new System.Windows.Forms.CheckBox(); this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); this.L_MinPKM = new System.Windows.Forms.Label(); @@ -190,7 +191,6 @@ private void InitializeComponent() this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); - this.CHK_6PKM = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -1874,7 +1874,7 @@ private void InitializeComponent() "High Powered Attacks"}); this.CB_Moves.Location = new System.Drawing.Point(52, 8); this.CB_Moves.Name = "CB_Moves"; - this.CB_Moves.Size = new System.Drawing.Size(121, 21); + this.CB_Moves.Size = new System.Drawing.Size(135, 21); this.CB_Moves.TabIndex = 337; this.CB_Moves.SelectedIndexChanged += new System.EventHandler(this.CB_Moves_SelectedIndexChanged); // @@ -2001,6 +2001,17 @@ private void InitializeComponent() this.Tab_Trainer1.Text = "Trainer"; this.Tab_Trainer1.UseVisualStyleBackColor = true; // + // CHK_6PKM + // + this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_6PKM.AutoSize = true; + this.CHK_6PKM.Location = new System.Drawing.Point(6, 94); + this.CHK_6PKM.Name = "CHK_6PKM"; + this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); + this.CHK_6PKM.TabIndex = 341; + this.CHK_6PKM.Text = "6 Pokémon for Important Trainers"; + this.CHK_6PKM.UseVisualStyleBackColor = true; + // // NUD_ForceFullyEvolved // this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 111); @@ -2142,17 +2153,6 @@ private void InitializeComponent() this.CHK_RandomClass.UseVisualStyleBackColor = true; this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); // - // CHK_6PKM - // - this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(6, 94); - this.CHK_6PKM.Name = "CHK_6PKM"; - this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); - this.CHK_6PKM.TabIndex = 341; - this.CHK_6PKM.Text = "6 Pokémon for Important Trainers"; - this.CHK_6PKM.UseVisualStyleBackColor = true; - // // SMTE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 74620b93d2..167745789d 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -230,8 +230,7 @@ private void Setup() CB_HPType.SelectedIndex = 0; CB_Nature.Items.Clear(); - foreach (string s in natures) - CB_Nature.Items.Add(s); + CB_Nature.Items.AddRange(natures.Take(25).ToArray()); CB_Item.Items.Clear(); foreach (string s in itemlist) @@ -671,10 +670,11 @@ private void B_Randomize_Click(object sender, EventArgs e) { if (CHK_RandomPKM.Checked) { - int Type = CHK_TypeTheme.Checked ? (int)Util.rnd32()%17 : -1; + int Type = CHK_TypeTheme.Checked ? (int)Util.rnd32() % 17 : -1; pk.Species = rnd.GetRandomSpeciesType(pk.Species, Type); pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); - pk.Gender = 0; // Random Gender + pk.Gender = 0; // random + pk.Nature = (int)(Util.rnd32() % CB_Nature.Items.Count); // random } if (CHK_Level.Checked) pk.Level = Randomizer.getModifiedLevel(pk.Level, NUD_LevelBoost.Value); @@ -686,15 +686,12 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.Ability = (int)Util.rnd32()%4; if (CHK_MaxDiffPKM.Checked) pk.IVs = new[] {31, 31, 31, 31, 31, 31}; - - if (CHK_ForceFullyEvolved.Checked && pk.Level >= NUD_ForceFullyEvolved.Value) + + if (CHK_ForceFullyEvolved.Checked && pk.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(pk.Species)) { - if (!FinalEvo.Contains(pk.Species)) - { - int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); - pk.Species = FinalEvo[randFinalEvo()]; - pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); - } + int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); + pk.Species = FinalEvo[randFinalEvo()]; + pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); } switch (CB_Moves.SelectedIndex) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index dbb5028913..bfa8a72ab8 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -481,7 +481,7 @@ private void B_Starters_Click(object sender, EventArgs e) t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none if (CHK_RandomAbility.Checked) - t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2 , or H + t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H } getListBoxEntries(); @@ -526,7 +526,7 @@ private void B_RandAll_Click(object sender, EventArgs e) t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none if (CHK_RandomAbility.Checked) - t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2 , or H + t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H } foreach (EncounterStatic7 t in Encounters) { @@ -552,7 +552,7 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Aura = Util.rand.Next(1, CB_Aura.Items.Count); // don't allow none if (CHK_RandomAbility.Checked) - t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2 , or H + t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2, or H } foreach (EncounterTrade7 t in Trades) { @@ -571,7 +571,7 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); if (CHK_RandomAbility.Checked) - t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2 , or H + t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H } getListBoxEntries(); From 943ce2c99eed9f2566e18c059f589d342ab3c8ab Mon Sep 17 00:00:00 2001 From: sora10pls Date: Thu, 4 Jan 2018 21:02:17 -0500 Subject: [PATCH 064/191] Enhance high-powered attack modification --- pk3DS/Subforms/Gen6/RSTE.cs | 6 +- pk3DS/Subforms/Gen6/TrainerRand.Designer.cs | 98 ++++++++++++++------- pk3DS/Subforms/Gen6/TrainerRand.cs | 3 +- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 62 ++++++++++--- pk3DS/Subforms/Gen7/SMTE.cs | 8 +- 5 files changed, 126 insertions(+), 51 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 0f035e1ca2..1918cce09b 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -521,7 +521,7 @@ private void Setup() readFile(); } - public static bool rPKM, rSmart, rLevel, rMove, rNoMove, rHighPower, rAbility, rDiffAI, + public static bool rPKM, rSmart, rLevel, rMove, rNoMove, rForceHighPower, rAbility, rDiffAI, rDiffIV, rClass, rGift, rItem, rDoRand, rRandomMegas, rGymE4Only, rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM, rForceFullyEvolved; public static bool rNoFixedDamage; @@ -538,7 +538,7 @@ private void Setup() private readonly List Tags = new List(); private readonly Dictionary TagTypes = new Dictionary(); public static int[] sL; // Random Species List - public static decimal rGiftPercent, rLevelMultiplier, rForceFullyEvolvedLevel; + public static decimal rGiftPercent, rLevelMultiplier, rForceFullyEvolvedLevel, rForceHighPowerLevel; private void B_Randomize_Click(object sender, EventArgs e) { rPKM = rMove = rAbility = rDiffAI = rDiffIV = rClass = rGift = rItem = rDoRand = false; // init to false @@ -711,7 +711,7 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom } // high-power attacks - if (rHighPower) + if (rForceHighPower && pk.Level >= rForceHighPowerLevel) { var pkMoves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); for (int m = 0; m < 4; m++) diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index 5017b7faa0..eeab75afbd 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -68,12 +68,15 @@ private void InitializeComponent() this.CB_Moves = new System.Windows.Forms.ComboBox(); this.L_Moves = new System.Windows.Forms.Label(); this.CHK_NoFixedDamage = new System.Windows.Forms.CheckBox(); + this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); + this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GiftPercent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); this.GB_Tweak.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).BeginInit(); this.SuspendLayout(); // // CHK_RandomPKM @@ -95,7 +98,7 @@ private void InitializeComponent() this.CHK_RandomItems.AutoSize = true; this.CHK_RandomItems.Checked = true; this.CHK_RandomItems.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomItems.Location = new System.Drawing.Point(21, 314); + this.CHK_RandomItems.Location = new System.Drawing.Point(21, 324); this.CHK_RandomItems.Name = "CHK_RandomItems"; this.CHK_RandomItems.Size = new System.Drawing.Size(119, 17); this.CHK_RandomItems.TabIndex = 6; @@ -108,7 +111,7 @@ private void InitializeComponent() this.CHK_RandomAbilities.AutoSize = true; this.CHK_RandomAbilities.Checked = true; this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 329); + this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 339); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); this.CHK_RandomAbilities.TabIndex = 7; @@ -121,7 +124,7 @@ private void InitializeComponent() this.CHK_RandomGift.AutoSize = true; this.CHK_RandomGift.Checked = true; this.CHK_RandomGift.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomGift.Location = new System.Drawing.Point(21, 408); + this.CHK_RandomGift.Location = new System.Drawing.Point(21, 418); this.CHK_RandomGift.Name = "CHK_RandomGift"; this.CHK_RandomGift.Size = new System.Drawing.Size(145, 17); this.CHK_RandomGift.TabIndex = 10; @@ -135,7 +138,7 @@ private void InitializeComponent() this.CHK_RandomClass.AutoSize = true; this.CHK_RandomClass.Checked = true; this.CHK_RandomClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomClass.Location = new System.Drawing.Point(21, 361); + this.CHK_RandomClass.Location = new System.Drawing.Point(21, 371); this.CHK_RandomClass.Name = "CHK_RandomClass"; this.CHK_RandomClass.Size = new System.Drawing.Size(141, 17); this.CHK_RandomClass.TabIndex = 9; @@ -149,7 +152,7 @@ private void InitializeComponent() this.CHK_MaxDiffAI.AutoSize = true; this.CHK_MaxDiffAI.Checked = true; this.CHK_MaxDiffAI.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffAI.Location = new System.Drawing.Point(21, 423); + this.CHK_MaxDiffAI.Location = new System.Drawing.Point(21, 433); this.CHK_MaxDiffAI.Name = "CHK_MaxDiffAI"; this.CHK_MaxDiffAI.Size = new System.Drawing.Size(95, 17); this.CHK_MaxDiffAI.TabIndex = 13; @@ -162,7 +165,7 @@ private void InitializeComponent() this.CHK_MaxDiffPKM.AutoSize = true; this.CHK_MaxDiffPKM.Checked = true; this.CHK_MaxDiffPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(21, 344); + this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(21, 354); this.CHK_MaxDiffPKM.Name = "CHK_MaxDiffPKM"; this.CHK_MaxDiffPKM.Size = new System.Drawing.Size(64, 17); this.CHK_MaxDiffPKM.TabIndex = 8; @@ -172,7 +175,7 @@ private void InitializeComponent() // B_OK // this.B_OK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.B_OK.Location = new System.Drawing.Point(250, 385); + this.B_OK.Location = new System.Drawing.Point(247, 409); this.B_OK.Name = "B_OK"; this.B_OK.Size = new System.Drawing.Size(50, 23); this.B_OK.TabIndex = 14; @@ -183,7 +186,7 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.B_Cancel.Location = new System.Drawing.Point(250, 407); + this.B_Cancel.Location = new System.Drawing.Point(247, 431); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(50, 23); this.B_Cancel.TabIndex = 15; @@ -194,7 +197,7 @@ private void InitializeComponent() // NUD_GiftPercent // this.NUD_GiftPercent.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_GiftPercent.Location = new System.Drawing.Point(166, 405); + this.NUD_GiftPercent.Location = new System.Drawing.Point(166, 415); this.NUD_GiftPercent.Name = "NUD_GiftPercent"; this.NUD_GiftPercent.Size = new System.Drawing.Size(43, 20); this.NUD_GiftPercent.TabIndex = 11; @@ -209,7 +212,7 @@ private void InitializeComponent() // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(211, 407); + this.label1.Location = new System.Drawing.Point(211, 417); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(15, 13); this.label1.TabIndex = 12; @@ -278,7 +281,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(12, 49); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(270, 163); + this.GB_Tweak.Size = new System.Drawing.Size(270, 155); this.GB_Tweak.TabIndex = 323; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Options"; @@ -286,7 +289,7 @@ private void InitializeComponent() // NUD_ForceFullyEvolved // this.NUD_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 97); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 98); this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(43, 20); this.NUD_ForceFullyEvolved.TabIndex = 334; @@ -301,7 +304,7 @@ private void InitializeComponent() this.CHK_GymE4Only.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_GymE4Only.AutoSize = true; this.CHK_GymE4Only.Enabled = false; - this.CHK_GymE4Only.Location = new System.Drawing.Point(141, 134); + this.CHK_GymE4Only.Location = new System.Drawing.Point(141, 133); this.CHK_GymE4Only.Name = "CHK_GymE4Only"; this.CHK_GymE4Only.Size = new System.Drawing.Size(125, 17); this.CHK_GymE4Only.TabIndex = 295; @@ -312,7 +315,7 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 99); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 100); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); this.CHK_ForceFullyEvolved.TabIndex = 333; @@ -324,7 +327,7 @@ private void InitializeComponent() this.CHK_GymTrainers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_GymTrainers.AutoSize = true; this.CHK_GymTrainers.Enabled = false; - this.CHK_GymTrainers.Location = new System.Drawing.Point(9, 134); + this.CHK_GymTrainers.Location = new System.Drawing.Point(9, 133); this.CHK_GymTrainers.Name = "CHK_GymTrainers"; this.CHK_GymTrainers.Size = new System.Drawing.Size(124, 17); this.CHK_GymTrainers.TabIndex = 292; @@ -337,7 +340,7 @@ private void InitializeComponent() this.CHK_StoryMEvos.AutoSize = true; this.CHK_StoryMEvos.Checked = true; this.CHK_StoryMEvos.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_StoryMEvos.Location = new System.Drawing.Point(9, 63); + this.CHK_StoryMEvos.Location = new System.Drawing.Point(9, 64); this.CHK_StoryMEvos.Name = "CHK_StoryMEvos"; this.CHK_StoryMEvos.Size = new System.Drawing.Size(168, 17); this.CHK_StoryMEvos.TabIndex = 291; @@ -348,7 +351,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 81); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 82); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 294; @@ -359,7 +362,7 @@ private void InitializeComponent() // this.CHK_TypeTheme.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_TypeTheme.AutoSize = true; - this.CHK_TypeTheme.Location = new System.Drawing.Point(9, 118); + this.CHK_TypeTheme.Location = new System.Drawing.Point(9, 117); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); this.CHK_TypeTheme.TabIndex = 289; @@ -477,7 +480,7 @@ private void InitializeComponent() // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(21, 215); + this.CHK_6PKM.Location = new System.Drawing.Point(21, 205); this.CHK_6PKM.Name = "CHK_6PKM"; this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 293; @@ -491,7 +494,7 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass.AutoSize = true; this.CHK_IgnoreSpecialClass.Checked = true; this.CHK_IgnoreSpecialClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(40, 377); + this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(40, 387); this.CHK_IgnoreSpecialClass.Name = "CHK_IgnoreSpecialClass"; this.CHK_IgnoreSpecialClass.Size = new System.Drawing.Size(133, 17); this.CHK_IgnoreSpecialClass.TabIndex = 324; @@ -504,7 +507,7 @@ private void InitializeComponent() this.CHK_OnlySingles.AutoSize = true; this.CHK_OnlySingles.Checked = true; this.CHK_OnlySingles.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_OnlySingles.Location = new System.Drawing.Point(40, 391); + this.CHK_OnlySingles.Location = new System.Drawing.Point(40, 401); this.CHK_OnlySingles.Name = "CHK_OnlySingles"; this.CHK_OnlySingles.Size = new System.Drawing.Size(114, 17); this.CHK_OnlySingles.TabIndex = 325; @@ -514,7 +517,7 @@ private void InitializeComponent() // NUD_Damage // this.NUD_Damage.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_Damage.Location = new System.Drawing.Point(213, 275); + this.NUD_Damage.Location = new System.Drawing.Point(226, 264); this.NUD_Damage.Maximum = new decimal(new int[] { 4, 0, @@ -535,7 +538,7 @@ private void InitializeComponent() this.CHK_Damage.AutoSize = true; this.CHK_Damage.Checked = true; this.CHK_Damage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Damage.Location = new System.Drawing.Point(21, 276); + this.CHK_Damage.Location = new System.Drawing.Point(21, 265); this.CHK_Damage.Name = "CHK_Damage"; this.CHK_Damage.Size = new System.Drawing.Size(192, 17); this.CHK_Damage.TabIndex = 327; @@ -548,7 +551,7 @@ private void InitializeComponent() this.CHK_STAB.AutoSize = true; this.CHK_STAB.Checked = true; this.CHK_STAB.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_STAB.Location = new System.Drawing.Point(21, 295); + this.CHK_STAB.Location = new System.Drawing.Point(21, 286); this.CHK_STAB.Name = "CHK_STAB"; this.CHK_STAB.Size = new System.Drawing.Size(172, 17); this.CHK_STAB.TabIndex = 328; @@ -558,7 +561,7 @@ private void InitializeComponent() // NUD_STAB // this.NUD_STAB.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_STAB.Location = new System.Drawing.Point(213, 296); + this.NUD_STAB.Location = new System.Drawing.Point(226, 285); this.NUD_STAB.Maximum = new decimal(new int[] { 4, 0, @@ -581,9 +584,8 @@ private void InitializeComponent() this.CB_Moves.Items.AddRange(new object[] { "Don\'t Modify", "Randomize All", - "Use Levelup Only", - "High Powered Attacks"}); - this.CB_Moves.Location = new System.Drawing.Point(67, 251); + "Use Levelup Only"}); + this.CB_Moves.Location = new System.Drawing.Point(67, 223); this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(135, 21); this.CB_Moves.TabIndex = 330; @@ -593,7 +595,7 @@ private void InitializeComponent() // this.L_Moves.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.L_Moves.AutoSize = true; - this.L_Moves.Location = new System.Drawing.Point(19, 254); + this.L_Moves.Location = new System.Drawing.Point(19, 226); this.L_Moves.Name = "L_Moves"; this.L_Moves.Size = new System.Drawing.Size(42, 13); this.L_Moves.TabIndex = 331; @@ -604,18 +606,49 @@ private void InitializeComponent() this.CHK_NoFixedDamage.AutoSize = true; this.CHK_NoFixedDamage.Checked = true; this.CHK_NoFixedDamage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_NoFixedDamage.Location = new System.Drawing.Point(21, 231); + this.CHK_NoFixedDamage.Location = new System.Drawing.Point(21, 305); this.CHK_NoFixedDamage.Name = "CHK_NoFixedDamage"; this.CHK_NoFixedDamage.Size = new System.Drawing.Size(281, 17); this.CHK_NoFixedDamage.TabIndex = 332; this.CHK_NoFixedDamage.Text = "No Fixed Damage Moves (Dragon Rage/Sonic Boom)"; this.CHK_NoFixedDamage.UseVisualStyleBackColor = true; // + // CHK_ForceHighPower + // + this.CHK_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.CHK_ForceHighPower.AutoSize = true; + this.CHK_ForceHighPower.Location = new System.Drawing.Point(21, 245); + this.CHK_ForceHighPower.Name = "CHK_ForceHighPower"; + this.CHK_ForceHighPower.Size = new System.Drawing.Size(203, 17); + this.CHK_ForceHighPower.TabIndex = 344; + this.CHK_ForceHighPower.Text = "Force High-Powered Attacks at Level"; + this.CHK_ForceHighPower.UseVisualStyleBackColor = true; + // + // NUD_ForceHighPower + // + this.NUD_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.NUD_ForceHighPower.Location = new System.Drawing.Point(226, 243); + this.NUD_ForceHighPower.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceHighPower.Name = "NUD_ForceHighPower"; + this.NUD_ForceHighPower.Size = new System.Drawing.Size(35, 20); + this.NUD_ForceHighPower.TabIndex = 343; + this.NUD_ForceHighPower.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // // TrainerRand // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(304, 447); + this.ClientSize = new System.Drawing.Size(304, 465); + this.Controls.Add(this.CHK_ForceHighPower); + this.Controls.Add(this.NUD_ForceHighPower); this.Controls.Add(this.CHK_NoFixedDamage); this.Controls.Add(this.L_Moves); this.Controls.Add(this.CHK_6PKM); @@ -654,6 +687,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -701,5 +735,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_NoFixedDamage; private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; + private System.Windows.Forms.CheckBox CHK_ForceHighPower; + private System.Windows.Forms.NumericUpDown NUD_ForceHighPower; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index 827c17af78..db097090b2 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -41,7 +41,6 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.rMove = CB_Moves.SelectedIndex == 1; RSTE.rNoMove = CB_Moves.SelectedIndex == 2; - RSTE.rHighPower = CB_Moves.SelectedIndex == 3; if (RSTE.rMove) { RSTE.rDMG = CHK_Damage.Checked; @@ -75,6 +74,8 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.rRandomMegas = CHK_RandomMegaForm.Checked; RSTE.rForceFullyEvolved = CHK_ForceFullyEvolved.Checked; RSTE.rForceFullyEvolvedLevel = NUD_ForceFullyEvolved.Value; + RSTE.rForceHighPower = CHK_ForceHighPower.Checked; + RSTE.rForceHighPowerLevel = NUD_ForceHighPower.Value; if (CHK_StoryMEvos.Checked) { diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 87a8e2ece6..969d2e4d64 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -191,6 +191,8 @@ private void InitializeComponent() this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); + this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -241,6 +243,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).BeginInit(); this.SuspendLayout(); // // CB_TrainerID @@ -1808,6 +1811,8 @@ private void InitializeComponent() // // Tab_PKM2 // + this.Tab_PKM2.Controls.Add(this.CHK_ForceHighPower); + this.Tab_PKM2.Controls.Add(this.NUD_ForceHighPower); this.Tab_PKM2.Controls.Add(this.CHK_NoFixedDamage); this.Tab_PKM2.Controls.Add(this.CHK_BeneficialEVs); this.Tab_PKM2.Controls.Add(this.L_Moves); @@ -1832,7 +1837,7 @@ private void InitializeComponent() this.CHK_NoFixedDamage.AutoSize = true; this.CHK_NoFixedDamage.Checked = true; this.CHK_NoFixedDamage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_NoFixedDamage.Location = new System.Drawing.Point(6, 31); + this.CHK_NoFixedDamage.Location = new System.Drawing.Point(6, 86); this.CHK_NoFixedDamage.Name = "CHK_NoFixedDamage"; this.CHK_NoFixedDamage.Size = new System.Drawing.Size(281, 17); this.CHK_NoFixedDamage.TabIndex = 340; @@ -1845,7 +1850,7 @@ private void InitializeComponent() this.CHK_BeneficialEVs.AutoSize = true; this.CHK_BeneficialEVs.Checked = true; this.CHK_BeneficialEVs.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BeneficialEVs.Location = new System.Drawing.Point(201, 115); + this.CHK_BeneficialEVs.Location = new System.Drawing.Point(201, 118); this.CHK_BeneficialEVs.Name = "CHK_BeneficialEVs"; this.CHK_BeneficialEVs.Size = new System.Drawing.Size(75, 17); this.CHK_BeneficialEVs.TabIndex = 339; @@ -1856,7 +1861,7 @@ private void InitializeComponent() // this.L_Moves.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.L_Moves.AutoSize = true; - this.L_Moves.Location = new System.Drawing.Point(6, 11); + this.L_Moves.Location = new System.Drawing.Point(6, 7); this.L_Moves.Name = "L_Moves"; this.L_Moves.Size = new System.Drawing.Size(42, 13); this.L_Moves.TabIndex = 338; @@ -1870,9 +1875,8 @@ private void InitializeComponent() this.CB_Moves.Items.AddRange(new object[] { "Don\'t Modify", "Randomize All", - "Use Levelup Only", - "High Powered Attacks"}); - this.CB_Moves.Location = new System.Drawing.Point(52, 8); + "Use Levelup Only"}); + this.CB_Moves.Location = new System.Drawing.Point(52, 4); this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(135, 21); this.CB_Moves.TabIndex = 337; @@ -1884,7 +1888,7 @@ private void InitializeComponent() this.CHK_MaxDiffPKM.AutoSize = true; this.CHK_MaxDiffPKM.Checked = true; this.CHK_MaxDiffPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(201, 99); + this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(201, 102); this.CHK_MaxDiffPKM.Name = "CHK_MaxDiffPKM"; this.CHK_MaxDiffPKM.Size = new System.Drawing.Size(64, 17); this.CHK_MaxDiffPKM.TabIndex = 332; @@ -1894,7 +1898,7 @@ private void InitializeComponent() // NUD_Damage // this.NUD_Damage.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_Damage.Location = new System.Drawing.Point(201, 49); + this.NUD_Damage.Location = new System.Drawing.Point(211, 45); this.NUD_Damage.Maximum = new decimal(new int[] { 4, 0, @@ -1915,7 +1919,7 @@ private void InitializeComponent() this.CHK_RandomAbilities.AutoSize = true; this.CHK_RandomAbilities.Checked = true; this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 115); + this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 118); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); this.CHK_RandomAbilities.TabIndex = 331; @@ -1925,7 +1929,7 @@ private void InitializeComponent() // NUD_STAB // this.NUD_STAB.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_STAB.Location = new System.Drawing.Point(201, 70); + this.NUD_STAB.Location = new System.Drawing.Point(211, 66); this.NUD_STAB.Maximum = new decimal(new int[] { 4, 0, @@ -1946,7 +1950,7 @@ private void InitializeComponent() this.CHK_Damage.AutoSize = true; this.CHK_Damage.Checked = true; this.CHK_Damage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Damage.Location = new System.Drawing.Point(6, 51); + this.CHK_Damage.Location = new System.Drawing.Point(6, 46); this.CHK_Damage.Name = "CHK_Damage"; this.CHK_Damage.Size = new System.Drawing.Size(192, 17); this.CHK_Damage.TabIndex = 334; @@ -1960,7 +1964,7 @@ private void InitializeComponent() this.CHK_RandomItems.AutoSize = true; this.CHK_RandomItems.Checked = true; this.CHK_RandomItems.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomItems.Location = new System.Drawing.Point(6, 99); + this.CHK_RandomItems.Location = new System.Drawing.Point(6, 102); this.CHK_RandomItems.Name = "CHK_RandomItems"; this.CHK_RandomItems.Size = new System.Drawing.Size(119, 17); this.CHK_RandomItems.TabIndex = 330; @@ -1973,7 +1977,7 @@ private void InitializeComponent() this.CHK_STAB.AutoSize = true; this.CHK_STAB.Checked = true; this.CHK_STAB.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_STAB.Location = new System.Drawing.Point(6, 70); + this.CHK_STAB.Location = new System.Drawing.Point(6, 66); this.CHK_STAB.Name = "CHK_STAB"; this.CHK_STAB.Size = new System.Drawing.Size(172, 17); this.CHK_STAB.TabIndex = 335; @@ -2153,6 +2157,35 @@ private void InitializeComponent() this.CHK_RandomClass.UseVisualStyleBackColor = true; this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); // + // NUD_ForceHighPower + // + this.NUD_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.NUD_ForceHighPower.Location = new System.Drawing.Point(211, 24); + this.NUD_ForceHighPower.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceHighPower.Name = "NUD_ForceHighPower"; + this.NUD_ForceHighPower.Size = new System.Drawing.Size(35, 20); + this.NUD_ForceHighPower.TabIndex = 341; + this.NUD_ForceHighPower.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceHighPower + // + this.CHK_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.CHK_ForceHighPower.AutoSize = true; + this.CHK_ForceHighPower.Location = new System.Drawing.Point(6, 26); + this.CHK_ForceHighPower.Name = "CHK_ForceHighPower"; + this.CHK_ForceHighPower.Size = new System.Drawing.Size(203, 17); + this.CHK_ForceHighPower.TabIndex = 342; + this.CHK_ForceHighPower.Text = "Force High-Powered Attacks at Level"; + this.CHK_ForceHighPower.UseVisualStyleBackColor = true; + // // SMTE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2233,6 +2266,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).EndInit(); this.ResumeLayout(false); } @@ -2400,6 +2434,8 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_6PKM; + private System.Windows.Forms.CheckBox CHK_ForceHighPower; + private System.Windows.Forms.NumericUpDown NUD_ForceHighPower; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 167745789d..a8eaf71d4d 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -702,10 +702,12 @@ private void B_Randomize_Click(object sender, EventArgs e) case 2: // Current LevelUp pk.Moves = learn.GetCurrentMoves(pk.Species, pk.Form, pk.Level, 4); break; - case 3: // High Attacks - pk.Moves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); - break; } + + // high-power attacks + if (CHK_ForceHighPower.Checked && pk.Level >= NUD_ForceHighPower.Value) + pk.Moves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); + // sanitize moves if (CB_Moves.SelectedIndex > 1) // learn source { From 4cf5381980a7d79554ed19e1562dd620656a92f8 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Fri, 5 Jan 2018 12:29:39 -0500 Subject: [PATCH 065/191] Add more SMTE rand options --- pk3DS.Core/Legality/Legal.cs | 5 + pk3DS/Subforms/Gen6/RSTE.Designer.cs | 4 +- pk3DS/Subforms/Gen6/TrainerRand.Designer.cs | 4 +- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 108 +++++++++++++------- pk3DS/Subforms/Gen7/SMTE.cs | 44 +++++++- 5 files changed, 118 insertions(+), 47 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index a2bd17b558..a1f6f95d9d 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -302,5 +302,10 @@ public static partial class Legal { 804, 805, 806, 807, }).ToArray(); + public static readonly int[] Legendary_Mythical = + { + 144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638, + 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 804, 805, 806, 807 + }; } } diff --git a/pk3DS/Subforms/Gen6/RSTE.Designer.cs b/pk3DS/Subforms/Gen6/RSTE.Designer.cs index f82f0fe7f6..d67155dbae 100644 --- a/pk3DS/Subforms/Gen6/RSTE.Designer.cs +++ b/pk3DS/Subforms/Gen6/RSTE.Designer.cs @@ -303,7 +303,7 @@ private void InitializeComponent() // checkBox_Healer // this.checkBox_Healer.AutoSize = true; - this.checkBox_Healer.Location = new System.Drawing.Point(7, 35); + this.checkBox_Healer.Location = new System.Drawing.Point(7, 49); this.checkBox_Healer.Name = "checkBox_Healer"; this.checkBox_Healer.Size = new System.Drawing.Size(57, 17); this.checkBox_Healer.TabIndex = 58; @@ -415,7 +415,7 @@ private void InitializeComponent() // checkBox_Moves // this.checkBox_Moves.AutoSize = true; - this.checkBox_Moves.Location = new System.Drawing.Point(7, 58); + this.checkBox_Moves.Location = new System.Drawing.Point(7, 65); this.checkBox_Moves.Name = "checkBox_Moves"; this.checkBox_Moves.Size = new System.Drawing.Size(58, 17); this.checkBox_Moves.TabIndex = 40; diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index eeab75afbd..751dcce15c 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -113,9 +113,9 @@ private void InitializeComponent() this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 339); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; - this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); + this.CHK_RandomAbilities.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbilities.TabIndex = 7; - this.CHK_RandomAbilities.Text = "Random Abilities (Including Hidden)"; + this.CHK_RandomAbilities.Text = "Random Abilities (1, 2, or Hidden)"; this.CHK_RandomAbilities.UseVisualStyleBackColor = true; // // CHK_RandomGift diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 969d2e4d64..d35c3288e6 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -168,6 +168,8 @@ private void InitializeComponent() this.CHK_BST = new System.Windows.Forms.CheckBox(); this.CHK_RandomPKM = new System.Windows.Forms.CheckBox(); this.Tab_PKM2 = new System.Windows.Forms.TabPage(); + this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); + this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); this.CHK_NoFixedDamage = new System.Windows.Forms.CheckBox(); this.CHK_BeneficialEVs = new System.Windows.Forms.CheckBox(); this.L_Moves = new System.Windows.Forms.Label(); @@ -191,8 +193,8 @@ private void InitializeComponent() this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); - this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); - this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -237,13 +239,13 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Shiny)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.Tab_PKM2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); this.Tab_Trainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).BeginInit(); this.SuspendLayout(); // // CB_TrainerID @@ -1832,6 +1834,35 @@ private void InitializeComponent() this.Tab_PKM2.Text = "Stats/Moves"; this.Tab_PKM2.UseVisualStyleBackColor = true; // + // CHK_ForceHighPower + // + this.CHK_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.CHK_ForceHighPower.AutoSize = true; + this.CHK_ForceHighPower.Location = new System.Drawing.Point(6, 26); + this.CHK_ForceHighPower.Name = "CHK_ForceHighPower"; + this.CHK_ForceHighPower.Size = new System.Drawing.Size(203, 17); + this.CHK_ForceHighPower.TabIndex = 342; + this.CHK_ForceHighPower.Text = "Force High-Powered Attacks at Level"; + this.CHK_ForceHighPower.UseVisualStyleBackColor = true; + // + // NUD_ForceHighPower + // + this.NUD_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.NUD_ForceHighPower.Location = new System.Drawing.Point(211, 24); + this.NUD_ForceHighPower.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceHighPower.Name = "NUD_ForceHighPower"; + this.NUD_ForceHighPower.Size = new System.Drawing.Size(35, 20); + this.NUD_ForceHighPower.TabIndex = 341; + this.NUD_ForceHighPower.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // // CHK_NoFixedDamage // this.CHK_NoFixedDamage.AutoSize = true; @@ -1921,9 +1952,9 @@ private void InitializeComponent() this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 118); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; - this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); + this.CHK_RandomAbilities.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbilities.TabIndex = 331; - this.CHK_RandomAbilities.Text = "Random Abilities (Including Hidden)"; + this.CHK_RandomAbilities.Text = "Random Abilities (1, 2, or Hidden)"; this.CHK_RandomAbilities.UseVisualStyleBackColor = true; // // NUD_STAB @@ -1987,6 +2018,8 @@ private void InitializeComponent() // // Tab_Trainer1 // + this.Tab_Trainer1.Controls.Add(this.CHK_ReplaceMega); + this.Tab_Trainer1.Controls.Add(this.CHK_ReplaceLegend); this.Tab_Trainer1.Controls.Add(this.CHK_6PKM); this.Tab_Trainer1.Controls.Add(this.NUD_ForceFullyEvolved); this.Tab_Trainer1.Controls.Add(this.CHK_ForceFullyEvolved); @@ -2009,7 +2042,7 @@ private void InitializeComponent() // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(6, 94); + this.CHK_6PKM.Location = new System.Drawing.Point(6, 104); this.CHK_6PKM.Name = "CHK_6PKM"; this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 341; @@ -2018,7 +2051,7 @@ private void InitializeComponent() // // NUD_ForceFullyEvolved // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 111); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 71); this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { 1, 0, @@ -2037,7 +2070,7 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 113); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 73); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); this.CHK_ForceFullyEvolved.TabIndex = 339; @@ -2110,7 +2143,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 76); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 89); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 333; @@ -2157,34 +2190,31 @@ private void InitializeComponent() this.CHK_RandomClass.UseVisualStyleBackColor = true; this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); // - // NUD_ForceHighPower - // - this.NUD_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_ForceHighPower.Location = new System.Drawing.Point(211, 24); - this.NUD_ForceHighPower.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NUD_ForceHighPower.Name = "NUD_ForceHighPower"; - this.NUD_ForceHighPower.Size = new System.Drawing.Size(35, 20); - this.NUD_ForceHighPower.TabIndex = 341; - this.NUD_ForceHighPower.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); - // - // CHK_ForceHighPower - // - this.CHK_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.CHK_ForceHighPower.AutoSize = true; - this.CHK_ForceHighPower.Location = new System.Drawing.Point(6, 26); - this.CHK_ForceHighPower.Name = "CHK_ForceHighPower"; - this.CHK_ForceHighPower.Size = new System.Drawing.Size(203, 17); - this.CHK_ForceHighPower.TabIndex = 342; - this.CHK_ForceHighPower.Text = "Force High-Powered Attacks at Level"; - this.CHK_ForceHighPower.UseVisualStyleBackColor = true; + // CHK_ReplaceLegend + // + this.CHK_ReplaceLegend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 53); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(257, 17); + this.CHK_ReplaceLegend.TabIndex = 342; + this.CHK_ReplaceLegend.Text = "Team Rainbow Rocket Legendary-for-Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + // + // CHK_ReplaceMega + // + this.CHK_ReplaceMega.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ReplaceMega.AutoSize = true; + this.CHK_ReplaceMega.Checked = true; + this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceMega.Location = new System.Drawing.Point(6, 119); + this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; + this.CHK_ReplaceMega.Size = new System.Drawing.Size(196, 17); + this.CHK_ReplaceMega.TabIndex = 343; + this.CHK_ReplaceMega.Text = "Ensure Post-Game Mega Evolutions"; + this.CHK_ReplaceMega.UseVisualStyleBackColor = true; // // SMTE // @@ -2259,6 +2289,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.Tab_PKM2.ResumeLayout(false); this.Tab_PKM2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); this.Tab_Trainer1.ResumeLayout(false); @@ -2266,7 +2297,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).EndInit(); this.ResumeLayout(false); } @@ -2436,6 +2466,8 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_6PKM; private System.Windows.Forms.CheckBox CHK_ForceHighPower; private System.Windows.Forms.NumericUpDown NUD_ForceHighPower; + private System.Windows.Forms.CheckBox CHK_ReplaceLegend; + private System.Windows.Forms.CheckBox CHK_ReplaceMega; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index a8eaf71d4d..b93f9798ae 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -21,6 +21,8 @@ public partial class SMTE : Form private static int[] TrainerClasses; private static int[] ImportantTrainers; private static int[] FinalEvo; + private static int[] ReplaceLegend; + private static Dictionary MegaDictionary; private int index = -1; private PictureBox[] pba; @@ -56,10 +58,13 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) CB_TrainerID.SelectedIndex = 0; CB_Moves.SelectedIndex = 0; + CHK_ReplaceLegend.Visible = Main.Config.USUM; // Team Rainbow Rocket only in USUM + MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); TrainerClasses = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; + ReplaceLegend = Legal.Legendary_Mythical; RandSettings.GetFormSettings(this, Tab_Misc.Controls); } @@ -671,8 +676,33 @@ private void B_Randomize_Click(object sender, EventArgs e) if (CHK_RandomPKM.Checked) { int Type = CHK_TypeTheme.Checked ? (int)Util.rnd32() % 17 : -1; - pk.Species = rnd.GetRandomSpeciesType(pk.Species, Type); - pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + + // replaces Megas with another Mega (Dexio and Lysandre in USUM) + if (MegaDictionary.Values.Any(z => z.Contains(pk.Item))) + { + int species = pk.Species; + int[] mega = GetRandomMega(out species); + pk.Species = species; + pk.Item = mega[Util.rand.Next(0, mega.Length)]; + pk.Form = 0; // allow it to Mega Evolve naturally + } + + // replaces Team Rainbow Rocket Legendaries with another Legendary + else if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(pk.Species)) + { + int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); + pk.Species = ReplaceLegend[randLegend()]; + pk.Item = items[Util.rnd32() % items.Length]; + pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + } + + // every other pkm + else + { + pk.Species = rnd.GetRandomSpeciesType(pk.Species, Type); + pk.Item = items[Util.rnd32() % items.Length]; + pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + } pk.Gender = 0; // random pk.Nature = (int)(Util.rnd32() % CB_Nature.Items.Count); // random } @@ -680,10 +710,8 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.Level = Randomizer.getModifiedLevel(pk.Level, NUD_LevelBoost.Value); if (CHK_RandomShiny.Checked) pk.Shiny = Util.rand.Next(0, 100 + 1) < NUD_Shiny.Value; - if (CHK_RandomItems.Checked) - pk.Item = items[Util.rnd32()%items.Length]; if (CHK_RandomAbilities.Checked) - pk.Ability = (int)Util.rnd32()%4; + pk.Ability = (int)Util.rnd32() % 4; if (CHK_MaxDiffPKM.Checked) pk.IVs = new[] {31, 31, 31, 31, 31, 31}; @@ -783,5 +811,11 @@ private void CHK_Level_CheckedChanged(object sender, EventArgs e) { NUD_LevelBoost.Enabled = CHK_Level.Checked; } + private int[] GetRandomMega(out int species) + { + int rnd = Util.rand.Next(0, MegaDictionary.Count - 1); + species = MegaDictionary.Keys.ElementAt(rnd); + return MegaDictionary.Values.ElementAt(rnd); + } } } From 8000dbc024f392e5821b2e497aaba79094e8f5c6 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 8 Jan 2018 10:43:48 -0500 Subject: [PATCH 066/191] Update final evolutions 2 Sandslash, no Regigigas oops --- pk3DS.Core/Legality/Legal.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index a1f6f95d9d..7bed2ff1eb 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -281,17 +281,17 @@ public static partial class Legal /// public static readonly int[] FinalEvolutions_6 = { - 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, - 091, 094, 097, 099, 101, 103, 105, 106, 107, 110, 115, 119, 121, 122, 124, 127, 128, 130, 131, 132, 134, 135, 136, 139, 141, 142, 143, 144, 145, 146, 149, 150, 151, 154, 157, 160, 162, - 164, 166, 168, 169, 171, 178, 181, 182, 184, 185, 186, 189, 192, 195, 196, 197, 199, 201, 202, 203, 205, 206, 208, 210, 211, 212, 213, 214, 217, 219, 222, 224, 225, 226, 227, 229, 230, - 232, 234, 235, 237, 241, 242, 243, 244, 245, 248, 249, 250, 251, 254, 257, 260, 262, 264, 267, 269, 272, 275, 277, 279, 282, 284, 286, 289, 291, 292, 295, 297, 301, 302, 303, 306, 308, - 310, 311, 312, 313, 314, 317, 319, 321, 323, 324, 326, 327, 330, 332, 334, 335, 336, 337, 338, 340, 342, 344, 346, 348, 350, 351, 352, 354, 357, 358, 359, 362, 365, 367, 368, 369, 370, - 373, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 389, 392, 395, 398, 400, 402, 405, 407, 409, 411, 413, 414, 416, 417, 419, 421, 423, 424, 426, 428, 429, 430, 432, 435, 437, - 441, 442, 445, 448, 450, 452, 454, 455, 457, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 386, 487, - 488, 489, 490, 491, 492, 493, 494, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, - 561, 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, - 635, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, - 701, 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, + 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, 091 + 094, 097, 099, 101, 103, 105, 106, 107, 110, 115, 119, 121, 122, 124, 127, 128, 130, 131, 132, 134, 135, 136, 139, 141, 142, 143, 144, 145, 146, 149, 150, 151, 154, 157, 160, 162, 164 + 166, 168, 169, 171, 178, 181, 182, 184, 185, 186, 189, 192, 195, 196, 197, 199, 201, 202, 203, 205, 206, 208, 210, 211, 212, 213, 214, 217, 219, 222, 224, 225, 226, 227, 229, 230, 232 + 234, 235, 237, 241, 242, 243, 244, 245, 248, 249, 250, 251, 254, 257, 260, 262, 264, 267, 269, 272, 275, 277, 279, 282, 284, 286, 289, 291, 292, 295, 297, 301, 302, 303, 306, 308, 310 + 311, 312, 313, 314, 317, 319, 321, 323, 324, 326, 327, 330, 332, 334, 335, 336, 337, 338, 340, 342, 344, 346, 348, 350, 351, 352, 354, 357, 358, 359, 362, 365, 367, 368, 369, 370, 373 + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 389, 392, 395, 398, 400, 402, 405, 407, 409, 411, 413, 414, 416, 417, 419, 421, 423, 424, 426, 428, 429, 430, 432, 435, 437, 441 + 442, 445, 448, 450, 452, 454, 455, 457, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488 + 489, 490, 491, 492, 493, 494, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, 561 + 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, 635, + 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, + 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, }; public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[] { From 11b2a043aecaa492bbc88e92f315dcf3f003d7ae Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 8 Jan 2018 10:48:06 -0500 Subject: [PATCH 067/191] Add commas oops x2 --- pk3DS.Core/Legality/Legal.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 7bed2ff1eb..a9f5c6785e 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -281,14 +281,14 @@ public static partial class Legal /// public static readonly int[] FinalEvolutions_6 = { - 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, 091 - 094, 097, 099, 101, 103, 105, 106, 107, 110, 115, 119, 121, 122, 124, 127, 128, 130, 131, 132, 134, 135, 136, 139, 141, 142, 143, 144, 145, 146, 149, 150, 151, 154, 157, 160, 162, 164 - 166, 168, 169, 171, 178, 181, 182, 184, 185, 186, 189, 192, 195, 196, 197, 199, 201, 202, 203, 205, 206, 208, 210, 211, 212, 213, 214, 217, 219, 222, 224, 225, 226, 227, 229, 230, 232 - 234, 235, 237, 241, 242, 243, 244, 245, 248, 249, 250, 251, 254, 257, 260, 262, 264, 267, 269, 272, 275, 277, 279, 282, 284, 286, 289, 291, 292, 295, 297, 301, 302, 303, 306, 308, 310 - 311, 312, 313, 314, 317, 319, 321, 323, 324, 326, 327, 330, 332, 334, 335, 336, 337, 338, 340, 342, 344, 346, 348, 350, 351, 352, 354, 357, 358, 359, 362, 365, 367, 368, 369, 370, 373 - 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 389, 392, 395, 398, 400, 402, 405, 407, 409, 411, 413, 414, 416, 417, 419, 421, 423, 424, 426, 428, 429, 430, 432, 435, 437, 441 - 442, 445, 448, 450, 452, 454, 455, 457, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488 - 489, 490, 491, 492, 493, 494, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, 561 + 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, 091, + 094, 097, 099, 101, 103, 105, 106, 107, 110, 115, 119, 121, 122, 124, 127, 128, 130, 131, 132, 134, 135, 136, 139, 141, 142, 143, 144, 145, 146, 149, 150, 151, 154, 157, 160, 162, 164, + 166, 168, 169, 171, 178, 181, 182, 184, 185, 186, 189, 192, 195, 196, 197, 199, 201, 202, 203, 205, 206, 208, 210, 211, 212, 213, 214, 217, 219, 222, 224, 225, 226, 227, 229, 230, 232, + 234, 235, 237, 241, 242, 243, 244, 245, 248, 249, 250, 251, 254, 257, 260, 262, 264, 267, 269, 272, 275, 277, 279, 282, 284, 286, 289, 291, 292, 295, 297, 301, 302, 303, 306, 308, 310, + 311, 312, 313, 314, 317, 319, 321, 323, 324, 326, 327, 330, 332, 334, 335, 336, 337, 338, 340, 342, 344, 346, 348, 350, 351, 352, 354, 357, 358, 359, 362, 365, 367, 368, 369, 370, 373, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 389, 392, 395, 398, 400, 402, 405, 407, 409, 411, 413, 414, 416, 417, 419, 421, 423, 424, 426, 428, 429, 430, 432, 435, 437, 441, + 442, 445, 448, 450, 452, 454, 455, 457, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, + 489, 490, 491, 492, 493, 494, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, 561, 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, 635, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, From d5ef00ea44d79cc8c9d6ee6197559a1f6541965b Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 11 Jan 2018 21:28:17 -0800 Subject: [PATCH 068/191] Add SOS/Weather rate labels/tooltips Thanks @wwwwwwzx ! --- pk3DS/Subforms/Gen7/SMWE.Designer.cs | 64 +++++++++++++++++++++++++++- pk3DS/Subforms/Gen7/SMWE.cs | 7 +++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/pk3DS/Subforms/Gen7/SMWE.Designer.cs b/pk3DS/Subforms/Gen7/SMWE.Designer.cs index c95fb6b099..926358ef3f 100644 --- a/pk3DS/Subforms/Gen7/SMWE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMWE.Designer.cs @@ -259,6 +259,11 @@ private void InitializeComponent() this.CB_TableID = new System.Windows.Forms.ComboBox(); this.B_Export = new System.Windows.Forms.Button(); this.CopySOS = new System.Windows.Forms.Button(); + this.L_Weather0 = new System.Windows.Forms.Label(); + this.L_Weather1 = new System.Windows.Forms.Label(); + this.L_Rain = new System.Windows.Forms.Label(); + this.L_Hail = new System.Windows.Forms.Label(); + this.L_Sand = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.NUP_Min)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUP_Max)).BeginInit(); this.GB_Encounters.SuspendLayout(); @@ -481,6 +486,11 @@ private void InitializeComponent() // // GB_Encounters // + this.GB_Encounters.Controls.Add(this.L_Sand); + this.GB_Encounters.Controls.Add(this.L_Hail); + this.GB_Encounters.Controls.Add(this.L_Rain); + this.GB_Encounters.Controls.Add(this.L_Weather1); + this.GB_Encounters.Controls.Add(this.L_Weather0); this.GB_Encounters.Controls.Add(this.B_PasteAll); this.GB_Encounters.Controls.Add(this.B_Paste); this.GB_Encounters.Controls.Add(this.B_Copy); @@ -975,7 +985,7 @@ private void InitializeComponent() // // NUP_WeatherForme6 // - this.NUP_WeatherForme6.Location = new System.Drawing.Point(219, 333); + this.NUP_WeatherForme6.Location = new System.Drawing.Point(220, 332); this.NUP_WeatherForme6.Maximum = new decimal(new int[] { 31, 0, @@ -1002,7 +1012,7 @@ private void InitializeComponent() this.CB_WeatherEnc6.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_WeatherEnc6.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_WeatherEnc6.FormattingEnabled = true; - this.CB_WeatherEnc6.Location = new System.Drawing.Point(144, 332); + this.CB_WeatherEnc6.Location = new System.Drawing.Point(145, 332); this.CB_WeatherEnc6.Name = "CB_WeatherEnc6"; this.CB_WeatherEnc6.Size = new System.Drawing.Size(72, 21); this.CB_WeatherEnc6.TabIndex = 502; @@ -3084,6 +3094,51 @@ private void InitializeComponent() this.CopySOS.UseVisualStyleBackColor = true; this.CopySOS.Click += new System.EventHandler(this.CopySOS_Click); // + // L_Weather0 + // + this.L_Weather0.AutoSize = true; + this.L_Weather0.Location = new System.Drawing.Point(114, 264); + this.L_Weather0.Name = "L_Weather0"; + this.L_Weather0.Size = new System.Drawing.Size(21, 13); + this.L_Weather0.TabIndex = 511; + this.L_Weather0.Text = "1%"; + // + // L_Weather1 + // + this.L_Weather1.AutoSize = true; + this.L_Weather1.Location = new System.Drawing.Point(222, 264); + this.L_Weather1.Name = "L_Weather1"; + this.L_Weather1.Size = new System.Drawing.Size(27, 13); + this.L_Weather1.TabIndex = 512; + this.L_Weather1.Text = "10%"; + // + // L_Rain + // + this.L_Rain.AutoSize = true; + this.L_Rain.Location = new System.Drawing.Point(254, 282); + this.L_Rain.Name = "L_Rain"; + this.L_Rain.Size = new System.Drawing.Size(29, 13); + this.L_Rain.TabIndex = 513; + this.L_Rain.Text = "Rain"; + // + // L_Hail + // + this.L_Hail.AutoSize = true; + this.L_Hail.Location = new System.Drawing.Point(254, 309); + this.L_Hail.Name = "L_Hail"; + this.L_Hail.Size = new System.Drawing.Size(25, 13); + this.L_Hail.TabIndex = 514; + this.L_Hail.Text = "Hail"; + // + // L_Sand + // + this.L_Sand.AutoSize = true; + this.L_Sand.Location = new System.Drawing.Point(254, 335); + this.L_Sand.Name = "L_Sand"; + this.L_Sand.Size = new System.Drawing.Size(32, 13); + this.L_Sand.TabIndex = 515; + this.L_Sand.Text = "Sand"; + // // SMWE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -3451,5 +3506,10 @@ private void InitializeComponent() private System.Windows.Forms.Button B_PasteAll; private System.Windows.Forms.Button B_Paste; private System.Windows.Forms.Button B_Copy; + private System.Windows.Forms.Label L_Sand; + private System.Windows.Forms.Label L_Hail; + private System.Windows.Forms.Label L_Rain; + private System.Windows.Forms.Label L_Weather1; + private System.Windows.Forms.Label L_Weather0; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/SMWE.cs b/pk3DS/Subforms/Gen7/SMWE.cs index 24359a350c..de138cf5af 100644 --- a/pk3DS/Subforms/Gen7/SMWE.cs +++ b/pk3DS/Subforms/Gen7/SMWE.cs @@ -41,6 +41,13 @@ public SMWE(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd) LoadData(); RandSettings.GetFormSettings(this, GB_Tweak.Controls); + var weather = string.Format("If weather is active, create a random number.{0}If 0, use slot 0.{0}If <= 10, use slot 1.{0}Else, pick an SOS table and a slot.", Environment.NewLine); + new ToolTip().SetToolTip(L_AddSOS, weather); + var sos = new[] {L_SOS1, L_SOS2, L_SOS3, L_SOS4, L_SOS5, L_SOS6, L_SOS7}; + var rates = new[] {1,1,1, 10,10,10, 67}; + for (int i = 0; i < sos.Length; i++) + new ToolTip().SetToolTip(sos[i], $"Table Selection Rate: {rates[i]}%"); + // ExportEncounters("um", "uu"); } From 2690520ffcdec768e1e765ad44e5abaafaf16399 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 11 Jan 2018 21:50:38 -0800 Subject: [PATCH 069/191] Add everything shiny checkbox automating the following patch: https://twitter.com/SciresM/status/799853435340423168 --- pk3DS/Subforms/ShinyRate.Designer.cs | 13 ++++++++++++ pk3DS/Subforms/ShinyRate.cs | 30 +++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/pk3DS/Subforms/ShinyRate.Designer.cs b/pk3DS/Subforms/ShinyRate.Designer.cs index 60462c6717..88ea1ce76a 100644 --- a/pk3DS/Subforms/ShinyRate.Designer.cs +++ b/pk3DS/Subforms/ShinyRate.Designer.cs @@ -42,6 +42,7 @@ private void InitializeComponent() this.GB_RerollHelper = new System.Windows.Forms.GroupBox(); this.GB_Rerolls = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Rerolls)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Rate)).BeginInit(); this.GB_RerollHelper.SuspendLayout(); @@ -194,12 +195,23 @@ private void InitializeComponent() this.label1.TabIndex = 13; this.label1.Text = "Note:\r\nThe above reroll count will overwrite the existing code.\r\n\r\nTo revert chan" + "ges, use the button below."; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Location = new System.Drawing.Point(281, 184); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(96, 30); + this.checkBox1.TabIndex = 14; + this.checkBox1.Text = "EVERYTHING\r\nSHINY"; + this.checkBox1.UseVisualStyleBackColor = true; // // ShinyRate // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(384, 271); + this.Controls.Add(this.checkBox1); this.Controls.Add(this.label1); this.Controls.Add(this.GB_Rerolls); this.Controls.Add(this.GB_RerollHelper); @@ -241,5 +253,6 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox GB_RerollHelper; private System.Windows.Forms.GroupBox GB_Rerolls; private System.Windows.Forms.Label label1; + private System.Windows.Forms.CheckBox checkBox1; } } \ No newline at end of file diff --git a/pk3DS/Subforms/ShinyRate.cs b/pk3DS/Subforms/ShinyRate.cs index 25a7715dac..0ff8dcab17 100644 --- a/pk3DS/Subforms/ShinyRate.cs +++ b/pk3DS/Subforms/ShinyRate.cs @@ -52,6 +52,8 @@ public ShinyRate() modified = true; } changeRerolls(null, null); + + CheckAlwaysShiny(); } private readonly List InstructionList = new List(); @@ -83,10 +85,36 @@ public byte[] Bytes } } + private int alwaysIndex; + private void CheckAlwaysShiny() + { + byte[] pattern = {0x00, 0x20, 0x22, 0xE0, 0x02, 0x30, 0x21, 0xE2, 0x03, 0x20, 0x92, 0xE1, 0x1C, 0x00, 0x00}; + int index = alwaysIndex = Util.IndexOfBytes(exefsData, pattern, 0, 0) + pattern.Length; + + if (index < 0) + { + checkBox1.Enabled = checkBox1.Visible = false; + return; + } + + bool original = exefsData[index] == 0x0A; + bool always = exefsData[index] == 0xEA; + + if (!original && !always) // oh no + { + checkBox1.Enabled = checkBox1.Visible = false; + return; + } + + checkBox1.Checked = always; + } + private void B_Cancel_Click(object sender, EventArgs e) => Close(); private void B_Save_Click(object sender, EventArgs e) { writeCodePatch(); + if (checkBox1.Enabled) + exefsData[alwaysIndex] = (byte)(checkBox1.Checked ? 0xEA : 0x0A); File.WriteAllBytes(codebin, exefsData); Close(); } @@ -133,7 +161,7 @@ private void changePercent(object sender, EventArgs e) var inv = (int)Math.Log(1 - (float)pct/100, (float) (bc - 1)/bc); if (pct == 0) pct = 0.00001m; // arbitrary nonzero - L_RerollCount.Text = $"Count: {inv.ToString("0")} = 1:{(int)(1/(pct/100))}"; + L_RerollCount.Text = $"Count: {inv:0} = 1:{(int)(1/(pct/100))}"; } } } \ No newline at end of file From ecef1be042ab9554309c522b8bff9a5a29a00a4e Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 15 Jan 2018 15:38:11 -0500 Subject: [PATCH 070/191] Add static/gift legend-for-legend --- pk3DS.Core/Legality/Legal.cs | 16 ++- .../Gen6/StaticEncounterEditor6.Designer.cs | 17 ++- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 17 ++- pk3DS/Subforms/Gen7/SMTE.cs | 2 +- .../Gen7/StaticEncounterEditor7.Designer.cs | 117 ++++++++++-------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 28 ++++- 6 files changed, 138 insertions(+), 59 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index a9f5c6785e..480b6d89e0 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -302,10 +302,22 @@ public static partial class Legal { 804, 805, 806, 807, }).ToArray(); - public static readonly int[] Legendary_Mythical = + /// + /// All Legendary and Mythical Pokemon. Used for Legendary-for-Legendary replacement. + /// Does not include un-evolved species in the array due to potential error with Force Fully Evolved. + /// + public static readonly int[] Legendary_Mythical_6 = { 144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638, - 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 804, 805, 806, 807 + 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721, }; + public static readonly int[] Legendary_Mythical_SM = Legendary_Mythical_6.Concat(new int[] + { + 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, + }).ToArray(); + public static readonly int[] Legendary_Mythical_USUM = Legendary_Mythical_SM.Concat(new int[] + { + 804, 805, 806, 807 + }).ToArray(); } } diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index 5b0835db6a..bb5fbccbaa 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -67,6 +67,7 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); @@ -305,6 +306,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); @@ -321,7 +323,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(5, 83); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 147); + this.GB_Tweak.Size = new System.Drawing.Size(258, 160); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -518,6 +520,18 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // + // CHK_ReplaceLegend + // + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 140); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); + this.CHK_ReplaceLegend.TabIndex = 304; + this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + // // StaticEncounterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -590,5 +604,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Ability; private System.Windows.Forms.ComboBox CB_Ability; private System.Windows.Forms.CheckBox CHK_RandomAbility; + private System.Windows.Forms.CheckBox CHK_ReplaceLegend; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 9d6bcacb81..6d5c7a168d 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -42,6 +42,7 @@ public StaticEncounterEditor6() private EncounterStatic6[] EncounterData; private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); + private static int[] ReplaceLegend; private readonly string[] ability = { @@ -81,6 +82,8 @@ private void loadData() foreach (var s in ability) CB_Ability.Items.Add(s); foreach (var s in gender) CB_Gender.Items.Add(s); + ReplaceLegend = Legal.Legendary_Mythical_6; + loaded = true; LB_Encounters.SelectedIndex = 0; } @@ -164,9 +167,19 @@ private void B_RandAll_Click(object sender, EventArgs e) for (int i = 0; i < LB_Encounters.Items.Count; i++) { LB_Encounters.SelectedIndex = i; - int species = CB_Species.SelectedIndex; - species = specrand.GetRandomSpecies(species); + + // replace Legendaries with another Legendary + if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(species)) + { + int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); + species = ReplaceLegend[randLegend()]; + } + + // every other entry + else + species = specrand.GetRandomSpecies(species); + CB_Species.SelectedIndex = species; NUD_Form.Value = formrand.GetRandomForme(species); CB_Gender.SelectedIndex = 0; // random diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index b93f9798ae..a4b09adece 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -64,7 +64,7 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) TrainerClasses = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; - ReplaceLegend = Legal.Legendary_Mythical; + ReplaceLegend = Legal.Legendary_Mythical_USUM; RandSettings.GetFormSettings(this, Tab_Misc.Controls); } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 2d5a420968..a67e3af1d4 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -49,6 +49,8 @@ private void InitializeComponent() this.NUD_GLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); + this.L_EGender = new System.Windows.Forms.Label(); + this.NUD_EGender = new System.Windows.Forms.NumericUpDown(); this.CB_EAbility = new System.Windows.Forms.ComboBox(); this.L_EAbility = new System.Windows.Forms.Label(); this.CHK_EIV3 = new System.Windows.Forms.CheckBox(); @@ -98,6 +100,8 @@ private void InitializeComponent() this.NUD_ELevel = new System.Windows.Forms.NumericUpDown(); this.LB_Encounter = new System.Windows.Forms.ListBox(); this.Tab_Trades = new System.Windows.Forms.TabPage(); + this.L_TGender = new System.Windows.Forms.Label(); + this.NUD_TGender = new System.Windows.Forms.NumericUpDown(); this.CB_TAbility = new System.Windows.Forms.ComboBox(); this.L_TAbility = new System.Windows.Forms.Label(); this.CB_TNature = new System.Windows.Forms.ComboBox(); @@ -155,15 +159,13 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.L_EGender = new System.Windows.Forms.Label(); - this.NUD_EGender = new System.Windows.Forms.NumericUpDown(); - this.L_TGender = new System.Windows.Forms.Label(); - this.NUD_TGender = new System.Windows.Forms.NumericUpDown(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).BeginInit(); this.Tab_Encounters.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).BeginInit(); this.GB_EEVs.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).BeginInit(); @@ -182,6 +184,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).BeginInit(); this.Tab_Trades.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).BeginInit(); @@ -195,8 +198,6 @@ private void InitializeComponent() this.Tab_Randomizer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.GB_Tweak.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).BeginInit(); this.SuspendLayout(); // // TC_Tabs @@ -447,6 +448,27 @@ private void InitializeComponent() this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // + // L_EGender + // + this.L_EGender.Location = new System.Drawing.Point(131, 71); + this.L_EGender.Name = "L_EGender"; + this.L_EGender.Size = new System.Drawing.Size(55, 23); + this.L_EGender.TabIndex = 519; + this.L_EGender.Text = "Gender:"; + this.L_EGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_EGender + // + this.NUD_EGender.Location = new System.Drawing.Point(187, 74); + this.NUD_EGender.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.NUD_EGender.Name = "NUD_EGender"; + this.NUD_EGender.Size = new System.Drawing.Size(34, 20); + this.NUD_EGender.TabIndex = 518; + // // CB_EAbility // this.CB_EAbility.FormattingEnabled = true; @@ -1071,6 +1093,27 @@ private void InitializeComponent() this.Tab_Trades.Text = "Trades"; this.Tab_Trades.UseVisualStyleBackColor = true; // + // L_TGender + // + this.L_TGender.Location = new System.Drawing.Point(131, 71); + this.L_TGender.Name = "L_TGender"; + this.L_TGender.Size = new System.Drawing.Size(55, 23); + this.L_TGender.TabIndex = 523; + this.L_TGender.Text = "Gender:"; + this.L_TGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_TGender + // + this.NUD_TGender.Location = new System.Drawing.Point(187, 74); + this.NUD_TGender.Maximum = new decimal(new int[] { + 2, + 0, + 0, + 0}); + this.NUD_TGender.Name = "NUD_TGender"; + this.NUD_TGender.Size = new System.Drawing.Size(34, 20); + this.NUD_TGender.TabIndex = 522; + // // CB_TAbility // this.CB_TAbility.FormattingEnabled = true; @@ -1522,7 +1565,7 @@ private void InitializeComponent() // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(192, 321); + this.B_RandAll.Location = new System.Drawing.Point(192, 330); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(122, 23); this.B_RandAll.TabIndex = 509; @@ -1532,6 +1575,7 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_SpecialMove); this.GB_Tweak.Controls.Add(this.CHK_RandomAura); @@ -1551,7 +1595,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(119, 113); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 193); + this.GB_Tweak.Size = new System.Drawing.Size(258, 205); this.GB_Tweak.TabIndex = 508; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; @@ -1747,7 +1791,7 @@ private void InitializeComponent() // // B_Starters // - this.B_Starters.Location = new System.Drawing.Point(192, 350); + this.B_Starters.Location = new System.Drawing.Point(192, 359); this.B_Starters.Name = "B_Starters"; this.B_Starters.Size = new System.Drawing.Size(122, 23); this.B_Starters.TabIndex = 9; @@ -1775,47 +1819,17 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // L_EGender + // CHK_ReplaceLegend // - this.L_EGender.Location = new System.Drawing.Point(131, 71); - this.L_EGender.Name = "L_EGender"; - this.L_EGender.Size = new System.Drawing.Size(55, 23); - this.L_EGender.TabIndex = 519; - this.L_EGender.Text = "Gender:"; - this.L_EGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_EGender - // - this.NUD_EGender.Location = new System.Drawing.Point(187, 74); - this.NUD_EGender.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.NUD_EGender.Name = "NUD_EGender"; - this.NUD_EGender.Size = new System.Drawing.Size(34, 20); - this.NUD_EGender.TabIndex = 518; - // - // L_TGender - // - this.L_TGender.Location = new System.Drawing.Point(131, 71); - this.L_TGender.Name = "L_TGender"; - this.L_TGender.Size = new System.Drawing.Size(55, 23); - this.L_TGender.TabIndex = 523; - this.L_TGender.Text = "Gender:"; - this.L_TGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // NUD_TGender - // - this.NUD_TGender.Location = new System.Drawing.Point(187, 74); - this.NUD_TGender.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.NUD_TGender.Name = "NUD_TGender"; - this.NUD_TGender.Size = new System.Drawing.Size(34, 20); - this.NUD_TGender.TabIndex = 522; + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 186); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); + this.CHK_ReplaceLegend.TabIndex = 303; + this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -1834,6 +1848,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).EndInit(); this.Tab_Encounters.ResumeLayout(false); this.Tab_Encounters.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).EndInit(); this.GB_EEVs.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).EndInit(); @@ -1853,6 +1868,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).EndInit(); this.Tab_Trades.ResumeLayout(false); this.Tab_Trades.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).EndInit(); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).EndInit(); @@ -1868,8 +1884,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).EndInit(); this.ResumeLayout(false); } @@ -2007,5 +2021,6 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_EGender; private System.Windows.Forms.Label L_TGender; private System.Windows.Forms.NumericUpDown NUD_TGender; + private System.Windows.Forms.CheckBox CHK_ReplaceLegend; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index bfa8a72ab8..4873f955ce 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -20,6 +20,7 @@ public partial class StaticEncounterEditor7 : Form private readonly string[] natures = Main.Config.getText(TextName.Natures); private readonly string[] types = Main.Config.getText(TextName.Types); private readonly int[] oldStarters; + private static int[] ReplaceLegend; private readonly string[] ability = { @@ -134,6 +135,8 @@ public StaticEncounterEditor7(byte[][] infiles) LB_Encounter.SelectedIndex = 0; LB_Trade.SelectedIndex = 0; + ReplaceLegend = Main.Config.USUM ? Legal.Legendary_Mythical_USUM : Legal.Legendary_Mythical_SM; + // Select last tab (Randomization) by default in case info already randomized. TC_Tabs.SelectedIndex = TC_Tabs.TabCount - 1; @@ -506,7 +509,18 @@ private void B_RandAll_Click(object sender, EventArgs e) for (int i = 3; i < Gifts.Length; i++) // Skip Starters { var t = Gifts[i]; - t.Species = specrand.GetRandomSpecies(t.Species); + + // replace Legendaries with another Legendary + if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species)) + { + int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); + t.Species = ReplaceLegend[randLegend()]; + } + + // every other entry + else + t.Species = specrand.GetRandomSpecies(t.Species); + t.Form = formrand.GetRandomForme(t.Species); t.Nature = -1; // random @@ -530,7 +544,17 @@ private void B_RandAll_Click(object sender, EventArgs e) } foreach (EncounterStatic7 t in Encounters) { - t.Species = specrand.GetRandomSpecies(t.Species); + // replace Legendaries with another Legendary + if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species)) + { + int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); + t.Species = ReplaceLegend[randLegend()]; + } + + // every other entry + else + t.Species = specrand.GetRandomSpecies(t.Species); + t.Form = formrand.GetRandomForme(t.Species); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); t.Gender = 0; // random From 3d3f7768a299df2a1602697d28c14bd084ede03a Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 24 Jan 2018 20:38:47 -0500 Subject: [PATCH 071/191] Misc additions --- pk3DS.Core/Legality/Legal.cs | 12 +- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 10 +- pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 130 +++++++---- pk3DS/Subforms/Gen6/GiftEditor6.cs | 18 +- .../Subforms/Gen6/StarterEditor6.Designer.cs | 38 ++-- pk3DS/Subforms/Gen6/StarterEditor6.cs | 12 +- .../Gen6/StaticEncounterEditor6.Designer.cs | 90 +++++--- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 17 +- .../Gen7/StaticEncounterEditor7.Designer.cs | 211 ++++++++++++------ pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 47 +++- 10 files changed, 401 insertions(+), 184 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 480b6d89e0..aa4783ad23 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -275,6 +275,16 @@ public static partial class Legal 490, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 630, 644, 645, 647, 648, 649, 650, 651, 652, }; + public static readonly int[] BasicStarters_6 = + { + 001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147, 152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246, 252, 255, 258, + 265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374, 387, 390, 393, 396, 403, 406, 440, 443, 495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602, + 607, 610, 633, 650, 653, 656, 661, 664, 669, 679, 704, + }; + public static readonly int[] BasicStarters_7 = BasicStarters_6.Concat(new int[] + { + 722, 725, 728, 731, 736, 761, 782, 789 + }).ToArray(); /// /// All final evolutions, excluding Event-exclusive Forms that do not evolve (Pikachu, Floette, etc). Used for forcing fully evolved species. /// Overrides all other randomizer settings, allowing all Generations and Legendary/Mythical Pokemon as well. @@ -313,7 +323,7 @@ public static partial class Legal }; public static readonly int[] Legendary_Mythical_SM = Legendary_Mythical_6.Concat(new int[] { - 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, + 773, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, }).ToArray(); public static readonly int[] Legendary_Mythical_USUM = Legendary_Mythical_SM.Concat(new int[] { diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 186376767d..812971227b 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -190,8 +190,14 @@ private void AddGen6Species(List list) } private void AddGen7Species(List list) { - list.AddRange(Enumerable.Range(722, 67)); // Rowlet - Kommo-o - if (L) list.AddRange(Enumerable.Range(785, 16)); // Tapus, Legends, UBs + list.AddRange(Enumerable.Range(722, 50)); // Rowlet - Pyukumuku + list.AddRange(Enumerable.Range(774, 11)); // Minior - Kommo-o + + if (L) + { + list.AddRange(Enumerable.Range(772, 2)); // Type: Null, Silvally + list.AddRange(Enumerable.Range(785, 16)); // Tapus, Legends, UBs + } if (E) list.AddRange(Enumerable.Range(801, 2)); // Magearna, Marshadow if (MaxSpeciesID == 807) // USUM diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index 10818de666..5c0f02cbed 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -43,6 +43,10 @@ private void InitializeComponent() this.B_RandAll = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.L_Gender = new System.Windows.Forms.Label(); + this.CB_Gender = new System.Windows.Forms.ComboBox(); + this.L_Ability = new System.Windows.Forms.Label(); + this.CB_Ability = new System.Windows.Forms.ComboBox(); this.CB_Nature = new System.Windows.Forms.ComboBox(); this.GB_EIVs = new System.Windows.Forms.GroupBox(); this.L_HP = new System.Windows.Forms.Label(); @@ -61,6 +65,7 @@ private void InitializeComponent() this.tabPage2 = new System.Windows.Forms.TabPage(); this.B_ModifyLevel = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); @@ -78,11 +83,8 @@ private void InitializeComponent() this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.L_Gender = new System.Windows.Forms.Label(); - this.CB_Gender = new System.Windows.Forms.ComboBox(); - this.L_Ability = new System.Windows.Forms.Label(); - this.CB_Ability = new System.Windows.Forms.ComboBox(); - this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); + this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); this.tabControl1.SuspendLayout(); @@ -97,6 +99,7 @@ private void InitializeComponent() this.tabPage2.SuspendLayout(); this.GB_Tweak.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); this.SuspendLayout(); // // B_Cancel @@ -260,6 +263,40 @@ private void InitializeComponent() this.tabPage1.Text = "Editor"; this.tabPage1.UseVisualStyleBackColor = true; // + // L_Gender + // + this.L_Gender.Location = new System.Drawing.Point(9, 96); + this.L_Gender.Name = "L_Gender"; + this.L_Gender.Size = new System.Drawing.Size(55, 23); + this.L_Gender.TabIndex = 532; + this.L_Gender.Text = "Gender:"; + this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Gender + // + this.CB_Gender.FormattingEnabled = true; + this.CB_Gender.Location = new System.Drawing.Point(65, 97); + this.CB_Gender.Name = "CB_Gender"; + this.CB_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Gender.TabIndex = 531; + // + // L_Ability + // + this.L_Ability.Location = new System.Drawing.Point(9, 73); + this.L_Ability.Name = "L_Ability"; + this.L_Ability.Size = new System.Drawing.Size(55, 23); + this.L_Ability.TabIndex = 530; + this.L_Ability.Text = "Ability:"; + this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Ability + // + this.CB_Ability.FormattingEnabled = true; + this.CB_Ability.Location = new System.Drawing.Point(65, 74); + this.CB_Ability.Name = "CB_Ability"; + this.CB_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Ability.TabIndex = 529; + // // CB_Nature // this.CB_Nature.FormattingEnabled = true; @@ -513,6 +550,8 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.NUD_ForceFullyEvolved); + this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); this.GB_Tweak.Controls.Add(this.CHK_AllowMega); @@ -527,13 +566,23 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(5, 71); + this.GB_Tweak.Location = new System.Drawing.Point(5, 57); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 147); + this.GB_Tweak.Size = new System.Drawing.Size(258, 170); this.GB_Tweak.TabIndex = 513; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_RandomAbility + // + this.CHK_RandomAbility.AutoSize = true; + this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 110); + this.CHK_RandomAbility.Name = "CHK_RandomAbility"; + this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); + this.CHK_RandomAbility.TabIndex = 298; + this.CHK_RandomAbility.Text = "Random Abilities (1, 2, or Hidden)"; + this.CHK_RandomAbility.UseVisualStyleBackColor = true; + // // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; @@ -737,49 +786,33 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // L_Gender - // - this.L_Gender.Location = new System.Drawing.Point(9, 96); - this.L_Gender.Name = "L_Gender"; - this.L_Gender.Size = new System.Drawing.Size(55, 23); - this.L_Gender.TabIndex = 532; - this.L_Gender.Text = "Gender:"; - this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // CB_Gender - // - this.CB_Gender.FormattingEnabled = true; - this.CB_Gender.Location = new System.Drawing.Point(65, 97); - this.CB_Gender.Name = "CB_Gender"; - this.CB_Gender.Size = new System.Drawing.Size(121, 21); - this.CB_Gender.TabIndex = 531; - // - // L_Ability - // - this.L_Ability.Location = new System.Drawing.Point(9, 73); - this.L_Ability.Name = "L_Ability"; - this.L_Ability.Size = new System.Drawing.Size(55, 23); - this.L_Ability.TabIndex = 530; - this.L_Ability.Text = "Ability:"; - this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // CB_Ability + // NUD_ForceFullyEvolved // - this.CB_Ability.FormattingEnabled = true; - this.CB_Ability.Location = new System.Drawing.Point(65, 74); - this.CB_Ability.Name = "CB_Ability"; - this.CB_Ability.Size = new System.Drawing.Size(121, 21); - this.CB_Ability.TabIndex = 529; + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 141); + this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.TabIndex = 518; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); // - // CHK_RandomAbility + // CHK_ForceFullyEvolved // - this.CHK_RandomAbility.AutoSize = true; - this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 110); - this.CHK_RandomAbility.Name = "CHK_RandomAbility"; - this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); - this.CHK_RandomAbility.TabIndex = 298; - this.CHK_RandomAbility.Text = "Random Abilities (1, 2, or Hidden)"; - this.CHK_RandomAbility.UseVisualStyleBackColor = true; + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 142); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 517; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; // // GiftEditor6 // @@ -815,6 +848,7 @@ private void InitializeComponent() this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); this.ResumeLayout(false); } @@ -876,5 +910,7 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Ability; private System.Windows.Forms.ComboBox CB_Ability; private System.Windows.Forms.CheckBox CHK_RandomAbility; + private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; + private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index b7b3bdec88..a3797f8a2c 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -59,6 +59,7 @@ public static Dictionary GetMegaDictionary(GameConfig config) private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private readonly string[] natureslist = Main.Config.getText(TextName.Natures); private readonly Dictionary MegaDictionary; + private static int[] FinalEvo; private readonly string[] ability = { @@ -97,6 +98,7 @@ private void loadData() foreach (var s in ability) CB_Ability.Items.Add(s); foreach (var s in gender) CB_Gender.Items.Add(s); + FinalEvo = Legal.FinalEvolutions_6; loaded = true; LB_Gifts.SelectedIndex = 0; @@ -242,11 +244,6 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_AllowMega.Checked) formrand.AllowMega = true; - CB_Species.SelectedIndex = species; - NUD_Form.Value = formrand.GetRandomForme(species); - CB_Gender.SelectedIndex = 0; // random - CB_Nature.SelectedIndex = 0; // random - if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex)) && NUD_Form.Value > 0) NUD_Form.Value = 0; // don't allow Mega Stone Gifts to be form 1 @@ -258,6 +255,17 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) CB_Ability.SelectedIndex = (Util.rand.Next(1, 4)); // 1, 2 , or H + + if (CHK_ForceFullyEvolved.Checked && NUD_Level.Value >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(species)) + { + int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); + species = FinalEvo[randFinalEvo()]; + } + + CB_Species.SelectedIndex = species; + NUD_Form.Value = formrand.GetRandomForme(species); + CB_Gender.SelectedIndex = 0; // random + CB_Nature.SelectedIndex = 0; // random } WinFormsUtil.Alert("Randomized all Gift Pokémon according to specification!"); } diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs index ccbd841350..f1f9d673c4 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs @@ -60,8 +60,8 @@ private void InitializeComponent() this.L_Set4 = new System.Windows.Forms.Label(); this.L_Set2 = new System.Windows.Forms.Label(); this.CHK_Gen = new System.Windows.Forms.CheckBox(); - this.CHK_BST = new System.Windows.Forms.CheckBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.CHK_BasicStarter = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_2)).BeginInit(); @@ -338,7 +338,7 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(717, 317); + this.B_Save.Location = new System.Drawing.Point(711, 331); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(75, 23); this.B_Save.TabIndex = 464; @@ -349,7 +349,7 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(636, 317); + this.B_Cancel.Location = new System.Drawing.Point(711, 309); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(75, 23); this.B_Cancel.TabIndex = 465; @@ -360,7 +360,7 @@ private void InitializeComponent() // B_Randomize // this.B_Randomize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.B_Randomize.Location = new System.Drawing.Point(12, 317); + this.B_Randomize.Location = new System.Drawing.Point(12, 320); this.B_Randomize.Name = "B_Randomize"; this.B_Randomize.Size = new System.Drawing.Size(75, 23); this.B_Randomize.TabIndex = 466; @@ -422,29 +422,29 @@ private void InitializeComponent() this.CHK_Gen.Text = "Keep Same Gen"; this.CHK_Gen.UseVisualStyleBackColor = true; // - // CHK_BST - // - this.CHK_BST.AutoSize = true; - this.CHK_BST.Checked = true; - this.CHK_BST.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BST.Location = new System.Drawing.Point(16, 29); - this.CHK_BST.Name = "CHK_BST"; - this.CHK_BST.Size = new System.Drawing.Size(108, 17); - this.CHK_BST.TabIndex = 472; - this.CHK_BST.Text = "Keep Similar BST"; - this.CHK_BST.UseVisualStyleBackColor = true; - // // groupBox1 // - this.groupBox1.Controls.Add(this.CHK_BST); + this.groupBox1.Controls.Add(this.CHK_BasicStarter); this.groupBox1.Controls.Add(this.CHK_Gen); this.groupBox1.Location = new System.Drawing.Point(93, 306); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(200, 45); + this.groupBox1.Size = new System.Drawing.Size(153, 48); this.groupBox1.TabIndex = 473; this.groupBox1.TabStop = false; this.groupBox1.Text = "Randomizer Settings"; // + // CHK_BasicStarter + // + this.CHK_BasicStarter.AutoSize = true; + this.CHK_BasicStarter.Checked = true; + this.CHK_BasicStarter.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_BasicStarter.Location = new System.Drawing.Point(16, 29); + this.CHK_BasicStarter.Name = "CHK_BasicStarter"; + this.CHK_BasicStarter.Size = new System.Drawing.Size(134, 17); + this.CHK_BasicStarter.TabIndex = 474; + this.CHK_BasicStarter.Text = "Basic Starter Pokémon"; + this.CHK_BasicStarter.UseVisualStyleBackColor = true; + // // StarterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -541,7 +541,7 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Set4; private System.Windows.Forms.Label L_Set2; private System.Windows.Forms.CheckBox CHK_Gen; - private System.Windows.Forms.CheckBox CHK_BST; private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox CHK_BasicStarter; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index 68c984ba8c..1b1a353a8c 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -60,6 +60,7 @@ public StarterEditor6() private byte[] FieldData; private readonly int Count = Main.Config.ORAS ? 4 : 2; private int offset; + private static int[] BasicStarter; private void B_Save_Click(object sender, EventArgs e) { saveData(); @@ -78,6 +79,7 @@ private void loadData() offset = BitConverter.ToInt32(Data, 0xb8); if (!Main.Config.ORAS) // XY have 0x10 bytes of zeroes offset += 0x10; + BasicStarter = Legal.BasicStarters_6; for (int i = 0; i < Count; i++) { Labels[i].Visible = true; @@ -161,15 +163,19 @@ private void B_Randomize_Click(object sender, EventArgs e) L = false, E = false, Shedinja = false, - - rBST = CHK_BST.Checked, }; rand.Initialize(); // Assign Species for (int j = 0; j < 3; j++) { int oldSpecies = BitConverter.ToUInt16(Data, offset + (i * 3 + j) * 0x54); - Choices[i][j].SelectedIndex = rand.GetRandomSpecies(oldSpecies); + if (CHK_BasicStarter.Checked) + { + int basic() => (int)(Util.rnd32() % BasicStarter.Length); + Choices[i][j].SelectedIndex = BasicStarter[basic()]; + } + else + Choices[i][j].SelectedIndex = rand.GetRandomSpecies(oldSpecies); } } diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index bb5fbccbaa..a7a03a76c6 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -51,6 +51,7 @@ private void InitializeComponent() this.tabPage2 = new System.Windows.Forms.TabPage(); this.B_ModifyLevel = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); @@ -67,7 +68,8 @@ private void InitializeComponent() this.CHK_G1 = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); + this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); @@ -75,6 +77,7 @@ private void InitializeComponent() this.tabPage2.SuspendLayout(); this.GB_Tweak.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); this.SuspendLayout(); // // B_Cancel @@ -321,17 +324,31 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G3); this.GB_Tweak.Controls.Add(this.CHK_G2); this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(5, 83); + this.GB_Tweak.Controls.Add(this.NUD_ForceFullyEvolved); + this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); + this.GB_Tweak.Location = new System.Drawing.Point(5, 66); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 160); + this.GB_Tweak.Size = new System.Drawing.Size(258, 185); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // CHK_ReplaceLegend + // + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 141); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); + this.CHK_ReplaceLegend.TabIndex = 304; + this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + // // CHK_RandomAbility // this.CHK_RandomAbility.AutoSize = true; - this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 109); + this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 110); this.CHK_RandomAbility.Name = "CHK_RandomAbility"; this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbility.TabIndex = 303; @@ -341,7 +358,7 @@ private void InitializeComponent() // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 94); + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 95); this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); this.CHK_RemoveShinyLock.TabIndex = 297; @@ -351,7 +368,7 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 125); + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 126); this.CHK_AllowMega.Name = "CHK_AllowMega"; this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); this.CHK_AllowMega.TabIndex = 296; @@ -363,7 +380,7 @@ private void InitializeComponent() this.CHK_Item.AutoSize = true; this.CHK_Item.Checked = true; this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Item.Location = new System.Drawing.Point(9, 79); + this.CHK_Item.Location = new System.Drawing.Point(9, 80); this.CHK_Item.Name = "CHK_Item"; this.CHK_Item.Size = new System.Drawing.Size(119, 17); this.CHK_Item.TabIndex = 295; @@ -373,7 +390,7 @@ private void InitializeComponent() // L_RandOpt // this.L_RandOpt.AutoSize = true; - this.L_RandOpt.Location = new System.Drawing.Point(6, 16); + this.L_RandOpt.Location = new System.Drawing.Point(6, 17); this.L_RandOpt.Name = "L_RandOpt"; this.L_RandOpt.Size = new System.Drawing.Size(105, 13); this.L_RandOpt.TabIndex = 294; @@ -382,7 +399,7 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(128, 64); + this.CHK_BST.Location = new System.Drawing.Point(128, 65); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 288; @@ -394,7 +411,7 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(128, 49); + this.CHK_E.Location = new System.Drawing.Point(128, 50); this.CHK_E.Name = "CHK_E"; this.CHK_E.Size = new System.Drawing.Size(98, 17); this.CHK_E.TabIndex = 287; @@ -406,7 +423,7 @@ private void InitializeComponent() this.CHK_L.AutoSize = true; this.CHK_L.Checked = true; this.CHK_L.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_L.Location = new System.Drawing.Point(128, 34); + this.CHK_L.Location = new System.Drawing.Point(128, 35); this.CHK_L.Name = "CHK_L"; this.CHK_L.Size = new System.Drawing.Size(98, 17); this.CHK_L.TabIndex = 286; @@ -418,7 +435,7 @@ private void InitializeComponent() this.CHK_G6.AutoSize = true; this.CHK_G6.Checked = true; this.CHK_G6.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G6.Location = new System.Drawing.Point(67, 64); + this.CHK_G6.Location = new System.Drawing.Point(67, 65); this.CHK_G6.Name = "CHK_G6"; this.CHK_G6.Size = new System.Drawing.Size(55, 17); this.CHK_G6.TabIndex = 285; @@ -430,7 +447,7 @@ private void InitializeComponent() this.CHK_G5.AutoSize = true; this.CHK_G5.Checked = true; this.CHK_G5.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G5.Location = new System.Drawing.Point(67, 49); + this.CHK_G5.Location = new System.Drawing.Point(67, 50); this.CHK_G5.Name = "CHK_G5"; this.CHK_G5.Size = new System.Drawing.Size(55, 17); this.CHK_G5.TabIndex = 284; @@ -442,7 +459,7 @@ private void InitializeComponent() this.CHK_G4.AutoSize = true; this.CHK_G4.Checked = true; this.CHK_G4.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G4.Location = new System.Drawing.Point(67, 34); + this.CHK_G4.Location = new System.Drawing.Point(67, 35); this.CHK_G4.Name = "CHK_G4"; this.CHK_G4.Size = new System.Drawing.Size(55, 17); this.CHK_G4.TabIndex = 283; @@ -454,7 +471,7 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(9, 64); + this.CHK_G3.Location = new System.Drawing.Point(9, 65); this.CHK_G3.Name = "CHK_G3"; this.CHK_G3.Size = new System.Drawing.Size(55, 17); this.CHK_G3.TabIndex = 282; @@ -466,7 +483,7 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(9, 49); + this.CHK_G2.Location = new System.Drawing.Point(9, 50); this.CHK_G2.Name = "CHK_G2"; this.CHK_G2.Size = new System.Drawing.Size(55, 17); this.CHK_G2.TabIndex = 281; @@ -478,7 +495,7 @@ private void InitializeComponent() this.CHK_G1.AutoSize = true; this.CHK_G1.Checked = true; this.CHK_G1.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G1.Location = new System.Drawing.Point(9, 34); + this.CHK_G1.Location = new System.Drawing.Point(9, 35); this.CHK_G1.Name = "CHK_G1"; this.CHK_G1.Size = new System.Drawing.Size(55, 17); this.CHK_G1.TabIndex = 280; @@ -520,17 +537,33 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // CHK_ReplaceLegend + // NUD_ForceFullyEvolved // - this.CHK_ReplaceLegend.AutoSize = true; - this.CHK_ReplaceLegend.Checked = true; - this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 140); - this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; - this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); - this.CHK_ReplaceLegend.TabIndex = 304; - this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; - this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 158); + this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.TabIndex = 516; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 159); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 515; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; // // StaticEncounterEditor6 // @@ -559,6 +592,7 @@ private void InitializeComponent() this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); this.ResumeLayout(false); } @@ -605,5 +639,7 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_Ability; private System.Windows.Forms.CheckBox CHK_RandomAbility; private System.Windows.Forms.CheckBox CHK_ReplaceLegend; + private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; + private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 6d5c7a168d..71839ee6e3 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -42,6 +42,7 @@ public StaticEncounterEditor6() private EncounterStatic6[] EncounterData; private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); + private static int[] FinalEvo; private static int[] ReplaceLegend; private readonly string[] ability = @@ -81,7 +82,7 @@ private void loadData() foreach (var s in ability) CB_Ability.Items.Add(s); foreach (var s in gender) CB_Gender.Items.Add(s); - + FinalEvo = Legal.FinalEvolutions_6; ReplaceLegend = Legal.Legendary_Mythical_6; loaded = true; @@ -179,10 +180,6 @@ private void B_RandAll_Click(object sender, EventArgs e) // every other entry else species = specrand.GetRandomSpecies(species); - - CB_Species.SelectedIndex = species; - NUD_Form.Value = formrand.GetRandomForme(species); - CB_Gender.SelectedIndex = 0; // random if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -198,6 +195,16 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) CB_Ability.SelectedIndex = (Util.rand.Next(1, 4)); // 1, 2 , or H + + if (CHK_ForceFullyEvolved.Checked && NUD_Level.Value >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(species)) + { + int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); + species = FinalEvo[randFinalEvo()]; + } + + CB_Species.SelectedIndex = species; + NUD_Form.Value = formrand.GetRandomForme(species); + CB_Gender.SelectedIndex = 0; // random } WinFormsUtil.Alert("Randomized all Static Encounters according to specification!"); } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index a67e3af1d4..e6b314784f 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -138,7 +138,8 @@ private void InitializeComponent() this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); - this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.GB_Rand = new System.Windows.Forms.GroupBox(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); this.CHK_SpecialMove = new System.Windows.Forms.CheckBox(); this.CHK_RandomAura = new System.Windows.Forms.CheckBox(); @@ -146,7 +147,6 @@ private void InitializeComponent() this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); this.CHK_G7 = new System.Windows.Forms.CheckBox(); - this.L_RandOpt = new System.Windows.Forms.Label(); this.CHK_BST = new System.Windows.Forms.CheckBox(); this.CHK_E = new System.Windows.Forms.CheckBox(); this.CHK_L = new System.Windows.Forms.CheckBox(); @@ -159,7 +159,11 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); + this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_BasicStarter = new System.Windows.Forms.CheckBox(); + this.CHK_ForceTotem = new System.Windows.Forms.CheckBox(); + this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); @@ -197,7 +201,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_TLevel)).BeginInit(); this.Tab_Randomizer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); + this.GB_Rand.SuspendLayout(); this.GB_Tweak.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); this.SuspendLayout(); // // TC_Tabs @@ -1504,11 +1510,12 @@ private void InitializeComponent() // // Tab_Randomizer // + this.Tab_Randomizer.Controls.Add(this.GB_Tweak); this.Tab_Randomizer.Controls.Add(this.B_ModifyLevel); this.Tab_Randomizer.Controls.Add(this.NUD_LevelBoost); this.Tab_Randomizer.Controls.Add(this.CHK_Level); this.Tab_Randomizer.Controls.Add(this.B_RandAll); - this.Tab_Randomizer.Controls.Add(this.GB_Tweak); + this.Tab_Randomizer.Controls.Add(this.GB_Rand); this.Tab_Randomizer.Controls.Add(this.B_Starters); this.Tab_Randomizer.Location = new System.Drawing.Point(4, 22); this.Tab_Randomizer.Name = "Tab_Randomizer"; @@ -1520,7 +1527,7 @@ private void InitializeComponent() // // B_ModifyLevel // - this.B_ModifyLevel.Location = new System.Drawing.Point(306, 89); + this.B_ModifyLevel.Location = new System.Drawing.Point(306, 49); this.B_ModifyLevel.Name = "B_ModifyLevel"; this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); this.B_ModifyLevel.TabIndex = 512; @@ -1536,7 +1543,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(257, 90); + this.NUD_LevelBoost.Location = new System.Drawing.Point(257, 50); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -1556,7 +1563,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(125, 91); + this.CHK_Level.Location = new System.Drawing.Point(125, 51); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 510; @@ -1565,7 +1572,7 @@ private void InitializeComponent() // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(192, 330); + this.B_RandAll.Location = new System.Drawing.Point(192, 369); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(122, 23); this.B_RandAll.TabIndex = 509; @@ -1573,37 +1580,46 @@ private void InitializeComponent() this.B_RandAll.UseVisualStyleBackColor = true; this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click); // - // GB_Tweak + // GB_Rand + // + this.GB_Rand.Controls.Add(this.CHK_SpecialMove); + this.GB_Rand.Controls.Add(this.CHK_RandomAbility); + this.GB_Rand.Controls.Add(this.CHK_RandomAura); + this.GB_Rand.Controls.Add(this.CHK_AllowMega); + this.GB_Rand.Controls.Add(this.CHK_Item); + this.GB_Rand.Controls.Add(this.CHK_G7); + this.GB_Rand.Controls.Add(this.CHK_BST); + this.GB_Rand.Controls.Add(this.CHK_E); + this.GB_Rand.Controls.Add(this.CHK_L); + this.GB_Rand.Controls.Add(this.CHK_G6); + this.GB_Rand.Controls.Add(this.CHK_G5); + this.GB_Rand.Controls.Add(this.CHK_G4); + this.GB_Rand.Controls.Add(this.CHK_G3); + this.GB_Rand.Controls.Add(this.CHK_G2); + this.GB_Rand.Controls.Add(this.CHK_G1); + this.GB_Rand.Location = new System.Drawing.Point(119, 73); + this.GB_Rand.Name = "GB_Rand"; + this.GB_Rand.Size = new System.Drawing.Size(258, 155); + this.GB_Rand.TabIndex = 508; + this.GB_Rand.TabStop = false; + this.GB_Rand.Text = "Randomizer Options"; // - this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); - this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); - this.GB_Tweak.Controls.Add(this.CHK_SpecialMove); - this.GB_Tweak.Controls.Add(this.CHK_RandomAura); - this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); - this.GB_Tweak.Controls.Add(this.CHK_AllowMega); - this.GB_Tweak.Controls.Add(this.CHK_Item); - this.GB_Tweak.Controls.Add(this.CHK_G7); - this.GB_Tweak.Controls.Add(this.L_RandOpt); - this.GB_Tweak.Controls.Add(this.CHK_BST); - this.GB_Tweak.Controls.Add(this.CHK_E); - this.GB_Tweak.Controls.Add(this.CHK_L); - this.GB_Tweak.Controls.Add(this.CHK_G6); - this.GB_Tweak.Controls.Add(this.CHK_G5); - this.GB_Tweak.Controls.Add(this.CHK_G4); - this.GB_Tweak.Controls.Add(this.CHK_G3); - this.GB_Tweak.Controls.Add(this.CHK_G2); - this.GB_Tweak.Controls.Add(this.CHK_G1); - this.GB_Tweak.Location = new System.Drawing.Point(119, 113); - this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 205); - this.GB_Tweak.TabIndex = 508; - this.GB_Tweak.TabStop = false; - this.GB_Tweak.Text = "Extra Randomization Tweaks"; + // CHK_ReplaceLegend + // + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 15); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); + this.CHK_ReplaceLegend.TabIndex = 303; + this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; // // CHK_RandomAbility // this.CHK_RandomAbility.AutoSize = true; - this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 124); + this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 120); this.CHK_RandomAbility.Name = "CHK_RandomAbility"; this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbility.TabIndex = 302; @@ -1613,7 +1629,7 @@ private void InitializeComponent() // CHK_SpecialMove // this.CHK_SpecialMove.AutoSize = true; - this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 155); + this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 135); this.CHK_SpecialMove.Name = "CHK_SpecialMove"; this.CHK_SpecialMove.Size = new System.Drawing.Size(197, 17); this.CHK_SpecialMove.TabIndex = 301; @@ -1623,7 +1639,7 @@ private void InitializeComponent() // CHK_RandomAura // this.CHK_RandomAura.AutoSize = true; - this.CHK_RandomAura.Location = new System.Drawing.Point(9, 140); + this.CHK_RandomAura.Location = new System.Drawing.Point(9, 105); this.CHK_RandomAura.Name = "CHK_RandomAura"; this.CHK_RandomAura.Size = new System.Drawing.Size(172, 17); this.CHK_RandomAura.TabIndex = 300; @@ -1633,7 +1649,9 @@ private void InitializeComponent() // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(9, 109); + this.CHK_RemoveShinyLock.Checked = true; + this.CHK_RemoveShinyLock.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(6, 79); this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); this.CHK_RemoveShinyLock.TabIndex = 299; @@ -1643,7 +1661,7 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 171); + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 90); this.CHK_AllowMega.Name = "CHK_AllowMega"; this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); this.CHK_AllowMega.TabIndex = 298; @@ -1655,7 +1673,7 @@ private void InitializeComponent() this.CHK_Item.AutoSize = true; this.CHK_Item.Checked = true; this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Item.Location = new System.Drawing.Point(9, 94); + this.CHK_Item.Location = new System.Drawing.Point(9, 75); this.CHK_Item.Name = "CHK_Item"; this.CHK_Item.Size = new System.Drawing.Size(119, 17); this.CHK_Item.TabIndex = 297; @@ -1667,26 +1685,17 @@ private void InitializeComponent() this.CHK_G7.AutoSize = true; this.CHK_G7.Checked = true; this.CHK_G7.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G7.Location = new System.Drawing.Point(9, 79); + this.CHK_G7.Location = new System.Drawing.Point(9, 60); this.CHK_G7.Name = "CHK_G7"; this.CHK_G7.Size = new System.Drawing.Size(55, 17); this.CHK_G7.TabIndex = 296; this.CHK_G7.Text = "Gen 7"; this.CHK_G7.UseVisualStyleBackColor = true; // - // L_RandOpt - // - this.L_RandOpt.AutoSize = true; - this.L_RandOpt.Location = new System.Drawing.Point(6, 16); - this.L_RandOpt.Name = "L_RandOpt"; - this.L_RandOpt.Size = new System.Drawing.Size(105, 13); - this.L_RandOpt.TabIndex = 294; - this.L_RandOpt.Text = "Randomizer Options:"; - // // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(128, 64); + this.CHK_BST.Location = new System.Drawing.Point(128, 45); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 288; @@ -1698,7 +1707,7 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(128, 49); + this.CHK_E.Location = new System.Drawing.Point(128, 30); this.CHK_E.Name = "CHK_E"; this.CHK_E.Size = new System.Drawing.Size(98, 17); this.CHK_E.TabIndex = 287; @@ -1710,7 +1719,7 @@ private void InitializeComponent() this.CHK_L.AutoSize = true; this.CHK_L.Checked = true; this.CHK_L.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_L.Location = new System.Drawing.Point(128, 34); + this.CHK_L.Location = new System.Drawing.Point(128, 15); this.CHK_L.Name = "CHK_L"; this.CHK_L.Size = new System.Drawing.Size(98, 17); this.CHK_L.TabIndex = 286; @@ -1722,7 +1731,7 @@ private void InitializeComponent() this.CHK_G6.AutoSize = true; this.CHK_G6.Checked = true; this.CHK_G6.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G6.Location = new System.Drawing.Point(67, 64); + this.CHK_G6.Location = new System.Drawing.Point(67, 45); this.CHK_G6.Name = "CHK_G6"; this.CHK_G6.Size = new System.Drawing.Size(55, 17); this.CHK_G6.TabIndex = 285; @@ -1734,7 +1743,7 @@ private void InitializeComponent() this.CHK_G5.AutoSize = true; this.CHK_G5.Checked = true; this.CHK_G5.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G5.Location = new System.Drawing.Point(67, 49); + this.CHK_G5.Location = new System.Drawing.Point(67, 30); this.CHK_G5.Name = "CHK_G5"; this.CHK_G5.Size = new System.Drawing.Size(55, 17); this.CHK_G5.TabIndex = 284; @@ -1746,7 +1755,7 @@ private void InitializeComponent() this.CHK_G4.AutoSize = true; this.CHK_G4.Checked = true; this.CHK_G4.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G4.Location = new System.Drawing.Point(67, 34); + this.CHK_G4.Location = new System.Drawing.Point(67, 15); this.CHK_G4.Name = "CHK_G4"; this.CHK_G4.Size = new System.Drawing.Size(55, 17); this.CHK_G4.TabIndex = 283; @@ -1758,7 +1767,7 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(9, 64); + this.CHK_G3.Location = new System.Drawing.Point(9, 45); this.CHK_G3.Name = "CHK_G3"; this.CHK_G3.Size = new System.Drawing.Size(55, 17); this.CHK_G3.TabIndex = 282; @@ -1770,7 +1779,7 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(9, 49); + this.CHK_G2.Location = new System.Drawing.Point(9, 30); this.CHK_G2.Name = "CHK_G2"; this.CHK_G2.Size = new System.Drawing.Size(55, 17); this.CHK_G2.TabIndex = 281; @@ -1782,7 +1791,7 @@ private void InitializeComponent() this.CHK_G1.AutoSize = true; this.CHK_G1.Checked = true; this.CHK_G1.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G1.Location = new System.Drawing.Point(9, 34); + this.CHK_G1.Location = new System.Drawing.Point(9, 15); this.CHK_G1.Name = "CHK_G1"; this.CHK_G1.Size = new System.Drawing.Size(55, 17); this.CHK_G1.TabIndex = 280; @@ -1791,7 +1800,7 @@ private void InitializeComponent() // // B_Starters // - this.B_Starters.Location = new System.Drawing.Point(192, 359); + this.B_Starters.Location = new System.Drawing.Point(192, 398); this.B_Starters.Name = "B_Starters"; this.B_Starters.Size = new System.Drawing.Size(122, 23); this.B_Starters.TabIndex = 9; @@ -1819,17 +1828,70 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_ReplaceLegend + // GB_Tweak // - this.CHK_ReplaceLegend.AutoSize = true; - this.CHK_ReplaceLegend.Checked = true; - this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 186); - this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; - this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); - this.CHK_ReplaceLegend.TabIndex = 303; - this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; - this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); + this.GB_Tweak.Controls.Add(this.NUD_ForceFullyEvolved); + this.GB_Tweak.Controls.Add(this.CHK_ForceTotem); + this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); + this.GB_Tweak.Controls.Add(this.CHK_BasicStarter); + this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); + this.GB_Tweak.Location = new System.Drawing.Point(119, 245); + this.GB_Tweak.Name = "GB_Tweak"; + this.GB_Tweak.Size = new System.Drawing.Size(258, 100); + this.GB_Tweak.TabIndex = 509; + this.GB_Tweak.TabStop = false; + this.GB_Tweak.Text = "Extra Tweaks"; + // + // CHK_BasicStarter + // + this.CHK_BasicStarter.AutoSize = true; + this.CHK_BasicStarter.Checked = true; + this.CHK_BasicStarter.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_BasicStarter.Location = new System.Drawing.Point(6, 31); + this.CHK_BasicStarter.Name = "CHK_BasicStarter"; + this.CHK_BasicStarter.Size = new System.Drawing.Size(217, 17); + this.CHK_BasicStarter.TabIndex = 304; + this.CHK_BasicStarter.Text = "Basic Starter Pokémon with 2 Evolutions"; + this.CHK_BasicStarter.UseVisualStyleBackColor = true; + // + // CHK_ForceTotem + // + this.CHK_ForceTotem.AutoSize = true; + this.CHK_ForceTotem.Location = new System.Drawing.Point(6, 47); + this.CHK_ForceTotem.Name = "CHK_ForceTotem"; + this.CHK_ForceTotem.Size = new System.Drawing.Size(200, 17); + this.CHK_ForceTotem.TabIndex = 305; + this.CHK_ForceTotem.Text = "Force Fully Evolved Totem Pokémon"; + this.CHK_ForceTotem.UseVisualStyleBackColor = true; + // + // NUD_ForceFullyEvolved + // + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 62); + this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.TabIndex = 514; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 63); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 513; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -1882,8 +1944,11 @@ private void InitializeComponent() this.Tab_Randomizer.ResumeLayout(false); this.Tab_Randomizer.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); + this.GB_Rand.ResumeLayout(false); + this.GB_Rand.PerformLayout(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); this.ResumeLayout(false); } @@ -1934,9 +1999,8 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_TRequest; private System.Windows.Forms.Label label1; private System.Windows.Forms.TabPage Tab_Randomizer; - private System.Windows.Forms.GroupBox GB_Tweak; + private System.Windows.Forms.GroupBox GB_Rand; private System.Windows.Forms.CheckBox CHK_G7; - private System.Windows.Forms.Label L_RandOpt; private System.Windows.Forms.CheckBox CHK_BST; private System.Windows.Forms.CheckBox CHK_E; private System.Windows.Forms.CheckBox CHK_L; @@ -2022,5 +2086,10 @@ private void InitializeComponent() private System.Windows.Forms.Label L_TGender; private System.Windows.Forms.NumericUpDown NUD_TGender; private System.Windows.Forms.CheckBox CHK_ReplaceLegend; + private System.Windows.Forms.GroupBox GB_Tweak; + private System.Windows.Forms.CheckBox CHK_ForceTotem; + private System.Windows.Forms.CheckBox CHK_BasicStarter; + private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; + private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 4873f955ce..eacdf5504f 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -20,7 +20,9 @@ public partial class StaticEncounterEditor7 : Form private readonly string[] natures = Main.Config.getText(TextName.Natures); private readonly string[] types = Main.Config.getText(TextName.Types); private readonly int[] oldStarters; + private static int[] FinalEvo; private static int[] ReplaceLegend; + private static int[] BasicStarter; private readonly string[] ability = { @@ -52,6 +54,9 @@ public partial class StaticEncounterEditor7 : Form "All Stats (+3)", }; + private static int[] Totem = { 020, 105, 735, 738, 743, 746, 752, 754, 758, 777, 778, 784 }; // Totem battles + private static int[] UnevolvedLegend = { 772, 789, 803 }; // Type: Null, Cosmog, Poipole gifts + public StaticEncounterEditor7(byte[][] infiles) { InitializeComponent(); @@ -134,8 +139,9 @@ public StaticEncounterEditor7(byte[][] infiles) LB_Gift.SelectedIndex = 0; LB_Encounter.SelectedIndex = 0; LB_Trade.SelectedIndex = 0; - + FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; ReplaceLegend = Main.Config.USUM ? Legal.Legendary_Mythical_USUM : Legal.Legendary_Mythical_SM; + BasicStarter = Legal.BasicStarters_7; // Select last tab (Randomization) by default in case info already randomized. TC_Tabs.SelectedIndex = TC_Tabs.TabCount - 1; @@ -464,7 +470,17 @@ private void B_Starters_Click(object sender, EventArgs e) for (int i = 0; i < 3; i++) { var t = Gifts[i]; - t.Species = specrand.GetRandomSpecies(oldStarters[i]); + + // Pokemon with 2 evolutions + if (CHK_BasicStarter.Checked) + { + int basic() => (int)(Util.rnd32() % BasicStarter.Length); + t.Species = BasicStarter[basic()]; + } + + else + t.Species = specrand.GetRandomSpecies(oldStarters[i]); + t.Form = formrand.GetRandomForme(t.Species); t.Nature = -1; // random @@ -505,13 +521,14 @@ private void B_RandAll_Click(object sender, EventArgs e) var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); + int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); for (int i = 3; i < Gifts.Length; i++) // Skip Starters { var t = Gifts[i]; - // replace Legendaries with another Legendary - if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species)) + // replace Legendaries with another Legendary, including unevolved Legendary gifts + if (CHK_ReplaceLegend.Checked && (ReplaceLegend.Contains(t.Species)) || (UnevolvedLegend.Contains(t.Species))) { int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); t.Species = ReplaceLegend[randLegend()]; @@ -541,6 +558,12 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H + + if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) + { + t.Species = FinalEvo[randFinalEvo()]; + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + } } foreach (EncounterStatic7 t in Encounters) { @@ -551,6 +574,10 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Species = ReplaceLegend[randLegend()]; } + // fully evolved Totems + else if (CHK_ForceTotem.Checked && Totem.Contains(t.Species)) + t.Species = FinalEvo[randFinalEvo()]; + // every other entry else t.Species = specrand.GetRandomSpecies(t.Species); @@ -577,6 +604,12 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2, or H + + if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) + { + t.Species = FinalEvo[randFinalEvo()]; + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + } } foreach (EncounterTrade7 t in Trades) { @@ -596,6 +629,12 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H + + if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) + { + t.Species = FinalEvo[randFinalEvo()]; + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + } } getListBoxEntries(); From 4d8c4a91455b40755be55ab72bbec3bf02500e9e Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sun, 28 Jan 2018 18:03:36 -0500 Subject: [PATCH 072/191] Add Sina/Dexio to important trainers --- pk3DS.Core/Legality/Legal.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index aa4783ad23..8b5057ed63 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -265,15 +265,15 @@ public static partial class Legal public static readonly int[] ImportantTrainers_SM = { 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 129, 131, 132, 138, 144, 146, 149, 152, 153, 154, 155, 156, 158, 159, 160, 164, 167, 185, 215, 216, - 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 371, 372, 392, 396, 398, 400, 401, 403, 405, 409, 410, 413, 414, 415, 416, 417, - 418, 419, 435, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 481, 482, 483, 484, + 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 371, 372, 392, 396, 398, 400, 401, 403, 405, 409, 410, 412, 413, 414, 415, 416, + 417, 418, 419, 435, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 481, 482, 483, 484, }; public static readonly int[] ImportantTrainers_USUM = { - 012, 013, 014, 023, 052, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 185, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, - 238, 239, 240, 241, 350, 351, 352, 356, 358, 359, 371, 372, 396, 398, 401, 405, 409, 410, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 489, - 490, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 630, 644, 645, 647, - 648, 649, 650, 651, 652, + 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 185, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, + 238, 239, 240, 241, 350, 351, 352, 356, 358, 359, 371, 372, 396, 398, 401, 405, 409, 410, 412, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 489, 490, + 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, + 650, 651, 652, }; public static readonly int[] BasicStarters_6 = { From 45d45a649b8d7e49cfee5113fcae8d215d454bc5 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 3 Feb 2018 13:04:49 -0500 Subject: [PATCH 073/191] Add several revisions --- pk3DS.Core/Legality/Legal.cs | 42 ++--- pk3DS/Subforms/Gen6/RSTE.cs | 150 ++++++++++-------- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 78 ++++----- pk3DS/Subforms/Gen7/SMTE.resx | 228 --------------------------- 4 files changed, 145 insertions(+), 353 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 8b5057ed63..c30b606db6 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -66,6 +66,10 @@ public static partial class Legal public static readonly int[] SpecialClasses_ORAS = { #region Classes + 064, // Battle Chatelaine + 065, // Battle Chatelaine + 066, // Battle Chatelaine + 067, // Battle Chatelaine 127, // Pokémon Trainer 128, // Pokémon Trainer 174, // Aqua Leader @@ -228,7 +232,6 @@ public static partial class Legal 078, // Team Flare (Admin) 079, // Team Flare (Grunt) 080, // Team Flare (Grunt) - 081, // Team Flare (Lysandre) 102, // Pokémon Trainer (AZ) 103, // Pokémon Trainer (Calem) 104, // Pokémon Trainer (Serena) @@ -241,39 +244,36 @@ public static partial class Legal 128, // Pokémon Trainer (May) 174, // Aqua Leader (Archie) 178, // Magma Leader (Maxie) - 192, // Pokémon Trainer (Wally) - 219, // Pokémon Trainer (Steven) + 198, // Champion (Steven) 221, // Lorekeeper (Zinnia) 272, // Pokémon Trainer (Wally) }; public static readonly int[] TrainerClasses_AO = { - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, + 064, 065, 066, 067, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, + 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, }; public static readonly int[] Z_Moves = { 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, - 695, 696, 697, 698, 699, 700, 701, 702, 703, - 719, - 723, 724, 725, 726, 727, 728 + 695, 696, 697, 698, 699, 700, 701, 702, 703, 719, 723, 724, 725, 726, 727, 728 }; public static readonly int[] ImportantTrainers_SM = { - 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 129, 131, 132, 138, 144, 146, 149, 152, 153, 154, 155, 156, 158, 159, 160, 164, 167, 185, 215, 216, - 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 371, 372, 392, 396, 398, 400, 401, 403, 405, 409, 410, 412, 413, 414, 415, 416, - 417, 418, 419, 435, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 481, 482, 483, 484, + 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 129, 131, 132, 138, 144, 146, 149, 152, 153, 154, 155, 156, 158, 159, 160, 164, 167, 215, 216, 217, 218, 219, 220, 221, + 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 392, 396, 398, 400, 401, 403, 405, 409, 410, 412, 413, 414, 415, 416, 417, 418, 419, 435, 438, 439, 440, + 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 481, 482, 483, 484, }; public static readonly int[] ImportantTrainers_USUM = { - 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 081, 082, 083, 084, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 185, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, - 238, 239, 240, 241, 350, 351, 352, 356, 358, 359, 371, 372, 396, 398, 401, 405, 409, 410, 412, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 489, 490, - 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, - 650, 651, 652, + 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, + 241, 350, 351, 352, 356, 358, 359, 396, 398, 401, 405, 409, 410, 412, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 489, 490, 494, 495, 496, + 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, 650, + 651, 652, }; public static readonly int[] BasicStarters_6 = { @@ -285,6 +285,7 @@ public static partial class Legal { 722, 725, 728, 731, 736, 761, 782, 789 }).ToArray(); + /// /// All final evolutions, excluding Event-exclusive Forms that do not evolve (Pikachu, Floette, etc). Used for forcing fully evolved species. /// Overrides all other randomizer settings, allowing all Generations and Legendary/Mythical Pokemon as well. @@ -305,13 +306,14 @@ public static partial class Legal }; public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[] { - 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, - 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, + 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787, + 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, }).ToArray(); public static readonly int[] FinalEvolutions_USUM = FinalEvolutions_SM.Concat(new int[] { 804, 805, 806, 807, }).ToArray(); + /// /// All Legendary and Mythical Pokemon. Used for Legendary-for-Legendary replacement. /// Does not include un-evolved species in the array due to potential error with Force Fully Evolved. diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 1918cce09b..a34fa8cbc1 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -758,6 +758,7 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) rClass // Classes selected to be randomized && (!rOnlySingles || t.BattleType == 0) // Nonsingles only get changed if rOnlySingles && !rIgnoreClass.Contains(t.Class) // Current class isn't a special class + && Main.Config.XY ) { int randClass() => (int)(rnd32() % trClass.Length); @@ -765,12 +766,11 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) // Ensure the Random Class isn't an exclusive class while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~")); // don't allow disallowed classes t.Class = rv; - - if (Main.Config.ORAS && t.Class <= 126) // 0 to 126 from XY, re-randomize to something from ORAS - { - int fixClass() => (int)(rnd32() % rTrainerClasses.Length); - t.Class = rTrainerClasses[fixClass()]; - } + } + else if (Main.Config.ORAS) // don't allow XY-only classes + { + int randClass() => (int)(rnd32() % rTrainerClasses.Length); + t.Class = rTrainerClasses[randClass()]; } } private static void RandomizeTrainerPrizeItem(trdata6 t) @@ -795,49 +795,54 @@ private string[] GetTagsORAS() { string[] tags = Enumerable.Repeat("", trdata.Length).ToArray(); ImportantTrainers = true; - //Rival Battles + + // Rival Battles TagTrainer(tags, "RIVAL1", 289, 292, 295, 298, 527, 530, 674, 677, 699, 906); // Rival w/ Grass Starter TagTrainer(tags, "RIVAL2", 290, 293, 296, 299, 528, 531, 675, 678, 700, 907); // Rival w/ Fire Starter TagTrainer(tags, "RIVAL3", 291, 294, 297, 300, 529, 532, 676, 679, 701, 908); // Rival w/ Water Starter - //Aqua Admins - TagTrainer(tags, "AQUA1", 178, 231, 266); // Archie - TagTrainer(tags, "AQUA2", 683, 684, 685, 686, 687); // Matt - TagTrainer(tags, "AQUA3", 688, 689, 690); // Shelly - - //Magma Admins - TagTrainer(tags, "MAGMA1", 235, 236, 271); // Maxie - TagTrainer(tags, "MAGMA2", 694, 695, 696, 697, 698); // Courney - TagTrainer(tags, "MAGMA3", 691, 692, 693); // Tabitha - - //Gym Leaders - TagTrainer(tags, "GYM1", 561); // Roxanne - TagTrainer(tags, "GYM2", 563); // Brawly - TagTrainer(tags, "GYM3", 567); // Wattson - TagTrainer(tags, "GYM4", 569); // Flannery - TagTrainer(tags, "GYM5", 570); // Norman - TagTrainer(tags, "GYM6", 571); // Winona - TagTrainer(tags, "GYM7", 552); // Liza & Tate - TagTrainer(tags, "GYM8", 572, 943); // Wallace - - //Elite 4 - TagTrainer(tags, "ELITE1", 553, 909); // Sidney - TagTrainer(tags, "ELITE2", 554, 910); // Phoebe - TagTrainer(tags, "ELITE3", 555, 911); // Glacia - TagTrainer(tags, "ELITE4", 556, 912); // Drake + // Aqua Admins + TagTrainer(tags, "AQUA1", 178, 231, 266); // Archie + TagTrainer(tags, "AQUA2", 683, 684, 685, 686, 687); // Matt + TagTrainer(tags, "AQUA3", 688, 689, 690); // Shelly + + // Magma Admins + TagTrainer(tags, "MAGMA1", 235, 236, 271); // Maxie + TagTrainer(tags, "MAGMA2", 694, 695, 696, 697, 698); // Courney + TagTrainer(tags, "MAGMA3", 691, 692, 693); // Tabitha + + // Gym Leaders + TagTrainer(tags, "GYM1", 561); // Roxanne + TagTrainer(tags, "GYM2", 563); // Brawly + TagTrainer(tags, "GYM3", 567); // Wattson + TagTrainer(tags, "GYM4", 569); // Flannery + TagTrainer(tags, "GYM5", 570); // Norman + TagTrainer(tags, "GYM6", 571); // Winona + TagTrainer(tags, "GYM7", 552); // Liza & Tate + TagTrainer(tags, "GYM8", 572, 943); // Wallace + + // Elite Four + TagTrainer(tags, "ELITE1", 553, 909); // Sidney + TagTrainer(tags, "ELITE2", 554, 910); // Phoebe + TagTrainer(tags, "ELITE3", 555, 911); // Glacia + TagTrainer(tags, "ELITE4", 556, 912); // Drake TagTrainer(tags, "CHAMPION", 557, 680, 913, 942); // Champion Steven - //Wally + // Wally TagTrainer(tags, "WALLY", 518, 583, 944, 945, 946, 947); - //Zinnia + // Zinnia TagTrainer(tags, "LOREKEEPER", 713, 898); + // Aarune + TagTrainer(tags, "EXPERT", 856, 857); + ImportantTrainers = false; TagTrainer(tags, "RIVAL1", 1, 4); // Rival w/ Grass Starter TagTrainer(tags, "RIVAL2", 2, 5); // Rival w/ Fire Starter TagTrainer(tags, "RIVAL3", 3, 6); // Rival w/ Water Starter - //Gym Trainers (Tagged in order of appearance on Bulbapedia's lists) + + // Gym Trainers (Tagged in order of appearance on Bulbapedia's lists) if (rTypeGymTrainers) { TagTrainer(tags, "GYM1", 562, 22, 667); @@ -855,49 +860,62 @@ private string[] GetTagsXY() { string[] tags = Enumerable.Repeat("", trdata.Length).ToArray(); ImportantTrainers = true; - //Rival Battles + + // Rival Battles TagTrainer(tags, "RIVAL1", 130, 184, 329, 332, 335, 338, 341, 435, 519, 604, 575, 578, 581, 584, 587, 590, 593, 596, 599, 607); // Rival w/ Fire Starter TagTrainer(tags, "RIVAL2", 131, 185, 330, 333, 336, 339, 342, 436, 520, 605, 576, 579, 582, 585, 588, 591, 594, 597, 600, 608); // Rival w/ Water Starter TagTrainer(tags, "RIVAL3", 132, 186, 331, 334, 337, 340, 343, 437, 521, 606, 577, 580, 583, 586, 589, 592, 595, 598, 601, 609); // Rival w/ Grass Starter - //Important Flare Members - TagTrainer(tags, "FLAREBOSS", 303, 525, 526); // Lysandre - TagTrainer(tags, "FLARE1", 175, 344); // Aliana - TagTrainer(tags, "FLARE2", 350, 351); // Bryony - TagTrainer(tags, "FLARE3", 348, 349); // Celosia - TagTrainer(tags, "FLARE4", 346, 347); // Mable - TagTrainer(tags, "FLARE5", 345); // Xerosic - - //Gym Leaders - TagTrainer(tags, "GYM1", 6, 254, 262); // Viola - TagTrainer(tags, "GYM2", 76, 261, 279); // Grant - TagTrainer(tags, "GYM3", 21, 188, 255, 263, 613); // Korrina - TagTrainer(tags, "GYM4", 22, 256, 264); // Ramos - TagTrainer(tags, "GYM5", 23, 257, 265); // Clemont - TagTrainer(tags, "GYM6", 24, 258, 266); // Valerie - TagTrainer(tags, "GYM7", 25, 259, 267); // Olympia - TagTrainer(tags, "GYM8", 26, 260, 268); // Wulfric - - //Elite 4 - TagTrainer(tags, "ELITE1", 269, 273, 507); // Malva - TagTrainer(tags, "ELITE2", 271, 275); // Siebold - TagTrainer(tags, "ELITE3", 187, 272); // Wikstrom - TagTrainer(tags, "ELITE4", 270, 274); // Drasna - TagTrainer(tags, "CHAMPION", 276, 277); // Champion Diantha - - //"Friends" - TagTrainer(tags, "SHAUNA", 137, 138, 139, 321, 322, 323); + // Team Flare Admins + TagTrainer(tags, "FLAREBOSS", 303, 525, 526); // Lysandre + TagTrainer(tags, "FLARE1", 175, 344); // Aliana + TagTrainer(tags, "FLARE2", 350, 351); // Bryony + TagTrainer(tags, "FLARE3", 348, 349); // Celosia + TagTrainer(tags, "FLARE4", 346, 347); // Mable + TagTrainer(tags, "FLARE5", 345); // Xerosic + + // Gym Leaders + TagTrainer(tags, "GYM1", 6, 254, 262); // Viola + TagTrainer(tags, "GYM2", 76, 261, 279); // Grant + TagTrainer(tags, "GYM3", 21, 255, 263, 613); // Korrina + TagTrainer(tags, "GYM4", 22, 256, 264); // Ramos + TagTrainer(tags, "GYM5", 23, 257, 265); // Clemont + TagTrainer(tags, "GYM6", 24, 258, 266); // Valerie + TagTrainer(tags, "GYM7", 25, 259, 267); // Olympia + TagTrainer(tags, "GYM8", 26, 260, 268); // Wulfric + + // Elite Four + TagTrainer(tags, "ELITE1", 269, 273, 507); // Malva + TagTrainer(tags, "ELITE2", 271, 275); // Siebold + TagTrainer(tags, "ELITE3", 187, 272); // Wikstrom + TagTrainer(tags, "ELITE4", 270, 274); // Drasna + TagTrainer(tags, "CHAMPION", 276, 277); // Champion Diantha + + // Friends + TagTrainer(tags, "SHAUNA", 321, 322, 323); TagTrainer(tags, "TREVOR", 325, 439); TagTrainer(tags, "TIERNO", 324, 438, 573); - //Prof + // Professor TagTrainer(tags, "PROFESSOR", 327, 328); - //Suspicious Trainer ??? + // Suspicious Trainer ??? TagTrainer(tags, "ESSENTIA", 503, 504, 505, 511, 512, 513, 514, 515); // Emma + // AZ + TagTrainer(tags, "AZ", 602); + + // Battle Chatelaines + TagTrainer(tags, "CHATELAINE1", 559); // Nita + TagTrainer(tags, "CHATELAINE2", 560); // Evelyn + TagTrainer(tags, "CHATELAINE3", 561); // Dana + TagTrainer(tags, "CHATELAINE4", 562); // Morgan + ImportantTrainers = false; - //Gym Trainers (Tagged in order of appearance on Bulbapedia's lists) + TagTrainer(tags, "SHAUNA", 137, 138, 139); + TagTrainer(tags, "GYM3", 188); + + // Gym Trainers (Tagged in order of appearance on Bulbapedia's lists) if (rTypeGymTrainers) { TagTrainer(tags, "GYM1", 39, 40, 48); diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index d35c3288e6..c7d9a17885 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -182,6 +182,8 @@ private void InitializeComponent() this.CHK_RandomItems = new System.Windows.Forms.CheckBox(); this.CHK_STAB = new System.Windows.Forms.CheckBox(); this.Tab_Trainer1 = new System.Windows.Forms.TabPage(); + this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.CHK_6PKM = new System.Windows.Forms.CheckBox(); this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); @@ -193,8 +195,6 @@ private void InitializeComponent() this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); - this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); - this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -2038,11 +2038,37 @@ private void InitializeComponent() this.Tab_Trainer1.Text = "Trainer"; this.Tab_Trainer1.UseVisualStyleBackColor = true; // + // CHK_ReplaceMega + // + this.CHK_ReplaceMega.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ReplaceMega.AutoSize = true; + this.CHK_ReplaceMega.Checked = true; + this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceMega.Location = new System.Drawing.Point(6, 121); + this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; + this.CHK_ReplaceMega.Size = new System.Drawing.Size(196, 17); + this.CHK_ReplaceMega.TabIndex = 343; + this.CHK_ReplaceMega.Text = "Ensure Post-Game Mega Evolutions"; + this.CHK_ReplaceMega.UseVisualStyleBackColor = true; + // + // CHK_ReplaceLegend + // + this.CHK_ReplaceLegend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 47); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(257, 17); + this.CHK_ReplaceLegend.TabIndex = 342; + this.CHK_ReplaceLegend.Text = "Team Rainbow Rocket Legendary-for-Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + // // CHK_6PKM // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(6, 104); + this.CHK_6PKM.Location = new System.Drawing.Point(6, 106); this.CHK_6PKM.Name = "CHK_6PKM"; this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 341; @@ -2051,7 +2077,7 @@ private void InitializeComponent() // // NUD_ForceFullyEvolved // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 71); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 73); this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { 1, 0, @@ -2070,7 +2096,7 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 73); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 75); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); this.CHK_ForceFullyEvolved.TabIndex = 339; @@ -2079,7 +2105,7 @@ private void InitializeComponent() // // L_MinPKM // - this.L_MinPKM.Location = new System.Drawing.Point(191, 6); + this.L_MinPKM.Location = new System.Drawing.Point(191, 0); this.L_MinPKM.Name = "L_MinPKM"; this.L_MinPKM.Size = new System.Drawing.Size(60, 20); this.L_MinPKM.TabIndex = 338; @@ -2088,7 +2114,7 @@ private void InitializeComponent() // // L_MaxPKM // - this.L_MaxPKM.Location = new System.Drawing.Point(191, 28); + this.L_MaxPKM.Location = new System.Drawing.Point(191, 22); this.L_MaxPKM.Name = "L_MaxPKM"; this.L_MaxPKM.Size = new System.Drawing.Size(60, 20); this.L_MaxPKM.TabIndex = 337; @@ -2097,7 +2123,7 @@ private void InitializeComponent() // // NUD_RMin // - this.NUD_RMin.Location = new System.Drawing.Point(257, 8); + this.NUD_RMin.Location = new System.Drawing.Point(257, 2); this.NUD_RMin.Maximum = new decimal(new int[] { 6, 0, @@ -2119,7 +2145,7 @@ private void InitializeComponent() // // NUD_RMax // - this.NUD_RMax.Location = new System.Drawing.Point(257, 30); + this.NUD_RMax.Location = new System.Drawing.Point(257, 24); this.NUD_RMax.Maximum = new decimal(new int[] { 6, 0, @@ -2143,7 +2169,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 89); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 91); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 333; @@ -2156,7 +2182,7 @@ private void InitializeComponent() this.CHK_TypeTheme.AutoSize = true; this.CHK_TypeTheme.Checked = true; this.CHK_TypeTheme.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 38); + this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 32); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); this.CHK_TypeTheme.TabIndex = 329; @@ -2169,7 +2195,7 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass.AutoSize = true; this.CHK_IgnoreSpecialClass.Checked = true; this.CHK_IgnoreSpecialClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(6, 23); + this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(6, 17); this.CHK_IgnoreSpecialClass.Name = "CHK_IgnoreSpecialClass"; this.CHK_IgnoreSpecialClass.Size = new System.Drawing.Size(133, 17); this.CHK_IgnoreSpecialClass.TabIndex = 327; @@ -2182,7 +2208,7 @@ private void InitializeComponent() this.CHK_RandomClass.AutoSize = true; this.CHK_RandomClass.Checked = true; this.CHK_RandomClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomClass.Location = new System.Drawing.Point(6, 8); + this.CHK_RandomClass.Location = new System.Drawing.Point(6, 2); this.CHK_RandomClass.Name = "CHK_RandomClass"; this.CHK_RandomClass.Size = new System.Drawing.Size(141, 17); this.CHK_RandomClass.TabIndex = 326; @@ -2190,32 +2216,6 @@ private void InitializeComponent() this.CHK_RandomClass.UseVisualStyleBackColor = true; this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); // - // CHK_ReplaceLegend - // - this.CHK_ReplaceLegend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_ReplaceLegend.AutoSize = true; - this.CHK_ReplaceLegend.Checked = true; - this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 53); - this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; - this.CHK_ReplaceLegend.Size = new System.Drawing.Size(257, 17); - this.CHK_ReplaceLegend.TabIndex = 342; - this.CHK_ReplaceLegend.Text = "Team Rainbow Rocket Legendary-for-Legendary"; - this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; - // - // CHK_ReplaceMega - // - this.CHK_ReplaceMega.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_ReplaceMega.AutoSize = true; - this.CHK_ReplaceMega.Checked = true; - this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceMega.Location = new System.Drawing.Point(6, 119); - this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; - this.CHK_ReplaceMega.Size = new System.Drawing.Size(196, 17); - this.CHK_ReplaceMega.TabIndex = 343; - this.CHK_ReplaceMega.Text = "Ensure Post-Game Mega Evolutions"; - this.CHK_ReplaceMega.UseVisualStyleBackColor = true; - // // SMTE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/pk3DS/Subforms/Gen7/SMTE.resx b/pk3DS/Subforms/Gen7/SMTE.resx index 05589a384b..0161958b99 100644 --- a/pk3DS/Subforms/Gen7/SMTE.resx +++ b/pk3DS/Subforms/Gen7/SMTE.resx @@ -150,54 +150,12 @@ True - - True - - - True - - - True - - - True - True True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - True @@ -213,12 +171,6 @@ True - - True - - - True - True @@ -228,12 +180,6 @@ True - - True - - - True - True @@ -243,12 +189,6 @@ True - - True - - - True - True @@ -258,12 +198,6 @@ True - - True - - - True - True @@ -273,12 +207,6 @@ True - - True - - - True - True @@ -288,12 +216,6 @@ True - - True - - - True - True @@ -303,66 +225,18 @@ True - - True - - - True - True True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - True True - - True - - - True - - - True - - - True - True @@ -387,18 +261,6 @@ True - - True - - - True - - - True - - - True - True @@ -414,18 +276,6 @@ True - - True - - - True - - - True - - - True - True @@ -441,18 +291,6 @@ True - - True - - - True - - - True - - - True - True @@ -468,18 +306,6 @@ True - - True - - - True - - - True - - - True - True @@ -495,18 +321,6 @@ True - - True - - - True - - - True - - - True - True @@ -522,18 +336,6 @@ True - - True - - - True - - - True - - - True - True @@ -546,15 +348,6 @@ True - - True - - - True - - - True - True @@ -564,33 +357,12 @@ True - - True - - - True - True True - - True - - - True - - - True - - - True - - - True - True From 98469c78574bfe634f622694fdc65f74649198b8 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 5 Feb 2018 01:03:33 -0500 Subject: [PATCH 074/191] Add remove trade evo option --- pk3DS.Core/Randomizers/EvolutionRandomizer.cs | 46 ++++ .../Gen6/EvolutionEditor6.Designer.cs | 221 +++++++++--------- pk3DS/Subforms/Gen6/EvolutionEditor6.cs | 28 ++- .../Gen7/EvolutionEditor7.Designer.cs | 23 +- pk3DS/Subforms/Gen7/EvolutionEditor7.cs | 26 ++- 5 files changed, 218 insertions(+), 126 deletions(-) diff --git a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs index 54e6153998..d677e2c147 100644 --- a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs +++ b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs @@ -26,6 +26,15 @@ public void Execute() } } + public void ExecuteTrade() + { + for (var i = 0; i < Evolutions.Length; i++) + { + var evo = Evolutions[i]; + Trade(evo, i); + } + } + private void Randomize(EvolutionSet evo, int i) { var evos = evo.PossibleEvolutions; @@ -35,5 +44,42 @@ private void Randomize(EvolutionSet evo, int i) v.Species = Randomizer.GetRandomSpecies(v.Species, i); } } + + private void Trade(EvolutionSet evo, int i) + { + var evos = evo.PossibleEvolutions; + foreach (EvolutionMethod v in evos) + { + if ((Config.XY || Config.ORAS) && v.Method == 5) // Gen 6 uses Argument rather than Level + { + if (i == 708 || i == 710) // Phantump/Pumpkaboo + v.Argument = 20; + else + v.Argument = 30; + v.Method = 4; // trade -> level up + } + + if ((Config.SM || Config.USUM) && v.Method == 5) + { + if (i == 708 || i == 710 || i == 876 || i == 877 | i == 878) // Phantump/Pumpkaboo forms + v.Level = 20; + else + v.Level = 30; + v.Method = 4; // trade -> level up + } + + if (v.Method == 6) // trade with held item -> level up with held item + v.Method = 19; + + if (v.Method == 7) // trade for opposite -> level up with party + { + if (i == 588) + v.Argument = 616; // Karrablast with Shelmet + if (i == 616) + v.Argument = 588; // Shelmet with Karrablast + v.Method = 22; + } + } + } } } diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs index df6c75e93f..e062fd5333 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs @@ -34,32 +34,24 @@ private void InitializeComponent() this.CB_M1 = new System.Windows.Forms.ComboBox(); this.L_M1 = new System.Windows.Forms.Label(); this.CB_I1 = new System.Windows.Forms.ComboBox(); - this.CB_P1 = new System.Windows.Forms.ComboBox(); - this.CB_P2 = new System.Windows.Forms.ComboBox(); this.CB_I2 = new System.Windows.Forms.ComboBox(); this.L_M2 = new System.Windows.Forms.Label(); this.CB_M2 = new System.Windows.Forms.ComboBox(); - this.CB_P3 = new System.Windows.Forms.ComboBox(); this.CB_I3 = new System.Windows.Forms.ComboBox(); this.L_M3 = new System.Windows.Forms.Label(); this.CB_M3 = new System.Windows.Forms.ComboBox(); - this.CB_P4 = new System.Windows.Forms.ComboBox(); this.CB_I4 = new System.Windows.Forms.ComboBox(); this.L_M4 = new System.Windows.Forms.Label(); this.CB_M4 = new System.Windows.Forms.ComboBox(); - this.CB_P5 = new System.Windows.Forms.ComboBox(); this.CB_I5 = new System.Windows.Forms.ComboBox(); this.L_M5 = new System.Windows.Forms.Label(); this.CB_M5 = new System.Windows.Forms.ComboBox(); - this.CB_P8 = new System.Windows.Forms.ComboBox(); this.CB_I8 = new System.Windows.Forms.ComboBox(); this.L_M8 = new System.Windows.Forms.Label(); this.CB_M8 = new System.Windows.Forms.ComboBox(); - this.CB_P7 = new System.Windows.Forms.ComboBox(); this.CB_I7 = new System.Windows.Forms.ComboBox(); this.L_M7 = new System.Windows.Forms.Label(); this.CB_M7 = new System.Windows.Forms.ComboBox(); - this.CB_P6 = new System.Windows.Forms.ComboBox(); this.CB_I6 = new System.Windows.Forms.ComboBox(); this.L_M6 = new System.Windows.Forms.Label(); this.CB_M6 = new System.Windows.Forms.ComboBox(); @@ -77,6 +69,15 @@ private void InitializeComponent() this.CHK_BST = new System.Windows.Forms.CheckBox(); this.CHK_Type = new System.Windows.Forms.CheckBox(); this.CHK_Exp = new System.Windows.Forms.CheckBox(); + this.B_Trade = new System.Windows.Forms.Button(); + this.CB_P8 = new System.Windows.Forms.ComboBox(); + this.CB_P7 = new System.Windows.Forms.ComboBox(); + this.CB_P6 = new System.Windows.Forms.ComboBox(); + this.CB_P5 = new System.Windows.Forms.ComboBox(); + this.CB_P4 = new System.Windows.Forms.ComboBox(); + this.CB_P3 = new System.Windows.Forms.ComboBox(); + this.CB_P2 = new System.Windows.Forms.ComboBox(); + this.CB_P1 = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_4)).BeginInit(); @@ -93,7 +94,7 @@ private void InitializeComponent() this.CB_Species.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Species.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Species.FormattingEnabled = true; - this.CB_Species.Location = new System.Drawing.Point(66, 12); + this.CB_Species.Location = new System.Drawing.Point(58, 12); this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; @@ -102,7 +103,7 @@ private void InitializeComponent() // L_Species // this.L_Species.AutoSize = true; - this.L_Species.Location = new System.Drawing.Point(12, 15); + this.L_Species.Location = new System.Drawing.Point(8, 15); this.L_Species.Name = "L_Species"; this.L_Species.Size = new System.Drawing.Size(48, 13); this.L_Species.TabIndex = 2; @@ -110,7 +111,7 @@ private void InitializeComponent() // // B_Dump // - this.B_Dump.Location = new System.Drawing.Point(193, 11); + this.B_Dump.Location = new System.Drawing.Point(183, 11); this.B_Dump.Name = "B_Dump"; this.B_Dump.Size = new System.Drawing.Size(59, 23); this.B_Dump.TabIndex = 5; @@ -150,26 +151,6 @@ private void InitializeComponent() this.CB_I1.TabIndex = 9; this.CB_I1.SelectedIndexChanged += new System.EventHandler(this.changeInto); // - // CB_P1 - // - this.CB_P1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P1.FormattingEnabled = true; - this.CB_P1.Location = new System.Drawing.Point(79, 69); - this.CB_P1.Name = "CB_P1"; - this.CB_P1.Size = new System.Drawing.Size(121, 21); - this.CB_P1.TabIndex = 10; - // - // CB_P2 - // - this.CB_P2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P2.FormattingEnabled = true; - this.CB_P2.Location = new System.Drawing.Point(79, 123); - this.CB_P2.Name = "CB_P2"; - this.CB_P2.Size = new System.Drawing.Size(121, 21); - this.CB_P2.TabIndex = 16; - // // CB_I2 // this.CB_I2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; @@ -202,16 +183,6 @@ private void InitializeComponent() this.CB_M2.TabIndex = 12; this.CB_M2.SelectedIndexChanged += new System.EventHandler(this.changeMethod); // - // CB_P3 - // - this.CB_P3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P3.FormattingEnabled = true; - this.CB_P3.Location = new System.Drawing.Point(79, 177); - this.CB_P3.Name = "CB_P3"; - this.CB_P3.Size = new System.Drawing.Size(121, 21); - this.CB_P3.TabIndex = 22; - // // CB_I3 // this.CB_I3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; @@ -244,16 +215,6 @@ private void InitializeComponent() this.CB_M3.TabIndex = 18; this.CB_M3.SelectedIndexChanged += new System.EventHandler(this.changeMethod); // - // CB_P4 - // - this.CB_P4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P4.FormattingEnabled = true; - this.CB_P4.Location = new System.Drawing.Point(79, 231); - this.CB_P4.Name = "CB_P4"; - this.CB_P4.Size = new System.Drawing.Size(121, 21); - this.CB_P4.TabIndex = 28; - // // CB_I4 // this.CB_I4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; @@ -286,16 +247,6 @@ private void InitializeComponent() this.CB_M4.TabIndex = 24; this.CB_M4.SelectedIndexChanged += new System.EventHandler(this.changeMethod); // - // CB_P5 - // - this.CB_P5.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P5.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P5.FormattingEnabled = true; - this.CB_P5.Location = new System.Drawing.Point(79, 285); - this.CB_P5.Name = "CB_P5"; - this.CB_P5.Size = new System.Drawing.Size(121, 21); - this.CB_P5.TabIndex = 34; - // // CB_I5 // this.CB_I5.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; @@ -328,16 +279,6 @@ private void InitializeComponent() this.CB_M5.TabIndex = 30; this.CB_M5.SelectedIndexChanged += new System.EventHandler(this.changeMethod); // - // CB_P8 - // - this.CB_P8.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P8.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P8.FormattingEnabled = true; - this.CB_P8.Location = new System.Drawing.Point(79, 447); - this.CB_P8.Name = "CB_P8"; - this.CB_P8.Size = new System.Drawing.Size(121, 21); - this.CB_P8.TabIndex = 52; - // // CB_I8 // this.CB_I8.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; @@ -370,16 +311,6 @@ private void InitializeComponent() this.CB_M8.TabIndex = 48; this.CB_M8.SelectedIndexChanged += new System.EventHandler(this.changeMethod); // - // CB_P7 - // - this.CB_P7.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P7.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P7.FormattingEnabled = true; - this.CB_P7.Location = new System.Drawing.Point(79, 393); - this.CB_P7.Name = "CB_P7"; - this.CB_P7.Size = new System.Drawing.Size(121, 21); - this.CB_P7.TabIndex = 46; - // // CB_I7 // this.CB_I7.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; @@ -412,16 +343,6 @@ private void InitializeComponent() this.CB_M7.TabIndex = 42; this.CB_M7.SelectedIndexChanged += new System.EventHandler(this.changeMethod); // - // CB_P6 - // - this.CB_P6.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_P6.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_P6.FormattingEnabled = true; - this.CB_P6.Location = new System.Drawing.Point(79, 339); - this.CB_P6.Name = "CB_P6"; - this.CB_P6.Size = new System.Drawing.Size(121, 21); - this.CB_P6.TabIndex = 40; - // // CB_I6 // this.CB_I6.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; @@ -546,7 +467,7 @@ private void InitializeComponent() // this.L_Protip.AutoSize = true; this.L_Protip.ForeColor = System.Drawing.Color.Red; - this.L_Protip.Location = new System.Drawing.Point(198, 11); + this.L_Protip.Location = new System.Drawing.Point(198, 9); this.L_Protip.Name = "L_Protip"; this.L_Protip.Size = new System.Drawing.Size(153, 13); this.L_Protip.TabIndex = 66; @@ -583,16 +504,107 @@ private void InitializeComponent() this.CHK_Exp.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_Exp.Location = new System.Drawing.Point(6, 23); this.CHK_Exp.Name = "CHK_Exp"; - this.CHK_Exp.Size = new System.Drawing.Size(219, 17); + this.CHK_Exp.Size = new System.Drawing.Size(222, 17); this.CHK_Exp.TabIndex = 63; - this.CHK_Exp.Text = "Share the same Exp Growth as Evolution"; + this.CHK_Exp.Text = "Share the same EXP Growth as Evolution"; this.CHK_Exp.UseVisualStyleBackColor = true; // - // Evolution + // B_Trade + // + this.B_Trade.Location = new System.Drawing.Point(244, 11); + this.B_Trade.Name = "B_Trade"; + this.B_Trade.Size = new System.Drawing.Size(143, 23); + this.B_Trade.TabIndex = 116; + this.B_Trade.Text = "Remove Trade Evolutions"; + this.B_Trade.UseVisualStyleBackColor = true; + this.B_Trade.Click += new System.EventHandler(this.B_Trade_Click); + // + // CB_P8 + // + this.CB_P8.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P8.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P8.FormattingEnabled = true; + this.CB_P8.Location = new System.Drawing.Point(79, 447); + this.CB_P8.Name = "CB_P8"; + this.CB_P8.Size = new System.Drawing.Size(121, 21); + this.CB_P8.TabIndex = 52; + // + // CB_P7 + // + this.CB_P7.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P7.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P7.FormattingEnabled = true; + this.CB_P7.Location = new System.Drawing.Point(79, 393); + this.CB_P7.Name = "CB_P7"; + this.CB_P7.Size = new System.Drawing.Size(121, 21); + this.CB_P7.TabIndex = 46; + // + // CB_P6 + // + this.CB_P6.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P6.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P6.FormattingEnabled = true; + this.CB_P6.Location = new System.Drawing.Point(79, 339); + this.CB_P6.Name = "CB_P6"; + this.CB_P6.Size = new System.Drawing.Size(121, 21); + this.CB_P6.TabIndex = 40; + // + // CB_P5 + // + this.CB_P5.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P5.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P5.FormattingEnabled = true; + this.CB_P5.Location = new System.Drawing.Point(79, 285); + this.CB_P5.Name = "CB_P5"; + this.CB_P5.Size = new System.Drawing.Size(121, 21); + this.CB_P5.TabIndex = 34; + // + // CB_P4 + // + this.CB_P4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P4.FormattingEnabled = true; + this.CB_P4.Location = new System.Drawing.Point(79, 231); + this.CB_P4.Name = "CB_P4"; + this.CB_P4.Size = new System.Drawing.Size(121, 21); + this.CB_P4.TabIndex = 28; + // + // CB_P3 + // + this.CB_P3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P3.FormattingEnabled = true; + this.CB_P3.Location = new System.Drawing.Point(79, 177); + this.CB_P3.Name = "CB_P3"; + this.CB_P3.Size = new System.Drawing.Size(121, 21); + this.CB_P3.TabIndex = 22; + // + // CB_P2 + // + this.CB_P2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P2.FormattingEnabled = true; + this.CB_P2.Location = new System.Drawing.Point(79, 123); + this.CB_P2.Name = "CB_P2"; + this.CB_P2.Size = new System.Drawing.Size(121, 21); + this.CB_P2.TabIndex = 16; + // + // CB_P1 + // + this.CB_P1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_P1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_P1.FormattingEnabled = true; + this.CB_P1.Location = new System.Drawing.Point(79, 69); + this.CB_P1.Name = "CB_P1"; + this.CB_P1.Size = new System.Drawing.Size(121, 21); + this.CB_P1.TabIndex = 10; + // + // EvolutionEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(394, 562); + this.ClientSize = new System.Drawing.Size(394, 561); + this.Controls.Add(this.B_Trade); this.Controls.Add(this.GB_Randomizer); this.Controls.Add(this.PB_8); this.Controls.Add(this.PB_7); @@ -667,32 +679,24 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_M1; private System.Windows.Forms.Label L_M1; private System.Windows.Forms.ComboBox CB_I1; - private System.Windows.Forms.ComboBox CB_P1; - private System.Windows.Forms.ComboBox CB_P2; private System.Windows.Forms.ComboBox CB_I2; private System.Windows.Forms.Label L_M2; private System.Windows.Forms.ComboBox CB_M2; - private System.Windows.Forms.ComboBox CB_P3; private System.Windows.Forms.ComboBox CB_I3; private System.Windows.Forms.Label L_M3; private System.Windows.Forms.ComboBox CB_M3; - private System.Windows.Forms.ComboBox CB_P4; private System.Windows.Forms.ComboBox CB_I4; private System.Windows.Forms.Label L_M4; private System.Windows.Forms.ComboBox CB_M4; - private System.Windows.Forms.ComboBox CB_P5; private System.Windows.Forms.ComboBox CB_I5; private System.Windows.Forms.Label L_M5; private System.Windows.Forms.ComboBox CB_M5; - private System.Windows.Forms.ComboBox CB_P8; private System.Windows.Forms.ComboBox CB_I8; private System.Windows.Forms.Label L_M8; private System.Windows.Forms.ComboBox CB_M8; - private System.Windows.Forms.ComboBox CB_P7; private System.Windows.Forms.ComboBox CB_I7; private System.Windows.Forms.Label L_M7; private System.Windows.Forms.ComboBox CB_M7; - private System.Windows.Forms.ComboBox CB_P6; private System.Windows.Forms.ComboBox CB_I6; private System.Windows.Forms.Label L_M6; private System.Windows.Forms.ComboBox CB_M6; @@ -710,5 +714,14 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Type; private System.Windows.Forms.CheckBox CHK_BST; private System.Windows.Forms.Label L_Protip; + private System.Windows.Forms.Button B_Trade; + private System.Windows.Forms.ComboBox CB_P8; + private System.Windows.Forms.ComboBox CB_P7; + private System.Windows.Forms.ComboBox CB_P6; + private System.Windows.Forms.ComboBox CB_P5; + private System.Windows.Forms.ComboBox CB_P4; + private System.Windows.Forms.ComboBox CB_P3; + private System.Windows.Forms.ComboBox CB_P2; + private System.Windows.Forms.ComboBox CB_P1; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs index 7221d402b6..d210b060e1 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs @@ -69,14 +69,10 @@ public EvolutionEditor6(byte[][] infiles) foreach (ComboBox cb in mb) { foreach (string s in evolutionMethods) cb.Items.Add(s); } foreach (ComboBox cb in rb) { foreach (string s in specieslist) cb.Items.Add(s); } - sortedspecies = (string[])specieslist.Clone(); - Array.Sort(sortedspecies); - CB_Species.Items.Clear(); - foreach (string s in sortedspecies) CB_Species.Items.Add(s); - CB_Species.Items.RemoveAt(0); + foreach (string s in specieslist) CB_Species.Items.Add(s); - CB_Species.SelectedIndex = 0; + CB_Species.SelectedIndex = 1; RandSettings.GetFormSettings(this, GB_Randomizer.Controls); } private readonly byte[][] files; @@ -85,7 +81,6 @@ public EvolutionEditor6(byte[][] infiles) private readonly ComboBox[] mb; private readonly PictureBox[] pic; private int entry = -1; - private readonly string[] sortedspecies; private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); @@ -102,7 +97,7 @@ private void getList() for (int i = 0; i < evo.PossibleEvolutions.Length; i++) { if (evo.PossibleEvolutions[i].Method > 34) return; // Invalid! - + mb[i].SelectedIndex = evo.PossibleEvolutions[i].Method; // Which will trigger the params cb to reload the valid params list pb[i].SelectedIndex = evo.PossibleEvolutions[i].Argument; rb[i].SelectedIndex = evo.PossibleEvolutions[i].Species; @@ -146,6 +141,21 @@ private void B_RandAll_Click(object sender, EventArgs e) WinFormsUtil.Alert("All Pokémon's Evolutions have been randomized!"); } + private void B_Trade_Click(object sender, EventArgs e) + { + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Remove all trade evolutions?", "Evolution methods will be altered so that evolutions will be possible with only one game.")) + return; + + setList(); + var evos = files.Select(z => new EvolutionSet6(z)).ToArray(); + var evoRand = new EvolutionRandomizer(Main.Config, evos); + evoRand.Randomizer.Initialize(); + evoRand.ExecuteTrade(); + evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); + getList(); + + WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); + } private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Evolutions to Text File?")) @@ -216,7 +226,7 @@ private void changeMethod(object sender, EventArgs e) case 3: // Moves { foreach (string t in movelist) pb[op].Items.Add(t); break; } case 4: // Species - { for (int i = 0; i < sortedspecies.Length; i++) pb[op].Items.Add(specieslist[i]); break; } + { for (int i = 0; i < specieslist.Length; i++) pb[op].Items.Add(specieslist[i]); break; } case 5: // 0-255 (Beauty) { for (int i = 0; i <= 255; i++) pb[op].Items.Add(i.ToString()); break; } case 6: diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs index c8c82863d1..774af2d694 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs @@ -93,6 +93,7 @@ private void InitializeComponent() this.CB_I8 = new System.Windows.Forms.ComboBox(); this.label7 = new System.Windows.Forms.Label(); this.CB_M8 = new System.Windows.Forms.ComboBox(); + this.B_Trade = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.PB_1)).BeginInit(); this.GB_Randomizer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_F1)).BeginInit(); @@ -202,7 +203,7 @@ private void InitializeComponent() // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(251, 47); + this.B_RandAll.Location = new System.Drawing.Point(511, 322); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(100, 23); this.B_RandAll.TabIndex = 62; @@ -216,7 +217,6 @@ private void InitializeComponent() this.GB_Randomizer.Controls.Add(this.CHK_BST); this.GB_Randomizer.Controls.Add(this.CHK_Type); this.GB_Randomizer.Controls.Add(this.CHK_Exp); - this.GB_Randomizer.Controls.Add(this.B_RandAll); this.GB_Randomizer.Location = new System.Drawing.Point(16, 292); this.GB_Randomizer.Name = "GB_Randomizer"; this.GB_Randomizer.Size = new System.Drawing.Size(357, 76); @@ -228,7 +228,7 @@ private void InitializeComponent() // this.L_Protip.AutoSize = true; this.L_Protip.ForeColor = System.Drawing.Color.Red; - this.L_Protip.Location = new System.Drawing.Point(198, 11); + this.L_Protip.Location = new System.Drawing.Point(198, 9); this.L_Protip.Name = "L_Protip"; this.L_Protip.Size = new System.Drawing.Size(153, 13); this.L_Protip.TabIndex = 66; @@ -265,9 +265,9 @@ private void InitializeComponent() this.CHK_Exp.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_Exp.Location = new System.Drawing.Point(6, 23); this.CHK_Exp.Name = "CHK_Exp"; - this.CHK_Exp.Size = new System.Drawing.Size(219, 17); + this.CHK_Exp.Size = new System.Drawing.Size(222, 17); this.CHK_Exp.TabIndex = 63; - this.CHK_Exp.Text = "Share the same Exp Growth as Evolution"; + this.CHK_Exp.Text = "Share the same EXP Growth as Evolution"; this.CHK_Exp.UseVisualStyleBackColor = true; // // NUD_F1 @@ -900,15 +900,27 @@ private void InitializeComponent() this.CB_M8.TabIndex = 108; this.CB_M8.SelectedIndexChanged += new System.EventHandler(this.changeMethod); // + // B_Trade + // + this.B_Trade.Location = new System.Drawing.Point(468, 345); + this.B_Trade.Name = "B_Trade"; + this.B_Trade.Size = new System.Drawing.Size(143, 23); + this.B_Trade.TabIndex = 115; + this.B_Trade.Text = "Remove Trade Evolutions"; + this.B_Trade.UseVisualStyleBackColor = true; + this.B_Trade.Click += new System.EventHandler(this.B_Trade_Click); + // // EvolutionEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(624, 376); + this.Controls.Add(this.B_Trade); this.Controls.Add(this.NUD_L8); this.Controls.Add(this.NUD_F8); this.Controls.Add(this.PB_8); this.Controls.Add(this.CB_P8); + this.Controls.Add(this.B_RandAll); this.Controls.Add(this.CB_I8); this.Controls.Add(this.label7); this.Controls.Add(this.CB_M8); @@ -1070,5 +1082,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_I8; private System.Windows.Forms.Label label7; private System.Windows.Forms.ComboBox CB_M8; + private System.Windows.Forms.Button B_Trade; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs index 903b300bfc..74c50d0468 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs @@ -89,14 +89,10 @@ public EvolutionEditor7(byte[][] infiles) foreach (ComboBox cb in mb) { cb.Items.AddRange(evos.ToArray()); } foreach (ComboBox cb in rb) { cb.Items.AddRange(specieslist.Take(Main.Config.MaxSpeciesID+1).ToArray()); } - sortedspecies = (string[])specieslist.Clone(); - Array.Sort(sortedspecies); - CB_Species.Items.Clear(); - foreach (string s in sortedspecies) CB_Species.Items.Add(s); - CB_Species.Items.RemoveAt(0); + foreach (string s in specieslist) CB_Species.Items.Add(s); - CB_Species.SelectedIndex = 0; + CB_Species.SelectedIndex = 1; RandSettings.GetFormSettings(this, GB_Randomizer.Controls); } private readonly byte[][] files; @@ -104,7 +100,6 @@ public EvolutionEditor7(byte[][] infiles) private readonly NumericUpDown[] fb, lb; private readonly PictureBox[] pic; private int entry = -1; - private readonly string[] sortedspecies; private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); @@ -175,6 +170,21 @@ private void B_RandAll_Click(object sender, EventArgs e) WinFormsUtil.Alert("All Pokémon's Evolutions have been randomized!"); } + private void B_Trade_Click(object sender, EventArgs e) + { + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Remove all trade evolutions?", "Evolution methods will be altered so that evolutions will be possible with only one game.")) + return; + + setList(); + var evos = files.Select(z => new EvolutionSet7(z)).ToArray(); + var evoRand = new EvolutionRandomizer(Main.Config, evos); + evoRand.Randomizer.Initialize(); + evoRand.ExecuteTrade(); + evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); + getList(); + + WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); + } private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Evolutions to Text File?")) @@ -262,7 +272,7 @@ private void changeMethod(object sender, EventArgs e) case 3: // Moves { foreach (string t in movelist) pb[op].Items.Add(t); break; } case 4: // Species - { for (int i = 0; i < sortedspecies.Length; i++) pb[op].Items.Add(specieslist[i]); break; } + { for (int i = 0; i < specieslist.Length; i++) pb[op].Items.Add(specieslist[i]); break; } case 5: // 0-255 (Beauty) { for (int i = 0; i <= 255; i++) pb[op].Items.Add(i.ToString()); break; } case 6: From c4332b077fea2ba4b73b138e8549f91cb29ffa97 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 6 Feb 2018 00:36:45 -0500 Subject: [PATCH 075/191] More fixes (#286) --- pk3DS.Core/Legality/Legal.cs | 8 +++---- pk3DS.Core/Randomizers/EvolutionRandomizer.cs | 7 +++--- .../Subforms/Gen6/StarterEditor6.Designer.cs | 4 ++-- pk3DS/Subforms/ShinyRate.Designer.cs | 22 +++++++++---------- pk3DS/Subforms/ShinyRate.cs | 10 ++++----- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index c30b606db6..4641ee8346 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -266,14 +266,14 @@ public static partial class Legal { 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 129, 131, 132, 138, 144, 146, 149, 152, 153, 154, 155, 156, 158, 159, 160, 164, 167, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 392, 396, 398, 400, 401, 403, 405, 409, 410, 412, 413, 414, 415, 416, 417, 418, 419, 435, 438, 439, 440, - 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 481, 482, 483, 484, + 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 480, 481, 482, 483, 484, }; public static readonly int[] ImportantTrainers_USUM = { 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, - 241, 350, 351, 352, 356, 358, 359, 396, 398, 401, 405, 409, 410, 412, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 489, 490, 494, 495, 496, - 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, 650, - 651, 652, + 241, 350, 351, 352, 356, 358, 359, 396, 398, 401, 405, 409, 410, 412, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 480, 489, 490, 494, 495, + 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, + 650, 651, 652, }; public static readonly int[] BasicStarters_6 = { diff --git a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs index d677e2c147..fe5cc0b236 100644 --- a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs +++ b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs @@ -16,7 +16,6 @@ public EvolutionRandomizer(GameConfig config, EvolutionSet[] evolutions) Randomizer = new SpeciesRandomizer(Config); } - public void Execute() { for (var i = 0; i < Evolutions.Length; i++) @@ -50,7 +49,7 @@ private void Trade(EvolutionSet evo, int i) var evos = evo.PossibleEvolutions; foreach (EvolutionMethod v in evos) { - if ((Config.XY || Config.ORAS) && v.Method == 5) // Gen 6 uses Argument rather than Level + if (Config.Generation == 6 && v.Method == 5) // Gen 6 uses Argument rather than Level { if (i == 708 || i == 710) // Phantump/Pumpkaboo v.Argument = 20; @@ -59,9 +58,9 @@ private void Trade(EvolutionSet evo, int i) v.Method = 4; // trade -> level up } - if ((Config.SM || Config.USUM) && v.Method == 5) + else if (Config.Generation == 7 && v.Method == 5) { - if (i == 708 || i == 710 || i == 876 || i == 877 | i == 878) // Phantump/Pumpkaboo forms + if (i == 708 || i == 710 || i == 871 || i == 872 || i == 873 || i == 876 || i == 877 || i == 878) // Phantump/Pumpkaboo forms v.Level = 20; else v.Level = 30; diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs index f1f9d673c4..40cab934ec 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs @@ -338,7 +338,7 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(711, 331); + this.B_Save.Location = new System.Drawing.Point(711, 306); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(75, 23); this.B_Save.TabIndex = 464; @@ -349,7 +349,7 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(711, 309); + this.B_Cancel.Location = new System.Drawing.Point(711, 328); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(75, 23); this.B_Cancel.TabIndex = 465; diff --git a/pk3DS/Subforms/ShinyRate.Designer.cs b/pk3DS/Subforms/ShinyRate.Designer.cs index 88ea1ce76a..002f7015a5 100644 --- a/pk3DS/Subforms/ShinyRate.Designer.cs +++ b/pk3DS/Subforms/ShinyRate.Designer.cs @@ -42,7 +42,7 @@ private void InitializeComponent() this.GB_RerollHelper = new System.Windows.Forms.GroupBox(); this.GB_Rerolls = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.CHK_EverythingShiny = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Rerolls)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Rate)).BeginInit(); this.GB_RerollHelper.SuspendLayout(); @@ -196,22 +196,22 @@ private void InitializeComponent() this.label1.Text = "Note:\r\nThe above reroll count will overwrite the existing code.\r\n\r\nTo revert chan" + "ges, use the button below."; // - // checkBox1 + // CHK_EverythingShiny // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(281, 184); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(96, 30); - this.checkBox1.TabIndex = 14; - this.checkBox1.Text = "EVERYTHING\r\nSHINY"; - this.checkBox1.UseVisualStyleBackColor = true; + this.CHK_EverythingShiny.AutoSize = true; + this.CHK_EverythingShiny.Location = new System.Drawing.Point(281, 184); + this.CHK_EverythingShiny.Name = "CHK_EverythingShiny"; + this.CHK_EverythingShiny.Size = new System.Drawing.Size(96, 30); + this.CHK_EverythingShiny.TabIndex = 14; + this.CHK_EverythingShiny.Text = "EVERYTHING\r\nSHINY"; + this.CHK_EverythingShiny.UseVisualStyleBackColor = true; // // ShinyRate // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(384, 271); - this.Controls.Add(this.checkBox1); + this.Controls.Add(this.CHK_EverythingShiny); this.Controls.Add(this.label1); this.Controls.Add(this.GB_Rerolls); this.Controls.Add(this.GB_RerollHelper); @@ -253,6 +253,6 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox GB_RerollHelper; private System.Windows.Forms.GroupBox GB_Rerolls; private System.Windows.Forms.Label label1; - private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.CheckBox CHK_EverythingShiny; } } \ No newline at end of file diff --git a/pk3DS/Subforms/ShinyRate.cs b/pk3DS/Subforms/ShinyRate.cs index 0ff8dcab17..705ba8cb7d 100644 --- a/pk3DS/Subforms/ShinyRate.cs +++ b/pk3DS/Subforms/ShinyRate.cs @@ -93,7 +93,7 @@ private void CheckAlwaysShiny() if (index < 0) { - checkBox1.Enabled = checkBox1.Visible = false; + CHK_EverythingShiny.Enabled = CHK_EverythingShiny.Visible = false; return; } @@ -102,19 +102,19 @@ private void CheckAlwaysShiny() if (!original && !always) // oh no { - checkBox1.Enabled = checkBox1.Visible = false; + CHK_EverythingShiny.Enabled = CHK_EverythingShiny.Visible = false; return; } - checkBox1.Checked = always; + CHK_EverythingShiny.Checked = always; } private void B_Cancel_Click(object sender, EventArgs e) => Close(); private void B_Save_Click(object sender, EventArgs e) { writeCodePatch(); - if (checkBox1.Enabled) - exefsData[alwaysIndex] = (byte)(checkBox1.Checked ? 0xEA : 0x0A); + if (CHK_EverythingShiny.Enabled) + exefsData[alwaysIndex] = (byte)(CHK_EverythingShiny.Checked ? 0xEA : 0x0A); File.WriteAllBytes(codebin, exefsData); Close(); } From 58ca85bbd8f1e8552c0e8ed57c0bf8e4db914197 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 10 Feb 2018 12:08:07 -0800 Subject: [PATCH 076/191] Re-add changeSpecies event now updates the listbox as intended (event was never set) Closes #281 --- .../Gen6/StaticEncounterEditor6.Designer.cs | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index a7a03a76c6..ba2e3f7db4 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -66,18 +66,18 @@ private void InitializeComponent() this.CHK_G3 = new System.Windows.Forms.CheckBox(); this.CHK_G2 = new System.Windows.Forms.CheckBox(); this.CHK_G1 = new System.Windows.Forms.CheckBox(); - this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); - this.CHK_Level = new System.Windows.Forms.CheckBox(); this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); + this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); + this.CHK_Level = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); this.tabPage2.SuspendLayout(); this.GB_Tweak.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.SuspendLayout(); // // B_Cancel @@ -219,6 +219,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 506; + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); // // L_Species // @@ -502,6 +503,34 @@ private void InitializeComponent() this.CHK_G1.Text = "Gen 1"; this.CHK_G1.UseVisualStyleBackColor = true; // + // NUD_ForceFullyEvolved + // + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 158); + this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.TabIndex = 516; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 159); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 515; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; + // // NUD_LevelBoost // this.NUD_LevelBoost.DecimalPlaces = 2; @@ -537,34 +566,6 @@ private void InitializeComponent() this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // NUD_ForceFullyEvolved - // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 158); - this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; - this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); - this.NUD_ForceFullyEvolved.TabIndex = 516; - this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); - // - // CHK_ForceFullyEvolved - // - this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 159); - this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; - this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); - this.CHK_ForceFullyEvolved.TabIndex = 515; - this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; - this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; - // // StaticEncounterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -591,8 +592,8 @@ private void InitializeComponent() this.tabPage2.PerformLayout(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.ResumeLayout(false); } From 0de1f9053e94e1ad944f8f6541795df20415d2a7 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 16 Feb 2018 17:03:15 -0500 Subject: [PATCH 077/191] Misc tweaks (#290) --- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 58 +++++++------------ 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index eacdf5504f..734a53646b 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -480,9 +480,6 @@ private void B_Starters_Click(object sender, EventArgs e) else t.Species = specrand.GetRandomSpecies(oldStarters[i]); - - t.Form = formrand.GetRandomForme(t.Species); - t.Nature = -1; // random if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -494,13 +491,16 @@ private void B_Starters_Click(object sender, EventArgs e) t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); if (CHK_RemoveShinyLock.Checked) - t.ShinyLock = false; // in case any user modifications locked the starters + t.ShinyLock = false; if (CHK_SpecialMove.Checked) t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H + + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + t.Nature = -1; // random } getListBoxEntries(); @@ -522,25 +522,20 @@ private void B_RandAll_Click(object sender, EventArgs e) var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); + int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); for (int i = 3; i < Gifts.Length; i++) // Skip Starters { var t = Gifts[i]; - // replace Legendaries with another Legendary, including unevolved Legendary gifts - if (CHK_ReplaceLegend.Checked && (ReplaceLegend.Contains(t.Species)) || (UnevolvedLegend.Contains(t.Species))) - { - int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); + // Legendary-for-Legendary + if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species) || UnevolvedLegend.Contains(t.Species)) t.Species = ReplaceLegend[randLegend()]; - } // every other entry else t.Species = specrand.GetRandomSpecies(t.Species); - t.Form = formrand.GetRandomForme(t.Species); - t.Nature = -1; // random - if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -560,19 +555,16 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) - { t.Species = FinalEvo[randFinalEvo()]; - t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); - } + + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + t.Nature = -1; // random } foreach (EncounterStatic7 t in Encounters) { - // replace Legendaries with another Legendary + // Legendary-for-Legendary if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species)) - { - int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); t.Species = ReplaceLegend[randLegend()]; - } // fully evolved Totems else if (CHK_ForceTotem.Checked && Totem.Contains(t.Species)) @@ -582,11 +574,6 @@ private void B_RandAll_Click(object sender, EventArgs e) else t.Species = specrand.GetRandomSpecies(t.Species); - t.Form = formrand.GetRandomForme(t.Species); - t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); - t.Gender = 0; // random - t.Nature = 0; // random - if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -606,17 +593,17 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2, or H if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) - { t.Species = FinalEvo[randFinalEvo()]; - t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); - } + + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); + t.Gender = 0; // random + t.Nature = 0; // random } foreach (EncounterTrade7 t in Trades) { t.Species = specrand.GetRandomSpecies(t.Species); - t.Form = formrand.GetRandomForme(t.Species); t.TradeRequestSpecies = specrand.GetRandomSpecies(t.TradeRequestSpecies); - t.Nature = (int)(Util.rnd32() % CB_TNature.Items.Count); // randomly selected if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -631,10 +618,10 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) - { - t.Species = FinalEvo[randFinalEvo()]; - t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); - } + t.Species = FinalEvo[randFinalEvo()]; // only do offered species to be fair + + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + t.Nature = (int)(Util.rnd32() % CB_TNature.Items.Count); // randomly selected } getListBoxEntries(); @@ -701,20 +688,17 @@ private void ExportEncounters() private void ModifyLevels(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Levels?", "Cannot undo.") != DialogResult.Yes) return; - - // encounter + for (int i = 0; i < LB_Encounter.Items.Count; i++) { LB_Encounter.SelectedIndex = i; NUD_ELevel.Value = Randomizer.getModifiedLevel((int)NUD_ELevel.Value, NUD_LevelBoost.Value); } - // gift for (int i = 0; i < LB_Gift.Items.Count; i++) { LB_Gift.SelectedIndex = i; NUD_GLevel.Value = Randomizer.getModifiedLevel((int)NUD_GLevel.Value, NUD_LevelBoost.Value); } - // trade for (int i = 0; i < LB_Trade.Items.Count; i++) { LB_Trade.SelectedIndex = i; From 09eedfcf3ad225342b288d801e49d7ef45eb6e6f Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 21 Feb 2018 19:53:59 -0500 Subject: [PATCH 078/191] Revise ORAS trainer class rand (#294) --- pk3DS/Subforms/Gen6/RSTE.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index a34fa8cbc1..d32a7ed9d1 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -746,10 +746,8 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) if (rOnlySingles) t.AI &= 7; - if (rClass && rModelRestricted.Contains(t.Class)) // Classes selected to be randomized + if (rClass && rModelRestricted.Contains(t.Class)) // shuffle classes with 3D models { - //if (rIgnoreClass.Any()) // ignored special classes - // return; int randClass() => (int) (rnd32() % rModelRestricted.Length); t.Class = rModelRestricted[randClass()]; } @@ -767,10 +765,12 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~")); // don't allow disallowed classes t.Class = rv; } - else if (Main.Config.ORAS) // don't allow XY-only classes + else if (rClass && Main.Config.ORAS) // special handling, can't allow XY classes { - int randClass() => (int)(rnd32() % rTrainerClasses.Length); - t.Class = rTrainerClasses[randClass()]; + int randClass() => (int)(rnd32() % rTrainerClasses.Length); + if (rOnlySingles && t.BattleType != 0) return; // only singles if specified + if (rIgnoreClass.Contains(t.Class) && rTrainerClasses.Contains(t.Class)) return; // don't change important trainers if specified + t.Class = rTrainerClasses[randClass()]; } } private static void RandomizeTrainerPrizeItem(trdata6 t) From 788958a4f1987291034529d3f78ffaec6bdd0ae6 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 23 Feb 2018 21:27:53 -0500 Subject: [PATCH 079/191] Fix Gen 6 AI mod (#295) --- pk3DS/Subforms/Gen6/RSTE.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index d32a7ed9d1..6eb4b6c1b5 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -743,10 +743,8 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) { if (rDiffAI) t.AI |= 7; // Set first 3 bits, keep any other flag if present - if (rOnlySingles) - t.AI &= 7; - if (rClass && rModelRestricted.Contains(t.Class)) // shuffle classes with 3D models + if (rClass && rModelRestricted.Contains(t.Class) && !rIgnoreClass.Contains(t.Class)) // shuffle classes with 3D models { int randClass() => (int) (rnd32() % rModelRestricted.Length); t.Class = rModelRestricted[randClass()]; @@ -808,7 +806,7 @@ private string[] GetTagsORAS() // Magma Admins TagTrainer(tags, "MAGMA1", 235, 236, 271); // Maxie - TagTrainer(tags, "MAGMA2", 694, 695, 696, 697, 698); // Courney + TagTrainer(tags, "MAGMA2", 694, 695, 696, 697, 698); // Courtney TagTrainer(tags, "MAGMA3", 691, 692, 693); // Tabitha // Gym Leaders @@ -987,4 +985,4 @@ private void gotoParty(object sender, EventArgs e) tabControl1.SelectedIndex = 1 + Array.IndexOf(new[]{PB_Team1, PB_Team2, PB_Team3, PB_Team4, PB_Team5, PB_Team6,}, sender as PictureBox); } } -} \ No newline at end of file +} From 8a9a9686c50c5000163cd33aa068b2a86ac07950 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 3 Mar 2018 23:03:11 -0800 Subject: [PATCH 080/191] Use cached learnset for learnset editors Closes #298 --- pk3DS.Core/StructConverter.cs | 7 +++---- pk3DS/Main.cs | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pk3DS.Core/StructConverter.cs b/pk3DS.Core/StructConverter.cs index 1de1890c3f..224bc91bee 100644 --- a/pk3DS.Core/StructConverter.cs +++ b/pk3DS.Core/StructConverter.cs @@ -7,10 +7,9 @@ public static class StructConverter { public static T ToStructure(this byte[] bytes) where T : struct { - GCHandle handle = GCHandle.Alloc(bytes, GCHandleType.Pinned); - T obj = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); - handle.Free(); - return obj; + var handle = GCHandle.Alloc(bytes, GCHandleType.Pinned); + try { return (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); } + finally { handle.Free(); } } public static byte[] ToBytes(this T obj) where T : struct { diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 005070debe..99827f8b33 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -781,6 +781,7 @@ private void B_Move_Click(object sender, EventArgs e) break; } g.Save(); + Config.InitializeMoves(); }).Start(); } private void B_LevelUp_Click(object sender, EventArgs e) @@ -788,8 +789,7 @@ private void B_LevelUp_Click(object sender, EventArgs e) if (threadActive()) return; new Thread(() => { - var g = Config.getGARCData("levelup"); - byte[][] d = g.Files; + byte[][] d = Config.GARCLearnsets.Files; switch (Config.Generation) { case 6: @@ -799,8 +799,9 @@ private void B_LevelUp_Click(object sender, EventArgs e) Invoke((Action)(() => new LevelUpEditor7(d).ShowDialog())); break; } - g.Files = d; - g.Save(); + Config.GARCLearnsets.Files = d; + Config.GARCLearnsets.Save(); + Config.InitializePersonal(); }).Start(); } private void B_EggMove_Click(object sender, EventArgs e) From a7414d53d8317b9aba142d557c9d9c8afb012b70 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 13 Mar 2018 16:05:51 -0400 Subject: [PATCH 081/191] Add Gen 6 Mythicals to final evolutions (#299) * Add Gen 6 Mythicals to final evolutions * Blaziken ORAS Megas -> XY Also group by Generation on each line. --- pk3DS.Core/Legality/Legal.cs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 4641ee8346..187b7e65d0 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -6,18 +6,17 @@ public static partial class Legal { public static readonly ushort[] Mega_XY = { - 3,6,9,65,80, - 115,127,130,142,150,181, - 212,214,229,248,282, - 303,306,308,310,354,359,380,381, - 445,448,460, + 003, 006, 009, 065, 080, 115, 127, 130, 142, 150, + 181, 212, 214, 229, 248, + 257, 282, 303, 306, 308, 310, 354, 359, 380, 381, + 445, 448, 460 }; public static readonly ushort[] Mega_ORAS = Mega_XY.Concat(new ushort[] { - 15,18,94, - 208,254,257,260, - 302,319,323,334,362,373,376,384, - 428,475, + 015, 018, 094, + 208, + 254, 260, 302, 319, 323, 334, 362, 373, 376, 384, + 428, 475, 531, 719 }).ToArray(); @@ -254,7 +253,7 @@ public static partial class Legal 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, + 275, 276, 277, 278, 279 }; public static readonly int[] Z_Moves = { @@ -266,20 +265,20 @@ public static partial class Legal { 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 129, 131, 132, 138, 144, 146, 149, 152, 153, 154, 155, 156, 158, 159, 160, 164, 167, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 392, 396, 398, 400, 401, 403, 405, 409, 410, 412, 413, 414, 415, 416, 417, 418, 419, 435, 438, 439, 440, - 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 480, 481, 482, 483, 484, + 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 480, 481, 482, 483, 484 }; public static readonly int[] ImportantTrainers_USUM = { 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, 241, 350, 351, 352, 356, 358, 359, 396, 398, 401, 405, 409, 410, 412, 415, 416, 417, 418, 419, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 477, 478, 479, 480, 489, 490, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, - 650, 651, 652, + 650, 651, 652 }; public static readonly int[] BasicStarters_6 = { 001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147, 152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246, 252, 255, 258, 265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374, 387, 390, 393, 396, 403, 406, 440, 443, 495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602, - 607, 610, 633, 650, 653, 656, 661, 664, 669, 679, 704, + 607, 610, 633, 650, 653, 656, 661, 664, 669, 679, 704 }; public static readonly int[] BasicStarters_7 = BasicStarters_6.Concat(new int[] { @@ -302,16 +301,16 @@ public static partial class Legal 489, 490, 491, 492, 493, 494, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, 561, 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, 635, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, - 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, + 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, 719, 720, 721 }; public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[] { 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787, - 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, + 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802 }).ToArray(); public static readonly int[] FinalEvolutions_USUM = FinalEvolutions_SM.Concat(new int[] { - 804, 805, 806, 807, + 804, 805, 806, 807 }).ToArray(); /// @@ -321,11 +320,11 @@ public static partial class Legal public static readonly int[] Legendary_Mythical_6 = { 144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638, - 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721, + 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721 }; public static readonly int[] Legendary_Mythical_SM = Legendary_Mythical_6.Concat(new int[] { - 773, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, + 773, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802 }).ToArray(); public static readonly int[] Legendary_Mythical_USUM = Legendary_Mythical_SM.Concat(new int[] { From 0f9eaee8ef271d41ae35aaef756ea0a7486b85c2 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 13 Mar 2018 22:55:37 -0700 Subject: [PATCH 082/191] Allow text parsing without specifying a config using pk3DS core with linqpad sucks less now --- pk3DS.Core/Game/GameConfig.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index f57e9d7e6a..c3b5df50fe 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -200,11 +200,11 @@ private GARC.lzGARC getlzGARC(string file) public string RomFS, ExeFS; - public GARCReference getGARCReference(string name) { return Files.FirstOrDefault(f => f.Name == name); } - public TextVariableCode getVariableCode(string name) { return Variables.FirstOrDefault(v => v.Name == name); } - public TextVariableCode getVariableName(int value) { return Variables.FirstOrDefault(v => v.Code == value); } + public GARCReference getGARCReference(string name) { return Files?.FirstOrDefault(f => f.Name == name); } + public TextVariableCode getVariableCode(string name) { return Variables?.FirstOrDefault(v => v.Name == name); } + public TextVariableCode getVariableName(int value) { return Variables?.FirstOrDefault(v => v.Code == value); } - private TextReference getGameText(TextName name) { return GameText.FirstOrDefault(f => f.Name == name); } + private TextReference getGameText(TextName name) { return GameText?.FirstOrDefault(f => f.Name == name); } public TextData getTextData(TextName file) => new TextData(getText(file)); public string[] getText(TextName file) { From af4e6ca805c0098ca80a564c1fc8fc9717805b81 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 16 Mar 2018 21:13:51 -0700 Subject: [PATCH 083/191] fix window enable/disable cross thread closes #300 --- pk3DS/Main.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 99827f8b33..1804f2a3b2 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -599,21 +599,16 @@ private void B_Wild_Click(object sender, EventArgs e) case 6: files = new[] { "encdata" }; if (Config.ORAS) - { - Enabled = false; action = () => new RSWE().ShowDialog(); - } else if (Config.XY) - { - Enabled = false; action = () => new XYWE().ShowDialog(); - } else return; + Invoke((MethodInvoker)delegate { Enabled = false; }); fileGet(files, false); Invoke(action); fileSet(files); - Enabled = true; + Invoke((MethodInvoker)delegate { Enabled = true; }); break; case 7: Invoke((MethodInvoker)delegate { Enabled = false; }); From 333b4bec2d239543ad33810f15acc71db48f1e51 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 17 Mar 2018 12:45:23 -0700 Subject: [PATCH 084/191] use c#7 expressions --- pk3DS.Core/Structures/Gen7/trdata7.cs | 18 ++++---- pk3DS.Core/Structures/Gen7/trpoke7.cs | 60 +++++++++++++-------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/pk3DS.Core/Structures/Gen7/trdata7.cs b/pk3DS.Core/Structures/Gen7/trdata7.cs index 4a8b581a69..01484ae9f7 100644 --- a/pk3DS.Core/Structures/Gen7/trdata7.cs +++ b/pk3DS.Core/Structures/Gen7/trdata7.cs @@ -24,16 +24,16 @@ public trdata7(byte[] tr = null, byte[] tp = null) } } - public byte TrainerClass { get { return trdata[0]; } set { trdata[0] = value; } } - public int NumPokemon { get { return trdata[3]; } set { trdata[3] = (byte)(value%7); } } - public int Item1 { get { return BitConverter.ToUInt16(trdata, 0x04); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x04); } } - public int Item2 { get { return BitConverter.ToUInt16(trdata, 0x06); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x06); } } - public int Item3 { get { return BitConverter.ToUInt16(trdata, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x08); } } - public int Item4 { get { return BitConverter.ToUInt16(trdata, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x0A); } } + public byte TrainerClass { get => trdata[0]; set => trdata[0] = value; } + public int NumPokemon { get => trdata[3]; set => trdata[3] = (byte)(value%7); } + public int Item1 { get => BitConverter.ToUInt16(trdata, 0x04); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x04); } + public int Item2 { get => BitConverter.ToUInt16(trdata, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x06); } + public int Item3 { get => BitConverter.ToUInt16(trdata, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x08); } + public int Item4 { get => BitConverter.ToUInt16(trdata, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x0A); } - public int AI { get { return trdata[0x0C]; } set { trdata[0x0C] = (byte)value; } } - public bool Flag { get { return trdata[0x0D] == 1; } set { trdata[0x0D] = (byte)(value ? 1 : 0); } } - public int Money { get { return trdata[0x11]; } set { trdata[0x11] = (byte)value; } } + public int AI { get => trdata[0x0C]; set => trdata[0x0C] = (byte)value; } + public bool Flag { get => trdata[0x0D] == 1; set => trdata[0x0D] = (byte)(value ? 1 : 0); } + public int Money { get => trdata[0x11]; set => trdata[0x11] = (byte)value; } public void Write(out byte[] tr, out byte[] pk) { diff --git a/pk3DS.Core/Structures/Gen7/trpoke7.cs b/pk3DS.Core/Structures/Gen7/trpoke7.cs index 039d68977f..26d4bd219f 100644 --- a/pk3DS.Core/Structures/Gen7/trpoke7.cs +++ b/pk3DS.Core/Structures/Gen7/trpoke7.cs @@ -21,47 +21,47 @@ public trpoke7 Clone() public int Gender { - get { return Data[0] & 0x3; } - set { Data[0] = (byte)((Data[0] & 0xFC) | value & 0x3); } + get => Data[0] & 0x3; + set => Data[0] = (byte)((Data[0] & 0xFC) | value & 0x3); } public int Ability { - get { return (Data[0] >> 4) & 0x3; } - set { Data[0] = (byte)((Data[0] & 0xCF) | ((value & 0x3) << 4)); } + get => (Data[0] >> 4) & 0x3; + set => Data[0] = (byte)((Data[0] & 0xCF) | ((value & 0x3) << 4)); } - public int Nature { get { return Data[1]; } set { Data[1] = (byte)value; } } + public int Nature { get => Data[1]; set => Data[1] = (byte)value; } - public int EV_HP { get { return Data[0x2]; } set { Data[0x2] = (byte)value; } } - public int EV_ATK { get { return Data[0x3]; } set { Data[0x3] = (byte)value; } } - public int EV_DEF { get { return Data[0x4]; } set { Data[0x4] = (byte)value; } } - public int EV_SPA { get { return Data[0x5]; } set { Data[0x5] = (byte)value; } } - public int EV_SPD { get { return Data[0x6]; } set { Data[0x6] = (byte)value; } } - public int EV_SPE { get { return Data[0x7]; } set { Data[0x7] = (byte)value; } } + public int EV_HP { get => Data[0x2]; set => Data[0x2] = (byte)value; } + public int EV_ATK { get => Data[0x3]; set => Data[0x3] = (byte)value; } + public int EV_DEF { get => Data[0x4]; set => Data[0x4] = (byte)value; } + public int EV_SPA { get => Data[0x5]; set => Data[0x5] = (byte)value; } + public int EV_SPD { get => Data[0x6]; set => Data[0x6] = (byte)value; } + public int EV_SPE { get => Data[0x7]; set => Data[0x7] = (byte)value; } - private uint IV32 { get { return BitConverter.ToUInt32(Data, 0x8); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x8); } } + private uint IV32 { get => BitConverter.ToUInt32(Data, 0x8); set => BitConverter.GetBytes(value).CopyTo(Data, 0x8); } - public int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } } - public int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } } - public int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } } - public int IV_SPA { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } } - public int IV_SPD { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } - public int IV_SPE { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } - public bool Shiny { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } } + public int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } + public int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } + public int IV_DEF { get => (int)(IV32 >> 10) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } + public int IV_SPA { get => (int)(IV32 >> 15) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } + public int IV_SPD { get => (int)(IV32 >> 20) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } + public int IV_SPE { get => (int)(IV32 >> 25) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } + public bool Shiny { get => ((IV32 >> 30) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } - public int Level { get { return Data[0xE]; } set { Data[0xE] = (byte)value; } } - public int Species { get { return BitConverter.ToUInt16(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } } - public int Form { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } } + public int Level { get => Data[0xE]; set => Data[0xE] = (byte)value; } + public int Species { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } + public int Form { get => Data[0x12]; set => Data[0x12] = (byte)value; } - public int Item { get { return BitConverter.ToUInt16(Data, 0x14); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); } } - public int Move1 { get { return BitConverter.ToUInt16(Data, 0x18); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } } - public int Move2 { get { return BitConverter.ToUInt16(Data, 0x1A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1A); } } - public int Move3 { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } } - public int Move4 { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } } + public int Item { get => BitConverter.ToUInt16(Data, 0x14); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); } + public int Move1 { get => BitConverter.ToUInt16(Data, 0x18); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } + public int Move2 { get => BitConverter.ToUInt16(Data, 0x1A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1A); } + public int Move3 { get => BitConverter.ToUInt16(Data, 0x1C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } + public int Move4 { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } public int[] IVs { - get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPA, IV_SPD, IV_SPE }; } + get => new[] { IV_HP, IV_ATK, IV_DEF, IV_SPA, IV_SPD, IV_SPE }; set { if (value?.Length != 6) return; @@ -71,7 +71,7 @@ public int[] IVs } public int[] EVs { - get { return new[] { EV_HP, EV_ATK, EV_DEF, EV_SPA, EV_SPD, EV_SPE }; } + get => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPA, EV_SPD, EV_SPE }; set { if (value?.Length != 6) return; @@ -81,7 +81,7 @@ public int[] EVs } public int[] Moves { - get { return new[] { Move1, Move2, Move3, Move4 }; } + get => new[] { Move1, Move2, Move3, Move4 }; set { if (value?.Length != 4) return; Move1 = value[0]; Move2 = value[1]; Move3 = value[2]; Move4 = value[3]; } } From cfc8d136bfbd88fad0087c132fde73e290aa0420 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 17 Mar 2018 18:56:55 -0700 Subject: [PATCH 085/191] Remove unnecessary duplicate class learn6 is same as learn7 --- pk3DS.Core/Game/GameConfig.cs | 2 +- pk3DS.Core/Structures/Learnset.cs | 39 --------------------------- pk3DS/Subforms/Gen7/LevelUpEditor7.cs | 4 +-- 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index c3b5df50fe..176128c75e 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -135,7 +135,7 @@ public void InitializeLearnset() Learnsets = GARCLearnsets.Files.Select(file => new Learnset6(file)).ToArray(); break; case 7: - Learnsets = GARCLearnsets.Files.Select(file => new Learnset7(file)).ToArray(); + Learnsets = GARCLearnsets.Files.Select(file => new Learnset6(file)).ToArray(); break; } } diff --git a/pk3DS.Core/Structures/Learnset.cs b/pk3DS.Core/Structures/Learnset.cs index c5098aefe8..09caf4b8d8 100644 --- a/pk3DS.Core/Structures/Learnset.cs +++ b/pk3DS.Core/Structures/Learnset.cs @@ -58,43 +58,4 @@ public override byte[] Write() } } } - public class Learnset7 : Learnset - { - public Learnset7(byte[] data) - { - if (data.Length < 4 || data.Length % 4 != 0) - { Count = 0; Levels = new int[0]; Moves = new int[0]; return; } - Count = data.Length / 4 - 1; - Moves = new int[Count]; - Levels = new int[Count]; - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - for (int i = 0; i < Count; i++) - { - Moves[i] = br.ReadInt16(); - Levels[i] = br.ReadInt16(); - } - } - public static Learnset[] getArray(byte[][] entries) - { - Learnset[] data = new Learnset[entries.Length]; - for (int i = 0; i < data.Length; i++) - data[i] = new Learnset7(entries[i]); - return data; - } - public override byte[] Write() - { - Count = (ushort)Moves.Length; - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - for (int i = 0; i < Count; i++) - { - bw.Write((short)Moves[i]); - bw.Write((short)Levels[i]); - } - bw.Write(-1); - return ms.ToArray(); - } - } - } } diff --git a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs index dd2ed047ef..6d1d75da31 100644 --- a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs +++ b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs @@ -88,7 +88,7 @@ private void getList() dgv.Rows.Clear(); byte[] input = files[entry]; if (input.Length <= 4) { files[entry] = BitConverter.GetBytes(-1); return; } - pkm = new Learnset7(input); + pkm = new Learnset6(input); dgv.Rows.Add(pkm.Count); @@ -132,7 +132,7 @@ private void changeEntry(object sender, EventArgs e) private void B_RandAll_Click(object sender, EventArgs e) { setList(); - var sets = files.Select(z => new Learnset7(z)).ToArray(); + var sets = files.Select(z => new Learnset6(z)).ToArray(); var banned = new List(new[] {165, 621, 464}.Concat(Legal.Z_Moves)); // Struggle, Hyperspace Fury, Dark Void if (CHK_NoFixedDamage.Checked) banned.AddRange(MoveRandomizer.FixedDamageMoves); From 0af0f33983c05213c3b19b2dd407122cb3680660 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 17 Mar 2018 19:06:02 -0700 Subject: [PATCH 086/191] Absorb PKHeX's learnset class contains a faster get current moves should probably make a class lib for rom structures... --- pk3DS.Core/Randomizers/LearnsetRandomizer.cs | 2 +- pk3DS.Core/Structures/Learnset.cs | 100 +++++++++++++++---- 2 files changed, 81 insertions(+), 21 deletions(-) diff --git a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs index eda660c531..74b38901cb 100644 --- a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs +++ b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs @@ -106,7 +106,7 @@ public int[] GetHighPoweredMoves(int species, int form, int count = 4) public int[] GetCurrentMoves(int species, int form, int level, int count = 4) { int i = Config.Personal.getFormeIndex(species, form); - var moves = Learnsets[i].getCurrentMoves(level); + var moves = Learnsets[i].GetEncounterMoves(level); Array.Resize(ref moves, count); return moves; } diff --git a/pk3DS.Core/Structures/Learnset.cs b/pk3DS.Core/Structures/Learnset.cs index 09caf4b8d8..8b967c8e5f 100644 --- a/pk3DS.Core/Structures/Learnset.cs +++ b/pk3DS.Core/Structures/Learnset.cs @@ -1,5 +1,6 @@ -using System.IO; -using System.Linq; +using System; +using System.Collections.Generic; +using System.IO; namespace pk3DS.Core.Structures { @@ -9,15 +10,73 @@ public abstract class Learnset public int[] Moves; public int[] Levels; - public int[] getMoves(int level) + public abstract byte[] Write(); + + /// + /// Returns the moves a Pokémon can learn between the specified level range. + /// + /// Maximum level + /// Minimum level + /// Array of Move IDs + public int[] GetMoves(int maxLevel, int minLevel = 0) { - return Moves.TakeWhile((move, i) => Levels[i] <= level).Distinct().ToArray(); + if (minLevel <= 1 && maxLevel >= 100) + return Moves; + if (minLevel > maxLevel) + return new int[0]; + int start = Array.FindIndex(Levels, z => z >= minLevel); + if (start < 0) + return new int[0]; + int end = Array.FindLastIndex(Levels, z => z <= maxLevel); + if (end < 0) + return new int[0]; + int[] result = new int[end - start + 1]; + Array.Copy(Moves, start, result, 0, result.Length); + return result; } - public int[] getCurrentMoves(int level) + /// Returns the moves a Pokémon would have if it were encountered at the specified level. + /// In Generation 1, it is not possible to learn any moves lower than these encounter moves. + /// The level the Pokémon was encountered at. + /// Array of Move IDs + public int[] GetEncounterMoves(int level) { - return getMoves(level).Reverse().Take(4).Reverse().ToArray(); + const int count = 4; + IList moves = new int[count]; + int ctr = 0; + for (int i = 0; i < Moves.Length; i++) + { + if (Levels[i] > level) + break; + int move = Moves[i]; + if (moves.Contains(move)) + continue; + + moves[ctr++] = move; + ctr &= 3; + } + return (int[])moves; + } + /// Returns the index of the lowest level move if the Pokémon were encountered at the specified level. + /// Helps determine the minimum level an encounter can be at. + /// The level the Pokémon was encountered at. + /// Array of Move IDs + public int GetMinMoveLevel(int level) + { + if (Levels.Length == 0) + return 1; + + int end = Array.FindLastIndex(Levels, z => z <= level); + return Math.Max(end - 4, 1); + } + + /// Returns the level that a Pokémon can learn the specified move. + /// Move ID + /// Level the move is learned at. If the result is below 0, it cannot be learned by levelup. + public int GetLevelLearnMove(int move) + { + int index = Array.IndexOf(Moves, move); + return index < 0 ? index : Levels[index]; } - public abstract byte[] Write(); } public class Learnset6 : Learnset { @@ -28,19 +87,13 @@ public Learnset6(byte[] data) Count = data.Length / 4 - 1; Moves = new int[Count]; Levels = new int[Count]; - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - for (int i = 0; i < Count; i++) - { - Moves[i] = br.ReadInt16(); - Levels[i] = br.ReadInt16(); - } - } - public static Learnset[] getArray(byte[][] entries) - { - Learnset[] data = new Learnset[entries.Length]; - for (int i = 0; i < data.Length; i++) - data[i] = new Learnset6(entries[i]); - return data; + using (var ms = new MemoryStream(data)) + using (var br = new BinaryReader(ms)) + for (int i = 0; i < Count; i++) + { + Moves[i] = br.ReadInt16(); + Levels[i] = br.ReadInt16(); + } } public override byte[] Write() { @@ -57,5 +110,12 @@ public override byte[] Write() return ms.ToArray(); } } + public static Learnset[] GetArray(byte[][] entries) + { + Learnset[] data = new Learnset[entries.Length]; + for (int i = 0; i < data.Length; i++) + data[i] = new Learnset6(entries[i]); + return data; + } } } From 143bee23215435d82377a23527da9a174175c126 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 18 Mar 2018 17:00:53 -0400 Subject: [PATCH 087/191] Revise starter rand (#303) --- .../Subforms/Gen6/StarterEditor6.Designer.cs | 120 +++++++++++------- pk3DS/Subforms/Gen6/StarterEditor6.cs | 6 +- 2 files changed, 76 insertions(+), 50 deletions(-) diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs index 40cab934ec..ea7a124ca6 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs @@ -53,7 +53,6 @@ private void InitializeComponent() this.CB_G4_0 = new System.Windows.Forms.ComboBox(); this.PB_G4_0 = new System.Windows.Forms.PictureBox(); this.B_Save = new System.Windows.Forms.Button(); - this.B_Cancel = new System.Windows.Forms.Button(); this.B_Randomize = new System.Windows.Forms.Button(); this.L_Set1 = new System.Windows.Forms.Label(); this.L_Set3 = new System.Windows.Forms.Label(); @@ -61,7 +60,10 @@ private void InitializeComponent() this.L_Set2 = new System.Windows.Forms.Label(); this.CHK_Gen = new System.Windows.Forms.CheckBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.CHK_E = new System.Windows.Forms.CheckBox(); + this.CHK_L = new System.Windows.Forms.CheckBox(); this.CHK_BasicStarter = new System.Windows.Forms.CheckBox(); + this.B_Cancel = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_G1_2)).BeginInit(); @@ -79,7 +81,7 @@ private void InitializeComponent() // // PB_G1_0 // - this.PB_G1_0.Location = new System.Drawing.Point(12, 30); + this.PB_G1_0.Location = new System.Drawing.Point(12, 20); this.PB_G1_0.Name = "PB_G1_0"; this.PB_G1_0.Size = new System.Drawing.Size(120, 90); this.PB_G1_0.TabIndex = 440; @@ -90,7 +92,7 @@ private void InitializeComponent() this.CB_G1_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G1_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G1_0.FormattingEnabled = true; - this.CB_G1_0.Location = new System.Drawing.Point(12, 126); + this.CB_G1_0.Location = new System.Drawing.Point(12, 116); this.CB_G1_0.Name = "CB_G1_0"; this.CB_G1_0.Size = new System.Drawing.Size(120, 21); this.CB_G1_0.TabIndex = 441; @@ -101,7 +103,7 @@ private void InitializeComponent() this.CB_G1_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G1_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G1_1.FormattingEnabled = true; - this.CB_G1_1.Location = new System.Drawing.Point(138, 126); + this.CB_G1_1.Location = new System.Drawing.Point(138, 116); this.CB_G1_1.Name = "CB_G1_1"; this.CB_G1_1.Size = new System.Drawing.Size(120, 21); this.CB_G1_1.TabIndex = 443; @@ -109,7 +111,7 @@ private void InitializeComponent() // // PB_G1_1 // - this.PB_G1_1.Location = new System.Drawing.Point(138, 30); + this.PB_G1_1.Location = new System.Drawing.Point(138, 20); this.PB_G1_1.Name = "PB_G1_1"; this.PB_G1_1.Size = new System.Drawing.Size(120, 90); this.PB_G1_1.TabIndex = 442; @@ -120,7 +122,7 @@ private void InitializeComponent() this.CB_G1_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G1_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G1_2.FormattingEnabled = true; - this.CB_G1_2.Location = new System.Drawing.Point(264, 126); + this.CB_G1_2.Location = new System.Drawing.Point(264, 116); this.CB_G1_2.Name = "CB_G1_2"; this.CB_G1_2.Size = new System.Drawing.Size(120, 21); this.CB_G1_2.TabIndex = 445; @@ -128,7 +130,7 @@ private void InitializeComponent() // // PB_G1_2 // - this.PB_G1_2.Location = new System.Drawing.Point(264, 30); + this.PB_G1_2.Location = new System.Drawing.Point(264, 20); this.PB_G1_2.Name = "PB_G1_2"; this.PB_G1_2.Size = new System.Drawing.Size(120, 90); this.PB_G1_2.TabIndex = 444; @@ -140,7 +142,7 @@ private void InitializeComponent() this.CB_G2_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G2_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G2_2.FormattingEnabled = true; - this.CB_G2_2.Location = new System.Drawing.Point(264, 279); + this.CB_G2_2.Location = new System.Drawing.Point(264, 254); this.CB_G2_2.Name = "CB_G2_2"; this.CB_G2_2.Size = new System.Drawing.Size(120, 21); this.CB_G2_2.TabIndex = 451; @@ -149,7 +151,7 @@ private void InitializeComponent() // PB_G2_2 // this.PB_G2_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.PB_G2_2.Location = new System.Drawing.Point(264, 183); + this.PB_G2_2.Location = new System.Drawing.Point(264, 158); this.PB_G2_2.Name = "PB_G2_2"; this.PB_G2_2.Size = new System.Drawing.Size(120, 90); this.PB_G2_2.TabIndex = 450; @@ -161,7 +163,7 @@ private void InitializeComponent() this.CB_G2_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G2_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G2_1.FormattingEnabled = true; - this.CB_G2_1.Location = new System.Drawing.Point(138, 279); + this.CB_G2_1.Location = new System.Drawing.Point(138, 254); this.CB_G2_1.Name = "CB_G2_1"; this.CB_G2_1.Size = new System.Drawing.Size(120, 21); this.CB_G2_1.TabIndex = 449; @@ -170,7 +172,7 @@ private void InitializeComponent() // PB_G2_1 // this.PB_G2_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.PB_G2_1.Location = new System.Drawing.Point(138, 183); + this.PB_G2_1.Location = new System.Drawing.Point(138, 158); this.PB_G2_1.Name = "PB_G2_1"; this.PB_G2_1.Size = new System.Drawing.Size(120, 90); this.PB_G2_1.TabIndex = 448; @@ -182,7 +184,7 @@ private void InitializeComponent() this.CB_G2_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G2_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G2_0.FormattingEnabled = true; - this.CB_G2_0.Location = new System.Drawing.Point(12, 279); + this.CB_G2_0.Location = new System.Drawing.Point(12, 254); this.CB_G2_0.Name = "CB_G2_0"; this.CB_G2_0.Size = new System.Drawing.Size(120, 21); this.CB_G2_0.TabIndex = 447; @@ -191,7 +193,7 @@ private void InitializeComponent() // PB_G2_0 // this.PB_G2_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.PB_G2_0.Location = new System.Drawing.Point(12, 183); + this.PB_G2_0.Location = new System.Drawing.Point(12, 158); this.PB_G2_0.Name = "PB_G2_0"; this.PB_G2_0.Size = new System.Drawing.Size(120, 90); this.PB_G2_0.TabIndex = 446; @@ -203,7 +205,7 @@ private void InitializeComponent() this.CB_G3_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G3_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G3_2.FormattingEnabled = true; - this.CB_G3_2.Location = new System.Drawing.Point(672, 126); + this.CB_G3_2.Location = new System.Drawing.Point(672, 116); this.CB_G3_2.Name = "CB_G3_2"; this.CB_G3_2.Size = new System.Drawing.Size(120, 21); this.CB_G3_2.TabIndex = 457; @@ -213,7 +215,7 @@ private void InitializeComponent() // PB_G3_2 // this.PB_G3_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.PB_G3_2.Location = new System.Drawing.Point(672, 30); + this.PB_G3_2.Location = new System.Drawing.Point(672, 20); this.PB_G3_2.Name = "PB_G3_2"; this.PB_G3_2.Size = new System.Drawing.Size(120, 90); this.PB_G3_2.TabIndex = 456; @@ -226,7 +228,7 @@ private void InitializeComponent() this.CB_G3_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G3_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G3_1.FormattingEnabled = true; - this.CB_G3_1.Location = new System.Drawing.Point(546, 126); + this.CB_G3_1.Location = new System.Drawing.Point(546, 116); this.CB_G3_1.Name = "CB_G3_1"; this.CB_G3_1.Size = new System.Drawing.Size(120, 21); this.CB_G3_1.TabIndex = 455; @@ -236,7 +238,7 @@ private void InitializeComponent() // PB_G3_1 // this.PB_G3_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.PB_G3_1.Location = new System.Drawing.Point(546, 30); + this.PB_G3_1.Location = new System.Drawing.Point(546, 20); this.PB_G3_1.Name = "PB_G3_1"; this.PB_G3_1.Size = new System.Drawing.Size(120, 90); this.PB_G3_1.TabIndex = 454; @@ -249,7 +251,7 @@ private void InitializeComponent() this.CB_G3_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G3_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G3_0.FormattingEnabled = true; - this.CB_G3_0.Location = new System.Drawing.Point(420, 126); + this.CB_G3_0.Location = new System.Drawing.Point(420, 116); this.CB_G3_0.Name = "CB_G3_0"; this.CB_G3_0.Size = new System.Drawing.Size(120, 21); this.CB_G3_0.TabIndex = 453; @@ -259,7 +261,7 @@ private void InitializeComponent() // PB_G3_0 // this.PB_G3_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.PB_G3_0.Location = new System.Drawing.Point(420, 30); + this.PB_G3_0.Location = new System.Drawing.Point(420, 20); this.PB_G3_0.Name = "PB_G3_0"; this.PB_G3_0.Size = new System.Drawing.Size(120, 90); this.PB_G3_0.TabIndex = 452; @@ -272,7 +274,7 @@ private void InitializeComponent() this.CB_G4_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G4_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G4_2.FormattingEnabled = true; - this.CB_G4_2.Location = new System.Drawing.Point(672, 279); + this.CB_G4_2.Location = new System.Drawing.Point(672, 254); this.CB_G4_2.Name = "CB_G4_2"; this.CB_G4_2.Size = new System.Drawing.Size(120, 21); this.CB_G4_2.TabIndex = 463; @@ -282,7 +284,7 @@ private void InitializeComponent() // PB_G4_2 // this.PB_G4_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.PB_G4_2.Location = new System.Drawing.Point(672, 183); + this.PB_G4_2.Location = new System.Drawing.Point(672, 158); this.PB_G4_2.Name = "PB_G4_2"; this.PB_G4_2.Size = new System.Drawing.Size(120, 90); this.PB_G4_2.TabIndex = 462; @@ -295,7 +297,7 @@ private void InitializeComponent() this.CB_G4_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G4_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G4_1.FormattingEnabled = true; - this.CB_G4_1.Location = new System.Drawing.Point(546, 279); + this.CB_G4_1.Location = new System.Drawing.Point(546, 254); this.CB_G4_1.Name = "CB_G4_1"; this.CB_G4_1.Size = new System.Drawing.Size(120, 21); this.CB_G4_1.TabIndex = 461; @@ -305,7 +307,7 @@ private void InitializeComponent() // PB_G4_1 // this.PB_G4_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.PB_G4_1.Location = new System.Drawing.Point(546, 183); + this.PB_G4_1.Location = new System.Drawing.Point(546, 158); this.PB_G4_1.Name = "PB_G4_1"; this.PB_G4_1.Size = new System.Drawing.Size(120, 90); this.PB_G4_1.TabIndex = 460; @@ -318,7 +320,7 @@ private void InitializeComponent() this.CB_G4_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_G4_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_G4_0.FormattingEnabled = true; - this.CB_G4_0.Location = new System.Drawing.Point(420, 279); + this.CB_G4_0.Location = new System.Drawing.Point(420, 254); this.CB_G4_0.Name = "CB_G4_0"; this.CB_G4_0.Size = new System.Drawing.Size(120, 21); this.CB_G4_0.TabIndex = 459; @@ -328,7 +330,7 @@ private void InitializeComponent() // PB_G4_0 // this.PB_G4_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.PB_G4_0.Location = new System.Drawing.Point(420, 183); + this.PB_G4_0.Location = new System.Drawing.Point(420, 158); this.PB_G4_0.Name = "PB_G4_0"; this.PB_G4_0.Size = new System.Drawing.Size(120, 90); this.PB_G4_0.TabIndex = 458; @@ -338,7 +340,7 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(711, 306); + this.B_Save.Location = new System.Drawing.Point(722, 308); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(75, 23); this.B_Save.TabIndex = 464; @@ -346,25 +348,14 @@ private void InitializeComponent() this.B_Save.UseVisualStyleBackColor = true; this.B_Save.Click += new System.EventHandler(this.B_Save_Click); // - // B_Cancel - // - this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(711, 328); - this.B_Cancel.Name = "B_Cancel"; - this.B_Cancel.Size = new System.Drawing.Size(75, 23); - this.B_Cancel.TabIndex = 465; - this.B_Cancel.Text = "Cancel"; - this.B_Cancel.UseVisualStyleBackColor = true; - this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); - // // B_Randomize // this.B_Randomize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.B_Randomize.Location = new System.Drawing.Point(12, 320); + this.B_Randomize.Location = new System.Drawing.Point(22, 299); this.B_Randomize.Name = "B_Randomize"; - this.B_Randomize.Size = new System.Drawing.Size(75, 23); + this.B_Randomize.Size = new System.Drawing.Size(87, 35); this.B_Randomize.TabIndex = 466; - this.B_Randomize.Text = "Randomize!"; + this.B_Randomize.Text = "Randomize\nAll Starters"; this.B_Randomize.UseVisualStyleBackColor = true; this.B_Randomize.Click += new System.EventHandler(this.B_Randomize_Click); // @@ -372,7 +363,7 @@ private void InitializeComponent() // this.L_Set1.AutoSize = true; this.L_Set1.ForeColor = System.Drawing.Color.Red; - this.L_Set1.Location = new System.Drawing.Point(9, 14); + this.L_Set1.Location = new System.Drawing.Point(9, 4); this.L_Set1.Name = "L_Set1"; this.L_Set1.Size = new System.Drawing.Size(32, 13); this.L_Set1.TabIndex = 467; @@ -383,7 +374,7 @@ private void InitializeComponent() this.L_Set3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_Set3.AutoSize = true; this.L_Set3.ForeColor = System.Drawing.Color.Green; - this.L_Set3.Location = new System.Drawing.Point(416, 14); + this.L_Set3.Location = new System.Drawing.Point(416, 4); this.L_Set3.Name = "L_Set3"; this.L_Set3.Size = new System.Drawing.Size(32, 13); this.L_Set3.TabIndex = 468; @@ -395,7 +386,7 @@ private void InitializeComponent() this.L_Set4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.L_Set4.AutoSize = true; this.L_Set4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.L_Set4.Location = new System.Drawing.Point(416, 167); + this.L_Set4.Location = new System.Drawing.Point(416, 142); this.L_Set4.Name = "L_Set4"; this.L_Set4.Size = new System.Drawing.Size(32, 13); this.L_Set4.TabIndex = 469; @@ -406,7 +397,7 @@ private void InitializeComponent() // this.L_Set2.AutoSize = true; this.L_Set2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.L_Set2.Location = new System.Drawing.Point(9, 167); + this.L_Set2.Location = new System.Drawing.Point(9, 142); this.L_Set2.Name = "L_Set2"; this.L_Set2.Size = new System.Drawing.Size(32, 13); this.L_Set2.TabIndex = 470; @@ -424,15 +415,37 @@ private void InitializeComponent() // // groupBox1 // + this.groupBox1.Controls.Add(this.CHK_E); + this.groupBox1.Controls.Add(this.CHK_L); this.groupBox1.Controls.Add(this.CHK_BasicStarter); this.groupBox1.Controls.Add(this.CHK_Gen); - this.groupBox1.Location = new System.Drawing.Point(93, 306); + this.groupBox1.Location = new System.Drawing.Point(124, 280); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(153, 48); + this.groupBox1.Size = new System.Drawing.Size(153, 77); this.groupBox1.TabIndex = 473; this.groupBox1.TabStop = false; this.groupBox1.Text = "Randomizer Settings"; // + // CHK_E + // + this.CHK_E.AutoSize = true; + this.CHK_E.Location = new System.Drawing.Point(16, 57); + this.CHK_E.Name = "CHK_E"; + this.CHK_E.Size = new System.Drawing.Size(98, 17); + this.CHK_E.TabIndex = 476; + this.CHK_E.Text = "Event Legends"; + this.CHK_E.UseVisualStyleBackColor = true; + // + // CHK_L + // + this.CHK_L.AutoSize = true; + this.CHK_L.Location = new System.Drawing.Point(16, 43); + this.CHK_L.Name = "CHK_L"; + this.CHK_L.Size = new System.Drawing.Size(98, 17); + this.CHK_L.TabIndex = 475; + this.CHK_L.Text = "Game Legends"; + this.CHK_L.UseVisualStyleBackColor = true; + // // CHK_BasicStarter // this.CHK_BasicStarter.AutoSize = true; @@ -445,6 +458,17 @@ private void InitializeComponent() this.CHK_BasicStarter.Text = "Basic Starter Pokémon"; this.CHK_BasicStarter.UseVisualStyleBackColor = true; // + // B_Cancel + // + this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Cancel.Location = new System.Drawing.Point(722, 330); + this.B_Cancel.Name = "B_Cancel"; + this.B_Cancel.Size = new System.Drawing.Size(75, 23); + this.B_Cancel.TabIndex = 465; + this.B_Cancel.Text = "Cancel"; + this.B_Cancel.UseVisualStyleBackColor = true; + this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); + // // StarterEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -534,7 +558,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_G4_0; private System.Windows.Forms.PictureBox PB_G4_0; private System.Windows.Forms.Button B_Save; - private System.Windows.Forms.Button B_Cancel; private System.Windows.Forms.Button B_Randomize; private System.Windows.Forms.Label L_Set1; private System.Windows.Forms.Label L_Set3; @@ -543,5 +566,8 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Gen; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox CHK_BasicStarter; + private System.Windows.Forms.CheckBox CHK_E; + private System.Windows.Forms.CheckBox CHK_L; + private System.Windows.Forms.Button B_Cancel; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index 1b1a353a8c..90145c1599 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -160,8 +160,8 @@ private void B_Randomize_Click(object sender, EventArgs e) G5 = !CHK_Gen.Checked || gen == 5, G6 = !CHK_Gen.Checked || gen == 6, - L = false, - E = false, + L = CHK_L.Checked, + E = CHK_E.Checked, Shedinja = false, }; rand.Initialize(); @@ -175,7 +175,7 @@ private void B_Randomize_Click(object sender, EventArgs e) Choices[i][j].SelectedIndex = BasicStarter[basic()]; } else - Choices[i][j].SelectedIndex = rand.GetRandomSpecies(oldSpecies); + Choices[i][j].SelectedIndex = rand.GetRandomSpecies(i); } } From c6db65bde3ba0b5d931ade0b84b0b43a82cc2611 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 29 Mar 2018 00:26:10 -0400 Subject: [PATCH 088/191] Misc updates (#305) --- pk3DS.Core/Legality/Legal.cs | 325 ++++++++++-------- pk3DS/Subforms/Gen6/RSTE.cs | 11 +- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 14 +- 3 files changed, 201 insertions(+), 149 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 187b7e65d0..da6414f885 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -26,6 +26,11 @@ public static partial class Legal 000, // Pokémon Trainer 001, // Pokémon Trainer 004, // Leader + 018, // Team Flare + 019, // Team Flare + 020, // Team Flare + 021, // Team Flare + 022, // Team Flare 035, // Elite Four 036, // Elite Four 037, // Elite Four @@ -45,10 +50,19 @@ public static partial class Legal 065, // Battle Chatelaine 066, // Battle Chatelaine 067, // Battle Chatelaine + 081, // Team Flare 102, // Pokémon Trainer 103, // Pokémon Trainer 104, // Pokémon Trainer 105, // Pokémon Professor + 139, // Marchioness + 140, // Marquis + 141, // Marchioness + 142, // Marquis + 143, // Marquis + 144, // Marchioness + 145, // Marchioness + 146, // Marquis 151, // Grand Duchess 160, // Pokémon Trainer 161, // Pokémon Trainer @@ -72,7 +86,12 @@ public static partial class Legal 127, // Pokémon Trainer 128, // Pokémon Trainer 174, // Aqua Leader + 175, // Aqua Admin 178, // Magma Leader + 180, // Magma Admin + 182, // Magma Admin + 186, // Aqua Admin + 187, // Magma Admin 192, // Pokémon Trainer 194, // Elite Four 195, // Elite Four @@ -88,9 +107,11 @@ public static partial class Legal 206, // Leaders 207, // Leader 219, // Pokémon Trainer + 221, // Lorekeeper 232, // Pokémon Trainer 233, // Pokémon Trainer 234, // Pokémon Trainer + 236, // Secret Base Expert 267, // Pokémon Trainer 268, // Sootopolitan 270, // Pokémon Trainer @@ -107,153 +128,183 @@ public static partial class Legal }; public static readonly int[] SpecialClasses_SM = { - 030, // Pokémon Trainer: Hau - 031, // Island Kahuna: Hala - 038, // Captain: Ilima - 042, // Trial Guide: Ben - 044, // Captain: Lana - 045, // Captain: Mallow - 049, // Island Kahuna: Olivia - 051, // Island Kahuna: Hapu - 071, // Aether President: Lusamine - 072, // Aether Branch Chief: Faba - 076, // Team Skull Boss: Guzma - 078, // Team Skull Admin: Plumeria - 079, // Pokémon Trainer: Plumeria - 080, // Elite Four: Kahili - 081, // Pokémon Trainer: [~ 157] - 082, // Aether President: Lusamine - 083, // Pokémon Trainer: Red - 084, // Pokémon Trainer: Blue - 085, // Pokémon Trainer: Sina - 086, // Pokémon Trainer: Dexio - 088, // Pokémon Trainer: Anabel - 092, // Pro Wrestler: The Royal - 093, // Pokémon Trainer: Molayne - 099, // Pokémon Trainer: Molayne - 100, // Pokémon Trainer: Hau - 101, // Pokémon Trainer: Hau - 102, // Pokémon Trainer: Gladion - 103, // Pokémon Trainer: Gladion - 107, // Elite Four: Acerola - 109, // Elite Four: Hala - 110, // Elite Four: Olivia - 111, // Pokémon Professor: Kukui - 139, // GAME FREAK: Morimoto - 141, // Island Kahuna: Nanu - 142, // Captain: Sophocles - 143, // Pokémon Trainer: Ryuki - 153, // Captain: Mina - 162, // Aether Foundation: Faba - 164, // Island Kahuna: Hapu - 165, // Pokémon Professor: Kukui - 185, // Aether Foundation: Faba + #region Classes + 000, // Pokémon Trainer + 001, // Pokémon Trainer + 030, // Pokémon Trainer + 031, // Island Kahuna + 038, // Captain + 040, // Pokémon Trainer + 041, // Pokémon Trainer + 043, // Captain + 044, // Captain + 045, // Captain + 046, // Captain + 047, // Captain + 048, // Captain + 049, // Island Kahuna + 050, // Island Kahuna + 051, // Island Kahuna + 071, // Aether President + 072, // Aether Branch Chief + 076, // Team Skull Boss + 077, // Pokémon Trainer + 078, // Team Skull Admin + 079, // Pokémon Trainer + 080, // Elite Four + 081, // Pokémon Trainer + 082, // Aether President + 083, // Pokémon Trainer + 084, // Pokémon Trainer + 085, // Pokémon Trainer + 086, // Pokémon Trainer + 087, // Pokémon Trainer + 088, // Pokémon Trainer + 089, // Pokémon Trainer + 090, // Pokémon Trainer + 091, // Pokémon Trainer + 092, // Pro Wrestler + 093, // Pokémon Trainer + 097, // Pokémon Trainer + 098, // Pokémon Trainer + 099, // Pokémon Trainer + 100, // Pokémon Trainer + 101, // Pokémon Trainer + 102, // Pokémon Trainer + 103, // Pokémon Trainer + 104, // Pokémon Trainer + 105, // Pokémon Trainer + 106, // Pokémon Trainer + 107, // Elite Four + 108, // Pokémon Trainer + 109, // Elite Four + 110, // Elite Four + 111, // Pokémon Professor + 128, // Pokémon Trainer + 139, // GAME FREAK + 140, // Pokémon Trainer + 141, // Island Kahuna + 142, // Captain + 143, // Pokémon Trainer + 150, // Pokémon Trainer + 153, // Captain + 154, // Pokémon Professor + 164, // Island Kahuna + 166, // Pokémon Trainer + 167, // Pokémon Trainer + 168, // Pokémon Trainer + 169, // Pokémon Trainer + 170, // Pokémon Trainer + 171, // Pokémon Trainer + 165, // Pokémon Professor + 183, // Battle Legend + 184, // Battle Legend + #endregion }; public static readonly int[] SpecialClasses_USUM = { - 030, // Pokémon Trainer: Hau - 031, // Island Kahuna: Hala - 038, // Captain: Ilima - 042, // Trial Guide: Ben - 044, // Captain: Lana - 045, // Captain: Mallow - 049, // Island Kahuna: Olivia - 051, // Island Kahuna: Hapu - 071, // Aether President: Lusamine - 072, // Aether Branch Chief: Faba - 076, // Team Skull Boss: Guzma - 078, // Team Skull Admin: Plumeria - 079, // Pokémon Trainer: Plumeria - 080, // Elite Four: Kahili - 081, // Pokémon Trainer: [~ 157] - 082, // Aether President: Lusamine - 083, // Pokémon Trainer: Red - 084, // Pokémon Trainer: Blue - 085, // Pokémon Trainer: Sina - 086, // Pokémon Trainer: Dexio - 088, // Pokémon Trainer: Anabel - 092, // Pro Wrestler: The Royal - 093, // Pokémon Trainer: Molayne - 099, // Pokémon Trainer: Molayne - 100, // Pokémon Trainer: Hau - 101, // Pokémon Trainer: Hau - 102, // Pokémon Trainer: Gladion - 103, // Pokémon Trainer: Gladion - 107, // Elite Four: Acerola - 109, // Elite Four: Hala - 110, // Elite Four: Olivia - 111, // Pokémon Professor: Kukui - 139, // GAME FREAK: Morimoto - 140, // Pokémon Trainer: Guzma - 141, // Island Kahuna: Nanu - 142, // Captain: Sophocles - 143, // Pokémon Trainer: Ryuki - 153, // Captain: Mina - 162, // Aether Foundation: Faba - 164, // Island Kahuna: Hapu - 165, // Pokémon Professor: Kukui - 185, // Aether Foundation: Faba - 186, // Pokémon Trainer: Sophocles - 187, // Pokémon Trainer: Giovanni - 188, // Pokémon Trainer: Kukui - 189, // Pokémon Trainer: Lillie - 190, // Pokémon Trainer: Giovanni - 191, // Elite Four: Molayne - 192, // Ultra Recon Squad: Soliera - 193, // Ultra Recon Squad: Dulse - 194, // Pokémon Trainer: Hau - 198, // Team Aqua: Archie - 199, // Team Galactic: Cyrus - 200, // Team Magma: Maxie - 201, // Team Plasma: Ghetsis - 202, // Team Flare: Lysandre - 204, // Kantonian Gym: Leader - 205, // GAME FREAK: Iwao - 206, // Team Rainbow Rocket: Giovanni - 207, // Pokémon Trainer: Lillie - 219, // Pokémon Trainer: Guzma - 220, // Aether President: Lusamine - 221, // Pokémon Trainer: Hau - 222, // Pokémon Trainer: Hau + #region Classes + 000, // Pokémon Trainer + 001, // Pokémon Trainer + 030, // Pokémon Trainer + 031, // Island Kahuna + 038, // Captain + 040, // Pokémon Trainer + 041, // Pokémon Trainer + 043, // Captain + 044, // Captain + 045, // Captain + 046, // Captain + 047, // Captain + 048, // Captain + 049, // Island Kahuna + 050, // Island Kahuna + 051, // Island Kahuna + 071, // Aether President + 072, // Aether Branch Chief + 076, // Team Skull Boss + 077, // Pokémon Trainer + 078, // Team Skull Admin + 079, // Pokémon Trainer + 080, // Elite Four + 081, // Pokémon Trainer + 082, // Aether President + 083, // Pokémon Trainer + 084, // Pokémon Trainer + 085, // Pokémon Trainer + 086, // Pokémon Trainer + 087, // Pokémon Trainer + 088, // Pokémon Trainer + 089, // Pokémon Trainer + 090, // Pokémon Trainer + 091, // Pokémon Trainer + 092, // Pro Wrestler + 093, // Pokémon Trainer + 097, // Pokémon Trainer + 098, // Pokémon Trainer + 099, // Pokémon Trainer + 100, // Pokémon Trainer + 101, // Pokémon Trainer + 102, // Pokémon Trainer + 103, // Pokémon Trainer + 104, // Pokémon Trainer + 105, // Pokémon Trainer + 106, // Pokémon Trainer + 107, // Elite Four + 108, // Pokémon Trainer + 109, // Elite Four + 110, // Elite Four + 111, // Pokémon Professor + 128, // Pokémon Trainer + 139, // GAME FREAK + 140, // Pokémon Trainer + 141, // Island Kahuna + 142, // Captain + 143, // Pokémon Trainer + 150, // Pokémon Trainer + 153, // Captain + 154, // Pokémon Professor + 164, // Island Kahuna + 166, // Pokémon Trainer + 167, // Pokémon Trainer + 168, // Pokémon Trainer + 169, // Pokémon Trainer + 170, // Pokémon Trainer + 171, // Pokémon Trainer + 165, // Pokémon Professor + 183, // Battle Legend + 184, // Battle Legend + 186, // Pokémon Trainer + 187, // Pokémon Trainer + 188, // Pokémon Trainer + 189, // Pokémon Trainer + 190, // Pokémon Trainer + 191, // Elite Four + 192, // Ultra Recon Squad + 193, // Ultra Recon Squad + 194, // Pokémon Trainer + 198, // Team Aqua + 199, // Team Galactic + 200, // Team Magma + 201, // Team Plasma + 202, // Team Flare + 205, // GAME FREAK + 206, // Team Rainbow Rocket + 207, // Pokémon Trainer + 219, // Pokémon Trainer + 220, // Aether President + 221, // Pokémon Trainer + 222, // Pokémon Trainer + #endregion }; public static readonly int[] Model_XY = { - 018, // Team Flare (Aliana) - 019, // Team Flare (Bryony) - 020, // Team Flare (Celosia) - 021, // Team Flare (Mable) - 022, // Team Flare (Xerosic) - 055, // Pokémon Trainer (Shauna) - 056, // Pokémon Trainer (Tierno) - 057, // Pokémon Trainer (Trevor) - 077, // Team Flare (Admin) - 078, // Team Flare (Admin) - 079, // Team Flare (Grunt) - 080, // Team Flare (Grunt) - 102, // Pokémon Trainer (AZ) - 103, // Pokémon Trainer (Calem) - 104, // Pokémon Trainer (Serena) - 105, // Pokémon Profoessor (Sycamore) - 175, // Team Flare Boss (Lysandre) + 018, 019, 020, 021, 022, 055, 056, 057, 077, 078, 079, 080, 081, 102, 103, 104, 105, 107, 108, 173, 174, 175 }; public static readonly int[] Model_AO = { - 127, // Pokémon Trainer (Brendan) - 128, // Pokémon Trainer (May) - 174, // Aqua Leader (Archie) - 178, // Magma Leader (Maxie) - 198, // Champion (Steven) - 221, // Lorekeeper (Zinnia) - 272, // Pokémon Trainer (Wally) - }; - public static readonly int[] TrainerClasses_AO = - { - 064, 065, 066, 067, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279 + 127, 128, 174, 178, 192, 198, 219, 272, 277 }; public static readonly int[] Z_Moves = { diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 6eb4b6c1b5..2576d46e6f 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -24,7 +24,6 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); rModelRestricted = Main.Config.ORAS ? Legal.Model_AO : Legal.Model_XY; - rTrainerClasses = Legal.TrainerClasses_AO; rFinalEvo = Legal.FinalEvolutions_6; InitializeComponent(); @@ -532,7 +531,6 @@ private void Setup() public static int rDMGCount, rSTABCount; private int[] mEvoTypes; private static int[] rModelRestricted; - private static int[] rTrainerClasses; private static int[] rFinalEvo; private string[] rImportant; private readonly List Tags = new List(); @@ -754,22 +752,15 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) rClass // Classes selected to be randomized && (!rOnlySingles || t.BattleType == 0) // Nonsingles only get changed if rOnlySingles && !rIgnoreClass.Contains(t.Class) // Current class isn't a special class - && Main.Config.XY ) { int randClass() => (int)(rnd32() % trClass.Length); int rv; do { rv = randClass(); } // Ensure the Random Class isn't an exclusive class while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~")); // don't allow disallowed classes + if (Main.Config.ORAS && (rv >= 0 && rv <= 126)) return; // disallow XY classes in ORAS t.Class = rv; } - else if (rClass && Main.Config.ORAS) // special handling, can't allow XY classes - { - int randClass() => (int)(rnd32() % rTrainerClasses.Length); - if (rOnlySingles && t.BattleType != 0) return; // only singles if specified - if (rIgnoreClass.Contains(t.Class) && rTrainerClasses.Contains(t.Class)) return; // don't change important trainers if specified - t.Class = rTrainerClasses[randClass()]; - } } private static void RandomizeTrainerPrizeItem(trdata6 t) { diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 734a53646b..64311d90c2 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -465,6 +465,7 @@ private void B_Starters_Click(object sender, EventArgs e) var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var items = Randomizer.getRandomItemList(); + int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 621 }).ToArray(); // Assign Species for (int i = 0; i < 3; i++) @@ -494,7 +495,11 @@ private void B_Starters_Click(object sender, EventArgs e) t.ShinyLock = false; if (CHK_SpecialMove.Checked) - t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none + { + int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); + if (banned.Contains(rv)) continue; // disallow banned moves + t.SpecialMove = rv; + } if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H @@ -521,6 +526,7 @@ private void B_RandAll_Click(object sender, EventArgs e) var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); + int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 621 }).ToArray(); int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); @@ -549,7 +555,11 @@ private void B_RandAll_Click(object sender, EventArgs e) t.ShinyLock = false; if (CHK_SpecialMove.Checked) - t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none + { + int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); + if (banned.Contains(rv)) continue; // disallow banned moves + t.SpecialMove = rv; + } if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H From 06da50b2ab0719b3f09d10f96fe6edcca5cc8d5d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 29 Mar 2018 18:21:27 -0400 Subject: [PATCH 089/191] Fix mega gift randomization (#307) --- pk3DS/Subforms/Gen6/GiftEditor6.cs | 12 ++++++------ pk3DS/Subforms/Gen6/RSTE.cs | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index a3797f8a2c..7caaf3251a 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -231,12 +231,12 @@ private void B_RandAll_Click(object sender, EventArgs e) continue; // skip Lucario, battle needs to Mega Evolve int[] items = GetRandomMega(out species); + NUD_Form.Value = 0; CB_HeldItem.SelectedIndex = items[Util.rand.Next(0, items.Length)]; } else { species = specrand.GetRandomSpecies(species); - if (CHK_Item.Checked) CB_HeldItem.SelectedIndex = helditems[Util.rnd32() % helditems.Length]; } @@ -244,9 +244,6 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_AllowMega.Checked) formrand.AllowMega = true; - if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex)) && NUD_Form.Value > 0) - NUD_Form.Value = 0; // don't allow Mega Stone Gifts to be form 1 - if (CHK_RemoveShinyLock.Checked) CHK_ShinyLock.Checked = false; @@ -266,6 +263,9 @@ private void B_RandAll_Click(object sender, EventArgs e) NUD_Form.Value = formrand.GetRandomForme(species); CB_Gender.SelectedIndex = 0; // random CB_Nature.SelectedIndex = 0; // random + + if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex)) && NUD_Form.Value != 0) + NUD_Form.Value = 0; // don't allow mega gifts to be form 1 } WinFormsUtil.Alert("Randomized all Gift Pokémon according to specification!"); } @@ -302,6 +302,8 @@ private int[] GetRandomMega(out int species) {310, new[] {682}}, // Manectric @ Manectite {354, new[] {668}}, // Banette @ Banettite {359, new[] {677}}, // Absol @ Absolite + {380, new[] {684}}, // Latias @ Latiasite + {381, new[] {685}}, // Latios @ Latiosite {445, new[] {683}}, // Garchomp @ Garchompite {448, new[] {673}}, // Lucario @ Lucarionite {460, new[] {674}}, // Abomasnow @ Abomasite @@ -321,8 +323,6 @@ private int[] GetRandomMega(out int species) {362, new[] {763}}, // Glalie @ Glalitite {373, new[] {769}}, // Salamence @ Salamencite {376, new[] {758}}, // Metagross @ Metagrossite - {380, new[] {684}}, // Latias @ Latiasite - {381, new[] {685}}, // Latios @ Latiosite {428, new[] {768}}, // Lopunny @ Lopunnite {475, new[] {756}}, // Gallade @ Galladite {531, new[] {757}}, // Audino @ Audinite diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 2576d46e6f..95c9179235 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -725,15 +725,14 @@ private static void InitializeTrainerTeamInfo(trdata6 t, bool important) // Copy the last slot to random pokemon int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) - t.NumPokemon = 6; Array.Resize(ref t.Team, t.NumPokemon); for (int f = lastPKM + 1; f < t.NumPokemon; f++) { - t.Team[f] = // clone last pkm then increment level by 1 + t.Team[f] = // clone last pkm, keeping an average level for all 6 new trdata6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) { - Level = (ushort) Math.Min(t.Team[f - 1].Level + 1, 100) + Level = t.Team[f - 1].Level }; } } From 9460586f8a3e690c45a53a1133e88c6dff427048 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 31 Mar 2018 14:46:11 -0700 Subject: [PATCH 090/191] add sarc dump pretty janky --- pk3DS/ARCUtil.cs | 2 +- pk3DS/Tools/ToolsUI.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pk3DS/ARCUtil.cs b/pk3DS/ARCUtil.cs index a84c6d6f0d..9cea5b8708 100644 --- a/pk3DS/ARCUtil.cs +++ b/pk3DS/ARCUtil.cs @@ -10,7 +10,7 @@ namespace pk3DS.ARCUtil { public static class ARC { - private static SARC analyzeSARC(string path) + public static SARC analyzeSARC(string path) { try { return new SARC(path); } catch { return new SARC(); } diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index 0773dbfd27..34fba128d0 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -205,6 +205,15 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa if (!r) { WinFormsUtil.Alert("Unpacking failed."); } } + else if (ARC.analyzeSARC(path).Valid) + { + var sarc = ARC.analyzeSARC(path); + Console.WriteLine($"New SARC with {sarc.SFAT.EntryCount} files."); + foreach (var z in sarc.Dump(path)) + { + + } + } else if (!recursing) { WinFormsUtil.Alert("File is not a darc or a mini packed file:" + Environment.NewLine + path);;} From 02fe63e33e0b3ecd3a9da97594c5be6e0c93ebef Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 1 Apr 2018 16:38:13 -0400 Subject: [PATCH 091/191] Update Mart6 tags (#308) --- pk3DS/Subforms/Gen6/MartEditor6.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pk3DS/Subforms/Gen6/MartEditor6.cs b/pk3DS/Subforms/Gen6/MartEditor6.cs index 10d38fdd55..fe2a658c20 100644 --- a/pk3DS/Subforms/Gen6/MartEditor6.cs +++ b/pk3DS/Subforms/Gen6/MartEditor6.cs @@ -55,8 +55,8 @@ private static int GetDataOffset(byte[] data) ? new byte[] // ORAS { 3, 10, 14, 17, 18, 19, 19, 19, 19, // General - 3, // Unused - 7, 6, 4, 3, 8, + 1, + 9, 6, 4, 3, 8, 8, 3, 3, 4, 3, 6, 8, 5, 4 @@ -81,9 +81,9 @@ private static int GetDataOffset(byte[] data) readonly string[] locations = Main.Config.ORAS ? new[] // ORAS - { - "No Badges", "1 Badge", "2 Badges", "3 Badges", "4 Badges", "5 Badges", "6 Badges", "7 Badges", "8 Badges", - "Unused", + { + "No Badges [After Pokédex]", "1 Badge", "2 Badges", "3 Badges", "4 Badges", "5 Badges", "6 Badges", "7 Badges", "8 Badges", + "No Badges [Before Pokédex]", "Slateport Market [Incenses]", "Slateport Market [Vitamins]", "Slateport Market [TMs]", "Rustboro City [Poké Balls]", "Slateport City [X Items]", "Mauville City [TMs]", "Verdanturf Town [Poké Balls]", "Fallarbor Town [Poké Balls]", "Lavaridge Town [Herbs]", "Lilycove Dept Store, 2F Left [Run Away Items]", "Lilycove Dept Store, 3F Left [Vitamins]", "Lilycove Dept Store, 3F Right [X Items]", @@ -180,7 +180,7 @@ private void B_Randomize_Click(object sender, EventArgs e) Util.Shuffle(validItems); bool specialOnly = DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize only special marts?", "Will leave regular necessities intact."); - int start = specialOnly ? 9 : 0; + int start = specialOnly ? 10 : 0; for (int i = start; i < CB_Location.Items.Count; i++) { CB_Location.SelectedIndex = i; From c72b1a572322732a0863f27b45a847bb71e94ad0 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 2 Apr 2018 15:48:28 -0400 Subject: [PATCH 092/191] Misc fixes (#310) --- pk3DS.Core/Legality/Legal.cs | 2 +- pk3DS.Core/Randomizers/EvolutionRandomizer.cs | 10 ++-------- pk3DS/Subforms/Gen6/MartEditor6.cs | 18 +++++++++--------- pk3DS/Subforms/Gen6/RSTE.cs | 3 +-- pk3DS/Subforms/Gen7/MartEditor7.cs | 6 +++--- pk3DS/Subforms/Gen7/MartEditor7UU.cs | 8 ++++---- 6 files changed, 20 insertions(+), 27 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index da6414f885..d1f5a9feb6 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -304,7 +304,7 @@ public static partial class Legal }; public static readonly int[] Model_AO = { - 127, 128, 174, 178, 192, 198, 219, 272, 277 + 127, 128, 174, 178, 192, 198, 219, 221, 267, 272, 277, 278, 279 }; public static readonly int[] Z_Moves = { diff --git a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs index fe5cc0b236..72d7c7bec7 100644 --- a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs +++ b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs @@ -51,19 +51,13 @@ private void Trade(EvolutionSet evo, int i) { if (Config.Generation == 6 && v.Method == 5) // Gen 6 uses Argument rather than Level { - if (i == 708 || i == 710) // Phantump/Pumpkaboo - v.Argument = 20; - else - v.Argument = 30; + v.Argument = 30; v.Method = 4; // trade -> level up } else if (Config.Generation == 7 && v.Method == 5) { - if (i == 708 || i == 710 || i == 871 || i == 872 || i == 873 || i == 876 || i == 877 || i == 878) // Phantump/Pumpkaboo forms - v.Level = 20; - else - v.Level = 30; + v.Level = 30; v.Method = 4; // trade -> level up } diff --git a/pk3DS/Subforms/Gen6/MartEditor6.cs b/pk3DS/Subforms/Gen6/MartEditor6.cs index fe2a658c20..4405aa828c 100644 --- a/pk3DS/Subforms/Gen6/MartEditor6.cs +++ b/pk3DS/Subforms/Gen6/MartEditor6.cs @@ -59,11 +59,11 @@ private static int GetDataOffset(byte[] data) 9, 6, 4, 3, 8, 8, 3, 3, 4, 3, 6, 8, - 5, 4 + 7, 4 } : new byte[] // XY { - 3, 10, 14, 17, 18, 19, 19, 19, 19, // General + 2, 11, 14, 17, 18, 19, 19, 19, 19, // General 1, // Unused 4, 10, 3, 9, 1, 1, // Misc 3, 3, // Balls @@ -82,19 +82,19 @@ private static int GetDataOffset(byte[] data) readonly string[] locations = Main.Config.ORAS ? new[] // ORAS { - "No Badges [After Pokédex]", "1 Badge", "2 Badges", "3 Badges", "4 Badges", "5 Badges", "6 Badges", "7 Badges", "8 Badges", - "No Badges [Before Pokédex]", + "No Gym Badges [After Pokédex]", "1 Gym Badge", "2 Gym Badges", "3 Gym Badges", "4 Gym Badges", "5 Gym Badges", "6 Gym Badges", "7 Gym Badges", "8 Gym Badges", + "No Gym Badges [Before Pokédex]", "Slateport Market [Incenses]", "Slateport Market [Vitamins]", "Slateport Market [TMs]", "Rustboro City [Poké Balls]", "Slateport City [X Items]", - "Mauville City [TMs]", "Verdanturf Town [Poké Balls]", "Fallarbor Town [Poké Balls]", "Lavaridge Town [Herbs]", + "Mauville City [TMs]", "Verdanturf Town [Poké Balls]", "Fallarbor Town [Poké Balls]", "Lavaridge Town [Herbs]", "Lilycove Dept Store, 2F Left [Run Away Items]", "Lilycove Dept Store, 3F Left [Vitamins]", "Lilycove Dept Store, 3F Right [X Items]", - "Lilycove Dept Store, 4F Left [Offensive TMs]", "Lilycove Dept Store, 4F Right [Defensive TMs]" + "Lilycove Dept Store, 4F Left [Offensive TMs]", "Lilycove Dept Store, 4F Right [Defensive TMs]" } : new[] // XY { - "No Badges", "1 Badge", "2 Badges", "3 Badges", "4 Badges", "5 Badges", "6 Badges", "7 Badges", "8 Badges", + "No Gym Badges", "1 Gym Badge", "2 Gym Badges", "3 Gym Badges", "4 Gym Badges", "5 Gym Badges", "6 Gym Badges", "7 Gym Badges", "8 Gym Badges", "Unused", - "Herbs", "Poké Balls", "Stones", "Incenses", "Aquacorde Town [Poké Ball]", "Aquacorde Town [Potion]", - "Lumiose City North Boulevard [Poké Balls]", "Cyllage City [Poké Balls]", + "Lumiose City [Herboriste]", "Lumiose City [Poké Ball Boutique]", "Lumiose City [Stone Emporium]", "Coumarine City [Incenses]", "Aquacorde Town [Poké Ball]", "Aquacorde Town [Potion]", + "Lumiose City North Boulevard [Poké Balls]", "Cyllage City [Poké Balls]", "Shalour City [TMs]", "Lumiose City South Boulevard [TMs]", "Laverre City [Vitamins]", "Snowbelle City [Poké Balls]", diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 95c9179235..114f400bed 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -756,8 +756,7 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) int randClass() => (int)(rnd32() % trClass.Length); int rv; do { rv = randClass(); } // Ensure the Random Class isn't an exclusive class - while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~")); // don't allow disallowed classes - if (Main.Config.ORAS && (rv >= 0 && rv <= 126)) return; // disallow XY classes in ORAS + while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~") || Main.Config.ORAS && (rv >= 0 && rv <= 63) || (rv >= 68 && rv <= 126)); // don't allow disallowed classes t.Class = rv; } } diff --git a/pk3DS/Subforms/Gen7/MartEditor7.cs b/pk3DS/Subforms/Gen7/MartEditor7.cs index 5573dabefd..3ff8f672bb 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7.cs @@ -81,9 +81,9 @@ public MartEditor7() "Seafolk Village [TMs]", "Konikoni City [TMs]", "Konikoni City [Stones]", - "Thrifty Megamart 1 [Poké Balls]", - "Thrifty Megamart 2 [Misc]", - "Thrifty Megamart 3 [Strange Souvenir]" + "Thrifty Megamart, Left [Poké Balls]", + "Thrifty Megamart, Middle [Misc]", + "Thrifty Megamart, Right [Strange Souvenir]" }; private readonly int[] entriesBP = diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.cs b/pk3DS/Subforms/Gen7/MartEditor7UU.cs index 6f249d8bd8..564bd94c5f 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.cs @@ -62,9 +62,9 @@ public MartEditor7UU() "Seafolk Village [TMs]", "Konikoni City [TMs]", "Konikoni City [Stones]", - "Thrifty Megamart 1 [Poké Balls]", - "Thrifty Megamart 2 [Misc]", - "Thrifty Megamart 3 [Strange Souvenir]", + "Thrifty Megamart, Left [Poké Balls]", + "Thrifty Megamart, Middle [Misc]", + "Thrifty Megamart, Right [Strange Souvenir]", "Route 3 [X Items]", "Konikoni City [X Items]", "Tapu Village [X Items]", @@ -78,7 +78,7 @@ public MartEditor7UU() "Battle Tree [Trade Evolution Items]", "Battle Tree [Held Items]", "Battle Tree [Mega Stones]", - "Medicine" + "Beaches [Medicine]" }; private readonly string[] locationsTutor = { From c3ebdc7b65599b8d61a547cb439644239157311d Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 9 Apr 2018 13:22:00 -0400 Subject: [PATCH 093/191] Add Metronome Mode (#313) --- .../Subforms/Gen6/LevelUpEditor6.Designer.cs | 34 +++++++++++++------ pk3DS/Subforms/Gen6/LevelUpEditor6.cs | 14 ++++++++ pk3DS/Subforms/Gen6/TMHMEditor6.cs | 7 ++-- .../Subforms/Gen7/LevelUpEditor7.Designer.cs | 34 +++++++++++++------ pk3DS/Subforms/Gen7/LevelUpEditor7.cs | 14 ++++++++ pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 2 +- pk3DS/Subforms/Gen7/TMEditor7.cs | 2 +- 7 files changed, 82 insertions(+), 25 deletions(-) diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs index f2c0cc0455..3c0a70d40d 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs @@ -48,6 +48,7 @@ private void InitializeComponent() this.CHK_STAB = new System.Windows.Forms.CheckBox(); this.CHK_HMs = new System.Windows.Forms.CheckBox(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); + this.B_Metronome = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Moves)).BeginInit(); @@ -64,7 +65,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgv.Location = new System.Drawing.Point(12, 41); + this.dgv.Location = new System.Drawing.Point(4, 41); this.dgv.Name = "dgv"; this.dgv.Size = new System.Drawing.Size(282, 359); this.dgv.TabIndex = 0; @@ -74,7 +75,7 @@ private void InitializeComponent() this.CB_Species.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Species.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Species.FormattingEnabled = true; - this.CB_Species.Location = new System.Drawing.Point(66, 12); + this.CB_Species.Location = new System.Drawing.Point(58, 12); this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; @@ -83,7 +84,7 @@ private void InitializeComponent() // L_Species // this.L_Species.AutoSize = true; - this.L_Species.Location = new System.Drawing.Point(12, 15); + this.L_Species.Location = new System.Drawing.Point(4, 15); this.L_Species.Name = "L_Species"; this.L_Species.Size = new System.Drawing.Size(48, 13); this.L_Species.TabIndex = 2; @@ -92,9 +93,9 @@ private void InitializeComponent() // B_RandAll // this.B_RandAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.B_RandAll.Location = new System.Drawing.Point(300, 10); + this.B_RandAll.Location = new System.Drawing.Point(292, 10); this.B_RandAll.Name = "B_RandAll"; - this.B_RandAll.Size = new System.Drawing.Size(95, 23); + this.B_RandAll.Size = new System.Drawing.Size(103, 23); this.B_RandAll.TabIndex = 4; this.B_RandAll.Text = "Randomize!"; this.B_RandAll.UseVisualStyleBackColor = true; @@ -102,7 +103,7 @@ private void InitializeComponent() // // B_Dump // - this.B_Dump.Location = new System.Drawing.Point(248, 10); + this.B_Dump.Location = new System.Drawing.Point(240, 10); this.B_Dump.Name = "B_Dump"; this.B_Dump.Size = new System.Drawing.Size(46, 23); this.B_Dump.TabIndex = 5; @@ -127,9 +128,9 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.NUD_STAB); this.groupBox1.Controls.Add(this.CHK_STAB); this.groupBox1.Controls.Add(this.CHK_HMs); - this.groupBox1.Location = new System.Drawing.Point(300, 39); + this.groupBox1.Location = new System.Drawing.Point(296, 65); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(95, 362); + this.groupBox1.Size = new System.Drawing.Size(95, 343); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Options"; @@ -141,7 +142,7 @@ private void InitializeComponent() this.CHK_NoFixedDamage.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_NoFixedDamage.Location = new System.Drawing.Point(5, 271); this.CHK_NoFixedDamage.Name = "CHK_NoFixedDamage"; - this.CHK_NoFixedDamage.Size = new System.Drawing.Size(68, 43); + this.CHK_NoFixedDamage.Size = new System.Drawing.Size(95, 69); this.CHK_NoFixedDamage.TabIndex = 14; this.CHK_NoFixedDamage.Text = "No Fixed\nDamage\nMoves\n(Dragon Rage\n+ Sonic Boom)"; this.CHK_NoFixedDamage.UseVisualStyleBackColor = true; @@ -292,17 +293,29 @@ private void InitializeComponent() // // PB_MonSprite // - this.PB_MonSprite.Location = new System.Drawing.Point(193, 5); + this.PB_MonSprite.Location = new System.Drawing.Point(185, 5); this.PB_MonSprite.Name = "PB_MonSprite"; this.PB_MonSprite.Size = new System.Drawing.Size(40, 30); this.PB_MonSprite.TabIndex = 90; this.PB_MonSprite.TabStop = false; // + // B_Metronome + // + this.B_Metronome.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.B_Metronome.Location = new System.Drawing.Point(292, 36); + this.B_Metronome.Name = "B_Metronome"; + this.B_Metronome.Size = new System.Drawing.Size(103, 23); + this.B_Metronome.TabIndex = 91; + this.B_Metronome.Text = "Metronome Mode"; + this.B_Metronome.UseVisualStyleBackColor = true; + this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); + // // LevelUpEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(404, 412); + this.Controls.Add(this.B_Metronome); this.Controls.Add(this.PB_MonSprite); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_Dump); @@ -350,5 +363,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox PB_MonSprite; private System.Windows.Forms.CheckBox CHK_4MovesLvl1; private System.Windows.Forms.CheckBox CHK_NoFixedDamage; + private System.Windows.Forms.Button B_Metronome; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs index d20376222a..639f3b5b38 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs @@ -157,6 +157,20 @@ private void B_RandAll_Click(object sender, EventArgs e) getList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!"); } + private void B_Metronome_Click(object sender, EventArgs e) + { + // clear all data, then only assign Metronome at Lv1 + for (int i = 0; i < CB_Species.Items.Count; i++) + { + CB_Species.SelectedIndex = i; + dgv.Rows.Clear(); + dgv.Rows.Add(); + dgv.Rows[0].Cells[0].Value = 1; + dgv.Rows[0].Cells[1].Value = movelist[118]; + } + CB_Species.SelectedIndex = 0; + WinFormsUtil.Alert("All Pokémon now only know the move Metronome!", "It is recommended that you open the Move Editor and set the Base PP for Metronome to 40."); + } private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Level Up Moves to Text File?")) diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index 87c7de3131..dc4a634962 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -165,15 +165,16 @@ private void B_RandomTM_Click(object sender, EventArgs e) int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray(); Util.Shuffle(randomMoves); - int[] hm_xy = { 15, 19, 57, 70, 127 }; // Cut, Fly, Surf, Strength, Waterfall - int[] hm_oras = { 15, 19, 57, 70, 127, 249, 291 }; // + Rock Smash, Dive + int[] hm_xy = { 015, 019, 057, 070, 127 }; // Cut, Fly, Surf, Strength, Waterfall + int[] hm_oras = { 015, 019, 057, 070, 127, 249, 291 }; // + Rock Smash, Dive int[] field = { 148, 249, 290 }; // Flash (TM70), Rock Smash (XY TM94), Secret Power (ORAS TM94) + int[] banned = { 165, 464 }; // Struggle and Hyperspace Fury int ctr = 0; for (int i = 0; i < dgvTM.Rows.Count; i++) { int val = Array.IndexOf(movelist, dgvTM.Rows[i].Cells[1].Value); - + if (banned.Contains(val)) continue; if (CHK_RandomizeField.Checked) dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; // randomize everything diff --git a/pk3DS/Subforms/Gen7/LevelUpEditor7.Designer.cs b/pk3DS/Subforms/Gen7/LevelUpEditor7.Designer.cs index 9c876c547b..1c397b33cb 100644 --- a/pk3DS/Subforms/Gen7/LevelUpEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/LevelUpEditor7.Designer.cs @@ -48,6 +48,7 @@ private void InitializeComponent() this.CHK_STAB = new System.Windows.Forms.CheckBox(); this.CHK_HMs = new System.Windows.Forms.CheckBox(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); + this.B_Metronome = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Moves)).BeginInit(); @@ -64,7 +65,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgv.Location = new System.Drawing.Point(12, 41); + this.dgv.Location = new System.Drawing.Point(4, 41); this.dgv.Name = "dgv"; this.dgv.Size = new System.Drawing.Size(282, 359); this.dgv.TabIndex = 0; @@ -74,7 +75,7 @@ private void InitializeComponent() this.CB_Species.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Species.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Species.FormattingEnabled = true; - this.CB_Species.Location = new System.Drawing.Point(66, 12); + this.CB_Species.Location = new System.Drawing.Point(58, 12); this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; @@ -83,7 +84,7 @@ private void InitializeComponent() // L_Species // this.L_Species.AutoSize = true; - this.L_Species.Location = new System.Drawing.Point(12, 15); + this.L_Species.Location = new System.Drawing.Point(4, 15); this.L_Species.Name = "L_Species"; this.L_Species.Size = new System.Drawing.Size(48, 13); this.L_Species.TabIndex = 2; @@ -92,9 +93,9 @@ private void InitializeComponent() // B_RandAll // this.B_RandAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.B_RandAll.Location = new System.Drawing.Point(300, 10); + this.B_RandAll.Location = new System.Drawing.Point(292, 10); this.B_RandAll.Name = "B_RandAll"; - this.B_RandAll.Size = new System.Drawing.Size(95, 23); + this.B_RandAll.Size = new System.Drawing.Size(103, 23); this.B_RandAll.TabIndex = 4; this.B_RandAll.Text = "Randomize!"; this.B_RandAll.UseVisualStyleBackColor = true; @@ -102,7 +103,7 @@ private void InitializeComponent() // // B_Dump // - this.B_Dump.Location = new System.Drawing.Point(248, 10); + this.B_Dump.Location = new System.Drawing.Point(240, 10); this.B_Dump.Name = "B_Dump"; this.B_Dump.Size = new System.Drawing.Size(46, 23); this.B_Dump.TabIndex = 5; @@ -127,9 +128,9 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.NUD_STAB); this.groupBox1.Controls.Add(this.CHK_STAB); this.groupBox1.Controls.Add(this.CHK_HMs); - this.groupBox1.Location = new System.Drawing.Point(300, 39); + this.groupBox1.Location = new System.Drawing.Point(296, 65); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(95, 362); + this.groupBox1.Size = new System.Drawing.Size(95, 343); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Options"; @@ -141,7 +142,7 @@ private void InitializeComponent() this.CHK_NoFixedDamage.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_NoFixedDamage.Location = new System.Drawing.Point(5, 271); this.CHK_NoFixedDamage.Name = "CHK_NoFixedDamage"; - this.CHK_NoFixedDamage.Size = new System.Drawing.Size(90, 56); + this.CHK_NoFixedDamage.Size = new System.Drawing.Size(95, 69); this.CHK_NoFixedDamage.TabIndex = 13; this.CHK_NoFixedDamage.Text = "No Fixed\nDamage\nMoves\n(Dragon Rage\n+ Sonic Boom)"; this.CHK_NoFixedDamage.UseVisualStyleBackColor = true; @@ -292,17 +293,29 @@ private void InitializeComponent() // // PB_MonSprite // - this.PB_MonSprite.Location = new System.Drawing.Point(193, 5); + this.PB_MonSprite.Location = new System.Drawing.Point(185, 5); this.PB_MonSprite.Name = "PB_MonSprite"; this.PB_MonSprite.Size = new System.Drawing.Size(40, 30); this.PB_MonSprite.TabIndex = 90; this.PB_MonSprite.TabStop = false; // + // B_Metronome + // + this.B_Metronome.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.B_Metronome.Location = new System.Drawing.Point(292, 36); + this.B_Metronome.Name = "B_Metronome"; + this.B_Metronome.Size = new System.Drawing.Size(103, 23); + this.B_Metronome.TabIndex = 92; + this.B_Metronome.Text = "Metronome Mode"; + this.B_Metronome.UseVisualStyleBackColor = true; + this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); + // // LevelUpEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(404, 412); + this.Controls.Add(this.B_Metronome); this.Controls.Add(this.PB_MonSprite); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_Dump); @@ -350,5 +363,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox PB_MonSprite; private System.Windows.Forms.CheckBox CHK_4MovesLvl1; private System.Windows.Forms.CheckBox CHK_NoFixedDamage; + private System.Windows.Forms.Button B_Metronome; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs index 6d1d75da31..d503b9ffce 100644 --- a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs +++ b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs @@ -154,6 +154,20 @@ private void B_RandAll_Click(object sender, EventArgs e) getList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!"); } + private void B_Metronome_Click(object sender, EventArgs e) + { + // clear all data, then only assign Metronome at Lv1 + for (int i = 0; i < CB_Species.Items.Count; i++) + { + CB_Species.SelectedIndex = i; + dgv.Rows.Clear(); + dgv.Rows.Add(); + dgv.Rows[0].Cells[0].Value = 1; + dgv.Rows[0].Cells[1].Value = movelist[118]; + } + CB_Species.SelectedIndex = 0; + WinFormsUtil.Alert("All Pokémon now only know the move Metronome!", "It is recommended that you open the Move Editor and set the Base PP for Metronome to 40."); + } private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Level Up Moves to Text File?")) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 64311d90c2..79d532c319 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -465,7 +465,7 @@ private void B_Starters_Click(object sender, EventArgs e) var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var items = Randomizer.getRandomItemList(); - int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 621 }).ToArray(); + int[] banned = Legal.Z_Moves.Concat(new int[] {165, 464, 621}).ToArray(); // Assign Species for (int i = 0; i < 3; i++) diff --git a/pk3DS/Subforms/Gen7/TMEditor7.cs b/pk3DS/Subforms/Gen7/TMEditor7.cs index 69109fe54c..d806bcdb4a 100644 --- a/pk3DS/Subforms/Gen7/TMEditor7.cs +++ b/pk3DS/Subforms/Gen7/TMEditor7.cs @@ -116,7 +116,7 @@ private void B_RandomTM_Click(object sender, EventArgs e) int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray(); Util.Shuffle(randomMoves); - int[] banned = Legal.Z_Moves; + int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 464, 621 }).ToArray(); int ctr = 0; for (int i = 0; i < dgvTM.Rows.Count; i++) From 6a31213402417e6a2fcb17e7e5d974c2f9c26476 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 9 Apr 2018 13:33:26 -0400 Subject: [PATCH 094/191] Add BST shuffler (#314) --- pk3DS.Core/Randomizers/PersonalRandomizer.cs | 13 + .../Subforms/Gen6/PersonalEditor6.Designer.cs | 61 +-- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 1 + .../Subforms/Gen7/PersonalEditor7.Designer.cs | 373 +++++++++--------- pk3DS/Subforms/Gen7/PersonalEditor7.cs | 1 + 5 files changed, 247 insertions(+), 202 deletions(-) diff --git a/pk3DS.Core/Randomizers/PersonalRandomizer.cs b/pk3DS.Core/Randomizers/PersonalRandomizer.cs index 48985346f6..2668832949 100644 --- a/pk3DS.Core/Randomizers/PersonalRandomizer.cs +++ b/pk3DS.Core/Randomizers/PersonalRandomizer.cs @@ -32,6 +32,7 @@ public class PersonalRandomizer : IRandomizer public bool AllowWonderGuard = true; public bool ModifyStats = true; + public bool ShuffleStats = true; public decimal StatDeviation = 25; public bool[] StatsToRandomize = { true, true, true, true, true, true }; @@ -70,6 +71,8 @@ public void Randomize(PersonalInfo z, int index) RandomizeSpecialTutors(z); if (ModifyStats) RandomizeStats(z); + if (ShuffleStats) + RandomShuffledStats(z); if (ModifyAbilities) RandomizeAbilities(z); if (ModifyEggGroup) @@ -160,6 +163,16 @@ private void RandomizeStats(PersonalInfo z) } z.Stats = stats; } + private void RandomShuffledStats(PersonalInfo z) + { + // Fiddle with Base Stats, don't muck with Shedinja. + var stats = z.Stats; + if (stats[0] == 1) + return; + for (int i = 0; i < stats.Length; i++) + Util.Shuffle(stats); + z.Stats = stats; + } private int GetRandomType() => rnd.Next(0, TypeCount); private int GetRandomEggGroup() => rnd.Next(1, eggGroupCount); diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs index 2215f1a838..f18cf769f7 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs @@ -144,6 +144,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); + this.CHK_Shuffle = new System.Windows.Forms.CheckBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -1149,6 +1150,7 @@ private void InitializeComponent() // // GB_Randomizer // + this.GB_Randomizer.Controls.Add(this.CHK_Shuffle); this.GB_Randomizer.Controls.Add(this.L_Same); this.GB_Randomizer.Controls.Add(this.NUD_Egg); this.GB_Randomizer.Controls.Add(this.CHK_WGuard); @@ -1182,7 +1184,7 @@ private void InitializeComponent() // L_Same // this.L_Same.AutoSize = true; - this.L_Same.Location = new System.Drawing.Point(216, 101); + this.L_Same.Location = new System.Drawing.Point(216, 97); this.L_Same.Name = "L_Same"; this.L_Same.Size = new System.Drawing.Size(48, 13); this.L_Same.TabIndex = 23; @@ -1190,7 +1192,7 @@ private void InitializeComponent() // // NUD_Egg // - this.NUD_Egg.Location = new System.Drawing.Point(267, 99); + this.NUD_Egg.Location = new System.Drawing.Point(267, 95); this.NUD_Egg.Name = "NUD_Egg"; this.NUD_Egg.Size = new System.Drawing.Size(46, 20); this.NUD_Egg.TabIndex = 22; @@ -1203,7 +1205,7 @@ private void InitializeComponent() // CHK_WGuard // this.CHK_WGuard.AutoSize = true; - this.CHK_WGuard.Location = new System.Drawing.Point(118, 49); + this.CHK_WGuard.Location = new System.Drawing.Point(118, 45); this.CHK_WGuard.Name = "CHK_WGuard"; this.CHK_WGuard.Size = new System.Drawing.Size(96, 17); this.CHK_WGuard.TabIndex = 10; @@ -1215,7 +1217,7 @@ private void InitializeComponent() this.CHK_Ability.AutoSize = true; this.CHK_Ability.Checked = true; this.CHK_Ability.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Ability.Location = new System.Drawing.Point(118, 34); + this.CHK_Ability.Location = new System.Drawing.Point(118, 30); this.CHK_Ability.Name = "CHK_Ability"; this.CHK_Ability.Size = new System.Drawing.Size(61, 17); this.CHK_Ability.TabIndex = 1; @@ -1228,7 +1230,7 @@ private void InitializeComponent() this.CHK_ORASTutors.AutoSize = true; this.CHK_ORASTutors.Checked = true; this.CHK_ORASTutors.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ORASTutors.Location = new System.Drawing.Point(219, 50); + this.CHK_ORASTutors.Location = new System.Drawing.Point(219, 46); this.CHK_ORASTutors.Name = "CHK_ORASTutors"; this.CHK_ORASTutors.Size = new System.Drawing.Size(120, 17); this.CHK_ORASTutors.TabIndex = 9; @@ -1240,7 +1242,7 @@ private void InitializeComponent() this.CHK_Tutors.AutoSize = true; this.CHK_Tutors.Checked = true; this.CHK_Tutors.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Tutors.Location = new System.Drawing.Point(219, 34); + this.CHK_Tutors.Location = new System.Drawing.Point(219, 30); this.CHK_Tutors.Name = "CHK_Tutors"; this.CHK_Tutors.Size = new System.Drawing.Size(94, 17); this.CHK_Tutors.TabIndex = 8; @@ -1252,7 +1254,7 @@ private void InitializeComponent() this.CHK_rSPE.AutoSize = true; this.CHK_rSPE.Checked = true; this.CHK_rSPE.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rSPE.Location = new System.Drawing.Point(51, 64); + this.CHK_rSPE.Location = new System.Drawing.Point(51, 60); this.CHK_rSPE.Name = "CHK_rSPE"; this.CHK_rSPE.Size = new System.Drawing.Size(45, 17); this.CHK_rSPE.TabIndex = 19; @@ -1264,7 +1266,7 @@ private void InitializeComponent() this.CHK_Type.AutoSize = true; this.CHK_Type.Checked = true; this.CHK_Type.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Type.Location = new System.Drawing.Point(118, 65); + this.CHK_Type.Location = new System.Drawing.Point(118, 61); this.CHK_Type.Name = "CHK_Type"; this.CHK_Type.Size = new System.Drawing.Size(55, 17); this.CHK_Type.TabIndex = 6; @@ -1276,7 +1278,7 @@ private void InitializeComponent() this.CHK_rSPD.AutoSize = true; this.CHK_rSPD.Checked = true; this.CHK_rSPD.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rSPD.Location = new System.Drawing.Point(6, 64); + this.CHK_rSPD.Location = new System.Drawing.Point(6, 60); this.CHK_rSPD.Name = "CHK_rSPD"; this.CHK_rSPD.Size = new System.Drawing.Size(47, 17); this.CHK_rSPD.TabIndex = 18; @@ -1288,7 +1290,7 @@ private void InitializeComponent() this.CHK_rSPA.AutoSize = true; this.CHK_rSPA.Checked = true; this.CHK_rSPA.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rSPA.Location = new System.Drawing.Point(51, 49); + this.CHK_rSPA.Location = new System.Drawing.Point(51, 45); this.CHK_rSPA.Name = "CHK_rSPA"; this.CHK_rSPA.Size = new System.Drawing.Size(46, 17); this.CHK_rSPA.TabIndex = 17; @@ -1298,7 +1300,7 @@ private void InitializeComponent() // L_SingleType // this.L_SingleType.AutoSize = true; - this.L_SingleType.Location = new System.Drawing.Point(115, 82); + this.L_SingleType.Location = new System.Drawing.Point(115, 78); this.L_SingleType.Name = "L_SingleType"; this.L_SingleType.Size = new System.Drawing.Size(77, 13); this.L_SingleType.TabIndex = 21; @@ -1309,7 +1311,7 @@ private void InitializeComponent() this.CHK_rDEF.AutoSize = true; this.CHK_rDEF.Checked = true; this.CHK_rDEF.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rDEF.Location = new System.Drawing.Point(6, 49); + this.CHK_rDEF.Location = new System.Drawing.Point(6, 45); this.CHK_rDEF.Name = "CHK_rDEF"; this.CHK_rDEF.Size = new System.Drawing.Size(43, 17); this.CHK_rDEF.TabIndex = 16; @@ -1321,7 +1323,7 @@ private void InitializeComponent() this.CHK_rATK.AutoSize = true; this.CHK_rATK.Checked = true; this.CHK_rATK.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rATK.Location = new System.Drawing.Point(51, 34); + this.CHK_rATK.Location = new System.Drawing.Point(51, 30); this.CHK_rATK.Name = "CHK_rATK"; this.CHK_rATK.Size = new System.Drawing.Size(42, 17); this.CHK_rATK.TabIndex = 15; @@ -1330,7 +1332,7 @@ private void InitializeComponent() // // NUD_TypePercent // - this.NUD_TypePercent.Location = new System.Drawing.Point(134, 98); + this.NUD_TypePercent.Location = new System.Drawing.Point(134, 94); this.NUD_TypePercent.Name = "NUD_TypePercent"; this.NUD_TypePercent.Size = new System.Drawing.Size(46, 20); this.NUD_TypePercent.TabIndex = 20; @@ -1345,7 +1347,7 @@ private void InitializeComponent() this.CHK_rHP.AutoSize = true; this.CHK_rHP.Checked = true; this.CHK_rHP.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rHP.Location = new System.Drawing.Point(6, 34); + this.CHK_rHP.Location = new System.Drawing.Point(6, 30); this.CHK_rHP.Name = "CHK_rHP"; this.CHK_rHP.Size = new System.Drawing.Size(41, 17); this.CHK_rHP.TabIndex = 14; @@ -1357,7 +1359,7 @@ private void InitializeComponent() this.CHK_HM.AutoSize = true; this.CHK_HM.Checked = true; this.CHK_HM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_HM.Location = new System.Drawing.Point(267, 19); + this.CHK_HM.Location = new System.Drawing.Point(267, 15); this.CHK_HM.Name = "CHK_HM"; this.CHK_HM.Size = new System.Drawing.Size(43, 17); this.CHK_HM.TabIndex = 7; @@ -1367,7 +1369,7 @@ private void InitializeComponent() // L_StatDev // this.L_StatDev.AutoSize = true; - this.L_StatDev.Location = new System.Drawing.Point(6, 82); + this.L_StatDev.Location = new System.Drawing.Point(6, 90); this.L_StatDev.Name = "L_StatDev"; this.L_StatDev.Size = new System.Drawing.Size(67, 13); this.L_StatDev.TabIndex = 4; @@ -1378,7 +1380,7 @@ private void InitializeComponent() this.CHK_TM.AutoSize = true; this.CHK_TM.Checked = true; this.CHK_TM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_TM.Location = new System.Drawing.Point(219, 19); + this.CHK_TM.Location = new System.Drawing.Point(219, 15); this.CHK_TM.Name = "CHK_TM"; this.CHK_TM.Size = new System.Drawing.Size(42, 17); this.CHK_TM.TabIndex = 0; @@ -1387,7 +1389,7 @@ private void InitializeComponent() // // NUD_StatDev // - this.NUD_StatDev.Location = new System.Drawing.Point(27, 98); + this.NUD_StatDev.Location = new System.Drawing.Point(27, 106); this.NUD_StatDev.Name = "NUD_StatDev"; this.NUD_StatDev.Size = new System.Drawing.Size(46, 20); this.NUD_StatDev.TabIndex = 3; @@ -1402,7 +1404,7 @@ private void InitializeComponent() this.CHK_Stats.AutoSize = true; this.CHK_Stats.Checked = true; this.CHK_Stats.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Stats.Location = new System.Drawing.Point(6, 19); + this.CHK_Stats.Location = new System.Drawing.Point(6, 15); this.CHK_Stats.Name = "CHK_Stats"; this.CHK_Stats.Size = new System.Drawing.Size(106, 17); this.CHK_Stats.TabIndex = 2; @@ -1415,7 +1417,7 @@ private void InitializeComponent() this.CHK_EggGroup.AutoSize = true; this.CHK_EggGroup.Checked = true; this.CHK_EggGroup.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_EggGroup.Location = new System.Drawing.Point(219, 81); + this.CHK_EggGroup.Location = new System.Drawing.Point(219, 77); this.CHK_EggGroup.Name = "CHK_EggGroup"; this.CHK_EggGroup.Size = new System.Drawing.Size(77, 17); this.CHK_EggGroup.TabIndex = 13; @@ -1427,7 +1429,7 @@ private void InitializeComponent() this.CHK_CatchRate.AutoSize = true; this.CHK_CatchRate.Checked = true; this.CHK_CatchRate.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_CatchRate.Location = new System.Drawing.Point(219, 66); + this.CHK_CatchRate.Location = new System.Drawing.Point(219, 62); this.CHK_CatchRate.Name = "CHK_CatchRate"; this.CHK_CatchRate.Size = new System.Drawing.Size(80, 17); this.CHK_CatchRate.TabIndex = 11; @@ -1439,7 +1441,7 @@ private void InitializeComponent() this.CHK_Item.AutoSize = true; this.CHK_Item.Checked = true; this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Item.Location = new System.Drawing.Point(118, 19); + this.CHK_Item.Location = new System.Drawing.Point(118, 15); this.CHK_Item.Name = "CHK_Item"; this.CHK_Item.Size = new System.Drawing.Size(76, 17); this.CHK_Item.TabIndex = 5; @@ -1474,6 +1476,18 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // + // CHK_Shuffle + // + this.CHK_Shuffle.AutoSize = true; + this.CHK_Shuffle.Checked = true; + this.CHK_Shuffle.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Shuffle.Location = new System.Drawing.Point(6, 75); + this.CHK_Shuffle.Name = "CHK_Shuffle"; + this.CHK_Shuffle.Size = new System.Drawing.Size(86, 17); + this.CHK_Shuffle.TabIndex = 24; + this.CHK_Shuffle.Text = "Shuffle Stats"; + this.CHK_Shuffle.UseVisualStyleBackColor = true; + // // PersonalEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1630,5 +1644,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_CatchRateMod; private System.Windows.Forms.Label L_CatchRateMod; private System.Windows.Forms.NumericUpDown NUD_CatchRateMod; + private System.Windows.Forms.CheckBox CHK_Shuffle; } } diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index 9518851390..7327ee5a80 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -346,6 +346,7 @@ private void B_Randomize_Click(object sender, EventArgs e) ModifyCatchRate = CHK_CatchRate.Checked, ModifyEggGroup = CHK_EggGroup.Checked, ModifyStats = CHK_Stats.Checked, + ShuffleStats = CHK_Shuffle.Checked, StatsToRandomize = rstat_boxes.Select(g => g.Checked).ToArray(), ModifyAbilities = CHK_Ability.Checked, ModifyLearnsetTM = CHK_TM.Checked, diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs index 0ceb5c4b1f..357a294ac9 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs @@ -32,6 +32,15 @@ private void InitializeComponent() this.L_Species_Precursor = new System.Windows.Forms.Label(); this.TC_Pokemon = new System.Windows.Forms.TabControl(); this.TP_General = new System.Windows.Forms.TabPage(); + this.L_WeightKG = new System.Windows.Forms.Label(); + this.L_HeightM = new System.Windows.Forms.Label(); + this.TB_Weight = new System.Windows.Forms.MaskedTextBox(); + this.TB_Height = new System.Windows.Forms.MaskedTextBox(); + this.L_Weight = new System.Windows.Forms.Label(); + this.L_Height = new System.Windows.Forms.Label(); + this.CB_ZMove = new System.Windows.Forms.ComboBox(); + this.CB_ZBaseMove = new System.Windows.Forms.ComboBox(); + this.CB_ZItem = new System.Windows.Forms.ComboBox(); this.TB_CallRate = new System.Windows.Forms.MaskedTextBox(); this.L_CallRate = new System.Windows.Forms.Label(); this.CHK_Variant = new System.Windows.Forms.CheckBox(); @@ -95,7 +104,12 @@ private void InitializeComponent() this.Label_SPE = new System.Windows.Forms.Label(); this.L_EVYield = new System.Windows.Forms.Label(); this.L_BaseStats = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.L_BaseMove = new System.Windows.Forms.Label(); + this.L_ZItem = new System.Windows.Forms.Label(); this.TP_MoveTutors = new System.Windows.Forms.TabPage(); + this.L_BeachTutors = new System.Windows.Forms.Label(); + this.CLB_BeachTutors = new System.Windows.Forms.CheckedListBox(); this.L_Special = new System.Windows.Forms.Label(); this.L_TM = new System.Windows.Forms.Label(); this.CLB_MoveTutors = new System.Windows.Forms.CheckedListBox(); @@ -116,6 +130,7 @@ private void InitializeComponent() this.CHK_NoEV = new System.Windows.Forms.CheckBox(); this.B_ModAll = new System.Windows.Forms.Button(); this.GB_Randomizer = new System.Windows.Forms.GroupBox(); + this.CHK_BeachTutors = new System.Windows.Forms.CheckBox(); this.L_Same = new System.Windows.Forms.Label(); this.NUD_Egg = new System.Windows.Forms.NumericUpDown(); this.CHK_WGuard = new System.Windows.Forms.CheckBox(); @@ -141,21 +156,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.CB_ZMove = new System.Windows.Forms.ComboBox(); - this.L_BaseMove = new System.Windows.Forms.Label(); - this.L_ZItem = new System.Windows.Forms.Label(); - this.CB_ZBaseMove = new System.Windows.Forms.ComboBox(); - this.CB_ZItem = new System.Windows.Forms.ComboBox(); - this.L_WeightKG = new System.Windows.Forms.Label(); - this.L_HeightM = new System.Windows.Forms.Label(); - this.TB_Weight = new System.Windows.Forms.MaskedTextBox(); - this.TB_Height = new System.Windows.Forms.MaskedTextBox(); - this.L_Weight = new System.Windows.Forms.Label(); - this.L_Height = new System.Windows.Forms.Label(); - this.L_BeachTutors = new System.Windows.Forms.Label(); - this.CLB_BeachTutors = new System.Windows.Forms.CheckedListBox(); - this.CHK_BeachTutors = new System.Windows.Forms.CheckBox(); + this.CHK_Shuffle = new System.Windows.Forms.CheckBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -289,6 +290,88 @@ private void InitializeComponent() this.TP_General.Text = "General Info"; this.TP_General.UseVisualStyleBackColor = true; // + // L_WeightKG + // + this.L_WeightKG.AutoSize = true; + this.L_WeightKG.Location = new System.Drawing.Point(415, 322); + this.L_WeightKG.Name = "L_WeightKG"; + this.L_WeightKG.Size = new System.Drawing.Size(19, 13); + this.L_WeightKG.TabIndex = 105; + this.L_WeightKG.Text = "kg"; + // + // L_HeightM + // + this.L_HeightM.AutoSize = true; + this.L_HeightM.Location = new System.Drawing.Point(415, 302); + this.L_HeightM.Name = "L_HeightM"; + this.L_HeightM.Size = new System.Drawing.Size(15, 13); + this.L_HeightM.TabIndex = 104; + this.L_HeightM.Text = "m"; + // + // TB_Weight + // + this.TB_Weight.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_Weight.Location = new System.Drawing.Point(381, 318); + this.TB_Weight.Mask = "000.0"; + this.TB_Weight.Name = "TB_Weight"; + this.TB_Weight.Size = new System.Drawing.Size(31, 20); + this.TB_Weight.TabIndex = 103; + this.TB_Weight.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // + // TB_Height + // + this.TB_Height.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_Height.Location = new System.Drawing.Point(381, 298); + this.TB_Height.Mask = "00.0"; + this.TB_Height.Name = "TB_Height"; + this.TB_Height.Size = new System.Drawing.Size(31, 20); + this.TB_Height.TabIndex = 102; + this.TB_Height.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // + // L_Weight + // + this.L_Weight.AutoSize = true; + this.L_Weight.Location = new System.Drawing.Point(336, 322); + this.L_Weight.Name = "L_Weight"; + this.L_Weight.Size = new System.Drawing.Size(44, 13); + this.L_Weight.TabIndex = 101; + this.L_Weight.Text = "Weight:"; + this.L_Weight.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_Height + // + this.L_Height.AutoSize = true; + this.L_Height.Location = new System.Drawing.Point(339, 302); + this.L_Height.Name = "L_Height"; + this.L_Height.Size = new System.Drawing.Size(41, 13); + this.L_Height.TabIndex = 100; + this.L_Height.Text = "Height:"; + this.L_Height.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_ZMove + // + this.CB_ZMove.FormattingEnabled = true; + this.CB_ZMove.Location = new System.Drawing.Point(177, 320); + this.CB_ZMove.Name = "CB_ZMove"; + this.CB_ZMove.Size = new System.Drawing.Size(121, 21); + this.CB_ZMove.TabIndex = 98; + // + // CB_ZBaseMove + // + this.CB_ZBaseMove.FormattingEnabled = true; + this.CB_ZBaseMove.Location = new System.Drawing.Point(177, 299); + this.CB_ZBaseMove.Name = "CB_ZBaseMove"; + this.CB_ZBaseMove.Size = new System.Drawing.Size(121, 21); + this.CB_ZBaseMove.TabIndex = 95; + // + // CB_ZItem + // + this.CB_ZItem.FormattingEnabled = true; + this.CB_ZItem.Location = new System.Drawing.Point(177, 278); + this.CB_ZItem.Name = "CB_ZItem"; + this.CB_ZItem.Size = new System.Drawing.Size(121, 21); + this.CB_ZItem.TabIndex = 94; + // // TB_CallRate // this.TB_CallRate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -917,6 +1000,33 @@ private void InitializeComponent() this.L_BaseStats.TabIndex = 1; this.L_BaseStats.Text = "Base Stats:"; // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(134, 323); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(44, 13); + this.label1.TabIndex = 99; + this.label1.Text = "Z Move"; + // + // L_BaseMove + // + this.L_BaseMove.AutoSize = true; + this.L_BaseMove.Location = new System.Drawing.Point(116, 302); + this.L_BaseMove.Name = "L_BaseMove"; + this.L_BaseMove.Size = new System.Drawing.Size(61, 13); + this.L_BaseMove.TabIndex = 97; + this.L_BaseMove.Text = "Base Move"; + // + // L_ZItem + // + this.L_ZItem.AutoSize = true; + this.L_ZItem.Location = new System.Drawing.Point(140, 281); + this.L_ZItem.Name = "L_ZItem"; + this.L_ZItem.Size = new System.Drawing.Size(37, 13); + this.L_ZItem.TabIndex = 96; + this.L_ZItem.Text = "Z Item"; + // // TP_MoveTutors // this.TP_MoveTutors.Controls.Add(this.L_BeachTutors); @@ -933,6 +1043,28 @@ private void InitializeComponent() this.TP_MoveTutors.Text = "Move Tutors"; this.TP_MoveTutors.UseVisualStyleBackColor = true; // + // L_BeachTutors + // + this.L_BeachTutors.AutoSize = true; + this.L_BeachTutors.Location = new System.Drawing.Point(298, 3); + this.L_BeachTutors.Name = "L_BeachTutors"; + this.L_BeachTutors.Size = new System.Drawing.Size(40, 13); + this.L_BeachTutors.TabIndex = 9; + this.L_BeachTutors.Text = "Tutors:"; + this.L_BeachTutors.Visible = false; + // + // CLB_BeachTutors + // + this.CLB_BeachTutors.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.CLB_BeachTutors.Enabled = false; + this.CLB_BeachTutors.FormattingEnabled = true; + this.CLB_BeachTutors.Location = new System.Drawing.Point(301, 19); + this.CLB_BeachTutors.Name = "CLB_BeachTutors"; + this.CLB_BeachTutors.Size = new System.Drawing.Size(133, 319); + this.CLB_BeachTutors.TabIndex = 8; + this.CLB_BeachTutors.Visible = false; + // // L_Special // this.L_Special.AutoSize = true; @@ -1162,9 +1294,10 @@ private void InitializeComponent() // // GB_Randomizer // - this.GB_Randomizer.Controls.Add(this.CHK_BeachTutors); + this.GB_Randomizer.Controls.Add(this.CHK_Shuffle); this.GB_Randomizer.Controls.Add(this.L_Same); this.GB_Randomizer.Controls.Add(this.NUD_Egg); + this.GB_Randomizer.Controls.Add(this.CHK_BeachTutors); this.GB_Randomizer.Controls.Add(this.CHK_WGuard); this.GB_Randomizer.Controls.Add(this.CHK_Ability); this.GB_Randomizer.Controls.Add(this.CHK_Tutors); @@ -1192,10 +1325,22 @@ private void InitializeComponent() this.GB_Randomizer.TabStop = false; this.GB_Randomizer.Text = "Randomizer Options"; // + // CHK_BeachTutors + // + this.CHK_BeachTutors.AutoSize = true; + this.CHK_BeachTutors.Checked = true; + this.CHK_BeachTutors.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_BeachTutors.Location = new System.Drawing.Point(219, 46); + this.CHK_BeachTutors.Name = "CHK_BeachTutors"; + this.CHK_BeachTutors.Size = new System.Drawing.Size(90, 17); + this.CHK_BeachTutors.TabIndex = 24; + this.CHK_BeachTutors.Text = "Beach Tutors"; + this.CHK_BeachTutors.UseVisualStyleBackColor = true; + // // L_Same // this.L_Same.AutoSize = true; - this.L_Same.Location = new System.Drawing.Point(216, 86); + this.L_Same.Location = new System.Drawing.Point(216, 97); this.L_Same.Name = "L_Same"; this.L_Same.Size = new System.Drawing.Size(48, 13); this.L_Same.TabIndex = 23; @@ -1203,7 +1348,7 @@ private void InitializeComponent() // // NUD_Egg // - this.NUD_Egg.Location = new System.Drawing.Point(267, 84); + this.NUD_Egg.Location = new System.Drawing.Point(267, 95); this.NUD_Egg.Name = "NUD_Egg"; this.NUD_Egg.Size = new System.Drawing.Size(46, 20); this.NUD_Egg.TabIndex = 22; @@ -1216,7 +1361,7 @@ private void InitializeComponent() // CHK_WGuard // this.CHK_WGuard.AutoSize = true; - this.CHK_WGuard.Location = new System.Drawing.Point(118, 49); + this.CHK_WGuard.Location = new System.Drawing.Point(118, 45); this.CHK_WGuard.Name = "CHK_WGuard"; this.CHK_WGuard.Size = new System.Drawing.Size(96, 17); this.CHK_WGuard.TabIndex = 10; @@ -1228,7 +1373,7 @@ private void InitializeComponent() this.CHK_Ability.AutoSize = true; this.CHK_Ability.Checked = true; this.CHK_Ability.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Ability.Location = new System.Drawing.Point(118, 34); + this.CHK_Ability.Location = new System.Drawing.Point(118, 30); this.CHK_Ability.Name = "CHK_Ability"; this.CHK_Ability.Size = new System.Drawing.Size(61, 17); this.CHK_Ability.TabIndex = 1; @@ -1241,7 +1386,7 @@ private void InitializeComponent() this.CHK_Tutors.AutoSize = true; this.CHK_Tutors.Checked = true; this.CHK_Tutors.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Tutors.Location = new System.Drawing.Point(219, 34); + this.CHK_Tutors.Location = new System.Drawing.Point(219, 30); this.CHK_Tutors.Name = "CHK_Tutors"; this.CHK_Tutors.Size = new System.Drawing.Size(94, 17); this.CHK_Tutors.TabIndex = 8; @@ -1253,7 +1398,7 @@ private void InitializeComponent() this.CHK_rSPE.AutoSize = true; this.CHK_rSPE.Checked = true; this.CHK_rSPE.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rSPE.Location = new System.Drawing.Point(51, 64); + this.CHK_rSPE.Location = new System.Drawing.Point(51, 60); this.CHK_rSPE.Name = "CHK_rSPE"; this.CHK_rSPE.Size = new System.Drawing.Size(45, 17); this.CHK_rSPE.TabIndex = 19; @@ -1265,7 +1410,7 @@ private void InitializeComponent() this.CHK_Type.AutoSize = true; this.CHK_Type.Checked = true; this.CHK_Type.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Type.Location = new System.Drawing.Point(118, 65); + this.CHK_Type.Location = new System.Drawing.Point(118, 61); this.CHK_Type.Name = "CHK_Type"; this.CHK_Type.Size = new System.Drawing.Size(55, 17); this.CHK_Type.TabIndex = 6; @@ -1277,7 +1422,7 @@ private void InitializeComponent() this.CHK_rSPD.AutoSize = true; this.CHK_rSPD.Checked = true; this.CHK_rSPD.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rSPD.Location = new System.Drawing.Point(6, 64); + this.CHK_rSPD.Location = new System.Drawing.Point(6, 60); this.CHK_rSPD.Name = "CHK_rSPD"; this.CHK_rSPD.Size = new System.Drawing.Size(47, 17); this.CHK_rSPD.TabIndex = 18; @@ -1289,7 +1434,7 @@ private void InitializeComponent() this.CHK_rSPA.AutoSize = true; this.CHK_rSPA.Checked = true; this.CHK_rSPA.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rSPA.Location = new System.Drawing.Point(51, 49); + this.CHK_rSPA.Location = new System.Drawing.Point(51, 45); this.CHK_rSPA.Name = "CHK_rSPA"; this.CHK_rSPA.Size = new System.Drawing.Size(46, 17); this.CHK_rSPA.TabIndex = 17; @@ -1299,7 +1444,7 @@ private void InitializeComponent() // L_SingleType // this.L_SingleType.AutoSize = true; - this.L_SingleType.Location = new System.Drawing.Point(115, 82); + this.L_SingleType.Location = new System.Drawing.Point(115, 78); this.L_SingleType.Name = "L_SingleType"; this.L_SingleType.Size = new System.Drawing.Size(77, 13); this.L_SingleType.TabIndex = 21; @@ -1310,7 +1455,7 @@ private void InitializeComponent() this.CHK_rDEF.AutoSize = true; this.CHK_rDEF.Checked = true; this.CHK_rDEF.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rDEF.Location = new System.Drawing.Point(6, 49); + this.CHK_rDEF.Location = new System.Drawing.Point(6, 45); this.CHK_rDEF.Name = "CHK_rDEF"; this.CHK_rDEF.Size = new System.Drawing.Size(43, 17); this.CHK_rDEF.TabIndex = 16; @@ -1322,7 +1467,7 @@ private void InitializeComponent() this.CHK_rATK.AutoSize = true; this.CHK_rATK.Checked = true; this.CHK_rATK.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rATK.Location = new System.Drawing.Point(51, 34); + this.CHK_rATK.Location = new System.Drawing.Point(51, 30); this.CHK_rATK.Name = "CHK_rATK"; this.CHK_rATK.Size = new System.Drawing.Size(42, 17); this.CHK_rATK.TabIndex = 15; @@ -1331,7 +1476,7 @@ private void InitializeComponent() // // NUD_TypePercent // - this.NUD_TypePercent.Location = new System.Drawing.Point(134, 98); + this.NUD_TypePercent.Location = new System.Drawing.Point(134, 94); this.NUD_TypePercent.Name = "NUD_TypePercent"; this.NUD_TypePercent.Size = new System.Drawing.Size(46, 20); this.NUD_TypePercent.TabIndex = 20; @@ -1346,7 +1491,7 @@ private void InitializeComponent() this.CHK_rHP.AutoSize = true; this.CHK_rHP.Checked = true; this.CHK_rHP.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_rHP.Location = new System.Drawing.Point(6, 34); + this.CHK_rHP.Location = new System.Drawing.Point(6, 30); this.CHK_rHP.Name = "CHK_rHP"; this.CHK_rHP.Size = new System.Drawing.Size(41, 17); this.CHK_rHP.TabIndex = 14; @@ -1358,7 +1503,7 @@ private void InitializeComponent() this.CHK_HM.AutoSize = true; this.CHK_HM.Checked = true; this.CHK_HM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_HM.Location = new System.Drawing.Point(267, 19); + this.CHK_HM.Location = new System.Drawing.Point(267, 15); this.CHK_HM.Name = "CHK_HM"; this.CHK_HM.Size = new System.Drawing.Size(43, 17); this.CHK_HM.TabIndex = 7; @@ -1368,7 +1513,7 @@ private void InitializeComponent() // L_StatDev // this.L_StatDev.AutoSize = true; - this.L_StatDev.Location = new System.Drawing.Point(6, 82); + this.L_StatDev.Location = new System.Drawing.Point(6, 90); this.L_StatDev.Name = "L_StatDev"; this.L_StatDev.Size = new System.Drawing.Size(67, 13); this.L_StatDev.TabIndex = 4; @@ -1379,7 +1524,7 @@ private void InitializeComponent() this.CHK_TM.AutoSize = true; this.CHK_TM.Checked = true; this.CHK_TM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_TM.Location = new System.Drawing.Point(219, 19); + this.CHK_TM.Location = new System.Drawing.Point(219, 15); this.CHK_TM.Name = "CHK_TM"; this.CHK_TM.Size = new System.Drawing.Size(42, 17); this.CHK_TM.TabIndex = 0; @@ -1388,7 +1533,7 @@ private void InitializeComponent() // // NUD_StatDev // - this.NUD_StatDev.Location = new System.Drawing.Point(27, 98); + this.NUD_StatDev.Location = new System.Drawing.Point(27, 106); this.NUD_StatDev.Name = "NUD_StatDev"; this.NUD_StatDev.Size = new System.Drawing.Size(46, 20); this.NUD_StatDev.TabIndex = 3; @@ -1403,7 +1548,7 @@ private void InitializeComponent() this.CHK_Stats.AutoSize = true; this.CHK_Stats.Checked = true; this.CHK_Stats.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Stats.Location = new System.Drawing.Point(6, 19); + this.CHK_Stats.Location = new System.Drawing.Point(6, 15); this.CHK_Stats.Name = "CHK_Stats"; this.CHK_Stats.Size = new System.Drawing.Size(106, 17); this.CHK_Stats.TabIndex = 2; @@ -1416,7 +1561,7 @@ private void InitializeComponent() this.CHK_EggGroup.AutoSize = true; this.CHK_EggGroup.Checked = true; this.CHK_EggGroup.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_EggGroup.Location = new System.Drawing.Point(219, 66); + this.CHK_EggGroup.Location = new System.Drawing.Point(219, 77); this.CHK_EggGroup.Name = "CHK_EggGroup"; this.CHK_EggGroup.Size = new System.Drawing.Size(77, 17); this.CHK_EggGroup.TabIndex = 13; @@ -1428,7 +1573,7 @@ private void InitializeComponent() this.CHK_CatchRate.AutoSize = true; this.CHK_CatchRate.Checked = true; this.CHK_CatchRate.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_CatchRate.Location = new System.Drawing.Point(219, 50); + this.CHK_CatchRate.Location = new System.Drawing.Point(219, 62); this.CHK_CatchRate.Name = "CHK_CatchRate"; this.CHK_CatchRate.Size = new System.Drawing.Size(80, 17); this.CHK_CatchRate.TabIndex = 11; @@ -1440,7 +1585,7 @@ private void InitializeComponent() this.CHK_Item.AutoSize = true; this.CHK_Item.Checked = true; this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Item.Location = new System.Drawing.Point(118, 19); + this.CHK_Item.Location = new System.Drawing.Point(118, 15); this.CHK_Item.Name = "CHK_Item"; this.CHK_Item.Size = new System.Drawing.Size(76, 17); this.CHK_Item.TabIndex = 5; @@ -1475,148 +1620,17 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(134, 323); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(44, 13); - this.label1.TabIndex = 99; - this.label1.Text = "Z Move"; - // - // CB_ZMove - // - this.CB_ZMove.FormattingEnabled = true; - this.CB_ZMove.Location = new System.Drawing.Point(177, 320); - this.CB_ZMove.Name = "CB_ZMove"; - this.CB_ZMove.Size = new System.Drawing.Size(121, 21); - this.CB_ZMove.TabIndex = 98; - // - // L_BaseMove - // - this.L_BaseMove.AutoSize = true; - this.L_BaseMove.Location = new System.Drawing.Point(116, 302); - this.L_BaseMove.Name = "L_BaseMove"; - this.L_BaseMove.Size = new System.Drawing.Size(61, 13); - this.L_BaseMove.TabIndex = 97; - this.L_BaseMove.Text = "Base Move"; - // - // L_ZItem - // - this.L_ZItem.AutoSize = true; - this.L_ZItem.Location = new System.Drawing.Point(140, 281); - this.L_ZItem.Name = "L_ZItem"; - this.L_ZItem.Size = new System.Drawing.Size(37, 13); - this.L_ZItem.TabIndex = 96; - this.L_ZItem.Text = "Z Item"; - // - // CB_ZBaseMove - // - this.CB_ZBaseMove.FormattingEnabled = true; - this.CB_ZBaseMove.Location = new System.Drawing.Point(177, 299); - this.CB_ZBaseMove.Name = "CB_ZBaseMove"; - this.CB_ZBaseMove.Size = new System.Drawing.Size(121, 21); - this.CB_ZBaseMove.TabIndex = 95; - // - // CB_ZItem - // - this.CB_ZItem.FormattingEnabled = true; - this.CB_ZItem.Location = new System.Drawing.Point(177, 278); - this.CB_ZItem.Name = "CB_ZItem"; - this.CB_ZItem.Size = new System.Drawing.Size(121, 21); - this.CB_ZItem.TabIndex = 94; - // - // L_WeightKG - // - this.L_WeightKG.AutoSize = true; - this.L_WeightKG.Location = new System.Drawing.Point(415, 322); - this.L_WeightKG.Name = "L_WeightKG"; - this.L_WeightKG.Size = new System.Drawing.Size(19, 13); - this.L_WeightKG.TabIndex = 105; - this.L_WeightKG.Text = "kg"; - // - // L_HeightM - // - this.L_HeightM.AutoSize = true; - this.L_HeightM.Location = new System.Drawing.Point(415, 302); - this.L_HeightM.Name = "L_HeightM"; - this.L_HeightM.Size = new System.Drawing.Size(15, 13); - this.L_HeightM.TabIndex = 104; - this.L_HeightM.Text = "m"; - // - // TB_Weight - // - this.TB_Weight.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Weight.Location = new System.Drawing.Point(381, 318); - this.TB_Weight.Mask = "000.0"; - this.TB_Weight.Name = "TB_Weight"; - this.TB_Weight.Size = new System.Drawing.Size(31, 20); - this.TB_Weight.TabIndex = 103; - this.TB_Weight.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // TB_Height + // CHK_Shuffle // - this.TB_Height.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Height.Location = new System.Drawing.Point(381, 298); - this.TB_Height.Mask = "00.0"; - this.TB_Height.Name = "TB_Height"; - this.TB_Height.Size = new System.Drawing.Size(31, 20); - this.TB_Height.TabIndex = 102; - this.TB_Height.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // L_Weight - // - this.L_Weight.AutoSize = true; - this.L_Weight.Location = new System.Drawing.Point(336, 322); - this.L_Weight.Name = "L_Weight"; - this.L_Weight.Size = new System.Drawing.Size(44, 13); - this.L_Weight.TabIndex = 101; - this.L_Weight.Text = "Weight:"; - this.L_Weight.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_Height - // - this.L_Height.AutoSize = true; - this.L_Height.Location = new System.Drawing.Point(339, 302); - this.L_Height.Name = "L_Height"; - this.L_Height.Size = new System.Drawing.Size(41, 13); - this.L_Height.TabIndex = 100; - this.L_Height.Text = "Height:"; - this.L_Height.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_ORASTutors - // - this.L_BeachTutors.AutoSize = true; - this.L_BeachTutors.Location = new System.Drawing.Point(298, 3); - this.L_BeachTutors.Name = "L_BeachTutors"; - this.L_BeachTutors.Size = new System.Drawing.Size(40, 13); - this.L_BeachTutors.TabIndex = 9; - this.L_BeachTutors.Text = "Tutors:"; - this.L_BeachTutors.Visible = false; - // - // CLB_OrasTutors - // - this.CLB_BeachTutors.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.CLB_BeachTutors.Enabled = false; - this.CLB_BeachTutors.FormattingEnabled = true; - this.CLB_BeachTutors.Location = new System.Drawing.Point(301, 19); - this.CLB_BeachTutors.Name = "CLB_BeachTutors"; - this.CLB_BeachTutors.Size = new System.Drawing.Size(133, 319); - this.CLB_BeachTutors.TabIndex = 8; - this.CLB_BeachTutors.Visible = false; - // - // CHK_ORASTutors - // - this.CHK_BeachTutors.AutoSize = true; - this.CHK_BeachTutors.Checked = true; - this.CHK_BeachTutors.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BeachTutors.Location = new System.Drawing.Point(219, 106); - this.CHK_BeachTutors.Name = "CHK_BeachTutors"; - this.CHK_BeachTutors.Size = new System.Drawing.Size(90, 17); - this.CHK_BeachTutors.TabIndex = 24; - this.CHK_BeachTutors.Text = "Beach Tutors"; - this.CHK_BeachTutors.UseVisualStyleBackColor = true; + this.CHK_Shuffle.AutoSize = true; + this.CHK_Shuffle.Checked = true; + this.CHK_Shuffle.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Shuffle.Location = new System.Drawing.Point(6, 75); + this.CHK_Shuffle.Name = "CHK_Shuffle"; + this.CHK_Shuffle.Size = new System.Drawing.Size(86, 17); + this.CHK_Shuffle.TabIndex = 25; + this.CHK_Shuffle.Text = "Shuffle Stats"; + this.CHK_Shuffle.UseVisualStyleBackColor = true; // // PersonalEditor7 // @@ -1787,5 +1801,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_BeachTutors; private System.Windows.Forms.CheckedListBox CLB_BeachTutors; private System.Windows.Forms.CheckBox CHK_BeachTutors; + private System.Windows.Forms.CheckBox CHK_Shuffle; } } diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.cs index b3e8dc5fac..02318fb271 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.cs @@ -330,6 +330,7 @@ private void B_Randomize_Click(object sender, EventArgs e) ModifyCatchRate = CHK_CatchRate.Checked, ModifyEggGroup = CHK_EggGroup.Checked, ModifyStats = CHK_Stats.Checked, + ShuffleStats = CHK_Shuffle.Checked, StatsToRandomize = rstat_boxes.Select(g => g.Checked).ToArray(), ModifyAbilities = CHK_Ability.Checked, ModifyLearnsetTM = CHK_TM.Checked, From 7fbf8b7e78b0e0c1fa487edf997bad496aedc188 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 9 Apr 2018 15:45:09 -0400 Subject: [PATCH 095/191] Add more Metronome options (#316) --- pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs | 39 ++- pk3DS/Subforms/Gen6/MoveEditor6.cs | 20 +- .../Subforms/Gen6/PersonalEditor6.Designer.cs | 59 +++-- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 35 ++- pk3DS/Subforms/Gen6/RSTE.cs | 14 +- pk3DS/Subforms/Gen6/TrainerRand.Designer.cs | 3 +- pk3DS/Subforms/Gen6/TrainerRand.cs | 1 + pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs | 41 ++-- pk3DS/Subforms/Gen7/MoveEditor7.cs | 21 +- .../Subforms/Gen7/PersonalEditor7.Designer.cs | 57 +++-- pk3DS/Subforms/Gen7/PersonalEditor7.cs | 12 +- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 3 +- pk3DS/Subforms/Gen7/SMTE.cs | 5 +- .../Gen7/StaticEncounterEditor7.Designer.cs | 229 +++++++++--------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 19 +- 15 files changed, 345 insertions(+), 213 deletions(-) diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs index c9921bc33f..9a28487603 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs @@ -90,8 +90,9 @@ private void InitializeComponent() this.L_0x21 = new System.Windows.Forms.Label(); this.B_RandAll = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.CHK_Type = new System.Windows.Forms.CheckBox(); this.CHK_Category = new System.Windows.Forms.CheckBox(); + this.CHK_Type = new System.Windows.Forms.CheckBox(); + this.B_Metronome = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).BeginInit(); @@ -804,13 +805,23 @@ private void InitializeComponent() // this.groupBox1.Controls.Add(this.CHK_Category); this.groupBox1.Controls.Add(this.CHK_Type); - this.groupBox1.Location = new System.Drawing.Point(333, 33); + this.groupBox1.Location = new System.Drawing.Point(333, 60); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(98, 342); + this.groupBox1.Size = new System.Drawing.Size(98, 55); this.groupBox1.TabIndex = 64; this.groupBox1.TabStop = false; this.groupBox1.Text = "Options"; // + // CHK_Category + // + this.CHK_Category.AutoSize = true; + this.CHK_Category.Location = new System.Drawing.Point(6, 34); + this.CHK_Category.Name = "CHK_Category"; + this.CHK_Category.Size = new System.Drawing.Size(68, 17); + this.CHK_Category.TabIndex = 1; + this.CHK_Category.Text = "Category"; + this.CHK_Category.UseVisualStyleBackColor = true; + // // CHK_Type // this.CHK_Type.AutoSize = true; @@ -821,21 +832,22 @@ private void InitializeComponent() this.CHK_Type.Text = "Type"; this.CHK_Type.UseVisualStyleBackColor = true; // - // CHK_Category + // B_Metronome // - this.CHK_Category.AutoSize = true; - this.CHK_Category.Location = new System.Drawing.Point(6, 34); - this.CHK_Category.Name = "CHK_Category"; - this.CHK_Category.Size = new System.Drawing.Size(68, 17); - this.CHK_Category.TabIndex = 1; - this.CHK_Category.Text = "Category"; - this.CHK_Category.UseVisualStyleBackColor = true; + this.B_Metronome.Location = new System.Drawing.Point(333, 33); + this.B_Metronome.Name = "B_Metronome"; + this.B_Metronome.Size = new System.Drawing.Size(98, 23); + this.B_Metronome.TabIndex = 65; + this.B_Metronome.Text = "Metronome Mode"; + this.B_Metronome.UseVisualStyleBackColor = true; + this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); // - // Moves + // MoveEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(439, 382); + this.ClientSize = new System.Drawing.Size(439, 381); + this.Controls.Add(this.B_Metronome); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_RandAll); this.Controls.Add(this.L_0x21); @@ -991,5 +1003,6 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox CHK_Category; private System.Windows.Forms.CheckBox CHK_Type; + private System.Windows.Forms.Button B_Metronome; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index 2fb130d5ef..4d00e02ed8 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -10,8 +10,6 @@ public MoveEditor6(byte[][] infiles) { files = infiles; movelist[0] = ""; - sortedmoves = (string[])movelist.Clone(); - Array.Sort(sortedmoves); InitializeComponent(); Setup(); @@ -21,7 +19,6 @@ public MoveEditor6(byte[][] infiles) private readonly string[] types = Main.Config.getText(TextName.Types); private readonly string[] moveflavor = Main.Config.getText(TextName.MoveFlavor); private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); - private readonly string[] sortedmoves; private readonly string[] MoveCategories = { "Status", "Physical", "Special", }; private readonly string[] StatCategories = { "None", "Attack", "Defense", "Special Attack", "Special Defense", "Speed", "Accuracy", "Evasion", "All", }; @@ -48,7 +45,7 @@ public MoveEditor6(byte[][] infiles) "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", }; private void Setup() { - foreach (string s in sortedmoves) CB_Move.Items.Add(s); + foreach (string s in movelist) CB_Move.Items.Add(s); foreach (string s in types) CB_Type.Items.Add(s); foreach (string s in MoveCategories) CB_Category.Items.Add(s); foreach (string s in StatCategories) CB_Stat1.Items.Add(s); @@ -192,5 +189,20 @@ private void B_RandAll_Click(object sender, EventArgs e) } WinFormsUtil.Alert("All Moves have been randomized!"); } + private void B_Metronome_Click(object sender, EventArgs e) + { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will set the Base PP for every other Move to 0!") != DialogResult.Yes) return; + + for (int i = 0; i < CB_Move.Items.Count; i++) + { + CB_Move.SelectedIndex = i; + if (CB_Move.SelectedIndex != 117) + NUD_PP.Value = 0; + if (CB_Move.SelectedIndex == 117) + NUD_PP.Value = 40; + } + CB_Move.SelectedIndex = 0; + WinFormsUtil.Alert("All Moves have had their Base PP values modified!"); + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs index f18cf769f7..64b8153c6f 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs @@ -102,7 +102,7 @@ private void InitializeComponent() this.L_ORASTutors = new System.Windows.Forms.Label(); this.L_Special = new System.Windows.Forms.Label(); this.L_TMHM = new System.Windows.Forms.Label(); - this.CLB_OrasTutors = new System.Windows.Forms.CheckedListBox(); + this.CLB_ORASTutors = new System.Windows.Forms.CheckedListBox(); this.CLB_MoveTutors = new System.Windows.Forms.CheckedListBox(); this.CLB_TMHM = new System.Windows.Forms.CheckedListBox(); this.TP_Randomizer = new System.Windows.Forms.TabPage(); @@ -118,6 +118,7 @@ private void InitializeComponent() this.CHK_NoEV = new System.Windows.Forms.CheckBox(); this.B_ModAll = new System.Windows.Forms.Button(); this.GB_Randomizer = new System.Windows.Forms.GroupBox(); + this.CHK_Shuffle = new System.Windows.Forms.CheckBox(); this.L_Same = new System.Windows.Forms.Label(); this.NUD_Egg = new System.Windows.Forms.NumericUpDown(); this.CHK_WGuard = new System.Windows.Forms.CheckBox(); @@ -144,7 +145,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.CHK_Shuffle = new System.Windows.Forms.CheckBox(); + this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -927,7 +928,7 @@ private void InitializeComponent() this.TP_MoveTutors.Controls.Add(this.L_ORASTutors); this.TP_MoveTutors.Controls.Add(this.L_Special); this.TP_MoveTutors.Controls.Add(this.L_TMHM); - this.TP_MoveTutors.Controls.Add(this.CLB_OrasTutors); + this.TP_MoveTutors.Controls.Add(this.CLB_ORASTutors); this.TP_MoveTutors.Controls.Add(this.CLB_MoveTutors); this.TP_MoveTutors.Controls.Add(this.CLB_TMHM); this.TP_MoveTutors.Location = new System.Drawing.Point(4, 22); @@ -966,17 +967,17 @@ private void InitializeComponent() this.L_TMHM.TabIndex = 5; this.L_TMHM.Text = "TM/HM:"; // - // CLB_OrasTutors + // CLB_ORASTutors // - this.CLB_OrasTutors.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.CLB_ORASTutors.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); - this.CLB_OrasTutors.Enabled = false; - this.CLB_OrasTutors.FormattingEnabled = true; - this.CLB_OrasTutors.Location = new System.Drawing.Point(301, 19); - this.CLB_OrasTutors.Name = "CLB_OrasTutors"; - this.CLB_OrasTutors.Size = new System.Drawing.Size(133, 319); - this.CLB_OrasTutors.TabIndex = 4; - this.CLB_OrasTutors.Visible = false; + this.CLB_ORASTutors.Enabled = false; + this.CLB_ORASTutors.FormattingEnabled = true; + this.CLB_ORASTutors.Location = new System.Drawing.Point(301, 19); + this.CLB_ORASTutors.Name = "CLB_ORASTutors"; + this.CLB_ORASTutors.Size = new System.Drawing.Size(133, 319); + this.CLB_ORASTutors.TabIndex = 4; + this.CLB_ORASTutors.Visible = false; // // CLB_MoveTutors // @@ -1013,6 +1014,7 @@ private void InitializeComponent() // // GB_Modifier // + this.GB_Modifier.Controls.Add(this.CHK_NoTutor); this.GB_Modifier.Controls.Add(this.CHK_CatchRateMod); this.GB_Modifier.Controls.Add(this.L_CatchRateMod); this.GB_Modifier.Controls.Add(this.NUD_CatchRateMod); @@ -1181,6 +1183,18 @@ private void InitializeComponent() this.GB_Randomizer.TabStop = false; this.GB_Randomizer.Text = "Randomizer Options"; // + // CHK_Shuffle + // + this.CHK_Shuffle.AutoSize = true; + this.CHK_Shuffle.Checked = true; + this.CHK_Shuffle.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Shuffle.Location = new System.Drawing.Point(6, 75); + this.CHK_Shuffle.Name = "CHK_Shuffle"; + this.CHK_Shuffle.Size = new System.Drawing.Size(86, 17); + this.CHK_Shuffle.TabIndex = 24; + this.CHK_Shuffle.Text = "Shuffle Stats"; + this.CHK_Shuffle.UseVisualStyleBackColor = true; + // // L_Same // this.L_Same.AutoSize = true; @@ -1476,17 +1490,15 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // CHK_Shuffle + // CHK_NoTutor // - this.CHK_Shuffle.AutoSize = true; - this.CHK_Shuffle.Checked = true; - this.CHK_Shuffle.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Shuffle.Location = new System.Drawing.Point(6, 75); - this.CHK_Shuffle.Name = "CHK_Shuffle"; - this.CHK_Shuffle.Size = new System.Drawing.Size(86, 17); - this.CHK_Shuffle.TabIndex = 24; - this.CHK_Shuffle.Text = "Shuffle Stats"; - this.CHK_Shuffle.UseVisualStyleBackColor = true; + this.CHK_NoTutor.AutoSize = true; + this.CHK_NoTutor.Location = new System.Drawing.Point(6, 95); + this.CHK_NoTutor.Name = "CHK_NoTutor"; + this.CHK_NoTutor.Size = new System.Drawing.Size(212, 17); + this.CHK_NoTutor.TabIndex = 20; + this.CHK_NoTutor.Text = "Remove All TM/HM/Tutor Compatibility"; + this.CHK_NoTutor.UseVisualStyleBackColor = true; // // PersonalEditor6 // @@ -1600,7 +1612,7 @@ private void InitializeComponent() private System.Windows.Forms.Label L_BST; private System.Windows.Forms.TextBox TB_BST; private System.Windows.Forms.CheckedListBox CLB_TMHM; - private System.Windows.Forms.CheckedListBox CLB_OrasTutors; + private System.Windows.Forms.CheckedListBox CLB_ORASTutors; private System.Windows.Forms.CheckedListBox CLB_MoveTutors; private System.Windows.Forms.Label L_ORASTutors; private System.Windows.Forms.Label L_Special; @@ -1645,5 +1657,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_CatchRateMod; private System.Windows.Forms.NumericUpDown NUD_CatchRateMod; private System.Windows.Forms.CheckBox CHK_Shuffle; + private System.Windows.Forms.CheckBox CHK_NoTutor; } } diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index 7327ee5a80..393b8ac0d3 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -119,8 +119,8 @@ private void Setup() Array.Copy(species, temp_species, temp_species.Length); species = temp_species; - CLB_OrasTutors.Visible = - CLB_OrasTutors.Enabled = + CLB_ORASTutors.Visible = + CLB_ORASTutors.Enabled = L_ORASTutors.Visible = false; CHK_ORASTutors.Visible = false; } @@ -128,16 +128,16 @@ private void Setup() { CLB_MoveTutors.Items.Add(moves[tutormoves[tutormoves.Length - 1]]); //Dragon's Ascent foreach (ushort tm in tutor1) - CLB_OrasTutors.Items.Add(moves[tm]); + CLB_ORASTutors.Items.Add(moves[tm]); foreach (ushort tm in tutor2) - CLB_OrasTutors.Items.Add(moves[tm]); + CLB_ORASTutors.Items.Add(moves[tm]); foreach (ushort tm in tutor3) - CLB_OrasTutors.Items.Add(moves[tm]); + CLB_ORASTutors.Items.Add(moves[tm]); foreach (ushort tm in tutor4) - CLB_OrasTutors.Items.Add(moves[tm]); + CLB_ORASTutors.Items.Add(moves[tm]); - CLB_OrasTutors.Visible = - CLB_OrasTutors.Enabled = + CLB_ORASTutors.Visible = + CLB_ORASTutors.Enabled = L_ORASTutors.Visible = true; } for (int i = 0; i < species.Length; i++) @@ -248,7 +248,7 @@ private void readInfo() int ctr = 0; for (int i = 0; i < len.Length; i++) for (int b = 0; b < len[i]; b++) - CLB_OrasTutors.SetItemChecked(ctr++, pkm.SpecialTutors[i][b]); + CLB_ORASTutors.SetItemChecked(ctr++, pkm.SpecialTutors[i][b]); } } private void readEntry() @@ -326,7 +326,7 @@ private void savePersonal() int ctr = 0; for (int i = 0; i < 4; i++) for (int t = 0; t < len[i]; t++) - pkm.SpecialTutors[i][t] = CLB_OrasTutors.GetItemChecked(ctr++); + pkm.SpecialTutors[i][t] = CLB_ORASTutors.GetItemChecked(ctr++); } private void saveEntry() { @@ -378,11 +378,22 @@ private void B_ModifyAll(object sender, EventArgs e) if (CHK_Growth.Checked) CB_EXPGroup.SelectedIndex = 5; if (CHK_EXP.Checked) - TB_BaseExp.Text = ((float)NUD_EXP.Value*(Convert.ToUInt16(TB_BaseExp.Text)/100f)).ToString("000"); + TB_BaseExp.Text = ((float)NUD_EXP.Value * (Convert.ToUInt16(TB_BaseExp.Text) / 100f)).ToString("000"); + + if (CHK_NoTutor.Checked) + { + // preserve HM compatiblity to ensure story progression + for (int tm = 0; tm <= 100; tm++) + CLB_TMHM.SetItemCheckState(tm, CheckState.Unchecked); + foreach (int mt in CLB_MoveTutors.CheckedIndices) + CLB_MoveTutors.SetItemCheckState(mt, CheckState.Unchecked); + foreach (int ao in CLB_ORASTutors.CheckedIndices) + CLB_ORASTutors.SetItemCheckState(ao, CheckState.Unchecked); + } if (CHK_QuickHatch.Checked) TB_HatchCycles.Text = 1.ToString(); - if(CHK_CatchRateMod.Checked) + if (CHK_CatchRateMod.Checked) TB_CatchRate.Text = ((int)NUD_CatchRateMod.Value).ToString(); } CB_Species.SelectedIndex = 1; diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 114f400bed..a16c664fbc 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -520,7 +520,7 @@ private void Setup() readFile(); } - public static bool rPKM, rSmart, rLevel, rMove, rNoMove, rForceHighPower, rAbility, rDiffAI, + public static bool rPKM, rSmart, rLevel, rMove, rMetronome, rNoMove, rForceHighPower, rAbility, rDiffAI, rDiffIV, rClass, rGift, rItem, rDoRand, rRandomMegas, rGymE4Only, rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM, rForceFullyEvolved; public static bool rNoFixedDamage; @@ -539,7 +539,7 @@ private void Setup() public static decimal rGiftPercent, rLevelMultiplier, rForceFullyEvolvedLevel, rForceHighPowerLevel; private void B_Randomize_Click(object sender, EventArgs e) { - rPKM = rMove = rAbility = rDiffAI = rDiffIV = rClass = rGift = rItem = rDoRand = false; // init to false + rPKM = rMove = rMetronome = rAbility = rDiffAI = rDiffIV = rClass = rGift = rItem = rDoRand = false; // init to false rGiftPercent = 0; rForceFullyEvolvedLevel = 0; new TrainerRand().ShowDialog(); // Open Randomizer Config to get config vals @@ -708,8 +708,16 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom pk.Moves[m] = (ushort)pkMoves[m]; } + if (rMetronome) + { + t.Moves = true; + var pkMoves = new[] { 118, 0, 0, 0 }; + for (int m = 0; m < 4; m++) + pk.Moves[m] = (ushort)pkMoves[m]; + } + // high-power attacks - if (rForceHighPower && pk.Level >= rForceHighPowerLevel) + if (rForceHighPower && pk.Level >= rForceHighPowerLevel && !rMetronome) { var pkMoves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); for (int m = 0; m < 4; m++) diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index 751dcce15c..81fc48dfd3 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -584,7 +584,8 @@ private void InitializeComponent() this.CB_Moves.Items.AddRange(new object[] { "Don\'t Modify", "Randomize All", - "Use Levelup Only"}); + "Use Levelup Only", + "Metronome Mode"}); this.CB_Moves.Location = new System.Drawing.Point(67, 223); this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(135, 21); diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index db097090b2..337d793b64 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -41,6 +41,7 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.rMove = CB_Moves.SelectedIndex == 1; RSTE.rNoMove = CB_Moves.SelectedIndex == 2; + RSTE.rMetronome = CB_Moves.SelectedIndex == 3; if (RSTE.rMove) { RSTE.rDMG = CHK_Damage.Checked; diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs index 86bce823df..e2e1f076ea 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs @@ -90,8 +90,9 @@ private void InitializeComponent() this.L_0x21 = new System.Windows.Forms.Label(); this.B_RandAll = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.CHK_Type = new System.Windows.Forms.CheckBox(); this.CHK_Category = new System.Windows.Forms.CheckBox(); + this.CHK_Type = new System.Windows.Forms.CheckBox(); + this.B_Metronome = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).BeginInit(); @@ -804,13 +805,23 @@ private void InitializeComponent() // this.groupBox1.Controls.Add(this.CHK_Category); this.groupBox1.Controls.Add(this.CHK_Type); - this.groupBox1.Location = new System.Drawing.Point(333, 33); + this.groupBox1.Location = new System.Drawing.Point(333, 60); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(98, 342); + this.groupBox1.Size = new System.Drawing.Size(98, 55); this.groupBox1.TabIndex = 64; this.groupBox1.TabStop = false; this.groupBox1.Text = "Options"; // + // CHK_Category + // + this.CHK_Category.AutoSize = true; + this.CHK_Category.Location = new System.Drawing.Point(6, 34); + this.CHK_Category.Name = "CHK_Category"; + this.CHK_Category.Size = new System.Drawing.Size(68, 17); + this.CHK_Category.TabIndex = 1; + this.CHK_Category.Text = "Category"; + this.CHK_Category.UseVisualStyleBackColor = true; + // // CHK_Type // this.CHK_Type.AutoSize = true; @@ -821,21 +832,22 @@ private void InitializeComponent() this.CHK_Type.Text = "Type"; this.CHK_Type.UseVisualStyleBackColor = true; // - // CHK_Category + // B_Metronome // - this.CHK_Category.AutoSize = true; - this.CHK_Category.Location = new System.Drawing.Point(6, 34); - this.CHK_Category.Name = "CHK_Category"; - this.CHK_Category.Size = new System.Drawing.Size(68, 17); - this.CHK_Category.TabIndex = 1; - this.CHK_Category.Text = "Category"; - this.CHK_Category.UseVisualStyleBackColor = true; + this.B_Metronome.Location = new System.Drawing.Point(333, 33); + this.B_Metronome.Name = "B_Metronome"; + this.B_Metronome.Size = new System.Drawing.Size(98, 23); + this.B_Metronome.TabIndex = 66; + this.B_Metronome.Text = "Metronome Mode"; + this.B_Metronome.UseVisualStyleBackColor = true; + this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); // - // Moves + // MoveEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(439, 382); + this.ClientSize = new System.Drawing.Size(439, 381); + this.Controls.Add(this.B_Metronome); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_RandAll); this.Controls.Add(this.L_0x21); @@ -889,7 +901,7 @@ private void InitializeComponent() this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(455, 420); this.MinimumSize = new System.Drawing.Size(355, 420); - this.Name = "MoveEditor6"; + this.Name = "MoveEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Move Editor"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); @@ -991,5 +1003,6 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox CHK_Category; private System.Windows.Forms.CheckBox CHK_Type; + private System.Windows.Forms.Button B_Metronome; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index 388ca3bf81..35b4db24dc 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -9,10 +9,7 @@ public partial class MoveEditor7 : Form public MoveEditor7(byte[][] infiles) { files = infiles; - movelist[0] = ""; - sortedmoves = (string[])movelist.Clone(); - Array.Sort(sortedmoves); InitializeComponent(); Setup(); @@ -22,7 +19,6 @@ public MoveEditor7(byte[][] infiles) private readonly string[] types = Main.Config.getText(TextName.Types); private readonly string[] moveflavor = Main.Config.getText(TextName.MoveFlavor); private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); - private readonly string[] sortedmoves; private readonly string[] MoveCategories = { "Status", "Physical", "Special", }; private readonly string[] StatCategories = { "None", "Attack", "Defense", "Special Attack", "Special Defense", "Speed", "Accuracy", "Evasion", "All", }; @@ -49,7 +45,7 @@ public MoveEditor7(byte[][] infiles) "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", }; private void Setup() { - foreach (string s in sortedmoves) CB_Move.Items.Add(s); + foreach (string s in movelist) CB_Move.Items.Add(s); foreach (string s in types) CB_Type.Items.Add(s); foreach (string s in MoveCategories) CB_Category.Items.Add(s); foreach (string s in StatCategories) CB_Stat1.Items.Add(s); @@ -193,5 +189,20 @@ private void B_RandAll_Click(object sender, EventArgs e) } WinFormsUtil.Alert("All Moves have been randomized!"); } + private void B_Metronome_Click(object sender, EventArgs e) + { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will set the Base PP for every other Move to 0!") != DialogResult.Yes) return; + + for (int i = 0; i < CB_Move.Items.Count; i++) + { + CB_Move.SelectedIndex = i; + if (CB_Move.SelectedIndex != 117) + NUD_PP.Value = 0; + if (CB_Move.SelectedIndex == 117) + NUD_PP.Value = 40; + } + CB_Move.SelectedIndex = 0; + WinFormsUtil.Alert("All Moves have had their Base PP values modified!"); + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs index 357a294ac9..eec07973ed 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs @@ -130,9 +130,10 @@ private void InitializeComponent() this.CHK_NoEV = new System.Windows.Forms.CheckBox(); this.B_ModAll = new System.Windows.Forms.Button(); this.GB_Randomizer = new System.Windows.Forms.GroupBox(); - this.CHK_BeachTutors = new System.Windows.Forms.CheckBox(); + this.CHK_Shuffle = new System.Windows.Forms.CheckBox(); this.L_Same = new System.Windows.Forms.Label(); this.NUD_Egg = new System.Windows.Forms.NumericUpDown(); + this.CHK_BeachTutors = new System.Windows.Forms.CheckBox(); this.CHK_WGuard = new System.Windows.Forms.CheckBox(); this.CHK_Ability = new System.Windows.Forms.CheckBox(); this.CHK_Tutors = new System.Windows.Forms.CheckBox(); @@ -156,7 +157,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.CHK_Shuffle = new System.Windows.Forms.CheckBox(); + this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -1118,6 +1119,7 @@ private void InitializeComponent() // // GB_Modifier // + this.GB_Modifier.Controls.Add(this.CHK_NoTutor); this.GB_Modifier.Controls.Add(this.CHK_CatchRateMod); this.GB_Modifier.Controls.Add(this.L_CatchRateMod); this.GB_Modifier.Controls.Add(this.NUD_CatchRateMod); @@ -1325,17 +1327,17 @@ private void InitializeComponent() this.GB_Randomizer.TabStop = false; this.GB_Randomizer.Text = "Randomizer Options"; // - // CHK_BeachTutors + // CHK_Shuffle // - this.CHK_BeachTutors.AutoSize = true; - this.CHK_BeachTutors.Checked = true; - this.CHK_BeachTutors.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BeachTutors.Location = new System.Drawing.Point(219, 46); - this.CHK_BeachTutors.Name = "CHK_BeachTutors"; - this.CHK_BeachTutors.Size = new System.Drawing.Size(90, 17); - this.CHK_BeachTutors.TabIndex = 24; - this.CHK_BeachTutors.Text = "Beach Tutors"; - this.CHK_BeachTutors.UseVisualStyleBackColor = true; + this.CHK_Shuffle.AutoSize = true; + this.CHK_Shuffle.Checked = true; + this.CHK_Shuffle.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_Shuffle.Location = new System.Drawing.Point(6, 75); + this.CHK_Shuffle.Name = "CHK_Shuffle"; + this.CHK_Shuffle.Size = new System.Drawing.Size(86, 17); + this.CHK_Shuffle.TabIndex = 25; + this.CHK_Shuffle.Text = "Shuffle Stats"; + this.CHK_Shuffle.UseVisualStyleBackColor = true; // // L_Same // @@ -1358,6 +1360,18 @@ private void InitializeComponent() 0, 0}); // + // CHK_BeachTutors + // + this.CHK_BeachTutors.AutoSize = true; + this.CHK_BeachTutors.Checked = true; + this.CHK_BeachTutors.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_BeachTutors.Location = new System.Drawing.Point(219, 46); + this.CHK_BeachTutors.Name = "CHK_BeachTutors"; + this.CHK_BeachTutors.Size = new System.Drawing.Size(90, 17); + this.CHK_BeachTutors.TabIndex = 24; + this.CHK_BeachTutors.Text = "Beach Tutors"; + this.CHK_BeachTutors.UseVisualStyleBackColor = true; + // // CHK_WGuard // this.CHK_WGuard.AutoSize = true; @@ -1620,17 +1634,15 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // CHK_Shuffle + // CHK_NoTutor // - this.CHK_Shuffle.AutoSize = true; - this.CHK_Shuffle.Checked = true; - this.CHK_Shuffle.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Shuffle.Location = new System.Drawing.Point(6, 75); - this.CHK_Shuffle.Name = "CHK_Shuffle"; - this.CHK_Shuffle.Size = new System.Drawing.Size(86, 17); - this.CHK_Shuffle.TabIndex = 25; - this.CHK_Shuffle.Text = "Shuffle Stats"; - this.CHK_Shuffle.UseVisualStyleBackColor = true; + this.CHK_NoTutor.AutoSize = true; + this.CHK_NoTutor.Location = new System.Drawing.Point(6, 95); + this.CHK_NoTutor.Name = "CHK_NoTutor"; + this.CHK_NoTutor.Size = new System.Drawing.Size(190, 17); + this.CHK_NoTutor.TabIndex = 21; + this.CHK_NoTutor.Text = "Remove All TM/Tutor Compatibility"; + this.CHK_NoTutor.UseVisualStyleBackColor = true; // // PersonalEditor7 // @@ -1802,5 +1814,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckedListBox CLB_BeachTutors; private System.Windows.Forms.CheckBox CHK_BeachTutors; private System.Windows.Forms.CheckBox CHK_Shuffle; + private System.Windows.Forms.CheckBox CHK_NoTutor; } } diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.cs index 02318fb271..54f5a08232 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.cs @@ -362,7 +362,17 @@ private void B_ModifyAll(object sender, EventArgs e) if (CHK_Growth.Checked) CB_EXPGroup.SelectedIndex = 5; if (CHK_EXP.Checked) - TB_BaseExp.Text = ((float)NUD_EXP.Value*(Convert.ToUInt16(TB_BaseExp.Text)/100f)).ToString("000"); + TB_BaseExp.Text = ((float)NUD_EXP.Value * (Convert.ToUInt16(TB_BaseExp.Text) / 100f)).ToString("000"); + + if (CHK_NoTutor.Checked) + { + foreach (int tm in CLB_TM.CheckedIndices) + CLB_TM.SetItemCheckState(tm, CheckState.Unchecked); + foreach (int mt in CLB_MoveTutors.CheckedIndices) + CLB_MoveTutors.SetItemCheckState(mt, CheckState.Unchecked); + foreach (int ao in CLB_BeachTutors.CheckedIndices) + CLB_BeachTutors.SetItemCheckState(ao, CheckState.Unchecked); + } if (CHK_QuickHatch.Checked) TB_HatchCycles.Text = 1.ToString(); diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index c7d9a17885..c2021a5177 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -1906,7 +1906,8 @@ private void InitializeComponent() this.CB_Moves.Items.AddRange(new object[] { "Don\'t Modify", "Randomize All", - "Use Levelup Only"}); + "Use Levelup Only", + "Metronome Mode"}); this.CB_Moves.Location = new System.Drawing.Point(52, 4); this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(135, 21); diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index a4b09adece..78fce0861d 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -730,10 +730,13 @@ private void B_Randomize_Click(object sender, EventArgs e) case 2: // Current LevelUp pk.Moves = learn.GetCurrentMoves(pk.Species, pk.Form, pk.Level, 4); break; + case 3: + pk.Moves = new[] { 118, 0, 0, 0 }; + break; } // high-power attacks - if (CHK_ForceHighPower.Checked && pk.Level >= NUD_ForceHighPower.Value) + if (CHK_ForceHighPower.Checked && pk.Level >= NUD_ForceHighPower.Value && CB_Moves.SelectedIndex != 3) pk.Moves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); // sanitize moves diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index e6b314784f..b3219a5a34 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -134,16 +134,21 @@ private void InitializeComponent() this.NUD_TLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Trade = new System.Windows.Forms.ListBox(); this.Tab_Randomizer = new System.Windows.Forms.TabPage(); + this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); + this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceTotem = new System.Windows.Forms.CheckBox(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); + this.CHK_BasicStarter = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.B_ModifyLevel = new System.Windows.Forms.Button(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); this.B_RandAll = new System.Windows.Forms.Button(); this.GB_Rand = new System.Windows.Forms.GroupBox(); - this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); - this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); this.CHK_SpecialMove = new System.Windows.Forms.CheckBox(); + this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); this.CHK_RandomAura = new System.Windows.Forms.CheckBox(); - this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); this.CHK_Item = new System.Windows.Forms.CheckBox(); this.CHK_G7 = new System.Windows.Forms.CheckBox(); @@ -159,11 +164,7 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.GB_Tweak = new System.Windows.Forms.GroupBox(); - this.CHK_BasicStarter = new System.Windows.Forms.CheckBox(); - this.CHK_ForceTotem = new System.Windows.Forms.CheckBox(); - this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); - this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); + this.CHK_Metronome = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); @@ -200,10 +201,10 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_TForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TLevel)).BeginInit(); this.Tab_Randomizer.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); - this.GB_Rand.SuspendLayout(); this.GB_Tweak.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); + this.GB_Rand.SuspendLayout(); this.SuspendLayout(); // // TC_Tabs @@ -1525,6 +1526,96 @@ private void InitializeComponent() this.Tab_Randomizer.Text = "Randomizer Options"; this.Tab_Randomizer.UseVisualStyleBackColor = true; // + // GB_Tweak + // + this.GB_Tweak.Controls.Add(this.CHK_Metronome); + this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); + this.GB_Tweak.Controls.Add(this.NUD_ForceFullyEvolved); + this.GB_Tweak.Controls.Add(this.CHK_ForceTotem); + this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); + this.GB_Tweak.Controls.Add(this.CHK_BasicStarter); + this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); + this.GB_Tweak.Location = new System.Drawing.Point(119, 245); + this.GB_Tweak.Name = "GB_Tweak"; + this.GB_Tweak.Size = new System.Drawing.Size(258, 115); + this.GB_Tweak.TabIndex = 509; + this.GB_Tweak.TabStop = false; + this.GB_Tweak.Text = "Extra Tweaks"; + // + // CHK_RemoveShinyLock + // + this.CHK_RemoveShinyLock.AutoSize = true; + this.CHK_RemoveShinyLock.Checked = true; + this.CHK_RemoveShinyLock.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(6, 79); + this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.TabIndex = 299; + this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; + this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; + // + // NUD_ForceFullyEvolved + // + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 62); + this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.TabIndex = 514; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceTotem + // + this.CHK_ForceTotem.AutoSize = true; + this.CHK_ForceTotem.Location = new System.Drawing.Point(6, 47); + this.CHK_ForceTotem.Name = "CHK_ForceTotem"; + this.CHK_ForceTotem.Size = new System.Drawing.Size(200, 17); + this.CHK_ForceTotem.TabIndex = 305; + this.CHK_ForceTotem.Text = "Force Fully Evolved Totem Pokémon"; + this.CHK_ForceTotem.UseVisualStyleBackColor = true; + // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 63); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 513; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; + // + // CHK_BasicStarter + // + this.CHK_BasicStarter.AutoSize = true; + this.CHK_BasicStarter.Checked = true; + this.CHK_BasicStarter.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_BasicStarter.Location = new System.Drawing.Point(6, 31); + this.CHK_BasicStarter.Name = "CHK_BasicStarter"; + this.CHK_BasicStarter.Size = new System.Drawing.Size(217, 17); + this.CHK_BasicStarter.TabIndex = 304; + this.CHK_BasicStarter.Text = "Basic Starter Pokémon with 2 Evolutions"; + this.CHK_BasicStarter.UseVisualStyleBackColor = true; + // + // CHK_ReplaceLegend + // + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 15); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); + this.CHK_ReplaceLegend.TabIndex = 303; + this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + // // B_ModifyLevel // this.B_ModifyLevel.Location = new System.Drawing.Point(306, 49); @@ -1604,17 +1695,15 @@ private void InitializeComponent() this.GB_Rand.TabStop = false; this.GB_Rand.Text = "Randomizer Options"; // - // CHK_ReplaceLegend + // CHK_SpecialMove // - this.CHK_ReplaceLegend.AutoSize = true; - this.CHK_ReplaceLegend.Checked = true; - this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 15); - this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; - this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); - this.CHK_ReplaceLegend.TabIndex = 303; - this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; - this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; + this.CHK_SpecialMove.AutoSize = true; + this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 135); + this.CHK_SpecialMove.Name = "CHK_SpecialMove"; + this.CHK_SpecialMove.Size = new System.Drawing.Size(197, 17); + this.CHK_SpecialMove.TabIndex = 301; + this.CHK_SpecialMove.Text = "Random Gift Move for Gift Pokémon"; + this.CHK_SpecialMove.UseVisualStyleBackColor = true; // // CHK_RandomAbility // @@ -1626,16 +1715,6 @@ private void InitializeComponent() this.CHK_RandomAbility.Text = "Random Abilities (1, 2, or Hidden)"; this.CHK_RandomAbility.UseVisualStyleBackColor = true; // - // CHK_SpecialMove - // - this.CHK_SpecialMove.AutoSize = true; - this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 135); - this.CHK_SpecialMove.Name = "CHK_SpecialMove"; - this.CHK_SpecialMove.Size = new System.Drawing.Size(197, 17); - this.CHK_SpecialMove.TabIndex = 301; - this.CHK_SpecialMove.Text = "Random Gift Move for Gift Pokémon"; - this.CHK_SpecialMove.UseVisualStyleBackColor = true; - // // CHK_RandomAura // this.CHK_RandomAura.AutoSize = true; @@ -1646,18 +1725,6 @@ private void InitializeComponent() this.CHK_RandomAura.Text = "Random Totem Pokémon Aura"; this.CHK_RandomAura.UseVisualStyleBackColor = true; // - // CHK_RemoveShinyLock - // - this.CHK_RemoveShinyLock.AutoSize = true; - this.CHK_RemoveShinyLock.Checked = true; - this.CHK_RemoveShinyLock.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(6, 79); - this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; - this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); - this.CHK_RemoveShinyLock.TabIndex = 299; - this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; - this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; - // // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; @@ -1828,70 +1895,15 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // GB_Tweak - // - this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); - this.GB_Tweak.Controls.Add(this.NUD_ForceFullyEvolved); - this.GB_Tweak.Controls.Add(this.CHK_ForceTotem); - this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); - this.GB_Tweak.Controls.Add(this.CHK_BasicStarter); - this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); - this.GB_Tweak.Location = new System.Drawing.Point(119, 245); - this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 100); - this.GB_Tweak.TabIndex = 509; - this.GB_Tweak.TabStop = false; - this.GB_Tweak.Text = "Extra Tweaks"; - // - // CHK_BasicStarter - // - this.CHK_BasicStarter.AutoSize = true; - this.CHK_BasicStarter.Checked = true; - this.CHK_BasicStarter.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BasicStarter.Location = new System.Drawing.Point(6, 31); - this.CHK_BasicStarter.Name = "CHK_BasicStarter"; - this.CHK_BasicStarter.Size = new System.Drawing.Size(217, 17); - this.CHK_BasicStarter.TabIndex = 304; - this.CHK_BasicStarter.Text = "Basic Starter Pokémon with 2 Evolutions"; - this.CHK_BasicStarter.UseVisualStyleBackColor = true; - // - // CHK_ForceTotem - // - this.CHK_ForceTotem.AutoSize = true; - this.CHK_ForceTotem.Location = new System.Drawing.Point(6, 47); - this.CHK_ForceTotem.Name = "CHK_ForceTotem"; - this.CHK_ForceTotem.Size = new System.Drawing.Size(200, 17); - this.CHK_ForceTotem.TabIndex = 305; - this.CHK_ForceTotem.Text = "Force Fully Evolved Totem Pokémon"; - this.CHK_ForceTotem.UseVisualStyleBackColor = true; - // - // NUD_ForceFullyEvolved - // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 62); - this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; - this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); - this.NUD_ForceFullyEvolved.TabIndex = 514; - this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); + // CHK_Metronome // - // CHK_ForceFullyEvolved - // - this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 63); - this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; - this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); - this.CHK_ForceFullyEvolved.TabIndex = 513; - this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; - this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; + this.CHK_Metronome.AutoSize = true; + this.CHK_Metronome.Location = new System.Drawing.Point(6, 95); + this.CHK_Metronome.Name = "CHK_Metronome"; + this.CHK_Metronome.Size = new System.Drawing.Size(109, 17); + this.CHK_Metronome.TabIndex = 515; + this.CHK_Metronome.Text = "Metronome Mode"; + this.CHK_Metronome.UseVisualStyleBackColor = true; // // StaticEncounterEditor7 // @@ -1943,12 +1955,12 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_TLevel)).EndInit(); this.Tab_Randomizer.ResumeLayout(false); this.Tab_Randomizer.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); - this.GB_Rand.ResumeLayout(false); - this.GB_Rand.PerformLayout(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); + this.GB_Rand.ResumeLayout(false); + this.GB_Rand.PerformLayout(); this.ResumeLayout(false); } @@ -2091,5 +2103,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_BasicStarter; private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; + private System.Windows.Forms.CheckBox CHK_Metronome; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 79d532c319..60cfa51d88 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -494,7 +494,7 @@ private void B_Starters_Click(object sender, EventArgs e) if (CHK_RemoveShinyLock.Checked) t.ShinyLock = false; - if (CHK_SpecialMove.Checked) + if (CHK_SpecialMove.Checked && !CHK_Metronome.Checked) { int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); if (banned.Contains(rv)) continue; // disallow banned moves @@ -556,9 +556,14 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_SpecialMove.Checked) { - int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); - if (banned.Contains(rv)) continue; // disallow banned moves - t.SpecialMove = rv; + if (CHK_Metronome.Checked) + t.SpecialMove = 0; // remove Surf Pikachu's special move + else + { + int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); + if (banned.Contains(rv)) continue; // disallow banned moves + t.SpecialMove = rv; + } } if (CHK_RandomAbility.Checked) @@ -605,8 +610,12 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) t.Species = FinalEvo[randFinalEvo()]; + if (CHK_Metronome.Checked) + t.RelearnMoves = new[] { 118, 0, 0, 0 }; + else + t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); - t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); t.Gender = 0; // random t.Nature = 0; // random } From 32f9fe4cfcd6a6862cc28130688d0af34e1dcec4 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 10 Apr 2018 19:13:34 -0400 Subject: [PATCH 096/191] Quality of life changes (#317) * Quality of life changes * Re-add raw color textbox --- pk3DS.Core/Legality/Legal.cs | 1 - pk3DS/Main.Designer.cs | 24 +- pk3DS/Main.cs | 3 + pk3DS/Subforms/Gen6/EggMoveEditor6.cs | 2 +- pk3DS/Subforms/Gen6/GiftEditor6.cs | 1 - pk3DS/Subforms/Gen6/LevelUpEditor6.cs | 6 +- .../Subforms/Gen6/PersonalEditor6.Designer.cs | 212 +++++++----- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 9 +- pk3DS/Subforms/Gen6/RSTE.Designer.cs | 310 +++++++++--------- pk3DS/Subforms/Gen6/RSTE.cs | 2 +- pk3DS/Subforms/Gen6/TrainerRand.cs | 6 +- pk3DS/Subforms/Gen7/EggMoveEditor7.cs | 2 +- pk3DS/Subforms/Gen7/LevelUpEditor7.cs | 6 +- .../Subforms/Gen7/PersonalEditor7.Designer.cs | 308 +++++++++-------- pk3DS/Subforms/Gen7/PersonalEditor7.cs | 13 +- pk3DS/Subforms/Gen7/SMTE.cs | 29 +- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 14 +- 17 files changed, 513 insertions(+), 435 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index d1f5a9feb6..8fca6859dd 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -201,7 +201,6 @@ public static partial class Legal 184, // Battle Legend #endregion }; - public static readonly int[] SpecialClasses_USUM = { #region Classes diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index aec91249c7..2c94c9a6e4 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -138,7 +138,7 @@ private void InitializeComponent() this.B_OPower.Name = "B_OPower"; this.B_OPower.Size = new System.Drawing.Size(100, 23); this.B_OPower.TabIndex = 4; - this.B_OPower.Text = "O-Power"; + this.B_OPower.Text = "O-Powers"; this.B_OPower.UseVisualStyleBackColor = true; this.B_OPower.Click += new System.EventHandler(this.B_OPower_Click); // @@ -148,7 +148,7 @@ private void InitializeComponent() this.B_Pickup.Name = "B_Pickup"; this.B_Pickup.Size = new System.Drawing.Size(100, 23); this.B_Pickup.TabIndex = 0; - this.B_Pickup.Text = "Pickup"; + this.B_Pickup.Text = "Pickup Items"; this.B_Pickup.UseVisualStyleBackColor = true; this.B_Pickup.Click += new System.EventHandler(this.B_Pickup_Click); // @@ -309,7 +309,7 @@ private void InitializeComponent() // this.Menu_RomFS.Enabled = false; this.Menu_RomFS.Name = "Menu_RomFS"; - this.Menu_RomFS.Size = new System.Drawing.Size(152, 22); + this.Menu_RomFS.Size = new System.Drawing.Size(111, 22); this.Menu_RomFS.Text = "RomFS"; this.Menu_RomFS.Click += new System.EventHandler(this.rebuildRomFS); // @@ -317,7 +317,7 @@ private void InitializeComponent() // this.Menu_ExeFS.Enabled = false; this.Menu_ExeFS.Name = "Menu_ExeFS"; - this.Menu_ExeFS.Size = new System.Drawing.Size(152, 22); + this.Menu_ExeFS.Size = new System.Drawing.Size(111, 22); this.Menu_ExeFS.Text = "ExeFS"; this.Menu_ExeFS.Click += new System.EventHandler(this.rebuildExeFS); // @@ -325,7 +325,7 @@ private void InitializeComponent() // this.Menu_CRO.Enabled = false; this.Menu_CRO.Name = "Menu_CRO"; - this.Menu_CRO.Size = new System.Drawing.Size(152, 22); + this.Menu_CRO.Size = new System.Drawing.Size(111, 22); this.Menu_CRO.Text = "CRO"; this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR); // @@ -333,7 +333,7 @@ private void InitializeComponent() // this.Menu_3DS.Enabled = false; this.Menu_3DS.Name = "Menu_3DS"; - this.Menu_3DS.Size = new System.Drawing.Size(152, 22); + this.Menu_3DS.Size = new System.Drawing.Size(111, 22); this.Menu_3DS.Text = ".3DS"; this.Menu_3DS.Click += new System.EventHandler(this.B_Rebuild3DS_Click); // @@ -341,7 +341,7 @@ private void InitializeComponent() // this.Menu_Patch.Enabled = false; this.Menu_Patch.Name = "Menu_Patch"; - this.Menu_Patch.Size = new System.Drawing.Size(152, 22); + this.Menu_Patch.Size = new System.Drawing.Size(111, 22); this.Menu_Patch.Text = "Patch"; this.Menu_Patch.Click += new System.EventHandler(this.B_Patch_Click); // @@ -363,7 +363,7 @@ private void InitializeComponent() // setInt32SeedToolStripMenuItem // this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem"; - this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed"; this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click); // @@ -382,7 +382,7 @@ private void InitializeComponent() this.Menu_Language.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.CB_Lang}); this.Menu_Language.Name = "Menu_Language"; - this.Menu_Language.Size = new System.Drawing.Size(152, 22); + this.Menu_Language.Size = new System.Drawing.Size(146, 22); this.Menu_Language.Text = "Language"; // // CB_Lang @@ -408,14 +408,14 @@ private void InitializeComponent() this.Menu_About.Name = "Menu_About"; this.Menu_About.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_About.ShowShortcutKeys = false; - this.Menu_About.Size = new System.Drawing.Size(152, 22); + this.Menu_About.Size = new System.Drawing.Size(146, 22); this.Menu_About.Text = "A&bout pk3DS"; this.Menu_About.Click += new System.EventHandler(this.L_About_Click); // // Menu_GARCs // this.Menu_GARCs.Name = "Menu_GARCs"; - this.Menu_GARCs.Size = new System.Drawing.Size(152, 22); + this.Menu_GARCs.Size = new System.Drawing.Size(146, 22); this.Menu_GARCs.Text = "About GARCs"; this.Menu_GARCs.Click += new System.EventHandler(this.L_GARCInfo_Click); // @@ -705,7 +705,7 @@ private void InitializeComponent() this.B_Starter.Name = "B_Starter"; this.B_Starter.Size = new System.Drawing.Size(100, 23); this.B_Starter.TabIndex = 1; - this.B_Starter.Text = "Starters"; + this.B_Starter.Text = "Starter Pokémon"; this.B_Starter.UseVisualStyleBackColor = true; this.B_Starter.Click += new System.EventHandler(this.B_Starter_Click); // diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 1804f2a3b2..f49efaced5 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -639,6 +639,9 @@ private void B_Wild_Click(object sender, EventArgs e) private void B_OWSE_Click(object sender, EventArgs e) { if (threadActive()) return; + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, + "The OverWorld/Script Editor is not recommended for most users and is still a work-in-progress.", "Continue anyway?")) + return; switch (Config.Generation) { case 6: diff --git a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs index 3f7826189c..3504fc7f63 100644 --- a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs @@ -123,7 +123,7 @@ private void B_RandAll_Click(object sender, EventArgs e) rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); getList(); - WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!"); + WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!", "Press the Dump button to see the new Egg Moves!"); } private void B_Dump_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 7caaf3251a..1bbbbc42f2 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -231,7 +231,6 @@ private void B_RandAll_Click(object sender, EventArgs e) continue; // skip Lucario, battle needs to Mega Evolve int[] items = GetRandomMega(out species); - NUD_Form.Value = 0; CB_HeldItem.SelectedIndex = items[Util.rand.Next(0, items.Length)]; } else diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs index 639f3b5b38..e1795e3a85 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs @@ -155,10 +155,12 @@ private void B_RandAll_Click(object sender, EventArgs e) rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); getList(); - WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!"); + WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!"); } private void B_Metronome_Click(object sender, EventArgs e) { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will modify learnsets to only have Metronome.") != DialogResult.Yes) return; + // clear all data, then only assign Metronome at Lv1 for (int i = 0; i < CB_Species.Items.Count; i++) { @@ -169,7 +171,7 @@ private void B_Metronome_Click(object sender, EventArgs e) dgv.Rows[0].Cells[1].Value = movelist[118]; } CB_Species.SelectedIndex = 0; - WinFormsUtil.Alert("All Pokémon now only know the move Metronome!", "It is recommended that you open the Move Editor and set the Base PP for Metronome to 40."); + WinFormsUtil.Alert("All Pokémon now only know the move Metronome!"); } private void B_Dump_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs index 64b8153c6f..debe636655 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs @@ -32,9 +32,11 @@ private void InitializeComponent() this.L_Species_Precursor = new System.Windows.Forms.Label(); this.TC_Pokemon = new System.Windows.Forms.TabControl(); this.TP_General = new System.Windows.Forms.TabPage(); + this.L_HiddenAbility = new System.Windows.Forms.Label(); + this.L_Ability2 = new System.Windows.Forms.Label(); + this.L_Ability1 = new System.Windows.Forms.Label(); this.TB_BST = new System.Windows.Forms.TextBox(); this.L_BST = new System.Windows.Forms.Label(); - this.TB_RawColor = new System.Windows.Forms.TextBox(); this.TB_CatchRate = new System.Windows.Forms.MaskedTextBox(); this.TB_Stage = new System.Windows.Forms.TextBox(); this.L_Stage = new System.Windows.Forms.Label(); @@ -107,6 +109,7 @@ private void InitializeComponent() this.CLB_TMHM = new System.Windows.Forms.CheckedListBox(); this.TP_Randomizer = new System.Windows.Forms.TabPage(); this.GB_Modifier = new System.Windows.Forms.GroupBox(); + this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); this.CHK_CatchRateMod = new System.Windows.Forms.CheckBox(); this.L_CatchRateMod = new System.Windows.Forms.Label(); this.NUD_CatchRateMod = new System.Windows.Forms.NumericUpDown(); @@ -145,7 +148,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); + this.TB_RawColor = new System.Windows.Forms.TextBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -190,14 +193,17 @@ private void InitializeComponent() this.TC_Pokemon.Location = new System.Drawing.Point(12, 40); this.TC_Pokemon.Name = "TC_Pokemon"; this.TC_Pokemon.SelectedIndex = 0; - this.TC_Pokemon.Size = new System.Drawing.Size(445, 365); + this.TC_Pokemon.Size = new System.Drawing.Size(445, 375); this.TC_Pokemon.TabIndex = 416; // // TP_General // + this.TP_General.Controls.Add(this.TB_RawColor); + this.TP_General.Controls.Add(this.L_HiddenAbility); + this.TP_General.Controls.Add(this.L_Ability2); + this.TP_General.Controls.Add(this.L_Ability1); this.TP_General.Controls.Add(this.TB_BST); this.TP_General.Controls.Add(this.L_BST); - this.TP_General.Controls.Add(this.TB_RawColor); this.TP_General.Controls.Add(this.TB_CatchRate); this.TP_General.Controls.Add(this.TB_Stage); this.TP_General.Controls.Add(this.L_Stage); @@ -264,11 +270,38 @@ private void InitializeComponent() this.TP_General.Location = new System.Drawing.Point(4, 22); this.TP_General.Name = "TP_General"; this.TP_General.Padding = new System.Windows.Forms.Padding(3); - this.TP_General.Size = new System.Drawing.Size(437, 339); + this.TP_General.Size = new System.Drawing.Size(437, 349); this.TP_General.TabIndex = 0; this.TP_General.Text = "General Info"; this.TP_General.UseVisualStyleBackColor = true; // + // L_HiddenAbility + // + this.L_HiddenAbility.AutoSize = true; + this.L_HiddenAbility.Location = new System.Drawing.Point(413, 126); + this.L_HiddenAbility.Name = "L_HiddenAbility"; + this.L_HiddenAbility.Size = new System.Drawing.Size(21, 13); + this.L_HiddenAbility.TabIndex = 93; + this.L_HiddenAbility.Text = "(H)"; + // + // L_Ability2 + // + this.L_Ability2.AutoSize = true; + this.L_Ability2.Location = new System.Drawing.Point(414, 104); + this.L_Ability2.Name = "L_Ability2"; + this.L_Ability2.Size = new System.Drawing.Size(19, 13); + this.L_Ability2.TabIndex = 92; + this.L_Ability2.Text = "(2)"; + // + // L_Ability1 + // + this.L_Ability1.AutoSize = true; + this.L_Ability1.Location = new System.Drawing.Point(414, 82); + this.L_Ability1.Name = "L_Ability1"; + this.L_Ability1.Size = new System.Drawing.Size(19, 13); + this.L_Ability1.TabIndex = 91; + this.L_Ability1.Text = "(1)"; + // // TB_BST // this.TB_BST.Location = new System.Drawing.Point(387, 27); @@ -289,16 +322,6 @@ private void InitializeComponent() this.L_BST.Text = "BST:"; this.L_BST.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // TB_RawColor - // - this.TB_RawColor.Location = new System.Drawing.Point(236, 211); - this.TB_RawColor.Name = "TB_RawColor"; - this.TB_RawColor.ReadOnly = true; - this.TB_RawColor.Size = new System.Drawing.Size(30, 20); - this.TB_RawColor.TabIndex = 88; - this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.TB_RawColor.Visible = false; - // // TB_CatchRate // this.TB_CatchRate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -312,17 +335,17 @@ private void InitializeComponent() // // TB_Stage // - this.TB_Stage.Location = new System.Drawing.Point(376, 248); + this.TB_Stage.Location = new System.Drawing.Point(384, 238); this.TB_Stage.Name = "TB_Stage"; this.TB_Stage.ReadOnly = true; - this.TB_Stage.Size = new System.Drawing.Size(30, 20); + this.TB_Stage.Size = new System.Drawing.Size(32, 20); this.TB_Stage.TabIndex = 86; this.TB_Stage.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_Stage // this.L_Stage.AutoSize = true; - this.L_Stage.Location = new System.Drawing.Point(290, 251); + this.L_Stage.Location = new System.Drawing.Point(299, 240); this.L_Stage.Name = "L_Stage"; this.L_Stage.Size = new System.Drawing.Size(85, 13); this.L_Stage.TabIndex = 85; @@ -332,7 +355,7 @@ private void InitializeComponent() // L_WeightKG // this.L_WeightKG.AutoSize = true; - this.L_WeightKG.Location = new System.Drawing.Point(269, 300); + this.L_WeightKG.Location = new System.Drawing.Point(416, 326); this.L_WeightKG.Name = "L_WeightKG"; this.L_WeightKG.Size = new System.Drawing.Size(19, 13); this.L_WeightKG.TabIndex = 84; @@ -341,7 +364,7 @@ private void InitializeComponent() // L_HeightM // this.L_HeightM.AutoSize = true; - this.L_HeightM.Location = new System.Drawing.Point(128, 300); + this.L_HeightM.Location = new System.Drawing.Point(416, 305); this.L_HeightM.Name = "L_HeightM"; this.L_HeightM.Size = new System.Drawing.Size(15, 13); this.L_HeightM.TabIndex = 83; @@ -349,17 +372,17 @@ private void InitializeComponent() // // TB_FormeCount // - this.TB_FormeCount.Location = new System.Drawing.Point(376, 296); + this.TB_FormeCount.Location = new System.Drawing.Point(384, 280); this.TB_FormeCount.Name = "TB_FormeCount"; this.TB_FormeCount.ReadOnly = true; - this.TB_FormeCount.Size = new System.Drawing.Size(30, 20); + this.TB_FormeCount.Size = new System.Drawing.Size(32, 20); this.TB_FormeCount.TabIndex = 82; this.TB_FormeCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_FormesCount // this.L_FormesCount.AutoSize = true; - this.L_FormesCount.Location = new System.Drawing.Point(300, 300); + this.L_FormesCount.Location = new System.Drawing.Point(309, 283); this.L_FormesCount.Name = "L_FormesCount"; this.L_FormesCount.Size = new System.Drawing.Size(75, 13); this.L_FormesCount.TabIndex = 81; @@ -368,17 +391,17 @@ private void InitializeComponent() // // TB_FormeSprite // - this.TB_FormeSprite.Location = new System.Drawing.Point(376, 272); + this.TB_FormeSprite.Location = new System.Drawing.Point(384, 259); this.TB_FormeSprite.Name = "TB_FormeSprite"; this.TB_FormeSprite.ReadOnly = true; - this.TB_FormeSprite.Size = new System.Drawing.Size(30, 20); + this.TB_FormeSprite.Size = new System.Drawing.Size(32, 20); this.TB_FormeSprite.TabIndex = 80; this.TB_FormeSprite.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_FormeSprite // this.L_FormeSprite.AutoSize = true; - this.L_FormeSprite.Location = new System.Drawing.Point(306, 276); + this.L_FormeSprite.Location = new System.Drawing.Point(315, 262); this.L_FormeSprite.Name = "L_FormeSprite"; this.L_FormeSprite.Size = new System.Drawing.Size(69, 13); this.L_FormeSprite.TabIndex = 79; @@ -399,9 +422,9 @@ private void InitializeComponent() this.CB_Color.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Color.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Color.FormattingEnabled = true; - this.CB_Color.Location = new System.Drawing.Point(311, 211); + this.CB_Color.Location = new System.Drawing.Point(295, 209); this.CB_Color.Name = "CB_Color"; - this.CB_Color.Size = new System.Drawing.Size(105, 21); + this.CB_Color.Size = new System.Drawing.Size(121, 21); this.CB_Color.TabIndex = 76; // // CB_EXPGroup @@ -417,7 +440,7 @@ private void InitializeComponent() // L_Color // this.L_Color.AutoSize = true; - this.L_Color.Location = new System.Drawing.Point(276, 214); + this.L_Color.Location = new System.Drawing.Point(261, 211); this.L_Color.Name = "L_Color"; this.L_Color.Size = new System.Drawing.Size(34, 13); this.L_Color.TabIndex = 74; @@ -426,7 +449,7 @@ private void InitializeComponent() // L_EXPGrowth // this.L_EXPGrowth.AutoSize = true; - this.L_EXPGrowth.Location = new System.Drawing.Point(16, 214); + this.L_EXPGrowth.Location = new System.Drawing.Point(16, 213); this.L_EXPGrowth.Name = "L_EXPGrowth"; this.L_EXPGrowth.Size = new System.Drawing.Size(63, 13); this.L_EXPGrowth.TabIndex = 73; @@ -435,27 +458,27 @@ private void InitializeComponent() // TB_Weight // this.TB_Weight.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Weight.Location = new System.Drawing.Point(235, 296); + this.TB_Weight.Location = new System.Drawing.Point(384, 322); this.TB_Weight.Mask = "000.0"; this.TB_Weight.Name = "TB_Weight"; - this.TB_Weight.Size = new System.Drawing.Size(31, 20); + this.TB_Weight.Size = new System.Drawing.Size(32, 20); this.TB_Weight.TabIndex = 72; this.TB_Weight.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // TB_Height // this.TB_Height.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Height.Location = new System.Drawing.Point(94, 296); + this.TB_Height.Location = new System.Drawing.Point(384, 301); this.TB_Height.Mask = "00.0"; this.TB_Height.Name = "TB_Height"; - this.TB_Height.Size = new System.Drawing.Size(31, 20); + this.TB_Height.Size = new System.Drawing.Size(32, 20); this.TB_Height.TabIndex = 71; this.TB_Height.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_Weight // this.L_Weight.AutoSize = true; - this.L_Weight.Location = new System.Drawing.Point(190, 300); + this.L_Weight.Location = new System.Drawing.Point(340, 325); this.L_Weight.Name = "L_Weight"; this.L_Weight.Size = new System.Drawing.Size(44, 13); this.L_Weight.TabIndex = 70; @@ -465,7 +488,7 @@ private void InitializeComponent() // L_Height // this.L_Height.AutoSize = true; - this.L_Height.Location = new System.Drawing.Point(52, 300); + this.L_Height.Location = new System.Drawing.Point(343, 304); this.L_Height.Name = "L_Height"; this.L_Height.Size = new System.Drawing.Size(41, 13); this.L_Height.TabIndex = 69; @@ -477,7 +500,7 @@ private void InitializeComponent() this.CB_Ability3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Ability3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Ability3.FormattingEnabled = true; - this.CB_Ability3.Location = new System.Drawing.Point(276, 131); + this.CB_Ability3.Location = new System.Drawing.Point(272, 123); this.CB_Ability3.Name = "CB_Ability3"; this.CB_Ability3.Size = new System.Drawing.Size(140, 21); this.CB_Ability3.TabIndex = 68; @@ -487,7 +510,7 @@ private void InitializeComponent() this.CB_Ability2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Ability2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Ability2.FormattingEnabled = true; - this.CB_Ability2.Location = new System.Drawing.Point(276, 105); + this.CB_Ability2.Location = new System.Drawing.Point(272, 101); this.CB_Ability2.Name = "CB_Ability2"; this.CB_Ability2.Size = new System.Drawing.Size(140, 21); this.CB_Ability2.TabIndex = 67; @@ -497,7 +520,7 @@ private void InitializeComponent() this.CB_Ability1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Ability1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Ability1.FormattingEnabled = true; - this.CB_Ability1.Location = new System.Drawing.Point(276, 79); + this.CB_Ability1.Location = new System.Drawing.Point(272, 79); this.CB_Ability1.Name = "CB_Ability1"; this.CB_Ability1.Size = new System.Drawing.Size(140, 21); this.CB_Ability1.TabIndex = 66; @@ -507,7 +530,7 @@ private void InitializeComponent() this.CB_EggGroup2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_EggGroup2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_EggGroup2.FormattingEnabled = true; - this.CB_EggGroup2.Location = new System.Drawing.Point(295, 184); + this.CB_EggGroup2.Location = new System.Drawing.Point(295, 180); this.CB_EggGroup2.Name = "CB_EggGroup2"; this.CB_EggGroup2.Size = new System.Drawing.Size(121, 21); this.CB_EggGroup2.TabIndex = 65; @@ -534,7 +557,7 @@ private void InitializeComponent() // L_Ability // this.L_Ability.AutoSize = true; - this.L_Ability.Location = new System.Drawing.Point(230, 83); + this.L_Ability.Location = new System.Drawing.Point(226, 83); this.L_Ability.Name = "L_Ability"; this.L_Ability.Size = new System.Drawing.Size(45, 13); this.L_Ability.TabIndex = 62; @@ -543,7 +566,7 @@ private void InitializeComponent() // TB_BaseExp // this.TB_BaseExp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_BaseExp.Location = new System.Drawing.Point(235, 272); + this.TB_BaseExp.Location = new System.Drawing.Point(77, 302); this.TB_BaseExp.Mask = "000"; this.TB_BaseExp.Name = "TB_BaseExp"; this.TB_BaseExp.Size = new System.Drawing.Size(31, 20); @@ -554,7 +577,7 @@ private void InitializeComponent() // L_BaseEXP // this.L_BaseEXP.AutoSize = true; - this.L_BaseEXP.Location = new System.Drawing.Point(176, 276); + this.L_BaseEXP.Location = new System.Drawing.Point(18, 306); this.L_BaseEXP.Name = "L_BaseEXP"; this.L_BaseEXP.Size = new System.Drawing.Size(58, 13); this.L_BaseEXP.TabIndex = 60; @@ -564,7 +587,7 @@ private void InitializeComponent() // TB_HatchCycles // this.TB_HatchCycles.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_HatchCycles.Location = new System.Drawing.Point(235, 248); + this.TB_HatchCycles.Location = new System.Drawing.Point(77, 323); this.TB_HatchCycles.Mask = "000"; this.TB_HatchCycles.Name = "TB_HatchCycles"; this.TB_HatchCycles.Size = new System.Drawing.Size(31, 20); @@ -575,7 +598,7 @@ private void InitializeComponent() // L_HatchCycles // this.L_HatchCycles.AutoSize = true; - this.L_HatchCycles.Location = new System.Drawing.Point(161, 251); + this.L_HatchCycles.Location = new System.Drawing.Point(3, 326); this.L_HatchCycles.Name = "L_HatchCycles"; this.L_HatchCycles.Size = new System.Drawing.Size(73, 13); this.L_HatchCycles.TabIndex = 57; @@ -585,7 +608,7 @@ private void InitializeComponent() // TB_Friendship // this.TB_Friendship.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Friendship.Location = new System.Drawing.Point(94, 272); + this.TB_Friendship.Location = new System.Drawing.Point(77, 281); this.TB_Friendship.Mask = "000"; this.TB_Friendship.Name = "TB_Friendship"; this.TB_Friendship.Size = new System.Drawing.Size(31, 20); @@ -596,7 +619,7 @@ private void InitializeComponent() // TB_Gender // this.TB_Gender.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Gender.Location = new System.Drawing.Point(94, 248); + this.TB_Gender.Location = new System.Drawing.Point(77, 260); this.TB_Gender.Mask = "000"; this.TB_Gender.Name = "TB_Gender"; this.TB_Gender.Size = new System.Drawing.Size(31, 20); @@ -607,7 +630,7 @@ private void InitializeComponent() // L_Friendship // this.L_Friendship.AutoSize = true; - this.L_Friendship.Location = new System.Drawing.Point(35, 276); + this.L_Friendship.Location = new System.Drawing.Point(18, 285); this.L_Friendship.Name = "L_Friendship"; this.L_Friendship.Size = new System.Drawing.Size(58, 13); this.L_Friendship.TabIndex = 54; @@ -617,7 +640,7 @@ private void InitializeComponent() // L_Gender // this.L_Gender.AutoSize = true; - this.L_Gender.Location = new System.Drawing.Point(48, 251); + this.L_Gender.Location = new System.Drawing.Point(31, 264); this.L_Gender.Name = "L_Gender"; this.L_Gender.Size = new System.Drawing.Size(45, 13); this.L_Gender.TabIndex = 53; @@ -627,7 +650,7 @@ private void InitializeComponent() // L_Item1 // this.L_Item1.AutoSize = true; - this.L_Item1.Location = new System.Drawing.Point(195, 134); + this.L_Item1.Location = new System.Drawing.Point(195, 126); this.L_Item1.Name = "L_Item1"; this.L_Item1.Size = new System.Drawing.Size(21, 13); this.L_Item1.TabIndex = 52; @@ -636,7 +659,7 @@ private void InitializeComponent() // L_Item5 // this.L_Item5.AutoSize = true; - this.L_Item5.Location = new System.Drawing.Point(195, 107); + this.L_Item5.Location = new System.Drawing.Point(195, 104); this.L_Item5.Name = "L_Item5"; this.L_Item5.Size = new System.Drawing.Size(21, 13); this.L_Item5.TabIndex = 51; @@ -656,7 +679,7 @@ private void InitializeComponent() this.CB_HeldItem3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_HeldItem3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_HeldItem3.FormattingEnabled = true; - this.CB_HeldItem3.Location = new System.Drawing.Point(52, 131); + this.CB_HeldItem3.Location = new System.Drawing.Point(52, 123); this.CB_HeldItem3.Name = "CB_HeldItem3"; this.CB_HeldItem3.Size = new System.Drawing.Size(140, 21); this.CB_HeldItem3.TabIndex = 49; @@ -666,7 +689,7 @@ private void InitializeComponent() this.CB_HeldItem2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_HeldItem2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_HeldItem2.FormattingEnabled = true; - this.CB_HeldItem2.Location = new System.Drawing.Point(52, 105); + this.CB_HeldItem2.Location = new System.Drawing.Point(52, 101); this.CB_HeldItem2.Name = "CB_HeldItem2"; this.CB_HeldItem2.Size = new System.Drawing.Size(140, 21); this.CB_HeldItem2.TabIndex = 48; @@ -695,7 +718,7 @@ private void InitializeComponent() this.CB_Type2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Type2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Type2.FormattingEnabled = true; - this.CB_Type2.Location = new System.Drawing.Point(63, 184); + this.CB_Type2.Location = new System.Drawing.Point(63, 180); this.CB_Type2.Name = "CB_Type2"; this.CB_Type2.Size = new System.Drawing.Size(129, 21); this.CB_Type2.TabIndex = 45; @@ -934,7 +957,7 @@ private void InitializeComponent() this.TP_MoveTutors.Location = new System.Drawing.Point(4, 22); this.TP_MoveTutors.Name = "TP_MoveTutors"; this.TP_MoveTutors.Padding = new System.Windows.Forms.Padding(3); - this.TP_MoveTutors.Size = new System.Drawing.Size(437, 339); + this.TP_MoveTutors.Size = new System.Drawing.Size(437, 349); this.TP_MoveTutors.TabIndex = 1; this.TP_MoveTutors.Text = "Move Tutors"; this.TP_MoveTutors.UseVisualStyleBackColor = true; @@ -963,9 +986,9 @@ private void InitializeComponent() this.L_TMHM.AutoSize = true; this.L_TMHM.Location = new System.Drawing.Point(6, 3); this.L_TMHM.Name = "L_TMHM"; - this.L_TMHM.Size = new System.Drawing.Size(48, 13); + this.L_TMHM.Size = new System.Drawing.Size(58, 13); this.L_TMHM.TabIndex = 5; - this.L_TMHM.Text = "TM/HM:"; + this.L_TMHM.Text = "TMs/HMs:"; // // CLB_ORASTutors // @@ -1007,7 +1030,7 @@ private void InitializeComponent() this.TP_Randomizer.Controls.Add(this.B_Randomize); this.TP_Randomizer.Location = new System.Drawing.Point(4, 22); this.TP_Randomizer.Name = "TP_Randomizer"; - this.TP_Randomizer.Size = new System.Drawing.Size(437, 339); + this.TP_Randomizer.Size = new System.Drawing.Size(437, 349); this.TP_Randomizer.TabIndex = 2; this.TP_Randomizer.Text = "Enhancements"; this.TP_Randomizer.UseVisualStyleBackColor = true; @@ -1031,6 +1054,16 @@ private void InitializeComponent() this.GB_Modifier.TabStop = false; this.GB_Modifier.Text = "Modifier Options"; // + // CHK_NoTutor + // + this.CHK_NoTutor.AutoSize = true; + this.CHK_NoTutor.Location = new System.Drawing.Point(6, 95); + this.CHK_NoTutor.Name = "CHK_NoTutor"; + this.CHK_NoTutor.Size = new System.Drawing.Size(176, 30); + this.CHK_NoTutor.TabIndex = 20; + this.CHK_NoTutor.Text = "Remove All TM/Move Tutor\nCompatibility (Metronome Mode)"; + this.CHK_NoTutor.UseVisualStyleBackColor = true; + // // CHK_CatchRateMod // this.CHK_CatchRateMod.AutoSize = true; @@ -1044,7 +1077,7 @@ private void InitializeComponent() // L_CatchRateMod // this.L_CatchRateMod.AutoSize = true; - this.L_CatchRateMod.Location = new System.Drawing.Point(204, 58); + this.L_CatchRateMod.Location = new System.Drawing.Point(230, 58); this.L_CatchRateMod.Name = "L_CatchRateMod"; this.L_CatchRateMod.Size = new System.Drawing.Size(34, 13); this.L_CatchRateMod.TabIndex = 18; @@ -1107,7 +1140,7 @@ private void InitializeComponent() // L_FinalXP // this.L_FinalXP.AutoSize = true; - this.L_FinalXP.Location = new System.Drawing.Point(6, 71); + this.L_FinalXP.Location = new System.Drawing.Point(6, 74); this.L_FinalXP.Name = "L_FinalXP"; this.L_FinalXP.Size = new System.Drawing.Size(63, 13); this.L_FinalXP.TabIndex = 6; @@ -1115,7 +1148,7 @@ private void InitializeComponent() // // NUD_EXP // - this.NUD_EXP.Location = new System.Drawing.Point(69, 69); + this.NUD_EXP.Location = new System.Drawing.Point(69, 72); this.NUD_EXP.Maximum = new decimal(new int[] { 300, 0, @@ -1178,7 +1211,7 @@ private void InitializeComponent() this.GB_Randomizer.Controls.Add(this.CHK_Item); this.GB_Randomizer.Location = new System.Drawing.Point(4, 12); this.GB_Randomizer.Name = "GB_Randomizer"; - this.GB_Randomizer.Size = new System.Drawing.Size(345, 129); + this.GB_Randomizer.Size = new System.Drawing.Size(345, 133); this.GB_Randomizer.TabIndex = 418; this.GB_Randomizer.TabStop = false; this.GB_Randomizer.Text = "Randomizer Options"; @@ -1198,15 +1231,15 @@ private void InitializeComponent() // L_Same // this.L_Same.AutoSize = true; - this.L_Same.Location = new System.Drawing.Point(216, 97); + this.L_Same.Location = new System.Drawing.Point(213, 99); this.L_Same.Name = "L_Same"; - this.L_Same.Size = new System.Drawing.Size(48, 13); + this.L_Same.Size = new System.Drawing.Size(51, 13); this.L_Same.TabIndex = 23; - this.L_Same.Text = "Same(%)"; + this.L_Same.Text = "Same (%)"; // // NUD_Egg // - this.NUD_Egg.Location = new System.Drawing.Point(267, 95); + this.NUD_Egg.Location = new System.Drawing.Point(267, 97); this.NUD_Egg.Name = "NUD_Egg"; this.NUD_Egg.Size = new System.Drawing.Size(46, 20); this.NUD_Egg.TabIndex = 22; @@ -1314,11 +1347,11 @@ private void InitializeComponent() // L_SingleType // this.L_SingleType.AutoSize = true; - this.L_SingleType.Location = new System.Drawing.Point(115, 78); + this.L_SingleType.Location = new System.Drawing.Point(115, 79); this.L_SingleType.Name = "L_SingleType"; - this.L_SingleType.Size = new System.Drawing.Size(77, 13); + this.L_SingleType.Size = new System.Drawing.Size(80, 13); this.L_SingleType.TabIndex = 21; - this.L_SingleType.Text = "Single Type(%)"; + this.L_SingleType.Text = "Single Type (%)"; // // CHK_rDEF // @@ -1346,7 +1379,7 @@ private void InitializeComponent() // // NUD_TypePercent // - this.NUD_TypePercent.Location = new System.Drawing.Point(134, 94); + this.NUD_TypePercent.Location = new System.Drawing.Point(134, 95); this.NUD_TypePercent.Name = "NUD_TypePercent"; this.NUD_TypePercent.Size = new System.Drawing.Size(46, 20); this.NUD_TypePercent.TabIndex = 20; @@ -1383,11 +1416,11 @@ private void InitializeComponent() // L_StatDev // this.L_StatDev.AutoSize = true; - this.L_StatDev.Location = new System.Drawing.Point(6, 90); + this.L_StatDev.Location = new System.Drawing.Point(6, 92); this.L_StatDev.Name = "L_StatDev"; - this.L_StatDev.Size = new System.Drawing.Size(67, 13); + this.L_StatDev.Size = new System.Drawing.Size(70, 13); this.L_StatDev.TabIndex = 4; - this.L_StatDev.Text = "Deviance(%)"; + this.L_StatDev.Text = "Deviance (%)"; // // CHK_TM // @@ -1403,7 +1436,7 @@ private void InitializeComponent() // // NUD_StatDev // - this.NUD_StatDev.Location = new System.Drawing.Point(27, 106); + this.NUD_StatDev.Location = new System.Drawing.Point(27, 108); this.NUD_StatDev.Name = "NUD_StatDev"; this.NUD_StatDev.Size = new System.Drawing.Size(46, 20); this.NUD_StatDev.TabIndex = 3; @@ -1474,7 +1507,7 @@ private void InitializeComponent() // // PB_MonSprite // - this.PB_MonSprite.Location = new System.Drawing.Point(285, 0); + this.PB_MonSprite.Location = new System.Drawing.Point(285, 1); this.PB_MonSprite.Name = "PB_MonSprite"; this.PB_MonSprite.Size = new System.Drawing.Size(80, 60); this.PB_MonSprite.TabIndex = 89; @@ -1482,7 +1515,7 @@ private void InitializeComponent() // // B_Dump // - this.B_Dump.Location = new System.Drawing.Point(368, 10); + this.B_Dump.Location = new System.Drawing.Point(368, 19); this.B_Dump.Name = "B_Dump"; this.B_Dump.Size = new System.Drawing.Size(82, 23); this.B_Dump.TabIndex = 418; @@ -1490,29 +1523,29 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // CHK_NoTutor + // TB_RawColor // - this.CHK_NoTutor.AutoSize = true; - this.CHK_NoTutor.Location = new System.Drawing.Point(6, 95); - this.CHK_NoTutor.Name = "CHK_NoTutor"; - this.CHK_NoTutor.Size = new System.Drawing.Size(212, 17); - this.CHK_NoTutor.TabIndex = 20; - this.CHK_NoTutor.Text = "Remove All TM/HM/Tutor Compatibility"; - this.CHK_NoTutor.UseVisualStyleBackColor = true; + this.TB_RawColor.Location = new System.Drawing.Point(229, 209); + this.TB_RawColor.Name = "TB_RawColor"; + this.TB_RawColor.ReadOnly = true; + this.TB_RawColor.Size = new System.Drawing.Size(30, 20); + this.TB_RawColor.TabIndex = 419; + this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_RawColor.Visible = false; // // PersonalEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(469, 416); + this.ClientSize = new System.Drawing.Size(469, 426); this.Controls.Add(this.B_Dump); this.Controls.Add(this.PB_MonSprite); this.Controls.Add(this.TC_Pokemon); this.Controls.Add(this.L_Species_Precursor); this.Controls.Add(this.CB_Species); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(485, 455); - this.MinimumSize = new System.Drawing.Size(485, 455); + this.MaximumSize = new System.Drawing.Size(485, 465); + this.MinimumSize = new System.Drawing.Size(485, 465); this.Name = "PersonalEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Personal Stats Editor"; @@ -1608,7 +1641,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox TB_Stage; private System.Windows.Forms.Label L_Stage; private System.Windows.Forms.MaskedTextBox TB_CatchRate; - private System.Windows.Forms.TextBox TB_RawColor; private System.Windows.Forms.Label L_BST; private System.Windows.Forms.TextBox TB_BST; private System.Windows.Forms.CheckedListBox CLB_TMHM; @@ -1658,5 +1690,9 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_CatchRateMod; private System.Windows.Forms.CheckBox CHK_Shuffle; private System.Windows.Forms.CheckBox CHK_NoTutor; + private System.Windows.Forms.Label L_HiddenAbility; + private System.Windows.Forms.Label L_Ability2; + private System.Windows.Forms.Label L_Ability1; + private System.Windows.Forms.TextBox TB_RawColor; } } diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index 393b8ac0d3..ce2a36c0d9 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -306,7 +306,7 @@ private void savePersonal() pkm.FormeSprite = Convert.ToUInt16(TB_FormeSprite.Text); pkm.FormeCount = Convert.ToByte(TB_FormeCount.Text); - pkm.Color = (byte) (Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0)); + pkm.Color = (byte)(Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0)); pkm.BaseEXP = Convert.ToUInt16(TB_BaseExp.Text); decimal h; decimal.TryParse(TB_Height.Text, out h); @@ -337,6 +337,7 @@ private void saveEntry() private void B_Randomize_Click(object sender, EventArgs e) { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Enhancements tab.") != DialogResult.Yes) return; saveEntry(); // input settings @@ -364,10 +365,12 @@ private void B_Randomize_Click(object sender, EventArgs e) Main.SpeciesStat.Select(z => z.Write()).ToArray().CopyTo(files, 0); readEntry(); - WinFormsUtil.Alert("All relevant Pokémon Personal Entries have been randomized!"); + WinFormsUtil.Alert("Randomized all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } private void B_ModifyAll(object sender, EventArgs e) { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all? Cannot undo.", "Double check Modification settings in the Enhancements tab.") != DialogResult.Yes) return; + for (int i = 1; i < CB_Species.Items.Count; i++) { CB_Species.SelectedIndex = i; // Get new Species @@ -397,7 +400,7 @@ private void B_ModifyAll(object sender, EventArgs e) TB_CatchRate.Text = ((int)NUD_CatchRateMod.Value).ToString(); } CB_Species.SelectedIndex = 1; - WinFormsUtil.Alert("All species modified according to specification!"); + WinFormsUtil.Alert("Modified all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } private bool dumping; private void B_Dump_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/RSTE.Designer.cs b/pk3DS/Subforms/Gen6/RSTE.Designer.cs index d67155dbae..08517e8aaf 100644 --- a/pk3DS/Subforms/Gen6/RSTE.Designer.cs +++ b/pk3DS/Subforms/Gen6/RSTE.Designer.cs @@ -303,7 +303,7 @@ private void InitializeComponent() // checkBox_Healer // this.checkBox_Healer.AutoSize = true; - this.checkBox_Healer.Location = new System.Drawing.Point(7, 49); + this.checkBox_Healer.Location = new System.Drawing.Point(457, 49); this.checkBox_Healer.Name = "checkBox_Healer"; this.checkBox_Healer.Size = new System.Drawing.Size(57, 17); this.checkBox_Healer.TabIndex = 58; @@ -313,7 +313,7 @@ private void InitializeComponent() // L_TPrize // this.L_TPrize.AutoSize = true; - this.L_TPrize.Location = new System.Drawing.Point(454, 3); + this.L_TPrize.Location = new System.Drawing.Point(454, 5); this.L_TPrize.Name = "L_TPrize"; this.L_TPrize.Size = new System.Drawing.Size(33, 13); this.L_TPrize.TabIndex = 57; @@ -332,7 +332,7 @@ private void InitializeComponent() // L_AI // this.L_AI.AutoSize = true; - this.L_AI.Location = new System.Drawing.Point(11, 103); + this.L_AI.Location = new System.Drawing.Point(17, 103); this.L_AI.Name = "L_AI"; this.L_AI.Size = new System.Drawing.Size(49, 13); this.L_AI.TabIndex = 55; @@ -351,7 +351,7 @@ private void InitializeComponent() // L_Money // this.L_Money.AutoSize = true; - this.L_Money.Location = new System.Drawing.Point(146, 103); + this.L_Money.Location = new System.Drawing.Point(152, 103); this.L_Money.Name = "L_Money"; this.L_Money.Size = new System.Drawing.Size(42, 13); this.L_Money.TabIndex = 53; @@ -370,7 +370,7 @@ private void InitializeComponent() // L_Battle_Type // this.L_Battle_Type.AutoSize = true; - this.L_Battle_Type.Location = new System.Drawing.Point(86, 76); + this.L_Battle_Type.Location = new System.Drawing.Point(56, 76); this.L_Battle_Type.Name = "L_Battle_Type"; this.L_Battle_Type.Size = new System.Drawing.Size(64, 13); this.L_Battle_Type.TabIndex = 51; @@ -387,15 +387,15 @@ private void InitializeComponent() "Triple Battle", "Rotation Battle", "Horde Battle"}); - this.CB_Battle_Type.Location = new System.Drawing.Point(156, 73); + this.CB_Battle_Type.Location = new System.Drawing.Point(121, 73); this.CB_Battle_Type.Name = "CB_Battle_Type"; - this.CB_Battle_Type.Size = new System.Drawing.Size(116, 21); + this.CB_Battle_Type.Size = new System.Drawing.Size(151, 21); this.CB_Battle_Type.TabIndex = 50; // // L_Trainer_Class // this.L_Trainer_Class.AutoSize = true; - this.L_Trainer_Class.Location = new System.Drawing.Point(79, 49); + this.L_Trainer_Class.Location = new System.Drawing.Point(49, 49); this.L_Trainer_Class.Name = "L_Trainer_Class"; this.L_Trainer_Class.Size = new System.Drawing.Size(71, 13); this.L_Trainer_Class.TabIndex = 49; @@ -407,15 +407,15 @@ private void InitializeComponent() this.CB_Trainer_Class.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Trainer_Class.DropDownWidth = 165; this.CB_Trainer_Class.FormattingEnabled = true; - this.CB_Trainer_Class.Location = new System.Drawing.Point(156, 46); + this.CB_Trainer_Class.Location = new System.Drawing.Point(121, 46); this.CB_Trainer_Class.Name = "CB_Trainer_Class"; - this.CB_Trainer_Class.Size = new System.Drawing.Size(116, 21); + this.CB_Trainer_Class.Size = new System.Drawing.Size(151, 21); this.CB_Trainer_Class.TabIndex = 48; // // checkBox_Moves // this.checkBox_Moves.AutoSize = true; - this.checkBox_Moves.Location = new System.Drawing.Point(7, 65); + this.checkBox_Moves.Location = new System.Drawing.Point(457, 76); this.checkBox_Moves.Name = "checkBox_Moves"; this.checkBox_Moves.Size = new System.Drawing.Size(58, 17); this.checkBox_Moves.TabIndex = 40; @@ -426,7 +426,7 @@ private void InitializeComponent() // checkBox_Item // this.checkBox_Item.AutoSize = true; - this.checkBox_Item.Location = new System.Drawing.Point(7, 81); + this.checkBox_Item.Location = new System.Drawing.Point(457, 103); this.checkBox_Item.Name = "checkBox_Item"; this.checkBox_Item.Size = new System.Drawing.Size(51, 17); this.checkBox_Item.TabIndex = 39; @@ -437,7 +437,7 @@ private void InitializeComponent() // L_Item_4 // this.L_Item_4.AutoSize = true; - this.L_Item_4.Location = new System.Drawing.Point(278, 103); + this.L_Item_4.Location = new System.Drawing.Point(284, 103); this.L_Item_4.Name = "L_Item_4"; this.L_Item_4.Size = new System.Drawing.Size(39, 13); this.L_Item_4.TabIndex = 34; @@ -448,7 +448,7 @@ private void InitializeComponent() this.CB_Item_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_4.FormattingEnabled = true; - this.CB_Item_4.Location = new System.Drawing.Point(330, 100); + this.CB_Item_4.Location = new System.Drawing.Point(324, 100); this.CB_Item_4.Name = "CB_Item_4"; this.CB_Item_4.Size = new System.Drawing.Size(121, 21); this.CB_Item_4.TabIndex = 33; @@ -456,7 +456,7 @@ private void InitializeComponent() // L_Item_3 // this.L_Item_3.AutoSize = true; - this.L_Item_3.Location = new System.Drawing.Point(278, 76); + this.L_Item_3.Location = new System.Drawing.Point(284, 76); this.L_Item_3.Name = "L_Item_3"; this.L_Item_3.Size = new System.Drawing.Size(39, 13); this.L_Item_3.TabIndex = 32; @@ -467,7 +467,7 @@ private void InitializeComponent() this.CB_Item_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_3.FormattingEnabled = true; - this.CB_Item_3.Location = new System.Drawing.Point(330, 73); + this.CB_Item_3.Location = new System.Drawing.Point(324, 73); this.CB_Item_3.Name = "CB_Item_3"; this.CB_Item_3.Size = new System.Drawing.Size(121, 21); this.CB_Item_3.TabIndex = 31; @@ -475,7 +475,7 @@ private void InitializeComponent() // L_Item_2 // this.L_Item_2.AutoSize = true; - this.L_Item_2.Location = new System.Drawing.Point(278, 49); + this.L_Item_2.Location = new System.Drawing.Point(284, 49); this.L_Item_2.Name = "L_Item_2"; this.L_Item_2.Size = new System.Drawing.Size(39, 13); this.L_Item_2.TabIndex = 30; @@ -486,7 +486,7 @@ private void InitializeComponent() this.CB_Item_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_2.FormattingEnabled = true; - this.CB_Item_2.Location = new System.Drawing.Point(330, 46); + this.CB_Item_2.Location = new System.Drawing.Point(324, 46); this.CB_Item_2.Name = "CB_Item_2"; this.CB_Item_2.Size = new System.Drawing.Size(121, 21); this.CB_Item_2.TabIndex = 29; @@ -494,7 +494,7 @@ private void InitializeComponent() // L_Item_1 // this.L_Item_1.AutoSize = true; - this.L_Item_1.Location = new System.Drawing.Point(278, 22); + this.L_Item_1.Location = new System.Drawing.Point(284, 22); this.L_Item_1.Name = "L_Item_1"; this.L_Item_1.Size = new System.Drawing.Size(39, 13); this.L_Item_1.TabIndex = 28; @@ -505,7 +505,7 @@ private void InitializeComponent() this.CB_Item_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_1.FormattingEnabled = true; - this.CB_Item_1.Location = new System.Drawing.Point(330, 19); + this.CB_Item_1.Location = new System.Drawing.Point(324, 19); this.CB_Item_1.Name = "CB_Item_1"; this.CB_Item_1.Size = new System.Drawing.Size(121, 21); this.CB_Item_1.TabIndex = 27; @@ -513,7 +513,7 @@ private void InitializeComponent() // L_numPokemon // this.L_numPokemon.AutoSize = true; - this.L_numPokemon.Location = new System.Drawing.Point(43, 22); + this.L_numPokemon.Location = new System.Drawing.Point(13, 22); this.L_numPokemon.Name = "L_numPokemon"; this.L_numPokemon.Size = new System.Drawing.Size(107, 13); this.L_numPokemon.TabIndex = 22; @@ -532,9 +532,9 @@ private void InitializeComponent() "4", "5", "6"}); - this.CB_numPokemon.Location = new System.Drawing.Point(156, 19); + this.CB_numPokemon.Location = new System.Drawing.Point(121, 19); this.CB_numPokemon.Name = "CB_numPokemon"; - this.CB_numPokemon.Size = new System.Drawing.Size(116, 21); + this.CB_numPokemon.Size = new System.Drawing.Size(151, 21); this.CB_numPokemon.TabIndex = 21; this.CB_numPokemon.SelectedIndexChanged += new System.EventHandler(this.changeTrainerType); // @@ -573,7 +573,7 @@ private void InitializeComponent() // L_Pokemon_1_Form // this.L_Pokemon_1_Form.AutoSize = true; - this.L_Pokemon_1_Form.Location = new System.Drawing.Point(33, 36); + this.L_Pokemon_1_Form.Location = new System.Drawing.Point(33, 44); this.L_Pokemon_1_Form.Name = "L_Pokemon_1_Form"; this.L_Pokemon_1_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_1_Form.TabIndex = 63; @@ -585,7 +585,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Ability.Enabled = false; this.CB_Pokemon_1_Ability.FormattingEnabled = true; - this.CB_Pokemon_1_Ability.Location = new System.Drawing.Point(429, 33); + this.CB_Pokemon_1_Ability.Location = new System.Drawing.Point(429, 41); this.CB_Pokemon_1_Ability.Name = "CB_Pokemon_1_Ability"; this.CB_Pokemon_1_Ability.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Ability.TabIndex = 62; @@ -593,7 +593,7 @@ private void InitializeComponent() // L_Pokemon_1_Gender // this.L_Pokemon_1_Gender.AutoSize = true; - this.L_Pokemon_1_Gender.Location = new System.Drawing.Point(378, 63); + this.L_Pokemon_1_Gender.Location = new System.Drawing.Point(378, 71); this.L_Pokemon_1_Gender.Name = "L_Pokemon_1_Gender"; this.L_Pokemon_1_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_1_Gender.TabIndex = 59; @@ -605,7 +605,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Gender.Enabled = false; this.CB_Pokemon_1_Gender.FormattingEnabled = true; - this.CB_Pokemon_1_Gender.Location = new System.Drawing.Point(429, 60); + this.CB_Pokemon_1_Gender.Location = new System.Drawing.Point(429, 68); this.CB_Pokemon_1_Gender.Name = "CB_Pokemon_1_Gender"; this.CB_Pokemon_1_Gender.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Gender.TabIndex = 58; @@ -614,7 +614,7 @@ private void InitializeComponent() // L_Pokemon_1_Ability // this.L_Pokemon_1_Ability.AutoSize = true; - this.L_Pokemon_1_Ability.Location = new System.Drawing.Point(386, 36); + this.L_Pokemon_1_Ability.Location = new System.Drawing.Point(386, 44); this.L_Pokemon_1_Ability.Name = "L_Pokemon_1_Ability"; this.L_Pokemon_1_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_1_Ability.TabIndex = 57; @@ -626,7 +626,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Form.Enabled = false; this.CB_Pokemon_1_Form.FormattingEnabled = true; - this.CB_Pokemon_1_Form.Location = new System.Drawing.Point(72, 33); + this.CB_Pokemon_1_Form.Location = new System.Drawing.Point(72, 41); this.CB_Pokemon_1_Form.Name = "CB_Pokemon_1_Form"; this.CB_Pokemon_1_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Form.TabIndex = 56; @@ -635,7 +635,7 @@ private void InitializeComponent() // L_Pokemon_1_IVs // this.L_Pokemon_1_IVs.AutoSize = true; - this.L_Pokemon_1_IVs.Location = new System.Drawing.Point(398, 9); + this.L_Pokemon_1_IVs.Location = new System.Drawing.Point(398, 17); this.L_Pokemon_1_IVs.Name = "L_Pokemon_1_IVs"; this.L_Pokemon_1_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_1_IVs.TabIndex = 36; @@ -647,7 +647,7 @@ private void InitializeComponent() this.CB_Pokemon_1_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_IVs.Enabled = false; this.CB_Pokemon_1_IVs.FormattingEnabled = true; - this.CB_Pokemon_1_IVs.Location = new System.Drawing.Point(429, 6); + this.CB_Pokemon_1_IVs.Location = new System.Drawing.Point(429, 14); this.CB_Pokemon_1_IVs.Name = "CB_Pokemon_1_IVs"; this.CB_Pokemon_1_IVs.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_IVs.TabIndex = 35; @@ -655,7 +655,7 @@ private void InitializeComponent() // L_Pokemon_1_Move_4 // this.L_Pokemon_1_Move_4.AutoSize = true; - this.L_Pokemon_1_Move_4.Location = new System.Drawing.Point(199, 90); + this.L_Pokemon_1_Move_4.Location = new System.Drawing.Point(199, 98); this.L_Pokemon_1_Move_4.Name = "L_Pokemon_1_Move_4"; this.L_Pokemon_1_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_4.TabIndex = 34; @@ -667,7 +667,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_4.Enabled = false; this.CB_Pokemon_1_Move_4.FormattingEnabled = true; - this.CB_Pokemon_1_Move_4.Location = new System.Drawing.Point(251, 87); + this.CB_Pokemon_1_Move_4.Location = new System.Drawing.Point(251, 95); this.CB_Pokemon_1_Move_4.Name = "CB_Pokemon_1_Move_4"; this.CB_Pokemon_1_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_4.TabIndex = 33; @@ -675,7 +675,7 @@ private void InitializeComponent() // L_Pokemon_1_Move_3 // this.L_Pokemon_1_Move_3.AutoSize = true; - this.L_Pokemon_1_Move_3.Location = new System.Drawing.Point(199, 63); + this.L_Pokemon_1_Move_3.Location = new System.Drawing.Point(199, 71); this.L_Pokemon_1_Move_3.Name = "L_Pokemon_1_Move_3"; this.L_Pokemon_1_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_3.TabIndex = 32; @@ -687,7 +687,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_3.Enabled = false; this.CB_Pokemon_1_Move_3.FormattingEnabled = true; - this.CB_Pokemon_1_Move_3.Location = new System.Drawing.Point(251, 60); + this.CB_Pokemon_1_Move_3.Location = new System.Drawing.Point(251, 68); this.CB_Pokemon_1_Move_3.Name = "CB_Pokemon_1_Move_3"; this.CB_Pokemon_1_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_3.TabIndex = 31; @@ -695,7 +695,7 @@ private void InitializeComponent() // L_Pokemon_1_Move_2 // this.L_Pokemon_1_Move_2.AutoSize = true; - this.L_Pokemon_1_Move_2.Location = new System.Drawing.Point(199, 36); + this.L_Pokemon_1_Move_2.Location = new System.Drawing.Point(199, 44); this.L_Pokemon_1_Move_2.Name = "L_Pokemon_1_Move_2"; this.L_Pokemon_1_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_2.TabIndex = 30; @@ -707,7 +707,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_2.Enabled = false; this.CB_Pokemon_1_Move_2.FormattingEnabled = true; - this.CB_Pokemon_1_Move_2.Location = new System.Drawing.Point(251, 33); + this.CB_Pokemon_1_Move_2.Location = new System.Drawing.Point(251, 41); this.CB_Pokemon_1_Move_2.Name = "CB_Pokemon_1_Move_2"; this.CB_Pokemon_1_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_2.TabIndex = 29; @@ -715,7 +715,7 @@ private void InitializeComponent() // L_Pokemon_1_Move_1 // this.L_Pokemon_1_Move_1.AutoSize = true; - this.L_Pokemon_1_Move_1.Location = new System.Drawing.Point(199, 9); + this.L_Pokemon_1_Move_1.Location = new System.Drawing.Point(199, 17); this.L_Pokemon_1_Move_1.Name = "L_Pokemon_1_Move_1"; this.L_Pokemon_1_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_1.TabIndex = 28; @@ -727,7 +727,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_1.Enabled = false; this.CB_Pokemon_1_Move_1.FormattingEnabled = true; - this.CB_Pokemon_1_Move_1.Location = new System.Drawing.Point(251, 6); + this.CB_Pokemon_1_Move_1.Location = new System.Drawing.Point(251, 14); this.CB_Pokemon_1_Move_1.Name = "CB_Pokemon_1_Move_1"; this.CB_Pokemon_1_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_1.TabIndex = 27; @@ -735,7 +735,7 @@ private void InitializeComponent() // L_Pokemon_1_Item // this.L_Pokemon_1_Item.AutoSize = true; - this.L_Pokemon_1_Item.Location = new System.Drawing.Point(36, 90); + this.L_Pokemon_1_Item.Location = new System.Drawing.Point(36, 98); this.L_Pokemon_1_Item.Name = "L_Pokemon_1_Item"; this.L_Pokemon_1_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_1_Item.TabIndex = 26; @@ -747,7 +747,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Item.Enabled = false; this.CB_Pokemon_1_Item.FormattingEnabled = true; - this.CB_Pokemon_1_Item.Location = new System.Drawing.Point(72, 87); + this.CB_Pokemon_1_Item.Location = new System.Drawing.Point(72, 95); this.CB_Pokemon_1_Item.Name = "CB_Pokemon_1_Item"; this.CB_Pokemon_1_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Item.TabIndex = 25; @@ -756,7 +756,7 @@ private void InitializeComponent() // L_Pokemon_1_Level // this.L_Pokemon_1_Level.AutoSize = true; - this.L_Pokemon_1_Level.Location = new System.Drawing.Point(30, 63); + this.L_Pokemon_1_Level.Location = new System.Drawing.Point(30, 71); this.L_Pokemon_1_Level.Name = "L_Pokemon_1_Level"; this.L_Pokemon_1_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_1_Level.TabIndex = 24; @@ -768,7 +768,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Level.Enabled = false; this.CB_Pokemon_1_Level.FormattingEnabled = true; - this.CB_Pokemon_1_Level.Location = new System.Drawing.Point(72, 60); + this.CB_Pokemon_1_Level.Location = new System.Drawing.Point(72, 68); this.CB_Pokemon_1_Level.Name = "CB_Pokemon_1_Level"; this.CB_Pokemon_1_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Level.TabIndex = 23; @@ -776,7 +776,7 @@ private void InitializeComponent() // L_Pokemon_1_Pokemon // this.L_Pokemon_1_Pokemon.AutoSize = true; - this.L_Pokemon_1_Pokemon.Location = new System.Drawing.Point(11, 9); + this.L_Pokemon_1_Pokemon.Location = new System.Drawing.Point(11, 17); this.L_Pokemon_1_Pokemon.Name = "L_Pokemon_1_Pokemon"; this.L_Pokemon_1_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_1_Pokemon.TabIndex = 22; @@ -788,7 +788,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Pokemon.Enabled = false; this.CB_Pokemon_1_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_1_Pokemon.Location = new System.Drawing.Point(72, 6); + this.CB_Pokemon_1_Pokemon.Location = new System.Drawing.Point(72, 14); this.CB_Pokemon_1_Pokemon.Name = "CB_Pokemon_1_Pokemon"; this.CB_Pokemon_1_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Pokemon.TabIndex = 21; @@ -829,7 +829,7 @@ private void InitializeComponent() // L_Pokemon_2_Gender // this.L_Pokemon_2_Gender.AutoSize = true; - this.L_Pokemon_2_Gender.Location = new System.Drawing.Point(378, 63); + this.L_Pokemon_2_Gender.Location = new System.Drawing.Point(378, 71); this.L_Pokemon_2_Gender.Name = "L_Pokemon_2_Gender"; this.L_Pokemon_2_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_2_Gender.TabIndex = 65; @@ -841,7 +841,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Gender.Enabled = false; this.CB_Pokemon_2_Gender.FormattingEnabled = true; - this.CB_Pokemon_2_Gender.Location = new System.Drawing.Point(429, 60); + this.CB_Pokemon_2_Gender.Location = new System.Drawing.Point(429, 68); this.CB_Pokemon_2_Gender.Name = "CB_Pokemon_2_Gender"; this.CB_Pokemon_2_Gender.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Gender.TabIndex = 64; @@ -850,7 +850,7 @@ private void InitializeComponent() // L_Pokemon_2_Ability // this.L_Pokemon_2_Ability.AutoSize = true; - this.L_Pokemon_2_Ability.Location = new System.Drawing.Point(386, 36); + this.L_Pokemon_2_Ability.Location = new System.Drawing.Point(386, 44); this.L_Pokemon_2_Ability.Name = "L_Pokemon_2_Ability"; this.L_Pokemon_2_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_2_Ability.TabIndex = 63; @@ -862,7 +862,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Ability.Enabled = false; this.CB_Pokemon_2_Ability.FormattingEnabled = true; - this.CB_Pokemon_2_Ability.Location = new System.Drawing.Point(429, 33); + this.CB_Pokemon_2_Ability.Location = new System.Drawing.Point(429, 41); this.CB_Pokemon_2_Ability.Name = "CB_Pokemon_2_Ability"; this.CB_Pokemon_2_Ability.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Ability.TabIndex = 62; @@ -870,7 +870,7 @@ private void InitializeComponent() // L_Pokemon_2_Form // this.L_Pokemon_2_Form.AutoSize = true; - this.L_Pokemon_2_Form.Location = new System.Drawing.Point(33, 36); + this.L_Pokemon_2_Form.Location = new System.Drawing.Point(33, 44); this.L_Pokemon_2_Form.Name = "L_Pokemon_2_Form"; this.L_Pokemon_2_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_2_Form.TabIndex = 59; @@ -882,7 +882,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Form.Enabled = false; this.CB_Pokemon_2_Form.FormattingEnabled = true; - this.CB_Pokemon_2_Form.Location = new System.Drawing.Point(72, 33); + this.CB_Pokemon_2_Form.Location = new System.Drawing.Point(72, 41); this.CB_Pokemon_2_Form.Name = "CB_Pokemon_2_Form"; this.CB_Pokemon_2_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Form.TabIndex = 58; @@ -891,7 +891,7 @@ private void InitializeComponent() // L_Pokemon_2_IVs // this.L_Pokemon_2_IVs.AutoSize = true; - this.L_Pokemon_2_IVs.Location = new System.Drawing.Point(398, 9); + this.L_Pokemon_2_IVs.Location = new System.Drawing.Point(398, 17); this.L_Pokemon_2_IVs.Name = "L_Pokemon_2_IVs"; this.L_Pokemon_2_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_2_IVs.TabIndex = 38; @@ -903,7 +903,7 @@ private void InitializeComponent() this.CB_Pokemon_2_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_IVs.Enabled = false; this.CB_Pokemon_2_IVs.FormattingEnabled = true; - this.CB_Pokemon_2_IVs.Location = new System.Drawing.Point(429, 6); + this.CB_Pokemon_2_IVs.Location = new System.Drawing.Point(429, 14); this.CB_Pokemon_2_IVs.Name = "CB_Pokemon_2_IVs"; this.CB_Pokemon_2_IVs.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_IVs.TabIndex = 37; @@ -911,7 +911,7 @@ private void InitializeComponent() // L_Pokemon_2_Move_4 // this.L_Pokemon_2_Move_4.AutoSize = true; - this.L_Pokemon_2_Move_4.Location = new System.Drawing.Point(199, 90); + this.L_Pokemon_2_Move_4.Location = new System.Drawing.Point(199, 98); this.L_Pokemon_2_Move_4.Name = "L_Pokemon_2_Move_4"; this.L_Pokemon_2_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_4.TabIndex = 34; @@ -923,7 +923,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_4.Enabled = false; this.CB_Pokemon_2_Move_4.FormattingEnabled = true; - this.CB_Pokemon_2_Move_4.Location = new System.Drawing.Point(251, 87); + this.CB_Pokemon_2_Move_4.Location = new System.Drawing.Point(251, 95); this.CB_Pokemon_2_Move_4.Name = "CB_Pokemon_2_Move_4"; this.CB_Pokemon_2_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_4.TabIndex = 33; @@ -931,7 +931,7 @@ private void InitializeComponent() // L_Pokemon_2_Move_3 // this.L_Pokemon_2_Move_3.AutoSize = true; - this.L_Pokemon_2_Move_3.Location = new System.Drawing.Point(199, 63); + this.L_Pokemon_2_Move_3.Location = new System.Drawing.Point(199, 71); this.L_Pokemon_2_Move_3.Name = "L_Pokemon_2_Move_3"; this.L_Pokemon_2_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_3.TabIndex = 32; @@ -943,7 +943,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_3.Enabled = false; this.CB_Pokemon_2_Move_3.FormattingEnabled = true; - this.CB_Pokemon_2_Move_3.Location = new System.Drawing.Point(251, 60); + this.CB_Pokemon_2_Move_3.Location = new System.Drawing.Point(251, 68); this.CB_Pokemon_2_Move_3.Name = "CB_Pokemon_2_Move_3"; this.CB_Pokemon_2_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_3.TabIndex = 31; @@ -951,7 +951,7 @@ private void InitializeComponent() // L_Pokemon_2_Move_2 // this.L_Pokemon_2_Move_2.AutoSize = true; - this.L_Pokemon_2_Move_2.Location = new System.Drawing.Point(199, 36); + this.L_Pokemon_2_Move_2.Location = new System.Drawing.Point(199, 44); this.L_Pokemon_2_Move_2.Name = "L_Pokemon_2_Move_2"; this.L_Pokemon_2_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_2.TabIndex = 30; @@ -963,7 +963,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_2.Enabled = false; this.CB_Pokemon_2_Move_2.FormattingEnabled = true; - this.CB_Pokemon_2_Move_2.Location = new System.Drawing.Point(251, 33); + this.CB_Pokemon_2_Move_2.Location = new System.Drawing.Point(251, 41); this.CB_Pokemon_2_Move_2.Name = "CB_Pokemon_2_Move_2"; this.CB_Pokemon_2_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_2.TabIndex = 29; @@ -971,7 +971,7 @@ private void InitializeComponent() // L_Pokemon_2_Move_1 // this.L_Pokemon_2_Move_1.AutoSize = true; - this.L_Pokemon_2_Move_1.Location = new System.Drawing.Point(199, 9); + this.L_Pokemon_2_Move_1.Location = new System.Drawing.Point(199, 17); this.L_Pokemon_2_Move_1.Name = "L_Pokemon_2_Move_1"; this.L_Pokemon_2_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_1.TabIndex = 28; @@ -983,7 +983,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_1.Enabled = false; this.CB_Pokemon_2_Move_1.FormattingEnabled = true; - this.CB_Pokemon_2_Move_1.Location = new System.Drawing.Point(251, 6); + this.CB_Pokemon_2_Move_1.Location = new System.Drawing.Point(251, 14); this.CB_Pokemon_2_Move_1.Name = "CB_Pokemon_2_Move_1"; this.CB_Pokemon_2_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_1.TabIndex = 27; @@ -991,7 +991,7 @@ private void InitializeComponent() // L_Pokemon_2_Item // this.L_Pokemon_2_Item.AutoSize = true; - this.L_Pokemon_2_Item.Location = new System.Drawing.Point(36, 90); + this.L_Pokemon_2_Item.Location = new System.Drawing.Point(36, 98); this.L_Pokemon_2_Item.Name = "L_Pokemon_2_Item"; this.L_Pokemon_2_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_2_Item.TabIndex = 26; @@ -1003,7 +1003,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Item.Enabled = false; this.CB_Pokemon_2_Item.FormattingEnabled = true; - this.CB_Pokemon_2_Item.Location = new System.Drawing.Point(72, 87); + this.CB_Pokemon_2_Item.Location = new System.Drawing.Point(72, 95); this.CB_Pokemon_2_Item.Name = "CB_Pokemon_2_Item"; this.CB_Pokemon_2_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Item.TabIndex = 25; @@ -1012,7 +1012,7 @@ private void InitializeComponent() // L_CB_Pokemon_2_Level // this.L_CB_Pokemon_2_Level.AutoSize = true; - this.L_CB_Pokemon_2_Level.Location = new System.Drawing.Point(30, 63); + this.L_CB_Pokemon_2_Level.Location = new System.Drawing.Point(30, 71); this.L_CB_Pokemon_2_Level.Name = "L_CB_Pokemon_2_Level"; this.L_CB_Pokemon_2_Level.Size = new System.Drawing.Size(36, 13); this.L_CB_Pokemon_2_Level.TabIndex = 24; @@ -1024,7 +1024,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Level.Enabled = false; this.CB_Pokemon_2_Level.FormattingEnabled = true; - this.CB_Pokemon_2_Level.Location = new System.Drawing.Point(72, 60); + this.CB_Pokemon_2_Level.Location = new System.Drawing.Point(72, 68); this.CB_Pokemon_2_Level.Name = "CB_Pokemon_2_Level"; this.CB_Pokemon_2_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Level.TabIndex = 23; @@ -1032,7 +1032,7 @@ private void InitializeComponent() // L_Pokemon_2_Pokemon // this.L_Pokemon_2_Pokemon.AutoSize = true; - this.L_Pokemon_2_Pokemon.Location = new System.Drawing.Point(11, 9); + this.L_Pokemon_2_Pokemon.Location = new System.Drawing.Point(11, 17); this.L_Pokemon_2_Pokemon.Name = "L_Pokemon_2_Pokemon"; this.L_Pokemon_2_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_2_Pokemon.TabIndex = 22; @@ -1044,7 +1044,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Pokemon.Enabled = false; this.CB_Pokemon_2_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_2_Pokemon.Location = new System.Drawing.Point(72, 6); + this.CB_Pokemon_2_Pokemon.Location = new System.Drawing.Point(72, 14); this.CB_Pokemon_2_Pokemon.Name = "CB_Pokemon_2_Pokemon"; this.CB_Pokemon_2_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Pokemon.TabIndex = 21; @@ -1085,7 +1085,7 @@ private void InitializeComponent() // L_Pokemon_3_Gender // this.L_Pokemon_3_Gender.AutoSize = true; - this.L_Pokemon_3_Gender.Location = new System.Drawing.Point(378, 63); + this.L_Pokemon_3_Gender.Location = new System.Drawing.Point(378, 71); this.L_Pokemon_3_Gender.Name = "L_Pokemon_3_Gender"; this.L_Pokemon_3_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_3_Gender.TabIndex = 65; @@ -1097,7 +1097,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Gender.Enabled = false; this.CB_Pokemon_3_Gender.FormattingEnabled = true; - this.CB_Pokemon_3_Gender.Location = new System.Drawing.Point(429, 60); + this.CB_Pokemon_3_Gender.Location = new System.Drawing.Point(429, 68); this.CB_Pokemon_3_Gender.Name = "CB_Pokemon_3_Gender"; this.CB_Pokemon_3_Gender.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Gender.TabIndex = 64; @@ -1106,7 +1106,7 @@ private void InitializeComponent() // L_Pokemon_3_Ability // this.L_Pokemon_3_Ability.AutoSize = true; - this.L_Pokemon_3_Ability.Location = new System.Drawing.Point(386, 36); + this.L_Pokemon_3_Ability.Location = new System.Drawing.Point(386, 44); this.L_Pokemon_3_Ability.Name = "L_Pokemon_3_Ability"; this.L_Pokemon_3_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_3_Ability.TabIndex = 63; @@ -1118,7 +1118,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Ability.Enabled = false; this.CB_Pokemon_3_Ability.FormattingEnabled = true; - this.CB_Pokemon_3_Ability.Location = new System.Drawing.Point(429, 33); + this.CB_Pokemon_3_Ability.Location = new System.Drawing.Point(429, 41); this.CB_Pokemon_3_Ability.Name = "CB_Pokemon_3_Ability"; this.CB_Pokemon_3_Ability.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Ability.TabIndex = 62; @@ -1126,7 +1126,7 @@ private void InitializeComponent() // L_Pokemon_3_Form // this.L_Pokemon_3_Form.AutoSize = true; - this.L_Pokemon_3_Form.Location = new System.Drawing.Point(33, 36); + this.L_Pokemon_3_Form.Location = new System.Drawing.Point(33, 44); this.L_Pokemon_3_Form.Name = "L_Pokemon_3_Form"; this.L_Pokemon_3_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_3_Form.TabIndex = 59; @@ -1138,7 +1138,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Form.Enabled = false; this.CB_Pokemon_3_Form.FormattingEnabled = true; - this.CB_Pokemon_3_Form.Location = new System.Drawing.Point(72, 33); + this.CB_Pokemon_3_Form.Location = new System.Drawing.Point(72, 41); this.CB_Pokemon_3_Form.Name = "CB_Pokemon_3_Form"; this.CB_Pokemon_3_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Form.TabIndex = 58; @@ -1147,7 +1147,7 @@ private void InitializeComponent() // L_Pokemon_3_IVs // this.L_Pokemon_3_IVs.AutoSize = true; - this.L_Pokemon_3_IVs.Location = new System.Drawing.Point(398, 9); + this.L_Pokemon_3_IVs.Location = new System.Drawing.Point(398, 17); this.L_Pokemon_3_IVs.Name = "L_Pokemon_3_IVs"; this.L_Pokemon_3_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_3_IVs.TabIndex = 38; @@ -1159,7 +1159,7 @@ private void InitializeComponent() this.CB_Pokemon_3_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_IVs.Enabled = false; this.CB_Pokemon_3_IVs.FormattingEnabled = true; - this.CB_Pokemon_3_IVs.Location = new System.Drawing.Point(429, 6); + this.CB_Pokemon_3_IVs.Location = new System.Drawing.Point(429, 14); this.CB_Pokemon_3_IVs.Name = "CB_Pokemon_3_IVs"; this.CB_Pokemon_3_IVs.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_IVs.TabIndex = 37; @@ -1167,7 +1167,7 @@ private void InitializeComponent() // L_Pokemon_3_Move_4 // this.L_Pokemon_3_Move_4.AutoSize = true; - this.L_Pokemon_3_Move_4.Location = new System.Drawing.Point(199, 90); + this.L_Pokemon_3_Move_4.Location = new System.Drawing.Point(199, 98); this.L_Pokemon_3_Move_4.Name = "L_Pokemon_3_Move_4"; this.L_Pokemon_3_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_4.TabIndex = 34; @@ -1179,7 +1179,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_4.Enabled = false; this.CB_Pokemon_3_Move_4.FormattingEnabled = true; - this.CB_Pokemon_3_Move_4.Location = new System.Drawing.Point(251, 87); + this.CB_Pokemon_3_Move_4.Location = new System.Drawing.Point(251, 95); this.CB_Pokemon_3_Move_4.Name = "CB_Pokemon_3_Move_4"; this.CB_Pokemon_3_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_4.TabIndex = 33; @@ -1187,7 +1187,7 @@ private void InitializeComponent() // L_Pokemon_3_Move_3 // this.L_Pokemon_3_Move_3.AutoSize = true; - this.L_Pokemon_3_Move_3.Location = new System.Drawing.Point(199, 63); + this.L_Pokemon_3_Move_3.Location = new System.Drawing.Point(199, 71); this.L_Pokemon_3_Move_3.Name = "L_Pokemon_3_Move_3"; this.L_Pokemon_3_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_3.TabIndex = 32; @@ -1199,7 +1199,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_3.Enabled = false; this.CB_Pokemon_3_Move_3.FormattingEnabled = true; - this.CB_Pokemon_3_Move_3.Location = new System.Drawing.Point(251, 60); + this.CB_Pokemon_3_Move_3.Location = new System.Drawing.Point(251, 68); this.CB_Pokemon_3_Move_3.Name = "CB_Pokemon_3_Move_3"; this.CB_Pokemon_3_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_3.TabIndex = 31; @@ -1207,7 +1207,7 @@ private void InitializeComponent() // L_Pokemon_3_Move_2 // this.L_Pokemon_3_Move_2.AutoSize = true; - this.L_Pokemon_3_Move_2.Location = new System.Drawing.Point(199, 36); + this.L_Pokemon_3_Move_2.Location = new System.Drawing.Point(199, 44); this.L_Pokemon_3_Move_2.Name = "L_Pokemon_3_Move_2"; this.L_Pokemon_3_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_2.TabIndex = 30; @@ -1219,7 +1219,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_2.Enabled = false; this.CB_Pokemon_3_Move_2.FormattingEnabled = true; - this.CB_Pokemon_3_Move_2.Location = new System.Drawing.Point(251, 33); + this.CB_Pokemon_3_Move_2.Location = new System.Drawing.Point(251, 41); this.CB_Pokemon_3_Move_2.Name = "CB_Pokemon_3_Move_2"; this.CB_Pokemon_3_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_2.TabIndex = 29; @@ -1227,7 +1227,7 @@ private void InitializeComponent() // L_Pokemon_3_Move_1 // this.L_Pokemon_3_Move_1.AutoSize = true; - this.L_Pokemon_3_Move_1.Location = new System.Drawing.Point(199, 9); + this.L_Pokemon_3_Move_1.Location = new System.Drawing.Point(199, 17); this.L_Pokemon_3_Move_1.Name = "L_Pokemon_3_Move_1"; this.L_Pokemon_3_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_1.TabIndex = 28; @@ -1239,7 +1239,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_1.Enabled = false; this.CB_Pokemon_3_Move_1.FormattingEnabled = true; - this.CB_Pokemon_3_Move_1.Location = new System.Drawing.Point(251, 6); + this.CB_Pokemon_3_Move_1.Location = new System.Drawing.Point(251, 14); this.CB_Pokemon_3_Move_1.Name = "CB_Pokemon_3_Move_1"; this.CB_Pokemon_3_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_1.TabIndex = 27; @@ -1247,7 +1247,7 @@ private void InitializeComponent() // L_Pokemon_3_Item // this.L_Pokemon_3_Item.AutoSize = true; - this.L_Pokemon_3_Item.Location = new System.Drawing.Point(36, 90); + this.L_Pokemon_3_Item.Location = new System.Drawing.Point(36, 98); this.L_Pokemon_3_Item.Name = "L_Pokemon_3_Item"; this.L_Pokemon_3_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_3_Item.TabIndex = 26; @@ -1259,7 +1259,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Item.Enabled = false; this.CB_Pokemon_3_Item.FormattingEnabled = true; - this.CB_Pokemon_3_Item.Location = new System.Drawing.Point(72, 87); + this.CB_Pokemon_3_Item.Location = new System.Drawing.Point(72, 95); this.CB_Pokemon_3_Item.Name = "CB_Pokemon_3_Item"; this.CB_Pokemon_3_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Item.TabIndex = 25; @@ -1268,7 +1268,7 @@ private void InitializeComponent() // L_Pokemon_3_Level // this.L_Pokemon_3_Level.AutoSize = true; - this.L_Pokemon_3_Level.Location = new System.Drawing.Point(30, 63); + this.L_Pokemon_3_Level.Location = new System.Drawing.Point(30, 71); this.L_Pokemon_3_Level.Name = "L_Pokemon_3_Level"; this.L_Pokemon_3_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_3_Level.TabIndex = 24; @@ -1280,7 +1280,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Level.Enabled = false; this.CB_Pokemon_3_Level.FormattingEnabled = true; - this.CB_Pokemon_3_Level.Location = new System.Drawing.Point(72, 60); + this.CB_Pokemon_3_Level.Location = new System.Drawing.Point(72, 68); this.CB_Pokemon_3_Level.Name = "CB_Pokemon_3_Level"; this.CB_Pokemon_3_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Level.TabIndex = 23; @@ -1288,7 +1288,7 @@ private void InitializeComponent() // L_Pokemon_3_Pokemon // this.L_Pokemon_3_Pokemon.AutoSize = true; - this.L_Pokemon_3_Pokemon.Location = new System.Drawing.Point(11, 9); + this.L_Pokemon_3_Pokemon.Location = new System.Drawing.Point(11, 17); this.L_Pokemon_3_Pokemon.Name = "L_Pokemon_3_Pokemon"; this.L_Pokemon_3_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_3_Pokemon.TabIndex = 22; @@ -1300,7 +1300,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Pokemon.Enabled = false; this.CB_Pokemon_3_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_3_Pokemon.Location = new System.Drawing.Point(72, 6); + this.CB_Pokemon_3_Pokemon.Location = new System.Drawing.Point(72, 14); this.CB_Pokemon_3_Pokemon.Name = "CB_Pokemon_3_Pokemon"; this.CB_Pokemon_3_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Pokemon.TabIndex = 21; @@ -1341,7 +1341,7 @@ private void InitializeComponent() // L_Pokemon_4_Gender // this.L_Pokemon_4_Gender.AutoSize = true; - this.L_Pokemon_4_Gender.Location = new System.Drawing.Point(378, 63); + this.L_Pokemon_4_Gender.Location = new System.Drawing.Point(378, 71); this.L_Pokemon_4_Gender.Name = "L_Pokemon_4_Gender"; this.L_Pokemon_4_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_4_Gender.TabIndex = 65; @@ -1353,7 +1353,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Gender.Enabled = false; this.CB_Pokemon_4_Gender.FormattingEnabled = true; - this.CB_Pokemon_4_Gender.Location = new System.Drawing.Point(429, 60); + this.CB_Pokemon_4_Gender.Location = new System.Drawing.Point(429, 68); this.CB_Pokemon_4_Gender.Name = "CB_Pokemon_4_Gender"; this.CB_Pokemon_4_Gender.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Gender.TabIndex = 64; @@ -1362,7 +1362,7 @@ private void InitializeComponent() // L_Pokemon_4_Ability // this.L_Pokemon_4_Ability.AutoSize = true; - this.L_Pokemon_4_Ability.Location = new System.Drawing.Point(386, 36); + this.L_Pokemon_4_Ability.Location = new System.Drawing.Point(386, 44); this.L_Pokemon_4_Ability.Name = "L_Pokemon_4_Ability"; this.L_Pokemon_4_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_4_Ability.TabIndex = 63; @@ -1374,7 +1374,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Ability.Enabled = false; this.CB_Pokemon_4_Ability.FormattingEnabled = true; - this.CB_Pokemon_4_Ability.Location = new System.Drawing.Point(429, 33); + this.CB_Pokemon_4_Ability.Location = new System.Drawing.Point(429, 41); this.CB_Pokemon_4_Ability.Name = "CB_Pokemon_4_Ability"; this.CB_Pokemon_4_Ability.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Ability.TabIndex = 62; @@ -1382,7 +1382,7 @@ private void InitializeComponent() // L_Pokemon_4_Form // this.L_Pokemon_4_Form.AutoSize = true; - this.L_Pokemon_4_Form.Location = new System.Drawing.Point(33, 36); + this.L_Pokemon_4_Form.Location = new System.Drawing.Point(33, 44); this.L_Pokemon_4_Form.Name = "L_Pokemon_4_Form"; this.L_Pokemon_4_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_4_Form.TabIndex = 59; @@ -1394,7 +1394,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Form.Enabled = false; this.CB_Pokemon_4_Form.FormattingEnabled = true; - this.CB_Pokemon_4_Form.Location = new System.Drawing.Point(72, 33); + this.CB_Pokemon_4_Form.Location = new System.Drawing.Point(72, 41); this.CB_Pokemon_4_Form.Name = "CB_Pokemon_4_Form"; this.CB_Pokemon_4_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Form.TabIndex = 58; @@ -1403,7 +1403,7 @@ private void InitializeComponent() // L_Pokemon_4_IVs // this.L_Pokemon_4_IVs.AutoSize = true; - this.L_Pokemon_4_IVs.Location = new System.Drawing.Point(398, 9); + this.L_Pokemon_4_IVs.Location = new System.Drawing.Point(398, 17); this.L_Pokemon_4_IVs.Name = "L_Pokemon_4_IVs"; this.L_Pokemon_4_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_4_IVs.TabIndex = 38; @@ -1415,7 +1415,7 @@ private void InitializeComponent() this.CB_Pokemon_4_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_IVs.Enabled = false; this.CB_Pokemon_4_IVs.FormattingEnabled = true; - this.CB_Pokemon_4_IVs.Location = new System.Drawing.Point(429, 6); + this.CB_Pokemon_4_IVs.Location = new System.Drawing.Point(429, 14); this.CB_Pokemon_4_IVs.Name = "CB_Pokemon_4_IVs"; this.CB_Pokemon_4_IVs.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_IVs.TabIndex = 37; @@ -1423,7 +1423,7 @@ private void InitializeComponent() // L_Pokemon_4_Move_4 // this.L_Pokemon_4_Move_4.AutoSize = true; - this.L_Pokemon_4_Move_4.Location = new System.Drawing.Point(199, 90); + this.L_Pokemon_4_Move_4.Location = new System.Drawing.Point(199, 98); this.L_Pokemon_4_Move_4.Name = "L_Pokemon_4_Move_4"; this.L_Pokemon_4_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_4.TabIndex = 34; @@ -1435,7 +1435,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_4.Enabled = false; this.CB_Pokemon_4_Move_4.FormattingEnabled = true; - this.CB_Pokemon_4_Move_4.Location = new System.Drawing.Point(251, 87); + this.CB_Pokemon_4_Move_4.Location = new System.Drawing.Point(251, 95); this.CB_Pokemon_4_Move_4.Name = "CB_Pokemon_4_Move_4"; this.CB_Pokemon_4_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_4.TabIndex = 33; @@ -1443,7 +1443,7 @@ private void InitializeComponent() // L_Pokemon_4_Move_3 // this.L_Pokemon_4_Move_3.AutoSize = true; - this.L_Pokemon_4_Move_3.Location = new System.Drawing.Point(199, 63); + this.L_Pokemon_4_Move_3.Location = new System.Drawing.Point(199, 71); this.L_Pokemon_4_Move_3.Name = "L_Pokemon_4_Move_3"; this.L_Pokemon_4_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_3.TabIndex = 32; @@ -1455,7 +1455,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_3.Enabled = false; this.CB_Pokemon_4_Move_3.FormattingEnabled = true; - this.CB_Pokemon_4_Move_3.Location = new System.Drawing.Point(251, 60); + this.CB_Pokemon_4_Move_3.Location = new System.Drawing.Point(251, 68); this.CB_Pokemon_4_Move_3.Name = "CB_Pokemon_4_Move_3"; this.CB_Pokemon_4_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_3.TabIndex = 31; @@ -1463,7 +1463,7 @@ private void InitializeComponent() // L_Pokemon_4_Move_2 // this.L_Pokemon_4_Move_2.AutoSize = true; - this.L_Pokemon_4_Move_2.Location = new System.Drawing.Point(199, 36); + this.L_Pokemon_4_Move_2.Location = new System.Drawing.Point(199, 44); this.L_Pokemon_4_Move_2.Name = "L_Pokemon_4_Move_2"; this.L_Pokemon_4_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_2.TabIndex = 30; @@ -1475,7 +1475,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_2.Enabled = false; this.CB_Pokemon_4_Move_2.FormattingEnabled = true; - this.CB_Pokemon_4_Move_2.Location = new System.Drawing.Point(251, 33); + this.CB_Pokemon_4_Move_2.Location = new System.Drawing.Point(251, 41); this.CB_Pokemon_4_Move_2.Name = "CB_Pokemon_4_Move_2"; this.CB_Pokemon_4_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_2.TabIndex = 29; @@ -1483,7 +1483,7 @@ private void InitializeComponent() // L_Pokemon_4_Move_1 // this.L_Pokemon_4_Move_1.AutoSize = true; - this.L_Pokemon_4_Move_1.Location = new System.Drawing.Point(199, 9); + this.L_Pokemon_4_Move_1.Location = new System.Drawing.Point(199, 17); this.L_Pokemon_4_Move_1.Name = "L_Pokemon_4_Move_1"; this.L_Pokemon_4_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_1.TabIndex = 28; @@ -1495,7 +1495,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_1.Enabled = false; this.CB_Pokemon_4_Move_1.FormattingEnabled = true; - this.CB_Pokemon_4_Move_1.Location = new System.Drawing.Point(251, 6); + this.CB_Pokemon_4_Move_1.Location = new System.Drawing.Point(251, 14); this.CB_Pokemon_4_Move_1.Name = "CB_Pokemon_4_Move_1"; this.CB_Pokemon_4_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_1.TabIndex = 27; @@ -1503,7 +1503,7 @@ private void InitializeComponent() // L_CB_Pokemon_4_Item // this.L_CB_Pokemon_4_Item.AutoSize = true; - this.L_CB_Pokemon_4_Item.Location = new System.Drawing.Point(36, 90); + this.L_CB_Pokemon_4_Item.Location = new System.Drawing.Point(36, 98); this.L_CB_Pokemon_4_Item.Name = "L_CB_Pokemon_4_Item"; this.L_CB_Pokemon_4_Item.Size = new System.Drawing.Size(30, 13); this.L_CB_Pokemon_4_Item.TabIndex = 26; @@ -1515,7 +1515,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Item.Enabled = false; this.CB_Pokemon_4_Item.FormattingEnabled = true; - this.CB_Pokemon_4_Item.Location = new System.Drawing.Point(72, 87); + this.CB_Pokemon_4_Item.Location = new System.Drawing.Point(72, 95); this.CB_Pokemon_4_Item.Name = "CB_Pokemon_4_Item"; this.CB_Pokemon_4_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Item.TabIndex = 25; @@ -1524,7 +1524,7 @@ private void InitializeComponent() // L_Pokemon_4_Level // this.L_Pokemon_4_Level.AutoSize = true; - this.L_Pokemon_4_Level.Location = new System.Drawing.Point(30, 63); + this.L_Pokemon_4_Level.Location = new System.Drawing.Point(30, 71); this.L_Pokemon_4_Level.Name = "L_Pokemon_4_Level"; this.L_Pokemon_4_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_4_Level.TabIndex = 24; @@ -1536,7 +1536,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Level.Enabled = false; this.CB_Pokemon_4_Level.FormattingEnabled = true; - this.CB_Pokemon_4_Level.Location = new System.Drawing.Point(72, 60); + this.CB_Pokemon_4_Level.Location = new System.Drawing.Point(72, 68); this.CB_Pokemon_4_Level.Name = "CB_Pokemon_4_Level"; this.CB_Pokemon_4_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Level.TabIndex = 23; @@ -1544,7 +1544,7 @@ private void InitializeComponent() // L_Pokemon_4_Pokemon // this.L_Pokemon_4_Pokemon.AutoSize = true; - this.L_Pokemon_4_Pokemon.Location = new System.Drawing.Point(11, 9); + this.L_Pokemon_4_Pokemon.Location = new System.Drawing.Point(11, 17); this.L_Pokemon_4_Pokemon.Name = "L_Pokemon_4_Pokemon"; this.L_Pokemon_4_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_4_Pokemon.TabIndex = 22; @@ -1556,7 +1556,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Pokemon.Enabled = false; this.CB_Pokemon_4_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_4_Pokemon.Location = new System.Drawing.Point(72, 6); + this.CB_Pokemon_4_Pokemon.Location = new System.Drawing.Point(72, 14); this.CB_Pokemon_4_Pokemon.Name = "CB_Pokemon_4_Pokemon"; this.CB_Pokemon_4_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Pokemon.TabIndex = 21; @@ -1597,7 +1597,7 @@ private void InitializeComponent() // L_Pokemon_5_Gender // this.L_Pokemon_5_Gender.AutoSize = true; - this.L_Pokemon_5_Gender.Location = new System.Drawing.Point(378, 63); + this.L_Pokemon_5_Gender.Location = new System.Drawing.Point(378, 71); this.L_Pokemon_5_Gender.Name = "L_Pokemon_5_Gender"; this.L_Pokemon_5_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_5_Gender.TabIndex = 65; @@ -1609,7 +1609,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Gender.Enabled = false; this.CB_Pokemon_5_Gender.FormattingEnabled = true; - this.CB_Pokemon_5_Gender.Location = new System.Drawing.Point(429, 60); + this.CB_Pokemon_5_Gender.Location = new System.Drawing.Point(429, 68); this.CB_Pokemon_5_Gender.Name = "CB_Pokemon_5_Gender"; this.CB_Pokemon_5_Gender.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Gender.TabIndex = 64; @@ -1618,7 +1618,7 @@ private void InitializeComponent() // L_Pokemon_5_Ability // this.L_Pokemon_5_Ability.AutoSize = true; - this.L_Pokemon_5_Ability.Location = new System.Drawing.Point(386, 36); + this.L_Pokemon_5_Ability.Location = new System.Drawing.Point(386, 44); this.L_Pokemon_5_Ability.Name = "L_Pokemon_5_Ability"; this.L_Pokemon_5_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_5_Ability.TabIndex = 63; @@ -1630,7 +1630,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Ability.Enabled = false; this.CB_Pokemon_5_Ability.FormattingEnabled = true; - this.CB_Pokemon_5_Ability.Location = new System.Drawing.Point(429, 33); + this.CB_Pokemon_5_Ability.Location = new System.Drawing.Point(429, 41); this.CB_Pokemon_5_Ability.Name = "CB_Pokemon_5_Ability"; this.CB_Pokemon_5_Ability.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Ability.TabIndex = 62; @@ -1638,7 +1638,7 @@ private void InitializeComponent() // L_Pokemon_5_Form // this.L_Pokemon_5_Form.AutoSize = true; - this.L_Pokemon_5_Form.Location = new System.Drawing.Point(33, 36); + this.L_Pokemon_5_Form.Location = new System.Drawing.Point(33, 44); this.L_Pokemon_5_Form.Name = "L_Pokemon_5_Form"; this.L_Pokemon_5_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_5_Form.TabIndex = 59; @@ -1650,7 +1650,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Form.Enabled = false; this.CB_Pokemon_5_Form.FormattingEnabled = true; - this.CB_Pokemon_5_Form.Location = new System.Drawing.Point(72, 33); + this.CB_Pokemon_5_Form.Location = new System.Drawing.Point(72, 41); this.CB_Pokemon_5_Form.Name = "CB_Pokemon_5_Form"; this.CB_Pokemon_5_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Form.TabIndex = 58; @@ -1659,7 +1659,7 @@ private void InitializeComponent() // L_Pokemon_5_IVs // this.L_Pokemon_5_IVs.AutoSize = true; - this.L_Pokemon_5_IVs.Location = new System.Drawing.Point(398, 9); + this.L_Pokemon_5_IVs.Location = new System.Drawing.Point(398, 17); this.L_Pokemon_5_IVs.Name = "L_Pokemon_5_IVs"; this.L_Pokemon_5_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_5_IVs.TabIndex = 38; @@ -1671,7 +1671,7 @@ private void InitializeComponent() this.CB_Pokemon_5_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_IVs.Enabled = false; this.CB_Pokemon_5_IVs.FormattingEnabled = true; - this.CB_Pokemon_5_IVs.Location = new System.Drawing.Point(429, 6); + this.CB_Pokemon_5_IVs.Location = new System.Drawing.Point(429, 14); this.CB_Pokemon_5_IVs.Name = "CB_Pokemon_5_IVs"; this.CB_Pokemon_5_IVs.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_IVs.TabIndex = 37; @@ -1679,7 +1679,7 @@ private void InitializeComponent() // L_Pokemon_5_Move_4 // this.L_Pokemon_5_Move_4.AutoSize = true; - this.L_Pokemon_5_Move_4.Location = new System.Drawing.Point(199, 90); + this.L_Pokemon_5_Move_4.Location = new System.Drawing.Point(199, 98); this.L_Pokemon_5_Move_4.Name = "L_Pokemon_5_Move_4"; this.L_Pokemon_5_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_4.TabIndex = 34; @@ -1691,7 +1691,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_4.Enabled = false; this.CB_Pokemon_5_Move_4.FormattingEnabled = true; - this.CB_Pokemon_5_Move_4.Location = new System.Drawing.Point(251, 87); + this.CB_Pokemon_5_Move_4.Location = new System.Drawing.Point(251, 95); this.CB_Pokemon_5_Move_4.Name = "CB_Pokemon_5_Move_4"; this.CB_Pokemon_5_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_4.TabIndex = 33; @@ -1699,7 +1699,7 @@ private void InitializeComponent() // L_Pokemon_5_Move_3 // this.L_Pokemon_5_Move_3.AutoSize = true; - this.L_Pokemon_5_Move_3.Location = new System.Drawing.Point(199, 63); + this.L_Pokemon_5_Move_3.Location = new System.Drawing.Point(199, 71); this.L_Pokemon_5_Move_3.Name = "L_Pokemon_5_Move_3"; this.L_Pokemon_5_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_3.TabIndex = 32; @@ -1711,7 +1711,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_3.Enabled = false; this.CB_Pokemon_5_Move_3.FormattingEnabled = true; - this.CB_Pokemon_5_Move_3.Location = new System.Drawing.Point(251, 60); + this.CB_Pokemon_5_Move_3.Location = new System.Drawing.Point(251, 68); this.CB_Pokemon_5_Move_3.Name = "CB_Pokemon_5_Move_3"; this.CB_Pokemon_5_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_3.TabIndex = 31; @@ -1719,7 +1719,7 @@ private void InitializeComponent() // L_Pokemon_5_Move_2 // this.L_Pokemon_5_Move_2.AutoSize = true; - this.L_Pokemon_5_Move_2.Location = new System.Drawing.Point(199, 36); + this.L_Pokemon_5_Move_2.Location = new System.Drawing.Point(199, 44); this.L_Pokemon_5_Move_2.Name = "L_Pokemon_5_Move_2"; this.L_Pokemon_5_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_2.TabIndex = 30; @@ -1731,7 +1731,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_2.Enabled = false; this.CB_Pokemon_5_Move_2.FormattingEnabled = true; - this.CB_Pokemon_5_Move_2.Location = new System.Drawing.Point(251, 33); + this.CB_Pokemon_5_Move_2.Location = new System.Drawing.Point(251, 41); this.CB_Pokemon_5_Move_2.Name = "CB_Pokemon_5_Move_2"; this.CB_Pokemon_5_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_2.TabIndex = 29; @@ -1739,7 +1739,7 @@ private void InitializeComponent() // L_Pokemon_5_Move_1 // this.L_Pokemon_5_Move_1.AutoSize = true; - this.L_Pokemon_5_Move_1.Location = new System.Drawing.Point(199, 9); + this.L_Pokemon_5_Move_1.Location = new System.Drawing.Point(199, 17); this.L_Pokemon_5_Move_1.Name = "L_Pokemon_5_Move_1"; this.L_Pokemon_5_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_1.TabIndex = 28; @@ -1751,7 +1751,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_1.Enabled = false; this.CB_Pokemon_5_Move_1.FormattingEnabled = true; - this.CB_Pokemon_5_Move_1.Location = new System.Drawing.Point(251, 6); + this.CB_Pokemon_5_Move_1.Location = new System.Drawing.Point(251, 14); this.CB_Pokemon_5_Move_1.Name = "CB_Pokemon_5_Move_1"; this.CB_Pokemon_5_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_1.TabIndex = 27; @@ -1759,7 +1759,7 @@ private void InitializeComponent() // L_Pokemon_5_Item // this.L_Pokemon_5_Item.AutoSize = true; - this.L_Pokemon_5_Item.Location = new System.Drawing.Point(36, 90); + this.L_Pokemon_5_Item.Location = new System.Drawing.Point(36, 98); this.L_Pokemon_5_Item.Name = "L_Pokemon_5_Item"; this.L_Pokemon_5_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_5_Item.TabIndex = 26; @@ -1771,7 +1771,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Item.Enabled = false; this.CB_Pokemon_5_Item.FormattingEnabled = true; - this.CB_Pokemon_5_Item.Location = new System.Drawing.Point(72, 87); + this.CB_Pokemon_5_Item.Location = new System.Drawing.Point(72, 95); this.CB_Pokemon_5_Item.Name = "CB_Pokemon_5_Item"; this.CB_Pokemon_5_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Item.TabIndex = 25; @@ -1780,7 +1780,7 @@ private void InitializeComponent() // L_Pokemon_5_Level // this.L_Pokemon_5_Level.AutoSize = true; - this.L_Pokemon_5_Level.Location = new System.Drawing.Point(30, 63); + this.L_Pokemon_5_Level.Location = new System.Drawing.Point(30, 71); this.L_Pokemon_5_Level.Name = "L_Pokemon_5_Level"; this.L_Pokemon_5_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_5_Level.TabIndex = 24; @@ -1792,7 +1792,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Level.Enabled = false; this.CB_Pokemon_5_Level.FormattingEnabled = true; - this.CB_Pokemon_5_Level.Location = new System.Drawing.Point(72, 60); + this.CB_Pokemon_5_Level.Location = new System.Drawing.Point(72, 68); this.CB_Pokemon_5_Level.Name = "CB_Pokemon_5_Level"; this.CB_Pokemon_5_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Level.TabIndex = 23; @@ -1800,7 +1800,7 @@ private void InitializeComponent() // L_Pokemon_5_Pokemon // this.L_Pokemon_5_Pokemon.AutoSize = true; - this.L_Pokemon_5_Pokemon.Location = new System.Drawing.Point(11, 9); + this.L_Pokemon_5_Pokemon.Location = new System.Drawing.Point(11, 17); this.L_Pokemon_5_Pokemon.Name = "L_Pokemon_5_Pokemon"; this.L_Pokemon_5_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_5_Pokemon.TabIndex = 22; @@ -1812,7 +1812,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Pokemon.Enabled = false; this.CB_Pokemon_5_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_5_Pokemon.Location = new System.Drawing.Point(72, 6); + this.CB_Pokemon_5_Pokemon.Location = new System.Drawing.Point(72, 14); this.CB_Pokemon_5_Pokemon.Name = "CB_Pokemon_5_Pokemon"; this.CB_Pokemon_5_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Pokemon.TabIndex = 21; @@ -1853,7 +1853,7 @@ private void InitializeComponent() // L_Pokemon_6_Gender // this.L_Pokemon_6_Gender.AutoSize = true; - this.L_Pokemon_6_Gender.Location = new System.Drawing.Point(378, 63); + this.L_Pokemon_6_Gender.Location = new System.Drawing.Point(378, 71); this.L_Pokemon_6_Gender.Name = "L_Pokemon_6_Gender"; this.L_Pokemon_6_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_6_Gender.TabIndex = 65; @@ -1865,7 +1865,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Gender.Enabled = false; this.CB_Pokemon_6_Gender.FormattingEnabled = true; - this.CB_Pokemon_6_Gender.Location = new System.Drawing.Point(429, 60); + this.CB_Pokemon_6_Gender.Location = new System.Drawing.Point(429, 68); this.CB_Pokemon_6_Gender.Name = "CB_Pokemon_6_Gender"; this.CB_Pokemon_6_Gender.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Gender.TabIndex = 64; @@ -1874,7 +1874,7 @@ private void InitializeComponent() // L_Pokemon_6_Ability // this.L_Pokemon_6_Ability.AutoSize = true; - this.L_Pokemon_6_Ability.Location = new System.Drawing.Point(386, 36); + this.L_Pokemon_6_Ability.Location = new System.Drawing.Point(386, 44); this.L_Pokemon_6_Ability.Name = "L_Pokemon_6_Ability"; this.L_Pokemon_6_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_6_Ability.TabIndex = 63; @@ -1886,7 +1886,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Ability.Enabled = false; this.CB_Pokemon_6_Ability.FormattingEnabled = true; - this.CB_Pokemon_6_Ability.Location = new System.Drawing.Point(429, 33); + this.CB_Pokemon_6_Ability.Location = new System.Drawing.Point(429, 41); this.CB_Pokemon_6_Ability.Name = "CB_Pokemon_6_Ability"; this.CB_Pokemon_6_Ability.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Ability.TabIndex = 62; @@ -1894,7 +1894,7 @@ private void InitializeComponent() // L_Pokemon_6_Form // this.L_Pokemon_6_Form.AutoSize = true; - this.L_Pokemon_6_Form.Location = new System.Drawing.Point(33, 36); + this.L_Pokemon_6_Form.Location = new System.Drawing.Point(33, 44); this.L_Pokemon_6_Form.Name = "L_Pokemon_6_Form"; this.L_Pokemon_6_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_6_Form.TabIndex = 59; @@ -1906,7 +1906,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Form.Enabled = false; this.CB_Pokemon_6_Form.FormattingEnabled = true; - this.CB_Pokemon_6_Form.Location = new System.Drawing.Point(72, 33); + this.CB_Pokemon_6_Form.Location = new System.Drawing.Point(72, 41); this.CB_Pokemon_6_Form.Name = "CB_Pokemon_6_Form"; this.CB_Pokemon_6_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Form.TabIndex = 58; @@ -1915,7 +1915,7 @@ private void InitializeComponent() // L_Pokemon_6_IVs // this.L_Pokemon_6_IVs.AutoSize = true; - this.L_Pokemon_6_IVs.Location = new System.Drawing.Point(398, 9); + this.L_Pokemon_6_IVs.Location = new System.Drawing.Point(398, 17); this.L_Pokemon_6_IVs.Name = "L_Pokemon_6_IVs"; this.L_Pokemon_6_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_6_IVs.TabIndex = 38; @@ -1927,7 +1927,7 @@ private void InitializeComponent() this.CB_Pokemon_6_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_IVs.Enabled = false; this.CB_Pokemon_6_IVs.FormattingEnabled = true; - this.CB_Pokemon_6_IVs.Location = new System.Drawing.Point(429, 6); + this.CB_Pokemon_6_IVs.Location = new System.Drawing.Point(429, 14); this.CB_Pokemon_6_IVs.Name = "CB_Pokemon_6_IVs"; this.CB_Pokemon_6_IVs.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_IVs.TabIndex = 37; @@ -1935,7 +1935,7 @@ private void InitializeComponent() // L_Pokemon_6_Move_4 // this.L_Pokemon_6_Move_4.AutoSize = true; - this.L_Pokemon_6_Move_4.Location = new System.Drawing.Point(199, 90); + this.L_Pokemon_6_Move_4.Location = new System.Drawing.Point(199, 98); this.L_Pokemon_6_Move_4.Name = "L_Pokemon_6_Move_4"; this.L_Pokemon_6_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_4.TabIndex = 34; @@ -1947,7 +1947,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_4.Enabled = false; this.CB_Pokemon_6_Move_4.FormattingEnabled = true; - this.CB_Pokemon_6_Move_4.Location = new System.Drawing.Point(251, 87); + this.CB_Pokemon_6_Move_4.Location = new System.Drawing.Point(251, 95); this.CB_Pokemon_6_Move_4.Name = "CB_Pokemon_6_Move_4"; this.CB_Pokemon_6_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_4.TabIndex = 33; @@ -1955,7 +1955,7 @@ private void InitializeComponent() // L_Pokemon_6_Move_3 // this.L_Pokemon_6_Move_3.AutoSize = true; - this.L_Pokemon_6_Move_3.Location = new System.Drawing.Point(199, 63); + this.L_Pokemon_6_Move_3.Location = new System.Drawing.Point(199, 71); this.L_Pokemon_6_Move_3.Name = "L_Pokemon_6_Move_3"; this.L_Pokemon_6_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_3.TabIndex = 32; @@ -1967,7 +1967,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_3.Enabled = false; this.CB_Pokemon_6_Move_3.FormattingEnabled = true; - this.CB_Pokemon_6_Move_3.Location = new System.Drawing.Point(251, 60); + this.CB_Pokemon_6_Move_3.Location = new System.Drawing.Point(251, 68); this.CB_Pokemon_6_Move_3.Name = "CB_Pokemon_6_Move_3"; this.CB_Pokemon_6_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_3.TabIndex = 31; @@ -1975,7 +1975,7 @@ private void InitializeComponent() // L_Pokemon_6_Move_2 // this.L_Pokemon_6_Move_2.AutoSize = true; - this.L_Pokemon_6_Move_2.Location = new System.Drawing.Point(199, 36); + this.L_Pokemon_6_Move_2.Location = new System.Drawing.Point(199, 44); this.L_Pokemon_6_Move_2.Name = "L_Pokemon_6_Move_2"; this.L_Pokemon_6_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_2.TabIndex = 30; @@ -1987,7 +1987,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_2.Enabled = false; this.CB_Pokemon_6_Move_2.FormattingEnabled = true; - this.CB_Pokemon_6_Move_2.Location = new System.Drawing.Point(251, 33); + this.CB_Pokemon_6_Move_2.Location = new System.Drawing.Point(251, 41); this.CB_Pokemon_6_Move_2.Name = "CB_Pokemon_6_Move_2"; this.CB_Pokemon_6_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_2.TabIndex = 29; @@ -1995,7 +1995,7 @@ private void InitializeComponent() // L_Pokemon_6_Move_1 // this.L_Pokemon_6_Move_1.AutoSize = true; - this.L_Pokemon_6_Move_1.Location = new System.Drawing.Point(199, 9); + this.L_Pokemon_6_Move_1.Location = new System.Drawing.Point(199, 17); this.L_Pokemon_6_Move_1.Name = "L_Pokemon_6_Move_1"; this.L_Pokemon_6_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_1.TabIndex = 28; @@ -2007,7 +2007,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_1.Enabled = false; this.CB_Pokemon_6_Move_1.FormattingEnabled = true; - this.CB_Pokemon_6_Move_1.Location = new System.Drawing.Point(251, 6); + this.CB_Pokemon_6_Move_1.Location = new System.Drawing.Point(251, 14); this.CB_Pokemon_6_Move_1.Name = "CB_Pokemon_6_Move_1"; this.CB_Pokemon_6_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_1.TabIndex = 27; @@ -2015,7 +2015,7 @@ private void InitializeComponent() // L_Pokemon_6_Item // this.L_Pokemon_6_Item.AutoSize = true; - this.L_Pokemon_6_Item.Location = new System.Drawing.Point(36, 90); + this.L_Pokemon_6_Item.Location = new System.Drawing.Point(36, 98); this.L_Pokemon_6_Item.Name = "L_Pokemon_6_Item"; this.L_Pokemon_6_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_6_Item.TabIndex = 26; @@ -2027,7 +2027,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Item.Enabled = false; this.CB_Pokemon_6_Item.FormattingEnabled = true; - this.CB_Pokemon_6_Item.Location = new System.Drawing.Point(72, 87); + this.CB_Pokemon_6_Item.Location = new System.Drawing.Point(72, 95); this.CB_Pokemon_6_Item.Name = "CB_Pokemon_6_Item"; this.CB_Pokemon_6_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Item.TabIndex = 25; @@ -2036,7 +2036,7 @@ private void InitializeComponent() // L_Pokemon_6_Level // this.L_Pokemon_6_Level.AutoSize = true; - this.L_Pokemon_6_Level.Location = new System.Drawing.Point(30, 63); + this.L_Pokemon_6_Level.Location = new System.Drawing.Point(30, 71); this.L_Pokemon_6_Level.Name = "L_Pokemon_6_Level"; this.L_Pokemon_6_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_6_Level.TabIndex = 24; @@ -2048,7 +2048,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Level.Enabled = false; this.CB_Pokemon_6_Level.FormattingEnabled = true; - this.CB_Pokemon_6_Level.Location = new System.Drawing.Point(72, 60); + this.CB_Pokemon_6_Level.Location = new System.Drawing.Point(72, 68); this.CB_Pokemon_6_Level.Name = "CB_Pokemon_6_Level"; this.CB_Pokemon_6_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Level.TabIndex = 23; @@ -2056,7 +2056,7 @@ private void InitializeComponent() // L_Pokemon_6_Pokemon // this.L_Pokemon_6_Pokemon.AutoSize = true; - this.L_Pokemon_6_Pokemon.Location = new System.Drawing.Point(11, 9); + this.L_Pokemon_6_Pokemon.Location = new System.Drawing.Point(11, 17); this.L_Pokemon_6_Pokemon.Name = "L_Pokemon_6_Pokemon"; this.L_Pokemon_6_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_6_Pokemon.TabIndex = 22; @@ -2068,7 +2068,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Pokemon.Enabled = false; this.CB_Pokemon_6_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_6_Pokemon.Location = new System.Drawing.Point(72, 6); + this.CB_Pokemon_6_Pokemon.Location = new System.Drawing.Point(72, 14); this.CB_Pokemon_6_Pokemon.Name = "CB_Pokemon_6_Pokemon"; this.CB_Pokemon_6_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Pokemon.TabIndex = 21; diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index a16c664fbc..abcfff3ab8 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -717,7 +717,7 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom } // high-power attacks - if (rForceHighPower && pk.Level >= rForceHighPowerLevel && !rMetronome) + if (rForceHighPower && pk.Level >= rForceHighPowerLevel) { var pkMoves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); for (int m = 0; m < 4; m++) diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index 337d793b64..f02a0de2d8 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -118,7 +118,7 @@ private void CHK_RandomPKM_CheckedChanged(object sender, EventArgs e) GB_Tweak.Enabled = CHK_G1.Checked = CHK_G2.Checked = CHK_G3.Checked = CHK_G4.Checked = CHK_G5.Checked = CHK_G6.Checked = - CHK_L.Checked = CHK_E.Checked = CHK_StoryMEvos.Checked = + CHK_L.Checked = CHK_E.Checked = CHK_StoryMEvos.Checked = CHK_ForceFullyEvolved.Checked = CHK_RandomPKM.Checked; CHK_TypeTheme.Checked = CHK_GymTrainers.Checked = CHK_GymE4Only.Checked = @@ -162,8 +162,8 @@ private void changeMoveRandomization(object sender, EventArgs e) CHK_Damage.Enabled = CHK_STAB.Enabled = NUD_Damage.Enabled = NUD_STAB.Enabled = CB_Moves.SelectedIndex == 1; - //if (CB_Moves.SelectedIndex == 0) - // CHK_6PKM.Checked = false; + CHK_ForceHighPower.Enabled = CHK_ForceHighPower.Checked = NUD_ForceHighPower.Enabled = + CHK_NoFixedDamage.Enabled = CHK_NoFixedDamage.Checked = (CB_Moves.SelectedIndex == 1 || CB_Moves.SelectedIndex == 2); } private void CHK_6PKM_CheckedChanged(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs index 070525d0ed..1042fd92f7 100644 --- a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs @@ -138,7 +138,7 @@ private void B_RandAll_Click(object sender, EventArgs e) rand.Execute(); // sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); getList(); - WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!"); + WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!", "Press the Dump All button to see the new Egg Moves!"); } private void B_Dump_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs index d503b9ffce..f2612778e5 100644 --- a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs +++ b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs @@ -152,10 +152,12 @@ private void B_RandAll_Click(object sender, EventArgs e) rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); getList(); - WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!"); + WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!"); } private void B_Metronome_Click(object sender, EventArgs e) { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will modify learnsets to only have Metronome.") != DialogResult.Yes) return; + // clear all data, then only assign Metronome at Lv1 for (int i = 0; i < CB_Species.Items.Count; i++) { @@ -166,7 +168,7 @@ private void B_Metronome_Click(object sender, EventArgs e) dgv.Rows[0].Cells[1].Value = movelist[118]; } CB_Species.SelectedIndex = 0; - WinFormsUtil.Alert("All Pokémon now only know the move Metronome!", "It is recommended that you open the Move Editor and set the Base PP for Metronome to 40."); + WinFormsUtil.Alert("All Pokémon now only know the move Metronome!"); } private void B_Dump_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs index eec07973ed..5076a7c661 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs @@ -32,8 +32,11 @@ private void InitializeComponent() this.L_Species_Precursor = new System.Windows.Forms.Label(); this.TC_Pokemon = new System.Windows.Forms.TabControl(); this.TP_General = new System.Windows.Forms.TabPage(); + this.L_HiddenAbility = new System.Windows.Forms.Label(); this.L_WeightKG = new System.Windows.Forms.Label(); + this.L_Ability2 = new System.Windows.Forms.Label(); this.L_HeightM = new System.Windows.Forms.Label(); + this.L_Ability1 = new System.Windows.Forms.Label(); this.TB_Weight = new System.Windows.Forms.MaskedTextBox(); this.TB_Height = new System.Windows.Forms.MaskedTextBox(); this.L_Weight = new System.Windows.Forms.Label(); @@ -46,7 +49,6 @@ private void InitializeComponent() this.CHK_Variant = new System.Windows.Forms.CheckBox(); this.TB_BST = new System.Windows.Forms.TextBox(); this.L_BST = new System.Windows.Forms.Label(); - this.TB_RawColor = new System.Windows.Forms.TextBox(); this.TB_CatchRate = new System.Windows.Forms.MaskedTextBox(); this.TB_Stage = new System.Windows.Forms.TextBox(); this.L_Stage = new System.Windows.Forms.Label(); @@ -104,9 +106,9 @@ private void InitializeComponent() this.Label_SPE = new System.Windows.Forms.Label(); this.L_EVYield = new System.Windows.Forms.Label(); this.L_BaseStats = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); + this.L_ZMove = new System.Windows.Forms.Label(); this.L_BaseMove = new System.Windows.Forms.Label(); - this.L_ZItem = new System.Windows.Forms.Label(); + this.L_ZCrystal = new System.Windows.Forms.Label(); this.TP_MoveTutors = new System.Windows.Forms.TabPage(); this.L_BeachTutors = new System.Windows.Forms.Label(); this.CLB_BeachTutors = new System.Windows.Forms.CheckedListBox(); @@ -116,13 +118,14 @@ private void InitializeComponent() this.CLB_TM = new System.Windows.Forms.CheckedListBox(); this.TP_Randomizer = new System.Windows.Forms.TabPage(); this.GB_Modifier = new System.Windows.Forms.GroupBox(); + this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); this.CHK_CatchRateMod = new System.Windows.Forms.CheckBox(); this.L_CatchRateMod = new System.Windows.Forms.Label(); this.NUD_CatchRateMod = new System.Windows.Forms.NumericUpDown(); this.CHK_CallRate = new System.Windows.Forms.CheckBox(); - this.L_CallRateVal = new System.Windows.Forms.Label(); this.NUD_CallRate = new System.Windows.Forms.NumericUpDown(); this.CHK_EXP = new System.Windows.Forms.CheckBox(); + this.L_CallRateVal = new System.Windows.Forms.Label(); this.CHK_Growth = new System.Windows.Forms.CheckBox(); this.CHK_QuickHatch = new System.Windows.Forms.CheckBox(); this.L_FinalXP = new System.Windows.Forms.Label(); @@ -146,7 +149,6 @@ private void InitializeComponent() this.CHK_rATK = new System.Windows.Forms.CheckBox(); this.NUD_TypePercent = new System.Windows.Forms.NumericUpDown(); this.CHK_rHP = new System.Windows.Forms.CheckBox(); - this.CHK_HM = new System.Windows.Forms.CheckBox(); this.L_StatDev = new System.Windows.Forms.Label(); this.CHK_TM = new System.Windows.Forms.CheckBox(); this.NUD_StatDev = new System.Windows.Forms.NumericUpDown(); @@ -157,7 +159,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); + this.TB_RawColor = new System.Windows.Forms.TextBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -208,8 +210,12 @@ private void InitializeComponent() // // TP_General // + this.TP_General.Controls.Add(this.TB_RawColor); + this.TP_General.Controls.Add(this.L_HiddenAbility); this.TP_General.Controls.Add(this.L_WeightKG); + this.TP_General.Controls.Add(this.L_Ability2); this.TP_General.Controls.Add(this.L_HeightM); + this.TP_General.Controls.Add(this.L_Ability1); this.TP_General.Controls.Add(this.TB_Weight); this.TP_General.Controls.Add(this.TB_Height); this.TP_General.Controls.Add(this.L_Weight); @@ -222,7 +228,6 @@ private void InitializeComponent() this.TP_General.Controls.Add(this.CHK_Variant); this.TP_General.Controls.Add(this.TB_BST); this.TP_General.Controls.Add(this.L_BST); - this.TP_General.Controls.Add(this.TB_RawColor); this.TP_General.Controls.Add(this.TB_CatchRate); this.TP_General.Controls.Add(this.TB_Stage); this.TP_General.Controls.Add(this.L_Stage); @@ -280,9 +285,9 @@ private void InitializeComponent() this.TP_General.Controls.Add(this.Label_SPE); this.TP_General.Controls.Add(this.L_EVYield); this.TP_General.Controls.Add(this.L_BaseStats); - this.TP_General.Controls.Add(this.label1); + this.TP_General.Controls.Add(this.L_ZMove); this.TP_General.Controls.Add(this.L_BaseMove); - this.TP_General.Controls.Add(this.L_ZItem); + this.TP_General.Controls.Add(this.L_ZCrystal); this.TP_General.Location = new System.Drawing.Point(4, 22); this.TP_General.Name = "TP_General"; this.TP_General.Padding = new System.Windows.Forms.Padding(3); @@ -291,48 +296,75 @@ private void InitializeComponent() this.TP_General.Text = "General Info"; this.TP_General.UseVisualStyleBackColor = true; // + // L_HiddenAbility + // + this.L_HiddenAbility.AutoSize = true; + this.L_HiddenAbility.Location = new System.Drawing.Point(413, 126); + this.L_HiddenAbility.Name = "L_HiddenAbility"; + this.L_HiddenAbility.Size = new System.Drawing.Size(21, 13); + this.L_HiddenAbility.TabIndex = 421; + this.L_HiddenAbility.Text = "(H)"; + // // L_WeightKG // this.L_WeightKG.AutoSize = true; - this.L_WeightKG.Location = new System.Drawing.Point(415, 322); + this.L_WeightKG.Location = new System.Drawing.Point(416, 326); this.L_WeightKG.Name = "L_WeightKG"; this.L_WeightKG.Size = new System.Drawing.Size(19, 13); this.L_WeightKG.TabIndex = 105; this.L_WeightKG.Text = "kg"; // + // L_Ability2 + // + this.L_Ability2.AutoSize = true; + this.L_Ability2.Location = new System.Drawing.Point(414, 104); + this.L_Ability2.Name = "L_Ability2"; + this.L_Ability2.Size = new System.Drawing.Size(19, 13); + this.L_Ability2.TabIndex = 420; + this.L_Ability2.Text = "(2)"; + // // L_HeightM // this.L_HeightM.AutoSize = true; - this.L_HeightM.Location = new System.Drawing.Point(415, 302); + this.L_HeightM.Location = new System.Drawing.Point(416, 305); this.L_HeightM.Name = "L_HeightM"; this.L_HeightM.Size = new System.Drawing.Size(15, 13); this.L_HeightM.TabIndex = 104; this.L_HeightM.Text = "m"; // + // L_Ability1 + // + this.L_Ability1.AutoSize = true; + this.L_Ability1.Location = new System.Drawing.Point(414, 82); + this.L_Ability1.Name = "L_Ability1"; + this.L_Ability1.Size = new System.Drawing.Size(19, 13); + this.L_Ability1.TabIndex = 419; + this.L_Ability1.Text = "(1)"; + // // TB_Weight // this.TB_Weight.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Weight.Location = new System.Drawing.Point(381, 318); + this.TB_Weight.Location = new System.Drawing.Point(384, 322); this.TB_Weight.Mask = "000.0"; this.TB_Weight.Name = "TB_Weight"; - this.TB_Weight.Size = new System.Drawing.Size(31, 20); + this.TB_Weight.Size = new System.Drawing.Size(32, 20); this.TB_Weight.TabIndex = 103; this.TB_Weight.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // TB_Height // this.TB_Height.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Height.Location = new System.Drawing.Point(381, 298); + this.TB_Height.Location = new System.Drawing.Point(384, 301); this.TB_Height.Mask = "00.0"; this.TB_Height.Name = "TB_Height"; - this.TB_Height.Size = new System.Drawing.Size(31, 20); + this.TB_Height.Size = new System.Drawing.Size(32, 20); this.TB_Height.TabIndex = 102; this.TB_Height.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_Weight // this.L_Weight.AutoSize = true; - this.L_Weight.Location = new System.Drawing.Point(336, 322); + this.L_Weight.Location = new System.Drawing.Point(340, 325); this.L_Weight.Name = "L_Weight"; this.L_Weight.Size = new System.Drawing.Size(44, 13); this.L_Weight.TabIndex = 101; @@ -342,7 +374,7 @@ private void InitializeComponent() // L_Height // this.L_Height.AutoSize = true; - this.L_Height.Location = new System.Drawing.Point(339, 302); + this.L_Height.Location = new System.Drawing.Point(343, 304); this.L_Height.Name = "L_Height"; this.L_Height.Size = new System.Drawing.Size(41, 13); this.L_Height.TabIndex = 100; @@ -352,7 +384,7 @@ private void InitializeComponent() // CB_ZMove // this.CB_ZMove.FormattingEnabled = true; - this.CB_ZMove.Location = new System.Drawing.Point(177, 320); + this.CB_ZMove.Location = new System.Drawing.Point(177, 321); this.CB_ZMove.Name = "CB_ZMove"; this.CB_ZMove.Size = new System.Drawing.Size(121, 21); this.CB_ZMove.TabIndex = 98; @@ -368,7 +400,7 @@ private void InitializeComponent() // CB_ZItem // this.CB_ZItem.FormattingEnabled = true; - this.CB_ZItem.Location = new System.Drawing.Point(177, 278); + this.CB_ZItem.Location = new System.Drawing.Point(177, 277); this.CB_ZItem.Name = "CB_ZItem"; this.CB_ZItem.Size = new System.Drawing.Size(121, 21); this.CB_ZItem.TabIndex = 94; @@ -376,7 +408,7 @@ private void InitializeComponent() // TB_CallRate // this.TB_CallRate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_CallRate.Location = new System.Drawing.Point(77, 278); + this.TB_CallRate.Location = new System.Drawing.Point(77, 281); this.TB_CallRate.Mask = "000"; this.TB_CallRate.Name = "TB_CallRate"; this.TB_CallRate.Size = new System.Drawing.Size(31, 20); @@ -387,7 +419,7 @@ private void InitializeComponent() // L_CallRate // this.L_CallRate.AutoSize = true; - this.L_CallRate.Location = new System.Drawing.Point(23, 282); + this.L_CallRate.Location = new System.Drawing.Point(23, 285); this.L_CallRate.Name = "L_CallRate"; this.L_CallRate.Size = new System.Drawing.Size(53, 13); this.L_CallRate.TabIndex = 92; @@ -397,8 +429,7 @@ private void InitializeComponent() // CHK_Variant // this.CHK_Variant.AutoSize = true; - this.CHK_Variant.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; - this.CHK_Variant.Location = new System.Drawing.Point(178, 261); + this.CHK_Variant.Location = new System.Drawing.Point(185, 259); this.CHK_Variant.Name = "CHK_Variant"; this.CHK_Variant.Size = new System.Drawing.Size(104, 17); this.CHK_Variant.TabIndex = 91; @@ -425,16 +456,6 @@ private void InitializeComponent() this.L_BST.Text = "BST:"; this.L_BST.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // TB_RawColor - // - this.TB_RawColor.Location = new System.Drawing.Point(382, 211); - this.TB_RawColor.Name = "TB_RawColor"; - this.TB_RawColor.ReadOnly = true; - this.TB_RawColor.Size = new System.Drawing.Size(30, 20); - this.TB_RawColor.TabIndex = 88; - this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.TB_RawColor.Visible = false; - // // TB_CatchRate // this.TB_CatchRate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -448,17 +469,17 @@ private void InitializeComponent() // // TB_Stage // - this.TB_Stage.Location = new System.Drawing.Point(382, 238); + this.TB_Stage.Location = new System.Drawing.Point(384, 238); this.TB_Stage.Name = "TB_Stage"; this.TB_Stage.ReadOnly = true; - this.TB_Stage.Size = new System.Drawing.Size(30, 20); + this.TB_Stage.Size = new System.Drawing.Size(32, 20); this.TB_Stage.TabIndex = 86; this.TB_Stage.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_Stage // this.L_Stage.AutoSize = true; - this.L_Stage.Location = new System.Drawing.Point(296, 241); + this.L_Stage.Location = new System.Drawing.Point(299, 240); this.L_Stage.Name = "L_Stage"; this.L_Stage.Size = new System.Drawing.Size(85, 13); this.L_Stage.TabIndex = 85; @@ -467,17 +488,17 @@ private void InitializeComponent() // // TB_FormeCount // - this.TB_FormeCount.Location = new System.Drawing.Point(382, 278); + this.TB_FormeCount.Location = new System.Drawing.Point(384, 280); this.TB_FormeCount.Name = "TB_FormeCount"; this.TB_FormeCount.ReadOnly = true; - this.TB_FormeCount.Size = new System.Drawing.Size(30, 20); + this.TB_FormeCount.Size = new System.Drawing.Size(32, 20); this.TB_FormeCount.TabIndex = 82; this.TB_FormeCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_FormesCount // this.L_FormesCount.AutoSize = true; - this.L_FormesCount.Location = new System.Drawing.Point(306, 282); + this.L_FormesCount.Location = new System.Drawing.Point(309, 283); this.L_FormesCount.Name = "L_FormesCount"; this.L_FormesCount.Size = new System.Drawing.Size(75, 13); this.L_FormesCount.TabIndex = 81; @@ -486,17 +507,17 @@ private void InitializeComponent() // // TB_FormeSprite // - this.TB_FormeSprite.Location = new System.Drawing.Point(382, 258); + this.TB_FormeSprite.Location = new System.Drawing.Point(384, 259); this.TB_FormeSprite.Name = "TB_FormeSprite"; this.TB_FormeSprite.ReadOnly = true; - this.TB_FormeSprite.Size = new System.Drawing.Size(30, 20); + this.TB_FormeSprite.Size = new System.Drawing.Size(32, 20); this.TB_FormeSprite.TabIndex = 80; this.TB_FormeSprite.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // L_FormeSprite // this.L_FormeSprite.AutoSize = true; - this.L_FormeSprite.Location = new System.Drawing.Point(312, 262); + this.L_FormeSprite.Location = new System.Drawing.Point(315, 262); this.L_FormeSprite.Name = "L_FormeSprite"; this.L_FormeSprite.Size = new System.Drawing.Size(69, 13); this.L_FormeSprite.TabIndex = 79; @@ -517,9 +538,9 @@ private void InitializeComponent() this.CB_Color.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Color.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Color.FormattingEnabled = true; - this.CB_Color.Location = new System.Drawing.Point(295, 211); + this.CB_Color.Location = new System.Drawing.Point(295, 209); this.CB_Color.Name = "CB_Color"; - this.CB_Color.Size = new System.Drawing.Size(86, 21); + this.CB_Color.Size = new System.Drawing.Size(121, 21); this.CB_Color.TabIndex = 76; // // CB_EXPGroup @@ -535,7 +556,7 @@ private void InitializeComponent() // L_Color // this.L_Color.AutoSize = true; - this.L_Color.Location = new System.Drawing.Point(260, 214); + this.L_Color.Location = new System.Drawing.Point(261, 211); this.L_Color.Name = "L_Color"; this.L_Color.Size = new System.Drawing.Size(34, 13); this.L_Color.TabIndex = 74; @@ -544,7 +565,7 @@ private void InitializeComponent() // L_EXPGrowth // this.L_EXPGrowth.AutoSize = true; - this.L_EXPGrowth.Location = new System.Drawing.Point(16, 214); + this.L_EXPGrowth.Location = new System.Drawing.Point(16, 213); this.L_EXPGrowth.Name = "L_EXPGrowth"; this.L_EXPGrowth.Size = new System.Drawing.Size(63, 13); this.L_EXPGrowth.TabIndex = 73; @@ -555,7 +576,7 @@ private void InitializeComponent() this.CB_Ability3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Ability3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Ability3.FormattingEnabled = true; - this.CB_Ability3.Location = new System.Drawing.Point(276, 131); + this.CB_Ability3.Location = new System.Drawing.Point(272, 123); this.CB_Ability3.Name = "CB_Ability3"; this.CB_Ability3.Size = new System.Drawing.Size(140, 21); this.CB_Ability3.TabIndex = 68; @@ -565,7 +586,7 @@ private void InitializeComponent() this.CB_Ability2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Ability2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Ability2.FormattingEnabled = true; - this.CB_Ability2.Location = new System.Drawing.Point(276, 105); + this.CB_Ability2.Location = new System.Drawing.Point(272, 101); this.CB_Ability2.Name = "CB_Ability2"; this.CB_Ability2.Size = new System.Drawing.Size(140, 21); this.CB_Ability2.TabIndex = 67; @@ -575,7 +596,7 @@ private void InitializeComponent() this.CB_Ability1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Ability1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Ability1.FormattingEnabled = true; - this.CB_Ability1.Location = new System.Drawing.Point(276, 79); + this.CB_Ability1.Location = new System.Drawing.Point(272, 79); this.CB_Ability1.Name = "CB_Ability1"; this.CB_Ability1.Size = new System.Drawing.Size(140, 21); this.CB_Ability1.TabIndex = 66; @@ -585,7 +606,7 @@ private void InitializeComponent() this.CB_EggGroup2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_EggGroup2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_EggGroup2.FormattingEnabled = true; - this.CB_EggGroup2.Location = new System.Drawing.Point(295, 184); + this.CB_EggGroup2.Location = new System.Drawing.Point(295, 180); this.CB_EggGroup2.Name = "CB_EggGroup2"; this.CB_EggGroup2.Size = new System.Drawing.Size(121, 21); this.CB_EggGroup2.TabIndex = 65; @@ -612,7 +633,7 @@ private void InitializeComponent() // L_Ability // this.L_Ability.AutoSize = true; - this.L_Ability.Location = new System.Drawing.Point(230, 83); + this.L_Ability.Location = new System.Drawing.Point(226, 83); this.L_Ability.Name = "L_Ability"; this.L_Ability.Size = new System.Drawing.Size(45, 13); this.L_Ability.TabIndex = 62; @@ -621,7 +642,7 @@ private void InitializeComponent() // TB_BaseExp // this.TB_BaseExp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_BaseExp.Location = new System.Drawing.Point(77, 298); + this.TB_BaseExp.Location = new System.Drawing.Point(77, 302); this.TB_BaseExp.Mask = "000"; this.TB_BaseExp.Name = "TB_BaseExp"; this.TB_BaseExp.Size = new System.Drawing.Size(31, 20); @@ -632,7 +653,7 @@ private void InitializeComponent() // L_BaseEXP // this.L_BaseEXP.AutoSize = true; - this.L_BaseEXP.Location = new System.Drawing.Point(18, 302); + this.L_BaseEXP.Location = new System.Drawing.Point(18, 306); this.L_BaseEXP.Name = "L_BaseEXP"; this.L_BaseEXP.Size = new System.Drawing.Size(58, 13); this.L_BaseEXP.TabIndex = 60; @@ -642,7 +663,7 @@ private void InitializeComponent() // TB_HatchCycles // this.TB_HatchCycles.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_HatchCycles.Location = new System.Drawing.Point(77, 318); + this.TB_HatchCycles.Location = new System.Drawing.Point(77, 323); this.TB_HatchCycles.Mask = "000"; this.TB_HatchCycles.Name = "TB_HatchCycles"; this.TB_HatchCycles.Size = new System.Drawing.Size(31, 20); @@ -653,7 +674,7 @@ private void InitializeComponent() // L_HatchCycles // this.L_HatchCycles.AutoSize = true; - this.L_HatchCycles.Location = new System.Drawing.Point(3, 321); + this.L_HatchCycles.Location = new System.Drawing.Point(3, 326); this.L_HatchCycles.Name = "L_HatchCycles"; this.L_HatchCycles.Size = new System.Drawing.Size(73, 13); this.L_HatchCycles.TabIndex = 57; @@ -663,7 +684,7 @@ private void InitializeComponent() // TB_Friendship // this.TB_Friendship.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Friendship.Location = new System.Drawing.Point(77, 258); + this.TB_Friendship.Location = new System.Drawing.Point(77, 260); this.TB_Friendship.Mask = "000"; this.TB_Friendship.Name = "TB_Friendship"; this.TB_Friendship.Size = new System.Drawing.Size(31, 20); @@ -674,7 +695,7 @@ private void InitializeComponent() // TB_Gender // this.TB_Gender.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.TB_Gender.Location = new System.Drawing.Point(77, 238); + this.TB_Gender.Location = new System.Drawing.Point(77, 239); this.TB_Gender.Mask = "000"; this.TB_Gender.Name = "TB_Gender"; this.TB_Gender.Size = new System.Drawing.Size(31, 20); @@ -685,7 +706,7 @@ private void InitializeComponent() // L_Friendship // this.L_Friendship.AutoSize = true; - this.L_Friendship.Location = new System.Drawing.Point(18, 262); + this.L_Friendship.Location = new System.Drawing.Point(18, 264); this.L_Friendship.Name = "L_Friendship"; this.L_Friendship.Size = new System.Drawing.Size(58, 13); this.L_Friendship.TabIndex = 54; @@ -695,7 +716,7 @@ private void InitializeComponent() // L_Gender // this.L_Gender.AutoSize = true; - this.L_Gender.Location = new System.Drawing.Point(31, 241); + this.L_Gender.Location = new System.Drawing.Point(31, 242); this.L_Gender.Name = "L_Gender"; this.L_Gender.Size = new System.Drawing.Size(45, 13); this.L_Gender.TabIndex = 53; @@ -705,7 +726,7 @@ private void InitializeComponent() // L_Item1 // this.L_Item1.AutoSize = true; - this.L_Item1.Location = new System.Drawing.Point(195, 134); + this.L_Item1.Location = new System.Drawing.Point(195, 126); this.L_Item1.Name = "L_Item1"; this.L_Item1.Size = new System.Drawing.Size(21, 13); this.L_Item1.TabIndex = 52; @@ -714,7 +735,7 @@ private void InitializeComponent() // L_Item5 // this.L_Item5.AutoSize = true; - this.L_Item5.Location = new System.Drawing.Point(195, 107); + this.L_Item5.Location = new System.Drawing.Point(195, 104); this.L_Item5.Name = "L_Item5"; this.L_Item5.Size = new System.Drawing.Size(21, 13); this.L_Item5.TabIndex = 51; @@ -734,7 +755,7 @@ private void InitializeComponent() this.CB_HeldItem3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_HeldItem3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_HeldItem3.FormattingEnabled = true; - this.CB_HeldItem3.Location = new System.Drawing.Point(52, 131); + this.CB_HeldItem3.Location = new System.Drawing.Point(52, 123); this.CB_HeldItem3.Name = "CB_HeldItem3"; this.CB_HeldItem3.Size = new System.Drawing.Size(140, 21); this.CB_HeldItem3.TabIndex = 49; @@ -744,7 +765,7 @@ private void InitializeComponent() this.CB_HeldItem2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_HeldItem2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_HeldItem2.FormattingEnabled = true; - this.CB_HeldItem2.Location = new System.Drawing.Point(52, 105); + this.CB_HeldItem2.Location = new System.Drawing.Point(52, 101); this.CB_HeldItem2.Name = "CB_HeldItem2"; this.CB_HeldItem2.Size = new System.Drawing.Size(140, 21); this.CB_HeldItem2.TabIndex = 48; @@ -773,7 +794,7 @@ private void InitializeComponent() this.CB_Type2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Type2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Type2.FormattingEnabled = true; - this.CB_Type2.Location = new System.Drawing.Point(63, 184); + this.CB_Type2.Location = new System.Drawing.Point(63, 180); this.CB_Type2.Name = "CB_Type2"; this.CB_Type2.Size = new System.Drawing.Size(129, 21); this.CB_Type2.TabIndex = 45; @@ -1001,32 +1022,32 @@ private void InitializeComponent() this.L_BaseStats.TabIndex = 1; this.L_BaseStats.Text = "Base Stats:"; // - // label1 + // L_ZMove // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(134, 323); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(44, 13); - this.label1.TabIndex = 99; - this.label1.Text = "Z Move"; + this.L_ZMove.AutoSize = true; + this.L_ZMove.Location = new System.Drawing.Point(130, 324); + this.L_ZMove.Name = "L_ZMove"; + this.L_ZMove.Size = new System.Drawing.Size(47, 13); + this.L_ZMove.TabIndex = 99; + this.L_ZMove.Text = "Z-Move:"; // // L_BaseMove // this.L_BaseMove.AutoSize = true; - this.L_BaseMove.Location = new System.Drawing.Point(116, 302); + this.L_BaseMove.Location = new System.Drawing.Point(113, 303); this.L_BaseMove.Name = "L_BaseMove"; - this.L_BaseMove.Size = new System.Drawing.Size(61, 13); + this.L_BaseMove.Size = new System.Drawing.Size(64, 13); this.L_BaseMove.TabIndex = 97; - this.L_BaseMove.Text = "Base Move"; + this.L_BaseMove.Text = "Base Move:"; // - // L_ZItem + // L_ZCrystal // - this.L_ZItem.AutoSize = true; - this.L_ZItem.Location = new System.Drawing.Point(140, 281); - this.L_ZItem.Name = "L_ZItem"; - this.L_ZItem.Size = new System.Drawing.Size(37, 13); - this.L_ZItem.TabIndex = 96; - this.L_ZItem.Text = "Z Item"; + this.L_ZCrystal.AutoSize = true; + this.L_ZCrystal.Location = new System.Drawing.Point(126, 281); + this.L_ZCrystal.Name = "L_ZCrystal"; + this.L_ZCrystal.Size = new System.Drawing.Size(51, 13); + this.L_ZCrystal.TabIndex = 96; + this.L_ZCrystal.Text = "Z-Crystal:"; // // TP_MoveTutors // @@ -1049,9 +1070,9 @@ private void InitializeComponent() this.L_BeachTutors.AutoSize = true; this.L_BeachTutors.Location = new System.Drawing.Point(298, 3); this.L_BeachTutors.Name = "L_BeachTutors"; - this.L_BeachTutors.Size = new System.Drawing.Size(40, 13); + this.L_BeachTutors.Size = new System.Drawing.Size(74, 13); this.L_BeachTutors.TabIndex = 9; - this.L_BeachTutors.Text = "Tutors:"; + this.L_BeachTutors.Text = "Beach Tutors:"; this.L_BeachTutors.Visible = false; // // CLB_BeachTutors @@ -1080,9 +1101,9 @@ private void InitializeComponent() this.L_TM.AutoSize = true; this.L_TM.Location = new System.Drawing.Point(6, 3); this.L_TM.Name = "L_TM"; - this.L_TM.Size = new System.Drawing.Size(26, 13); + this.L_TM.Size = new System.Drawing.Size(31, 13); this.L_TM.TabIndex = 5; - this.L_TM.Text = "TM:"; + this.L_TM.Text = "TMs:"; // // CLB_MoveTutors // @@ -1124,9 +1145,9 @@ private void InitializeComponent() this.GB_Modifier.Controls.Add(this.L_CatchRateMod); this.GB_Modifier.Controls.Add(this.NUD_CatchRateMod); this.GB_Modifier.Controls.Add(this.CHK_CallRate); - this.GB_Modifier.Controls.Add(this.L_CallRateVal); this.GB_Modifier.Controls.Add(this.NUD_CallRate); this.GB_Modifier.Controls.Add(this.CHK_EXP); + this.GB_Modifier.Controls.Add(this.L_CallRateVal); this.GB_Modifier.Controls.Add(this.CHK_Growth); this.GB_Modifier.Controls.Add(this.CHK_QuickHatch); this.GB_Modifier.Controls.Add(this.L_FinalXP); @@ -1139,10 +1160,20 @@ private void InitializeComponent() this.GB_Modifier.TabStop = false; this.GB_Modifier.Text = "Modifier Options"; // + // CHK_NoTutor + // + this.CHK_NoTutor.AutoSize = true; + this.CHK_NoTutor.Location = new System.Drawing.Point(6, 95); + this.CHK_NoTutor.Name = "CHK_NoTutor"; + this.CHK_NoTutor.Size = new System.Drawing.Size(176, 30); + this.CHK_NoTutor.TabIndex = 21; + this.CHK_NoTutor.Text = "Remove All TM/Move Tutor\nCompatibility (Metronome Mode)"; + this.CHK_NoTutor.UseVisualStyleBackColor = true; + // // CHK_CatchRateMod // this.CHK_CatchRateMod.AutoSize = true; - this.CHK_CatchRateMod.Location = new System.Drawing.Point(204, 81); + this.CHK_CatchRateMod.Location = new System.Drawing.Point(204, 38); this.CHK_CatchRateMod.Name = "CHK_CatchRateMod"; this.CHK_CatchRateMod.Size = new System.Drawing.Size(114, 17); this.CHK_CatchRateMod.TabIndex = 16; @@ -1152,7 +1183,7 @@ private void InitializeComponent() // L_CatchRateMod // this.L_CatchRateMod.AutoSize = true; - this.L_CatchRateMod.Location = new System.Drawing.Point(204, 101); + this.L_CatchRateMod.Location = new System.Drawing.Point(230, 58); this.L_CatchRateMod.Name = "L_CatchRateMod"; this.L_CatchRateMod.Size = new System.Drawing.Size(34, 13); this.L_CatchRateMod.TabIndex = 15; @@ -1160,7 +1191,7 @@ private void InitializeComponent() // // NUD_CatchRateMod // - this.NUD_CatchRateMod.Location = new System.Drawing.Point(267, 99); + this.NUD_CatchRateMod.Location = new System.Drawing.Point(267, 56); this.NUD_CatchRateMod.Maximum = new decimal(new int[] { 255, 0, @@ -1183,25 +1214,16 @@ private void InitializeComponent() // CHK_CallRate // this.CHK_CallRate.AutoSize = true; - this.CHK_CallRate.Location = new System.Drawing.Point(204, 38); + this.CHK_CallRate.Location = new System.Drawing.Point(204, 80); this.CHK_CallRate.Name = "CHK_CallRate"; this.CHK_CallRate.Size = new System.Drawing.Size(128, 17); this.CHK_CallRate.TabIndex = 13; this.CHK_CallRate.Text = "Modify SOS Call Rate"; this.CHK_CallRate.UseVisualStyleBackColor = true; // - // L_CallRateVal - // - this.L_CallRateVal.AutoSize = true; - this.L_CallRateVal.Location = new System.Drawing.Point(204, 58); - this.L_CallRateVal.Name = "L_CallRateVal"; - this.L_CallRateVal.Size = new System.Drawing.Size(34, 13); - this.L_CallRateVal.TabIndex = 12; - this.L_CallRateVal.Text = "Value"; - // // NUD_CallRate // - this.NUD_CallRate.Location = new System.Drawing.Point(267, 56); + this.NUD_CallRate.Location = new System.Drawing.Point(267, 98); this.NUD_CallRate.Maximum = new decimal(new int[] { 255, 0, @@ -1226,6 +1248,15 @@ private void InitializeComponent() this.CHK_EXP.Text = "Modify EXP Yield"; this.CHK_EXP.UseVisualStyleBackColor = true; // + // L_CallRateVal + // + this.L_CallRateVal.AutoSize = true; + this.L_CallRateVal.Location = new System.Drawing.Point(230, 100); + this.L_CallRateVal.Name = "L_CallRateVal"; + this.L_CallRateVal.Size = new System.Drawing.Size(34, 13); + this.L_CallRateVal.TabIndex = 12; + this.L_CallRateVal.Text = "Value"; + // // CHK_Growth // this.CHK_Growth.AutoSize = true; @@ -1251,7 +1282,7 @@ private void InitializeComponent() // L_FinalXP // this.L_FinalXP.AutoSize = true; - this.L_FinalXP.Location = new System.Drawing.Point(6, 71); + this.L_FinalXP.Location = new System.Drawing.Point(6, 74); this.L_FinalXP.Name = "L_FinalXP"; this.L_FinalXP.Size = new System.Drawing.Size(63, 13); this.L_FinalXP.TabIndex = 6; @@ -1259,7 +1290,7 @@ private void InitializeComponent() // // NUD_EXP // - this.NUD_EXP.Location = new System.Drawing.Point(69, 69); + this.NUD_EXP.Location = new System.Drawing.Point(69, 72); this.NUD_EXP.Maximum = new decimal(new int[] { 300, 0, @@ -1312,7 +1343,6 @@ private void InitializeComponent() this.GB_Randomizer.Controls.Add(this.CHK_rATK); this.GB_Randomizer.Controls.Add(this.NUD_TypePercent); this.GB_Randomizer.Controls.Add(this.CHK_rHP); - this.GB_Randomizer.Controls.Add(this.CHK_HM); this.GB_Randomizer.Controls.Add(this.L_StatDev); this.GB_Randomizer.Controls.Add(this.CHK_TM); this.GB_Randomizer.Controls.Add(this.NUD_StatDev); @@ -1322,7 +1352,7 @@ private void InitializeComponent() this.GB_Randomizer.Controls.Add(this.CHK_Item); this.GB_Randomizer.Location = new System.Drawing.Point(4, 12); this.GB_Randomizer.Name = "GB_Randomizer"; - this.GB_Randomizer.Size = new System.Drawing.Size(345, 129); + this.GB_Randomizer.Size = new System.Drawing.Size(345, 133); this.GB_Randomizer.TabIndex = 418; this.GB_Randomizer.TabStop = false; this.GB_Randomizer.Text = "Randomizer Options"; @@ -1342,15 +1372,15 @@ private void InitializeComponent() // L_Same // this.L_Same.AutoSize = true; - this.L_Same.Location = new System.Drawing.Point(216, 97); + this.L_Same.Location = new System.Drawing.Point(213, 99); this.L_Same.Name = "L_Same"; - this.L_Same.Size = new System.Drawing.Size(48, 13); + this.L_Same.Size = new System.Drawing.Size(51, 13); this.L_Same.TabIndex = 23; - this.L_Same.Text = "Same(%)"; + this.L_Same.Text = "Same (%)"; // // NUD_Egg // - this.NUD_Egg.Location = new System.Drawing.Point(267, 95); + this.NUD_Egg.Location = new System.Drawing.Point(267, 97); this.NUD_Egg.Name = "NUD_Egg"; this.NUD_Egg.Size = new System.Drawing.Size(46, 20); this.NUD_Egg.TabIndex = 22; @@ -1458,11 +1488,11 @@ private void InitializeComponent() // L_SingleType // this.L_SingleType.AutoSize = true; - this.L_SingleType.Location = new System.Drawing.Point(115, 78); + this.L_SingleType.Location = new System.Drawing.Point(115, 79); this.L_SingleType.Name = "L_SingleType"; - this.L_SingleType.Size = new System.Drawing.Size(77, 13); + this.L_SingleType.Size = new System.Drawing.Size(80, 13); this.L_SingleType.TabIndex = 21; - this.L_SingleType.Text = "Single Type(%)"; + this.L_SingleType.Text = "Single Type (%)"; // // CHK_rDEF // @@ -1490,7 +1520,7 @@ private void InitializeComponent() // // NUD_TypePercent // - this.NUD_TypePercent.Location = new System.Drawing.Point(134, 94); + this.NUD_TypePercent.Location = new System.Drawing.Point(134, 95); this.NUD_TypePercent.Name = "NUD_TypePercent"; this.NUD_TypePercent.Size = new System.Drawing.Size(46, 20); this.NUD_TypePercent.TabIndex = 20; @@ -1512,26 +1542,14 @@ private void InitializeComponent() this.CHK_rHP.Text = "HP"; this.CHK_rHP.UseVisualStyleBackColor = true; // - // CHK_HM - // - this.CHK_HM.AutoSize = true; - this.CHK_HM.Checked = true; - this.CHK_HM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_HM.Location = new System.Drawing.Point(267, 15); - this.CHK_HM.Name = "CHK_HM"; - this.CHK_HM.Size = new System.Drawing.Size(43, 17); - this.CHK_HM.TabIndex = 7; - this.CHK_HM.Text = "HM"; - this.CHK_HM.UseVisualStyleBackColor = true; - // // L_StatDev // this.L_StatDev.AutoSize = true; - this.L_StatDev.Location = new System.Drawing.Point(6, 90); + this.L_StatDev.Location = new System.Drawing.Point(6, 92); this.L_StatDev.Name = "L_StatDev"; - this.L_StatDev.Size = new System.Drawing.Size(67, 13); + this.L_StatDev.Size = new System.Drawing.Size(70, 13); this.L_StatDev.TabIndex = 4; - this.L_StatDev.Text = "Deviance(%)"; + this.L_StatDev.Text = "Deviance (%)"; // // CHK_TM // @@ -1540,14 +1558,14 @@ private void InitializeComponent() this.CHK_TM.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_TM.Location = new System.Drawing.Point(219, 15); this.CHK_TM.Name = "CHK_TM"; - this.CHK_TM.Size = new System.Drawing.Size(42, 17); + this.CHK_TM.Size = new System.Drawing.Size(103, 17); this.CHK_TM.TabIndex = 0; - this.CHK_TM.Text = "TM"; + this.CHK_TM.Text = "TM Compatibility"; this.CHK_TM.UseVisualStyleBackColor = true; // // NUD_StatDev // - this.NUD_StatDev.Location = new System.Drawing.Point(27, 106); + this.NUD_StatDev.Location = new System.Drawing.Point(27, 108); this.NUD_StatDev.Name = "NUD_StatDev"; this.NUD_StatDev.Size = new System.Drawing.Size(46, 20); this.NUD_StatDev.TabIndex = 3; @@ -1618,7 +1636,7 @@ private void InitializeComponent() // // PB_MonSprite // - this.PB_MonSprite.Location = new System.Drawing.Point(285, 0); + this.PB_MonSprite.Location = new System.Drawing.Point(285, 1); this.PB_MonSprite.Name = "PB_MonSprite"; this.PB_MonSprite.Size = new System.Drawing.Size(80, 60); this.PB_MonSprite.TabIndex = 89; @@ -1626,7 +1644,7 @@ private void InitializeComponent() // // B_Dump // - this.B_Dump.Location = new System.Drawing.Point(368, 10); + this.B_Dump.Location = new System.Drawing.Point(368, 19); this.B_Dump.Name = "B_Dump"; this.B_Dump.Size = new System.Drawing.Size(82, 23); this.B_Dump.TabIndex = 418; @@ -1634,15 +1652,15 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // CHK_NoTutor + // TB_RawColor // - this.CHK_NoTutor.AutoSize = true; - this.CHK_NoTutor.Location = new System.Drawing.Point(6, 95); - this.CHK_NoTutor.Name = "CHK_NoTutor"; - this.CHK_NoTutor.Size = new System.Drawing.Size(190, 17); - this.CHK_NoTutor.TabIndex = 21; - this.CHK_NoTutor.Text = "Remove All TM/Tutor Compatibility"; - this.CHK_NoTutor.UseVisualStyleBackColor = true; + this.TB_RawColor.Location = new System.Drawing.Point(229, 209); + this.TB_RawColor.Name = "TB_RawColor"; + this.TB_RawColor.ReadOnly = true; + this.TB_RawColor.Size = new System.Drawing.Size(30, 20); + this.TB_RawColor.TabIndex = 420; + this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_RawColor.Visible = false; // // PersonalEditor7 // @@ -1747,7 +1765,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox TB_Stage; private System.Windows.Forms.Label L_Stage; private System.Windows.Forms.MaskedTextBox TB_CatchRate; - private System.Windows.Forms.TextBox TB_RawColor; private System.Windows.Forms.Label L_BST; private System.Windows.Forms.TextBox TB_BST; private System.Windows.Forms.CheckedListBox CLB_TM; @@ -1764,7 +1781,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_StatDev; private System.Windows.Forms.CheckBox CHK_Item; private System.Windows.Forms.CheckBox CHK_Type; - private System.Windows.Forms.CheckBox CHK_HM; private System.Windows.Forms.CheckBox CHK_Tutors; private System.Windows.Forms.CheckBox CHK_WGuard; private System.Windows.Forms.CheckBox CHK_CatchRate; @@ -1807,13 +1823,17 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_ZMove; private System.Windows.Forms.ComboBox CB_ZBaseMove; private System.Windows.Forms.ComboBox CB_ZItem; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label L_ZMove; private System.Windows.Forms.Label L_BaseMove; - private System.Windows.Forms.Label L_ZItem; + private System.Windows.Forms.Label L_ZCrystal; private System.Windows.Forms.Label L_BeachTutors; private System.Windows.Forms.CheckedListBox CLB_BeachTutors; private System.Windows.Forms.CheckBox CHK_BeachTutors; private System.Windows.Forms.CheckBox CHK_Shuffle; private System.Windows.Forms.CheckBox CHK_NoTutor; + private System.Windows.Forms.Label L_HiddenAbility; + private System.Windows.Forms.Label L_Ability2; + private System.Windows.Forms.Label L_Ability1; + private System.Windows.Forms.TextBox TB_RawColor; } } diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.cs index 54f5a08232..392e0e512b 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.cs @@ -281,7 +281,7 @@ private void savePersonal() pkm.FormeSprite = Convert.ToUInt16(TB_FormeSprite.Text); pkm.FormeCount = Convert.ToByte(TB_FormeCount.Text); - pkm.Color = (byte) (Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0)); + pkm.Color = (byte)(Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0)); pkm.BaseEXP = Convert.ToUInt16(TB_BaseExp.Text); decimal h; decimal.TryParse(TB_Height.Text, out h); @@ -321,6 +321,7 @@ private void saveEntry() private void B_Randomize_Click(object sender, EventArgs e) { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Enhancements tab.") != DialogResult.Yes) return; saveEntry(); // input settings @@ -334,7 +335,7 @@ private void B_Randomize_Click(object sender, EventArgs e) StatsToRandomize = rstat_boxes.Select(g => g.Checked).ToArray(), ModifyAbilities = CHK_Ability.Checked, ModifyLearnsetTM = CHK_TM.Checked, - ModifyLearnsetHM = CHK_HM.Checked, + ModifyLearnsetHM = false, // no HMs in Gen 7 ModifyLearnsetTypeTutors = CHK_Tutors.Checked, ModifyLearnsetMoveTutors = Main.Config.USUM && CHK_BeachTutors.Checked, ModifyTypes = CHK_Type.Checked, @@ -348,10 +349,12 @@ private void B_Randomize_Click(object sender, EventArgs e) Main.SpeciesStat.Select(z => z.Write()).ToArray().CopyTo(files, 0); readEntry(); - WinFormsUtil.Alert("All relevant Pokémon Personal Entries have been randomized!"); + WinFormsUtil.Alert("Randomized all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } private void B_ModifyAll(object sender, EventArgs e) { + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all? Cannot undo.", "Double check Modification settings in the Enhancements tab.") != DialogResult.Yes) return; + for (int i = 1; i < CB_Species.Items.Count; i++) { CB_Species.SelectedIndex = i; // Get new Species @@ -378,11 +381,11 @@ private void B_ModifyAll(object sender, EventArgs e) TB_HatchCycles.Text = 1.ToString(); if (CHK_CallRate.Checked) TB_CallRate.Text = ((int)NUD_CallRate.Value).ToString(); - if(CHK_CatchRateMod.Checked) + if (CHK_CatchRateMod.Checked) TB_CatchRate.Text = ((int)NUD_CatchRateMod.Value).ToString(); } CB_Species.SelectedIndex = 1; - WinFormsUtil.Alert("All species modified according to specification!"); + WinFormsUtil.Alert("Modified all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } private bool dumping; private void B_Dump_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 78fce0861d..28c74d141c 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -736,7 +736,7 @@ private void B_Randomize_Click(object sender, EventArgs e) } // high-power attacks - if (CHK_ForceHighPower.Checked && pk.Level >= NUD_ForceHighPower.Value && CB_Moves.SelectedIndex != 3) + if (CHK_ForceHighPower.Checked && pk.Level >= NUD_ForceHighPower.Value) pk.Moves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); // sanitize moves @@ -779,7 +779,12 @@ private void SetMoves(IList moves) // Randomization UI private void CB_Moves_SelectedIndexChanged(object sender, EventArgs e) { - CHK_Damage.Visible = CHK_STAB.Visible = NUD_Damage.Visible = NUD_STAB.Visible = CB_Moves.SelectedIndex == 1; // Randomized + CHK_Damage.Checked = CHK_STAB.Checked = + CHK_Damage.Enabled = CHK_STAB.Enabled = + NUD_Damage.Enabled = NUD_STAB.Enabled = CB_Moves.SelectedIndex == 1; + + CHK_ForceHighPower.Enabled = CHK_ForceHighPower.Checked = NUD_ForceHighPower.Enabled = + CHK_NoFixedDamage.Enabled = CHK_NoFixedDamage.Checked = (CB_Moves.SelectedIndex == 1 || CB_Moves.SelectedIndex == 2); } private void CHK_Damage_CheckedChanged(object sender, EventArgs e) { @@ -791,14 +796,18 @@ private void CHK_STAB_CheckedChanged(object sender, EventArgs e) } private void CHK_RandomPKM_CheckedChanged(object sender, EventArgs e) { - CHK_BST.Visible = CHK_RandomPKM.Checked; - if (CHK_RandomPKM.Checked) - return; - foreach (CheckBox c in new[] { CHK_G1, CHK_G2, CHK_G3, CHK_G4, CHK_G5, CHK_G6, CHK_G7, CHK_L, CHK_E }) - { - c.Visible = false; - c.Checked = true; - } + if (!CHK_RandomPKM.Checked) + foreach (CheckBox c in new[] { CHK_G1, CHK_G2, CHK_G3, CHK_G4, CHK_G5, CHK_G6, CHK_G7, CHK_L, CHK_E, CHK_BST }) + { + c.Enabled = false; + c.Checked = false; + } + else + foreach (CheckBox c in new[] { CHK_G1, CHK_G2, CHK_G3, CHK_G4, CHK_G5, CHK_G6, CHK_G7, CHK_L, CHK_E, CHK_BST }) + { + c.Enabled = true; + c.Checked = true; + } } private void CHK_RandomClass_CheckedChanged(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 60cfa51d88..895dc936f7 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -465,7 +465,7 @@ private void B_Starters_Click(object sender, EventArgs e) var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var items = Randomizer.getRandomItemList(); - int[] banned = Legal.Z_Moves.Concat(new int[] {165, 464, 621}).ToArray(); + int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 464, 621 }).ToArray(); // Assign Species for (int i = 0; i < 3; i++) @@ -496,8 +496,9 @@ private void B_Starters_Click(object sender, EventArgs e) if (CHK_SpecialMove.Checked && !CHK_Metronome.Checked) { - int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); - if (banned.Contains(rv)) continue; // disallow banned moves + int rv; + do { rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); } + while (banned.Contains(rv)) ; t.SpecialMove = rv; } @@ -526,7 +527,7 @@ private void B_RandAll_Click(object sender, EventArgs e) var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); - int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 621 }).ToArray(); + int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 464, 621 }).ToArray(); int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); @@ -560,8 +561,9 @@ private void B_RandAll_Click(object sender, EventArgs e) t.SpecialMove = 0; // remove Surf Pikachu's special move else { - int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); - if (banned.Contains(rv)) continue; // disallow banned moves + int rv; + do { rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); } + while (banned.Contains(rv)); t.SpecialMove = rv; } } From 95c81e467471887989562533a993ae3e669fad3c Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 11 Apr 2018 17:27:19 -0700 Subject: [PATCH 097/191] Change healing to enum --- pk3DS.Core/Structures/Gen6/Move6.cs | 33 +++++++---------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/pk3DS.Core/Structures/Gen6/Move6.cs b/pk3DS.Core/Structures/Gen6/Move6.cs index 2739463332..e4127c1458 100644 --- a/pk3DS.Core/Structures/Gen6/Move6.cs +++ b/pk3DS.Core/Structures/Gen6/Move6.cs @@ -34,7 +34,7 @@ public Move(byte[] data) Flinch = data[0xF]; Effect = BitConverter.ToUInt16(data, 0x10); Recoil = data[0x12]; - Healing = new Heal(data[0x13]); + Healing = (Heal)data[0x13]; Targeting = data[0x14]; Stat1 = data[0x15]; Stat2 = data[0x16]; @@ -72,7 +72,7 @@ public byte[] Write() bw.Write(Flinch); bw.Write(Effect); bw.Write(Recoil); - bw.Write(Healing.Write()); + bw.Write((byte)Healing); bw.Write(Targeting); bw.Write(Stat1); bw.Write(Stat2); @@ -90,30 +90,13 @@ public byte[] Write() return ms.ToArray(); } } - public class Heal + public enum Heal : byte { - public byte Val; - public bool Full, Half, Quarter, Value; - public Heal(byte val) - { - Val = val; - Full = Val == 0xFF; - Half = Val == 0xFE; - Quarter = Val == 0xFD; - Value = Val < 0xFD; - } - public byte Write() - { - if (Value) - return Val; - if (Full) - return 0xFF; - if (Half) - return 0xFE; - if (Quarter) - return 0xFD; - return Val; - } + None = 0, + + Full = 255, + Half = 254, + Quarter = 253, } } } From 90fd6fcb7b5ea9ab3815dcac52682945a6219f99 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 11 Apr 2018 17:28:37 -0700 Subject: [PATCH 098/191] Close streams when peeking for offset https://projectpokemon.org/home/forums/topic/34377-pk3ds-3ds-rom-editor-randomizer/?do=findComment&comment=228719 https://projectpokemon.org/home/forums/topic/34377-pk3ds-3ds-rom-editor-randomizer/?do=findComment&comment=229665 Thanks Furenzu & TaliOS! --- pk3DS/Subforms/Gen6/RSWE.cs | 39 ++++++++++++++++++++----------------- pk3DS/Subforms/Gen6/XYWE.cs | 31 ++++++++++++++--------------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSWE.cs b/pk3DS/Subforms/Gen6/RSWE.cs index 456cc4a776..e909a1e8df 100644 --- a/pk3DS/Subforms/Gen6/RSWE.cs +++ b/pk3DS/Subforms/Gen6/RSWE.cs @@ -422,23 +422,25 @@ private byte[] ConcatArrays(byte[] b1, byte[] b2) private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) { int f = CB_LocationID.SelectedIndex; - FileStream InStream = File.OpenRead(filepaths[f]); - BinaryReader br = new BinaryReader(InStream); - br.BaseStream.Seek(0x10, SeekOrigin.Begin); - int offset = br.ReadInt32() + 0xE; - int ofs2 = br.ReadInt32(); - int length = ofs2 - offset; - if (length < 0xF6) //no encounters in this map + + int offset; + using (var s = File.OpenRead(filepaths[f])) + using (var br = new BinaryReader(s)) { - ClearData(); - br.Close(); - return; + br.BaseStream.Seek(0x10, SeekOrigin.Begin); + offset = br.ReadInt32() + 0xE; + int ofs2 = br.ReadInt32(); + int length = ofs2 - offset; + if (length < 0xF6) //no encounters in this map + { + ClearData(); + return; + } } - br.Close(); byte[] filedata = File.ReadAllBytes(filepaths[f]); - byte[] encounterdata = new Byte[0xF6]; + byte[] encounterdata = new byte[0xF6]; Array.Copy(filedata, offset, encounterdata, 0, 0xF6); parse(encounterdata); } @@ -554,12 +556,13 @@ private void B_Save_Click(object sender, EventArgs e) } else { - FileStream InStream = File.OpenRead(filepaths[f]); - BinaryReader br = new BinaryReader(InStream); - br.BaseStream.Seek(0x10, SeekOrigin.Begin); - int offset = br.ReadInt32() + 0xe; - // int length = (int)br.BaseStream.Length - offset; - br.Close(); + int offset; + using (var s = File.OpenRead(filepaths[f])) + using (var br = new BinaryReader(s)) + { + br.BaseStream.Seek(0x10, SeekOrigin.Begin); + offset = br.ReadInt32() + 0xE; + } byte[] filedata = File.ReadAllBytes(filepaths[f]); byte[] preoffset; if (offset < filedata.Length) diff --git a/pk3DS/Subforms/Gen6/XYWE.cs b/pk3DS/Subforms/Gen6/XYWE.cs index d94f7f6669..a5786deb91 100644 --- a/pk3DS/Subforms/Gen6/XYWE.cs +++ b/pk3DS/Subforms/Gen6/XYWE.cs @@ -402,21 +402,24 @@ private string parseslot(byte[] slot) private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) { int f = CB_LocationID.SelectedIndex; - FileStream InStream = File.OpenRead(filepaths[f]); - BinaryReader br = new BinaryReader(InStream); - br.BaseStream.Seek(0x10, SeekOrigin.Begin); - int offset = br.ReadInt32() + 0x10; - int length = (int)br.BaseStream.Length - offset; - if (length < 0x178) //no encounters in this map + int offset; + using (var s = File.OpenRead(filepaths[f])) + using (var br = new BinaryReader(s)) { - ClearData(); - return; + + br.BaseStream.Seek(0x10, SeekOrigin.Begin); + offset = br.ReadInt32() + 0x10; + int length = (int)br.BaseStream.Length - offset; + if (length < 0x178) //no encounters in this map + { + ClearData(); + return; + } } - br.Close(); byte[] filedata = File.ReadAllBytes(filepaths[f]); - byte[] encounterdata = new Byte[0x178]; + byte[] encounterdata = new byte[0x178]; Array.Copy(filedata, offset, encounterdata, 0, 0x178); parse(encounterdata); } @@ -462,12 +465,8 @@ private void B_Save_Click(object sender, EventArgs e) { int f = CB_LocationID.SelectedIndex; string filepath = filepaths[f]; - FileStream InStream = File.OpenRead(filepaths[f]); - BinaryReader br = new BinaryReader(InStream); - br.BaseStream.Seek(0x10, SeekOrigin.Begin); - int offset = br.ReadInt32() + 0x10; - br.Close(); - byte[] filedata = File.ReadAllBytes(filepaths[f]); + byte[] filedata = File.ReadAllBytes(filepath); + int offset = BitConverter.ToInt32(filedata, 0x10) + 0x10; byte[] preoffset; if (offset < filedata.Length) { From e3fb4ce526ab00bec3fb6311462f43a899bbd0d8 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 12 Apr 2018 21:07:13 -0700 Subject: [PATCH 099/191] seal forms allowdrop call in constructor, doesn't really matter --- pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs | 2 +- pk3DS/Subforms/Gen6/Experimental/OWSE.cs | 2 +- pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs | 2 +- pk3DS/Subforms/Gen6/TitleScreenEditor6.cs | 2 +- pk3DS/Tools/Icon.Designer.cs | 2 +- pk3DS/Tools/Icon.cs | 2 +- pk3DS/Tools/ToolsUI.Designer.cs | 2 +- pk3DS/Tools/ToolsUI.cs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs index 73d030a94c..9d5a27967b 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs @@ -1,6 +1,6 @@ namespace pk3DS { - partial class OWSE + sealed partial class OWSE { /// /// Required designer variable. diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs index 68f9c8665f..b8488ea73a 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs @@ -10,7 +10,7 @@ namespace pk3DS { - public partial class OWSE : Form + public sealed partial class OWSE : Form { public OWSE() { diff --git a/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs b/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs index 4c647663e4..b53079306f 100644 --- a/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs @@ -1,6 +1,6 @@ namespace pk3DS { - partial class TitleScreenEditor6 + sealed partial class TitleScreenEditor6 { /// /// Required designer variable. diff --git a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs index 4e928a581a..63a2063472 100644 --- a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs +++ b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs @@ -9,7 +9,7 @@ namespace pk3DS { - public partial class TitleScreenEditor6 : Form + public sealed partial class TitleScreenEditor6 : Form { private readonly bool compressed = Main.Config.ORAS; public TitleScreenEditor6() diff --git a/pk3DS/Tools/Icon.Designer.cs b/pk3DS/Tools/Icon.Designer.cs index 0e93d5dcab..299f18e333 100644 --- a/pk3DS/Tools/Icon.Designer.cs +++ b/pk3DS/Tools/Icon.Designer.cs @@ -1,6 +1,6 @@ namespace pk3DS { - partial class Icon + sealed partial class Icon { /// /// Required designer variable. diff --git a/pk3DS/Tools/Icon.cs b/pk3DS/Tools/Icon.cs index 957f490c0b..5006076e1e 100644 --- a/pk3DS/Tools/Icon.cs +++ b/pk3DS/Tools/Icon.cs @@ -7,7 +7,7 @@ namespace pk3DS { - public partial class Icon : Form + public sealed partial class Icon : Form { private SMDH SMDH; public Icon() diff --git a/pk3DS/Tools/ToolsUI.Designer.cs b/pk3DS/Tools/ToolsUI.Designer.cs index 8593ed548c..70ae3428c7 100644 --- a/pk3DS/Tools/ToolsUI.Designer.cs +++ b/pk3DS/Tools/ToolsUI.Designer.cs @@ -1,6 +1,6 @@ namespace pk3DS { - partial class ToolsUI + sealed partial class ToolsUI { /// /// Required designer variable. diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index 34fba128d0..928df1de4a 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -11,7 +11,7 @@ namespace pk3DS { - public partial class ToolsUI : Form + public sealed partial class ToolsUI : Form { public ToolsUI() { From 39934095daccf9730b7b7ed98f3762f0668787fb Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 13 Apr 2018 13:10:12 -0400 Subject: [PATCH 100/191] Expose static SOS allies (#318) --- pk3DS.Core/Legality/Legal.cs | 33 +- .../Structures/Gen7/EncounterStatic7.cs | 18 + pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 126 +++---- pk3DS/Subforms/Gen6/GiftEditor6.cs | 18 +- pk3DS/Subforms/Gen6/RSTE.Designer.cs | 348 +++++++++--------- pk3DS/Subforms/Gen6/RSTE.cs | 6 +- .../Gen6/StaticEncounterEditor6.Designer.cs | 58 +-- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 18 +- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 197 ++++------ pk3DS/Subforms/Gen7/SMTE.cs | 14 +- pk3DS/Subforms/Gen7/SMTE.resx | 255 ------------- .../Gen7/StaticEncounterEditor7.Designer.cs | 334 ++++++++++------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 27 +- 13 files changed, 644 insertions(+), 808 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 8fca6859dd..fddb321720 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -299,11 +299,40 @@ public static partial class Legal }; public static readonly int[] Model_XY = { - 018, 019, 020, 021, 022, 055, 056, 057, 077, 078, 079, 080, 081, 102, 103, 104, 105, 107, 108, 173, 174, 175 + #region Models + 018, // Aliana + 019, // Bryony + 020, // Celosia + 021, // Mable + 022, // Xerosic + 055, // Shauna + 056, // Tierno + 057, // Trevor + 081, // Lysandre + 102, // AZ + 103, // Calem + 104, // Serena + 105, // Sycamore + 175, // Lysandre (Mega Ring) + #endregion }; public static readonly int[] Model_AO = { - 127, 128, 174, 178, 192, 198, 219, 221, 267, 272, 277, 278, 279 + #region Models + 127, // Brendan + 128, // May + 174, // Archie + 178, // Maxie + 192, // Wally + 198, // Steven + 219, // Steven (Multi Battle) + 221, // Zinnia (Lorekeeper) + 267, // Zinnia + 272, // Wally (Mega Pendant) + 277, // Steven (Rematch) + 278, // Brendan (Mega Bracelet) + 279, // May (Mega Bracelet) + #endregion }; public static readonly int[] Z_Moves = { diff --git a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs index 25cb686c8f..61fda8cc53 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs @@ -124,6 +124,24 @@ public int Aura set => Data[0x25] = (byte)value; } + public int Allies + { + get => Data[0x27]; + set => Data[0x27] = (byte)value; + } + + public int Ally1 + { + get => Data[0x28]; + set => Data[0x28] = (byte)value; + } + + public int Ally2 + { + get => Data[0x2C]; + set => Data[0x2C] = (byte)value; + } + public bool IV3 => (sbyte) Data[0x15] < 0 && (sbyte) Data[0x15] + 1 == -3; public string GetSummary() diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index 5c0f02cbed..d2aff7cc93 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -65,6 +65,8 @@ private void InitializeComponent() this.tabPage2 = new System.Windows.Forms.TabPage(); this.B_ModifyLevel = new System.Windows.Forms.Button(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); this.CHK_RandomAbility = new System.Windows.Forms.CheckBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.CHK_AllowMega = new System.Windows.Forms.CheckBox(); @@ -83,8 +85,6 @@ private void InitializeComponent() this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown(); this.CHK_Level = new System.Windows.Forms.CheckBox(); - this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); - this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit(); this.tabControl1.SuspendLayout(); @@ -98,8 +98,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_IV0)).BeginInit(); this.tabPage2.SuspendLayout(); this.GB_Tweak.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.SuspendLayout(); // // B_Cancel @@ -140,16 +140,16 @@ private void InitializeComponent() this.CB_Species.FormattingEnabled = true; this.CB_Species.Location = new System.Drawing.Point(65, 7); this.CB_Species.Name = "CB_Species"; - this.CB_Species.Size = new System.Drawing.Size(121, 21); + this.CB_Species.Size = new System.Drawing.Size(136, 21); this.CB_Species.TabIndex = 469; this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); // // CB_HeldItem // this.CB_HeldItem.FormattingEnabled = true; - this.CB_HeldItem.Location = new System.Drawing.Point(65, 120); + this.CB_HeldItem.Location = new System.Drawing.Point(65, 115); this.CB_HeldItem.Name = "CB_HeldItem"; - this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); + this.CB_HeldItem.Size = new System.Drawing.Size(136, 21); this.CB_HeldItem.TabIndex = 470; // // L_Species @@ -163,7 +163,7 @@ private void InitializeComponent() // // L_HeldItem // - this.L_HeldItem.Location = new System.Drawing.Point(9, 119); + this.L_HeldItem.Location = new System.Drawing.Point(9, 114); this.L_HeldItem.Name = "L_HeldItem"; this.L_HeldItem.Size = new System.Drawing.Size(55, 23); this.L_HeldItem.TabIndex = 478; @@ -172,7 +172,7 @@ private void InitializeComponent() // // NUD_Level // - this.NUD_Level.Location = new System.Drawing.Point(65, 30); + this.NUD_Level.Location = new System.Drawing.Point(65, 29); this.NUD_Level.Name = "NUD_Level"; this.NUD_Level.Size = new System.Drawing.Size(41, 20); this.NUD_Level.TabIndex = 479; @@ -184,7 +184,7 @@ private void InitializeComponent() // // L_Level // - this.L_Level.Location = new System.Drawing.Point(9, 27); + this.L_Level.Location = new System.Drawing.Point(9, 26); this.L_Level.Name = "L_Level"; this.L_Level.Size = new System.Drawing.Size(55, 23); this.L_Level.TabIndex = 480; @@ -193,14 +193,14 @@ private void InitializeComponent() // // NUD_Form // - this.NUD_Form.Location = new System.Drawing.Point(65, 52); + this.NUD_Form.Location = new System.Drawing.Point(65, 50); this.NUD_Form.Name = "NUD_Form"; this.NUD_Form.Size = new System.Drawing.Size(41, 20); this.NUD_Form.TabIndex = 481; // // L_Form // - this.L_Form.Location = new System.Drawing.Point(9, 49); + this.L_Form.Location = new System.Drawing.Point(9, 47); this.L_Form.Name = "L_Form"; this.L_Form.Size = new System.Drawing.Size(55, 23); this.L_Form.TabIndex = 482; @@ -209,7 +209,7 @@ private void InitializeComponent() // // L_Nature // - this.L_Nature.Location = new System.Drawing.Point(9, 142); + this.L_Nature.Location = new System.Drawing.Point(9, 136); this.L_Nature.Name = "L_Nature"; this.L_Nature.Size = new System.Drawing.Size(55, 23); this.L_Nature.TabIndex = 490; @@ -265,7 +265,7 @@ private void InitializeComponent() // // L_Gender // - this.L_Gender.Location = new System.Drawing.Point(9, 96); + this.L_Gender.Location = new System.Drawing.Point(9, 92); this.L_Gender.Name = "L_Gender"; this.L_Gender.Size = new System.Drawing.Size(55, 23); this.L_Gender.TabIndex = 532; @@ -275,14 +275,14 @@ private void InitializeComponent() // CB_Gender // this.CB_Gender.FormattingEnabled = true; - this.CB_Gender.Location = new System.Drawing.Point(65, 97); + this.CB_Gender.Location = new System.Drawing.Point(65, 93); this.CB_Gender.Name = "CB_Gender"; - this.CB_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Gender.TabIndex = 531; // // L_Ability // - this.L_Ability.Location = new System.Drawing.Point(9, 73); + this.L_Ability.Location = new System.Drawing.Point(9, 70); this.L_Ability.Name = "L_Ability"; this.L_Ability.Size = new System.Drawing.Size(55, 23); this.L_Ability.TabIndex = 530; @@ -292,17 +292,17 @@ private void InitializeComponent() // CB_Ability // this.CB_Ability.FormattingEnabled = true; - this.CB_Ability.Location = new System.Drawing.Point(65, 74); + this.CB_Ability.Location = new System.Drawing.Point(65, 71); this.CB_Ability.Name = "CB_Ability"; - this.CB_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Ability.TabIndex = 529; // // CB_Nature // this.CB_Nature.FormattingEnabled = true; - this.CB_Nature.Location = new System.Drawing.Point(65, 143); + this.CB_Nature.Location = new System.Drawing.Point(65, 137); this.CB_Nature.Name = "CB_Nature"; - this.CB_Nature.Size = new System.Drawing.Size(121, 21); + this.CB_Nature.Size = new System.Drawing.Size(136, 21); this.CB_Nature.TabIndex = 505; // // GB_EIVs @@ -319,7 +319,7 @@ private void InitializeComponent() this.GB_EIVs.Controls.Add(this.NUD_IV0); this.GB_EIVs.Controls.Add(this.L_ATK); this.GB_EIVs.Controls.Add(this.L_DEF); - this.GB_EIVs.Location = new System.Drawing.Point(12, 181); + this.GB_EIVs.Location = new System.Drawing.Point(12, 178); this.GB_EIVs.Name = "GB_EIVs"; this.GB_EIVs.Size = new System.Drawing.Size(148, 112); this.GB_EIVs.TabIndex = 504; @@ -515,7 +515,7 @@ private void InitializeComponent() // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 167); + this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 163); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); this.CHK_ShinyLock.TabIndex = 503; @@ -540,7 +540,7 @@ private void InitializeComponent() // // B_ModifyLevel // - this.B_ModifyLevel.Location = new System.Drawing.Point(189, 5); + this.B_ModifyLevel.Location = new System.Drawing.Point(189, 16); this.B_ModifyLevel.Name = "B_ModifyLevel"; this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); this.B_ModifyLevel.TabIndex = 514; @@ -550,11 +550,11 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.NUD_ForceFullyEvolved); this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); - this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); @@ -573,10 +573,38 @@ private void InitializeComponent() this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Randomization Tweaks"; // + // NUD_ForceFullyEvolved + // + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 141); + this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.TabIndex = 518; + this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 143); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 517; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; + // // CHK_RandomAbility // this.CHK_RandomAbility.AutoSize = true; - this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 110); + this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 109); this.CHK_RandomAbility.Name = "CHK_RandomAbility"; this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbility.TabIndex = 298; @@ -596,7 +624,7 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 126); + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 124); this.CHK_AllowMega.Name = "CHK_AllowMega"; this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); this.CHK_AllowMega.TabIndex = 296; @@ -627,7 +655,7 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(128, 64); + this.CHK_BST.Location = new System.Drawing.Point(128, 62); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 288; @@ -639,7 +667,7 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(128, 49); + this.CHK_E.Location = new System.Drawing.Point(128, 48); this.CHK_E.Name = "CHK_E"; this.CHK_E.Size = new System.Drawing.Size(98, 17); this.CHK_E.TabIndex = 287; @@ -663,7 +691,7 @@ private void InitializeComponent() this.CHK_G6.AutoSize = true; this.CHK_G6.Checked = true; this.CHK_G6.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G6.Location = new System.Drawing.Point(67, 64); + this.CHK_G6.Location = new System.Drawing.Point(67, 62); this.CHK_G6.Name = "CHK_G6"; this.CHK_G6.Size = new System.Drawing.Size(55, 17); this.CHK_G6.TabIndex = 285; @@ -675,7 +703,7 @@ private void InitializeComponent() this.CHK_G5.AutoSize = true; this.CHK_G5.Checked = true; this.CHK_G5.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G5.Location = new System.Drawing.Point(67, 49); + this.CHK_G5.Location = new System.Drawing.Point(67, 48); this.CHK_G5.Name = "CHK_G5"; this.CHK_G5.Size = new System.Drawing.Size(55, 17); this.CHK_G5.TabIndex = 284; @@ -699,7 +727,7 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(9, 64); + this.CHK_G3.Location = new System.Drawing.Point(9, 62); this.CHK_G3.Name = "CHK_G3"; this.CHK_G3.Size = new System.Drawing.Size(55, 17); this.CHK_G3.TabIndex = 282; @@ -711,7 +739,7 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(9, 49); + this.CHK_G2.Location = new System.Drawing.Point(9, 48); this.CHK_G2.Name = "CHK_G2"; this.CHK_G2.Size = new System.Drawing.Size(55, 17); this.CHK_G2.TabIndex = 281; @@ -759,7 +787,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 6); + this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 17); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -779,41 +807,13 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(9, 7); + this.CHK_Level.Location = new System.Drawing.Point(9, 18); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 302; this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // - // NUD_ForceFullyEvolved - // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 141); - this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; - this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); - this.NUD_ForceFullyEvolved.TabIndex = 518; - this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); - // - // CHK_ForceFullyEvolved - // - this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 142); - this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; - this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); - this.CHK_ForceFullyEvolved.TabIndex = 517; - this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; - this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; - // // GiftEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -847,8 +847,8 @@ private void InitializeComponent() this.tabPage2.PerformLayout(); this.GB_Tweak.ResumeLayout(false); this.GB_Tweak.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.ResumeLayout(false); } diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 1bbbbc42f2..bcfe4134b3 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -60,20 +60,14 @@ public static Dictionary GetMegaDictionary(GameConfig config) private readonly string[] natureslist = Main.Config.getText(TextName.Natures); private readonly Dictionary MegaDictionary; private static int[] FinalEvo; - + private readonly string[] ability = { - "Random (1 or 2)", + "Any (1 or 2)", "Ability 1", "Ability 2", "Hidden Ability", }; - private readonly string[] gender = - { - "Random/Genderless", - "Male", - "Female", - }; private void B_Save_Click(object sender, EventArgs e) { saveEntry(); @@ -95,9 +89,13 @@ private void loadData() GiftData[i] = new EncounterGift6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray(), Main.Config.ORAS); LB_Gifts.Items.Add($"{i:00} - {specieslist[GiftData[i].Species]}"); } - foreach (var s in ability) CB_Ability.Items.Add(s); - foreach (var s in gender) CB_Gender.Items.Add(s); + + CB_Gender.Items.Clear(); + CB_Gender.Items.Add("- / Genderless/Random"); + CB_Gender.Items.Add("♂ / Male"); + CB_Gender.Items.Add("♀ / Female"); + FinalEvo = Legal.FinalEvolutions_6; loaded = true; diff --git a/pk3DS/Subforms/Gen6/RSTE.Designer.cs b/pk3DS/Subforms/Gen6/RSTE.Designer.cs index 08517e8aaf..c35e331db5 100644 --- a/pk3DS/Subforms/Gen6/RSTE.Designer.cs +++ b/pk3DS/Subforms/Gen6/RSTE.Designer.cs @@ -303,7 +303,7 @@ private void InitializeComponent() // checkBox_Healer // this.checkBox_Healer.AutoSize = true; - this.checkBox_Healer.Location = new System.Drawing.Point(457, 49); + this.checkBox_Healer.Location = new System.Drawing.Point(452, 12); this.checkBox_Healer.Name = "checkBox_Healer"; this.checkBox_Healer.Size = new System.Drawing.Size(57, 17); this.checkBox_Healer.TabIndex = 58; @@ -313,7 +313,7 @@ private void InitializeComponent() // L_TPrize // this.L_TPrize.AutoSize = true; - this.L_TPrize.Location = new System.Drawing.Point(454, 5); + this.L_TPrize.Location = new System.Drawing.Point(443, 80); this.L_TPrize.Name = "L_TPrize"; this.L_TPrize.Size = new System.Drawing.Size(33, 13); this.L_TPrize.TabIndex = 57; @@ -324,15 +324,15 @@ private void InitializeComponent() this.CB_Prize.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Prize.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Prize.FormattingEnabled = true; - this.CB_Prize.Location = new System.Drawing.Point(457, 19); + this.CB_Prize.Location = new System.Drawing.Point(446, 94); this.CB_Prize.Name = "CB_Prize"; - this.CB_Prize.Size = new System.Drawing.Size(93, 21); + this.CB_Prize.Size = new System.Drawing.Size(102, 21); this.CB_Prize.TabIndex = 56; // // L_AI // this.L_AI.AutoSize = true; - this.L_AI.Location = new System.Drawing.Point(17, 103); + this.L_AI.Location = new System.Drawing.Point(12, 97); this.L_AI.Name = "L_AI"; this.L_AI.Size = new System.Drawing.Size(49, 13); this.L_AI.TabIndex = 55; @@ -343,7 +343,7 @@ private void InitializeComponent() this.CB_AI.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_AI.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_AI.FormattingEnabled = true; - this.CB_AI.Location = new System.Drawing.Point(66, 100); + this.CB_AI.Location = new System.Drawing.Point(61, 94); this.CB_AI.Name = "CB_AI"; this.CB_AI.Size = new System.Drawing.Size(74, 21); this.CB_AI.TabIndex = 54; @@ -351,7 +351,7 @@ private void InitializeComponent() // L_Money // this.L_Money.AutoSize = true; - this.L_Money.Location = new System.Drawing.Point(152, 103); + this.L_Money.Location = new System.Drawing.Point(147, 97); this.L_Money.Name = "L_Money"; this.L_Money.Size = new System.Drawing.Size(42, 13); this.L_Money.TabIndex = 53; @@ -362,7 +362,7 @@ private void InitializeComponent() this.CB_Money.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Money.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Money.FormattingEnabled = true; - this.CB_Money.Location = new System.Drawing.Point(195, 100); + this.CB_Money.Location = new System.Drawing.Point(190, 94); this.CB_Money.Name = "CB_Money"; this.CB_Money.Size = new System.Drawing.Size(77, 21); this.CB_Money.TabIndex = 52; @@ -370,7 +370,7 @@ private void InitializeComponent() // L_Battle_Type // this.L_Battle_Type.AutoSize = true; - this.L_Battle_Type.Location = new System.Drawing.Point(56, 76); + this.L_Battle_Type.Location = new System.Drawing.Point(51, 70); this.L_Battle_Type.Name = "L_Battle_Type"; this.L_Battle_Type.Size = new System.Drawing.Size(64, 13); this.L_Battle_Type.TabIndex = 51; @@ -387,7 +387,7 @@ private void InitializeComponent() "Triple Battle", "Rotation Battle", "Horde Battle"}); - this.CB_Battle_Type.Location = new System.Drawing.Point(121, 73); + this.CB_Battle_Type.Location = new System.Drawing.Point(116, 67); this.CB_Battle_Type.Name = "CB_Battle_Type"; this.CB_Battle_Type.Size = new System.Drawing.Size(151, 21); this.CB_Battle_Type.TabIndex = 50; @@ -395,7 +395,7 @@ private void InitializeComponent() // L_Trainer_Class // this.L_Trainer_Class.AutoSize = true; - this.L_Trainer_Class.Location = new System.Drawing.Point(49, 49); + this.L_Trainer_Class.Location = new System.Drawing.Point(44, 43); this.L_Trainer_Class.Name = "L_Trainer_Class"; this.L_Trainer_Class.Size = new System.Drawing.Size(71, 13); this.L_Trainer_Class.TabIndex = 49; @@ -407,7 +407,7 @@ private void InitializeComponent() this.CB_Trainer_Class.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Trainer_Class.DropDownWidth = 165; this.CB_Trainer_Class.FormattingEnabled = true; - this.CB_Trainer_Class.Location = new System.Drawing.Point(121, 46); + this.CB_Trainer_Class.Location = new System.Drawing.Point(116, 40); this.CB_Trainer_Class.Name = "CB_Trainer_Class"; this.CB_Trainer_Class.Size = new System.Drawing.Size(151, 21); this.CB_Trainer_Class.TabIndex = 48; @@ -415,7 +415,7 @@ private void InitializeComponent() // checkBox_Moves // this.checkBox_Moves.AutoSize = true; - this.checkBox_Moves.Location = new System.Drawing.Point(457, 76); + this.checkBox_Moves.Location = new System.Drawing.Point(452, 28); this.checkBox_Moves.Name = "checkBox_Moves"; this.checkBox_Moves.Size = new System.Drawing.Size(58, 17); this.checkBox_Moves.TabIndex = 40; @@ -426,7 +426,7 @@ private void InitializeComponent() // checkBox_Item // this.checkBox_Item.AutoSize = true; - this.checkBox_Item.Location = new System.Drawing.Point(457, 103); + this.checkBox_Item.Location = new System.Drawing.Point(452, 44); this.checkBox_Item.Name = "checkBox_Item"; this.checkBox_Item.Size = new System.Drawing.Size(51, 17); this.checkBox_Item.TabIndex = 39; @@ -437,7 +437,7 @@ private void InitializeComponent() // L_Item_4 // this.L_Item_4.AutoSize = true; - this.L_Item_4.Location = new System.Drawing.Point(284, 103); + this.L_Item_4.Location = new System.Drawing.Point(276, 97); this.L_Item_4.Name = "L_Item_4"; this.L_Item_4.Size = new System.Drawing.Size(39, 13); this.L_Item_4.TabIndex = 34; @@ -448,7 +448,7 @@ private void InitializeComponent() this.CB_Item_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_4.FormattingEnabled = true; - this.CB_Item_4.Location = new System.Drawing.Point(324, 100); + this.CB_Item_4.Location = new System.Drawing.Point(316, 94); this.CB_Item_4.Name = "CB_Item_4"; this.CB_Item_4.Size = new System.Drawing.Size(121, 21); this.CB_Item_4.TabIndex = 33; @@ -456,7 +456,7 @@ private void InitializeComponent() // L_Item_3 // this.L_Item_3.AutoSize = true; - this.L_Item_3.Location = new System.Drawing.Point(284, 76); + this.L_Item_3.Location = new System.Drawing.Point(276, 70); this.L_Item_3.Name = "L_Item_3"; this.L_Item_3.Size = new System.Drawing.Size(39, 13); this.L_Item_3.TabIndex = 32; @@ -467,7 +467,7 @@ private void InitializeComponent() this.CB_Item_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_3.FormattingEnabled = true; - this.CB_Item_3.Location = new System.Drawing.Point(324, 73); + this.CB_Item_3.Location = new System.Drawing.Point(316, 67); this.CB_Item_3.Name = "CB_Item_3"; this.CB_Item_3.Size = new System.Drawing.Size(121, 21); this.CB_Item_3.TabIndex = 31; @@ -475,7 +475,7 @@ private void InitializeComponent() // L_Item_2 // this.L_Item_2.AutoSize = true; - this.L_Item_2.Location = new System.Drawing.Point(284, 49); + this.L_Item_2.Location = new System.Drawing.Point(276, 43); this.L_Item_2.Name = "L_Item_2"; this.L_Item_2.Size = new System.Drawing.Size(39, 13); this.L_Item_2.TabIndex = 30; @@ -486,7 +486,7 @@ private void InitializeComponent() this.CB_Item_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_2.FormattingEnabled = true; - this.CB_Item_2.Location = new System.Drawing.Point(324, 46); + this.CB_Item_2.Location = new System.Drawing.Point(316, 40); this.CB_Item_2.Name = "CB_Item_2"; this.CB_Item_2.Size = new System.Drawing.Size(121, 21); this.CB_Item_2.TabIndex = 29; @@ -494,7 +494,7 @@ private void InitializeComponent() // L_Item_1 // this.L_Item_1.AutoSize = true; - this.L_Item_1.Location = new System.Drawing.Point(284, 22); + this.L_Item_1.Location = new System.Drawing.Point(276, 16); this.L_Item_1.Name = "L_Item_1"; this.L_Item_1.Size = new System.Drawing.Size(39, 13); this.L_Item_1.TabIndex = 28; @@ -505,7 +505,7 @@ private void InitializeComponent() this.CB_Item_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_1.FormattingEnabled = true; - this.CB_Item_1.Location = new System.Drawing.Point(324, 19); + this.CB_Item_1.Location = new System.Drawing.Point(316, 13); this.CB_Item_1.Name = "CB_Item_1"; this.CB_Item_1.Size = new System.Drawing.Size(121, 21); this.CB_Item_1.TabIndex = 27; @@ -513,7 +513,7 @@ private void InitializeComponent() // L_numPokemon // this.L_numPokemon.AutoSize = true; - this.L_numPokemon.Location = new System.Drawing.Point(13, 22); + this.L_numPokemon.Location = new System.Drawing.Point(8, 16); this.L_numPokemon.Name = "L_numPokemon"; this.L_numPokemon.Size = new System.Drawing.Size(107, 13); this.L_numPokemon.TabIndex = 22; @@ -532,7 +532,7 @@ private void InitializeComponent() "4", "5", "6"}); - this.CB_numPokemon.Location = new System.Drawing.Point(121, 19); + this.CB_numPokemon.Location = new System.Drawing.Point(116, 13); this.CB_numPokemon.Name = "CB_numPokemon"; this.CB_numPokemon.Size = new System.Drawing.Size(151, 21); this.CB_numPokemon.TabIndex = 21; @@ -573,7 +573,7 @@ private void InitializeComponent() // L_Pokemon_1_Form // this.L_Pokemon_1_Form.AutoSize = true; - this.L_Pokemon_1_Form.Location = new System.Drawing.Point(33, 44); + this.L_Pokemon_1_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_1_Form.Name = "L_Pokemon_1_Form"; this.L_Pokemon_1_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_1_Form.TabIndex = 63; @@ -585,15 +585,15 @@ private void InitializeComponent() this.CB_Pokemon_1_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Ability.Enabled = false; this.CB_Pokemon_1_Ability.FormattingEnabled = true; - this.CB_Pokemon_1_Ability.Location = new System.Drawing.Point(429, 41); + this.CB_Pokemon_1_Ability.Location = new System.Drawing.Point(413, 41); this.CB_Pokemon_1_Ability.Name = "CB_Pokemon_1_Ability"; - this.CB_Pokemon_1_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_1_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_1_Ability.TabIndex = 62; // // L_Pokemon_1_Gender // this.L_Pokemon_1_Gender.AutoSize = true; - this.L_Pokemon_1_Gender.Location = new System.Drawing.Point(378, 71); + this.L_Pokemon_1_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_1_Gender.Name = "L_Pokemon_1_Gender"; this.L_Pokemon_1_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_1_Gender.TabIndex = 59; @@ -605,16 +605,16 @@ private void InitializeComponent() this.CB_Pokemon_1_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Gender.Enabled = false; this.CB_Pokemon_1_Gender.FormattingEnabled = true; - this.CB_Pokemon_1_Gender.Location = new System.Drawing.Point(429, 68); + this.CB_Pokemon_1_Gender.Location = new System.Drawing.Point(413, 68); this.CB_Pokemon_1_Gender.Name = "CB_Pokemon_1_Gender"; - this.CB_Pokemon_1_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_1_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_1_Gender.TabIndex = 58; this.CB_Pokemon_1_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); // // L_Pokemon_1_Ability // this.L_Pokemon_1_Ability.AutoSize = true; - this.L_Pokemon_1_Ability.Location = new System.Drawing.Point(386, 44); + this.L_Pokemon_1_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_1_Ability.Name = "L_Pokemon_1_Ability"; this.L_Pokemon_1_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_1_Ability.TabIndex = 57; @@ -626,7 +626,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Form.Enabled = false; this.CB_Pokemon_1_Form.FormattingEnabled = true; - this.CB_Pokemon_1_Form.Location = new System.Drawing.Point(72, 41); + this.CB_Pokemon_1_Form.Location = new System.Drawing.Point(64, 41); this.CB_Pokemon_1_Form.Name = "CB_Pokemon_1_Form"; this.CB_Pokemon_1_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Form.TabIndex = 56; @@ -635,7 +635,7 @@ private void InitializeComponent() // L_Pokemon_1_IVs // this.L_Pokemon_1_IVs.AutoSize = true; - this.L_Pokemon_1_IVs.Location = new System.Drawing.Point(398, 17); + this.L_Pokemon_1_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_1_IVs.Name = "L_Pokemon_1_IVs"; this.L_Pokemon_1_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_1_IVs.TabIndex = 36; @@ -647,15 +647,15 @@ private void InitializeComponent() this.CB_Pokemon_1_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_IVs.Enabled = false; this.CB_Pokemon_1_IVs.FormattingEnabled = true; - this.CB_Pokemon_1_IVs.Location = new System.Drawing.Point(429, 14); + this.CB_Pokemon_1_IVs.Location = new System.Drawing.Point(413, 14); this.CB_Pokemon_1_IVs.Name = "CB_Pokemon_1_IVs"; - this.CB_Pokemon_1_IVs.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_1_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_1_IVs.TabIndex = 35; // // L_Pokemon_1_Move_4 // this.L_Pokemon_1_Move_4.AutoSize = true; - this.L_Pokemon_1_Move_4.Location = new System.Drawing.Point(199, 98); + this.L_Pokemon_1_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_1_Move_4.Name = "L_Pokemon_1_Move_4"; this.L_Pokemon_1_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_4.TabIndex = 34; @@ -667,7 +667,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_4.Enabled = false; this.CB_Pokemon_1_Move_4.FormattingEnabled = true; - this.CB_Pokemon_1_Move_4.Location = new System.Drawing.Point(251, 95); + this.CB_Pokemon_1_Move_4.Location = new System.Drawing.Point(241, 95); this.CB_Pokemon_1_Move_4.Name = "CB_Pokemon_1_Move_4"; this.CB_Pokemon_1_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_4.TabIndex = 33; @@ -675,7 +675,7 @@ private void InitializeComponent() // L_Pokemon_1_Move_3 // this.L_Pokemon_1_Move_3.AutoSize = true; - this.L_Pokemon_1_Move_3.Location = new System.Drawing.Point(199, 71); + this.L_Pokemon_1_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_1_Move_3.Name = "L_Pokemon_1_Move_3"; this.L_Pokemon_1_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_3.TabIndex = 32; @@ -687,7 +687,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_3.Enabled = false; this.CB_Pokemon_1_Move_3.FormattingEnabled = true; - this.CB_Pokemon_1_Move_3.Location = new System.Drawing.Point(251, 68); + this.CB_Pokemon_1_Move_3.Location = new System.Drawing.Point(241, 68); this.CB_Pokemon_1_Move_3.Name = "CB_Pokemon_1_Move_3"; this.CB_Pokemon_1_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_3.TabIndex = 31; @@ -695,7 +695,7 @@ private void InitializeComponent() // L_Pokemon_1_Move_2 // this.L_Pokemon_1_Move_2.AutoSize = true; - this.L_Pokemon_1_Move_2.Location = new System.Drawing.Point(199, 44); + this.L_Pokemon_1_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_1_Move_2.Name = "L_Pokemon_1_Move_2"; this.L_Pokemon_1_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_2.TabIndex = 30; @@ -707,7 +707,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_2.Enabled = false; this.CB_Pokemon_1_Move_2.FormattingEnabled = true; - this.CB_Pokemon_1_Move_2.Location = new System.Drawing.Point(251, 41); + this.CB_Pokemon_1_Move_2.Location = new System.Drawing.Point(241, 41); this.CB_Pokemon_1_Move_2.Name = "CB_Pokemon_1_Move_2"; this.CB_Pokemon_1_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_2.TabIndex = 29; @@ -715,7 +715,7 @@ private void InitializeComponent() // L_Pokemon_1_Move_1 // this.L_Pokemon_1_Move_1.AutoSize = true; - this.L_Pokemon_1_Move_1.Location = new System.Drawing.Point(199, 17); + this.L_Pokemon_1_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_1_Move_1.Name = "L_Pokemon_1_Move_1"; this.L_Pokemon_1_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_1.TabIndex = 28; @@ -727,7 +727,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_1.Enabled = false; this.CB_Pokemon_1_Move_1.FormattingEnabled = true; - this.CB_Pokemon_1_Move_1.Location = new System.Drawing.Point(251, 14); + this.CB_Pokemon_1_Move_1.Location = new System.Drawing.Point(241, 14); this.CB_Pokemon_1_Move_1.Name = "CB_Pokemon_1_Move_1"; this.CB_Pokemon_1_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_1.TabIndex = 27; @@ -735,7 +735,7 @@ private void InitializeComponent() // L_Pokemon_1_Item // this.L_Pokemon_1_Item.AutoSize = true; - this.L_Pokemon_1_Item.Location = new System.Drawing.Point(36, 98); + this.L_Pokemon_1_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_1_Item.Name = "L_Pokemon_1_Item"; this.L_Pokemon_1_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_1_Item.TabIndex = 26; @@ -747,7 +747,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Item.Enabled = false; this.CB_Pokemon_1_Item.FormattingEnabled = true; - this.CB_Pokemon_1_Item.Location = new System.Drawing.Point(72, 95); + this.CB_Pokemon_1_Item.Location = new System.Drawing.Point(64, 95); this.CB_Pokemon_1_Item.Name = "CB_Pokemon_1_Item"; this.CB_Pokemon_1_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Item.TabIndex = 25; @@ -756,7 +756,7 @@ private void InitializeComponent() // L_Pokemon_1_Level // this.L_Pokemon_1_Level.AutoSize = true; - this.L_Pokemon_1_Level.Location = new System.Drawing.Point(30, 71); + this.L_Pokemon_1_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_1_Level.Name = "L_Pokemon_1_Level"; this.L_Pokemon_1_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_1_Level.TabIndex = 24; @@ -768,7 +768,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Level.Enabled = false; this.CB_Pokemon_1_Level.FormattingEnabled = true; - this.CB_Pokemon_1_Level.Location = new System.Drawing.Point(72, 68); + this.CB_Pokemon_1_Level.Location = new System.Drawing.Point(64, 68); this.CB_Pokemon_1_Level.Name = "CB_Pokemon_1_Level"; this.CB_Pokemon_1_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Level.TabIndex = 23; @@ -776,7 +776,7 @@ private void InitializeComponent() // L_Pokemon_1_Pokemon // this.L_Pokemon_1_Pokemon.AutoSize = true; - this.L_Pokemon_1_Pokemon.Location = new System.Drawing.Point(11, 17); + this.L_Pokemon_1_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_1_Pokemon.Name = "L_Pokemon_1_Pokemon"; this.L_Pokemon_1_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_1_Pokemon.TabIndex = 22; @@ -788,7 +788,7 @@ private void InitializeComponent() this.CB_Pokemon_1_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Pokemon.Enabled = false; this.CB_Pokemon_1_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_1_Pokemon.Location = new System.Drawing.Point(72, 14); + this.CB_Pokemon_1_Pokemon.Location = new System.Drawing.Point(64, 14); this.CB_Pokemon_1_Pokemon.Name = "CB_Pokemon_1_Pokemon"; this.CB_Pokemon_1_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Pokemon.TabIndex = 21; @@ -829,7 +829,7 @@ private void InitializeComponent() // L_Pokemon_2_Gender // this.L_Pokemon_2_Gender.AutoSize = true; - this.L_Pokemon_2_Gender.Location = new System.Drawing.Point(378, 71); + this.L_Pokemon_2_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_2_Gender.Name = "L_Pokemon_2_Gender"; this.L_Pokemon_2_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_2_Gender.TabIndex = 65; @@ -841,16 +841,16 @@ private void InitializeComponent() this.CB_Pokemon_2_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Gender.Enabled = false; this.CB_Pokemon_2_Gender.FormattingEnabled = true; - this.CB_Pokemon_2_Gender.Location = new System.Drawing.Point(429, 68); + this.CB_Pokemon_2_Gender.Location = new System.Drawing.Point(413, 68); this.CB_Pokemon_2_Gender.Name = "CB_Pokemon_2_Gender"; - this.CB_Pokemon_2_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_2_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_2_Gender.TabIndex = 64; this.CB_Pokemon_2_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); // // L_Pokemon_2_Ability // this.L_Pokemon_2_Ability.AutoSize = true; - this.L_Pokemon_2_Ability.Location = new System.Drawing.Point(386, 44); + this.L_Pokemon_2_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_2_Ability.Name = "L_Pokemon_2_Ability"; this.L_Pokemon_2_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_2_Ability.TabIndex = 63; @@ -862,15 +862,15 @@ private void InitializeComponent() this.CB_Pokemon_2_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Ability.Enabled = false; this.CB_Pokemon_2_Ability.FormattingEnabled = true; - this.CB_Pokemon_2_Ability.Location = new System.Drawing.Point(429, 41); + this.CB_Pokemon_2_Ability.Location = new System.Drawing.Point(413, 41); this.CB_Pokemon_2_Ability.Name = "CB_Pokemon_2_Ability"; - this.CB_Pokemon_2_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_2_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_2_Ability.TabIndex = 62; // // L_Pokemon_2_Form // this.L_Pokemon_2_Form.AutoSize = true; - this.L_Pokemon_2_Form.Location = new System.Drawing.Point(33, 44); + this.L_Pokemon_2_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_2_Form.Name = "L_Pokemon_2_Form"; this.L_Pokemon_2_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_2_Form.TabIndex = 59; @@ -882,7 +882,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Form.Enabled = false; this.CB_Pokemon_2_Form.FormattingEnabled = true; - this.CB_Pokemon_2_Form.Location = new System.Drawing.Point(72, 41); + this.CB_Pokemon_2_Form.Location = new System.Drawing.Point(64, 41); this.CB_Pokemon_2_Form.Name = "CB_Pokemon_2_Form"; this.CB_Pokemon_2_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Form.TabIndex = 58; @@ -891,7 +891,7 @@ private void InitializeComponent() // L_Pokemon_2_IVs // this.L_Pokemon_2_IVs.AutoSize = true; - this.L_Pokemon_2_IVs.Location = new System.Drawing.Point(398, 17); + this.L_Pokemon_2_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_2_IVs.Name = "L_Pokemon_2_IVs"; this.L_Pokemon_2_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_2_IVs.TabIndex = 38; @@ -903,15 +903,15 @@ private void InitializeComponent() this.CB_Pokemon_2_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_IVs.Enabled = false; this.CB_Pokemon_2_IVs.FormattingEnabled = true; - this.CB_Pokemon_2_IVs.Location = new System.Drawing.Point(429, 14); + this.CB_Pokemon_2_IVs.Location = new System.Drawing.Point(413, 14); this.CB_Pokemon_2_IVs.Name = "CB_Pokemon_2_IVs"; - this.CB_Pokemon_2_IVs.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_2_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_2_IVs.TabIndex = 37; // // L_Pokemon_2_Move_4 // this.L_Pokemon_2_Move_4.AutoSize = true; - this.L_Pokemon_2_Move_4.Location = new System.Drawing.Point(199, 98); + this.L_Pokemon_2_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_2_Move_4.Name = "L_Pokemon_2_Move_4"; this.L_Pokemon_2_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_4.TabIndex = 34; @@ -923,7 +923,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_4.Enabled = false; this.CB_Pokemon_2_Move_4.FormattingEnabled = true; - this.CB_Pokemon_2_Move_4.Location = new System.Drawing.Point(251, 95); + this.CB_Pokemon_2_Move_4.Location = new System.Drawing.Point(241, 95); this.CB_Pokemon_2_Move_4.Name = "CB_Pokemon_2_Move_4"; this.CB_Pokemon_2_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_4.TabIndex = 33; @@ -931,7 +931,7 @@ private void InitializeComponent() // L_Pokemon_2_Move_3 // this.L_Pokemon_2_Move_3.AutoSize = true; - this.L_Pokemon_2_Move_3.Location = new System.Drawing.Point(199, 71); + this.L_Pokemon_2_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_2_Move_3.Name = "L_Pokemon_2_Move_3"; this.L_Pokemon_2_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_3.TabIndex = 32; @@ -943,7 +943,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_3.Enabled = false; this.CB_Pokemon_2_Move_3.FormattingEnabled = true; - this.CB_Pokemon_2_Move_3.Location = new System.Drawing.Point(251, 68); + this.CB_Pokemon_2_Move_3.Location = new System.Drawing.Point(241, 68); this.CB_Pokemon_2_Move_3.Name = "CB_Pokemon_2_Move_3"; this.CB_Pokemon_2_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_3.TabIndex = 31; @@ -951,7 +951,7 @@ private void InitializeComponent() // L_Pokemon_2_Move_2 // this.L_Pokemon_2_Move_2.AutoSize = true; - this.L_Pokemon_2_Move_2.Location = new System.Drawing.Point(199, 44); + this.L_Pokemon_2_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_2_Move_2.Name = "L_Pokemon_2_Move_2"; this.L_Pokemon_2_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_2.TabIndex = 30; @@ -963,7 +963,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_2.Enabled = false; this.CB_Pokemon_2_Move_2.FormattingEnabled = true; - this.CB_Pokemon_2_Move_2.Location = new System.Drawing.Point(251, 41); + this.CB_Pokemon_2_Move_2.Location = new System.Drawing.Point(241, 41); this.CB_Pokemon_2_Move_2.Name = "CB_Pokemon_2_Move_2"; this.CB_Pokemon_2_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_2.TabIndex = 29; @@ -971,7 +971,7 @@ private void InitializeComponent() // L_Pokemon_2_Move_1 // this.L_Pokemon_2_Move_1.AutoSize = true; - this.L_Pokemon_2_Move_1.Location = new System.Drawing.Point(199, 17); + this.L_Pokemon_2_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_2_Move_1.Name = "L_Pokemon_2_Move_1"; this.L_Pokemon_2_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_1.TabIndex = 28; @@ -983,7 +983,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_1.Enabled = false; this.CB_Pokemon_2_Move_1.FormattingEnabled = true; - this.CB_Pokemon_2_Move_1.Location = new System.Drawing.Point(251, 14); + this.CB_Pokemon_2_Move_1.Location = new System.Drawing.Point(241, 14); this.CB_Pokemon_2_Move_1.Name = "CB_Pokemon_2_Move_1"; this.CB_Pokemon_2_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_1.TabIndex = 27; @@ -991,7 +991,7 @@ private void InitializeComponent() // L_Pokemon_2_Item // this.L_Pokemon_2_Item.AutoSize = true; - this.L_Pokemon_2_Item.Location = new System.Drawing.Point(36, 98); + this.L_Pokemon_2_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_2_Item.Name = "L_Pokemon_2_Item"; this.L_Pokemon_2_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_2_Item.TabIndex = 26; @@ -1003,7 +1003,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Item.Enabled = false; this.CB_Pokemon_2_Item.FormattingEnabled = true; - this.CB_Pokemon_2_Item.Location = new System.Drawing.Point(72, 95); + this.CB_Pokemon_2_Item.Location = new System.Drawing.Point(64, 95); this.CB_Pokemon_2_Item.Name = "CB_Pokemon_2_Item"; this.CB_Pokemon_2_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Item.TabIndex = 25; @@ -1012,7 +1012,7 @@ private void InitializeComponent() // L_CB_Pokemon_2_Level // this.L_CB_Pokemon_2_Level.AutoSize = true; - this.L_CB_Pokemon_2_Level.Location = new System.Drawing.Point(30, 71); + this.L_CB_Pokemon_2_Level.Location = new System.Drawing.Point(26, 71); this.L_CB_Pokemon_2_Level.Name = "L_CB_Pokemon_2_Level"; this.L_CB_Pokemon_2_Level.Size = new System.Drawing.Size(36, 13); this.L_CB_Pokemon_2_Level.TabIndex = 24; @@ -1024,7 +1024,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Level.Enabled = false; this.CB_Pokemon_2_Level.FormattingEnabled = true; - this.CB_Pokemon_2_Level.Location = new System.Drawing.Point(72, 68); + this.CB_Pokemon_2_Level.Location = new System.Drawing.Point(64, 68); this.CB_Pokemon_2_Level.Name = "CB_Pokemon_2_Level"; this.CB_Pokemon_2_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Level.TabIndex = 23; @@ -1032,7 +1032,7 @@ private void InitializeComponent() // L_Pokemon_2_Pokemon // this.L_Pokemon_2_Pokemon.AutoSize = true; - this.L_Pokemon_2_Pokemon.Location = new System.Drawing.Point(11, 17); + this.L_Pokemon_2_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_2_Pokemon.Name = "L_Pokemon_2_Pokemon"; this.L_Pokemon_2_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_2_Pokemon.TabIndex = 22; @@ -1044,7 +1044,7 @@ private void InitializeComponent() this.CB_Pokemon_2_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Pokemon.Enabled = false; this.CB_Pokemon_2_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_2_Pokemon.Location = new System.Drawing.Point(72, 14); + this.CB_Pokemon_2_Pokemon.Location = new System.Drawing.Point(64, 14); this.CB_Pokemon_2_Pokemon.Name = "CB_Pokemon_2_Pokemon"; this.CB_Pokemon_2_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Pokemon.TabIndex = 21; @@ -1085,7 +1085,7 @@ private void InitializeComponent() // L_Pokemon_3_Gender // this.L_Pokemon_3_Gender.AutoSize = true; - this.L_Pokemon_3_Gender.Location = new System.Drawing.Point(378, 71); + this.L_Pokemon_3_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_3_Gender.Name = "L_Pokemon_3_Gender"; this.L_Pokemon_3_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_3_Gender.TabIndex = 65; @@ -1097,16 +1097,16 @@ private void InitializeComponent() this.CB_Pokemon_3_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Gender.Enabled = false; this.CB_Pokemon_3_Gender.FormattingEnabled = true; - this.CB_Pokemon_3_Gender.Location = new System.Drawing.Point(429, 68); + this.CB_Pokemon_3_Gender.Location = new System.Drawing.Point(413, 68); this.CB_Pokemon_3_Gender.Name = "CB_Pokemon_3_Gender"; - this.CB_Pokemon_3_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_3_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_3_Gender.TabIndex = 64; this.CB_Pokemon_3_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); // // L_Pokemon_3_Ability // this.L_Pokemon_3_Ability.AutoSize = true; - this.L_Pokemon_3_Ability.Location = new System.Drawing.Point(386, 44); + this.L_Pokemon_3_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_3_Ability.Name = "L_Pokemon_3_Ability"; this.L_Pokemon_3_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_3_Ability.TabIndex = 63; @@ -1118,15 +1118,15 @@ private void InitializeComponent() this.CB_Pokemon_3_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Ability.Enabled = false; this.CB_Pokemon_3_Ability.FormattingEnabled = true; - this.CB_Pokemon_3_Ability.Location = new System.Drawing.Point(429, 41); + this.CB_Pokemon_3_Ability.Location = new System.Drawing.Point(413, 41); this.CB_Pokemon_3_Ability.Name = "CB_Pokemon_3_Ability"; - this.CB_Pokemon_3_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_3_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_3_Ability.TabIndex = 62; // // L_Pokemon_3_Form // this.L_Pokemon_3_Form.AutoSize = true; - this.L_Pokemon_3_Form.Location = new System.Drawing.Point(33, 44); + this.L_Pokemon_3_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_3_Form.Name = "L_Pokemon_3_Form"; this.L_Pokemon_3_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_3_Form.TabIndex = 59; @@ -1138,7 +1138,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Form.Enabled = false; this.CB_Pokemon_3_Form.FormattingEnabled = true; - this.CB_Pokemon_3_Form.Location = new System.Drawing.Point(72, 41); + this.CB_Pokemon_3_Form.Location = new System.Drawing.Point(64, 41); this.CB_Pokemon_3_Form.Name = "CB_Pokemon_3_Form"; this.CB_Pokemon_3_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Form.TabIndex = 58; @@ -1147,7 +1147,7 @@ private void InitializeComponent() // L_Pokemon_3_IVs // this.L_Pokemon_3_IVs.AutoSize = true; - this.L_Pokemon_3_IVs.Location = new System.Drawing.Point(398, 17); + this.L_Pokemon_3_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_3_IVs.Name = "L_Pokemon_3_IVs"; this.L_Pokemon_3_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_3_IVs.TabIndex = 38; @@ -1159,15 +1159,15 @@ private void InitializeComponent() this.CB_Pokemon_3_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_IVs.Enabled = false; this.CB_Pokemon_3_IVs.FormattingEnabled = true; - this.CB_Pokemon_3_IVs.Location = new System.Drawing.Point(429, 14); + this.CB_Pokemon_3_IVs.Location = new System.Drawing.Point(413, 14); this.CB_Pokemon_3_IVs.Name = "CB_Pokemon_3_IVs"; - this.CB_Pokemon_3_IVs.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_3_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_3_IVs.TabIndex = 37; // // L_Pokemon_3_Move_4 // this.L_Pokemon_3_Move_4.AutoSize = true; - this.L_Pokemon_3_Move_4.Location = new System.Drawing.Point(199, 98); + this.L_Pokemon_3_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_3_Move_4.Name = "L_Pokemon_3_Move_4"; this.L_Pokemon_3_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_4.TabIndex = 34; @@ -1179,7 +1179,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_4.Enabled = false; this.CB_Pokemon_3_Move_4.FormattingEnabled = true; - this.CB_Pokemon_3_Move_4.Location = new System.Drawing.Point(251, 95); + this.CB_Pokemon_3_Move_4.Location = new System.Drawing.Point(241, 95); this.CB_Pokemon_3_Move_4.Name = "CB_Pokemon_3_Move_4"; this.CB_Pokemon_3_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_4.TabIndex = 33; @@ -1187,7 +1187,7 @@ private void InitializeComponent() // L_Pokemon_3_Move_3 // this.L_Pokemon_3_Move_3.AutoSize = true; - this.L_Pokemon_3_Move_3.Location = new System.Drawing.Point(199, 71); + this.L_Pokemon_3_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_3_Move_3.Name = "L_Pokemon_3_Move_3"; this.L_Pokemon_3_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_3.TabIndex = 32; @@ -1199,7 +1199,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_3.Enabled = false; this.CB_Pokemon_3_Move_3.FormattingEnabled = true; - this.CB_Pokemon_3_Move_3.Location = new System.Drawing.Point(251, 68); + this.CB_Pokemon_3_Move_3.Location = new System.Drawing.Point(241, 68); this.CB_Pokemon_3_Move_3.Name = "CB_Pokemon_3_Move_3"; this.CB_Pokemon_3_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_3.TabIndex = 31; @@ -1207,7 +1207,7 @@ private void InitializeComponent() // L_Pokemon_3_Move_2 // this.L_Pokemon_3_Move_2.AutoSize = true; - this.L_Pokemon_3_Move_2.Location = new System.Drawing.Point(199, 44); + this.L_Pokemon_3_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_3_Move_2.Name = "L_Pokemon_3_Move_2"; this.L_Pokemon_3_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_2.TabIndex = 30; @@ -1219,7 +1219,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_2.Enabled = false; this.CB_Pokemon_3_Move_2.FormattingEnabled = true; - this.CB_Pokemon_3_Move_2.Location = new System.Drawing.Point(251, 41); + this.CB_Pokemon_3_Move_2.Location = new System.Drawing.Point(241, 41); this.CB_Pokemon_3_Move_2.Name = "CB_Pokemon_3_Move_2"; this.CB_Pokemon_3_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_2.TabIndex = 29; @@ -1227,7 +1227,7 @@ private void InitializeComponent() // L_Pokemon_3_Move_1 // this.L_Pokemon_3_Move_1.AutoSize = true; - this.L_Pokemon_3_Move_1.Location = new System.Drawing.Point(199, 17); + this.L_Pokemon_3_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_3_Move_1.Name = "L_Pokemon_3_Move_1"; this.L_Pokemon_3_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_1.TabIndex = 28; @@ -1239,7 +1239,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_1.Enabled = false; this.CB_Pokemon_3_Move_1.FormattingEnabled = true; - this.CB_Pokemon_3_Move_1.Location = new System.Drawing.Point(251, 14); + this.CB_Pokemon_3_Move_1.Location = new System.Drawing.Point(241, 14); this.CB_Pokemon_3_Move_1.Name = "CB_Pokemon_3_Move_1"; this.CB_Pokemon_3_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_1.TabIndex = 27; @@ -1247,7 +1247,7 @@ private void InitializeComponent() // L_Pokemon_3_Item // this.L_Pokemon_3_Item.AutoSize = true; - this.L_Pokemon_3_Item.Location = new System.Drawing.Point(36, 98); + this.L_Pokemon_3_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_3_Item.Name = "L_Pokemon_3_Item"; this.L_Pokemon_3_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_3_Item.TabIndex = 26; @@ -1259,7 +1259,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Item.Enabled = false; this.CB_Pokemon_3_Item.FormattingEnabled = true; - this.CB_Pokemon_3_Item.Location = new System.Drawing.Point(72, 95); + this.CB_Pokemon_3_Item.Location = new System.Drawing.Point(64, 95); this.CB_Pokemon_3_Item.Name = "CB_Pokemon_3_Item"; this.CB_Pokemon_3_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Item.TabIndex = 25; @@ -1268,7 +1268,7 @@ private void InitializeComponent() // L_Pokemon_3_Level // this.L_Pokemon_3_Level.AutoSize = true; - this.L_Pokemon_3_Level.Location = new System.Drawing.Point(30, 71); + this.L_Pokemon_3_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_3_Level.Name = "L_Pokemon_3_Level"; this.L_Pokemon_3_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_3_Level.TabIndex = 24; @@ -1280,7 +1280,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Level.Enabled = false; this.CB_Pokemon_3_Level.FormattingEnabled = true; - this.CB_Pokemon_3_Level.Location = new System.Drawing.Point(72, 68); + this.CB_Pokemon_3_Level.Location = new System.Drawing.Point(64, 68); this.CB_Pokemon_3_Level.Name = "CB_Pokemon_3_Level"; this.CB_Pokemon_3_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Level.TabIndex = 23; @@ -1288,7 +1288,7 @@ private void InitializeComponent() // L_Pokemon_3_Pokemon // this.L_Pokemon_3_Pokemon.AutoSize = true; - this.L_Pokemon_3_Pokemon.Location = new System.Drawing.Point(11, 17); + this.L_Pokemon_3_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_3_Pokemon.Name = "L_Pokemon_3_Pokemon"; this.L_Pokemon_3_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_3_Pokemon.TabIndex = 22; @@ -1300,7 +1300,7 @@ private void InitializeComponent() this.CB_Pokemon_3_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Pokemon.Enabled = false; this.CB_Pokemon_3_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_3_Pokemon.Location = new System.Drawing.Point(72, 14); + this.CB_Pokemon_3_Pokemon.Location = new System.Drawing.Point(64, 14); this.CB_Pokemon_3_Pokemon.Name = "CB_Pokemon_3_Pokemon"; this.CB_Pokemon_3_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Pokemon.TabIndex = 21; @@ -1341,7 +1341,7 @@ private void InitializeComponent() // L_Pokemon_4_Gender // this.L_Pokemon_4_Gender.AutoSize = true; - this.L_Pokemon_4_Gender.Location = new System.Drawing.Point(378, 71); + this.L_Pokemon_4_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_4_Gender.Name = "L_Pokemon_4_Gender"; this.L_Pokemon_4_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_4_Gender.TabIndex = 65; @@ -1353,16 +1353,16 @@ private void InitializeComponent() this.CB_Pokemon_4_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Gender.Enabled = false; this.CB_Pokemon_4_Gender.FormattingEnabled = true; - this.CB_Pokemon_4_Gender.Location = new System.Drawing.Point(429, 68); + this.CB_Pokemon_4_Gender.Location = new System.Drawing.Point(413, 68); this.CB_Pokemon_4_Gender.Name = "CB_Pokemon_4_Gender"; - this.CB_Pokemon_4_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_4_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_4_Gender.TabIndex = 64; this.CB_Pokemon_4_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); // // L_Pokemon_4_Ability // this.L_Pokemon_4_Ability.AutoSize = true; - this.L_Pokemon_4_Ability.Location = new System.Drawing.Point(386, 44); + this.L_Pokemon_4_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_4_Ability.Name = "L_Pokemon_4_Ability"; this.L_Pokemon_4_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_4_Ability.TabIndex = 63; @@ -1374,15 +1374,15 @@ private void InitializeComponent() this.CB_Pokemon_4_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Ability.Enabled = false; this.CB_Pokemon_4_Ability.FormattingEnabled = true; - this.CB_Pokemon_4_Ability.Location = new System.Drawing.Point(429, 41); + this.CB_Pokemon_4_Ability.Location = new System.Drawing.Point(413, 41); this.CB_Pokemon_4_Ability.Name = "CB_Pokemon_4_Ability"; - this.CB_Pokemon_4_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_4_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_4_Ability.TabIndex = 62; // // L_Pokemon_4_Form // this.L_Pokemon_4_Form.AutoSize = true; - this.L_Pokemon_4_Form.Location = new System.Drawing.Point(33, 44); + this.L_Pokemon_4_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_4_Form.Name = "L_Pokemon_4_Form"; this.L_Pokemon_4_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_4_Form.TabIndex = 59; @@ -1394,7 +1394,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Form.Enabled = false; this.CB_Pokemon_4_Form.FormattingEnabled = true; - this.CB_Pokemon_4_Form.Location = new System.Drawing.Point(72, 41); + this.CB_Pokemon_4_Form.Location = new System.Drawing.Point(64, 41); this.CB_Pokemon_4_Form.Name = "CB_Pokemon_4_Form"; this.CB_Pokemon_4_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Form.TabIndex = 58; @@ -1403,7 +1403,7 @@ private void InitializeComponent() // L_Pokemon_4_IVs // this.L_Pokemon_4_IVs.AutoSize = true; - this.L_Pokemon_4_IVs.Location = new System.Drawing.Point(398, 17); + this.L_Pokemon_4_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_4_IVs.Name = "L_Pokemon_4_IVs"; this.L_Pokemon_4_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_4_IVs.TabIndex = 38; @@ -1415,15 +1415,15 @@ private void InitializeComponent() this.CB_Pokemon_4_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_IVs.Enabled = false; this.CB_Pokemon_4_IVs.FormattingEnabled = true; - this.CB_Pokemon_4_IVs.Location = new System.Drawing.Point(429, 14); + this.CB_Pokemon_4_IVs.Location = new System.Drawing.Point(413, 14); this.CB_Pokemon_4_IVs.Name = "CB_Pokemon_4_IVs"; - this.CB_Pokemon_4_IVs.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_4_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_4_IVs.TabIndex = 37; // // L_Pokemon_4_Move_4 // this.L_Pokemon_4_Move_4.AutoSize = true; - this.L_Pokemon_4_Move_4.Location = new System.Drawing.Point(199, 98); + this.L_Pokemon_4_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_4_Move_4.Name = "L_Pokemon_4_Move_4"; this.L_Pokemon_4_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_4.TabIndex = 34; @@ -1435,7 +1435,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_4.Enabled = false; this.CB_Pokemon_4_Move_4.FormattingEnabled = true; - this.CB_Pokemon_4_Move_4.Location = new System.Drawing.Point(251, 95); + this.CB_Pokemon_4_Move_4.Location = new System.Drawing.Point(241, 95); this.CB_Pokemon_4_Move_4.Name = "CB_Pokemon_4_Move_4"; this.CB_Pokemon_4_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_4.TabIndex = 33; @@ -1443,7 +1443,7 @@ private void InitializeComponent() // L_Pokemon_4_Move_3 // this.L_Pokemon_4_Move_3.AutoSize = true; - this.L_Pokemon_4_Move_3.Location = new System.Drawing.Point(199, 71); + this.L_Pokemon_4_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_4_Move_3.Name = "L_Pokemon_4_Move_3"; this.L_Pokemon_4_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_3.TabIndex = 32; @@ -1455,7 +1455,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_3.Enabled = false; this.CB_Pokemon_4_Move_3.FormattingEnabled = true; - this.CB_Pokemon_4_Move_3.Location = new System.Drawing.Point(251, 68); + this.CB_Pokemon_4_Move_3.Location = new System.Drawing.Point(241, 68); this.CB_Pokemon_4_Move_3.Name = "CB_Pokemon_4_Move_3"; this.CB_Pokemon_4_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_3.TabIndex = 31; @@ -1463,7 +1463,7 @@ private void InitializeComponent() // L_Pokemon_4_Move_2 // this.L_Pokemon_4_Move_2.AutoSize = true; - this.L_Pokemon_4_Move_2.Location = new System.Drawing.Point(199, 44); + this.L_Pokemon_4_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_4_Move_2.Name = "L_Pokemon_4_Move_2"; this.L_Pokemon_4_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_2.TabIndex = 30; @@ -1475,7 +1475,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_2.Enabled = false; this.CB_Pokemon_4_Move_2.FormattingEnabled = true; - this.CB_Pokemon_4_Move_2.Location = new System.Drawing.Point(251, 41); + this.CB_Pokemon_4_Move_2.Location = new System.Drawing.Point(241, 41); this.CB_Pokemon_4_Move_2.Name = "CB_Pokemon_4_Move_2"; this.CB_Pokemon_4_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_2.TabIndex = 29; @@ -1483,7 +1483,7 @@ private void InitializeComponent() // L_Pokemon_4_Move_1 // this.L_Pokemon_4_Move_1.AutoSize = true; - this.L_Pokemon_4_Move_1.Location = new System.Drawing.Point(199, 17); + this.L_Pokemon_4_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_4_Move_1.Name = "L_Pokemon_4_Move_1"; this.L_Pokemon_4_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_1.TabIndex = 28; @@ -1495,7 +1495,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_1.Enabled = false; this.CB_Pokemon_4_Move_1.FormattingEnabled = true; - this.CB_Pokemon_4_Move_1.Location = new System.Drawing.Point(251, 14); + this.CB_Pokemon_4_Move_1.Location = new System.Drawing.Point(241, 14); this.CB_Pokemon_4_Move_1.Name = "CB_Pokemon_4_Move_1"; this.CB_Pokemon_4_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_1.TabIndex = 27; @@ -1503,7 +1503,7 @@ private void InitializeComponent() // L_CB_Pokemon_4_Item // this.L_CB_Pokemon_4_Item.AutoSize = true; - this.L_CB_Pokemon_4_Item.Location = new System.Drawing.Point(36, 98); + this.L_CB_Pokemon_4_Item.Location = new System.Drawing.Point(32, 98); this.L_CB_Pokemon_4_Item.Name = "L_CB_Pokemon_4_Item"; this.L_CB_Pokemon_4_Item.Size = new System.Drawing.Size(30, 13); this.L_CB_Pokemon_4_Item.TabIndex = 26; @@ -1515,7 +1515,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Item.Enabled = false; this.CB_Pokemon_4_Item.FormattingEnabled = true; - this.CB_Pokemon_4_Item.Location = new System.Drawing.Point(72, 95); + this.CB_Pokemon_4_Item.Location = new System.Drawing.Point(64, 95); this.CB_Pokemon_4_Item.Name = "CB_Pokemon_4_Item"; this.CB_Pokemon_4_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Item.TabIndex = 25; @@ -1524,7 +1524,7 @@ private void InitializeComponent() // L_Pokemon_4_Level // this.L_Pokemon_4_Level.AutoSize = true; - this.L_Pokemon_4_Level.Location = new System.Drawing.Point(30, 71); + this.L_Pokemon_4_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_4_Level.Name = "L_Pokemon_4_Level"; this.L_Pokemon_4_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_4_Level.TabIndex = 24; @@ -1536,7 +1536,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Level.Enabled = false; this.CB_Pokemon_4_Level.FormattingEnabled = true; - this.CB_Pokemon_4_Level.Location = new System.Drawing.Point(72, 68); + this.CB_Pokemon_4_Level.Location = new System.Drawing.Point(64, 68); this.CB_Pokemon_4_Level.Name = "CB_Pokemon_4_Level"; this.CB_Pokemon_4_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Level.TabIndex = 23; @@ -1544,7 +1544,7 @@ private void InitializeComponent() // L_Pokemon_4_Pokemon // this.L_Pokemon_4_Pokemon.AutoSize = true; - this.L_Pokemon_4_Pokemon.Location = new System.Drawing.Point(11, 17); + this.L_Pokemon_4_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_4_Pokemon.Name = "L_Pokemon_4_Pokemon"; this.L_Pokemon_4_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_4_Pokemon.TabIndex = 22; @@ -1556,7 +1556,7 @@ private void InitializeComponent() this.CB_Pokemon_4_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Pokemon.Enabled = false; this.CB_Pokemon_4_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_4_Pokemon.Location = new System.Drawing.Point(72, 14); + this.CB_Pokemon_4_Pokemon.Location = new System.Drawing.Point(64, 14); this.CB_Pokemon_4_Pokemon.Name = "CB_Pokemon_4_Pokemon"; this.CB_Pokemon_4_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Pokemon.TabIndex = 21; @@ -1597,7 +1597,7 @@ private void InitializeComponent() // L_Pokemon_5_Gender // this.L_Pokemon_5_Gender.AutoSize = true; - this.L_Pokemon_5_Gender.Location = new System.Drawing.Point(378, 71); + this.L_Pokemon_5_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_5_Gender.Name = "L_Pokemon_5_Gender"; this.L_Pokemon_5_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_5_Gender.TabIndex = 65; @@ -1609,16 +1609,16 @@ private void InitializeComponent() this.CB_Pokemon_5_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Gender.Enabled = false; this.CB_Pokemon_5_Gender.FormattingEnabled = true; - this.CB_Pokemon_5_Gender.Location = new System.Drawing.Point(429, 68); + this.CB_Pokemon_5_Gender.Location = new System.Drawing.Point(413, 68); this.CB_Pokemon_5_Gender.Name = "CB_Pokemon_5_Gender"; - this.CB_Pokemon_5_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_5_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_5_Gender.TabIndex = 64; this.CB_Pokemon_5_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); // // L_Pokemon_5_Ability // this.L_Pokemon_5_Ability.AutoSize = true; - this.L_Pokemon_5_Ability.Location = new System.Drawing.Point(386, 44); + this.L_Pokemon_5_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_5_Ability.Name = "L_Pokemon_5_Ability"; this.L_Pokemon_5_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_5_Ability.TabIndex = 63; @@ -1630,15 +1630,15 @@ private void InitializeComponent() this.CB_Pokemon_5_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Ability.Enabled = false; this.CB_Pokemon_5_Ability.FormattingEnabled = true; - this.CB_Pokemon_5_Ability.Location = new System.Drawing.Point(429, 41); + this.CB_Pokemon_5_Ability.Location = new System.Drawing.Point(413, 41); this.CB_Pokemon_5_Ability.Name = "CB_Pokemon_5_Ability"; - this.CB_Pokemon_5_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_5_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_5_Ability.TabIndex = 62; // // L_Pokemon_5_Form // this.L_Pokemon_5_Form.AutoSize = true; - this.L_Pokemon_5_Form.Location = new System.Drawing.Point(33, 44); + this.L_Pokemon_5_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_5_Form.Name = "L_Pokemon_5_Form"; this.L_Pokemon_5_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_5_Form.TabIndex = 59; @@ -1650,7 +1650,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Form.Enabled = false; this.CB_Pokemon_5_Form.FormattingEnabled = true; - this.CB_Pokemon_5_Form.Location = new System.Drawing.Point(72, 41); + this.CB_Pokemon_5_Form.Location = new System.Drawing.Point(64, 41); this.CB_Pokemon_5_Form.Name = "CB_Pokemon_5_Form"; this.CB_Pokemon_5_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Form.TabIndex = 58; @@ -1659,7 +1659,7 @@ private void InitializeComponent() // L_Pokemon_5_IVs // this.L_Pokemon_5_IVs.AutoSize = true; - this.L_Pokemon_5_IVs.Location = new System.Drawing.Point(398, 17); + this.L_Pokemon_5_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_5_IVs.Name = "L_Pokemon_5_IVs"; this.L_Pokemon_5_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_5_IVs.TabIndex = 38; @@ -1671,15 +1671,15 @@ private void InitializeComponent() this.CB_Pokemon_5_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_IVs.Enabled = false; this.CB_Pokemon_5_IVs.FormattingEnabled = true; - this.CB_Pokemon_5_IVs.Location = new System.Drawing.Point(429, 14); + this.CB_Pokemon_5_IVs.Location = new System.Drawing.Point(413, 14); this.CB_Pokemon_5_IVs.Name = "CB_Pokemon_5_IVs"; - this.CB_Pokemon_5_IVs.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_5_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_5_IVs.TabIndex = 37; // // L_Pokemon_5_Move_4 // this.L_Pokemon_5_Move_4.AutoSize = true; - this.L_Pokemon_5_Move_4.Location = new System.Drawing.Point(199, 98); + this.L_Pokemon_5_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_5_Move_4.Name = "L_Pokemon_5_Move_4"; this.L_Pokemon_5_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_4.TabIndex = 34; @@ -1691,7 +1691,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_4.Enabled = false; this.CB_Pokemon_5_Move_4.FormattingEnabled = true; - this.CB_Pokemon_5_Move_4.Location = new System.Drawing.Point(251, 95); + this.CB_Pokemon_5_Move_4.Location = new System.Drawing.Point(241, 95); this.CB_Pokemon_5_Move_4.Name = "CB_Pokemon_5_Move_4"; this.CB_Pokemon_5_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_4.TabIndex = 33; @@ -1699,7 +1699,7 @@ private void InitializeComponent() // L_Pokemon_5_Move_3 // this.L_Pokemon_5_Move_3.AutoSize = true; - this.L_Pokemon_5_Move_3.Location = new System.Drawing.Point(199, 71); + this.L_Pokemon_5_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_5_Move_3.Name = "L_Pokemon_5_Move_3"; this.L_Pokemon_5_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_3.TabIndex = 32; @@ -1711,7 +1711,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_3.Enabled = false; this.CB_Pokemon_5_Move_3.FormattingEnabled = true; - this.CB_Pokemon_5_Move_3.Location = new System.Drawing.Point(251, 68); + this.CB_Pokemon_5_Move_3.Location = new System.Drawing.Point(241, 68); this.CB_Pokemon_5_Move_3.Name = "CB_Pokemon_5_Move_3"; this.CB_Pokemon_5_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_3.TabIndex = 31; @@ -1719,7 +1719,7 @@ private void InitializeComponent() // L_Pokemon_5_Move_2 // this.L_Pokemon_5_Move_2.AutoSize = true; - this.L_Pokemon_5_Move_2.Location = new System.Drawing.Point(199, 44); + this.L_Pokemon_5_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_5_Move_2.Name = "L_Pokemon_5_Move_2"; this.L_Pokemon_5_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_2.TabIndex = 30; @@ -1731,7 +1731,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_2.Enabled = false; this.CB_Pokemon_5_Move_2.FormattingEnabled = true; - this.CB_Pokemon_5_Move_2.Location = new System.Drawing.Point(251, 41); + this.CB_Pokemon_5_Move_2.Location = new System.Drawing.Point(241, 41); this.CB_Pokemon_5_Move_2.Name = "CB_Pokemon_5_Move_2"; this.CB_Pokemon_5_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_2.TabIndex = 29; @@ -1739,7 +1739,7 @@ private void InitializeComponent() // L_Pokemon_5_Move_1 // this.L_Pokemon_5_Move_1.AutoSize = true; - this.L_Pokemon_5_Move_1.Location = new System.Drawing.Point(199, 17); + this.L_Pokemon_5_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_5_Move_1.Name = "L_Pokemon_5_Move_1"; this.L_Pokemon_5_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_1.TabIndex = 28; @@ -1751,7 +1751,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_1.Enabled = false; this.CB_Pokemon_5_Move_1.FormattingEnabled = true; - this.CB_Pokemon_5_Move_1.Location = new System.Drawing.Point(251, 14); + this.CB_Pokemon_5_Move_1.Location = new System.Drawing.Point(241, 14); this.CB_Pokemon_5_Move_1.Name = "CB_Pokemon_5_Move_1"; this.CB_Pokemon_5_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_1.TabIndex = 27; @@ -1759,7 +1759,7 @@ private void InitializeComponent() // L_Pokemon_5_Item // this.L_Pokemon_5_Item.AutoSize = true; - this.L_Pokemon_5_Item.Location = new System.Drawing.Point(36, 98); + this.L_Pokemon_5_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_5_Item.Name = "L_Pokemon_5_Item"; this.L_Pokemon_5_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_5_Item.TabIndex = 26; @@ -1771,7 +1771,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Item.Enabled = false; this.CB_Pokemon_5_Item.FormattingEnabled = true; - this.CB_Pokemon_5_Item.Location = new System.Drawing.Point(72, 95); + this.CB_Pokemon_5_Item.Location = new System.Drawing.Point(64, 95); this.CB_Pokemon_5_Item.Name = "CB_Pokemon_5_Item"; this.CB_Pokemon_5_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Item.TabIndex = 25; @@ -1780,7 +1780,7 @@ private void InitializeComponent() // L_Pokemon_5_Level // this.L_Pokemon_5_Level.AutoSize = true; - this.L_Pokemon_5_Level.Location = new System.Drawing.Point(30, 71); + this.L_Pokemon_5_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_5_Level.Name = "L_Pokemon_5_Level"; this.L_Pokemon_5_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_5_Level.TabIndex = 24; @@ -1792,7 +1792,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Level.Enabled = false; this.CB_Pokemon_5_Level.FormattingEnabled = true; - this.CB_Pokemon_5_Level.Location = new System.Drawing.Point(72, 68); + this.CB_Pokemon_5_Level.Location = new System.Drawing.Point(64, 68); this.CB_Pokemon_5_Level.Name = "CB_Pokemon_5_Level"; this.CB_Pokemon_5_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Level.TabIndex = 23; @@ -1800,7 +1800,7 @@ private void InitializeComponent() // L_Pokemon_5_Pokemon // this.L_Pokemon_5_Pokemon.AutoSize = true; - this.L_Pokemon_5_Pokemon.Location = new System.Drawing.Point(11, 17); + this.L_Pokemon_5_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_5_Pokemon.Name = "L_Pokemon_5_Pokemon"; this.L_Pokemon_5_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_5_Pokemon.TabIndex = 22; @@ -1812,7 +1812,7 @@ private void InitializeComponent() this.CB_Pokemon_5_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Pokemon.Enabled = false; this.CB_Pokemon_5_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_5_Pokemon.Location = new System.Drawing.Point(72, 14); + this.CB_Pokemon_5_Pokemon.Location = new System.Drawing.Point(64, 14); this.CB_Pokemon_5_Pokemon.Name = "CB_Pokemon_5_Pokemon"; this.CB_Pokemon_5_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Pokemon.TabIndex = 21; @@ -1853,7 +1853,7 @@ private void InitializeComponent() // L_Pokemon_6_Gender // this.L_Pokemon_6_Gender.AutoSize = true; - this.L_Pokemon_6_Gender.Location = new System.Drawing.Point(378, 71); + this.L_Pokemon_6_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_6_Gender.Name = "L_Pokemon_6_Gender"; this.L_Pokemon_6_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_6_Gender.TabIndex = 65; @@ -1865,16 +1865,16 @@ private void InitializeComponent() this.CB_Pokemon_6_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Gender.Enabled = false; this.CB_Pokemon_6_Gender.FormattingEnabled = true; - this.CB_Pokemon_6_Gender.Location = new System.Drawing.Point(429, 68); + this.CB_Pokemon_6_Gender.Location = new System.Drawing.Point(413, 68); this.CB_Pokemon_6_Gender.Name = "CB_Pokemon_6_Gender"; - this.CB_Pokemon_6_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_6_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_6_Gender.TabIndex = 64; this.CB_Pokemon_6_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); // // L_Pokemon_6_Ability // this.L_Pokemon_6_Ability.AutoSize = true; - this.L_Pokemon_6_Ability.Location = new System.Drawing.Point(386, 44); + this.L_Pokemon_6_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_6_Ability.Name = "L_Pokemon_6_Ability"; this.L_Pokemon_6_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_6_Ability.TabIndex = 63; @@ -1886,15 +1886,15 @@ private void InitializeComponent() this.CB_Pokemon_6_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Ability.Enabled = false; this.CB_Pokemon_6_Ability.FormattingEnabled = true; - this.CB_Pokemon_6_Ability.Location = new System.Drawing.Point(429, 41); + this.CB_Pokemon_6_Ability.Location = new System.Drawing.Point(413, 41); this.CB_Pokemon_6_Ability.Name = "CB_Pokemon_6_Ability"; - this.CB_Pokemon_6_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_6_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_6_Ability.TabIndex = 62; // // L_Pokemon_6_Form // this.L_Pokemon_6_Form.AutoSize = true; - this.L_Pokemon_6_Form.Location = new System.Drawing.Point(33, 44); + this.L_Pokemon_6_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_6_Form.Name = "L_Pokemon_6_Form"; this.L_Pokemon_6_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_6_Form.TabIndex = 59; @@ -1906,7 +1906,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Form.Enabled = false; this.CB_Pokemon_6_Form.FormattingEnabled = true; - this.CB_Pokemon_6_Form.Location = new System.Drawing.Point(72, 41); + this.CB_Pokemon_6_Form.Location = new System.Drawing.Point(64, 41); this.CB_Pokemon_6_Form.Name = "CB_Pokemon_6_Form"; this.CB_Pokemon_6_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Form.TabIndex = 58; @@ -1915,7 +1915,7 @@ private void InitializeComponent() // L_Pokemon_6_IVs // this.L_Pokemon_6_IVs.AutoSize = true; - this.L_Pokemon_6_IVs.Location = new System.Drawing.Point(398, 17); + this.L_Pokemon_6_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_6_IVs.Name = "L_Pokemon_6_IVs"; this.L_Pokemon_6_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_6_IVs.TabIndex = 38; @@ -1927,15 +1927,15 @@ private void InitializeComponent() this.CB_Pokemon_6_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_IVs.Enabled = false; this.CB_Pokemon_6_IVs.FormattingEnabled = true; - this.CB_Pokemon_6_IVs.Location = new System.Drawing.Point(429, 14); + this.CB_Pokemon_6_IVs.Location = new System.Drawing.Point(413, 14); this.CB_Pokemon_6_IVs.Name = "CB_Pokemon_6_IVs"; - this.CB_Pokemon_6_IVs.Size = new System.Drawing.Size(121, 21); + this.CB_Pokemon_6_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_6_IVs.TabIndex = 37; // // L_Pokemon_6_Move_4 // this.L_Pokemon_6_Move_4.AutoSize = true; - this.L_Pokemon_6_Move_4.Location = new System.Drawing.Point(199, 98); + this.L_Pokemon_6_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_6_Move_4.Name = "L_Pokemon_6_Move_4"; this.L_Pokemon_6_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_4.TabIndex = 34; @@ -1947,7 +1947,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_4.Enabled = false; this.CB_Pokemon_6_Move_4.FormattingEnabled = true; - this.CB_Pokemon_6_Move_4.Location = new System.Drawing.Point(251, 95); + this.CB_Pokemon_6_Move_4.Location = new System.Drawing.Point(241, 95); this.CB_Pokemon_6_Move_4.Name = "CB_Pokemon_6_Move_4"; this.CB_Pokemon_6_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_4.TabIndex = 33; @@ -1955,7 +1955,7 @@ private void InitializeComponent() // L_Pokemon_6_Move_3 // this.L_Pokemon_6_Move_3.AutoSize = true; - this.L_Pokemon_6_Move_3.Location = new System.Drawing.Point(199, 71); + this.L_Pokemon_6_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_6_Move_3.Name = "L_Pokemon_6_Move_3"; this.L_Pokemon_6_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_3.TabIndex = 32; @@ -1967,7 +1967,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_3.Enabled = false; this.CB_Pokemon_6_Move_3.FormattingEnabled = true; - this.CB_Pokemon_6_Move_3.Location = new System.Drawing.Point(251, 68); + this.CB_Pokemon_6_Move_3.Location = new System.Drawing.Point(241, 68); this.CB_Pokemon_6_Move_3.Name = "CB_Pokemon_6_Move_3"; this.CB_Pokemon_6_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_3.TabIndex = 31; @@ -1975,7 +1975,7 @@ private void InitializeComponent() // L_Pokemon_6_Move_2 // this.L_Pokemon_6_Move_2.AutoSize = true; - this.L_Pokemon_6_Move_2.Location = new System.Drawing.Point(199, 44); + this.L_Pokemon_6_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_6_Move_2.Name = "L_Pokemon_6_Move_2"; this.L_Pokemon_6_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_2.TabIndex = 30; @@ -1987,7 +1987,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_2.Enabled = false; this.CB_Pokemon_6_Move_2.FormattingEnabled = true; - this.CB_Pokemon_6_Move_2.Location = new System.Drawing.Point(251, 41); + this.CB_Pokemon_6_Move_2.Location = new System.Drawing.Point(241, 41); this.CB_Pokemon_6_Move_2.Name = "CB_Pokemon_6_Move_2"; this.CB_Pokemon_6_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_2.TabIndex = 29; @@ -1995,7 +1995,7 @@ private void InitializeComponent() // L_Pokemon_6_Move_1 // this.L_Pokemon_6_Move_1.AutoSize = true; - this.L_Pokemon_6_Move_1.Location = new System.Drawing.Point(199, 17); + this.L_Pokemon_6_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_6_Move_1.Name = "L_Pokemon_6_Move_1"; this.L_Pokemon_6_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_1.TabIndex = 28; @@ -2007,7 +2007,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_1.Enabled = false; this.CB_Pokemon_6_Move_1.FormattingEnabled = true; - this.CB_Pokemon_6_Move_1.Location = new System.Drawing.Point(251, 14); + this.CB_Pokemon_6_Move_1.Location = new System.Drawing.Point(241, 14); this.CB_Pokemon_6_Move_1.Name = "CB_Pokemon_6_Move_1"; this.CB_Pokemon_6_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_1.TabIndex = 27; @@ -2015,7 +2015,7 @@ private void InitializeComponent() // L_Pokemon_6_Item // this.L_Pokemon_6_Item.AutoSize = true; - this.L_Pokemon_6_Item.Location = new System.Drawing.Point(36, 98); + this.L_Pokemon_6_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_6_Item.Name = "L_Pokemon_6_Item"; this.L_Pokemon_6_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_6_Item.TabIndex = 26; @@ -2027,7 +2027,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Item.Enabled = false; this.CB_Pokemon_6_Item.FormattingEnabled = true; - this.CB_Pokemon_6_Item.Location = new System.Drawing.Point(72, 95); + this.CB_Pokemon_6_Item.Location = new System.Drawing.Point(64, 95); this.CB_Pokemon_6_Item.Name = "CB_Pokemon_6_Item"; this.CB_Pokemon_6_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Item.TabIndex = 25; @@ -2036,7 +2036,7 @@ private void InitializeComponent() // L_Pokemon_6_Level // this.L_Pokemon_6_Level.AutoSize = true; - this.L_Pokemon_6_Level.Location = new System.Drawing.Point(30, 71); + this.L_Pokemon_6_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_6_Level.Name = "L_Pokemon_6_Level"; this.L_Pokemon_6_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_6_Level.TabIndex = 24; @@ -2048,7 +2048,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Level.Enabled = false; this.CB_Pokemon_6_Level.FormattingEnabled = true; - this.CB_Pokemon_6_Level.Location = new System.Drawing.Point(72, 68); + this.CB_Pokemon_6_Level.Location = new System.Drawing.Point(64, 68); this.CB_Pokemon_6_Level.Name = "CB_Pokemon_6_Level"; this.CB_Pokemon_6_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Level.TabIndex = 23; @@ -2056,7 +2056,7 @@ private void InitializeComponent() // L_Pokemon_6_Pokemon // this.L_Pokemon_6_Pokemon.AutoSize = true; - this.L_Pokemon_6_Pokemon.Location = new System.Drawing.Point(11, 17); + this.L_Pokemon_6_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_6_Pokemon.Name = "L_Pokemon_6_Pokemon"; this.L_Pokemon_6_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_6_Pokemon.TabIndex = 22; @@ -2068,7 +2068,7 @@ private void InitializeComponent() this.CB_Pokemon_6_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Pokemon.Enabled = false; this.CB_Pokemon_6_Pokemon.FormattingEnabled = true; - this.CB_Pokemon_6_Pokemon.Location = new System.Drawing.Point(72, 14); + this.CB_Pokemon_6_Pokemon.Location = new System.Drawing.Point(64, 14); this.CB_Pokemon_6_Pokemon.Name = "CB_Pokemon_6_Pokemon"; this.CB_Pokemon_6_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Pokemon.TabIndex = 21; diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index abcfff3ab8..f0057a98cd 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -479,9 +479,9 @@ private void Setup() trpk_IV[i].Items.Add(z.ToString()); trpk_gender[i].Items.Clear(); - trpk_gender[i].Items.Add("- / G/Random"); - trpk_gender[i].Items.Add("♂ / M"); - trpk_gender[i].Items.Add("♀ / F"); + trpk_gender[i].Items.Add("- / Genderless/Random"); + trpk_gender[i].Items.Add("♂ / Male"); + trpk_gender[i].Items.Add("♀ / Female"); trpk_form[i].Items.Add(""); diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index ba2e3f7db4..7ebff012b4 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -160,7 +160,7 @@ private void InitializeComponent() // // L_Gender // - this.L_Gender.Location = new System.Drawing.Point(9, 96); + this.L_Gender.Location = new System.Drawing.Point(9, 92); this.L_Gender.Name = "L_Gender"; this.L_Gender.Size = new System.Drawing.Size(55, 23); this.L_Gender.TabIndex = 526; @@ -170,14 +170,14 @@ private void InitializeComponent() // CB_Gender // this.CB_Gender.FormattingEnabled = true; - this.CB_Gender.Location = new System.Drawing.Point(65, 97); + this.CB_Gender.Location = new System.Drawing.Point(65, 93); this.CB_Gender.Name = "CB_Gender"; - this.CB_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Gender.TabIndex = 525; // // L_Ability // - this.L_Ability.Location = new System.Drawing.Point(9, 73); + this.L_Ability.Location = new System.Drawing.Point(9, 70); this.L_Ability.Name = "L_Ability"; this.L_Ability.Size = new System.Drawing.Size(55, 23); this.L_Ability.TabIndex = 524; @@ -187,15 +187,15 @@ private void InitializeComponent() // CB_Ability // this.CB_Ability.FormattingEnabled = true; - this.CB_Ability.Location = new System.Drawing.Point(65, 74); + this.CB_Ability.Location = new System.Drawing.Point(65, 71); this.CB_Ability.Name = "CB_Ability"; - this.CB_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Ability.TabIndex = 523; // // CHK_IV3 // this.CHK_IV3.AutoSize = true; - this.CHK_IV3.Location = new System.Drawing.Point(65, 158); + this.CHK_IV3.Location = new System.Drawing.Point(65, 153); this.CHK_IV3.Name = "CHK_IV3"; this.CHK_IV3.Size = new System.Drawing.Size(42, 17); this.CHK_IV3.TabIndex = 522; @@ -205,7 +205,7 @@ private void InitializeComponent() // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 143); + this.CHK_ShinyLock.Location = new System.Drawing.Point(65, 138); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); this.CHK_ShinyLock.TabIndex = 519; @@ -217,7 +217,7 @@ private void InitializeComponent() this.CB_Species.FormattingEnabled = true; this.CB_Species.Location = new System.Drawing.Point(65, 7); this.CB_Species.Name = "CB_Species"; - this.CB_Species.Size = new System.Drawing.Size(121, 21); + this.CB_Species.Size = new System.Drawing.Size(136, 21); this.CB_Species.TabIndex = 506; this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); // @@ -232,7 +232,7 @@ private void InitializeComponent() // // L_HeldItem // - this.L_HeldItem.Location = new System.Drawing.Point(9, 119); + this.L_HeldItem.Location = new System.Drawing.Point(9, 114); this.L_HeldItem.Name = "L_HeldItem"; this.L_HeldItem.Size = new System.Drawing.Size(55, 23); this.L_HeldItem.TabIndex = 509; @@ -241,7 +241,7 @@ private void InitializeComponent() // // NUD_Level // - this.NUD_Level.Location = new System.Drawing.Point(65, 30); + this.NUD_Level.Location = new System.Drawing.Point(65, 29); this.NUD_Level.Name = "NUD_Level"; this.NUD_Level.Size = new System.Drawing.Size(41, 20); this.NUD_Level.TabIndex = 510; @@ -253,7 +253,7 @@ private void InitializeComponent() // // L_Level // - this.L_Level.Location = new System.Drawing.Point(9, 27); + this.L_Level.Location = new System.Drawing.Point(9, 26); this.L_Level.Name = "L_Level"; this.L_Level.Size = new System.Drawing.Size(55, 23); this.L_Level.TabIndex = 511; @@ -262,7 +262,7 @@ private void InitializeComponent() // // L_Form // - this.L_Form.Location = new System.Drawing.Point(9, 49); + this.L_Form.Location = new System.Drawing.Point(9, 47); this.L_Form.Name = "L_Form"; this.L_Form.Size = new System.Drawing.Size(55, 23); this.L_Form.TabIndex = 513; @@ -272,14 +272,14 @@ private void InitializeComponent() // CB_HeldItem // this.CB_HeldItem.FormattingEnabled = true; - this.CB_HeldItem.Location = new System.Drawing.Point(65, 120); + this.CB_HeldItem.Location = new System.Drawing.Point(65, 115); this.CB_HeldItem.Name = "CB_HeldItem"; - this.CB_HeldItem.Size = new System.Drawing.Size(121, 21); + this.CB_HeldItem.Size = new System.Drawing.Size(136, 21); this.CB_HeldItem.TabIndex = 507; // // NUD_Form // - this.NUD_Form.Location = new System.Drawing.Point(65, 52); + this.NUD_Form.Location = new System.Drawing.Point(65, 50); this.NUD_Form.Name = "NUD_Form"; this.NUD_Form.Size = new System.Drawing.Size(41, 20); this.NUD_Form.TabIndex = 512; @@ -300,7 +300,7 @@ private void InitializeComponent() // // B_ModifyLevel // - this.B_ModifyLevel.Location = new System.Drawing.Point(189, 5); + this.B_ModifyLevel.Location = new System.Drawing.Point(189, 16); this.B_ModifyLevel.Name = "B_ModifyLevel"; this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); this.B_ModifyLevel.TabIndex = 502; @@ -311,9 +311,9 @@ private void InitializeComponent() // GB_Tweak // this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); + this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_RandomAbility); this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock); - this.GB_Tweak.Controls.Add(this.CHK_AllowMega); this.GB_Tweak.Controls.Add(this.CHK_Item); this.GB_Tweak.Controls.Add(this.L_RandOpt); this.GB_Tweak.Controls.Add(this.CHK_BST); @@ -339,7 +339,7 @@ private void InitializeComponent() this.CHK_ReplaceLegend.AutoSize = true; this.CHK_ReplaceLegend.Checked = true; this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 141); + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 140); this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); this.CHK_ReplaceLegend.TabIndex = 304; @@ -369,7 +369,7 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 126); + this.CHK_AllowMega.Location = new System.Drawing.Point(9, 125); this.CHK_AllowMega.Name = "CHK_AllowMega"; this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); this.CHK_AllowMega.TabIndex = 296; @@ -400,7 +400,7 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(128, 65); + this.CHK_BST.Location = new System.Drawing.Point(128, 63); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 288; @@ -412,7 +412,7 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(128, 50); + this.CHK_E.Location = new System.Drawing.Point(128, 49); this.CHK_E.Name = "CHK_E"; this.CHK_E.Size = new System.Drawing.Size(98, 17); this.CHK_E.TabIndex = 287; @@ -436,7 +436,7 @@ private void InitializeComponent() this.CHK_G6.AutoSize = true; this.CHK_G6.Checked = true; this.CHK_G6.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G6.Location = new System.Drawing.Point(67, 65); + this.CHK_G6.Location = new System.Drawing.Point(67, 63); this.CHK_G6.Name = "CHK_G6"; this.CHK_G6.Size = new System.Drawing.Size(55, 17); this.CHK_G6.TabIndex = 285; @@ -448,7 +448,7 @@ private void InitializeComponent() this.CHK_G5.AutoSize = true; this.CHK_G5.Checked = true; this.CHK_G5.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G5.Location = new System.Drawing.Point(67, 50); + this.CHK_G5.Location = new System.Drawing.Point(67, 49); this.CHK_G5.Name = "CHK_G5"; this.CHK_G5.Size = new System.Drawing.Size(55, 17); this.CHK_G5.TabIndex = 284; @@ -472,7 +472,7 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(9, 65); + this.CHK_G3.Location = new System.Drawing.Point(9, 63); this.CHK_G3.Name = "CHK_G3"; this.CHK_G3.Size = new System.Drawing.Size(55, 17); this.CHK_G3.TabIndex = 282; @@ -484,7 +484,7 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(9, 50); + this.CHK_G2.Location = new System.Drawing.Point(9, 49); this.CHK_G2.Name = "CHK_G2"; this.CHK_G2.Size = new System.Drawing.Size(55, 17); this.CHK_G2.TabIndex = 281; @@ -505,7 +505,7 @@ private void InitializeComponent() // // NUD_ForceFullyEvolved // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 158); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 157); this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { 1, 0, @@ -539,7 +539,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 6); + this.NUD_LevelBoost.Location = new System.Drawing.Point(140, 17); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -559,7 +559,7 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(9, 7); + this.CHK_Level.Location = new System.Drawing.Point(9, 18); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 302; diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 71839ee6e3..8fef3b10fb 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -44,20 +44,14 @@ public StaticEncounterEditor6() private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private static int[] FinalEvo; private static int[] ReplaceLegend; - + private readonly string[] ability = { - "Random (1 or 2)", + "Any (1 or 2)", "Ability 1", "Ability 2", "Hidden Ability", }; - private readonly string[] gender = - { - "Random/Genderless", - "Male", - "Female", - }; private void B_Save_Click(object sender, EventArgs e) { saveEntry(); @@ -79,9 +73,13 @@ private void loadData() EncounterData[i] = new EncounterStatic6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray()); LB_Encounters.Items.Add($"{i:00} - {specieslist[EncounterData[i].Species]}"); } - foreach (var s in ability) CB_Ability.Items.Add(s); - foreach (var s in gender) CB_Gender.Items.Add(s); + + CB_Gender.Items.Clear(); + CB_Gender.Items.Add("- / Genderless/Random"); + CB_Gender.Items.Add("♂ / Male"); + CB_Gender.Items.Add("♀ / Female"); + FinalEvo = Legal.FinalEvolutions_6; ReplaceLegend = Legal.Legendary_Mythical_6; diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index c2021a5177..098f154805 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -137,9 +137,6 @@ private void InitializeComponent() this.CB_Move4 = new System.Windows.Forms.ComboBox(); this.CB_Move2 = new System.Windows.Forms.ComboBox(); this.CB_Move3 = new System.Windows.Forms.ComboBox(); - this.textBox3 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.textBox1 = new System.Windows.Forms.TextBox(); this.NUD_AI = new System.Windows.Forms.NumericUpDown(); this.L_TrainerName = new System.Windows.Forms.Label(); this.TB_TrainerName = new System.Windows.Forms.TextBox(); @@ -147,8 +144,7 @@ private void InitializeComponent() this.TC_trdata = new System.Windows.Forms.TabControl(); this.Tab_Trainer = new System.Windows.Forms.TabPage(); this.CHK_Flag = new System.Windows.Forms.CheckBox(); - this.Tab_Advanced = new System.Windows.Forms.TabPage(); - this.Tab_Misc = new System.Windows.Forms.TabPage(); + this.Tab_Rand = new System.Windows.Forms.TabPage(); this.TC_rand = new System.Windows.Forms.TabControl(); this.Tab_PKM1 = new System.Windows.Forms.TabPage(); this.L_ShinyPCT = new System.Windows.Forms.Label(); @@ -232,8 +228,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_NumPoke)).BeginInit(); this.TC_trdata.SuspendLayout(); this.Tab_Trainer.SuspendLayout(); - this.Tab_Advanced.SuspendLayout(); - this.Tab_Misc.SuspendLayout(); + this.Tab_Rand.SuspendLayout(); this.TC_rand.SuspendLayout(); this.Tab_PKM1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Shiny)).BeginInit(); @@ -264,7 +259,7 @@ private void InitializeComponent() // L_AI // this.L_AI.AutoSize = true; - this.L_AI.Location = new System.Drawing.Point(217, 54); + this.L_AI.Location = new System.Drawing.Point(217, 57); this.L_AI.Name = "L_AI"; this.L_AI.Size = new System.Drawing.Size(38, 13); this.L_AI.TabIndex = 55; @@ -284,7 +279,7 @@ private void InitializeComponent() this.CB_Money.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Money.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Money.FormattingEnabled = true; - this.CB_Money.Location = new System.Drawing.Point(90, 51); + this.CB_Money.Location = new System.Drawing.Point(85, 51); this.CB_Money.Name = "CB_Money"; this.CB_Money.Size = new System.Drawing.Size(70, 21); this.CB_Money.TabIndex = 52; @@ -304,15 +299,15 @@ private void InitializeComponent() this.CB_Trainer_Class.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Trainer_Class.DropDownWidth = 165; this.CB_Trainer_Class.FormattingEnabled = true; - this.CB_Trainer_Class.Location = new System.Drawing.Point(90, 29); + this.CB_Trainer_Class.Location = new System.Drawing.Point(85, 29); this.CB_Trainer_Class.Name = "CB_Trainer_Class"; - this.CB_Trainer_Class.Size = new System.Drawing.Size(161, 21); + this.CB_Trainer_Class.Size = new System.Drawing.Size(175, 21); this.CB_Trainer_Class.TabIndex = 48; // // L_Item_4 // this.L_Item_4.AutoSize = true; - this.L_Item_4.Location = new System.Drawing.Point(16, 160); + this.L_Item_4.Location = new System.Drawing.Point(6, 176); this.L_Item_4.Name = "L_Item_4"; this.L_Item_4.Size = new System.Drawing.Size(39, 13); this.L_Item_4.TabIndex = 34; @@ -323,7 +318,7 @@ private void InitializeComponent() this.CB_Item_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_4.FormattingEnabled = true; - this.CB_Item_4.Location = new System.Drawing.Point(61, 157); + this.CB_Item_4.Location = new System.Drawing.Point(51, 173); this.CB_Item_4.Name = "CB_Item_4"; this.CB_Item_4.Size = new System.Drawing.Size(99, 21); this.CB_Item_4.TabIndex = 33; @@ -331,7 +326,7 @@ private void InitializeComponent() // L_Item_3 // this.L_Item_3.AutoSize = true; - this.L_Item_3.Location = new System.Drawing.Point(16, 138); + this.L_Item_3.Location = new System.Drawing.Point(6, 154); this.L_Item_3.Name = "L_Item_3"; this.L_Item_3.Size = new System.Drawing.Size(39, 13); this.L_Item_3.TabIndex = 32; @@ -342,7 +337,7 @@ private void InitializeComponent() this.CB_Item_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_3.FormattingEnabled = true; - this.CB_Item_3.Location = new System.Drawing.Point(61, 135); + this.CB_Item_3.Location = new System.Drawing.Point(51, 151); this.CB_Item_3.Name = "CB_Item_3"; this.CB_Item_3.Size = new System.Drawing.Size(99, 21); this.CB_Item_3.TabIndex = 31; @@ -350,7 +345,7 @@ private void InitializeComponent() // L_Item_2 // this.L_Item_2.AutoSize = true; - this.L_Item_2.Location = new System.Drawing.Point(16, 116); + this.L_Item_2.Location = new System.Drawing.Point(6, 132); this.L_Item_2.Name = "L_Item_2"; this.L_Item_2.Size = new System.Drawing.Size(39, 13); this.L_Item_2.TabIndex = 30; @@ -361,7 +356,7 @@ private void InitializeComponent() this.CB_Item_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_2.FormattingEnabled = true; - this.CB_Item_2.Location = new System.Drawing.Point(61, 113); + this.CB_Item_2.Location = new System.Drawing.Point(51, 129); this.CB_Item_2.Name = "CB_Item_2"; this.CB_Item_2.Size = new System.Drawing.Size(99, 21); this.CB_Item_2.TabIndex = 29; @@ -369,7 +364,7 @@ private void InitializeComponent() // L_Item_1 // this.L_Item_1.AutoSize = true; - this.L_Item_1.Location = new System.Drawing.Point(16, 94); + this.L_Item_1.Location = new System.Drawing.Point(6, 110); this.L_Item_1.Name = "L_Item_1"; this.L_Item_1.Size = new System.Drawing.Size(39, 13); this.L_Item_1.TabIndex = 28; @@ -380,7 +375,7 @@ private void InitializeComponent() this.CB_Item_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_1.FormattingEnabled = true; - this.CB_Item_1.Location = new System.Drawing.Point(61, 91); + this.CB_Item_1.Location = new System.Drawing.Point(51, 107); this.CB_Item_1.Name = "CB_Item_1"; this.CB_Item_1.Size = new System.Drawing.Size(99, 21); this.CB_Item_1.TabIndex = 27; @@ -388,7 +383,7 @@ private void InitializeComponent() // L_numPokemon // this.L_numPokemon.AutoSize = true; - this.L_numPokemon.Location = new System.Drawing.Point(215, 11); + this.L_numPokemon.Location = new System.Drawing.Point(42, 75); this.L_numPokemon.Name = "L_numPokemon"; this.L_numPokemon.Size = new System.Drawing.Size(40, 13); this.L_numPokemon.TabIndex = 22; @@ -565,7 +560,7 @@ private void InitializeComponent() // this.L_Species.Location = new System.Drawing.Point(3, 0); this.L_Species.Name = "L_Species"; - this.L_Species.Size = new System.Drawing.Size(70, 21); + this.L_Species.Size = new System.Drawing.Size(55, 21); this.L_Species.TabIndex = 0; this.L_Species.Text = "Species:"; this.L_Species.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -575,10 +570,10 @@ private void InitializeComponent() this.CB_Species.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Species.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Species.FormattingEnabled = true; - this.CB_Species.Location = new System.Drawing.Point(76, 0); + this.CB_Species.Location = new System.Drawing.Point(61, 0); this.CB_Species.Margin = new System.Windows.Forms.Padding(0); this.CB_Species.Name = "CB_Species"; - this.CB_Species.Size = new System.Drawing.Size(121, 21); + this.CB_Species.Size = new System.Drawing.Size(136, 21); this.CB_Species.TabIndex = 1; this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.RefreshSpeciesAbility); // @@ -598,7 +593,7 @@ private void InitializeComponent() // this.L_Forme.Location = new System.Drawing.Point(3, 0); this.L_Forme.Name = "L_Forme"; - this.L_Forme.Size = new System.Drawing.Size(70, 21); + this.L_Forme.Size = new System.Drawing.Size(55, 21); this.L_Forme.TabIndex = 0; this.L_Forme.Text = "Form:"; this.L_Forme.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -608,10 +603,10 @@ private void InitializeComponent() this.CB_Forme.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Forme.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Forme.FormattingEnabled = true; - this.CB_Forme.Location = new System.Drawing.Point(76, 0); + this.CB_Forme.Location = new System.Drawing.Point(61, 0); this.CB_Forme.Margin = new System.Windows.Forms.Padding(0); this.CB_Forme.Name = "CB_Forme"; - this.CB_Forme.Size = new System.Drawing.Size(121, 21); + this.CB_Forme.Size = new System.Drawing.Size(136, 21); this.CB_Forme.TabIndex = 1; this.CB_Forme.SelectedIndexChanged += new System.EventHandler(this.RefreshFormAbility); // @@ -631,14 +626,14 @@ private void InitializeComponent() // this.L_Level.Location = new System.Drawing.Point(3, 0); this.L_Level.Name = "L_Level"; - this.L_Level.Size = new System.Drawing.Size(70, 21); + this.L_Level.Size = new System.Drawing.Size(55, 21); this.L_Level.TabIndex = 0; this.L_Level.Text = "Level:"; this.L_Level.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Level // - this.NUD_Level.Location = new System.Drawing.Point(76, 0); + this.NUD_Level.Location = new System.Drawing.Point(61, 0); this.NUD_Level.Margin = new System.Windows.Forms.Padding(0); this.NUD_Level.Name = "NUD_Level"; this.NUD_Level.Size = new System.Drawing.Size(56, 20); @@ -661,7 +656,7 @@ private void InitializeComponent() // this.L_Ability.Location = new System.Drawing.Point(3, 0); this.L_Ability.Name = "L_Ability"; - this.L_Ability.Size = new System.Drawing.Size(70, 21); + this.L_Ability.Size = new System.Drawing.Size(55, 21); this.L_Ability.TabIndex = 0; this.L_Ability.Text = "Ability:"; this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -671,10 +666,10 @@ private void InitializeComponent() this.CB_Ability.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Ability.FormattingEnabled = true; - this.CB_Ability.Location = new System.Drawing.Point(76, 0); + this.CB_Ability.Location = new System.Drawing.Point(61, 0); this.CB_Ability.Margin = new System.Windows.Forms.Padding(0); this.CB_Ability.Name = "CB_Ability"; - this.CB_Ability.Size = new System.Drawing.Size(121, 21); + this.CB_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Ability.TabIndex = 2; // // flowLayoutPanel1 @@ -693,7 +688,7 @@ private void InitializeComponent() // this.L_Item.Location = new System.Drawing.Point(3, 0); this.L_Item.Name = "L_Item"; - this.L_Item.Size = new System.Drawing.Size(70, 21); + this.L_Item.Size = new System.Drawing.Size(55, 21); this.L_Item.TabIndex = 0; this.L_Item.Text = "Held Item:"; this.L_Item.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -703,10 +698,10 @@ private void InitializeComponent() this.CB_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item.FormattingEnabled = true; - this.CB_Item.Location = new System.Drawing.Point(76, 0); + this.CB_Item.Location = new System.Drawing.Point(61, 0); this.CB_Item.Margin = new System.Windows.Forms.Padding(0); this.CB_Item.Name = "CB_Item"; - this.CB_Item.Size = new System.Drawing.Size(121, 21); + this.CB_Item.Size = new System.Drawing.Size(136, 21); this.CB_Item.TabIndex = 2; // // flowLayoutPanel5 @@ -725,7 +720,7 @@ private void InitializeComponent() // this.L_Nature.Location = new System.Drawing.Point(3, 0); this.L_Nature.Name = "L_Nature"; - this.L_Nature.Size = new System.Drawing.Size(70, 21); + this.L_Nature.Size = new System.Drawing.Size(55, 21); this.L_Nature.TabIndex = 0; this.L_Nature.Text = "Nature:"; this.L_Nature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -735,10 +730,10 @@ private void InitializeComponent() this.CB_Nature.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Nature.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Nature.FormattingEnabled = true; - this.CB_Nature.Location = new System.Drawing.Point(76, 0); + this.CB_Nature.Location = new System.Drawing.Point(61, 0); this.CB_Nature.Margin = new System.Windows.Forms.Padding(0); this.CB_Nature.Name = "CB_Nature"; - this.CB_Nature.Size = new System.Drawing.Size(121, 21); + this.CB_Nature.Size = new System.Drawing.Size(136, 21); this.CB_Nature.TabIndex = 2; this.CB_Nature.SelectedIndexChanged += new System.EventHandler(this.UpdateStats); // @@ -758,7 +753,7 @@ private void InitializeComponent() // this.L_Misc.Location = new System.Drawing.Point(3, 0); this.L_Misc.Name = "L_Misc"; - this.L_Misc.Size = new System.Drawing.Size(70, 21); + this.L_Misc.Size = new System.Drawing.Size(55, 21); this.L_Misc.TabIndex = 0; this.L_Misc.Text = "Misc:"; this.L_Misc.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -766,7 +761,7 @@ private void InitializeComponent() // CHK_Shiny // this.CHK_Shiny.AutoSize = true; - this.CHK_Shiny.Location = new System.Drawing.Point(79, 3); + this.CHK_Shiny.Location = new System.Drawing.Point(64, 3); this.CHK_Shiny.Name = "CHK_Shiny"; this.CHK_Shiny.Size = new System.Drawing.Size(52, 17); this.CHK_Shiny.TabIndex = 1; @@ -789,7 +784,7 @@ private void InitializeComponent() // this.L_Gender.Location = new System.Drawing.Point(3, 0); this.L_Gender.Name = "L_Gender"; - this.L_Gender.Size = new System.Drawing.Size(70, 21); + this.L_Gender.Size = new System.Drawing.Size(55, 21); this.L_Gender.TabIndex = 0; this.L_Gender.Text = "Gender:"; this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -799,10 +794,10 @@ private void InitializeComponent() this.CB_Gender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Gender.FormattingEnabled = true; - this.CB_Gender.Location = new System.Drawing.Point(76, 0); + this.CB_Gender.Location = new System.Drawing.Point(61, 0); this.CB_Gender.Margin = new System.Windows.Forms.Padding(0); this.CB_Gender.Name = "CB_Gender"; - this.CB_Gender.Size = new System.Drawing.Size(121, 21); + this.CB_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Gender.TabIndex = 3; // // Tab_Stats @@ -1425,34 +1420,10 @@ private void InitializeComponent() this.CB_Move3.Size = new System.Drawing.Size(121, 21); this.CB_Move3.TabIndex = 2; // - // textBox3 - // - this.textBox3.Enabled = false; - this.textBox3.Location = new System.Drawing.Point(53, 66); - this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(255, 20); - this.textBox3.TabIndex = 453; - // - // textBox2 - // - this.textBox2.Enabled = false; - this.textBox2.Location = new System.Drawing.Point(53, 46); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(255, 20); - this.textBox2.TabIndex = 452; - // - // textBox1 - // - this.textBox1.Enabled = false; - this.textBox1.Location = new System.Drawing.Point(53, 26); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(255, 20); - this.textBox1.TabIndex = 451; - // // NUD_AI // this.NUD_AI.Hexadecimal = true; - this.NUD_AI.Location = new System.Drawing.Point(261, 52); + this.NUD_AI.Location = new System.Drawing.Point(261, 55); this.NUD_AI.Maximum = new decimal(new int[] { 255, 0, @@ -1473,16 +1444,16 @@ private void InitializeComponent() // // TB_TrainerName // - this.TB_TrainerName.Location = new System.Drawing.Point(90, 8); + this.TB_TrainerName.Location = new System.Drawing.Point(85, 8); this.TB_TrainerName.MaxLength = 50; this.TB_TrainerName.Name = "TB_TrainerName"; - this.TB_TrainerName.Size = new System.Drawing.Size(116, 20); + this.TB_TrainerName.Size = new System.Drawing.Size(175, 20); this.TB_TrainerName.TabIndex = 35; this.TB_TrainerName.TextChanged += new System.EventHandler(this.UpdateTrainerName); // // NUD_NumPoke // - this.NUD_NumPoke.Location = new System.Drawing.Point(261, 9); + this.NUD_NumPoke.Location = new System.Drawing.Point(85, 73); this.NUD_NumPoke.Maximum = new decimal(new int[] { 6, 0, @@ -1497,8 +1468,7 @@ private void InitializeComponent() // TC_trdata // this.TC_trdata.Controls.Add(this.Tab_Trainer); - this.TC_trdata.Controls.Add(this.Tab_Advanced); - this.TC_trdata.Controls.Add(this.Tab_Misc); + this.TC_trdata.Controls.Add(this.Tab_Rand); this.TC_trdata.Location = new System.Drawing.Point(250, 13); this.TC_trdata.Name = "TC_trdata"; this.TC_trdata.SelectedIndex = 0; @@ -1537,37 +1507,24 @@ private void InitializeComponent() // CHK_Flag // this.CHK_Flag.AutoSize = true; - this.CHK_Flag.Location = new System.Drawing.Point(166, 53); + this.CHK_Flag.Location = new System.Drawing.Point(158, 54); this.CHK_Flag.Name = "CHK_Flag"; this.CHK_Flag.Size = new System.Drawing.Size(46, 17); this.CHK_Flag.TabIndex = 451; this.CHK_Flag.Text = "Flag"; this.CHK_Flag.UseVisualStyleBackColor = true; // - // Tab_Advanced - // - this.Tab_Advanced.Controls.Add(this.textBox3); - this.Tab_Advanced.Controls.Add(this.textBox1); - this.Tab_Advanced.Controls.Add(this.textBox2); - this.Tab_Advanced.Location = new System.Drawing.Point(4, 22); - this.Tab_Advanced.Name = "Tab_Advanced"; - this.Tab_Advanced.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Advanced.Size = new System.Drawing.Size(314, 199); - this.Tab_Advanced.TabIndex = 1; - this.Tab_Advanced.Text = "Advanced"; - this.Tab_Advanced.UseVisualStyleBackColor = true; - // - // Tab_Misc - // - this.Tab_Misc.Controls.Add(this.TC_rand); - this.Tab_Misc.Controls.Add(this.B_Randomize); - this.Tab_Misc.Controls.Add(this.B_Dump); - this.Tab_Misc.Location = new System.Drawing.Point(4, 22); - this.Tab_Misc.Name = "Tab_Misc"; - this.Tab_Misc.Size = new System.Drawing.Size(314, 199); - this.Tab_Misc.TabIndex = 2; - this.Tab_Misc.Text = "Misc/Rand"; - this.Tab_Misc.UseVisualStyleBackColor = true; + // Tab_Rand + // + this.Tab_Rand.Controls.Add(this.TC_rand); + this.Tab_Rand.Controls.Add(this.B_Randomize); + this.Tab_Rand.Controls.Add(this.B_Dump); + this.Tab_Rand.Location = new System.Drawing.Point(4, 22); + this.Tab_Rand.Name = "Tab_Rand"; + this.Tab_Rand.Size = new System.Drawing.Size(314, 199); + this.Tab_Rand.TabIndex = 2; + this.Tab_Rand.Text = "Randomizer Options"; + this.Tab_Rand.UseVisualStyleBackColor = true; // // TC_rand // @@ -1609,7 +1566,7 @@ private void InitializeComponent() // L_ShinyPCT // this.L_ShinyPCT.AutoSize = true; - this.L_ShinyPCT.Location = new System.Drawing.Point(276, 57); + this.L_ShinyPCT.Location = new System.Drawing.Point(276, 60); this.L_ShinyPCT.Name = "L_ShinyPCT"; this.L_ShinyPCT.Size = new System.Drawing.Size(15, 13); this.L_ShinyPCT.TabIndex = 305; @@ -1617,7 +1574,7 @@ private void InitializeComponent() // // NUD_Shiny // - this.NUD_Shiny.Location = new System.Drawing.Point(232, 53); + this.NUD_Shiny.Location = new System.Drawing.Point(232, 56); this.NUD_Shiny.Name = "NUD_Shiny"; this.NUD_Shiny.Size = new System.Drawing.Size(43, 20); this.NUD_Shiny.TabIndex = 304; @@ -1632,7 +1589,7 @@ private void InitializeComponent() this.CHK_RandomShiny.AutoSize = true; this.CHK_RandomShiny.Checked = true; this.CHK_RandomShiny.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomShiny.Location = new System.Drawing.Point(100, 54); + this.CHK_RandomShiny.Location = new System.Drawing.Point(100, 58); this.CHK_RandomShiny.Name = "CHK_RandomShiny"; this.CHK_RandomShiny.Size = new System.Drawing.Size(103, 17); this.CHK_RandomShiny.TabIndex = 303; @@ -1855,7 +1812,7 @@ private void InitializeComponent() 0, 0}); this.NUD_ForceHighPower.Name = "NUD_ForceHighPower"; - this.NUD_ForceHighPower.Size = new System.Drawing.Size(35, 20); + this.NUD_ForceHighPower.Size = new System.Drawing.Size(40, 20); this.NUD_ForceHighPower.TabIndex = 341; this.NUD_ForceHighPower.Value = new decimal(new int[] { 50, @@ -1881,7 +1838,7 @@ private void InitializeComponent() this.CHK_BeneficialEVs.AutoSize = true; this.CHK_BeneficialEVs.Checked = true; this.CHK_BeneficialEVs.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BeneficialEVs.Location = new System.Drawing.Point(201, 118); + this.CHK_BeneficialEVs.Location = new System.Drawing.Point(201, 120); this.CHK_BeneficialEVs.Name = "CHK_BeneficialEVs"; this.CHK_BeneficialEVs.Size = new System.Drawing.Size(75, 17); this.CHK_BeneficialEVs.TabIndex = 339; @@ -1920,7 +1877,7 @@ private void InitializeComponent() this.CHK_MaxDiffPKM.AutoSize = true; this.CHK_MaxDiffPKM.Checked = true; this.CHK_MaxDiffPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(201, 102); + this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(201, 106); this.CHK_MaxDiffPKM.Name = "CHK_MaxDiffPKM"; this.CHK_MaxDiffPKM.Size = new System.Drawing.Size(64, 17); this.CHK_MaxDiffPKM.TabIndex = 332; @@ -1951,7 +1908,7 @@ private void InitializeComponent() this.CHK_RandomAbilities.AutoSize = true; this.CHK_RandomAbilities.Checked = true; this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 118); + this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 120); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; this.CHK_RandomAbilities.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbilities.TabIndex = 331; @@ -1996,7 +1953,7 @@ private void InitializeComponent() this.CHK_RandomItems.AutoSize = true; this.CHK_RandomItems.Checked = true; this.CHK_RandomItems.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomItems.Location = new System.Drawing.Point(6, 102); + this.CHK_RandomItems.Location = new System.Drawing.Point(6, 106); this.CHK_RandomItems.Name = "CHK_RandomItems"; this.CHK_RandomItems.Size = new System.Drawing.Size(119, 17); this.CHK_RandomItems.TabIndex = 330; @@ -2023,7 +1980,6 @@ private void InitializeComponent() this.Tab_Trainer1.Controls.Add(this.CHK_ReplaceLegend); this.Tab_Trainer1.Controls.Add(this.CHK_6PKM); this.Tab_Trainer1.Controls.Add(this.NUD_ForceFullyEvolved); - this.Tab_Trainer1.Controls.Add(this.CHK_ForceFullyEvolved); this.Tab_Trainer1.Controls.Add(this.L_MinPKM); this.Tab_Trainer1.Controls.Add(this.L_MaxPKM); this.Tab_Trainer1.Controls.Add(this.NUD_RMin); @@ -2032,6 +1988,7 @@ private void InitializeComponent() this.Tab_Trainer1.Controls.Add(this.CHK_TypeTheme); this.Tab_Trainer1.Controls.Add(this.CHK_IgnoreSpecialClass); this.Tab_Trainer1.Controls.Add(this.CHK_RandomClass); + this.Tab_Trainer1.Controls.Add(this.CHK_ForceFullyEvolved); this.Tab_Trainer1.Location = new System.Drawing.Point(4, 22); this.Tab_Trainer1.Name = "Tab_Trainer1"; this.Tab_Trainer1.Size = new System.Drawing.Size(300, 137); @@ -2058,7 +2015,7 @@ private void InitializeComponent() this.CHK_ReplaceLegend.AutoSize = true; this.CHK_ReplaceLegend.Checked = true; this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 47); + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 44); this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; this.CHK_ReplaceLegend.Size = new System.Drawing.Size(257, 17); this.CHK_ReplaceLegend.TabIndex = 342; @@ -2069,7 +2026,7 @@ private void InitializeComponent() // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(6, 106); + this.CHK_6PKM.Location = new System.Drawing.Point(6, 107); this.CHK_6PKM.Name = "CHK_6PKM"; this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 341; @@ -2078,7 +2035,7 @@ private void InitializeComponent() // // NUD_ForceFullyEvolved // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 73); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 77); this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { 1, 0, @@ -2097,7 +2054,7 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 75); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 79); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); this.CHK_ForceFullyEvolved.TabIndex = 339; @@ -2115,7 +2072,7 @@ private void InitializeComponent() // // L_MaxPKM // - this.L_MaxPKM.Location = new System.Drawing.Point(191, 22); + this.L_MaxPKM.Location = new System.Drawing.Point(191, 21); this.L_MaxPKM.Name = "L_MaxPKM"; this.L_MaxPKM.Size = new System.Drawing.Size(60, 20); this.L_MaxPKM.TabIndex = 337; @@ -2146,7 +2103,7 @@ private void InitializeComponent() // // NUD_RMax // - this.NUD_RMax.Location = new System.Drawing.Point(257, 24); + this.NUD_RMax.Location = new System.Drawing.Point(257, 23); this.NUD_RMax.Maximum = new decimal(new int[] { 6, 0, @@ -2170,7 +2127,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 91); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 93); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 333; @@ -2183,7 +2140,7 @@ private void InitializeComponent() this.CHK_TypeTheme.AutoSize = true; this.CHK_TypeTheme.Checked = true; this.CHK_TypeTheme.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 32); + this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 30); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); this.CHK_TypeTheme.TabIndex = 329; @@ -2196,7 +2153,7 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass.AutoSize = true; this.CHK_IgnoreSpecialClass.Checked = true; this.CHK_IgnoreSpecialClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(6, 17); + this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(6, 16); this.CHK_IgnoreSpecialClass.Name = "CHK_IgnoreSpecialClass"; this.CHK_IgnoreSpecialClass.Size = new System.Drawing.Size(133, 17); this.CHK_IgnoreSpecialClass.TabIndex = 327; @@ -2280,9 +2237,7 @@ private void InitializeComponent() this.TC_trdata.ResumeLayout(false); this.Tab_Trainer.ResumeLayout(false); this.Tab_Trainer.PerformLayout(); - this.Tab_Advanced.ResumeLayout(false); - this.Tab_Advanced.PerformLayout(); - this.Tab_Misc.ResumeLayout(false); + this.Tab_Rand.ResumeLayout(false); this.TC_rand.ResumeLayout(false); this.Tab_PKM1.ResumeLayout(false); this.Tab_PKM1.PerformLayout(); @@ -2364,9 +2319,6 @@ private void InitializeComponent() private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel7; private System.Windows.Forms.Label L_Gender; private System.Windows.Forms.ComboBox CB_Gender; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.FlowLayoutPanel FLP_Stats; private System.Windows.Forms.FlowLayoutPanel FLP_StatHeader; private System.Windows.Forms.FlowLayoutPanel FLP_StatsHeaderRight; @@ -2420,8 +2372,7 @@ private void InitializeComponent() private System.Windows.Forms.Button B_Clear; private System.Windows.Forms.TabControl TC_trdata; private System.Windows.Forms.TabPage Tab_Trainer; - private System.Windows.Forms.TabPage Tab_Advanced; - private System.Windows.Forms.TabPage Tab_Misc; + private System.Windows.Forms.TabPage Tab_Rand; private System.Windows.Forms.CheckBox CHK_RandomClass; private System.Windows.Forms.CheckBox CHK_IgnoreSpecialClass; private System.Windows.Forms.CheckBox CHK_TypeTheme; diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 28c74d141c..660ed63fec 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -65,7 +65,7 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; ReplaceLegend = Legal.Legendary_Mythical_USUM; - RandSettings.GetFormSettings(this, Tab_Misc.Controls); + RandSettings.GetFormSettings(this, Tab_Rand.Controls); } private int GetSlot(object sender) @@ -242,9 +242,9 @@ private void Setup() CB_Item.Items.Add(s); CB_Gender.Items.Clear(); - CB_Gender.Items.Add("- / G/Random"); - CB_Gender.Items.Add("♂ / M"); - CB_Gender.Items.Add("♀ / F"); + CB_Gender.Items.Add("- / Genderless/Random"); + CB_Gender.Items.Add("♂ / Male"); + CB_Gender.Items.Add("♀ / Female"); CB_Forme.Items.Add(""); @@ -411,7 +411,7 @@ protected override void OnFormClosing(FormClosingEventArgs e) if (TrainerNames.Modified) Main.Config.setText(TextName.TrainerNames, TrainerNames.Lines); base.OnFormClosing(e); - RandSettings.SetFormSettings(this, Tab_Misc.Controls); + RandSettings.SetFormSettings(this, Tab_Rand.Controls); } // Dumping @@ -587,7 +587,7 @@ public static int[] SetHPIVs(int type, int[] ivs) private void B_Randomize_Click(object sender, EventArgs e) { - if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Misc/Rand tab.") != DialogResult.Yes) return; + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Randomizer Options tab.") != DialogResult.Yes) return; CB_TrainerID.SelectedIndex = 0; var rnd = new SpeciesRandomizer(Main.Config) @@ -730,7 +730,7 @@ private void B_Randomize_Click(object sender, EventArgs e) case 2: // Current LevelUp pk.Moves = learn.GetCurrentMoves(pk.Species, pk.Form, pk.Level, 4); break; - case 3: + case 3: // Metronome pk.Moves = new[] { 118, 0, 0, 0 }; break; } diff --git a/pk3DS/Subforms/Gen7/SMTE.resx b/pk3DS/Subforms/Gen7/SMTE.resx index 0161958b99..b4ae0e8f06 100644 --- a/pk3DS/Subforms/Gen7/SMTE.resx +++ b/pk3DS/Subforms/Gen7/SMTE.resx @@ -117,262 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True - 17, 17 - - 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 - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index b3219a5a34..f496330f98 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -49,8 +49,12 @@ private void InitializeComponent() this.NUD_GLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); + this.CB_EGender = new System.Windows.Forms.ComboBox(); + this.L_Ally1 = new System.Windows.Forms.Label(); + this.NUD_Ally1 = new System.Windows.Forms.NumericUpDown(); + this.L_Ally2 = new System.Windows.Forms.Label(); + this.NUD_Ally2 = new System.Windows.Forms.NumericUpDown(); this.L_EGender = new System.Windows.Forms.Label(); - this.NUD_EGender = new System.Windows.Forms.NumericUpDown(); this.CB_EAbility = new System.Windows.Forms.ComboBox(); this.L_EAbility = new System.Windows.Forms.Label(); this.CHK_EIV3 = new System.Windows.Forms.CheckBox(); @@ -99,9 +103,11 @@ private void InitializeComponent() this.L_ESpecies = new System.Windows.Forms.Label(); this.NUD_ELevel = new System.Windows.Forms.NumericUpDown(); this.LB_Encounter = new System.Windows.Forms.ListBox(); + this.label15 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); this.Tab_Trades = new System.Windows.Forms.TabPage(); + this.CB_TGender = new System.Windows.Forms.ComboBox(); this.L_TGender = new System.Windows.Forms.Label(); - this.NUD_TGender = new System.Windows.Forms.NumericUpDown(); this.CB_TAbility = new System.Windows.Forms.ComboBox(); this.L_TAbility = new System.Windows.Forms.Label(); this.CB_TNature = new System.Windows.Forms.ComboBox(); @@ -135,6 +141,7 @@ private void InitializeComponent() this.LB_Trade = new System.Windows.Forms.ListBox(); this.Tab_Randomizer = new System.Windows.Forms.TabPage(); this.GB_Tweak = new System.Windows.Forms.GroupBox(); + this.CHK_Metronome = new System.Windows.Forms.CheckBox(); this.CHK_RemoveShinyLock = new System.Windows.Forms.CheckBox(); this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); this.CHK_ForceTotem = new System.Windows.Forms.CheckBox(); @@ -164,13 +171,13 @@ private void InitializeComponent() this.B_Starters = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); - this.CHK_Metronome = new System.Windows.Forms.CheckBox(); this.TC_Tabs.SuspendLayout(); this.Tab_Gifts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).BeginInit(); this.Tab_Encounters.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Ally1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Ally2)).BeginInit(); this.GB_EEVs.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).BeginInit(); @@ -189,7 +196,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).BeginInit(); this.Tab_Trades.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).BeginInit(); @@ -216,10 +222,10 @@ private void InitializeComponent() this.TC_Tabs.Controls.Add(this.Tab_Encounters); this.TC_Tabs.Controls.Add(this.Tab_Trades); this.TC_Tabs.Controls.Add(this.Tab_Randomizer); - this.TC_Tabs.Location = new System.Drawing.Point(12, 12); + this.TC_Tabs.Location = new System.Drawing.Point(12, 11); this.TC_Tabs.Name = "TC_Tabs"; this.TC_Tabs.SelectedIndex = 0; - this.TC_Tabs.Size = new System.Drawing.Size(506, 502); + this.TC_Tabs.Size = new System.Drawing.Size(506, 538); this.TC_Tabs.TabIndex = 0; // // Tab_Gifts @@ -244,7 +250,7 @@ private void InitializeComponent() this.Tab_Gifts.Controls.Add(this.LB_Gift); this.Tab_Gifts.Location = new System.Drawing.Point(4, 22); this.Tab_Gifts.Name = "Tab_Gifts"; - this.Tab_Gifts.Size = new System.Drawing.Size(498, 476); + this.Tab_Gifts.Size = new System.Drawing.Size(498, 512); this.Tab_Gifts.TabIndex = 2; this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; @@ -252,14 +258,14 @@ private void InitializeComponent() // CB_GAbility // this.CB_GAbility.FormattingEnabled = true; - this.CB_GAbility.Location = new System.Drawing.Point(187, 74); + this.CB_GAbility.Location = new System.Drawing.Point(187, 71); this.CB_GAbility.Name = "CB_GAbility"; - this.CB_GAbility.Size = new System.Drawing.Size(121, 21); + this.CB_GAbility.Size = new System.Drawing.Size(136, 21); this.CB_GAbility.TabIndex = 513; // // L_GAbility // - this.L_GAbility.Location = new System.Drawing.Point(131, 72); + this.L_GAbility.Location = new System.Drawing.Point(131, 69); this.L_GAbility.Name = "L_GAbility"; this.L_GAbility.Size = new System.Drawing.Size(55, 23); this.L_GAbility.TabIndex = 512; @@ -269,14 +275,14 @@ private void InitializeComponent() // CB_GNature // this.CB_GNature.FormattingEnabled = true; - this.CB_GNature.Location = new System.Drawing.Point(187, 120); + this.CB_GNature.Location = new System.Drawing.Point(187, 115); this.CB_GNature.Name = "CB_GNature"; - this.CB_GNature.Size = new System.Drawing.Size(121, 21); + this.CB_GNature.Size = new System.Drawing.Size(136, 21); this.CB_GNature.TabIndex = 511; // // L_GNature // - this.L_GNature.Location = new System.Drawing.Point(131, 118); + this.L_GNature.Location = new System.Drawing.Point(131, 113); this.L_GNature.Name = "L_GNature"; this.L_GNature.Size = new System.Drawing.Size(55, 23); this.L_GNature.TabIndex = 510; @@ -286,7 +292,7 @@ private void InitializeComponent() // CHK_IsEgg // this.CHK_IsEgg.AutoSize = true; - this.CHK_IsEgg.Location = new System.Drawing.Point(187, 198); + this.CHK_IsEgg.Location = new System.Drawing.Point(187, 193); this.CHK_IsEgg.Name = "CHK_IsEgg"; this.CHK_IsEgg.Size = new System.Drawing.Size(56, 17); this.CHK_IsEgg.TabIndex = 509; @@ -296,7 +302,7 @@ private void InitializeComponent() // CHK_GIV3 // this.CHK_GIV3.AutoSize = true; - this.CHK_GIV3.Location = new System.Drawing.Point(187, 183); + this.CHK_GIV3.Location = new System.Drawing.Point(187, 178); this.CHK_GIV3.Name = "CHK_GIV3"; this.CHK_GIV3.Size = new System.Drawing.Size(42, 17); this.CHK_GIV3.TabIndex = 508; @@ -306,14 +312,14 @@ private void InitializeComponent() // CB_SpecialMove // this.CB_SpecialMove.FormattingEnabled = true; - this.CB_SpecialMove.Location = new System.Drawing.Point(187, 143); + this.CB_SpecialMove.Location = new System.Drawing.Point(187, 137); this.CB_SpecialMove.Name = "CB_SpecialMove"; - this.CB_SpecialMove.Size = new System.Drawing.Size(121, 21); + this.CB_SpecialMove.Size = new System.Drawing.Size(136, 21); this.CB_SpecialMove.TabIndex = 507; // // L_SpecialMove // - this.L_SpecialMove.Location = new System.Drawing.Point(121, 141); + this.L_SpecialMove.Location = new System.Drawing.Point(121, 135); this.L_SpecialMove.Name = "L_SpecialMove"; this.L_SpecialMove.Size = new System.Drawing.Size(65, 23); this.L_SpecialMove.TabIndex = 506; @@ -323,7 +329,7 @@ private void InitializeComponent() // CHK_G_Lock // this.CHK_G_Lock.AutoSize = true; - this.CHK_G_Lock.Location = new System.Drawing.Point(187, 168); + this.CHK_G_Lock.Location = new System.Drawing.Point(187, 163); this.CHK_G_Lock.Name = "CHK_G_Lock"; this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); this.CHK_G_Lock.TabIndex = 19; @@ -333,14 +339,14 @@ private void InitializeComponent() // CB_GHeldItem // this.CB_GHeldItem.FormattingEnabled = true; - this.CB_GHeldItem.Location = new System.Drawing.Point(187, 97); + this.CB_GHeldItem.Location = new System.Drawing.Point(187, 93); this.CB_GHeldItem.Name = "CB_GHeldItem"; - this.CB_GHeldItem.Size = new System.Drawing.Size(121, 21); + this.CB_GHeldItem.Size = new System.Drawing.Size(136, 21); this.CB_GHeldItem.TabIndex = 8; // // L_GHeldItem // - this.L_GHeldItem.Location = new System.Drawing.Point(131, 95); + this.L_GHeldItem.Location = new System.Drawing.Point(131, 91); this.L_GHeldItem.Name = "L_GHeldItem"; this.L_GHeldItem.Size = new System.Drawing.Size(55, 23); this.L_GHeldItem.TabIndex = 7; @@ -352,13 +358,13 @@ private void InitializeComponent() this.CB_GSpecies.FormattingEnabled = true; this.CB_GSpecies.Location = new System.Drawing.Point(187, 7); this.CB_GSpecies.Name = "CB_GSpecies"; - this.CB_GSpecies.Size = new System.Drawing.Size(121, 21); + this.CB_GSpecies.Size = new System.Drawing.Size(136, 21); this.CB_GSpecies.TabIndex = 6; this.CB_GSpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); // // L_GForm // - this.L_GForm.Location = new System.Drawing.Point(131, 49); + this.L_GForm.Location = new System.Drawing.Point(131, 47); this.L_GForm.Name = "L_GForm"; this.L_GForm.Size = new System.Drawing.Size(55, 23); this.L_GForm.TabIndex = 5; @@ -367,7 +373,7 @@ private void InitializeComponent() // // NUD_GForm // - this.NUD_GForm.Location = new System.Drawing.Point(187, 52); + this.NUD_GForm.Location = new System.Drawing.Point(187, 50); this.NUD_GForm.Maximum = new decimal(new int[] { 255, 0, @@ -384,7 +390,7 @@ private void InitializeComponent() // // L_GLevel // - this.L_GLevel.Location = new System.Drawing.Point(131, 27); + this.L_GLevel.Location = new System.Drawing.Point(131, 26); this.L_GLevel.Name = "L_GLevel"; this.L_GLevel.Size = new System.Drawing.Size(55, 23); this.L_GLevel.TabIndex = 3; @@ -402,7 +408,7 @@ private void InitializeComponent() // // NUD_GLevel // - this.NUD_GLevel.Location = new System.Drawing.Point(187, 30); + this.NUD_GLevel.Location = new System.Drawing.Point(187, 29); this.NUD_GLevel.Name = "NUD_GLevel"; this.NUD_GLevel.Size = new System.Drawing.Size(48, 20); this.NUD_GLevel.TabIndex = 1; @@ -419,14 +425,18 @@ private void InitializeComponent() this.LB_Gift.FormattingEnabled = true; this.LB_Gift.Location = new System.Drawing.Point(3, 3); this.LB_Gift.Name = "LB_Gift"; - this.LB_Gift.Size = new System.Drawing.Size(115, 472); + this.LB_Gift.Size = new System.Drawing.Size(115, 498); this.LB_Gift.TabIndex = 0; this.LB_Gift.SelectedIndexChanged += new System.EventHandler(this.LB_Gift_SelectedIndexChanged); // // Tab_Encounters // + this.Tab_Encounters.Controls.Add(this.CB_EGender); + this.Tab_Encounters.Controls.Add(this.L_Ally1); + this.Tab_Encounters.Controls.Add(this.NUD_Ally1); + this.Tab_Encounters.Controls.Add(this.L_Ally2); + this.Tab_Encounters.Controls.Add(this.NUD_Ally2); this.Tab_Encounters.Controls.Add(this.L_EGender); - this.Tab_Encounters.Controls.Add(this.NUD_EGender); this.Tab_Encounters.Controls.Add(this.CB_EAbility); this.Tab_Encounters.Controls.Add(this.L_EAbility); this.Tab_Encounters.Controls.Add(this.CHK_EIV3); @@ -447,46 +457,96 @@ private void InitializeComponent() this.Tab_Encounters.Controls.Add(this.L_ESpecies); this.Tab_Encounters.Controls.Add(this.NUD_ELevel); this.Tab_Encounters.Controls.Add(this.LB_Encounter); + this.Tab_Encounters.Controls.Add(this.label15); + this.Tab_Encounters.Controls.Add(this.label14); this.Tab_Encounters.Location = new System.Drawing.Point(4, 22); this.Tab_Encounters.Name = "Tab_Encounters"; this.Tab_Encounters.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Encounters.Size = new System.Drawing.Size(498, 476); + this.Tab_Encounters.Size = new System.Drawing.Size(498, 512); this.Tab_Encounters.TabIndex = 0; this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // + // CB_EGender + // + this.CB_EGender.FormattingEnabled = true; + this.CB_EGender.Location = new System.Drawing.Point(187, 71); + this.CB_EGender.Name = "CB_EGender"; + this.CB_EGender.Size = new System.Drawing.Size(136, 21); + this.CB_EGender.TabIndex = 526; + // + // L_Ally1 + // + this.L_Ally1.Location = new System.Drawing.Point(126, 178); + this.L_Ally1.Name = "L_Ally1"; + this.L_Ally1.Size = new System.Drawing.Size(60, 23); + this.L_Ally1.TabIndex = 523; + this.L_Ally1.Text = "SOS Ally 1:"; + this.L_Ally1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_Ally1 + // + this.NUD_Ally1.Location = new System.Drawing.Point(187, 181); + this.NUD_Ally1.Maximum = new decimal(new int[] { + 251, + 0, + 0, + 0}); + this.NUD_Ally1.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_Ally1.Name = "NUD_Ally1"; + this.NUD_Ally1.Size = new System.Drawing.Size(48, 20); + this.NUD_Ally1.TabIndex = 522; + // + // L_Ally2 + // + this.L_Ally2.Location = new System.Drawing.Point(126, 199); + this.L_Ally2.Name = "L_Ally2"; + this.L_Ally2.Size = new System.Drawing.Size(60, 23); + this.L_Ally2.TabIndex = 521; + this.L_Ally2.Text = "SOS Ally 2:"; + this.L_Ally2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_Ally2 + // + this.NUD_Ally2.Location = new System.Drawing.Point(187, 202); + this.NUD_Ally2.Maximum = new decimal(new int[] { + 251, + 0, + 0, + 0}); + this.NUD_Ally2.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NUD_Ally2.Name = "NUD_Ally2"; + this.NUD_Ally2.Size = new System.Drawing.Size(48, 20); + this.NUD_Ally2.TabIndex = 520; + // // L_EGender // - this.L_EGender.Location = new System.Drawing.Point(131, 71); + this.L_EGender.Location = new System.Drawing.Point(131, 69); this.L_EGender.Name = "L_EGender"; this.L_EGender.Size = new System.Drawing.Size(55, 23); this.L_EGender.TabIndex = 519; this.L_EGender.Text = "Gender:"; this.L_EGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // NUD_EGender - // - this.NUD_EGender.Location = new System.Drawing.Point(187, 74); - this.NUD_EGender.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.NUD_EGender.Name = "NUD_EGender"; - this.NUD_EGender.Size = new System.Drawing.Size(34, 20); - this.NUD_EGender.TabIndex = 518; - // // CB_EAbility // this.CB_EAbility.FormattingEnabled = true; - this.CB_EAbility.Location = new System.Drawing.Point(187, 96); + this.CB_EAbility.Location = new System.Drawing.Point(187, 93); this.CB_EAbility.Name = "CB_EAbility"; - this.CB_EAbility.Size = new System.Drawing.Size(121, 21); + this.CB_EAbility.Size = new System.Drawing.Size(136, 21); this.CB_EAbility.TabIndex = 517; // // L_EAbility // - this.L_EAbility.Location = new System.Drawing.Point(131, 94); + this.L_EAbility.Location = new System.Drawing.Point(131, 91); this.L_EAbility.Name = "L_EAbility"; this.L_EAbility.Size = new System.Drawing.Size(55, 23); this.L_EAbility.TabIndex = 516; @@ -496,7 +556,7 @@ private void InitializeComponent() // CHK_EIV3 // this.CHK_EIV3.AutoSize = true; - this.CHK_EIV3.Location = new System.Drawing.Point(187, 205); + this.CHK_EIV3.Location = new System.Drawing.Point(187, 240); this.CHK_EIV3.Name = "CHK_EIV3"; this.CHK_EIV3.Size = new System.Drawing.Size(42, 17); this.CHK_EIV3.TabIndex = 504; @@ -506,14 +566,14 @@ private void InitializeComponent() // CB_ENature // this.CB_ENature.FormattingEnabled = true; - this.CB_ENature.Location = new System.Drawing.Point(187, 142); + this.CB_ENature.Location = new System.Drawing.Point(187, 137); this.CB_ENature.Name = "CB_ENature"; - this.CB_ENature.Size = new System.Drawing.Size(121, 21); + this.CB_ENature.Size = new System.Drawing.Size(136, 21); this.CB_ENature.TabIndex = 503; // // L_ENature // - this.L_ENature.Location = new System.Drawing.Point(131, 140); + this.L_ENature.Location = new System.Drawing.Point(131, 135); this.L_ENature.Name = "L_ENature"; this.L_ENature.Size = new System.Drawing.Size(55, 23); this.L_ENature.TabIndex = 502; @@ -534,7 +594,7 @@ private void InitializeComponent() this.GB_EEVs.Controls.Add(this.label3); this.GB_EEVs.Controls.Add(this.label4); this.GB_EEVs.Controls.Add(this.label5); - this.GB_EEVs.Location = new System.Drawing.Point(284, 333); + this.GB_EEVs.Location = new System.Drawing.Point(280, 371); this.GB_EEVs.Name = "GB_EEVs"; this.GB_EEVs.Size = new System.Drawing.Size(160, 112); this.GB_EEVs.TabIndex = 501; @@ -711,7 +771,7 @@ private void InitializeComponent() this.GB_EIVs.Controls.Add(this.NUD_EIV0); this.GB_EIVs.Controls.Add(this.L_ATK); this.GB_EIVs.Controls.Add(this.L_DEF); - this.GB_EIVs.Location = new System.Drawing.Point(129, 333); + this.GB_EIVs.Location = new System.Drawing.Point(129, 371); this.GB_EIVs.Name = "GB_EIVs"; this.GB_EIVs.Size = new System.Drawing.Size(148, 112); this.GB_EIVs.TabIndex = 21; @@ -906,7 +966,7 @@ private void InitializeComponent() // // L_Aura // - this.L_Aura.Location = new System.Drawing.Point(131, 163); + this.L_Aura.Location = new System.Drawing.Point(131, 157); this.L_Aura.Name = "L_Aura"; this.L_Aura.Size = new System.Drawing.Size(55, 23); this.L_Aura.TabIndex = 22; @@ -916,15 +976,15 @@ private void InitializeComponent() // CB_Aura // this.CB_Aura.FormattingEnabled = true; - this.CB_Aura.Location = new System.Drawing.Point(187, 165); + this.CB_Aura.Location = new System.Drawing.Point(187, 159); this.CB_Aura.Name = "CB_Aura"; - this.CB_Aura.Size = new System.Drawing.Size(121, 21); + this.CB_Aura.Size = new System.Drawing.Size(136, 21); this.CB_Aura.TabIndex = 21; // // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 190); + this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 225); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); this.CHK_ShinyLock.TabIndex = 18; @@ -937,7 +997,7 @@ private void InitializeComponent() this.GB_EMoves.Controls.Add(this.CB_EMove2); this.GB_EMoves.Controls.Add(this.CB_EMove1); this.GB_EMoves.Controls.Add(this.CB_EMove0); - this.GB_EMoves.Location = new System.Drawing.Point(129, 220); + this.GB_EMoves.Location = new System.Drawing.Point(129, 253); this.GB_EMoves.Name = "GB_EMoves"; this.GB_EMoves.Size = new System.Drawing.Size(133, 112); this.GB_EMoves.TabIndex = 17; @@ -979,14 +1039,14 @@ private void InitializeComponent() // CB_EHeldItem // this.CB_EHeldItem.FormattingEnabled = true; - this.CB_EHeldItem.Location = new System.Drawing.Point(187, 119); + this.CB_EHeldItem.Location = new System.Drawing.Point(187, 115); this.CB_EHeldItem.Name = "CB_EHeldItem"; - this.CB_EHeldItem.Size = new System.Drawing.Size(121, 21); + this.CB_EHeldItem.Size = new System.Drawing.Size(136, 21); this.CB_EHeldItem.TabIndex = 16; // // L_EHeldItem // - this.L_EHeldItem.Location = new System.Drawing.Point(131, 117); + this.L_EHeldItem.Location = new System.Drawing.Point(131, 113); this.L_EHeldItem.Name = "L_EHeldItem"; this.L_EHeldItem.Size = new System.Drawing.Size(55, 23); this.L_EHeldItem.TabIndex = 15; @@ -998,13 +1058,13 @@ private void InitializeComponent() this.CB_ESpecies.FormattingEnabled = true; this.CB_ESpecies.Location = new System.Drawing.Point(187, 7); this.CB_ESpecies.Name = "CB_ESpecies"; - this.CB_ESpecies.Size = new System.Drawing.Size(121, 21); + this.CB_ESpecies.Size = new System.Drawing.Size(136, 21); this.CB_ESpecies.TabIndex = 14; this.CB_ESpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); // // L_EForm // - this.L_EForm.Location = new System.Drawing.Point(131, 49); + this.L_EForm.Location = new System.Drawing.Point(131, 47); this.L_EForm.Name = "L_EForm"; this.L_EForm.Size = new System.Drawing.Size(55, 23); this.L_EForm.TabIndex = 13; @@ -1013,7 +1073,7 @@ private void InitializeComponent() // // NUD_EForm // - this.NUD_EForm.Location = new System.Drawing.Point(187, 52); + this.NUD_EForm.Location = new System.Drawing.Point(187, 50); this.NUD_EForm.Maximum = new decimal(new int[] { 255, 0, @@ -1030,7 +1090,7 @@ private void InitializeComponent() // // L_ELevel // - this.L_ELevel.Location = new System.Drawing.Point(131, 27); + this.L_ELevel.Location = new System.Drawing.Point(131, 26); this.L_ELevel.Name = "L_ELevel"; this.L_ELevel.Size = new System.Drawing.Size(55, 23); this.L_ELevel.TabIndex = 11; @@ -1048,7 +1108,7 @@ private void InitializeComponent() // // NUD_ELevel // - this.NUD_ELevel.Location = new System.Drawing.Point(187, 30); + this.NUD_ELevel.Location = new System.Drawing.Point(187, 29); this.NUD_ELevel.Name = "NUD_ELevel"; this.NUD_ELevel.Size = new System.Drawing.Size(48, 20); this.NUD_ELevel.TabIndex = 9; @@ -1065,14 +1125,32 @@ private void InitializeComponent() this.LB_Encounter.FormattingEnabled = true; this.LB_Encounter.Location = new System.Drawing.Point(3, 3); this.LB_Encounter.Name = "LB_Encounter"; - this.LB_Encounter.Size = new System.Drawing.Size(115, 472); + this.LB_Encounter.Size = new System.Drawing.Size(115, 498); this.LB_Encounter.TabIndex = 1; this.LB_Encounter.SelectedIndexChanged += new System.EventHandler(this.LB_Encounter_SelectedIndexChanged); // + // label15 + // + this.label15.Location = new System.Drawing.Point(237, 199); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(66, 23); + this.label15.TabIndex = 525; + this.label15.Text = "(-1 is None)"; + this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label14 + // + this.label14.Location = new System.Drawing.Point(237, 179); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(66, 23); + this.label14.TabIndex = 524; + this.label14.Text = "(-1 is None)"; + this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // Tab_Trades // + this.Tab_Trades.Controls.Add(this.CB_TGender); this.Tab_Trades.Controls.Add(this.L_TGender); - this.Tab_Trades.Controls.Add(this.NUD_TGender); this.Tab_Trades.Controls.Add(this.CB_TAbility); this.Tab_Trades.Controls.Add(this.L_TAbility); this.Tab_Trades.Controls.Add(this.CB_TNature); @@ -1095,43 +1173,39 @@ private void InitializeComponent() this.Tab_Trades.Location = new System.Drawing.Point(4, 22); this.Tab_Trades.Name = "Tab_Trades"; this.Tab_Trades.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Trades.Size = new System.Drawing.Size(498, 476); + this.Tab_Trades.Size = new System.Drawing.Size(498, 512); this.Tab_Trades.TabIndex = 1; this.Tab_Trades.Text = "Trades"; this.Tab_Trades.UseVisualStyleBackColor = true; // + // CB_TGender + // + this.CB_TGender.FormattingEnabled = true; + this.CB_TGender.Location = new System.Drawing.Point(187, 71); + this.CB_TGender.Name = "CB_TGender"; + this.CB_TGender.Size = new System.Drawing.Size(136, 21); + this.CB_TGender.TabIndex = 527; + // // L_TGender // - this.L_TGender.Location = new System.Drawing.Point(131, 71); + this.L_TGender.Location = new System.Drawing.Point(131, 69); this.L_TGender.Name = "L_TGender"; this.L_TGender.Size = new System.Drawing.Size(55, 23); this.L_TGender.TabIndex = 523; this.L_TGender.Text = "Gender:"; this.L_TGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // NUD_TGender - // - this.NUD_TGender.Location = new System.Drawing.Point(187, 74); - this.NUD_TGender.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.NUD_TGender.Name = "NUD_TGender"; - this.NUD_TGender.Size = new System.Drawing.Size(34, 20); - this.NUD_TGender.TabIndex = 522; - // // CB_TAbility // this.CB_TAbility.FormattingEnabled = true; - this.CB_TAbility.Location = new System.Drawing.Point(187, 96); + this.CB_TAbility.Location = new System.Drawing.Point(187, 93); this.CB_TAbility.Name = "CB_TAbility"; - this.CB_TAbility.Size = new System.Drawing.Size(121, 21); + this.CB_TAbility.Size = new System.Drawing.Size(136, 21); this.CB_TAbility.TabIndex = 521; // // L_TAbility // - this.L_TAbility.Location = new System.Drawing.Point(131, 94); + this.L_TAbility.Location = new System.Drawing.Point(131, 91); this.L_TAbility.Name = "L_TAbility"; this.L_TAbility.Size = new System.Drawing.Size(55, 23); this.L_TAbility.TabIndex = 520; @@ -1141,14 +1215,14 @@ private void InitializeComponent() // CB_TNature // this.CB_TNature.FormattingEnabled = true; - this.CB_TNature.Location = new System.Drawing.Point(187, 142); + this.CB_TNature.Location = new System.Drawing.Point(187, 137); this.CB_TNature.Name = "CB_TNature"; - this.CB_TNature.Size = new System.Drawing.Size(121, 21); + this.CB_TNature.Size = new System.Drawing.Size(136, 21); this.CB_TNature.TabIndex = 505; // // L_TNature // - this.L_TNature.Location = new System.Drawing.Point(131, 140); + this.L_TNature.Location = new System.Drawing.Point(131, 135); this.L_TNature.Name = "L_TNature"; this.L_TNature.Size = new System.Drawing.Size(55, 23); this.L_TNature.TabIndex = 504; @@ -1365,14 +1439,14 @@ private void InitializeComponent() // CB_TRequest // this.CB_TRequest.FormattingEnabled = true; - this.CB_TRequest.Location = new System.Drawing.Point(230, 194); + this.CB_TRequest.Location = new System.Drawing.Point(230, 188); this.CB_TRequest.Name = "CB_TRequest"; this.CB_TRequest.Size = new System.Drawing.Size(121, 21); this.CB_TRequest.TabIndex = 29; // // label1 // - this.label1.Location = new System.Drawing.Point(121, 192); + this.label1.Location = new System.Drawing.Point(121, 186); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(106, 23); this.label1.TabIndex = 28; @@ -1382,7 +1456,7 @@ private void InitializeComponent() // L_TTID // this.L_TTID.AutoSize = true; - this.L_TTID.Location = new System.Drawing.Point(252, 170); + this.L_TTID.Location = new System.Drawing.Point(252, 162); this.L_TTID.Name = "L_TTID"; this.L_TTID.Size = new System.Drawing.Size(53, 13); this.L_TTID.TabIndex = 27; @@ -1391,7 +1465,7 @@ private void InitializeComponent() // // L_TID // - this.L_TID.Location = new System.Drawing.Point(136, 165); + this.L_TID.Location = new System.Drawing.Point(136, 157); this.L_TID.Name = "L_TID"; this.L_TID.Size = new System.Drawing.Size(50, 23); this.L_TID.TabIndex = 26; @@ -1400,7 +1474,7 @@ private void InitializeComponent() // // NUD_TID // - this.NUD_TID.Location = new System.Drawing.Point(187, 167); + this.NUD_TID.Location = new System.Drawing.Point(187, 159); this.NUD_TID.Maximum = new decimal(new int[] { 999999, 0, @@ -1419,14 +1493,14 @@ private void InitializeComponent() // CB_THeldItem // this.CB_THeldItem.FormattingEnabled = true; - this.CB_THeldItem.Location = new System.Drawing.Point(187, 119); + this.CB_THeldItem.Location = new System.Drawing.Point(187, 115); this.CB_THeldItem.Name = "CB_THeldItem"; - this.CB_THeldItem.Size = new System.Drawing.Size(121, 21); + this.CB_THeldItem.Size = new System.Drawing.Size(136, 21); this.CB_THeldItem.TabIndex = 24; // // L_THeldItem // - this.L_THeldItem.Location = new System.Drawing.Point(131, 117); + this.L_THeldItem.Location = new System.Drawing.Point(131, 113); this.L_THeldItem.Name = "L_THeldItem"; this.L_THeldItem.Size = new System.Drawing.Size(55, 23); this.L_THeldItem.TabIndex = 23; @@ -1438,13 +1512,13 @@ private void InitializeComponent() this.CB_TSpecies.FormattingEnabled = true; this.CB_TSpecies.Location = new System.Drawing.Point(187, 7); this.CB_TSpecies.Name = "CB_TSpecies"; - this.CB_TSpecies.Size = new System.Drawing.Size(121, 21); + this.CB_TSpecies.Size = new System.Drawing.Size(136, 21); this.CB_TSpecies.TabIndex = 22; this.CB_TSpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); // // L_TForm // - this.L_TForm.Location = new System.Drawing.Point(131, 49); + this.L_TForm.Location = new System.Drawing.Point(131, 47); this.L_TForm.Name = "L_TForm"; this.L_TForm.Size = new System.Drawing.Size(55, 23); this.L_TForm.TabIndex = 21; @@ -1453,7 +1527,7 @@ private void InitializeComponent() // // NUD_TForm // - this.NUD_TForm.Location = new System.Drawing.Point(187, 52); + this.NUD_TForm.Location = new System.Drawing.Point(187, 50); this.NUD_TForm.Maximum = new decimal(new int[] { 255, 0, @@ -1470,7 +1544,7 @@ private void InitializeComponent() // // L_TLevel // - this.L_TLevel.Location = new System.Drawing.Point(131, 27); + this.L_TLevel.Location = new System.Drawing.Point(131, 26); this.L_TLevel.Name = "L_TLevel"; this.L_TLevel.Size = new System.Drawing.Size(55, 23); this.L_TLevel.TabIndex = 19; @@ -1488,7 +1562,7 @@ private void InitializeComponent() // // NUD_TLevel // - this.NUD_TLevel.Location = new System.Drawing.Point(187, 30); + this.NUD_TLevel.Location = new System.Drawing.Point(187, 29); this.NUD_TLevel.Name = "NUD_TLevel"; this.NUD_TLevel.Size = new System.Drawing.Size(48, 20); this.NUD_TLevel.TabIndex = 17; @@ -1505,7 +1579,7 @@ private void InitializeComponent() this.LB_Trade.FormattingEnabled = true; this.LB_Trade.Location = new System.Drawing.Point(3, 3); this.LB_Trade.Name = "LB_Trade"; - this.LB_Trade.Size = new System.Drawing.Size(115, 472); + this.LB_Trade.Size = new System.Drawing.Size(115, 498); this.LB_Trade.TabIndex = 2; this.LB_Trade.SelectedIndexChanged += new System.EventHandler(this.LB_Trade_SelectedIndexChanged); // @@ -1521,7 +1595,7 @@ private void InitializeComponent() this.Tab_Randomizer.Location = new System.Drawing.Point(4, 22); this.Tab_Randomizer.Name = "Tab_Randomizer"; this.Tab_Randomizer.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Randomizer.Size = new System.Drawing.Size(498, 476); + this.Tab_Randomizer.Size = new System.Drawing.Size(498, 512); this.Tab_Randomizer.TabIndex = 3; this.Tab_Randomizer.Text = "Randomizer Options"; this.Tab_Randomizer.UseVisualStyleBackColor = true; @@ -1542,6 +1616,16 @@ private void InitializeComponent() this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Tweaks"; // + // CHK_Metronome + // + this.CHK_Metronome.AutoSize = true; + this.CHK_Metronome.Location = new System.Drawing.Point(6, 95); + this.CHK_Metronome.Name = "CHK_Metronome"; + this.CHK_Metronome.Size = new System.Drawing.Size(109, 17); + this.CHK_Metronome.TabIndex = 515; + this.CHK_Metronome.Text = "Metronome Mode"; + this.CHK_Metronome.UseVisualStyleBackColor = true; + // // CHK_RemoveShinyLock // this.CHK_RemoveShinyLock.AutoSize = true; @@ -1752,7 +1836,7 @@ private void InitializeComponent() this.CHK_G7.AutoSize = true; this.CHK_G7.Checked = true; this.CHK_G7.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G7.Location = new System.Drawing.Point(9, 60); + this.CHK_G7.Location = new System.Drawing.Point(9, 57); this.CHK_G7.Name = "CHK_G7"; this.CHK_G7.Size = new System.Drawing.Size(55, 17); this.CHK_G7.TabIndex = 296; @@ -1762,7 +1846,7 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(128, 45); + this.CHK_BST.Location = new System.Drawing.Point(128, 43); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 288; @@ -1774,7 +1858,7 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(128, 30); + this.CHK_E.Location = new System.Drawing.Point(128, 29); this.CHK_E.Name = "CHK_E"; this.CHK_E.Size = new System.Drawing.Size(98, 17); this.CHK_E.TabIndex = 287; @@ -1798,7 +1882,7 @@ private void InitializeComponent() this.CHK_G6.AutoSize = true; this.CHK_G6.Checked = true; this.CHK_G6.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G6.Location = new System.Drawing.Point(67, 45); + this.CHK_G6.Location = new System.Drawing.Point(67, 43); this.CHK_G6.Name = "CHK_G6"; this.CHK_G6.Size = new System.Drawing.Size(55, 17); this.CHK_G6.TabIndex = 285; @@ -1810,7 +1894,7 @@ private void InitializeComponent() this.CHK_G5.AutoSize = true; this.CHK_G5.Checked = true; this.CHK_G5.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G5.Location = new System.Drawing.Point(67, 30); + this.CHK_G5.Location = new System.Drawing.Point(67, 29); this.CHK_G5.Name = "CHK_G5"; this.CHK_G5.Size = new System.Drawing.Size(55, 17); this.CHK_G5.TabIndex = 284; @@ -1834,7 +1918,7 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(9, 45); + this.CHK_G3.Location = new System.Drawing.Point(9, 43); this.CHK_G3.Name = "CHK_G3"; this.CHK_G3.Size = new System.Drawing.Size(55, 17); this.CHK_G3.TabIndex = 282; @@ -1846,7 +1930,7 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(9, 30); + this.CHK_G2.Location = new System.Drawing.Point(9, 29); this.CHK_G2.Name = "CHK_G2"; this.CHK_G2.Size = new System.Drawing.Size(55, 17); this.CHK_G2.TabIndex = 281; @@ -1877,7 +1961,7 @@ private void InitializeComponent() // // B_Save // - this.B_Save.Location = new System.Drawing.Point(435, 481); + this.B_Save.Location = new System.Drawing.Point(435, 518); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(75, 23); this.B_Save.TabIndex = 1; @@ -1887,7 +1971,7 @@ private void InitializeComponent() // // B_Cancel // - this.B_Cancel.Location = new System.Drawing.Point(354, 481); + this.B_Cancel.Location = new System.Drawing.Point(354, 518); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(75, 23); this.B_Cancel.TabIndex = 2; @@ -1895,21 +1979,11 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // CHK_Metronome - // - this.CHK_Metronome.AutoSize = true; - this.CHK_Metronome.Location = new System.Drawing.Point(6, 95); - this.CHK_Metronome.Name = "CHK_Metronome"; - this.CHK_Metronome.Size = new System.Drawing.Size(109, 17); - this.CHK_Metronome.TabIndex = 515; - this.CHK_Metronome.Text = "Metronome Mode"; - this.CHK_Metronome.UseVisualStyleBackColor = true; - // // StaticEncounterEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(530, 535); + this.ClientSize = new System.Drawing.Size(530, 571); this.Controls.Add(this.B_Cancel); this.Controls.Add(this.B_Save); this.Controls.Add(this.TC_Tabs); @@ -1922,7 +1996,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).EndInit(); this.Tab_Encounters.ResumeLayout(false); this.Tab_Encounters.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Ally1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_Ally2)).EndInit(); this.GB_EEVs.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).EndInit(); @@ -1942,7 +2017,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).EndInit(); this.Tab_Trades.ResumeLayout(false); this.Tab_Trades.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).EndInit(); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).EndInit(); @@ -2094,9 +2168,7 @@ private void InitializeComponent() private System.Windows.Forms.Label L_TAbility; private System.Windows.Forms.CheckBox CHK_RandomAbility; private System.Windows.Forms.Label L_EGender; - private System.Windows.Forms.NumericUpDown NUD_EGender; private System.Windows.Forms.Label L_TGender; - private System.Windows.Forms.NumericUpDown NUD_TGender; private System.Windows.Forms.CheckBox CHK_ReplaceLegend; private System.Windows.Forms.GroupBox GB_Tweak; private System.Windows.Forms.CheckBox CHK_ForceTotem; @@ -2104,5 +2176,13 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_Metronome; + private System.Windows.Forms.Label L_Ally1; + private System.Windows.Forms.NumericUpDown NUD_Ally1; + private System.Windows.Forms.Label L_Ally2; + private System.Windows.Forms.NumericUpDown NUD_Ally2; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.ComboBox CB_EGender; + private System.Windows.Forms.ComboBox CB_TGender; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 895dc936f7..679278f3ee 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -24,9 +24,15 @@ public partial class StaticEncounterEditor7 : Form private static int[] ReplaceLegend; private static int[] BasicStarter; + private readonly string[] gender = + { + "- / Genderless/Random", + "♂ / Male", + "♀ / Female", + }; private readonly string[] ability = { - "Random (1 or 2)", + "Any (1 or 2)", "Ability 1", "Ability 2", "Hidden Ability", @@ -127,6 +133,11 @@ public StaticEncounterEditor7(byte[][] infiles) CB_EMove3.Items.Add(s); CB_SpecialMove.Items.Add(s); } + foreach (string s in gender) + { + CB_EGender.Items.Add(s); + CB_TGender.Items.Add(s); + } foreach (string s in aura) CB_Aura.Items.Add(s); CB_GNature.Items.Add("Random"); @@ -135,6 +146,8 @@ public StaticEncounterEditor7(byte[][] infiles) CB_ENature.Items.AddRange(natures.Take(25).ToArray()); CB_TNature.Items.AddRange(natures.Take(25).ToArray()); + NUD_Ally1.Maximum = NUD_Ally2.Maximum = Main.Config.USUM ? 251 : 136; + getListBoxEntries(); LB_Gift.SelectedIndex = 0; LB_Encounter.SelectedIndex = 0; @@ -275,7 +288,7 @@ private void getEncounter() CB_EHeldItem.SelectedIndex = entry.HeldItem; NUD_ELevel.Value = entry.Level; NUD_EForm.Value = entry.Form; - NUD_EGender.Value = entry.Gender; + CB_EGender.SelectedIndex = entry.Gender; CB_EAbility.SelectedIndex = entry.Ability; int[] moves = entry.RelearnMoves; @@ -302,6 +315,8 @@ private void getEncounter() CHK_EIV3.Checked = entry.IV3; CB_ENature.SelectedIndex = entry.Nature; CB_Aura.SelectedIndex = entry.Aura; + NUD_Ally1.Value = entry.Ally1 - 1; + NUD_Ally2.Value = entry.Ally2 - 1; loading = false; } @@ -317,7 +332,7 @@ private void setEncounter() entry.HeldItem = CB_EHeldItem.SelectedIndex; entry.Level = (int)NUD_ELevel.Value; entry.Form = (int)NUD_EForm.Value; - entry.Gender = (int)NUD_EGender.Value; + entry.Gender = CB_EGender.SelectedIndex; entry.Ability = CB_EAbility.SelectedIndex; entry.RelearnMoves = new[] { @@ -346,6 +361,8 @@ private void setEncounter() entry.ShinyLock = CHK_ShinyLock.Checked; entry.Nature = CB_ENature.SelectedIndex; entry.Aura = CB_Aura.SelectedIndex; + entry.Ally1 = (int)NUD_Ally1.Value + 1; + entry.Ally2 = (int)NUD_Ally2.Value + 1; } private void getTrade() { @@ -359,7 +376,7 @@ private void getTrade() CB_THeldItem.SelectedIndex = entry.HeldItem; NUD_TLevel.Value = entry.Level; NUD_TForm.Value = entry.Form; - NUD_TGender.Value = entry.Gender; + CB_TGender.SelectedIndex = entry.Gender + 1; CB_TAbility.SelectedIndex = entry.Ability + 1; CB_TNature.SelectedIndex = entry.Nature; @@ -386,7 +403,7 @@ private void setTrade() entry.HeldItem = CB_THeldItem.SelectedIndex; entry.Level = (int)NUD_TLevel.Value; entry.Form = (int)NUD_TForm.Value; - entry.Gender = (int)NUD_TGender.Value; + entry.Gender = CB_TGender.SelectedIndex - 1; entry.Ability = (CB_TAbility.SelectedIndex - 1); entry.Nature = CB_TNature.SelectedIndex; From f9d9b8878af210890f324b2dfa9e1cdb442a9034 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 19 Apr 2018 16:01:49 -0700 Subject: [PATCH 101/191] Save updated shiny lock shiny wasn't decomposed to IsShiny (bit0--else unused) and NeverShiny (bit1), the unmodified value was being set back (Shiny). Closes #324 --- pk3DS.Core/Structures/Gen6/EncounterGift6.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs index 08e47a0acc..1609354f2e 100644 --- a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs +++ b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs @@ -29,7 +29,10 @@ public class EncounterGift6 // All public byte uLast; - public bool ShinyLock { get { return (Data[0x6] & 2) >> 1 == 1; } set { Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0)); } } + public bool ShinyLock { + get => (Shiny & 2) != 0; + set => Shiny = (byte)(Shiny & ~2 | (value ? 2 : 0)); + } public EncounterGift6(byte[] data, bool oras) { From 54fef2c6860d2e8c44d7f02d0a6235b187a44454 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 1 May 2018 16:11:22 -0400 Subject: [PATCH 102/191] Fix SMTE trainer class rand (#331) --- pk3DS.Core/Legality/Legal.cs | 6 +++++ pk3DS/Subforms/Gen6/RSTE.cs | 1 - pk3DS/Subforms/Gen7/SMTE.cs | 44 +++++++++++++++++++++++++++--------- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index fddb321720..cd120e33d7 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -145,6 +145,7 @@ public static partial class Legal 049, // Island Kahuna 050, // Island Kahuna 051, // Island Kahuna + 070, // Team Skull 071, // Aether President 072, // Aether Branch Chief 076, // Team Skull Boss @@ -187,6 +188,8 @@ public static partial class Legal 142, // Captain 143, // Pokémon Trainer 150, // Pokémon Trainer + 151, // Captain + 152, // Captain 153, // Captain 154, // Pokémon Professor 164, // Island Kahuna @@ -220,6 +223,7 @@ public static partial class Legal 049, // Island Kahuna 050, // Island Kahuna 051, // Island Kahuna + 070, // Team Skull 071, // Aether President 072, // Aether Branch Chief 076, // Team Skull Boss @@ -262,6 +266,8 @@ public static partial class Legal 142, // Captain 143, // Pokémon Trainer 150, // Pokémon Trainer + 151, // Captain + 152, // Captain 153, // Captain 154, // Pokémon Professor 164, // Island Kahuna diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index f0057a98cd..ec73d3a920 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -763,7 +763,6 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) { int randClass() => (int)(rnd32() % trClass.Length); int rv; do { rv = randClass(); } - // Ensure the Random Class isn't an exclusive class while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~") || Main.Config.ORAS && (rv >= 0 && rv <= 63) || (rv >= 68 && rv <= 126)); // don't allow disallowed classes t.Class = rv; } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 660ed63fec..66757c5547 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -18,7 +18,7 @@ public partial class SMTE : Form private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); private readonly trdata7[] Trainers; private string[][] AltForms; - private static int[] TrainerClasses; + private static int[] SpecialClasses; private static int[] ImportantTrainers; private static int[] FinalEvo; private static int[] ReplaceLegend; @@ -60,11 +60,20 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) CB_Moves.SelectedIndex = 0; CHK_ReplaceLegend.Visible = Main.Config.USUM; // Team Rainbow Rocket only in USUM MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); - - TrainerClasses = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; + ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; ReplaceLegend = Legal.Legendary_Mythical_USUM; + + if (CHK_RandomClass.Checked) + { + SpecialClasses = CHK_IgnoreSpecialClass.Checked + ? Main.Config.USUM + ? Legal.SpecialClasses_USUM + : Legal.SpecialClasses_SM + : new int[] {}; + } + RandSettings.GetFormSettings(this, Tab_Rand.Controls); } @@ -624,25 +633,34 @@ private void B_Randomize_Click(object sender, EventArgs e) var tr = Trainers[i]; if (tr.Pokemon.Count == 0) continue; + // Trainer Properties if (CHK_RandomClass.Checked) { - int rv; - do + // ignore special classes + if (CHK_IgnoreSpecialClass.Checked && !SpecialClasses.Contains(tr.TrainerClass)) { - rv = (int) (Util.rnd32()%CB_Trainer_Class.Items.Count); - } while (/*trClass[rv].StartsWith("[~") || */TrainerClasses.Contains(rv) && CHK_IgnoreSpecialClass.Checked); // don't allow disallowed classes - - if (rv == 082) // Lusamine 2 (Aether President - 082) can crash Multi Battles, skip - continue; + int randClass() => (int)(Util.rnd32() % CB_Trainer_Class.Items.Count); + int rv; do { rv = randClass(); } + while (SpecialClasses.Contains(rv)); // don't allow disallowed classes + tr.TrainerClass = (byte)rv; + } - tr.TrainerClass = (byte) rv; + // all classes + else if (!CHK_IgnoreSpecialClass.Checked) + { + int randClass() => (int)(Util.rnd32() % CB_Trainer_Class.Items.Count); + int rv; do { rv = randClass(); } + while (rv == 082); // Lusamine 2 can crash multi battles, skip + tr.TrainerClass = (byte)rv; + } } var avgBST = (int)tr.Pokemon.Average(pk => Main.SpeciesStat[pk.Species].BST); int avgLevel = (int)tr.Pokemon.Average(pk => pk.Level); var pinfo = Main.SpeciesStat.OrderBy(pk => Math.Abs(avgBST - pk.BST)).First(); int avgSpec = Array.IndexOf(Main.SpeciesStat, pinfo); + int[] royal = { 081, 082, 083, 084, 185 }; if (tr.NumPokemon < NUD_RMin.Value) { @@ -670,6 +688,10 @@ private void B_Randomize_Click(object sender, EventArgs e) tr.NumPokemon = 6; } + // force 1 pkm to keep forced Battle Royal fair + if (royal.Contains(tr.ID)) + tr.NumPokemon = 1; + // PKM Properties foreach (var pk in tr.Pokemon) { From 63600a2a35a7bd5a9a7d31909256e7ffcf2704aa Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 3 May 2018 17:25:00 -0400 Subject: [PATCH 103/191] Re-arrange move/form assignment (#333) --- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 679278f3ee..0535b4f7b9 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -629,14 +629,14 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) t.Species = FinalEvo[randFinalEvo()]; + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); + t.Gender = 0; // random + t.Nature = 0; // random + if (CHK_Metronome.Checked) t.RelearnMoves = new[] { 118, 0, 0, 0 }; else t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); - - t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); - t.Gender = 0; // random - t.Nature = 0; // random } foreach (EncounterTrade7 t in Trades) { From 126ddf1a49b3d7b4f35484c0a14bf75c7cea7a3e Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 12 May 2018 18:57:17 -0400 Subject: [PATCH 104/191] Rework Gen 6 TM/HM randomization (#338) --- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index dc4a634962..2b00458cf4 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -158,40 +158,43 @@ private void formClosing(object sender, FormClosingEventArgs e) private void B_RandomTM_Click(object sender, EventArgs e) { - if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize TMs?", "Move compatibility will be the same as the base TMs.") != DialogResult.Yes) return; - if (CHK_RandomizeHM.Checked) - if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomizing HMs can halt story progression!", "Continue anyway?") != DialogResult.Yes) return; + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize TMs? Cannot undo.", "Move compatibility will be the same as the base TMs.") != DialogResult.Yes) return; + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomizing HMs can halt story progression!", "Continue anyway?") != DialogResult.Yes) return; int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray(); Util.Shuffle(randomMoves); - int[] hm_xy = { 015, 019, 057, 070, 127 }; // Cut, Fly, Surf, Strength, Waterfall - int[] hm_oras = { 015, 019, 057, 070, 127, 249, 291 }; // + Rock Smash, Dive - int[] field = { 148, 249, 290 }; // Flash (TM70), Rock Smash (XY TM94), Secret Power (ORAS TM94) + int[] hm_xy = { 015, 019, 057, 070, 127 }; + int[] hm_ao = hm_xy.Concat(new int[] { 249, 291 }).ToArray(); + int[] field = { 148, 249, 290 }; // TMs with field effects int[] banned = { 165, 464 }; // Struggle and Hyperspace Fury int ctr = 0; for (int i = 0; i < dgvTM.Rows.Count; i++) { - int val = Array.IndexOf(movelist, dgvTM.Rows[i].Cells[1].Value); - if (banned.Contains(val)) continue; + // randomize all TMs if (CHK_RandomizeField.Checked) - dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; // randomize everything + { + while (banned.Contains(randomMoves[ctr])) ctr++; + dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; + } + // randomize all TMs, no Field Moves else { - if (hm_xy.Contains(val) || hm_oras.Contains(val) || field.Contains(val)) continue; // skip HMs and Field Moves - while (hm_xy.Contains(randomMoves[ctr]) || hm_oras.Contains(randomMoves[ctr]) || field.Contains(randomMoves[ctr])) ctr++; + int val = Array.IndexOf(movelist, dgvTM.Rows[i].Cells[1].Value); + if (hm_xy.Contains(val) || hm_ao.Contains(val) || field.Contains(val)) continue; // skip banned moves + while (hm_xy.Contains(randomMoves[ctr]) || hm_ao.Contains(randomMoves[ctr]) || field.Contains(randomMoves[ctr]) || banned.Contains(randomMoves[ctr])) ctr++; dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; } } if (CHK_RandomizeHM.Checked) { - for (int i = 0; i < dgvHM.Rows.Count; i++) + for (int j = 0; j < dgvHM.Rows.Count; j++) { - dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; - dgvHM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]]; + while (banned.Contains(randomMoves[ctr])) ctr++; + dgvHM.Rows[j].Cells[1].Value = movelist[randomMoves[ctr++]]; } } WinFormsUtil.Alert("Randomized!"); From 32c0dad5ea9d2212850d15329af87f495444e979 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 13 May 2018 10:32:41 -0400 Subject: [PATCH 105/191] Fix TMHMEditor6 banned moves (#339) --- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index 2b00458cf4..7334e71cb8 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -167,7 +167,7 @@ private void B_RandomTM_Click(object sender, EventArgs e) int[] hm_xy = { 015, 019, 057, 070, 127 }; int[] hm_ao = hm_xy.Concat(new int[] { 249, 291 }).ToArray(); int[] field = { 148, 249, 290 }; // TMs with field effects - int[] banned = { 165, 464 }; // Struggle and Hyperspace Fury + int[] banned = { 165, 621 }; // Struggle and Hyperspace Fury int ctr = 0; for (int i = 0; i < dgvTM.Rows.Count; i++) @@ -233,4 +233,4 @@ internal static void getTMHMList(bool oras, ref ushort[] TMs, ref ushort[] HMs) HMs = hms.ToArray(); } } -} \ No newline at end of file +} From 1a00009fb2e971e21f53309de9f92e19b32486d3 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 19 May 2018 10:06:47 -0700 Subject: [PATCH 106/191] Replace force-exit call environment exit is dirtier but prevents other restorations from occurring. Closes #327 --- pk3DS/Subforms/EnhancedRestore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Subforms/EnhancedRestore.cs b/pk3DS/Subforms/EnhancedRestore.cs index 3ae114335f..e4e3d14be5 100644 --- a/pk3DS/Subforms/EnhancedRestore.cs +++ b/pk3DS/Subforms/EnhancedRestore.cs @@ -156,7 +156,7 @@ private void B_Go_Click(object sender, EventArgs e) } WinFormsUtil.Alert($"Restored {count} file(s).", "The program will now close."); - Application.Exit(); // do not call closing events that repackage personal/gametext + Environment.Exit(-1); // do not call closing events that repackage personal/gametext } private void B_All_Click(object sender, EventArgs e) From 50a2554cb31bb9917375194fd7c18a96c89e5e37 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 19 May 2018 14:46:07 -0700 Subject: [PATCH 107/191] flip arg order https://github.com/kwsch/pk3DS/issues/327#issuecomment-390429334 was copying wrong way --- pk3DS/Subforms/EnhancedRestore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pk3DS/Subforms/EnhancedRestore.cs b/pk3DS/Subforms/EnhancedRestore.cs index e4e3d14be5..25e9fd39fb 100644 --- a/pk3DS/Subforms/EnhancedRestore.cs +++ b/pk3DS/Subforms/EnhancedRestore.cs @@ -148,8 +148,8 @@ private void B_Go_Click(object sender, EventArgs e) try { - if (File.Exists(dest)) // only restore files that exist - File.Copy(dest, src, overwrite: true); count++; + if (File.Exists(src)) // only restore files that exist + File.Copy(src, dest, overwrite: true); count++; } catch { Debug.WriteLine("Unable to overwrite backup: " + dest); } } From 504b41f25c5a875ef0edea72acece287778d86fb Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 23 May 2018 15:28:07 -0400 Subject: [PATCH 108/191] Add min/max PKM for RSTE --- pk3DS/Subforms/Gen6/RSTE.cs | 57 ++++++-- pk3DS/Subforms/Gen6/TrainerRand.Designer.cs | 140 +++++++++++++++----- pk3DS/Subforms/Gen6/TrainerRand.cs | 2 + 3 files changed, 158 insertions(+), 41 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index ec73d3a920..f985be5f74 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -536,7 +536,7 @@ private void Setup() private readonly List Tags = new List(); private readonly Dictionary TagTypes = new Dictionary(); public static int[] sL; // Random Species List - public static decimal rGiftPercent, rLevelMultiplier, rForceFullyEvolvedLevel, rForceHighPowerLevel; + public static decimal rGiftPercent, rLevelMultiplier, rMinPKM, rMaxPKM, rForceFullyEvolvedLevel, rForceHighPowerLevel; private void B_Randomize_Click(object sender, EventArgs e) { rPKM = rMove = rMetronome = rAbility = rDiffAI = rDiffIV = rClass = rGift = rItem = rDoRand = false; // init to false @@ -629,7 +629,8 @@ private void Randomize() Item = rItem || checkBox_Item.Checked }; - InitializeTrainerTeamInfo(t, rImportant[i] == null); + SetMinMaxPKM(t); + SetFullParties(t, rImportant[i] == null); RandomizeTrainerAIClass(t, trClass); RandomizeTrainerPrizeItem(t); RandomizeTeam(t, move, learn, itemvals, type, mevo, typerand); @@ -725,22 +726,58 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom } } } - private static void InitializeTrainerTeamInfo(trdata6 t, bool important) + private static void SetMinMaxPKM(trdata6 t) { - // skip the first rival battles - if (!r6PKM || important) - return; + int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) + var avgBST = (int)t.Team.Average(pk => Main.SpeciesStat[pk.Species].BST); + int avgLevel = (int)t.Team.Average(pk => pk.Level); + var pinfo = Main.SpeciesStat.OrderBy(pk => Math.Abs(avgBST - pk.BST)).First(); + int avgSpec = Array.IndexOf(Main.SpeciesStat, pinfo); + + // set minimum pkm, don't modify hordes + if (t.NumPokemon < rMinPKM && t.BattleType != 4) + { + t.NumPokemon = (byte)rMinPKM; + for (int f = lastPKM + 1; f < t.NumPokemon; f++) + { + Array.Resize(ref t.Team, (int)rMinPKM); + t.Team[f] = // clone last pkm, keeping an average level for all new pkm + new trdata6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) + { + Species = (ushort)rSpeciesRand.GetRandomSpecies(avgSpec), + Level = (ushort)avgLevel, + }; + } + } - // Copy the last slot to random pokemon + // set maximum pkm, don't modify hordes + if (t.NumPokemon > rMaxPKM && t.BattleType != 4) + { + Array.Resize(ref t.Team, (int)rMaxPKM); + t.NumPokemon = (byte)rMaxPKM; + } + } + private static void SetFullParties(trdata6 t, bool important) + { int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) + var avgBST = (int)t.Team.Average(pk => Main.SpeciesStat[pk.Species].BST); + int avgLevel = (int)t.Team.Average(pk => pk.Level); + var pinfo = Main.SpeciesStat.OrderBy(pk => Math.Abs(avgBST - pk.BST)).First(); + int avgSpec = Array.IndexOf(Main.SpeciesStat, pinfo); + + // 6 pkm for important trainers, skip the first rival battles + if (!r6PKM || important) + return; + t.NumPokemon = 6; - Array.Resize(ref t.Team, t.NumPokemon); for (int f = lastPKM + 1; f < t.NumPokemon; f++) { - t.Team[f] = // clone last pkm, keeping an average level for all 6 + Array.Resize(ref t.Team, t.NumPokemon); + t.Team[f] = // clone last pkm, keeping an average level for all new pkm new trdata6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) { - Level = t.Team[f - 1].Level + Species = (ushort)rSpeciesRand.GetRandomSpecies(avgSpec), + Level = (ushort)avgLevel, }; } } diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index 81fc48dfd3..365c385030 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -70,6 +70,10 @@ private void InitializeComponent() this.CHK_NoFixedDamage = new System.Windows.Forms.CheckBox(); this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); + this.L_MinPKM = new System.Windows.Forms.Label(); + this.L_MaxPKM = new System.Windows.Forms.Label(); + this.NUD_RMin = new System.Windows.Forms.NumericUpDown(); + this.NUD_RMax = new System.Windows.Forms.NumericUpDown(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GiftPercent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); this.GB_Tweak.SuspendLayout(); @@ -77,6 +81,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).BeginInit(); this.SuspendLayout(); // // CHK_RandomPKM @@ -98,7 +104,7 @@ private void InitializeComponent() this.CHK_RandomItems.AutoSize = true; this.CHK_RandomItems.Checked = true; this.CHK_RandomItems.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomItems.Location = new System.Drawing.Point(21, 324); + this.CHK_RandomItems.Location = new System.Drawing.Point(21, 372); this.CHK_RandomItems.Name = "CHK_RandomItems"; this.CHK_RandomItems.Size = new System.Drawing.Size(119, 17); this.CHK_RandomItems.TabIndex = 6; @@ -111,7 +117,7 @@ private void InitializeComponent() this.CHK_RandomAbilities.AutoSize = true; this.CHK_RandomAbilities.Checked = true; this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 339); + this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 387); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; this.CHK_RandomAbilities.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbilities.TabIndex = 7; @@ -124,7 +130,7 @@ private void InitializeComponent() this.CHK_RandomGift.AutoSize = true; this.CHK_RandomGift.Checked = true; this.CHK_RandomGift.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomGift.Location = new System.Drawing.Point(21, 418); + this.CHK_RandomGift.Location = new System.Drawing.Point(21, 466); this.CHK_RandomGift.Name = "CHK_RandomGift"; this.CHK_RandomGift.Size = new System.Drawing.Size(145, 17); this.CHK_RandomGift.TabIndex = 10; @@ -138,7 +144,7 @@ private void InitializeComponent() this.CHK_RandomClass.AutoSize = true; this.CHK_RandomClass.Checked = true; this.CHK_RandomClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomClass.Location = new System.Drawing.Point(21, 371); + this.CHK_RandomClass.Location = new System.Drawing.Point(21, 419); this.CHK_RandomClass.Name = "CHK_RandomClass"; this.CHK_RandomClass.Size = new System.Drawing.Size(141, 17); this.CHK_RandomClass.TabIndex = 9; @@ -152,7 +158,7 @@ private void InitializeComponent() this.CHK_MaxDiffAI.AutoSize = true; this.CHK_MaxDiffAI.Checked = true; this.CHK_MaxDiffAI.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffAI.Location = new System.Drawing.Point(21, 433); + this.CHK_MaxDiffAI.Location = new System.Drawing.Point(21, 481); this.CHK_MaxDiffAI.Name = "CHK_MaxDiffAI"; this.CHK_MaxDiffAI.Size = new System.Drawing.Size(95, 17); this.CHK_MaxDiffAI.TabIndex = 13; @@ -165,7 +171,7 @@ private void InitializeComponent() this.CHK_MaxDiffPKM.AutoSize = true; this.CHK_MaxDiffPKM.Checked = true; this.CHK_MaxDiffPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(21, 354); + this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(21, 402); this.CHK_MaxDiffPKM.Name = "CHK_MaxDiffPKM"; this.CHK_MaxDiffPKM.Size = new System.Drawing.Size(64, 17); this.CHK_MaxDiffPKM.TabIndex = 8; @@ -175,7 +181,7 @@ private void InitializeComponent() // B_OK // this.B_OK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.B_OK.Location = new System.Drawing.Point(247, 409); + this.B_OK.Location = new System.Drawing.Point(247, 457); this.B_OK.Name = "B_OK"; this.B_OK.Size = new System.Drawing.Size(50, 23); this.B_OK.TabIndex = 14; @@ -186,7 +192,7 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.B_Cancel.Location = new System.Drawing.Point(247, 431); + this.B_Cancel.Location = new System.Drawing.Point(247, 479); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(50, 23); this.B_Cancel.TabIndex = 15; @@ -197,7 +203,7 @@ private void InitializeComponent() // NUD_GiftPercent // this.NUD_GiftPercent.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_GiftPercent.Location = new System.Drawing.Point(166, 415); + this.NUD_GiftPercent.Location = new System.Drawing.Point(166, 463); this.NUD_GiftPercent.Name = "NUD_GiftPercent"; this.NUD_GiftPercent.Size = new System.Drawing.Size(43, 20); this.NUD_GiftPercent.TabIndex = 11; @@ -212,7 +218,7 @@ private void InitializeComponent() // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(211, 417); + this.label1.Location = new System.Drawing.Point(211, 465); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(15, 13); this.label1.TabIndex = 12; @@ -281,7 +287,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(12, 49); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(270, 155); + this.GB_Tweak.Size = new System.Drawing.Size(270, 154); this.GB_Tweak.TabIndex = 323; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Options"; @@ -289,7 +295,7 @@ private void InitializeComponent() // NUD_ForceFullyEvolved // this.NUD_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 98); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(168, 97); this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(43, 20); this.NUD_ForceFullyEvolved.TabIndex = 334; @@ -304,7 +310,7 @@ private void InitializeComponent() this.CHK_GymE4Only.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_GymE4Only.AutoSize = true; this.CHK_GymE4Only.Enabled = false; - this.CHK_GymE4Only.Location = new System.Drawing.Point(141, 133); + this.CHK_GymE4Only.Location = new System.Drawing.Point(141, 132); this.CHK_GymE4Only.Name = "CHK_GymE4Only"; this.CHK_GymE4Only.Size = new System.Drawing.Size(125, 17); this.CHK_GymE4Only.TabIndex = 295; @@ -315,7 +321,7 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 100); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(9, 99); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); this.CHK_ForceFullyEvolved.TabIndex = 333; @@ -327,7 +333,7 @@ private void InitializeComponent() this.CHK_GymTrainers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_GymTrainers.AutoSize = true; this.CHK_GymTrainers.Enabled = false; - this.CHK_GymTrainers.Location = new System.Drawing.Point(9, 133); + this.CHK_GymTrainers.Location = new System.Drawing.Point(9, 132); this.CHK_GymTrainers.Name = "CHK_GymTrainers"; this.CHK_GymTrainers.Size = new System.Drawing.Size(124, 17); this.CHK_GymTrainers.TabIndex = 292; @@ -340,7 +346,7 @@ private void InitializeComponent() this.CHK_StoryMEvos.AutoSize = true; this.CHK_StoryMEvos.Checked = true; this.CHK_StoryMEvos.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_StoryMEvos.Location = new System.Drawing.Point(9, 64); + this.CHK_StoryMEvos.Location = new System.Drawing.Point(9, 63); this.CHK_StoryMEvos.Name = "CHK_StoryMEvos"; this.CHK_StoryMEvos.Size = new System.Drawing.Size(168, 17); this.CHK_StoryMEvos.TabIndex = 291; @@ -351,7 +357,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 82); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(9, 81); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 294; @@ -362,7 +368,7 @@ private void InitializeComponent() // this.CHK_TypeTheme.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_TypeTheme.AutoSize = true; - this.CHK_TypeTheme.Location = new System.Drawing.Point(9, 117); + this.CHK_TypeTheme.Location = new System.Drawing.Point(9, 116); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); this.CHK_TypeTheme.TabIndex = 289; @@ -480,7 +486,7 @@ private void InitializeComponent() // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(21, 205); + this.CHK_6PKM.Location = new System.Drawing.Point(21, 207); this.CHK_6PKM.Name = "CHK_6PKM"; this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 293; @@ -494,7 +500,7 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass.AutoSize = true; this.CHK_IgnoreSpecialClass.Checked = true; this.CHK_IgnoreSpecialClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(40, 387); + this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(40, 435); this.CHK_IgnoreSpecialClass.Name = "CHK_IgnoreSpecialClass"; this.CHK_IgnoreSpecialClass.Size = new System.Drawing.Size(133, 17); this.CHK_IgnoreSpecialClass.TabIndex = 324; @@ -507,7 +513,7 @@ private void InitializeComponent() this.CHK_OnlySingles.AutoSize = true; this.CHK_OnlySingles.Checked = true; this.CHK_OnlySingles.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_OnlySingles.Location = new System.Drawing.Point(40, 401); + this.CHK_OnlySingles.Location = new System.Drawing.Point(40, 449); this.CHK_OnlySingles.Name = "CHK_OnlySingles"; this.CHK_OnlySingles.Size = new System.Drawing.Size(114, 17); this.CHK_OnlySingles.TabIndex = 325; @@ -517,7 +523,7 @@ private void InitializeComponent() // NUD_Damage // this.NUD_Damage.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_Damage.Location = new System.Drawing.Point(226, 264); + this.NUD_Damage.Location = new System.Drawing.Point(226, 332); this.NUD_Damage.Maximum = new decimal(new int[] { 4, 0, @@ -538,7 +544,7 @@ private void InitializeComponent() this.CHK_Damage.AutoSize = true; this.CHK_Damage.Checked = true; this.CHK_Damage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Damage.Location = new System.Drawing.Point(21, 265); + this.CHK_Damage.Location = new System.Drawing.Point(21, 333); this.CHK_Damage.Name = "CHK_Damage"; this.CHK_Damage.Size = new System.Drawing.Size(192, 17); this.CHK_Damage.TabIndex = 327; @@ -551,7 +557,7 @@ private void InitializeComponent() this.CHK_STAB.AutoSize = true; this.CHK_STAB.Checked = true; this.CHK_STAB.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_STAB.Location = new System.Drawing.Point(21, 286); + this.CHK_STAB.Location = new System.Drawing.Point(21, 354); this.CHK_STAB.Name = "CHK_STAB"; this.CHK_STAB.Size = new System.Drawing.Size(172, 17); this.CHK_STAB.TabIndex = 328; @@ -561,7 +567,7 @@ private void InitializeComponent() // NUD_STAB // this.NUD_STAB.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_STAB.Location = new System.Drawing.Point(226, 285); + this.NUD_STAB.Location = new System.Drawing.Point(226, 353); this.NUD_STAB.Maximum = new decimal(new int[] { 4, 0, @@ -586,7 +592,7 @@ private void InitializeComponent() "Randomize All", "Use Levelup Only", "Metronome Mode"}); - this.CB_Moves.Location = new System.Drawing.Point(67, 223); + this.CB_Moves.Location = new System.Drawing.Point(67, 269); this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(135, 21); this.CB_Moves.TabIndex = 330; @@ -596,7 +602,7 @@ private void InitializeComponent() // this.L_Moves.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.L_Moves.AutoSize = true; - this.L_Moves.Location = new System.Drawing.Point(19, 226); + this.L_Moves.Location = new System.Drawing.Point(19, 272); this.L_Moves.Name = "L_Moves"; this.L_Moves.Size = new System.Drawing.Size(42, 13); this.L_Moves.TabIndex = 331; @@ -607,7 +613,7 @@ private void InitializeComponent() this.CHK_NoFixedDamage.AutoSize = true; this.CHK_NoFixedDamage.Checked = true; this.CHK_NoFixedDamage.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_NoFixedDamage.Location = new System.Drawing.Point(21, 305); + this.CHK_NoFixedDamage.Location = new System.Drawing.Point(21, 313); this.CHK_NoFixedDamage.Name = "CHK_NoFixedDamage"; this.CHK_NoFixedDamage.Size = new System.Drawing.Size(281, 17); this.CHK_NoFixedDamage.TabIndex = 332; @@ -618,7 +624,7 @@ private void InitializeComponent() // this.CHK_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.CHK_ForceHighPower.AutoSize = true; - this.CHK_ForceHighPower.Location = new System.Drawing.Point(21, 245); + this.CHK_ForceHighPower.Location = new System.Drawing.Point(21, 293); this.CHK_ForceHighPower.Name = "CHK_ForceHighPower"; this.CHK_ForceHighPower.Size = new System.Drawing.Size(203, 17); this.CHK_ForceHighPower.TabIndex = 344; @@ -628,7 +634,7 @@ private void InitializeComponent() // NUD_ForceHighPower // this.NUD_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_ForceHighPower.Location = new System.Drawing.Point(226, 243); + this.NUD_ForceHighPower.Location = new System.Drawing.Point(226, 291); this.NUD_ForceHighPower.Minimum = new decimal(new int[] { 1, 0, @@ -643,11 +649,77 @@ private void InitializeComponent() 0, 0}); // + // L_MinPKM + // + this.L_MinPKM.Location = new System.Drawing.Point(5, 224); + this.L_MinPKM.Name = "L_MinPKM"; + this.L_MinPKM.Size = new System.Drawing.Size(60, 20); + this.L_MinPKM.TabIndex = 348; + this.L_MinPKM.Text = "Min PKM:"; + this.L_MinPKM.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_MaxPKM + // + this.L_MaxPKM.Location = new System.Drawing.Point(5, 244); + this.L_MaxPKM.Name = "L_MaxPKM"; + this.L_MaxPKM.Size = new System.Drawing.Size(60, 20); + this.L_MaxPKM.TabIndex = 347; + this.L_MaxPKM.Text = "Max PKM:"; + this.L_MaxPKM.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_RMin + // + this.NUD_RMin.Location = new System.Drawing.Point(67, 224); + this.NUD_RMin.Maximum = new decimal(new int[] { + 6, + 0, + 0, + 0}); + this.NUD_RMin.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_RMin.Name = "NUD_RMin"; + this.NUD_RMin.Size = new System.Drawing.Size(40, 20); + this.NUD_RMin.TabIndex = 346; + this.NUD_RMin.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // NUD_RMax + // + this.NUD_RMax.Location = new System.Drawing.Point(67, 246); + this.NUD_RMax.Maximum = new decimal(new int[] { + 6, + 0, + 0, + 0}); + this.NUD_RMax.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_RMax.Name = "NUD_RMax"; + this.NUD_RMax.Size = new System.Drawing.Size(40, 20); + this.NUD_RMax.TabIndex = 345; + this.NUD_RMax.Value = new decimal(new int[] { + 6, + 0, + 0, + 0}); + // // TrainerRand // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(304, 465); + this.ClientSize = new System.Drawing.Size(304, 513); + this.Controls.Add(this.L_MinPKM); + this.Controls.Add(this.L_MaxPKM); + this.Controls.Add(this.NUD_RMin); + this.Controls.Add(this.NUD_RMax); this.Controls.Add(this.CHK_ForceHighPower); this.Controls.Add(this.NUD_ForceHighPower); this.Controls.Add(this.CHK_NoFixedDamage); @@ -689,6 +761,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -738,5 +812,9 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_ForceHighPower; private System.Windows.Forms.NumericUpDown NUD_ForceHighPower; + private System.Windows.Forms.Label L_MinPKM; + private System.Windows.Forms.Label L_MaxPKM; + private System.Windows.Forms.NumericUpDown NUD_RMin; + private System.Windows.Forms.NumericUpDown NUD_RMax; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index f02a0de2d8..04096d97de 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -71,6 +71,8 @@ private void B_Save_Click(object sender, EventArgs e) RSTE.rTypeTheme = CHK_TypeTheme.Checked; RSTE.rTypeGymTrainers = CHK_GymTrainers.Checked; RSTE.rGymE4Only = CHK_GymE4Only.Checked; + RSTE.rMinPKM = NUD_RMin.Value; + RSTE.rMaxPKM = NUD_RMax.Value; RSTE.r6PKM = CHK_6PKM.Checked; RSTE.rRandomMegas = CHK_RandomMegaForm.Checked; RSTE.rForceFullyEvolved = CHK_ForceFullyEvolved.Checked; From 3b5bb9c591127259886c8a139c5a4699570790af Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 2 Jun 2018 16:51:13 -0700 Subject: [PATCH 109/191] Add battle exclusive form check Closes #344 --- pk3DS.Core/Legality/Legal.cs | 37 +++++++++++++++++++++++- pk3DS.Core/Randomizers/FormRandomizer.cs | 4 ++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index cd120e33d7..3056e6878f 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; namespace pk3DS.Core { @@ -415,5 +416,39 @@ public static partial class Legal { 804, 805, 806, 807 }).ToArray(); + + public static readonly HashSet BattleForms = new HashSet + { + 351, // Castform + 421, // Cherrim + 555, // Darmanitan + 648, // Meloetta + 681, // Aegislash + 716, // Xerneas + 746, // Wishiwashi + 778, // Mimikyu + }; + public static readonly HashSet BattleMegas = new HashSet + { + // XY + 3,6,9,65,80, + 115,127,130,142,150,181, + 212,214,229,248,282, + 303,306,308,310,354,359,380,381, + 445,448,460, + + // AO + 15,18,94, + 208,254,257,260, + 302,319,323,334,362,373,376,384, + 428,475, + 531, + 719, + + // USUM + 800, // Ultra Necrozma + }; + public static readonly HashSet BattlePrimals = new HashSet { 382, 383 }; + public static HashSet BattleExclusiveForms = new HashSet(BattleForms.Concat(BattleMegas.Concat(BattlePrimals))); } } diff --git a/pk3DS.Core/Randomizers/FormRandomizer.cs b/pk3DS.Core/Randomizers/FormRandomizer.cs index 8e7d3fdd15..1c1031ecbf 100644 --- a/pk3DS.Core/Randomizers/FormRandomizer.cs +++ b/pk3DS.Core/Randomizers/FormRandomizer.cs @@ -23,6 +23,8 @@ public int GetRandomForme(int species, PersonalInfo[] stats = null) switch (species) { + case 658 when !AllowMega: + return 0; case 664: case 665: case 666: // Vivillon evo chain return 30; // save file specific case 774: // Minior @@ -31,7 +33,7 @@ public int GetRandomForme(int species, PersonalInfo[] stats = null) if (AllowAlolanForm && Legal.EvolveToAlolanForms.Contains(species)) return (int)(Util.rnd32() % 2); - if (!Legal.Mega_ORAS.Contains((ushort)species) || AllowMega) + if (!Legal.BattleExclusiveForms.Contains(species) || AllowMega) return (int)(Util.rnd32() % stats[species].FormeCount); // Slot-Random return 0; } From b2a4788f4dbe546c1664f40505a1d0df5ffacaf7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 3 Jun 2018 12:02:33 -0700 Subject: [PATCH 110/191] de-tab main cs --- pk3DS/Main.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index f49efaced5..55ac708324 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -199,7 +199,7 @@ private void openQuick(string path) string newtext = $"Game Loaded: {Config.Version}"; if (L_Game.Text != newtext && Directory.Exists("personal")) { Directory.Delete("personal", true); } // Force reloading of personal data if the game is switched. - L_Game.Text = newtext; TB_Path.Text = path; + L_Game.Text = newtext; TB_Path.Text = path; } else if (ExeFSPath != null) { L_Game.Text = "ExeFS loaded - no RomFS"; TB_Path.Text = path; } @@ -220,7 +220,7 @@ private void openQuick(string path) Menu_ExeFS.Enabled = ExeFSPath != null; Menu_RomFS.Enabled = Menu_Restore.Enabled = Menu_GARCs.Enabled = RomFSPath != null; Menu_Patch.Enabled = RomFSPath != null && ExeFSPath != null; - Menu_3DS.Enabled = + Menu_3DS.Enabled = ExHeaderPath != null && RomFSPath != null && ExeFSPath != null; // Change L_Game if RomFS and ExeFS exists to a better descriptor @@ -283,7 +283,7 @@ private void updateGameInfo() // 5 - ES // 6 - CHS // 7 - KO - // 8 - + // 8 - // 11 - CHT int[] AILang = { 0, 0, 1, 2, 4, 3, 5, 7, 8, 9, 6, 11 }; Text = SMDH?.AppSettings == null @@ -349,7 +349,7 @@ private bool checkIfExeFS(string path) // unpack successful, continue onward! } - if (files.Length != 3 && files.Length != 4) + if (files.Length != 3 && files.Length != 4) return false; FileInfo fi = new FileInfo(files[0]); @@ -375,7 +375,7 @@ private bool checkIfExHeader(string path) ExHeaderPath = null; // Input folder path should contain the ExHeader. string[] files = Directory.GetFiles(path); - foreach (string fp in from s in files let f = new FileInfo(s) where (f.Name.ToLower().StartsWith("exh") || f.Name.ToLower().StartsWith("decryptedexh")) && f.Length == 0x800 select s) + foreach (string fp in from s in files let f = new FileInfo(s) where (f.Name.ToLower().StartsWith("exh") || f.Name.ToLower().StartsWith("decryptedexh")) && f.Length == 0x800 select s) ExHeaderPath = fp; return ExHeaderPath != null; @@ -475,7 +475,7 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g) "Yes: Save changes, dump errata/failed text", "No: Save changes, don't dump errata/failed text" }; - var dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Errors found while attempting to save text." + var dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Errors found while attempting to save text." + Environment.NewLine + "Example: " + errata[0], string.Join(Environment.NewLine, options)); if (dr == DialogResult.Cancel) @@ -1037,7 +1037,7 @@ private void B_Static_Click(object sender, EventArgs e) { var esg = Config.getGARCData("encounterstatic"); byte[][] es = esg.Files; - + Invoke((Action)(() => new StaticEncounterEditor7(es).ShowDialog())); esg.Files = es; esg.Save(); @@ -1127,7 +1127,7 @@ private void Menu_LZ11_Click(object sender, EventArgs e) "Yes = Decompress\nNo = Compress\nCancel = Abort"); new Thread(() => { - threads++; + threads++; if (dr == DialogResult.Yes) { try From 3c412f0a0fce5870ad1434f6d8e34ea568dbb341 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 10 Jun 2018 10:55:49 -0700 Subject: [PATCH 111/191] reattach progressbar & label Closes #345 --- pk3DS/GarcUtil.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pk3DS/GarcUtil.cs b/pk3DS/GarcUtil.cs index 7ced976676..d6f61ffbea 100644 --- a/pk3DS/GarcUtil.cs +++ b/pk3DS/GarcUtil.cs @@ -51,10 +51,12 @@ private static void GARC_UnpackProgressed(object sender, GARC.UnpackProgressedEv public static bool garcPackMS(string folderPath, string garcPath, int version, int bytesPadding, ProgressBar pBar1 = null, Label label = null, bool supress = false) { + GarcUtil.pBar1 = pBar1; + GarcUtil.label = label; GARC.FileCountDetermined += GARC_FileCountDetermined; GARC.PackProgressed += GARC_PackProgressed; try - { + { var filectr = GARC.garcPackMS(folderPath, garcPath, version, bytesPadding); if (filectr > 0) { @@ -90,6 +92,8 @@ public static bool garcPackMS(string folderPath, string garcPath, int version, i public static bool garcUnpack(string garcPath, string outPath, bool skipDecompression, ProgressBar pBar1 = null, Label label = null, bool supress = false, bool bypassExt = false) { + GarcUtil.pBar1 = pBar1; + GarcUtil.label = label; GARC.FileCountDetermined += GARC_FileCountDetermined; GARC.UnpackProgressed += GARC_UnpackProgressed; try From 7685d5beb21287c4a80e51e7140f3d42cd00dd34 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 16 Jun 2018 00:21:33 -0400 Subject: [PATCH 112/191] Revise HM randomizer check --- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index 7334e71cb8..4c898926f6 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -159,7 +159,7 @@ private void formClosing(object sender, FormClosingEventArgs e) private void B_RandomTM_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize TMs? Cannot undo.", "Move compatibility will be the same as the base TMs.") != DialogResult.Yes) return; - if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomizing HMs can halt story progression!", "Continue anyway?") != DialogResult.Yes) return; + if (CHK_RandomizeHM.Checked && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomizing HMs can halt story progression!", "Continue anyway?") != DialogResult.Yes) return; int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray(); Util.Shuffle(randomMoves); From da0f1f6eca0c76eeb11a1ade8d35b9dc87389179 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 19 Jun 2018 21:28:39 -0700 Subject: [PATCH 113/191] reorder learnset by base power when randomizing --- pk3DS.Core/Randomizers/LearnsetRandomizer.cs | 9 ++++++--- pk3DS.Core/Randomizers/MoveRandomizer.cs | 13 ++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs index 74b38901cb..3303cb6ee8 100644 --- a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs +++ b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs @@ -6,8 +6,8 @@ namespace pk3DS.Core.Randomizers { // https://twitter.com/Drayano60/status/807297858244411397 - // ORAS: 10682 moves learned on levelup/birth. - // 5593 are STAB. 52.3% are STAB. + // ORAS: 10682 moves learned on levelup/birth. + // 5593 are STAB. 52.3% are STAB. // Steelix learns the most @ 25 (so many level 1)! // Move relearner ingame glitch fixed (52 tested), but keep below 75 public class LearnsetRandomizer : IRandomizer @@ -30,11 +30,12 @@ public LearnsetRandomizer(GameConfig config, Learnset[] sets) public int SpreadTo = 75; public bool STABFirst = true; public bool Learn4Level1 = false; + public bool OrderByPower = true; public bool STAB { set => moverand.rSTAB = value; } public IList BannedMoves { set => moverand.BannedMoves = value; } public decimal rSTABPercent { set => moverand.rSTABPercent = value; } - + public void Execute() { for (var i = 0; i < Learnsets.Length; i++) @@ -91,6 +92,8 @@ private int[] GetRandomMoves(int count, int index) // STAB Moves (if requested) come first; randomize the order of moves Util.Shuffle(rand); + if (OrderByPower) + moverand.ReorderMovesPower(rand); rand.CopyTo(moves, 1); return moves; } diff --git a/pk3DS.Core/Randomizers/MoveRandomizer.cs b/pk3DS.Core/Randomizers/MoveRandomizer.cs index 52257630b7..7f0a69e394 100644 --- a/pk3DS.Core/Randomizers/MoveRandomizer.cs +++ b/pk3DS.Core/Randomizers/MoveRandomizer.cs @@ -91,6 +91,17 @@ private bool IsMovesetMeetingRequirements(int[] moves, int count) return moves.Distinct().Count() == count; } + public void ReorderMovesPower(IList moves) + { + var data = moves.Select((Move, Index) => new {Index, Move, Data = MoveData[Move]}); + var powered = data.Where(z => z.Data.Power > 1).ToList(); + var indexes = powered.Select(z => z.Index).ToList(); + var order = powered.OrderBy(z => z.Data.Power * Math.Max(1, (z.Data.HitMin + z.Data.HitMax)/2m)).ToList(); + + for (var i = 0; i < order.Count; i++) + moves[indexes[i]] = order[i].Move; + } + private static readonly int[] firstMoves = { 1, // Pound @@ -103,7 +114,7 @@ private bool IsMovesetMeetingRequirements(int[] moves, int count) 98, // Quick Attack 122, // Lick 141, // Leech Life - + }; private static readonly GenericRandomizer first = new GenericRandomizer(firstMoves); public int GetRandomFirstMoveAny() From 406f0602c8f6c3319711cae70cf786082c78f951 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 2 Aug 2018 00:24:27 -0400 Subject: [PATCH 114/191] Add lazy fix for SM trainer rand (#350) --- pk3DS.Core/Legality/Legal.cs | 17 ++++++++--------- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 1 - pk3DS/Subforms/Gen7/SMTE.cs | 8 ++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 3056e6878f..fe445a8eac 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -431,17 +431,16 @@ public static partial class Legal public static readonly HashSet BattleMegas = new HashSet { // XY - 3,6,9,65,80, - 115,127,130,142,150,181, - 212,214,229,248,282, - 303,306,308,310,354,359,380,381, - 445,448,460, + 003, 006, 009, 065, 080, 115, 127, 130, 142, 150, + 181, 212, 214, 229, 248, + 257, 282, 303, 306, 308, 310, 354, 359, 380, 381, + 445, 448, 460, // AO - 15,18,94, - 208,254,257,260, - 302,319,323,334,362,373,376,384, - 428,475, + 015, 018, 094, + 208, + 254, 260, 302, 319, 323, 334, 362, 373, 376, 384, + 428, 475, 531, 719, diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 812971227b..32896797b7 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -205,7 +205,6 @@ private void AddGen7Species(List list) if (L) list.AddRange(Enumerable.Range(803, 4)); // Poipole, Naganadel, Stakataka, Blacephalon if (E) list.Add(807); // Zeraora } - } public int[] RandomSpeciesList => Enumerable.Range(1, MaxSpeciesID).ToArray(); diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 66757c5547..bd3c75b12c 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -725,6 +725,14 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.Item = items[Util.rnd32() % items.Length]; pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); } + + // lazy fix for USUM-only species + if (Main.Config.SM && pk.Species > 802) + { + pk.Species = 1; + pk.Form = 0; + } + pk.Gender = 0; // random pk.Nature = (int)(Util.rnd32() % CB_Nature.Items.Count); // random } From cb269eca2b4f85af07ebf100df05bc7baafcf1e5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 5 Aug 2018 00:53:28 -0700 Subject: [PATCH 115/191] Update move data Add export button too for both gens --- pk3DS.Core/Structures/Gen6/Move6.cs | 168 ++++++++++---------- pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs | 13 ++ pk3DS/Subforms/Gen6/MoveEditor6.cs | 36 +++-- pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs | 13 ++ pk3DS/Subforms/Gen7/MoveEditor7.cs | 33 ++-- 5 files changed, 152 insertions(+), 111 deletions(-) diff --git a/pk3DS.Core/Structures/Gen6/Move6.cs b/pk3DS.Core/Structures/Gen6/Move6.cs index e4127c1458..1118dc463e 100644 --- a/pk3DS.Core/Structures/Gen6/Move6.cs +++ b/pk3DS.Core/Structures/Gen6/Move6.cs @@ -1,102 +1,98 @@ using System; -using System.IO; namespace pk3DS.Core.Structures { public class Move { - public byte Type, Quality, Category, Power, Accuracy, PP, Priority, InflictPercent, - HitMin, HitMax, TurnMin, TurnMax, CritStage, Flinch, Recoil, Targeting, - Stat1, Stat2, Stat3, - Stat1Stage, Stat2Stage, Stat3Stage, - Stat1Percent, Stat2Percent, Stat3Percent; + private const int SIZE = 0x22; + private readonly byte[] Data; + public Move() => Data = new byte[SIZE]; + public Move(byte[] data) => Data = data ?? new byte[SIZE]; + public byte[] Write() => Data; + + public int Type { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public int Quality { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public int Category { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public int Power { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public int Accuracy { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public int PP { get => Data[0x05]; set => Data[0x05] = (byte)value; } + public int Priority { get => Data[0x06]; set => Data[0x06] = (byte)value; } + public int HitMin { get => Data[0x07] & 0xF; set => Data[0x07] = (byte)(HitMax << 4 | value); } + public int HitMax { get => Data[0x07] >> 4; set => Data[0x07] = (byte)(value << 4 | HitMin); } + public int Inflict { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } + public int InflictPercent { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } + public MoveInflictDuration InflictCount { get => (MoveInflictDuration)Data[0x0B]; set => Data[0x0B] = (byte)value; } + public int TurnMin { get => Data[0x0C]; set => Data[0x0C] = (byte)value; } + public int TurnMax { get => Data[0x0D]; set => Data[0x0D] = (byte)value; } + public int CritStage { get => Data[0x0E]; set => Data[0x0E] = (byte)value; } + public int Flinch { get => Data[0x0F]; set => Data[0x0F] = (byte)value; } + public int EffectSequence { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } + public int Recoil { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public Heal Healing { get => (Heal)Data[0x13]; set => Data[0x13] = (byte)value; } + public MoveTarget Target { get => (MoveTarget)Data[0x14]; set => Data[0x14] = (byte)value; } + public int Stat1 { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public int Stat2 { get => Data[0x16]; set => Data[0x16] = (byte)value; } + public int Stat3 { get => Data[0x17]; set => Data[0x17] = (byte)value; } + public int Stat1Stage { get => Data[0x18]; set => Data[0x18] = (byte)value; } + public int Stat2Stage { get => Data[0x19]; set => Data[0x19] = (byte)value; } + public int Stat3Stage { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } + public int Stat1Percent { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + public int Stat2Percent { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public int Stat3Percent { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } + + public MoveFlag Flags { get => (MoveFlag)BitConverter.ToUInt32(Data, 0x1E); set => BitConverter.GetBytes((uint)value).CopyTo(Data, 0x1E); } - public Heal Healing; - public ushort Inflict, Effect; - public byte _0xB, _0x1E, _0x1F, _0x20, _0x21; - public Move(byte[] data) - { - Type = data[0]; - Quality = data[1]; - Category = data[2]; - Power = data[3]; - Accuracy = data[4]; - PP = data[5]; - Priority = data[6]; - HitMin = (byte)(data[7] & 0xF); - HitMax = (byte)(data[7] >> 4); - Inflict = BitConverter.ToUInt16(data, 0x8); - InflictPercent = data[0xA]; - _0xB = data[0xB]; - TurnMin = data[0xC]; - TurnMax = data[0xD]; - CritStage = data[0xE]; - Flinch = data[0xF]; - Effect = BitConverter.ToUInt16(data, 0x10); - Recoil = data[0x12]; - Healing = (Heal)data[0x13]; - Targeting = data[0x14]; - Stat1 = data[0x15]; - Stat2 = data[0x16]; - Stat3 = data[0x17]; - Stat1Stage = data[0x18]; - Stat2Stage = data[0x19]; - Stat3Stage = data[0x1A]; - Stat1Percent = data[0x1B]; - Stat2Percent = data[0x1C]; - Stat3Percent = data[0x1D]; - _0x1E = data[0x1E]; - _0x1F = data[0x1F]; - _0x20 = data[0x20]; - _0x21 = data[0x21]; - } - public byte[] Write() - { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - bw.Write(Type); - bw.Write(Quality); - bw.Write(Category); - bw.Write(Power); - bw.Write(Accuracy); - bw.Write(PP); - bw.Write(Priority); - bw.Write((byte)(HitMin | (HitMax << 4))); - bw.Write(Inflict); - bw.Write(InflictPercent); - bw.Write(_0xB); - bw.Write(TurnMin); - bw.Write(TurnMax); - bw.Write(CritStage); - bw.Write(Flinch); - bw.Write(Effect); - bw.Write(Recoil); - bw.Write((byte)Healing); - bw.Write(Targeting); - bw.Write(Stat1); - bw.Write(Stat2); - bw.Write(Stat3); - bw.Write(Stat1Stage); - bw.Write(Stat2Stage); - bw.Write(Stat3Stage); - bw.Write(Stat1Percent); - bw.Write(Stat2Percent); - bw.Write(Stat3Percent); - bw.Write(_0x1E); - bw.Write(_0x1F); - bw.Write(_0x20); - bw.Write(_0x21); - return ms.ToArray(); - } - } public enum Heal : byte { None = 0, - Full = 255, Half = 254, Quarter = 253, } } + + public enum MoveInflictDuration + { + None = 0, + Permanent, + TurnCount, + Unused, + Switch, + }; + + public enum MoveTarget : byte + { + // Specific target + AnyExceptSelf, + AllyOrSelf, + Ally, + Opponent, + AllAdjacent, + AllAdjacentOpponents, + AllAllies, + Self, + All, + RandomOpponent, + + // No pkm target + SideAll, + SideOpponent, + SideSelf, + Counter, + } + + [Flags] + public enum MoveFlag : uint + { + None, + // TBD + } + + public static class MoveFlagExtensions + { + public static bool HasFlagFast(this MoveFlag value, MoveFlag flag) + { + return (value & flag) != 0; + } + } } diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs index 9a28487603..5c96d69346 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs @@ -93,6 +93,7 @@ private void InitializeComponent() this.CHK_Category = new System.Windows.Forms.CheckBox(); this.CHK_Type = new System.Windows.Forms.CheckBox(); this.B_Metronome = new System.Windows.Forms.Button(); + this.B_Table = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).BeginInit(); @@ -842,11 +843,22 @@ private void InitializeComponent() this.B_Metronome.UseVisualStyleBackColor = true; this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); // + // B_Table + // + this.B_Table.Location = new System.Drawing.Point(356, 117); + this.B_Table.Name = "B_Table"; + this.B_Table.Size = new System.Drawing.Size(75, 23); + this.B_Table.TabIndex = 66; + this.B_Table.Text = "Export Table"; + this.B_Table.UseVisualStyleBackColor = true; + this.B_Table.Click += new System.EventHandler(this.B_Table_Click); + // // MoveEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(439, 381); + this.Controls.Add(this.B_Table); this.Controls.Add(this.B_Metronome); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_RandAll); @@ -1004,5 +1016,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Category; private System.Windows.Forms.CheckBox CHK_Type; private System.Windows.Forms.Button B_Metronome; + private System.Windows.Forms.Button B_Table; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index 4d00e02ed8..5331b5e7cf 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -1,6 +1,8 @@ using pk3DS.Core; using System; +using System.Linq; using System.Windows.Forms; +using pk3DS.Core.Structures; namespace pk3DS { @@ -23,25 +25,25 @@ public MoveEditor6(byte[][] infiles) private readonly string[] StatCategories = { "None", "Attack", "Defense", "Special Attack", "Special Defense", "Speed", "Accuracy", "Evasion", "All", }; private readonly string[] TargetingTypes = - { "Single Adjacent Ally/Foe", - "Any Ally", "Any Adjacent Ally", "Single Adjacent Foe", "Everyone but User", "All Foes", - "All Allies", "Self", "All Pokémon on Field", "Single Adjacent Foe (2)", "Entire Field", - "Opponent's Field", "User's Field", "Self", + { "Single Adjacent Ally/Foe", + "Any Ally", "Any Adjacent Ally", "Single Adjacent Foe", "Everyone but User", "All Foes", + "All Allies", "Self", "All Pokémon on Field", "Single Adjacent Foe (2)", "Entire Field", + "Opponent's Field", "User's Field", "Self", }; private readonly string[] InflictionTypes = - { "None", - "Paralyze", "Sleep", "Freeze", "Burn", "Poison", - "Confusion", "Attract", "Capture", "Nightmare", "Curse", - "Taunt", "Torment", "Disable", "Yawn", "Heal Block", - "?", "Detect", "Leech Seed", "Embargo", "Perish Song", - "Ingrain", + { "None", + "Paralyze", "Sleep", "Freeze", "Burn", "Poison", + "Confusion", "Attract", "Capture", "Nightmare", "Curse", + "Taunt", "Torment", "Disable", "Yawn", "Heal Block", + "?", "Detect", "Leech Seed", "Embargo", "Perish Song", + "Ingrain", }; private readonly string[] MoveQualities = - { "Only DMG", - "No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat", - "DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field", + { "Only DMG", + "No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat", + "DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field", "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", }; private void Setup() { @@ -158,6 +160,14 @@ private void setEntry() } files[entry] = data; } + + private void B_Table_Click(object sender, EventArgs e) + { + var items = files.Select(z => new Move(z)); + Clipboard.SetText(TableUtil.GetTable(items, movelist)); + System.Media.SystemSounds.Asterisk.Play(); + } + private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs index e2e1f076ea..aa45f9b82f 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs @@ -93,6 +93,7 @@ private void InitializeComponent() this.CHK_Category = new System.Windows.Forms.CheckBox(); this.CHK_Type = new System.Windows.Forms.CheckBox(); this.B_Metronome = new System.Windows.Forms.Button(); + this.B_Table = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).BeginInit(); @@ -842,11 +843,22 @@ private void InitializeComponent() this.B_Metronome.UseVisualStyleBackColor = true; this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); // + // B_Table + // + this.B_Table.Location = new System.Drawing.Point(356, 117); + this.B_Table.Name = "B_Table"; + this.B_Table.Size = new System.Drawing.Size(75, 23); + this.B_Table.TabIndex = 67; + this.B_Table.Text = "Export Table"; + this.B_Table.UseVisualStyleBackColor = true; + this.B_Table.Click += new System.EventHandler(this.B_Table_Click); + // // MoveEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(439, 381); + this.Controls.Add(this.B_Table); this.Controls.Add(this.B_Metronome); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_RandAll); @@ -1004,5 +1016,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_Category; private System.Windows.Forms.CheckBox CHK_Type; private System.Windows.Forms.Button B_Metronome; + private System.Windows.Forms.Button B_Table; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index 35b4db24dc..829251ba20 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -1,6 +1,8 @@ using pk3DS.Core; using System; +using System.Linq; using System.Windows.Forms; +using pk3DS.Core.Structures; namespace pk3DS { @@ -23,25 +25,25 @@ public MoveEditor7(byte[][] infiles) private readonly string[] StatCategories = { "None", "Attack", "Defense", "Special Attack", "Special Defense", "Speed", "Accuracy", "Evasion", "All", }; private readonly string[] TargetingTypes = - { "Single Adjacent Ally/Foe", - "Any Ally", "Any Adjacent Ally", "Single Adjacent Foe", "Everyone but User", "All Foes", - "All Allies", "Self", "All Pokémon on Field", "Single Adjacent Foe (2)", "Entire Field", - "Opponent's Field", "User's Field", "Self", + { "Single Adjacent Ally/Foe", + "Any Ally", "Any Adjacent Ally", "Single Adjacent Foe", "Everyone but User", "All Foes", + "All Allies", "Self", "All Pokémon on Field", "Single Adjacent Foe (2)", "Entire Field", + "Opponent's Field", "User's Field", "Self", }; private readonly string[] InflictionTypes = - { "None", - "Paralyze", "Sleep", "Freeze", "Burn", "Poison", - "Confusion", "Attract", "Capture", "Nightmare", "Curse", - "Taunt", "Torment", "Disable", "Yawn", "Heal Block", - "?", "Detect", "Leech Seed", "Embargo", "Perish Song", + { "None", + "Paralyze", "Sleep", "Freeze", "Burn", "Poison", + "Confusion", "Attract", "Capture", "Nightmare", "Curse", + "Taunt", "Torment", "Disable", "Yawn", "Heal Block", + "?", "Detect", "Leech Seed", "Embargo", "Perish Song", "Ingrain", "??? 0x16", "??? 0x17", "Mute" }; private readonly string[] MoveQualities = - { "Only DMG", - "No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat", - "DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field", + { "Only DMG", + "No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat", + "DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field", "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", }; private void Setup() { @@ -164,6 +166,13 @@ private void formClosing(object sender, FormClosingEventArgs e) RandSettings.SetFormSettings(this, groupBox1.Controls); } + private void B_Table_Click(object sender, EventArgs e) + { + var items = files.Select(z => new Move(z)); + Clipboard.SetText(TableUtil.GetTable(items, movelist)); + System.Media.SystemSounds.Asterisk.Play(); + } + private void B_RandAll_Click(object sender, EventArgs e) { if (!CHK_Category.Checked && !CHK_Type.Checked) From 7943fbc750b908147df9cf82b24f226102bc5ca6 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 5 Aug 2018 11:03:18 -0700 Subject: [PATCH 116/191] Update Item stats --- pk3DS.Core/Structures/Gen6/Item6.cs | 108 ++++++++++++++++++++++------ 1 file changed, 88 insertions(+), 20 deletions(-) diff --git a/pk3DS.Core/Structures/Gen6/Item6.cs b/pk3DS.Core/Structures/Gen6/Item6.cs index 05c2af9612..8228ea4294 100644 --- a/pk3DS.Core/Structures/Gen6/Item6.cs +++ b/pk3DS.Core/Structures/Gen6/Item6.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Runtime.InteropServices; namespace pk3DS.Core.Structures @@ -15,18 +16,22 @@ public struct Item #region Structure private ushort Price; + [Category(Battle)] public byte HeldEffect { get; set; } + public byte HeldArgument { get; set; } public byte NaturalGiftEffect { get; set; } public byte FlingEffect { get; set; } public byte FlingPower { get; set; } - private byte NaturalGiftPower { get; set; } - public byte NaturalGiftTypeFlags { get; set; } - public byte KeyFlags { get; set; } + public byte NaturalGiftPower { get; set; } + public ushort Packed { get; set; } + [Category(Field), Description("Routine # to call when used; 0=unusable.")] - public byte UseEffect { get; set; } - public byte _0xB { get; set; } // Battle Type + public byte EffectField { get; set; } + + [Category(Battle), Description("Routine # to call when used; 0=unusable.")] + public byte EffectBattle { get; set; } // Battle Type public byte _0xC { get; set; } // 0 or 1 public byte _0xD { get; set; } // Classification (0-3 Battle, 4 Balls, 5 Mail) public byte Consumable { get; set; } @@ -35,25 +40,34 @@ public struct Item private byte Boost0; // Revive 1, Sacred Ash 3, Rare Candy 5, EvoStone 8, upper4 for BoostAtk private byte Boost1; // DEF, SPA private byte Boost2; // SPD, SPE - private byte Boost3; // ACC, CRIT - public byte FunctionFlags0 { get; set; } - public byte FunctionFlags1{ get; set; } + private byte Boost3; // ACC, CRIT PPUpFlags + public ItemFlags1 FunctionFlags0 { get; set; } + public ItemFlags2 FunctionFlags1 { get; set; } + [Category(Field), Description("Adds EVs to the HP stat.")] public sbyte EVHP { get; set; } + [Category(Field), Description("Adds EVs to the Attack stat.")] public sbyte EVATK { get; set; } + [Category(Field), Description("Adds EVs to the Defense stat.")] public sbyte EVDEF { get; set; } + [Category(Field), Description("Adds EVs to the Speed stat.")] public sbyte EVSPE { get; set; } + [Category(Field), Description("Adds EVs to the Sp. Attack stat.")] public sbyte EVSPA { get; set; } + [Category(Field), Description("Adds EVs to the Sp. Defense stat.")] public sbyte EVSPD { get; set; } + [Category(Heal), Description("Determines the healing percent, or if a flat value is used."), RefreshProperties(RefreshProperties.All)] public HealValue HealAmount { get; set; } + [Category(Field), Description("PP to be added to the move's current PP if used.")] public byte PPGain { get; set; } + public sbyte Friendship1 { get; set; } public sbyte Friendship2 { get; set; } public sbyte Friendship3 { get; set; } @@ -62,35 +76,51 @@ public struct Item [Category(Mart), RefreshProperties(RefreshProperties.All)] public int BuyPrice { get => Price * 10; set => Price = (ushort)(value / 10); } + [Category(Mart), ReadOnly(true)] public int SellPrice { get => Price * 5; set => Price = (ushort)(value / 5); } [Category(Battle)] - public int NaturalGiftType { get => NaturalGiftTypeFlags & 0x1F; set => NaturalGiftTypeFlags = (byte)(NaturalGiftEffect & ~0x1F | value); } + public int NaturalGiftType { get => Packed & 0x1F; set => Packed = (ushort)((NaturalGiftEffect & ~0x1F) | value); } + [Category(Battle)] - public int U8Flags { get => NaturalGiftTypeFlags >> 5; set => NaturalGiftTypeFlags = (byte)(NaturalGiftEffect & 0x1F | (value << 5)); } + public bool Flag1 { get => ((Packed >> 5) & 1) == 1; set => Packed = (ushort)((Packed & ~(1 << 5)) | ((value ? 1 : 0) << 5)); } [Category(Battle)] - public int FieldEffect { get => Boost0 & 0xF; set => Boost0 = (byte)(Boost0 & ~0xF | (value & 0xF)); } + public bool Flag2 { get => ((Packed >> 6) & 1) == 1; set => Packed = (ushort)((Packed & ~(1 << 6)) | ((value ? 1 : 0) << 6)); } + + [Category(Field)] + public int PocketField { get => (Packed >> 7) & 0xF; set => Packed = (ushort)((Packed & 0xF87F) | ((value & 0xF) << 7)); } + [Category(Battle)] - public int BoostATK { get => Boost0 >> 4; set => Boost0 = (byte)(Boost0 & 0xF | (value << 4)); } + public BattlePocket PocketBattle { get => (BattlePocket)(Packed >> 11); set => Packed = (ushort)((Packed & 0x077F) | (((byte)value & 0x1F) << 11)); } [Category(Battle)] - public int BoostDEF { get => Boost1 & 0xF; set => Boost1 = (byte)(Boost1 & ~0xF | (value & 0xF)); } + public int FieldEffect { get => Boost0 & 0xF; set => Boost0 = (byte)((Boost0 & ~0xF) | (value & 0xF)); } + + [Category(Battle)] + public int BoostATK { get => Boost0 >> 4; set => Boost0 = (byte)((Boost0 & 0xF) | (value << 4)); } + [Category(Battle)] - public int BoostSPA { get => Boost1 >> 4; set => Boost1 = (byte)(Boost1 & 0xF | (value << 4)); } + public int BoostDEF { get => Boost1 & 0xF; set => Boost1 = (byte)((Boost1 & ~0xF) | (value & 0xF)); } [Category(Battle)] - public int BoostSPD { get => Boost2 & 0xF; set => Boost2 = (byte)(Boost2 & ~0xF | (value & 0xF)); } + public int BoostSPA { get => Boost1 >> 4; set => Boost1 = (byte)((Boost1 & 0xF) | (value << 4)); } + [Category(Battle)] - public int BoostSPE { get => Boost2 >> 4; set => Boost2 = (byte)(Boost2 & 0xF | (value << 4)); } + public int BoostSPD { get => Boost2 & 0xF; set => Boost2 = (byte)((Boost2 & ~0xF) | (value & 0xF)); } [Category(Battle)] - public int BoostACC { get => Boost0 & 0xF; set => Boost0 = (byte)(Boost3 & ~0xF | (value & 0xF)); } + public int BoostSPE { get => Boost2 >> 4; set => Boost2 = (byte)((Boost2 & 0xF) | (value << 4)); } + [Category(Battle)] - public int BoostCRIT { get => (Boost3 >> 4) & 3; set => Boost3 = (byte)(Boost3 & ~0x30 | ((value & 3) << 4)); } + public int BoostACC { get => Boost0 & 0xF; set => Boost0 = (byte)((Boost3 & ~0xF) | (value & 0xF)); } + [Category(Battle)] - public int BoostPP { get => (Boost3 >> 6) & 3; set => Boost3 = (byte)(Boost3 & 0x3F | ((value & 3) << 6)); } + public int BoostCRIT { get => (Boost3 >> 4) & 3; set => Boost3 = (byte)((Boost3 & ~0x30) | ((value & 3) << 4)); } + + [Category(Battle), Description("1 = One PP Up, 3 = PP Max")] + public int BoostPP { get => (Boost3 >> 6) & 3; set => Boost3 = (byte)((Boost3 & 0x3F) | ((value & 3) << 6)); } [Category(Heal), Description("Raw value of the Heal enum."), RefreshProperties(RefreshProperties.All)] public int HealValue @@ -99,4 +129,42 @@ public int HealValue set => HealAmount = (HealValue)value; } } + + [Flags] + public enum ItemFlags1 : byte + { + None, + RestorePP = 1 << 0, + RestorePPAll = 1 << 1, + RestoreHP = 1 << 2, + AddEVHP = 1 << 3, + AddEVAtk = 1 << 4, + AddEVDef = 1 << 5, + AddEVSpe = 1 << 6, + AddEVSpA = 1 << 7, + } + + [Flags] + public enum ItemFlags2 : byte + { + None, + AddEVSpD = 1 << 0, + AddEVAbove100 = 1 << 1, + AddFriendship1 = 1 << 2, + AddFriendship2 = 1 << 3, + AddFriendship3 = 1 << 4, + Unused1 = 1 << 5, + Unused2 = 1 << 6, + Unused3 = 1 << 7, + } + + [Flags] + public enum BattlePocket : byte + { + None, + Ball = 1 << 0, + Boosts = 1 << 1, + Restore = 1 << 2, + Misc = 1 << 3, + } } From 3ef3040c8d8dab7757de77dd7dcc88bb8de2e221 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 5 Aug 2018 11:05:23 -0700 Subject: [PATCH 117/191] Refresh learnsets when finished editing learn not personal, lul Closes #358 --- pk3DS/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 55ac708324..d49bc7c5e1 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -1,4 +1,4 @@ -/*----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*/ /*-- This program is free software: you can redistribute it and/or modify --*/ /*-- it under the terms of the GNU General Public License as published by --*/ /*-- the Free Software Foundation, either version 3 of the License, or --*/ @@ -799,7 +799,7 @@ private void B_LevelUp_Click(object sender, EventArgs e) } Config.GARCLearnsets.Files = d; Config.GARCLearnsets.Save(); - Config.InitializePersonal(); + Config.InitializeLearnset(); }).Start(); } private void B_EggMove_Click(object sender, EventArgs e) From 10c7dbbeeeaf3e8790ba1e798872284b10270bbf Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 7 Aug 2018 17:26:16 -0700 Subject: [PATCH 118/191] Misc clean --- pk3DS.Core/CTR/mini.cs | 42 ++++++++++++------- pk3DS.Core/Game/GameConfig.cs | 4 +- pk3DS/Main.cs | 8 ++-- .../Subforms/Gen6/Experimental/MapPermView.cs | 8 ++-- pk3DS/Subforms/Gen6/Experimental/OWSE.cs | 12 +++--- pk3DS/Subforms/Gen7/Experimental/OWSE7.cs | 8 ++-- pk3DS/Subforms/Gen7/SMWE.cs | 20 ++++----- pk3DS/Subforms/Gen7/Wild/Area7.cs | 19 +++++---- pk3DS/Tools/ToolsUI.cs | 18 ++++---- 9 files changed, 76 insertions(+), 63 deletions(-) diff --git a/pk3DS.Core/CTR/mini.cs b/pk3DS.Core/CTR/mini.cs index 5a9923336a..ae195fac00 100644 --- a/pk3DS.Core/CTR/mini.cs +++ b/pk3DS.Core/CTR/mini.cs @@ -5,15 +5,15 @@ namespace pk3DS.Core.CTR { // Mini Packing Util - public static class mini + public static class Mini { - public static byte[] adjustMiniHeader(byte[] data, int headerLength) + public static byte[] AdjustMiniHeader(byte[] data, int headerLength) { // Adjust the header size of the mini file. int count = BitConverter.ToUInt16(data, 2); int[] start = new int[count]; for (int i = 0; i < count; i++) - start[i] = BitConverter.ToInt32(data, 4 + i*4); + start[i] = BitConverter.ToInt32(data, 4 + (i * 4)); int dataStart = start.Min(); if (headerLength < dataStart) @@ -24,11 +24,12 @@ public static byte[] adjustMiniHeader(byte[] data, int headerLength) int diff = headerLength - dataStart; // shift pointer for (int i = 0; i < count + 1; i++) - Array.Copy(BitConverter.GetBytes(BitConverter.ToInt32(data, 4 + i * 4) + diff), 0, newData, 4 + 4 * i, 4); + Array.Copy(BitConverter.GetBytes(BitConverter.ToInt32(data, 4 + (i * 4)) + diff), 0, newData, 4 + (4 * i), 4); return newData; } - public static void packMini(string path, string ident, string fileName, string outExt = null, string outFolder = null, bool delete = true) + + public static void PackMini(string path, string ident, string fileName, string outExt = null, string outFolder = null, bool delete = true) { if (outFolder == null) { @@ -44,7 +45,7 @@ public static void packMini(string path, string ident, string fileName, string o Array.Copy(BitConverter.GetBytes((ushort)files.Length), 0, data, 2, 2); int count = files.Length; - int dataOffset = 4 + 4 + count * 4; + int dataOffset = 4 + 4 + (count * 4); // Start the data filling. using (MemoryStream dataout = new MemoryStream()) @@ -84,7 +85,8 @@ public static void packMini(string path, string ident, string fileName, string o if (delete) Directory.Delete(path, true); } - public static byte[] packMini(byte[][] fileData, string ident) + + public static byte[] PackMini(byte[][] fileData, string ident) { // Create new Binary with the relevant header bytes byte[] data = new byte[4]; @@ -93,7 +95,7 @@ public static byte[] packMini(byte[][] fileData, string ident) Array.Copy(BitConverter.GetBytes((ushort)fileData.Length), 0, data, 2, 2); int count = fileData.Length; - int dataOffset = 4 + 4 + count * 4; + int dataOffset = 4 + 4 + (count * 4); // Start the data filling. using (MemoryStream dataout = new MemoryStream()) @@ -129,7 +131,8 @@ public static byte[] packMini(byte[][] fileData, string ident) } } } - public static bool packMini2(string path, string ident, string fileName) + + public static bool PackMini2(string path, string ident, string fileName) { if (!Directory.Exists(path)) return false; try @@ -137,13 +140,14 @@ public static bool packMini2(string path, string ident, string fileName) string[] filesToPack = Directory.GetFiles(path); byte[][] fileData = new byte[filesToPack.Length][]; for (int i = 0; i < filesToPack.Length; i++) fileData[i] = File.ReadAllBytes(filesToPack[i]); - byte[] miniBytes = packMini(fileData, ident); + byte[] miniBytes = PackMini(fileData, ident); File.WriteAllBytes(fileName, miniBytes); return true; } catch { return false; } } - public static void unpackMini(string path, string ident, string outFolder = null, bool delete = true) + + public static void UnpackMini(string path, string ident, string outFolder = null, bool delete = true) { if (outFolder == null) outFolder = Path.GetDirectoryName(path); if (!Directory.Exists(outFolder)) Directory.CreateDirectory(outFolder); @@ -185,7 +189,14 @@ public static void unpackMini(string path, string ident, string outFolder = null if (delete) File.Delete(path); // File is unpacked. } - public static byte[][] unpackMini(byte[] fileData, string identifier) + + /// + /// Unpacks a BinLinkerAccessor generated file into individual arrays. + /// + /// Packed data + /// Signature expected in the first two bytes (ASCII) + /// Unpacked array containing all files that were packed. + public static byte[][] UnpackMini(byte[] fileData, string identifier) { if (fileData == null || fileData.Length < 4) return null; @@ -207,7 +218,8 @@ public static byte[][] unpackMini(byte[] fileData, string identifier) } return returnData; } - public static string getIsMini(string path) + + public static string GetIsMini(string path) { byte[] data = File.ReadAllBytes(path); var fi = new FileInfo(path); @@ -220,8 +232,8 @@ public static string getIsMini(string path) uint length = 1338; for (int i = 0; i < count; i++) { - offsets[i] = BitConverter.ToUInt32(data, 4 + i * 4); - length = BitConverter.ToUInt32(data, 8 + i * 4); + offsets[i] = BitConverter.ToUInt32(data, 4 + (i * 4)); + length = BitConverter.ToUInt32(data, 8 + (i * 4)); } offsets[offsets.Length - 1] = length; diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index 176128c75e..ac86c21a6f 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -153,10 +153,10 @@ public void InitializeMoves() if (XY) Moves = GARCMoves.Files.Select(file => new Move(file)).ToArray(); if (ORAS) - Moves = mini.unpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move(file)).ToArray(); + Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move(file)).ToArray(); break; case 7: - Moves = mini.unpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move(file)).ToArray(); + Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move(file)).ToArray(); break; } } diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index d49bc7c5e1..352724f647 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -768,14 +768,14 @@ private void B_Move_Click(object sender, EventArgs e) { case 6: bool isMini = Config.ORAS; - Moves = isMini ? mini.unpackMini(g.getFile(0), "WD") : g.Files; + Moves = isMini ? Mini.UnpackMini(g.getFile(0), "WD") : g.Files; Invoke((Action)(() => new MoveEditor6(Moves).ShowDialog())); - g.Files = isMini ? new[] { mini.packMini(Moves, "WD") } : Moves; + g.Files = isMini ? new[] { Mini.PackMini(Moves, "WD") } : Moves; break; case 7: - Moves = mini.unpackMini(g.getFile(0), "WD"); + Moves = Mini.UnpackMini(g.getFile(0), "WD"); Invoke((Action)(() => new MoveEditor7(Moves).ShowDialog())); - g.Files = new[] {mini.packMini(Moves, "WD")}; + g.Files = new[] {Mini.PackMini(Moves, "WD")}; break; } g.Save(); diff --git a/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs b/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs index 75e03e13be..0e8896736d 100644 --- a/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs +++ b/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs @@ -27,7 +27,7 @@ public void drawMap(int Map) public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea = false) { // Load MM - byte[][] MM = mini.unpackMini(File.ReadAllBytes(MapMatrixes[DrawMap]), "MM"); + byte[][] MM = Mini.UnpackMini(File.ReadAllBytes(MapMatrixes[DrawMap]), "MM"); var mm = OWSE.mm = new MapMatrix(MM); // Unknown @@ -39,7 +39,7 @@ public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea { if (mm.EntryList[i] == 0xFFFF) // Mystery Zone continue; - byte[][] GR = mini.unpackMini(File.ReadAllBytes(MapGRs[mm.EntryList[i]]), "GR"); + byte[][] GR = Mini.UnpackMini(File.ReadAllBytes(MapGRs[mm.EntryList[i]]), "GR"); mm.Entries[i] = new MapMatrix.Entry(GR[0]) {coll = new MapMatrix.Collision(GR[2])}; } mapScale = Math.Max(1, (int)NUD_Scale.Value); @@ -129,7 +129,7 @@ private Bitmap overlayEntities(Bitmap img) //{ // using(var g = Graphics.FromImage(img)) // foreach (var l in OWSE.mm.LoadLines) - // try { g.DrawLine(new Pen(Color.Red, 4), l.p2 * mapScale, l.p1 * mapScale, l.p4 * mapScale, l.p3 * mapScale); } + // try { g.DrawLine(new Pen(Color.Red, 4), l.p2 * mapScale, l.p1 * mapScale, l.p4 * mapScale, l.p3 * mapScale); } // catch {} //} @@ -163,7 +163,7 @@ private void hoverMap(object sender, MouseEventArgs e) L_MapCoord.Text = string.Format("V:0x{3}{2}X:{0,3} Y:{1,3}", X, Y, Environment.NewLine, tileVal); } - catch { } + catch { } } private void B_Redraw_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs index b8488ea73a..461a6bdd43 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs @@ -20,7 +20,7 @@ public OWSE() AllowDrop = true; DragEnter += tabMain_DragEnter; DragDrop += tabMain_DragDrop; - + // Finished openQuick(Directory.GetFiles("encdata")); mapView.Show(); @@ -65,7 +65,7 @@ private void openQuick(string[] encdata) zdLocations[f] = LocationNum.ToString("000") + " - " + LocationName; rawLocations[f] = LocationName; } - + // Assign CB_LocationID.DataSource = zdLocations; CB_LocationID.Enabled = true; @@ -94,7 +94,7 @@ private void getEntry() { if (entry < 0) return; byte[] raw = File.ReadAllBytes(filepaths[entry]); - locationData = Core.CTR.mini.unpackMini(raw, "ZO"); + locationData = Core.CTR.Mini.UnpackMini(raw, "ZO"); if (locationData == null) return; // Read master ZD table @@ -125,7 +125,7 @@ private void setEntry() { if (entry < 0) return; if (debugToolDumping) return; - + // Set the data back into the class object // Currently only the first two files. setZoneData(); // File 0 @@ -141,12 +141,12 @@ private void setEntry() // Debug Check (can stay, why not.) if (!locationData.Where((t, i) => !data[i].SequenceEqual(t)).Any()) return; - + // Util.Alert("Zone has been edited!"); System.Media.SystemSounds.Asterisk.Play(); // Package the files into the permanent package file. - byte[] raw = mini.packMini(data, "ZO"); + byte[] raw = Mini.PackMini(data, "ZO"); File.WriteAllBytes(filepaths[entry], raw); } diff --git a/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs b/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs index 697e6d66e2..1cb454754e 100644 --- a/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs +++ b/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs @@ -33,7 +33,7 @@ public OWSE7(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd) private readonly byte[] zoneData; private byte[] worldData; private readonly string[] locationList; - + private void loadData() { // get zonedata array @@ -107,14 +107,14 @@ private class World private bool HasZS => _7 != null; private bool HasZI => _8 != null; - public Script[] ZoneScripts; + public Script[] ZoneScripts; public Script[] ZoneInfoScripts; public World(lzGARCFile garc, int worldID) { int index = worldID*11; - _7 = mini.unpackMini(garc[index + 7], "ZS"); - _8 = mini.unpackMini(garc[index + 8], "ZI"); + _7 = Mini.UnpackMini(garc[index + 7], "ZS"); + _8 = Mini.UnpackMini(garc[index + 8], "ZI"); ZoneScripts = HasZS ? _7.Select(arr => new Script(arr)).ToArray() : new Script[0]; ZoneInfoScripts = HasZI ? _8.Select(arr => new Script(arr)).ToArray() : new Script[0]; diff --git a/pk3DS/Subforms/Gen7/SMWE.cs b/pk3DS/Subforms/Gen7/SMWE.cs index de138cf5af..22aec586f9 100644 --- a/pk3DS/Subforms/Gen7/SMWE.cs +++ b/pk3DS/Subforms/Gen7/SMWE.cs @@ -215,7 +215,7 @@ private void UpdateSpeciesForm(object sender, EventArgs e) var cur_pb = CB_TableID.SelectedIndex%2 == 0 ? PB_DayTable : PB_NightTable; var cur_img = cur_pb.Image; - + object[][] source = sender is NumericUpDown ? (object[][])nup_spec : cb_spec; int table = Array.FindIndex(source, t => t.Contains(sender)); int slot = Array.IndexOf(source[table], sender); @@ -255,14 +255,14 @@ private void UpdateEncounterRate(object sender, EventArgs e) { if (loadingdata) return; - + var cur_pb = CB_TableID.SelectedIndex%2 == 0 ? PB_DayTable : PB_NightTable; var cur_img = cur_pb.Image; - + int slot = Array.IndexOf(rate_spec, sender); int rate = (int) ((NumericUpDown) sender).Value; CurrentTable.Rates[slot] = rate; - + using (var g = Graphics.FromImage(cur_img)) { var pnt = new PointF(40 * slot + 10, 10); @@ -270,7 +270,7 @@ private void UpdateEncounterRate(object sender, EventArgs e) g.Clear(Color.Transparent); g.DrawString($"{rate}%", font, Brushes.Black, pnt); } - + cur_pb.Image = cur_img; var sum = TotalEncounterRate; @@ -330,7 +330,7 @@ private void B_Save_Click(object sender, EventArgs e) WinFormsUtil.Error("Encounter rates must add up to either 0% or 100%."); return; } - + CurrentTable.Write(); var area = Areas[CB_LocationID.SelectedIndex]; area.Tables[CB_TableID.SelectedIndex] = CurrentTable; @@ -363,11 +363,11 @@ private void DumpTables(object sender, EventArgs e) File.WriteAllText(sfd.FileName, sb.ToString()); } } - + // Randomization & Bulk Modification private void B_Randomize_Click(object sender, EventArgs e) { - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings at the bottom left.")) return; @@ -475,8 +475,8 @@ private void ExportEncounters(string gameID, string ident) var reg = dumpreg(); var sos = dumpsos(); - File.WriteAllBytes($"encounter_{gameID}.pkl", mini.packMini(reg, ident)); - File.WriteAllBytes($"encounter_{gameID}_sos.pkl", mini.packMini(sos, ident)); + File.WriteAllBytes($"encounter_{gameID}.pkl", Mini.PackMini(reg, ident)); + File.WriteAllBytes($"encounter_{gameID}_sos.pkl", Mini.PackMini(sos, ident)); } private byte[][] dumpreg() { diff --git a/pk3DS/Subforms/Gen7/Wild/Area7.cs b/pk3DS/Subforms/Gen7/Wild/Area7.cs index af590a5a1b..3700189d60 100644 --- a/pk3DS/Subforms/Gen7/Wild/Area7.cs +++ b/pk3DS/Subforms/Gen7/Wild/Area7.cs @@ -24,20 +24,21 @@ public string GetSummary(string[] speciesList) { var sb = new StringBuilder(); sb.AppendLine("=========="); - sb.AppendLine($"Map: {Name}"); - sb.AppendLine($"Tables: {Tables.Count / 2}"); + sb.Append("Map: ").AppendLine(Name); + sb.Append("Tables: ").Append(Tables.Count / 2).AppendLine(); for (int i = 0; i < Tables.Count / 2; i++) { - sb.AppendLine($"Table {i+1} (Day):"); + sb.Append("Table ").Append(i + 1).AppendLine(" (Day):"); sb.AppendLine(Tables[i*2].GetSummary(speciesList)); - sb.AppendLine($"Table {i+1} (Night):"); - sb.AppendLine(Tables[i*2 + 1].GetSummary(speciesList)); + sb.Append("Table ").Append(i + 1).AppendLine(" (Night):"); + sb.AppendLine(Tables[(i * 2) + 1].GetSummary(speciesList)); } sb.AppendLine("=========="); return sb.ToString(); } private const string PackIdentifier = "EA"; + public static byte[] GetDayNightTableBinary(IList tables) { byte[][] tabs = new byte[tables.Count / 2][]; @@ -50,7 +51,7 @@ public static byte[] GetDayNightTableBinary(IList tables) table1.CopyTo(arr, 4 + table0.Length); tabs[i / 2] = arr; } - return mini.packMini(tabs, PackIdentifier); + return Mini.PackMini(tabs, PackIdentifier); } public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) @@ -62,7 +63,7 @@ public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) { areas[i] = new Area7 { - FileNumber = 9 + 11 * i, + FileNumber = 9 + (11 * i), Zones = zd.Where(z => z.AreaIndex == i).ToArray() }; var md = ed[areas[i].FileNumber]; @@ -72,7 +73,7 @@ public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) continue; } - byte[][] Tables = mini.unpackMini(md, PackIdentifier); + byte[][] Tables = Mini.UnpackMini(md, PackIdentifier); areas[i].HasTables = Tables.Any(t => t.Length > 0); if (!areas[i].HasTables) continue; @@ -98,7 +99,7 @@ public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) /// Annotated Area Array public static Area7[] GetArray(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd, string[] locationList) { - var Worlds = wd.Files.Select(f => mini.unpackMini(f, "WD")[0]).ToArray(); + var Worlds = wd.Files.Select(f => Mini.UnpackMini(f, "WD")[0]).ToArray(); byte[][] zdfiles = zd.Files; var worldData = zdfiles[1]; diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index 928df1de4a..b594b1f641 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -138,15 +138,15 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa // Determine if it is a DARC or a Mini // Check if Mini first - string fx = fi.Length > 10 * (1<<20) ? null : mini.getIsMini(path); // no mini is above 10MB + string fx = fi.Length > 10 * (1<<20) ? null : Mini.GetIsMini(path); // no mini is above 10MB if (fx != null) // Is Mini Packed File { newFolder = folderPath + "_" + fx; // Fetch Mini File Contents - mini.unpackMini(path, fx, newFolder, false); + Mini.UnpackMini(path, fx, newFolder, false); // Recurse throught the extracted contents if they extract successfully if (Directory.Exists(newFolder)) - { + { foreach (string file in Directory.GetFiles(newFolder)) openARC(file, pBar1, true); batchRenameExtension(newFolder); @@ -211,7 +211,7 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa Console.WriteLine($"New SARC with {sarc.SFAT.EntryCount} files."); foreach (var z in sarc.Dump(path)) { - + } } else if (!recursing) @@ -295,7 +295,7 @@ private void saveARC(string path) int index = fileName.LastIndexOf('_'); string fileNum = fileName.Substring(0, index); string fileExt = fileName.Substring(index + 1); - + // Find old file for reference... string file; if (File.Exists(Path.Combine(parentName, fileNum + ".bin"))) @@ -306,7 +306,7 @@ private void saveARC(string path) file = null; byte[] oldData = file != null ? File.ReadAllBytes(file) : null; - bool r = mini.packMini2(path, fileExt, Path.Combine(parentName, fileNum + "." + fileExt)); + bool r = Mini.PackMini2(path, fileExt, Path.Combine(parentName, fileNum + "." + fileExt)); if (!r) { WinFormsUtil.Alert("Packing failed."); @@ -330,9 +330,9 @@ private void saveARC(string path) break; // Fix pointers - byte[] update = mini.adjustMiniHeader(newData, oldPtr); + byte[] update = Mini.AdjustMiniHeader(newData, oldPtr); File.WriteAllBytes(Path.Combine(parentName, fileNum + "." + fileExt), update); - } + } } break; @@ -364,7 +364,7 @@ private void B_Reset_Click(object sender, EventArgs e) private static void batchRenameExtension(string Folder) { - if (!Directory.Exists(Folder)) + if (!Directory.Exists(Folder)) return; foreach (string f in Directory.GetFiles(Folder, "*", SearchOption.AllDirectories)) From d95b4a57284cd94f13d807ab00afadf24882f385 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 8 Aug 2018 20:22:05 -0700 Subject: [PATCH 119/191] Add more disassembly results yay progress --- .../Structures/Gen6/EncounterStatic6.cs | 5 + .../Structures/Gen7/EncounterStatic7.cs | 5 + .../Subforms/Gen6/Experimental/MapPermView.cs | 8 +- pk3DS/Subforms/Gen6/Experimental/OWSE.cs | 8 +- .../Subforms/Gen6/Experimental/OWSEStructs.cs | 228 +++++++++++++++--- 5 files changed, 210 insertions(+), 44 deletions(-) diff --git a/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs b/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs index 03a19b8ead..8570bdf528 100644 --- a/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs +++ b/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs @@ -38,6 +38,11 @@ public int HeldItem } } + public bool Shiny + { + get => (Data[0x6] & 1) >> 1 == 1; + set => Data[0x6] = (byte)(Data[0x6] & ~1 | (value ? 1 : 0)); + } public bool ShinyLock { get => (Data[0x6] & 2) >> 1 == 1; diff --git a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs index 61fda8cc53..6389c922b2 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs @@ -41,6 +41,11 @@ public override int HeldItem } } + public bool Shiny + { + get => (Data[0x6] & 1) >> 1 == 1; + set => Data[0x6] = (byte)(Data[0x6] & ~1 | (value ? 1 : 0)); + } public bool ShinyLock { get => (Data[0x6] & 2) >> 1 == 1; diff --git a/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs b/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs index 0e8896736d..265971bfff 100644 --- a/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs +++ b/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs @@ -89,8 +89,8 @@ private Bitmap overlayEntities(Bitmap img) } foreach (var e in OWSE.CurrentZone.Entities.Warps) { - int x = (int)e.pX; // shifted warps look weird - int y = (int)e.pY; // shifted warps look weird + int x = (int)e.PX; // shifted warps look weird + int y = (int)e.PY; // shifted warps look weird for (int sx = 0; sx < e.Width; sx++) // Stretch X for (int sy = 0; sy < e.Height; sy++) // Stretch Y try { WinFormsUtil.LayerImage(img, Properties.Resources.W, (x + sx) * mapScale, (y + sy) * mapScale, opacity); } @@ -118,8 +118,8 @@ private Bitmap overlayEntities(Bitmap img) // Overlay Map Data // Flyto { - int x = (int)OWSE.CurrentZone.ZD.pX2; - int y = (int)OWSE.CurrentZone.ZD.pY2; + int x = (int)OWSE.CurrentZone.ZD.PX2; + int y = (int)OWSE.CurrentZone.ZD.PY2; for (int sx = 0; sx < 1; sx++) // Stretch X for (int sy = 0; sy < 1; sy++) // Stretch Y try { WinFormsUtil.LayerImage(img, Properties.Resources.FLY, (x + sx) * mapScale, (y + sy) * mapScale, opacity/2); } diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs index 461a6bdd43..60f3268734 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs @@ -156,12 +156,12 @@ private void getZoneData() L_ZDPreview.Text = "Text File: " + CurrentZone.ZD.TextFile + Environment.NewLine + "Map File: " + CurrentZone.ZD.MapMatrix; - L_ZD.Text = string.Format("X: {0,5}{3}Y: {1,5}{3}Z:{2,6}{3}{3}X: {4,5}{3}Y: {5,5}{3}Z:{6,6}", CurrentZone.ZD.pX, CurrentZone.ZD.pY, - CurrentZone.ZD.Z, Environment.NewLine, CurrentZone.ZD.pX2, CurrentZone.ZD.pY2, + L_ZD.Text = string.Format("X: {0,5}{3}Y: {1,5}{3}Z:{2,6}{3}{3}X: {4,5}{3}Y: {5,5}{3}Z:{6,6}", CurrentZone.ZD.PX, CurrentZone.ZD.PY, + CurrentZone.ZD.Z, Environment.NewLine, CurrentZone.ZD.PX2, CurrentZone.ZD.PY2, CurrentZone.ZD.Z2); - if (Math.Abs(CurrentZone.ZD.pX - CurrentZone.ZD.pX2) > 0.01 - || Math.Abs(CurrentZone.ZD.pY - CurrentZone.ZD.pY2) > 0.01 + if (Math.Abs(CurrentZone.ZD.PX - CurrentZone.ZD.PX2) > 0.01 + || Math.Abs(CurrentZone.ZD.PY - CurrentZone.ZD.PY2) > 0.01 || CurrentZone.ZD.Z != CurrentZone.ZD.Z2) { L_ZD.Text += Environment.NewLine + "COORDINATE MISMATCH"; diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs index 3fe01ba137..9775bccbcc 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs @@ -20,6 +20,7 @@ public class MapMatrix public Unknown[] Unknowns; public byte[] UnkData; + public MapMatrix(byte[][] data) { using (BinaryReader br = new BinaryReader(new MemoryStream(data[0]))) @@ -31,14 +32,21 @@ public MapMatrix(byte[][] data) Entries = new Entry[Area]; EntryList = new ushort[Area]; for (int i = 0; i < Area; i++) + { EntryList[i] = br.ReadUInt16(); + } if (br.BaseStream.Position != br.BaseStream.Length) + { uL = br.ReadUInt16(); + } } if (data.Length > 1) - parseUnk(UnkData = data[1]); + { + ParseUnk(UnkData = data[1]); + } } + public byte[] Write() { using (MemoryStream ms = new MemoryStream()) @@ -47,7 +55,11 @@ public byte[] Write() bw.Write(u0); bw.Write(Width); bw.Write(Height); - foreach (ushort Entry in EntryList) bw.Write(Entry); + foreach (ushort Entry in EntryList) + { + bw.Write(Entry); + } + bw.Write(uL); return ms.ToArray(); } @@ -64,18 +76,23 @@ public Bitmap Preview(int Scale, int ColorShift) // Fetch Singular Images first Bitmap[] EntryImages = new Bitmap[Area]; for (int i = 0; i < Area; i++) + { EntryImages[i] = Entries[i] == null ? new Bitmap(40 * Scale, 40 * Scale) : Entries[i].Preview(Scale, ColorShift); + } // Combine all images into one. Bitmap img = new Bitmap(EntryImages[0].Width * Width, EntryImages[0].Height * Height); using (Graphics g = Graphics.FromImage(img)) - for (int i = 0; i < Area; i++) + { + for (int i = 0; i < Area; i++) { g.DrawImage(EntryImages[i], new Point(i * EntryImages[0].Width % img.Width, EntryImages[0].Height * (i / Width))); } + } + return img; } @@ -86,6 +103,7 @@ public class Entry public ushort Width, Height; private readonly int Area; public uint[] Tiles; // Certain bits? + public Entry(byte[] data) { using (BinaryReader br = new BinaryReader(new MemoryStream(data))) @@ -95,9 +113,12 @@ public Entry(byte[] data) Area = Width*Height; Tiles = new uint[Area]; for (int i = 0; i < Area; i++) + { Tiles[i] = br.ReadUInt32(); + } } } + public byte[] Write() { using (MemoryStream ms = new MemoryStream()) @@ -105,11 +126,15 @@ public byte[] Write() { bw.Write(Width); bw.Write(Height); - foreach (uint Tile in Tiles) bw.Write(Tile); + foreach (uint Tile in Tiles) + { + bw.Write(Tile); + } + return ms.ToArray(); } } - + public Bitmap Preview(int s, int ColorShift) { byte[] bmpData = BytePreview(s, ColorShift); @@ -120,6 +145,7 @@ public Bitmap Preview(int s, int ColorShift) return b; } + public byte[] BytePreview(int s, int ColorShift) { byte[] bmpData = new byte[4 * Width * Height * s * s]; @@ -133,11 +159,14 @@ public byte[] BytePreview(int s, int ColorShift) byte[] pixel = BitConverter.GetBytes(colorValue); for (int x = 0; x < s * s; x++) - pixel.CopyTo(bmpData, 4 * ((Y * s + x / s) * Width * s + X * s + x % s)); + { + pixel.CopyTo(bmpData, 4 * ((((Y * s) + (x / s)) * Width * s) + (X * s) + (x % s))); + } } return bmpData; } } + public class Collision { public string Magic; @@ -149,13 +178,16 @@ public class Collision public CollisionObject[] MapMisc; public string termMagic; public byte[] termData; + public Collision(byte[] data) { using (BinaryReader br = new BinaryReader(new MemoryStream(data))) { Magic = new string(br.ReadChars(4)); // Magic if (Magic != "coll") + { return; // all other properties are null + } termOffset = br.ReadInt32(); U5D8 = br.ReadInt32(); @@ -164,28 +196,37 @@ public Collision(byte[] data) // Read 40 collision rectangles Map40 = new CollisionObject[40]; for (int i = 0; i < Map40.Length; i++) + { Map40[i] = new CollisionObject(br.ReadBytes(0x10)); + } // Read 32 Int32s MapInts = new int[0x20]; for (int i = 0; i < MapInts.Length; i++) + { MapInts[i] = br.ReadInt32(); + } // Read misc collision rectangles int ct = termOffset - (int)br.BaseStream.Position + 0x10; MapMisc = new CollisionObject[ct/0x10]; for (int i = 0; i < MapMisc.Length; i++) + { MapMisc[i] = new CollisionObject(br.ReadBytes(0x10)); + } // Read Term termMagic = new string(br.ReadChars(4)); if (termMagic != "term") + { return; // all other properties are null + } // Read the rest of the data.... termData = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position)); } } + public class CollisionObject { private readonly float _0; @@ -206,6 +247,7 @@ public CollisionObject(byte[] data) _2 = BitConverter.ToSingle(data, 0x8); _3 = BitConverter.ToSingle(data, 0xC); } + public override string ToString() { return string.Join(", ", F1.ToString(), F2.ToString(), F3.ToString(), F4.ToString()); @@ -215,13 +257,15 @@ public override string ToString() public string Unk2String() { - return Unknowns.Aggregate("", (current, l) => current + $"{l.Direction}: {l.p1,3} {l.p2,3} {l.p3,3} {l.p4,3}{Environment.NewLine,3}"); + return Unknowns.Aggregate("", (current, l) => current + $"{l.Direction}: {l.P1,3} {l.P2,3} {l.P3,3} {l.P4,3}{Environment.NewLine,3}"); } - private void parseUnk(byte[] data) + + private void ParseUnk(byte[] data) { List unk = new List(); using (var br = new BinaryReader(new MemoryStream(data))) - do + { + do { unk.Add(new Unknown { Direction = br.ReadUInt32(), @@ -231,6 +275,8 @@ private void parseUnk(byte[] data) _4 = br.ReadSingle(), }); } while (unk.Last().Direction != 0); + } + unk.RemoveAt(unk.Count-1); Unknowns = unk.ToArray(); } @@ -243,45 +289,97 @@ public class Unknown public float _3; public float _4; - public int p1 => (int)_1 / 18; - public int p2 => (int)_2 / 18; - public int p3 => (int)_3 / 18; - public int p4 => (int)_4 / 18; + public int P1 => (int)_1 / 18; + public int P2 => (int)_2 / 18; + public int P3 => (int)_3 / 18; + public int P4 => (int)_4 / 18; } } + public class ZoneData { internal const int Size = 0x38; public readonly byte[] Data; + + public byte MapType { get => Data[0]; set => Data[0] = value; } + public byte MapMove { get => Data[1]; set => Data[1] = value; } + public int MapArea { get => BitConverter.ToUInt16(Data, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); } public int MapMatrix { get => BitConverter.ToUInt16(Data, 0x04); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x04); } public int TextFile { get => BitConverter.ToUInt16(Data, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x06); } - public int ParentMap // 0x1C - low 7 bits + + public uint BGMSpring { get => BitConverter.ToUInt32(Data, 0x08); set => BitConverter.GetBytes(value).CopyTo(Data, 0x08); } + public uint BGMSummer { get => BitConverter.ToUInt32(Data, 0x0C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x0C); } + public uint BGMAutumn { get => BitConverter.ToUInt32(Data, 0x10); set => BitConverter.GetBytes(value).CopyTo(Data, 0x10); } + public uint BGMWinter { get => BitConverter.ToUInt32(Data, 0x14); set => BitConverter.GetBytes(value).CopyTo(Data, 0x14); } + + public int ScriptFile { get => BitConverter.ToUInt16(Data, 0x18); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } + public int TownMapGroup { get => BitConverter.ToUInt16(Data, 0x1A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1A); } + + public int ParentMap // 0x1C - low 10 bits + { + get => BitConverter.ToUInt16(Data, 0x1C) & 0x3FF; + set => BitConverter.GetBytes((ushort)(value | (BitConverter.ToUInt16(Data, 0x1C) & ~0x3FF))).CopyTo(Data, 0x1C); + } + + public int OLValue // 0x1C - high 6 bits + { + get => BitConverter.ToUInt16(Data, 0x1C) >> 10; + set => BitConverter.GetBytes((ushort)((value << 10) | ParentMap)).CopyTo(Data, 0x1C); + } + + // 5,1,1,7 + public int Weather // 0x1E, low 5 { - get => BitConverter.ToUInt16(Data, 0x1C) & 0x1FF; - set => BitConverter.GetBytes((ushort)(value | (BitConverter.ToUInt16(Data, 0x1C) & ~0x1FF))).CopyTo(Data, 0x1C); + get => BitConverter.ToUInt16(Data, 0x1E) & 0x1F; + set => BitConverter.GetBytes((ushort)(value | (BitConverter.ToUInt16(Data, 0x1E) & ~0x1F))).CopyTo(Data, 0x1E); } - public int OLFlags // 0x1C - high 9(?) bits + + public bool IsSkyBoxEnable { get => ((Data[0x1E] >> 5) & 1) == 1; set => Data[0x1E] = (byte)((Data[0x1E] & ~0x20) | (value ? 1 << 5 : 0)); } + public bool IsRollerSkateEnable { get => ((Data[0x1E] >> 6) & 1) == 1; set => Data[0x1E] = (byte)((Data[0x1E] & ~0x40) | (value ? 1 << 6 : 0)); } + + public int BattleBackground // 7-13 { - get => BitConverter.ToUInt16(Data, 0x1C) >> 9; - set => BitConverter.GetBytes((ushort)((value << 9) | (BitConverter.ToUInt16(Data, 0x1C) & 0x1FF))).CopyTo(Data, 0x1C); + get => (BitConverter.ToUInt16(Data, 0x1E) >> 7) & 0x7F; + set => BitConverter.GetBytes((ushort)(((value & 0x7F) << 7) | (BitConverter.ToUInt16(Data, 0x1E) & ~0x3F80))).CopyTo(Data, 0x1E); } - private int X { get => BitConverter.ToUInt16(Data, 0x2C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } + private int _20 { get => BitConverter.ToUInt16(Data, 0x20); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x20); } + public int MapChange { get => _20 & 0x1F; set => _20 = (_20 & ~0x1F) | value; } + // ??? 5 + public bool IsBicycleEnable { get => ((_20 >> 10) & 1) == 1; set => _20 = (_20 & ~(1 << 10)) | (value ? 1 << 10 : 0); } + public bool IsRunEnable { get => ((_20 >> 11) & 1) == 1; set => _20 = (_20 & ~(1 << 11)) | (value ? 1 << 11 : 0); } + public bool IsEscapeRopeEnable { get => ((_20 >> 12) & 1) == 1; set => _20 = (_20 & ~(1 << 12)) | (value ? 1 << 12 : 0); } + public bool IsFlyEnable { get => ((_20 >> 13) & 1) == 1; set => _20 = (_20 & ~(1 << 13)) | (value ? 1 << 13 : 0); } + public bool IsBGM { get => ((_20 >> 14) & 1) == 1; set => _20 = (_20 & ~(1 << 14)) | (value ? 1 << 14 : 0); } + public bool IsUnk { get => ((_20 >> 15) & 1) == 1; set => _20 = (_20 & ~(1 << 15)) | (value ? 1 << 15 : 0); } + + // unused + public int _22 { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } + + public int _24 { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); } + public int _26 { get => BitConverter.ToUInt16(Data, 0x26); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); } + + public int _28 { get => BitConverter.ToUInt16(Data, 0x28); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } + + private int X { get => BitConverter.ToInt16(Data, 0x2C); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x2C); } public int Z { get => BitConverter.ToInt16(Data, 0x2E); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x2E); } - private int Y { get => BitConverter.ToUInt16(Data, 0x30); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x30); } - private int X2 { get => BitConverter.ToUInt16(Data, 0x32); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x32); } + private int Y { get => BitConverter.ToInt16(Data, 0x30); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x30); } + private int X2 { get => BitConverter.ToInt16(Data, 0x32); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x32); } public int Z2 { get => BitConverter.ToInt16(Data, 0x34); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x34); } - private int Y2 { get => BitConverter.ToUInt16(Data, 0x36); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x36); } + private int Y2 { get => BitConverter.ToInt16(Data, 0x36); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x36); } - public float pX { get => (float)X / 18; set => X = (int)(18 * value); } - public float pY { get => (float)Y / 18; set => Y = (int)(18 * value); } - public float pX2 { get => (float)X2 / 18; set => X2 = (int)(18 * value); } - public float pY2 { get => (float)Y2 / 18; set => Y2 = (int)(18 * value); } + public float PX { get => (float)X / 18; set => X = (int)(18 * value); } + public float PY { get => (float)Y / 18; set => Y = (int)(18 * value); } + public float PX2 { get => (float)X2 / 18; set => X2 = (int)(18 * value); } + public float PY2 { get => (float)Y2 / 18; set => Y2 = (int)(18 * value); } public ZoneData(byte[] data) { - if (data.Length != Size) + if (data.Length != Size) + { return; + } + Data = data; } @@ -290,6 +388,7 @@ public byte[] Write() return Data; } } + public class Zone { public readonly ZoneData ZD; @@ -311,8 +410,11 @@ public Zone(byte[][] Zone) // Array 3 is [Wild Encounters] Encounters = new ZoneEncounters(Zone[3]); // Array 4 is [???] - May not be present in all. - if (Zone.Length <= 4) + if (Zone.Length <= 4) + { return; + } + File5 = new ZoneUnknown(Zone[4]); } @@ -323,8 +425,10 @@ public byte[][] Write() Zone[1] = Entities.Write(); Zone[2] = MapScript.Write(); Zone[3] = Encounters.Write(); - if (Zone.Length <= 4) + if (Zone.Length <= 4) + { return Zone; + } Zone[4] = File5.Write(); return Zone; @@ -360,15 +464,29 @@ public ZoneEntities(byte[] data) // Load Entitites for (int i = 0; i < FurnitureCount; i++) + { Furniture[i] = new EntityFurniture(br.ReadBytes(EntityFurniture.Size)); + } + for (int i = 0; i < NPCCount; i++) + { NPCs[i] = new EntityNPC(br.ReadBytes(EntityNPC.Size)); + } + for (int i = 0; i < WarpCount; i++) + { Warps[i] = new EntityWarp(br.ReadBytes(EntityWarp.Size)); + } + for (int i = 0; i < TriggerCount; i++) + { Triggers1[i] = new EntityTrigger1(br.ReadBytes(EntityTrigger1.Size)); + } + for (int i = 0; i < UnknownCount; i++) + { Triggers2[i] = new EntityTrigger2(br.ReadBytes(EntityTrigger2.Size)); + } // Load Script Data int len = br.ReadInt32(); @@ -376,44 +494,57 @@ public ZoneEntities(byte[] data) Script = new Script(br.ReadBytes(len)); } } + public byte[] Write() { byte[] F = new byte[Furniture.Length * EntityFurniture.Size]; for (int i = 0; i < Furniture.Length; i++) + { Furniture[i].Write().CopyTo(F, i * EntityFurniture.Size); + } byte[] N = new byte[NPCs.Length * EntityNPC.Size]; for (int i = 0; i < NPCs.Length; i++) + { NPCs[i].Write().CopyTo(N, i * EntityNPC.Size); + } byte[] W = new byte[Warps.Length * EntityWarp.Size]; for (int i = 0; i < Warps.Length; i++) + { Warps[i].Write().CopyTo(W, i * EntityWarp.Size); + } byte[] T = new byte[Triggers1.Length * EntityTrigger1.Size]; for (int i = 0; i < Triggers1.Length; i++) + { Triggers1[i].Write().CopyTo(T, i * EntityTrigger1.Size); + } byte[] U = new byte[Triggers2.Length * EntityTrigger2.Size]; for (int i = 0; i < Triggers2.Length; i++) + { Triggers2[i].Write().CopyTo(U, i * EntityTrigger2.Size); + } // Assemble entity information byte[] OWEntities = F.Concat(N).Concat(W).Concat(T).Concat(U).ToArray(); byte[] EntityLength = BitConverter.GetBytes(8 + OWEntities.Length); byte[] EntityCounts = {(byte)Furniture.Length, (byte)NPCs.Length, (byte)Warps.Length, (byte)Triggers1.Length, (byte)Triggers2.Length, 0, 0, 0 }; - + // Reassemble NPC portion byte[] OWEntityData = EntityLength.Concat(EntityCounts).Concat(OWEntities).ToArray(); // Reassemble Script portion byte[] OWScriptData = Script.Write(); - + byte[] finalData = OWEntityData.Concat(OWScriptData).ToArray(); // Add padding zeroes if required (yield size % 4 == 0) if (finalData.Length % 4 != 0) - Array.Resize(ref finalData, finalData.Length + 4 - finalData.Length % 4); + { + Array.Resize(ref finalData, finalData.Length + 4 - (finalData.Length % 4)); + } return finalData; } @@ -440,16 +571,19 @@ public class EntityFurniture public byte[] Raw; public byte[] OriginalData; internal static readonly byte Size = 0x14; + public EntityFurniture(byte[] data = null) { Raw = data ?? new byte[Size]; OriginalData = (byte[])Raw.Clone(); } + public byte[] Write() { return Raw; } } + public class EntityNPC { // Usable Attributes @@ -496,16 +630,19 @@ public class EntityNPC public byte[] Raw; public byte[] OriginalData; internal static readonly byte Size = 0x30; + public EntityNPC(byte[] data = null) { Raw = data ?? new byte[Size]; OriginalData = (byte[])Raw.Clone(); } + public byte[] Write() { return Raw; } } + public class EntityWarp { // Usable Attributes @@ -523,8 +660,8 @@ public class EntityWarp public int Z { get => BitConverter.ToInt16(Raw, 0x0A); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0A); } public int Y { get => BitConverter.ToUInt16(Raw, 0x0C); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0C); } - public decimal pX => (decimal)X / 18; - public decimal pY => (decimal)Y / 18; + public decimal PX => (decimal)X / 18; + public decimal PY => (decimal)Y / 18; // Stretches RIGHT public int Width { get => BitConverter.ToInt16(Raw, 0x0E); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0E); } @@ -539,16 +676,19 @@ public class EntityWarp public byte[] Raw; public byte[] OriginalData; internal static readonly byte Size = 0x18; + public EntityWarp(byte[] data = null) { Raw = data ?? new byte[Size]; OriginalData = (byte[])Raw.Clone(); } + public byte[] Write() { return Raw; } } + public class EntityTrigger1 { // Usable Attributes @@ -560,7 +700,7 @@ public class EntityTrigger1 public int U6 { get => BitConverter.ToUInt16(Raw, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x06); } // 0 or 1, always 0 in ORAS public int U8 { get => BitConverter.ToUInt16(Raw, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x08); } - + // 0x0A-0x0B unused public int X { get => BitConverter.ToUInt16(Raw, 0x0C); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0C); } @@ -574,16 +714,19 @@ public class EntityTrigger1 public byte[] Raw; public byte[] OriginalData; internal static readonly byte Size = 0x18; + public EntityTrigger1(byte[] data = null) { Raw = data ?? new byte[Size]; OriginalData = (byte[])Raw.Clone(); } + public byte[] Write() { return Raw; } } + public class EntityTrigger2 { // Usable Attributes @@ -609,34 +752,41 @@ public class EntityTrigger2 public byte[] Raw; public byte[] OriginalData; internal static readonly byte Size = 0x18; + public EntityTrigger2(byte[] data = null) { Raw = data ?? new byte[Size]; OriginalData = (byte[])Raw.Clone(); } + public byte[] Write() => Raw; } } + public class ZoneScript { public byte[] Data; // File details unknown. public Script Script; + public ZoneScript(byte[] data) { Data = data; Script = new Script(data); } + public byte[] Write() { Data = Script.Write(); return Data; } } + public class ZoneEncounters { public byte[] Data; // File details unknown. public byte[] Header; public EncounterSet[] Encounters; + public ZoneEncounters(byte[] data) { Data = data; @@ -646,9 +796,12 @@ public ZoneEncounters(byte[] data) Header = br.ReadBytes(0x10); Encounters = new EncounterSet[(int)(br.BaseStream.Length - br.BaseStream.Position)/4]; for (int i = 0; i < Encounters.Length; i++) + { Encounters[i] = new EncounterSet(br.ReadBytes(4)); + } } } + public byte[] Write() { byte[] data = Header; // Start with the header data, then concat every encounter in afterwards. @@ -672,6 +825,7 @@ public EncounterSet(byte[] data) LevelMax = br.ReadByte(); } } + public byte[] Write() { using (MemoryStream ms = new MemoryStream()) @@ -685,9 +839,11 @@ public byte[] Write() } } } + public class ZoneUnknown { public byte[] FileData; // File details unknown. + public ZoneUnknown(byte[] data) { FileData = data; From e40d3ce5548d75821f31785dc88cd465610530a6 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 8 Aug 2018 20:56:32 -0700 Subject: [PATCH 120/191] Style updates makes it easier to look at still looks yuck ;) --- pk3DS.Core/CTR/AES.cs | 17 +- pk3DS.Core/CTR/ALYT.cs | 3 + pk3DS.Core/CTR/BLZ.cs | 15 +- pk3DS.Core/CTR/CRO.cs | 15 +- pk3DS.Core/CTR/CTR.cs | 18 +- pk3DS.Core/CTR/DARC.cs | 20 +- pk3DS.Core/CTR/ExeFS.cs | 23 +- pk3DS.Core/CTR/Exheader.cs | 6 +- pk3DS.Core/CTR/FileFormat.cs | 12 +- pk3DS.Core/CTR/GARC.cs | 20 +- pk3DS.Core/CTR/Images/BCLIM.cs | 23 +- pk3DS.Core/CTR/Images/BFLIM.cs | 2 + pk3DS.Core/CTR/Images/BXLIM.cs | 3 +- pk3DS.Core/CTR/Images/Coordinate.cs | 2 + pk3DS.Core/CTR/Images/PixelConverter.cs | 5 +- pk3DS.Core/CTR/Images/XLIMUtil.cs | 1 + pk3DS.Core/CTR/LZSS.cs | 11 +- pk3DS.Core/CTR/NCSD.cs | 16 +- pk3DS.Core/CTR/RomFS.cs | 38 +- pk3DS.Core/CTR/SARC.cs | 14 + pk3DS.Core/CTR/SMDH.cs | 14 + pk3DS.Core/Game/GARCFile.cs | 2 + pk3DS.Core/Game/GARCReference.cs | 8 + pk3DS.Core/Game/GameBackup.cs | 10 +- pk3DS.Core/Game/GameConfig.cs | 58 +- pk3DS.Core/Game/GameRNG.cs | 1 + pk3DS.Core/Game/GameVersion.cs | 13 + pk3DS.Core/Game/TextReference.cs | 6 + pk3DS.Core/Game/TextVariableCode.cs | 3 + pk3DS.Core/ImageUtil.cs | 10 +- pk3DS.Core/Legality/Legal.cs | 17 + pk3DS.Core/Legality/Tables6.cs | 16 + pk3DS.Core/Legality/Tables7.cs | 14 + pk3DS.Core/Randomizers/EggMoveRandomizer.cs | 1 + pk3DS.Core/Randomizers/EvolutionRandomizer.cs | 1 - pk3DS.Core/Randomizers/FormRandomizer.cs | 1 + pk3DS.Core/Randomizers/GenericRandomizer.cs | 2 +- pk3DS.Core/Randomizers/LearnsetRandomizer.cs | 2 + pk3DS.Core/Randomizers/MoveRandomizer.cs | 9 + pk3DS.Core/Randomizers/PersonalRandomizer.cs | 15 +- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 12 + pk3DS.Core/StructConverter.cs | 1 + pk3DS.Core/Structures/EggMoves.cs | 6 + pk3DS.Core/Structures/Gen6/EncounterGift6.cs | 3 +- .../Structures/Gen6/EncounterStatic6.cs | 18 +- pk3DS.Core/Structures/Gen6/Evolutions.cs | 6 + pk3DS.Core/Structures/Gen6/Item6.cs | 1 + pk3DS.Core/Structures/Gen6/Maison6.cs | 8 +- pk3DS.Core/Structures/Gen6/MegaEvolution6.cs | 2 + pk3DS.Core/Structures/Gen6/trdata6.cs | 4 + pk3DS.Core/Structures/Gen7/EncounterGift7.cs | 12 + .../Structures/Gen7/EncounterStatic7.cs | 27 +- pk3DS.Core/Structures/Gen7/EncounterTrade7.cs | 9 + pk3DS.Core/Structures/Gen7/Maison7.cs | 8 +- pk3DS.Core/Structures/Gen7/ZoneData7.cs | 6 +- pk3DS.Core/Structures/Gen7/trpoke7.cs | 5 +- pk3DS.Core/Structures/Learnset.cs | 7 +- .../Structures/PersonalInfo/PersonalInfo.cs | 3 + .../PersonalInfo/PersonalInfoORAS.cs | 2 + .../Structures/PersonalInfo/PersonalInfoSM.cs | 2 + .../Structures/PersonalInfo/PersonalInfoXY.cs | 9 + .../Structures/PersonalInfo/PersonalTable.cs | 6 + pk3DS.Core/Structures/Script.cs | 2 + pk3DS.Core/Structures/Scripts.cs | 21 +- pk3DS.Core/Structures/TypeChart.cs | 4 +- pk3DS.Core/TableUtil.cs | 4 + pk3DS.Core/TextFile.cs | 26 +- pk3DS.Core/Util.cs | 16 +- pk3DS/ARCUtil.cs | 17 +- pk3DS/Legality/Randomizer.cs | 11 + pk3DS/Main.Designer.cs | 272 +++--- pk3DS/Main.cs | 351 +++++--- pk3DS/Misc/About.cs | 1 + pk3DS/Misc/ErrorWindow.cs | 2 +- pk3DS/Misc/Patch.cs | 5 +- pk3DS/Subforms/EnhancedRestore.cs | 2 +- pk3DS/Subforms/Gen6/EggMoveEditor6.cs | 6 + pk3DS/Subforms/Gen6/EvolutionEditor6.cs | 6 + .../Gen6/Experimental/MapPermView.Designer.cs | 6 +- .../Subforms/Gen6/Experimental/MapPermView.cs | 49 +- .../Gen6/Experimental/OWSE.Designer.cs | 646 +++++++------- pk3DS/Subforms/Gen6/Experimental/OWSE.cs | 302 ++++--- .../Subforms/Gen6/Experimental/OWSEStructs.cs | 2 +- pk3DS/Subforms/Gen6/GiftEditor6.cs | 13 +- pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs | 38 +- pk3DS/Subforms/Gen6/ItemEditor6.cs | 21 +- pk3DS/Subforms/Gen6/LevelUpEditor6.cs | 5 + pk3DS/Subforms/Gen6/MaisonEditor6.cs | 12 +- pk3DS/Subforms/Gen6/MartEditor6.cs | 10 +- pk3DS/Subforms/Gen6/MegaEvoEditor6.cs | 5 + pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs | 274 +++--- pk3DS/Subforms/Gen6/MoveEditor6.cs | 26 +- pk3DS/Subforms/Gen6/OPower.cs | 7 +- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 16 +- pk3DS/Subforms/Gen6/PickupEditor6.cs | 14 +- pk3DS/Subforms/Gen6/RSTE.Designer.cs | 786 +++++++++--------- pk3DS/Subforms/Gen6/RSTE.cs | 267 +++--- pk3DS/Subforms/Gen6/RSWE.cs | 27 +- pk3DS/Subforms/Gen6/StarterEditor6.cs | 16 +- .../Gen6/StaticEncounterEditor6.Designer.cs | 4 +- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 40 +- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 41 +- pk3DS/Subforms/Gen6/TitleScreenEditor6.cs | 8 +- pk3DS/Subforms/Gen6/TrainerRand.cs | 7 +- pk3DS/Subforms/Gen6/TutorEditor6.cs | 11 +- pk3DS/Subforms/Gen6/TypeChart6.cs | 10 +- pk3DS/Subforms/Gen6/XYWE.cs | 19 +- pk3DS/Subforms/Gen7/EggMoveEditor7.cs | 6 +- pk3DS/Subforms/Gen7/EvolutionEditor7.cs | 6 + pk3DS/Subforms/Gen7/Experimental/OWSE7.cs | 14 +- pk3DS/Subforms/Gen7/ItemEditor7.cs | 5 + pk3DS/Subforms/Gen7/LevelUpEditor7.cs | 5 + pk3DS/Subforms/Gen7/MaisonEditor7.cs | 12 +- pk3DS/Subforms/Gen7/MartEditor7.cs | 28 +- pk3DS/Subforms/Gen7/MartEditor7UU.cs | 45 +- pk3DS/Subforms/Gen7/MegaEvoEditor7.cs | 5 + pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs | 274 +++--- pk3DS/Subforms/Gen7/MoveEditor7.cs | 21 +- pk3DS/Subforms/Gen7/PersonalEditor7.cs | 16 +- pk3DS/Subforms/Gen7/PickupEditor7.cs | 8 +- pk3DS/Subforms/Gen7/SMTE.cs | 48 +- pk3DS/Subforms/Gen7/SMWE.cs | 92 +- .../Gen7/StaticEncounterEditor7.Designer.cs | 8 +- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 134 +-- pk3DS/Subforms/Gen7/TMEditor7.cs | 11 +- pk3DS/Subforms/Gen7/TypeChart7.cs | 10 +- pk3DS/Subforms/Gen7/Wild/EncounterTable.cs | 12 +- pk3DS/Subforms/ShinyRate.cs | 8 +- pk3DS/Subforms/TextEditor.cs | 7 + pk3DS/Tools/Icon.cs | 16 + pk3DS/Tools/RandSettings.cs | 5 + pk3DS/Tools/Scripts.cs | 21 +- pk3DS/Tools/Shuffler.cs | 1 + pk3DS/Tools/ToolsUI.Designer.cs | 6 +- pk3DS/Tools/ToolsUI.cs | 71 +- pk3DS/WinFormsUtil.cs | 37 +- 136 files changed, 2951 insertions(+), 2033 deletions(-) diff --git a/pk3DS.Core/CTR/AES.cs b/pk3DS.Core/CTR/AES.cs index 9aafd90930..878368f659 100644 --- a/pk3DS.Core/CTR/AES.cs +++ b/pk3DS.Core/CTR/AES.cs @@ -43,6 +43,7 @@ public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, b return inputCount; } } + public class AesCounter { public const int BufferSize = 0x400000; //4 MB Buffer @@ -83,14 +84,14 @@ public ulong SwapBytes(ulong value) { ulong uvalue = value; ulong swapped = - 0x00000000000000FF & (uvalue >> 56) - | 0x000000000000FF00 & (uvalue >> 40) - | 0x0000000000FF0000 & (uvalue >> 24) - | 0x00000000FF000000 & (uvalue >> 8) - | 0x000000FF00000000 & (uvalue << 8) - | 0x0000FF0000000000 & (uvalue << 24) - | 0x00FF000000000000 & (uvalue << 40) - | 0xFF00000000000000 & (uvalue << 56); + (0x00000000000000FF & (uvalue >> 56)) + | (0x000000000000FF00 & (uvalue >> 40)) + | (0x0000000000FF0000 & (uvalue >> 24)) + | (0x00000000FF000000 & (uvalue >> 8)) + | (0x000000FF00000000 & (uvalue << 8)) + | (0x0000FF0000000000 & (uvalue << 24)) + | (0x00FF000000000000 & (uvalue << 40)) + | (0xFF00000000000000 & (uvalue << 56)); return swapped; } } diff --git a/pk3DS.Core/CTR/ALYT.cs b/pk3DS.Core/CTR/ALYT.cs index 01b66240b5..f41281c7e7 100644 --- a/pk3DS.Core/CTR/ALYT.cs +++ b/pk3DS.Core/CTR/ALYT.cs @@ -135,6 +135,7 @@ public static byte[] GetData(string path) using (var br = new BinaryReader(File.OpenRead(path))) return GetData(br); } + /// /// Rips out the data portion of the ALYT, assuming the ALYT is partially valid. /// @@ -144,6 +145,7 @@ public static byte[] GetData(byte[] data) using (var br = new BinaryReader(ms)) return GetData(br); } + /// /// Rips out the data portion of the ALYT, assuming the ALYT is partially valid. /// @@ -152,6 +154,7 @@ public static byte[] GetData(Stream ms) using (var br = new BinaryReader(ms)) return GetData(br); } + private static byte[] GetData(BinaryReader br) { if (br.BaseStream.Length <= 0x80) diff --git a/pk3DS.Core/CTR/BLZ.cs b/pk3DS.Core/CTR/BLZ.cs index 5b98f458b5..52755f7dea 100644 --- a/pk3DS.Core/CTR/BLZ.cs +++ b/pk3DS.Core/CTR/BLZ.cs @@ -45,12 +45,14 @@ public class BLZCoder private int new_len; private readonly ProgressBar pBar1; + private void initpBar(int max) { if (pBar1.InvokeRequired) pBar1.Invoke((MethodInvoker)delegate { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = max; }); else { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = max; } } + private void setpBarPos(int pos) { if (pBar1.InvokeRequired) @@ -71,7 +73,6 @@ public BLZCoder(string[] args, ProgressBar pBar = null) if (args[0].Equals("-d")) cmd = CMD_DECODE; - else if (args[0].Equals("-en") || args[0].Equals("-en9")) { cmd = CMD_ENCODE; @@ -105,6 +106,7 @@ public BLZCoder(string[] args, ProgressBar pBar = null) Console.Write(Environment.NewLine + "Done" + Environment.NewLine); } + private static void Save(string filename, byte[] buffer, int length) { Array.Resize(ref buffer, length); @@ -117,6 +119,7 @@ private static void Save(string filename, byte[] buffer, int length) Console.Write(Environment.NewLine + "Wrote to 'blz.bin' instead." + Environment.NewLine); } } + private static void BLZ_Decode(string filename) { try @@ -134,6 +137,7 @@ private static void BLZ_Decode(string filename) catch (IOException e) { Console.Write(Environment.NewLine + "File read error" + Environment.NewLine + e); } } + private static BLZResult BLZ_Decode(byte[] data) { int raw_len, len; @@ -244,6 +248,7 @@ private static BLZResult BLZ_Decode(byte[] data) return new BLZResult(raw_buffer, raw_len); } + private BLZResult BLZ_Encode(byte[] data, int mode) { new_len = 0; @@ -263,6 +268,7 @@ private BLZResult BLZ_Encode(byte[] data, int mode) } return new BLZResult(pak_buffer, pak_len); } + private static byte[] prepareData(byte[] data) { int fs = data.Length; @@ -272,6 +278,7 @@ private static byte[] prepareData(byte[] data) return fb; } + private static void writeUnsigned(byte[] buffer, int offset, int value) { buffer[offset] = (byte)(value & 0xFF); @@ -279,6 +286,7 @@ private static void writeUnsigned(byte[] buffer, int offset, int value) buffer[offset + 2] = (byte)((value >> 16) & 0xFF); buffer[offset + 3] = (byte)((value >> 24) & 0x7F); } + private void BLZ_Encode(string filename, int mode) { try @@ -298,6 +306,7 @@ private void BLZ_Encode(string filename, int mode) catch (IOException e) { Console.Write(Environment.NewLine + "File read error" + Environment.NewLine + e + Environment.NewLine); } } + private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best) { int flg = 0; @@ -308,7 +317,7 @@ private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best) int pak_tmp = 0; int raw_tmp = raw_len; - int pak_len = raw_len + (raw_len + 7) / 8 + 11; + int pak_len = raw_len + ((raw_len + 7) / 8) + 11; byte[] pak_buffer = new byte[pak_len]; int raw_new = raw_len; @@ -459,6 +468,7 @@ public SearchPair(int l, int p) this.p = p; } } + private static SearchPair SEARCH(int p, IList raw_buffer, int raw, int raw_end) { int l = BLZ_THRESHOLD; @@ -497,6 +507,7 @@ public BLZResult(byte[] raw_buffer, int raw_len) public readonly byte[] buffer; public readonly int length; } + private static void BLZ_Invert(byte[] buffer, int offset, int length) { int bottom = offset + length - 1; diff --git a/pk3DS.Core/CTR/CRO.cs b/pk3DS.Core/CTR/CRO.cs index 3fc706e6a9..ddebd84d4c 100644 --- a/pk3DS.Core/CTR/CRO.cs +++ b/pk3DS.Core/CTR/CRO.cs @@ -30,6 +30,7 @@ internal static void updateTB(RichTextBox RTB, string progress) } catch { } } + internal static int IndexOfBytes(byte[] array, byte[] pattern, int startIndex, int count) { int i = startIndex; @@ -45,10 +46,12 @@ internal static int IndexOfBytes(byte[] array, byte[] pattern, int startIndex, i } return -1; } + internal static string getHexString(byte[] data) { return BitConverter.ToString(data).Replace("-", ""); } + internal static byte[] StringToByteArray(string hex) { return Enumerable.Range(0, hex.Length) @@ -99,12 +102,13 @@ internal static string[] verifyCRR(string PATH_CRR, string PATH_CRO) for (int i = 0; i < hashData.Length; i++) { byte[] crrEntryHash = new byte[0x20]; - Array.Copy(CRR, i * 0x20 + hashTableOffset, crrEntryHash, 0, 0x20); + Array.Copy(CRR, (i * 0x20) + hashTableOffset, crrEntryHash, 0, 0x20); results[i] = "Hash @ {0} is " + (crrEntryHash.SequenceEqual(hashData[i]) ? "valid." : "invalid."); - Array.Copy(hashData, 0, CRR, hashTableOffset + 0x20 * i, 0x20); + Array.Copy(hashData, 0, CRR, hashTableOffset + (0x20 * i), 0x20); } return results; } + public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = true, bool saveCRR = true, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { // Get CRO files @@ -175,7 +179,7 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr } // Store Hashes in CRR for (int i = 0; i < hashData.Length; i++) - Array.Copy(hashData[i], 0, CRR, hashTableOffset + 0x20 * i, 0x20); + Array.Copy(hashData[i], 0, CRR, hashTableOffset + (0x20 * i), 0x20); updateTB(TB_Progress, updatedCTR > 0 @@ -194,6 +198,7 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr } return true; } + internal static byte[] hashCRO(ref byte[] CRO) { // Allocate new byte array to store modified CRO @@ -215,12 +220,13 @@ internal static byte[] hashCRO(ref byte[] CRO) return mySHA.ComputeHash(CRO, 0, 0x80); } - public CRO(byte[] data) { Data = (byte[])data.Clone(); } + private readonly byte[] Data; + private byte[] sha2Hash { get @@ -236,6 +242,7 @@ private byte[] sha2Hash Array.Copy(value, Data, value.Length); } } + private string Magic => new string(Data.Skip(0x80).Take(4).Select(c => (char)c).ToArray()); } } diff --git a/pk3DS.Core/CTR/CTR.cs b/pk3DS.Core/CTR/CTR.cs index bbf85bbc23..225d76f850 100644 --- a/pk3DS.Core/CTR/CTR.cs +++ b/pk3DS.Core/CTR/CTR.cs @@ -113,6 +113,7 @@ internal static NCCH setNCCH(string EXEFS_PATH, string ROMFS_PATH, string EXHEAD return NCCH; } + internal static NCSD setNCSD(NCCH NCCH, bool Card2, ProgressBar PB_Show = null, RichTextBox TB_Progress = null) { @@ -126,7 +127,7 @@ internal static NCSD setNCSD(NCCH NCCH, bool Card2, header = new NCSD.Header {Signature = new byte[0x100], Magic = 0x4453434E} }; ulong Length = 0x80 * 0x100000; // 128 MB - while (Length <= NCCH.header.Size * MEDIA_UNIT_SIZE + 0x400000) //Extra 4 MB for potential save data + while (Length <= (NCCH.header.Size * MEDIA_UNIT_SIZE) + 0x400000) //Extra 4 MB for potential save data { Length *= 2; } @@ -194,6 +195,7 @@ internal static NCSD setNCSD(NCCH NCCH, bool Card2, //NCSD is Initialized return NCSD; } + internal static bool writeROM(NCSD NCSD, string SAVE_PATH, ProgressBar PB_Show = null, RichTextBox TB_Progress = null) { @@ -223,14 +225,14 @@ internal static bool writeROM(NCSD NCSD, string SAVE_PATH, break; case 1: //Exefs updateTB(TB_Progress, "Writing Exefs..."); - OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.ExefsOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.ExefsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); byte[] OutExefs = new byte[NCSD.NCCH_Array[0].exefs.Data.Length]; aesctr.TransformBlock(NCSD.NCCH_Array[0].exefs.Data, 0, NCSD.NCCH_Array[0].exefs.Data.Length, OutExefs, 0); OutFileStream.Write(OutExefs, 0, OutExefs.Length); break; case 2: //Romfs updateTB(TB_Progress, "Writing Romfs..."); - OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.RomfsOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.RomfsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); using (FileStream InFileStream = new FileStream(NCSD.NCCH_Array[0].romfs.FileName, FileMode.Open, FileAccess.Read)) { uint BUFFER_SIZE; @@ -257,17 +259,17 @@ internal static bool writeROM(NCSD NCSD, string SAVE_PATH, } } updateTB(TB_Progress, "Writing Logo..."); - OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.LogoOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.LogoOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); OutFileStream.Write(NCSD.NCCH_Array[0].logo, 0, NCSD.NCCH_Array[0].logo.Length); if (NCSD.NCCH_Array[0].plainregion.Length > 0) { updateTB(TB_Progress, "Writing Plain Region..."); - OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.PlainRegionOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.PlainRegionOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); OutFileStream.Write(NCSD.NCCH_Array[0].plainregion, 0, NCSD.NCCH_Array[0].plainregion.Length); } //NCSD Padding - OutFileStream.Seek(NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE + NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE, SeekOrigin.Begin); + OutFileStream.Seek((NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE) + (NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE), SeekOrigin.Begin); ulong TotalLen = NCSD.header.MediaSize * MEDIA_UNIT_SIZE; byte[] Buffer = Enumerable.Repeat((byte)0xFF, 0x400000).ToArray(); updateTB(TB_Progress, "Writing NCSD Padding..."); @@ -324,6 +326,7 @@ internal static bool isValid(string exeFS, string romFS, string exeheader, strin Exheader exh = new Exheader(exeheader); return !exh.isPokemon() || Card2; } + internal static void updateTB(RichTextBox RTB, string progress) { try @@ -344,12 +347,13 @@ internal static void updateTB(RichTextBox RTB, string progress) } catch { } } + internal static ulong Align(ulong input, ulong alignsize) { ulong output = input; if (output % alignsize != 0) { - output += alignsize - output % alignsize; + output += alignsize - (output % alignsize); } return output; } diff --git a/pk3DS.Core/CTR/DARC.cs b/pk3DS.Core/CTR/DARC.cs index c37247479a..752adfec06 100644 --- a/pk3DS.Core/CTR/DARC.cs +++ b/pk3DS.Core/CTR/DARC.cs @@ -33,7 +33,7 @@ public DARC(byte[] Data = null) while ((c = (char) br.ReadUInt16()) > 0) s += c; FileNameTable[i] = new NameTableEntry(offs, s); - offs += (uint)s.Length * 2 + 2; + offs += ((uint)s.Length * 2) + 2; } br.BaseStream.Position = Header.FileDataOffset; this.Data = br.ReadBytes((int)(Header.FileSize - Header.FileDataOffset)); @@ -57,6 +57,7 @@ public DARCHeader(BinaryReader br = null) FileTableLength = br.ReadUInt32(); FileDataOffset = br.ReadUInt32(); } + public string Signature; public ushort Endianness; public ushort HeaderSize; @@ -66,6 +67,7 @@ public DARCHeader(BinaryReader br = null) public uint FileTableLength; public uint FileDataOffset; } + public class FileTableEntry { public FileTableEntry(BinaryReader br = null) @@ -77,15 +79,18 @@ public FileTableEntry(BinaryReader br = null) DataOffset = br.ReadUInt32(); DataLength = br.ReadUInt32(); } + public uint NameOffset; public bool IsFolder; public uint DataOffset; // FOLDER: Parent Entry Index public uint DataLength; // FOLDER: Next Folder Index } + public class NameTableEntry { public uint NameOffset; public string FileName; + public NameTableEntry(uint offset, string fileName) { NameOffset = offset; @@ -129,6 +134,7 @@ public static byte[] setDARC(DARC darc) return ms.ToArray(); } } + public static DARC getDARC(string folderName) { // Package Folder into a DARC. @@ -168,7 +174,6 @@ public static DARC getDARC(string folderName) string fileName = fi.Name; NameList.Add(new NameTableEntry(nameOffset, parentName)); - EntryList.Add(new FileTableEntry { DataOffset = (uint) Data.Length, @@ -187,8 +192,8 @@ public static DARC getDARC(string folderName) int darcFileCount = NameList.Count; int NameListOffset = darcFileCount * 0xC; int NameListLength = (int)(nameOffset + NameListOffset); - int DataOffset = NameListLength % 4 == 0 ? NameListLength : NameListLength + (4 - NameListLength % 4); - Array.Resize(ref Data, Data.Length % 4 == 0 ? Data.Length : Data.Length + 4 - Data.Length % 4); + int DataOffset = NameListLength % 4 == 0 ? NameListLength : NameListLength + (4 - (NameListLength % 4)); + Array.Resize(ref Data, Data.Length % 4 == 0 ? Data.Length : Data.Length + 4 - (Data.Length % 4)); int FinalSize = DataOffset + Data.Length; // Create New DARC @@ -224,6 +229,7 @@ public static bool darc2files(string path, string folderName) try { return darc2files(File.ReadAllBytes(path), folderName); } catch (Exception) { return false; } } + public static bool darc2files(byte[] darc, string folderName) { // Save all contents of a DARC to a folder, assuming there's only 1 layer of folders. @@ -266,6 +272,7 @@ public static bool darc2files(byte[] darc, string folderName) } catch (Exception) { return false; } } + public static bool files2darc(string folderName, bool delete = false, string originalDARC = null, string outFile = null) { // Save all contents of a folder to a darc. @@ -313,11 +320,13 @@ public static int getDARCposition(byte[] data) { pos += 4; if (pos >= data.Length) return -1; } return pos; } + public static bool insertFile(ref DARC orig, int index, string path) { try { return insertFile(ref orig, index, File.ReadAllBytes(path)); } catch (Exception) { return false; } } + public static bool insertFile(ref DARC orig, int index, byte[] data) { if (index < 0) return false; @@ -344,6 +353,7 @@ public static bool insertFile(ref DARC orig, int index, byte[] data) } catch (Exception) { return false; } } + public static DARC insertFiles(DARC orig, string folderName) { string[] fileNames = new string[orig.Entries.Length]; @@ -364,7 +374,7 @@ public static DARC insertFiles(DARC orig, string folderName) insertFile(ref orig, index, file); } // Fix Data layout - Array.Resize(ref orig.Data, orig.Data.Length % 4 == 0 ? orig.Data.Length : orig.Data.Length + 4 - orig.Data.Length % 4); + Array.Resize(ref orig.Data, orig.Data.Length % 4 == 0 ? orig.Data.Length : orig.Data.Length + 4 - (orig.Data.Length % 4)); orig.Header.FileSize = (uint)(orig.Data.Length + orig.Header.FileDataOffset); return orig; } diff --git a/pk3DS.Core/CTR/ExeFS.cs b/pk3DS.Core/CTR/ExeFS.cs index a9ea1e2307..48d07113be 100644 --- a/pk3DS.Core/CTR/ExeFS.cs +++ b/pk3DS.Core/CTR/ExeFS.cs @@ -48,13 +48,14 @@ public static bool get(string inFile, string outPath) // New File Path outPath + Path.DirectorySeparatorChar + fileName + ".bin", // Get New Data from Offset after 0x200 Header. - data.Skip(0x200 + BitConverter.ToInt32(data, 0x8 + 0x10 * i)).Take(BitConverter.ToInt32(data, 0xC + 0x10 * i)).ToArray() + data.Skip(0x200 + BitConverter.ToInt32(data, 0x8 + (0x10 * i))).Take(BitConverter.ToInt32(data, 0xC + (0x10 * i))).ToArray() ); } return true; } catch { return false; } } + public static bool set(string[] files, string outFile) { if (files.Length > 10) { Console.WriteLine("Cannot package more than 10 files to exefs."); return false; } @@ -76,13 +77,13 @@ public static bool set(string[] files, string outFile) FileInfo fi = new FileInfo(files[i]); uint size = (uint)fi.Length; - Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + i * 0x10, 0x4); - Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + i * 0x10, 0x4); - offset += 0x200 - size % 0x200 + size; + Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + (i * 0x10), 0x4); + Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + (i * 0x10), 0x4); + offset += 0x200 - (size % 0x200) + size; // Do the Bottom (Hashes) byte[] hash = sha.ComputeHash(File.ReadAllBytes(files[i])); - Array.Copy(hash, 0, headerData, 0x200 - 0x20 * (i + 1), 0x20); + Array.Copy(hash, 0, headerData, 0x200 - (0x20 * (i + 1)), 0x20); } // Set in the Data @@ -93,7 +94,7 @@ public static bool set(string[] files, string outFile) { using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s))) loadFile.CopyTo(newFile); - new MemoryStream(new byte[0x200 - newFile.Length % 0x200]).CopyTo(newFile); + new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile); } File.WriteAllBytes(outFile, newFile.ToArray()); @@ -120,13 +121,13 @@ public void setData(string[] files) FileInfo fi = new FileInfo(files[i]); uint size = (uint)fi.Length; - Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + i * 0x10, 0x4); - Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + i * 0x10, 0x4); - offset += 0x200 - size % 0x200 + size; + Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + (i * 0x10), 0x4); + Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + (i * 0x10), 0x4); + offset += 0x200 - (size % 0x200) + size; // Do the Bottom (Hashes) byte[] hash = sha.ComputeHash(File.ReadAllBytes(files[i])); - Array.Copy(hash, 0, headerData, 0x200 - 0x20 * (i + 1), 0x20); + Array.Copy(hash, 0, headerData, 0x200 - (0x20 * (i + 1)), 0x20); } // Set in the Data @@ -137,7 +138,7 @@ public void setData(string[] files) { using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s))) loadFile.CopyTo(newFile); - new MemoryStream(new byte[0x200 - newFile.Length % 0x200]).CopyTo(newFile); + new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile); } Data = newFile.ToArray(); diff --git a/pk3DS.Core/CTR/Exheader.cs b/pk3DS.Core/CTR/Exheader.cs index f91ebb96c5..7a93359c06 100644 --- a/pk3DS.Core/CTR/Exheader.cs +++ b/pk3DS.Core/CTR/Exheader.cs @@ -26,6 +26,7 @@ public byte[] GetSuperBlockHash() SHA256Managed sha = new SHA256Managed(); return sha.ComputeHash(Data, 0, 0x400); } + public string GetSerial() { const string output = "CTR-P-"; @@ -40,7 +41,7 @@ public string GetSerial() { char lc = RecognizedGames[titleid].ToArray()[0].ToCharArray()[3]; char lc2 = vars[1].ToCharArray()[3]; - if (lc2 == 'A' || lc2 == 'E' || lc2 == 'P' && lc == 'J') //Prefer games in order US, PAL, JP + if (lc2 == 'A' || lc2 == 'E' || (lc2 == 'P' && lc == 'J')) //Prefer games in order US, PAL, JP { RecognizedGames[titleid] = vars.Skip(1).Take(2).ToArray(); } @@ -57,14 +58,17 @@ public bool isPokemon() { return isORAS() || isXY(); } + public bool isORAS() { return (TitleID & 0xFFFFFFFF) >> 8 == 0x11C5 || (TitleID & 0xFFFFFFFF) >> 8 == 0x11C4; } + public bool isXY() { return (TitleID & 0xFFFFFFFF) >> 8 == 0x55D || (TitleID & 0xFFFFFFFF) >> 8 == 0x55E; } + public string GetPokemonSerial() { if (!isPokemon()) diff --git a/pk3DS.Core/CTR/FileFormat.cs b/pk3DS.Core/CTR/FileFormat.cs index 78948aa1c2..8e379183ec 100644 --- a/pk3DS.Core/CTR/FileFormat.cs +++ b/pk3DS.Core/CTR/FileFormat.cs @@ -18,6 +18,7 @@ public static string Guess(string path) ext = Guess(br); return ext; } + public static string Guess(byte[] data) { string ext; @@ -25,6 +26,7 @@ public static string Guess(byte[] data) ext = Guess(br); return ext; } + public static string Guess(MemoryStream ms, bool start = true) { string ext; @@ -32,6 +34,7 @@ public static string Guess(MemoryStream ms, bool start = true) ext = Guess(br, start); return ext; } + public static string Guess(BinaryReader br, bool start = true) { long position = br.BaseStream.Position; // Store current position to reset after. @@ -69,7 +72,7 @@ public static bool GuessMini(BinaryReader br, out string ext) // check for 2char container extensions ushort magic = br.ReadUInt16(); ushort count = br.ReadUInt16(); - br.BaseStream.Position = 4 + 4 * count; + br.BaseStream.Position = 4 + (4 * count); if (br.ReadUInt32() == br.BaseStream.Length) { ext += (char)magic & 0xFF; @@ -82,6 +85,7 @@ public static bool GuessMini(BinaryReader br, out string ext) return ext.Length > 0; } + public static bool GuessHeaderedDARC(BinaryReader br, out string ext) { long position = br.BaseStream.Position; // Store current position to reset after. @@ -90,7 +94,7 @@ public static bool GuessHeaderedDARC(BinaryReader br, out string ext) { byte[] magic = Encoding.ASCII.GetBytes(br.ReadChars(4)); int count = BitConverter.ToUInt16(magic, 0); - br.BaseStream.Position = position + 4 + 0x40 * count; + br.BaseStream.Position = position + 4 + (0x40 * count); uint tableval = br.ReadUInt32(); br.BaseStream.Position += 0x20 * tableval; while (br.PeekChar() == 0) // seek forward @@ -104,6 +108,7 @@ public static bool GuessHeaderedDARC(BinaryReader br, out string ext) return ext.Length > 0; } + public static bool GuessBCLIM(BinaryReader br, out string ext) { long position = br.BaseStream.Position; // Store current position to reset after. @@ -124,6 +129,7 @@ public static bool GuessBCLIM(BinaryReader br, out string ext) return ext.Length > 0; } + public static bool GuessLZ11(BinaryReader br, out string ext) { long position = br.BaseStream.Position; // Store current position to reset after. @@ -144,6 +150,7 @@ public static bool GuessLZ11(BinaryReader br, out string ext) br.BaseStream.Position = position; return ext.Length > 0; } + public static bool Guess4CHAR(BinaryReader br, out string ext) { long position = br.BaseStream.Position; // Store current position to reset after. @@ -163,6 +170,7 @@ public static bool Guess4CHAR(BinaryReader br, out string ext) br.BaseStream.Position = position; return false; } + public static bool Guess3CHAR(BinaryReader br, out string ext) { long position = br.BaseStream.Position; // Store current position to reset after. diff --git a/pk3DS.Core/CTR/GARC.cs b/pk3DS.Core/CTR/GARC.cs index 200ecb59d7..9d518728f3 100644 --- a/pk3DS.Core/CTR/GARC.cs +++ b/pk3DS.Core/CTR/GARC.cs @@ -28,7 +28,6 @@ public class UnpackProgressedEventArgs : EventArgs public int Total { get; set; } } - public static event EventHandler FileCountDetermined; public static event EventHandler PackProgressed; public static event EventHandler UnpackProgressed; @@ -82,7 +81,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in // Magic = new[] { 'O', 'T', 'A', 'F' }, Entries = new FATO_Entry[packOrder.Length], EntryCount = (ushort) packOrder.Length, - HeaderSize = 0xC + packOrder.Length*4, + HeaderSize = 0xC + (packOrder.Length*4), Padding = 0xFFFF }, fatb = @@ -133,7 +132,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in // Assemble Entry FileInfo fi = new FileInfo(packOrder[i]); - int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - fi.Length % 4); + int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - (fi.Length % 4)); garc.fatb.Entries[i].SubEntries[0].Start = od; garc.fatb.Entries[i].SubEntries[0].End = actualLength + garc.fatb.Entries[i].SubEntries[0].Start; garc.fatb.Entries[i].SubEntries[0].Length = (int)fi.Length; @@ -169,7 +168,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in // Assemble Entry FileInfo fi = new FileInfo(s); - int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - fi.Length % 4); + int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - (fi.Length % 4)); garc.fatb.Entries[i].SubEntries[fileNumber].Start = od; garc.fatb.Entries[i].SubEntries[fileNumber].End = actualLength + garc.fatb.Entries[i].SubEntries[fileNumber].Start; garc.fatb.Entries[i].SubEntries[fileNumber].Length = (int)fi.Length; @@ -314,6 +313,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in return filectr; } } + public static int garcUnpack(string garcPath, string outPath, bool skipDecompression) { if (!File.Exists(garcPath)) throw new FileNotFoundException("File does not exist"); @@ -338,7 +338,6 @@ public static int garcUnpack(string garcPath, string outPath, bool skipDecompres // Pull out all the files for (int o = 0; o < garc.fato.EntryCount; o++) { - var Entry = garc.fatb.Entries[o]; // Set Entry File Name string fileName = o.ToString(format); @@ -404,6 +403,7 @@ public static GARCFile unpackGARC(string path) { return unpackGARC(File.OpenRead(path)); } + private static GARCFile unpackGARC(byte[] data) { GARCFile garc; @@ -411,6 +411,7 @@ private static GARCFile unpackGARC(byte[] data) garc = unpackGARC(gd); return garc; } + private static GARCFile unpackGARC(Stream stream) { GARCFile garc = new GARCFile(); @@ -500,7 +501,7 @@ public static MemGARC packGARC(byte[][] data, int version, int contentpadnearest // Magic = new[] { 'O', 'T', 'A', 'F' }, Entries = new FATO_Entry[data.Length], EntryCount = (ushort) data.Length, - HeaderSize = 0xC + data.Length*4, + HeaderSize = 0xC + (data.Length*4), Padding = 0xFFFF }, fatb = @@ -731,6 +732,7 @@ public lzGARC(byte[] data) } private readonly GARCEntry[] Storage; + private class GARCEntry { public bool Accessed; @@ -739,6 +741,7 @@ private class GARCEntry public readonly bool WasCompressed; public GARCEntry() { } + public GARCEntry(byte[] data) { Data = data; @@ -792,6 +795,7 @@ private byte[] getFile(int file, int subfile = 0) Array.Copy(Data, offset, data, 0, data.Length); return data; } + public byte[] this[int file] { get @@ -811,6 +815,7 @@ public byte[] this[int file] Storage[file].Saved = true; } } + public byte[] Save() { byte[][] data = new byte[FileCount][]; @@ -858,6 +863,7 @@ public struct FATO public FATO_Entry[] Entries; } + public struct FATO_Entry { public int Offset; @@ -871,12 +877,14 @@ public struct FATB public FATB_Entry[] Entries; } + public struct FATB_Entry { public uint Vector; public bool IsFolder; public FATB_SubEntry[] SubEntries; } + public struct FATB_SubEntry { public bool Exists; diff --git a/pk3DS.Core/CTR/Images/BCLIM.cs b/pk3DS.Core/CTR/Images/BCLIM.cs index 3abf345426..78dba2f2a4 100644 --- a/pk3DS.Core/CTR/Images/BCLIM.cs +++ b/pk3DS.Core/CTR/Images/BCLIM.cs @@ -8,11 +8,13 @@ namespace pk3DS.Core.CTR public class BCLIM : BXLIM { public BCLIM(Stream data) => ReadBCLIM(data); + public BCLIM(byte[] data) { using (var ms = new MemoryStream(data)) ReadBCLIM(ms); } + public BCLIM(string path) { var data = File.ReadAllBytes(path); @@ -111,6 +113,7 @@ public static byte[] IMGToBCLIM(Image img, char fc) } return ms.ToArray(); } + public static byte[] getBCLIM(string path, char fc) { byte[] byteArray = File.ReadAllBytes(path); @@ -120,6 +123,7 @@ public static byte[] getBCLIM(string path, char fc) return IMGToBCLIM(img, fc); } } + public static Image makeBCLIM(string path, char fc) { byte[] bclim = getBCLIM(path, fc); @@ -131,6 +135,7 @@ public static Image makeBCLIM(string path, char fc) return makeBMP(newPath); } + public static Image makeBMP(string path, bool autosave = false, bool crop = true) { BCLIM bclim = analyze(path); @@ -238,6 +243,7 @@ public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) } return 7; } + public static void writeGeneric(int format, Bitmap img, ref MemoryStream ms, bool rectangle = true) { BinaryWriter bz = new BinaryWriter(ms); @@ -258,11 +264,12 @@ public static byte[] MakePixelData(byte[] input, ref int w, ref int h, XLIMOrien for (uint i = 0; i < pixels.Length / 4; i++) { var c = orienter.Get(i); - var offset = c.X * 4 + c.Y * width; + var offset = (c.X * 4) + (c.Y * width); Array.Copy(input, offset, pixels, i * 4, 4); } return pixels; } + public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true) { int w = img.Width; @@ -347,6 +354,7 @@ public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true) return mz.ToArray(); } } + public static int getColorCount(Bitmap img) { Color[] colors = new Color[img.Width * img.Height]; @@ -372,24 +380,29 @@ internal static byte GetL8(Color c) byte green = c.G; byte blue = c.B; // Luma (Y’) = 0.299 R’ + 0.587 G’ + 0.114 B’ from wikipedia - return (byte)(((0x4CB2 * red + 0x9691 * green + 0x1D3E * blue) >> 16) & 0xFF); + return (byte)((((0x4CB2 * red) + (0x9691 * green) + (0x1D3E * blue)) >> 16) & 0xFF); } // L8 + internal static byte GetA8(Color c) { return c.A; } // A8 + internal static byte GetLA4(Color c) { - return (byte)(c.A / 0x11 + c.R / 0x11 << 4); + return (byte)((c.A / 0x11) + (c.R / 0x11) << 4); } // LA4 + internal static ushort GetLA8(Color c) { return (ushort)(c.A + (c.R << 8)); } // LA8 + internal static ushort GetHILO8(Color c) { return (ushort)(c.G + (c.R << 8)); } // HILO8 + internal static ushort GetRGB565(Color c) { int val = 0; @@ -411,6 +424,7 @@ internal static ushort GetRGBA5551(Color c) return v; }// RGBA5551 + internal static ushort GetRGBA4444(Color c) { int val = 0; @@ -420,6 +434,7 @@ internal static ushort GetRGBA4444(Color c) val += (c.R / 0x11) << 12; return (ushort)val; }// RGBA4444 + internal static uint GetRGBA8888(Color c) // RGBA8888 { uint val = 0; @@ -433,7 +448,6 @@ internal static uint GetRGBA8888(Color c) // RGBA8888 // Unit Conversion internal static byte convert8to5(int colorval) { - byte[] Convert8to5 = { 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, @@ -453,6 +467,7 @@ public static BCLIM analyze(byte[] data, string shortPath) }; return bclim; } + public static BCLIM analyze(string path) { byte[] data = File.ReadAllBytes(path); diff --git a/pk3DS.Core/CTR/Images/BFLIM.cs b/pk3DS.Core/CTR/Images/BFLIM.cs index 1aa9838b03..954eaff4d3 100644 --- a/pk3DS.Core/CTR/Images/BFLIM.cs +++ b/pk3DS.Core/CTR/Images/BFLIM.cs @@ -7,11 +7,13 @@ namespace pk3DS.Core.CTR public class BFLIM : BXLIM { public BFLIM(Stream data) => ReadBFLIM(data); + public BFLIM(byte[] data) { using (var ms = new MemoryStream(data)) ReadBFLIM(ms); } + public BFLIM(string path) { var data = File.ReadAllBytes(path); diff --git a/pk3DS.Core/CTR/Images/BXLIM.cs b/pk3DS.Core/CTR/Images/BXLIM.cs index ebd1e34fbd..ae10fb5fa1 100644 --- a/pk3DS.Core/CTR/Images/BXLIM.cs +++ b/pk3DS.Core/CTR/Images/BXLIM.cs @@ -43,7 +43,7 @@ public byte[] GetImageData(bool crop = true) continue; var val = pixels[i]; - uint o = 4 * (coord.X + coord.Y * Footer.Width); + uint o = 4 * (coord.X + (coord.Y * Footer.Width)); array[o + 0] = (byte)(val & 0xFF); array[o + 1] = (byte)(val >> 8 & 0xFF); array[o + 2] = (byte)(val >> 16 & 0xFF); @@ -56,6 +56,7 @@ public virtual uint[] GetPixels() { return PixelConverter.GetPixels(PixelData, Footer.Format).ToArray(); } + public byte[] GetPixelsRaw() { var pix = GetPixels(); diff --git a/pk3DS.Core/CTR/Images/Coordinate.cs b/pk3DS.Core/CTR/Images/Coordinate.cs index c4f6fe5e8d..0b09eebd68 100644 --- a/pk3DS.Core/CTR/Images/Coordinate.cs +++ b/pk3DS.Core/CTR/Images/Coordinate.cs @@ -9,12 +9,14 @@ public Coordinate(uint x, uint y) { X = x; Y = y; } + public void Transpose() { var tmp = X; X = Y; Y = tmp; } + public void Rotate90(uint height) { var tmp = X; diff --git a/pk3DS.Core/CTR/Images/PixelConverter.cs b/pk3DS.Core/CTR/Images/PixelConverter.cs index 64d20829b0..73129ee9b0 100644 --- a/pk3DS.Core/CTR/Images/PixelConverter.cs +++ b/pk3DS.Core/CTR/Images/PixelConverter.cs @@ -40,7 +40,6 @@ public static IEnumerable GetPixels(byte[] raw, XLIMEncoding e) } } - internal static uint GetDecodedPixelValue(uint val, XLIMEncoding e) { byte a = byte.MaxValue, r = 0, g = 0, b = 0; @@ -136,6 +135,7 @@ public static uint GetEncodedPixelValue(byte[] raw, int offset, int size) return raw[offset]; } } + public static int GetBitsPerPixel(this XLIMEncoding e) { if (_32.Contains(e)) @@ -153,10 +153,12 @@ public static int GetBitsPerPixel(this XLIMEncoding e) { XLIMEncoding.RGBA8, }; + private static readonly HashSet _24 = new HashSet { XLIMEncoding.RGBX8, }; + private static readonly HashSet _16 = new HashSet { XLIMEncoding.LA8, @@ -165,6 +167,7 @@ public static int GetBitsPerPixel(this XLIMEncoding e) XLIMEncoding.RGB5A1, XLIMEncoding.RGBA4, }; + private static readonly HashSet _8 = new HashSet { XLIMEncoding.L8, diff --git a/pk3DS.Core/CTR/Images/XLIMUtil.cs b/pk3DS.Core/CTR/Images/XLIMUtil.cs index 8698bfdf3f..a1985c1c6e 100644 --- a/pk3DS.Core/CTR/Images/XLIMUtil.cs +++ b/pk3DS.Core/CTR/Images/XLIMUtil.cs @@ -12,6 +12,7 @@ internal static int gcm(int n, int m) { return (n + m - 1) / m * m; } + /// /// Next Largest Power of 2 /// diff --git a/pk3DS.Core/CTR/LZSS.cs b/pk3DS.Core/CTR/LZSS.cs index b81b5e53dc..26f9aa4eb3 100644 --- a/pk3DS.Core/CTR/LZSS.cs +++ b/pk3DS.Core/CTR/LZSS.cs @@ -19,6 +19,7 @@ public static long Decompress(string infile, string outfile) return Decompress(inStream, inStream.Length, outStream); } } + /// /// Decompresses the given stream, writing the decompressed data to the given output stream. /// Assumes Supports(instream) returns true. @@ -302,7 +303,7 @@ internal static unsafe int Compress(Stream instream, long inLength, Stream outst // we do need to buffer the output, as the first byte indicates which blocks are compressed. // this version does not use a look-ahead, so we do not need to buffer more than 8 blocks at a time. // (a block is at most 4 bytes long) - byte[] outbuffer = new byte[8 * 4 + 1]; + byte[] outbuffer = new byte[(8 * 4) + 1]; outbuffer[0] = 0; int bufferlength = 1, bufferedBlocks = 0; int readBytes = 0; @@ -417,7 +418,7 @@ internal static unsafe int CompressWithLA(Stream instream, long inLength, Stream // we do need to buffer the output, as the first byte indicates which blocks are compressed. // this version does not use a look-ahead, so we do not need to buffer more than 8 blocks at a time. // blocks are at most 4 bytes long. - byte[] outbuffer = new byte[8 * 4 + 1]; + byte[] outbuffer = new byte[(8 * 4) + 1]; outbuffer[0] = 0; int bufferlength = 1, bufferedBlocks = 0; int readBytes = 0; @@ -438,7 +439,6 @@ internal static unsafe int CompressWithLA(Stream instream, long inLength, Stream bufferedBlocks = 0; } - if (lengths[readBytes] == 1) { outbuffer[bufferlength++] = *(instart + readBytes++); @@ -480,7 +480,6 @@ internal static unsafe int CompressWithLA(Stream instream, long inLength, Stream readBytes += lengths[readBytes]; } - bufferedBlocks++; } @@ -580,6 +579,7 @@ public InputTooLargeException() : base("The compression ratio is not high enough to fit the input " + "in a single compressed file.") { } } + /// /// An exception that is thrown by the decompression functions when there /// is not enough data available in order to properly decompress the input. @@ -610,6 +610,7 @@ public NotEnoughDataException(long currentOutSize, long totalOutSize) DesiredLength = totalOutSize; } } + /// /// An exception thrown by the compression or decompression function, indicating that the /// given input length was too large for the given input stream. @@ -624,6 +625,7 @@ public StreamTooShortException() + "before the given amout of data was read.") { } } + /// /// An exception indication that the input has more data than required in order /// to decompress it. This may indicate that more sub-files are present in the file. @@ -706,6 +708,7 @@ public static unsafe int GetOccurrenceLength(byte* newPtr, int newLength, byte* return maxLength; } } + public static class IOUtils { #region byte[] <-> (u)int diff --git a/pk3DS.Core/CTR/NCSD.cs b/pk3DS.Core/CTR/NCSD.cs index e3715246cc..0b4d4faf68 100644 --- a/pk3DS.Core/CTR/NCSD.cs +++ b/pk3DS.Core/CTR/NCSD.cs @@ -25,6 +25,7 @@ public class Header public ulong[] NCCHIdTable; //Size: 0x8; //public byte[] Padding2; //Size: 0x30; } + public class CardInfoHeader { public uint WritableAddress; @@ -48,6 +49,7 @@ public class CardInfoNotes public byte[] Reserved3; //Size: 0xCD6; } } + public class NCCH_Meta { public uint Offset; @@ -58,10 +60,11 @@ public ulong GetWritableAddress() { const ulong MEDIA_UNIT_SIZE = 0x200; return Card2 - ? Align(header.OffsetSizeTable[NCCH_Array.Count - 1].Offset * NCCH.MEDIA_UNIT_SIZE - + header.OffsetSizeTable[NCCH_Array.Count - 1].Size * NCCH.MEDIA_UNIT_SIZE + 0x1000, 0x10000) / MEDIA_UNIT_SIZE + ? Align((header.OffsetSizeTable[NCCH_Array.Count - 1].Offset * NCCH.MEDIA_UNIT_SIZE) + + (header.OffsetSizeTable[NCCH_Array.Count - 1].Size * NCCH.MEDIA_UNIT_SIZE) + 0x1000, 0x10000) / MEDIA_UNIT_SIZE : 0x00000000FFFFFFFF; } + public void BuildHeader() { Data = new byte[0x4000]; @@ -71,13 +74,13 @@ public void BuildHeader() Array.Copy(BitConverter.GetBytes(header.TitleId), 0, Data, 0x108, 8); for (int i = 0; i < header.OffsetSizeTable.Length; i++) { - Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Offset), 0, Data, 0x120 + 8 * i, 4); - Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Size), 0, Data, 0x124 + 8 * i, 4); + Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Offset), 0, Data, 0x120 + (8 * i), 4); + Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Size), 0, Data, 0x124 + (8 * i), 4); } Array.Copy(header.flags, 0, Data, 0x188, header.flags.Length); for (int i = 0; i < header.NCCHIdTable.Length; i++) { - Array.Copy(BitConverter.GetBytes(header.NCCHIdTable[i]), 0, Data, 0x190 + 8 * i, 8); + Array.Copy(BitConverter.GetBytes(header.NCCHIdTable[i]), 0, Data, 0x190 + (8 * i), 8); } //CardInfoHeader Array.Copy(BitConverter.GetBytes(cardinfoheader.WritableAddress), 0, Data, 0x200, 4); @@ -97,12 +100,13 @@ public void BuildHeader() Array.Copy(cardinfoheader.NCCH0Header, 0, Data, 0x1100, cardinfoheader.NCCH0Header.Length); Array.Copy(Enumerable.Repeat((byte)0xFF, 0x2E00).ToArray(), 0, Data, 0x1200, 0x2E00); } + internal static ulong Align(ulong input, ulong alignsize) { ulong output = input; if (output % alignsize != 0) { - output += alignsize - output % alignsize; + output += alignsize - (output % alignsize); } return output; } diff --git a/pk3DS.Core/CTR/RomFS.cs b/pk3DS.Core/CTR/RomFS.cs index f66c860bb9..1751e750c4 100644 --- a/pk3DS.Core/CTR/RomFS.cs +++ b/pk3DS.Core/CTR/RomFS.cs @@ -25,7 +25,7 @@ public RomFS(string fn) uint mhlen = (uint)(fs.ReadByte() | (fs.ReadByte() << 8) | (fs.ReadByte() << 16) | (fs.ReadByte() << 24)); SuperBlockLen = mhlen + 0x50; if (SuperBlockLen % 0x200 != 0) - SuperBlockLen += 0x200 - SuperBlockLen % 0x200; + SuperBlockLen += 0x200 - (SuperBlockLen % 0x200); byte[] superblock = new byte[SuperBlockLen]; fs.Seek(0, SeekOrigin.Begin); fs.Read(superblock, 0, superblock.Length); @@ -63,6 +63,7 @@ internal static void updateTB(RichTextBox RTB, string progress) } catch { } } + public static void BuildRomFS(string infile, string outfile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { OutFile = outfile; @@ -101,10 +102,11 @@ internal static ulong Align(ulong input, ulong alignsize) ulong output = input; if (output % alignsize != 0) { - output += alignsize - output % alignsize; + output += alignsize - (output % alignsize); } return output; } + internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { updateTB(TB_Progress, "Computing IVFC Header Data..."); @@ -233,6 +235,7 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, if (File.Exists(OutFile)) File.Delete(OutFile); File.Move(TempFile, OutFile); } + internal static void WriteBinary(string tempFile, string outFile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { using (FileStream fs = new FileStream(outFile, FileMode.Create)) @@ -268,6 +271,7 @@ internal static void WriteBinary(string tempFile, string outFile, RichTextBox TB File.Delete(TempFile); updateTB(TB_Progress, "Wrote RomFS to path:" + Environment.NewLine + outFile); } + internal static string ByteArrayToString(IEnumerable input) { StringBuilder sb = new StringBuilder(); @@ -281,6 +285,7 @@ internal static void UpdateTB_Progress(string text, RichTextBox TB_Progress = nu { TB_Progress.Text += text + Environment.NewLine; } + internal static void BuildRomFSHeader(MemoryStream romfs_stream, RomfsFile[] Entries, string DIR) { ROOT_DIR = DIR; @@ -291,6 +296,7 @@ internal static void BuildRomFSHeader(MemoryStream romfs_stream, RomfsFile[] Ent PopulateRomfs(MetaData, Entries); WriteMetaDataToStream(MetaData, romfs_stream); } + internal static void InitializeMetaData(Romfs_MetaData MetaData) { MetaData.InfoHeader = new Romfs_InfoHeader(); @@ -306,6 +312,7 @@ internal static void InitializeMetaData(Romfs_MetaData MetaData) MetaData.DirHashTable = new List(); MetaData.FileHashTable = new List(); } + internal static void CalcRomfsSize(Romfs_MetaData MetaData) { MetaData.DirNum = 1; @@ -315,7 +322,7 @@ internal static void CalcRomfsSize(Romfs_MetaData MetaData) MetaData.M_DirHashTableEntry = GetHashTableEntryCount(MetaData.DirNum); MetaData.M_FileHashTableEntry = GetHashTableEntryCount(MetaData.FileNum); - uint MetaDataSize = (uint)Align(0x28 + MetaData.M_DirHashTableEntry * 4 + MetaData.M_DirTableLen + MetaData.M_FileHashTableEntry * 4 + MetaData.M_FileTableLen, PADDING_ALIGN); + uint MetaDataSize = (uint)Align(0x28 + (MetaData.M_DirHashTableEntry * 4) + MetaData.M_DirTableLen + (MetaData.M_FileHashTableEntry * 4) + MetaData.M_FileTableLen, PADDING_ALIGN); for (int i = 0; i < MetaData.M_DirHashTableEntry; i++) MetaData.DirHashTable.Add(ROMFS_UNUSED_ENTRY); @@ -347,6 +354,7 @@ internal static void CalcRomfsSize(Romfs_MetaData MetaData) } MetaData.InfoHeader.DataOffset = MetaDataSize; } + internal static uint GetHashTableEntryCount(uint Entries) { uint count = Entries; @@ -363,6 +371,7 @@ internal static uint GetHashTableEntryCount(uint Entries) } return count; } + internal static void CalcDirSize(Romfs_MetaData MetaData, DirectoryInfo dir) { if (MetaData.M_DirTableLen == 0) @@ -381,6 +390,7 @@ internal static void CalcDirSize(Romfs_MetaData MetaData, DirectoryInfo dir) MetaData.FileNum += (uint)files.Length; MetaData.DirNum += (uint)SubDirectories.Length; } + internal static void PopulateRomfs(Romfs_MetaData MetaData, RomfsFile[] Entries) { //Recursively Add All Directories to DirectoryTable @@ -394,6 +404,7 @@ internal static void PopulateRomfs(Romfs_MetaData MetaData, RomfsFile[] Entries) //Thats it. } + internal static void PopulateHashTables(Romfs_MetaData MetaData) { for (int i = 0; i < MetaData.DirTable.DirectoryTable.Count; i++) @@ -430,6 +441,7 @@ internal static void AddDirHashKey(Romfs_MetaData MetaData, int index) } } } + internal static void AddFileHashKey(Romfs_MetaData MetaData, int index) { uint parent = MetaData.FileTable.FileTable[index].ParentDirOffset; @@ -523,6 +535,7 @@ internal static void AddDir(Romfs_MetaData MetaData, DirectoryInfo Dir, uint par MetaData.DirTable.DirectoryTable[curindex].ChildOffset = MetaData.DirTable.DirectoryTable[childindex].Offset; } + internal static void AddFiles(Romfs_MetaData MetaData, RomfsFile[] Entries) { string PrevDirPath = ""; @@ -610,7 +623,7 @@ internal static void WriteMetaDataToStream(Romfs_MetaData MetaData, MemoryStream //Padding while (stream.Position % PADDING_ALIGN != 0) - stream.Write(new byte[PADDING_ALIGN - stream.Position % 0x10], 0, (int)(PADDING_ALIGN - stream.Position % 0x10)); + stream.Write(new byte[PADDING_ALIGN - (stream.Position % 0x10)], 0, (int)(PADDING_ALIGN - (stream.Position % 0x10))); //All Done. } @@ -623,6 +636,7 @@ internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, string FullName) return -1; } + internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, uint Offset) { for (int i = 0; i < MetaData.DirTable.DirectoryTable.Count; i++) @@ -631,6 +645,7 @@ internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, uint Offset) return -1; } + internal static int GetRomfsFileEntry(Romfs_MetaData MetaData, uint Offset) { for (int i = 0; i < MetaData.FileTable.FileTable.Count; i++) @@ -657,25 +672,30 @@ public class Romfs_MetaData public uint FileTableLen; public uint M_FileTableLen; } + public struct Romfs_SectionHeader { public uint Offset; public uint Size; } + public struct Romfs_InfoHeader { public uint HeaderLength; public Romfs_SectionHeader[] Sections; public uint DataOffset; } + public class Romfs_DirTable { public List DirectoryTable; } + public class Romfs_FileTable { public List FileTable; } + public class Romfs_DirEntry { public uint ParentOffset; @@ -687,6 +707,7 @@ public class Romfs_DirEntry public string FullName; public uint Offset; } + public class Romfs_FileEntry { public uint ParentDirOffset; @@ -712,16 +733,19 @@ public static ulong GetDataBlockLength(RomfsFile[] files, ulong PreData) return files.Length == 0 ? PreData : PreData + files[files.Length - 1].Offset + files[files.Length - 1].Size; } } + public class IVFCInfo { public IVFCLevel[] Levels; } + public class IVFCLevel { public ulong HashOffset; public ulong DataLength; public uint BlockSize; } + public class FileNameTable { public List NameEntryTable { get; } @@ -745,6 +769,7 @@ internal void AddDirectory(DirectoryInfo dir) } } } + public static class LayoutManager { public static Output[] Create(IEnumerable Input) @@ -764,19 +789,22 @@ public static Output[] Create(IEnumerable Input) } return list.ToArray(); } + private static ulong AlignInput(ulong input, ulong alignsize) { ulong output = input; if (output % alignsize != 0) - output += alignsize - output % alignsize; + output += alignsize - (output % alignsize); return output; } + public class Input { public string FilePath; public uint AlignmentSize; } + public class Output { public string FilePath; diff --git a/pk3DS.Core/CTR/SARC.cs b/pk3DS.Core/CTR/SARC.cs index 6a23bd1bcd..61bdbed2ad 100644 --- a/pk3DS.Core/CTR/SARC.cs +++ b/pk3DS.Core/CTR/SARC.cs @@ -43,6 +43,7 @@ public SARC() SFAT = new SFAT(); SFNT = new SFNT(); } + /// /// Initializes a from a file location. /// @@ -56,6 +57,7 @@ public SARC(string path) ReadSARC(); Valid = true; } + /// /// Initializes a from a provided stream. /// @@ -67,6 +69,7 @@ public SARC(Stream fs) ReadSARC(); Valid = true; } + /// /// Initializes a from a provided array. /// @@ -122,6 +125,7 @@ public void SetFileInfo(string path) /// Entry to fetch data for /// Data array public byte[] GetData(SFATEntry entry) => GetData(entry.FileDataStart, entry.FileDataLength); + /// /// Overwrites the entry data, assuming the size is the exact same. /// @@ -133,6 +137,7 @@ public void SetData(SFATEntry entry, byte[] data) throw new ArgumentException(nameof(data.Length)); SetData(entry.FileDataStart, data); } + /// /// Exports the entry data for a given at a provided path with its assigned file name via the name table. /// @@ -190,6 +195,7 @@ private string GetFileName(int offset) string name = sb.ToString().Replace('/', Path.DirectorySeparatorChar); return name; } + private void SetFileName(int offset, string value) { var str = value.Replace(Path.DirectorySeparatorChar, '/'); @@ -199,6 +205,7 @@ private void SetFileName(int offset, string value) stream.WriteByte((byte)b); stream.WriteByte((byte)'\0'); } + private byte[] GetData(int offset, int length) { byte[] fileBuffer = new byte[length]; @@ -206,6 +213,7 @@ private byte[] GetData(int offset, int length) stream.Read(fileBuffer, 0, length); return fileBuffer; } + private void SetData(int offset, byte[] data) { stream.Seek(offset + DataOffset, SeekOrigin.Begin); @@ -228,6 +236,7 @@ public void Dispose() public class SFAT { public const string Identifier = nameof(SFAT); + /// /// The required matches the first 4 bytes of the file data. /// @@ -240,6 +249,7 @@ public class SFAT public List Entries; public SFAT() { } + public SFAT(BinaryReader br) { Magic = new string(br.ReadChars(4)); @@ -255,12 +265,14 @@ public SFAT(BinaryReader br) Entries.Add(new SFATEntry(br)); } } + /// /// File Name Table /// public class SFNT { public const string Identifier = nameof(SFNT); + /// /// The required matches the first 4 bytes of the file data. /// @@ -272,6 +284,7 @@ public class SFNT public uint StringOffset; public SFNT() { } + public SFNT(BinaryReader br) { Magic = new string(br.ReadChars(4)); @@ -283,6 +296,7 @@ public SFNT(BinaryReader br) StringOffset = (uint)br.BaseStream.Position; } } + /// /// File Access Table () Entry /// diff --git a/pk3DS.Core/CTR/SMDH.cs b/pk3DS.Core/CTR/SMDH.cs index c7d4e845cf..d08d3f448c 100644 --- a/pk3DS.Core/CTR/SMDH.cs +++ b/pk3DS.Core/CTR/SMDH.cs @@ -20,10 +20,12 @@ public SMDH(byte[] data) { Read(new BinaryReader(new MemoryStream(data))); } + public SMDH(string path) { Read(new BinaryReader(File.OpenRead(path))); } + public void Read(BinaryReader br) { // Check to see if the first 4 bytes (magic) is valid. @@ -41,6 +43,7 @@ public void Read(BinaryReader br) SmallIcon = new SmallIcon(br); LargeIcon = new LargeIcon(br); } + public byte[] Write() { using (var ms = new MemoryStream()) @@ -65,12 +68,14 @@ public class ApplicationInfo public string ShortDescription; //0x80 public string LongDescription; //0x100 public string Publisher; //0x80 + public ApplicationInfo(BinaryReader br) { ShortDescription = Encoding.Unicode.GetString(br.ReadBytes(0x80)).TrimEnd('\0'); LongDescription = Encoding.Unicode.GetString(br.ReadBytes(0x100)).TrimEnd('\0'); Publisher = Encoding.Unicode.GetString(br.ReadBytes(0x80)).TrimEnd('\0'); } + public void Write(BinaryWriter bw) { bw.Write(Encoding.Unicode.GetBytes(ShortDescription.PadRight(0x80/2, '\0'))); @@ -101,6 +106,7 @@ public enum RegionLockoutFlags : uint Korea = 0x20, Taiwan = 0x40 } + public enum AppSettingsFlags : uint { Visible = 1, @@ -114,6 +120,7 @@ public enum AppSettingsFlags : uint RecordUsage = 256, DisableSDSaveBackup = 512 } + public ApplicationSettings(BinaryReader br) { GameRatings = br.ReadBytes(0x10); @@ -126,6 +133,7 @@ public ApplicationSettings(BinaryReader br) AnimationDefaultFrame = br.ReadSingle(); StreetPassID = br.ReadUInt32(); } + public void Write(BinaryWriter bw) { bw.Write(GameRatings, 0, 0x10); @@ -144,15 +152,18 @@ public class SmallIcon // 24x24 { public Bitmap Icon; public byte[] Bytes; + public SmallIcon(BinaryReader br) { Bytes = br.ReadBytes(0x480); Icon = ImageUtil.GetBitmap(Bytes, 24, 24); } + public void Write(BinaryWriter bw) { bw.Write(Bytes); } + public bool ChangeIcon(Bitmap img) { if (img.Width != Icon.Width || img.Height != Icon.Height) return false; @@ -166,15 +177,18 @@ public class LargeIcon // 48x48 { public Bitmap Icon; public byte[] Bytes; + public LargeIcon(BinaryReader br) { Bytes = br.ReadBytes(0x1200); Icon = ImageUtil.GetBitmap(Bytes, 48, 48); } + public void Write(BinaryWriter bw) { bw.Write(Bytes); } + public bool ChangeIcon(Bitmap img) { if (img.Width != Icon.Width || img.Height != Icon.Height) return false; diff --git a/pk3DS.Core/Game/GARCFile.cs b/pk3DS.Core/Game/GARCFile.cs index bb359cb5e9..facad830bc 100644 --- a/pk3DS.Core/Game/GARCFile.cs +++ b/pk3DS.Core/Game/GARCFile.cs @@ -28,6 +28,7 @@ public void Save() Console.WriteLine($"Wrote {Reference.Name} to {Reference.Reference}"); } } + public class lzGARCFile { private readonly GARC.lzGARC GARC; @@ -64,6 +65,7 @@ public byte[] this[int file] get { return GARC[file]; } set { GARC[file] = value; } } + public void Save() { File.WriteAllBytes(Path, GARC.Save()); diff --git a/pk3DS.Core/Game/GARCReference.cs b/pk3DS.Core/Game/GARCReference.cs index 58e3610e1c..0d3689a907 100644 --- a/pk3DS.Core/Game/GARCReference.cs +++ b/pk3DS.Core/Game/GARCReference.cs @@ -19,6 +19,7 @@ private GARCReference(int file, string name, bool lv = false) FileNumber = file; LanguageVariant = lv; } + public GARCReference getRelativeGARC(int offset, string name = "") { return new GARCReference(FileNumber + offset, name); @@ -51,6 +52,7 @@ public GARCReference getRelativeGARC(int offset, string name = "") new GARCReference(072, "gametext", true), new GARCReference(080, "storytext", true), }; + public static readonly GARCReference[] GARCReference_AO = { new GARCReference(013, "encdata"), @@ -77,6 +79,7 @@ public GARCReference getRelativeGARC(int offset, string name = "") new GARCReference(071, "gametext", true), new GARCReference(079, "storytext", true), }; + public static readonly GARCReference[] GARCReference_SMDEMO = { new GARCReference(011, "move"), @@ -98,6 +101,7 @@ public GARCReference getRelativeGARC(int offset, string name = "") new GARCReference(030, "gametext", true), new GARCReference(040, "storytext", true), }; + private static readonly GARCReference[] GARCReference_SM = { new GARCReference(011, "move"), @@ -128,6 +132,7 @@ public GARCReference getRelativeGARC(int offset, string name = "") new GARCReference(030, "gametext", true), new GARCReference(040, "storytext", true), }; + private static readonly GARCReference[] GARCReference_USUM = { new GARCReference(011, "move"), @@ -163,14 +168,17 @@ public GARCReference getRelativeGARC(int offset, string name = "") new[] { new GARCReference(082, "encdata"), }).ToArray(); + public static readonly GARCReference[] GARCReference_MN = GARCReference_SM.Concat( new[] { new GARCReference(083, "encdata"), }).ToArray(); + public static readonly GARCReference[] GARCReference_US = GARCReference_USUM.Concat( new[] { new GARCReference(082, "encdata"), }).ToArray(); + public static readonly GARCReference[] GARCReference_UM = GARCReference_USUM.Concat( new[] { new GARCReference(083, "encdata"), diff --git a/pk3DS.Core/Game/GameBackup.cs b/pk3DS.Core/Game/GameBackup.cs index 5db9fe292f..24536499e8 100644 --- a/pk3DS.Core/Game/GameBackup.cs +++ b/pk3DS.Core/Game/GameBackup.cs @@ -47,6 +47,7 @@ public static void backupFiles(this GameConfig config, bool overwrite = false) File.WriteAllText(Path.Combine(gameBackup, "bakinfo.txt"), "Backup created from the following location:" + Environment.NewLine + gamePath.FullName); } + private static void backupExeFS(GameConfig config, bool overwrite, string bak_exefs) { var files = Directory.GetFiles(config.ExeFS); @@ -57,12 +58,13 @@ private static void backupExeFS(GameConfig config, bool overwrite, string bak_ex File.Copy(f, dest); } } + private static void backupGARC(GameConfig config, bool overwrite, string bak_a) { var files = config.Files.Select(file => file.Name); foreach (var f in files) { - string GARC = config.getGARCFileName(f); + string GARC = config.GetGARCFileName(f); string name = f + $" ({GARC.Replace(Path.DirectorySeparatorChar.ToString(), "")})"; string src = Path.Combine(config.RomFS, GARC); string dest = Path.Combine(bak_a, name); @@ -70,6 +72,7 @@ private static void backupGARC(GameConfig config, bool overwrite, string bak_a) File.Copy(src, dest); } } + private static void backupDLL(GameConfig config, bool overwrite, string bak_dll) { string path = config.RomFS; @@ -138,6 +141,7 @@ public static string[] restoreFiles(this GameConfig config) var result = string.Join(Environment.NewLine, info); return new[] {result}; } + private static int restoreExeFS(GameConfig config, string bak_exefs) { int count = 0; @@ -155,13 +159,14 @@ private static int restoreExeFS(GameConfig config, string bak_exefs) } return count; } + private static int restoreGARC(GameConfig config, string bak_a) { int count = 0; var files = config.Files.Select(file => file.Name); foreach (var f in files) { - string GARC = config.getGARCFileName(f); + string GARC = config.GetGARCFileName(f); string name = f + $" ({GARC.Replace(Path.DirectorySeparatorChar.ToString(), "")})"; string src = Path.Combine(config.RomFS, GARC); string dest = Path.Combine(bak_a, name); @@ -175,6 +180,7 @@ private static int restoreGARC(GameConfig config, string bak_a) } return count; } + private static int restoreDLL(GameConfig config, string bak_dll) { int count = 0; diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index ac86c21a6f..a314f59b11 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -58,12 +58,13 @@ public GameConfig(int fileCount) Version = game; } + public GameConfig(GameVersion game) { Version = game; } - private void getGameData(GameVersion game) + private void GetGameData(GameVersion game) { switch (game) { @@ -89,7 +90,7 @@ private void getGameData(GameVersion game) case GameVersion.MN: case GameVersion.SM: Files = GARCReference.GARCReference_SN; - if (new FileInfo(Path.Combine(RomFS, getGARCFileName("encdata"))).Length == 0) + if (new FileInfo(Path.Combine(RomFS, GetGARCFileName("encdata"))).Length == 0) Files = GARCReference.GARCReference_MN; Variables = TextVariableCode.VariableCodes_SM; GameText = TextReference.GameText_SM; @@ -98,21 +99,23 @@ private void getGameData(GameVersion game) case GameVersion.UM: case GameVersion.USUM: Files = GARCReference.GARCReference_US; - if (new FileInfo(Path.Combine(RomFS, getGARCFileName("encdata"))).Length == 0) + if (new FileInfo(Path.Combine(RomFS, GetGARCFileName("encdata"))).Length == 0) Files = GARCReference.GARCReference_UM; Variables = TextVariableCode.VariableCodes_SM; GameText = TextReference.GameText_USUM; break; } } + public void Initialize(string romFSpath, string exeFSpath, int lang) { RomFS = romFSpath; ExeFS = exeFSpath; Language = lang; - getGameData(Version); + GetGameData(Version); InitializeAll(); } + public void InitializeAll() { InitializePersonal(); @@ -121,14 +124,16 @@ public void InitializeAll() InitializeMoves(); InitializeGameInfo(); } + public void InitializePersonal() { - GARCPersonal = getGARCData("personal"); + GARCPersonal = GetGARCData("personal"); Personal = new PersonalTable(GARCPersonal.getFile(GARCPersonal.FileCount - 1), Version); } + public void InitializeLearnset() { - GARCLearnsets = getGARCData("levelup"); + GARCLearnsets = GetGARCData("levelup"); switch (Generation) { case 6: @@ -139,14 +144,16 @@ public void InitializeLearnset() break; } } + public void InitializeGameText() { - GARCGameText = getGARCData("gametext"); + GARCGameText = GetGARCData("gametext"); GameTextStrings = GARCGameText.Files.Select(file => new TextFile(this, file, RemapCharacters).Lines).ToArray(); } + public void InitializeMoves() { - GARCMoves = getGARCData("move"); + GARCMoves = GetGARCData("move"); switch (Generation) { case 6: @@ -160,27 +167,32 @@ public void InitializeMoves() break; } } + private void InitializeGameInfo() { Info = new GameInfo(this); } - public lzGARCFile getlzGARCData(string file) + + public lzGARCFile GetlzGARCData(string file) { var gr = getGARCReference(file); gr = gr.LanguageVariant ? gr.getRelativeGARC(Language, gr.Name) : gr; - return new lzGARCFile(getlzGARC(file), gr, getGARCPath(file)); + return new lzGARCFile(GetlzGARC(file), gr, getGARCPath(file)); } - public GARCFile getGARCData(string file, bool skipRelative = false) + + public GARCFile GetGARCData(string file, bool skipRelative = false) { var gr = getGARCReference(file); if (gr.LanguageVariant && !skipRelative) gr = gr.getRelativeGARC(Language, gr.Name); - return getGARCByReference(gr); + return GetGARCByReference(gr); } - public GARCFile getGARCByReference(GARCReference gr) + + public GARCFile GetGARCByReference(GARCReference gr) { - return new GARCFile(getMemGARC(gr.Name), gr, getGARCPath(gr.Name)); + return new GARCFile(GetMemGARC(gr.Name), gr, getGARCPath(gr.Name)); } + private string getGARCPath(string file) { var gr = getGARCReference(file); @@ -189,11 +201,12 @@ private string getGARCPath(string file) return Path.Combine(RomFS, subloc); } - private GARC.MemGARC getMemGARC(string file) + private GARC.MemGARC GetMemGARC(string file) { return new GARC.MemGARC(File.ReadAllBytes(getGARCPath(file))); } - private GARC.lzGARC getlzGARC(string file) + + private GARC.lzGARC GetlzGARC(string file) { return new GARC.lzGARC(File.ReadAllBytes(getGARCPath(file))); } @@ -204,19 +217,21 @@ private GARC.lzGARC getlzGARC(string file) public TextVariableCode getVariableCode(string name) { return Variables?.FirstOrDefault(v => v.Name == name); } public TextVariableCode getVariableName(int value) { return Variables?.FirstOrDefault(v => v.Code == value); } - private TextReference getGameText(TextName name) { return GameText?.FirstOrDefault(f => f.Name == name); } + private TextReference GetGameText(TextName name) { return GameText?.FirstOrDefault(f => f.Name == name); } public TextData getTextData(TextName file) => new TextData(getText(file)); + public string[] getText(TextName file) { - return (string[])GameTextStrings[getGameText(file).Index].Clone(); + return (string[])GameTextStrings[GetGameText(file).Index].Clone(); } - public bool setText(TextName file, string[] strings) + + public bool SetText(TextName file, string[] strings) { - GameTextStrings[getGameText(file).Index] = strings; + GameTextStrings[GetGameText(file).Index] = strings; return true; } - public string getGARCFileName(string requestedGARC) + public string GetGARCFileName(string requestedGARC) { var garc = getGARCReference(requestedGARC); if (garc.LanguageVariant) @@ -239,6 +254,7 @@ public string getGARCFileName(string requestedGARC) public bool USUM => Version == GameVersion.USUM; public int MaxSpeciesID => XY || ORAS ? Legal.MaxSpeciesID_6 : SM ? Legal.MaxSpeciesID_7_SM : Legal.MaxSpeciesID_7_USUM; public int GARCVersion => XY || ORAS ? GARC.VER_4 : GARC.VER_6; + public int Generation { get diff --git a/pk3DS.Core/Game/GameRNG.cs b/pk3DS.Core/Game/GameRNG.cs index be4abf72eb..263b5e601e 100644 --- a/pk3DS.Core/Game/GameRNG.cs +++ b/pk3DS.Core/Game/GameRNG.cs @@ -11,6 +11,7 @@ public static uint Advance(uint seed, int ctr) } return seed; } + public static uint Reverse(uint seed, int ctr) { for (int i = 0; i < ctr; i++) diff --git a/pk3DS.Core/Game/GameVersion.cs b/pk3DS.Core/Game/GameVersion.cs index 530f11ce33..1d23a67a9d 100644 --- a/pk3DS.Core/Game/GameVersion.cs +++ b/pk3DS.Core/Game/GameVersion.cs @@ -9,27 +9,40 @@ public enum GameVersion // Version IDs, also stored in PKM structure /*Gen3*/ S = 1, R = 2, E = 3, FR = 4, LG = 5, CXD = 15, + /*Gen4*/ D = 10, P = 11, Pt = 12, HG = 7, SS = 8, + /*Gen5*/ W = 20, B = 21, W2 = 22, B2 = 23, + /*Gen6*/ X = 24, Y = 25, AS = 26, OR = 27, + /*Gen7*/ SN = 30, MN = 31, US = 32, UM = 33, + /* GO */ GO = 34, /* VC1*/ RD = 35, GN = 36, BU = 37, YW = 38, // GN = Blue for international release + /* VC2*/ GD = 39, SV = 40, C = 41, // Crystal is unused // Not actually stored values, but assigned as properties. // Game Groupings (SaveFile type) /*SAV1*/ RB, RBY, + /*SAV2*/ GS, GSC, + /*SAV3*/ RS, FRLG, RSBOX, COLO, XD, + /*SAV4*/ DP, HGSS, BATREV, + /*SAV5*/ BW, B2W2, + /*SAV6*/ XY, ORASDEMO, ORAS, + /*SAV7*/ SM, USUM, // Extra Game Groupings (Generation) Gen1, Gen2, Gen3, Gen4, Gen5, Gen6, Gen7, + GBCartEraOnly, Stadium, Stadium2, diff --git a/pk3DS.Core/Game/TextReference.cs b/pk3DS.Core/Game/TextReference.cs index 00ecfd8590..166e882836 100644 --- a/pk3DS.Core/Game/TextReference.cs +++ b/pk3DS.Core/Game/TextReference.cs @@ -47,10 +47,12 @@ public string this[int line] } } } + public class TextReference { public readonly int Index; public readonly TextName Name; + private TextReference(int index, TextName name) { Index = index; @@ -76,6 +78,7 @@ private TextReference(int index, TextName name) new TextReference(131, TextName.SuperTrainerNames), new TextReference(141, TextName.OPowerFlavor), }; + public static readonly TextReference[] GameText_AO = { new TextReference(005, TextName.Forms), @@ -95,6 +98,7 @@ private TextReference(int index, TextName name) new TextReference(154, TextName.SuperTrainerNames), new TextReference(165, TextName.OPowerFlavor), }; + public static readonly TextReference[] GameText_SMDEMO = { new TextReference(020, TextName.ItemFlavor), @@ -111,6 +115,7 @@ private TextReference(int index, TextName name) new TextReference(054, TextName.MoveFlavor), new TextReference(055, TextName.MoveNames), }; + public static readonly TextReference[] GameText_SM = { new TextReference(035, TextName.ItemFlavor), @@ -132,6 +137,7 @@ private TextReference(int index, TextName name) new TextReference(119, TextName.PokedexEntry1), new TextReference(120, TextName.PokedexEntry2) }; + public static readonly TextReference[] GameText_USUM = { new TextReference(039, TextName.ItemFlavor), diff --git a/pk3DS.Core/Game/TextVariableCode.cs b/pk3DS.Core/Game/TextVariableCode.cs index 037e0ca1b9..13d12a119c 100644 --- a/pk3DS.Core/Game/TextVariableCode.cs +++ b/pk3DS.Core/Game/TextVariableCode.cs @@ -4,6 +4,7 @@ public class TextVariableCode { public readonly int Code; public readonly string Name; + private TextVariableCode(int code, string name) { Code = code; @@ -61,6 +62,7 @@ private TextVariableCode(int code, string name) new TextVariableCode(0x0207, "NUM8"), new TextVariableCode(0x0208, "NUM9"), }; + public static readonly TextVariableCode[] VariableCodes_AO = { new TextVariableCode(0xFF00, "COLOR"), @@ -112,6 +114,7 @@ private TextVariableCode(int code, string name) new TextVariableCode(0x0207, "NUM8"), new TextVariableCode(0x0208, "NUM9"), }; + public static readonly TextVariableCode[] VariableCodes_SM = { new TextVariableCode(0xFF00, "COLOR"), diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs index 27de836be2..f45c184f48 100644 --- a/pk3DS.Core/ImageUtil.cs +++ b/pk3DS.Core/ImageUtil.cs @@ -26,10 +26,12 @@ public static Bitmap GetBitmap(this BXLIM bflim, bool crop = true) var data = bflim.GetImageData(crop); return GetBitmap(data, bflim.Footer.Width, bflim.Footer.Height); } + public static Bitmap GetBitmap(byte[] data, int width, int height, int stride = 4, PixelFormat format = PixelFormat.Format32bppArgb) { return new Bitmap(width, height, stride, format, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0)); } + public static byte[] GetPixelData(Bitmap bitmap) { var argbData = new byte[bitmap.Width * bitmap.Height * 4]; @@ -113,7 +115,7 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat { for (int j = 0; j < h; j++) { - int k = (j + i * img.Height) * 4; + int k = (j + (i * img.Height)) * 4; img.SetPixel(i, j, Color.FromArgb(imgData[k + 3], imgData[k], imgData[k + 1], imgData[k + 2])); } } @@ -134,8 +136,8 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat for (int j = 0; j < 8; j++) // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. { - int x1 = (x + y / 8 * h) % img2.Width; // Reshift x - int y1 = (x + y / 8 * h) / img2.Width * 8; // Reshift y + int x1 = (x + (y / 8 * h)) % img2.Width; // Reshift x + int y1 = (x + (y / 8 * h)) / img2.Width * 8; // Reshift y img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle } } @@ -153,7 +155,7 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. { int x1 = x % img2.Width; // Reshift x - int y1 = (x + y / 8 * h) / img2.Width * 8; // Reshift y + int y1 = (x + (y / 8 * h)) / img2.Width * 8; // Reshift y img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle } } diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index fe445a8eac..77df69e7df 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -12,6 +12,7 @@ public static partial class Legal 257, 282, 303, 306, 308, 310, 354, 359, 380, 381, 445, 448, 460 }; + public static readonly ushort[] Mega_ORAS = Mega_XY.Concat(new ushort[] { 015, 018, 094, @@ -21,6 +22,7 @@ public static partial class Legal 531, 719 }).ToArray(); + public static readonly int[] SpecialClasses_XY = { #region Classes @@ -77,6 +79,7 @@ public static partial class Legal 177, // Leader #endregion }; + public static readonly int[] SpecialClasses_ORAS = { #region Classes @@ -127,6 +130,7 @@ public static partial class Legal 279, // Pokémon Trainer #endregion }; + public static readonly int[] SpecialClasses_SM = { #region Classes @@ -205,6 +209,7 @@ public static partial class Legal 184, // Battle Legend #endregion }; + public static readonly int[] SpecialClasses_USUM = { #region Classes @@ -304,6 +309,7 @@ public static partial class Legal 222, // Pokémon Trainer #endregion }; + public static readonly int[] Model_XY = { #region Models @@ -323,6 +329,7 @@ public static partial class Legal 175, // Lysandre (Mega Ring) #endregion }; + public static readonly int[] Model_AO = { #region Models @@ -341,6 +348,7 @@ public static partial class Legal 279, // May (Mega Bracelet) #endregion }; + public static readonly int[] Z_Moves = { 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, @@ -353,6 +361,7 @@ public static partial class Legal 222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 392, 396, 398, 400, 401, 403, 405, 409, 410, 412, 413, 414, 415, 416, 417, 418, 419, 435, 438, 439, 440, 441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 480, 481, 482, 483, 484 }; + public static readonly int[] ImportantTrainers_USUM = { 012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240, @@ -360,12 +369,14 @@ public static partial class Legal 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, 650, 651, 652 }; + public static readonly int[] BasicStarters_6 = { 001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147, 152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246, 252, 255, 258, 265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374, 387, 390, 393, 396, 403, 406, 440, 443, 495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602, 607, 610, 633, 650, 653, 656, 661, 664, 669, 679, 704 }; + public static readonly int[] BasicStarters_7 = BasicStarters_6.Concat(new int[] { 722, 725, 728, 731, 736, 761, 782, 789 @@ -389,11 +400,13 @@ public static partial class Legal 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, 719, 720, 721 }; + public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[] { 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802 }).ToArray(); + public static readonly int[] FinalEvolutions_USUM = FinalEvolutions_SM.Concat(new int[] { 804, 805, 806, 807 @@ -408,10 +421,12 @@ public static partial class Legal 144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721 }; + public static readonly int[] Legendary_Mythical_SM = Legendary_Mythical_6.Concat(new int[] { 773, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802 }).ToArray(); + public static readonly int[] Legendary_Mythical_USUM = Legendary_Mythical_SM.Concat(new int[] { 804, 805, 806, 807 @@ -428,6 +443,7 @@ public static partial class Legal 746, // Wishiwashi 778, // Mimikyu }; + public static readonly HashSet BattleMegas = new HashSet { // XY @@ -447,6 +463,7 @@ public static partial class Legal // USUM 800, // Ultra Necrozma }; + public static readonly HashSet BattlePrimals = new HashSet { 382, 383 }; public static HashSet BattleExclusiveForms = new HashSet(BattleForms.Concat(BattleMegas.Concat(BattlePrimals))); } diff --git a/pk3DS.Core/Legality/Tables6.cs b/pk3DS.Core/Legality/Tables6.cs index 35d063b8ef..17d6583363 100644 --- a/pk3DS.Core/Legality/Tables6.cs +++ b/pk3DS.Core/Legality/Tables6.cs @@ -228,6 +228,7 @@ public static partial class Legal #endregion public static readonly int[] EggLocations6 = {60002, 30002}; + public static readonly int[] ValidMet_XY = { 006, 008, 009, 010, 012, 013, 014, 016, 017, 018, 020, 021, 022, 024, 026, 028, 029, 030, 032, 034, 035, 036, @@ -236,6 +237,7 @@ public static partial class Legal 100, 101, 102, 103, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 135, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168 }; + public static readonly int[] ValidMet_AO = { 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, @@ -244,6 +246,7 @@ public static partial class Legal 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354 }; + public static readonly int[] FriendSafari = { 190, 206, 216, 506, 294, 352, 531, 572, 113, 132, 133, 235, @@ -265,6 +268,7 @@ public static partial class Legal 082, 303, 597, 205, 227, 375, 600, 437, 530, 707, 098, 224, 400, 515, 008, 130, 195, 419, 061, 184, 657 }; + public static readonly int[] CosplayPikachuMoves = { 309, 556, 577, 604, 560, 0 }; public static readonly int[] WildPokeballs6 = { 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; @@ -291,6 +295,7 @@ public static partial class Legal 313, // Via Illumise }; + public static readonly int[] Inherit_Safari = { 016, 019, 020, 021, 022, 023, 024, 025, 027, 029, 035, 039, 041, @@ -314,6 +319,7 @@ public static partial class Legal 439, // Via Mr. Mime 440, // Via Chansey }; + public static readonly int[] Inherit_Dream = { 010, 013, 016, 019, 021, 023, 027, 029, 037, 041, 043, 046, 048, 050, 052, 054, 056, 058, 060, 063, 066, 069, @@ -343,6 +349,7 @@ public static partial class Legal // Via Incense Breeding 298, 360, 406, 433, 438, 439, 440, 446, 458, }; + public static readonly int[] Ban_DreamHidden = { 311, // Plusle @@ -354,6 +361,7 @@ public static partial class Legal 356, // Dusclops 477, // Dusknoir }; + public static readonly int[] Ban_Gen3Ball = { 252, 255, 258, //1 - Treeko, Torchic, Mudkip @@ -367,6 +375,7 @@ public static partial class Legal 497, 500, 503, //3 566, 567, 696, 697, 698, 699 // Fossil Only obtain }; + public static readonly int[] Ban_Gen3BallHidden = { // can have HA and can be in gen 3 ball as eggs but can not at same time. @@ -382,6 +391,7 @@ public static partial class Legal 710 + (3 << 11), //Pumpkaboo-Super 711 + (3 << 11), //Gourgeist-Super }; + public static readonly int[] Ban_Gen4Ball_6 = { 152, 155, 158, //1 - Chikorita, Cyndaquil, Totodile @@ -414,6 +424,7 @@ public static partial class Legal 68, // {0} soared through the sky with {1} and went to many different places. {4} that {3}. 69, // {1} asked {0} to dive. Down it went, deep into the ocean, to explore the bottom of the sea. {4} that {3}. }; + public static readonly int[] Memory_NotAO = { 11, // {0} went clothes shopping with {1}. {4} that {3}. @@ -423,6 +434,7 @@ public static partial class Legal 57, // {0} went to a nice restaurant with {1} and ate until it got totally full. {4} that {3}. 62, // {0} saw itself in a mirror in a mirror cave that it went to with {1}. {4} that {3}. }; + public static readonly int[][] MoveSpecificMemories = { new[] { @@ -436,6 +448,7 @@ public static partial class Legal }, new[] { 57, 19, 70, 15, 249, 127, 291}, // Move IDs }; + public static readonly int[][] LocationsWithPKCenter = { new[] { @@ -474,6 +487,7 @@ public static partial class Legal }, new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // Region matching }; + public static readonly HashSet MemoryGeneral = new HashSet { 1, 2, 3, 4, 19, 24, 31, 32, 33, 35, 36, 37, 38, 39, 42, 52, 59 }; public static readonly HashSet MemorySpecific = new HashSet { 6 }; public static readonly HashSet MemoryMove = new HashSet { 12, 16, 48, 49 }; @@ -498,6 +512,7 @@ public static partial class Legal 05, 10, 05, 05, 15, 10, 05, 05, 05, 10, 10, 10, 10, 20, 25, 10, 20, 30, 25, 20, 20, 15, 20, 15, 20, 20, 10, 10, 10, 10, 10, 20, 10, 30, 15, 10, 10, 10, 20, 20, 05, 05, 05, 20, 10, 10, 20, 15, 20, 20, 10, 20, 30, 10, 10, 40, 40, 30, 20, 40, 20, 20, 10, 10, 10, 10, 05, 10, 10, 05, 05, }; + public static readonly int[] UnreleasedItems_6 = { 005, // Safari Ball @@ -536,6 +551,7 @@ public static partial class Legal 590, // Relic Crown 715, // Fairy Gem }; + public static readonly bool[] ReleasedHeldItems_6 = Enumerable.Range(0, MaxItemID_6_AO+1).Select(i => HeldItem_AO.Contains((ushort)i) && !UnreleasedItems_6.Contains(i)).ToArray(); } } diff --git a/pk3DS.Core/Legality/Tables7.cs b/pk3DS.Core/Legality/Tables7.cs index 888e7fb4fe..281ca76f9a 100644 --- a/pk3DS.Core/Legality/Tables7.cs +++ b/pk3DS.Core/Legality/Tables7.cs @@ -69,14 +69,17 @@ public static partial class Legal 761, 762, 763, 764, 767, 768, 769, 770, 795, 796, 844, 849, 853, 854, 855, 856, 879, 880, 881, 882, 883, 884, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, }; + internal static readonly ushort[] Pouch_Ball_SM = { // 08 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 492, 493, 494, 495, 496, 497, 498, 576, 851 }; + internal static readonly ushort[] Pouch_Battle_SM = { // 16 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 577, 846, }; + internal static readonly ushort[] Pouch_Items_SM = Pouch_Regular_SM.Concat(Pouch_Ball_SM).Concat(Pouch_Battle_SM).ToArray(); internal static readonly ushort[] Pouch_Key_SM = { @@ -84,6 +87,7 @@ public static partial class Legal 705, 706, 765, 773, 797, 841, 842, 843, 845, 847, 850, 857, 858, 860, }; + internal static readonly ushort[] Pouch_TMHM_SM = { // 02 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, @@ -92,29 +96,37 @@ public static partial class Legal 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 618, 619, 620, 690, 691, 692, 693, 694, }; + internal static readonly ushort[] Pouch_Medicine_SM = { // 32 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 65, 66, 67, 134, 504, 565, 566, 567, 568, 569, 570, 591, 645, 708, 709, 852, }; + internal static readonly ushort[] Pouch_Berries_SM = { 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 686, 687, 688, }; + internal static readonly ushort[] Pouch_ZCrystal_SM = { // Bead 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, }; + internal static readonly ushort[] Pouch_ZCrystalHeld_SM = { // Piece 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 798, 799, 800, 801, 802, 803, 804, 805, 806, 836 }; + internal static readonly ushort[] Pouch_ZCrystal_USUM = { // Bead 927, 928, 929, 930, 931, 932 }; + internal static readonly ushort[] Pouch_ZCrystalHeld_USUM = { // Piece 921, 922, 923, 924, 925, 926 }; + internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray(); internal static readonly ushort[] HeldItems_USUM = new ushort[1].Concat(HeldItems_SM).Concat(Pouch_ZCrystalHeld_USUM).ToArray(); + internal static readonly int[] AlolanOriginForms = { 019, // Rattata @@ -220,6 +232,7 @@ public static partial class Legal 105, // Marowak (Normal, Alolan, Totem) 778, // Mimikyu (Normal, Busted, Totem, Totem_Busted) }; + public static readonly HashSet Totem_SM = new HashSet { 020, // Raticate @@ -231,6 +244,7 @@ public static partial class Legal 778, // Mimikyu 784, // Kommo-o }; + public static readonly HashSet Totem_USUM = new HashSet { 020, // Raticate diff --git a/pk3DS.Core/Randomizers/EggMoveRandomizer.cs b/pk3DS.Core/Randomizers/EggMoveRandomizer.cs index d94f4d99d5..9386fc02a0 100644 --- a/pk3DS.Core/Randomizers/EggMoveRandomizer.cs +++ b/pk3DS.Core/Randomizers/EggMoveRandomizer.cs @@ -12,6 +12,7 @@ public class EggMoveRandomizer : IRandomizer private readonly MoveRandomizer moverand; private readonly GameConfig Config; private readonly EggMoves[] Sets; + public EggMoveRandomizer(GameConfig config, EggMoves[] sets) { Config = config; diff --git a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs index 72d7c7bec7..d16b6a6e40 100644 --- a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs +++ b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs @@ -54,7 +54,6 @@ private void Trade(EvolutionSet evo, int i) v.Argument = 30; v.Method = 4; // trade -> level up } - else if (Config.Generation == 7 && v.Method == 5) { v.Level = 30; diff --git a/pk3DS.Core/Randomizers/FormRandomizer.cs b/pk3DS.Core/Randomizers/FormRandomizer.cs index 1c1031ecbf..692bbc3f13 100644 --- a/pk3DS.Core/Randomizers/FormRandomizer.cs +++ b/pk3DS.Core/Randomizers/FormRandomizer.cs @@ -6,6 +6,7 @@ namespace pk3DS.Core.Randomizers public class FormRandomizer { private readonly GameConfig Game; + public FormRandomizer(GameConfig game) { Game = game; diff --git a/pk3DS.Core/Randomizers/GenericRandomizer.cs b/pk3DS.Core/Randomizers/GenericRandomizer.cs index 6afbdcd8b7..b326d988cd 100644 --- a/pk3DS.Core/Randomizers/GenericRandomizer.cs +++ b/pk3DS.Core/Randomizers/GenericRandomizer.cs @@ -1,7 +1,7 @@ namespace pk3DS.Core.Randomizers { /// Cyclical Shuffled Randomizer - /// + /// /// The shuffled list is iterated over, and reshuffled when exhausted. /// The list does not repeat values until the list is exhausted. /// diff --git a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs index 3303cb6ee8..2aef7b6a57 100644 --- a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs +++ b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs @@ -48,8 +48,10 @@ private void Randomize(Learnset set, int index) int[] levels = GetRandomLevels(set, moves.Length); if (Learn4Level1) + { for (int i = 0; i < Math.Min(4, levels.Length); ++i) levels[i] = 1; + } set.Moves = moves; set.Levels = levels; diff --git a/pk3DS.Core/Randomizers/MoveRandomizer.cs b/pk3DS.Core/Randomizers/MoveRandomizer.cs index 7f0a69e394..a9e4ba4038 100644 --- a/pk3DS.Core/Randomizers/MoveRandomizer.cs +++ b/pk3DS.Core/Randomizers/MoveRandomizer.cs @@ -41,6 +41,7 @@ public void Execute() private int loopctr = 0; public int[] GetRandomLearnset(int index, int movecount) => GetRandomLearnset(SpeciesStat[index].Types, movecount); + public int[] GetRandomLearnset(int[] Types, int movecount) { var oldSTABCount = rSTABCount; @@ -49,7 +50,9 @@ public int[] GetRandomLearnset(int[] Types, int movecount) rSTABCount = oldSTABCount; return moves; } + public int[] GetRandomMoveset(int index, int movecount = 4) => GetRandomMoveset(SpeciesStat[index].Types, movecount); + public int[] GetRandomMoveset(int[] Types, int movecount = 4) { loopctr = 0; @@ -73,6 +76,7 @@ private int[] GetRandomMoves(int[] Types, int movecount = 4) moves[i] = RandMove.Next(); return moves; } + private int GetRandomSTABMove(int[] types) { int move; @@ -80,6 +84,7 @@ private int GetRandomSTABMove(int[] types) while (!types.Contains(MoveData[move].Type)); return move; } + private bool IsMovesetMeetingRequirements(int[] moves, int count) { if (rDMG && rDMGCount > moves.Count(move => MoveData[move].Category != 0)) @@ -116,13 +121,17 @@ public void ReorderMovesPower(IList moves) 141, // Leech Life }; + private static readonly GenericRandomizer first = new GenericRandomizer(firstMoves); + public int GetRandomFirstMoveAny() { first.Reset(); return first.Next(); } + public int GetRandomFirstMove(int index) => GetRandomFirstMove(SpeciesStat[index].Types); + public int GetRandomFirstMove(int[] types) { first.Reset(); diff --git a/pk3DS.Core/Randomizers/PersonalRandomizer.cs b/pk3DS.Core/Randomizers/PersonalRandomizer.cs index 2668832949..71d6e3c8d7 100644 --- a/pk3DS.Core/Randomizers/PersonalRandomizer.cs +++ b/pk3DS.Core/Randomizers/PersonalRandomizer.cs @@ -99,6 +99,7 @@ private void RandomizeTMHM(PersonalInfo z) z.TMHM = tms; } + private void RandomizeTypeTutors(PersonalInfo z, int index) { var t = z.TypeTutors; @@ -111,6 +112,7 @@ private void RandomizeTypeTutors(PersonalInfo z, int index) z.TypeTutors = t; } + private void RandomizeSpecialTutors(PersonalInfo z) { var tutors = z.SpecialTutors; @@ -119,6 +121,7 @@ private void RandomizeSpecialTutors(PersonalInfo z) tutor[i] = rnd.Next(0, 100) < LearnMoveTutorPercent; z.SpecialTutors = tutors; } + private void RandomizeAbilities(PersonalInfo z) { var abils = z.Abilities; @@ -126,6 +129,7 @@ private void RandomizeAbilities(PersonalInfo z) abils[i] = GetRandomAbility(); z.Abilities = abils; } + private void RandomizeEggGroups(PersonalInfo z) { var egg = z.EggGroups; @@ -133,6 +137,7 @@ private void RandomizeEggGroups(PersonalInfo z) egg[1] = rnd.Next(0, 100) < SameEggGroupChance ? egg[0] : GetRandomEggGroup(); z.EggGroups = egg; } + private void RandomizeHeldItems(PersonalInfo z) { var item = z.Items; @@ -140,6 +145,7 @@ private void RandomizeHeldItems(PersonalInfo z) item[j] = GetRandomHeldItem(); z.Items = item; } + private void RandomizeTypes(PersonalInfo z) { var t = z.Types; @@ -147,6 +153,7 @@ private void RandomizeTypes(PersonalInfo z) t[1] = rnd.Next(0, 100) < SameTypeChance ? t[0] : GetRandomType(); z.Types = t; } + private void RandomizeStats(PersonalInfo z) { // Fiddle with Base Stats, don't muck with Shedinja. @@ -157,12 +164,13 @@ private void RandomizeStats(PersonalInfo z) { if (!StatsToRandomize[i]) continue; - var l = Math.Min(255, (int) (stats[i] * (1 - StatDeviation / 100))); - var h = Math.Min(255, (int) (stats[i] * (1 + StatDeviation / 100))); + var l = Math.Min(255, (int) (stats[i] * (1 - (StatDeviation / 100)))); + var h = Math.Min(255, (int) (stats[i] * (1 + (StatDeviation / 100)))); stats[i] = Math.Max(5, rnd.Next(l, h)); } z.Stats = stats; } + private void RandomShuffledStats(PersonalInfo z) { // Fiddle with Base Stats, don't muck with Shedinja. @@ -178,12 +186,13 @@ private void RandomShuffledStats(PersonalInfo z) private int GetRandomEggGroup() => rnd.Next(1, eggGroupCount); private int GetRandomHeldItem() => Game.Info.HeldItems[rnd.Next(1, Game.Info.HeldItems.Length)]; private readonly IList BannedAbilities = new int[0]; + private int GetRandomAbility() { const int WonderGuard = 25; int newabil; do newabil = rnd.Next(1, Game.Info.MaxAbilityID + 1); - while (newabil == WonderGuard && !AllowWonderGuard || BannedAbilities.Contains(newabil)); + while ((newabil == WonderGuard && !AllowWonderGuard) || BannedAbilities.Contains(newabil)); return newabil; } } diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 32896797b7..132442819e 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -73,6 +73,7 @@ public int GetRandomSpeciesType(int oldSpecies, int type) loopctr++; return newSpecies; } + private bool GetIsTypeMatch(int newSpecies, int type) => type == -1 || SpeciesStat[newSpecies].Types.Any(z => z == type) || loopctr > 9000; public int GetRandomSpecies(int oldSpecies) @@ -100,6 +101,7 @@ private bool IsSpeciesReplacementBad(int newSpecies, int currentSpecies) { return newSpecies == currentSpecies && loopctr < MaxSpeciesID * 10; } + private bool IsSpeciesEXPRateBad(PersonalInfo oldpkm, PersonalInfo pkm) { if (!rEXP) @@ -107,6 +109,7 @@ private bool IsSpeciesEXPRateBad(PersonalInfo oldpkm, PersonalInfo pkm) // Experience Growth Rate matches return oldpkm.EXPGrowth != pkm.EXPGrowth; } + private bool IsSpeciesTypeBad(PersonalInfo oldpkm, PersonalInfo pkm) { if (!rType) @@ -114,6 +117,7 @@ private bool IsSpeciesTypeBad(PersonalInfo oldpkm, PersonalInfo pkm) // Type has to be somewhat similar return !oldpkm.Types.Any(z => pkm.Types.Contains(z)); } + private bool IsSpeciesBSTBad(PersonalInfo oldpkm, PersonalInfo pkm) { if (!rBST) @@ -138,6 +142,7 @@ private int[] InitializeSpeciesList() return list.Count == 0 ? RandomSpeciesList : list.ToArray(); } + private void AddGen1Species(List list) { list.AddRange(Enumerable.Range(1, 143)); // Bulbasaur - Snorlax @@ -150,6 +155,7 @@ private void AddGen1Species(List list) } if (E) list.Add(151); // Mew } + private void AddGen2Species(List list) { list.AddRange(Enumerable.Range(152, 91)); // Chikorita - Blissey @@ -162,6 +168,7 @@ private void AddGen2Species(List list) } if (E) list.Add(251); // Celebi } + private void AddGen3Species(List list) { list.AddRange(Enumerable.Range(252, 40)); // Treecko - Ninjask @@ -170,24 +177,28 @@ private void AddGen3Species(List list) if (L) list.AddRange(Enumerable.Range(377, 8)); // Regi, Lati, Mascot if (E) list.AddRange(Enumerable.Range(385, 2)); // Jirachi/Deoxys } + private void AddGen4Species(List list) { list.AddRange(Enumerable.Range(387, 93)); // Turtwig - Rotom if (L) list.AddRange(Enumerable.Range(480, 9)); // Sinnoh Legends if (E) list.AddRange(Enumerable.Range(489, 5)); // Phione, Manaphy, Darkrai, Shaymin, Arceus } + private void AddGen5Species(List list) { list.AddRange(Enumerable.Range(495, 143)); // Snivy - Volcarona if (L) list.AddRange(Enumerable.Range(638, 9)); // Unova Legends if (E) list.Add(494); list.AddRange(Enumerable.Range(647, 3)); // Victini, Keldeo, Meloetta, Genesect } + private void AddGen6Species(List list) { list.AddRange(Enumerable.Range(650, 66)); // Chespin - Noivern if (L) list.AddRange(Enumerable.Range(716, 3)); // Kalos Legends if (E) list.AddRange(Enumerable.Range(719, 3)); // Diancie, Hoopa, Volcanion } + private void AddGen7Species(List list) { list.AddRange(Enumerable.Range(722, 50)); // Rowlet - Pyukumuku @@ -208,6 +219,7 @@ private void AddGen7Species(List list) } public int[] RandomSpeciesList => Enumerable.Range(1, MaxSpeciesID).ToArray(); + private bool GetNewSpecies(int currentSpecies, PersonalInfo oldpkm, out int newSpecies) { newSpecies = RandSpec.Next(); diff --git a/pk3DS.Core/StructConverter.cs b/pk3DS.Core/StructConverter.cs index 224bc91bee..ad34b6fbd5 100644 --- a/pk3DS.Core/StructConverter.cs +++ b/pk3DS.Core/StructConverter.cs @@ -11,6 +11,7 @@ public static T ToStructure(this byte[] bytes) where T : struct try { return (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); } finally { handle.Free(); } } + public static byte[] ToBytes(this T obj) where T : struct { int size = Marshal.SizeOf(obj); diff --git a/pk3DS.Core/Structures/EggMoves.cs b/pk3DS.Core/Structures/EggMoves.cs index 31be253791..61f3c7cce3 100644 --- a/pk3DS.Core/Structures/EggMoves.cs +++ b/pk3DS.Core/Structures/EggMoves.cs @@ -10,6 +10,7 @@ public abstract class EggMoves public abstract byte[] Write(); } + public class EggMoves6 : EggMoves { public EggMoves6(byte[] data) @@ -23,6 +24,7 @@ public EggMoves6(byte[] data) Moves[i] = br.ReadUInt16(); } } + public static EggMoves[] getArray(byte[][] entries) { EggMoves[] data = new EggMoves[entries.Length]; @@ -30,6 +32,7 @@ public static EggMoves[] getArray(byte[][] entries) data[i] = new EggMoves6(entries[i]); return data; } + public override byte[] Write() { Count = Moves.Length; @@ -45,6 +48,7 @@ public override byte[] Write() } } } + public class EggMoves7 : EggMoves { public EggMoves7(byte[] data) @@ -60,6 +64,7 @@ public EggMoves7(byte[] data) Moves[i] = br.ReadUInt16(); } } + public static EggMoves[] getArray(byte[][] entries) { EggMoves[] data = new EggMoves[entries.Length]; @@ -67,6 +72,7 @@ public static EggMoves[] getArray(byte[][] entries) data[i] = new EggMoves7(entries[i]); return data; } + public override byte[] Write() { Count = Moves.Length; diff --git a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs index 1609354f2e..a3da482a8e 100644 --- a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs +++ b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs @@ -31,7 +31,7 @@ public class EncounterGift6 public bool ShinyLock { get => (Shiny & 2) != 0; - set => Shiny = (byte)(Shiny & ~2 | (value ? 2 : 0)); + set => Shiny = (byte)((Shiny & ~2) | (value ? 2 : 0)); } public EncounterGift6(byte[] data, bool oras) @@ -72,6 +72,7 @@ public EncounterGift6(byte[] data, bool oras) uLast = br.ReadByte(); } } + public byte[] Write() { using (MemoryStream ms = new MemoryStream()) diff --git a/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs b/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs index 8570bdf528..e9d662584a 100644 --- a/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs +++ b/pk3DS.Core/Structures/Gen6/EncounterStatic6.cs @@ -18,11 +18,13 @@ public byte Form get => Data[0x2]; set => Data[0x2] = value; } + public byte Level { get => Data[0x3]; set => Data[0x3] = value; } + public int HeldItem { get @@ -41,33 +43,37 @@ public int HeldItem public bool Shiny { get => (Data[0x6] & 1) >> 1 == 1; - set => Data[0x6] = (byte)(Data[0x6] & ~1 | (value ? 1 : 0)); + set => Data[0x6] = (byte)((Data[0x6] & ~1) | (value ? 1 : 0)); } + public bool ShinyLock { get => (Data[0x6] & 2) >> 1 == 1; - set => Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0)); + set => Data[0x6] = (byte)((Data[0x6] & ~2) | (value ? 2 : 0)); } + public int Gender { get => (Data[0x6] & 0xC) >> 2; - set => Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2)); + set => Data[0x6] = (byte)((Data[0x6] & ~0xC) | ((value & 3) << 2)); } public int Ability { get => (Data[0x6] & 0x70) >> 4; - set => Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4)); + set => Data[0x6] = (byte)((Data[0x6] & ~0x70) | ((value & 7) << 4)); } + public bool IV3 { get => (Data[0x7] & 1) >> 0 == 1; - set => Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0)); + set => Data[0x7] = (byte)((Data[0x7] & ~1) | (value ? 1 : 0)); } + public bool IV3_1 { get => (Data[0x7] & 2) >> 1 == 1; - set => Data[0x7] = (byte)(Data[0x7] & ~2 | (value ? 2 : 0)); + set => Data[0x7] = (byte)((Data[0x7] & ~2) | (value ? 2 : 0)); } public EncounterStatic6(byte[] data) => Data = (byte[])data.Clone(); diff --git a/pk3DS.Core/Structures/Gen6/Evolutions.cs b/pk3DS.Core/Structures/Gen6/Evolutions.cs index 4bf264447e..21ea1503fd 100644 --- a/pk3DS.Core/Structures/Gen6/Evolutions.cs +++ b/pk3DS.Core/Structures/Gen6/Evolutions.cs @@ -17,11 +17,13 @@ public abstract class EvolutionSet public EvolutionMethod[] PossibleEvolutions; public abstract byte[] Write(); } + public class EvolutionSet6 : EvolutionSet { private const int ENTRY_SIZE = 6; private const int ENTRY_COUNT = 8; public const int SIZE = ENTRY_COUNT * ENTRY_SIZE; + public EvolutionSet6(byte[] data) { if (data.Length != SIZE) return; @@ -43,6 +45,7 @@ public EvolutionSet6(byte[] data) // PossibleEvolutions[i / SIZE].Level = 0; } } + public override byte[] Write() { using (MemoryStream ms = new MemoryStream()) @@ -58,11 +61,13 @@ public override byte[] Write() } } } + public class EvolutionSet7 : EvolutionSet { private const int ENTRY_SIZE = 8; private const int ENTRY_COUNT = 8; public const int SIZE = ENTRY_COUNT * ENTRY_SIZE; + public EvolutionSet7(byte[] data) { if (data.Length != SIZE) return; @@ -79,6 +84,7 @@ public EvolutionSet7(byte[] data) }; } } + public override byte[] Write() { using (MemoryStream ms = new MemoryStream()) diff --git a/pk3DS.Core/Structures/Gen6/Item6.cs b/pk3DS.Core/Structures/Gen6/Item6.cs index 8228ea4294..c009fd21af 100644 --- a/pk3DS.Core/Structures/Gen6/Item6.cs +++ b/pk3DS.Core/Structures/Gen6/Item6.cs @@ -32,6 +32,7 @@ public struct Item [Category(Battle), Description("Routine # to call when used; 0=unusable.")] public byte EffectBattle { get; set; } // Battle Type + public byte _0xC { get; set; } // 0 or 1 public byte _0xD { get; set; } // Classification (0-3 Battle, 4 Balls, 5 Mail) public byte Consumable { get; set; } diff --git a/pk3DS.Core/Structures/Gen6/Maison6.cs b/pk3DS.Core/Structures/Gen6/Maison6.cs index f16a009771..33f5483e1c 100644 --- a/pk3DS.Core/Structures/Gen6/Maison6.cs +++ b/pk3DS.Core/Structures/Gen6/Maison6.cs @@ -12,14 +12,16 @@ public class Trainer public ushort[] Choices; public Trainer() { } + public Trainer(byte[] data) { Class = BitConverter.ToUInt16(data, 0); Count = BitConverter.ToUInt16(data, 2); Choices = new ushort[Count]; for (int i = 0; i < Count; i++) - Choices[i] = BitConverter.ToUInt16(data, 4 + 2 * i); + Choices[i] = BitConverter.ToUInt16(data, 4 + (2 * i)); } + public byte[] Write() { using (var ms = new MemoryStream()) @@ -33,6 +35,7 @@ public byte[] Write() } } } + public class Pokemon { public ushort Species; @@ -58,7 +61,7 @@ public Pokemon(byte[] data) { Species = BitConverter.ToUInt16(data, 0); for (int i = 0; i < 4; i++) - Moves[i] = BitConverter.ToUInt16(data, 2 + 2*i); + Moves[i] = BitConverter.ToUInt16(data, 2 + (2 * i)); EV = data[0xA]; for (int i = 0; i < 6; i++) EVs[i] = ((EV >> i) & 1) == 1; @@ -66,6 +69,7 @@ public Pokemon(byte[] data) Item = BitConverter.ToUInt16(data, 0xC); Form = BitConverter.ToUInt16(data, 0xE); } + public byte[] Write() { using (var ms = new MemoryStream()) diff --git a/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs b/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs index fad23a8e73..151eb8234c 100644 --- a/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs +++ b/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs @@ -5,6 +5,7 @@ namespace pk3DS.Core.Structures public class MegaEvolutions { public ushort[] Form, Method, Argument, u6; + public MegaEvolutions(byte[] data) { if (data.Length < 0x10 || data.Length % 8 != 0) return; @@ -21,6 +22,7 @@ public MegaEvolutions(byte[] data) u6[i] = br.ReadUInt16(); } } + public byte[] Write() { using (MemoryStream ms = new MemoryStream()) diff --git a/pk3DS.Core/Structures/Gen6/trdata6.cs b/pk3DS.Core/Structures/Gen6/trdata6.cs index b636fa6fdb..e94533fbb3 100644 --- a/pk3DS.Core/Structures/Gen6/trdata6.cs +++ b/pk3DS.Core/Structures/Gen6/trdata6.cs @@ -17,6 +17,7 @@ public class trdata6 public byte Money; public ushort Prize; public Pokemon[] Team; + public trdata6(byte[] trData, byte[] trPoke, bool ORAS) { using (BinaryReader br = new BinaryReader(new MemoryStream(trData))) @@ -49,6 +50,7 @@ public trdata6(byte[] trData, byte[] trPoke, bool ORAS) Team[i] = new Pokemon(TeamData[i], Item, Moves); } } + public byte[] Write() { using (MemoryStream ms = new MemoryStream()) @@ -78,6 +80,7 @@ public byte[] Write() return ms.ToArray(); } } + public byte[] WriteTeam() { return Team.Aggregate(new byte[0], (i, pkm) => i.Concat(pkm.Write(Item, Moves)).ToArray()); @@ -117,6 +120,7 @@ public Pokemon(byte[] data, bool HasItem, bool HasMoves) Moves[i] = br.ReadUInt16(); } } + public byte[] Write(bool HasItem, bool HasMoves) { using (MemoryStream ms = new MemoryStream()) diff --git a/pk3DS.Core/Structures/Gen7/EncounterGift7.cs b/pk3DS.Core/Structures/Gen7/EncounterGift7.cs index 04bfc39d8d..ee850313b3 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterGift7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterGift7.cs @@ -6,60 +6,72 @@ public class EncounterGift7 : EncounterStatic { public const int SIZE = 0x14; public readonly byte[] Data; + public EncounterGift7(byte[] data) { Data = data; } + public override int Species { get => BitConverter.ToUInt16(Data, 0x0); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0); } + public int Form { get => Data[0x2]; set => Data[0x2] = (byte)value; } + public int Level { get => Data[0x3]; set => Data[0x3] = (byte)value; } + public int Gender { get => Data[0x4] & 1; set => Data[0x4] = (byte)(value & 1); } + public bool ShinyLock { get => (Data[0x4] & 2) != 0; set => Data[0x4] = (byte)((Data[0x4] & ~2) | (value ? 2 : 0)); } + public sbyte Ability { get => (sbyte)Data[0x6]; set => Data[0x6] = (byte)value; } + public sbyte Nature { get => (sbyte)Data[0x7]; set => Data[0x7] = (byte)value; } + public override int HeldItem { get => BitConverter.ToUInt16(Data, 0x8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8); } + public bool IsEgg { get => Data[0xA] == 1; set => Data[0xA] = (byte)(value ? 1 : 0); } + public int SpecialMove { get => BitConverter.ToUInt16(Data, 0xC); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xC); } + public bool IV3 => (sbyte) Data[0xE] < 0 && (sbyte) Data[0xE] + 1 == -3; public string GetSummary() diff --git a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs index 6389c922b2..c3af4ca7b6 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs @@ -7,25 +7,30 @@ public class EncounterStatic7 : EncounterStatic { public const int SIZE = 0x38; public readonly byte[] Data; + public EncounterStatic7(byte[] data) { Data = data; } + public override int Species { get => BitConverter.ToUInt16(Data, 0x0); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0); } + public int Form { get => Data[0x2]; set => Data[0x2] = (byte)value; } + public int Level { get => Data[0x3]; set => Data[0x3] = (byte)value; } + public override int HeldItem { get @@ -44,34 +49,39 @@ public override int HeldItem public bool Shiny { get => (Data[0x6] & 1) >> 1 == 1; - set => Data[0x6] = (byte)(Data[0x6] & ~1 | (value ? 1 : 0)); + set => Data[0x6] = (byte)((Data[0x6] & ~1) | (value ? 1 : 0)); } + public bool ShinyLock { get => (Data[0x6] & 2) >> 1 == 1; - set => Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0)); + set => Data[0x6] = (byte)((Data[0x6] & ~2) | (value ? 2 : 0)); } + public int Gender { get => (Data[0x6] & 0xC) >> 2; - set => Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2)); + set => Data[0x6] = (byte)((Data[0x6] & ~0xC) | ((value & 3) << 2)); } + public int Ability { get => (Data[0x6] & 0x70) >> 4; - set => Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4)); + set => Data[0x6] = (byte)((Data[0x6] & ~0x70) | ((value & 7) << 4)); } public bool _7 { get => (Data[0x7] & 1) >> 0 == 1; - set => Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0)); + set => Data[0x7] = (byte)((Data[0x7] & ~1) | (value ? 1 : 0)); } + public bool _7_1 { get => (Data[0x7] & 2) >> 1 == 1; - set => Data[0x7] = (byte)(Data[0x7] & ~2 | (value ? 2 : 0)); + set => Data[0x7] = (byte)((Data[0x7] & ~2) | (value ? 2 : 0)); } + public int Map { get => BitConverter.ToInt16(Data, 0x8) - 1; @@ -92,9 +102,10 @@ public int[] RelearnMoves if (value.Length != 4) return; for (int i = 0; i < 4; i++) - BitConverter.GetBytes((ushort)value[i]).CopyTo(Data, 0xC + i * 2); + BitConverter.GetBytes((ushort)value[i]).CopyTo(Data, 0xC + (i * 2)); } } + public int Nature { get => Data[0x14]; @@ -112,6 +123,7 @@ public int[] IVs Data[i + 0x15] = (byte)Convert.ToSByte(value[i]); } } + public int[] EVs { get => new int[] { Data[0x1B], Data[0x1C], Data[0x1D], Data[0x1E], Data[0x1F], Data[0x20] }; @@ -123,6 +135,7 @@ public int[] EVs Data[i + 0x1B] = (byte)value[i]; } } + public int Aura { get => Data[0x25]; diff --git a/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs b/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs index ce4edb9751..4ee9052386 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs @@ -7,22 +7,27 @@ public class EncounterTrade7 : EncounterStatic public const int SIZE = 0x34; public readonly byte[] Data; + public EncounterTrade7(byte[] data) { Data = data; } + public override int Species { get { return BitConverter.ToUInt16(Data, 0x0); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0); } } + public int String1 { get { return BitConverter.ToUInt16(Data, 0x2); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2); } } + public int Form { get { return Data[0x4]; } set { Data[0x4] = (byte)value; } } public int Level { get { return Data[0x5]; } set { Data[0x5] = (byte)value; } } + public int[] IVs { get @@ -40,12 +45,14 @@ public int[] IVs Data[i + 0x6] = (byte)Convert.ToSByte(value[i]); } } + public int Ability { get { return Data[0xC]; } set { Data[0xC] = (byte)value; } } public int Nature { get { return Data[0xD]; } set { Data[0xD] = (byte)value; } } public int Gender { get { return Data[0xE]; } set { Data[0xE] = (byte)value; } } public int TID { get { return BitConverter.ToUInt16(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } } public int SID { get { return BitConverter.ToUInt16(Data, 0x12); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } } public uint ID { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } } + public override int HeldItem { get @@ -60,11 +67,13 @@ public override int HeldItem BitConverter.GetBytes((short)value).CopyTo(Data, 0x14); } } + public int String2 { get { return BitConverter.ToUInt16(Data, 0x18); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } } + public int trGender { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } } public ushort OT_Intensity { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } } diff --git a/pk3DS.Core/Structures/Gen7/Maison7.cs b/pk3DS.Core/Structures/Gen7/Maison7.cs index e837d27346..d71b9411c6 100644 --- a/pk3DS.Core/Structures/Gen7/Maison7.cs +++ b/pk3DS.Core/Structures/Gen7/Maison7.cs @@ -12,14 +12,16 @@ public class Trainer public ushort[] Choices; public Trainer() { } + public Trainer(byte[] data) { Class = BitConverter.ToUInt16(data, 0); Count = BitConverter.ToUInt16(data, 2); Choices = new ushort[Count]; for (int i = 0; i < Count; i++) - Choices[i] = BitConverter.ToUInt16(data, 4 + 2 * i); + Choices[i] = BitConverter.ToUInt16(data, 4 + (2 * i)); } + public byte[] Write() { using (var ms = new MemoryStream()) @@ -33,6 +35,7 @@ public byte[] Write() } } } + public class Pokemon { public ushort Species; @@ -58,7 +61,7 @@ public Pokemon(byte[] data) { Species = BitConverter.ToUInt16(data, 0); for (int i = 0; i < 4; i++) - Moves[i] = BitConverter.ToUInt16(data, 2 + 2 * i); + Moves[i] = BitConverter.ToUInt16(data, 2 + (2 * i)); EV = data[0xA]; for (int i = 0; i < 6; i++) EVs[i] = ((EV >> i) & 1) == 1; @@ -66,6 +69,7 @@ public Pokemon(byte[] data) Item = BitConverter.ToUInt16(data, 0xC); Form = BitConverter.ToUInt16(data, 0xE); } + public byte[] Write() { using (var ms = new MemoryStream()) diff --git a/pk3DS.Core/Structures/Gen7/ZoneData7.cs b/pk3DS.Core/Structures/Gen7/ZoneData7.cs index 84da741e6f..4be17aeb1c 100644 --- a/pk3DS.Core/Structures/Gen7/ZoneData7.cs +++ b/pk3DS.Core/Structures/Gen7/ZoneData7.cs @@ -16,6 +16,7 @@ public ZoneData7(byte[] data) { Data = (byte[])(data ?? new byte[SIZE]).Clone(); } + public ZoneData7(byte[] data, int index) { Data = new byte[SIZE]; @@ -27,7 +28,7 @@ public int ParentMap { get => BitConverter.ToInt32(Data, 0x1C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1C); } - + // Info Tracking public void SetZoneName(string[] locationList, int index) { @@ -35,7 +36,6 @@ public void SetZoneName(string[] locationList, int index) Name = $"{index:000} - {LocationName}"; } - public static ZoneData7[] GetArray(byte[] zoneData) { ZoneData7[] zd = new ZoneData7[zoneData.Length / SIZE]; @@ -46,7 +46,7 @@ public static ZoneData7[] GetArray(byte[] zoneData) public static ZoneData7[] GetZoneData7Array(byte[] zoneData, byte[] worldData, string[] locationList, byte[][] worlds) { - var zones = ZoneData7.GetArray(zoneData); + var zones = GetArray(zoneData); for (int i = 0; i < zones.Length; i++) { zones[i].WorldIndex = BitConverter.ToUInt16(worldData, i * 0x2); diff --git a/pk3DS.Core/Structures/Gen7/trpoke7.cs b/pk3DS.Core/Structures/Gen7/trpoke7.cs index 26d4bd219f..117b2e4ab5 100644 --- a/pk3DS.Core/Structures/Gen7/trpoke7.cs +++ b/pk3DS.Core/Structures/Gen7/trpoke7.cs @@ -22,8 +22,9 @@ public trpoke7 Clone() public int Gender { get => Data[0] & 0x3; - set => Data[0] = (byte)((Data[0] & 0xFC) | value & 0x3); + set => Data[0] = (byte)((Data[0] & 0xFC) | (value & 0x3)); } + public int Ability { get => (Data[0] >> 4) & 0x3; @@ -69,6 +70,7 @@ public int[] IVs IV_SPA = value[3]; IV_SPD = value[4]; IV_SPE = value[5]; } } + public int[] EVs { get => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPA, EV_SPD, EV_SPE }; @@ -79,6 +81,7 @@ public int[] EVs EV_SPA = value[3]; EV_SPD = value[4]; EV_SPE = value[5]; } } + public int[] Moves { get => new[] { Move1, Move2, Move3, Move4 }; diff --git a/pk3DS.Core/Structures/Learnset.cs b/pk3DS.Core/Structures/Learnset.cs index 8b967c8e5f..bba51d11a5 100644 --- a/pk3DS.Core/Structures/Learnset.cs +++ b/pk3DS.Core/Structures/Learnset.cs @@ -34,6 +34,7 @@ public int[] GetMoves(int maxLevel, int minLevel = 0) Array.Copy(Moves, start, result, 0, result.Length); return result; } + /// Returns the moves a Pokémon would have if it were encountered at the specified level. /// In Generation 1, it is not possible to learn any moves lower than these encounter moves. /// The level the Pokémon was encountered at. @@ -56,6 +57,7 @@ public int[] GetEncounterMoves(int level) } return (int[])moves; } + /// Returns the index of the lowest level move if the Pokémon were encountered at the specified level. /// Helps determine the minimum level an encounter can be at. /// The level the Pokémon was encountered at. @@ -78,13 +80,14 @@ public int GetLevelLearnMove(int move) return index < 0 ? index : Levels[index]; } } + public class Learnset6 : Learnset { public Learnset6(byte[] data) { if (data.Length < 4 || data.Length % 4 != 0) { Count = 0; Levels = new int[0]; Moves = new int[0]; return; } - Count = data.Length / 4 - 1; + Count = (data.Length / 4) - 1; Moves = new int[Count]; Levels = new int[Count]; using (var ms = new MemoryStream(data)) @@ -95,6 +98,7 @@ public Learnset6(byte[] data) Levels[i] = br.ReadInt16(); } } + public override byte[] Write() { Count = (ushort)Moves.Length; @@ -110,6 +114,7 @@ public override byte[] Write() return ms.ToArray(); } } + public static Learnset[] GetArray(byte[][] entries) { Learnset[] data = new Learnset[entries.Length]; diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs index bf14c04e1c..25db773799 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs @@ -63,6 +63,7 @@ protected static bool[] getBits(byte[] data) r[i] = (data[i/8] >> (i&7) & 0x1) == 1; return r; } + protected static byte[] setBits(bool[] bits) { byte[] data = new byte[bits.Length/8]; @@ -83,6 +84,7 @@ public int FormeIndex(int species, int forme) return FormStatsIndex + forme - 1; } + public int RandomGender { get @@ -100,6 +102,7 @@ public int RandomGender } } } + public bool HasFormes => FormeCount > 1; public int BST => HP + ATK + DEF + SPE + SPA + SPD; } diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs index 129bee726d..7c19338994 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs @@ -5,6 +5,7 @@ namespace pk3DS.Core.Structures.PersonalInfo public class PersonalInfoORAS : PersonalInfoXY { public new const int SIZE = 0x50; + public PersonalInfoORAS(byte[] data) { if (data.Length != SIZE) @@ -23,6 +24,7 @@ public PersonalInfoORAS(byte[] data) getBits(Data.Skip(0x4C).Take(0x04).ToArray()), }; } + public override byte[] Write() { setBits(TMHM).CopyTo(Data, 0x28); diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs index 37aaa852d3..498b923ded 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs @@ -6,6 +6,7 @@ namespace pk3DS.Core.Structures.PersonalInfo public class PersonalInfoSM : PersonalInfoXY { public new const int SIZE = 0x54; + public PersonalInfoSM(byte[] data) { if (data.Length != SIZE) @@ -19,6 +20,7 @@ public PersonalInfoSM(byte[] data) getBits(Data.Skip(0x3C).Take(0x0A).ToArray()), }; } + public override byte[] Write() { setBits(TMHM).CopyTo(Data, 0x28); diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs index 141e5676d0..f15523b1c5 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs @@ -7,6 +7,7 @@ public class PersonalInfoXY : PersonalInfo { protected PersonalInfoXY() { } // For ORAS public const int SIZE = 0x40; + public PersonalInfoXY(byte[] data) { if (data.Length != SIZE) @@ -18,6 +19,7 @@ public PersonalInfoXY(byte[] data) TypeTutors = getBits(Data.Skip(0x38).Take(0x4).ToArray()); // 0x3C-0x40 unknown } + public override byte[] Write() { setBits(TMHM).CopyTo(Data, 0x28); @@ -31,6 +33,7 @@ public override byte[] Write() public override int SPE { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } } public override int SPA { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } } public override int SPD { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } } + public override int[] Types { get { return new int[] { Data[0x06], Data[0x07] }; } @@ -41,6 +44,7 @@ public override int[] Types Data[0x07] = (byte)value[1]; } } + public override int CatchRate { get { return Data[0x08]; } set { Data[0x08] = (byte)value; } } public override int EvoStage { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } } private int EVYield { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } } @@ -50,6 +54,7 @@ public override int[] Types public override int EV_SPE { get { return EVYield >> 6 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } } public override int EV_SPA { get { return EVYield >> 8 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } } public override int EV_SPD { get { return EVYield >> 10 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } } + public override int[] Items { get { return new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE), BitConverter.ToInt16(Data, 0x10) }; } @@ -61,10 +66,12 @@ public override int[] Items BitConverter.GetBytes((short)value[2]).CopyTo(Data, 0x10); } } + public override int Gender { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } } public override int HatchCycles { get { return Data[0x13]; } set { Data[0x13] = (byte)value; } } public override int BaseFriendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } public override int EXPGrowth { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } + public override int[] EggGroups { get { return new int[] { Data[0x16], Data[0x17] }; } @@ -75,6 +82,7 @@ public override int[] EggGroups Data[0x17] = (byte)value[1]; } } + public override int[] Abilities { get { return new int[] { Data[0x18], Data[0x19], Data[0x1A] }; } @@ -86,6 +94,7 @@ public override int[] Abilities Data[0x1A] = (byte)value[2]; } } + public override int EscapeRate { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } } public override int FormStatsIndex { get { return BitConverter.ToUInt16(Data, 0x1C); } protected internal set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } } public override int FormeSprite { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } } diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs index 13fd975ab0..3a154fa2c5 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs @@ -14,6 +14,7 @@ private static byte[][] splitBytes(byte[] data, int size) } return r; } + public PersonalTable(byte[] data, GameVersion format) { int size = 0; @@ -55,6 +56,7 @@ public PersonalTable(byte[] data, GameVersion format) } public readonly PersonalInfo[] Table; + public PersonalInfo this[int index] { get @@ -77,12 +79,14 @@ public int[] getAbilities(int species, int forme) { species = 0; Console.WriteLine("Requested out of bounds SpeciesID"); } return this[getFormeIndex(species, forme)].Abilities; } + public int getFormeIndex(int species, int forme) { if (species >= Table.Length) { species = 0; Console.WriteLine("Requested out of bounds SpeciesID"); } return this[species].FormeIndex(species, forme); } + public PersonalInfo getFormeEntry(int species, int forme) { return this[getFormeIndex(species, forme)]; @@ -105,6 +109,7 @@ public string[][] getFormList(string[] species, int MaxSpecies) return FormList; } + public string[] getPersonalEntryList(string[][] AltForms, string[] species, int MaxSpecies, out int[] baseForm, out int[] formVal) { string[] result = new string[Table.Length]; @@ -126,6 +131,7 @@ public string[] getPersonalEntryList(string[][] AltForms, string[] species, int } return result; } + public int[] getSpeciesForm(int PersonalEntry, GameConfig config) { if (PersonalEntry < config.MaxSpeciesID) return new[] { PersonalEntry, 0 }; diff --git a/pk3DS.Core/Structures/Script.cs b/pk3DS.Core/Structures/Script.cs index dbdffcad2e..f6fa7a5e2f 100644 --- a/pk3DS.Core/Structures/Script.cs +++ b/pk3DS.Core/Structures/Script.cs @@ -40,6 +40,7 @@ public class Script ((DecompressedLength - CompressedLength)/(decimal)DecompressedLength).ToString("p1"); public byte[] Raw; + public Script(byte[] data = null) { Raw = data ?? new byte[0]; @@ -48,6 +49,7 @@ public Script(byte[] data = null) if ((Raw[8] & 1) != 0) throw new ArgumentException("Multi-environment script!?"); } + public byte[] Write() { return Raw; diff --git a/pk3DS.Core/Structures/Scripts.cs b/pk3DS.Core/Structures/Scripts.cs index 25a20c9860..6846da5d3d 100644 --- a/pk3DS.Core/Structures/Scripts.cs +++ b/pk3DS.Core/Structures/Scripts.cs @@ -31,11 +31,13 @@ internal static byte[] decompressScript(byte[] data) return mn.ToArray(); } } + internal static byte[] readCompressed(byte[] data, int pos) { byte[] c1 = data.Skip(pos).TakeWhile(b => b >> 7 > 0).ToArray(); // Take while >= 0x80 return c1.Concat(data.Skip(pos + c1.Length).Take(1)).ToArray(); // Take another } + internal static byte[] decompressBytes(byte[] cb) { byte[] db = new byte[0]; @@ -120,6 +122,7 @@ internal static byte[] compressScript(byte[] data) return mn.ToArray(); } } + internal static byte[] compressBytes(byte[] db) { short cmd = BitConverter.ToInt16(db, 0); @@ -171,7 +174,7 @@ internal static byte[] compressBytes(byte[] db) { byte bits = (byte)((byte)dv & 0x7F); dv >>= 7; // Take off 7 bits at a time bitStorage |= (byte)(bits << (ctr*8)); // Write the 7 bits into storage - bitStorage |= (byte)(1 << (7 + ctr++*8)); // continue reading flag + bitStorage |= (byte)(1 << (7 + (ctr++*8))); // continue reading flag } byte[] compressedBits = BitConverter.GetBytes(bitStorage); @@ -191,11 +194,12 @@ internal static string[] getHexLines(byte[] data, int count = 4) { data = data ?? new byte[0]; // Generates an x-byte wide space separated string array; leftovers included at the end. - string[] s = new string[data.Length/count + (data.Length % count > 0 ? 1 : 0)]; + string[] s = new string[(data.Length/count) + (data.Length % count > 0 ? 1 : 0)]; for (int i = 0; i < s.Length;i++) s[i] = BitConverter.ToString(data.Skip(i*count).Take(count).ToArray()).Replace('-', ' '); return s; } + internal static string[] getHexLines(uint[] data) { data = data ?? new uint[0]; @@ -205,6 +209,7 @@ internal static string[] getHexLines(uint[] data) s[i] = BitConverter.ToString(BitConverter.GetBytes(data[i])).Replace('-', ' '); return s; } + internal static byte[] getBytes(uint[] data) { return data.Aggregate(new byte[0], (current, t) => current.Concat(BitConverter.GetBytes(t)).ToArray()); @@ -426,7 +431,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // sanity check range... // negative.. weird - int newOfs = line*4 + delta; + int newOfs = (line * 4) + delta; op = $"{Commands[c]} => 0x{newOfs:X4} ({delta})"; break; } @@ -440,7 +445,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) } case 0x82: // JumpIfElse { - var jOffset = i*4 -4; // todo: this may be the correct jump start point... + var jOffset = (i * 4) - 4; // todo: this may be the correct jump start point... var count = cmd[i++]; // switch case table // sanity check @@ -451,14 +456,14 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) for (int j = 0; j < count; j++) { var jmp = (int)cmd[i++]; - var toOffset = (i-2)*4 + jmp; + var toOffset = ((i-2)*4) + jmp; var ifValue = (int)cmd[i++]; tree.Add($"\t{ifValue} => 0x{toOffset:X4} ({jmp})"); } // Default { int jmp = (int)cmd[i++]; - var toOffset = (i-2)*4 + jmp; + var toOffset = ((i-2)*4) + jmp; tree.Add($"\t{"*"} => 0x{toOffset:X4} ({jmp})"); } @@ -575,7 +580,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) { // minimal sanity checks // can return error code 0x1C - int newPos = i + (int)(1 + 2*(cmd[i]/4) + 1); + int newPos = i + (int)(1 + (2 *(cmd[i]/4)) + 1); op = eA(c, newPos); break; @@ -636,7 +641,9 @@ internal static string eA(uint c, params int[] arr) string parameters = arr.Length == 0 ? "" : string.Join(", ", arr.Select(z => $"{(Math.Abs(z) < 100 ? z.ToString() : "0x"+z.ToString("X4"))}")); return $"{cmd}({parameters})"; } + private static readonly Func getFloat = val => BitConverter.ToSingle(BitConverter.GetBytes(val), 0); + internal static string eF(uint c, params uint[] arr) { string cmd = Commands[c]; diff --git a/pk3DS.Core/Structures/TypeChart.cs b/pk3DS.Core/Structures/TypeChart.cs index 737333f902..da8040d29f 100644 --- a/pk3DS.Core/Structures/TypeChart.cs +++ b/pk3DS.Core/Structures/TypeChart.cs @@ -31,14 +31,14 @@ public static Bitmap getGrid(int itemsize, int itemsPerRow, byte[] vals) byte[] itemColor = BitConverter.GetBytes(Colors[vals[i]]); for (int x = 0; x < itemsize * itemsize; x++) Buffer.BlockCopy(itemColor, 0, bmpData, - (Y * itemsize + x % itemsize) * width * 4 + (X * itemsize + x / itemsize) * 4, 4); + (((Y * itemsize) + (x % itemsize)) * width * 4) + (((X * itemsize) + (x / itemsize)) * 4), 4); } // slap on a grid byte[] gridColor = BitConverter.GetBytes(0x17000000); for (int i = 0; i < width * height; i++) if (i % itemsize == 0 || i / (itemsize * itemsPerRow) % itemsize == 0) Buffer.BlockCopy(gridColor, 0, bmpData, - i / (itemsize * itemsPerRow) * width * 4 + i % (itemsize * itemsPerRow) * 4, 4); + (i / (itemsize * itemsPerRow) * width * 4) + (i % (itemsize * itemsPerRow) * 4), 4); // assemble image Bitmap b = new Bitmap(width, height, PixelFormat.Format32bppArgb); diff --git a/pk3DS.Core/TableUtil.cs b/pk3DS.Core/TableUtil.cs index 29716d7f62..3382b9c729 100644 --- a/pk3DS.Core/TableUtil.cs +++ b/pk3DS.Core/TableUtil.cs @@ -21,6 +21,7 @@ public static class TableUtil return string.Join(Environment.NewLine, list); } + public static string GetTable(IEnumerable arr) where T : new() { return string.Join(Environment.NewLine, GetTableRaw(arr)); @@ -30,6 +31,7 @@ public static class TableUtil { return Table(arr).Select(row => string.Join(sep, row)); } + private static IEnumerable> Table(IEnumerable arr) where T : new() { var type = typeof(T); @@ -37,6 +39,7 @@ public static class TableUtil foreach (var z in arr) yield return GetValues(z, type); } + private static IEnumerable GetNames(Type type) { foreach (var z in type.GetProperties()) @@ -44,6 +47,7 @@ private static IEnumerable GetNames(Type type) foreach (var z in type.GetFields()) yield return z.Name; } + private static IEnumerable GetValues(object obj, Type type) { foreach (var z in type.GetProperties()) diff --git a/pk3DS.Core/TextFile.cs b/pk3DS.Core/TextFile.cs index f22a9bf7c7..0607766b16 100644 --- a/pk3DS.Core/TextFile.cs +++ b/pk3DS.Core/TextFile.cs @@ -34,14 +34,16 @@ public TextFile(GameConfig config, byte[] data = null, bool remapChars = false) Config = config; RemapChars = remapChars; } + private GameConfig Config { get; set; } - private bool RemapChars = true; + private readonly bool RemapChars = true; private ushort TextSections { get { return BitConverter.ToUInt16(Data, 0x0); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x0); } } // Always 0x0001 private ushort LineCount { get { return BitConverter.ToUInt16(Data, 0x2); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x2); } } private uint TotalLength { get { return BitConverter.ToUInt32(Data, 0x4); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4); } } private uint InitialKey { get { return BitConverter.ToUInt32(Data, 0x8); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x8); } } // Always 0x00000000 private uint SectionDataOffset { get { return BitConverter.ToUInt32(Data, 0xC); } set { BitConverter.GetBytes(value).CopyTo(Data, 0xC); } } // Always 0x0010 private uint SectionLength { get { return BitConverter.ToUInt32(Data, (int)SectionDataOffset); } set { BitConverter.GetBytes(value).CopyTo(Data, SectionDataOffset); } } + private LineInfo[] LineOffsets { get @@ -51,8 +53,8 @@ private LineInfo[] LineOffsets for (int i = 0; i < result.Length; i++) result[i] = new LineInfo { - Offset = BitConverter.ToInt32(Data, i * 8 + sdo + 4) + sdo, - Length = BitConverter.ToInt16(Data, i * 8 + sdo + 8) + Offset = BitConverter.ToInt32(Data, (i * 8) + sdo + 4) + sdo, + Length = BitConverter.ToInt16(Data, (i * 8) + sdo + 8) }; return result; } @@ -63,11 +65,12 @@ private LineInfo[] LineOffsets int sdo = (int)SectionDataOffset; for (int i = 0; i < value.Length; i++) { - BitConverter.GetBytes(value[i].Offset).CopyTo(Data, i * 8 + sdo + 4); - BitConverter.GetBytes(value[i].Length).CopyTo(Data, i * 8 + sdo + 8); + BitConverter.GetBytes(value[i].Offset).CopyTo(Data, (i * 8) + sdo + 4); + BitConverter.GetBytes(value[i].Length).CopyTo(Data, (i * 8) + sdo + 8); } } } + private class LineInfo { public int Offset, Length; @@ -118,19 +121,20 @@ public byte[][] LineData int bytesUsed = 0; for (int i = 0; i < lines.Length; i++) { - lines[i] = new LineInfo {Offset = 4 + 8 * value.Length + bytesUsed, Length = value[i].Length / 2}; + lines[i] = new LineInfo {Offset = 4 + (8 * value.Length) + bytesUsed, Length = value[i].Length / 2}; bytesUsed += value[i].Length; } // Apply Line Data int sdo = (int)SectionDataOffset; - Array.Resize(ref Data, sdo + 4 + 8 * value.Length + bytesUsed); + Array.Resize(ref Data, sdo + 4 + (8 * value.Length) + bytesUsed); LineOffsets = lines; value.SelectMany(i => i).ToArray().CopyTo(Data, Data.Length - bytesUsed); TotalLength = SectionLength = (uint)(Data.Length - sdo); LineCount = (ushort)value.Length; } } + public string[] Lines { get => LineData.Select(z => getLineString(Config, z)).ToArray(); @@ -172,6 +176,7 @@ private static byte[] cryptLineData(byte[] data, ushort key) } return result; } + private byte[] getLineData(GameConfig config, string line) { if (line == null) @@ -223,6 +228,7 @@ private ushort TryRemapChar(ushort val) default: return val; } } + private ushort TryUnmapChar(ushort val) { if (!RemapChars) @@ -262,6 +268,7 @@ private string getLineString(GameConfig config, byte[] data) } return s.ToString(); // Shouldn't get hit if the string is properly terminated. } + private string getVariableString(GameConfig config, byte[] data, ref int i) { var s = new StringBuilder(); @@ -300,6 +307,7 @@ private string getVariableString(GameConfig config, byte[] data, ref int i) s.Append("]"); return s.ToString(); } + private IEnumerable getEscapeValues(char esc) { var vals = new List(); @@ -313,6 +321,7 @@ private IEnumerable getEscapeValues(char esc) default: throw new Exception("Invalid terminated line: \\" + esc); } } + private IEnumerable getVariableValues(GameConfig config, string variable) { string[] split = variable.Split(' '); @@ -339,6 +348,7 @@ private IEnumerable getVariableValues(GameConfig config, string variable } return vals; } + private IEnumerable getVariableParameters(GameConfig config, string text) { var vals = new List(); @@ -374,6 +384,7 @@ private ushort getVariableNumber(GameConfig config, string variable) } catch { throw new ArgumentException("Variable parse error: " + variable); } } + private string getVariableString(GameConfig config, ushort variable) { var v = config.getVariableName(variable); @@ -387,6 +398,7 @@ public static string[] getStrings(GameConfig config, byte[] data, bool remapChar try { t = new TextFile(config, data, remapChars); } catch { return null; } return t.Lines; } + public static byte[] getBytes(GameConfig config, string[] lines, bool remapChars = false) { return new TextFile (config, remapChars: remapChars) { Lines = lines }.Data; diff --git a/pk3DS.Core/Util.cs b/pk3DS.Core/Util.cs index d5bcd9259b..6dec138167 100644 --- a/pk3DS.Core/Util.cs +++ b/pk3DS.Core/Util.cs @@ -14,15 +14,18 @@ public static FileInfo GetNewestFile(DirectoryInfo directory) .OrderByDescending(f => f?.LastWriteTime ?? DateTime.MinValue) .FirstOrDefault(); } + public static string NormalizePath(string path) { return Path.GetFullPath(new Uri(path).LocalPath) .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); } + public static string CleanFileName(string fileName) { return Path.GetInvalidFileNameChars().Aggregate(fileName, (current, c) => current.Replace(c.ToString(), string.Empty)); } + public static string TrimFromZero(string input) { int index = input.IndexOf('\0'); @@ -43,6 +46,7 @@ public static int ToInt32(string value) string val = value?.Replace(" ", "").Replace("_", "").Trim(); return string.IsNullOrWhiteSpace(val) ? 0 : int.Parse(val); } + public static uint ToUInt32(string value) { string val = value?.Replace(" ", "").Replace("_", "").Trim(); @@ -78,7 +82,7 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp // check for 2char container extensions try { - br.BaseStream.Position = position + 4 + 4 * count; + br.BaseStream.Position = position + 4 + (4 * count); if (br.ReadUInt32() == br.BaseStream.Length) { ext += (char)magic[0] + (char)magic[1]; @@ -92,7 +96,7 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp try { count = BitConverter.ToUInt16(magic, 0); - br.BaseStream.Position = position + 4 + 0x40 * count; + br.BaseStream.Position = position + 4 + (0x40 * count); uint tableval = br.ReadUInt32(); br.BaseStream.Position += 0x20 * tableval; while (br.PeekChar() == 0) // seek forward @@ -121,7 +125,7 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp return defaultExt; for (int i = 0; i < magic.Length && i < 4; i++) { - if (magic[i] >= 'a' && magic[i] <= 'z' || magic[i] >= 'A' && magic[i] <= 'Z' + if ((magic[i] >= 'a' && magic[i] <= 'z') || (magic[i] >= 'A' && magic[i] <= 'Z') || char.IsDigit((char)magic[i])) { ext += (char)magic[i]; @@ -142,11 +146,13 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp } catch { return defaultExt; } } + public static string GuessExtension(string path, bool bypass) { using (BinaryReader br = new BinaryReader(File.OpenRead(path))) return GuessExtension(br, "bin", bypass); } + public static uint Reverse(uint x) { uint y = 0; @@ -158,6 +164,7 @@ public static uint Reverse(uint x) } return y; } + public static char[] Reverse(char[] charArray) { Array.Reverse(charArray); @@ -189,6 +196,7 @@ public static string getHexString(byte[] data) { return BitConverter.ToString(data).Replace('-', ' '); } + public static void resizeJagged(ref byte[][] array, int size, int lowLen) { int oldSize = array?.Length ?? 0; @@ -200,6 +208,7 @@ public static void resizeJagged(ref byte[][] array, int size, int lowLen) array[i] = new byte[lowLen]; } } + public static byte[] StringToByteArray(string hex) { return Enumerable.Range(0, hex.Length) @@ -207,6 +216,5 @@ public static byte[] StringToByteArray(string hex) .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) .ToArray(); } - } } diff --git a/pk3DS/ARCUtil.cs b/pk3DS/ARCUtil.cs index 9cea5b8708..1e5a12df40 100644 --- a/pk3DS/ARCUtil.cs +++ b/pk3DS/ARCUtil.cs @@ -15,6 +15,7 @@ public static SARC analyzeSARC(string path) try { return new SARC(path); } catch { return new SARC(); } } + internal static ShuffleARC AnalyzeShuffle(string path) { ShuffleARC sharc = new ShuffleARC @@ -60,6 +61,7 @@ internal static ShuffleARC AnalyzeShuffle(string path) } return sharc; } + internal static GAR analyzeGAR(string path) { GAR gar = new GAR @@ -129,6 +131,7 @@ internal static GAR analyzeGAR(string path) } return gar; } + internal static DARC analyze(string path) { DARC darc = new DARC @@ -204,6 +207,7 @@ internal static DARC analyze(string path) return darc; } } + internal static FARC analyzeFARC(string path) { FARC farc = new FARC @@ -283,6 +287,7 @@ internal static FARC analyzeFARC(string path) farc.Extension = Path.GetExtension(path); return farc; } + internal static string Interpret(string path) { string fn = Path.GetFileName(path); @@ -500,8 +505,8 @@ internal static void repackDARC(string path, string fileName, string outfolder = byte[] donorBytes = File.ReadAllBytes(donor); if (data.SequenceEqual(donorBytes.Take(data.Length))) { - int headerLen = data.Length + BitConverter.ToInt32(donorBytes, data.Length)*0x20; - headerLen += 0x80 - headerLen%0x80; + int headerLen = data.Length + (BitConverter.ToInt32(donorBytes, data.Length)*0x20); + headerLen += 0x80 - (headerLen % 0x80); data = donorBytes.Take(headerLen).ToArray(); } else @@ -530,6 +535,7 @@ internal static string FixMajoraChecksum(string path) File.WriteAllBytes(path, data); return "Corrected Majora Checksum to " + val.ToString("X4"); } + internal static string ParseShuffleText(string path) { ShuffleText st = new ShuffleText @@ -592,11 +598,13 @@ public struct FARC public string Extension; public Boolean valid; } + public struct FARCFileTable { public List Files; public List FileNames; } + public struct FARCFile { public uint NameOffset; @@ -622,11 +630,13 @@ public class ShuffleARC public bool add100; public bool valid; } + public class ShuffleFile { public uint Offset; public uint Length; } + public class ShuffleText { public uint StringMetaOffset; @@ -661,6 +671,7 @@ public class GAR public string Extension; public bool valid; } + public class GARFile { public string NameWithExtension; @@ -691,11 +702,13 @@ public struct DARC public string Extension; public Boolean valid; } + public struct FileTable { public List Files; public List FileNames; } + public struct DarcFile { public ushort NameOffset; // diff --git a/pk3DS/Legality/Randomizer.cs b/pk3DS/Legality/Randomizer.cs index 2b8bd3ca1e..b803c88363 100644 --- a/pk3DS/Legality/Randomizer.cs +++ b/pk3DS/Legality/Randomizer.cs @@ -76,11 +76,13 @@ internal static int[] getRandomItemList() 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 699, 704, 708, 709, 710, 711, 715, }; + private static readonly int[] Items_HeldAO = Items_HeldXY.Concat(new[] { 534, 535, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 767, 768, 769, 770, }).ToArray(); + private static readonly int[] Items_Ball = { 000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, @@ -108,14 +110,17 @@ internal static int[] getRandomItemList() 761, 762, 763, 764, 767, 768, 769, 770, 795, 796, 844, 849, 853, 854, 855, 856, 879, 880, 881, 882, 883, 884, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, }; + internal static readonly ushort[] Pouch_Ball_SM = { // 08 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 492, 493, 494, 495, 496, 497, 498, 576, 851 }; + internal static readonly ushort[] Pouch_Battle_SM = { // 16 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 577, 846, }; + internal static readonly ushort[] Pouch_Items_SM = Pouch_Regular_SM.Concat(Pouch_Ball_SM).Concat(Pouch_Battle_SM).ToArray(); internal static readonly ushort[] Pouch_Key_SM = { @@ -123,6 +128,7 @@ internal static int[] getRandomItemList() 705, 706, 765, 773, 797, 841, 842, 843, 845, 847, 850, 857, 858, 860, }; + internal static readonly ushort[] Pouch_TMHM_SM = { // 02 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, @@ -131,21 +137,26 @@ internal static int[] getRandomItemList() 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 618, 619, 620, 690, 691, 692, 693, 694, }; + internal static readonly ushort[] Pouch_Medicine_SM = { // 32 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 65, 66, 67, 134, 504, 565, 566, 567, 568, 569, 570, 591, 708, 709, 852, }; + internal static readonly ushort[] Pouch_Berries_SM = { 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 686, 687, 688, }; + internal static readonly ushort[] Pouch_ZCrystal_SM = { // Bead 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, }; + internal static readonly ushort[] Pouch_ZCrystalHeld_SM = { // Piece 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 798, 799, 800, 801, 802, 803, 804, 805, 806, 836 }; + internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray(); internal static readonly ushort[] HeldItemsBuy_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Medicine_SM).ToArray(); #endregion diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index 2c94c9a6e4..89d23b3e48 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -102,19 +102,19 @@ private void InitializeComponent() this.FLP_CRO.SuspendLayout(); this.Tab_Output.SuspendLayout(); this.SuspendLayout(); - // + // // TB_Path - // - this.TB_Path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.TB_Path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.TB_Path.Location = new System.Drawing.Point(158, 3); this.TB_Path.Name = "TB_Path"; this.TB_Path.ReadOnly = true; this.TB_Path.Size = new System.Drawing.Size(214, 20); this.TB_Path.TabIndex = 1; - // + // // L_Game - // + // this.L_Game.AutoSize = true; this.L_Game.ForeColor = System.Drawing.Color.Red; this.L_Game.Location = new System.Drawing.Point(157, 23); @@ -122,18 +122,18 @@ private void InitializeComponent() this.L_Game.Size = new System.Drawing.Size(91, 13); this.L_Game.TabIndex = 2; this.L_Game.Text = "No Game Loaded"; - // + // // pBar1 - // - this.pBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + // + this.pBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pBar1.Location = new System.Drawing.Point(12, 225); this.pBar1.Name = "pBar1"; this.pBar1.Size = new System.Drawing.Size(360, 14); this.pBar1.TabIndex = 6; - // + // // B_OPower - // + // this.B_OPower.Location = new System.Drawing.Point(215, 32); this.B_OPower.Name = "B_OPower"; this.B_OPower.Size = new System.Drawing.Size(100, 23); @@ -141,9 +141,9 @@ private void InitializeComponent() this.B_OPower.Text = "O-Powers"; this.B_OPower.UseVisualStyleBackColor = true; this.B_OPower.Click += new System.EventHandler(this.B_OPower_Click); - // + // // B_Pickup - // + // this.B_Pickup.Location = new System.Drawing.Point(109, 32); this.B_Pickup.Name = "B_Pickup"; this.B_Pickup.Size = new System.Drawing.Size(100, 23); @@ -151,9 +151,9 @@ private void InitializeComponent() this.B_Pickup.Text = "Pickup Items"; this.B_Pickup.UseVisualStyleBackColor = true; this.B_Pickup.Click += new System.EventHandler(this.B_Pickup_Click); - // + // // B_Mart - // + // this.B_Mart.Location = new System.Drawing.Point(3, 32); this.B_Mart.Name = "B_Mart"; this.B_Mart.Size = new System.Drawing.Size(100, 23); @@ -161,9 +161,9 @@ private void InitializeComponent() this.B_Mart.Text = "Poké Mart"; this.B_Mart.UseVisualStyleBackColor = true; this.B_Mart.Click += new System.EventHandler(this.B_Mart_Click); - // + // // B_MoveTutor - // + // this.B_MoveTutor.Location = new System.Drawing.Point(3, 3); this.B_MoveTutor.Name = "B_MoveTutor"; this.B_MoveTutor.Size = new System.Drawing.Size(100, 23); @@ -171,9 +171,9 @@ private void InitializeComponent() this.B_MoveTutor.Text = "Move Tutors"; this.B_MoveTutor.UseVisualStyleBackColor = true; this.B_MoveTutor.Click += new System.EventHandler(this.B_MoveTutor_Click); - // + // // B_TMHM - // + // this.B_TMHM.Location = new System.Drawing.Point(109, 3); this.B_TMHM.Name = "B_TMHM"; this.B_TMHM.Size = new System.Drawing.Size(100, 23); @@ -181,9 +181,9 @@ private void InitializeComponent() this.B_TMHM.Text = "TMs/HMs"; this.B_TMHM.UseVisualStyleBackColor = true; this.B_TMHM.Click += new System.EventHandler(this.B_TMHM_Click); - // + // // RTB_Status - // + // this.RTB_Status.Dock = System.Windows.Forms.DockStyle.Fill; this.RTB_Status.Location = new System.Drawing.Point(0, 0); this.RTB_Status.Name = "RTB_Status"; @@ -191,9 +191,9 @@ private void InitializeComponent() this.RTB_Status.Size = new System.Drawing.Size(352, 154); this.RTB_Status.TabIndex = 7; this.RTB_Status.Text = ""; - // + // // menuStrip1 - // + // this.menuStrip1.BackColor = System.Drawing.Color.Transparent; this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_File, @@ -204,34 +204,34 @@ private void InitializeComponent() this.menuStrip1.Size = new System.Drawing.Size(384, 24); this.menuStrip1.TabIndex = 9; this.menuStrip1.Text = "menuStrip1"; - // + // // Menu_File - // + // this.Menu_File.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Open, this.Menu_Exit}); this.Menu_File.Name = "Menu_File"; this.Menu_File.Size = new System.Drawing.Size(37, 20); this.Menu_File.Text = "File"; - // + // // Menu_Open - // + // this.Menu_Open.Name = "Menu_Open"; this.Menu_Open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); this.Menu_Open.Size = new System.Drawing.Size(155, 22); this.Menu_Open.Text = "&Open..."; this.Menu_Open.Click += new System.EventHandler(this.B_Open_Click); - // + // // Menu_Exit - // + // this.Menu_Exit.Name = "Menu_Exit"; this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); this.Menu_Exit.Size = new System.Drawing.Size(155, 22); this.Menu_Exit.Text = "&Exit"; this.Menu_Exit.Click += new System.EventHandler(this.Menu_Exit_Click); - // + // // Menu_Tools - // + // this.Menu_Tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Restore, this.Menu_Misc, @@ -241,17 +241,17 @@ private void InitializeComponent() this.Menu_Tools.Name = "Menu_Tools"; this.Menu_Tools.Size = new System.Drawing.Size(47, 20); this.Menu_Tools.Text = "Tools"; - // + // // Menu_Restore - // + // this.Menu_Restore.Enabled = false; this.Menu_Restore.Name = "Menu_Restore"; this.Menu_Restore.Size = new System.Drawing.Size(184, 22); this.Menu_Restore.Text = "Restore Original Files"; this.Menu_Restore.Click += new System.EventHandler(this.L_Game_Click); - // + // // Menu_Misc - // + // this.Menu_Misc.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.unPackBCLIMToolStripMenuItem, this.Menu_BLZ, @@ -260,41 +260,41 @@ private void InitializeComponent() this.Menu_Misc.Name = "Menu_Misc"; this.Menu_Misc.Size = new System.Drawing.Size(184, 22); this.Menu_Misc.Text = "Misc Tools"; - // + // // unPackBCLIMToolStripMenuItem - // + // this.unPackBCLIMToolStripMenuItem.Name = "unPackBCLIMToolStripMenuItem"; this.unPackBCLIMToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T))); this.unPackBCLIMToolStripMenuItem.Size = new System.Drawing.Size(216, 22); this.unPackBCLIMToolStripMenuItem.Text = "(un)Pack + BCLIM"; this.unPackBCLIMToolStripMenuItem.Click += new System.EventHandler(this.L_SubTools_Click); - // + // // Menu_BLZ - // + // this.Menu_BLZ.Name = "Menu_BLZ"; this.Menu_BLZ.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_BLZ.Size = new System.Drawing.Size(216, 22); this.Menu_BLZ.Text = "(de)Compress BLZ"; this.Menu_BLZ.Click += new System.EventHandler(this.Menu_BLZ_Click); - // + // // Menu_LZ11 - // + // this.Menu_LZ11.Name = "Menu_LZ11"; this.Menu_LZ11.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L))); this.Menu_LZ11.Size = new System.Drawing.Size(216, 22); this.Menu_LZ11.Text = "(de)Compress LZ11"; this.Menu_LZ11.Click += new System.EventHandler(this.Menu_LZ11_Click); - // + // // Menu_Shuffler - // + // this.Menu_Shuffler.Enabled = false; this.Menu_Shuffler.Name = "Menu_Shuffler"; this.Menu_Shuffler.Size = new System.Drawing.Size(216, 22); this.Menu_Shuffler.Text = "GARC Shuffler"; this.Menu_Shuffler.Click += new System.EventHandler(this.Menu_Shuffler_Click); - // + // // Menu_Rebuild - // + // this.Menu_Rebuild.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_RomFS, this.Menu_ExeFS, @@ -304,71 +304,71 @@ private void InitializeComponent() this.Menu_Rebuild.Name = "Menu_Rebuild"; this.Menu_Rebuild.Size = new System.Drawing.Size(184, 22); this.Menu_Rebuild.Text = "Rebuild..."; - // + // // Menu_RomFS - // + // this.Menu_RomFS.Enabled = false; this.Menu_RomFS.Name = "Menu_RomFS"; this.Menu_RomFS.Size = new System.Drawing.Size(111, 22); this.Menu_RomFS.Text = "RomFS"; this.Menu_RomFS.Click += new System.EventHandler(this.rebuildRomFS); - // + // // Menu_ExeFS - // + // this.Menu_ExeFS.Enabled = false; this.Menu_ExeFS.Name = "Menu_ExeFS"; this.Menu_ExeFS.Size = new System.Drawing.Size(111, 22); this.Menu_ExeFS.Text = "ExeFS"; this.Menu_ExeFS.Click += new System.EventHandler(this.rebuildExeFS); - // + // // Menu_CRO - // + // this.Menu_CRO.Enabled = false; this.Menu_CRO.Name = "Menu_CRO"; this.Menu_CRO.Size = new System.Drawing.Size(111, 22); this.Menu_CRO.Text = "CRO"; this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR); - // + // // Menu_3DS - // + // this.Menu_3DS.Enabled = false; this.Menu_3DS.Name = "Menu_3DS"; this.Menu_3DS.Size = new System.Drawing.Size(111, 22); this.Menu_3DS.Text = ".3DS"; this.Menu_3DS.Click += new System.EventHandler(this.B_Rebuild3DS_Click); - // + // // Menu_Patch - // + // this.Menu_Patch.Enabled = false; this.Menu_Patch.Name = "Menu_Patch"; this.Menu_Patch.Size = new System.Drawing.Size(111, 22); this.Menu_Patch.Text = "Patch"; this.Menu_Patch.Click += new System.EventHandler(this.B_Patch_Click); - // + // // Menu_SMDH - // + // this.Menu_SMDH.Name = "Menu_SMDH"; this.Menu_SMDH.Size = new System.Drawing.Size(184, 22); this.Menu_SMDH.Text = "SMDH Editor (Icon)"; this.Menu_SMDH.Click += new System.EventHandler(this.Menu_SMDH_Click); - // + // // randomizationToolStripMenuItem - // + // this.randomizationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.setInt32SeedToolStripMenuItem}); this.randomizationToolStripMenuItem.Name = "randomizationToolStripMenuItem"; this.randomizationToolStripMenuItem.Size = new System.Drawing.Size(184, 22); this.randomizationToolStripMenuItem.Text = "Randomization"; - // + // // setInt32SeedToolStripMenuItem - // + // this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem"; this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed"; this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click); - // + // // Menu_Options - // + // this.Menu_Options.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Language, this.Menu_About, @@ -376,17 +376,17 @@ private void InitializeComponent() this.Menu_Options.Name = "Menu_Options"; this.Menu_Options.Size = new System.Drawing.Size(61, 20); this.Menu_Options.Text = "Options"; - // + // // Menu_Language - // + // this.Menu_Language.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.CB_Lang}); this.Menu_Language.Name = "Menu_Language"; this.Menu_Language.Size = new System.Drawing.Size(146, 22); this.Menu_Language.Text = "Language"; - // + // // CB_Lang - // + // this.CB_Lang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Lang.Items.AddRange(new object[] { "カタカナ", @@ -401,28 +401,28 @@ private void InitializeComponent() "漢字簡化方案"}); this.CB_Lang.Name = "CB_Lang"; this.CB_Lang.Size = new System.Drawing.Size(121, 23); - this.CB_Lang.SelectedIndexChanged += new System.EventHandler(this.changeLanguage); - // + this.CB_Lang.SelectedIndexChanged += new System.EventHandler(this.ChangeLanguage); + // // Menu_About - // + // this.Menu_About.Name = "Menu_About"; this.Menu_About.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_About.ShowShortcutKeys = false; this.Menu_About.Size = new System.Drawing.Size(146, 22); this.Menu_About.Text = "A&bout pk3DS"; this.Menu_About.Click += new System.EventHandler(this.L_About_Click); - // + // // Menu_GARCs - // + // this.Menu_GARCs.Name = "Menu_GARCs"; this.Menu_GARCs.Size = new System.Drawing.Size(146, 22); this.Menu_GARCs.Text = "About GARCs"; this.Menu_GARCs.Click += new System.EventHandler(this.L_GARCInfo_Click); - // + // // TC_RomFS - // - this.TC_RomFS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.TC_RomFS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.TC_RomFS.Controls.Add(this.Tab_RomFS); this.TC_RomFS.Controls.Add(this.Tab_ExeFS); @@ -433,9 +433,9 @@ private void InitializeComponent() this.TC_RomFS.SelectedIndex = 0; this.TC_RomFS.Size = new System.Drawing.Size(360, 180); this.TC_RomFS.TabIndex = 11; - // + // // Tab_RomFS - // + // this.Tab_RomFS.Controls.Add(this.FLP_RomFS); this.Tab_RomFS.Location = new System.Drawing.Point(4, 22); this.Tab_RomFS.Name = "Tab_RomFS"; @@ -444,9 +444,9 @@ private void InitializeComponent() this.Tab_RomFS.TabIndex = 0; this.Tab_RomFS.Text = "RomFS"; this.Tab_RomFS.UseVisualStyleBackColor = true; - // + // // FLP_RomFS - // + // this.FLP_RomFS.AutoScroll = true; this.FLP_RomFS.Controls.Add(this.B_GameText); this.FLP_RomFS.Controls.Add(this.B_StoryText); @@ -468,9 +468,9 @@ private void InitializeComponent() this.FLP_RomFS.Name = "FLP_RomFS"; this.FLP_RomFS.Size = new System.Drawing.Size(346, 148); this.FLP_RomFS.TabIndex = 13; - // + // // B_GameText - // + // this.B_GameText.Location = new System.Drawing.Point(3, 3); this.B_GameText.Name = "B_GameText"; this.B_GameText.Size = new System.Drawing.Size(100, 23); @@ -478,9 +478,9 @@ private void InitializeComponent() this.B_GameText.Text = "Game Text"; this.B_GameText.UseVisualStyleBackColor = true; this.B_GameText.Click += new System.EventHandler(this.B_GameText_Click); - // + // // B_StoryText - // + // this.B_StoryText.Location = new System.Drawing.Point(109, 3); this.B_StoryText.Name = "B_StoryText"; this.B_StoryText.Size = new System.Drawing.Size(100, 23); @@ -488,9 +488,9 @@ private void InitializeComponent() this.B_StoryText.Text = "Story Text"; this.B_StoryText.UseVisualStyleBackColor = true; this.B_StoryText.Click += new System.EventHandler(this.B_StoryText_Click); - // + // // B_Personal - // + // this.B_Personal.Location = new System.Drawing.Point(215, 3); this.B_Personal.Name = "B_Personal"; this.B_Personal.Size = new System.Drawing.Size(100, 23); @@ -498,9 +498,9 @@ private void InitializeComponent() this.B_Personal.Text = "Personal Stats"; this.B_Personal.UseVisualStyleBackColor = true; this.B_Personal.Click += new System.EventHandler(this.B_Personal_Click); - // + // // B_Evolution - // + // this.B_Evolution.Location = new System.Drawing.Point(3, 32); this.B_Evolution.Name = "B_Evolution"; this.B_Evolution.Size = new System.Drawing.Size(100, 23); @@ -508,9 +508,9 @@ private void InitializeComponent() this.B_Evolution.Text = "Evolutions"; this.B_Evolution.UseVisualStyleBackColor = true; this.B_Evolution.Click += new System.EventHandler(this.B_Evolution_Click); - // + // // B_LevelUp - // + // this.B_LevelUp.Location = new System.Drawing.Point(109, 32); this.B_LevelUp.Name = "B_LevelUp"; this.B_LevelUp.Size = new System.Drawing.Size(100, 23); @@ -518,9 +518,9 @@ private void InitializeComponent() this.B_LevelUp.Text = "Level Up Moves"; this.B_LevelUp.UseVisualStyleBackColor = true; this.B_LevelUp.Click += new System.EventHandler(this.B_LevelUp_Click); - // + // // B_Wild - // + // this.B_Wild.Location = new System.Drawing.Point(215, 32); this.B_Wild.Name = "B_Wild"; this.B_Wild.Size = new System.Drawing.Size(100, 23); @@ -528,9 +528,9 @@ private void InitializeComponent() this.B_Wild.Text = "Wild Encounters"; this.B_Wild.UseVisualStyleBackColor = true; this.B_Wild.Click += new System.EventHandler(this.B_Wild_Click); - // + // // B_MegaEvo - // + // this.B_MegaEvo.Location = new System.Drawing.Point(3, 61); this.B_MegaEvo.Name = "B_MegaEvo"; this.B_MegaEvo.Size = new System.Drawing.Size(100, 23); @@ -538,9 +538,9 @@ private void InitializeComponent() this.B_MegaEvo.Text = "Mega Evolutions"; this.B_MegaEvo.UseVisualStyleBackColor = true; this.B_MegaEvo.Click += new System.EventHandler(this.B_MegaEvo_Click); - // + // // B_EggMove - // + // this.B_EggMove.Location = new System.Drawing.Point(109, 61); this.B_EggMove.Name = "B_EggMove"; this.B_EggMove.Size = new System.Drawing.Size(100, 23); @@ -548,9 +548,9 @@ private void InitializeComponent() this.B_EggMove.Text = "Egg Moves"; this.B_EggMove.UseVisualStyleBackColor = true; this.B_EggMove.Click += new System.EventHandler(this.B_EggMove_Click); - // + // // B_Trainer - // + // this.B_Trainer.Location = new System.Drawing.Point(215, 61); this.B_Trainer.Name = "B_Trainer"; this.B_Trainer.Size = new System.Drawing.Size(100, 23); @@ -558,9 +558,9 @@ private void InitializeComponent() this.B_Trainer.Text = "Trainers"; this.B_Trainer.UseVisualStyleBackColor = true; this.B_Trainer.Click += new System.EventHandler(this.B_Trainer_Click); - // + // // B_Maison - // + // this.B_Maison.Location = new System.Drawing.Point(3, 90); this.B_Maison.Name = "B_Maison"; this.B_Maison.Size = new System.Drawing.Size(100, 23); @@ -568,9 +568,9 @@ private void InitializeComponent() this.B_Maison.Text = "Battle Maison"; this.B_Maison.UseVisualStyleBackColor = true; this.B_Maison.Click += new System.EventHandler(this.B_Maison_Click); - // + // // B_Royal - // + // this.B_Royal.Location = new System.Drawing.Point(109, 90); this.B_Royal.Name = "B_Royal"; this.B_Royal.Size = new System.Drawing.Size(100, 23); @@ -578,9 +578,9 @@ private void InitializeComponent() this.B_Royal.Text = "Battle Royal/Tree"; this.B_Royal.UseVisualStyleBackColor = true; this.B_Royal.Click += new System.EventHandler(this.B_Maison_Click); - // + // // B_Item - // + // this.B_Item.Location = new System.Drawing.Point(215, 90); this.B_Item.Name = "B_Item"; this.B_Item.Size = new System.Drawing.Size(100, 23); @@ -588,9 +588,9 @@ private void InitializeComponent() this.B_Item.Text = "Item Stats"; this.B_Item.UseVisualStyleBackColor = true; this.B_Item.Click += new System.EventHandler(this.B_Item_Click); - // + // // B_Move - // + // this.B_Move.Location = new System.Drawing.Point(3, 119); this.B_Move.Name = "B_Move"; this.B_Move.Size = new System.Drawing.Size(100, 23); @@ -598,9 +598,9 @@ private void InitializeComponent() this.B_Move.Text = "Move Stats"; this.B_Move.UseVisualStyleBackColor = true; this.B_Move.Click += new System.EventHandler(this.B_Move_Click); - // + // // B_TitleScreen - // + // this.B_TitleScreen.Location = new System.Drawing.Point(109, 119); this.B_TitleScreen.Name = "B_TitleScreen"; this.B_TitleScreen.Size = new System.Drawing.Size(100, 23); @@ -608,9 +608,9 @@ private void InitializeComponent() this.B_TitleScreen.Text = "Title Screen"; this.B_TitleScreen.UseVisualStyleBackColor = true; this.B_TitleScreen.Click += new System.EventHandler(this.B_TitleScreen_Click); - // + // // B_OWSE - // + // this.B_OWSE.Location = new System.Drawing.Point(215, 119); this.B_OWSE.Name = "B_OWSE"; this.B_OWSE.Size = new System.Drawing.Size(100, 23); @@ -618,9 +618,9 @@ private void InitializeComponent() this.B_OWSE.Text = "OWSE [Dev]"; this.B_OWSE.UseVisualStyleBackColor = true; this.B_OWSE.Click += new System.EventHandler(this.B_OWSE_Click); - // + // // Tab_ExeFS - // + // this.Tab_ExeFS.Controls.Add(this.FLP_ExeFS); this.Tab_ExeFS.Location = new System.Drawing.Point(4, 22); this.Tab_ExeFS.Name = "Tab_ExeFS"; @@ -629,9 +629,9 @@ private void InitializeComponent() this.Tab_ExeFS.TabIndex = 1; this.Tab_ExeFS.Text = "ExeFS"; this.Tab_ExeFS.UseVisualStyleBackColor = true; - // + // // FLP_ExeFS - // + // this.FLP_ExeFS.AutoScroll = true; this.FLP_ExeFS.Controls.Add(this.B_MoveTutor); this.FLP_ExeFS.Controls.Add(this.B_TMHM); @@ -645,9 +645,9 @@ private void InitializeComponent() this.FLP_ExeFS.Name = "FLP_ExeFS"; this.FLP_ExeFS.Size = new System.Drawing.Size(346, 148); this.FLP_ExeFS.TabIndex = 11; - // + // // B_TM - // + // this.B_TM.Location = new System.Drawing.Point(215, 3); this.B_TM.Name = "B_TM"; this.B_TM.Size = new System.Drawing.Size(100, 23); @@ -655,9 +655,9 @@ private void InitializeComponent() this.B_TM.Text = "TMs"; this.B_TM.UseVisualStyleBackColor = true; this.B_TM.Click += new System.EventHandler(this.B_TMHM_Click); - // + // // B_ShinyRate - // + // this.B_ShinyRate.Location = new System.Drawing.Point(3, 61); this.B_ShinyRate.Name = "B_ShinyRate"; this.B_ShinyRate.Size = new System.Drawing.Size(100, 23); @@ -665,9 +665,9 @@ private void InitializeComponent() this.B_ShinyRate.Text = "Shiny Rate"; this.B_ShinyRate.UseVisualStyleBackColor = true; this.B_ShinyRate.Click += new System.EventHandler(this.B_ShinyRate_Click); - // + // // Tab_CRO - // + // this.Tab_CRO.Controls.Add(this.FLP_CRO); this.Tab_CRO.Location = new System.Drawing.Point(4, 22); this.Tab_CRO.Name = "Tab_CRO"; @@ -675,9 +675,9 @@ private void InitializeComponent() this.Tab_CRO.TabIndex = 2; this.Tab_CRO.Text = "CRO"; this.Tab_CRO.UseVisualStyleBackColor = true; - // + // // FLP_CRO - // + // this.FLP_CRO.Controls.Add(this.B_TypeChart); this.FLP_CRO.Controls.Add(this.B_Starter); this.FLP_CRO.Controls.Add(this.B_Gift); @@ -688,9 +688,9 @@ private void InitializeComponent() this.FLP_CRO.Padding = new System.Windows.Forms.Padding(3); this.FLP_CRO.Size = new System.Drawing.Size(352, 154); this.FLP_CRO.TabIndex = 1; - // + // // B_TypeChart - // + // this.B_TypeChart.Location = new System.Drawing.Point(6, 6); this.B_TypeChart.Name = "B_TypeChart"; this.B_TypeChart.Size = new System.Drawing.Size(100, 23); @@ -698,9 +698,9 @@ private void InitializeComponent() this.B_TypeChart.Text = "Type Chart"; this.B_TypeChart.UseVisualStyleBackColor = true; this.B_TypeChart.Click += new System.EventHandler(this.B_TypeChart_Click); - // + // // B_Starter - // + // this.B_Starter.Location = new System.Drawing.Point(112, 6); this.B_Starter.Name = "B_Starter"; this.B_Starter.Size = new System.Drawing.Size(100, 23); @@ -708,9 +708,9 @@ private void InitializeComponent() this.B_Starter.Text = "Starter Pokémon"; this.B_Starter.UseVisualStyleBackColor = true; this.B_Starter.Click += new System.EventHandler(this.B_Starter_Click); - // + // // B_Gift - // + // this.B_Gift.Location = new System.Drawing.Point(218, 6); this.B_Gift.Name = "B_Gift"; this.B_Gift.Size = new System.Drawing.Size(100, 23); @@ -718,9 +718,9 @@ private void InitializeComponent() this.B_Gift.Text = "Gift Pokémon"; this.B_Gift.UseVisualStyleBackColor = true; this.B_Gift.Click += new System.EventHandler(this.B_Gift_Click); - // + // // B_Static - // + // this.B_Static.Location = new System.Drawing.Point(6, 35); this.B_Static.Name = "B_Static"; this.B_Static.Size = new System.Drawing.Size(100, 23); @@ -728,9 +728,9 @@ private void InitializeComponent() this.B_Static.Text = "Static Encounters"; this.B_Static.UseVisualStyleBackColor = true; this.B_Static.Click += new System.EventHandler(this.B_Static_Click); - // + // // Tab_Output - // + // this.Tab_Output.Controls.Add(this.RTB_Status); this.Tab_Output.Location = new System.Drawing.Point(4, 22); this.Tab_Output.Name = "Tab_Output"; @@ -738,17 +738,17 @@ private void InitializeComponent() this.Tab_Output.TabIndex = 3; this.Tab_Output.Text = "Output"; this.Tab_Output.UseVisualStyleBackColor = true; - // + // // L_Status - // + // this.L_Status.Location = new System.Drawing.Point(203, 37); this.L_Status.Name = "L_Status"; this.L_Status.Size = new System.Drawing.Size(163, 20); this.L_Status.TabIndex = 14; this.L_Status.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // Main - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(384, 252); @@ -763,7 +763,7 @@ private void InitializeComponent() this.Name = "Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "pk3DS"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CloseForm); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.TC_RomFS.ResumeLayout(false); diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 352724f647..91a46d3d32 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -59,6 +59,7 @@ public Main() if (File.Exists(RandSettings.FileName)) RandSettings.Load(File.ReadAllLines(RandSettings.FileName)); } + internal static GameConfig Config; public static string RomFSPath; public static string ExeFSPath; @@ -75,19 +76,22 @@ private void L_About_Click(object sender, EventArgs e) { new About().ShowDialog(); } + private void L_GARCInfo_Click(object sender, EventArgs e) { if (RomFSPath == null) return; string s = "Game Type: " + Config.Version + Environment.NewLine; - s = Config.Files.Select(file => file.Name).Aggregate(s, (current, t) => current + string.Format(Environment.NewLine + "{0} - {1}", t, Config.getGARCFileName(t))); + s = Config.Files.Select(file => file.Name).Aggregate(s, (current, t) => current + string.Format(Environment.NewLine + "{0} - {1}", t, Config.GetGARCFileName(t))); - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, s, "Copy to Clipboard?")) return; + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, s, "Copy to Clipboard?")) + return; try { Clipboard.SetText(s); } catch { WinFormsUtil.Alert("Unable to copy to Clipboard."); } } + private void L_Game_Click(object sender, EventArgs e) => new EnhancedRestore(Config).ShowDialog(); private void B_Open_Click(object sender, EventArgs e) @@ -96,7 +100,8 @@ private void B_Open_Click(object sender, EventArgs e) if (fbd.ShowDialog() == DialogResult.OK) openQuick(fbd.SelectedPath); } - private void changeLanguage(object sender, EventArgs e) + + private void ChangeLanguage(object sender, EventArgs e) { if (InvokeRequired) Invoke((MethodInvoker)delegate { Language = CB_Lang.SelectedIndex; }); @@ -121,13 +126,16 @@ private void changeLanguage(object sender, EventArgs e) Properties.Settings.Default.Language = Language; Properties.Settings.Default.Save(); } + private void Menu_Exit_Click(object sender, EventArgs e) { Close(); } - private void formClosing(object sender, FormClosingEventArgs e) + + private void CloseForm(object sender, FormClosingEventArgs e) { - if (Config == null) return; + if (Config == null) + return; var g = Config.GARCGameText; string[][] files = Config.GameTextStrings; g.Files = files.Select(x => TextFile.getBytes(Config, x)).ToArray(); @@ -142,7 +150,8 @@ private void formClosing(object sender, FormClosingEventArgs e) private void openQuick(string path) { - if (threadActive()) return; + if (threadActive()) + return; if (!Directory.Exists(path)) // File { @@ -169,7 +178,7 @@ private void openQuick(string path) if (dr == DialogResult.Cancel) return; bool recurse = dr == DialogResult.Yes; - ToolsUI.openARC(path, pBar1, recurse); + ToolsUI.OpenARC(path, pBar1, recurse); } } else // Directory @@ -182,10 +191,10 @@ private void openQuick(string path) // Find RomFS folder foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.ToLower().Contains("rom") && Directory.Exists(f))) - checkIfRomFS(f); + CheckIfRomFS(f); // Find ExeFS folder foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.ToLower().Contains("exe") && Directory.Exists(f))) - checkIfExeFS(f); + CheckIfExeFS(f); if (count > 3) WinFormsUtil.Alert("pk3DS will function best if you keep your Game Files folder clean and free of unnecessary folders."); @@ -195,7 +204,7 @@ private void openQuick(string path) Tab_ExeFS.Enabled = RomFSPath != null && ExeFSPath != null; if (RomFSPath != null) { - toggleSubEditors(); + ToggleSubEditors(); string newtext = $"Game Loaded: {Config.Version}"; if (L_Game.Text != newtext && Directory.Exists("personal")) { Directory.Delete("personal", true); } // Force reloading of personal data if the game is switched. @@ -216,7 +225,7 @@ private void openQuick(string path) } // Enable Rebuilding options if all files have been found - checkIfExHeader(path); + CheckIfExHeader(path); Menu_ExeFS.Enabled = ExeFSPath != null; Menu_RomFS.Enabled = Menu_Restore.Enabled = Menu_GARCs.Enabled = RomFSPath != null; Menu_Patch.Enabled = RomFSPath != null && ExeFSPath != null; @@ -237,12 +246,14 @@ private void openQuick(string path) } } - private void toggleSubEditors() + private void ToggleSubEditors() { // Hide all buttons foreach (var f in from TabPage t in TC_RomFS.TabPages from f in t.Controls.OfType() select f) + { for (int i = f.Controls.Count - 1; i >= 0; i--) f.Controls.Remove(f.Controls[i]); + } B_MoveTutor.Visible = Config.ORAS; // Default false unless loaded @@ -273,6 +284,7 @@ private void toggleSubEditors() FLP_ExeFS.Controls.AddRange(exefs); FLP_CRO.Controls.AddRange(cro); } + private void updateGameInfo() { // 0 - JP @@ -290,7 +302,8 @@ private void updateGameInfo() ? "pk3DS" // nothing else : "pk3DS - " + SMDH.AppInfo[AILang[Language]].ShortDescription; } - private static GameConfig checkGameType(string[] files) + + private static GameConfig CheckGameType(string[] files) { try { @@ -303,7 +316,8 @@ private static GameConfig checkGameType(string[] files) catch { } return null; } - private bool checkIfRomFS(string path) + + private bool CheckIfRomFS(string path) { string[] top = Directory.GetDirectories(path); FileInfo fi = new FileInfo(top[top.Length > 1 ? 1 : 0]); @@ -311,7 +325,7 @@ private bool checkIfRomFS(string path) if (fi.Name == "a") { string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories); - var cfg = checkGameType(files); + var cfg = CheckGameType(files); if (cfg == null) { @@ -329,10 +343,11 @@ private bool checkIfRomFS(string path) RomFSPath = null; return false; } - private bool checkIfExeFS(string path) + + private bool CheckIfExeFS(string path) { string[] files = Directory.GetFiles(path); - if (files.Length == 1 && Path.GetFileName(files[0]).ToLower() == "exefs.bin") + if (files.Length == 1 && string.Equals(Path.GetFileName(files[0]), "exefs.bin", StringComparison.OrdinalIgnoreCase)) { // Prompt if the user wants to unpack the ExeFS. if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected ExeFS binary.", "Unpack?")) @@ -355,14 +370,12 @@ private bool checkIfExeFS(string path) FileInfo fi = new FileInfo(files[0]); if (!fi.Name.Contains("code")) { - if (new FileInfo(files[1]).Name == "code.bin") - { - File.Move(files[1], Path.Combine(Path.GetDirectoryName(files[1]), ".code.bin")); - files = Directory.GetFiles(path); - fi = new FileInfo(files[0]); - } - else + if (new FileInfo(files[1]).Name != "code.bin") return false; + + File.Move(files[1], Path.Combine(Path.GetDirectoryName(files[1]), ".code.bin")); + files = Directory.GetFiles(path); + fi = new FileInfo(files[0]); } if (fi.Length % 0x200 != 0 && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Compressed code binary.", "Decompress? File will be replaced.") == DialogResult.Yes) new Thread(() => { threads++; new BLZCoder(new[] { "-d", files[0] }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start(); @@ -370,25 +383,30 @@ private bool checkIfExeFS(string path) ExeFSPath = path; return true; } - private bool checkIfExHeader(string path) + + private bool CheckIfExHeader(string path) { ExHeaderPath = null; // Input folder path should contain the ExHeader. string[] files = Directory.GetFiles(path); - foreach (string fp in from s in files let f = new FileInfo(s) where (f.Name.ToLower().StartsWith("exh") || f.Name.ToLower().StartsWith("decryptedexh")) && f.Length == 0x800 select s) + foreach (string fp in from s in files let f = new FileInfo(s) where (f.Name.StartsWith("exh", StringComparison.OrdinalIgnoreCase) || f.Name.StartsWith("decryptedexh", StringComparison.OrdinalIgnoreCase)) && f.Length == 0x800 select s) ExHeaderPath = fp; return ExHeaderPath != null; } + private bool threadActive() { - if (threads <= 0) return false; + if (threads <= 0) + return false; WinFormsUtil.Alert("Please wait for all operations to finish first."); return true; } + private void tabMain_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } + private void tabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); @@ -399,14 +417,17 @@ private void tabMain_DragDrop(object sender, DragEventArgs e) // RomFS Subform Items private void rebuildRomFS(object sender, EventArgs e) { - if (threadActive()) return; - if (RomFSPath == null) return; - if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild RomFS?") != DialogResult.Yes) return; + if (threadActive()) + return; + if (RomFSPath == null) + return; + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild RomFS?") != DialogResult.Yes) + return; SaveFileDialog sfd = new SaveFileDialog { FileName = HANSgameID != 0 ? HANSgameID.ToString("X8") + ".romfs" : "romfs.bin", - Filter = "HANS RomFS|*.romfs" + "|Binary File|*.bin" + "|All Files|*.*" + Filter = "HANS RomFS|*.romfs|Binary File|*.bin|All Files|*.*" }; sfd.FilterIndex = HANSgameID != 0 ? 0 : sfd.Filter.Length - 1; @@ -425,9 +446,11 @@ private void rebuildRomFS(object sender, EventArgs e) }).Start(); } } + private void B_GameText_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { var g = Config.GARCGameText; @@ -437,18 +460,21 @@ private void B_GameText_Click(object sender, EventArgs e) g.Save(); }).Start(); } + private void B_StoryText_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { - var g = Config.getGARCData("storytext"); + var g = Config.GetGARCData("storytext"); string[][] files = g.Files.Select(file => new TextFile(Config, file).Lines).ToArray(); Invoke((Action)(() => new TextEditor(files, "storytext").ShowDialog())); g.Files = TryWriteText(files, g); g.Save(); }).Start(); } + private static byte[][] TryWriteText(string[][] files, GARCFile g) { byte[][] data = new byte[files.Length][]; @@ -466,7 +492,7 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g) data[i] = g.getFile(i); } } - if (!errata.Any()) + if (errata.Count == 0) return data; string[] options = @@ -493,9 +519,11 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g) return data; } + private void B_Maison_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; DialogResult dr; switch (Config.Generation) { @@ -508,14 +536,15 @@ private void B_Maison_Click(object sender, EventArgs e) default: return; } - if (dr == DialogResult.Cancel) return; + if (dr == DialogResult.Cancel) + return; new Thread(() => { bool super = dr == DialogResult.Yes; string c = super ? "S" : "N"; - var trdata = Config.getGARCData("maisontr"+c); - var trpoke = Config.getGARCData("maisonpk"+c); + var trdata = Config.GetGARCData("maisontr"+c); + var trpoke = Config.GetGARCData("maisonpk"+c); byte[][] trd = trdata.Files; byte[][] trp = trpoke.Files; switch (Config.Generation) @@ -533,9 +562,11 @@ private void B_Maison_Click(object sender, EventArgs e) trpoke.Save(); }).Start(); } + private void B_Personal_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { byte[][] d = Config.GARCPersonal.Files; @@ -555,17 +586,18 @@ private void B_Personal_Click(object sender, EventArgs e) Config.GARCPersonal.Files = d; Config.GARCPersonal.Save(); Config.InitializePersonal(); - }).Start(); } + private void B_Trainer_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { - var trclass = Config.getGARCData("trclass"); - var trdata = Config.getGARCData("trdata"); - var trpoke = Config.getGARCData("trpoke"); + var trclass = Config.GetGARCData("trclass"); + var trdata = Config.GetGARCData("trdata"); + var trpoke = Config.GetGARCData("trpoke"); byte[][] trc = trclass.Files; byte[][] trd = trdata.Files; byte[][] trp = trpoke.Files; @@ -587,9 +619,11 @@ private void B_Trainer_Click(object sender, EventArgs e) trpoke.Save(); }).Start(); } + private void B_Wild_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { string[] files; @@ -605,9 +639,9 @@ private void B_Wild_Click(object sender, EventArgs e) else return; Invoke((MethodInvoker)delegate { Enabled = false; }); - fileGet(files, false); + FileGet(files, false); Invoke(action); - fileSet(files); + FileSet(files); Invoke((MethodInvoker)delegate { Enabled = true; }); break; case 7: @@ -616,11 +650,11 @@ private void B_Wild_Click(object sender, EventArgs e) files = new [] { "encdata", "zonedata", "worlddata" }; updateStatus($"GARC Get: {files[0]}... "); - var ed = Config.getlzGARCData(files[0]); + var ed = Config.GetlzGARCData(files[0]); updateStatus($"GARC Get: {files[1]}... "); - var zd = Config.getlzGARCData(files[1]); + var zd = Config.GetlzGARCData(files[1]); updateStatus($"GARC Get: {files[2]}... "); - var wd = Config.getlzGARCData(files[2]); + var wd = Config.GetlzGARCData(files[2]); updateStatus("Running SMWE... "); action = () => new SMWE(ed, zd, wd).ShowDialog(); Invoke(action); @@ -636,11 +670,12 @@ private void B_Wild_Click(object sender, EventArgs e) } }).Start(); } + private void B_OWSE_Click(object sender, EventArgs e) { - if (threadActive()) return; - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "The OverWorld/Script Editor is not recommended for most users and is still a work-in-progress.", "Continue anyway?")) + if (threadActive()) + return; + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "The OverWorld/Script Editor is not recommended for most users and is still a work-in-progress.", "Continue anyway?")) return; switch (Config.Generation) { @@ -652,6 +687,7 @@ private void B_OWSE_Click(object sender, EventArgs e) return; } } + private void runOWSE6() { Enabled = false; @@ -660,11 +696,11 @@ private void runOWSE6() bool reload = ModifierKeys == Keys.Control || ModifierKeys == (Keys.Alt | Keys.Control); string[] files = {"encdata", "storytext", "mapGR", "mapMatrix"}; if (reload || files.Sum(t => Directory.Exists(t) ? 0 : 1) != 0) // Dev bypass if all exist already - fileGet(files, false); + FileGet(files, false); // Don't set any data back. Just view. { - var g = Config.getGARCData("storytext"); + var g = Config.GetGARCData("storytext"); string[][] tfiles = g.Files.Select(file => new TextFile(Config, file).Lines).ToArray(); Invoke((Action)(() => new OWSE().Show())); Invoke((Action)(() => new TextEditor(tfiles, "storytext").Show())); @@ -672,9 +708,10 @@ private void runOWSE6() Thread.Sleep(200); } Invoke((MethodInvoker) delegate { Enabled = true; }); - fileSet(files); + FileSet(files); }).Start(); } + private void runOWSE7() { Enabled = false; @@ -682,13 +719,13 @@ private void runOWSE7() { var files = new[] { "encdata", "zonedata", "worlddata" }; updateStatus($"GARC Get: {files[0]}... "); - var ed = Config.getlzGARCData(files[0]); + var ed = Config.GetlzGARCData(files[0]); updateStatus($"GARC Get: {files[1]}... "); - var zd = Config.getlzGARCData(files[1]); + var zd = Config.GetlzGARCData(files[1]); updateStatus($"GARC Get: {files[2]}... "); - var wd = Config.getlzGARCData(files[2]); + var wd = Config.GetlzGARCData(files[2]); - var g = Config.getGARCData("storytext"); + var g = Config.GetGARCData("storytext"); string[][] tfiles = g.Files.Select(file => new TextFile(Config, file).Lines).ToArray(); Invoke((Action)(() => new TextEditor(tfiles, "storytext").Show())); Invoke((Action)(() => new OWSE7(ed, zd, wd).Show())); @@ -697,12 +734,14 @@ private void runOWSE7() Invoke((MethodInvoker)delegate { Enabled = true; }); }).Start(); } + private void B_Evolution_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { - var g = Config.getGARCData("evolution"); + var g = Config.GetGARCData("evolution"); byte[][] d = g.Files; switch (Config.Generation) { @@ -717,12 +756,14 @@ private void B_Evolution_Click(object sender, EventArgs e) g.Save(); }).Start(); } + private void B_MegaEvo_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { - var g = Config.getGARCData("megaevo"); + var g = Config.GetGARCData("megaevo"); byte[][] d = g.Files; switch (Config.Generation) { @@ -737,12 +778,14 @@ private void B_MegaEvo_Click(object sender, EventArgs e) g.Save(); }).Start(); } + private void B_Item_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { - var g = Config.getGARCData("item"); + var g = Config.GetGARCData("item"); byte[][] d = g.Files; switch (Config.Generation) { @@ -757,9 +800,11 @@ private void B_Item_Click(object sender, EventArgs e) g.Save(); }).Start(); } + private void B_Move_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { var g = Config.GARCMoves; @@ -782,9 +827,11 @@ private void B_Move_Click(object sender, EventArgs e) Config.InitializeMoves(); }).Start(); } + private void B_LevelUp_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { byte[][] d = Config.GARCLearnsets.Files; @@ -802,12 +849,14 @@ private void B_LevelUp_Click(object sender, EventArgs e) Config.InitializeLearnset(); }).Start(); } + private void B_EggMove_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { - var g = Config.getGARCData("eggmove"); + var g = Config.GetGARCData("eggmove"); byte[][] d = g.Files; switch (Config.Generation) { @@ -822,36 +871,41 @@ private void B_EggMove_Click(object sender, EventArgs e) g.Save(); }).Start(); } + private void B_TitleScreen_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; new Thread(() => { string[] files = { "titlescreen" }; - fileGet(files); // Compressed files exist, handled in the other form since there's so many + FileGet(files); // Compressed files exist, handled in the other form since there's so many Invoke((Action)(() => new TitleScreenEditor6().ShowDialog())); - fileSet(files); + FileSet(files); }).Start(); } // RomFS File Requesting Method Wrapper - private void fileGet(string[] files, bool skipDecompression = true, bool skipGet = false) + private void FileGet(string[] files, bool skipDecompression = true, bool skipGet = false) { - if (skipGet || skipBoth) return; + if (skipGet || skipBoth) + return; foreach (string toEdit in files) { - string GARC = Config.getGARCFileName(toEdit); + string GARC = Config.GetGARCFileName(toEdit); updateStatus($"GARC Get: {toEdit} @ {GARC}... "); threadGet(Path.Combine(RomFSPath, GARC), toEdit, true, skipDecompression); while (threads > 0) Thread.Sleep(50); resetStatus(); } } - private void fileSet(IEnumerable files, bool keep = false) + + private void FileSet(IEnumerable files, bool keep = false) { - if (skipBoth) return; + if (skipBoth) + return; foreach (string toEdit in files) { - string GARC = Config.getGARCFileName(toEdit); + string GARC = Config.GetGARCFileName(toEdit); updateStatus($"GARC Set: {toEdit} @ {GARC}... "); threadSet(Path.Combine(RomFSPath, GARC), toEdit, 4); // 4 bytes for Gen6 while (threads > 0) Thread.Sleep(50); @@ -863,8 +917,10 @@ private void fileSet(IEnumerable files, bool keep = false) // ExeFS Subform Items private void rebuildExeFS(object sender, EventArgs e) { - if (ExeFSPath == null) return; - if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild ExeFS?") != DialogResult.Yes) return; + if (ExeFSPath == null) + return; + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild ExeFS?") != DialogResult.Yes) + return; string[] files = Directory.GetFiles(ExeFSPath); int file = 0; if (files[1].Contains("code")) file = 1; @@ -872,7 +928,7 @@ private void rebuildExeFS(object sender, EventArgs e) SaveFileDialog sfd = new SaveFileDialog { FileName = HANSgameID != 0 ? HANSgameID.ToString("X8") + ".exefs" : "exefs.bin", - Filter = "HANS ExeFS|*.exefs" + "|Binary File|*.bin" + "|All Files|*.*" + Filter = "HANS ExeFS|*.exefs|Binary File|*.bin|All Files|*.*" }; sfd.FilterIndex = HANSgameID != 0 ? 0 : sfd.Filter.Length - 1; @@ -888,37 +944,40 @@ private void rebuildExeFS(object sender, EventArgs e) }).Start(); } } + private void B_Pickup_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; switch (Config.Generation) { case 6: if (ExeFSPath != null) new PickupEditor6().Show(); break; case 7: - var pickup = Config.getlzGARCData("pickup"); + var pickup = Config.GetlzGARCData("pickup"); Invoke((Action)(() => new PickupEditor7(pickup).ShowDialog())); break; } } + private void B_TMHM_Click(object sender, EventArgs e) { - if (threadActive()) return; - if (ExeFSPath != null) - switch (Config.Generation) - { - case 6: - new TMHMEditor6().Show(); - break; - case 7: - new TMEditor7().Show(); - break; - } + if (threadActive()) + return; + if (ExeFSPath == null) + return; + switch (Config.Generation) + { + case 6: new TMHMEditor6().Show(); break; + case 7: new TMEditor7().Show(); break; + } } + private void B_Mart_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; switch (Config.Generation) { case 6: @@ -926,36 +985,44 @@ private void B_Mart_Click(object sender, EventArgs e) break; case 7: - if (threadActive()) return; - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) + if (threadActive()) + return; + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; if (RomFSPath != null) (Config.USUM ? new MartEditor7UU() : (Form)new MartEditor7()).Show(); break; } } + private void B_MoveTutor_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; if (Config.XY) { WinFormsUtil.Alert("No Tutors for X/Y."); return; } // Already disabled button... if (ExeFSPath != null) new TutorEditor6().Show(); } + private void B_OPower_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; if (ExeFSPath != null) new OPower().Show(); } + private void B_ShinyRate_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; if (ExeFSPath != null) new ShinyRate().ShowDialog(); } // CRO Subform Items private void patchCRO_CRR(object sender, EventArgs e) { - if (threadActive()) return; - if (RomFSPath == null) return; + if (threadActive()) + return; + if (RomFSPath == null) + return; if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuilding CRO/CRR is not necessary if you patch the RO module.", "Continue?")) return; new Thread(() => @@ -967,13 +1034,13 @@ private void patchCRO_CRR(object sender, EventArgs e) WinFormsUtil.Alert("CRO's and CRR have been updated.", "If you have made any modifications, it is required that the RSA Verification check be patched on the system in order for the modified CROs to load (ie, no file redirection like NTR's layeredFS)."); }).Start(); - } + private void B_Starter_Click(object sender, EventArgs e) { - if (threadActive()) return; - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) + if (threadActive()) + return; + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; string CRO = Path.Combine(RomFSPath, "DllPoke3Select.cro"); string CRO2 = Path.Combine(RomFSPath, "DllField.cro"); @@ -989,15 +1056,16 @@ private void B_Starter_Click(object sender, EventArgs e) } new StarterEditor6().ShowDialog(); } + private void B_TypeChart_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; switch (Config.Generation) { case 6: - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; string CRO = Path.Combine(RomFSPath, "DllBattle.cro"); if (!File.Exists(CRO)) @@ -1010,14 +1078,14 @@ private void B_TypeChart_Click(object sender, EventArgs e) case 7: new TypeChart7().ShowDialog(); break; - } } + private void B_Gift_Click(object sender, EventArgs e) { - if (threadActive()) return; - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) + if (threadActive()) + return; + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; string CRO = Path.Combine(RomFSPath, "DllField.cro"); if (!File.Exists(CRO)) @@ -1027,15 +1095,17 @@ private void B_Gift_Click(object sender, EventArgs e) } new GiftEditor6().ShowDialog(); } + private void B_Static_Click(object sender, EventArgs e) { - if (threadActive()) return; + if (threadActive()) + return; if (Config.Generation == 7) { new Thread(() => { - var esg = Config.getGARCData("encounterstatic"); + var esg = Config.GetGARCData("encounterstatic"); byte[][] es = esg.Files; Invoke((Action)(() => new StaticEncounterEditor7(es).ShowDialog())); @@ -1045,8 +1115,7 @@ private void B_Static_Click(object sender, EventArgs e) return; } - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; string CRO = Path.Combine(RomFSPath, "DllField.cro"); if (!File.Exists(CRO)) @@ -1067,14 +1136,16 @@ private void B_Rebuild3DS_Click(object sender, EventArgs e) WinFormsUtil.Error("RomFS file count does not match the default game file count."); return; } - if (threadActive()) return; + if (threadActive()) + return; SaveFileDialog sfd = new SaveFileDialog { FileName = "newROM.3ds", Filter = "Binary File|*.*" }; - if (sfd.ShowDialog() != DialogResult.OK) return; + if (sfd.ShowDialog() != DialogResult.OK) + return; string path = sfd.FileName; new Thread(() => @@ -1092,14 +1163,17 @@ private void L_SubTools_Click(object sender, EventArgs e) { new ToolsUI().ShowDialog(); } + private void B_Patch_Click(object sender, EventArgs e) { new Patch().ShowDialog(); } + private void Menu_BLZ_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); - if (DialogResult.OK != ofd.ShowDialog()) return; + if (DialogResult.OK != ofd.ShowDialog()) + return; string path = ofd.FileName; FileInfo fi = new FileInfo(path); @@ -1111,10 +1185,12 @@ private void Menu_BLZ_Click(object sender, EventArgs e) else if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Compressed Binary", "Decompress? File will be replaced.") == DialogResult.Yes) new Thread(() => { threads++; new BLZCoder(new[] { "-d", path }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start(); } + private void Menu_LZ11_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); - if (DialogResult.OK != ofd.ShowDialog()) return; + if (DialogResult.OK != ofd.ShowDialog()) + return; string path = ofd.FileName; FileInfo fi = new FileInfo(path); @@ -1144,10 +1220,12 @@ private void Menu_LZ11_Click(object sender, EventArgs e) threads--; }).Start(); } + private void Menu_SMDH_Click(object sender, EventArgs e) { new Icon().ShowDialog(); } + private void Menu_Shuffler_Click(object sender, EventArgs e) { new Shuffler().ShowDialog(); @@ -1163,7 +1241,7 @@ internal static string getGARCFileName(string requestedGARC, int lang) return garc.Reference; } - private bool getGARC(string infile, string outfolder, bool PB, bool bypassExt = false) + private bool GetGARC(string infile, string outfolder, bool PB, bool bypassExt = false) { if (skipBoth && Directory.Exists(outfolder)) { @@ -1180,9 +1258,10 @@ private bool getGARC(string infile, string outfolder, bool PB, bool bypassExt = } catch (Exception e) { WinFormsUtil.Error("Could not get the GARC:", e.ToString()); threads--; return false; } } + private bool setGARC(string outfile, string infolder, int padBytes, bool PB) { - if (skipBoth || ModifierKeys == Keys.Control && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Cancel writing data back to GARC?") == DialogResult.Yes) + if (skipBoth || (ModifierKeys == Keys.Control && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Cancel writing data back to GARC?") == DialogResult.Yes)) { threads--; updateStatus("Aborted!", false); return false; } try @@ -1194,13 +1273,19 @@ private bool setGARC(string outfile, string infolder, int padBytes, bool PB) } catch (Exception e) { WinFormsUtil.Error("Could not set the GARC back:", e.ToString()); threads--; return false; } } + private void threadGet(string infile, string outfolder, bool PB = true, bool bypassExt = false) { threads++; - if (Directory.Exists(outfolder)) try { Directory.Delete(outfolder, true); } + if (Directory.Exists(outfolder)) + { + try { Directory.Delete(outfolder, true); } catch { } - new Thread(() => getGARC(infile, outfolder, PB, bypassExt)).Start(); + } + + new Thread(() => GetGARC(infile, outfolder, PB, bypassExt)).Start(); } + private void threadSet(string outfile, string infolder, int padBytes, bool PB = true) { threads++; @@ -1214,6 +1299,7 @@ private void updateStatus(string status, bool preBreak = true) try { if (RTB_Status.InvokeRequired) + { RTB_Status.Invoke((MethodInvoker)delegate { RTB_Status.AppendText(newtext); @@ -1221,6 +1307,7 @@ private void updateStatus(string status, bool preBreak = true) RTB_Status.ScrollToCaret(); L_Status.Text = RTB_Status.Lines.Last().Split(new[] {" @"}, StringSplitOptions.None)[0]; }); + } else { RTB_Status.AppendText(newtext); @@ -1231,15 +1318,15 @@ private void updateStatus(string status, bool preBreak = true) } catch { } } + private void resetStatus() { try { if (L_Status.InvokeRequired) - L_Status.Invoke((MethodInvoker)delegate - { - L_Status.Text = ""; - }); + { + L_Status.Invoke((MethodInvoker)(() => L_Status.Text = "")); + } else { L_Status.Text = ""; diff --git a/pk3DS/Misc/About.cs b/pk3DS/Misc/About.cs index 6ad37bd2bd..84498bc160 100644 --- a/pk3DS/Misc/About.cs +++ b/pk3DS/Misc/About.cs @@ -10,6 +10,7 @@ public About() InitializeComponent(); RTB.Text = Properties.Resources.changelog; } + private void B_Close_Click(object sender, EventArgs e) { Close(); diff --git a/pk3DS/Misc/ErrorWindow.cs b/pk3DS/Misc/ErrorWindow.cs index 6ad3f82420..27e8474a2b 100644 --- a/pk3DS/Misc/ErrorWindow.cs +++ b/pk3DS/Misc/ErrorWindow.cs @@ -79,6 +79,7 @@ public Exception Error UpdateExceptionDetailsMessage(); } } + private Exception _error; private void UpdateExceptionDetailsMessage() @@ -129,6 +130,5 @@ private void B_Abort_Click(object sender, EventArgs e) DialogResult = DialogResult.Abort; Close(); } - } } diff --git a/pk3DS/Misc/Patch.cs b/pk3DS/Misc/Patch.cs index 1e4db725ce..5f43f3b4a2 100644 --- a/pk3DS/Misc/Patch.cs +++ b/pk3DS/Misc/Patch.cs @@ -62,6 +62,7 @@ internal static bool patchExeFS(string path, string[] oldstr, string[] newstr, s File.WriteAllText(outPath ?? path, text, Encoding.Unicode); return true; } + internal static string exportGARCs(string[] garcPaths, string[] newPaths, string parentRomFS, string patchFolder) { // Stuff files into new patch folder @@ -127,12 +128,13 @@ private string[] getGARCs() sc.CopyTo(garcs, 0); return garcs.Distinct().ToArray(); } + private string[] getPaths(string[] sc) { bool languages = CHK_Lang.Checked; StringCollection paths = new StringCollection(); foreach (string s in sc) - if (!languages || s != "gametext" && s != "storytext") + if (!languages || (s != "gametext" && s != "storytext")) paths.Add(Main.getGARCFileName(s, Main.Language)); else for (int l = 0; l < 8; l++) @@ -148,6 +150,7 @@ private void B_CheckAll_Click(object sender, EventArgs e) for (int i = 0; i < CHKLB_GARCs.Items.Count; i++) CHKLB_GARCs.SetItemChecked(i, true); } + private void B_CheckNone_Click(object sender, EventArgs e) { for (int i = 0; i < CHKLB_GARCs.Items.Count; i++) diff --git a/pk3DS/Subforms/EnhancedRestore.cs b/pk3DS/Subforms/EnhancedRestore.cs index 25e9fd39fb..245a2f3d4c 100644 --- a/pk3DS/Subforms/EnhancedRestore.cs +++ b/pk3DS/Subforms/EnhancedRestore.cs @@ -87,7 +87,7 @@ private static IEnumerable GetRestorableGarcs(GameConfig config, st var files = config.Files.Select(file => file.Name); foreach (var f in files) { - string GARC = config.getGARCFileName(f); + string GARC = config.GetGARCFileName(f); string name = $"{f} ({GARC.Replace(Path.DirectorySeparatorChar.ToString(), "")})"; string src = Path.Combine(config.RomFS, GARC); diff --git a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs index 3504fc7f63..677cd71195 100644 --- a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs @@ -36,10 +36,12 @@ public EggMoveEditor6(byte[][] infiles) CB_Species.SelectedIndex = 0; RandSettings.GetFormSettings(this, groupBox1.Controls); } + private readonly byte[][] files; private int entry = -1; private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private bool dumping; + private void setupDGV() { string[] sortedmoves = (string[])movelist.Clone(); @@ -58,6 +60,7 @@ private void setupDGV() } private EggMoves pkm = new EggMoves6(new byte[0]); + private void getList() { entry = WinFormsUtil.getIndex(CB_Species); @@ -79,6 +82,7 @@ private void getList() dgv.CancelEdit(); } + private void setList() { if (entry < 1 || dumping) return; @@ -125,6 +129,7 @@ private void B_RandAll_Click(object sender, EventArgs e) getList(); WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!", "Press the Dump button to see the new Egg Moves!"); } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Egg Moves to Text File?")) @@ -157,6 +162,7 @@ private void formClosing(object sender, FormClosingEventArgs e) setList(); RandSettings.SetFormSettings(this, groupBox1.Controls); } + private void calcStats() { Move[] MoveData = Main.Config.Moves; diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs index d210b060e1..770698fe2d 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs @@ -75,6 +75,7 @@ public EvolutionEditor6(byte[][] infiles) CB_Species.SelectedIndex = 1; RandSettings.GetFormSettings(this, GB_Randomizer.Controls); } + private readonly byte[][] files; private readonly ComboBox[] pb; private readonly ComboBox[] rb; @@ -87,6 +88,7 @@ public EvolutionEditor6(byte[][] infiles) private readonly string[] typelist = Main.Config.getText(TextName.Types); private bool dumping; private EvolutionSet evo = new EvolutionSet6(new byte[EvolutionSet6.SIZE]); + private void getList() { entry = Array.IndexOf(specieslist, CB_Species.Text); @@ -103,6 +105,7 @@ private void getList() rb[i].SelectedIndex = evo.PossibleEvolutions[i].Species; } } + private void setList() { if (entry < 1 || dumping) return; @@ -141,6 +144,7 @@ private void B_RandAll_Click(object sender, EventArgs e) WinFormsUtil.Alert("All Pokémon's Evolutions have been randomized!"); } + private void B_Trade_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Remove all trade evolutions?", "Evolution methods will be altered so that evolutions will be possible with only one game.")) @@ -156,6 +160,7 @@ private void B_Trade_Click(object sender, EventArgs e) WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Evolutions to Text File?")) @@ -234,6 +239,7 @@ private void changeMethod(object sender, EventArgs e) } pb[op].SelectedIndex = 0; } + private void changeInto(object sender, EventArgs e) { pic[Array.IndexOf(rb, sender as ComboBox)].Image = (Bitmap)Resources.ResourceManager.GetObject("_" + Array.IndexOf(specieslist, (sender as ComboBox).Text)); diff --git a/pk3DS/Subforms/Gen6/Experimental/MapPermView.Designer.cs b/pk3DS/Subforms/Gen6/Experimental/MapPermView.Designer.cs index 3f3b1dfdcf..f37c3650dc 100644 --- a/pk3DS/Subforms/Gen6/Experimental/MapPermView.Designer.cs +++ b/pk3DS/Subforms/Gen6/Experimental/MapPermView.Designer.cs @@ -75,9 +75,9 @@ private void InitializeComponent() this.PB_Map.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.PB_Map.TabIndex = 2; this.PB_Map.TabStop = false; - this.PB_Map.DoubleClick += new System.EventHandler(this.dclickMap); - this.PB_Map.MouseEnter += new System.EventHandler(this.focusPanel); - this.PB_Map.MouseMove += new System.Windows.Forms.MouseEventHandler(this.hoverMap); + this.PB_Map.DoubleClick += new System.EventHandler(this.DclickMap); + this.PB_Map.MouseEnter += new System.EventHandler(this.FocusPanel); + this.PB_Map.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HoverMap); // // CHK_AutoDraw // diff --git a/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs b/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs index 265971bfff..ba9b1748da 100644 --- a/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs +++ b/pk3DS/Subforms/Gen6/Experimental/MapPermView.cs @@ -19,12 +19,14 @@ public MapPermView() private readonly string[] MapGRs; private int mapScale = -1; public int DrawMap = -1; - public void drawMap(int Map) + + public void SetMap(int Map) { DrawMap = Map; - PB_Map.Image = CHK_AutoDraw.Checked ? getMapImage(sliceArea: true) : null; + PB_Map.Image = CHK_AutoDraw.Checked ? GetMapImage(sliceArea: true) : null; } - public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea = false) + + public Bitmap GetMapImage(bool crop = false, bool entity = true, bool sliceArea = false) { // Load MM byte[][] MM = Mini.UnpackMini(File.ReadAllBytes(MapMatrixes[DrawMap]), "MM"); @@ -51,13 +53,17 @@ public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea { int area = 40*mapScale; for (int x = 0; x < img.Width; x++) + { for (int y = 0; y < img.Height; y++) + { if (x % area == 0 || y % area == 0) img.SetPixel(x,y,Color.FromArgb(0x10,0xFF,0,0)); + } + } } if (entity && mapScale == 8) - img = overlayEntities(img); + img = OverlayEntities(img); if (crop) img = WinFormsUtil.TrimBitmap(img); @@ -67,7 +73,7 @@ public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea internal static Bitmap baseImage; - private Bitmap overlayEntities(Bitmap img) + private Bitmap OverlayEntities(Bitmap img) { const float opacity = 0.66f; // Overlay every... overworld entity @@ -76,9 +82,13 @@ private Bitmap overlayEntities(Bitmap img) int x = e.X; int y = e.Y; for (int sx = 0; sx < e.WX; sx++) // Stretch X + { for (int sy = 0; sy < e.WY; sy++) // Stretch Y + { try { WinFormsUtil.LayerImage(img, Properties.Resources.F, (x + sx) * mapScale, (y + sy) * mapScale, opacity); } catch { } + } + } } foreach (var e in OWSE.CurrentZone.Entities.NPCs) { @@ -92,27 +102,39 @@ private Bitmap overlayEntities(Bitmap img) int x = (int)e.PX; // shifted warps look weird int y = (int)e.PY; // shifted warps look weird for (int sx = 0; sx < e.Width; sx++) // Stretch X + { for (int sy = 0; sy < e.Height; sy++) // Stretch Y + { try { WinFormsUtil.LayerImage(img, Properties.Resources.W, (x + sx) * mapScale, (y + sy) * mapScale, opacity); } catch { } + } + } } foreach (var e in OWSE.CurrentZone.Entities.Triggers1) { int x = e.X; int y = e.Y; for (int sx = 0; sx < e.Width; sx++) // Stretch X + { for (int sy = 0; sy < e.Height; sy++) // Stretch Y + { try { WinFormsUtil.LayerImage(img, Properties.Resources.T1, (x + sx) * mapScale, (y + sy) * mapScale, opacity); } catch { } + } + } } foreach (var e in OWSE.CurrentZone.Entities.Triggers2) { int x = e.X; int y = e.Y; for (int sx = 0; sx < e.Width; sx++) // Stretch X + { for (int sy = 0; sy < e.Height; sy++) // Stretch Y + { try { WinFormsUtil.LayerImage(img, Properties.Resources.T2, (x + sx) * mapScale, (y + sy) * mapScale, opacity); } catch { } + } + } } // Overlay Map Data @@ -121,9 +143,13 @@ private Bitmap overlayEntities(Bitmap img) int x = (int)OWSE.CurrentZone.ZD.PX2; int y = (int)OWSE.CurrentZone.ZD.PY2; for (int sx = 0; sx < 1; sx++) // Stretch X + { for (int sy = 0; sy < 1; sy++) // Stretch Y + { try { WinFormsUtil.LayerImage(img, Properties.Resources.FLY, (x + sx) * mapScale, (y + sy) * mapScale, opacity/2); } catch { } + } + } } // Unknown //{ @@ -137,7 +163,7 @@ private Bitmap overlayEntities(Bitmap img) } // UI - private void hoverMap(object sender, MouseEventArgs e) + private void HoverMap(object sender, MouseEventArgs e) { if (mapScale < 0) return; @@ -151,10 +177,10 @@ private void hoverMap(object sender, MouseEventArgs e) int entryX = X/40; int entryY = Y/40; - int entry = entryY*(PB_Map.Image.Width/40/mapScale) + entryX; + int entry = (entryY *(PB_Map.Image.Width/40/mapScale)) + entryX; int epX = X%40; int epY = Y%40; - int tile = epY * 40 + epX; + int tile = (epY * 40) + epX; try { var tileVal = OWSE.mm.Entries[entry] == null @@ -165,10 +191,11 @@ private void hoverMap(object sender, MouseEventArgs e) } catch { } } + private void B_Redraw_Click(object sender, EventArgs e) { if (DrawMap != -1) - PB_Map.Image = getMapImage(sliceArea: true); + PB_Map.Image = GetMapImage(sliceArea: true); } private void MapPermView_FormClosing(object sender, FormClosingEventArgs e) @@ -178,13 +205,13 @@ private void MapPermView_FormClosing(object sender, FormClosingEventArgs e) e.Cancel = true; } - private void focusPanel(object sender, EventArgs e) + private void FocusPanel(object sender, EventArgs e) { if (ContainsFocus) PAN_MAP.Focus(); } - private void dclickMap(object sender, EventArgs e) + private void DclickMap(object sender, EventArgs e) { DialogResult dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Copy image to Clipboard?", "Yes: Map & Overworlds" + Environment.NewLine + "No: Map Only"); diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs index 9d5a27967b..427303a0d6 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs @@ -226,9 +226,9 @@ private void InitializeComponent() this.tb_RAW.SuspendLayout(); this.tb_Dev.SuspendLayout(); this.SuspendLayout(); - // + // // CB_LocationID - // + // this.CB_LocationID.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_LocationID.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_LocationID.Enabled = false; @@ -238,18 +238,18 @@ private void InitializeComponent() this.CB_LocationID.Size = new System.Drawing.Size(164, 21); this.CB_LocationID.TabIndex = 407; this.CB_LocationID.SelectedIndexChanged += new System.EventHandler(this.CB_LocationID_SelectedIndexChanged); - // + // // L_Location - // + // this.L_Location.AutoSize = true; this.L_Location.Location = new System.Drawing.Point(12, 8); this.L_Location.Name = "L_Location"; this.L_Location.Size = new System.Drawing.Size(28, 13); this.L_Location.TabIndex = 411; this.L_Location.Text = "Loc:"; - // + // // RTB_ZD - // + // this.RTB_ZD.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_ZD.Location = new System.Drawing.Point(217, 3); this.RTB_ZD.Name = "RTB_ZD"; @@ -257,11 +257,11 @@ private void InitializeComponent() this.RTB_ZD.Size = new System.Drawing.Size(266, 36); this.RTB_ZD.TabIndex = 412; this.RTB_ZD.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF"; - // + // // tb_Zone - // - this.tb_Zone.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.tb_Zone.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tb_Zone.Controls.Add(this.tb_ZoneData); this.tb_Zone.Controls.Add(this.tb_OWSC); @@ -275,9 +275,9 @@ private void InitializeComponent() this.tb_Zone.SelectedIndex = 0; this.tb_Zone.Size = new System.Drawing.Size(494, 497); this.tb_Zone.TabIndex = 417; - // + // // tb_ZoneData - // + // this.tb_ZoneData.Controls.Add(this.L_MapInfoTabData); this.tb_ZoneData.Location = new System.Drawing.Point(4, 22); this.tb_ZoneData.Name = "tb_ZoneData"; @@ -286,18 +286,18 @@ private void InitializeComponent() this.tb_ZoneData.TabIndex = 0; this.tb_ZoneData.Text = "ZoneData"; this.tb_ZoneData.UseVisualStyleBackColor = true; - // + // // L_MapInfoTabData - // + // this.L_MapInfoTabData.AutoSize = true; this.L_MapInfoTabData.Location = new System.Drawing.Point(26, 26); this.L_MapInfoTabData.Name = "L_MapInfoTabData"; this.L_MapInfoTabData.Size = new System.Drawing.Size(227, 13); this.L_MapInfoTabData.TabIndex = 2; this.L_MapInfoTabData.Text = "Functionality unknown. See RAW tab for data."; - // + // // tb_OWSC - // + // this.tb_OWSC.Controls.Add(this.B_ResetOverworlds); this.tb_OWSC.Controls.Add(this.CHK_EditRAW); this.tb_OWSC.Controls.Add(this.NUD_UnkCount); @@ -319,9 +319,9 @@ private void InitializeComponent() this.tb_OWSC.TabIndex = 1; this.tb_OWSC.Text = "OW & SC"; this.tb_OWSC.UseVisualStyleBackColor = true; - // + // // B_ResetOverworlds - // + // this.B_ResetOverworlds.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.B_ResetOverworlds.Location = new System.Drawing.Point(413, 157); this.B_ResetOverworlds.Name = "B_ResetOverworlds"; @@ -330,9 +330,9 @@ private void InitializeComponent() this.B_ResetOverworlds.Text = "Reset\r\nAll"; this.B_ResetOverworlds.UseVisualStyleBackColor = true; this.B_ResetOverworlds.Click += new System.EventHandler(this.B_ResetOverworlds_Click); - // + // // CHK_EditRAW - // + // this.CHK_EditRAW.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.CHK_EditRAW.AutoSize = true; this.CHK_EditRAW.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -342,10 +342,10 @@ private void InitializeComponent() this.CHK_EditRAW.TabIndex = 430; this.CHK_EditRAW.Text = "Edit Raw Data"; this.CHK_EditRAW.UseVisualStyleBackColor = true; - this.CHK_EditRAW.CheckedChanged += new System.EventHandler(this.changeRAWCheck); - // + this.CHK_EditRAW.CheckedChanged += new System.EventHandler(this.ChangeRAWCheck); + // // NUD_UnkCount - // + // this.NUD_UnkCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.NUD_UnkCount.Location = new System.Drawing.Point(422, 108); this.NUD_UnkCount.Maximum = new decimal(new int[] { @@ -356,10 +356,10 @@ private void InitializeComponent() this.NUD_UnkCount.Name = "NUD_UnkCount"; this.NUD_UnkCount.Size = new System.Drawing.Size(53, 20); this.NUD_UnkCount.TabIndex = 428; - this.NUD_UnkCount.ValueChanged += new System.EventHandler(this.changeUnkCount); - // + this.NUD_UnkCount.ValueChanged += new System.EventHandler(this.ChangeUnkCount); + // // L_Unk - // + // this.L_Unk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_Unk.Location = new System.Drawing.Point(350, 108); this.L_Unk.Name = "L_Unk"; @@ -367,9 +367,9 @@ private void InitializeComponent() this.L_Unk.TabIndex = 429; this.L_Unk.Text = "Unk:"; this.L_Unk.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_OWEntities - // + // this.L_OWEntities.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_OWEntities.AutoSize = true; this.L_OWEntities.Location = new System.Drawing.Point(357, 13); @@ -377,9 +377,9 @@ private void InitializeComponent() this.L_OWEntities.Size = new System.Drawing.Size(118, 13); this.L_OWEntities.TabIndex = 423; this.L_OWEntities.Text = "Overworld Entity Count:"; - // + // // NUD_TrigCount - // + // this.NUD_TrigCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.NUD_TrigCount.Location = new System.Drawing.Point(422, 88); this.NUD_TrigCount.Maximum = new decimal(new int[] { @@ -390,10 +390,10 @@ private void InitializeComponent() this.NUD_TrigCount.Name = "NUD_TrigCount"; this.NUD_TrigCount.Size = new System.Drawing.Size(53, 20); this.NUD_TrigCount.TabIndex = 421; - this.NUD_TrigCount.ValueChanged += new System.EventHandler(this.changeTriggerCount); - // + this.NUD_TrigCount.ValueChanged += new System.EventHandler(this.ChangeTriggerCount); + // // L_TriggerCount - // + // this.L_TriggerCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_TriggerCount.Location = new System.Drawing.Point(350, 88); this.L_TriggerCount.Name = "L_TriggerCount"; @@ -401,9 +401,9 @@ private void InitializeComponent() this.L_TriggerCount.TabIndex = 422; this.L_TriggerCount.Text = "Trigger:"; this.L_TriggerCount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_WarpCount - // + // this.NUD_WarpCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.NUD_WarpCount.Location = new System.Drawing.Point(422, 68); this.NUD_WarpCount.Maximum = new decimal(new int[] { @@ -414,10 +414,10 @@ private void InitializeComponent() this.NUD_WarpCount.Name = "NUD_WarpCount"; this.NUD_WarpCount.Size = new System.Drawing.Size(53, 20); this.NUD_WarpCount.TabIndex = 419; - this.NUD_WarpCount.ValueChanged += new System.EventHandler(this.changeWarpCount); - // + this.NUD_WarpCount.ValueChanged += new System.EventHandler(this.ChangeWarpCount); + // // L_WarpCount - // + // this.L_WarpCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_WarpCount.Location = new System.Drawing.Point(350, 68); this.L_WarpCount.Name = "L_WarpCount"; @@ -425,9 +425,9 @@ private void InitializeComponent() this.L_WarpCount.TabIndex = 420; this.L_WarpCount.Text = "Warp:"; this.L_WarpCount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_FurnCount - // + // this.NUD_FurnCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.NUD_FurnCount.Location = new System.Drawing.Point(422, 28); this.NUD_FurnCount.Maximum = new decimal(new int[] { @@ -438,10 +438,10 @@ private void InitializeComponent() this.NUD_FurnCount.Name = "NUD_FurnCount"; this.NUD_FurnCount.Size = new System.Drawing.Size(53, 20); this.NUD_FurnCount.TabIndex = 417; - this.NUD_FurnCount.ValueChanged += new System.EventHandler(this.changeFurnitureCount); - // + this.NUD_FurnCount.ValueChanged += new System.EventHandler(this.ChangeFurnitureCount); + // // L_FurnitureCount - // + // this.L_FurnitureCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_FurnitureCount.Location = new System.Drawing.Point(350, 28); this.L_FurnitureCount.Name = "L_FurnitureCount"; @@ -449,11 +449,11 @@ private void InitializeComponent() this.L_FurnitureCount.TabIndex = 418; this.L_FurnitureCount.Text = "Furniture:"; this.L_FurnitureCount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // tc_OWSC - // - this.tc_OWSC.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.tc_OWSC.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tc_OWSC.Controls.Add(this.tb_Furniture); this.tc_OWSC.Controls.Add(this.tb_NPC); @@ -466,9 +466,9 @@ private void InitializeComponent() this.tc_OWSC.SelectedIndex = 0; this.tc_OWSC.Size = new System.Drawing.Size(345, 462); this.tc_OWSC.TabIndex = 415; - // + // // tb_Furniture - // + // this.tb_Furniture.Controls.Add(this.GB_F); this.tb_Furniture.Controls.Add(this.NUD_FE); this.tb_Furniture.Controls.Add(this.L_FE); @@ -479,9 +479,9 @@ private void InitializeComponent() this.tb_Furniture.TabIndex = 0; this.tb_Furniture.Text = "Furniture"; this.tb_Furniture.UseVisualStyleBackColor = true; - // + // // GB_F - // + // this.GB_F.Controls.Add(this.B_ResetFurniture); this.GB_F.Controls.Add(this.NUD_FWY); this.GB_F.Controls.Add(this.L_FWY); @@ -498,9 +498,9 @@ private void InitializeComponent() this.GB_F.TabIndex = 437; this.GB_F.TabStop = false; this.GB_F.Text = "Info:"; - // + // // B_ResetFurniture - // + // this.B_ResetFurniture.Location = new System.Drawing.Point(257, 275); this.B_ResetFurniture.Name = "B_ResetFurniture"; this.B_ResetFurniture.Size = new System.Drawing.Size(62, 42); @@ -508,9 +508,9 @@ private void InitializeComponent() this.B_ResetFurniture.Text = "Reset\r\nFurniture"; this.B_ResetFurniture.UseVisualStyleBackColor = true; this.B_ResetFurniture.Click += new System.EventHandler(this.B_ResetFurniture_Click); - // + // // NUD_FWY - // + // this.NUD_FWY.Location = new System.Drawing.Point(125, 216); this.NUD_FWY.Maximum = new decimal(new int[] { 65535, @@ -520,18 +520,18 @@ private void InitializeComponent() this.NUD_FWY.Name = "NUD_FWY"; this.NUD_FWY.Size = new System.Drawing.Size(53, 20); this.NUD_FWY.TabIndex = 469; - // + // // L_FWY - // + // this.L_FWY.Location = new System.Drawing.Point(43, 216); this.L_FWY.Name = "L_FWY"; this.L_FWY.Size = new System.Drawing.Size(76, 16); this.L_FWY.TabIndex = 468; this.L_FWY.Text = "FwY:"; this.L_FWY.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_FWX - // + // this.NUD_FWX.Location = new System.Drawing.Point(125, 190); this.NUD_FWX.Maximum = new decimal(new int[] { 65535, @@ -541,18 +541,18 @@ private void InitializeComponent() this.NUD_FWX.Name = "NUD_FWX"; this.NUD_FWX.Size = new System.Drawing.Size(53, 20); this.NUD_FWX.TabIndex = 467; - // + // // L_FWX - // + // this.L_FWX.Location = new System.Drawing.Point(43, 190); this.L_FWX.Name = "L_FWX"; this.L_FWX.Size = new System.Drawing.Size(76, 16); this.L_FWX.TabIndex = 466; this.L_FWX.Text = "FwX:"; this.L_FWX.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_FY - // + // this.NUD_FY.Location = new System.Drawing.Point(125, 164); this.NUD_FY.Maximum = new decimal(new int[] { 65535, @@ -562,18 +562,18 @@ private void InitializeComponent() this.NUD_FY.Name = "NUD_FY"; this.NUD_FY.Size = new System.Drawing.Size(53, 20); this.NUD_FY.TabIndex = 463; - // + // // L_FY - // + // this.L_FY.Location = new System.Drawing.Point(43, 164); this.L_FY.Name = "L_FY"; this.L_FY.Size = new System.Drawing.Size(76, 16); this.L_FY.TabIndex = 462; this.L_FY.Text = "Y Coordinate:"; this.L_FY.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_FX - // + // this.NUD_FX.Location = new System.Drawing.Point(125, 138); this.NUD_FX.Maximum = new decimal(new int[] { 65535, @@ -583,18 +583,18 @@ private void InitializeComponent() this.NUD_FX.Name = "NUD_FX"; this.NUD_FX.Size = new System.Drawing.Size(53, 20); this.NUD_FX.TabIndex = 461; - // + // // L_FX - // + // this.L_FX.Location = new System.Drawing.Point(43, 138); this.L_FX.Name = "L_FX"; this.L_FX.Size = new System.Drawing.Size(76, 16); this.L_FX.TabIndex = 460; this.L_FX.Text = "X Coordinate:"; this.L_FX.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB_F - // + // this.RTB_F.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_F.Location = new System.Drawing.Point(6, 275); this.RTB_F.Name = "RTB_F"; @@ -603,10 +603,10 @@ private void InitializeComponent() this.RTB_F.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA " + "BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF "; this.RTB_F.Visible = false; - this.RTB_F.TextChanged += new System.EventHandler(this.changeRAW_F); - // + this.RTB_F.TextChanged += new System.EventHandler(this.ChangeRAW_F); + // // NUD_FE - // + // this.NUD_FE.Location = new System.Drawing.Point(75, 11); this.NUD_FE.Maximum = new decimal(new int[] { 255, @@ -616,19 +616,19 @@ private void InitializeComponent() this.NUD_FE.Name = "NUD_FE"; this.NUD_FE.Size = new System.Drawing.Size(53, 20); this.NUD_FE.TabIndex = 423; - this.NUD_FE.ValueChanged += new System.EventHandler(this.changeFurniture); - // + this.NUD_FE.ValueChanged += new System.EventHandler(this.ChangeFurniture); + // // L_FE - // + // this.L_FE.Location = new System.Drawing.Point(3, 11); this.L_FE.Name = "L_FE"; this.L_FE.Size = new System.Drawing.Size(66, 15); this.L_FE.TabIndex = 424; this.L_FE.Text = "Entry:"; this.L_FE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // tb_NPC - // + // this.tb_NPC.Controls.Add(this.GB_N); this.tb_NPC.Controls.Add(this.NUD_NE); this.tb_NPC.Controls.Add(this.L_NE); @@ -639,9 +639,9 @@ private void InitializeComponent() this.tb_NPC.TabIndex = 1; this.tb_NPC.Text = "NPC"; this.tb_NPC.UseVisualStyleBackColor = true; - // + // // GB_N - // + // this.GB_N.Controls.Add(this.B_ResetNPC); this.GB_N.Controls.Add(this.NUD_NMove2); this.GB_N.Controls.Add(this.L_Move2); @@ -675,9 +675,9 @@ private void InitializeComponent() this.GB_N.TabIndex = 436; this.GB_N.TabStop = false; this.GB_N.Text = "Info:"; - // + // // B_ResetNPC - // + // this.B_ResetNPC.Location = new System.Drawing.Point(257, 275); this.B_ResetNPC.Name = "B_ResetNPC"; this.B_ResetNPC.Size = new System.Drawing.Size(62, 42); @@ -685,9 +685,9 @@ private void InitializeComponent() this.B_ResetNPC.Text = "Reset\r\nNPC"; this.B_ResetNPC.UseVisualStyleBackColor = true; this.B_ResetNPC.Click += new System.EventHandler(this.B_ResetNPC_Click); - // + // // NUD_NMove2 - // + // this.NUD_NMove2.Location = new System.Drawing.Point(234, 146); this.NUD_NMove2.Maximum = new decimal(new int[] { 65535, @@ -697,18 +697,18 @@ private void InitializeComponent() this.NUD_NMove2.Name = "NUD_NMove2"; this.NUD_NMove2.Size = new System.Drawing.Size(53, 20); this.NUD_NMove2.TabIndex = 457; - // + // // L_Move2 - // + // this.L_Move2.Location = new System.Drawing.Point(152, 146); this.L_Move2.Name = "L_Move2"; this.L_Move2.Size = new System.Drawing.Size(76, 16); this.L_Move2.TabIndex = 456; this.L_Move2.Text = "Move2:"; this.L_Move2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_NMove1 - // + // this.NUD_NMove1.Location = new System.Drawing.Point(234, 120); this.NUD_NMove1.Maximum = new decimal(new int[] { 65535, @@ -718,52 +718,52 @@ private void InitializeComponent() this.NUD_NMove1.Name = "NUD_NMove1"; this.NUD_NMove1.Size = new System.Drawing.Size(53, 20); this.NUD_NMove1.TabIndex = 455; - // + // // L_Move1 - // + // this.L_Move1.Location = new System.Drawing.Point(152, 120); this.L_Move1.Name = "L_Move1"; this.L_Move1.Size = new System.Drawing.Size(76, 16); this.L_Move1.TabIndex = 454; this.L_Move1.Text = "Move1:"; this.L_Move1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // TB_Leash - // + // this.TB_Leash.Location = new System.Drawing.Point(93, 250); this.TB_Leash.Name = "TB_Leash"; this.TB_Leash.ReadOnly = true; this.TB_Leash.Size = new System.Drawing.Size(158, 20); this.TB_Leash.TabIndex = 453; - // + // // L_LeashInfo - // + // this.L_LeashInfo.Location = new System.Drawing.Point(11, 251); this.L_LeashInfo.Name = "L_LeashInfo"; this.L_LeashInfo.Size = new System.Drawing.Size(76, 16); this.L_LeashInfo.TabIndex = 452; this.L_LeashInfo.Text = "Leash Info:"; this.L_LeashInfo.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_NDeg - // + // this.L_NDeg.Location = new System.Drawing.Point(11, 225); this.L_NDeg.Name = "L_NDeg"; this.L_NDeg.Size = new System.Drawing.Size(76, 16); this.L_NDeg.TabIndex = 451; this.L_NDeg.Text = "Degrees (?):"; this.L_NDeg.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // TB_NDeg - // + // this.TB_NDeg.Location = new System.Drawing.Point(93, 224); this.TB_NDeg.Name = "TB_NDeg"; this.TB_NDeg.ReadOnly = true; this.TB_NDeg.Size = new System.Drawing.Size(53, 20); this.TB_NDeg.TabIndex = 437; - // + // // NUD_NRange - // + // this.NUD_NRange.Location = new System.Drawing.Point(93, 146); this.NUD_NRange.Maximum = new decimal(new int[] { 65535, @@ -773,18 +773,18 @@ private void InitializeComponent() this.NUD_NRange.Name = "NUD_NRange"; this.NUD_NRange.Size = new System.Drawing.Size(53, 20); this.NUD_NRange.TabIndex = 450; - // + // // L_Range - // + // this.L_Range.Location = new System.Drawing.Point(11, 146); this.L_Range.Name = "L_Range"; this.L_Range.Size = new System.Drawing.Size(76, 16); this.L_Range.TabIndex = 449; this.L_Range.Text = "Sight Range:"; this.L_Range.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_ModelAsHex - // + // this.L_ModelAsHex.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_ModelAsHex.AutoSize = true; this.L_ModelAsHex.Location = new System.Drawing.Point(152, 44); @@ -792,9 +792,9 @@ private void InitializeComponent() this.L_ModelAsHex.Size = new System.Drawing.Size(29, 13); this.L_ModelAsHex.TabIndex = 448; this.L_ModelAsHex.Text = "HEX"; - // + // // NUD_NFlag - // + // this.NUD_NFlag.Location = new System.Drawing.Point(93, 68); this.NUD_NFlag.Maximum = new decimal(new int[] { 65535, @@ -804,18 +804,18 @@ private void InitializeComponent() this.NUD_NFlag.Name = "NUD_NFlag"; this.NUD_NFlag.Size = new System.Drawing.Size(53, 20); this.NUD_NFlag.TabIndex = 447; - // + // // L_NFlag - // + // this.L_NFlag.Location = new System.Drawing.Point(11, 68); this.L_NFlag.Name = "L_NFlag"; this.L_NFlag.Size = new System.Drawing.Size(76, 16); this.L_NFlag.TabIndex = 446; this.L_NFlag.Text = "Spawn Flag:"; this.L_NFlag.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_NScript - // + // this.NUD_NScript.Location = new System.Drawing.Point(93, 94); this.NUD_NScript.Maximum = new decimal(new int[] { 65535, @@ -825,18 +825,18 @@ private void InitializeComponent() this.NUD_NScript.Name = "NUD_NScript"; this.NUD_NScript.Size = new System.Drawing.Size(53, 20); this.NUD_NScript.TabIndex = 445; - // + // // L_NScript - // + // this.L_NScript.Location = new System.Drawing.Point(11, 94); this.L_NScript.Name = "L_NScript"; this.L_NScript.Size = new System.Drawing.Size(76, 16); this.L_NScript.TabIndex = 444; this.L_NScript.Text = "Script:"; this.L_NScript.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_NFace - // + // this.NUD_NFace.Location = new System.Drawing.Point(93, 120); this.NUD_NFace.Maximum = new decimal(new int[] { 65535, @@ -846,18 +846,18 @@ private void InitializeComponent() this.NUD_NFace.Name = "NUD_NFace"; this.NUD_NFace.Size = new System.Drawing.Size(53, 20); this.NUD_NFace.TabIndex = 443; - // + // // L_NFaceDirection - // + // this.L_NFaceDirection.Location = new System.Drawing.Point(11, 120); this.L_NFaceDirection.Name = "L_NFaceDirection"; this.L_NFaceDirection.Size = new System.Drawing.Size(76, 16); this.L_NFaceDirection.TabIndex = 442; this.L_NFaceDirection.Text = "Facing:"; this.L_NFaceDirection.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_NY - // + // this.NUD_NY.Location = new System.Drawing.Point(93, 198); this.NUD_NY.Maximum = new decimal(new int[] { 65535, @@ -867,18 +867,18 @@ private void InitializeComponent() this.NUD_NY.Name = "NUD_NY"; this.NUD_NY.Size = new System.Drawing.Size(53, 20); this.NUD_NY.TabIndex = 441; - // + // // L_NY - // + // this.L_NY.Location = new System.Drawing.Point(11, 198); this.L_NY.Name = "L_NY"; this.L_NY.Size = new System.Drawing.Size(76, 16); this.L_NY.TabIndex = 440; this.L_NY.Text = "Y Coordinate:"; this.L_NY.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_NX - // + // this.NUD_NX.Location = new System.Drawing.Point(93, 172); this.NUD_NX.Maximum = new decimal(new int[] { 65535, @@ -888,18 +888,18 @@ private void InitializeComponent() this.NUD_NX.Name = "NUD_NX"; this.NUD_NX.Size = new System.Drawing.Size(53, 20); this.NUD_NX.TabIndex = 439; - // + // // L_NX - // + // this.L_NX.Location = new System.Drawing.Point(11, 172); this.L_NX.Name = "L_NX"; this.L_NX.Size = new System.Drawing.Size(76, 16); this.L_NX.TabIndex = 438; this.L_NX.Text = "X Coordinate:"; this.L_NX.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_NModel - // + // this.NUD_NModel.Location = new System.Drawing.Point(93, 42); this.NUD_NModel.Maximum = new decimal(new int[] { 65535, @@ -909,19 +909,19 @@ private void InitializeComponent() this.NUD_NModel.Name = "NUD_NModel"; this.NUD_NModel.Size = new System.Drawing.Size(53, 20); this.NUD_NModel.TabIndex = 437; - this.NUD_NModel.ValueChanged += new System.EventHandler(this.changeNPC_Model); - // + this.NUD_NModel.ValueChanged += new System.EventHandler(this.ChangeNPC_Model); + // // L_NModel - // + // this.L_NModel.Location = new System.Drawing.Point(11, 42); this.L_NModel.Name = "L_NModel"; this.L_NModel.Size = new System.Drawing.Size(76, 16); this.L_NModel.TabIndex = 436; this.L_NModel.Text = "Model:"; this.L_NModel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB_N - // + // this.RTB_N.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.RTB_N.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_N.Location = new System.Drawing.Point(6, 275); @@ -931,10 +931,10 @@ private void InitializeComponent() this.RTB_N.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA " + "BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF "; this.RTB_N.Visible = false; - this.RTB_N.TextChanged += new System.EventHandler(this.changeRAW_N); - // + this.RTB_N.TextChanged += new System.EventHandler(this.ChangeRAW_N); + // // NUD_NID - // + // this.NUD_NID.Location = new System.Drawing.Point(93, 16); this.NUD_NID.Maximum = new decimal(new int[] { 65535, @@ -944,19 +944,19 @@ private void InitializeComponent() this.NUD_NID.Name = "NUD_NID"; this.NUD_NID.Size = new System.Drawing.Size(53, 20); this.NUD_NID.TabIndex = 435; - this.NUD_NID.ValueChanged += new System.EventHandler(this.changeNPC_ID); - // + this.NUD_NID.ValueChanged += new System.EventHandler(this.ChangeNPC_ID); + // // L_NID - // + // this.L_NID.Location = new System.Drawing.Point(11, 16); this.L_NID.Name = "L_NID"; this.L_NID.Size = new System.Drawing.Size(76, 16); this.L_NID.TabIndex = 433; this.L_NID.Text = "Entity ID:"; this.L_NID.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_NE - // + // this.NUD_NE.Location = new System.Drawing.Point(75, 11); this.NUD_NE.Maximum = new decimal(new int[] { 255, @@ -966,19 +966,19 @@ private void InitializeComponent() this.NUD_NE.Name = "NUD_NE"; this.NUD_NE.Size = new System.Drawing.Size(53, 20); this.NUD_NE.TabIndex = 425; - this.NUD_NE.ValueChanged += new System.EventHandler(this.changeNPC); - // + this.NUD_NE.ValueChanged += new System.EventHandler(this.ChangeNPC); + // // L_NE - // + // this.L_NE.Location = new System.Drawing.Point(3, 11); this.L_NE.Name = "L_NE"; this.L_NE.Size = new System.Drawing.Size(66, 15); this.L_NE.TabIndex = 426; this.L_NE.Text = "Entry:"; this.L_NE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // tb_Warp - // + // this.tb_Warp.Controls.Add(this.GB_W); this.tb_Warp.Controls.Add(this.NUD_WE); this.tb_Warp.Controls.Add(this.L_WE); @@ -988,9 +988,9 @@ private void InitializeComponent() this.tb_Warp.TabIndex = 2; this.tb_Warp.Text = "Warp"; this.tb_Warp.UseVisualStyleBackColor = true; - // + // // GB_W - // + // this.GB_W.Controls.Add(this.B_ResetWarp); this.GB_W.Controls.Add(this.L_WpY); this.GB_W.Controls.Add(this.L_WpX); @@ -1010,9 +1010,9 @@ private void InitializeComponent() this.GB_W.TabIndex = 438; this.GB_W.TabStop = false; this.GB_W.Text = "Info:"; - // + // // B_ResetWarp - // + // this.B_ResetWarp.Location = new System.Drawing.Point(256, 275); this.B_ResetWarp.Name = "B_ResetWarp"; this.B_ResetWarp.Size = new System.Drawing.Size(62, 42); @@ -1020,9 +1020,9 @@ private void InitializeComponent() this.B_ResetWarp.Text = "Reset\r\nWarp"; this.B_ResetWarp.UseVisualStyleBackColor = true; this.B_ResetWarp.Click += new System.EventHandler(this.B_ResetWarp_Click); - // + // // L_WpY - // + // this.L_WpY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_WpY.AutoSize = true; this.L_WpY.Location = new System.Drawing.Point(253, 191); @@ -1030,9 +1030,9 @@ private void InitializeComponent() this.L_WpY.Size = new System.Drawing.Size(31, 13); this.L_WpY.TabIndex = 465; this.L_WpY.Text = "#/18"; - // + // // L_WpX - // + // this.L_WpX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_WpX.AutoSize = true; this.L_WpX.Location = new System.Drawing.Point(253, 165); @@ -1040,9 +1040,9 @@ private void InitializeComponent() this.L_WpX.Size = new System.Drawing.Size(31, 13); this.L_WpX.TabIndex = 464; this.L_WpX.Text = "#/18"; - // + // // NUD_WY - // + // this.NUD_WY.Increment = new decimal(new int[] { 18, 0, @@ -1057,19 +1057,19 @@ private void InitializeComponent() this.NUD_WY.Name = "NUD_WY"; this.NUD_WY.Size = new System.Drawing.Size(53, 20); this.NUD_WY.TabIndex = 463; - this.NUD_WY.ValueChanged += new System.EventHandler(this.changeWarp_Y); - // + this.NUD_WY.ValueChanged += new System.EventHandler(this.ChangeWarp_Y); + // // L_WY - // + // this.L_WY.Location = new System.Drawing.Point(43, 189); this.L_WY.Name = "L_WY"; this.L_WY.Size = new System.Drawing.Size(76, 16); this.L_WY.TabIndex = 462; this.L_WY.Text = "Y Coordinate:"; this.L_WY.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_WX - // + // this.NUD_WX.Increment = new decimal(new int[] { 18, 0, @@ -1084,19 +1084,19 @@ private void InitializeComponent() this.NUD_WX.Name = "NUD_WX"; this.NUD_WX.Size = new System.Drawing.Size(53, 20); this.NUD_WX.TabIndex = 461; - this.NUD_WX.ValueChanged += new System.EventHandler(this.changeWarp_X); - // + this.NUD_WX.ValueChanged += new System.EventHandler(this.ChangeWarp_X); + // // L_WX - // + // this.L_WX.Location = new System.Drawing.Point(43, 163); this.L_WX.Name = "L_WX"; this.L_WX.Size = new System.Drawing.Size(76, 16); this.L_WX.TabIndex = 460; this.L_WX.Text = "X Coordinate:"; this.L_WX.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB_W - // + // this.RTB_W.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_W.Location = new System.Drawing.Point(6, 275); this.RTB_W.Name = "RTB_W"; @@ -1105,29 +1105,29 @@ private void InitializeComponent() this.RTB_W.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA " + "BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF "; this.RTB_W.Visible = false; - this.RTB_W.TextChanged += new System.EventHandler(this.changeRAW_W); - // + this.RTB_W.TextChanged += new System.EventHandler(this.ChangeRAW_W); + // // L_WarpDest - // + // this.L_WarpDest.Location = new System.Drawing.Point(58, 31); this.L_WarpDest.Name = "L_WarpDest"; this.L_WarpDest.Size = new System.Drawing.Size(120, 15); this.L_WarpDest.TabIndex = 432; this.L_WarpDest.Text = "Dest:"; this.L_WarpDest.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.L_WarpDest.DoubleClick += new System.EventHandler(this.dclickDestMap); - // + this.L_WarpDest.DoubleClick += new System.EventHandler(this.DclickDestMap); + // // L_DestMap - // + // this.L_DestMap.Location = new System.Drawing.Point(-1, 50); this.L_DestMap.Name = "L_DestMap"; this.L_DestMap.Size = new System.Drawing.Size(120, 15); this.L_DestMap.TabIndex = 428; this.L_DestMap.Text = "Destination Map:"; this.L_DestMap.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_WTile - // + // this.NUD_WTile.Location = new System.Drawing.Point(125, 70); this.NUD_WTile.Maximum = new decimal(new int[] { 255, @@ -1137,18 +1137,18 @@ private void InitializeComponent() this.NUD_WTile.Name = "NUD_WTile"; this.NUD_WTile.Size = new System.Drawing.Size(53, 20); this.NUD_WTile.TabIndex = 431; - // + // // L_DestWarpTile - // + // this.L_DestWarpTile.Location = new System.Drawing.Point(-1, 71); this.L_DestWarpTile.Name = "L_DestWarpTile"; this.L_DestWarpTile.Size = new System.Drawing.Size(120, 15); this.L_DestWarpTile.TabIndex = 429; this.L_DestWarpTile.Text = "Destination WarpTile:"; this.L_DestWarpTile.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_WMap - // + // this.NUD_WMap.Location = new System.Drawing.Point(125, 49); this.NUD_WMap.Maximum = new decimal(new int[] { 999, @@ -1158,9 +1158,9 @@ private void InitializeComponent() this.NUD_WMap.Name = "NUD_WMap"; this.NUD_WMap.Size = new System.Drawing.Size(53, 20); this.NUD_WMap.TabIndex = 430; - // + // // NUD_WE - // + // this.NUD_WE.Location = new System.Drawing.Point(75, 11); this.NUD_WE.Maximum = new decimal(new int[] { 255, @@ -1170,19 +1170,19 @@ private void InitializeComponent() this.NUD_WE.Name = "NUD_WE"; this.NUD_WE.Size = new System.Drawing.Size(53, 20); this.NUD_WE.TabIndex = 425; - this.NUD_WE.ValueChanged += new System.EventHandler(this.changeWarp); - // + this.NUD_WE.ValueChanged += new System.EventHandler(this.ChangeWarp); + // // L_WE - // + // this.L_WE.Location = new System.Drawing.Point(3, 11); this.L_WE.Name = "L_WE"; this.L_WE.Size = new System.Drawing.Size(66, 15); this.L_WE.TabIndex = 426; this.L_WE.Text = "Entry:"; this.L_WE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // tb_Trigger1 - // + // this.tb_Trigger1.Controls.Add(this.GB_T1); this.tb_Trigger1.Controls.Add(this.NUD_TE); this.tb_Trigger1.Controls.Add(this.L_TE); @@ -1192,9 +1192,9 @@ private void InitializeComponent() this.tb_Trigger1.TabIndex = 3; this.tb_Trigger1.Text = "Trigger1"; this.tb_Trigger1.UseVisualStyleBackColor = true; - // + // // GB_T1 - // + // this.GB_T1.Controls.Add(this.B_ResetTrigger1); this.GB_T1.Controls.Add(this.NUD_T1Y); this.GB_T1.Controls.Add(this.L_T1Y); @@ -1207,9 +1207,9 @@ private void InitializeComponent() this.GB_T1.TabIndex = 439; this.GB_T1.TabStop = false; this.GB_T1.Text = "Info:"; - // + // // B_ResetTrigger1 - // + // this.B_ResetTrigger1.Location = new System.Drawing.Point(257, 275); this.B_ResetTrigger1.Name = "B_ResetTrigger1"; this.B_ResetTrigger1.Size = new System.Drawing.Size(62, 42); @@ -1217,9 +1217,9 @@ private void InitializeComponent() this.B_ResetTrigger1.Text = "Reset\r\nTrigger1"; this.B_ResetTrigger1.UseVisualStyleBackColor = true; this.B_ResetTrigger1.Click += new System.EventHandler(this.B_ResetTrigger1_Click); - // + // // NUD_T1Y - // + // this.NUD_T1Y.Location = new System.Drawing.Point(143, 164); this.NUD_T1Y.Maximum = new decimal(new int[] { 65535, @@ -1229,18 +1229,18 @@ private void InitializeComponent() this.NUD_T1Y.Name = "NUD_T1Y"; this.NUD_T1Y.Size = new System.Drawing.Size(53, 20); this.NUD_T1Y.TabIndex = 445; - // + // // L_T1Y - // + // this.L_T1Y.Location = new System.Drawing.Point(61, 164); this.L_T1Y.Name = "L_T1Y"; this.L_T1Y.Size = new System.Drawing.Size(76, 16); this.L_T1Y.TabIndex = 444; this.L_T1Y.Text = "Y Coordinate:"; this.L_T1Y.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_T1X - // + // this.NUD_T1X.Location = new System.Drawing.Point(143, 138); this.NUD_T1X.Maximum = new decimal(new int[] { 65535, @@ -1250,18 +1250,18 @@ private void InitializeComponent() this.NUD_T1X.Name = "NUD_T1X"; this.NUD_T1X.Size = new System.Drawing.Size(53, 20); this.NUD_T1X.TabIndex = 443; - // + // // L_T1X - // + // this.L_T1X.Location = new System.Drawing.Point(61, 138); this.L_T1X.Name = "L_T1X"; this.L_T1X.Size = new System.Drawing.Size(76, 16); this.L_T1X.TabIndex = 442; this.L_T1X.Text = "X Coordinate:"; this.L_T1X.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB_T1 - // + // this.RTB_T1.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_T1.Location = new System.Drawing.Point(6, 275); this.RTB_T1.Name = "RTB_T1"; @@ -1270,10 +1270,10 @@ private void InitializeComponent() this.RTB_T1.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA " + "BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF "; this.RTB_T1.Visible = false; - this.RTB_T1.TextChanged += new System.EventHandler(this.changeRAW_T1); - // + this.RTB_T1.TextChanged += new System.EventHandler(this.ChangeRAW_T1); + // // NUD_TE - // + // this.NUD_TE.Location = new System.Drawing.Point(75, 11); this.NUD_TE.Maximum = new decimal(new int[] { 255, @@ -1283,19 +1283,19 @@ private void InitializeComponent() this.NUD_TE.Name = "NUD_TE"; this.NUD_TE.Size = new System.Drawing.Size(53, 20); this.NUD_TE.TabIndex = 425; - this.NUD_TE.ValueChanged += new System.EventHandler(this.changeTrigger1); - // + this.NUD_TE.ValueChanged += new System.EventHandler(this.ChangeTrigger1); + // // L_TE - // + // this.L_TE.Location = new System.Drawing.Point(3, 11); this.L_TE.Name = "L_TE"; this.L_TE.Size = new System.Drawing.Size(66, 15); this.L_TE.TabIndex = 426; this.L_TE.Text = "Entry:"; this.L_TE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // tb_Trigger2 - // + // this.tb_Trigger2.Controls.Add(this.GB_T2); this.tb_Trigger2.Controls.Add(this.NUD_UE); this.tb_Trigger2.Controls.Add(this.L_UE); @@ -1306,9 +1306,9 @@ private void InitializeComponent() this.tb_Trigger2.TabIndex = 5; this.tb_Trigger2.Text = "Trigger2"; this.tb_Trigger2.UseVisualStyleBackColor = true; - // + // // GB_T2 - // + // this.GB_T2.Controls.Add(this.B_ResetTrigger2); this.GB_T2.Controls.Add(this.NUD_T2Y); this.GB_T2.Controls.Add(this.L_T2Y); @@ -1321,9 +1321,9 @@ private void InitializeComponent() this.GB_T2.TabIndex = 440; this.GB_T2.TabStop = false; this.GB_T2.Text = "Info:"; - // + // // B_ResetTrigger2 - // + // this.B_ResetTrigger2.Location = new System.Drawing.Point(257, 275); this.B_ResetTrigger2.Name = "B_ResetTrigger2"; this.B_ResetTrigger2.Size = new System.Drawing.Size(62, 42); @@ -1331,9 +1331,9 @@ private void InitializeComponent() this.B_ResetTrigger2.Text = "Reset\r\nTrigger2"; this.B_ResetTrigger2.UseVisualStyleBackColor = true; this.B_ResetTrigger2.Click += new System.EventHandler(this.B_ResetTrigger2_Click); - // + // // NUD_T2Y - // + // this.NUD_T2Y.Location = new System.Drawing.Point(143, 164); this.NUD_T2Y.Maximum = new decimal(new int[] { 65535, @@ -1343,18 +1343,18 @@ private void InitializeComponent() this.NUD_T2Y.Name = "NUD_T2Y"; this.NUD_T2Y.Size = new System.Drawing.Size(53, 20); this.NUD_T2Y.TabIndex = 445; - // + // // L_T2Y - // + // this.L_T2Y.Location = new System.Drawing.Point(61, 164); this.L_T2Y.Name = "L_T2Y"; this.L_T2Y.Size = new System.Drawing.Size(76, 16); this.L_T2Y.TabIndex = 444; this.L_T2Y.Text = "Y Coordinate:"; this.L_T2Y.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_T2X - // + // this.NUD_T2X.Location = new System.Drawing.Point(143, 138); this.NUD_T2X.Maximum = new decimal(new int[] { 65535, @@ -1364,18 +1364,18 @@ private void InitializeComponent() this.NUD_T2X.Name = "NUD_T2X"; this.NUD_T2X.Size = new System.Drawing.Size(53, 20); this.NUD_T2X.TabIndex = 443; - // + // // L_T2X - // + // this.L_T2X.Location = new System.Drawing.Point(61, 138); this.L_T2X.Name = "L_T2X"; this.L_T2X.Size = new System.Drawing.Size(76, 16); this.L_T2X.TabIndex = 442; this.L_T2X.Text = "X Coordinate:"; this.L_T2X.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB_T2 - // + // this.RTB_T2.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_T2.Location = new System.Drawing.Point(6, 275); this.RTB_T2.Name = "RTB_T2"; @@ -1384,10 +1384,10 @@ private void InitializeComponent() this.RTB_T2.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA " + "BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF "; this.RTB_T2.Visible = false; - this.RTB_T2.TextChanged += new System.EventHandler(this.changeRAW_T2); - // + this.RTB_T2.TextChanged += new System.EventHandler(this.ChangeRAW_T2); + // // NUD_UE - // + // this.NUD_UE.Location = new System.Drawing.Point(75, 11); this.NUD_UE.Maximum = new decimal(new int[] { 255, @@ -1397,19 +1397,19 @@ private void InitializeComponent() this.NUD_UE.Name = "NUD_UE"; this.NUD_UE.Size = new System.Drawing.Size(53, 20); this.NUD_UE.TabIndex = 427; - this.NUD_UE.ValueChanged += new System.EventHandler(this.changeTrigger2); - // + this.NUD_UE.ValueChanged += new System.EventHandler(this.ChangeTrigger2); + // // L_UE - // + // this.L_UE.Location = new System.Drawing.Point(3, 11); this.L_UE.Name = "L_UE"; this.L_UE.Size = new System.Drawing.Size(66, 15); this.L_UE.TabIndex = 428; this.L_UE.Text = "Entry:"; this.L_UE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // tb_Script - // + // this.tb_Script.Controls.Add(this.RTB_OSP); this.tb_Script.Controls.Add(this.RTB_OS); this.tb_Script.Controls.Add(this.L_OWSCDesc); @@ -1420,11 +1420,11 @@ private void InitializeComponent() this.tb_Script.TabIndex = 4; this.tb_Script.Text = "Script"; this.tb_Script.UseVisualStyleBackColor = true; - // + // // RTB_OSP - // - this.RTB_OSP.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.RTB_OSP.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.RTB_OSP.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_OSP.Location = new System.Drawing.Point(6, 234); @@ -1433,9 +1433,9 @@ private void InitializeComponent() this.RTB_OSP.Size = new System.Drawing.Size(331, 202); this.RTB_OSP.TabIndex = 425; this.RTB_OSP.Text = "Parse Output"; - // + // // RTB_OS - // + // this.RTB_OS.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_OS.Location = new System.Drawing.Point(97, 3); this.RTB_OS.Name = "RTB_OS"; @@ -1443,18 +1443,18 @@ private void InitializeComponent() this.RTB_OS.Size = new System.Drawing.Size(85, 225); this.RTB_OS.TabIndex = 424; this.RTB_OS.Text = "Raw Data"; - // + // // L_OWSCDesc - // + // this.L_OWSCDesc.AutoSize = true; this.L_OWSCDesc.Location = new System.Drawing.Point(188, 3); this.L_OWSCDesc.Name = "L_OWSCDesc"; this.L_OWSCDesc.Size = new System.Drawing.Size(75, 13); this.L_OWSCDesc.TabIndex = 423; this.L_OWSCDesc.Text = "Script Analysis"; - // + // // RTB_OWSCMD - // + // this.RTB_OWSCMD.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_OWSCMD.Location = new System.Drawing.Point(6, 3); this.RTB_OWSCMD.Name = "RTB_OWSCMD"; @@ -1462,9 +1462,9 @@ private void InitializeComponent() this.RTB_OWSCMD.Size = new System.Drawing.Size(85, 225); this.RTB_OWSCMD.TabIndex = 422; this.RTB_OWSCMD.Text = "Script CMDs"; - // + // // NUD_NPCCount - // + // this.NUD_NPCCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.NUD_NPCCount.Location = new System.Drawing.Point(422, 48); this.NUD_NPCCount.Maximum = new decimal(new int[] { @@ -1475,10 +1475,10 @@ private void InitializeComponent() this.NUD_NPCCount.Name = "NUD_NPCCount"; this.NUD_NPCCount.Size = new System.Drawing.Size(53, 20); this.NUD_NPCCount.TabIndex = 415; - this.NUD_NPCCount.ValueChanged += new System.EventHandler(this.changeNPCCount); - // + this.NUD_NPCCount.ValueChanged += new System.EventHandler(this.ChangeNPCCount); + // // L_NPCCount - // + // this.L_NPCCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_NPCCount.Location = new System.Drawing.Point(350, 48); this.L_NPCCount.Name = "L_NPCCount"; @@ -1486,9 +1486,9 @@ private void InitializeComponent() this.L_NPCCount.TabIndex = 416; this.L_NPCCount.Text = "NPC:"; this.L_NPCCount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // tb_MSC - // + // this.tb_MSC.Controls.Add(this.RTB_MSP); this.tb_MSC.Controls.Add(this.RTB_MSCMD); this.tb_MSC.Controls.Add(this.L_MSSCDesc); @@ -1499,11 +1499,11 @@ private void InitializeComponent() this.tb_MSC.TabIndex = 2; this.tb_MSC.Text = "Map SC"; this.tb_MSC.UseVisualStyleBackColor = true; - // + // // RTB_MSP - // - this.RTB_MSP.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.RTB_MSP.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.RTB_MSP.Font = new System.Drawing.Font("Courier New", 8.25F); this.RTB_MSP.Location = new System.Drawing.Point(3, 234); @@ -1512,9 +1512,9 @@ private void InitializeComponent() this.RTB_MSP.Size = new System.Drawing.Size(483, 237); this.RTB_MSP.TabIndex = 428; this.RTB_MSP.Text = "Parse Output"; - // + // // RTB_MSCMD - // + // this.RTB_MSCMD.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_MSCMD.Location = new System.Drawing.Point(3, 3); this.RTB_MSCMD.Name = "RTB_MSCMD"; @@ -1522,18 +1522,18 @@ private void InitializeComponent() this.RTB_MSCMD.Size = new System.Drawing.Size(85, 225); this.RTB_MSCMD.TabIndex = 427; this.RTB_MSCMD.Text = "Script CMDs"; - // + // // L_MSSCDesc - // + // this.L_MSSCDesc.AutoSize = true; this.L_MSSCDesc.Location = new System.Drawing.Point(185, 3); this.L_MSSCDesc.Name = "L_MSSCDesc"; this.L_MSSCDesc.Size = new System.Drawing.Size(75, 13); this.L_MSSCDesc.TabIndex = 426; this.L_MSSCDesc.Text = "Script Analysis"; - // + // // RTB_MS - // + // this.RTB_MS.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_MS.Location = new System.Drawing.Point(94, 3); this.RTB_MS.Name = "RTB_MS"; @@ -1541,9 +1541,9 @@ private void InitializeComponent() this.RTB_MS.Size = new System.Drawing.Size(85, 225); this.RTB_MS.TabIndex = 425; this.RTB_MS.Text = "Raw Data"; - // + // // tb_Encounters - // + // this.tb_Encounters.Controls.Add(this.L_Encounters); this.tb_Encounters.Location = new System.Drawing.Point(4, 22); this.tb_Encounters.Name = "tb_Encounters"; @@ -1551,18 +1551,18 @@ private void InitializeComponent() this.tb_Encounters.TabIndex = 3; this.tb_Encounters.Text = "Encounters"; this.tb_Encounters.UseVisualStyleBackColor = true; - // + // // L_Encounters - // + // this.L_Encounters.AutoSize = true; this.L_Encounters.Location = new System.Drawing.Point(26, 26); this.L_Encounters.Name = "L_Encounters"; this.L_Encounters.Size = new System.Drawing.Size(241, 13); this.L_Encounters.TabIndex = 0; this.L_Encounters.Text = "Encounters are handled in the regular Wild Editor."; - // + // // tb_File5 - // + // this.tb_File5.Controls.Add(this.L_File5TabData); this.tb_File5.Location = new System.Drawing.Point(4, 22); this.tb_File5.Name = "tb_File5"; @@ -1570,18 +1570,18 @@ private void InitializeComponent() this.tb_File5.TabIndex = 4; this.tb_File5.Text = "File 5"; this.tb_File5.UseVisualStyleBackColor = true; - // + // // L_File5TabData - // + // this.L_File5TabData.AutoSize = true; this.L_File5TabData.Location = new System.Drawing.Point(26, 26); this.L_File5TabData.Name = "L_File5TabData"; this.L_File5TabData.Size = new System.Drawing.Size(227, 13); this.L_File5TabData.TabIndex = 1; this.L_File5TabData.Text = "Functionality unknown. See RAW tab for data."; - // + // // tb_RAW - // + // this.tb_RAW.Controls.Add(this.L_ZD); this.tb_RAW.Controls.Add(this.L_File3); this.tb_RAW.Controls.Add(this.L_ZDMaster); @@ -1601,9 +1601,9 @@ private void InitializeComponent() this.tb_RAW.TabIndex = 5; this.tb_RAW.Text = "RAW"; this.tb_RAW.UseVisualStyleBackColor = true; - // + // // L_ZD - // + // this.L_ZD.AutoSize = true; this.L_ZD.Font = new System.Drawing.Font("Courier New", 8.25F); this.L_ZD.Location = new System.Drawing.Point(140, 346); @@ -1611,63 +1611,63 @@ private void InitializeComponent() this.L_ZD.Size = new System.Drawing.Size(35, 28); this.L_ZD.TabIndex = 430; this.L_ZD.Text = "X: ~\r\nY: ~"; - // + // // L_File3 - // + // this.L_File3.Location = new System.Drawing.Point(70, 83); this.L_File3.Name = "L_File3"; this.L_File3.Size = new System.Drawing.Size(141, 23); this.L_File3.TabIndex = 429; this.L_File3.Text = "Map Environment [3]:"; this.L_File3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_ZDMaster - // + // this.L_ZDMaster.Location = new System.Drawing.Point(-4, 277); this.L_ZDMaster.Name = "L_ZDMaster"; this.L_ZDMaster.Size = new System.Drawing.Size(141, 23); this.L_ZDMaster.TabIndex = 428; this.L_ZDMaster.Text = "Master ZoneData Table:"; this.L_ZDMaster.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_File5 - // + // this.L_File5.Location = new System.Drawing.Point(70, 167); this.L_File5.Name = "L_File5"; this.L_File5.Size = new System.Drawing.Size(141, 23); this.L_File5.TabIndex = 427; this.L_File5.Text = "Unknown [5]:"; this.L_File5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_File4 - // + // this.L_File4.Location = new System.Drawing.Point(70, 125); this.L_File4.Name = "L_File4"; this.L_File4.Size = new System.Drawing.Size(141, 23); this.L_File4.TabIndex = 426; this.L_File4.Text = "Encounter Data [4]:"; this.L_File4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_File2 - // + // this.L_File2.Location = new System.Drawing.Point(70, 41); this.L_File2.Name = "L_File2"; this.L_File2.Size = new System.Drawing.Size(141, 23); this.L_File2.TabIndex = 424; this.L_File2.Text = "Overworlds [2]:"; this.L_File2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_File1 - // + // this.L_File1.Location = new System.Drawing.Point(70, -1); this.L_File1.Name = "L_File1"; this.L_File1.Size = new System.Drawing.Size(141, 23); this.L_File1.TabIndex = 423; this.L_File1.Text = "ZoneData [1]:"; this.L_File1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB_ZDMaster - // + // this.RTB_ZDMaster.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_ZDMaster.Location = new System.Drawing.Point(143, 279); this.RTB_ZDMaster.Name = "RTB_ZDMaster"; @@ -1677,9 +1677,9 @@ private void InitializeComponent() this.RTB_ZDMaster.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA " + "BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00 11 22 33 44 55" + " 66 77 88 99 AA BB CC DD EE FF"; - // + // // RTB_File5 - // + // this.RTB_File5.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_File5.Location = new System.Drawing.Point(217, 171); this.RTB_File5.Name = "RTB_File5"; @@ -1687,9 +1687,9 @@ private void InitializeComponent() this.RTB_File5.Size = new System.Drawing.Size(266, 36); this.RTB_File5.TabIndex = 421; this.RTB_File5.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF"; - // + // // RTB_OWSC - // + // this.RTB_OWSC.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_OWSC.Location = new System.Drawing.Point(217, 45); this.RTB_OWSC.Name = "RTB_OWSC"; @@ -1697,9 +1697,9 @@ private void InitializeComponent() this.RTB_OWSC.Size = new System.Drawing.Size(266, 36); this.RTB_OWSC.TabIndex = 418; this.RTB_OWSC.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF"; - // + // // RTB_Encounter - // + // this.RTB_Encounter.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_Encounter.Location = new System.Drawing.Point(217, 129); this.RTB_Encounter.Name = "RTB_Encounter"; @@ -1707,9 +1707,9 @@ private void InitializeComponent() this.RTB_Encounter.Size = new System.Drawing.Size(266, 36); this.RTB_Encounter.TabIndex = 420; this.RTB_Encounter.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF"; - // + // // RTB_MapSC - // + // this.RTB_MapSC.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_MapSC.Location = new System.Drawing.Point(217, 87); this.RTB_MapSC.Name = "RTB_MapSC"; @@ -1717,9 +1717,9 @@ private void InitializeComponent() this.RTB_MapSC.Size = new System.Drawing.Size(266, 36); this.RTB_MapSC.TabIndex = 419; this.RTB_MapSC.Text = "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF"; - // + // // tb_Dev - // + // this.tb_Dev.Controls.Add(this.B_DumpZD); this.tb_Dev.Controls.Add(this.L_DeComp); this.tb_Dev.Controls.Add(this.RTB_CompressedScript); @@ -1738,9 +1738,9 @@ private void InitializeComponent() this.tb_Dev.TabIndex = 7; this.tb_Dev.Text = "Dev"; this.tb_Dev.UseVisualStyleBackColor = true; - // + // // B_DumpZD - // + // this.B_DumpZD.Location = new System.Drawing.Point(149, 51); this.B_DumpZD.Name = "B_DumpZD"; this.B_DumpZD.Size = new System.Drawing.Size(89, 39); @@ -1748,28 +1748,28 @@ private void InitializeComponent() this.B_DumpZD.Text = "Dump all ZD"; this.B_DumpZD.UseVisualStyleBackColor = true; this.B_DumpZD.Click += new System.EventHandler(this.B_DumpZD_Click); - // + // // L_DeComp - // + // this.L_DeComp.AutoSize = true; this.L_DeComp.Location = new System.Drawing.Point(395, 224); this.L_DeComp.Name = "L_DeComp"; this.L_DeComp.Size = new System.Drawing.Size(78, 13); this.L_DeComp.TabIndex = 430; this.L_DeComp.Text = "Decompressed"; - // + // // RTB_CompressedScript - // + // this.RTB_CompressedScript.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_CompressedScript.Location = new System.Drawing.Point(304, 240); this.RTB_CompressedScript.Name = "RTB_CompressedScript"; this.RTB_CompressedScript.Size = new System.Drawing.Size(85, 225); this.RTB_CompressedScript.TabIndex = 429; this.RTB_CompressedScript.Text = "Script CMDs"; - this.RTB_CompressedScript.TextChanged += new System.EventHandler(this.pasteScript); - // + this.RTB_CompressedScript.TextChanged += new System.EventHandler(this.PasteScript); + // // RTB_DecompressedScript - // + // this.RTB_DecompressedScript.Font = new System.Drawing.Font("Courier New", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB_DecompressedScript.Location = new System.Drawing.Point(395, 240); this.RTB_DecompressedScript.Name = "RTB_DecompressedScript"; @@ -1777,18 +1777,18 @@ private void InitializeComponent() this.RTB_DecompressedScript.Size = new System.Drawing.Size(85, 225); this.RTB_DecompressedScript.TabIndex = 428; this.RTB_DecompressedScript.Text = "Raw Data"; - // + // // L_Comp - // + // this.L_Comp.AutoSize = true; this.L_Comp.Location = new System.Drawing.Point(301, 224); this.L_Comp.Name = "L_Comp"; this.L_Comp.Size = new System.Drawing.Size(65, 13); this.L_Comp.TabIndex = 426; this.L_Comp.Text = "Compressed"; - // + // // B_DumpMaps - // + // this.B_DumpMaps.Location = new System.Drawing.Point(149, 6); this.B_DumpMaps.Name = "B_DumpMaps"; this.B_DumpMaps.Size = new System.Drawing.Size(89, 39); @@ -1796,9 +1796,9 @@ private void InitializeComponent() this.B_DumpMaps.Text = "Dump all Maps"; this.B_DumpMaps.UseVisualStyleBackColor = true; this.B_DumpMaps.Click += new System.EventHandler(this.B_DumpMaps_Click); - // + // // B_DumpUnk - // + // this.B_DumpUnk.Location = new System.Drawing.Point(6, 186); this.B_DumpUnk.Name = "B_DumpUnk"; this.B_DumpUnk.Size = new System.Drawing.Size(89, 39); @@ -1806,9 +1806,9 @@ private void InitializeComponent() this.B_DumpUnk.Text = "Dump all\r\nUnk"; this.B_DumpUnk.UseVisualStyleBackColor = true; this.B_DumpUnk.Click += new System.EventHandler(this.B_DumpUnk_Click); - // + // // B_DumpTrigger - // + // this.B_DumpTrigger.Location = new System.Drawing.Point(6, 141); this.B_DumpTrigger.Name = "B_DumpTrigger"; this.B_DumpTrigger.Size = new System.Drawing.Size(89, 39); @@ -1816,9 +1816,9 @@ private void InitializeComponent() this.B_DumpTrigger.Text = "Dump all\r\nTriggers"; this.B_DumpTrigger.UseVisualStyleBackColor = true; this.B_DumpTrigger.Click += new System.EventHandler(this.B_DumpTrigger_Click); - // + // // B_DumpWarp - // + // this.B_DumpWarp.Location = new System.Drawing.Point(6, 96); this.B_DumpWarp.Name = "B_DumpWarp"; this.B_DumpWarp.Size = new System.Drawing.Size(89, 39); @@ -1826,9 +1826,9 @@ private void InitializeComponent() this.B_DumpWarp.Text = "Dump all\r\nWarp Bytes"; this.B_DumpWarp.UseVisualStyleBackColor = true; this.B_DumpWarp.Click += new System.EventHandler(this.B_DumpWarp_Click); - // + // // B_DumpNPC - // + // this.B_DumpNPC.Location = new System.Drawing.Point(6, 51); this.B_DumpNPC.Name = "B_DumpNPC"; this.B_DumpNPC.Size = new System.Drawing.Size(89, 39); @@ -1836,9 +1836,9 @@ private void InitializeComponent() this.B_DumpNPC.Text = "Dump all\r\nNPC Bytes"; this.B_DumpNPC.UseVisualStyleBackColor = true; this.B_DumpNPC.Click += new System.EventHandler(this.B_DumpNPC_Click); - // + // // B_DumpFurniture - // + // this.B_DumpFurniture.Location = new System.Drawing.Point(6, 6); this.B_DumpFurniture.Name = "B_DumpFurniture"; this.B_DumpFurniture.Size = new System.Drawing.Size(89, 39); @@ -1846,9 +1846,9 @@ private void InitializeComponent() this.B_DumpFurniture.Text = "Dump all\r\nFurniture Bytes"; this.B_DumpFurniture.UseVisualStyleBackColor = true; this.B_DumpFurniture.Click += new System.EventHandler(this.B_DumpFurniture_Click); - // + // // B_Map - // + // this.B_Map.Location = new System.Drawing.Point(318, 5); this.B_Map.Name = "B_Map"; this.B_Map.Size = new System.Drawing.Size(89, 23); @@ -1856,18 +1856,18 @@ private void InitializeComponent() this.B_Map.Text = "Show Map"; this.B_Map.UseVisualStyleBackColor = true; this.B_Map.Click += new System.EventHandler(this.B_Map_Click); - // + // // L_ZDPreview - // + // this.L_ZDPreview.AutoSize = true; this.L_ZDPreview.Location = new System.Drawing.Point(216, 3); this.L_ZDPreview.Name = "L_ZDPreview"; this.L_ZDPreview.Size = new System.Drawing.Size(50, 26); this.L_ZDPreview.TabIndex = 418; this.L_ZDPreview.Text = "Text File:\r\nMap File:"; - // + // // B_HLCMD - // + // this.B_HLCMD.Location = new System.Drawing.Point(413, 5); this.B_HLCMD.Name = "B_HLCMD"; this.B_HLCMD.Size = new System.Drawing.Size(89, 23); @@ -1875,9 +1875,9 @@ private void InitializeComponent() this.B_HLCMD.Text = "HL **CMD**"; this.B_HLCMD.UseVisualStyleBackColor = true; this.B_HLCMD.Click += new System.EventHandler(this.B_HLCMD_Click); - // + // // OWSE - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(514, 537); @@ -1892,7 +1892,7 @@ private void InitializeComponent() this.Name = "OWSE"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Overworld Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.closingForm); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ClosingForm); this.tb_Zone.ResumeLayout(false); this.tb_ZoneData.ResumeLayout(false); this.tb_ZoneData.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs index 60f3268734..8fc72fde40 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs @@ -18,14 +18,15 @@ public OWSE() // Script Drag&Drop AllowDrop = true; - DragEnter += tabMain_DragEnter; - DragDrop += tabMain_DragDrop; + DragEnter += TabMain_DragEnter; + DragDrop += TabMain_DragDrop; // Finished - openQuick(Directory.GetFiles("encdata")); + OpenQuick(Directory.GetFiles("encdata")); mapView.Show(); tb_Zone.SelectedIndex = 1; // Show Overworlds tab } + private readonly string[] gameLocations = Main.Config.getText(TextName.metlist_000000); private string[] filepaths; private string[] encdatapaths; @@ -42,7 +43,7 @@ public OWSE() internal static MapMatrix mm; private readonly MapPermView mapView = new MapPermView(); - private void openQuick(string[] encdata) + private void OpenQuick(string[] encdata) { // Gather encdatapaths = encdata; @@ -72,12 +73,14 @@ private void openQuick(string[] encdata) CB_LocationID_SelectedIndexChanged(null, null); NUD_WMap.Maximum = zdLocations.Length; // Cap map warp destinations to the amount of maps. } + private void B_Map_Click(object sender, EventArgs e) { if (!mapView.Visible) mapView.Show(); } - private void closingForm(object sender, FormClosingEventArgs e) + + private void ClosingForm(object sender, FormClosingEventArgs e) { // Close map view mapView.Close(); @@ -86,15 +89,16 @@ private void closingForm(object sender, FormClosingEventArgs e) private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) { - setEntry(); + SetEntry(); entry = CB_LocationID.SelectedIndex; - getEntry(); + GetEntry(); } - private void getEntry() + + private void GetEntry() { if (entry < 0) return; byte[] raw = File.ReadAllBytes(filepaths[entry]); - locationData = Core.CTR.Mini.UnpackMini(raw, "ZO"); + locationData = Mini.UnpackMini(raw, "ZO"); if (locationData == null) return; // Read master ZD table @@ -105,15 +109,15 @@ private void getEntry() CurrentZone = new Zone(locationData); // File 0 - ZoneData RTB_ZD.Lines = Scripts.getHexLines(locationData[0], 0x10); - getZoneData(); + GetZoneData(); // File 1 - Overworld Setup & Script RTB_OWSC.Lines = Scripts.getHexLines(locationData[1], 0x10); - getOWSData(); + GetOWSData(); // File 2 - Map Script RTB_MapSC.Lines = Scripts.getHexLines(locationData[2], 0x10); - getScriptData(); + GetScriptData(); // File 3 - Encounters RTB_Encounter.Lines = Scripts.getHexLines(locationData[3], 0x10); @@ -121,15 +125,16 @@ private void getEntry() // File 4 - ?? (ORAS Only?) RTB_File5.Lines = Scripts.getHexLines(locationData.Length <= 4 ? null : locationData[4], 0x10); } - private void setEntry() + + private void SetEntry() { if (entry < 0) return; if (debugToolDumping) return; // Set the data back into the class object // Currently only the first two files. - setZoneData(); // File 0 - setOWSData(); + SetZoneData(); // File 0 + SetOWSData(); // setMSData(); // setEncounterData(); // if (Main.Config.ORAS) @@ -151,7 +156,7 @@ private void setEntry() } // Loading of Data - private void getZoneData() + private void GetZoneData() { L_ZDPreview.Text = "Text File: " + CurrentZone.ZD.TextFile + Environment.NewLine + "Map File: " + CurrentZone.ZD.MapMatrix; @@ -168,26 +173,27 @@ private void getZoneData() } // Fetch Map Image - mapView.drawMap(CurrentZone.ZD.MapMatrix); + mapView.SetMap(CurrentZone.ZD.MapMatrix); } - private void getOWSData() + + private void GetOWSData() { // Reset Fields a little. RTB_F.Text = RTB_N.Text = RTB_W.Text = RTB_T1.Text = RTB_T2.Text = string.Empty; fEntry = nEntry = wEntry = tEntry = uEntry = -1; // Set Counters - NUD_FurnCount.Value = CurrentZone.Entities.FurnitureCount; changeFurnitureCount(null, null); - NUD_NPCCount.Value = CurrentZone.Entities.NPCCount; changeNPCCount(null, null); - NUD_WarpCount.Value = CurrentZone.Entities.WarpCount; changeWarpCount(null, null); - NUD_TrigCount.Value = CurrentZone.Entities.TriggerCount; changeTriggerCount(null, null); - NUD_UnkCount.Value = CurrentZone.Entities.UnknownCount; changeUnkCount(null, null); + NUD_FurnCount.Value = CurrentZone.Entities.FurnitureCount; ChangeFurnitureCount(null, null); + NUD_NPCCount.Value = CurrentZone.Entities.NPCCount; ChangeNPCCount(null, null); + NUD_WarpCount.Value = CurrentZone.Entities.WarpCount; ChangeWarpCount(null, null); + NUD_TrigCount.Value = CurrentZone.Entities.TriggerCount; ChangeTriggerCount(null, null); + NUD_UnkCount.Value = CurrentZone.Entities.UnknownCount; ChangeUnkCount(null, null); // Collect/Load Data - NUD_FE.Value = NUD_FE.Maximum < 0 ? -1 : 0; changeFurniture(null, null); - NUD_NE.Value = NUD_NE.Maximum < 0 ? -1 : 0; changeNPC(null, null); - NUD_WE.Value = NUD_WE.Maximum < 0 ? -1 : 0; changeWarp(null, null); - NUD_TE.Value = NUD_TE.Maximum < 0 ? -1 : 0; changeTrigger1(null, null); - NUD_UE.Value = NUD_UE.Maximum < 0 ? -1 : 0; changeTrigger2(null, null); + NUD_FE.Value = NUD_FE.Maximum < 0 ? -1 : 0; ChangeFurniture(null, null); + NUD_NE.Value = NUD_NE.Maximum < 0 ? -1 : 0; ChangeNPC(null, null); + NUD_WE.Value = NUD_WE.Maximum < 0 ? -1 : 0; ChangeWarp(null, null); + NUD_TE.Value = NUD_TE.Maximum < 0 ? -1 : 0; ChangeTrigger1(null, null); + NUD_UE.Value = NUD_UE.Maximum < 0 ? -1 : 0; ChangeTrigger2(null, null); // Process Scripts var script = CurrentZone.Entities.Script; @@ -205,9 +211,12 @@ private void getOWSData() RTB_OSP.Lines = script.ParseScript.Concat(script.ParseMoves).ToArray(); } else - RTB_OWSCMD.Lines = RTB_OS.Lines = new[] {"No Data"}; + { + RTB_OWSCMD.Lines = RTB_OS.Lines = new[] { "No Data" }; + } } - private void getScriptData() + + private void GetScriptData() { var script = CurrentZone.MapScript.Script; if (script.Raw.Length > 4) @@ -224,33 +233,38 @@ private void getScriptData() RTB_MSP.Lines = script.ParseScript.Concat(script.ParseMoves).ToArray(); } else + { RTB_MSCMD.Lines = RTB_OS.Lines = new[] { "No Data" }; + } } - private void setZoneData() + + private void SetZoneData() { // Nothing, ZoneData is not currently researched enough. } - private void setOWSData() + + private void SetOWSData() { // Force all entities to be written back - setFurniture(); - setNPC(); - setWarp(); - setTrigger1(); - setTrigger2(); + SetFurniture(); + SetNPC(); + SetWarp(); + SetTrigger1(); + SetTrigger2(); } // Overworld Viewing private int entry = -1; private int fEntry, nEntry, wEntry, tEntry, uEntry = -1; #region Enabling - internal static void toggleEnable(NumericUpDown master, NumericUpDown slave, GroupBox display) + internal static void ToggleEnable(NumericUpDown master, NumericUpDown slave, GroupBox display) { slave.Maximum = master.Value - 1; slave.Enabled = display.Visible = slave.Maximum > -1; slave.Minimum = slave.Enabled ? 0 : -1; } - private void changeFurnitureCount(object sender, EventArgs e) + + private void ChangeFurnitureCount(object sender, EventArgs e) { // Resize array int count = (int)NUD_FurnCount.Value; @@ -259,9 +273,10 @@ private void changeFurnitureCount(object sender, EventArgs e) for (int i = 0; i < count; i++) CurrentZone.Entities.Furniture[i] = CurrentZone.Entities.Furniture[i] ?? new Zone.ZoneEntities.EntityFurniture(); - toggleEnable(NUD_FurnCount, NUD_FE, GB_F); + ToggleEnable(NUD_FurnCount, NUD_FE, GB_F); } - private void changeNPCCount(object sender, EventArgs e) + + private void ChangeNPCCount(object sender, EventArgs e) { // Resize array int count = (int)NUD_NPCCount.Value; @@ -270,9 +285,10 @@ private void changeNPCCount(object sender, EventArgs e) for (int i = 0; i < count; i++) CurrentZone.Entities.NPCs[i] = CurrentZone.Entities.NPCs[i] ?? new Zone.ZoneEntities.EntityNPC(); - toggleEnable(NUD_NPCCount, NUD_NE, GB_N); + ToggleEnable(NUD_NPCCount, NUD_NE, GB_N); } - private void changeWarpCount(object sender, EventArgs e) + + private void ChangeWarpCount(object sender, EventArgs e) { // Resize array int count = (int)NUD_WarpCount.Value; @@ -281,9 +297,10 @@ private void changeWarpCount(object sender, EventArgs e) for (int i = 0; i < count; i++) CurrentZone.Entities.Warps[i] = CurrentZone.Entities.Warps[i] ?? new Zone.ZoneEntities.EntityWarp(); - toggleEnable(NUD_WarpCount, NUD_WE, GB_W); + ToggleEnable(NUD_WarpCount, NUD_WE, GB_W); } - private void changeTriggerCount(object sender, EventArgs e) + + private void ChangeTriggerCount(object sender, EventArgs e) { // Resize array int count = (int)NUD_TrigCount.Value; @@ -292,9 +309,10 @@ private void changeTriggerCount(object sender, EventArgs e) for (int i = 0; i < count; i++) CurrentZone.Entities.Triggers1[i] = CurrentZone.Entities.Triggers1[i] ?? new Zone.ZoneEntities.EntityTrigger1(); - toggleEnable(NUD_TrigCount, NUD_TE, GB_T1); + ToggleEnable(NUD_TrigCount, NUD_TE, GB_T1); } - private void changeUnkCount(object sender, EventArgs e) + + private void ChangeUnkCount(object sender, EventArgs e) { // Resize array int count = (int)NUD_UnkCount.Value; @@ -303,18 +321,19 @@ private void changeUnkCount(object sender, EventArgs e) for (int i = 0; i < count; i++) CurrentZone.Entities.Triggers2[i] = CurrentZone.Entities.Triggers2[i] ?? new Zone.ZoneEntities.EntityTrigger2(); - toggleEnable(NUD_UnkCount, NUD_UE, GB_T2); + ToggleEnable(NUD_UnkCount, NUD_UE, GB_T2); } #endregion #region Updating - private void changeFurniture(object sender, EventArgs e) + private void ChangeFurniture(object sender, EventArgs e) { if (NUD_FE.Value < 0) return; - setFurniture(); + SetFurniture(); fEntry = (int)NUD_FE.Value; - getFurniture(); + GetFurniture(); } - private void getFurniture() + + private void GetFurniture() { if (NUD_FE.Value < 0) return; @@ -325,7 +344,8 @@ private void getFurniture() NUD_FWY.Value = Furniture.WY; RTB_F.Text = Util.getHexString(Furniture.Raw); } - private void setFurniture() + + private void SetFurniture() { if (NUD_FE.Value < 0) return; if (fEntry < 0) return; @@ -337,14 +357,15 @@ private void setFurniture() FUrniture.WY = (int)NUD_FWY.Value; } - private void changeNPC(object sender, EventArgs e) + private void ChangeNPC(object sender, EventArgs e) { if (NUD_NE.Value < 0) return; - setNPC(); + SetNPC(); nEntry = (int)NUD_NE.Value; - getNPC(); + GetNPC(); } - private void getNPC() + + private void GetNPC() { if (NUD_NE.Value < 0) return; var NPC = CurrentZone.Entities.NPCs[nEntry]; @@ -369,7 +390,8 @@ private void getNPC() RTB_N.Text = Util.getHexString(NPC.Raw); } - private void setNPC() + + private void SetNPC() { if (NUD_NE.Value < 0) return; if (nEntry < 0) return; @@ -388,14 +410,15 @@ private void setNPC() NPC.MovePermissions2 = (int)NUD_NMove2.Value; } - private void changeWarp(object sender, EventArgs e) + private void ChangeWarp(object sender, EventArgs e) { if (NUD_WE.Value < 0) return; - setWarp(); + SetWarp(); wEntry = (int)NUD_WE.Value; - getWarp(); + GetWarp(); } - private void getWarp() + + private void GetWarp() { if (NUD_WE.Value < 0) return; @@ -412,7 +435,8 @@ private void getWarp() // Flavor Mods L_WarpDest.Text = zdLocations[Warp.DestinationMap]; } - private void setWarp() + + private void SetWarp() { if (NUD_WE.Value < 0) return; if (wEntry < 0) return; @@ -424,14 +448,15 @@ private void setWarp() Warp.Y = (int)NUD_WY.Value; } - private void changeTrigger1(object sender, EventArgs e) + private void ChangeTrigger1(object sender, EventArgs e) { if (NUD_TE.Value < 0) return; - setTrigger1(); + SetTrigger1(); tEntry = (int)NUD_TE.Value; - getTrigger1(); + GetTrigger1(); } - private void getTrigger1() + + private void GetTrigger1() { if (NUD_TE.Value < 0) return; @@ -440,7 +465,8 @@ private void getTrigger1() NUD_T1Y.Value = Trigger1.Y; RTB_T1.Text = Util.getHexString(Trigger1.Raw); } - private void setTrigger1() + + private void SetTrigger1() { if (NUD_TE.Value < 0) return; if (tEntry < 0) return; @@ -450,14 +476,15 @@ private void setTrigger1() Trigger1.Y = (int)NUD_T1Y.Value; } - private void changeTrigger2(object sender, EventArgs e) + private void ChangeTrigger2(object sender, EventArgs e) { if (NUD_UE.Value < 0) return; - setTrigger2(); + SetTrigger2(); uEntry = (int)NUD_UE.Value; - getTrigger2(); + GetTrigger2(); } - private void getTrigger2() + + private void GetTrigger2() { if (NUD_UE.Value < 0) return; @@ -467,7 +494,8 @@ private void getTrigger2() NUD_T2Y.Value = Trigger2.Y; RTB_T2.Text = Util.getHexString(Trigger2.Raw); } - private void setTrigger2() + + private void SetTrigger2() { if (NUD_UE.Value < 0) return; if (uEntry < 0) return; @@ -479,15 +507,10 @@ private void setTrigger2() #endregion // Overworld User Enhancements - private void changeNPC_ID(object sender, EventArgs e) - { - L_NID.ForeColor = NUD_NID.Value != NUD_NE.Value ? Color.Red : Color.Black; - } - private void changeNPC_Model(object sender, EventArgs e) - { - L_ModelAsHex.Text = "0x" + ((int)NUD_NModel.Value).ToString("X4"); - } - private void dclickDestMap(object sender, EventArgs e) + private void ChangeNPC_ID(object sender, EventArgs e) => L_NID.ForeColor = NUD_NID.Value != NUD_NE.Value ? Color.Red : Color.Black; + private void ChangeNPC_Model(object sender, EventArgs e) => L_ModelAsHex.Text = "0x" + ((int)NUD_NModel.Value).ToString("X4"); + + private void DclickDestMap(object sender, EventArgs e) { var Tile = NUD_WTile.Value; CB_LocationID.SelectedIndex = (int)NUD_WMap.Value; @@ -496,39 +519,38 @@ private void dclickDestMap(object sender, EventArgs e) catch { try { NUD_WE.Value = 0; } catch { } } } - private void changeWarp_X(object sender, EventArgs e) - { - L_WpX.Text = (NUD_WX.Value / 18).ToString(); - } - private void changeWarp_Y(object sender, EventArgs e) - { - L_WpY.Text = (NUD_WY.Value / 18).ToString(); - } + + private void ChangeWarp_X(object sender, EventArgs e) => L_WpX.Text = (NUD_WX.Value / 18).ToString(); + private void ChangeWarp_Y(object sender, EventArgs e) => L_WpY.Text = (NUD_WY.Value / 18).ToString(); // Script Handling private void B_HLCMD_Click(object sender, EventArgs e) { - int ctr = WinFormsUtil.highlightText(RTB_OSP, "**", Color.Red) + WinFormsUtil.highlightText(RTB_MSP, "**", Color.Red) / 2; + int ctr = WinFormsUtil.highlightText(RTB_OSP, "**", Color.Red) + (WinFormsUtil.highlightText(RTB_MSP, "**", Color.Red) / 2); WinFormsUtil.Alert($"{ctr} instance{(ctr > 1 ? "s" : "")} of \"*\" present."); } - private void tabMain_DragEnter(object sender, DragEventArgs e) + + private void TabMain_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } - private void tabMain_DragDrop(object sender, DragEventArgs e) + + private void TabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); string path = files[0]; // open first D&D if (new FileInfo(path).Length < 10000000) - parseScriptInput(File.ReadAllBytes(path)); + ParseScriptInput(File.ReadAllBytes(path)); } - private void parseScriptInput(byte[] data) + + private void ParseScriptInput(byte[] data) { Script scr = new Script(data); RTB_CompressedScript.Lines = Scripts.getHexLines(scr.CompressedBytes); System.Media.SystemSounds.Asterisk.Play(); } - private void pasteScript(object sender, EventArgs e) + + private void PasteScript(object sender, EventArgs e) { // import data as bytes try @@ -573,6 +595,7 @@ private void B_DumpFurniture_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = 0; debugToolDumping = false; } + private void B_DumpNPC_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all NPCs?") != DialogResult.Yes) @@ -599,6 +622,7 @@ private void B_DumpNPC_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = 0; debugToolDumping = false; } + private void B_DumpWarp_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all Warps?") != DialogResult.Yes) @@ -625,6 +649,7 @@ private void B_DumpWarp_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = 0; debugToolDumping = false; } + private void B_DumpTrigger_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all Triggers?") != DialogResult.Yes) @@ -651,6 +676,7 @@ private void B_DumpTrigger_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = 0; debugToolDumping = false; } + private void B_DumpUnk_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all Unks?") != DialogResult.Yes) @@ -677,6 +703,7 @@ private void B_DumpUnk_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = 0; debugToolDumping = false; } + private void B_DumpMaps_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all MapImages?") != DialogResult.Yes) @@ -691,7 +718,7 @@ private void B_DumpMaps_Click(object sender, EventArgs e) for (int i = 0; i < CB_LocationID.Items.Count; i++) { mapView.DrawMap = i; - Image img = mapView.getMapImage(crop: true); + Image img = mapView.GetMapImage(crop: true); using (MemoryStream ms = new MemoryStream()) { //error will throw from here @@ -699,8 +726,8 @@ private void B_DumpMaps_Click(object sender, EventArgs e) byte[] data = ms.ToArray(); File.WriteAllBytes(Path.Combine(folder, $"{zdLocations[i].Replace('?', '-')} ({i}).png"), data); } - string l = mm.EntryList.Where(t => t != 0xFFFF).Aggregate("", (current, t) => current + t.ToString("000" + " ")); - result[i] = $"{i.ToString("000")}\t{CB_LocationID.Items[i]}\t{l}"; + string l = mm.EntryList.Where(t => t != 0xFFFF).Aggregate("", (current, t) => current + t.ToString("000 ")); + result[i] = $"{i:000}\t{CB_LocationID.Items[i]}\t{l}"; } if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Write Map parse output?") == DialogResult.Yes) File.WriteAllLines("MapLocations.txt", result); @@ -708,6 +735,7 @@ private void B_DumpMaps_Click(object sender, EventArgs e) WinFormsUtil.Alert("All Map images have been dumped to " + folder + "."); debugToolDumping = false; } + private void B_DumpZD_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all ZD?") != DialogResult.Yes) @@ -733,9 +761,9 @@ private void B_DumpZD_Click(object sender, EventArgs e) } // Raw file editing - private void changeRAWCheck(object sender, EventArgs e) + private void ChangeRAWCheck(object sender, EventArgs e) { - bool chk = (sender as CheckBox).Checked; + bool chk = ((CheckBox)sender).Checked; foreach (NumericUpDown nud in GB_F.Controls.OfType()) nud.Enabled = !chk; foreach (NumericUpDown nud in GB_N.Controls.OfType()) @@ -750,94 +778,99 @@ private void changeRAWCheck(object sender, EventArgs e) foreach (RichTextBox rtb in new[] {RTB_F, RTB_N, RTB_W, RTB_T1, RTB_T2}) rtb.Visible = chk; } - private void changeRAW_F(object sender, EventArgs e) + + private void ChangeRAW_F(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible) + if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) return; try { - byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); + byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); if (data.Length != Zone.ZoneEntities.EntityFurniture.Size) return; CurrentZone.Entities.Furniture[fEntry].Raw = data; - getFurniture(); + GetFurniture(); } catch { - (sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Furniture[fEntry].Raw); + ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Furniture[fEntry].Raw); } } - private void changeRAW_N(object sender, EventArgs e) + + private void ChangeRAW_N(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible) + if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) return; try { - byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); + byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); if (data.Length != Zone.ZoneEntities.EntityNPC.Size) return; CurrentZone.Entities.NPCs[nEntry].Raw = data; - getNPC(); + GetNPC(); } catch { - (sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.NPCs[nEntry].Raw); + ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.NPCs[nEntry].Raw); } } - private void changeRAW_W(object sender, EventArgs e) + + private void ChangeRAW_W(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible) + if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) return; try { - byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); + byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); if (data.Length != Zone.ZoneEntities.EntityWarp.Size) return; CurrentZone.Entities.Warps[wEntry].Raw = data; - getWarp(); + GetWarp(); } catch { - (sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Warps[wEntry].Raw); + ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Warps[wEntry].Raw); } } - private void changeRAW_T1(object sender, EventArgs e) + + private void ChangeRAW_T1(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible) + if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) return; try { - byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); + byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", "")); if (data.Length != Zone.ZoneEntities.EntityTrigger1.Size) return; CurrentZone.Entities.Triggers1[tEntry].Raw = data; - getTrigger1(); + GetTrigger1(); } catch { - (sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Triggers1[tEntry].Raw); + ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Triggers1[tEntry].Raw); } } - private void changeRAW_T2(object sender, EventArgs e) + + private void ChangeRAW_T2(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible) + if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) return; try { - byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ","")); + byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ","")); if (data.Length != Zone.ZoneEntities.EntityTrigger2.Size) return; CurrentZone.Entities.Triggers2[uEntry].Raw = data; - getTrigger2(); + GetTrigger2(); } catch { - (sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Triggers2[uEntry].Raw); + ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Triggers2[uEntry].Raw); } } @@ -849,32 +882,37 @@ private void B_ResetOverworlds_Click(object sender, EventArgs e) // since scripts are not editable, just reset the overworld file. CurrentZone.Entities = new Zone.ZoneEntities(locationData[1]); - getOWSData(); + GetOWSData(); } + private void B_ResetFurniture_Click(object sender, EventArgs e) { CurrentZone.Entities.Furniture[fEntry].OriginalData.CopyTo(CurrentZone.Entities.Furniture[fEntry].Raw, 0); - getFurniture(); + GetFurniture(); } + private void B_ResetNPC_Click(object sender, EventArgs e) { CurrentZone.Entities.NPCs[nEntry].OriginalData.CopyTo(CurrentZone.Entities.NPCs[nEntry].Raw, 0); - getNPC(); + GetNPC(); } + private void B_ResetWarp_Click(object sender, EventArgs e) { CurrentZone.Entities.Warps[wEntry].OriginalData.CopyTo(CurrentZone.Entities.Warps[wEntry].Raw, 0); - getWarp(); + GetWarp(); } + private void B_ResetTrigger1_Click(object sender, EventArgs e) { CurrentZone.Entities.Triggers1[tEntry].OriginalData.CopyTo(CurrentZone.Entities.Triggers1[tEntry].Raw, 0); - getTrigger1(); + GetTrigger1(); } + private void B_ResetTrigger2_Click(object sender, EventArgs e) { CurrentZone.Entities.Triggers2[uEntry].OriginalData.CopyTo(CurrentZone.Entities.Triggers2[uEntry].Raw, 0); - getTrigger2(); + GetTrigger2(); } } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs index 9775bccbcc..988418d811 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs @@ -238,7 +238,7 @@ public class CollisionObject public float F1 => _0 / 2; public float F2 => _1 * 80; public float F3 => _2 / 2; - public float F4 => _3; + public float F4 => _3 / 1; public CollisionObject(byte[] data) { diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index bcfe4134b3..567db08741 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -68,6 +68,7 @@ public static Dictionary GetMegaDictionary(GameConfig config) "Ability 2", "Hidden Ability", }; + private void B_Save_Click(object sender, EventArgs e) { saveEntry(); @@ -75,10 +76,12 @@ private void B_Save_Click(object sender, EventArgs e) RandSettings.SetFormSettings(this, tabPage2.Controls); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); } + private void loadData() { FieldData = File.ReadAllBytes(FieldPath); @@ -86,7 +89,7 @@ private void loadData() LB_Gifts.Items.Clear(); for (int i = 0; i < GiftData.Length; i++) { - GiftData[i] = new EncounterGift6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray(), Main.Config.ORAS); + GiftData[i] = new EncounterGift6(FieldData.Skip(fieldOffset + (i * fieldSize)).Take(fieldSize).ToArray(), Main.Config.ORAS); LB_Gifts.Items.Add($"{i:00} - {specieslist[GiftData[i].Species]}"); } foreach (var s in ability) CB_Ability.Items.Add(s); @@ -101,6 +104,7 @@ private void loadData() loaded = true; LB_Gifts.SelectedIndex = 0; } + private void saveData() { // Check to see if a starter has been modified right before we write data. @@ -121,7 +125,7 @@ private void saveData() for (int i = 0; i < GiftData.Length; i++) { - int offset = fieldOffset + i*fieldSize; + int offset = fieldOffset + (i * fieldSize); // Check too see if starters got modified if (Array.IndexOf(entries, i) > - 1 && BitConverter.ToUInt16(FieldData, offset) != GiftData[i].Species) @@ -140,6 +144,7 @@ private void saveData() private int entry = -1; private bool loaded; + private void changeIndex(object sender, EventArgs e) { if (LB_Gifts.SelectedIndex < 0) @@ -151,6 +156,7 @@ private void changeIndex(object sender, EventArgs e) entry = LB_Gifts.SelectedIndex; loadEntry(); } + private void loadEntry() { bool oldloaded = loaded; @@ -177,6 +183,7 @@ private void loadEntry() loaded |= oldloaded; } + private void saveEntry() { GiftData[entry].Species = (ushort)CB_Species.SelectedIndex; @@ -305,6 +312,7 @@ private int[] GetRandomMega(out int species) {448, new[] {673}}, // Lucario @ Lucarionite {460, new[] {674}}, // Abomasnow @ Abomasite }; + private static readonly Dictionary MegaDictionaryAO = new Dictionary { {015, new[] {770}}, // Beedrill @ Beedrillite @@ -325,6 +333,7 @@ private int[] GetRandomMega(out int species) {531, new[] {757}}, // Audino @ Audinite {719, new[] {764}}, // Diancie @ Diancite }; + private void changeSpecies(object sender, EventArgs e) { int index = LB_Gifts.SelectedIndex; diff --git a/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs b/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs index 1383e009cc..9c8ea1a7fe 100644 --- a/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs @@ -35,30 +35,30 @@ private void InitializeComponent() this.CB_Item = new System.Windows.Forms.ComboBox(); this.B_Table = new System.Windows.Forms.Button(); this.SuspendLayout(); - // + // // Grid - // - this.Grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.Grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.Grid.LineColor = System.Drawing.SystemColors.ControlDark; this.Grid.Location = new System.Drawing.Point(12, 94); this.Grid.Name = "Grid"; this.Grid.Size = new System.Drawing.Size(316, 280); this.Grid.TabIndex = 52; - // + // // L_Index - // + // this.L_Index.AutoSize = true; this.L_Index.Location = new System.Drawing.Point(221, 14); this.L_Index.Name = "L_Index"; this.L_Index.Size = new System.Drawing.Size(39, 13); this.L_Index.TabIndex = 51; this.L_Index.Text = "Index: "; - // + // // RTB - // - this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.RTB.Location = new System.Drawing.Point(11, 37); this.RTB.Name = "RTB"; @@ -66,18 +66,18 @@ private void InitializeComponent() this.RTB.Size = new System.Drawing.Size(316, 51); this.RTB.TabIndex = 50; this.RTB.Text = ""; - // + // // L_Item - // + // this.L_Item.Location = new System.Drawing.Point(12, 10); this.L_Item.Name = "L_Item"; this.L_Item.Size = new System.Drawing.Size(51, 21); this.L_Item.TabIndex = 49; this.L_Item.Text = "Item:"; this.L_Item.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Item - // + // this.CB_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item.DropDownWidth = 120; @@ -86,10 +86,10 @@ private void InitializeComponent() this.CB_Item.Name = "CB_Item"; this.CB_Item.Size = new System.Drawing.Size(144, 21); this.CB_Item.TabIndex = 48; - this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.changeEntry); - // + this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); + // // B_Table - // + // this.B_Table.Location = new System.Drawing.Point(253, 94); this.B_Table.Name = "B_Table"; this.B_Table.Size = new System.Drawing.Size(75, 23); @@ -97,9 +97,9 @@ private void InitializeComponent() this.B_Table.Text = "Export Table"; this.B_Table.UseVisualStyleBackColor = true; this.B_Table.Click += new System.EventHandler(this.B_Table_Click); - // + // // ItemEditor6 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(339, 381); @@ -115,7 +115,7 @@ private void InitializeComponent() this.Name = "ItemEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Item Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IsFormClosing); this.ResumeLayout(false); this.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/ItemEditor6.cs b/pk3DS/Subforms/Gen6/ItemEditor6.cs index 1e09613585..839b7adb66 100644 --- a/pk3DS/Subforms/Gen6/ItemEditor6.cs +++ b/pk3DS/Subforms/Gen6/ItemEditor6.cs @@ -27,32 +27,37 @@ private void Setup() foreach (string s in itemlist) CB_Item.Items.Add(s); CB_Item.SelectedIndex = 1; } + private int entry = -1; - private void changeEntry(object sender, EventArgs e) + + private void ChangeEntry(object sender, EventArgs e) { - setEntry(); + SetEntry(); entry = CB_Item.SelectedIndex; L_Index.Text = "Index: " + entry.ToString("000"); - getEntry(); + GetEntry(); } - private void getEntry() + + private void GetEntry() { if (entry < 1) return; Grid.SelectedObject = new Item(files[entry]); RTB.Text = itemflavor[entry].Replace("\\n", Environment.NewLine); } - private void setEntry() + + private void SetEntry() { if (entry < 1) return; files[entry] = ((Item)Grid.SelectedObject).Write(); } - private void formClosing(object sender, FormClosingEventArgs e) + + private void IsFormClosing(object sender, FormClosingEventArgs e) { - setEntry(); + SetEntry(); } - private int getItemMapOffset() + private int GetItemMapOffset() { if (Main.ExeFSPath == null) { WinFormsUtil.Alert("No exeFS code to load."); return -1; } string[] exefsFiles = Directory.GetFiles(Main.ExeFSPath); diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs index e1795e3a85..ae55f2d9c0 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs @@ -46,6 +46,7 @@ public LevelUpEditor6(byte[][] infiles) private int entry = -1; private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private bool dumping; + private void setupDGV() { string[] sortedmoves = (string[])movelist.Clone(); @@ -72,6 +73,7 @@ private void setupDGV() } private Learnset6 pkm; + private void getList() { entry = WinFormsUtil.getIndex(CB_Species); @@ -96,6 +98,7 @@ private void getList() dgv.CancelEdit(); } + private void setList() { if (entry < 1 || dumping) return; @@ -157,6 +160,7 @@ private void B_RandAll_Click(object sender, EventArgs e) getList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!"); } + private void B_Metronome_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will modify learnsets to only have Metronome.") != DialogResult.Yes) return; @@ -173,6 +177,7 @@ private void B_Metronome_Click(object sender, EventArgs e) CB_Species.SelectedIndex = 0; WinFormsUtil.Alert("All Pokémon now only know the move Metronome!"); } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Level Up Moves to Text File?")) diff --git a/pk3DS/Subforms/Gen6/MaisonEditor6.cs b/pk3DS/Subforms/Gen6/MaisonEditor6.cs index ce595f7d60..4c48dd469b 100644 --- a/pk3DS/Subforms/Gen6/MaisonEditor6.cs +++ b/pk3DS/Subforms/Gen6/MaisonEditor6.cs @@ -37,6 +37,7 @@ public MaisonEditor6(byte[][] trd, byte[][] trp, bool super) private int trEntry = -1; private int pkEntry = -1; private bool dumping; + private void Setup() { foreach (string s in trClass) CB_Class.Items.Add(s); @@ -52,6 +53,7 @@ private void Setup() CB_Trainer.SelectedIndex = 1; } + private void changeTrainer(object sender, EventArgs e) { setTrainer(); @@ -60,12 +62,14 @@ private void changeTrainer(object sender, EventArgs e) if (GB_Trainer.Enabled) LB_Choices.SelectedIndex = 0; } + private void changePokemon(object sender, EventArgs e) { setPokemon(); pkEntry = CB_Pokemon.SelectedIndex; getPokemon(); } + private void getTrainer() { if (trEntry < 0) return; @@ -80,6 +84,7 @@ private void getTrainer() foreach (ushort Entry in tr.Choices) LB_Choices.Items.Add(Entry.ToString()); } + private void setTrainer() { if (trEntry < 0 || !GB_Trainer.Enabled || dumping) return; @@ -95,6 +100,7 @@ private void setTrainer() Array.Sort(tr.Choices); trFiles[trEntry] = tr.Write(); } + private void getPokemon() { if (pkEntry < 0 || dumping) return; @@ -117,6 +123,7 @@ private void getPokemon() CB_Species.SelectedIndex = pkm.Species; // Loaded last in order to refresh the sprite with all info. // Last 2 Bytes are unused. } + private void setPokemon() { if (pkEntry < 0 || dumping) return; @@ -156,6 +163,7 @@ private void B_Remove_Click(object sender, EventArgs e) if (LB_Choices.SelectedIndex > -1 && GB_Trainer.Enabled) LB_Choices.Items.RemoveAt(LB_Choices.SelectedIndex); } + private void B_Set_Click(object sender, EventArgs e) { if (LB_Choices.SelectedIndex <= -1 || !GB_Trainer.Enabled) return; @@ -180,6 +188,7 @@ private void B_Set_Click(object sender, EventArgs e) // Set current index to the one just added. LB_Choices.SelectedIndex = Array.IndexOf(choiceList, toAdd); } + private void B_View_Click(object sender, EventArgs e) { if (LB_Choices.SelectedIndex > -1 && GB_Trainer.Enabled) @@ -221,6 +230,7 @@ private void DumpTRs_Click(object sender, EventArgs e) dumping = false; CB_Trainer.SelectedIndex = 0; } + private void B_DumpPKs_Click(object sender, EventArgs e) { string[] stats = {"HP", "ATK", "DEF", "Spe", "SpA", "SpD"}; @@ -242,7 +252,7 @@ private void B_DumpPKs_Click(object sender, EventArgs e) result += $"Move 4: {movelist[pk.Move4]}" + Environment.NewLine; var EVstr = string.Join(",", pk.EVs.Select((iv, x) => iv ? stats[x] : string.Empty).Where(x => !string.IsNullOrWhiteSpace(x))); - result += $"EV'd in: {(pk.EVs.Any() ? EVstr : "None")}" + Environment.NewLine; + result += $"EV'd in: {(pk.EVs.Length > 0 ? EVstr : "None")}" + Environment.NewLine; result += Environment.NewLine; } diff --git a/pk3DS/Subforms/Gen6/MartEditor6.cs b/pk3DS/Subforms/Gen6/MartEditor6.cs index 4405aa828c..fd5c6ffdd9 100644 --- a/pk3DS/Subforms/Gen6/MartEditor6.cs +++ b/pk3DS/Subforms/Gen6/MartEditor6.cs @@ -110,6 +110,7 @@ private void getDataOffset(int index) for (int i = 0; i < index; i++) dataoffset += 2 * entries[i]; } + private void setupDGV() { DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); @@ -134,12 +135,14 @@ private void setupDGV() } private int entry = -1; + private void changeIndex(object sender, EventArgs e) { if (entry > -1) setList(); entry = CB_Location.SelectedIndex; getList(); } + private void getList() { dgv.Rows.Clear(); @@ -149,14 +152,15 @@ private void getList() for (int i = 0; i < count; i++) { dgv.Rows[i].Cells[0].Value = i.ToString(); - dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffset + 2 * i)]; + dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffset + (2 * i))]; } } + private void setList() { int count = dgv.Rows.Count; for (int i = 0; i < count; i++) - Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + (2 * i), 2); } private void B_Save_Click(object sender, EventArgs e) @@ -165,10 +169,12 @@ private void B_Save_Click(object sender, EventArgs e) File.WriteAllBytes(codebin, data); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); } + private void B_Randomize_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize mart inventories?")) diff --git a/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs b/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs index ee67dc6f91..eda5dca7b7 100644 --- a/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs +++ b/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs @@ -51,6 +51,7 @@ public MegaEvoEditor6(byte[][] infiles) // All the initial settings Setup(); CB_Species.SelectedIndex = 0; } + private void Setup() { List temp_list = new List(specieslist); @@ -88,6 +89,7 @@ private void Setup() loaded = true; } + private void CHK_Changed(object sender, EventArgs e) { for (int i = 0; i < groupbox_spec.Length; i++) @@ -103,6 +105,7 @@ private void changeIndex(object sender, EventArgs e) entry = (int)CB_Species.SelectedValue; getEntry(); } + private void getEntry() { if (!loaded) return; @@ -122,6 +125,7 @@ private void getEntry() forme_spec[i].SelectedIndex = me.Form[i]; } } + private void setEntry() { if (entry < 1 || entry == 384) return; // Don't edit invalid / Rayquaza. @@ -180,6 +184,7 @@ private void UpdateImage(PictureBox pb, int species, int form, int item, int gen } pb.Image = WinFormsUtil.getSprite(species, form, gender, item, Main.Config); } + private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs index 5c96d69346..0c87748703 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs @@ -120,9 +120,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_0x21)).BeginInit(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); - // + // // L_Type - // + // this.L_Type.AutoSize = true; this.L_Type.Location = new System.Drawing.Point(32, 38); this.L_Type.Name = "L_Type"; @@ -130,9 +130,9 @@ private void InitializeComponent() this.L_Type.TabIndex = 0; this.L_Type.Text = "Type:"; this.L_Type.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Move - // + // this.CB_Move.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Move.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Move.DropDownWidth = 120; @@ -141,10 +141,10 @@ private void InitializeComponent() this.CB_Move.Name = "CB_Move"; this.CB_Move.Size = new System.Drawing.Size(130, 21); this.CB_Move.TabIndex = 1; - this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.changeEntry); - // + this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); + // // L_Move - // + // this.L_Move.AutoSize = true; this.L_Move.Location = new System.Drawing.Point(33, 13); this.L_Move.Name = "L_Move"; @@ -152,27 +152,27 @@ private void InitializeComponent() this.L_Move.TabIndex = 2; this.L_Move.Text = "Move:"; this.L_Move.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Type - // + // this.CB_Type.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Type.FormattingEnabled = true; this.CB_Type.Location = new System.Drawing.Point(71, 35); this.CB_Type.Name = "CB_Type"; this.CB_Type.Size = new System.Drawing.Size(99, 21); this.CB_Type.TabIndex = 3; - // + // // CB_Category - // + // this.CB_Category.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Category.FormattingEnabled = true; this.CB_Category.Location = new System.Drawing.Point(71, 58); this.CB_Category.Name = "CB_Category"; this.CB_Category.Size = new System.Drawing.Size(99, 21); this.CB_Category.TabIndex = 4; - // + // // L_Category - // + // this.L_Category.AutoSize = true; this.L_Category.Location = new System.Drawing.Point(18, 61); this.L_Category.Name = "L_Category"; @@ -180,9 +180,9 @@ private void InitializeComponent() this.L_Category.TabIndex = 5; this.L_Category.Text = "Category:"; this.L_Category.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_BP - // + // this.L_BP.AutoSize = true; this.L_BP.Location = new System.Drawing.Point(26, 132); this.L_BP.Name = "L_BP"; @@ -190,9 +190,9 @@ private void InitializeComponent() this.L_BP.TabIndex = 7; this.L_BP.Text = "Power:"; this.L_BP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_PP - // + // this.L_PP.AutoSize = true; this.L_PP.Location = new System.Drawing.Point(15, 174); this.L_PP.Name = "L_PP"; @@ -200,9 +200,9 @@ private void InitializeComponent() this.L_PP.TabIndex = 8; this.L_PP.Text = "Base PP:"; this.L_PP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Min - // + // this.L_Min.AutoSize = true; this.L_Min.Location = new System.Drawing.Point(236, 132); this.L_Min.Name = "L_Min"; @@ -210,9 +210,9 @@ private void InitializeComponent() this.L_Min.TabIndex = 10; this.L_Min.Text = "Min Hits:"; this.L_Min.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Max - // + // this.L_Max.AutoSize = true; this.L_Max.Location = new System.Drawing.Point(233, 153); this.L_Max.Name = "L_Max"; @@ -220,18 +220,18 @@ private void InitializeComponent() this.L_Max.TabIndex = 12; this.L_Max.Text = "Max Hits:"; this.L_Max.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Priority - // + // this.L_Priority.AutoSize = true; this.L_Priority.Location = new System.Drawing.Point(25, 195); this.L_Priority.Name = "L_Priority"; this.L_Priority.Size = new System.Drawing.Size(41, 13); this.L_Priority.TabIndex = 17; this.L_Priority.Text = "Priority:"; - // + // // NUD_HitMax - // + // this.NUD_HitMax.Location = new System.Drawing.Point(290, 151); this.NUD_HitMax.Maximum = new decimal(new int[] { 6, @@ -241,9 +241,9 @@ private void InitializeComponent() this.NUD_HitMax.Name = "NUD_HitMax"; this.NUD_HitMax.Size = new System.Drawing.Size(30, 20); this.NUD_HitMax.TabIndex = 18; - // + // // NUD_HitMin - // + // this.NUD_HitMin.Location = new System.Drawing.Point(290, 130); this.NUD_HitMin.Maximum = new decimal(new int[] { 6, @@ -253,9 +253,9 @@ private void InitializeComponent() this.NUD_HitMin.Name = "NUD_HitMin"; this.NUD_HitMin.Size = new System.Drawing.Size(30, 20); this.NUD_HitMin.TabIndex = 19; - // + // // NUD_Priority - // + // this.NUD_Priority.Location = new System.Drawing.Point(72, 193); this.NUD_Priority.Maximum = new decimal(new int[] { 8, @@ -270,9 +270,9 @@ private void InitializeComponent() this.NUD_Priority.Name = "NUD_Priority"; this.NUD_Priority.Size = new System.Drawing.Size(35, 20); this.NUD_Priority.TabIndex = 20; - // + // // NUD_PP - // + // this.NUD_PP.Location = new System.Drawing.Point(72, 172); this.NUD_PP.Maximum = new decimal(new int[] { 40, @@ -282,9 +282,9 @@ private void InitializeComponent() this.NUD_PP.Name = "NUD_PP"; this.NUD_PP.Size = new System.Drawing.Size(35, 20); this.NUD_PP.TabIndex = 21; - // + // // NUD_Power - // + // this.NUD_Power.Location = new System.Drawing.Point(72, 130); this.NUD_Power.Maximum = new decimal(new int[] { 255, @@ -294,9 +294,9 @@ private void InitializeComponent() this.NUD_Power.Name = "NUD_Power"; this.NUD_Power.Size = new System.Drawing.Size(45, 20); this.NUD_Power.TabIndex = 22; - // + // // NUD_TurnMin - // + // this.NUD_TurnMin.Location = new System.Drawing.Point(290, 172); this.NUD_TurnMin.Maximum = new decimal(new int[] { 15, @@ -306,9 +306,9 @@ private void InitializeComponent() this.NUD_TurnMin.Name = "NUD_TurnMin"; this.NUD_TurnMin.Size = new System.Drawing.Size(30, 20); this.NUD_TurnMin.TabIndex = 26; - // + // // L_TrapMin - // + // this.L_TrapMin.AutoSize = true; this.L_TrapMin.Location = new System.Drawing.Point(227, 174); this.L_TrapMin.Name = "L_TrapMin"; @@ -316,9 +316,9 @@ private void InitializeComponent() this.L_TrapMin.TabIndex = 23; this.L_TrapMin.Text = "Min Turns:"; this.L_TrapMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_TurnMax - // + // this.NUD_TurnMax.Location = new System.Drawing.Point(290, 193); this.NUD_TurnMax.Maximum = new decimal(new int[] { 15, @@ -328,9 +328,9 @@ private void InitializeComponent() this.NUD_TurnMax.Name = "NUD_TurnMax"; this.NUD_TurnMax.Size = new System.Drawing.Size(30, 20); this.NUD_TurnMax.TabIndex = 25; - // + // // L_TrapMax - // + // this.L_TrapMax.AutoSize = true; this.L_TrapMax.Location = new System.Drawing.Point(224, 195); this.L_TrapMax.Name = "L_TrapMax"; @@ -338,9 +338,9 @@ private void InitializeComponent() this.L_TrapMax.TabIndex = 24; this.L_TrapMax.Text = "Max Turns:"; this.L_TrapMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Recoil - // + // this.NUD_Recoil.Location = new System.Drawing.Point(184, 172); this.NUD_Recoil.Minimum = new decimal(new int[] { 100, @@ -350,9 +350,9 @@ private void InitializeComponent() this.NUD_Recoil.Name = "NUD_Recoil"; this.NUD_Recoil.Size = new System.Drawing.Size(40, 20); this.NUD_Recoil.TabIndex = 34; - // + // // L_Recoil - // + // this.L_Recoil.AutoSize = true; this.L_Recoil.Location = new System.Drawing.Point(114, 174); this.L_Recoil.Name = "L_Recoil"; @@ -360,9 +360,9 @@ private void InitializeComponent() this.L_Recoil.TabIndex = 31; this.L_Recoil.Text = "Rec/Abs %:"; this.L_Recoil.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Heal - // + // this.NUD_Heal.Location = new System.Drawing.Point(184, 151); this.NUD_Heal.Maximum = new decimal(new int[] { 255, @@ -372,9 +372,9 @@ private void InitializeComponent() this.NUD_Heal.Name = "NUD_Heal"; this.NUD_Heal.Size = new System.Drawing.Size(40, 20); this.NUD_Heal.TabIndex = 33; - // + // // L_Heal - // + // this.L_Heal.AutoSize = true; this.L_Heal.Location = new System.Drawing.Point(135, 153); this.L_Heal.Name = "L_Heal"; @@ -382,9 +382,9 @@ private void InitializeComponent() this.L_Heal.TabIndex = 32; this.L_Heal.Text = "Heal %:"; this.L_Heal.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_CritStage - // + // this.NUD_CritStage.Location = new System.Drawing.Point(184, 193); this.NUD_CritStage.Maximum = new decimal(new int[] { 6, @@ -394,9 +394,9 @@ private void InitializeComponent() this.NUD_CritStage.Name = "NUD_CritStage"; this.NUD_CritStage.Size = new System.Drawing.Size(30, 20); this.NUD_CritStage.TabIndex = 30; - // + // // L_CritStage - // + // this.L_CritStage.AutoSize = true; this.L_CritStage.Location = new System.Drawing.Point(122, 195); this.L_CritStage.Name = "L_CritStage"; @@ -404,9 +404,9 @@ private void InitializeComponent() this.L_CritStage.TabIndex = 27; this.L_CritStage.Text = "Crit Stage:"; this.L_CritStage.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Flinch - // + // this.NUD_Flinch.Location = new System.Drawing.Point(184, 130); this.NUD_Flinch.Maximum = new decimal(new int[] { 101, @@ -416,9 +416,9 @@ private void InitializeComponent() this.NUD_Flinch.Name = "NUD_Flinch"; this.NUD_Flinch.Size = new System.Drawing.Size(40, 20); this.NUD_Flinch.TabIndex = 29; - // + // // L_Flinch - // + // this.L_Flinch.AutoSize = true; this.L_Flinch.Location = new System.Drawing.Point(129, 132); this.L_Flinch.Name = "L_Flinch"; @@ -426,9 +426,9 @@ private void InitializeComponent() this.L_Flinch.TabIndex = 28; this.L_Flinch.Text = "Flinch %:"; this.L_Flinch.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // GB_Stat - // + // this.GB_Stat.Controls.Add(this.NUD_StatP3); this.GB_Stat.Controls.Add(this.NUD_StatP2); this.GB_Stat.Controls.Add(this.NUD_StatP1); @@ -447,9 +447,9 @@ private void InitializeComponent() this.GB_Stat.TabIndex = 35; this.GB_Stat.TabStop = false; this.GB_Stat.Text = "Stat Stage Changes"; - // + // // NUD_StatP3 - // + // this.NUD_StatP3.Location = new System.Drawing.Point(165, 68); this.NUD_StatP3.Maximum = new decimal(new int[] { 101, @@ -459,9 +459,9 @@ private void InitializeComponent() this.NUD_StatP3.Name = "NUD_StatP3"; this.NUD_StatP3.Size = new System.Drawing.Size(40, 20); this.NUD_StatP3.TabIndex = 44; - // + // // NUD_StatP2 - // + // this.NUD_StatP2.Location = new System.Drawing.Point(165, 46); this.NUD_StatP2.Maximum = new decimal(new int[] { 101, @@ -471,9 +471,9 @@ private void InitializeComponent() this.NUD_StatP2.Name = "NUD_StatP2"; this.NUD_StatP2.Size = new System.Drawing.Size(40, 20); this.NUD_StatP2.TabIndex = 43; - // + // // NUD_StatP1 - // + // this.NUD_StatP1.Location = new System.Drawing.Point(165, 24); this.NUD_StatP1.Maximum = new decimal(new int[] { 101, @@ -483,9 +483,9 @@ private void InitializeComponent() this.NUD_StatP1.Name = "NUD_StatP1"; this.NUD_StatP1.Size = new System.Drawing.Size(40, 20); this.NUD_StatP1.TabIndex = 42; - // + // // NUD_Stat2 - // + // this.NUD_Stat2.Location = new System.Drawing.Point(127, 46); this.NUD_Stat2.Maximum = new decimal(new int[] { 5, @@ -500,9 +500,9 @@ private void InitializeComponent() this.NUD_Stat2.Name = "NUD_Stat2"; this.NUD_Stat2.Size = new System.Drawing.Size(35, 20); this.NUD_Stat2.TabIndex = 41; - // + // // NUD_Stat3 - // + // this.NUD_Stat3.Location = new System.Drawing.Point(127, 68); this.NUD_Stat3.Maximum = new decimal(new int[] { 5, @@ -517,9 +517,9 @@ private void InitializeComponent() this.NUD_Stat3.Name = "NUD_Stat3"; this.NUD_Stat3.Size = new System.Drawing.Size(35, 20); this.NUD_Stat3.TabIndex = 40; - // + // // NUD_Stat1 - // + // this.NUD_Stat1.Location = new System.Drawing.Point(127, 24); this.NUD_Stat1.Maximum = new decimal(new int[] { 5, @@ -534,63 +534,63 @@ private void InitializeComponent() this.NUD_Stat1.Name = "NUD_Stat1"; this.NUD_Stat1.Size = new System.Drawing.Size(35, 20); this.NUD_Stat1.TabIndex = 39; - // + // // CB_Stat3 - // + // this.CB_Stat3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat3.FormattingEnabled = true; this.CB_Stat3.Location = new System.Drawing.Point(27, 67); this.CB_Stat3.Name = "CB_Stat3"; this.CB_Stat3.Size = new System.Drawing.Size(99, 21); this.CB_Stat3.TabIndex = 38; - // + // // CB_Stat2 - // + // this.CB_Stat2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat2.FormattingEnabled = true; this.CB_Stat2.Location = new System.Drawing.Point(27, 45); this.CB_Stat2.Name = "CB_Stat2"; this.CB_Stat2.Size = new System.Drawing.Size(99, 21); this.CB_Stat2.TabIndex = 37; - // + // // CB_Stat1 - // + // this.CB_Stat1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat1.FormattingEnabled = true; this.CB_Stat1.Location = new System.Drawing.Point(27, 23); this.CB_Stat1.Name = "CB_Stat1"; this.CB_Stat1.Size = new System.Drawing.Size(99, 21); this.CB_Stat1.TabIndex = 36; - // + // // L_Stage3 - // + // this.L_Stage3.AutoSize = true; this.L_Stage3.Location = new System.Drawing.Point(5, 70); this.L_Stage3.Name = "L_Stage3"; this.L_Stage3.Size = new System.Drawing.Size(16, 13); this.L_Stage3.TabIndex = 2; this.L_Stage3.Text = "3:"; - // + // // L_Stage2 - // + // this.L_Stage2.AutoSize = true; this.L_Stage2.Location = new System.Drawing.Point(5, 48); this.L_Stage2.Name = "L_Stage2"; this.L_Stage2.Size = new System.Drawing.Size(16, 13); this.L_Stage2.TabIndex = 1; this.L_Stage2.Text = "2:"; - // + // // L_Stage1 - // + // this.L_Stage1.AutoSize = true; this.L_Stage1.Location = new System.Drawing.Point(5, 26); this.L_Stage1.Name = "L_Stage1"; this.L_Stage1.Size = new System.Drawing.Size(16, 13); this.L_Stage1.TabIndex = 0; this.L_Stage1.Text = "1:"; - // + // // L_Targeting - // + // this.L_Targeting.AutoSize = true; this.L_Targeting.Location = new System.Drawing.Point(173, 38); this.L_Targeting.Name = "L_Targeting"; @@ -598,9 +598,9 @@ private void InitializeComponent() this.L_Targeting.TabIndex = 36; this.L_Targeting.Text = "Targeting:"; this.L_Targeting.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Influcts - // + // this.L_Influcts.AutoSize = true; this.L_Influcts.Location = new System.Drawing.Point(188, 60); this.L_Influcts.Name = "L_Influcts"; @@ -608,10 +608,10 @@ private void InitializeComponent() this.L_Influcts.TabIndex = 37; this.L_Influcts.Text = "Inflicts:"; this.L_Influcts.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB - // - this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + // + this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.RTB.Location = new System.Drawing.Point(12, 324); this.RTB.Name = "RTB"; @@ -619,9 +619,9 @@ private void InitializeComponent() this.RTB.Size = new System.Drawing.Size(316, 51); this.RTB.TabIndex = 38; this.RTB.Text = ""; - // + // // CB_Targeting - // + // this.CB_Targeting.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Targeting.DropDownWidth = 150; this.CB_Targeting.FormattingEnabled = true; @@ -629,9 +629,9 @@ private void InitializeComponent() this.CB_Targeting.Name = "CB_Targeting"; this.CB_Targeting.Size = new System.Drawing.Size(99, 21); this.CB_Targeting.TabIndex = 39; - // + // // CB_Inflict - // + // this.CB_Inflict.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Inflict.DropDownWidth = 150; this.CB_Inflict.FormattingEnabled = true; @@ -639,9 +639,9 @@ private void InitializeComponent() this.CB_Inflict.Name = "CB_Inflict"; this.CB_Inflict.Size = new System.Drawing.Size(99, 21); this.CB_Inflict.TabIndex = 40; - // + // // L_Inflict - // + // this.L_Inflict.AutoSize = true; this.L_Inflict.Location = new System.Drawing.Point(238, 81); this.L_Inflict.Name = "L_Inflict"; @@ -649,9 +649,9 @@ private void InitializeComponent() this.L_Inflict.TabIndex = 41; this.L_Inflict.Text = "Inflict %:"; this.L_Inflict.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Inflict - // + // this.NUD_Inflict.Location = new System.Drawing.Point(287, 78); this.NUD_Inflict.Maximum = new decimal(new int[] { 101, @@ -661,9 +661,9 @@ private void InitializeComponent() this.NUD_Inflict.Name = "NUD_Inflict"; this.NUD_Inflict.Size = new System.Drawing.Size(40, 20); this.NUD_Inflict.TabIndex = 42; - // + // // NUD_Effect - // + // this.NUD_Effect.Location = new System.Drawing.Point(150, 103); this.NUD_Effect.Maximum = new decimal(new int[] { 65535, @@ -673,9 +673,9 @@ private void InitializeComponent() this.NUD_Effect.Name = "NUD_Effect"; this.NUD_Effect.Size = new System.Drawing.Size(50, 20); this.NUD_Effect.TabIndex = 44; - // + // // L_Effect - // + // this.L_Effect.AutoSize = true; this.L_Effect.Location = new System.Drawing.Point(106, 106); this.L_Effect.Name = "L_Effect"; @@ -683,9 +683,9 @@ private void InitializeComponent() this.L_Effect.TabIndex = 45; this.L_Effect.Text = "Effect:"; this.L_Effect.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Accuracy - // + // this.NUD_Accuracy.Location = new System.Drawing.Point(72, 151); this.NUD_Accuracy.Maximum = new decimal(new int[] { 101, @@ -695,9 +695,9 @@ private void InitializeComponent() this.NUD_Accuracy.Name = "NUD_Accuracy"; this.NUD_Accuracy.Size = new System.Drawing.Size(40, 20); this.NUD_Accuracy.TabIndex = 47; - // + // // L_Accuracy - // + // this.L_Accuracy.AutoSize = true; this.L_Accuracy.Location = new System.Drawing.Point(17, 153); this.L_Accuracy.Name = "L_Accuracy"; @@ -705,9 +705,9 @@ private void InitializeComponent() this.L_Accuracy.TabIndex = 46; this.L_Accuracy.Text = "Accur %:"; this.L_Accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Quality - // + // this.CB_Quality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Quality.DropDownWidth = 170; this.CB_Quality.FormattingEnabled = true; @@ -715,9 +715,9 @@ private void InitializeComponent() this.CB_Quality.Name = "CB_Quality"; this.CB_Quality.Size = new System.Drawing.Size(129, 21); this.CB_Quality.TabIndex = 48; - // + // // L_Quality - // + // this.L_Quality.AutoSize = true; this.L_Quality.Location = new System.Drawing.Point(20, 84); this.L_Quality.Name = "L_Quality"; @@ -725,9 +725,9 @@ private void InitializeComponent() this.L_Quality.TabIndex = 49; this.L_Quality.Text = "Qualities:"; this.L_Quality.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_0xB - // + // this.L_0xB.AutoSize = true; this.L_0xB.Location = new System.Drawing.Point(256, 101); this.L_0xB.Name = "L_0xB"; @@ -735,9 +735,9 @@ private void InitializeComponent() this.L_0xB.TabIndex = 50; this.L_0xB.Text = "0xB:"; this.L_0xB.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_0xB - // + // this.NUD_0xB.Location = new System.Drawing.Point(287, 99); this.NUD_0xB.Maximum = new decimal(new int[] { 255, @@ -747,9 +747,9 @@ private void InitializeComponent() this.NUD_0xB.Name = "NUD_0xB"; this.NUD_0xB.Size = new System.Drawing.Size(40, 20); this.NUD_0xB.TabIndex = 51; - // + // // NUD_0x20 - // + // this.NUD_0x20.Location = new System.Drawing.Point(282, 239); this.NUD_0x20.Maximum = new decimal(new int[] { 255, @@ -759,9 +759,9 @@ private void InitializeComponent() this.NUD_0x20.Name = "NUD_0x20"; this.NUD_0x20.Size = new System.Drawing.Size(40, 20); this.NUD_0x20.TabIndex = 52; - // + // // NUD_0x21 - // + // this.NUD_0x21.Location = new System.Drawing.Point(282, 261); this.NUD_0x21.Maximum = new decimal(new int[] { 255, @@ -771,9 +771,9 @@ private void InitializeComponent() this.NUD_0x21.Name = "NUD_0x21"; this.NUD_0x21.Size = new System.Drawing.Size(40, 20); this.NUD_0x21.TabIndex = 53; - // + // // L_0x20 - // + // this.L_0x20.AutoSize = true; this.L_0x20.Location = new System.Drawing.Point(232, 242); this.L_0x20.Name = "L_0x20"; @@ -781,9 +781,9 @@ private void InitializeComponent() this.L_0x20.TabIndex = 59; this.L_0x20.Text = "Flags 1:"; this.L_0x20.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_0x21 - // + // this.L_0x21.AutoSize = true; this.L_0x21.Location = new System.Drawing.Point(233, 264); this.L_0x21.Name = "L_0x21"; @@ -791,9 +791,9 @@ private void InitializeComponent() this.L_0x21.TabIndex = 62; this.L_0x21.Text = "Flags 2:"; this.L_0x21.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // B_RandAll - // + // this.B_RandAll.Location = new System.Drawing.Point(333, 10); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(98, 23); @@ -801,9 +801,9 @@ private void InitializeComponent() this.B_RandAll.Text = "Randomize!"; this.B_RandAll.UseVisualStyleBackColor = true; this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click); - // + // // groupBox1 - // + // this.groupBox1.Controls.Add(this.CHK_Category); this.groupBox1.Controls.Add(this.CHK_Type); this.groupBox1.Location = new System.Drawing.Point(333, 60); @@ -812,9 +812,9 @@ private void InitializeComponent() this.groupBox1.TabIndex = 64; this.groupBox1.TabStop = false; this.groupBox1.Text = "Options"; - // + // // CHK_Category - // + // this.CHK_Category.AutoSize = true; this.CHK_Category.Location = new System.Drawing.Point(6, 34); this.CHK_Category.Name = "CHK_Category"; @@ -822,9 +822,9 @@ private void InitializeComponent() this.CHK_Category.TabIndex = 1; this.CHK_Category.Text = "Category"; this.CHK_Category.UseVisualStyleBackColor = true; - // + // // CHK_Type - // + // this.CHK_Type.AutoSize = true; this.CHK_Type.Location = new System.Drawing.Point(6, 19); this.CHK_Type.Name = "CHK_Type"; @@ -832,9 +832,9 @@ private void InitializeComponent() this.CHK_Type.TabIndex = 0; this.CHK_Type.Text = "Type"; this.CHK_Type.UseVisualStyleBackColor = true; - // + // // B_Metronome - // + // this.B_Metronome.Location = new System.Drawing.Point(333, 33); this.B_Metronome.Name = "B_Metronome"; this.B_Metronome.Size = new System.Drawing.Size(98, 23); @@ -842,9 +842,9 @@ private void InitializeComponent() this.B_Metronome.Text = "Metronome Mode"; this.B_Metronome.UseVisualStyleBackColor = true; this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); - // + // // B_Table - // + // this.B_Table.Location = new System.Drawing.Point(356, 117); this.B_Table.Name = "B_Table"; this.B_Table.Size = new System.Drawing.Size(75, 23); @@ -852,9 +852,9 @@ private void InitializeComponent() this.B_Table.Text = "Export Table"; this.B_Table.UseVisualStyleBackColor = true; this.B_Table.Click += new System.EventHandler(this.B_Table_Click); - // + // // MoveEditor6 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(439, 381); @@ -916,7 +916,7 @@ private void InitializeComponent() this.Name = "MoveEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Move Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CloseForm); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).EndInit(); diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index 5331b5e7cf..ddf080e6f3 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -17,7 +17,8 @@ public MoveEditor6(byte[][] infiles) Setup(); RandSettings.GetFormSettings(this, groupBox1.Controls); } - private byte[][] files; + + private readonly byte[][] files; private readonly string[] types = Main.Config.getText(TextName.Types); private readonly string[] moveflavor = Main.Config.getText(TextName.MoveFlavor); private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); @@ -45,6 +46,7 @@ public MoveEditor6(byte[][] infiles) "No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat", "DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field", "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", }; + private void Setup() { foreach (string s in movelist) CB_Move.Items.Add(s); @@ -61,20 +63,22 @@ private void Setup() CB_Move.Items.RemoveAt(0); CB_Move.SelectedIndex = 0; } + private int entry = -1; - private void changeEntry(object sender, EventArgs e) + + private void ChangeEntry(object sender, EventArgs e) { - setEntry(); + SetEntry(); entry = Array.IndexOf(movelist, CB_Move.Text); - getEntry(); + GetEntry(); } - private void getEntry() + + private void GetEntry() { if (entry < 1) return; byte[] data = files[entry]; { - string flavor = moveflavor[entry].Replace("\\n", Environment.NewLine); - RTB.Text = flavor; + RTB.Text = moveflavor[entry].Replace("\\n", Environment.NewLine); CB_Type.SelectedIndex = data[0x00]; CB_Quality.SelectedIndex = data[0x01]; @@ -119,7 +123,8 @@ private void getEntry() //NUD_0x23.Value = data[0x23]; // 0x23 } } - private void setEntry() + + private void SetEntry() { if (entry < 1) return; byte[] data = files[entry]; @@ -168,9 +173,9 @@ private void B_Table_Click(object sender, EventArgs e) System.Media.SystemSounds.Asterisk.Play(); } - private void formClosing(object sender, FormClosingEventArgs e) + private void CloseForm(object sender, FormClosingEventArgs e) { - setEntry(); + SetEntry(); RandSettings.SetFormSettings(this, groupBox1.Controls); } @@ -199,6 +204,7 @@ private void B_RandAll_Click(object sender, EventArgs e) } WinFormsUtil.Alert("All Moves have been randomized!"); } + private void B_Metronome_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will set the Base PP for every other Move to 0!") != DialogResult.Yes) return; diff --git a/pk3DS/Subforms/Gen6/OPower.cs b/pk3DS/Subforms/Gen6/OPower.cs index b7878094ba..68c10dbd5b 100644 --- a/pk3DS/Subforms/Gen6/OPower.cs +++ b/pk3DS/Subforms/Gen6/OPower.cs @@ -24,7 +24,7 @@ public OPower() // Gather Data for (int i = 0; i < powerData.Length; i++) - powerData[i] = exefsData.Skip(offset + 22 * i).Take(22).ToArray(); + powerData[i] = exefsData.Skip(offset + (22 * i)).Take(22).ToArray(); // Prepare View for (int i = 0; i < 10; i++) CB_SortOrder.Items.Add(i); @@ -40,12 +40,14 @@ public OPower() private readonly string[] powerFlavor = Main.Config.getText(TextName.OPowerFlavor); private int entry = -1; + private void changeEntry(object sender, EventArgs e) { setEntry(); entry = CB_Item.SelectedIndex + 1; getEntry(); } + private void getEntry() { if (entry < 1) return; @@ -86,6 +88,7 @@ private void getEntry() NUD_Usability.Value = _01; NUD_2.Value = _02; } + private void setEntry() { if (entry < 1) return; @@ -117,7 +120,7 @@ private void formClosing(object sender, FormClosingEventArgs e) setEntry(); // Copy data back to storage for (int i = 0; i < powerData.Length; i++) - Array.Copy(powerData[i], 0, exefsData, offset + i * powerData[i].Length, powerData[i].Length); + Array.Copy(powerData[i], 0, exefsData, offset + (i * powerData[i].Length), powerData[i].Length); if (ModifierKeys != Keys.Control) File.WriteAllBytes(codebin, exefsData); } diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index ce2a36c0d9..0f963ee29e 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -172,6 +172,7 @@ private void CB_Species_SelectedIndexChanged(object sender, EventArgs e) entry = CB_Species.SelectedIndex; readEntry(); } + private void ByteLimiter(object sender, EventArgs e) { if (!(sender is MaskedTextBox mtb)) @@ -184,6 +185,7 @@ private void ByteLimiter(object sender, EventArgs e) } private PersonalInfo pkm; + private void readInfo() { pkm = Main.SpeciesStat[entry]; @@ -251,6 +253,7 @@ private void readInfo() CLB_ORASTutors.SetItemChecked(ctr++, pkm.SpecialTutors[i][b]); } } + private void readEntry() { readInfo(); @@ -268,13 +271,14 @@ private void readEntry() { Color c = rawImg.GetPixel(x, y); bigImg.SetPixel(2 * x, 2 * y, c); - bigImg.SetPixel(2 * x + 1, 2 * y, c); - bigImg.SetPixel(2 * x, 2 * y + 1, c); - bigImg.SetPixel(2 * x + 1, 2 * y + 1, c); + bigImg.SetPixel((2 * x) + 1, 2 * y, c); + bigImg.SetPixel(2 * x, (2 * y) + 1, c); + bigImg.SetPixel((2 * x) + 1, (2 * y) + 1, c); } } PB_MonSprite.Image = bigImg; } + private void savePersonal() { pkm.HP = Convert.ToByte(TB_BaseHP.Text); @@ -328,6 +332,7 @@ private void savePersonal() for (int t = 0; t < len[i]; t++) pkm.SpecialTutors[i][t] = CLB_ORASTutors.GetItemChecked(ctr++); } + private void saveEntry() { savePersonal(); @@ -367,6 +372,7 @@ private void B_Randomize_Click(object sender, EventArgs e) readEntry(); WinFormsUtil.Alert("Randomized all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } + private void B_ModifyAll(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all? Cannot undo.", "Double check Modification settings in the Enhancements tab.") != DialogResult.Yes) return; @@ -402,7 +408,9 @@ private void B_ModifyAll(object sender, EventArgs e) CB_Species.SelectedIndex = 1; WinFormsUtil.Alert("Modified all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } + private bool dumping; + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Personal Entries to Text File?")) @@ -442,11 +450,13 @@ private void B_Dump_Click(object sender, EventArgs e) string path = sfd.FileName; File.WriteAllLines(path, lines, Encoding.Unicode); } + private void CHK_Stats_CheckedChanged(object sender, EventArgs e) { L_StatDev.Visible = NUD_StatDev.Visible = CHK_Stats.Checked; CHK_rHP.Enabled = CHK_rATK.Enabled = CHK_rDEF.Enabled = CHK_rSPA.Enabled = CHK_rSPD.Enabled = CHK_rSPE.Enabled = CHK_Stats.Checked; } + private void CHK_Ability_CheckedChanged(object sender, EventArgs e) { CHK_WGuard.Enabled = CHK_Ability.Checked; diff --git a/pk3DS/Subforms/Gen6/PickupEditor6.cs b/pk3DS/Subforms/Gen6/PickupEditor6.cs index 2f676ca8f5..a220b8a8ca 100644 --- a/pk3DS/Subforms/Gen6/PickupEditor6.cs +++ b/pk3DS/Subforms/Gen6/PickupEditor6.cs @@ -28,10 +28,12 @@ public PickupEditor6() private readonly int offset = Main.Config.ORAS ? 0x004872FC : 0x004455A8; private readonly byte[] data; private int dataoffset; + private void getDataOffset() { dataoffset = offset; // reset } + private void setupDGV() { dgvCommon.Columns.Clear(); dgvRare.Columns.Clear(); @@ -70,9 +72,9 @@ private void getList() getDataOffset(); for (int i = 0; i < 0x12; i++) // 0x12 Common - common.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + common.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); for (int i = 0x12; i < 0x12 + 0xB; i++) // 0xB Rare - rare.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + rare.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); ushort[] clist = common.ToArray(); ushort[] rlist = rare.ToArray(); @@ -80,8 +82,8 @@ private void getList() { dgvCommon.Rows.Add(); dgvCommon.Rows[i].Cells[0].Value = i.ToString(); dgvCommon.Rows[i].Cells[1].Value = itemlist[clist[i]]; } for (int i = 0; i < rlist.Length; i++) { dgvRare.Rows.Add(); dgvRare.Rows[i].Cells[0].Value = i.ToString(); dgvRare.Rows[i].Cells[1].Value = itemlist[rlist[i]]; } - } + private void setList() { common = new List(); @@ -96,9 +98,9 @@ private void setList() ushort[] rlist = rare.ToArray(); for (int i = 0; i < 0x12; i++) - Array.Copy(BitConverter.GetBytes(clist[i]), 0, data, offset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes(clist[i]), 0, data, offset + (2 * i), 2); for (int i = 0x12; i < 0x12 + 0xB; i++) - Array.Copy(BitConverter.GetBytes(rlist[i - 0x12]), 0, data, offset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes(rlist[i - 0x12]), 0, data, offset + (2 * i), 2); } private void B_Save_Click(object sender, EventArgs e) @@ -107,10 +109,12 @@ private void B_Save_Click(object sender, EventArgs e) File.WriteAllBytes(codebin, data); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); } + private void B_Randomize_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize pickup lists?")) diff --git a/pk3DS/Subforms/Gen6/RSTE.Designer.cs b/pk3DS/Subforms/Gen6/RSTE.Designer.cs index c35e331db5..3607281cf8 100644 --- a/pk3DS/Subforms/Gen6/RSTE.Designer.cs +++ b/pk3DS/Subforms/Gen6/RSTE.Designer.cs @@ -221,9 +221,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.SuspendLayout(); - // + // // B_Dump - // + // this.B_Dump.Location = new System.Drawing.Point(483, 4); this.B_Dump.Name = "B_Dump"; this.B_Dump.Size = new System.Drawing.Size(93, 23); @@ -231,18 +231,18 @@ private void InitializeComponent() this.B_Dump.Text = "Dump to .TXT"; this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); - // + // // L_TrainerID - // + // this.L_TrainerID.AutoSize = true; this.L_TrainerID.Location = new System.Drawing.Point(12, 9); this.L_TrainerID.Name = "L_TrainerID"; this.L_TrainerID.Size = new System.Drawing.Size(57, 13); this.L_TrainerID.TabIndex = 63; this.L_TrainerID.Text = "Trainer ID:"; - // + // // CB_TrainerID - // + // this.CB_TrainerID.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_TrainerID.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_TrainerID.FormattingEnabled = true; @@ -250,10 +250,10 @@ private void InitializeComponent() this.CB_TrainerID.Name = "CB_TrainerID"; this.CB_TrainerID.Size = new System.Drawing.Size(134, 21); this.CB_TrainerID.TabIndex = 62; - this.CB_TrainerID.SelectedIndexChanged += new System.EventHandler(this.changeTrainerIndex); - // + this.CB_TrainerID.SelectedIndexChanged += new System.EventHandler(this.ChangeTrainerIndex); + // // tabControl1 - // + // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage3); @@ -266,9 +266,9 @@ private void InitializeComponent() this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(565, 153); this.tabControl1.TabIndex = 61; - // + // // tabPage1 - // + // this.tabPage1.BackColor = System.Drawing.SystemColors.Control; this.tabPage1.Controls.Add(this.checkBox_Healer); this.tabPage1.Controls.Add(this.L_TPrize); @@ -299,9 +299,9 @@ private void InitializeComponent() this.tabPage1.Size = new System.Drawing.Size(557, 127); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Trainer Info"; - // + // // checkBox_Healer - // + // this.checkBox_Healer.AutoSize = true; this.checkBox_Healer.Location = new System.Drawing.Point(452, 12); this.checkBox_Healer.Name = "checkBox_Healer"; @@ -309,18 +309,18 @@ private void InitializeComponent() this.checkBox_Healer.TabIndex = 58; this.checkBox_Healer.Text = "Healer"; this.checkBox_Healer.UseVisualStyleBackColor = true; - // + // // L_TPrize - // + // this.L_TPrize.AutoSize = true; this.L_TPrize.Location = new System.Drawing.Point(443, 80); this.L_TPrize.Name = "L_TPrize"; this.L_TPrize.Size = new System.Drawing.Size(33, 13); this.L_TPrize.TabIndex = 57; this.L_TPrize.Text = "Prize:"; - // + // // CB_Prize - // + // this.CB_Prize.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Prize.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Prize.FormattingEnabled = true; @@ -328,18 +328,18 @@ private void InitializeComponent() this.CB_Prize.Name = "CB_Prize"; this.CB_Prize.Size = new System.Drawing.Size(102, 21); this.CB_Prize.TabIndex = 56; - // + // // L_AI - // + // this.L_AI.AutoSize = true; this.L_AI.Location = new System.Drawing.Point(12, 97); this.L_AI.Name = "L_AI"; this.L_AI.Size = new System.Drawing.Size(49, 13); this.L_AI.TabIndex = 55; this.L_AI.Text = "AI Level:"; - // + // // CB_AI - // + // this.CB_AI.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_AI.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_AI.FormattingEnabled = true; @@ -347,18 +347,18 @@ private void InitializeComponent() this.CB_AI.Name = "CB_AI"; this.CB_AI.Size = new System.Drawing.Size(74, 21); this.CB_AI.TabIndex = 54; - // + // // L_Money - // + // this.L_Money.AutoSize = true; this.L_Money.Location = new System.Drawing.Point(147, 97); this.L_Money.Name = "L_Money"; this.L_Money.Size = new System.Drawing.Size(42, 13); this.L_Money.TabIndex = 53; this.L_Money.Text = "Money:"; - // + // // CB_Money - // + // this.CB_Money.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Money.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Money.FormattingEnabled = true; @@ -366,18 +366,18 @@ private void InitializeComponent() this.CB_Money.Name = "CB_Money"; this.CB_Money.Size = new System.Drawing.Size(77, 21); this.CB_Money.TabIndex = 52; - // + // // L_Battle_Type - // + // this.L_Battle_Type.AutoSize = true; this.L_Battle_Type.Location = new System.Drawing.Point(51, 70); this.L_Battle_Type.Name = "L_Battle_Type"; this.L_Battle_Type.Size = new System.Drawing.Size(64, 13); this.L_Battle_Type.TabIndex = 51; this.L_Battle_Type.Text = "Battle Type:"; - // + // // CB_Battle_Type - // + // this.CB_Battle_Type.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Battle_Type.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Battle_Type.FormattingEnabled = true; @@ -391,18 +391,18 @@ private void InitializeComponent() this.CB_Battle_Type.Name = "CB_Battle_Type"; this.CB_Battle_Type.Size = new System.Drawing.Size(151, 21); this.CB_Battle_Type.TabIndex = 50; - // + // // L_Trainer_Class - // + // this.L_Trainer_Class.AutoSize = true; this.L_Trainer_Class.Location = new System.Drawing.Point(44, 43); this.L_Trainer_Class.Name = "L_Trainer_Class"; this.L_Trainer_Class.Size = new System.Drawing.Size(71, 13); this.L_Trainer_Class.TabIndex = 49; this.L_Trainer_Class.Text = "Trainer Class:"; - // + // // CB_Trainer_Class - // + // this.CB_Trainer_Class.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Trainer_Class.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Trainer_Class.DropDownWidth = 165; @@ -411,9 +411,9 @@ private void InitializeComponent() this.CB_Trainer_Class.Name = "CB_Trainer_Class"; this.CB_Trainer_Class.Size = new System.Drawing.Size(151, 21); this.CB_Trainer_Class.TabIndex = 48; - // + // // checkBox_Moves - // + // this.checkBox_Moves.AutoSize = true; this.checkBox_Moves.Location = new System.Drawing.Point(452, 28); this.checkBox_Moves.Name = "checkBox_Moves"; @@ -421,10 +421,10 @@ private void InitializeComponent() this.checkBox_Moves.TabIndex = 40; this.checkBox_Moves.Text = "Moves"; this.checkBox_Moves.UseVisualStyleBackColor = true; - this.checkBox_Moves.CheckedChanged += new System.EventHandler(this.changeTrainerType); - // + this.checkBox_Moves.CheckedChanged += new System.EventHandler(this.ChangeTrainerType); + // // checkBox_Item - // + // this.checkBox_Item.AutoSize = true; this.checkBox_Item.Location = new System.Drawing.Point(452, 44); this.checkBox_Item.Name = "checkBox_Item"; @@ -432,19 +432,19 @@ private void InitializeComponent() this.checkBox_Item.TabIndex = 39; this.checkBox_Item.Text = "Items"; this.checkBox_Item.UseVisualStyleBackColor = true; - this.checkBox_Item.CheckedChanged += new System.EventHandler(this.changeTrainerType); - // + this.checkBox_Item.CheckedChanged += new System.EventHandler(this.ChangeTrainerType); + // // L_Item_4 - // + // this.L_Item_4.AutoSize = true; this.L_Item_4.Location = new System.Drawing.Point(276, 97); this.L_Item_4.Name = "L_Item_4"; this.L_Item_4.Size = new System.Drawing.Size(39, 13); this.L_Item_4.TabIndex = 34; this.L_Item_4.Text = "Item 4:"; - // + // // CB_Item_4 - // + // this.CB_Item_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_4.FormattingEnabled = true; @@ -452,18 +452,18 @@ private void InitializeComponent() this.CB_Item_4.Name = "CB_Item_4"; this.CB_Item_4.Size = new System.Drawing.Size(121, 21); this.CB_Item_4.TabIndex = 33; - // + // // L_Item_3 - // + // this.L_Item_3.AutoSize = true; this.L_Item_3.Location = new System.Drawing.Point(276, 70); this.L_Item_3.Name = "L_Item_3"; this.L_Item_3.Size = new System.Drawing.Size(39, 13); this.L_Item_3.TabIndex = 32; this.L_Item_3.Text = "Item 3:"; - // + // // CB_Item_3 - // + // this.CB_Item_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_3.FormattingEnabled = true; @@ -471,18 +471,18 @@ private void InitializeComponent() this.CB_Item_3.Name = "CB_Item_3"; this.CB_Item_3.Size = new System.Drawing.Size(121, 21); this.CB_Item_3.TabIndex = 31; - // + // // L_Item_2 - // + // this.L_Item_2.AutoSize = true; this.L_Item_2.Location = new System.Drawing.Point(276, 43); this.L_Item_2.Name = "L_Item_2"; this.L_Item_2.Size = new System.Drawing.Size(39, 13); this.L_Item_2.TabIndex = 30; this.L_Item_2.Text = "Item 2:"; - // + // // CB_Item_2 - // + // this.CB_Item_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_2.FormattingEnabled = true; @@ -490,18 +490,18 @@ private void InitializeComponent() this.CB_Item_2.Name = "CB_Item_2"; this.CB_Item_2.Size = new System.Drawing.Size(121, 21); this.CB_Item_2.TabIndex = 29; - // + // // L_Item_1 - // + // this.L_Item_1.AutoSize = true; this.L_Item_1.Location = new System.Drawing.Point(276, 16); this.L_Item_1.Name = "L_Item_1"; this.L_Item_1.Size = new System.Drawing.Size(39, 13); this.L_Item_1.TabIndex = 28; this.L_Item_1.Text = "Item 1:"; - // + // // CB_Item_1 - // + // this.CB_Item_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Item_1.FormattingEnabled = true; @@ -509,18 +509,18 @@ private void InitializeComponent() this.CB_Item_1.Name = "CB_Item_1"; this.CB_Item_1.Size = new System.Drawing.Size(121, 21); this.CB_Item_1.TabIndex = 27; - // + // // L_numPokemon - // + // this.L_numPokemon.AutoSize = true; this.L_numPokemon.Location = new System.Drawing.Point(8, 16); this.L_numPokemon.Name = "L_numPokemon"; this.L_numPokemon.Size = new System.Drawing.Size(107, 13); this.L_numPokemon.TabIndex = 22; this.L_numPokemon.Text = "Number of Pokémon:"; - // + // // CB_numPokemon - // + // this.CB_numPokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_numPokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_numPokemon.FormattingEnabled = true; @@ -536,10 +536,10 @@ private void InitializeComponent() this.CB_numPokemon.Name = "CB_numPokemon"; this.CB_numPokemon.Size = new System.Drawing.Size(151, 21); this.CB_numPokemon.TabIndex = 21; - this.CB_numPokemon.SelectedIndexChanged += new System.EventHandler(this.changeTrainerType); - // + this.CB_numPokemon.SelectedIndexChanged += new System.EventHandler(this.ChangeTrainerType); + // // tabPage2 - // + // this.tabPage2.BackColor = System.Drawing.SystemColors.Control; this.tabPage2.Controls.Add(this.L_Pokemon_1_Form); this.tabPage2.Controls.Add(this.CB_Pokemon_1_Ability); @@ -569,18 +569,18 @@ private void InitializeComponent() this.tabPage2.Size = new System.Drawing.Size(557, 127); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Pokémon 1"; - // + // // L_Pokemon_1_Form - // + // this.L_Pokemon_1_Form.AutoSize = true; this.L_Pokemon_1_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_1_Form.Name = "L_Pokemon_1_Form"; this.L_Pokemon_1_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_1_Form.TabIndex = 63; this.L_Pokemon_1_Form.Text = "Form:"; - // + // // CB_Pokemon_1_Ability - // + // this.CB_Pokemon_1_Ability.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Ability.Enabled = false; @@ -589,18 +589,18 @@ private void InitializeComponent() this.CB_Pokemon_1_Ability.Name = "CB_Pokemon_1_Ability"; this.CB_Pokemon_1_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_1_Ability.TabIndex = 62; - // + // // L_Pokemon_1_Gender - // + // this.L_Pokemon_1_Gender.AutoSize = true; this.L_Pokemon_1_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_1_Gender.Name = "L_Pokemon_1_Gender"; this.L_Pokemon_1_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_1_Gender.TabIndex = 59; this.L_Pokemon_1_Gender.Text = "Gender:"; - // + // // CB_Pokemon_1_Gender - // + // this.CB_Pokemon_1_Gender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Gender.Enabled = false; @@ -609,19 +609,19 @@ private void InitializeComponent() this.CB_Pokemon_1_Gender.Name = "CB_Pokemon_1_Gender"; this.CB_Pokemon_1_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_1_Gender.TabIndex = 58; - this.CB_Pokemon_1_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_1_Gender.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_1_Ability - // + // this.L_Pokemon_1_Ability.AutoSize = true; this.L_Pokemon_1_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_1_Ability.Name = "L_Pokemon_1_Ability"; this.L_Pokemon_1_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_1_Ability.TabIndex = 57; this.L_Pokemon_1_Ability.Text = "Ability:"; - // + // // CB_Pokemon_1_Form - // + // this.CB_Pokemon_1_Form.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Form.Enabled = false; @@ -630,19 +630,19 @@ private void InitializeComponent() this.CB_Pokemon_1_Form.Name = "CB_Pokemon_1_Form"; this.CB_Pokemon_1_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Form.TabIndex = 56; - this.CB_Pokemon_1_Form.SelectedIndexChanged += new System.EventHandler(this.refreshFormAbility); - // + this.CB_Pokemon_1_Form.SelectedIndexChanged += new System.EventHandler(this.RefreshFormAbility); + // // L_Pokemon_1_IVs - // + // this.L_Pokemon_1_IVs.AutoSize = true; this.L_Pokemon_1_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_1_IVs.Name = "L_Pokemon_1_IVs"; this.L_Pokemon_1_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_1_IVs.TabIndex = 36; this.L_Pokemon_1_IVs.Text = "IVs:"; - // + // // CB_Pokemon_1_IVs - // + // this.CB_Pokemon_1_IVs.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_IVs.Enabled = false; @@ -651,18 +651,18 @@ private void InitializeComponent() this.CB_Pokemon_1_IVs.Name = "CB_Pokemon_1_IVs"; this.CB_Pokemon_1_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_1_IVs.TabIndex = 35; - // + // // L_Pokemon_1_Move_4 - // + // this.L_Pokemon_1_Move_4.AutoSize = true; this.L_Pokemon_1_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_1_Move_4.Name = "L_Pokemon_1_Move_4"; this.L_Pokemon_1_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_4.TabIndex = 34; this.L_Pokemon_1_Move_4.Text = "Move 4:"; - // + // // CB_Pokemon_1_Move_4 - // + // this.CB_Pokemon_1_Move_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_4.Enabled = false; @@ -671,18 +671,18 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_4.Name = "CB_Pokemon_1_Move_4"; this.CB_Pokemon_1_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_4.TabIndex = 33; - // + // // L_Pokemon_1_Move_3 - // + // this.L_Pokemon_1_Move_3.AutoSize = true; this.L_Pokemon_1_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_1_Move_3.Name = "L_Pokemon_1_Move_3"; this.L_Pokemon_1_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_3.TabIndex = 32; this.L_Pokemon_1_Move_3.Text = "Move 3:"; - // + // // CB_Pokemon_1_Move_3 - // + // this.CB_Pokemon_1_Move_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_3.Enabled = false; @@ -691,18 +691,18 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_3.Name = "CB_Pokemon_1_Move_3"; this.CB_Pokemon_1_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_3.TabIndex = 31; - // + // // L_Pokemon_1_Move_2 - // + // this.L_Pokemon_1_Move_2.AutoSize = true; this.L_Pokemon_1_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_1_Move_2.Name = "L_Pokemon_1_Move_2"; this.L_Pokemon_1_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_2.TabIndex = 30; this.L_Pokemon_1_Move_2.Text = "Move 2:"; - // + // // CB_Pokemon_1_Move_2 - // + // this.CB_Pokemon_1_Move_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_2.Enabled = false; @@ -711,18 +711,18 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_2.Name = "CB_Pokemon_1_Move_2"; this.CB_Pokemon_1_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_2.TabIndex = 29; - // + // // L_Pokemon_1_Move_1 - // + // this.L_Pokemon_1_Move_1.AutoSize = true; this.L_Pokemon_1_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_1_Move_1.Name = "L_Pokemon_1_Move_1"; this.L_Pokemon_1_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_1_Move_1.TabIndex = 28; this.L_Pokemon_1_Move_1.Text = "Move 1:"; - // + // // CB_Pokemon_1_Move_1 - // + // this.CB_Pokemon_1_Move_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Move_1.Enabled = false; @@ -731,18 +731,18 @@ private void InitializeComponent() this.CB_Pokemon_1_Move_1.Name = "CB_Pokemon_1_Move_1"; this.CB_Pokemon_1_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Move_1.TabIndex = 27; - // + // // L_Pokemon_1_Item - // + // this.L_Pokemon_1_Item.AutoSize = true; this.L_Pokemon_1_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_1_Item.Name = "L_Pokemon_1_Item"; this.L_Pokemon_1_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_1_Item.TabIndex = 26; this.L_Pokemon_1_Item.Text = "Item:"; - // + // // CB_Pokemon_1_Item - // + // this.CB_Pokemon_1_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Item.Enabled = false; @@ -751,19 +751,19 @@ private void InitializeComponent() this.CB_Pokemon_1_Item.Name = "CB_Pokemon_1_Item"; this.CB_Pokemon_1_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Item.TabIndex = 25; - this.CB_Pokemon_1_Item.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_1_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_1_Level - // + // this.L_Pokemon_1_Level.AutoSize = true; this.L_Pokemon_1_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_1_Level.Name = "L_Pokemon_1_Level"; this.L_Pokemon_1_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_1_Level.TabIndex = 24; this.L_Pokemon_1_Level.Text = "Level:"; - // + // // CB_Pokemon_1_Level - // + // this.CB_Pokemon_1_Level.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Level.Enabled = false; @@ -772,18 +772,18 @@ private void InitializeComponent() this.CB_Pokemon_1_Level.Name = "CB_Pokemon_1_Level"; this.CB_Pokemon_1_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Level.TabIndex = 23; - // + // // L_Pokemon_1_Pokemon - // + // this.L_Pokemon_1_Pokemon.AutoSize = true; this.L_Pokemon_1_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_1_Pokemon.Name = "L_Pokemon_1_Pokemon"; this.L_Pokemon_1_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_1_Pokemon.TabIndex = 22; this.L_Pokemon_1_Pokemon.Text = "Pokémon:"; - // + // // CB_Pokemon_1_Pokemon - // + // this.CB_Pokemon_1_Pokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_1_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_1_Pokemon.Enabled = false; @@ -792,10 +792,10 @@ private void InitializeComponent() this.CB_Pokemon_1_Pokemon.Name = "CB_Pokemon_1_Pokemon"; this.CB_Pokemon_1_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_1_Pokemon.TabIndex = 21; - this.CB_Pokemon_1_Pokemon.SelectedIndexChanged += new System.EventHandler(this.refreshSpeciesAbility); - // + this.CB_Pokemon_1_Pokemon.SelectedIndexChanged += new System.EventHandler(this.RefreshSpeciesAbility); + // // tabPage3 - // + // this.tabPage3.BackColor = System.Drawing.SystemColors.Control; this.tabPage3.Controls.Add(this.L_Pokemon_2_Gender); this.tabPage3.Controls.Add(this.CB_Pokemon_2_Gender); @@ -825,18 +825,18 @@ private void InitializeComponent() this.tabPage3.Size = new System.Drawing.Size(557, 127); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Pokémon 2"; - // + // // L_Pokemon_2_Gender - // + // this.L_Pokemon_2_Gender.AutoSize = true; this.L_Pokemon_2_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_2_Gender.Name = "L_Pokemon_2_Gender"; this.L_Pokemon_2_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_2_Gender.TabIndex = 65; this.L_Pokemon_2_Gender.Text = "Gender:"; - // + // // CB_Pokemon_2_Gender - // + // this.CB_Pokemon_2_Gender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Gender.Enabled = false; @@ -845,19 +845,19 @@ private void InitializeComponent() this.CB_Pokemon_2_Gender.Name = "CB_Pokemon_2_Gender"; this.CB_Pokemon_2_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_2_Gender.TabIndex = 64; - this.CB_Pokemon_2_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_2_Gender.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_2_Ability - // + // this.L_Pokemon_2_Ability.AutoSize = true; this.L_Pokemon_2_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_2_Ability.Name = "L_Pokemon_2_Ability"; this.L_Pokemon_2_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_2_Ability.TabIndex = 63; this.L_Pokemon_2_Ability.Text = "Ability:"; - // + // // CB_Pokemon_2_Ability - // + // this.CB_Pokemon_2_Ability.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Ability.Enabled = false; @@ -866,18 +866,18 @@ private void InitializeComponent() this.CB_Pokemon_2_Ability.Name = "CB_Pokemon_2_Ability"; this.CB_Pokemon_2_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_2_Ability.TabIndex = 62; - // + // // L_Pokemon_2_Form - // + // this.L_Pokemon_2_Form.AutoSize = true; this.L_Pokemon_2_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_2_Form.Name = "L_Pokemon_2_Form"; this.L_Pokemon_2_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_2_Form.TabIndex = 59; this.L_Pokemon_2_Form.Text = "Form:"; - // + // // CB_Pokemon_2_Form - // + // this.CB_Pokemon_2_Form.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Form.Enabled = false; @@ -886,19 +886,19 @@ private void InitializeComponent() this.CB_Pokemon_2_Form.Name = "CB_Pokemon_2_Form"; this.CB_Pokemon_2_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Form.TabIndex = 58; - this.CB_Pokemon_2_Form.SelectedIndexChanged += new System.EventHandler(this.refreshFormAbility); - // + this.CB_Pokemon_2_Form.SelectedIndexChanged += new System.EventHandler(this.RefreshFormAbility); + // // L_Pokemon_2_IVs - // + // this.L_Pokemon_2_IVs.AutoSize = true; this.L_Pokemon_2_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_2_IVs.Name = "L_Pokemon_2_IVs"; this.L_Pokemon_2_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_2_IVs.TabIndex = 38; this.L_Pokemon_2_IVs.Text = "IVs:"; - // + // // CB_Pokemon_2_IVs - // + // this.CB_Pokemon_2_IVs.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_IVs.Enabled = false; @@ -907,18 +907,18 @@ private void InitializeComponent() this.CB_Pokemon_2_IVs.Name = "CB_Pokemon_2_IVs"; this.CB_Pokemon_2_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_2_IVs.TabIndex = 37; - // + // // L_Pokemon_2_Move_4 - // + // this.L_Pokemon_2_Move_4.AutoSize = true; this.L_Pokemon_2_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_2_Move_4.Name = "L_Pokemon_2_Move_4"; this.L_Pokemon_2_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_4.TabIndex = 34; this.L_Pokemon_2_Move_4.Text = "Move 4:"; - // + // // CB_Pokemon_2_Move_4 - // + // this.CB_Pokemon_2_Move_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_4.Enabled = false; @@ -927,18 +927,18 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_4.Name = "CB_Pokemon_2_Move_4"; this.CB_Pokemon_2_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_4.TabIndex = 33; - // + // // L_Pokemon_2_Move_3 - // + // this.L_Pokemon_2_Move_3.AutoSize = true; this.L_Pokemon_2_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_2_Move_3.Name = "L_Pokemon_2_Move_3"; this.L_Pokemon_2_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_3.TabIndex = 32; this.L_Pokemon_2_Move_3.Text = "Move 3:"; - // + // // CB_Pokemon_2_Move_3 - // + // this.CB_Pokemon_2_Move_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_3.Enabled = false; @@ -947,18 +947,18 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_3.Name = "CB_Pokemon_2_Move_3"; this.CB_Pokemon_2_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_3.TabIndex = 31; - // + // // L_Pokemon_2_Move_2 - // + // this.L_Pokemon_2_Move_2.AutoSize = true; this.L_Pokemon_2_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_2_Move_2.Name = "L_Pokemon_2_Move_2"; this.L_Pokemon_2_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_2.TabIndex = 30; this.L_Pokemon_2_Move_2.Text = "Move 2:"; - // + // // CB_Pokemon_2_Move_2 - // + // this.CB_Pokemon_2_Move_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_2.Enabled = false; @@ -967,18 +967,18 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_2.Name = "CB_Pokemon_2_Move_2"; this.CB_Pokemon_2_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_2.TabIndex = 29; - // + // // L_Pokemon_2_Move_1 - // + // this.L_Pokemon_2_Move_1.AutoSize = true; this.L_Pokemon_2_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_2_Move_1.Name = "L_Pokemon_2_Move_1"; this.L_Pokemon_2_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_2_Move_1.TabIndex = 28; this.L_Pokemon_2_Move_1.Text = "Move 1:"; - // + // // CB_Pokemon_2_Move_1 - // + // this.CB_Pokemon_2_Move_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Move_1.Enabled = false; @@ -987,18 +987,18 @@ private void InitializeComponent() this.CB_Pokemon_2_Move_1.Name = "CB_Pokemon_2_Move_1"; this.CB_Pokemon_2_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Move_1.TabIndex = 27; - // + // // L_Pokemon_2_Item - // + // this.L_Pokemon_2_Item.AutoSize = true; this.L_Pokemon_2_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_2_Item.Name = "L_Pokemon_2_Item"; this.L_Pokemon_2_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_2_Item.TabIndex = 26; this.L_Pokemon_2_Item.Text = "Item:"; - // + // // CB_Pokemon_2_Item - // + // this.CB_Pokemon_2_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Item.Enabled = false; @@ -1007,19 +1007,19 @@ private void InitializeComponent() this.CB_Pokemon_2_Item.Name = "CB_Pokemon_2_Item"; this.CB_Pokemon_2_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Item.TabIndex = 25; - this.CB_Pokemon_2_Item.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_2_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_CB_Pokemon_2_Level - // + // this.L_CB_Pokemon_2_Level.AutoSize = true; this.L_CB_Pokemon_2_Level.Location = new System.Drawing.Point(26, 71); this.L_CB_Pokemon_2_Level.Name = "L_CB_Pokemon_2_Level"; this.L_CB_Pokemon_2_Level.Size = new System.Drawing.Size(36, 13); this.L_CB_Pokemon_2_Level.TabIndex = 24; this.L_CB_Pokemon_2_Level.Text = "Level:"; - // + // // CB_Pokemon_2_Level - // + // this.CB_Pokemon_2_Level.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Level.Enabled = false; @@ -1028,18 +1028,18 @@ private void InitializeComponent() this.CB_Pokemon_2_Level.Name = "CB_Pokemon_2_Level"; this.CB_Pokemon_2_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Level.TabIndex = 23; - // + // // L_Pokemon_2_Pokemon - // + // this.L_Pokemon_2_Pokemon.AutoSize = true; this.L_Pokemon_2_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_2_Pokemon.Name = "L_Pokemon_2_Pokemon"; this.L_Pokemon_2_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_2_Pokemon.TabIndex = 22; this.L_Pokemon_2_Pokemon.Text = "Pokémon:"; - // + // // CB_Pokemon_2_Pokemon - // + // this.CB_Pokemon_2_Pokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_2_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_2_Pokemon.Enabled = false; @@ -1048,10 +1048,10 @@ private void InitializeComponent() this.CB_Pokemon_2_Pokemon.Name = "CB_Pokemon_2_Pokemon"; this.CB_Pokemon_2_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_2_Pokemon.TabIndex = 21; - this.CB_Pokemon_2_Pokemon.SelectedIndexChanged += new System.EventHandler(this.refreshSpeciesAbility); - // + this.CB_Pokemon_2_Pokemon.SelectedIndexChanged += new System.EventHandler(this.RefreshSpeciesAbility); + // // tabPage4 - // + // this.tabPage4.BackColor = System.Drawing.SystemColors.Control; this.tabPage4.Controls.Add(this.L_Pokemon_3_Gender); this.tabPage4.Controls.Add(this.CB_Pokemon_3_Gender); @@ -1081,18 +1081,18 @@ private void InitializeComponent() this.tabPage4.Size = new System.Drawing.Size(557, 127); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "Pokémon 3"; - // + // // L_Pokemon_3_Gender - // + // this.L_Pokemon_3_Gender.AutoSize = true; this.L_Pokemon_3_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_3_Gender.Name = "L_Pokemon_3_Gender"; this.L_Pokemon_3_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_3_Gender.TabIndex = 65; this.L_Pokemon_3_Gender.Text = "Gender:"; - // + // // CB_Pokemon_3_Gender - // + // this.CB_Pokemon_3_Gender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Gender.Enabled = false; @@ -1101,19 +1101,19 @@ private void InitializeComponent() this.CB_Pokemon_3_Gender.Name = "CB_Pokemon_3_Gender"; this.CB_Pokemon_3_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_3_Gender.TabIndex = 64; - this.CB_Pokemon_3_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_3_Gender.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_3_Ability - // + // this.L_Pokemon_3_Ability.AutoSize = true; this.L_Pokemon_3_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_3_Ability.Name = "L_Pokemon_3_Ability"; this.L_Pokemon_3_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_3_Ability.TabIndex = 63; this.L_Pokemon_3_Ability.Text = "Ability:"; - // + // // CB_Pokemon_3_Ability - // + // this.CB_Pokemon_3_Ability.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Ability.Enabled = false; @@ -1122,18 +1122,18 @@ private void InitializeComponent() this.CB_Pokemon_3_Ability.Name = "CB_Pokemon_3_Ability"; this.CB_Pokemon_3_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_3_Ability.TabIndex = 62; - // + // // L_Pokemon_3_Form - // + // this.L_Pokemon_3_Form.AutoSize = true; this.L_Pokemon_3_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_3_Form.Name = "L_Pokemon_3_Form"; this.L_Pokemon_3_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_3_Form.TabIndex = 59; this.L_Pokemon_3_Form.Text = "Form:"; - // + // // CB_Pokemon_3_Form - // + // this.CB_Pokemon_3_Form.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Form.Enabled = false; @@ -1142,19 +1142,19 @@ private void InitializeComponent() this.CB_Pokemon_3_Form.Name = "CB_Pokemon_3_Form"; this.CB_Pokemon_3_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Form.TabIndex = 58; - this.CB_Pokemon_3_Form.SelectedIndexChanged += new System.EventHandler(this.refreshFormAbility); - // + this.CB_Pokemon_3_Form.SelectedIndexChanged += new System.EventHandler(this.RefreshFormAbility); + // // L_Pokemon_3_IVs - // + // this.L_Pokemon_3_IVs.AutoSize = true; this.L_Pokemon_3_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_3_IVs.Name = "L_Pokemon_3_IVs"; this.L_Pokemon_3_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_3_IVs.TabIndex = 38; this.L_Pokemon_3_IVs.Text = "IVs:"; - // + // // CB_Pokemon_3_IVs - // + // this.CB_Pokemon_3_IVs.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_IVs.Enabled = false; @@ -1163,18 +1163,18 @@ private void InitializeComponent() this.CB_Pokemon_3_IVs.Name = "CB_Pokemon_3_IVs"; this.CB_Pokemon_3_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_3_IVs.TabIndex = 37; - // + // // L_Pokemon_3_Move_4 - // + // this.L_Pokemon_3_Move_4.AutoSize = true; this.L_Pokemon_3_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_3_Move_4.Name = "L_Pokemon_3_Move_4"; this.L_Pokemon_3_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_4.TabIndex = 34; this.L_Pokemon_3_Move_4.Text = "Move 4:"; - // + // // CB_Pokemon_3_Move_4 - // + // this.CB_Pokemon_3_Move_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_4.Enabled = false; @@ -1183,18 +1183,18 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_4.Name = "CB_Pokemon_3_Move_4"; this.CB_Pokemon_3_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_4.TabIndex = 33; - // + // // L_Pokemon_3_Move_3 - // + // this.L_Pokemon_3_Move_3.AutoSize = true; this.L_Pokemon_3_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_3_Move_3.Name = "L_Pokemon_3_Move_3"; this.L_Pokemon_3_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_3.TabIndex = 32; this.L_Pokemon_3_Move_3.Text = "Move 3:"; - // + // // CB_Pokemon_3_Move_3 - // + // this.CB_Pokemon_3_Move_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_3.Enabled = false; @@ -1203,18 +1203,18 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_3.Name = "CB_Pokemon_3_Move_3"; this.CB_Pokemon_3_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_3.TabIndex = 31; - // + // // L_Pokemon_3_Move_2 - // + // this.L_Pokemon_3_Move_2.AutoSize = true; this.L_Pokemon_3_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_3_Move_2.Name = "L_Pokemon_3_Move_2"; this.L_Pokemon_3_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_2.TabIndex = 30; this.L_Pokemon_3_Move_2.Text = "Move 2:"; - // + // // CB_Pokemon_3_Move_2 - // + // this.CB_Pokemon_3_Move_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_2.Enabled = false; @@ -1223,18 +1223,18 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_2.Name = "CB_Pokemon_3_Move_2"; this.CB_Pokemon_3_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_2.TabIndex = 29; - // + // // L_Pokemon_3_Move_1 - // + // this.L_Pokemon_3_Move_1.AutoSize = true; this.L_Pokemon_3_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_3_Move_1.Name = "L_Pokemon_3_Move_1"; this.L_Pokemon_3_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_3_Move_1.TabIndex = 28; this.L_Pokemon_3_Move_1.Text = "Move 1:"; - // + // // CB_Pokemon_3_Move_1 - // + // this.CB_Pokemon_3_Move_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Move_1.Enabled = false; @@ -1243,18 +1243,18 @@ private void InitializeComponent() this.CB_Pokemon_3_Move_1.Name = "CB_Pokemon_3_Move_1"; this.CB_Pokemon_3_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Move_1.TabIndex = 27; - // + // // L_Pokemon_3_Item - // + // this.L_Pokemon_3_Item.AutoSize = true; this.L_Pokemon_3_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_3_Item.Name = "L_Pokemon_3_Item"; this.L_Pokemon_3_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_3_Item.TabIndex = 26; this.L_Pokemon_3_Item.Text = "Item:"; - // + // // CB_Pokemon_3_Item - // + // this.CB_Pokemon_3_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Item.Enabled = false; @@ -1263,19 +1263,19 @@ private void InitializeComponent() this.CB_Pokemon_3_Item.Name = "CB_Pokemon_3_Item"; this.CB_Pokemon_3_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Item.TabIndex = 25; - this.CB_Pokemon_3_Item.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_3_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_3_Level - // + // this.L_Pokemon_3_Level.AutoSize = true; this.L_Pokemon_3_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_3_Level.Name = "L_Pokemon_3_Level"; this.L_Pokemon_3_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_3_Level.TabIndex = 24; this.L_Pokemon_3_Level.Text = "Level:"; - // + // // CB_Pokemon_3_Level - // + // this.CB_Pokemon_3_Level.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Level.Enabled = false; @@ -1284,18 +1284,18 @@ private void InitializeComponent() this.CB_Pokemon_3_Level.Name = "CB_Pokemon_3_Level"; this.CB_Pokemon_3_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Level.TabIndex = 23; - // + // // L_Pokemon_3_Pokemon - // + // this.L_Pokemon_3_Pokemon.AutoSize = true; this.L_Pokemon_3_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_3_Pokemon.Name = "L_Pokemon_3_Pokemon"; this.L_Pokemon_3_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_3_Pokemon.TabIndex = 22; this.L_Pokemon_3_Pokemon.Text = "Pokémon:"; - // + // // CB_Pokemon_3_Pokemon - // + // this.CB_Pokemon_3_Pokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_3_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_3_Pokemon.Enabled = false; @@ -1304,10 +1304,10 @@ private void InitializeComponent() this.CB_Pokemon_3_Pokemon.Name = "CB_Pokemon_3_Pokemon"; this.CB_Pokemon_3_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_3_Pokemon.TabIndex = 21; - this.CB_Pokemon_3_Pokemon.SelectedIndexChanged += new System.EventHandler(this.refreshSpeciesAbility); - // + this.CB_Pokemon_3_Pokemon.SelectedIndexChanged += new System.EventHandler(this.RefreshSpeciesAbility); + // // tabPage5 - // + // this.tabPage5.BackColor = System.Drawing.SystemColors.Control; this.tabPage5.Controls.Add(this.L_Pokemon_4_Gender); this.tabPage5.Controls.Add(this.CB_Pokemon_4_Gender); @@ -1337,18 +1337,18 @@ private void InitializeComponent() this.tabPage5.Size = new System.Drawing.Size(557, 127); this.tabPage5.TabIndex = 4; this.tabPage5.Text = "Pokémon 4"; - // + // // L_Pokemon_4_Gender - // + // this.L_Pokemon_4_Gender.AutoSize = true; this.L_Pokemon_4_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_4_Gender.Name = "L_Pokemon_4_Gender"; this.L_Pokemon_4_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_4_Gender.TabIndex = 65; this.L_Pokemon_4_Gender.Text = "Gender:"; - // + // // CB_Pokemon_4_Gender - // + // this.CB_Pokemon_4_Gender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Gender.Enabled = false; @@ -1357,19 +1357,19 @@ private void InitializeComponent() this.CB_Pokemon_4_Gender.Name = "CB_Pokemon_4_Gender"; this.CB_Pokemon_4_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_4_Gender.TabIndex = 64; - this.CB_Pokemon_4_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_4_Gender.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_4_Ability - // + // this.L_Pokemon_4_Ability.AutoSize = true; this.L_Pokemon_4_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_4_Ability.Name = "L_Pokemon_4_Ability"; this.L_Pokemon_4_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_4_Ability.TabIndex = 63; this.L_Pokemon_4_Ability.Text = "Ability:"; - // + // // CB_Pokemon_4_Ability - // + // this.CB_Pokemon_4_Ability.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Ability.Enabled = false; @@ -1378,18 +1378,18 @@ private void InitializeComponent() this.CB_Pokemon_4_Ability.Name = "CB_Pokemon_4_Ability"; this.CB_Pokemon_4_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_4_Ability.TabIndex = 62; - // + // // L_Pokemon_4_Form - // + // this.L_Pokemon_4_Form.AutoSize = true; this.L_Pokemon_4_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_4_Form.Name = "L_Pokemon_4_Form"; this.L_Pokemon_4_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_4_Form.TabIndex = 59; this.L_Pokemon_4_Form.Text = "Form:"; - // + // // CB_Pokemon_4_Form - // + // this.CB_Pokemon_4_Form.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Form.Enabled = false; @@ -1398,19 +1398,19 @@ private void InitializeComponent() this.CB_Pokemon_4_Form.Name = "CB_Pokemon_4_Form"; this.CB_Pokemon_4_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Form.TabIndex = 58; - this.CB_Pokemon_4_Form.SelectedIndexChanged += new System.EventHandler(this.refreshFormAbility); - // + this.CB_Pokemon_4_Form.SelectedIndexChanged += new System.EventHandler(this.RefreshFormAbility); + // // L_Pokemon_4_IVs - // + // this.L_Pokemon_4_IVs.AutoSize = true; this.L_Pokemon_4_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_4_IVs.Name = "L_Pokemon_4_IVs"; this.L_Pokemon_4_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_4_IVs.TabIndex = 38; this.L_Pokemon_4_IVs.Text = "IVs:"; - // + // // CB_Pokemon_4_IVs - // + // this.CB_Pokemon_4_IVs.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_IVs.Enabled = false; @@ -1419,18 +1419,18 @@ private void InitializeComponent() this.CB_Pokemon_4_IVs.Name = "CB_Pokemon_4_IVs"; this.CB_Pokemon_4_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_4_IVs.TabIndex = 37; - // + // // L_Pokemon_4_Move_4 - // + // this.L_Pokemon_4_Move_4.AutoSize = true; this.L_Pokemon_4_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_4_Move_4.Name = "L_Pokemon_4_Move_4"; this.L_Pokemon_4_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_4.TabIndex = 34; this.L_Pokemon_4_Move_4.Text = "Move 4:"; - // + // // CB_Pokemon_4_Move_4 - // + // this.CB_Pokemon_4_Move_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_4.Enabled = false; @@ -1439,18 +1439,18 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_4.Name = "CB_Pokemon_4_Move_4"; this.CB_Pokemon_4_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_4.TabIndex = 33; - // + // // L_Pokemon_4_Move_3 - // + // this.L_Pokemon_4_Move_3.AutoSize = true; this.L_Pokemon_4_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_4_Move_3.Name = "L_Pokemon_4_Move_3"; this.L_Pokemon_4_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_3.TabIndex = 32; this.L_Pokemon_4_Move_3.Text = "Move 3:"; - // + // // CB_Pokemon_4_Move_3 - // + // this.CB_Pokemon_4_Move_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_3.Enabled = false; @@ -1459,18 +1459,18 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_3.Name = "CB_Pokemon_4_Move_3"; this.CB_Pokemon_4_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_3.TabIndex = 31; - // + // // L_Pokemon_4_Move_2 - // + // this.L_Pokemon_4_Move_2.AutoSize = true; this.L_Pokemon_4_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_4_Move_2.Name = "L_Pokemon_4_Move_2"; this.L_Pokemon_4_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_2.TabIndex = 30; this.L_Pokemon_4_Move_2.Text = "Move 2:"; - // + // // CB_Pokemon_4_Move_2 - // + // this.CB_Pokemon_4_Move_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_2.Enabled = false; @@ -1479,18 +1479,18 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_2.Name = "CB_Pokemon_4_Move_2"; this.CB_Pokemon_4_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_2.TabIndex = 29; - // + // // L_Pokemon_4_Move_1 - // + // this.L_Pokemon_4_Move_1.AutoSize = true; this.L_Pokemon_4_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_4_Move_1.Name = "L_Pokemon_4_Move_1"; this.L_Pokemon_4_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_4_Move_1.TabIndex = 28; this.L_Pokemon_4_Move_1.Text = "Move 1:"; - // + // // CB_Pokemon_4_Move_1 - // + // this.CB_Pokemon_4_Move_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Move_1.Enabled = false; @@ -1499,18 +1499,18 @@ private void InitializeComponent() this.CB_Pokemon_4_Move_1.Name = "CB_Pokemon_4_Move_1"; this.CB_Pokemon_4_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Move_1.TabIndex = 27; - // + // // L_CB_Pokemon_4_Item - // + // this.L_CB_Pokemon_4_Item.AutoSize = true; this.L_CB_Pokemon_4_Item.Location = new System.Drawing.Point(32, 98); this.L_CB_Pokemon_4_Item.Name = "L_CB_Pokemon_4_Item"; this.L_CB_Pokemon_4_Item.Size = new System.Drawing.Size(30, 13); this.L_CB_Pokemon_4_Item.TabIndex = 26; this.L_CB_Pokemon_4_Item.Text = "Item:"; - // + // // CB_Pokemon_4_Item - // + // this.CB_Pokemon_4_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Item.Enabled = false; @@ -1519,19 +1519,19 @@ private void InitializeComponent() this.CB_Pokemon_4_Item.Name = "CB_Pokemon_4_Item"; this.CB_Pokemon_4_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Item.TabIndex = 25; - this.CB_Pokemon_4_Item.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_4_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_4_Level - // + // this.L_Pokemon_4_Level.AutoSize = true; this.L_Pokemon_4_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_4_Level.Name = "L_Pokemon_4_Level"; this.L_Pokemon_4_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_4_Level.TabIndex = 24; this.L_Pokemon_4_Level.Text = "Level:"; - // + // // CB_Pokemon_4_Level - // + // this.CB_Pokemon_4_Level.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Level.Enabled = false; @@ -1540,18 +1540,18 @@ private void InitializeComponent() this.CB_Pokemon_4_Level.Name = "CB_Pokemon_4_Level"; this.CB_Pokemon_4_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Level.TabIndex = 23; - // + // // L_Pokemon_4_Pokemon - // + // this.L_Pokemon_4_Pokemon.AutoSize = true; this.L_Pokemon_4_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_4_Pokemon.Name = "L_Pokemon_4_Pokemon"; this.L_Pokemon_4_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_4_Pokemon.TabIndex = 22; this.L_Pokemon_4_Pokemon.Text = "Pokémon:"; - // + // // CB_Pokemon_4_Pokemon - // + // this.CB_Pokemon_4_Pokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_4_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_4_Pokemon.Enabled = false; @@ -1560,10 +1560,10 @@ private void InitializeComponent() this.CB_Pokemon_4_Pokemon.Name = "CB_Pokemon_4_Pokemon"; this.CB_Pokemon_4_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_4_Pokemon.TabIndex = 21; - this.CB_Pokemon_4_Pokemon.SelectedIndexChanged += new System.EventHandler(this.refreshSpeciesAbility); - // + this.CB_Pokemon_4_Pokemon.SelectedIndexChanged += new System.EventHandler(this.RefreshSpeciesAbility); + // // tabPage6 - // + // this.tabPage6.BackColor = System.Drawing.SystemColors.Control; this.tabPage6.Controls.Add(this.L_Pokemon_5_Gender); this.tabPage6.Controls.Add(this.CB_Pokemon_5_Gender); @@ -1593,18 +1593,18 @@ private void InitializeComponent() this.tabPage6.Size = new System.Drawing.Size(557, 127); this.tabPage6.TabIndex = 5; this.tabPage6.Text = "Pokémon 5"; - // + // // L_Pokemon_5_Gender - // + // this.L_Pokemon_5_Gender.AutoSize = true; this.L_Pokemon_5_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_5_Gender.Name = "L_Pokemon_5_Gender"; this.L_Pokemon_5_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_5_Gender.TabIndex = 65; this.L_Pokemon_5_Gender.Text = "Gender:"; - // + // // CB_Pokemon_5_Gender - // + // this.CB_Pokemon_5_Gender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Gender.Enabled = false; @@ -1613,19 +1613,19 @@ private void InitializeComponent() this.CB_Pokemon_5_Gender.Name = "CB_Pokemon_5_Gender"; this.CB_Pokemon_5_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_5_Gender.TabIndex = 64; - this.CB_Pokemon_5_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_5_Gender.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_5_Ability - // + // this.L_Pokemon_5_Ability.AutoSize = true; this.L_Pokemon_5_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_5_Ability.Name = "L_Pokemon_5_Ability"; this.L_Pokemon_5_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_5_Ability.TabIndex = 63; this.L_Pokemon_5_Ability.Text = "Ability:"; - // + // // CB_Pokemon_5_Ability - // + // this.CB_Pokemon_5_Ability.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Ability.Enabled = false; @@ -1634,18 +1634,18 @@ private void InitializeComponent() this.CB_Pokemon_5_Ability.Name = "CB_Pokemon_5_Ability"; this.CB_Pokemon_5_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_5_Ability.TabIndex = 62; - // + // // L_Pokemon_5_Form - // + // this.L_Pokemon_5_Form.AutoSize = true; this.L_Pokemon_5_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_5_Form.Name = "L_Pokemon_5_Form"; this.L_Pokemon_5_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_5_Form.TabIndex = 59; this.L_Pokemon_5_Form.Text = "Form:"; - // + // // CB_Pokemon_5_Form - // + // this.CB_Pokemon_5_Form.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Form.Enabled = false; @@ -1654,19 +1654,19 @@ private void InitializeComponent() this.CB_Pokemon_5_Form.Name = "CB_Pokemon_5_Form"; this.CB_Pokemon_5_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Form.TabIndex = 58; - this.CB_Pokemon_5_Form.SelectedIndexChanged += new System.EventHandler(this.refreshFormAbility); - // + this.CB_Pokemon_5_Form.SelectedIndexChanged += new System.EventHandler(this.RefreshFormAbility); + // // L_Pokemon_5_IVs - // + // this.L_Pokemon_5_IVs.AutoSize = true; this.L_Pokemon_5_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_5_IVs.Name = "L_Pokemon_5_IVs"; this.L_Pokemon_5_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_5_IVs.TabIndex = 38; this.L_Pokemon_5_IVs.Text = "IVs:"; - // + // // CB_Pokemon_5_IVs - // + // this.CB_Pokemon_5_IVs.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_IVs.Enabled = false; @@ -1675,18 +1675,18 @@ private void InitializeComponent() this.CB_Pokemon_5_IVs.Name = "CB_Pokemon_5_IVs"; this.CB_Pokemon_5_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_5_IVs.TabIndex = 37; - // + // // L_Pokemon_5_Move_4 - // + // this.L_Pokemon_5_Move_4.AutoSize = true; this.L_Pokemon_5_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_5_Move_4.Name = "L_Pokemon_5_Move_4"; this.L_Pokemon_5_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_4.TabIndex = 34; this.L_Pokemon_5_Move_4.Text = "Move 4:"; - // + // // CB_Pokemon_5_Move_4 - // + // this.CB_Pokemon_5_Move_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_4.Enabled = false; @@ -1695,18 +1695,18 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_4.Name = "CB_Pokemon_5_Move_4"; this.CB_Pokemon_5_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_4.TabIndex = 33; - // + // // L_Pokemon_5_Move_3 - // + // this.L_Pokemon_5_Move_3.AutoSize = true; this.L_Pokemon_5_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_5_Move_3.Name = "L_Pokemon_5_Move_3"; this.L_Pokemon_5_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_3.TabIndex = 32; this.L_Pokemon_5_Move_3.Text = "Move 3:"; - // + // // CB_Pokemon_5_Move_3 - // + // this.CB_Pokemon_5_Move_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_3.Enabled = false; @@ -1715,18 +1715,18 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_3.Name = "CB_Pokemon_5_Move_3"; this.CB_Pokemon_5_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_3.TabIndex = 31; - // + // // L_Pokemon_5_Move_2 - // + // this.L_Pokemon_5_Move_2.AutoSize = true; this.L_Pokemon_5_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_5_Move_2.Name = "L_Pokemon_5_Move_2"; this.L_Pokemon_5_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_2.TabIndex = 30; this.L_Pokemon_5_Move_2.Text = "Move 2:"; - // + // // CB_Pokemon_5_Move_2 - // + // this.CB_Pokemon_5_Move_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_2.Enabled = false; @@ -1735,18 +1735,18 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_2.Name = "CB_Pokemon_5_Move_2"; this.CB_Pokemon_5_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_2.TabIndex = 29; - // + // // L_Pokemon_5_Move_1 - // + // this.L_Pokemon_5_Move_1.AutoSize = true; this.L_Pokemon_5_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_5_Move_1.Name = "L_Pokemon_5_Move_1"; this.L_Pokemon_5_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_5_Move_1.TabIndex = 28; this.L_Pokemon_5_Move_1.Text = "Move 1:"; - // + // // CB_Pokemon_5_Move_1 - // + // this.CB_Pokemon_5_Move_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Move_1.Enabled = false; @@ -1755,18 +1755,18 @@ private void InitializeComponent() this.CB_Pokemon_5_Move_1.Name = "CB_Pokemon_5_Move_1"; this.CB_Pokemon_5_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Move_1.TabIndex = 27; - // + // // L_Pokemon_5_Item - // + // this.L_Pokemon_5_Item.AutoSize = true; this.L_Pokemon_5_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_5_Item.Name = "L_Pokemon_5_Item"; this.L_Pokemon_5_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_5_Item.TabIndex = 26; this.L_Pokemon_5_Item.Text = "Item:"; - // + // // CB_Pokemon_5_Item - // + // this.CB_Pokemon_5_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Item.Enabled = false; @@ -1775,19 +1775,19 @@ private void InitializeComponent() this.CB_Pokemon_5_Item.Name = "CB_Pokemon_5_Item"; this.CB_Pokemon_5_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Item.TabIndex = 25; - this.CB_Pokemon_5_Item.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_5_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_5_Level - // + // this.L_Pokemon_5_Level.AutoSize = true; this.L_Pokemon_5_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_5_Level.Name = "L_Pokemon_5_Level"; this.L_Pokemon_5_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_5_Level.TabIndex = 24; this.L_Pokemon_5_Level.Text = "Level:"; - // + // // CB_Pokemon_5_Level - // + // this.CB_Pokemon_5_Level.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Level.Enabled = false; @@ -1796,18 +1796,18 @@ private void InitializeComponent() this.CB_Pokemon_5_Level.Name = "CB_Pokemon_5_Level"; this.CB_Pokemon_5_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Level.TabIndex = 23; - // + // // L_Pokemon_5_Pokemon - // + // this.L_Pokemon_5_Pokemon.AutoSize = true; this.L_Pokemon_5_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_5_Pokemon.Name = "L_Pokemon_5_Pokemon"; this.L_Pokemon_5_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_5_Pokemon.TabIndex = 22; this.L_Pokemon_5_Pokemon.Text = "Pokémon:"; - // + // // CB_Pokemon_5_Pokemon - // + // this.CB_Pokemon_5_Pokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_5_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_5_Pokemon.Enabled = false; @@ -1816,10 +1816,10 @@ private void InitializeComponent() this.CB_Pokemon_5_Pokemon.Name = "CB_Pokemon_5_Pokemon"; this.CB_Pokemon_5_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_5_Pokemon.TabIndex = 21; - this.CB_Pokemon_5_Pokemon.SelectedIndexChanged += new System.EventHandler(this.refreshSpeciesAbility); - // + this.CB_Pokemon_5_Pokemon.SelectedIndexChanged += new System.EventHandler(this.RefreshSpeciesAbility); + // // tabPage7 - // + // this.tabPage7.BackColor = System.Drawing.SystemColors.Control; this.tabPage7.Controls.Add(this.L_Pokemon_6_Gender); this.tabPage7.Controls.Add(this.CB_Pokemon_6_Gender); @@ -1849,18 +1849,18 @@ private void InitializeComponent() this.tabPage7.Size = new System.Drawing.Size(557, 127); this.tabPage7.TabIndex = 6; this.tabPage7.Text = "Pokémon 6"; - // + // // L_Pokemon_6_Gender - // + // this.L_Pokemon_6_Gender.AutoSize = true; this.L_Pokemon_6_Gender.Location = new System.Drawing.Point(366, 71); this.L_Pokemon_6_Gender.Name = "L_Pokemon_6_Gender"; this.L_Pokemon_6_Gender.Size = new System.Drawing.Size(45, 13); this.L_Pokemon_6_Gender.TabIndex = 65; this.L_Pokemon_6_Gender.Text = "Gender:"; - // + // // CB_Pokemon_6_Gender - // + // this.CB_Pokemon_6_Gender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Gender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Gender.Enabled = false; @@ -1869,19 +1869,19 @@ private void InitializeComponent() this.CB_Pokemon_6_Gender.Name = "CB_Pokemon_6_Gender"; this.CB_Pokemon_6_Gender.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_6_Gender.TabIndex = 64; - this.CB_Pokemon_6_Gender.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_6_Gender.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_6_Ability - // + // this.L_Pokemon_6_Ability.AutoSize = true; this.L_Pokemon_6_Ability.Location = new System.Drawing.Point(374, 44); this.L_Pokemon_6_Ability.Name = "L_Pokemon_6_Ability"; this.L_Pokemon_6_Ability.Size = new System.Drawing.Size(37, 13); this.L_Pokemon_6_Ability.TabIndex = 63; this.L_Pokemon_6_Ability.Text = "Ability:"; - // + // // CB_Pokemon_6_Ability - // + // this.CB_Pokemon_6_Ability.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Ability.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Ability.Enabled = false; @@ -1890,18 +1890,18 @@ private void InitializeComponent() this.CB_Pokemon_6_Ability.Name = "CB_Pokemon_6_Ability"; this.CB_Pokemon_6_Ability.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_6_Ability.TabIndex = 62; - // + // // L_Pokemon_6_Form - // + // this.L_Pokemon_6_Form.AutoSize = true; this.L_Pokemon_6_Form.Location = new System.Drawing.Point(29, 44); this.L_Pokemon_6_Form.Name = "L_Pokemon_6_Form"; this.L_Pokemon_6_Form.Size = new System.Drawing.Size(33, 13); this.L_Pokemon_6_Form.TabIndex = 59; this.L_Pokemon_6_Form.Text = "Form:"; - // + // // CB_Pokemon_6_Form - // + // this.CB_Pokemon_6_Form.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Form.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Form.Enabled = false; @@ -1910,19 +1910,19 @@ private void InitializeComponent() this.CB_Pokemon_6_Form.Name = "CB_Pokemon_6_Form"; this.CB_Pokemon_6_Form.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Form.TabIndex = 58; - this.CB_Pokemon_6_Form.SelectedIndexChanged += new System.EventHandler(this.refreshFormAbility); - // + this.CB_Pokemon_6_Form.SelectedIndexChanged += new System.EventHandler(this.RefreshFormAbility); + // // L_Pokemon_6_IVs - // + // this.L_Pokemon_6_IVs.AutoSize = true; this.L_Pokemon_6_IVs.Location = new System.Drawing.Point(386, 17); this.L_Pokemon_6_IVs.Name = "L_Pokemon_6_IVs"; this.L_Pokemon_6_IVs.Size = new System.Drawing.Size(25, 13); this.L_Pokemon_6_IVs.TabIndex = 38; this.L_Pokemon_6_IVs.Text = "IVs:"; - // + // // CB_Pokemon_6_IVs - // + // this.CB_Pokemon_6_IVs.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_IVs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_IVs.Enabled = false; @@ -1931,18 +1931,18 @@ private void InitializeComponent() this.CB_Pokemon_6_IVs.Name = "CB_Pokemon_6_IVs"; this.CB_Pokemon_6_IVs.Size = new System.Drawing.Size(136, 21); this.CB_Pokemon_6_IVs.TabIndex = 37; - // + // // L_Pokemon_6_Move_4 - // + // this.L_Pokemon_6_Move_4.AutoSize = true; this.L_Pokemon_6_Move_4.Location = new System.Drawing.Point(192, 98); this.L_Pokemon_6_Move_4.Name = "L_Pokemon_6_Move_4"; this.L_Pokemon_6_Move_4.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_4.TabIndex = 34; this.L_Pokemon_6_Move_4.Text = "Move 4:"; - // + // // CB_Pokemon_6_Move_4 - // + // this.CB_Pokemon_6_Move_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Move_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_4.Enabled = false; @@ -1951,18 +1951,18 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_4.Name = "CB_Pokemon_6_Move_4"; this.CB_Pokemon_6_Move_4.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_4.TabIndex = 33; - // + // // L_Pokemon_6_Move_3 - // + // this.L_Pokemon_6_Move_3.AutoSize = true; this.L_Pokemon_6_Move_3.Location = new System.Drawing.Point(192, 71); this.L_Pokemon_6_Move_3.Name = "L_Pokemon_6_Move_3"; this.L_Pokemon_6_Move_3.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_3.TabIndex = 32; this.L_Pokemon_6_Move_3.Text = "Move 3:"; - // + // // CB_Pokemon_6_Move_3 - // + // this.CB_Pokemon_6_Move_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Move_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_3.Enabled = false; @@ -1971,18 +1971,18 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_3.Name = "CB_Pokemon_6_Move_3"; this.CB_Pokemon_6_Move_3.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_3.TabIndex = 31; - // + // // L_Pokemon_6_Move_2 - // + // this.L_Pokemon_6_Move_2.AutoSize = true; this.L_Pokemon_6_Move_2.Location = new System.Drawing.Point(192, 44); this.L_Pokemon_6_Move_2.Name = "L_Pokemon_6_Move_2"; this.L_Pokemon_6_Move_2.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_2.TabIndex = 30; this.L_Pokemon_6_Move_2.Text = "Move 2:"; - // + // // CB_Pokemon_6_Move_2 - // + // this.CB_Pokemon_6_Move_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Move_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_2.Enabled = false; @@ -1991,18 +1991,18 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_2.Name = "CB_Pokemon_6_Move_2"; this.CB_Pokemon_6_Move_2.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_2.TabIndex = 29; - // + // // L_Pokemon_6_Move_1 - // + // this.L_Pokemon_6_Move_1.AutoSize = true; this.L_Pokemon_6_Move_1.Location = new System.Drawing.Point(192, 17); this.L_Pokemon_6_Move_1.Name = "L_Pokemon_6_Move_1"; this.L_Pokemon_6_Move_1.Size = new System.Drawing.Size(46, 13); this.L_Pokemon_6_Move_1.TabIndex = 28; this.L_Pokemon_6_Move_1.Text = "Move 1:"; - // + // // CB_Pokemon_6_Move_1 - // + // this.CB_Pokemon_6_Move_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Move_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Move_1.Enabled = false; @@ -2011,18 +2011,18 @@ private void InitializeComponent() this.CB_Pokemon_6_Move_1.Name = "CB_Pokemon_6_Move_1"; this.CB_Pokemon_6_Move_1.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Move_1.TabIndex = 27; - // + // // L_Pokemon_6_Item - // + // this.L_Pokemon_6_Item.AutoSize = true; this.L_Pokemon_6_Item.Location = new System.Drawing.Point(32, 98); this.L_Pokemon_6_Item.Name = "L_Pokemon_6_Item"; this.L_Pokemon_6_Item.Size = new System.Drawing.Size(30, 13); this.L_Pokemon_6_Item.TabIndex = 26; this.L_Pokemon_6_Item.Text = "Item:"; - // + // // CB_Pokemon_6_Item - // + // this.CB_Pokemon_6_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Item.Enabled = false; @@ -2031,19 +2031,19 @@ private void InitializeComponent() this.CB_Pokemon_6_Item.Name = "CB_Pokemon_6_Item"; this.CB_Pokemon_6_Item.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Item.TabIndex = 25; - this.CB_Pokemon_6_Item.SelectedIndexChanged += new System.EventHandler(this.changeTeam); - // + this.CB_Pokemon_6_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeTeam); + // // L_Pokemon_6_Level - // + // this.L_Pokemon_6_Level.AutoSize = true; this.L_Pokemon_6_Level.Location = new System.Drawing.Point(26, 71); this.L_Pokemon_6_Level.Name = "L_Pokemon_6_Level"; this.L_Pokemon_6_Level.Size = new System.Drawing.Size(36, 13); this.L_Pokemon_6_Level.TabIndex = 24; this.L_Pokemon_6_Level.Text = "Level:"; - // + // // CB_Pokemon_6_Level - // + // this.CB_Pokemon_6_Level.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Level.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Level.Enabled = false; @@ -2052,18 +2052,18 @@ private void InitializeComponent() this.CB_Pokemon_6_Level.Name = "CB_Pokemon_6_Level"; this.CB_Pokemon_6_Level.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Level.TabIndex = 23; - // + // // L_Pokemon_6_Pokemon - // + // this.L_Pokemon_6_Pokemon.AutoSize = true; this.L_Pokemon_6_Pokemon.Location = new System.Drawing.Point(7, 17); this.L_Pokemon_6_Pokemon.Name = "L_Pokemon_6_Pokemon"; this.L_Pokemon_6_Pokemon.Size = new System.Drawing.Size(55, 13); this.L_Pokemon_6_Pokemon.TabIndex = 22; this.L_Pokemon_6_Pokemon.Text = "Pokémon:"; - // + // // CB_Pokemon_6_Pokemon - // + // this.CB_Pokemon_6_Pokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon_6_Pokemon.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Pokemon_6_Pokemon.Enabled = false; @@ -2072,10 +2072,10 @@ private void InitializeComponent() this.CB_Pokemon_6_Pokemon.Name = "CB_Pokemon_6_Pokemon"; this.CB_Pokemon_6_Pokemon.Size = new System.Drawing.Size(121, 21); this.CB_Pokemon_6_Pokemon.TabIndex = 21; - this.CB_Pokemon_6_Pokemon.SelectedIndexChanged += new System.EventHandler(this.refreshSpeciesAbility); - // + this.CB_Pokemon_6_Pokemon.SelectedIndexChanged += new System.EventHandler(this.RefreshSpeciesAbility); + // // B_Randomize - // + // this.B_Randomize.Location = new System.Drawing.Point(384, 4); this.B_Randomize.Name = "B_Randomize"; this.B_Randomize.Size = new System.Drawing.Size(93, 23); @@ -2083,104 +2083,104 @@ private void InitializeComponent() this.B_Randomize.Text = "Randomize All"; this.B_Randomize.UseVisualStyleBackColor = true; this.B_Randomize.Click += new System.EventHandler(this.B_Randomize_Click); - // + // // TB_Text1 - // + // this.TB_Text1.Location = new System.Drawing.Point(66, 256); this.TB_Text1.Name = "TB_Text1"; this.TB_Text1.Size = new System.Drawing.Size(511, 20); this.TB_Text1.TabIndex = 69; - // + // // L_Text1 - // + // this.L_Text1.Location = new System.Drawing.Point(-6, 258); this.L_Text1.Name = "L_Text1"; this.L_Text1.Size = new System.Drawing.Size(66, 15); this.L_Text1.TabIndex = 425; this.L_Text1.Text = "Text1:"; this.L_Text1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // PB_Team6 - // + // this.PB_Team6.Location = new System.Drawing.Point(496, 190); this.PB_Team6.Name = "PB_Team6"; this.PB_Team6.Size = new System.Drawing.Size(80, 60); this.PB_Team6.TabIndex = 432; this.PB_Team6.TabStop = false; - this.PB_Team6.Click += new System.EventHandler(this.gotoParty); - // + this.PB_Team6.Click += new System.EventHandler(this.GotoParty); + // // PB_Team5 - // + // this.PB_Team5.Location = new System.Drawing.Point(410, 190); this.PB_Team5.Name = "PB_Team5"; this.PB_Team5.Size = new System.Drawing.Size(80, 60); this.PB_Team5.TabIndex = 433; this.PB_Team5.TabStop = false; - this.PB_Team5.Click += new System.EventHandler(this.gotoParty); - // + this.PB_Team5.Click += new System.EventHandler(this.GotoParty); + // // PB_Team4 - // + // this.PB_Team4.Location = new System.Drawing.Point(324, 190); this.PB_Team4.Name = "PB_Team4"; this.PB_Team4.Size = new System.Drawing.Size(80, 60); this.PB_Team4.TabIndex = 434; this.PB_Team4.TabStop = false; - this.PB_Team4.Click += new System.EventHandler(this.gotoParty); - // + this.PB_Team4.Click += new System.EventHandler(this.GotoParty); + // // PB_Team3 - // + // this.PB_Team3.Location = new System.Drawing.Point(238, 190); this.PB_Team3.Name = "PB_Team3"; this.PB_Team3.Size = new System.Drawing.Size(80, 60); this.PB_Team3.TabIndex = 435; this.PB_Team3.TabStop = false; - this.PB_Team3.Click += new System.EventHandler(this.gotoParty); - // + this.PB_Team3.Click += new System.EventHandler(this.GotoParty); + // // PB_Team2 - // + // this.PB_Team2.Location = new System.Drawing.Point(152, 190); this.PB_Team2.Name = "PB_Team2"; this.PB_Team2.Size = new System.Drawing.Size(80, 60); this.PB_Team2.TabIndex = 436; this.PB_Team2.TabStop = false; - this.PB_Team2.Click += new System.EventHandler(this.gotoParty); - // + this.PB_Team2.Click += new System.EventHandler(this.GotoParty); + // // PB_Team1 - // + // this.PB_Team1.Location = new System.Drawing.Point(66, 190); this.PB_Team1.Name = "PB_Team1"; this.PB_Team1.Size = new System.Drawing.Size(80, 60); this.PB_Team1.TabIndex = 437; this.PB_Team1.TabStop = false; - this.PB_Team1.Click += new System.EventHandler(this.gotoParty); - // + this.PB_Team1.Click += new System.EventHandler(this.GotoParty); + // // label4 - // + // this.label4.Location = new System.Drawing.Point(-6, 213); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(66, 15); this.label4.TabIndex = 438; this.label4.Text = "Team:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Text2 - // + // this.L_Text2.Location = new System.Drawing.Point(-6, 284); this.L_Text2.Name = "L_Text2"; this.L_Text2.Size = new System.Drawing.Size(66, 15); this.L_Text2.TabIndex = 440; this.L_Text2.Text = "Text2:"; this.L_Text2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // TB_Text2 - // + // this.TB_Text2.Location = new System.Drawing.Point(66, 282); this.TB_Text2.Name = "TB_Text2"; this.TB_Text2.Size = new System.Drawing.Size(511, 20); this.TB_Text2.TabIndex = 439; - // + // // RSTE - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(584, 256); @@ -2204,7 +2204,7 @@ private void InitializeComponent() this.MaximizeBox = false; this.Name = "RSTE"; this.Text = "Trainer Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IsFormClosing); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index f985be5f74..60a0006cf9 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -16,6 +16,7 @@ namespace pk3DS public partial class RSTE : Form { private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); + public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) { trclass = trc; @@ -29,110 +30,23 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) InitializeComponent(); // String Fetching #region Combo Box Arrays - trpk_pkm = new[] - { - CB_Pokemon_1_Pokemon, - CB_Pokemon_2_Pokemon, - CB_Pokemon_3_Pokemon, - CB_Pokemon_4_Pokemon, - CB_Pokemon_5_Pokemon, - CB_Pokemon_6_Pokemon, - }; - trpk_lvl = new[] - { - CB_Pokemon_1_Level, - CB_Pokemon_2_Level, - CB_Pokemon_3_Level, - CB_Pokemon_4_Level, - CB_Pokemon_5_Level, - CB_Pokemon_6_Level, - }; - trpk_item = new[] - { - CB_Pokemon_1_Item, - CB_Pokemon_2_Item, - CB_Pokemon_3_Item, - CB_Pokemon_4_Item, - CB_Pokemon_5_Item, - CB_Pokemon_6_Item, - }; - trpk_abil = new[] - { - CB_Pokemon_1_Ability, - CB_Pokemon_2_Ability, - CB_Pokemon_3_Ability, - CB_Pokemon_4_Ability, - CB_Pokemon_5_Ability, - CB_Pokemon_6_Ability, - }; - trpk_m1 = new[] - { - CB_Pokemon_1_Move_1, - CB_Pokemon_2_Move_1, - CB_Pokemon_3_Move_1, - CB_Pokemon_4_Move_1, - CB_Pokemon_5_Move_1, - CB_Pokemon_6_Move_1, - }; - trpk_m2 = new[] - { - CB_Pokemon_1_Move_2, - CB_Pokemon_2_Move_2, - CB_Pokemon_3_Move_2, - CB_Pokemon_4_Move_2, - CB_Pokemon_5_Move_2, - CB_Pokemon_6_Move_2, - }; - trpk_m3 = new[] - { - CB_Pokemon_1_Move_3, - CB_Pokemon_2_Move_3, - CB_Pokemon_3_Move_3, - CB_Pokemon_4_Move_3, - CB_Pokemon_5_Move_3, - CB_Pokemon_6_Move_3, - }; - trpk_m4 = new[] - { - CB_Pokemon_1_Move_4, - CB_Pokemon_2_Move_4, - CB_Pokemon_3_Move_4, - CB_Pokemon_4_Move_4, - CB_Pokemon_5_Move_4, - CB_Pokemon_6_Move_4, - }; - trpk_IV = new[] - { - CB_Pokemon_1_IVs, - CB_Pokemon_2_IVs, - CB_Pokemon_3_IVs, - CB_Pokemon_4_IVs, - CB_Pokemon_5_IVs, - CB_Pokemon_6_IVs, - }; - trpk_form = new[] - { - CB_Pokemon_1_Form, - CB_Pokemon_2_Form, - CB_Pokemon_3_Form, - CB_Pokemon_4_Form, - CB_Pokemon_5_Form, - CB_Pokemon_6_Form, - }; - trpk_gender = new[] - { - CB_Pokemon_1_Gender, - CB_Pokemon_2_Gender, - CB_Pokemon_3_Gender, - CB_Pokemon_4_Gender, - CB_Pokemon_5_Gender, - CB_Pokemon_6_Gender, - }; + trpk_pkm = new[] { CB_Pokemon_1_Pokemon, CB_Pokemon_2_Pokemon, CB_Pokemon_3_Pokemon, CB_Pokemon_4_Pokemon, CB_Pokemon_5_Pokemon, CB_Pokemon_6_Pokemon, }; + trpk_lvl = new[] { CB_Pokemon_1_Level, CB_Pokemon_2_Level, CB_Pokemon_3_Level, CB_Pokemon_4_Level, CB_Pokemon_5_Level, CB_Pokemon_6_Level, }; + trpk_item = new[] { CB_Pokemon_1_Item, CB_Pokemon_2_Item, CB_Pokemon_3_Item, CB_Pokemon_4_Item, CB_Pokemon_5_Item, CB_Pokemon_6_Item, }; + trpk_abil = new[] { CB_Pokemon_1_Ability, CB_Pokemon_2_Ability, CB_Pokemon_3_Ability, CB_Pokemon_4_Ability, CB_Pokemon_5_Ability, CB_Pokemon_6_Ability, }; + trpk_m1 = new[] { CB_Pokemon_1_Move_1, CB_Pokemon_2_Move_1, CB_Pokemon_3_Move_1, CB_Pokemon_4_Move_1, CB_Pokemon_5_Move_1, CB_Pokemon_6_Move_1, }; + trpk_m2 = new[] { CB_Pokemon_1_Move_2, CB_Pokemon_2_Move_2, CB_Pokemon_3_Move_2, CB_Pokemon_4_Move_2, CB_Pokemon_5_Move_2, CB_Pokemon_6_Move_2, }; + trpk_m3 = new[] { CB_Pokemon_1_Move_3, CB_Pokemon_2_Move_3, CB_Pokemon_3_Move_3, CB_Pokemon_4_Move_3, CB_Pokemon_5_Move_3, CB_Pokemon_6_Move_3, }; + trpk_m4 = new[] { CB_Pokemon_1_Move_4, CB_Pokemon_2_Move_4, CB_Pokemon_3_Move_4, CB_Pokemon_4_Move_4, CB_Pokemon_5_Move_4, CB_Pokemon_6_Move_4, }; + trpk_IV = new[] { CB_Pokemon_1_IVs, CB_Pokemon_2_IVs, CB_Pokemon_3_IVs, CB_Pokemon_4_IVs, CB_Pokemon_5_IVs, CB_Pokemon_6_IVs, }; + trpk_form = new[] { CB_Pokemon_1_Form, CB_Pokemon_2_Form, CB_Pokemon_3_Form, CB_Pokemon_4_Form, CB_Pokemon_5_Form, CB_Pokemon_6_Form, }; + trpk_gender = new[] { CB_Pokemon_1_Gender, CB_Pokemon_2_Gender, CB_Pokemon_3_Gender, CB_Pokemon_4_Gender, CB_Pokemon_5_Gender, CB_Pokemon_6_Gender, }; #endregion Setup(); } + private string[][] AltForms; - internal static uint rnd32() => Util.rnd32(); + internal static uint Rand() => Util.rnd32(); private bool start = true; private bool loading = true; private int index = -1; @@ -164,18 +78,20 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) #endregion // Ability Loading - private void refreshFormAbility(object sender, EventArgs e) + private void RefreshFormAbility(object sender, EventArgs e) { int i = Array.IndexOf(trpk_form, sender as ComboBox); - refreshPKMSlotAbility(i); + RefreshPKMSlotAbility(i); } - private void refreshSpeciesAbility(object sender, EventArgs e) + + private void RefreshSpeciesAbility(object sender, EventArgs e) { int i = Array.IndexOf(trpk_pkm, sender as ComboBox); FormUtil.setForms(trpk_pkm[i].SelectedIndex, trpk_form[i], AltForms); - refreshPKMSlotAbility(i); + RefreshPKMSlotAbility(i); } - private void refreshPKMSlotAbility(int slot) + + private void RefreshPKMSlotAbility(int slot) { int previousAbility = trpk_abil[slot].SelectedIndex; @@ -192,10 +108,10 @@ private void refreshPKMSlotAbility(int slot) trpk_abil[slot].SelectedIndex = previousAbility; - showTeams(slot); + ShowTeams(slot); } // Set Loading - private void changeTrainerType(object sender, EventArgs e) + private void ChangeTrainerType(object sender, EventArgs e) { if (start || loading) return; int pkm = CB_numPokemon.SelectedIndex; @@ -242,7 +158,7 @@ private void changeTrainerType(object sender, EventArgs e) } // Dumping - private string getTRSummary() + private string GetTRSummary() { string toret = "======" + Environment.NewLine; @@ -270,20 +186,22 @@ private string getTRSummary() if (trpk_m4[i].SelectedIndex > 0) toret += " / " + trpk_m4[i].Text; toret += ")"; } - toret += " IVs: All " + Convert.ToInt32(trpk_IV[i].SelectedIndex) / 8; + toret += " IVs: All " + (Convert.ToInt32(trpk_IV[i].SelectedIndex) / 8); toret += Environment.NewLine; } toret += Environment.NewLine; return toret; } + private bool dumping; + private void B_Dump_Click(object sender, EventArgs e) { string toret = ""; dumping = true; for (int i = 1; i < CB_TrainerID.Items.Count; i++) { CB_TrainerID.SelectedIndex = i; - string tdata = getTRSummary(); + string tdata = GetTRSummary(); toret += tdata; } SaveFileDialog sfd = new SaveFileDialog {FileName = "Battles.txt", Filter = "Text File|*.txt"}; @@ -299,12 +217,14 @@ private void B_Dump_Click(object sender, EventArgs e) // Change Read/Write private trdata6 tr; - private void changeTrainerIndex(object sender, EventArgs e) + + private void ChangeTrainerIndex(object sender, EventArgs e) { - if (!dumping && index > -1) writeFile(); - readFile(); // Load the new file. + if (!dumping && index > -1) WriteFile(); + ReadFile(); // Load the new file. } - private void readFile() + + private void ReadFile() { if (start) return; index = CB_TrainerID.SelectedIndex; @@ -331,7 +251,7 @@ private void readFile() checkBox_Healer.Checked = tr.Healer; CB_Money.SelectedIndex = tr.Money; CB_Prize.SelectedIndex = tr.Prize; - + // Load Pokemon Data for (int i = 0; i < tr.NumPokemon; i++) { @@ -340,7 +260,7 @@ private void readFile() trpk_pkm[i].SelectedIndex = tr.Team[i].Species; FormUtil.setForms(tr.Team[i].Species, trpk_form[i], AltForms); trpk_form[i].SelectedIndex = tr.Team[i].Form % trpk_form[i].Items.Count; // stupid X/Y buggy edge cases (220 / 222) - refreshPKMSlotAbility(i); // Repopulate Abilities + RefreshPKMSlotAbility(i); // Repopulate Abilities trpk_abil[i].SelectedIndex = tr.Team[i].Ability; trpk_gender[i].SelectedIndex = tr.Team[i].Gender; @@ -352,17 +272,17 @@ private void readFile() trpk_m4[i].SelectedIndex = tr.Team[i].Moves[3]; } loading = false; - changeTrainerType(null, null); // Prompt cleaning update of PKM fields + ChangeTrainerType(null, null); // Prompt cleaning update of PKM fields // Refresh Team View if (!loading) { - for (int i = 0; i < 6; i++) showTeams(i); + for (int i = 0; i < 6; i++) ShowTeams(i); // showText(); // Commented out for now, have to figure out how text is assigned. } - } - private void writeFile() + + private void WriteFile() { // Set Trainer Data tr.Moves = checkBox_Moves.Checked; @@ -370,7 +290,7 @@ private void writeFile() tr.Class = CB_Trainer_Class.SelectedIndex; tr.BattleType = (byte)CB_Battle_Type.SelectedIndex; tr.NumPokemon = (byte)CB_numPokemon.SelectedIndex; - if (tr.NumPokemon == 0) + if (tr.NumPokemon == 0) tr.NumPokemon = 1; // No empty teams! tr.Items[0] = (ushort)CB_Item_1.SelectedIndex; tr.Items[1] = (ushort)CB_Item_2.SelectedIndex; @@ -400,35 +320,35 @@ private void writeFile() tr.Team[i].Moves[2] = (ushort)trpk_m3[i].SelectedIndex; tr.Team[i].Moves[3] = (ushort)trpk_m4[i].SelectedIndex; } - byte[] trd = tr.Write(); - trdata[index] = trd; - byte[] trp = tr.WriteTeam(); - trpoke[index] = trp; + trdata[index] = tr.Write(); + trpoke[index] = tr.WriteTeam(); } // Image Displays - private void changeTeam(object sender, EventArgs e) + private void ChangeTeam(object sender, EventArgs e) { if (loading) return; int gendSlot = Array.IndexOf(trpk_gender, sender as ComboBox); int itemSlot = Array.IndexOf(trpk_item, sender as ComboBox); - showTeams(gendSlot < 0 ? itemSlot : gendSlot); + ShowTeams(gendSlot < 0 ? itemSlot : gendSlot); } - private void showTeams(int i) + + private void ShowTeams(int i) { if (tr == null) return; if (i >= tr.Team.Length) { pba[i].Image = null; return; } Bitmap rawImg = WinFormsUtil.getSprite(tr.Team[i].Species, tr.Team[i].Form, tr.Team[i].Gender, tr.Team[i].Item, Main.Config); pba[i].Image = WinFormsUtil.scaleImage(rawImg, 2); } - private void showText() + + private void ShowText() { if (index * 2 >= trText.Length) return; TB_Text1.Text = trText[index * 2]; - TB_Text2.Text = trText[index * 2 + 1]; + TB_Text2.Text = trText[(index * 2) + 1]; } - + private void Setup() { start = true; @@ -511,18 +431,19 @@ private void Setup() CB_Battle_Type.Items.Add("Triple"); CB_Battle_Type.Items.Add("Rotation"); if (Main.Config.ORAS) CB_Battle_Type.Items.Add("Horde"); - megaEvos = Main.Config.ORAS - ? new[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 } + megaEvos = Main.Config.ORAS + ? new[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 } : new[] { 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 }; - + CB_TrainerID.SelectedIndex = 1; start = false; - readFile(); + ReadFile(); } - public static bool rPKM, rSmart, rLevel, rMove, rMetronome, rNoMove, rForceHighPower, rAbility, rDiffAI, + public static bool rPKM, rSmart, rLevel, rMove, rMetronome, rNoMove, rForceHighPower, rAbility, rDiffAI, rDiffIV, rClass, rGift, rItem, rDoRand, rRandomMegas, rGymE4Only, rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM, rForceFullyEvolved; + public static bool rNoFixedDamage; internal static bool[] rThemedClasses = { }; private static string[] rTags; @@ -537,6 +458,7 @@ private void Setup() private readonly Dictionary TagTypes = new Dictionary(); public static int[] sL; // Random Species List public static decimal rGiftPercent, rLevelMultiplier, rMinPKM, rMaxPKM, rForceFullyEvolvedLevel, rForceHighPowerLevel; + private void B_Randomize_Click(object sender, EventArgs e) { rPKM = rMove = rMetronome = rAbility = rDiffAI = rDiffIV = rClass = rGift = rItem = rDoRand = false; // init to false @@ -546,6 +468,7 @@ private void B_Randomize_Click(object sender, EventArgs e) if (rDoRand) Randomize(); } + private void Randomize() { List banned = new List { 165, 621 }; // Struggle, Hyperspace Fury @@ -571,22 +494,28 @@ private void Randomize() { if (mEvoTypes.Length < 13 && rTypeTheme) { - WinFormsUtil.Alert("There are insufficient Types with at least one mega evolution to Guarantee story Mega Evos while keeping Type theming.", + WinFormsUtil.Alert("There are insufficient Types with at least one mega evolution to Guarantee story Mega Evos while keeping Type theming.", "Re-Randomize Personal or don't choose both options."); return; } GymE4Types.AddRange(mEvoTypes); } else + { GymE4Types.AddRange(Enumerable.Range(0, types.Length).ToArray()); + } + foreach (int t1 in rEnsureMEvo.Where(t1 => rTags[t1] != "" && !TagTypes.Keys.Contains(rTags[t1]))) { int t; if (rTags[t1].Contains("GYM") || rTags[t1].Contains("ELITE") || rTags[t1].Contains("CHAMPION")) { - t = GymE4Types[(int)(rnd32() % GymE4Types.Count)]; + t = GymE4Types[(int)(Rand() % GymE4Types.Count)]; GymE4Types.Remove(t); } else - t = mEvoTypes[rnd32() % mEvoTypes.Length]; + { + t = mEvoTypes[Rand() % mEvoTypes.Length]; + } + TagTypes[rTags[t1]] = t; } foreach (string t1 in Tags) @@ -596,11 +525,13 @@ private void Randomize() int t; if (t1.Contains("GYM") || t1.Contains("ELITE") || t1.Contains("CHAMPION")) { - t = GymE4Types[(int)(rnd32() % GymE4Types.Count)]; + t = GymE4Types[(int)(Rand() % GymE4Types.Count)]; GymE4Types.Remove(t); } else - t = (int)(rnd32() % types.Length); + { + t = (int)(Rand() % types.Length); + } TagTypes[t1] = t; } @@ -617,15 +548,14 @@ private void Randomize() // Trainer Type/Mega Evo int type = GetRandomType(i); bool mevo = rEnsureMEvo.Contains(i); - bool typerand = rTypeTheme && !rGymE4Only || - rTypeTheme && rImportant[i] != null && ImportantClasses.Contains(rImportant[i]); + bool typerand = (rTypeTheme && !rGymE4Only) || (rTypeTheme && rImportant[i] != null && ImportantClasses.Contains(rImportant[i])); rSpeciesRand.rType = typerand; byte[] trd = trdata[i]; byte[] trp = trpoke[i]; var t = new trdata6(trd, trp, Main.Config.ORAS) { - Moves = rMove || !rNoMove && checkBox_Moves.Checked, + Moves = rMove || (!rNoMove && checkBox_Moves.Checked), Item = rItem || checkBox_Item.Checked }; @@ -664,9 +594,13 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom } } else if (p == last && mevo) + { stones = GetRandomMega(out species); + } else + { species = rSpeciesRand.GetRandomSpecies(pk.Species); + } pk.Species = (ushort)species; pk.Gender = 0; // Set Gender to Random @@ -676,14 +610,14 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom if (rLevel) pk.Level = (ushort)Randomizer.getModifiedLevel(pk.Level, rLevelMultiplier); if (rAbility) - pk.Ability = (int)(1 + rnd32() % 3); + pk.Ability = (int)(1 + (Rand() % 3)); if (rDiffIV) pk.IVs = 255; if (mevo && p == last && stones != null) - pk.Item = (ushort)stones[rnd32() % stones.Length]; + pk.Item = (ushort)stones[Rand() % stones.Length]; else if (rItem) - pk.Item = itemvals[rnd32() % itemvals.Length]; + pk.Item = itemvals[Rand() % itemvals.Length]; if (rForceFullyEvolved && pk.Level >= rForceFullyEvolvedLevel && !rFinalEvo.Contains(pk.Species)) { @@ -726,6 +660,7 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom } } } + private static void SetMinMaxPKM(trdata6 t) { int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) @@ -757,6 +692,7 @@ private static void SetMinMaxPKM(trdata6 t) t.NumPokemon = (byte)rMaxPKM; } } + private static void SetFullParties(trdata6 t, bool important) { int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) @@ -768,7 +704,7 @@ private static void SetFullParties(trdata6 t, bool important) // 6 pkm for important trainers, skip the first rival battles if (!r6PKM || important) return; - + t.NumPokemon = 6; for (int f = lastPKM + 1; f < t.NumPokemon; f++) { @@ -781,6 +717,7 @@ private static void SetFullParties(trdata6 t, bool important) }; } } + private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) { if (rDiffAI) @@ -788,7 +725,7 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) if (rClass && rModelRestricted.Contains(t.Class) && !rIgnoreClass.Contains(t.Class)) // shuffle classes with 3D models { - int randClass() => (int) (rnd32() % rModelRestricted.Length); + int randClass() => (int) (Rand() % rModelRestricted.Length); t.Class = rModelRestricted[randClass()]; } else @@ -798,28 +735,31 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) && !rIgnoreClass.Contains(t.Class) // Current class isn't a special class ) { - int randClass() => (int)(rnd32() % trClass.Length); + int randClass() => (int)(Rand() % trClass.Length); int rv; do { rv = randClass(); } - while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~") || Main.Config.ORAS && (rv >= 0 && rv <= 63) || (rv >= 68 && rv <= 126)); // don't allow disallowed classes + while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~") || (Main.Config.ORAS && (rv >= 0 && rv <= 63)) || (rv >= 68 && rv <= 126)); // don't allow disallowed classes t.Class = rv; } } + private static void RandomizeTrainerPrizeItem(trdata6 t) { - if (rGift && rnd32() % 100 < rGiftPercent) + if (rGift && Rand() % 100 < rGiftPercent) { ushort[] items; - uint rnd = rnd32() % 10; + uint rnd = Rand() % 10; if (rnd < 2) // held item items = Main.Config.ORAS ? Legal.Pouch_Items_AO : Legal.Pouch_Items_XY; else if (rnd < 5) // medicine items = Main.Config.ORAS ? Legal.Pouch_Medicine_AO : Legal.Pouch_Medicine_XY; else // berry items = Legal.Pouch_Berry_XY; - t.Prize = items[rnd32() % items.Length]; + t.Prize = items[Rand() % items.Length]; } else if (rGift) + { t.Prize = 0; + } } private string[] GetTagsORAS() @@ -887,6 +827,7 @@ private string[] GetTagsORAS() } return tags; } + private string[] GetTagsXY() { string[] tags = Enumerable.Repeat("", trdata.Length).ToArray(); @@ -960,6 +901,7 @@ private string[] GetTagsXY() } return tags; } + private bool ImportantTrainers; public static SpeciesRandomizer rSpeciesRand; @@ -978,20 +920,23 @@ private void TagTrainer(string[] trTags, string tag, params int[] ids) } private static Dictionary MegaDictionary; + private static int[] GetRandomMega(out int species) { int rnd = Util.rand.Next(0, MegaDictionary.Count - 1); species = MegaDictionary.Keys.ElementAt(rnd); return MegaDictionary.Values.ElementAt(rnd); } + private int GetRandomType(int trainer) { - if (rTags[trainer] != "") + if (rTags[trainer] != "") return TagTypes[rTags[trainer]]; - if (!rEnsureMEvo.Contains(trainer)) - return (int)(rnd32()%types.Length); - return mEvoTypes[rnd32() % mEvoTypes.Length]; + if (!rEnsureMEvo.Contains(trainer)) + return (int)(Rand()%types.Length); + return mEvoTypes[Rand() % mEvoTypes.Length]; } + private int[] GetMegaEvolvableTypes() { List MEvoTypes = new List(); @@ -1007,12 +952,12 @@ private int[] GetMegaEvolvableTypes() return MEvoTypes.ToArray(); } - private void formClosing(object sender, FormClosingEventArgs e) + private void IsFormClosing(object sender, FormClosingEventArgs e) { - writeFile(); + WriteFile(); } - private void gotoParty(object sender, EventArgs e) + private void GotoParty(object sender, EventArgs e) { // When sprite is clicked, jump to that Pokémon. tabControl1.SelectedIndex = 1 + Array.IndexOf(new[]{PB_Team1, PB_Team2, PB_Team3, PB_Team4, PB_Team5, PB_Team6,}, sender as PictureBox); diff --git a/pk3DS/Subforms/Gen6/RSWE.cs b/pk3DS/Subforms/Gen6/RSWE.cs index e909a1e8df..7a40e04f03 100644 --- a/pk3DS/Subforms/Gen6/RSWE.cs +++ b/pk3DS/Subforms/Gen6/RSWE.cs @@ -272,6 +272,7 @@ public RSWE() openQuick(Directory.GetFiles("encdata")); RandSettings.GetFormSettings(this, GB_Tweak.Controls); } + private readonly ComboBox[] spec; private readonly NumericUpDown[] min; private readonly NumericUpDown[] max; @@ -305,6 +306,7 @@ private void RSWE_Load() //Preload Tabs PreloadTabs(); } + internal static uint rnd32() => Util.rnd32(); private void openQuick(string[] encdata) @@ -322,8 +324,8 @@ private void openQuick(string[] encdata) string name = Path.GetFileNameWithoutExtension(filepaths[f]); int LocationNum = Convert.ToInt16(name.Substring(4, name.Length - 4)); - int indNum = LocationNum * 56 + 0x1C; - string LocationName = metRS_00000[zonedata[indNum] + 0x100 * (zonedata[indNum + 1] & 1)]; + int indNum = (LocationNum * 56) + 0x1C; + string LocationName = metRS_00000[zonedata[indNum] + (0x100 * (zonedata[indNum + 1] & 1))]; LocationNames[f] = LocationNum.ToString("000") + " - " + LocationName; } CB_LocationID.DataSource = LocationNames; @@ -359,7 +361,7 @@ private void parse(byte[] ed) for (int i = 0; i < max.Length; i++) { // Fetch Data - Array.Copy(ed, offset + i * 4, slot, 0, 4); + Array.Copy(ed, offset + (i * 4), slot, 0, 4); int[] data = pslot(slot); // Load Data @@ -379,6 +381,7 @@ private void parse(byte[] ed) File.WriteAllBytes(Path.Combine("encounter_ao", loc.ToString("000") + CB_LocationID.SelectedIndex.ToString("000") + ".bin"), edata); #endif } + private int[] pslot(byte[] slot) // Parse Slot to Bytes { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; @@ -392,6 +395,7 @@ private int[] pslot(byte[] slot) // Parse Slot to Bytes data[3] = hi; return data; } + private string parseslot(byte[] slot) { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; @@ -403,6 +407,7 @@ private string parseslot(byte[] slot) if (form > 0) species += "-" + form; return species + ',' + min + ',' + max + ','; } + private byte[] MakeSlotData(int species, int f, int lo, int hi) { byte[] data = new byte[4]; @@ -411,6 +416,7 @@ private byte[] MakeSlotData(int species, int f, int lo, int hi) data[3] = (byte)hi; return data; } + private byte[] ConcatArrays(byte[] b1, byte[] b2) { byte[] concat = new byte[b1.Length + b2.Length]; @@ -464,12 +470,14 @@ private bool hasData() } return false; } + private void PreloadTabs() { for (int i = 0; i < TabControl_EncounterData.TabPages.Count; i++) TabControl_EncounterData.TabPages[i].Show(); TabControl_EncounterData.TabPages[0].Show(); } + private void ClearData() { for (int i = 0; i < max.Length; i++) @@ -481,6 +489,7 @@ private void ClearData() max[i].Value = 0; } } + private byte[] MakeEncounterData() { byte[] ed = new byte[0x102]; @@ -488,10 +497,11 @@ private byte[] MakeEncounterData() for (int i = 0; i < max.Length; i++) { byte[] data = MakeSlotData(spec[i].SelectedIndex, (int)form[i].Value, (int)min[i].Value, (int)max[i].Value); - Array.Copy(data, 0, ed, offset + i * 4, 4); + Array.Copy(data, 0, ed, offset + (i * 4), 4); } return ed; } + private string GetEncDataString() { string toret = "======" + Environment.NewLine; @@ -544,6 +554,7 @@ private void B_Dump_Click(object sender, EventArgs e) string path = savetxt.FileName; File.WriteAllText(path, toret); } + private void B_Save_Click(object sender, EventArgs e) { int f = CB_LocationID.SelectedIndex; @@ -640,7 +651,7 @@ private void B_Randomize_Click(object sender, EventArgs e) // At most 18, but don't chew if there's only a few slots. int cons = list.Count(a => a != 0); - int[] RandomList = new int[cons > 18 ? 18 - cons / 8 : cons]; + int[] RandomList = new int[cons > 18 ? 18 - (cons / 8) : cons]; // Fill Location List for (int s = 0; s < RandomList.Length; s++) @@ -666,7 +677,7 @@ private void B_Randomize_Click(object sender, EventArgs e) if (CHK_HomogeneousHordes.Checked) for (int slot = max.Length - 15; slot < max.Length; slot++) { - list[slot] = list[slot - hordeslot % 5]; + list[slot] = list[slot - (hordeslot % 5)]; hordeslot++; } @@ -683,6 +694,7 @@ private void B_Randomize_Click(object sender, EventArgs e) Enabled = true; WinFormsUtil.Alert("Randomized all Wild Encounters according to specification!", "Press the Dump Tables button to view the new Wild Encounter information!"); } + private int countUnique(int[] list) { int used = 0; @@ -697,6 +709,7 @@ private int countUnique(int[] list) used += list.Skip(46).Take(15).Distinct().Count(a => a != 0); return used; } + private void setRandomForm(int slot, int species) { if (CHK_MegaForm.Checked && Main.SpeciesStat[species].FormeCount > 1 && Legal.Mega_ORAS.Contains((ushort)species)) @@ -724,6 +737,7 @@ private void setRandomForm(int slot, int species) else form[slot].Value = 0; } + private void ShuffleSlots(ref int[] list, int slC) { int[] input = (int[])list.Clone(); @@ -772,6 +786,7 @@ private void ShuffleSlots(ref int[] list, int slC) } } } + private void swap(ref int a1, ref int a2) { var s1 = a1; var s2 = a2; diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index 90145c1599..b31fa71614 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -43,30 +43,35 @@ public StarterEditor6() }; Labels = new[] { L_Set1, L_Set2, L_Set3, L_Set4 }; - Width = Main.Config.ORAS ? Width : Width/2 + 2; + Width = Main.Config.ORAS ? Width : (Width / 2) + 2; loadData(); RandSettings.GetFormSettings(this, groupBox1.Controls); } + private readonly string CROPath = Path.Combine(Main.RomFSPath, "DllPoke3Select.cro"); private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro"); private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private readonly ComboBox[][] Choices; private readonly PictureBox[][] Previews; private readonly Label[] Labels; + private readonly string[] StarterSummary = Main.Config.ORAS ? new[] { "Gen 3 Starters", "Gen 2 Starters", "Gen 4 Starters", "Gen 5 Starters" } : new[] { "Gen 6 Starters", "Gen 1 Starters" }; + private byte[] Data; private byte[] FieldData; private readonly int Count = Main.Config.ORAS ? 4 : 2; private int offset; private static int[] BasicStarter; + private void B_Save_Click(object sender, EventArgs e) { saveData(); RandSettings.SetFormSettings(this, groupBox1.Controls); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); @@ -88,18 +93,19 @@ private void loadData() { foreach (string s in specieslist) Choices[i][j].Items.Add(s); - int species = BitConverter.ToUInt16(Data, offset + (i*3 + j)*0x54); + int species = BitConverter.ToUInt16(Data, offset + (((i * 3) + j)*0x54)); Choices[i][j].SelectedIndex = species; // changing index prompts loading of sprite Choices[i][j].Visible = Previews[i][j].Visible = true; } } } + private void saveData() { for (int i = 0; i < Count; i++) for (int j = 0; j < 3; j++) - Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, Data, offset + (i*3 + j)*0x54, 2); + Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, Data, offset + (((i * 3) + j)*0x54), 2); // Set the choices back int fieldOffset = Main.Config.ORAS ? 0xF906C : 0xF805C; @@ -120,7 +126,7 @@ private void saveData() for (int i = 0; i < Count; i++) for (int j = 0; j < 3; j++) - Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, FieldData, fieldOffset + entries[i*3 + j]*fieldSize, 2); + Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, FieldData, fieldOffset + (entries[(i * 3) + j]*fieldSize), 2); File.WriteAllBytes(CROPath, Data); // poke3 File.WriteAllBytes(FieldPath, FieldData); // field @@ -168,7 +174,7 @@ private void B_Randomize_Click(object sender, EventArgs e) // Assign Species for (int j = 0; j < 3; j++) { - int oldSpecies = BitConverter.ToUInt16(Data, offset + (i * 3 + j) * 0x54); + int oldSpecies = BitConverter.ToUInt16(Data, offset + (((i * 3) + j) * 0x54)); if (CHK_BasicStarter.Checked) { int basic() => (int)(Util.rnd32() % BasicStarter.Length); diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs index 7ebff012b4..c2cd30d45b 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.Designer.cs @@ -111,7 +111,7 @@ private void InitializeComponent() this.LB_Encounters.Name = "LB_Encounters"; this.LB_Encounters.Size = new System.Drawing.Size(110, 342); this.LB_Encounters.TabIndex = 468; - this.LB_Encounters.SelectedIndexChanged += new System.EventHandler(this.changeIndex); + this.LB_Encounters.SelectedIndexChanged += new System.EventHandler(this.ChangeIndex); // // B_RandAll // @@ -219,7 +219,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(136, 21); this.CB_Species.TabIndex = 506; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // L_Species // diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 8fef3b10fb..2079850b22 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -31,9 +31,10 @@ public StaticEncounterEditor6() CB_HeldItem.Items.Clear(); foreach (string s in itemlist) CB_HeldItem.Items.Add(s); - loadData(); + LoadData(); RandSettings.GetFormSettings(this, tabPage2.Controls); } + private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro"); private byte[] FieldData; private readonly int fieldOffset = Main.Config.ORAS ? 0xF1B20 : 0xEE478; @@ -44,7 +45,7 @@ public StaticEncounterEditor6() private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private static int[] FinalEvo; private static int[] ReplaceLegend; - + private readonly string[] ability = { "Any (1 or 2)", @@ -52,25 +53,28 @@ public StaticEncounterEditor6() "Ability 2", "Hidden Ability", }; + private void B_Save_Click(object sender, EventArgs e) { - saveEntry(); - saveData(); + SaveEntry(); + SaveData(); RandSettings.SetFormSettings(this, tabPage2.Controls); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); } - private void loadData() + + private void LoadData() { FieldData = File.ReadAllBytes(FieldPath); EncounterData = new EncounterStatic6[count]; LB_Encounters.Items.Clear(); for (int i = 0; i < EncounterData.Length; i++) { - EncounterData[i] = new EncounterStatic6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray()); + EncounterData[i] = new EncounterStatic6(FieldData.Skip(fieldOffset + (i * fieldSize)).Take(fieldSize).ToArray()); LB_Encounters.Items.Add($"{i:00} - {specieslist[EncounterData[i].Species]}"); } foreach (var s in ability) CB_Ability.Items.Add(s); @@ -86,11 +90,12 @@ private void loadData() loaded = true; LB_Encounters.SelectedIndex = 0; } - private void saveData() + + private void SaveData() { for (int i = 0; i < EncounterData.Length; i++) { - int offset = fieldOffset + i*fieldSize; + int offset = fieldOffset + (i * fieldSize); // Write new data Array.Copy(EncounterData[i].Write(), 0, FieldData, offset, fieldSize); } @@ -99,18 +104,20 @@ private void saveData() private int entry = -1; private bool loaded; - private void changeIndex(object sender, EventArgs e) + + private void ChangeIndex(object sender, EventArgs e) { if (LB_Encounters.SelectedIndex < 0) return; if (!loaded) return; - if (entry != -1) - saveEntry(); + if (entry != -1) + SaveEntry(); entry = LB_Encounters.SelectedIndex; - loadEntry(); + LoadEntry(); } - private void loadEntry() + + private void LoadEntry() { bool oldloaded = loaded; loaded = false; @@ -129,7 +136,8 @@ private void loadEntry() loaded |= oldloaded; } - private void saveEntry() + + private void SaveEntry() { EncounterData[entry].Species = (ushort)CB_Species.SelectedIndex; EncounterData[entry].HeldItem = CB_HeldItem.SelectedIndex; @@ -177,7 +185,9 @@ private void B_RandAll_Click(object sender, EventArgs e) // every other entry else + { species = specrand.GetRandomSpecies(species); + } if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -207,7 +217,7 @@ private void B_RandAll_Click(object sender, EventArgs e) WinFormsUtil.Alert("Randomized all Static Encounters according to specification!"); } - private void changeSpecies(object sender, EventArgs e) + private void ChangeSpecies(object sender, EventArgs e) { int index = LB_Encounters.SelectedIndex; LB_Encounters.Items[index] = index.ToString("00") + " - " + CB_Species.Text; diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index 4c898926f6..68b859ea00 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -31,10 +31,12 @@ public TMHMEditor6() private readonly int offset = Main.Config.ORAS ? 0x004A67EE : 0x00464796; // Default private readonly byte[] data; private int dataoffset; + private void getDataOffset() { dataoffset = offset; // reset } + private void setupDGV() { dgvTM.Columns.Clear(); dgvHM.Columns.Clear(); @@ -75,20 +77,20 @@ private void getList() getDataOffset(); for (int i = 0; i < 92; i++) // 1-92 TMs stored sequentially - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); for (int i = 92; i < 92 + 5; i++) - hms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + hms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); if (Main.Config.ORAS) { - hms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * 97)); + hms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * 97))); for (int i = 98; i < 106; i++) - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); - hms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * 106)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); + hms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * 106))); } else { for (int i = 97; i < 105; i++) - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); } ushort[] tmlist = tms.ToArray(); @@ -98,6 +100,7 @@ private void getList() for (int i = 0; i < hmlist.Length; i++) { dgvHM.Rows.Add(); dgvHM.Rows[i].Cells[0].Value = (i + 1).ToString(); dgvHM.Rows[i].Cells[1].Value = movelist[hmlist[i]]; } } + private void setList() { // Gather TM/HM list. @@ -114,20 +117,20 @@ private void setList() // Set TM/HM list in for (int i = 0; i < 92; i++) - Array.Copy(BitConverter.GetBytes(tmlist[i]), 0, data, offset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes(tmlist[i]), 0, data, offset + (2 * i), 2); for (int i = 92; i < 92 + 5; i++) - Array.Copy(BitConverter.GetBytes(hmlist[i - 92]), 0, data, offset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes(hmlist[i - 92]), 0, data, offset + (2 * i), 2); if (Main.Config.ORAS) { - Array.Copy(BitConverter.GetBytes(hmlist[5]), 0, data, offset + 2 * 97, 2); + Array.Copy(BitConverter.GetBytes(hmlist[5]), 0, data, offset + (2 * 97), 2); for (int i = 98; i < 106; i++) - Array.Copy(BitConverter.GetBytes(tmlist[i - 6]), 0, data, offset + 2 * i, 2); - Array.Copy(BitConverter.GetBytes(hmlist[6]), 0, data, offset + 2 * 106, 2); + Array.Copy(BitConverter.GetBytes(tmlist[i - 6]), 0, data, offset + (2 * i), 2); + Array.Copy(BitConverter.GetBytes(hmlist[6]), 0, data, offset + (2 * 106), 2); } else { for (int i = 97; i < 105; i++) - Array.Copy(BitConverter.GetBytes(tmlist[i - 5]), 0, data, offset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes(tmlist[i - 5]), 0, data, offset + (2 * i), 2); } // Set Move Text Descriptions back into Item Text File @@ -146,7 +149,7 @@ private void setList() itemDescriptions[425] = moveDescriptions[hmlist[5]]; // HM06 itemDescriptions[737] = moveDescriptions[hmlist[6]]; // HM07 } - Main.Config.setText(TextName.ItemFlavor, itemDescriptions); + Main.Config.SetText(TextName.ItemFlavor, itemDescriptions); } private void formClosing(object sender, FormClosingEventArgs e) @@ -213,20 +216,20 @@ internal static void getTMHMList(bool oras, ref ushort[] TMs, ref ushort[] HMs) List hms = new List(); for (int i = 0; i < 92; i++) // 1-92 TMs stored sequentially - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); for (int i = 92; i < 92 + 5; i++) - hms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + hms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); if (Main.Config.ORAS) { - hms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * 97)); + hms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * 97))); for (int i = 98; i < 106; i++) - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); - hms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * 106)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); + hms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * 106))); } else { for (int i = 97; i < 105; i++) - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); } TMs = tms.ToArray(); diff --git a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs index 63a2063472..27bd62eb62 100644 --- a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs +++ b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs @@ -12,6 +12,7 @@ namespace pk3DS public sealed partial class TitleScreenEditor6 : Form { private readonly bool compressed = Main.Config.ORAS; + public TitleScreenEditor6() { InitializeComponent(); @@ -44,7 +45,7 @@ public TitleScreenEditor6() for (int i = 0; i < darcs.Length/2; i++) CB_DARC.Items.Add($"{games[0]} - {languages[i]}"); for (int i = darcs.Length/2; i < darcs.Length; i++) - CB_DARC.Items.Add($"{games[1]} - {languages[i - darcs.Length/2]}"); + CB_DARC.Items.Add($"{games[1]} - {languages[i - (darcs.Length/2)]}"); // Load darcs for (int i = 0; i < darcs.Length; i++) @@ -70,6 +71,7 @@ public TitleScreenEditor6() CB_DARC.SelectedIndex = CB_DARC.Items.Count - 1; // last (english game2) } + private readonly string[] files = Directory.GetFiles("titlescreen"); private readonly DARC[] darcs = new DARC[2 * (Main.Config.ORAS ? 8 : 7)]; private readonly string[] usedFiles = new string[2 * (Main.Config.ORAS ? 8 : 7)]; @@ -123,7 +125,9 @@ private void changeFile(object sender, EventArgs e) L_Dimensions.Text = $"Dimensions: {PB_Image.Width}w && {PB_Image.Height}h"; } + private byte[] currentBytes; + private void insertFile(string path) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Overwrite image?")) @@ -181,6 +185,7 @@ private void tabMain_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } + private void tabMain_DragDrop(object sender, DragEventArgs e) { string path = ((string[])e.Data.GetData(DataFormats.FileDrop))[0]; // open first D&D @@ -245,6 +250,7 @@ private void clickSave(object sender, EventArgs e) } } } + private void clickOpen(object sender, EventArgs e) { var ofd = new OpenFileDialog diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index 04096d97de..440b77af88 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -20,7 +20,7 @@ public TrainerRand() RandSettings.GetFormSettings(this, Controls); } - private string[] trName = Main.Config.getText(TextName.TrainerNames); + private readonly string[] trName = Main.Config.getText(TextName.TrainerNames); private readonly string[] trClass = Main.Config.getText(TextName.TrainerClasses); private readonly List trClassnorep; @@ -28,6 +28,7 @@ private void B_Close_Click(object sender, EventArgs e) { Close(); } + private void B_Save_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings before continuing.") != DialogResult.Yes) @@ -131,15 +132,18 @@ private void CHK_Level_CheckedChanged(object sender, EventArgs e) { NUD_Level.Enabled = CHK_Level.Checked; } + private void changeLevelPercent(object sender, EventArgs e) { CHK_Level.Checked = NUD_Level.Value != 0; } + private void CHK_RandomGift_CheckedChanged(object sender, EventArgs e) { NUD_GiftPercent.Enabled = CHK_RandomGift.Checked; NUD_GiftPercent.Value = Convert.ToDecimal(CHK_RandomGift.Checked) * 15; } + private void changeGiftPercent(object sender, EventArgs e) { CHK_RandomGift.Checked = NUD_GiftPercent.Value != 0; @@ -167,6 +171,7 @@ private void changeMoveRandomization(object sender, EventArgs e) CHK_ForceHighPower.Enabled = CHK_ForceHighPower.Checked = NUD_ForceHighPower.Enabled = CHK_NoFixedDamage.Enabled = CHK_NoFixedDamage.Checked = (CB_Moves.SelectedIndex == 1 || CB_Moves.SelectedIndex == 2); } + private void CHK_6PKM_CheckedChanged(object sender, EventArgs e) { //if (CB_Moves.SelectedIndex == 0) diff --git a/pk3DS/Subforms/Gen6/TutorEditor6.cs b/pk3DS/Subforms/Gen6/TutorEditor6.cs index 4c1cd3fabc..2dce1a95f9 100644 --- a/pk3DS/Subforms/Gen6/TutorEditor6.cs +++ b/pk3DS/Subforms/Gen6/TutorEditor6.cs @@ -59,12 +59,14 @@ private static int GetDataOffset(byte[] data) private readonly int offset; private int dataoffset; readonly string[] locations = { "1", "2", "3", "4" }; + private void getDataOffset(int index) { dataoffset = offset; // reset for (int i = 0; i < index; i++) - dataoffset += 2 * entries[i] + 2; // There's a EndCap + dataoffset += (2 * entries[i]) + 2; // There's a EndCap } + private void setupDGV() { DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); @@ -89,12 +91,14 @@ private void setupDGV() } private int entry = -1; + private void changeIndex(object sender, EventArgs e) { if (entry > -1) setList(); entry = CB_Location.SelectedIndex; getList(); } + private void getList() { dgv.Rows.Clear(); @@ -104,14 +108,15 @@ private void getList() for (int i = 0; i < count; i++) { dgv.Rows[i].Cells[0].Value = i.ToString(); - dgv.Rows[i].Cells[1].Value = movelist[BitConverter.ToUInt16(data, dataoffset + 2 * i)]; + dgv.Rows[i].Cells[1].Value = movelist[BitConverter.ToUInt16(data, dataoffset + (2 * i))]; } } + private void setList() { int count = dgv.Rows.Count; for (int i = 0; i < count; i++) - Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(movelist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(movelist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + (2 * i), 2); } private void formClosing(object sender, FormClosingEventArgs e) diff --git a/pk3DS/Subforms/Gen6/TypeChart6.cs b/pk3DS/Subforms/Gen6/TypeChart6.cs index 459de25f43..799568af3c 100644 --- a/pk3DS/Subforms/Gen6/TypeChart6.cs +++ b/pk3DS/Subforms/Gen6/TypeChart6.cs @@ -33,12 +33,14 @@ private void populateChart() { PB_Chart.Image = TypeChart.getGrid(TypeWidth, TypeCount, chart); } + private void B_Save_Click(object sender, EventArgs e) { Array.Copy(chart, 0, CROData, offset, chart.Length); File.WriteAllBytes(CROPath, CROData); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); @@ -47,15 +49,16 @@ private void B_Cancel_Click(object sender, EventArgs e) private void moveMouse(object sender, MouseEventArgs e) { GetCoordinate((PictureBox)sender, e, out int X, out int Y); - int index = Y * TypeCount + X; + int index = (Y * TypeCount) + X; if (index >= chart.Length) return; updateLabel(X, Y, chart[index]); } + private void clickMouse(object sender, MouseEventArgs e) { GetCoordinate((PictureBox)sender, e, out int X, out int Y); - int index = Y * TypeCount + X; + int index = (Y * TypeCount) + X; if (index >= chart.Length) return; @@ -64,12 +67,14 @@ private void clickMouse(object sender, MouseEventArgs e) updateLabel(X, Y, chart[index]); populateChart(); } + private void updateLabel(int X, int Y, int value) { if (value >= effects.Length || X >= types.Length || Y >= types.Length) return; // clicking and moving outside the box has invalid values L_Hover.Text = $"[{X:00}x{Y:00}: {value:00}] {types[Y]} attacking {types[X]} {effects[value]}"; } + private readonly string[] effects = { "has no effect!", @@ -90,6 +95,7 @@ public static void GetCoordinate(Control sender, MouseEventArgs e, out int X, ou if (e.Y == sender.Height - 1 - 2) Y -= 1; } + public static byte ToggleEffectiveness(byte currentValue, bool increase) { byte[] vals = { 0, 2, 4, 8 }; diff --git a/pk3DS/Subforms/Gen6/XYWE.cs b/pk3DS/Subforms/Gen6/XYWE.cs index a5786deb91..bd64cfe791 100644 --- a/pk3DS/Subforms/Gen6/XYWE.cs +++ b/pk3DS/Subforms/Gen6/XYWE.cs @@ -277,6 +277,7 @@ public XYWE() openQuick(Directory.GetFiles("encdata")); RandSettings.GetFormSettings(this, GB_Tweak.Controls); } + private readonly ComboBox[] spec; private readonly NumericUpDown[] min; private readonly NumericUpDown[] max; @@ -320,8 +321,8 @@ private void openQuick(string[] encdata) string name = Path.GetFileNameWithoutExtension(filepaths[f]); int LocationNum = Convert.ToInt16(name.Substring(4, name.Length - 4)); - int indNum = LocationNum * 56 + 0x1C; - string LocationName = metXY_00000[zonedata[indNum] + 0x100 * (zonedata[indNum + 1] & 1)]; + int indNum = (LocationNum * 56) + 0x1C; + string LocationName = metXY_00000[zonedata[indNum] + (0x100 * (zonedata[indNum + 1] & 1))]; LocationNames[f] = LocationNum.ToString("000") + " - " + LocationName; } CB_LocationID.DataSource = LocationNames; @@ -341,6 +342,7 @@ private bool hasData() } return false; } + private void parse(byte[] ed) { // 12,12,12,12,12 @@ -354,7 +356,7 @@ private void parse(byte[] ed) for (int i = 0; i < max.Length; i++) { // Fetch Data - Array.Copy(ed, offset + i * 4, slot, 0, 4); + Array.Copy(ed, offset + (i * 4), slot, 0, 4); int[] data = pslot(slot); // Load Data @@ -374,6 +376,7 @@ private void parse(byte[] ed) File.WriteAllBytes(Path.Combine("encounter_xy", loc.ToString("000") + CB_LocationID.SelectedIndex.ToString("000") + ".bin"), edata); #endif } + private int[] pslot(byte[] slot) { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; @@ -387,6 +390,7 @@ private int[] pslot(byte[] slot) data[3] = max; return data; } + private string parseslot(byte[] slot) { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; @@ -406,7 +410,6 @@ private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) using (var s = File.OpenRead(filepaths[f])) using (var br = new BinaryReader(s)) { - br.BaseStream.Seek(0x10, SeekOrigin.Begin); offset = br.ReadInt32() + 0x10; int length = (int)br.BaseStream.Length - offset; @@ -423,6 +426,7 @@ private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) Array.Copy(filedata, offset, encounterdata, 0, 0x178); parse(encounterdata); } + private void ClearData() { for (int i = 0; i < max.Length; i++) @@ -434,6 +438,7 @@ private void ClearData() max[i].Value = 0; } } + private byte[] MakeSlotData(int species, int f, int lo, int hi) { byte[] data = new byte[4]; @@ -442,6 +447,7 @@ private byte[] MakeSlotData(int species, int f, int lo, int hi) data[3] = (byte)hi; return data; } + private byte[] MakeEncounterData() { byte[] ed = new byte[0x178]; @@ -449,10 +455,11 @@ private byte[] MakeEncounterData() for (int i = 0; i < max.Length; i++) { byte[] data = MakeSlotData(spec[i].SelectedIndex, (int)form[i].Value, (int)min[i].Value, (int)max[i].Value); - Array.Copy(data, 0, ed, offset + i * 4, 4); + Array.Copy(data, 0, ed, offset + (i * 4), 4); } return ed; } + private byte[] ConcatArrays(byte[] b1, byte[] b2) { byte[] concat = new byte[b1.Length + b2.Length]; @@ -534,7 +541,6 @@ private void B_Randomize_Click(object sender, EventArgs e) for (int l = 0; l < max.Length; l++) min[l].Value = max[l].Value = max[l].Value <= 1 ? max[l].Value : Math.Max(1, Math.Min(100, (int)(leveldiff * max[l].Value))); - // If Distinct Hordes are selected, homogenize int hordeslot = 0; for (int slot = 0; slot < max.Length; slot++) @@ -561,6 +567,7 @@ private void B_Randomize_Click(object sender, EventArgs e) Enabled = true; WinFormsUtil.Alert("Randomized all Wild Encounters according to specification!", "Press the Dump Tables button to view the new Wild Encounter information!"); } + private void setRandomForm(int slot, int species) { if (CHK_MegaForm.Checked && Main.SpeciesStat[species].FormeCount > 1 && Legal.Mega_XY.Contains((ushort)species)) diff --git a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs index 1042fd92f7..ec733a56ff 100644 --- a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs @@ -61,6 +61,7 @@ public EggMoveEditor7(byte[][] infiles) private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private bool dumping; private readonly int[] baseForms, formVal; + private void setupDGV() { string[] sortedmoves = (string[])movelist.Clone(); @@ -79,6 +80,7 @@ private void setupDGV() } private EggMoves pkm = new EggMoves7(new byte[0]); + private void getList() { entry = WinFormsUtil.getIndex(CB_Species); @@ -103,6 +105,7 @@ private void getList() dgv.CancelEdit(); } + private void setList() { if (entry < 1 || dumping) return; @@ -140,6 +143,7 @@ private void B_RandAll_Click(object sender, EventArgs e) getList(); WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!", "Press the Dump All button to see the new Egg Moves!"); } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Egg Moves to Text File?")) @@ -196,7 +200,7 @@ private void calcStats() if (max < movecount) { max = movecount; spec = i; } // Max Moves (and species) for (int m = 0; m < movecount; m++) { - int move = BitConverter.ToUInt16(movedata, m * 2 + 4); + int move = BitConverter.ToUInt16(movedata, (m * 2) + 4); if (Main.SpeciesStat[i].Types.Contains(MoveData[move].Type)) stab++; } diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs index 74c50d0468..9e75274fe0 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs @@ -95,6 +95,7 @@ public EvolutionEditor7(byte[][] infiles) CB_Species.SelectedIndex = 1; RandSettings.GetFormSettings(this, GB_Randomizer.Controls); } + private readonly byte[][] files; private readonly ComboBox[] pb, mb, rb; private readonly NumericUpDown[] fb, lb; @@ -108,6 +109,7 @@ public EvolutionEditor7(byte[][] infiles) private readonly int[] baseForms, formVal; private EvolutionSet evo = new EvolutionSet7(new byte[EvolutionSet7.SIZE]); private readonly int maxEvoMethod; + private void getList() { entry = Array.IndexOf(specieslist, CB_Species.Text); @@ -130,6 +132,7 @@ private void getList() changeInto(rb[i], null); // refresh sprite } } + private void setList() { if (entry < 1 || dumping) return; @@ -170,6 +173,7 @@ private void B_RandAll_Click(object sender, EventArgs e) WinFormsUtil.Alert("All Pokémon's Evolutions have been randomized!"); } + private void B_Trade_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Remove all trade evolutions?", "Evolution methods will be altered so that evolutions will be possible with only one game.")) @@ -185,6 +189,7 @@ private void B_Trade_Click(object sender, EventArgs e) WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Evolutions to Text File?")) @@ -282,6 +287,7 @@ private void changeMethod(object sender, EventArgs e) } pb[op].SelectedIndex = 0; } + private void changeInto(object sender, EventArgs e) { if (loading || dumping) diff --git a/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs b/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs index 1cb454754e..d82cfd4581 100644 --- a/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs +++ b/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs @@ -13,6 +13,7 @@ public partial class OWSE7 : Form private readonly lzGARCFile EncounterData; private readonly lzGARCFile WorldData; private readonly lzGARCFile ZoneData; + public OWSE7(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd) { EncounterData = ed; @@ -31,7 +32,7 @@ public OWSE7(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd) } private readonly byte[] zoneData; - private byte[] worldData; + private readonly byte[] worldData; private readonly string[] locationList; private void loadData() @@ -48,10 +49,11 @@ private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) { setEntry(); entry = CB_LocationID.SelectedIndex; - getEntry(); + GetEntry(); } private int entry = -1; + private void setEntry() { if (entry < 0) @@ -62,7 +64,8 @@ private void setEntry() private bool loading = false; private World Map; - private void getEntry() + + private void GetEntry() { Console.WriteLine($"Loading {CB_LocationID.Text}"); int index = entry*11; @@ -102,8 +105,8 @@ private void getEntry() private class World { - private byte[][] _7; - private byte[][] _8; + private readonly byte[][] _7; + private readonly byte[][] _8; private bool HasZS => _7 != null; private bool HasZI => _8 != null; @@ -144,6 +147,7 @@ private void NUD_7_Count_ValueChanged(object sender, EventArgs e) }; L_7_Info.Text = string.Join(Environment.NewLine, lines); } + private void NUD_8_Count_ValueChanged(object sender, EventArgs e) { if (loading) diff --git a/pk3DS/Subforms/Gen7/ItemEditor7.cs b/pk3DS/Subforms/Gen7/ItemEditor7.cs index 7436771fa3..019e2ba24e 100644 --- a/pk3DS/Subforms/Gen7/ItemEditor7.cs +++ b/pk3DS/Subforms/Gen7/ItemEditor7.cs @@ -28,7 +28,9 @@ private void Setup() foreach (string s in itemlist) CB_Item.Items.Add(s); CB_Item.SelectedIndex = 1; } + private int entry = -1; + private void changeEntry(object sender, EventArgs e) { setEntry(); @@ -36,6 +38,7 @@ private void changeEntry(object sender, EventArgs e) L_Index.Text = $"Index: {entry:000}"; getEntry(); } + private void getEntry() { if (entry < 1) return; @@ -43,11 +46,13 @@ private void getEntry() RTB.Text = itemflavor[entry].Replace("\\n", Environment.NewLine); } + private void setEntry() { if (entry < 1) return; files[entry] = ((Item)Grid.SelectedObject).Write(); } + private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); diff --git a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs index f2612778e5..56dd3d99f1 100644 --- a/pk3DS/Subforms/Gen7/LevelUpEditor7.cs +++ b/pk3DS/Subforms/Gen7/LevelUpEditor7.cs @@ -48,6 +48,7 @@ public LevelUpEditor7(byte[][] infiles) private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private bool dumping; private readonly int[] baseForms, formVal; + private void setupDGV() { string[] sortedmoves = (string[])movelist.Clone(); @@ -74,6 +75,7 @@ private void setupDGV() } private Learnset pkm; + private void getList() { entry = WinFormsUtil.getIndex(CB_Species); @@ -101,6 +103,7 @@ private void getList() dgv.CancelEdit(); } + private void setList() { if (entry < 1 || dumping) return; @@ -154,6 +157,7 @@ private void B_RandAll_Click(object sender, EventArgs e) getList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!"); } + private void B_Metronome_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will modify learnsets to only have Metronome.") != DialogResult.Yes) return; @@ -170,6 +174,7 @@ private void B_Metronome_Click(object sender, EventArgs e) CB_Species.SelectedIndex = 0; WinFormsUtil.Alert("All Pokémon now only know the move Metronome!"); } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Level Up Moves to Text File?")) diff --git a/pk3DS/Subforms/Gen7/MaisonEditor7.cs b/pk3DS/Subforms/Gen7/MaisonEditor7.cs index 5833d14271..1c46db4fcd 100644 --- a/pk3DS/Subforms/Gen7/MaisonEditor7.cs +++ b/pk3DS/Subforms/Gen7/MaisonEditor7.cs @@ -37,6 +37,7 @@ public MaisonEditor7(byte[][] trd, byte[][] trp, bool royal) private int trEntry = -1; private int pkEntry = -1; private bool dumping; + private void Setup() { for (int i = 0; i < trClass.Length; i++) @@ -54,6 +55,7 @@ private void Setup() CB_Trainer.SelectedIndex = 1; } + private void changeTrainer(object sender, EventArgs e) { setTrainer(); @@ -62,12 +64,14 @@ private void changeTrainer(object sender, EventArgs e) if (GB_Trainer.Enabled) LB_Choices.SelectedIndex = 0; } + private void changePokemon(object sender, EventArgs e) { setPokemon(); pkEntry = CB_Pokemon.SelectedIndex; getPokemon(); } + private void getTrainer() { if (trEntry < 0) return; @@ -82,6 +86,7 @@ private void getTrainer() foreach (ushort Entry in tr.Choices) LB_Choices.Items.Add(Entry.ToString()); } + private void setTrainer() { if (trEntry < 0 || !GB_Trainer.Enabled || dumping) return; @@ -97,6 +102,7 @@ private void setTrainer() Array.Sort(tr.Choices); trFiles[trEntry] = tr.Write(); } + private void getPokemon() { if (pkEntry < 0 || dumping) return; @@ -120,6 +126,7 @@ private void getPokemon() CB_Species.SelectedIndex = pkm.Species; // Loaded last in order to refresh the sprite with all info. // Last 2 Bytes are unused. } + private void setPokemon() { if (pkEntry < 0 || dumping) return; @@ -157,6 +164,7 @@ private void B_Remove_Click(object sender, EventArgs e) if (LB_Choices.SelectedIndex > -1 && GB_Trainer.Enabled) LB_Choices.Items.RemoveAt(LB_Choices.SelectedIndex); } + private void B_Set_Click(object sender, EventArgs e) { if (LB_Choices.SelectedIndex <= -1 || !GB_Trainer.Enabled) return; @@ -181,6 +189,7 @@ private void B_Set_Click(object sender, EventArgs e) // Set current index to the one just added. LB_Choices.SelectedIndex = Array.IndexOf(choiceList, toAdd); } + private void B_View_Click(object sender, EventArgs e) { if (LB_Choices.SelectedIndex > -1 && GB_Trainer.Enabled) @@ -222,6 +231,7 @@ private void DumpTRs_Click(object sender, EventArgs e) dumping = false; CB_Trainer.SelectedIndex = 0; } + private void B_DumpPKs_Click(object sender, EventArgs e) { //File.WriteAllBytes("maiz", pkFiles.SelectMany(t => t).ToArray()); @@ -244,7 +254,7 @@ private void B_DumpPKs_Click(object sender, EventArgs e) result += $"Move 4: {movelist[pk.Move4]}" + Environment.NewLine; var EVstr = string.Join(",", pk.EVs.Select((iv, x) => iv ? stats[x] : string.Empty).Where(x => !string.IsNullOrWhiteSpace(x))); - result += $"EV'd in: {(pk.EVs.Any() ? EVstr : "None")}" + Environment.NewLine; + result += $"EV'd in: {(pk.EVs.Length > 0 ? EVstr : "None")}" + Environment.NewLine; if (pk.Form > 0) result += $"Form: {pk.Form}" + Environment.NewLine; diff --git a/pk3DS/Subforms/Gen7/MartEditor7.cs b/pk3DS/Subforms/Gen7/MartEditor7.cs index 3ff8f672bb..0cf9cc99f8 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7.cs @@ -9,6 +9,7 @@ namespace pk3DS public partial class MartEditor7 : Form { private readonly string CROPath = Path.Combine(Main.RomFSPath, "Shop.cro"); + public MartEditor7() { if (!File.Exists(CROPath)) @@ -40,11 +41,13 @@ public MartEditor7() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, }; + private readonly byte[] BPSignature = // 2 arrays after the regular shops, the BP shops start. Skip over the second one to get BP offset. { 0x09, 0x0B, 0x0D, 0x0F, 0x11, 0x13, 0x14, 0x15, 0x09, 0x04, 0x08, 0x0C, 0x05, 0x04, 0x0B, 0x03, 0x0A, 0x06, 0x0A, 0x06, 0x04, 0x05, 0x07, 0x01 }; + private readonly byte[] entries = { 9, 11, 13, 15, 17, 19, 20, 21, // Regular Mart @@ -65,6 +68,7 @@ public MartEditor7() 7, // Thrifty 2 1, // Thrifty 3 (Souvenir) }; + private readonly string[] locations = { "No Trials", "1 Trial", "2 Trials", "3 Trials", "4 Trials", "5 Trials", "6 Trials", "7 Trials", @@ -95,6 +99,7 @@ public MartEditor7() 21, // Tree 2 16, // Tree 3 }; + private readonly string[] locationsBP = { "Battle Royal Dome [Medicine]", @@ -113,6 +118,7 @@ private void B_Save_Click(object sender, EventArgs e) File.WriteAllBytes(CROPath, data); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); @@ -120,6 +126,7 @@ private void B_Cancel_Click(object sender, EventArgs e) private readonly int offset; private int dataoffset; + private void getDataOffset(int index) { dataoffset = offset; // reset @@ -136,12 +143,14 @@ private void setupDGV() } private int entry = -1; + private void changeIndex(object sender, EventArgs e) { if (entry > -1) setList(); entry = CB_Location.SelectedIndex; getList(); } + private void getList() { dgv.Rows.Clear(); @@ -151,14 +160,15 @@ private void getList() for (int i = 0; i < count; i++) { dgv.Rows[i].Cells[0].Value = i.ToString(); - dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffset + 2 * i)]; + dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffset + (2 * i))]; } } + private void setList() { int count = dgv.Rows.Count; for (int i = 0; i < count; i++) - Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + (2 * i), 2); } /// @@ -173,6 +183,7 @@ private void setList() 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 618, 619, 620, 690, 691, 692, 693, 694, 701, 737 }; + private void B_Randomize_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize mart inventories?")) @@ -207,15 +218,18 @@ private void getDataOffsetBP(int index) for (int i = 0; i < index; i++) dataoffsetBP += 4 * entriesBP[i]; } + private readonly int offsetBP; private int dataoffsetBP; private int entryBP = -1; + private void changeIndexBP(object sender, EventArgs e) { if (entryBP > -1) setListBP(); entryBP = CB_LocationBP.SelectedIndex; getListBP(); } + private void getListBP() { dgvbp.Rows.Clear(); @@ -225,22 +239,24 @@ private void getListBP() for (int i = 0; i < count; i++) { dgvbp.Rows[i].Cells[0].Value = i.ToString(); - dgvbp.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffsetBP + 4 * i)]; - dgvbp.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, dataoffsetBP + 4 * i + 2).ToString(); + dgvbp.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffsetBP + (4 * i))]; + dgvbp.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, dataoffsetBP + (4 * i) + 2).ToString(); } } + private void setListBP() { int count = dgvbp.Rows.Count; for (int i = 0; i < count; i++) { int item = Array.IndexOf(itemlist, dgvbp.Rows[i].Cells[1].Value); - Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, dataoffsetBP + 4 * i, 2); + Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, dataoffsetBP + (4 * i), 2); int price; string p = dgvbp.Rows[i].Cells[2].Value.ToString(); if (int.TryParse(p, out price)) - Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, dataoffsetBP + 4 * i + 2, 2); + Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, dataoffsetBP + (4 * i) + 2, 2); } } + private void B_RandomizeBP_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize BP inventories?")) diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.cs b/pk3DS/Subforms/Gen7/MartEditor7UU.cs index 564bd94c5f..54ad1bde0e 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.cs @@ -10,6 +10,7 @@ namespace pk3DS public partial class MartEditor7UU : Form { private readonly string CROPath = Path.Combine(Main.RomFSPath, "Shop.cro"); + public MartEditor7UU() { if (!File.Exists(CROPath)) @@ -34,6 +35,7 @@ public MartEditor7UU() CB_LocationBPItem.SelectedIndex = CB_LocationBPMove.SelectedIndex = 0; } + private const int ofs_Item = 0x50BC; private const int ofs_BPItem = 0x52FA; private const int ofs_BPTutor = 0x54DE; @@ -70,6 +72,7 @@ public MartEditor7UU() "Tapu Village [X Items]", "Mount Lanakila [X Items]", }; + private readonly string[] locationsBP = { "Battle Royal Dome [Medicine]", @@ -80,6 +83,7 @@ public MartEditor7UU() "Battle Tree [Mega Stones]", "Beaches [Medicine]" }; + private readonly string[] locationsTutor = { "Big Wave Beach", @@ -97,6 +101,7 @@ private void B_Save_Click(object sender, EventArgs e) File.WriteAllBytes(CROPath, data); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) => Close(); private void setupDGV() @@ -119,12 +124,14 @@ private void changeIndexItem(object sender, EventArgs e) entryItem = CB_Location.SelectedIndex; getListItem(); } + private void changeIndexBPItem(object sender, EventArgs e) { if (entryBPItem > -1) setListBPItem(); entryBPItem = CB_LocationBPItem.SelectedIndex; getListBPItem(); } + private void changeIndexBPMove(object sender, EventArgs e) { if (entryBPMove > -1) setListBPMove(); @@ -137,71 +144,75 @@ private void getListItem() dgv.Rows.Clear(); int count = len_Items[entryItem]; dgv.Rows.Add(count); - var ofs = ofs_Item + len_Items.Take(entryItem).Sum(z => z) * 2; + var ofs = ofs_Item + (len_Items.Take(entryItem).Sum(z => z) * 2); for (int i = 0; i < count; i++) { dgv.Rows[i].Cells[0].Value = i.ToString(); - dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, ofs + 2 * i)]; + dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, ofs + (2 * i))]; } } + private void getListBPItem() { dgvbp.Rows.Clear(); int count = len_BPItem[entryBPItem]; dgvbp.Rows.Add(count); - var ofs = ofs_BPItem + len_BPItem.Take(entryBPItem).Sum(z => z) * 4; + var ofs = ofs_BPItem + (len_BPItem.Take(entryBPItem).Sum(z => z) * 4); for (int i = 0; i < count; i++) { dgvbp.Rows[i].Cells[0].Value = i.ToString(); - dgvbp.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, ofs + 4 * i)]; - dgvbp.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, ofs + 4 * i + 2).ToString(); + dgvbp.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, ofs + (4 * i))]; + dgvbp.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, ofs + (4 * i) + 2).ToString(); } } + private void getListBPMove() { dgvmv.Rows.Clear(); int count = len_BPTutor[entryBPMove]; dgvmv.Rows.Add(count); - var ofs = ofs_BPTutor + len_BPTutor.Take(entryBPMove).Sum(z => z) * 4; + var ofs = ofs_BPTutor + (len_BPTutor.Take(entryBPMove).Sum(z => z) * 4); for (int i = 0; i < count; i++) { dgvmv.Rows[i].Cells[0].Value = i.ToString(); - dgvmv.Rows[i].Cells[1].Value = movelist[BitConverter.ToUInt16(data, ofs + 4 * i)]; - dgvmv.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, ofs + 4 * i + 2).ToString(); + dgvmv.Rows[i].Cells[1].Value = movelist[BitConverter.ToUInt16(data, ofs + (4 * i))]; + dgvmv.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, ofs + (4 * i) + 2).ToString(); } } private void setListItem() { int count = dgv.Rows.Count; - var ofs = ofs_Item + len_Items.Take(entryItem).Sum(z => z) * 2; + var ofs = ofs_Item + (len_Items.Take(entryItem).Sum(z => z) * 2); for (int i = 0; i < count; i++) - Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, ofs + 2 * i, 2); + Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, ofs + (2 * i), 2); } + private void setListBPItem() { int count = dgvbp.Rows.Count; - var ofs = ofs_BPItem + len_BPItem.Take(entryBPItem).Sum(z => z) * 4; + var ofs = ofs_BPItem + (len_BPItem.Take(entryBPItem).Sum(z => z) * 4); for (int i = 0; i < count; i++) { int item = Array.IndexOf(itemlist, dgvbp.Rows[i].Cells[1].Value); - Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, ofs + 4 * i, 2); + Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, ofs + (4 * i), 2); int price; string p = dgvbp.Rows[i].Cells[2].Value.ToString(); if (int.TryParse(p, out price)) - Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, ofs + 4 * i + 2, 2); + Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, ofs + (4 * i) + 2, 2); } } + private void setListBPMove() { int count = dgvmv.Rows.Count; - var ofs = ofs_BPTutor + len_BPTutor.Take(entryBPMove).Sum(z => z) * 4; + var ofs = ofs_BPTutor + (len_BPTutor.Take(entryBPMove).Sum(z => z) * 4); for (int i = 0; i < count; i++) { int item = Array.IndexOf(movelist, dgvmv.Rows[i].Cells[1].Value); - Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, ofs + 4 * i, 2); + Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, ofs + (4 * i), 2); int price; string p = dgvmv.Rows[i].Cells[2].Value.ToString(); if (int.TryParse(p, out price)) - Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, ofs + 4 * i + 2, 2); + Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, ofs + (4 * i) + 2, 2); } } @@ -220,6 +231,7 @@ private void B_Randomize_Click(object sender, EventArgs e) break; } } + private void RandomizeItems() { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize mart inventories?")) @@ -247,6 +259,7 @@ private void RandomizeItems() } WinFormsUtil.Alert("Randomized!"); } + private void RandomizeBPItems() { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize BP inventories?")) diff --git a/pk3DS/Subforms/Gen7/MegaEvoEditor7.cs b/pk3DS/Subforms/Gen7/MegaEvoEditor7.cs index 27bfd212c8..cd09e37c04 100644 --- a/pk3DS/Subforms/Gen7/MegaEvoEditor7.cs +++ b/pk3DS/Subforms/Gen7/MegaEvoEditor7.cs @@ -51,6 +51,7 @@ public MegaEvoEditor7(byte[][] infiles) // All the initial settings Setup(); CB_Species.SelectedIndex = 0; } + private void Setup() { List temp_list = new List(specieslist); @@ -88,6 +89,7 @@ private void Setup() loaded = true; } + private void CHK_Changed(object sender, EventArgs e) { for (int i = 0; i < groupbox_spec.Length; i++) @@ -103,6 +105,7 @@ private void changeIndex(object sender, EventArgs e) entry = (int)CB_Species.SelectedValue; getEntry(); } + private void getEntry() { if (!loaded) return; @@ -122,6 +125,7 @@ private void getEntry() forme_spec[i].SelectedIndex = me.Form[i]; } } + private void setEntry() { if (entry < 1 || entry == 384) return; // Don't edit invalid / Rayquaza. @@ -180,6 +184,7 @@ private void UpdateImage(PictureBox pb, int species, int form, int item, int gen } pb.Image = WinFormsUtil.getSprite(species, form, gender, item, Main.Config); } + private void formClosing(object sender, FormClosingEventArgs e) { setEntry(); diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs index aa45f9b82f..310f237eeb 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs @@ -120,9 +120,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_0x21)).BeginInit(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); - // + // // L_Type - // + // this.L_Type.AutoSize = true; this.L_Type.Location = new System.Drawing.Point(32, 38); this.L_Type.Name = "L_Type"; @@ -130,9 +130,9 @@ private void InitializeComponent() this.L_Type.TabIndex = 0; this.L_Type.Text = "Type:"; this.L_Type.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Move - // + // this.CB_Move.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Move.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Move.DropDownWidth = 120; @@ -141,10 +141,10 @@ private void InitializeComponent() this.CB_Move.Name = "CB_Move"; this.CB_Move.Size = new System.Drawing.Size(130, 21); this.CB_Move.TabIndex = 1; - this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.changeEntry); - // + this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); + // // L_Move - // + // this.L_Move.AutoSize = true; this.L_Move.Location = new System.Drawing.Point(33, 13); this.L_Move.Name = "L_Move"; @@ -152,27 +152,27 @@ private void InitializeComponent() this.L_Move.TabIndex = 2; this.L_Move.Text = "Move:"; this.L_Move.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Type - // + // this.CB_Type.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Type.FormattingEnabled = true; this.CB_Type.Location = new System.Drawing.Point(71, 35); this.CB_Type.Name = "CB_Type"; this.CB_Type.Size = new System.Drawing.Size(99, 21); this.CB_Type.TabIndex = 3; - // + // // CB_Category - // + // this.CB_Category.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Category.FormattingEnabled = true; this.CB_Category.Location = new System.Drawing.Point(71, 58); this.CB_Category.Name = "CB_Category"; this.CB_Category.Size = new System.Drawing.Size(99, 21); this.CB_Category.TabIndex = 4; - // + // // L_Category - // + // this.L_Category.AutoSize = true; this.L_Category.Location = new System.Drawing.Point(18, 61); this.L_Category.Name = "L_Category"; @@ -180,9 +180,9 @@ private void InitializeComponent() this.L_Category.TabIndex = 5; this.L_Category.Text = "Category:"; this.L_Category.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_BP - // + // this.L_BP.AutoSize = true; this.L_BP.Location = new System.Drawing.Point(26, 132); this.L_BP.Name = "L_BP"; @@ -190,9 +190,9 @@ private void InitializeComponent() this.L_BP.TabIndex = 7; this.L_BP.Text = "Power:"; this.L_BP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_PP - // + // this.L_PP.AutoSize = true; this.L_PP.Location = new System.Drawing.Point(15, 174); this.L_PP.Name = "L_PP"; @@ -200,9 +200,9 @@ private void InitializeComponent() this.L_PP.TabIndex = 8; this.L_PP.Text = "Base PP:"; this.L_PP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Min - // + // this.L_Min.AutoSize = true; this.L_Min.Location = new System.Drawing.Point(236, 132); this.L_Min.Name = "L_Min"; @@ -210,9 +210,9 @@ private void InitializeComponent() this.L_Min.TabIndex = 10; this.L_Min.Text = "Min Hits:"; this.L_Min.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Max - // + // this.L_Max.AutoSize = true; this.L_Max.Location = new System.Drawing.Point(233, 153); this.L_Max.Name = "L_Max"; @@ -220,18 +220,18 @@ private void InitializeComponent() this.L_Max.TabIndex = 12; this.L_Max.Text = "Max Hits:"; this.L_Max.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Priority - // + // this.L_Priority.AutoSize = true; this.L_Priority.Location = new System.Drawing.Point(25, 195); this.L_Priority.Name = "L_Priority"; this.L_Priority.Size = new System.Drawing.Size(41, 13); this.L_Priority.TabIndex = 17; this.L_Priority.Text = "Priority:"; - // + // // NUD_HitMax - // + // this.NUD_HitMax.Location = new System.Drawing.Point(290, 151); this.NUD_HitMax.Maximum = new decimal(new int[] { 6, @@ -241,9 +241,9 @@ private void InitializeComponent() this.NUD_HitMax.Name = "NUD_HitMax"; this.NUD_HitMax.Size = new System.Drawing.Size(30, 20); this.NUD_HitMax.TabIndex = 18; - // + // // NUD_HitMin - // + // this.NUD_HitMin.Location = new System.Drawing.Point(290, 130); this.NUD_HitMin.Maximum = new decimal(new int[] { 6, @@ -253,9 +253,9 @@ private void InitializeComponent() this.NUD_HitMin.Name = "NUD_HitMin"; this.NUD_HitMin.Size = new System.Drawing.Size(30, 20); this.NUD_HitMin.TabIndex = 19; - // + // // NUD_Priority - // + // this.NUD_Priority.Location = new System.Drawing.Point(72, 193); this.NUD_Priority.Maximum = new decimal(new int[] { 8, @@ -270,9 +270,9 @@ private void InitializeComponent() this.NUD_Priority.Name = "NUD_Priority"; this.NUD_Priority.Size = new System.Drawing.Size(35, 20); this.NUD_Priority.TabIndex = 20; - // + // // NUD_PP - // + // this.NUD_PP.Location = new System.Drawing.Point(72, 172); this.NUD_PP.Maximum = new decimal(new int[] { 40, @@ -282,9 +282,9 @@ private void InitializeComponent() this.NUD_PP.Name = "NUD_PP"; this.NUD_PP.Size = new System.Drawing.Size(35, 20); this.NUD_PP.TabIndex = 21; - // + // // NUD_Power - // + // this.NUD_Power.Location = new System.Drawing.Point(72, 130); this.NUD_Power.Maximum = new decimal(new int[] { 255, @@ -294,9 +294,9 @@ private void InitializeComponent() this.NUD_Power.Name = "NUD_Power"; this.NUD_Power.Size = new System.Drawing.Size(45, 20); this.NUD_Power.TabIndex = 22; - // + // // NUD_TurnMin - // + // this.NUD_TurnMin.Location = new System.Drawing.Point(290, 172); this.NUD_TurnMin.Maximum = new decimal(new int[] { 15, @@ -306,9 +306,9 @@ private void InitializeComponent() this.NUD_TurnMin.Name = "NUD_TurnMin"; this.NUD_TurnMin.Size = new System.Drawing.Size(30, 20); this.NUD_TurnMin.TabIndex = 26; - // + // // L_TrapMin - // + // this.L_TrapMin.AutoSize = true; this.L_TrapMin.Location = new System.Drawing.Point(227, 174); this.L_TrapMin.Name = "L_TrapMin"; @@ -316,9 +316,9 @@ private void InitializeComponent() this.L_TrapMin.TabIndex = 23; this.L_TrapMin.Text = "Min Turns:"; this.L_TrapMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_TurnMax - // + // this.NUD_TurnMax.Location = new System.Drawing.Point(290, 193); this.NUD_TurnMax.Maximum = new decimal(new int[] { 15, @@ -328,9 +328,9 @@ private void InitializeComponent() this.NUD_TurnMax.Name = "NUD_TurnMax"; this.NUD_TurnMax.Size = new System.Drawing.Size(30, 20); this.NUD_TurnMax.TabIndex = 25; - // + // // L_TrapMax - // + // this.L_TrapMax.AutoSize = true; this.L_TrapMax.Location = new System.Drawing.Point(224, 195); this.L_TrapMax.Name = "L_TrapMax"; @@ -338,9 +338,9 @@ private void InitializeComponent() this.L_TrapMax.TabIndex = 24; this.L_TrapMax.Text = "Max Turns:"; this.L_TrapMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Recoil - // + // this.NUD_Recoil.Location = new System.Drawing.Point(184, 172); this.NUD_Recoil.Minimum = new decimal(new int[] { 100, @@ -350,9 +350,9 @@ private void InitializeComponent() this.NUD_Recoil.Name = "NUD_Recoil"; this.NUD_Recoil.Size = new System.Drawing.Size(40, 20); this.NUD_Recoil.TabIndex = 34; - // + // // L_Recoil - // + // this.L_Recoil.AutoSize = true; this.L_Recoil.Location = new System.Drawing.Point(114, 174); this.L_Recoil.Name = "L_Recoil"; @@ -360,9 +360,9 @@ private void InitializeComponent() this.L_Recoil.TabIndex = 31; this.L_Recoil.Text = "Rec/Abs %:"; this.L_Recoil.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Heal - // + // this.NUD_Heal.Location = new System.Drawing.Point(184, 151); this.NUD_Heal.Maximum = new decimal(new int[] { 255, @@ -372,9 +372,9 @@ private void InitializeComponent() this.NUD_Heal.Name = "NUD_Heal"; this.NUD_Heal.Size = new System.Drawing.Size(40, 20); this.NUD_Heal.TabIndex = 33; - // + // // L_Heal - // + // this.L_Heal.AutoSize = true; this.L_Heal.Location = new System.Drawing.Point(135, 153); this.L_Heal.Name = "L_Heal"; @@ -382,9 +382,9 @@ private void InitializeComponent() this.L_Heal.TabIndex = 32; this.L_Heal.Text = "Heal %:"; this.L_Heal.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_CritStage - // + // this.NUD_CritStage.Location = new System.Drawing.Point(184, 193); this.NUD_CritStage.Maximum = new decimal(new int[] { 6, @@ -394,9 +394,9 @@ private void InitializeComponent() this.NUD_CritStage.Name = "NUD_CritStage"; this.NUD_CritStage.Size = new System.Drawing.Size(30, 20); this.NUD_CritStage.TabIndex = 30; - // + // // L_CritStage - // + // this.L_CritStage.AutoSize = true; this.L_CritStage.Location = new System.Drawing.Point(122, 195); this.L_CritStage.Name = "L_CritStage"; @@ -404,9 +404,9 @@ private void InitializeComponent() this.L_CritStage.TabIndex = 27; this.L_CritStage.Text = "Crit Stage:"; this.L_CritStage.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Flinch - // + // this.NUD_Flinch.Location = new System.Drawing.Point(184, 130); this.NUD_Flinch.Maximum = new decimal(new int[] { 101, @@ -416,9 +416,9 @@ private void InitializeComponent() this.NUD_Flinch.Name = "NUD_Flinch"; this.NUD_Flinch.Size = new System.Drawing.Size(40, 20); this.NUD_Flinch.TabIndex = 29; - // + // // L_Flinch - // + // this.L_Flinch.AutoSize = true; this.L_Flinch.Location = new System.Drawing.Point(129, 132); this.L_Flinch.Name = "L_Flinch"; @@ -426,9 +426,9 @@ private void InitializeComponent() this.L_Flinch.TabIndex = 28; this.L_Flinch.Text = "Flinch %:"; this.L_Flinch.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // GB_Stat - // + // this.GB_Stat.Controls.Add(this.NUD_StatP3); this.GB_Stat.Controls.Add(this.NUD_StatP2); this.GB_Stat.Controls.Add(this.NUD_StatP1); @@ -447,9 +447,9 @@ private void InitializeComponent() this.GB_Stat.TabIndex = 35; this.GB_Stat.TabStop = false; this.GB_Stat.Text = "Stat Stage Changes"; - // + // // NUD_StatP3 - // + // this.NUD_StatP3.Location = new System.Drawing.Point(165, 68); this.NUD_StatP3.Maximum = new decimal(new int[] { 101, @@ -459,9 +459,9 @@ private void InitializeComponent() this.NUD_StatP3.Name = "NUD_StatP3"; this.NUD_StatP3.Size = new System.Drawing.Size(40, 20); this.NUD_StatP3.TabIndex = 44; - // + // // NUD_StatP2 - // + // this.NUD_StatP2.Location = new System.Drawing.Point(165, 46); this.NUD_StatP2.Maximum = new decimal(new int[] { 101, @@ -471,9 +471,9 @@ private void InitializeComponent() this.NUD_StatP2.Name = "NUD_StatP2"; this.NUD_StatP2.Size = new System.Drawing.Size(40, 20); this.NUD_StatP2.TabIndex = 43; - // + // // NUD_StatP1 - // + // this.NUD_StatP1.Location = new System.Drawing.Point(165, 24); this.NUD_StatP1.Maximum = new decimal(new int[] { 101, @@ -483,9 +483,9 @@ private void InitializeComponent() this.NUD_StatP1.Name = "NUD_StatP1"; this.NUD_StatP1.Size = new System.Drawing.Size(40, 20); this.NUD_StatP1.TabIndex = 42; - // + // // NUD_Stat2 - // + // this.NUD_Stat2.Location = new System.Drawing.Point(127, 46); this.NUD_Stat2.Maximum = new decimal(new int[] { 5, @@ -500,9 +500,9 @@ private void InitializeComponent() this.NUD_Stat2.Name = "NUD_Stat2"; this.NUD_Stat2.Size = new System.Drawing.Size(35, 20); this.NUD_Stat2.TabIndex = 41; - // + // // NUD_Stat3 - // + // this.NUD_Stat3.Location = new System.Drawing.Point(127, 68); this.NUD_Stat3.Maximum = new decimal(new int[] { 5, @@ -517,9 +517,9 @@ private void InitializeComponent() this.NUD_Stat3.Name = "NUD_Stat3"; this.NUD_Stat3.Size = new System.Drawing.Size(35, 20); this.NUD_Stat3.TabIndex = 40; - // + // // NUD_Stat1 - // + // this.NUD_Stat1.Location = new System.Drawing.Point(127, 24); this.NUD_Stat1.Maximum = new decimal(new int[] { 5, @@ -534,63 +534,63 @@ private void InitializeComponent() this.NUD_Stat1.Name = "NUD_Stat1"; this.NUD_Stat1.Size = new System.Drawing.Size(35, 20); this.NUD_Stat1.TabIndex = 39; - // + // // CB_Stat3 - // + // this.CB_Stat3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat3.FormattingEnabled = true; this.CB_Stat3.Location = new System.Drawing.Point(27, 67); this.CB_Stat3.Name = "CB_Stat3"; this.CB_Stat3.Size = new System.Drawing.Size(99, 21); this.CB_Stat3.TabIndex = 38; - // + // // CB_Stat2 - // + // this.CB_Stat2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat2.FormattingEnabled = true; this.CB_Stat2.Location = new System.Drawing.Point(27, 45); this.CB_Stat2.Name = "CB_Stat2"; this.CB_Stat2.Size = new System.Drawing.Size(99, 21); this.CB_Stat2.TabIndex = 37; - // + // // CB_Stat1 - // + // this.CB_Stat1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat1.FormattingEnabled = true; this.CB_Stat1.Location = new System.Drawing.Point(27, 23); this.CB_Stat1.Name = "CB_Stat1"; this.CB_Stat1.Size = new System.Drawing.Size(99, 21); this.CB_Stat1.TabIndex = 36; - // + // // L_Stage3 - // + // this.L_Stage3.AutoSize = true; this.L_Stage3.Location = new System.Drawing.Point(5, 70); this.L_Stage3.Name = "L_Stage3"; this.L_Stage3.Size = new System.Drawing.Size(16, 13); this.L_Stage3.TabIndex = 2; this.L_Stage3.Text = "3:"; - // + // // L_Stage2 - // + // this.L_Stage2.AutoSize = true; this.L_Stage2.Location = new System.Drawing.Point(5, 48); this.L_Stage2.Name = "L_Stage2"; this.L_Stage2.Size = new System.Drawing.Size(16, 13); this.L_Stage2.TabIndex = 1; this.L_Stage2.Text = "2:"; - // + // // L_Stage1 - // + // this.L_Stage1.AutoSize = true; this.L_Stage1.Location = new System.Drawing.Point(5, 26); this.L_Stage1.Name = "L_Stage1"; this.L_Stage1.Size = new System.Drawing.Size(16, 13); this.L_Stage1.TabIndex = 0; this.L_Stage1.Text = "1:"; - // + // // L_Targeting - // + // this.L_Targeting.AutoSize = true; this.L_Targeting.Location = new System.Drawing.Point(173, 38); this.L_Targeting.Name = "L_Targeting"; @@ -598,9 +598,9 @@ private void InitializeComponent() this.L_Targeting.TabIndex = 36; this.L_Targeting.Text = "Targeting:"; this.L_Targeting.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Influcts - // + // this.L_Influcts.AutoSize = true; this.L_Influcts.Location = new System.Drawing.Point(188, 60); this.L_Influcts.Name = "L_Influcts"; @@ -608,10 +608,10 @@ private void InitializeComponent() this.L_Influcts.TabIndex = 37; this.L_Influcts.Text = "Inflicts:"; this.L_Influcts.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB - // - this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + // + this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.RTB.Location = new System.Drawing.Point(12, 324); this.RTB.Name = "RTB"; @@ -619,9 +619,9 @@ private void InitializeComponent() this.RTB.Size = new System.Drawing.Size(316, 51); this.RTB.TabIndex = 38; this.RTB.Text = ""; - // + // // CB_Targeting - // + // this.CB_Targeting.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Targeting.DropDownWidth = 150; this.CB_Targeting.FormattingEnabled = true; @@ -629,9 +629,9 @@ private void InitializeComponent() this.CB_Targeting.Name = "CB_Targeting"; this.CB_Targeting.Size = new System.Drawing.Size(99, 21); this.CB_Targeting.TabIndex = 39; - // + // // CB_Inflict - // + // this.CB_Inflict.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Inflict.DropDownWidth = 150; this.CB_Inflict.FormattingEnabled = true; @@ -639,9 +639,9 @@ private void InitializeComponent() this.CB_Inflict.Name = "CB_Inflict"; this.CB_Inflict.Size = new System.Drawing.Size(99, 21); this.CB_Inflict.TabIndex = 40; - // + // // L_Inflict - // + // this.L_Inflict.AutoSize = true; this.L_Inflict.Location = new System.Drawing.Point(238, 81); this.L_Inflict.Name = "L_Inflict"; @@ -649,9 +649,9 @@ private void InitializeComponent() this.L_Inflict.TabIndex = 41; this.L_Inflict.Text = "Inflict %:"; this.L_Inflict.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Inflict - // + // this.NUD_Inflict.Location = new System.Drawing.Point(287, 78); this.NUD_Inflict.Maximum = new decimal(new int[] { 101, @@ -661,9 +661,9 @@ private void InitializeComponent() this.NUD_Inflict.Name = "NUD_Inflict"; this.NUD_Inflict.Size = new System.Drawing.Size(40, 20); this.NUD_Inflict.TabIndex = 42; - // + // // NUD_Effect - // + // this.NUD_Effect.Location = new System.Drawing.Point(150, 103); this.NUD_Effect.Maximum = new decimal(new int[] { 65535, @@ -673,9 +673,9 @@ private void InitializeComponent() this.NUD_Effect.Name = "NUD_Effect"; this.NUD_Effect.Size = new System.Drawing.Size(50, 20); this.NUD_Effect.TabIndex = 44; - // + // // L_Effect - // + // this.L_Effect.AutoSize = true; this.L_Effect.Location = new System.Drawing.Point(106, 106); this.L_Effect.Name = "L_Effect"; @@ -683,9 +683,9 @@ private void InitializeComponent() this.L_Effect.TabIndex = 45; this.L_Effect.Text = "Effect:"; this.L_Effect.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Accuracy - // + // this.NUD_Accuracy.Location = new System.Drawing.Point(72, 151); this.NUD_Accuracy.Maximum = new decimal(new int[] { 101, @@ -695,9 +695,9 @@ private void InitializeComponent() this.NUD_Accuracy.Name = "NUD_Accuracy"; this.NUD_Accuracy.Size = new System.Drawing.Size(40, 20); this.NUD_Accuracy.TabIndex = 47; - // + // // L_Accuracy - // + // this.L_Accuracy.AutoSize = true; this.L_Accuracy.Location = new System.Drawing.Point(17, 153); this.L_Accuracy.Name = "L_Accuracy"; @@ -705,9 +705,9 @@ private void InitializeComponent() this.L_Accuracy.TabIndex = 46; this.L_Accuracy.Text = "Accur %:"; this.L_Accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Quality - // + // this.CB_Quality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Quality.DropDownWidth = 170; this.CB_Quality.FormattingEnabled = true; @@ -715,9 +715,9 @@ private void InitializeComponent() this.CB_Quality.Name = "CB_Quality"; this.CB_Quality.Size = new System.Drawing.Size(129, 21); this.CB_Quality.TabIndex = 48; - // + // // L_Quality - // + // this.L_Quality.AutoSize = true; this.L_Quality.Location = new System.Drawing.Point(20, 84); this.L_Quality.Name = "L_Quality"; @@ -725,9 +725,9 @@ private void InitializeComponent() this.L_Quality.TabIndex = 49; this.L_Quality.Text = "Qualities:"; this.L_Quality.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_0xB - // + // this.L_0xB.AutoSize = true; this.L_0xB.Location = new System.Drawing.Point(256, 101); this.L_0xB.Name = "L_0xB"; @@ -735,9 +735,9 @@ private void InitializeComponent() this.L_0xB.TabIndex = 50; this.L_0xB.Text = "0xB:"; this.L_0xB.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_0xB - // + // this.NUD_0xB.Location = new System.Drawing.Point(287, 99); this.NUD_0xB.Maximum = new decimal(new int[] { 255, @@ -747,9 +747,9 @@ private void InitializeComponent() this.NUD_0xB.Name = "NUD_0xB"; this.NUD_0xB.Size = new System.Drawing.Size(40, 20); this.NUD_0xB.TabIndex = 51; - // + // // NUD_0x20 - // + // this.NUD_0x20.Location = new System.Drawing.Point(282, 239); this.NUD_0x20.Maximum = new decimal(new int[] { 255, @@ -759,9 +759,9 @@ private void InitializeComponent() this.NUD_0x20.Name = "NUD_0x20"; this.NUD_0x20.Size = new System.Drawing.Size(40, 20); this.NUD_0x20.TabIndex = 52; - // + // // NUD_0x21 - // + // this.NUD_0x21.Location = new System.Drawing.Point(282, 261); this.NUD_0x21.Maximum = new decimal(new int[] { 255, @@ -771,9 +771,9 @@ private void InitializeComponent() this.NUD_0x21.Name = "NUD_0x21"; this.NUD_0x21.Size = new System.Drawing.Size(40, 20); this.NUD_0x21.TabIndex = 53; - // + // // L_0x20 - // + // this.L_0x20.AutoSize = true; this.L_0x20.Location = new System.Drawing.Point(232, 242); this.L_0x20.Name = "L_0x20"; @@ -781,9 +781,9 @@ private void InitializeComponent() this.L_0x20.TabIndex = 59; this.L_0x20.Text = "Flags 1:"; this.L_0x20.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_0x21 - // + // this.L_0x21.AutoSize = true; this.L_0x21.Location = new System.Drawing.Point(233, 264); this.L_0x21.Name = "L_0x21"; @@ -791,9 +791,9 @@ private void InitializeComponent() this.L_0x21.TabIndex = 62; this.L_0x21.Text = "Flags 2:"; this.L_0x21.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // B_RandAll - // + // this.B_RandAll.Location = new System.Drawing.Point(333, 10); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(98, 23); @@ -801,9 +801,9 @@ private void InitializeComponent() this.B_RandAll.Text = "Randomize!"; this.B_RandAll.UseVisualStyleBackColor = true; this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click); - // + // // groupBox1 - // + // this.groupBox1.Controls.Add(this.CHK_Category); this.groupBox1.Controls.Add(this.CHK_Type); this.groupBox1.Location = new System.Drawing.Point(333, 60); @@ -812,9 +812,9 @@ private void InitializeComponent() this.groupBox1.TabIndex = 64; this.groupBox1.TabStop = false; this.groupBox1.Text = "Options"; - // + // // CHK_Category - // + // this.CHK_Category.AutoSize = true; this.CHK_Category.Location = new System.Drawing.Point(6, 34); this.CHK_Category.Name = "CHK_Category"; @@ -822,9 +822,9 @@ private void InitializeComponent() this.CHK_Category.TabIndex = 1; this.CHK_Category.Text = "Category"; this.CHK_Category.UseVisualStyleBackColor = true; - // + // // CHK_Type - // + // this.CHK_Type.AutoSize = true; this.CHK_Type.Location = new System.Drawing.Point(6, 19); this.CHK_Type.Name = "CHK_Type"; @@ -832,9 +832,9 @@ private void InitializeComponent() this.CHK_Type.TabIndex = 0; this.CHK_Type.Text = "Type"; this.CHK_Type.UseVisualStyleBackColor = true; - // + // // B_Metronome - // + // this.B_Metronome.Location = new System.Drawing.Point(333, 33); this.B_Metronome.Name = "B_Metronome"; this.B_Metronome.Size = new System.Drawing.Size(98, 23); @@ -842,9 +842,9 @@ private void InitializeComponent() this.B_Metronome.Text = "Metronome Mode"; this.B_Metronome.UseVisualStyleBackColor = true; this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); - // + // // B_Table - // + // this.B_Table.Location = new System.Drawing.Point(356, 117); this.B_Table.Name = "B_Table"; this.B_Table.Size = new System.Drawing.Size(75, 23); @@ -852,9 +852,9 @@ private void InitializeComponent() this.B_Table.Text = "Export Table"; this.B_Table.UseVisualStyleBackColor = true; this.B_Table.Click += new System.EventHandler(this.B_Table_Click); - // + // // MoveEditor7 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(439, 381); @@ -916,7 +916,7 @@ private void InitializeComponent() this.Name = "MoveEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Move Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CloseForm); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).EndInit(); diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index 829251ba20..bdd2b07fde 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -17,7 +17,8 @@ public MoveEditor7(byte[][] infiles) Setup(); RandSettings.GetFormSettings(this, groupBox1.Controls); } - private byte[][] files; + + private readonly byte[][] files; private readonly string[] types = Main.Config.getText(TextName.Types); private readonly string[] moveflavor = Main.Config.getText(TextName.MoveFlavor); private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); @@ -45,6 +46,7 @@ public MoveEditor7(byte[][] infiles) "No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat", "DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field", "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", }; + private void Setup() { foreach (string s in movelist) CB_Move.Items.Add(s); @@ -61,20 +63,22 @@ private void Setup() CB_Move.Items.RemoveAt(0); CB_Move.SelectedIndex = 0; } + private int entry = -1; - private void changeEntry(object sender, EventArgs e) + + private void ChangeEntry(object sender, EventArgs e) { setEntry(); entry = Array.IndexOf(movelist, CB_Move.Text); - getEntry(); + GetEntry(); } - private void getEntry() + + private void GetEntry() { if (entry < 1) return; byte[] data = files[entry]; { - string flavor = moveflavor[entry].Replace("\\n", Environment.NewLine); - RTB.Text = flavor; + RTB.Text = moveflavor[entry].Replace("\\n", Environment.NewLine); CB_Type.SelectedIndex = data[0x00]; CB_Quality.SelectedIndex = data[0x01]; @@ -119,6 +123,7 @@ private void getEntry() //NUD_0x23.Value = data[0x23]; // 0x23 } } + private void setEntry() { if (entry < 1) return; @@ -160,7 +165,8 @@ private void setEntry() } files[entry] = data; } - private void formClosing(object sender, FormClosingEventArgs e) + + private void CloseForm(object sender, FormClosingEventArgs e) { setEntry(); RandSettings.SetFormSettings(this, groupBox1.Controls); @@ -198,6 +204,7 @@ private void B_RandAll_Click(object sender, EventArgs e) } WinFormsUtil.Alert("All Moves have been randomized!"); } + private void B_Metronome_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will set the Base PP for every other Move to 0!") != DialogResult.Yes) return; diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.cs index 392e0e512b..821ae66364 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.cs @@ -140,6 +140,7 @@ private void CB_Species_SelectedIndexChanged(object sender, EventArgs e) entry = CB_Species.SelectedIndex; readEntry(); } + private void ByteLimiter(object sender, EventArgs e) { if (!(sender is MaskedTextBox mtb)) @@ -152,6 +153,7 @@ private void ByteLimiter(object sender, EventArgs e) } private PersonalInfo pkm; + private void readInfo() { pkm = Main.SpeciesStat[entry]; @@ -226,6 +228,7 @@ private void readInfo() CLB_BeachTutors.SetItemChecked(b, special[0][b]); } } + private void readEntry() { readInfo(); @@ -243,13 +246,14 @@ private void readEntry() { Color c = rawImg.GetPixel(x, y); bigImg.SetPixel(2 * x, 2 * y, c); - bigImg.SetPixel(2 * x + 1, 2 * y, c); - bigImg.SetPixel(2 * x, 2 * y + 1, c); - bigImg.SetPixel(2 * x + 1, 2 * y + 1, c); + bigImg.SetPixel((2 * x) + 1, 2 * y, c); + bigImg.SetPixel(2 * x, (2 * y) + 1, c); + bigImg.SetPixel((2 * x) + 1, (2 * y) + 1, c); } } PB_MonSprite.Image = bigImg; } + private void savePersonal() { pkm.HP = Convert.ToByte(TB_BaseHP.Text); @@ -312,6 +316,7 @@ private void savePersonal() pkm.SpecialTutors = special; } } + private void saveEntry() { savePersonal(); @@ -351,6 +356,7 @@ private void B_Randomize_Click(object sender, EventArgs e) readEntry(); WinFormsUtil.Alert("Randomized all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } + private void B_ModifyAll(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all? Cannot undo.", "Double check Modification settings in the Enhancements tab.") != DialogResult.Yes) return; @@ -387,7 +393,9 @@ private void B_ModifyAll(object sender, EventArgs e) CB_Species.SelectedIndex = 1; WinFormsUtil.Alert("Modified all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } + private bool dumping; + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Personal Entries to Text File?")) @@ -431,11 +439,13 @@ private void B_Dump_Click(object sender, EventArgs e) File.WriteAllLines(path, lines, Encoding.Unicode); dumping = false; } + private void CHK_Stats_CheckedChanged(object sender, EventArgs e) { L_StatDev.Enabled = NUD_StatDev.Enabled = CHK_Stats.Checked; CHK_rHP.Enabled = CHK_rATK.Enabled = CHK_rDEF.Enabled = CHK_rSPA.Enabled = CHK_rSPD.Enabled = CHK_rSPE.Enabled = CHK_Stats.Checked; } + private void CHK_Ability_CheckedChanged(object sender, EventArgs e) { CHK_WGuard.Enabled = CHK_Ability.Checked; diff --git a/pk3DS/Subforms/Gen7/PickupEditor7.cs b/pk3DS/Subforms/Gen7/PickupEditor7.cs index 700ee40fd1..0320de116d 100644 --- a/pk3DS/Subforms/Gen7/PickupEditor7.cs +++ b/pk3DS/Subforms/Gen7/PickupEditor7.cs @@ -25,6 +25,7 @@ public PickupEditor7(lzGARCFile pickup) private readonly string[] items; private const int Columns = 10; + private void setupFLP() { dgvCommon.Columns.Clear(); @@ -59,7 +60,7 @@ private void setupFLP() for (int i = 0; i < Columns; i++) { - string rate = $"{i*10 + 1}-{(i + 1)*10}"; + string rate = $"{(i * 10) + 1}-{(i + 1)*10}"; DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); { dgvIndex.HeaderText = rate; @@ -87,7 +88,7 @@ private void getList(byte[] data) dgvCommon.Rows.Add(rows); for (int i = 0; i < rows; i++) { - int offset = 4 + i * (Columns + 2); + int offset = 4 + (i * (Columns + 2)); int item = BitConverter.ToUInt16(data, offset); var r = dgvCommon.Rows[i]; @@ -99,6 +100,7 @@ private void getList(byte[] data) } } } + private byte[] setList() { int rows = dgvCommon.RowCount; @@ -161,10 +163,12 @@ private void B_Save_Click(object sender, EventArgs e) g_pickup.Save(); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); } + private void B_Randomize_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize pickup lists?")) diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index bd3c75b12c..f8227b4b32 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -82,6 +82,7 @@ private int GetSlot(object sender) var send = ((sender as ToolStripItem)?.Owner as ContextMenuStrip)?.SourceControl ?? sender as PictureBox; return Array.IndexOf(pba, send); } + private void ClickSlot(object sender, EventArgs e) { switch (ModifierKeys) @@ -91,6 +92,7 @@ private void ClickSlot(object sender, EventArgs e) case Keys.Alt: ClickDelete(sender, e); break; } } + private void ClickView(object sender, EventArgs e) { int slot = GetSlot(sender); @@ -109,6 +111,7 @@ private void ClickView(object sender, EventArgs e) else SystemSounds.Exclamation.Play(); } + private void ClickSet(object sender, EventArgs e) { int slot = GetSlot(sender); @@ -129,6 +132,7 @@ private void ClickSet(object sender, EventArgs e) GetQuickFiller(pba[slot], pk); GetSlotColor(slot, Properties.Resources.slotSet); } + private void ClickDelete(object sender, EventArgs e) { int slot = GetSlot(sender); @@ -158,6 +162,7 @@ private void GetSlotColor(int slot, Image color) pba[slot].BackgroundImage = color; } + private static void GetQuickFiller(PictureBox pb, trpoke7 pk) { Bitmap rawImg = WinFormsUtil.getSprite(pk.Species, pk.Form, pk.Gender, pk.Item, Main.Config, pk.Shiny); @@ -172,6 +177,7 @@ private void RefreshFormAbility(object sender, EventArgs e) pkm.Form = CB_Forme.SelectedIndex; RefreshPKMSlotAbility(); } + private void RefreshSpeciesAbility(object sender, EventArgs e) { if (index < 0) @@ -180,6 +186,7 @@ private void RefreshSpeciesAbility(object sender, EventArgs e) FormUtil.setForms(CB_Species.SelectedIndex, CB_Forme, AltForms); RefreshPKMSlotAbility(); } + private void RefreshPKMSlotAbility() { int previousAbility = CB_Ability.SelectedIndex; @@ -198,6 +205,7 @@ private void RefreshPKMSlotAbility() } private static string GetEntryTitle(string str, int i) => $"{str} - {i:000}"; + private void Setup() { AltForms = forms.Select(f => Enumerable.Range(0, 100).Select(i => i.ToString()).ToArray()).ToArray(); @@ -287,6 +295,7 @@ private void ChangeTrainerIndex(object sender, EventArgs e) if (TC_trdata.SelectedIndex == TC_trdata.TabCount - 1) // last TC_trdata.SelectedIndex = 0; } + private void SaveEntry() { if (index < 0) @@ -296,12 +305,14 @@ private void SaveEntry() SaveData(tr, index); TrainerNames[index] = TB_TrainerName.Text; } + private void SaveData(trdata7 tr, int i) { tr.Write(out byte[] trd, out byte[] trp); trdata[i] = trd; trpoke[i] = trp; } + private void LoadEntry() { index = CB_TrainerID.SelectedIndex; @@ -316,6 +327,7 @@ private void LoadEntry() private bool loading; private trpoke7 pkm; + private void PopulateFieldsTP7(trpoke7 pk) { pkm = pk.Clone(); @@ -354,6 +366,7 @@ private void PopulateFieldsTP7(trpoke7 pk) updatingStats = false; UpdateStats(null, null); } + private trpoke7 PrepareTP7() { var pk = pkm.Clone(); @@ -387,6 +400,7 @@ private trpoke7 PrepareTP7() return pk; } + private void PopulateFieldsTD7(trdata7 tr) { // Load Trainer Data @@ -401,6 +415,7 @@ private void PopulateFieldsTD7(trdata7 tr) CHK_Flag.Checked = tr.Flag; PopulateTeam(tr); } + private void PrepareTR7(trdata7 tr) { tr.TrainerClass = (byte)CB_Trainer_Class.SelectedIndex; @@ -418,7 +433,7 @@ protected override void OnFormClosing(FormClosingEventArgs e) { SaveEntry(); if (TrainerNames.Modified) - Main.Config.setText(TextName.TrainerNames, TrainerNames.Lines); + Main.Config.SetText(TextName.TrainerNames, TrainerNames.Lines); base.OnFormClosing(e); RandSettings.SetFormSettings(this, Tab_Rand.Controls); } @@ -437,6 +452,7 @@ private void DumpTxt(object sender, EventArgs e) File.WriteAllText(sfd.FileName, sb.ToString()); } } + private string GetTrainerString(trdata7 tr) { var sb = new StringBuilder(); @@ -470,6 +486,7 @@ private void UpdateNumPokemon(object sender, EventArgs e) return; Trainers[index].NumPokemon = (int) NUD_NumPoke.Value; } + private void UpdateTrainerName(object sender, EventArgs e) { if (loading) @@ -503,16 +520,16 @@ private void UpdateStats(object sender, EventArgs e) int Nature = CB_Nature.SelectedIndex; ushort[] Stats = new ushort[6]; - Stats[0] = (ushort)(p.HP == 1 ? 1 : (Util.ToInt32(TB_HPIV.Text) + 2 * p.HP + Util.ToInt32(TB_HPEV.Text) / 4 + 100) * level / 100 + 10); - Stats[1] = (ushort)((Util.ToInt32(TB_ATKIV.Text) + 2 * p.ATK + Util.ToInt32(TB_ATKEV.Text) / 4) * level / 100 + 5); - Stats[2] = (ushort)((Util.ToInt32(TB_DEFIV.Text) + 2 * p.DEF + Util.ToInt32(TB_DEFEV.Text) / 4) * level / 100 + 5); - Stats[4] = (ushort)((Util.ToInt32(TB_SPAIV.Text) + 2 * p.SPA + Util.ToInt32(TB_SPAEV.Text) / 4) * level / 100 + 5); - Stats[5] = (ushort)((Util.ToInt32(TB_SPDIV.Text) + 2 * p.SPD + Util.ToInt32(TB_SPDEV.Text) / 4) * level / 100 + 5); - Stats[3] = (ushort)((Util.ToInt32(TB_SPEIV.Text) + 2 * p.SPE + Util.ToInt32(TB_SPEEV.Text) / 4) * level / 100 + 5); + Stats[0] = (ushort)(p.HP == 1 ? 1 : ((Util.ToInt32(TB_HPIV.Text) + (2 * p.HP) + (Util.ToInt32(TB_HPEV.Text) / 4) + 100) * level / 100) + 10); + Stats[1] = (ushort)(((Util.ToInt32(TB_ATKIV.Text) + (2 * p.ATK) + (Util.ToInt32(TB_ATKEV.Text) / 4)) * level / 100) + 5); + Stats[2] = (ushort)(((Util.ToInt32(TB_DEFIV.Text) + (2 * p.DEF) + (Util.ToInt32(TB_DEFEV.Text) / 4)) * level / 100) + 5); + Stats[4] = (ushort)(((Util.ToInt32(TB_SPAIV.Text) + (2 * p.SPA) + (Util.ToInt32(TB_SPAEV.Text) / 4)) * level / 100) + 5); + Stats[5] = (ushort)(((Util.ToInt32(TB_SPDIV.Text) + (2 * p.SPD) + (Util.ToInt32(TB_SPDEV.Text) / 4)) * level / 100) + 5); + Stats[3] = (ushort)(((Util.ToInt32(TB_SPEIV.Text) + (2 * p.SPE) + (Util.ToInt32(TB_SPEEV.Text) / 4)) * level / 100) + 5); // Account for nature - int incr = Nature / 5 + 1; - int decr = Nature % 5 + 1; + int incr = (Nature / 5) + 1; + int decr = (Nature % 5) + 1; if (incr != decr) { Stats[incr] *= 11; @@ -549,7 +566,7 @@ private void UpdateStats(object sender, EventArgs e) } var ivs = tb_iv.Select(tb => WinFormsUtil.ToInt32(tb) & 1).ToArray(); updatingStats = true; - CB_HPType.SelectedIndex = 15 * (ivs[0] + 2 * ivs[1] + 4 * ivs[2] + 8 * ivs[3] + 16 * ivs[4] + 32 * ivs[5]) / 63; + CB_HPType.SelectedIndex = 15 * (ivs[0] + (2 * ivs[1]) + (4 * ivs[2]) + (8 * ivs[3]) + (16 * ivs[4]) + (32 * ivs[5])) / 63; updatingStats = false; } @@ -568,6 +585,7 @@ private void UpdateHPType(object sender, EventArgs e) TB_SPEIV.Text = newIVs[5].ToString(); updatingStats = false; } + public static int[] SetHPIVs(int type, int[] ivs) { for (int i = 0; i < 6; i++) @@ -781,6 +799,7 @@ private void B_Randomize_Click(object sender, EventArgs e) } WinFormsUtil.Alert("Randomized all Trainers according to specification!", "Press the Dump to .TXT button to view the new Trainer information!"); } + private void B_HighAttack_Click(object sender, EventArgs e) { pkm.Species = CB_Species.SelectedIndex; @@ -789,6 +808,7 @@ private void B_HighAttack_Click(object sender, EventArgs e) var moves = learn.GetHighPoweredMoves(pkm.Species, pkm.Form, 4); SetMoves(moves); } + private void B_CurrentAttack_Click(object sender, EventArgs e) { pkm.Species = CB_Species.SelectedIndex; @@ -797,6 +817,7 @@ private void B_CurrentAttack_Click(object sender, EventArgs e) var moves = learn.GetCurrentMoves(pkm.Species, pkm.Form, pkm.Level, 4); SetMoves(moves); } + private void B_Clear_Click(object sender, EventArgs e) => SetMoves(new int[4]); private void SetMoves(IList moves) @@ -816,14 +837,17 @@ private void CB_Moves_SelectedIndexChanged(object sender, EventArgs e) CHK_ForceHighPower.Enabled = CHK_ForceHighPower.Checked = NUD_ForceHighPower.Enabled = CHK_NoFixedDamage.Enabled = CHK_NoFixedDamage.Checked = (CB_Moves.SelectedIndex == 1 || CB_Moves.SelectedIndex == 2); } + private void CHK_Damage_CheckedChanged(object sender, EventArgs e) { NUD_Damage.Enabled = CHK_Damage.Checked; } + private void CHK_STAB_CheckedChanged(object sender, EventArgs e) { NUD_STAB.Enabled = CHK_STAB.Checked; } + private void CHK_RandomPKM_CheckedChanged(object sender, EventArgs e) { if (!CHK_RandomPKM.Checked) @@ -839,20 +863,24 @@ private void CHK_RandomPKM_CheckedChanged(object sender, EventArgs e) c.Checked = true; } } + private void CHK_RandomClass_CheckedChanged(object sender, EventArgs e) { CHK_IgnoreSpecialClass.Enabled = CHK_RandomClass.Checked; if (!CHK_RandomClass.Checked) CHK_IgnoreSpecialClass.Checked = false; } + private void CHK_RandomShiny_CheckedChanged(object sender, EventArgs e) { NUD_Shiny.Enabled = CHK_RandomShiny.Checked; } + private void CHK_Level_CheckedChanged(object sender, EventArgs e) { NUD_LevelBoost.Enabled = CHK_Level.Checked; } + private int[] GetRandomMega(out int species) { int rnd = Util.rand.Next(0, MegaDictionary.Count - 1); diff --git a/pk3DS/Subforms/Gen7/SMWE.cs b/pk3DS/Subforms/Gen7/SMWE.cs index 22aec586f9..95dd67d46d 100644 --- a/pk3DS/Subforms/Gen7/SMWE.cs +++ b/pk3DS/Subforms/Gen7/SMWE.cs @@ -51,7 +51,6 @@ public SMWE(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd) // ExportEncounters("um", "uu"); } - private NumericUpDown[] LoadRateNUD() { var list = new[] {NUP_Rate1, NUP_Rate2, NUP_Rate3, NUP_Rate4, NUP_Rate5, NUP_Rate6, NUP_Rate7, NUP_Rate8, NUP_Rate9, NUP_Rate10}; @@ -59,6 +58,7 @@ private NumericUpDown[] LoadRateNUD() nup.ValueChanged += UpdateEncounterRate; return list; } + private ComboBox[][] LoadSpeciesComboBoxes() { var list = new[] { @@ -73,14 +73,18 @@ private ComboBox[][] LoadSpeciesComboBoxes() new[] {CB_WeatherEnc1, CB_WeatherEnc2, CB_WeatherEnc3, CB_WeatherEnc4, CB_WeatherEnc5, CB_WeatherEnc6} }; foreach (var cb_l in list) - foreach (var cb in cb_l) { - cb.Items.AddRange(speciesList); - cb.SelectedIndex = 0; - cb.SelectedIndexChanged += UpdateSpeciesForm; + foreach (var cb in cb_l) + { + cb.Items.AddRange(speciesList); + cb.SelectedIndex = 0; + cb.SelectedIndexChanged += UpdateSpeciesForm; + } } + return list; } + private NumericUpDown[][] LoadFormeNUD() { var list = new[] { @@ -96,8 +100,10 @@ private NumericUpDown[][] LoadFormeNUD() }; foreach (var nup_l in list) - foreach (var nup in nup_l) - nup.ValueChanged += UpdateSpeciesForm; + { + foreach (var nup in nup_l) + nup.ValueChanged += UpdateSpeciesForm; + } return list; } @@ -136,16 +142,20 @@ private void ChangeMap(object sender, EventArgs e) { for (int i = 0; i < Areas[CB_LocationID.SelectedIndex].Tables.Count; i += 2) { - CB_TableID.Items.Add($"{i / 2 + 1} (Day)"); - CB_TableID.Items.Add($"{i / 2 + 1} (Night)"); + CB_TableID.Items.Add($"{(i / 2) + 1} (Day)"); + CB_TableID.Items.Add($"{(i / 2) + 1} (Night)"); } } else + { CB_TableID.Items.Add("(None)"); + } + CB_TableID.SelectedIndex = 0; loadingdata = false; UpdatePanel(sender, e); } + private void UpdatePanel(object sender, EventArgs e) { if (loadingdata) @@ -180,14 +190,16 @@ private void LoadTable(EncounterTable table) NUP_Max.Minimum = table.MinLevel; NUP_Max.Value = table.MaxLevel; for (int slot = 0; slot < table.Encounter7s.Length; slot++) - for (int i = 0; i < table.Encounter7s[slot].Length; i++) { - var sl = table.Encounter7s[slot]; - if (slot == 8) - sl = table.AdditionalSOS; - rate_spec[i].Value = table.Rates[i]; - cb_spec[slot][i].SelectedIndex = (int)sl[i].Species; - nup_spec[slot][i].Value = (int)sl[i].Forme; + for (int i = 0; i < table.Encounter7s[slot].Length; i++) + { + var sl = table.Encounter7s[slot]; + if (slot == 8) + sl = table.AdditionalSOS; + rate_spec[i].Value = table.Rates[i]; + cb_spec[slot][i].SelectedIndex = (int)sl[i].Species; + nup_spec[slot][i].Value = (int)sl[i].Forme; + } } } @@ -208,6 +220,7 @@ private void UpdateMinMax(object sender, EventArgs e) CurrentTable.MaxLevel = max; loadingdata = false; } + private void UpdateSpeciesForm(object sender, EventArgs e) { if (loadingdata) @@ -238,7 +251,7 @@ private void UpdateSpeciesForm(object sender, EventArgs e) int y = 30*(table + 1); if (table == 8) { - x = 40*slot + 60; + x = (40 * slot) + 60; y = 270; } var pnt = new Point(x, y); @@ -251,6 +264,7 @@ private void UpdateSpeciesForm(object sender, EventArgs e) cur_pb.Image = cur_img; } + private void UpdateEncounterRate(object sender, EventArgs e) { if (loadingdata) @@ -265,7 +279,7 @@ private void UpdateEncounterRate(object sender, EventArgs e) using (var g = Graphics.FromImage(cur_img)) { - var pnt = new PointF(40 * slot + 10, 10); + var pnt = new PointF((40 * slot) + 10, 10); g.SetClip(new Rectangle((int) pnt.X, (int) pnt.Y, 40, 14), CombineMode.Replace); g.Clear(Color.Transparent); g.DrawString($"{rate}%", font, Brushes.Black, pnt); @@ -279,6 +293,7 @@ private void UpdateEncounterRate(object sender, EventArgs e) private byte[] CopyTable; private int CopyCount; + private void B_Copy_Click(object sender, EventArgs e) { var Map = Areas[CB_LocationID.SelectedIndex]; @@ -293,6 +308,7 @@ private void B_Copy_Click(object sender, EventArgs e) B_Paste.Enabled = B_PasteAll.Enabled = true; WinFormsUtil.Alert("Copied table data."); } + private void B_Paste_Click(object sender, EventArgs e) { var Map = Areas[CB_LocationID.SelectedIndex]; @@ -310,6 +326,7 @@ private void B_Paste_Click(object sender, EventArgs e) RefreshTableImages(Map); System.Media.SystemSounds.Asterisk.Play(); } + private void B_PasteAll_Click(object sender, EventArgs e) { var Map = Areas[CB_LocationID.SelectedIndex]; @@ -322,6 +339,7 @@ private void B_PasteAll_Click(object sender, EventArgs e) foreach (var t in Map.Tables.Where(t => CopyCount == t.Encounter7s[0].Count(z => z.Species != 0))) t.Reset(CopyTable); } + private void B_Save_Click(object sender, EventArgs e) { var sum = TotalEncounterRate; @@ -338,6 +356,7 @@ private void B_Save_Click(object sender, EventArgs e) // Set data back to GARC encdata[area.FileNumber] = Area7.GetDayNightTableBinary(area.Tables); } + private void B_Export_Click(object sender, EventArgs e) { B_Save_Click(sender, e); @@ -350,6 +369,7 @@ private void B_Export_Click(object sender, EventArgs e) } WinFormsUtil.Alert("Exported all tables!"); } + private void DumpTables(object sender, EventArgs e) { using (var sfd = new SaveFileDialog()) @@ -367,8 +387,7 @@ private void DumpTables(object sender, EventArgs e) // Randomization & Bulk Modification private void B_Randomize_Click(object sender, EventArgs e) { - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "Randomize all? Cannot undo.", "Double check Randomization settings at the bottom left.")) + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings at the bottom left.")) return; Enabled = false; @@ -378,6 +397,7 @@ private void B_Randomize_Click(object sender, EventArgs e) WinFormsUtil.Alert("Randomized all Wild Encounters according to specification!", "Press the Dump Tables button to view the new Wild Encounter information!"); } + private void ExecuteRandomization() { var rnd = new SpeciesRandomizer(Main.Config) @@ -410,6 +430,7 @@ private void ExecuteRandomization() }; wild7.Execute(Areas, encdata); } + private void CopySOS_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Copy initial species to SOS slots?", "Cannot undo.") != DialogResult.Yes) @@ -426,10 +447,10 @@ private void CopySOS_Click(object sender, EventArgs e) } WinFormsUtil.Alert("All initial species copied to SOS slots!"); } + private void ModifyAllLevelRanges(object sender, EventArgs e) { - if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, - "Modify all current Level ranges?", "Cannot undo.")) + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Level ranges?", "Cannot undo.")) return; // Disable Interface while modifying @@ -472,13 +493,14 @@ public static string[] GetGoodLocationList(string[] list) private void ExportEncounters(string gameID, string ident) { - var reg = dumpreg(); - var sos = dumpsos(); + var reg = DumpRegular(); + var sos = DumpSOS(); File.WriteAllBytes($"encounter_{gameID}.pkl", Mini.PackMini(reg, ident)); File.WriteAllBytes($"encounter_{gameID}_sos.pkl", Mini.PackMini(sos, ident)); } - private byte[][] dumpreg() + + private byte[][] DumpRegular() { var dict = new Dictionary>(); foreach (var area in Areas) @@ -499,7 +521,8 @@ from e in s return GetLocationDump(dict).ToArray(); } - private byte[][] dumpsos() + + private byte[][] DumpSOS() { var dict = new Dictionary>(); foreach (var area in Areas) @@ -524,7 +547,7 @@ from e in t.AdditionalSOS return GetLocationDump(dict).ToArray(); } - private IEnumerable GetLocationDump(Dictionary> dict) + private static IEnumerable GetLocationDump(Dictionary> dict) { foreach (var z in dict.OrderBy(z => z.Key)) { @@ -554,22 +577,25 @@ public static Bitmap GetTableImg(this EncounterTable table, Font font) { g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; for (int i = 0; i < table.Rates.Length; i++) - g.DrawString($"{table.Rates[i]}%", font, Brushes.Black, new PointF(40 * i + 10, 10)); + g.DrawString($"{table.Rates[i]}%", font, Brushes.Black, new PointF((40 * i) + 10, 10)); g.DrawString("Weather: ", font, Brushes.Black, new PointF(10, 280)); // Draw Sprites for (int i = 0; i < table.Encounter7s.Length - 1; i++) - for (int j = 0; j < table.Encounter7s[i].Length; j++) { - var slot = table.Encounter7s[i][j]; - var sprite = GetSprite((int)slot.Species, (int)slot.Forme); - g.DrawImage(sprite, new Point(40 * j, 30 * (i + 1))); + for (int j = 0; j < table.Encounter7s[i].Length; j++) + { + var slot = table.Encounter7s[i][j]; + var sprite = GetSprite((int)slot.Species, (int)slot.Forme); + g.DrawImage(sprite, new Point(40 * j, 30 * (i + 1))); + } } + for (int i = 0; i < table.AdditionalSOS.Length; i++) { var slot = table.AdditionalSOS[i]; var sprite = GetSprite((int)slot.Species, (int)slot.Forme); - g.DrawImage(sprite, new Point(40 * i + 60, 270)); + g.DrawImage(sprite, new Point((40 * i) + 60, 270)); } } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index f496330f98..1f72319ea3 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -360,7 +360,7 @@ private void InitializeComponent() this.CB_GSpecies.Name = "CB_GSpecies"; this.CB_GSpecies.Size = new System.Drawing.Size(136, 21); this.CB_GSpecies.TabIndex = 6; - this.CB_GSpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_GSpecies.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // L_GForm // @@ -1060,7 +1060,7 @@ private void InitializeComponent() this.CB_ESpecies.Name = "CB_ESpecies"; this.CB_ESpecies.Size = new System.Drawing.Size(136, 21); this.CB_ESpecies.TabIndex = 14; - this.CB_ESpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_ESpecies.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // L_EForm // @@ -1488,7 +1488,7 @@ private void InitializeComponent() 0, 0, 0}); - this.NUD_TID.ValueChanged += new System.EventHandler(this.changeTID); + this.NUD_TID.ValueChanged += new System.EventHandler(this.ChangeTID); // // CB_THeldItem // @@ -1514,7 +1514,7 @@ private void InitializeComponent() this.CB_TSpecies.Name = "CB_TSpecies"; this.CB_TSpecies.Size = new System.Drawing.Size(136, 21); this.CB_TSpecies.TabIndex = 22; - this.CB_TSpecies.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_TSpecies.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // L_TForm // diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 0535b4f7b9..e487e59017 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -30,6 +30,7 @@ public partial class StaticEncounterEditor7 : Form "♂ / Male", "♀ / Female", }; + private readonly string[] ability = { "Any (1 or 2)", @@ -37,6 +38,7 @@ public partial class StaticEncounterEditor7 : Form "Ability 2", "Hidden Ability", }; + private readonly string[] aura = { "(None)", @@ -60,8 +62,8 @@ public partial class StaticEncounterEditor7 : Form "All Stats (+3)", }; - private static int[] Totem = { 020, 105, 735, 738, 743, 746, 752, 754, 758, 777, 778, 784 }; // Totem battles - private static int[] UnevolvedLegend = { 772, 789, 803 }; // Type: Null, Cosmog, Poipole gifts + private static readonly int[] Totem = { 020, 105, 735, 738, 743, 746, 752, 754, 758, 777, 778, 784 }; // Totem battles + private static readonly int[] UnevolvedLegend = { 772, 789, 803 }; // Type: Null, Cosmog, Poipole gifts public StaticEncounterEditor7(byte[][] infiles) { @@ -148,7 +150,7 @@ public StaticEncounterEditor7(byte[][] infiles) NUD_Ally1.Maximum = NUD_Ally2.Maximum = Main.Config.USUM ? 251 : 136; - getListBoxEntries(); + GetListBoxEntries(); LB_Gift.SelectedIndex = 0; LB_Encounter.SelectedIndex = 0; LB_Trade.SelectedIndex = 0; @@ -162,7 +164,8 @@ public StaticEncounterEditor7(byte[][] infiles) RandSettings.GetFormSettings(this, Tab_Randomizer.Controls); // ExportEncounters(); } - private void getListBoxEntries() + + private void GetListBoxEntries() { loading = true; LB_Gift.Items.Clear(); @@ -170,11 +173,11 @@ private void getListBoxEntries() LB_Trade.Items.Clear(); for (int i = 0; i < Gifts.Length; i++) - LB_Gift.Items.Add(getEntryText(Gifts[i], i)); + LB_Gift.Items.Add(GetEntryText(Gifts[i], i)); for (int i = 0; i < Encounters.Length; i++) - LB_Encounter.Items.Add(getEntryText(Encounters[i], i)); + LB_Encounter.Items.Add(GetEntryText(Encounters[i], i)); for (int i = 0; i < Trades.Length; i++) - LB_Trade.Items.Add(getEntryText(Trades[i], i)); + LB_Trade.Items.Add(GetEntryText(Trades[i], i)); loading = false; } @@ -184,19 +187,20 @@ private void getListBoxEntries() private void B_Save_Click(object sender, EventArgs e) { - setGift(); - setEncounter(); - setTrade(); - saveData(); + SetGift(); + SetEncounter(); + SetTrade(); + SaveData(); RandSettings.SetFormSettings(this, Tab_Randomizer.Controls); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); } - private void saveData() + private void SaveData() { files[0] = Gifts.SelectMany(file => file.Data).ToArray(); files[1] = Encounters.SelectMany(file => file.Data).ToArray(); @@ -207,39 +211,43 @@ private void saveData() var dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Starters have been changed. Update text references?", "Note that this only updates text references for the current language set in pk3DS.", "This can be changed from Options -> Language on the main window."); if (dr == DialogResult.Yes) - updateStarterText(); + UpdateStarterText(); } - private string getEntryText(int species, int entry) + private string GetEntryText(int species, int entry) { return $"{entry:00} - {specieslist[species]}"; } - private string getEntryText(EncounterStatic enc, int entry) + + private string GetEntryText(EncounterStatic enc, int entry) { - return getEntryText(enc.Species, entry); + return GetEntryText(enc.Species, entry); } private void LB_Gift_SelectedIndexChanged(object sender, EventArgs e) { - setGift(); + SetGift(); gEntry = LB_Gift.SelectedIndex; - getGift(); + GetGift(); } + private void LB_Encounter_SelectedIndexChanged(object sender, EventArgs e) { - setEncounter(); + SetEncounter(); eEntry = LB_Encounter.SelectedIndex; - getEncounter(); + GetEncounter(); } + private void LB_Trade_SelectedIndexChanged(object sender, EventArgs e) { - setTrade(); + SetTrade(); tEntry = LB_Trade.SelectedIndex; - getTrade(); + GetTrade(); } private bool loading; - private void getGift() + + private void GetGift() { if (gEntry < 0) return; @@ -259,7 +267,8 @@ private void getGift() loading = false; } - private void setGift() + + private void SetGift() { if (gEntry < 0) return; @@ -275,7 +284,8 @@ private void setGift() entry.ShinyLock = CHK_G_Lock.Checked; entry.IsEgg = CHK_IsEgg.Checked; } - private void getEncounter() + + private void GetEncounter() { if (eEntry < 0) return; @@ -320,7 +330,8 @@ private void getEncounter() loading = false; } - private void setEncounter() + + private void SetEncounter() { if (eEntry < 0) return; @@ -364,7 +375,8 @@ private void setEncounter() entry.Ally1 = (int)NUD_Ally1.Value + 1; entry.Ally2 = (int)NUD_Ally2.Value + 1; } - private void getTrade() + + private void GetTrade() { if (tEntry < 0) return; @@ -392,7 +404,8 @@ private void getTrade() loading = false; } - private void setTrade() + + private void SetTrade() { if (tEntry < 0) return; @@ -418,41 +431,41 @@ private void setTrade() iv[5] = (int)NUD_TIV5.Value; entry.IVs = iv; } - - private void changeSpecies(object sender, EventArgs e) + + private void ChangeSpecies(object sender, EventArgs e) { if (loading) return; - var cb = sender as ComboBox; - if (cb == null) + if (!(sender is ComboBox cb)) return; if (sender == CB_GSpecies) { var entry = Gifts[gEntry]; entry.Species = cb.SelectedIndex; - LB_Gift.Items[gEntry] = getEntryText(entry, gEntry); + LB_Gift.Items[gEntry] = GetEntryText(entry, gEntry); } else if (sender == CB_ESpecies) { var entry = Encounters[eEntry]; entry.Species = cb.SelectedIndex; - LB_Encounter.Items[eEntry] = getEntryText(entry, eEntry); + LB_Encounter.Items[eEntry] = GetEntryText(entry, eEntry); } else if (sender == CB_TSpecies) { var entry = Trades[tEntry]; entry.Species = cb.SelectedIndex; - LB_Trade.Items[tEntry] = getEntryText(entry, tEntry); + LB_Trade.Items[tEntry] = GetEntryText(entry, tEntry); } } - private void changeTID(object sender, EventArgs e) + + private void ChangeTID(object sender, EventArgs e) { L_TTID.Text = $"Gen 7 ID: {NUD_TID.Value % 100000:000000}"; } // Randomization - private SpeciesRandomizer getRandomizer() + private SpeciesRandomizer GetRandomizer() { var specrand = new SpeciesRandomizer(Main.Config) { @@ -472,14 +485,15 @@ private SpeciesRandomizer getRandomizer() specrand.Initialize(); return specrand; } + private void B_Starters_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Starters? Cannot undo.", "Double check Randomization settings before continuing.") != DialogResult.Yes) return; - setGift(); + SetGift(); - var specrand = getRandomizer(); + var specrand = GetRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var items = Randomizer.getRandomItemList(); int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 464, 621 }).ToArray(); @@ -495,9 +509,10 @@ private void B_Starters_Click(object sender, EventArgs e) int basic() => (int)(Util.rnd32() % BasicStarter.Length); t.Species = BasicStarter[basic()]; } - else + { t.Species = specrand.GetRandomSpecies(oldStarters[i]); + } if (CHK_AllowMega.Checked) formrand.AllowMega = true; @@ -526,21 +541,22 @@ private void B_Starters_Click(object sender, EventArgs e) t.Nature = -1; // random } - getListBoxEntries(); - getGift(); + GetListBoxEntries(); + GetGift(); WinFormsUtil.Alert("Randomized Starters according to specification!"); } + private void B_RandAll_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Static Encounters? Cannot undo.", "Double check Randomization Settings before continuing.") != DialogResult.Yes) return; - - setGift(); - setEncounter(); - setTrade(); - var specrand = getRandomizer(); + SetGift(); + SetEncounter(); + SetTrade(); + + var specrand = GetRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); @@ -553,7 +569,7 @@ private void B_RandAll_Click(object sender, EventArgs e) var t = Gifts[i]; // Legendary-for-Legendary - if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species) || UnevolvedLegend.Contains(t.Species)) + if ((CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species)) || UnevolvedLegend.Contains(t.Species)) t.Species = ReplaceLegend[randLegend()]; // every other entry @@ -575,7 +591,9 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_SpecialMove.Checked) { if (CHK_Metronome.Checked) + { t.SpecialMove = 0; // remove Surf Pikachu's special move + } else { int rv; @@ -587,7 +605,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H - + if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) t.Species = FinalEvo[randFinalEvo()]; @@ -625,7 +643,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2, or H - + if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) t.Species = FinalEvo[randFinalEvo()]; @@ -654,7 +672,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_RandomAbility.Checked) t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H - + if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) t.Species = FinalEvo[randFinalEvo()]; // only do offered species to be fair @@ -662,16 +680,16 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Nature = (int)(Util.rnd32() % CB_TNature.Items.Count); // randomly selected } - getListBoxEntries(); - getGift(); - getEncounter(); - getTrade(); + GetListBoxEntries(); + GetGift(); + GetEncounter(); + GetTrade(); WinFormsUtil.Alert("Randomized Static Encounters according to specification!"); } // Mirror Changes - private void updateStarterText() + private void UpdateStarterText() { var gr = Main.Config.getGARCReference("storytext"); int file = Main.Config.USUM ? 39 : 41; @@ -679,7 +697,7 @@ private void updateStarterText() { // get Story Text var sr = gr.getRelativeGARC(i, gr.Name); - var s = Main.Config.getGARCByReference(sr); + var s = Main.Config.GetGARCByReference(sr); byte[][] storytextdata = s.Files; string[] storyText = TextFile.getStrings(Main.Config, storytextdata[file]); @@ -726,7 +744,7 @@ private void ExportEncounters() private void ModifyLevels(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Levels?", "Cannot undo.") != DialogResult.Yes) return; - + for (int i = 0; i < LB_Encounter.Items.Count; i++) { LB_Encounter.SelectedIndex = i; diff --git a/pk3DS/Subforms/Gen7/TMEditor7.cs b/pk3DS/Subforms/Gen7/TMEditor7.cs index d806bcdb4a..2b9f02d5cd 100644 --- a/pk3DS/Subforms/Gen7/TMEditor7.cs +++ b/pk3DS/Subforms/Gen7/TMEditor7.cs @@ -32,10 +32,12 @@ public TMEditor7() private readonly int offset = 0x0059795A; // Default private readonly byte[] data; private int dataoffset; + private void getDataOffset() { dataoffset = offset; // reset } + private void setupDGV() { dgvTM.Columns.Clear(); @@ -72,12 +74,13 @@ private void getList() getDataOffset(); for (int i = 0; i < 100; i++) // TMs stored sequentially - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); ushort[] tmlist = tms.ToArray(); for (int i = 0; i < tmlist.Length; i++) { dgvTM.Rows.Add(); dgvTM.Rows[i].Cells[0].Value = (i + 1).ToString(); dgvTM.Rows[i].Cells[1].Value = movelist[tmlist[i]]; } } + private void setList() { // Gather TM/HM list. @@ -89,7 +92,7 @@ private void setList() // Set TM/HM list in for (int i = 0; i < 100; i++) - Array.Copy(BitConverter.GetBytes(tmlist[i]), 0, data, offset + 2 * i, 2); + Array.Copy(BitConverter.GetBytes(tmlist[i]), 0, data, offset + (2 * i), 2); // Set Move Text Descriptions back into Item Text File string[] itemDescriptions = Main.Config.getText(TextName.ItemFlavor); @@ -100,7 +103,7 @@ private void setList() itemDescriptions[618 + i - 92] = moveDescriptions[tmlist[i]]; for (int i = 96 - 1; i <= 100 - 1; i++) // TM96 - TM100 itemDescriptions[690 + i - 95] = moveDescriptions[tmlist[i]]; - Main.Config.setText(TextName.ItemFlavor, itemDescriptions); + Main.Config.SetText(TextName.ItemFlavor, itemDescriptions); } private void formClosing(object sender, FormClosingEventArgs e) @@ -144,7 +147,7 @@ internal static void getTMHMList(ref ushort[] TMs) List tms = new List(); for (int i = 0; i < 100; i++) // TMs stored sequentially - tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i)); + tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); TMs = tms.ToArray(); } } diff --git a/pk3DS/Subforms/Gen7/TypeChart7.cs b/pk3DS/Subforms/Gen7/TypeChart7.cs index 499fab27fe..cd6b00ad6f 100644 --- a/pk3DS/Subforms/Gen7/TypeChart7.cs +++ b/pk3DS/Subforms/Gen7/TypeChart7.cs @@ -35,6 +35,7 @@ public TypeChart7() Array.Copy(exefs, offset, chart, 0, chart.Length); populateChart(); } + private readonly byte[] Signature = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, @@ -47,12 +48,14 @@ private void populateChart() { PB_Chart.Image = TypeChart.getGrid(TypeWidth, TypeCount, chart); } + private void B_Save_Click(object sender, EventArgs e) { chart.CopyTo(exefs, offset); File.WriteAllBytes(codebin, exefs); Close(); } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); @@ -61,15 +64,16 @@ private void B_Cancel_Click(object sender, EventArgs e) private void moveMouse(object sender, MouseEventArgs e) { TypeChart6.GetCoordinate((PictureBox)sender, e, out int X, out int Y); - int index = Y*TypeCount + X; + int index = (Y * TypeCount) + X; if (index >= chart.Length) return; updateLabel(X, Y, chart[index]); } + private void clickMouse(object sender, MouseEventArgs e) { TypeChart6.GetCoordinate((PictureBox)sender, e, out int X, out int Y); - int index = Y * TypeCount + X; + int index = (Y * TypeCount) + X; if (index >= chart.Length) return; @@ -78,12 +82,14 @@ private void clickMouse(object sender, MouseEventArgs e) updateLabel(X, Y, chart[index]); populateChart(); } + private void updateLabel(int X, int Y, int value) { if (value >= effects.Length || X >= types.Length || Y >= types.Length) return; // clicking and moving outside the box has invalid values L_Hover.Text = $"[{X:00}x{Y:00}: {value:00}] {types[Y]} attacking {types[X]} {effects[value]}"; } + private readonly string[] effects = { "has no effect!", diff --git a/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs b/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs index a104b51f95..350bfdb12a 100644 --- a/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs +++ b/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs @@ -36,13 +36,13 @@ public void Reset() for (int i = 0; i < Encounter7s.Length - 1; i++) { Encounter7s[i] = new Encounter7[10]; - var ofs = 0xC + i * 4 * Encounter7s[i].Length; + var ofs = 0xC + (i * 4 * Encounter7s[i].Length); for (int j = 0; j < Encounter7s[i].Length; j++) - Encounter7s[i][j] = new Encounter7(BitConverter.ToUInt32(t, ofs + 4 * j)); + Encounter7s[i][j] = new Encounter7(BitConverter.ToUInt32(t, ofs + (4 * j))); } for (var i = 0; i < AdditionalSOS.Length; i++) - AdditionalSOS[i] = new Encounter7(BitConverter.ToUInt32(t, 0x14C + 4 * i)); + AdditionalSOS[i] = new Encounter7(BitConverter.ToUInt32(t, 0x14C + (4 * i))); Encounter7s[8] = AdditionalSOS; } @@ -78,13 +78,13 @@ public void Write() for (int i = 0; i < Encounter7s.Length - 1; i++) { - var ofs = 0xC + i * 4 * Encounter7s[i].Length; + var ofs = 0xC + (i * 4 * Encounter7s[i].Length); for (int j = 0; j < Encounter7s[i].Length; j++) - BitConverter.GetBytes(Encounter7s[i][j].RawValue).CopyTo(Data, ofs + 4 * j); + BitConverter.GetBytes(Encounter7s[i][j].RawValue).CopyTo(Data, ofs + (4 * j)); } for (int i = 0; i < AdditionalSOS.Length; i++) - BitConverter.GetBytes(AdditionalSOS[i].RawValue).CopyTo(Data, 0x14C + 4 * i); + BitConverter.GetBytes(AdditionalSOS[i].RawValue).CopyTo(Data, 0x14C + (4 * i)); } public string GetSummary(string[] speciesList) diff --git a/pk3DS/Subforms/ShinyRate.cs b/pk3DS/Subforms/ShinyRate.cs index 705ba8cb7d..bcfd24fe9e 100644 --- a/pk3DS/Subforms/ShinyRate.cs +++ b/pk3DS/Subforms/ShinyRate.cs @@ -74,6 +74,7 @@ public Instruction(int val, byte[] arg) Argument = arg; ArgVal = BitConverter.ToUInt16(Argument, 0); } + public byte[] Bytes { get @@ -86,6 +87,7 @@ public byte[] Bytes } private int alwaysIndex; + private void CheckAlwaysShiny() { byte[] pattern = {0x00, 0x20, 0x22, 0xE0, 0x02, 0x30, 0x21, 0xE2, 0x03, 0x20, 0x92, 0xE1, 0x1C, 0x00, 0x00}; @@ -110,6 +112,7 @@ private void CheckAlwaysShiny() } private void B_Cancel_Click(object sender, EventArgs e) => Close(); + private void B_Save_Click(object sender, EventArgs e) { writeCodePatch(); @@ -118,6 +121,7 @@ private void B_Save_Click(object sender, EventArgs e) File.WriteAllBytes(codebin, exefsData); Close(); } + private void changeRerolls(object sender, EventArgs e) { int count = (int)NUD_Rerolls.Value; @@ -125,6 +129,7 @@ private void changeRerolls(object sender, EventArgs e) var pct = 1 - Math.Pow((float)(bc - 1)/bc, count); L_Overall.Text = $"~{pct:P}"; } + private void writeCodePatch() { // Overwrite the "load input argument value for reroll count" so that it loads a constant value. @@ -153,12 +158,13 @@ private void B_RestoreOriginal_Click(object sender, EventArgs e) } Close(); } + private void changePercent(object sender, EventArgs e) { var pct = NUD_Rate.Value; const int bc = 4096; - var inv = (int)Math.Log(1 - (float)pct/100, (float) (bc - 1)/bc); + var inv = (int)Math.Log(1 - ((float)pct/100), (float) (bc - 1)/bc); if (pct == 0) pct = 0.00001m; // arbitrary nonzero L_RerollCount.Text = $"Count: {inv:0} = 1:{(int)(1/(pct/100))}"; diff --git a/pk3DS/Subforms/TextEditor.cs b/pk3DS/Subforms/TextEditor.cs index 41f16115b9..5951691d92 100644 --- a/pk3DS/Subforms/TextEditor.cs +++ b/pk3DS/Subforms/TextEditor.cs @@ -20,6 +20,7 @@ public TextEditor(string[][] infiles, string mode) CB_Entry.SelectedIndex = 0; dgv.EditMode = DataGridViewEditMode.EditOnEnter; } + private readonly string[][] files; private readonly string Mode; private int entry = -1; @@ -35,6 +36,7 @@ private void B_Export_Click(object sender, EventArgs e) string path = Dump.FileName; exportTextFile(path, newline, files); } + private void B_Import_Click(object sender, EventArgs e) { if (files.Length <= 0) return; @@ -49,6 +51,7 @@ private void B_Import_Click(object sender, EventArgs e) changeEntry(null, null); WinFormsUtil.Alert("Imported Text from Input Path:", path); } + public static void exportTextFile(string fileName, bool newline, string[][] fileData) { using (MemoryStream ms = new MemoryStream()) @@ -82,6 +85,7 @@ public static void exportTextFile(string fileName, bool newline, string[][] file File.WriteAllBytes(fileName, ms.ToArray()); } } + private bool importTextFile(string fileName) { string[] fileText = File.ReadAllLines(fileName, Encoding.Unicode); @@ -128,6 +132,7 @@ private bool importTextFile(string fileName) catch (Exception e) { WinFormsUtil.Error($"The input Text File (# {i}) failed to convert:", e.ToString()); return false; } return true; } + private void changeEntry(object sender, EventArgs e) { // Save All the old text @@ -216,6 +221,7 @@ private void B_AddLine_Click(object sender, EventArgs e) for (int i = 0; i < dgv.Rows.Count; i++) dgv.Rows[i].Cells[0].Value = i.ToString(); } + private void B_RemoveLine_Click(object sender, EventArgs e) { int currentRow = dgv.CurrentRow.Index; @@ -231,6 +237,7 @@ private void B_RemoveLine_Click(object sender, EventArgs e) for (int i = 0; i < dgv.Rows.Count; i++) dgv.Rows[i].Cells[0].Value = i.ToString(); } + private void TextEditor_FormClosing(object sender, FormClosingEventArgs e) { // Save any pending edits diff --git a/pk3DS/Tools/Icon.cs b/pk3DS/Tools/Icon.cs index 5006076e1e..edd9de2514 100644 --- a/pk3DS/Tools/Icon.cs +++ b/pk3DS/Tools/Icon.cs @@ -10,6 +10,7 @@ namespace pk3DS public sealed partial class Icon : Form { private SMDH SMDH; + public Icon() { InitializeComponent(); @@ -30,10 +31,12 @@ public Icon() DragEnter += tabMain_DragEnter; DragDrop += tabMain_DragDrop; } + private void tabMain_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } + private void tabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); @@ -41,6 +44,7 @@ private void tabMain_DragDrop(object sender, DragEventArgs e) openFile(path, true); } + private void LoadSMDH() { PB_Large.Image = SMDH.LargeIcon.Icon; @@ -48,6 +52,7 @@ private void LoadSMDH() CB_AppInfo.SelectedIndex = 0; CB_AppInfo_SelectedIndexChanged(null, null); } + private void SaveSMDH() { Main.SMDH = SMDH; @@ -65,6 +70,7 @@ private void openFile(string path, bool drop = false) importSMDH(data, true); else importIcon(data, drop); } + private void B_Save_Click(object sender, EventArgs e) { CB_AppInfo_SelectedIndexChanged(null, null); // Force re-save @@ -74,6 +80,7 @@ private void B_Save_Click(object sender, EventArgs e) Close(); } } + private void B_Cancel_Click(object sender, EventArgs e) { Close(); @@ -83,14 +90,17 @@ private void B_ExportSMDH_Click(object sender, EventArgs e) { exportSMDH(); } + private void B_ExportSmallIcon_Click(object sender, EventArgs e) { exportIcon(false); } + private void B_ExportLargeIcon_Click(object sender, EventArgs e) { exportIcon(true); } + private void exportSMDH() { var sfd = new SaveFileDialog @@ -102,6 +112,7 @@ private void exportSMDH() CB_AppInfo_SelectedIndexChanged(null, null); // Force re-save File.WriteAllBytes(sfd.FileName, SMDH.Write()); } + private void exportIcon(bool large) { var sfd = new SaveFileDialog @@ -132,6 +143,7 @@ private void B_ImportSMDH_Click(object sender, EventArgs e) openFile(ofd.FileName); } + private void B_ImportSmallIcon_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog @@ -143,6 +155,7 @@ private void B_ImportSmallIcon_Click(object sender, EventArgs e) openFile(ofd.FileName); } + private void B_ImportLargeIcon_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog @@ -154,6 +167,7 @@ private void B_ImportLargeIcon_Click(object sender, EventArgs e) openFile(ofd.FileName); } + private void importSMDH(byte[] data, bool prompt = false) { if (prompt && DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Replace SMDH?")) @@ -166,6 +180,7 @@ private void importSMDH(byte[] data, bool prompt = false) entry = -1; // allow proper refreshing LoadSMDH(); } + private void importIcon(byte[] data, bool prompt = false) { try @@ -195,6 +210,7 @@ private void importIcon(byte[] data, bool prompt = false) } private int entry = -1; + private void CB_AppInfo_SelectedIndexChanged(object sender, EventArgs e) { if (entry > -1) diff --git a/pk3DS/Tools/RandSettings.cs b/pk3DS/Tools/RandSettings.cs index 62ce7f39fa..4e2e13bac2 100644 --- a/pk3DS/Tools/RandSettings.cs +++ b/pk3DS/Tools/RandSettings.cs @@ -10,6 +10,7 @@ public static class RandSettings { public const string FileName = "randsettings.txt"; private static readonly Dictionary> Settings = new Dictionary>(); + public static void Load(string[] lines) { Settings.Clear(); @@ -23,6 +24,7 @@ public static void Load(string[] lines) ctr = end + 1; } } + public static string[] Save() { var result = new List(); @@ -52,6 +54,7 @@ public static void GetFormSettings(Form form, Control.ControlCollection controls TryGetValue(ctrl, pair.Value); } } + public static void SetFormSettings(Form form, Control.ControlCollection controls) { if (!Settings.TryGetValue(form.Name, out var list)) @@ -70,6 +73,7 @@ public static void SetFormSettings(Form form, Control.ControlCollection controls list.Add(pair); } } + private static void TryGetValue(Control ctrl, string s) { switch (ctrl) @@ -91,6 +95,7 @@ private static void TryGetValue(Control ctrl, string s) break; } } + private static bool TrySetValue(Control ctrl, NameValue v) { switch (ctrl) diff --git a/pk3DS/Tools/Scripts.cs b/pk3DS/Tools/Scripts.cs index 0e75b2e93f..f4fd518f44 100644 --- a/pk3DS/Tools/Scripts.cs +++ b/pk3DS/Tools/Scripts.cs @@ -31,11 +31,13 @@ internal static byte[] decompressScript(byte[] data) return mn.ToArray(); } } + internal static byte[] readCompressed(byte[] data, int pos) { byte[] c1 = data.Skip(pos).TakeWhile(b => b >> 7 > 0).ToArray(); // Take while >= 0x80 return c1.Concat(data.Skip(pos + c1.Length).Take(1)).ToArray(); // Take another } + internal static byte[] decompressBytes(byte[] cb) { byte[] db = new byte[0]; @@ -120,6 +122,7 @@ internal static byte[] compressScript(byte[] data) return mn.ToArray(); } } + internal static byte[] compressBytes(byte[] db) { short cmd = BitConverter.ToInt16(db, 0); @@ -171,7 +174,7 @@ internal static byte[] compressBytes(byte[] db) { byte bits = (byte)((byte)dv & 0x7F); dv >>= 7; // Take off 7 bits at a time bitStorage |= (byte)(bits << (ctr*8)); // Write the 7 bits into storage - bitStorage |= (byte)(1 << (7 + ctr++*8)); // continue reading flag + bitStorage |= (byte)(1 << (7 + (ctr++*8))); // continue reading flag } byte[] compressedBits = BitConverter.GetBytes(bitStorage); @@ -191,11 +194,12 @@ internal static string[] getHexLines(byte[] data, int count = 4) { data = data ?? new byte[0]; // Generates an x-byte wide space separated string array; leftovers included at the end. - string[] s = new string[data.Length/count + (data.Length % count > 0 ? 1 : 0)]; + string[] s = new string[(data.Length/count) + (data.Length % count > 0 ? 1 : 0)]; for (int i = 0; i < s.Length;i++) s[i] = BitConverter.ToString(data.Skip(i*count).Take(count).ToArray()).Replace('-', ' '); return s; } + internal static string[] getHexLines(uint[] data) { data = data ?? new uint[0]; @@ -205,6 +209,7 @@ internal static string[] getHexLines(uint[] data) s[i] = BitConverter.ToString(BitConverter.GetBytes(data[i])).Replace('-', ' '); return s; } + internal static byte[] getBytes(uint[] data) { return data.Aggregate(new byte[0], (current, t) => current.Concat(BitConverter.GetBytes(t)).ToArray()); @@ -426,7 +431,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // sanity check range... // negative.. weird - int newOfs = line*4 + delta; + int newOfs = (line * 4) + delta; op = $"{Commands[c]} => 0x{newOfs:X4} ({delta})"; break; } @@ -440,7 +445,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) } case 0x82: // JumpIfElse { - var jOffset = i*4 -4; // todo: this may be the correct jump start point... + var jOffset = (i * 4) - 4; // todo: this may be the correct jump start point... var count = cmd[i++]; // switch case table // sanity check @@ -451,14 +456,14 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) for (int j = 0; j < count; j++) { var jmp = (int)cmd[i++]; - var toOffset = (i-2)*4 + jmp; + var toOffset = ((i-2)*4) + jmp; var ifValue = (int)cmd[i++]; tree.Add($"\t{ifValue} => 0x{toOffset:X4} ({jmp})"); } // Default { int jmp = (int)cmd[i++]; - var toOffset = (i-2)*4 + jmp; + var toOffset = ((i-2)*4) + jmp; tree.Add($"\t{"*"} => 0x{toOffset:X4} ({jmp})"); } @@ -575,7 +580,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) { // minimal sanity checks // can return error code 0x1C - int newPos = i + (int)(1 + 2*(cmd[i]/4) + 1); + int newPos = i + (int)(1 + (2 *(cmd[i]/4)) + 1); op = eA(c, newPos); break; @@ -636,7 +641,9 @@ internal static string eA(uint c, params int[] arr) string parameters = arr.Length == 0 ? "" : string.Join(", ", arr.Select(z => $"{(Math.Abs(z) < 100 ? z.ToString() : "0x"+z.ToString("X4"))}")); return $"{cmd}({parameters})"; } + private static readonly Func getFloat = val => BitConverter.ToSingle(BitConverter.GetBytes(val), 0); + internal static string eF(uint c, params uint[] arr) { string cmd = Commands[c]; diff --git a/pk3DS/Tools/Shuffler.cs b/pk3DS/Tools/Shuffler.cs index 248eb8e33d..9976082fc4 100644 --- a/pk3DS/Tools/Shuffler.cs +++ b/pk3DS/Tools/Shuffler.cs @@ -28,6 +28,7 @@ public Shuffler() "a101", "a165", "a218" }; } + private string garc; private readonly string[] banlist; diff --git a/pk3DS/Tools/ToolsUI.Designer.cs b/pk3DS/Tools/ToolsUI.Designer.cs index 70ae3428c7..6cdd81cac3 100644 --- a/pk3DS/Tools/ToolsUI.Designer.cs +++ b/pk3DS/Tools/ToolsUI.Designer.cs @@ -54,8 +54,8 @@ private void InitializeComponent() this.PB_Unpack.Name = "PB_Unpack"; this.PB_Unpack.Size = new System.Drawing.Size(300, 67); this.PB_Unpack.TabIndex = 0; - this.PB_Unpack.MouseLeave += new System.EventHandler(this.dropLeave); - this.PB_Unpack.MouseHover += new System.EventHandler(this.dropHover); + this.PB_Unpack.MouseLeave += new System.EventHandler(this.DropLeave); + this.PB_Unpack.MouseHover += new System.EventHandler(this.DropHover); // // L_DARCMini // @@ -205,7 +205,7 @@ private void InitializeComponent() this.Name = "ToolsUI"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Tools"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.closeForm); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CloseForm); ((System.ComponentModel.ISupportInitialize)(this.PB_BCLIM)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Padding)).EndInit(); this.ResumeLayout(false); diff --git a/pk3DS/Tools/ToolsUI.cs b/pk3DS/Tools/ToolsUI.cs index b594b1f641..b923d01dfd 100644 --- a/pk3DS/Tools/ToolsUI.cs +++ b/pk3DS/Tools/ToolsUI.cs @@ -17,13 +17,13 @@ public ToolsUI() { InitializeComponent(); AllowDrop = PB_Unpack.AllowDrop = PB_Repack.AllowDrop = PB_BCLIM.AllowDrop = true; - DragEnter += tabMain_DragEnter; + DragEnter += TabMain_DragEnter; DragDrop += tabMain_DragDrop; - PB_Unpack.DragEnter += tabMain_DragEnter; + PB_Unpack.DragEnter += TabMain_DragEnter; PB_Unpack.DragDrop += tabMain_DragDrop; - PB_Repack.DragEnter += tabMain_DragEnter; + PB_Repack.DragEnter += TabMain_DragEnter; PB_Repack.DragDrop += tabMain_DragDrop; - PB_BCLIM.DragEnter += tabMain_DragEnter; + PB_BCLIM.DragEnter += TabMain_DragEnter; PB_BCLIM.DragDrop += tabMain_DragDrop; CLIMWindow = PB_BCLIM.Size; CB_Repack.Items.Add("Autodetect"); @@ -32,10 +32,12 @@ public ToolsUI() CB_Repack.Items.Add("Mini Pack (from Name)"); CB_Repack.SelectedIndex = 0; } - private void tabMain_DragEnter(object sender, DragEventArgs e) + + private void TabMain_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } + private void tabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); @@ -47,11 +49,11 @@ private void tabMain_DragDrop(object sender, DragEventArgs e) private void HandleDrop(object sender, string path) { if (sender == PB_Unpack) - openARC(path, pBar1); + OpenARC(path, pBar1); else if (sender == PB_BCLIM) - openIMG(path); + OpenIMG(path); else if (sender == PB_Repack) - saveARC(path); + SaveARC(path); else DecompressLZSS_BLZ(path); } @@ -74,10 +76,10 @@ private void DecompressLZSS_BLZ(string path) } } - private void dropHover(object sender, EventArgs e) => ((Panel) sender).BackColor = Color.Gray; - private void dropLeave(object sender, EventArgs e) => ((Panel) sender).BackColor = Color.Transparent; + private void DropHover(object sender, EventArgs e) => ((Panel) sender).BackColor = Color.Gray; + private void DropLeave(object sender, EventArgs e) => ((Panel) sender).BackColor = Color.Transparent; - private void openIMG(string path) + private void OpenIMG(string path) { var img = BCLIM.makeBMP(path, CHK_PNG.Checked); if (img == null) @@ -105,7 +107,7 @@ private void openIMG(string path) PB_BCLIM.Size = new Size(img.Width + 2, img.Height + 2); PB_BCLIM.BackgroundImage = img; int leftpad = PB_BCLIM.Location.X; - int suggestedWidth = leftpad * 2 + PB_BCLIM.Width + 10; + int suggestedWidth = (leftpad * 2) + PB_BCLIM.Width + 10; if (Width < suggestedWidth) Width = suggestedWidth; @@ -115,7 +117,8 @@ private void openIMG(string path) } internal static volatile int threads; - internal static void openARC(string path, ProgressBar pBar1, bool recursing = false) + + internal static void OpenARC(string path, ProgressBar pBar1, bool recursing = false) { string newFolder = ""; try @@ -148,8 +151,8 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa if (Directory.Exists(newFolder)) { foreach (string file in Directory.GetFiles(newFolder)) - openARC(file, pBar1, true); - batchRenameExtension(newFolder); + OpenARC(file, pBar1, true); + BatchRenameExtension(newFolder); } } else if (first4.SequenceEqual(BitConverter.GetBytes(0x54594C41))) // ALYT @@ -184,7 +187,9 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa bool r = GarcUtil.garcUnpack(path, folderPath + "_g", SkipDecompression, pBar1); threads--; if (r) - batchRenameExtension(newFolder); + { + BatchRenameExtension(newFolder); + } else { WinFormsUtil.Alert("Unpacking failed."); return; } System.Media.SystemSounds.Asterisk.Play(); @@ -215,8 +220,7 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa } } else if (!recursing) - { WinFormsUtil.Alert("File is not a darc or a mini packed file:" + Environment.NewLine + path);;} - + { WinFormsUtil.Alert("File is not a darc or a mini packed file:" + Environment.NewLine + path); } } catch (Exception e) { @@ -225,7 +229,8 @@ internal static void openARC(string path, ProgressBar pBar1, bool recursing = fa threads = 0; } } - private void saveARC(string path) + + private void SaveARC(string path) { if (!Directory.Exists(path)) { WinFormsUtil.Error("Input path is not a Folder", path); return; } string folderName = Path.GetFileName(path); @@ -255,7 +260,7 @@ private void saveARC(string path) var version = dr == DialogResult.Yes ? GARC.VER_6 : GARC.VER_4; int padding = (int)NUD_Padding.Value; - if (version == Core.CTR.GARC.VER_4) + if (version == GARC.VER_4) padding = 4; string outfolder = Directory.GetParent(path).FullName; @@ -324,9 +329,7 @@ private void saveARC(string path) int oldPtr = BitConverter.ToInt32(oldData, 4); if (newPtr != oldPtr) // Header size is different. Prompt repointing. { - if (DialogResult.Yes != - WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Header size of existing file is nonstandard.", - "Adjust newly packed file to have the same header size as old file? Data pointers will be updated accordingly.")) + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Header size of existing file is nonstandard.", "Adjust newly packed file to have the same header size as old file? Data pointers will be updated accordingly.")) break; // Fix pointers @@ -346,6 +349,7 @@ private void saveARC(string path) Directory.Delete(path, true); System.Media.SystemSounds.Asterisk.Play(); } + private void PB_BCLIM_Click(object sender, EventArgs e) { if (ModifierKeys == Keys.Control && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Copy image to clipboard?") == DialogResult.Yes) @@ -357,26 +361,31 @@ private void PB_BCLIM_Click(object sender, EventArgs e) // Utility private readonly Size CLIMWindow; + private void B_Reset_Click(object sender, EventArgs e) { PB_BCLIM.Size = CLIMWindow; } - private static void batchRenameExtension(string Folder) + private static void BatchRenameExtension(string Folder) { if (!Directory.Exists(Folder)) return; foreach (string f in Directory.GetFiles(Folder, "*", SearchOption.AllDirectories)) - try { - string ext = Path.GetExtension(f); - string newExt = FileFormat.Guess(f); - if (ext != newExt) - File.Move(f, Path.Combine(Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f)) + newExt); - } catch { } + { + try + { + string ext = Path.GetExtension(f); + string newExt = FileFormat.Guess(f); + if (ext != newExt) + File.Move(f, Path.Combine(Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f)) + newExt); + } + catch { } + } } - private void closeForm(object sender, FormClosingEventArgs e) + private void CloseForm(object sender, FormClosingEventArgs e) { if (threads > 0 && DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Currently processing files.", "Abort?")) e.Cancel = true; diff --git a/pk3DS/WinFormsUtil.cs b/pk3DS/WinFormsUtil.cs index 3029fe6fd8..fb51224ae0 100644 --- a/pk3DS/WinFormsUtil.cs +++ b/pk3DS/WinFormsUtil.cs @@ -28,6 +28,7 @@ public static Bitmap LayerImage(Image baseLayer, Image overLayer, int x, int y, } return img; } + public static Bitmap ChangeOpacity(Image img, double trans) { if (img == null) @@ -69,6 +70,7 @@ public static string GetResourceStringSprite(int species, int form, int gender, return file; } + public static Bitmap getSprite(int species, int form, int gender, int item, GameConfig config, bool shiny = false) { if (species == 0) @@ -109,10 +111,11 @@ public static Bitmap getSprite(int species, int form, int gender, int item, Game { Bitmap itemimg = (Bitmap)(Resources.ResourceManager.GetObject("item_" + item) ?? Resources.helditem); // Redraw - baseImage = LayerImage(baseImage, itemimg, 22 + (15 - itemimg.Width) / 2, 15 + (15 - itemimg.Height), 1); + baseImage = LayerImage(baseImage, itemimg, 22 + ((15 - itemimg.Width) / 2), 15 + (15 - itemimg.Height), 1); } return baseImage; } + public static bool IsTotemForm(int species, int form, int generation = 7) { if (generation != 7) @@ -127,12 +130,14 @@ public static bool IsTotemForm(int species, int form, int generation = 7) return form == 2; return form == 1; } + public static int GetTotemBaseForm(int species, int form) { if (species == 778) // Mimikyu return form - 2; return form - 1; } + public static Bitmap scaleImage(Bitmap rawImg, int s) { Bitmap bigImg = new Bitmap(rawImg.Width * s, rawImg.Height * s); @@ -141,6 +146,7 @@ public static Bitmap scaleImage(Bitmap rawImg, int s) bigImg.SetPixel(x, y, rawImg.GetPixel(x / s, y / s)); return bigImg; } + public static Bitmap ToGrayscale(Image img) { if (img == null) @@ -158,17 +164,20 @@ public static Bitmap ToGrayscale(Image img) return bmp; } + private static void GetBitmapData(Bitmap bmp, out BitmapData bmpData, out IntPtr ptr, out byte[] data) { bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); ptr = bmpData.Scan0; data = new byte[bmp.Width * bmp.Height * 4]; } + private static void SetAllTransparencyTo(byte[] data, double trans) { for (int i = 0; i < data.Length; i += 4) data[i + 3] = (byte)(data[i + 3] * trans); } + private static void SetAllColorTo(byte[] data, Color c) { byte R = c.R; @@ -183,13 +192,14 @@ private static void SetAllColorTo(byte[] data, Color c) data[i + 2] = R; } } + private static void SetAllColorToGrayScale(byte[] data) { for (int i = 0; i < data.Length; i += 4) { if (data[i + 3] == 0) continue; - byte greyS = (byte)((0.3 * data[i + 2] + 0.59 * data[i + 1] + 0.11 * data[i + 0]) / 3); + byte greyS = (byte)(((0.3 * data[i + 2]) + (0.59 * data[i + 1]) + (0.11 * data[i + 0])) / 3); data[i + 0] = greyS; data[i + 1] = greyS; data[i + 2] = greyS; @@ -209,6 +219,7 @@ public static string[] getStringList(string f, string l) return stringdata; } + public static string[] getSimpleStringList(string f) { object txt = Resources.ResourceManager.GetObject(f); // Fetch File, \n to list. @@ -227,16 +238,19 @@ public static int ToInt32(TextBox tb) string value = tb.Text; return Util.ToInt32(value); } + public static uint ToUInt32(TextBox tb) { string value = tb.Text; return Util.ToUInt32(value); } + public static int ToInt32(MaskedTextBox tb) { string value = tb.Text; return Util.ToInt32(value); } + public static uint ToUInt32(MaskedTextBox tb) { string value = tb.Text; @@ -274,7 +288,7 @@ public static string getOnlyHex(string str) { var c = t; // filter for hex - if (c < 0x0047 && c > 0x002F || c < 0x0067 && c > 0x0060) + if ((c < 0x0047 && c > 0x002F) || (c < 0x0067 && c > 0x0060)) s += c; else System.Media.SystemSounds.Beep.Play(); @@ -357,6 +371,7 @@ public static void TranslateInterface(Control form, string lang) next:; } } + public static List FindContextMenuStrips(IEnumerable c) { List cs = new List(); @@ -364,7 +379,6 @@ public static List FindContextMenuStrips(IEnumerable { if (control.ContextMenuStrip != null) cs.Add(control.ContextMenuStrip); - else if (control.Controls.Count > 0) cs.AddRange(FindContextMenuStrips(control.Controls.OfType())); } @@ -378,12 +392,14 @@ public static DialogResult Error(params string[] lines) string msg = string.Join(Environment.NewLine + Environment.NewLine, lines); return MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } + public static DialogResult Alert(params string[] lines) { System.Media.SystemSounds.Asterisk.Play(); string msg = string.Join(Environment.NewLine + Environment.NewLine, lines); return MessageBox.Show(msg, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); } + public static DialogResult Prompt(MessageBoxButtons btn, params string[] lines) { System.Media.SystemSounds.Question.Play(); @@ -397,6 +413,7 @@ public class cbItem public string Text { get; set; } public object Value { get; set; } } + public static List getCBList(string textfile, string lang) { // Set up @@ -429,6 +446,7 @@ public static List getCBList(string textfile, string lang) Value = indexes[Array.IndexOf(unsortedList, t)] }).ToList(); } + public static List getCBList(string[] inStrings, params int[][] allowed) { List cbList = new List(); @@ -455,6 +473,7 @@ public static List getCBList(string[] inStrings, params int[][] allowed) } return cbList; } + public static List getOffsetCBList(List cbList, string[] inStrings, int offset, int[] allowed) { if (allowed == null) @@ -483,6 +502,7 @@ public static List getOffsetCBList(List cbList, string[] inStrin } return cbList; } + public static List getVariedCBList(List cbList, string[] inStrings, int[] stringNum, int[] stringVal) { // Set up @@ -516,6 +536,7 @@ public static List getVariedCBList(List cbList, string[] inStrin })); return newlist; } + public static List getUnsortedCBList(string textfile) { // Set up @@ -581,7 +602,7 @@ public static Bitmap TrimBitmap(Bitmap source) bool stop = false; for (int y = 0; y < data.Height; y++) { - byte alpha = buffer[y * data.Stride + 4 * x + 3]; + byte alpha = buffer[(y * data.Stride) + (4 * x) + 3]; if (alpha != 0) { xMin = x; @@ -604,7 +625,7 @@ public static Bitmap TrimBitmap(Bitmap source) bool stop = false; for (int x = xMin; x < data.Width; x++) { - byte alpha = buffer[y * data.Stride + 4 * x + 3]; + byte alpha = buffer[(y * data.Stride) + (4 * x) + 3]; if (alpha != 0) { yMin = y; @@ -622,7 +643,7 @@ public static Bitmap TrimBitmap(Bitmap source) bool stop = false; for (int y = yMin; y < data.Height; y++) { - byte alpha = buffer[y * data.Stride + 4 * x + 3]; + byte alpha = buffer[(y * data.Stride) + (4 * x) + 3]; if (alpha != 0) { xMax = x; @@ -640,7 +661,7 @@ public static Bitmap TrimBitmap(Bitmap source) bool stop = false; for (int x = xMin; x <= xMax; x++) { - byte alpha = buffer[y * data.Stride + 4 * x + 3]; + byte alpha = buffer[(y * data.Stride) + (4 * x) + 3]; if (alpha != 0) { yMax = y; From cecc49a9288deb3c03290b2de9df60a41ec078be Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 18 Aug 2018 19:01:01 -0700 Subject: [PATCH 121/191] Add license Closes #364 --- LICENSE.md | 596 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 596 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000000..16d89e0a34 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,596 @@ +GNU GENERAL PUBLIC LICENSE +========================== + +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. <> + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +## Preamble + +The GNU General Public License is a free, copyleft license for software and other +kinds of works. + +The licenses for most software and other practical works are designed to take away +your freedom to share and change the works. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change all versions of a +program--to make sure it remains free software for all its users. We, the Free +Software Foundation, use the GNU General Public License for most of our software; it +applies also to any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General +Public Licenses are designed to make sure that you have the freedom to distribute +copies of free software (and charge for them if you wish), that you receive source +code or can get it if you want it, that you can change the software or use pieces of +it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or +asking you to surrender the rights. Therefore, you have certain responsibilities if +you distribute copies of the software, or if you modify it: responsibilities to +respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, +you must pass on to the recipients the same freedoms that you received. You must make +sure that they, too, receive or can get the source code. And you must show them these +terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert +copyright on the software, and (2) offer you this License giving you legal permission +to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is +no warranty for this free software. For both users' and authors' sake, the GPL +requires that modified versions be marked as changed, so that their problems will not +be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of +the software inside them, although the manufacturer can do so. This is fundamentally +incompatible with the aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we have designed +this version of the GPL to prohibit the practice for those products. If such problems +arise substantially in other domains, we stand ready to extend this provision to +those domains in future versions of the GPL, as needed to protect the freedom of +users. + +Finally, every program is threatened constantly by software patents. States should +not allow patents to restrict development and use of software on general-purpose +computers, but in those that do, we wish to avoid the special danger that patents +applied to a free program could make it effectively proprietary. To prevent this, the +GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +## TERMS AND CONDITIONS + +### 0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this +License. Each licensee is addressed as “you”. “Licensees” and +“recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in +a fashion requiring copyright permission, other than the making of an exact copy. The +resulting work is called a “modified version” of the earlier work or a +work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on +the Program. + +To “propagate” a work means to do anything with it that, without +permission, would make you directly or secondarily liable for infringement under +applicable copyright law, except executing it on a computer or modifying a private +copy. Propagation includes copying, distribution (with or without modification), +making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through a computer +network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the +extent that it includes a convenient and prominently visible feature that (1) +displays an appropriate copyright notice, and (2) tells the user that there is no +warranty for the work (except to the extent that warranties are provided), that +licensees may convey the work under this License, and how to view a copy of this +License. If the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +### 1. Source Code. + +The “source code” for a work means the preferred form of the work for +making modifications to it. “Object code” means any non-source form of a +work. + +A “Standard Interface” means an interface that either is an official +standard defined by a recognized standards body, or, in the case of interfaces +specified for a particular programming language, one that is widely used among +developers working in that language. + +The “System Libraries” of an executable work include anything, other than +the work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only to +enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code form. +A “Major Component”, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on which +the executable work runs, or a compiler used to produce the work, or an object code +interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the +source code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. However, +it does not include the work's System Libraries, or general-purpose tools or +generally available free programs which are used unmodified in performing those +activities but which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for the work, and +the source code for shared libraries and dynamically linked subprograms that the work +is specifically designed to require, such as by intimate data communication or +control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +### 2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on the +Program, and are irrevocable provided the stated conditions are met. This License +explicitly affirms your unlimited permission to run the unmodified Program. The +output from running a covered work is covered by this License only if the output, +given its content, constitutes a covered work. This License acknowledges your rights +of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey covered +works to others for the sole purpose of having them make modifications exclusively +for you, or provide you with facilities for running those works, provided that you +comply with the terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for you must do so +exclusively on your behalf, under your direction and control, on terms that prohibit +them from making any copies of your copyrighted material outside their relationship +with you. + +Conveying under any other circumstances is permitted solely under the conditions +stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under any +applicable law fulfilling obligations under article 11 of the WIPO copyright treaty +adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention +of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of +technological measures to the extent such circumvention is effected by exercising +rights under this License with respect to the covered work, and you disclaim any +intention to limit operation or modification of the work as a means of enforcing, +against the work's users, your or third parties' legal rights to forbid circumvention +of technological measures. + +### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, in any +medium, provided that you conspicuously and appropriately publish on each copy an +appropriate copyright notice; keep intact all notices stating that this License and +any non-permissive terms added in accord with section 7 apply to the code; keep +intact all notices of the absence of any warranty; and give all recipients a copy of +this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer +support or warranty protection for a fee. + +### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it from +the Program, in the form of source code under the terms of section 4, provided that +you also meet all of these conditions: + +* **a)** The work must carry prominent notices stating that you modified it, and giving a +relevant date. +* **b)** The work must carry prominent notices stating that it is released under this +License and any conditions added under section 7. This requirement modifies the +requirement in section 4 to “keep intact all notices”. +* **c)** You must license the entire work, as a whole, under this License to anyone who +comes into possession of a copy. This License will therefore apply, along with any +applicable section 7 additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no permission to license the +work in any other way, but it does not invalidate such permission if you have +separately received it. +* **d)** If the work has interactive user interfaces, each must display Appropriate Legal +Notices; however, if the Program has interactive interfaces that do not display +Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are +not by their nature extensions of the covered work, and which are not combined with +it such as to form a larger program, in or on a volume of a storage or distribution +medium, is called an “aggregate” if the compilation and its resulting +copyright are not used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work in an aggregate +does not cause this License to apply to the other parts of the aggregate. + +### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 and +5, provided that you also convey the machine-readable Corresponding Source under the +terms of this License, in one of these ways: + +* **a)** Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by the Corresponding Source fixed on a +durable physical medium customarily used for software interchange. +* **b)** Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by a written offer, valid for at least +three years and valid for as long as you offer spare parts or customer support for +that product model, to give anyone who possesses the object code either (1) a copy of +the Corresponding Source for all the software in the product that is covered by this +License, on a durable physical medium customarily used for software interchange, for +a price no more than your reasonable cost of physically performing this conveying of +source, or (2) access to copy the Corresponding Source from a network server at no +charge. +* **c)** Convey individual copies of the object code with a copy of the written offer to +provide the Corresponding Source. This alternative is allowed only occasionally and +noncommercially, and only if you received the object code with such an offer, in +accord with subsection 6b. +* **d)** Convey the object code by offering access from a designated place (gratis or for +a charge), and offer equivalent access to the Corresponding Source in the same way +through the same place at no further charge. You need not require recipients to copy +the Corresponding Source along with the object code. If the place to copy the object +code is a network server, the Corresponding Source may be on a different server +(operated by you or a third party) that supports equivalent copying facilities, +provided you maintain clear directions next to the object code saying where to find +the Corresponding Source. Regardless of what server hosts the Corresponding Source, +you remain obligated to ensure that it is available for as long as needed to satisfy +these requirements. +* **e)** Convey the object code using peer-to-peer transmission, provided you inform +other peers where the object code and Corresponding Source of the work are being +offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. + +A “User Product” is either (1) a “consumer product”, which +means any tangible personal property which is normally used for personal, family, or +household purposes, or (2) anything designed or sold for incorporation into a +dwelling. In determining whether a product is a consumer product, doubtful cases +shall be resolved in favor of coverage. For a particular product received by a +particular user, “normally used” refers to a typical or common use of +that class of product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected to use, the +product. A product is a consumer product regardless of whether the product has +substantial commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, +procedures, authorization keys, or other information required to install and execute +modified versions of a covered work in that User Product from a modified version of +its Corresponding Source. The information must suffice to ensure that the continued +functioning of the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for +use in, a User Product, and the conveying occurs as part of a transaction in which +the right of possession and use of the User Product is transferred to the recipient +in perpetuity or for a fixed term (regardless of how the transaction is +characterized), the Corresponding Source conveyed under this section must be +accompanied by the Installation Information. But this requirement does not apply if +neither you nor any third party retains the ability to install modified object code +on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to +continue to provide support service, warranty, or updates for a work that has been +modified or installed by the recipient, or for the User Product in which it has been +modified or installed. Access to a network may be denied when the modification itself +materially and adversely affects the operation of the network or violates the rules +and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with +this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require no +special password or key for unpacking, reading or copying. + +### 7. Additional Terms. + +“Additional permissions” are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. Additional +permissions that are applicable to the entire Program shall be treated as though they +were included in this License, to the extent that they are valid under applicable +law. If additional permissions apply only to part of the Program, that part may be +used separately under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when you +modify the work.) You may place additional permissions on material, added by you to a +covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: + +* **a)** Disclaiming warranty or limiting liability differently from the terms of +sections 15 and 16 of this License; or +* **b)** Requiring preservation of specified reasonable legal notices or author +attributions in that material or in the Appropriate Legal Notices displayed by works +containing it; or +* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that +modified versions of such material be marked in reasonable ways as different from the +original version; or +* **d)** Limiting the use for publicity purposes of names of licensors or authors of the +material; or +* **e)** Declining to grant rights under trademark law for use of some trade names, +trademarks, or service marks; or +* **f)** Requiring indemnification of licensors and authors of that material by anyone +who conveys the material (or modified versions of it) with contractual assumptions of +liability to the recipient, for any liability that these contractual assumptions +directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further +restrictions” within the meaning of section 10. If the Program as you received +it, or any part of it, contains a notice stating that it is governed by this License +along with a term that is a further restriction, you may remove that term. If a +license document contains a further restriction but permits relicensing or conveying +under this License, you may add to a covered work material governed by the terms of +that license document, provided that the further restriction does not survive such +relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in +the relevant source files, a statement of the additional terms that apply to those +files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements apply +either way. + +### 8. Termination. + +You may not propagate or modify a covered work except as expressly provided under +this License. Any attempt otherwise to propagate or modify it is void, and will +automatically terminate your rights under this License (including any patent licenses +granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated (a) provisionally, unless and until the +copyright holder explicitly and finally terminates your license, and (b) permanently, +if the copyright holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently +if the copyright holder notifies you of the violation by some reasonable means, this +is the first time you have received notice of violation of this License (for any +work) from that copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of +parties who have received copies or rights from you under this License. If your +rights have been terminated and not permanently reinstated, you do not qualify to +receive new licenses for the same material under section 10. + +### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of the +Program. Ancillary propagation of a covered work occurring solely as a consequence of +using peer-to-peer transmission to receive a copy likewise does not require +acceptance. However, nothing other than this License grants you permission to +propagate or modify any covered work. These actions infringe copyright if you do not +accept this License. Therefore, by modifying or propagating a covered work, you +indicate your acceptance of this License to do so. + +### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a license +from the original licensors, to run, modify and propagate that work, subject to this +License. You are not responsible for enforcing compliance by third parties with this +License. + +An “entity transaction” is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an organization, or +merging organizations. If propagation of a covered work results from an entity +transaction, each party to that transaction who receives a copy of the work also +receives whatever licenses to the work the party's predecessor in interest had or +could give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if the predecessor +has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or +affirmed under this License. For example, you may not impose a license fee, royalty, +or other charge for exercise of rights granted under this License, and you may not +initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging +that any patent claim is infringed by making, using, selling, offering for sale, or +importing the Program or any portion of it. + +### 11. Patents. + +A “contributor” is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The work thus +licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, that +would be infringed by some manner, permitted by this License, of making, using, or +selling its contributor version, but do not include claims that would be infringed +only as a consequence of further modification of the contributor version. For +purposes of this definition, “control” includes the right to grant patent +sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license +under the contributor's essential patent claims, to make, use, sell, offer for sale, +import and otherwise run, modify and propagate the contents of its contributor +version. + +In the following three paragraphs, a “patent license” is any express +agreement or commitment, however denominated, not to enforce a patent (such as an +express permission to practice a patent or covenant not to sue for patent +infringement). To “grant” such a patent license to a party means to make +such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of charge +and under the terms of this License, through a publicly available network server or +other readily accessible means, then you must either (1) cause the Corresponding +Source to be so available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner consistent with +the requirements of this License, to extend the patent license to downstream +recipients. “Knowingly relying” means you have actual knowledge that, but +for the patent license, your conveying the covered work in a country, or your +recipient's use of the covered work in a country, would infringe one or more +identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a patent +license to some of the parties receiving the covered work authorizing them to use, +propagate, modify or convey a specific copy of the covered work, then the patent +license you grant is automatically extended to all recipients of the covered work and +works based on it. + +A patent license is “discriminatory” if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on the +non-exercise of one or more of the rights that are specifically granted under this +License. You may not convey a covered work if you are a party to an arrangement with +a third party that is in the business of distributing software, under which you make +payment to the third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties who would receive +the covered work from you, a discriminatory patent license (a) in connection with +copies of the covered work conveyed by you (or copies made from those copies), or (b) +primarily for and in connection with specific products or compilations that contain +the covered work, unless you entered into that arrangement, or that patent license +was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to you +under applicable patent law. + +### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) +that contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot convey a covered work so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not convey it at all. For example, if you +agree to terms that obligate you to collect a royalty for further conveying from +those to whom you convey the Program, the only way you could satisfy both those terms +and this License would be to refrain entirely from conveying the Program. + +### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link or +combine any covered work with a work licensed under version 3 of the GNU Affero +General Public License into a single combined work, and to convey the resulting work. +The terms of this License will continue to apply to the part which is the covered +work, but the special requirements of the GNU Affero General Public License, section +13, concerning interaction through a network will apply to the combination as such. + +### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in spirit +to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that +a certain numbered version of the GNU General Public License “or any later +version” applies to it, you have the option of following the terms and +conditions either of that numbered version or of any later version published by the +Free Software Foundation. If the Program does not specify a version number of the GNU +General Public License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU +General Public License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no +additional obligations are imposed on any author or copyright holder as a result of +your choosing to follow a later version. + +### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE +OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE +WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot be +given local legal effect according to their terms, reviewing courts shall apply local +law that most closely approximates an absolute waiver of all civil liability in +connection with the Program, unless a warranty or assumption of liability accompanies +a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +## How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to +the public, the best way to achieve this is to make it free software which everyone +can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them +to the start of each source file to most effectively state the exclusion of warranty; +and each file should have at least the “copyright” line and a pointer to +where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this +when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate parts of +the General Public License. Of course, your program's commands might be different; +for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to +sign a “copyright disclaimer” for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +<>. + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider it +more useful to permit linking proprietary applications with the library. If this is +what you want to do, use the GNU Lesser General Public License instead of this +License. But first, please read +<>. \ No newline at end of file From dcae5d5da0a5aabb9b1b3b471e8babc58cc98a91 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 21 Aug 2018 20:00:53 -0700 Subject: [PATCH 122/191] Update move data exporting clarity #352 --- pk3DS.Core/Game/GameConfig.cs | 6 +- pk3DS.Core/Structures/Gen6/Move6.cs | 98 ------------------- pk3DS.Core/Structures/Moves/Heal.cs | 10 ++ pk3DS.Core/Structures/Moves/Move.cs | 41 ++++++++ pk3DS.Core/Structures/Moves/Move6.cs | 43 ++++++++ pk3DS.Core/Structures/Moves/Move7.cs | 51 ++++++++++ pk3DS.Core/Structures/Moves/MoveFlag6.cs | 46 +++++++++ pk3DS.Core/Structures/Moves/MoveFlag7.cs | 46 +++++++++ .../Structures/Moves/MoveFlagExtensions.cs | 15 +++ .../Structures/Moves/MoveInflictDuration.cs | 11 +++ pk3DS.Core/Structures/Moves/MoveTarget.cs | 23 +++++ pk3DS/Subforms/Gen6/MoveEditor6.cs | 2 +- pk3DS/Subforms/Gen7/MoveEditor7.cs | 2 +- 13 files changed, 291 insertions(+), 103 deletions(-) delete mode 100644 pk3DS.Core/Structures/Gen6/Move6.cs create mode 100644 pk3DS.Core/Structures/Moves/Heal.cs create mode 100644 pk3DS.Core/Structures/Moves/Move.cs create mode 100644 pk3DS.Core/Structures/Moves/Move6.cs create mode 100644 pk3DS.Core/Structures/Moves/Move7.cs create mode 100644 pk3DS.Core/Structures/Moves/MoveFlag6.cs create mode 100644 pk3DS.Core/Structures/Moves/MoveFlag7.cs create mode 100644 pk3DS.Core/Structures/Moves/MoveFlagExtensions.cs create mode 100644 pk3DS.Core/Structures/Moves/MoveInflictDuration.cs create mode 100644 pk3DS.Core/Structures/Moves/MoveTarget.cs diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index a314f59b11..8a32be6651 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -158,12 +158,12 @@ public void InitializeMoves() { case 6: if (XY) - Moves = GARCMoves.Files.Select(file => new Move(file)).ToArray(); + Moves = GARCMoves.Files.Select(file => new Move6(file)).ToArray(); if (ORAS) - Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move(file)).ToArray(); + Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move6(file)).ToArray(); break; case 7: - Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move(file)).ToArray(); + Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move7(file)).ToArray(); break; } } diff --git a/pk3DS.Core/Structures/Gen6/Move6.cs b/pk3DS.Core/Structures/Gen6/Move6.cs deleted file mode 100644 index 1118dc463e..0000000000 --- a/pk3DS.Core/Structures/Gen6/Move6.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; - -namespace pk3DS.Core.Structures -{ - public class Move - { - private const int SIZE = 0x22; - private readonly byte[] Data; - public Move() => Data = new byte[SIZE]; - public Move(byte[] data) => Data = data ?? new byte[SIZE]; - public byte[] Write() => Data; - - public int Type { get => Data[0x00]; set => Data[0x00] = (byte)value; } - public int Quality { get => Data[0x01]; set => Data[0x01] = (byte)value; } - public int Category { get => Data[0x02]; set => Data[0x02] = (byte)value; } - public int Power { get => Data[0x03]; set => Data[0x03] = (byte)value; } - public int Accuracy { get => Data[0x04]; set => Data[0x04] = (byte)value; } - public int PP { get => Data[0x05]; set => Data[0x05] = (byte)value; } - public int Priority { get => Data[0x06]; set => Data[0x06] = (byte)value; } - public int HitMin { get => Data[0x07] & 0xF; set => Data[0x07] = (byte)(HitMax << 4 | value); } - public int HitMax { get => Data[0x07] >> 4; set => Data[0x07] = (byte)(value << 4 | HitMin); } - public int Inflict { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } - public int InflictPercent { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } - public MoveInflictDuration InflictCount { get => (MoveInflictDuration)Data[0x0B]; set => Data[0x0B] = (byte)value; } - public int TurnMin { get => Data[0x0C]; set => Data[0x0C] = (byte)value; } - public int TurnMax { get => Data[0x0D]; set => Data[0x0D] = (byte)value; } - public int CritStage { get => Data[0x0E]; set => Data[0x0E] = (byte)value; } - public int Flinch { get => Data[0x0F]; set => Data[0x0F] = (byte)value; } - public int EffectSequence { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } - public int Recoil { get => Data[0x12]; set => Data[0x12] = (byte)value; } - public Heal Healing { get => (Heal)Data[0x13]; set => Data[0x13] = (byte)value; } - public MoveTarget Target { get => (MoveTarget)Data[0x14]; set => Data[0x14] = (byte)value; } - public int Stat1 { get => Data[0x15]; set => Data[0x15] = (byte)value; } - public int Stat2 { get => Data[0x16]; set => Data[0x16] = (byte)value; } - public int Stat3 { get => Data[0x17]; set => Data[0x17] = (byte)value; } - public int Stat1Stage { get => Data[0x18]; set => Data[0x18] = (byte)value; } - public int Stat2Stage { get => Data[0x19]; set => Data[0x19] = (byte)value; } - public int Stat3Stage { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } - public int Stat1Percent { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } - public int Stat2Percent { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } - public int Stat3Percent { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } - - public MoveFlag Flags { get => (MoveFlag)BitConverter.ToUInt32(Data, 0x1E); set => BitConverter.GetBytes((uint)value).CopyTo(Data, 0x1E); } - - public enum Heal : byte - { - None = 0, - Full = 255, - Half = 254, - Quarter = 253, - } - } - - public enum MoveInflictDuration - { - None = 0, - Permanent, - TurnCount, - Unused, - Switch, - }; - - public enum MoveTarget : byte - { - // Specific target - AnyExceptSelf, - AllyOrSelf, - Ally, - Opponent, - AllAdjacent, - AllAdjacentOpponents, - AllAllies, - Self, - All, - RandomOpponent, - - // No pkm target - SideAll, - SideOpponent, - SideSelf, - Counter, - } - - [Flags] - public enum MoveFlag : uint - { - None, - // TBD - } - - public static class MoveFlagExtensions - { - public static bool HasFlagFast(this MoveFlag value, MoveFlag flag) - { - return (value & flag) != 0; - } - } -} diff --git a/pk3DS.Core/Structures/Moves/Heal.cs b/pk3DS.Core/Structures/Moves/Heal.cs new file mode 100644 index 0000000000..8e90505991 --- /dev/null +++ b/pk3DS.Core/Structures/Moves/Heal.cs @@ -0,0 +1,10 @@ +namespace pk3DS.Core.Structures +{ + public enum Heal : byte + { + None = 0, + Full = 255, + Half = 254, + Quarter = 253, + } +} \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/Move.cs b/pk3DS.Core/Structures/Moves/Move.cs new file mode 100644 index 0000000000..f6c72faa30 --- /dev/null +++ b/pk3DS.Core/Structures/Moves/Move.cs @@ -0,0 +1,41 @@ +namespace pk3DS.Core.Structures +{ + public abstract class Move + { + protected readonly byte[] Data; + protected abstract int SIZE { get; } + protected Move(byte[] data = null) => Data = data ?? new byte[SIZE]; + + public byte[] Write() => Data; + + public abstract int Type { get; set; } + public abstract int Quality { get; set; } + public abstract int Category { get; set; } + public abstract int Power { get; set; } + public abstract int Accuracy { get; set; } + public abstract int PP { get; set; } + public abstract int Priority { get; set; } + public abstract int HitMin { get; set; } + public abstract int HitMax { get; set; } + public abstract int Inflict { get; set; } + public abstract int InflictPercent { get; set; } + public abstract MoveInflictDuration InflictCount { get; set; } + public abstract int TurnMin { get; set; } + public abstract int TurnMax { get; set; } + public abstract int CritStage { get; set; } + public abstract int Flinch { get; set; } + public abstract int EffectSequence { get; set; } + public abstract int Recoil { get; set; } + public abstract Heal Healing { get; set; } + public abstract MoveTarget Target { get; set; } + public abstract int Stat1 { get; set; } + public abstract int Stat2 { get; set; } + public abstract int Stat3 { get; set; } + public abstract int Stat1Stage { get; set; } + public abstract int Stat2Stage { get; set; } + public abstract int Stat3Stage { get; set; } + public abstract int Stat1Percent { get; set; } + public abstract int Stat2Percent { get; set; } + public abstract int Stat3Percent { get; set; } + } +} \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/Move6.cs b/pk3DS.Core/Structures/Moves/Move6.cs new file mode 100644 index 0000000000..a31c66c39e --- /dev/null +++ b/pk3DS.Core/Structures/Moves/Move6.cs @@ -0,0 +1,43 @@ +using System; + +namespace pk3DS.Core.Structures +{ + public class Move6 : Move + { + protected override int SIZE => 0x22; + public Move6(){} + public Move6(byte[] data = null) : base(data) { } + + public override int Type { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public override int Quality { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public override int Category { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public override int Power { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public override int Accuracy { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public override int PP { get => Data[0x05]; set => Data[0x05] = (byte)value; } + public override int Priority { get => Data[0x06]; set => Data[0x06] = (byte)value; } + public override int HitMin { get => Data[0x07] & 0xF; set => Data[0x07] = (byte)(HitMax << 4 | value); } + public override int HitMax { get => Data[0x07] >> 4; set => Data[0x07] = (byte)(value << 4 | HitMin); } + public override int Inflict { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } + public override int InflictPercent { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } + public override MoveInflictDuration InflictCount { get => (MoveInflictDuration)Data[0x0B]; set => Data[0x0B] = (byte)value; } + public override int TurnMin { get => Data[0x0C]; set => Data[0x0C] = (byte)value; } + public override int TurnMax { get => Data[0x0D]; set => Data[0x0D] = (byte)value; } + public override int CritStage { get => Data[0x0E]; set => Data[0x0E] = (byte)value; } + public override int Flinch { get => Data[0x0F]; set => Data[0x0F] = (byte)value; } + public override int EffectSequence { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } + public override int Recoil { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public override Heal Healing { get => (Heal)Data[0x13]; set => Data[0x13] = (byte)value; } + public override MoveTarget Target { get => (MoveTarget)Data[0x14]; set => Data[0x14] = (byte)value; } + public override int Stat1 { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public override int Stat2 { get => Data[0x16]; set => Data[0x16] = (byte)value; } + public override int Stat3 { get => Data[0x17]; set => Data[0x17] = (byte)value; } + public override int Stat1Stage { get => Data[0x18]; set => Data[0x18] = (byte)value; } + public override int Stat2Stage { get => Data[0x19]; set => Data[0x19] = (byte)value; } + public override int Stat3Stage { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } + public override int Stat1Percent { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + public override int Stat2Percent { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public override int Stat3Percent { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } + + public MoveFlag6 Flags { get => (MoveFlag6)BitConverter.ToUInt32(Data, 0x1E); set => BitConverter.GetBytes((uint)value).CopyTo(Data, 0x1E); } + } +} diff --git a/pk3DS.Core/Structures/Moves/Move7.cs b/pk3DS.Core/Structures/Moves/Move7.cs new file mode 100644 index 0000000000..2a1b8d59c2 --- /dev/null +++ b/pk3DS.Core/Structures/Moves/Move7.cs @@ -0,0 +1,51 @@ +using System; + +namespace pk3DS.Core.Structures +{ + + public class Move7 : Move + { + protected override int SIZE => 0x28; + public Move7() { } + public Move7(byte[] data = null) : base(data) { } + + public override int Type { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public override int Quality { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public override int Category { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public override int Power { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public override int Accuracy { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public override int PP { get => Data[0x05]; set => Data[0x05] = (byte)value; } + public override int Priority { get => Data[0x06]; set => Data[0x06] = (byte)value; } + public override int HitMin { get => Data[0x07] & 0xF; set => Data[0x07] = (byte)(HitMax << 4 | value); } + public override int HitMax { get => Data[0x07] >> 4; set => Data[0x07] = (byte)(value << 4 | HitMin); } + public override int Inflict { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } + public override int InflictPercent { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } + public override MoveInflictDuration InflictCount { get => (MoveInflictDuration)Data[0x0B]; set => Data[0x0B] = (byte)value; } + public override int TurnMin { get => Data[0x0C]; set => Data[0x0C] = (byte)value; } + public override int TurnMax { get => Data[0x0D]; set => Data[0x0D] = (byte)value; } + public override int CritStage { get => Data[0x0E]; set => Data[0x0E] = (byte)value; } + public override int Flinch { get => Data[0x0F]; set => Data[0x0F] = (byte)value; } + public override int EffectSequence { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } + public override int Recoil { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public override Heal Healing { get => (Heal)Data[0x13]; set => Data[0x13] = (byte)value; } + public override MoveTarget Target { get => (MoveTarget)Data[0x14]; set => Data[0x14] = (byte)value; } + public override int Stat1 { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public override int Stat2 { get => Data[0x16]; set => Data[0x16] = (byte)value; } + public override int Stat3 { get => Data[0x17]; set => Data[0x17] = (byte)value; } + public override int Stat1Stage { get => Data[0x18]; set => Data[0x18] = (byte)value; } + public override int Stat2Stage { get => Data[0x19]; set => Data[0x19] = (byte)value; } + public override int Stat3Stage { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } + public override int Stat1Percent { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + public override int Stat2Percent { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public override int Stat3Percent { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } + + public int ZMove { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } // 32 + public int ZPower { get => Data[0x20]; set => Data[0x20] = (byte)value; } // 33 + public int ZEffect { get => Data[0x21]; set => Data[0x21] = (byte)value; } // 34 + + public int Z3 { get => Data[0x22]; set => Data[0x22] = (byte)value; } // 35 + public int ZPercent { get => Data[0x23]; set => Data[0x23] = (byte)value; } // 36 + + public MoveFlag7 Flags { get => (MoveFlag7)BitConverter.ToUInt32(Data, 0x24); set => BitConverter.GetBytes((uint)value).CopyTo(Data, 0x24); } + } +} diff --git a/pk3DS.Core/Structures/Moves/MoveFlag6.cs b/pk3DS.Core/Structures/Moves/MoveFlag6.cs new file mode 100644 index 0000000000..bea4909603 --- /dev/null +++ b/pk3DS.Core/Structures/Moves/MoveFlag6.cs @@ -0,0 +1,46 @@ +using System; + +namespace pk3DS.Core.Structures +{ + [Flags] + public enum MoveFlag6 : uint + { + None, + + F01 = 1u << 00, + F02 = 1u << 01, + F03 = 1u << 02, + F04 = 1u << 03, + F05 = 1u << 04, + F06 = 1u << 05, + F07 = 1u << 06, + F08 = 1u << 07, + + F09 = 1u << 08, + F10 = 1u << 09, + F11 = 1u << 10, + F12 = 1u << 11, + F13 = 1u << 12, + F14 = 1u << 13, + F15 = 1u << 14, + F16 = 1u << 15, + + F17 = 1u << 16, + F18 = 1u << 17, + F19 = 1u << 18, + F20 = 1u << 19, + F21 = 1u << 20, + F22 = 1u << 21, + F23 = 1u << 22, + F24 = 1u << 23, + + F25 = 1u << 24, + F26 = 1u << 25, + F27 = 1u << 26, + F28 = 1u << 27, + F29 = 1u << 28, + F30 = 1u << 29, + F31 = 1u << 30, + F32 = 1u << 31, + } +} \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/MoveFlag7.cs b/pk3DS.Core/Structures/Moves/MoveFlag7.cs new file mode 100644 index 0000000000..3745984b13 --- /dev/null +++ b/pk3DS.Core/Structures/Moves/MoveFlag7.cs @@ -0,0 +1,46 @@ +using System; + +namespace pk3DS.Core.Structures +{ + [Flags] + public enum MoveFlag7 : uint + { + None, + + F01 = 1u << 00, + F02 = 1u << 01, + F03 = 1u << 02, + F04 = 1u << 03, + F05 = 1u << 04, + F06 = 1u << 05, + F07 = 1u << 06, + F08 = 1u << 07, + + F09 = 1u << 08, + F10 = 1u << 09, + F11 = 1u << 10, + F12 = 1u << 11, + F13 = 1u << 12, + F14 = 1u << 13, + F15 = 1u << 14, + F16 = 1u << 15, + + F17 = 1u << 16, + F18 = 1u << 17, + F19 = 1u << 18, + F20 = 1u << 19, + F21 = 1u << 20, + F22 = 1u << 21, + F23 = 1u << 22, + F24 = 1u << 23, + + F25 = 1u << 24, + F26 = 1u << 25, + F27 = 1u << 26, + F28 = 1u << 27, + F29 = 1u << 28, + F30 = 1u << 29, + F31 = 1u << 30, + F32 = 1u << 31, + } +} \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/MoveFlagExtensions.cs b/pk3DS.Core/Structures/Moves/MoveFlagExtensions.cs new file mode 100644 index 0000000000..74c689eee0 --- /dev/null +++ b/pk3DS.Core/Structures/Moves/MoveFlagExtensions.cs @@ -0,0 +1,15 @@ +namespace pk3DS.Core.Structures +{ + public static class MoveFlagExtensions + { + public static bool HasFlagFast(this MoveFlag6 value, MoveFlag6 flag) + { + return (value & flag) != 0; + } + + public static bool HasFlagFast(this MoveFlag7 value, MoveFlag7 flag) + { + return (value & flag) != 0; + } + } +} \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/MoveInflictDuration.cs b/pk3DS.Core/Structures/Moves/MoveInflictDuration.cs new file mode 100644 index 0000000000..50ee270f5a --- /dev/null +++ b/pk3DS.Core/Structures/Moves/MoveInflictDuration.cs @@ -0,0 +1,11 @@ +namespace pk3DS.Core.Structures +{ + public enum MoveInflictDuration + { + None = 0, + Permanent, + TurnCountSwitch, + PermanentSwitch, + TurnCountNoSwitch, + }; +} \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/MoveTarget.cs b/pk3DS.Core/Structures/Moves/MoveTarget.cs new file mode 100644 index 0000000000..0a0839b5eb --- /dev/null +++ b/pk3DS.Core/Structures/Moves/MoveTarget.cs @@ -0,0 +1,23 @@ +namespace pk3DS.Core.Structures +{ + public enum MoveTarget : byte + { + // Specific target + AnyExceptSelf, + AllyOrSelf, + Ally, + Opponent, + AllAdjacent, + AllAdjacentOpponents, + AllAllies, + Self, + All, + RandomOpponent, + + // No pkm target + SideAll, + SideOpponent, + SideSelf, + Counter, + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index ddf080e6f3..67f694e8f8 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -168,7 +168,7 @@ private void SetEntry() private void B_Table_Click(object sender, EventArgs e) { - var items = files.Select(z => new Move(z)); + var items = files.Select(z => new Move6(z)); Clipboard.SetText(TableUtil.GetTable(items, movelist)); System.Media.SystemSounds.Asterisk.Play(); } diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index bdd2b07fde..25352bac8a 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -174,7 +174,7 @@ private void CloseForm(object sender, FormClosingEventArgs e) private void B_Table_Click(object sender, EventArgs e) { - var items = files.Select(z => new Move(z)); + var items = files.Select(z => new Move7(z)); Clipboard.SetText(TableUtil.GetTable(items, movelist)); System.Media.SystemSounds.Asterisk.Play(); } From 49b6aa94a0f0fd11c3f300fe1d6758347ee9102e Mon Sep 17 00:00:00 2001 From: sora10pls Date: Thu, 23 Aug 2018 01:37:08 -0400 Subject: [PATCH 123/191] Add max AI option to SMTE --- pk3DS.Core/Legality/Legal.cs | 2 + pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 2 +- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 52 ++++++++++----------- pk3DS/Subforms/Gen7/SMTE.cs | 9 +--- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 77df69e7df..bf0aadced5 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -207,6 +207,7 @@ public static partial class Legal 165, // Pokémon Professor 183, // Battle Legend 184, // Battle Legend + 185, // Aether Foundation #endregion }; @@ -286,6 +287,7 @@ public static partial class Legal 165, // Pokémon Professor 183, // Battle Legend 184, // Battle Legend + 185, // Aether Foundation 186, // Pokémon Trainer 187, // Pokémon Trainer 188, // Pokémon Trainer diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 132442819e..d5c84ede81 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -163,7 +163,7 @@ private void AddGen2Species(List list) if (L) { - list.AddRange(Enumerable.Range(243, 3)); // Beasts + list.AddRange(Enumerable.Range(243, 3)); // Raikou, Entei, Suicune list.AddRange(Enumerable.Range(249, 2)); // Lugia & Ho-Oh } if (E) list.Add(251); // Celebi diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 098f154805..1730d7e118 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -167,7 +167,7 @@ private void InitializeComponent() this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); this.CHK_NoFixedDamage = new System.Windows.Forms.CheckBox(); - this.CHK_BeneficialEVs = new System.Windows.Forms.CheckBox(); + this.CHK_MaxAI = new System.Windows.Forms.CheckBox(); this.L_Moves = new System.Windows.Forms.Label(); this.CB_Moves = new System.Windows.Forms.ComboBox(); this.CHK_MaxDiffPKM = new System.Windows.Forms.CheckBox(); @@ -182,7 +182,6 @@ private void InitializeComponent() this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.CHK_6PKM = new System.Windows.Forms.CheckBox(); this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); - this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); this.L_MinPKM = new System.Windows.Forms.Label(); this.L_MaxPKM = new System.Windows.Forms.Label(); this.NUD_RMin = new System.Windows.Forms.NumericUpDown(); @@ -191,6 +190,7 @@ private void InitializeComponent() this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); + this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -1773,7 +1773,7 @@ private void InitializeComponent() this.Tab_PKM2.Controls.Add(this.CHK_ForceHighPower); this.Tab_PKM2.Controls.Add(this.NUD_ForceHighPower); this.Tab_PKM2.Controls.Add(this.CHK_NoFixedDamage); - this.Tab_PKM2.Controls.Add(this.CHK_BeneficialEVs); + this.Tab_PKM2.Controls.Add(this.CHK_MaxAI); this.Tab_PKM2.Controls.Add(this.L_Moves); this.Tab_PKM2.Controls.Add(this.CB_Moves); this.Tab_PKM2.Controls.Add(this.CHK_MaxDiffPKM); @@ -1832,18 +1832,18 @@ private void InitializeComponent() this.CHK_NoFixedDamage.Text = "No Fixed Damage Moves (Dragon Rage/Sonic Boom)"; this.CHK_NoFixedDamage.UseVisualStyleBackColor = true; // - // CHK_BeneficialEVs + // CHK_MaxAI // - this.CHK_BeneficialEVs.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.CHK_BeneficialEVs.AutoSize = true; - this.CHK_BeneficialEVs.Checked = true; - this.CHK_BeneficialEVs.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BeneficialEVs.Location = new System.Drawing.Point(201, 120); - this.CHK_BeneficialEVs.Name = "CHK_BeneficialEVs"; - this.CHK_BeneficialEVs.Size = new System.Drawing.Size(75, 17); - this.CHK_BeneficialEVs.TabIndex = 339; - this.CHK_BeneficialEVs.Text = "Smart EVs"; - this.CHK_BeneficialEVs.UseVisualStyleBackColor = true; + this.CHK_MaxAI.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.CHK_MaxAI.AutoSize = true; + this.CHK_MaxAI.Checked = true; + this.CHK_MaxAI.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_MaxAI.Location = new System.Drawing.Point(201, 120); + this.CHK_MaxAI.Name = "CHK_MaxAI"; + this.CHK_MaxAI.Size = new System.Drawing.Size(95, 17); + this.CHK_MaxAI.TabIndex = 339; + this.CHK_MaxAI.Text = "Max Trainer AI"; + this.CHK_MaxAI.UseVisualStyleBackColor = true; // // L_Moves // @@ -2050,17 +2050,6 @@ private void InitializeComponent() 0, 0}); // - // CHK_ForceFullyEvolved - // - this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 79); - this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; - this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); - this.CHK_ForceFullyEvolved.TabIndex = 339; - this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; - this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; - // // L_MinPKM // this.L_MinPKM.Location = new System.Drawing.Point(191, 0); @@ -2174,6 +2163,17 @@ private void InitializeComponent() this.CHK_RandomClass.UseVisualStyleBackColor = true; this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); // + // CHK_ForceFullyEvolved + // + this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ForceFullyEvolved.AutoSize = true; + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 79); + this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.TabIndex = 339; + this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; + this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; + // // SMTE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2389,7 +2389,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_MaxDiffPKM; private System.Windows.Forms.ComboBox CB_Moves; private System.Windows.Forms.Label L_Moves; - private System.Windows.Forms.CheckBox CHK_BeneficialEVs; + private System.Windows.Forms.CheckBox CHK_MaxAI; private System.Windows.Forms.TabPage Tab_PKM2; private System.Windows.Forms.CheckBox CHK_RandomPKM; private System.Windows.Forms.CheckBox CHK_BST; diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index f8227b4b32..7548e6d8b6 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -744,13 +744,6 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); } - // lazy fix for USUM-only species - if (Main.Config.SM && pk.Species > 802) - { - pk.Species = 1; - pk.Form = 0; - } - pk.Gender = 0; // random pk.Nature = (int)(Util.rnd32() % CB_Nature.Items.Count); // random } @@ -762,6 +755,8 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.Ability = (int)Util.rnd32() % 4; if (CHK_MaxDiffPKM.Checked) pk.IVs = new[] {31, 31, 31, 31, 31, 31}; + if (CHK_MaxAI.Checked) + tr.AI |= 7; if (CHK_ForceFullyEvolved.Checked && pk.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(pk.Species)) { From 9e1d1e2dbf2c21a6bf0fa687dff5c8a2a14a2f27 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 26 Aug 2018 19:18:44 -0700 Subject: [PATCH 124/191] Update with latest pkhex property accessing telekensis, sprite flags, c#7 get/set style --- .../Structures/PersonalInfo/PersonalInfoXY.cs | 66 ++++++++++--------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs index f15523b1c5..42c29fd860 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs @@ -27,16 +27,16 @@ public override byte[] Write() return Data; } - public override int HP { get { return Data[0x00]; } set { Data[0x00] = (byte)value; } } - public override int ATK { get { return Data[0x01]; } set { Data[0x01] = (byte)value; } } - public override int DEF { get { return Data[0x02]; } set { Data[0x02] = (byte)value; } } - public override int SPE { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } } - public override int SPA { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } } - public override int SPD { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } } + public override int HP { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public override int ATK { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public override int DEF { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public override int SPE { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public override int SPA { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public override int SPD { get => Data[0x05]; set => Data[0x05] = (byte)value; } public override int[] Types { - get { return new int[] { Data[0x06], Data[0x07] }; } + get => new int[] { Data[0x06], Data[0x07] }; set { if (value?.Length != 2) return; @@ -45,19 +45,20 @@ public override int[] Types } } - public override int CatchRate { get { return Data[0x08]; } set { Data[0x08] = (byte)value; } } - public override int EvoStage { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } } - private int EVYield { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } } - public override int EV_HP { get { return EVYield >> 0 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 0)) | (value & 0x3) << 0; } } - public override int EV_ATK { get { return EVYield >> 2 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 2)) | (value & 0x3) << 2; } } - public override int EV_DEF { get { return EVYield >> 4 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 4)) | (value & 0x3) << 4; } } - public override int EV_SPE { get { return EVYield >> 6 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } } - public override int EV_SPA { get { return EVYield >> 8 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } } - public override int EV_SPD { get { return EVYield >> 10 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } } + public override int CatchRate { get => Data[0x08]; set => Data[0x08] = (byte)value; } + public override int EvoStage { get => Data[0x09]; set => Data[0x09] = (byte)value; } + private int EVYield { get => BitConverter.ToUInt16(Data, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + public override int EV_HP { get => EVYield >> 0 & 0x3; set => EVYield = (EVYield & ~(0x3 << 0)) | (value & 0x3) << 0; } + public override int EV_ATK { get => EVYield >> 2 & 0x3; set => EVYield = (EVYield & ~(0x3 << 2)) | (value & 0x3) << 2; } + public override int EV_DEF { get => EVYield >> 4 & 0x3; set => EVYield = (EVYield & ~(0x3 << 4)) | (value & 0x3) << 4; } + public override int EV_SPE { get => EVYield >> 6 & 0x3; set => EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } + public override int EV_SPA { get => EVYield >> 8 & 0x3; set => EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } + public override int EV_SPD { get => EVYield >> 10 & 0x3; set => EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } + public bool Telekenesis { get => (EVYield >> 12 & 1) == 0; set => EVYield = (EVYield & ~(0x1 << 12)) | (value ? 1 : 0) << 12; } public override int[] Items { - get { return new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE), BitConverter.ToInt16(Data, 0x10) }; } + get => new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE), BitConverter.ToInt16(Data, 0x10) }; set { if (value?.Length != 3) return; @@ -67,14 +68,14 @@ public override int[] Items } } - public override int Gender { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } } - public override int HatchCycles { get { return Data[0x13]; } set { Data[0x13] = (byte)value; } } - public override int BaseFriendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } - public override int EXPGrowth { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } + public override int Gender { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public override int HatchCycles { get => Data[0x13]; set => Data[0x13] = (byte)value; } + public override int BaseFriendship { get => Data[0x14]; set => Data[0x14] = (byte)value; } + public override int EXPGrowth { get => Data[0x15]; set => Data[0x15] = (byte)value; } public override int[] EggGroups { - get { return new int[] { Data[0x16], Data[0x17] }; } + get => new int[] { Data[0x16], Data[0x17] }; set { if (value?.Length != 2) return; @@ -85,7 +86,7 @@ public override int[] EggGroups public override int[] Abilities { - get { return new int[] { Data[0x18], Data[0x19], Data[0x1A] }; } + get => new int[] { Data[0x18], Data[0x19], Data[0x1A] }; set { if (value?.Length != 3) return; @@ -95,13 +96,16 @@ public override int[] Abilities } } - public override int EscapeRate { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } } - public override int FormStatsIndex { get { return BitConverter.ToUInt16(Data, 0x1C); } protected internal set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } } - public override int FormeSprite { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } } - public override int FormeCount { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } - public override int Color { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } } - public override int BaseEXP { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } } - public override int Height { get { return BitConverter.ToUInt16(Data, 0x24); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); } } - public override int Weight { get { return BitConverter.ToUInt16(Data, 0x26); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); } } + public override int EscapeRate { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + public override int FormStatsIndex { get => BitConverter.ToUInt16(Data, 0x1C); protected internal set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } + public override int FormeSprite { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } + public override int FormeCount { get => Data[0x20]; set => Data[0x20] = (byte)value; } + public override int Color { get => Data[0x21] & 0x3F; set => Data[0x21] = (byte)((Data[0x21] & 0xC0) | (value & 0x3F)); } + public bool SpriteFlip { get => ((Data[0x21] >> 6) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x40) | (value ? 0x40 : 0)); } + public bool SpriteForme { get => ((Data[0x21] >> 7) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x80) | (value ? 0x80 : 0)); } + + public override int BaseEXP { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } + public override int Height { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); } + public override int Weight { get => BitConverter.ToUInt16(Data, 0x26); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); } } } From 82b4914df475e30eab944dc3b41c18abc821c0e5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 26 Aug 2018 19:19:04 -0700 Subject: [PATCH 125/191] Update bitflag names #352 --- pk3DS.Core/Structures/Moves/MoveFlag6.cs | 64 ++++++++++++------------ pk3DS.Core/Structures/Moves/MoveFlag7.cs | 64 ++++++++++++------------ 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/pk3DS.Core/Structures/Moves/MoveFlag6.cs b/pk3DS.Core/Structures/Moves/MoveFlag6.cs index bea4909603..9217eae131 100644 --- a/pk3DS.Core/Structures/Moves/MoveFlag6.cs +++ b/pk3DS.Core/Structures/Moves/MoveFlag6.cs @@ -7,40 +7,40 @@ public enum MoveFlag6 : uint { None, - F01 = 1u << 00, - F02 = 1u << 01, - F03 = 1u << 02, - F04 = 1u << 03, - F05 = 1u << 04, - F06 = 1u << 05, - F07 = 1u << 06, - F08 = 1u << 07, + MakesContact = 1u << 00, + Charge = 1u << 01, + Recharge = 1u << 02, + Protect = 1u << 03, + Reflectable = 1u << 04, + Snatch = 1u << 05, + Mirror = 1u << 06, + Punch = 1u << 07, - F09 = 1u << 08, - F10 = 1u << 09, - F11 = 1u << 10, - F12 = 1u << 11, - F13 = 1u << 12, - F14 = 1u << 13, - F15 = 1u << 14, - F16 = 1u << 15, + Sound = 1u << 08, + Gravity = 1u << 09, + Defrost = 1u << 10, + Distance = 1u << 11, + Heal = 1u << 12, + IgnoreSubstitute = 1u << 13, + NonSky = 1u << 14, + Mystery = 1u << 15, - F17 = 1u << 16, - F18 = 1u << 17, - F19 = 1u << 18, - F20 = 1u << 19, - F21 = 1u << 20, - F22 = 1u << 21, - F23 = 1u << 22, - F24 = 1u << 23, + F17 = 1u << 16, // Dancer in future games + F18 = 1u << 17, + F19 = 1u << 18, + F20 = 1u << 19, + F21 = 1u << 20, + F22 = 1u << 21, + F23 = 1u << 22, + F24 = 1u << 23, - F25 = 1u << 24, - F26 = 1u << 25, - F27 = 1u << 26, - F28 = 1u << 27, - F29 = 1u << 28, - F30 = 1u << 29, - F31 = 1u << 30, - F32 = 1u << 31, + F25 = 1u << 24, + F26 = 1u << 25, + F27 = 1u << 26, + F28 = 1u << 27, + F29 = 1u << 28, + F30 = 1u << 29, + F31 = 1u << 30, + F32 = 1u << 31, } } \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/MoveFlag7.cs b/pk3DS.Core/Structures/Moves/MoveFlag7.cs index 3745984b13..a905939ad7 100644 --- a/pk3DS.Core/Structures/Moves/MoveFlag7.cs +++ b/pk3DS.Core/Structures/Moves/MoveFlag7.cs @@ -7,40 +7,40 @@ public enum MoveFlag7 : uint { None, - F01 = 1u << 00, - F02 = 1u << 01, - F03 = 1u << 02, - F04 = 1u << 03, - F05 = 1u << 04, - F06 = 1u << 05, - F07 = 1u << 06, - F08 = 1u << 07, + MakesContact = 1u << 00, + Charge = 1u << 01, + Recharge = 1u << 02, + Protect = 1u << 03, + Reflectable = 1u << 04, + Snatch = 1u << 05, + Mirror = 1u << 06, + Punch = 1u << 07, - F09 = 1u << 08, - F10 = 1u << 09, - F11 = 1u << 10, - F12 = 1u << 11, - F13 = 1u << 12, - F14 = 1u << 13, - F15 = 1u << 14, - F16 = 1u << 15, + Sound = 1u << 08, + Gravity = 1u << 09, + Defrost = 1u << 10, + Distance = 1u << 11, + Heal = 1u << 12, + IgnoreSubstitute = 1u << 13, + NonSky = 1u << 14, + Unknown = 1u << 15, - F17 = 1u << 16, - F18 = 1u << 17, - F19 = 1u << 18, - F20 = 1u << 19, - F21 = 1u << 20, - F22 = 1u << 21, - F23 = 1u << 22, - F24 = 1u << 23, + Dance = 1u << 16, + F18 = 1u << 17, + F19 = 1u << 18, + F20 = 1u << 19, + F21 = 1u << 20, + F22 = 1u << 21, + F23 = 1u << 22, + F24 = 1u << 23, - F25 = 1u << 24, - F26 = 1u << 25, - F27 = 1u << 26, - F28 = 1u << 27, - F29 = 1u << 28, - F30 = 1u << 29, - F31 = 1u << 30, - F32 = 1u << 31, + F25 = 1u << 24, + F26 = 1u << 25, + F27 = 1u << 26, + F28 = 1u << 27, + F29 = 1u << 28, + F30 = 1u << 29, + F31 = 1u << 30, + F32 = 1u << 31, } } \ No newline at end of file From 8f6c16ec283dd7328b8b382008c445f3cf07fa4f Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 26 Aug 2018 19:39:12 -0700 Subject: [PATCH 126/191] Add flag/zmove data editing Closes #352 --- pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs | 325 +++++++++----------- pk3DS/Subforms/Gen6/MoveEditor6.cs | 21 +- pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs | 189 ++++++++---- pk3DS/Subforms/Gen7/MoveEditor7.cs | 35 ++- 4 files changed, 300 insertions(+), 270 deletions(-) diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs index 0c87748703..918148a4de 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs @@ -84,16 +84,13 @@ private void InitializeComponent() this.L_Quality = new System.Windows.Forms.Label(); this.L_0xB = new System.Windows.Forms.Label(); this.NUD_0xB = new System.Windows.Forms.NumericUpDown(); - this.NUD_0x20 = new System.Windows.Forms.NumericUpDown(); - this.NUD_0x21 = new System.Windows.Forms.NumericUpDown(); - this.L_0x20 = new System.Windows.Forms.Label(); - this.L_0x21 = new System.Windows.Forms.Label(); this.B_RandAll = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.CHK_Category = new System.Windows.Forms.CheckBox(); this.CHK_Type = new System.Windows.Forms.CheckBox(); this.B_Metronome = new System.Windows.Forms.Button(); this.B_Table = new System.Windows.Forms.Button(); + this.CLB_Flags = new System.Windows.Forms.CheckedListBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).BeginInit(); @@ -116,13 +113,11 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Effect)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Accuracy)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_0xB)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x20)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x21)).BeginInit(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); - // + // // L_Type - // + // this.L_Type.AutoSize = true; this.L_Type.Location = new System.Drawing.Point(32, 38); this.L_Type.Name = "L_Type"; @@ -130,9 +125,9 @@ private void InitializeComponent() this.L_Type.TabIndex = 0; this.L_Type.Text = "Type:"; this.L_Type.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Move - // + // this.CB_Move.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Move.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Move.DropDownWidth = 120; @@ -142,9 +137,9 @@ private void InitializeComponent() this.CB_Move.Size = new System.Drawing.Size(130, 21); this.CB_Move.TabIndex = 1; this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); - // + // // L_Move - // + // this.L_Move.AutoSize = true; this.L_Move.Location = new System.Drawing.Point(33, 13); this.L_Move.Name = "L_Move"; @@ -152,27 +147,27 @@ private void InitializeComponent() this.L_Move.TabIndex = 2; this.L_Move.Text = "Move:"; this.L_Move.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Type - // + // this.CB_Type.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Type.FormattingEnabled = true; this.CB_Type.Location = new System.Drawing.Point(71, 35); this.CB_Type.Name = "CB_Type"; this.CB_Type.Size = new System.Drawing.Size(99, 21); this.CB_Type.TabIndex = 3; - // + // // CB_Category - // + // this.CB_Category.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Category.FormattingEnabled = true; this.CB_Category.Location = new System.Drawing.Point(71, 58); this.CB_Category.Name = "CB_Category"; this.CB_Category.Size = new System.Drawing.Size(99, 21); this.CB_Category.TabIndex = 4; - // + // // L_Category - // + // this.L_Category.AutoSize = true; this.L_Category.Location = new System.Drawing.Point(18, 61); this.L_Category.Name = "L_Category"; @@ -180,9 +175,9 @@ private void InitializeComponent() this.L_Category.TabIndex = 5; this.L_Category.Text = "Category:"; this.L_Category.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_BP - // + // this.L_BP.AutoSize = true; this.L_BP.Location = new System.Drawing.Point(26, 132); this.L_BP.Name = "L_BP"; @@ -190,9 +185,9 @@ private void InitializeComponent() this.L_BP.TabIndex = 7; this.L_BP.Text = "Power:"; this.L_BP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_PP - // + // this.L_PP.AutoSize = true; this.L_PP.Location = new System.Drawing.Point(15, 174); this.L_PP.Name = "L_PP"; @@ -200,9 +195,9 @@ private void InitializeComponent() this.L_PP.TabIndex = 8; this.L_PP.Text = "Base PP:"; this.L_PP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Min - // + // this.L_Min.AutoSize = true; this.L_Min.Location = new System.Drawing.Point(236, 132); this.L_Min.Name = "L_Min"; @@ -210,9 +205,9 @@ private void InitializeComponent() this.L_Min.TabIndex = 10; this.L_Min.Text = "Min Hits:"; this.L_Min.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Max - // + // this.L_Max.AutoSize = true; this.L_Max.Location = new System.Drawing.Point(233, 153); this.L_Max.Name = "L_Max"; @@ -220,18 +215,18 @@ private void InitializeComponent() this.L_Max.TabIndex = 12; this.L_Max.Text = "Max Hits:"; this.L_Max.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Priority - // + // this.L_Priority.AutoSize = true; this.L_Priority.Location = new System.Drawing.Point(25, 195); this.L_Priority.Name = "L_Priority"; this.L_Priority.Size = new System.Drawing.Size(41, 13); this.L_Priority.TabIndex = 17; this.L_Priority.Text = "Priority:"; - // + // // NUD_HitMax - // + // this.NUD_HitMax.Location = new System.Drawing.Point(290, 151); this.NUD_HitMax.Maximum = new decimal(new int[] { 6, @@ -241,9 +236,9 @@ private void InitializeComponent() this.NUD_HitMax.Name = "NUD_HitMax"; this.NUD_HitMax.Size = new System.Drawing.Size(30, 20); this.NUD_HitMax.TabIndex = 18; - // + // // NUD_HitMin - // + // this.NUD_HitMin.Location = new System.Drawing.Point(290, 130); this.NUD_HitMin.Maximum = new decimal(new int[] { 6, @@ -253,9 +248,9 @@ private void InitializeComponent() this.NUD_HitMin.Name = "NUD_HitMin"; this.NUD_HitMin.Size = new System.Drawing.Size(30, 20); this.NUD_HitMin.TabIndex = 19; - // + // // NUD_Priority - // + // this.NUD_Priority.Location = new System.Drawing.Point(72, 193); this.NUD_Priority.Maximum = new decimal(new int[] { 8, @@ -270,9 +265,9 @@ private void InitializeComponent() this.NUD_Priority.Name = "NUD_Priority"; this.NUD_Priority.Size = new System.Drawing.Size(35, 20); this.NUD_Priority.TabIndex = 20; - // + // // NUD_PP - // + // this.NUD_PP.Location = new System.Drawing.Point(72, 172); this.NUD_PP.Maximum = new decimal(new int[] { 40, @@ -282,9 +277,9 @@ private void InitializeComponent() this.NUD_PP.Name = "NUD_PP"; this.NUD_PP.Size = new System.Drawing.Size(35, 20); this.NUD_PP.TabIndex = 21; - // + // // NUD_Power - // + // this.NUD_Power.Location = new System.Drawing.Point(72, 130); this.NUD_Power.Maximum = new decimal(new int[] { 255, @@ -294,9 +289,9 @@ private void InitializeComponent() this.NUD_Power.Name = "NUD_Power"; this.NUD_Power.Size = new System.Drawing.Size(45, 20); this.NUD_Power.TabIndex = 22; - // + // // NUD_TurnMin - // + // this.NUD_TurnMin.Location = new System.Drawing.Point(290, 172); this.NUD_TurnMin.Maximum = new decimal(new int[] { 15, @@ -306,9 +301,9 @@ private void InitializeComponent() this.NUD_TurnMin.Name = "NUD_TurnMin"; this.NUD_TurnMin.Size = new System.Drawing.Size(30, 20); this.NUD_TurnMin.TabIndex = 26; - // + // // L_TrapMin - // + // this.L_TrapMin.AutoSize = true; this.L_TrapMin.Location = new System.Drawing.Point(227, 174); this.L_TrapMin.Name = "L_TrapMin"; @@ -316,9 +311,9 @@ private void InitializeComponent() this.L_TrapMin.TabIndex = 23; this.L_TrapMin.Text = "Min Turns:"; this.L_TrapMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_TurnMax - // + // this.NUD_TurnMax.Location = new System.Drawing.Point(290, 193); this.NUD_TurnMax.Maximum = new decimal(new int[] { 15, @@ -328,9 +323,9 @@ private void InitializeComponent() this.NUD_TurnMax.Name = "NUD_TurnMax"; this.NUD_TurnMax.Size = new System.Drawing.Size(30, 20); this.NUD_TurnMax.TabIndex = 25; - // + // // L_TrapMax - // + // this.L_TrapMax.AutoSize = true; this.L_TrapMax.Location = new System.Drawing.Point(224, 195); this.L_TrapMax.Name = "L_TrapMax"; @@ -338,9 +333,9 @@ private void InitializeComponent() this.L_TrapMax.TabIndex = 24; this.L_TrapMax.Text = "Max Turns:"; this.L_TrapMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Recoil - // + // this.NUD_Recoil.Location = new System.Drawing.Point(184, 172); this.NUD_Recoil.Minimum = new decimal(new int[] { 100, @@ -350,9 +345,9 @@ private void InitializeComponent() this.NUD_Recoil.Name = "NUD_Recoil"; this.NUD_Recoil.Size = new System.Drawing.Size(40, 20); this.NUD_Recoil.TabIndex = 34; - // + // // L_Recoil - // + // this.L_Recoil.AutoSize = true; this.L_Recoil.Location = new System.Drawing.Point(114, 174); this.L_Recoil.Name = "L_Recoil"; @@ -360,9 +355,9 @@ private void InitializeComponent() this.L_Recoil.TabIndex = 31; this.L_Recoil.Text = "Rec/Abs %:"; this.L_Recoil.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Heal - // + // this.NUD_Heal.Location = new System.Drawing.Point(184, 151); this.NUD_Heal.Maximum = new decimal(new int[] { 255, @@ -372,9 +367,9 @@ private void InitializeComponent() this.NUD_Heal.Name = "NUD_Heal"; this.NUD_Heal.Size = new System.Drawing.Size(40, 20); this.NUD_Heal.TabIndex = 33; - // + // // L_Heal - // + // this.L_Heal.AutoSize = true; this.L_Heal.Location = new System.Drawing.Point(135, 153); this.L_Heal.Name = "L_Heal"; @@ -382,9 +377,9 @@ private void InitializeComponent() this.L_Heal.TabIndex = 32; this.L_Heal.Text = "Heal %:"; this.L_Heal.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_CritStage - // + // this.NUD_CritStage.Location = new System.Drawing.Point(184, 193); this.NUD_CritStage.Maximum = new decimal(new int[] { 6, @@ -394,9 +389,9 @@ private void InitializeComponent() this.NUD_CritStage.Name = "NUD_CritStage"; this.NUD_CritStage.Size = new System.Drawing.Size(30, 20); this.NUD_CritStage.TabIndex = 30; - // + // // L_CritStage - // + // this.L_CritStage.AutoSize = true; this.L_CritStage.Location = new System.Drawing.Point(122, 195); this.L_CritStage.Name = "L_CritStage"; @@ -404,9 +399,9 @@ private void InitializeComponent() this.L_CritStage.TabIndex = 27; this.L_CritStage.Text = "Crit Stage:"; this.L_CritStage.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Flinch - // + // this.NUD_Flinch.Location = new System.Drawing.Point(184, 130); this.NUD_Flinch.Maximum = new decimal(new int[] { 101, @@ -416,9 +411,9 @@ private void InitializeComponent() this.NUD_Flinch.Name = "NUD_Flinch"; this.NUD_Flinch.Size = new System.Drawing.Size(40, 20); this.NUD_Flinch.TabIndex = 29; - // + // // L_Flinch - // + // this.L_Flinch.AutoSize = true; this.L_Flinch.Location = new System.Drawing.Point(129, 132); this.L_Flinch.Name = "L_Flinch"; @@ -426,9 +421,9 @@ private void InitializeComponent() this.L_Flinch.TabIndex = 28; this.L_Flinch.Text = "Flinch %:"; this.L_Flinch.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // GB_Stat - // + // this.GB_Stat.Controls.Add(this.NUD_StatP3); this.GB_Stat.Controls.Add(this.NUD_StatP2); this.GB_Stat.Controls.Add(this.NUD_StatP1); @@ -447,9 +442,9 @@ private void InitializeComponent() this.GB_Stat.TabIndex = 35; this.GB_Stat.TabStop = false; this.GB_Stat.Text = "Stat Stage Changes"; - // + // // NUD_StatP3 - // + // this.NUD_StatP3.Location = new System.Drawing.Point(165, 68); this.NUD_StatP3.Maximum = new decimal(new int[] { 101, @@ -459,9 +454,9 @@ private void InitializeComponent() this.NUD_StatP3.Name = "NUD_StatP3"; this.NUD_StatP3.Size = new System.Drawing.Size(40, 20); this.NUD_StatP3.TabIndex = 44; - // + // // NUD_StatP2 - // + // this.NUD_StatP2.Location = new System.Drawing.Point(165, 46); this.NUD_StatP2.Maximum = new decimal(new int[] { 101, @@ -471,9 +466,9 @@ private void InitializeComponent() this.NUD_StatP2.Name = "NUD_StatP2"; this.NUD_StatP2.Size = new System.Drawing.Size(40, 20); this.NUD_StatP2.TabIndex = 43; - // + // // NUD_StatP1 - // + // this.NUD_StatP1.Location = new System.Drawing.Point(165, 24); this.NUD_StatP1.Maximum = new decimal(new int[] { 101, @@ -483,9 +478,9 @@ private void InitializeComponent() this.NUD_StatP1.Name = "NUD_StatP1"; this.NUD_StatP1.Size = new System.Drawing.Size(40, 20); this.NUD_StatP1.TabIndex = 42; - // + // // NUD_Stat2 - // + // this.NUD_Stat2.Location = new System.Drawing.Point(127, 46); this.NUD_Stat2.Maximum = new decimal(new int[] { 5, @@ -500,9 +495,9 @@ private void InitializeComponent() this.NUD_Stat2.Name = "NUD_Stat2"; this.NUD_Stat2.Size = new System.Drawing.Size(35, 20); this.NUD_Stat2.TabIndex = 41; - // + // // NUD_Stat3 - // + // this.NUD_Stat3.Location = new System.Drawing.Point(127, 68); this.NUD_Stat3.Maximum = new decimal(new int[] { 5, @@ -517,9 +512,9 @@ private void InitializeComponent() this.NUD_Stat3.Name = "NUD_Stat3"; this.NUD_Stat3.Size = new System.Drawing.Size(35, 20); this.NUD_Stat3.TabIndex = 40; - // + // // NUD_Stat1 - // + // this.NUD_Stat1.Location = new System.Drawing.Point(127, 24); this.NUD_Stat1.Maximum = new decimal(new int[] { 5, @@ -534,63 +529,63 @@ private void InitializeComponent() this.NUD_Stat1.Name = "NUD_Stat1"; this.NUD_Stat1.Size = new System.Drawing.Size(35, 20); this.NUD_Stat1.TabIndex = 39; - // + // // CB_Stat3 - // + // this.CB_Stat3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat3.FormattingEnabled = true; this.CB_Stat3.Location = new System.Drawing.Point(27, 67); this.CB_Stat3.Name = "CB_Stat3"; this.CB_Stat3.Size = new System.Drawing.Size(99, 21); this.CB_Stat3.TabIndex = 38; - // + // // CB_Stat2 - // + // this.CB_Stat2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat2.FormattingEnabled = true; this.CB_Stat2.Location = new System.Drawing.Point(27, 45); this.CB_Stat2.Name = "CB_Stat2"; this.CB_Stat2.Size = new System.Drawing.Size(99, 21); this.CB_Stat2.TabIndex = 37; - // + // // CB_Stat1 - // + // this.CB_Stat1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Stat1.FormattingEnabled = true; this.CB_Stat1.Location = new System.Drawing.Point(27, 23); this.CB_Stat1.Name = "CB_Stat1"; this.CB_Stat1.Size = new System.Drawing.Size(99, 21); this.CB_Stat1.TabIndex = 36; - // + // // L_Stage3 - // + // this.L_Stage3.AutoSize = true; this.L_Stage3.Location = new System.Drawing.Point(5, 70); this.L_Stage3.Name = "L_Stage3"; this.L_Stage3.Size = new System.Drawing.Size(16, 13); this.L_Stage3.TabIndex = 2; this.L_Stage3.Text = "3:"; - // + // // L_Stage2 - // + // this.L_Stage2.AutoSize = true; this.L_Stage2.Location = new System.Drawing.Point(5, 48); this.L_Stage2.Name = "L_Stage2"; this.L_Stage2.Size = new System.Drawing.Size(16, 13); this.L_Stage2.TabIndex = 1; this.L_Stage2.Text = "2:"; - // + // // L_Stage1 - // + // this.L_Stage1.AutoSize = true; this.L_Stage1.Location = new System.Drawing.Point(5, 26); this.L_Stage1.Name = "L_Stage1"; this.L_Stage1.Size = new System.Drawing.Size(16, 13); this.L_Stage1.TabIndex = 0; this.L_Stage1.Text = "1:"; - // + // // L_Targeting - // + // this.L_Targeting.AutoSize = true; this.L_Targeting.Location = new System.Drawing.Point(173, 38); this.L_Targeting.Name = "L_Targeting"; @@ -598,9 +593,9 @@ private void InitializeComponent() this.L_Targeting.TabIndex = 36; this.L_Targeting.Text = "Targeting:"; this.L_Targeting.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_Influcts - // + // this.L_Influcts.AutoSize = true; this.L_Influcts.Location = new System.Drawing.Point(188, 60); this.L_Influcts.Name = "L_Influcts"; @@ -608,10 +603,10 @@ private void InitializeComponent() this.L_Influcts.TabIndex = 37; this.L_Influcts.Text = "Inflicts:"; this.L_Influcts.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // RTB - // - this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + // + this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.RTB.Location = new System.Drawing.Point(12, 324); this.RTB.Name = "RTB"; @@ -619,9 +614,9 @@ private void InitializeComponent() this.RTB.Size = new System.Drawing.Size(316, 51); this.RTB.TabIndex = 38; this.RTB.Text = ""; - // + // // CB_Targeting - // + // this.CB_Targeting.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Targeting.DropDownWidth = 150; this.CB_Targeting.FormattingEnabled = true; @@ -629,9 +624,9 @@ private void InitializeComponent() this.CB_Targeting.Name = "CB_Targeting"; this.CB_Targeting.Size = new System.Drawing.Size(99, 21); this.CB_Targeting.TabIndex = 39; - // + // // CB_Inflict - // + // this.CB_Inflict.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Inflict.DropDownWidth = 150; this.CB_Inflict.FormattingEnabled = true; @@ -639,9 +634,9 @@ private void InitializeComponent() this.CB_Inflict.Name = "CB_Inflict"; this.CB_Inflict.Size = new System.Drawing.Size(99, 21); this.CB_Inflict.TabIndex = 40; - // + // // L_Inflict - // + // this.L_Inflict.AutoSize = true; this.L_Inflict.Location = new System.Drawing.Point(238, 81); this.L_Inflict.Name = "L_Inflict"; @@ -649,9 +644,9 @@ private void InitializeComponent() this.L_Inflict.TabIndex = 41; this.L_Inflict.Text = "Inflict %:"; this.L_Inflict.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Inflict - // + // this.NUD_Inflict.Location = new System.Drawing.Point(287, 78); this.NUD_Inflict.Maximum = new decimal(new int[] { 101, @@ -661,9 +656,9 @@ private void InitializeComponent() this.NUD_Inflict.Name = "NUD_Inflict"; this.NUD_Inflict.Size = new System.Drawing.Size(40, 20); this.NUD_Inflict.TabIndex = 42; - // + // // NUD_Effect - // + // this.NUD_Effect.Location = new System.Drawing.Point(150, 103); this.NUD_Effect.Maximum = new decimal(new int[] { 65535, @@ -673,9 +668,9 @@ private void InitializeComponent() this.NUD_Effect.Name = "NUD_Effect"; this.NUD_Effect.Size = new System.Drawing.Size(50, 20); this.NUD_Effect.TabIndex = 44; - // + // // L_Effect - // + // this.L_Effect.AutoSize = true; this.L_Effect.Location = new System.Drawing.Point(106, 106); this.L_Effect.Name = "L_Effect"; @@ -683,9 +678,9 @@ private void InitializeComponent() this.L_Effect.TabIndex = 45; this.L_Effect.Text = "Effect:"; this.L_Effect.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_Accuracy - // + // this.NUD_Accuracy.Location = new System.Drawing.Point(72, 151); this.NUD_Accuracy.Maximum = new decimal(new int[] { 101, @@ -695,9 +690,9 @@ private void InitializeComponent() this.NUD_Accuracy.Name = "NUD_Accuracy"; this.NUD_Accuracy.Size = new System.Drawing.Size(40, 20); this.NUD_Accuracy.TabIndex = 47; - // + // // L_Accuracy - // + // this.L_Accuracy.AutoSize = true; this.L_Accuracy.Location = new System.Drawing.Point(17, 153); this.L_Accuracy.Name = "L_Accuracy"; @@ -705,9 +700,9 @@ private void InitializeComponent() this.L_Accuracy.TabIndex = 46; this.L_Accuracy.Text = "Accur %:"; this.L_Accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // CB_Quality - // + // this.CB_Quality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Quality.DropDownWidth = 170; this.CB_Quality.FormattingEnabled = true; @@ -715,9 +710,9 @@ private void InitializeComponent() this.CB_Quality.Name = "CB_Quality"; this.CB_Quality.Size = new System.Drawing.Size(129, 21); this.CB_Quality.TabIndex = 48; - // + // // L_Quality - // + // this.L_Quality.AutoSize = true; this.L_Quality.Location = new System.Drawing.Point(20, 84); this.L_Quality.Name = "L_Quality"; @@ -725,9 +720,9 @@ private void InitializeComponent() this.L_Quality.TabIndex = 49; this.L_Quality.Text = "Qualities:"; this.L_Quality.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // L_0xB - // + // this.L_0xB.AutoSize = true; this.L_0xB.Location = new System.Drawing.Point(256, 101); this.L_0xB.Name = "L_0xB"; @@ -735,9 +730,9 @@ private void InitializeComponent() this.L_0xB.TabIndex = 50; this.L_0xB.Text = "0xB:"; this.L_0xB.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // NUD_0xB - // + // this.NUD_0xB.Location = new System.Drawing.Point(287, 99); this.NUD_0xB.Maximum = new decimal(new int[] { 255, @@ -747,53 +742,9 @@ private void InitializeComponent() this.NUD_0xB.Name = "NUD_0xB"; this.NUD_0xB.Size = new System.Drawing.Size(40, 20); this.NUD_0xB.TabIndex = 51; - // - // NUD_0x20 - // - this.NUD_0x20.Location = new System.Drawing.Point(282, 239); - this.NUD_0x20.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_0x20.Name = "NUD_0x20"; - this.NUD_0x20.Size = new System.Drawing.Size(40, 20); - this.NUD_0x20.TabIndex = 52; - // - // NUD_0x21 - // - this.NUD_0x21.Location = new System.Drawing.Point(282, 261); - this.NUD_0x21.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_0x21.Name = "NUD_0x21"; - this.NUD_0x21.Size = new System.Drawing.Size(40, 20); - this.NUD_0x21.TabIndex = 53; - // - // L_0x20 - // - this.L_0x20.AutoSize = true; - this.L_0x20.Location = new System.Drawing.Point(232, 242); - this.L_0x20.Name = "L_0x20"; - this.L_0x20.Size = new System.Drawing.Size(44, 13); - this.L_0x20.TabIndex = 59; - this.L_0x20.Text = "Flags 1:"; - this.L_0x20.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_0x21 - // - this.L_0x21.AutoSize = true; - this.L_0x21.Location = new System.Drawing.Point(233, 264); - this.L_0x21.Name = "L_0x21"; - this.L_0x21.Size = new System.Drawing.Size(44, 13); - this.L_0x21.TabIndex = 62; - this.L_0x21.Text = "Flags 2:"; - this.L_0x21.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // // B_RandAll - // + // this.B_RandAll.Location = new System.Drawing.Point(333, 10); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(98, 23); @@ -801,9 +752,9 @@ private void InitializeComponent() this.B_RandAll.Text = "Randomize!"; this.B_RandAll.UseVisualStyleBackColor = true; this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click); - // + // // groupBox1 - // + // this.groupBox1.Controls.Add(this.CHK_Category); this.groupBox1.Controls.Add(this.CHK_Type); this.groupBox1.Location = new System.Drawing.Point(333, 60); @@ -812,9 +763,9 @@ private void InitializeComponent() this.groupBox1.TabIndex = 64; this.groupBox1.TabStop = false; this.groupBox1.Text = "Options"; - // + // // CHK_Category - // + // this.CHK_Category.AutoSize = true; this.CHK_Category.Location = new System.Drawing.Point(6, 34); this.CHK_Category.Name = "CHK_Category"; @@ -822,9 +773,9 @@ private void InitializeComponent() this.CHK_Category.TabIndex = 1; this.CHK_Category.Text = "Category"; this.CHK_Category.UseVisualStyleBackColor = true; - // + // // CHK_Type - // + // this.CHK_Type.AutoSize = true; this.CHK_Type.Location = new System.Drawing.Point(6, 19); this.CHK_Type.Name = "CHK_Type"; @@ -832,9 +783,9 @@ private void InitializeComponent() this.CHK_Type.TabIndex = 0; this.CHK_Type.Text = "Type"; this.CHK_Type.UseVisualStyleBackColor = true; - // + // // B_Metronome - // + // this.B_Metronome.Location = new System.Drawing.Point(333, 33); this.B_Metronome.Name = "B_Metronome"; this.B_Metronome.Size = new System.Drawing.Size(98, 23); @@ -842,9 +793,9 @@ private void InitializeComponent() this.B_Metronome.Text = "Metronome Mode"; this.B_Metronome.UseVisualStyleBackColor = true; this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click); - // + // // B_Table - // + // this.B_Table.Location = new System.Drawing.Point(356, 117); this.B_Table.Name = "B_Table"; this.B_Table.Size = new System.Drawing.Size(75, 23); @@ -852,20 +803,25 @@ private void InitializeComponent() this.B_Table.Text = "Export Table"; this.B_Table.UseVisualStyleBackColor = true; this.B_Table.Click += new System.EventHandler(this.B_Table_Click); - // + // + // CLB_Flags + // + this.CLB_Flags.FormattingEnabled = true; + this.CLB_Flags.Location = new System.Drawing.Point(328, 146); + this.CLB_Flags.Name = "CLB_Flags"; + this.CLB_Flags.Size = new System.Drawing.Size(103, 229); + this.CLB_Flags.TabIndex = 70; + // // MoveEditor6 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(439, 381); + this.Controls.Add(this.CLB_Flags); this.Controls.Add(this.B_Table); this.Controls.Add(this.B_Metronome); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_RandAll); - this.Controls.Add(this.L_0x21); - this.Controls.Add(this.L_0x20); - this.Controls.Add(this.NUD_0x21); - this.Controls.Add(this.NUD_0x20); this.Controls.Add(this.NUD_0xB); this.Controls.Add(this.L_0xB); this.Controls.Add(this.CB_Quality); @@ -940,8 +896,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Effect)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Accuracy)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_0xB)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x20)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x21)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); @@ -1007,15 +961,12 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_StatP1; private System.Windows.Forms.Label L_0xB; private System.Windows.Forms.NumericUpDown NUD_0xB; - private System.Windows.Forms.NumericUpDown NUD_0x20; - private System.Windows.Forms.NumericUpDown NUD_0x21; - private System.Windows.Forms.Label L_0x20; - private System.Windows.Forms.Label L_0x21; private System.Windows.Forms.Button B_RandAll; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox CHK_Category; private System.Windows.Forms.CheckBox CHK_Type; private System.Windows.Forms.Button B_Metronome; private System.Windows.Forms.Button B_Table; + private System.Windows.Forms.CheckedListBox CLB_Flags; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index 67f694e8f8..9ea1d7cfa4 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -58,6 +58,7 @@ private void Setup() foreach (string s in TargetingTypes) CB_Targeting.Items.Add(s); foreach (string s in MoveQualities) CB_Quality.Items.Add(s); foreach (string s in InflictionTypes) CB_Inflict.Items.Add(s); + foreach (var s in Enum.GetNames(typeof(MoveFlag6)).Skip(1)) CLB_Flags.Items.Add(s); CB_Inflict.Items.Add("Special"); CB_Move.Items.RemoveAt(0); @@ -112,15 +113,10 @@ private void GetEntry() NUD_StatP2.Value = data[0x1C]; NUD_StatP3.Value = data[0x1D]; - // Unknown (Bitflag Related for stuff like Contact and Extra Move Effects) - NUD_0x20.Value = data[0x20]; // 0x20 - NUD_0x21.Value = data[0x21]; // 0x21 - // end, the other bytes aren't used. - - //NUD_0x1E.Value = data[0x1E]; // 0x1E - //NUD_0x1F.Value = data[0x1F]; // 0x1F - //NUD_0x22.Value = data[0x22]; // 0x22 - //NUD_0x23.Value = data[0x23]; // 0x23 + var move = new Move6(data); + var flags = (uint)move.Flags; + for (int i = 0; i < CLB_Flags.Items.Count; i++) + CLB_Flags.SetItemChecked(i, ((flags >> i) & 1) == 1); } } @@ -159,9 +155,10 @@ private void SetEntry() data[0x1C] = (byte)NUD_StatP2.Value; data[0x1D] = (byte)NUD_StatP3.Value; - data[0x20] = (byte)NUD_0x20.Value; - data[0x21] = (byte)NUD_0x21.Value; - // end, the other bytes aren't used. + uint flagval = 0; + for (int i = 0; i < CLB_Flags.Items.Count; i++) + flagval |= CLB_Flags.GetItemChecked(i) ? 1u << i : 0; + BitConverter.GetBytes(flagval).CopyTo(data, 0x1E); } files[entry] = data; } diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs index 310f237eeb..c8d7ff2a9c 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs @@ -84,16 +84,21 @@ private void InitializeComponent() this.L_Quality = new System.Windows.Forms.Label(); this.L_0xB = new System.Windows.Forms.Label(); this.NUD_0xB = new System.Windows.Forms.NumericUpDown(); - this.NUD_0x20 = new System.Windows.Forms.NumericUpDown(); - this.NUD_0x21 = new System.Windows.Forms.NumericUpDown(); - this.L_0x20 = new System.Windows.Forms.Label(); - this.L_0x21 = new System.Windows.Forms.Label(); this.B_RandAll = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.CHK_Category = new System.Windows.Forms.CheckBox(); this.CHK_Type = new System.Windows.Forms.CheckBox(); this.B_Metronome = new System.Windows.Forms.Button(); this.B_Table = new System.Windows.Forms.Button(); + this.CLB_Flags = new System.Windows.Forms.CheckedListBox(); + this.NUD_ZPower = new System.Windows.Forms.NumericUpDown(); + this.NUD_ZPercent = new System.Windows.Forms.NumericUpDown(); + this.NUD_ZUnk = new System.Windows.Forms.NumericUpDown(); + this.CB_ZMove = new System.Windows.Forms.ComboBox(); + this.L_ZMove = new System.Windows.Forms.Label(); + this.NUD_ZEffect = new System.Windows.Forms.NumericUpDown(); + this.L_ZPower = new System.Windows.Forms.Label(); + this.L_ZEffect = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).BeginInit(); @@ -116,9 +121,11 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Effect)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Accuracy)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_0xB)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x20)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x21)).BeginInit(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPower)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPercent)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZUnk)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZEffect)).BeginInit(); this.SuspendLayout(); // // L_Type @@ -748,50 +755,6 @@ private void InitializeComponent() this.NUD_0xB.Size = new System.Drawing.Size(40, 20); this.NUD_0xB.TabIndex = 51; // - // NUD_0x20 - // - this.NUD_0x20.Location = new System.Drawing.Point(282, 239); - this.NUD_0x20.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_0x20.Name = "NUD_0x20"; - this.NUD_0x20.Size = new System.Drawing.Size(40, 20); - this.NUD_0x20.TabIndex = 52; - // - // NUD_0x21 - // - this.NUD_0x21.Location = new System.Drawing.Point(282, 261); - this.NUD_0x21.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_0x21.Name = "NUD_0x21"; - this.NUD_0x21.Size = new System.Drawing.Size(40, 20); - this.NUD_0x21.TabIndex = 53; - // - // L_0x20 - // - this.L_0x20.AutoSize = true; - this.L_0x20.Location = new System.Drawing.Point(232, 242); - this.L_0x20.Name = "L_0x20"; - this.L_0x20.Size = new System.Drawing.Size(44, 13); - this.L_0x20.TabIndex = 59; - this.L_0x20.Text = "Flags 1:"; - this.L_0x20.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // L_0x21 - // - this.L_0x21.AutoSize = true; - this.L_0x21.Location = new System.Drawing.Point(233, 264); - this.L_0x21.Name = "L_0x21"; - this.L_0x21.Size = new System.Drawing.Size(44, 13); - this.L_0x21.TabIndex = 62; - this.L_0x21.Text = "Flags 2:"; - this.L_0x21.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // B_RandAll // this.B_RandAll.Location = new System.Drawing.Point(333, 10); @@ -853,19 +816,118 @@ private void InitializeComponent() this.B_Table.UseVisualStyleBackColor = true; this.B_Table.Click += new System.EventHandler(this.B_Table_Click); // + // CLB_Flags + // + this.CLB_Flags.FormattingEnabled = true; + this.CLB_Flags.Location = new System.Drawing.Point(328, 146); + this.CLB_Flags.Name = "CLB_Flags"; + this.CLB_Flags.Size = new System.Drawing.Size(103, 229); + this.CLB_Flags.TabIndex = 71; + // + // NUD_ZPower + // + this.NUD_ZPower.Location = new System.Drawing.Point(282, 260); + this.NUD_ZPower.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_ZPower.Name = "NUD_ZPower"; + this.NUD_ZPower.Size = new System.Drawing.Size(40, 20); + this.NUD_ZPower.TabIndex = 72; + // + // NUD_ZPercent + // + this.NUD_ZPercent.Location = new System.Drawing.Point(239, 302); + this.NUD_ZPercent.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_ZPercent.Name = "NUD_ZPercent"; + this.NUD_ZPercent.Size = new System.Drawing.Size(40, 20); + this.NUD_ZPercent.TabIndex = 73; + // + // NUD_ZUnk + // + this.NUD_ZUnk.Location = new System.Drawing.Point(282, 302); + this.NUD_ZUnk.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_ZUnk.Name = "NUD_ZUnk"; + this.NUD_ZUnk.Size = new System.Drawing.Size(40, 20); + this.NUD_ZUnk.TabIndex = 74; + // + // CB_ZMove + // + this.CB_ZMove.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_ZMove.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_ZMove.DropDownWidth = 150; + this.CB_ZMove.FormattingEnabled = true; + this.CB_ZMove.Location = new System.Drawing.Point(227, 235); + this.CB_ZMove.Name = "CB_ZMove"; + this.CB_ZMove.Size = new System.Drawing.Size(95, 21); + this.CB_ZMove.TabIndex = 75; + // + // L_ZMove + // + this.L_ZMove.AutoSize = true; + this.L_ZMove.Location = new System.Drawing.Point(229, 219); + this.L_ZMove.Name = "L_ZMove"; + this.L_ZMove.Size = new System.Drawing.Size(44, 13); + this.L_ZMove.TabIndex = 76; + this.L_ZMove.Text = "Z Move"; + // + // NUD_ZEffect + // + this.NUD_ZEffect.Location = new System.Drawing.Point(282, 281); + this.NUD_ZEffect.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_ZEffect.Name = "NUD_ZEffect"; + this.NUD_ZEffect.Size = new System.Drawing.Size(40, 20); + this.NUD_ZEffect.TabIndex = 77; + // + // L_ZPower + // + this.L_ZPower.AutoSize = true; + this.L_ZPower.Location = new System.Drawing.Point(229, 262); + this.L_ZPower.Name = "L_ZPower"; + this.L_ZPower.Size = new System.Drawing.Size(37, 13); + this.L_ZPower.TabIndex = 78; + this.L_ZPower.Text = "Power"; + // + // L_ZEffect + // + this.L_ZEffect.AutoSize = true; + this.L_ZEffect.Location = new System.Drawing.Point(229, 283); + this.L_ZEffect.Name = "L_ZEffect"; + this.L_ZEffect.Size = new System.Drawing.Size(35, 13); + this.L_ZEffect.TabIndex = 79; + this.L_ZEffect.Text = "Effect"; + // // MoveEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(439, 381); + this.Controls.Add(this.L_ZEffect); + this.Controls.Add(this.L_ZPower); + this.Controls.Add(this.NUD_ZEffect); + this.Controls.Add(this.L_ZMove); + this.Controls.Add(this.CB_ZMove); + this.Controls.Add(this.NUD_ZUnk); + this.Controls.Add(this.NUD_ZPercent); + this.Controls.Add(this.NUD_ZPower); + this.Controls.Add(this.CLB_Flags); this.Controls.Add(this.B_Table); this.Controls.Add(this.B_Metronome); this.Controls.Add(this.groupBox1); this.Controls.Add(this.B_RandAll); - this.Controls.Add(this.L_0x21); - this.Controls.Add(this.L_0x20); - this.Controls.Add(this.NUD_0x21); - this.Controls.Add(this.NUD_0x20); this.Controls.Add(this.NUD_0xB); this.Controls.Add(this.L_0xB); this.Controls.Add(this.CB_Quality); @@ -940,10 +1002,12 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Effect)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Accuracy)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_0xB)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x20)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_0x21)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPower)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPercent)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZUnk)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ZEffect)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -1007,15 +1071,20 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_StatP1; private System.Windows.Forms.Label L_0xB; private System.Windows.Forms.NumericUpDown NUD_0xB; - private System.Windows.Forms.NumericUpDown NUD_0x20; - private System.Windows.Forms.NumericUpDown NUD_0x21; - private System.Windows.Forms.Label L_0x20; - private System.Windows.Forms.Label L_0x21; private System.Windows.Forms.Button B_RandAll; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox CHK_Category; private System.Windows.Forms.CheckBox CHK_Type; private System.Windows.Forms.Button B_Metronome; private System.Windows.Forms.Button B_Table; + private System.Windows.Forms.CheckedListBox CLB_Flags; + private System.Windows.Forms.NumericUpDown NUD_ZPower; + private System.Windows.Forms.NumericUpDown NUD_ZPercent; + private System.Windows.Forms.NumericUpDown NUD_ZUnk; + private System.Windows.Forms.ComboBox CB_ZMove; + private System.Windows.Forms.Label L_ZMove; + private System.Windows.Forms.NumericUpDown NUD_ZEffect; + private System.Windows.Forms.Label L_ZPower; + private System.Windows.Forms.Label L_ZEffect; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index 25352bac8a..d3dac48888 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -58,6 +58,8 @@ private void Setup() foreach (string s in TargetingTypes) CB_Targeting.Items.Add(s); foreach (string s in MoveQualities) CB_Quality.Items.Add(s); foreach (string s in InflictionTypes) CB_Inflict.Items.Add(s); + foreach (string s in movelist) CB_ZMove.Items.Add(s); + foreach (var s in Enum.GetNames(typeof(MoveFlag7)).Skip(1)) CLB_Flags.Items.Add(s); CB_Inflict.Items.Add("Special"); CB_Move.Items.RemoveAt(0); @@ -112,15 +114,16 @@ private void GetEntry() NUD_StatP2.Value = data[0x1C]; NUD_StatP3.Value = data[0x1D]; - // Unknown (Bitflag Related for stuff like Contact and Extra Move Effects) - NUD_0x20.Value = data[0x20]; // 0x20 - NUD_0x21.Value = data[0x21]; // 0x21 - // end, the other bytes aren't used. + var move = new Move7(data); + CB_ZMove.SelectedIndex = move.ZMove; + NUD_ZPower.Value = move.ZPower; + NUD_ZEffect.Value = move.ZEffect; + NUD_ZPercent.Value = move.ZPercent; + NUD_ZUnk.Value = move.Z3; - //NUD_0x1E.Value = data[0x1E]; // 0x1E - //NUD_0x1F.Value = data[0x1F]; // 0x1F - //NUD_0x22.Value = data[0x22]; // 0x22 - //NUD_0x23.Value = data[0x23]; // 0x23 + var flags = (uint)move.Flags; + for (int i = 0; i < CLB_Flags.Items.Count; i++) + CLB_Flags.SetItemChecked(i, ((flags >> i) & 1) == 1); } } @@ -159,9 +162,19 @@ private void setEntry() data[0x1C] = (byte)NUD_StatP2.Value; data[0x1D] = (byte)NUD_StatP3.Value; - data[0x20] = (byte)NUD_0x20.Value; - data[0x21] = (byte)NUD_0x21.Value; - // end, the other bytes aren't used. + var move = new Move7(data) + { + ZMove = CB_ZMove.SelectedIndex, + ZPower = (int) NUD_ZPower.Value, + ZEffect = (int) NUD_ZEffect.Value, + ZPercent = (int) NUD_ZPercent.Value, + Z3 = (int) NUD_ZUnk.Value + }; + + uint flagval = 0; + for (int i = 0; i < CLB_Flags.Items.Count; i++) + flagval |= CLB_Flags.GetItemChecked(i) ? 1u << i : 0; + move.Flags = (MoveFlag7) flagval; } files[entry] = data; } From 8b817382d867b023f887c5fefacf9233e3231a30 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 26 Aug 2018 21:21:41 -0700 Subject: [PATCH 127/191] Update flag naming / add docs #352 comment descriptions from showdown (except AnimateAlly) --- pk3DS.Core/Structures/Moves/MoveFlag6.cs | 32 +++++++++++----------- pk3DS.Core/Structures/Moves/MoveFlag7.cs | 34 ++++++++++++------------ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pk3DS.Core/Structures/Moves/MoveFlag6.cs b/pk3DS.Core/Structures/Moves/MoveFlag6.cs index 9217eae131..3640f3a961 100644 --- a/pk3DS.Core/Structures/Moves/MoveFlag6.cs +++ b/pk3DS.Core/Structures/Moves/MoveFlag6.cs @@ -7,23 +7,23 @@ public enum MoveFlag6 : uint { None, - MakesContact = 1u << 00, - Charge = 1u << 01, - Recharge = 1u << 02, - Protect = 1u << 03, - Reflectable = 1u << 04, - Snatch = 1u << 05, - Mirror = 1u << 06, - Punch = 1u << 07, + MakesContact = 1u << 00, // Makes contact. + Charge = 1u << 01, // The user is unable to make a move between turns. + Recharge = 1u << 02, // If this move is successful, the user must recharge on the following turn and cannot make a move. + Protect = 1u << 03, // Blocked by Detect, Protect, Spiky Shield, and if not a Status move, King's Shield. + Reflectable = 1u << 04, // Bounced back to the original user by Magic Coat or the Magic Bounce Ability. + Snatch = 1u << 05, // Can be stolen from the original user and instead used by another Pokemon using Snatch. + Mirror = 1u << 06, // Can be copied by Mirror Move. + Punch = 1u << 07, // Power is multiplied when used by a Pokemon with the Iron Fist Ability. - Sound = 1u << 08, - Gravity = 1u << 09, - Defrost = 1u << 10, - Distance = 1u << 11, - Heal = 1u << 12, - IgnoreSubstitute = 1u << 13, - NonSky = 1u << 14, - Mystery = 1u << 15, + Sound = 1u << 08, // Has no effect on Pokemon with the Soundproof Ability. + Gravity = 1u << 09, // Prevented from being executed or selected during Gravity's effect. + Defrost = 1u << 10, // Thaws the user if executed successfully while the user is frozen. + DistanceTriple = 1u << 11, // Can target a Pokemon positioned anywhere in a Triple Battle. + Heal = 1u << 12, // Prevented from being executed or selected during Heal Block's effect. + IgnoreSubstitute = 1u << 13, // Ignores a target's substitute. + FailSkyBattle = 1u << 14, // Prevented from being executed or selected in a Sky Battle. + AnimateAlly = 1u << 15, // Always animate the move when used on an ally. F17 = 1u << 16, // Dancer in future games F18 = 1u << 17, diff --git a/pk3DS.Core/Structures/Moves/MoveFlag7.cs b/pk3DS.Core/Structures/Moves/MoveFlag7.cs index a905939ad7..8acd8ec9ab 100644 --- a/pk3DS.Core/Structures/Moves/MoveFlag7.cs +++ b/pk3DS.Core/Structures/Moves/MoveFlag7.cs @@ -7,25 +7,25 @@ public enum MoveFlag7 : uint { None, - MakesContact = 1u << 00, - Charge = 1u << 01, - Recharge = 1u << 02, - Protect = 1u << 03, - Reflectable = 1u << 04, - Snatch = 1u << 05, - Mirror = 1u << 06, - Punch = 1u << 07, + MakesContact = 1u << 00, // Makes contact. + Charge = 1u << 01, // The user is unable to make a move between turns. + Recharge = 1u << 02, // If this move is successful, the user must recharge on the following turn and cannot make a move. + Protect = 1u << 03, // Blocked by Detect, Protect, Spiky Shield, and if not a Status move, King's Shield. + Reflectable = 1u << 04, // Bounced back to the original user by Magic Coat or the Magic Bounce Ability. + Snatch = 1u << 05, // Can be stolen from the original user and instead used by another Pokemon using Snatch. + Mirror = 1u << 06, // Can be copied by Mirror Move. + Punch = 1u << 07, // Power is multiplied when used by a Pokemon with the Iron Fist Ability. - Sound = 1u << 08, - Gravity = 1u << 09, - Defrost = 1u << 10, - Distance = 1u << 11, - Heal = 1u << 12, - IgnoreSubstitute = 1u << 13, - NonSky = 1u << 14, - Unknown = 1u << 15, + Sound = 1u << 08, // Has no effect on Pokemon with the Soundproof Ability. + Gravity = 1u << 09, // Prevented from being executed or selected during Gravity's effect. + Defrost = 1u << 10, // Thaws the user if executed successfully while the user is frozen. + DistanceTriple = 1u << 11, // Can target a Pokemon positioned anywhere in a Triple Battle. + Heal = 1u << 12, // Prevented from being executed or selected during Heal Block's effect. + IgnoreSubstitute = 1u << 13, // Ignores a target's substitute. + FailSkyBattle = 1u << 14, // Prevented from being executed or selected in a Sky Battle. + AnimateAlly = 1u << 15, // Always animate the move when used on an ally. - Dance = 1u << 16, + Dance = 1u << 16, // When used by a Pokemon, other Pokemon with the Dancer Ability can attempt to execute the same move. F18 = 1u << 17, F19 = 1u << 18, F20 = 1u << 19, From f4be7cf4a97b99234dccf7ae517e59b98384cfa5 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Mon, 27 Aug 2018 19:09:09 -0400 Subject: [PATCH 128/191] Show static SOS ally species name --- .../Gen7/StaticEncounterEditor7.Designer.cs | 80 +++++++++---------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 19 +++++ 2 files changed, 59 insertions(+), 40 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index 1f72319ea3..c2cbcd18e0 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -50,9 +50,9 @@ private void InitializeComponent() this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); this.CB_EGender = new System.Windows.Forms.ComboBox(); - this.L_Ally1 = new System.Windows.Forms.Label(); + this.L_SOS1 = new System.Windows.Forms.Label(); this.NUD_Ally1 = new System.Windows.Forms.NumericUpDown(); - this.L_Ally2 = new System.Windows.Forms.Label(); + this.L_SOS2 = new System.Windows.Forms.Label(); this.NUD_Ally2 = new System.Windows.Forms.NumericUpDown(); this.L_EGender = new System.Windows.Forms.Label(); this.CB_EAbility = new System.Windows.Forms.ComboBox(); @@ -103,8 +103,8 @@ private void InitializeComponent() this.L_ESpecies = new System.Windows.Forms.Label(); this.NUD_ELevel = new System.Windows.Forms.NumericUpDown(); this.LB_Encounter = new System.Windows.Forms.ListBox(); - this.label15 = new System.Windows.Forms.Label(); - this.label14 = new System.Windows.Forms.Label(); + this.L_Ally2 = new System.Windows.Forms.Label(); + this.L_Ally1 = new System.Windows.Forms.Label(); this.Tab_Trades = new System.Windows.Forms.TabPage(); this.CB_TGender = new System.Windows.Forms.ComboBox(); this.L_TGender = new System.Windows.Forms.Label(); @@ -432,9 +432,9 @@ private void InitializeComponent() // Tab_Encounters // this.Tab_Encounters.Controls.Add(this.CB_EGender); - this.Tab_Encounters.Controls.Add(this.L_Ally1); + this.Tab_Encounters.Controls.Add(this.L_SOS1); this.Tab_Encounters.Controls.Add(this.NUD_Ally1); - this.Tab_Encounters.Controls.Add(this.L_Ally2); + this.Tab_Encounters.Controls.Add(this.L_SOS2); this.Tab_Encounters.Controls.Add(this.NUD_Ally2); this.Tab_Encounters.Controls.Add(this.L_EGender); this.Tab_Encounters.Controls.Add(this.CB_EAbility); @@ -457,8 +457,8 @@ private void InitializeComponent() this.Tab_Encounters.Controls.Add(this.L_ESpecies); this.Tab_Encounters.Controls.Add(this.NUD_ELevel); this.Tab_Encounters.Controls.Add(this.LB_Encounter); - this.Tab_Encounters.Controls.Add(this.label15); - this.Tab_Encounters.Controls.Add(this.label14); + this.Tab_Encounters.Controls.Add(this.L_Ally2); + this.Tab_Encounters.Controls.Add(this.L_Ally1); this.Tab_Encounters.Location = new System.Drawing.Point(4, 22); this.Tab_Encounters.Name = "Tab_Encounters"; this.Tab_Encounters.Padding = new System.Windows.Forms.Padding(3); @@ -475,14 +475,14 @@ private void InitializeComponent() this.CB_EGender.Size = new System.Drawing.Size(136, 21); this.CB_EGender.TabIndex = 526; // - // L_Ally1 + // L_SOS1 // - this.L_Ally1.Location = new System.Drawing.Point(126, 178); - this.L_Ally1.Name = "L_Ally1"; - this.L_Ally1.Size = new System.Drawing.Size(60, 23); - this.L_Ally1.TabIndex = 523; - this.L_Ally1.Text = "SOS Ally 1:"; - this.L_Ally1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.L_SOS1.Location = new System.Drawing.Point(126, 178); + this.L_SOS1.Name = "L_SOS1"; + this.L_SOS1.Size = new System.Drawing.Size(60, 23); + this.L_SOS1.TabIndex = 523; + this.L_SOS1.Text = "SOS Ally 1:"; + this.L_SOS1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Ally1 // @@ -501,14 +501,14 @@ private void InitializeComponent() this.NUD_Ally1.Size = new System.Drawing.Size(48, 20); this.NUD_Ally1.TabIndex = 522; // - // L_Ally2 + // L_SOS2 // - this.L_Ally2.Location = new System.Drawing.Point(126, 199); - this.L_Ally2.Name = "L_Ally2"; - this.L_Ally2.Size = new System.Drawing.Size(60, 23); - this.L_Ally2.TabIndex = 521; - this.L_Ally2.Text = "SOS Ally 2:"; - this.L_Ally2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.L_SOS2.Location = new System.Drawing.Point(126, 199); + this.L_SOS2.Name = "L_SOS2"; + this.L_SOS2.Size = new System.Drawing.Size(60, 23); + this.L_SOS2.TabIndex = 521; + this.L_SOS2.Text = "SOS Ally 2:"; + this.L_SOS2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Ally2 // @@ -1129,23 +1129,23 @@ private void InitializeComponent() this.LB_Encounter.TabIndex = 1; this.LB_Encounter.SelectedIndexChanged += new System.EventHandler(this.LB_Encounter_SelectedIndexChanged); // - // label15 + // L_Ally2 // - this.label15.Location = new System.Drawing.Point(237, 199); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(66, 23); - this.label15.TabIndex = 525; - this.label15.Text = "(-1 is None)"; - this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.L_Ally2.Location = new System.Drawing.Point(237, 199); + this.L_Ally2.Name = "L_Ally2"; + this.L_Ally2.Size = new System.Drawing.Size(135, 23); + this.L_Ally2.TabIndex = 525; + this.L_Ally2.Text = "WWWWWWWWWWWW"; + this.L_Ally2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label14 + // L_Ally1 // - this.label14.Location = new System.Drawing.Point(237, 179); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(66, 23); - this.label14.TabIndex = 524; - this.label14.Text = "(-1 is None)"; - this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.L_Ally1.Location = new System.Drawing.Point(237, 179); + this.L_Ally1.Name = "L_Ally1"; + this.L_Ally1.Size = new System.Drawing.Size(135, 23); + this.L_Ally1.TabIndex = 524; + this.L_Ally1.Text = "WWWWWWWWWWWW"; + this.L_Ally1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // Tab_Trades // @@ -2176,12 +2176,12 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_ForceFullyEvolved; private System.Windows.Forms.CheckBox CHK_Metronome; - private System.Windows.Forms.Label L_Ally1; + private System.Windows.Forms.Label L_SOS1; private System.Windows.Forms.NumericUpDown NUD_Ally1; - private System.Windows.Forms.Label L_Ally2; + private System.Windows.Forms.Label L_SOS2; private System.Windows.Forms.NumericUpDown NUD_Ally2; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label L_Ally2; + private System.Windows.Forms.Label L_Ally1; private System.Windows.Forms.ComboBox CB_EGender; private System.Windows.Forms.ComboBox CB_TGender; } diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index e487e59017..6804969040 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -236,6 +236,7 @@ private void LB_Encounter_SelectedIndexChanged(object sender, EventArgs e) SetEncounter(); eEntry = LB_Encounter.SelectedIndex; GetEncounter(); + GetAllies(); } private void LB_Trade_SelectedIndexChanged(object sender, EventArgs e) @@ -247,6 +248,24 @@ private void LB_Trade_SelectedIndexChanged(object sender, EventArgs e) private bool loading; + private void GetAllies() + { + var entry = Encounters[eEntry]; + + // USUM has slots with SOS allies beyond slot 100, accommodate by trimming an extra character + int endTrim = eEntry < 100 ? 5 : 6; + + if (entry.Ally1 == 0) + L_Ally1.Text = "No SOS Ally"; + else + L_Ally1.Text = ((string)LB_Encounter.Items[entry.Ally1 - 1]).Remove(0, endTrim); + + if (entry.Ally2 == 0) + L_Ally2.Text = "No SOS Ally"; + else + L_Ally2.Text = ((string)LB_Encounter.Items[entry.Ally2 - 1]).Remove(0, endTrim); + } + private void GetGift() { if (gEntry < 0) From 74ec2378247b3f7a8b7435a27b6578563e05a253 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 27 Aug 2018 18:12:14 -0700 Subject: [PATCH 129/191] Update moveeditor7 with more detail closes #367 --- pk3DS.Core/Structures/Moves/Move7.cs | 4 +- pk3DS.Core/Structures/Moves/RefreshType.cs | 11 ++ pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs | 150 +++++++++++--------- pk3DS/Subforms/Gen7/MoveEditor7.cs | 100 +++++++++---- 4 files changed, 167 insertions(+), 98 deletions(-) create mode 100644 pk3DS.Core/Structures/Moves/RefreshType.cs diff --git a/pk3DS.Core/Structures/Moves/Move7.cs b/pk3DS.Core/Structures/Moves/Move7.cs index 2a1b8d59c2..eef97614c1 100644 --- a/pk3DS.Core/Structures/Moves/Move7.cs +++ b/pk3DS.Core/Structures/Moves/Move7.cs @@ -43,8 +43,8 @@ public Move7(byte[] data = null) : base(data) { } public int ZPower { get => Data[0x20]; set => Data[0x20] = (byte)value; } // 33 public int ZEffect { get => Data[0x21]; set => Data[0x21] = (byte)value; } // 34 - public int Z3 { get => Data[0x22]; set => Data[0x22] = (byte)value; } // 35 - public int ZPercent { get => Data[0x23]; set => Data[0x23] = (byte)value; } // 36 + public RefreshType RefreshAfflictType { get => (RefreshType)Data[0x22]; set => Data[0x22] = (byte)value; } // 35 + public int RefreshAfflictPercent { get => Data[0x23]; set => Data[0x23] = (byte)value; } // 36 public MoveFlag7 Flags { get => (MoveFlag7)BitConverter.ToUInt32(Data, 0x24); set => BitConverter.GetBytes((uint)value).CopyTo(Data, 0x24); } } diff --git a/pk3DS.Core/Structures/Moves/RefreshType.cs b/pk3DS.Core/Structures/Moves/RefreshType.cs new file mode 100644 index 0000000000..53a9897540 --- /dev/null +++ b/pk3DS.Core/Structures/Moves/RefreshType.cs @@ -0,0 +1,11 @@ +namespace pk3DS.Core.Structures +{ + public enum RefreshType : byte + { + None, + Disheveled, + Mud, + Dust, + Dry, + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs index c8d7ff2a9c..413054eec8 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.Designer.cs @@ -92,13 +92,15 @@ private void InitializeComponent() this.B_Table = new System.Windows.Forms.Button(); this.CLB_Flags = new System.Windows.Forms.CheckedListBox(); this.NUD_ZPower = new System.Windows.Forms.NumericUpDown(); - this.NUD_ZPercent = new System.Windows.Forms.NumericUpDown(); - this.NUD_ZUnk = new System.Windows.Forms.NumericUpDown(); + this.NUD_RefreshAfflictPercent = new System.Windows.Forms.NumericUpDown(); this.CB_ZMove = new System.Windows.Forms.ComboBox(); this.L_ZMove = new System.Windows.Forms.Label(); - this.NUD_ZEffect = new System.Windows.Forms.NumericUpDown(); this.L_ZPower = new System.Windows.Forms.Label(); this.L_ZEffect = new System.Windows.Forms.Label(); + this.CB_ZEffect = new System.Windows.Forms.ComboBox(); + this.CB_AfflictRefresh = new System.Windows.Forms.ComboBox(); + this.L_Refresh = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).BeginInit(); @@ -123,9 +125,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_0xB)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPower)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPercent)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ZUnk)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ZEffect)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_RefreshAfflictPercent)).BeginInit(); this.SuspendLayout(); // // L_Type @@ -146,7 +146,7 @@ private void InitializeComponent() this.CB_Move.FormattingEnabled = true; this.CB_Move.Location = new System.Drawing.Point(71, 10); this.CB_Move.Name = "CB_Move"; - this.CB_Move.Size = new System.Drawing.Size(130, 21); + this.CB_Move.Size = new System.Drawing.Size(157, 21); this.CB_Move.TabIndex = 1; this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); // @@ -618,9 +618,8 @@ private void InitializeComponent() // // RTB // - this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.RTB.Location = new System.Drawing.Point(12, 324); + this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.RTB.Location = new System.Drawing.Point(12, 370); this.RTB.Name = "RTB"; this.RTB.ReadOnly = true; this.RTB.Size = new System.Drawing.Size(316, 51); @@ -818,15 +817,18 @@ private void InitializeComponent() // // CLB_Flags // + this.CLB_Flags.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.CLB_Flags.FormattingEnabled = true; this.CLB_Flags.Location = new System.Drawing.Point(328, 146); this.CLB_Flags.Name = "CLB_Flags"; - this.CLB_Flags.Size = new System.Drawing.Size(103, 229); + this.CLB_Flags.Size = new System.Drawing.Size(103, 274); this.CLB_Flags.TabIndex = 71; // // NUD_ZPower // - this.NUD_ZPower.Location = new System.Drawing.Point(282, 260); + this.NUD_ZPower.Location = new System.Drawing.Point(71, 343); this.NUD_ZPower.Maximum = new decimal(new int[] { 255, 0, @@ -836,29 +838,12 @@ private void InitializeComponent() this.NUD_ZPower.Size = new System.Drawing.Size(40, 20); this.NUD_ZPower.TabIndex = 72; // - // NUD_ZPercent + // NUD_RefreshAfflictPercent // - this.NUD_ZPercent.Location = new System.Drawing.Point(239, 302); - this.NUD_ZPercent.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_ZPercent.Name = "NUD_ZPercent"; - this.NUD_ZPercent.Size = new System.Drawing.Size(40, 20); - this.NUD_ZPercent.TabIndex = 73; - // - // NUD_ZUnk - // - this.NUD_ZUnk.Location = new System.Drawing.Point(282, 302); - this.NUD_ZUnk.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_ZUnk.Name = "NUD_ZUnk"; - this.NUD_ZUnk.Size = new System.Drawing.Size(40, 20); - this.NUD_ZUnk.TabIndex = 74; + this.NUD_RefreshAfflictPercent.Location = new System.Drawing.Point(282, 284); + this.NUD_RefreshAfflictPercent.Name = "NUD_RefreshAfflictPercent"; + this.NUD_RefreshAfflictPercent.Size = new System.Drawing.Size(40, 20); + this.NUD_RefreshAfflictPercent.TabIndex = 73; // // CB_ZMove // @@ -866,62 +851,90 @@ private void InitializeComponent() this.CB_ZMove.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_ZMove.DropDownWidth = 150; this.CB_ZMove.FormattingEnabled = true; - this.CB_ZMove.Location = new System.Drawing.Point(227, 235); + this.CB_ZMove.Location = new System.Drawing.Point(71, 320); this.CB_ZMove.Name = "CB_ZMove"; - this.CB_ZMove.Size = new System.Drawing.Size(95, 21); + this.CB_ZMove.Size = new System.Drawing.Size(157, 21); this.CB_ZMove.TabIndex = 75; // // L_ZMove // this.L_ZMove.AutoSize = true; - this.L_ZMove.Location = new System.Drawing.Point(229, 219); + this.L_ZMove.Location = new System.Drawing.Point(18, 323); this.L_ZMove.Name = "L_ZMove"; - this.L_ZMove.Size = new System.Drawing.Size(44, 13); + this.L_ZMove.Size = new System.Drawing.Size(47, 13); this.L_ZMove.TabIndex = 76; - this.L_ZMove.Text = "Z Move"; - // - // NUD_ZEffect - // - this.NUD_ZEffect.Location = new System.Drawing.Point(282, 281); - this.NUD_ZEffect.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_ZEffect.Name = "NUD_ZEffect"; - this.NUD_ZEffect.Size = new System.Drawing.Size(40, 20); - this.NUD_ZEffect.TabIndex = 77; + this.L_ZMove.Text = "Z Move:"; // // L_ZPower // this.L_ZPower.AutoSize = true; - this.L_ZPower.Location = new System.Drawing.Point(229, 262); + this.L_ZPower.Location = new System.Drawing.Point(25, 345); this.L_ZPower.Name = "L_ZPower"; - this.L_ZPower.Size = new System.Drawing.Size(37, 13); + this.L_ZPower.Size = new System.Drawing.Size(40, 13); this.L_ZPower.TabIndex = 78; - this.L_ZPower.Text = "Power"; + this.L_ZPower.Text = "Power:"; // // L_ZEffect // this.L_ZEffect.AutoSize = true; - this.L_ZEffect.Location = new System.Drawing.Point(229, 283); + this.L_ZEffect.Location = new System.Drawing.Point(117, 345); this.L_ZEffect.Name = "L_ZEffect"; - this.L_ZEffect.Size = new System.Drawing.Size(35, 13); + this.L_ZEffect.Size = new System.Drawing.Size(38, 13); this.L_ZEffect.TabIndex = 79; - this.L_ZEffect.Text = "Effect"; + this.L_ZEffect.Text = "Effect:"; + // + // CB_ZEffect + // + this.CB_ZEffect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_ZEffect.DropDownWidth = 350; + this.CB_ZEffect.FormattingEnabled = true; + this.CB_ZEffect.Location = new System.Drawing.Point(159, 342); + this.CB_ZEffect.Name = "CB_ZEffect"; + this.CB_ZEffect.Size = new System.Drawing.Size(129, 21); + this.CB_ZEffect.TabIndex = 80; + // + // CB_AfflictRefresh + // + this.CB_AfflictRefresh.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_AfflictRefresh.DropDownWidth = 130; + this.CB_AfflictRefresh.FormattingEnabled = true; + this.CB_AfflictRefresh.Location = new System.Drawing.Point(227, 261); + this.CB_AfflictRefresh.Name = "CB_AfflictRefresh"; + this.CB_AfflictRefresh.Size = new System.Drawing.Size(95, 21); + this.CB_AfflictRefresh.TabIndex = 81; + // + // L_Refresh + // + this.L_Refresh.AutoSize = true; + this.L_Refresh.Location = new System.Drawing.Point(229, 245); + this.L_Refresh.Name = "L_Refresh"; + this.L_Refresh.Size = new System.Drawing.Size(76, 13); + this.L_Refresh.TabIndex = 82; + this.L_Refresh.Text = "Afflict Refresh:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(229, 286); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(47, 13); + this.label1.TabIndex = 83; + this.label1.Text = "Percent:"; // // MoveEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(439, 381); + this.ClientSize = new System.Drawing.Size(439, 427); + this.Controls.Add(this.label1); + this.Controls.Add(this.L_Refresh); + this.Controls.Add(this.CB_AfflictRefresh); + this.Controls.Add(this.CB_ZEffect); this.Controls.Add(this.L_ZEffect); this.Controls.Add(this.L_ZPower); - this.Controls.Add(this.NUD_ZEffect); this.Controls.Add(this.L_ZMove); this.Controls.Add(this.CB_ZMove); - this.Controls.Add(this.NUD_ZUnk); - this.Controls.Add(this.NUD_ZPercent); + this.Controls.Add(this.NUD_RefreshAfflictPercent); this.Controls.Add(this.NUD_ZPower); this.Controls.Add(this.CLB_Flags); this.Controls.Add(this.B_Table); @@ -972,9 +985,8 @@ private void InitializeComponent() this.Controls.Add(this.L_Max); this.Controls.Add(this.L_Move); this.Controls.Add(this.CB_Move); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(455, 420); - this.MinimumSize = new System.Drawing.Size(355, 420); this.Name = "MoveEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Move Editor"; @@ -1005,9 +1017,7 @@ private void InitializeComponent() this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPower)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ZPercent)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ZUnk)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ZEffect)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_RefreshAfflictPercent)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -1079,12 +1089,14 @@ private void InitializeComponent() private System.Windows.Forms.Button B_Table; private System.Windows.Forms.CheckedListBox CLB_Flags; private System.Windows.Forms.NumericUpDown NUD_ZPower; - private System.Windows.Forms.NumericUpDown NUD_ZPercent; - private System.Windows.Forms.NumericUpDown NUD_ZUnk; + private System.Windows.Forms.NumericUpDown NUD_RefreshAfflictPercent; private System.Windows.Forms.ComboBox CB_ZMove; private System.Windows.Forms.Label L_ZMove; - private System.Windows.Forms.NumericUpDown NUD_ZEffect; private System.Windows.Forms.Label L_ZPower; private System.Windows.Forms.Label L_ZEffect; + private System.Windows.Forms.ComboBox CB_ZEffect; + private System.Windows.Forms.ComboBox CB_AfflictRefresh; + private System.Windows.Forms.Label L_Refresh; + private System.Windows.Forms.Label label1; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index d3dac48888..78378649dd 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -25,15 +25,17 @@ public MoveEditor7(byte[][] infiles) private readonly string[] MoveCategories = { "Status", "Physical", "Special", }; private readonly string[] StatCategories = { "None", "Attack", "Defense", "Special Attack", "Special Defense", "Speed", "Accuracy", "Evasion", "All", }; - private readonly string[] TargetingTypes = - { "Single Adjacent Ally/Foe", + private static readonly string[] TargetingTypes = + { + "Single Adjacent Ally/Foe", "Any Ally", "Any Adjacent Ally", "Single Adjacent Foe", "Everyone but User", "All Foes", "All Allies", "Self", "All Pokémon on Field", "Single Adjacent Foe (2)", "Entire Field", "Opponent's Field", "User's Field", "Self", }; - private readonly string[] InflictionTypes = - { "None", + private static readonly string[] InflictionTypes = + { + "None", "Paralyze", "Sleep", "Freeze", "Burn", "Poison", "Confusion", "Attract", "Capture", "Nightmare", "Curse", "Taunt", "Torment", "Disable", "Yawn", "Heal Block", @@ -41,26 +43,70 @@ public MoveEditor7(byte[][] infiles) "Ingrain", "??? 0x16", "??? 0x17", "Mute" }; - private readonly string[] MoveQualities = - { "Only DMG", + private static readonly string[] MoveQualities = + { + "Only DMG", "No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat", "DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field", - "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", }; + "Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", + }; + + private static readonly string[] ZMoveEffects = + { + "None", + "+1 Attack", + "+2 Attack", + "+3 Attack", + "+1 Defense", + "+2 Defense", + "+3 Defense", + "+1 Special Attack", + "+2 Special Attack", + "+3 Special Attack", + "+1 Special Defense", + "+2 Special Defense", + "+3 Special Defense", + "+1 Speed", + "+2 Speed", + "+3 Speed", + "+1 Accuracy", + "+2 Accuracy", + "+3 Accuracy", + "+1 Evasiveness", + "+2 Evasiveness", + "+3 Evasiveness", + "+1 to all (except Accuracy or Evasiveness)", + "+2 to all (except Accuracy or Evasiveness)", + "+3 to all (except Accuracy or Evasiveness)", + "raises critical-hit ratio two stages", + "resets lowered stats of the user", + "recovers all of user's HP", + "recovers all Hp of the Pokémon switching-in (Memento and Parting Shot)", + "makes the user the center of attention", + "only on Curse: recovers all HP if the user's a Ghost type, +1 Attack otherwise" + }; private void Setup() { - foreach (string s in movelist) CB_Move.Items.Add(s); - foreach (string s in types) CB_Type.Items.Add(s); - foreach (string s in MoveCategories) CB_Category.Items.Add(s); - foreach (string s in StatCategories) CB_Stat1.Items.Add(s); - foreach (string s in StatCategories) CB_Stat2.Items.Add(s); - foreach (string s in StatCategories) CB_Stat3.Items.Add(s); - foreach (string s in TargetingTypes) CB_Targeting.Items.Add(s); - foreach (string s in MoveQualities) CB_Quality.Items.Add(s); - foreach (string s in InflictionTypes) CB_Inflict.Items.Add(s); - foreach (string s in movelist) CB_ZMove.Items.Add(s); - foreach (var s in Enum.GetNames(typeof(MoveFlag7)).Skip(1)) CLB_Flags.Items.Add(s); + char[] ps = { 'P', 'S' }; // Distinguish Physical/Special Z-Moves + for (int i = 622; i < 658; i++) + movelist[i] += $" ({ps[i % 2]})"; + CB_Move.Items.AddRange(movelist); + CB_Type.Items.AddRange(types); + CB_Category.Items.AddRange(MoveCategories); + CB_Stat1.Items.AddRange(StatCategories); + CB_Stat2.Items.AddRange(StatCategories); + CB_Stat3.Items.AddRange(StatCategories); + CB_Targeting.Items.AddRange(TargetingTypes); + CB_Quality.Items.AddRange(MoveQualities); + CB_Inflict.Items.AddRange(InflictionTypes); + CB_ZMove.Items.AddRange(movelist); + var flagnames = Enum.GetNames(typeof(MoveFlag7)).Skip(1).ToArray(); + CLB_Flags.Items.AddRange(flagnames); + CB_ZEffect.Items.AddRange(ZMoveEffects); CB_Inflict.Items.Add("Special"); + var refreshtypes = Enum.GetNames(typeof(RefreshType)); + CB_AfflictRefresh.Items.AddRange(refreshtypes); CB_Move.Items.RemoveAt(0); CB_Move.SelectedIndex = 0; @@ -70,7 +116,7 @@ private void Setup() private void ChangeEntry(object sender, EventArgs e) { - setEntry(); + SetEntry(); entry = Array.IndexOf(movelist, CB_Move.Text); GetEntry(); } @@ -117,9 +163,9 @@ private void GetEntry() var move = new Move7(data); CB_ZMove.SelectedIndex = move.ZMove; NUD_ZPower.Value = move.ZPower; - NUD_ZEffect.Value = move.ZEffect; - NUD_ZPercent.Value = move.ZPercent; - NUD_ZUnk.Value = move.Z3; + CB_ZEffect.SelectedIndex = move.ZEffect; + CB_AfflictRefresh.SelectedIndex = (int)move.RefreshAfflictType; + NUD_RefreshAfflictPercent.Value = move.RefreshAfflictPercent; var flags = (uint)move.Flags; for (int i = 0; i < CLB_Flags.Items.Count; i++) @@ -127,7 +173,7 @@ private void GetEntry() } } - private void setEntry() + private void SetEntry() { if (entry < 1) return; byte[] data = files[entry]; @@ -166,9 +212,9 @@ private void setEntry() { ZMove = CB_ZMove.SelectedIndex, ZPower = (int) NUD_ZPower.Value, - ZEffect = (int) NUD_ZEffect.Value, - ZPercent = (int) NUD_ZPercent.Value, - Z3 = (int) NUD_ZUnk.Value + ZEffect = CB_ZEffect.SelectedIndex, + RefreshAfflictPercent = (int) NUD_RefreshAfflictPercent.Value, + RefreshAfflictType = (RefreshType)CB_AfflictRefresh.SelectedIndex }; uint flagval = 0; @@ -181,7 +227,7 @@ private void setEntry() private void CloseForm(object sender, FormClosingEventArgs e) { - setEntry(); + SetEntry(); RandSettings.SetFormSettings(this, groupBox1.Controls); } From c1de3c55067920b88c08dfb819cfa2f32125696e Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 28 Aug 2018 12:43:27 -0400 Subject: [PATCH 130/191] Move USUM tutor moves to their own editor (#374) Splits the functionality from the existing g7 Mart cro editor to a separate form. --- pk3DS/Main.cs | 16 +- pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs | 112 +--------- pk3DS/Subforms/Gen7/MartEditor7UU.cs | 53 +---- pk3DS/Subforms/Gen7/MartEditor7UU.resx | 6 +- pk3DS/Subforms/Gen7/TutorEditor7.Designer.cs | 205 ++++++++++++++++++ pk3DS/Subforms/Gen7/TutorEditor7.cs | 103 +++++++++ pk3DS/Subforms/Gen7/TutorEditor7.resx | 129 +++++++++++ pk3DS/pk3DS.csproj | 9 + 8 files changed, 470 insertions(+), 163 deletions(-) create mode 100644 pk3DS/Subforms/Gen7/TutorEditor7.Designer.cs create mode 100644 pk3DS/Subforms/Gen7/TutorEditor7.cs create mode 100644 pk3DS/Subforms/Gen7/TutorEditor7.resx diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 91a46d3d32..1d0db698ab 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -270,7 +270,8 @@ private void ToggleSubEditors() case 7: romfs = new Control[] {B_GameText, B_StoryText, B_Personal, B_Evolution, B_LevelUp, B_Wild, B_MegaEvo, B_EggMove, B_Trainer, B_Item, B_Move, B_Royal, B_Pickup, B_OWSE }; exefs = new Control[] {B_TM, B_TypeChart, B_ShinyRate}; - cro = new Control[] {B_Mart}; + cro = new Control[] {B_Mart, B_MoveTutor}; + B_MoveTutor.Visible = Config.USUM; if (Config.Version != GameVersion.SMDEMO) romfs = romfs.Concat(new[] {B_Static}).ToArray(); @@ -998,8 +999,17 @@ private void B_MoveTutor_Click(object sender, EventArgs e) { if (threadActive()) return; - if (Config.XY) { WinFormsUtil.Alert("No Tutors for X/Y."); return; } // Already disabled button... - if (ExeFSPath != null) new TutorEditor6().Show(); + switch (Config.Generation) + { + case 6: + if (ExeFSPath != null) new TutorEditor6().Show(); + break; + case 7: + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) + return; + if (RomFSPath != null) new TutorEditor7().Show(); + break; + } } private void B_OPower_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs b/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs index 924b0739de..976b8d08f6 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs @@ -28,9 +28,8 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.CB_Location = new System.Windows.Forms.ComboBox(); this.dgv = new System.Windows.Forms.DataGridView(); this.dgvIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -45,23 +44,14 @@ private void InitializeComponent() this.dgvIndexBP = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dgvItemBP = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.dgvPriceBP = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dgvmv = new System.Windows.Forms.DataGridView(); - this.dgvmvIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dgvmvMove = new System.Windows.Forms.DataGridViewComboBoxColumn(); - this.dgvmvBP = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.label2 = new System.Windows.Forms.Label(); - this.CB_LocationBPMove = new System.Windows.Forms.ComboBox(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); - this.tabPage3 = new System.Windows.Forms.TabPage(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvbp)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dgvmv)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); - this.tabPage3.SuspendLayout(); this.SuspendLayout(); // // CB_Location @@ -96,8 +86,8 @@ private void InitializeComponent() // // dgvIndex // - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dgvIndex.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dgvIndex.DefaultCellStyle = dataGridViewCellStyle5; this.dgvIndex.HeaderText = "Index"; this.dgvIndex.Name = "dgvIndex"; this.dgvIndex.ReadOnly = true; @@ -194,8 +184,8 @@ private void InitializeComponent() // // dgvIndexBP // - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dgvIndexBP.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dgvIndexBP.DefaultCellStyle = dataGridViewCellStyle6; this.dgvIndexBP.HeaderText = "Index"; this.dgvIndexBP.MaxInputLength = 3; this.dgvIndexBP.Name = "dgvIndexBP"; @@ -216,70 +206,6 @@ private void InitializeComponent() this.dgvPriceBP.Name = "dgvPriceBP"; this.dgvPriceBP.Width = 65; // - // dgvmv - // - this.dgvmv.AllowUserToAddRows = false; - this.dgvmv.AllowUserToDeleteRows = false; - this.dgvmv.AllowUserToResizeColumns = false; - this.dgvmv.AllowUserToResizeRows = false; - this.dgvmv.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.dgvmv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvmv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.dgvmvIndex, - this.dgvmvMove, - this.dgvmvBP}); - this.dgvmv.Location = new System.Drawing.Point(0, 27); - this.dgvmv.Name = "dgvmv"; - this.dgvmv.Size = new System.Drawing.Size(317, 241); - this.dgvmv.TabIndex = 14; - // - // dgvmvIndex - // - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dgvmvIndex.DefaultCellStyle = dataGridViewCellStyle3; - this.dgvmvIndex.HeaderText = "Index"; - this.dgvmvIndex.MaxInputLength = 3; - this.dgvmvIndex.Name = "dgvmvIndex"; - this.dgvmvIndex.ReadOnly = true; - this.dgvmvIndex.Width = 45; - // - // dgvmvMove - // - this.dgvmvMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.dgvmvMove.HeaderText = "Move"; - this.dgvmvMove.Name = "dgvmvMove"; - this.dgvmvMove.Width = 135; - // - // dgvmvBP - // - this.dgvmvBP.HeaderText = "Price"; - this.dgvmvBP.MaxInputLength = 3; - this.dgvmvBP.Name = "dgvmvBP"; - this.dgvmvBP.Width = 65; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 6); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(51, 13); - this.label2.TabIndex = 12; - this.label2.Text = "Location:"; - // - // CB_LocationBPMove - // - this.CB_LocationBPMove.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.CB_LocationBPMove.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_LocationBPMove.FormattingEnabled = true; - this.CB_LocationBPMove.Location = new System.Drawing.Point(60, 3); - this.CB_LocationBPMove.Name = "CB_LocationBPMove"; - this.CB_LocationBPMove.Size = new System.Drawing.Size(254, 21); - this.CB_LocationBPMove.TabIndex = 11; - this.CB_LocationBPMove.SelectedIndexChanged += new System.EventHandler(this.changeIndexBPMove); - // // tabControl1 // this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -287,7 +213,6 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Location = new System.Drawing.Point(12, 12); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; @@ -304,7 +229,7 @@ private void InitializeComponent() this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(317, 268); this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Mart"; + this.tabPage1.Text = "Poké Mart"; this.tabPage1.UseVisualStyleBackColor = true; // // tabPage2 @@ -320,19 +245,6 @@ private void InitializeComponent() this.tabPage2.Text = "BP Items"; this.tabPage2.UseVisualStyleBackColor = true; // - // tabPage3 - // - this.tabPage3.Controls.Add(this.dgvmv); - this.tabPage3.Controls.Add(this.label2); - this.tabPage3.Controls.Add(this.CB_LocationBPMove); - this.tabPage3.Location = new System.Drawing.Point(4, 22); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(317, 268); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "Tutors"; - this.tabPage3.UseVisualStyleBackColor = true; - // // MartEditor7UU // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -349,14 +261,11 @@ private void InitializeComponent() this.Text = "Mart Editor"; ((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvbp)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.dgvmv)).EndInit(); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); - this.tabPage3.ResumeLayout(false); - this.tabPage3.PerformLayout(); this.ResumeLayout(false); } @@ -377,15 +286,8 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn dgvIndexBP; private System.Windows.Forms.DataGridViewComboBoxColumn dgvItemBP; private System.Windows.Forms.DataGridViewTextBoxColumn dgvPriceBP; - private System.Windows.Forms.DataGridView dgvmv; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox CB_LocationBPMove; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.TabPage tabPage3; - private System.Windows.Forms.DataGridViewTextBoxColumn dgvmvIndex; - private System.Windows.Forms.DataGridViewComboBoxColumn dgvmvMove; - private System.Windows.Forms.DataGridViewTextBoxColumn dgvmvBP; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.cs b/pk3DS/Subforms/Gen7/MartEditor7UU.cs index 54ad1bde0e..049d99c539 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.cs @@ -30,10 +30,8 @@ public MartEditor7UU() setupDGV(); foreach (string s in locations) CB_Location.Items.Add(s); foreach (string s in locationsBP) CB_LocationBPItem.Items.Add(s); - foreach (string s in locationsTutor) CB_LocationBPMove.Items.Add(s); CB_Location.SelectedIndex = - CB_LocationBPItem.SelectedIndex = - CB_LocationBPMove.SelectedIndex = 0; + CB_LocationBPItem.SelectedIndex = 0; } private const int ofs_Item = 0x50BC; @@ -83,21 +81,12 @@ public MartEditor7UU() "Battle Tree [Mega Stones]", "Beaches [Medicine]" }; - - private readonly string[] locationsTutor = - { - "Big Wave Beach", - "Heahea Beach", - "Ula'ula Beach", - "Battle Tree", - }; #endregion private void B_Save_Click(object sender, EventArgs e) { if (entryItem > -1) setListItem(); if (entryBPItem > -1) setListBPItem(); - if (entryBPMove > -1) setListBPMove(); File.WriteAllBytes(CROPath, data); Close(); } @@ -110,8 +99,6 @@ private void setupDGV() dgvItem.Items.Add(t); // add only the Names foreach (string t in itemlist) dgvItemBP.Items.Add(t); // add only the Names - foreach (string t in movelist) - dgvmvMove.Items.Add(t); // add only the Names } private int entryItem = -1; @@ -131,13 +118,6 @@ private void changeIndexBPItem(object sender, EventArgs e) entryBPItem = CB_LocationBPItem.SelectedIndex; getListBPItem(); } - - private void changeIndexBPMove(object sender, EventArgs e) - { - if (entryBPMove > -1) setListBPMove(); - entryBPMove = CB_LocationBPMove.SelectedIndex; - getListBPMove(); - } private void getListItem() { @@ -166,20 +146,6 @@ private void getListBPItem() } } - private void getListBPMove() - { - dgvmv.Rows.Clear(); - int count = len_BPTutor[entryBPMove]; - dgvmv.Rows.Add(count); - var ofs = ofs_BPTutor + (len_BPTutor.Take(entryBPMove).Sum(z => z) * 4); - for (int i = 0; i < count; i++) - { - dgvmv.Rows[i].Cells[0].Value = i.ToString(); - dgvmv.Rows[i].Cells[1].Value = movelist[BitConverter.ToUInt16(data, ofs + (4 * i))]; - dgvmv.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, ofs + (4 * i) + 2).ToString(); - } - } - private void setListItem() { int count = dgv.Rows.Count; @@ -202,20 +168,6 @@ private void setListBPItem() } } - private void setListBPMove() - { - int count = dgvmv.Rows.Count; - var ofs = ofs_BPTutor + (len_BPTutor.Take(entryBPMove).Sum(z => z) * 4); - for (int i = 0; i < count; i++) - { - int item = Array.IndexOf(movelist, dgvmv.Rows[i].Cells[1].Value); - Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, ofs + (4 * i), 2); - int price; string p = dgvmv.Rows[i].Cells[2].Value.ToString(); - if (int.TryParse(p, out price)) - Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, ofs + (4 * i) + 2, 2); - } - } - private void B_Randomize_Click(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) @@ -226,9 +178,6 @@ private void B_Randomize_Click(object sender, EventArgs e) case 1: RandomizeBPItems(); break; - default: - WinFormsUtil.Alert("Not implemented"); - break; } } diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.resx b/pk3DS/Subforms/Gen7/MartEditor7UU.resx index 88ba2a3377..2a2ca52b7d 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.resx +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.resx @@ -132,13 +132,13 @@ True - + True - + True - + True \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/TutorEditor7.Designer.cs b/pk3DS/Subforms/Gen7/TutorEditor7.Designer.cs new file mode 100644 index 0000000000..7b0ddb9b9f --- /dev/null +++ b/pk3DS/Subforms/Gen7/TutorEditor7.Designer.cs @@ -0,0 +1,205 @@ +namespace pk3DS +{ + partial class TutorEditor7 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + this.B_Randomize = new System.Windows.Forms.Button(); + this.B_Save = new System.Windows.Forms.Button(); + this.B_Cancel = new System.Windows.Forms.Button(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.CB_LocationBPMove = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.dgvmv = new System.Windows.Forms.DataGridView(); + this.dgvmvBP = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgvmvMove = new System.Windows.Forms.DataGridViewComboBoxColumn(); + this.dgvmvIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvmv)).BeginInit(); + this.tabControl1.SuspendLayout(); + this.SuspendLayout(); + // + // B_Randomize + // + this.B_Randomize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.B_Randomize.Location = new System.Drawing.Point(12, 493); + this.B_Randomize.Name = "B_Randomize"; + this.B_Randomize.Size = new System.Drawing.Size(87, 23); + this.B_Randomize.TabIndex = 3; + this.B_Randomize.Text = "Randomize"; + this.B_Randomize.UseVisualStyleBackColor = true; + this.B_Randomize.Click += new System.EventHandler(this.B_Randomize_Click); + // + // B_Save + // + this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Save.Location = new System.Drawing.Point(265, 493); + this.B_Save.Name = "B_Save"; + this.B_Save.Size = new System.Drawing.Size(68, 23); + this.B_Save.TabIndex = 4; + this.B_Save.Text = "Save"; + this.B_Save.UseVisualStyleBackColor = true; + this.B_Save.Click += new System.EventHandler(this.B_Save_Click); + // + // B_Cancel + // + this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Cancel.Location = new System.Drawing.Point(191, 493); + this.B_Cancel.Name = "B_Cancel"; + this.B_Cancel.Size = new System.Drawing.Size(68, 23); + this.B_Cancel.TabIndex = 5; + this.B_Cancel.Text = "Cancel"; + this.B_Cancel.UseVisualStyleBackColor = true; + this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.dgvmv); + this.tabPage3.Controls.Add(this.label2); + this.tabPage3.Controls.Add(this.CB_LocationBPMove); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(317, 446); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Move Tutors"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // CB_LocationBPMove + // + this.CB_LocationBPMove.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.CB_LocationBPMove.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_LocationBPMove.FormattingEnabled = true; + this.CB_LocationBPMove.Location = new System.Drawing.Point(60, 3); + this.CB_LocationBPMove.Name = "CB_LocationBPMove"; + this.CB_LocationBPMove.Size = new System.Drawing.Size(254, 21); + this.CB_LocationBPMove.TabIndex = 11; + this.CB_LocationBPMove.SelectedIndexChanged += new System.EventHandler(this.changeIndexBPMove); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 6); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(51, 13); + this.label2.TabIndex = 12; + this.label2.Text = "Location:"; + // + // dgvmv + // + this.dgvmv.AllowUserToAddRows = false; + this.dgvmv.AllowUserToDeleteRows = false; + this.dgvmv.AllowUserToResizeColumns = false; + this.dgvmv.AllowUserToResizeRows = false; + this.dgvmv.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dgvmv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvmv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dgvmvIndex, + this.dgvmvMove, + this.dgvmvBP}); + this.dgvmv.Location = new System.Drawing.Point(0, 27); + this.dgvmv.Name = "dgvmv"; + this.dgvmv.Size = new System.Drawing.Size(317, 419); + this.dgvmv.TabIndex = 14; + // + // dgvmvBP + // + this.dgvmvBP.HeaderText = "Price"; + this.dgvmvBP.MaxInputLength = 3; + this.dgvmvBP.Name = "dgvmvBP"; + this.dgvmvBP.Width = 65; + // + // dgvmvMove + // + this.dgvmvMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.dgvmvMove.HeaderText = "Move"; + this.dgvmvMove.Name = "dgvmvMove"; + this.dgvmvMove.Width = 135; + // + // dgvmvIndex + // + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dgvmvIndex.DefaultCellStyle = dataGridViewCellStyle7; + this.dgvmvIndex.HeaderText = "Index"; + this.dgvmvIndex.MaxInputLength = 3; + this.dgvmvIndex.Name = "dgvmvIndex"; + this.dgvmvIndex.ReadOnly = true; + this.dgvmvIndex.Width = 45; + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Location = new System.Drawing.Point(12, 12); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(325, 472); + this.tabControl1.TabIndex = 15; + // + // TutorEditor7 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(344, 528); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.B_Cancel); + this.Controls.Add(this.B_Save); + this.Controls.Add(this.B_Randomize); + this.MaximizeBox = false; + this.MinimumSize = new System.Drawing.Size(360, 300); + this.Name = "TutorEditor7"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Tutor Editor"; + this.tabPage3.ResumeLayout(false); + this.tabPage3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvmv)).EndInit(); + this.tabControl1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Button B_Randomize; + private System.Windows.Forms.Button B_Save; + private System.Windows.Forms.Button B_Cancel; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.DataGridView dgvmv; + private System.Windows.Forms.DataGridViewTextBoxColumn dgvmvIndex; + private System.Windows.Forms.DataGridViewComboBoxColumn dgvmvMove; + private System.Windows.Forms.DataGridViewTextBoxColumn dgvmvBP; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox CB_LocationBPMove; + private System.Windows.Forms.TabControl tabControl1; + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/TutorEditor7.cs b/pk3DS/Subforms/Gen7/TutorEditor7.cs new file mode 100644 index 0000000000..0f560d957f --- /dev/null +++ b/pk3DS/Subforms/Gen7/TutorEditor7.cs @@ -0,0 +1,103 @@ +using pk3DS.Core; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Windows.Forms; + +namespace pk3DS +{ + public partial class TutorEditor7 : Form + { + private readonly string CROPath = Path.Combine(Main.RomFSPath, "Shop.cro"); + + public TutorEditor7() + { + if (!File.Exists(CROPath)) + { + WinFormsUtil.Error("CRO does not exist! Closing.", CROPath); + Close(); + } + InitializeComponent(); + + + data = File.ReadAllBytes(CROPath); + len_BPTutor = data.Skip(0x52D2).Take(4).ToArray(); + + setupDGV(); + foreach (string s in locationsTutor) CB_LocationBPMove.Items.Add(s); + CB_LocationBPMove.SelectedIndex = 0; + } + + private const int ofs_BPTutor = 0x54DE; + private readonly byte[] len_BPTutor; + + private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); + private readonly byte[] data; + + private readonly string[] locationsTutor = + { + "Big Wave Beach", + "Heahea Beach", + "Ula'ula Beach", + "Battle Tree", + }; + + private void B_Save_Click(object sender, EventArgs e) + { + if (entryBPMove > -1) setListBPMove(); + File.WriteAllBytes(CROPath, data); + Close(); + } + + private void B_Cancel_Click(object sender, EventArgs e) => Close(); + + private void setupDGV() + { + foreach (string t in movelist) + dgvmvMove.Items.Add(t); // add only the Names + } + + private int entryBPMove = -1; + + private void changeIndexBPMove(object sender, EventArgs e) + { + if (entryBPMove > -1) setListBPMove(); + entryBPMove = CB_LocationBPMove.SelectedIndex; + getListBPMove(); + } + + private void getListBPMove() + { + dgvmv.Rows.Clear(); + int count = len_BPTutor[entryBPMove]; + dgvmv.Rows.Add(count); + var ofs = ofs_BPTutor + (len_BPTutor.Take(entryBPMove).Sum(z => z) * 4); + for (int i = 0; i < count; i++) + { + dgvmv.Rows[i].Cells[0].Value = i.ToString(); + dgvmv.Rows[i].Cells[1].Value = movelist[BitConverter.ToUInt16(data, ofs + (4 * i))]; + dgvmv.Rows[i].Cells[2].Value = BitConverter.ToUInt16(data, ofs + (4 * i) + 2).ToString(); + } + } + + private void setListBPMove() + { + int count = dgvmv.Rows.Count; + var ofs = ofs_BPTutor + (len_BPTutor.Take(entryBPMove).Sum(z => z) * 4); + for (int i = 0; i < count; i++) + { + int item = Array.IndexOf(movelist, dgvmv.Rows[i].Cells[1].Value); + Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, ofs + (4 * i), 2); + int price; string p = dgvmv.Rows[i].Cells[2].Value.ToString(); + if (int.TryParse(p, out price)) + Array.Copy(BitConverter.GetBytes((ushort)price), 0, data, ofs + (4 * i) + 2, 2); + } + } + + private void B_Randomize_Click(object sender, EventArgs e) + { + WinFormsUtil.Alert("Not currently implemented."); + } + } +} diff --git a/pk3DS/Subforms/Gen7/TutorEditor7.resx b/pk3DS/Subforms/Gen7/TutorEditor7.resx new file mode 100644 index 0000000000..059ea06bd3 --- /dev/null +++ b/pk3DS/Subforms/Gen7/TutorEditor7.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/pk3DS/pk3DS.csproj b/pk3DS/pk3DS.csproj index c6af6503bd..a9fde95fa4 100644 --- a/pk3DS/pk3DS.csproj +++ b/pk3DS/pk3DS.csproj @@ -80,6 +80,12 @@ MartEditor7UU.cs + + Form + + + TutorEditor7.cs + @@ -455,6 +461,9 @@ TMEditor7.cs + + TutorEditor7.cs + TypeChart7.cs From 4ac6681c82c628812ecb6bf5b17f404b62bc83aa Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 20 Sep 2018 16:01:27 -0700 Subject: [PATCH 131/191] Check for moved exefs file user moving exe folder causes directory.exists to fail, falling back to file IO since the exefs path no longer exists, the file doesn't exist, causing an error --- pk3DS.Core/Structures/Scripts.cs | 16 ++++++++-------- pk3DS/Main.cs | 3 +++ pk3DS/Subforms/Gen6/MaisonEditor6.cs | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pk3DS.Core/Structures/Scripts.cs b/pk3DS.Core/Structures/Scripts.cs index 6846da5d3d..95b8f9adc2 100644 --- a/pk3DS.Core/Structures/Scripts.cs +++ b/pk3DS.Core/Structures/Scripts.cs @@ -12,7 +12,7 @@ public static class Scripts internal static byte[] decompressScript(byte[] data) { data = data ?? new byte[0]; // Bad Input - + using (MemoryStream mn = new MemoryStream()) using (BinaryWriter bw = new BinaryWriter(mn)) { @@ -92,7 +92,7 @@ internal static uint[] quickDecompress(byte[] data, int count) uint[] code = new uint[count]; uint i = 0, j = 0, x = 0, f = 0; while (i < code.Length) { - int b = data[f++], + int b = data[f++], v = b & 0x7F; if (++j == 1) // sign extension possible x = (uint)((((v >> 6 == 0 ? 1 : 0) - 1) << 6) | v); // only for bit6 being set @@ -248,7 +248,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // Peek at next value var next = (int)cmd[i++]; // Check Value against negative and zero... ? - + op = eA(c, next); break; } @@ -266,7 +266,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // Peek at next value var next = (int)cmd[i++]; // Check Value against negative... ? - + op = eA(c, next); break; } @@ -406,7 +406,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) { var next = (int)cmd[i++]; // No sanity check needed - + op = eA(c, next); break; } @@ -430,7 +430,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var delta = (int)cmd[i++]; // sanity check range... // negative.. weird - + int newOfs = (line * 4) + delta; op = $"{Commands[c]} => 0x{newOfs:X4} ({delta})"; break; @@ -448,7 +448,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var jOffset = (i * 4) - 4; // todo: this may be the correct jump start point... var count = cmd[i++]; // switch case table // sanity check - + // Populate If-Case Tree var tree = new List(); @@ -650,7 +650,7 @@ internal static string eF(uint c, params uint[] arr) string parameters = arr.Length == 1 ? "" : string.Join(", ", arr.Select(z => getFloat(z))); return $"{cmd}({parameters})"; } - + internal static readonly Dictionary Commands = new Dictionary {// { 0x00, "$00" }, // Invalid Code { 0x01, "$01" }, diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 1d0db698ab..a728f61e60 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -155,6 +155,9 @@ private void openQuick(string path) if (!Directory.Exists(path)) // File { + if (!File.Exists(path)) + return; + FileInfo fi = new FileInfo(path); if (fi.Name.Contains("code.bin")) // Compress/Decompress .code.bin { diff --git a/pk3DS/Subforms/Gen6/MaisonEditor6.cs b/pk3DS/Subforms/Gen6/MaisonEditor6.cs index 4c48dd469b..027f470b79 100644 --- a/pk3DS/Subforms/Gen6/MaisonEditor6.cs +++ b/pk3DS/Subforms/Gen6/MaisonEditor6.cs @@ -19,7 +19,7 @@ public MaisonEditor6(byte[][] trd, byte[][] trp, bool super) pkFiles = trp; Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); movelist[0] = specieslist[0] = itemlist[0] = ""; - + trNames = Main.Config.getText(super ? TextName.SuperTrainerNames : TextName.MaisonTrainerNames); Array.Resize(ref trNames, trFiles.Length); InitializeComponent(); From 3cf894bdbf01451c7368b12e77df36b016eaaad2 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 23 Sep 2018 19:38:47 -0400 Subject: [PATCH 132/191] Add full HM compatiblity mod (#381) --- pk3DS/Subforms/Gen6/GiftEditor6.cs | 1 + .../Subforms/Gen6/PersonalEditor6.Designer.cs | 33 +++++++++++++------ pk3DS/Subforms/Gen6/PersonalEditor6.cs | 4 +++ pk3DS/Subforms/Gen7/MartEditor7UU.cs | 1 - pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 8 +++++ 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 567db08741..803d3908aa 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -267,6 +267,7 @@ private void B_RandAll_Click(object sender, EventArgs e) NUD_Form.Value = formrand.GetRandomForme(species); CB_Gender.SelectedIndex = 0; // random CB_Nature.SelectedIndex = 0; // random + NUD_IV0.Value = NUD_IV1.Value = NUD_IV2.Value = NUD_IV3.Value = NUD_IV4.Value = NUD_IV5.Value = -1; // random if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex)) && NUD_Form.Value != 0) NUD_Form.Value = 0; // don't allow mega gifts to be form 1 diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs index debe636655..186cfcd24f 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs @@ -32,6 +32,7 @@ private void InitializeComponent() this.L_Species_Precursor = new System.Windows.Forms.Label(); this.TC_Pokemon = new System.Windows.Forms.TabControl(); this.TP_General = new System.Windows.Forms.TabPage(); + this.TB_RawColor = new System.Windows.Forms.TextBox(); this.L_HiddenAbility = new System.Windows.Forms.Label(); this.L_Ability2 = new System.Windows.Forms.Label(); this.L_Ability1 = new System.Windows.Forms.Label(); @@ -148,7 +149,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.TB_RawColor = new System.Windows.Forms.TextBox(); + this.CHK_FullHMCompatibility = new System.Windows.Forms.CheckBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -275,6 +276,16 @@ private void InitializeComponent() this.TP_General.Text = "General Info"; this.TP_General.UseVisualStyleBackColor = true; // + // TB_RawColor + // + this.TB_RawColor.Location = new System.Drawing.Point(229, 209); + this.TB_RawColor.Name = "TB_RawColor"; + this.TB_RawColor.ReadOnly = true; + this.TB_RawColor.Size = new System.Drawing.Size(30, 20); + this.TB_RawColor.TabIndex = 419; + this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_RawColor.Visible = false; + // // L_HiddenAbility // this.L_HiddenAbility.AutoSize = true; @@ -1037,6 +1048,7 @@ private void InitializeComponent() // // GB_Modifier // + this.GB_Modifier.Controls.Add(this.CHK_FullHMCompatibility); this.GB_Modifier.Controls.Add(this.CHK_NoTutor); this.GB_Modifier.Controls.Add(this.CHK_CatchRateMod); this.GB_Modifier.Controls.Add(this.L_CatchRateMod); @@ -1049,7 +1061,7 @@ private void InitializeComponent() this.GB_Modifier.Controls.Add(this.CHK_NoEV); this.GB_Modifier.Location = new System.Drawing.Point(4, 147); this.GB_Modifier.Name = "GB_Modifier"; - this.GB_Modifier.Size = new System.Drawing.Size(345, 129); + this.GB_Modifier.Size = new System.Drawing.Size(345, 152); this.GB_Modifier.TabIndex = 419; this.GB_Modifier.TabStop = false; this.GB_Modifier.Text = "Modifier Options"; @@ -1523,15 +1535,15 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // TB_RawColor + // CHK_FullHMCompatibility // - this.TB_RawColor.Location = new System.Drawing.Point(229, 209); - this.TB_RawColor.Name = "TB_RawColor"; - this.TB_RawColor.ReadOnly = true; - this.TB_RawColor.Size = new System.Drawing.Size(30, 20); - this.TB_RawColor.TabIndex = 419; - this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.TB_RawColor.Visible = false; + this.CHK_FullHMCompatibility.AutoSize = true; + this.CHK_FullHMCompatibility.Location = new System.Drawing.Point(6, 127); + this.CHK_FullHMCompatibility.Name = "CHK_FullHMCompatibility"; + this.CHK_FullHMCompatibility.Size = new System.Drawing.Size(123, 17); + this.CHK_FullHMCompatibility.TabIndex = 21; + this.CHK_FullHMCompatibility.Text = "Full HM Compatibility"; + this.CHK_FullHMCompatibility.UseVisualStyleBackColor = true; // // PersonalEditor6 // @@ -1694,5 +1706,6 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Ability2; private System.Windows.Forms.Label L_Ability1; private System.Windows.Forms.TextBox TB_RawColor; + private System.Windows.Forms.CheckBox CHK_FullHMCompatibility; } } diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index 0f963ee29e..784b91d1a2 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -400,6 +400,10 @@ private void B_ModifyAll(object sender, EventArgs e) CLB_ORASTutors.SetItemCheckState(ao, CheckState.Unchecked); } + if (CHK_FullHMCompatibility.Checked) + for (int h = 100; h < CLB_TMHM.Items.Count; h++) + CLB_TMHM.SetItemCheckState(h, CheckState.Checked); + if (CHK_QuickHatch.Checked) TB_HatchCycles.Text = 1.ToString(); if (CHK_CatchRateMod.Checked) diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.cs b/pk3DS/Subforms/Gen7/MartEditor7UU.cs index 049d99c539..ab9fd82ef2 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.cs @@ -103,7 +103,6 @@ private void setupDGV() private int entryItem = -1; private int entryBPItem = -1; - private int entryBPMove = -1; private void changeIndexItem(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 6804969040..aa98ba2678 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -666,6 +666,13 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) t.Species = FinalEvo[randFinalEvo()]; + if (t.IV3) + t.IVs = new[] { -4, -1, -1, -1, -1, -1 }; // random with IV3 flag + else + t.IVs = new[] { -1, -1, -1, -1, -1, -1 }; // random + + t.EVs = new[] { 0, 0, 0, 0, 0, 0 }; // reset EVs + t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); t.Gender = 0; // random t.Nature = 0; // random @@ -697,6 +704,7 @@ private void B_RandAll_Click(object sender, EventArgs e) t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); t.Nature = (int)(Util.rnd32() % CB_TNature.Items.Count); // randomly selected + t.IVs = new[] { -1, -1, -1, -1, -1, -1 }; // random } GetListBoxEntries(); From 46f4c74c381c2a5fe37b8a83dce7b78eb46e220f Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 10 Oct 2018 14:54:04 -0400 Subject: [PATCH 133/191] Misc updates --- pk3DS.Core/Legality/Legal.cs | 141 ++++++++++++++---- pk3DS/Subforms/Gen6/GiftEditor6.cs | 11 +- pk3DS/Subforms/Gen6/RSTE.cs | 2 +- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 14 +- pk3DS/Subforms/Gen6/TrainerRand.cs | 6 + pk3DS/Subforms/Gen7/SMTE.Designer.cs | 40 ++--- pk3DS/Subforms/Gen7/SMTE.cs | 26 +--- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 19 ++- 8 files changed, 167 insertions(+), 92 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index bf0aadced5..e9f01feef5 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -383,55 +383,134 @@ public static partial class Legal { 722, 725, 728, 731, 736, 761, 782, 789 }).ToArray(); - - /// - /// All final evolutions, excluding Event-exclusive Forms that do not evolve (Pikachu, Floette, etc). Used for forcing fully evolved species. - /// Overrides all other randomizer settings, allowing all Generations and Legendary/Mythical Pokemon as well. - /// + public static readonly int[] FinalEvolutions_6 = { 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, 091, - 094, 097, 099, 101, 103, 105, 106, 107, 110, 115, 119, 121, 122, 124, 127, 128, 130, 131, 132, 134, 135, 136, 139, 141, 142, 143, 144, 145, 146, 149, 150, 151, 154, 157, 160, 162, 164, - 166, 168, 169, 171, 178, 181, 182, 184, 185, 186, 189, 192, 195, 196, 197, 199, 201, 202, 203, 205, 206, 208, 210, 211, 212, 213, 214, 217, 219, 222, 224, 225, 226, 227, 229, 230, 232, - 234, 235, 237, 241, 242, 243, 244, 245, 248, 249, 250, 251, 254, 257, 260, 262, 264, 267, 269, 272, 275, 277, 279, 282, 284, 286, 289, 291, 292, 295, 297, 301, 302, 303, 306, 308, 310, - 311, 312, 313, 314, 317, 319, 321, 323, 324, 326, 327, 330, 332, 334, 335, 336, 337, 338, 340, 342, 344, 346, 348, 350, 351, 352, 354, 357, 358, 359, 362, 365, 367, 368, 369, 370, 373, - 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 389, 392, 395, 398, 400, 402, 405, 407, 409, 411, 413, 414, 416, 417, 419, 421, 423, 424, 426, 428, 429, 430, 432, 435, 437, 441, - 442, 445, 448, 450, 452, 454, 455, 457, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, - 489, 490, 491, 492, 493, 494, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, 561, - 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, 635, - 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, - 702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, 719, 720, 721 + 094, 097, 099, 101, 103, 105, 106, 107, 110, 115, 119, 121, 122, 124, 127, 128, 130, 131, 132, 134, 135, 136, 139, 141, 142, 143, 149, 154, 157, 160, 162, 164, 166, 168, 169, 171, 178, + 181, 182, 184, 185, 186, 189, 192, 195, 196, 197, 199, 201, 202, 203, 205, 206, 208, 210, 211, 212, 213, 214, 217, 219, 222, 224, 225, 226, 227, 229, 230, 232, 234, 235, 237, 241, 242, + 248, 254, 257, 260, 262, 264, 267, 269, 272, 275, 277, 279, 282, 284, 286, 289, 291, 292, 295, 297, 301, 302, 303, 306, 308, 310, 311, 312, 313, 314, 317, 319, 321, 323, 324, 326, 327, + 330, 332, 334, 335, 336, 337, 338, 340, 342, 344, 346, 348, 350, 351, 352, 354, 357, 358, 359, 362, 365, 367, 368, 369, 370, 373, 376, 389, 392, 395, 398, 400, 402, 405, 407, 409, 411, + 413, 414, 416, 417, 419, 421, 423, 424, 426, 428, 429, 430, 432, 435, 437, 441, 442, 445, 448, 450, 452, 454, 455, 457, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 476, 477, 478, 479, 497, 500, 503, 505, 508, 510, 512, 514, 516, 518, 521, 523, 526, 528, 530, 531, 534, 537, 538, 539, 542, 545, 547, 549, 550, 553, 555, 556, 558, 560, + 561, 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, + 635, 637, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, 702, 703, 706, 707, 709, 711, 713, 715, + }; + + public static readonly int[] FinalEvolutions_7 = FinalEvolutions_6.Concat(new int[] + { + 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 774, 775, 776, 777, 779, 780, 781, 784, + }).ToArray(); + + public static readonly int[] Legendary_6 = + { + #region Legendary + 144, // Articuno + 145, // Zapdos + 146, // Moltres + 150, // Mewtwo + 243, // Raikou + 244, // Entei + 245, // Suicune + 249, // Lugia + 250, // Ho-Oh + 377, // Regirock + 378, // Regice + 379, // Registeel + 380, // Latias + 381, // Latios + 382, // Kyogre + 383, // Groudon + 384, // Rayquaza + 480, // Uxie + 481, // Mesprit + 482, // Azelf + 483, // Dialga + 484, // Palkia + 485, // Heatran + 486, // Regigigas + 487, // Giratina + 488, // Cresselia + 638, // Cobalion + 639, // Terrakion + 640, // Virizion + 641, // Tornadus + 642, // Thundurus + 643, // Reshiram + 644, // Zekrom + 645, // Landorus + 646, // Kyurem + 716, // Xerneas + 717, // Yveltal + 718, // Zygarde + #endregion }; - public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[] + public static readonly int[] Legendary_SM = Legendary_6.Concat(new int[] { - 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787, - 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802 + #region Legendary + 773, // Silvally + 785, // Tapu Koko + 786, // Tapu Lele + 787, // Tapu Bulu + 788, // Tapu Fini + 791, // Solgaleo + 792, // Lunala + 793, // Nihilego + 794, // Buzzwole + 795, // Pheromosa + 796, // Xurkitree + 797, // Celesteela + 798, // Kartana + 799, // Guzzlord + 800, // Necrozma + #endregion }).ToArray(); - public static readonly int[] FinalEvolutions_USUM = FinalEvolutions_SM.Concat(new int[] + public static readonly int[] Legendary_USUM = Legendary_SM.Concat(new int[] { - 804, 805, 806, 807 + #region Legendary + 804, // Naganadel + 805, // Stakataka + 806, // Blacephalon + #endregion }).ToArray(); - /// - /// All Legendary and Mythical Pokemon. Used for Legendary-for-Legendary replacement. - /// Does not include un-evolved species in the array due to potential error with Force Fully Evolved. - /// - public static readonly int[] Legendary_Mythical_6 = + public static readonly int[] Mythical_6 = { - 144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638, - 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721 + #region Mythical + 151, // Mew + 251, // Celebi + 385, // Jirachi + 386, // Deoxys + 489, // Phione + 490, // Manaphy + 491, // Darkrai + 492, // Shaymin + 493, // Arceus + 494, // Victini + 647, // Keldeo + 648, // Meloetta + 649, // Genesect + 719, // Diancie + 720, // Hoopa + 721, // Volcanion + #endregion }; - public static readonly int[] Legendary_Mythical_SM = Legendary_Mythical_6.Concat(new int[] + public static readonly int[] Mythical_SM = Mythical_6.Concat(new int[] { - 773, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802 + #region Mythical + 801, // Magearna + 802, // Marshadow + #endregion }).ToArray(); - public static readonly int[] Legendary_Mythical_USUM = Legendary_Mythical_SM.Concat(new int[] + public static readonly int[] Mythical_USUM = Mythical_SM.Concat(new int[] { - 804, 805, 806, 807 + #region Mythical + 807, // Zeraora + #endregion }).ToArray(); public static readonly HashSet BattleForms = new HashSet diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 803d3908aa..2278b07a95 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -59,7 +59,9 @@ public static Dictionary GetMegaDictionary(GameConfig config) private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); private readonly string[] natureslist = Main.Config.getText(TextName.Natures); private readonly Dictionary MegaDictionary; - private static int[] FinalEvo; + private static int[] FinalEvo = Legal.FinalEvolutions_6; + private static int[] Legendary = Legal.Legendary_6; + private static int[] Mythical = Legal.Mythical_6; private readonly string[] ability = { @@ -99,8 +101,6 @@ private void loadData() CB_Gender.Items.Add("♂ / Male"); CB_Gender.Items.Add("♀ / Female"); - FinalEvo = Legal.FinalEvolutions_6; - loaded = true; LB_Gifts.SelectedIndex = 0; } @@ -224,6 +224,11 @@ private void B_RandAll_Click(object sender, EventArgs e) rBST = CHK_BST.Checked, }; specrand.Initialize(); + + // add Legendary/Mythical to final evolutions if checked + if (CHK_L.Checked) FinalEvo = FinalEvo.Concat(Legendary).ToArray(); + if (CHK_E.Checked) FinalEvo = FinalEvo.Concat(Mythical).ToArray(); + var helditems = Randomizer.getRandomItemList(); for (int i = 0; i < LB_Gifts.Items.Count; i++) { diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 60a0006cf9..719bf713ae 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -452,7 +452,7 @@ private void Setup() public static int rDMGCount, rSTABCount; private int[] mEvoTypes; private static int[] rModelRestricted; - private static int[] rFinalEvo; + public static int[] rFinalEvo; private string[] rImportant; private readonly List Tags = new List(); private readonly Dictionary TagTypes = new Dictionary(); diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 2079850b22..1ccec39b83 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -43,8 +43,10 @@ public StaticEncounterEditor6() private EncounterStatic6[] EncounterData; private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); - private static int[] FinalEvo; - private static int[] ReplaceLegend; + private static int[] FinalEvo = Legal.FinalEvolutions_6; + private static int[] Legendary = Legal.Legendary_6; + private static int[] Mythical = Legal.Mythical_6; + private static int[] ReplaceLegend = Legendary.Concat(Mythical).ToArray(); private readonly string[] ability = { @@ -84,9 +86,6 @@ private void LoadData() CB_Gender.Items.Add("♂ / Male"); CB_Gender.Items.Add("♀ / Female"); - FinalEvo = Legal.FinalEvolutions_6; - ReplaceLegend = Legal.Legendary_Mythical_6; - loaded = true; LB_Encounters.SelectedIndex = 0; } @@ -170,6 +169,11 @@ private void B_RandAll_Click(object sender, EventArgs e) rBST = CHK_BST.Checked, }; specrand.Initialize(); + + // add Legendary/Mythical to final evolutions if checked + if (CHK_L.Checked) FinalEvo = FinalEvo.Concat(Legendary).ToArray(); + if (CHK_E.Checked) FinalEvo = FinalEvo.Concat(Mythical).ToArray(); + var items = Randomizer.getRandomItemList(); for (int i = 0; i < LB_Encounters.Items.Count; i++) { diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index 440b77af88..e02204feee 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -23,6 +23,8 @@ public TrainerRand() private readonly string[] trName = Main.Config.getText(TextName.TrainerNames); private readonly string[] trClass = Main.Config.getText(TextName.TrainerClasses); private readonly List trClassnorep; + private static int[] Legendary = Legal.Legendary_6; + private static int[] Mythical = Legal.Mythical_6; private void B_Close_Click(object sender, EventArgs e) { @@ -111,6 +113,10 @@ private void B_Save_Click(object sender, EventArgs e) }; RSTE.rSpeciesRand.Initialize(); + // add Legendary/Mythical to final evolutions if checked + if (CHK_L.Checked) RSTE.rFinalEvo = RSTE.rFinalEvo.Concat(Legendary).ToArray(); + if (CHK_E.Checked) RSTE.rFinalEvo = RSTE.rFinalEvo.Concat(Mythical).ToArray(); + RSTE.rDoRand = true; RandSettings.SetFormSettings(this, Controls); Close(); diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 1730d7e118..d88159d224 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -179,7 +179,6 @@ private void InitializeComponent() this.CHK_STAB = new System.Windows.Forms.CheckBox(); this.Tab_Trainer1 = new System.Windows.Forms.TabPage(); this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); - this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); this.CHK_6PKM = new System.Windows.Forms.CheckBox(); this.NUD_ForceFullyEvolved = new System.Windows.Forms.NumericUpDown(); this.L_MinPKM = new System.Windows.Forms.Label(); @@ -1977,7 +1976,6 @@ private void InitializeComponent() // Tab_Trainer1 // this.Tab_Trainer1.Controls.Add(this.CHK_ReplaceMega); - this.Tab_Trainer1.Controls.Add(this.CHK_ReplaceLegend); this.Tab_Trainer1.Controls.Add(this.CHK_6PKM); this.Tab_Trainer1.Controls.Add(this.NUD_ForceFullyEvolved); this.Tab_Trainer1.Controls.Add(this.L_MinPKM); @@ -2002,31 +2000,18 @@ private void InitializeComponent() this.CHK_ReplaceMega.AutoSize = true; this.CHK_ReplaceMega.Checked = true; this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceMega.Location = new System.Drawing.Point(6, 121); + this.CHK_ReplaceMega.Location = new System.Drawing.Point(6, 118); this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; this.CHK_ReplaceMega.Size = new System.Drawing.Size(196, 17); this.CHK_ReplaceMega.TabIndex = 343; this.CHK_ReplaceMega.Text = "Ensure Post-Game Mega Evolutions"; this.CHK_ReplaceMega.UseVisualStyleBackColor = true; // - // CHK_ReplaceLegend - // - this.CHK_ReplaceLegend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CHK_ReplaceLegend.AutoSize = true; - this.CHK_ReplaceLegend.Checked = true; - this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 44); - this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; - this.CHK_ReplaceLegend.Size = new System.Drawing.Size(257, 17); - this.CHK_ReplaceLegend.TabIndex = 342; - this.CHK_ReplaceLegend.Text = "Team Rainbow Rocket Legendary-for-Legendary"; - this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; - // // CHK_6PKM // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(6, 107); + this.CHK_6PKM.Location = new System.Drawing.Point(6, 104); this.CHK_6PKM.Name = "CHK_6PKM"; this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 341; @@ -2035,7 +2020,7 @@ private void InitializeComponent() // // NUD_ForceFullyEvolved // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 77); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 74); this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { 1, 0, @@ -2052,7 +2037,7 @@ private void InitializeComponent() // // L_MinPKM // - this.L_MinPKM.Location = new System.Drawing.Point(191, 0); + this.L_MinPKM.Location = new System.Drawing.Point(191, 3); this.L_MinPKM.Name = "L_MinPKM"; this.L_MinPKM.Size = new System.Drawing.Size(60, 20); this.L_MinPKM.TabIndex = 338; @@ -2061,7 +2046,7 @@ private void InitializeComponent() // // L_MaxPKM // - this.L_MaxPKM.Location = new System.Drawing.Point(191, 21); + this.L_MaxPKM.Location = new System.Drawing.Point(191, 24); this.L_MaxPKM.Name = "L_MaxPKM"; this.L_MaxPKM.Size = new System.Drawing.Size(60, 20); this.L_MaxPKM.TabIndex = 337; @@ -2070,7 +2055,7 @@ private void InitializeComponent() // // NUD_RMin // - this.NUD_RMin.Location = new System.Drawing.Point(257, 2); + this.NUD_RMin.Location = new System.Drawing.Point(257, 5); this.NUD_RMin.Maximum = new decimal(new int[] { 6, 0, @@ -2092,7 +2077,7 @@ private void InitializeComponent() // // NUD_RMax // - this.NUD_RMax.Location = new System.Drawing.Point(257, 23); + this.NUD_RMax.Location = new System.Drawing.Point(257, 26); this.NUD_RMax.Maximum = new decimal(new int[] { 6, 0, @@ -2116,7 +2101,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 93); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 90); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 333; @@ -2129,7 +2114,7 @@ private void InitializeComponent() this.CHK_TypeTheme.AutoSize = true; this.CHK_TypeTheme.Checked = true; this.CHK_TypeTheme.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 30); + this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 33); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); this.CHK_TypeTheme.TabIndex = 329; @@ -2142,7 +2127,7 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass.AutoSize = true; this.CHK_IgnoreSpecialClass.Checked = true; this.CHK_IgnoreSpecialClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(6, 16); + this.CHK_IgnoreSpecialClass.Location = new System.Drawing.Point(6, 19); this.CHK_IgnoreSpecialClass.Name = "CHK_IgnoreSpecialClass"; this.CHK_IgnoreSpecialClass.Size = new System.Drawing.Size(133, 17); this.CHK_IgnoreSpecialClass.TabIndex = 327; @@ -2155,7 +2140,7 @@ private void InitializeComponent() this.CHK_RandomClass.AutoSize = true; this.CHK_RandomClass.Checked = true; this.CHK_RandomClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomClass.Location = new System.Drawing.Point(6, 2); + this.CHK_RandomClass.Location = new System.Drawing.Point(6, 5); this.CHK_RandomClass.Name = "CHK_RandomClass"; this.CHK_RandomClass.Size = new System.Drawing.Size(141, 17); this.CHK_RandomClass.TabIndex = 326; @@ -2167,7 +2152,7 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 79); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 76); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); this.CHK_ForceFullyEvolved.TabIndex = 339; @@ -2418,7 +2403,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_6PKM; private System.Windows.Forms.CheckBox CHK_ForceHighPower; private System.Windows.Forms.NumericUpDown NUD_ForceHighPower; - private System.Windows.Forms.CheckBox CHK_ReplaceLegend; private System.Windows.Forms.CheckBox CHK_ReplaceMega; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 7548e6d8b6..5e8193ff64 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -19,9 +19,10 @@ public partial class SMTE : Form private readonly trdata7[] Trainers; private string[][] AltForms; private static int[] SpecialClasses; - private static int[] ImportantTrainers; - private static int[] FinalEvo; - private static int[] ReplaceLegend; + private static int[] ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; + private static int[] FinalEvo = Legal.FinalEvolutions_7; + private static int[] Legendary = Main.Config.USUM ? Legal.Legendary_USUM : Legal.Legendary_SM; + private static int[] Mythical = Main.Config.USUM ? Legal.Mythical_USUM : Legal.Mythical_SM; private static Dictionary MegaDictionary; private int index = -1; private PictureBox[] pba; @@ -38,7 +39,6 @@ public partial class SMTE : Form private readonly string[] trClass = Main.Config.getText(TextName.TrainerClasses); private readonly TextData trText = Main.Config.getTextData(TextName.TrainerText); private readonly TextData TrainerNames; - public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) { @@ -58,12 +58,7 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) CB_TrainerID.SelectedIndex = 0; CB_Moves.SelectedIndex = 0; - CHK_ReplaceLegend.Visible = Main.Config.USUM; // Team Rainbow Rocket only in USUM MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); - - ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; - FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; - ReplaceLegend = Legal.Legendary_Mythical_USUM; if (CHK_RandomClass.Checked) { @@ -633,6 +628,10 @@ private void B_Randomize_Click(object sender, EventArgs e) }; rnd.Initialize(); + // add Legendary/Mythical to final evolutions if checked + if (CHK_L.Checked) FinalEvo = FinalEvo.Concat(Legendary).ToArray(); + if (CHK_E.Checked) FinalEvo = FinalEvo.Concat(Mythical).ToArray(); + var banned = new List(new[] { 165, 621, 464 }.Concat(Legal.Z_Moves)); // Struggle, Hyperspace Fury, Dark Void if (CHK_NoFixedDamage.Checked) banned.AddRange(MoveRandomizer.FixedDamageMoves); @@ -726,15 +725,6 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.Item = mega[Util.rand.Next(0, mega.Length)]; pk.Form = 0; // allow it to Mega Evolve naturally } - - // replaces Team Rainbow Rocket Legendaries with another Legendary - else if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(pk.Species)) - { - int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); - pk.Species = ReplaceLegend[randLegend()]; - pk.Item = items[Util.rnd32() % items.Length]; - pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); - } // every other pkm else diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index aa98ba2678..1ab2f29820 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -20,9 +20,11 @@ public partial class StaticEncounterEditor7 : Form private readonly string[] natures = Main.Config.getText(TextName.Natures); private readonly string[] types = Main.Config.getText(TextName.Types); private readonly int[] oldStarters; - private static int[] FinalEvo; - private static int[] ReplaceLegend; - private static int[] BasicStarter; + private static int[] FinalEvo = Legal.FinalEvolutions_7; + private static int[] Legendary = Main.Config.USUM ? Legal.Legendary_USUM : Legal.Legendary_SM; + private static int[] Mythical = Main.Config.USUM ? Legal.Mythical_USUM : Legal.Mythical_SM; + private static int[] ReplaceLegend = Legendary.Concat(Mythical).ToArray(); + private static int[] BasicStarter = Legal.BasicStarters_7; private readonly string[] gender = { @@ -154,9 +156,6 @@ public StaticEncounterEditor7(byte[][] infiles) LB_Gift.SelectedIndex = 0; LB_Encounter.SelectedIndex = 0; LB_Trade.SelectedIndex = 0; - FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; - ReplaceLegend = Main.Config.USUM ? Legal.Legendary_Mythical_USUM : Legal.Legendary_Mythical_SM; - BasicStarter = Legal.BasicStarters_7; // Select last tab (Randomization) by default in case info already randomized. TC_Tabs.SelectedIndex = TC_Tabs.TabCount - 1; @@ -252,6 +251,9 @@ private void GetAllies() { var entry = Encounters[eEntry]; + if (eEntry < 0) + return; + // USUM has slots with SOS allies beyond slot 100, accommodate by trimming an extra character int endTrim = eEntry < 100 ? 5 : 6; @@ -502,6 +504,11 @@ private SpeciesRandomizer GetRandomizer() rBST = CHK_BST.Checked, }; specrand.Initialize(); + + // add Legendary/Mythical to final evolutions if checked + if (CHK_L.Checked) FinalEvo = FinalEvo.Concat(Legendary).ToArray(); + if (CHK_E.Checked) FinalEvo = FinalEvo.Concat(Mythical).ToArray(); + return specrand; } From 2abd4a2441740b8e55745136db603b58a06644f7 Mon Sep 17 00:00:00 2001 From: "J. Lord" Date: Mon, 5 Nov 2018 18:05:34 -0800 Subject: [PATCH 134/191] Fix #391: prevent Metronome Mode softlock (#392) * Fix #391: Metronome Mode causes catching tut. softlock * Fix #391: Metronome Mode causes catching tut. softlock --- pk3DS/Subforms/Gen6/MoveEditor6.cs | 6 ++++-- pk3DS/Subforms/Gen7/MoveEditor7.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index 9ea1d7cfa4..98e3cd3720 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -209,13 +209,15 @@ private void B_Metronome_Click(object sender, EventArgs e) for (int i = 0; i < CB_Move.Items.Count; i++) { CB_Move.SelectedIndex = i; - if (CB_Move.SelectedIndex != 117) + if (CB_Move.SelectedIndex != 117 || CB_Move.SelectedIndex != 32) NUD_PP.Value = 0; if (CB_Move.SelectedIndex == 117) NUD_PP.Value = 40; + if (CB_Move.SelectedIndex == 32) + NUD_PP.Value = 1; } CB_Move.SelectedIndex = 0; WinFormsUtil.Alert("All Moves have had their Base PP values modified!"); } } -} \ No newline at end of file +} diff --git a/pk3DS/Subforms/Gen7/MoveEditor7.cs b/pk3DS/Subforms/Gen7/MoveEditor7.cs index 78378649dd..cf46c9f0a8 100644 --- a/pk3DS/Subforms/Gen7/MoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/MoveEditor7.cs @@ -271,13 +271,15 @@ private void B_Metronome_Click(object sender, EventArgs e) for (int i = 0; i < CB_Move.Items.Count; i++) { CB_Move.SelectedIndex = i; - if (CB_Move.SelectedIndex != 117) + if (CB_Move.SelectedIndex != 117 || CB_Move.SelectedIndex != 32) NUD_PP.Value = 0; if (CB_Move.SelectedIndex == 117) NUD_PP.Value = 40; + if (CB_Move.SelectedIndex == 32) + NUD_PP.Value = 1; } CB_Move.SelectedIndex = 0; WinFormsUtil.Alert("All Moves have had their Base PP values modified!"); } } -} \ No newline at end of file +} From f3282e9c8c04c60a34fa1becb43e74e74848b70f Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 9 Nov 2018 21:01:07 -0800 Subject: [PATCH 135/191] Fix maison tr dump off by 1 Closes #393 --- pk3DS/Subforms/Gen6/MaisonEditor6.cs | 2 +- pk3DS/Subforms/Gen7/MaisonEditor7.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pk3DS/Subforms/Gen6/MaisonEditor6.cs b/pk3DS/Subforms/Gen6/MaisonEditor6.cs index 027f470b79..6c7315cd2c 100644 --- a/pk3DS/Subforms/Gen6/MaisonEditor6.cs +++ b/pk3DS/Subforms/Gen6/MaisonEditor6.cs @@ -208,7 +208,7 @@ private void DumpTRs_Click(object sender, EventArgs e) for (int i = 0; i < CB_Trainer.Items.Count; i++) { CB_Trainer.SelectedIndex = i; - int count = LB_Choices.Items.Count - 1; + int count = LB_Choices.Items.Count; if (count > 0) { result += "======" + Environment.NewLine + i + " - (" + CB_Class.Text + ") " + CB_Trainer.Text + Environment.NewLine + "======" + Environment.NewLine; diff --git a/pk3DS/Subforms/Gen7/MaisonEditor7.cs b/pk3DS/Subforms/Gen7/MaisonEditor7.cs index 1c46db4fcd..84725fe146 100644 --- a/pk3DS/Subforms/Gen7/MaisonEditor7.cs +++ b/pk3DS/Subforms/Gen7/MaisonEditor7.cs @@ -19,7 +19,7 @@ public MaisonEditor7(byte[][] trd, byte[][] trp, bool royal) pkFiles = trp; Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); movelist[0] = specieslist[0] = itemlist[0] = ""; - + trNames = Main.Config.getText(royal ? TextName.BattleRoyalNames : TextName.BattleTreeNames); Array.Resize(ref trNames, trFiles.Length); InitializeComponent(); @@ -209,7 +209,7 @@ private void DumpTRs_Click(object sender, EventArgs e) for (int i = 0; i < CB_Trainer.Items.Count; i++) { CB_Trainer.SelectedIndex = i; - int count = LB_Choices.Items.Count - 1; + int count = LB_Choices.Items.Count; if (count > 0) { result += "======" + Environment.NewLine + i + " - (" + CB_Class.Text + ") " + CB_Trainer.Text + Environment.NewLine + "======" + Environment.NewLine; @@ -265,7 +265,7 @@ private void B_DumpPKs_Click(object sender, EventArgs e) if (sfd.ShowDialog() != DialogResult.OK) return; - + File.WriteAllText(sfd.FileName, result, Encoding.Unicode); } } From e6aa4df384b42be6adb5e7823977fbc8dad47b00 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 13 Nov 2018 22:21:55 -0800 Subject: [PATCH 136/191] Add makefile Closes #396 Thanks @iskunk ! --- Makefile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..cc04662ae5 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# GNU Make makefile for building with Mono + +MONO = mono +MSBUILD = msbuild + +#CONFIG = Debug +CONFIG = Release + +PK3DS_EXE = pk3DS/bin/$(CONFIG)/pk3DS.exe + +# Note: The Mono compiler seems to dump some detritus by default in +# /tmp, so we set TMPDIR to a more suitable location + +$(PK3DS_EXE): pk3DS.sln + mkdir -p tmp + TMPDIR=$(shell pwd)/tmp $(MSBUILD) /p:Configuration=$(CONFIG) $< + +install: $(PK3DS_EXE) + rm -rf pk3ds-install + mkdir pk3ds-install + cp -np */bin/$(CONFIG)/*.dll pk3ds-install + cp -np */bin/$(CONFIG)/*.exe pk3ds-install + +run: $(PK3DS_EXE) + $(MONO) $< + +run-install: pk3ds-install/SPICA.exe + $(MONO) $< + +clean: + rm -rf pk3DS*/bin pk3DS*/obj + rm -rf pk3ds-install + rm -rf tmp + +.PHONY: clean install run run-install + +# EOF From e3e6268f900926378d69b835d07252440ea03102 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 19 Nov 2018 15:01:38 -0800 Subject: [PATCH 137/191] Fix index access exception --- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 1ab2f29820..31f446dfd7 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -249,10 +249,9 @@ private void LB_Trade_SelectedIndexChanged(object sender, EventArgs e) private void GetAllies() { - var entry = Encounters[eEntry]; - if (eEntry < 0) return; + var entry = Encounters[eEntry]; // USUM has slots with SOS allies beyond slot 100, accommodate by trimming an extra character int endTrim = eEntry < 100 ? 5 : 6; From 2c159e7d6f7987b980bbdd0ee821380b3881bd89 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 27 Dec 2018 20:29:56 -0800 Subject: [PATCH 138/191] Add battle mode property & gui Closes #399 --- pk3DS.Core/Structures/Gen7/trdata7.cs | 10 +++- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 32 +++++++++++++ pk3DS/Subforms/Gen7/SMTE.cs | 66 ++++++++++++++------------- 3 files changed, 76 insertions(+), 32 deletions(-) diff --git a/pk3DS.Core/Structures/Gen7/trdata7.cs b/pk3DS.Core/Structures/Gen7/trdata7.cs index 01484ae9f7..d1e56a5a8a 100644 --- a/pk3DS.Core/Structures/Gen7/trdata7.cs +++ b/pk3DS.Core/Structures/Gen7/trdata7.cs @@ -24,7 +24,8 @@ public trdata7(byte[] tr = null, byte[] tp = null) } } - public byte TrainerClass { get => trdata[0]; set => trdata[0] = value; } + public int TrainerClass { get => BitConverter.ToUInt16(trdata, 0x00); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x00); } + public BattleMode Mode { get => (BattleMode)trdata[2]; set => trdata[2] = (byte)value; } public int NumPokemon { get => trdata[3]; set => trdata[3] = (byte)(value%7); } public int Item1 { get => BitConverter.ToUInt16(trdata, 0x04); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x04); } public int Item2 { get => BitConverter.ToUInt16(trdata, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x06); } @@ -44,4 +45,11 @@ public void Write(out byte[] tr, out byte[] pk) pk = dat; } } + + public enum BattleMode : byte + { + Singles, + Doubles, + Multi, + } } diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index d88159d224..6f8372d96e 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -190,6 +190,8 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); + this.CB_Mode = new System.Windows.Forms.ComboBox(); + this.L_Mode = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -1476,6 +1478,8 @@ private void InitializeComponent() // // Tab_Trainer // + this.Tab_Trainer.Controls.Add(this.L_Mode); + this.Tab_Trainer.Controls.Add(this.CB_Mode); this.Tab_Trainer.Controls.Add(this.CHK_Flag); this.Tab_Trainer.Controls.Add(this.NUD_AI); this.Tab_Trainer.Controls.Add(this.L_AI); @@ -2159,6 +2163,32 @@ private void InitializeComponent() this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; // + // CB_Mode + // + this.CB_Mode.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Mode.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Mode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_Mode.FormattingEnabled = true; + this.CB_Mode.Items.AddRange(new object[] { + "Single", + "Double", + "Multi", + "3", + "4"}); + this.CB_Mode.Location = new System.Drawing.Point(214, 107); + this.CB_Mode.Name = "CB_Mode"; + this.CB_Mode.Size = new System.Drawing.Size(94, 21); + this.CB_Mode.TabIndex = 452; + // + // L_Mode + // + this.L_Mode.AutoSize = true; + this.L_Mode.Location = new System.Drawing.Point(169, 110); + this.L_Mode.Name = "L_Mode"; + this.L_Mode.Size = new System.Drawing.Size(37, 13); + this.L_Mode.TabIndex = 453; + this.L_Mode.Text = "Mode:"; + // // SMTE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2404,6 +2434,8 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_ForceHighPower; private System.Windows.Forms.NumericUpDown NUD_ForceHighPower; private System.Windows.Forms.CheckBox CHK_ReplaceMega; + private System.Windows.Forms.Label L_Mode; + private System.Windows.Forms.ComboBox CB_Mode; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 5e8193ff64..388c2f782d 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -19,10 +19,10 @@ public partial class SMTE : Form private readonly trdata7[] Trainers; private string[][] AltForms; private static int[] SpecialClasses; - private static int[] ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; + private static readonly int[] ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; private static int[] FinalEvo = Legal.FinalEvolutions_7; - private static int[] Legendary = Main.Config.USUM ? Legal.Legendary_USUM : Legal.Legendary_SM; - private static int[] Mythical = Main.Config.USUM ? Legal.Mythical_USUM : Legal.Mythical_SM; + private static readonly int[] Legendary = Main.Config.USUM ? Legal.Legendary_USUM : Legal.Legendary_SM; + private static readonly int[] Mythical = Main.Config.USUM ? Legal.Mythical_USUM : Legal.Mythical_SM; private static Dictionary MegaDictionary; private int index = -1; private PictureBox[] pba; @@ -93,7 +93,7 @@ private void ClickView(object sender, EventArgs e) int slot = GetSlot(sender); if (pba[slot].Image == null) { SystemSounds.Exclamation.Play(); return; } - + // Load the PKM var pk = Trainers[index].Pokemon[slot]; if (pk.Species != 0) @@ -104,7 +104,9 @@ private void ClickView(object sender, EventArgs e) GetSlotColor(slot, Properties.Resources.slotView); } else + { SystemSounds.Exclamation.Play(); + } } private void ClickSet(object sender, EventArgs e) @@ -116,7 +118,9 @@ private void ClickSet(object sender, EventArgs e) var pk = PrepareTP7(); var tr = Trainers[index]; if (slot < tr.NumPokemon) + { tr.Pokemon[slot] = pk; + } else { tr.Pokemon.Add(pk); @@ -203,7 +207,7 @@ private void RefreshPKMSlotAbility() private void Setup() { - AltForms = forms.Select(f => Enumerable.Range(0, 100).Select(i => i.ToString()).ToArray()).ToArray(); + AltForms = forms.Select(_ => Enumerable.Range(0, 100).Select(i => i.ToString()).ToArray()).ToArray(); CB_TrainerID.Items.Clear(); for (int i = 0; i < trdata.Length; i++) CB_TrainerID.Items.Add(GetEntryTitle(trName[i] ?? "UNKNOWN", i)); @@ -226,7 +230,7 @@ private void Setup() specieslist[0] = "---"; abilitylist[0] = itemlist[0] = movelist[0] = "(None)"; pba = new[] { PB_Team1, PB_Team2, PB_Team3, PB_Team4, PB_Team5, PB_Team6 }; - + CB_Species.Items.Clear(); foreach (string s in specieslist) CB_Species.Items.Add(s); @@ -252,7 +256,7 @@ private void Setup() CB_Item.Items.Clear(); foreach (string s in itemlist) CB_Item.Items.Add(s); - + CB_Gender.Items.Clear(); CB_Gender.Items.Add("- / Genderless/Random"); CB_Gender.Items.Add("♂ / Male"); @@ -406,6 +410,7 @@ private void PopulateFieldsTD7(trdata7 tr) CB_Item_3.SelectedIndex = tr.Item3; CB_Item_4.SelectedIndex = tr.Item4; CB_Money.SelectedIndex = tr.Money; + CB_Mode.SelectedIndex = (int)tr.Mode; NUD_AI.Value = tr.AI; CHK_Flag.Checked = tr.Flag; PopulateTeam(tr); @@ -420,6 +425,7 @@ private void PrepareTR7(trdata7 tr) tr.Item3 = CB_Item_3.SelectedIndex; tr.Item4 = CB_Item_4.SelectedIndex; tr.Money = CB_Money.SelectedIndex; + tr.Mode = (BattleMode)CB_Mode.SelectedIndex; tr.AI = (int)NUD_AI.Value; tr.Flag = CHK_Flag.Checked; } @@ -452,24 +458,24 @@ private string GetTrainerString(trdata7 tr) { var sb = new StringBuilder(); sb.AppendLine("======"); - sb.AppendLine($"{tr.ID} - {trClass[tr.TrainerClass]} {tr.Name}"); + sb.Append(tr.ID).Append(" - ").Append(trClass[tr.TrainerClass]).Append(" ").AppendLine(tr.Name); sb.AppendLine("======"); - sb.AppendLine($"Pokemon: {tr.NumPokemon}"); + sb.Append("Pokemon: ").Append(tr.NumPokemon).AppendLine(); for (int i = 0; i < tr.NumPokemon; i++) { if (tr.Pokemon[i].Shiny) sb.Append("Shiny "); sb.Append(specieslist[tr.Pokemon[i].Species]); - sb.Append($" (Lv. {tr.Pokemon[i].Level}) "); + sb.Append(" (Lv. ").Append(tr.Pokemon[i].Level).Append(") "); if (tr.Pokemon[i].Item > 0) - sb.Append($"@{itemlist[tr.Pokemon[i].Item]}"); + sb.Append("@").Append(itemlist[tr.Pokemon[i].Item]); if (tr.Pokemon[i].Nature != 0) - sb.Append($" (Nature: {natures[tr.Pokemon[i].Nature]})"); + sb.Append(" (Nature: ").Append(natures[tr.Pokemon[i].Nature]).Append(")"); - sb.Append($" (Moves: {string.Join("/", tr.Pokemon[i].Moves.Select(m => m == 0 ? "(None)" : movelist[m]))})"); - sb.Append($" IVs: {string.Join("/", tr.Pokemon[i].IVs)}"); - sb.Append($" EVs: {string.Join("/", tr.Pokemon[i].EVs)}"); + sb.Append(" (Moves: ").Append(string.Join("/", tr.Pokemon[i].Moves.Select(m => m == 0 ? "(None)" : movelist[m]))).Append(")"); + sb.Append(" IVs: ").Append(string.Join("/", tr.Pokemon[i].IVs)); + sb.Append(" EVs: ").Append(string.Join("/", tr.Pokemon[i].EVs)); sb.AppendLine(); } return sb.ToString(); @@ -682,11 +688,14 @@ private void B_Randomize_Click(object sender, EventArgs e) if (tr.NumPokemon < NUD_RMin.Value) { for (int p = tr.NumPokemon; p < NUD_RMin.Value; p++) + { tr.Pokemon.Add(new trpoke7 { Species = rnd.GetRandomSpecies(avgSpec), Level = avgLevel, }); + } + tr.NumPokemon = (int)NUD_RMin.Value; } if (tr.NumPokemon > NUD_RMax.Value) @@ -697,11 +706,14 @@ private void B_Randomize_Click(object sender, EventArgs e) if (CHK_6PKM.Checked && ImportantTrainers.Contains(tr.ID)) { for (int g = tr.NumPokemon; g < 6; g++) + { tr.Pokemon.Add(new trpoke7 { Species = rnd.GetRandomSpecies(avgSpec), Level = avgLevel, }); + } + tr.NumPokemon = 6; } @@ -719,13 +731,12 @@ private void B_Randomize_Click(object sender, EventArgs e) // replaces Megas with another Mega (Dexio and Lysandre in USUM) if (MegaDictionary.Values.Any(z => z.Contains(pk.Item))) { - int species = pk.Species; - int[] mega = GetRandomMega(out species); + int[] mega = GetRandomMega(out int species); pk.Species = species; pk.Item = mega[Util.rand.Next(0, mega.Length)]; pk.Form = 0; // allow it to Mega Evolve naturally } - + // every other pkm else { @@ -747,7 +758,7 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.IVs = new[] {31, 31, 31, 31, 31, 31}; if (CHK_MaxAI.Checked) tr.AI |= 7; - + if (CHK_ForceFullyEvolved.Checked && pk.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(pk.Species)) { int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); @@ -835,18 +846,11 @@ private void CHK_STAB_CheckedChanged(object sender, EventArgs e) private void CHK_RandomPKM_CheckedChanged(object sender, EventArgs e) { - if (!CHK_RandomPKM.Checked) - foreach (CheckBox c in new[] { CHK_G1, CHK_G2, CHK_G3, CHK_G4, CHK_G5, CHK_G6, CHK_G7, CHK_L, CHK_E, CHK_BST }) - { - c.Enabled = false; - c.Checked = false; - } - else - foreach (CheckBox c in new[] { CHK_G1, CHK_G2, CHK_G3, CHK_G4, CHK_G5, CHK_G6, CHK_G7, CHK_L, CHK_E, CHK_BST }) - { - c.Enabled = true; - c.Checked = true; - } + foreach (CheckBox c in new[] { CHK_G1, CHK_G2, CHK_G3, CHK_G4, CHK_G5, CHK_G6, CHK_G7, CHK_L, CHK_E, CHK_BST }) + { + c.Enabled = CHK_RandomPKM.Checked; + c.Checked = CHK_RandomPKM.Checked; + } } private void CHK_RandomClass_CheckedChanged(object sender, EventArgs e) From d971af11b457c917b6f0cf56a0161402bb33f42f Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 2 Jan 2019 17:51:08 -0800 Subject: [PATCH 139/191] Split pp bitflags into separate properties --- pk3DS.Core/Structures/Gen6/Item6.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pk3DS.Core/Structures/Gen6/Item6.cs b/pk3DS.Core/Structures/Gen6/Item6.cs index c009fd21af..0ee548f6ec 100644 --- a/pk3DS.Core/Structures/Gen6/Item6.cs +++ b/pk3DS.Core/Structures/Gen6/Item6.cs @@ -120,8 +120,11 @@ public struct Item [Category(Battle)] public int BoostCRIT { get => (Boost3 >> 4) & 3; set => Boost3 = (byte)((Boost3 & ~0x30) | ((value & 3) << 4)); } - [Category(Battle), Description("1 = One PP Up, 3 = PP Max")] - public int BoostPP { get => (Boost3 >> 6) & 3; set => Boost3 = (byte)((Boost3 & 0x3F) | ((value & 3) << 6)); } + [Category(Battle)] + public int BoostPP1 { get => (Boost3 >> 6) & 1; set => Boost3 = (byte)((Boost3 & 0xBF) | ((value & 1) << 6)); } + + [Category(Battle)] + public int BoostPPMax { get => (Boost3 >> 7) & 1; set => Boost3 = (byte)((Boost3 & 0x7F) | ((value & 1) << 7)); } [Category(Heal), Description("Raw value of the Heal enum."), RefreshProperties(RefreshProperties.All)] public int HealValue From ee169dcfbbcaeb03025af7c288a46f5a9dcfa08e Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 2 Jan 2019 23:45:14 -0800 Subject: [PATCH 140/191] Split Consumable byte to 4&4 flutes appear as '16', which is 0x10 (4th bit) flag. --- pk3DS.Core/Structures/Gen6/Item6.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pk3DS.Core/Structures/Gen6/Item6.cs b/pk3DS.Core/Structures/Gen6/Item6.cs index 0ee548f6ec..75ee066de1 100644 --- a/pk3DS.Core/Structures/Gen6/Item6.cs +++ b/pk3DS.Core/Structures/Gen6/Item6.cs @@ -35,7 +35,7 @@ public struct Item public byte _0xC { get; set; } // 0 or 1 public byte _0xD { get; set; } // Classification (0-3 Battle, 4 Balls, 5 Mail) - public byte Consumable { get; set; } + private byte Consumable { get; set; } // 4 bits for use consume, 4 bits for use not consumed public byte SortIndex { get; set; } public BattleStatusFlags CureInflict { get; set; } // Bitflags private byte Boost0; // Revive 1, Sacred Ash 3, Rare Candy 5, EvoStone 8, upper4 for BoostAtk @@ -132,6 +132,12 @@ public int HealValue get => (int) HealAmount; set => HealAmount = (HealValue)value; } + + [Category(Heal), Description("Item is consumed when used."), RefreshProperties(RefreshProperties.All)] + public bool UseConsume { get => (Consumable & 0xF) != 0; set => Consumable = (byte)((Consumable & 0xF0) | (value ? 1 : 0)); } + + [Category(Heal), Description("Item is not consumed when used."), RefreshProperties(RefreshProperties.All)] + public bool UseKeep { get => (Consumable & 0xF0) != 0; set => Consumable = (byte)((Consumable & 0x0F) | (value ? 0x10 : 0)); } } [Flags] From 48c0dbb748784b50bb544e454fabce33488d0826 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 7 Jan 2019 17:50:31 -0800 Subject: [PATCH 141/191] Expose individual field effect bits Closes #407 Also fix boostacc getset (oops) --- pk3DS.Core/Structures/Gen6/Item6.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pk3DS.Core/Structures/Gen6/Item6.cs b/pk3DS.Core/Structures/Gen6/Item6.cs index 75ee066de1..c8f0f62fac 100644 --- a/pk3DS.Core/Structures/Gen6/Item6.cs +++ b/pk3DS.Core/Structures/Gen6/Item6.cs @@ -96,8 +96,17 @@ public struct Item [Category(Battle)] public BattlePocket PocketBattle { get => (BattlePocket)(Packed >> 11); set => Packed = (ushort)((Packed & 0x077F) | (((byte)value & 0x1F) << 11)); } - [Category(Battle)] - public int FieldEffect { get => Boost0 & 0xF; set => Boost0 = (byte)((Boost0 & ~0xF) | (value & 0xF)); } + [Category(Field)] + public bool Revive { get => ((Boost0 >> 0) & 1) == 0; set => Boost0 = (byte)((Boost0 & ~(1 << 0)) | ((value ? 1 : 0) << 0)); } + + [Category(Field)] + public bool ReviveAll { get => ((Boost0 >> 1) & 1) == 1; set => Boost0 = (byte)((Boost0 & ~(1 << 1)) | ((value ? 1 : 0) << 1)); } + + [Category(Field)] + public bool LevelUp { get => ((Boost0 >> 2) & 1) == 1; set => Boost0 = (byte)((Boost0 & ~(1 << 2)) | ((value ? 1 : 0) << 2)); } + + [Category(Field)] + public bool EvoStone { get => ((Boost0 >> 3) & 1) == 1; set => Boost0 = (byte)((Boost0 & ~(1 << 3)) | ((value ? 1 : 0) << 3)); } [Category(Battle)] public int BoostATK { get => Boost0 >> 4; set => Boost0 = (byte)((Boost0 & 0xF) | (value << 4)); } @@ -115,7 +124,7 @@ public struct Item public int BoostSPE { get => Boost2 >> 4; set => Boost2 = (byte)((Boost2 & 0xF) | (value << 4)); } [Category(Battle)] - public int BoostACC { get => Boost0 & 0xF; set => Boost0 = (byte)((Boost3 & ~0xF) | (value & 0xF)); } + public int BoostACC { get => Boost3 & 0xF; set => Boost3 = (byte)((Boost3 & ~0xF) | (value & 0xF)); } [Category(Battle)] public int BoostCRIT { get => (Boost3 >> 4) & 3; set => Boost3 = (byte)((Boost3 & ~0x30) | ((value & 3) << 4)); } From 0ef222774783a543b65f48cda773fb828b8c1b5d Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sat, 6 Apr 2019 11:38:53 -0400 Subject: [PATCH 142/191] Expose Gen 7 Trainer AI bits --- pk3DS.Core/Structures/Gen7/TrainerAI.cs | 18 ++ pk3DS/Subforms/Gen7/SMTE.Designer.cs | 289 +++++++++++++++--------- pk3DS/Subforms/Gen7/SMTE.cs | 24 +- 3 files changed, 226 insertions(+), 105 deletions(-) create mode 100644 pk3DS.Core/Structures/Gen7/TrainerAI.cs diff --git a/pk3DS.Core/Structures/Gen7/TrainerAI.cs b/pk3DS.Core/Structures/Gen7/TrainerAI.cs new file mode 100644 index 0000000000..7a6b1a9888 --- /dev/null +++ b/pk3DS.Core/Structures/Gen7/TrainerAI.cs @@ -0,0 +1,18 @@ +using System; + +namespace pk3DS.Core.Structures +{ + [Flags] + public enum TrainerAI : byte + { + Basic = 1 << 0, + Strong = 1 << 1, + Expert = 1 << 2, + + Doubles = 1 << 3, + NoWhiteout = 1 << 4, + BattleRoyal = 1 << 5, + PokeChange = 1 << 6, + UseItem = 1 << 7, + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 6f8372d96e..9bdc6f641b 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -30,7 +30,6 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.CB_TrainerID = new System.Windows.Forms.ComboBox(); - this.L_AI = new System.Windows.Forms.Label(); this.L_Money = new System.Windows.Forms.Label(); this.CB_Money = new System.Windows.Forms.ComboBox(); this.L_Trainer_Class = new System.Windows.Forms.Label(); @@ -137,12 +136,13 @@ private void InitializeComponent() this.CB_Move4 = new System.Windows.Forms.ComboBox(); this.CB_Move2 = new System.Windows.Forms.ComboBox(); this.CB_Move3 = new System.Windows.Forms.ComboBox(); - this.NUD_AI = new System.Windows.Forms.NumericUpDown(); this.L_TrainerName = new System.Windows.Forms.Label(); this.TB_TrainerName = new System.Windows.Forms.TextBox(); this.NUD_NumPoke = new System.Windows.Forms.NumericUpDown(); this.TC_trdata = new System.Windows.Forms.TabControl(); this.Tab_Trainer = new System.Windows.Forms.TabPage(); + this.L_Mode = new System.Windows.Forms.Label(); + this.CB_Mode = new System.Windows.Forms.ComboBox(); this.CHK_Flag = new System.Windows.Forms.CheckBox(); this.Tab_Rand = new System.Windows.Forms.TabPage(); this.TC_rand = new System.Windows.Forms.TabControl(); @@ -190,8 +190,15 @@ private void InitializeComponent() this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); this.CHK_ForceFullyEvolved = new System.Windows.Forms.CheckBox(); - this.CB_Mode = new System.Windows.Forms.ComboBox(); - this.L_Mode = new System.Windows.Forms.Label(); + this.GB_AIBits = new System.Windows.Forms.GroupBox(); + this.CHK_AI6 = new System.Windows.Forms.CheckBox(); + this.CHK_AI5 = new System.Windows.Forms.CheckBox(); + this.CHK_AI4 = new System.Windows.Forms.CheckBox(); + this.CHK_AI3 = new System.Windows.Forms.CheckBox(); + this.CHK_AI2 = new System.Windows.Forms.CheckBox(); + this.CHK_AI1 = new System.Windows.Forms.CheckBox(); + this.CHK_AI0 = new System.Windows.Forms.CheckBox(); + this.CHK_AI7 = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -225,7 +232,6 @@ private void InitializeComponent() this.FLP_HPType.SuspendLayout(); this.Tab_Moves.SuspendLayout(); this.GB_Moves.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_AI)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_NumPoke)).BeginInit(); this.TC_trdata.SuspendLayout(); this.Tab_Trainer.SuspendLayout(); @@ -242,6 +248,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).BeginInit(); + this.GB_AIBits.SuspendLayout(); this.SuspendLayout(); // // CB_TrainerID @@ -257,19 +264,10 @@ private void InitializeComponent() this.CB_TrainerID.TabIndex = 64; this.CB_TrainerID.SelectedIndexChanged += new System.EventHandler(this.ChangeTrainerIndex); // - // L_AI - // - this.L_AI.AutoSize = true; - this.L_AI.Location = new System.Drawing.Point(217, 57); - this.L_AI.Name = "L_AI"; - this.L_AI.Size = new System.Drawing.Size(38, 13); - this.L_AI.TabIndex = 55; - this.L_AI.Text = "AI Val:"; - // // L_Money // this.L_Money.AutoSize = true; - this.L_Money.Location = new System.Drawing.Point(40, 54); + this.L_Money.Location = new System.Drawing.Point(34, 54); this.L_Money.Name = "L_Money"; this.L_Money.Size = new System.Drawing.Size(42, 13); this.L_Money.TabIndex = 53; @@ -280,7 +278,7 @@ private void InitializeComponent() this.CB_Money.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Money.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Money.FormattingEnabled = true; - this.CB_Money.Location = new System.Drawing.Point(85, 51); + this.CB_Money.Location = new System.Drawing.Point(79, 51); this.CB_Money.Name = "CB_Money"; this.CB_Money.Size = new System.Drawing.Size(70, 21); this.CB_Money.TabIndex = 52; @@ -288,7 +286,7 @@ private void InitializeComponent() // L_Trainer_Class // this.L_Trainer_Class.AutoSize = true; - this.L_Trainer_Class.Location = new System.Drawing.Point(13, 32); + this.L_Trainer_Class.Location = new System.Drawing.Point(7, 32); this.L_Trainer_Class.Name = "L_Trainer_Class"; this.L_Trainer_Class.Size = new System.Drawing.Size(71, 13); this.L_Trainer_Class.TabIndex = 49; @@ -300,9 +298,9 @@ private void InitializeComponent() this.CB_Trainer_Class.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Trainer_Class.DropDownWidth = 165; this.CB_Trainer_Class.FormattingEnabled = true; - this.CB_Trainer_Class.Location = new System.Drawing.Point(85, 29); + this.CB_Trainer_Class.Location = new System.Drawing.Point(79, 29); this.CB_Trainer_Class.Name = "CB_Trainer_Class"; - this.CB_Trainer_Class.Size = new System.Drawing.Size(175, 21); + this.CB_Trainer_Class.Size = new System.Drawing.Size(172, 21); this.CB_Trainer_Class.TabIndex = 48; // // L_Item_4 @@ -384,7 +382,7 @@ private void InitializeComponent() // L_numPokemon // this.L_numPokemon.AutoSize = true; - this.L_numPokemon.Location = new System.Drawing.Point(42, 75); + this.L_numPokemon.Location = new System.Drawing.Point(36, 75); this.L_numPokemon.Name = "L_numPokemon"; this.L_numPokemon.Size = new System.Drawing.Size(40, 13); this.L_numPokemon.TabIndex = 22; @@ -404,7 +402,7 @@ private void InitializeComponent() // this.PB_Team1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Team1.ContextMenuStrip = this.mnuVSD; - this.PB_Team1.Location = new System.Drawing.Point(53, 244); + this.PB_Team1.Location = new System.Drawing.Point(50, 244); this.PB_Team1.Name = "PB_Team1"; this.PB_Team1.Size = new System.Drawing.Size(82, 62); this.PB_Team1.TabIndex = 444; @@ -441,7 +439,7 @@ private void InitializeComponent() // this.PB_Team2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Team2.ContextMenuStrip = this.mnuVSD; - this.PB_Team2.Location = new System.Drawing.Point(139, 244); + this.PB_Team2.Location = new System.Drawing.Point(147, 244); this.PB_Team2.Name = "PB_Team2"; this.PB_Team2.Size = new System.Drawing.Size(82, 62); this.PB_Team2.TabIndex = 443; @@ -451,7 +449,7 @@ private void InitializeComponent() // this.PB_Team3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Team3.ContextMenuStrip = this.mnuVSD; - this.PB_Team3.Location = new System.Drawing.Point(225, 244); + this.PB_Team3.Location = new System.Drawing.Point(244, 244); this.PB_Team3.Name = "PB_Team3"; this.PB_Team3.Size = new System.Drawing.Size(82, 62); this.PB_Team3.TabIndex = 442; @@ -461,7 +459,7 @@ private void InitializeComponent() // this.PB_Team4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Team4.ContextMenuStrip = this.mnuVSD; - this.PB_Team4.Location = new System.Drawing.Point(311, 244); + this.PB_Team4.Location = new System.Drawing.Point(341, 244); this.PB_Team4.Name = "PB_Team4"; this.PB_Team4.Size = new System.Drawing.Size(82, 62); this.PB_Team4.TabIndex = 441; @@ -471,7 +469,7 @@ private void InitializeComponent() // this.PB_Team5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Team5.ContextMenuStrip = this.mnuVSD; - this.PB_Team5.Location = new System.Drawing.Point(397, 244); + this.PB_Team5.Location = new System.Drawing.Point(438, 244); this.PB_Team5.Name = "PB_Team5"; this.PB_Team5.Size = new System.Drawing.Size(82, 62); this.PB_Team5.TabIndex = 440; @@ -481,7 +479,7 @@ private void InitializeComponent() // this.PB_Team6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Team6.ContextMenuStrip = this.mnuVSD; - this.PB_Team6.Location = new System.Drawing.Point(483, 244); + this.PB_Team6.Location = new System.Drawing.Point(535, 244); this.PB_Team6.Name = "PB_Team6"; this.PB_Team6.Size = new System.Drawing.Size(82, 62); this.PB_Team6.TabIndex = 439; @@ -489,7 +487,7 @@ private void InitializeComponent() // // B_Randomize // - this.B_Randomize.Location = new System.Drawing.Point(61, 3); + this.B_Randomize.Location = new System.Drawing.Point(88, 5); this.B_Randomize.Name = "B_Randomize"; this.B_Randomize.Size = new System.Drawing.Size(93, 23); this.B_Randomize.TabIndex = 447; @@ -499,7 +497,7 @@ private void InitializeComponent() // // B_Dump // - this.B_Dump.Location = new System.Drawing.Point(160, 3); + this.B_Dump.Location = new System.Drawing.Point(187, 5); this.B_Dump.Name = "B_Dump"; this.B_Dump.Size = new System.Drawing.Size(93, 23); this.B_Dump.TabIndex = 446; @@ -1421,23 +1419,10 @@ private void InitializeComponent() this.CB_Move3.Size = new System.Drawing.Size(121, 21); this.CB_Move3.TabIndex = 2; // - // NUD_AI - // - this.NUD_AI.Hexadecimal = true; - this.NUD_AI.Location = new System.Drawing.Point(261, 55); - this.NUD_AI.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_AI.Name = "NUD_AI"; - this.NUD_AI.Size = new System.Drawing.Size(47, 20); - this.NUD_AI.TabIndex = 58; - // // L_TrainerName // this.L_TrainerName.AutoSize = true; - this.L_TrainerName.Location = new System.Drawing.Point(10, 11); + this.L_TrainerName.Location = new System.Drawing.Point(4, 11); this.L_TrainerName.Name = "L_TrainerName"; this.L_TrainerName.Size = new System.Drawing.Size(74, 13); this.L_TrainerName.TabIndex = 450; @@ -1445,16 +1430,16 @@ private void InitializeComponent() // // TB_TrainerName // - this.TB_TrainerName.Location = new System.Drawing.Point(85, 8); + this.TB_TrainerName.Location = new System.Drawing.Point(79, 8); this.TB_TrainerName.MaxLength = 50; this.TB_TrainerName.Name = "TB_TrainerName"; - this.TB_TrainerName.Size = new System.Drawing.Size(175, 20); + this.TB_TrainerName.Size = new System.Drawing.Size(172, 20); this.TB_TrainerName.TabIndex = 35; this.TB_TrainerName.TextChanged += new System.EventHandler(this.UpdateTrainerName); // // NUD_NumPoke // - this.NUD_NumPoke.Location = new System.Drawing.Point(85, 73); + this.NUD_NumPoke.Location = new System.Drawing.Point(79, 73); this.NUD_NumPoke.Maximum = new decimal(new int[] { 6, 0, @@ -1473,16 +1458,15 @@ private void InitializeComponent() this.TC_trdata.Location = new System.Drawing.Point(250, 13); this.TC_trdata.Name = "TC_trdata"; this.TC_trdata.SelectedIndex = 0; - this.TC_trdata.Size = new System.Drawing.Size(322, 225); + this.TC_trdata.Size = new System.Drawing.Size(371, 225); this.TC_trdata.TabIndex = 450; // // Tab_Trainer // + this.Tab_Trainer.Controls.Add(this.GB_AIBits); this.Tab_Trainer.Controls.Add(this.L_Mode); this.Tab_Trainer.Controls.Add(this.CB_Mode); this.Tab_Trainer.Controls.Add(this.CHK_Flag); - this.Tab_Trainer.Controls.Add(this.NUD_AI); - this.Tab_Trainer.Controls.Add(this.L_AI); this.Tab_Trainer.Controls.Add(this.TB_TrainerName); this.Tab_Trainer.Controls.Add(this.L_Trainer_Class); this.Tab_Trainer.Controls.Add(this.CB_Item_1); @@ -1502,15 +1486,41 @@ private void InitializeComponent() this.Tab_Trainer.Location = new System.Drawing.Point(4, 22); this.Tab_Trainer.Name = "Tab_Trainer"; this.Tab_Trainer.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Trainer.Size = new System.Drawing.Size(314, 199); + this.Tab_Trainer.Size = new System.Drawing.Size(363, 199); this.Tab_Trainer.TabIndex = 0; this.Tab_Trainer.Text = "Trainer"; this.Tab_Trainer.UseVisualStyleBackColor = true; // + // L_Mode + // + this.L_Mode.AutoSize = true; + this.L_Mode.Location = new System.Drawing.Point(190, 174); + this.L_Mode.Name = "L_Mode"; + this.L_Mode.Size = new System.Drawing.Size(67, 13); + this.L_Mode.TabIndex = 453; + this.L_Mode.Text = "Battle Mode:"; + // + // CB_Mode + // + this.CB_Mode.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Mode.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Mode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_Mode.FormattingEnabled = true; + this.CB_Mode.Items.AddRange(new object[] { + "Single", + "Double", + "Multi", + "3", + "4"}); + this.CB_Mode.Location = new System.Drawing.Point(261, 171); + this.CB_Mode.Name = "CB_Mode"; + this.CB_Mode.Size = new System.Drawing.Size(94, 21); + this.CB_Mode.TabIndex = 452; + // // CHK_Flag // this.CHK_Flag.AutoSize = true; - this.CHK_Flag.Location = new System.Drawing.Point(158, 54); + this.CHK_Flag.Location = new System.Drawing.Point(152, 54); this.CHK_Flag.Name = "CHK_Flag"; this.CHK_Flag.Size = new System.Drawing.Size(46, 17); this.CHK_Flag.TabIndex = 451; @@ -1524,7 +1534,7 @@ private void InitializeComponent() this.Tab_Rand.Controls.Add(this.B_Dump); this.Tab_Rand.Location = new System.Drawing.Point(4, 22); this.Tab_Rand.Name = "Tab_Rand"; - this.Tab_Rand.Size = new System.Drawing.Size(314, 199); + this.Tab_Rand.Size = new System.Drawing.Size(363, 199); this.Tab_Rand.TabIndex = 2; this.Tab_Rand.Text = "Randomizer Options"; this.Tab_Rand.UseVisualStyleBackColor = true; @@ -1537,7 +1547,7 @@ private void InitializeComponent() this.TC_rand.Location = new System.Drawing.Point(3, 33); this.TC_rand.Name = "TC_rand"; this.TC_rand.SelectedIndex = 0; - this.TC_rand.Size = new System.Drawing.Size(308, 163); + this.TC_rand.Size = new System.Drawing.Size(357, 163); this.TC_rand.TabIndex = 448; // // Tab_PKM1 @@ -1561,7 +1571,7 @@ private void InitializeComponent() this.Tab_PKM1.Location = new System.Drawing.Point(4, 22); this.Tab_PKM1.Name = "Tab_PKM1"; this.Tab_PKM1.Padding = new System.Windows.Forms.Padding(3); - this.Tab_PKM1.Size = new System.Drawing.Size(300, 137); + this.Tab_PKM1.Size = new System.Drawing.Size(349, 137); this.Tab_PKM1.TabIndex = 0; this.Tab_PKM1.Text = "Main"; this.Tab_PKM1.UseVisualStyleBackColor = true; @@ -1569,7 +1579,7 @@ private void InitializeComponent() // L_ShinyPCT // this.L_ShinyPCT.AutoSize = true; - this.L_ShinyPCT.Location = new System.Drawing.Point(276, 60); + this.L_ShinyPCT.Location = new System.Drawing.Point(330, 93); this.L_ShinyPCT.Name = "L_ShinyPCT"; this.L_ShinyPCT.Size = new System.Drawing.Size(15, 13); this.L_ShinyPCT.TabIndex = 305; @@ -1577,7 +1587,7 @@ private void InitializeComponent() // // NUD_Shiny // - this.NUD_Shiny.Location = new System.Drawing.Point(232, 56); + this.NUD_Shiny.Location = new System.Drawing.Point(286, 90); this.NUD_Shiny.Name = "NUD_Shiny"; this.NUD_Shiny.Size = new System.Drawing.Size(43, 20); this.NUD_Shiny.TabIndex = 304; @@ -1592,7 +1602,7 @@ private void InitializeComponent() this.CHK_RandomShiny.AutoSize = true; this.CHK_RandomShiny.Checked = true; this.CHK_RandomShiny.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomShiny.Location = new System.Drawing.Point(100, 58); + this.CHK_RandomShiny.Location = new System.Drawing.Point(154, 92); this.CHK_RandomShiny.Name = "CHK_RandomShiny"; this.CHK_RandomShiny.Size = new System.Drawing.Size(103, 17); this.CHK_RandomShiny.TabIndex = 303; @@ -1693,7 +1703,7 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(232, 77); + this.NUD_LevelBoost.Location = new System.Drawing.Point(286, 111); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, @@ -1728,7 +1738,7 @@ private void InitializeComponent() // CHK_Level // this.CHK_Level.AutoSize = true; - this.CHK_Level.Location = new System.Drawing.Point(100, 78); + this.CHK_Level.Location = new System.Drawing.Point(154, 112); this.CHK_Level.Name = "CHK_Level"; this.CHK_Level.Size = new System.Drawing.Size(130, 17); this.CHK_Level.TabIndex = 300; @@ -1751,7 +1761,7 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(100, 19); + this.CHK_BST.Location = new System.Drawing.Point(154, 23); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 297; @@ -1763,7 +1773,7 @@ private void InitializeComponent() this.CHK_RandomPKM.AutoSize = true; this.CHK_RandomPKM.Checked = true; this.CHK_RandomPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomPKM.Location = new System.Drawing.Point(100, 5); + this.CHK_RandomPKM.Location = new System.Drawing.Point(154, 5); this.CHK_RandomPKM.Name = "CHK_RandomPKM"; this.CHK_RandomPKM.Size = new System.Drawing.Size(114, 17); this.CHK_RandomPKM.TabIndex = 299; @@ -1789,7 +1799,7 @@ private void InitializeComponent() this.Tab_PKM2.Location = new System.Drawing.Point(4, 22); this.Tab_PKM2.Name = "Tab_PKM2"; this.Tab_PKM2.Padding = new System.Windows.Forms.Padding(3); - this.Tab_PKM2.Size = new System.Drawing.Size(300, 137); + this.Tab_PKM2.Size = new System.Drawing.Size(349, 137); this.Tab_PKM2.TabIndex = 1; this.Tab_PKM2.Text = "Stats/Moves"; this.Tab_PKM2.UseVisualStyleBackColor = true; @@ -1841,7 +1851,7 @@ private void InitializeComponent() this.CHK_MaxAI.AutoSize = true; this.CHK_MaxAI.Checked = true; this.CHK_MaxAI.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxAI.Location = new System.Drawing.Point(201, 120); + this.CHK_MaxAI.Location = new System.Drawing.Point(225, 118); this.CHK_MaxAI.Name = "CHK_MaxAI"; this.CHK_MaxAI.Size = new System.Drawing.Size(95, 17); this.CHK_MaxAI.TabIndex = 339; @@ -1880,7 +1890,7 @@ private void InitializeComponent() this.CHK_MaxDiffPKM.AutoSize = true; this.CHK_MaxDiffPKM.Checked = true; this.CHK_MaxDiffPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(201, 106); + this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(225, 104); this.CHK_MaxDiffPKM.Name = "CHK_MaxDiffPKM"; this.CHK_MaxDiffPKM.Size = new System.Drawing.Size(64, 17); this.CHK_MaxDiffPKM.TabIndex = 332; @@ -1911,7 +1921,7 @@ private void InitializeComponent() this.CHK_RandomAbilities.AutoSize = true; this.CHK_RandomAbilities.Checked = true; this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 120); + this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 118); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; this.CHK_RandomAbilities.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbilities.TabIndex = 331; @@ -1956,7 +1966,7 @@ private void InitializeComponent() this.CHK_RandomItems.AutoSize = true; this.CHK_RandomItems.Checked = true; this.CHK_RandomItems.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomItems.Location = new System.Drawing.Point(6, 106); + this.CHK_RandomItems.Location = new System.Drawing.Point(6, 104); this.CHK_RandomItems.Name = "CHK_RandomItems"; this.CHK_RandomItems.Size = new System.Drawing.Size(119, 17); this.CHK_RandomItems.TabIndex = 330; @@ -1993,7 +2003,7 @@ private void InitializeComponent() this.Tab_Trainer1.Controls.Add(this.CHK_ForceFullyEvolved); this.Tab_Trainer1.Location = new System.Drawing.Point(4, 22); this.Tab_Trainer1.Name = "Tab_Trainer1"; - this.Tab_Trainer1.Size = new System.Drawing.Size(300, 137); + this.Tab_Trainer1.Size = new System.Drawing.Size(349, 137); this.Tab_Trainer1.TabIndex = 2; this.Tab_Trainer1.Text = "Trainer"; this.Tab_Trainer1.UseVisualStyleBackColor = true; @@ -2041,7 +2051,7 @@ private void InitializeComponent() // // L_MinPKM // - this.L_MinPKM.Location = new System.Drawing.Point(191, 3); + this.L_MinPKM.Location = new System.Drawing.Point(235, 3); this.L_MinPKM.Name = "L_MinPKM"; this.L_MinPKM.Size = new System.Drawing.Size(60, 20); this.L_MinPKM.TabIndex = 338; @@ -2050,7 +2060,7 @@ private void InitializeComponent() // // L_MaxPKM // - this.L_MaxPKM.Location = new System.Drawing.Point(191, 24); + this.L_MaxPKM.Location = new System.Drawing.Point(235, 24); this.L_MaxPKM.Name = "L_MaxPKM"; this.L_MaxPKM.Size = new System.Drawing.Size(60, 20); this.L_MaxPKM.TabIndex = 337; @@ -2059,7 +2069,7 @@ private void InitializeComponent() // // NUD_RMin // - this.NUD_RMin.Location = new System.Drawing.Point(257, 5); + this.NUD_RMin.Location = new System.Drawing.Point(301, 5); this.NUD_RMin.Maximum = new decimal(new int[] { 6, 0, @@ -2081,7 +2091,7 @@ private void InitializeComponent() // // NUD_RMax // - this.NUD_RMax.Location = new System.Drawing.Point(257, 26); + this.NUD_RMax.Location = new System.Drawing.Point(301, 26); this.NUD_RMax.Maximum = new decimal(new int[] { 6, 0, @@ -2116,8 +2126,6 @@ private void InitializeComponent() // this.CHK_TypeTheme.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_TypeTheme.AutoSize = true; - this.CHK_TypeTheme.Checked = true; - this.CHK_TypeTheme.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 33); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); @@ -2163,37 +2171,108 @@ private void InitializeComponent() this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; // - // CB_Mode - // - this.CB_Mode.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_Mode.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Mode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_Mode.FormattingEnabled = true; - this.CB_Mode.Items.AddRange(new object[] { - "Single", - "Double", - "Multi", - "3", - "4"}); - this.CB_Mode.Location = new System.Drawing.Point(214, 107); - this.CB_Mode.Name = "CB_Mode"; - this.CB_Mode.Size = new System.Drawing.Size(94, 21); - this.CB_Mode.TabIndex = 452; - // - // L_Mode - // - this.L_Mode.AutoSize = true; - this.L_Mode.Location = new System.Drawing.Point(169, 110); - this.L_Mode.Name = "L_Mode"; - this.L_Mode.Size = new System.Drawing.Size(37, 13); - this.L_Mode.TabIndex = 453; - this.L_Mode.Text = "Mode:"; + // GB_AIBits + // + this.GB_AIBits.Controls.Add(this.CHK_AI7); + this.GB_AIBits.Controls.Add(this.CHK_AI6); + this.GB_AIBits.Controls.Add(this.CHK_AI5); + this.GB_AIBits.Controls.Add(this.CHK_AI4); + this.GB_AIBits.Controls.Add(this.CHK_AI3); + this.GB_AIBits.Controls.Add(this.CHK_AI2); + this.GB_AIBits.Controls.Add(this.CHK_AI1); + this.GB_AIBits.Controls.Add(this.CHK_AI0); + this.GB_AIBits.Location = new System.Drawing.Point(257, 2); + this.GB_AIBits.Name = "GB_AIBits"; + this.GB_AIBits.Size = new System.Drawing.Size(100, 161); + this.GB_AIBits.TabIndex = 464; + this.GB_AIBits.TabStop = false; + this.GB_AIBits.Text = "AI Bits"; + // + // CHK_AI6 + // + this.CHK_AI6.AutoSize = true; + this.CHK_AI6.Location = new System.Drawing.Point(13, 119); + this.CHK_AI6.Name = "CHK_AI6"; + this.CHK_AI6.Size = new System.Drawing.Size(88, 17); + this.CHK_AI6.TabIndex = 458; + this.CHK_AI6.Text = "PokeChange"; + this.CHK_AI6.UseVisualStyleBackColor = true; + // + // CHK_AI5 + // + this.CHK_AI5.AutoSize = true; + this.CHK_AI5.Location = new System.Drawing.Point(13, 105); + this.CHK_AI5.Name = "CHK_AI5"; + this.CHK_AI5.Size = new System.Drawing.Size(80, 17); + this.CHK_AI5.TabIndex = 457; + this.CHK_AI5.Text = "BattleRoyal"; + this.CHK_AI5.UseVisualStyleBackColor = true; + // + // CHK_AI4 + // + this.CHK_AI4.AutoSize = true; + this.CHK_AI4.Location = new System.Drawing.Point(13, 91); + this.CHK_AI4.Name = "CHK_AI4"; + this.CHK_AI4.Size = new System.Drawing.Size(83, 17); + this.CHK_AI4.TabIndex = 456; + this.CHK_AI4.Text = "NoWhiteout"; + this.CHK_AI4.UseVisualStyleBackColor = true; + // + // CHK_AI3 + // + this.CHK_AI3.AutoSize = true; + this.CHK_AI3.Location = new System.Drawing.Point(13, 77); + this.CHK_AI3.Name = "CHK_AI3"; + this.CHK_AI3.Size = new System.Drawing.Size(65, 17); + this.CHK_AI3.TabIndex = 455; + this.CHK_AI3.Text = "Doubles"; + this.CHK_AI3.UseVisualStyleBackColor = true; + // + // CHK_AI2 + // + this.CHK_AI2.AutoSize = true; + this.CHK_AI2.Location = new System.Drawing.Point(13, 51); + this.CHK_AI2.Name = "CHK_AI2"; + this.CHK_AI2.Size = new System.Drawing.Size(56, 17); + this.CHK_AI2.TabIndex = 454; + this.CHK_AI2.Text = "Expert"; + this.CHK_AI2.UseVisualStyleBackColor = true; + // + // CHK_AI1 + // + this.CHK_AI1.AutoSize = true; + this.CHK_AI1.Location = new System.Drawing.Point(13, 37); + this.CHK_AI1.Name = "CHK_AI1"; + this.CHK_AI1.Size = new System.Drawing.Size(57, 17); + this.CHK_AI1.TabIndex = 453; + this.CHK_AI1.Text = "Strong"; + this.CHK_AI1.UseVisualStyleBackColor = true; + // + // CHK_AI0 + // + this.CHK_AI0.AutoSize = true; + this.CHK_AI0.Location = new System.Drawing.Point(13, 23); + this.CHK_AI0.Name = "CHK_AI0"; + this.CHK_AI0.Size = new System.Drawing.Size(52, 17); + this.CHK_AI0.TabIndex = 452; + this.CHK_AI0.Text = "Basic"; + this.CHK_AI0.UseVisualStyleBackColor = true; + // + // CHK_AI7 + // + this.CHK_AI7.AutoSize = true; + this.CHK_AI7.Location = new System.Drawing.Point(13, 133); + this.CHK_AI7.Name = "CHK_AI7"; + this.CHK_AI7.Size = new System.Drawing.Size(46, 17); + this.CHK_AI7.TabIndex = 459; + this.CHK_AI7.Text = "Item"; + this.CHK_AI7.UseVisualStyleBackColor = true; // // SMTE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(580, 315); + this.ClientSize = new System.Drawing.Size(631, 315); this.Controls.Add(this.TC_trpoke); this.Controls.Add(this.L_Team); this.Controls.Add(this.PB_Team1); @@ -2247,7 +2326,6 @@ private void InitializeComponent() this.FLP_HPType.ResumeLayout(false); this.Tab_Moves.ResumeLayout(false); this.GB_Moves.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.NUD_AI)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_NumPoke)).EndInit(); this.TC_trdata.ResumeLayout(false); this.Tab_Trainer.ResumeLayout(false); @@ -2268,13 +2346,14 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).EndInit(); + this.GB_AIBits.ResumeLayout(false); + this.GB_AIBits.PerformLayout(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.ComboBox CB_TrainerID; - private System.Windows.Forms.Label L_AI; private System.Windows.Forms.Label L_Money; private System.Windows.Forms.ComboBox CB_Money; private System.Windows.Forms.Label L_Trainer_Class; @@ -2328,7 +2407,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_Move3; private System.Windows.Forms.GroupBox GB_Moves; private System.Windows.Forms.NumericUpDown NUD_NumPoke; - private System.Windows.Forms.NumericUpDown NUD_AI; private System.Windows.Forms.TextBox TB_TrainerName; private System.Windows.Forms.Label L_TrainerName; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel7; @@ -2436,6 +2514,15 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_ReplaceMega; private System.Windows.Forms.Label L_Mode; private System.Windows.Forms.ComboBox CB_Mode; + private System.Windows.Forms.GroupBox GB_AIBits; + private System.Windows.Forms.CheckBox CHK_AI6; + private System.Windows.Forms.CheckBox CHK_AI5; + private System.Windows.Forms.CheckBox CHK_AI4; + private System.Windows.Forms.CheckBox CHK_AI3; + private System.Windows.Forms.CheckBox CHK_AI2; + private System.Windows.Forms.CheckBox CHK_AI1; + private System.Windows.Forms.CheckBox CHK_AI0; + private System.Windows.Forms.CheckBox CHK_AI7; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 388c2f782d..eb2492fb75 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -26,6 +26,7 @@ public partial class SMTE : Form private static Dictionary MegaDictionary; private int index = -1; private PictureBox[] pba; + private CheckBox[] AIBits; private readonly byte[][] trclass, trdata, trpoke; private readonly string[] abilitylist = Main.Config.getText(TextName.AbilityNames); @@ -229,7 +230,8 @@ private void Setup() specieslist[0] = "---"; abilitylist[0] = itemlist[0] = movelist[0] = "(None)"; - pba = new[] { PB_Team1, PB_Team2, PB_Team3, PB_Team4, PB_Team5, PB_Team6 }; + pba = new[] {PB_Team1, PB_Team2, PB_Team3, PB_Team4, PB_Team5, PB_Team6}; + AIBits = new[] {CHK_AI0, CHK_AI1, CHK_AI2, CHK_AI3, CHK_AI4, CHK_AI5, CHK_AI6, CHK_AI7}; CB_Species.Items.Clear(); foreach (string s in specieslist) @@ -411,7 +413,7 @@ private void PopulateFieldsTD7(trdata7 tr) CB_Item_4.SelectedIndex = tr.Item4; CB_Money.SelectedIndex = tr.Money; CB_Mode.SelectedIndex = (int)tr.Mode; - NUD_AI.Value = tr.AI; + LoadAIBits((uint)tr.AI); CHK_Flag.Checked = tr.Flag; PopulateTeam(tr); } @@ -426,10 +428,24 @@ private void PrepareTR7(trdata7 tr) tr.Item4 = CB_Item_4.SelectedIndex; tr.Money = CB_Money.SelectedIndex; tr.Mode = (BattleMode)CB_Mode.SelectedIndex; - tr.AI = (int)NUD_AI.Value; + tr.AI = (int)SaveAIBits(); tr.Flag = CHK_Flag.Checked; } + private void LoadAIBits(uint val) + { + for (int i = 0; i < AIBits.Length; i++) + AIBits[i].Checked = ((val >> i) & 1) == 1; + } + + private uint SaveAIBits() + { + uint val = 0; + for (int i = 0; i < AIBits.Length; i++) + val |= AIBits[i].Checked ? 1u << i : 0; + return val; + } + protected override void OnFormClosing(FormClosingEventArgs e) { SaveEntry(); @@ -757,7 +773,7 @@ private void B_Randomize_Click(object sender, EventArgs e) if (CHK_MaxDiffPKM.Checked) pk.IVs = new[] {31, 31, 31, 31, 31, 31}; if (CHK_MaxAI.Checked) - tr.AI |= 7; + tr.AI |= (int)(TrainerAI.Basic | TrainerAI.Strong | TrainerAI.Expert | TrainerAI.PokeChange); if (CHK_ForceFullyEvolved.Checked && pk.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(pk.Species)) { From 263f7ca9099c99ee582bfd7196fac23fa5209bb4 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 4 May 2019 22:11:07 -0700 Subject: [PATCH 143/191] Add advanced evo/move based personal randomization nonfunctional/nontested --- pk3DS.Core/Game/GameConfig.cs | 16 +++ pk3DS.Core/Randomizers/PersonalRandomizer.cs | 107 ++++++++++++++++++- pk3DS/Main.cs | 1 + pk3DS/Subforms/Gen6/EggMoveEditor6.cs | 2 +- pk3DS/Subforms/Gen6/LevelUpEditor6.cs | 2 +- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 8 +- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 4 +- pk3DS/Subforms/Gen7/PersonalEditor7.cs | 7 +- pk3DS/Subforms/Gen7/TMEditor7.cs | 13 ++- 9 files changed, 142 insertions(+), 18 deletions(-) diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index 8a32be6651..752caeab68 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -122,6 +122,7 @@ public void InitializeAll() InitializeLearnset(); InitializeGameText(); InitializeMoves(); + InitializeEvos(); InitializeGameInfo(); } @@ -167,6 +168,20 @@ public void InitializeMoves() break; } } + public void InitializeEvos() + { + var g = GetGARCData("evolution"); + byte[][] d = g.Files; + switch (Generation) + { + case 6: + Evolutions = d.Select(z => new EvolutionSet6(z)).ToArray(); + break; + case 7: + Evolutions = d.Select(z => new EvolutionSet7(z)).ToArray(); + break; + } + } private void InitializeGameInfo() { @@ -247,6 +262,7 @@ public string GetGARCFileName(string requestedGARC) public Learnset[] Learnsets { get; private set; } public string[][] GameTextStrings { get; private set; } public Move[] Moves { get; private set; } + public EvolutionSet[] Evolutions { get; private set; } public bool XY => Version == GameVersion.XY; public bool ORAS => Version == GameVersion.ORAS || Version == GameVersion.ORASDEMO; diff --git a/pk3DS.Core/Randomizers/PersonalRandomizer.cs b/pk3DS.Core/Randomizers/PersonalRandomizer.cs index 71d6e3c8d7..78ef1fe723 100644 --- a/pk3DS.Core/Randomizers/PersonalRandomizer.cs +++ b/pk3DS.Core/Randomizers/PersonalRandomizer.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using pk3DS.Core.Structures; using pk3DS.Core.Structures.PersonalInfo; namespace pk3DS.Core.Randomizers @@ -41,6 +42,14 @@ public class PersonalRandomizer : IRandomizer public bool ModifyEggGroup = true; public decimal SameEggGroupChance = 50; + private const bool Advanced = false; + private const bool TMInheritance = false; + private const bool ModifyLearnsetSmartly = false; + + public ushort[] MoveIDsTMs { private get; set; } + public Move[] Moves => Game.Moves; + public EvolutionSet[] Evos => Game.Evolutions; + public PersonalRandomizer(PersonalInfo[] table, GameConfig game) { Game = game; @@ -56,15 +65,72 @@ public PersonalRandomizer(PersonalInfo[] table, GameConfig game) public void Execute() { - for (var i = 0; i < Table.Length; i++) + for (var i = 1; i < Table.Length; i++) Randomize(Table[i], i); + + if (TMInheritance) + PropagateTMs(Table, Evos); + } + + private void PropagateTMs(PersonalInfo[] table, EvolutionSet[] evos) + { + int specCount = Game.MaxSpeciesID; + var HandledIndexes = new HashSet(); + + for (int species = 1; species <= specCount; species++) + { + var entry = table[species]; + PropagateDown(entry, species, 0); + for (int form = 0; form < entry.FormeCount; form++) + PropagateDown(entry, species, form); + } + + void PropagateDown(PersonalInfo pi, int species, int form) + { + int index = pi.FormeIndex(species, form); + if (index == species && form != 0) + return; + + if (index >= evos.Length) + index = species; + PropagateDownIndex(pi, index); + } + + void PropagateDownIndex(PersonalInfo pi, int index) + { + if (HandledIndexes.Contains(index)) + return; + + var evoList = evos[index]; + foreach (var evo in evoList.PossibleEvolutions.Where(z => z.Species != 0)) + { + var espec = evo.Species; + var eform = evo.Form; + var evoIndex = table[espec].FormeIndex(espec, eform); + if (evoIndex >= table.Length) + continue; + + if (!HandledIndexes.Contains(evoIndex)) + table[evoIndex].TMHM = pi.TMHM; + else // pre-evolution encountered! take the higher evolution's TM's since they have been propagated up already... + pi.TMHM = table[evoIndex].TMHM; + + HandledIndexes.Add(evoIndex); + PropagateDownIndex(pi, evoIndex); // recurse for the rest of the evo chain + } + } } public void Randomize(PersonalInfo z, int index) { // Fiddle with Learnsets if (ModifyLearnsetTM || ModifyLearnsetHM) - RandomizeTMHM(z); + { + if (!ModifyLearnsetSmartly) + RandomizeTMHMSimple(z); + else + RandomizeTMHMAdvanced(z); + } if (ModifyLearnsetTypeTutors) RandomizeTypeTutors(z, index); if (ModifyLearnsetMoveTutors) @@ -85,7 +151,42 @@ public void Randomize(PersonalInfo z, int index) z.CatchRate = rnd.Next(3, 251); // Random Catch Rate between 3 and 250. } - private void RandomizeTMHM(PersonalInfo z) + private void RandomizeTMHMAdvanced(PersonalInfo z) + { + var tms = z.TMHM; + var types = z.Types; + + bool CanLearn(Move m) + { + var type = m.Type; + bool typeMatch = types.Any(t => t == type); + // todo: how do I learn move? + return rnd.Next(0, 100) < LearnTMPercent; + } + + if (ModifyLearnsetTM) + { + for (int j = 0; j < tmcount; j++) + { + var moveID = MoveIDsTMs[j]; + var move = Moves[moveID]; + tms[j] = CanLearn(move); + } + } + if (ModifyLearnsetHM) + { + for (int j = tmcount; j < tms.Length; j++) + { + var moveID = MoveIDsTMs[j]; + var move = Moves[moveID]; + tms[j] = CanLearn(move); + } + } + + z.TMHM = tms; + } + + private void RandomizeTMHMSimple(PersonalInfo z) { var tms = z.TMHM; diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index a728f61e60..327e24afc3 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -757,6 +757,7 @@ private void B_Evolution_Click(object sender, EventArgs e) break; } g.Files = d; + Config.InitializeEvos(); g.Save(); }).Start(); } diff --git a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs index 677cd71195..103f1a376e 100644 --- a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs @@ -108,7 +108,7 @@ private void B_RandAll_Click(object sender, EventArgs e) ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 }; ushort[] TMs = { }; if (CHK_HMs.Checked && Main.ExeFSPath != null) - TMHMEditor6.getTMHMList(Main.Config.ORAS, ref TMs, ref HMs); + TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs); List banned = new List { 165, 621 }; // Struggle, Hyperspace Fury if (!CHK_HMs.Checked) diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs index ae55f2d9c0..2cfd3285a5 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs @@ -133,7 +133,7 @@ private void B_RandAll_Click(object sender, EventArgs e) ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 }; ushort[] TMs = {}; if (CHK_HMs.Checked && Main.ExeFSPath != null) - TMHMEditor6.getTMHMList(Main.Config.ORAS, ref TMs, ref HMs); + TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs); List banned = new List {165, 621}; // Struggle, Hyperspace Fury if (!CHK_HMs.Checked) diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index 784b91d1a2..ba2f17b810 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -35,6 +35,7 @@ public PersonalEditor6(byte[][] infiles) abilities[0] = items[0] = moves[0] = ""; string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID); species = Main.Config.Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal); + TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs); Setup(); //Turn string resources into arrays CB_Species.SelectedIndex = 1; @@ -78,13 +79,11 @@ public PersonalEditor6(byte[][] infiles) private readonly ushort[] tutor4 = { 380, 388, 180, 495, 270, 271, 478, 472, 283, 200, 278, 289, 446, 214, 285 }; private readonly int[] baseForms, formVal; + private readonly ushort[] TMs, HMs; int entry = -1; #endregion private void Setup() { - ushort[] TMs = new ushort[0]; - ushort[] HMs = new ushort[0]; - TMHMEditor6.getTMHMList(Main.Config.ORAS, ref TMs, ref HMs); CLB_TMHM.Items.Clear(); int hmcount = Main.Config.ORAS ? 7 : 5; @@ -364,7 +363,8 @@ private void B_Randomize_Click(object sender, EventArgs e) SameTypeChance = NUD_TypePercent.Value, SameEggGroupChance = NUD_Egg.Value, StatDeviation = NUD_StatDev.Value, - AllowWonderGuard = CHK_WGuard.Checked + AllowWonderGuard = CHK_WGuard.Checked, + MoveIDsTMs = TMs, }; rnd.Execute(); Main.SpeciesStat.Select(z => z.Write()).ToArray().CopyTo(files, 0); diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index 68b859ea00..e27d533ce6 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -203,8 +203,10 @@ private void B_RandomTM_Click(object sender, EventArgs e) WinFormsUtil.Alert("Randomized!"); } - internal static void getTMHMList(bool oras, ref ushort[] TMs, ref ushort[] HMs) + internal static void getTMHMList(bool oras, out ushort[] TMs, out ushort[] HMs) { + TMs = new ushort[0]; + HMs = new ushort[0]; if (Main.ExeFSPath == null) return; string[] files = Directory.GetFiles(Main.ExeFSPath); if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) return; diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.cs index 821ae66364..950752e8af 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.cs @@ -30,7 +30,8 @@ public PersonalEditor7(byte[][] infiles) abilities[0] = items[0] = moves[0] = ""; var altForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID); entryNames = Main.Config.Personal.getPersonalEntryList(altForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal); - + TMs = TMEditor7.getTMHMList(); + Setup(); CB_Species.SelectedIndex = 1; RandSettings.GetFormSettings(this, TP_Randomizer.Controls); @@ -72,12 +73,11 @@ public PersonalEditor7(byte[][] infiles) }; private readonly int[] baseForms, formVal; + private readonly ushort[] TMs; int entry = -1; #endregion private void Setup() { - ushort[] TMs = new ushort[0]; - TMEditor7.getTMHMList(ref TMs); CLB_TM.Items.Clear(); if (TMs.Length == 0) // No ExeFS to grab TMs from. @@ -350,6 +350,7 @@ private void B_Randomize_Click(object sender, EventArgs e) StatDeviation = NUD_StatDev.Value, AllowWonderGuard = CHK_WGuard.Checked }; + rnd.Execute(); Main.SpeciesStat.Select(z => z.Write()).ToArray().CopyTo(files, 0); diff --git a/pk3DS/Subforms/Gen7/TMEditor7.cs b/pk3DS/Subforms/Gen7/TMEditor7.cs index 2b9f02d5cd..6ed7b16a82 100644 --- a/pk3DS/Subforms/Gen7/TMEditor7.cs +++ b/pk3DS/Subforms/Gen7/TMEditor7.cs @@ -133,14 +133,17 @@ private void B_RandomTM_Click(object sender, EventArgs e) WinFormsUtil.Alert("Randomized!"); } - internal static void getTMHMList(ref ushort[] TMs) + internal static ushort[] getTMHMList() { - if (Main.ExeFSPath == null) return; + if (Main.ExeFSPath == null) + return new ushort[0]; string[] files = Directory.GetFiles(Main.ExeFSPath); - if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) return; + if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) + return new ushort[0]; byte[] data = File.ReadAllBytes(files[0]); int dataoffset = Util.IndexOfBytes(data, Signature, 0x400000, 0) + Signature.Length; - if (data.Length % 0x200 != 0) return; + if (data.Length % 0x200 != 0) + return new ushort[0]; if (Main.Config.USUM) dataoffset += 0x22; @@ -148,7 +151,7 @@ internal static void getTMHMList(ref ushort[] TMs) for (int i = 0; i < 100; i++) // TMs stored sequentially tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); - TMs = tms.ToArray(); + return tms.ToArray(); } } } \ No newline at end of file From 775b065c72b55c754e6cfc78c00482c235b40996 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 19 May 2019 23:29:39 -0700 Subject: [PATCH 144/191] Update warp documentation Same as gen5, thanks Xanatus ! --- .../Subforms/Gen6/Experimental/OWSEStructs.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs index 988418d811..a4ad89e2df 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs @@ -650,25 +650,29 @@ public class EntityWarp public int DestinationTileIndex { get => BitConverter.ToUInt16(Raw, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x02); } // Not sure if these are widths or face direction - public int WX { get => Raw[0x04]; set => Raw[0x4] = (byte)value; } - public int WY { get => Raw[0x05]; set => Raw[0x5] = (byte)value; } + public byte FaceDirection { get => Raw[0x04]; set => Raw[0x4] = (byte)value; } + public byte SceneTransitionEffect { get => Raw[0x05]; set => Raw[0x5] = (byte)value; } // Either 0 or 1, only in X/Y - public int U06 { get => BitConverter.ToUInt16(Raw, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x06); } + // 0: use x,z,y + // 1: use x,y,{unused} + public ushort CoordinateType { get => BitConverter.ToUInt16(Raw, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x06); } // Coordinates have some upper-bit usage it seems... - public int X { get => BitConverter.ToUInt16(Raw, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x08); } - public int Z { get => BitConverter.ToInt16(Raw, 0x0A); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0A); } - public int Y { get => BitConverter.ToUInt16(Raw, 0x0C); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x0C); } + public short X { get => BitConverter.ToInt16(Raw, 0x08); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x08); } + public short Z { get => BitConverter.ToInt16(Raw, 0x0A); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0A); } + public short Y { get => BitConverter.ToInt16(Raw, 0x0C); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0C); } public decimal PX => (decimal)X / 18; public decimal PY => (decimal)Y / 18; // Stretches RIGHT - public int Width { get => BitConverter.ToInt16(Raw, 0x0E); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0E); } + public short Width { get => BitConverter.ToInt16(Raw, 0x0E); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0E); } // Stretches DOWN - public int Height { get => BitConverter.ToInt16(Raw, 0x10); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } - // Not sure. - public int U12 { get => BitConverter.ToInt16(Raw, 0x12); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x12); } + public short Height { get => BitConverter.ToInt16(Raw, 0x10); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } + // 0-bidirectional + // 1-send only + // 2-receive only + public ushort Directionality { get => BitConverter.ToUInt16(Raw, 0x12); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x12); } // 0x14-0x15 Unused // 0x16-0x17 Unused From 94e02d5ffca1ee4e372f6a0f0142e2ae45697eeb Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 21 May 2019 20:37:34 -0700 Subject: [PATCH 145/191] Minor overworld clarifications --- pk3DS/Subforms/Gen6/Experimental/OWSE.cs | 4 +- .../Subforms/Gen6/Experimental/OWSEStructs.cs | 71 +++++++++---------- 2 files changed, 34 insertions(+), 41 deletions(-) diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs index 8fc72fde40..9c0a5aefda 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs @@ -444,8 +444,8 @@ private void SetWarp() var Warp = CurrentZone.Entities.Warps[wEntry]; Warp.DestinationMap = (int)NUD_WMap.Value; Warp.DestinationTileIndex = (int)NUD_WTile.Value; - Warp.X = (int)NUD_WX.Value; - Warp.Y = (int)NUD_WY.Value; + Warp.X = (short)NUD_WX.Value; + Warp.Y = (short)NUD_WY.Value; } private void ChangeTrigger1(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs index a4ad89e2df..5227b1308a 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs @@ -11,7 +11,8 @@ namespace pk3DS #region Game Related Classes public class MapMatrix { - public uint u0; + public ushort u0; + public ushort u1; public ushort uL; public ushort Width, Height; private readonly int Area; @@ -25,26 +26,22 @@ public MapMatrix(byte[][] data) { using (BinaryReader br = new BinaryReader(new MemoryStream(data[0]))) { - u0 = br.ReadUInt32(); + u0 = br.ReadUInt16(); + u1 = br.ReadUInt16(); Width = br.ReadUInt16(); Height = br.ReadUInt16(); + Area = Width*Height; Entries = new Entry[Area]; EntryList = new ushort[Area]; for (int i = 0; i < Area; i++) - { EntryList[i] = br.ReadUInt16(); - } if (br.BaseStream.Position != br.BaseStream.Length) - { uL = br.ReadUInt16(); - } } if (data.Length > 1) - { ParseUnk(UnkData = data[1]); - } } public byte[] Write() @@ -88,9 +85,7 @@ public Bitmap Preview(int Scale, int ColorShift) using (Graphics g = Graphics.FromImage(img)) { for (int i = 0; i < Area; i++) - { - g.DrawImage(EntryImages[i], new Point(i * EntryImages[0].Width % img.Width, EntryImages[0].Height * (i / Width))); - } + g.DrawImage(EntryImages[i], new Point(i * EntryImages[0].Width % img.Width, EntryImages[0].Height * (i / Width))); } return img; @@ -343,35 +338,33 @@ public int BattleBackground // 7-13 set => BitConverter.GetBytes((ushort)(((value & 0x7F) << 7) | (BitConverter.ToUInt16(Data, 0x1E) & ~0x3F80))).CopyTo(Data, 0x1E); } - private int _20 { get => BitConverter.ToUInt16(Data, 0x20); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x20); } - public int MapChange { get => _20 & 0x1F; set => _20 = (_20 & ~0x1F) | value; } + private uint _20 { get => BitConverter.ToUInt32(Data, 0x20); set => BitConverter.GetBytes(value).CopyTo(Data, 0x20); } + public uint MapChange { get => _20 & 0x1Fu; set => _20 = (_20 & ~0x1Fu) | value; } // ??? 5 - public bool IsBicycleEnable { get => ((_20 >> 10) & 1) == 1; set => _20 = (_20 & ~(1 << 10)) | (value ? 1 << 10 : 0); } - public bool IsRunEnable { get => ((_20 >> 11) & 1) == 1; set => _20 = (_20 & ~(1 << 11)) | (value ? 1 << 11 : 0); } - public bool IsEscapeRopeEnable { get => ((_20 >> 12) & 1) == 1; set => _20 = (_20 & ~(1 << 12)) | (value ? 1 << 12 : 0); } - public bool IsFlyEnable { get => ((_20 >> 13) & 1) == 1; set => _20 = (_20 & ~(1 << 13)) | (value ? 1 << 13 : 0); } - public bool IsBGM { get => ((_20 >> 14) & 1) == 1; set => _20 = (_20 & ~(1 << 14)) | (value ? 1 << 14 : 0); } - public bool IsUnk { get => ((_20 >> 15) & 1) == 1; set => _20 = (_20 & ~(1 << 15)) | (value ? 1 << 15 : 0); } - - // unused - public int _22 { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } - - public int _24 { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); } - public int _26 { get => BitConverter.ToUInt16(Data, 0x26); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); } - - public int _28 { get => BitConverter.ToUInt16(Data, 0x28); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } - - private int X { get => BitConverter.ToInt16(Data, 0x2C); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x2C); } - public int Z { get => BitConverter.ToInt16(Data, 0x2E); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x2E); } - private int Y { get => BitConverter.ToInt16(Data, 0x30); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x30); } - private int X2 { get => BitConverter.ToInt16(Data, 0x32); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x32); } - public int Z2 { get => BitConverter.ToInt16(Data, 0x34); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x34); } - private int Y2 { get => BitConverter.ToInt16(Data, 0x36); set => BitConverter.GetBytes((short)value).CopyTo(Data, 0x36); } - - public float PX { get => (float)X / 18; set => X = (int)(18 * value); } - public float PY { get => (float)Y / 18; set => Y = (int)(18 * value); } - public float PX2 { get => (float)X2 / 18; set => X2 = (int)(18 * value); } - public float PY2 { get => (float)Y2 / 18; set => Y2 = (int)(18 * value); } + public bool IsBicycleEnable { get => ((_20 >> 10) & 1) == 1; set => _20 = (_20 & ~(1u << 10)) | (value ? 1u << 10 : 0); } + public bool IsRunEnable { get => ((_20 >> 11) & 1) == 1; set => _20 = (_20 & ~(1u << 11)) | (value ? 1u << 11 : 0); } + public bool IsEscapeRopeEnable { get => ((_20 >> 12) & 1) == 1; set => _20 = (_20 & ~(1u << 12)) | (value ? 1u << 12 : 0); } + public bool IsFlyEnable { get => ((_20 >> 13) & 1) == 1; set => _20 = (_20 & ~(1u << 13)) | (value ? 1u << 13 : 0); } + public bool IsBGM { get => ((_20 >> 14) & 1) == 1; set => _20 = (_20 & ~(1u << 14)) | (value ? 1u << 14 : 0); } + public bool IsUnk { get => ((_20 >> 15) & 1) == 1; set => _20 = (_20 & ~(1u << 15)) | (value ? 1u << 15 : 0); } + + // unused - camera + public ushort Camera1 { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes(value).CopyTo(Data, 0x22); } + + public ushort Camera2 { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes(value).CopyTo(Data, 0x24); } + public uint CameraFlags { get => BitConverter.ToUInt32(Data, 0x26); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); } + + private short X { get => BitConverter.ToInt16(Data, 0x2C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x2C); } + public short Z { get => BitConverter.ToInt16(Data, 0x2E); set => BitConverter.GetBytes(value).CopyTo(Data, 0x2E); } + private short Y { get => BitConverter.ToInt16(Data, 0x30); set => BitConverter.GetBytes(value).CopyTo(Data, 0x30); } + private short X2 { get => BitConverter.ToInt16(Data, 0x32); set => BitConverter.GetBytes(value).CopyTo(Data, 0x32); } + public short Z2 { get => BitConverter.ToInt16(Data, 0x34); set => BitConverter.GetBytes(value).CopyTo(Data, 0x34); } + private short Y2 { get => BitConverter.ToInt16(Data, 0x36); set => BitConverter.GetBytes(value).CopyTo(Data, 0x36); } + + public float PX { get => (float)X / 18; set => X = (short)(18 * value); } + public float PY { get => (float)Y / 18; set => Y = (short)(18 * value); } + public float PX2 { get => (float)X2 / 18; set => X2 = (short)(18 * value); } + public float PY2 { get => (float)Y2 / 18; set => Y2 = (short)(18 * value); } public ZoneData(byte[] data) { From 7b34bc4cdd8c514714f9a1302d7abd810993148a Mon Sep 17 00:00:00 2001 From: sora10pls Date: Sun, 30 Jun 2019 22:42:22 -0400 Subject: [PATCH 146/191] Add X Item Mart blacklist option --- pk3DS/Subforms/Gen6/MartEditor6.Designer.cs | 31 ++++++++++---- pk3DS/Subforms/Gen6/MartEditor6.cs | 2 + pk3DS/Subforms/Gen7/MartEditor7.Designer.cs | 27 +++++++++--- pk3DS/Subforms/Gen7/MartEditor7.cs | 10 +++++ pk3DS/Subforms/Gen7/MartEditor7.resx | 6 --- pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs | 42 +++++++++++++------ pk3DS/Subforms/Gen7/MartEditor7UU.cs | 10 +++++ pk3DS/Subforms/Gen7/MartEditor7UU.resx | 9 ---- 8 files changed, 95 insertions(+), 42 deletions(-) diff --git a/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs index 2761083f13..0600b33079 100644 --- a/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.B_Save = new System.Windows.Forms.Button(); this.B_Cancel = new System.Windows.Forms.Button(); + this.CHK_XItems = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); this.SuspendLayout(); // @@ -61,7 +62,7 @@ private void InitializeComponent() this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgv.Location = new System.Drawing.Point(12, 33); this.dgv.Name = "dgv"; - this.dgv.Size = new System.Drawing.Size(300, 284); + this.dgv.Size = new System.Drawing.Size(300, 287); this.dgv.TabIndex = 1; // // L_Mart @@ -75,7 +76,7 @@ private void InitializeComponent() // // B_Randomize // - this.B_Randomize.Location = new System.Drawing.Point(12, 326); + this.B_Randomize.Location = new System.Drawing.Point(12, 329); this.B_Randomize.Name = "B_Randomize"; this.B_Randomize.Size = new System.Drawing.Size(87, 23); this.B_Randomize.TabIndex = 3; @@ -85,7 +86,7 @@ private void InitializeComponent() // // B_Save // - this.B_Save.Location = new System.Drawing.Point(244, 326); + this.B_Save.Location = new System.Drawing.Point(244, 329); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(68, 23); this.B_Save.TabIndex = 4; @@ -95,7 +96,7 @@ private void InitializeComponent() // // B_Cancel // - this.B_Cancel.Location = new System.Drawing.Point(170, 326); + this.B_Cancel.Location = new System.Drawing.Point(170, 329); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(68, 23); this.B_Cancel.TabIndex = 5; @@ -103,11 +104,24 @@ private void InitializeComponent() this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // - // Mart + // CHK_XItems + // + this.CHK_XItems.AutoSize = true; + this.CHK_XItems.Checked = true; + this.CHK_XItems.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_XItems.Location = new System.Drawing.Point(13, 356); + this.CHK_XItems.Name = "CHK_XItems"; + this.CHK_XItems.Size = new System.Drawing.Size(200, 17); + this.CHK_XItems.TabIndex = 304; + this.CHK_XItems.Text = "Don\'t Randomize X Items (Speedrun)"; + this.CHK_XItems.UseVisualStyleBackColor = true; + // + // MartEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(324, 361); + this.ClientSize = new System.Drawing.Size(324, 381); + this.Controls.Add(this.CHK_XItems); this.Controls.Add(this.B_Cancel); this.Controls.Add(this.B_Save); this.Controls.Add(this.B_Randomize); @@ -115,8 +129,8 @@ private void InitializeComponent() this.Controls.Add(this.dgv); this.Controls.Add(this.CB_Location); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(340, 400); - this.MinimumSize = new System.Drawing.Size(340, 400); + this.MaximumSize = new System.Drawing.Size(340, 420); + this.MinimumSize = new System.Drawing.Size(340, 420); this.Name = "MartEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Mart Editor"; @@ -134,5 +148,6 @@ private void InitializeComponent() private System.Windows.Forms.Button B_Randomize; private System.Windows.Forms.Button B_Save; private System.Windows.Forms.Button B_Cancel; + private System.Windows.Forms.CheckBox CHK_XItems; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/MartEditor6.cs b/pk3DS/Subforms/Gen6/MartEditor6.cs index fd5c6ffdd9..4bebadf1d5 100644 --- a/pk3DS/Subforms/Gen6/MartEditor6.cs +++ b/pk3DS/Subforms/Gen6/MartEditor6.cs @@ -193,6 +193,8 @@ private void B_Randomize_Click(object sender, EventArgs e) for (int r = 0; r < dgv.Rows.Count; r++) { int currentItem = Array.IndexOf(itemlist, dgv.Rows[r].Cells[1].Value); + if (CHK_XItems.Checked && MartEditor7.XItems.Contains(currentItem)) + continue; if (MartEditor7.BannedItems.Contains(currentItem)) continue; dgv.Rows[r].Cells[1].Value = itemlist[validItems[ctr++]]; diff --git a/pk3DS/Subforms/Gen7/MartEditor7.Designer.cs b/pk3DS/Subforms/Gen7/MartEditor7.Designer.cs index eaf5691dc7..f27aa13f90 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7.Designer.cs @@ -28,8 +28,8 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.CB_Location = new System.Windows.Forms.ComboBox(); this.dgv = new System.Windows.Forms.DataGridView(); this.dgvIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -45,6 +45,7 @@ private void InitializeComponent() this.dgvIndexBP = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dgvItemBP = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.dgvPriceBP = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.CHK_XItems = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvbp)).BeginInit(); this.SuspendLayout(); @@ -76,8 +77,8 @@ private void InitializeComponent() // // dgvIndex // - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dgvIndex.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dgvIndex.DefaultCellStyle = dataGridViewCellStyle1; this.dgvIndex.HeaderText = "Index"; this.dgvIndex.Name = "dgvIndex"; this.dgvIndex.ReadOnly = true; @@ -176,8 +177,8 @@ private void InitializeComponent() // // dgvIndexBP // - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dgvIndexBP.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dgvIndexBP.DefaultCellStyle = dataGridViewCellStyle2; this.dgvIndexBP.HeaderText = "Index"; this.dgvIndexBP.MaxInputLength = 3; this.dgvIndexBP.Name = "dgvIndexBP"; @@ -198,11 +199,24 @@ private void InitializeComponent() this.dgvPriceBP.Name = "dgvPriceBP"; this.dgvPriceBP.Width = 65; // + // CHK_XItems + // + this.CHK_XItems.AutoSize = true; + this.CHK_XItems.Checked = true; + this.CHK_XItems.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_XItems.Location = new System.Drawing.Point(106, 330); + this.CHK_XItems.Name = "CHK_XItems"; + this.CHK_XItems.Size = new System.Drawing.Size(200, 17); + this.CHK_XItems.TabIndex = 304; + this.CHK_XItems.Text = "Don\'t Randomize X Items (Speedrun)"; + this.CHK_XItems.UseVisualStyleBackColor = true; + // // MartEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(639, 361); + this.Controls.Add(this.CHK_XItems); this.Controls.Add(this.dgvbp); this.Controls.Add(this.B_RandomizeBP); this.Controls.Add(this.label1); @@ -242,5 +256,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn dgvIndexBP; private System.Windows.Forms.DataGridViewComboBoxColumn dgvItemBP; private System.Windows.Forms.DataGridViewTextBoxColumn dgvPriceBP; + private System.Windows.Forms.CheckBox CHK_XItems; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MartEditor7.cs b/pk3DS/Subforms/Gen7/MartEditor7.cs index 0cf9cc99f8..56f22b7fe0 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7.cs @@ -184,6 +184,14 @@ private void setList() 692, 693, 694, 701, 737 }; + /// + /// All X Items usable in Generations 6 and 7. Speedrunners utilize these Items a lot, so make sure they are still available. + /// + internal static readonly HashSet XItems = new HashSet + { + 055, 056, 057, 058, 059, 060, 061, 062 + }; + private void B_Randomize_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize mart inventories?")) @@ -202,6 +210,8 @@ private void B_Randomize_Click(object sender, EventArgs e) for (int r = 0; r < dgv.Rows.Count; r++) { int currentItem = Array.IndexOf(itemlist, dgv.Rows[r].Cells[1].Value); + if (CHK_XItems.Checked && XItems.Contains(currentItem)) + continue; if (BannedItems.Contains(currentItem)) continue; dgv.Rows[r].Cells[1].Value = itemlist[validItems[ctr++]]; diff --git a/pk3DS/Subforms/Gen7/MartEditor7.resx b/pk3DS/Subforms/Gen7/MartEditor7.resx index ebef7fda3d..8af5c467a4 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7.resx +++ b/pk3DS/Subforms/Gen7/MartEditor7.resx @@ -123,12 +123,6 @@ True - - True - - - True - True diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs b/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs index 976b8d08f6..39590c178e 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs @@ -28,8 +28,8 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.CB_Location = new System.Windows.Forms.ComboBox(); this.dgv = new System.Windows.Forms.DataGridView(); this.dgvIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -47,6 +47,7 @@ private void InitializeComponent() this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.CHK_XItems = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvbp)).BeginInit(); this.tabControl1.SuspendLayout(); @@ -81,13 +82,13 @@ private void InitializeComponent() this.dgvItem}); this.dgv.Location = new System.Drawing.Point(0, 27); this.dgv.Name = "dgv"; - this.dgv.Size = new System.Drawing.Size(317, 241); + this.dgv.Size = new System.Drawing.Size(317, 265); this.dgv.TabIndex = 1; // // dgvIndex // - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dgvIndex.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dgvIndex.DefaultCellStyle = dataGridViewCellStyle1; this.dgvIndex.HeaderText = "Index"; this.dgvIndex.Name = "dgvIndex"; this.dgvIndex.ReadOnly = true; @@ -112,7 +113,7 @@ private void InitializeComponent() // B_Randomize // this.B_Randomize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.B_Randomize.Location = new System.Drawing.Point(12, 315); + this.B_Randomize.Location = new System.Drawing.Point(12, 336); this.B_Randomize.Name = "B_Randomize"; this.B_Randomize.Size = new System.Drawing.Size(87, 23); this.B_Randomize.TabIndex = 3; @@ -123,7 +124,7 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(265, 315); + this.B_Save.Location = new System.Drawing.Point(265, 336); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(68, 23); this.B_Save.TabIndex = 4; @@ -134,7 +135,7 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(191, 315); + this.B_Cancel.Location = new System.Drawing.Point(191, 336); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(68, 23); this.B_Cancel.TabIndex = 5; @@ -184,8 +185,8 @@ private void InitializeComponent() // // dgvIndexBP // - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dgvIndexBP.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dgvIndexBP.DefaultCellStyle = dataGridViewCellStyle2; this.dgvIndexBP.HeaderText = "Index"; this.dgvIndexBP.MaxInputLength = 3; this.dgvIndexBP.Name = "dgvIndexBP"; @@ -216,7 +217,7 @@ private void InitializeComponent() this.tabControl1.Location = new System.Drawing.Point(12, 12); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(325, 294); + this.tabControl1.Size = new System.Drawing.Size(325, 318); this.tabControl1.TabIndex = 15; // // tabPage1 @@ -227,7 +228,7 @@ private void InitializeComponent() this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(317, 268); + this.tabPage1.Size = new System.Drawing.Size(317, 292); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Poké Mart"; this.tabPage1.UseVisualStyleBackColor = true; @@ -245,11 +246,24 @@ private void InitializeComponent() this.tabPage2.Text = "BP Items"; this.tabPage2.UseVisualStyleBackColor = true; // + // CHK_XItems + // + this.CHK_XItems.AutoSize = true; + this.CHK_XItems.Checked = true; + this.CHK_XItems.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_XItems.Location = new System.Drawing.Point(13, 364); + this.CHK_XItems.Name = "CHK_XItems"; + this.CHK_XItems.Size = new System.Drawing.Size(200, 17); + this.CHK_XItems.TabIndex = 304; + this.CHK_XItems.Text = "Don\'t Randomize X Items (Speedrun)"; + this.CHK_XItems.UseVisualStyleBackColor = true; + // // MartEditor7UU // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(344, 350); + this.ClientSize = new System.Drawing.Size(344, 387); + this.Controls.Add(this.CHK_XItems); this.Controls.Add(this.tabControl1); this.Controls.Add(this.B_Cancel); this.Controls.Add(this.B_Save); @@ -267,6 +281,7 @@ private void InitializeComponent() this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -289,5 +304,6 @@ private void InitializeComponent() private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.CheckBox CHK_XItems; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.cs b/pk3DS/Subforms/Gen7/MartEditor7UU.cs index ab9fd82ef2..38b5071ec8 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.cs +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.cs @@ -198,6 +198,8 @@ private void RandomizeItems() for (int r = 0; r < dgv.Rows.Count; r++) { int currentItem = Array.IndexOf(itemlist, dgv.Rows[r].Cells[1].Value); + if (CHK_XItems.Checked && XItems.Contains(currentItem)) + continue; if (BannedItems.Contains(currentItem)) continue; dgv.Rows[r].Cells[1].Value = itemlist[validItems[ctr++]]; @@ -243,5 +245,13 @@ private void RandomizeBPItems() 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 618, 619, 620, 690, 691, 692, 693, 694, 701, 737 }; + + /// + /// All X Items usable in Generations 6 and 7. Speedrunners utilize these Items a lot, so make sure they are still available. + /// + internal static readonly HashSet XItems = new HashSet + { + 055, 056, 057, 058, 059, 060, 061, 062 + }; } } diff --git a/pk3DS/Subforms/Gen7/MartEditor7UU.resx b/pk3DS/Subforms/Gen7/MartEditor7UU.resx index 2a2ca52b7d..8af5c467a4 100644 --- a/pk3DS/Subforms/Gen7/MartEditor7UU.resx +++ b/pk3DS/Subforms/Gen7/MartEditor7UU.resx @@ -132,13 +132,4 @@ True - - True - - - True - - - True - \ No newline at end of file From 86c8cb9ba5b6665a8d1a9868508cc855d79e2809 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 15 Jul 2019 14:34:19 -0700 Subject: [PATCH 147/191] Fix opower efficacy copy --- pk3DS/Subforms/Gen6/OPower.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pk3DS/Subforms/Gen6/OPower.cs b/pk3DS/Subforms/Gen6/OPower.cs index 68c10dbd5b..6b7d9e49f2 100644 --- a/pk3DS/Subforms/Gen6/OPower.cs +++ b/pk3DS/Subforms/Gen6/OPower.cs @@ -105,8 +105,7 @@ private void setEntry() powerData[entry][0x4] = otherCost; powerData[entry][0xE] = stage; powerData[entry][0xF] = lvlup; - - Array.Copy(powerData[entry], 0x12, BitConverter.GetBytes(efficacy), 0, 2); + BitConverter.GetBytes(efficacy).CopyTo(powerData[entry], 0x12); powerData[entry][0x14] = duration; // sbyte FF = -1 (no duration?) byte usability = (byte)NUD_Usability.Value; @@ -125,4 +124,4 @@ private void formClosing(object sender, FormClosingEventArgs e) File.WriteAllBytes(codebin, exefsData); } } -} \ No newline at end of file +} From ec3ace043e26af9cbfee5df9849b22d4693149b2 Mon Sep 17 00:00:00 2001 From: tom-overton Date: Sat, 5 Oct 2019 18:51:30 -0700 Subject: [PATCH 148/191] Add support for recognizing SuMo and USUM --- pk3DS.Core/CTR/Exheader.cs | 24 +++++++++++++++++- .../romdata/byte/PlainRegion/SuMo.bin | Bin 0 -> 1024 bytes .../romdata/byte/PlainRegion/USUM.bin | Bin 0 -> 1024 bytes pk3DS.Core/Resources/romdata/txt/3dsgames.txt | 6 ++++- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 pk3DS.Core/Resources/romdata/byte/PlainRegion/SuMo.bin create mode 100644 pk3DS.Core/Resources/romdata/byte/PlainRegion/USUM.bin diff --git a/pk3DS.Core/CTR/Exheader.cs b/pk3DS.Core/CTR/Exheader.cs index 7a93359c06..44311ef07a 100644 --- a/pk3DS.Core/CTR/Exheader.cs +++ b/pk3DS.Core/CTR/Exheader.cs @@ -56,7 +56,17 @@ public string GetSerial() public bool isPokemon() { - return isORAS() || isXY(); + return isORAS() || isXY() || isUSUM() || isSuMo(); + } + + public bool isUSUM() + { + return (TitleID & 0xFFFFFFFF) >> 8 == 0x1B50 || (TitleID & 0xFFFFFFFF) >> 8 == 0x1B51; + } + + public bool isSuMo() + { + return (TitleID & 0xFFFFFFFF) >> 8 == 0x1648 || (TitleID & 0xFFFFFFFF) >> 8 == 0x175E; } public bool isORAS() @@ -76,6 +86,18 @@ public string GetPokemonSerial() string name; switch ((TitleID & 0xFFFFFFFF) >> 8) { + case 0x1B51: + name = "A2BA"; // Ultra Moon + break; + case 0x1B50: + name = "A2AA"; // Ultra Sun + break; + case 0x175E: // Moon + name = "BNEA"; + break; + case 0x1648: // Sun + name = "BNDA"; + break; case 0x11C5: //Alpha Sapphire name = "ECLA"; break; diff --git a/pk3DS.Core/Resources/romdata/byte/PlainRegion/SuMo.bin b/pk3DS.Core/Resources/romdata/byte/PlainRegion/SuMo.bin new file mode 100644 index 0000000000000000000000000000000000000000..9e426b38686a87a70f472053eefdc98564e70f8d GIT binary patch literal 1024 zcmb7?ZEu1w6ovgiiwQ878NPKCmqsZL+)H9iQ%hZ%K}(=G+^-)Fx;Rji@$o*V=iYlR z>ln^&Fv2Sz!_f6s5oroz+a?oY6UVZMRFZE->p!xYD6&sl@Ui8PJBv&W7gBSXC>O>{ z06fT9<6#l2!-3igmWtdB)Gp;UN@s82fMJme|d%4;c2-I6@eA+(46f6q?GZR}l2% zr|@}o1xE88G>u}q=a6a|b5<4ng{IZutY;((rAnS2%#2se{JJl~uM@8sX4>4B@AL(F z-~4FlK|5D)DHB6Y3`+#aBJ{wbUH13&DgU|0S>lC35aQlbvzkXUUQoca*i$`-sHI2> zEodsf2K@0*sFJCC08rtnEUTnoRI9@5W14nR9mCkkVHjxe0F_ZCrI7ES^lJ_BJUto< JB{!r0ec!dCHS7QY literal 0 HcmV?d00001 diff --git a/pk3DS.Core/Resources/romdata/byte/PlainRegion/USUM.bin b/pk3DS.Core/Resources/romdata/byte/PlainRegion/USUM.bin new file mode 100644 index 0000000000000000000000000000000000000000..7e122a4a24accaa58a5aa237e57d9f34954fd0bc GIT binary patch literal 1024 zcmb7?ZEJ%t6ovbLMnPT2ir+G0M`(?mb}vv$NMky}G!c!R-LIdbflk}P{CJ;}bMHOZ zZ48%p7~zeNVd#3Bh%|+%ZIc?~?H}1f6xlZ|_|$U9gGJ_s3#qwGlndiE z03PJ5@vw;1<3Q~NOGWMm>X7mp@~ov2(lG76HMWmg4|?^DITt~FTD zQiCcHYG{DswfhqJvg>R2gLPG-HC1dD#{LJnC$>eLCk%&av=GKUH_#*=g{E@u6$AtM zIegvRfYEXQO{16|Ii#A#oK*#XqiHod>jlY5sgkEBGvf_2zaEP4`^;;GnK$?42YrP; zHa}W=(#{QB%EV9;!x{my3O%qIEPKwodt7?yg+UPF!BexEM>Aefz_d70J&LHKND3`z zDt<=%`BbQqseA-b;i)XEq+nF5!c1kF_EEKA9OO6*G*g#zM*6 H Date: Sat, 5 Oct 2019 18:54:42 -0700 Subject: [PATCH 149/191] Add CXI extraction and Trimmed 3DS rebuilding --- pk3DS.Core/CTR/CTR.cs | 27 ++-- pk3DS.Core/CTR/NCCH.cs | 178 ++++++++++++++++++++++ pk3DS.Core/CTR/RomFS.cs | 189 +++++++++++++++++++++++ pk3DS/Main.Designer.cs | 321 ++++++++++++++++++++++------------------ pk3DS/Main.cs | 65 +++++++- 5 files changed, 623 insertions(+), 157 deletions(-) diff --git a/pk3DS.Core/CTR/CTR.cs b/pk3DS.Core/CTR/CTR.cs index 225d76f850..bcfa596752 100644 --- a/pk3DS.Core/CTR/CTR.cs +++ b/pk3DS.Core/CTR/CTR.cs @@ -17,7 +17,7 @@ public class CTRUtil public static bool buildROM(bool Card2, string LOGO_NAME, string EXEFS_PATH, string ROMFS_PATH, string EXHEADER_PATH, string SERIAL_TEXT, string SAVE_PATH, - ProgressBar PB_Show = null, RichTextBox TB_Progress = null) + bool trimmed = false, ProgressBar PB_Show = null, RichTextBox TB_Progress = null) { PB_Show = PB_Show ?? new ProgressBar(); TB_Progress = TB_Progress ?? new RichTextBox(); @@ -37,7 +37,7 @@ public static bool buildROM(bool Card2, string LOGO_NAME, NCCH NCCH = setNCCH(EXEFS_PATH, ROMFS_PATH, EXHEADER_PATH, SERIAL_TEXT, LOGO_NAME, PB_Show, TB_Progress); NCSD NCSD = setNCSD(NCCH, Card2, PB_Show, TB_Progress); - bool success = writeROM(NCSD, SAVE_PATH, PB_Show, TB_Progress); + bool success = writeROM(NCSD, SAVE_PATH, trimmed, PB_Show, TB_Progress); return success; } @@ -62,6 +62,10 @@ internal static NCCH setNCCH(string EXEFS_PATH, string ROMFS_PATH, string EXHEAD NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("XY"); else if (NCCH.exheader.isORAS()) NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("ORAS"); + else if (NCCH.exheader.isSuMo()) + NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("SuMo"); + else if (NCCH.exheader.isUSUM()) + NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("USUM"); } updateTB(TB_Progress, "Adding ExeFS..."); NCCH.exefs = new ExeFS(EXEFS_PATH); @@ -196,7 +200,7 @@ internal static NCSD setNCSD(NCCH NCCH, bool Card2, return NCSD; } - internal static bool writeROM(NCSD NCSD, string SAVE_PATH, + internal static bool writeROM(NCSD NCSD, string SAVE_PATH, bool trimmed = false, ProgressBar PB_Show = null, RichTextBox TB_Progress = null) { PB_Show = PB_Show ?? new ProgressBar(); @@ -269,14 +273,17 @@ internal static bool writeROM(NCSD NCSD, string SAVE_PATH, } //NCSD Padding - OutFileStream.Seek((NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE) + (NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE), SeekOrigin.Begin); - ulong TotalLen = NCSD.header.MediaSize * MEDIA_UNIT_SIZE; - byte[] Buffer = Enumerable.Repeat((byte)0xFF, 0x400000).ToArray(); - updateTB(TB_Progress, "Writing NCSD Padding..."); - while ((ulong)OutFileStream.Position < TotalLen) + if (!trimmed) { - int BUFFER_LEN = TotalLen - (ulong)OutFileStream.Position < 0x400000 ? (int)(TotalLen - (ulong)OutFileStream.Position) : 0x400000; - OutFileStream.Write(Buffer, 0, BUFFER_LEN); + OutFileStream.Seek((NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE) + (NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + ulong TotalLen = NCSD.header.MediaSize * MEDIA_UNIT_SIZE; + byte[] Buffer = Enumerable.Repeat((byte)0xFF, 0x400000).ToArray(); + updateTB(TB_Progress, "Writing NCSD Padding..."); + while ((ulong)OutFileStream.Position < TotalLen) + { + int BUFFER_LEN = TotalLen - (ulong)OutFileStream.Position < 0x400000 ? (int)(TotalLen - (ulong)OutFileStream.Position) : 0x400000; + OutFileStream.Write(Buffer, 0, BUFFER_LEN); + } } } diff --git a/pk3DS.Core/CTR/NCCH.cs b/pk3DS.Core/CTR/NCCH.cs index 4327d13ad3..4b04e15086 100644 --- a/pk3DS.Core/CTR/NCCH.cs +++ b/pk3DS.Core/CTR/NCCH.cs @@ -1,4 +1,6 @@ using System; +using System.IO; +using System.Windows.Forms; namespace pk3DS.Core.CTR { @@ -73,6 +75,182 @@ public void BuildHeader() Array.Copy(ExefsHash, 0, Data, 0x1C0, 0x20); Array.Copy(RomfsHash, 0, Data, 0x1E0, 0x20); } + + public void BuildHeaderFromBytes(byte[] data) + { + Data = data; + Signature = new byte[0x100]; + Array.Copy(data, Signature, 0x100); + Magic = BitConverter.ToUInt32(data, 0x100); + Size = BitConverter.ToUInt32(data, 0x104); + TitleId = BitConverter.ToUInt64(data, 0x108); + MakerCode = BitConverter.ToUInt16(data, 0x110); + FormatVersion = BitConverter.ToUInt16(data, 0x112); + //4 Byte Padding + ProgramId = BitConverter.ToUInt64(data, 0x118); + //0x10 Byte Padding + LogoHash = new byte[0x20]; + Array.Copy(data, 0x130, LogoHash, 0x0, 0x20); + ProductCode = new byte[0x10]; + Array.Copy(data, 0x150, ProductCode, 0x0, 0x10); + ExheaderHash = new byte[0x20]; + Array.Copy(data, 0x160, ExheaderHash, 0x0, 0x20); + ExheaderSize = BitConverter.ToUInt32(data, 0x180); + //4 Byte Padding + Flags = new byte[0x8]; + Array.Copy(data, 0x188, Flags, 0, 0x8); + PlainRegionOffset = BitConverter.ToUInt32(data, 0x190); + PlainRegionSize = BitConverter.ToUInt32(data, 0x194); + LogoOffset = BitConverter.ToUInt32(data, 0x198); + LogoSize = BitConverter.ToUInt32(data, 0x19C); + ExefsOffset = BitConverter.ToUInt32(data, 0x1A0); + ExefsSize = BitConverter.ToUInt32(data, 0x1A4); + ExefsSuperBlockSize = BitConverter.ToUInt32(data, 0x1A8); + //4 Byte Padding + RomfsOffset = BitConverter.ToUInt32(data, 0x1B0); + RomfsSize = BitConverter.ToUInt32(data, 0x1B4); + RomfsSuperBlockSize = BitConverter.ToUInt32(data, 0x1B8); + //4 Byte Padding + ExefsHash = new byte[0x20]; + Array.Copy(data, 0x1C0, ExefsHash, 0x0, 0x20); + RomfsHash = new byte[0x20]; + Array.Copy(data, 0x1E0, RomfsHash, 0x0, 0x20); + } + } + + public void ExtractNCCHFromFile(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) + { + if (!Directory.Exists(outputDirectory)) + Directory.CreateDirectory(outputDirectory); + + byte[] headerBytes = new byte[0x200]; + using (FileStream fs = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read)) + { + fs.Read(headerBytes, 0, headerBytes.Length); + header = new Header(); + header.BuildHeaderFromBytes(headerBytes); + + logo = new byte[header.LogoSize * MEDIA_UNIT_SIZE]; + fs.Seek(Convert.ToInt32(header.LogoOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + fs.Read(logo, 0, logo.Length); + + plainregion = new byte[header.PlainRegionSize * MEDIA_UNIT_SIZE]; + fs.Seek(Convert.ToInt32(header.PlainRegionOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + fs.Read(plainregion, 0, plainregion.Length); + } + + WriteHeaderToFile(outputDirectory, TB_Progress); + WritePlainRegionAndLogo(outputDirectory, TB_Progress); + ExtractExheader(NCCH_PATH, outputDirectory, TB_Progress); + ExtractExeFS(NCCH_PATH, outputDirectory, TB_Progress, PB_Show); + ExtractRomFS(NCCH_PATH, outputDirectory, TB_Progress, PB_Show); + } + + private void ExtractExheader(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null) + { + string exheaderpath = Path.Combine(outputDirectory, "exheader.bin"); + updateTB(TB_Progress, "Extracting exheader.bin from CXI..."); + byte[] exheaderbytes = new byte[header.ExheaderSize * 2]; + + using (FileStream fs = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read)) + { + fs.Seek(Convert.ToInt32(0x200), SeekOrigin.Begin); + fs.Read(exheaderbytes, 0, exheaderbytes.Length); + } + + File.WriteAllBytes(exheaderpath, exheaderbytes); + exheader = new Exheader(exheaderpath); + } + + private void ExtractExeFS(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) + { + string exefsbinpath = Path.Combine(outputDirectory, "exefs.bin"); + string exefspath = Path.Combine(outputDirectory, "exefs"); + updateTB(TB_Progress, "Extracting exefs.bin from CXI..."); + byte[] exefsbytes = new byte[header.ExefsSize * MEDIA_UNIT_SIZE]; + + using (FileStream fs = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read)) + { + fs.Seek(Convert.ToInt32(header.ExefsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + fs.Read(exefsbytes, 0, exefsbytes.Length); + } + + File.WriteAllBytes(exefsbinpath, exefsbytes); + ExeFS.get(exefsbinpath, exefspath); + File.Delete(exefsbinpath); + } + + private void ExtractRomFS(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) + { + updateTB(TB_Progress, "Extracting romfs.bin from CXI..."); + string romfsbinpath = Path.Combine(outputDirectory, "romfs.bin"); + string romfspath = Path.Combine(outputDirectory, "romfs"); + byte[] romfsBytes = new byte[MEDIA_UNIT_SIZE]; + + using (FileStream ncchstream = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read), + romfsstream = new FileStream(romfsbinpath, FileMode.Append, FileAccess.Write)) + { + ncchstream.Seek(Convert.ToInt32(header.RomfsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + if (PB_Show.InvokeRequired) + PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(header.RomfsSize); }); + else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(header.RomfsSize); } + for (int i = 0; i < header.RomfsSize; i++) + { + ncchstream.Read(romfsBytes, 0, romfsBytes.Length); + romfsstream.Write(romfsBytes, 0, romfsBytes.Length); + if (PB_Show.InvokeRequired) + PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); + else { PB_Show.PerformStep(); } + } + } + + RomFS romfs = new RomFS(romfsbinpath); + romfs.ExtractRomFS(romfspath, TB_Progress, PB_Show); + File.Delete(romfsbinpath); + } + + private void WriteHeaderToFile(string outputDirectory, RichTextBox TB_Progress) + { + updateTB(TB_Progress, "Extracting ncchheader.bin from CXI..."); + string headerParth = Path.Combine(outputDirectory, "ncchheader.bin"); + using (FileStream headerStream = new FileStream(headerParth, FileMode.OpenOrCreate, FileAccess.Write)) + { + headerStream.Write(this.header.Data, 0, this.header.Data.Length); + } + } + + private void WritePlainRegionAndLogo(string outputDirectory, RichTextBox TB_Progress) + { + string plainRegionPath = Path.Combine(outputDirectory, "plain.bin"); + string logoPath = Path.Combine(outputDirectory, "logo.bcma.lz"); + updateTB(TB_Progress, "Extracting plain.bin and logo.bcma.lz from CXI..."); + using (FileStream plainStream = new FileStream(plainRegionPath, FileMode.OpenOrCreate, FileAccess.Write), + logoStream = new FileStream(logoPath, FileMode.OpenOrCreate, FileAccess.Write)) + { + plainStream.Write(this.plainregion, 0, this.plainregion.Length); + logoStream.Write(this.logo, 0, this.logo.Length); + } + } + + internal static void updateTB(RichTextBox RTB, string progress) + { + try + { + if (RTB.InvokeRequired) + RTB.Invoke((MethodInvoker)delegate + { + RTB.AppendText(Environment.NewLine + progress); + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + }); + else + { + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + RTB.AppendText(progress + Environment.NewLine); + } + } + catch { } } } } diff --git a/pk3DS.Core/CTR/RomFS.cs b/pk3DS.Core/CTR/RomFS.cs index 1751e750c4..c4b5c07617 100644 --- a/pk3DS.Core/CTR/RomFS.cs +++ b/pk3DS.Core/CTR/RomFS.cs @@ -64,6 +64,194 @@ internal static void updateTB(RichTextBox RTB, string progress) catch { } } + public void ExtractRomFS(string outputDirectory, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) + { + byte[] ivfcHeaderBytes = new byte[0x5C]; + using (FileStream file = new FileStream(FileName, FileMode.Open, FileAccess.Read)) + { + file.Read(ivfcHeaderBytes, 0, ivfcHeaderBytes.Length); + } + IVFCInfo ivfc = GetIVFCInfoFromBytes(ivfcHeaderBytes); + + ulong romfsDataOffset = Align(ivfc.Levels[0].HashOffset + ivfc.MasterHashSize, ivfc.Levels[2].BlockSize); + byte[] romfsInfoHeaderBytes = new byte[0x28]; + using (FileStream file = new FileStream(FileName, FileMode.Open, FileAccess.Read)) + { + file.Seek(Convert.ToInt64(romfsDataOffset), SeekOrigin.Begin); + file.Read(romfsInfoHeaderBytes, 0, romfsInfoHeaderBytes.Length); + } + Romfs_InfoHeader infoHeader = GetRomfsInfoHeaderFromBytes(romfsInfoHeaderBytes, Convert.ToUInt32(romfsDataOffset)); + + byte[] directoryMetadataBlock = new byte[infoHeader.Sections[1].Size]; + byte[] fileMetadataBlock = new byte[infoHeader.Sections[3].Size]; + using (FileStream file = new FileStream(FileName, FileMode.Open, FileAccess.Read)) + { + file.Seek(Convert.ToInt64(infoHeader.Sections[1].Offset), SeekOrigin.Begin); + file.Read(directoryMetadataBlock, 0, directoryMetadataBlock.Length); + + file.Seek(Convert.ToInt64(infoHeader.Sections[3].Offset), SeekOrigin.Begin); + file.Read(fileMetadataBlock, 0, fileMetadataBlock.Length); + } + + if (!Directory.Exists(outputDirectory)) + { + Directory.CreateDirectory(outputDirectory); + } + + VisitDirectory(0, outputDirectory, directoryMetadataBlock, fileMetadataBlock, infoHeader.DataOffset, TB_Progress, PB_Show); + } + + private static IVFCInfo GetIVFCInfoFromBytes(byte[] headerBytes) + { + IVFCInfo ivfc = new IVFCInfo(); + uint magic1 = BitConverter.ToUInt32(headerBytes, 0x00); + uint magic2 = BitConverter.ToUInt32(headerBytes, 0x04); + if (magic1 != 0x43465649 || magic2 != 0x10000) + { + throw new ArgumentException("Bad IVFC Header"); + } + ivfc.MasterHashSize = BitConverter.ToUInt32(headerBytes, 0x08); + ivfc.Levels = new IVFCLevel[3]; + for (int i = 0; i < 3; i++) + { + ivfc.Levels[i] = new IVFCLevel(); + ivfc.Levels[i].HashOffset = BitConverter.ToUInt64(headerBytes, 0x0C + (i * 0x18)); + ivfc.Levels[i].DataLength = BitConverter.ToUInt64(headerBytes, 0x14 + (i * 0x18)); + ivfc.Levels[i].BlockSize = 1U << BitConverter.ToInt32(headerBytes, 0x1C + (i * 0x18)); + } + return ivfc; + } + + private static Romfs_InfoHeader GetRomfsInfoHeaderFromBytes(byte[] headerBytes, uint bodyOffset) + { + Romfs_InfoHeader infoHeader = new Romfs_InfoHeader(); + infoHeader.HeaderLength = BitConverter.ToUInt32(headerBytes, 0x00); + infoHeader.Sections = new Romfs_SectionHeader[4]; + for (int i = 0; i < 4; i++) + { + infoHeader.Sections[i] = new Romfs_SectionHeader(); + infoHeader.Sections[i].Offset = BitConverter.ToUInt32(headerBytes, 0x04 + (i * 0x08)) + bodyOffset; + infoHeader.Sections[i].Size = BitConverter.ToUInt32(headerBytes, 0x08 + (i * 0x08)); + } + infoHeader.DataOffset = BitConverter.ToUInt32(headerBytes, 0x24) + bodyOffset; + return infoHeader; + } + + private void VisitDirectory( + uint directoryOffset, + string rootPath, + byte[] directoryMetadataBlock, + byte[] fileMetadataBlock, + ulong dataOffset, + RichTextBox TB_Progress = null, + ProgressBar PB_Show = null) + { + Romfs_DirEntry entry = GetDirEntryFromMetadataBytes(directoryMetadataBlock, Convert.ToInt32(directoryOffset)); + + string currentPath = Path.Combine(rootPath, entry.Name); + Directory.CreateDirectory(currentPath); + + if (entry.FileOffset != 0xFFFFFFFF) + { + VisitFile(entry.FileOffset, currentPath, fileMetadataBlock, dataOffset, TB_Progress, PB_Show); + } + + if (entry.ChildOffset != 0xFFFFFFFF) + { + VisitDirectory(entry.ChildOffset, currentPath, directoryMetadataBlock, fileMetadataBlock, dataOffset, TB_Progress, PB_Show); + } + + if (entry.SiblingOffset != 0xFFFFFFFF) + { + VisitDirectory(entry.SiblingOffset, rootPath, directoryMetadataBlock, fileMetadataBlock, dataOffset, TB_Progress, PB_Show); + } + + } + + private void VisitFile( + uint fileOffset, + string rootPath, + byte[] fileMetadataBlock, + ulong dataOffset, + RichTextBox TB_Progress = null, + ProgressBar PB_Show = null) + { + Romfs_FileEntry entry = GetFileEntryFromMetadataBytes(fileMetadataBlock, Convert.ToInt32(fileOffset)); + string currentPath = Path.Combine(rootPath, entry.Name); + UpdateTB_Progress(string.Format("Extracting {0} from romfs", currentPath), TB_Progress); + ExtractFileFromRomFS(entry, currentPath, dataOffset, PB_Show); + + if (entry.SiblingOffset != 0xFFFFFFFF) + { + VisitFile(entry.SiblingOffset, rootPath, fileMetadataBlock, dataOffset, TB_Progress, PB_Show); + } + } + + + private static Romfs_DirEntry GetDirEntryFromMetadataBytes(byte[] directoryMetadataBlock, int directoryOffset) + { + Romfs_DirEntry entry = new Romfs_DirEntry(); + entry.ParentOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset); + entry.SiblingOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x04); + entry.ChildOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x08); + entry.FileOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x0C); + uint nameLength = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x14); + entry.Name = ""; + if (nameLength != 0xFFFFFFFF) + { + byte[] fileNameBytes = new byte[nameLength]; + Array.Copy(directoryMetadataBlock, directoryOffset + 0x18, fileNameBytes, 0, fileNameBytes.Length); + entry.Name = Encoding.Unicode.GetString(fileNameBytes); + } + return entry; + } + + private static Romfs_FileEntry GetFileEntryFromMetadataBytes(byte[] fileMetadataBlock, int fileOffset) + { + Romfs_FileEntry entry = new Romfs_FileEntry(); + entry.ParentDirOffset = BitConverter.ToUInt32(fileMetadataBlock, fileOffset); + entry.SiblingOffset = BitConverter.ToUInt32(fileMetadataBlock, fileOffset + 0x04); + entry.DataOffset = BitConverter.ToUInt64(fileMetadataBlock, fileOffset + 0x08); + entry.DataSize = BitConverter.ToUInt64(fileMetadataBlock, fileOffset + 0x10); + entry.NameSize = BitConverter.ToUInt32(fileMetadataBlock, fileOffset + 0x1C); + entry.Name = ""; + if (entry.NameSize != 0xFFFFFFFF) + { + byte[] fileNameBytes = new byte[entry.NameSize]; + Array.Copy(fileMetadataBlock, fileOffset + 0x20, fileNameBytes, 0, fileNameBytes.Length); + entry.Name = Encoding.Unicode.GetString(fileNameBytes); + } + return entry; + } + + private void ExtractFileFromRomFS(Romfs_FileEntry entry, string path, ulong dataOffset, ProgressBar PB_Show = null) + { + ulong offsetInRomFS = dataOffset + entry.DataOffset; + byte[] buffer = new byte[0x2000]; + + using (FileStream romfsFileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read), + outputFileStream = new FileStream(path, FileMode.Append, FileAccess.Write)) + { + romfsFileStream.Seek(Convert.ToInt64(offsetInRomFS), SeekOrigin.Begin); + int remainingSize = Convert.ToInt32(entry.DataSize); + if (PB_Show.InvokeRequired) + PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = remainingSize / buffer.Length; }); + else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = remainingSize / buffer.Length; } + + while (remainingSize > 0) + { + int sizeToReadWrite = buffer.Length > remainingSize ? remainingSize : buffer.Length; + romfsFileStream.Read(buffer, 0, sizeToReadWrite); + outputFileStream.Write(buffer, 0, sizeToReadWrite); + remainingSize -= sizeToReadWrite; + if (PB_Show.InvokeRequired) + PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); + else { PB_Show.PerformStep(); } + } + } + + } + public static void BuildRomFS(string infile, string outfile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { OutFile = outfile; @@ -736,6 +924,7 @@ public static ulong GetDataBlockLength(RomfsFile[] files, ulong PreData) public class IVFCInfo { + public uint MasterHashSize; public IVFCLevel[] Levels; } diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index 89d23b3e48..0744526b3e 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -92,6 +92,9 @@ private void InitializeComponent() this.B_Static = new System.Windows.Forms.Button(); this.Tab_Output = new System.Windows.Forms.TabPage(); this.L_Status = new System.Windows.Forms.Label(); + this.Menu_Extract = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_Extract_CXI = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_Trimmed3DS = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.TC_RomFS.SuspendLayout(); this.Tab_RomFS.SuspendLayout(); @@ -102,19 +105,19 @@ private void InitializeComponent() this.FLP_CRO.SuspendLayout(); this.Tab_Output.SuspendLayout(); this.SuspendLayout(); - // + // // TB_Path - // - this.TB_Path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // + this.TB_Path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.TB_Path.Location = new System.Drawing.Point(158, 3); this.TB_Path.Name = "TB_Path"; this.TB_Path.ReadOnly = true; this.TB_Path.Size = new System.Drawing.Size(214, 20); this.TB_Path.TabIndex = 1; - // + // // L_Game - // + // this.L_Game.AutoSize = true; this.L_Game.ForeColor = System.Drawing.Color.Red; this.L_Game.Location = new System.Drawing.Point(157, 23); @@ -122,18 +125,18 @@ private void InitializeComponent() this.L_Game.Size = new System.Drawing.Size(91, 13); this.L_Game.TabIndex = 2; this.L_Game.Text = "No Game Loaded"; - // + // // pBar1 - // - this.pBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + // + this.pBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pBar1.Location = new System.Drawing.Point(12, 225); this.pBar1.Name = "pBar1"; this.pBar1.Size = new System.Drawing.Size(360, 14); this.pBar1.TabIndex = 6; - // + // // B_OPower - // + // this.B_OPower.Location = new System.Drawing.Point(215, 32); this.B_OPower.Name = "B_OPower"; this.B_OPower.Size = new System.Drawing.Size(100, 23); @@ -141,9 +144,9 @@ private void InitializeComponent() this.B_OPower.Text = "O-Powers"; this.B_OPower.UseVisualStyleBackColor = true; this.B_OPower.Click += new System.EventHandler(this.B_OPower_Click); - // + // // B_Pickup - // + // this.B_Pickup.Location = new System.Drawing.Point(109, 32); this.B_Pickup.Name = "B_Pickup"; this.B_Pickup.Size = new System.Drawing.Size(100, 23); @@ -151,9 +154,9 @@ private void InitializeComponent() this.B_Pickup.Text = "Pickup Items"; this.B_Pickup.UseVisualStyleBackColor = true; this.B_Pickup.Click += new System.EventHandler(this.B_Pickup_Click); - // + // // B_Mart - // + // this.B_Mart.Location = new System.Drawing.Point(3, 32); this.B_Mart.Name = "B_Mart"; this.B_Mart.Size = new System.Drawing.Size(100, 23); @@ -161,9 +164,9 @@ private void InitializeComponent() this.B_Mart.Text = "Poké Mart"; this.B_Mart.UseVisualStyleBackColor = true; this.B_Mart.Click += new System.EventHandler(this.B_Mart_Click); - // + // // B_MoveTutor - // + // this.B_MoveTutor.Location = new System.Drawing.Point(3, 3); this.B_MoveTutor.Name = "B_MoveTutor"; this.B_MoveTutor.Size = new System.Drawing.Size(100, 23); @@ -171,9 +174,9 @@ private void InitializeComponent() this.B_MoveTutor.Text = "Move Tutors"; this.B_MoveTutor.UseVisualStyleBackColor = true; this.B_MoveTutor.Click += new System.EventHandler(this.B_MoveTutor_Click); - // + // // B_TMHM - // + // this.B_TMHM.Location = new System.Drawing.Point(109, 3); this.B_TMHM.Name = "B_TMHM"; this.B_TMHM.Size = new System.Drawing.Size(100, 23); @@ -181,9 +184,9 @@ private void InitializeComponent() this.B_TMHM.Text = "TMs/HMs"; this.B_TMHM.UseVisualStyleBackColor = true; this.B_TMHM.Click += new System.EventHandler(this.B_TMHM_Click); - // + // // RTB_Status - // + // this.RTB_Status.Dock = System.Windows.Forms.DockStyle.Fill; this.RTB_Status.Location = new System.Drawing.Point(0, 0); this.RTB_Status.Name = "RTB_Status"; @@ -191,9 +194,9 @@ private void InitializeComponent() this.RTB_Status.Size = new System.Drawing.Size(352, 154); this.RTB_Status.TabIndex = 7; this.RTB_Status.Text = ""; - // + // // menuStrip1 - // + // this.menuStrip1.BackColor = System.Drawing.Color.Transparent; this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_File, @@ -204,54 +207,55 @@ private void InitializeComponent() this.menuStrip1.Size = new System.Drawing.Size(384, 24); this.menuStrip1.TabIndex = 9; this.menuStrip1.Text = "menuStrip1"; - // + // // Menu_File - // + // this.Menu_File.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Open, this.Menu_Exit}); this.Menu_File.Name = "Menu_File"; this.Menu_File.Size = new System.Drawing.Size(37, 20); this.Menu_File.Text = "File"; - // + // // Menu_Open - // + // this.Menu_Open.Name = "Menu_Open"; this.Menu_Open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.Menu_Open.Size = new System.Drawing.Size(155, 22); + this.Menu_Open.Size = new System.Drawing.Size(180, 22); this.Menu_Open.Text = "&Open..."; this.Menu_Open.Click += new System.EventHandler(this.B_Open_Click); - // + // // Menu_Exit - // + // this.Menu_Exit.Name = "Menu_Exit"; this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); - this.Menu_Exit.Size = new System.Drawing.Size(155, 22); + this.Menu_Exit.Size = new System.Drawing.Size(180, 22); this.Menu_Exit.Text = "&Exit"; this.Menu_Exit.Click += new System.EventHandler(this.Menu_Exit_Click); - // + // // Menu_Tools - // + // this.Menu_Tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Restore, this.Menu_Misc, + this.Menu_Extract, this.Menu_Rebuild, this.Menu_SMDH, this.randomizationToolStripMenuItem}); this.Menu_Tools.Name = "Menu_Tools"; - this.Menu_Tools.Size = new System.Drawing.Size(47, 20); + this.Menu_Tools.Size = new System.Drawing.Size(46, 20); this.Menu_Tools.Text = "Tools"; - // + // // Menu_Restore - // + // this.Menu_Restore.Enabled = false; this.Menu_Restore.Name = "Menu_Restore"; this.Menu_Restore.Size = new System.Drawing.Size(184, 22); this.Menu_Restore.Text = "Restore Original Files"; this.Menu_Restore.Click += new System.EventHandler(this.L_Game_Click); - // + // // Menu_Misc - // + // this.Menu_Misc.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.unPackBCLIMToolStripMenuItem, this.Menu_BLZ, @@ -260,115 +264,116 @@ private void InitializeComponent() this.Menu_Misc.Name = "Menu_Misc"; this.Menu_Misc.Size = new System.Drawing.Size(184, 22); this.Menu_Misc.Text = "Misc Tools"; - // + // // unPackBCLIMToolStripMenuItem - // + // this.unPackBCLIMToolStripMenuItem.Name = "unPackBCLIMToolStripMenuItem"; this.unPackBCLIMToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T))); this.unPackBCLIMToolStripMenuItem.Size = new System.Drawing.Size(216, 22); this.unPackBCLIMToolStripMenuItem.Text = "(un)Pack + BCLIM"; this.unPackBCLIMToolStripMenuItem.Click += new System.EventHandler(this.L_SubTools_Click); - // + // // Menu_BLZ - // + // this.Menu_BLZ.Name = "Menu_BLZ"; this.Menu_BLZ.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_BLZ.Size = new System.Drawing.Size(216, 22); this.Menu_BLZ.Text = "(de)Compress BLZ"; this.Menu_BLZ.Click += new System.EventHandler(this.Menu_BLZ_Click); - // + // // Menu_LZ11 - // + // this.Menu_LZ11.Name = "Menu_LZ11"; this.Menu_LZ11.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L))); this.Menu_LZ11.Size = new System.Drawing.Size(216, 22); this.Menu_LZ11.Text = "(de)Compress LZ11"; this.Menu_LZ11.Click += new System.EventHandler(this.Menu_LZ11_Click); - // + // // Menu_Shuffler - // + // this.Menu_Shuffler.Enabled = false; this.Menu_Shuffler.Name = "Menu_Shuffler"; this.Menu_Shuffler.Size = new System.Drawing.Size(216, 22); this.Menu_Shuffler.Text = "GARC Shuffler"; this.Menu_Shuffler.Click += new System.EventHandler(this.Menu_Shuffler_Click); - // + // // Menu_Rebuild - // + // this.Menu_Rebuild.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_RomFS, this.Menu_ExeFS, this.Menu_CRO, + this.Menu_Trimmed3DS, this.Menu_3DS, this.Menu_Patch}); this.Menu_Rebuild.Name = "Menu_Rebuild"; this.Menu_Rebuild.Size = new System.Drawing.Size(184, 22); this.Menu_Rebuild.Text = "Rebuild..."; - // + // // Menu_RomFS - // + // this.Menu_RomFS.Enabled = false; this.Menu_RomFS.Name = "Menu_RomFS"; - this.Menu_RomFS.Size = new System.Drawing.Size(111, 22); + this.Menu_RomFS.Size = new System.Drawing.Size(180, 22); this.Menu_RomFS.Text = "RomFS"; this.Menu_RomFS.Click += new System.EventHandler(this.rebuildRomFS); - // + // // Menu_ExeFS - // + // this.Menu_ExeFS.Enabled = false; this.Menu_ExeFS.Name = "Menu_ExeFS"; - this.Menu_ExeFS.Size = new System.Drawing.Size(111, 22); + this.Menu_ExeFS.Size = new System.Drawing.Size(180, 22); this.Menu_ExeFS.Text = "ExeFS"; this.Menu_ExeFS.Click += new System.EventHandler(this.rebuildExeFS); - // + // // Menu_CRO - // + // this.Menu_CRO.Enabled = false; this.Menu_CRO.Name = "Menu_CRO"; - this.Menu_CRO.Size = new System.Drawing.Size(111, 22); + this.Menu_CRO.Size = new System.Drawing.Size(180, 22); this.Menu_CRO.Text = "CRO"; this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR); - // + // // Menu_3DS - // + // this.Menu_3DS.Enabled = false; this.Menu_3DS.Name = "Menu_3DS"; - this.Menu_3DS.Size = new System.Drawing.Size(111, 22); + this.Menu_3DS.Size = new System.Drawing.Size(180, 22); this.Menu_3DS.Text = ".3DS"; this.Menu_3DS.Click += new System.EventHandler(this.B_Rebuild3DS_Click); - // + // // Menu_Patch - // + // this.Menu_Patch.Enabled = false; this.Menu_Patch.Name = "Menu_Patch"; - this.Menu_Patch.Size = new System.Drawing.Size(111, 22); + this.Menu_Patch.Size = new System.Drawing.Size(180, 22); this.Menu_Patch.Text = "Patch"; this.Menu_Patch.Click += new System.EventHandler(this.B_Patch_Click); - // + // // Menu_SMDH - // + // this.Menu_SMDH.Name = "Menu_SMDH"; this.Menu_SMDH.Size = new System.Drawing.Size(184, 22); this.Menu_SMDH.Text = "SMDH Editor (Icon)"; this.Menu_SMDH.Click += new System.EventHandler(this.Menu_SMDH_Click); - // + // // randomizationToolStripMenuItem - // + // this.randomizationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.setInt32SeedToolStripMenuItem}); this.randomizationToolStripMenuItem.Name = "randomizationToolStripMenuItem"; this.randomizationToolStripMenuItem.Size = new System.Drawing.Size(184, 22); this.randomizationToolStripMenuItem.Text = "Randomization"; - // + // // setInt32SeedToolStripMenuItem - // + // this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem"; this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed"; this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click); - // + // // Menu_Options - // + // this.Menu_Options.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Language, this.Menu_About, @@ -376,17 +381,17 @@ private void InitializeComponent() this.Menu_Options.Name = "Menu_Options"; this.Menu_Options.Size = new System.Drawing.Size(61, 20); this.Menu_Options.Text = "Options"; - // + // // Menu_Language - // + // this.Menu_Language.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.CB_Lang}); this.Menu_Language.Name = "Menu_Language"; - this.Menu_Language.Size = new System.Drawing.Size(146, 22); + this.Menu_Language.Size = new System.Drawing.Size(180, 22); this.Menu_Language.Text = "Language"; - // + // // CB_Lang - // + // this.CB_Lang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Lang.Items.AddRange(new object[] { "カタカナ", @@ -402,27 +407,27 @@ private void InitializeComponent() this.CB_Lang.Name = "CB_Lang"; this.CB_Lang.Size = new System.Drawing.Size(121, 23); this.CB_Lang.SelectedIndexChanged += new System.EventHandler(this.ChangeLanguage); - // + // // Menu_About - // + // this.Menu_About.Name = "Menu_About"; this.Menu_About.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_About.ShowShortcutKeys = false; - this.Menu_About.Size = new System.Drawing.Size(146, 22); + this.Menu_About.Size = new System.Drawing.Size(180, 22); this.Menu_About.Text = "A&bout pk3DS"; this.Menu_About.Click += new System.EventHandler(this.L_About_Click); - // + // // Menu_GARCs - // + // this.Menu_GARCs.Name = "Menu_GARCs"; - this.Menu_GARCs.Size = new System.Drawing.Size(146, 22); + this.Menu_GARCs.Size = new System.Drawing.Size(180, 22); this.Menu_GARCs.Text = "About GARCs"; this.Menu_GARCs.Click += new System.EventHandler(this.L_GARCInfo_Click); - // + // // TC_RomFS - // - this.TC_RomFS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.TC_RomFS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.TC_RomFS.Controls.Add(this.Tab_RomFS); this.TC_RomFS.Controls.Add(this.Tab_ExeFS); @@ -433,9 +438,9 @@ private void InitializeComponent() this.TC_RomFS.SelectedIndex = 0; this.TC_RomFS.Size = new System.Drawing.Size(360, 180); this.TC_RomFS.TabIndex = 11; - // + // // Tab_RomFS - // + // this.Tab_RomFS.Controls.Add(this.FLP_RomFS); this.Tab_RomFS.Location = new System.Drawing.Point(4, 22); this.Tab_RomFS.Name = "Tab_RomFS"; @@ -444,9 +449,9 @@ private void InitializeComponent() this.Tab_RomFS.TabIndex = 0; this.Tab_RomFS.Text = "RomFS"; this.Tab_RomFS.UseVisualStyleBackColor = true; - // + // // FLP_RomFS - // + // this.FLP_RomFS.AutoScroll = true; this.FLP_RomFS.Controls.Add(this.B_GameText); this.FLP_RomFS.Controls.Add(this.B_StoryText); @@ -468,9 +473,9 @@ private void InitializeComponent() this.FLP_RomFS.Name = "FLP_RomFS"; this.FLP_RomFS.Size = new System.Drawing.Size(346, 148); this.FLP_RomFS.TabIndex = 13; - // + // // B_GameText - // + // this.B_GameText.Location = new System.Drawing.Point(3, 3); this.B_GameText.Name = "B_GameText"; this.B_GameText.Size = new System.Drawing.Size(100, 23); @@ -478,9 +483,9 @@ private void InitializeComponent() this.B_GameText.Text = "Game Text"; this.B_GameText.UseVisualStyleBackColor = true; this.B_GameText.Click += new System.EventHandler(this.B_GameText_Click); - // + // // B_StoryText - // + // this.B_StoryText.Location = new System.Drawing.Point(109, 3); this.B_StoryText.Name = "B_StoryText"; this.B_StoryText.Size = new System.Drawing.Size(100, 23); @@ -488,9 +493,9 @@ private void InitializeComponent() this.B_StoryText.Text = "Story Text"; this.B_StoryText.UseVisualStyleBackColor = true; this.B_StoryText.Click += new System.EventHandler(this.B_StoryText_Click); - // + // // B_Personal - // + // this.B_Personal.Location = new System.Drawing.Point(215, 3); this.B_Personal.Name = "B_Personal"; this.B_Personal.Size = new System.Drawing.Size(100, 23); @@ -498,9 +503,9 @@ private void InitializeComponent() this.B_Personal.Text = "Personal Stats"; this.B_Personal.UseVisualStyleBackColor = true; this.B_Personal.Click += new System.EventHandler(this.B_Personal_Click); - // + // // B_Evolution - // + // this.B_Evolution.Location = new System.Drawing.Point(3, 32); this.B_Evolution.Name = "B_Evolution"; this.B_Evolution.Size = new System.Drawing.Size(100, 23); @@ -508,9 +513,9 @@ private void InitializeComponent() this.B_Evolution.Text = "Evolutions"; this.B_Evolution.UseVisualStyleBackColor = true; this.B_Evolution.Click += new System.EventHandler(this.B_Evolution_Click); - // + // // B_LevelUp - // + // this.B_LevelUp.Location = new System.Drawing.Point(109, 32); this.B_LevelUp.Name = "B_LevelUp"; this.B_LevelUp.Size = new System.Drawing.Size(100, 23); @@ -518,9 +523,9 @@ private void InitializeComponent() this.B_LevelUp.Text = "Level Up Moves"; this.B_LevelUp.UseVisualStyleBackColor = true; this.B_LevelUp.Click += new System.EventHandler(this.B_LevelUp_Click); - // + // // B_Wild - // + // this.B_Wild.Location = new System.Drawing.Point(215, 32); this.B_Wild.Name = "B_Wild"; this.B_Wild.Size = new System.Drawing.Size(100, 23); @@ -528,9 +533,9 @@ private void InitializeComponent() this.B_Wild.Text = "Wild Encounters"; this.B_Wild.UseVisualStyleBackColor = true; this.B_Wild.Click += new System.EventHandler(this.B_Wild_Click); - // + // // B_MegaEvo - // + // this.B_MegaEvo.Location = new System.Drawing.Point(3, 61); this.B_MegaEvo.Name = "B_MegaEvo"; this.B_MegaEvo.Size = new System.Drawing.Size(100, 23); @@ -538,9 +543,9 @@ private void InitializeComponent() this.B_MegaEvo.Text = "Mega Evolutions"; this.B_MegaEvo.UseVisualStyleBackColor = true; this.B_MegaEvo.Click += new System.EventHandler(this.B_MegaEvo_Click); - // + // // B_EggMove - // + // this.B_EggMove.Location = new System.Drawing.Point(109, 61); this.B_EggMove.Name = "B_EggMove"; this.B_EggMove.Size = new System.Drawing.Size(100, 23); @@ -548,9 +553,9 @@ private void InitializeComponent() this.B_EggMove.Text = "Egg Moves"; this.B_EggMove.UseVisualStyleBackColor = true; this.B_EggMove.Click += new System.EventHandler(this.B_EggMove_Click); - // + // // B_Trainer - // + // this.B_Trainer.Location = new System.Drawing.Point(215, 61); this.B_Trainer.Name = "B_Trainer"; this.B_Trainer.Size = new System.Drawing.Size(100, 23); @@ -558,9 +563,9 @@ private void InitializeComponent() this.B_Trainer.Text = "Trainers"; this.B_Trainer.UseVisualStyleBackColor = true; this.B_Trainer.Click += new System.EventHandler(this.B_Trainer_Click); - // + // // B_Maison - // + // this.B_Maison.Location = new System.Drawing.Point(3, 90); this.B_Maison.Name = "B_Maison"; this.B_Maison.Size = new System.Drawing.Size(100, 23); @@ -568,9 +573,9 @@ private void InitializeComponent() this.B_Maison.Text = "Battle Maison"; this.B_Maison.UseVisualStyleBackColor = true; this.B_Maison.Click += new System.EventHandler(this.B_Maison_Click); - // + // // B_Royal - // + // this.B_Royal.Location = new System.Drawing.Point(109, 90); this.B_Royal.Name = "B_Royal"; this.B_Royal.Size = new System.Drawing.Size(100, 23); @@ -578,9 +583,9 @@ private void InitializeComponent() this.B_Royal.Text = "Battle Royal/Tree"; this.B_Royal.UseVisualStyleBackColor = true; this.B_Royal.Click += new System.EventHandler(this.B_Maison_Click); - // + // // B_Item - // + // this.B_Item.Location = new System.Drawing.Point(215, 90); this.B_Item.Name = "B_Item"; this.B_Item.Size = new System.Drawing.Size(100, 23); @@ -588,9 +593,9 @@ private void InitializeComponent() this.B_Item.Text = "Item Stats"; this.B_Item.UseVisualStyleBackColor = true; this.B_Item.Click += new System.EventHandler(this.B_Item_Click); - // + // // B_Move - // + // this.B_Move.Location = new System.Drawing.Point(3, 119); this.B_Move.Name = "B_Move"; this.B_Move.Size = new System.Drawing.Size(100, 23); @@ -598,9 +603,9 @@ private void InitializeComponent() this.B_Move.Text = "Move Stats"; this.B_Move.UseVisualStyleBackColor = true; this.B_Move.Click += new System.EventHandler(this.B_Move_Click); - // + // // B_TitleScreen - // + // this.B_TitleScreen.Location = new System.Drawing.Point(109, 119); this.B_TitleScreen.Name = "B_TitleScreen"; this.B_TitleScreen.Size = new System.Drawing.Size(100, 23); @@ -608,9 +613,9 @@ private void InitializeComponent() this.B_TitleScreen.Text = "Title Screen"; this.B_TitleScreen.UseVisualStyleBackColor = true; this.B_TitleScreen.Click += new System.EventHandler(this.B_TitleScreen_Click); - // + // // B_OWSE - // + // this.B_OWSE.Location = new System.Drawing.Point(215, 119); this.B_OWSE.Name = "B_OWSE"; this.B_OWSE.Size = new System.Drawing.Size(100, 23); @@ -618,9 +623,9 @@ private void InitializeComponent() this.B_OWSE.Text = "OWSE [Dev]"; this.B_OWSE.UseVisualStyleBackColor = true; this.B_OWSE.Click += new System.EventHandler(this.B_OWSE_Click); - // + // // Tab_ExeFS - // + // this.Tab_ExeFS.Controls.Add(this.FLP_ExeFS); this.Tab_ExeFS.Location = new System.Drawing.Point(4, 22); this.Tab_ExeFS.Name = "Tab_ExeFS"; @@ -629,9 +634,9 @@ private void InitializeComponent() this.Tab_ExeFS.TabIndex = 1; this.Tab_ExeFS.Text = "ExeFS"; this.Tab_ExeFS.UseVisualStyleBackColor = true; - // + // // FLP_ExeFS - // + // this.FLP_ExeFS.AutoScroll = true; this.FLP_ExeFS.Controls.Add(this.B_MoveTutor); this.FLP_ExeFS.Controls.Add(this.B_TMHM); @@ -645,9 +650,9 @@ private void InitializeComponent() this.FLP_ExeFS.Name = "FLP_ExeFS"; this.FLP_ExeFS.Size = new System.Drawing.Size(346, 148); this.FLP_ExeFS.TabIndex = 11; - // + // // B_TM - // + // this.B_TM.Location = new System.Drawing.Point(215, 3); this.B_TM.Name = "B_TM"; this.B_TM.Size = new System.Drawing.Size(100, 23); @@ -655,9 +660,9 @@ private void InitializeComponent() this.B_TM.Text = "TMs"; this.B_TM.UseVisualStyleBackColor = true; this.B_TM.Click += new System.EventHandler(this.B_TMHM_Click); - // + // // B_ShinyRate - // + // this.B_ShinyRate.Location = new System.Drawing.Point(3, 61); this.B_ShinyRate.Name = "B_ShinyRate"; this.B_ShinyRate.Size = new System.Drawing.Size(100, 23); @@ -665,9 +670,9 @@ private void InitializeComponent() this.B_ShinyRate.Text = "Shiny Rate"; this.B_ShinyRate.UseVisualStyleBackColor = true; this.B_ShinyRate.Click += new System.EventHandler(this.B_ShinyRate_Click); - // + // // Tab_CRO - // + // this.Tab_CRO.Controls.Add(this.FLP_CRO); this.Tab_CRO.Location = new System.Drawing.Point(4, 22); this.Tab_CRO.Name = "Tab_CRO"; @@ -675,9 +680,9 @@ private void InitializeComponent() this.Tab_CRO.TabIndex = 2; this.Tab_CRO.Text = "CRO"; this.Tab_CRO.UseVisualStyleBackColor = true; - // + // // FLP_CRO - // + // this.FLP_CRO.Controls.Add(this.B_TypeChart); this.FLP_CRO.Controls.Add(this.B_Starter); this.FLP_CRO.Controls.Add(this.B_Gift); @@ -688,9 +693,9 @@ private void InitializeComponent() this.FLP_CRO.Padding = new System.Windows.Forms.Padding(3); this.FLP_CRO.Size = new System.Drawing.Size(352, 154); this.FLP_CRO.TabIndex = 1; - // + // // B_TypeChart - // + // this.B_TypeChart.Location = new System.Drawing.Point(6, 6); this.B_TypeChart.Name = "B_TypeChart"; this.B_TypeChart.Size = new System.Drawing.Size(100, 23); @@ -698,9 +703,9 @@ private void InitializeComponent() this.B_TypeChart.Text = "Type Chart"; this.B_TypeChart.UseVisualStyleBackColor = true; this.B_TypeChart.Click += new System.EventHandler(this.B_TypeChart_Click); - // + // // B_Starter - // + // this.B_Starter.Location = new System.Drawing.Point(112, 6); this.B_Starter.Name = "B_Starter"; this.B_Starter.Size = new System.Drawing.Size(100, 23); @@ -708,9 +713,9 @@ private void InitializeComponent() this.B_Starter.Text = "Starter Pokémon"; this.B_Starter.UseVisualStyleBackColor = true; this.B_Starter.Click += new System.EventHandler(this.B_Starter_Click); - // + // // B_Gift - // + // this.B_Gift.Location = new System.Drawing.Point(218, 6); this.B_Gift.Name = "B_Gift"; this.B_Gift.Size = new System.Drawing.Size(100, 23); @@ -718,9 +723,9 @@ private void InitializeComponent() this.B_Gift.Text = "Gift Pokémon"; this.B_Gift.UseVisualStyleBackColor = true; this.B_Gift.Click += new System.EventHandler(this.B_Gift_Click); - // + // // B_Static - // + // this.B_Static.Location = new System.Drawing.Point(6, 35); this.B_Static.Name = "B_Static"; this.B_Static.Size = new System.Drawing.Size(100, 23); @@ -728,9 +733,9 @@ private void InitializeComponent() this.B_Static.Text = "Static Encounters"; this.B_Static.UseVisualStyleBackColor = true; this.B_Static.Click += new System.EventHandler(this.B_Static_Click); - // + // // Tab_Output - // + // this.Tab_Output.Controls.Add(this.RTB_Status); this.Tab_Output.Location = new System.Drawing.Point(4, 22); this.Tab_Output.Name = "Tab_Output"; @@ -738,17 +743,40 @@ private void InitializeComponent() this.Tab_Output.TabIndex = 3; this.Tab_Output.Text = "Output"; this.Tab_Output.UseVisualStyleBackColor = true; - // + // // L_Status - // + // this.L_Status.Location = new System.Drawing.Point(203, 37); this.L_Status.Name = "L_Status"; this.L_Status.Size = new System.Drawing.Size(163, 20); this.L_Status.TabIndex = 14; this.L_Status.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // + // + // Menu_Extract + // + this.Menu_Extract.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.Menu_Extract_CXI}); + this.Menu_Extract.Name = "Menu_Extract"; + this.Menu_Extract.Size = new System.Drawing.Size(184, 22); + this.Menu_Extract.Text = "Extract..."; + // + // Menu_Extract_CXI + // + this.Menu_Extract_CXI.Name = "Menu_Extract_CXI"; + this.Menu_Extract_CXI.Size = new System.Drawing.Size(180, 22); + this.Menu_Extract_CXI.Text = ".CXI"; + this.Menu_Extract_CXI.Click += new System.EventHandler(this.B_ExtractCXI_Click); + // + // Menu_Trimmed3DS + // + this.Menu_Trimmed3DS.Enabled = false; + this.Menu_Trimmed3DS.Name = "Menu_Trimmed3DS"; + this.Menu_Trimmed3DS.Size = new System.Drawing.Size(180, 22); + this.Menu_Trimmed3DS.Text = "Trimmed .3DS"; + this.Menu_Trimmed3DS.Click += new System.EventHandler(this.B_RebuildTrimmed3DS_Click); + // // Main - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(384, 252); @@ -845,5 +873,8 @@ private void InitializeComponent() private System.Windows.Forms.Button B_TM; private System.Windows.Forms.ToolStripMenuItem randomizationToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem setInt32SeedToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem Menu_Extract; + private System.Windows.Forms.ToolStripMenuItem Menu_Extract_CXI; + private System.Windows.Forms.ToolStripMenuItem Menu_Trimmed3DS; } } \ No newline at end of file diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 327e24afc3..64621f61df 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -234,6 +234,8 @@ private void openQuick(string path) Menu_Patch.Enabled = RomFSPath != null && ExeFSPath != null; Menu_3DS.Enabled = ExHeaderPath != null && RomFSPath != null && ExeFSPath != null; + Menu_Trimmed3DS.Enabled = + ExHeaderPath != null && RomFSPath != null && ExeFSPath != null; // Change L_Game if RomFS and ExeFS exists to a better descriptor SMDH = ExeFSPath != null ? File.Exists(Path.Combine(ExeFSPath, "icon.bin")) ? new SMDH(Path.Combine(ExeFSPath, "icon.bin")) : null : null; @@ -249,6 +251,40 @@ private void openQuick(string path) } } + private void B_ExtractCXI_Click(object sender, EventArgs e) + { + if (WinFormsUtil.Prompt( + MessageBoxButtons.OKCancel, + "Extracting a CXI requires multiple GB of disc space and takes some time to complete.", + "If you want to continue, press OK to select your CXI and then select your output directory. For best results, make sure the output directory is an empty directory.") == DialogResult.OK) + { + string inputCXI; + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Title = "Select CXI"; + ofd.Filter = "CXI files (*.cxi)|*.cxi"; + if (ofd.ShowDialog() == DialogResult.OK) + inputCXI = ofd.FileName; + else + return; + + FolderBrowserDialog fbd = new FolderBrowserDialog(); + DialogResult result = fbd.ShowDialog(); + if (result == DialogResult.OK) + extractNCCH(inputCXI, fbd.SelectedPath); + } + + WinFormsUtil.Prompt(MessageBoxButtons.OK, "Extraction complete!"); + } + + private void extractNCCH(string ncchPath, string outputDirectory) + { + if (!File.Exists(ncchPath)) + return; + + NCCH ncch = new NCCH(); + ncch.ExtractNCCHFromFile(ncchPath, outputDirectory, RTB_Status, pBar1); + } + private void ToggleSubEditors() { // Hide all buttons @@ -1140,6 +1176,31 @@ private void B_Static_Click(object sender, EventArgs e) new StaticEncounterEditor6().ShowDialog(); } + // CXI Building + private void B_RebuildTrimmed3DS_Click(object sender, EventArgs e) + { + if (threadActive()) + return; + + SaveFileDialog sfd = new SaveFileDialog + { + FileName = "newROM.3ds", + Filter = "Binary File|*.*" + }; + if (sfd.ShowDialog() != DialogResult.OK) + return; + string path = sfd.FileName; + + new Thread(() => + { + threads++; + Exheader exh = new Exheader(ExHeaderPath); + CTRUtil.buildROM(true, "Nintendo", ExeFSPath, RomFSPath, ExHeaderPath, exh.GetSerial(), path, + true, pBar1, RTB_Status); + threads--; + }).Start(); + } + // 3DS Building private void B_Rebuild3DS_Click(object sender, EventArgs e) { @@ -1166,8 +1227,8 @@ private void B_Rebuild3DS_Click(object sender, EventArgs e) { threads++; Exheader exh = new Exheader(ExHeaderPath); - CTRUtil.buildROM(true, "Nintendo", ExeFSPath, RomFSPath, ExHeaderPath, exh.GetSerial(), path, pBar1, - RTB_Status); + CTRUtil.buildROM(true, "Nintendo", ExeFSPath, RomFSPath, ExHeaderPath, exh.GetSerial(), path, + false, pBar1, RTB_Status); threads--; }).Start(); } From 44279537c1a0351110d7264da378952947e42d83 Mon Sep 17 00:00:00 2001 From: tom-overton Date: Sat, 5 Oct 2019 20:51:30 -0700 Subject: [PATCH 150/191] Add 3DS extracting, and move extracting to its own thread --- pk3DS.Core/CTR/NCCH.cs | 2 - pk3DS.Core/CTR/NCSD.cs | 97 ++++++++++++++++++++++++++++++++++++++++- pk3DS.Core/CTR/RomFS.cs | 12 ++++- pk3DS/Main.Designer.cs | 68 +++++++++++++++++------------ pk3DS/Main.cs | 55 +++++++++++++++++++---- 5 files changed, 192 insertions(+), 42 deletions(-) diff --git a/pk3DS.Core/CTR/NCCH.cs b/pk3DS.Core/CTR/NCCH.cs index 4b04e15086..9e1e616143 100644 --- a/pk3DS.Core/CTR/NCCH.cs +++ b/pk3DS.Core/CTR/NCCH.cs @@ -139,8 +139,6 @@ public void ExtractNCCHFromFile(string NCCH_PATH, string outputDirectory, RichTe fs.Read(plainregion, 0, plainregion.Length); } - WriteHeaderToFile(outputDirectory, TB_Progress); - WritePlainRegionAndLogo(outputDirectory, TB_Progress); ExtractExheader(NCCH_PATH, outputDirectory, TB_Progress); ExtractExeFS(NCCH_PATH, outputDirectory, TB_Progress, PB_Show); ExtractRomFS(NCCH_PATH, outputDirectory, TB_Progress, PB_Show); diff --git a/pk3DS.Core/CTR/NCSD.cs b/pk3DS.Core/CTR/NCSD.cs index 0b4d4faf68..49884fd282 100644 --- a/pk3DS.Core/CTR/NCSD.cs +++ b/pk3DS.Core/CTR/NCSD.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Windows.Forms; namespace pk3DS.Core.CTR { @@ -56,9 +58,10 @@ public class NCCH_Meta public uint Size; } + private const ulong MEDIA_UNIT_SIZE = 0x200; + public ulong GetWritableAddress() { - const ulong MEDIA_UNIT_SIZE = 0x200; return Card2 ? Align((header.OffsetSizeTable[NCCH_Array.Count - 1].Offset * NCCH.MEDIA_UNIT_SIZE) + (header.OffsetSizeTable[NCCH_Array.Count - 1].Size * NCCH.MEDIA_UNIT_SIZE) + 0x1000, 0x10000) / MEDIA_UNIT_SIZE @@ -101,6 +104,77 @@ public void BuildHeader() Array.Copy(Enumerable.Repeat((byte)0xFF, 0x2E00).ToArray(), 0, Data, 0x1200, 0x2E00); } + public Header CreateHeaderFromBytes(byte[] data) + { + Header header = new Header(); + Data = data; + header.Signature = new byte[0x100]; + Array.Copy(data, header.Signature, 0x100); + header.Magic = BitConverter.ToUInt32(data, 0x100); + header.MediaSize = BitConverter.ToUInt32(data, 0x104); + header.TitleId = BitConverter.ToUInt64(data, 0x108); + header.OffsetSizeTable = new NCCH_Meta[8]; + for (int i = 0; i < 8; i++) + { + header.OffsetSizeTable[i] = new NCCH_Meta(); + header.OffsetSizeTable[i].Offset = BitConverter.ToUInt32(data, 0x120 + (8 * i)); + header.OffsetSizeTable[i].Size = BitConverter.ToUInt32(data, 0x124 + (8 * i)); + } + header.flags = new byte[8]; + Array.Copy(data, 0x188, header.flags, 0, 8); + header.NCCHIdTable = new ulong[8]; + for (int i = 0; i < 8; i++) + { + header.NCCHIdTable[i] = BitConverter.ToUInt64(data, 0x190 + (8 * i)); + } + return header; + } + + public void ExtractFilesFromNCSD(string NCSD_PATH, string outputDirectory, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) + { + if (!Directory.Exists(outputDirectory)) + Directory.CreateDirectory(outputDirectory); + + updateTB(TB_Progress, "Extracting game data (CXI) from .3DS file..."); + byte[] headerBytes = new byte[0x200]; + using (FileStream fs = new FileStream(NCSD_PATH, FileMode.Open, FileAccess.Read)) + { + fs.Read(headerBytes, 0, headerBytes.Length); + } + + header = CreateHeaderFromBytes(headerBytes); + string ncchPath = ExtractCXIfromNCSD(NCSD_PATH, outputDirectory, header.OffsetSizeTable[0].Size, PB_Show); + updateTB(TB_Progress, "CXI extracted, extracting files from CXI..."); + NCCH ncch = new NCCH(); + ncch.ExtractNCCHFromFile(ncchPath, outputDirectory, TB_Progress, PB_Show); + File.Delete(ncchPath); + } + + private static string ExtractCXIfromNCSD(string NCSD_PATH, string outputDirectory, uint ncchSize, ProgressBar PB_Show = null) + { + byte[] buffer = new byte[MEDIA_UNIT_SIZE * 10]; + string outputFile = Path.Combine(outputDirectory, "game.cxi"); + if (PB_Show.InvokeRequired) + PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(ncchSize); }); + else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(ncchSize); } + + using (FileStream inputFileStream = new FileStream(NCSD_PATH, FileMode.Open, FileAccess.Read), + outputFileStream = new FileStream(outputFile, FileMode.Append, FileAccess.Write)) + { + inputFileStream.Seek(0x4000, SeekOrigin.Begin); + for (int i = 0; i < ncchSize; i++) + { + inputFileStream.Read(buffer, 0, buffer.Length); + outputFileStream.Write(buffer, 0, buffer.Length); + if (PB_Show.InvokeRequired) + PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); + else { PB_Show.PerformStep(); } + + } + } + return outputFile; + } + internal static ulong Align(ulong input, ulong alignsize) { ulong output = input; @@ -110,5 +184,26 @@ internal static ulong Align(ulong input, ulong alignsize) } return output; } + + internal static void updateTB(RichTextBox RTB, string progress) + { + try + { + if (RTB.InvokeRequired) + RTB.Invoke((MethodInvoker)delegate + { + RTB.AppendText(Environment.NewLine + progress); + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + }); + else + { + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + RTB.AppendText(progress + Environment.NewLine); + } + } + catch { } + } } } diff --git a/pk3DS.Core/CTR/RomFS.cs b/pk3DS.Core/CTR/RomFS.cs index c4b5c07617..54e9a465a5 100644 --- a/pk3DS.Core/CTR/RomFS.cs +++ b/pk3DS.Core/CTR/RomFS.cs @@ -471,7 +471,17 @@ internal static string ByteArrayToString(IEnumerable input) internal static void UpdateTB_Progress(string text, RichTextBox TB_Progress = null) { - TB_Progress.Text += text + Environment.NewLine; + if (TB_Progress.InvokeRequired) + { + TB_Progress.Invoke((MethodInvoker)delegate + { + TB_Progress.Text += text + Environment.NewLine; + }); + } + else + { + TB_Progress.Text += text + Environment.NewLine; + } } internal static void BuildRomFSHeader(MemoryStream romfs_stream, RomfsFile[] Entries, string DIR) diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index 0744526b3e..8357de3498 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -48,10 +48,13 @@ private void InitializeComponent() this.Menu_BLZ = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_LZ11 = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Shuffler = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_Extract = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_Extract_CXI = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Rebuild = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_RomFS = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_ExeFS = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_CRO = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_Trimmed3DS = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_3DS = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Patch = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_SMDH = new System.Windows.Forms.ToolStripMenuItem(); @@ -92,9 +95,7 @@ private void InitializeComponent() this.B_Static = new System.Windows.Forms.Button(); this.Tab_Output = new System.Windows.Forms.TabPage(); this.L_Status = new System.Windows.Forms.Label(); - this.Menu_Extract = new System.Windows.Forms.ToolStripMenuItem(); - this.Menu_Extract_CXI = new System.Windows.Forms.ToolStripMenuItem(); - this.Menu_Trimmed3DS = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_Extract_3DS = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.TC_RomFS.SuspendLayout(); this.Tab_RomFS.SuspendLayout(); @@ -221,7 +222,7 @@ private void InitializeComponent() // this.Menu_Open.Name = "Menu_Open"; this.Menu_Open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.Menu_Open.Size = new System.Drawing.Size(180, 22); + this.Menu_Open.Size = new System.Drawing.Size(155, 22); this.Menu_Open.Text = "&Open..."; this.Menu_Open.Click += new System.EventHandler(this.B_Open_Click); // @@ -229,7 +230,7 @@ private void InitializeComponent() // this.Menu_Exit.Name = "Menu_Exit"; this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); - this.Menu_Exit.Size = new System.Drawing.Size(180, 22); + this.Menu_Exit.Size = new System.Drawing.Size(155, 22); this.Menu_Exit.Text = "&Exit"; this.Menu_Exit.Click += new System.EventHandler(this.Menu_Exit_Click); // @@ -297,6 +298,22 @@ private void InitializeComponent() this.Menu_Shuffler.Text = "GARC Shuffler"; this.Menu_Shuffler.Click += new System.EventHandler(this.Menu_Shuffler_Click); // + // Menu_Extract + // + this.Menu_Extract.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.Menu_Extract_CXI, + this.Menu_Extract_3DS}); + this.Menu_Extract.Name = "Menu_Extract"; + this.Menu_Extract.Size = new System.Drawing.Size(184, 22); + this.Menu_Extract.Text = "Extract..."; + // + // Menu_Extract_CXI + // + this.Menu_Extract_CXI.Name = "Menu_Extract_CXI"; + this.Menu_Extract_CXI.Size = new System.Drawing.Size(180, 22); + this.Menu_Extract_CXI.Text = ".CXI"; + this.Menu_Extract_CXI.Click += new System.EventHandler(this.B_ExtractCXI_Click); + // // Menu_Rebuild // this.Menu_Rebuild.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -334,6 +351,14 @@ private void InitializeComponent() this.Menu_CRO.Text = "CRO"; this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR); // + // Menu_Trimmed3DS + // + this.Menu_Trimmed3DS.Enabled = false; + this.Menu_Trimmed3DS.Name = "Menu_Trimmed3DS"; + this.Menu_Trimmed3DS.Size = new System.Drawing.Size(180, 22); + this.Menu_Trimmed3DS.Text = "Trimmed .3DS"; + this.Menu_Trimmed3DS.Click += new System.EventHandler(this.B_RebuildTrimmed3DS_Click); + // // Menu_3DS // this.Menu_3DS.Enabled = false; @@ -387,7 +412,7 @@ private void InitializeComponent() this.Menu_Language.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.CB_Lang}); this.Menu_Language.Name = "Menu_Language"; - this.Menu_Language.Size = new System.Drawing.Size(180, 22); + this.Menu_Language.Size = new System.Drawing.Size(146, 22); this.Menu_Language.Text = "Language"; // // CB_Lang @@ -413,14 +438,14 @@ private void InitializeComponent() this.Menu_About.Name = "Menu_About"; this.Menu_About.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_About.ShowShortcutKeys = false; - this.Menu_About.Size = new System.Drawing.Size(180, 22); + this.Menu_About.Size = new System.Drawing.Size(146, 22); this.Menu_About.Text = "A&bout pk3DS"; this.Menu_About.Click += new System.EventHandler(this.L_About_Click); // // Menu_GARCs // this.Menu_GARCs.Name = "Menu_GARCs"; - this.Menu_GARCs.Size = new System.Drawing.Size(180, 22); + this.Menu_GARCs.Size = new System.Drawing.Size(146, 22); this.Menu_GARCs.Text = "About GARCs"; this.Menu_GARCs.Click += new System.EventHandler(this.L_GARCInfo_Click); // @@ -752,28 +777,12 @@ private void InitializeComponent() this.L_Status.TabIndex = 14; this.L_Status.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // Menu_Extract - // - this.Menu_Extract.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.Menu_Extract_CXI}); - this.Menu_Extract.Name = "Menu_Extract"; - this.Menu_Extract.Size = new System.Drawing.Size(184, 22); - this.Menu_Extract.Text = "Extract..."; - // - // Menu_Extract_CXI - // - this.Menu_Extract_CXI.Name = "Menu_Extract_CXI"; - this.Menu_Extract_CXI.Size = new System.Drawing.Size(180, 22); - this.Menu_Extract_CXI.Text = ".CXI"; - this.Menu_Extract_CXI.Click += new System.EventHandler(this.B_ExtractCXI_Click); - // - // Menu_Trimmed3DS + // Menu_Extract_3DS // - this.Menu_Trimmed3DS.Enabled = false; - this.Menu_Trimmed3DS.Name = "Menu_Trimmed3DS"; - this.Menu_Trimmed3DS.Size = new System.Drawing.Size(180, 22); - this.Menu_Trimmed3DS.Text = "Trimmed .3DS"; - this.Menu_Trimmed3DS.Click += new System.EventHandler(this.B_RebuildTrimmed3DS_Click); + this.Menu_Extract_3DS.Name = "Menu_Extract_3DS"; + this.Menu_Extract_3DS.Size = new System.Drawing.Size(180, 22); + this.Menu_Extract_3DS.Text = ".3DS"; + this.Menu_Extract_3DS.Click += new System.EventHandler(this.B_Extract3DS_Click); // // Main // @@ -876,5 +885,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem Menu_Extract; private System.Windows.Forms.ToolStripMenuItem Menu_Extract_CXI; private System.Windows.Forms.ToolStripMenuItem Menu_Trimmed3DS; + private System.Windows.Forms.ToolStripMenuItem Menu_Extract_3DS; } } \ No newline at end of file diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index 64621f61df..fcaec0a3a6 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -273,7 +273,29 @@ private void B_ExtractCXI_Click(object sender, EventArgs e) extractNCCH(inputCXI, fbd.SelectedPath); } - WinFormsUtil.Prompt(MessageBoxButtons.OK, "Extraction complete!"); + } + + private void B_Extract3DS_Click(object sender, EventArgs e) + { + if (WinFormsUtil.Prompt( + MessageBoxButtons.OKCancel, + "Extracting a 3DS file requires multiple GB of disc space and takes some time to complete.", + "If you want to continue, press OK to select your CXI and then select your output directory. For best results, make sure the output directory is an empty directory.") == DialogResult.OK) + { + string input3DS; + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Title = "Select 3DS"; + ofd.Filter = "3DS files (*.3ds)|*.3ds"; + if (ofd.ShowDialog() == DialogResult.OK) + input3DS = ofd.FileName; + else + return; + + FolderBrowserDialog fbd = new FolderBrowserDialog(); + DialogResult result = fbd.ShowDialog(); + if (result == DialogResult.OK) + extractNCSD(input3DS, fbd.SelectedPath); + } } private void extractNCCH(string ncchPath, string outputDirectory) @@ -282,7 +304,29 @@ private void extractNCCH(string ncchPath, string outputDirectory) return; NCCH ncch = new NCCH(); - ncch.ExtractNCCHFromFile(ncchPath, outputDirectory, RTB_Status, pBar1); + + new Thread(() => + { + threads++; + ncch.ExtractNCCHFromFile(ncchPath, outputDirectory, RTB_Status, pBar1); + threads--; + WinFormsUtil.Prompt(MessageBoxButtons.OK, "Extraction complete!"); + }).Start(); + } + + private void extractNCSD(string ncsdPath, string outputDirectory) + { + if (!File.Exists(ncsdPath)) + return; + + NCSD ncsd = new NCSD(); + new Thread(() => + { + threads++; + ncsd.ExtractFilesFromNCSD(ncsdPath, outputDirectory, RTB_Status, pBar1); + threads--; + WinFormsUtil.Prompt(MessageBoxButtons.OK, "Extraction complete!"); + }).Start(); } private void ToggleSubEditors() @@ -1204,13 +1248,6 @@ private void B_RebuildTrimmed3DS_Click(object sender, EventArgs e) // 3DS Building private void B_Rebuild3DS_Click(object sender, EventArgs e) { - // Ensure that the romfs paths are valid - string[] files = Directory.GetFiles(TB_Path.Text, "*", SearchOption.AllDirectories); - if (!Config.IsRebuildable(files.Length)) - { - WinFormsUtil.Error("RomFS file count does not match the default game file count."); - return; - } if (threadActive()) return; From 59ba986d98c5dbdf57d52db3f787f0850db3df96 Mon Sep 17 00:00:00 2001 From: Egzon Qukovci Jusufi Date: Tue, 8 Oct 2019 22:48:35 +0200 Subject: [PATCH 151/191] Port the Current Levelup Moves and High Attack Levelup Moves buttons/behavior from SMTE to StaticEncounterEditor7. Also add autocomplete settings to avoid unnecessary breakings. --- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 26 +- .../Gen7/StaticEncounterEditor7.Designer.cs | 809 +++++++++++------- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 38 +- 3 files changed, 565 insertions(+), 308 deletions(-) diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 9bdc6f641b..cfd23f2cd1 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -1386,17 +1386,6 @@ private void InitializeComponent() this.CB_Move1.Size = new System.Drawing.Size(121, 21); this.CB_Move1.TabIndex = 1; // - // CB_Move4 - // - this.CB_Move4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; - this.CB_Move4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Move4.FormattingEnabled = true; - this.CB_Move4.Location = new System.Drawing.Point(40, 82); - this.CB_Move4.Margin = new System.Windows.Forms.Padding(0); - this.CB_Move4.Name = "CB_Move4"; - this.CB_Move4.Size = new System.Drawing.Size(121, 21); - this.CB_Move4.TabIndex = 2; - // // CB_Move2 // this.CB_Move2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; @@ -1406,7 +1395,7 @@ private void InitializeComponent() this.CB_Move2.Margin = new System.Windows.Forms.Padding(0); this.CB_Move2.Name = "CB_Move2"; this.CB_Move2.Size = new System.Drawing.Size(121, 21); - this.CB_Move2.TabIndex = 1; + this.CB_Move2.TabIndex = 2; // // CB_Move3 // @@ -1417,7 +1406,18 @@ private void InitializeComponent() this.CB_Move3.Margin = new System.Windows.Forms.Padding(0); this.CB_Move3.Name = "CB_Move3"; this.CB_Move3.Size = new System.Drawing.Size(121, 21); - this.CB_Move3.TabIndex = 2; + this.CB_Move3.TabIndex = 3; + // + // CB_Move4 + // + this.CB_Move4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_Move4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Move4.FormattingEnabled = true; + this.CB_Move4.Location = new System.Drawing.Point(40, 82); + this.CB_Move4.Margin = new System.Windows.Forms.Padding(0); + this.CB_Move4.Name = "CB_Move4"; + this.CB_Move4.Size = new System.Drawing.Size(121, 21); + this.CB_Move4.TabIndex = 4; // // L_TrainerName // diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs index c2cbcd18e0..06773c0c79 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.Designer.cs @@ -49,6 +49,9 @@ private void InitializeComponent() this.NUD_GLevel = new System.Windows.Forms.NumericUpDown(); this.LB_Gift = new System.Windows.Forms.ListBox(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); + this.B_ClearSE = new System.Windows.Forms.Button(); + this.B_CurrentAttackSE = new System.Windows.Forms.Button(); + this.B_HighAttackSE = new System.Windows.Forms.Button(); this.CB_EGender = new System.Windows.Forms.ComboBox(); this.L_SOS1 = new System.Windows.Forms.Label(); this.NUD_Ally1 = new System.Windows.Forms.NumericUpDown(); @@ -222,10 +225,11 @@ private void InitializeComponent() this.TC_Tabs.Controls.Add(this.Tab_Encounters); this.TC_Tabs.Controls.Add(this.Tab_Trades); this.TC_Tabs.Controls.Add(this.Tab_Randomizer); - this.TC_Tabs.Location = new System.Drawing.Point(12, 11); + this.TC_Tabs.Location = new System.Drawing.Point(16, 14); + this.TC_Tabs.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.TC_Tabs.Name = "TC_Tabs"; this.TC_Tabs.SelectedIndex = 0; - this.TC_Tabs.Size = new System.Drawing.Size(506, 538); + this.TC_Tabs.Size = new System.Drawing.Size(675, 662); this.TC_Tabs.TabIndex = 0; // // Tab_Gifts @@ -248,9 +252,10 @@ private void InitializeComponent() this.Tab_Gifts.Controls.Add(this.L_GSpecies); this.Tab_Gifts.Controls.Add(this.NUD_GLevel); this.Tab_Gifts.Controls.Add(this.LB_Gift); - this.Tab_Gifts.Location = new System.Drawing.Point(4, 22); + this.Tab_Gifts.Location = new System.Drawing.Point(4, 25); + this.Tab_Gifts.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Tab_Gifts.Name = "Tab_Gifts"; - this.Tab_Gifts.Size = new System.Drawing.Size(498, 512); + this.Tab_Gifts.Size = new System.Drawing.Size(667, 633); this.Tab_Gifts.TabIndex = 2; this.Tab_Gifts.Text = "Gifts"; this.Tab_Gifts.UseVisualStyleBackColor = true; @@ -258,33 +263,39 @@ private void InitializeComponent() // CB_GAbility // this.CB_GAbility.FormattingEnabled = true; - this.CB_GAbility.Location = new System.Drawing.Point(187, 71); + this.CB_GAbility.Location = new System.Drawing.Point(249, 87); + this.CB_GAbility.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_GAbility.Name = "CB_GAbility"; - this.CB_GAbility.Size = new System.Drawing.Size(136, 21); + this.CB_GAbility.Size = new System.Drawing.Size(180, 24); this.CB_GAbility.TabIndex = 513; // // L_GAbility // - this.L_GAbility.Location = new System.Drawing.Point(131, 69); + this.L_GAbility.Location = new System.Drawing.Point(175, 85); + this.L_GAbility.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_GAbility.Name = "L_GAbility"; - this.L_GAbility.Size = new System.Drawing.Size(55, 23); + this.L_GAbility.Size = new System.Drawing.Size(73, 28); this.L_GAbility.TabIndex = 512; this.L_GAbility.Text = "Ability:"; this.L_GAbility.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // CB_GNature // + this.CB_GNature.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_GNature.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_GNature.FormattingEnabled = true; - this.CB_GNature.Location = new System.Drawing.Point(187, 115); + this.CB_GNature.Location = new System.Drawing.Point(249, 142); + this.CB_GNature.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_GNature.Name = "CB_GNature"; - this.CB_GNature.Size = new System.Drawing.Size(136, 21); + this.CB_GNature.Size = new System.Drawing.Size(180, 24); this.CB_GNature.TabIndex = 511; // // L_GNature // - this.L_GNature.Location = new System.Drawing.Point(131, 113); + this.L_GNature.Location = new System.Drawing.Point(175, 139); + this.L_GNature.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_GNature.Name = "L_GNature"; - this.L_GNature.Size = new System.Drawing.Size(55, 23); + this.L_GNature.Size = new System.Drawing.Size(73, 28); this.L_GNature.TabIndex = 510; this.L_GNature.Text = "Nature:"; this.L_GNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -292,9 +303,10 @@ private void InitializeComponent() // CHK_IsEgg // this.CHK_IsEgg.AutoSize = true; - this.CHK_IsEgg.Location = new System.Drawing.Point(187, 193); + this.CHK_IsEgg.Location = new System.Drawing.Point(249, 238); + this.CHK_IsEgg.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_IsEgg.Name = "CHK_IsEgg"; - this.CHK_IsEgg.Size = new System.Drawing.Size(56, 17); + this.CHK_IsEgg.Size = new System.Drawing.Size(65, 20); this.CHK_IsEgg.TabIndex = 509; this.CHK_IsEgg.Text = "Is Egg"; this.CHK_IsEgg.UseVisualStyleBackColor = true; @@ -302,26 +314,31 @@ private void InitializeComponent() // CHK_GIV3 // this.CHK_GIV3.AutoSize = true; - this.CHK_GIV3.Location = new System.Drawing.Point(187, 178); + this.CHK_GIV3.Location = new System.Drawing.Point(249, 219); + this.CHK_GIV3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_GIV3.Name = "CHK_GIV3"; - this.CHK_GIV3.Size = new System.Drawing.Size(42, 17); + this.CHK_GIV3.Size = new System.Drawing.Size(46, 20); this.CHK_GIV3.TabIndex = 508; this.CHK_GIV3.Text = "3IV"; this.CHK_GIV3.UseVisualStyleBackColor = true; // // CB_SpecialMove // + this.CB_SpecialMove.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_SpecialMove.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_SpecialMove.FormattingEnabled = true; - this.CB_SpecialMove.Location = new System.Drawing.Point(187, 137); + this.CB_SpecialMove.Location = new System.Drawing.Point(249, 169); + this.CB_SpecialMove.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_SpecialMove.Name = "CB_SpecialMove"; - this.CB_SpecialMove.Size = new System.Drawing.Size(136, 21); + this.CB_SpecialMove.Size = new System.Drawing.Size(180, 24); this.CB_SpecialMove.TabIndex = 507; // // L_SpecialMove // - this.L_SpecialMove.Location = new System.Drawing.Point(121, 135); + this.L_SpecialMove.Location = new System.Drawing.Point(161, 166); + this.L_SpecialMove.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SpecialMove.Name = "L_SpecialMove"; - this.L_SpecialMove.Size = new System.Drawing.Size(65, 23); + this.L_SpecialMove.Size = new System.Drawing.Size(87, 28); this.L_SpecialMove.TabIndex = 506; this.L_SpecialMove.Text = "Gift Move:"; this.L_SpecialMove.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -329,58 +346,68 @@ private void InitializeComponent() // CHK_G_Lock // this.CHK_G_Lock.AutoSize = true; - this.CHK_G_Lock.Location = new System.Drawing.Point(187, 163); + this.CHK_G_Lock.Location = new System.Drawing.Point(249, 201); + this.CHK_G_Lock.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G_Lock.Name = "CHK_G_Lock"; - this.CHK_G_Lock.Size = new System.Drawing.Size(79, 17); + this.CHK_G_Lock.Size = new System.Drawing.Size(92, 20); this.CHK_G_Lock.TabIndex = 19; this.CHK_G_Lock.Text = "Shiny Lock"; this.CHK_G_Lock.UseVisualStyleBackColor = true; // // CB_GHeldItem // + this.CB_GHeldItem.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_GHeldItem.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_GHeldItem.FormattingEnabled = true; - this.CB_GHeldItem.Location = new System.Drawing.Point(187, 93); + this.CB_GHeldItem.Location = new System.Drawing.Point(249, 114); + this.CB_GHeldItem.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_GHeldItem.Name = "CB_GHeldItem"; - this.CB_GHeldItem.Size = new System.Drawing.Size(136, 21); + this.CB_GHeldItem.Size = new System.Drawing.Size(180, 24); this.CB_GHeldItem.TabIndex = 8; // // L_GHeldItem // - this.L_GHeldItem.Location = new System.Drawing.Point(131, 91); + this.L_GHeldItem.Location = new System.Drawing.Point(175, 112); + this.L_GHeldItem.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_GHeldItem.Name = "L_GHeldItem"; - this.L_GHeldItem.Size = new System.Drawing.Size(55, 23); + this.L_GHeldItem.Size = new System.Drawing.Size(73, 28); this.L_GHeldItem.TabIndex = 7; this.L_GHeldItem.Text = "Held Item:"; this.L_GHeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // CB_GSpecies // + this.CB_GSpecies.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_GSpecies.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_GSpecies.FormattingEnabled = true; - this.CB_GSpecies.Location = new System.Drawing.Point(187, 7); + this.CB_GSpecies.Location = new System.Drawing.Point(249, 9); + this.CB_GSpecies.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_GSpecies.Name = "CB_GSpecies"; - this.CB_GSpecies.Size = new System.Drawing.Size(136, 21); + this.CB_GSpecies.Size = new System.Drawing.Size(180, 24); this.CB_GSpecies.TabIndex = 6; this.CB_GSpecies.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // L_GForm // - this.L_GForm.Location = new System.Drawing.Point(131, 47); + this.L_GForm.Location = new System.Drawing.Point(175, 58); + this.L_GForm.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_GForm.Name = "L_GForm"; - this.L_GForm.Size = new System.Drawing.Size(55, 23); + this.L_GForm.Size = new System.Drawing.Size(73, 28); this.L_GForm.TabIndex = 5; this.L_GForm.Text = "Form:"; this.L_GForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_GForm // - this.NUD_GForm.Location = new System.Drawing.Point(187, 50); + this.NUD_GForm.Location = new System.Drawing.Point(249, 62); + this.NUD_GForm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_GForm.Maximum = new decimal(new int[] { 255, 0, 0, 0}); this.NUD_GForm.Name = "NUD_GForm"; - this.NUD_GForm.Size = new System.Drawing.Size(48, 20); + this.NUD_GForm.Size = new System.Drawing.Size(64, 22); this.NUD_GForm.TabIndex = 4; this.NUD_GForm.Value = new decimal(new int[] { 100, @@ -390,27 +417,30 @@ private void InitializeComponent() // // L_GLevel // - this.L_GLevel.Location = new System.Drawing.Point(131, 26); + this.L_GLevel.Location = new System.Drawing.Point(175, 32); + this.L_GLevel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_GLevel.Name = "L_GLevel"; - this.L_GLevel.Size = new System.Drawing.Size(55, 23); + this.L_GLevel.Size = new System.Drawing.Size(73, 28); this.L_GLevel.TabIndex = 3; this.L_GLevel.Text = "Level:"; this.L_GLevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_GSpecies // - this.L_GSpecies.Location = new System.Drawing.Point(131, 5); + this.L_GSpecies.Location = new System.Drawing.Point(175, 6); + this.L_GSpecies.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_GSpecies.Name = "L_GSpecies"; - this.L_GSpecies.Size = new System.Drawing.Size(55, 23); + this.L_GSpecies.Size = new System.Drawing.Size(73, 28); this.L_GSpecies.TabIndex = 2; this.L_GSpecies.Text = "Species:"; this.L_GSpecies.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_GLevel // - this.NUD_GLevel.Location = new System.Drawing.Point(187, 29); + this.NUD_GLevel.Location = new System.Drawing.Point(249, 36); + this.NUD_GLevel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_GLevel.Name = "NUD_GLevel"; - this.NUD_GLevel.Size = new System.Drawing.Size(48, 20); + this.NUD_GLevel.Size = new System.Drawing.Size(64, 22); this.NUD_GLevel.TabIndex = 1; this.NUD_GLevel.Value = new decimal(new int[] { 100, @@ -423,14 +453,19 @@ private void InitializeComponent() this.LB_Gift.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.LB_Gift.FormattingEnabled = true; - this.LB_Gift.Location = new System.Drawing.Point(3, 3); + this.LB_Gift.ItemHeight = 16; + this.LB_Gift.Location = new System.Drawing.Point(4, 4); + this.LB_Gift.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.LB_Gift.Name = "LB_Gift"; - this.LB_Gift.Size = new System.Drawing.Size(115, 498); + this.LB_Gift.Size = new System.Drawing.Size(152, 612); this.LB_Gift.TabIndex = 0; this.LB_Gift.SelectedIndexChanged += new System.EventHandler(this.LB_Gift_SelectedIndexChanged); // // Tab_Encounters // + this.Tab_Encounters.Controls.Add(this.B_ClearSE); + this.Tab_Encounters.Controls.Add(this.B_CurrentAttackSE); + this.Tab_Encounters.Controls.Add(this.B_HighAttackSE); this.Tab_Encounters.Controls.Add(this.CB_EGender); this.Tab_Encounters.Controls.Add(this.L_SOS1); this.Tab_Encounters.Controls.Add(this.NUD_Ally1); @@ -459,34 +494,71 @@ private void InitializeComponent() this.Tab_Encounters.Controls.Add(this.LB_Encounter); this.Tab_Encounters.Controls.Add(this.L_Ally2); this.Tab_Encounters.Controls.Add(this.L_Ally1); - this.Tab_Encounters.Location = new System.Drawing.Point(4, 22); + this.Tab_Encounters.Location = new System.Drawing.Point(4, 25); + this.Tab_Encounters.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Tab_Encounters.Name = "Tab_Encounters"; - this.Tab_Encounters.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Encounters.Size = new System.Drawing.Size(498, 512); + this.Tab_Encounters.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Tab_Encounters.Size = new System.Drawing.Size(667, 633); this.Tab_Encounters.TabIndex = 0; this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // + // B_ClearSE + // + this.B_ClearSE.Location = new System.Drawing.Point(357, 421); + this.B_ClearSE.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_ClearSE.Name = "B_ClearSE"; + this.B_ClearSE.Size = new System.Drawing.Size(124, 28); + this.B_ClearSE.TabIndex = 529; + this.B_ClearSE.Text = "Clear"; + this.B_ClearSE.UseVisualStyleBackColor = true; + this.B_ClearSE.Click += new System.EventHandler(this.B_ClearSE_Click); + // + // B_CurrentAttackSE + // + this.B_CurrentAttackSE.Location = new System.Drawing.Point(357, 317); + this.B_CurrentAttackSE.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_CurrentAttackSE.Name = "B_CurrentAttackSE"; + this.B_CurrentAttackSE.Size = new System.Drawing.Size(124, 49); + this.B_CurrentAttackSE.TabIndex = 528; + this.B_CurrentAttackSE.Text = "Current Level Levelup Moves"; + this.B_CurrentAttackSE.UseVisualStyleBackColor = true; + this.B_CurrentAttackSE.Click += new System.EventHandler(this.B_CurrentAttackSE_Click); + // + // B_HighAttackSE + // + this.B_HighAttackSE.Location = new System.Drawing.Point(357, 369); + this.B_HighAttackSE.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_HighAttackSE.Name = "B_HighAttackSE"; + this.B_HighAttackSE.Size = new System.Drawing.Size(124, 49); + this.B_HighAttackSE.TabIndex = 527; + this.B_HighAttackSE.Text = "High Attacking Levelup Moves"; + this.B_HighAttackSE.UseVisualStyleBackColor = true; + this.B_HighAttackSE.Click += new System.EventHandler(this.B_HighAttackSE_Click); + // // CB_EGender // this.CB_EGender.FormattingEnabled = true; - this.CB_EGender.Location = new System.Drawing.Point(187, 71); + this.CB_EGender.Location = new System.Drawing.Point(249, 87); + this.CB_EGender.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_EGender.Name = "CB_EGender"; - this.CB_EGender.Size = new System.Drawing.Size(136, 21); + this.CB_EGender.Size = new System.Drawing.Size(180, 24); this.CB_EGender.TabIndex = 526; // // L_SOS1 // - this.L_SOS1.Location = new System.Drawing.Point(126, 178); + this.L_SOS1.Location = new System.Drawing.Point(168, 219); + this.L_SOS1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SOS1.Name = "L_SOS1"; - this.L_SOS1.Size = new System.Drawing.Size(60, 23); + this.L_SOS1.Size = new System.Drawing.Size(80, 28); this.L_SOS1.TabIndex = 523; this.L_SOS1.Text = "SOS Ally 1:"; this.L_SOS1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Ally1 // - this.NUD_Ally1.Location = new System.Drawing.Point(187, 181); + this.NUD_Ally1.Location = new System.Drawing.Point(249, 223); + this.NUD_Ally1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_Ally1.Maximum = new decimal(new int[] { 251, 0, @@ -498,21 +570,23 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_Ally1.Name = "NUD_Ally1"; - this.NUD_Ally1.Size = new System.Drawing.Size(48, 20); + this.NUD_Ally1.Size = new System.Drawing.Size(64, 22); this.NUD_Ally1.TabIndex = 522; // // L_SOS2 // - this.L_SOS2.Location = new System.Drawing.Point(126, 199); + this.L_SOS2.Location = new System.Drawing.Point(168, 245); + this.L_SOS2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SOS2.Name = "L_SOS2"; - this.L_SOS2.Size = new System.Drawing.Size(60, 23); + this.L_SOS2.Size = new System.Drawing.Size(80, 28); this.L_SOS2.TabIndex = 521; this.L_SOS2.Text = "SOS Ally 2:"; this.L_SOS2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Ally2 // - this.NUD_Ally2.Location = new System.Drawing.Point(187, 202); + this.NUD_Ally2.Location = new System.Drawing.Point(249, 249); + this.NUD_Ally2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_Ally2.Maximum = new decimal(new int[] { 251, 0, @@ -524,14 +598,15 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_Ally2.Name = "NUD_Ally2"; - this.NUD_Ally2.Size = new System.Drawing.Size(48, 20); + this.NUD_Ally2.Size = new System.Drawing.Size(64, 22); this.NUD_Ally2.TabIndex = 520; // // L_EGender // - this.L_EGender.Location = new System.Drawing.Point(131, 69); + this.L_EGender.Location = new System.Drawing.Point(175, 85); + this.L_EGender.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_EGender.Name = "L_EGender"; - this.L_EGender.Size = new System.Drawing.Size(55, 23); + this.L_EGender.Size = new System.Drawing.Size(73, 28); this.L_EGender.TabIndex = 519; this.L_EGender.Text = "Gender:"; this.L_EGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -539,16 +614,18 @@ private void InitializeComponent() // CB_EAbility // this.CB_EAbility.FormattingEnabled = true; - this.CB_EAbility.Location = new System.Drawing.Point(187, 93); + this.CB_EAbility.Location = new System.Drawing.Point(249, 114); + this.CB_EAbility.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_EAbility.Name = "CB_EAbility"; - this.CB_EAbility.Size = new System.Drawing.Size(136, 21); + this.CB_EAbility.Size = new System.Drawing.Size(180, 24); this.CB_EAbility.TabIndex = 517; // // L_EAbility // - this.L_EAbility.Location = new System.Drawing.Point(131, 91); + this.L_EAbility.Location = new System.Drawing.Point(175, 112); + this.L_EAbility.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_EAbility.Name = "L_EAbility"; - this.L_EAbility.Size = new System.Drawing.Size(55, 23); + this.L_EAbility.Size = new System.Drawing.Size(73, 28); this.L_EAbility.TabIndex = 516; this.L_EAbility.Text = "Ability:"; this.L_EAbility.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -556,26 +633,31 @@ private void InitializeComponent() // CHK_EIV3 // this.CHK_EIV3.AutoSize = true; - this.CHK_EIV3.Location = new System.Drawing.Point(187, 240); + this.CHK_EIV3.Location = new System.Drawing.Point(249, 295); + this.CHK_EIV3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_EIV3.Name = "CHK_EIV3"; - this.CHK_EIV3.Size = new System.Drawing.Size(42, 17); + this.CHK_EIV3.Size = new System.Drawing.Size(46, 20); this.CHK_EIV3.TabIndex = 504; this.CHK_EIV3.Text = "3IV"; this.CHK_EIV3.UseVisualStyleBackColor = true; // // CB_ENature // + this.CB_ENature.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_ENature.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_ENature.FormattingEnabled = true; - this.CB_ENature.Location = new System.Drawing.Point(187, 137); + this.CB_ENature.Location = new System.Drawing.Point(249, 169); + this.CB_ENature.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_ENature.Name = "CB_ENature"; - this.CB_ENature.Size = new System.Drawing.Size(136, 21); + this.CB_ENature.Size = new System.Drawing.Size(180, 24); this.CB_ENature.TabIndex = 503; // // L_ENature // - this.L_ENature.Location = new System.Drawing.Point(131, 135); + this.L_ENature.Location = new System.Drawing.Point(175, 166); + this.L_ENature.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_ENature.Name = "L_ENature"; - this.L_ENature.Size = new System.Drawing.Size(55, 23); + this.L_ENature.Size = new System.Drawing.Size(73, 28); this.L_ENature.TabIndex = 502; this.L_ENature.Text = "Nature:"; this.L_ENature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -594,23 +676,26 @@ private void InitializeComponent() this.GB_EEVs.Controls.Add(this.label3); this.GB_EEVs.Controls.Add(this.label4); this.GB_EEVs.Controls.Add(this.label5); - this.GB_EEVs.Location = new System.Drawing.Point(280, 371); + this.GB_EEVs.Location = new System.Drawing.Point(373, 457); + this.GB_EEVs.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.GB_EEVs.Name = "GB_EEVs"; - this.GB_EEVs.Size = new System.Drawing.Size(160, 112); + this.GB_EEVs.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.GB_EEVs.Size = new System.Drawing.Size(213, 138); this.GB_EEVs.TabIndex = 501; this.GB_EEVs.TabStop = false; this.GB_EEVs.Text = "EVs"; // // NUD_EV5 // - this.NUD_EV5.Location = new System.Drawing.Point(111, 82); + this.NUD_EV5.Location = new System.Drawing.Point(148, 101); + this.NUD_EV5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EV5.Maximum = new decimal(new int[] { 252, 0, 0, 0}); this.NUD_EV5.Name = "NUD_EV5"; - this.NUD_EV5.Size = new System.Drawing.Size(40, 20); + this.NUD_EV5.Size = new System.Drawing.Size(53, 22); this.NUD_EV5.TabIndex = 515; this.NUD_EV5.Value = new decimal(new int[] { 252, @@ -620,14 +705,15 @@ private void InitializeComponent() // // NUD_EV4 // - this.NUD_EV4.Location = new System.Drawing.Point(111, 51); + this.NUD_EV4.Location = new System.Drawing.Point(148, 63); + this.NUD_EV4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EV4.Maximum = new decimal(new int[] { 252, 0, 0, 0}); this.NUD_EV4.Name = "NUD_EV4"; - this.NUD_EV4.Size = new System.Drawing.Size(40, 20); + this.NUD_EV4.Size = new System.Drawing.Size(53, 22); this.NUD_EV4.TabIndex = 516; this.NUD_EV4.Value = new decimal(new int[] { 252, @@ -637,14 +723,15 @@ private void InitializeComponent() // // NUD_EV3 // - this.NUD_EV3.Location = new System.Drawing.Point(111, 20); + this.NUD_EV3.Location = new System.Drawing.Point(148, 25); + this.NUD_EV3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EV3.Maximum = new decimal(new int[] { 252, 0, 0, 0}); this.NUD_EV3.Name = "NUD_EV3"; - this.NUD_EV3.Size = new System.Drawing.Size(40, 20); + this.NUD_EV3.Size = new System.Drawing.Size(53, 22); this.NUD_EV3.TabIndex = 514; this.NUD_EV3.Value = new decimal(new int[] { 252, @@ -654,14 +741,15 @@ private void InitializeComponent() // // NUD_EV2 // - this.NUD_EV2.Location = new System.Drawing.Point(33, 82); + this.NUD_EV2.Location = new System.Drawing.Point(44, 101); + this.NUD_EV2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EV2.Maximum = new decimal(new int[] { 252, 0, 0, 0}); this.NUD_EV2.Name = "NUD_EV2"; - this.NUD_EV2.Size = new System.Drawing.Size(40, 20); + this.NUD_EV2.Size = new System.Drawing.Size(53, 22); this.NUD_EV2.TabIndex = 502; this.NUD_EV2.Value = new decimal(new int[] { 252, @@ -671,14 +759,15 @@ private void InitializeComponent() // // NUD_EV1 // - this.NUD_EV1.Location = new System.Drawing.Point(33, 51); + this.NUD_EV1.Location = new System.Drawing.Point(44, 63); + this.NUD_EV1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EV1.Maximum = new decimal(new int[] { 252, 0, 0, 0}); this.NUD_EV1.Name = "NUD_EV1"; - this.NUD_EV1.Size = new System.Drawing.Size(40, 20); + this.NUD_EV1.Size = new System.Drawing.Size(53, 22); this.NUD_EV1.TabIndex = 513; this.NUD_EV1.Value = new decimal(new int[] { 252, @@ -688,41 +777,45 @@ private void InitializeComponent() // // label2 // - this.label2.Location = new System.Drawing.Point(4, 18); + this.label2.Location = new System.Drawing.Point(5, 22); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(29, 21); + this.label2.Size = new System.Drawing.Size(39, 26); this.label2.TabIndex = 507; this.label2.Text = "HP:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // label7 // - this.label7.Location = new System.Drawing.Point(4, 80); + this.label7.Location = new System.Drawing.Point(5, 98); + this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(29, 21); + this.label7.Size = new System.Drawing.Size(39, 26); this.label7.TabIndex = 509; this.label7.Text = "Def:"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // label6 // - this.label6.Location = new System.Drawing.Point(7, 49); + this.label6.Location = new System.Drawing.Point(9, 60); + this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(26, 21); + this.label6.Size = new System.Drawing.Size(35, 26); this.label6.TabIndex = 508; this.label6.Text = "Atk:"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_EV0 // - this.NUD_EV0.Location = new System.Drawing.Point(33, 20); + this.NUD_EV0.Location = new System.Drawing.Point(44, 25); + this.NUD_EV0.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EV0.Maximum = new decimal(new int[] { 252, 0, 0, 0}); this.NUD_EV0.Name = "NUD_EV0"; - this.NUD_EV0.Size = new System.Drawing.Size(40, 20); + this.NUD_EV0.Size = new System.Drawing.Size(53, 22); this.NUD_EV0.TabIndex = 501; this.NUD_EV0.Value = new decimal(new int[] { 252, @@ -732,27 +825,30 @@ private void InitializeComponent() // // label3 // - this.label3.Location = new System.Drawing.Point(79, 49); + this.label3.Location = new System.Drawing.Point(105, 60); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(31, 21); + this.label3.Size = new System.Drawing.Size(41, 26); this.label3.TabIndex = 512; this.label3.Text = "SpD:"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // label4 // - this.label4.Location = new System.Drawing.Point(79, 80); + this.label4.Location = new System.Drawing.Point(105, 98); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(31, 21); + this.label4.Size = new System.Drawing.Size(41, 26); this.label4.TabIndex = 511; this.label4.Text = "Spe:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // label5 // - this.label5.Location = new System.Drawing.Point(79, 18); + this.label5.Location = new System.Drawing.Point(105, 22); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(31, 21); + this.label5.Size = new System.Drawing.Size(41, 26); this.label5.TabIndex = 510; this.label5.Text = "SpA:"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -771,25 +867,29 @@ private void InitializeComponent() this.GB_EIVs.Controls.Add(this.NUD_EIV0); this.GB_EIVs.Controls.Add(this.L_ATK); this.GB_EIVs.Controls.Add(this.L_DEF); - this.GB_EIVs.Location = new System.Drawing.Point(129, 371); + this.GB_EIVs.Location = new System.Drawing.Point(172, 457); + this.GB_EIVs.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.GB_EIVs.Name = "GB_EIVs"; - this.GB_EIVs.Size = new System.Drawing.Size(148, 112); + this.GB_EIVs.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.GB_EIVs.Size = new System.Drawing.Size(197, 138); this.GB_EIVs.TabIndex = 21; this.GB_EIVs.TabStop = false; this.GB_EIVs.Text = "IVs"; // // L_HP // - this.L_HP.Location = new System.Drawing.Point(4, 16); + this.L_HP.Location = new System.Drawing.Point(5, 20); + this.L_HP.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_HP.Name = "L_HP"; - this.L_HP.Size = new System.Drawing.Size(29, 21); + this.L_HP.Size = new System.Drawing.Size(39, 26); this.L_HP.TabIndex = 495; this.L_HP.Text = "HP:"; this.L_HP.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_EIV3 // - this.NUD_EIV3.Location = new System.Drawing.Point(104, 18); + this.NUD_EIV3.Location = new System.Drawing.Point(139, 22); + this.NUD_EIV3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EIV3.Maximum = new decimal(new int[] { 31, 0, @@ -801,7 +901,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_EIV3.Name = "NUD_EIV3"; - this.NUD_EIV3.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV3.Size = new System.Drawing.Size(45, 22); this.NUD_EIV3.TabIndex = 492; this.NUD_EIV3.Value = new decimal(new int[] { 31, @@ -811,7 +911,8 @@ private void InitializeComponent() // // NUD_EIV4 // - this.NUD_EIV4.Location = new System.Drawing.Point(104, 49); + this.NUD_EIV4.Location = new System.Drawing.Point(139, 60); + this.NUD_EIV4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EIV4.Maximum = new decimal(new int[] { 31, 0, @@ -823,7 +924,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_EIV4.Name = "NUD_EIV4"; - this.NUD_EIV4.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV4.Size = new System.Drawing.Size(45, 22); this.NUD_EIV4.TabIndex = 493; this.NUD_EIV4.Value = new decimal(new int[] { 31, @@ -833,7 +934,8 @@ private void InitializeComponent() // // NUD_EIV5 // - this.NUD_EIV5.Location = new System.Drawing.Point(104, 80); + this.NUD_EIV5.Location = new System.Drawing.Point(139, 98); + this.NUD_EIV5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EIV5.Maximum = new decimal(new int[] { 31, 0, @@ -845,7 +947,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_EIV5.Name = "NUD_EIV5"; - this.NUD_EIV5.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV5.Size = new System.Drawing.Size(45, 22); this.NUD_EIV5.TabIndex = 494; this.NUD_EIV5.Value = new decimal(new int[] { 31, @@ -855,34 +957,38 @@ private void InitializeComponent() // // L_SPD // - this.L_SPD.Location = new System.Drawing.Point(73, 47); + this.L_SPD.Location = new System.Drawing.Point(97, 58); + this.L_SPD.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SPD.Name = "L_SPD"; - this.L_SPD.Size = new System.Drawing.Size(31, 21); + this.L_SPD.Size = new System.Drawing.Size(41, 26); this.L_SPD.TabIndex = 500; this.L_SPD.Text = "SpD:"; this.L_SPD.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_SPE // - this.L_SPE.Location = new System.Drawing.Point(73, 78); + this.L_SPE.Location = new System.Drawing.Point(97, 96); + this.L_SPE.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SPE.Name = "L_SPE"; - this.L_SPE.Size = new System.Drawing.Size(31, 21); + this.L_SPE.Size = new System.Drawing.Size(41, 26); this.L_SPE.TabIndex = 499; this.L_SPE.Text = "Spe:"; this.L_SPE.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_SPA // - this.L_SPA.Location = new System.Drawing.Point(73, 16); + this.L_SPA.Location = new System.Drawing.Point(97, 20); + this.L_SPA.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SPA.Name = "L_SPA"; - this.L_SPA.Size = new System.Drawing.Size(31, 21); + this.L_SPA.Size = new System.Drawing.Size(41, 26); this.L_SPA.TabIndex = 498; this.L_SPA.Text = "SpA:"; this.L_SPA.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_EIV2 // - this.NUD_EIV2.Location = new System.Drawing.Point(33, 80); + this.NUD_EIV2.Location = new System.Drawing.Point(44, 98); + this.NUD_EIV2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EIV2.Maximum = new decimal(new int[] { 31, 0, @@ -894,7 +1000,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_EIV2.Name = "NUD_EIV2"; - this.NUD_EIV2.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV2.Size = new System.Drawing.Size(45, 22); this.NUD_EIV2.TabIndex = 491; this.NUD_EIV2.Value = new decimal(new int[] { 31, @@ -904,7 +1010,8 @@ private void InitializeComponent() // // NUD_EIV1 // - this.NUD_EIV1.Location = new System.Drawing.Point(33, 49); + this.NUD_EIV1.Location = new System.Drawing.Point(44, 60); + this.NUD_EIV1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EIV1.Maximum = new decimal(new int[] { 31, 0, @@ -916,7 +1023,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_EIV1.Name = "NUD_EIV1"; - this.NUD_EIV1.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV1.Size = new System.Drawing.Size(45, 22); this.NUD_EIV1.TabIndex = 490; this.NUD_EIV1.Value = new decimal(new int[] { 31, @@ -926,7 +1033,8 @@ private void InitializeComponent() // // NUD_EIV0 // - this.NUD_EIV0.Location = new System.Drawing.Point(33, 18); + this.NUD_EIV0.Location = new System.Drawing.Point(44, 22); + this.NUD_EIV0.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EIV0.Maximum = new decimal(new int[] { 31, 0, @@ -938,7 +1046,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_EIV0.Name = "NUD_EIV0"; - this.NUD_EIV0.Size = new System.Drawing.Size(34, 20); + this.NUD_EIV0.Size = new System.Drawing.Size(45, 22); this.NUD_EIV0.TabIndex = 489; this.NUD_EIV0.Value = new decimal(new int[] { 31, @@ -948,45 +1056,52 @@ private void InitializeComponent() // // L_ATK // - this.L_ATK.Location = new System.Drawing.Point(7, 47); + this.L_ATK.Location = new System.Drawing.Point(9, 58); + this.L_ATK.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_ATK.Name = "L_ATK"; - this.L_ATK.Size = new System.Drawing.Size(26, 21); + this.L_ATK.Size = new System.Drawing.Size(35, 26); this.L_ATK.TabIndex = 496; this.L_ATK.Text = "Atk:"; this.L_ATK.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_DEF // - this.L_DEF.Location = new System.Drawing.Point(4, 78); + this.L_DEF.Location = new System.Drawing.Point(5, 96); + this.L_DEF.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_DEF.Name = "L_DEF"; - this.L_DEF.Size = new System.Drawing.Size(29, 21); + this.L_DEF.Size = new System.Drawing.Size(39, 26); this.L_DEF.TabIndex = 497; this.L_DEF.Text = "Def:"; this.L_DEF.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_Aura // - this.L_Aura.Location = new System.Drawing.Point(131, 157); + this.L_Aura.Location = new System.Drawing.Point(175, 193); + this.L_Aura.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_Aura.Name = "L_Aura"; - this.L_Aura.Size = new System.Drawing.Size(55, 23); + this.L_Aura.Size = new System.Drawing.Size(73, 28); this.L_Aura.TabIndex = 22; this.L_Aura.Text = "Aura:"; this.L_Aura.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // CB_Aura // + this.CB_Aura.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_Aura.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Aura.FormattingEnabled = true; - this.CB_Aura.Location = new System.Drawing.Point(187, 159); + this.CB_Aura.Location = new System.Drawing.Point(249, 196); + this.CB_Aura.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_Aura.Name = "CB_Aura"; - this.CB_Aura.Size = new System.Drawing.Size(136, 21); + this.CB_Aura.Size = new System.Drawing.Size(180, 24); this.CB_Aura.TabIndex = 21; // // CHK_ShinyLock // this.CHK_ShinyLock.AutoSize = true; - this.CHK_ShinyLock.Location = new System.Drawing.Point(187, 225); + this.CHK_ShinyLock.Location = new System.Drawing.Point(249, 277); + this.CHK_ShinyLock.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_ShinyLock.Name = "CHK_ShinyLock"; - this.CHK_ShinyLock.Size = new System.Drawing.Size(79, 17); + this.CHK_ShinyLock.Size = new System.Drawing.Size(92, 20); this.CHK_ShinyLock.TabIndex = 18; this.CHK_ShinyLock.Text = "Shiny Lock"; this.CHK_ShinyLock.UseVisualStyleBackColor = true; @@ -997,90 +1112,113 @@ private void InitializeComponent() this.GB_EMoves.Controls.Add(this.CB_EMove2); this.GB_EMoves.Controls.Add(this.CB_EMove1); this.GB_EMoves.Controls.Add(this.CB_EMove0); - this.GB_EMoves.Location = new System.Drawing.Point(129, 253); + this.GB_EMoves.Location = new System.Drawing.Point(172, 311); + this.GB_EMoves.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.GB_EMoves.Name = "GB_EMoves"; - this.GB_EMoves.Size = new System.Drawing.Size(133, 112); + this.GB_EMoves.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.GB_EMoves.Size = new System.Drawing.Size(177, 138); this.GB_EMoves.TabIndex = 17; this.GB_EMoves.TabStop = false; this.GB_EMoves.Text = "Moves"; // // CB_EMove3 // + this.CB_EMove3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_EMove3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_EMove3.FormattingEnabled = true; - this.CB_EMove3.Location = new System.Drawing.Point(6, 85); + this.CB_EMove3.Location = new System.Drawing.Point(8, 105); + this.CB_EMove3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_EMove3.Name = "CB_EMove3"; - this.CB_EMove3.Size = new System.Drawing.Size(121, 21); + this.CB_EMove3.Size = new System.Drawing.Size(160, 24); this.CB_EMove3.TabIndex = 20; // // CB_EMove2 // + this.CB_EMove2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_EMove2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_EMove2.FormattingEnabled = true; - this.CB_EMove2.Location = new System.Drawing.Point(6, 63); + this.CB_EMove2.Location = new System.Drawing.Point(8, 78); + this.CB_EMove2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_EMove2.Name = "CB_EMove2"; - this.CB_EMove2.Size = new System.Drawing.Size(121, 21); + this.CB_EMove2.Size = new System.Drawing.Size(160, 24); this.CB_EMove2.TabIndex = 19; // // CB_EMove1 // + this.CB_EMove1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_EMove1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_EMove1.FormattingEnabled = true; - this.CB_EMove1.Location = new System.Drawing.Point(6, 41); + this.CB_EMove1.Location = new System.Drawing.Point(8, 50); + this.CB_EMove1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_EMove1.Name = "CB_EMove1"; - this.CB_EMove1.Size = new System.Drawing.Size(121, 21); + this.CB_EMove1.Size = new System.Drawing.Size(160, 24); this.CB_EMove1.TabIndex = 18; // // CB_EMove0 // + this.CB_EMove0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_EMove0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_EMove0.FormattingEnabled = true; - this.CB_EMove0.Location = new System.Drawing.Point(6, 19); + this.CB_EMove0.Location = new System.Drawing.Point(8, 23); + this.CB_EMove0.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_EMove0.Name = "CB_EMove0"; - this.CB_EMove0.Size = new System.Drawing.Size(121, 21); + this.CB_EMove0.Size = new System.Drawing.Size(160, 24); this.CB_EMove0.TabIndex = 17; // // CB_EHeldItem // + this.CB_EHeldItem.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_EHeldItem.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_EHeldItem.FormattingEnabled = true; - this.CB_EHeldItem.Location = new System.Drawing.Point(187, 115); + this.CB_EHeldItem.Location = new System.Drawing.Point(249, 142); + this.CB_EHeldItem.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_EHeldItem.Name = "CB_EHeldItem"; - this.CB_EHeldItem.Size = new System.Drawing.Size(136, 21); + this.CB_EHeldItem.Size = new System.Drawing.Size(180, 24); this.CB_EHeldItem.TabIndex = 16; // // L_EHeldItem // - this.L_EHeldItem.Location = new System.Drawing.Point(131, 113); + this.L_EHeldItem.Location = new System.Drawing.Point(175, 139); + this.L_EHeldItem.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_EHeldItem.Name = "L_EHeldItem"; - this.L_EHeldItem.Size = new System.Drawing.Size(55, 23); + this.L_EHeldItem.Size = new System.Drawing.Size(73, 28); this.L_EHeldItem.TabIndex = 15; this.L_EHeldItem.Text = "Held Item:"; this.L_EHeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // CB_ESpecies // + this.CB_ESpecies.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_ESpecies.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_ESpecies.FormattingEnabled = true; - this.CB_ESpecies.Location = new System.Drawing.Point(187, 7); + this.CB_ESpecies.Location = new System.Drawing.Point(249, 9); + this.CB_ESpecies.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_ESpecies.Name = "CB_ESpecies"; - this.CB_ESpecies.Size = new System.Drawing.Size(136, 21); + this.CB_ESpecies.Size = new System.Drawing.Size(180, 24); this.CB_ESpecies.TabIndex = 14; this.CB_ESpecies.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // L_EForm // - this.L_EForm.Location = new System.Drawing.Point(131, 47); + this.L_EForm.Location = new System.Drawing.Point(175, 58); + this.L_EForm.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_EForm.Name = "L_EForm"; - this.L_EForm.Size = new System.Drawing.Size(55, 23); + this.L_EForm.Size = new System.Drawing.Size(73, 28); this.L_EForm.TabIndex = 13; this.L_EForm.Text = "Form:"; this.L_EForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_EForm // - this.NUD_EForm.Location = new System.Drawing.Point(187, 50); + this.NUD_EForm.Location = new System.Drawing.Point(249, 62); + this.NUD_EForm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_EForm.Maximum = new decimal(new int[] { 255, 0, 0, 0}); this.NUD_EForm.Name = "NUD_EForm"; - this.NUD_EForm.Size = new System.Drawing.Size(48, 20); + this.NUD_EForm.Size = new System.Drawing.Size(64, 22); this.NUD_EForm.TabIndex = 12; this.NUD_EForm.Value = new decimal(new int[] { 100, @@ -1090,27 +1228,30 @@ private void InitializeComponent() // // L_ELevel // - this.L_ELevel.Location = new System.Drawing.Point(131, 26); + this.L_ELevel.Location = new System.Drawing.Point(175, 32); + this.L_ELevel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_ELevel.Name = "L_ELevel"; - this.L_ELevel.Size = new System.Drawing.Size(55, 23); + this.L_ELevel.Size = new System.Drawing.Size(73, 28); this.L_ELevel.TabIndex = 11; this.L_ELevel.Text = "Level:"; this.L_ELevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_ESpecies // - this.L_ESpecies.Location = new System.Drawing.Point(131, 5); + this.L_ESpecies.Location = new System.Drawing.Point(175, 6); + this.L_ESpecies.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_ESpecies.Name = "L_ESpecies"; - this.L_ESpecies.Size = new System.Drawing.Size(55, 23); + this.L_ESpecies.Size = new System.Drawing.Size(73, 28); this.L_ESpecies.TabIndex = 10; this.L_ESpecies.Text = "Species:"; this.L_ESpecies.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_ELevel // - this.NUD_ELevel.Location = new System.Drawing.Point(187, 29); + this.NUD_ELevel.Location = new System.Drawing.Point(249, 36); + this.NUD_ELevel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_ELevel.Name = "NUD_ELevel"; - this.NUD_ELevel.Size = new System.Drawing.Size(48, 20); + this.NUD_ELevel.Size = new System.Drawing.Size(64, 22); this.NUD_ELevel.TabIndex = 9; this.NUD_ELevel.Value = new decimal(new int[] { 100, @@ -1123,26 +1264,30 @@ private void InitializeComponent() this.LB_Encounter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.LB_Encounter.FormattingEnabled = true; - this.LB_Encounter.Location = new System.Drawing.Point(3, 3); + this.LB_Encounter.ItemHeight = 16; + this.LB_Encounter.Location = new System.Drawing.Point(4, 4); + this.LB_Encounter.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.LB_Encounter.Name = "LB_Encounter"; - this.LB_Encounter.Size = new System.Drawing.Size(115, 498); + this.LB_Encounter.Size = new System.Drawing.Size(152, 612); this.LB_Encounter.TabIndex = 1; this.LB_Encounter.SelectedIndexChanged += new System.EventHandler(this.LB_Encounter_SelectedIndexChanged); // // L_Ally2 // - this.L_Ally2.Location = new System.Drawing.Point(237, 199); + this.L_Ally2.Location = new System.Drawing.Point(316, 245); + this.L_Ally2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_Ally2.Name = "L_Ally2"; - this.L_Ally2.Size = new System.Drawing.Size(135, 23); + this.L_Ally2.Size = new System.Drawing.Size(180, 28); this.L_Ally2.TabIndex = 525; this.L_Ally2.Text = "WWWWWWWWWWWW"; this.L_Ally2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // L_Ally1 // - this.L_Ally1.Location = new System.Drawing.Point(237, 179); + this.L_Ally1.Location = new System.Drawing.Point(316, 220); + this.L_Ally1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_Ally1.Name = "L_Ally1"; - this.L_Ally1.Size = new System.Drawing.Size(135, 23); + this.L_Ally1.Size = new System.Drawing.Size(180, 28); this.L_Ally1.TabIndex = 524; this.L_Ally1.Text = "WWWWWWWWWWWW"; this.L_Ally1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -1170,10 +1315,11 @@ private void InitializeComponent() this.Tab_Trades.Controls.Add(this.L_TSpecies); this.Tab_Trades.Controls.Add(this.NUD_TLevel); this.Tab_Trades.Controls.Add(this.LB_Trade); - this.Tab_Trades.Location = new System.Drawing.Point(4, 22); + this.Tab_Trades.Location = new System.Drawing.Point(4, 25); + this.Tab_Trades.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Tab_Trades.Name = "Tab_Trades"; - this.Tab_Trades.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Trades.Size = new System.Drawing.Size(498, 512); + this.Tab_Trades.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Tab_Trades.Size = new System.Drawing.Size(667, 633); this.Tab_Trades.TabIndex = 1; this.Tab_Trades.Text = "Trades"; this.Tab_Trades.UseVisualStyleBackColor = true; @@ -1181,16 +1327,18 @@ private void InitializeComponent() // CB_TGender // this.CB_TGender.FormattingEnabled = true; - this.CB_TGender.Location = new System.Drawing.Point(187, 71); + this.CB_TGender.Location = new System.Drawing.Point(249, 87); + this.CB_TGender.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_TGender.Name = "CB_TGender"; - this.CB_TGender.Size = new System.Drawing.Size(136, 21); + this.CB_TGender.Size = new System.Drawing.Size(180, 24); this.CB_TGender.TabIndex = 527; // // L_TGender // - this.L_TGender.Location = new System.Drawing.Point(131, 69); + this.L_TGender.Location = new System.Drawing.Point(175, 85); + this.L_TGender.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TGender.Name = "L_TGender"; - this.L_TGender.Size = new System.Drawing.Size(55, 23); + this.L_TGender.Size = new System.Drawing.Size(73, 28); this.L_TGender.TabIndex = 523; this.L_TGender.Text = "Gender:"; this.L_TGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -1198,33 +1346,39 @@ private void InitializeComponent() // CB_TAbility // this.CB_TAbility.FormattingEnabled = true; - this.CB_TAbility.Location = new System.Drawing.Point(187, 93); + this.CB_TAbility.Location = new System.Drawing.Point(249, 114); + this.CB_TAbility.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_TAbility.Name = "CB_TAbility"; - this.CB_TAbility.Size = new System.Drawing.Size(136, 21); + this.CB_TAbility.Size = new System.Drawing.Size(180, 24); this.CB_TAbility.TabIndex = 521; // // L_TAbility // - this.L_TAbility.Location = new System.Drawing.Point(131, 91); + this.L_TAbility.Location = new System.Drawing.Point(175, 112); + this.L_TAbility.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TAbility.Name = "L_TAbility"; - this.L_TAbility.Size = new System.Drawing.Size(55, 23); + this.L_TAbility.Size = new System.Drawing.Size(73, 28); this.L_TAbility.TabIndex = 520; this.L_TAbility.Text = "Ability:"; this.L_TAbility.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // CB_TNature // + this.CB_TNature.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_TNature.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_TNature.FormattingEnabled = true; - this.CB_TNature.Location = new System.Drawing.Point(187, 137); + this.CB_TNature.Location = new System.Drawing.Point(249, 169); + this.CB_TNature.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_TNature.Name = "CB_TNature"; - this.CB_TNature.Size = new System.Drawing.Size(136, 21); + this.CB_TNature.Size = new System.Drawing.Size(180, 24); this.CB_TNature.TabIndex = 505; // // L_TNature // - this.L_TNature.Location = new System.Drawing.Point(131, 135); + this.L_TNature.Location = new System.Drawing.Point(175, 166); + this.L_TNature.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TNature.Name = "L_TNature"; - this.L_TNature.Size = new System.Drawing.Size(55, 23); + this.L_TNature.Size = new System.Drawing.Size(73, 28); this.L_TNature.TabIndex = 504; this.L_TNature.Text = "Nature:"; this.L_TNature.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -1243,25 +1397,29 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.NUD_TIV0); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); - this.groupBox1.Location = new System.Drawing.Point(129, 222); + this.groupBox1.Location = new System.Drawing.Point(172, 273); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(148, 112); + this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox1.Size = new System.Drawing.Size(197, 138); this.groupBox1.TabIndex = 30; this.groupBox1.TabStop = false; this.groupBox1.Text = "IVs"; // // label8 // - this.label8.Location = new System.Drawing.Point(4, 16); + this.label8.Location = new System.Drawing.Point(5, 20); + this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(29, 21); + this.label8.Size = new System.Drawing.Size(39, 26); this.label8.TabIndex = 495; this.label8.Text = "HP:"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TIV3 // - this.NUD_TIV3.Location = new System.Drawing.Point(104, 18); + this.NUD_TIV3.Location = new System.Drawing.Point(139, 22); + this.NUD_TIV3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TIV3.Maximum = new decimal(new int[] { 31, 0, @@ -1273,7 +1431,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_TIV3.Name = "NUD_TIV3"; - this.NUD_TIV3.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV3.Size = new System.Drawing.Size(45, 22); this.NUD_TIV3.TabIndex = 492; this.NUD_TIV3.Value = new decimal(new int[] { 31, @@ -1283,7 +1441,8 @@ private void InitializeComponent() // // NUD_TIV4 // - this.NUD_TIV4.Location = new System.Drawing.Point(104, 49); + this.NUD_TIV4.Location = new System.Drawing.Point(139, 60); + this.NUD_TIV4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TIV4.Maximum = new decimal(new int[] { 31, 0, @@ -1295,7 +1454,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_TIV4.Name = "NUD_TIV4"; - this.NUD_TIV4.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV4.Size = new System.Drawing.Size(45, 22); this.NUD_TIV4.TabIndex = 493; this.NUD_TIV4.Value = new decimal(new int[] { 31, @@ -1305,7 +1464,8 @@ private void InitializeComponent() // // NUD_TIV5 // - this.NUD_TIV5.Location = new System.Drawing.Point(104, 80); + this.NUD_TIV5.Location = new System.Drawing.Point(139, 98); + this.NUD_TIV5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TIV5.Maximum = new decimal(new int[] { 31, 0, @@ -1317,7 +1477,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_TIV5.Name = "NUD_TIV5"; - this.NUD_TIV5.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV5.Size = new System.Drawing.Size(45, 22); this.NUD_TIV5.TabIndex = 494; this.NUD_TIV5.Value = new decimal(new int[] { 31, @@ -1327,34 +1487,38 @@ private void InitializeComponent() // // label9 // - this.label9.Location = new System.Drawing.Point(73, 47); + this.label9.Location = new System.Drawing.Point(97, 58); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(31, 21); + this.label9.Size = new System.Drawing.Size(41, 26); this.label9.TabIndex = 500; this.label9.Text = "SpD:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // label10 // - this.label10.Location = new System.Drawing.Point(73, 78); + this.label10.Location = new System.Drawing.Point(97, 96); + this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(31, 21); + this.label10.Size = new System.Drawing.Size(41, 26); this.label10.TabIndex = 499; this.label10.Text = "Spe:"; this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // label11 // - this.label11.Location = new System.Drawing.Point(73, 16); + this.label11.Location = new System.Drawing.Point(97, 20); + this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(31, 21); + this.label11.Size = new System.Drawing.Size(41, 26); this.label11.TabIndex = 498; this.label11.Text = "SpA:"; this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TIV2 // - this.NUD_TIV2.Location = new System.Drawing.Point(33, 80); + this.NUD_TIV2.Location = new System.Drawing.Point(44, 98); + this.NUD_TIV2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TIV2.Maximum = new decimal(new int[] { 31, 0, @@ -1366,7 +1530,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_TIV2.Name = "NUD_TIV2"; - this.NUD_TIV2.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV2.Size = new System.Drawing.Size(45, 22); this.NUD_TIV2.TabIndex = 491; this.NUD_TIV2.Value = new decimal(new int[] { 31, @@ -1376,7 +1540,8 @@ private void InitializeComponent() // // NUD_TIV1 // - this.NUD_TIV1.Location = new System.Drawing.Point(33, 49); + this.NUD_TIV1.Location = new System.Drawing.Point(44, 60); + this.NUD_TIV1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TIV1.Maximum = new decimal(new int[] { 31, 0, @@ -1388,7 +1553,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_TIV1.Name = "NUD_TIV1"; - this.NUD_TIV1.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV1.Size = new System.Drawing.Size(45, 22); this.NUD_TIV1.TabIndex = 490; this.NUD_TIV1.Value = new decimal(new int[] { 31, @@ -1398,7 +1563,8 @@ private void InitializeComponent() // // NUD_TIV0 // - this.NUD_TIV0.Location = new System.Drawing.Point(33, 18); + this.NUD_TIV0.Location = new System.Drawing.Point(44, 22); + this.NUD_TIV0.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TIV0.Maximum = new decimal(new int[] { 31, 0, @@ -1410,7 +1576,7 @@ private void InitializeComponent() 0, -2147483648}); this.NUD_TIV0.Name = "NUD_TIV0"; - this.NUD_TIV0.Size = new System.Drawing.Size(34, 20); + this.NUD_TIV0.Size = new System.Drawing.Size(45, 22); this.NUD_TIV0.TabIndex = 489; this.NUD_TIV0.Value = new decimal(new int[] { 31, @@ -1420,35 +1586,41 @@ private void InitializeComponent() // // label12 // - this.label12.Location = new System.Drawing.Point(7, 47); + this.label12.Location = new System.Drawing.Point(9, 58); + this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(26, 21); + this.label12.Size = new System.Drawing.Size(35, 26); this.label12.TabIndex = 496; this.label12.Text = "Atk:"; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // label13 // - this.label13.Location = new System.Drawing.Point(4, 78); + this.label13.Location = new System.Drawing.Point(5, 96); + this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(29, 21); + this.label13.Size = new System.Drawing.Size(39, 26); this.label13.TabIndex = 497; this.label13.Text = "Def:"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // CB_TRequest // + this.CB_TRequest.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_TRequest.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_TRequest.FormattingEnabled = true; - this.CB_TRequest.Location = new System.Drawing.Point(230, 188); + this.CB_TRequest.Location = new System.Drawing.Point(307, 231); + this.CB_TRequest.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_TRequest.Name = "CB_TRequest"; - this.CB_TRequest.Size = new System.Drawing.Size(121, 21); + this.CB_TRequest.Size = new System.Drawing.Size(160, 24); this.CB_TRequest.TabIndex = 29; // // label1 // - this.label1.Location = new System.Drawing.Point(121, 186); + this.label1.Location = new System.Drawing.Point(161, 229); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(106, 23); + this.label1.Size = new System.Drawing.Size(141, 28); this.label1.TabIndex = 28; this.label1.Text = "Requested Species:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -1456,32 +1628,35 @@ private void InitializeComponent() // L_TTID // this.L_TTID.AutoSize = true; - this.L_TTID.Location = new System.Drawing.Point(252, 162); + this.L_TTID.Location = new System.Drawing.Point(336, 199); + this.L_TTID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TTID.Name = "L_TTID"; - this.L_TTID.Size = new System.Drawing.Size(53, 13); + this.L_TTID.Size = new System.Drawing.Size(62, 16); this.L_TTID.TabIndex = 27; this.L_TTID.Text = "Gen 7 ID:"; this.L_TTID.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // L_TID // - this.L_TID.Location = new System.Drawing.Point(136, 157); + this.L_TID.Location = new System.Drawing.Point(181, 193); + this.L_TID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TID.Name = "L_TID"; - this.L_TID.Size = new System.Drawing.Size(50, 23); + this.L_TID.Size = new System.Drawing.Size(67, 28); this.L_TID.TabIndex = 26; this.L_TID.Text = "ID:"; this.L_TID.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TID // - this.NUD_TID.Location = new System.Drawing.Point(187, 159); + this.NUD_TID.Location = new System.Drawing.Point(249, 196); + this.NUD_TID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TID.Maximum = new decimal(new int[] { 999999, 0, 0, 0}); this.NUD_TID.Name = "NUD_TID"; - this.NUD_TID.Size = new System.Drawing.Size(60, 20); + this.NUD_TID.Size = new System.Drawing.Size(80, 22); this.NUD_TID.TabIndex = 25; this.NUD_TID.Value = new decimal(new int[] { 999999, @@ -1492,49 +1667,58 @@ private void InitializeComponent() // // CB_THeldItem // + this.CB_THeldItem.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_THeldItem.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_THeldItem.FormattingEnabled = true; - this.CB_THeldItem.Location = new System.Drawing.Point(187, 115); + this.CB_THeldItem.Location = new System.Drawing.Point(249, 142); + this.CB_THeldItem.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_THeldItem.Name = "CB_THeldItem"; - this.CB_THeldItem.Size = new System.Drawing.Size(136, 21); + this.CB_THeldItem.Size = new System.Drawing.Size(180, 24); this.CB_THeldItem.TabIndex = 24; // // L_THeldItem // - this.L_THeldItem.Location = new System.Drawing.Point(131, 113); + this.L_THeldItem.Location = new System.Drawing.Point(175, 139); + this.L_THeldItem.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_THeldItem.Name = "L_THeldItem"; - this.L_THeldItem.Size = new System.Drawing.Size(55, 23); + this.L_THeldItem.Size = new System.Drawing.Size(73, 28); this.L_THeldItem.TabIndex = 23; this.L_THeldItem.Text = "Held Item:"; this.L_THeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // CB_TSpecies // + this.CB_TSpecies.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_TSpecies.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_TSpecies.FormattingEnabled = true; - this.CB_TSpecies.Location = new System.Drawing.Point(187, 7); + this.CB_TSpecies.Location = new System.Drawing.Point(249, 9); + this.CB_TSpecies.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CB_TSpecies.Name = "CB_TSpecies"; - this.CB_TSpecies.Size = new System.Drawing.Size(136, 21); + this.CB_TSpecies.Size = new System.Drawing.Size(180, 24); this.CB_TSpecies.TabIndex = 22; this.CB_TSpecies.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // L_TForm // - this.L_TForm.Location = new System.Drawing.Point(131, 47); + this.L_TForm.Location = new System.Drawing.Point(175, 58); + this.L_TForm.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TForm.Name = "L_TForm"; - this.L_TForm.Size = new System.Drawing.Size(55, 23); + this.L_TForm.Size = new System.Drawing.Size(73, 28); this.L_TForm.TabIndex = 21; this.L_TForm.Text = "Form:"; this.L_TForm.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TForm // - this.NUD_TForm.Location = new System.Drawing.Point(187, 50); + this.NUD_TForm.Location = new System.Drawing.Point(249, 62); + this.NUD_TForm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TForm.Maximum = new decimal(new int[] { 255, 0, 0, 0}); this.NUD_TForm.Name = "NUD_TForm"; - this.NUD_TForm.Size = new System.Drawing.Size(48, 20); + this.NUD_TForm.Size = new System.Drawing.Size(64, 22); this.NUD_TForm.TabIndex = 20; this.NUD_TForm.Value = new decimal(new int[] { 100, @@ -1544,27 +1728,30 @@ private void InitializeComponent() // // L_TLevel // - this.L_TLevel.Location = new System.Drawing.Point(131, 26); + this.L_TLevel.Location = new System.Drawing.Point(175, 32); + this.L_TLevel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TLevel.Name = "L_TLevel"; - this.L_TLevel.Size = new System.Drawing.Size(55, 23); + this.L_TLevel.Size = new System.Drawing.Size(73, 28); this.L_TLevel.TabIndex = 19; this.L_TLevel.Text = "Level:"; this.L_TLevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_TSpecies // - this.L_TSpecies.Location = new System.Drawing.Point(131, 5); + this.L_TSpecies.Location = new System.Drawing.Point(175, 6); + this.L_TSpecies.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_TSpecies.Name = "L_TSpecies"; - this.L_TSpecies.Size = new System.Drawing.Size(55, 23); + this.L_TSpecies.Size = new System.Drawing.Size(73, 28); this.L_TSpecies.TabIndex = 18; this.L_TSpecies.Text = "Species:"; this.L_TSpecies.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TLevel // - this.NUD_TLevel.Location = new System.Drawing.Point(187, 29); + this.NUD_TLevel.Location = new System.Drawing.Point(249, 36); + this.NUD_TLevel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_TLevel.Name = "NUD_TLevel"; - this.NUD_TLevel.Size = new System.Drawing.Size(48, 20); + this.NUD_TLevel.Size = new System.Drawing.Size(64, 22); this.NUD_TLevel.TabIndex = 17; this.NUD_TLevel.Value = new decimal(new int[] { 100, @@ -1577,9 +1764,11 @@ private void InitializeComponent() this.LB_Trade.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.LB_Trade.FormattingEnabled = true; - this.LB_Trade.Location = new System.Drawing.Point(3, 3); + this.LB_Trade.ItemHeight = 16; + this.LB_Trade.Location = new System.Drawing.Point(4, 4); + this.LB_Trade.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.LB_Trade.Name = "LB_Trade"; - this.LB_Trade.Size = new System.Drawing.Size(115, 498); + this.LB_Trade.Size = new System.Drawing.Size(152, 612); this.LB_Trade.TabIndex = 2; this.LB_Trade.SelectedIndexChanged += new System.EventHandler(this.LB_Trade_SelectedIndexChanged); // @@ -1592,10 +1781,11 @@ private void InitializeComponent() this.Tab_Randomizer.Controls.Add(this.B_RandAll); this.Tab_Randomizer.Controls.Add(this.GB_Rand); this.Tab_Randomizer.Controls.Add(this.B_Starters); - this.Tab_Randomizer.Location = new System.Drawing.Point(4, 22); + this.Tab_Randomizer.Location = new System.Drawing.Point(4, 25); + this.Tab_Randomizer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Tab_Randomizer.Name = "Tab_Randomizer"; - this.Tab_Randomizer.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Randomizer.Size = new System.Drawing.Size(498, 512); + this.Tab_Randomizer.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Tab_Randomizer.Size = new System.Drawing.Size(667, 633); this.Tab_Randomizer.TabIndex = 3; this.Tab_Randomizer.Text = "Randomizer Options"; this.Tab_Randomizer.UseVisualStyleBackColor = true; @@ -1609,9 +1799,11 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_ForceFullyEvolved); this.GB_Tweak.Controls.Add(this.CHK_BasicStarter); this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend); - this.GB_Tweak.Location = new System.Drawing.Point(119, 245); + this.GB_Tweak.Location = new System.Drawing.Point(159, 302); + this.GB_Tweak.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(258, 115); + this.GB_Tweak.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.GB_Tweak.Size = new System.Drawing.Size(344, 142); this.GB_Tweak.TabIndex = 509; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Extra Tweaks"; @@ -1619,9 +1811,10 @@ private void InitializeComponent() // CHK_Metronome // this.CHK_Metronome.AutoSize = true; - this.CHK_Metronome.Location = new System.Drawing.Point(6, 95); + this.CHK_Metronome.Location = new System.Drawing.Point(8, 117); + this.CHK_Metronome.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_Metronome.Name = "CHK_Metronome"; - this.CHK_Metronome.Size = new System.Drawing.Size(109, 17); + this.CHK_Metronome.Size = new System.Drawing.Size(133, 20); this.CHK_Metronome.TabIndex = 515; this.CHK_Metronome.Text = "Metronome Mode"; this.CHK_Metronome.UseVisualStyleBackColor = true; @@ -1631,23 +1824,25 @@ private void InitializeComponent() this.CHK_RemoveShinyLock.AutoSize = true; this.CHK_RemoveShinyLock.Checked = true; this.CHK_RemoveShinyLock.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(6, 79); + this.CHK_RemoveShinyLock.Location = new System.Drawing.Point(8, 97); + this.CHK_RemoveShinyLock.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_RemoveShinyLock.Name = "CHK_RemoveShinyLock"; - this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(127, 17); + this.CHK_RemoveShinyLock.Size = new System.Drawing.Size(154, 20); this.CHK_RemoveShinyLock.TabIndex = 299; this.CHK_RemoveShinyLock.Text = "Remove Shiny Locks"; this.CHK_RemoveShinyLock.UseVisualStyleBackColor = true; // // NUD_ForceFullyEvolved // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 62); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(220, 76); + this.NUD_ForceFullyEvolved.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { 1, 0, 0, 0}); this.NUD_ForceFullyEvolved.Name = "NUD_ForceFullyEvolved"; - this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(40, 20); + this.NUD_ForceFullyEvolved.Size = new System.Drawing.Size(53, 22); this.NUD_ForceFullyEvolved.TabIndex = 514; this.NUD_ForceFullyEvolved.Value = new decimal(new int[] { 50, @@ -1658,9 +1853,10 @@ private void InitializeComponent() // CHK_ForceTotem // this.CHK_ForceTotem.AutoSize = true; - this.CHK_ForceTotem.Location = new System.Drawing.Point(6, 47); + this.CHK_ForceTotem.Location = new System.Drawing.Point(8, 58); + this.CHK_ForceTotem.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_ForceTotem.Name = "CHK_ForceTotem"; - this.CHK_ForceTotem.Size = new System.Drawing.Size(200, 17); + this.CHK_ForceTotem.Size = new System.Drawing.Size(249, 20); this.CHK_ForceTotem.TabIndex = 305; this.CHK_ForceTotem.Text = "Force Fully Evolved Totem Pokémon"; this.CHK_ForceTotem.UseVisualStyleBackColor = true; @@ -1669,9 +1865,10 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 63); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(8, 80); + this.CHK_ForceFullyEvolved.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; - this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); + this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(196, 20); this.CHK_ForceFullyEvolved.TabIndex = 513; this.CHK_ForceFullyEvolved.Text = "Force Fully Evolved at Level"; this.CHK_ForceFullyEvolved.UseVisualStyleBackColor = true; @@ -1681,9 +1878,10 @@ private void InitializeComponent() this.CHK_BasicStarter.AutoSize = true; this.CHK_BasicStarter.Checked = true; this.CHK_BasicStarter.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_BasicStarter.Location = new System.Drawing.Point(6, 31); + this.CHK_BasicStarter.Location = new System.Drawing.Point(8, 38); + this.CHK_BasicStarter.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_BasicStarter.Name = "CHK_BasicStarter"; - this.CHK_BasicStarter.Size = new System.Drawing.Size(217, 17); + this.CHK_BasicStarter.Size = new System.Drawing.Size(264, 20); this.CHK_BasicStarter.TabIndex = 304; this.CHK_BasicStarter.Text = "Basic Starter Pokémon with 2 Evolutions"; this.CHK_BasicStarter.UseVisualStyleBackColor = true; @@ -1693,18 +1891,20 @@ private void InitializeComponent() this.CHK_ReplaceLegend.AutoSize = true; this.CHK_ReplaceLegend.Checked = true; this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 15); + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(8, 18); + this.CHK_ReplaceLegend.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; - this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17); + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(300, 20); this.CHK_ReplaceLegend.TabIndex = 303; this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary"; this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; // // B_ModifyLevel // - this.B_ModifyLevel.Location = new System.Drawing.Point(306, 49); + this.B_ModifyLevel.Location = new System.Drawing.Point(408, 60); + this.B_ModifyLevel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.B_ModifyLevel.Name = "B_ModifyLevel"; - this.B_ModifyLevel.Size = new System.Drawing.Size(70, 23); + this.B_ModifyLevel.Size = new System.Drawing.Size(93, 28); this.B_ModifyLevel.TabIndex = 512; this.B_ModifyLevel.Text = "× Current"; this.B_ModifyLevel.UseVisualStyleBackColor = true; @@ -1718,14 +1918,15 @@ private void InitializeComponent() 0, 0, 131072}); - this.NUD_LevelBoost.Location = new System.Drawing.Point(257, 50); + this.NUD_LevelBoost.Location = new System.Drawing.Point(343, 62); + this.NUD_LevelBoost.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NUD_LevelBoost.Maximum = new decimal(new int[] { 3, 0, 0, 0}); this.NUD_LevelBoost.Name = "NUD_LevelBoost"; - this.NUD_LevelBoost.Size = new System.Drawing.Size(43, 20); + this.NUD_LevelBoost.Size = new System.Drawing.Size(57, 22); this.NUD_LevelBoost.TabIndex = 511; this.NUD_LevelBoost.Value = new decimal(new int[] { 1, @@ -1738,18 +1939,20 @@ private void InitializeComponent() this.CHK_Level.AutoSize = true; this.CHK_Level.Checked = true; this.CHK_Level.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Level.Location = new System.Drawing.Point(125, 51); + this.CHK_Level.Location = new System.Drawing.Point(167, 63); + this.CHK_Level.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_Level.Name = "CHK_Level"; - this.CHK_Level.Size = new System.Drawing.Size(130, 17); + this.CHK_Level.Size = new System.Drawing.Size(157, 20); this.CHK_Level.TabIndex = 510; this.CHK_Level.Text = "Multiply PKM Level by"; this.CHK_Level.UseVisualStyleBackColor = true; // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(192, 369); + this.B_RandAll.Location = new System.Drawing.Point(256, 454); + this.B_RandAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.B_RandAll.Name = "B_RandAll"; - this.B_RandAll.Size = new System.Drawing.Size(122, 23); + this.B_RandAll.Size = new System.Drawing.Size(163, 28); this.B_RandAll.TabIndex = 509; this.B_RandAll.Text = "Randomize All"; this.B_RandAll.UseVisualStyleBackColor = true; @@ -1772,9 +1975,11 @@ private void InitializeComponent() this.GB_Rand.Controls.Add(this.CHK_G3); this.GB_Rand.Controls.Add(this.CHK_G2); this.GB_Rand.Controls.Add(this.CHK_G1); - this.GB_Rand.Location = new System.Drawing.Point(119, 73); + this.GB_Rand.Location = new System.Drawing.Point(159, 90); + this.GB_Rand.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.GB_Rand.Name = "GB_Rand"; - this.GB_Rand.Size = new System.Drawing.Size(258, 155); + this.GB_Rand.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.GB_Rand.Size = new System.Drawing.Size(344, 191); this.GB_Rand.TabIndex = 508; this.GB_Rand.TabStop = false; this.GB_Rand.Text = "Randomizer Options"; @@ -1782,9 +1987,10 @@ private void InitializeComponent() // CHK_SpecialMove // this.CHK_SpecialMove.AutoSize = true; - this.CHK_SpecialMove.Location = new System.Drawing.Point(9, 135); + this.CHK_SpecialMove.Location = new System.Drawing.Point(12, 166); + this.CHK_SpecialMove.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_SpecialMove.Name = "CHK_SpecialMove"; - this.CHK_SpecialMove.Size = new System.Drawing.Size(197, 17); + this.CHK_SpecialMove.Size = new System.Drawing.Size(239, 20); this.CHK_SpecialMove.TabIndex = 301; this.CHK_SpecialMove.Text = "Random Gift Move for Gift Pokémon"; this.CHK_SpecialMove.UseVisualStyleBackColor = true; @@ -1792,9 +1998,10 @@ private void InitializeComponent() // CHK_RandomAbility // this.CHK_RandomAbility.AutoSize = true; - this.CHK_RandomAbility.Location = new System.Drawing.Point(9, 120); + this.CHK_RandomAbility.Location = new System.Drawing.Point(12, 148); + this.CHK_RandomAbility.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_RandomAbility.Name = "CHK_RandomAbility"; - this.CHK_RandomAbility.Size = new System.Drawing.Size(183, 17); + this.CHK_RandomAbility.Size = new System.Drawing.Size(225, 20); this.CHK_RandomAbility.TabIndex = 302; this.CHK_RandomAbility.Text = "Random Abilities (1, 2, or Hidden)"; this.CHK_RandomAbility.UseVisualStyleBackColor = true; @@ -1802,9 +2009,10 @@ private void InitializeComponent() // CHK_RandomAura // this.CHK_RandomAura.AutoSize = true; - this.CHK_RandomAura.Location = new System.Drawing.Point(9, 105); + this.CHK_RandomAura.Location = new System.Drawing.Point(12, 129); + this.CHK_RandomAura.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_RandomAura.Name = "CHK_RandomAura"; - this.CHK_RandomAura.Size = new System.Drawing.Size(172, 17); + this.CHK_RandomAura.Size = new System.Drawing.Size(213, 20); this.CHK_RandomAura.TabIndex = 300; this.CHK_RandomAura.Text = "Random Totem Pokémon Aura"; this.CHK_RandomAura.UseVisualStyleBackColor = true; @@ -1812,9 +2020,10 @@ private void InitializeComponent() // CHK_AllowMega // this.CHK_AllowMega.AutoSize = true; - this.CHK_AllowMega.Location = new System.Drawing.Point(9, 90); + this.CHK_AllowMega.Location = new System.Drawing.Point(12, 111); + this.CHK_AllowMega.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_AllowMega.Name = "CHK_AllowMega"; - this.CHK_AllowMega.Size = new System.Drawing.Size(155, 17); + this.CHK_AllowMega.Size = new System.Drawing.Size(193, 20); this.CHK_AllowMega.TabIndex = 298; this.CHK_AllowMega.Text = "Allow Random Mega Forms"; this.CHK_AllowMega.UseVisualStyleBackColor = true; @@ -1824,9 +2033,10 @@ private void InitializeComponent() this.CHK_Item.AutoSize = true; this.CHK_Item.Checked = true; this.CHK_Item.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_Item.Location = new System.Drawing.Point(9, 75); + this.CHK_Item.Location = new System.Drawing.Point(12, 92); + this.CHK_Item.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_Item.Name = "CHK_Item"; - this.CHK_Item.Size = new System.Drawing.Size(119, 17); + this.CHK_Item.Size = new System.Drawing.Size(146, 20); this.CHK_Item.TabIndex = 297; this.CHK_Item.Text = "Random Held Items"; this.CHK_Item.UseVisualStyleBackColor = true; @@ -1836,9 +2046,10 @@ private void InitializeComponent() this.CHK_G7.AutoSize = true; this.CHK_G7.Checked = true; this.CHK_G7.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G7.Location = new System.Drawing.Point(9, 57); + this.CHK_G7.Location = new System.Drawing.Point(12, 70); + this.CHK_G7.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G7.Name = "CHK_G7"; - this.CHK_G7.Size = new System.Drawing.Size(55, 17); + this.CHK_G7.Size = new System.Drawing.Size(62, 20); this.CHK_G7.TabIndex = 296; this.CHK_G7.Text = "Gen 7"; this.CHK_G7.UseVisualStyleBackColor = true; @@ -1846,9 +2057,10 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(128, 43); + this.CHK_BST.Location = new System.Drawing.Point(171, 53); + this.CHK_BST.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_BST.Name = "CHK_BST"; - this.CHK_BST.Size = new System.Drawing.Size(117, 17); + this.CHK_BST.Size = new System.Drawing.Size(144, 20); this.CHK_BST.TabIndex = 288; this.CHK_BST.Text = "Randomize by BST"; this.CHK_BST.UseVisualStyleBackColor = true; @@ -1858,9 +2070,10 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(128, 29); + this.CHK_E.Location = new System.Drawing.Point(171, 36); + this.CHK_E.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_E.Name = "CHK_E"; - this.CHK_E.Size = new System.Drawing.Size(98, 17); + this.CHK_E.Size = new System.Drawing.Size(117, 20); this.CHK_E.TabIndex = 287; this.CHK_E.Text = "Event Legends"; this.CHK_E.UseVisualStyleBackColor = true; @@ -1870,9 +2083,10 @@ private void InitializeComponent() this.CHK_L.AutoSize = true; this.CHK_L.Checked = true; this.CHK_L.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_L.Location = new System.Drawing.Point(128, 15); + this.CHK_L.Location = new System.Drawing.Point(171, 18); + this.CHK_L.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_L.Name = "CHK_L"; - this.CHK_L.Size = new System.Drawing.Size(98, 17); + this.CHK_L.Size = new System.Drawing.Size(120, 20); this.CHK_L.TabIndex = 286; this.CHK_L.Text = "Game Legends"; this.CHK_L.UseVisualStyleBackColor = true; @@ -1882,9 +2096,10 @@ private void InitializeComponent() this.CHK_G6.AutoSize = true; this.CHK_G6.Checked = true; this.CHK_G6.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G6.Location = new System.Drawing.Point(67, 43); + this.CHK_G6.Location = new System.Drawing.Point(89, 53); + this.CHK_G6.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G6.Name = "CHK_G6"; - this.CHK_G6.Size = new System.Drawing.Size(55, 17); + this.CHK_G6.Size = new System.Drawing.Size(62, 20); this.CHK_G6.TabIndex = 285; this.CHK_G6.Text = "Gen 6"; this.CHK_G6.UseVisualStyleBackColor = true; @@ -1894,9 +2109,10 @@ private void InitializeComponent() this.CHK_G5.AutoSize = true; this.CHK_G5.Checked = true; this.CHK_G5.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G5.Location = new System.Drawing.Point(67, 29); + this.CHK_G5.Location = new System.Drawing.Point(89, 36); + this.CHK_G5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G5.Name = "CHK_G5"; - this.CHK_G5.Size = new System.Drawing.Size(55, 17); + this.CHK_G5.Size = new System.Drawing.Size(62, 20); this.CHK_G5.TabIndex = 284; this.CHK_G5.Text = "Gen 5"; this.CHK_G5.UseVisualStyleBackColor = true; @@ -1906,9 +2122,10 @@ private void InitializeComponent() this.CHK_G4.AutoSize = true; this.CHK_G4.Checked = true; this.CHK_G4.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G4.Location = new System.Drawing.Point(67, 15); + this.CHK_G4.Location = new System.Drawing.Point(89, 18); + this.CHK_G4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G4.Name = "CHK_G4"; - this.CHK_G4.Size = new System.Drawing.Size(55, 17); + this.CHK_G4.Size = new System.Drawing.Size(62, 20); this.CHK_G4.TabIndex = 283; this.CHK_G4.Text = "Gen 4"; this.CHK_G4.UseVisualStyleBackColor = true; @@ -1918,9 +2135,10 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(9, 43); + this.CHK_G3.Location = new System.Drawing.Point(12, 53); + this.CHK_G3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G3.Name = "CHK_G3"; - this.CHK_G3.Size = new System.Drawing.Size(55, 17); + this.CHK_G3.Size = new System.Drawing.Size(62, 20); this.CHK_G3.TabIndex = 282; this.CHK_G3.Text = "Gen 3"; this.CHK_G3.UseVisualStyleBackColor = true; @@ -1930,9 +2148,10 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(9, 29); + this.CHK_G2.Location = new System.Drawing.Point(12, 36); + this.CHK_G2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G2.Name = "CHK_G2"; - this.CHK_G2.Size = new System.Drawing.Size(55, 17); + this.CHK_G2.Size = new System.Drawing.Size(62, 20); this.CHK_G2.TabIndex = 281; this.CHK_G2.Text = "Gen 2"; this.CHK_G2.UseVisualStyleBackColor = true; @@ -1942,18 +2161,20 @@ private void InitializeComponent() this.CHK_G1.AutoSize = true; this.CHK_G1.Checked = true; this.CHK_G1.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G1.Location = new System.Drawing.Point(9, 15); + this.CHK_G1.Location = new System.Drawing.Point(12, 18); + this.CHK_G1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.CHK_G1.Name = "CHK_G1"; - this.CHK_G1.Size = new System.Drawing.Size(55, 17); + this.CHK_G1.Size = new System.Drawing.Size(62, 20); this.CHK_G1.TabIndex = 280; this.CHK_G1.Text = "Gen 1"; this.CHK_G1.UseVisualStyleBackColor = true; // // B_Starters // - this.B_Starters.Location = new System.Drawing.Point(192, 398); + this.B_Starters.Location = new System.Drawing.Point(256, 490); + this.B_Starters.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.B_Starters.Name = "B_Starters"; - this.B_Starters.Size = new System.Drawing.Size(122, 23); + this.B_Starters.Size = new System.Drawing.Size(163, 28); this.B_Starters.TabIndex = 9; this.B_Starters.Text = "Randomize Starters"; this.B_Starters.UseVisualStyleBackColor = true; @@ -1961,9 +2182,10 @@ private void InitializeComponent() // // B_Save // - this.B_Save.Location = new System.Drawing.Point(435, 518); + this.B_Save.Location = new System.Drawing.Point(580, 638); + this.B_Save.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.B_Save.Name = "B_Save"; - this.B_Save.Size = new System.Drawing.Size(75, 23); + this.B_Save.Size = new System.Drawing.Size(100, 28); this.B_Save.TabIndex = 1; this.B_Save.Text = "Save"; this.B_Save.UseVisualStyleBackColor = true; @@ -1971,9 +2193,10 @@ private void InitializeComponent() // // B_Cancel // - this.B_Cancel.Location = new System.Drawing.Point(354, 518); + this.B_Cancel.Location = new System.Drawing.Point(472, 638); + this.B_Cancel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.B_Cancel.Name = "B_Cancel"; - this.B_Cancel.Size = new System.Drawing.Size(75, 23); + this.B_Cancel.Size = new System.Drawing.Size(100, 28); this.B_Cancel.TabIndex = 2; this.B_Cancel.Text = "Cancel"; this.B_Cancel.UseVisualStyleBackColor = true; @@ -1981,12 +2204,13 @@ private void InitializeComponent() // // StaticEncounterEditor7 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(530, 571); + this.ClientSize = new System.Drawing.Size(707, 703); this.Controls.Add(this.B_Cancel); this.Controls.Add(this.B_Save); this.Controls.Add(this.TC_Tabs); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "StaticEncounterEditor7"; this.Text = "StaticEncounterEditor7"; this.TC_Tabs.ResumeLayout(false); @@ -2184,5 +2408,8 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Ally1; private System.Windows.Forms.ComboBox CB_EGender; private System.Windows.Forms.ComboBox CB_TGender; + private System.Windows.Forms.Button B_ClearSE; + private System.Windows.Forms.Button B_CurrentAttackSE; + private System.Windows.Forms.Button B_HighAttackSE; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs index 31f446dfd7..ed808291ce 100644 --- a/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs +++ b/pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs @@ -1,10 +1,12 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using pk3DS.Core; using pk3DS.Core.Randomizers; using pk3DS.Core.Structures; +using pk3DS.Core.Structures.PersonalInfo; namespace pk3DS { @@ -14,6 +16,7 @@ public partial class StaticEncounterEditor7 : Form private readonly EncounterGift7[] Gifts; private readonly EncounterStatic7[] Encounters; private readonly EncounterTrade7[] Trades; + private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); @@ -80,7 +83,7 @@ public StaticEncounterEditor7(byte[][] infiles) { byte[] entry = new byte[EncounterGift7.SIZE]; Array.Copy(data, i, entry, 0, entry.Length); - Gifts[i/EncounterGift7.SIZE] = new EncounterGift7(entry); + Gifts[i / EncounterGift7.SIZE] = new EncounterGift7(entry); } } oldStarters = Gifts.Take(3).Select(gift => gift.Species).ToArray(); @@ -93,7 +96,7 @@ public StaticEncounterEditor7(byte[][] infiles) { byte[] entry = new byte[EncounterStatic7.SIZE]; Array.Copy(data, i, entry, 0, entry.Length); - Encounters[i/EncounterStatic7.SIZE] = new EncounterStatic7(entry); + Encounters[i / EncounterStatic7.SIZE] = new EncounterStatic7(entry); } } @@ -105,7 +108,7 @@ public StaticEncounterEditor7(byte[][] infiles) { byte[] entry = new byte[EncounterTrade7.SIZE]; Array.Copy(data, i, entry, 0, entry.Length); - Trades[i/EncounterTrade7.SIZE] = new EncounterTrade7(entry); + Trades[i / EncounterTrade7.SIZE] = new EncounterTrade7(entry); } } @@ -555,7 +558,7 @@ private void B_Starters_Click(object sender, EventArgs e) { int rv; do { rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); } - while (banned.Contains(rv)) ; + while (banned.Contains(rv)); t.SpecialMove = rv; } @@ -795,5 +798,32 @@ private void ModifyLevels(object sender, EventArgs e) } WinFormsUtil.Alert("Modified all Levels according to specification!"); } + + private void B_CurrentAttackSE_Click(object sender, EventArgs e) + { + int species = CB_ESpecies.SelectedIndex; + int lvl = (int)NUD_ELevel.Value; + int frm = (int)NUD_EForm.Value; + int[] moves = learn.GetCurrentMoves(species, frm, lvl, 4); + SetMoves(moves); + } + + private void B_HighAttackSE_Click(object sender, EventArgs e) + { + int species = CB_ESpecies.SelectedIndex; + int frm = (int)NUD_EForm.Value; + int[] moves = learn.GetHighPoweredMoves(species, frm, 4); + SetMoves(moves); + } + + private void B_ClearSE_Click(object sender, EventArgs e) => SetMoves(new int[4]); + + private void SetMoves(IList moves) + { + var mcb = new[] { CB_EMove0, CB_EMove1, CB_EMove2, CB_EMove3 }; + for (int i = 0; i < mcb.Length; i++) + mcb[i].SelectedIndex = moves[i]; + } + } } \ No newline at end of file From 34a91ac81d8a157be3ba8ec045afaa151039bbe7 Mon Sep 17 00:00:00 2001 From: haggys22 Date: Fri, 10 Jul 2020 02:50:25 +0200 Subject: [PATCH 152/191] Add "Basic Starters" per generation --- pk3DS.Core/Legality/Legal.cs | 42 +++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index e9f01feef5..849590ca8d 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -371,18 +371,40 @@ public static partial class Legal 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, 650, 651, 652 }; - - public static readonly int[] BasicStarters_6 = - { - 001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147, 152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246, 252, 255, 258, - 265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374, 387, 390, 393, 396, 403, 406, 440, 443, 495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602, - 607, 610, 633, 650, 653, 656, 661, 664, 669, 679, 704 + + public static readonly int[][] BasicStarters = { + new int[] { + 001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147 + }, + new int[] { + 152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246 + }, + new int[] { + 252, 255, 258, 265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374 + }, + new int[] { + 387, 390, 393, 396, 403, 406, 440, 443 + }, + new int[] { + 495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602, 607, 610, 633 + }, + new int[] { + 650, 653, 656, 661, 664, 669, 679, 704 + }, + new int[] { + 722, 725, 728, 731, 736, 761, 782, 789 + } }; - public static readonly int[] BasicStarters_7 = BasicStarters_6.Concat(new int[] - { - 722, 725, 728, 731, 736, 761, 782, 789 - }).ToArray(); + public static readonly int[] BasicStarters_6 = BasicStarters[0] + .Concat(BasicStarters[1]) + .Concat(BasicStarters[2]) + .Concat(BasicStarters[3]) + .Concat(BasicStarters[4]) + .Concat(BasicStarters[5]) + .ToArray(); + + public static readonly int[] BasicStarters_7 = BasicStarters_6.Concat(BasicStarters[6]).ToArray(); public static readonly int[] FinalEvolutions_6 = { From 4069d087fb8cdccbfc19c6a07f17edf768137799 Mon Sep 17 00:00:00 2001 From: haggys22 Date: Fri, 10 Jul 2020 03:01:06 +0200 Subject: [PATCH 153/191] Pick Basic Starters of Same Gen (Gen6) --- pk3DS/Subforms/Gen6/StarterEditor6.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index b31fa71614..00498125ab 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -64,6 +64,7 @@ public StarterEditor6() private readonly int Count = Main.Config.ORAS ? 4 : 2; private int offset; private static int[] BasicStarter; + private static int[] BasicStarterPerGen; private void B_Save_Click(object sender, EventArgs e) { @@ -85,6 +86,7 @@ private void loadData() if (!Main.Config.ORAS) // XY have 0x10 bytes of zeroes offset += 0x10; BasicStarter = Legal.BasicStarters_6; + BasicStarterPerGen = Legal.BasicStarters; for (int i = 0; i < Count; i++) { Labels[i].Visible = true; @@ -177,8 +179,15 @@ private void B_Randomize_Click(object sender, EventArgs e) int oldSpecies = BitConverter.ToUInt16(Data, offset + (((i * 3) + j) * 0x54)); if (CHK_BasicStarter.Checked) { - int basic() => (int)(Util.rnd32() % BasicStarter.Length); - Choices[i][j].SelectedIndex = BasicStarter[basic()]; + if (CHK_Gen.Checked) + { + int basic() => (int)(Util.rnd32() % BasicStarterPerGen[gen - 1].Length); + Choices[i][j].SelectedIndex = BasicStarterPerGen[gen - 1][basic()]; + } + else { + int basic() => (int)(Util.rnd32() % BasicStarter.Length); + Choices[i][j].SelectedIndex = BasicStarter[basic()]; + } } else Choices[i][j].SelectedIndex = rand.GetRandomSpecies(i); @@ -192,4 +201,4 @@ private void B_Randomize_Click(object sender, EventArgs e) } } } -} \ No newline at end of file +} From 652322db171438ef0271c2e6d852dd8a760548d4 Mon Sep 17 00:00:00 2001 From: haggys22 Date: Fri, 10 Jul 2020 03:05:26 +0200 Subject: [PATCH 154/191] Remove newline at end of file --- pk3DS/Subforms/Gen6/StarterEditor6.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index 00498125ab..8f35fd56dd 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -201,4 +201,4 @@ private void B_Randomize_Click(object sender, EventArgs e) } } } -} +} \ No newline at end of file From 82af1d63aa339323a2d7cb8f2dfade78c82dffde Mon Sep 17 00:00:00 2001 From: haggys22 Date: Fri, 10 Jul 2020 14:43:16 +0200 Subject: [PATCH 155/191] Fix data type of BasicStartersPerGen (#451) Co-authored-by: haggys22 --- pk3DS/Subforms/Gen6/StarterEditor6.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index 8f35fd56dd..74ad14b92d 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -64,7 +64,7 @@ public StarterEditor6() private readonly int Count = Main.Config.ORAS ? 4 : 2; private int offset; private static int[] BasicStarter; - private static int[] BasicStarterPerGen; + private static int[][] BasicStarterPerGen; private void B_Save_Click(object sender, EventArgs e) { From f7646eec860840fd85f4f404178c6111f2705a94 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 3 Aug 2020 18:27:30 -0700 Subject: [PATCH 156/191] Load value using same culture as the one that writes it Closes #456 --- pk3DS/Tools/RandSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pk3DS/Tools/RandSettings.cs b/pk3DS/Tools/RandSettings.cs index 4e2e13bac2..46f56b9fe0 100644 --- a/pk3DS/Tools/RandSettings.cs +++ b/pk3DS/Tools/RandSettings.cs @@ -79,7 +79,7 @@ private static void TryGetValue(Control ctrl, string s) switch (ctrl) { case NumericUpDown nud: - if (decimal.TryParse(s, out var n)) + if (decimal.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out var n)) nud.Value = n; break; case ComboBox cb: From a58c7f90cdf66e6357d1c52bdc4833a60df6d9e6 Mon Sep 17 00:00:00 2001 From: Koopa Date: Wed, 16 Sep 2020 20:18:05 -0400 Subject: [PATCH 157/191] Add more move availability modifiers (#462) * Add full TM compat. to Gen6 * Fix variable name * Add full TM compat. to Gen7 * Use Items.Count rather than hardcoding * Add "All move tutors" button to Gen6 * Make the move tutor name/label less misleading * Add "Add all" for move tutors and beach tutors for Gen7 * Revert unintentional changes --- .../Subforms/Gen6/PersonalEditor6.Designer.cs | 46 +++++++++++---- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 7 +++ .../Subforms/Gen7/PersonalEditor7.Designer.cs | 59 +++++++++++++++---- pk3DS/Subforms/Gen7/PersonalEditor7.cs | 10 ++++ 4 files changed, 102 insertions(+), 20 deletions(-) diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs index 186cfcd24f..c4c81e9eab 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs @@ -110,6 +110,8 @@ private void InitializeComponent() this.CLB_TMHM = new System.Windows.Forms.CheckedListBox(); this.TP_Randomizer = new System.Windows.Forms.TabPage(); this.GB_Modifier = new System.Windows.Forms.GroupBox(); + this.CHK_FullTMCompatibility = new System.Windows.Forms.CheckBox(); + this.CHK_FullHMCompatibility = new System.Windows.Forms.CheckBox(); this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); this.CHK_CatchRateMod = new System.Windows.Forms.CheckBox(); this.L_CatchRateMod = new System.Windows.Forms.Label(); @@ -149,7 +151,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.CHK_FullHMCompatibility = new System.Windows.Forms.CheckBox(); + this.CHK_FullMoveTutorCompatibility = new System.Windows.Forms.CheckBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -1048,6 +1050,8 @@ private void InitializeComponent() // // GB_Modifier // + this.GB_Modifier.Controls.Add(this.CHK_FullMoveTutorCompatibility); + this.GB_Modifier.Controls.Add(this.CHK_FullTMCompatibility); this.GB_Modifier.Controls.Add(this.CHK_FullHMCompatibility); this.GB_Modifier.Controls.Add(this.CHK_NoTutor); this.GB_Modifier.Controls.Add(this.CHK_CatchRateMod); @@ -1061,11 +1065,31 @@ private void InitializeComponent() this.GB_Modifier.Controls.Add(this.CHK_NoEV); this.GB_Modifier.Location = new System.Drawing.Point(4, 147); this.GB_Modifier.Name = "GB_Modifier"; - this.GB_Modifier.Size = new System.Drawing.Size(345, 152); + this.GB_Modifier.Size = new System.Drawing.Size(345, 176); this.GB_Modifier.TabIndex = 419; this.GB_Modifier.TabStop = false; this.GB_Modifier.Text = "Modifier Options"; // + // CHK_FullTMCompatibility + // + this.CHK_FullTMCompatibility.AutoSize = true; + this.CHK_FullTMCompatibility.Location = new System.Drawing.Point(6, 131); + this.CHK_FullTMCompatibility.Name = "CHK_FullTMCompatibility"; + this.CHK_FullTMCompatibility.Size = new System.Drawing.Size(122, 17); + this.CHK_FullTMCompatibility.TabIndex = 21; + this.CHK_FullTMCompatibility.Text = "Full TM Compatibility"; + this.CHK_FullTMCompatibility.UseVisualStyleBackColor = true; + // + // CHK_FullHMCompatibility + // + this.CHK_FullHMCompatibility.AutoSize = true; + this.CHK_FullHMCompatibility.Location = new System.Drawing.Point(204, 131); + this.CHK_FullHMCompatibility.Name = "CHK_FullHMCompatibility"; + this.CHK_FullHMCompatibility.Size = new System.Drawing.Size(123, 17); + this.CHK_FullHMCompatibility.TabIndex = 22; + this.CHK_FullHMCompatibility.Text = "Full HM Compatibility"; + this.CHK_FullHMCompatibility.UseVisualStyleBackColor = true; + // // CHK_NoTutor // this.CHK_NoTutor.AutoSize = true; @@ -1535,15 +1559,15 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // CHK_FullHMCompatibility + // CHK_FullMoveTutorCompatibility // - this.CHK_FullHMCompatibility.AutoSize = true; - this.CHK_FullHMCompatibility.Location = new System.Drawing.Point(6, 127); - this.CHK_FullHMCompatibility.Name = "CHK_FullHMCompatibility"; - this.CHK_FullHMCompatibility.Size = new System.Drawing.Size(123, 17); - this.CHK_FullHMCompatibility.TabIndex = 21; - this.CHK_FullHMCompatibility.Text = "Full HM Compatibility"; - this.CHK_FullHMCompatibility.UseVisualStyleBackColor = true; + this.CHK_FullMoveTutorCompatibility.AutoSize = true; + this.CHK_FullMoveTutorCompatibility.Location = new System.Drawing.Point(6, 153); + this.CHK_FullMoveTutorCompatibility.Name = "CHK_FullMoveTutorCompatibility"; + this.CHK_FullMoveTutorCompatibility.Size = new System.Drawing.Size(161, 17); + this.CHK_FullMoveTutorCompatibility.TabIndex = 24; + this.CHK_FullMoveTutorCompatibility.Text = "Full Move Tutor Compatibility"; + this.CHK_FullMoveTutorCompatibility.UseVisualStyleBackColor = true; // // PersonalEditor6 // @@ -1706,6 +1730,8 @@ private void InitializeComponent() private System.Windows.Forms.Label L_Ability2; private System.Windows.Forms.Label L_Ability1; private System.Windows.Forms.TextBox TB_RawColor; + private System.Windows.Forms.CheckBox CHK_FullTMCompatibility; private System.Windows.Forms.CheckBox CHK_FullHMCompatibility; + private System.Windows.Forms.CheckBox CHK_FullMoveTutorCompatibility; } } diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index ba2f17b810..03e943616c 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -400,9 +400,16 @@ private void B_ModifyAll(object sender, EventArgs e) CLB_ORASTutors.SetItemCheckState(ao, CheckState.Unchecked); } + if (CHK_FullTMCompatibility.Checked) + for (int t = 0; t < 100; t++) + CLB_TMHM.SetItemCheckState(t, CheckState.Checked); if (CHK_FullHMCompatibility.Checked) for (int h = 100; h < CLB_TMHM.Items.Count; h++) CLB_TMHM.SetItemCheckState(h, CheckState.Checked); + if (CHK_FullMoveTutorCompatibility.Checked) + for (int m = 0; m < CLB_MoveTutors.Items.Count; m++) + CLB_MoveTutors.SetItemCheckState(m, CheckState.Checked); + if (CHK_QuickHatch.Checked) TB_HatchCycles.Text = 1.ToString(); diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs index 5076a7c661..6a0dce043b 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs @@ -32,6 +32,7 @@ private void InitializeComponent() this.L_Species_Precursor = new System.Windows.Forms.Label(); this.TC_Pokemon = new System.Windows.Forms.TabControl(); this.TP_General = new System.Windows.Forms.TabPage(); + this.TB_RawColor = new System.Windows.Forms.TextBox(); this.L_HiddenAbility = new System.Windows.Forms.Label(); this.L_WeightKG = new System.Windows.Forms.Label(); this.L_Ability2 = new System.Windows.Forms.Label(); @@ -118,6 +119,8 @@ private void InitializeComponent() this.CLB_TM = new System.Windows.Forms.CheckedListBox(); this.TP_Randomizer = new System.Windows.Forms.TabPage(); this.GB_Modifier = new System.Windows.Forms.GroupBox(); + this.CHK_FullMoveTutorCompatibility = new System.Windows.Forms.CheckBox(); + this.CHK_FullTMCompatibility = new System.Windows.Forms.CheckBox(); this.CHK_NoTutor = new System.Windows.Forms.CheckBox(); this.CHK_CatchRateMod = new System.Windows.Forms.CheckBox(); this.L_CatchRateMod = new System.Windows.Forms.Label(); @@ -159,7 +162,7 @@ private void InitializeComponent() this.B_Randomize = new System.Windows.Forms.Button(); this.PB_MonSprite = new System.Windows.Forms.PictureBox(); this.B_Dump = new System.Windows.Forms.Button(); - this.TB_RawColor = new System.Windows.Forms.TextBox(); + this.CHK_FullBeachTutorCompatibility = new System.Windows.Forms.CheckBox(); this.TC_Pokemon.SuspendLayout(); this.TP_General.SuspendLayout(); this.TP_MoveTutors.SuspendLayout(); @@ -296,6 +299,16 @@ private void InitializeComponent() this.TP_General.Text = "General Info"; this.TP_General.UseVisualStyleBackColor = true; // + // TB_RawColor + // + this.TB_RawColor.Location = new System.Drawing.Point(229, 209); + this.TB_RawColor.Name = "TB_RawColor"; + this.TB_RawColor.ReadOnly = true; + this.TB_RawColor.Size = new System.Drawing.Size(30, 20); + this.TB_RawColor.TabIndex = 420; + this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_RawColor.Visible = false; + // // L_HiddenAbility // this.L_HiddenAbility.AutoSize = true; @@ -1140,6 +1153,9 @@ private void InitializeComponent() // // GB_Modifier // + this.GB_Modifier.Controls.Add(this.CHK_FullBeachTutorCompatibility); + this.GB_Modifier.Controls.Add(this.CHK_FullMoveTutorCompatibility); + this.GB_Modifier.Controls.Add(this.CHK_FullTMCompatibility); this.GB_Modifier.Controls.Add(this.CHK_NoTutor); this.GB_Modifier.Controls.Add(this.CHK_CatchRateMod); this.GB_Modifier.Controls.Add(this.L_CatchRateMod); @@ -1155,11 +1171,31 @@ private void InitializeComponent() this.GB_Modifier.Controls.Add(this.CHK_NoEV); this.GB_Modifier.Location = new System.Drawing.Point(4, 147); this.GB_Modifier.Name = "GB_Modifier"; - this.GB_Modifier.Size = new System.Drawing.Size(345, 129); + this.GB_Modifier.Size = new System.Drawing.Size(345, 188); this.GB_Modifier.TabIndex = 419; this.GB_Modifier.TabStop = false; this.GB_Modifier.Text = "Modifier Options"; // + // CHK_FullMoveTutorCompatibility + // + this.CHK_FullMoveTutorCompatibility.AutoSize = true; + this.CHK_FullMoveTutorCompatibility.Location = new System.Drawing.Point(6, 154); + this.CHK_FullMoveTutorCompatibility.Name = "CHK_FullMoveTutorCompatibility"; + this.CHK_FullMoveTutorCompatibility.Size = new System.Drawing.Size(138, 30); + this.CHK_FullMoveTutorCompatibility.TabIndex = 23; + this.CHK_FullMoveTutorCompatibility.Text = "Full Special Move Tutor\nCompatibility"; + this.CHK_FullMoveTutorCompatibility.UseVisualStyleBackColor = true; + // + // CHK_FullTMCompatibility + // + this.CHK_FullTMCompatibility.AutoSize = true; + this.CHK_FullTMCompatibility.Location = new System.Drawing.Point(6, 131); + this.CHK_FullTMCompatibility.Name = "CHK_FullTMCompatibility"; + this.CHK_FullTMCompatibility.Size = new System.Drawing.Size(122, 17); + this.CHK_FullTMCompatibility.TabIndex = 22; + this.CHK_FullTMCompatibility.Text = "Full TM Compatibility"; + this.CHK_FullTMCompatibility.UseVisualStyleBackColor = true; + // // CHK_NoTutor // this.CHK_NoTutor.AutoSize = true; @@ -1652,15 +1688,15 @@ private void InitializeComponent() this.B_Dump.UseVisualStyleBackColor = true; this.B_Dump.Click += new System.EventHandler(this.B_Dump_Click); // - // TB_RawColor + // CHK_FullBeachTutorCompatibility // - this.TB_RawColor.Location = new System.Drawing.Point(229, 209); - this.TB_RawColor.Name = "TB_RawColor"; - this.TB_RawColor.ReadOnly = true; - this.TB_RawColor.Size = new System.Drawing.Size(30, 20); - this.TB_RawColor.TabIndex = 420; - this.TB_RawColor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.TB_RawColor.Visible = false; + this.CHK_FullBeachTutorCompatibility.AutoSize = true; + this.CHK_FullBeachTutorCompatibility.Location = new System.Drawing.Point(204, 152); + this.CHK_FullBeachTutorCompatibility.Name = "CHK_FullBeachTutorCompatibility"; + this.CHK_FullBeachTutorCompatibility.Size = new System.Drawing.Size(134, 30); + this.CHK_FullBeachTutorCompatibility.TabIndex = 24; + this.CHK_FullBeachTutorCompatibility.Text = "Full Beach Move Tutor\nCompatibility"; + this.CHK_FullBeachTutorCompatibility.UseVisualStyleBackColor = true; // // PersonalEditor7 // @@ -1831,9 +1867,12 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_BeachTutors; private System.Windows.Forms.CheckBox CHK_Shuffle; private System.Windows.Forms.CheckBox CHK_NoTutor; + private System.Windows.Forms.CheckBox CHK_FullTMCompatibility; private System.Windows.Forms.Label L_HiddenAbility; private System.Windows.Forms.Label L_Ability2; private System.Windows.Forms.Label L_Ability1; private System.Windows.Forms.TextBox TB_RawColor; + private System.Windows.Forms.CheckBox CHK_FullMoveTutorCompatibility; + private System.Windows.Forms.CheckBox CHK_FullBeachTutorCompatibility; } } diff --git a/pk3DS/Subforms/Gen7/PersonalEditor7.cs b/pk3DS/Subforms/Gen7/PersonalEditor7.cs index 950752e8af..a635659af6 100644 --- a/pk3DS/Subforms/Gen7/PersonalEditor7.cs +++ b/pk3DS/Subforms/Gen7/PersonalEditor7.cs @@ -384,6 +384,16 @@ private void B_ModifyAll(object sender, EventArgs e) CLB_BeachTutors.SetItemCheckState(ao, CheckState.Unchecked); } + if (CHK_FullTMCompatibility.Checked) + for (int t = 0; t < CLB_TM.Items.Count; t++) + CLB_TM.SetItemCheckState(t, CheckState.Checked); + if (CHK_FullMoveTutorCompatibility.Checked) + for (int m = 0; m < CLB_MoveTutors.Items.Count; m++) + CLB_MoveTutors.SetItemCheckState(m, CheckState.Checked); + if (CHK_FullBeachTutorCompatibility.Checked) + for (int m = 0; m < CLB_BeachTutors.Items.Count; m++) + CLB_BeachTutors.SetItemCheckState(m, CheckState.Checked); + if (CHK_QuickHatch.Checked) TB_HatchCycles.Text = 1.ToString(); if (CHK_CallRate.Checked) From f1833e74a88e6263d4347f924e53769c25d16a9f Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 23 Sep 2020 19:01:54 -0400 Subject: [PATCH 158/191] Add every level evolution randomizer (#463) Similar implementation to pkNX; could be cleaner but it works. Also add in form randomization to evolution randomizer (missing for almost 4 years, lol) --- pk3DS.Core/Randomizers/EvolutionRandomizer.cs | 45 +++++- .../Gen6/EvolutionEditor6.Designer.cs | 129 ++++++++++++------ pk3DS/Subforms/Gen6/EvolutionEditor6.cs | 23 ++++ .../Gen7/EvolutionEditor7.Designer.cs | 51 ++++++- pk3DS/Subforms/Gen7/EvolutionEditor7.cs | 23 ++++ 5 files changed, 219 insertions(+), 52 deletions(-) diff --git a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs index d16b6a6e40..c0281501aa 100644 --- a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs +++ b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs @@ -8,12 +8,14 @@ public class EvolutionRandomizer : IRandomizer private readonly GameConfig Config; public readonly SpeciesRandomizer Randomizer; + public readonly FormRandomizer FormRandomizer; public EvolutionRandomizer(GameConfig config, EvolutionSet[] evolutions) { Config = config; Evolutions = evolutions; Randomizer = new SpeciesRandomizer(Config); + FormRandomizer = new FormRandomizer(config); } public void Execute() @@ -34,13 +36,25 @@ public void ExecuteTrade() } } + public void ExecuteEvolveEveryLevel() + { + for (var i = 0; i < Evolutions.Length; i++) + { + var evo = Evolutions[i]; + MakeEvolveEveryLevel(evo, i); + } + } + private void Randomize(EvolutionSet evo, int i) { var evos = evo.PossibleEvolutions; foreach (EvolutionMethod v in evos) { if (v.Method > 0) + { v.Species = Randomizer.GetRandomSpecies(v.Species, i); + v.Form = FormRandomizer.GetRandomForme(v.Species); + } } } @@ -73,5 +87,34 @@ private void Trade(EvolutionSet evo, int i) } } } + + private void MakeEvolveEveryLevel(EvolutionSet evo, int species) + { + var evos = evo.PossibleEvolutions; + foreach (EvolutionMethod v in evos) + { + switch (Config.Generation) + { + case 6: + v.Argument = 1; + v.Method = 4; + v.Species = 1; + break; + default: + v.Argument = 0; + v.Form = 0; + v.Level = 1; + v.Method = 4; + v.Species = 1; // will be randomized after + break; + } + } + + if (evos[1].Species != 0) // has other branched evolutions; remove them + { + for (int i = 1; i < evos.Length; i++) + evos[i] = new EvolutionMethod(); + } + } } -} +} \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs index e062fd5333..2a26f81ce4 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs @@ -78,6 +78,9 @@ private void InitializeComponent() this.CB_P3 = new System.Windows.Forms.ComboBox(); this.CB_P2 = new System.Windows.Forms.ComboBox(); this.CB_P1 = new System.Windows.Forms.ComboBox(); + this.B_EveryLevel = new System.Windows.Forms.Button(); + this.CHK_E = new System.Windows.Forms.CheckBox(); + this.CHK_L = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_4)).BeginInit(); @@ -124,7 +127,7 @@ private void InitializeComponent() this.CB_M1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M1.DropDownWidth = 200; this.CB_M1.FormattingEnabled = true; - this.CB_M1.Location = new System.Drawing.Point(79, 46); + this.CB_M1.Location = new System.Drawing.Point(79, 64); this.CB_M1.MaxDropDownItems = 10; this.CB_M1.Name = "CB_M1"; this.CB_M1.Size = new System.Drawing.Size(150, 21); @@ -134,7 +137,7 @@ private void InitializeComponent() // L_M1 // this.L_M1.AutoSize = true; - this.L_M1.Location = new System.Drawing.Point(18, 49); + this.L_M1.Location = new System.Drawing.Point(18, 67); this.L_M1.Name = "L_M1"; this.L_M1.Size = new System.Drawing.Size(55, 13); this.L_M1.TabIndex = 7; @@ -145,7 +148,7 @@ private void InitializeComponent() this.CB_I1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I1.FormattingEnabled = true; - this.CB_I1.Location = new System.Drawing.Point(277, 46); + this.CB_I1.Location = new System.Drawing.Point(277, 64); this.CB_I1.Name = "CB_I1"; this.CB_I1.Size = new System.Drawing.Size(101, 21); this.CB_I1.TabIndex = 9; @@ -156,7 +159,7 @@ private void InitializeComponent() this.CB_I2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I2.FormattingEnabled = true; - this.CB_I2.Location = new System.Drawing.Point(277, 100); + this.CB_I2.Location = new System.Drawing.Point(277, 118); this.CB_I2.Name = "CB_I2"; this.CB_I2.Size = new System.Drawing.Size(101, 21); this.CB_I2.TabIndex = 15; @@ -165,7 +168,7 @@ private void InitializeComponent() // L_M2 // this.L_M2.AutoSize = true; - this.L_M2.Location = new System.Drawing.Point(18, 103); + this.L_M2.Location = new System.Drawing.Point(18, 121); this.L_M2.Name = "L_M2"; this.L_M2.Size = new System.Drawing.Size(55, 13); this.L_M2.TabIndex = 13; @@ -176,7 +179,7 @@ private void InitializeComponent() this.CB_M2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M2.DropDownWidth = 200; this.CB_M2.FormattingEnabled = true; - this.CB_M2.Location = new System.Drawing.Point(79, 100); + this.CB_M2.Location = new System.Drawing.Point(79, 118); this.CB_M2.MaxDropDownItems = 10; this.CB_M2.Name = "CB_M2"; this.CB_M2.Size = new System.Drawing.Size(150, 21); @@ -188,7 +191,7 @@ private void InitializeComponent() this.CB_I3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I3.FormattingEnabled = true; - this.CB_I3.Location = new System.Drawing.Point(277, 154); + this.CB_I3.Location = new System.Drawing.Point(277, 172); this.CB_I3.Name = "CB_I3"; this.CB_I3.Size = new System.Drawing.Size(101, 21); this.CB_I3.TabIndex = 21; @@ -197,7 +200,7 @@ private void InitializeComponent() // L_M3 // this.L_M3.AutoSize = true; - this.L_M3.Location = new System.Drawing.Point(18, 157); + this.L_M3.Location = new System.Drawing.Point(18, 175); this.L_M3.Name = "L_M3"; this.L_M3.Size = new System.Drawing.Size(55, 13); this.L_M3.TabIndex = 19; @@ -208,7 +211,7 @@ private void InitializeComponent() this.CB_M3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M3.DropDownWidth = 200; this.CB_M3.FormattingEnabled = true; - this.CB_M3.Location = new System.Drawing.Point(79, 154); + this.CB_M3.Location = new System.Drawing.Point(79, 172); this.CB_M3.MaxDropDownItems = 10; this.CB_M3.Name = "CB_M3"; this.CB_M3.Size = new System.Drawing.Size(150, 21); @@ -220,7 +223,7 @@ private void InitializeComponent() this.CB_I4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I4.FormattingEnabled = true; - this.CB_I4.Location = new System.Drawing.Point(277, 208); + this.CB_I4.Location = new System.Drawing.Point(277, 226); this.CB_I4.Name = "CB_I4"; this.CB_I4.Size = new System.Drawing.Size(101, 21); this.CB_I4.TabIndex = 27; @@ -229,7 +232,7 @@ private void InitializeComponent() // L_M4 // this.L_M4.AutoSize = true; - this.L_M4.Location = new System.Drawing.Point(18, 211); + this.L_M4.Location = new System.Drawing.Point(18, 229); this.L_M4.Name = "L_M4"; this.L_M4.Size = new System.Drawing.Size(55, 13); this.L_M4.TabIndex = 25; @@ -240,7 +243,7 @@ private void InitializeComponent() this.CB_M4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M4.DropDownWidth = 200; this.CB_M4.FormattingEnabled = true; - this.CB_M4.Location = new System.Drawing.Point(79, 208); + this.CB_M4.Location = new System.Drawing.Point(79, 226); this.CB_M4.MaxDropDownItems = 10; this.CB_M4.Name = "CB_M4"; this.CB_M4.Size = new System.Drawing.Size(150, 21); @@ -252,7 +255,7 @@ private void InitializeComponent() this.CB_I5.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I5.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I5.FormattingEnabled = true; - this.CB_I5.Location = new System.Drawing.Point(277, 262); + this.CB_I5.Location = new System.Drawing.Point(277, 280); this.CB_I5.Name = "CB_I5"; this.CB_I5.Size = new System.Drawing.Size(101, 21); this.CB_I5.TabIndex = 33; @@ -261,7 +264,7 @@ private void InitializeComponent() // L_M5 // this.L_M5.AutoSize = true; - this.L_M5.Location = new System.Drawing.Point(18, 265); + this.L_M5.Location = new System.Drawing.Point(18, 283); this.L_M5.Name = "L_M5"; this.L_M5.Size = new System.Drawing.Size(55, 13); this.L_M5.TabIndex = 31; @@ -272,7 +275,7 @@ private void InitializeComponent() this.CB_M5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M5.DropDownWidth = 200; this.CB_M5.FormattingEnabled = true; - this.CB_M5.Location = new System.Drawing.Point(79, 262); + this.CB_M5.Location = new System.Drawing.Point(79, 280); this.CB_M5.MaxDropDownItems = 10; this.CB_M5.Name = "CB_M5"; this.CB_M5.Size = new System.Drawing.Size(150, 21); @@ -284,7 +287,7 @@ private void InitializeComponent() this.CB_I8.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I8.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I8.FormattingEnabled = true; - this.CB_I8.Location = new System.Drawing.Point(277, 424); + this.CB_I8.Location = new System.Drawing.Point(277, 442); this.CB_I8.Name = "CB_I8"; this.CB_I8.Size = new System.Drawing.Size(101, 21); this.CB_I8.TabIndex = 51; @@ -293,7 +296,7 @@ private void InitializeComponent() // L_M8 // this.L_M8.AutoSize = true; - this.L_M8.Location = new System.Drawing.Point(18, 427); + this.L_M8.Location = new System.Drawing.Point(18, 445); this.L_M8.Name = "L_M8"; this.L_M8.Size = new System.Drawing.Size(55, 13); this.L_M8.TabIndex = 49; @@ -304,7 +307,7 @@ private void InitializeComponent() this.CB_M8.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M8.DropDownWidth = 200; this.CB_M8.FormattingEnabled = true; - this.CB_M8.Location = new System.Drawing.Point(79, 424); + this.CB_M8.Location = new System.Drawing.Point(79, 442); this.CB_M8.MaxDropDownItems = 10; this.CB_M8.Name = "CB_M8"; this.CB_M8.Size = new System.Drawing.Size(150, 21); @@ -316,7 +319,7 @@ private void InitializeComponent() this.CB_I7.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I7.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I7.FormattingEnabled = true; - this.CB_I7.Location = new System.Drawing.Point(277, 370); + this.CB_I7.Location = new System.Drawing.Point(277, 388); this.CB_I7.Name = "CB_I7"; this.CB_I7.Size = new System.Drawing.Size(101, 21); this.CB_I7.TabIndex = 45; @@ -325,7 +328,7 @@ private void InitializeComponent() // L_M7 // this.L_M7.AutoSize = true; - this.L_M7.Location = new System.Drawing.Point(18, 373); + this.L_M7.Location = new System.Drawing.Point(18, 391); this.L_M7.Name = "L_M7"; this.L_M7.Size = new System.Drawing.Size(55, 13); this.L_M7.TabIndex = 43; @@ -336,7 +339,7 @@ private void InitializeComponent() this.CB_M7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M7.DropDownWidth = 200; this.CB_M7.FormattingEnabled = true; - this.CB_M7.Location = new System.Drawing.Point(79, 370); + this.CB_M7.Location = new System.Drawing.Point(79, 388); this.CB_M7.MaxDropDownItems = 10; this.CB_M7.Name = "CB_M7"; this.CB_M7.Size = new System.Drawing.Size(150, 21); @@ -348,7 +351,7 @@ private void InitializeComponent() this.CB_I6.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_I6.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_I6.FormattingEnabled = true; - this.CB_I6.Location = new System.Drawing.Point(277, 316); + this.CB_I6.Location = new System.Drawing.Point(277, 334); this.CB_I6.Name = "CB_I6"; this.CB_I6.Size = new System.Drawing.Size(101, 21); this.CB_I6.TabIndex = 39; @@ -357,7 +360,7 @@ private void InitializeComponent() // L_M6 // this.L_M6.AutoSize = true; - this.L_M6.Location = new System.Drawing.Point(18, 319); + this.L_M6.Location = new System.Drawing.Point(18, 337); this.L_M6.Name = "L_M6"; this.L_M6.Size = new System.Drawing.Size(55, 13); this.L_M6.TabIndex = 37; @@ -368,7 +371,7 @@ private void InitializeComponent() this.CB_M6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_M6.DropDownWidth = 200; this.CB_M6.FormattingEnabled = true; - this.CB_M6.Location = new System.Drawing.Point(79, 316); + this.CB_M6.Location = new System.Drawing.Point(79, 334); this.CB_M6.MaxDropDownItems = 10; this.CB_M6.Name = "CB_M6"; this.CB_M6.Size = new System.Drawing.Size(150, 21); @@ -377,7 +380,7 @@ private void InitializeComponent() // // PB_1 // - this.PB_1.Location = new System.Drawing.Point(235, 46); + this.PB_1.Location = new System.Drawing.Point(235, 64); this.PB_1.Name = "PB_1"; this.PB_1.Size = new System.Drawing.Size(40, 30); this.PB_1.TabIndex = 54; @@ -385,7 +388,7 @@ private void InitializeComponent() // // PB_2 // - this.PB_2.Location = new System.Drawing.Point(235, 100); + this.PB_2.Location = new System.Drawing.Point(235, 118); this.PB_2.Name = "PB_2"; this.PB_2.Size = new System.Drawing.Size(40, 30); this.PB_2.TabIndex = 55; @@ -393,7 +396,7 @@ private void InitializeComponent() // // PB_4 // - this.PB_4.Location = new System.Drawing.Point(235, 208); + this.PB_4.Location = new System.Drawing.Point(235, 226); this.PB_4.Name = "PB_4"; this.PB_4.Size = new System.Drawing.Size(40, 30); this.PB_4.TabIndex = 57; @@ -401,7 +404,7 @@ private void InitializeComponent() // // PB_3 // - this.PB_3.Location = new System.Drawing.Point(235, 154); + this.PB_3.Location = new System.Drawing.Point(235, 172); this.PB_3.Name = "PB_3"; this.PB_3.Size = new System.Drawing.Size(40, 30); this.PB_3.TabIndex = 56; @@ -409,7 +412,7 @@ private void InitializeComponent() // // PB_6 // - this.PB_6.Location = new System.Drawing.Point(235, 316); + this.PB_6.Location = new System.Drawing.Point(235, 334); this.PB_6.Name = "PB_6"; this.PB_6.Size = new System.Drawing.Size(40, 30); this.PB_6.TabIndex = 59; @@ -417,7 +420,7 @@ private void InitializeComponent() // // PB_5 // - this.PB_5.Location = new System.Drawing.Point(235, 262); + this.PB_5.Location = new System.Drawing.Point(235, 280); this.PB_5.Name = "PB_5"; this.PB_5.Size = new System.Drawing.Size(40, 30); this.PB_5.TabIndex = 58; @@ -425,7 +428,7 @@ private void InitializeComponent() // // PB_8 // - this.PB_8.Location = new System.Drawing.Point(235, 424); + this.PB_8.Location = new System.Drawing.Point(235, 442); this.PB_8.Name = "PB_8"; this.PB_8.Size = new System.Drawing.Size(40, 30); this.PB_8.TabIndex = 61; @@ -433,7 +436,7 @@ private void InitializeComponent() // // PB_7 // - this.PB_7.Location = new System.Drawing.Point(235, 370); + this.PB_7.Location = new System.Drawing.Point(235, 388); this.PB_7.Name = "PB_7"; this.PB_7.Size = new System.Drawing.Size(40, 30); this.PB_7.TabIndex = 60; @@ -451,14 +454,16 @@ private void InitializeComponent() // // GB_Randomizer // + this.GB_Randomizer.Controls.Add(this.CHK_E); + this.GB_Randomizer.Controls.Add(this.CHK_L); this.GB_Randomizer.Controls.Add(this.L_Protip); this.GB_Randomizer.Controls.Add(this.CHK_BST); this.GB_Randomizer.Controls.Add(this.CHK_Type); this.GB_Randomizer.Controls.Add(this.CHK_Exp); this.GB_Randomizer.Controls.Add(this.B_RandAll); - this.GB_Randomizer.Location = new System.Drawing.Point(21, 474); + this.GB_Randomizer.Location = new System.Drawing.Point(21, 494); this.GB_Randomizer.Name = "GB_Randomizer"; - this.GB_Randomizer.Size = new System.Drawing.Size(357, 76); + this.GB_Randomizer.Size = new System.Drawing.Size(357, 108); this.GB_Randomizer.TabIndex = 63; this.GB_Randomizer.TabStop = false; this.GB_Randomizer.Text = "Randomizer Options"; @@ -524,7 +529,7 @@ private void InitializeComponent() this.CB_P8.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P8.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P8.FormattingEnabled = true; - this.CB_P8.Location = new System.Drawing.Point(79, 447); + this.CB_P8.Location = new System.Drawing.Point(79, 465); this.CB_P8.Name = "CB_P8"; this.CB_P8.Size = new System.Drawing.Size(121, 21); this.CB_P8.TabIndex = 52; @@ -534,7 +539,7 @@ private void InitializeComponent() this.CB_P7.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P7.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P7.FormattingEnabled = true; - this.CB_P7.Location = new System.Drawing.Point(79, 393); + this.CB_P7.Location = new System.Drawing.Point(79, 411); this.CB_P7.Name = "CB_P7"; this.CB_P7.Size = new System.Drawing.Size(121, 21); this.CB_P7.TabIndex = 46; @@ -544,7 +549,7 @@ private void InitializeComponent() this.CB_P6.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P6.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P6.FormattingEnabled = true; - this.CB_P6.Location = new System.Drawing.Point(79, 339); + this.CB_P6.Location = new System.Drawing.Point(79, 357); this.CB_P6.Name = "CB_P6"; this.CB_P6.Size = new System.Drawing.Size(121, 21); this.CB_P6.TabIndex = 40; @@ -554,7 +559,7 @@ private void InitializeComponent() this.CB_P5.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P5.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P5.FormattingEnabled = true; - this.CB_P5.Location = new System.Drawing.Point(79, 285); + this.CB_P5.Location = new System.Drawing.Point(79, 303); this.CB_P5.Name = "CB_P5"; this.CB_P5.Size = new System.Drawing.Size(121, 21); this.CB_P5.TabIndex = 34; @@ -564,7 +569,7 @@ private void InitializeComponent() this.CB_P4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P4.FormattingEnabled = true; - this.CB_P4.Location = new System.Drawing.Point(79, 231); + this.CB_P4.Location = new System.Drawing.Point(79, 249); this.CB_P4.Name = "CB_P4"; this.CB_P4.Size = new System.Drawing.Size(121, 21); this.CB_P4.TabIndex = 28; @@ -574,7 +579,7 @@ private void InitializeComponent() this.CB_P3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P3.FormattingEnabled = true; - this.CB_P3.Location = new System.Drawing.Point(79, 177); + this.CB_P3.Location = new System.Drawing.Point(79, 195); this.CB_P3.Name = "CB_P3"; this.CB_P3.Size = new System.Drawing.Size(121, 21); this.CB_P3.TabIndex = 22; @@ -584,7 +589,7 @@ private void InitializeComponent() this.CB_P2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P2.FormattingEnabled = true; - this.CB_P2.Location = new System.Drawing.Point(79, 123); + this.CB_P2.Location = new System.Drawing.Point(79, 141); this.CB_P2.Name = "CB_P2"; this.CB_P2.Size = new System.Drawing.Size(121, 21); this.CB_P2.TabIndex = 16; @@ -594,16 +599,47 @@ private void InitializeComponent() this.CB_P1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_P1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_P1.FormattingEnabled = true; - this.CB_P1.Location = new System.Drawing.Point(79, 69); + this.CB_P1.Location = new System.Drawing.Point(79, 87); this.CB_P1.Name = "CB_P1"; this.CB_P1.Size = new System.Drawing.Size(121, 21); this.CB_P1.TabIndex = 10; // + // B_EveryLevel + // + this.B_EveryLevel.Location = new System.Drawing.Point(222, 37); + this.B_EveryLevel.Name = "B_EveryLevel"; + this.B_EveryLevel.Size = new System.Drawing.Size(165, 23); + this.B_EveryLevel.TabIndex = 117; + this.B_EveryLevel.Text = "Random Evolution Every Level"; + this.B_EveryLevel.UseVisualStyleBackColor = true; + this.B_EveryLevel.Click += new System.EventHandler(this.B_EveryLevel_Click); + // + // CHK_E + // + this.CHK_E.AutoSize = true; + this.CHK_E.Location = new System.Drawing.Point(6, 83); + this.CHK_E.Name = "CHK_E"; + this.CHK_E.Size = new System.Drawing.Size(98, 17); + this.CHK_E.TabIndex = 478; + this.CHK_E.Text = "Event Legends"; + this.CHK_E.UseVisualStyleBackColor = true; + // + // CHK_L + // + this.CHK_L.AutoSize = true; + this.CHK_L.Location = new System.Drawing.Point(6, 68); + this.CHK_L.Name = "CHK_L"; + this.CHK_L.Size = new System.Drawing.Size(98, 17); + this.CHK_L.TabIndex = 477; + this.CHK_L.Text = "Game Legends"; + this.CHK_L.UseVisualStyleBackColor = true; + // // EvolutionEditor6 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(394, 561); + this.ClientSize = new System.Drawing.Size(394, 611); + this.Controls.Add(this.B_EveryLevel); this.Controls.Add(this.B_Trade); this.Controls.Add(this.GB_Randomizer); this.Controls.Add(this.PB_8); @@ -650,8 +686,8 @@ private void InitializeComponent() this.Controls.Add(this.L_Species); this.Controls.Add(this.CB_Species); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(410, 600); - this.MinimumSize = new System.Drawing.Size(410, 515); + this.MaximumSize = new System.Drawing.Size(410, 650); + this.MinimumSize = new System.Drawing.Size(410, 650); this.Name = "EvolutionEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Evolution Editor"; @@ -723,5 +759,8 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_P3; private System.Windows.Forms.ComboBox CB_P2; private System.Windows.Forms.ComboBox CB_P1; + private System.Windows.Forms.Button B_EveryLevel; + private System.Windows.Forms.CheckBox CHK_E; + private System.Windows.Forms.CheckBox CHK_L; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs index 770698fe2d..e31056477f 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs @@ -137,6 +137,8 @@ private void B_RandAll_Click(object sender, EventArgs e) evoRand.Randomizer.rBST = CHK_BST.Checked; evoRand.Randomizer.rEXP = CHK_Exp.Checked; evoRand.Randomizer.rType = CHK_Type.Checked; + evoRand.Randomizer.L = CHK_L.Checked; + evoRand.Randomizer.E = CHK_E.Checked; evoRand.Randomizer.Initialize(); evoRand.Execute(); evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); @@ -161,6 +163,27 @@ private void B_Trade_Click(object sender, EventArgs e) WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); } + private void B_EveryLevel_Click(object sender, EventArgs e) + { + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify evolutions?", "This will make it to where your Pokémon will evolve into something random every time it levels up.")) + return; + + setList(); + var evos = files.Select(z => new EvolutionSet6(z)).ToArray(); + var evoRand = new EvolutionRandomizer(Main.Config, evos); + evoRand.Randomizer.rBST = CHK_BST.Checked; + evoRand.Randomizer.rEXP = CHK_Exp.Checked; + evoRand.Randomizer.rType = CHK_Type.Checked; + evoRand.Randomizer.L = CHK_L.Checked; + evoRand.Randomizer.E = CHK_E.Checked; + evoRand.Randomizer.Initialize(); + evoRand.ExecuteEvolveEveryLevel(); + evoRand.Execute(); // randomize right after + evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); + getList(); + SystemSounds.Asterisk.Play(); + } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Evolutions to Text File?")) diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs index 774af2d694..c2d3e073cb 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs @@ -94,6 +94,9 @@ private void InitializeComponent() this.label7 = new System.Windows.Forms.Label(); this.CB_M8 = new System.Windows.Forms.ComboBox(); this.B_Trade = new System.Windows.Forms.Button(); + this.B_EveryLevel = new System.Windows.Forms.Button(); + this.CHK_E = new System.Windows.Forms.CheckBox(); + this.CHK_L = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_1)).BeginInit(); this.GB_Randomizer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_F1)).BeginInit(); @@ -203,7 +206,7 @@ private void InitializeComponent() // // B_RandAll // - this.B_RandAll.Location = new System.Drawing.Point(511, 322); + this.B_RandAll.Location = new System.Drawing.Point(511, 324); this.B_RandAll.Name = "B_RandAll"; this.B_RandAll.Size = new System.Drawing.Size(100, 23); this.B_RandAll.TabIndex = 62; @@ -213,13 +216,15 @@ private void InitializeComponent() // // GB_Randomizer // + this.GB_Randomizer.Controls.Add(this.CHK_E); + this.GB_Randomizer.Controls.Add(this.CHK_L); this.GB_Randomizer.Controls.Add(this.L_Protip); this.GB_Randomizer.Controls.Add(this.CHK_BST); this.GB_Randomizer.Controls.Add(this.CHK_Type); this.GB_Randomizer.Controls.Add(this.CHK_Exp); this.GB_Randomizer.Location = new System.Drawing.Point(16, 292); this.GB_Randomizer.Name = "GB_Randomizer"; - this.GB_Randomizer.Size = new System.Drawing.Size(357, 76); + this.GB_Randomizer.Size = new System.Drawing.Size(357, 104); this.GB_Randomizer.TabIndex = 63; this.GB_Randomizer.TabStop = false; this.GB_Randomizer.Text = "Randomizer Options"; @@ -902,7 +907,7 @@ private void InitializeComponent() // // B_Trade // - this.B_Trade.Location = new System.Drawing.Point(468, 345); + this.B_Trade.Location = new System.Drawing.Point(468, 347); this.B_Trade.Name = "B_Trade"; this.B_Trade.Size = new System.Drawing.Size(143, 23); this.B_Trade.TabIndex = 115; @@ -910,11 +915,42 @@ private void InitializeComponent() this.B_Trade.UseVisualStyleBackColor = true; this.B_Trade.Click += new System.EventHandler(this.B_Trade_Click); // + // B_EveryLevel + // + this.B_EveryLevel.Location = new System.Drawing.Point(446, 370); + this.B_EveryLevel.Name = "B_EveryLevel"; + this.B_EveryLevel.Size = new System.Drawing.Size(165, 23); + this.B_EveryLevel.TabIndex = 118; + this.B_EveryLevel.Text = "Random Evolution Every Level"; + this.B_EveryLevel.UseVisualStyleBackColor = true; + this.B_EveryLevel.Click += new System.EventHandler(this.B_EveryLevel_Click); + // + // CHK_E + // + this.CHK_E.AutoSize = true; + this.CHK_E.Location = new System.Drawing.Point(6, 83); + this.CHK_E.Name = "CHK_E"; + this.CHK_E.Size = new System.Drawing.Size(98, 17); + this.CHK_E.TabIndex = 480; + this.CHK_E.Text = "Event Legends"; + this.CHK_E.UseVisualStyleBackColor = true; + // + // CHK_L + // + this.CHK_L.AutoSize = true; + this.CHK_L.Location = new System.Drawing.Point(6, 68); + this.CHK_L.Name = "CHK_L"; + this.CHK_L.Size = new System.Drawing.Size(98, 17); + this.CHK_L.TabIndex = 479; + this.CHK_L.Text = "Game Legends"; + this.CHK_L.UseVisualStyleBackColor = true; + // // EvolutionEditor7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(624, 376); + this.ClientSize = new System.Drawing.Size(624, 406); + this.Controls.Add(this.B_EveryLevel); this.Controls.Add(this.B_Trade); this.Controls.Add(this.NUD_L8); this.Controls.Add(this.NUD_F8); @@ -978,8 +1014,8 @@ private void InitializeComponent() this.Controls.Add(this.L_Species); this.Controls.Add(this.CB_Species); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(640, 415); - this.MinimumSize = new System.Drawing.Size(640, 415); + this.MaximumSize = new System.Drawing.Size(640, 445); + this.MinimumSize = new System.Drawing.Size(640, 445); this.Name = "EvolutionEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Evolution Editor"; @@ -1083,5 +1119,8 @@ private void InitializeComponent() private System.Windows.Forms.Label label7; private System.Windows.Forms.ComboBox CB_M8; private System.Windows.Forms.Button B_Trade; + private System.Windows.Forms.Button B_EveryLevel; + private System.Windows.Forms.CheckBox CHK_E; + private System.Windows.Forms.CheckBox CHK_L; } } \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs index 9e75274fe0..0002a07786 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs @@ -166,6 +166,8 @@ private void B_RandAll_Click(object sender, EventArgs e) evoRand.Randomizer.rBST = CHK_BST.Checked; evoRand.Randomizer.rEXP = CHK_Exp.Checked; evoRand.Randomizer.rType = CHK_Type.Checked; + evoRand.Randomizer.L = CHK_L.Checked; + evoRand.Randomizer.E = CHK_E.Checked; evoRand.Randomizer.Initialize(); evoRand.Execute(); evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); @@ -190,6 +192,27 @@ private void B_Trade_Click(object sender, EventArgs e) WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); } + private void B_EveryLevel_Click(object sender, EventArgs e) + { + if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify evolutions?", "This will make it to where your Pokémon will evolve into something random every time it levels up.")) + return; + + setList(); + var evos = files.Select(z => new EvolutionSet7(z)).ToArray(); + var evoRand = new EvolutionRandomizer(Main.Config, evos); + evoRand.Randomizer.rBST = CHK_BST.Checked; + evoRand.Randomizer.rEXP = CHK_Exp.Checked; + evoRand.Randomizer.rType = CHK_Type.Checked; + evoRand.Randomizer.L = CHK_L.Checked; + evoRand.Randomizer.E = CHK_E.Checked; + evoRand.Randomizer.Initialize(); + evoRand.ExecuteEvolveEveryLevel(); + evoRand.Execute(); // randomize right after + evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); + getList(); + SystemSounds.Asterisk.Play(); + } + private void B_Dump_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Evolutions to Text File?")) From f11e91b55cb1dbd0670d16a90744f26de81b9e23 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 9 Oct 2020 21:50:36 -0700 Subject: [PATCH 159/191] Update dumper to only dump SOS slots if base wild can SOS --- pk3DS/Subforms/Gen7/SMWE.cs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/pk3DS/Subforms/Gen7/SMWE.cs b/pk3DS/Subforms/Gen7/SMWE.cs index 95dd67d46d..e9da1f325a 100644 --- a/pk3DS/Subforms/Gen7/SMWE.cs +++ b/pk3DS/Subforms/Gen7/SMWE.cs @@ -524,6 +524,7 @@ from e in s private byte[][] DumpSOS() { + var personal = Main.Config.Personal; var dict = new Dictionary>(); foreach (var area in Areas) { @@ -534,9 +535,25 @@ private byte[][] DumpSOS() dict.Add(loc, new List()); var table = dict[loc]; - table.AddRange(from t in area.Tables from s in t.Encounter7s.Skip(1) - from e in s - select e.RawValue | (uint) (t.MinLevel << 16) | (uint) (t.MaxLevel << 24)); + + foreach (var t in area.Tables) + { + var first = t.Encounter7s[0]; + for (int i = 0; i < first.Length; i++) + { + // Only add the column SOS slots if the wild slot can SOS for help. + var wild = first[i]; + if (personal[(int)wild.Species].EscapeRate == 0) + continue; + + for (int j = 1; j < t.Encounter7s.Length - 1; j++) + { + var e = t.Encounter7s[j][i]; + var val = e.RawValue | (uint) (t.MinLevel << 16) | (uint) (t.MaxLevel << 24); + table.Add(val); + } + } + } table.AddRange(from t in area.Tables from e in t.AdditionalSOS From b6bea36facaa79c0e6f4c8bbf776ffd4039be25e Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 10 Oct 2020 17:48:18 -0700 Subject: [PATCH 160/191] Extract g7 wild dump to pk3ds.core --- .../Structures/Gen7}/Area7.cs | 3 +- .../Structures/Gen7}/Encounter7.cs | 4 +- .../Structures/Gen7}/EncounterTable.cs | 2 +- pk3DS.Core/Structures/Gen7/Gen7SlotDumper.cs | 105 ++++++++++++++++++ pk3DS/Subforms/Gen7/SMWE.cs | 84 +------------- pk3DS/pk3DS.csproj | 3 - 6 files changed, 112 insertions(+), 89 deletions(-) rename {pk3DS/Subforms/Gen7/Wild => pk3DS.Core/Structures/Gen7}/Area7.cs (99%) rename {pk3DS/Subforms/Gen7/Wild => pk3DS.Core/Structures/Gen7}/Encounter7.cs (81%) rename {pk3DS/Subforms/Gen7/Wild => pk3DS.Core/Structures/Gen7}/EncounterTable.cs (99%) create mode 100644 pk3DS.Core/Structures/Gen7/Gen7SlotDumper.cs diff --git a/pk3DS/Subforms/Gen7/Wild/Area7.cs b/pk3DS.Core/Structures/Gen7/Area7.cs similarity index 99% rename from pk3DS/Subforms/Gen7/Wild/Area7.cs rename to pk3DS.Core/Structures/Gen7/Area7.cs index 3700189d60..6a8f11add6 100644 --- a/pk3DS/Subforms/Gen7/Wild/Area7.cs +++ b/pk3DS.Core/Structures/Gen7/Area7.cs @@ -1,11 +1,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using pk3DS.Core; using pk3DS.Core.CTR; using pk3DS.Core.Structures; -namespace pk3DS +namespace pk3DS.Core { public class Area7 { diff --git a/pk3DS/Subforms/Gen7/Wild/Encounter7.cs b/pk3DS.Core/Structures/Gen7/Encounter7.cs similarity index 81% rename from pk3DS/Subforms/Gen7/Wild/Encounter7.cs rename to pk3DS.Core/Structures/Gen7/Encounter7.cs index aee75b0ed8..f091907fe9 100644 --- a/pk3DS/Subforms/Gen7/Wild/Encounter7.cs +++ b/pk3DS.Core/Structures/Gen7/Encounter7.cs @@ -1,6 +1,6 @@ using System.Text; -namespace pk3DS +namespace pk3DS.Core { public class Encounter7 { @@ -22,5 +22,7 @@ public string GetSummary(string[] speciesList) sb.Append($" (Forme {Forme})"); return sb.ToString(); } + + public uint Dump(EncounterTable t) => RawValue | (uint)(t.MinLevel << 16) | (uint)(t.MaxLevel << 24); } } diff --git a/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs b/pk3DS.Core/Structures/Gen7/EncounterTable.cs similarity index 99% rename from pk3DS/Subforms/Gen7/Wild/EncounterTable.cs rename to pk3DS.Core/Structures/Gen7/EncounterTable.cs index 350bfdb12a..62af900f77 100644 --- a/pk3DS/Subforms/Gen7/Wild/EncounterTable.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterTable.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; -namespace pk3DS +namespace pk3DS.Core { public class EncounterTable { diff --git a/pk3DS.Core/Structures/Gen7/Gen7SlotDumper.cs b/pk3DS.Core/Structures/Gen7/Gen7SlotDumper.cs new file mode 100644 index 0000000000..c8891587a8 --- /dev/null +++ b/pk3DS.Core/Structures/Gen7/Gen7SlotDumper.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using pk3DS.Core.Structures.PersonalInfo; + +namespace pk3DS.Core +{ + public static class Gen7SlotDumper + { + public static byte[][] GetRegularBinary(Area7[] areas) + { + var dict = DumpAreas(areas); + return GetLocationDump(dict).ToArray(); + } + public static byte[][] GetSOSBinary(Area7[] areas, PersonalTable personal) + { + var dict = DumpAreas(areas, personal); + return GetLocationDump(dict).ToArray(); + } + + private static Dictionary> DumpAreas(Area7[] areas, PersonalTable personal) + { + var dict = new Dictionary>(); + for (var areaIndex = 0; areaIndex < areas.Length; areaIndex++) + { + var area = areas[areaIndex]; + for (var zoneIndex = 0; zoneIndex < area.Zones.Length; zoneIndex++) + { + var z = area.Zones[zoneIndex]; + int loc = z.ParentMap; + if (!dict.ContainsKey(loc)) + dict.Add(loc, new List()); + + var table = dict[loc]; + for (var x = 0; x < area.Tables.Count; x++) + { + var t = area.Tables[x]; + var first = t.Encounter7s[0]; + for (int i = 0; i < first.Length; i++) + { + // Only add the column SOS slots if the wild slot can SOS for help. + var wild = first[i]; + if (personal[(int)wild.Species].EscapeRate == 0) + continue; + + for (int j = 1; j < t.Encounter7s.Length - 1; j++) + table.Add(t.Encounter7s[j][i].Dump(t)); + } + + foreach (var s in t.AdditionalSOS) + table.Add(s.Dump(t)); + } + } + } + + return dict; + } + + private static Dictionary> DumpAreas(Area7[] areas) + { + var dict = new Dictionary>(); + for (var areaIndex = 0; areaIndex < areas.Length; areaIndex++) + { + var area = areas[areaIndex]; + for (var zoneIndex = 0; zoneIndex < area.Zones.Length; zoneIndex++) + { + var z = area.Zones[zoneIndex]; + int loc = z.ParentMap; + if (!dict.ContainsKey(loc)) + dict.Add(loc, new List()); + + var table = dict[loc]; + for (var tableIndex = 0; tableIndex < area.Tables.Count; tableIndex++) + { + var t = area.Tables[tableIndex]; + var first = t.Encounter7s[0]; + for (int i = 0; i < first.Length; i++) + { + // Only add the column SOS slots if the wild slot can SOS for help. + var wild = first[i]; + table.Add(wild.Dump(t)); + } + } + } + } + + return dict; + } + + private static IEnumerable GetLocationDump(Dictionary> dict) + { + foreach (var z in dict.OrderBy(z => z.Key)) + { + using (var ms = new MemoryStream()) + using (var bw = new BinaryWriter(ms)) + { + bw.Write((ushort)z.Key); + foreach (var s in z.Value.Distinct()) + bw.Write(s); + yield return ms.ToArray(); + } + } + } + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/Gen7/SMWE.cs b/pk3DS/Subforms/Gen7/SMWE.cs index e9da1f325a..dd7ce00e8d 100644 --- a/pk3DS/Subforms/Gen7/SMWE.cs +++ b/pk3DS/Subforms/Gen7/SMWE.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.IO; @@ -493,92 +492,13 @@ public static string[] GetGoodLocationList(string[] list) private void ExportEncounters(string gameID, string ident) { - var reg = DumpRegular(); - var sos = DumpSOS(); + var reg = Gen7SlotDumper.GetRegularBinary(Areas); + var sos = Gen7SlotDumper.GetSOSBinary(Areas, Main.Config.Personal); File.WriteAllBytes($"encounter_{gameID}.pkl", Mini.PackMini(reg, ident)); File.WriteAllBytes($"encounter_{gameID}_sos.pkl", Mini.PackMini(sos, ident)); } - private byte[][] DumpRegular() - { - var dict = new Dictionary>(); - foreach (var area in Areas) - { - foreach (var z in area.Zones) - { - int loc = z.ParentMap; - if (!dict.ContainsKey(loc)) - dict.Add(loc, new List()); - - var table = dict[loc]; - table.AddRange(from t in area.Tables - from s in t.Encounter7s.Take(1) - from e in s - select e.RawValue | (uint)(t.MinLevel << 16) | (uint)(t.MaxLevel << 24)); - } - } - - return GetLocationDump(dict).ToArray(); - } - - private byte[][] DumpSOS() - { - var personal = Main.Config.Personal; - var dict = new Dictionary>(); - foreach (var area in Areas) - { - foreach (var z in area.Zones) - { - int loc = z.ParentMap; - if (!dict.ContainsKey(loc)) - dict.Add(loc, new List()); - - var table = dict[loc]; - - foreach (var t in area.Tables) - { - var first = t.Encounter7s[0]; - for (int i = 0; i < first.Length; i++) - { - // Only add the column SOS slots if the wild slot can SOS for help. - var wild = first[i]; - if (personal[(int)wild.Species].EscapeRate == 0) - continue; - - for (int j = 1; j < t.Encounter7s.Length - 1; j++) - { - var e = t.Encounter7s[j][i]; - var val = e.RawValue | (uint) (t.MinLevel << 16) | (uint) (t.MaxLevel << 24); - table.Add(val); - } - } - } - - table.AddRange(from t in area.Tables - from e in t.AdditionalSOS - select e.RawValue | (uint) (t.MinLevel << 16) | (uint) (t.MaxLevel << 24)); - } - } - - return GetLocationDump(dict).ToArray(); - } - - private static IEnumerable GetLocationDump(Dictionary> dict) - { - foreach (var z in dict.OrderBy(z => z.Key)) - { - using (var ms = new MemoryStream()) - using (var bw = new BinaryWriter(ms)) - { - bw.Write((ushort)z.Key); - foreach (var s in z.Value.Distinct()) - bw.Write(s); - yield return ms.ToArray(); - } - } - } - private void SMWE_FormClosing(object sender, FormClosingEventArgs e) { RandSettings.SetFormSettings(this, GB_Tweak.Controls); diff --git a/pk3DS/pk3DS.csproj b/pk3DS/pk3DS.csproj index a9fde95fa4..27ca9019d3 100644 --- a/pk3DS/pk3DS.csproj +++ b/pk3DS/pk3DS.csproj @@ -86,9 +86,6 @@ TutorEditor7.cs - - - From 55c75f354031db842a9e194f71a957f5837c92cd Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 26 Dec 2020 18:32:23 -0800 Subject: [PATCH 161/191] Facelift 2020, no functional change Update to net46 Update to c#9 Handle the majority of compiler messages/warnings --- pk3DS.Core/CTR/AES.cs | 22 +- pk3DS.Core/CTR/ALYT.cs | 28 +- pk3DS.Core/CTR/BLZ.cs | 42 +- pk3DS.Core/CTR/CRO.cs | 68 ++- pk3DS.Core/CTR/CTR.cs | 274 ++++----- pk3DS.Core/CTR/DARC.cs | 104 ++-- pk3DS.Core/CTR/ExeFS.cs | 56 +- pk3DS.Core/CTR/Exheader.cs | 59 +- pk3DS.Core/CTR/FileFormat.cs | 21 +- pk3DS.Core/CTR/GARC.cs | 539 +++++++++--------- pk3DS.Core/CTR/Images/BCLIM.cs | 393 +++++++------ pk3DS.Core/CTR/Images/BFLIM.cs | 11 +- pk3DS.Core/CTR/Images/BXLIM.cs | 2 +- pk3DS.Core/CTR/Images/PixelConverter.cs | 26 +- pk3DS.Core/CTR/Images/XLIMOrientation.cs | 8 + pk3DS.Core/CTR/Images/XLIMOrienter.cs | 20 +- pk3DS.Core/CTR/Images/XLIMUtil.cs | 4 +- pk3DS.Core/CTR/LZSS.cs | 119 +++- pk3DS.Core/CTR/NCCH.cs | 96 ++-- pk3DS.Core/CTR/NCSD.cs | 96 ++-- pk3DS.Core/CTR/RomFS.cs | 244 ++++---- pk3DS.Core/CTR/SARC.cs | 13 +- pk3DS.Core/CTR/SMDH.cs | 33 +- pk3DS.Core/CTR/mini.cs | 90 ++- pk3DS.Core/Game/GARCFile.cs | 16 +- pk3DS.Core/Game/GARCReference.cs | 232 ++++---- pk3DS.Core/Game/GameBackup.cs | 44 +- pk3DS.Core/Game/GameConfig.cs | 70 ++- pk3DS.Core/Game/GameVersion.cs | 9 +- pk3DS.Core/Game/TextReference.cs | 164 +++--- pk3DS.Core/Game/TextVariableCode.cs | 290 +++++----- pk3DS.Core/ImageUtil.cs | 27 +- pk3DS.Core/Legality/Legal.cs | 54 +- pk3DS.Core/Legality/Tables6.cs | 40 +- pk3DS.Core/Legality/Tables7.cs | 8 +- pk3DS.Core/Properties/Resources.Designer.cs | 20 + pk3DS.Core/Properties/Resources.resx | 6 + pk3DS.Core/Randomizers/EggMoveRandomizer.cs | 6 +- pk3DS.Core/Randomizers/EvolutionRandomizer.cs | 11 +- pk3DS.Core/Randomizers/FormRandomizer.cs | 9 +- pk3DS.Core/Randomizers/LearnsetRandomizer.cs | 10 +- pk3DS.Core/Randomizers/MoveInfoRandomizer.cs | 7 +- pk3DS.Core/Randomizers/MoveRandomizer.cs | 26 +- pk3DS.Core/Randomizers/PersonalRandomizer.cs | 37 +- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 4 +- pk3DS.Core/Structures/EggMoves.cs | 66 +-- pk3DS.Core/Structures/Gen6/EncounterGift6.cs | 116 ++-- pk3DS.Core/Structures/Gen6/Evolutions.cs | 36 +- pk3DS.Core/Structures/Gen6/HealValue.cs | 10 - pk3DS.Core/Structures/Gen6/Item6.cs | 8 +- pk3DS.Core/Structures/Gen6/Maison6.cs | 86 +-- pk3DS.Core/Structures/Gen6/MegaEvolution6.cs | 38 +- pk3DS.Core/Structures/Gen6/TrainerData6.cs | 144 +++++ pk3DS.Core/Structures/Gen6/trdata6.cs | 146 ----- pk3DS.Core/Structures/Gen7/Area7.cs | 6 +- pk3DS.Core/Structures/Gen7/Encounter7.cs | 2 +- pk3DS.Core/Structures/Gen7/EncounterGift7.cs | 5 +- .../Structures/Gen7/EncounterStatic7.cs | 9 +- pk3DS.Core/Structures/Gen7/EncounterTable.cs | 4 +- pk3DS.Core/Structures/Gen7/EncounterTrade7.cs | 42 +- pk3DS.Core/Structures/Gen7/Maison7.cs | 44 +- .../Gen7/{trdata7.cs => TrainerData7.cs} | 18 +- .../Gen7/{trpoke7.cs => TrainerPoke7.cs} | 10 +- pk3DS.Core/Structures/Learnset.cs | 28 +- pk3DS.Core/Structures/Moves/Heal.cs | 4 +- pk3DS.Core/Structures/Moves/Move7.cs | 1 - .../Structures/PersonalInfo/PersonalInfo.cs | 22 +- .../PersonalInfo/PersonalInfoORAS.cs | 24 +- .../Structures/PersonalInfo/PersonalInfoSM.cs | 22 +- .../Structures/PersonalInfo/PersonalInfoXY.cs | 8 +- .../Structures/PersonalInfo/PersonalTable.cs | 42 +- pk3DS.Core/Structures/Script.cs | 8 +- pk3DS.Core/Structures/Scripts.cs | 126 ++-- pk3DS.Core/Structures/TypeChart.cs | 18 +- pk3DS.Core/TextFile.cs | 133 +++-- pk3DS.Core/Util.cs | 62 +- pk3DS.Core/pk3DS.Core.csproj | 11 +- pk3DS/ARCUtil.cs | 94 +-- pk3DS/GarcUtil.cs | 64 ++- pk3DS/Legality/Randomizer.cs | 10 +- pk3DS/Main.Designer.cs | 8 +- pk3DS/Main.cs | 297 +++++----- pk3DS/Misc/ErrorWindow.Designer.cs | 2 +- pk3DS/Misc/ErrorWindow.cs | 27 +- pk3DS/Misc/Patch.Designer.cs | 2 +- pk3DS/Misc/Patch.cs | 32 +- pk3DS/Program.cs | 11 +- pk3DS/Properties/Resources.Designer.cs | 2 +- pk3DS/Properties/Settings.Designer.cs | 2 +- pk3DS/Subforms/EnhancedRestore.cs | 6 +- pk3DS/Subforms/FormUtil.cs | 2 +- .../Subforms/Gen6/EggMoveEditor6.Designer.cs | 4 +- pk3DS/Subforms/Gen6/EggMoveEditor6.cs | 47 +- .../Gen6/EvolutionEditor6.Designer.cs | 36 +- pk3DS/Subforms/Gen6/EvolutionEditor6.cs | 50 +- pk3DS/Subforms/Gen6/Experimental/OWSE.cs | 84 +-- .../Subforms/Gen6/Experimental/OWSEStructs.cs | 299 +++++----- pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs | 4 +- pk3DS/Subforms/Gen6/GiftEditor6.cs | 65 ++- pk3DS/Subforms/Gen6/ItemEditor6.cs | 9 +- .../Subforms/Gen6/LevelUpEditor6.Designer.cs | 4 +- pk3DS/Subforms/Gen6/LevelUpEditor6.cs | 53 +- pk3DS/Subforms/Gen6/MaisonEditor6.Designer.cs | 8 +- pk3DS/Subforms/Gen6/MaisonEditor6.cs | 42 +- pk3DS/Subforms/Gen6/MartEditor6.Designer.cs | 2 +- pk3DS/Subforms/Gen6/MartEditor6.cs | 26 +- .../Subforms/Gen6/MegaEvoEditor6.Designer.cs | 4 +- pk3DS/Subforms/Gen6/MegaEvoEditor6.cs | 63 +- pk3DS/Subforms/Gen6/MoveEditor6.cs | 8 +- pk3DS/Subforms/Gen6/OPower.Designer.cs | 4 +- pk3DS/Subforms/Gen6/OPower.cs | 16 +- .../Subforms/Gen6/PersonalEditor6.Designer.cs | 2 +- pk3DS/Subforms/Gen6/PersonalEditor6.cs | 98 ++-- pk3DS/Subforms/Gen6/PickupEditor6.cs | 24 +- pk3DS/Subforms/Gen6/RSTE.cs | 101 ++-- pk3DS/Subforms/Gen6/RSWE.Designer.cs | 2 +- pk3DS/Subforms/Gen6/RSWE.cs | 249 ++++---- .../Subforms/Gen6/StarterEditor6.Designer.cs | 24 +- pk3DS/Subforms/Gen6/StarterEditor6.cs | 40 +- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 24 +- pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs | 2 +- pk3DS/Subforms/Gen6/TMHMEditor6.cs | 36 +- .../Gen6/TitleScreenEditor6.Designer.cs | 6 +- pk3DS/Subforms/Gen6/TitleScreenEditor6.cs | 99 ++-- pk3DS/Subforms/Gen6/TrainerRand.Designer.cs | 6 +- pk3DS/Subforms/Gen6/TrainerRand.cs | 38 +- pk3DS/Subforms/Gen6/TutorEditor6.Designer.cs | 4 +- pk3DS/Subforms/Gen6/TutorEditor6.cs | 26 +- pk3DS/Subforms/Gen6/TypeChart6.Designer.cs | 4 +- pk3DS/Subforms/Gen6/TypeChart6.cs | 24 +- pk3DS/Subforms/Gen6/XYWE.Designer.cs | 2 +- pk3DS/Subforms/Gen6/XYWE.cs | 191 ++++--- .../Subforms/Gen7/EggMoveEditor7.Designer.cs | 4 +- pk3DS/Subforms/Gen7/EggMoveEditor7.cs | 47 +- .../Gen7/EvolutionEditor7.Designer.cs | 52 +- pk3DS/Subforms/Gen7/EvolutionEditor7.cs | 54 +- pk3DS/Subforms/Gen7/Experimental/OWSE7.cs | 47 +- pk3DS/Subforms/Gen7/ItemEditor7.Designer.cs | 4 +- pk3DS/Subforms/Gen7/ItemEditor7.cs | 23 +- .../Subforms/Gen7/LevelUpEditor7.Designer.cs | 4 +- pk3DS/Subforms/Gen7/LevelUpEditor7.cs | 45 +- pk3DS/Subforms/Gen7/MaisonEditor7.Designer.cs | 10 +- pk3DS/Subforms/Gen7/MaisonEditor7.cs | 42 +- pk3DS/Subforms/Gen7/MartEditor7.Designer.cs | 4 +- pk3DS/Subforms/Gen7/MartEditor7.cs | 54 +- pk3DS/Subforms/Gen7/MartEditor7UU.Designer.cs | 4 +- pk3DS/Subforms/Gen7/MartEditor7UU.cs | 55 +- .../Subforms/Gen7/MegaEvoEditor7.Designer.cs | 4 +- pk3DS/Subforms/Gen7/MegaEvoEditor7.cs | 65 ++- pk3DS/Subforms/Gen7/MoveEditor7.cs | 8 +- .../Subforms/Gen7/PersonalEditor7.Designer.cs | 2 +- pk3DS/Subforms/Gen7/PersonalEditor7.cs | 88 +-- pk3DS/Subforms/Gen7/PickupEditor7.cs | 51 +- pk3DS/Subforms/Gen7/SMTE.cs | 109 ++-- pk3DS/Subforms/Gen7/SMWE.cs | 43 +- pk3DS/Subforms/Gen7/StaticEncounterEditor7.cs | 115 ++-- pk3DS/Subforms/Gen7/TMEditor7.Designer.cs | 2 +- pk3DS/Subforms/Gen7/TMEditor7.cs | 38 +- pk3DS/Subforms/Gen7/TutorEditor7.Designer.cs | 2 +- pk3DS/Subforms/Gen7/TutorEditor7.cs | 34 +- pk3DS/Subforms/Gen7/TypeChart7.Designer.cs | 4 +- pk3DS/Subforms/Gen7/TypeChart7.cs | 20 +- pk3DS/Subforms/Gen7/Wild/Wild7Randomizer.cs | 6 +- pk3DS/Subforms/ShinyRate.Designer.cs | 4 +- pk3DS/Subforms/ShinyRate.cs | 21 +- pk3DS/Subforms/TextEditor.Designer.cs | 2 +- pk3DS/Subforms/TextEditor.cs | 116 ++-- pk3DS/Tools/Icon.cs | 84 ++- pk3DS/Tools/RandSettings.cs | 6 +- pk3DS/Tools/Scripts.cs | 142 +++-- pk3DS/Tools/Shuffler.Designer.cs | 6 +- pk3DS/Tools/Shuffler.cs | 40 +- pk3DS/Tools/ToolsUI.cs | 47 +- pk3DS/WinFormsUtil.cs | 169 ++---- pk3DS/app.config | 10 +- pk3DS/pk3DS.csproj | 15 +- 176 files changed, 4427 insertions(+), 4421 deletions(-) delete mode 100644 pk3DS.Core/Structures/Gen6/HealValue.cs create mode 100644 pk3DS.Core/Structures/Gen6/TrainerData6.cs delete mode 100644 pk3DS.Core/Structures/Gen6/trdata6.cs rename pk3DS.Core/Structures/Gen7/{trdata7.cs => TrainerData7.cs} (80%) rename pk3DS.Core/Structures/Gen7/{trpoke7.cs => TrainerPoke7.cs} (95%) diff --git a/pk3DS.Core/CTR/AES.cs b/pk3DS.Core/CTR/AES.cs index 878368f659..30a89c6c1b 100644 --- a/pk3DS.Core/CTR/AES.cs +++ b/pk3DS.Core/CTR/AES.cs @@ -6,7 +6,7 @@ namespace pk3DS.Core.CTR { public class AesCtr { - private readonly AesManaged Aes = new AesManaged(); + private readonly AesManaged Aes = new(); private readonly ICryptoTransform Encryptor; private readonly AesCounter Counter; @@ -80,19 +80,17 @@ public byte[] ManageBufferCounters(int size) return Buffer; } - public ulong SwapBytes(ulong value) + public static ulong SwapBytes(ulong value) { ulong uvalue = value; - ulong swapped = - (0x00000000000000FF & (uvalue >> 56)) - | (0x000000000000FF00 & (uvalue >> 40)) - | (0x0000000000FF0000 & (uvalue >> 24)) - | (0x00000000FF000000 & (uvalue >> 8)) - | (0x000000FF00000000 & (uvalue << 8)) - | (0x0000FF0000000000 & (uvalue << 24)) - | (0x00FF000000000000 & (uvalue << 40)) - | (0xFF00000000000000 & (uvalue << 56)); - return swapped; + return (0x00000000000000FF & (uvalue >> 56)) + | (0x000000000000FF00 & (uvalue >> 40)) + | (0x0000000000FF0000 & (uvalue >> 24)) + | (0x00000000FF000000 & (uvalue >> 8)) + | (0x000000FF00000000 & (uvalue << 8)) + | (0x0000FF0000000000 & (uvalue << 24)) + | (0x00FF000000000000 & (uvalue << 40)) + | (0xFF00000000000000 & (uvalue << 56)); } } } diff --git a/pk3DS.Core/CTR/ALYT.cs b/pk3DS.Core/CTR/ALYT.cs index f41281c7e7..f46f989b84 100644 --- a/pk3DS.Core/CTR/ALYT.cs +++ b/pk3DS.Core/CTR/ALYT.cs @@ -41,21 +41,21 @@ public ALYT(string path) FilePath = Path.GetDirectoryName(path); Extension = Path.GetExtension(path); - using (var br = new BinaryReader(File.OpenRead(path))) - ReadALYT(br); + using var br = new BinaryReader(File.OpenRead(path)); + ReadALYT(br); } public ALYT(byte[] data) { - using (var ms = new MemoryStream(data)) - using (var br = new BinaryReader(ms)) - ReadALYT(br); + using var ms = new MemoryStream(data); + using var br = new BinaryReader(ms); + ReadALYT(br); } public ALYT(Stream ms) { - using (var br = new BinaryReader(ms)) - ReadALYT(br); + using var br = new BinaryReader(ms); + ReadALYT(br); } private void ReadALYT(BinaryReader br) @@ -132,8 +132,8 @@ public static string ReadString(BinaryReader br, int skip) /// public static byte[] GetData(string path) { - using (var br = new BinaryReader(File.OpenRead(path))) - return GetData(br); + using var br = new BinaryReader(File.OpenRead(path)); + return GetData(br); } /// @@ -141,9 +141,9 @@ public static byte[] GetData(string path) /// public static byte[] GetData(byte[] data) { - using (var ms = new MemoryStream(data)) - using (var br = new BinaryReader(ms)) - return GetData(br); + using var ms = new MemoryStream(data); + using var br = new BinaryReader(ms); + return GetData(br); } /// @@ -151,8 +151,8 @@ public static byte[] GetData(byte[] data) /// public static byte[] GetData(Stream ms) { - using (var br = new BinaryReader(ms)) - return GetData(br); + using var br = new BinaryReader(ms); + return GetData(br); } private static byte[] GetData(BinaryReader br) diff --git a/pk3DS.Core/CTR/BLZ.cs b/pk3DS.Core/CTR/BLZ.cs index 52755f7dea..177d12ce37 100644 --- a/pk3DS.Core/CTR/BLZ.cs +++ b/pk3DS.Core/CTR/BLZ.cs @@ -43,20 +43,24 @@ public class BLZCoder private readonly bool arm9; private int new_len; - + private readonly ProgressBar pBar1; - private void initpBar(int max) + private void InitProgress(int max) { if (pBar1.InvokeRequired) + { pBar1.Invoke((MethodInvoker)delegate { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = max; }); + } else { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = max; } } - private void setpBarPos(int pos) + private void SetProgressPosition(int pos) { if (pBar1.InvokeRequired) + { pBar1.Invoke((MethodInvoker)delegate { pBar1.Value = pos; }); + } else { pBar1.Value = pos; } } @@ -72,7 +76,9 @@ public BLZCoder(string[] args, ProgressBar pBar = null) throw new Exception("No arguments supplied to BLZ"); if (args[0].Equals("-d")) + { cmd = CMD_DECODE; + } else if (args[0].Equals("-en") || args[0].Equals("-en9")) { cmd = CMD_ENCODE; @@ -86,7 +92,9 @@ public BLZCoder(string[] args, ProgressBar pBar = null) else { Console.Write("Command not supported" + Environment.NewLine); return; } if (args.Length < 2) + { Console.Write("Filename not specified" + Environment.NewLine); + } else { int arg; @@ -140,18 +148,18 @@ private static void BLZ_Decode(string filename) private static BLZResult BLZ_Decode(byte[] data) { - int raw_len, len; - int enc_len, dec_len; + int raw_len; + int len; + int dec_len; int flags = 0; - byte[] pak_buffer = prepareData(data); + byte[] pak_buffer = PrepareData(data); int pak_len = pak_buffer.Length - 3; int inc_len = BitConverter.ToInt32(pak_buffer, pak_len - 4); if (inc_len < 1) { Console.Write(", WARNING: not coded file!"); - enc_len = 0; dec_len = pak_len; pak_len = 0; raw_len = dec_len; @@ -174,7 +182,7 @@ private static BLZResult BLZ_Decode(byte[] data) Console.Write(Environment.NewLine + "Bad length" + Environment.NewLine); return null; } - enc_len = (int)(BitConverter.ToUInt32(pak_buffer, pak_len - 8) & 0x00FFFFFF); + var enc_len = (int)(BitConverter.ToUInt32(pak_buffer, pak_len - 8) & 0x00FFFFFF); dec_len = pak_len - enc_len; pak_len = enc_len - hdr_len; raw_len = dec_len + enc_len + inc_len; @@ -253,7 +261,7 @@ private BLZResult BLZ_Encode(byte[] data, int mode) { new_len = 0; - byte[] raw_buffer = prepareData(data); + byte[] raw_buffer = PrepareData(data); int raw_len = raw_buffer.Length - 3; byte[] pak_buffer = null; @@ -269,7 +277,7 @@ private BLZResult BLZ_Encode(byte[] data, int mode) return new BLZResult(pak_buffer, pak_len); } - private static byte[] prepareData(byte[] data) + private static byte[] PrepareData(byte[] data) { int fs = data.Length; byte[] fb = new byte[fs + 3]; @@ -279,7 +287,7 @@ private static byte[] prepareData(byte[] data) return fb; } - private static void writeUnsigned(byte[] buffer, int offset, int value) + private static void WriteUnsigned(byte[] buffer, int offset, int value) { buffer[offset] = (byte)(value & 0xFF); buffer[offset + 1] = (byte)((value >> 8) & 0xFF); @@ -334,10 +342,10 @@ private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best) int raw_end = raw_new; int mask = 0; - initpBar(raw_end); + InitProgress(raw_end); while (raw < raw_end) { - setpBarPos(raw); + SetProgressPosition(raw); if ((mask = (int)((uint)mask >> BLZ_SHIFT)) == 0) { pak_buffer[flg = pak++] = 0; @@ -386,7 +394,9 @@ private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best) pak_buffer[pak++] = (byte)(pos_best - 3); } else + { pak_buffer[pak++] = raw_buffer[raw++]; + } if (pak + raw_len - raw >= pak_tmp + raw_tmp) continue; @@ -433,7 +443,7 @@ private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best) for (len = 0; len < pak_tmp; len++) tmp[raw_tmp + len] = pak_buffer[len + pak_len - pak_tmp]; - + pak_buffer = tmp; pak = raw_tmp + pak_tmp; @@ -447,10 +457,10 @@ private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best) hdr_len++; } - writeUnsigned(pak_buffer, pak, enc_len + hdr_len); + WriteUnsigned(pak_buffer, pak, enc_len + hdr_len); pak += 3; pak_buffer[pak++] = (byte)hdr_len; - writeUnsigned(pak_buffer, pak, inc_len - hdr_len); + WriteUnsigned(pak_buffer, pak, inc_len - hdr_len); pak += 4; } new_len = pak; diff --git a/pk3DS.Core/CTR/CRO.cs b/pk3DS.Core/CTR/CRO.cs index ddebd84d4c..e36f067351 100644 --- a/pk3DS.Core/CTR/CRO.cs +++ b/pk3DS.Core/CTR/CRO.cs @@ -10,17 +10,19 @@ namespace pk3DS.Core.CTR public class CRO { // Utility - internal static void updateTB(RichTextBox RTB, string progress) + internal static void UpdateTB(RichTextBox RTB, string progress) { try { if (RTB.InvokeRequired) + { RTB.Invoke((MethodInvoker)delegate - { - RTB.AppendText(Environment.NewLine + progress); - RTB.SelectionStart = RTB.Text.Length; - RTB.ScrollToCaret(); - }); + { + RTB.AppendText(Environment.NewLine + progress); + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + }); + } else { RTB.SelectionStart = RTB.Text.Length; @@ -47,7 +49,7 @@ internal static int IndexOfBytes(byte[] array, byte[] pattern, int startIndex, i return -1; } - internal static string getHexString(byte[] data) + internal static string GetHexString(byte[] data) { return BitConverter.ToString(data).Replace("-", ""); } @@ -61,7 +63,7 @@ internal static byte[] StringToByteArray(string hex) } // Checking - internal static string[] verifyCRR(string PATH_CRR, string PATH_CRO) + internal static string[] VerifyCRR(string PATH_CRR, string PATH_CRO) { // Get CRO files string[] CROFiles = Directory.GetFiles(PATH_CRO); @@ -69,8 +71,11 @@ internal static string[] verifyCRR(string PATH_CRR, string PATH_CRO) // Weed out anything that isn't a .cro List cros = new List(); for (int i = 0; i < CROFiles.Length; i++) + { if (Path.GetExtension(cros[i]) == ".cro") cros.Add(cros[i]); + } + CROFiles = cros.ToArray(); // Store Hashes as Strings (hacky way to sort byte[]'s against eachother @@ -78,8 +83,8 @@ internal static string[] verifyCRR(string PATH_CRR, string PATH_CRO) for (int i = 0; i < hashes.Length; i++) { byte[] data = File.ReadAllBytes(CROFiles[i]); - byte[] hash = hashCRO(ref data); - hashes[i] = getHexString(hash).ToUpper(); + byte[] hash = HashCRO(ref data); + hashes[i] = GetHexString(hash).ToUpper(); } Array.Sort(hashes, string.Compare); // Convert Hash Strings to Bytes @@ -94,8 +99,7 @@ internal static string[] verifyCRR(string PATH_CRR, string PATH_CRO) // A little validation... if (hashCount != hashData.Length) - throw new Exception( - $"Amount of input file-hashes does not equal the hash count in CRR. Expected {hashCount}, got {hashData.Length}."); + throw new Exception($"Amount of input file-hashes does not equal the hash count in CRR. Expected {hashCount}, got {hashData.Length}."); string[] results = new string[hashData.Length]; // Store Hashes in CRR @@ -109,7 +113,7 @@ internal static string[] verifyCRR(string PATH_CRR, string PATH_CRO) return results; } - public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = true, bool saveCRR = true, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) + public static bool E_HashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = true, bool saveCRR = true, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { // Get CRO files string[] CROFiles = Directory.GetFiles(PATH_CRO); @@ -124,36 +128,40 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr // A little validation... if (hashCount != CROFiles.Length) { - updateTB(TB_Progress, + UpdateTB(TB_Progress, $"Amount of input file-hashes does not equal the hash count in CRR. Expected {hashCount}, got {CROFiles.Length}."); - updateTB(TB_Progress, "Did not modify files. Aborting."); + UpdateTB(TB_Progress, "Did not modify files. Aborting."); return false; } // Initialize Update Display - if (TB_Progress == null) TB_Progress = new RichTextBox(); - if (PB_Show == null) PB_Show = new ProgressBar(); + TB_Progress ??= new RichTextBox(); + PB_Show ??= new ProgressBar(); if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = CROFiles.Length; }); + } else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = CROFiles.Length; } - updateTB(TB_Progress, ""); - updateTB(TB_Progress, "Computing hashes for " + CROFiles.Length + " CRO files."); + UpdateTB(TB_Progress, ""); + UpdateTB(TB_Progress, "Computing hashes for " + CROFiles.Length + " CRO files."); // Store Hashes as Strings (hacky way to sort byte[]'s against eachother string[] hashes = new string[CROFiles.Length]; for (int i = 0; i < hashes.Length; i++) { byte[] data = File.ReadAllBytes(CROFiles[i]); - byte[] hash = hashCRO(ref data); - hashes[i] = getHexString(hash).ToUpper(); + byte[] hash = HashCRO(ref data); + hashes[i] = GetHexString(hash).ToUpper(); if (saveCRO) File.WriteAllBytes(CROFiles[i], data); if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)(() => PB_Show.PerformStep())); + } else { PB_Show.PerformStep(); } } - updateTB(TB_Progress, "Hashes computed, now sorting."); // Don't need to fiddle the ProgressBar because this should be quite quick. + UpdateTB(TB_Progress, "Hashes computed, now sorting."); // Don't need to fiddle the ProgressBar because this should be quite quick. string[] hashCopy = (string[])hashes.Clone(); // Store an unsorted list for later. Array.Sort(hashes, string.Compare); // Convert Hash Strings to Bytes @@ -161,7 +169,7 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr for (int i = 0; i < hashes.Length; i++) hashData[i] = StringToByteArray(hashes[i]); - updateTB(TB_Progress, "Hashes sorted, writing hashes to CRR."); + UpdateTB(TB_Progress, "Hashes sorted, writing hashes to CRR."); // Loop to check which CROs have to be updated. Do this separate from overwriting so we don't overwrite hashes for other CROs (yet). int updatedCTR = 0; @@ -173,7 +181,7 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr { // CRO was updated. string file = CROFiles[Array.IndexOf(hashCopy, hashes[i])]; - updateTB(TB_Progress, $"{Path.GetFileName(file)} hash has been updated."); + UpdateTB(TB_Progress, $"{Path.GetFileName(file)} hash has been updated."); updatedCTR++; } } @@ -181,7 +189,7 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr for (int i = 0; i < hashData.Length; i++) Array.Copy(hashData[i], 0, CRR, hashTableOffset + (0x20 * i), 0x20); - updateTB(TB_Progress, + UpdateTB(TB_Progress, updatedCTR > 0 ? $"{updatedCTR} hashes have been updated." : "CRR is fine. No modifications are necessary."); @@ -190,16 +198,16 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr if (saveCRR && updatedCTR > 0) { File.WriteAllBytes(PATH_CRR, CRR); - updateTB(TB_Progress, "Wrote CRR."); + UpdateTB(TB_Progress, "Wrote CRR."); } else { - updateTB(TB_Progress, "CRR has not been updated."); + UpdateTB(TB_Progress, "CRR has not been updated."); } return true; } - internal static byte[] hashCRO(ref byte[] CRO) + internal static byte[] HashCRO(ref byte[] CRO) { // Allocate new byte array to store modified CRO SHA256 mySHA = SHA256.Create(); @@ -227,7 +235,7 @@ public CRO(byte[] data) private readonly byte[] Data; - private byte[] sha2Hash + public byte[] HashSHA2 { get { @@ -243,6 +251,6 @@ private byte[] sha2Hash } } - private string Magic => new string(Data.Skip(0x80).Take(4).Select(c => (char)c).ToArray()); + public string Magic => new(Data.Skip(0x80).Take(4).Select(c => (char)c).ToArray()); } } diff --git a/pk3DS.Core/CTR/CTR.cs b/pk3DS.Core/CTR/CTR.cs index bcfa596752..36224f07a9 100644 --- a/pk3DS.Core/CTR/CTR.cs +++ b/pk3DS.Core/CTR/CTR.cs @@ -9,163 +9,161 @@ namespace pk3DS.Core.CTR { - public class CTRUtil + public static class CTRUtil { internal const uint MEDIA_UNIT_SIZE = 0x200; // Main wrapper that assembles the ROM based on the following specifications: - public static bool buildROM(bool Card2, string LOGO_NAME, + public static bool BuildROM(bool Card2, string LOGO_NAME, string EXEFS_PATH, string ROMFS_PATH, string EXHEADER_PATH, string SERIAL_TEXT, string SAVE_PATH, bool trimmed = false, ProgressBar PB_Show = null, RichTextBox TB_Progress = null) { - PB_Show = PB_Show ?? new ProgressBar(); - TB_Progress = TB_Progress ?? new RichTextBox(); + PB_Show ??= new ProgressBar(); + TB_Progress ??= new RichTextBox(); // Sanity check the input files. if (! ((File.Exists(EXEFS_PATH) || Directory.Exists(EXEFS_PATH)) && (File.Exists(ROMFS_PATH) || Directory.Exists(ROMFS_PATH)) && File.Exists(EXHEADER_PATH))) + { return false; + } // If ExeFS and RomFS are not built, build. if (!File.Exists(EXEFS_PATH) && Directory.Exists(EXEFS_PATH)) - ExeFS.set(Directory.GetFiles(EXEFS_PATH), EXEFS_PATH = "exefs.bin"); + ExeFS.PackExeFS(Directory.GetFiles(EXEFS_PATH), EXEFS_PATH = "exefs.bin"); if (!File.Exists(ROMFS_PATH) && Directory.Exists(ROMFS_PATH)) RomFS.BuildRomFS(ROMFS_PATH, ROMFS_PATH = "romfs.bin", TB_Progress, PB_Show); - NCCH NCCH = setNCCH(EXEFS_PATH, ROMFS_PATH, EXHEADER_PATH, SERIAL_TEXT, LOGO_NAME, PB_Show, TB_Progress); - NCSD NCSD = setNCSD(NCCH, Card2, PB_Show, TB_Progress); - bool success = writeROM(NCSD, SAVE_PATH, trimmed, PB_Show, TB_Progress); + NCCH NCCH = SetNCCH(EXEFS_PATH, ROMFS_PATH, EXHEADER_PATH, SERIAL_TEXT, LOGO_NAME, TB_Progress); + NCSD NCSD = SetNCSD(NCCH, Card2, TB_Progress); + bool success = WriteROM(NCSD, SAVE_PATH, trimmed, PB_Show, TB_Progress); return success; } // Sub methods that drive the operation - internal static NCCH setNCCH(string EXEFS_PATH, string ROMFS_PATH, string EXHEADER_PATH, string TB_Serial, string LOGO_NAME, - ProgressBar PB_Show = null, RichTextBox TB_Progress = null) + internal static NCCH SetNCCH(string EXEFS_PATH, string ROMFS_PATH, string EXHEADER_PATH, string TB_Serial, string LOGO_NAME, RichTextBox TB_Progress = null) { - PB_Show = PB_Show ?? new ProgressBar(); - TB_Progress = TB_Progress ?? new RichTextBox(); + TB_Progress ??= new RichTextBox(); - updateTB(TB_Progress, "Creating NCCH..."); - updateTB(TB_Progress, "Adding Exheader..."); + UpdateTB(TB_Progress, "Creating NCCH..."); + UpdateTB(TB_Progress, "Adding Exheader..."); NCCH NCCH = new NCCH { - exheader = new Exheader(EXHEADER_PATH), - plainregion = new byte[0] + Exheader = new Exheader(EXHEADER_PATH), + plainregion = Array.Empty() }; - if (NCCH.exheader.isPokemon()) + if (NCCH.Exheader.IsSupported()) { - updateTB(TB_Progress, "Detected Pokemon Game. Adding Plain Region..."); - if (NCCH.exheader.isXY()) - NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("XY"); - else if (NCCH.exheader.isORAS()) - NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("ORAS"); - else if (NCCH.exheader.isSuMo()) - NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("SuMo"); - else if (NCCH.exheader.isUSUM()) - NCCH.plainregion = (byte[])Resources.ResourceManager.GetObject("USUM"); + UpdateTB(TB_Progress, "Detected Pokemon Game. Adding Plain Region..."); + if (NCCH.Exheader.IsXY()) + NCCH.plainregion = Resources.XY; + else if (NCCH.Exheader.IsORAS()) + NCCH.plainregion = Resources.ORAS; + else if (NCCH.Exheader.IsSM()) + NCCH.plainregion = Resources.SuMo; + else if (NCCH.Exheader.IsUSUM()) + NCCH.plainregion = Resources.USUM; } - updateTB(TB_Progress, "Adding ExeFS..."); - NCCH.exefs = new ExeFS(EXEFS_PATH); - updateTB(TB_Progress, "Adding RomFS..."); - NCCH.romfs = new RomFS(ROMFS_PATH); + UpdateTB(TB_Progress, "Adding ExeFS..."); + NCCH.ExeFS = new ExeFS(EXEFS_PATH); + UpdateTB(TB_Progress, "Adding RomFS..."); + NCCH.RomFS = new RomFS(ROMFS_PATH); - updateTB(TB_Progress, "Adding Logo..."); + UpdateTB(TB_Progress, "Adding Logo..."); NCCH.logo = (byte[])Resources.ResourceManager.GetObject(LOGO_NAME); - updateTB(TB_Progress, "Assembling NCCH Header..."); + UpdateTB(TB_Progress, "Assembling NCCH Header..."); ulong Len = 0x200; //NCCH Signature + NCCH Header - NCCH.header = new NCCH.Header { Signature = new byte[0x100], Magic = 0x4843434E }; - NCCH.header.TitleId = NCCH.header.ProgramId = NCCH.exheader.TitleID; - NCCH.header.MakerCode = 0x3130; //01 - NCCH.header.FormatVersion = 0x2; //Default - NCCH.header.LogoHash = new SHA256Managed().ComputeHash(NCCH.logo); - NCCH.header.ProductCode = Encoding.ASCII.GetBytes(TB_Serial); - Array.Resize(ref NCCH.header.ProductCode, 0x10); - NCCH.header.ExheaderHash = NCCH.exheader.GetSuperBlockHash(); - NCCH.header.ExheaderSize = (uint)NCCH.exheader.Data.Length; - Len += NCCH.header.ExheaderSize + (uint)NCCH.exheader.AccessDescriptor.Length; - NCCH.header.Flags = new byte[0x8]; + NCCH.Header = new NCCH.NCCHHeader { Signature = new byte[0x100], Magic = 0x4843434E }; + NCCH.Header.TitleId = NCCH.Header.ProgramId = NCCH.Exheader.TitleID; + NCCH.Header.MakerCode = 0x3130; //01 + NCCH.Header.FormatVersion = 0x2; //Default + NCCH.Header.LogoHash = new SHA256Managed().ComputeHash(NCCH.logo); + NCCH.Header.ProductCode = Encoding.ASCII.GetBytes(TB_Serial); + Array.Resize(ref NCCH.Header.ProductCode, 0x10); + NCCH.Header.ExheaderHash = NCCH.Exheader.GetSuperBlockHash(); + NCCH.Header.ExheaderSize = (uint)NCCH.Exheader.Data.Length; + Len += NCCH.Header.ExheaderSize + (uint)NCCH.Exheader.AccessDescriptor.Length; + NCCH.Header.Flags = new byte[0x8]; //FLAGS - NCCH.header.Flags[3] = 0; // Crypto: 0 = <7.x, 1=7.x; - NCCH.header.Flags[4] = 1; // Content Platform: 1 = CTR; - NCCH.header.Flags[5] = 0x3; // Content Type Bitflags: 1=Data, 2=Executable, 4=SysUpdate, 8=Manual, 0x10=Trial; - NCCH.header.Flags[6] = 0; // MEDIA_UNIT_SIZE = 0x200*Math.Pow(2, Content.header.Flags[6]); - NCCH.header.Flags[7] = 1; // FixedCrypto = 1, NoMountRomfs = 2; NoCrypto=4; - NCCH.header.LogoOffset = (uint)(Len / MEDIA_UNIT_SIZE); - NCCH.header.LogoSize = (uint)(NCCH.logo.Length / MEDIA_UNIT_SIZE); + NCCH.Header.Flags[3] = 0; // Crypto: 0 = <7.x, 1=7.x; + NCCH.Header.Flags[4] = 1; // Content Platform: 1 = CTR; + NCCH.Header.Flags[5] = 0x3; // Content Type Bitflags: 1=Data, 2=Executable, 4=SysUpdate, 8=Manual, 0x10=Trial; + NCCH.Header.Flags[6] = 0; // MEDIA_UNIT_SIZE = 0x200*Math.Pow(2, Content.header.Flags[6]); + NCCH.Header.Flags[7] = 1; // FixedCrypto = 1, NoMountRomfs = 2; NoCrypto=4; + NCCH.Header.LogoOffset = (uint)(Len / MEDIA_UNIT_SIZE); + NCCH.Header.LogoSize = (uint)(NCCH.logo.Length / MEDIA_UNIT_SIZE); Len += (uint)NCCH.logo.Length; - NCCH.header.PlainRegionOffset = (uint)(NCCH.plainregion.Length > 0 ? Len / MEDIA_UNIT_SIZE : 0); - NCCH.header.PlainRegionSize = (uint)NCCH.plainregion.Length / MEDIA_UNIT_SIZE; + NCCH.Header.PlainRegionOffset = (uint)(NCCH.plainregion.Length > 0 ? Len / MEDIA_UNIT_SIZE : 0); + NCCH.Header.PlainRegionSize = (uint)NCCH.plainregion.Length / MEDIA_UNIT_SIZE; Len += (uint)NCCH.plainregion.Length; - NCCH.header.ExefsOffset = (uint)(Len / MEDIA_UNIT_SIZE); - NCCH.header.ExefsSize = (uint)(NCCH.exefs.Data.Length / MEDIA_UNIT_SIZE); - NCCH.header.ExefsSuperBlockSize = 0x200 / MEDIA_UNIT_SIZE; //Static 0x200 for exefs superblock - Len += (uint)NCCH.exefs.Data.Length; + NCCH.Header.ExefsOffset = (uint)(Len / MEDIA_UNIT_SIZE); + NCCH.Header.ExefsSize = (uint)(NCCH.ExeFS.Data.Length / MEDIA_UNIT_SIZE); + NCCH.Header.ExefsSuperBlockSize = 0x200 / MEDIA_UNIT_SIZE; //Static 0x200 for exefs superblock + Len += (uint)NCCH.ExeFS.Data.Length; Len = (uint)Align(Len, 0x1000); //Romfs Start is aligned to 0x1000 - NCCH.header.RomfsOffset = (uint)(Len / MEDIA_UNIT_SIZE); - NCCH.header.RomfsSize = (uint)(new FileInfo(NCCH.romfs.FileName).Length / MEDIA_UNIT_SIZE); - NCCH.header.RomfsSuperBlockSize = NCCH.romfs.SuperBlockLen / MEDIA_UNIT_SIZE; - Len += NCCH.header.RomfsSize * MEDIA_UNIT_SIZE; - NCCH.header.ExefsHash = NCCH.exefs.SuperBlockHash; - NCCH.header.RomfsHash = NCCH.romfs.SuperBlockHash; - NCCH.header.Size = (uint)(Len / MEDIA_UNIT_SIZE); + NCCH.Header.RomfsOffset = (uint)(Len / MEDIA_UNIT_SIZE); + NCCH.Header.RomfsSize = (uint)(new FileInfo(NCCH.RomFS.FileName).Length / MEDIA_UNIT_SIZE); + NCCH.Header.RomfsSuperBlockSize = NCCH.RomFS.SuperBlockLen / MEDIA_UNIT_SIZE; + Len += NCCH.Header.RomfsSize * MEDIA_UNIT_SIZE; + NCCH.Header.ExefsHash = NCCH.ExeFS.SuperBlockHash; + NCCH.Header.RomfsHash = NCCH.RomFS.SuperBlockHash; + NCCH.Header.Size = (uint)(Len / MEDIA_UNIT_SIZE); //Build the Header byte[]. - updateTB(TB_Progress, "Building NCCH Header..."); - NCCH.header.BuildHeader(); + UpdateTB(TB_Progress, "Building NCCH Header..."); + NCCH.Header.BuildHeader(); return NCCH; } - internal static NCSD setNCSD(NCCH NCCH, bool Card2, - ProgressBar PB_Show = null, RichTextBox TB_Progress = null) + internal static NCSD SetNCSD(NCCH NCCH, bool Card2, RichTextBox TB_Progress = null) { - PB_Show = PB_Show ?? new ProgressBar(); - TB_Progress = TB_Progress ?? new RichTextBox(); - updateTB(TB_Progress, "Building NCSD Header..."); + TB_Progress ??= new RichTextBox(); + UpdateTB(TB_Progress, "Building NCSD Header..."); NCSD NCSD = new NCSD { NCCH_Array = new List {NCCH}, Card2 = Card2, - header = new NCSD.Header {Signature = new byte[0x100], Magic = 0x4453434E} + Header = new NCSD.NCSDHeader {Signature = new byte[0x100], Magic = 0x4453434E} }; ulong Length = 0x80 * 0x100000; // 128 MB - while (Length <= (NCCH.header.Size * MEDIA_UNIT_SIZE) + 0x400000) //Extra 4 MB for potential save data + while (Length <= (NCCH.Header.Size * MEDIA_UNIT_SIZE) + 0x400000) //Extra 4 MB for potential save data { Length *= 2; } - NCSD.header.MediaSize = (uint)(Length / MEDIA_UNIT_SIZE); - NCSD.header.TitleId = NCCH.exheader.TitleID; - NCSD.header.OffsetSizeTable = new NCSD.NCCH_Meta[8]; + NCSD.Header.MediaSize = (uint)(Length / MEDIA_UNIT_SIZE); + NCSD.Header.TitleId = NCCH.Exheader.TitleID; + NCSD.Header.OffsetSizeTable = new NCSD.NCCH_Meta[8]; ulong OSOfs = 0x4000; - for (int i = 0; i < NCSD.header.OffsetSizeTable.Length; i++) + for (int i = 0; i < NCSD.Header.OffsetSizeTable.Length; i++) { NCSD.NCCH_Meta ncchm = new NCSD.NCCH_Meta(); if (i < NCSD.NCCH_Array.Count) { ncchm.Offset = (uint)(OSOfs / MEDIA_UNIT_SIZE); - ncchm.Size = NCSD.NCCH_Array[i].header.Size; + ncchm.Size = NCSD.NCCH_Array[i].Header.Size; } else { ncchm.Offset = 0; ncchm.Size = 0; } - NCSD.header.OffsetSizeTable[i] = ncchm; + NCSD.Header.OffsetSizeTable[i] = ncchm; OSOfs += ncchm.Size * MEDIA_UNIT_SIZE; } - NCSD.header.flags = new byte[0x8]; - NCSD.header.flags[0] = 0; // 0-255 seconds of waiting for save writing. - NCSD.header.flags[3] = (byte)(NCSD.Card2 ? 2 : 1); // Media Card Device: 1 = NOR Flash, 2 = None, 3 = BT - NCSD.header.flags[4] = 1; // Media Platform Index: 1 = CTR - NCSD.header.flags[5] = (byte)(NCSD.Card2 ? 2 : 1); // Media Type Index: 0 = Inner Device, 1 = Card1, 2 = Card2, 3 = Extended Device - NCSD.header.flags[6] = 0; // Media Unit Size. Same as NCCH. - NCSD.header.flags[7] = 0; // Old Media Card Device. - NCSD.header.NCCHIdTable = new ulong[8]; + NCSD.Header.flags = new byte[0x8]; + NCSD.Header.flags[0] = 0; // 0-255 seconds of waiting for save writing. + NCSD.Header.flags[3] = NCSD.Card2 ? 2 : 1; // Media Card Device: 1 = NOR Flash, 2 = None, 3 = BT + NCSD.Header.flags[4] = 1; // Media Platform Index: 1 = CTR + NCSD.Header.flags[5] = NCSD.Card2 ? 2 : 1; // Media Type Index: 0 = Inner Device, 1 = Card1, 2 = Card2, 3 = Extended Device + NCSD.Header.flags[6] = 0; // Media Unit Size. Same as NCCH. + NCSD.Header.flags[7] = 0; // Old Media Card Device. + NCSD.Header.NCCHIdTable = new ulong[8]; for (int i = 0; i < NCSD.NCCH_Array.Count; i++) { - NCSD.header.NCCHIdTable[i] = NCSD.NCCH_Array[i].header.TitleId; + NCSD.Header.NCCHIdTable[i] = NCSD.NCCH_Array[i].Header.TitleId; } NCSD.cardinfoheader = new NCSD.CardInfoHeader { @@ -182,7 +180,7 @@ internal static NCSD setNCSD(NCCH NCCH, bool Card2, CVerTitleVersion = 0, Reserved3 = new byte[0xCD6] }, - NCCH0TitleId = NCSD.NCCH_Array[0].header.TitleId, + NCCH0TitleId = NCSD.NCCH_Array[0].Header.TitleId, Reserved0 = 0, InitialData = new byte[0x30] }; @@ -192,7 +190,7 @@ internal static NCSD setNCSD(NCCH NCCH, bool Card2, Array.Copy(randbuffer, NCSD.cardinfoheader.InitialData, randbuffer.Length); NCSD.cardinfoheader.Reserved1 = new byte[0xC0]; NCSD.cardinfoheader.NCCH0Header = new byte[0x100]; - Array.Copy(NCSD.NCCH_Array[0].header.Data, 0x100, NCSD.cardinfoheader.NCCH0Header, 0, 0x100); + Array.Copy(NCSD.NCCH_Array[0].Header.Data, 0x100, NCSD.cardinfoheader.NCCH0Header, 0, 0x100); NCSD.BuildHeader(); @@ -200,47 +198,47 @@ internal static NCSD setNCSD(NCCH NCCH, bool Card2, return NCSD; } - internal static bool writeROM(NCSD NCSD, string SAVE_PATH, bool trimmed = false, + internal static bool WriteROM(NCSD NCSD, string SAVE_PATH, bool trimmed = false, ProgressBar PB_Show = null, RichTextBox TB_Progress = null) { - PB_Show = PB_Show ?? new ProgressBar(); - TB_Progress = TB_Progress ?? new RichTextBox(); + PB_Show ??= new ProgressBar(); + TB_Progress ??= new RichTextBox(); using (FileStream OutFileStream = new FileStream(SAVE_PATH, FileMode.Create)) { - updateTB(TB_Progress, "Writing NCSD Header..."); + UpdateTB(TB_Progress, "Writing NCSD Header..."); OutFileStream.Write(NCSD.Data, 0, NCSD.Data.Length); - updateTB(TB_Progress, "Writing NCCH..."); - OutFileStream.Write(NCSD.NCCH_Array[0].header.Data, 0, NCSD.NCCH_Array[0].header.Data.Length); //Write NCCH header + UpdateTB(TB_Progress, "Writing NCCH..."); + OutFileStream.Write(NCSD.NCCH_Array[0].Header.Data, 0, NCSD.NCCH_Array[0].Header.Data.Length); //Write NCCH header //AES time. byte[] key = new byte[0x10]; //Fixed-Crypto key is all zero. for (int i = 0; i < 3; i++) { - AesCtr aesctr = new AesCtr(key, NCSD.NCCH_Array[0].header.ProgramId, (ulong)(i + 1) << 56); //CTR is ProgramID, section id<<88 + AesCtr aesctr = new AesCtr(key, NCSD.NCCH_Array[0].Header.ProgramId, (ulong)(i + 1) << 56); //CTR is ProgramID, section id<<88 switch (i) { case 0: //Exheader + AccessDesc - updateTB(TB_Progress, "Writing Exheader..."); - byte[] inEncExheader = new byte[NCSD.NCCH_Array[0].exheader.Data.Length + NCSD.NCCH_Array[0].exheader.AccessDescriptor.Length]; - byte[] outEncExheader = new byte[NCSD.NCCH_Array[0].exheader.Data.Length + NCSD.NCCH_Array[0].exheader.AccessDescriptor.Length]; - Array.Copy(NCSD.NCCH_Array[0].exheader.Data, inEncExheader, NCSD.NCCH_Array[0].exheader.Data.Length); - Array.Copy(NCSD.NCCH_Array[0].exheader.AccessDescriptor, 0, inEncExheader, NCSD.NCCH_Array[0].exheader.Data.Length, NCSD.NCCH_Array[0].exheader.AccessDescriptor.Length); + UpdateTB(TB_Progress, "Writing Exheader..."); + byte[] inEncExheader = new byte[NCSD.NCCH_Array[0].Exheader.Data.Length + NCSD.NCCH_Array[0].Exheader.AccessDescriptor.Length]; + byte[] outEncExheader = new byte[NCSD.NCCH_Array[0].Exheader.Data.Length + NCSD.NCCH_Array[0].Exheader.AccessDescriptor.Length]; + Array.Copy(NCSD.NCCH_Array[0].Exheader.Data, inEncExheader, NCSD.NCCH_Array[0].Exheader.Data.Length); + Array.Copy(NCSD.NCCH_Array[0].Exheader.AccessDescriptor, 0, inEncExheader, NCSD.NCCH_Array[0].Exheader.Data.Length, NCSD.NCCH_Array[0].Exheader.AccessDescriptor.Length); aesctr.TransformBlock(inEncExheader, 0, inEncExheader.Length, outEncExheader, 0); OutFileStream.Write(outEncExheader, 0, outEncExheader.Length); // Write Exheader break; case 1: //Exefs - updateTB(TB_Progress, "Writing Exefs..."); - OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.ExefsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); - byte[] OutExefs = new byte[NCSD.NCCH_Array[0].exefs.Data.Length]; - aesctr.TransformBlock(NCSD.NCCH_Array[0].exefs.Data, 0, NCSD.NCCH_Array[0].exefs.Data.Length, OutExefs, 0); + UpdateTB(TB_Progress, "Writing Exefs..."); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].Header.ExefsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + byte[] OutExefs = new byte[NCSD.NCCH_Array[0].ExeFS.Data.Length]; + aesctr.TransformBlock(NCSD.NCCH_Array[0].ExeFS.Data, 0, NCSD.NCCH_Array[0].ExeFS.Data.Length, OutExefs, 0); OutFileStream.Write(OutExefs, 0, OutExefs.Length); break; case 2: //Romfs - updateTB(TB_Progress, "Writing Romfs..."); - OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.RomfsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); - using (FileStream InFileStream = new FileStream(NCSD.NCCH_Array[0].romfs.FileName, FileMode.Open, FileAccess.Read)) + UpdateTB(TB_Progress, "Writing Romfs..."); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].Header.RomfsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + using (FileStream InFileStream = new FileStream(NCSD.NCCH_Array[0].RomFS.FileName, FileMode.Open, FileAccess.Read)) { uint BUFFER_SIZE; - ulong RomfsLen = NCSD.NCCH_Array[0].header.RomfsSize * MEDIA_UNIT_SIZE; + ulong RomfsLen = NCSD.NCCH_Array[0].Header.RomfsSize * MEDIA_UNIT_SIZE; PB_Show.Invoke((Action)(() => { PB_Show.Minimum = 0; @@ -262,23 +260,23 @@ internal static bool writeROM(NCSD NCSD, string SAVE_PATH, bool trimmed = false, break; } } - updateTB(TB_Progress, "Writing Logo..."); - OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.LogoOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + UpdateTB(TB_Progress, "Writing Logo..."); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].Header.LogoOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); OutFileStream.Write(NCSD.NCCH_Array[0].logo, 0, NCSD.NCCH_Array[0].logo.Length); if (NCSD.NCCH_Array[0].plainregion.Length > 0) { - updateTB(TB_Progress, "Writing Plain Region..."); - OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.PlainRegionOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + UpdateTB(TB_Progress, "Writing Plain Region..."); + OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].Header.PlainRegionOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); OutFileStream.Write(NCSD.NCCH_Array[0].plainregion, 0, NCSD.NCCH_Array[0].plainregion.Length); } //NCSD Padding if (!trimmed) { - OutFileStream.Seek((NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE) + (NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE), SeekOrigin.Begin); - ulong TotalLen = NCSD.header.MediaSize * MEDIA_UNIT_SIZE; + OutFileStream.Seek((NCSD.Header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE) + (NCSD.Header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + ulong TotalLen = NCSD.Header.MediaSize * MEDIA_UNIT_SIZE; byte[] Buffer = Enumerable.Repeat((byte)0xFF, 0x400000).ToArray(); - updateTB(TB_Progress, "Writing NCSD Padding..."); + UpdateTB(TB_Progress, "Writing NCSD Padding..."); while ((ulong)OutFileStream.Position < TotalLen) { int BUFFER_LEN = TotalLen - (ulong)OutFileStream.Position < 0x400000 ? (int)(TotalLen - (ulong)OutFileStream.Position) : 0x400000; @@ -288,33 +286,41 @@ internal static bool writeROM(NCSD NCSD, string SAVE_PATH, bool trimmed = false, } //Delete Temporary Romfs File - if (NCSD.NCCH_Array[0].romfs.isTempFile) - File.Delete(NCSD.NCCH_Array[0].romfs.FileName); + if (NCSD.NCCH_Array[0].RomFS.isTempFile) + File.Delete(NCSD.NCCH_Array[0].RomFS.FileName); - updateTB(TB_Progress, "Done!"); + UpdateTB(TB_Progress, "Done!"); return true; } // Utility - internal static bool isValid(string exeFS, string romFS, string exeheader, string path, string serial, bool Card2) + internal static bool IsValid(string exeFS, string romFS, string exeheader, string path, string serial, bool Card2) { bool isSerialValid = true; if (serial.Length == 10) { string[] subs = serial.Split('-'); if (subs.Length != 3) + { isSerialValid = false; + } else { if (subs[0].Length != 3 || subs[1].Length != 1 || subs[2].Length != 4) + { isSerialValid = false; + } else if (subs[0] != "CTR" && subs[0] != "KTR") + { isSerialValid = false; + } else if (subs[1] != "P" && subs[1] != "N" && subs[2] != "U") + { isSerialValid = false; + } else { - foreach (char c in subs[2].Where(c => !Char.IsLetterOrDigit(c))) + if (subs[2].Any(c => !char.IsLetterOrDigit(c))) isSerialValid = false; } } @@ -323,28 +329,32 @@ internal static bool isValid(string exeFS, string romFS, string exeheader, strin { isSerialValid = false; } - if (exeFS == string.Empty - || romFS == string.Empty - || exeheader == string.Empty - || path == string.Empty + if (string.IsNullOrEmpty(exeFS) + || string.IsNullOrEmpty(romFS) + || string.IsNullOrEmpty(exeheader) + || string.IsNullOrEmpty(path) || !isSerialValid) + { return false; + } Exheader exh = new Exheader(exeheader); - return !exh.isPokemon() || Card2; + return !exh.IsSupported() || Card2; } - internal static void updateTB(RichTextBox RTB, string progress) + internal static void UpdateTB(RichTextBox RTB, string progress) { try { if (RTB.InvokeRequired) + { RTB.Invoke((MethodInvoker)delegate - { - RTB.AppendText(Environment.NewLine + progress); - RTB.SelectionStart = RTB.Text.Length; - RTB.ScrollToCaret(); - }); + { + RTB.AppendText(Environment.NewLine + progress); + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + }); + } else { RTB.SelectionStart = RTB.Text.Length; diff --git a/pk3DS.Core/CTR/DARC.cs b/pk3DS.Core/CTR/DARC.cs index 752adfec06..cd9234c09c 100644 --- a/pk3DS.Core/CTR/DARC.cs +++ b/pk3DS.Core/CTR/DARC.cs @@ -16,7 +16,7 @@ public class DARC public DARC(byte[] Data = null) { if (Data == null) return; - using (BinaryReader br = new BinaryReader(new MemoryStream(Data))) + using BinaryReader br = new BinaryReader(new MemoryStream(Data)); try { Header = new DARCHeader(br); @@ -99,48 +99,46 @@ public NameTableEntry(uint offset, string fileName) } // DARC r/w - public static byte[] setDARC(DARC darc) + public static byte[] SetDARC(DARC darc) { // Package DARC into a writable array. - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + // Write Header + bw.Write(Encoding.ASCII.GetBytes(darc.Header.Signature)); + bw.Write(darc.Header.Endianness); + bw.Write(darc.Header.HeaderSize); + bw.Write(darc.Header.Version); + bw.Write(darc.Header.FileSize); + bw.Write(darc.Header.FileTableOffset); + bw.Write(darc.Header.FileTableLength); + bw.Write(darc.Header.FileDataOffset); + // Write FileTableEntries + foreach (FileTableEntry entry in darc.Entries) { - // Write Header - bw.Write(Encoding.ASCII.GetBytes(darc.Header.Signature)); - bw.Write(darc.Header.Endianness); - bw.Write(darc.Header.HeaderSize); - bw.Write(darc.Header.Version); - bw.Write(darc.Header.FileSize); - bw.Write(darc.Header.FileTableOffset); - bw.Write(darc.Header.FileTableLength); - bw.Write(darc.Header.FileDataOffset); - // Write FileTableEntries - foreach (FileTableEntry entry in darc.Entries) - { - bw.Write(entry.NameOffset | (entry.IsFolder ? (uint)1 << 24 : 0)); - bw.Write(entry.DataOffset); - bw.Write(entry.DataLength); - } - foreach (NameTableEntry entry in darc.FileNameTable) - { - bw.Write(Encoding.Unicode.GetBytes(entry.FileName + "\0")); - } - while (bw.BaseStream.Position < darc.Header.FileDataOffset) - bw.Write((byte)0); + bw.Write(entry.NameOffset | (entry.IsFolder ? (uint)1 << 24 : 0)); + bw.Write(entry.DataOffset); + bw.Write(entry.DataLength); + } + foreach (NameTableEntry entry in darc.FileNameTable) + { + bw.Write(Encoding.Unicode.GetBytes(entry.FileName + "\0")); + } + while (bw.BaseStream.Position < darc.Header.FileDataOffset) + bw.Write((byte)0); - // Write Data - bw.Write(darc.Data); + // Write Data + bw.Write(darc.Data); - return ms.ToArray(); - } + return ms.ToArray(); } - public static DARC getDARC(string folderName) + public static DARC GetDARC(string folderName) { // Package Folder into a DARC. List EntryList = new List(); List NameList = new List(); - byte[] Data = new byte[0]; + byte[] Data = Array.Empty(); uint nameOffset = 6; // 00 00 + 00 2E 00 00 #region Build FileTable/NameTables { @@ -201,9 +199,9 @@ public static DARC getDARC(string folderName) { Header = { - Signature = "darc", - Endianness = 0xFEFF, - HeaderSize = 0x1C, + Signature = "darc", + Endianness = 0xFEFF, + HeaderSize = 0x1C, Version = 1, FileSize = (uint)FinalSize, FileTableOffset = 0x1C, @@ -224,13 +222,13 @@ public static DARC getDARC(string folderName) return darc; } - public static bool darc2files(string path, string folderName) + public static bool Darc2files(string path, string folderName) { - try { return darc2files(File.ReadAllBytes(path), folderName); } + try { return Darc2files(File.ReadAllBytes(path), folderName); } catch (Exception) { return false; } } - public static bool darc2files(byte[] darc, string folderName) + public static bool Darc2files(byte[] darc, string folderName) { // Save all contents of a DARC to a folder, assuming there's only 1 layer of folders. try @@ -247,7 +245,7 @@ public static bool darc2files(byte[] darc, string folderName) for (int i = 2; i < DARC.FileNameTable.Length;) { bool isFolder = DARC.Entries[i].IsFolder; - if (!isFolder) + if (!isFolder) return false; // uint level = DARC.Entries[i].DataOffset; Only assuming 1 layer of folders. string parentName = DARC.FileNameTable[i].FileName; @@ -273,7 +271,7 @@ public static bool darc2files(byte[] darc, string folderName) catch (Exception) { return false; } } - public static bool files2darc(string folderName, bool delete = false, string originalDARC = null, string outFile = null) + public static bool Files2darc(string folderName, bool delete = false, string originalDARC = null, string outFile = null) { // Save all contents of a folder to a darc. try @@ -285,23 +283,23 @@ public static bool files2darc(string folderName, bool delete = false, string ori { // Fetch offset of DARC within file. byte[] darc = File.ReadAllBytes(originalDARC); - int darcPos = getDARCposition(darc); + int darcPos = GetDARCposition(darc); if (darcPos < 0) return false; byte[] origData = darc.Skip(darcPos).ToArray(); orig = new DARC(origData); - orig = insertFiles(orig, folderName); - byte[] newDARC = setDARC(orig); + orig = InsertFiles(orig, folderName); + byte[] newDARC = SetDARC(orig); darcData = darc.Take(darcPos).Concat(newDARC).ToArray(); } else // no existing darc to get { - orig = getDARC(folderName); - darcData = setDARC(orig); + orig = GetDARC(folderName); + darcData = SetDARC(orig); } // Fetch final name if not specified - outFile = outFile ?? originalDARC ?? new DirectoryInfo(folderName).Name.Replace("_d", "") + ".darc"; + outFile ??= originalDARC ?? new DirectoryInfo(folderName).Name.Replace("_d", "") + ".darc"; if (darcData == null) return false; File.WriteAllBytes(outFile, darcData); @@ -313,7 +311,7 @@ public static bool files2darc(string folderName, bool delete = false, string ori } // DARC Utility - public static int getDARCposition(byte[] data) + public static int GetDARCposition(byte[] data) { int pos = 0; while (BitConverter.ToUInt32(data, pos) != 0x63726164) @@ -321,13 +319,13 @@ public static int getDARCposition(byte[] data) return pos; } - public static bool insertFile(ref DARC orig, int index, string path) + public static bool InsertFile(ref DARC orig, int index, string path) { - try { return insertFile(ref orig, index, File.ReadAllBytes(path)); } + try { return InsertFile(ref orig, index, File.ReadAllBytes(path)); } catch (Exception) { return false; } } - public static bool insertFile(ref DARC orig, int index, byte[] data) + public static bool InsertFile(ref DARC orig, int index, byte[] data) { if (index < 0) return false; @@ -347,14 +345,14 @@ public static bool insertFile(ref DARC orig, int index, byte[] data) // Fix Offset references of other files foreach (var x in orig.Entries.Where(x => x.DataOffset >= offset + oldLength)) x.DataOffset += (uint) diff; - orig.Entries[index].DataLength = (uint)data.Length; + orig.Entries[index].DataLength = (uint)data.Length; orig.Header.FileSize += (uint)diff; return true; } catch (Exception) { return false; } } - public static DARC insertFiles(DARC orig, string folderName) + public static DARC InsertFiles(DARC orig, string folderName) { string[] fileNames = new string[orig.Entries.Length]; for (int i = 0; i < fileNames.Length; i++) @@ -371,7 +369,7 @@ public static DARC insertFiles(DARC orig, string folderName) if (orig.Entries[index].IsFolder) throw new Exception(file + " is not a valid file to reinsert!"); - insertFile(ref orig, index, file); + InsertFile(ref orig, index, file); } // Fix Data layout Array.Resize(ref orig.Data, orig.Data.Length % 4 == 0 ? orig.Data.Length : orig.Data.Length + 4 - (orig.Data.Length % 4)); diff --git a/pk3DS.Core/CTR/ExeFS.cs b/pk3DS.Core/CTR/ExeFS.cs index 48d07113be..f042dcba12 100644 --- a/pk3DS.Core/CTR/ExeFS.cs +++ b/pk3DS.Core/CTR/ExeFS.cs @@ -17,23 +17,23 @@ public ExeFS(string EXEFS_PATH) if (Directory.Exists(EXEFS_PATH)) { var files = new DirectoryInfo(EXEFS_PATH).GetFiles().Select(f => f.FullName).ToArray(); - setData(files); + SetData(files); } else { Data = File.ReadAllBytes(EXEFS_PATH); } - getSuperBlockHash(); + GetSuperBlockHash(); } - public void getSuperBlockHash() + public void GetSuperBlockHash() { - using (SHA256Managed sha = new SHA256Managed()) - SuperBlockHash = sha.ComputeHash(Data, 0, 0x200); + using var sha = new SHA256Managed(); + SuperBlockHash = sha.ComputeHash(Data, 0, 0x200); } // Overall R/W files (wrapped) - public static bool get(string inFile, string outPath) + public static bool UnpackExeFS(string inFile, string outPath) { try { @@ -44,19 +44,21 @@ public static bool get(string inFile, string outPath) // Get File Name String; if exists we have a file to extract. string fileName = Encoding.ASCII.GetString(data.Skip(0x10 * i).Take(0x8).ToArray()).TrimEnd((char)0); if (fileName.Length > 0) + { File.WriteAllBytes( // New File Path outPath + Path.DirectorySeparatorChar + fileName + ".bin", // Get New Data from Offset after 0x200 Header. data.Skip(0x200 + BitConverter.ToInt32(data, 0x8 + (0x10 * i))).Take(BitConverter.ToInt32(data, 0xC + (0x10 * i))).ToArray() - ); + ); + } } return true; } catch { return false; } } - public static bool set(string[] files, string outFile) + public static bool PackExeFS(string[] files, string outFile) { if (files.Length > 10) { Console.WriteLine("Cannot package more than 10 files to exefs."); return false; } @@ -87,24 +89,22 @@ public static bool set(string[] files, string outFile) } // Set in the Data - using (MemoryStream newFile = new MemoryStream()) + using MemoryStream newFile = new MemoryStream(); + new MemoryStream(headerData).CopyTo(newFile); + foreach (string s in files) { - new MemoryStream(headerData).CopyTo(newFile); - foreach (string s in files) - { - using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s))) - loadFile.CopyTo(newFile); - new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile); - } - - File.WriteAllBytes(outFile, newFile.ToArray()); + using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s))) + loadFile.CopyTo(newFile); + new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile); } + + File.WriteAllBytes(outFile, newFile.ToArray()); return true; } catch { return false; } } - public void setData(string[] files) + public void SetData(string[] files) { // Set up the Header byte[] headerData = new byte[0x200]; @@ -131,18 +131,16 @@ public void setData(string[] files) } // Set in the Data - using (MemoryStream newFile = new MemoryStream()) + using MemoryStream newFile = new MemoryStream(); + new MemoryStream(headerData).CopyTo(newFile); + foreach (string s in files) { - new MemoryStream(headerData).CopyTo(newFile); - foreach (string s in files) - { - using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s))) - loadFile.CopyTo(newFile); - new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile); - } - - Data = newFile.ToArray(); + using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s))) + loadFile.CopyTo(newFile); + new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile); } + + Data = newFile.ToArray(); } } } diff --git a/pk3DS.Core/CTR/Exheader.cs b/pk3DS.Core/CTR/Exheader.cs index 44311ef07a..a5ddb410b7 100644 --- a/pk3DS.Core/CTR/Exheader.cs +++ b/pk3DS.Core/CTR/Exheader.cs @@ -39,8 +39,8 @@ public string GetSerial() ulong titleid = Convert.ToUInt64(vars[0], 16); if (RecognizedGames.ContainsKey(titleid)) { - char lc = RecognizedGames[titleid].ToArray()[0].ToCharArray()[3]; - char lc2 = vars[1].ToCharArray()[3]; + char lc = RecognizedGames[titleid].ToArray()[0][3]; + char lc2 = vars[1][3]; if (lc2 == 'A' || lc2 == 'E' || (lc2 == 'P' && lc == 'J')) //Prefer games in order US, PAL, JP { RecognizedGames[titleid] = vars.Skip(1).Take(2).ToArray(); @@ -54,66 +54,47 @@ public string GetSerial() return output + RecognizedGames[TitleID][0]; } - public bool isPokemon() + public bool IsSupported() { - return isORAS() || isXY() || isUSUM() || isSuMo(); + return IsORAS() || IsXY() || IsUSUM() || IsSM(); } - public bool isUSUM() + public bool IsUSUM() { return (TitleID & 0xFFFFFFFF) >> 8 == 0x1B50 || (TitleID & 0xFFFFFFFF) >> 8 == 0x1B51; } - public bool isSuMo() + public bool IsSM() { return (TitleID & 0xFFFFFFFF) >> 8 == 0x1648 || (TitleID & 0xFFFFFFFF) >> 8 == 0x175E; } - public bool isORAS() + public bool IsORAS() { return (TitleID & 0xFFFFFFFF) >> 8 == 0x11C5 || (TitleID & 0xFFFFFFFF) >> 8 == 0x11C4; } - public bool isXY() + public bool IsXY() { return (TitleID & 0xFFFFFFFF) >> 8 == 0x55D || (TitleID & 0xFFFFFFFF) >> 8 == 0x55E; } public string GetPokemonSerial() { - if (!isPokemon()) + if (!IsSupported()) return "CTR-P-XXXX"; - string name; - switch ((TitleID & 0xFFFFFFFF) >> 8) + string name = ((TitleID & 0xFFFFFFFF) >> 8) switch { - case 0x1B51: - name = "A2BA"; // Ultra Moon - break; - case 0x1B50: - name = "A2AA"; // Ultra Sun - break; - case 0x175E: // Moon - name = "BNEA"; - break; - case 0x1648: // Sun - name = "BNDA"; - break; - case 0x11C5: //Alpha Sapphire - name = "ECLA"; - break; - case 0x11C4: //Omega Ruby - name = "ECRA"; - break; - case 0x55D: //X - name = "EKJA"; - break; - case 0x55E: //Y - name = "EK2A"; - break; - default: - name = "XXXX"; - break; - } + 0x1B51 => "A2BA", // Ultra Moon + 0x1B50 => "A2AA", // Ultra Sun + 0x175E => "BNEA", // Moon + 0x1648 => "BNDA", // Sun + 0x11C5 => "ECLA", // Alpha Sapphire + 0x11C4 => "ECRA", // Omega Ruby + 0x055D => "EKJA", // X + 0x055E => "EK2A", // Y + _ => "XXXX" + }; return "CTR-P-" + name; } } diff --git a/pk3DS.Core/CTR/FileFormat.cs b/pk3DS.Core/CTR/FileFormat.cs index 8e379183ec..177fd3e767 100644 --- a/pk3DS.Core/CTR/FileFormat.cs +++ b/pk3DS.Core/CTR/FileFormat.cs @@ -13,26 +13,20 @@ public static class FileFormat public static string Guess(string path) { - string ext; - using (BinaryReader br = new BinaryReader(File.OpenRead(path))) - ext = Guess(br); - return ext; + using BinaryReader br = new BinaryReader(File.OpenRead(path)); + return Guess(br); } public static string Guess(byte[] data) { - string ext; - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - ext = Guess(br); - return ext; + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + return Guess(br); } public static string Guess(MemoryStream ms, bool start = true) { - string ext; - using (BinaryReader br = new BinaryReader(ms)) - ext = Guess(br, start); - return ext; + using BinaryReader br = new BinaryReader(ms); + return Guess(br, start); } public static string Guess(BinaryReader br, bool start = true) @@ -43,8 +37,7 @@ public static string Guess(BinaryReader br, bool start = true) br.BaseStream.Position = 0; // Guess Extension - string ext; - if (GuessMini(br, out ext)) + if (GuessMini(br, out var ext)) Console.WriteLine("Mini Packed File detected, extension type " + ext); else if (GuessHeaderedDARC(br, out ext)) Console.WriteLine("Headered DARC File detected, extension type " + ext); diff --git a/pk3DS.Core/CTR/GARC.cs b/pk3DS.Core/CTR/GARC.cs index 9d518728f3..e1b4398e64 100644 --- a/pk3DS.Core/CTR/GARC.cs +++ b/pk3DS.Core/CTR/GARC.cs @@ -32,7 +32,7 @@ public class UnpackProgressedEventArgs : EventArgs public static event EventHandler PackProgressed; public static event EventHandler UnpackProgressed; - public static int garcPackMS(string folderPath, string garcPath, int version, int bytesPadding) + public static int PackGARC(string folderPath, string garcPath, int version, int bytesPadding) { // Check to see if our input folder exists. if (!new DirectoryInfo(folderPath).Exists) throw new DirectoryNotFoundException("Folder does not exist"); @@ -191,135 +191,134 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in catch { } // Set up the Header Info - using (var newGARC = new FileStream(garcPath, FileMode.Create)) - using (BinaryWriter gw = new BinaryWriter(newGARC)) - { - #region Write GARC Headers - // Write GARC - gw.Write((uint)0x47415243); // GARC - gw.Write((uint)(version == VER_6 ? 0x24 : 0x1C)); // Header Length - gw.Write((ushort)0xFEFF); // Endianness BOM - gw.Write((ushort)version); // Version - gw.Write((uint)0x00000004); // Section Count (4) - gw.Write((uint)0x00000000); // Data Offset (temp) - gw.Write((uint)0x00000000); // File Length (temp) - gw.Write((uint)0x00000000); // Largest File Size (temp) + using var newGARC = new FileStream(garcPath, FileMode.Create); + using BinaryWriter gw = new BinaryWriter(newGARC); + + #region Write GARC Headers + // Write GARC + gw.Write((uint)0x47415243); // GARC + gw.Write((uint)(version == VER_6 ? 0x24 : 0x1C)); // Header Length + gw.Write((ushort)0xFEFF); // Endianness BOM + gw.Write((ushort)version); // Version + gw.Write((uint)0x00000004); // Section Count (4) + gw.Write((uint)0x00000000); // Data Offset (temp) + gw.Write((uint)0x00000000); // File Length (temp) + gw.Write((uint)0x00000000); // Largest File Size (temp) - if (version == VER_6) - { - gw.Write((uint)0x0); - gw.Write((uint)0x0); - } - - // Write FATO - gw.Write((uint)0x4641544F); // FATO - gw.Write(garc.fato.HeaderSize); // Header Size - gw.Write(garc.fato.EntryCount); // Entry Count - gw.Write(garc.fato.Padding); // Padding - for (int i = 0; i < garc.fato.Entries.Length; i++) - gw.Write((uint)garc.fato.Entries[i].Offset); + if (version == VER_6) + { + gw.Write((uint)0x0); + gw.Write((uint)0x0); + } - // Write FATB - gw.Write((uint)0x46415442); // FATB - gw.Write(garc.fatb.HeaderSize); // Header Size - gw.Write(garc.fatb.FileCount); // File Count - foreach (var e in garc.fatb.Entries) - { - gw.Write(e.Vector); - foreach (var s in e.SubEntries.Where(s => s.Exists)) - { gw.Write((uint)s.Start); gw.Write((uint)s.End); gw.Write((uint)s.Length); } - } + // Write FATO + gw.Write((uint)0x4641544F); // FATO + gw.Write(garc.fato.HeaderSize); // Header Size + gw.Write(garc.fato.EntryCount); // Entry Count + gw.Write(garc.fato.Padding); // Padding + foreach (var t in garc.fato.Entries) + gw.Write((uint)t.Offset); + + // Write FATB + gw.Write((uint)0x46415442); // FATB + gw.Write(garc.fatb.HeaderSize); // Header Size + gw.Write(garc.fatb.FileCount); // File Count + foreach (var e in garc.fatb.Entries) + { + gw.Write(e.Vector); + foreach (var s in e.SubEntries.Where(s => s.Exists)) + { gw.Write((uint)s.Start); gw.Write((uint)s.End); gw.Write((uint)s.Length); } + } - // Write FIMB - gw.Write((uint)0x46494D42); // FIMB - gw.Write((uint)0x0000000C); // Header Length - var dataLen = gw.BaseStream.Position; - gw.Write((uint)0); // Data Length - TEMP + // Write FIMB + gw.Write((uint)0x46494D42); // FIMB + gw.Write((uint)0x0000000C); // Header Length + var dataLen = gw.BaseStream.Position; + gw.Write((uint)0); // Data Length - TEMP - gw.Seek(0x10, SeekOrigin.Begin); // Goto the start of the un-set 0 data we set earlier and set it. - var hdrLen = gw.BaseStream.Position; - gw.Write((uint)0); // Write Data Offset - TEMP - gw.Write((uint)0); // Write total GARC Length - TEMP + gw.Seek(0x10, SeekOrigin.Begin); // Goto the start of the un-set 0 data we set earlier and set it. + var hdrLen = gw.BaseStream.Position; + gw.Write((uint)0); // Write Data Offset - TEMP + gw.Write((uint)0); // Write total GARC Length - TEMP - // Write Handling information - if (version == VER_4) - { - gw.Write(garc.ContentLargestUnpadded); // Write Largest File stat - } - else if (version == VER_6) - { - gw.Write(garc.ContentLargestPadded); // Write Largest With Padding - gw.Write(garc.ContentLargestUnpadded); // Write Largest Without Padding - gw.Write(garc.ContentPadToNearest); - } + // Write Handling information + if (version == VER_4) + { + gw.Write(garc.ContentLargestUnpadded); // Write Largest File stat + } + else if (version == VER_6) + { + gw.Write(garc.ContentLargestPadded); // Write Largest With Padding + gw.Write(garc.ContentLargestUnpadded); // Write Largest Without Padding + gw.Write(garc.ContentPadToNearest); + } - newGARC.Seek(0, SeekOrigin.End); // Goto the end so we can copy the filedata after the GARC headers. + newGARC.Seek(0, SeekOrigin.End); // Goto the end so we can copy the filedata after the GARC headers. - #endregion + #endregion - #region Write Files - var ghLength = gw.BaseStream.Length; + #region Write Files + var ghLength = gw.BaseStream.Length; - long largestSize = 0; // Required memory to allocate to handle the largest file - long largestPadded = 0; // Required memory to allocate to handle the largest PADDED file (Ver6 only) - foreach (string e in packOrder) + long largestSize = 0; // Required memory to allocate to handle the largest file + long largestPadded = 0; // Required memory to allocate to handle the largest PADDED file (Ver6 only) + foreach (string e in packOrder) + { + string[] fa = Directory.Exists(e) ? Directory.GetFiles(e) : new[] { e }; + foreach (string f in fa) { - string[] fa = Directory.Exists(e) ? Directory.GetFiles(e) : new[] { e }; - foreach (string f in fa) + // Update largest file length if necessary + long len = new FileInfo(f).Length; + int padding = (int)(len % bytesPadding); + if (padding != 0) padding = bytesPadding - padding; + bool largest = len > largestSize; + if (largest) { - // Update largest file length if necessary - long len = new FileInfo(f).Length; - int padding = (int)(len % bytesPadding); - if (padding != 0) padding = bytesPadding - padding; - bool largest = len > largestSize; - if (largest) - { - largestSize = len; - largestPadded = len + padding; - } - - // Write to FIMB - using (var x = File.OpenRead(f)) - x.CopyTo(newGARC); - - // While length is not divisible by 4, pad with FF (unused byte) - while (padding-- > 0) - gw.Write((byte)0xFF); + largestSize = len; + largestPadded = len + padding; } - } - garc.ContentLargestUnpadded = (uint)largestSize; - garc.ContentLargestPadded = (uint)largestPadded; - var gdLength = gw.BaseStream.Length - ghLength; - #endregion - gw.Seek((int)dataLen, SeekOrigin.Begin); - gw.Write((uint)gdLength); // Data Length - gw.Seek((int)hdrLen, SeekOrigin.Begin); - gw.Write((uint)ghLength); // Write Data Offset - gw.Write((uint)gw.BaseStream.Length); // Write total GARC Length + // Write to FIMB + using (var x = File.OpenRead(f)) + x.CopyTo(newGARC); - // Write Handling information - if (version == VER_4) - { - gw.Write(garc.ContentLargestUnpadded); // Write Largest File stat + // While length is not divisible by 4, pad with FF (unused byte) + while (padding-- > 0) + gw.Write((byte)0xFF); } - else if (version == VER_6) - { - gw.Write(garc.ContentLargestPadded); // Write Largest With Padding - gw.Write(garc.ContentLargestUnpadded); // Write Largest Without Padding - gw.Write(garc.ContentPadToNearest); - } + } + garc.ContentLargestUnpadded = (uint)largestSize; + garc.ContentLargestPadded = (uint)largestPadded; + var gdLength = gw.BaseStream.Length - ghLength; + #endregion + + gw.Seek((int)dataLen, SeekOrigin.Begin); + gw.Write((uint)gdLength); // Data Length + gw.Seek((int)hdrLen, SeekOrigin.Begin); + gw.Write((uint)ghLength); // Write Data Offset + gw.Write((uint)gw.BaseStream.Length); // Write total GARC Length - return filectr; + // Write Handling information + if (version == VER_4) + { + gw.Write(garc.ContentLargestUnpadded); // Write Largest File stat + } + else if (version == VER_6) + { + gw.Write(garc.ContentLargestPadded); // Write Largest With Padding + gw.Write(garc.ContentLargestUnpadded); // Write Largest Without Padding + gw.Write(garc.ContentPadToNearest); } + + return filectr; } - public static int garcUnpack(string garcPath, string outPath, bool skipDecompression) + public static int GarcUnpack(string garcPath, string outPath, bool skipDecompression) { if (!File.Exists(garcPath)) throw new FileNotFoundException("File does not exist"); // Unpack the GARC - GARCFile garc = unpackGARC(garcPath); + GARCFile garc = UnpackGARC(garcPath); const string ext = "bin"; // Default Extension Name int fileCount = garc.fatb.FileCount; string format = "D" + Math.Ceiling(Math.Log10(fileCount)); @@ -328,167 +327,169 @@ public static int garcUnpack(string garcPath, string outPath, bool skipDecompres FileCountDetermined?.Invoke(null, new FileCountDeterminedEventArgs { Total = fileCount }); - using (BinaryReader br = new BinaryReader(File.OpenRead(garcPath))) + using BinaryReader br = new BinaryReader(File.OpenRead(garcPath)); + // Create Extraction folder if it does not exist. + if (!Directory.Exists(outPath)) + Directory.CreateDirectory(outPath); + + int filectr = 0; + // Pull out all the files + for (int o = 0; o < garc.fato.EntryCount; o++) { - // Create Extraction folder if it does not exist. - if (!Directory.Exists(outPath)) - Directory.CreateDirectory(outPath); + var Entry = garc.fatb.Entries[o]; + // Set Entry File Name + string fileName = o.ToString(format); + + #region OutDirectory Determination + string parentFolder = Entry.IsFolder ? Path.Combine(outPath, fileName) : outPath; + if (Entry.IsFolder) // Process Folder + Directory.CreateDirectory(parentFolder); + #endregion - int filectr = 0; - // Pull out all the files - for (int o = 0; o < garc.fato.EntryCount; o++) + uint vector = Entry.Vector; + for (int i = 0; i < 32; i++) // For each bit in vector { - var Entry = garc.fatb.Entries[o]; - // Set Entry File Name - string fileName = o.ToString(format); - - #region OutDirectory Determination - string parentFolder = Entry.IsFolder ? Path.Combine(outPath, fileName) : outPath; - if (Entry.IsFolder) // Process Folder - Directory.CreateDirectory(parentFolder); - #endregion + var SubEntry = Entry.SubEntries[i]; + if (!SubEntry.Exists) continue; + + // Seek to Offset + br.BaseStream.Position = SubEntry.Start + garc.DataOffset; - uint vector = Entry.Vector; - for (int i = 0; i < 32; i++) // For each bit in vector + // Check if Compressed + bool compressed = false; + if (!skipDecompression) { - var SubEntry = Entry.SubEntries[i]; - if (!SubEntry.Exists) continue; + try { compressed = (byte)br.PeekChar() == 0x11; } + catch { } + } - // Seek to Offset + // Write File + string fileOut = Path.Combine(parentFolder, (Entry.IsFolder ? i.ToString("00") : fileName) + "." + ext); + using (BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut))) + { + // Write out the data for the file br.BaseStream.Position = SubEntry.Start + garc.DataOffset; - - // Check if Compressed - bool compressed = false; - if (!skipDecompression) - try { compressed = (byte)br.PeekChar() == 0x11; } - catch { } - - // Write File - string fileOut = Path.Combine(parentFolder, (Entry.IsFolder ? i.ToString("00") : fileName) + "." + ext); - using (BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut))) + bw.Write(br.ReadBytes(SubEntry.Length)); + filectr++; + } + if (compressed) + #region Decompression + { + string decout = Path.Combine(Path.GetDirectoryName(fileOut), "dec_" + Path.GetFileName(fileOut)); + try { - // Write out the data for the file - br.BaseStream.Position = SubEntry.Start + garc.DataOffset; - bw.Write(br.ReadBytes(SubEntry.Length)); - filectr++; + LZSS.Decompress(fileOut, decout); + try { File.Delete(fileOut); } + catch (Exception e) { throw new Exception("A compressed file could not be deleted: " + fileOut, e); } } - if (compressed) - #region Decompression + catch { - string decout = Path.Combine(Path.GetDirectoryName(fileOut), "dec_" + Path.GetFileName(fileOut)); - try - { - LZSS.Decompress(fileOut, decout); - try { File.Delete(fileOut); } - catch (Exception e) { throw new Exception("A compressed file could not be deleted: " + fileOut, e); } - } - catch - { - // File is really not encrypted. - File.Delete(decout); - } + // File is really not encrypted. + File.Delete(decout); } - #endregion + } + #endregion - UnpackProgressed?.Invoke(null, new UnpackProgressedEventArgs { Current = filectr, Total = fileCount }); + UnpackProgressed?.Invoke(null, new UnpackProgressedEventArgs { Current = filectr, Total = fileCount }); - if ((vector >>= 1) == 0) break; - } + if ((vector >>= 1) == 0) break; } } + return fileCount; } - public static GARCFile unpackGARC(string path) + public static GARCFile UnpackGARC(string path) { - return unpackGARC(File.OpenRead(path)); + return UnpackGARC(File.OpenRead(path)); } - private static GARCFile unpackGARC(byte[] data) + private static GARCFile UnpackGARC(byte[] data) { - GARCFile garc; - using (var gd = new MemoryStream(data)) - garc = unpackGARC(gd); - return garc; + using var gd = new MemoryStream(data); + return UnpackGARC(gd); } - private static GARCFile unpackGARC(Stream stream) + private static GARCFile UnpackGARC(Stream stream) { - GARCFile garc = new GARCFile(); - using (BinaryReader br = new BinaryReader(stream)) + using BinaryReader br = new BinaryReader(stream); + GARCFile garc = new GARCFile { - // GARC Header - garc.Magic = br.ReadChars(4); - garc.HeaderSize = br.ReadUInt32(); - garc.Endianess = br.ReadUInt16(); - garc.Version = br.ReadUInt16(); - garc.ChunkCount = br.ReadUInt32(); - - garc.DataOffset = br.ReadUInt32(); - garc.FileSize = br.ReadUInt32(); - if (garc.Version == VER_4) - { - garc.ContentLargestUnpadded = br.ReadUInt32(); - garc.ContentPadToNearest = 4; - } - else if (garc.Version == VER_6) - { - garc.ContentLargestPadded = br.ReadUInt32(); - garc.ContentLargestUnpadded = br.ReadUInt32(); - garc.ContentPadToNearest = br.ReadUInt32(); - } - else - throw new FormatException("Invalid GARC Version: 0x" + garc.Version.ToString("X4")); - if (garc.ChunkCount != 4) - throw new FormatException("Invalid GARC Chunk Count: " + garc.ChunkCount); - - // FATO (File Allocation Table Offsets) - garc.fato.Magic = br.ReadChars(4); - garc.fato.HeaderSize = br.ReadInt32(); - garc.fato.EntryCount = br.ReadUInt16(); - garc.fato.Padding = br.ReadUInt16(); - - garc.fato.Entries = new FATO_Entry[garc.fato.EntryCount]; - for (int i = 0; i < garc.fato.EntryCount; i++) - garc.fato.Entries[i].Offset = br.ReadInt32(); - - // FATB (File Allocation Table Bits) - garc.fatb.Magic = br.ReadChars(4); - garc.fatb.HeaderSize = br.ReadInt32(); - garc.fatb.FileCount = br.ReadInt32(); - - garc.fatb.Entries = new FATB_Entry[garc.fato.EntryCount]; - for (int i = 0; i < garc.fato.EntryCount; i++) // Loop through all FATO entries - { - garc.fatb.Entries[i].Vector = br.ReadUInt32(); - garc.fatb.Entries[i].SubEntries = new FATB_SubEntry[32]; - uint bitvector = garc.fatb.Entries[i].Vector; - int ctr = 0; - for (int b = 0; b < 32; b++) - { - garc.fatb.Entries[i].SubEntries[b].Exists = (bitvector & 1) == 1; - bitvector >>= 1; - if (!garc.fatb.Entries[i].SubEntries[b].Exists) continue; - garc.fatb.Entries[i].SubEntries[b].Start = br.ReadInt32(); - garc.fatb.Entries[i].SubEntries[b].End = br.ReadInt32(); - garc.fatb.Entries[i].SubEntries[b].Length = br.ReadInt32(); - ctr++; - } - garc.fatb.Entries[i].IsFolder = ctr > 1; - } + Magic = br.ReadChars(4), + HeaderSize = br.ReadUInt32(), + Endianess = br.ReadUInt16(), + Version = br.ReadUInt16(), + ChunkCount = br.ReadUInt32(), + DataOffset = br.ReadUInt32(), + FileSize = br.ReadUInt32() + }; + // GARC Header + + if (garc.Version == VER_4) + { + garc.ContentLargestUnpadded = br.ReadUInt32(); + garc.ContentPadToNearest = 4; + } + else if (garc.Version == VER_6) + { + garc.ContentLargestPadded = br.ReadUInt32(); + garc.ContentLargestUnpadded = br.ReadUInt32(); + garc.ContentPadToNearest = br.ReadUInt32(); + } + else + { + throw new FormatException("Invalid GARC Version: 0x" + garc.Version.ToString("X4")); + } + + if (garc.ChunkCount != 4) + throw new FormatException("Invalid GARC Chunk Count: " + garc.ChunkCount); - // FIMB (File IMage Bytes) - garc.fimg.Magic = br.ReadChars(4); - garc.fimg.HeaderSize = br.ReadInt32(); - garc.fimg.DataSize = br.ReadInt32(); + // FATO (File Allocation Table Offsets) + garc.fato.Magic = br.ReadChars(4); + garc.fato.HeaderSize = br.ReadInt32(); + garc.fato.EntryCount = br.ReadUInt16(); + garc.fato.Padding = br.ReadUInt16(); - // Files data - // Oftentimes too large to toss into a byte array. Fetch as needed with a BinaryReader. + garc.fato.Entries = new FATO_Entry[garc.fato.EntryCount]; + for (int i = 0; i < garc.fato.EntryCount; i++) + garc.fato.Entries[i].Offset = br.ReadInt32(); + + // FATB (File Allocation Table Bits) + garc.fatb.Magic = br.ReadChars(4); + garc.fatb.HeaderSize = br.ReadInt32(); + garc.fatb.FileCount = br.ReadInt32(); + + garc.fatb.Entries = new FATB_Entry[garc.fato.EntryCount]; + for (int i = 0; i < garc.fato.EntryCount; i++) // Loop through all FATO entries + { + garc.fatb.Entries[i].Vector = br.ReadUInt32(); + garc.fatb.Entries[i].SubEntries = new FATB_SubEntry[32]; + uint bitvector = garc.fatb.Entries[i].Vector; + int ctr = 0; + for (int b = 0; b < 32; b++) + { + garc.fatb.Entries[i].SubEntries[b].Exists = (bitvector & 1) == 1; + bitvector >>= 1; + if (!garc.fatb.Entries[i].SubEntries[b].Exists) continue; + garc.fatb.Entries[i].SubEntries[b].Start = br.ReadInt32(); + garc.fatb.Entries[i].SubEntries[b].End = br.ReadInt32(); + garc.fatb.Entries[i].SubEntries[b].Length = br.ReadInt32(); + ctr++; + } + garc.fatb.Entries[i].IsFolder = ctr > 1; } + + // FIMB (File IMage Bytes) + garc.fimg.Magic = br.ReadChars(4); + garc.fimg.HeaderSize = br.ReadInt32(); + garc.fimg.DataSize = br.ReadInt32(); + + // Files data + // Oftentimes too large to toss into a byte array. Fetch as needed with a BinaryReader. return garc; } - public static MemGARC packGARC(byte[][] data, int version, int contentpadnearest) + public static MemGARC PackGARC(byte[][] data, int version, int contentpadnearest) { if (contentpadnearest < 0) contentpadnearest = 4; @@ -568,8 +569,8 @@ public static MemGARC packGARC(byte[][] data, int version, int contentpadnearest gw.Write(garc.fato.HeaderSize); // Header Size gw.Write(garc.fato.EntryCount); // Entry Count gw.Write(garc.fato.Padding); // Padding - for (int i = 0; i < garc.fato.Entries.Length; i++) - gw.Write((uint) garc.fato.Entries[i].Offset); + foreach (var t in garc.fato.Entries) + gw.Write((uint) t.Offset); // Write FATB gw.Write((uint) 0x46415442); // FATB @@ -677,11 +678,11 @@ public class MemGARC public MemGARC(byte[] data) { Data = data; - garc = unpackGARC(data); + garc = UnpackGARC(data); } // Returns an individual file - public byte[] getFile(int file, int subfile = 0) + public byte[] GetFile(int file, int subfile = 0) { var Entry = garc.fatb.Entries[file]; var SubEntry = Entry.SubEntries[subfile]; @@ -700,7 +701,7 @@ public byte[][] Files { byte[][] data = new byte[FileCount][]; for (int i = 0; i < data.Length; i++) - data[i] = getFile(i); + data[i] = GetFile(i); return data; } set @@ -708,7 +709,7 @@ public byte[][] Files if (value == null || value.Length != FileCount) throw new ArgumentException(); - var ng = packGARC(value, garc.Version, (int)garc.ContentPadToNearest); + var ng = PackGARC(value, garc.Version, (int)garc.ContentPadToNearest); garc = ng.garc; Data = ng.Data; } @@ -718,16 +719,16 @@ public byte[][] Files /// /// GARC Class that is heavier on OOP to allow for compression tracking for faster edits /// - public class lzGARC + public class LazyGARC { private GARCFile garc; private byte[] Data; public int FileCount => garc.fato.EntryCount; - public lzGARC(byte[] data) + public LazyGARC(byte[] data) { Data = data; - garc = unpackGARC(data); + garc = UnpackGARC(data); Storage = new GARCEntry[FileCount]; } @@ -735,17 +736,13 @@ public lzGARC(byte[] data) private class GARCEntry { - public bool Accessed; public bool Saved; public byte[] Data; - public readonly bool WasCompressed; - - public GARCEntry() { } + private readonly bool WasCompressed; public GARCEntry(byte[] data) { Data = data; - Accessed = true; if (data.Length == 0) return; @@ -773,18 +770,16 @@ public byte[] Save() byte[] data; try { - using (MemoryStream newMS = new MemoryStream()) - { - LZSS.Compress(new MemoryStream(Data), Data.Length, newMS, original: true); - data = newMS.ToArray(); - } + using MemoryStream newMS = new MemoryStream(); + LZSS.Compress(new MemoryStream(Data), Data.Length, newMS, original: true); + data = newMS.ToArray(); } - catch { data = new byte[0]; } + catch { data = Array.Empty(); } return data; } } - private byte[] getFile(int file, int subfile = 0) + private byte[] GetFile(int file, int subfile = 0) { var Entry = garc.fatb.Entries[file]; var SubEntry = Entry.SubEntries[subfile]; @@ -803,14 +798,12 @@ public byte[] this[int file] if (file > FileCount) throw new ArgumentException(); - if (Storage[file] == null) - Storage[file] = new GARCEntry(getFile(file, 0)); + Storage[file] ??= new GARCEntry(GetFile(file, 0)); return Storage[file].Data; } set { - if (Storage[file] == null) - Storage[file] = new GARCEntry(value); + Storage[file] ??= new GARCEntry(value); Storage[file].Data = value; Storage[file].Saved = true; } @@ -821,20 +814,20 @@ public byte[] Save() byte[][] data = new byte[FileCount][]; for (int i = 0; i < data.Length; i++) { - if (Storage[i] == null || !Storage[i].Saved) // retrieve original - data[i] = getFile(i, 0); + if (Storage[i]?.Saved != true) // retrieve original + data[i] = GetFile(i, 0); else // use modified data[i] = Storage[i].Save(); } - var ng = packGARC(data, garc.Version, (int)garc.ContentPadToNearest); + var ng = PackGARC(data, garc.Version, (int)garc.ContentPadToNearest); garc = ng.garc; Data = ng.Data; return Data; } } - public struct GARCFile + public class GARCFile { public char[] Magic; // Always GARC = 0x4E415243 public uint HeaderSize; // Always 0x001C @@ -844,7 +837,7 @@ public struct GARCFile public uint DataOffset; public uint FileSize; - + public uint ContentLargestPadded; // Format 6 Only public uint ContentLargestUnpadded; public uint ContentPadToNearest; // Format 6 Only (4 bytes is standard in VER_4, and is not stored) @@ -854,7 +847,7 @@ public struct GARCFile public FIMG fimg; } - public struct FATO + public class FATO { public char[] Magic; public int HeaderSize; @@ -864,12 +857,12 @@ public struct FATO public FATO_Entry[] Entries; } - public struct FATO_Entry + public class FATO_Entry { public int Offset; } - public struct FATB + public class FATB { public char[] Magic; public int HeaderSize; @@ -878,14 +871,14 @@ public struct FATB public FATB_Entry[] Entries; } - public struct FATB_Entry + public class FATB_Entry { public uint Vector; public bool IsFolder; public FATB_SubEntry[] SubEntries; } - public struct FATB_SubEntry + public class FATB_SubEntry { public bool Exists; public int Start; @@ -896,7 +889,7 @@ public struct FATB_SubEntry public int Padding { get; set; } } - public struct FIMG + public class FIMG { public char[] Magic; public int HeaderSize; @@ -904,4 +897,4 @@ public struct FIMG } } #endregion -} \ No newline at end of file +} diff --git a/pk3DS.Core/CTR/Images/BCLIM.cs b/pk3DS.Core/CTR/Images/BCLIM.cs index 78dba2f2a4..1eefdeaef4 100644 --- a/pk3DS.Core/CTR/Images/BCLIM.cs +++ b/pk3DS.Core/CTR/Images/BCLIM.cs @@ -11,15 +11,15 @@ public class BCLIM : BXLIM public BCLIM(byte[] data) { - using (var ms = new MemoryStream(data)) - ReadBCLIM(ms); + using var ms = new MemoryStream(data); + ReadBCLIM(ms); } public BCLIM(string path) { var data = File.ReadAllBytes(path); - using (var ms = new MemoryStream(data)) - ReadBCLIM(ms); + using var ms = new MemoryStream(data); + ReadBCLIM(ms); } private void ReadBCLIM(Stream ms) @@ -40,35 +40,33 @@ public override uint[] GetPixels() private uint[] GetPixelsViaPalette() { - using (var ms = new MemoryStream(PixelData)) - using (var br = new BinaryReader(ms)) + using var ms = new MemoryStream(PixelData); + using var br = new BinaryReader(ms); + if (br.ReadUInt16() != 2) return null; + + // read palette + int count = br.ReadUInt16(); + uint[] colors = new uint[count]; + for (int i = 0; i < colors.Length; i++) + colors[i] = PixelConverter.GetDecodedPixelValue(br.ReadUInt16(), XLIMEncoding.RGB565); + + // read pixels + bool half = colors.Length < 0x10; + uint[] pixels = new uint[BaseSize * BaseSize]; + for (int i = 0; i < pixels.Length; i++) { - if (br.ReadUInt16() != 2) return null; - - // read palette - int count = br.ReadUInt16(); - uint[] colors = new uint[count]; - for (int i = 0; i < colors.Length; i++) - colors[i] = PixelConverter.GetDecodedPixelValue(br.ReadUInt16(), XLIMEncoding.RGB565); - - // read pixels - bool half = colors.Length < 0x10; - uint[] pixels = new uint[BaseSize * BaseSize]; - for (int i = 0; i < pixels.Length; i++) + var b = br.ReadByte(); + if (!half) { - var b = br.ReadByte(); - if (!half) - { - pixels[i] = colors[b]; - } - else - { - pixels[i++] = colors[b & 0xF]; - pixels[i] = colors[b >> 4]; - } + pixels[i] = colors[b]; + } + else + { + pixels[i++] = colors[b & 0xF]; + pixels[i] = colors[b >> 4]; } - return pixels; } + return pixels; } // todo: move System.Drawing utilization out, make encoding generic for bflim @@ -79,13 +77,15 @@ public static byte[] IMGToBCLIM(Image img, char fc) int bclimformat = 7; // Init to default (for X) if (fc == 'X') - write16BitColorPalette(mBitmap, ref ms); + { + Write16BitColorPalette(mBitmap, ref ms); + } else { bclimformat = Convert.ToInt16(fc.ToString(), 16); try { - writeGeneric(bclimformat, mBitmap, ref ms); + WriteGeneric(bclimformat, mBitmap, ref ms); } catch (Exception e) { @@ -114,31 +114,29 @@ public static byte[] IMGToBCLIM(Image img, char fc) return ms.ToArray(); } - public static byte[] getBCLIM(string path, char fc) + public static byte[] GetBCLIM(string path, char fc) { byte[] byteArray = File.ReadAllBytes(path); - using (Stream BitmapStream = new MemoryStream(byteArray)) // Open the file, even if it is in use. - { - Image img = Image.FromStream(BitmapStream); - return IMGToBCLIM(img, fc); - } + using Stream BitmapStream = new MemoryStream(byteArray); + Image img = Image.FromStream(BitmapStream); + return IMGToBCLIM(img, fc); } - public static Image makeBCLIM(string path, char fc) + public static Image MakeBCLIM(string path, char fc) { - byte[] bclim = getBCLIM(path, fc); + byte[] bclim = GetBCLIM(path, fc); string fp = Path.GetFileNameWithoutExtension(path); fp = "new_" + fp.Substring(fp.IndexOf('_') + 1); string pp = Path.GetDirectoryName(path); string newPath = Path.Combine(pp, fp + ".bclim"); File.WriteAllBytes(newPath, bclim); - return makeBMP(newPath); + return MakeBMP(newPath); } - public static Image makeBMP(string path, bool autosave = false, bool crop = true) + public static Image MakeBMP(string path, bool autosave = false, bool crop = true) { - BCLIM bclim = analyze(path); + BCLIM bclim = Analyze(path); if (bclim.Magic != 0x4D494C43) { System.Media.SystemSounds.Beep.Play(); @@ -156,107 +154,103 @@ public static Image makeBMP(string path, bool autosave = false, bool crop = true } // BCLIM Data Writing - public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms) + public static int Write16BitColorPalette(Bitmap img, ref MemoryStream ms) { - using (Stream pixelcolors = new MemoryStream()) - using (BinaryWriter bz = new BinaryWriter(pixelcolors)) + using Stream pixelcolors = new MemoryStream(); + using BinaryWriter bz = new BinaryWriter(pixelcolors); + // Set up our basis. + bool under16colors = false; + int colors = GetColorCount(img); + Color[] pcs = new Color[colors]; + if (colors < 16) under16colors = true; + uint div = 1; + if (under16colors) + div = 2; + + if (colors > 70) throw new Exception("Too many colors"); + + // Set up a new reverse image to build into. + int w = XLIMUtil.GreatestCommonMultiple(img.Width, 8); + int h = XLIMUtil.GreatestCommonMultiple(img.Height, 8); + w = Math.Max(XLIMUtil.NextLargestPow2(w), XLIMUtil.NextLargestPow2(h)); + h = w; + byte[] pixelarray = new byte[w * h]; + + const int colorformat = 2; + int ctr = 1; + + pcs[0] = Color.FromArgb(0, 0xFF, 0xFF, 0xFF); + + int p = XLIMUtil.GreatestCommonMultiple(w, 8) / 8; + if (p == 0) p = 1; + int d = 0; + for (uint i = 0; i < pixelarray.Length; i++) { - // Set up our basis. - bool under16colors = false; - int colors = getColorCount(img); - Color[] pcs = new Color[colors]; - if (colors < 16) under16colors = true; - uint div = 1; - if (under16colors) - div = 2; - - if (colors > 70) throw new Exception("Too many colors"); - - // Set up a new reverse image to build into. - int w = XLIMUtil.gcm(img.Width, 8); - int h = XLIMUtil.gcm(img.Height, 8); - w = Math.Max(XLIMUtil.nlpo2(w), XLIMUtil.nlpo2(h)); - h = w; - byte[] pixelarray = new byte[w * h]; - - const int colorformat = 2; - int ctr = 1; - - pcs[0] = Color.FromArgb(0, 0xFF, 0xFF, 0xFF); - - int p = XLIMUtil.gcm(w, 8) / 8; - if (p == 0) p = 1; - int d = 0; - for (uint i = 0; i < pixelarray.Length; i++) - { - d = (int)(i / div); - // Get Tile Coordinate - uint x; - uint y; - XLIMOrienter.d2xy(i % 64, out x, out y); - - // Get Shift Tile - uint tile = i / 64; - - // Shift Tile Coordinate into Tilemap - x += (uint)(tile % p) * 8; - y += (uint)(tile / p) * 8; - if (x >= img.Width || y >= img.Height) // Don't try to access any pixel data outside of our bounds. - { i++; continue; } // Goto next tile. - - // Get Color of Pixel - Color c = img.GetPixel((int)x, (int)y); - - // Color Table Building Logic - int index = Array.IndexOf(pcs, c); - if (c.A == 0) index = 0; - if (index < 0) // If new color - { pcs[ctr] = c; index = ctr; ctr++; } // Add it to color list - - // Add pixel to pixeldata - if (under16colors) index = index << 4; - pixelarray[i / div] = (byte)index; - if (!under16colors) continue; - - c = img.GetPixel((int)x + 1, (int)y); - index = Array.IndexOf(pcs, c); - if (c.A == 0) index = 0; - if (index < 0) // If new color - { pcs[ctr] = c; index = ctr; ctr++; } - pixelarray[i / div] |= (byte)index; - i++; - } + d = (int)(i / div); + // Get Tile Coordinate + XLIMOrienter.DecimalToCartesian(i % 64, out var x, out var y); - // Write Intro - bz.Write((ushort)colorformat); bz.Write((ushort)ctr); - // Write Colors - for (int i = 0; i < ctr; i++) - bz.Write((ushort)GetRGBA5551(pcs[i])); // Write byte array. - // Write Pixel Data - for (uint i = 0; i < d; i++) - bz.Write(pixelarray[i]); - // Write Padding - while (pixelcolors.Length < XLIMUtil.nlpo2((int)pixelcolors.Length)) - bz.Write((byte)0); - // Copy to main CLIM. - pixelcolors.Position = 0; pixelcolors.CopyTo(ms); + // Get Shift Tile + uint tile = i / 64; + + // Shift Tile Coordinate into Tilemap + x += (uint)(tile % p) * 8; + y += (uint)(tile / p) * 8; + if (x >= img.Width || y >= img.Height) // Don't try to access any pixel data outside of our bounds. + { i++; continue; } // Goto next tile. + + // Get Color of Pixel + Color c = img.GetPixel((int)x, (int)y); + + // Color Table Building Logic + int index = Array.IndexOf(pcs, c); + if (c.A == 0) index = 0; + if (index < 0) // If new color + { pcs[ctr] = c; index = ctr; ctr++; } // Add it to color list + + // Add pixel to pixeldata + if (under16colors) index <<= 4; + pixelarray[i / div] = (byte)index; + if (!under16colors) continue; + + c = img.GetPixel((int)x + 1, (int)y); + index = Array.IndexOf(pcs, c); + if (c.A == 0) index = 0; + if (index < 0) // If new color + { pcs[ctr] = c; index = ctr; ctr++; } + pixelarray[i / div] |= (byte)index; + i++; } + + // Write Intro + bz.Write((ushort)colorformat); bz.Write((ushort)ctr); + // Write Colors + for (int i = 0; i < ctr; i++) + bz.Write(GetRGBA5551(pcs[i])); // Write byte array. + // Write Pixel Data + for (uint i = 0; i < d; i++) + bz.Write(pixelarray[i]); + // Write Padding + while (pixelcolors.Length < XLIMUtil.NextLargestPow2((int)pixelcolors.Length)) + bz.Write((byte)0); + // Copy to main CLIM. + pixelcolors.Position = 0; pixelcolors.CopyTo(ms); return 7; } - public static void writeGeneric(int format, Bitmap img, ref MemoryStream ms, bool rectangle = true) + public static void WriteGeneric(int format, Bitmap img, ref MemoryStream ms, bool rectangle = true) { - BinaryWriter bz = new BinaryWriter(ms); - bz.Write(getPixelData(img, format, rectangle)); + using var bz = new BinaryWriter(ms); + bz.Write(GetPixelData(img, format, rectangle)); bz.Flush(); } public static byte[] MakePixelData(byte[] input, ref int w, ref int h, XLIMOrientation x = XLIMOrientation.None) { int width = w; - w = XLIMUtil.nlpo2(w); - h = XLIMUtil.nlpo2(h); - if (!(Math.Min(w, h) < 32)) + w = XLIMUtil.NextLargestPow2(w); + h = XLIMUtil.NextLargestPow2(h); + if (Math.Min(w, h) >= 32) w = h = Math.Max(w, h); // resize byte[] pixels = new byte[w * h * 4]; @@ -270,7 +264,7 @@ public static byte[] MakePixelData(byte[] input, ref int w, ref int h, XLIMOrien return pixels; } - public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true) + public static byte[] GetPixelData(Bitmap img, int format, bool rectangle = true) { int w = img.Width; int h = img.Height; @@ -281,81 +275,82 @@ public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true) // Square Format Checks if (rectangle && Math.Min(img.Width, img.Height) < 32) { - w = XLIMUtil.nlpo2(img.Width); - h = XLIMUtil.nlpo2(img.Height); + w = XLIMUtil.NextLargestPow2(img.Width); + h = XLIMUtil.NextLargestPow2(img.Height); } else { - w = h = Math.Max(XLIMUtil.nlpo2(w), XLIMUtil.nlpo2(h)); // else resize + w = h = Math.Max(XLIMUtil.NextLargestPow2(w), XLIMUtil.NextLargestPow2(h)); // else resize } } - using (MemoryStream mz = new MemoryStream()) - using (BinaryWriter bz = new BinaryWriter(mz)) + using MemoryStream mz = new MemoryStream(); + using BinaryWriter bz = new BinaryWriter(mz); + int p = XLIMUtil.GreatestCommonMultiple(w, 8) / 8; + if (p == 0) p = 1; + for (uint i = 0; i < w * h; i++) { - int p = XLIMUtil.gcm(w, 8) / 8; - if (p == 0) p = 1; - for (uint i = 0; i < w * h; i++) - { - XLIMOrienter.d2xy(i % 64, out uint x, out uint y); + XLIMOrienter.DecimalToCartesian(i % 64, out uint x, out uint y); - // Get Shift Tile - uint tile = i / 64; + // Get Shift Tile + uint tile = i / 64; - // Shift Tile Coordinate into Tilemap - x += (uint)(tile % p) * 8; - y += (uint)(tile / p) * 8; + // Shift Tile Coordinate into Tilemap + x += (uint)(tile % p) * 8; + y += (uint)(tile / p) * 8; - // Don't write data - Color c; - if (x >= img.Width || y >= img.Height) - { c = Color.FromArgb(0, 0, 0, 0); } - else - { c = img.GetPixel((int)x, (int)y); if (c.A == 0) c = Color.FromArgb(0, 86, 86, 86); } + // Don't write data + Color c; + if (x >= img.Width || y >= img.Height) + { c = Color.FromArgb(0, 0, 0, 0); } + else + { c = img.GetPixel((int)x, (int)y); if (c.A == 0) c = Color.FromArgb(0, 86, 86, 86); } - switch (format) + switch (format) + { + case 0: bz.Write(GetL8(c)); break; // L8 + case 1: bz.Write(GetA8(c)); break; // A8 + case 2: bz.Write(GetLA4(c)); break; // LA4(4) + case 3: bz.Write(GetLA8(c)); break; // LA8(8) + case 4: bz.Write(GetHILO8(c)); break; // HILO8 + case 5: bz.Write(GetRGB565(c)); break; // RGB565 + case 6: + { + bz.Write(c.B); + bz.Write(c.G); + bz.Write(c.R); break; + } + case 7: bz.Write(GetRGBA5551(c)); break; // RGBA5551 + case 8: bz.Write(GetRGBA4444(c)); break; // RGBA4444 + case 9: bz.Write(GetRGBA8888(c)); break; // RGBA8 + case 10: throw new Exception("ETC1 not supported."); + case 11: throw new Exception("ETC1A4 not supported."); + case 12: + { + byte val = (byte)(GetL8(c) / 0x11); // First Pix // L4 + { c = img.GetPixel((int)x, (int)y); if (c.A == 0) c = Color.FromArgb(0, 0, 0, 0); } + val |= (byte)((GetL8(c) / 0x11) << 4); i++; + bz.Write(val); break; + } + case 13: { - case 0: bz.Write((byte)GetL8(c)); break; // L8 - case 1: bz.Write((byte)GetA8(c)); break; // A8 - case 2: bz.Write((byte)GetLA4(c)); break; // LA4(4) - case 3: bz.Write((ushort)GetLA8(c)); break; // LA8(8) - case 4: bz.Write((ushort)GetHILO8(c)); break; // HILO8 - case 5: bz.Write((ushort)GetRGB565(c)); break; // RGB565 - case 6: - { - bz.Write(c.B); - bz.Write(c.G); - bz.Write(c.R); break; - } - case 7: bz.Write((ushort)GetRGBA5551(c)); break; // RGBA5551 - case 8: bz.Write((ushort)GetRGBA4444(c)); break; // RGBA4444 - case 9: bz.Write((uint)GetRGBA8888(c)); break; // RGBA8 - case 10: throw new Exception("ETC1 not supported."); - case 11: throw new Exception("ETC1A4 not supported."); - case 12: - { - byte val = (byte)(GetL8(c) / 0x11); // First Pix // L4 - { c = img.GetPixel((int)x, (int)y); if (c.A == 0) c = Color.FromArgb(0, 0, 0, 0); } - val |= (byte)((GetL8(c) / 0x11) << 4); i++; - bz.Write(val); break; - } - case 13: - { - byte val = (byte)(GetA8(c) / 0x11); // First Pix // L4 - { c = img.GetPixel((int)x, (int)y); } - val |= (byte)((GetA8(c) / 0x11) << 4); i++; - bz.Write(val); break; - } + byte val = (byte)(GetA8(c) / 0x11); // First Pix // L4 + { c = img.GetPixel((int)x, (int)y); } + val |= (byte)((GetA8(c) / 0x11) << 4); i++; + bz.Write(val); break; } } - if (!perfect) - while (mz.Length < XLIMUtil.nlpo2((int)mz.Length)) // pad - bz.Write((byte)0); - return mz.ToArray(); } + if (!perfect) + { + while (mz.Length < XLIMUtil.NextLargestPow2((int)mz.Length)) // pad + bz.Write((byte)0); + } + + return mz.ToArray(); } - public static int getColorCount(Bitmap img) + public static int GetColorCount(Bitmap img) { Color[] colors = new Color[img.Width * img.Height]; int colorct = 1; @@ -407,19 +402,19 @@ internal static ushort GetRGB565(Color c) { int val = 0; // val += c.A >> 8; // unused - val += convert8to5(c.B) >> 3; + val += Convert8to5(c.B) >> 3; val += (c.G >> 2) << 5; - val += convert8to5(c.R) << 10; + val += Convert8to5(c.R) << 10; return (ushort)val; } // RGB565 // RGB8 internal static ushort GetRGBA5551(Color c) { int val = 0; - val += (byte)(c.A > 0x80 ? 1 : 0); - val += convert8to5(c.R) << 11; - val += convert8to5(c.G) << 6; - val += convert8to5(c.B) << 1; + val += c.A > 0x80 ? 1 : 0; + val += Convert8to5(c.R) << 11; + val += Convert8to5(c.G) << 6; + val += Convert8to5(c.B) << 1; ushort v = (ushort)val; return v; @@ -446,7 +441,7 @@ internal static uint GetRGBA8888(Color c) // RGBA8888 } // Unit Conversion - internal static byte convert8to5(int colorval) + internal static byte Convert8to5(int colorval) { byte[] Convert8to5 = { 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, @@ -457,9 +452,9 @@ internal static byte convert8to5(int colorval) return i; } - public static BCLIM analyze(byte[] data, string shortPath) + public static BCLIM Analyze(byte[] data, string shortPath) { - BCLIM bclim = new BCLIM(data) + var bclim = new BCLIM(data) { FileName = Path.GetFileNameWithoutExtension(shortPath), FilePath = Path.GetDirectoryName(shortPath), @@ -468,10 +463,10 @@ public static BCLIM analyze(byte[] data, string shortPath) return bclim; } - public static BCLIM analyze(string path) + public static BCLIM Analyze(string path) { byte[] data = File.ReadAllBytes(path); - return analyze(data, path); + return Analyze(data, path); } } } \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/BFLIM.cs b/pk3DS.Core/CTR/Images/BFLIM.cs index 954eaff4d3..50f1aaf50f 100644 --- a/pk3DS.Core/CTR/Images/BFLIM.cs +++ b/pk3DS.Core/CTR/Images/BFLIM.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using System.IO; using pk3DS.Core.CTR.Images; namespace pk3DS.Core.CTR @@ -10,15 +9,15 @@ public class BFLIM : BXLIM public BFLIM(byte[] data) { - using (var ms = new MemoryStream(data)) - ReadBFLIM(ms); + using var ms = new MemoryStream(data); + ReadBFLIM(ms); } public BFLIM(string path) { var data = File.ReadAllBytes(path); - using (var ms = new MemoryStream(data)) - ReadBFLIM(ms); + using var ms = new MemoryStream(data); + ReadBFLIM(ms); } private void ReadBFLIM(Stream ms) diff --git a/pk3DS.Core/CTR/Images/BXLIM.cs b/pk3DS.Core/CTR/Images/BXLIM.cs index ae10fb5fa1..3040ba94e2 100644 --- a/pk3DS.Core/CTR/Images/BXLIM.cs +++ b/pk3DS.Core/CTR/Images/BXLIM.cs @@ -18,7 +18,7 @@ public abstract class BXLIM : IXLIMHeader public string FileName { get; set; } public string FilePath { get; set; } public string Extension { get; set; } - public int BaseSize => Math.Max(XLIMUtil.nlpo2(Width), XLIMUtil.nlpo2(Height)); + public int BaseSize => Math.Max(XLIMUtil.NextLargestPow2(Width), XLIMUtil.NextLargestPow2(Height)); /// /// ARGB 32bpp diff --git a/pk3DS.Core/CTR/Images/PixelConverter.cs b/pk3DS.Core/CTR/Images/PixelConverter.cs index 73129ee9b0..d098d9ec5a 100644 --- a/pk3DS.Core/CTR/Images/PixelConverter.cs +++ b/pk3DS.Core/CTR/Images/PixelConverter.cs @@ -42,7 +42,7 @@ public static IEnumerable GetPixels(byte[] raw, XLIMEncoding e) internal static uint GetDecodedPixelValue(uint val, XLIMEncoding e) { - byte a = byte.MaxValue, r = 0, g = 0, b = 0; + byte a = byte.MaxValue, r, g, b; switch (e) { case XLIMEncoding.L4: @@ -123,17 +123,13 @@ internal static uint GetDecodedPixelValue(uint val, XLIMEncoding e) public static uint GetEncodedPixelValue(byte[] raw, int offset, int size) { - switch (size) + return size switch { - case BPP_32: - return BitConverter.ToUInt32(raw, offset); - case BPP_24: - return BitConverter.ToUInt32(raw, offset) & 0x00FFFFFF; - case BPP_16: - return BitConverter.ToUInt16(raw, offset); - default: - return raw[offset]; - } + BPP_32 => BitConverter.ToUInt32(raw, offset), + BPP_24 => BitConverter.ToUInt32(raw, offset) & 0x00FFFFFF, + BPP_16 => BitConverter.ToUInt16(raw, offset), + _ => raw[offset], + }; } public static int GetBitsPerPixel(this XLIMEncoding e) @@ -149,17 +145,17 @@ public static int GetBitsPerPixel(this XLIMEncoding e) return BPP_4; } - private static readonly HashSet _32 = new HashSet + private static readonly HashSet _32 = new() { XLIMEncoding.RGBA8, }; - private static readonly HashSet _24 = new HashSet + private static readonly HashSet _24 = new() { XLIMEncoding.RGBX8, }; - private static readonly HashSet _16 = new HashSet + private static readonly HashSet _16 = new() { XLIMEncoding.LA8, XLIMEncoding.HILO8, @@ -168,7 +164,7 @@ public static int GetBitsPerPixel(this XLIMEncoding e) XLIMEncoding.RGBA4, }; - private static readonly HashSet _8 = new HashSet + private static readonly HashSet _8 = new() { XLIMEncoding.L8, XLIMEncoding.A8, diff --git a/pk3DS.Core/CTR/Images/XLIMOrientation.cs b/pk3DS.Core/CTR/Images/XLIMOrientation.cs index 3426c497b2..eba5f571bf 100644 --- a/pk3DS.Core/CTR/Images/XLIMOrientation.cs +++ b/pk3DS.Core/CTR/Images/XLIMOrientation.cs @@ -9,4 +9,12 @@ public enum XLIMOrientation : byte Rotate90 = 4, Transpose = 8, } + + public static class XlimOrientationExtensions + { + public static bool HasFlagFast(this XLIMOrientation value, XLIMOrientation flag) + { + return (value & flag) != 0; + } + } } \ No newline at end of file diff --git a/pk3DS.Core/CTR/Images/XLIMOrienter.cs b/pk3DS.Core/CTR/Images/XLIMOrienter.cs index f37e0d2c7d..039e5bf2ec 100644 --- a/pk3DS.Core/CTR/Images/XLIMOrienter.cs +++ b/pk3DS.Core/CTR/Images/XLIMOrienter.cs @@ -4,26 +4,26 @@ namespace pk3DS.Core.CTR { public class XLIMOrienter { - readonly XLIMOrientation _orientation; + private readonly XLIMOrientation _orientation; public uint Width { get; } public uint Height { get; } public uint PanelsPerWidth { get; } - + public XLIMOrienter(int width, int height, XLIMOrientation orientation) { - Width = (uint)nlpo2(gcm(width, 8)); - Height = (uint)nlpo2(gcm(height, 8)); + Width = (uint)NextLargestPow2(GreatestCommonMultiple(width, 8)); + Height = (uint)NextLargestPow2(GreatestCommonMultiple(height, 8)); uint stride = orientation == XLIMOrientation.None ? Width : Height; - PanelsPerWidth = (uint)gcm((int)stride, 8) / 8; + PanelsPerWidth = (uint)GreatestCommonMultiple((int)stride, 8) / 8; _orientation = orientation; } public Coordinate Get(uint i) { - d2xy(i & 0x3F, out uint x, out uint y); + DecimalToCartesian(i & 0x3F, out uint x, out uint y); // Shift Tile Coordinate into Tilemap var tile = i >> 6; @@ -31,9 +31,9 @@ public Coordinate Get(uint i) y |= (tile / PanelsPerWidth) << 3; var coord = new Coordinate(x, y); - if (_orientation.HasFlag(XLIMOrientation.Rotate90)) + if (_orientation.HasFlagFast(XLIMOrientation.Rotate90)) coord.Rotate90(Height); - if (_orientation.HasFlag(XLIMOrientation.Transpose)) + if (_orientation.HasFlagFast(XLIMOrientation.Transpose)) coord.Transpose(); return coord; } @@ -56,7 +56,7 @@ internal static uint C11(uint x) /// /// /// - internal static uint xy2d(uint x, uint y) + internal static uint CartesianToDecimal(uint x, uint y) { x &= 0x0000ffff; y &= 0x0000ffff; @@ -85,7 +85,7 @@ internal static uint xy2d(uint x, uint y) /// Loop integer which will be decoded to X/Y /// Output X coordinate /// Output Y coordinate - internal static void d2xy(uint d, out uint x, out uint y) + internal static void DecimalToCartesian(uint d, out uint x, out uint y) { x = d; y = x >> 1; diff --git a/pk3DS.Core/CTR/Images/XLIMUtil.cs b/pk3DS.Core/CTR/Images/XLIMUtil.cs index a1985c1c6e..b0f70d797c 100644 --- a/pk3DS.Core/CTR/Images/XLIMUtil.cs +++ b/pk3DS.Core/CTR/Images/XLIMUtil.cs @@ -8,7 +8,7 @@ public static class XLIMUtil /// Number to round-up. /// Multiple to round-up to. /// Rounded up number. - internal static int gcm(int n, int m) + internal static int GreatestCommonMultiple(int n, int m) { return (n + m - 1) / m * m; } @@ -18,7 +18,7 @@ internal static int gcm(int n, int m) /// /// Input to round up to next 2^n /// 2^n > x && x > 2^(n-1) - internal static int nlpo2(int x) + internal static int NextLargestPow2(int x) { x--; // comment out to always take the next biggest power of two, even if x is already a power of two x |= x >> 1; diff --git a/pk3DS.Core/CTR/LZSS.cs b/pk3DS.Core/CTR/LZSS.cs index 26f9aa4eb3..65d7938138 100644 --- a/pk3DS.Core/CTR/LZSS.cs +++ b/pk3DS.Core/CTR/LZSS.cs @@ -4,7 +4,7 @@ namespace pk3DS.Core.CTR { // LZSS (de)compression, heavily taken from dsdecmp - public static class LZSS + public static class LZSS { public static long Decompress(string infile, string outfile) { @@ -13,18 +13,16 @@ public static long Decompress(string infile, string outfile) if (!Directory.Exists(outDirectory)) Directory.CreateDirectory(outDirectory); // open the two given files, and delegate to the format-specific code. - using (FileStream inStream = new FileStream(infile, FileMode.Open), - outStream = new FileStream(outfile, FileMode.Create)) - { - return Decompress(inStream, inStream.Length, outStream); - } + using FileStream inStream = new(infile, FileMode.Open), + outStream = new(outfile, FileMode.Create); + return Decompress(inStream, inStream.Length, outStream); } /// /// Decompresses the given stream, writing the decompressed data to the given output stream. - /// Assumes Supports(instream) returns true. + /// Assumes Supports(instream) returns true. /// After this call, the input stream will be positioned at the end of the compressed stream, - /// or at the initial position + inLength, whichever comes first. + /// or at the initial position + inLength, whichever comes first. /// /// The stream to decompress. At the end of this method, the position /// of this stream is directly after the compressed data. @@ -78,8 +76,7 @@ Bit 16-23 Disp LSBs byte type = (byte)instream.ReadByte(); if (type != 0x11) - throw new InvalidDataException("The provided stream is not a valid LZ-0x11 " - + "compressed stream (invalid type 0x" + type.ToString("X") + ")"); + throw new InvalidDataException($"The provided stream is not a valid LZ-0x11 compressed stream (invalid type 0x{type:X})"); byte[] sizeBytes = new byte[3]; instream.Read(sizeBytes, 0, 3); int decompressedSize = IOUtils.ToNDSu24(sizeBytes, 0); @@ -203,10 +200,10 @@ Bit 16-23 Disp LSBs } if (disp > currentOutSize) - throw new InvalidDataException("Cannot go back more than already written. " - + "DISP = " + disp + ", #written bytes = 0x" + currentOutSize.ToString("X") - + " before 0x" + instream.Position.ToString("X") + " with indicator 0x" - + (byte1 >> 4).ToString("X")); + { + throw new InvalidDataException($"Cannot go back more than already written. DISP = {disp}, #written bytes = 0x{currentOutSize:X} before 0x{instream.Position:X} with indicator 0x{byte1 >> 4:X}"); + } + #endregion int bufIdx = bufferOffset + bufferLength - disp; @@ -251,18 +248,16 @@ public static int Compress(string infile, string outfile) if (!Directory.Exists(outDirectory)) Directory.CreateDirectory(outDirectory); // open the proper Streams, and delegate to the format-specific code. - using (FileStream inStream = File.Open(infile, FileMode.Open), - outStream = File.Create(outfile)) + using FileStream inStream = File.Open(infile, FileMode.Open), + outStream = File.Create(outfile); + if (inStream.Length == 0) // empty file 'compression' to lzss container { - if (inStream.Length == 0) // empty file 'compression' to lzss container - { - byte[] blank = {0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - outStream.Write(blank, 0, blank.Length); - return blank.Length; - } - - return Compress(inStream, inStream.Length, outStream, true); + byte[] blank = {0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + outStream.Write(blank, 0, blank.Length); + return blank.Length; } + + return Compress(inStream, inStream.Length, outStream, true); } #region Original compression method /// @@ -325,10 +320,9 @@ internal static unsafe int Compress(Stream instream, long inLength, Stream outst // determine if we're dealing with a compressed or raw block. // it is a compressed block when the next 3 or more bytes can be copied from // somewhere in the set of already compressed bytes. - int disp; int oldLength = Math.Min(readBytes, 0x1000); int length = LZUtil.GetOccurrenceLength(instart + readBytes, (int)Math.Min(inLength - readBytes, 0x10110), - instart + readBytes - oldLength, oldLength, out disp); + instart + readBytes - oldLength, oldLength, out var disp); // length not 3 or more? next byte is raw data if (length < 3) @@ -424,8 +418,7 @@ internal static unsafe int CompressWithLA(Stream instream, long inLength, Stream int readBytes = 0; // get the optimal choices for len and disp - int[] lengths, disps; - GetOptimalCompressionLengths(instart, indata.Length, out lengths, out disps); + GetOptimalCompressionLengths(instart, indata.Length, out var lengths, out var disps); while (readBytes < inLength) { // we can only buffer 8 blocks at a time. @@ -570,6 +563,7 @@ internal static unsafe void GetOptimalCompressionLengths(byte* indata, int inLen /// An exception indicating that the file cannot be compressed, because the decompressed size /// cannot be represented in the current compression format. /// + [Serializable] public class InputTooLargeException : Exception { /// @@ -578,12 +572,25 @@ public class InputTooLargeException : Exception public InputTooLargeException() : base("The compression ratio is not high enough to fit the input " + "in a single compressed file.") { } + + public InputTooLargeException(string message) : base(message) + { + } + + public InputTooLargeException(string message, Exception innerException) : base(message, innerException) + { + } + + protected InputTooLargeException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) + { + } } /// /// An exception that is thrown by the decompression functions when there /// is not enough data available in order to properly decompress the input. /// + [Serializable] public class NotEnoughDataException : IOException { /// @@ -602,19 +609,40 @@ public class NotEnoughDataException : IOException /// The actual number of written bytes. /// The desired number of written bytes. public NotEnoughDataException(long currentOutSize, long totalOutSize) - : base("Not enough data availble; 0x" + currentOutSize.ToString("X") + : base("Not enough data available; 0x" + currentOutSize.ToString("X") + " of " + (totalOutSize < 0 ? "???" : "0x" + totalOutSize.ToString("X")) + " bytes written.") { WrittenLength = currentOutSize; DesiredLength = totalOutSize; } + + public NotEnoughDataException() + { + } + + public NotEnoughDataException(string message) : base(message) + { + } + + public NotEnoughDataException(string message, Exception innerException) : base(message, innerException) + { + } + + public NotEnoughDataException(string message, int hresult) : base(message, hresult) + { + } + + protected NotEnoughDataException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) + { + } } /// /// An exception thrown by the compression or decompression function, indicating that the /// given input length was too large for the given input stream. /// + [Serializable] public class StreamTooShortException : EndOfStreamException { /// @@ -622,20 +650,33 @@ public class StreamTooShortException : EndOfStreamException /// public StreamTooShortException() : base("The end of the stream was reached " - + "before the given amout of data was read.") + + "before the given amount of data was read.") { } + + public StreamTooShortException(string message) : base(message) + { + } + + public StreamTooShortException(string message, Exception innerException) : base(message, innerException) + { + } + + protected StreamTooShortException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) + { + } } /// /// An exception indication that the input has more data than required in order /// to decompress it. This may indicate that more sub-files are present in the file. /// + [Serializable] public class TooMuchInputException : Exception { /// /// Gets the number of bytes read by the decompressed to decompress the stream. /// - public long ReadBytes { get; private set; } + public long ReadBytes { get; } /// /// Creates a new exception indicating that the input has more data than necessary for @@ -650,6 +691,22 @@ public TooMuchInputException(long readBytes, long totLength) { ReadBytes = readBytes; } + + public TooMuchInputException() + { + } + + public TooMuchInputException(string message) : base(message) + { + } + + public TooMuchInputException(string message, Exception innerException) : base(message, innerException) + { + } + + protected TooMuchInputException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) + { + } } #endregion #region Supplementary diff --git a/pk3DS.Core/CTR/NCCH.cs b/pk3DS.Core/CTR/NCCH.cs index 9e1e616143..2a34fe568f 100644 --- a/pk3DS.Core/CTR/NCCH.cs +++ b/pk3DS.Core/CTR/NCCH.cs @@ -6,15 +6,15 @@ namespace pk3DS.Core.CTR { public class NCCH { - public Header header; - public ExeFS exefs; - public RomFS romfs; - public Exheader exheader; + public NCCHHeader Header; + public ExeFS ExeFS; + public RomFS RomFS; + public Exheader Exheader; public byte[] logo; public byte[] plainregion; public const uint MEDIA_UNIT_SIZE = 0x200; - public class Header + public class NCCHHeader { public byte[] Signature; //Size: 0x100 public uint Magic; @@ -127,28 +127,28 @@ public void ExtractNCCHFromFile(string NCCH_PATH, string outputDirectory, RichTe using (FileStream fs = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read)) { fs.Read(headerBytes, 0, headerBytes.Length); - header = new Header(); - header.BuildHeaderFromBytes(headerBytes); + Header = new NCCHHeader(); + Header.BuildHeaderFromBytes(headerBytes); - logo = new byte[header.LogoSize * MEDIA_UNIT_SIZE]; - fs.Seek(Convert.ToInt32(header.LogoOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + logo = new byte[Header.LogoSize * MEDIA_UNIT_SIZE]; + fs.Seek(Convert.ToInt32(Header.LogoOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); fs.Read(logo, 0, logo.Length); - plainregion = new byte[header.PlainRegionSize * MEDIA_UNIT_SIZE]; - fs.Seek(Convert.ToInt32(header.PlainRegionOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + plainregion = new byte[Header.PlainRegionSize * MEDIA_UNIT_SIZE]; + fs.Seek(Convert.ToInt32(Header.PlainRegionOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); fs.Read(plainregion, 0, plainregion.Length); } ExtractExheader(NCCH_PATH, outputDirectory, TB_Progress); - ExtractExeFS(NCCH_PATH, outputDirectory, TB_Progress, PB_Show); + ExtractExeFS(NCCH_PATH, outputDirectory, TB_Progress); ExtractRomFS(NCCH_PATH, outputDirectory, TB_Progress, PB_Show); } private void ExtractExheader(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null) { string exheaderpath = Path.Combine(outputDirectory, "exheader.bin"); - updateTB(TB_Progress, "Extracting exheader.bin from CXI..."); - byte[] exheaderbytes = new byte[header.ExheaderSize * 2]; + UpdateTB(TB_Progress, "Extracting exheader.bin from CXI..."); + byte[] exheaderbytes = new byte[Header.ExheaderSize * 2]; using (FileStream fs = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read)) { @@ -157,47 +157,51 @@ private void ExtractExheader(string NCCH_PATH, string outputDirectory, RichTextB } File.WriteAllBytes(exheaderpath, exheaderbytes); - exheader = new Exheader(exheaderpath); + Exheader = new Exheader(exheaderpath); } - private void ExtractExeFS(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) + private void ExtractExeFS(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null) { string exefsbinpath = Path.Combine(outputDirectory, "exefs.bin"); string exefspath = Path.Combine(outputDirectory, "exefs"); - updateTB(TB_Progress, "Extracting exefs.bin from CXI..."); - byte[] exefsbytes = new byte[header.ExefsSize * MEDIA_UNIT_SIZE]; + UpdateTB(TB_Progress, "Extracting exefs.bin from CXI..."); + byte[] exefsbytes = new byte[Header.ExefsSize * MEDIA_UNIT_SIZE]; using (FileStream fs = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read)) { - fs.Seek(Convert.ToInt32(header.ExefsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + fs.Seek(Convert.ToInt32(Header.ExefsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); fs.Read(exefsbytes, 0, exefsbytes.Length); } File.WriteAllBytes(exefsbinpath, exefsbytes); - ExeFS.get(exefsbinpath, exefspath); + ExeFS.UnpackExeFS(exefsbinpath, exefspath); File.Delete(exefsbinpath); } private void ExtractRomFS(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { - updateTB(TB_Progress, "Extracting romfs.bin from CXI..."); + UpdateTB(TB_Progress, "Extracting romfs.bin from CXI..."); string romfsbinpath = Path.Combine(outputDirectory, "romfs.bin"); string romfspath = Path.Combine(outputDirectory, "romfs"); byte[] romfsBytes = new byte[MEDIA_UNIT_SIZE]; - using (FileStream ncchstream = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read), - romfsstream = new FileStream(romfsbinpath, FileMode.Append, FileAccess.Write)) + using (FileStream ncchstream = new(NCCH_PATH, FileMode.Open, FileAccess.Read), + romfsstream = new(romfsbinpath, FileMode.Append, FileAccess.Write)) { - ncchstream.Seek(Convert.ToInt32(header.RomfsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); + ncchstream.Seek(Convert.ToInt32(Header.RomfsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin); if (PB_Show.InvokeRequired) - PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(header.RomfsSize); }); - else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(header.RomfsSize); } - for (int i = 0; i < header.RomfsSize; i++) + { + PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(Header.RomfsSize); }); + } + else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(Header.RomfsSize); } + for (int i = 0; i < Header.RomfsSize; i++) { ncchstream.Read(romfsBytes, 0, romfsBytes.Length); romfsstream.Write(romfsBytes, 0, romfsBytes.Length); if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); + } else { PB_Show.PerformStep(); } } } @@ -207,40 +211,38 @@ private void ExtractRomFS(string NCCH_PATH, string outputDirectory, RichTextBox File.Delete(romfsbinpath); } - private void WriteHeaderToFile(string outputDirectory, RichTextBox TB_Progress) + public void WriteHeaderToFile(string outputDirectory, RichTextBox TB_Progress) { - updateTB(TB_Progress, "Extracting ncchheader.bin from CXI..."); + UpdateTB(TB_Progress, "Extracting ncchheader.bin from CXI..."); string headerParth = Path.Combine(outputDirectory, "ncchheader.bin"); - using (FileStream headerStream = new FileStream(headerParth, FileMode.OpenOrCreate, FileAccess.Write)) - { - headerStream.Write(this.header.Data, 0, this.header.Data.Length); - } + using FileStream headerStream = new FileStream(headerParth, FileMode.OpenOrCreate, FileAccess.Write); + headerStream.Write(this.Header.Data, 0, this.Header.Data.Length); } - private void WritePlainRegionAndLogo(string outputDirectory, RichTextBox TB_Progress) + public void WritePlainRegionAndLogo(string outputDirectory, RichTextBox TB_Progress) { string plainRegionPath = Path.Combine(outputDirectory, "plain.bin"); string logoPath = Path.Combine(outputDirectory, "logo.bcma.lz"); - updateTB(TB_Progress, "Extracting plain.bin and logo.bcma.lz from CXI..."); - using (FileStream plainStream = new FileStream(plainRegionPath, FileMode.OpenOrCreate, FileAccess.Write), - logoStream = new FileStream(logoPath, FileMode.OpenOrCreate, FileAccess.Write)) - { - plainStream.Write(this.plainregion, 0, this.plainregion.Length); - logoStream.Write(this.logo, 0, this.logo.Length); - } + UpdateTB(TB_Progress, "Extracting plain.bin and logo.bcma.lz from CXI..."); + using FileStream plainStream = new(plainRegionPath, FileMode.OpenOrCreate, FileAccess.Write); + using FileStream logoStream = new(logoPath, FileMode.OpenOrCreate, FileAccess.Write); + plainStream.Write(this.plainregion, 0, this.plainregion.Length); + logoStream.Write(this.logo, 0, this.logo.Length); } - internal static void updateTB(RichTextBox RTB, string progress) + internal static void UpdateTB(RichTextBox RTB, string progress) { try { if (RTB.InvokeRequired) + { RTB.Invoke((MethodInvoker)delegate - { - RTB.AppendText(Environment.NewLine + progress); - RTB.SelectionStart = RTB.Text.Length; - RTB.ScrollToCaret(); - }); + { + RTB.AppendText(Environment.NewLine + progress); + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + }); + } else { RTB.SelectionStart = RTB.Text.Length; diff --git a/pk3DS.Core/CTR/NCSD.cs b/pk3DS.Core/CTR/NCSD.cs index 49884fd282..799febbe18 100644 --- a/pk3DS.Core/CTR/NCSD.cs +++ b/pk3DS.Core/CTR/NCSD.cs @@ -8,13 +8,13 @@ namespace pk3DS.Core.CTR { public class NCSD { - public Header header; + public NCSDHeader Header; public CardInfoHeader cardinfoheader; public List NCCH_Array; public bool Card2; public byte[] Data; - public class Header + public class NCSDHeader { public byte[] Signature; //Size 0x100; public uint Magic; @@ -63,27 +63,27 @@ public class NCCH_Meta public ulong GetWritableAddress() { return Card2 - ? Align((header.OffsetSizeTable[NCCH_Array.Count - 1].Offset * NCCH.MEDIA_UNIT_SIZE) - + (header.OffsetSizeTable[NCCH_Array.Count - 1].Size * NCCH.MEDIA_UNIT_SIZE) + 0x1000, 0x10000) / MEDIA_UNIT_SIZE + ? Align((Header.OffsetSizeTable[NCCH_Array.Count - 1].Offset * NCCH.MEDIA_UNIT_SIZE) + + (Header.OffsetSizeTable[NCCH_Array.Count - 1].Size * NCCH.MEDIA_UNIT_SIZE) + 0x1000, 0x10000) / MEDIA_UNIT_SIZE : 0x00000000FFFFFFFF; } public void BuildHeader() { Data = new byte[0x4000]; - Array.Copy(header.Signature, Data, 0x100); - Array.Copy(BitConverter.GetBytes(header.Magic), 0, Data, 0x100, 4); - Array.Copy(BitConverter.GetBytes(header.MediaSize), 0, Data, 0x104, 4); - Array.Copy(BitConverter.GetBytes(header.TitleId), 0, Data, 0x108, 8); - for (int i = 0; i < header.OffsetSizeTable.Length; i++) + Array.Copy(Header.Signature, Data, 0x100); + Array.Copy(BitConverter.GetBytes(Header.Magic), 0, Data, 0x100, 4); + Array.Copy(BitConverter.GetBytes(Header.MediaSize), 0, Data, 0x104, 4); + Array.Copy(BitConverter.GetBytes(Header.TitleId), 0, Data, 0x108, 8); + for (int i = 0; i < Header.OffsetSizeTable.Length; i++) { - Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Offset), 0, Data, 0x120 + (8 * i), 4); - Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Size), 0, Data, 0x124 + (8 * i), 4); + Array.Copy(BitConverter.GetBytes(Header.OffsetSizeTable[i].Offset), 0, Data, 0x120 + (8 * i), 4); + Array.Copy(BitConverter.GetBytes(Header.OffsetSizeTable[i].Size), 0, Data, 0x124 + (8 * i), 4); } - Array.Copy(header.flags, 0, Data, 0x188, header.flags.Length); - for (int i = 0; i < header.NCCHIdTable.Length; i++) + Array.Copy(Header.flags, 0, Data, 0x188, Header.flags.Length); + for (int i = 0; i < Header.NCCHIdTable.Length; i++) { - Array.Copy(BitConverter.GetBytes(header.NCCHIdTable[i]), 0, Data, 0x190 + (8 * i), 8); + Array.Copy(BitConverter.GetBytes(Header.NCCHIdTable[i]), 0, Data, 0x190 + (8 * i), 8); } //CardInfoHeader Array.Copy(BitConverter.GetBytes(cardinfoheader.WritableAddress), 0, Data, 0x200, 4); @@ -104,21 +104,25 @@ public void BuildHeader() Array.Copy(Enumerable.Repeat((byte)0xFF, 0x2E00).ToArray(), 0, Data, 0x1200, 0x2E00); } - public Header CreateHeaderFromBytes(byte[] data) + public NCSDHeader CreateHeaderFromBytes(byte[] data) { - Header header = new Header(); Data = data; - header.Signature = new byte[0x100]; + var header = new NCSDHeader + { + Signature = new byte[0x100], + Magic = BitConverter.ToUInt32(data, 0x100), + MediaSize = BitConverter.ToUInt32(data, 0x104), + TitleId = BitConverter.ToUInt64(data, 0x108), + OffsetSizeTable = new NCCH_Meta[8] + }; Array.Copy(data, header.Signature, 0x100); - header.Magic = BitConverter.ToUInt32(data, 0x100); - header.MediaSize = BitConverter.ToUInt32(data, 0x104); - header.TitleId = BitConverter.ToUInt64(data, 0x108); - header.OffsetSizeTable = new NCCH_Meta[8]; for (int i = 0; i < 8; i++) { - header.OffsetSizeTable[i] = new NCCH_Meta(); - header.OffsetSizeTable[i].Offset = BitConverter.ToUInt32(data, 0x120 + (8 * i)); - header.OffsetSizeTable[i].Size = BitConverter.ToUInt32(data, 0x124 + (8 * i)); + header.OffsetSizeTable[i] = new NCCH_Meta + { + Offset = BitConverter.ToUInt32(data, 0x120 + (8 * i)), + Size = BitConverter.ToUInt32(data, 0x124 + (8 * i)) + }; } header.flags = new byte[8]; Array.Copy(data, 0x188, header.flags, 0, 8); @@ -135,16 +139,16 @@ public void ExtractFilesFromNCSD(string NCSD_PATH, string outputDirectory, RichT if (!Directory.Exists(outputDirectory)) Directory.CreateDirectory(outputDirectory); - updateTB(TB_Progress, "Extracting game data (CXI) from .3DS file..."); + UpdateTB(TB_Progress, "Extracting game data (CXI) from .3DS file..."); byte[] headerBytes = new byte[0x200]; using (FileStream fs = new FileStream(NCSD_PATH, FileMode.Open, FileAccess.Read)) { fs.Read(headerBytes, 0, headerBytes.Length); } - header = CreateHeaderFromBytes(headerBytes); - string ncchPath = ExtractCXIfromNCSD(NCSD_PATH, outputDirectory, header.OffsetSizeTable[0].Size, PB_Show); - updateTB(TB_Progress, "CXI extracted, extracting files from CXI..."); + Header = CreateHeaderFromBytes(headerBytes); + string ncchPath = ExtractCXIfromNCSD(NCSD_PATH, outputDirectory, Header.OffsetSizeTable[0].Size, PB_Show); + UpdateTB(TB_Progress, "CXI extracted, extracting files from CXI..."); NCCH ncch = new NCCH(); ncch.ExtractNCCHFromFile(ncchPath, outputDirectory, TB_Progress, PB_Show); File.Delete(ncchPath); @@ -155,23 +159,25 @@ private static string ExtractCXIfromNCSD(string NCSD_PATH, string outputDirector byte[] buffer = new byte[MEDIA_UNIT_SIZE * 10]; string outputFile = Path.Combine(outputDirectory, "game.cxi"); if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(ncchSize); }); + } else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = Convert.ToInt32(ncchSize); } - using (FileStream inputFileStream = new FileStream(NCSD_PATH, FileMode.Open, FileAccess.Read), - outputFileStream = new FileStream(outputFile, FileMode.Append, FileAccess.Write)) + using FileStream inputFileStream = new(NCSD_PATH, FileMode.Open, FileAccess.Read), + outputFileStream = new(outputFile, FileMode.Append, FileAccess.Write); + inputFileStream.Seek(0x4000, SeekOrigin.Begin); + for (int i = 0; i < ncchSize; i++) { - inputFileStream.Seek(0x4000, SeekOrigin.Begin); - for (int i = 0; i < ncchSize; i++) + inputFileStream.Read(buffer, 0, buffer.Length); + outputFileStream.Write(buffer, 0, buffer.Length); + if (PB_Show.InvokeRequired) { - inputFileStream.Read(buffer, 0, buffer.Length); - outputFileStream.Write(buffer, 0, buffer.Length); - if (PB_Show.InvokeRequired) - PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); - else { PB_Show.PerformStep(); } - + PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); } + else { PB_Show.PerformStep(); } } + return outputFile; } @@ -185,17 +191,19 @@ internal static ulong Align(ulong input, ulong alignsize) return output; } - internal static void updateTB(RichTextBox RTB, string progress) + internal static void UpdateTB(RichTextBox RTB, string progress) { try { if (RTB.InvokeRequired) + { RTB.Invoke((MethodInvoker)delegate - { - RTB.AppendText(Environment.NewLine + progress); - RTB.SelectionStart = RTB.Text.Length; - RTB.ScrollToCaret(); - }); + { + RTB.AppendText(Environment.NewLine + progress); + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + }); + } else { RTB.SelectionStart = RTB.Text.Length; diff --git a/pk3DS.Core/CTR/RomFS.cs b/pk3DS.Core/CTR/RomFS.cs index 54e9a465a5..a7ab2aa9b7 100644 --- a/pk3DS.Core/CTR/RomFS.cs +++ b/pk3DS.Core/CTR/RomFS.cs @@ -19,21 +19,17 @@ public RomFS(string fn) { FileName = fn; isTempFile = true; - using (var fs = File.OpenRead(fn)) - { - fs.Seek(0x8, SeekOrigin.Begin); - uint mhlen = (uint)(fs.ReadByte() | (fs.ReadByte() << 8) | (fs.ReadByte() << 16) | (fs.ReadByte() << 24)); - SuperBlockLen = mhlen + 0x50; - if (SuperBlockLen % 0x200 != 0) - SuperBlockLen += 0x200 - (SuperBlockLen % 0x200); - byte[] superblock = new byte[SuperBlockLen]; - fs.Seek(0, SeekOrigin.Begin); - fs.Read(superblock, 0, superblock.Length); - using (SHA256 sha = SHA256.Create()) - { - SuperBlockHash = sha.ComputeHash(superblock); - } - } + using var fs = File.OpenRead(fn); + fs.Seek(0x8, SeekOrigin.Begin); + uint mhlen = (uint)(fs.ReadByte() | (fs.ReadByte() << 8) | (fs.ReadByte() << 16) | (fs.ReadByte() << 24)); + SuperBlockLen = mhlen + 0x50; + if (SuperBlockLen % 0x200 != 0) + SuperBlockLen += 0x200 - (SuperBlockLen % 0x200); + byte[] superblock = new byte[SuperBlockLen]; + fs.Seek(0, SeekOrigin.Begin); + fs.Read(superblock, 0, superblock.Length); + using SHA256 sha = SHA256.Create(); + SuperBlockHash = sha.ComputeHash(superblock); } // Build @@ -43,17 +39,19 @@ public RomFS(string fn) internal static string OutFile; internal const uint ROMFS_UNUSED_ENTRY = 0xFFFFFFFF; - internal static void updateTB(RichTextBox RTB, string progress) + internal static void UpdateTB(RichTextBox RTB, string progress) { try { if (RTB.InvokeRequired) + { RTB.Invoke((MethodInvoker)delegate - { - RTB.AppendText(Environment.NewLine + progress); - RTB.SelectionStart = RTB.Text.Length; - RTB.ScrollToCaret(); - }); + { + RTB.AppendText(Environment.NewLine + progress); + RTB.SelectionStart = RTB.Text.Length; + RTB.ScrollToCaret(); + }); + } else { RTB.SelectionStart = RTB.Text.Length; @@ -114,24 +112,29 @@ private static IVFCInfo GetIVFCInfoFromBytes(byte[] headerBytes) ivfc.Levels = new IVFCLevel[3]; for (int i = 0; i < 3; i++) { - ivfc.Levels[i] = new IVFCLevel(); - ivfc.Levels[i].HashOffset = BitConverter.ToUInt64(headerBytes, 0x0C + (i * 0x18)); - ivfc.Levels[i].DataLength = BitConverter.ToUInt64(headerBytes, 0x14 + (i * 0x18)); - ivfc.Levels[i].BlockSize = 1U << BitConverter.ToInt32(headerBytes, 0x1C + (i * 0x18)); + ivfc.Levels[i] = new IVFCLevel + { + HashOffset = BitConverter.ToUInt64(headerBytes, 0x0C + (i * 0x18)), + DataLength = BitConverter.ToUInt64(headerBytes, 0x14 + (i * 0x18)), + BlockSize = 1U << BitConverter.ToInt32(headerBytes, 0x1C + (i * 0x18)) + }; } return ivfc; } private static Romfs_InfoHeader GetRomfsInfoHeaderFromBytes(byte[] headerBytes, uint bodyOffset) { - Romfs_InfoHeader infoHeader = new Romfs_InfoHeader(); - infoHeader.HeaderLength = BitConverter.ToUInt32(headerBytes, 0x00); - infoHeader.Sections = new Romfs_SectionHeader[4]; + Romfs_InfoHeader infoHeader = new Romfs_InfoHeader + { + HeaderLength = BitConverter.ToUInt32(headerBytes, 0x00), Sections = new Romfs_SectionHeader[4] + }; for (int i = 0; i < 4; i++) { - infoHeader.Sections[i] = new Romfs_SectionHeader(); - infoHeader.Sections[i].Offset = BitConverter.ToUInt32(headerBytes, 0x04 + (i * 0x08)) + bodyOffset; - infoHeader.Sections[i].Size = BitConverter.ToUInt32(headerBytes, 0x08 + (i * 0x08)); + infoHeader.Sections[i] = new Romfs_SectionHeader + { + Offset = BitConverter.ToUInt32(headerBytes, 0x04 + (i * 0x08)) + bodyOffset, + Size = BitConverter.ToUInt32(headerBytes, 0x08 + (i * 0x08)) + }; } infoHeader.DataOffset = BitConverter.ToUInt32(headerBytes, 0x24) + bodyOffset; return infoHeader; @@ -165,7 +168,6 @@ private void VisitDirectory( { VisitDirectory(entry.SiblingOffset, rootPath, directoryMetadataBlock, fileMetadataBlock, dataOffset, TB_Progress, PB_Show); } - } private void VisitFile( @@ -178,7 +180,7 @@ private void VisitFile( { Romfs_FileEntry entry = GetFileEntryFromMetadataBytes(fileMetadataBlock, Convert.ToInt32(fileOffset)); string currentPath = Path.Combine(rootPath, entry.Name); - UpdateTB_Progress(string.Format("Extracting {0} from romfs", currentPath), TB_Progress); + UpdateTB_Progress($"Extracting {currentPath} from romfs", TB_Progress); ExtractFileFromRomFS(entry, currentPath, dataOffset, PB_Show); if (entry.SiblingOffset != 0xFFFFFFFF) @@ -187,14 +189,15 @@ private void VisitFile( } } - private static Romfs_DirEntry GetDirEntryFromMetadataBytes(byte[] directoryMetadataBlock, int directoryOffset) { - Romfs_DirEntry entry = new Romfs_DirEntry(); - entry.ParentOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset); - entry.SiblingOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x04); - entry.ChildOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x08); - entry.FileOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x0C); + Romfs_DirEntry entry = new Romfs_DirEntry + { + ParentOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset), + SiblingOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x04), + ChildOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x08), + FileOffset = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x0C) + }; uint nameLength = BitConverter.ToUInt32(directoryMetadataBlock, directoryOffset + 0x14); entry.Name = ""; if (nameLength != 0xFFFFFFFF) @@ -208,13 +211,15 @@ private static Romfs_DirEntry GetDirEntryFromMetadataBytes(byte[] directoryMetad private static Romfs_FileEntry GetFileEntryFromMetadataBytes(byte[] fileMetadataBlock, int fileOffset) { - Romfs_FileEntry entry = new Romfs_FileEntry(); - entry.ParentDirOffset = BitConverter.ToUInt32(fileMetadataBlock, fileOffset); - entry.SiblingOffset = BitConverter.ToUInt32(fileMetadataBlock, fileOffset + 0x04); - entry.DataOffset = BitConverter.ToUInt64(fileMetadataBlock, fileOffset + 0x08); - entry.DataSize = BitConverter.ToUInt64(fileMetadataBlock, fileOffset + 0x10); - entry.NameSize = BitConverter.ToUInt32(fileMetadataBlock, fileOffset + 0x1C); - entry.Name = ""; + Romfs_FileEntry entry = new Romfs_FileEntry + { + ParentDirOffset = BitConverter.ToUInt32(fileMetadataBlock, fileOffset), + SiblingOffset = BitConverter.ToUInt32(fileMetadataBlock, fileOffset + 0x04), + DataOffset = BitConverter.ToUInt64(fileMetadataBlock, fileOffset + 0x08), + DataSize = BitConverter.ToUInt64(fileMetadataBlock, fileOffset + 0x10), + NameSize = BitConverter.ToUInt32(fileMetadataBlock, fileOffset + 0x1C), + Name = "" + }; if (entry.NameSize != 0xFFFFFFFF) { byte[] fileNameBytes = new byte[entry.NameSize]; @@ -229,27 +234,29 @@ private void ExtractFileFromRomFS(Romfs_FileEntry entry, string path, ulong data ulong offsetInRomFS = dataOffset + entry.DataOffset; byte[] buffer = new byte[0x2000]; - using (FileStream romfsFileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read), - outputFileStream = new FileStream(path, FileMode.Append, FileAccess.Write)) + using FileStream romfsFileStream = new(FileName, FileMode.Open, FileAccess.Read), + outputFileStream = new(path, FileMode.Append, FileAccess.Write); + romfsFileStream.Seek(Convert.ToInt64(offsetInRomFS), SeekOrigin.Begin); + int remainingSize = Convert.ToInt32(entry.DataSize); + var max = remainingSize / buffer.Length; + if (PB_Show.InvokeRequired) { - romfsFileStream.Seek(Convert.ToInt64(offsetInRomFS), SeekOrigin.Begin); - int remainingSize = Convert.ToInt32(entry.DataSize); - if (PB_Show.InvokeRequired) - PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = remainingSize / buffer.Length; }); - else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = remainingSize / buffer.Length; } + PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = max; }); + } + else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = max; } - while (remainingSize > 0) + while (remainingSize > 0) + { + int sizeToReadWrite = buffer.Length > remainingSize ? remainingSize : buffer.Length; + romfsFileStream.Read(buffer, 0, sizeToReadWrite); + outputFileStream.Write(buffer, 0, sizeToReadWrite); + remainingSize -= sizeToReadWrite; + if (PB_Show.InvokeRequired) { - int sizeToReadWrite = buffer.Length > remainingSize ? remainingSize : buffer.Length; - romfsFileStream.Read(buffer, 0, sizeToReadWrite); - outputFileStream.Write(buffer, 0, sizeToReadWrite); - remainingSize -= sizeToReadWrite; - if (PB_Show.InvokeRequired) - PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); - else { PB_Show.PerformStep(); } + PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); } + else { PB_Show.PerformStep(); } } - } public static void BuildRomFS(string infile, string outfile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) @@ -261,7 +268,7 @@ public static void BuildRomFS(string infile, string outfile, RichTextBox TB_Prog FileNameTable FNT = new FileNameTable(ROOT_DIR); RomfsFile[] RomFiles = new RomfsFile[FNT.NumFiles]; LayoutManager.Input[] In = new LayoutManager.Input[FNT.NumFiles]; - updateTB(TB_Progress, "Creating Layout..."); + UpdateTB(TB_Progress, "Creating Layout..."); for (int i = 0; i < FNT.NumFiles; i++) { In[i] = new LayoutManager.Input { FilePath = FNT.NameEntryTable[i].FullName, AlignmentSize = 0x10 }; @@ -277,12 +284,11 @@ public static void BuildRomFS(string infile, string outfile, RichTextBox TB_Prog Size = Out[i].Size }; } - using (MemoryStream memoryStream = new MemoryStream()) - { - updateTB(TB_Progress, "Creating RomFS MetaData..."); - BuildRomFSHeader(memoryStream, RomFiles, ROOT_DIR); - MakeRomFSData(RomFiles, memoryStream, TB_Progress, PB_Show); - } + + using MemoryStream memoryStream = new MemoryStream(); + UpdateTB(TB_Progress, "Creating RomFS MetaData..."); + BuildRomFSHeader(memoryStream, RomFiles, ROOT_DIR); + MakeRomFSData(RomFiles, memoryStream, TB_Progress, PB_Show); } internal static ulong Align(ulong input, ulong alignsize) @@ -297,7 +303,7 @@ internal static ulong Align(ulong input, ulong alignsize) internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { - updateTB(TB_Progress, "Computing IVFC Header Data..."); + UpdateTB(TB_Progress, "Computing IVFC Header Data..."); IVFCInfo ivfc = new IVFCInfo { Levels = new IVFCLevel[3] }; for (int i = 0; i < ivfc.Levels.Length; i++) { @@ -317,7 +323,6 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, const uint RESERVED = 0x0; const uint HeaderLen = 0x5C; const uint MEDIA_UNIT_SIZE = 0x200; - byte[] SuperBlockHash = new byte[0x20]; FileStream OutFileStream = new FileStream(TempFile, FileMode.Create, FileAccess.ReadWrite); try { @@ -338,9 +343,11 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, byte[] metadataArray = metadata.ToArray(); OutFileStream.Write(metadataArray, 0, metadataArray.Length); long baseOfs = OutFileStream.Position; - updateTB(TB_Progress, "Writing Level 2 Data..."); + UpdateTB(TB_Progress, "Writing Level 2 Data..."); if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = RomFiles.Length; }); + } else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = RomFiles.Length; } foreach (RomfsFile t in RomFiles) @@ -356,7 +363,9 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, } } if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); + } else { PB_Show.PerformStep(); } } long hashBaseOfs = (long)Align((ulong)OutFileStream.Position, ivfc.Levels[2].BlockSize); @@ -365,12 +374,14 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, SHA256Managed sha = new SHA256Managed(); for (int i = ivfc.Levels.Length - 1; i >= 0; i--) { - updateTB(TB_Progress, "Computing Level " + i + " Hashes..."); + UpdateTB(TB_Progress, "Computing Level " + i + " Hashes..."); byte[] buffer = new byte[(int)ivfc.Levels[i].BlockSize]; var count = (int) (ivfc.Levels[i].DataLength/ivfc.Levels[i].BlockSize); if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = count; }); + } else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = count; } for (long ofs = 0; ofs < (long)ivfc.Levels[i].DataLength; ofs += ivfc.Levels[i].BlockSize) @@ -383,10 +394,12 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, OutFileStream.Write(hash, 0, hash.Length); cOfs = OutFileStream.Position; if (PB_Show.InvokeRequired) + { PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); + } else { PB_Show.PerformStep(); } } - + if (i <= 0) continue; @@ -411,7 +424,9 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, uint SuperBlockLen = (uint)Align(MasterHashLen + 0x60, MEDIA_UNIT_SIZE); byte[] MasterHashes = new byte[SuperBlockLen]; OutFileStream.Read(MasterHashes, 0, (int)SuperBlockLen); - SuperBlockHash = sha.ComputeHash(MasterHashes); + + //var SuperBlockHash = sha.ComputeHash(MasterHashes); + //Console.WriteLine(SuperBlockHash); } finally { @@ -426,45 +441,47 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, internal static void WriteBinary(string tempFile, string outFile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { - using (FileStream fs = new FileStream(outFile, FileMode.Create)) + using FileStream fs = new FileStream(outFile, FileMode.Create); + using BinaryWriter writer = new BinaryWriter(fs); + using FileStream fileStream = new FileStream(tempFile, FileMode.Open, FileAccess.Read); + + const uint BUFFER_SIZE = 0x400000; // 4MB Buffer + var steps = (int)(fileStream.Length / BUFFER_SIZE); + if (PB_Show.InvokeRequired) + { + PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = steps; }); + } + else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = steps; } + + byte[] buffer = new byte[BUFFER_SIZE]; + while (true) { - using (BinaryWriter writer = new BinaryWriter(fs)) + int count = fileStream.Read(buffer, 0, buffer.Length); + if (count != 0) { - using (FileStream fileStream = new FileStream(tempFile, FileMode.Open, FileAccess.Read)) + writer.Write(buffer, 0, count); + if (PB_Show.InvokeRequired) { - const uint BUFFER_SIZE = 0x400000; // 4MB Buffer - var steps = (int)(fileStream.Length / BUFFER_SIZE); - if (PB_Show.InvokeRequired) - PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = steps; }); - else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = steps; } - - byte[] buffer = new byte[BUFFER_SIZE]; - while (true) - { - int count = fileStream.Read(buffer, 0, buffer.Length); - if (count != 0) - { - writer.Write(buffer, 0, count); - if (PB_Show.InvokeRequired) - PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); - else { PB_Show.PerformStep(); } - } - else - break; - } + PB_Show.Invoke((MethodInvoker)PB_Show.PerformStep); } - writer.Flush(); + else { PB_Show.PerformStep(); } + } + else + { + break; } } + + writer.Flush(); File.Delete(TempFile); - updateTB(TB_Progress, "Wrote RomFS to path:" + Environment.NewLine + outFile); + UpdateTB(TB_Progress, "Wrote RomFS to path:" + Environment.NewLine + outFile); } internal static string ByteArrayToString(IEnumerable input) { StringBuilder sb = new StringBuilder(); foreach (byte b in input) - sb.Append(b.ToString("X2") + " "); + sb.Append(b.ToString("X2")).Append(' '); return sb.ToString(); } @@ -557,9 +574,13 @@ internal static uint GetHashTableEntryCount(uint Entries) { uint count = Entries; if (Entries < 3) + { count = 3; + } else if (count < 19) + { count |= 1; + } else { while (count % 2 == 0 || count % 3 == 0 || count % 5 == 0 || count % 7 == 0 || count % 11 == 0 || count % 13 == 0 || count % 17 == 0) @@ -616,7 +637,7 @@ internal static void AddDirHashKey(Romfs_MetaData MetaData, int index) uint parent = MetaData.DirTable.DirectoryTable[index].ParentOffset; string Name = MetaData.DirTable.DirectoryTable[index].Name; byte[] NArr = index == 0 ? Encoding.Unicode.GetBytes("") : Encoding.Unicode.GetBytes(Name); - uint hash = CalcPathHash(parent, NArr, 0, NArr.Length); + uint hash = CalcPathHash(parent, NArr, 0); int ind2 = (int)(hash % MetaData.M_DirHashTableEntry); if (MetaData.DirHashTable[ind2] == ROMFS_UNUSED_ENTRY) { @@ -645,7 +666,7 @@ internal static void AddFileHashKey(Romfs_MetaData MetaData, int index) uint parent = MetaData.FileTable.FileTable[index].ParentDirOffset; string Name = MetaData.FileTable.FileTable[index].Name; byte[] NArr = Encoding.Unicode.GetBytes(Name); - uint hash = CalcPathHash(parent, NArr, 0, NArr.Length); + uint hash = CalcPathHash(parent, NArr, 0); int ind2 = (int)(hash % MetaData.M_FileHashTableEntry); if (MetaData.FileHashTable[ind2] == ROMFS_UNUSED_ENTRY) { @@ -669,7 +690,7 @@ internal static void AddFileHashKey(Romfs_MetaData MetaData, int index) } } - internal static uint CalcPathHash(uint ParentOffset, byte[] NameArray, int start, int len) + internal static uint CalcPathHash(uint ParentOffset, byte[] NameArray, int start) { uint hash = ParentOffset ^ 123456789; for (int i = 0; i < NameArray.Length; i += 2) @@ -724,14 +745,13 @@ internal static void AddDir(Romfs_MetaData MetaData, DirectoryInfo Dir, uint par AddDir(MetaData, t, CurrentDir, sibling, true); } - if (SubDirectories.Length <= 0) + if (SubDirectories.Length == 0) return; int curindex = GetRomfsDirEntry(MetaData, Dir.FullName); int childindex = GetRomfsDirEntry(MetaData, SubDirectories[0].FullName); if (curindex > -1 && childindex > -1) - MetaData.DirTable.DirectoryTable[curindex].ChildOffset = - MetaData.DirTable.DirectoryTable[childindex].Offset; + MetaData.DirTable.DirectoryTable[curindex].ChildOffset = MetaData.DirTable.DirectoryTable[childindex].Offset; } internal static void AddFiles(Romfs_MetaData MetaData, RomfsFile[] Entries) @@ -829,8 +849,10 @@ internal static void WriteMetaDataToStream(Romfs_MetaData MetaData, MemoryStream internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, string FullName) { for (int i = 0; i < MetaData.DirTable.DirectoryTable.Count; i++) + { if (MetaData.DirTable.DirectoryTable[i].FullName == FullName) return i; + } return -1; } @@ -838,8 +860,10 @@ internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, string FullName) internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, uint Offset) { for (int i = 0; i < MetaData.DirTable.DirectoryTable.Count; i++) + { if (MetaData.DirTable.DirectoryTable[i].Offset == Offset) return i; + } return -1; } @@ -847,8 +871,10 @@ internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, uint Offset) internal static int GetRomfsFileEntry(Romfs_MetaData MetaData, uint Offset) { for (int i = 0; i < MetaData.FileTable.FileTable.Count; i++) + { if (MetaData.FileTable.FileTable[i].Offset == Offset) return i; + } return -1; } @@ -871,13 +897,13 @@ public class Romfs_MetaData public uint M_FileTableLen; } - public struct Romfs_SectionHeader + public class Romfs_SectionHeader { public uint Offset; public uint Size; } - public struct Romfs_InfoHeader + public class Romfs_InfoHeader { public uint HeaderLength; public Romfs_SectionHeader[] Sections; diff --git a/pk3DS.Core/CTR/SARC.cs b/pk3DS.Core/CTR/SARC.cs index 61bdbed2ad..edcf6aa03b 100644 --- a/pk3DS.Core/CTR/SARC.cs +++ b/pk3DS.Core/CTR/SARC.cs @@ -8,7 +8,7 @@ namespace pk3DS.Core.CTR /// /// Simple (?) ARChive /// - public class SARC : IDisposable + public sealed class SARC : IDisposable { private const string Identifier = nameof(SARC); @@ -145,7 +145,7 @@ public void SetData(SFATEntry entry, byte[] data) /// Path to export to. If left null, will output to the FilePath, if it is assigned. public string ExportFile(SFATEntry t, string outpath = null) { - outpath = outpath ?? FilePath; + outpath ??= FilePath; byte[] data = GetData(t); string name = GetFileName(t); @@ -167,7 +167,7 @@ public string ExportFile(SFATEntry t, string outpath = null) /// Folder to dump contents to public IEnumerable Dump(string path = null, string folder = null) { - path = path ?? FilePath; + path ??= FilePath; if (path == null) throw new ArgumentNullException(nameof(path)); if (File.Exists(path)) @@ -175,7 +175,7 @@ public IEnumerable Dump(string path = null, string folder = null) if (path == null) throw new ArgumentNullException(nameof(path)); - folder = folder ?? FileName ?? "sarc"; + folder ??= FileName ?? "sarc"; string dir = Path.Combine(path, folder); Directory.CreateDirectory(dir); @@ -192,11 +192,10 @@ private string GetFileName(int offset) for (char c = (char)stream.ReadByte(); c != 0; c = (char)stream.ReadByte()) sb.Append(c); - string name = sb.ToString().Replace('/', Path.DirectorySeparatorChar); - return name; + return sb.ToString().Replace('/', Path.DirectorySeparatorChar); } - private void SetFileName(int offset, string value) + public void SetFileName(int offset, string value) { var str = value.Replace(Path.DirectorySeparatorChar, '/'); stream.Seek(SFNT.StringOffset, SeekOrigin.Begin); diff --git a/pk3DS.Core/CTR/SMDH.cs b/pk3DS.Core/CTR/SMDH.cs index d08d3f448c..d838c9ad06 100644 --- a/pk3DS.Core/CTR/SMDH.cs +++ b/pk3DS.Core/CTR/SMDH.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using System; +using System.Drawing; using System.IO; using System.Text; @@ -46,19 +47,17 @@ public void Read(BinaryReader br) public byte[] Write() { - using (var ms = new MemoryStream()) - using (var bw = new BinaryWriter(ms)) - { - bw.Write(Magic); - bw.Write(Version); - bw.Write(Reserved2); - for (int i = 0; i < 16; i++) AppInfo[i].Write(bw); - AppSettings.Write(bw); - bw.Write(Reserved8); - SmallIcon.Write(bw); - LargeIcon.Write(bw); - return ms.ToArray(); - } + using var ms = new MemoryStream(); + using var bw = new BinaryWriter(ms); + bw.Write(Magic); + bw.Write(Version); + bw.Write(Reserved2); + for (int i = 0; i < 16; i++) AppInfo[i].Write(bw); + AppSettings.Write(bw); + bw.Write(Reserved8); + SmallIcon.Write(bw); + LargeIcon.Write(bw); + return ms.ToArray(); } } @@ -95,9 +94,11 @@ public class ApplicationSettings public readonly ushort Reserved; public readonly float AnimationDefaultFrame; public readonly uint StreetPassID; - + + [Flags] public enum RegionLockoutFlags : uint { + None, Japan = 0x01, NorthAmerica = 0x02, Europe = 0x04, @@ -107,8 +108,10 @@ public enum RegionLockoutFlags : uint Taiwan = 0x40 } + [Flags] public enum AppSettingsFlags : uint { + None, Visible = 1, AutoBoot = 2, Allow3D = 4, diff --git a/pk3DS.Core/CTR/mini.cs b/pk3DS.Core/CTR/mini.cs index ae195fac00..c76140711c 100644 --- a/pk3DS.Core/CTR/mini.cs +++ b/pk3DS.Core/CTR/mini.cs @@ -36,7 +36,7 @@ public static void PackMini(string path, string ident, string fileName, string o delete = false; outFolder = path; } - if (outExt == null) outExt = ".bin"; + outExt ??= ".bin"; // Create new Binary with the relevant header bytes byte[] data = new byte[4]; data[0] = (byte)ident[0]; @@ -74,13 +74,11 @@ public static void PackMini(string path, string ident, string fileName, string o // Cap the File bo.Write((uint)(dataout.Position + dataOffset)); - using (var newPack = File.Create(Path.Combine(outFolder, fileName + outExt))) - using (var header = new MemoryStream(data)) - { - header.WriteTo(newPack); - offsetMap.WriteTo(newPack); - dataout.WriteTo(newPack); - } + using var newPack = File.Create(Path.Combine(outFolder, fileName + outExt)); + using var header = new MemoryStream(data); + header.WriteTo(newPack); + offsetMap.WriteTo(newPack); + dataout.WriteTo(newPack); } if (delete) Directory.Delete(path, true); @@ -98,38 +96,34 @@ public static byte[] PackMini(byte[][] fileData, string ident) int dataOffset = 4 + 4 + (count * 4); // Start the data filling. - using (MemoryStream dataout = new MemoryStream()) - using (MemoryStream offsetMap = new MemoryStream()) - using (BinaryWriter bd = new BinaryWriter(dataout)) - using (BinaryWriter bo = new BinaryWriter(offsetMap)) + using MemoryStream dataout = new MemoryStream(); + using MemoryStream offsetMap = new MemoryStream(); + using BinaryWriter bd = new BinaryWriter(dataout); + using BinaryWriter bo = new BinaryWriter(offsetMap); + // For each file... + for (int i = 0; i < count; i++) { - // For each file... - for (int i = 0; i < count; i++) - { - // Write File Offset - uint fileOffset = (uint)(dataout.Position + dataOffset); - bo.Write(fileOffset); + // Write File Offset + uint fileOffset = (uint)(dataout.Position + dataOffset); + bo.Write(fileOffset); - // Write File to Stream - bd.Write(fileData[i]); - - // Pad the Data MemoryStream with Zeroes until len%4=0; - while (dataout.Length % 4 != 0) - bd.Write((byte)0); - // File Offset will be updated as the offset is based off of the Data length. - } - // Cap the File - bo.Write((uint)(dataout.Position + dataOffset)); + // Write File to Stream + bd.Write(fileData[i]); - using (var newPack = new MemoryStream()) - using (var header = new MemoryStream(data)) - { - header.WriteTo(newPack); - offsetMap.WriteTo(newPack); - dataout.WriteTo(newPack); - return newPack.ToArray(); - } + // Pad the Data MemoryStream with Zeroes until len%4=0; + while (dataout.Length % 4 != 0) + bd.Write((byte)0); + // File Offset will be updated as the offset is based off of the Data length. } + // Cap the File + bo.Write((uint)(dataout.Position + dataOffset)); + + using var newPack = new MemoryStream(); + using var header = new MemoryStream(data); + header.WriteTo(newPack); + offsetMap.WriteTo(newPack); + dataout.WriteTo(newPack); + return newPack.ToArray(); } public static bool PackMini2(string path, string ident, string fileName) @@ -149,7 +143,7 @@ public static bool PackMini2(string path, string ident, string fileName) public static void UnpackMini(string path, string ident, string outFolder = null, bool delete = true) { - if (outFolder == null) outFolder = Path.GetDirectoryName(path); + outFolder ??= Path.GetDirectoryName(path); if (!Directory.Exists(outFolder)) Directory.CreateDirectory(outFolder); using (var s = new MemoryStream(File.ReadAllBytes(path))) using (var br = new BinaryReader(s)) @@ -170,20 +164,18 @@ public static void UnpackMini(string path, string ident, string outFolder = null for (int i = 0; i < count; i++) { br.BaseStream.Seek(offsets[i], SeekOrigin.Begin); - using (MemoryStream dataout = new MemoryStream()) + using MemoryStream dataout = new MemoryStream(); + byte[] data = Array.Empty(); + s.CopyTo(dataout, (int)offsets[i]); + int len = (int)offsets[i + 1] - (int)offsets[i]; + + if (len != 0) { - byte[] data = new byte[0]; - s.CopyTo(dataout, (int)offsets[i]); - int len = (int)offsets[i + 1] - (int)offsets[i]; - - if (len != 0) - { - data = dataout.ToArray(); - Array.Resize(ref data, len); - } - string newFile = Path.Combine(outFolder, i.ToString(namePad) + ".bin"); - File.WriteAllBytes(newFile, data); + data = dataout.ToArray(); + Array.Resize(ref data, len); } + string newFile = Path.Combine(outFolder, i.ToString(namePad) + ".bin"); + File.WriteAllBytes(newFile, data); } } if (delete) diff --git a/pk3DS.Core/Game/GARCFile.cs b/pk3DS.Core/Game/GARCFile.cs index facad830bc..45e83493e6 100644 --- a/pk3DS.Core/Game/GARCFile.cs +++ b/pk3DS.Core/Game/GARCFile.cs @@ -18,8 +18,8 @@ public GARCFile(GARC.MemGARC g, GARCReference r, string p) } // Shorthand Alias - public byte[] getFile(int file, int subfile = 0) { return GARC.getFile(file, subfile); } - public byte[][] Files { get { return GARC.Files; } set { GARC.Files = value; } } + public byte[] GetFile(int file, int subfile = 0) { return GARC.GetFile(file, subfile); } + public byte[][] Files { get => GARC.Files; set => GARC.Files = value; } public int FileCount => GARC.FileCount; public void Save() @@ -29,19 +29,19 @@ public void Save() } } - public class lzGARCFile + public class LazyGARCFile { - private readonly GARC.lzGARC GARC; + private readonly GARC.LazyGARC GARC; private readonly GARCReference Reference; private readonly string Path; - public lzGARCFile(GARC.lzGARC g, GARCReference r, string p) + public LazyGARCFile(GARC.LazyGARC g, GARCReference r, string p) { GARC = g; Reference = r; Path = p; } - + public int FileCount => GARC.FileCount; public byte[][] Files @@ -62,8 +62,8 @@ public byte[][] Files public byte[] this[int file] { - get { return GARC[file]; } - set { GARC[file] = value; } + get => GARC[file]; + set => GARC[file] = value; } public void Save() diff --git a/pk3DS.Core/Game/GARCReference.cs b/pk3DS.Core/Game/GARCReference.cs index 0d3689a907..5217ad1b51 100644 --- a/pk3DS.Core/Game/GARCReference.cs +++ b/pk3DS.Core/Game/GARCReference.cs @@ -3,7 +3,7 @@ namespace pk3DS.Core { - public class GARCReference + public sealed class GARCReference { public readonly int FileNumber; public readonly string Name; @@ -20,148 +20,148 @@ private GARCReference(int file, string name, bool lv = false) LanguageVariant = lv; } - public GARCReference getRelativeGARC(int offset, string name = "") + public GARCReference GetRelativeGARC(int offset, string name = "") { - return new GARCReference(FileNumber + offset, name); + return new(FileNumber + offset, name); } public static readonly GARCReference[] GARCReference_XY = { - new GARCReference(005, "movesprite"), - new GARCReference(012, "encdata"), - new GARCReference(038, "trdata"), - new GARCReference(039, "trclass"), - new GARCReference(040, "trpoke"), - new GARCReference(041, "mapGR"), - new GARCReference(042, "mapMatrix"), - new GARCReference(104, "wallpaper"), - new GARCReference(165, "titlescreen"), - new GARCReference(203, "maisonpkN"), - new GARCReference(204, "maisontrN"), - new GARCReference(205, "maisonpkS"), - new GARCReference(206, "maisontrS"), - new GARCReference(212, "move"), - new GARCReference(213, "eggmove"), - new GARCReference(214, "levelup"), - new GARCReference(215, "evolution"), - new GARCReference(216, "megaevo"), - new GARCReference(218, "personal"), - new GARCReference(220, "item"), + new(005, "movesprite"), + new(012, "encdata"), + new(038, "trdata"), + new(039, "trclass"), + new(040, "trpoke"), + new(041, "mapGR"), + new(042, "mapMatrix"), + new(104, "wallpaper"), + new(165, "titlescreen"), + new(203, "maisonpkN"), + new(204, "maisontrN"), + new(205, "maisonpkS"), + new(206, "maisontrS"), + new(212, "move"), + new(213, "eggmove"), + new(214, "levelup"), + new(215, "evolution"), + new(216, "megaevo"), + new(218, "personal"), + new(220, "item"), // Varied - new GARCReference(072, "gametext", true), - new GARCReference(080, "storytext", true), + new(072, "gametext", true), + new(080, "storytext", true), }; public static readonly GARCReference[] GARCReference_AO = { - new GARCReference(013, "encdata"), - new GARCReference(036, "trdata"), - new GARCReference(037, "trclass"), - new GARCReference(038, "trpoke"), - new GARCReference(039, "mapGR"), - new GARCReference(040, "mapMatrix"), - new GARCReference(103, "wallpaper"), - new GARCReference(152, "titlescreen"), - new GARCReference(182, "maisonpkN"), - new GARCReference(183, "maisontrN"), - new GARCReference(184, "maisonpkS"), - new GARCReference(185, "maisontrS"), - new GARCReference(189, "move"), - new GARCReference(190, "eggmove"), - new GARCReference(191, "levelup"), - new GARCReference(192, "evolution"), - new GARCReference(193, "megaevo"), - new GARCReference(195, "personal"), - new GARCReference(197, "item"), - + new(013, "encdata"), + new(036, "trdata"), + new(037, "trclass"), + new(038, "trpoke"), + new(039, "mapGR"), + new(040, "mapMatrix"), + new(103, "wallpaper"), + new(152, "titlescreen"), + new(182, "maisonpkN"), + new(183, "maisontrN"), + new(184, "maisonpkS"), + new(185, "maisontrS"), + new(189, "move"), + new(190, "eggmove"), + new(191, "levelup"), + new(192, "evolution"), + new(193, "megaevo"), + new(195, "personal"), + new(197, "item"), + // Varied - new GARCReference(071, "gametext", true), - new GARCReference(079, "storytext", true), + new(071, "gametext", true), + new(079, "storytext", true), }; public static readonly GARCReference[] GARCReference_SMDEMO = { - new GARCReference(011, "move"), - new GARCReference(012, "eggmove"), - new GARCReference(013, "levelup"), - new GARCReference(014, "evolution"), - new GARCReference(015, "megaevo"), - new GARCReference(017, "personal"), - new GARCReference(019, "item"), - - new GARCReference(076, "zonedata"), - new GARCReference(081, "encdata"), - - new GARCReference(101, "trclass"), - new GARCReference(102, "trdata"), - new GARCReference(103, "trpoke"), - + new(011, "move"), + new(012, "eggmove"), + new(013, "levelup"), + new(014, "evolution"), + new(015, "megaevo"), + new(017, "personal"), + new(019, "item"), + + new(076, "zonedata"), + new(081, "encdata"), + + new(101, "trclass"), + new(102, "trdata"), + new(103, "trpoke"), + // Varied - new GARCReference(030, "gametext", true), - new GARCReference(040, "storytext", true), + new(030, "gametext", true), + new(040, "storytext", true), }; private static readonly GARCReference[] GARCReference_SM = { - new GARCReference(011, "move"), - new GARCReference(012, "eggmove"), - new GARCReference(013, "levelup"), - new GARCReference(014, "evolution"), - new GARCReference(015, "megaevo"), - new GARCReference(017, "personal"), - new GARCReference(019, "item"), - - new GARCReference(077, "zonedata"), - new GARCReference(091, "worlddata"), - - new GARCReference(104, "trclass"), - new GARCReference(105, "trdata"), - new GARCReference(106, "trpoke"), - - new GARCReference(155, "encounterstatic"), - - new GARCReference(267, "pickup"), - - new GARCReference(277, "maisonpkN"), - new GARCReference(278, "maisontrN"), - new GARCReference(279, "maisonpkS"), - new GARCReference(280, "maisontrS"), - + new(011, "move"), + new(012, "eggmove"), + new(013, "levelup"), + new(014, "evolution"), + new(015, "megaevo"), + new(017, "personal"), + new(019, "item"), + + new(077, "zonedata"), + new(091, "worlddata"), + + new(104, "trclass"), + new(105, "trdata"), + new(106, "trpoke"), + + new(155, "encounterstatic"), + + new(267, "pickup"), + + new(277, "maisonpkN"), + new(278, "maisontrN"), + new(279, "maisonpkS"), + new(280, "maisontrS"), + // Varied - new GARCReference(030, "gametext", true), - new GARCReference(040, "storytext", true), + new(030, "gametext", true), + new(040, "storytext", true), }; private static readonly GARCReference[] GARCReference_USUM = { - new GARCReference(011, "move"), - new GARCReference(012, "eggmove"), - new GARCReference(013, "levelup"), - new GARCReference(014, "evolution"), - new GARCReference(015, "megaevo"), - new GARCReference(017, "personal"), - new GARCReference(019, "item"), - - new GARCReference(077, "zonedata"), - new GARCReference(091, "worlddata"), - - new GARCReference(105, "trclass"), - new GARCReference(106, "trdata"), - new GARCReference(107, "trpoke"), - - new GARCReference(159, "encounterstatic"), - - new GARCReference(271, "pickup"), - - new GARCReference(281, "maisonpkN"), - new GARCReference(282, "maisontrN"), - new GARCReference(283, "maisonpkS"), - new GARCReference(284, "maisontrS"), - + new(011, "move"), + new(012, "eggmove"), + new(013, "levelup"), + new(014, "evolution"), + new(015, "megaevo"), + new(017, "personal"), + new(019, "item"), + + new(077, "zonedata"), + new(091, "worlddata"), + + new(105, "trclass"), + new(106, "trdata"), + new(107, "trpoke"), + + new(159, "encounterstatic"), + + new(271, "pickup"), + + new(281, "maisonpkN"), + new(282, "maisontrN"), + new(283, "maisonpkS"), + new(284, "maisontrS"), + // Varied - new GARCReference(030, "gametext", true), - new GARCReference(040, "storytext", true), + new(030, "gametext", true), + new(040, "storytext", true), }; public static readonly GARCReference[] GARCReference_SN = GARCReference_SM.Concat( diff --git a/pk3DS.Core/Game/GameBackup.cs b/pk3DS.Core/Game/GameBackup.cs index 24536499e8..d738273069 100644 --- a/pk3DS.Core/Game/GameBackup.cs +++ b/pk3DS.Core/Game/GameBackup.cs @@ -11,7 +11,7 @@ public static class GameBackup public const string baka = "a"; public const string bakdll = "dll"; - public static void backupFiles(this GameConfig config, bool overwrite = false) + public static void BackupFiles(this GameConfig config, bool overwrite = false) { // Users may use pk3DS for multiple games, and even the same game but from different paths. // A simple way is to create a backup for each unique game, but... some carts may be pre-patched. @@ -39,16 +39,16 @@ public static void backupFiles(this GameConfig config, bool overwrite = false) // Backup files if (config.ExeFS != null) // exefs - backupExeFS(config, overwrite, bak_exefs); + BackupExeFS(config, overwrite, bak_exefs); if (config.RomFS != null) // a - backupGARC(config, overwrite, bak_a); + BackupGARC(config, overwrite, bak_a); if (config.RomFS != null) // dll - backupDLL(config, overwrite, bak_dll); + BackupDLL(config, overwrite, bak_dll); File.WriteAllText(Path.Combine(gameBackup, "bakinfo.txt"), "Backup created from the following location:" + Environment.NewLine + gamePath.FullName); } - private static void backupExeFS(GameConfig config, bool overwrite, string bak_exefs) + private static void BackupExeFS(GameConfig config, bool overwrite, string bak_exefs) { var files = Directory.GetFiles(config.ExeFS); foreach (var f in files) @@ -59,7 +59,7 @@ private static void backupExeFS(GameConfig config, bool overwrite, string bak_ex } } - private static void backupGARC(GameConfig config, bool overwrite, string bak_a) + private static void BackupGARC(GameConfig config, bool overwrite, string bak_a) { var files = config.Files.Select(file => file.Name); foreach (var f in files) @@ -73,7 +73,7 @@ private static void backupGARC(GameConfig config, bool overwrite, string bak_a) } } - private static void backupDLL(GameConfig config, bool overwrite, string bak_dll) + private static void BackupDLL(GameConfig config, bool overwrite, string bak_dll) { string path = config.RomFS; string[] files = Directory.GetFiles(path); @@ -81,7 +81,7 @@ private static void backupDLL(GameConfig config, bool overwrite, string bak_dll) string[] CRSs = files.Where(x => new FileInfo(x).Extension.Contains("crs")).ToArray(); string[] CRRs = Directory.Exists(Path.Combine(path, ".crr")) ? Directory.GetFiles(Path.Combine(path, ".crr")) - : new string[0]; + : Array.Empty(); int count = CROs.Length + CRSs.Length + CRRs.Length; if (count <= 0) @@ -97,7 +97,7 @@ private static void backupDLL(GameConfig config, bool overwrite, string bak_dll) File.Copy(src, dest); } - if (CRRs.Length <= 0) + if (CRRs.Length == 0) return; // Separate folder for the .crr @@ -113,7 +113,7 @@ private static void backupDLL(GameConfig config, bool overwrite, string bak_dll) } } - public static string[] restoreFiles(this GameConfig config) + public static string[] RestoreFiles(this GameConfig config) { // Do the same process as backing up, but copy files in the opposite direction. @@ -130,11 +130,11 @@ public static string[] restoreFiles(this GameConfig config) // restore exefs if (Directory.Exists(bak_exefs)) - count[0] = restoreExeFS(config, bak_exefs); + count[0] = RestoreExeFS(config, bak_exefs); if (Directory.Exists(bak_a)) - count[1] = restoreGARC(config, bak_a); + count[1] = RestoreGARC(config, bak_a); if (Directory.Exists(bak_dll)) - count[2] = restoreDLL(config, bak_dll); + count[2] = RestoreDLL(config, bak_dll); string[] sources = { "ExeFS", "'a'", "CRO" }; var info = count.Select((c, i) => $"{sources[i]}: {c}"); @@ -142,7 +142,7 @@ public static string[] restoreFiles(this GameConfig config) return new[] {result}; } - private static int restoreExeFS(GameConfig config, string bak_exefs) + private static int RestoreExeFS(GameConfig config, string bak_exefs) { int count = 0; var files = Directory.GetFiles(config.ExeFS); @@ -155,12 +155,14 @@ private static int restoreExeFS(GameConfig config, string bak_exefs) catch { Console.WriteLine("Unable to overwrite backup: " + dest); } } else + { Console.WriteLine("Unable to find backup: " + dest); + } } return count; } - private static int restoreGARC(GameConfig config, string bak_a) + private static int RestoreGARC(GameConfig config, string bak_a) { int count = 0; var files = config.Files.Select(file => file.Name); @@ -176,12 +178,14 @@ private static int restoreGARC(GameConfig config, string bak_a) catch { Console.WriteLine("Unable to overwrite backup: " + dest); } } else + { Console.WriteLine("Unable to find backup: " + dest); + } } return count; } - private static int restoreDLL(GameConfig config, string bak_dll) + private static int RestoreDLL(GameConfig config, string bak_dll) { int count = 0; @@ -191,7 +195,7 @@ private static int restoreDLL(GameConfig config, string bak_dll) string[] CRSs = files.Where(x => new FileInfo(x).Extension.Contains("crs")).ToArray(); string[] CRRs = Directory.Exists(Path.Combine(path, ".crr")) ? Directory.GetFiles(Path.Combine(path, ".crr")) - : new string[0]; + : Array.Empty(); if (CROs.Length + CRSs.Length + CRRs.Length <= 0) return 0; @@ -205,10 +209,12 @@ private static int restoreDLL(GameConfig config, string bak_dll) catch { Console.WriteLine("Unable to overwrite backup: " + dest); } } else + { Console.WriteLine("Unable to find backup: " + dest); + } } - if (CRRs.Length <= 0) + if (CRRs.Length == 0) return count; // Separate folder for the .crr @@ -222,7 +228,9 @@ private static int restoreDLL(GameConfig config, string bak_dll) count++; } else + { Console.WriteLine("Unable to find backup: " + dest); + } } return count; } diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index 752caeab68..bbf6cc0262 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -129,7 +129,7 @@ public void InitializeAll() public void InitializePersonal() { GARCPersonal = GetGARCData("personal"); - Personal = new PersonalTable(GARCPersonal.getFile(GARCPersonal.FileCount - 1), Version); + Personal = new PersonalTable(GARCPersonal.GetFile(GARCPersonal.FileCount - 1), Version); } public void InitializeLearnset() @@ -161,10 +161,10 @@ public void InitializeMoves() if (XY) Moves = GARCMoves.Files.Select(file => new Move6(file)).ToArray(); if (ORAS) - Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move6(file)).ToArray(); + Moves = Mini.UnpackMini(GARCMoves.GetFile(0), "WD").Select(file => new Move6(file)).ToArray(); break; case 7: - Moves = Mini.UnpackMini(GARCMoves.getFile(0), "WD").Select(file => new Move7(file)).ToArray(); + Moves = Mini.UnpackMini(GARCMoves.GetFile(0), "WD").Select(file => new Move7(file)).ToArray(); break; } } @@ -188,54 +188,54 @@ private void InitializeGameInfo() Info = new GameInfo(this); } - public lzGARCFile GetlzGARCData(string file) + public LazyGARCFile GetlzGARCData(string file) { - var gr = getGARCReference(file); - gr = gr.LanguageVariant ? gr.getRelativeGARC(Language, gr.Name) : gr; - return new lzGARCFile(GetlzGARC(file), gr, getGARCPath(file)); + var gr = GetGARCReference(file); + gr = gr.LanguageVariant ? gr.GetRelativeGARC(Language, gr.Name) : gr; + return new LazyGARCFile(GetlzGARC(file), gr, GetGARCPath(file)); } public GARCFile GetGARCData(string file, bool skipRelative = false) { - var gr = getGARCReference(file); + var gr = GetGARCReference(file); if (gr.LanguageVariant && !skipRelative) - gr = gr.getRelativeGARC(Language, gr.Name); + gr = gr.GetRelativeGARC(Language, gr.Name); return GetGARCByReference(gr); } public GARCFile GetGARCByReference(GARCReference gr) { - return new GARCFile(GetMemGARC(gr.Name), gr, getGARCPath(gr.Name)); + return new(GetMemGARC(gr.Name), gr, GetGARCPath(gr.Name)); } - private string getGARCPath(string file) + private string GetGARCPath(string file) { - var gr = getGARCReference(file); - gr = gr.LanguageVariant ? gr.getRelativeGARC(Language, gr.Name) : gr; + var gr = GetGARCReference(file); + gr = gr.LanguageVariant ? gr.GetRelativeGARC(Language, gr.Name) : gr; string subloc = gr.Reference; return Path.Combine(RomFS, subloc); } private GARC.MemGARC GetMemGARC(string file) { - return new GARC.MemGARC(File.ReadAllBytes(getGARCPath(file))); + return new(File.ReadAllBytes(GetGARCPath(file))); } - private GARC.lzGARC GetlzGARC(string file) + private GARC.LazyGARC GetlzGARC(string file) { - return new GARC.lzGARC(File.ReadAllBytes(getGARCPath(file))); + return new(File.ReadAllBytes(GetGARCPath(file))); } public string RomFS, ExeFS; - public GARCReference getGARCReference(string name) { return Files?.FirstOrDefault(f => f.Name == name); } - public TextVariableCode getVariableCode(string name) { return Variables?.FirstOrDefault(v => v.Name == name); } - public TextVariableCode getVariableName(int value) { return Variables?.FirstOrDefault(v => v.Code == value); } + public GARCReference GetGARCReference(string name) { return Files?.FirstOrDefault(f => f.Name == name); } + public TextVariableCode GetVariableCode(string name) { return Variables?.FirstOrDefault(v => v.Name == name); } + public TextVariableCode GetVariableName(int value) { return Variables?.FirstOrDefault(v => v.Code == value); } private TextReference GetGameText(TextName name) { return GameText?.FirstOrDefault(f => f.Name == name); } - public TextData getTextData(TextName file) => new TextData(getText(file)); + public TextData GetTextData(TextName file) => new(GetText(file)); - public string[] getText(TextName file) + public string[] GetText(TextName file) { return (string[])GameTextStrings[GetGameText(file).Index].Clone(); } @@ -248,9 +248,9 @@ public bool SetText(TextName file, string[] strings) public string GetGARCFileName(string requestedGARC) { - var garc = getGARCReference(requestedGARC); + var garc = GetGARCReference(requestedGARC); if (garc.LanguageVariant) - garc = garc.getRelativeGARC(Language); + garc = garc.GetRelativeGARC(Language); return garc.Reference; } @@ -285,22 +285,16 @@ public int Generation public bool IsRebuildable(int fileCount) { - switch (fileCount) + return fileCount switch { - case FILECOUNT_XY: - return Version == GameVersion.XY; - case FILECOUNT_ORAS: - return Version == GameVersion.ORAS; - case FILECOUNT_ORASDEMO: - return Version == GameVersion.ORASDEMO; - case FILECOUNT_SMDEMO: - return Version == GameVersion.SMDEMO; - case FILECOUNT_SM: - return Version == GameVersion.SM; - case FILECOUNT_USUM: - return Version == GameVersion.USUM; - } - return false; + FILECOUNT_XY => Version == GameVersion.XY, + FILECOUNT_ORAS => Version == GameVersion.ORAS, + FILECOUNT_ORASDEMO => Version == GameVersion.ORASDEMO, + FILECOUNT_SMDEMO => Version == GameVersion.SMDEMO, + FILECOUNT_SM => Version == GameVersion.SM, + FILECOUNT_USUM => Version == GameVersion.USUM, + _ => false + }; } } } diff --git a/pk3DS.Core/Game/GameVersion.cs b/pk3DS.Core/Game/GameVersion.cs index 1d23a67a9d..149ac37e23 100644 --- a/pk3DS.Core/Game/GameVersion.cs +++ b/pk3DS.Core/Game/GameVersion.cs @@ -8,9 +8,12 @@ public enum GameVersion Unknown = 0, // Version IDs, also stored in PKM structure - /*Gen3*/ S = 1, R = 2, E = 3, FR = 4, LG = 5, CXD = 15, + /*Gen3*/ S = 1, R = 2, E = 3, FR = 4, LG = 5, - /*Gen4*/ D = 10, P = 11, Pt = 12, HG = 7, SS = 8, + /*Gen4*/ HG = 7, SS = 8, D = 10, P = 11, Pt = 12, + + // Gen3 + CXD = 15, /*Gen5*/ W = 20, B = 21, W2 = 22, B2 = 23, @@ -53,7 +56,7 @@ public enum GameVersion SMDEMO } - public static partial class Extensions + public static class Extensions { public static bool Contains(this GameVersion g1, GameVersion g2) { diff --git a/pk3DS.Core/Game/TextReference.cs b/pk3DS.Core/Game/TextReference.cs index 166e882836..61d5b89b28 100644 --- a/pk3DS.Core/Game/TextReference.cs +++ b/pk3DS.Core/Game/TextReference.cs @@ -48,7 +48,7 @@ public string this[int line] } } - public class TextReference + public sealed class TextReference { public readonly int Index; public readonly TextName Name; @@ -61,103 +61,103 @@ private TextReference(int index, TextName name) public static readonly TextReference[] GameText_XY = { - new TextReference(005, TextName.Forms), - new TextReference(013, TextName.MoveNames), - new TextReference(015, TextName.MoveFlavor), - new TextReference(017, TextName.Types), - new TextReference(020, TextName.TrainerClasses), - new TextReference(021, TextName.TrainerNames), - new TextReference(022, TextName.TrainerText), - new TextReference(034, TextName.AbilityNames), - new TextReference(047, TextName.Natures), - new TextReference(072, TextName.metlist_000000), - new TextReference(080, TextName.SpeciesNames), - new TextReference(096, TextName.ItemNames), - new TextReference(099, TextName.ItemFlavor), - new TextReference(130, TextName.MaisonTrainerNames), - new TextReference(131, TextName.SuperTrainerNames), - new TextReference(141, TextName.OPowerFlavor), + new(005, TextName.Forms), + new(013, TextName.MoveNames), + new(015, TextName.MoveFlavor), + new(017, TextName.Types), + new(020, TextName.TrainerClasses), + new(021, TextName.TrainerNames), + new(022, TextName.TrainerText), + new(034, TextName.AbilityNames), + new(047, TextName.Natures), + new(072, TextName.metlist_000000), + new(080, TextName.SpeciesNames), + new(096, TextName.ItemNames), + new(099, TextName.ItemFlavor), + new(130, TextName.MaisonTrainerNames), + new(131, TextName.SuperTrainerNames), + new(141, TextName.OPowerFlavor), }; public static readonly TextReference[] GameText_AO = { - new TextReference(005, TextName.Forms), - new TextReference(014, TextName.MoveNames), - new TextReference(016, TextName.MoveFlavor), - new TextReference(018, TextName.Types), - new TextReference(021, TextName.TrainerClasses), - new TextReference(022, TextName.TrainerNames), - new TextReference(023, TextName.TrainerText), - new TextReference(037, TextName.AbilityNames), - new TextReference(051, TextName.Natures), - new TextReference(090, TextName.metlist_000000), - new TextReference(098, TextName.SpeciesNames), - new TextReference(114, TextName.ItemNames), - new TextReference(117, TextName.ItemFlavor), - new TextReference(153, TextName.MaisonTrainerNames), - new TextReference(154, TextName.SuperTrainerNames), - new TextReference(165, TextName.OPowerFlavor), + new(005, TextName.Forms), + new(014, TextName.MoveNames), + new(016, TextName.MoveFlavor), + new(018, TextName.Types), + new(021, TextName.TrainerClasses), + new(022, TextName.TrainerNames), + new(023, TextName.TrainerText), + new(037, TextName.AbilityNames), + new(051, TextName.Natures), + new(090, TextName.metlist_000000), + new(098, TextName.SpeciesNames), + new(114, TextName.ItemNames), + new(117, TextName.ItemFlavor), + new(153, TextName.MaisonTrainerNames), + new(154, TextName.SuperTrainerNames), + new(165, TextName.OPowerFlavor), }; public static readonly TextReference[] GameText_SMDEMO = { - new TextReference(020, TextName.ItemFlavor), - new TextReference(021, TextName.ItemNames), - new TextReference(026, TextName.SpeciesNames), - new TextReference(030, TextName.metlist_000000), - new TextReference(044, TextName.Forms), - new TextReference(044, TextName.Natures), - new TextReference(046, TextName.AbilityNames), - new TextReference(049, TextName.TrainerText), - new TextReference(050, TextName.TrainerNames), - new TextReference(051, TextName.TrainerClasses), - new TextReference(052, TextName.Types), - new TextReference(054, TextName.MoveFlavor), - new TextReference(055, TextName.MoveNames), + new(020, TextName.ItemFlavor), + new(021, TextName.ItemNames), + new(026, TextName.SpeciesNames), + new(030, TextName.metlist_000000), + new(044, TextName.Forms), + new(044, TextName.Natures), + new(046, TextName.AbilityNames), + new(049, TextName.TrainerText), + new(050, TextName.TrainerNames), + new(051, TextName.TrainerClasses), + new(052, TextName.Types), + new(054, TextName.MoveFlavor), + new(055, TextName.MoveNames), }; public static readonly TextReference[] GameText_SM = { - new TextReference(035, TextName.ItemFlavor), - new TextReference(036, TextName.ItemNames), - new TextReference(055, TextName.SpeciesNames), - new TextReference(067, TextName.metlist_000000), - new TextReference(086, TextName.BattleRoyalNames), - new TextReference(087, TextName.Natures), - new TextReference(096, TextName.AbilityNames), - new TextReference(099, TextName.BattleTreeNames), - new TextReference(104, TextName.TrainerText), - new TextReference(105, TextName.TrainerNames), - new TextReference(106, TextName.TrainerClasses), - new TextReference(107, TextName.Types), - new TextReference(112, TextName.MoveFlavor), - new TextReference(113, TextName.MoveNames), - new TextReference(114, TextName.Forms), - new TextReference(116, TextName.SpeciesClassifications), - new TextReference(119, TextName.PokedexEntry1), - new TextReference(120, TextName.PokedexEntry2) + new(035, TextName.ItemFlavor), + new(036, TextName.ItemNames), + new(055, TextName.SpeciesNames), + new(067, TextName.metlist_000000), + new(086, TextName.BattleRoyalNames), + new(087, TextName.Natures), + new(096, TextName.AbilityNames), + new(099, TextName.BattleTreeNames), + new(104, TextName.TrainerText), + new(105, TextName.TrainerNames), + new(106, TextName.TrainerClasses), + new(107, TextName.Types), + new(112, TextName.MoveFlavor), + new(113, TextName.MoveNames), + new(114, TextName.Forms), + new(116, TextName.SpeciesClassifications), + new(119, TextName.PokedexEntry1), + new(120, TextName.PokedexEntry2) }; public static readonly TextReference[] GameText_USUM = { - new TextReference(039, TextName.ItemFlavor), - new TextReference(040, TextName.ItemNames), - new TextReference(060, TextName.SpeciesNames), - new TextReference(072, TextName.metlist_000000), - new TextReference(091, TextName.BattleRoyalNames), - new TextReference(092, TextName.Natures), - new TextReference(101, TextName.AbilityNames), - new TextReference(104, TextName.BattleTreeNames), - new TextReference(109, TextName.TrainerText), - new TextReference(110, TextName.TrainerNames), - new TextReference(111, TextName.TrainerClasses), - new TextReference(112, TextName.Types), - new TextReference(117, TextName.MoveFlavor), - new TextReference(118, TextName.MoveNames), - new TextReference(119, TextName.Forms), - new TextReference(121, TextName.SpeciesClassifications), - new TextReference(124, TextName.PokedexEntry1), - new TextReference(125, TextName.PokedexEntry2) + new(039, TextName.ItemFlavor), + new(040, TextName.ItemNames), + new(060, TextName.SpeciesNames), + new(072, TextName.metlist_000000), + new(091, TextName.BattleRoyalNames), + new(092, TextName.Natures), + new(101, TextName.AbilityNames), + new(104, TextName.BattleTreeNames), + new(109, TextName.TrainerText), + new(110, TextName.TrainerNames), + new(111, TextName.TrainerClasses), + new(112, TextName.Types), + new(117, TextName.MoveFlavor), + new(118, TextName.MoveNames), + new(119, TextName.Forms), + new(121, TextName.SpeciesClassifications), + new(124, TextName.PokedexEntry1), + new(125, TextName.PokedexEntry2) }; } } diff --git a/pk3DS.Core/Game/TextVariableCode.cs b/pk3DS.Core/Game/TextVariableCode.cs index 13d12a119c..20a26f1348 100644 --- a/pk3DS.Core/Game/TextVariableCode.cs +++ b/pk3DS.Core/Game/TextVariableCode.cs @@ -1,6 +1,6 @@ namespace pk3DS.Core { - public class TextVariableCode + public sealed class TextVariableCode { public readonly int Code; public readonly string Name; @@ -13,158 +13,158 @@ private TextVariableCode(int code, string name) public static readonly TextVariableCode[] VariableCodes_XY = { - new TextVariableCode(0xFF00, "COLOR"), - new TextVariableCode(0x0100, "TRNAME"), - new TextVariableCode(0x0101, "PKNAME"), - new TextVariableCode(0x0102, "PKNICK"), - new TextVariableCode(0x0103, "TYPE"), - new TextVariableCode(0x0105, "LOCATION"), - new TextVariableCode(0x0106, "ABILITY"), - new TextVariableCode(0x0107, "MOVE"), - new TextVariableCode(0x0108, "ITEM1"), - new TextVariableCode(0x0109, "ITEM2"), - new TextVariableCode(0x010A, "sTRBAG"), - new TextVariableCode(0x010B, "BOX"), - new TextVariableCode(0x010D, "EVSTAT"), - new TextVariableCode(0x0110, "OPOWER"), - new TextVariableCode(0x0127, "RIBBON"), - new TextVariableCode(0x0134, "MIINAME"), - new TextVariableCode(0x013E, "WEATHER"), - new TextVariableCode(0x0189, "TRNICK"), - new TextVariableCode(0x018A, "1stchrTR"), - new TextVariableCode(0x018B, "SHOUTOUT"), - new TextVariableCode(0x018E, "BERRY"), - new TextVariableCode(0x018F, "REMFEEL"), - new TextVariableCode(0x0190, "REMQUAL"), - new TextVariableCode(0x0191, "WEBSITE"), - new TextVariableCode(0x019C, "CHOICECOS"), - new TextVariableCode(0x01A1, "GSYNCID"), - new TextVariableCode(0x0192, "PRVIDSAY"), - new TextVariableCode(0x0193, "BTLTEST"), - new TextVariableCode(0x0195, "GENLOC"), - new TextVariableCode(0x0199, "CHOICEFOOD"), - new TextVariableCode(0x019A, "HOTELITEM"), - new TextVariableCode(0x019B, "TAXISTOP"), - new TextVariableCode(0x019F, "MAISTITLE"), - new TextVariableCode(0x1000, "ITEMPLUR0"), - new TextVariableCode(0x1001, "ITEMPLUR1"), - new TextVariableCode(0x1100, "GENDBR"), - new TextVariableCode(0x1101, "NUMBRNCH"), - new TextVariableCode(0x1302, "iCOLOR2"), - new TextVariableCode(0x1303, "iCOLOR3"), - new TextVariableCode(0x0200, "NUM1"), - new TextVariableCode(0x0201, "NUM2"), - new TextVariableCode(0x0202, "NUM3"), - new TextVariableCode(0x0203, "NUM4"), - new TextVariableCode(0x0204, "NUM5"), - new TextVariableCode(0x0205, "NUM6"), - new TextVariableCode(0x0206, "NUM7"), - new TextVariableCode(0x0207, "NUM8"), - new TextVariableCode(0x0208, "NUM9"), + new(0xFF00, "COLOR"), + new(0x0100, "TRNAME"), + new(0x0101, "PKNAME"), + new(0x0102, "PKNICK"), + new(0x0103, "TYPE"), + new(0x0105, "LOCATION"), + new(0x0106, "ABILITY"), + new(0x0107, "MOVE"), + new(0x0108, "ITEM1"), + new(0x0109, "ITEM2"), + new(0x010A, "sTRBAG"), + new(0x010B, "BOX"), + new(0x010D, "EVSTAT"), + new(0x0110, "OPOWER"), + new(0x0127, "RIBBON"), + new(0x0134, "MIINAME"), + new(0x013E, "WEATHER"), + new(0x0189, "TRNICK"), + new(0x018A, "1stchrTR"), + new(0x018B, "SHOUTOUT"), + new(0x018E, "BERRY"), + new(0x018F, "REMFEEL"), + new(0x0190, "REMQUAL"), + new(0x0191, "WEBSITE"), + new(0x019C, "CHOICECOS"), + new(0x01A1, "GSYNCID"), + new(0x0192, "PRVIDSAY"), + new(0x0193, "BTLTEST"), + new(0x0195, "GENLOC"), + new(0x0199, "CHOICEFOOD"), + new(0x019A, "HOTELITEM"), + new(0x019B, "TAXISTOP"), + new(0x019F, "MAISTITLE"), + new(0x1000, "ITEMPLUR0"), + new(0x1001, "ITEMPLUR1"), + new(0x1100, "GENDBR"), + new(0x1101, "NUMBRNCH"), + new(0x1302, "iCOLOR2"), + new(0x1303, "iCOLOR3"), + new(0x0200, "NUM1"), + new(0x0201, "NUM2"), + new(0x0202, "NUM3"), + new(0x0203, "NUM4"), + new(0x0204, "NUM5"), + new(0x0205, "NUM6"), + new(0x0206, "NUM7"), + new(0x0207, "NUM8"), + new(0x0208, "NUM9"), }; public static readonly TextVariableCode[] VariableCodes_AO = { - new TextVariableCode(0xFF00, "COLOR"), - new TextVariableCode(0x0100, "TRNAME"), - new TextVariableCode(0x0101, "PKNAME"), - new TextVariableCode(0x0102, "PKNICK"), - new TextVariableCode(0x0103, "TYPE"), - new TextVariableCode(0x0105, "LOCATION"), - new TextVariableCode(0x0106, "ABILITY"), - new TextVariableCode(0x0107, "MOVE"), - new TextVariableCode(0x0108, "ITEM1"), - new TextVariableCode(0x0109, "ITEM2"), - new TextVariableCode(0x010A, "sTRBAG"), - new TextVariableCode(0x010B, "BOX"), - new TextVariableCode(0x010D, "EVSTAT"), - new TextVariableCode(0x0110, "OPOWER"), - new TextVariableCode(0x0127, "RIBBON"), - new TextVariableCode(0x0134, "MIINAME"), - new TextVariableCode(0x013E, "WEATHER"), - new TextVariableCode(0x0189, "TRNICK"), - new TextVariableCode(0x018A, "1stchrTR"), - new TextVariableCode(0x018B, "SHOUTOUT"), - new TextVariableCode(0x018E, "BERRY"), - new TextVariableCode(0x018F, "REMFEEL"), - new TextVariableCode(0x0190, "REMQUAL"), - new TextVariableCode(0x0191, "WEBSITE"), - new TextVariableCode(0x019C, "CHOICECOS"), - new TextVariableCode(0x01A1, "GSYNCID"), - new TextVariableCode(0x0192, "PRVIDSAY"), - new TextVariableCode(0x0193, "BTLTEST"), - new TextVariableCode(0x0195, "GENLOC"), - new TextVariableCode(0x0199, "CHOICEFOOD"), - new TextVariableCode(0x019A, "HOTELITEM"), - new TextVariableCode(0x019B, "TAXISTOP"), - new TextVariableCode(0x019F, "MAISTITLE"), - new TextVariableCode(0x1000, "ITEMPLUR0"), - new TextVariableCode(0x1001, "ITEMPLUR1"), - new TextVariableCode(0x1100, "GENDBR"), - new TextVariableCode(0x1101, "NUMBRNCH"), - new TextVariableCode(0x1302, "iCOLOR2"), - new TextVariableCode(0x1303, "iCOLOR3"), - new TextVariableCode(0x0200, "NUM1"), - new TextVariableCode(0x0201, "NUM2"), - new TextVariableCode(0x0202, "NUM3"), - new TextVariableCode(0x0203, "NUM4"), - new TextVariableCode(0x0204, "NUM5"), - new TextVariableCode(0x0205, "NUM6"), - new TextVariableCode(0x0206, "NUM7"), - new TextVariableCode(0x0207, "NUM8"), - new TextVariableCode(0x0208, "NUM9"), + new(0xFF00, "COLOR"), + new(0x0100, "TRNAME"), + new(0x0101, "PKNAME"), + new(0x0102, "PKNICK"), + new(0x0103, "TYPE"), + new(0x0105, "LOCATION"), + new(0x0106, "ABILITY"), + new(0x0107, "MOVE"), + new(0x0108, "ITEM1"), + new(0x0109, "ITEM2"), + new(0x010A, "sTRBAG"), + new(0x010B, "BOX"), + new(0x010D, "EVSTAT"), + new(0x0110, "OPOWER"), + new(0x0127, "RIBBON"), + new(0x0134, "MIINAME"), + new(0x013E, "WEATHER"), + new(0x0189, "TRNICK"), + new(0x018A, "1stchrTR"), + new(0x018B, "SHOUTOUT"), + new(0x018E, "BERRY"), + new(0x018F, "REMFEEL"), + new(0x0190, "REMQUAL"), + new(0x0191, "WEBSITE"), + new(0x019C, "CHOICECOS"), + new(0x01A1, "GSYNCID"), + new(0x0192, "PRVIDSAY"), + new(0x0193, "BTLTEST"), + new(0x0195, "GENLOC"), + new(0x0199, "CHOICEFOOD"), + new(0x019A, "HOTELITEM"), + new(0x019B, "TAXISTOP"), + new(0x019F, "MAISTITLE"), + new(0x1000, "ITEMPLUR0"), + new(0x1001, "ITEMPLUR1"), + new(0x1100, "GENDBR"), + new(0x1101, "NUMBRNCH"), + new(0x1302, "iCOLOR2"), + new(0x1303, "iCOLOR3"), + new(0x0200, "NUM1"), + new(0x0201, "NUM2"), + new(0x0202, "NUM3"), + new(0x0203, "NUM4"), + new(0x0204, "NUM5"), + new(0x0205, "NUM6"), + new(0x0206, "NUM7"), + new(0x0207, "NUM8"), + new(0x0208, "NUM9"), }; public static readonly TextVariableCode[] VariableCodes_SM = { - new TextVariableCode(0xFF00, "COLOR"), - new TextVariableCode(0x0100, "TRNAME"), - new TextVariableCode(0x0101, "PKNAME"), - new TextVariableCode(0x0102, "PKNICK"), - new TextVariableCode(0x0103, "TYPE"), - new TextVariableCode(0x0105, "LOCATION"), - new TextVariableCode(0x0106, "ABILITY"), - new TextVariableCode(0x0107, "MOVE"), - new TextVariableCode(0x0108, "ITEM1"), - new TextVariableCode(0x0109, "ITEM2"), - new TextVariableCode(0x010A, "sTRBAG"), - new TextVariableCode(0x010B, "BOX"), - new TextVariableCode(0x010D, "EVSTAT"), - new TextVariableCode(0x0110, "OPOWER"), - new TextVariableCode(0x0127, "RIBBON"), - new TextVariableCode(0x0134, "MIINAME"), - new TextVariableCode(0x013E, "WEATHER"), - new TextVariableCode(0x0189, "TRNICK"), - new TextVariableCode(0x018A, "1stchrTR"), - new TextVariableCode(0x018B, "SHOUTOUT"), - new TextVariableCode(0x018E, "BERRY"), - new TextVariableCode(0x018F, "REMFEEL"), - new TextVariableCode(0x0190, "REMQUAL"), - new TextVariableCode(0x0191, "WEBSITE"), - new TextVariableCode(0x019C, "CHOICECOS"), - new TextVariableCode(0x01A1, "GSYNCID"), - new TextVariableCode(0x0192, "PRVIDSAY"), - new TextVariableCode(0x0193, "BTLTEST"), - new TextVariableCode(0x0195, "GENLOC"), - new TextVariableCode(0x0199, "CHOICEFOOD"), - new TextVariableCode(0x019A, "HOTELITEM"), - new TextVariableCode(0x019B, "TAXISTOP"), - new TextVariableCode(0x019F, "MAISTITLE"), - new TextVariableCode(0x1000, "ITEMPLUR0"), - new TextVariableCode(0x1001, "ITEMPLUR1"), - new TextVariableCode(0x1100, "GENDBR"), - new TextVariableCode(0x1101, "NUMBRNCH"), - new TextVariableCode(0x1302, "iCOLOR2"), - new TextVariableCode(0x1303, "iCOLOR3"), - new TextVariableCode(0x0200, "NUM1"), - new TextVariableCode(0x0201, "NUM2"), - new TextVariableCode(0x0202, "NUM3"), - new TextVariableCode(0x0203, "NUM4"), - new TextVariableCode(0x0204, "NUM5"), - new TextVariableCode(0x0205, "NUM6"), - new TextVariableCode(0x0206, "NUM7"), - new TextVariableCode(0x0207, "NUM8"), - new TextVariableCode(0x0208, "NUM9"), + new(0xFF00, "COLOR"), + new(0x0100, "TRNAME"), + new(0x0101, "PKNAME"), + new(0x0102, "PKNICK"), + new(0x0103, "TYPE"), + new(0x0105, "LOCATION"), + new(0x0106, "ABILITY"), + new(0x0107, "MOVE"), + new(0x0108, "ITEM1"), + new(0x0109, "ITEM2"), + new(0x010A, "sTRBAG"), + new(0x010B, "BOX"), + new(0x010D, "EVSTAT"), + new(0x0110, "OPOWER"), + new(0x0127, "RIBBON"), + new(0x0134, "MIINAME"), + new(0x013E, "WEATHER"), + new(0x0189, "TRNICK"), + new(0x018A, "1stchrTR"), + new(0x018B, "SHOUTOUT"), + new(0x018E, "BERRY"), + new(0x018F, "REMFEEL"), + new(0x0190, "REMQUAL"), + new(0x0191, "WEBSITE"), + new(0x019C, "CHOICECOS"), + new(0x01A1, "GSYNCID"), + new(0x0192, "PRVIDSAY"), + new(0x0193, "BTLTEST"), + new(0x0195, "GENLOC"), + new(0x0199, "CHOICEFOOD"), + new(0x019A, "HOTELITEM"), + new(0x019B, "TAXISTOP"), + new(0x019F, "MAISTITLE"), + new(0x1000, "ITEMPLUR0"), + new(0x1001, "ITEMPLUR1"), + new(0x1100, "GENDBR"), + new(0x1101, "NUMBRNCH"), + new(0x1302, "iCOLOR2"), + new(0x1303, "iCOLOR3"), + new(0x0200, "NUM1"), + new(0x0201, "NUM2"), + new(0x0202, "NUM3"), + new(0x0203, "NUM4"), + new(0x0204, "NUM5"), + new(0x0205, "NUM6"), + new(0x0206, "NUM7"), + new(0x0207, "NUM8"), + new(0x0208, "NUM9"), }; } } diff --git a/pk3DS.Core/ImageUtil.cs b/pk3DS.Core/ImageUtil.cs index f45c184f48..9e0fda796e 100644 --- a/pk3DS.Core/ImageUtil.cs +++ b/pk3DS.Core/ImageUtil.cs @@ -29,7 +29,7 @@ public static Bitmap GetBitmap(this BXLIM bflim, bool crop = true) public static Bitmap GetBitmap(byte[] data, int width, int height, int stride = 4, PixelFormat format = PixelFormat.Format32bppArgb) { - return new Bitmap(width, height, stride, format, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0)); + return new(width, height, stride, format, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0)); } public static byte[] GetPixelData(Bitmap bitmap) @@ -49,8 +49,8 @@ public static Bitmap GetBitmapETC(BXLIM bxlim, bool crop = true) try { - var width = Math.Max(nlpo2(bxlim.Width), 16); - var height = Math.Max(nlpo2(bxlim.Height), 16); + var width = Math.Max(NextLargestPow2(bxlim.Width), 16); + var height = Math.Max(NextLargestPow2(bxlim.Height), 16); Bitmap img = new Bitmap(width, height); img = DecodeETC(bxlim, img, data, etc1a4); return crop ? CropBMP(bxlim, img) : img; @@ -128,10 +128,10 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat if (w > h) { // Image is now in appropriate order, but the shifting is messed up. Let's fix that. - Bitmap img2 = new Bitmap(Math.Max(nlpo2(bclim.Width), 16), Math.Max(nlpo2(bclim.Height), 16)); - for (int y = 0; y < Math.Max(nlpo2(bclim.Width), 16); y += 8) + Bitmap img2 = new Bitmap(Math.Max(NextLargestPow2(bclim.Width), 16), Math.Max(NextLargestPow2(bclim.Height), 16)); + for (int y = 0; y < Math.Max(NextLargestPow2(bclim.Width), 16); y += 8) { - for (int x = 0; x < Math.Max(nlpo2(bclim.Height), 16); x++) + for (int x = 0; x < Math.Max(NextLargestPow2(bclim.Height), 16); x++) { for (int j = 0; j < 8; j++) // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. @@ -142,17 +142,18 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat } } } - img = img2; + return img2; } - else if (h > w) + + if (h > w) { - Bitmap img2 = new Bitmap(Math.Max(nlpo2(bclim.Width), 16), Math.Max(nlpo2(bclim.Height), 16)); - for (int y = 0; y < Math.Max(nlpo2(bclim.Width), 16); y += 8) + Bitmap img2 = new Bitmap(Math.Max(NextLargestPow2(bclim.Width), 16), Math.Max(NextLargestPow2(bclim.Height), 16)); + for (int y = 0; y < Math.Max(NextLargestPow2(bclim.Width), 16); y += 8) { - for (int x = 0; x < Math.Max(nlpo2(bclim.Height), 16); x++) + for (int x = 0; x < Math.Max(NextLargestPow2(bclim.Height), 16); x++) { for (int j = 0; j < 8; j++) - // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. + // Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later. { int x1 = x % img2.Width; // Reshift x int y1 = (x + (y / 8 * h)) / img2.Width * 8; // Reshift y @@ -160,7 +161,7 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat } } } - img = img2; + return img2; } return img; diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index 849590ca8d..fd4e58e3e7 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -371,29 +371,15 @@ public static partial class Legal 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649, 650, 651, 652 }; - + public static readonly int[][] BasicStarters = { - new int[] { - 001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147 - }, - new int[] { - 152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246 - }, - new int[] { - 252, 255, 258, 265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374 - }, - new int[] { - 387, 390, 393, 396, 403, 406, 440, 443 - }, - new int[] { - 495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602, 607, 610, 633 - }, - new int[] { - 650, 653, 656, 661, 664, 669, 679, 704 - }, - new int[] { - 722, 725, 728, 731, 736, 761, 782, 789 - } + new[] {001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147}, + new[] {152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246}, + new[] {252, 255, 258, 265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374}, + new[] {387, 390, 393, 396, 403, 406, 440, 443}, + new[] {495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602, 607, 610, 633}, + new[] {650, 653, 656, 661, 664, 669, 679, 704}, + new[] {722, 725, 728, 731, 736, 761, 782, 789}, }; public static readonly int[] BasicStarters_6 = BasicStarters[0] @@ -405,7 +391,7 @@ public static partial class Legal .ToArray(); public static readonly int[] BasicStarters_7 = BasicStarters_6.Concat(BasicStarters[6]).ToArray(); - + public static readonly int[] FinalEvolutions_6 = { 003, 006, 009, 012, 015, 018, 020, 022, 024, 026, 028, 031, 034, 036, 038, 040, 045, 047, 049, 051, 053, 055, 057, 059, 062, 065, 068, 071, 073, 076, 078, 080, 083, 085, 087, 089, 091, @@ -418,12 +404,12 @@ public static partial class Legal 561, 563, 565, 567, 569, 571, 573, 576, 579, 581, 584, 586, 587, 589, 591, 593, 594, 596, 598, 601, 604, 606, 609, 612, 614, 615, 617, 618, 620, 621, 623, 625, 626, 628, 630, 631, 632, 635, 637, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701, 702, 703, 706, 707, 709, 711, 713, 715, }; - - public static readonly int[] FinalEvolutions_7 = FinalEvolutions_6.Concat(new int[] + + public static readonly int[] FinalEvolutions_7 = FinalEvolutions_6.Concat(new[] { 724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 774, 775, 776, 777, 779, 780, 781, 784, }).ToArray(); - + public static readonly int[] Legendary_6 = { #region Legendary @@ -468,7 +454,7 @@ public static partial class Legal #endregion }; - public static readonly int[] Legendary_SM = Legendary_6.Concat(new int[] + public static readonly int[] Legendary_SM = Legendary_6.Concat(new[] { #region Legendary 773, // Silvally @@ -489,7 +475,7 @@ public static partial class Legal #endregion }).ToArray(); - public static readonly int[] Legendary_USUM = Legendary_SM.Concat(new int[] + public static readonly int[] Legendary_USUM = Legendary_SM.Concat(new[] { #region Legendary 804, // Naganadel @@ -520,7 +506,7 @@ public static partial class Legal #endregion }; - public static readonly int[] Mythical_SM = Mythical_6.Concat(new int[] + public static readonly int[] Mythical_SM = Mythical_6.Concat(new[] { #region Mythical 801, // Magearna @@ -528,14 +514,14 @@ public static partial class Legal #endregion }).ToArray(); - public static readonly int[] Mythical_USUM = Mythical_SM.Concat(new int[] + public static readonly int[] Mythical_USUM = Mythical_SM.Concat(new[] { #region Mythical 807, // Zeraora #endregion }).ToArray(); - public static readonly HashSet BattleForms = new HashSet + public static readonly HashSet BattleForms = new() { 351, // Castform 421, // Cherrim @@ -547,7 +533,7 @@ public static partial class Legal 778, // Mimikyu }; - public static readonly HashSet BattleMegas = new HashSet + public static readonly HashSet BattleMegas = new() { // XY 003, 006, 009, 065, 080, 115, 127, 130, 142, 150, @@ -567,7 +553,7 @@ public static partial class Legal 800, // Ultra Necrozma }; - public static readonly HashSet BattlePrimals = new HashSet { 382, 383 }; - public static HashSet BattleExclusiveForms = new HashSet(BattleForms.Concat(BattleMegas.Concat(BattlePrimals))); + public static readonly HashSet BattlePrimals = new() { 382, 383 }; + public static HashSet BattleExclusiveForms = new(BattleForms.Concat(BattleMegas.Concat(BattlePrimals))); } } diff --git a/pk3DS.Core/Legality/Tables6.cs b/pk3DS.Core/Legality/Tables6.cs index 17d6583363..81bea18b54 100644 --- a/pk3DS.Core/Legality/Tables6.cs +++ b/pk3DS.Core/Legality/Tables6.cs @@ -226,7 +226,7 @@ public static partial class Legal }; #endregion - + public static readonly int[] EggLocations6 = {60002, 30002}; public static readonly int[] ValidMet_XY = @@ -292,7 +292,7 @@ public static partial class Legal public static readonly int[] Inherit_Sport = { 010, 013, 046, 048, 123, 127, 265, 290, 314, 401, 415, - + 313, // Via Illumise }; @@ -488,28 +488,28 @@ public static partial class Legal new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // Region matching }; - public static readonly HashSet MemoryGeneral = new HashSet { 1, 2, 3, 4, 19, 24, 31, 32, 33, 35, 36, 37, 38, 39, 42, 52, 59 }; - public static readonly HashSet MemorySpecific = new HashSet { 6 }; - public static readonly HashSet MemoryMove = new HashSet { 12, 16, 48, 49 }; - public static readonly HashSet MemoryItem = new HashSet { 5, 15, 26, 34, 40, 51 }; - public static readonly HashSet MemorySpecies = new HashSet { 7, 9, 13, 14, 17, 21, 18, 25, 29, 44, 45, 50, 60 }; + public static readonly HashSet MemoryGeneral = new() { 1, 2, 3, 4, 19, 24, 31, 32, 33, 35, 36, 37, 38, 39, 42, 52, 59 }; + public static readonly HashSet MemorySpecific = new() { 6 }; + public static readonly HashSet MemoryMove = new() { 12, 16, 48, 49 }; + public static readonly HashSet MemoryItem = new() { 5, 15, 26, 34, 40, 51 }; + public static readonly HashSet MemorySpecies = new() { 7, 9, 13, 14, 17, 21, 18, 25, 29, 44, 45, 50, 60 }; #endregion public static readonly int[] MovePP_XY = { - 00, - 35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 20, 30, 35, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20, - 30, 25, 15, 30, 25, 05, 15, 10, 05, 20, 20, 20, 05, 35, 20, 25, 20, 20, 20, 15, 25, 15, 10, 20, 25, 10, 35, 30, 15, 10, 40, 10, 15, 30, 15, 20, 10, 15, 10, 05, 10, 10, 25, 10, 20, 40, 30, 30, 20, 20, - 15, 10, 40, 15, 10, 30, 10, 20, 10, 40, 40, 20, 30, 30, 20, 30, 10, 10, 20, 05, 10, 30, 20, 20, 20, 05, 15, 15, 20, 10, 15, 35, 20, 15, 10, 10, 30, 15, 40, 20, 15, 10, 05, 10, 30, 10, 15, 20, 15, 40, - 20, 10, 05, 15, 10, 10, 10, 15, 30, 30, 10, 10, 20, 10, 01, 01, 10, 25, 10, 05, 15, 25, 15, 10, 15, 30, 05, 40, 15, 10, 25, 10, 30, 10, 20, 10, 10, 10, 10, 10, 20, 05, 40, 05, 05, 15, 05, 10, 05, 10, - 10, 10, 10, 20, 20, 40, 15, 10, 20, 20, 25, 05, 15, 10, 05, 20, 15, 20, 25, 20, 05, 30, 05, 10, 20, 40, 05, 20, 40, 20, 15, 35, 10, 05, 05, 05, 15, 05, 20, 05, 05, 15, 20, 10, 05, 05, 15, 10, 15, 15, - 10, 10, 10, 20, 10, 10, 10, 10, 15, 15, 15, 10, 20, 20, 10, 20, 20, 20, 20, 20, 10, 10, 10, 20, 20, 05, 15, 10, 10, 15, 10, 20, 05, 05, 10, 10, 20, 05, 10, 20, 10, 20, 20, 20, 05, 05, 15, 20, 10, 15, - 20, 15, 10, 10, 15, 10, 05, 05, 10, 15, 10, 05, 20, 25, 05, 40, 15, 05, 40, 15, 20, 20, 05, 15, 20, 20, 15, 15, 05, 10, 30, 20, 30, 15, 05, 40, 15, 05, 20, 05, 15, 25, 25, 15, 20, 15, 20, 15, 20, 10, - 20, 20, 05, 05, 10, 05, 40, 10, 10, 05, 10, 10, 15, 10, 20, 15, 30, 10, 20, 05, 10, 10, 15, 10, 10, 05, 15, 05, 10, 10, 30, 20, 20, 10, 10, 05, 05, 10, 05, 20, 10, 20, 10, 15, 10, 20, 20, 20, 15, 15, - 10, 15, 15, 15, 10, 10, 10, 20, 10, 30, 05, 10, 15, 10, 10, 05, 20, 30, 10, 30, 15, 15, 15, 15, 30, 10, 20, 15, 10, 10, 20, 15, 05, 05, 15, 15, 05, 10, 05, 20, 05, 15, 20, 05, 20, 20, 20, 20, 10, 20, - 10, 15, 20, 15, 10, 10, 05, 10, 05, 05, 10, 05, 05, 10, 05, 05, 05, 15, 10, 10, 10, 10, 10, 10, 15, 20, 15, 10, 15, 10, 15, 10, 20, 10, 15, 10, 20, 20, 20, 20, 20, 15, 15, 15, 15, 15, 15, 20, 15, 10, - 15, 15, 15, 15, 10, 10, 10, 10, 10, 15, 15, 15, 15, 05, 05, 15, 05, 10, 10, 10, 20, 20, 20, 10, 10, 30, 15, 15, 10, 15, 25, 10, 15, 10, 10, 10, 20, 10, 10, 10, 10, 10, 15, 15, 05, 05, 10, 10, 10, 05, - 05, 10, 05, 05, 15, 10, 05, 05, 05, 10, 10, 10, 10, 20, 25, 10, 20, 30, 25, 20, 20, 15, 20, 15, 20, 20, 10, 10, 10, 10, 10, 20, 10, 30, 15, 10, 10, 10, 20, 20, 05, 05, 05, 20, 10, 10, 20, 15, 20, 20, + 00, + 35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 20, 30, 35, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20, + 30, 25, 15, 30, 25, 05, 15, 10, 05, 20, 20, 20, 05, 35, 20, 25, 20, 20, 20, 15, 25, 15, 10, 20, 25, 10, 35, 30, 15, 10, 40, 10, 15, 30, 15, 20, 10, 15, 10, 05, 10, 10, 25, 10, 20, 40, 30, 30, 20, 20, + 15, 10, 40, 15, 10, 30, 10, 20, 10, 40, 40, 20, 30, 30, 20, 30, 10, 10, 20, 05, 10, 30, 20, 20, 20, 05, 15, 15, 20, 10, 15, 35, 20, 15, 10, 10, 30, 15, 40, 20, 15, 10, 05, 10, 30, 10, 15, 20, 15, 40, + 20, 10, 05, 15, 10, 10, 10, 15, 30, 30, 10, 10, 20, 10, 01, 01, 10, 25, 10, 05, 15, 25, 15, 10, 15, 30, 05, 40, 15, 10, 25, 10, 30, 10, 20, 10, 10, 10, 10, 10, 20, 05, 40, 05, 05, 15, 05, 10, 05, 10, + 10, 10, 10, 20, 20, 40, 15, 10, 20, 20, 25, 05, 15, 10, 05, 20, 15, 20, 25, 20, 05, 30, 05, 10, 20, 40, 05, 20, 40, 20, 15, 35, 10, 05, 05, 05, 15, 05, 20, 05, 05, 15, 20, 10, 05, 05, 15, 10, 15, 15, + 10, 10, 10, 20, 10, 10, 10, 10, 15, 15, 15, 10, 20, 20, 10, 20, 20, 20, 20, 20, 10, 10, 10, 20, 20, 05, 15, 10, 10, 15, 10, 20, 05, 05, 10, 10, 20, 05, 10, 20, 10, 20, 20, 20, 05, 05, 15, 20, 10, 15, + 20, 15, 10, 10, 15, 10, 05, 05, 10, 15, 10, 05, 20, 25, 05, 40, 15, 05, 40, 15, 20, 20, 05, 15, 20, 20, 15, 15, 05, 10, 30, 20, 30, 15, 05, 40, 15, 05, 20, 05, 15, 25, 25, 15, 20, 15, 20, 15, 20, 10, + 20, 20, 05, 05, 10, 05, 40, 10, 10, 05, 10, 10, 15, 10, 20, 15, 30, 10, 20, 05, 10, 10, 15, 10, 10, 05, 15, 05, 10, 10, 30, 20, 20, 10, 10, 05, 05, 10, 05, 20, 10, 20, 10, 15, 10, 20, 20, 20, 15, 15, + 10, 15, 15, 15, 10, 10, 10, 20, 10, 30, 05, 10, 15, 10, 10, 05, 20, 30, 10, 30, 15, 15, 15, 15, 30, 10, 20, 15, 10, 10, 20, 15, 05, 05, 15, 15, 05, 10, 05, 20, 05, 15, 20, 05, 20, 20, 20, 20, 10, 20, + 10, 15, 20, 15, 10, 10, 05, 10, 05, 05, 10, 05, 05, 10, 05, 05, 05, 15, 10, 10, 10, 10, 10, 10, 15, 20, 15, 10, 15, 10, 15, 10, 20, 10, 15, 10, 20, 20, 20, 20, 20, 15, 15, 15, 15, 15, 15, 20, 15, 10, + 15, 15, 15, 15, 10, 10, 10, 10, 10, 15, 15, 15, 15, 05, 05, 15, 05, 10, 10, 10, 20, 20, 20, 10, 10, 30, 15, 15, 10, 15, 25, 10, 15, 10, 10, 10, 20, 10, 10, 10, 10, 10, 15, 15, 05, 05, 10, 10, 10, 05, + 05, 10, 05, 05, 15, 10, 05, 05, 05, 10, 10, 10, 10, 20, 25, 10, 20, 30, 25, 20, 20, 15, 20, 15, 20, 20, 10, 10, 10, 10, 10, 20, 10, 30, 15, 10, 10, 10, 20, 20, 05, 05, 05, 20, 10, 10, 20, 15, 20, 20, 10, 20, 30, 10, 10, 40, 40, 30, 20, 40, 20, 20, 10, 10, 10, 10, 05, 10, 10, 05, 05, }; diff --git a/pk3DS.Core/Legality/Tables7.cs b/pk3DS.Core/Legality/Tables7.cs index 281ca76f9a..d84932c59a 100644 --- a/pk3DS.Core/Legality/Tables7.cs +++ b/pk3DS.Core/Legality/Tables7.cs @@ -81,7 +81,7 @@ public static partial class Legal }; internal static readonly ushort[] Pouch_Items_SM = Pouch_Regular_SM.Concat(Pouch_Ball_SM).Concat(Pouch_Battle_SM).ToArray(); - + internal static readonly ushort[] Pouch_Key_SM = { 216, 465, 466, 628, 629, 631, 632, 633, 638, 696, 705, 706, 765, 773, 797, @@ -226,14 +226,14 @@ public static partial class Legal #endregion internal static readonly bool[] ReleasedHeldItems_7 = Enumerable.Range(0, MaxItemID_7_SM+1).Select(i => HeldItems_SM.Contains((ushort)i) && !UnreleasedHeldItems_7.Contains(i)).ToArray(); - public static readonly HashSet Totem_Alolan = new HashSet + public static readonly HashSet Totem_Alolan = new() { 020, // Raticate (Normal, Alolan, Totem) 105, // Marowak (Normal, Alolan, Totem) 778, // Mimikyu (Normal, Busted, Totem, Totem_Busted) }; - public static readonly HashSet Totem_SM = new HashSet + public static readonly HashSet Totem_SM = new() { 020, // Raticate 735, // Gumshoos @@ -245,7 +245,7 @@ public static partial class Legal 784, // Kommo-o }; - public static readonly HashSet Totem_USUM = new HashSet + public static readonly HashSet Totem_USUM = new() { 020, // Raticate 735, // Gumshoos diff --git a/pk3DS.Core/Properties/Resources.Designer.cs b/pk3DS.Core/Properties/Resources.Designer.cs index d9ae772ddc..ead022bc4d 100644 --- a/pk3DS.Core/Properties/Resources.Designer.cs +++ b/pk3DS.Core/Properties/Resources.Designer.cs @@ -169,5 +169,25 @@ public static byte[] XY { return ((byte[])(obj)); } } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + public static byte[] SuMo { + get { + object obj = ResourceManager.GetObject("SuMo", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + public static byte[] USUM { + get { + object obj = ResourceManager.GetObject("USUM", resourceCulture); + return ((byte[])(obj)); + } + } } } diff --git a/pk3DS.Core/Properties/Resources.resx b/pk3DS.Core/Properties/Resources.resx index 1eca08555f..cca01c8316 100644 --- a/pk3DS.Core/Properties/Resources.resx +++ b/pk3DS.Core/Properties/Resources.resx @@ -139,6 +139,12 @@ ..\Resources\romdata\byte\PlainRegion\XY.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\romdata\byte\PlainRegion\SuMo.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\romdata\byte\PlainRegion\USUM.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\romdata\txt\3dsgames.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 diff --git a/pk3DS.Core/Randomizers/EggMoveRandomizer.cs b/pk3DS.Core/Randomizers/EggMoveRandomizer.cs index 9386fc02a0..4d50763282 100644 --- a/pk3DS.Core/Randomizers/EggMoveRandomizer.cs +++ b/pk3DS.Core/Randomizers/EggMoveRandomizer.cs @@ -24,13 +24,15 @@ public EggMoveRandomizer(GameConfig config, EggMoves[] sets) public int ExpandTo = 18; public bool STAB { set => moverand.rSTAB = value; } public int[] BannedMoves { set => moverand.BannedMoves = value; } - public decimal rSTABPercent { set => moverand.rSTABPercent = value; } + public decimal STABPercent { set => moverand.rSTABPercent = value; } public void Execute() { if (Sets[0] is EggMoves6) + { for (int i = 0; i < Sets.Length; i++) Randomize(Sets[i], i); + } else if (Sets[0] is EggMoves7) { for (int i = 0; i <= Config.MaxSpeciesID; i++) @@ -39,7 +41,7 @@ public void Execute() int formoff = ((EggMoves7) Sets[i]).FormTableIndex; int count = Config.Personal[i].FormeCount; for (int j = 1; j < count; j++) - Randomize(Sets[formoff + j - 1], Config.Personal.getFormeIndex(i, j)); + Randomize(Sets[formoff + j - 1], Config.Personal.GetFormIndex(i, j)); } } } diff --git a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs index c0281501aa..bf61c80739 100644 --- a/pk3DS.Core/Randomizers/EvolutionRandomizer.cs +++ b/pk3DS.Core/Randomizers/EvolutionRandomizer.cs @@ -38,11 +38,8 @@ public void ExecuteTrade() public void ExecuteEvolveEveryLevel() { - for (var i = 0; i < Evolutions.Length; i++) - { - var evo = Evolutions[i]; - MakeEvolveEveryLevel(evo, i); - } + foreach (var evo in Evolutions) + MakeEvolveEveryLevel(evo); } private void Randomize(EvolutionSet evo, int i) @@ -73,7 +70,7 @@ private void Trade(EvolutionSet evo, int i) v.Level = 30; v.Method = 4; // trade -> level up } - + if (v.Method == 6) // trade with held item -> level up with held item v.Method = 19; @@ -88,7 +85,7 @@ private void Trade(EvolutionSet evo, int i) } } - private void MakeEvolveEveryLevel(EvolutionSet evo, int species) + private void MakeEvolveEveryLevel(EvolutionSet evo) { var evos = evo.PossibleEvolutions; foreach (EvolutionMethod v in evos) diff --git a/pk3DS.Core/Randomizers/FormRandomizer.cs b/pk3DS.Core/Randomizers/FormRandomizer.cs index 692bbc3f13..ba07ecae13 100644 --- a/pk3DS.Core/Randomizers/FormRandomizer.cs +++ b/pk3DS.Core/Randomizers/FormRandomizer.cs @@ -17,8 +17,7 @@ public FormRandomizer(GameConfig game) public int GetRandomForme(int species, PersonalInfo[] stats = null) { - if (stats == null) - stats = Game.Personal.Table; + stats ??= Game.Personal.Table; if (stats[species].FormeCount <= 1) return 0; @@ -29,13 +28,13 @@ public int GetRandomForme(int species, PersonalInfo[] stats = null) case 664: case 665: case 666: // Vivillon evo chain return 30; // save file specific case 774: // Minior - return (int)(Util.rnd32() % 7); + return (int)(Util.Random32() % 7); } if (AllowAlolanForm && Legal.EvolveToAlolanForms.Contains(species)) - return (int)(Util.rnd32() % 2); + return (int)(Util.Random32() % 2); if (!Legal.BattleExclusiveForms.Contains(species) || AllowMega) - return (int)(Util.rnd32() % stats[species].FormeCount); // Slot-Random + return (int)(Util.Random32() % stats[species].FormeCount); // Slot-Random return 0; } } diff --git a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs index 2aef7b6a57..d823d220d8 100644 --- a/pk3DS.Core/Randomizers/LearnsetRandomizer.cs +++ b/pk3DS.Core/Randomizers/LearnsetRandomizer.cs @@ -21,7 +21,7 @@ public LearnsetRandomizer(GameConfig config, Learnset[] sets) Config = config; moverand = new MoveRandomizer(config); Learnsets = sets; - rSTABPercent = 52.3m; + STABPercent = 52.3m; } public bool Expand = true; @@ -34,7 +34,7 @@ public LearnsetRandomizer(GameConfig config, Learnset[] sets) public bool STAB { set => moverand.rSTAB = value; } public IList BannedMoves { set => moverand.BannedMoves = value; } - public decimal rSTABPercent { set => moverand.rSTABPercent = value; } + public decimal STABPercent { set => moverand.rSTABPercent = value; } public void Execute() { @@ -89,7 +89,7 @@ private int[] GetRandomMoves(int count, int index) int[] moves = new int[count]; if (count == 0) return moves; - moves[0] = STABFirst ? moverand.GetRandomFirstMove(index) : moverand.GetRandomFirstMoveAny(); + moves[0] = STABFirst ? moverand.GetRandomFirstMove(index) : MoveRandomizer.GetRandomFirstMoveAny(); var rand = moverand.GetRandomLearnset(index, count - 1); // STAB Moves (if requested) come first; randomize the order of moves @@ -102,7 +102,7 @@ private int[] GetRandomMoves(int count, int index) public int[] GetHighPoweredMoves(int species, int form, int count = 4) { - int index = Config.Personal.getFormeIndex(species, form); + int index = Config.Personal.GetFormIndex(species, form); var moves = Learnsets[index].Moves.OrderByDescending(move => Config.Moves[move].Power).Distinct().Take(count).ToArray(); Array.Resize(ref moves, count); return moves; @@ -110,7 +110,7 @@ public int[] GetHighPoweredMoves(int species, int form, int count = 4) public int[] GetCurrentMoves(int species, int form, int level, int count = 4) { - int i = Config.Personal.getFormeIndex(species, form); + int i = Config.Personal.GetFormIndex(species, form); var moves = Learnsets[i].GetEncounterMoves(level); Array.Resize(ref moves, count); return moves; diff --git a/pk3DS.Core/Randomizers/MoveInfoRandomizer.cs b/pk3DS.Core/Randomizers/MoveInfoRandomizer.cs index 9d1d259132..8d1df35937 100644 --- a/pk3DS.Core/Randomizers/MoveInfoRandomizer.cs +++ b/pk3DS.Core/Randomizers/MoveInfoRandomizer.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace pk3DS.Core.Randomizers +namespace pk3DS.Core.Randomizers { public class MoveInfoRandomizer { diff --git a/pk3DS.Core/Randomizers/MoveRandomizer.cs b/pk3DS.Core/Randomizers/MoveRandomizer.cs index a9e4ba4038..6ce8d2f59a 100644 --- a/pk3DS.Core/Randomizers/MoveRandomizer.cs +++ b/pk3DS.Core/Randomizers/MoveRandomizer.cs @@ -8,8 +8,8 @@ namespace pk3DS.Core.Randomizers { public class MoveRandomizer : IRandomizer { - private readonly GameConfig Config; - private readonly int MaxMoveID; + //private readonly GameConfig Config; + //private readonly int MaxMoveID; private readonly Move[] MoveData; private readonly PersonalInfo[] SpeciesStat; @@ -17,8 +17,8 @@ public class MoveRandomizer : IRandomizer public MoveRandomizer(GameConfig config) { - Config = config; - MaxMoveID = config.Info.MaxMoveID; + //Config = config; + var MaxMoveID = config.Info.MaxMoveID; MoveData = config.Moves; SpeciesStat = config.Personal.Table; RandMove = new GenericRandomizer(Enumerable.Range(1, MaxMoveID-1).ToArray()); @@ -26,7 +26,6 @@ public MoveRandomizer(GameConfig config) public void Execute() { - throw new NotImplementedException(); } public bool rDMG = true; @@ -34,11 +33,11 @@ public void Execute() public bool rSTAB = true; public int rSTABCount = 2; public decimal rSTABPercent = 100; - public IList BannedMoves = new int[0]; + public IList BannedMoves = Array.Empty(); public static readonly int[] FixedDamageMoves = { 49, 82 }; - private int loopctr = 0; + private int loopctr; public int[] GetRandomLearnset(int index, int movecount) => GetRandomLearnset(SpeciesStat[index].Types, movecount); @@ -70,8 +69,11 @@ private int[] GetRandomMoves(int[] Types, int movecount = 4) int i = 0; int[] moves = new int[movecount]; if (rSTAB) - for (; i < rSTABCount; i++) - moves[i] = GetRandomSTABMove(Types); + { + for (; i < rSTABCount; i++) + moves[i] = GetRandomSTABMove(Types); + } + for (; i < moves.Length; i++) // remainder of moves moves[i] = RandMove.Next(); return moves; @@ -100,7 +102,7 @@ public void ReorderMovesPower(IList moves) { var data = moves.Select((Move, Index) => new {Index, Move, Data = MoveData[Move]}); var powered = data.Where(z => z.Data.Power > 1).ToList(); - var indexes = powered.Select(z => z.Index).ToList(); + var indexes = powered.ConvertAll(z => z.Index); var order = powered.OrderBy(z => z.Data.Power * Math.Max(1, (z.Data.HitMin + z.Data.HitMax)/2m)).ToList(); for (var i = 0; i < order.Count; i++) @@ -122,9 +124,9 @@ public void ReorderMovesPower(IList moves) }; - private static readonly GenericRandomizer first = new GenericRandomizer(firstMoves); + private static readonly GenericRandomizer first = new(firstMoves); - public int GetRandomFirstMoveAny() + public static int GetRandomFirstMoveAny() { first.Reset(); return first.Next(); diff --git a/pk3DS.Core/Randomizers/PersonalRandomizer.cs b/pk3DS.Core/Randomizers/PersonalRandomizer.cs index 78ef1fe723..bf627a83c1 100644 --- a/pk3DS.Core/Randomizers/PersonalRandomizer.cs +++ b/pk3DS.Core/Randomizers/PersonalRandomizer.cs @@ -9,7 +9,7 @@ namespace pk3DS.Core.Randomizers { public class PersonalRandomizer : IRandomizer { - private readonly Random rnd = Util.rand; + private readonly Random rnd = Util.Rand; private const decimal LearnTMPercent = 35; // Average Learnable TMs is 35.260. private const decimal LearnTypeTutorPercent = 2; //136 special tutor moves learnable by species in Untouched ORAS. @@ -42,9 +42,9 @@ public class PersonalRandomizer : IRandomizer public bool ModifyEggGroup = true; public decimal SameEggGroupChance = 50; - private const bool Advanced = false; - private const bool TMInheritance = false; - private const bool ModifyLearnsetSmartly = false; + //public bool Advanced { get; set; } = false; + public bool TMInheritance { get; set; } + public bool ModifyLearnsetSmartly { get; set; } public ushort[] MoveIDsTMs { private get; set; } public Move[] Moves => Game.Moves; @@ -154,12 +154,12 @@ public void Randomize(PersonalInfo z, int index) private void RandomizeTMHMAdvanced(PersonalInfo z) { var tms = z.TMHM; - var types = z.Types; + //var types = z.Types; - bool CanLearn(Move m) + bool CanLearn(Move _) { - var type = m.Type; - bool typeMatch = types.Any(t => t == type); + //var type = m.Type; + //bool typeMatch = types.Any(t => t == type); // todo: how do I learn move? return rnd.Next(0, 100) < LearnTMPercent; } @@ -191,12 +191,16 @@ private void RandomizeTMHMSimple(PersonalInfo z) var tms = z.TMHM; if (ModifyLearnsetTM) - for (int j = 0; j < tmcount; j++) - tms[j] = rnd.Next(0, 100) < LearnTMPercent; + { + for (int j = 0; j < tmcount; j++) + tms[j] = rnd.Next(0, 100) < LearnTMPercent; + } if (ModifyLearnsetHM) - for (int j = tmcount; j < tms.Length; j++) - tms[j] = rnd.Next(0, 100) < LearnTMPercent; + { + for (int j = tmcount; j < tms.Length; j++) + tms[j] = rnd.Next(0, 100) < LearnTMPercent; + } z.TMHM = tms; } @@ -218,8 +222,11 @@ private void RandomizeSpecialTutors(PersonalInfo z) { var tutors = z.SpecialTutors; foreach (bool[] tutor in tutors) + { for (int i = 0; i < tutor.Length; i++) tutor[i] = rnd.Next(0, 100) < LearnMoveTutorPercent; + } + z.SpecialTutors = tutors; } @@ -278,15 +285,15 @@ private void RandomShuffledStats(PersonalInfo z) var stats = z.Stats; if (stats[0] == 1) return; - for (int i = 0; i < stats.Length; i++) - Util.Shuffle(stats); + + Util.Shuffle(stats); z.Stats = stats; } private int GetRandomType() => rnd.Next(0, TypeCount); private int GetRandomEggGroup() => rnd.Next(1, eggGroupCount); private int GetRandomHeldItem() => Game.Info.HeldItems[rnd.Next(1, Game.Info.HeldItems.Length)]; - private readonly IList BannedAbilities = new int[0]; + private readonly IList BannedAbilities = Array.Empty(); private int GetRandomAbility() { diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index d5c84ede81..c870303013 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -7,13 +7,13 @@ namespace pk3DS.Core.Randomizers { public class SpeciesRandomizer { - private readonly GameConfig Game; + //private readonly GameConfig Game; private readonly PersonalInfo[] SpeciesStat; private readonly int MaxSpeciesID; public SpeciesRandomizer(GameConfig config) { - Game = config; + var Game = config; MaxSpeciesID = Game.Info.MaxSpeciesID; SpeciesStat = Game.Personal.Table; } diff --git a/pk3DS.Core/Structures/EggMoves.cs b/pk3DS.Core/Structures/EggMoves.cs index 61f3c7cce3..2b815e311a 100644 --- a/pk3DS.Core/Structures/EggMoves.cs +++ b/pk3DS.Core/Structures/EggMoves.cs @@ -16,16 +16,15 @@ public class EggMoves6 : EggMoves public EggMoves6(byte[] data) { if (data.Length < 2 || data.Length % 2 != 0) - { Count = 0; Moves = new int[0]; return; } - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - { - Moves = new int[Count = br.ReadUInt16()]; - for (int i = 0; i < Count; i++) - Moves[i] = br.ReadUInt16(); - } + { Count = 0; Moves = System.Array.Empty(); return; } + + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + Moves = new int[Count = br.ReadUInt16()]; + for (int i = 0; i < Count; i++) + Moves[i] = br.ReadUInt16(); } - public static EggMoves[] getArray(byte[][] entries) + public static EggMoves[] GetArray(byte[][] entries) { EggMoves[] data = new EggMoves[entries.Length]; for (int i = 0; i < data.Length; i++) @@ -36,16 +35,14 @@ public static EggMoves[] getArray(byte[][] entries) public override byte[] Write() { Count = Moves.Length; - if (Count == 0) return new byte[0]; - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - bw.Write((ushort)Count); - for (int i = 0; i < Count; i++) - bw.Write((ushort)Moves[i]); + if (Count == 0) return System.Array.Empty(); + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + bw.Write((ushort)Count); + for (int i = 0; i < Count; i++) + bw.Write((ushort)Moves[i]); - return ms.ToArray(); - } + return ms.ToArray(); } } @@ -54,18 +51,17 @@ public class EggMoves7 : EggMoves public EggMoves7(byte[] data) { if (data.Length < 2 || data.Length % 2 != 0) - { Count = 0; Moves = new int[0]; return; } - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - { - FormTableIndex = br.ReadUInt16(); - Count = br.ReadUInt16(); - Moves = new int[Count]; - for (int i = 0; i < Count; i++) - Moves[i] = br.ReadUInt16(); - } + { Count = 0; Moves = System.Array.Empty(); return; } + + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + FormTableIndex = br.ReadUInt16(); + Count = br.ReadUInt16(); + Moves = new int[Count]; + for (int i = 0; i < Count; i++) + Moves[i] = br.ReadUInt16(); } - public static EggMoves[] getArray(byte[][] entries) + public static EggMoves[] GetArray(byte[][] entries) { EggMoves[] data = new EggMoves[entries.Length]; for (int i = 0; i < data.Length; i++) @@ -76,16 +72,14 @@ public static EggMoves[] getArray(byte[][] entries) public override byte[] Write() { Count = Moves.Length; - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - bw.Write((ushort)FormTableIndex); - bw.Write((ushort)Count); - for (int i = 0; i < Count; i++) - bw.Write((ushort)Moves[i]); + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + bw.Write((ushort)FormTableIndex); + bw.Write((ushort)Count); + for (int i = 0; i < Count; i++) + bw.Write((ushort)Moves[i]); - return ms.ToArray(); - } + return ms.ToArray(); } } } diff --git a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs index a3da482a8e..59240098b7 100644 --- a/pk3DS.Core/Structures/Gen6/EncounterGift6.cs +++ b/pk3DS.Core/Structures/Gen6/EncounterGift6.cs @@ -38,79 +38,75 @@ public EncounterGift6(byte[] data, bool oras) { Data = data; ORAS = oras; - using (BinaryReader br = new BinaryReader(new MemoryStream(Data))) - { - Species = br.ReadUInt16(); - u2 = br.ReadUInt16(); - Form = br.ReadByte(); - Level = br.ReadByte(); - Shiny = br.ReadByte(); - Ability = br.ReadSByte(); - Nature = br.ReadSByte(); - u9 = br.ReadByte(); - uA = br.ReadByte(); - uB = br.ReadByte(); - HeldItem = br.ReadInt32(); - Gender = br.ReadSByte(); - - if (ORAS) - { - u11 = br.ReadByte(); - MetLocation = br.ReadInt16(); - Move = br.ReadUInt16(); - } + using BinaryReader br = new BinaryReader(new MemoryStream(Data)); + Species = br.ReadUInt16(); + u2 = br.ReadUInt16(); + Form = br.ReadByte(); + Level = br.ReadByte(); + Shiny = br.ReadByte(); + Ability = br.ReadSByte(); + Nature = br.ReadSByte(); + u9 = br.ReadByte(); + uA = br.ReadByte(); + uB = br.ReadByte(); + HeldItem = br.ReadInt32(); + Gender = br.ReadSByte(); - for (int i = 0; i < 6; i++) - IVs[i] = br.ReadSByte(); + if (ORAS) + { + u11 = br.ReadByte(); + MetLocation = br.ReadInt16(); + Move = br.ReadUInt16(); + } - if (ORAS) - { - ContestStats = br.ReadBytes(6); - u22 = br.ReadByte(); - } + for (int i = 0; i < 6; i++) + IVs[i] = br.ReadSByte(); - uLast = br.ReadByte(); + if (ORAS) + { + ContestStats = br.ReadBytes(6); + u22 = br.ReadByte(); } + + uLast = br.ReadByte(); } public byte[] Write() { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - bw.Write(Species); - bw.Write(u2); - bw.Write(Form); - bw.Write(Level); - bw.Write(Shiny); - bw.Write(Ability); - bw.Write(Nature); - bw.Write(u9); - bw.Write(uA); - bw.Write(uB); - bw.Write(HeldItem); - bw.Write(Gender); + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + bw.Write(Species); + bw.Write(u2); + bw.Write(Form); + bw.Write(Level); + bw.Write(Shiny); + bw.Write(Ability); + bw.Write(Nature); + bw.Write(u9); + bw.Write(uA); + bw.Write(uB); + bw.Write(HeldItem); + bw.Write(Gender); - if (ORAS) - { - bw.Write(u11); - bw.Write(MetLocation); - bw.Write(Move); - } + if (ORAS) + { + bw.Write(u11); + bw.Write(MetLocation); + bw.Write(Move); + } - for (int i = 0; i < 6; i++) - bw.Write(IVs[i]); + for (int i = 0; i < 6; i++) + bw.Write(IVs[i]); - if (ORAS) - { - bw.Write(ContestStats); - bw.Write(u22); - } + if (ORAS) + { + bw.Write(ContestStats); + bw.Write(u22); + } - bw.Write(uLast); + bw.Write(uLast); - return ms.ToArray(); - } + return ms.ToArray(); } } } diff --git a/pk3DS.Core/Structures/Gen6/Evolutions.cs b/pk3DS.Core/Structures/Gen6/Evolutions.cs index 21ea1503fd..1246746efb 100644 --- a/pk3DS.Core/Structures/Gen6/Evolutions.cs +++ b/pk3DS.Core/Structures/Gen6/Evolutions.cs @@ -48,17 +48,15 @@ public EvolutionSet6(byte[] data) public override byte[] Write() { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + foreach (EvolutionMethod evo in PossibleEvolutions) { - foreach (EvolutionMethod evo in PossibleEvolutions) - { - bw.Write((ushort)evo.Method); - bw.Write((ushort)evo.Argument); - bw.Write((ushort)evo.Species); - } - return ms.ToArray(); + bw.Write((ushort)evo.Method); + bw.Write((ushort)evo.Argument); + bw.Write((ushort)evo.Species); } + return ms.ToArray(); } } @@ -87,19 +85,17 @@ public EvolutionSet7(byte[] data) public override byte[] Write() { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + foreach (EvolutionMethod evo in PossibleEvolutions) { - foreach (EvolutionMethod evo in PossibleEvolutions) - { - bw.Write((ushort)evo.Method); - bw.Write((ushort)evo.Argument); - bw.Write((ushort)evo.Species); - bw.Write((sbyte)evo.Form); - bw.Write((byte)evo.Level); - } - return ms.ToArray(); + bw.Write((ushort)evo.Method); + bw.Write((ushort)evo.Argument); + bw.Write((ushort)evo.Species); + bw.Write((sbyte)evo.Form); + bw.Write((byte)evo.Level); } + return ms.ToArray(); } } } diff --git a/pk3DS.Core/Structures/Gen6/HealValue.cs b/pk3DS.Core/Structures/Gen6/HealValue.cs deleted file mode 100644 index b0cb1246c6..0000000000 --- a/pk3DS.Core/Structures/Gen6/HealValue.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace pk3DS.Core.Structures -{ - public enum HealValue : byte - { - Full = 0xFF, - Half = 0xFE, - Quarter = 0xFD, - None = 0, - } -} diff --git a/pk3DS.Core/Structures/Gen6/Item6.cs b/pk3DS.Core/Structures/Gen6/Item6.cs index c8f0f62fac..6d3c0641e8 100644 --- a/pk3DS.Core/Structures/Gen6/Item6.cs +++ b/pk3DS.Core/Structures/Gen6/Item6.cs @@ -33,8 +33,8 @@ public struct Item [Category(Battle), Description("Routine # to call when used; 0=unusable.")] public byte EffectBattle { get; set; } // Battle Type - public byte _0xC { get; set; } // 0 or 1 - public byte _0xD { get; set; } // Classification (0-3 Battle, 4 Balls, 5 Mail) + public byte Unk_0xC { get; set; } // 0 or 1 + public byte Unk_0xD { get; set; } // Classification (0-3 Battle, 4 Balls, 5 Mail) private byte Consumable { get; set; } // 4 bits for use consume, 4 bits for use not consumed public byte SortIndex { get; set; } public BattleStatusFlags CureInflict { get; set; } // Bitflags @@ -64,7 +64,7 @@ public struct Item public sbyte EVSPD { get; set; } [Category(Heal), Description("Determines the healing percent, or if a flat value is used."), RefreshProperties(RefreshProperties.All)] - public HealValue HealAmount { get; set; } + public Heal HealAmount { get; set; } [Category(Field), Description("PP to be added to the move's current PP if used.")] public byte PPGain { get; set; } @@ -139,7 +139,7 @@ public struct Item public int HealValue { get => (int) HealAmount; - set => HealAmount = (HealValue)value; + set => HealAmount = (Heal)value; } [Category(Heal), Description("Item is consumed when used."), RefreshProperties(RefreshProperties.All)] diff --git a/pk3DS.Core/Structures/Gen6/Maison6.cs b/pk3DS.Core/Structures/Gen6/Maison6.cs index 33f5483e1c..dc95960ac1 100644 --- a/pk3DS.Core/Structures/Gen6/Maison6.cs +++ b/pk3DS.Core/Structures/Gen6/Maison6.cs @@ -3,7 +3,7 @@ namespace pk3DS.Core.Structures { - public class Maison6 + public static class Maison6 { public class Trainer { @@ -24,15 +24,13 @@ public Trainer(byte[] data) public byte[] Write() { - using (var ms = new MemoryStream()) - using (var bw = new BinaryWriter(ms)) - { - bw.Write(Class); - bw.Write(Count); - foreach (ushort Choice in Choices) - bw.Write(Choice); - return ms.ToArray(); - } + using var ms = new MemoryStream(); + using var bw = new BinaryWriter(ms); + bw.Write(Class); + bw.Write(Count); + foreach (ushort Choice in Choices) + bw.Write(Choice); + return ms.ToArray(); } } @@ -46,16 +44,36 @@ public class Pokemon public ushort Item; public ushort Form; - public int Move1 { get { return Moves[0]; } set { Moves[0] = (ushort)value; } } - public int Move2 { get { return Moves[1]; } set { Moves[1] = (ushort)value; } } - public int Move3 { get { return Moves[2]; } set { Moves[2] = (ushort)value; } } - public int Move4 { get { return Moves[3]; } set { Moves[3] = (ushort)value; } } - public bool HP { get { return EVs[0]; } set { EVs[0] = value; } } - public bool ATK { get { return EVs[1]; } set { EVs[1] = value; } } - public bool DEF { get { return EVs[2]; } set { EVs[2] = value; } } - public bool SPE { get { return EVs[3]; } set { EVs[3] = value; } } - public bool SPA { get { return EVs[4]; } set { EVs[4] = value; } } - public bool SPD { get { return EVs[5]; } set { EVs[5] = value; } } + public int Move1 { get => Moves[0]; + set => Moves[0] = (ushort)value; + } + public int Move2 { get => Moves[1]; + set => Moves[1] = (ushort)value; + } + public int Move3 { get => Moves[2]; + set => Moves[2] = (ushort)value; + } + public int Move4 { get => Moves[3]; + set => Moves[3] = (ushort)value; + } + public bool HP { get => EVs[0]; + set => EVs[0] = value; + } + public bool ATK { get => EVs[1]; + set => EVs[1] = value; + } + public bool DEF { get => EVs[2]; + set => EVs[2] = value; + } + public bool SPE { get => EVs[3]; + set => EVs[3] = value; + } + public bool SPA { get => EVs[4]; + set => EVs[4] = value; + } + public bool SPD { get => EVs[5]; + set => EVs[5] = value; + } public Pokemon(byte[] data) { @@ -72,23 +90,21 @@ public Pokemon(byte[] data) public byte[] Write() { - using (var ms = new MemoryStream()) - using (var bw = new BinaryWriter(ms)) - { - bw.Write(Species); - foreach (ushort Move in Moves) - bw.Write(Move); + using var ms = new MemoryStream(); + using var bw = new BinaryWriter(ms); + bw.Write(Species); + foreach (ushort Move in Moves) + bw.Write(Move); - int ev = EV & 0xC0; - for (int i = 0; i < EVs.Length; i++) - ev |= EVs[i] ? 1 << i : 0; - bw.Write((byte)ev); + int ev = EV & 0xC0; + for (int i = 0; i < EVs.Length; i++) + ev |= EVs[i] ? 1 << i : 0; + bw.Write((byte)ev); - bw.Write(Nature); - bw.Write(Item); - bw.Write(Form); - return ms.ToArray(); - } + bw.Write(Nature); + bw.Write(Item); + bw.Write(Form); + return ms.ToArray(); } } } diff --git a/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs b/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs index 151eb8234c..3b9a472c21 100644 --- a/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs +++ b/pk3DS.Core/Structures/Gen6/MegaEvolution6.cs @@ -13,32 +13,30 @@ public MegaEvolutions(byte[] data) Method = new ushort[data.Length / 8]; Argument = new ushort[data.Length / 8]; u6 = new ushort[data.Length / 8]; - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - for (int i = 0; i < Form.Length; i++) - { - Form[i] = br.ReadUInt16(); - Method[i] = br.ReadUInt16(); - Argument[i] = br.ReadUInt16(); - u6[i] = br.ReadUInt16(); - } + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + for (int i = 0; i < Form.Length; i++) + { + Form[i] = br.ReadUInt16(); + Method[i] = br.ReadUInt16(); + Argument[i] = br.ReadUInt16(); + u6[i] = br.ReadUInt16(); + } } public byte[] Write() { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + for (int i = 0; i < Form.Length; i++) { - for (int i = 0; i < Form.Length; i++) - { - if (Method[i] == 0) - { Form[i] = Argument[i] = 0; } // No method to evolve, clear information. - bw.Write(Form[i]); - bw.Write(Method[i]); - bw.Write(Argument[i]); - bw.Write(u6[i]); - } - return ms.ToArray(); + if (Method[i] == 0) + { Form[i] = Argument[i] = 0; } // No method to evolve, clear information. + bw.Write(Form[i]); + bw.Write(Method[i]); + bw.Write(Argument[i]); + bw.Write(u6[i]); } + return ms.ToArray(); } } } diff --git a/pk3DS.Core/Structures/Gen6/TrainerData6.cs b/pk3DS.Core/Structures/Gen6/TrainerData6.cs new file mode 100644 index 0000000000..e71125cc24 --- /dev/null +++ b/pk3DS.Core/Structures/Gen6/TrainerData6.cs @@ -0,0 +1,144 @@ +using System; +using System.IO; +using System.Linq; + +namespace pk3DS.Core.Structures +{ + public class TrainerData6 + { + public bool isORAS; + public int Format, Class; + public bool Item, Moves; + public byte BattleType, NumPokemon, AI; + public ushort[] Items = new ushort[4]; + public byte u1, u2, u3; + public ushort uORAS; + public bool Healer; + public byte Money; + public ushort Prize; + public Pokemon[] Team; + + public TrainerData6(byte[] trData, byte[] trPoke, bool ORAS) + { + using var ms = new MemoryStream(trData); + using BinaryReader br = new BinaryReader(ms); + isORAS = ORAS; + Format = ORAS ? br.ReadUInt16() : br.ReadByte(); + Class = ORAS ? br.ReadUInt16() : br.ReadByte(); + if (ORAS) uORAS = br.ReadUInt16(); + Item = ((Format >> 1) & 1) == 1; + Moves = (Format & 1) == 1; + BattleType = br.ReadByte(); + NumPokemon = br.ReadByte(); + for (int i = 0; i < 4; i++) + Items[i] = br.ReadUInt16(); + AI = br.ReadByte(); + u1 = br.ReadByte(); + u2 = br.ReadByte(); + u3 = br.ReadByte(); + Healer = br.ReadByte() != 0; + Money = br.ReadByte(); + Prize = br.ReadUInt16(); + + // Fetch Team + Team = new Pokemon[NumPokemon]; + byte[][] TeamData = new byte[NumPokemon][]; + int dataLen = trPoke.Length / NumPokemon; + for (int i = 0; i < TeamData.Length; i++) + TeamData[i] = trPoke.Skip(i * dataLen).Take(dataLen).ToArray(); + for (int i = 0; i < NumPokemon; i++) + Team[i] = new Pokemon(TeamData[i], Item, Moves); + } + + public byte[] Write() + { + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + Format = Convert.ToByte(Moves) + (Convert.ToByte(Item) << 1); + if (isORAS) + { bw.Write((ushort)Format); bw.Write((ushort)Class); bw.Write((ushort)0); } + else + { bw.Write((byte)Format); bw.Write((byte)Class); } + + bw.Write(BattleType); + bw.Write(NumPokemon); + bw.Write(Items[0]); + bw.Write(Items[1]); + bw.Write(Items[2]); + bw.Write(Items[3]); + + bw.Write(AI); + bw.Write(u1); + bw.Write(u2); + bw.Write(u3); + bw.Write(Convert.ToByte(Healer)); + bw.Write(Money); + bw.Write(Prize); + + return ms.ToArray(); + } + + public byte[] WriteTeam() + { + return Team.Aggregate(Array.Empty(), (i, pkm) => i.Concat(pkm.Write(Item, Moves)).ToArray()); + } + + public class Pokemon + { + public byte IVs; + public byte PID; + public ushort Level; + public ushort Species; + public ushort Form; + public int Ability; + public int Gender; + public int uBit; + public ushort Item; + public ushort[] Moves = new ushort[4]; + + public Pokemon(byte[] data, bool HasItem, bool HasMoves) + { + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + IVs = br.ReadByte(); + PID = br.ReadByte(); + Level = br.ReadUInt16(); + Species = br.ReadUInt16(); + Form = br.ReadUInt16(); + + Ability = PID >> 4; + Gender = PID & 3; + uBit = (PID >> 3) & 1; + + if (HasItem) + Item = br.ReadUInt16(); + if (HasMoves) + { + for (int i = 0; i < 4; i++) + Moves[i] = br.ReadUInt16(); + } + } + + public byte[] Write(bool HasItem, bool HasMoves) + { + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + bw.Write(IVs); + PID = (byte)(((Ability & 0xF) << 4) | ((uBit & 1) << 3) | (Gender & 0x7)); + bw.Write(PID); + bw.Write(Level); + bw.Write(Species); + bw.Write(Form); + + if (HasItem) + bw.Write(Item); + if (HasMoves) + { + foreach (ushort Move in Moves) + bw.Write(Move); + } + + return ms.ToArray(); + } + } + } +} diff --git a/pk3DS.Core/Structures/Gen6/trdata6.cs b/pk3DS.Core/Structures/Gen6/trdata6.cs deleted file mode 100644 index e94533fbb3..0000000000 --- a/pk3DS.Core/Structures/Gen6/trdata6.cs +++ /dev/null @@ -1,146 +0,0 @@ -using System; -using System.IO; -using System.Linq; - -namespace pk3DS.Core.Structures -{ - public class trdata6 - { - public bool isORAS; - public int Format, Class; - public bool Item, Moves; - public byte BattleType, NumPokemon, AI; - public ushort[] Items = new ushort[4]; - public byte u1, u2, u3; - public ushort uORAS; - public bool Healer; - public byte Money; - public ushort Prize; - public Pokemon[] Team; - - public trdata6(byte[] trData, byte[] trPoke, bool ORAS) - { - using (BinaryReader br = new BinaryReader(new MemoryStream(trData))) - { - isORAS = ORAS; - Format = ORAS ? br.ReadUInt16() : br.ReadByte(); - Class = ORAS ? br.ReadUInt16() : br.ReadByte(); - if (ORAS) uORAS = br.ReadUInt16(); - Item = ((Format >> 1) & 1) == 1; - Moves = (Format & 1) == 1; - BattleType = br.ReadByte(); - NumPokemon = br.ReadByte(); - for (int i = 0; i < 4; i++) - Items[i] = br.ReadUInt16(); - AI = br.ReadByte(); - u1 = br.ReadByte(); - u2 = br.ReadByte(); - u3 = br.ReadByte(); - Healer = br.ReadByte() != 0; - Money = br.ReadByte(); - Prize = br.ReadUInt16(); - - // Fetch Team - Team = new Pokemon[NumPokemon]; - byte[][] TeamData = new byte[NumPokemon][]; - int dataLen = trPoke.Length / NumPokemon; - for (int i = 0; i < TeamData.Length; i++) - TeamData[i] = trPoke.Skip(i * dataLen).Take(dataLen).ToArray(); - for (int i = 0; i < NumPokemon; i++) - Team[i] = new Pokemon(TeamData[i], Item, Moves); - } - } - - public byte[] Write() - { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - Format = Convert.ToByte(Moves) + (Convert.ToByte(Item) << 1); - if (isORAS) - { bw.Write((ushort)Format); bw.Write((ushort)Class); bw.Write((ushort)0); } - else - { bw.Write((byte)Format); bw.Write((byte)Class); } - - bw.Write(BattleType); - bw.Write(NumPokemon); - bw.Write(Items[0]); - bw.Write(Items[1]); - bw.Write(Items[2]); - bw.Write(Items[3]); - - bw.Write(AI); - bw.Write(u1); - bw.Write(u2); - bw.Write(u3); - bw.Write(Convert.ToByte(Healer)); - bw.Write(Money); - bw.Write(Prize); - - return ms.ToArray(); - } - } - - public byte[] WriteTeam() - { - return Team.Aggregate(new byte[0], (i, pkm) => i.Concat(pkm.Write(Item, Moves)).ToArray()); - } - - public class Pokemon - { - public byte IVs; - public byte PID; - public ushort Level; - public ushort Species; - public ushort Form; - public int Ability; - public int Gender; - public int uBit; - public ushort Item; - public ushort[] Moves = new ushort[4]; - - public Pokemon(byte[] data, bool HasItem, bool HasMoves) - { - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - { - IVs = br.ReadByte(); - PID = br.ReadByte(); - Level = br.ReadUInt16(); - Species = br.ReadUInt16(); - Form = br.ReadUInt16(); - - Ability = PID >> 4; - Gender = PID & 3; - uBit = (PID >> 3) & 1; - - if (HasItem) - Item = br.ReadUInt16(); - if (HasMoves) - for (int i = 0; i < 4; i++) - Moves[i] = br.ReadUInt16(); - } - } - - public byte[] Write(bool HasItem, bool HasMoves) - { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - bw.Write(IVs); - PID = (byte)(((Ability & 0xF) << 4) | ((uBit & 1) << 3) | (Gender & 0x7)); - bw.Write(PID); - bw.Write(Level); - bw.Write(Species); - bw.Write(Form); - - if (HasItem) - bw.Write(Item); - if (HasMoves) - foreach (ushort Move in Moves) - bw.Write(Move); - return ms.ToArray(); - } - } - } - } -} diff --git a/pk3DS.Core/Structures/Gen7/Area7.cs b/pk3DS.Core/Structures/Gen7/Area7.cs index 6a8f11add6..8d505f23f4 100644 --- a/pk3DS.Core/Structures/Gen7/Area7.cs +++ b/pk3DS.Core/Structures/Gen7/Area7.cs @@ -53,7 +53,7 @@ public static byte[] GetDayNightTableBinary(IList tables) return Mini.PackMini(tabs, PackIdentifier); } - public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) + public static Area7[] GetArray(LazyGARCFile ed, ZoneData7[] zd) { int fileCount = ed.FileCount; var numAreas = fileCount / 11; @@ -66,7 +66,7 @@ public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) Zones = zd.Where(z => z.AreaIndex == i).ToArray() }; var md = ed[areas[i].FileNumber]; - if (md.Length <= 0) + if (md.Length == 0) { areas[i].HasTables = false; continue; @@ -96,7 +96,7 @@ public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) /// WorldData GARC /// Location strings /// Annotated Area Array - public static Area7[] GetArray(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd, string[] locationList) + public static Area7[] GetArray(LazyGARCFile ed, LazyGARCFile zd, LazyGARCFile wd, string[] locationList) { var Worlds = wd.Files.Select(f => Mini.UnpackMini(f, "WD")[0]).ToArray(); diff --git a/pk3DS.Core/Structures/Gen7/Encounter7.cs b/pk3DS.Core/Structures/Gen7/Encounter7.cs index f091907fe9..cbf1f15296 100644 --- a/pk3DS.Core/Structures/Gen7/Encounter7.cs +++ b/pk3DS.Core/Structures/Gen7/Encounter7.cs @@ -19,7 +19,7 @@ public string GetSummary(string[] speciesList) var sb = new StringBuilder(); sb.Append(speciesList[Species]); if (Forme != 0) - sb.Append($" (Forme {Forme})"); + sb.Append(" (Forme ").Append(Forme).Append(')'); return sb.ToString(); } diff --git a/pk3DS.Core/Structures/Gen7/EncounterGift7.cs b/pk3DS.Core/Structures/Gen7/EncounterGift7.cs index ee850313b3..0c1d402da2 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterGift7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterGift7.cs @@ -63,7 +63,7 @@ public override int HeldItem public bool IsEgg { get => Data[0xA] == 1; - set => Data[0xA] = (byte)(value ? 1 : 0); + set => Data[0xA] = value ? 1 : 0; } public int SpecialMove @@ -92,8 +92,7 @@ public string GetSummary() if (SpecialMove != 0) str += $"Moves = new[] {{{SpecialMove}}}, "; - str = str.Trim() + " },"; - return str; + return str.Trim() + " },"; } } } diff --git a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs index c3af4ca7b6..6b509701d2 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterStatic7.cs @@ -70,13 +70,13 @@ public int Ability set => Data[0x6] = (byte)((Data[0x6] & ~0x70) | ((value & 7) << 4)); } - public bool _7 + public bool Unk_7 { get => (Data[0x7] & 1) >> 0 == 1; set => Data[0x7] = (byte)((Data[0x7] & ~1) | (value ? 1 : 0)); } - public bool _7_1 + public bool Unk_7_1 { get => (Data[0x7] & 2) >> 1 == 1; set => Data[0x7] = (byte)((Data[0x7] & ~2) | (value ? 2 : 0)); @@ -171,7 +171,9 @@ public string GetSummary() str += "Shiny = false, "; if (IV3) + { str += "IV3 = true, "; + } else if (IVs.Any(z => z >= 0)) { var iv = IVs.Select(z => z >= 0 ? $"{z:00}" : "-1"); @@ -191,8 +193,7 @@ public string GetSummary() if (Nature != 0) str += $"Nature = {Nature - 1}, "; - str = str.Trim() + " },"; - return str; + return str.Trim() + " },"; } } } diff --git a/pk3DS.Core/Structures/Gen7/EncounterTable.cs b/pk3DS.Core/Structures/Gen7/EncounterTable.cs index 62af900f77..f037e54908 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterTable.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterTable.cs @@ -95,7 +95,7 @@ public string GetSummary(string[] speciesList) var tn = "Encounters"; if (i != 0) tn = "SOS Slot " + i; - sb.Append($"{tn} (Levels {MinLevel}-{MaxLevel}): "); + sb.Append(tn).Append(" (Levels ").Append(MinLevel).Append('-').Append(MaxLevel).Append("): "); sb.AppendLine(GetSlotSetSummary(speciesList, i)); } @@ -121,7 +121,7 @@ private string GetSlotSetSummary(string[] speciesList, int setNumber) } specToRate[encounter.RawValue] += Rates[j]; } - var list = distincts.OrderBy(e => specToRate[e.RawValue]).Reverse(); + var list = distincts.OrderByDescending(e => specToRate[e.RawValue]); var summaries = list.Select(e => $"{e.GetSummary(speciesList)} ({specToRate[e.RawValue]}%)"); return string.Join(", ", summaries); } diff --git a/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs b/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs index 4ee9052386..04b180a498 100644 --- a/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs +++ b/pk3DS.Core/Structures/Gen7/EncounterTrade7.cs @@ -15,18 +15,18 @@ public EncounterTrade7(byte[] data) public override int Species { - get { return BitConverter.ToUInt16(Data, 0x0); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0); } + get => BitConverter.ToUInt16(Data, 0x0); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0); } public int String1 { - get { return BitConverter.ToUInt16(Data, 0x2); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2); } + get => BitConverter.ToUInt16(Data, 0x2); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2); } - public int Form { get { return Data[0x4]; } set { Data[0x4] = (byte)value; } } - public int Level { get { return Data[0x5]; } set { Data[0x5] = (byte)value; } } + public int Form { get => Data[0x4]; set => Data[0x4] = (byte)value; } + public int Level { get => Data[0x5]; set => Data[0x5] = (byte)value; } public int[] IVs { @@ -46,12 +46,12 @@ public int[] IVs } } - public int Ability { get { return Data[0xC]; } set { Data[0xC] = (byte)value; } } - public int Nature { get { return Data[0xD]; } set { Data[0xD] = (byte)value; } } - public int Gender { get { return Data[0xE]; } set { Data[0xE] = (byte)value; } } - public int TID { get { return BitConverter.ToUInt16(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } } - public int SID { get { return BitConverter.ToUInt16(Data, 0x12); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } } - public uint ID { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } } + public int Ability { get => Data[0xC]; set => Data[0xC] = (byte)value; } + public int Nature { get => Data[0xD]; set => Data[0xD] = (byte)value; } + public int Gender { get => Data[0xE]; set => Data[0xE] = (byte)value; } + public int TID { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } + public int SID { get => BitConverter.ToUInt16(Data, 0x12); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } + public uint ID { get => BitConverter.ToUInt32(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } public override int HeldItem { @@ -70,23 +70,23 @@ public override int HeldItem public int String2 { - get { return BitConverter.ToUInt16(Data, 0x18); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } + get => BitConverter.ToUInt16(Data, 0x18); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } - public int trGender { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } } + public int OT_Gender { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } - public ushort OT_Intensity { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } } - public ushort OT_Memory { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } } - public ushort OT_TextVar { get { return BitConverter.ToUInt16(Data, 0x20); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x20); } } - public ushort OT_Feeling { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } } + public ushort OT_Intensity { get => BitConverter.ToUInt16(Data, 0x1C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1C); } + public ushort OT_Memory { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1E); } + public ushort OT_TextVar { get => BitConverter.ToUInt16(Data, 0x20); set => BitConverter.GetBytes(value).CopyTo(Data, 0x20); } + public ushort OT_Feeling { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes(value).CopyTo(Data, 0x22); } // 0x24-0x2B are language IDs set depending on the game's current language; all default to -1 public int TradeRequestSpecies { - get { return BitConverter.ToUInt16(Data, 0x2C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } + get => BitConverter.ToUInt16(Data, 0x2C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } } } diff --git a/pk3DS.Core/Structures/Gen7/Maison7.cs b/pk3DS.Core/Structures/Gen7/Maison7.cs index d71b9411c6..0c99c47d1b 100644 --- a/pk3DS.Core/Structures/Gen7/Maison7.cs +++ b/pk3DS.Core/Structures/Gen7/Maison7.cs @@ -24,15 +24,13 @@ public Trainer(byte[] data) public byte[] Write() { - using (var ms = new MemoryStream()) - using (var bw = new BinaryWriter(ms)) - { - bw.Write(Class); - bw.Write(Count); - foreach (ushort Choice in Choices) - bw.Write(Choice); - return ms.ToArray(); - } + using var ms = new MemoryStream(); + using var bw = new BinaryWriter(ms); + bw.Write(Class); + bw.Write(Count); + foreach (ushort Choice in Choices) + bw.Write(Choice); + return ms.ToArray(); } } @@ -72,23 +70,21 @@ public Pokemon(byte[] data) public byte[] Write() { - using (var ms = new MemoryStream()) - using (var bw = new BinaryWriter(ms)) - { - bw.Write(Species); - foreach (ushort Move in Moves) - bw.Write(Move); + using var ms = new MemoryStream(); + using var bw = new BinaryWriter(ms); + bw.Write(Species); + foreach (ushort Move in Moves) + bw.Write(Move); - int ev = EV & 0xC0; - for (int i = 0; i < EVs.Length; i++) - ev |= EVs[i] ? 1 << i : 0; - bw.Write((byte)ev); + int ev = EV & 0xC0; + for (int i = 0; i < EVs.Length; i++) + ev |= EVs[i] ? 1 << i : 0; + bw.Write((byte)ev); - bw.Write(Nature); - bw.Write(Item); - bw.Write(Form); - return ms.ToArray(); - } + bw.Write(Nature); + bw.Write(Item); + bw.Write(Form); + return ms.ToArray(); } } } diff --git a/pk3DS.Core/Structures/Gen7/trdata7.cs b/pk3DS.Core/Structures/Gen7/TrainerData7.cs similarity index 80% rename from pk3DS.Core/Structures/Gen7/trdata7.cs rename to pk3DS.Core/Structures/Gen7/TrainerData7.cs index d1e56a5a8a..5175fd5432 100644 --- a/pk3DS.Core/Structures/Gen7/trdata7.cs +++ b/pk3DS.Core/Structures/Gen7/TrainerData7.cs @@ -3,24 +3,24 @@ namespace pk3DS.Core.Structures { - public class trdata7 + public class TrainerData7 { private readonly byte[] trdata; - public readonly List Pokemon = new List(); + public readonly List Pokemon = new(); public int ID { get; set; } public string Name { get; set; } - public trdata7(byte[] tr = null, byte[] tp = null) + public TrainerData7(byte[] tr = null, byte[] tp = null) { - tr = tr ?? new byte[0x14]; - tp = tp ?? new byte[0x20]; + tr ??= new byte[0x14]; + tp ??= new byte[0x20]; trdata = (byte[])tr.Clone(); for (int i = 0; i < NumPokemon; i++) { byte[] poke = new byte[0x20]; Array.Copy(tp, i * 0x20, poke, 0, 0x20); - Pokemon.Add(new trpoke7(poke)); + Pokemon.Add(new TrainerPoke7(poke)); } } @@ -33,15 +33,15 @@ public trdata7(byte[] tr = null, byte[] tp = null) public int Item4 { get => BitConverter.ToUInt16(trdata, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x0A); } public int AI { get => trdata[0x0C]; set => trdata[0x0C] = (byte)value; } - public bool Flag { get => trdata[0x0D] == 1; set => trdata[0x0D] = (byte)(value ? 1 : 0); } + public bool Flag { get => trdata[0x0D] == 1; set => trdata[0x0D] = value ? 1 : 0; } public int Money { get => trdata[0x11]; set => trdata[0x11] = (byte)value; } public void Write(out byte[] tr, out byte[] pk) { tr = trdata; - byte[] dat = new byte[trpoke7.SIZE * NumPokemon]; + byte[] dat = new byte[TrainerPoke7.SIZE * NumPokemon]; for (int i = 0; i < NumPokemon; i++) - Pokemon[i].Write().CopyTo(dat, trpoke7.SIZE*i); + Pokemon[i].Write().CopyTo(dat, TrainerPoke7.SIZE*i); pk = dat; } } diff --git a/pk3DS.Core/Structures/Gen7/trpoke7.cs b/pk3DS.Core/Structures/Gen7/TrainerPoke7.cs similarity index 95% rename from pk3DS.Core/Structures/Gen7/trpoke7.cs rename to pk3DS.Core/Structures/Gen7/TrainerPoke7.cs index 117b2e4ab5..5e2e59348d 100644 --- a/pk3DS.Core/Structures/Gen7/trpoke7.cs +++ b/pk3DS.Core/Structures/Gen7/TrainerPoke7.cs @@ -2,21 +2,21 @@ namespace pk3DS.Core.Structures { - public class trpoke7 + public class TrainerPoke7 { public const int SIZE = 0x20; private readonly byte[] Data; - public trpoke7(byte[] d = null) + public TrainerPoke7(byte[] d = null) { Data = (byte[])(d ?? new byte[SIZE]).Clone(); if (Data.Length != 0x20) throw new ArgumentException("Invalid trpoke7!"); } - public trpoke7 Clone() + public TrainerPoke7 Clone() { - return new trpoke7(Write()); + return new(Write()); } public int Gender @@ -48,7 +48,7 @@ public int Ability public int IV_SPA { get => (int)(IV32 >> 15) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } public int IV_SPD { get => (int)(IV32 >> 20) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } public int IV_SPE { get => (int)(IV32 >> 25) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } - public bool Shiny { get => ((IV32 >> 30) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } + public bool Shiny { get => ((IV32 >> 30) & 1) == 1; set => IV32 = ((IV32 & ~0x40000000u) | (value ? 0x40000000u : 0)); } public int Level { get => Data[0xE]; set => Data[0xE] = (byte)value; } public int Species { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } diff --git a/pk3DS.Core/Structures/Learnset.cs b/pk3DS.Core/Structures/Learnset.cs index bba51d11a5..e1c634ed5b 100644 --- a/pk3DS.Core/Structures/Learnset.cs +++ b/pk3DS.Core/Structures/Learnset.cs @@ -23,13 +23,13 @@ public int[] GetMoves(int maxLevel, int minLevel = 0) if (minLevel <= 1 && maxLevel >= 100) return Moves; if (minLevel > maxLevel) - return new int[0]; + return Array.Empty(); int start = Array.FindIndex(Levels, z => z >= minLevel); if (start < 0) - return new int[0]; + return Array.Empty(); int end = Array.FindLastIndex(Levels, z => z <= maxLevel); if (end < 0) - return new int[0]; + return Array.Empty(); int[] result = new int[end - start + 1]; Array.Copy(Moves, start, result, 0, result.Length); return result; @@ -86,12 +86,12 @@ public class Learnset6 : Learnset public Learnset6(byte[] data) { if (data.Length < 4 || data.Length % 4 != 0) - { Count = 0; Levels = new int[0]; Moves = new int[0]; return; } + { Count = 0; Levels = Array.Empty(); Moves = Array.Empty(); return; } Count = (data.Length / 4) - 1; Moves = new int[Count]; Levels = new int[Count]; - using (var ms = new MemoryStream(data)) - using (var br = new BinaryReader(ms)) + using var ms = new MemoryStream(data); + using var br = new BinaryReader(ms); for (int i = 0; i < Count; i++) { Moves[i] = br.ReadInt16(); @@ -102,17 +102,15 @@ public Learnset6(byte[] data) public override byte[] Write() { Count = (ushort)Moves.Length; - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + for (int i = 0; i < Count; i++) { - for (int i = 0; i < Count; i++) - { - bw.Write((short)Moves[i]); - bw.Write((short)Levels[i]); - } - bw.Write(-1); - return ms.ToArray(); + bw.Write((short)Moves[i]); + bw.Write((short)Levels[i]); } + bw.Write(-1); + return ms.ToArray(); } public static Learnset[] GetArray(byte[][] entries) diff --git a/pk3DS.Core/Structures/Moves/Heal.cs b/pk3DS.Core/Structures/Moves/Heal.cs index 8e90505991..18b81acfcb 100644 --- a/pk3DS.Core/Structures/Moves/Heal.cs +++ b/pk3DS.Core/Structures/Moves/Heal.cs @@ -3,8 +3,8 @@ public enum Heal : byte { None = 0, - Full = 255, - Half = 254, Quarter = 253, + Half = 254, + Full = 255, } } \ No newline at end of file diff --git a/pk3DS.Core/Structures/Moves/Move7.cs b/pk3DS.Core/Structures/Moves/Move7.cs index eef97614c1..fd4a8e9055 100644 --- a/pk3DS.Core/Structures/Moves/Move7.cs +++ b/pk3DS.Core/Structures/Moves/Move7.cs @@ -2,7 +2,6 @@ namespace pk3DS.Core.Structures { - public class Move7 : Move { protected override int SIZE => 0x28; diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs index 25db773799..30fe4c395c 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfo.cs @@ -54,9 +54,9 @@ public int[] Stats public bool[] TMHM { get; set; } public bool[] TypeTutors { get; set; } - public bool[][] SpecialTutors { get; set; } = new bool[0][]; + public bool[][] SpecialTutors { get; set; } = System.Array.Empty(); - protected static bool[] getBits(byte[] data) + protected static bool[] GetBits(byte[] data) { bool[] r = new bool[8 * data.Length]; for (int i = 0; i < r.Length; i++) @@ -64,7 +64,7 @@ protected static bool[] getBits(byte[] data) return r; } - protected static byte[] setBits(bool[] bits) + protected static byte[] SetBits(bool[] bits) { byte[] data = new byte[bits.Length/8]; for (int i = 0; i < bits.Length; i++) @@ -89,17 +89,13 @@ public int RandomGender { get { - switch (Gender) + return Gender switch { - case 255: // Genderless - return 2; - case 254: // Female - return 1; - case 0: // Male - return 0; - default: - return (int)(Util.rnd32() % 2); - } + 255 => 2, // Genderless + 254 => 1, // Female + 0 => 0, // Male + _ => (int)(Util.Random32() % 2), + }; } } diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs index 7c19338994..ede4963b3f 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoORAS.cs @@ -13,26 +13,26 @@ public PersonalInfoORAS(byte[] data) Data = data; // Unpack TMHM & Tutors - TMHM = getBits(Data.Skip(0x28).Take(0x10).ToArray()); - TypeTutors = getBits(Data.Skip(0x38).Take(0x4).ToArray()); + TMHM = GetBits(Data.Skip(0x28).Take(0x10).ToArray()); + TypeTutors = GetBits(Data.Skip(0x38).Take(0x4).ToArray()); // 0x3C-0x40 unknown SpecialTutors = new[] { - getBits(Data.Skip(0x40).Take(0x04).ToArray()), - getBits(Data.Skip(0x44).Take(0x04).ToArray()), - getBits(Data.Skip(0x48).Take(0x04).ToArray()), - getBits(Data.Skip(0x4C).Take(0x04).ToArray()), + GetBits(Data.Skip(0x40).Take(0x04).ToArray()), + GetBits(Data.Skip(0x44).Take(0x04).ToArray()), + GetBits(Data.Skip(0x48).Take(0x04).ToArray()), + GetBits(Data.Skip(0x4C).Take(0x04).ToArray()), }; } public override byte[] Write() { - setBits(TMHM).CopyTo(Data, 0x28); - setBits(TypeTutors).CopyTo(Data, 0x38); - setBits(SpecialTutors[0]).CopyTo(Data, 0x40); - setBits(SpecialTutors[1]).CopyTo(Data, 0x44); - setBits(SpecialTutors[2]).CopyTo(Data, 0x48); - setBits(SpecialTutors[3]).CopyTo(Data, 0x4C); + SetBits(TMHM).CopyTo(Data, 0x28); + SetBits(TypeTutors).CopyTo(Data, 0x38); + SetBits(SpecialTutors[0]).CopyTo(Data, 0x40); + SetBits(SpecialTutors[1]).CopyTo(Data, 0x44); + SetBits(SpecialTutors[2]).CopyTo(Data, 0x48); + SetBits(SpecialTutors[3]).CopyTo(Data, 0x4C); return Data; } } diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs index 498b923ded..29be978bb0 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoSM.cs @@ -13,27 +13,27 @@ public PersonalInfoSM(byte[] data) return; Data = data; - TMHM = getBits(Data.Skip(0x28).Take(0x10).ToArray()); // 36-39 - TypeTutors = getBits(Data.Skip(0x38).Take(0x4).ToArray()); // 40 + TMHM = GetBits(Data.Skip(0x28).Take(0x10).ToArray()); // 36-39 + TypeTutors = GetBits(Data.Skip(0x38).Take(0x4).ToArray()); // 40 SpecialTutors = new[] { - getBits(Data.Skip(0x3C).Take(0x0A).ToArray()), + GetBits(Data.Skip(0x3C).Take(0x0A).ToArray()), }; } public override byte[] Write() { - setBits(TMHM).CopyTo(Data, 0x28); - setBits(TypeTutors).CopyTo(Data, 0x38); - setBits(SpecialTutors[0]).CopyTo(Data, 0x3C); + SetBits(TMHM).CopyTo(Data, 0x28); + SetBits(TypeTutors).CopyTo(Data, 0x38); + SetBits(SpecialTutors[0]).CopyTo(Data, 0x3C); return Data; } - + // No accessing for 3C-4B - public int SpecialZ_Item { get { return BitConverter.ToUInt16(Data, 0x4C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); } } - public int SpecialZ_BaseMove { get { return BitConverter.ToUInt16(Data, 0x4E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4E); } } - public int SpecialZ_ZMove { get { return BitConverter.ToUInt16(Data, 0x50); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x50); } } - public bool LocalVariant { get { return Data[0x52] == 1; } set { Data[0x52] = (byte)(value ? 1 : 0); } } + public int SpecialZ_Item { get => BitConverter.ToUInt16(Data, 0x4C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); } + public int SpecialZ_BaseMove { get => BitConverter.ToUInt16(Data, 0x4E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4E); } + public int SpecialZ_ZMove { get => BitConverter.ToUInt16(Data, 0x50); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x50); } + public bool LocalVariant { get => Data[0x52] == 1; set => Data[0x52] = value ? 1 : 0; } } } diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs index 42c29fd860..5cf530a943 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalInfoXY.cs @@ -15,15 +15,15 @@ public PersonalInfoXY(byte[] data) Data = data; // Unpack TMHM & Tutors - TMHM = getBits(Data.Skip(0x28).Take(0x10).ToArray()); - TypeTutors = getBits(Data.Skip(0x38).Take(0x4).ToArray()); + TMHM = GetBits(Data.Skip(0x28).Take(0x10).ToArray()); + TypeTutors = GetBits(Data.Skip(0x38).Take(0x4).ToArray()); // 0x3C-0x40 unknown } public override byte[] Write() { - setBits(TMHM).CopyTo(Data, 0x28); - setBits(TypeTutors).CopyTo(Data, 0x38); + SetBits(TMHM).CopyTo(Data, 0x28); + SetBits(TypeTutors).CopyTo(Data, 0x38); return Data; } diff --git a/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs b/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs index 3a154fa2c5..2d427d42c3 100644 --- a/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs +++ b/pk3DS.Core/Structures/PersonalInfo/PersonalTable.cs @@ -4,7 +4,7 @@ namespace pk3DS.Core.Structures.PersonalInfo { public class PersonalTable { - private static byte[][] splitBytes(byte[] data, int size) + private static byte[][] SplitBytes(byte[] data, int size) { byte[][] r = new byte[data.Length / size][]; for (int i = 0; i < data.Length; i += size) @@ -17,21 +17,21 @@ private static byte[][] splitBytes(byte[] data, int size) public PersonalTable(byte[] data, GameVersion format) { - int size = 0; - switch (format) + int size = format switch { - case GameVersion.XY: size = PersonalInfoXY.SIZE; break; - case GameVersion.ORASDEMO: - case GameVersion.ORAS: size = PersonalInfoORAS.SIZE; break; - case GameVersion.SMDEMO: - case GameVersion.SM: - case GameVersion.USUM: size = PersonalInfoSM.SIZE; break; - } + GameVersion.XY => PersonalInfoXY.SIZE, + GameVersion.ORASDEMO => PersonalInfoORAS.SIZE, + GameVersion.ORAS => PersonalInfoORAS.SIZE, + GameVersion.SMDEMO => PersonalInfoSM.SIZE, + GameVersion.SM => PersonalInfoSM.SIZE, + GameVersion.USUM => PersonalInfoSM.SIZE, + _ => 0 + }; if (size == 0) { Table = null; return; } - byte[][] entries = splitBytes(data, size); + byte[][] entries = SplitBytes(data, size); PersonalInfo[] d = new PersonalInfo[data.Length / size]; switch (format) @@ -69,30 +69,30 @@ public PersonalInfo this[int index] { if (index < Table.Length) return; - Table[index] = value; + Table[index] = value; } } - public int[] getAbilities(int species, int forme) + public int[] GetAbilities(int species, int forme) { if (species >= Table.Length) { species = 0; Console.WriteLine("Requested out of bounds SpeciesID"); } - return this[getFormeIndex(species, forme)].Abilities; + return this[GetFormIndex(species, forme)].Abilities; } - public int getFormeIndex(int species, int forme) + public int GetFormIndex(int species, int forme) { if (species >= Table.Length) { species = 0; Console.WriteLine("Requested out of bounds SpeciesID"); } return this[species].FormeIndex(species, forme); } - public PersonalInfo getFormeEntry(int species, int forme) + public PersonalInfo GetFormEntry(int species, int forme) { - return this[getFormeIndex(species, forme)]; + return this[GetFormIndex(species, forme)]; } - public string[][] getFormList(string[] species, int MaxSpecies) + public string[][] GetFormList(string[] species, int MaxSpecies) { string[][] FormList = new string[MaxSpecies + 1][]; for (int i = 0; i <= MaxSpecies; i++) @@ -110,7 +110,7 @@ public string[][] getFormList(string[] species, int MaxSpecies) return FormList; } - public string[] getPersonalEntryList(string[][] AltForms, string[] species, int MaxSpecies, out int[] baseForm, out int[] formVal) + public string[] GetPersonalEntryList(string[][] AltForms, string[] species, int MaxSpecies, out int[] baseForm, out int[] formVal) { string[] result = new string[Table.Length]; baseForm = new int[result.Length]; @@ -132,7 +132,7 @@ public string[] getPersonalEntryList(string[][] AltForms, string[] species, int return result; } - public int[] getSpeciesForm(int PersonalEntry, GameConfig config) + public int[] GetSpeciesForm(int PersonalEntry, GameConfig config) { if (PersonalEntry < config.MaxSpeciesID) return new[] { PersonalEntry, 0 }; @@ -142,8 +142,10 @@ public int[] getSpeciesForm(int PersonalEntry, GameConfig config) var altformpointer = this[i].FormStatsIndex; if (altformpointer <= 0) continue; for (int j = 0; j < FormCount; j++) + { if (altformpointer + j == PersonalEntry) return new[] { i, j }; + } } return new[] { -1, -1 }; diff --git a/pk3DS.Core/Structures/Script.cs b/pk3DS.Core/Structures/Script.cs index f6fa7a5e2f..02986735a1 100644 --- a/pk3DS.Core/Structures/Script.cs +++ b/pk3DS.Core/Structures/Script.cs @@ -23,12 +23,12 @@ public class Script public int CompressedLength => Length - ScriptInstructionStart; public byte[] CompressedBytes => Raw.Skip(ScriptInstructionStart).ToArray(); public int DecompressedLength => FinalOffset - ScriptInstructionStart; - public uint[] DecompressedInstructions => Scripts.quickDecompress(CompressedBytes, DecompressedLength/4); + public uint[] DecompressedInstructions => Scripts.QuickDecompress(CompressedBytes, DecompressedLength/4); public uint[] ScriptCommands => DecompressedInstructions.Take((ScriptMovementStart - ScriptInstructionStart) / 4).ToArray(); public uint[] MoveCommands => DecompressedInstructions.Skip((ScriptMovementStart - ScriptInstructionStart) / 4).ToArray(); - public string[] ParseScript => Scripts.parseScript(ScriptCommands); - public string[] ParseMoves => Scripts.parseMovement(MoveCommands); + public string[] ParseScript => Scripts.ParseScript(ScriptCommands); + public string[] ParseMoves => Scripts.ParseMovement(MoveCommands); public string Info => "Data Start: 0x" + ScriptInstructionStart.ToString("X4") + Environment.NewLine + "Movement Offset: 0x" + ScriptMovementStart.ToString("X4") @@ -43,7 +43,7 @@ public class Script public Script(byte[] data = null) { - Raw = data ?? new byte[0]; + Raw = data ?? Array.Empty(); // sub_51AAFC if ((Raw[8] & 1) != 0) diff --git a/pk3DS.Core/Structures/Scripts.cs b/pk3DS.Core/Structures/Scripts.cs index 95b8f9adc2..b342793eb2 100644 --- a/pk3DS.Core/Structures/Scripts.cs +++ b/pk3DS.Core/Structures/Scripts.cs @@ -9,38 +9,36 @@ namespace pk3DS.Core public static class Scripts { // Decompression - Deprecated: Use FireFly's method. - internal static byte[] decompressScript(byte[] data) + internal static byte[] DecompressScript(byte[] data) { - data = data ?? new byte[0]; // Bad Input + data ??= Array.Empty(); // Bad Input - using (MemoryStream mn = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(mn)) + using MemoryStream mn = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(mn); + // Read away! + int pos = 0; + while (pos < data.Length) { - // Read away! - int pos = 0; - while (pos < data.Length) - { - // Read until the top bit is not set - byte[] cb = readCompressed(data, pos); - pos += cb.Length; - // Interpret the bytecode - byte[] db = decompressBytes(cb); - // Write Bytes - bw.Write(db); - } - return mn.ToArray(); + // Read until the top bit is not set + byte[] cb = ReadCompressed(data, pos); + pos += cb.Length; + // Interpret the bytecode + byte[] db = DecompressBytes(cb); + // Write Bytes + bw.Write(db); } + return mn.ToArray(); } - internal static byte[] readCompressed(byte[] data, int pos) + internal static byte[] ReadCompressed(byte[] data, int pos) { byte[] c1 = data.Skip(pos).TakeWhile(b => b >> 7 > 0).ToArray(); // Take while >= 0x80 return c1.Concat(data.Skip(pos + c1.Length).Take(1)).ToArray(); // Take another } - internal static byte[] decompressBytes(byte[] cb) + internal static byte[] DecompressBytes(byte[] cb) { - byte[] db = new byte[0]; + byte[] db = Array.Empty(); if ((cb[0] & 0x40) > 0) // Signed Parameter { @@ -87,7 +85,7 @@ internal static byte[] decompressBytes(byte[] cb) } // FireFly's (github.com/FireyFly) concise decompression (ported c->c#): // https://github.com/FireyFly/poketools/blob/e74538a5b5e5dab1e78c1cd313c55d158f37534d/src/formats/script.c#L61 - internal static uint[] quickDecompress(byte[] data, int count) + internal static uint[] QuickDecompress(byte[] data, int count) { uint[] code = new uint[count]; uint i = 0, j = 0, x = 0, f = 0; @@ -105,30 +103,28 @@ internal static uint[] quickDecompress(byte[] data, int count) } // Compression - internal static byte[] compressScript(byte[] data) + internal static byte[] CompressScript(byte[] data) { if (data == null || data.Length % 4 != 0) // Bad Input return null; - using (MemoryStream mn = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(mn)) + using MemoryStream mn = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(mn); + int pos = 0; + while (pos < data.Length) { - int pos = 0; - while (pos < data.Length) - { - byte[] db = data.Skip(pos+=4).Take(4).ToArray(); - byte[] cb = compressBytes(db); - bw.Write(cb); - } - return mn.ToArray(); + byte[] db = data.Skip(pos+=4).Take(4).ToArray(); + byte[] cb = CompressBytes(db); + bw.Write(cb); } + return mn.ToArray(); } - internal static byte[] compressBytes(byte[] db) + internal static byte[] CompressBytes(byte[] db) { short cmd = BitConverter.ToInt16(db, 0); short val = BitConverter.ToInt16(db, 2); - byte[] cb = new byte[0]; + byte[] cb = Array.Empty(); bool sign4 = val < 0 && cmd < 0 && db[0] >= 0xC0; // 4 byte signed bool sign3 = val < 0 && cmd < 0 && db[0] < 0xC0; // 3 byte signed bool sign2 = val < 0 && cmd > 0; // 2 byte signed @@ -190,9 +186,9 @@ internal static byte[] compressBytes(byte[] db) } // General Utility - internal static string[] getHexLines(byte[] data, int count = 4) + internal static string[] GetHexLines(byte[] data, int count = 4) { - data = data ?? new byte[0]; + data ??= Array.Empty(); // Generates an x-byte wide space separated string array; leftovers included at the end. string[] s = new string[(data.Length/count) + (data.Length % count > 0 ? 1 : 0)]; for (int i = 0; i < s.Length;i++) @@ -200,9 +196,9 @@ internal static string[] getHexLines(byte[] data, int count = 4) return s; } - internal static string[] getHexLines(uint[] data) + internal static string[] GetHexLines(uint[] data) { - data = data ?? new uint[0]; + data ??= Array.Empty(); // Generates an 4-byte wide space separated string array. string[] s = new string[data.Length]; for (int i = 0; i < s.Length; i++) @@ -210,13 +206,13 @@ internal static string[] getHexLines(uint[] data) return s; } - internal static byte[] getBytes(uint[] data) + internal static byte[] GetBytes(uint[] data) { - return data.Aggregate(new byte[0], (current, t) => current.Concat(BitConverter.GetBytes(t)).ToArray()); + return data.Aggregate(Array.Empty(), (current, t) => current.Concat(BitConverter.GetBytes(t)).ToArray()); } // Interpreting - internal static string[] parseScript(uint[] cmd, int sanity = -1) + internal static string[] ParseScript(uint[] cmd, int sanity = -1) { // sub_148CBC Moon v1.0 List parse = new List(); @@ -249,7 +245,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next = (int)cmd[i++]; // Check Value against negative and zero... ? - op = eA(c, next); + op = UnkeA(c, next); break; } case 0x03: @@ -267,7 +263,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next = (int)cmd[i++]; // Check Value against negative... ? - op = eA(c, next); + op = UnkeA(c, next); break; } case 0x09: @@ -362,7 +358,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // no sanity checks var arg = (short)(c >> 16); - op = eA(c & 0xFF, arg); + op = UnkeA(c & 0xFF, arg); if ((c & 0xFF) == 0x30) // return op += Environment.NewLine; @@ -407,7 +403,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next = (int)cmd[i++]; // No sanity check needed - op = eA(c, next); + op = UnkeA(c, next); break; } @@ -440,12 +436,12 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next = (int)cmd[i++]; sanityMode |= 1; // flag mode 1 - op = eA(c, next); + op = UnkeA(c, next); break; } case 0x82: // JumpIfElse { - var jOffset = (i * 4) - 4; // todo: this may be the correct jump start point... + //var jOffset = (i * 4) - 4; // todo: this may be the correct jump start point... var count = cmd[i++]; // switch case table // sanity check @@ -464,7 +460,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) { int jmp = (int)cmd[i++]; var toOffset = ((i-2)*4) + jmp; - tree.Add($"\t{"*"} => 0x{toOffset:X4} ({jmp})"); + tree.Add($"\t* => 0x{toOffset:X4} ({jmp})"); } op = Commands[c] + Environment.NewLine + string.Join(Environment.NewLine, tree); @@ -476,7 +472,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next2 = (int)cmd[i++]; sanityMode |= 2; // flag mode 2 - op = eA(c, next1, next2); + op = UnkeA(c, next1, next2); break; } @@ -490,7 +486,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next1 = (int)cmd[i++]; var next2 = (int)cmd[i++]; - op = eA(c, next1, next2); + op = UnkeA(c, next1, next2); break; } @@ -503,7 +499,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next2 = cmd[i++]; var next3 = cmd[i++]; - op = eF(c, next1, next2, next3); + op = UnkeF(c, next1, next2, next3); break; } @@ -517,7 +513,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next3 = (int)cmd[i++]; var next4 = (int)cmd[i++]; - op = eA(c, next1, next2, next3, next4); + op = UnkeA(c, next1, next2, next3, next4); break; } @@ -532,7 +528,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next4 = cmd[i++]; var next5 = cmd[i++]; - op = eF(c, next1, next2, next3, next4, next5); + op = UnkeF(c, next1, next2, next3, next4, next5); break; } @@ -542,7 +538,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next2 = (int)cmd[i++]; // a bunch of sanity checking - op = eA(c, next1, next2); + op = UnkeA(c, next1, next2); break; } @@ -552,7 +548,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) var next2 = (int)cmd[i++]; // a bunch of sanity checking - op = eA(c, next1, next2); + op = UnkeA(c, next1, next2); break; } @@ -562,7 +558,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // perm check a1 + 0x14 // can return error code 0x1C - op = eA(c, next1); + op = UnkeA(c, next1); break; } @@ -572,7 +568,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // same permission checking as 0x9E // can return error code 0x1C - op = eA(c); + op = UnkeA(c); break; } @@ -582,7 +578,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // can return error code 0x1C int newPos = i + (int)(1 + (2 *(cmd[i]/4)) + 1); - op = eA(c, newPos); + op = UnkeA(c, newPos); break; } @@ -600,7 +596,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // sanity check arg var arg = (short)(c >> 16); - op = eA(c & 0xFF, arg); + op = UnkeA(c & 0xFF, arg); break; } case 0xA4: // GetGlobal4 @@ -617,7 +613,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) // sanity check arg, slightly different var arg = (short)(c >> 16); - op = eA(c & 0xFF, arg); + op = UnkeA(c & 0xFF, arg); break; } } @@ -630,12 +626,12 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1) return parse.ToArray(); } - internal static string[] parseMovement(uint[] cmd) + internal static string[] ParseMovement(uint[] cmd) { - return getHexLines(cmd); + return GetHexLines(cmd); } - internal static string eA(uint c, params int[] arr) + internal static string UnkeA(uint c, params int[] arr) { string cmd = Commands[c]; string parameters = arr.Length == 0 ? "" : string.Join(", ", arr.Select(z => $"{(Math.Abs(z) < 100 ? z.ToString() : "0x"+z.ToString("X4"))}")); @@ -644,14 +640,14 @@ internal static string eA(uint c, params int[] arr) private static readonly Func getFloat = val => BitConverter.ToSingle(BitConverter.GetBytes(val), 0); - internal static string eF(uint c, params uint[] arr) + internal static string UnkeF(uint c, params uint[] arr) { string cmd = Commands[c]; string parameters = arr.Length == 1 ? "" : string.Join(", ", arr.Select(z => getFloat(z))); return $"{cmd}({parameters})"; } - internal static readonly Dictionary Commands = new Dictionary + internal static readonly Dictionary Commands = new() {// { 0x00, "$00" }, // Invalid Code { 0x01, "$01" }, { 0x02, "$02" }, diff --git a/pk3DS.Core/Structures/TypeChart.cs b/pk3DS.Core/Structures/TypeChart.cs index da8040d29f..011ee9610d 100644 --- a/pk3DS.Core/Structures/TypeChart.cs +++ b/pk3DS.Core/Structures/TypeChart.cs @@ -14,11 +14,11 @@ public static class TypeChart 0, 0, 0, // unused 0xFF008000 }; - public static Bitmap getGrid(int itemsize, int itemsPerRow, byte[] vals) + public static Bitmap GetGrid(int itemsize, int itemsPerRow, byte[] vals) { // set up image - int width = itemsize * itemsPerRow, - height = itemsize * vals.Length / itemsPerRow; + var width = itemsize * itemsPerRow; + var height = itemsize * vals.Length / itemsPerRow; byte[] bmpData = new byte[4 * width * height]; // loop over area @@ -26,19 +26,21 @@ public static Bitmap getGrid(int itemsize, int itemsPerRow, byte[] vals) { int X = i % itemsPerRow; int Y = i / itemsPerRow; - + // Plop into image byte[] itemColor = BitConverter.GetBytes(Colors[vals[i]]); for (int x = 0; x < itemsize * itemsize; x++) - Buffer.BlockCopy(itemColor, 0, bmpData, - (((Y * itemsize) + (x % itemsize)) * width * 4) + (((X * itemsize) + (x / itemsize)) * 4), 4); + { + Buffer.BlockCopy(itemColor, 0, bmpData, (((Y * itemsize) + (x % itemsize)) * width * 4) + (((X * itemsize) + (x / itemsize)) * 4), 4); + } } // slap on a grid byte[] gridColor = BitConverter.GetBytes(0x17000000); for (int i = 0; i < width * height; i++) + { if (i % itemsize == 0 || i / (itemsize * itemsPerRow) % itemsize == 0) - Buffer.BlockCopy(gridColor, 0, bmpData, - (i / (itemsize * itemsPerRow) * width * 4) + (i % (itemsize * itemsPerRow) * 4), 4); + Buffer.BlockCopy(gridColor, 0, bmpData, (i / (itemsize * itemsPerRow) * width * 4) + (i % (itemsize * itemsPerRow) * 4), 4); + } // assemble image Bitmap b = new Bitmap(width, height, PixelFormat.Format32bppArgb); diff --git a/pk3DS.Core/TextFile.cs b/pk3DS.Core/TextFile.cs index 0607766b16..50aef4cb9e 100644 --- a/pk3DS.Core/TextFile.cs +++ b/pk3DS.Core/TextFile.cs @@ -17,9 +17,12 @@ public class TextFile private const ushort KEY_TEXTCLEAR = 0xBE01; private const ushort KEY_TEXTWAIT = 0xBE02; private const ushort KEY_TEXTNULL = 0xBDFF; - private const bool SETEMPTYTEXT = false; private static readonly byte[] emptyTextFile = { 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 }; + private GameConfig Config { get; } + public bool SETEMPTYTEXT { get; set; } + public bool RemapChars { get; set; } + public TextFile(GameConfig config, byte[] data = null, bool remapChars = false) { Data = (byte[])(data ?? emptyTextFile).Clone(); @@ -35,14 +38,12 @@ public TextFile(GameConfig config, byte[] data = null, bool remapChars = false) RemapChars = remapChars; } - private GameConfig Config { get; set; } - private readonly bool RemapChars = true; - private ushort TextSections { get { return BitConverter.ToUInt16(Data, 0x0); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x0); } } // Always 0x0001 - private ushort LineCount { get { return BitConverter.ToUInt16(Data, 0x2); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x2); } } - private uint TotalLength { get { return BitConverter.ToUInt32(Data, 0x4); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4); } } - private uint InitialKey { get { return BitConverter.ToUInt32(Data, 0x8); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x8); } } // Always 0x00000000 - private uint SectionDataOffset { get { return BitConverter.ToUInt32(Data, 0xC); } set { BitConverter.GetBytes(value).CopyTo(Data, 0xC); } } // Always 0x0010 - private uint SectionLength { get { return BitConverter.ToUInt32(Data, (int)SectionDataOffset); } set { BitConverter.GetBytes(value).CopyTo(Data, SectionDataOffset); } } + private ushort TextSections { get => BitConverter.ToUInt16(Data, 0x0); set => BitConverter.GetBytes(value).CopyTo(Data, 0x0); } // Always 0x0001 + private ushort LineCount { get => BitConverter.ToUInt16(Data, 0x2); set => BitConverter.GetBytes(value).CopyTo(Data, 0x2); } + private uint TotalLength { get => BitConverter.ToUInt32(Data, 0x4); set => BitConverter.GetBytes(value).CopyTo(Data, 0x4); } + private uint InitialKey { get => BitConverter.ToUInt32(Data, 0x8); set => BitConverter.GetBytes(value).CopyTo(Data, 0x8); } // Always 0x00000000 + private uint SectionDataOffset { get => BitConverter.ToUInt32(Data, 0xC); set => BitConverter.GetBytes(value).CopyTo(Data, 0xC); } // Always 0x0010 + private uint SectionLength { get => BitConverter.ToUInt32(Data, (int)SectionDataOffset); set => BitConverter.GetBytes(value).CopyTo(Data, SectionDataOffset); } private LineInfo[] LineOffsets { @@ -51,11 +52,14 @@ private LineInfo[] LineOffsets LineInfo[] result = new LineInfo[LineCount]; int sdo = (int)SectionDataOffset; for (int i = 0; i < result.Length; i++) + { result[i] = new LineInfo { Offset = BitConverter.ToInt32(Data, (i * 8) + sdo + 4) + sdo, Length = BitConverter.ToInt16(Data, (i * 8) + sdo + 8) }; + } + return result; } set @@ -85,7 +89,7 @@ public byte[] this[int index] byte[] EncryptedLineData = new byte[line.Length * 2]; Array.Copy(Data, line.Offset, EncryptedLineData, 0, EncryptedLineData.Length); - return cryptLineData(EncryptedLineData, key); + return CryptLineData(EncryptedLineData, key); } } @@ -109,7 +113,7 @@ public byte[][] LineData byte[] EncryptedLineData = new byte[lines[i].Length * 2]; Array.Copy(Data, lines[i].Offset, EncryptedLineData, 0, EncryptedLineData.Length); - result[i] = cryptLineData(EncryptedLineData, key); + result[i] = CryptLineData(EncryptedLineData, key); key += KEY_ADVANCE; } return result; @@ -137,14 +141,13 @@ public byte[][] LineData public string[] Lines { - get => LineData.Select(z => getLineString(Config, z)).ToArray(); + get => LineData.Select(z => GetLineString(Config, z)).ToArray(); set => LineData = ConvertLinesToData(value); } private byte[][] ConvertLinesToData(string[] value) { - if (value == null) - value = new string[0]; + value ??= Array.Empty(); ushort key = KEY_BASE; // Get Line Data @@ -154,8 +157,8 @@ private byte[][] ConvertLinesToData(string[] value) string text = (value[i] ?? "").Trim(); if (text.Length == 0 && SETEMPTYTEXT) text = $"[~ {i}]"; - byte[] DecryptedLineData = getLineData(Config, text); - lineData[i] = cryptLineData(DecryptedLineData, key); + byte[] DecryptedLineData = GetLineData(Config, text); + lineData[i] = CryptLineData(DecryptedLineData, key); if (lineData[i].Length % 4 == 2) Array.Resize(ref lineData[i], lineData[i].Length + 2); key += KEY_ADVANCE; @@ -166,7 +169,7 @@ private byte[][] ConvertLinesToData(string[] value) public byte[] Data; - private static byte[] cryptLineData(byte[] data, ushort key) + private static byte[] CryptLineData(byte[] data, ushort key) { byte[] result = new byte[data.Length]; for (int i = 0; i < result.Length; i += 2) @@ -177,73 +180,79 @@ private static byte[] cryptLineData(byte[] data, ushort key) return result; } - private byte[] getLineData(GameConfig config, string line) + private byte[] GetLineData(GameConfig config, string line) { if (line == null) return new byte[2]; MemoryStream ms = new MemoryStream(); - using (BinaryWriter bw = new BinaryWriter(ms)) + using BinaryWriter bw = new BinaryWriter(ms); + int i = 0; + while (i < line.Length) { - int i = 0; - while (i < line.Length) - { - ushort val = line[i++]; - val = TryRemapChar(val); + ushort val = line[i++]; + val = TryRemapChar(val); - if (val == '[') // Variable + switch (val) + { + // Variable + case '[': { // grab the string int bracket = line.IndexOf("]", i, StringComparison.Ordinal); if (bracket < 0) throw new ArgumentException("Variable text is not capped properly: " + line); string varText = line.Substring(i, bracket - i); - var varValues = getVariableValues(config, varText); + var varValues = GetVariableValues(config, varText); foreach (ushort v in varValues) bw.Write(v); i += 1 + varText.Length; + break; } - else if (val == '\\') // Escaped Formatting + // Escaped Formatting + case '\\': { - var escapeValues = getEscapeValues(line[i++]); + var escapeValues = GetEscapeValues(line[i++]); foreach (ushort v in escapeValues) bw.Write(v); + break; } - else + default: bw.Write(val); + break; } - bw.Write(KEY_TERMINATOR); // cap the line off - return ms.ToArray(); } + bw.Write(KEY_TERMINATOR); // cap the line off + return ms.ToArray(); } private ushort TryRemapChar(ushort val) { if (!RemapChars) return val; - switch (val) + return val switch { - case 0x202F: return 0xE07F; // nbsp - case 0x2026: return 0xE08D; // … - case 0x2642: return 0xE08E; // ♂ - case 0x2640: return 0xE08F; // ♀ - default: return val; - } + 0x202F => 0xE07F, // nbsp + 0x2026 => 0xE08D, // … + 0x2642 => 0xE08E, // ♂ + 0x2640 => 0xE08F, // ♀ + _ => val + }; } private ushort TryUnmapChar(ushort val) { if (!RemapChars) return val; - switch (val) + return val switch { - case 0xE07F: return 0x202F; // nbsp - case 0xE08D: return 0x2026; // … - case 0xE08E: return 0x2642; // ♂ - case 0xE08F: return 0x2640; // ♀ - default: return val; - } + 0xE07F => 0x202F, // nbsp + 0xE08D => 0x2026, // … + 0xE08E => 0x2642, // ♂ + 0xE08F => 0x2640, // ♀ + _ => val + }; } - private string getLineString(GameConfig config, byte[] data) + private string GetLineString(GameConfig config, byte[] data) { if (data == null) return null; @@ -259,7 +268,7 @@ private string getLineString(GameConfig config, byte[] data) switch (val) { case KEY_TERMINATOR: return s.ToString(); - case KEY_VARIABLE: s.Append(getVariableString(config, data, ref i)); break; + case KEY_VARIABLE: s.Append(GetVariableString(config, data, ref i)); break; case '\n': s.Append(@"\n"); break; case '\\': s.Append(@"\\"); break; case '[': s.Append(@"\["); break; @@ -269,7 +278,7 @@ private string getLineString(GameConfig config, byte[] data) return s.ToString(); // Shouldn't get hit if the string is properly terminated. } - private string getVariableString(GameConfig config, byte[] data, ref int i) + private string GetVariableString(GameConfig config, byte[] data, ref int i) { var s = new StringBuilder(); ushort count = BitConverter.ToUInt16(data, i); i += 2; @@ -289,9 +298,9 @@ private string getVariableString(GameConfig config, byte[] data, ref int i) return $"[~ {line}]"; } - string varName = getVariableString(config, variable); + string varName = GetVariableString(config, variable); - s.Append("[VAR" + " " + varName); + s.Append("[VAR ").Append(varName); if (count > 1) { s.Append('('); @@ -308,7 +317,7 @@ private string getVariableString(GameConfig config, byte[] data, ref int i) return s.ToString(); } - private IEnumerable getEscapeValues(char esc) + private IEnumerable GetEscapeValues(char esc) { var vals = new List(); switch (esc) @@ -322,7 +331,7 @@ private IEnumerable getEscapeValues(char esc) } } - private IEnumerable getVariableValues(GameConfig config, string variable) + private IEnumerable GetVariableValues(GameConfig config, string variable) { string[] split = variable.Split(' '); if (split.Length < 2) @@ -342,20 +351,20 @@ private IEnumerable getVariableValues(GameConfig config, string variable vals.Add(Convert.ToUInt16(split[1])); break; case "VAR": // Text Variable - vals.AddRange(getVariableParameters(config, split[1])); + vals.AddRange(GetVariableParameters(config, split[1])); break; default: throw new Exception("Unknown variable method type: " + variable); } return vals; } - private IEnumerable getVariableParameters(GameConfig config, string text) + private IEnumerable GetVariableParameters(GameConfig config, string text) { var vals = new List(); int bracket = text.IndexOf('('); bool noArgs = bracket < 0; string variable = noArgs ? text : text.Substring(0, bracket); - ushort varVal = getVariableNumber(config, variable); + ushort varVal = GetVariableNumber(config, variable); if (!noArgs) { @@ -372,9 +381,9 @@ private IEnumerable getVariableParameters(GameConfig config, string text return vals; } - private ushort getVariableNumber(GameConfig config, string variable) + private ushort GetVariableNumber(GameConfig config, string variable) { - var v = config.getVariableCode(variable); + var v = config.GetVariableCode(variable); if (v != null) return (ushort) v.Code; @@ -385,21 +394,21 @@ private ushort getVariableNumber(GameConfig config, string variable) catch { throw new ArgumentException("Variable parse error: " + variable); } } - private string getVariableString(GameConfig config, ushort variable) + private static string GetVariableString(GameConfig config, ushort variable) { - var v = config.getVariableName(variable); + var v = config.GetVariableName(variable); return v == null ? variable.ToString("X4") : v.Name; } - + // Exposed Methods - public static string[] getStrings(GameConfig config, byte[] data, bool remapChars = false) + public static string[] GetStrings(GameConfig config, byte[] data, bool remapChars = false) { TextFile t; try { t = new TextFile(config, data, remapChars); } catch { return null; } return t.Lines; } - public static byte[] getBytes(GameConfig config, string[] lines, bool remapChars = false) + public static byte[] GetBytes(GameConfig config, string[] lines, bool remapChars = false) { return new TextFile (config, remapChars: remapChars) { Lines = lines }.Data; } diff --git a/pk3DS.Core/Util.cs b/pk3DS.Core/Util.cs index 6dec138167..b6a0ffc6f3 100644 --- a/pk3DS.Core/Util.cs +++ b/pk3DS.Core/Util.cs @@ -5,7 +5,7 @@ namespace pk3DS.Core { public static class Util - { + { // Strings and Paths public static FileInfo GetNewestFile(DirectoryInfo directory) { @@ -36,9 +36,9 @@ public static string TrimFromZero(string input) } // Randomization - public static Random rand { get; private set; } = new Random(); - public static void ReseedRand(int seed) => rand = new Random(seed); - public static uint rnd32() => (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2); + public static Random Rand { get; private set; } = new(); + public static void ReseedRand(int seed) => Rand = new Random(seed); + public static uint Random32() => (uint)Rand.Next(1 << 30) << 2 | (uint)Rand.Next(1 << 2); // Data Retrieval public static int ToInt32(string value) @@ -51,7 +51,7 @@ public static uint ToUInt32(string value) { string val = value?.Replace(" ", "").Replace("_", "").Trim(); return string.IsNullOrWhiteSpace(val) ? 0 : uint.Parse(val); - } + } // Data Manipulation public static void Shuffle(T[] array) @@ -59,12 +59,12 @@ public static void Shuffle(T[] array) int n = array.Length; for (int i = 0; i < n; i++) { - int r = i + (int)(rand.NextDouble() * (n - i)); + int r = i + (int)(Rand.NextDouble() * (n - i)); T t = array[r]; array[r] = array[i]; array[i] = t; } - } + } // GARCTool Utility public static string GuessExtension(BinaryReader br, string defaultExt, bool bypass) @@ -131,17 +131,17 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp ext += (char)magic[i]; } else + { break; + } } } } - end: + end: { // Return BaseStream position to the start. br.BaseStream.Position = position; - if (ext.Length <= 1) - return defaultExt; - return ext; + return ext.Length <= 1 ? defaultExt : ext; } } catch { return defaultExt; } @@ -149,26 +149,8 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp public static string GuessExtension(string path, bool bypass) { - using (BinaryReader br = new BinaryReader(File.OpenRead(path))) - return GuessExtension(br, "bin", bypass); - } - - public static uint Reverse(uint x) - { - uint y = 0; - for (int i = 0; i < 32; ++i) - { - y <<= 1; - y |= x & 1; - x >>= 1; - } - return y; - } - - public static char[] Reverse(char[] charArray) - { - Array.Reverse(charArray); - return charArray; + using BinaryReader br = new BinaryReader(File.OpenRead(path)); + return GuessExtension(br, "bin", bypass); } // Find Code off of Reference @@ -187,34 +169,24 @@ public static int IndexOfBytes(byte[] array, byte[] pattern, int startIndex, int j = 0; } else if (++j == len) + { return i; + } } } // Misc - public static string getHexString(byte[] data) + public static string GetHexString(byte[] data) { return BitConverter.ToString(data).Replace('-', ' '); } - public static void resizeJagged(ref byte[][] array, int size, int lowLen) - { - int oldSize = array?.Length ?? 0; - Array.Resize(ref array, size); - - // Zero fill new data - for (int i = oldSize; i < size - oldSize; i++) - { - array[i] = new byte[lowLen]; - } - } - public static byte[] StringToByteArray(string hex) { return Enumerable.Range(0, hex.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) .ToArray(); - } + } } } diff --git a/pk3DS.Core/pk3DS.Core.csproj b/pk3DS.Core/pk3DS.Core.csproj index 3fc76e6ebe..c334489926 100644 --- a/pk3DS.Core/pk3DS.Core.csproj +++ b/pk3DS.Core/pk3DS.Core.csproj @@ -1,7 +1,8 @@  - net40 + net46 + 9 @@ -12,6 +13,14 @@ True + + true + + + + true + + diff --git a/pk3DS/ARCUtil.cs b/pk3DS/ARCUtil.cs index 1e5a12df40..47f64b6d5c 100644 --- a/pk3DS/ARCUtil.cs +++ b/pk3DS/ARCUtil.cs @@ -10,7 +10,7 @@ namespace pk3DS.ARCUtil { public static class ARC { - public static SARC analyzeSARC(string path) + public static SARC AnalyzeSARC(string path) { try { return new SARC(path); } catch { return new SARC(); } @@ -24,7 +24,7 @@ internal static ShuffleARC AnalyzeShuffle(string path) FilePath = Path.GetDirectoryName(path), Extension = Path.GetExtension(path) }; - BinaryReader br = new BinaryReader(File.OpenRead(path)); + using var br = new BinaryReader(File.OpenRead(path)); if (br.ReadUInt32() != 0xB) { br.BaseStream.Seek(0x100, SeekOrigin.Begin); @@ -62,7 +62,7 @@ internal static ShuffleARC AnalyzeShuffle(string path) return sharc; } - internal static GAR analyzeGAR(string path) + internal static GAR AnalyzeGAR(string path) { GAR gar = new GAR { @@ -70,7 +70,7 @@ internal static GAR analyzeGAR(string path) FilePath = Path.GetDirectoryName(path), Extension = Path.GetExtension(path) }; - BinaryReader br = new BinaryReader(File.OpenRead(path)); + using var br = new BinaryReader(File.OpenRead(path)); long len = br.BaseStream.Length; gar.Magic = br.ReadUInt32(); gar.FileLength = br.ReadUInt32(); @@ -132,7 +132,7 @@ internal static GAR analyzeGAR(string path) return gar; } - internal static DARC analyze(string path) + internal static DARC Analyze(string path) { DARC darc = new DARC { @@ -140,10 +140,10 @@ internal static DARC analyze(string path) FilePath = Path.GetDirectoryName(path), Extension = Path.GetExtension(path) }; - using (BinaryReader br = new BinaryReader(File.OpenRead(path))) { + using BinaryReader br = new BinaryReader(File.OpenRead(path)); long len = br.BaseStream.Length; darc.Magic = br.ReadUInt32(); - uint m = darc.Magic; + uint m = darc.Magic; darc.HeaderOffset = 0; while (m != 0x63726164 && darc.HeaderOffset < len - 4) { @@ -186,10 +186,10 @@ internal static DARC analyze(string path) } uint NameTableOffset = (uint)br.BaseStream.Position; - for (int i = 0; i < ft.Files.Count; i++) + foreach (var t in ft.Files) { - br.BaseStream.Seek(NameTableOffset + ft.Files[i].NameOffset, SeekOrigin.Begin); - MemoryStream stream = new MemoryStream(); + br.BaseStream.Seek(NameTableOffset + t.NameOffset, SeekOrigin.Begin); + var stream = new MemoryStream(); for (byte fb = br.ReadByte(), sb = br.ReadByte(); fb != 0 || sb != 0; fb = br.ReadByte(), sb = br.ReadByte()) @@ -205,10 +205,9 @@ internal static DARC analyze(string path) darc.FilePath = Path.GetDirectoryName(path); darc.Extension = Path.GetExtension(path); return darc; - } } - internal static FARC analyzeFARC(string path) + internal static FARC AnalyzeFARC(string path) { FARC farc = new FARC { @@ -251,7 +250,7 @@ internal static FARC analyzeFARC(string path) br.BaseStream.Seek(farc.TableOffset, SeekOrigin.Begin); FARCFileTable ft = new FARCFileTable { - Files = new List(), + Files = new List(), FileNames = new List() }; for (int i = 0; i < farc.FileCount; i++) @@ -299,15 +298,15 @@ internal static string Interpret(string path) { return ParseShuffleText(path); } - DARC darc = analyze(path); + DARC darc = Analyze(path); FARC farc = new FARC(); GAR gar = new GAR(); SARC sarc = new SARC(); ShuffleARC sharc = new ShuffleARC(); - if (!darc.valid) farc = analyzeFARC(path); - if (!farc.valid) gar = analyzeGAR(path); + if (!darc.valid) farc = AnalyzeFARC(path); + if (!farc.valid) gar = AnalyzeGAR(path); if (!gar.valid) sharc = AnalyzeShuffle(path); - if (!sharc.valid) sarc = analyzeSARC(path); + if (!sharc.valid) sarc = AnalyzeSARC(path); string ret = ""; if (darc.valid) @@ -387,10 +386,12 @@ internal static string Interpret(string path) } else if (sharc.valid) { - UnpackShuffleARC(path, sharc, ret); + UnpackShuffleARC(path, sharc); } else if (sarc.Valid) + { UnpackSARC(sarc); + } else { ret = "Not a valid .DARC/.FARC/.SARC/.GAR/Shuffle Archive file"; @@ -398,7 +399,7 @@ internal static string Interpret(string path) return ret; } - private static bool UnpackShuffleARC(string path, ShuffleARC sharc, string ret) + private static bool UnpackShuffleARC(string path, ShuffleARC sharc) { Debug.WriteLine($"New Shuffle Archive with {sharc.FileCount} files."); string dir = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + sharc.FileName + "_" + Path.DirectorySeparatorChar; @@ -441,28 +442,30 @@ public static bool UnpackSARC(SARC sarc) } // Unpacking - internal static string unpackDARC(string path, string outFolder = null, bool delete = true) + internal static string UnpackDARC(string path, string outFolder = null, bool delete = true) { int extracted = 0; int folder = 0; - DARC darc = analyze(path); + DARC darc = Analyze(path); if (!darc.valid) return "Not a DARC?"; for (int i = 0; i < darc.Files.Files.Count; i++) { - if (darc.Files.Files[i].Folder > 0) folder++; + if (darc.Files.Files[i].Folder > 0) + { + folder++; + } else { extracted++; string dir = outFolder ?? Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + darc.FileName + Path.DirectorySeparatorChar; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } - using (var fs = File.OpenRead(path)) - { - fs.Seek(darc.Files.Files[i].Offset, SeekOrigin.Begin); - byte[] fileBuffer = new byte[darc.Files.Files[i].Length]; - fs.Read(fileBuffer, 0, fileBuffer.Length); - File.WriteAllBytes(Path.Combine(dir, darc.Files.FileNames[i]), fileBuffer); - } + + using var fs = File.OpenRead(path); + fs.Seek(darc.Files.Files[i].Offset, SeekOrigin.Begin); + byte[] fileBuffer = new byte[darc.Files.Files[i].Length]; + fs.Read(fileBuffer, 0, fileBuffer.Length); + File.WriteAllBytes(Path.Combine(dir, darc.Files.FileNames[i]), fileBuffer); } } if (delete) @@ -477,16 +480,13 @@ internal static string unpackDARC(string path, string outFolder = null, bool del return s; } - internal static void repackDARC(string path, string fileName, string outfolder = null, bool header = true, bool delete = true) + internal static void RepackDARC(string path, string fileName, string outfolder = null, bool header = true) { - var data = new byte[0]; + var data = Array.Empty(); string[] files = Directory.GetFiles(path); int count = files.Length; - if (outfolder == null) - { - outfolder = Directory.GetParent(path).FullName; - } + outfolder ??= Directory.GetParent(path).FullName; string donor = Path.Combine(outfolder, fileName); if (header && File.Exists(donor)) @@ -511,7 +511,7 @@ internal static void repackDARC(string path, string fileName, string outfolder = } else { - data = new byte[0]; + data = Array.Empty(); } } if (data.Length == 0) @@ -564,7 +564,7 @@ internal static string ParseShuffleText(string path) { br.BaseStream.Seek(st.offsets[i], SeekOrigin.Begin); uint len = i < st.StringCount - 1 - ? st.offsets[i + 1] - st.offsets[i] + ? st.offsets[i + 1] - st.offsets[i] : StringDataLen + 0x40 - st.offsets[i]; byte[] data = br.ReadBytes((int)len); st.strings.Add(Encoding.Unicode.GetString(data).Replace((char)0, ' ').Replace((char)0xa, ' ')); @@ -580,7 +580,7 @@ internal static string ParseShuffleText(string path) } } - public struct FARC + public class FARC { public uint Magic; public uint SirMagic; @@ -596,16 +596,16 @@ public struct FARC public string FileName; public string FilePath; public string Extension; - public Boolean valid; + public bool valid; } - public struct FARCFileTable + public class FARCFileTable { public List Files; public List FileNames; } - public struct FARCFile + public class FARCFile { public uint NameOffset; public uint Offset; @@ -682,13 +682,13 @@ public class GARFile public uint Length; } - public struct DARC + public class DARC { public uint HeaderOffset; // Where is header in file? public uint Magic; // 0x64617263 "darc" - public UInt16 BOM; // 0xFFFE - public UInt16 HeaderLength; // HeaderLength - 0x1C + public ushort BOM; // 0xFFFE + public ushort HeaderLength; // HeaderLength - 0x1C public uint Unknown; // 0x10000000 public uint totalLength; // Total Length of file public uint TableOffset; // Offset from Start of File @@ -700,16 +700,16 @@ public struct DARC public string FileName; public string FilePath; public string Extension; - public Boolean valid; + public bool valid; } - public struct FileTable + public class FileTable { public List Files; public List FileNames; } - public struct DarcFile + public class DarcFile { public ushort NameOffset; // public byte Parent; diff --git a/pk3DS/GarcUtil.cs b/pk3DS/GarcUtil.cs index d6f61ffbea..4351f397a4 100644 --- a/pk3DS/GarcUtil.cs +++ b/pk3DS/GarcUtil.cs @@ -11,53 +11,61 @@ namespace pk3DS /// public static class GarcUtil { - private static ProgressBar pBar1; - private static Label label; + private static ProgressBar Progress; + private static Label Label; private static void GARC_FileCountDetermined(object sender, GARC.FileCountDeterminedEventArgs e) { - if (pBar1 == null) pBar1 = new ProgressBar(); - if (pBar1.InvokeRequired) - pBar1.Invoke((MethodInvoker)delegate { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = e.Total; }); - else { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = e.Total; } - if (label == null) label = new Label(); - if (label.InvokeRequired) - label.Invoke((MethodInvoker)delegate { label.Visible = true; }); + Progress ??= new ProgressBar(); + if (Progress.InvokeRequired) + { + Progress.Invoke((MethodInvoker)delegate { Progress.Minimum = 0; Progress.Step = 1; Progress.Value = 0; Progress.Maximum = e.Total; }); + } + else { Progress.Minimum = 0; Progress.Step = 1; Progress.Value = 0; Progress.Maximum = e.Total; } + Label ??= new Label(); + if (Label.InvokeRequired) + Label.Invoke((MethodInvoker)delegate { Label.Visible = true; }); } private static void GARC_PackProgressed(object sender, GARC.PackProgressedEventArgs e) { - if (pBar1.InvokeRequired) - pBar1.Invoke((MethodInvoker)(() => pBar1.PerformStep())); - else { pBar1.PerformStep(); } + if (Progress.InvokeRequired) + { + Progress.Invoke((MethodInvoker)(() => Progress.PerformStep())); + } + else { Progress.PerformStep(); } string update = $"{(float)e.Current / (float)e.Total:P2} - {e.Current}/{e.Total} - {e.CurrentFile}"; - if (label.InvokeRequired) - label.Invoke((MethodInvoker)delegate { label.Text = update; }); - else { label.Text = update; } + if (Label.InvokeRequired) + { + Label.Invoke((MethodInvoker)delegate { Label.Text = update; }); + } + else { Label.Text = update; } } private static void GARC_UnpackProgressed(object sender, GARC.UnpackProgressedEventArgs e) { #region Step - if (pBar1.InvokeRequired) pBar1.Invoke((MethodInvoker)(() => pBar1.PerformStep())); - else pBar1.PerformStep(); + if (Progress.InvokeRequired) Progress.Invoke((MethodInvoker)(() => Progress.PerformStep())); + else Progress.PerformStep(); string update = $"{e.Current / e.Total:P2} - {e.Current}/{e.Total}"; - if (label.InvokeRequired) - label.Invoke((MethodInvoker)delegate { label.Text = update; }); - else { label.Text = update; } + if (Label.InvokeRequired) + { + Label.Invoke((MethodInvoker)delegate { Label.Text = update; }); + } + else { Label.Text = update; } #endregion } - public static bool garcPackMS(string folderPath, string garcPath, int version, int bytesPadding, ProgressBar pBar1 = null, Label label = null, bool supress = false) + public static bool PackGARC(string folderPath, string garcPath, int version, int bytesPadding, ProgressBar pBar1 = null, Label label = null, bool supress = false) { - GarcUtil.pBar1 = pBar1; - GarcUtil.label = label; + Progress = pBar1; + Label = label; GARC.FileCountDetermined += GARC_FileCountDetermined; GARC.PackProgressed += GARC_PackProgressed; try { - var filectr = GARC.garcPackMS(folderPath, garcPath, version, bytesPadding); + var filectr = GARC.PackGARC(folderPath, garcPath, version, bytesPadding); if (filectr > 0) { // We're done. @@ -90,15 +98,15 @@ public static bool garcPackMS(string folderPath, string garcPath, int version, i return false; } - public static bool garcUnpack(string garcPath, string outPath, bool skipDecompression, ProgressBar pBar1 = null, Label label = null, bool supress = false, bool bypassExt = false) + public static bool UnpackGARC(string garcPath, string outPath, bool skipDecompression, ProgressBar pBar1 = null, Label label = null, bool supress = false) { - GarcUtil.pBar1 = pBar1; - GarcUtil.label = label; + Progress = pBar1; + Label = label; GARC.FileCountDetermined += GARC_FileCountDetermined; GARC.UnpackProgressed += GARC_UnpackProgressed; try { - var fileCount = GARC.garcUnpack(garcPath, outPath, skipDecompression); + var fileCount = GARC.GarcUnpack(garcPath, outPath, skipDecompression); if (fileCount > 0) { SystemSounds.Exclamation.Play(); diff --git a/pk3DS/Legality/Randomizer.cs b/pk3DS/Legality/Randomizer.cs index b803c88363..d4ded674bf 100644 --- a/pk3DS/Legality/Randomizer.cs +++ b/pk3DS/Legality/Randomizer.cs @@ -15,11 +15,11 @@ internal static int GetRandomForme(int species, bool mega, bool alola, PersonalI if (species == 664 || species == 665 || species == 666) // vivillon return 30; // save file specific if (species == 774) // minior - return (int)(Util.rnd32()%7); + return (int)(Util.Random32()%7); if (alola && Legal.EvolveToAlolanForms.Contains(species)) - return (int)(Util.rnd32()%2); + return (int)(Util.Random32()%2); if (!Legal.Mega_ORAS.Contains((ushort)species) || mega) - return (int)(Util.rnd32() % stats[species].FormeCount); // Slot-Random + return (int)(Util.Random32() % stats[species].FormeCount); // Slot-Random return 0; } @@ -29,7 +29,7 @@ internal static int GetRandomForme(int species, bool mega, bool alola, PersonalI /// Current Level. /// Modification factor. /// Boosted (or reduced) level. - internal static int getModifiedLevel(int level, decimal factor) + internal static int GetModifiedLevel(int level, decimal factor) { int newlvl = (int) (level * factor); if (newlvl < 1) @@ -39,7 +39,7 @@ internal static int getModifiedLevel(int level, decimal factor) return newlvl; } - internal static int[] getRandomItemList() + internal static int[] GetRandomItemList() { if (Main.Config.ORAS) return Items_HeldAO.Concat(Items_Ball).Where(i => i != 0).ToArray(); diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index 8357de3498..b38615f586 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -333,7 +333,7 @@ private void InitializeComponent() this.Menu_RomFS.Name = "Menu_RomFS"; this.Menu_RomFS.Size = new System.Drawing.Size(180, 22); this.Menu_RomFS.Text = "RomFS"; - this.Menu_RomFS.Click += new System.EventHandler(this.rebuildRomFS); + this.Menu_RomFS.Click += new System.EventHandler(this.RebuildRomFS); // // Menu_ExeFS // @@ -341,7 +341,7 @@ private void InitializeComponent() this.Menu_ExeFS.Name = "Menu_ExeFS"; this.Menu_ExeFS.Size = new System.Drawing.Size(180, 22); this.Menu_ExeFS.Text = "ExeFS"; - this.Menu_ExeFS.Click += new System.EventHandler(this.rebuildExeFS); + this.Menu_ExeFS.Click += new System.EventHandler(this.RebuildExeFS); // // Menu_CRO // @@ -349,7 +349,7 @@ private void InitializeComponent() this.Menu_CRO.Name = "Menu_CRO"; this.Menu_CRO.Size = new System.Drawing.Size(180, 22); this.Menu_CRO.Text = "CRO"; - this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR); + this.Menu_CRO.Click += new System.EventHandler(this.PatchCRO_CRR); // // Menu_Trimmed3DS // @@ -395,7 +395,7 @@ private void InitializeComponent() this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem"; this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed"; - this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click); + this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.SetInt32SeedToolStripMenuItem_Click); // // Menu_Options // diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index fcaec0a3a6..ad1e36b5de 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -35,22 +35,22 @@ public Main() // Prepare DragDrop Functionality AllowDrop = TB_Path.AllowDrop = true; - DragEnter += tabMain_DragEnter; - DragDrop += tabMain_DragDrop; - TB_Path.DragEnter += tabMain_DragEnter; - TB_Path.DragDrop += tabMain_DragDrop; + DragEnter += TabMain_DragEnter; + DragDrop += TabMain_DragDrop; + TB_Path.DragEnter += TabMain_DragEnter; + TB_Path.DragDrop += TabMain_DragDrop; foreach (var t in TC_RomFS.TabPages.OfType()) { t.AllowDrop = true; - t.DragEnter += tabMain_DragEnter; - t.DragDrop += tabMain_DragDrop; + t.DragEnter += TabMain_DragEnter; + t.DragDrop += TabMain_DragDrop; } // Reload Previous Editing Files if the file exists CB_Lang.SelectedIndex = Properties.Settings.Default.Language; if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.GamePath)) - openQuick(Properties.Settings.Default.GamePath); + OpenQuick(Properties.Settings.Default.GamePath); string[] args = Environment.GetCommandLineArgs(); string filename = args.Length > 0 ? Path.GetFileNameWithoutExtension(args[0])?.ToLower() : ""; @@ -98,7 +98,7 @@ private void B_Open_Click(object sender, EventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) - openQuick(fbd.SelectedPath); + OpenQuick(fbd.SelectedPath); } private void ChangeLanguage(object sender, EventArgs e) @@ -121,7 +121,7 @@ private void ChangeLanguage(object sender, EventArgs e) return; // set event re-triggers this method } - updateGameInfo(); + UpdateGameInfo(); Config.InitializeGameText(); Properties.Settings.Default.Language = Language; Properties.Settings.Default.Save(); @@ -138,7 +138,7 @@ private void CloseForm(object sender, FormClosingEventArgs e) return; var g = Config.GARCGameText; string[][] files = Config.GameTextStrings; - g.Files = files.Select(x => TextFile.getBytes(Config, x)).ToArray(); + g.Files = files.Select(x => TextFile.GetBytes(Config, x)).ToArray(); g.Save(); try @@ -148,9 +148,9 @@ private void CloseForm(object sender, FormClosingEventArgs e) catch { } } - private void openQuick(string path) + private void OpenQuick(string path) { - if (threadActive()) + if (ThreadActive()) return; if (!Directory.Exists(path)) // File @@ -162,16 +162,16 @@ private void openQuick(string path) if (fi.Name.Contains("code.bin")) // Compress/Decompress .code.bin { if (fi.Length % 0x200 == 0 && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Decompressed code.bin.", "Compress? File will be replaced.") == DialogResult.Yes) - new Thread(() => { threads++; new BLZCoder(new[] { "-en", path }, pBar1); threads--; WinFormsUtil.Alert("Compressed!"); }).Start(); + new Thread(() => { Interlocked.Increment(ref threads); new BLZCoder(new[] { "-en", path }, pBar1); Interlocked.Decrement(ref threads); WinFormsUtil.Alert("Compressed!"); }).Start(); else if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Compressed code.bin.", "Decompress? File will be replaced.") == DialogResult.Yes) - new Thread(() => { threads++; new BLZCoder(new[] { "-d", path }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start(); + new Thread(() => { Interlocked.Increment(ref threads); new BLZCoder(new[] { "-d", path }, pBar1); Interlocked.Decrement(ref threads); WinFormsUtil.Alert("Decompressed!"); }).Start(); } - else if (fi.Name.ToLower().Contains("exe")) // Unpack exefs + else if (fi.Name.IndexOf("exe", StringComparison.OrdinalIgnoreCase) >= 0) // Unpack exefs { if (fi.Length % 0x200 == 0 && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected ExeFS.bin.", "Unpack?") == DialogResult.Yes) - new Thread(() => { threads++; ExeFS.get(path, Path.GetDirectoryName(path)); threads--; WinFormsUtil.Alert("Unpacked!"); }).Start(); + new Thread(() => { Interlocked.Increment(ref threads); ExeFS.UnpackExeFS(path, Path.GetDirectoryName(path)); Interlocked.Decrement(ref threads); WinFormsUtil.Alert("Unpacked!"); }).Start(); } - else if (fi.Name.ToLower().Contains("rom")) + else if (fi.Name.IndexOf("rom", StringComparison.OrdinalIgnoreCase) >= 0) { WinFormsUtil.Alert("RomFS unpacking not implemented."); } @@ -193,10 +193,10 @@ private void openQuick(string path) int count = folders.Length; // Find RomFS folder - foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.ToLower().Contains("rom") && Directory.Exists(f))) + foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.IndexOf("rom", StringComparison.OrdinalIgnoreCase) >= 0 && Directory.Exists(f))) CheckIfRomFS(f); // Find ExeFS folder - foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.ToLower().Contains("exe") && Directory.Exists(f))) + foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.IndexOf("exe", StringComparison.OrdinalIgnoreCase) >= 0 && Directory.Exists(f))) CheckIfExeFS(f); if (count > 3) @@ -222,9 +222,9 @@ private void openQuick(string path) { // Trigger Data Loading if (RTB_Status.Text.Length > 0) RTB_Status.Clear(); - updateStatus("Data found! Loading persistent data for subforms...", false); + UpdateStatus("Data found! Loading persistent data for subforms...", false); Config.Initialize(RomFSPath, ExeFSPath, Language); - Config.backupFiles(); + Config.BackupFiles(); } // Enable Rebuilding options if all files have been found @@ -241,11 +241,11 @@ private void openQuick(string path) SMDH = ExeFSPath != null ? File.Exists(Path.Combine(ExeFSPath, "icon.bin")) ? new SMDH(Path.Combine(ExeFSPath, "icon.bin")) : null : null; HANSgameID = SMDH != null ? (SMDH.AppSettings?.StreetPassID ?? 0) : 0; L_Game.Visible = SMDH == null && RomFSPath != null; - updateGameInfo(); + UpdateGameInfo(); TB_Path.Select(TB_Path.TextLength, 0); // Method finished. System.Media.SystemSounds.Asterisk.Play(); - resetStatus(); + ResetStatus(); Properties.Settings.Default.GamePath = path; Properties.Settings.Default.Save(); } @@ -259,9 +259,7 @@ private void B_ExtractCXI_Click(object sender, EventArgs e) "If you want to continue, press OK to select your CXI and then select your output directory. For best results, make sure the output directory is an empty directory.") == DialogResult.OK) { string inputCXI; - OpenFileDialog ofd = new OpenFileDialog(); - ofd.Title = "Select CXI"; - ofd.Filter = "CXI files (*.cxi)|*.cxi"; + OpenFileDialog ofd = new OpenFileDialog {Title = "Select CXI", Filter = "CXI files (*.cxi)|*.cxi"}; if (ofd.ShowDialog() == DialogResult.OK) inputCXI = ofd.FileName; else @@ -270,9 +268,8 @@ private void B_ExtractCXI_Click(object sender, EventArgs e) FolderBrowserDialog fbd = new FolderBrowserDialog(); DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK) - extractNCCH(inputCXI, fbd.SelectedPath); + ExtractNCCH(inputCXI, fbd.SelectedPath); } - } private void B_Extract3DS_Click(object sender, EventArgs e) @@ -283,9 +280,7 @@ private void B_Extract3DS_Click(object sender, EventArgs e) "If you want to continue, press OK to select your CXI and then select your output directory. For best results, make sure the output directory is an empty directory.") == DialogResult.OK) { string input3DS; - OpenFileDialog ofd = new OpenFileDialog(); - ofd.Title = "Select 3DS"; - ofd.Filter = "3DS files (*.3ds)|*.3ds"; + OpenFileDialog ofd = new OpenFileDialog {Title = "Select 3DS", Filter = "3DS files (*.3ds)|*.3ds"}; if (ofd.ShowDialog() == DialogResult.OK) input3DS = ofd.FileName; else @@ -294,11 +289,11 @@ private void B_Extract3DS_Click(object sender, EventArgs e) FolderBrowserDialog fbd = new FolderBrowserDialog(); DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK) - extractNCSD(input3DS, fbd.SelectedPath); + ExtractNCSD(input3DS, fbd.SelectedPath); } } - private void extractNCCH(string ncchPath, string outputDirectory) + private void ExtractNCCH(string ncchPath, string outputDirectory) { if (!File.Exists(ncchPath)) return; @@ -307,14 +302,14 @@ private void extractNCCH(string ncchPath, string outputDirectory) new Thread(() => { - threads++; + Interlocked.Increment(ref threads); ncch.ExtractNCCHFromFile(ncchPath, outputDirectory, RTB_Status, pBar1); - threads--; + Interlocked.Decrement(ref threads); WinFormsUtil.Prompt(MessageBoxButtons.OK, "Extraction complete!"); }).Start(); } - private void extractNCSD(string ncsdPath, string outputDirectory) + private void ExtractNCSD(string ncsdPath, string outputDirectory) { if (!File.Exists(ncsdPath)) return; @@ -322,9 +317,9 @@ private void extractNCSD(string ncsdPath, string outputDirectory) NCSD ncsd = new NCSD(); new Thread(() => { - threads++; + Interlocked.Increment(ref threads); ncsd.ExtractFilesFromNCSD(ncsdPath, outputDirectory, RTB_Status, pBar1); - threads--; + Interlocked.Decrement(ref threads); WinFormsUtil.Prompt(MessageBoxButtons.OK, "Extraction complete!"); }).Start(); } @@ -369,7 +364,7 @@ private void ToggleSubEditors() FLP_CRO.Controls.AddRange(cro); } - private void updateGameInfo() + private void UpdateGameInfo() { // 0 - JP // 1 - EN @@ -438,7 +433,7 @@ private bool CheckIfExeFS(string path) return false; // User wanted to unpack. Unpack. - if (!ExeFS.get(files[0], path)) + if (!ExeFS.UnpackExeFS(files[0], path)) return false; // on unpack fail // Remove ExeFS binary after unpacking @@ -462,7 +457,7 @@ private bool CheckIfExeFS(string path) fi = new FileInfo(files[0]); } if (fi.Length % 0x200 != 0 && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Compressed code binary.", "Decompress? File will be replaced.") == DialogResult.Yes) - new Thread(() => { threads++; new BLZCoder(new[] { "-d", files[0] }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start(); + new Thread(() => { Interlocked.Increment(ref threads); new BLZCoder(new[] { "-d", files[0] }, pBar1); Interlocked.Decrement(ref threads); WinFormsUtil.Alert("Decompressed!"); }).Start(); ExeFSPath = path; return true; @@ -472,36 +467,36 @@ private bool CheckIfExHeader(string path) { ExHeaderPath = null; // Input folder path should contain the ExHeader. - string[] files = Directory.GetFiles(path); + string[] files = Directory.GetFiles(path); foreach (string fp in from s in files let f = new FileInfo(s) where (f.Name.StartsWith("exh", StringComparison.OrdinalIgnoreCase) || f.Name.StartsWith("decryptedexh", StringComparison.OrdinalIgnoreCase)) && f.Length == 0x800 select s) ExHeaderPath = fp; return ExHeaderPath != null; } - private bool threadActive() + private bool ThreadActive() { if (threads <= 0) return false; WinFormsUtil.Alert("Please wait for all operations to finish first."); return true; } - private void tabMain_DragEnter(object sender, DragEventArgs e) + private void TabMain_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } - private void tabMain_DragDrop(object sender, DragEventArgs e) + private void TabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); string path = files[0]; // open first D&D - openQuick(path); + OpenQuick(path); } // RomFS Subform Items - private void rebuildRomFS(object sender, EventArgs e) + private void RebuildRomFS(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (RomFSPath == null) return; @@ -519,13 +514,13 @@ private void rebuildRomFS(object sender, EventArgs e) { new Thread(() => { - updateStatus(Environment.NewLine + "Building RomFS binary. Please wait until the program finishes."); + UpdateStatus(Environment.NewLine + "Building RomFS binary. Please wait until the program finishes."); - threads++; + Interlocked.Increment(ref threads); RomFS.BuildRomFS(RomFSPath, sfd.FileName, RTB_Status, pBar1); - threads--; + Interlocked.Decrement(ref threads); - updateStatus("RomFS binary saved." + Environment.NewLine); + UpdateStatus("RomFS binary saved." + Environment.NewLine); WinFormsUtil.Alert("Wrote RomFS binary:", sfd.FileName); }).Start(); } @@ -533,7 +528,7 @@ private void rebuildRomFS(object sender, EventArgs e) private void B_GameText_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -547,7 +542,7 @@ private void B_GameText_Click(object sender, EventArgs e) private void B_StoryText_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -567,13 +562,13 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g) { try { - data[i] = TextFile.getBytes(Config, files[i]); + data[i] = TextFile.GetBytes(Config, files[i]); } catch (Exception ex) { errata.Add($"File {i:000} | {ex.Message}"); // revert changes - data[i] = g.getFile(i); + data[i] = g.GetFile(i); } } if (errata.Count == 0) @@ -596,7 +591,7 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g) const string txt_errata = "text_errata.txt"; const string txt_failed = "text_failed.txt"; File.WriteAllLines(txt_errata, errata); - TextEditor.exportTextFile(txt_failed, true, files); + TextEditor.ExportTextFile(txt_failed, true, files); WinFormsUtil.Alert("Saved text files to path: " + Application.StartupPath, txt_errata + Environment.NewLine + txt_failed); @@ -606,7 +601,7 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g) private void B_Maison_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; DialogResult dr; switch (Config.Generation) @@ -649,7 +644,7 @@ private void B_Maison_Click(object sender, EventArgs e) private void B_Personal_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -675,7 +670,7 @@ private void B_Personal_Click(object sender, EventArgs e) private void B_Trainer_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -689,10 +684,10 @@ private void B_Trainer_Click(object sender, EventArgs e) switch (Config.Generation) { case 6: - Invoke((Action)(() => new RSTE(trc, trd, trp).ShowDialog())); + Invoke((Action)(() => new RSTE(trd, trp).ShowDialog())); break; case 7: - Invoke((Action)(() => new SMTE(trc, trd, trp).ShowDialog())); + Invoke((Action)(() => new SMTE(trd, trp).ShowDialog())); break; } trclass.Files = trc; @@ -706,7 +701,7 @@ private void B_Trainer_Click(object sender, EventArgs e) private void B_Wild_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -730,23 +725,23 @@ private void B_Wild_Click(object sender, EventArgs e) break; case 7: Invoke((MethodInvoker)delegate { Enabled = false; }); - threads++; + Interlocked.Increment(ref threads); files = new [] { "encdata", "zonedata", "worlddata" }; - updateStatus($"GARC Get: {files[0]}... "); + UpdateStatus($"GARC Get: {files[0]}... "); var ed = Config.GetlzGARCData(files[0]); - updateStatus($"GARC Get: {files[1]}... "); + UpdateStatus($"GARC Get: {files[1]}... "); var zd = Config.GetlzGARCData(files[1]); - updateStatus($"GARC Get: {files[2]}... "); + UpdateStatus($"GARC Get: {files[2]}... "); var wd = Config.GetlzGARCData(files[2]); - updateStatus("Running SMWE... "); + UpdateStatus("Running SMWE... "); action = () => new SMWE(ed, zd, wd).ShowDialog(); Invoke(action); - updateStatus($"GARC Set: {files[0]}... "); + UpdateStatus($"GARC Set: {files[0]}... "); ed.Save(); - resetStatus(); - threads--; + ResetStatus(); + Interlocked.Decrement(ref threads); Invoke((MethodInvoker)delegate { Enabled = true; }); break; default: @@ -757,22 +752,22 @@ private void B_Wild_Click(object sender, EventArgs e) private void B_OWSE_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "The OverWorld/Script Editor is not recommended for most users and is still a work-in-progress.", "Continue anyway?")) return; switch (Config.Generation) { case 6: - runOWSE6(); + RunOWSE6(); return; case 7: - runOWSE7(); + RunOWSE7(); return; } } - private void runOWSE6() + private void RunOWSE6() { Enabled = false; new Thread(() => @@ -796,23 +791,23 @@ private void runOWSE6() }).Start(); } - private void runOWSE7() + private void RunOWSE7() { Enabled = false; new Thread(() => { var files = new[] { "encdata", "zonedata", "worlddata" }; - updateStatus($"GARC Get: {files[0]}... "); + UpdateStatus($"GARC Get: {files[0]}... "); var ed = Config.GetlzGARCData(files[0]); - updateStatus($"GARC Get: {files[1]}... "); + UpdateStatus($"GARC Get: {files[1]}... "); var zd = Config.GetlzGARCData(files[1]); - updateStatus($"GARC Get: {files[2]}... "); - var wd = Config.GetlzGARCData(files[2]); + UpdateStatus($"GARC Get: {files[2]}... "); + //var wd = Config.GetlzGARCData(files[2]); var g = Config.GetGARCData("storytext"); string[][] tfiles = g.Files.Select(file => new TextFile(Config, file).Lines).ToArray(); Invoke((Action)(() => new TextEditor(tfiles, "storytext").Show())); - Invoke((Action)(() => new OWSE7(ed, zd, wd).Show())); + Invoke((Action)(() => new OWSE7(ed, zd).Show())); while (Application.OpenForms.Count > 1) Thread.Sleep(200); Invoke((MethodInvoker)delegate { Enabled = true; }); @@ -821,7 +816,7 @@ private void runOWSE7() private void B_Evolution_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -844,7 +839,7 @@ private void B_Evolution_Click(object sender, EventArgs e) private void B_MegaEvo_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -866,7 +861,7 @@ private void B_MegaEvo_Click(object sender, EventArgs e) private void B_Item_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -888,7 +883,7 @@ private void B_Item_Click(object sender, EventArgs e) private void B_Move_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -898,12 +893,12 @@ private void B_Move_Click(object sender, EventArgs e) { case 6: bool isMini = Config.ORAS; - Moves = isMini ? Mini.UnpackMini(g.getFile(0), "WD") : g.Files; + Moves = isMini ? Mini.UnpackMini(g.GetFile(0), "WD") : g.Files; Invoke((Action)(() => new MoveEditor6(Moves).ShowDialog())); g.Files = isMini ? new[] { Mini.PackMini(Moves, "WD") } : Moves; break; case 7: - Moves = Mini.UnpackMini(g.getFile(0), "WD"); + Moves = Mini.UnpackMini(g.GetFile(0), "WD"); Invoke((Action)(() => new MoveEditor7(Moves).ShowDialog())); g.Files = new[] {Mini.PackMini(Moves, "WD")}; break; @@ -915,7 +910,7 @@ private void B_Move_Click(object sender, EventArgs e) private void B_LevelUp_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -937,7 +932,7 @@ private void B_LevelUp_Click(object sender, EventArgs e) private void B_EggMove_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -959,7 +954,7 @@ private void B_EggMove_Click(object sender, EventArgs e) private void B_TitleScreen_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; new Thread(() => { @@ -977,10 +972,10 @@ private void FileGet(string[] files, bool skipDecompression = true, bool skipGet foreach (string toEdit in files) { string GARC = Config.GetGARCFileName(toEdit); - updateStatus($"GARC Get: {toEdit} @ {GARC}... "); - threadGet(Path.Combine(RomFSPath, GARC), toEdit, true, skipDecompression); + UpdateStatus($"GARC Get: {toEdit} @ {GARC}... "); + ThreadGet(Path.Combine(RomFSPath, GARC), toEdit, true, skipDecompression); while (threads > 0) Thread.Sleep(50); - resetStatus(); + ResetStatus(); } } @@ -991,16 +986,16 @@ private void FileSet(IEnumerable files, bool keep = false) foreach (string toEdit in files) { string GARC = Config.GetGARCFileName(toEdit); - updateStatus($"GARC Set: {toEdit} @ {GARC}... "); - threadSet(Path.Combine(RomFSPath, GARC), toEdit, 4); // 4 bytes for Gen6 + UpdateStatus($"GARC Set: {toEdit} @ {GARC}... "); + ThreadSet(Path.Combine(RomFSPath, GARC), toEdit, 4); // 4 bytes for Gen6 while (threads > 0) Thread.Sleep(50); if (!keep && Directory.Exists(toEdit)) Directory.Delete(toEdit, true); - resetStatus(); + ResetStatus(); } } // ExeFS Subform Items - private void rebuildExeFS(object sender, EventArgs e) + private void RebuildExeFS(object sender, EventArgs e) { if (ExeFSPath == null) return; @@ -1021,18 +1016,18 @@ private void rebuildExeFS(object sender, EventArgs e) { new Thread(() => { - threads++; + Interlocked.Increment(ref threads); new BLZCoder(new[] { "-en", files[file] }, pBar1); WinFormsUtil.Alert("Compressed!"); - ExeFS.set(Directory.GetFiles(ExeFSPath), sfd.FileName); - threads--; + ExeFS.PackExeFS(Directory.GetFiles(ExeFSPath), sfd.FileName); + Interlocked.Decrement(ref threads); }).Start(); } } private void B_Pickup_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; switch (Config.Generation) { @@ -1048,7 +1043,7 @@ private void B_Pickup_Click(object sender, EventArgs e) private void B_TMHM_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (ExeFSPath == null) return; @@ -1061,7 +1056,7 @@ private void B_TMHM_Click(object sender, EventArgs e) private void B_Mart_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; switch (Config.Generation) { @@ -1070,7 +1065,7 @@ private void B_Mart_Click(object sender, EventArgs e) break; case 7: - if (threadActive()) + if (ThreadActive()) return; if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; @@ -1081,7 +1076,7 @@ private void B_Mart_Click(object sender, EventArgs e) private void B_MoveTutor_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; switch (Config.Generation) { @@ -1098,22 +1093,22 @@ private void B_MoveTutor_Click(object sender, EventArgs e) private void B_OPower_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (ExeFSPath != null) new OPower().Show(); } private void B_ShinyRate_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (ExeFSPath != null) new ShinyRate().ShowDialog(); } // CRO Subform Items - private void patchCRO_CRR(object sender, EventArgs e) + private void PatchCRO_CRR(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (RomFSPath == null) return; @@ -1121,9 +1116,9 @@ private void patchCRO_CRR(object sender, EventArgs e) return; new Thread(() => { - threads++; - CRO.rehashCRR(Path.Combine(RomFSPath, ".crr", "static.crr"), RomFSPath, true, /* true // don't patch crr for now */ false, RTB_Status, pBar1); - threads--; + Interlocked.Increment(ref threads); + CRO.E_HashCRR(Path.Combine(RomFSPath, ".crr", "static.crr"), RomFSPath, true, /* true // don't patch crr for now */ false, RTB_Status, pBar1); + Interlocked.Decrement(ref threads); WinFormsUtil.Alert("CRO's and CRR have been updated.", "If you have made any modifications, it is required that the RSA Verification check be patched on the system in order for the modified CROs to load (ie, no file redirection like NTR's layeredFS)."); @@ -1132,7 +1127,7 @@ private void patchCRO_CRR(object sender, EventArgs e) private void B_Starter_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; @@ -1153,7 +1148,7 @@ private void B_Starter_Click(object sender, EventArgs e) private void B_TypeChart_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; switch (Config.Generation) @@ -1177,7 +1172,7 @@ private void B_TypeChart_Click(object sender, EventArgs e) private void B_Gift_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?")) return; @@ -1192,7 +1187,7 @@ private void B_Gift_Click(object sender, EventArgs e) private void B_Static_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; if (Config.Generation == 7) @@ -1223,7 +1218,7 @@ private void B_Static_Click(object sender, EventArgs e) // CXI Building private void B_RebuildTrimmed3DS_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; SaveFileDialog sfd = new SaveFileDialog @@ -1237,18 +1232,18 @@ private void B_RebuildTrimmed3DS_Click(object sender, EventArgs e) new Thread(() => { - threads++; + Interlocked.Increment(ref threads); Exheader exh = new Exheader(ExHeaderPath); - CTRUtil.buildROM(true, "Nintendo", ExeFSPath, RomFSPath, ExHeaderPath, exh.GetSerial(), path, + CTRUtil.BuildROM(true, "Nintendo", ExeFSPath, RomFSPath, ExHeaderPath, exh.GetSerial(), path, true, pBar1, RTB_Status); - threads--; + Interlocked.Decrement(ref threads); }).Start(); } // 3DS Building private void B_Rebuild3DS_Click(object sender, EventArgs e) { - if (threadActive()) + if (ThreadActive()) return; SaveFileDialog sfd = new SaveFileDialog @@ -1262,11 +1257,11 @@ private void B_Rebuild3DS_Click(object sender, EventArgs e) new Thread(() => { - threads++; + Interlocked.Increment(ref threads); Exheader exh = new Exheader(ExHeaderPath); - CTRUtil.buildROM(true, "Nintendo", ExeFSPath, RomFSPath, ExHeaderPath, exh.GetSerial(), path, + CTRUtil.BuildROM(true, "Nintendo", ExeFSPath, RomFSPath, ExHeaderPath, exh.GetSerial(), path, false, pBar1, RTB_Status); - threads--; + Interlocked.Decrement(ref threads); }).Start(); } @@ -1293,9 +1288,9 @@ private void Menu_BLZ_Click(object sender, EventArgs e) { WinFormsUtil.Error("File too big!", fi.Length + " bytes."); return; } if (ModifierKeys != Keys.Control && fi.Length % 0x200 == 0 && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Decompressed Binary.", "Compress? File will be replaced.") == DialogResult.Yes) - new Thread(() => { threads++; new BLZCoder(new[] { "-en", path }, pBar1); threads--; WinFormsUtil.Alert("Compressed!"); }).Start(); + new Thread(() => { Interlocked.Increment(ref threads); new BLZCoder(new[] { "-en", path }, pBar1); Interlocked.Decrement(ref threads); WinFormsUtil.Alert("Compressed!"); }).Start(); else if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Compressed Binary", "Decompress? File will be replaced.") == DialogResult.Yes) - new Thread(() => { threads++; new BLZCoder(new[] { "-d", path }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start(); + new Thread(() => { Interlocked.Increment(ref threads); new BLZCoder(new[] { "-d", path }, pBar1); Interlocked.Decrement(ref threads); WinFormsUtil.Alert("Decompressed!"); }).Start(); } private void Menu_LZ11_Click(object sender, EventArgs e) @@ -1315,7 +1310,7 @@ private void Menu_LZ11_Click(object sender, EventArgs e) "Yes = Decompress\nNo = Compress\nCancel = Abort"); new Thread(() => { - threads++; + Interlocked.Increment(ref threads); if (dr == DialogResult.Yes) { try @@ -1329,7 +1324,7 @@ private void Menu_LZ11_Click(object sender, EventArgs e) LZSS.Compress(path, Path.Combine(Directory.GetParent(path).FullName, Path.GetFileNameWithoutExtension(path).Replace("_dec", "") + ".lz")); WinFormsUtil.Alert("File Compressed!", path); } - threads--; + Interlocked.Decrement(ref threads); }).Start(); } @@ -1344,11 +1339,11 @@ private void Menu_Shuffler_Click(object sender, EventArgs e) } // GARC Requests - internal static string getGARCFileName(string requestedGARC, int lang) + internal static string GetGARCFileName(string requestedGARC, int lang) { - var garc = Config.getGARCReference(requestedGARC); + var garc = Config.GetGARCReference(requestedGARC); if (garc.LanguageVariant) - garc = garc.getRelativeGARC(lang); + garc = garc.GetRelativeGARC(lang); return garc.Reference; } @@ -1357,38 +1352,38 @@ private bool GetGARC(string infile, string outfolder, bool PB, bool bypassExt = { if (skipBoth && Directory.Exists(outfolder)) { - updateStatus("Skipped - Exists!", false); - threads--; + UpdateStatus("Skipped - Exists!", false); + Interlocked.Decrement(ref threads); return true; } try { - bool success = GarcUtil.garcUnpack(infile, outfolder, bypassExt, PB ? pBar1 : null, L_Status, true, bypassExt); - updateStatus(string.Format(success ? "Success!" : "Failed!"), false); - threads--; + bool success = GarcUtil.UnpackGARC(infile, outfolder, bypassExt, PB ? pBar1 : null, L_Status, true); + UpdateStatus(string.Format(success ? "Success!" : "Failed!"), false); + Interlocked.Decrement(ref threads); return success; } - catch (Exception e) { WinFormsUtil.Error("Could not get the GARC:", e.ToString()); threads--; return false; } + catch (Exception e) { WinFormsUtil.Error("Could not get the GARC:", e.ToString()); Interlocked.Decrement(ref threads); return false; } } - private bool setGARC(string outfile, string infolder, int padBytes, bool PB) + private bool SetGARC(string outfile, string infolder, int padBytes, bool PB) { if (skipBoth || (ModifierKeys == Keys.Control && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Cancel writing data back to GARC?") == DialogResult.Yes)) - { threads--; updateStatus("Aborted!", false); return false; } + { Interlocked.Decrement(ref threads); UpdateStatus("Aborted!", false); return false; } try { - bool success = GarcUtil.garcPackMS(infolder, outfile, Config.GARCVersion, padBytes, PB ? pBar1 : null, L_Status, true); - threads--; - updateStatus(string.Format(success ? "Success!" : "Failed!"), false); + bool success = GarcUtil.PackGARC(infolder, outfile, Config.GARCVersion, padBytes, PB ? pBar1 : null, L_Status, true); + Interlocked.Decrement(ref threads); + UpdateStatus(string.Format(success ? "Success!" : "Failed!"), false); return success; } - catch (Exception e) { WinFormsUtil.Error("Could not set the GARC back:", e.ToString()); threads--; return false; } + catch (Exception e) { WinFormsUtil.Error("Could not set the GARC back:", e.ToString()); Interlocked.Decrement(ref threads); return false; } } - private void threadGet(string infile, string outfolder, bool PB = true, bool bypassExt = false) + private void ThreadGet(string infile, string outfolder, bool PB = true, bool bypassExt = false) { - threads++; + Interlocked.Increment(ref threads); if (Directory.Exists(outfolder)) { try { Directory.Delete(outfolder, true); } @@ -1398,14 +1393,14 @@ private void threadGet(string infile, string outfolder, bool PB = true, bool byp new Thread(() => GetGARC(infile, outfolder, PB, bypassExt)).Start(); } - private void threadSet(string outfile, string infolder, int padBytes, bool PB = true) + private void ThreadSet(string outfile, string infolder, int padBytes, bool PB = true) { - threads++; - new Thread(() => setGARC(outfile, infolder, padBytes, PB)).Start(); + Interlocked.Increment(ref threads); + new Thread(() => SetGARC(outfile, infolder, padBytes, PB)).Start(); } // Update RichTextBox - private void updateStatus(string status, bool preBreak = true) + private void UpdateStatus(string status, bool preBreak = true) { string newtext = (preBreak ? Environment.NewLine : "") + status; try @@ -1431,7 +1426,7 @@ private void updateStatus(string status, bool preBreak = true) catch { } } - private void resetStatus() + private void ResetStatus() { try { @@ -1447,7 +1442,7 @@ private void resetStatus() catch { } } - private void setInt32SeedToolStripMenuItem_Click(object sender, EventArgs e) + private void SetInt32SeedToolStripMenuItem_Click(object sender, EventArgs e) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Reseed RNG?", "If yes, copy the 32 bit (not hex) integer seed to the clipboard before hitting Yes.")) return; diff --git a/pk3DS/Misc/ErrorWindow.Designer.cs b/pk3DS/Misc/ErrorWindow.Designer.cs index 816b33cda1..a615e08f0f 100644 --- a/pk3DS/Misc/ErrorWindow.Designer.cs +++ b/pk3DS/Misc/ErrorWindow.Designer.cs @@ -67,7 +67,7 @@ private void InitializeComponent() this.B_CopyToClipboard.TabIndex = 9; this.B_CopyToClipboard.Text = "Copy to Clipboard"; this.B_CopyToClipboard.UseVisualStyleBackColor = true; - this.B_CopyToClipboard.Click += new System.EventHandler(this.btnCopyToClipboard_Click); + this.B_CopyToClipboard.Click += new System.EventHandler(this.B_CopyToClipboard_Click); // // L_ProvideInfo // diff --git a/pk3DS/Misc/ErrorWindow.cs b/pk3DS/Misc/ErrorWindow.cs index 27e8474a2b..44b8e29608 100644 --- a/pk3DS/Misc/ErrorWindow.cs +++ b/pk3DS/Misc/ErrorWindow.cs @@ -40,14 +40,8 @@ public ErrorWindow(string lang) : this() /// For application exceptions, continuing is not possible, so the button should not be shown. public bool ShowContinue { - get - { - return B_Continue.Visible; - } - set - { - B_Continue.Visible = value; - } + get => B_Continue.Visible; + set => B_Continue.Visible = value; } /// @@ -57,22 +51,13 @@ public bool ShowContinue /// For example: "An error occurred while attempting to automatically load the save file." public string Message { - get - { - return L_Message.Text; - } - set - { - L_Message.Text = value; - } + get => L_Message.Text; + set => L_Message.Text = value; } public Exception Error { - get - { - return _error; - } + get => _error; set { _error = value; @@ -114,7 +99,7 @@ private void UpdateExceptionDetailsMessage() T_ExceptionDetails.Text = details.ToString(); } - private void btnCopyToClipboard_Click(object sender, EventArgs e) + private void B_CopyToClipboard_Click(object sender, EventArgs e) { Clipboard.SetText(T_ExceptionDetails.Text); } diff --git a/pk3DS/Misc/Patch.Designer.cs b/pk3DS/Misc/Patch.Designer.cs index 052f758dc6..6ab1b596e0 100644 --- a/pk3DS/Misc/Patch.Designer.cs +++ b/pk3DS/Misc/Patch.Designer.cs @@ -151,7 +151,7 @@ private void InitializeComponent() this.Name = "Patch"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Patch Manager"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.savePatch); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SavePatch); this.ResumeLayout(false); this.PerformLayout(); diff --git a/pk3DS/Misc/Patch.cs b/pk3DS/Misc/Patch.cs index 5f43f3b4a2..a4c27dcd39 100644 --- a/pk3DS/Misc/Patch.cs +++ b/pk3DS/Misc/Patch.cs @@ -21,7 +21,7 @@ public Patch() RTB_GARCs.Lines = File.ReadAllLines("patch.txt", Encoding.Unicode); } - internal static bool patchExeFS(string path, string[] oldstr, string[] newstr, string oldROM, string newROM, ref string result, string outPath = null) + internal static bool PatchExeFS(string path, string[] oldstr, string[] newstr, string oldROM, string newROM, ref string result, string outPath = null) { int ctr = 0; if (oldstr.Length != newstr.Length) @@ -63,7 +63,7 @@ internal static bool patchExeFS(string path, string[] oldstr, string[] newstr, s return true; } - internal static string exportGARCs(string[] garcPaths, string[] newPaths, string parentRomFS, string patchFolder) + internal static string ExportGARCs(string[] garcPaths, string[] newPaths, string parentRomFS, string patchFolder) { // Stuff files into new patch folder for (int i = 0; i < garcPaths.Length; i++) @@ -80,11 +80,11 @@ internal static string exportGARCs(string[] garcPaths, string[] newPaths, string private void B_PatchCIA_Click(object sender, EventArgs e) { - string patchFolder = $"{"Patch"} ({DateTime.Now.ToString("yy-MM-dd@HH-mm-ss")})"; + string patchFolder = $"Patch ({DateTime.Now:yy-MM-dd@HH-mm-ss})"; try { - string[] garcs = getGARCs(); - string[] garcPaths = getPaths(garcs); + string[] garcs = GetGARCs(); + string[] garcPaths = GetPaths(garcs); const string oldROM = "rom:"; const string newROM = "rom2:"; @@ -102,10 +102,10 @@ private void B_PatchCIA_Click(object sender, EventArgs e) string result = ""; string ExeFS = Directory.GetFiles(Main.ExeFSPath)[0]; if (!File.Exists(ExeFS) || !Path.GetFileNameWithoutExtension(ExeFS).Contains("code")) { throw new Exception("No .code.bin detected."); } - if (!patchExeFS(ExeFS, garcPaths, newPaths, oldROM, newROM, ref result, Path.Combine(patchFolder, ".code.bin"))) + if (!PatchExeFS(ExeFS, garcPaths, newPaths, oldROM, newROM, ref result, Path.Combine(patchFolder, ".code.bin"))) throw new Exception(result); - WinFormsUtil.Alert("Patch contents saved to:" + Environment.NewLine + exportGARCs(garcPaths, newPaths, Main.RomFSPath, patchFolder), result); + WinFormsUtil.Alert("Patch contents saved to:" + Environment.NewLine + ExportGARCs(garcPaths, newPaths, Main.RomFSPath, patchFolder), result); } catch (Exception ex) { @@ -114,7 +114,7 @@ private void B_PatchCIA_Click(object sender, EventArgs e) } } - private string[] getGARCs() + private string[] GetGARCs() { StringCollection sc = new StringCollection(); foreach (int indexChecked in CHKLB_GARCs.CheckedIndices) @@ -129,16 +129,22 @@ private string[] getGARCs() return garcs.Distinct().ToArray(); } - private string[] getPaths(string[] sc) + private string[] GetPaths(string[] sc) { bool languages = CHK_Lang.Checked; StringCollection paths = new StringCollection(); foreach (string s in sc) + { if (!languages || (s != "gametext" && s != "storytext")) - paths.Add(Main.getGARCFileName(s, Main.Language)); + { + paths.Add(Main.GetGARCFileName(s, Main.Language)); + } else + { for (int l = 0; l < 8; l++) - paths.Add(Main.getGARCFileName(s, l)); + paths.Add(Main.GetGARCFileName(s, l)); + } + } string[] garcs = new string[paths.Count]; paths.CopyTo(garcs, 0); @@ -157,10 +163,12 @@ private void B_CheckNone_Click(object sender, EventArgs e) CHKLB_GARCs.SetItemChecked(i, false); } - private void savePatch(object sender, FormClosingEventArgs e) + private void SavePatch(object sender, FormClosingEventArgs e) { if (RTB_GARCs.Text.Length > 0) + { try { File.WriteAllLines("patch.ini", RTB_GARCs.Lines, Encoding.Unicode); } catch {} + } } } } diff --git a/pk3DS/Program.cs b/pk3DS/Program.cs index 43626fadba..872a5e0355 100644 --- a/pk3DS/Program.cs +++ b/pk3DS/Program.cs @@ -1,10 +1,13 @@ using System; -using System.Threading; using System.Windows.Forms; +#if !DEBUG +using System.Threading; +#endif + namespace pk3DS { - static class Program + internal static class Program { /// /// The main entry point for the application. @@ -29,6 +32,7 @@ private static void Main() Application.Run(new Main()); } +#if !DEBUG // Handle the UI exceptions by showing a dialog box, and asking the user whether or not they wish to abort execution. private static void UIThreadException(object sender, ThreadExceptionEventArgs t) { @@ -43,7 +47,7 @@ private static void UIThreadException(object sender, ThreadExceptionEventArgs t) try { // Todo: make this translatable - MessageBox.Show("A fatal error has occurred in PKHeX, and the details could not be displayed. Please report this to the author.", "PKHeX Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); + MessageBox.Show("A fatal error has occurred in pk3DS, and the details could not be displayed. Please report this to the author.", "pk3DS Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { @@ -81,5 +85,6 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc } } } +#endif } } diff --git a/pk3DS/Properties/Resources.Designer.cs b/pk3DS/Properties/Resources.Designer.cs index eacf7a17df..ac2fb8fac9 100644 --- a/pk3DS/Properties/Resources.Designer.cs +++ b/pk3DS/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace pk3DS.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/pk3DS/Properties/Settings.Designer.cs b/pk3DS/Properties/Settings.Designer.cs index b53e0198c9..56d7348124 100644 --- a/pk3DS/Properties/Settings.Designer.cs +++ b/pk3DS/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace pk3DS.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/pk3DS/Subforms/EnhancedRestore.cs b/pk3DS/Subforms/EnhancedRestore.cs index 245a2f3d4c..ecf21d8b93 100644 --- a/pk3DS/Subforms/EnhancedRestore.cs +++ b/pk3DS/Subforms/EnhancedRestore.cs @@ -63,7 +63,7 @@ private static IEnumerable GetRestorableCROs(GameConfig config, str string[] CRSs = files.Where(x => new FileInfo(x).Extension.Contains("crs")).ToArray(); var CRRs = Directory.Exists(Path.Combine(path, ".crr")) ? Directory.EnumerateFiles(Path.Combine(path, ".crr")) - : new string[0]; + : Array.Empty(); string CRRBAKPATH = Path.Combine(bak_dll, ".crr"); foreach (string src in CROs.Concat(CRSs)) @@ -128,8 +128,8 @@ public RestoreInfo(string src, string dest, string disp = null) } } - private readonly List> Items = new List>(); - private readonly List List = new List(); + private readonly List> Items = new(); + private readonly List List = new(); private void B_Go_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/FormUtil.cs b/pk3DS/Subforms/FormUtil.cs index 39a063dd6b..0d01a5c760 100644 --- a/pk3DS/Subforms/FormUtil.cs +++ b/pk3DS/Subforms/FormUtil.cs @@ -5,7 +5,7 @@ namespace pk3DS public static class FormUtil { // Utility (Shared) - internal static void setForms(int species, ComboBox cb, string[][] AltForms) + internal static void SetForms(int species, ComboBox cb, string[][] AltForms) { cb.Items.Clear(); string[] forms = AltForms[species]; diff --git a/pk3DS/Subforms/Gen6/EggMoveEditor6.Designer.cs b/pk3DS/Subforms/Gen6/EggMoveEditor6.Designer.cs index 3d0638b293..4540e49c0a 100644 --- a/pk3DS/Subforms/Gen6/EggMoveEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/EggMoveEditor6.Designer.cs @@ -71,7 +71,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeEntry); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); // // L_Species // @@ -232,7 +232,7 @@ private void InitializeComponent() this.Name = "EggMove"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Egg Move Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs index 103f1a376e..5bc444a47e 100644 --- a/pk3DS/Subforms/Gen6/EggMoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/EggMoveEditor6.cs @@ -19,16 +19,16 @@ public EggMoveEditor6(byte[][] infiles) { InitializeComponent(); files = infiles; - string[] specieslist = Main.Config.getText(TextName.SpeciesNames); + string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); specieslist[0] = movelist[0] = ""; string[] sortedspecies = (string[])specieslist.Clone(); Array.Resize(ref sortedspecies, Main.Config.MaxSpeciesID); Array.Sort(sortedspecies); - setupDGV(); + SetupDGV(); - var newlist = new List(); + var newlist = new List(); for (int i = 1; i < Main.Config.MaxSpeciesID; i++) // add all species - newlist.Add(new WinFormsUtil.cbItem { Text = sortedspecies[i], Value = Array.IndexOf(specieslist, sortedspecies[i]) }); + newlist.Add(new ComboItem { Text = sortedspecies[i], Value = Array.IndexOf(specieslist, sortedspecies[i]) }); CB_Species.DisplayMember = "Text"; CB_Species.ValueMember = "Value"; @@ -39,10 +39,10 @@ public EggMoveEditor6(byte[][] infiles) private readonly byte[][] files; private int entry = -1; - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); private bool dumping; - private void setupDGV() + private void SetupDGV() { string[] sortedmoves = (string[])movelist.Clone(); Array.Sort(sortedmoves); @@ -59,13 +59,13 @@ private void setupDGV() dgv.Columns.Add(dgvMove); } - private EggMoves pkm = new EggMoves6(new byte[0]); + private EggMoves pkm = new EggMoves6(Array.Empty()); - private void getList() + private void GetList() { - entry = WinFormsUtil.getIndex(CB_Species); + entry = WinFormsUtil.GetIndex(CB_Species); - int[] specForm = Main.Config.Personal.getSpeciesForm(entry, Main.Config); + int[] specForm = Main.Config.Personal.GetSpeciesForm(entry, Main.Config); string filename = "_" + specForm[0] + (entry > 721 ? "_" + (specForm[1] + 1) : ""); PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename); @@ -73,7 +73,7 @@ private void getList() byte[] input = files[entry]; if (input.Length == 0) return; pkm = new EggMoves6(input); - if (pkm.Count < 1) { files[entry] = new byte[0]; return; } + if (pkm.Count < 1) { files[entry] = Array.Empty(); return; } dgv.Rows.Add(pkm.Count); // Fill Entries @@ -83,7 +83,7 @@ private void getList() dgv.CancelEdit(); } - private void setList() + private void SetList() { if (entry < 1 || dumping) return; List moves = new List(); @@ -97,36 +97,35 @@ private void setList() files[entry] = pkm.Write(); } - private void changeEntry(object sender, EventArgs e) + private void ChangeEntry(object sender, EventArgs e) { - setList(); - getList(); + SetList(); + GetList(); } private void B_RandAll_Click(object sender, EventArgs e) { ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 }; - ushort[] TMs = { }; if (CHK_HMs.Checked && Main.ExeFSPath != null) - TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs); + TMHMEditor6.GetTMHMList(out _, out HMs); List banned = new List { 165, 621 }; // Struggle, Hyperspace Fury if (!CHK_HMs.Checked) banned.AddRange(HMs.Select(z => (int)z)); - setList(); + SetList(); var sets = files.Select(z => new EggMoves6(z)).ToArray(); var rand = new EggMoveRandomizer(Main.Config, sets) { Expand = CHK_Expand.Checked, ExpandTo = (int)NUD_Moves.Value, STAB = CHK_STAB.Checked, - rSTABPercent = NUD_STAB.Value, + STABPercent = NUD_STAB.Value, BannedMoves = banned.ToArray() }; rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!", "Press the Dump button to see the new Egg Moves!"); } @@ -157,16 +156,16 @@ private void B_Dump_Click(object sender, EventArgs e) dumping = false; } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setList(); + SetList(); RandSettings.SetFormSettings(this, groupBox1.Controls); } - private void calcStats() + public void CalcStats() { Move[] MoveData = Main.Config.Moves; - + int movectr = 0; int max = 0; int spec = 0; diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs index 2a26f81ce4..aad8917f69 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.Designer.cs @@ -101,7 +101,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeEntry); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); // // L_Species // @@ -132,7 +132,7 @@ private void InitializeComponent() this.CB_M1.Name = "CB_M1"; this.CB_M1.Size = new System.Drawing.Size(150, 21); this.CB_M1.TabIndex = 6; - this.CB_M1.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M1.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // L_M1 // @@ -152,7 +152,7 @@ private void InitializeComponent() this.CB_I1.Name = "CB_I1"; this.CB_I1.Size = new System.Drawing.Size(101, 21); this.CB_I1.TabIndex = 9; - this.CB_I1.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I1.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // CB_I2 // @@ -163,7 +163,7 @@ private void InitializeComponent() this.CB_I2.Name = "CB_I2"; this.CB_I2.Size = new System.Drawing.Size(101, 21); this.CB_I2.TabIndex = 15; - this.CB_I2.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I2.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // L_M2 // @@ -184,7 +184,7 @@ private void InitializeComponent() this.CB_M2.Name = "CB_M2"; this.CB_M2.Size = new System.Drawing.Size(150, 21); this.CB_M2.TabIndex = 12; - this.CB_M2.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M2.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // CB_I3 // @@ -195,7 +195,7 @@ private void InitializeComponent() this.CB_I3.Name = "CB_I3"; this.CB_I3.Size = new System.Drawing.Size(101, 21); this.CB_I3.TabIndex = 21; - this.CB_I3.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I3.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // L_M3 // @@ -216,7 +216,7 @@ private void InitializeComponent() this.CB_M3.Name = "CB_M3"; this.CB_M3.Size = new System.Drawing.Size(150, 21); this.CB_M3.TabIndex = 18; - this.CB_M3.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M3.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // CB_I4 // @@ -227,7 +227,7 @@ private void InitializeComponent() this.CB_I4.Name = "CB_I4"; this.CB_I4.Size = new System.Drawing.Size(101, 21); this.CB_I4.TabIndex = 27; - this.CB_I4.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I4.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // L_M4 // @@ -248,7 +248,7 @@ private void InitializeComponent() this.CB_M4.Name = "CB_M4"; this.CB_M4.Size = new System.Drawing.Size(150, 21); this.CB_M4.TabIndex = 24; - this.CB_M4.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M4.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // CB_I5 // @@ -259,7 +259,7 @@ private void InitializeComponent() this.CB_I5.Name = "CB_I5"; this.CB_I5.Size = new System.Drawing.Size(101, 21); this.CB_I5.TabIndex = 33; - this.CB_I5.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I5.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // L_M5 // @@ -280,7 +280,7 @@ private void InitializeComponent() this.CB_M5.Name = "CB_M5"; this.CB_M5.Size = new System.Drawing.Size(150, 21); this.CB_M5.TabIndex = 30; - this.CB_M5.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M5.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // CB_I8 // @@ -291,7 +291,7 @@ private void InitializeComponent() this.CB_I8.Name = "CB_I8"; this.CB_I8.Size = new System.Drawing.Size(101, 21); this.CB_I8.TabIndex = 51; - this.CB_I8.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I8.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // L_M8 // @@ -312,7 +312,7 @@ private void InitializeComponent() this.CB_M8.Name = "CB_M8"; this.CB_M8.Size = new System.Drawing.Size(150, 21); this.CB_M8.TabIndex = 48; - this.CB_M8.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M8.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // CB_I7 // @@ -323,7 +323,7 @@ private void InitializeComponent() this.CB_I7.Name = "CB_I7"; this.CB_I7.Size = new System.Drawing.Size(101, 21); this.CB_I7.TabIndex = 45; - this.CB_I7.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I7.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // L_M7 // @@ -344,7 +344,7 @@ private void InitializeComponent() this.CB_M7.Name = "CB_M7"; this.CB_M7.Size = new System.Drawing.Size(150, 21); this.CB_M7.TabIndex = 42; - this.CB_M7.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M7.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // CB_I6 // @@ -355,7 +355,7 @@ private void InitializeComponent() this.CB_I6.Name = "CB_I6"; this.CB_I6.Size = new System.Drawing.Size(101, 21); this.CB_I6.TabIndex = 39; - this.CB_I6.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I6.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // L_M6 // @@ -376,7 +376,7 @@ private void InitializeComponent() this.CB_M6.Name = "CB_M6"; this.CB_M6.Size = new System.Drawing.Size(150, 21); this.CB_M6.TabIndex = 36; - this.CB_M6.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M6.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // PB_1 // @@ -691,7 +691,7 @@ private void InitializeComponent() this.Name = "EvolutionEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Evolution Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.PB_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_4)).EndInit(); diff --git a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs index e31056477f..5cbeb208f1 100644 --- a/pk3DS/Subforms/Gen6/EvolutionEditor6.cs +++ b/pk3DS/Subforms/Gen6/EvolutionEditor6.cs @@ -23,7 +23,7 @@ public EvolutionEditor6(byte[][] infiles) Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); string[] evolutionMethods = - { + { "", "Level Up with Friendship", "Level Up at Morning with Friendship", @@ -82,14 +82,14 @@ public EvolutionEditor6(byte[][] infiles) private readonly ComboBox[] mb; private readonly PictureBox[] pic; private int entry = -1; - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); - private readonly string[] typelist = Main.Config.getText(TextName.Types); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); + private readonly string[] typelist = Main.Config.GetText(TextName.Types); private bool dumping; private EvolutionSet evo = new EvolutionSet6(new byte[EvolutionSet6.SIZE]); - private void getList() + private void GetList() { entry = Array.IndexOf(specieslist, CB_Species.Text); byte[] input = files[entry]; @@ -99,14 +99,14 @@ private void getList() for (int i = 0; i < evo.PossibleEvolutions.Length; i++) { if (evo.PossibleEvolutions[i].Method > 34) return; // Invalid! - + mb[i].SelectedIndex = evo.PossibleEvolutions[i].Method; // Which will trigger the params cb to reload the valid params list pb[i].SelectedIndex = evo.PossibleEvolutions[i].Argument; rb[i].SelectedIndex = evo.PossibleEvolutions[i].Species; } } - private void setList() + private void SetList() { if (entry < 1 || dumping) return; @@ -119,10 +119,10 @@ private void setList() files[entry] = evo.Write(); } - private void changeEntry(object sender, EventArgs e) + private void ChangeEntry(object sender, EventArgs e) { - setList(); - getList(); + SetList(); + GetList(); } private void B_RandAll_Click(object sender, EventArgs e) @@ -130,7 +130,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all resulting species?", "Evolution methods and parameters will stay the same.")) return; - setList(); + SetList(); // Set up advanced randomization options var evos = files.Select(z => new EvolutionSet6(z)).ToArray(); var evoRand = new EvolutionRandomizer(Main.Config, evos); @@ -142,7 +142,7 @@ private void B_RandAll_Click(object sender, EventArgs e) evoRand.Randomizer.Initialize(); evoRand.Execute(); evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); WinFormsUtil.Alert("All Pokémon's Evolutions have been randomized!"); } @@ -152,13 +152,13 @@ private void B_Trade_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Remove all trade evolutions?", "Evolution methods will be altered so that evolutions will be possible with only one game.")) return; - setList(); + SetList(); var evos = files.Select(z => new EvolutionSet6(z)).ToArray(); var evoRand = new EvolutionRandomizer(Main.Config, evos); evoRand.Randomizer.Initialize(); evoRand.ExecuteTrade(); evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); } @@ -168,7 +168,7 @@ private void B_EveryLevel_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify evolutions?", "This will make it to where your Pokémon will evolve into something random every time it levels up.")) return; - setList(); + SetList(); var evos = files.Select(z => new EvolutionSet6(z)).ToArray(); var evoRand = new EvolutionRandomizer(Main.Config, evos); evoRand.Randomizer.rBST = CHK_BST.Checked; @@ -180,7 +180,7 @@ private void B_EveryLevel_Click(object sender, EventArgs e) evoRand.ExecuteEvolveEveryLevel(); evoRand.Execute(); // randomize right after evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); SystemSounds.Asterisk.Play(); } @@ -217,17 +217,17 @@ private void B_Dump_Click(object sender, EventArgs e) dumping = false; } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setList(); + SetList(); RandSettings.SetFormSettings(this, GB_Randomizer.Controls); } - private void changeMethod(object sender, EventArgs e) + private void ChangeMethod(object sender, EventArgs e) { int op = Array.IndexOf(mb, sender as ComboBox); ushort[] methodCase = - { + { 0,0,0,0,1,0,2,0,2,1,1,1,1,1,1,1,5,2,2,2,2,3,4,1,1,0,0,0, // 27, Past Methods // New Methods 1, // 28 - Dark Type Party @@ -254,7 +254,7 @@ private void changeMethod(object sender, EventArgs e) case 3: // Moves { foreach (string t in movelist) pb[op].Items.Add(t); break; } case 4: // Species - { for (int i = 0; i < specieslist.Length; i++) pb[op].Items.Add(specieslist[i]); break; } + { foreach (string t in specieslist) pb[op].Items.Add(t); break; } case 5: // 0-255 (Beauty) { for (int i = 0; i <= 255; i++) pb[op].Items.Add(i.ToString()); break; } case 6: @@ -263,9 +263,11 @@ private void changeMethod(object sender, EventArgs e) pb[op].SelectedIndex = 0; } - private void changeInto(object sender, EventArgs e) + private void ChangeInto(object sender, EventArgs e) { - pic[Array.IndexOf(rb, sender as ComboBox)].Image = (Bitmap)Resources.ResourceManager.GetObject("_" + Array.IndexOf(specieslist, (sender as ComboBox).Text)); + if (sender is not ComboBox cb) + return; + pic[Array.IndexOf(rb, cb)].Image = (Bitmap)Resources.ResourceManager.GetObject("_" + Array.IndexOf(specieslist, cb.Text)); } } } diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs index 9c0a5aefda..43fbceb018 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSE.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSE.cs @@ -27,7 +27,7 @@ public OWSE() tb_Zone.SelectedIndex = 1; // Show Overworlds tab } - private readonly string[] gameLocations = Main.Config.getText(TextName.metlist_000000); + private readonly string[] gameLocations = Main.Config.GetText(TextName.metlist_000000); private string[] filepaths; private string[] encdatapaths; private byte[] masterZoneData; @@ -41,7 +41,7 @@ public OWSE() // Map Viewer References internal static Zone CurrentZone; internal static MapMatrix mm; - private readonly MapPermView mapView = new MapPermView(); + private readonly MapPermView mapView = new(); private void OpenQuick(string[] encdata) { @@ -103,27 +103,27 @@ private void GetEntry() // Read master ZD table byte[] zd = masterZoneData.Skip(ZoneData.Size * entry).Take(ZoneData.Size).ToArray(); - RTB_ZDMaster.Lines = Scripts.getHexLines(zd, 0x10); + RTB_ZDMaster.Lines = Scripts.GetHexLines(zd, 0x10); // Load from location Data. CurrentZone = new Zone(locationData); // File 0 - ZoneData - RTB_ZD.Lines = Scripts.getHexLines(locationData[0], 0x10); + RTB_ZD.Lines = Scripts.GetHexLines(locationData[0], 0x10); GetZoneData(); // File 1 - Overworld Setup & Script - RTB_OWSC.Lines = Scripts.getHexLines(locationData[1], 0x10); + RTB_OWSC.Lines = Scripts.GetHexLines(locationData[1], 0x10); GetOWSData(); // File 2 - Map Script - RTB_MapSC.Lines = Scripts.getHexLines(locationData[2], 0x10); + RTB_MapSC.Lines = Scripts.GetHexLines(locationData[2], 0x10); GetScriptData(); // File 3 - Encounters - RTB_Encounter.Lines = Scripts.getHexLines(locationData[3], 0x10); + RTB_Encounter.Lines = Scripts.GetHexLines(locationData[3], 0x10); // File 4 - ?? (ORAS Only?) - RTB_File5.Lines = Scripts.getHexLines(locationData.Length <= 4 ? null : locationData[4], 0x10); + RTB_File5.Lines = Scripts.GetHexLines(locationData.Length <= 4 ? null : locationData[4], 0x10); } private void SetEntry() @@ -199,11 +199,11 @@ private void GetOWSData() var script = CurrentZone.Entities.Script; if (script.Raw.Length > 4) { - RTB_OS.Lines = Scripts.getHexLines(script.Raw); + RTB_OS.Lines = Scripts.GetHexLines(script.Raw); L_OWSCDesc.Text = script.Info; uint[] Instructions = script.DecompressedInstructions; - RTB_OWSCMD.Lines = Scripts.getHexLines(Instructions); + RTB_OWSCMD.Lines = Scripts.GetHexLines(Instructions); if (script.DecompressedLength / 4 != Instructions.Length) RTB_OWSCMD.Text = RTB_OSP.Text = "DCMP FAIL"; @@ -221,11 +221,11 @@ private void GetScriptData() var script = CurrentZone.MapScript.Script; if (script.Raw.Length > 4) { - RTB_MS.Lines = Scripts.getHexLines(script.Raw); + RTB_MS.Lines = Scripts.GetHexLines(script.Raw); L_MSSCDesc.Text = script.Info; uint[] Instructions = script.DecompressedInstructions; - RTB_MSCMD.Lines = Scripts.getHexLines(Instructions); + RTB_MSCMD.Lines = Scripts.GetHexLines(Instructions); if (script.DecompressedLength / 4 != Instructions.Length) RTB_MSCMD.Text = RTB_OSP.Text = "DCMP FAIL"; @@ -271,7 +271,7 @@ private void ChangeFurnitureCount(object sender, EventArgs e) CurrentZone.Entities.FurnitureCount = count; Array.Resize(ref CurrentZone.Entities.Furniture, count); for (int i = 0; i < count; i++) - CurrentZone.Entities.Furniture[i] = CurrentZone.Entities.Furniture[i] ?? new Zone.ZoneEntities.EntityFurniture(); + CurrentZone.Entities.Furniture[i] ??= new Zone.ZoneEntities.EntityFurniture(); ToggleEnable(NUD_FurnCount, NUD_FE, GB_F); } @@ -283,7 +283,7 @@ private void ChangeNPCCount(object sender, EventArgs e) CurrentZone.Entities.NPCCount = count; Array.Resize(ref CurrentZone.Entities.NPCs, count); for (int i = 0; i < count; i++) - CurrentZone.Entities.NPCs[i] = CurrentZone.Entities.NPCs[i] ?? new Zone.ZoneEntities.EntityNPC(); + CurrentZone.Entities.NPCs[i] ??= new Zone.ZoneEntities.EntityNPC(); ToggleEnable(NUD_NPCCount, NUD_NE, GB_N); } @@ -295,7 +295,7 @@ private void ChangeWarpCount(object sender, EventArgs e) CurrentZone.Entities.WarpCount = count; Array.Resize(ref CurrentZone.Entities.Warps, count); for (int i = 0; i < count; i++) - CurrentZone.Entities.Warps[i] = CurrentZone.Entities.Warps[i] ?? new Zone.ZoneEntities.EntityWarp(); + CurrentZone.Entities.Warps[i] ??= new Zone.ZoneEntities.EntityWarp(); ToggleEnable(NUD_WarpCount, NUD_WE, GB_W); } @@ -307,7 +307,7 @@ private void ChangeTriggerCount(object sender, EventArgs e) CurrentZone.Entities.TriggerCount = count; Array.Resize(ref CurrentZone.Entities.Triggers1, count); for (int i = 0; i < count; i++) - CurrentZone.Entities.Triggers1[i] = CurrentZone.Entities.Triggers1[i] ?? new Zone.ZoneEntities.EntityTrigger1(); + CurrentZone.Entities.Triggers1[i] ??= new Zone.ZoneEntities.EntityTrigger1(); ToggleEnable(NUD_TrigCount, NUD_TE, GB_T1); } @@ -319,7 +319,7 @@ private void ChangeUnkCount(object sender, EventArgs e) CurrentZone.Entities.UnknownCount = count; Array.Resize(ref CurrentZone.Entities.Triggers2, count); for (int i = 0; i < count; i++) - CurrentZone.Entities.Triggers2[i] = CurrentZone.Entities.Triggers2[i] ?? new Zone.ZoneEntities.EntityTrigger2(); + CurrentZone.Entities.Triggers2[i] ??= new Zone.ZoneEntities.EntityTrigger2(); ToggleEnable(NUD_UnkCount, NUD_UE, GB_T2); } @@ -342,7 +342,7 @@ private void GetFurniture() NUD_FY.Value = Furniture.Y; NUD_FWX.Value = Furniture.WX; NUD_FWY.Value = Furniture.WY; - RTB_F.Text = Util.getHexString(Furniture.Raw); + RTB_F.Text = Util.GetHexString(Furniture.Raw); } private void SetFurniture() @@ -388,7 +388,7 @@ private void GetNPC() ? TB_Leash.Text = "No Leash!" : $"{NPC.L1}, {NPC.L2}, {NPC.L3} -- {NPC.LDir}"; - RTB_N.Text = Util.getHexString(NPC.Raw); + RTB_N.Text = Util.GetHexString(NPC.Raw); } private void SetNPC() @@ -423,7 +423,7 @@ private void GetWarp() if (NUD_WE.Value < 0) return; var Warp = CurrentZone.Entities.Warps[wEntry]; - RTB_W.Text = Util.getHexString(Warp.Raw); + RTB_W.Text = Util.GetHexString(Warp.Raw); // Load new Attributes NUD_WMap.Value = Warp.DestinationMap; @@ -463,7 +463,7 @@ private void GetTrigger1() var Trigger1 = CurrentZone.Entities.Triggers1[tEntry]; NUD_T1X.Value = Trigger1.X; NUD_T1Y.Value = Trigger1.Y; - RTB_T1.Text = Util.getHexString(Trigger1.Raw); + RTB_T1.Text = Util.GetHexString(Trigger1.Raw); } private void SetTrigger1() @@ -492,7 +492,7 @@ private void GetTrigger2() var Trigger2 = CurrentZone.Entities.Triggers2[uEntry]; NUD_T2X.Value = Trigger2.X; NUD_T2Y.Value = Trigger2.Y; - RTB_T2.Text = Util.getHexString(Trigger2.Raw); + RTB_T2.Text = Util.GetHexString(Trigger2.Raw); } private void SetTrigger2() @@ -526,7 +526,7 @@ private void DclickDestMap(object sender, EventArgs e) // Script Handling private void B_HLCMD_Click(object sender, EventArgs e) { - int ctr = WinFormsUtil.highlightText(RTB_OSP, "**", Color.Red) + (WinFormsUtil.highlightText(RTB_MSP, "**", Color.Red) / 2); + int ctr = WinFormsUtil.HighlightText(RTB_OSP, "**", Color.Red) + (WinFormsUtil.HighlightText(RTB_MSP, "**", Color.Red) / 2); WinFormsUtil.Alert($"{ctr} instance{(ctr > 1 ? "s" : "")} of \"*\" present."); } @@ -546,7 +546,7 @@ private void TabMain_DragDrop(object sender, DragEventArgs e) private void ParseScriptInput(byte[] data) { Script scr = new Script(data); - RTB_CompressedScript.Lines = Scripts.getHexLines(scr.CompressedBytes); + RTB_CompressedScript.Lines = Scripts.GetHexLines(scr.CompressedBytes); System.Media.SystemSounds.Asterisk.Play(); } @@ -558,9 +558,9 @@ private void PasteScript(object sender, EventArgs e) string text = RTB_CompressedScript.Text.Replace(Environment.NewLine, "").Replace("\n", "").Replace(" ", ""); byte[] data = Util.StringToByteArray(text); - byte[] dec = Scripts.decompressScript(data); + byte[] dec = Scripts.DecompressScript(data); - RTB_DecompressedScript.Lines = Scripts.getHexLines(dec); + RTB_DecompressedScript.Lines = Scripts.GetHexLines(dec); } catch { @@ -582,7 +582,7 @@ private void B_DumpFurniture_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = i; for (int j = 0; j < CurrentZone.Entities.FurnitureCount; j++) { - result.Add(Util.getHexString(CurrentZone.Entities.Furniture[j].Raw)); + result.Add(Util.GetHexString(CurrentZone.Entities.Furniture[j].Raw)); data.Add(CurrentZone.Entities.Furniture[j].Raw); } } @@ -609,7 +609,7 @@ private void B_DumpNPC_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = i; for (int j = 0; j < CurrentZone.Entities.NPCCount; j++) { - result.Add(Util.getHexString(CurrentZone.Entities.NPCs[j].Raw)); + result.Add(Util.GetHexString(CurrentZone.Entities.NPCs[j].Raw)); data.Add(CurrentZone.Entities.NPCs[j].Raw); } } @@ -636,7 +636,7 @@ private void B_DumpWarp_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = i; for (int j = 0; j < CurrentZone.Entities.WarpCount; j++) { - result.Add(Util.getHexString(CurrentZone.Entities.Warps[j].Raw)); + result.Add(Util.GetHexString(CurrentZone.Entities.Warps[j].Raw)); data.Add(CurrentZone.Entities.Warps[j].Raw); } } @@ -663,7 +663,7 @@ private void B_DumpTrigger_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = i; for (int j = 0; j < CurrentZone.Entities.TriggerCount; j++) { - result.Add(Util.getHexString(CurrentZone.Entities.Triggers1[j].Raw)); + result.Add(Util.GetHexString(CurrentZone.Entities.Triggers1[j].Raw)); data.Add(CurrentZone.Entities.Triggers1[j].Raw); } } @@ -690,7 +690,7 @@ private void B_DumpUnk_Click(object sender, EventArgs e) CB_LocationID.SelectedIndex = i; for (int j = 0; j < CurrentZone.Entities.UnknownCount; j++) { - result.Add(Util.getHexString(CurrentZone.Entities.Triggers2[j].Raw)); + result.Add(Util.GetHexString(CurrentZone.Entities.Triggers2[j].Raw)); data.Add(CurrentZone.Entities.Triggers2[j].Raw); } } @@ -747,7 +747,7 @@ private void B_DumpZD_Click(object sender, EventArgs e) for (int i = 0; i < CB_LocationID.Items.Count; i++) { CB_LocationID.SelectedIndex = i; - result.Add(Util.getHexString(CurrentZone.ZD.Data)); + result.Add(Util.GetHexString(CurrentZone.ZD.Data)); data.Add(CurrentZone.ZD.Data); } if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Write ZDs to file?") == DialogResult.Yes) @@ -781,7 +781,7 @@ private void ChangeRAWCheck(object sender, EventArgs e) private void ChangeRAW_F(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) + if (sender is not RichTextBox { Visible: true }) return; try @@ -794,13 +794,13 @@ private void ChangeRAW_F(object sender, EventArgs e) } catch { - ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Furniture[fEntry].Raw); + ((RichTextBox) sender).Text = Util.GetHexString(CurrentZone.Entities.Furniture[fEntry].Raw); } } private void ChangeRAW_N(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) + if (sender is not RichTextBox { Visible: true }) return; try @@ -813,13 +813,13 @@ private void ChangeRAW_N(object sender, EventArgs e) } catch { - ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.NPCs[nEntry].Raw); + ((RichTextBox) sender).Text = Util.GetHexString(CurrentZone.Entities.NPCs[nEntry].Raw); } } private void ChangeRAW_W(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) + if (sender is not RichTextBox { Visible: true }) return; try @@ -832,13 +832,13 @@ private void ChangeRAW_W(object sender, EventArgs e) } catch { - ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Warps[wEntry].Raw); + ((RichTextBox) sender).Text = Util.GetHexString(CurrentZone.Entities.Warps[wEntry].Raw); } } private void ChangeRAW_T1(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) + if (sender is not RichTextBox { Visible: true }) return; try @@ -851,13 +851,13 @@ private void ChangeRAW_T1(object sender, EventArgs e) } catch { - ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Triggers1[tEntry].Raw); + ((RichTextBox) sender).Text = Util.GetHexString(CurrentZone.Entities.Triggers1[tEntry].Raw); } } private void ChangeRAW_T2(object sender, EventArgs e) { - if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible) + if (sender is not RichTextBox {Visible: true}) return; try @@ -870,7 +870,7 @@ private void ChangeRAW_T2(object sender, EventArgs e) } catch { - ((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Triggers2[uEntry].Raw); + ((RichTextBox) sender).Text = Util.GetHexString(CurrentZone.Entities.Triggers2[uEntry].Raw); } } diff --git a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs index 5227b1308a..7fb695d339 100644 --- a/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs +++ b/pk3DS/Subforms/Gen6/Experimental/OWSEStructs.cs @@ -46,20 +46,18 @@ public MapMatrix(byte[][] data) public byte[] Write() { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + bw.Write(u0); + bw.Write(Width); + bw.Write(Height); + foreach (ushort Entry in EntryList) { - bw.Write(u0); - bw.Write(Width); - bw.Write(Height); - foreach (ushort Entry in EntryList) - { - bw.Write(Entry); - } - - bw.Write(uL); - return ms.ToArray(); + bw.Write(Entry); } + + bw.Write(uL); + return ms.ToArray(); } public Bitmap Preview(int Scale, int ColorShift) @@ -82,11 +80,9 @@ public Bitmap Preview(int Scale, int ColorShift) // Combine all images into one. Bitmap img = new Bitmap(EntryImages[0].Width * Width, EntryImages[0].Height * Height); - using (Graphics g = Graphics.FromImage(img)) - { - for (int i = 0; i < Area; i++) - g.DrawImage(EntryImages[i], new Point(i * EntryImages[0].Width % img.Width, EntryImages[0].Height * (i / Width))); - } + using Graphics g = Graphics.FromImage(img); + for (int i = 0; i < Area; i++) + g.DrawImage(EntryImages[i], new Point(i * EntryImages[0].Width % img.Width, EntryImages[0].Height * (i / Width))); return img; } @@ -101,33 +97,29 @@ public class Entry public Entry(byte[] data) { - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + Width = br.ReadUInt16(); + Height = br.ReadUInt16(); + Area = Width*Height; + Tiles = new uint[Area]; + for (int i = 0; i < Area; i++) { - Width = br.ReadUInt16(); - Height = br.ReadUInt16(); - Area = Width*Height; - Tiles = new uint[Area]; - for (int i = 0; i < Area; i++) - { - Tiles[i] = br.ReadUInt32(); - } + Tiles[i] = br.ReadUInt32(); } } public byte[] Write() { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + bw.Write(Width); + bw.Write(Height); + foreach (uint Tile in Tiles) { - bw.Write(Width); - bw.Write(Height); - foreach (uint Tile in Tiles) - { - bw.Write(Tile); - } - - return ms.ToArray(); + bw.Write(Tile); } + + return ms.ToArray(); } public Bitmap Preview(int s, int ColorShift) @@ -176,50 +168,48 @@ public class Collision public Collision(byte[] data) { - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + Magic = new string(br.ReadChars(4)); // Magic + if (Magic != "coll") { - Magic = new string(br.ReadChars(4)); // Magic - if (Magic != "coll") - { - return; // all other properties are null - } + return; // all other properties are null + } - termOffset = br.ReadInt32(); - U5D8 = br.ReadInt32(); - UnknownBytes = br.ReadBytes(0x14); + termOffset = br.ReadInt32(); + U5D8 = br.ReadInt32(); + UnknownBytes = br.ReadBytes(0x14); - // Read 40 collision rectangles - Map40 = new CollisionObject[40]; - for (int i = 0; i < Map40.Length; i++) - { - Map40[i] = new CollisionObject(br.ReadBytes(0x10)); - } - - // Read 32 Int32s - MapInts = new int[0x20]; - for (int i = 0; i < MapInts.Length; i++) - { - MapInts[i] = br.ReadInt32(); - } + // Read 40 collision rectangles + Map40 = new CollisionObject[40]; + for (int i = 0; i < Map40.Length; i++) + { + Map40[i] = new CollisionObject(br.ReadBytes(0x10)); + } - // Read misc collision rectangles - int ct = termOffset - (int)br.BaseStream.Position + 0x10; - MapMisc = new CollisionObject[ct/0x10]; - for (int i = 0; i < MapMisc.Length; i++) - { - MapMisc[i] = new CollisionObject(br.ReadBytes(0x10)); - } + // Read 32 Int32s + MapInts = new int[0x20]; + for (int i = 0; i < MapInts.Length; i++) + { + MapInts[i] = br.ReadInt32(); + } - // Read Term - termMagic = new string(br.ReadChars(4)); - if (termMagic != "term") - { - return; // all other properties are null - } + // Read misc collision rectangles + int ct = termOffset - (int)br.BaseStream.Position + 0x10; + MapMisc = new CollisionObject[ct/0x10]; + for (int i = 0; i < MapMisc.Length; i++) + { + MapMisc[i] = new CollisionObject(br.ReadBytes(0x10)); + } - // Read the rest of the data.... - termData = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position)); + // Read Term + termMagic = new string(br.ReadChars(4)); + if (termMagic != "term") + { + return; // all other properties are null } + + // Read the rest of the data.... + termData = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position)); } public class CollisionObject @@ -258,19 +248,20 @@ public string Unk2String() private void ParseUnk(byte[] data) { List unk = new List(); - using (var br = new BinaryReader(new MemoryStream(data))) - { - do + using var ms = new MemoryStream(data); + using var br = new BinaryReader(ms); + do { - unk.Add(new Unknown { + var obj = new Unknown + { Direction = br.ReadUInt32(), _1 = br.ReadSingle(), _2 = br.ReadSingle(), _3 = br.ReadSingle(), _4 = br.ReadSingle(), - }); + }; + unk.Add(obj); } while (unk.Last().Direction != 0); - } unk.RemoveAt(unk.Count-1); Unknowns = unk.ToArray(); @@ -338,15 +329,15 @@ public int BattleBackground // 7-13 set => BitConverter.GetBytes((ushort)(((value & 0x7F) << 7) | (BitConverter.ToUInt16(Data, 0x1E) & ~0x3F80))).CopyTo(Data, 0x1E); } - private uint _20 { get => BitConverter.ToUInt32(Data, 0x20); set => BitConverter.GetBytes(value).CopyTo(Data, 0x20); } - public uint MapChange { get => _20 & 0x1Fu; set => _20 = (_20 & ~0x1Fu) | value; } + private uint Unk_20 { get => BitConverter.ToUInt32(Data, 0x20); set => BitConverter.GetBytes(value).CopyTo(Data, 0x20); } + public uint MapChange { get => Unk_20 & 0x1Fu; set => Unk_20 = (Unk_20 & ~0x1Fu) | value; } // ??? 5 - public bool IsBicycleEnable { get => ((_20 >> 10) & 1) == 1; set => _20 = (_20 & ~(1u << 10)) | (value ? 1u << 10 : 0); } - public bool IsRunEnable { get => ((_20 >> 11) & 1) == 1; set => _20 = (_20 & ~(1u << 11)) | (value ? 1u << 11 : 0); } - public bool IsEscapeRopeEnable { get => ((_20 >> 12) & 1) == 1; set => _20 = (_20 & ~(1u << 12)) | (value ? 1u << 12 : 0); } - public bool IsFlyEnable { get => ((_20 >> 13) & 1) == 1; set => _20 = (_20 & ~(1u << 13)) | (value ? 1u << 13 : 0); } - public bool IsBGM { get => ((_20 >> 14) & 1) == 1; set => _20 = (_20 & ~(1u << 14)) | (value ? 1u << 14 : 0); } - public bool IsUnk { get => ((_20 >> 15) & 1) == 1; set => _20 = (_20 & ~(1u << 15)) | (value ? 1u << 15 : 0); } + public bool IsBicycleEnable { get => ((Unk_20 >> 10) & 1) == 1; set => Unk_20 = (Unk_20 & ~(1u << 10)) | (value ? 1u << 10 : 0); } + public bool IsRunEnable { get => ((Unk_20 >> 11) & 1) == 1; set => Unk_20 = (Unk_20 & ~(1u << 11)) | (value ? 1u << 11 : 0); } + public bool IsEscapeRopeEnable { get => ((Unk_20 >> 12) & 1) == 1; set => Unk_20 = (Unk_20 & ~(1u << 12)) | (value ? 1u << 12 : 0); } + public bool IsFlyEnable { get => ((Unk_20 >> 13) & 1) == 1; set => Unk_20 = (Unk_20 & ~(1u << 13)) | (value ? 1u << 13 : 0); } + public bool IsBGM { get => ((Unk_20 >> 14) & 1) == 1; set => Unk_20 = (Unk_20 & ~(1u << 14)) | (value ? 1u << 14 : 0); } + public bool IsUnk { get => ((Unk_20 >> 15) & 1) == 1; set => Unk_20 = (Unk_20 & ~(1u << 15)) | (value ? 1u << 15 : 0); } // unused - camera public ushort Camera1 { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes(value).CopyTo(Data, 0x22); } @@ -445,47 +436,45 @@ public ZoneEntities(byte[] data) { Data = data; - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + // Load Header + Length = br.ReadInt32(); + Furniture = new EntityFurniture[FurnitureCount = br.ReadByte()]; + NPCs = new EntityNPC[NPCCount = br.ReadByte()]; + Warps = new EntityWarp[WarpCount = br.ReadByte()]; + Triggers1 = new EntityTrigger1[TriggerCount = br.ReadByte()]; + Triggers2 = new EntityTrigger2[UnknownCount = br.ReadInt32()]; // not sure if there's other types or if the remaining 3 bytes are padding. + + // Load Entitites + for (int i = 0; i < FurnitureCount; i++) { - // Load Header - Length = br.ReadInt32(); - Furniture = new EntityFurniture[FurnitureCount = br.ReadByte()]; - NPCs = new EntityNPC[NPCCount = br.ReadByte()]; - Warps = new EntityWarp[WarpCount = br.ReadByte()]; - Triggers1 = new EntityTrigger1[TriggerCount = br.ReadByte()]; - Triggers2 = new EntityTrigger2[UnknownCount = br.ReadInt32()]; // not sure if there's other types or if the remaining 3 bytes are padding. - - // Load Entitites - for (int i = 0; i < FurnitureCount; i++) - { - Furniture[i] = new EntityFurniture(br.ReadBytes(EntityFurniture.Size)); - } - - for (int i = 0; i < NPCCount; i++) - { - NPCs[i] = new EntityNPC(br.ReadBytes(EntityNPC.Size)); - } + Furniture[i] = new EntityFurniture(br.ReadBytes(EntityFurniture.Size)); + } - for (int i = 0; i < WarpCount; i++) - { - Warps[i] = new EntityWarp(br.ReadBytes(EntityWarp.Size)); - } + for (int i = 0; i < NPCCount; i++) + { + NPCs[i] = new EntityNPC(br.ReadBytes(EntityNPC.Size)); + } - for (int i = 0; i < TriggerCount; i++) - { - Triggers1[i] = new EntityTrigger1(br.ReadBytes(EntityTrigger1.Size)); - } + for (int i = 0; i < WarpCount; i++) + { + Warps[i] = new EntityWarp(br.ReadBytes(EntityWarp.Size)); + } - for (int i = 0; i < UnknownCount; i++) - { - Triggers2[i] = new EntityTrigger2(br.ReadBytes(EntityTrigger2.Size)); - } + for (int i = 0; i < TriggerCount; i++) + { + Triggers1[i] = new EntityTrigger1(br.ReadBytes(EntityTrigger1.Size)); + } - // Load Script Data - int len = br.ReadInt32(); - br.BaseStream.Position -= 4; - Script = new Script(br.ReadBytes(len)); + for (int i = 0; i < UnknownCount; i++) + { + Triggers2[i] = new EntityTrigger2(br.ReadBytes(EntityTrigger2.Size)); } + + // Load Script Data + int len = br.ReadInt32(); + br.BaseStream.Position -= 4; + Script = new Script(br.ReadBytes(len)); } public byte[] Write() @@ -563,7 +552,7 @@ public class EntityFurniture public byte[] Raw; public byte[] OriginalData; - internal static readonly byte Size = 0x14; + internal const byte Size = 0x14; public EntityFurniture(byte[] data = null) { @@ -622,7 +611,7 @@ public class EntityNPC public byte[] Raw; public byte[] OriginalData; - internal static readonly byte Size = 0x30; + internal const byte Size = 0x30; public EntityNPC(byte[] data = null) { @@ -643,25 +632,25 @@ public class EntityWarp public int DestinationTileIndex { get => BitConverter.ToUInt16(Raw, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x02); } // Not sure if these are widths or face direction - public byte FaceDirection { get => Raw[0x04]; set => Raw[0x4] = (byte)value; } - public byte SceneTransitionEffect { get => Raw[0x05]; set => Raw[0x5] = (byte)value; } + public byte FaceDirection { get => Raw[0x04]; set => Raw[0x4] = value; } + public byte SceneTransitionEffect { get => Raw[0x05]; set => Raw[0x5] = value; } // Either 0 or 1, only in X/Y // 0: use x,z,y // 1: use x,y,{unused} - public ushort CoordinateType { get => BitConverter.ToUInt16(Raw, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(Raw, 0x06); } + public ushort CoordinateType { get => BitConverter.ToUInt16(Raw, 0x06); set => BitConverter.GetBytes(value).CopyTo(Raw, 0x06); } // Coordinates have some upper-bit usage it seems... - public short X { get => BitConverter.ToInt16(Raw, 0x08); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x08); } - public short Z { get => BitConverter.ToInt16(Raw, 0x0A); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0A); } - public short Y { get => BitConverter.ToInt16(Raw, 0x0C); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0C); } + public short X { get => BitConverter.ToInt16(Raw, 0x08); set => BitConverter.GetBytes(value).CopyTo(Raw, 0x08); } + public short Z { get => BitConverter.ToInt16(Raw, 0x0A); set => BitConverter.GetBytes(value).CopyTo(Raw, 0x0A); } + public short Y { get => BitConverter.ToInt16(Raw, 0x0C); set => BitConverter.GetBytes(value).CopyTo(Raw, 0x0C); } public decimal PX => (decimal)X / 18; public decimal PY => (decimal)Y / 18; // Stretches RIGHT - public short Width { get => BitConverter.ToInt16(Raw, 0x0E); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x0E); } + public short Width { get => BitConverter.ToInt16(Raw, 0x0E); set => BitConverter.GetBytes(value).CopyTo(Raw, 0x0E); } // Stretches DOWN - public short Height { get => BitConverter.ToInt16(Raw, 0x10); set => BitConverter.GetBytes((short)value).CopyTo(Raw, 0x10); } + public short Height { get => BitConverter.ToInt16(Raw, 0x10); set => BitConverter.GetBytes(value).CopyTo(Raw, 0x10); } // 0-bidirectional // 1-send only // 2-receive only @@ -672,7 +661,7 @@ public class EntityWarp public byte[] Raw; public byte[] OriginalData; - internal static readonly byte Size = 0x18; + internal const byte Size = 0x18; public EntityWarp(byte[] data = null) { @@ -710,7 +699,7 @@ public class EntityTrigger1 public byte[] Raw; public byte[] OriginalData; - internal static readonly byte Size = 0x18; + internal const byte Size = 0x18; public EntityTrigger1(byte[] data = null) { @@ -748,7 +737,7 @@ public class EntityTrigger2 public byte[] Raw; public byte[] OriginalData; - internal static readonly byte Size = 0x18; + internal const byte Size = 0x18; public EntityTrigger2(byte[] data = null) { @@ -788,14 +777,12 @@ public ZoneEncounters(byte[] data) { Data = data; - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + Header = br.ReadBytes(0x10); + Encounters = new EncounterSet[(int)(br.BaseStream.Length - br.BaseStream.Position)/4]; + for (int i = 0; i < Encounters.Length; i++) { - Header = br.ReadBytes(0x10); - Encounters = new EncounterSet[(int)(br.BaseStream.Length - br.BaseStream.Position)/4]; - for (int i = 0; i < Encounters.Length; i++) - { - Encounters[i] = new EncounterSet(br.ReadBytes(4)); - } + Encounters[i] = new EncounterSet(br.ReadBytes(4)); } } @@ -813,26 +800,22 @@ public class EncounterSet public EncounterSet(byte[] data) { - using (BinaryReader br = new BinaryReader(new MemoryStream(data))) - { - ushort SpecForm = br.ReadUInt16(); - Species = SpecForm & 0x7FF; - Form = SpecForm >> 11; - LevelMin = br.ReadByte(); - LevelMax = br.ReadByte(); - } + using BinaryReader br = new BinaryReader(new MemoryStream(data)); + ushort SpecForm = br.ReadUInt16(); + Species = SpecForm & 0x7FF; + Form = SpecForm >> 11; + LevelMin = br.ReadByte(); + LevelMax = br.ReadByte(); } public byte[] Write() { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - bw.Write((ushort)(Species | (Form << 11))); - bw.Write(LevelMin); - bw.Write(LevelMax); - return ms.ToArray(); - } + using MemoryStream ms = new MemoryStream(); + using BinaryWriter bw = new BinaryWriter(ms); + bw.Write((ushort)(Species | (Form << 11))); + bw.Write(LevelMin); + bw.Write(LevelMax); + return ms.ToArray(); } } } diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs index d2aff7cc93..f0b33ada80 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.Designer.cs @@ -133,7 +133,7 @@ private void InitializeComponent() this.LB_Gifts.Name = "LB_Gifts"; this.LB_Gifts.Size = new System.Drawing.Size(110, 342); this.LB_Gifts.TabIndex = 468; - this.LB_Gifts.SelectedIndexChanged += new System.EventHandler(this.changeIndex); + this.LB_Gifts.SelectedIndexChanged += new System.EventHandler(this.ChangeIndex); // // CB_Species // @@ -142,7 +142,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(136, 21); this.CB_Species.TabIndex = 469; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // CB_HeldItem // diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index 2278b07a95..f92a3c3ca9 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -38,7 +38,7 @@ public GiftEditor6() CB_Nature.Items.AddRange(natureslist.Take(25).ToArray()); RandSettings.GetFormSettings(this, tabPage2.Controls); - loadData(); + LoadData(); } public static Dictionary GetMegaDictionary(GameConfig config) @@ -53,16 +53,16 @@ public static Dictionary GetMegaDictionary(GameConfig config) private readonly int fieldSize = Main.Config.ORAS ? 0x24 : 0x18; private readonly int count = Main.Config.ORAS ? 0x25 : 0x13; private EncounterGift6[] GiftData; - private readonly string[] abilitylist = Main.Config.getText(TextName.AbilityNames); - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); - private readonly string[] natureslist = Main.Config.getText(TextName.Natures); + //private readonly string[] abilitylist = Main.Config.GetText(TextName.AbilityNames); + //private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); + private readonly string[] natureslist = Main.Config.GetText(TextName.Natures); private readonly Dictionary MegaDictionary; private static int[] FinalEvo = Legal.FinalEvolutions_6; - private static int[] Legendary = Legal.Legendary_6; - private static int[] Mythical = Legal.Mythical_6; - + private static readonly int[] Legendary = Legal.Legendary_6; + private static readonly int[] Mythical = Legal.Mythical_6; + private readonly string[] ability = { "Any (1 or 2)", @@ -73,8 +73,8 @@ public static Dictionary GetMegaDictionary(GameConfig config) private void B_Save_Click(object sender, EventArgs e) { - saveEntry(); - saveData(); + SaveEntry(); + SaveData(); RandSettings.SetFormSettings(this, tabPage2.Controls); Close(); } @@ -84,7 +84,7 @@ private void B_Cancel_Click(object sender, EventArgs e) Close(); } - private void loadData() + private void LoadData() { FieldData = File.ReadAllBytes(FieldPath); GiftData = new EncounterGift6[count]; @@ -105,7 +105,7 @@ private void loadData() LB_Gifts.SelectedIndex = 0; } - private void saveData() + private void SaveData() { // Check to see if a starter has been modified right before we write data. bool starters = false; @@ -130,14 +130,13 @@ private void saveData() // Check too see if starters got modified if (Array.IndexOf(entries, i) > - 1 && BitConverter.ToUInt16(FieldData, offset) != GiftData[i].Species) starters = true; - + // Write new data Array.Copy(GiftData[i].Write(), 0, FieldData, offset, fieldSize); } if (starters) // are modified - WinFormsUtil.Alert("Starters have been modified.", - "Be sure to update the Starters in DllPoke3Select.cro by updating via the Starter Editor."); + WinFormsUtil.Alert("Starters have been modified.", "Be sure to update the Starters in DllPoke3Select.cro by updating via the Starter Editor."); File.WriteAllBytes(FieldPath, FieldData); } @@ -145,19 +144,19 @@ private void saveData() private int entry = -1; private bool loaded; - private void changeIndex(object sender, EventArgs e) + private void ChangeIndex(object sender, EventArgs e) { if (LB_Gifts.SelectedIndex < 0) return; if (!loaded) return; - if (entry != -1) - saveEntry(); + if (entry != -1) + SaveEntry(); entry = LB_Gifts.SelectedIndex; - loadEntry(); + LoadEntry(); } - private void loadEntry() + private void LoadEntry() { bool oldloaded = loaded; loaded = false; @@ -184,7 +183,7 @@ private void loadEntry() loaded |= oldloaded; } - private void saveEntry() + private void SaveEntry() { GiftData[entry].Species = (ushort)CB_Species.SelectedIndex; GiftData[entry].HeldItem = CB_HeldItem.SelectedIndex; @@ -229,7 +228,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_L.Checked) FinalEvo = FinalEvo.Concat(Legendary).ToArray(); if (CHK_E.Checked) FinalEvo = FinalEvo.Concat(Mythical).ToArray(); - var helditems = Randomizer.getRandomItemList(); + var helditems = Randomizer.GetRandomItemList(); for (int i = 0; i < LB_Gifts.Items.Count; i++) { LB_Gifts.SelectedIndex = i; @@ -241,13 +240,13 @@ private void B_RandAll_Click(object sender, EventArgs e) continue; // skip Lucario, battle needs to Mega Evolve int[] items = GetRandomMega(out species); - CB_HeldItem.SelectedIndex = items[Util.rand.Next(0, items.Length)]; + CB_HeldItem.SelectedIndex = items[Util.Rand.Next(0, items.Length)]; } else { species = specrand.GetRandomSpecies(species); if (CHK_Item.Checked) - CB_HeldItem.SelectedIndex = helditems[Util.rnd32() % helditems.Length]; + CB_HeldItem.SelectedIndex = helditems[Util.Random32() % helditems.Length]; } if (CHK_AllowMega.Checked) @@ -257,14 +256,14 @@ private void B_RandAll_Click(object sender, EventArgs e) CHK_ShinyLock.Checked = false; if (CHK_Level.Checked) - NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + NUD_Level.Value = Randomizer.GetModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); if (CHK_RandomAbility.Checked) - CB_Ability.SelectedIndex = (Util.rand.Next(1, 4)); // 1, 2 , or H + CB_Ability.SelectedIndex = (Util.Rand.Next(1, 4)); // 1, 2 , or H if (CHK_ForceFullyEvolved.Checked && NUD_Level.Value >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(species)) { - int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); + static int randFinalEvo() => (int)(Util.Random32() % FinalEvo.Length); species = FinalEvo[randFinalEvo()]; } @@ -282,12 +281,12 @@ private void B_RandAll_Click(object sender, EventArgs e) private int[] GetRandomMega(out int species) { - int rnd = Util.rand.Next(0, MegaDictionary.Count - 1); + int rnd = Util.Rand.Next(0, MegaDictionary.Count - 1); species = MegaDictionary.Keys.ElementAt(rnd); return MegaDictionary.Values.ElementAt(rnd); } - private static readonly Dictionary MegaDictionaryXY = new Dictionary + private static readonly Dictionary MegaDictionaryXY = new() { {003, new[] {659}}, // Venusaur @ Venusaurite {006, new[] {660, 678}}, // Charizard @ Charizardite X/Y @@ -319,7 +318,7 @@ private int[] GetRandomMega(out int species) {460, new[] {674}}, // Abomasnow @ Abomasite }; - private static readonly Dictionary MegaDictionaryAO = new Dictionary + private static readonly Dictionary MegaDictionaryAO = new() { {015, new[] {770}}, // Beedrill @ Beedrillite {018, new[] {762}}, // Pidgeot @ Pidgeotite @@ -340,7 +339,7 @@ private int[] GetRandomMega(out int species) {719, new[] {764}}, // Diancie @ Diancite }; - private void changeSpecies(object sender, EventArgs e) + private void ChangeSpecies(object sender, EventArgs e) { int index = LB_Gifts.SelectedIndex; LB_Gifts.Items[index] = index.ToString("00") + " - " + CB_Species.Text; @@ -353,7 +352,7 @@ private void ModifyLevels(object sender, EventArgs e) for (int i = 0; i < LB_Gifts.Items.Count; i++) { LB_Gifts.SelectedIndex = i; - NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + NUD_Level.Value = Randomizer.GetModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); } WinFormsUtil.Alert("Modified all Levels according to specification!"); } diff --git a/pk3DS/Subforms/Gen6/ItemEditor6.cs b/pk3DS/Subforms/Gen6/ItemEditor6.cs index 839b7adb66..dccdd0465f 100644 --- a/pk3DS/Subforms/Gen6/ItemEditor6.cs +++ b/pk3DS/Subforms/Gen6/ItemEditor6.cs @@ -19,8 +19,8 @@ public ItemEditor6(byte[][] infiles) } private readonly byte[][] files; - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); - private readonly string[] itemflavor = Main.Config.getText(TextName.ItemFlavor); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); + private readonly string[] itemflavor = Main.Config.GetText(TextName.ItemFlavor); private void Setup() { @@ -57,7 +57,7 @@ private void IsFormClosing(object sender, FormClosingEventArgs e) SetEntry(); } - private int GetItemMapOffset() + public static int GetItemMapOffset() { if (Main.ExeFSPath == null) { WinFormsUtil.Alert("No exeFS code to load."); return -1; } string[] exefsFiles = Directory.GetFiles(Main.ExeFSPath); @@ -68,8 +68,7 @@ private int GetItemMapOffset() ? new byte[] { 0x92, 0x0A, 0x06, 0x3F, 0x75, 0x02 } // ORAS (vanilla @ 47C640) : new byte[] { 0x92, 0x0A, 0x06, 0x3F, 0x41, 0x02 }; // XY (vanilla @ 43DB74) - int ptr = Util.IndexOfBytes(data, reference, 0x400000, 0) - 2 + reference.Length; - return ptr; + return Util.IndexOfBytes(data, reference, 0x400000, 0) - 2 + reference.Length; } private void B_Table_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs index 3c0a70d40d..7110e25907 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.Designer.cs @@ -79,7 +79,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeEntry); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); // // L_Species // @@ -328,7 +328,7 @@ private void InitializeComponent() this.Name = "LevelUpEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Level Up Move Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs index 2cfd3285a5..10b4a293d4 100644 --- a/pk3DS/Subforms/Gen6/LevelUpEditor6.cs +++ b/pk3DS/Subforms/Gen6/LevelUpEditor6.cs @@ -19,21 +19,20 @@ public LevelUpEditor6(byte[][] infiles) { InitializeComponent(); files = infiles; - string[] species = Main.Config.getText(TextName.SpeciesNames); - string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID); - int[] baseForm, formVal; - string[] specieslist = Main.Config.Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForm, out formVal); + string[] species = Main.Config.GetText(TextName.SpeciesNames); + string[][] AltForms = Main.Config.Personal.GetFormList(species, Main.Config.MaxSpeciesID); + string[] specieslist = Main.Config.Personal.GetPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out _, out _); specieslist[0] = movelist[0] = ""; string[] sortedspecies = (string[])specieslist.Clone(); Array.Resize(ref sortedspecies, Main.Config.MaxSpeciesID); Array.Sort(sortedspecies); - setupDGV(); + SetupDGV(); - var newlist = new List(); + var newlist = new List(); for (int i = 1; i < Main.Config.MaxSpeciesID; i++) // add all species - newlist.Add(new WinFormsUtil.cbItem { Text = sortedspecies[i], Value = Array.IndexOf(specieslist, sortedspecies[i]) }); + newlist.Add(new ComboItem { Text = sortedspecies[i], Value = Array.IndexOf(specieslist, sortedspecies[i]) }); for (int i = Main.Config.MaxSpeciesID; i < specieslist.Length; i++) // add all forms - newlist.Add(new WinFormsUtil.cbItem { Text = specieslist[i], Value = i }); + newlist.Add(new ComboItem { Text = specieslist[i], Value = i }); CB_Species.DisplayMember = "Text"; CB_Species.ValueMember = "Value"; @@ -44,10 +43,10 @@ public LevelUpEditor6(byte[][] infiles) private readonly byte[][] files; private int entry = -1; - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); private bool dumping; - private void setupDGV() + private void SetupDGV() { string[] sortedmoves = (string[])movelist.Clone(); Array.Sort(sortedmoves); @@ -74,11 +73,11 @@ private void setupDGV() private Learnset6 pkm; - private void getList() + private void GetList() { - entry = WinFormsUtil.getIndex(CB_Species); + entry = WinFormsUtil.GetIndex(CB_Species); - int[] specForm = Main.Config.Personal.getSpeciesForm(entry, Main.Config); + int[] specForm = Main.Config.Personal.GetSpeciesForm(entry, Main.Config); string filename = "_" + specForm[0] + (entry > 721 ? "_" + (specForm[1] + 1) : ""); PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename); @@ -99,7 +98,7 @@ private void getList() dgv.CancelEdit(); } - private void setList() + private void SetList() { if (entry < 1 || dumping) return; List moves = new List(); @@ -111,8 +110,7 @@ private void setList() moves.Add((short)move); string level = (dgv.Rows[i].Cells[0].Value ?? 0).ToString(); - short lv; - short.TryParse(level, out lv); + short.TryParse(level, out var lv); if (lv > 100) lv = 100; else if (lv == 0) lv = 1; levels.Add(lv); @@ -122,18 +120,17 @@ private void setList() files[entry] = pkm.Write(); } - private void changeEntry(object sender, EventArgs e) + private void ChangeEntry(object sender, EventArgs e) { - setList(); - getList(); + SetList(); + GetList(); } private void B_RandAll_Click(object sender, EventArgs e) { ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 }; - ushort[] TMs = {}; if (CHK_HMs.Checked && Main.ExeFSPath != null) - TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs); + TMHMEditor6.GetTMHMList(out _, out HMs); List banned = new List {165, 621}; // Struggle, Hyperspace Fury if (!CHK_HMs.Checked) @@ -141,7 +138,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_NoFixedDamage.Checked) banned.AddRange(MoveRandomizer.FixedDamageMoves); - setList(); + SetList(); var sets = files.Select(z => new Learnset6(z)).ToArray(); var rand = new LearnsetRandomizer(Main.Config, sets) { @@ -150,14 +147,14 @@ private void B_RandAll_Click(object sender, EventArgs e) Spread = CHK_Spread.Checked, SpreadTo = (int)NUD_Level.Value, STAB = CHK_STAB.Checked, - rSTABPercent = NUD_STAB.Value, + STABPercent = NUD_STAB.Value, STABFirst = CHK_STAB.Checked, BannedMoves = banned.ToArray(), Learn4Level1 = CHK_4MovesLvl1.Checked, }; rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!"); } @@ -205,9 +202,9 @@ private void B_Dump_Click(object sender, EventArgs e) dumping = false; } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setList(); + SetList(); RandSettings.SetFormSettings(this, groupBox1.Controls); } @@ -217,10 +214,10 @@ private void CHK_TypeBias_CheckedChanged(object sender, EventArgs e) NUD_STAB.Value = CHK_STAB.Checked ? 52 : NUD_STAB.Minimum; } - public void calcStats() // Debug Function + public void CalcStats() // Debug Function { Move[] MoveData = Main.Config.Moves; - + int movectr = 0; int max = 0; int spec = 0; diff --git a/pk3DS/Subforms/Gen6/MaisonEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MaisonEditor6.Designer.cs index a9591c989a..87d0e6a99d 100644 --- a/pk3DS/Subforms/Gen6/MaisonEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MaisonEditor6.Designer.cs @@ -73,7 +73,7 @@ private void InitializeComponent() this.CB_Trainer.Name = "CB_Trainer"; this.CB_Trainer.Size = new System.Drawing.Size(121, 21); this.CB_Trainer.TabIndex = 0; - this.CB_Trainer.SelectedIndexChanged += new System.EventHandler(this.changeTrainer); + this.CB_Trainer.SelectedIndexChanged += new System.EventHandler(this.ChangeTrainer); // // CB_Pokemon // @@ -84,7 +84,7 @@ private void InitializeComponent() this.CB_Pokemon.Name = "CB_Pokemon"; this.CB_Pokemon.Size = new System.Drawing.Size(106, 21); this.CB_Pokemon.TabIndex = 1; - this.CB_Pokemon.SelectedIndexChanged += new System.EventHandler(this.changePokemon); + this.CB_Pokemon.SelectedIndexChanged += new System.EventHandler(this.ChangePokemon); // // L_Trainer // @@ -368,7 +368,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(106, 21); this.CB_Species.TabIndex = 8; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // B_DumpPKs // @@ -409,7 +409,7 @@ private void InitializeComponent() this.Name = "MaisonEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Maison Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); this.GB_Trainer.ResumeLayout(false); this.GB_Trainer.PerformLayout(); this.GB_Pokemon.ResumeLayout(false); diff --git a/pk3DS/Subforms/Gen6/MaisonEditor6.cs b/pk3DS/Subforms/Gen6/MaisonEditor6.cs index 6c7315cd2c..3d45efca0d 100644 --- a/pk3DS/Subforms/Gen6/MaisonEditor6.cs +++ b/pk3DS/Subforms/Gen6/MaisonEditor6.cs @@ -20,7 +20,7 @@ public MaisonEditor6(byte[][] trd, byte[][] trp, bool super) Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); movelist[0] = specieslist[0] = itemlist[0] = ""; - trNames = Main.Config.getText(super ? TextName.SuperTrainerNames : TextName.MaisonTrainerNames); Array.Resize(ref trNames, trFiles.Length); + trNames = Main.Config.GetText(super ? TextName.SuperTrainerNames : TextName.MaisonTrainerNames); Array.Resize(ref trNames, trFiles.Length); InitializeComponent(); Setup(); @@ -29,11 +29,11 @@ public MaisonEditor6(byte[][] trd, byte[][] trp, bool super) private readonly byte[][] trFiles; private readonly string[] trNames; private readonly byte[][] pkFiles; - private readonly string[] natures = Main.Config.getText(TextName.Natures); - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); - private readonly string[] trClass = Main.Config.getText(TextName.TrainerClasses); - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); + private readonly string[] natures = Main.Config.GetText(TextName.Natures); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); + private readonly string[] trClass = Main.Config.GetText(TextName.TrainerClasses); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); private int trEntry = -1; private int pkEntry = -1; private bool dumping; @@ -54,23 +54,23 @@ private void Setup() CB_Trainer.SelectedIndex = 1; } - private void changeTrainer(object sender, EventArgs e) + private void ChangeTrainer(object sender, EventArgs e) { - setTrainer(); + SetTrainer(); trEntry = CB_Trainer.SelectedIndex; - getTrainer(); + GetTrainer(); if (GB_Trainer.Enabled) LB_Choices.SelectedIndex = 0; } - private void changePokemon(object sender, EventArgs e) + private void ChangePokemon(object sender, EventArgs e) { - setPokemon(); + SetPokemon(); pkEntry = CB_Pokemon.SelectedIndex; - getPokemon(); + GetPokemon(); } - private void getTrainer() + private void GetTrainer() { if (trEntry < 0) return; @@ -85,7 +85,7 @@ private void getTrainer() LB_Choices.Items.Add(Entry.ToString()); } - private void setTrainer() + private void SetTrainer() { if (trEntry < 0 || !GB_Trainer.Enabled || dumping) return; // Gather @@ -101,7 +101,7 @@ private void setTrainer() trFiles[trEntry] = tr.Write(); } - private void getPokemon() + private void GetPokemon() { if (pkEntry < 0 || dumping) return; Maison6.Pokemon pkm = new Maison6.Pokemon(pkFiles[pkEntry]); @@ -124,7 +124,7 @@ private void getPokemon() // Last 2 Bytes are unused. } - private void setPokemon() + private void SetPokemon() { if (pkEntry < 0 || dumping) return; @@ -153,9 +153,9 @@ private void setPokemon() pkFiles[pkEntry] = data; } - private void changeSpecies(object sender, EventArgs e) + private void ChangeSpecies(object sender, EventArgs e) { - PB_PKM.Image = WinFormsUtil.getSprite(CB_Species.SelectedIndex, 0, 0, CB_Item.SelectedIndex, Main.Config); + PB_PKM.Image = WinFormsUtil.GetSprite(CB_Species.SelectedIndex, 0, 0, CB_Item.SelectedIndex, Main.Config); } private void B_Remove_Click(object sender, EventArgs e) @@ -195,10 +195,10 @@ private void B_View_Click(object sender, EventArgs e) CB_Pokemon.SelectedIndex = Convert.ToUInt16(LB_Choices.Items[LB_Choices.SelectedIndex].ToString()); } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setTrainer(); - setPokemon(); + SetTrainer(); + SetPokemon(); } private void DumpTRs_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs index 0600b33079..469f2e4dd5 100644 --- a/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MartEditor6.Designer.cs @@ -48,7 +48,7 @@ private void InitializeComponent() this.CB_Location.Name = "CB_Location"; this.CB_Location.Size = new System.Drawing.Size(243, 21); this.CB_Location.TabIndex = 0; - this.CB_Location.SelectedIndexChanged += new System.EventHandler(this.changeIndex); + this.CB_Location.SelectedIndexChanged += new System.EventHandler(this.ChangeIndex); // // dgv // diff --git a/pk3DS/Subforms/Gen6/MartEditor6.cs b/pk3DS/Subforms/Gen6/MartEditor6.cs index 4bebadf1d5..347c7300c4 100644 --- a/pk3DS/Subforms/Gen6/MartEditor6.cs +++ b/pk3DS/Subforms/Gen6/MartEditor6.cs @@ -18,7 +18,7 @@ public MartEditor6() offset = GetDataOffset(data); codebin = files[0]; itemlist[0] = ""; - setupDGV(); + SetupDGV(); foreach (string s in locations) CB_Location.Items.Add(s); CB_Location.SelectedIndex = 0; } @@ -48,7 +48,7 @@ private static int GetDataOffset(byte[] data) } private readonly string codebin; - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); private readonly byte[] data; private readonly byte[] entries = Main.Config.ORAS @@ -79,7 +79,7 @@ private static int GetDataOffset(byte[] data) private readonly int offset; private int dataoffset; - readonly string[] locations = Main.Config.ORAS + private readonly string[] locations = Main.Config.ORAS ? new[] // ORAS { "No Gym Badges [After Pokédex]", "1 Gym Badge", "2 Gym Badges", "3 Gym Badges", "4 Gym Badges", "5 Gym Badges", "6 Gym Badges", "7 Gym Badges", "8 Gym Badges", @@ -104,14 +104,14 @@ private static int GetDataOffset(byte[] data) "Coumarine City [Poké Balls]" }; - private void getDataOffset(int index) + private void GetDataOffset(int index) { dataoffset = offset; // reset for (int i = 0; i < index; i++) dataoffset += 2 * entries[i]; } - private void setupDGV() + private void SetupDGV() { DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); { @@ -136,19 +136,19 @@ private void setupDGV() private int entry = -1; - private void changeIndex(object sender, EventArgs e) + private void ChangeIndex(object sender, EventArgs e) { - if (entry > -1) setList(); + if (entry > -1) SetList(); entry = CB_Location.SelectedIndex; - getList(); + GetList(); } - private void getList() + private void GetList() { dgv.Rows.Clear(); int count = entries[entry]; dgv.Rows.Add(count); - getDataOffset(entry); + GetDataOffset(entry); for (int i = 0; i < count; i++) { dgv.Rows[i].Cells[0].Value = i.ToString(); @@ -156,7 +156,7 @@ private void getList() } } - private void setList() + private void SetList() { int count = dgv.Rows.Count; for (int i = 0; i < count; i++) @@ -165,7 +165,7 @@ private void setList() private void B_Save_Click(object sender, EventArgs e) { - if (entry > -1) setList(); + if (entry > -1) SetList(); File.WriteAllBytes(codebin, data); Close(); } @@ -180,7 +180,7 @@ private void B_Randomize_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize mart inventories?")) return; - int[] validItems = Randomizer.getRandomItemList(); + int[] validItems = Randomizer.GetRandomItemList(); int ctr = 0; Util.Shuffle(validItems); diff --git a/pk3DS/Subforms/Gen6/MegaEvoEditor6.Designer.cs b/pk3DS/Subforms/Gen6/MegaEvoEditor6.Designer.cs index b42bd2bfc8..5bfef011d6 100644 --- a/pk3DS/Subforms/Gen6/MegaEvoEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/MegaEvoEditor6.Designer.cs @@ -273,7 +273,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(181, 21); this.CB_Species.TabIndex = 15; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeIndex); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeIndex); // // GB_MEvo3 // @@ -411,7 +411,7 @@ private void InitializeComponent() this.MinimumSize = new System.Drawing.Size(430, 250); this.Name = "MegaEvoEditor6"; this.Text = "Mega Evo Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); this.GB_MEvo1.ResumeLayout(false); this.GB_MEvo1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_M1)).EndInit(); diff --git a/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs b/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs index eda5dca7b7..fe14743627 100644 --- a/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs +++ b/pk3DS/Subforms/Gen6/MegaEvoEditor6.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Media; using System.Text; using System.Windows.Forms; @@ -14,10 +13,10 @@ namespace pk3DS public partial class MegaEvoEditor6 : Form { private readonly byte[][] files; - private readonly string[] forms = Main.Config.getText(TextName.Forms); - private readonly string[] types = Main.Config.getText(TextName.Types); - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); + //private readonly string[] forms = Main.Config.GetText(TextName.Forms); + //private readonly string[] types = Main.Config.GetText(TextName.Types); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); private readonly GroupBox[] groupbox_spec; private readonly ComboBox[] forme_spec; private readonly ComboBox[] item_spec; @@ -40,7 +39,7 @@ public MegaEvoEditor6(byte[][] infiles) // All the initial settings Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); specieslist[0] = itemlist[0] = ""; specieslist[32] += "♂"; specieslist[29] += "♀"; - AltForms = Main.Config.Personal.getFormList(specieslist, Main.Config.MaxSpeciesID); + AltForms = Main.Config.Personal.GetFormList(specieslist, Main.Config.MaxSpeciesID); groupbox_spec = new[] { GB_MEvo1, GB_MEvo2, GB_MEvo3 }; item_spec = new[] { CB_Item1, CB_Item2, CB_Item3 }; @@ -57,20 +56,20 @@ private void Setup() List temp_list = new List(specieslist); temp_list.Sort(); - CB_Species.DataSource = temp_list.Select(mon => new WinFormsUtil.cbItem { Text = mon, Value = Array.IndexOf(specieslist, mon) }).ToList(); + CB_Species.DataSource = temp_list.ConvertAll(mon => new ComboItem { Text = mon, Value = Array.IndexOf(specieslist, mon) }); List items = new List(itemlist); List sorted_items = new List(itemlist); - List[] item_lists = new List[item_spec.Length]; + List[] item_lists = new List[item_spec.Length]; for (int i = 0; i < item_lists.Length; i++) - item_lists[i] = new List(); + item_lists[i] = new List(); sorted_items.Sort(); for (int i = 0; i < items.Count; i++) { int index = items.IndexOf(sorted_items[i]); { - var ncbi = new WinFormsUtil.cbItem(); + var ncbi = new ComboItem(); if (sorted_items[i] == "???") continue; // Don't allow stubbed items. ncbi.Text = sorted_items[i] + " - " + index.ToString("000"); ncbi.Value = index; @@ -99,14 +98,14 @@ private void CHK_Changed(object sender, EventArgs e) } } - private void changeIndex(object sender, EventArgs e) + private void ChangeIndex(object sender, EventArgs e) { - setEntry(); + SetEntry(); entry = (int)CB_Species.SelectedValue; - getEntry(); + GetEntry(); } - private void getEntry() + private void GetEntry() { if (!loaded) return; if (Main.Config.ORAS && entry == 384 && !dumping) // Current Mon is Rayquaza @@ -115,7 +114,7 @@ private void getEntry() byte[] data = files[entry]; foreach (ComboBox CB in forme_spec) - FormUtil.setForms(entry, CB, AltForms); + FormUtil.SetForms(entry, CB, AltForms); me = new MegaEvolutions(data); for (int i = 0; i < 3; i++) @@ -126,15 +125,15 @@ private void getEntry() } } - private void setEntry() + private void SetEntry() { if (entry < 1 || entry == 384) return; // Don't edit invalid / Rayquaza. for (int i = 0; i < 3; i++) { - if (me.Method[i] > 1) + if (me.Method[i] > 1) return; // Shouldn't hit this. - me.Method[i] = (ushort)(checkbox_spec[i].Checked ? 1 : 0); - me.Argument[i] = (ushort)WinFormsUtil.getIndex(item_spec[i]); + me.Method[i] = checkbox_spec[i].Checked ? 1 : 0; + me.Argument[i] = (ushort)WinFormsUtil.GetIndex(item_spec[i]); me.Form[i] = (ushort)forme_spec[i].SelectedIndex; } files[entry] = me.Write(); @@ -148,13 +147,13 @@ private void Update_PBs(object sender, EventArgs e) CheckBox CB = checkbox_spec[i]; if (CB.Checked) { - UpdateImage(picturebox_spec[0][i], entry, 0, WinFormsUtil.getIndex(item_spec[i]), 0); - UpdateImage(picturebox_spec[1][i], entry, forme_spec[i].SelectedIndex, WinFormsUtil.getIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[0][i], entry, 0, WinFormsUtil.GetIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[1][i], entry, forme_spec[i].SelectedIndex, WinFormsUtil.GetIndex(item_spec[i]), 0); } else { - UpdateImage(picturebox_spec[0][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0); - UpdateImage(picturebox_spec[1][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[0][i], 0, 0, WinFormsUtil.GetIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[1][i], 0, 0, WinFormsUtil.GetIndex(item_spec[i]), 0); } } } @@ -165,29 +164,29 @@ private void Update_PBs(int i) CheckBox CB = checkbox_spec[i]; if (CB.Checked) { - UpdateImage(picturebox_spec[0][i], entry, 0, WinFormsUtil.getIndex(item_spec[i]), 0); - UpdateImage(picturebox_spec[1][i], entry, forme_spec[i].SelectedIndex, WinFormsUtil.getIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[0][i], entry, 0, WinFormsUtil.GetIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[1][i], entry, forme_spec[i].SelectedIndex, WinFormsUtil.GetIndex(item_spec[i]), 0); } else { - UpdateImage(picturebox_spec[0][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0); - UpdateImage(picturebox_spec[1][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[0][i], 0, 0, WinFormsUtil.GetIndex(item_spec[i]), 0); + UpdateImage(picturebox_spec[1][i], 0, 0, WinFormsUtil.GetIndex(item_spec[i]), 0); } } - - private void UpdateImage(PictureBox pb, int species, int form, int item, int gender) + + private static void UpdateImage(PictureBox pb, int species, int form, int item, int gender) { if (!pb.Enabled) { pb.Image = null; return; } - pb.Image = WinFormsUtil.getSprite(species, form, gender, item, Main.Config); + pb.Image = WinFormsUtil.GetSprite(species, form, gender, item, Main.Config); } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setEntry(); + SetEntry(); } private void B_Dump_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/MoveEditor6.cs b/pk3DS/Subforms/Gen6/MoveEditor6.cs index 98e3cd3720..cfc7047704 100644 --- a/pk3DS/Subforms/Gen6/MoveEditor6.cs +++ b/pk3DS/Subforms/Gen6/MoveEditor6.cs @@ -19,9 +19,9 @@ public MoveEditor6(byte[][] infiles) } private readonly byte[][] files; - private readonly string[] types = Main.Config.getText(TextName.Types); - private readonly string[] moveflavor = Main.Config.getText(TextName.MoveFlavor); - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); + private readonly string[] types = Main.Config.GetText(TextName.Types); + private readonly string[] moveflavor = Main.Config.GetText(TextName.MoveFlavor); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); private readonly string[] MoveCategories = { "Status", "Physical", "Special", }; private readonly string[] StatCategories = { "None", "Attack", "Defense", "Special Attack", "Special Defense", "Speed", "Accuracy", "Evasion", "All", }; @@ -185,7 +185,7 @@ private void B_RandAll_Click(object sender, EventArgs e) } if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Moves? Cannot undo.", "Double check options on the right before continuing.") != DialogResult.Yes) return; - Random rnd = Util.rand; + Random rnd = Util.Rand; for (int i = 0; i < CB_Move.Items.Count; i++) { CB_Move.SelectedIndex = i; // Get new Move diff --git a/pk3DS/Subforms/Gen6/OPower.Designer.cs b/pk3DS/Subforms/Gen6/OPower.Designer.cs index c389c2baf7..50cab3c6f2 100644 --- a/pk3DS/Subforms/Gen6/OPower.Designer.cs +++ b/pk3DS/Subforms/Gen6/OPower.Designer.cs @@ -149,7 +149,7 @@ private void InitializeComponent() this.CB_Item.Name = "CB_Item"; this.CB_Item.Size = new System.Drawing.Size(45, 21); this.CB_Item.TabIndex = 46; - this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.changeEntry); + this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); // // NUD_Duration // @@ -350,7 +350,7 @@ private void InitializeComponent() this.Name = "OPower"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "O-Power Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.NUD_PlayerCost)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_OtherCost)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Stage)).EndInit(); diff --git a/pk3DS/Subforms/Gen6/OPower.cs b/pk3DS/Subforms/Gen6/OPower.cs index 6b7d9e49f2..f1490d7d38 100644 --- a/pk3DS/Subforms/Gen6/OPower.cs +++ b/pk3DS/Subforms/Gen6/OPower.cs @@ -37,18 +37,18 @@ public OPower() private readonly int offset; private readonly byte[] exefsData; private readonly byte[][] powerData = new byte[65][]; - private readonly string[] powerFlavor = Main.Config.getText(TextName.OPowerFlavor); + private readonly string[] powerFlavor = Main.Config.GetText(TextName.OPowerFlavor); private int entry = -1; - private void changeEntry(object sender, EventArgs e) + private void ChangeEntry(object sender, EventArgs e) { - setEntry(); + SetEntry(); entry = CB_Item.SelectedIndex + 1; - getEntry(); + GetEntry(); } - private void getEntry() + private void GetEntry() { if (entry < 1) return; @@ -89,7 +89,7 @@ private void getEntry() NUD_2.Value = _02; } - private void setEntry() + private void SetEntry() { if (entry < 1) return; @@ -114,9 +114,9 @@ private void setEntry() powerData[entry][1] = usability; } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setEntry(); + SetEntry(); // Copy data back to storage for (int i = 0; i < powerData.Length; i++) Array.Copy(powerData[i], 0, exefsData, offset + (i * powerData[i].Length), powerData[i].Length); diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs index c4c81e9eab..4adb47c7ec 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.Designer.cs @@ -1585,7 +1585,7 @@ private void InitializeComponent() this.Name = "PersonalEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Personal Stats Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); this.TC_Pokemon.ResumeLayout(false); this.TP_General.ResumeLayout(false); this.TP_General.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/PersonalEditor6.cs b/pk3DS/Subforms/Gen6/PersonalEditor6.cs index 03e943616c..50d66c6234 100644 --- a/pk3DS/Subforms/Gen6/PersonalEditor6.cs +++ b/pk3DS/Subforms/Gen6/PersonalEditor6.cs @@ -26,16 +26,16 @@ public PersonalEditor6(byte[][] infiles) rstat_boxes = new[] { CHK_rHP, CHK_rATK, CHK_rDEF, CHK_rSPA, CHK_rSPD, CHK_rSPE }; files = infiles; - abilities = Main.Config.getText(TextName.AbilityNames); - moves = Main.Config.getText(TextName.MoveNames); - items = Main.Config.getText(TextName.ItemNames); - species = Main.Config.getText(TextName.SpeciesNames); - types = Main.Config.getText(TextName.Types); + abilities = Main.Config.GetText(TextName.AbilityNames); + moves = Main.Config.GetText(TextName.MoveNames); + items = Main.Config.GetText(TextName.ItemNames); + species = Main.Config.GetText(TextName.SpeciesNames); + types = Main.Config.GetText(TextName.Types); species[0] = "---"; abilities[0] = items[0] = moves[0] = ""; - string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID); - species = Main.Config.Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal); - TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs); + string[][] AltForms = Main.Config.Personal.GetFormList(species, Main.Config.MaxSpeciesID); + species = Main.Config.Personal.GetPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal); + TMHMEditor6.GetTMHMList(out TMs, out HMs); Setup(); //Turn string resources into arrays CB_Species.SelectedIndex = 1; @@ -45,10 +45,10 @@ public PersonalEditor6(byte[][] infiles) private readonly string mode = Main.Config.ORAS ? "ORAS" : "XY"; private readonly byte[][] files; - private string[] items = { }; - private string[] moves = { }; - private string[] species = { }; - private readonly string[] abilities = { }; + private string[] items = Array.Empty(); + private string[] moves = Array.Empty(); + private string[] species = Array.Empty(); + private readonly string[] abilities = Array.Empty(); private readonly ComboBox[] helditem_boxes; private readonly ComboBox[] ability_boxes; @@ -59,7 +59,7 @@ public PersonalEditor6(byte[][] infiles) private readonly MaskedTextBox[] ev_boxes; private readonly CheckBox[] rstat_boxes; - private readonly string[] types = { }; + private readonly string[] types = Array.Empty(); private readonly string[] eggGroups = { "---", "Monster", "Water 1", "Bug", "Flying", "Field", "Fairy", "Grass", "Human-Like", "Water 3", "Mineral", "Amorphous", "Water 2", "Ditto", "Dragon", "Undiscovered" }; private readonly string[] EXPGroups = { "Medium-Fast", "Erratic", "Fluctuating", "Medium-Slow", "Fast", "Slow" }; @@ -80,7 +80,7 @@ public PersonalEditor6(byte[][] infiles) private readonly int[] baseForms, formVal; private readonly ushort[] TMs, HMs; - int entry = -1; + private int entry = -1; #endregion private void Setup() { @@ -135,28 +135,36 @@ private void Setup() foreach (ushort tm in tutor4) CLB_ORASTutors.Items.Add(moves[tm]); - CLB_ORASTutors.Visible = - CLB_ORASTutors.Enabled = + CLB_ORASTutors.Visible = + CLB_ORASTutors.Enabled = L_ORASTutors.Visible = true; } for (int i = 0; i < species.Length; i++) CB_Species.Items.Add($"{species[i]} - {i:000}"); foreach (ComboBox cb in helditem_boxes) + { foreach (string it in items) cb.Items.Add(it); + } foreach (ComboBox cb in ability_boxes) + { foreach (string ab in abilities) cb.Items.Add(ab); + } foreach (ComboBox cb in typing_boxes) + { foreach (string ty in types) cb.Items.Add(ty); + } foreach (ComboBox cb in eggGroup_boxes) + { foreach (string eg in eggGroups) cb.Items.Add(eg); + } foreach (string co in colors) CB_Color.Items.Add(co); @@ -167,14 +175,14 @@ private void Setup() private void CB_Species_SelectedIndexChanged(object sender, EventArgs e) { - if (entry > -1 && !dumping) saveEntry(); + if (entry > -1 && !dumping) SaveEntry(); entry = CB_Species.SelectedIndex; - readEntry(); + ReadEntry(); } private void ByteLimiter(object sender, EventArgs e) { - if (!(sender is MaskedTextBox mtb)) + if (sender is not MaskedTextBox mtb) return; int.TryParse(mtb.Text, out int val); if (Array.IndexOf(byte_boxes, mtb) > -1 && val > 255) @@ -185,7 +193,7 @@ private void ByteLimiter(object sender, EventArgs e) private PersonalInfo pkm; - private void readInfo() + private void ReadInfo() { pkm = Main.SpeciesStat[entry]; @@ -201,7 +209,7 @@ private void readInfo() TB_SPEEVs.Text = pkm.EV_SPE.ToString("0"); TB_SPAEVs.Text = pkm.EV_SPA.ToString("0"); TB_SPDEVs.Text = pkm.EV_SPD.ToString("0"); - + CB_Type1.SelectedIndex = pkm.Types[0]; CB_Type2.SelectedIndex = pkm.Types[1]; @@ -248,21 +256,23 @@ private void readInfo() int[] len = { tutor1.Length, tutor2.Length, tutor3.Length, tutor4.Length }; int ctr = 0; for (int i = 0; i < len.Length; i++) + { for (int b = 0; b < len[i]; b++) CLB_ORASTutors.SetItemChecked(ctr++, pkm.SpecialTutors[i][b]); + } } } - private void readEntry() + private void ReadEntry() { - readInfo(); - + ReadInfo(); + if (dumping) return; int s = baseForms[entry]; int f = formVal[entry]; if (entry <= Main.Config.MaxSpeciesID) s = entry; - Bitmap rawImg = WinFormsUtil.getSprite(s, f, 0, 0, Main.Config); + Bitmap rawImg = WinFormsUtil.GetSprite(s, f, 0, 0, Main.Config); Bitmap bigImg = new Bitmap(rawImg.Width * 2, rawImg.Height * 2); for (int x = 0; x < rawImg.Width; x++) { @@ -278,7 +288,7 @@ private void readEntry() PB_MonSprite.Image = bigImg; } - private void savePersonal() + private void SavePersonal() { pkm.HP = Convert.ToByte(TB_BaseHP.Text); pkm.ATK = Convert.ToByte(TB_BaseATK.Text); @@ -312,11 +322,11 @@ private void savePersonal() pkm.Color = (byte)(Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0)); pkm.BaseEXP = Convert.ToUInt16(TB_BaseExp.Text); - decimal h; decimal.TryParse(TB_Height.Text, out h); - decimal w; decimal.TryParse(TB_Weight.Text, out w); + decimal.TryParse(TB_Height.Text, out var h); + decimal.TryParse(TB_Weight.Text, out var w); pkm.Height = (int)(h * 100); pkm.Weight = (int)(w * 10); - + for (int i = 0; i < CLB_TMHM.Items.Count; i++) pkm.TMHM[i] = CLB_TMHM.GetItemChecked(i); @@ -328,13 +338,15 @@ private void savePersonal() int[] len = {tutor1.Length, tutor2.Length, tutor3.Length, tutor4.Length}; int ctr = 0; for (int i = 0; i < 4; i++) + { for (int t = 0; t < len[i]; t++) pkm.SpecialTutors[i][t] = CLB_ORASTutors.GetItemChecked(ctr++); + } } - private void saveEntry() + private void SaveEntry() { - savePersonal(); + SavePersonal(); byte[] edits = pkm.Write(); files[entry] = edits; } @@ -342,7 +354,7 @@ private void saveEntry() private void B_Randomize_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Enhancements tab.") != DialogResult.Yes) return; - saveEntry(); + SaveEntry(); // input settings var rnd = new PersonalRandomizer(Main.SpeciesStat, Main.Config) @@ -369,7 +381,7 @@ private void B_Randomize_Click(object sender, EventArgs e) rnd.Execute(); Main.SpeciesStat.Select(z => z.Write()).ToArray().CopyTo(files, 0); - readEntry(); + ReadEntry(); WinFormsUtil.Alert("Randomized all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); } @@ -382,8 +394,11 @@ private void B_ModifyAll(object sender, EventArgs e) CB_Species.SelectedIndex = i; // Get new Species if (CHK_NoEV.Checked) + { for (int z = 0; z < 6; z++) ev_boxes[z].Text = 0.ToString(); + } + if (CHK_Growth.Checked) CB_EXPGroup.SelectedIndex = 5; if (CHK_EXP.Checked) @@ -401,15 +416,22 @@ private void B_ModifyAll(object sender, EventArgs e) } if (CHK_FullTMCompatibility.Checked) + { for (int t = 0; t < 100; t++) CLB_TMHM.SetItemCheckState(t, CheckState.Checked); + } + if (CHK_FullHMCompatibility.Checked) + { for (int h = 100; h < CLB_TMHM.Items.Count; h++) CLB_TMHM.SetItemCheckState(h, CheckState.Checked); + } + if (CHK_FullMoveTutorCompatibility.Checked) + { for (int m = 0; m < CLB_MoveTutors.Items.Count; m++) CLB_MoveTutors.SetItemCheckState(m, CheckState.Checked); - + } if (CHK_QuickHatch.Checked) TB_HatchCycles.Text = 1.ToString(); @@ -442,8 +464,8 @@ private void B_Dump_Click(object sender, EventArgs e) lines.Add($"Base Stats: {TB_BaseHP.Text}.{TB_BaseATK.Text}.{TB_BaseDEF.Text}.{TB_BaseSPA.Text}.{TB_BaseSPD.Text}.{TB_BaseSPE.Text} (BST: {pkm.BST})"); lines.Add($"EV Yield: {TB_HPEVs.Text}.{TB_ATKEVs.Text}.{TB_DEFEVs.Text}.{TB_SPAEVs.Text}.{TB_SPDEVs.Text}.{TB_SPEEVs.Text}"); lines.Add($"Abilities: {CB_Ability1.Text} (1) | {CB_Ability2.Text} (2) | {CB_Ability3.Text} (H)"); - lines.Add(string.Format(CB_Type1.SelectedIndex != CB_Type2.SelectedIndex - ? "Type: {0} / {1}" + lines.Add(string.Format(CB_Type1.SelectedIndex != CB_Type2.SelectedIndex + ? "Type: {0} / {1}" : "Type: {0}", CB_Type1.Text, CB_Type2.Text)); lines.Add($"Item 1 (50%): {CB_HeldItem1.Text}"); @@ -475,9 +497,9 @@ private void CHK_Ability_CheckedChanged(object sender, EventArgs e) CHK_WGuard.Checked = false; } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - if (entry > -1) saveEntry(); + if (entry > -1) SaveEntry(); RandSettings.SetFormSettings(this, TP_Randomizer.Controls); } } diff --git a/pk3DS/Subforms/Gen6/PickupEditor6.cs b/pk3DS/Subforms/Gen6/PickupEditor6.cs index a220b8a8ca..877f241e1b 100644 --- a/pk3DS/Subforms/Gen6/PickupEditor6.cs +++ b/pk3DS/Subforms/Gen6/PickupEditor6.cs @@ -19,22 +19,22 @@ public PickupEditor6() offset = Util.IndexOfBytes(data, new byte[] { 0x1E, 0x28, 0x32, 0x3C, 0x46, 0x50, 0x5A, 0x5E, 0x62, 0x05, 0x0A, 0x0F, 0x14, 0x19, 0x1E, 0x23, 0x28, 0x2D, 0x32 }, 0x400000, 0) - 0x3A; codebin = files[0]; itemlist[0] = ""; - setupDGV(); - getList(); + SetupDGV(); + GetList(); } private readonly string codebin; - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); private readonly int offset = Main.Config.ORAS ? 0x004872FC : 0x004455A8; private readonly byte[] data; private int dataoffset; - private void getDataOffset() + private void GetDataOffset() { dataoffset = offset; // reset } - private void setupDGV() + private void SetupDGV() { dgvCommon.Columns.Clear(); dgvRare.Columns.Clear(); DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); @@ -61,16 +61,16 @@ private void setupDGV() dgvRare.Columns.Add((DataGridViewColumn)dgvMove.Clone()); } - private List common = new List(); - private List rare = new List(); + private List common = new(); + private List rare = new(); - private void getList() + private void GetList() { common = new List(); rare = new List(); dgvCommon.Rows.Clear(); - getDataOffset(); + GetDataOffset(); for (int i = 0; i < 0x12; i++) // 0x12 Common common.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); for (int i = 0x12; i < 0x12 + 0xB; i++) // 0xB Rare @@ -84,7 +84,7 @@ private void getList() { dgvRare.Rows.Add(); dgvRare.Rows[i].Cells[0].Value = i.ToString(); dgvRare.Rows[i].Cells[1].Value = itemlist[rlist[i]]; } } - private void setList() + private void SetList() { common = new List(); rare = new List(); @@ -105,7 +105,7 @@ private void setList() private void B_Save_Click(object sender, EventArgs e) { - setList(); + SetList(); File.WriteAllBytes(codebin, data); Close(); } @@ -120,7 +120,7 @@ private void B_Randomize_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize pickup lists?")) return; - int[] validItems = Randomizer.getRandomItemList(); + int[] validItems = Randomizer.GetRandomItemList(); int ctr = 0; Util.Shuffle(validItems); diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index 719bf713ae..4cdee3554f 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -15,11 +15,11 @@ namespace pk3DS { public partial class RSTE : Form { - private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); + private readonly LearnsetRandomizer learn = new(Main.Config, Main.Config.Learnsets); - public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) + public RSTE(byte[][] trd, byte[][] trp) { - trclass = trc; + //trclass = trc; trdata = trd; trpoke = trp; Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); @@ -42,11 +42,13 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) trpk_form = new[] { CB_Pokemon_1_Form, CB_Pokemon_2_Form, CB_Pokemon_3_Form, CB_Pokemon_4_Form, CB_Pokemon_5_Form, CB_Pokemon_6_Form, }; trpk_gender = new[] { CB_Pokemon_1_Gender, CB_Pokemon_2_Gender, CB_Pokemon_3_Gender, CB_Pokemon_4_Gender, CB_Pokemon_5_Gender, CB_Pokemon_6_Gender, }; #endregion + string[] species = Main.Config.GetText(TextName.SpeciesNames); + AltForms = Main.Config.Personal.GetFormList(species, Main.Config.MaxSpeciesID); Setup(); } - private string[][] AltForms; - internal static uint Rand() => Util.rnd32(); + private readonly string[][] AltForms; + internal static uint Rand() => Util.Random32(); private bool start = true; private bool loading = true; private int index = -1; @@ -63,18 +65,18 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp) private PictureBox[] pba; // Top Level Functions - private readonly byte[][] trclass; + //private readonly byte[][] trclass; private readonly byte[][] trdata; private readonly byte[][] trpoke; - private readonly string[] abilitylist = Main.Config.getText(TextName.AbilityNames); - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); - private readonly string[] types = Main.Config.getText(TextName.Types); - private readonly string[] forms = Main.Config.getText(TextName.Forms); - private string[] trName = Main.Config.getText(TextName.TrainerNames); - private readonly string[] trClass = Main.Config.getText(TextName.TrainerClasses); - private readonly string[] trText = Main.Config.getText(TextName.TrainerText); + private readonly string[] abilitylist = Main.Config.GetText(TextName.AbilityNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); + private readonly string[] types = Main.Config.GetText(TextName.Types); + //private readonly string[] forms = Main.Config.GetText(TextName.Forms); + private string[] trName = Main.Config.GetText(TextName.TrainerNames); + private readonly string[] trClass = Main.Config.GetText(TextName.TrainerClasses); + //private readonly string[] trText = Main.Config.GetText(TextName.TrainerText); #endregion // Ability Loading @@ -87,7 +89,7 @@ private void RefreshFormAbility(object sender, EventArgs e) private void RefreshSpeciesAbility(object sender, EventArgs e) { int i = Array.IndexOf(trpk_pkm, sender as ComboBox); - FormUtil.setForms(trpk_pkm[i].SelectedIndex, trpk_form[i], AltForms); + FormUtil.SetForms(trpk_pkm[i].SelectedIndex, trpk_form[i], AltForms); RefreshPKMSlotAbility(i); } @@ -98,7 +100,7 @@ private void RefreshPKMSlotAbility(int slot) int species = trpk_pkm[slot].SelectedIndex; int formnum = trpk_form[slot].SelectedIndex; - int entry = Main.Config.Personal.getFormeIndex(species, formnum); + int entry = Main.Config.Personal.GetFormIndex(species, formnum); trpk_abil[slot].Items.Clear(); trpk_abil[slot].Items.Add("Any (1 or 2)"); @@ -216,7 +218,7 @@ private void B_Dump_Click(object sender, EventArgs e) } // Change Read/Write - private trdata6 tr; + private TrainerData6 tr; private void ChangeTrainerIndex(object sender, EventArgs e) { @@ -235,7 +237,7 @@ private void ReadFile() tabControl1.Enabled = true; byte[] trd = trdata[index]; byte[] trp = trpoke[index]; - tr = new trdata6(trd, trp, Main.Config.ORAS); + tr = new TrainerData6(trd, trp, Main.Config.ORAS); // Load Trainer Data CB_Trainer_Class.SelectedIndex = tr.Class; @@ -258,7 +260,7 @@ private void ReadFile() trpk_IV[i].SelectedIndex = tr.Team[i].IVs; trpk_lvl[i].SelectedIndex = tr.Team[i].Level; trpk_pkm[i].SelectedIndex = tr.Team[i].Species; - FormUtil.setForms(tr.Team[i].Species, trpk_form[i], AltForms); + FormUtil.SetForms(tr.Team[i].Species, trpk_form[i], AltForms); trpk_form[i].SelectedIndex = tr.Team[i].Form % trpk_form[i].Items.Count; // stupid X/Y buggy edge cases (220 / 222) RefreshPKMSlotAbility(i); // Repopulate Abilities @@ -305,8 +307,7 @@ private void WriteFile() Array.Resize(ref tr.Team, tr.NumPokemon); for (int i = 0; i < tr.NumPokemon; i++) { - if (tr.Team[i] == null) - tr.Team[i] = new trdata6.Pokemon(new byte[100], false, false); // Initialize with zeroes + tr.Team[i] ??= new TrainerData6.Pokemon(new byte[100], false, false); tr.Team[i].IVs = (byte)trpk_IV[i].SelectedIndex; tr.Team[i].Ability = trpk_abil[i].SelectedIndex; tr.Team[i].Gender = trpk_gender[i].SelectedIndex; @@ -338,22 +339,20 @@ private void ShowTeams(int i) { if (tr == null) return; if (i >= tr.Team.Length) { pba[i].Image = null; return; } - Bitmap rawImg = WinFormsUtil.getSprite(tr.Team[i].Species, tr.Team[i].Form, tr.Team[i].Gender, tr.Team[i].Item, Main.Config); - pba[i].Image = WinFormsUtil.scaleImage(rawImg, 2); + Bitmap rawImg = WinFormsUtil.GetSprite(tr.Team[i].Species, tr.Team[i].Form, tr.Team[i].Gender, tr.Team[i].Item, Main.Config); + pba[i].Image = WinFormsUtil.ScaleImage(rawImg, 2); } - private void ShowText() - { - if (index * 2 >= trText.Length) return; - TB_Text1.Text = trText[index * 2]; - TB_Text2.Text = trText[(index * 2) + 1]; - } + //private void ShowText() + //{ + // if (index * 2 >= trText.Length) return; + // TB_Text1.Text = trText[index * 2]; + // TB_Text2.Text = trText[(index * 2) + 1]; + //} private void Setup() { start = true; - string[] species = Main.Config.getText(TextName.SpeciesNames); - AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID); Array.Resize(ref trName, trdata.Length); CB_TrainerID.Items.Clear(); @@ -445,7 +444,7 @@ private void Setup() rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM, rForceFullyEvolved; public static bool rNoFixedDamage; - internal static bool[] rThemedClasses = { }; + internal static bool[] rThemedClasses = Array.Empty(); private static string[] rTags; private static int[] megaEvos; public static int[] rIgnoreClass, rEnsureMEvo; @@ -454,8 +453,8 @@ private void Setup() private static int[] rModelRestricted; public static int[] rFinalEvo; private string[] rImportant; - private readonly List Tags = new List(); - private readonly Dictionary TagTypes = new Dictionary(); + private readonly List Tags = new(); + private readonly Dictionary TagTypes = new(); public static int[] sL; // Random Species List public static decimal rGiftPercent, rLevelMultiplier, rMinPKM, rMaxPKM, rForceFullyEvolvedLevel, rForceHighPowerLevel; @@ -503,7 +502,7 @@ private void Randomize() GymE4Types.AddRange(Enumerable.Range(0, types.Length).ToArray()); } - foreach (int t1 in rEnsureMEvo.Where(t1 => rTags[t1] != "" && !TagTypes.Keys.Contains(rTags[t1]))) + foreach (int t1 in rEnsureMEvo.Where(t1 => rTags[t1].Length != 0 && !TagTypes.Keys.Contains(rTags[t1]))) { int t; if (rTags[t1].Contains("GYM") || rTags[t1].Contains("ELITE") || rTags[t1].Contains("CHAMPION")) @@ -520,7 +519,7 @@ private void Randomize() } foreach (string t1 in Tags) { - if (!TagTypes.Keys.Contains(t1) && t1 != "") + if (!TagTypes.Keys.Contains(t1) && t1.Length != 0) { int t; if (t1.Contains("GYM") || t1.Contains("ELITE") || t1.Contains("CHAMPION")) @@ -553,7 +552,7 @@ private void Randomize() byte[] trd = trdata[i]; byte[] trp = trpoke[i]; - var t = new trdata6(trd, trp, Main.Config.ORAS) + var t = new TrainerData6(trd, trp, Main.Config.ORAS) { Moves = rMove || (!rNoMove && checkBox_Moves.Checked), Item = rItem || checkBox_Item.Checked @@ -572,7 +571,7 @@ private void Randomize() WinFormsUtil.Alert("Randomized all Trainers according to specification!", "Press the Dump to .TXT button to view the new Trainer information!"); } - private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandomizer learn, ushort[] itemvals, int type, bool mevo, bool typerand) + private static void RandomizeTeam(TrainerData6 t, MoveRandomizer move, LearnsetRandomizer learn, ushort[] itemvals, int type, bool mevo, bool typerand) { int last = t.Team.Length - 1; for (int p = 0; p < t.Team.Length; p++) @@ -604,11 +603,11 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom pk.Species = (ushort)species; pk.Gender = 0; // Set Gender to Random - bool mega = rRandomMegas & !(mevo && p == last); // except if mega evolution is forced for the last slot + bool mega = rRandomMegas && !(mevo && p == last); // except if mega evolution is forced for the last slot pk.Form = (ushort)Randomizer.GetRandomForme(pk.Species, mega, true, Main.SpeciesStat); } if (rLevel) - pk.Level = (ushort)Randomizer.getModifiedLevel(pk.Level, rLevelMultiplier); + pk.Level = (ushort)Randomizer.GetModifiedLevel(pk.Level, rLevelMultiplier); if (rAbility) pk.Ability = (int)(1 + (Rand() % 3)); if (rDiffIV) @@ -621,7 +620,7 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom if (rForceFullyEvolved && pk.Level >= rForceFullyEvolvedLevel && !rFinalEvo.Contains(pk.Species)) { - int randFinalEvo() => (int)(Util.rnd32() % rFinalEvo.Length); + static int randFinalEvo() => (int)(Util.Random32() % rFinalEvo.Length); pk.Species = (ushort)rFinalEvo[randFinalEvo()]; pk.Form = (ushort)Randomizer.GetRandomForme(pk.Species, rRandomMegas, true, Main.SpeciesStat); } @@ -661,7 +660,7 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom } } - private static void SetMinMaxPKM(trdata6 t) + private static void SetMinMaxPKM(TrainerData6 t) { int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) var avgBST = (int)t.Team.Average(pk => Main.SpeciesStat[pk.Species].BST); @@ -677,7 +676,7 @@ private static void SetMinMaxPKM(trdata6 t) { Array.Resize(ref t.Team, (int)rMinPKM); t.Team[f] = // clone last pkm, keeping an average level for all new pkm - new trdata6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) + new TrainerData6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) { Species = (ushort)rSpeciesRand.GetRandomSpecies(avgSpec), Level = (ushort)avgLevel, @@ -693,7 +692,7 @@ private static void SetMinMaxPKM(trdata6 t) } } - private static void SetFullParties(trdata6 t, bool important) + private static void SetFullParties(TrainerData6 t, bool important) { int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) var avgBST = (int)t.Team.Average(pk => Main.SpeciesStat[pk.Species].BST); @@ -710,7 +709,7 @@ private static void SetFullParties(trdata6 t, bool important) { Array.Resize(ref t.Team, t.NumPokemon); t.Team[f] = // clone last pkm, keeping an average level for all new pkm - new trdata6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) + new TrainerData6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) { Species = (ushort)rSpeciesRand.GetRandomSpecies(avgSpec), Level = (ushort)avgLevel, @@ -718,7 +717,7 @@ private static void SetFullParties(trdata6 t, bool important) } } - private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) + private static void RandomizeTrainerAIClass(TrainerData6 t, string[] trClass) { if (rDiffAI) t.AI |= 7; // Set first 3 bits, keep any other flag if present @@ -742,7 +741,7 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass) } } - private static void RandomizeTrainerPrizeItem(trdata6 t) + private static void RandomizeTrainerPrizeItem(TrainerData6 t) { if (rGift && Rand() % 100 < rGiftPercent) { @@ -923,21 +922,21 @@ private void TagTrainer(string[] trTags, string tag, params int[] ids) private static int[] GetRandomMega(out int species) { - int rnd = Util.rand.Next(0, MegaDictionary.Count - 1); + int rnd = Util.Rand.Next(0, MegaDictionary.Count - 1); species = MegaDictionary.Keys.ElementAt(rnd); return MegaDictionary.Values.ElementAt(rnd); } private int GetRandomType(int trainer) { - if (rTags[trainer] != "") + if (rTags[trainer].Length != 0) return TagTypes[rTags[trainer]]; if (!rEnsureMEvo.Contains(trainer)) return (int)(Rand()%types.Length); return mEvoTypes[Rand() % mEvoTypes.Length]; } - private int[] GetMegaEvolvableTypes() + private static int[] GetMegaEvolvableTypes() { List MEvoTypes = new List(); foreach (int spec in megaEvos) diff --git a/pk3DS/Subforms/Gen6/RSWE.Designer.cs b/pk3DS/Subforms/Gen6/RSWE.Designer.cs index 3146fd7dfd..b8190b6cfb 100644 --- a/pk3DS/Subforms/Gen6/RSWE.Designer.cs +++ b/pk3DS/Subforms/Gen6/RSWE.Designer.cs @@ -1000,7 +1000,7 @@ private void InitializeComponent() this.B_LevelPlus.TabIndex = 277; this.B_LevelPlus.Text = "× Current"; this.B_LevelPlus.UseVisualStyleBackColor = true; - this.B_LevelPlus.Click += new System.EventHandler(this.modifyLevels); + this.B_LevelPlus.Click += new System.EventHandler(this.ModifyLevels); // // NUD_LevelAmp // diff --git a/pk3DS/Subforms/Gen6/RSWE.cs b/pk3DS/Subforms/Gen6/RSWE.cs index 7a40e04f03..51c3cba88f 100644 --- a/pk3DS/Subforms/Gen6/RSWE.cs +++ b/pk3DS/Subforms/Gen6/RSWE.cs @@ -12,56 +12,56 @@ public partial class RSWE : Form public RSWE() { InitializeComponent(); - spec = new[] + All_Species = new[] { CB_Grass1, CB_Grass2, CB_Grass3, CB_Grass4, CB_Grass5, CB_Grass6, CB_Grass7, CB_Grass8, CB_Grass9, CB_Grass10, CB_Grass11, CB_Grass12, CB_TallGrass1, CB_TallGrass2, CB_TallGrass3, CB_TallGrass4, CB_TallGrass5, CB_TallGrass6, CB_TallGrass7, CB_TallGrass8, CB_TallGrass9, CB_TallGrass10, CB_TallGrass11, CB_TallGrass12, - CB_Swarm1, CB_Swarm2, CB_Swarm3, - CB_Surf1, CB_Surf2, CB_Surf3, CB_Surf4, CB_Surf5, - CB_RockSmash1, CB_RockSmash2, CB_RockSmash3, CB_RockSmash4, CB_RockSmash5, - CB_Old1, CB_Old2, CB_Old3, + CB_Swarm1, CB_Swarm2, CB_Swarm3, + CB_Surf1, CB_Surf2, CB_Surf3, CB_Surf4, CB_Surf5, + CB_RockSmash1, CB_RockSmash2, CB_RockSmash3, CB_RockSmash4, CB_RockSmash5, + CB_Old1, CB_Old2, CB_Old3, CB_Good1, CB_Good2, CB_Good3, CB_Super1, CB_Super2, CB_Super3, CB_HordeA1, CB_HordeA2, CB_HordeA3, CB_HordeA4, CB_HordeA5, CB_HordeB1, CB_HordeB2, CB_HordeB3, CB_HordeB4, CB_HordeB5, CB_HordeC1, CB_HordeC2, CB_HordeC3, CB_HordeC4, CB_HordeC5, }; - min = new[] + All_Min = new[] { NUP_GrassMin1, NUP_GrassMin2, NUP_GrassMin3, NUP_GrassMin4, NUP_GrassMin5, NUP_GrassMin6, NUP_GrassMin7, NUP_GrassMin8, NUP_GrassMin9, NUP_GrassMin10, NUP_GrassMin11, NUP_GrassMin12, NUP_TallGrassMin1, NUP_TallGrassMin2, NUP_TallGrassMin3, NUP_TallGrassMin4, NUP_TallGrassMin5, NUP_TallGrassMin6, NUP_TallGrassMin7, NUP_TallGrassMin8, NUP_TallGrassMin9, NUP_TallGrassMin10, NUP_TallGrassMin11, NUP_TallGrassMin12, - NUP_SwarmMin1, NUP_SwarmMin2, NUP_SwarmMin3, - NUP_SurfMin1, NUP_SurfMin2, NUP_SurfMin3, NUP_SurfMin4, NUP_SurfMin5, - NUP_RockSmashMin1, NUP_RockSmashMin2, NUP_RockSmashMin3, NUP_RockSmashMin4, NUP_RockSmashMin5, - NUP_OldMin1, NUP_OldMin2, NUP_OldMin3, + NUP_SwarmMin1, NUP_SwarmMin2, NUP_SwarmMin3, + NUP_SurfMin1, NUP_SurfMin2, NUP_SurfMin3, NUP_SurfMin4, NUP_SurfMin5, + NUP_RockSmashMin1, NUP_RockSmashMin2, NUP_RockSmashMin3, NUP_RockSmashMin4, NUP_RockSmashMin5, + NUP_OldMin1, NUP_OldMin2, NUP_OldMin3, NUP_GoodMin1, NUP_GoodMin2, NUP_GoodMin3, NUP_SuperMin1, NUP_SuperMin2, NUP_SuperMin3, NUP_HordeAMin1, NUP_HordeAMin2, NUP_HordeAMin3, NUP_HordeAMin4, NUP_HordeAMin5, NUP_HordeBMin1, NUP_HordeBMin2, NUP_HordeBMin3, NUP_HordeBMin4, NUP_HordeBMin5, NUP_HordeCMin1, NUP_HordeCMin2, NUP_HordeCMin3, NUP_HordeCMin4, NUP_HordeCMin5, }; - max = new[] + All_Max = new[] { NUP_GrassMax1, NUP_GrassMax2, NUP_GrassMax3, NUP_GrassMax4, NUP_GrassMax5, NUP_GrassMax6, NUP_GrassMax7, NUP_GrassMax8, NUP_GrassMax9, NUP_GrassMax10, NUP_GrassMax11, NUP_GrassMax12, NUP_TallGrassMax1, NUP_TallGrassMax2, NUP_TallGrassMax3, NUP_TallGrassMax4, NUP_TallGrassMax5, NUP_TallGrassMax6, NUP_TallGrassMax7, NUP_TallGrassMax8, NUP_TallGrassMax9, NUP_TallGrassMax10, NUP_TallGrassMax11, NUP_TallGrassMax12, - NUP_SwarmMax1, NUP_SwarmMax2, NUP_SwarmMax3, - NUP_SurfMax1, NUP_SurfMax2, NUP_SurfMax3, NUP_SurfMax4, NUP_SurfMax5, - NUP_RockSmashMax1, NUP_RockSmashMax2, NUP_RockSmashMax3, NUP_RockSmashMax4, NUP_RockSmashMax5, - NUP_OldMax1, NUP_OldMax2, NUP_OldMax3, + NUP_SwarmMax1, NUP_SwarmMax2, NUP_SwarmMax3, + NUP_SurfMax1, NUP_SurfMax2, NUP_SurfMax3, NUP_SurfMax4, NUP_SurfMax5, + NUP_RockSmashMax1, NUP_RockSmashMax2, NUP_RockSmashMax3, NUP_RockSmashMax4, NUP_RockSmashMax5, + NUP_OldMax1, NUP_OldMax2, NUP_OldMax3, NUP_GoodMax1, NUP_GoodMax2, NUP_GoodMax3, NUP_SuperMax1, NUP_SuperMax2, NUP_SuperMax3, NUP_HordeAMax1, NUP_HordeAMax2, NUP_HordeAMax3, NUP_HordeAMax4, NUP_HordeAMax5, NUP_HordeBMax1, NUP_HordeBMax2, NUP_HordeBMax3, NUP_HordeBMax4, NUP_HordeBMax5, NUP_HordeCMax1, NUP_HordeCMax2, NUP_HordeCMax3, NUP_HordeCMax4, NUP_HordeCMax5, }; - form = new[] + All_Forms = new[] { NUP_GrassForme1, NUP_GrassForme2, NUP_GrassForme3, NUP_GrassForme4, NUP_GrassForme5, NUP_GrassForme6, NUP_GrassForme7, NUP_GrassForme8, NUP_GrassForme9, NUP_GrassForme10, NUP_GrassForme11, NUP_GrassForme12, NUP_TallGrassForme1, NUP_TallGrassForme2, NUP_TallGrassForme3, NUP_TallGrassForme4, NUP_TallGrassForme5, NUP_TallGrassForme6, NUP_TallGrassForme7, NUP_TallGrassForme8, NUP_TallGrassForme9, NUP_TallGrassForme10, NUP_TallGrassForme11, NUP_TallGrassForme12, - NUP_SwarmForme1, NUP_SwarmForme2, NUP_SwarmForme3, - NUP_SurfForme1, NUP_SurfForme2, NUP_SurfForme3, NUP_SurfForme4, NUP_SurfForme5, - NUP_RockSmashForme1, NUP_RockSmashForme2, NUP_RockSmashForme3, NUP_RockSmashForme4, NUP_RockSmashForme5, - NUP_OldForme1, NUP_OldForme2, NUP_OldForme3, + NUP_SwarmForme1, NUP_SwarmForme2, NUP_SwarmForme3, + NUP_SurfForme1, NUP_SurfForme2, NUP_SurfForme3, NUP_SurfForme4, NUP_SurfForme5, + NUP_RockSmashForme1, NUP_RockSmashForme2, NUP_RockSmashForme3, NUP_RockSmashForme4, NUP_RockSmashForme5, + NUP_OldForme1, NUP_OldForme2, NUP_OldForme3, NUP_GoodForme1, NUP_GoodForme2, NUP_GoodForme3, NUP_SuperForme1, NUP_SuperForme2, NUP_SuperForme3, NUP_HordeAForme1, NUP_HordeAForme2, NUP_HordeAForme3, NUP_HordeAForme4, NUP_HordeAForme5, @@ -269,53 +269,53 @@ public RSWE() "Megas-Mega (Y) - 2", }; RSWE_Load(); - openQuick(Directory.GetFiles("encdata")); + OpenQuick(Directory.GetFiles("encdata")); RandSettings.GetFormSettings(this, GB_Tweak.Controls); } - private readonly ComboBox[] spec; - private readonly NumericUpDown[] min; - private readonly NumericUpDown[] max; - private readonly NumericUpDown[] form; - string[] specieslist = { }; - readonly string[] formlist = { }; - string[] metRS_00000 = { }; - byte[] zonedata = { }; - byte[] decStorage = { }; - string[] LocationNames = { }; + private readonly ComboBox[] All_Species; + private readonly NumericUpDown[] All_Min; + private readonly NumericUpDown[] All_Max; + private readonly NumericUpDown[] All_Forms; + private string[] specieslist = Array.Empty(); + private readonly string[] formlist = Array.Empty(); + private string[] metRS_00000 = Array.Empty(); + private byte[] zonedata = Array.Empty(); + private byte[] decStorage = Array.Empty(); + private string[] LocationNames = Array.Empty(); private string[] encdatapaths; private string[] filepaths; private void RSWE_Load() { - specieslist = Main.Config.getText(TextName.SpeciesNames); + specieslist = Main.Config.GetText(TextName.SpeciesNames); specieslist[0] = "---"; foreach (string s in formlist) CB_FormeList.Items.Add(s); // Clear & Reset Data - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { - spec[i].Items.Clear(); + All_Species[i].Items.Clear(); foreach (string s in specieslist) - spec[i].Items.Add(s); - spec[i].SelectedIndex = 0; + All_Species[i].Items.Add(s); + All_Species[i].SelectedIndex = 0; } //Preload Tabs PreloadTabs(); } - internal static uint rnd32() => Util.rnd32(); + internal static uint Random32() => Util.Random32(); - private void openQuick(string[] encdata) + private void OpenQuick(string[] encdata) { encdatapaths = encdata; Array.Sort(encdatapaths); filepaths = new string[encdatapaths.Length - 2]; Array.Copy(encdatapaths, 2, filepaths, 0, filepaths.Length); - metRS_00000 = Main.Config.getText(TextName.metlist_000000); + metRS_00000 = Main.Config.GetText(TextName.metlist_000000); zonedata = File.ReadAllBytes(encdatapaths[0]); decStorage = File.ReadAllBytes(encdatapaths[1]); LocationNames = new string[filepaths.Length]; @@ -334,7 +334,7 @@ private void openQuick(string[] encdata) CB_LocationID_SelectedIndexChanged(null, null); } - private void parse(byte[] ed) + private void ParseEncounterTable(byte[] ed) { // Encounter Slot Counts per Encounter Type /* OLD XY// 12,12,12,12,12 @@ -354,21 +354,21 @@ private void parse(byte[] ed) //5 horde 60 //5 horde 35 //5 horde 5 - byte[] slot = new Byte[4]; + byte[] slot = new byte[4]; const int offset = 0x0; // read data into form - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { // Fetch Data Array.Copy(ed, offset + (i * 4), slot, 0, 4); - int[] data = pslot(slot); + int[] data = ParseSlot(slot); // Load Data - spec[i].SelectedIndex = data[0]; - form[i].Value = data[1]; - min[i].Value = data[2]; - max[i].Value = data[3]; + All_Species[i].SelectedIndex = data[0]; + All_Forms[i].Value = data[1]; + All_Min[i].Value = data[2]; + All_Max[i].Value = data[3]; } #if DUMPER @@ -382,7 +382,7 @@ private void parse(byte[] ed) #endif } - private int[] pslot(byte[] slot) // Parse Slot to Bytes + private static int[] ParseSlot(byte[] slot) // Parse Slot to Bytes { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; int f = BitConverter.ToUInt16(slot, 0) >> 11; @@ -396,7 +396,7 @@ private int[] pslot(byte[] slot) // Parse Slot to Bytes return data; } - private string parseslot(byte[] slot) + public string ConvertSlotToString(byte[] slot) { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; if (index == 0) return ""; @@ -408,7 +408,7 @@ private string parseslot(byte[] slot) return species + ',' + min + ',' + max + ','; } - private byte[] MakeSlotData(int species, int f, int lo, int hi) + private static byte[] MakeSlotData(int species, int f, int lo, int hi) { byte[] data = new byte[4]; Array.Copy(BitConverter.GetBytes(Convert.ToUInt16((Convert.ToUInt16(f) << 11) + Convert.ToUInt16(species))), 0, data, 0, 2); @@ -448,25 +448,25 @@ private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) byte[] encounterdata = new byte[0xF6]; Array.Copy(filedata, offset, encounterdata, 0, 0xF6); - parse(encounterdata); + ParseEncounterTable(encounterdata); } // Utility - private bool needsInsertion(int mapID) + private bool NeedsInsertion(int mapID) { if (mapID != 535) // Hardcoded, bad, I know. return BitConverter.ToUInt32(decStorage, (mapID + 2) * 4) - BitConverter.ToUInt32(decStorage, (mapID + 1) * 4) == 0; return BitConverter.ToUInt32(decStorage, (mapID + 1) * 4) == decStorage.Length; } - private bool hasData() + private bool HasData() { - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { - if (spec[i].SelectedIndex > 0) { return true; } - if (form[i].Value > 0) { return true; } - if (min[i].Value > 0) { return true; } - if (max[i].Value > 0) { return true; } + if (All_Species[i].SelectedIndex > 0) { return true; } + if (All_Forms[i].Value > 0) { return true; } + if (All_Min[i].Value > 0) { return true; } + if (All_Max[i].Value > 0) { return true; } } return false; } @@ -480,13 +480,13 @@ private void PreloadTabs() private void ClearData() { - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { // Load Data - spec[i].SelectedIndex = 0; - form[i].Value = 0; - min[i].Value = 0; - max[i].Value = 0; + All_Species[i].SelectedIndex = 0; + All_Forms[i].Value = 0; + All_Min[i].Value = 0; + All_Max[i].Value = 0; } } @@ -494,9 +494,9 @@ private byte[] MakeEncounterData() { byte[] ed = new byte[0x102]; const int offset = 0x0; - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { - byte[] data = MakeSlotData(spec[i].SelectedIndex, (int)form[i].Value, (int)min[i].Value, (int)max[i].Value); + byte[] data = MakeSlotData(All_Species[i].SelectedIndex, (int)All_Forms[i].Value, (int)All_Min[i].Value, (int)All_Max[i].Value); Array.Copy(data, 0, ed, offset + (i * 4), 4); } return ed; @@ -507,14 +507,14 @@ private string GetEncDataString() string toret = "======" + Environment.NewLine; toret += "Map " + CB_LocationID.Text + "" + Environment.NewLine; toret += "======" + Environment.NewLine; - if (hasData()) + if (HasData()) { toret += "Grass: " + label31.Text + " - " + CB_Grass1.Text + " (Level " + NUP_GrassMin1.Text + ", Forme: " + NUP_GrassForme1.Text + "), " + label32.Text + " - " + CB_Grass2.Text + " (Level " + NUP_GrassMin2.Text + ", Forme: " + NUP_GrassForme2.Text + "), " + label33.Text + " - " + CB_Grass3.Text + " (Level " + NUP_GrassMin3.Text + ", Forme: " + NUP_GrassForme3.Text + "), " + label34.Text + " - " + CB_Grass4.Text + " (Level " + NUP_GrassMin4.Text + ", Forme: " + NUP_GrassForme4.Text + "), " + label35.Text + " - " + CB_Grass5.Text + " (Level " + NUP_GrassMin5.Text + ", Forme: " + NUP_GrassForme5.Text + "), " + label36.Text + " - " + CB_Grass6.Text + " (Level " + NUP_GrassMin6.Text + ", Forme: " + NUP_GrassForme6.Text + "), " + label37.Text + " - " + CB_Grass7.Text + " (Level " + NUP_GrassMin7.Text + ", Forme: " + NUP_GrassForme7.Text + "), " + label38.Text + " - " + CB_Grass8.Text + " (Level " + NUP_GrassMin8.Text + ", Forme: " + NUP_GrassForme8.Text + "), " + label39.Text + " - " + CB_Grass9.Text + " (Level " + NUP_GrassMin9.Text + ", Forme: " + NUP_GrassForme9.Text + "), " + label40.Text + " - " + CB_Grass10.Text + " (Level " + NUP_GrassMin10.Text + ", Forme: " + NUP_GrassForme10.Text + "), " + label42.Text + " - " + CB_Grass11.Text + " (Level " + NUP_GrassMin11.Text + ", Forme: " + NUP_GrassForme11.Text + "), " + label41.Text + " - " + CB_Grass12.Text + " (Level " + NUP_GrassMin12.Text + ", Forme: " + NUP_GrassForme12.Text + ")" + Environment.NewLine; toret += "Tall Grass: " + label10.Text + " - " + CB_TallGrass1.Text + " (Level " + NUP_TallGrassMin1.Text + ", Forme: " + NUP_TallGrassForme1.Text + "), " + label21.Text + " - " + CB_TallGrass2.Text + " (Level " + NUP_TallGrassMin2.Text + ", Forme: " + NUP_TallGrassForme2.Text + "), " + label20.Text + " - " + CB_TallGrass3.Text + " (Level " + NUP_TallGrassMin3.Text + ", Forme: " + NUP_TallGrassForme3.Text + "), " + label19.Text + " - " + CB_TallGrass4.Text + " (Level " + NUP_TallGrassMin4.Text + ", Forme: " + NUP_TallGrassForme4.Text + "), " + label18.Text + " - " + CB_TallGrass5.Text + " (Level " + NUP_TallGrassMin5.Text + ", Forme: " + NUP_TallGrassForme5.Text + "), " + label17.Text + " - " + CB_TallGrass6.Text + " (Level " + NUP_TallGrassMin6.Text + ", Forme: " + NUP_TallGrassForme6.Text + "), " + label16.Text + " - " + CB_TallGrass7.Text + " (Level " + NUP_TallGrassMin7.Text + ", Forme: " + NUP_TallGrassForme7.Text + "), " + label15.Text + " - " + CB_TallGrass8.Text + " (Level " + NUP_TallGrassMin8.Text + ", Forme: " + NUP_TallGrassForme8.Text + "), " + label14.Text + " - " + CB_TallGrass9.Text + " (Level " + NUP_TallGrassMin9.Text + ", Forme: " + NUP_TallGrassForme9.Text + "), " + label13.Text + " - " + CB_TallGrass10.Text + " (Level " + NUP_TallGrassMin10.Text + ", Forme: " + NUP_TallGrassForme10.Text + "), " + label12.Text + " - " + CB_TallGrass11.Text + " (Level " + NUP_TallGrassMin11.Text + ", Forme: " + NUP_TallGrassForme11.Text + "), " + label11.Text + " - " + CB_TallGrass12.Text + " (Level " + NUP_TallGrassMin12.Text + ", Forme: " + NUP_TallGrassForme12.Text + ")" + Environment.NewLine; toret += "Rock Smash: " + label111.Text + " - " + CB_RockSmash1.Text + " (Level " + NUP_RockSmashMin1.Text + ", Forme: " + NUP_RockSmashForme1.Text + "), " + label110.Text + " - " + CB_RockSmash2.Text + " (Level " + NUP_RockSmashMin2.Text + ", Forme: " + NUP_RockSmashForme2.Text + "), " + label109.Text + " - " + CB_RockSmash3.Text + " (Level " + NUP_RockSmashMin3.Text + ", Forme: " + NUP_RockSmashForme3.Text + "), " + label108.Text + " - " + CB_RockSmash4.Text + " (Level " + NUP_RockSmashMin4.Text + ", Forme: " + NUP_RockSmashForme4.Text + "), " + label107.Text + " - " + CB_RockSmash5.Text + " (Level " + NUP_RockSmashMin5.Text + ", Forme: " + NUP_RockSmashForme5.Text + ")" + Environment.NewLine; - + toret += "Swarm: " + label70.Text + " - " + CB_Swarm1.Text + " (Level " + NUP_SwarmMin1.Text + ", Forme: " + NUP_SwarmForme1.Text + "), " + label81.Text + " - " + CB_Swarm2.Text + " (Level " + NUP_SwarmMin2.Text + ", Forme: " + NUP_SwarmForme2.Text + "), " + label80.Text + " - " + CB_Swarm3.Text + " (Level " + NUP_SwarmMin3.Text + ", Forme: " + NUP_SwarmForme3.Text + ")" + Environment.NewLine; toret += "Old Rod: " + label43.Text + " - " + CB_Old1.Text + " (Level " + NUP_OldMin1.Text + ", Forme: " + NUP_OldForme1.Text + "), " + label44.Text + " - " + CB_Old2.Text + " (Level " + NUP_OldMin2.Text + ", Forme: " + NUP_OldForme2.Text + "), " + label45.Text + " - " + CB_Old3.Text + " (Level " + NUP_OldMin3.Text + ", Forme: " + NUP_OldForme3.Text + ")" + Environment.NewLine; @@ -534,7 +534,10 @@ private string GetEncDataString() toret = toret.Replace("--- (No Level)", "None"); } else + { toret += "No encounters found." + Environment.NewLine + Environment.NewLine; + } + return toret; } @@ -559,7 +562,7 @@ private void B_Save_Click(object sender, EventArgs e) { int f = CB_LocationID.SelectedIndex; string filepath = filepaths[f]; - if (needsInsertion(f)) + if (NeedsInsertion(f)) { //To be implemented, eventually. //Spoiler: I am actually probably not going to bother. @@ -588,8 +591,8 @@ private void B_Save_Click(object sender, EventArgs e) //overwrite offset so the game actually looks at the data Array.Copy(BitConverter.GetBytes(Convert.ToUInt32(filedata.Length)), 0, preoffset, 0x10, 4); } - byte[] encdata = { }; - if (hasData()) { encdata = MakeEncounterData(); } + byte[] encdata = Array.Empty(); + if (HasData()) { encdata = MakeEncounterData(); } byte[] newdata = ConcatArrays(preoffset, encdata); File.WriteAllBytes(filepath, newdata); //Also write to 537.EN (decStorage) @@ -604,7 +607,7 @@ private void B_Save_Click(object sender, EventArgs e) private void B_Randomize_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Horde tab.") != DialogResult.Yes) return; - + Enabled = false; // Calculate % diff we will apply to each level @@ -628,26 +631,30 @@ private void B_Randomize_Click(object sender, EventArgs e) }; rand.Initialize(); - int[] slotArray = Enumerable.Range(0, max.Length).Select(a => a).ToArray(); + int[] slotArray = Enumerable.Range(0, All_Max.Length).Select(a => a).ToArray(); for (int i = 0; i < CB_LocationID.Items.Count; i++) // for every location { CB_LocationID.SelectedIndex = i; - if (!hasData()) continue; // Don't randomize if doesn't have data. - + if (!HasData()) continue; // Don't randomize if doesn't have data. + // Assign Levels if (CHK_Level.Checked) - for (int l = 0; l < max.Length; l++) - min[l].Value = max[l].Value = max[l].Value <= 1 ? max[l].Value : Math.Max(1, Math.Min(100, (int)(leveldiff * max[l].Value))); + { + for (int l = 0; l < All_Max.Length; l++) + All_Min[l].Value = All_Max[l].Value = All_Max[l].Value <= 1 ? All_Max[l].Value : Math.Max(1, Math.Min(100, (int)(leveldiff * All_Max[l].Value))); + } // Get a new list of Pokemon so that DexNav does not crash. - int[] list = new int[max.Length]; + int[] list = new int[All_Max.Length]; int used = 19; // Count up how many slots are active. - for (int s = 0; s < max.Length; s++) - if (spec[s].SelectedIndex > 0) - list[s] = spec[s].SelectedIndex; + for (int s = 0; s < All_Max.Length; s++) + { + if (All_Species[s].SelectedIndex > 0) + list[s] = All_Species[s].SelectedIndex; + } // At most 18, but don't chew if there's only a few slots. int cons = list.Count(a => a != 0); @@ -655,39 +662,43 @@ private void B_Randomize_Click(object sender, EventArgs e) // Fill Location List for (int s = 0; s < RandomList.Length; s++) - RandomList[s] = rand.GetRandomSpecies(spec[s].SelectedIndex); + RandomList[s] = rand.GetRandomSpecies(All_Species[s].SelectedIndex); // Assign Slots while (used < RandomList.Distinct().Count() || used > 18) // Can just arbitrarily assign slots. { Util.Shuffle(slotArray); - for (int s = 0; s < max.Length; s++) + for (int s = 0; s < All_Max.Length; s++) { int slot = slotArray[s]; - if (spec[slot].SelectedIndex != 0) // If the slot is in use - list[slot] = RandomList[Util.rand.Next(0, RandomList.Length)]; + if (All_Species[slot].SelectedIndex != 0) // If the slot is in use + list[slot] = RandomList[Util.Rand.Next(0, RandomList.Length)]; } - used = countUnique(list); + used = CountUnique(list); if (used != RandomList.Length) - ShuffleSlots(ref list, RandomList.Length); - used = countUnique(list); + ShuffleSlots(ref list); + used = CountUnique(list); } // If Distinct Hordes are selected, homogenize int hordeslot = 0; if (CHK_HomogeneousHordes.Checked) - for (int slot = max.Length - 15; slot < max.Length; slot++) { - list[slot] = list[slot - (hordeslot % 5)]; - hordeslot++; + for (int slot = All_Max.Length - 15; slot < All_Max.Length; slot++) + { + list[slot] = list[slot - (hordeslot % 5)]; + hordeslot++; + } } // Fill Slots - for (int slot = 0; slot < max.Length; slot++) - if (spec[slot].SelectedIndex != 0) + for (int slot = 0; slot < All_Max.Length; slot++) + { + if (All_Species[slot].SelectedIndex != 0) { - spec[slot].SelectedIndex = list[slot]; - setRandomForm(slot, spec[slot].SelectedIndex); + All_Species[slot].SelectedIndex = list[slot]; + SetRandomForm(slot, All_Species[slot].SelectedIndex); } + } B_Save_Click(sender, e); } @@ -695,7 +706,7 @@ private void B_Randomize_Click(object sender, EventArgs e) WinFormsUtil.Alert("Randomized all Wild Encounters according to specification!", "Press the Dump Tables button to view the new Wild Encounter information!"); } - private int countUnique(int[] list) + private static int CountUnique(int[] list) { int used = 0; used += list.Skip(0).Take(12).Distinct().Count(a => a != 0); @@ -710,35 +721,35 @@ private int countUnique(int[] list) return used; } - private void setRandomForm(int slot, int species) + private void SetRandomForm(int slot, int species) { if (CHK_MegaForm.Checked && Main.SpeciesStat[species].FormeCount > 1 && Legal.Mega_ORAS.Contains((ushort)species)) - form[slot].Value = rnd32() % Main.SpeciesStat[species].FormeCount; // Slot-Random + All_Forms[slot].Value = Random32() % Main.SpeciesStat[species].FormeCount; // Slot-Random else if (species == 666 || species == 665 || species == 664) // Vivillon - form[slot].Value = rnd32() % 20; + All_Forms[slot].Value = Random32() % 20; else if (species == 386) // Deoxys - form[slot].Value = rnd32() % 4; + All_Forms[slot].Value = Random32() % 4; else if (species == 201) // Unown - form[slot].Value = 31; + All_Forms[slot].Value = 31; else if (species == 550) // Basculin - form[slot].Value = rnd32() % 2; + All_Forms[slot].Value = Random32() % 2; else if (species == 412 || species == 413) // Wormadam - form[slot].Value = rnd32() % 3; + All_Forms[slot].Value = Random32() % 3; else if (species == 422 || species == 423) // Gastrodon - form[slot].Value = rnd32() % 2; + All_Forms[slot].Value = Random32() % 2; else if (species == 585 || species == 586) // Sawsbuck - form[slot].Value = rnd32() % 4; + All_Forms[slot].Value = Random32() % 4; else if (species == 669 || species == 671) // Flabebe/Florges - form[slot].Value = rnd32() % 5; + All_Forms[slot].Value = Random32() % 5; else if (species == 670) // Floette - form[slot].Value = rnd32() % 6; + All_Forms[slot].Value = Random32() % 6; else if (species == 710 || species == 711) // Pumpkaboo - form[slot].Value = rnd32() % 4; + All_Forms[slot].Value = Random32() % 4; else - form[slot].Value = 0; + All_Forms[slot].Value = 0; } - private void ShuffleSlots(ref int[] list, int slC) + private void ShuffleSlots(ref int[] list) { int[] input = (int[])list.Clone(); // int rawct = input.Distinct().Count(a => a != 0); @@ -749,7 +760,7 @@ private void ShuffleSlots(ref int[] list, int slC) for (int i = 0; i < slotset.Length; i++) slotdata[i] = list.Skip(slotset[i]).Take(slotlen[i]).ToArray(); - int used = countUnique(list); + int used = CountUnique(list); // Iterate while (used > 18) { @@ -769,11 +780,11 @@ private void ShuffleSlots(ref int[] list, int slC) if (!slotdata[s].Contains(data)) continue; int z = Array.LastIndexOf(slotdata[s], data); - int next = (z + 1 + Util.rand.Next(slotdata[s].Length - 1)) % slotdata[s].Length; + int next = (z + 1 + Util.Rand.Next(slotdata[s].Length - 1)) % slotdata[s].Length; int donor = slotdata[s][next]; if (donor == 0) continue; if (donor != data) - swap(ref slotdata[s][next], ref slotdata[i][j]); + Swap(ref slotdata[s][next], ref slotdata[i][j]); } } } @@ -781,19 +792,19 @@ private void ShuffleSlots(ref int[] list, int slC) for (int i = 1; i < slotdata.Length; i++) temp = temp.Concat(slotdata[i]).ToArray(); list = temp.ToArray(); - used = countUnique(list); + used = CountUnique(list); if (used < 18) break; } } } - private void swap(ref int a1, ref int a2) + private static void Swap(ref int a1, ref int a2) { var s1 = a1; var s2 = a2; a2 = s1; a1 = s2; } - private void modifyLevels(object sender, EventArgs e) + private void ModifyLevels(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Level ranges?", "Cannot undo.") != DialogResult.Yes) return; @@ -810,9 +821,11 @@ private void modifyLevels(object sender, EventArgs e) CB_LocationID.SelectedIndex = i; // Amp Levels - for (int l = 0; l < max.Length; l++) - if (min[l].Value > 1) - min[l].Value = max[l].Value = Randomizer.getModifiedLevel((int)max[l].Value, leveldiff); + for (int l = 0; l < All_Max.Length; l++) + { + if (All_Min[l].Value > 1) + All_Min[l].Value = All_Max[l].Value = Randomizer.GetModifiedLevel((int)All_Max[l].Value, leveldiff); + } // Save Changes B_Save_Click(sender, e); diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs index ea7a124ca6..b90312b672 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.Designer.cs @@ -96,7 +96,7 @@ private void InitializeComponent() this.CB_G1_0.Name = "CB_G1_0"; this.CB_G1_0.Size = new System.Drawing.Size(120, 21); this.CB_G1_0.TabIndex = 441; - this.CB_G1_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G1_0.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // CB_G1_1 // @@ -107,7 +107,7 @@ private void InitializeComponent() this.CB_G1_1.Name = "CB_G1_1"; this.CB_G1_1.Size = new System.Drawing.Size(120, 21); this.CB_G1_1.TabIndex = 443; - this.CB_G1_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G1_1.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G1_1 // @@ -126,7 +126,7 @@ private void InitializeComponent() this.CB_G1_2.Name = "CB_G1_2"; this.CB_G1_2.Size = new System.Drawing.Size(120, 21); this.CB_G1_2.TabIndex = 445; - this.CB_G1_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G1_2.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G1_2 // @@ -146,7 +146,7 @@ private void InitializeComponent() this.CB_G2_2.Name = "CB_G2_2"; this.CB_G2_2.Size = new System.Drawing.Size(120, 21); this.CB_G2_2.TabIndex = 451; - this.CB_G2_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G2_2.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G2_2 // @@ -167,7 +167,7 @@ private void InitializeComponent() this.CB_G2_1.Name = "CB_G2_1"; this.CB_G2_1.Size = new System.Drawing.Size(120, 21); this.CB_G2_1.TabIndex = 449; - this.CB_G2_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G2_1.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G2_1 // @@ -188,7 +188,7 @@ private void InitializeComponent() this.CB_G2_0.Name = "CB_G2_0"; this.CB_G2_0.Size = new System.Drawing.Size(120, 21); this.CB_G2_0.TabIndex = 447; - this.CB_G2_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G2_0.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G2_0 // @@ -210,7 +210,7 @@ private void InitializeComponent() this.CB_G3_2.Size = new System.Drawing.Size(120, 21); this.CB_G3_2.TabIndex = 457; this.CB_G3_2.Visible = false; - this.CB_G3_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G3_2.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G3_2 // @@ -233,7 +233,7 @@ private void InitializeComponent() this.CB_G3_1.Size = new System.Drawing.Size(120, 21); this.CB_G3_1.TabIndex = 455; this.CB_G3_1.Visible = false; - this.CB_G3_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G3_1.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G3_1 // @@ -256,7 +256,7 @@ private void InitializeComponent() this.CB_G3_0.Size = new System.Drawing.Size(120, 21); this.CB_G3_0.TabIndex = 453; this.CB_G3_0.Visible = false; - this.CB_G3_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G3_0.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G3_0 // @@ -279,7 +279,7 @@ private void InitializeComponent() this.CB_G4_2.Size = new System.Drawing.Size(120, 21); this.CB_G4_2.TabIndex = 463; this.CB_G4_2.Visible = false; - this.CB_G4_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G4_2.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G4_2 // @@ -302,7 +302,7 @@ private void InitializeComponent() this.CB_G4_1.Size = new System.Drawing.Size(120, 21); this.CB_G4_1.TabIndex = 461; this.CB_G4_1.Visible = false; - this.CB_G4_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G4_1.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G4_1 // @@ -325,7 +325,7 @@ private void InitializeComponent() this.CB_G4_0.Size = new System.Drawing.Size(120, 21); this.CB_G4_0.TabIndex = 459; this.CB_G4_0.Visible = false; - this.CB_G4_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + this.CB_G4_0.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies); // // PB_G4_0 // diff --git a/pk3DS/Subforms/Gen6/StarterEditor6.cs b/pk3DS/Subforms/Gen6/StarterEditor6.cs index 74ad14b92d..b891a748c9 100644 --- a/pk3DS/Subforms/Gen6/StarterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StarterEditor6.cs @@ -12,7 +12,7 @@ public StarterEditor6() { specieslist[0] = "---"; Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); - + if (!File.Exists(CROPath)) { WinFormsUtil.Error("CRO does not exist! Closing.", CROPath); @@ -44,13 +44,13 @@ public StarterEditor6() Labels = new[] { L_Set1, L_Set2, L_Set3, L_Set4 }; Width = Main.Config.ORAS ? Width : (Width / 2) + 2; - loadData(); + LoadData(); RandSettings.GetFormSettings(this, groupBox1.Controls); } private readonly string CROPath = Path.Combine(Main.RomFSPath, "DllPoke3Select.cro"); private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro"); - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); private readonly ComboBox[][] Choices; private readonly PictureBox[][] Previews; private readonly Label[] Labels; @@ -68,7 +68,7 @@ public StarterEditor6() private void B_Save_Click(object sender, EventArgs e) { - saveData(); + SaveData(); RandSettings.SetFormSettings(this, groupBox1.Controls); Close(); } @@ -78,7 +78,7 @@ private void B_Cancel_Click(object sender, EventArgs e) Close(); } - private void loadData() + private void LoadData() { Data = File.ReadAllBytes(CROPath); FieldData = File.ReadAllBytes(FieldPath); @@ -103,11 +103,13 @@ private void loadData() } } - private void saveData() + private void SaveData() { for (int i = 0; i < Count; i++) + { for (int j = 0; j < 3; j++) Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, Data, offset + (((i * 3) + j)*0x54), 2); + } // Set the choices back int fieldOffset = Main.Config.ORAS ? 0xF906C : 0xF805C; @@ -127,22 +129,27 @@ private void saveData() }; for (int i = 0; i < Count; i++) + { for (int j = 0; j < 3; j++) Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, FieldData, fieldOffset + (entries[(i * 3) + j]*fieldSize), 2); + } File.WriteAllBytes(CROPath, Data); // poke3 File.WriteAllBytes(FieldPath, FieldData); // field } - private void changeSpecies(object sender, EventArgs e) + private void ChangeSpecies(object sender, EventArgs e) { + if (sender is not ComboBox cb) + return; + // Fetch the corresponding PictureBox to update - string name = (sender as ComboBox).Name; + string name = cb.Name; int group = int.Parse(name[4]+"") - 1; int index = int.Parse(name[6]+""); - int species = (sender as ComboBox).SelectedIndex; - Previews[group][index].Image = WinFormsUtil.scaleImage(WinFormsUtil.getSprite(species, 0, 0, 0, Main.Config), 3); + int species = cb.SelectedIndex; + Previews[group][index].Image = WinFormsUtil.ScaleImage(WinFormsUtil.GetSprite(species, 0, 0, 0, Main.Config), 3); } private void B_Randomize_Click(object sender, EventArgs e) @@ -176,27 +183,30 @@ private void B_Randomize_Click(object sender, EventArgs e) // Assign Species for (int j = 0; j < 3; j++) { - int oldSpecies = BitConverter.ToUInt16(Data, offset + (((i * 3) + j) * 0x54)); + // int oldSpecies = BitConverter.ToUInt16(Data, offset + (((i * 3) + j) * 0x54)); if (CHK_BasicStarter.Checked) { if (CHK_Gen.Checked) { - int basic() => (int)(Util.rnd32() % BasicStarterPerGen[gen - 1].Length); + int basic() => (int)(Util.Random32() % BasicStarterPerGen[gen - 1].Length); Choices[i][j].SelectedIndex = BasicStarterPerGen[gen - 1][basic()]; } - else { - int basic() => (int)(Util.rnd32() % BasicStarter.Length); + else + { + int basic() => (int)(Util.Random32() % BasicStarter.Length); Choices[i][j].SelectedIndex = BasicStarter[basic()]; } } else + { Choices[i][j].SelectedIndex = rand.GetRandomSpecies(i); + } } } if (blind) { - saveData(); + SaveData(); Close(); } } diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 1ccec39b83..92acb398a2 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -41,12 +41,12 @@ public StaticEncounterEditor6() private const int fieldSize = 0xC; private readonly int count = Main.Config.ORAS ? 0x3B : 0xC; private EncounterStatic6[] EncounterData; - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); private static int[] FinalEvo = Legal.FinalEvolutions_6; - private static int[] Legendary = Legal.Legendary_6; - private static int[] Mythical = Legal.Mythical_6; - private static int[] ReplaceLegend = Legendary.Concat(Mythical).ToArray(); + private static readonly int[] Legendary = Legal.Legendary_6; + private static readonly int[] Mythical = Legal.Mythical_6; + private static readonly int[] ReplaceLegend = Legendary.Concat(Mythical).ToArray(); private readonly string[] ability = { @@ -174,7 +174,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (CHK_L.Checked) FinalEvo = FinalEvo.Concat(Legendary).ToArray(); if (CHK_E.Checked) FinalEvo = FinalEvo.Concat(Mythical).ToArray(); - var items = Randomizer.getRandomItemList(); + var items = Randomizer.GetRandomItemList(); for (int i = 0; i < LB_Encounters.Items.Count; i++) { LB_Encounters.SelectedIndex = i; @@ -183,7 +183,7 @@ private void B_RandAll_Click(object sender, EventArgs e) // replace Legendaries with another Legendary if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(species)) { - int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); + int randLegend() => (int)(Util.Random32() % ReplaceLegend.Length); species = ReplaceLegend[randLegend()]; } @@ -197,20 +197,20 @@ private void B_RandAll_Click(object sender, EventArgs e) formrand.AllowMega = true; if (CHK_Item.Checked) - CB_HeldItem.SelectedIndex = items[Util.rnd32() % items.Length]; + CB_HeldItem.SelectedIndex = items[Util.Random32() % items.Length]; if (CHK_Level.Checked) - NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + NUD_Level.Value = Randomizer.GetModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); if (CHK_RemoveShinyLock.Checked) CHK_ShinyLock.Checked = false; if (CHK_RandomAbility.Checked) - CB_Ability.SelectedIndex = (Util.rand.Next(1, 4)); // 1, 2 , or H + CB_Ability.SelectedIndex = (Util.Rand.Next(1, 4)); // 1, 2 , or H if (CHK_ForceFullyEvolved.Checked && NUD_Level.Value >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(species)) { - int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); + int randFinalEvo() => (int)(Util.Random32() % FinalEvo.Length); species = FinalEvo[randFinalEvo()]; } @@ -234,7 +234,7 @@ private void ModifyLevels(object sender, EventArgs e) for (int i = 0; i < LB_Encounters.Items.Count; i++) { LB_Encounters.SelectedIndex = i; - NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); + NUD_Level.Value = Randomizer.GetModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value); } WinFormsUtil.Alert("Modified all Levels according to specification!"); } diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs index 76617ca7e2..c88f0cbed8 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.Designer.cs @@ -145,7 +145,7 @@ private void InitializeComponent() this.Name = "TMHMEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "TM / HM Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.dgvTM)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvHM)).EndInit(); this.groupBox1.ResumeLayout(false); diff --git a/pk3DS/Subforms/Gen6/TMHMEditor6.cs b/pk3DS/Subforms/Gen6/TMHMEditor6.cs index e27d533ce6..97b20621b4 100644 --- a/pk3DS/Subforms/Gen6/TMHMEditor6.cs +++ b/pk3DS/Subforms/Gen6/TMHMEditor6.cs @@ -20,24 +20,24 @@ public TMHMEditor6() offset = Util.IndexOfBytes(data, Signature, 0x400000, 0) + 8; codebin = files[0]; movelist[0] = ""; - setupDGV(); - getList(); + SetupDGV(); + GetList(); RandSettings.GetFormSettings(this, groupBox1.Controls); } private static readonly byte[] Signature = {0xD4, 0x00, 0xAE, 0x02, 0xAF, 0x02, 0xB0, 0x02}; private readonly string codebin; - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); private readonly int offset = Main.Config.ORAS ? 0x004A67EE : 0x00464796; // Default private readonly byte[] data; private int dataoffset; - private void getDataOffset() + private void GetDataOffset() { dataoffset = offset; // reset } - private void setupDGV() + private void SetupDGV() { dgvTM.Columns.Clear(); dgvHM.Columns.Clear(); DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); @@ -66,16 +66,16 @@ private void setupDGV() dgvHM.Columns.Add((DataGridViewColumn)dgvMove.Clone()); } - private List tms = new List(); - private List hms = new List(); + private List tms = new(); + private List hms = new(); - private void getList() + private void GetList() { tms = new List(); hms = new List(); dgvTM.Rows.Clear(); - getDataOffset(); + GetDataOffset(); for (int i = 0; i < 92; i++) // 1-92 TMs stored sequentially tms.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i))); for (int i = 92; i < 92 + 5; i++) @@ -101,7 +101,7 @@ private void getList() { dgvHM.Rows.Add(); dgvHM.Rows[i].Cells[0].Value = (i + 1).ToString(); dgvHM.Rows[i].Cells[1].Value = movelist[hmlist[i]]; } } - private void setList() + private void SetList() { // Gather TM/HM list. tms = new List(); @@ -134,8 +134,8 @@ private void setList() } // Set Move Text Descriptions back into Item Text File - string[] itemDescriptions = Main.Config.getText(TextName.ItemFlavor); - string[] moveDescriptions = Main.Config.getText(TextName.MoveFlavor); + string[] itemDescriptions = Main.Config.GetText(TextName.ItemFlavor); + string[] moveDescriptions = Main.Config.GetText(TextName.MoveFlavor); for (int i = 1 - 1; i <= 92 - 1; i++) // TM01 - TM92 itemDescriptions[328 + i] = moveDescriptions[tmlist[i]]; for (int i = 93 - 1; i <= 95 - 1; i++) // TM92 - TM95 @@ -152,9 +152,9 @@ private void setList() Main.Config.SetText(TextName.ItemFlavor, itemDescriptions); } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setList(); + SetList(); File.WriteAllBytes(codebin, data); RandSettings.SetFormSettings(this, groupBox1.Controls); } @@ -168,7 +168,7 @@ private void B_RandomTM_Click(object sender, EventArgs e) Util.Shuffle(randomMoves); int[] hm_xy = { 015, 019, 057, 070, 127 }; - int[] hm_ao = hm_xy.Concat(new int[] { 249, 291 }).ToArray(); + int[] hm_ao = hm_xy.Concat(new[] { 249, 291 }).ToArray(); int[] field = { 148, 249, 290 }; // TMs with field effects int[] banned = { 165, 621 }; // Struggle and Hyperspace Fury int ctr = 0; @@ -203,10 +203,10 @@ private void B_RandomTM_Click(object sender, EventArgs e) WinFormsUtil.Alert("Randomized!"); } - internal static void getTMHMList(bool oras, out ushort[] TMs, out ushort[] HMs) + internal static void GetTMHMList(out ushort[] TMs, out ushort[] HMs) { - TMs = new ushort[0]; - HMs = new ushort[0]; + TMs = Array.Empty(); + HMs = Array.Empty(); if (Main.ExeFSPath == null) return; string[] files = Directory.GetFiles(Main.ExeFSPath); if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) return; diff --git a/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs b/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs index b53079306f..14c7f2e5c9 100644 --- a/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/TitleScreenEditor6.Designer.cs @@ -53,7 +53,7 @@ private void InitializeComponent() this.CB_DARC.Name = "CB_DARC"; this.CB_DARC.Size = new System.Drawing.Size(100, 21); this.CB_DARC.TabIndex = 1; - this.CB_DARC.SelectedIndexChanged += new System.EventHandler(this.changeDARC); + this.CB_DARC.SelectedIndexChanged += new System.EventHandler(this.ChangeDARC); // // CB_File // @@ -64,7 +64,7 @@ private void InitializeComponent() this.CB_File.Name = "CB_File"; this.CB_File.Size = new System.Drawing.Size(400, 21); this.CB_File.TabIndex = 2; - this.CB_File.SelectedIndexChanged += new System.EventHandler(this.changeFile); + this.CB_File.SelectedIndexChanged += new System.EventHandler(this.ChangeFile); // // L_DARCSelect // @@ -100,7 +100,7 @@ private void InitializeComponent() this.Name = "TitleScreenEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Title Screen Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.PB_Image)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs index 27bd62eb62..998b13cbe2 100644 --- a/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs +++ b/pk3DS/Subforms/Gen6/TitleScreenEditor6.cs @@ -17,11 +17,11 @@ public TitleScreenEditor6() { InitializeComponent(); AllowDrop = true; - DragEnter += tabMain_DragEnter; - DragDrop += tabMain_DragDrop; + DragEnter += TC_Main_DragEnter; + DragDrop += TC_Main_DragDrop; PB_Image.AllowDrop = true; - PB_Image.DragEnter += tabMain_DragEnter; - PB_Image.DragDrop += tabMain_DragDrop; + PB_Image.DragEnter += TC_Main_DragEnter; + PB_Image.DragDrop += TC_Main_DragDrop; // Add tooltip to image new ToolTip().SetToolTip(PB_Image, "Click to toggle Green Screen\nRightClick for I/O\nCTRL+Click for Copy->Clipboard."); @@ -31,8 +31,8 @@ public TitleScreenEditor6() ToolStripMenuItem mnuR = new ToolStripMenuItem("Replace with..."); ToolStripMenuItem mnuS = new ToolStripMenuItem("Save as..."); // Assign event handlers - mnuR.Click += clickOpen; - mnuS.Click += clickSave; + mnuR.Click += ClickOpen; + mnuS.Click += ClickSave; // Add to main context menu mnu.Items.AddRange(new ToolStripItem[] { mnuR, mnuS, }); @@ -40,7 +40,7 @@ public TitleScreenEditor6() PB_Image.ContextMenuStrip = mnu; // Set up languages - string[] languages = (Main.Config.ORAS ? new[] {"JP1"} : new string[] {}).Concat(new[] {"DE", "ES", "FR", "IT", "JP", "KO", "EN"}).ToArray(); + string[] languages = (Main.Config.ORAS ? new[] {"JP1"} : Array.Empty()).Concat(new[] {"DE", "ES", "FR", "IT", "JP", "KO", "EN"}).ToArray(); string[] games = Main.Config.ORAS ? new[] {"OR", "AS"} : new[] {"X", "Y"}; for (int i = 0; i < darcs.Length/2; i++) CB_DARC.Items.Add($"{games[0]} - {languages[i]}"); @@ -62,7 +62,7 @@ public TitleScreenEditor6() while (BitConverter.ToUInt32(data, pos) != 0x63726164) { pos += 4; - if (pos >= data.Length) + if (pos >= data.Length) throw new Exception("Invalid DARC?\n\n" + usedFiles[i]); } var darcData = data.Skip(pos).ToArray(); @@ -76,10 +76,10 @@ public TitleScreenEditor6() private readonly DARC[] darcs = new DARC[2 * (Main.Config.ORAS ? 8 : 7)]; private readonly string[] usedFiles = new string[2 * (Main.Config.ORAS ? 8 : 7)]; - private readonly int[] darcFiles = Main.Config.ORAS + private readonly int[] darcFiles = Main.Config.ORAS ? new[] { - 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, + 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, }: new[] { @@ -87,19 +87,21 @@ public TitleScreenEditor6() 474, 475, 476, 477, 478, 479, 480, }; - private void changeDARC(object sender, EventArgs e) + private void ChangeDARC(object sender, EventArgs e) { // When the darc is changed, we need to re-load the files CB_File.Items.Clear(); var darc = darcs[CB_DARC.SelectedIndex]; for (int i = 0; i < darc.Entries.Length; i++) + { if (darc.FileNameTable[i].FileName.Contains(".bclim")) CB_File.Items.Add(darc.FileNameTable[i].FileName); + } CB_File.SelectedIndex = CB_File.Items.Count - 1; // Load last (version) } - private void changeFile(object sender, EventArgs e) + private void ChangeFile(object sender, EventArgs e) { // When the file is changed, we need to display the new file. string filename = CB_File.Text; @@ -107,16 +109,18 @@ private void changeFile(object sender, EventArgs e) // Find entry in darc var darc = darcs[CB_DARC.SelectedIndex]; for (int i = 0; i < darc.Entries.Length; i++) - if (darc.FileNameTable[i].FileName == filename) - { - entry = i; - break; - } + { + if (darc.FileNameTable[i].FileName != filename) + continue; + entry = i; + break; + } + if (entry < 0) throw new Exception("File not found!?"); // Load file byte[] data = darc.Data.Skip((int)(darc.Entries[entry].DataOffset - darc.Header.FileDataOffset)).Take((int)darc.Entries[entry].DataLength).ToArray(); - BCLIM bclim = BCLIM.analyze(data, filename); + BCLIM bclim = BCLIM.Analyze(data, filename); Image CropBMP = bclim.GetBitmap(); PB_Image.Image = CropBMP; @@ -128,7 +132,7 @@ private void changeFile(object sender, EventArgs e) private byte[] currentBytes; - private void insertFile(string path) + private void InsertFile(string path) { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Overwrite image?")) return; @@ -137,7 +141,7 @@ private void insertFile(string path) if (Path.GetExtension(path) == ".bclim") // bclim opened { - var img = BCLIM.analyze(data, path); + var img = BCLIM.Analyze(data, path); if (img.Width != PB_Image.Width || img.Height != PB_Image.Height) { WinFormsUtil.Alert("Image sizes do not match.", @@ -148,17 +152,15 @@ private void insertFile(string path) } else // image { - using (Stream BitmapStream = new MemoryStream(data)) + using Stream BitmapStream = new MemoryStream(data); + Image img = Image.FromStream(BitmapStream); + if (img.Width != PB_Image.Width || img.Height != PB_Image.Height) { - Image img = Image.FromStream(BitmapStream); - if (img.Width != PB_Image.Width || img.Height != PB_Image.Height) - { - WinFormsUtil.Alert("Image sizes do not match.", - $"Width: {img.Width} - {PB_Image.Width}\nHeight: {img.Height} - {PB_Image.Height}"); - return; - } - bclim = BCLIM.IMGToBCLIM(img, '9'); + WinFormsUtil.Alert("Image sizes do not match.", + $"Width: {img.Width} - {PB_Image.Width}\nHeight: {img.Height} - {PB_Image.Height}"); + return; } + bclim = BCLIM.IMGToBCLIM(img, '9'); } string filename = CB_File.Text; @@ -166,33 +168,36 @@ private void insertFile(string path) // Find entry in darc var darc = darcs[CB_DARC.SelectedIndex]; for (int i = 0; i < darc.Entries.Length; i++) + { if (darc.FileNameTable[i].FileName == filename) { entry = i; break; } + } + if (entry < 0) throw new Exception("File not found!?"); - DARC.insertFile(ref darc, entry, bclim); + DARC.InsertFile(ref darc, entry, bclim); darcs[CB_DARC.SelectedIndex] = darc; // Trigger reloading of the image - changeFile(null, null); + ChangeFile(null, null); } // Dropping file in - private void tabMain_DragEnter(object sender, DragEventArgs e) + private void TC_Main_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } - private void tabMain_DragDrop(object sender, DragEventArgs e) + private void TC_Main_DragDrop(object sender, DragEventArgs e) { string path = ((string[])e.Data.GetData(DataFormats.FileDrop))[0]; // open first D&D - insertFile(path); + InsertFile(path); } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { if (compressed) WinFormsUtil.Alert("Recompressing may take some time...", "Don't panic if the Progress Bar doesn't move!"); @@ -207,25 +212,25 @@ private void formClosing(object sender, FormClosingEventArgs e) if (pos >= data.Length) return; } byte[] preData = data.Take(pos).ToArray(); - byte[] darcData = DARC.setDARC(darcs[i]); + byte[] darcData = DARC.SetDARC(darcs[i]); byte[] newData = preData.Concat(darcData).ToArray(); byte[] oldDarc = File.ReadAllBytes(usedFiles[i]); if (newData.SequenceEqual(oldDarc)) // if same, just continue. { - if (compressed) + if (compressed) File.Delete(usedFiles[i]); // Use old compressed file (speedup) } else // File is different, replace and allow repacking to compress. { - if (compressed) + if (compressed) File.Delete(files[darcFiles[i]]); // delete the old compressed file File.WriteAllBytes(usedFiles[i], newData); // write the new edited (uncompressed) file } } } - private void clickSave(object sender, EventArgs e) + private void ClickSave(object sender, EventArgs e) { var sfd = new SaveFileDialog { @@ -241,17 +246,15 @@ private void clickSave(object sender, EventArgs e) else // PNG { Image img = PB_Image.Image; - using (MemoryStream ms = new MemoryStream()) - { - //error will throw from here - img.Save(ms, ImageFormat.Png); - byte[] data = ms.ToArray(); - File.WriteAllBytes(sfd.FileName, data); - } + using MemoryStream ms = new MemoryStream(); + //error will throw from here + img.Save(ms, ImageFormat.Png); + byte[] data = ms.ToArray(); + File.WriteAllBytes(sfd.FileName, data); } } - private void clickOpen(object sender, EventArgs e) + private void ClickOpen(object sender, EventArgs e) { var ofd = new OpenFileDialog { @@ -260,7 +263,7 @@ private void clickOpen(object sender, EventArgs e) }; if (ofd.ShowDialog() != DialogResult.OK) return; - insertFile(ofd.FileName); + InsertFile(ofd.FileName); } private void PB_Image_Click(object sender, EventArgs e) diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index 365c385030..5bc2fefca2 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -212,7 +212,7 @@ private void InitializeComponent() 0, 0, 0}); - this.NUD_GiftPercent.ValueChanged += new System.EventHandler(this.changeGiftPercent); + this.NUD_GiftPercent.ValueChanged += new System.EventHandler(this.ChangeGiftPercent); // // label1 // @@ -252,7 +252,7 @@ private void InitializeComponent() 0, 0, 65536}); - this.NUD_Level.ValueChanged += new System.EventHandler(this.changeLevelPercent); + this.NUD_Level.ValueChanged += new System.EventHandler(this.ChangeLevelPercent); // // CHK_Level // @@ -596,7 +596,7 @@ private void InitializeComponent() this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(135, 21); this.CB_Moves.TabIndex = 330; - this.CB_Moves.SelectedIndexChanged += new System.EventHandler(this.changeMoveRandomization); + this.CB_Moves.SelectedIndexChanged += new System.EventHandler(this.ChangeMoveRandomization); // // L_Moves // diff --git a/pk3DS/Subforms/Gen6/TrainerRand.cs b/pk3DS/Subforms/Gen6/TrainerRand.cs index e02204feee..d461d92965 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.cs @@ -13,18 +13,18 @@ public TrainerRand() { InitializeComponent(); CB_Moves.SelectedIndex = 1; - trClassnorep = new List(); + var trClassnorep = new List(); foreach (string tclass in trClass.Where(tclass => !trClassnorep.Contains(tclass) && !tclass.StartsWith("[~"))) trClassnorep.Add(tclass); trClassnorep.Sort(); RandSettings.GetFormSettings(this, Controls); } - private readonly string[] trName = Main.Config.getText(TextName.TrainerNames); - private readonly string[] trClass = Main.Config.getText(TextName.TrainerClasses); - private readonly List trClassnorep; - private static int[] Legendary = Legal.Legendary_6; - private static int[] Mythical = Legal.Mythical_6; + //private readonly string[] trName = Main.Config.GetText(TextName.TrainerNames); + private readonly string[] trClass = Main.Config.GetText(TextName.TrainerClasses); + //private readonly List trClassnorep; + private static readonly int[] Legendary = Legal.Legendary_6; + private static readonly int[] Mythical = Legal.Mythical_6; private void B_Close_Click(object sender, EventArgs e) { @@ -65,7 +65,7 @@ private void B_Save_Click(object sender, EventArgs e) ? Main.Config.ORAS ? Legal.SpecialClasses_ORAS : Legal.SpecialClasses_XY - : new int[] {}; + : Array.Empty(); RSTE.rOnlySingles = CHK_OnlySingles.Checked; } RSTE.rGift = CHK_RandomGift.Checked; @@ -85,15 +85,15 @@ private void B_Save_Click(object sender, EventArgs e) if (CHK_StoryMEvos.Checked) { - RSTE.rEnsureMEvo = Main.Config.ORAS - ? new [] { 178, 235, 557, 583, 687, 698, 699, 700, 701, 713, 906, 907, 908, 909, 910, 911, 912, 913, 942, 944, 946 } + RSTE.rEnsureMEvo = Main.Config.ORAS + ? new [] { 178, 235, 557, 583, 687, 698, 699, 700, 701, 713, 906, 907, 908, 909, 910, 911, 912, 913, 942, 944, 946 } : new [] { 188, 263, 276, 277, 519, 520, 521, 526, 599, 600, 601 }; } else { - RSTE.rEnsureMEvo = new int[] { }; + RSTE.rEnsureMEvo = Array.Empty(); } - + RSTE.rThemedClasses = new bool[trClass.Length]; RSTE.rSpeciesRand = new SpeciesRandomizer(Main.Config) { @@ -124,13 +124,13 @@ private void B_Save_Click(object sender, EventArgs e) private void CHK_RandomPKM_CheckedChanged(object sender, EventArgs e) { - GB_Tweak.Enabled = - CHK_G1.Checked = CHK_G2.Checked = CHK_G3.Checked = - CHK_G4.Checked = CHK_G5.Checked = CHK_G6.Checked = + GB_Tweak.Enabled = + CHK_G1.Checked = CHK_G2.Checked = CHK_G3.Checked = + CHK_G4.Checked = CHK_G5.Checked = CHK_G6.Checked = CHK_L.Checked = CHK_E.Checked = CHK_StoryMEvos.Checked = CHK_ForceFullyEvolved.Checked = CHK_RandomPKM.Checked; - CHK_TypeTheme.Checked = CHK_GymTrainers.Checked = CHK_GymE4Only.Checked = + CHK_TypeTheme.Checked = CHK_GymTrainers.Checked = CHK_GymE4Only.Checked = CHK_BST.Checked = CHK_6PKM.Checked = CHK_RandomMegaForm.Checked = false; // Off by default } @@ -139,7 +139,7 @@ private void CHK_Level_CheckedChanged(object sender, EventArgs e) NUD_Level.Enabled = CHK_Level.Checked; } - private void changeLevelPercent(object sender, EventArgs e) + private void ChangeLevelPercent(object sender, EventArgs e) { CHK_Level.Checked = NUD_Level.Value != 0; } @@ -150,7 +150,7 @@ private void CHK_RandomGift_CheckedChanged(object sender, EventArgs e) NUD_GiftPercent.Value = Convert.ToDecimal(CHK_RandomGift.Checked) * 15; } - private void changeGiftPercent(object sender, EventArgs e) + private void ChangeGiftPercent(object sender, EventArgs e) { CHK_RandomGift.Checked = NUD_GiftPercent.Value != 0; } @@ -164,11 +164,11 @@ private void CHK_TypeTheme_CheckedChanged(object sender, EventArgs e) private void CHK_RandomClass_CheckedChanged(object sender, EventArgs e) { - CHK_IgnoreSpecialClass.Enabled = CHK_IgnoreSpecialClass.Checked = + CHK_IgnoreSpecialClass.Enabled = CHK_IgnoreSpecialClass.Checked = CHK_OnlySingles.Enabled = CHK_OnlySingles.Checked = CHK_RandomClass.Checked; } - private void changeMoveRandomization(object sender, EventArgs e) + private void ChangeMoveRandomization(object sender, EventArgs e) { CHK_Damage.Checked = CHK_STAB.Checked = CHK_Damage.Enabled = CHK_STAB.Enabled = diff --git a/pk3DS/Subforms/Gen6/TutorEditor6.Designer.cs b/pk3DS/Subforms/Gen6/TutorEditor6.Designer.cs index 310a2fbad6..31fa9e88d8 100644 --- a/pk3DS/Subforms/Gen6/TutorEditor6.Designer.cs +++ b/pk3DS/Subforms/Gen6/TutorEditor6.Designer.cs @@ -44,7 +44,7 @@ private void InitializeComponent() this.CB_Location.Name = "CB_Location"; this.CB_Location.Size = new System.Drawing.Size(243, 21); this.CB_Location.TabIndex = 0; - this.CB_Location.SelectedIndexChanged += new System.EventHandler(this.changeIndex); + this.CB_Location.SelectedIndexChanged += new System.EventHandler(this.ChangeIndex); // // dgv // @@ -84,7 +84,7 @@ private void InitializeComponent() this.Name = "TutorEditor6"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Move Tutor Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/pk3DS/Subforms/Gen6/TutorEditor6.cs b/pk3DS/Subforms/Gen6/TutorEditor6.cs index 2dce1a95f9..f7982aa5a5 100644 --- a/pk3DS/Subforms/Gen6/TutorEditor6.cs +++ b/pk3DS/Subforms/Gen6/TutorEditor6.cs @@ -18,7 +18,7 @@ public TutorEditor6() offset = GetDataOffset(data); codebin = files[0]; movelist[0] = ""; - setupDGV(); + SetupDGV(); foreach (string s in locations) CB_Location.Items.Add(s); CB_Location.SelectedIndex = 0; WinFormsUtil.Alert("Changes made do not reflect ingame.", "Still needs more research."); @@ -53,21 +53,21 @@ private static int GetDataOffset(byte[] data) } private readonly string codebin; - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); private readonly byte[] data; private readonly byte[] entries = { 0xF, 0x11, 0x10, 0xF }; // Entries per Tutor private readonly int offset; private int dataoffset; - readonly string[] locations = { "1", "2", "3", "4" }; + private readonly string[] locations = { "1", "2", "3", "4" }; - private void getDataOffset(int index) + private void GetDataOffset(int index) { dataoffset = offset; // reset for (int i = 0; i < index; i++) dataoffset += (2 * entries[i]) + 2; // There's a EndCap } - private void setupDGV() + private void SetupDGV() { DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); { @@ -92,19 +92,19 @@ private void setupDGV() private int entry = -1; - private void changeIndex(object sender, EventArgs e) + private void ChangeIndex(object sender, EventArgs e) { - if (entry > -1) setList(); + if (entry > -1) SetList(); entry = CB_Location.SelectedIndex; - getList(); + GetList(); } - private void getList() + private void GetList() { dgv.Rows.Clear(); int count = entries[entry]; dgv.Rows.Add(count); - getDataOffset(entry); + GetDataOffset(entry); for (int i = 0; i < count; i++) { dgv.Rows[i].Cells[0].Value = i.ToString(); @@ -112,16 +112,16 @@ private void getList() } } - private void setList() + private void SetList() { int count = dgv.Rows.Count; for (int i = 0; i < count; i++) Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(movelist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + (2 * i), 2); } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - if (entry > -1) setList(); + if (entry > -1) SetList(); File.WriteAllBytes(codebin, data); } } diff --git a/pk3DS/Subforms/Gen6/TypeChart6.Designer.cs b/pk3DS/Subforms/Gen6/TypeChart6.Designer.cs index eed8d8db34..e2d7219a0d 100644 --- a/pk3DS/Subforms/Gen6/TypeChart6.Designer.cs +++ b/pk3DS/Subforms/Gen6/TypeChart6.Designer.cs @@ -43,8 +43,8 @@ private void InitializeComponent() this.PB_Chart.Size = new System.Drawing.Size(579, 579); this.PB_Chart.TabIndex = 0; this.PB_Chart.TabStop = false; - this.PB_Chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.clickMouse); - this.PB_Chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.moveMouse); + this.PB_Chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.ClickMouse); + this.PB_Chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MoveMouse); // // B_Cancel // diff --git a/pk3DS/Subforms/Gen6/TypeChart6.cs b/pk3DS/Subforms/Gen6/TypeChart6.cs index 799568af3c..d3f27612fa 100644 --- a/pk3DS/Subforms/Gen6/TypeChart6.cs +++ b/pk3DS/Subforms/Gen6/TypeChart6.cs @@ -9,7 +9,7 @@ namespace pk3DS public partial class TypeChart6 : Form { private readonly string CROPath = Path.Combine(Main.RomFSPath, "DllBattle.cro"); - private readonly string[] types = Main.Config.getText(TextName.Types); + private readonly string[] types = Main.Config.GetText(TextName.Types); private readonly int offset = Main.Config.ORAS ? 0x000DB428 : 0x000D12A8; private readonly byte[] chart = new byte[TypeCount * TypeCount]; private readonly byte[] CROData; @@ -26,12 +26,12 @@ public TypeChart6() CROData = File.ReadAllBytes(CROPath); Array.Copy(CROData, offset, chart, 0, chart.Length); - populateChart(); + PopulateChart(); } - private void populateChart() + private void PopulateChart() { - PB_Chart.Image = TypeChart.getGrid(TypeWidth, TypeCount, chart); + PB_Chart.Image = TypeChart.GetGrid(TypeWidth, TypeCount, chart); } private void B_Save_Click(object sender, EventArgs e) @@ -46,16 +46,16 @@ private void B_Cancel_Click(object sender, EventArgs e) Close(); } - private void moveMouse(object sender, MouseEventArgs e) + private void MoveMouse(object sender, MouseEventArgs e) { GetCoordinate((PictureBox)sender, e, out int X, out int Y); int index = (Y * TypeCount) + X; if (index >= chart.Length) return; - updateLabel(X, Y, chart[index]); + UpdateLabel(X, Y, chart[index]); } - private void clickMouse(object sender, MouseEventArgs e) + private void ClickMouse(object sender, MouseEventArgs e) { GetCoordinate((PictureBox)sender, e, out int X, out int Y); int index = (Y * TypeCount) + X; @@ -64,11 +64,11 @@ private void clickMouse(object sender, MouseEventArgs e) chart[index] = ToggleEffectiveness(chart[index], e.Button == MouseButtons.Left); - updateLabel(X, Y, chart[index]); - populateChart(); + UpdateLabel(X, Y, chart[index]); + PopulateChart(); } - private void updateLabel(int X, int Y, int value) + private void UpdateLabel(int X, int Y, int value) { if (value >= effects.Length || X >= types.Length || Y >= types.Length) return; // clicking and moving outside the box has invalid values @@ -91,9 +91,9 @@ public static void GetCoordinate(Control sender, MouseEventArgs e, out int X, ou X = e.X / TypeWidth; Y = e.Y / TypeWidth; if (e.X == sender.Width - 1 - 2) // tweak because the furthest pixel is unused for transparent effect, and 2 px are used for border - X -= 1; + X--; if (e.Y == sender.Height - 1 - 2) - Y -= 1; + Y--; } public static byte ToggleEffectiveness(byte currentValue, bool increase) diff --git a/pk3DS/Subforms/Gen6/XYWE.Designer.cs b/pk3DS/Subforms/Gen6/XYWE.Designer.cs index 2df7f8d033..8faf893535 100644 --- a/pk3DS/Subforms/Gen6/XYWE.Designer.cs +++ b/pk3DS/Subforms/Gen6/XYWE.Designer.cs @@ -15672,7 +15672,7 @@ private void InitializeComponent() this.B_LevelPlus.TabIndex = 277; this.B_LevelPlus.Text = "× Current"; this.B_LevelPlus.UseVisualStyleBackColor = true; - this.B_LevelPlus.Click += new System.EventHandler(this.modifyLevels); + this.B_LevelPlus.Click += new System.EventHandler(this.ModifyLevels); // // NUD_LevelAmp // diff --git a/pk3DS/Subforms/Gen6/XYWE.cs b/pk3DS/Subforms/Gen6/XYWE.cs index bd64cfe791..2c206775a8 100644 --- a/pk3DS/Subforms/Gen6/XYWE.cs +++ b/pk3DS/Subforms/Gen6/XYWE.cs @@ -12,64 +12,64 @@ public partial class XYWE : Form public XYWE() { InitializeComponent(); - spec = new[] + All_Species = new[] { CB_Grass1, CB_Grass2, CB_Grass3, CB_Grass4, CB_Grass5, CB_Grass6, CB_Grass7, CB_Grass8, CB_Grass9, CB_Grass10, CB_Grass11, CB_Grass12, CB_Yellow1, CB_Yellow2, CB_Yellow3, CB_Yellow4, CB_Yellow5, CB_Yellow6, CB_Yellow7, CB_Yellow8, CB_Yellow9, CB_Yellow10, CB_Yellow11, CB_Yellow12, CB_Purple1, CB_Purple2, CB_Purple3, CB_Purple4, CB_Purple5, CB_Purple6, CB_Purple7, CB_Purple8, CB_Purple9, CB_Purple10, CB_Purple11, CB_Purple12, CB_Red1, CB_Red2, CB_Red3, CB_Red4, CB_Red5, CB_Red6, CB_Red7, CB_Red8, CB_Red9, CB_Red10, CB_Red11, CB_Red12, CB_RT1, CB_RT2, CB_RT3, CB_RT4, CB_RT5, CB_RT6, CB_RT7, CB_RT8, CB_RT9, CB_RT10, CB_RT11, CB_RT12, - CB_Surf1, CB_Surf2, CB_Surf3, CB_Surf4, CB_Surf5, - CB_RockSmash1, CB_RockSmash2, CB_RockSmash3, CB_RockSmash4, CB_RockSmash5, - CB_Old1, CB_Old2, CB_Old3, + CB_Surf1, CB_Surf2, CB_Surf3, CB_Surf4, CB_Surf5, + CB_RockSmash1, CB_RockSmash2, CB_RockSmash3, CB_RockSmash4, CB_RockSmash5, + CB_Old1, CB_Old2, CB_Old3, CB_Good1, CB_Good2, CB_Good3, CB_Super1, CB_Super2, CB_Super3, CB_HordeA1, CB_HordeA2, CB_HordeA3, CB_HordeA4, CB_HordeA5, CB_HordeB1, CB_HordeB2, CB_HordeB3, CB_HordeB4, CB_HordeB5, CB_HordeC1, CB_HordeC2, CB_HordeC3, CB_HordeC4, CB_HordeC5, }; - min = new[] + All_Min = new[] { NUP_GrassMin1, NUP_GrassMin2, NUP_GrassMin3, NUP_GrassMin4, NUP_GrassMin5, NUP_GrassMin6, NUP_GrassMin7, NUP_GrassMin8, NUP_GrassMin9, NUP_GrassMin10, NUP_GrassMin11, NUP_GrassMin12, NUP_YellowMin1, NUP_YellowMin2, NUP_YellowMin3, NUP_YellowMin4, NUP_YellowMin5, NUP_YellowMin6, NUP_YellowMin7, NUP_YellowMin8, NUP_YellowMin9, NUP_YellowMin10, NUP_YellowMin11, NUP_YellowMin12, NUP_PurpleMin1, NUP_PurpleMin2, NUP_PurpleMin3, NUP_PurpleMin4, NUP_PurpleMin5, NUP_PurpleMin6, NUP_PurpleMin7, NUP_PurpleMin8, NUP_PurpleMin9, NUP_PurpleMin10, NUP_PurpleMin11, NUP_PurpleMin12, NUP_RedMin1, NUP_RedMin2, NUP_RedMin3, NUP_RedMin4, NUP_RedMin5, NUP_RedMin6, NUP_RedMin7, NUP_RedMin8, NUP_RedMin9, NUP_RedMin10, NUP_RedMin11, NUP_RedMin12, NUP_RTMin1, NUP_RTMin2, NUP_RTMin3, NUP_RTMin4, NUP_RTMin5, NUP_RTMin6, NUP_RTMin7, NUP_RTMin8, NUP_RTMin9, NUP_RTMin10, NUP_RTMin11, NUP_RTMin12, - NUP_SurfMin1, NUP_SurfMin2, NUP_SurfMin3, NUP_SurfMin4, NUP_SurfMin5, - NUP_RockSmashMin1, NUP_RockSmashMin2, NUP_RockSmashMin3, NUP_RockSmashMin4, NUP_RockSmashMin5, - NUP_OldMin1, NUP_OldMin2, NUP_OldMin3, + NUP_SurfMin1, NUP_SurfMin2, NUP_SurfMin3, NUP_SurfMin4, NUP_SurfMin5, + NUP_RockSmashMin1, NUP_RockSmashMin2, NUP_RockSmashMin3, NUP_RockSmashMin4, NUP_RockSmashMin5, + NUP_OldMin1, NUP_OldMin2, NUP_OldMin3, NUP_GoodMin1, NUP_GoodMin2, NUP_GoodMin3, NUP_SuperMin1, NUP_SuperMin2, NUP_SuperMin3, NUP_HordeAMin1, NUP_HordeAMin2, NUP_HordeAMin3, NUP_HordeAMin4, NUP_HordeAMin5, NUP_HordeBMin1, NUP_HordeBMin2, NUP_HordeBMin3, NUP_HordeBMin4, NUP_HordeBMin5, NUP_HordeCMin1, NUP_HordeCMin2, NUP_HordeCMin3, NUP_HordeCMin4, NUP_HordeCMin5, }; - max = new[] + All_Max = new[] { NUP_GrassMax1, NUP_GrassMax2, NUP_GrassMax3, NUP_GrassMax4, NUP_GrassMax5, NUP_GrassMax6, NUP_GrassMax7, NUP_GrassMax8, NUP_GrassMax9, NUP_GrassMax10, NUP_GrassMax11, NUP_GrassMax12, NUP_YellowMax1, NUP_YellowMax2, NUP_YellowMax3, NUP_YellowMax4, NUP_YellowMax5, NUP_YellowMax6, NUP_YellowMax7, NUP_YellowMax8, NUP_YellowMax9, NUP_YellowMax10, NUP_YellowMax11, NUP_YellowMax12, NUP_PurpleMax1, NUP_PurpleMax2, NUP_PurpleMax3, NUP_PurpleMax4, NUP_PurpleMax5, NUP_PurpleMax6, NUP_PurpleMax7, NUP_PurpleMax8, NUP_PurpleMax9, NUP_PurpleMax10, NUP_PurpleMax11, NUP_PurpleMax12, NUP_RedMax1, NUP_RedMax2, NUP_RedMax3, NUP_RedMax4, NUP_RedMax5, NUP_RedMax6, NUP_RedMax7, NUP_RedMax8, NUP_RedMax9, NUP_RedMax10, NUP_RedMax11, NUP_RedMax12, - NUP_RTMax1, NUP_RTMax2, NUP_RTMax3, NUP_RTMax4, NUP_RTMax5, NUP_RTMax6, NUP_RTMax7, NUP_RTMax8, NUP_RTMax9, NUP_RTMax10, NUP_RTMax11, NUP_RTMax12, - NUP_SurfMax1, NUP_SurfMax2, NUP_SurfMax3, NUP_SurfMax4, NUP_SurfMax5, - NUP_RockSmashMax1, NUP_RockSmashMax2, NUP_RockSmashMax3, NUP_RockSmashMax4, NUP_RockSmashMax5, - NUP_OldMax1, NUP_OldMax2, NUP_OldMax3, + NUP_RTMax1, NUP_RTMax2, NUP_RTMax3, NUP_RTMax4, NUP_RTMax5, NUP_RTMax6, NUP_RTMax7, NUP_RTMax8, NUP_RTMax9, NUP_RTMax10, NUP_RTMax11, NUP_RTMax12, + NUP_SurfMax1, NUP_SurfMax2, NUP_SurfMax3, NUP_SurfMax4, NUP_SurfMax5, + NUP_RockSmashMax1, NUP_RockSmashMax2, NUP_RockSmashMax3, NUP_RockSmashMax4, NUP_RockSmashMax5, + NUP_OldMax1, NUP_OldMax2, NUP_OldMax3, NUP_GoodMax1, NUP_GoodMax2, NUP_GoodMax3, NUP_SuperMax1, NUP_SuperMax2, NUP_SuperMax3, NUP_HordeAMax1, NUP_HordeAMax2, NUP_HordeAMax3, NUP_HordeAMax4, NUP_HordeAMax5, NUP_HordeBMax1, NUP_HordeBMax2, NUP_HordeBMax3, NUP_HordeBMax4, NUP_HordeBMax5, NUP_HordeCMax1, NUP_HordeCMax2, NUP_HordeCMax3, NUP_HordeCMax4, NUP_HordeCMax5, }; - form = new[] + All_Form = new[] { NUP_GrassForme1, NUP_GrassForme2, NUP_GrassForme3, NUP_GrassForme4, NUP_GrassForme5, NUP_GrassForme6, NUP_GrassForme7, NUP_GrassForme8, NUP_GrassForme9, NUP_GrassForme10, NUP_GrassForme11, NUP_GrassForme12, NUP_YellowForme1, NUP_YellowForme2, NUP_YellowForme3, NUP_YellowForme4, NUP_YellowForme5, NUP_YellowForme6, NUP_YellowForme7, NUP_YellowForme8, NUP_YellowForme9, NUP_YellowForme10, NUP_YellowForme11, NUP_YellowForme12, NUP_PurpleForme1, NUP_PurpleForme2, NUP_PurpleForme3, NUP_PurpleForme4, NUP_PurpleForme5, NUP_PurpleForme6, NUP_PurpleForme7, NUP_PurpleForme8, NUP_PurpleForme9, NUP_PurpleForme10, NUP_PurpleForme11, NUP_PurpleForme12, NUP_RedForme1, NUP_RedForme2, NUP_RedForme3, NUP_RedForme4, NUP_RedForme5, NUP_RedForme6, NUP_RedForme7, NUP_RedForme8, NUP_RedForme9, NUP_RedForme10, NUP_RedForme11, NUP_RedForme12, NUP_RTForme1, NUP_RTForme2, NUP_RTForme3, NUP_RTForme4, NUP_RTForme5, NUP_RTForme6, NUP_RTForme7, NUP_RTForme8, NUP_RTForme9, NUP_RTForme10, NUP_RTForme11, NUP_RTForme12, - NUP_SurfForme1, NUP_SurfForme2, NUP_SurfForme3, NUP_SurfForme4, NUP_SurfForme5, - NUP_RockSmashForme1, NUP_RockSmashForme2, NUP_RockSmashForme3, NUP_RockSmashForme4, NUP_RockSmashForme5, - NUP_OldForme1, NUP_OldForme2, NUP_OldForme3, + NUP_SurfForme1, NUP_SurfForme2, NUP_SurfForme3, NUP_SurfForme4, NUP_SurfForme5, + NUP_RockSmashForme1, NUP_RockSmashForme2, NUP_RockSmashForme3, NUP_RockSmashForme4, NUP_RockSmashForme5, + NUP_OldForme1, NUP_OldForme2, NUP_OldForme3, NUP_GoodForme1, NUP_GoodForme2, NUP_GoodForme3, NUP_SuperForme1, NUP_SuperForme2, NUP_SuperForme3, NUP_HordeAForme1, NUP_HordeAForme2, NUP_HordeAForme3, NUP_HordeAForme4, NUP_HordeAForme5, @@ -274,46 +274,46 @@ public XYWE() "Megas-Mega (Y) - 2", }; Load_XYWE(); - openQuick(Directory.GetFiles("encdata")); + OpenQuick(Directory.GetFiles("encdata")); RandSettings.GetFormSettings(this, GB_Tweak.Controls); } - private readonly ComboBox[] spec; - private readonly NumericUpDown[] min; - private readonly NumericUpDown[] max; - private readonly NumericUpDown[] form; - string[] specieslist = { }; - readonly string[] formlist = { }; - string[] metXY_00000 = { }; - byte[] zonedata = { }; - string[] LocationNames = { }; + private readonly ComboBox[] All_Species; + private readonly NumericUpDown[] All_Min; + private readonly NumericUpDown[] All_Max; + private readonly NumericUpDown[] All_Form; + private string[] specieslist = Array.Empty(); + private readonly string[] formlist = Array.Empty(); + private string[] metXY_00000 = Array.Empty(); + private byte[] zonedata = Array.Empty(); + private string[] LocationNames = Array.Empty(); private string[] encdatapaths; private string[] filepaths; private void Load_XYWE() { - specieslist = Main.Config.getText(TextName.SpeciesNames); + specieslist = Main.Config.GetText(TextName.SpeciesNames); specieslist[0] = "---"; CB_FormeList.Items.AddRange(formlist); // Clear & Reset Data - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { - spec[i].Items.Clear(); + All_Species[i].Items.Clear(); foreach (string s in specieslist) - spec[i].Items.Add(s); - spec[i].SelectedIndex = 0; + All_Species[i].Items.Add(s); + All_Species[i].SelectedIndex = 0; } } - private void openQuick(string[] encdata) + private void OpenQuick(string[] encdata) { encdatapaths = encdata; Array.Sort(encdatapaths); filepaths = new string[encdatapaths.Length - 1]; Array.Copy(encdatapaths, 1, filepaths, 0, filepaths.Length); - metXY_00000 = Main.Config.getText(TextName.metlist_000000); + metXY_00000 = Main.Config.GetText(TextName.metlist_000000); zonedata = File.ReadAllBytes(encdatapaths[0]); LocationNames = new string[filepaths.Length]; for (int f = 0; f < filepaths.Length; f++) @@ -331,39 +331,39 @@ private void openQuick(string[] encdata) CB_LocationID_SelectedIndexChanged(null, null); } - private bool hasData() + private bool HasData() { - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { - if (spec[i].SelectedIndex > 0) { return true; } - if (form[i].Value > 0) { return true; } - if (min[i].Value > 0) { return true; } - if (max[i].Value > 0) { return true; } + if (All_Species[i].SelectedIndex > 0) { return true; } + if (All_Form[i].Value > 0) { return true; } + if (All_Min[i].Value > 0) { return true; } + if (All_Max[i].Value > 0) { return true; } } return false; } - private void parse(byte[] ed) + private void ParseEncounterTable(byte[] ed) { // 12,12,12,12,12 // 5,5 // 3,3,3 // 5,5,5, - byte[] slot = new Byte[4]; + byte[] slot = new byte[4]; const int offset = 0x0; // read data into form - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { // Fetch Data Array.Copy(ed, offset + (i * 4), slot, 0, 4); - int[] data = pslot(slot); + int[] data = ParseSlot(slot); // Load Data - spec[i].SelectedIndex = data[0]; - form[i].Value = data[1]; - min[i].Value = data[2]; - max[i].Value = data[3]; + All_Species[i].SelectedIndex = data[0]; + All_Form[i].Value = data[1]; + All_Min[i].Value = data[2]; + All_Max[i].Value = data[3]; } #if DUMPER @@ -377,7 +377,7 @@ private void parse(byte[] ed) #endif } - private int[] pslot(byte[] slot) + private static int[] ParseSlot(byte[] slot) { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; int form = BitConverter.ToUInt16(slot, 0) >> 11; @@ -391,7 +391,7 @@ private int[] pslot(byte[] slot) return data; } - private string parseslot(byte[] slot) + public string ConvertSlotToString(byte[] slot) { int index = BitConverter.ToUInt16(slot, 0) & 0x7FF; if (index == 0) return ""; @@ -400,7 +400,7 @@ private string parseslot(byte[] slot) int max = slot[3]; string species = specieslist[index]; if (form > 0) species += "-" + form; - return species + ',' + min + ',' + max + ','; + return $"{species},{min},{max},"; } private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) @@ -424,22 +424,22 @@ private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) byte[] encounterdata = new byte[0x178]; Array.Copy(filedata, offset, encounterdata, 0, 0x178); - parse(encounterdata); + ParseEncounterTable(encounterdata); } private void ClearData() { - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { // Load Data - spec[i].SelectedIndex = 0; - form[i].Value = 0; - min[i].Value = 0; - max[i].Value = 0; + All_Species[i].SelectedIndex = 0; + All_Form[i].Value = 0; + All_Min[i].Value = 0; + All_Max[i].Value = 0; } } - private byte[] MakeSlotData(int species, int f, int lo, int hi) + private static byte[] MakeSlotData(int species, int f, int lo, int hi) { byte[] data = new byte[4]; Array.Copy(BitConverter.GetBytes(Convert.ToUInt16((Convert.ToUInt16(f) << 11) + Convert.ToUInt16(species))), 0, data, 0, 2); @@ -452,9 +452,9 @@ private byte[] MakeEncounterData() { byte[] ed = new byte[0x178]; const int offset = 0x0; - for (int i = 0; i < max.Length; i++) + for (int i = 0; i < All_Max.Length; i++) { - byte[] data = MakeSlotData(spec[i].SelectedIndex, (int)form[i].Value, (int)min[i].Value, (int)max[i].Value); + byte[] data = MakeSlotData(All_Species[i].SelectedIndex, (int)All_Form[i].Value, (int)All_Min[i].Value, (int)All_Max[i].Value); Array.Copy(data, 0, ed, offset + (i * 4), 4); } return ed; @@ -487,8 +487,8 @@ private void B_Save_Click(object sender, EventArgs e) //overwrite offset so the game actually looks at the data Array.Copy(BitConverter.GetBytes(Convert.ToUInt32(filedata.Length)), 0, preoffset, 0x10, 4); } - byte[] encdata = { }; - if (hasData()) { encdata = MakeEncounterData(); } + byte[] encdata = Array.Empty(); + if (HasData()) { encdata = MakeEncounterData(); } byte[] newdata = ConcatArrays(preoffset, encdata); File.WriteAllBytes(filepath, newdata); } @@ -503,7 +503,7 @@ private void PreloadTabs(object sender, EventArgs e) TabControl_EncounterData.TabPages[0].Show(); } - internal static uint rnd32() => Util.rnd32(); + internal static uint Random32() => Util.Random32(); private void B_Randomize_Click(object sender, EventArgs e) { @@ -534,33 +534,35 @@ private void B_Randomize_Click(object sender, EventArgs e) for (int i = 0; i < CB_LocationID.Items.Count; i++) // for every location { CB_LocationID.SelectedIndex = i; - if (!hasData()) continue; // Don't randomize if doesn't have data. + if (!HasData()) continue; // Don't randomize if doesn't have data. // Assign Levels if (CHK_Level.Checked) - for (int l = 0; l < max.Length; l++) - min[l].Value = max[l].Value = max[l].Value <= 1 ? max[l].Value : Math.Max(1, Math.Min(100, (int)(leveldiff * max[l].Value))); + { + for (int l = 0; l < All_Max.Length; l++) + All_Min[l].Value = All_Max[l].Value = All_Max[l].Value <= 1 ? All_Max[l].Value : Math.Max(1, Math.Min(100, (int)(leveldiff * All_Max[l].Value))); + } // If Distinct Hordes are selected, homogenize int hordeslot = 0; - for (int slot = 0; slot < max.Length; slot++) + for (int slot = 0; slot < All_Max.Length; slot++) { - if (spec[slot].SelectedIndex == 0) continue; - if (CHK_HomogeneousHordes.Checked && slot >= max.Length - 15) + if (All_Species[slot].SelectedIndex == 0) continue; + if (CHK_HomogeneousHordes.Checked && slot >= All_Max.Length - 15) { int shift = hordeslot % 5; hordeslot++; if (shift != 0) { - spec[slot].SelectedIndex = spec[slot - shift].SelectedIndex; - form[slot].Value = form[slot - shift].Value; + All_Species[slot].SelectedIndex = All_Species[slot - shift].SelectedIndex; + All_Form[slot].Value = All_Form[slot - shift].Value; continue; } } - int species = rand.GetRandomSpecies(spec[slot].SelectedIndex); - spec[slot].SelectedIndex = species; - setRandomForm(slot, species); + int species = rand.GetRandomSpecies(All_Species[slot].SelectedIndex); + All_Species[slot].SelectedIndex = species; + SetRandomForm(slot, species); } B_Save_Click(sender, e); } @@ -568,32 +570,32 @@ private void B_Randomize_Click(object sender, EventArgs e) WinFormsUtil.Alert("Randomized all Wild Encounters according to specification!", "Press the Dump Tables button to view the new Wild Encounter information!"); } - private void setRandomForm(int slot, int species) + private void SetRandomForm(int slot, int species) { if (CHK_MegaForm.Checked && Main.SpeciesStat[species].FormeCount > 1 && Legal.Mega_XY.Contains((ushort)species)) - form[slot].Value = rnd32() % Main.SpeciesStat[species].FormeCount; // Slot-Random + All_Form[slot].Value = Random32() % Main.SpeciesStat[species].FormeCount; // Slot-Random else if (species == 666 || species == 665 || species == 664) // Vivillon - form[slot].Value = rnd32() % 20; + All_Form[slot].Value = Random32() % 20; else if (species == 386) // Deoxys - form[slot].Value = rnd32() % 4; + All_Form[slot].Value = Random32() % 4; else if (species == 201) // Unown - form[slot].Value = 31; + All_Form[slot].Value = 31; else if (species == 550) // Basculin - form[slot].Value = rnd32() % 2; + All_Form[slot].Value = Random32() % 2; else if (species == 412 || species == 413) // Wormadam - form[slot].Value = rnd32() % 3; + All_Form[slot].Value = Random32() % 3; else if (species == 422 || species == 423) // Gastrodon - form[slot].Value = rnd32() % 2; + All_Form[slot].Value = Random32() % 2; else if (species == 585 || species == 586) // Sawsbuck - form[slot].Value = rnd32() % 4; + All_Form[slot].Value = Random32() % 4; else if (species == 669 || species == 671) // Flabebe/Florges - form[slot].Value = rnd32() % 5; + All_Form[slot].Value = Random32() % 5; else if (species == 670) // Floette - form[slot].Value = rnd32() % 6; + All_Form[slot].Value = Random32() % 6; else if (species == 710 || species == 711) // Pumpkaboo - form[slot].Value = rnd32() % 4; + All_Form[slot].Value = Random32() % 4; else - form[slot].Value = 0; + All_Form[slot].Value = 0; } private void B_Dump_Click(object sender, EventArgs e) @@ -617,7 +619,7 @@ private string GetEncDataString() string toret = "======" + Environment.NewLine; toret += "Map " + CB_LocationID.Text + "" + Environment.NewLine; toret += "======" + Environment.NewLine; - if (hasData()) + if (HasData()) { toret += $"Grass: {label31.Text} - {CB_Grass1.Text} (Level {NUP_GrassMin1.Text}, Forme: {NUP_GrassForme1.Text}), {label32.Text} - {CB_Grass2.Text} (Level {NUP_GrassMin2.Text}, Forme: {NUP_GrassForme2.Text}), {label33.Text} - {CB_Grass3.Text} (Level {NUP_GrassMin3.Text}, Forme: {NUP_GrassForme3.Text}), {label34.Text} - {CB_Grass4.Text} (Level {NUP_GrassMin4.Text}, Forme: {NUP_GrassForme4.Text}), {label35.Text} - {CB_Grass5.Text} (Level {NUP_GrassMin5.Text}, Forme: {NUP_GrassForme5.Text}), {label36.Text} - {CB_Grass6.Text} (Level {NUP_GrassMin6.Text}, Forme: {NUP_GrassForme6.Text}), {label37.Text} - {CB_Grass7.Text} (Level {NUP_GrassMin7.Text}, Forme: {NUP_GrassForme7.Text}), {label38.Text} - {CB_Grass8.Text} (Level {NUP_GrassMin8.Text}, Forme: {NUP_GrassForme8.Text}), {label39.Text} - {CB_Grass9.Text} (Level {NUP_GrassMin9.Text}, Forme: {NUP_GrassForme9.Text}), {label40.Text} - {CB_Grass10.Text} (Level {NUP_GrassMin10.Text}, Forme: {NUP_GrassForme10.Text}), {label42.Text} - {CB_Grass11.Text} (Level {NUP_GrassMin11.Text}, Forme: {NUP_GrassForme11.Text}), {label41.Text} - {CB_Grass12.Text} (Level {NUP_GrassMin12.Text}, Forme: {NUP_GrassForme12.Text}){Environment.NewLine}"; toret += $"Rough Terrain: {label10.Text} - {CB_RT1.Text} (Level {NUP_RTMin1.Text}, Forme: {NUP_RTForme1.Text}), {label21.Text} - {CB_RT2.Text} (Level {NUP_RTMin2.Text}, Forme: {NUP_RTForme2.Text}), {label20.Text} - {CB_RT3.Text} (Level {NUP_RTMin3.Text}, Forme: {NUP_RTForme3.Text}), {label19.Text} - {CB_RT4.Text} (Level {NUP_RTMin4.Text}, Forme: {NUP_RTForme4.Text}), {label18.Text} - {CB_RT5.Text} (Level {NUP_RTMin5.Text}, Forme: {NUP_RTForme5.Text}), {label17.Text} - {CB_RT6.Text} (Level {NUP_RTMin6.Text}, Forme: {NUP_RTForme6.Text}), {label16.Text} - {CB_RT7.Text} (Level {NUP_RTMin7.Text}, Forme: {NUP_RTForme7.Text}), {label15.Text} - {CB_RT8.Text} (Level {NUP_RTMin8.Text}, Forme: {NUP_RTForme8.Text}), {label14.Text} - {CB_RT9.Text} (Level {NUP_RTMin9.Text}, Forme: {NUP_RTForme9.Text}), {label13.Text} - {CB_RT10.Text} (Level {NUP_RTMin10.Text}, Forme: {NUP_RTForme10.Text}), {label12.Text} - {CB_RT11.Text} (Level {NUP_RTMin11.Text}, Forme: {NUP_RTForme11.Text}), {label11.Text} - {CB_RT12.Text} (Level {NUP_RTMin12.Text}, Forme: {NUP_RTForme12.Text}){Environment.NewLine}"; @@ -635,11 +637,14 @@ private string GetEncDataString() toret = toret.Replace("--- (No Level)", "None"); } else + { toret += "No encounters found." + Environment.NewLine + Environment.NewLine; + } + return toret; } - private void modifyLevels(object sender, EventArgs e) + private void ModifyLevels(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all current Level ranges?", "Cannot undo.") != DialogResult.Yes) return; @@ -656,9 +661,11 @@ private void modifyLevels(object sender, EventArgs e) CB_LocationID.SelectedIndex = i; // Amp Levels - for (int l = 0; l < max.Length; l++) - if (min[l].Value > 1) - min[l].Value = max[l].Value = Randomizer.getModifiedLevel((int)max[l].Value, leveldiff); + for (int l = 0; l < All_Max.Length; l++) + { + if (All_Min[l].Value > 1) + All_Min[l].Value = All_Max[l].Value = Randomizer.GetModifiedLevel((int)All_Max[l].Value, leveldiff); + } // Save Changes B_Save_Click(sender, e); diff --git a/pk3DS/Subforms/Gen7/EggMoveEditor7.Designer.cs b/pk3DS/Subforms/Gen7/EggMoveEditor7.Designer.cs index 6f6dda61ca..1ca87d6513 100644 --- a/pk3DS/Subforms/Gen7/EggMoveEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/EggMoveEditor7.Designer.cs @@ -74,7 +74,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeEntry); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); // // L_Species // @@ -253,7 +253,7 @@ private void InitializeComponent() this.Name = "EggMoveEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Egg Move Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs index ec733a56ff..6839f07164 100644 --- a/pk3DS/Subforms/Gen7/EggMoveEditor7.cs +++ b/pk3DS/Subforms/Gen7/EggMoveEditor7.cs @@ -19,12 +19,12 @@ public EggMoveEditor7(byte[][] infiles) { InitializeComponent(); files = infiles; - string[] species = Main.Config.getText(TextName.SpeciesNames); - string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID); - string[] specieslist = Main.Config.Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal); + string[] species = Main.Config.GetText(TextName.SpeciesNames); + string[][] AltForms = Main.Config.Personal.GetFormList(species, Main.Config.MaxSpeciesID); + string[] specieslist = Main.Config.Personal.GetPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out _, out _); specieslist[0] = movelist[0] = ""; - - setupDGV(); + + SetupDGV(); entries = infiles.Select(z => new EggMoves7(z)).ToArray(); string[] names = new string[entries.Length]; @@ -35,12 +35,11 @@ public EggMoveEditor7(byte[][] infiles) int count = Main.Config.Personal[i].FormeCount; for (int j = 1; j < count; j++) { - if (names[formoff + j - 1] == null) - names[formoff + j - 1] = $"{species[i]} [{AltForms[i][j].Replace(species[i] + " ", "")}]"; + names[formoff + j - 1] ??= $"{species[i]} [{AltForms[i][j].Replace(species[i] + " ", "")}]"; } } - var newlist = names.Select((z, i) => new WinFormsUtil.cbItem{Text = (names[i] ?? "Extra") + $" ({i})", Value = i}); + var newlist = names.Select((_, i) => new ComboItem{Text = (names[i] ?? "Extra") + $" ({i})", Value = i}); newlist = newlist.GroupBy(z => z.Text.StartsWith("Extra")) .Select(z => z.OrderBy(item => item.Text)) .SelectMany(z => z).ToList(); @@ -58,11 +57,11 @@ public EggMoveEditor7(byte[][] infiles) private readonly byte[][] files; private int entry = -1; - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); private bool dumping; - private readonly int[] baseForms, formVal; + //private readonly int[] baseForms, formVal; - private void setupDGV() + private void SetupDGV() { string[] sortedmoves = (string[])movelist.Clone(); Array.Sort(sortedmoves); @@ -79,11 +78,11 @@ private void setupDGV() dgv.Columns.Add(dgvMove); } - private EggMoves pkm = new EggMoves7(new byte[0]); + private EggMoves pkm = new EggMoves7(Array.Empty()); - private void getList() + private void GetList() { - entry = WinFormsUtil.getIndex(CB_Species); + entry = WinFormsUtil.GetIndex(CB_Species); int s = 0, f = 0; if (entry <= Main.Config.MaxSpeciesID) { @@ -96,7 +95,7 @@ private void getList() dgv.Rows.Clear(); pkm = entries[entry]; NUD_FormTable.Value = pkm.FormTableIndex; - if (pkm.Count < 1) { files[entry] = new byte[0]; return; } + if (pkm.Count < 1) { files[entry] = Array.Empty(); return; } dgv.Rows.Add(pkm.Count); // Fill Entries @@ -106,7 +105,7 @@ private void getList() dgv.CancelEdit(); } - private void setList() + private void SetList() { if (entry < 1 || dumping) return; List moves = new List(); @@ -121,10 +120,10 @@ private void setList() entries[entry] = (EggMoves7)pkm; } - private void changeEntry(object sender, EventArgs e) + private void ChangeEntry(object sender, EventArgs e) { - setList(); - getList(); + SetList(); + GetList(); } private void B_RandAll_Click(object sender, EventArgs e) @@ -135,12 +134,12 @@ private void B_RandAll_Click(object sender, EventArgs e) Expand = CHK_Expand.Checked, ExpandTo = (int)NUD_Moves.Value, STAB = CHK_STAB.Checked, - rSTABPercent = NUD_STAB.Value, + STABPercent = NUD_STAB.Value, BannedMoves = new[] { 165, 621, 464 }.Concat(Legal.Z_Moves).ToArray(), // Struggle, Hyperspace Fury, Dark Void }; rand.Execute(); // sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!", "Press the Dump All button to see the new Egg Moves!"); } @@ -171,9 +170,9 @@ private void B_Dump_Click(object sender, EventArgs e) dumping = false; } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setList(); + SetList(); entries.Select(z => z.Write()).ToArray().CopyTo(files, 0); RandSettings.SetFormSettings(this, groupBox1.Controls); } @@ -183,7 +182,7 @@ private void B_Goto_Click(object sender, EventArgs e) CB_Species.SelectedValue = (int)NUD_FormTable.Value; } - private void calcStats() + public void CalcStats() { Move[] MoveData = Main.Config.Moves; int movectr = 0; diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs index c2d3e073cb..1013cdf5fc 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.Designer.cs @@ -133,7 +133,7 @@ private void InitializeComponent() this.CB_Species.Name = "CB_Species"; this.CB_Species.Size = new System.Drawing.Size(121, 21); this.CB_Species.TabIndex = 1; - this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeEntry); + this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry); // // L_Species // @@ -164,7 +164,7 @@ private void InitializeComponent() this.CB_M1.Name = "CB_M1"; this.CB_M1.Size = new System.Drawing.Size(150, 21); this.CB_M1.TabIndex = 6; - this.CB_M1.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M1.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // L_M1 // @@ -184,7 +184,7 @@ private void InitializeComponent() this.CB_I1.Name = "CB_I1"; this.CB_I1.Size = new System.Drawing.Size(101, 21); this.CB_I1.TabIndex = 9; - this.CB_I1.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I1.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // CB_P1 // @@ -291,7 +291,7 @@ private void InitializeComponent() this.NUD_F1.Name = "NUD_F1"; this.NUD_F1.Size = new System.Drawing.Size(45, 20); this.NUD_F1.TabIndex = 64; - this.NUD_F1.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F1.ValueChanged += new System.EventHandler(this.ChangeInto); // // NUD_L1 // @@ -343,7 +343,7 @@ private void InitializeComponent() this.NUD_F2.Name = "NUD_F2"; this.NUD_F2.Size = new System.Drawing.Size(45, 20); this.NUD_F2.TabIndex = 71; - this.NUD_F2.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F2.ValueChanged += new System.EventHandler(this.ChangeInto); // // PB_2 // @@ -372,7 +372,7 @@ private void InitializeComponent() this.CB_I2.Name = "CB_I2"; this.CB_I2.Size = new System.Drawing.Size(101, 21); this.CB_I2.TabIndex = 68; - this.CB_I2.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I2.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // label1 // @@ -393,7 +393,7 @@ private void InitializeComponent() this.CB_M2.Name = "CB_M2"; this.CB_M2.Size = new System.Drawing.Size(150, 21); this.CB_M2.TabIndex = 66; - this.CB_M2.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M2.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // NUD_L3 // @@ -428,7 +428,7 @@ private void InitializeComponent() this.NUD_F3.Name = "NUD_F3"; this.NUD_F3.Size = new System.Drawing.Size(45, 20); this.NUD_F3.TabIndex = 78; - this.NUD_F3.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F3.ValueChanged += new System.EventHandler(this.ChangeInto); // // PB_3 // @@ -457,7 +457,7 @@ private void InitializeComponent() this.CB_I3.Name = "CB_I3"; this.CB_I3.Size = new System.Drawing.Size(101, 21); this.CB_I3.TabIndex = 75; - this.CB_I3.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I3.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // label2 // @@ -478,7 +478,7 @@ private void InitializeComponent() this.CB_M3.Name = "CB_M3"; this.CB_M3.Size = new System.Drawing.Size(150, 21); this.CB_M3.TabIndex = 73; - this.CB_M3.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M3.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // NUD_L4 // @@ -513,7 +513,7 @@ private void InitializeComponent() this.NUD_F4.Name = "NUD_F4"; this.NUD_F4.Size = new System.Drawing.Size(45, 20); this.NUD_F4.TabIndex = 85; - this.NUD_F4.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F4.ValueChanged += new System.EventHandler(this.ChangeInto); // // PB_4 // @@ -542,7 +542,7 @@ private void InitializeComponent() this.CB_I4.Name = "CB_I4"; this.CB_I4.Size = new System.Drawing.Size(101, 21); this.CB_I4.TabIndex = 82; - this.CB_I4.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I4.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // label3 // @@ -563,7 +563,7 @@ private void InitializeComponent() this.CB_M4.Name = "CB_M4"; this.CB_M4.Size = new System.Drawing.Size(150, 21); this.CB_M4.TabIndex = 80; - this.CB_M4.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M4.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // NUD_L5 // @@ -598,7 +598,7 @@ private void InitializeComponent() this.NUD_F5.Name = "NUD_F5"; this.NUD_F5.Size = new System.Drawing.Size(45, 20); this.NUD_F5.TabIndex = 92; - this.NUD_F5.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F5.ValueChanged += new System.EventHandler(this.ChangeInto); // // PB_5 // @@ -627,7 +627,7 @@ private void InitializeComponent() this.CB_I5.Name = "CB_I5"; this.CB_I5.Size = new System.Drawing.Size(101, 21); this.CB_I5.TabIndex = 89; - this.CB_I5.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I5.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // label4 // @@ -648,7 +648,7 @@ private void InitializeComponent() this.CB_M5.Name = "CB_M5"; this.CB_M5.Size = new System.Drawing.Size(150, 21); this.CB_M5.TabIndex = 87; - this.CB_M5.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M5.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // NUD_L6 // @@ -683,7 +683,7 @@ private void InitializeComponent() this.NUD_F6.Name = "NUD_F6"; this.NUD_F6.Size = new System.Drawing.Size(45, 20); this.NUD_F6.TabIndex = 99; - this.NUD_F6.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F6.ValueChanged += new System.EventHandler(this.ChangeInto); // // PB_6 // @@ -712,7 +712,7 @@ private void InitializeComponent() this.CB_I6.Name = "CB_I6"; this.CB_I6.Size = new System.Drawing.Size(101, 21); this.CB_I6.TabIndex = 96; - this.CB_I6.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I6.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // label5 // @@ -733,7 +733,7 @@ private void InitializeComponent() this.CB_M6.Name = "CB_M6"; this.CB_M6.Size = new System.Drawing.Size(150, 21); this.CB_M6.TabIndex = 94; - this.CB_M6.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M6.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // NUD_L7 // @@ -768,7 +768,7 @@ private void InitializeComponent() this.NUD_F7.Name = "NUD_F7"; this.NUD_F7.Size = new System.Drawing.Size(45, 20); this.NUD_F7.TabIndex = 106; - this.NUD_F7.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F7.ValueChanged += new System.EventHandler(this.ChangeInto); // // PB_7 // @@ -797,7 +797,7 @@ private void InitializeComponent() this.CB_I7.Name = "CB_I7"; this.CB_I7.Size = new System.Drawing.Size(101, 21); this.CB_I7.TabIndex = 103; - this.CB_I7.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I7.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // label6 // @@ -818,7 +818,7 @@ private void InitializeComponent() this.CB_M7.Name = "CB_M7"; this.CB_M7.Size = new System.Drawing.Size(150, 21); this.CB_M7.TabIndex = 101; - this.CB_M7.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M7.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // NUD_L8 // @@ -853,7 +853,7 @@ private void InitializeComponent() this.NUD_F8.Name = "NUD_F8"; this.NUD_F8.Size = new System.Drawing.Size(45, 20); this.NUD_F8.TabIndex = 113; - this.NUD_F8.ValueChanged += new System.EventHandler(this.changeInto); + this.NUD_F8.ValueChanged += new System.EventHandler(this.ChangeInto); // // PB_8 // @@ -882,7 +882,7 @@ private void InitializeComponent() this.CB_I8.Name = "CB_I8"; this.CB_I8.Size = new System.Drawing.Size(101, 21); this.CB_I8.TabIndex = 110; - this.CB_I8.SelectedIndexChanged += new System.EventHandler(this.changeInto); + this.CB_I8.SelectedIndexChanged += new System.EventHandler(this.ChangeInto); // // label7 // @@ -903,7 +903,7 @@ private void InitializeComponent() this.CB_M8.Name = "CB_M8"; this.CB_M8.Size = new System.Drawing.Size(150, 21); this.CB_M8.TabIndex = 108; - this.CB_M8.SelectedIndexChanged += new System.EventHandler(this.changeMethod); + this.CB_M8.SelectedIndexChanged += new System.EventHandler(this.ChangeMethod); // // B_Trade // @@ -1019,7 +1019,7 @@ private void InitializeComponent() this.Name = "EvolutionEditor7"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Evolution Editor"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing); ((System.ComponentModel.ISupportInitialize)(this.PB_1)).EndInit(); this.GB_Randomizer.ResumeLayout(false); this.GB_Randomizer.PerformLayout(); diff --git a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs index 0002a07786..76879e5239 100644 --- a/pk3DS/Subforms/Gen7/EvolutionEditor7.cs +++ b/pk3DS/Subforms/Gen7/EvolutionEditor7.cs @@ -21,11 +21,11 @@ public EvolutionEditor7(byte[][] infiles) specieslist[0] = movelist[0] = itemlist[0] = ""; Array.Resize(ref specieslist, Main.Config.MaxSpeciesID + 1); - string[][] AltForms = Main.Config.Personal.getFormList(specieslist, Main.Config.MaxSpeciesID); - specieslist = Main.Config.Personal.getPersonalEntryList(AltForms, specieslist, Main.Config.MaxSpeciesID, out baseForms, out formVal); + string[][] AltForms = Main.Config.Personal.GetFormList(specieslist, Main.Config.MaxSpeciesID); + specieslist = Main.Config.Personal.GetPersonalEntryList(AltForms, specieslist, Main.Config.MaxSpeciesID, out baseForms, out formVal); string[] evolutionMethods = - { + { "", "Level Up with Friendship", "Level Up at Morning with Friendship", @@ -101,16 +101,16 @@ public EvolutionEditor7(byte[][] infiles) private readonly NumericUpDown[] fb, lb; private readonly PictureBox[] pic; private int entry = -1; - private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames); - private readonly string[] movelist = Main.Config.getText(TextName.MoveNames); - private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames); - private readonly string[] typelist = Main.Config.getText(TextName.Types); + private readonly string[] specieslist = Main.Config.GetText(TextName.SpeciesNames); + private readonly string[] movelist = Main.Config.GetText(TextName.MoveNames); + private readonly string[] itemlist = Main.Config.GetText(TextName.ItemNames); + private readonly string[] typelist = Main.Config.GetText(TextName.Types); private bool dumping, loading; private readonly int[] baseForms, formVal; private EvolutionSet evo = new EvolutionSet7(new byte[EvolutionSet7.SIZE]); private readonly int maxEvoMethod; - private void getList() + private void GetList() { entry = Array.IndexOf(specieslist, CB_Species.Text); byte[] input = files[entry]; @@ -129,11 +129,11 @@ private void getList() pb[i].SelectedIndex = evo.PossibleEvolutions[i].Argument; rb[i].SelectedIndex = evo.PossibleEvolutions[i].Species; // Triggers sprite to reload loading = false; - changeInto(rb[i], null); // refresh sprite + ChangeInto(rb[i], null); // refresh sprite } } - private void setList() + private void SetList() { if (entry < 1 || dumping) return; @@ -148,10 +148,10 @@ private void setList() files[entry] = evo.Write(); } - private void changeEntry(object sender, EventArgs e) + private void ChangeEntry(object sender, EventArgs e) { - setList(); - getList(); + SetList(); + GetList(); } private void B_RandAll_Click(object sender, EventArgs e) @@ -159,7 +159,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all resulting species?", "Evolution methods and parameters will stay the same.")) return; - setList(); + SetList(); // Set up advanced randomization options var evos = files.Select(z => new EvolutionSet7(z)).ToArray(); var evoRand = new EvolutionRandomizer(Main.Config, evos); @@ -171,7 +171,7 @@ private void B_RandAll_Click(object sender, EventArgs e) evoRand.Randomizer.Initialize(); evoRand.Execute(); evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); WinFormsUtil.Alert("All Pokémon's Evolutions have been randomized!"); } @@ -181,13 +181,13 @@ private void B_Trade_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Remove all trade evolutions?", "Evolution methods will be altered so that evolutions will be possible with only one game.")) return; - setList(); + SetList(); var evos = files.Select(z => new EvolutionSet7(z)).ToArray(); var evoRand = new EvolutionRandomizer(Main.Config, evos); evoRand.Randomizer.Initialize(); evoRand.ExecuteTrade(); evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item."); } @@ -197,7 +197,7 @@ private void B_EveryLevel_Click(object sender, EventArgs e) if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify evolutions?", "This will make it to where your Pokémon will evolve into something random every time it levels up.")) return; - setList(); + SetList(); var evos = files.Select(z => new EvolutionSet7(z)).ToArray(); var evoRand = new EvolutionRandomizer(Main.Config, evos); evoRand.Randomizer.rBST = CHK_BST.Checked; @@ -209,7 +209,7 @@ private void B_EveryLevel_Click(object sender, EventArgs e) evoRand.ExecuteEvolveEveryLevel(); evoRand.Execute(); // randomize right after evos.Select(z => z.Write()).ToArray().CopyTo(files, 0); - getList(); + GetList(); SystemSounds.Asterisk.Play(); } @@ -257,17 +257,17 @@ private void B_Dump_Click(object sender, EventArgs e) dumping = false; } - private void formClosing(object sender, FormClosingEventArgs e) + private void Form_Closing(object sender, FormClosingEventArgs e) { - setList(); + SetList(); RandSettings.SetFormSettings(this, GB_Randomizer.Controls); } - private void changeMethod(object sender, EventArgs e) + private void ChangeMethod(object sender, EventArgs e) { int op = Array.IndexOf(mb, sender as ComboBox); ushort[] methodCase = - { + { 0,0,0,0,1,0,2,0,2,1,1,1,1,1,1,1,5,2,2,2,2,3,4,1,1,0,0,0, // 27, Past Methods // New Methods 1, // 28 - Dark Type Party @@ -300,7 +300,7 @@ private void changeMethod(object sender, EventArgs e) case 3: // Moves { foreach (string t in movelist) pb[op].Items.Add(t); break; } case 4: // Species - { for (int i = 0; i < specieslist.Length; i++) pb[op].Items.Add(specieslist[i]); break; } + { foreach (var t in specieslist) pb[op].Items.Add(t); break; } case 5: // 0-255 (Beauty) { for (int i = 0; i <= 255; i++) pb[op].Items.Add(i.ToString()); break; } case 6: @@ -311,7 +311,7 @@ private void changeMethod(object sender, EventArgs e) pb[op].SelectedIndex = 0; } - private void changeInto(object sender, EventArgs e) + private void ChangeInto(object sender, EventArgs e) { if (loading || dumping) return; @@ -320,8 +320,8 @@ private void changeInto(object sender, EventArgs e) int form = (int)fb[index].Value; if (form == -1) form = baseForms[species]; - - pic[index].Image = WinFormsUtil.getSprite(species, form, 0, 0, Main.Config); + + pic[index].Image = WinFormsUtil.GetSprite(species, form, 0, 0, Main.Config); } } } diff --git a/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs b/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs index d82cfd4581..c08412f9e3 100644 --- a/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs +++ b/pk3DS/Subforms/Gen7/Experimental/OWSE7.cs @@ -10,32 +10,32 @@ namespace pk3DS { public partial class OWSE7 : Form { - private readonly lzGARCFile EncounterData; - private readonly lzGARCFile WorldData; - private readonly lzGARCFile ZoneData; + private readonly LazyGARCFile EncounterData; + //private readonly LazyGARCFile WorldData; + // private readonly LazyGARCFile ZoneData; - public OWSE7(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd) + public OWSE7(LazyGARCFile ed, LazyGARCFile zd) { EncounterData = ed; - ZoneData = zd; - WorldData = wd; + var ZoneData = zd; + //WorldData = wd; - locationList = Main.Config.getText(TextName.metlist_000000); + locationList = Main.Config.GetText(TextName.metlist_000000); locationList = SMWE.GetGoodLocationList(locationList); InitializeComponent(); var zdFiles = ZoneData.Files; zoneData = zdFiles[0]; - worldData = zdFiles[1]; - loadData(); + //worldData = zdFiles[1]; + LoadData(); } private readonly byte[] zoneData; - private readonly byte[] worldData; + //private readonly byte[] worldData; private readonly string[] locationList; - private void loadData() + private void LoadData() { // get zonedata array var zd = ZoneData7.GetArray(zoneData); @@ -47,22 +47,23 @@ private void loadData() private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e) { - setEntry(); + SetEntry(); entry = CB_LocationID.SelectedIndex; GetEntry(); } private int entry = -1; - private void setEntry() + private void SetEntry() { if (entry < 0) return; + Console.WriteLine($"Setting {CB_LocationID.Text}"); // research only, no set } - private bool loading = false; + private bool loading; private World Map; private void GetEntry() @@ -110,17 +111,17 @@ private class World private bool HasZS => _7 != null; private bool HasZI => _8 != null; - public Script[] ZoneScripts; - public Script[] ZoneInfoScripts; + public readonly Script[] ZoneScripts; + public readonly Script[] ZoneInfoScripts; - public World(lzGARCFile garc, int worldID) + public World(LazyGARCFile garc, int worldID) { int index = worldID*11; _7 = Mini.UnpackMini(garc[index + 7], "ZS"); _8 = Mini.UnpackMini(garc[index + 8], "ZI"); - ZoneScripts = HasZS ? _7.Select(arr => new Script(arr)).ToArray() : new Script[0]; - ZoneInfoScripts = HasZI ? _8.Select(arr => new Script(arr)).ToArray() : new Script[0]; + ZoneScripts = HasZS ? _7.Select(arr => new Script(arr)).ToArray() : Array.Empty