Pokedex Setting

This commit is contained in:
Kurt 2014-11-29 20:12:37 -08:00
parent 5d939d4aad
commit df2a91bb1e
4 changed files with 38 additions and 81 deletions

View File

@ -5165,7 +5165,7 @@ private void setPokedex(byte[] pkxdata)
int shiftoff = (shiny * 0x60 * 2) + (gender * 0x60) + 0x68;
// Set the [Species/Gender/Shiny] Owned Flag
savefile[dexoff + shiftoff + (species - 1) / 8 + 0x8] |= (byte)(1 << ((species - 1) % 8));
savefile[dexoff + shiftoff + (species - 1) / 8] |= (byte)(1 << ((species - 1) % 8));
// Owned quality flag
if (origin < 0x18 && species < 650 && !savegame_oras) // Pre 650 for X/Y, and not for ORAS; Set the Foreign Owned Flag

View File

@ -71,7 +71,7 @@ private void getListItems()
{
int[] itemlist = new int[] {
000,001,002,003,004,005,006,007,008,009,010,011,012,013,014,015,016,055,056,
057,058,059,060,061,062,063,064, 070,071,072,073,074,075,
057,058,059,060,061,062,063,064,065,066,067,068,069,070,071,072,073,074,075,
076,077,078,079,080,081,082,083,084,085,086,087,088,089,090,091,092,093,094,
099,100,101,102,103,104,105,106,107,108,109,110,112,116,117,118,119,135,136,
213,214,215,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,

View File

@ -54,12 +54,11 @@ private void InitializeComponent()
this.B_FillDex = new System.Windows.Forms.Button();
this.GB_Language = new System.Windows.Forms.GroupBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.MT_Count = new System.Windows.Forms.MaskedTextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.CHK_F1 = new System.Windows.Forms.CheckBox();
this.TB_Spinda = new System.Windows.Forms.TextBox();
this.L_Spinda = new System.Windows.Forms.Label();
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox();
this.label2 = new System.Windows.Forms.Label();
this.GB_Language.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
@ -87,11 +86,11 @@ private void InitializeComponent()
// CHK_P1
//
this.CHK_P1.AutoSize = true;
this.CHK_P1.Location = new System.Drawing.Point(12, 93);
this.CHK_P1.Location = new System.Drawing.Point(12, 86);
this.CHK_P1.Name = "CHK_P1";
this.CHK_P1.Size = new System.Drawing.Size(96, 17);
this.CHK_P1.Size = new System.Drawing.Size(69, 17);
this.CHK_P1.TabIndex = 3;
this.CHK_P1.Text = "Native (ORAS)";
this.CHK_P1.Text = "Obtained";
this.CHK_P1.UseVisualStyleBackColor = true;
this.CHK_P1.Click += new System.EventHandler(this.changePartitionBool);
//
@ -287,11 +286,11 @@ private void InitializeComponent()
//
// B_GiveAll
//
this.B_GiveAll.Location = new System.Drawing.Point(251, 11);
this.B_GiveAll.Location = new System.Drawing.Point(149, 11);
this.B_GiveAll.Name = "B_GiveAll";
this.B_GiveAll.Size = new System.Drawing.Size(60, 23);
this.B_GiveAll.TabIndex = 23;
this.B_GiveAll.Text = "Give All";
this.B_GiveAll.Text = "Check All";
this.B_GiveAll.UseVisualStyleBackColor = true;
this.B_GiveAll.Click += new System.EventHandler(this.B_GiveAll_Click);
//
@ -333,20 +332,40 @@ private void InitializeComponent()
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.CHK_P9);
this.groupBox1.Controls.Add(this.MT_Count);
this.groupBox1.Controls.Add(this.CHK_P8);
this.groupBox1.Controls.Add(this.CHK_P7);
this.groupBox1.Controls.Add(this.CHK_P6);
this.groupBox1.Location = new System.Drawing.Point(148, 176);
this.groupBox1.Location = new System.Drawing.Point(148, 154);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(115, 89);
this.groupBox1.Size = new System.Drawing.Size(115, 111);
this.groupBox1.TabIndex = 27;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Encountered";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 85);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(43, 13);
this.label2.TabIndex = 32;
this.label2.Text = "Battled:";
//
// MT_Count
//
this.MT_Count.Location = new System.Drawing.Point(63, 82);
this.MT_Count.Mask = "00000";
this.MT_Count.Name = "MT_Count";
this.MT_Count.Size = new System.Drawing.Size(38, 20);
this.MT_Count.TabIndex = 31;
this.MT_Count.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.MT_Count.TextChanged += new System.EventHandler(this.changeEncounteredCount);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.CHK_F1);
this.groupBox2.Controls.Add(this.CHK_P1);
this.groupBox2.Controls.Add(this.CHK_P5);
this.groupBox2.Controls.Add(this.CHK_P4);
@ -354,22 +373,11 @@ private void InitializeComponent()
this.groupBox2.Controls.Add(this.CHK_P2);
this.groupBox2.Location = new System.Drawing.Point(148, 40);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(115, 130);
this.groupBox2.Size = new System.Drawing.Size(115, 108);
this.groupBox2.TabIndex = 28;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Owned";
//
// CHK_F1
//
this.CHK_F1.AutoSize = true;
this.CHK_F1.Location = new System.Drawing.Point(12, 108);
this.CHK_F1.Name = "CHK_F1";
this.CHK_F1.Size = new System.Drawing.Size(61, 17);
this.CHK_F1.TabIndex = 13;
this.CHK_F1.Text = "Foreign";
this.CHK_F1.UseVisualStyleBackColor = true;
this.CHK_F1.Click += new System.EventHandler(this.changePartitionBool);
//
// TB_Spinda
//
this.TB_Spinda.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@ -389,32 +397,11 @@ private void InitializeComponent()
this.L_Spinda.TabIndex = 30;
this.L_Spinda.Text = "Spinda:";
//
// maskedTextBox1
//
this.maskedTextBox1.Location = new System.Drawing.Point(207, 13);
this.maskedTextBox1.Mask = "00000";
this.maskedTextBox1.Name = "maskedTextBox1";
this.maskedTextBox1.Size = new System.Drawing.Size(38, 20);
this.maskedTextBox1.TabIndex = 31;
this.maskedTextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.maskedTextBox1.TextChanged += new System.EventHandler(this.changeEncounteredCount);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(158, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(43, 13);
this.label2.TabIndex = 32;
this.label2.Text = "Battled:";
//
// SAV_PokedexORAS
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(394, 272);
this.Controls.Add(this.label2);
this.Controls.Add(this.maskedTextBox1);
this.Controls.Add(this.L_Spinda);
this.Controls.Add(this.TB_Spinda);
this.Controls.Add(this.groupBox2);
@ -473,10 +460,9 @@ private void InitializeComponent()
private System.Windows.Forms.GroupBox GB_Language;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox CHK_F1;
private System.Windows.Forms.TextBox TB_Spinda;
private System.Windows.Forms.Label L_Spinda;
private System.Windows.Forms.MaskedTextBox maskedTextBox1;
private System.Windows.Forms.MaskedTextBox MT_Count;
private System.Windows.Forms.Label label2;
}
}

