From b3b2a9a46a1c8b0883e148aa7fbd4a4bb9d1484f Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 12 Jan 2015 22:17:26 -0800 Subject: [PATCH] Finish dumping options --- pk3DS/Subforms/Maison.Designer.cs | 12 +++++ pk3DS/Subforms/Maison.cs | 83 +++++++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 5 deletions(-) diff --git a/pk3DS/Subforms/Maison.Designer.cs b/pk3DS/Subforms/Maison.Designer.cs index ffbdfc6..e6317b1 100644 --- a/pk3DS/Subforms/Maison.Designer.cs +++ b/pk3DS/Subforms/Maison.Designer.cs @@ -66,6 +66,7 @@ private void InitializeComponent() // // CB_Trainer // + this.CB_Trainer.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Trainer.FormattingEnabled = true; this.CB_Trainer.Location = new System.Drawing.Point(67, 8); this.CB_Trainer.Name = "CB_Trainer"; @@ -75,6 +76,7 @@ private void InitializeComponent() // // CB_Pokemon // + this.CB_Pokemon.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Pokemon.FormattingEnabled = true; this.CB_Pokemon.Location = new System.Drawing.Point(361, 8); this.CB_Pokemon.Name = "CB_Pokemon"; @@ -156,6 +158,7 @@ private void InitializeComponent() // // CB_Class // + this.CB_Class.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Class.FormattingEnabled = true; this.CB_Class.Location = new System.Drawing.Point(55, 20); this.CB_Class.Name = "CB_Class"; @@ -295,6 +298,7 @@ private void InitializeComponent() // // CB_Item // + this.CB_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Item.FormattingEnabled = true; this.CB_Item.Location = new System.Drawing.Point(65, 156); this.CB_Item.Name = "CB_Item"; @@ -303,6 +307,7 @@ private void InitializeComponent() // // CB_Nature // + this.CB_Nature.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Nature.FormattingEnabled = true; this.CB_Nature.Location = new System.Drawing.Point(65, 129); this.CB_Nature.Name = "CB_Nature"; @@ -311,6 +316,7 @@ private void InitializeComponent() // // CB_Move4 // + this.CB_Move4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Move4.FormattingEnabled = true; this.CB_Move4.Location = new System.Drawing.Point(140, 91); this.CB_Move4.Name = "CB_Move4"; @@ -319,6 +325,7 @@ private void InitializeComponent() // // CB_Move2 // + this.CB_Move2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Move2.FormattingEnabled = true; this.CB_Move2.Location = new System.Drawing.Point(140, 64); this.CB_Move2.Name = "CB_Move2"; @@ -327,6 +334,7 @@ private void InitializeComponent() // // CB_Move3 // + this.CB_Move3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Move3.FormattingEnabled = true; this.CB_Move3.Location = new System.Drawing.Point(13, 91); this.CB_Move3.Name = "CB_Move3"; @@ -335,6 +343,7 @@ private void InitializeComponent() // // CB_Move1 // + this.CB_Move1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Move1.FormattingEnabled = true; this.CB_Move1.Location = new System.Drawing.Point(13, 64); this.CB_Move1.Name = "CB_Move1"; @@ -343,6 +352,7 @@ private void InitializeComponent() // // CB_Species // + this.CB_Species.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Species.FormattingEnabled = true; this.CB_Species.Location = new System.Drawing.Point(67, 20); this.CB_Species.Name = "CB_Species"; @@ -358,6 +368,7 @@ private void InitializeComponent() this.B_DumpPKs.TabIndex = 6; this.B_DumpPKs.Text = "Dump PKs"; this.B_DumpPKs.UseVisualStyleBackColor = true; + this.B_DumpPKs.Click += new System.EventHandler(this.B_DumpPKs_Click); // // DumpTRs // @@ -367,6 +378,7 @@ private void InitializeComponent() this.DumpTRs.TabIndex = 7; this.DumpTRs.Text = "Dump TRs"; this.DumpTRs.UseVisualStyleBackColor = true; + this.DumpTRs.Click += new System.EventHandler(this.DumpTRs_Click); // // Maison // diff --git a/pk3DS/Subforms/Maison.cs b/pk3DS/Subforms/Maison.cs index 3b10826..621c9bf 100644 --- a/pk3DS/Subforms/Maison.cs +++ b/pk3DS/Subforms/Maison.cs @@ -44,6 +44,7 @@ public Maison(bool rom_oras, bool super) string[] itemlist; int trEntry = -1; int pkEntry = -1; + bool dumping = false; private void Setup() { foreach (string s in trClass) CB_Class.Items.Add(s); @@ -87,7 +88,7 @@ private void getTrainer() } private void setTrainer() { - if (trEntry < 0 || !GB_Trainer.Enabled) return; + if (trEntry < 0 || !GB_Trainer.Enabled || dumping) return; // Gather int trclass = CB_Class.SelectedIndex; int count = LB_Choices.Items.Count; @@ -108,7 +109,7 @@ private void setTrainer() } private void getPokemon() { - if (pkEntry < 0) return; + if (pkEntry < 0 || dumping) return; byte[] data = File.ReadAllBytes(pkFiles[pkEntry]); // Get @@ -131,7 +132,7 @@ private void getPokemon() } private void setPokemon() { - if (pkEntry < 0) return; + if (pkEntry < 0 || dumping) return; // Each File is 16 Bytes. byte[] data = new byte[0x10]; @@ -168,7 +169,6 @@ 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) { @@ -195,7 +195,6 @@ private void B_Set_Click(object sender, EventArgs e) LB_Choices.SelectedIndex = Array.IndexOf(choiceList, toAdd); } } - private void B_View_Click(object sender, EventArgs e) { if (LB_Choices.SelectedIndex > -1 && GB_Trainer.Enabled) @@ -208,5 +207,79 @@ private void formClosing(object sender, FormClosingEventArgs e) setPokemon(); } + private void DumpTRs_Click(object sender, EventArgs e) + { + dumping = true; + string result = ""; + for (int i = 0; i < CB_Trainer.Items.Count; i++) + { + CB_Trainer.SelectedIndex = i; + int count = LB_Choices.Items.Count - 1; + if (count > 0) + { + result += "======" + Environment.NewLine + i + " - (" + CB_Class.Text + ") " + CB_Trainer.Text + Environment.NewLine + "======" + Environment.NewLine; + result += "Choices: "; + for (int c = 0; c < count; c++) + result += LB_Choices.Items[c].ToString() + ", "; + + result += Environment.NewLine; result += Environment.NewLine; + } + } + SaveFileDialog sfd = new SaveFileDialog(); + sfd.FileName = "Maison Trainers.txt"; + sfd.Filter = "Text File|*.txt"; + + System.Media.SystemSounds.Asterisk.Play(); + if (sfd.ShowDialog() == DialogResult.OK) + { + string path = sfd.FileName; + File.WriteAllText(path, result, System.Text.Encoding.Unicode); + } + dumping = false; + CB_Trainer.SelectedIndex = 0; + } + + private void B_DumpPKs_Click(object sender, EventArgs e) + { + dumping = true; + string result = ""; + for (int i = 0; i < CB_Pokemon.Items.Count; i++) + { + CB_Pokemon.SelectedIndex = i; + if (CB_Species.SelectedIndex > 0) + { + result += "======" + Environment.NewLine + i + " - " + CB_Species.Text + Environment.NewLine + "======" + Environment.NewLine; + result += String.Format("Held Item: {0}" + Environment.NewLine, CB_Item.Text); + result += String.Format("Nature: {0}" + Environment.NewLine, CB_Nature.Text); + result += String.Format("Move 1: {0}" + Environment.NewLine, CB_Move1.Text); + result += String.Format("Move 2: {0}" + Environment.NewLine, CB_Move2.Text); + result += String.Format("Move 3: {0}" + Environment.NewLine, CB_Move3.Text); + result += String.Format("Move 4: {0}" + Environment.NewLine, CB_Move4.Text); + + result += "EV'd in: "; + result += (CHK_HP.Checked) ? "HP, " : ""; + result += (CHK_ATK.Checked) ? "ATK, " : ""; + result += (CHK_DEF.Checked) ? "DEF, " : ""; + result += (CHK_SpA.Checked) ? "SpA, " : ""; + result += (CHK_SpD.Checked) ? "SpD, " : ""; + result += (CHK_Spe.Checked) ? "Spe, " : ""; + result += Environment.NewLine; + + result += Environment.NewLine; + } + } + SaveFileDialog sfd = new SaveFileDialog(); + sfd.FileName = "Maison Pokemon.txt"; + sfd.Filter = "Text File|*.txt"; + + System.Media.SystemSounds.Asterisk.Play(); + if (sfd.ShowDialog() == DialogResult.OK) + { + string path = sfd.FileName; + File.WriteAllText(path, result, System.Text.Encoding.Unicode); + } + dumping = false; + CB_Trainer.SelectedIndex = 0; + } } }