mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-25 21:40:21 +00:00
ORAS Reorganization
This commit is contained in:
parent
f8ad28e41b
commit
a462db6089
17 changed files with 3277 additions and 3450 deletions
|
@ -14,18 +14,18 @@ namespace PKHeX
|
|||
{
|
||||
public partial class CodeGenerator : Form
|
||||
{
|
||||
Form1 m_parent;
|
||||
byte[] codedata = new Byte[232];
|
||||
byte[] newdata = new Byte[232];
|
||||
SaveGames.SaveStruct SaveGame = new SaveGames.SaveStruct(null);
|
||||
|
||||
|
||||
Form1 m_parent;
|
||||
public CodeGenerator(Form1 frm1)
|
||||
{
|
||||
m_parent = frm1;
|
||||
InitializeComponent();
|
||||
this.CenterToParent();
|
||||
RTB_Code.Clear();
|
||||
TB_Write.Clear();
|
||||
m_parent = frm1;
|
||||
SaveGame = m_parent.SaveGame;
|
||||
CB_Box.Items.Clear();
|
||||
for (int i = 1; i <= 31; i++)
|
||||
|
@ -43,7 +43,7 @@ namespace PKHeX
|
|||
{
|
||||
byte[] pkx = m_parent.preparepkx(m_parent.buff);
|
||||
newdata = new Byte[232];
|
||||
Array.Copy(m_parent.encryptArray(pkx), newdata, 232);
|
||||
Array.Copy(PKX.encryptArray(pkx), newdata, 232);
|
||||
}
|
||||
else return false;
|
||||
|
||||
|
@ -130,44 +130,12 @@ namespace PKHeX
|
|||
TB_Write.Text = (0x22000 - 0x5400).ToString("X8"); // WC Slot 1
|
||||
}
|
||||
}
|
||||
|
||||
public static string RemoveTroublesomeCharacters(TextBox tb)
|
||||
{
|
||||
string inString = tb.Text;
|
||||
if (inString == null) return null;
|
||||
|
||||
StringBuilder newString = new StringBuilder();
|
||||
char ch;
|
||||
|
||||
for (int i = 0; i < inString.Length; i++)
|
||||
{
|
||||
ch = inString[i];
|
||||
// filter for hex
|
||||
if ((ch < 0x0047 && ch > 0x002F) || (ch < 0x0067 && ch > 0x0060))
|
||||
newString.Append(ch);
|
||||
else
|
||||
System.Media.SystemSounds.Beep.Play();
|
||||
}
|
||||
if (newString.Length == 0)
|
||||
newString.Append("0");
|
||||
uint value = UInt32.Parse(newString.ToString(), NumberStyles.HexNumber);
|
||||
tb.Text = value.ToString("X8");
|
||||
return newString.ToString();
|
||||
|
||||
}
|
||||
private uint getHEXval(TextBox tb)
|
||||
{
|
||||
if (tb.Text == null)
|
||||
return 0;
|
||||
string str = RemoveTroublesomeCharacters(tb);
|
||||
return UInt32.Parse(str, NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
|
||||
private void B_Add_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Add the new code to the textbox.
|
||||
if (!loaddata()) return;
|
||||
uint writeoffset = getHEXval(TB_Write);
|
||||
uint writeoffset = Util.getHEXval(TB_Write);
|
||||
|
||||
for (int i = 0; i < newdata.Length / 4; i++)
|
||||
{
|
||||
|
|
2761
Misc/PKX.cs
Normal file
2761
Misc/PKX.cs
Normal file
File diff suppressed because it is too large
Load diff
2304
Misc/Util.cs
2304
Misc/Util.cs
File diff suppressed because it is too large
Load diff
146
Misc/pk2pk.cs
146
Misc/pk2pk.cs
|
@ -15,7 +15,7 @@ namespace PKHeX
|
|||
public byte[] ConvertPKM(byte[] input, byte[] savefile, int savindex)
|
||||
{
|
||||
#region Initialize Everything
|
||||
spectable = Util.SpeciesTable();
|
||||
spectable = PKX.SpeciesTable();
|
||||
|
||||
// Load Species Name Tables
|
||||
speclang_ja = getStringList("Species", "ja");
|
||||
|
@ -991,10 +991,10 @@ namespace PKHeX
|
|||
pk4[0x36] = (byte)((ppup >> 4) & 3);
|
||||
pk4[0x37] = (byte)((ppup >> 6) & 3);
|
||||
// Get Move PP
|
||||
pk4[0x30] = (byte)(getMovePP(BitConverter.ToInt16(pk4, 0x28)) * (5 + pk4[0x34]) / 5);
|
||||
pk4[0x31] = (byte)(getMovePP(BitConverter.ToInt16(pk4, 0x2A)) * (5 + pk4[0x35]) / 5);
|
||||
pk4[0x32] = (byte)(getMovePP(BitConverter.ToInt16(pk4, 0x2C)) * (5 + pk4[0x36]) / 5);
|
||||
pk4[0x33] = (byte)(getMovePP(BitConverter.ToInt16(pk4, 0x2E)) * (5 + pk4[0x37]) / 5);
|
||||
pk4[0x30] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk4, 0x28), pk4[0x34]));
|
||||
pk4[0x31] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk4, 0x2A), pk4[0x35]));
|
||||
pk4[0x32] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk4, 0x2C), pk4[0x36]));
|
||||
pk4[0x33] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk4, 0x2E), pk4[0x37]));
|
||||
|
||||
// Copy IVs
|
||||
uint IVs = BitConverter.ToUInt32(pk3, 0x48);
|
||||
|
@ -1008,7 +1008,7 @@ namespace PKHeX
|
|||
if (((pk4[0x3B] >> 6) & 1) == 1)
|
||||
{
|
||||
// set level to 5...
|
||||
Array.Copy(BitConverter.GetBytes(getEXP(5, species)), 0, pk4, 0x10, 4);
|
||||
Array.Copy(BitConverter.GetBytes(PKX.getEXP(5, species)), 0, pk4, 0x10, 4);
|
||||
// set nickname to species name later
|
||||
isegg = true;
|
||||
}
|
||||
|
@ -1052,7 +1052,7 @@ namespace PKHeX
|
|||
pk4[0x5F] = (byte)((origins >> 7) & 0xF); // Hometown Game
|
||||
pk4[0x82] = pk3[0x44]; // Copy Pokerus
|
||||
pk4[0x83] = (byte)((origins >> 11) & 0xF); // Ball
|
||||
pk4[0x84] = (byte)((pk3[0x47] & 0x80) | ((byte)getLevel(species, exp)));
|
||||
pk4[0x84] = (byte)((pk3[0x47] & 0x80) | ((byte)PKX.getLevel(species, ref exp)));
|
||||
|
||||
// Nickname and OT Name handling...
|
||||
byte[][] trash = new byte[8][];
|
||||
|
@ -1192,7 +1192,7 @@ namespace PKHeX
|
|||
// pk5[0x0A] = pk5[0x0B] = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++) // fix PP
|
||||
pk5[0x30 + i] = (byte)((getMovePP(BitConverter.ToUInt16(pk5, 0x28 + 2 * i)) * (5 + pk5[0x34+i])) / 5);
|
||||
pk5[0x30 + i] = (byte)(PKX.getMovePP(BitConverter.ToUInt16(pk5, 0x28 + 2 * i),pk5[0x34+i]));
|
||||
|
||||
// fix nature
|
||||
pk5[0x41] = (byte)(BitConverter.ToUInt32(pk5, 0) % 0x19);
|
||||
|
@ -1266,7 +1266,7 @@ namespace PKHeX
|
|||
// Fix Level
|
||||
pk5[0x84] &= 0x80;
|
||||
uint exp = BitConverter.ToUInt32(pk5, 0x10);
|
||||
pk5[0x84] |= (byte)getLevel(species, exp);
|
||||
pk5[0x84] |= (byte)PKX.getLevel(species, ref exp);
|
||||
|
||||
// Fix Checksum
|
||||
ushort chk = 0;
|
||||
|
@ -1325,10 +1325,10 @@ namespace PKHeX
|
|||
for (int i = 0; i < 16; i++)
|
||||
pk6[0x5A + i] = pk5[0x28 + i];
|
||||
// Fix PP; some moves have different PP in Gen 6.
|
||||
pk6[0x62] = (byte)(getMovePP(BitConverter.ToInt16(pk6, 0x5A)) * (5 + pk6[0x66]) / 5);
|
||||
pk6[0x63] = (byte)(getMovePP(BitConverter.ToInt16(pk6, 0x5C)) * (5 + pk6[0x67]) / 5);
|
||||
pk6[0x64] = (byte)(getMovePP(BitConverter.ToInt16(pk6, 0x5E)) * (5 + pk6[0x68]) / 5);
|
||||
pk6[0x65] = (byte)(getMovePP(BitConverter.ToInt16(pk6, 0x60)) * (5 + pk6[0x69]) / 5);
|
||||
pk6[0x62] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk6, 0x5A), pk6[0x66]));
|
||||
pk6[0x63] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk6, 0x5C), pk6[0x67]));
|
||||
pk6[0x64] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk6, 0x5E), pk6[0x68]));
|
||||
pk6[0x65] = (byte)(PKX.getMovePP(BitConverter.ToInt16(pk6, 0x60), pk6[0x69]));
|
||||
|
||||
// Copy 32bit IV value.
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -1494,10 +1494,10 @@ namespace PKHeX
|
|||
// 01 - Not handled by OT
|
||||
// 07 - CA
|
||||
// 31 - USA
|
||||
byte[] x90x = new byte[] { 0x00, 0x00, g6trgend, 0x01, (byte)subreg, (byte)country, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)getBaseFriendship(species), 0x00, 0x01, 0x04, (byte)(rnd32() % 10), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
byte[] x90x = new byte[] { 0x00, 0x00, g6trgend, 0x01, (byte)subreg, (byte)country, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)PKX.getBaseFriendship(species), 0x00, 0x01, 0x04, (byte)(Util.rnd32() % 10), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
Array.Copy(x90x, 0, pk6, 0x90, x90x.Length);
|
||||
// When transferred, friendship gets reset.
|
||||
pk6[0xCA] = (byte)getBaseFriendship(species);
|
||||
pk6[0xCA] = (byte)PKX.getBaseFriendship(species);
|
||||
|
||||
// Write Origin (USA California) - location is dependent on 3DS system that transfers.
|
||||
pk6[0xE0] = (byte)country;
|
||||
|
@ -1554,19 +1554,6 @@ namespace PKHeX
|
|||
}
|
||||
}
|
||||
|
||||
private static uint LCRNG(uint seed)
|
||||
{
|
||||
uint a = 0x41C64E6D;
|
||||
uint c = 0x00006073;
|
||||
|
||||
seed = (seed * a + c) & 0xFFFFFFFF;
|
||||
return seed;
|
||||
}
|
||||
private static Random rand = new Random();
|
||||
private static uint rnd32()
|
||||
{
|
||||
return (uint)(rand.Next(1 << 30)) << 2 | (uint)(rand.Next(1 << 2));
|
||||
}
|
||||
static DataTable Char3to4E()
|
||||
{
|
||||
DataTable table = new DataTable();
|
||||
|
@ -4819,109 +4806,6 @@ namespace PKHeX
|
|||
#endregion
|
||||
return table;
|
||||
}
|
||||
private int getBaseFriendship(int species)
|
||||
{
|
||||
int fshp = (int)Util.Friendship().Rows[species][1];
|
||||
// return fshp;
|
||||
return fshp;
|
||||
}
|
||||
private int getLevel(int species, uint exp)
|
||||
{
|
||||
DataTable spectable = Util.SpeciesTable();
|
||||
int growth = (int)spectable.Rows[species][1];
|
||||
int tl = 1; // Initial Level
|
||||
if (exp == 0) { return tl; }
|
||||
DataTable table = Util.ExpTable();
|
||||
if ((int)table.Rows[tl][growth + 1] < exp)
|
||||
{
|
||||
while ((int)table.Rows[tl][growth + 1] < exp)
|
||||
{
|
||||
// While EXP for guessed level is below our current exp
|
||||
tl += 1;
|
||||
if (tl == 100)
|
||||
{
|
||||
getEXP(100, species);
|
||||
return tl;
|
||||
}
|
||||
// when calcexp exceeds our exp, we exit loop
|
||||
}
|
||||
if ((int)table.Rows[tl][growth + 1] == exp)
|
||||
{
|
||||
// Matches level threshold
|
||||
return tl;
|
||||
}
|
||||
else return (tl - 1);
|
||||
}
|
||||
else return tl;
|
||||
}
|
||||
private int getEXP(int level, int species)
|
||||
{
|
||||
// Fetch Growth
|
||||
DataTable spectable = Util.SpeciesTable();
|
||||
int growth = (int)spectable.Rows[species][1];
|
||||
int exp;
|
||||
if ((level == 0) || (level == 1))
|
||||
{
|
||||
exp = 0;
|
||||
return exp;
|
||||
}
|
||||
switch (growth)
|
||||
{
|
||||
case 0: // Erratic
|
||||
if (level <= 50)
|
||||
{
|
||||
exp = (level * level * level) * (100 - level) / 50;
|
||||
}
|
||||
else if (level < 69)
|
||||
{
|
||||
exp = (level * level * level) * (150 - level) / 100;
|
||||
}
|
||||
else if (level < 99)
|
||||
{
|
||||
exp = (level * level * level) * ((1911 - 10 * level) / 3) / 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
exp = (level * level * level) * (160 - level) / 100;
|
||||
}
|
||||
return exp;
|
||||
case 1: // Fast
|
||||
exp = 4 * (level * level * level) / 5;
|
||||
return exp;
|
||||
case 2: // Medium Fast
|
||||
exp = (level * level * level);
|
||||
return exp;
|
||||
case 3: // Medium Slow
|
||||
exp = 6 * (level * level * level) / 5 - 15 * (level * level) + 100 * level - 140;
|
||||
return exp;
|
||||
case 4:
|
||||
exp = 5 * (level * level * level) / 4;
|
||||
return exp;
|
||||
case 5:
|
||||
if (level <= 15)
|
||||
{
|
||||
exp = (level * level * level) * ((((level + 1) / 3) + 24) / 50);
|
||||
}
|
||||
else if (level <= 36)
|
||||
{
|
||||
exp = (level * level * level) * ((level + 14) / 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
exp = (level * level * level) * (((level / 2) + 32) / 50);
|
||||
}
|
||||
return exp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
private int getMovePP(int move)
|
||||
{
|
||||
int pp = 0;
|
||||
DataTable movepptable = Util.MovePPTable();
|
||||
if (move == -1) { move = 0; }
|
||||
pp = (int)movepptable.Rows[move][1];
|
||||
return pp;
|
||||
}
|
||||
|
||||
private int getg3species(int g3index)
|
||||
{
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<Compile Include="Misc\CodeGenerator.Designer.cs">
|
||||
<DependentUpon>CodeGenerator.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Misc\PKX.cs" />
|
||||
<Compile Include="PKX\f1-Main.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
960
PKX/f1-Main.cs
960
PKX/f1-Main.cs
File diff suppressed because it is too large
Load diff
|
@ -65,7 +65,7 @@ namespace PKHeX
|
|||
// Conversion
|
||||
public void TranslateInterface(string FORM_NAME)
|
||||
{
|
||||
string curlanguage = m_parent.curlanguage;
|
||||
string curlanguage = Form1.curlanguage;
|
||||
// Fetch a File
|
||||
// Check to see if a the translation file exists in the same folder as the executable
|
||||
string externalLangPath = System.Windows.Forms.Application.StartupPath + "\\lang_" + curlanguage + ".txt";
|
||||
|
@ -127,40 +127,26 @@ namespace PKHeX
|
|||
}
|
||||
}
|
||||
}
|
||||
public static uint ToUInt32(String value)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
return 0;
|
||||
return UInt32.Parse(value);
|
||||
}
|
||||
private static int ToInt32(String value)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
return 0;
|
||||
return Int32.Parse(value);
|
||||
}
|
||||
public int getIndex(ComboBox cb)
|
||||
{
|
||||
int val = 0;
|
||||
try { val = ToInt32(cb.SelectedValue.ToString()); }
|
||||
catch { };
|
||||
return val;
|
||||
}
|
||||
|
||||
// Load/Save Actions
|
||||
private void loadFields()
|
||||
{
|
||||
// Save the region/country values.
|
||||
v1s(Region0, 0x94); v1cb(CB_Country0, 0x95);
|
||||
v1s(Region1, 0x96); v1cb(CB_Country1, 0x97);
|
||||
v1s(Region2, 0x98); v1cb(CB_Country2, 0x99);
|
||||
v1s(Region3, 0x9A); v1cb(CB_Country3, 0x9B);
|
||||
v1s(Region4, 0x9C); v1cb(CB_Country4, 0x9D);
|
||||
|
||||
// Write the Fullness, and Enjoyment
|
||||
v1s(M_Fullness, 0xAE); v1s(M_Enjoyment, 0xAF);
|
||||
|
||||
// Write the CT Memories
|
||||
v1s(M_CT_Friendship, 0xA2); v1s(M_CT_Affection, 0xA3);
|
||||
CB_CTQual.SelectedIndex = Math.Max(0,h[0xA4]-1);
|
||||
v1cb(CB_CTMemory, 0xA5); v2cb(CB_CTVar, 0xA8); i1cb(CB_CTFeel, 0xA6);
|
||||
v1s(M_Fullness, 0xAE); v1s(M_Enjoyment, 0xAF);
|
||||
|
||||
// Write the OT Memories
|
||||
v1s(M_OT_Friendship, 0xCA); v1s(M_OT_Affection, 0xCB);
|
||||
CB_OTQual.SelectedIndex = Math.Max(0,h[0xCC]-1);
|
||||
v1cb(CB_OTMemory, 0xCD); v2cb(CB_OTVar, 0xCE); i1cb(CB_OTFeel, 0xD0);
|
||||
|
@ -187,8 +173,8 @@ namespace PKHeX
|
|||
BTN_Save.Enabled = M_Fullness.Enabled = M_Enjoyment.Enabled = false;
|
||||
L_Fullness.Enabled = L_Enjoyment.Enabled = false;
|
||||
|
||||
GB_M_OT.Text = "N/A: " + m_parent.eggname;
|
||||
GB_M_CT.Text = "N/A: " + m_parent.eggname;
|
||||
GB_M_OT.Text = "N/A: " + Form1.eggname;
|
||||
GB_M_CT.Text = "N/A: " + Form1.eggname;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -202,29 +188,29 @@ namespace PKHeX
|
|||
GB_M_OT.Text = String.Format(withOT + " (" + ot + ")", m_parent.TB_OT.Text);
|
||||
GB_M_CT.Text = String.Format(withOT,m_parent.TB_OTt2.Text);
|
||||
}
|
||||
bool ggnore;
|
||||
|
||||
GB_M_CT.Enabled = true;
|
||||
GB_Residence.Enabled = true;
|
||||
|
||||
if ((!m_parent.CHK_IsEgg.Checked))
|
||||
{
|
||||
int game = (int)(m_parent.getIndex(m_parent.CB_GameOrigin));
|
||||
bool enable = false;
|
||||
int game = (int)(Util.getIndex(m_parent.CB_GameOrigin));
|
||||
if ((game < 24) && (game != 0))
|
||||
{
|
||||
// Banked Mon
|
||||
GB_M_CT.Text = withOT + " " + m_parent.TB_OTt2.Text;
|
||||
GB_M_OT.Text = past + " " + ot + ": " + m_parent.TB_OT.Text;
|
||||
ggnore = false;
|
||||
enable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ggnore = true;
|
||||
enable = true;
|
||||
GB_M_OT.Text = withOT + " " + m_parent.TB_OT.Text + " (" + ot + ")";
|
||||
GB_M_CT.Text = withOT + m_parent.TB_OTt2.Text;
|
||||
if ((m_parent.TB_OTt2.Text == ""))
|
||||
{
|
||||
GB_M_CT.Enabled = false;
|
||||
GB_Residence.Enabled = false;
|
||||
GB_M_CT.Enabled = GB_Residence.Enabled = false;
|
||||
GB_M_CT.Text = notleft + " " + ot + " - " + disabled;
|
||||
}
|
||||
else
|
||||
|
@ -232,7 +218,7 @@ namespace PKHeX
|
|||
GB_M_CT.Text = withOT + " " + m_parent.TB_OTt2.Text;
|
||||
}
|
||||
}
|
||||
RTB_OT.Visible = CB_OTQual.Enabled = CB_OTMemory.Enabled = CB_OTFeel.Enabled = CB_OTVar.Enabled = M_OT_Affection.Enabled = ggnore;
|
||||
RTB_OT.Visible = CB_OTQual.Enabled = CB_OTMemory.Enabled = CB_OTFeel.Enabled = CB_OTVar.Enabled = M_OT_Affection.Enabled = enable;
|
||||
}
|
||||
}
|
||||
private void saveFields()
|
||||
|
@ -323,7 +309,7 @@ namespace PKHeX
|
|||
} // Value (from ByteArray) to String (textBox): 1 byte
|
||||
private void s1v(MaskedTextBox t, int o)
|
||||
{
|
||||
h[o] = (byte)ToUInt32(t.Text);
|
||||
h[o] = (byte)Util.ToUInt32(t.Text);
|
||||
} // String (textBox) to Value (in ByteArray): 1 byte
|
||||
|
||||
private void v1cb(ComboBox cb, int o)
|
||||
|
@ -523,12 +509,12 @@ namespace PKHeX
|
|||
int[] allowed = new int[64];
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
memories[i] = m_parent.memories[39 + i];
|
||||
memories[i] = Form1.memories[39 + i];
|
||||
allowed[i] = i+1;
|
||||
}
|
||||
List<cbItem> memory_list = getComboBoxItems2(memories, allowed);
|
||||
cbItem def = new cbItem();
|
||||
def.Text = m_parent.memories[38+0];
|
||||
def.Text = Form1.memories[38 + 0];
|
||||
def.Value = 0;
|
||||
memory_list.Insert(0, def);
|
||||
|
||||
|
@ -546,8 +532,8 @@ namespace PKHeX
|
|||
CB_OTQual.Items.Clear();
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
CB_CTQual.Items.Add(m_parent.memories[2 + i]);
|
||||
CB_OTQual.Items.Add(m_parent.memories[2 + i]);
|
||||
CB_CTQual.Items.Add(Form1.memories[2 + i]);
|
||||
CB_OTQual.Items.Add(Form1.memories[2 + i]);
|
||||
}
|
||||
|
||||
// Feeling Chooser
|
||||
|
@ -555,8 +541,8 @@ namespace PKHeX
|
|||
CB_OTFeel.Items.Clear();
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
CB_CTFeel.Items.Add(m_parent.memories[10 + i]);
|
||||
CB_OTFeel.Items.Add(m_parent.memories[10 + i]);
|
||||
CB_CTFeel.Items.Add(Form1.memories[10 + i]);
|
||||
CB_OTFeel.Items.Add(Form1.memories[10 + i]);
|
||||
}
|
||||
}
|
||||
private void getMemoryArguments(string ARG, ComboBox sender)
|
||||
|
@ -570,7 +556,7 @@ namespace PKHeX
|
|||
{
|
||||
allowed[i] = i;
|
||||
}
|
||||
List<cbItem> genloc = getComboBoxItems(m_parent.genloc, allowed);
|
||||
List<cbItem> genloc = getComboBoxItems(Form1.genloc, allowed);
|
||||
#endregion
|
||||
#region Items
|
||||
allowed = new int[697]
|
||||
|
@ -591,7 +577,7 @@ namespace PKHeX
|
|||
650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,
|
||||
700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717
|
||||
};
|
||||
List<cbItem> item_list = getComboBoxItems(m_parent.itemlist, allowed);
|
||||
List<cbItem> item_list = getComboBoxItems(Form1.itemlist, allowed);
|
||||
#endregion
|
||||
List<cbItem> species_list = (List<cbItem>)m_parent.CB_Species.DataSource;
|
||||
|
||||
|
@ -599,13 +585,13 @@ namespace PKHeX
|
|||
allowed = new int[] {
|
||||
2,6,8,10,12,14,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,
|
||||
};
|
||||
List<cbItem> locationXY = getComboBoxItems(m_parent.metXY_00000, allowed);
|
||||
List<cbItem> locationXY = getComboBoxItems(Form1.metXY_00000, allowed);
|
||||
#region Moves
|
||||
|
||||
List<cbItem> move_list = new List<cbItem>();
|
||||
// Sort the Rest based on String Name
|
||||
string[] sortedmoves = new string[m_parent.movelist.Length];
|
||||
Array.Copy(m_parent.movelist, sortedmoves, m_parent.movelist.Length);
|
||||
string[] sortedmoves = new string[Form1.movelist.Length];
|
||||
Array.Copy(Form1.movelist, sortedmoves, Form1.movelist.Length);
|
||||
Array.Sort(sortedmoves);
|
||||
|
||||
// Add the rest of the items
|
||||
|
@ -613,7 +599,7 @@ namespace PKHeX
|
|||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Text = sortedmoves[i];
|
||||
ncbi.Value = Array.IndexOf(m_parent.movelist, sortedmoves[i]);
|
||||
ncbi.Value = Array.IndexOf(Form1.movelist, sortedmoves[i]);
|
||||
move_list.Add(ncbi);
|
||||
}
|
||||
|
||||
|
@ -722,27 +708,24 @@ namespace PKHeX
|
|||
string result = "";
|
||||
string nn = m_parent.TB_Nickname.Text;
|
||||
string a = arg.Text;
|
||||
int mem = getIndex(m);
|
||||
int mem = Util.getIndex(m);
|
||||
|
||||
bool enabled = false;
|
||||
if (mem == 0)
|
||||
{
|
||||
result = m_parent.memories[38];
|
||||
}
|
||||
result = Form1.memories[38];
|
||||
else
|
||||
{
|
||||
result = String.Format(m_parent.memories[mem + 38], nn, tr, a, f.Text, q.Text);
|
||||
result = String.Format(Form1.memories[mem + 38], nn, tr, a, f.Text, q.Text);
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
// ugh, labels
|
||||
// Show labels if the memory allows for them.
|
||||
if (q == CB_CTQual)
|
||||
{
|
||||
L_CT_Quality.Visible = L_CT_Feeling.Visible = enabled;
|
||||
}
|
||||
else
|
||||
L_OT_Quality.Visible = L_OT_Feeling.Visible = enabled;
|
||||
|
||||
// Show Quality and Feeling.
|
||||
q.Visible = q.Enabled = f.Visible = f.Enabled = enabled;
|
||||
|
||||
return result;
|
||||
|
@ -753,8 +736,8 @@ namespace PKHeX
|
|||
ComboBox m = (ComboBox)sender;
|
||||
if (m == CB_CTMemory || m == CB_OTMemory)
|
||||
{
|
||||
int memory = getIndex(m);
|
||||
switch (memory) // dis switchtable...
|
||||
int memory = Util.getIndex(m);
|
||||
switch (memory) // Memory Case Switchtable
|
||||
{
|
||||
case 0: getMemoryArguments("NONE", m); break;
|
||||
case 1: getMemoryArguments("GENLOC", m); break;
|
||||
|
@ -877,7 +860,7 @@ namespace PKHeX
|
|||
MaskedTextBox mtb = sender as MaskedTextBox;
|
||||
try
|
||||
{
|
||||
int val = ToInt32(mtb.Text);
|
||||
int val = Util.ToInt32(mtb.Text);
|
||||
if (val > 255) mtb.Text = "255";
|
||||
}
|
||||
catch { mtb.Text = "0"; }
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace PKHeX
|
|||
// Set up Training Bag Data
|
||||
comboBox1.Items.Clear();
|
||||
comboBox1.Items.Add("---");
|
||||
for (int i = 1; i < m_parent.trainingbags.Length-1; i++)
|
||||
comboBox1.Items.Add(m_parent.trainingbags[i]);
|
||||
for (int i = 1; i < Form1.trainingbags.Length - 1; i++)
|
||||
comboBox1.Items.Add(Form1.trainingbags[i]);
|
||||
comboBox1.SelectedIndex = m_parent.buff[0x17];
|
||||
numericUpDown1.Value = m_parent.buff[0x16];
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace PKHeX
|
|||
}
|
||||
public void TranslateInterface(string FORM_NAME)
|
||||
{
|
||||
string curlanguage = m_parent.curlanguage;
|
||||
string curlanguage = Form1.curlanguage;
|
||||
// Fetch a File
|
||||
// Check to see if a the translation file exists in the same folder as the executable
|
||||
string externalLangPath = System.Windows.Forms.Application.StartupPath + "\\lang_" + curlanguage + ".txt";
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace PKHeX
|
|||
if (data.Length <= (31 - index) * (0xE8 * 30))
|
||||
{
|
||||
Array.Copy(data, 0, m_parent.savefile, offset, data.Length);
|
||||
m_parent.getPKXBoxes();
|
||||
m_parent.setPKXBoxes();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -11,18 +11,17 @@ namespace PKHeX
|
|||
{
|
||||
public partial class SAV_BoxLayout : Form
|
||||
{
|
||||
public SAV_BoxLayout(Form1 frm1)
|
||||
public SAV_BoxLayout()
|
||||
{
|
||||
InitializeComponent();
|
||||
m_parent = frm1;
|
||||
editing = true;
|
||||
Array.Copy(m_parent.savefile, sav, 0x100000);
|
||||
savindex = m_parent.savindex;
|
||||
|
||||
// Repopulate Wallpaper names
|
||||
CB_BG.Items.Clear();
|
||||
for (int i = 0; i < m_parent.wallpapernames.Length; i++)
|
||||
CB_BG.Items.Add(m_parent.wallpapernames[i]);
|
||||
for (int i = 0; i < Form1.wallpapernames.Length; i++)
|
||||
CB_BG.Items.Add(Form1.wallpapernames[i]);
|
||||
|
||||
// Go
|
||||
LB_BoxSelect.SelectedIndex = m_parent.C_BoxSelect.SelectedIndex;
|
||||
|
@ -86,8 +85,8 @@ namespace PKHeX
|
|||
{
|
||||
Array.Copy(sav, m_parent.savefile, 0x100000);
|
||||
m_parent.savedited = true;
|
||||
m_parent.getBoxNames();
|
||||
m_parent.getPKXBoxes();
|
||||
m_parent.setBoxNames();
|
||||
m_parent.setPKXBoxes();
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -106,14 +106,14 @@ namespace PKHeX
|
|||
else shinystr = "Yes";
|
||||
|
||||
RTB.Text += "Name: " + nickname;
|
||||
RTB.Text += " (" + m_parent.specieslist[species] + " - " + genderstr + ")\r\n";
|
||||
RTB.Text += " (" + Form1.specieslist[species] + " - " + genderstr + ")\r\n";
|
||||
RTB.Text += "Level: " + level.ToString() + "\r\n";
|
||||
RTB.Text += "Shiny: " + shinystr + "\r\n";
|
||||
RTB.Text += "Held Item: " + m_parent.itemlist[helditem] + "\r\n";
|
||||
RTB.Text += "Move 1: " + m_parent.movelist[move1] + "\r\n";
|
||||
RTB.Text += "Move 2: " + m_parent.movelist[move2] + "\r\n";
|
||||
RTB.Text += "Move 3: " + m_parent.movelist[move3] + "\r\n";
|
||||
RTB.Text += "Move 4: " + m_parent.movelist[move4] + "\r\n";
|
||||
RTB.Text += "Held Item: " + Form1.itemlist[helditem] + "\r\n";
|
||||
RTB.Text += "Move 1: " + Form1.movelist[move1] + "\r\n";
|
||||
RTB.Text += "Move 2: " + Form1.movelist[move2] + "\r\n";
|
||||
RTB.Text += "Move 3: " + Form1.movelist[move3] + "\r\n";
|
||||
RTB.Text += "Move 4: " + Form1.movelist[move4] + "\r\n";
|
||||
RTB.Text += "OT: " + OTname + " (" + TID.ToString() + "/" + SID.ToString() + ")\r\n";
|
||||
RTB.Text += "\r\n";
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ namespace PKHeX
|
|||
|
||||
popItems();
|
||||
|
||||
B_DisplayItems.Text = m_parent.itempouch[0];
|
||||
B_DisplayMedicine.Text = m_parent.itempouch[1];
|
||||
B_DisplayTMHM.Text = m_parent.itempouch[2];
|
||||
B_DisplayBerries.Text = m_parent.itempouch[3];
|
||||
B_DisplayKeyItems.Text = m_parent.itempouch[4];
|
||||
B_DisplayItems.Text = Form1.itempouch[0];
|
||||
B_DisplayMedicine.Text = Form1.itempouch[1];
|
||||
B_DisplayTMHM.Text = Form1.itempouch[2];
|
||||
B_DisplayBerries.Text = Form1.itempouch[3];
|
||||
B_DisplayKeyItems.Text = Form1.itempouch[4];
|
||||
}
|
||||
Form1 m_parent;
|
||||
public byte[] sav = new Byte[0x100000];
|
||||
|
@ -69,7 +69,7 @@ namespace PKHeX
|
|||
};
|
||||
item_val = new string[itemlist.Length];
|
||||
for (int i = 0; i < itemlist.Length; i++)
|
||||
item_val[i] = m_parent.itemlist[itemlist[i]];
|
||||
item_val[i] = Form1.itemlist[itemlist[i]];
|
||||
Array.Sort(item_val);
|
||||
}
|
||||
private void getListKeyItems()
|
||||
|
@ -82,7 +82,7 @@ namespace PKHeX
|
|||
};
|
||||
keyitem_val = new string[itemlist.Length];
|
||||
for (int i = 0; i < itemlist.Length; i++)
|
||||
keyitem_val[i] = m_parent.itemlist[itemlist[i]];
|
||||
keyitem_val[i] = Form1.itemlist[itemlist[i]];
|
||||
Array.Sort(keyitem_val);
|
||||
}
|
||||
private void getListTMHM()
|
||||
|
@ -100,7 +100,7 @@ namespace PKHeX
|
|||
};
|
||||
tmhm_val = new string[itemlist.Length];
|
||||
for (int i = 0; i < itemlist.Length; i++)
|
||||
tmhm_val[i] = m_parent.itemlist[itemlist[i]];
|
||||
tmhm_val[i] = Form1.itemlist[itemlist[i]];
|
||||
// Array.Sort(tmhm_val); Already sorted, keep HMs last.
|
||||
}
|
||||
private void getListMedicine()
|
||||
|
@ -112,7 +112,7 @@ namespace PKHeX
|
|||
};
|
||||
medicine_val = new string[itemlist.Length];
|
||||
for (int i = 0; i < itemlist.Length; i++)
|
||||
medicine_val[i] = m_parent.itemlist[itemlist[i]];
|
||||
medicine_val[i] = Form1.itemlist[itemlist[i]];
|
||||
Array.Sort(medicine_val);
|
||||
}
|
||||
private void getListBerries()
|
||||
|
@ -126,7 +126,7 @@ namespace PKHeX
|
|||
};
|
||||
berries_val = new string[itemlist.Length];
|
||||
for (int i = 0; i < itemlist.Length; i++)
|
||||
berries_val[i] = m_parent.itemlist[itemlist[i]];
|
||||
berries_val[i] = Form1.itemlist[itemlist[i]];
|
||||
Array.Sort(berries_val);
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ namespace PKHeX
|
|||
int itemvalue = BitConverter.ToUInt16(sav, offset + i*4);
|
||||
try
|
||||
{
|
||||
itemname = m_parent.itemlist[itemvalue];
|
||||
itemname = Form1.itemlist[itemvalue];
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -257,7 +257,7 @@ namespace PKHeX
|
|||
for (int i = 0; i < itemcount; i++)
|
||||
{
|
||||
string item = dataGridView1.Rows[i].Cells[0].Value.ToString();
|
||||
int itemindex = Array.IndexOf(m_parent.itemlist, item);
|
||||
int itemindex = Array.IndexOf(Form1.itemlist, item);
|
||||
int itemcnt = 0;
|
||||
try {
|
||||
itemcnt = Convert.ToUInt16(dataGridView1.Rows[i].Cells[1].Value.ToString());
|
||||
|
|
|
@ -12,12 +12,12 @@ namespace PKHeX
|
|||
{
|
||||
public partial class SAV_Pokedex : Form
|
||||
{
|
||||
public SAV_Pokedex(Form1 frm1)
|
||||
Form1 m_parent;
|
||||
public SAV_Pokedex()
|
||||
{
|
||||
m_parent = frm1;
|
||||
InitializeComponent();
|
||||
Array.Copy(m_parent.savefile, sav, sav.Length);
|
||||
savshift = m_parent.savindex*0x7F000;
|
||||
Array.Copy(m_parent.savefile, sav, sav.Length);
|
||||
savshift = m_parent.savindex * 0x7F000;
|
||||
Setup();
|
||||
editing = false;
|
||||
LB_Species.SelectedIndex = 0;
|
||||
|
@ -28,7 +28,6 @@ namespace PKHeX
|
|||
public bool[,] specbools = new bool[10, 0x60 * 8];
|
||||
public bool[,] langbools = new bool[7, 0x60 * 8];
|
||||
public bool[] foreignbools = new bool[0x52 * 8];
|
||||
Form1 m_parent;
|
||||
bool editing = true;
|
||||
private void Setup()
|
||||
{
|
||||
|
@ -45,8 +44,8 @@ namespace PKHeX
|
|||
{
|
||||
List<cbItem> species_list = new List<cbItem>();
|
||||
// Sort the Rest based on String Name
|
||||
string[] sortedspecies = new string[m_parent.specieslist.Length];
|
||||
Array.Copy(m_parent.specieslist, sortedspecies, m_parent.specieslist.Length);
|
||||
string[] sortedspecies = new string[Form1.specieslist.Length];
|
||||
Array.Copy(Form1.specieslist, sortedspecies, Form1.specieslist.Length);
|
||||
Array.Sort(sortedspecies);
|
||||
|
||||
// Add the rest of the items
|
||||
|
@ -54,7 +53,7 @@ namespace PKHeX
|
|||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Text = sortedspecies[i];
|
||||
ncbi.Value = Array.IndexOf(m_parent.specieslist, sortedspecies[i]);
|
||||
ncbi.Value = Array.IndexOf(Form1.specieslist, sortedspecies[i]);
|
||||
species_list.Add(ncbi);
|
||||
}
|
||||
species_list.RemoveAt(0); // Remove 0th Entry
|
||||
|
@ -64,9 +63,9 @@ namespace PKHeX
|
|||
}
|
||||
#endregion
|
||||
|
||||
for (int i = 1; i < m_parent.specieslist.Length; i++)
|
||||
for (int i = 1; i < Form1.specieslist.Length; i++)
|
||||
{
|
||||
LB_Species.Items.Add(i.ToString("000") + " - " + m_parent.specieslist[i]);
|
||||
LB_Species.Items.Add(i.ToString("000") + " - " + Form1.specieslist[i]);
|
||||
}
|
||||
for (int i = 722; i <= 0x300; i++)
|
||||
LB_Species.Items.Add(i.ToString("000") + " - ???");
|
||||
|
@ -168,7 +167,7 @@ namespace PKHeX
|
|||
CHK_P10.Enabled = true;
|
||||
|
||||
int index = LB_Species.SelectedIndex + 1;
|
||||
DataTable spectable = Util.SpeciesTable();
|
||||
DataTable spectable = PKX.SpeciesTable();
|
||||
int gt = (int)spectable.Rows[index][8];
|
||||
|
||||
CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = (((gt > 255) && (gt != 257)) || gt < 256);
|
||||
|
@ -267,7 +266,7 @@ namespace PKHeX
|
|||
// Store Spinda Spot
|
||||
try
|
||||
{
|
||||
uint PID = m_parent.getHEXval(TB_Spinda);
|
||||
uint PID = Util.getHEXval(TB_Spinda);
|
||||
Array.Copy(BitConverter.GetBytes(PID), 0, sav, 0x1AA48 + savshift, 4);
|
||||
}
|
||||
catch { };
|
||||
|
@ -296,7 +295,7 @@ namespace PKHeX
|
|||
CHK_F1.Checked = !(ModifierKeys == Keys.Control);
|
||||
}
|
||||
int index = LB_Species.SelectedIndex+1;
|
||||
DataTable spectable = Util.SpeciesTable();
|
||||
DataTable spectable = PKX.SpeciesTable();
|
||||
int gt = (int)spectable.Rows[index][8];
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = CHK_P6.Checked = CHK_P8.Checked = (((gt > 255) && (gt != 257)) || gt < 256) && !(ModifierKeys == Keys.Control);
|
||||
|
|
|
@ -11,12 +11,11 @@ namespace PKHeX
|
|||
{
|
||||
public partial class SAV_Pokepuff : Form
|
||||
{
|
||||
public SAV_Pokepuff(Form1 frm1)
|
||||
public SAV_Pokepuff()
|
||||
{
|
||||
InitializeComponent();
|
||||
m_parent = frm1;
|
||||
Array.Copy(m_parent.savefile, sav, 0x100000);
|
||||
pfa = m_parent.puffs;
|
||||
pfa = Form1.puffs;
|
||||
savindex = m_parent.savindex;
|
||||
pfa[0] = "---";
|
||||
setup();
|
||||
|
|
|
@ -11,19 +11,18 @@ namespace PKHeX
|
|||
{
|
||||
public partial class SAV_SuperTrain : Form
|
||||
{
|
||||
public SAV_SuperTrain(Form1 frm1)
|
||||
public SAV_SuperTrain()
|
||||
{
|
||||
m_parent = frm1;
|
||||
savindex = m_parent.savindex;
|
||||
specieslist = m_parent.specieslist;
|
||||
specieslist = Form1.specieslist;
|
||||
Array.Copy(m_parent.savefile, sav, 0x100000);
|
||||
trba = m_parent.trainingbags;
|
||||
trba = Form1.trainingbags;
|
||||
trba[0] = "---";
|
||||
offsetTime = 0x24608 + 0x7F000 * savindex;
|
||||
offsetSpec = 0x24788 + 0x7F000 * savindex;
|
||||
offsetVal = 0x2478A + 0x7F000 * savindex;
|
||||
InitializeComponent();
|
||||
string[] stages = m_parent.trainingstage;
|
||||
string[] stages = Form1.trainingstage;
|
||||
listBox1.Items.Clear();
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
|
|
|
@ -97,12 +97,12 @@ namespace PKHeX
|
|||
|
||||
string OTname = Util.TrimFromZero(Encoding.Unicode.GetString(wondercard_data, 0xB6, 22));
|
||||
RTB.Text +=
|
||||
"\r\nSpecies: " + m_parent.specieslist[species] + "\r\n"
|
||||
+ "Item: " + m_parent.itemlist[helditem] + "\r\n"
|
||||
+ "Move 1: " + m_parent.movelist[move1] + "\r\n"
|
||||
+ "Move 2: " + m_parent.movelist[move2] + "\r\n"
|
||||
+ "Move 3: " + m_parent.movelist[move3] + "\r\n"
|
||||
+ "Move 4: " + m_parent.movelist[move4] + "\r\n"
|
||||
"\r\nSpecies: " + Form1.specieslist[species] + "\r\n"
|
||||
+ "Item: " + Form1.itemlist[helditem] + "\r\n"
|
||||
+ "Move 1: " + Form1.movelist[move1] + "\r\n"
|
||||
+ "Move 2: " + Form1.movelist[move2] + "\r\n"
|
||||
+ "Move 3: " + Form1.movelist[move3] + "\r\n"
|
||||
+ "Move 4: " + Form1.movelist[move4] + "\r\n"
|
||||
+ "OT: " + OTname + "\r\n"
|
||||
+ "ID: " + TID.ToString() + "/" + SID.ToString();
|
||||
}
|
||||
|
@ -234,8 +234,8 @@ namespace PKHeX
|
|||
|
||||
Array.Copy(sav, m_parent.savefile, 0x100000);
|
||||
m_parent.savedited = true;
|
||||
m_parent.getBoxNames();
|
||||
m_parent.getPKXBoxes();
|
||||
m_parent.setBoxNames();
|
||||
m_parent.setPKXBoxes();
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
310
SAV/frmReport.cs
310
SAV/frmReport.cs
|
@ -1,17 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Security.Cryptography;
|
||||
using System.Reflection;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Security.Cryptography;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
public partial class frmReport : Form
|
||||
public partial class frmReport : Form1
|
||||
{
|
||||
private byte[] SaveData;
|
||||
private const int PIDOFFSET = 0x18;
|
||||
|
@ -167,301 +168,6 @@ namespace PKHeX
|
|||
|
||||
return input.Substring(0, index);
|
||||
}
|
||||
public class PKX
|
||||
{
|
||||
#region Define
|
||||
private Image pksprite;
|
||||
private uint mEC, mPID, mIV32,
|
||||
|
||||
mexp,
|
||||
mHP_EV, mATK_EV, mDEF_EV, mSPA_EV, mSPD_EV, mSPE_EV,
|
||||
mHP_IV, mATK_IV, mDEF_IV, mSPE_IV, mSPA_IV, mSPD_IV,
|
||||
mcnt_cool, mcnt_beauty, mcnt_cute, mcnt_smart, mcnt_tough, mcnt_sheen,
|
||||
mmarkings, mhptype;
|
||||
|
||||
private string
|
||||
mnicknamestr, mgenderstring, mnotOT, mot, mSpeciesName, mNatureName, mHPName, mAbilityName,
|
||||
mMove1N, mMove2N, mMove3N, mMove4N;
|
||||
|
||||
private int
|
||||
mability, mabilitynum, mnature, mfeflag, mgenderflag, maltforms, mPKRS_Strain, mPKRS_Duration,
|
||||
mmetlevel, motgender;
|
||||
|
||||
private bool
|
||||
misegg, misnick, misshiny;
|
||||
|
||||
private ushort
|
||||
mspecies, mhelditem, mTID, mSID, mTSV, mESV,
|
||||
mmove1, mmove2, mmove3, mmove4,
|
||||
mmove1_pp, mmove2_pp, mmove3_pp, mmove4_pp,
|
||||
mmove1_ppu, mmove2_ppu, mmove3_ppu, mmove4_ppu,
|
||||
meggmove1, meggmove2, meggmove3, meggmove4,
|
||||
mchk,
|
||||
|
||||
mOTfriendship, mOTaffection,
|
||||
megg_year, megg_month, megg_day,
|
||||
mmet_year, mmet_month, mmet_day,
|
||||
meggloc, mmetloc,
|
||||
mball, mencountertype,
|
||||
mgamevers, mcountryID, mregionID, mdsregID, motlang;
|
||||
|
||||
#endregion
|
||||
public Image pkimg { get { return pksprite; } }
|
||||
public string Nickname { get { return mnicknamestr; } }
|
||||
public string Species { get { return mSpeciesName; } }
|
||||
public string Nature { get { return mNatureName; } }
|
||||
public string Gender { get { return mgenderstring; } }
|
||||
public string ESV { get { return mESV.ToString("0000"); } }
|
||||
public string HP_Type { get { return mHPName; } }
|
||||
public string Ability { get { return mAbilityName; } }
|
||||
public string Move1 { get { return mMove1N; } }
|
||||
public string Move2 { get { return mMove2N; } }
|
||||
public string Move3 { get { return mMove3N; } }
|
||||
public string Move4 { get { return mMove4N; } }
|
||||
#region Extraneous
|
||||
public string EC { get { return mEC.ToString("X8"); } }
|
||||
public string PID { get { return mPID.ToString("X8"); } }
|
||||
public uint HP_IV { get { return mHP_IV; } }
|
||||
public uint ATK_IV { get { return mATK_IV; } }
|
||||
public uint DEF_IV { get { return mDEF_IV; } }
|
||||
public uint SPA_IV { get { return mSPA_IV; } }
|
||||
public uint SPD_IV { get { return mSPD_IV; } }
|
||||
public uint SPE_IV { get { return mSPE_IV; } }
|
||||
public uint EXP { get { return mexp; } }
|
||||
public uint HP_EV { get { return mHP_EV; } }
|
||||
public uint ATK_EV { get { return mATK_EV; } }
|
||||
public uint DEF_EV { get { return mDEF_EV; } }
|
||||
public uint SPA_EV { get { return mSPA_EV; } }
|
||||
public uint SPD_EV { get { return mSPD_EV; } }
|
||||
public uint SPE_EV { get { return mSPE_EV; } }
|
||||
public uint Cool { get { return mcnt_cool; } }
|
||||
public uint Beauty { get { return mcnt_beauty; } }
|
||||
public uint Cute { get { return mcnt_cute; } }
|
||||
public uint Smart { get { return mcnt_smart; } }
|
||||
public uint Tough { get { return mcnt_tough; } }
|
||||
public uint Sheen { get { return mcnt_sheen; } }
|
||||
public uint Markings { get { return mmarkings; } }
|
||||
|
||||
public string NotOT { get { return mnotOT; } }
|
||||
public string OT { get { return mot; } }
|
||||
|
||||
public int AbilityNum { get { return mabilitynum; } }
|
||||
public int FatefulFlag { get { return mfeflag; } }
|
||||
public int GenderFlag { get { return mgenderflag; } }
|
||||
public int AltForms { get { return maltforms; } }
|
||||
public int PKRS_Strain { get { return mPKRS_Strain; } }
|
||||
public int PKRS_Days { get { return mPKRS_Duration; } }
|
||||
public int MetLevel { get { return mmetlevel; } }
|
||||
public int OT_Gender { get { return motgender; } }
|
||||
|
||||
public bool IsEgg { get { return misegg; } }
|
||||
public bool IsNicknamed { get { return misnick; } }
|
||||
public bool IsShiny { get { return misshiny; } }
|
||||
|
||||
public ushort HeldItem { get { return mhelditem; } }
|
||||
public ushort TID { get { return mTID; } }
|
||||
public ushort SID { get { return mSID; } }
|
||||
public ushort TSV { get { return mTSV; } }
|
||||
public ushort Move1_PP { get { return mmove1_pp; } }
|
||||
public ushort Move2_PP { get { return mmove2_pp; } }
|
||||
public ushort Move3_PP { get { return mmove3_pp; } }
|
||||
public ushort Move4_PP { get { return mmove4_pp; } }
|
||||
public ushort Move1_PPUp { get { return mmove1_ppu; } }
|
||||
public ushort Move2_PPUp { get { return mmove2_ppu; } }
|
||||
public ushort Move3_PPUp { get { return mmove3_ppu; } }
|
||||
public ushort Move4_PPUp { get { return mmove4_ppu; } }
|
||||
public ushort EggMove1 { get { return meggmove1; } }
|
||||
public ushort EggMove2 { get { return meggmove2; } }
|
||||
public ushort EggMove3 { get { return meggmove3; } }
|
||||
public ushort EggMove4 { get { return meggmove4; } }
|
||||
public ushort Checksum { get { return mchk; } }
|
||||
public ushort Friendship { get { return mOTfriendship; } }
|
||||
public ushort OT_Affection { get { return mOTaffection; } }
|
||||
public ushort Egg_Year { get { return megg_year; } }
|
||||
public ushort Egg_Day { get { return megg_month; } }
|
||||
public ushort Egg_Month { get { return megg_day; } }
|
||||
public ushort Met_Year { get { return mmet_year; } }
|
||||
public ushort Met_Day { get { return mmet_month; } }
|
||||
public ushort Met_Month { get { return mmet_day; } }
|
||||
public ushort Egg_Location { get { return meggloc; } }
|
||||
public ushort Met_Location { get { return mmetloc; } }
|
||||
public ushort Ball { get { return mball; } }
|
||||
public ushort Encounter { get { return mencountertype; } }
|
||||
public ushort GameVersion { get { return mgamevers; } }
|
||||
public ushort CountryID { get { return mcountryID; } }
|
||||
public ushort RegionID { get { return mregionID; } }
|
||||
public ushort DSRegionID { get { return mdsregID; } }
|
||||
public ushort OTLang { get { return motlang; } }
|
||||
|
||||
#endregion
|
||||
public PKX(byte[] pkx)
|
||||
{
|
||||
mnicknamestr = "";
|
||||
mnotOT = "";
|
||||
mot = "";
|
||||
mEC = BitConverter.ToUInt32(pkx, 0);
|
||||
mchk = BitConverter.ToUInt16(pkx, 6);
|
||||
mspecies = BitConverter.ToUInt16(pkx, 0x08);
|
||||
mhelditem = BitConverter.ToUInt16(pkx, 0x0A);
|
||||
mTID = BitConverter.ToUInt16(pkx, 0x0C);
|
||||
mSID = BitConverter.ToUInt16(pkx, 0x0E);
|
||||
mexp = BitConverter.ToUInt32(pkx, 0x10);
|
||||
mability = pkx[0x14];
|
||||
mabilitynum = pkx[0x15];
|
||||
// 0x16, 0x17 - unknown
|
||||
mPID = BitConverter.ToUInt32(pkx, 0x18);
|
||||
mnature = pkx[0x1C];
|
||||
mfeflag = pkx[0x1D] % 2;
|
||||
mgenderflag = (pkx[0x1D] >> 1) & 0x3;
|
||||
maltforms = (pkx[0x1D] >> 3);
|
||||
mHP_EV = pkx[0x1E];
|
||||
mATK_EV = pkx[0x1F];
|
||||
mDEF_EV = pkx[0x20];
|
||||
mSPA_EV = pkx[0x22];
|
||||
mSPD_EV = pkx[0x23];
|
||||
mSPE_EV = pkx[0x21];
|
||||
mcnt_cool = pkx[0x24];
|
||||
mcnt_beauty = pkx[0x25];
|
||||
mcnt_cute = pkx[0x26];
|
||||
mcnt_smart = pkx[0x27];
|
||||
mcnt_tough = pkx[0x28];
|
||||
mcnt_sheen = pkx[0x29];
|
||||
mmarkings = pkx[0x2A];
|
||||
mPKRS_Strain = pkx[0x2B] >> 4;
|
||||
mPKRS_Duration = pkx[0x2B] % 0x10;
|
||||
|
||||
// Block B
|
||||
mnicknamestr = TrimFromZero(Encoding.Unicode.GetString(pkx, 0x40, 24));
|
||||
// 0x58, 0x59 - unused
|
||||
mmove1 = BitConverter.ToUInt16(pkx, 0x5A);
|
||||
mmove2 = BitConverter.ToUInt16(pkx, 0x5C);
|
||||
mmove3 = BitConverter.ToUInt16(pkx, 0x5E);
|
||||
mmove4 = BitConverter.ToUInt16(pkx, 0x60);
|
||||
mmove1_pp = pkx[0x62];
|
||||
mmove2_pp = pkx[0x63];
|
||||
mmove3_pp = pkx[0x64];
|
||||
mmove4_pp = pkx[0x65];
|
||||
mmove1_ppu = pkx[0x66];
|
||||
mmove2_ppu = pkx[0x67];
|
||||
mmove3_ppu = pkx[0x68];
|
||||
mmove4_ppu = pkx[0x69];
|
||||
meggmove1 = BitConverter.ToUInt16(pkx, 0x6A);
|
||||
meggmove2 = BitConverter.ToUInt16(pkx, 0x6C);
|
||||
meggmove3 = BitConverter.ToUInt16(pkx, 0x6E);
|
||||
meggmove4 = BitConverter.ToUInt16(pkx, 0x70);
|
||||
|
||||
// 0x72 - Super Training Flag - Passed with pkx to new form
|
||||
|
||||
// 0x73 - unused/unknown
|
||||
mIV32 = BitConverter.ToUInt32(pkx, 0x74);
|
||||
mHP_IV = mIV32 & 0x1F;
|
||||
mATK_IV = (mIV32 >> 5) & 0x1F;
|
||||
mDEF_IV = (mIV32 >> 10) & 0x1F;
|
||||
mSPE_IV = (mIV32 >> 15) & 0x1F;
|
||||
mSPA_IV = (mIV32 >> 20) & 0x1F;
|
||||
mSPD_IV = (mIV32 >> 25) & 0x1F;
|
||||
misegg = Convert.ToBoolean((mIV32 >> 30) & 1);
|
||||
misnick = Convert.ToBoolean((mIV32 >> 31));
|
||||
|
||||
// Block C
|
||||
mnotOT = TrimFromZero(Encoding.Unicode.GetString(pkx, 0x78, 24));
|
||||
bool notOTG = Convert.ToBoolean(pkx[0x92]);
|
||||
// Memory Editor edits everything else with pkx in a new form
|
||||
|
||||
// Block D
|
||||
mot = TrimFromZero(Encoding.Unicode.GetString(pkx, 0xB0, 24));
|
||||
// 0xC8, 0xC9 - unused
|
||||
mOTfriendship = pkx[0xCA];
|
||||
mOTaffection = pkx[0xCB]; // Handled by Memory Editor
|
||||
// 0xCC, 0xCD, 0xCE, 0xCF, 0xD0
|
||||
megg_year = pkx[0xD1];
|
||||
megg_month = pkx[0xD2];
|
||||
megg_day = pkx[0xD3];
|
||||
mmet_year = pkx[0xD4];
|
||||
mmet_month = pkx[0xD5];
|
||||
mmet_day = pkx[0xD6];
|
||||
// 0xD7 - unused
|
||||
meggloc = BitConverter.ToUInt16(pkx, 0xD8);
|
||||
mmetloc = BitConverter.ToUInt16(pkx, 0xDA);
|
||||
mball = pkx[0xDC];
|
||||
mmetlevel = pkx[0xDD] & 0x7F;
|
||||
motgender = (pkx[0xDD]) >> 7;
|
||||
mencountertype = pkx[0xDE];
|
||||
mgamevers = pkx[0xDF];
|
||||
mcountryID = pkx[0xE0];
|
||||
mregionID = pkx[0xE1];
|
||||
mdsregID = pkx[0xE2];
|
||||
motlang = pkx[0xE3];
|
||||
|
||||
if (mgenderflag == 0)
|
||||
{
|
||||
mgenderstring = "♂";
|
||||
}
|
||||
else if (mgenderflag == 1)
|
||||
{
|
||||
mgenderstring = "♀";
|
||||
}
|
||||
else mgenderstring = "-";
|
||||
|
||||
mhptype = (15 * ((mHP_IV & 1) + 2 * (mATK_IV & 1) + 4 * (mDEF_IV & 1) + 8 * (mSPE_IV & 1) + 16 * (mSPA_IV & 1) + 32 * (mSPD_IV & 1))) / 63 + 1;
|
||||
|
||||
mTSV = (ushort)((mTID ^ mSID) >> 4);
|
||||
mESV = (ushort)(((mPID >> 16) ^ (mPID & 0xFFFF)) >> 4);
|
||||
|
||||
misshiny = (mTSV == mESV);
|
||||
// Nidoran Gender Fixing Text
|
||||
if (!Convert.ToBoolean(misnick))
|
||||
{
|
||||
if (mnicknamestr.Contains((char)0xE08F))
|
||||
{
|
||||
mnicknamestr = Regex.Replace(mnicknamestr, "\uE08F", "\u2640");
|
||||
}
|
||||
else if (mnicknamestr.Contains((char)0xE08E))
|
||||
{
|
||||
mnicknamestr = Regex.Replace(mnicknamestr, "\uE08E", "\u2642");
|
||||
}
|
||||
}
|
||||
{
|
||||
int species = BitConverter.ToInt16(pkx, 0x08); // Get Species
|
||||
uint isegg = (BitConverter.ToUInt32(pkx, 0x74) >> 30) & 1;
|
||||
|
||||
int altforms = (pkx[0x1D] >> 3);
|
||||
int gender = (pkx[0x1D] >> 1) & 0x3;
|
||||
|
||||
string file;
|
||||
if (isegg == 1)
|
||||
{ file = "egg"; }
|
||||
else
|
||||
{
|
||||
file = "_" + species.ToString();
|
||||
if (altforms > 0) // Alt Form Handling
|
||||
{
|
||||
file = file + "_" + altforms.ToString();
|
||||
}
|
||||
else if ((species == 521) && (gender == 1)) // Unfezant
|
||||
{
|
||||
file = file = "_" + species.ToString() + "f";
|
||||
}
|
||||
}
|
||||
if (species == 0)
|
||||
file = "_0";
|
||||
|
||||
pksprite = (Image)Properties.Resources.ResourceManager.GetObject(file);
|
||||
}
|
||||
try
|
||||
{
|
||||
mSpeciesName = m_parent.specieslist[mspecies];
|
||||
mNatureName = m_parent.natures[mnature];
|
||||
mHPName = m_parent.types[mhptype];
|
||||
mAbilityName = m_parent.abilitylist[mability];
|
||||
mMove1N = m_parent.movelist[mmove1];
|
||||
mMove2N = m_parent.movelist[mmove2];
|
||||
mMove3N = m_parent.movelist[mmove3];
|
||||
mMove4N = m_parent.movelist[mmove4];
|
||||
}
|
||||
catch { return; }
|
||||
}
|
||||
}
|
||||
public class PokemonList : System.Collections.ObjectModel.ObservableCollection<PKX> { }
|
||||
}
|
||||
public static class ExtensionMethods // Speed up scrolling
|
||||
|
|
Loading…
Reference in a new issue