From dc95e1a530c82987ea6f49dec516b9cb56aa3e30 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 6 Aug 2014 17:10:29 -0700 Subject: [PATCH] Label Clicking OT; Item Name Duplicates --- PKX/f1-Main.Designer.cs | 2 ++ PKX/f1-Main.cs | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/PKX/f1-Main.Designer.cs b/PKX/f1-Main.Designer.cs index c387b9b8b..3e99df999 100644 --- a/PKX/f1-Main.Designer.cs +++ b/PKX/f1-Main.Designer.cs @@ -2135,6 +2135,7 @@ public void InitializeComponent() this.Label_PrevOT.TabIndex = 42; this.Label_PrevOT.Text = "OT:"; this.Label_PrevOT.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.Label_PrevOT.Click += new System.EventHandler(this.Label_PrevOT_Click); // // CHK_Triangle // @@ -2443,6 +2444,7 @@ public void InitializeComponent() this.Label_OT.TabIndex = 5; this.Label_OT.Text = "OT:"; this.Label_OT.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.Label_OT.Click += new System.EventHandler(this.Label_OT_Click); // // Label_SID // diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index d5009987e..6c50228c1 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -4664,6 +4664,36 @@ private void Marking_Click(object sender, EventArgs e) cb.Checked = !cb.Checked; getMarkings(); } + private void Label_OT_Click(object sender, EventArgs e) + { + string OT = TrimFromZero(Encoding.Unicode.GetString(savefile, 0x19448 + savindex*0x7F000, 0x1A)); + if (OT.Length > 0) + { + TB_OT.Text = OT; + // Set Gender Label + int g6trgend = savefile[0x19405 + savindex * 0x7F000]; + if (g6trgend == 1) + Label_OTGender.Text = "♀"; + else Label_OTGender.Text = "♂"; + + // Get TID/SID + TB_TID.Text = BitConverter.ToUInt16(savefile, 0x19400 + savindex * 0x7F000).ToString(); + TB_SID.Text = BitConverter.ToUInt16(savefile, 0x19402 + savindex * 0x7F000).ToString(); + } + } + private void Label_PrevOT_Click(object sender, EventArgs e) + { + string OT = TrimFromZero(Encoding.Unicode.GetString(savefile, 0x19448 + savindex*0x7F000, 0x1A)); + if (OT.Length > 0) + { + TB_OTt2.Text = OT; + // Set Gender Label + int g6trgend = savefile[0x19405 + savindex * 0x7F000]; + if (g6trgend == 1) + Label_CTGender.Text = "♀"; + else Label_CTGender.Text = "♂"; + } + } // Prompted Updates of PKX Functions // public static string RemoveTroublesomeCharacters(TextBox tb) { @@ -7958,6 +7988,17 @@ private void getSlotFiller(int offset, PictureBox pb) Array.Copy(savefile, offset, slotdata, 0, 0xE8); // Fill Our EKX Slot byte[] dslotdata = decryptArray(slotdata); + ushort chk = 0; + for (int i = 8; i < 232; i += 2) // Loop through the entire PKX + chk += BitConverter.ToUInt16(dslotdata,i); + + if (chk != BitConverter.ToUInt16(dslotdata, 6) && !slotdata.SequenceEqual(new Byte[0xE8])) + { + pb.Image = null; + pb.BackColor = Color.Red; + return; + } + else pb.BackColor = Color.Transparent; int species = BitConverter.ToInt16(dslotdata, 0x08); // Get Species uint isegg = (BitConverter.ToUInt32(dslotdata, 0x74) >> 30) & 1; @@ -8490,6 +8531,11 @@ private void InitializeStrings() itempouch = getStringList("ItemPouch", l); wallpapernames = getStringList("Wallpaper", l); + // Fix Item Names (Duplicate entries) + itemlist[629] += " (2)"; + itemlist[707] += " (2)"; + itemlist[713] += " (2)"; + // Get the Egg Name and then replace it with --- for the comboboxes. eggname = specieslist[0]; specieslist[0] = "---"; @@ -8683,6 +8729,7 @@ public class ImageTransparency { public static Bitmap ChangeOpacity(Image img, double opacityvalue) { + if (img == null) return null; Bitmap bmp = new Bitmap(img.Width, img.Height); // Determining Width and Height of Source Image Graphics graphics = Graphics.FromImage(bmp); ColorMatrix colormatrix = new ColorMatrix();