2014-06-28 21:22:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX
|
|
|
|
|
{
|
|
|
|
|
public partial class SAV_Pokepuff : Form
|
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
public SAV_Pokepuff()
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2015-09-21 03:34:09 +00:00
|
|
|
|
Util.TranslateInterface(this, Main.curlanguage);
|
|
|
|
|
sav = (byte[])Main.savefile.Clone();
|
|
|
|
|
|
|
|
|
|
pfa = Main.puffs;
|
2014-07-31 22:06:48 +00:00
|
|
|
|
pfa[0] = "---";
|
2015-02-01 04:40:35 +00:00
|
|
|
|
Setup();
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2015-03-11 01:44:51 +00:00
|
|
|
|
new ToolTip().SetToolTip(B_Sort, "Hold CTRL to reverse sort.");
|
|
|
|
|
new ToolTip().SetToolTip(B_All, "Hold CTRL to give Deluxe instead of Supreme.");
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2015-03-12 04:44:12 +00:00
|
|
|
|
|
2015-09-21 03:34:09 +00:00
|
|
|
|
public byte[] sav;
|
2015-03-12 04:44:12 +00:00
|
|
|
|
private string[] pfa =
|
|
|
|
|
{
|
|
|
|
|
"Empty",
|
|
|
|
|
"Basic Sweet", "Basic Mint", "Basic Citrus", "Basic Mocha", "Basic Spice",
|
|
|
|
|
"Frosted Sweet", "Frosted Mint", "Frosted Citrus", "Frosted Mocha", "Frosted Spice",
|
|
|
|
|
"Fancy Sweet", "Fancy Mint", "Fancy Citrus", "Fancy Mocha", "Fancy Spice",
|
|
|
|
|
"Deluxe Sweet", "Deluxe Mint", "Deluxe Citrus", "Deluxe Mocha", "Deluxe Spice",
|
|
|
|
|
"Supreme Wish", "Supreme Honor", "Supreme Spring", "Supreme Summer", "Supreme Fall", "Supreme Winter",
|
|
|
|
|
};
|
2015-02-01 04:40:35 +00:00
|
|
|
|
private void Setup()
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
dgv.Rows.Clear();
|
|
|
|
|
dgv.Columns.Clear();
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
|
|
|
|
|
{
|
|
|
|
|
dgvIndex.HeaderText = "Slot";
|
|
|
|
|
dgvIndex.DisplayIndex = 0;
|
|
|
|
|
dgvIndex.Width = 45;
|
|
|
|
|
dgvIndex.ReadOnly = true;
|
|
|
|
|
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
|
}
|
2015-03-11 01:44:51 +00:00
|
|
|
|
DataGridViewComboBoxColumn dgvPuff = new DataGridViewComboBoxColumn
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2015-03-11 01:44:51 +00:00
|
|
|
|
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
|
|
|
|
|
};
|
|
|
|
|
{
|
|
|
|
|
foreach (string t in pfa)
|
|
|
|
|
dgvPuff.Items.Add(t);
|
|
|
|
|
|
2014-06-28 21:22:05 +00:00
|
|
|
|
dgvPuff.DisplayIndex = 1;
|
|
|
|
|
dgvPuff.Width = 135;
|
|
|
|
|
dgvPuff.FlatStyle = FlatStyle.Flat;
|
|
|
|
|
}
|
2015-09-21 03:34:09 +00:00
|
|
|
|
dgv.Columns.Add(dgvIndex);
|
|
|
|
|
dgv.Columns.Add(dgvPuff);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2015-09-21 03:34:09 +00:00
|
|
|
|
dgv.Rows.Add(100);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
dgv.Rows[i].Cells[0].Value = (i + 1).ToString();
|
|
|
|
|
dgv.Rows[i].Cells[1].Value = pfa[sav[Main.SaveGame.Puff + i]];
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2015-09-21 03:34:09 +00:00
|
|
|
|
MT_CNT.Text = BitConverter.ToUInt32(sav, Main.SaveGame.Puff + 100).ToString("0");
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
private void dropclick(object sender, DataGridViewCellEventArgs e)
|
|
|
|
|
{
|
2015-03-12 04:44:12 +00:00
|
|
|
|
if (e.ColumnIndex != 1) return;
|
2015-09-21 03:34:09 +00:00
|
|
|
|
((ComboBox)(sender as DataGridView).EditingControl).DroppedDown = true;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2015-03-12 04:44:12 +00:00
|
|
|
|
|
2014-06-28 21:22:05 +00:00
|
|
|
|
private void B_Cancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
private void B_All_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-11-28 04:47:50 +00:00
|
|
|
|
int basepuff = 20;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
int basemod = 6;
|
|
|
|
|
if (ModifierKeys == Keys.Control)
|
|
|
|
|
{
|
2014-11-28 04:47:50 +00:00
|
|
|
|
basepuff = 1;
|
|
|
|
|
basemod = 0x19;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2014-12-12 05:45:01 +00:00
|
|
|
|
byte[] newpuffs = new byte[100];
|
2014-06-28 21:22:05 +00:00
|
|
|
|
for (int i = 0; i < 100; i++)
|
2015-03-12 04:44:12 +00:00
|
|
|
|
newpuffs[i] = (byte) (Util.rnd32()%basemod + basepuff);
|
2015-02-01 04:40:35 +00:00
|
|
|
|
|
2015-09-21 03:34:09 +00:00
|
|
|
|
Array.Copy(newpuffs, 0, sav, Main.SaveGame.Puff, 100);
|
2015-02-01 04:40:35 +00:00
|
|
|
|
Setup();
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
private void B_None_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-12-12 05:45:01 +00:00
|
|
|
|
byte[] newpuffs = new byte[100];
|
2014-06-28 21:22:05 +00:00
|
|
|
|
newpuffs[0] = 1;
|
|
|
|
|
newpuffs[1] = 2;
|
|
|
|
|
newpuffs[2] = 3;
|
|
|
|
|
newpuffs[3] = 4;
|
|
|
|
|
newpuffs[4] = 5;
|
2015-09-21 03:34:09 +00:00
|
|
|
|
Array.Copy(newpuffs, 0, sav, Main.SaveGame.Puff, 100);
|
2015-02-01 04:40:35 +00:00
|
|
|
|
Setup();
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
private void B_Sort_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-12-12 05:45:01 +00:00
|
|
|
|
byte[] puffarray = new byte[100];
|
2014-06-28 21:22:05 +00:00
|
|
|
|
if (ModifierKeys == Keys.Control)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
string puff = dgv.Rows[i].Cells[1].Value.ToString();
|
2015-03-12 04:44:12 +00:00
|
|
|
|
puffarray[i] = (byte) Array.IndexOf(pfa, puff);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
Array.Sort(puffarray);
|
|
|
|
|
Array.Reverse(puffarray);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
string puff = dgv.Rows[i].Cells[1].Value.ToString();
|
2015-03-12 04:44:12 +00:00
|
|
|
|
byte puffval = (byte) Array.IndexOf(pfa, puff);
|
2015-03-11 01:44:51 +00:00
|
|
|
|
if (puffval == 0) continue;
|
|
|
|
|
puffarray[count] = puffval;
|
|
|
|
|
count++;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
Array.Resize(ref puffarray, count);
|
|
|
|
|
Array.Sort(puffarray);
|
|
|
|
|
Array.Resize(ref puffarray, 100);
|
|
|
|
|
}
|
2015-09-21 03:34:09 +00:00
|
|
|
|
Array.Copy(puffarray, 0, sav, Main.SaveGame.Puff, 100);
|
2015-02-01 04:40:35 +00:00
|
|
|
|
Setup();
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
private void B_Save_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-12-12 05:45:01 +00:00
|
|
|
|
byte[] puffarray = new byte[100];
|
2014-06-28 21:22:05 +00:00
|
|
|
|
int emptyslots = 0;
|
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
string puff = dgv.Rows[i].Cells[1].Value.ToString();
|
2014-06-28 21:22:05 +00:00
|
|
|
|
if (Array.IndexOf(pfa, puff) == 0)
|
|
|
|
|
{
|
|
|
|
|
emptyslots++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2015-03-12 04:44:12 +00:00
|
|
|
|
|
|
|
|
|
puffarray[i - emptyslots] = (byte) Array.IndexOf(pfa, puff);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2015-09-21 03:34:09 +00:00
|
|
|
|
Array.Copy(puffarray, 0, sav, Main.SaveGame.Puff, 100);
|
|
|
|
|
Array.Copy(sav, Main.savefile, sav.Length);
|
|
|
|
|
Main.savedited = true;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|