Initial PK2 implementation (incomplete)

This commit is contained in:
Michael Scire
2016-08-31 13:52:30 -07:00
parent 4c37a63e2c
commit 8668d6221d
3 changed files with 437 additions and 23 deletions

View File

@@ -30,7 +30,11 @@ public PK1(byte[] decryptedData = null, string ident = null, bool jp = false)
Identifier = ident;
if (Data.Length != SIZE_PARTY)
Array.Resize(ref Data, SIZE_PARTY);
int strLen = jp ? STRLEN_J : STRLEN_U;
int strLen = STRLEN_U;
if (jp)
{
strLen = STRLEN_J;
}
otname = Enumerable.Repeat((byte) 0x50, strLen).ToArray();
nick = Enumerable.Repeat((byte) 0x50, strLen).ToArray();
}
@@ -100,7 +104,8 @@ public override bool IsNicknamed
get
{
string spName = PKX.getSpeciesName(Species, Japanese ? 1 : 2).ToUpper();
return !nick.SequenceEqual(
return
!nick.SequenceEqual(
PKX.setG1Str(spName, Japanese)
.Concat(Enumerable.Repeat((byte) 0x50, StringLength - spName.Length - 1)));
}
@@ -252,18 +257,17 @@ public override bool CanHoldItem(ushort[] ValidArray)
#endregion
}
public class PokemonList1
class PokemonList1
{
internal const int CAPACITY_DAYCARE = 1;
internal const int CAPACITY_PARTY = 6;
internal const int CAPACITY_STORED = 20;
internal const int CAPACITY_STORED_JP = 30;
private readonly bool Japanese;
private bool Japanese;
private int StringLength => Japanese ? PK1.STRLEN_J : PK1.STRLEN_U;
internal static readonly byte[] EMPTY_LIST = { 0x01, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50 };
public enum CapacityType
{
Daycare = CAPACITY_DAYCARE,
@@ -308,12 +312,9 @@ public PokemonList1(byte[] d, CapacityType c = CapacityType.Single, bool jp = fa
{
int base_ofs = 2 + Capacity;
byte[] dat = Data.Skip(base_ofs + Entry_Size * i).Take(Entry_Size).ToArray();
Pokemon[i] = new PK1(dat, null, jp)
{
otname = Data.Skip(base_ofs + Capacity*Entry_Size + StringLength*i).Take(StringLength).ToArray(),
nick = Data.Skip(base_ofs + Capacity*Entry_Size + StringLength*Capacity + StringLength*i)
.Take(StringLength).ToArray()
};
Pokemon[i] = new PK1(dat, null, jp);
Pokemon[i].otname = Data.Skip(base_ofs + Capacity * Entry_Size + StringLength * i).Take(StringLength).ToArray();
Pokemon[i].nick = Data.Skip(base_ofs + Capacity * Entry_Size + StringLength * Capacity + StringLength * i).Take(StringLength).ToArray();
}
}
@@ -357,14 +358,14 @@ public int GetCapacity()
set
{
if (value == null) return;
Pokemon[i] = (PK1)value.Clone();
Pokemon[i] = (PK1)(((PK1)value).Clone());
}
}
private void Update()
{
if (Pokemon.Any(pk => pk.Species == 0))
Count = (byte) Array.FindIndex(Pokemon, pk => pk.Species == 0);
if (Pokemon.Any(pk => (pk.Species == 0)))
Count = (byte) Array.FindIndex(Pokemon, pk => (pk.Species == 0));
else
Count = Capacity;
for (int i = 0; i < Count; i++)

408
PKHeX/PKM/PK2.cs Normal file
View File

@@ -0,0 +1,408 @@
using System;
using System.Linq;
namespace PKHeX
{
public class PK2 : PKM
{
// Internal use only
protected internal byte[] otname;
protected internal byte[] nick;
public byte[] OT_Name_Raw => (byte[])otname.Clone();
public byte[] Nickname_Raw => (byte[])nick.Clone();
public sealed override int SIZE_PARTY => PKX.SIZE_2PARTY;
public override int SIZE_STORED => PKX.SIZE_2STORED;
internal const int STRLEN_J = 6;
internal const int STRLEN_U = 11;
private int StringLength => Japanese ? STRLEN_J : STRLEN_U;
public override int Format => 1;
public bool Japanese => otname.Length == STRLEN_J;
public override string FileName => $"{Species.ToString("000")} - {Nickname} - {OT_Name}.{Extension}";
public PK2(byte[] decryptedData = null, string ident = null, bool jp = false)
{
Data = (byte[])(decryptedData ?? new byte[SIZE_PARTY]).Clone();
Identifier = ident;
if (Data.Length != SIZE_PARTY)
Array.Resize(ref Data, SIZE_PARTY);
int strLen = STRLEN_U;
if (jp)
{
strLen = STRLEN_J;
}
otname = Enumerable.Repeat((byte) 0x50, strLen).ToArray();
nick = Enumerable.Repeat((byte) 0x50, strLen).ToArray();
IsEgg = false; // Egg data stored in Pokemon List.
}
public override PKM Clone()
{
PK2 new_pk2 = new PK2(Data, Identifier, Japanese);
Array.Copy(otname, 0, new_pk2.otname, 0, otname.Length);
Array.Copy(nick, 0, new_pk2.nick, 0, nick.Length);
return new_pk2;
}
public override string Nickname
{
get { return PKX.getG1Str(nick, Japanese); }
set
{
byte[] strdata = PKX.setG1Str(value, Japanese);
if (strdata.Length > StringLength)
throw new ArgumentOutOfRangeException($"Nickname {value} too long for given PK2");
if (nick.Any(b => b == 0) && nick[StringLength - 1] == 0x50 && Array.FindIndex(nick, b => b == 0) == strdata.Length - 1) // Handle JP Mew event with grace
{
int firstInd = Array.FindIndex(nick, b => b == 0);
for (int i = firstInd; i < StringLength - 1; i++)
if (nick[i] != 0)
break;
strdata = strdata.Take(strdata.Length - 1).ToArray();
}
strdata.CopyTo(nick, 0);
}
}
public override string OT_Name
{
get { return PKX.getG1Str(otname, Japanese); }
set
{
byte[] strdata = PKX.setG1Str(value, Japanese);
if (strdata.Length > StringLength)
throw new ArgumentOutOfRangeException($"OT Name {value} too long for given PK1");
if (otname.Any(b => b == 0) && otname[StringLength - 1] == 0x50 && Array.FindIndex(otname, b => b == 0) == strdata.Length - 1) // Handle JP Mew event with grace
{
int firstInd = Array.FindIndex(otname, b => b == 0);
for (int i = firstInd; i < StringLength - 1; i++)
if (otname[i] != 0)
break;
strdata = strdata.Take(strdata.Length - 1).ToArray();
}
strdata.CopyTo(otname, 0);
}
}
public override byte[] Encrypt()
{
// Oh god this is such total abuse of what this method is meant to do
// Please forgive me
return (byte[]) Data.Clone();
// return new PokemonList1(this).GetBytes();
}
// Please forgive me.
public override byte[] EncryptedPartyData => Encrypt().ToArray();
public override byte[] EncryptedBoxData => Encrypt().ToArray();
public override byte[] DecryptedBoxData => Encrypt().ToArray();
public override byte[] DecryptedPartyData => Encrypt().ToArray();
public override bool IsNicknamed
{
get
{
string spName = PKX.getSpeciesName(Species, Japanese ? 1 : 2).ToUpper();
return
!nick.SequenceEqual(
PKX.setG1Str(spName, Japanese)
.Concat(Enumerable.Repeat((byte) 0x50, StringLength - spName.Length - 1)));
}
set { }
}
public void setNotNicknamed()
{
string spName = PKX.getSpeciesName(Species, Japanese ? 1 : 2).ToUpper();
nick = PKX.setG1Str(spName, Japanese).Concat(Enumerable.Repeat((byte)0x50, StringLength - spName.Length - 1)).ToArray();
}
#region Stored Attributes
public override int Species
{
get { return Data[0]; }
set
{
Data[0] = (byte)value;
}
}
public override int HeldItem { get { return Data[0x1]; } set { Data[0x1] = (byte)value; } }
public override int Move1 { get { return Data[2]; } set { Data[2] = (byte) value; } }
public override int Move2 { get { return Data[3]; } set { Data[3] = (byte)value; } }
public override int Move3 { get { return Data[4]; } set { Data[4] = (byte)value; } }
public override int Move4 { get { return Data[5]; } set { Data[5] = (byte)value; } }
public override int TID { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 6)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 6); } }
public override uint EXP
{
get { return (Util.SwapEndianness(BitConverter.ToUInt32(Data, 8)) >> 8) & 0x00FFFFFF; }
set { Array.Copy(BitConverter.GetBytes(Util.SwapEndianness((value << 8) & 0xFFFFFF00)), 0, Data, 8, 3); }
}
public override int EV_HP { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0xB)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0xB); } }
public override int EV_ATK { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0xD)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0xD); } }
public override int EV_DEF { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0xF)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0xF); } }
public override int EV_SPE { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x11)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x11); } }
public int EV_SPC { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x13)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x13); } }
public override int EV_SPA { get { return EV_SPC; } set { EV_SPC = value; } }
public override int EV_SPD { get { return EV_SPC; } set { } }
public ushort DV16 { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x15)); } set { BitConverter.GetBytes(Util.SwapEndianness(value)).CopyTo(Data, 0x15); } }
public override int IV_HP { get { return ((IV_ATK & 1) << 3) | ((IV_DEF & 1) << 2) | ((IV_SPE & 1) << 1) | ((IV_SPC & 1) << 0); } set { } }
public override int IV_ATK { get { return (DV16 >> 12) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 12)) | (ushort)((value > 0xF ? 0xF : value) << 12)); } }
public override int IV_DEF { get { return (DV16 >> 8) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 8)) | (ushort)((value > 0xF ? 0xF : value) << 8)); } }
public override int IV_SPE { get { return (DV16 >> 4) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 4)) | (ushort)((value > 0xF ? 0xF : value) << 4)); } }
public int IV_SPC { get { return (DV16 >> 0) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 0)) | (ushort)((value > 0xF ? 0xF : value) << 0)); } }
public override int IV_SPA { get { return IV_SPC; } set { IV_SPC = value; } }
public override int IV_SPD { get { return IV_SPC; } set { } }
public override int Move1_PP { get { return Data[0x17] & 0x3F; } set { Data[0x17] = (byte)((Data[0x17] & 0xC0) | (value & 0x3F)); } }
public override int Move2_PP { get { return Data[0x18] & 0x3F; } set { Data[0x18] = (byte)((Data[0x18] & 0xC0) | (value & 0x3F)); } }
public override int Move3_PP { get { return Data[0x19] & 0x3F; } set { Data[0x19] = (byte)((Data[0x19] & 0xC0) | (value & 0x3F)); } }
public override int Move4_PP { get { return Data[0x1A] & 0x3F; } set { Data[0x1A] = (byte)((Data[0x1A] & 0xC0) | (value & 0x3F)); } }
public override int Move1_PPUps { get { return (Data[0x17] & 0xC0) >> 6; } set { Data[0x17] = (byte)((Data[0x17] & 0x3F) | ((value & 0x3) << 6)); } }
public override int Move2_PPUps { get { return (Data[0x18] & 0xC0) >> 6; } set { Data[0x18] = (byte)((Data[0x18] & 0x3F) | ((value & 0x3) << 6)); } }
public override int Move3_PPUps { get { return (Data[0x19] & 0xC0) >> 6; } set { Data[0x19] = (byte)((Data[0x19] & 0x3F) | ((value & 0x3) << 6)); } }
public override int Move4_PPUps { get { return (Data[0x1A] & 0xC0) >> 6; } set { Data[0x1A] = (byte)((Data[0x1A] & 0x3F) | ((value & 0x3) << 6)); } }
public override int CurrentFriendship { get { return Data[0x1B]; } set { Data[0x1B] = (byte) value; } }
private byte PKRS { get { return Data[0x1C]; } set { Data[0x1C] = value; } }
public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } }
// Crystal only Caught Data
private int CaughtData { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x1D)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x1D); } }
public override int Met_Level { get { return (CaughtData >> 8) & 0x3F; } set { CaughtData = (CaughtData & 0xC0FF) | (value & 0x3F); } }
public override int OT_Gender { get { return (CaughtData >> 7) & 1; } set { CaughtData = (CaughtData & 0xFFEF) | (value & 1); } }
public override int Met_Location { get { return CaughtData & 0x7F; } set { CaughtData = (CaughtData & 0xFF80) | (value & 0x7F); } }
public override int Stat_Level
{
get { return Data[0x1F]; }
set { Data[0x1F] = (byte)value; }
}
#endregion
#region Party Attributes
public int Status_Condition { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
public override int Stat_HPCurrent { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x22)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x22); } }
public override int Stat_HPMax { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x24)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x24); } }
public override int Stat_ATK { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x26)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x26); } }
public override int Stat_DEF { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x28)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x28); } }
public override int Stat_SPE { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x2A)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x2A); } }
public override int Stat_SPA { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x2C)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x2C); } }
public override int Stat_SPD { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x2E)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x2E); } }
#endregion
public override ushort[] getStats(PersonalInfo p)
{
ushort[] Stats = new ushort[6];
for (int i = 0; i < Stats.Length; i++)
{
ushort L = (ushort)Stat_Level;
ushort B = (ushort)p.Stats[i];
ushort I = (ushort)IVs[i];
ushort E = // Fixed formula via http://www.smogon.com/ingame/guides/rby_gsc_stats
(ushort)Math.Floor(Math.Min(255, Math.Floor(Math.Sqrt(Math.Max(0, EVs[i] - 1)) + 1)) / 4.0);
Stats[i] = (ushort)Math.Floor((2 * (B + I) + E) * L / 100.0 + 5);
}
Stats[0] += (ushort)(5 + Stat_Level); // HP
return Stats;
}
public override bool getGenderIsValid()
{
return true;
int gv = PersonalTable.GSC[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
public override bool IsEgg { get; set; }
public override int Gender { get { return 0; } set { } }
public bool hasMetData => CaughtData != 0;
public override bool CanHoldItem(ushort[] ValidArray)
{
return false;
}
#region Future, Unused Attributes
public override uint EncryptionConstant { get { return 0; } set { } }
public override uint PID { get { return 0; } set { } }
public override int Nature { get { return 0; } set { } }
public override int AltForm { get { return 0; } set { } }
public override ushort Sanity { get { return 0; } set { } }
public override bool ChecksumValid => true;
public override ushort Checksum { get { return 0; } set { } }
public override int Language { get { return 0; } set { } }
public override bool FatefulEncounter { get { return false; } set { } }
public override int TSV => 0x0000;
public override int PSV => 0xFFFF;
public override int Characteristic => -1;
public override byte MarkByte { get { return 0; } protected set { } }
public override int Ability { get { return 0; } set { } }
public override int CurrentHandler { get { return 0; } set { } }
public override int Egg_Location { get { return 0; } set { } }
public override int OT_Friendship { get { return 0; } set { } }
public override int Ball { get { return 0; } set { } }
public override int Version { get { return 0; } set { } }
public override int SID { get { return 0; } set { } }
public override int CNT_Cool { get { return 0; } set { } }
public override int CNT_Beauty { get { return 0; } set { } }
public override int CNT_Cute { get { return 0; } set { } }
public override int CNT_Smart { get { return 0; } set { } }
public override int CNT_Tough { get { return 0; } set { } }
public override int CNT_Sheen { get { return 0; } set { } }
#endregion
}
class PokemonList2
{
internal const int CAPACITY_DAYCARE = 1;
internal const int CAPACITY_PARTY = 6;
internal const int CAPACITY_STORED = 20;
internal const int CAPACITY_STORED_JP = 30;
private bool Japanese;
private int StringLength => Japanese ? PK2.STRLEN_J : PK2.STRLEN_U;
public enum CapacityType
{
Daycare = CAPACITY_DAYCARE,
Party = CAPACITY_PARTY,
Stored = CAPACITY_STORED,
StoredJP = CAPACITY_STORED_JP,
Single
}
public static int getEntrySize(CapacityType c)
{
return c == CapacityType.Single || c == CapacityType.Party
? PKX.SIZE_2PARTY
: PKX.SIZE_2STORED;
}
public static byte getCapacity(CapacityType c)
{
return c == CapacityType.Single ? (byte)1 : (byte)c;
}
private byte[] getEmptyList(CapacityType c, bool is_JP = false)
{
int cap = getCapacity(c);
return new[] { (byte)0 }.Concat(Enumerable.Repeat((byte)0xFF, cap + 1)).Concat(Enumerable.Repeat((byte)0, getEntrySize(c) * cap)).Concat(Enumerable.Repeat((byte)0x50, (is_JP ? PK2.STRLEN_J : PK2.STRLEN_U) * 2 * cap)).ToArray();
}
public PokemonList2(byte[] d, CapacityType c = CapacityType.Single, bool jp = false)
{
Japanese = jp;
Data = d ?? getEmptyList(c, Japanese);
Capacity = getCapacity(c);
Entry_Size = getEntrySize(c);
if (Data.Length != DataSize)
{
Array.Resize(ref Data, DataSize);
}
Pokemon = new PK2[Capacity];
for (int i = 0; i < Capacity; i++)
{
int base_ofs = 2 + Capacity;
byte[] dat = Data.Skip(base_ofs + Entry_Size * i).Take(Entry_Size).ToArray();
Pokemon[i] = new PK2(dat, null, jp);
Pokemon[i].IsEgg = Data[1 + i] == 0xFD;
Pokemon[i].otname = Data.Skip(base_ofs + Capacity * Entry_Size + StringLength * i).Take(StringLength).ToArray();
Pokemon[i].nick = Data.Skip(base_ofs + Capacity * Entry_Size + StringLength * Capacity + StringLength * i).Take(StringLength).ToArray();
}
}
public PokemonList2(CapacityType c = CapacityType.Single, bool jp = false)
: this(null, c, jp)
{
Count = 1;
}
public PokemonList2(PK2 pk)
: this(CapacityType.Single, pk.Japanese)
{
this[0] = pk;
Count = 1;
}
private readonly byte[] Data;
private readonly byte Capacity;
private readonly int Entry_Size;
public byte Count
{
get { return Data[0]; }
set { Data[0] = value > Capacity ? Capacity : value; }
}
public int GetCapacity()
{
return Capacity;
}
public readonly PK2[] Pokemon;
public PK2 this[int i]
{
get
{
if (i > Capacity || i < 0) throw new IndexOutOfRangeException($"Invalid PokemonList Access: {i}");
return Pokemon[i];
}
set
{
if (value == null) return;
Pokemon[i] = (PK2)(((PK2)value).Clone());
}
}
private void Update()
{
if (Pokemon.Any(pk => (pk.Species == 0)))
Count = (byte)Array.FindIndex(Pokemon, pk => (pk.Species == 0));
else
Count = Capacity;
for (int i = 0; i < Count; i++)
{
Data[1 + i] = Pokemon[i].IsEgg ? (byte)0xFD : (byte)Pokemon[i].Species;
Array.Copy(Pokemon[i].Data, 0, Data, 2 + Capacity + Entry_Size * i, Entry_Size);
Array.Copy(Pokemon[i].OT_Name_Raw, 0, Data, 2 + Capacity + Capacity * Entry_Size + StringLength * i, StringLength);
Array.Copy(Pokemon[i].Nickname_Raw, 0, Data, 2 + Capacity + Capacity * Entry_Size + StringLength * Capacity + StringLength * i, StringLength);
}
Data[1 + Count] = byte.MaxValue;
}
public byte[] GetBytes()
{
Update();
return Data;
}
private int DataSize => Capacity * (Entry_Size + 1 + 2 * StringLength) + 2;
public static int GetDataLength(CapacityType c, bool jp = false)
{
return getCapacity(c) * (getEntrySize(c) + 1 + 2 * (jp ? PK2.STRLEN_J : PK2.STRLEN_U)) + 2;
}
}
}

