Cleanup, add Personal table for RBY

This commit is contained in:
Michael Scire 2016-08-27 02:48:04 -07:00
parent 3ded8b61c6
commit b5ec320b03
8 changed files with 103 additions and 3 deletions

View file

@ -73,7 +73,7 @@ namespace PKHeX
public override bool IsNicknamed { get { throw new NotImplementedException(); } set { } }
#region Stored Attributes
public override int Species { get { return Data[0]; } set { } }
public override int Species { get { return PKX.getG1Species(Data[0]); } set { Data[0] = (byte)PKX.setG1Species(Data[0]); } }
public override int Stat_HPCurrent { get { return Util.SwapEndianness(BitConverter.ToUInt16(Data, 0x1)); } set { BitConverter.GetBytes(Util.SwapEndianness((ushort)value)).CopyTo(Data, 0x1); } }
public int Status_Condition { get { return Data[4]; } set { Data[4] = (byte)value; } }
@ -148,8 +148,8 @@ namespace PKHeX
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 => 0;
public override int PSV => 0;
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 CurrentFriendship { get { return 0; } set { } }

View file

@ -1623,6 +1623,18 @@ namespace PKHeX
return arr[g3val];
}
public static int getG1Species(int raw_id)
{
int[] table = { 0x00, 0x70, 0x73, 0x20, 0x23, 0x15, 0x64, 0x22, 0x50, 0x02, 0x67, 0x6C, 0x66, 0x58, 0x5E, 0x1D, 0x1F, 0x68, 0x6F, 0x83, 0x3B, 0x97, 0x82, 0x5A, 0x48, 0x5C, 0x7B, 0x78, 0x09, 0x7F, 0x72, 0x00, 0x00, 0x3A, 0x5F, 0x16, 0x10, 0x4F, 0x40, 0x4B, 0x71, 0x43, 0x7A, 0x6A, 0x6B, 0x18, 0x2F, 0x36, 0x60, 0x4C, 0x00, 0x7E, 0x00, 0x7D, 0x52, 0x6D, 0x00, 0x38, 0x56, 0x32, 0x80, 0x00, 0x00, 0x00, 0x53, 0x30, 0x95, 0x00, 0x00, 0x00, 0x54, 0x3C, 0x7C, 0x92, 0x90, 0x91, 0x84, 0x34, 0x62, 0x00, 0x00, 0x00, 0x25, 0x26, 0x19, 0x1A, 0x00, 0x00, 0x93, 0x94, 0x8C, 0x8D, 0x74, 0x75, 0x00, 0x00, 0x1B, 0x1C, 0x8A, 0x8B, 0x27, 0x28, 0x85, 0x88, 0x87, 0x86, 0x42, 0x29, 0x17, 0x2E, 0x3D, 0x3E, 0x0D, 0x0E, 0x0F, 0x00, 0x55, 0x39, 0x33, 0x31, 0x57, 0x00, 0x00, 0x0A, 0x0B, 0x0C, 0x44, 0x00, 0x37, 0x61, 0x2A, 0x96, 0x8F, 0x81, 0x00, 0x00, 0x59, 0x00, 0x63, 0x5B, 0x00, 0x65, 0x24, 0x6E, 0x35, 0x69, 0x00, 0x5D, 0x3F, 0x41, 0x11, 0x12, 0x79, 0x01, 0x03, 0x49, 0x00, 0x76, 0x77, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x4E, 0x13, 0x14, 0x21, 0x1E, 0x4A, 0x89, 0x8E, 0x00, 0x51, 0x00, 0x00, 0x04, 0x07, 0x05, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x2C, 0x2D, 0x45, 0x46, 0x47, 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, 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, 0x00 };
return table[raw_id];
}
public static int setG1Species(int dex_id)
{
int[] table = { 0x00, 0x99, 0x09, 0x9A, 0xB0, 0xB2, 0xB4, 0xB1, 0xB3, 0x1C, 0x7B, 0x7C, 0x7D, 0x70, 0x71, 0x72, 0x24, 0x96, 0x97, 0xA5, 0xA6, 0x05, 0x23, 0x6C, 0x2D, 0x54, 0x55, 0x60, 0x61, 0x0F, 0xA8, 0x10, 0x03, 0xA7, 0x07, 0x04, 0x8E, 0x52, 0x53, 0x64, 0x65, 0x6B, 0x82, 0xB9, 0xBA, 0xBB, 0x6D, 0x2E, 0x41, 0x77, 0x3B, 0x76, 0x4D, 0x90, 0x2F, 0x80, 0x39, 0x75, 0x21, 0x14, 0x47, 0x6E, 0x6F, 0x94, 0x26, 0x95, 0x6A, 0x29, 0x7E, 0xBC, 0xBD, 0xBE, 0x18, 0x9B, 0xA9, 0x27, 0x31, 0xA3, 0xA4, 0x25, 0x08, 0xAD, 0x36, 0x40, 0x46, 0x74, 0x3A, 0x78, 0x0D, 0x88, 0x17, 0x8B, 0x19, 0x93, 0x0E, 0x22, 0x30, 0x81, 0x4E, 0x8A, 0x06, 0x8D, 0x0C, 0x0A, 0x11, 0x91, 0x2B, 0x2C, 0x0B, 0x37, 0x8F, 0x12, 0x01, 0x28, 0x1E, 0x02, 0x5C, 0x5D, 0x9D, 0x9E, 0x1B, 0x98, 0x2A, 0x1A, 0x48, 0x35, 0x33, 0x1D, 0x3C, 0x85, 0x16, 0x13, 0x4C, 0x66, 0x69, 0x68, 0x67, 0xAA, 0x62, 0x63, 0x5A, 0x5B, 0xAB, 0x84, 0x4A, 0x4B, 0x49, 0x58, 0x59, 0x42, 0x83, 0x15, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
return table[dex_id];
}
public static byte setG1Char(ushort chr, bool jp)
{
throw new NotImplementedException();

View file

@ -0,0 +1,67 @@
using System;
using System.Linq;
namespace PKHeX
{
public class PersonalInfoG1 : PersonalInfo
{
protected PersonalInfoG1() { }
public const int SIZE = 0x1C;
public PersonalInfoG1(byte[] data)
{
if (data.Length != SIZE)
return;
Data = data;
TMHM = getBits(Data.Skip(0x14).Take(0x8).ToArray());
}
public override byte[] Write()
{
setBits(TMHM).CopyTo(Data, 0x14);
return Data;
}
public int DEX_ID { get { return Data[0x00]; } set { Data[0x00] = (byte)value; } }
public override int HP { get { return Data[0x01]; } set { Data[0x01] = (byte)value; } }
public override int ATK { get { return Data[0x02]; } set { Data[0x02] = (byte)value; } }
public override int DEF { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } }
public override int SPE { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } }
public int SPC { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } }
public override int SPA { get { return SPC; } set { SPC = value; } }
public override int SPD { get { return SPC; } set { SPC = value; } }
public override int[] Types
{
get { return new int[] { Data[0x06], Data[0x07] }; }
set
{
if (value?.Length != 2) return;
Data[0x06] = (byte)value[0];
Data[0x07] = (byte)value[1];
}
}
public override int CatchRate { get { return Data[0x08]; } set { Data[0x08] = (byte)value; } }
public override int BaseEXP { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } }
public int Move1 { get { return Data[0x0A]; } set { Data[0x0A] = (byte)value; } }
public int Move2 { get { return Data[0x0B]; } set { Data[0x0B] = (byte)value; } }
public int Move3 { get { return Data[0x0C]; } set { Data[0x0C] = (byte)value; } }
public int Move4 { get { return Data[0x0D]; } set { Data[0x0D] = (byte)value; } }
public override int EXPGrowth { get { return Data[0x13]; } set { Data[0x13] = (byte)value; } }
// Future game values, unused
public override int[] Items { get { return new[] { 0, 0 }; } set { } }
public override int[] EggGroups { get { return new[] { 0, 0 }; } set { } }
public override int[] Abilities { get { return new[] { 0, 0 }; } set { } }
public override int Gender { get { return 0; } set { } }
public override int HatchCycles { get { return 0; } set { } }
public override int BaseFriendship { get { return 0; } set { } }
public override int EscapeRate { get { return 0; } set { } }
public override int Color { get { return 0; } set { } }
private int EVYield { get { return 0; } set { } }
public override int EV_HP { get { return 0; } set { } }
public override int EV_ATK { get { return 0; } set { } }
public override int EV_DEF { get { return 0; } set { } }
public override int EV_SPE { get { return 0; } set { } }
public override int EV_SPA { get { return 0; } set { } }
public override int EV_SPD { get { return 0; } set { } }
}
}

