diff --git a/pk3DS/Game/GARCReference.cs b/pk3DS/Game/GARCReference.cs
index 70ffaea..a225c01 100644
--- a/pk3DS/Game/GARCReference.cs
+++ b/pk3DS/Game/GARCReference.cs
@@ -117,6 +117,8 @@ public GARCReference getRelativeGARC(int offset, string name = "")
new GARCReference(155, "encounterstatic"),
+ new GARCReference(267, "pickup"),
+
new GARCReference(277, "maisonpkN"),
new GARCReference(278, "maisontrN"),
new GARCReference(279, "maisonpkS"),
diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs
index d89d8ef..c924783 100644
--- a/pk3DS/Main.cs
+++ b/pk3DS/Main.cs
@@ -249,7 +249,7 @@ private void toggleSubEditors()
B_MoveTutor.Visible = Config.ORAS; // Default false unless loaded
break;
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_Maison, B_OWSE};
+ 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_Maison, B_Pickup, B_OWSE };
exefs = new Control[] {B_TMHM, B_TypeChart};
cro = new Control[] {B_Mart};
@@ -837,7 +837,16 @@ private void rebuildExeFS(object sender, EventArgs e)
private void B_Pickup_Click(object sender, EventArgs e)
{
if (threadActive()) return;
- if (ExeFSPath != null) new PickupEditor6().Show();
+ switch (Config.Generation)
+ {
+ case 6:
+ if (ExeFSPath != null) new PickupEditor6().Show();
+ break;
+ case 7:
+ var pickup = Config.getlzGARCData("pickup");
+ Invoke((Action)(() => new PickupEditor7(pickup).ShowDialog()));
+ break;
+ }
}
private void B_TMHM_Click(object sender, EventArgs e)
{
diff --git a/pk3DS/Subforms/Gen7/PickupEditor7.Designer.cs b/pk3DS/Subforms/Gen7/PickupEditor7.Designer.cs
new file mode 100644
index 0000000..292116f
--- /dev/null
+++ b/pk3DS/Subforms/Gen7/PickupEditor7.Designer.cs
@@ -0,0 +1,137 @@
+namespace pk3DS
+{
+ partial class PickupEditor7
+ {
+ ///
+ /// 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()
+ {
+ 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.dgvCommon = new System.Windows.Forms.DataGridView();
+ this.B_AddRow = new System.Windows.Forms.Button();
+ this.B_DeleteRow = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvCommon)).BeginInit();
+ 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(597, 331);
+ this.B_Save.Name = "B_Save";
+ this.B_Save.Size = new System.Drawing.Size(75, 23);
+ this.B_Save.TabIndex = 7;
+ 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(516, 331);
+ this.B_Cancel.Name = "B_Cancel";
+ this.B_Cancel.Size = new System.Drawing.Size(75, 23);
+ this.B_Cancel.TabIndex = 8;
+ 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(9, 331);
+ this.B_Randomize.Name = "B_Randomize";
+ this.B_Randomize.Size = new System.Drawing.Size(75, 23);
+ this.B_Randomize.TabIndex = 9;
+ this.B_Randomize.Text = "Randomize";
+ this.B_Randomize.UseVisualStyleBackColor = true;
+ this.B_Randomize.Click += new System.EventHandler(this.B_Randomize_Click);
+ //
+ // dgvCommon
+ //
+ this.dgvCommon.AllowUserToResizeColumns = false;
+ this.dgvCommon.AllowUserToResizeRows = false;
+ this.dgvCommon.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.dgvCommon.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dgvCommon.Location = new System.Drawing.Point(12, 12);
+ this.dgvCommon.Name = "dgvCommon";
+ this.dgvCommon.Size = new System.Drawing.Size(656, 300);
+ this.dgvCommon.TabIndex = 10;
+ //
+ // B_AddRow
+ //
+ this.B_AddRow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.B_AddRow.Location = new System.Drawing.Point(90, 331);
+ this.B_AddRow.Name = "B_AddRow";
+ this.B_AddRow.Size = new System.Drawing.Size(75, 23);
+ this.B_AddRow.TabIndex = 11;
+ this.B_AddRow.Text = "Add Row";
+ this.B_AddRow.UseVisualStyleBackColor = true;
+ this.B_AddRow.Click += new System.EventHandler(this.B_AddRow_Click);
+ //
+ // B_DeleteRow
+ //
+ this.B_DeleteRow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.B_DeleteRow.Location = new System.Drawing.Point(171, 331);
+ this.B_DeleteRow.Name = "B_DeleteRow";
+ this.B_DeleteRow.Size = new System.Drawing.Size(75, 23);
+ this.B_DeleteRow.TabIndex = 12;
+ this.B_DeleteRow.Text = "Delete Row";
+ this.B_DeleteRow.UseVisualStyleBackColor = true;
+ this.B_DeleteRow.Click += new System.EventHandler(this.B_DeleteRow_Click);
+ //
+ // PickupEditor7
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(680, 361);
+ this.Controls.Add(this.B_DeleteRow);
+ this.Controls.Add(this.B_AddRow);
+ this.Controls.Add(this.dgvCommon);
+ this.Controls.Add(this.B_Randomize);
+ this.Controls.Add(this.B_Cancel);
+ this.Controls.Add(this.B_Save);
+ this.MaximizeBox = false;
+ this.MinimumSize = new System.Drawing.Size(600, 400);
+ this.Name = "PickupEditor7";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Pickup Editor";
+ ((System.ComponentModel.ISupportInitialize)(this.dgvCommon)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ 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.DataGridView dgvCommon;
+ private System.Windows.Forms.Button B_AddRow;
+ private System.Windows.Forms.Button B_DeleteRow;
+ }
+}
\ No newline at end of file
diff --git a/pk3DS/Subforms/Gen7/PickupEditor7.cs b/pk3DS/Subforms/Gen7/PickupEditor7.cs
new file mode 100644
index 0000000..5a16d4f
--- /dev/null
+++ b/pk3DS/Subforms/Gen7/PickupEditor7.cs
@@ -0,0 +1,204 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace pk3DS
+{
+ public partial class PickupEditor7 : Form
+ {
+ public PickupEditor7(lzGARCFile pickup)
+ {
+ InitializeComponent();
+ g_pickup = pickup;
+ var itemlist = Main.getText(TextName.ItemNames);
+ itemlist[0] = "";
+ items = itemlist.Select((v, i) => $"{v} - {i:000}").ToArray();
+ setupFLP();
+
+ byte[] data = pickup.Files[0];
+ getList(data);
+ }
+
+ private readonly lzGARCFile g_pickup;
+ private readonly string[] items;
+
+ private const int Columns = 10;
+ private void setupFLP()
+ {
+ dgvCommon.Columns.Clear();
+ // Add DataGrid
+ var dgv = dgvCommon;
+ {
+ dgv.AllowUserToAddRows = false;
+ dgv.AllowUserToDeleteRows = false;
+ dgv.AllowUserToResizeRows = false;
+ dgv.AllowUserToResizeColumns = false;
+ dgv.RowHeadersVisible = false;
+ //dgv.ColumnHeadersVisible = false,
+ dgv.MultiSelect = false;
+ dgv.ShowEditingIcon = false;
+ dgv.EditMode = DataGridViewEditMode.EditOnEnter;
+ dgv.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
+ dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dgv.SelectionMode = DataGridViewSelectionMode.CellSelect;
+ dgv.CellBorderStyle = DataGridViewCellBorderStyle.None;
+ }
+
+ int c = 0;
+ DataGridViewComboBoxColumn dgvItemVal = new DataGridViewComboBoxColumn
+ {
+ HeaderText = "Item",
+ DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,
+ DisplayIndex = c++,
+ Width = 135,
+ FlatStyle = FlatStyle.Flat
+ };
+ dgv.Columns.Add(dgvItemVal);
+
+ for (int i = 0; i < Columns; i++)
+ {
+ string rate = $"{i*10 + 1}-{(i + 1)*10}";
+ DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
+ {
+ dgvIndex.HeaderText = rate;
+ dgvIndex.DisplayIndex = c++;
+ dgvIndex.Width = 45;
+ dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+ ((DataGridViewTextBoxColumn)dgvIndex).MaxInputLength = 2;
+ }
+ dgv.Columns.Add(dgvIndex);
+ }
+
+ var combo = dgv.Columns[0] as DataGridViewComboBoxColumn;
+ foreach (var i in items)
+ combo.Items.Add(i); // add only the Item Names
+
+ // disable sorting
+ dgv.Columns.Cast().ToList().ForEach(f => f.SortMode = DataGridViewColumnSortMode.NotSortable);
+ dgv.CancelEdit();
+ }
+
+ private void getList(byte[] data)
+ {
+ // Fill Data
+ int rows = BitConverter.ToUInt16(data, 0) - 1; // nice editor gamefreak
+ dgvCommon.Rows.Add(rows);
+ for (int i = 0; i < rows; i++)
+ {
+ int offset = 4 + i * (Columns + 2);
+ int item = BitConverter.ToUInt16(data, offset);
+
+ var r = dgvCommon.Rows[i];
+ r.Cells[0].Value = items[item];
+ for (int j = 0; j < Columns; j++)
+ {
+ int rate = data[offset + 2 + j];
+ r.Cells[1 + j].Value = rate.ToString();
+ }
+ }
+ }
+ private byte[] setList()
+ {
+ int rows = dgvCommon.RowCount;
+ int[][] rates = new int[rows][];
+ for (int i = 0; i < rates.Length; i++)
+ rates[i] = new int[Columns];
+ for (int i = 0; i < Columns; i++)
+ {
+ // get column sum
+ int sum = 0;
+ for (int r = 0; r < rows; r++)
+ {
+ var cell = dgvCommon.Rows[r].Cells[i+1];
+ int val;
+ if (!int.TryParse(cell.Value.ToString(), out val))
+ {
+ cell.Value = 0.ToString();
+ continue;
+ }
+ if (val > 100 || val < 0)
+ {
+ val = 0;
+ cell.Value = 0.ToString();
+ }
+ rates[r][i] = val;
+ sum += val;
+ }
+ if (sum == 100) // good
+ continue;
+
+ Util.Alert($"Sum of Column {i+1} needs to equal 100.", $"Got {sum}.");
+ return null;
+ }
+
+ using (var ms = new MemoryStream())
+ using (var bw = new BinaryWriter(ms))
+ {
+ bw.Write(rates.Length + 1); // nice editor gamefreak
+ for (int i = 0; i < rows; i++)
+ {
+ var r = dgvCommon.Rows[i];
+ string item = r.Cells[0].Value.ToString();
+ int itemindex = Array.IndexOf(items, item);
+ bw.Write((ushort)itemindex);
+
+ foreach (var b in rates[i])
+ bw.Write((byte)b);
+ }
+ return ms.ToArray();
+ }
+ }
+
+ private void B_Save_Click(object sender, EventArgs e)
+ {
+ byte[] result = setList();
+ if (result == null)
+ return;
+
+ g_pickup[0] = result;
+ 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 != Util.Prompt(MessageBoxButtons.YesNoCancel, "Randomize pickup lists?"))
+ return;
+
+ int[] validItems = Randomizer.getRandomItemList();
+
+ int ctr = 0;
+ Util.Shuffle(validItems);
+ for (int r = 0; r < dgvCommon.RowCount; r++)
+ {
+ dgvCommon.Rows[r].Cells[0].Value = items[validItems[ctr++]];
+ if (ctr <= validItems.Length) continue;
+ Util.Shuffle(validItems); ctr = 0;
+ }
+ }
+
+ private void B_AddRow_Click(object sender, EventArgs e)
+ {
+ if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Add a row at the bottom?"))
+ return;
+
+ int row = dgvCommon.RowCount;
+ dgvCommon.Rows.Add();
+ dgvCommon.Rows[row].Cells[0].Value = items[0];
+ for (int i = 1; i < dgvCommon.ColumnCount; i++)
+ dgvCommon.Rows[row].Cells[i].Value = 0.ToString();
+ }
+
+ private void B_DeleteRow_Click(object sender, EventArgs e)
+ {
+ if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Delete the bottom row?"))
+ return;
+
+ dgvCommon.Rows.RemoveAt(dgvCommon.RowCount - 1);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pk3DS/Subforms/Gen7/PickupEditor7.resx b/pk3DS/Subforms/Gen7/PickupEditor7.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/pk3DS/Subforms/Gen7/PickupEditor7.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/pk3DS/pk3DS.csproj b/pk3DS/pk3DS.csproj
index 11dc242..af0e0cb 100644
--- a/pk3DS/pk3DS.csproj
+++ b/pk3DS/pk3DS.csproj
@@ -191,6 +191,12 @@
PersonalEditor7.cs
+
+ Form
+
+
+ PickupEditor7.cs
+
Form
@@ -447,6 +453,9 @@
PersonalEditor7.cs
+
+ PickupEditor7.cs
+
SMTE.cs