View File

@@ -15,6 +15,11 @@ public static class PKX
internal const int SIZE_1PARTY = 44;
internal const int SIZE_1STORED = 33;
internal const int SIZE_2ULIST = 73;
internal const int SIZE_2JLIST = 63;
internal const int SIZE_2PARTY = 48;
internal const int SIZE_2STORED = 32;
internal const int SIZE_3PARTY = 100;
internal const int SIZE_3STORED = 80;
internal const int SIZE_3BLOCK = 12;
@@ -38,7 +43,7 @@ public static class PKX
/// <returns>A boolean indicating whether or not the length is valid for a Pokemon file.</returns>
public static bool getIsPKM(long len)
{
return new[] {SIZE_1JLIST, SIZE_1ULIST, SIZE_3STORED, SIZE_3PARTY, SIZE_4STORED, SIZE_4PARTY, SIZE_5PARTY, SIZE_6STORED, SIZE_6PARTY}.Contains((int)len);
return new[] {SIZE_1JLIST, SIZE_1ULIST, SIZE_2ULIST, SIZE_2JLIST, SIZE_3STORED, SIZE_3PARTY, SIZE_4STORED, SIZE_4PARTY, SIZE_5PARTY, SIZE_6STORED, SIZE_6PARTY}.Contains((int)len);
}
// C# PKX Function Library
@@ -1636,7 +1641,7 @@ public static ushort getG4Item(ushort g3val)
}
#region Gen 1 Character Tables
private static Dictionary<byte, string> RBY2U_U => new Dictionary<byte, string>{
internal static Dictionary<byte, string> RBY2U_U => new Dictionary<byte, string>{
{0x50, "\0"},
{0x5D, "[TRAINER]"},
{0x7F, " "},
@@ -1699,8 +1704,8 @@ public static ushort getG4Item(ushort g3val)
{0xB8, "y"},
{0xB9, "z"},
{0xE1, "{"}, /* Pk */
{0xE2, "}"}, /* Mn */
{0xE3, "-"},
{0xE2, "}"}, /* Mn */
{0xE3, "-"},
{0xE6, "?"},
{0xE7, "!"},
{0xEF, "♂"},
@@ -1720,7 +1725,7 @@ public static ushort getG4Item(ushort g3val)
{0xFF, "9"}
};
private static Dictionary<string, byte> U2RBY_U => new Dictionary<string, byte> {
internal static Dictionary<string, byte> U2RBY_U => new Dictionary<string, byte> {
{"\0", 0x50},
{"[TRAINER]", 0x5D},
{" ", 0x7F},
@@ -1783,8 +1788,8 @@ public static ushort getG4Item(ushort g3val)
{"y", 0xB8},
{"z", 0xB9},
{"{", 0xE1}, /* Pk */
{"}", 0xE2}, /* Mn */
{"-", 0xE3},
{"}", 0xE2}, /* Mn */
{"-", 0xE3},
{"?", 0xE6},
{"!", 0xE7},
{"♂", 0xEF},
@@ -1803,7 +1808,7 @@ public static ushort getG4Item(ushort g3val)
{"8", 0xFE},
{"9", 0xFF}
};
private static Dictionary<string, byte> U2RBY_J => new Dictionary<string, byte> {
internal static Dictionary<string, byte> U2RBY_J => new Dictionary<string, byte> {
{"ガ", 0x05},
{"ギ", 0x06},
{"グ", 0x07},
@@ -1964,7 +1969,7 @@ public static ushort getG4Item(ushort g3val)
{"♀", 0xF5}
};
private static Dictionary<byte, string> RBY2U_J => new Dictionary<byte, string> {
static Dictionary<byte, string> RBY2U_J => new Dictionary<byte, string> {
{0x05, "ガ"},
{0x06, "ギ"},
{0x07, "グ"},