View file

@ -15,6 +15,7 @@ namespace PKHeX
internal static readonly PersonalTable FR = new PersonalTable(Properties.Resources.personal_fr, GameVersion.FR);
internal static readonly PersonalTable E = new PersonalTable(Properties.Resources.personal_e, GameVersion.E);
internal static readonly PersonalTable RS = new PersonalTable(Properties.Resources.personal_rs, GameVersion.RS);
internal static readonly PersonalTable RBY = new PersonalTable(Properties.Resources.personal_rby, GameVersion.RBY);
private static byte[][] splitBytes(byte[] data, int size)
{
@ -31,6 +32,7 @@ namespace PKHeX
int size = 0;
switch (format)
{
case GameVersion.RBY: size = PersonalInfoG1.SIZE;break;
case GameVersion.RS:
case GameVersion.E:
case GameVersion.FR:
@ -52,6 +54,10 @@ namespace PKHeX
switch (format)
{
case GameVersion.RBY:
for (int i = 0; i < d.Length; i++)
d[i] = new PersonalInfoG1(entries[i]);
break;
case GameVersion.RS:
case GameVersion.E:
case GameVersion.FR:

View file

@ -15555,6 +15555,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] personal_rby {
get {
object obj = ResourceManager.GetObject("personal_rby", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>

View file

@ -6391,4 +6391,7 @@
<data name="swapBox" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\box\swapBox.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="personal_rby" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\personal_rby;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

View file

@ -18,6 +18,8 @@ namespace PKHeX
SN = 28, MN = 29,
// Game Groupings (SaveFile type)
RBY = 98,
GSC = 99,
RS = 100,
FRLG = 101,
DP = 102,