mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-27 14:28:49 -05:00
Refactoring round two
Introduced the fully editable PK6 class object, which is now used by PKHeX's pk6 editor, as well as updated the Box Data Report. Readability should be increased as no Includes bug fixes: Odaxis' report regarding Event Flag Editor Showdown sets using "Trait" instead of "Ability" (old old style) now can be read. Imported showdown sets will not use the imported gender label (instead uses the current style, same 'value')
This commit is contained in:
518
Misc/PK6.cs
Normal file
518
Misc/PK6.cs
Normal file
@@ -0,0 +1,518 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
public class PK6 : PKX
|
||||
{
|
||||
public PK6(byte[] pkx, string ident = null)
|
||||
{
|
||||
Data = (byte[])pkx.Clone();
|
||||
Identifier = ident;
|
||||
if (Data.Length != 260)
|
||||
Array.Resize(ref Data, 260);
|
||||
}
|
||||
|
||||
// Internal Attributes set on creation
|
||||
public byte[] Data; // Raw Storage
|
||||
public string Identifier; // User or Form Custom Attribute
|
||||
|
||||
// Structure
|
||||
#region Block A
|
||||
public uint EncryptionConstant
|
||||
{
|
||||
get { return BitConverter.ToUInt32(Data, 0x00); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x00, 4); }
|
||||
}
|
||||
public ushort Sanity
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x02); }
|
||||
// set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x04, 2); }
|
||||
}
|
||||
public ushort Checksum
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x06); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x06, 2); }
|
||||
}
|
||||
public int Species
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x08); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x08, 2); }
|
||||
}
|
||||
public int HeldItem
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x0A); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x0A, 2); }
|
||||
}
|
||||
public int TID
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x0C); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x0C, 2); }
|
||||
}
|
||||
public int SID
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x0E); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x0E, 2); }
|
||||
}
|
||||
public uint EXP
|
||||
{
|
||||
get { return BitConverter.ToUInt32(Data, 0x10); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x10, 4); }
|
||||
}
|
||||
public int Ability { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
|
||||
public int AbilityNumber { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } }
|
||||
public int TrainingBagHits { get { return Data[0x16]; } set { Data[0x16] = (byte)value; } }
|
||||
public int TrainingBag { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } }
|
||||
public uint PID
|
||||
{
|
||||
get { return BitConverter.ToUInt32(Data, 0x18); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x18, 4); }
|
||||
}
|
||||
public int Nature { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } }
|
||||
public bool FatefulEncounter { get { return (Data[0x1D] & 1) == 1; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x01 | (value ? 1 : 0)); } }
|
||||
public int Gender { get { return (Data[0x1D] >> 1) & 0x3; } set { Data[0x1D] = (byte)(Data[0x1D] & 0xF9 | (value << 1)); } }
|
||||
public int AltForm { get { return Data[0x1D] >> 3; } set { Data[0x1D] = (byte)(Data[0x1D] & 0x07 | (value << 3)); } }
|
||||
public int EV_HP { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } }
|
||||
public int EV_ATK { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } }
|
||||
public int EV_DEF { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
|
||||
public int EV_SPE { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
|
||||
public int EV_SPA { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } }
|
||||
public int EV_SPD { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } }
|
||||
public int CNT_Cool { get { return Data[0x24]; } set { Data[0x24] = (byte)value; } }
|
||||
public int CNT_Beauty { get { return Data[0x25]; } set { Data[0x25] = (byte)value; } }
|
||||
public int CNT_Cute { get { return Data[0x26]; } set { Data[0x26] = (byte)value; } }
|
||||
public int CNT_Smart { get { return Data[0x27]; } set { Data[0x27] = (byte)value; } }
|
||||
public int CNT_Tough { get { return Data[0x28]; } set { Data[0x28] = (byte)value; } }
|
||||
public int CNT_Sheen { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } }
|
||||
public byte Markings { get { return Data[0x2A]; } set { Data[0x2A] = value; } }
|
||||
public bool Circle { get { return (Markings & (1 << 0)) == 1 << 0; } set { Markings = (byte)(Markings & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool Triangle { get { return (Markings & (1 << 1)) == 1 << 1; } set { Markings = (byte)(Markings & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool Square { get { return (Markings & (1 << 2)) == 1 << 2; } set { Markings = (byte)(Markings & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool Heart { get { return (Markings & (1 << 3)) == 1 << 3; } set { Markings = (byte)(Markings & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool Star { get { return (Markings & (1 << 4)) == 1 << 4; } set { Markings = (byte)(Markings & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool Diamond { get { return (Markings & (1 << 5)) == 1 << 5; } set { Markings = (byte)(Markings & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
private byte PKRS { get { return Data[0x2B]; } set { Data[0x2B] = value; } }
|
||||
public int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
|
||||
public int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } }
|
||||
private byte ST1 { get { return Data[0x2C]; } set { Data[0x2C] = value; } }
|
||||
public bool ST1_0 { get { return (ST1 & (1 << 0)) == 1 << 0; } set { ST1 = (byte)(ST1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool ST1_1 { get { return (ST1 & (1 << 1)) == 1 << 1; } set { ST1 = (byte)(ST1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool ST1_2 { get { return (ST1 & (1 << 2)) == 1 << 2; } set { ST1 = (byte)(ST1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool ST1_3 { get { return (ST1 & (1 << 3)) == 1 << 3; } set { ST1 = (byte)(ST1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool ST1_4 { get { return (ST1 & (1 << 4)) == 1 << 4; } set { ST1 = (byte)(ST1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool ST1_5 { get { return (ST1 & (1 << 5)) == 1 << 5; } set { ST1 = (byte)(ST1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool ST1_6 { get { return (ST1 & (1 << 6)) == 1 << 6; } set { ST1 = (byte)(ST1 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool ST1_7 { get { return (ST1 & (1 << 7)) == 1 << 7; } set { ST1 = (byte)(ST1 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte ST2 { get { return Data[0x2D]; } set { Data[0x2D] = value; } }
|
||||
public bool ST2_0 { get { return (ST2 & (1 << 0)) == 1 << 0; } set { ST2 = (byte)(ST2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool ST2_1 { get { return (ST2 & (1 << 1)) == 1 << 1; } set { ST2 = (byte)(ST2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool ST2_2 { get { return (ST2 & (1 << 2)) == 1 << 2; } set { ST2 = (byte)(ST2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool ST2_3 { get { return (ST2 & (1 << 3)) == 1 << 3; } set { ST2 = (byte)(ST2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool ST2_4 { get { return (ST2 & (1 << 4)) == 1 << 4; } set { ST2 = (byte)(ST2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool ST2_5 { get { return (ST2 & (1 << 5)) == 1 << 5; } set { ST2 = (byte)(ST2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool ST2_6 { get { return (ST2 & (1 << 6)) == 1 << 6; } set { ST2 = (byte)(ST2 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool ST2_7 { get { return (ST2 & (1 << 7)) == 1 << 7; } set { ST2 = (byte)(ST2 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte ST3 { get { return Data[0x2E]; } set { Data[0x2E] = value; } }
|
||||
public bool ST3_0 { get { return (ST3 & (1 << 0)) == 1 << 0; } set { ST3 = (byte)(ST3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool ST3_1 { get { return (ST3 & (1 << 1)) == 1 << 1; } set { ST3 = (byte)(ST3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool ST3_2 { get { return (ST3 & (1 << 2)) == 1 << 2; } set { ST3 = (byte)(ST3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool ST3_3 { get { return (ST3 & (1 << 3)) == 1 << 3; } set { ST3 = (byte)(ST3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool ST3_4 { get { return (ST3 & (1 << 4)) == 1 << 4; } set { ST3 = (byte)(ST3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool ST3_5 { get { return (ST3 & (1 << 5)) == 1 << 5; } set { ST3 = (byte)(ST3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool ST3_6 { get { return (ST3 & (1 << 6)) == 1 << 6; } set { ST3 = (byte)(ST3 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool ST3_7 { get { return (ST3 & (1 << 7)) == 1 << 7; } set { ST3 = (byte)(ST3 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte ST4 { get { return Data[0x2F]; } set { Data[0x2F] = value; } }
|
||||
public bool ST4_0 { get { return (ST4 & (1 << 0)) == 1 << 0; } set { ST4 = (byte)(ST4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool ST4_1 { get { return (ST4 & (1 << 1)) == 1 << 1; } set { ST4 = (byte)(ST4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool ST4_2 { get { return (ST4 & (1 << 2)) == 1 << 2; } set { ST4 = (byte)(ST4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool ST4_3 { get { return (ST4 & (1 << 3)) == 1 << 3; } set { ST4 = (byte)(ST4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool ST4_4 { get { return (ST4 & (1 << 4)) == 1 << 4; } set { ST4 = (byte)(ST4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool ST4_5 { get { return (ST4 & (1 << 5)) == 1 << 5; } set { ST4 = (byte)(ST4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool ST4_6 { get { return (ST4 & (1 << 6)) == 1 << 6; } set { ST4 = (byte)(ST4 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool ST4_7 { get { return (ST4 & (1 << 7)) == 1 << 7; } set { ST4 = (byte)(ST4 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte RIB0 { get { return Data[0x30]; } set { Data[0x30] = value; } }
|
||||
public bool RIB0_0 { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool RIB0_1 { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool RIB0_2 { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool RIB0_3 { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool RIB0_4 { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool RIB0_5 { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool RIB0_6 { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool RIB0_7 { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte RIB1 { get { return Data[0x31]; } set { Data[0x31] = value; } }
|
||||
public bool RIB1_0 { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool RIB1_1 { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool RIB1_2 { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool RIB1_3 { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool RIB1_4 { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool RIB1_5 { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool RIB1_6 { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool RIB1_7 { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte RIB2 { get { return Data[0x32]; } set { Data[0x32] = value; } }
|
||||
public bool RIB2_0 { get { return (RIB2 & (1 << 0)) == 1 << 0; } set { RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool RIB2_1 { get { return (RIB2 & (1 << 1)) == 1 << 1; } set { RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool RIB2_2 { get { return (RIB2 & (1 << 2)) == 1 << 2; } set { RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool RIB2_3 { get { return (RIB2 & (1 << 3)) == 1 << 3; } set { RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool RIB2_4 { get { return (RIB2 & (1 << 4)) == 1 << 4; } set { RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool RIB2_5 { get { return (RIB2 & (1 << 5)) == 1 << 5; } set { RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool RIB2_6 { get { return (RIB2 & (1 << 6)) == 1 << 6; } set { RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool RIB2_7 { get { return (RIB2 & (1 << 7)) == 1 << 7; } set { RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte RIB3 { get { return Data[0x33]; } set { Data[0x33] = value; } }
|
||||
public bool RIB3_0 { get { return (RIB3 & (1 << 0)) == 1 << 0; } set { RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool RIB3_1 { get { return (RIB3 & (1 << 1)) == 1 << 1; } set { RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool RIB3_2 { get { return (RIB3 & (1 << 2)) == 1 << 2; } set { RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool RIB3_3 { get { return (RIB3 & (1 << 3)) == 1 << 3; } set { RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool RIB3_4 { get { return (RIB3 & (1 << 4)) == 1 << 4; } set { RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool RIB3_5 { get { return (RIB3 & (1 << 5)) == 1 << 5; } set { RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool RIB3_6 { get { return (RIB3 & (1 << 6)) == 1 << 6; } set { RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool RIB3_7 { get { return (RIB3 & (1 << 7)) == 1 << 7; } set { RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte RIB4 { get { return Data[0x34]; } set { Data[0x34] = value; } }
|
||||
public bool RIB4_0 { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool RIB4_1 { get { return (RIB4 & (1 << 1)) == 1 << 1; } set { RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool RIB4_2 { get { return (RIB4 & (1 << 2)) == 1 << 2; } set { RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool RIB4_3 { get { return (RIB4 & (1 << 3)) == 1 << 3; } set { RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool RIB4_4 { get { return (RIB4 & (1 << 4)) == 1 << 4; } set { RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool RIB4_5 { get { return (RIB4 & (1 << 5)) == 1 << 5; } set { RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool RIB4_6 { get { return (RIB4 & (1 << 6)) == 1 << 6; } set { RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool RIB4_7 { get { return (RIB4 & (1 << 7)) == 1 << 7; } set { RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
private byte RIB5 { get { return Data[0x35]; } set { Data[0x35] = value; } }
|
||||
public bool RIB5_0 { get { return (RIB5 & (1 << 0)) == 1 << 0; } set { RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool RIB5_1 { get { return (RIB5 & (1 << 1)) == 1 << 1; } set { RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool RIB5_2 { get { return (RIB5 & (1 << 2)) == 1 << 2; } set { RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool RIB5_3 { get { return (RIB5 & (1 << 3)) == 1 << 3; } set { RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool RIB5_4 { get { return (RIB5 & (1 << 4)) == 1 << 4; } set { RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool RIB5_5 { get { return (RIB5 & (1 << 5)) == 1 << 5; } set { RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool RIB5_6 { get { return (RIB5 & (1 << 6)) == 1 << 6; } set { RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 7 : 0)); } }
|
||||
public bool RIB5_7 { get { return (RIB5 & (1 << 7)) == 1 << 7; } set { RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 6 : 0)); } }
|
||||
public byte _0x36 { get { return Data[0x36]; } set { Data[0x36] = value; } }
|
||||
public byte _0x37 { get { return Data[0x37]; } set { Data[0x37] = value; } }
|
||||
public byte Memory_ContestCount { get { return Data[0x38]; } set { Data[0x38] = value; } }
|
||||
public byte Memory_BattleCount { get { return Data[0x39]; } set { Data[0x39] = value; } }
|
||||
private byte DistByte { get { return Data[0x3A]; } set { Data[0x3A] = value; } }
|
||||
public bool Dist1 { get { return (DistByte & (1 << 0)) == 1 << 0; } set { DistByte = (byte)(DistByte & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
|
||||
public bool Dist2 { get { return (DistByte & (1 << 1)) == 1 << 1; } set { DistByte = (byte)(DistByte & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
|
||||
public bool Dist3 { get { return (DistByte & (1 << 2)) == 1 << 2; } set { DistByte = (byte)(DistByte & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
|
||||
public bool Dist4 { get { return (DistByte & (1 << 3)) == 1 << 3; } set { DistByte = (byte)(DistByte & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
|
||||
public bool Dist5 { get { return (DistByte & (1 << 4)) == 1 << 4; } set { DistByte = (byte)(DistByte & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
|
||||
public bool Dist6 { get { return (DistByte & (1 << 5)) == 1 << 5; } set { DistByte = (byte)(DistByte & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
|
||||
public bool Dist7 { get { return (DistByte & (1 << 6)) == 1 << 6; } set { DistByte = (byte)(DistByte & ~(1 << 6) | (value ? 1 << 6 : 0)); } }
|
||||
public bool Dist8 { get { return (DistByte & (1 << 7)) == 1 << 7; } set { DistByte = (byte)(DistByte & ~(1 << 7) | (value ? 1 << 7 : 0)); } }
|
||||
public byte _0x3B { get { return Data[0x3B]; } set { Data[0x3B] = value; } }
|
||||
public byte _0x3C { get { return Data[0x3C]; } set { Data[0x3C] = value; } }
|
||||
public byte _0x3D { get { return Data[0x3D]; } set { Data[0x3D] = value; } }
|
||||
public byte _0x3E { get { return Data[0x3E]; } set { Data[0x3E] = value; } }
|
||||
public byte _0x3F { get { return Data[0x3F]; } set { Data[0x3F] = value; } }
|
||||
#endregion
|
||||
#region Block B
|
||||
public string Nickname
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x40, 24))
|
||||
.Replace("\uE08F", "\u2640") // nidoran
|
||||
.Replace("\uE08E", "\u2642") // nidoran
|
||||
.Replace("\u2019", "\u0027"); // farfetch'd
|
||||
}
|
||||
set
|
||||
{
|
||||
string TempNick = value // Replace Special Characters and add Terminator
|
||||
.Replace("\u2640", "\uE08F") // nidoran
|
||||
.Replace("\u2642", "\uE08E") // nidoran
|
||||
.Replace("\u0027", "\u2019") // farfetch'd
|
||||
.PadRight(value.Length + 1, '\0'); // Null Terminator
|
||||
byte[] NickBytes = Encoding.Unicode.GetBytes(TempNick);
|
||||
Array.Copy(NickBytes, 0, Data, 0x40, NickBytes.Length);
|
||||
}
|
||||
}
|
||||
public int Move1
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x5A); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x5A, 2); }
|
||||
}
|
||||
public int Move2
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x5C); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x5C, 2); }
|
||||
}
|
||||
public int Move3
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x5E); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x5E, 2); }
|
||||
}
|
||||
public int Move4
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x60); }
|
||||
set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x60, 2); }
|
||||
}
|
||||
public int Move1_PP { get { return Data[0x62]; } set { Data[0x62] = (byte)value; } }
|
||||
public int Move2_PP { get { return Data[0x63]; } set { Data[0x63] = (byte)value; } }
|
||||
public int Move3_PP { get { return Data[0x64]; } set { Data[0x64] = (byte)value; } }
|
||||
public int Move4_PP { get { return Data[0x65]; } set { Data[0x65] = (byte)value; } }
|
||||
public int Move1_PPUps { get { return Data[0x66]; } set { Data[0x66] = (byte)value; } }
|
||||
public int Move2_PPUps { get { return Data[0x67]; } set { Data[0x67] = (byte)value; } }
|
||||
public int Move3_PPUps { get { return Data[0x68]; } set { Data[0x68] = (byte)value; } }
|
||||
public int Move4_PPUps { get { return Data[0x69]; } set { Data[0x69] = (byte)value; } }
|
||||
public int RelearnMove1
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x6A); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x6A, 2); }
|
||||
}
|
||||
public int RelearnMove2
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x6C); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x6C, 2); }
|
||||
}
|
||||
public int RelearnMove3
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x6E); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x6E, 2); }
|
||||
}
|
||||
public int RelearnMove4
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x70); }
|
||||
set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0x70, 2); }
|
||||
}
|
||||
public bool SecretSuperTraining { get { return Data[0x72] == 1; } set { Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); } }
|
||||
public byte _0x73 { get { return Data[0x73]; } set { Data[0x73] = value; } }
|
||||
private uint IV32 { get { return BitConverter.ToUInt32(Data, 0x74); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0x74, 4); } }
|
||||
public int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
|
||||
public int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
|
||||
public int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
|
||||
public int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
|
||||
public int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
|
||||
public int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
|
||||
public bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
|
||||
public bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = ((IV32 & ~0x80000000) | (value ? 0x80000000 : 0)); } }
|
||||
#endregion
|
||||
#region Block C
|
||||
public string HT_Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x78, 24))
|
||||
.Replace("\uE08F", "\u2640") // nidoran
|
||||
.Replace("\uE08E", "\u2642") // nidoran
|
||||
.Replace("\u2019", "\u0027"); // farfetch'd
|
||||
}
|
||||
set
|
||||
{
|
||||
string TempNick = value // Replace Special Characters and add Terminator
|
||||
.Replace("\u2640", "\uE08F") // nidoran
|
||||
.Replace("\u2642", "\uE08E") // nidoran
|
||||
.Replace("\u0027", "\u2019") // farfetch'd
|
||||
.PadRight(value.Length + 1, '\0'); // Null Terminator
|
||||
byte[] nameBytes = Encoding.Unicode.GetBytes(TempNick);
|
||||
Array.Copy(nameBytes, 0, Data, 0x78, nameBytes.Length);
|
||||
}
|
||||
}
|
||||
public int HT_Gender { get { return Data[0x92]; } set { Data[0x92] = (byte)value; } }
|
||||
public int CurrentHandler { get { return Data[0x93]; } set { Data[0x93] = (byte)value; } }
|
||||
public int Geo1_Region { get { return Data[0x94]; } set { Data[0x94] = (byte)value; } }
|
||||
public int Geo1_Country { get { return Data[0x95]; } set { Data[0x95] = (byte)value; } }
|
||||
public int Geo2_Region { get { return Data[0x96]; } set { Data[0x96] = (byte)value; } }
|
||||
public int Geo2_Country { get { return Data[0x97]; } set { Data[0x97] = (byte)value; } }
|
||||
public int Geo3_Region { get { return Data[0x98]; } set { Data[0x98] = (byte)value; } }
|
||||
public int Geo3_Country { get { return Data[0x99]; } set { Data[0x99] = (byte)value; } }
|
||||
public int Geo4_Region { get { return Data[0x9A]; } set { Data[0x9A] = (byte)value; } }
|
||||
public int Geo4_Country { get { return Data[0x9B]; } set { Data[0x9B] = (byte)value; } }
|
||||
public int Geo5_Region { get { return Data[0x9C]; } set { Data[0x9C] = (byte)value; } }
|
||||
public int Geo5_Country { get { return Data[0x9D]; } set { Data[0x9D] = (byte)value; } }
|
||||
public byte _0x9E { get { return Data[0x9E]; } set { Data[0x9E] = value; } }
|
||||
public byte _0x9F { get { return Data[0x9F]; } set { Data[0x9F] = value; } }
|
||||
public byte _0xA0 { get { return Data[0xA0]; } set { Data[0xA0] = value; } }
|
||||
public byte _0xA1 { get { return Data[0xA1]; } set { Data[0xA1] = value; } }
|
||||
public int HT_Friendship { get { return Data[0xA2]; } set { Data[0xA2] = (byte)value; } }
|
||||
public int HT_Affection { get { return Data[0xA3]; } set { Data[0xA3] = (byte)value; } }
|
||||
public int HT_Intensity { get { return Data[0xA4]; } set { Data[0xA4] = (byte)value; } }
|
||||
public int HT_Memory { get { return Data[0xA5]; } set { Data[0xA5] = (byte)value; } }
|
||||
public int HT_Feeling { get { return Data[0xA6]; } set { Data[0xA6] = (byte)value; } }
|
||||
public byte _0xA7 { get { return Data[0xA7]; } set { Data[0xA7] = value; } }
|
||||
public int HT_TextVar { get { return BitConverter.ToUInt16(Data, 0xA8); } set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0xA8, 2); } }
|
||||
public byte _0xAA { get { return Data[0xAA]; } set { Data[0xAA] = value; } }
|
||||
public byte _0xAB { get { return Data[0xAB]; } set { Data[0xAB] = value; } }
|
||||
public byte _0xAC { get { return Data[0xAC]; } set { Data[0xAC] = value; } }
|
||||
public byte _0xAD { get { return Data[0xAD]; } set { Data[0xAD] = value; } }
|
||||
public byte Fullness { get { return Data[0xAE]; } set { Data[0xAE] = value; } }
|
||||
public byte Enjoyment { get { return Data[0xAF]; } set { Data[0xAF] = value; } }
|
||||
#endregion
|
||||
#region Block D
|
||||
public string OT_Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0xB0, 24))
|
||||
.Replace("\uE08F", "\u2640") // nidoran
|
||||
.Replace("\uE08E", "\u2642") // nidoran
|
||||
.Replace("\u2019", "\u0027"); // farfetch'd
|
||||
}
|
||||
set
|
||||
{
|
||||
string TempNick = value // Replace Special Characters and add Terminator
|
||||
.Replace("\u2640", "\uE08F") // nidoran
|
||||
.Replace("\u2642", "\uE08E") // nidoran
|
||||
.Replace("\u0027", "\u2019") // farfetch'd
|
||||
.PadRight(value.Length + 1, '\0'); // Null Terminator
|
||||
byte[] nameBytes = Encoding.Unicode.GetBytes(TempNick);
|
||||
Array.Copy(nameBytes, 0, Data, 0xB0, nameBytes.Length);
|
||||
}
|
||||
}
|
||||
public int OT_Friendship { get { return Data[0xCA]; } set { Data[0xCA] = (byte)value; } }
|
||||
public int OT_Affection { get { return Data[0xCB]; } set { Data[0xCB] = (byte)value; } }
|
||||
public int OT_Intensity { get { return Data[0xCC]; } set { Data[0xCC] = (byte)value; } }
|
||||
public int OT_Memory { get { return Data[0xCD]; } set { Data[0xCD] = (byte)value; } }
|
||||
public int OT_TextVar { get { return BitConverter.ToUInt16(Data, 0xCE); } set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0xCE, 2); } }
|
||||
public int OT_Feeling { get { return Data[0xD0]; } set { Data[0xD0] = (byte)value; } }
|
||||
public int Egg_Year { get { return Data[0xD1]; } set { Data[0xD1] = (byte)value; } }
|
||||
public int Egg_Month { get { return Data[0xD2]; } set { Data[0xD2] = (byte)value; } }
|
||||
public int Egg_Day { get { return Data[0xD3]; } set { Data[0xD3] = (byte)value; } }
|
||||
public int Met_Year { get { return Data[0xD4]; } set { Data[0xD4] = (byte)value; } }
|
||||
public int Met_Month { get { return Data[0xD5]; } set { Data[0xD5] = (byte)value; } }
|
||||
public int Met_Day { get { return Data[0xD6]; } set { Data[0xD6] = (byte)value; } }
|
||||
public byte _0xD7 { get { return Data[0xD7]; } set { Data[0xD7] = value; } }
|
||||
public int Egg_Location { get { return BitConverter.ToUInt16(Data, 0xD8); } set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0xD8, 2); } }
|
||||
public int Met_Location { get { return BitConverter.ToUInt16(Data, 0xDA); } set { Array.Copy(BitConverter.GetBytes((ushort)value), 0, Data, 0xDA, 2); } }
|
||||
public int Ball { get { return Data[0xDC]; } set { Data[0xDC] = (byte)value; } }
|
||||
public int Met_Level { get { return Data[0xDD] & 0x80; } set { Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | value); } }
|
||||
public int OT_Gender { get { return Data[0xDD] >> 7; } set { Data[0xDD] = (byte)((Data[0xDD] & 0x80) | (value << 7)); } }
|
||||
public int EncounterType { get { return Data[0xDE]; } set { Data[0xDE] = (byte)value; } }
|
||||
public int Version { get { return Data[0xDF]; } set { Data[0xDF] = (byte)value; } }
|
||||
public int Country { get { return Data[0xE0]; } set { Data[0xE0] = (byte)value; } }
|
||||
public int Region { get { return Data[0xE1]; } set { Data[0xE1] = (byte)value; } }
|
||||
public int ConsoleRegion { get { return Data[0xE2]; } set { Data[0xE2] = (byte)value; } }
|
||||
public int Language { get { return Data[0xE3]; } set { Data[0xE3] = (byte)value; } }
|
||||
#endregion
|
||||
#region Battle Stats
|
||||
public int Stat_Level { get { return Data[0xEC]; } set { Data[0xEC] = (byte)value; } }
|
||||
public int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0xF0); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0xF0, 2); } }
|
||||
public int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0xF2); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0xF2, 2); } }
|
||||
public int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0xF4); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0xF4, 2); } }
|
||||
public int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0xF6); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0xF6, 2); } }
|
||||
public int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0xF8); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0xF8, 2); } }
|
||||
public int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0xFA); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0xFA, 2); } }
|
||||
public int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0xFC); } set { Array.Copy(BitConverter.GetBytes(value), 0, Data, 0xFC, 2); } }
|
||||
#endregion
|
||||
|
||||
// Simple Generated Attributes
|
||||
public int[] IVs { get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; } }
|
||||
public int[] EVs { get { return new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; } }
|
||||
public int PSV { get { return (int)(((PID >> 16) ^ (PID & 0xFFFF)) >> 4); } }
|
||||
public int TSV { get { return (TID ^ SID) >> 4; } }
|
||||
public bool IsShiny { get { return TSV == PSV; } }
|
||||
public bool PKRS_Infected { get { return PKRS_Strain > 0; } }
|
||||
public bool PKRS_Cured { get { return PKRS_Days == 0 && PKRS_Strain > 0; } }
|
||||
public string[] ShowdownText { get { return getShowdownText(Nickname, Species, HeldItem, Ability, EVs, HPType, Move1, Move2, Move3, Move4); } }
|
||||
|
||||
// Complex Generated Attributes
|
||||
public Image Sprite { get { return getSprite(Species, AltForm, Gender, HeldItem, IsEgg, IsShiny); } }
|
||||
public int HPType
|
||||
{
|
||||
get { return (15 * ((IV_HP & 1) + 2 * (IV_ATK & 1) + 4 * (IV_DEF & 1) + 8 * (IV_SPE & 1) + 16 * (IV_SPA & 1) + 32 * (IV_SPD & 1))) / 63; }
|
||||
set
|
||||
{
|
||||
IV_HP = (IV_HP & ~1) + hpivs[value][0];
|
||||
IV_ATK = (IV_ATK & ~1) + hpivs[value][1];
|
||||
IV_DEF = (IV_DEF & ~1) + hpivs[value][2];
|
||||
IV_SPE = (IV_SPE & ~1) + hpivs[value][3];
|
||||
IV_SPA = (IV_SPA & ~1) + hpivs[value][4];
|
||||
IV_SPD = (IV_SPD & ~1) + hpivs[value][5];
|
||||
}
|
||||
}
|
||||
public int Characteristic
|
||||
{
|
||||
get
|
||||
{
|
||||
// Characteristic with EC%6
|
||||
int pm6 = (int)(EncryptionConstant % 6); // EC MOD 6
|
||||
int maxIV = IVs.Max();
|
||||
int pm6stat = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
pm6stat = (pm6 + i) % 6;
|
||||
if (IVs[pm6stat] == maxIV)
|
||||
break; // P%6 is this stat
|
||||
}
|
||||
return pm6stat*5 + maxIV%5;
|
||||
}
|
||||
}
|
||||
public int PotentialRating
|
||||
{
|
||||
get
|
||||
{
|
||||
int ivTotal = IVs.Sum();
|
||||
if (ivTotal <= 90)
|
||||
return 0;
|
||||
if (ivTotal <= 120)
|
||||
return 1;
|
||||
return ivTotal <= 150 ? 2 : 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Methods
|
||||
public void RefreshChecksum()
|
||||
{
|
||||
Checksum = CalculateChecksum();
|
||||
}
|
||||
public ushort CalculateChecksum()
|
||||
{
|
||||
ushort chk = 0;
|
||||
for (int i = 8; i < 232; i += 2) // Loop through the entire PKX
|
||||
chk += BitConverter.ToUInt16(Data, i);
|
||||
|
||||
return chk;
|
||||
}
|
||||
public byte[] Write()
|
||||
{
|
||||
RefreshChecksum();
|
||||
return Data;
|
||||
}
|
||||
public byte[] Encrypt()
|
||||
{
|
||||
Checksum = CalculateChecksum();
|
||||
return encryptArray(Data);
|
||||
}
|
||||
public void CalculateStats()
|
||||
{
|
||||
ushort[] Stats = getStats(Species, Stat_Level, Nature, AltForm,
|
||||
EV_HP, EV_ATK, EV_DEF, EV_SPA, EV_SPD, EV_SPE,
|
||||
IV_HP, IV_ATK, IV_DEF, IV_SPA, IV_SPD, IV_SPE);
|
||||
|
||||
Stat_HPMax = Stats[0];
|
||||
Stat_ATK = Stats[1];
|
||||
Stat_DEF = Stats[2];
|
||||
Stat_SPE = Stats[3];
|
||||
Stat_SPA = Stats[4];
|
||||
Stat_SPD = Stats[5];
|
||||
}
|
||||
public string[] Summarize(string SpeciesName = null)
|
||||
{
|
||||
string[] response = new string[3];
|
||||
// Summarize
|
||||
string filename = Nickname;
|
||||
if (Nickname != SpeciesName && SpeciesName != null)
|
||||
filename += " (" + SpeciesName + ")";
|
||||
response[0] = String.Format("{0} [{4}] lv{3} @ {1} -- {2}", filename, HeldItem, Nature, Stat_Level, Ability);
|
||||
response[1] = String.Format("{0} / {1} / {2} / {3}", Move1, Move2, Move3, Move4);
|
||||
response[2] = String.Format(
|
||||
"IVs:{0}{1}{2}{3}{4}{5}"
|
||||
+ Environment.NewLine + Environment.NewLine +
|
||||
"EVs:{6}{7}{8}{9}{10}{11}",
|
||||
Environment.NewLine + IV_HP.ToString("00"),
|
||||
Environment.NewLine + IV_ATK.ToString("00"),
|
||||
Environment.NewLine + IV_DEF.ToString("00"),
|
||||
Environment.NewLine + IV_SPA.ToString("00"),
|
||||
Environment.NewLine + IV_SPD.ToString("00"),
|
||||
Environment.NewLine + IV_SPE.ToString("00"),
|
||||
Environment.NewLine + EV_HP.ToString("00"),
|
||||
Environment.NewLine + EV_ATK.ToString("00"),
|
||||
Environment.NewLine + EV_DEF.ToString("00"),
|
||||
Environment.NewLine + EV_SPA.ToString("00"),
|
||||
Environment.NewLine + EV_SPD.ToString("00"),
|
||||
Environment.NewLine + EV_SPE.ToString("00"));
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
350
Misc/PKX.cs
350
Misc/PKX.cs
@@ -5,7 +5,6 @@
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
@@ -213,7 +212,7 @@ internal static byte getBaseFriendship(int species)
|
||||
{
|
||||
return PersonalGetter.GetPersonal(species).BaseFriendship;
|
||||
}
|
||||
internal static int getLevel(int species, ref uint exp)
|
||||
internal static int getLevel(int species, uint exp)
|
||||
{
|
||||
if (exp == 0) { return 1; }
|
||||
|
||||
@@ -226,7 +225,6 @@ internal static int getLevel(int species, ref uint exp)
|
||||
while ((uint)table.Rows[++tl][growth + 1] <= exp)
|
||||
{
|
||||
if (tl != 100) continue;
|
||||
exp = getEXP(100, species); // Fix EXP
|
||||
return 100;
|
||||
// After we find the level above ours, we're done.
|
||||
}
|
||||
@@ -257,6 +255,8 @@ internal static byte[] getAbilities(int species, int formnum)
|
||||
}
|
||||
internal static int getGender(string s)
|
||||
{
|
||||
if (s == null)
|
||||
return -1;
|
||||
if (s == "♂" || s == "M")
|
||||
return 0;
|
||||
if (s == "♀" || s == "F")
|
||||
@@ -518,286 +518,6 @@ internal static uint getRandomPID(int species, int cg)
|
||||
return pid;
|
||||
}
|
||||
|
||||
// Object
|
||||
#region PKX Object
|
||||
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
|
||||
slot,
|
||||
mnicknamestr, mgenderstring, mnotOT, mot, mSpeciesName, mNatureName, mHPName, mAbilityName,
|
||||
mMove1N, mMove2N, mMove3N, mMove4N, mhelditemN,
|
||||
mRMove1N, mRMove2N, mRMove3N, mRMove4N,
|
||||
mMetLocN, mEggLocN,
|
||||
mcountryID, mregionID, mGameN, mBallN, mdsregIDN, motlangN;
|
||||
|
||||
private int
|
||||
mability, mabilitynum, mnature, mgenderflag, maltforms, mPKRS_Strain, mPKRS_Duration,
|
||||
mmetlevel, motgender, mLevel;
|
||||
|
||||
private bool
|
||||
misegg, misnick, misshiny, mfeflag;
|
||||
|
||||
private ushort
|
||||
mhelditem, mspecies, 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, mdsregID, motlang;
|
||||
|
||||
public string Position { get { return slot; } }
|
||||
public Image Sprite { 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; } }
|
||||
public string HeldItem { get { return mhelditemN; } }
|
||||
public string MetLoc { get { return mMetLocN; } }
|
||||
public string EggLoc { get { return mEggLocN; } }
|
||||
public string Ball { get { return mBallN; } }
|
||||
public string OT { get { return mot; } }
|
||||
public string Version { get { return mGameN; } }
|
||||
public string OTLang { get { return motlangN; } }
|
||||
public string CountryID { get { return mcountryID; } }
|
||||
public string RegionID { get { return mregionID; } }
|
||||
public string DSRegionID { get { return mdsregIDN; } }
|
||||
|
||||
#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 int Level { get { return mLevel; } }
|
||||
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 int AbilityNum { get { return mabilitynum; } }
|
||||
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 FatefulFlag { get { return mfeflag; } }
|
||||
public bool IsEgg { get { return misegg; } }
|
||||
public bool IsNicknamed { get { return misnick; } }
|
||||
public bool IsShiny { get { return misshiny; } }
|
||||
|
||||
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 string Relearn1 { get { return mRMove1N; } }
|
||||
public string Relearn2 { get { return mRMove2N; } }
|
||||
public string Relearn3 { get { return mRMove3N; } }
|
||||
public string Relearn4 { get { return mRMove4N; } }
|
||||
public ushort Checksum { get { return mchk; } }
|
||||
public ushort mFriendship { 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 Encounter { get { return mencountertype; } }
|
||||
|
||||
#endregion
|
||||
public PKX(byte[] pkx, string ident)
|
||||
{
|
||||
slot = ident;
|
||||
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 - Training bag
|
||||
mPID = BitConverter.ToUInt32(pkx, 0x18);
|
||||
mnature = pkx[0x1C];
|
||||
mfeflag = (pkx[0x1D] % 2) == 1;
|
||||
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 = Util.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 = Util.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 = Util.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];
|
||||
string[] data = getCountryRegionText(pkx[0xE0], pkx[0xE1], Main.curlanguage);
|
||||
mcountryID = data[0x0];
|
||||
mregionID = data[0x1];
|
||||
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
|
||||
{
|
||||
mnicknamestr = Regex.Replace(mnicknamestr, "\uE08F", "\u2640");
|
||||
mnicknamestr = Regex.Replace(mnicknamestr, "\uE08E", "\u2642");
|
||||
}
|
||||
{
|
||||
pksprite = getSprite(pkx);
|
||||
}
|
||||
try
|
||||
{
|
||||
mSpeciesName = Main.specieslist[mspecies];
|
||||
mhelditemN = Main.itemlist[mhelditem];
|
||||
mNatureName = Main.natures[mnature];
|
||||
mHPName = Main.types[mhptype];
|
||||
mAbilityName = Main.abilitylist[mability];
|
||||
mMove1N = Main.movelist[mmove1];
|
||||
mMove2N = Main.movelist[mmove2];
|
||||
mMove3N = Main.movelist[mmove3];
|
||||
mMove4N = Main.movelist[mmove4];
|
||||
mRMove1N = Main.movelist[meggmove1];
|
||||
mRMove2N = Main.movelist[meggmove2];
|
||||
mRMove3N = Main.movelist[meggmove3];
|
||||
mRMove4N = Main.movelist[meggmove4];
|
||||
mMetLocN = getLocation(false, mgamevers, mmetloc);
|
||||
mEggLocN = getLocation(true, mgamevers, meggloc);
|
||||
mLevel = getLevel(mspecies, ref mexp);
|
||||
mGameN = Main.gamelist[mgamevers];
|
||||
mBallN = Main.balllist[mball];
|
||||
motlangN = Main.gamelanguages[motlang] ?? String.Format("UNK {0}", motlang);
|
||||
mdsregIDN = Main.consoleregions[mdsregID] ?? String.Format("UNK {0}", mdsregID);
|
||||
}
|
||||
catch { return; }
|
||||
}
|
||||
#endregion
|
||||
#region SaveGame
|
||||
|
||||
public class Structures
|
||||
@@ -1048,7 +768,7 @@ public SaveGame(string GameID)
|
||||
OPower = 0x17400; // ****changed****
|
||||
EventConst = 0x14A00;
|
||||
EventAsh = EventConst + 0x78;
|
||||
EventFlag = 0x14A00; // Confirmed
|
||||
EventFlag = EventConst + 0x2FC;
|
||||
PokeDex = 0x15000;
|
||||
Spinda = PokeDex + 0x680;
|
||||
EncounterCount = PokeDex + 0x686;
|
||||
@@ -1079,35 +799,6 @@ public SaveGame(string GameID)
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal static string[] getPKXSummary(PKX data)
|
||||
{
|
||||
string[] response = new string[3];
|
||||
// Summarize
|
||||
string filename = data.Nickname;
|
||||
if (filename != data.Species)
|
||||
filename += " (" + data.Species + ")";
|
||||
response[0] = String.Format("{0} [{4}] lv{3} @ {1} -- {2}", filename, data.HeldItem, data.Nature, data.Level, data.Ability);
|
||||
response[1] = String.Format("{0} / {1} / {2} / {3}", data.Move1, data.Move2, data.Move3, data.Move4);
|
||||
response[2] = String.Format(
|
||||
"IVs:{0}{1}{2}{3}{4}{5}"
|
||||
+ Environment.NewLine + Environment.NewLine +
|
||||
"EVs:{6}{7}{8}{9}{10}{11}",
|
||||
Environment.NewLine + data.HP_IV.ToString("00"),
|
||||
Environment.NewLine + data.ATK_IV.ToString("00"),
|
||||
Environment.NewLine + data.DEF_IV.ToString("00"),
|
||||
Environment.NewLine + data.SPA_IV.ToString("00"),
|
||||
Environment.NewLine + data.SPD_IV.ToString("00"),
|
||||
Environment.NewLine + data.SPE_IV.ToString("00"),
|
||||
Environment.NewLine + data.HP_EV.ToString("00"),
|
||||
Environment.NewLine + data.ATK_EV.ToString("00"),
|
||||
Environment.NewLine + data.DEF_EV.ToString("00"),
|
||||
Environment.NewLine + data.SPA_EV.ToString("00"),
|
||||
Environment.NewLine + data.SPD_EV.ToString("00"),
|
||||
Environment.NewLine + data.SPE_EV.ToString("00"));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
// SAV Manipulation
|
||||
internal static int detectSAVIndex(byte[] data, out int savindex)
|
||||
{
|
||||
@@ -1638,19 +1329,6 @@ internal static byte[] writeG6SHA(byte[] savefile, bool oras, int savegame)
|
||||
}
|
||||
|
||||
// Data Requests
|
||||
internal static Image getSprite(byte[] data)
|
||||
{
|
||||
int species = BitConverter.ToInt16(data, 0x08); // Get Species
|
||||
int form = (data[0x1D] >> 3);
|
||||
int gender = (data[0x1D] >> 1) & 0x3;
|
||||
int item = BitConverter.ToUInt16(data, 0xA);
|
||||
bool isEgg = ((BitConverter.ToUInt32(data, 0x74) >> 30) & 1) == 1;
|
||||
bool isShiny = getIsShiny(BitConverter.ToUInt32(data, 0x18),
|
||||
BitConverter.ToUInt16(data, 0x0C),
|
||||
BitConverter.ToUInt16(data, 0x0E));
|
||||
|
||||
return getSprite(species, form, gender, item, isEgg, isShiny);
|
||||
}
|
||||
internal static Image getSprite(int species, int form, int gender, int item, bool isegg, bool shiny)
|
||||
{
|
||||
string file;
|
||||
@@ -1700,7 +1378,21 @@ internal static Image getSprite(int species, int form, int gender, int item, boo
|
||||
}
|
||||
return baseImage;
|
||||
}
|
||||
internal static Image getSprite(PK6 pk6)
|
||||
{
|
||||
return pk6.Sprite;
|
||||
}
|
||||
internal static Image getSprite(byte[] data)
|
||||
{
|
||||
return new PK6(data).Sprite;
|
||||
}
|
||||
|
||||
internal static string[] getShowdownText(string Nickname, int Species, int HeldItem, int Ability, int[] EVs,
|
||||
int HPType, int Move1, int Move2, int Move3, int Move4)
|
||||
{
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
// Font Related
|
||||
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
|
||||
@@ -2167,6 +1859,8 @@ public Set(string input, string[] species, string[] items, string[] natures, str
|
||||
string[] lines = input.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
|
||||
for (int i = 0; i < lines.Length; i++) lines[i] = lines[i].Replace("'", "’").Trim(); // Sanitize apostrophes
|
||||
|
||||
if (lines.Length < 3) return;
|
||||
|
||||
// Seek for start of set
|
||||
int start = -1;
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
@@ -2211,8 +1905,7 @@ public Set(string input, string[] species, string[] items, string[] natures, str
|
||||
}
|
||||
if (Species < -1)
|
||||
return;
|
||||
else
|
||||
lines = lines.Skip(1).Take(lines.Length - 1).ToArray();
|
||||
lines = lines.Skip(1).Take(lines.Length - 1).ToArray();
|
||||
}
|
||||
int movectr = 0;
|
||||
// Detect relevant data
|
||||
@@ -2239,6 +1932,7 @@ public Set(string input, string[] species, string[] items, string[] natures, str
|
||||
string[] brokenline = line.Split(new[] { ": " }, StringSplitOptions.None);
|
||||
switch (brokenline[0])
|
||||
{
|
||||
case "Trait":
|
||||
case "Ability": { Ability = Array.IndexOf(abilities, brokenline[1]); break; }
|
||||
case "Level": { Level = Util.ToInt32(brokenline[1]); break; }
|
||||
case "Shiny": { Shiny = (brokenline[1] == "Yes"); break; }
|
||||
|
||||
@@ -160,7 +160,7 @@ public byte[] convertPK3toPK4(byte[] pk3)
|
||||
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)PKX.getLevel(species, ref exp)));
|
||||
pk4[0x84] = (byte)((pk3[0x47] & 0x80) | ((byte)PKX.getLevel(species, exp)));
|
||||
|
||||
// Nickname and OT Name handling...
|
||||
byte[][] trash = new byte[8][];
|
||||
@@ -348,8 +348,8 @@ public byte[] convertPK4toPK5(byte[] pk4)
|
||||
// Fix Level
|
||||
pk5[0x84] &= 0x80;
|
||||
uint exp = BitConverter.ToUInt32(pk5, 0x10);
|
||||
pk5[0x84] |= (byte)PKX.getLevel(species, ref exp);
|
||||
|
||||
pk5[0x84] |= (byte)PKX.getLevel(species, exp);
|
||||
|
||||
// Fix Checksum
|
||||
ushort chk = 0;
|
||||
for (int i = 8; i < 136; i += 2) // Loop through the entire PKX
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Misc\Legal.cs" />
|
||||
<Compile Include="Misc\PK6.cs" />
|
||||
<Compile Include="Misc\QR.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
861
PKX/f1-Main.cs
861
PKX/f1-Main.cs
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ public partial class MemoryAmie : Form
|
||||
past = "Past Gen";
|
||||
withOT = "Memories with";
|
||||
}
|
||||
h = Main.buff;
|
||||
h = Main.pk6.Data;
|
||||
|
||||
getCountries();
|
||||
getLangStrings();
|
||||
@@ -85,9 +85,9 @@ private void loadFields()
|
||||
if (Util.TrimFromZero(m_parent.TB_OTt2.Text) != "")
|
||||
CB_Handler.Items.AddRange(new object[] { m_parent.TB_OTt2.Text });
|
||||
else
|
||||
Main.buff[0x93] = 0;
|
||||
Main.pk6.CurrentHandler = 0;
|
||||
|
||||
tabControl1.SelectedIndex = CB_Handler.SelectedIndex = Main.buff[0x93];
|
||||
tabControl1.SelectedIndex = CB_Handler.SelectedIndex = Main.pk6.CurrentHandler;
|
||||
|
||||
if (m_parent.CHK_IsEgg.Checked)
|
||||
{
|
||||
@@ -167,8 +167,8 @@ private void saveFields()
|
||||
cb1v(CB_CTMemory, 0xA5);
|
||||
if (!CB_CTVar.Enabled)
|
||||
{
|
||||
Main.buff[0xA8] = 0;
|
||||
Main.buff[0xA9] = 0;
|
||||
Main.pk6.Data[0xA8] = 0;
|
||||
Main.pk6.Data[0xA9] = 0;
|
||||
}
|
||||
else
|
||||
cb2v(CB_CTVar, 0xA8);
|
||||
@@ -176,21 +176,21 @@ private void saveFields()
|
||||
// If memory doesn't contain a feeling/quality
|
||||
if (!CB_CTFeel.Enabled)
|
||||
{
|
||||
Main.buff[0xA4] = 0;
|
||||
Main.buff[0xA6] = 0;
|
||||
Main.pk6.Data[0xA4] = 0;
|
||||
Main.pk6.Data[0xA6] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cb1i(CB_CTFeel, 0xA6);
|
||||
Main.buff[0xA4] = (byte)(CB_CTQual.SelectedIndex + 1);
|
||||
Main.pk6.Data[0xA4] = (byte)(CB_CTQual.SelectedIndex + 1);
|
||||
}
|
||||
#endregion
|
||||
#region // OT MEMORIES
|
||||
cb1v(CB_OTMemory, 0xCD);
|
||||
if (!CB_OTVar.Enabled)
|
||||
{
|
||||
Main.buff[0xCE] = 0;
|
||||
Main.buff[0xCF] = 0;
|
||||
Main.pk6.Data[0xCE] = 0;
|
||||
Main.pk6.Data[0xCF] = 0;
|
||||
}
|
||||
else
|
||||
cb2v(CB_OTVar, 0xCE);
|
||||
@@ -198,13 +198,13 @@ private void saveFields()
|
||||
// If memory doesn't contain a feeling/quality
|
||||
if (!CB_OTFeel.Enabled)
|
||||
{
|
||||
Main.buff[0xCC] = 0;
|
||||
Main.buff[0xD0] = 0;
|
||||
Main.pk6.Data[0xCC] = 0;
|
||||
Main.pk6.Data[0xD0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cb1i(CB_OTFeel, 0xD0);
|
||||
Main.buff[0xCC] = (byte)(CB_OTQual.SelectedIndex + 1);
|
||||
Main.pk6.Data[0xCC] = (byte)(CB_OTQual.SelectedIndex + 1);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
198
PKX/f4-RibbMedal.Designer.cs
generated
198
PKX/f4-RibbMedal.Designer.cs
generated
@@ -34,11 +34,18 @@ private void InitializeComponent()
|
||||
this.BTN_None = new System.Windows.Forms.Button();
|
||||
this.BTN_Cancel = new System.Windows.Forms.Button();
|
||||
this.Tab_Medals = new System.Windows.Forms.TabPage();
|
||||
this.CHK_D5 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D4 = new System.Windows.Forms.CheckBox();
|
||||
this.L_Distro = new System.Windows.Forms.Label();
|
||||
this.CHK_D3 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D0 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D1 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D2 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_Secret = new System.Windows.Forms.CheckBox();
|
||||
this.GB_Medals1 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.CB_Bag = new System.Windows.Forms.ComboBox();
|
||||
this.L_Bag = new System.Windows.Forms.Label();
|
||||
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_BagHits = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_Hits = new System.Windows.Forms.Label();
|
||||
this.L_SuperTraining = new System.Windows.Forms.Label();
|
||||
this.L_Rank3 = new System.Windows.Forms.Label();
|
||||
@@ -236,16 +243,9 @@ private void InitializeComponent()
|
||||
this.Hoenn1b_5 = new System.Windows.Forms.CheckBox();
|
||||
this.Hoenn1b_6 = new System.Windows.Forms.CheckBox();
|
||||
this.Hoenn1b_7 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D5 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D4 = new System.Windows.Forms.CheckBox();
|
||||
this.L_Distro = new System.Windows.Forms.Label();
|
||||
this.CHK_D3 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D0 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D1 = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_D2 = new System.Windows.Forms.CheckBox();
|
||||
this.Tab_Medals.SuspendLayout();
|
||||
this.GB_Medals1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_BagHits)).BeginInit();
|
||||
this.GB_Medals2.SuspendLayout();
|
||||
this.Tab_Extra.SuspendLayout();
|
||||
this.GB_Extra2.SuspendLayout();
|
||||
@@ -362,6 +362,75 @@ private void InitializeComponent()
|
||||
this.Tab_Medals.Text = "Training Medals";
|
||||
this.Tab_Medals.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D5
|
||||
//
|
||||
this.CHK_D5.AutoSize = true;
|
||||
this.CHK_D5.Location = new System.Drawing.Point(447, 16);
|
||||
this.CHK_D5.Name = "CHK_D5";
|
||||
this.CHK_D5.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D5.TabIndex = 44;
|
||||
this.CHK_D5.Text = "5";
|
||||
this.CHK_D5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D4
|
||||
//
|
||||
this.CHK_D4.AutoSize = true;
|
||||
this.CHK_D4.Location = new System.Drawing.Point(415, 16);
|
||||
this.CHK_D4.Name = "CHK_D4";
|
||||
this.CHK_D4.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D4.TabIndex = 43;
|
||||
this.CHK_D4.Text = "4";
|
||||
this.CHK_D4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// L_Distro
|
||||
//
|
||||
this.L_Distro.AutoSize = true;
|
||||
this.L_Distro.Location = new System.Drawing.Point(318, 3);
|
||||
this.L_Distro.Name = "L_Distro";
|
||||
this.L_Distro.Size = new System.Drawing.Size(62, 13);
|
||||
this.L_Distro.TabIndex = 38;
|
||||
this.L_Distro.Text = "Distribution:";
|
||||
//
|
||||
// CHK_D3
|
||||
//
|
||||
this.CHK_D3.AutoSize = true;
|
||||
this.CHK_D3.Location = new System.Drawing.Point(382, 16);
|
||||
this.CHK_D3.Name = "CHK_D3";
|
||||
this.CHK_D3.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D3.TabIndex = 42;
|
||||
this.CHK_D3.Text = "3";
|
||||
this.CHK_D3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D0
|
||||
//
|
||||
this.CHK_D0.AutoSize = true;
|
||||
this.CHK_D0.Location = new System.Drawing.Point(382, 2);
|
||||
this.CHK_D0.Name = "CHK_D0";
|
||||
this.CHK_D0.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D0.TabIndex = 39;
|
||||
this.CHK_D0.Text = "0";
|
||||
this.CHK_D0.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D1
|
||||
//
|
||||
this.CHK_D1.AutoSize = true;
|
||||
this.CHK_D1.Location = new System.Drawing.Point(415, 2);
|
||||
this.CHK_D1.Name = "CHK_D1";
|
||||
this.CHK_D1.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D1.TabIndex = 40;
|
||||
this.CHK_D1.Text = "1";
|
||||
this.CHK_D1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D2
|
||||
//
|
||||
this.CHK_D2.AutoSize = true;
|
||||
this.CHK_D2.Location = new System.Drawing.Point(447, 2);
|
||||
this.CHK_D2.Name = "CHK_D2";
|
||||
this.CHK_D2.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D2.TabIndex = 41;
|
||||
this.CHK_D2.Text = "2";
|
||||
this.CHK_D2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_Secret
|
||||
//
|
||||
this.CHK_Secret.AutoSize = true;
|
||||
@@ -375,9 +444,9 @@ private void InitializeComponent()
|
||||
//
|
||||
// GB_Medals1
|
||||
//
|
||||
this.GB_Medals1.Controls.Add(this.comboBox1);
|
||||
this.GB_Medals1.Controls.Add(this.CB_Bag);
|
||||
this.GB_Medals1.Controls.Add(this.L_Bag);
|
||||
this.GB_Medals1.Controls.Add(this.numericUpDown1);
|
||||
this.GB_Medals1.Controls.Add(this.NUD_BagHits);
|
||||
this.GB_Medals1.Controls.Add(this.L_Hits);
|
||||
this.GB_Medals1.Controls.Add(this.L_SuperTraining);
|
||||
this.GB_Medals1.Controls.Add(this.L_Rank3);
|
||||
@@ -407,14 +476,14 @@ private void InitializeComponent()
|
||||
this.GB_Medals1.TabIndex = 5;
|
||||
this.GB_Medals1.TabStop = false;
|
||||
//
|
||||
// comboBox1
|
||||
// CB_Bag
|
||||
//
|
||||
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(105, 166);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(110, 21);
|
||||
this.comboBox1.TabIndex = 23;
|
||||
this.CB_Bag.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Bag.FormattingEnabled = true;
|
||||
this.CB_Bag.Location = new System.Drawing.Point(105, 166);
|
||||
this.CB_Bag.Name = "CB_Bag";
|
||||
this.CB_Bag.Size = new System.Drawing.Size(110, 21);
|
||||
this.CB_Bag.TabIndex = 23;
|
||||
//
|
||||
// L_Bag
|
||||
//
|
||||
@@ -425,19 +494,19 @@ private void InitializeComponent()
|
||||
this.L_Bag.Text = "Last Used Bag:";
|
||||
this.L_Bag.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// numericUpDown1
|
||||
// NUD_BagHits
|
||||
//
|
||||
this.numericUpDown1.Location = new System.Drawing.Point(105, 187);
|
||||
this.numericUpDown1.Maximum = new decimal(new int[] {
|
||||
this.NUD_BagHits.Location = new System.Drawing.Point(105, 187);
|
||||
this.NUD_BagHits.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDown1.Name = "numericUpDown1";
|
||||
this.numericUpDown1.Size = new System.Drawing.Size(50, 20);
|
||||
this.numericUpDown1.TabIndex = 21;
|
||||
this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.numericUpDown1.Value = new decimal(new int[] {
|
||||
this.NUD_BagHits.Name = "NUD_BagHits";
|
||||
this.NUD_BagHits.Size = new System.Drawing.Size(50, 20);
|
||||
this.NUD_BagHits.TabIndex = 21;
|
||||
this.NUD_BagHits.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.NUD_BagHits.Value = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
@@ -2609,75 +2678,6 @@ private void InitializeComponent()
|
||||
this.Hoenn1b_7.Text = "Smart Master";
|
||||
this.Hoenn1b_7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D5
|
||||
//
|
||||
this.CHK_D5.AutoSize = true;
|
||||
this.CHK_D5.Location = new System.Drawing.Point(447, 16);
|
||||
this.CHK_D5.Name = "CHK_D5";
|
||||
this.CHK_D5.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D5.TabIndex = 44;
|
||||
this.CHK_D5.Text = "5";
|
||||
this.CHK_D5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D4
|
||||
//
|
||||
this.CHK_D4.AutoSize = true;
|
||||
this.CHK_D4.Location = new System.Drawing.Point(415, 16);
|
||||
this.CHK_D4.Name = "CHK_D4";
|
||||
this.CHK_D4.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D4.TabIndex = 43;
|
||||
this.CHK_D4.Text = "4";
|
||||
this.CHK_D4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// L_Distro
|
||||
//
|
||||
this.L_Distro.AutoSize = true;
|
||||
this.L_Distro.Location = new System.Drawing.Point(318, 3);
|
||||
this.L_Distro.Name = "L_Distro";
|
||||
this.L_Distro.Size = new System.Drawing.Size(62, 13);
|
||||
this.L_Distro.TabIndex = 38;
|
||||
this.L_Distro.Text = "Distribution:";
|
||||
//
|
||||
// CHK_D3
|
||||
//
|
||||
this.CHK_D3.AutoSize = true;
|
||||
this.CHK_D3.Location = new System.Drawing.Point(382, 16);
|
||||
this.CHK_D3.Name = "CHK_D3";
|
||||
this.CHK_D3.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D3.TabIndex = 42;
|
||||
this.CHK_D3.Text = "3";
|
||||
this.CHK_D3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D0
|
||||
//
|
||||
this.CHK_D0.AutoSize = true;
|
||||
this.CHK_D0.Location = new System.Drawing.Point(382, 2);
|
||||
this.CHK_D0.Name = "CHK_D0";
|
||||
this.CHK_D0.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D0.TabIndex = 39;
|
||||
this.CHK_D0.Text = "0";
|
||||
this.CHK_D0.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D1
|
||||
//
|
||||
this.CHK_D1.AutoSize = true;
|
||||
this.CHK_D1.Location = new System.Drawing.Point(415, 2);
|
||||
this.CHK_D1.Name = "CHK_D1";
|
||||
this.CHK_D1.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D1.TabIndex = 40;
|
||||
this.CHK_D1.Text = "1";
|
||||
this.CHK_D1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_D2
|
||||
//
|
||||
this.CHK_D2.AutoSize = true;
|
||||
this.CHK_D2.Location = new System.Drawing.Point(447, 2);
|
||||
this.CHK_D2.Name = "CHK_D2";
|
||||
this.CHK_D2.Size = new System.Drawing.Size(32, 17);
|
||||
this.CHK_D2.TabIndex = 41;
|
||||
this.CHK_D2.Text = "2";
|
||||
this.CHK_D2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// RibbMedal
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -2699,7 +2699,7 @@ private void InitializeComponent()
|
||||
this.Tab_Medals.PerformLayout();
|
||||
this.GB_Medals1.ResumeLayout(false);
|
||||
this.GB_Medals1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_BagHits)).EndInit();
|
||||
this.GB_Medals2.ResumeLayout(false);
|
||||
this.GB_Medals2.PerformLayout();
|
||||
this.Tab_Extra.ResumeLayout(false);
|
||||
@@ -2954,9 +2954,9 @@ private void InitializeComponent()
|
||||
private System.Windows.Forms.PictureBox PB_53;
|
||||
private System.Windows.Forms.PictureBox PB_52;
|
||||
private System.Windows.Forms.PictureBox PB_51;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.ComboBox CB_Bag;
|
||||
private System.Windows.Forms.Label L_Bag;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDown1;
|
||||
private System.Windows.Forms.NumericUpDown NUD_BagHits;
|
||||
private System.Windows.Forms.Label L_Hits;
|
||||
private System.Windows.Forms.CheckBox ORAS_5;
|
||||
private System.Windows.Forms.CheckBox ORAS_4;
|
||||
|
||||
@@ -13,12 +13,12 @@ public RibbMedal()
|
||||
Util.TranslateInterface(this, Main.curlanguage);
|
||||
|
||||
// Set up Training Bag Data
|
||||
comboBox1.Items.Clear();
|
||||
comboBox1.Items.Add("---");
|
||||
CB_Bag.Items.Clear();
|
||||
CB_Bag.Items.Add("---");
|
||||
for (int i = 1; i < Main.trainingbags.Length - 1; i++)
|
||||
comboBox1.Items.Add(Main.trainingbags[i]);
|
||||
comboBox1.SelectedIndex = Main.buff[0x17];
|
||||
numericUpDown1.Value = Main.buff[0x16];
|
||||
CB_Bag.Items.Add(Main.trainingbags[i]);
|
||||
CB_Bag.SelectedIndex = Main.pk6.TrainingBag;
|
||||
NUD_BagHits.Value = Main.pk6.TrainingBagHits;
|
||||
getRibbons();
|
||||
}
|
||||
private void getRibbons()
|
||||
@@ -66,7 +66,7 @@ private void getRibbons()
|
||||
pba[i].Image = Util.ChangeOpacity(bma[i], 0.1);
|
||||
|
||||
// Populate Medals (what a mess)
|
||||
int rv = Main.buff[0x2C];
|
||||
int rv = Main.pk6.Data[0x2C];
|
||||
updateRibbon(TMedal1_0, rv, 0);
|
||||
updateRibbon(TMedal1_1, rv, 1);
|
||||
updateRibbon(TMedal1_2, rv, 2);
|
||||
@@ -75,7 +75,7 @@ private void getRibbons()
|
||||
updateRibbon(TMedal1_5, rv, 5);
|
||||
updateRibbon(TMedal1_6, rv, 6);
|
||||
updateRibbon(TMedal1_7, rv, 7);
|
||||
rv = Main.buff[0x2D];
|
||||
rv = Main.pk6.Data[0x2D];
|
||||
updateRibbon(TMedal2_0, rv, 0);
|
||||
updateRibbon(TMedal2_1, rv, 1);
|
||||
updateRibbon(TMedal2_2, rv, 2);
|
||||
@@ -84,7 +84,7 @@ private void getRibbons()
|
||||
updateRibbon(TMedal2_5, rv, 5);
|
||||
updateRibbon(TMedal2_6, rv, 6);
|
||||
updateRibbon(TMedal2_7, rv, 7);
|
||||
rv = Main.buff[0x2E];
|
||||
rv = Main.pk6.Data[0x2E];
|
||||
updateRibbon(TMedal3_0, rv, 0);
|
||||
updateRibbon(TMedal3_1, rv, 1);
|
||||
updateRibbon(TMedal3_2, rv, 2);
|
||||
@@ -93,7 +93,7 @@ private void getRibbons()
|
||||
updateRibbon(TMedal3_5, rv, 5);
|
||||
updateRibbon(TMedal3_6, rv, 6);
|
||||
updateRibbon(TMedal3_7, rv, 7);
|
||||
rv = Main.buff[0x2F];
|
||||
rv = Main.pk6.Data[0x2F];
|
||||
updateRibbon(TMedal4_0, rv, 0);
|
||||
updateRibbon(TMedal4_1, rv, 1);
|
||||
updateRibbon(TMedal4_2, rv, 2);
|
||||
@@ -104,7 +104,7 @@ private void getRibbons()
|
||||
updateRibbon(TMedal4_7, rv, 7);
|
||||
|
||||
// Populate Kalos Ribbons
|
||||
rv = Main.buff[0x30];
|
||||
rv = Main.pk6.Data[0x30];
|
||||
updateRibbon(Kalos1a_0, rv, 0);
|
||||
updateRibbon(Kalos1a_1, rv, 1);
|
||||
updateRibbon(Kalos1a_2, rv, 2);
|
||||
@@ -113,7 +113,7 @@ private void getRibbons()
|
||||
updateRibbon(Kalos1a_5, rv, 5);
|
||||
updateRibbon(Kalos1a_6, rv, 6);
|
||||
updateRibbon(Kalos1a_7, rv, 7);
|
||||
rv = Main.buff[0x31];
|
||||
rv = Main.pk6.Data[0x31];
|
||||
updateRibbon(Kalos1b_0, rv, 0);
|
||||
updateRibbon(Kalos1b_1, rv, 1);
|
||||
updateRibbon(Kalos1b_2, rv, 2);
|
||||
@@ -122,7 +122,7 @@ private void getRibbons()
|
||||
updateRibbon(Kalos1b_5, rv, 5);
|
||||
updateRibbon(Kalos1b_6, rv, 6);
|
||||
updateRibbon(Kalos1b_7, rv, 7);
|
||||
rv = Main.buff[0x32];
|
||||
rv = Main.pk6.Data[0x32];
|
||||
updateRibbon(Kalos2a_0, rv, 0);
|
||||
updateRibbon(Kalos2a_1, rv, 1);
|
||||
updateRibbon(Kalos2a_2, rv, 2);
|
||||
@@ -131,7 +131,7 @@ private void getRibbons()
|
||||
updateRibbon(Kalos2a_5, rv, 5);
|
||||
updateRibbon(Kalos2a_6, rv, 6);
|
||||
updateRibbon(Kalos2a_7, rv, 7);
|
||||
rv = Main.buff[0x33];
|
||||
rv = Main.pk6.Data[0x33];
|
||||
updateRibbon(Kalos2b_0, rv, 0);
|
||||
updateRibbon(Kalos2b_1, rv, 1);
|
||||
updateRibbon(Kalos2b_2, rv, 2);
|
||||
@@ -142,7 +142,7 @@ private void getRibbons()
|
||||
updateRibbon(Kalos2b_7, rv, 7);
|
||||
|
||||
// Populate Extra Ribbons
|
||||
rv = Main.buff[0x34];
|
||||
rv = Main.pk6.Data[0x34];
|
||||
updateRibbon(Extra1_0, rv, 0);
|
||||
updateRibbon(Extra1_1, rv, 1);
|
||||
updateRibbon(Extra1_2, rv, 2);
|
||||
@@ -151,7 +151,7 @@ private void getRibbons()
|
||||
|
||||
// oras
|
||||
updateRibbon(Extra1_7, rv, 7);
|
||||
rv = Main.buff[0x35];
|
||||
rv = Main.pk6.Data[0x35];
|
||||
updateRibbon(ORAS_0, rv, 0);
|
||||
updateRibbon(ORAS_1, rv, 1);
|
||||
updateRibbon(ORAS_2, rv, 2);
|
||||
@@ -159,10 +159,10 @@ private void getRibbons()
|
||||
updateRibbon(ORAS_4, rv, 4);
|
||||
updateRibbon(ORAS_5, rv, 5);
|
||||
|
||||
TB_PastContest.Text = Main.buff[0x38].ToString();
|
||||
TB_PastBattle.Text = Main.buff[0x39].ToString();
|
||||
TB_PastContest.Text = Main.pk6.Data[0x38].ToString();
|
||||
TB_PastBattle.Text = Main.pk6.Data[0x39].ToString();
|
||||
|
||||
rv = Main.buff[0x3A];
|
||||
rv = Main.pk6.Data[0x3A];
|
||||
updateRibbon(CHK_D0, rv, 0);
|
||||
updateRibbon(CHK_D1, rv, 1);
|
||||
updateRibbon(CHK_D2, rv, 2);
|
||||
@@ -170,7 +170,7 @@ private void getRibbons()
|
||||
updateRibbon(CHK_D4, rv, 4);
|
||||
updateRibbon(CHK_D5, rv, 5);
|
||||
|
||||
CHK_Secret.Checked = Convert.ToBoolean(Main.buff[0x72]);
|
||||
CHK_Secret.Checked = Convert.ToBoolean(Main.pk6.Data[0x72]);
|
||||
} // Populate Ribbons prompted
|
||||
private void setRibbons()
|
||||
{
|
||||
@@ -208,10 +208,10 @@ private void setRibbons()
|
||||
kalos2b |= addRibbon(Kalos2b_5);
|
||||
kalos2b |= addRibbon(Kalos2b_6);
|
||||
kalos2b |= addRibbon(Kalos2b_7);////
|
||||
Main.buff[0x30] = (byte)kalos1a;
|
||||
Main.buff[0x31] = (byte)kalos1b;
|
||||
Main.buff[0x32] = (byte)kalos2a;
|
||||
Main.buff[0x33] = (byte)kalos2b;
|
||||
Main.pk6.Data[0x30] = (byte)kalos1a;
|
||||
Main.pk6.Data[0x31] = (byte)kalos1b;
|
||||
Main.pk6.Data[0x32] = (byte)kalos2a;
|
||||
Main.pk6.Data[0x33] = (byte)kalos2b;
|
||||
|
||||
// Pass Extra Ribbon
|
||||
int extra1 = 0;
|
||||
@@ -223,7 +223,7 @@ private void setRibbons()
|
||||
|
||||
// ORAS
|
||||
extra1 |= addRibbon(Extra1_7); // Hoenn Champ
|
||||
Main.buff[0x34] = (byte)extra1;
|
||||
Main.pk6.Data[0x34] = (byte)extra1;
|
||||
|
||||
int oras = 0;
|
||||
oras |= addRibbon(ORAS_0);
|
||||
@@ -232,7 +232,7 @@ private void setRibbons()
|
||||
oras |= addRibbon(ORAS_3);
|
||||
oras |= addRibbon(ORAS_4);
|
||||
oras |= addRibbon(ORAS_5);
|
||||
Main.buff[0x35] = (byte)oras;
|
||||
Main.pk6.Data[0x35] = (byte)oras;
|
||||
|
||||
// Gather Super Training Medals
|
||||
int medals1 = 0, medals2 = 0, medals3 = 0, medals4 = 0;
|
||||
@@ -268,13 +268,13 @@ private void setRibbons()
|
||||
medals4 |= addRibbon(TMedal4_5);
|
||||
medals4 |= addRibbon(TMedal4_6);
|
||||
medals4 |= addRibbon(TMedal4_7);////
|
||||
Main.buff[0x2C] = (byte)medals1;
|
||||
Main.buff[0x2D] = (byte)medals2;
|
||||
Main.buff[0x2E] = (byte)medals3;
|
||||
Main.buff[0x2F] = (byte)medals4;
|
||||
Main.pk6.Data[0x2C] = (byte)medals1;
|
||||
Main.pk6.Data[0x2D] = (byte)medals2;
|
||||
Main.pk6.Data[0x2E] = (byte)medals3;
|
||||
Main.pk6.Data[0x2F] = (byte)medals4;
|
||||
|
||||
Main.buff[0x38] = (byte)Util.ToUInt32(TB_PastContest.Text);
|
||||
Main.buff[0x39] = (byte)Util.ToUInt32(TB_PastBattle.Text);
|
||||
Main.pk6.Data[0x38] = (byte)Util.ToUInt32(TB_PastContest.Text);
|
||||
Main.pk6.Data[0x39] = (byte)Util.ToUInt32(TB_PastBattle.Text);
|
||||
|
||||
int dis = 0;
|
||||
dis |= addRibbon(CHK_D0);
|
||||
@@ -283,9 +283,9 @@ private void setRibbons()
|
||||
dis |= addRibbon(CHK_D3);
|
||||
dis |= addRibbon(CHK_D4);
|
||||
dis |= addRibbon(CHK_D5);
|
||||
Main.buff[0x3A] = (byte)dis;
|
||||
Main.pk6.Data[0x3A] = (byte)dis;
|
||||
|
||||
Main.buff[0x72] = Convert.ToByte(CHK_Secret.Checked);
|
||||
Main.pk6.Data[0x72] = Convert.ToByte(CHK_Secret.Checked);
|
||||
} // Saving Ribbons prompted
|
||||
private void updateRibbon(CheckBox chk, int rv, int sh)
|
||||
{
|
||||
@@ -328,7 +328,7 @@ private void buttonFlag(bool b)
|
||||
|
||||
TB_PastContest.Text = (Convert.ToInt32(b) * 40).ToString();
|
||||
TB_PastBattle.Text = (Convert.ToInt32(b) * 8).ToString();
|
||||
if (Main.buff[0xDF] <= 0x10) return; // gen3
|
||||
if (Main.pk6.Data[0xDF] <= 0x10) return; // gen3
|
||||
TB_PastContest.Text = 0.ToString(); // no past gen ribbons 4-5
|
||||
TB_PastBattle.Text = 0.ToString();
|
||||
}
|
||||
@@ -360,8 +360,8 @@ private void buttonFlag(bool b)
|
||||
|
||||
private void BTN_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
Main.buff[0x17] = (byte)comboBox1.SelectedIndex;
|
||||
Main.buff[0x16] = (byte)numericUpDown1.Value;
|
||||
Main.pk6.Data[0x17] = (byte)CB_Bag.SelectedIndex;
|
||||
Main.pk6.Data[0x16] = (byte)NUD_BagHits.Value;
|
||||
setRibbons();
|
||||
Close();
|
||||
} // Save Button
|
||||
|
||||
105
SAV/frmReport.cs
105
SAV/frmReport.cs
@@ -2,6 +2,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -13,6 +14,102 @@ namespace PKHeX
|
||||
public partial class frmReport : Form
|
||||
{
|
||||
private byte[] SaveData;
|
||||
|
||||
public class Preview
|
||||
{
|
||||
private PK6 pk6;
|
||||
public string Position { get { return pk6.Identifier; } }
|
||||
public Image Sprite { get { return pk6.Sprite; } }
|
||||
public string Nickname { get { return pk6.Nickname; } }
|
||||
public string Species { get { return Main.specieslist[pk6.Species]; } }
|
||||
public string Nature { get { return Main.natures[pk6.Nature]; } }
|
||||
public string Gender { get { return Main.gendersymbols[pk6.Gender]; } }
|
||||
public string ESV { get { return pk6.PSV.ToString("0000"); } }
|
||||
public string HP_Type { get { return Main.types[pk6.HPType]; } }
|
||||
public string Ability { get { return Main.abilitylist[pk6.Ability]; } }
|
||||
public string Move1 { get { return Main.movelist[pk6.Move1]; } }
|
||||
public string Move2 { get { return Main.movelist[pk6.Move2]; } }
|
||||
public string Move3 { get { return Main.movelist[pk6.Move3]; } }
|
||||
public string Move4 { get { return Main.movelist[pk6.Move4]; } }
|
||||
public string HeldItem { get { return Main.itemlist[pk6.HeldItem]; } }
|
||||
public string MetLoc { get { return PKX.getLocation(false, pk6.Version, pk6.Met_Location); } }
|
||||
public string EggLoc { get { return PKX.getLocation(false, pk6.Version, pk6.Egg_Location); } }
|
||||
public string Ball { get { return Main.balllist[pk6.Ball]; } }
|
||||
public string OT { get { return pk6.OT_Name; } }
|
||||
public string Version { get { return Main.gamelist[pk6.Version]; } }
|
||||
public string OTLang { get { return Main.gamelanguages[pk6.Language] ?? String.Format("UNK {0}", pk6.Language); } }
|
||||
public string CountryID { get { return pk6.Country.ToString(); } }
|
||||
public string RegionID { get { return pk6.Region.ToString(); } }
|
||||
public string DSRegionID { get { return pk6.ConsoleRegion.ToString(); } }
|
||||
|
||||
#region Extraneous
|
||||
public string EC { get { return pk6.EncryptionConstant.ToString("X8"); } }
|
||||
public string PID { get { return pk6.PID.ToString("X8"); } }
|
||||
public int HP_IV { get { return pk6.IV_HP; } }
|
||||
public int ATK_IV { get { return pk6.IV_ATK; } }
|
||||
public int DEF_IV { get { return pk6.IV_DEF; } }
|
||||
public int SPA_IV { get { return pk6.IV_SPA; } }
|
||||
public int SPD_IV { get { return pk6.IV_SPD; } }
|
||||
public int SPE_IV { get { return pk6.IV_SPE; } }
|
||||
public uint EXP { get { return pk6.EXP; } }
|
||||
public int Level { get { return pk6.Stat_Level; } }
|
||||
public int HP_EV { get { return pk6.EV_HP; } }
|
||||
public int ATK_EV { get { return pk6.EV_ATK; } }
|
||||
public int DEF_EV { get { return pk6.EV_DEF; } }
|
||||
public int SPA_EV { get { return pk6.EV_SPA; } }
|
||||
public int SPD_EV { get { return pk6.EV_SPD; } }
|
||||
public int SPE_EV { get { return pk6.EV_SPE; } }
|
||||
public int Cool { get { return pk6.CNT_Cool; } }
|
||||
public int Beauty { get { return pk6.CNT_Beauty; } }
|
||||
public int Cute { get { return pk6.CNT_Cute; } }
|
||||
public int Smart { get { return pk6.CNT_Smart; } }
|
||||
public int Tough { get { return pk6.CNT_Tough; } }
|
||||
public int Sheen { get { return pk6.CNT_Sheen; } }
|
||||
public int Markings { get { return pk6.Markings; } }
|
||||
|
||||
public string NotOT { get { return pk6.HT_Name; } }
|
||||
|
||||
public int AbilityNum { get { return pk6.AbilityNumber; } }
|
||||
public int GenderFlag { get { return pk6.Gender; } }
|
||||
public int AltForms { get { return pk6.AltForm; } }
|
||||
public int PKRS_Strain { get { return pk6.PKRS_Strain; } }
|
||||
public int PKRS_Days { get { return pk6.PKRS_Days; } }
|
||||
public int MetLevel { get { return pk6.Met_Level; } }
|
||||
public int OT_Gender { get { return pk6.OT_Gender; } }
|
||||
|
||||
public bool FatefulFlag { get { return pk6.FatefulEncounter; } }
|
||||
public bool IsEgg { get { return pk6.IsEgg; } }
|
||||
public bool IsNicknamed { get { return pk6.IsNicknamed; } }
|
||||
public bool IsShiny { get { return pk6.IsShiny; } }
|
||||
|
||||
public int TID { get { return pk6.TID; } }
|
||||
public int SID { get { return pk6.SID; } }
|
||||
public int TSV { get { return pk6.TSV; } }
|
||||
public int Move1_PP { get { return pk6.Move1_PP; } }
|
||||
public int Move2_PP { get { return pk6.Move2_PP; } }
|
||||
public int Move3_PP { get { return pk6.Move3_PP; } }
|
||||
public int Move4_PP { get { return pk6.Move4_PP; } }
|
||||
public int Move1_PPUp { get { return pk6.Move1_PPUps; } }
|
||||
public int Move2_PPUp { get { return pk6.Move2_PPUps; } }
|
||||
public int Move3_PPUp { get { return pk6.Move3_PPUps; } }
|
||||
public int Move4_PPUp { get { return pk6.Move4_PPUps; } }
|
||||
public string Relearn1 { get { return Main.movelist[pk6.RelearnMove1]; } }
|
||||
public string Relearn2 { get { return Main.movelist[pk6.RelearnMove2]; } }
|
||||
public string Relearn3 { get { return Main.movelist[pk6.RelearnMove3]; } }
|
||||
public string Relearn4 { get { return Main.movelist[pk6.RelearnMove4]; } }
|
||||
public ushort Checksum { get { return pk6.Checksum; } }
|
||||
public int mFriendship { get { return pk6.OT_Friendship; } }
|
||||
public int OT_Affection { get { return pk6.OT_Affection; } }
|
||||
public int Egg_Year { get { return pk6.Egg_Year; } }
|
||||
public int Egg_Month { get { return pk6.Egg_Month; } }
|
||||
public int Egg_Day { get { return pk6.Egg_Day; } }
|
||||
public int Met_Year { get { return pk6.Met_Year; } }
|
||||
public int Met_Month { get { return pk6.Met_Month; } }
|
||||
public int Met_Day { get { return pk6.Met_Day; } }
|
||||
public int Encounter { get { return pk6.EncounterType; } }
|
||||
#endregion
|
||||
public Preview(PK6 p) { pk6 = p; }
|
||||
}
|
||||
public frmReport()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -36,9 +133,9 @@ public void PopulateData(byte[] InputData, int BoxDataOffset)
|
||||
byte[] dslotdata = PKX.decryptArray(slotdata);
|
||||
if (BitConverter.ToUInt16(dslotdata, 0x8) == 0) continue;
|
||||
string Identifier = String.Format("B{0}:{1}",BoxNum.ToString("00"),SlotNum.ToString("00"));
|
||||
PKX pkm = new PKX(dslotdata, Identifier);
|
||||
if ((pkm.EC == "00000000") && (pkm.Species == "---")) continue;
|
||||
PL.Add(pkm);
|
||||
PK6 pkm = new PK6(dslotdata, Identifier);
|
||||
if ((pkm.EncryptionConstant == 0) && (pkm.Species == 0)) continue;
|
||||
PL.Add(new Preview(pkm));
|
||||
}
|
||||
}
|
||||
dgData.DataSource = PL;
|
||||
@@ -80,7 +177,7 @@ private void Export_CSV(string path)
|
||||
File.WriteAllText(path, sb.ToString(), Encoding.UTF8);
|
||||
}
|
||||
|
||||
public class PokemonList : SortableBindingList<PKX> { }
|
||||
public class PokemonList : SortableBindingList<Preview> { }
|
||||
}
|
||||
public static class ExtensionMethods // Speed up scrolling
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user