diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.Designer.cs
index 22cbb0074..c2d734ccb 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.Designer.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.Designer.cs
@@ -33,26 +33,30 @@ private void InitializeComponent()
this.B_Cancel = new System.Windows.Forms.Button();
this.CB_TreeList = new System.Windows.Forms.ComboBox();
this.L_HoneyTree = new System.Windows.Forms.Label();
- this.L_Pokemon = new System.Windows.Forms.Label();
+ this.L_Slot = new System.Windows.Forms.Label();
this.L_Time = new System.Windows.Forms.Label();
- this.CB_Species = new System.Windows.Forms.ComboBox();
this.L_Shake = new System.Windows.Forms.Label();
this.NUD_Time = new System.Windows.Forms.NumericUpDown();
this.NUD_Shake = new System.Windows.Forms.NumericUpDown();
this.L_Munchlax = new System.Windows.Forms.Label();
this.L_Tree0 = new System.Windows.Forms.Label();
- this.L_Tree1 = new System.Windows.Forms.Label();
- this.L_Tree2 = new System.Windows.Forms.Label();
- this.L_Tree3 = new System.Windows.Forms.Label();
this.B_Catchable = new System.Windows.Forms.Button();
+ this.NUD_Group = new System.Windows.Forms.NumericUpDown();
+ this.L_Group = new System.Windows.Forms.Label();
+ this.NUD_Slot = new System.Windows.Forms.NumericUpDown();
+ this.L_Species = new System.Windows.Forms.Label();
+ this.GB_TreeInfo = new System.Windows.Forms.GroupBox();
((System.ComponentModel.ISupportInitialize)(this.NUD_Time)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Shake)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.NUD_Group)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.NUD_Slot)).BeginInit();
+ this.GB_TreeInfo.SuspendLayout();
this.SuspendLayout();
//
// 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(402, 98);
+ this.B_Save.Location = new System.Drawing.Point(314, 181);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(75, 23);
this.B_Save.TabIndex = 73;
@@ -63,7 +67,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(321, 98);
+ this.B_Cancel.Location = new System.Drawing.Point(233, 181);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(75, 23);
this.B_Cancel.TabIndex = 72;
@@ -100,58 +104,39 @@ private void InitializeComponent()
this.CB_TreeList.Name = "CB_TreeList";
this.CB_TreeList.Size = new System.Drawing.Size(183, 21);
this.CB_TreeList.TabIndex = 74;
- this.CB_TreeList.SelectedIndexChanged += new System.EventHandler(this.CB_TreeList_SelectedIndexChanged);
+ this.CB_TreeList.SelectedIndexChanged += new System.EventHandler(this.changeTree);
//
// L_HoneyTree
//
- this.L_HoneyTree.AutoSize = true;
- this.L_HoneyTree.Location = new System.Drawing.Point(74, 20);
+ this.L_HoneyTree.Location = new System.Drawing.Point(7, 22);
this.L_HoneyTree.Name = "L_HoneyTree";
- this.L_HoneyTree.Size = new System.Drawing.Size(63, 13);
+ this.L_HoneyTree.Size = new System.Drawing.Size(186, 13);
this.L_HoneyTree.TabIndex = 75;
this.L_HoneyTree.Text = "Honey Tree";
+ this.L_HoneyTree.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
- // L_Pokemon
+ // L_Slot
//
- this.L_Pokemon.AutoSize = true;
- this.L_Pokemon.Location = new System.Drawing.Point(234, 20);
- this.L_Pokemon.Name = "L_Pokemon";
- this.L_Pokemon.Size = new System.Drawing.Size(52, 13);
- this.L_Pokemon.TabIndex = 76;
- this.L_Pokemon.Text = "Pokémon";
+ this.L_Slot.AutoSize = true;
+ this.L_Slot.Location = new System.Drawing.Point(48, 16);
+ this.L_Slot.Name = "L_Slot";
+ this.L_Slot.Size = new System.Drawing.Size(25, 13);
+ this.L_Slot.TabIndex = 76;
+ this.L_Slot.Text = "Slot";
//
// L_Time
//
this.L_Time.AutoSize = true;
- this.L_Time.Location = new System.Drawing.Point(336, 20);
+ this.L_Time.Location = new System.Drawing.Point(11, 67);
this.L_Time.Name = "L_Time";
this.L_Time.Size = new System.Drawing.Size(92, 13);
this.L_Time.TabIndex = 77;
this.L_Time.Text = "Time left (minutes)";
//
- // CB_Species
- //
- this.CB_Species.FormattingEnabled = true;
- this.CB_Species.Items.AddRange(new object[] {
- "None",
- "Aipom",
- "Burmy",
- "Cherubi",
- "Combee",
- "Heracross",
- "Munchlax",
- "Silcoon/Cascoon",
- "Wurmple"});
- this.CB_Species.Location = new System.Drawing.Point(199, 36);
- this.CB_Species.Name = "CB_Species";
- this.CB_Species.Size = new System.Drawing.Size(123, 21);
- this.CB_Species.TabIndex = 78;
- this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.CB_Species_SelectedIndexChanged);
- //
// L_Shake
//
this.L_Shake.AutoSize = true;
- this.L_Shake.Location = new System.Drawing.Point(436, 21);
+ this.L_Shake.Location = new System.Drawing.Point(116, 67);
this.L_Shake.Name = "L_Shake";
this.L_Shake.Size = new System.Drawing.Size(38, 13);
this.L_Shake.TabIndex = 79;
@@ -159,7 +144,7 @@ private void InitializeComponent()
//
// NUD_Time
//
- this.NUD_Time.Location = new System.Drawing.Point(328, 37);
+ this.NUD_Time.Location = new System.Drawing.Point(11, 83);
this.NUD_Time.Maximum = new decimal(new int[] {
1440,
0,
@@ -168,11 +153,10 @@ private void InitializeComponent()
this.NUD_Time.Name = "NUD_Time";
this.NUD_Time.Size = new System.Drawing.Size(102, 20);
this.NUD_Time.TabIndex = 80;
- this.NUD_Time.ValueChanged += new System.EventHandler(this.NUD_Time_ValueChanged);
//
// NUD_Shake
//
- this.NUD_Shake.Location = new System.Drawing.Point(436, 37);
+ this.NUD_Shake.Location = new System.Drawing.Point(119, 83);
this.NUD_Shake.Maximum = new decimal(new int[] {
3,
0,
@@ -181,92 +165,124 @@ private void InitializeComponent()
this.NUD_Shake.Name = "NUD_Shake";
this.NUD_Shake.Size = new System.Drawing.Size(36, 20);
this.NUD_Shake.TabIndex = 81;
- this.NUD_Shake.ValueChanged += new System.EventHandler(this.NUD_Shake_ValueChanged);
//
// L_Munchlax
//
this.L_Munchlax.AutoSize = true;
- this.L_Munchlax.Location = new System.Drawing.Point(7, 60);
+ this.L_Munchlax.Location = new System.Drawing.Point(199, 22);
this.L_Munchlax.Name = "L_Munchlax";
- this.L_Munchlax.Size = new System.Drawing.Size(82, 13);
+ this.L_Munchlax.Size = new System.Drawing.Size(86, 13);
this.L_Munchlax.TabIndex = 82;
- this.L_Munchlax.Text = "Munchlax trees:";
+ this.L_Munchlax.Text = "Munchlax Trees:";
//
// L_Tree0
//
this.L_Tree0.AutoSize = true;
- this.L_Tree0.Location = new System.Drawing.Point(12, 73);
+ this.L_Tree0.Location = new System.Drawing.Point(199, 39);
this.L_Tree0.Name = "L_Tree0";
this.L_Tree0.Size = new System.Drawing.Size(164, 13);
this.L_Tree0.TabIndex = 83;
this.L_Tree0.Text = "- Route 205, Floaroma Town side";
//
- // L_Tree1
- //
- this.L_Tree1.AutoSize = true;
- this.L_Tree1.Location = new System.Drawing.Point(12, 86);
- this.L_Tree1.Name = "L_Tree1";
- this.L_Tree1.Size = new System.Drawing.Size(164, 13);
- this.L_Tree1.TabIndex = 84;
- this.L_Tree1.Text = "- Route 205, Floaroma Town side";
- //
- // L_Tree2
- //
- this.L_Tree2.AutoSize = true;
- this.L_Tree2.Location = new System.Drawing.Point(12, 99);
- this.L_Tree2.Name = "L_Tree2";
- this.L_Tree2.Size = new System.Drawing.Size(164, 13);
- this.L_Tree2.TabIndex = 85;
- this.L_Tree2.Text = "- Route 205, Floaroma Town side";
- //
- // L_Tree3
- //
- this.L_Tree3.AutoSize = true;
- this.L_Tree3.Location = new System.Drawing.Point(12, 112);
- this.L_Tree3.Name = "L_Tree3";
- this.L_Tree3.Size = new System.Drawing.Size(164, 13);
- this.L_Tree3.TabIndex = 86;
- this.L_Tree3.Text = "- Route 205, Floaroma Town side";
- //
// B_Catchable
//
this.B_Catchable.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
- this.B_Catchable.Location = new System.Drawing.Point(328, 63);
+ this.B_Catchable.Location = new System.Drawing.Point(11, 109);
this.B_Catchable.Name = "B_Catchable";
- this.B_Catchable.Size = new System.Drawing.Size(100, 20);
+ this.B_Catchable.Size = new System.Drawing.Size(100, 23);
this.B_Catchable.TabIndex = 87;
this.B_Catchable.Text = "Make catchable";
this.B_Catchable.UseVisualStyleBackColor = true;
this.B_Catchable.Click += new System.EventHandler(this.B_Catchable_Click);
//
+ // NUD_Group
+ //
+ this.NUD_Group.Location = new System.Drawing.Point(9, 32);
+ this.NUD_Group.Maximum = new decimal(new int[] {
+ 3,
+ 0,
+ 0,
+ 0});
+ this.NUD_Group.Name = "NUD_Group";
+ this.NUD_Group.Size = new System.Drawing.Size(36, 20);
+ this.NUD_Group.TabIndex = 88;
+ this.NUD_Group.ValueChanged += new System.EventHandler(this.changeGroupSlot);
+ //
+ // L_Group
+ //
+ this.L_Group.AutoSize = true;
+ this.L_Group.Location = new System.Drawing.Point(6, 16);
+ this.L_Group.Name = "L_Group";
+ this.L_Group.Size = new System.Drawing.Size(36, 13);
+ this.L_Group.TabIndex = 89;
+ this.L_Group.Text = "Group";
+ //
+ // NUD_Slot
+ //
+ this.NUD_Slot.Location = new System.Drawing.Point(51, 32);
+ this.NUD_Slot.Maximum = new decimal(new int[] {
+ 5,
+ 0,
+ 0,
+ 0});
+ this.NUD_Slot.Name = "NUD_Slot";
+ this.NUD_Slot.Size = new System.Drawing.Size(36, 20);
+ this.NUD_Slot.TabIndex = 90;
+ this.NUD_Slot.ValueChanged += new System.EventHandler(this.changeGroupSlot);
+ //
+ // L_Species
+ //
+ this.L_Species.Location = new System.Drawing.Point(93, 16);
+ this.L_Species.Name = "L_Species";
+ this.L_Species.Size = new System.Drawing.Size(88, 51);
+ this.L_Species.TabIndex = 91;
+ this.L_Species.Text = "Species";
+ this.L_Species.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // GB_TreeInfo
+ //
+ this.GB_TreeInfo.Controls.Add(this.L_Group);
+ this.GB_TreeInfo.Controls.Add(this.L_Species);
+ this.GB_TreeInfo.Controls.Add(this.L_Slot);
+ this.GB_TreeInfo.Controls.Add(this.NUD_Slot);
+ this.GB_TreeInfo.Controls.Add(this.L_Time);
+ this.GB_TreeInfo.Controls.Add(this.L_Shake);
+ this.GB_TreeInfo.Controls.Add(this.NUD_Group);
+ this.GB_TreeInfo.Controls.Add(this.NUD_Time);
+ this.GB_TreeInfo.Controls.Add(this.B_Catchable);
+ this.GB_TreeInfo.Controls.Add(this.NUD_Shake);
+ this.GB_TreeInfo.Location = new System.Drawing.Point(12, 63);
+ this.GB_TreeInfo.Name = "GB_TreeInfo";
+ this.GB_TreeInfo.Size = new System.Drawing.Size(185, 141);
+ this.GB_TreeInfo.TabIndex = 92;
+ this.GB_TreeInfo.TabStop = false;
+ this.GB_TreeInfo.Text = "Tree Info";
+ //
// SAV_HoneyTree
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(487, 133);
- this.Controls.Add(this.B_Catchable);
- this.Controls.Add(this.L_Tree3);
- this.Controls.Add(this.L_Tree2);
- this.Controls.Add(this.L_Tree1);
+ this.ClientSize = new System.Drawing.Size(399, 216);
+ this.Controls.Add(this.GB_TreeInfo);
this.Controls.Add(this.L_Tree0);
this.Controls.Add(this.L_Munchlax);
- this.Controls.Add(this.NUD_Shake);
- this.Controls.Add(this.NUD_Time);
- this.Controls.Add(this.L_Shake);
- this.Controls.Add(this.CB_Species);
- this.Controls.Add(this.L_Time);
- this.Controls.Add(this.L_Pokemon);
this.Controls.Add(this.L_HoneyTree);
this.Controls.Add(this.CB_TreeList);
this.Controls.Add(this.B_Save);
this.Controls.Add(this.B_Cancel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(200, 150);
this.Name = "SAV_HoneyTree";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Honey Tree Editor";
((System.ComponentModel.ISupportInitialize)(this.NUD_Time)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Shake)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.NUD_Group)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.NUD_Slot)).EndInit();
+ this.GB_TreeInfo.ResumeLayout(false);
+ this.GB_TreeInfo.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -277,17 +293,18 @@ private void InitializeComponent()
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.ComboBox CB_TreeList;
private System.Windows.Forms.Label L_HoneyTree;
- private System.Windows.Forms.Label L_Pokemon;
+ private System.Windows.Forms.Label L_Slot;
private System.Windows.Forms.Label L_Time;
- private System.Windows.Forms.ComboBox CB_Species;
private System.Windows.Forms.Label L_Shake;
private System.Windows.Forms.NumericUpDown NUD_Time;
private System.Windows.Forms.NumericUpDown NUD_Shake;
private System.Windows.Forms.Label L_Munchlax;
private System.Windows.Forms.Label L_Tree0;
- private System.Windows.Forms.Label L_Tree1;
- private System.Windows.Forms.Label L_Tree2;
- private System.Windows.Forms.Label L_Tree3;
private System.Windows.Forms.Button B_Catchable;
+ private System.Windows.Forms.NumericUpDown NUD_Group;
+ private System.Windows.Forms.Label L_Group;
+ private System.Windows.Forms.NumericUpDown NUD_Slot;
+ private System.Windows.Forms.Label L_Species;
+ private System.Windows.Forms.GroupBox GB_TreeInfo;
}
}
\ No newline at end of file
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.cs
index f7a9f9c07..3411d4278 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_HoneyTree.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.Windows.Forms;
using PKHeX.Core;
@@ -13,392 +14,80 @@ public SAV_HoneyTree()
WinFormsUtil.TranslateInterface(this, Main.curlanguage);
if (SAV.DP)
- {
- SAV.getData(SAV.PokeDex - 0x12DC + DP_OFFSET, 8 * 21).CopyTo(TreeBlock, 0);
- }
+ Table = HoneyTree.TableDP;
else if (SAV.Pt)
- {
- SAV.getData(SAV.PokeDex - 0x1328 + PT_OFFSET, 8 * 21).CopyTo(TreeBlock, 0);
- //No silcoon/cascoon in Pt
- CB_Species.Items.Remove(CB_Species.Items[(int)TreeSpecies.Silcoon_Wurmple]);
- }
+ Table = HoneyTree.TablePt;
+
+ // Get Munchlax tree for this savegame in screen
+ MunchlaxTrees = SAV.MunchlaxTrees;
+
+ const string sep = "- ";
+ L_Tree0.Text = string.Join(Environment.NewLine, MunchlaxTrees.Select(z => sep + CB_TreeList.Items[z]));
CB_TreeList.SelectedIndex = 0;
-
- //Get Munchlax tree for this savegame in screen
- A = (SAV.TID >> 8) % 21;
- B = (SAV.TID & 0x00FF) % 21;
- C = (SAV.SID >> 8) % 21;
- D = (SAV.SID & 0x00FF) % 21;
-
- if (A == B)
- {
- B += 1;
- if (B == 21)
- B = 0;
- }
- if (A == C)
- {
- C += 1;
- if (C == 21)
- C = 0;
- }
- if (B == C)
- {
- C += 1;
- if (C == 21)
- C = 0;
- }
- if (A == D)
- {
- D += 1;
- if (D == 21)
- D = 0;
- }
- if (B == D)
- {
- D += 1;
- if (D == 21)
- D = 0;
- }
- if (C == D)
- {
- D += 1;
- if (D == 21)
- D = 0;
- }
-
- L_Tree0.Text = "- " + CB_TreeList.GetItemText(CB_TreeList.Items[A]);
- L_Tree1.Text = "- " + CB_TreeList.GetItemText(CB_TreeList.Items[B]);
- L_Tree2.Text = "- " + CB_TreeList.GetItemText(CB_TreeList.Items[C]);
- L_Tree3.Text = "- " + CB_TreeList.GetItemText(CB_TreeList.Items[D]);
}
+
+ private readonly int[] MunchlaxTrees;
+ private readonly int[][] Table;
+ private int entry;
+ private bool loading;
+ private HoneyTree Tree;
+
+ private int TreeSpecies => Table[(int)NUD_Group.Value][(int)NUD_Slot.Value];
+ private void B_Catchable_Click(object sender, EventArgs e) => NUD_Time.Value = 1080;
+ private void changeGroupSlot(object sender, EventArgs e)
+ {
+ int species = TreeSpecies;
+ L_Species.Text = species != 266 // silcoon/cascoon
+ ? GameInfo.Strings.specieslist[species]
+ : GameInfo.Strings.specieslist[species + 0] + $" ({GameInfo.Strings.gamelist[10]})" + Environment.NewLine
+ + GameInfo.Strings.specieslist[species + 2] + $" ({GameInfo.Strings.gamelist[11]})";
+
+ if (loading)
+ return;
+
+ if (species == 446 && !MunchlaxTrees.Contains(CB_TreeList.SelectedIndex))
+ WinFormsUtil.Alert("Catching Munchlax in this tree will make it illegal for this savegame's TID/SID combination.");
+ }
+ private void changeTree(object sender, EventArgs e)
+ {
+ saveTree();
+ entry = CB_TreeList.SelectedIndex;
+ readTree();
+ }
+ private void readTree()
+ {
+ loading = true;
+ Tree = SAV.getHoneyTree(entry);
+
+ NUD_Time.Value = Math.Min(NUD_Time.Maximum, Tree.Time);
+ NUD_Shake.Value = Math.Min(NUD_Shake.Maximum, Tree.Shake);
+ NUD_Group.Value = Math.Min(NUD_Group.Maximum, Tree.Group);
+ NUD_Slot.Value = Math.Min(NUD_Slot.Maximum, Tree.Slot);
+
+ changeGroupSlot(null, null);
+ loading = false;
+ }
+ private void saveTree()
+ {
+ if (Tree == null)
+ return;
+
+ Tree.Time = (uint)NUD_Time.Value;
+ Tree.Shake = (int)NUD_Shake.Value;
+ Tree.Group = (int)NUD_Group.Value;
+ Tree.Slot = (int)NUD_Slot.Value;
+
+ SAV.setHoneyTree(Tree, entry);
+ }
+
private void B_Save_Click(object sender, EventArgs e)
{
- if (SAV.DP)
- SAV.setData(TreeBlock, SAV.PokeDex - 0x12DC + DP_OFFSET);
- else if (SAV.Pt)
- SAV.setData(TreeBlock, SAV.PokeDex - 0x1328 + PT_OFFSET);
+ saveTree();
SAV.Data.CopyTo(Main.SAV.Data, 0);
Main.SAV.Edited = true;
Close();
}
- private void B_Cancel_Click(object sender, EventArgs e)
- {
- Close();
- }
-
- private void CB_TreeList_SelectedIndexChanged(object sender, EventArgs e)
- {
- TreeIndex = CB_TreeList.SelectedIndex;
- readTree();
- }
- #region Tree
- private int TreeIndex;
- private int row;
- private int column;
- private int modifier;
- private byte[] TreeBlock = new byte[8 * 21];
- private int DP_OFFSET = 0x72E4;
- private int PT_OFFSET = 0x7F38;
- private int A, B, C, D;
-
- private void CB_Species_SelectedIndexChanged(object sender, EventArgs e)
- {
- saveTreeSpecies();
- if (getTreeSpecies() == (int)TreeSpecies.Munchlax && CB_TreeList.SelectedIndex != A && CB_TreeList.SelectedIndex != B && CB_TreeList.SelectedIndex != C && CB_TreeList.SelectedIndex != D )
- {
- MessageBox.Show("Warning!\n\nCatching Munchlax in this tree will make it illegal\nfor this savegame's TID/SID combination.");
- }
- }
-
- private void NUD_Time_ValueChanged(object sender, EventArgs e)
- {
- saveTreeTime();
- }
-
- private void NUD_Shake_ValueChanged(object sender, EventArgs e)
- {
- saveTreeShake();
- }
-
- private void B_Catchable_Click(object sender, EventArgs e)
- {
- NUD_Time.Value = 1080;
- }
-
- private enum TreeSpecies
- {
- None,
- Aipom,
- Burmy,
- Cherubi,
- Combee,
- Heracross,
- Munchlax,
- Silcoon_Wurmple, //Silcoon/cascoon aren't available in Pt
- Wurmple //Not used for Pt
- };
-
- private int getTreeSpecies()
- {
- int species = (int)TreeSpecies.None;
- switch (SAV.Version)
- {
- case GameVersion.DP:
- if (modifier == 0 || modifier > 3)//No Pokémon
- {
- species = (int)TreeSpecies.None;
- }
- else if (modifier == 1)//Column 0
- {
- switch (row)
- {
- case 0:
- species = (int)TreeSpecies.Wurmple;
- break;
- case 1:
- species = (int)TreeSpecies.Silcoon_Wurmple;
- break;
- case 2:
- species = (int)TreeSpecies.Combee;
- break;
- case 3:
- species = (int)TreeSpecies.Burmy;
- break;
- case 4:
- species = (int)TreeSpecies.Cherubi;
- break;
- case 5:
- species = (int)TreeSpecies.Aipom;
- break;
- }
- }
- else if (modifier == 2)//Column 1
- {
- switch (row)
- {
- case 0:
- species = (int)TreeSpecies.Combee;
- break;
- case 1:
- species = (int)TreeSpecies.Burmy;
- break;
- case 2:
- species = (int)TreeSpecies.Cherubi;
- break;
- case 3:
- species = (int)TreeSpecies.Aipom;
- break;
- case 4:
- species = (int)TreeSpecies.Heracross;
- break;
- case 5:
- species = (int)TreeSpecies.Wurmple;
- break;
- }
- }
- else if (modifier == 3)//Munchlax
- {
- species = (int)TreeSpecies.Munchlax;
- }
- break;
- case GameVersion.Pt:
- if (modifier == 0 || modifier > 3)//No Pokémon
- {
- species = (int)TreeSpecies.None;
- }
- else if (modifier == 1)//Column 0
- {
- switch (row)
- {
- case 0:
- species = (int)TreeSpecies.Combee;
- break;
- case 1:
- species = (int)TreeSpecies.Silcoon_Wurmple;
- break;
- case 2:
- species = (int)TreeSpecies.Burmy;
- break;
- case 3:
- species = (int)TreeSpecies.Cherubi;
- break;
- case 4:
- species = (int)TreeSpecies.Aipom;
- break;
- case 5:
- species = (int)TreeSpecies.Aipom;
- break;
- }
- }
- else if (modifier == 2)//Column 1
- {
- switch (row)
- {
- case 0:
- species = (int)TreeSpecies.Burmy;
- break;
- case 1:
- species = (int)TreeSpecies.Cherubi;
- break;
- case 2:
- species = (int)TreeSpecies.Combee;
- break;
- case 3:
- species = (int)TreeSpecies.Aipom;
- break;
- case 4:
- species = (int)TreeSpecies.Aipom;
- break;
- case 5:
- species = (int)TreeSpecies.Heracross;
- break;
- }
- }
- else if (modifier == 3)//Munchlax
- {
- species = (int)TreeSpecies.Munchlax;
- }
- break;
- }
- return species;
- }
-
- private void readTree()
- {
- NUD_Time.Value = BitConverter.ToUInt32(TreeBlock, TreeIndex * 8);
- NUD_Shake.Value = (int)TreeBlock[TreeIndex * 8 + 7];
- row = TreeBlock[TreeIndex * 8 + 4];
- column = TreeBlock[TreeIndex * 8 + 5];
- modifier = TreeBlock[TreeIndex * 8 + 6];
-
- CB_Species.SelectedIndex = getTreeSpecies();
-
-
- }
- private void saveTreeTime()
- {
- BitConverter.GetBytes((UInt32)NUD_Time.Value).CopyTo(TreeBlock, TreeIndex * 8);
- }
- private void saveTreeShake()
- {
- TreeBlock[TreeIndex * 8 + 7] = (byte)NUD_Shake.Value;
- }
- private void saveTreeSpecies()
- {
- //Only change species if actually different (prevents needless savedata modification)
- if (CB_Species.SelectedIndex != getTreeSpecies())
- {
- if (SAV.Version == GameVersion.DP)
- {
- switch (CB_Species.SelectedIndex)
- {
- case (int)TreeSpecies.None:
- TreeBlock[TreeIndex * 8 + 6] = 0;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 0;//Row
- break;
- case (int)TreeSpecies.Aipom:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 5;//Row
- break;
- case (int)TreeSpecies.Burmy:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 3;//Row
- break;
- case (int)TreeSpecies.Cherubi:
- TreeBlock[TreeIndex * 8 + 6] = 2;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 1;//Column
- TreeBlock[TreeIndex * 8 + 4] = 2;//Row
- break;
- case (int)TreeSpecies.Combee:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 2;//Row
- break;
- case (int)TreeSpecies.Heracross:
- TreeBlock[TreeIndex * 8 + 6] = 2;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 1;//Column
- TreeBlock[TreeIndex * 8 + 4] = 4;//Row
- break;
- case (int)TreeSpecies.Munchlax:
- TreeBlock[TreeIndex * 8 + 6] = 3;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 2;//Column
- TreeBlock[TreeIndex * 8 + 4] = 0;//Row
- break;
- case (int)TreeSpecies.Silcoon_Wurmple:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 1;//Row
- break;
- case (int)TreeSpecies.Wurmple:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 0;//Row
- break;
- }
- }
- else if (SAV.Version == GameVersion.Pt)
- {
- switch (CB_Species.SelectedIndex)
- {
- case (int)TreeSpecies.None:
- TreeBlock[TreeIndex * 8 + 6] = 0;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 0;//Row
- break;
- case (int)TreeSpecies.Aipom:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 4;//Row
- break;
- case (int)TreeSpecies.Burmy:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 2;//Row
- break;
- case (int)TreeSpecies.Cherubi:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 3;//Row
- break;
- case (int)TreeSpecies.Combee:
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 0;//Row
- break;
- case (int)TreeSpecies.Heracross:
- TreeBlock[TreeIndex * 8 + 6] = 2;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 1;//Column
- TreeBlock[TreeIndex * 8 + 4] = 5;//Row
- break;
- case (int)TreeSpecies.Munchlax:
- TreeBlock[TreeIndex * 8 + 6] = 3;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 2;//Column
- TreeBlock[TreeIndex * 8 + 4] = 0;//Row
- break;
- case (int)TreeSpecies.Silcoon_Wurmple://There one less pokémon available in Pt
- TreeBlock[TreeIndex * 8 + 6] = 1;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 1;//Row
- break;
- }
- }
- else
- {
- TreeBlock[TreeIndex * 8 + 6] = 0;//Modifier
- TreeBlock[TreeIndex * 8 + 5] = 0;//Column
- TreeBlock[TreeIndex * 8 + 4] = 0;//Row
- }
- //Update info for getTreeSpecies
- row = TreeBlock[TreeIndex * 8 + 4];
- column = TreeBlock[TreeIndex * 8 + 5];
- modifier = TreeBlock[TreeIndex * 8 + 6];
- }
- }
- #endregion
+ private void B_Cancel_Click(object sender, EventArgs e) => Close();
}
}
diff --git a/PKHeX/PKHeX.Core.csproj b/PKHeX/PKHeX.Core.csproj
index 6d64e8efd..e98aadd8c 100644
--- a/PKHeX/PKHeX.Core.csproj
+++ b/PKHeX/PKHeX.Core.csproj
@@ -212,6 +212,7 @@
True
Resources.resx
+
diff --git a/PKHeX/Saves/SAV4.cs b/PKHeX/Saves/SAV4.cs
index 158adbecf..726ea1dbd 100644
--- a/PKHeX/Saves/SAV4.cs
+++ b/PKHeX/Saves/SAV4.cs
@@ -831,7 +831,7 @@ protected override void setDex(PKM pkm)
}
}
- int[] DPLangSpecies = new int[14] { 23, 25, 54, 77, 120, 129, 202, 214, 215, 216, 228, 278, 287, 315 };
+ int[] DPLangSpecies = { 23, 25, 54, 77, 120, 129, 202, 214, 215, 216, 228, 278, 287, 315 };
int dpl = 1 + Array.IndexOf(DPLangSpecies, pkm.Species);
if (DP && dpl <= 0)
return;
@@ -1061,5 +1061,56 @@ public int DexUpgraded
}
}
}
+
+ // Honey Trees
+ private const int HONEY_DP = 0x72E4;
+ private const int HONEY_PT = 0x7F38;
+ private const int HONEY_SIZE = 8;
+ public HoneyTree getHoneyTree(int index)
+ {
+ if (index > 21)
+ return null;
+ switch (Version)
+ {
+ case GameVersion.DP:
+ return new HoneyTree(getData(HONEY_DP + HONEY_SIZE*index, HONEY_SIZE));
+ case GameVersion.Pt:
+ return new HoneyTree(getData(HONEY_PT + HONEY_SIZE*index, HONEY_SIZE));
+ }
+ return null;
+ }
+ public void setHoneyTree(HoneyTree tree, int index)
+ {
+ if (index > 21)
+ return;
+ switch (Version)
+ {
+ case GameVersion.DP:
+ setData(tree.Data, HONEY_DP + HONEY_SIZE*index);
+ break;
+ case GameVersion.Pt:
+ setData(tree.Data, HONEY_PT + HONEY_SIZE*index);
+ break;
+ }
+ }
+ public int[] MunchlaxTrees
+ {
+ get
+ {
+ int A = (TID >> 8) % 21;
+ int B = (TID & 0x00FF) % 21;
+ int C = (SID >> 8) % 21;
+ int D = (SID & 0x00FF) % 21;
+
+ if (A == B) B = (B + 1) % 21;
+ if (A == C) C = (C + 1) % 21;
+ if (B == C) C = (C + 1) % 21;
+ if (A == D) D = (D + 1) % 21;
+ if (B == D) D = (D + 1) % 21;
+ if (C == D) D = (D + 1) % 21;
+
+ return new[] { A, B, C, D };
+ }
+ }
}
}
diff --git a/PKHeX/Saves/Substructures/HoneyTree.cs b/PKHeX/Saves/Substructures/HoneyTree.cs
new file mode 100644
index 000000000..8a44f247a
--- /dev/null
+++ b/PKHeX/Saves/Substructures/HoneyTree.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace PKHeX.Core
+{
+ public class HoneyTree
+ {
+ public const int Size = 8;
+
+ public readonly byte[] Data;
+
+ public uint Time { get { return BitConverter.ToUInt32(Data, 0); } set { BitConverter.GetBytes(value).CopyTo(Data, 0); } }
+ public int Slot { get { return Data[4]; } set { Data[4] = (byte)value; } }
+ public int Group { get { return Data[5]; } set { Data[5] = (byte)value; X = Group+1; } }
+ public int X { get { return Data[6]; } set { Data[6] = (byte)value; } }
+ public int Shake { get { return Data[7]; } set { Data[7] = (byte)value; } }
+
+ public HoneyTree(byte[] data)
+ {
+ Data = data;
+ }
+
+ public static readonly int[][] TableDP =
+ {
+ new[] {000, 000, 000, 000, 000, 000},
+ new[] {265, 266, 415, 412, 420, 190},
+ new[] {415, 412, 420, 190, 214, 265},
+ new[] {446, 446, 446, 446, 446, 446},
+ };
+ public static readonly int[][] TablePt =
+ {
+ TableDP[0],
+ new[] {415, 265, 412, 420, 190, 190},
+ new[] {412, 420, 415, 190, 190, 214},
+ TableDP[3],
+ };
+ }
+}