View File

@ -30,7 +30,6 @@ public SAV_PokedexORAS(Form1 frm1)
public int sv = 0;
public bool[,] specbools = new bool[9, 0x60 * 8];
public bool[,] langbools = new bool[7, 0x60 * 8];
public bool[] foreignbools = new bool[0x52 * 8];
bool editing = true;
private void Setup()
{
@ -88,15 +87,6 @@ private void Setup()
for (int b = 0; b < (721); b++) // 721 Species
for (int i = 0; i < 7; i++) // 7 Languages
langbools[i, b] = LangRegion[7 * b + i];
// Fill Foreign array
{
byte[] foreigndata = new Byte[0x52];
Array.Copy(sav, dexoffset + 0x688, foreigndata, 0, 0x52);
BitArray ForeignRegion = new BitArray(foreigndata);
for (int b = 0; b < (0x52 * 8); b++)
foreignbools[b] = ForeignRegion[b];
}
}
private void changeCBSpecies(object sender, EventArgs e)
{
@ -144,10 +134,6 @@ private void loadchks()
CP[i].Checked = specbools[i, pk-1];
for (int i = 0; i < 7; i++)
CL[i].Checked = langbools[i, pk-1];
if (pk < 650) { CHK_F1.Enabled = true; CHK_F1.Checked = foreignbools[pk - 1]; }
else { CHK_F1.Enabled = CHK_F1.Checked = false; }
{
CHK_P1.Enabled = true;
@ -164,7 +150,7 @@ private void loadchks()
// Load Encountered Count
editing = true;
maskedTextBox1.Text = BitConverter.ToUInt16(sav, dexoffset + 0x6E8 + (pk - 1) * 2).ToString();
MT_Count.Text = BitConverter.ToUInt16(sav, dexoffset + 0x686 + (pk - 1) * 2).ToString();
editing = false;
}
private void removedropCB(object sender, KeyEventArgs e)
@ -194,8 +180,6 @@ private void changePartitionBool(object sender, EventArgs e)
specbools[6, (species - 1)] = CHK_P7.Checked;
specbools[7, (species - 1)] = CHK_P8.Checked;
specbools[8, (species - 1)] = CHK_P9.Checked;
if (CHK_F1.Enabled) // species < 650 // (1-649)
foreignbools[species - 1] = CHK_F1.Checked;
}
private void B_Cancel_Click(object sender, EventArgs e)
@ -241,16 +225,7 @@ private void saveChanges()
Array.Copy(ldata, 0, sav, sv + dexoffset + 0x400, 0x27C);
}
// Return Foreign Array
{
byte[] foreigndata = new byte[0x52];
for (int i = 0; i < 0x52 * 8; i++)
if (foreignbools[i])
foreigndata[i / 8] |= (byte)(1 << i % 8);
Array.Copy(foreigndata, 0, sav, sv + dexoffset + 0x688, 0x52);
}
// Store Spinda Spot
try
{
@ -277,10 +252,6 @@ private void B_GiveAll_Click(object sender, EventArgs e)
{
CHK_P1.Checked = !(ModifierKeys == Keys.Control);
}
if (CHK_F1.Enabled)
{
CHK_F1.Checked = !(ModifierKeys == Keys.Control);
}
int index = LB_Species.SelectedIndex+1;
DataTable spectable = PKX.SpeciesTable();
int gt = (int)spectable.Rows[index][8];
@ -519,7 +490,7 @@ private void B_FillDex_Click(object sender, EventArgs e)
// Encounter Count Writing (999*all species)
for (int i = 0; i < 0x2D1; i++)
Array.Copy(BitConverter.GetBytes(999), 0, sav, sv + 0x5400 + 0x15686 + 8 + i * 2, 2);
Array.Copy(BitConverter.GetBytes(999), 0, sav, sv + 0x5400 + 0x15686 + i * 2, 2);
// Forms Bool Writing
for (int i = 0; i < 0x9C; i++)
@ -535,7 +506,7 @@ private void B_FillDex_Click(object sender, EventArgs e)
private void changeEncounteredCount(object sender, EventArgs e)
{
if (!editing)
Array.Copy(BitConverter.GetBytes(Util.ToUInt32(maskedTextBox1)), 0, sav, dexoffset + 0x6EA + (LB_Species.SelectedIndex - 1) * 2, 2);
Array.Copy(BitConverter.GetBytes(Math.Min(0xFFFF,Util.ToUInt32(MT_Count))), 0, sav, dexoffset + 0x686 + (LB_Species.SelectedIndex - 1) * 2, 2);
}
}
}