Refactoring

Simplify HeldItem / SpriteItem
Egg Nicknaming user automation added (checks nicknamed & adds egg if
isEgg ticked)
Remove some unnecessary data caching
Allow QR codes for games NDS+ (for program use only, no QR browser
exploit works
This commit is contained in:
Kaphotics 2016-10-11 22:59:19 -07:00
parent bae964dfc4
commit bc9893415b
14 changed files with 94 additions and 134 deletions

View file

@ -1597,7 +1597,7 @@ namespace PKHeX
private void setForms()
{
int species = Util.getIndex(CB_Species);
if (SAV.Generation < 4 && species != 201)
if (SAV.Generation < 4 && species != 201 || SAV.Generation < 3)
{
Label_Form.Visible = CB_Form.Visible = CB_Form.Enabled = false;
return;
@ -1605,10 +1605,8 @@ namespace PKHeX
bool hasForms = SAV.Personal[species].HasFormes || new[] { 201, 664, 665, 414 }.Contains(species);
CB_Form.Enabled = CB_Form.Visible = Label_Form.Visible = hasForms;
if (SAV.Generation == 2)
CB_Form.Enabled = false;
if (HaX)
if (HaX && SAV.Generation >= 4)
Label_Form.Visible = true;
if (!hasForms)
@ -1661,20 +1659,20 @@ namespace PKHeX
{
PictureBox[] pba = { PB_Mark1, PB_Mark2, PB_Mark3, PB_Mark4, PB_Mark5, PB_Mark6 };
for (int i = 0; i < 6; i++)
pba[i].Image = Util.ChangeOpacity(pba[i].InitialImage, (pkm.Markings[i] ? 1 : 0) * 0.9 + 0.1);
pba[i].Image = Util.ChangeOpacity(pba[i].InitialImage, pkm.Markings[i] ? 1 : 0.1);
PB_MarkShiny.Image = Util.ChangeOpacity(PB_MarkShiny.InitialImage, (!BTN_Shinytize.Enabled ? 1 : 0) * 0.9 + 0.1);
PB_MarkCured.Image = Util.ChangeOpacity(PB_MarkCured.InitialImage, (CHK_Cured.Checked ? 1 : 0) * 0.9 + 0.1);
PB_MarkShiny.Image = Util.ChangeOpacity(PB_MarkShiny.InitialImage, !BTN_Shinytize.Enabled ? 1 : 0.1);
PB_MarkCured.Image = Util.ChangeOpacity(PB_MarkCured.InitialImage, CHK_Cured.Checked ? 1 : 0.1);
int Version = Util.getIndex(CB_GameOrigin); // 24,25 = XY, 26,27 = ORAS, 28,29 = ???
PB_MarkPentagon.Image = Util.ChangeOpacity(PB_MarkPentagon.InitialImage, (Version >= 24 && Version <= 29 ? 1 : 0) * 0.9 + 0.1);
int Version = pkm.Version;
PB_MarkPentagon.Image = Util.ChangeOpacity(PB_MarkPentagon.InitialImage, Version >= 24 && Version <= 29 ? 1 : 0.1);
}
// Clicked Label Shortcuts //
private void clickQR(object sender, EventArgs e)
{
if (SAV.Generation != 6)
if (SAV.Generation <= 3)
{
Util.Alert("QR feature only available for 6th Gen Games.");
Util.Alert("QR feature not available for loaded game.");
return;
}
if (ModifierKeys == Keys.Alt)
@ -1683,15 +1681,20 @@ namespace PKHeX
byte[] ekx = QR.getQRData();
if (ekx == null) return;
if (ekx.Length != SAV.SIZE_STORED) { Util.Alert($"Decoded data not {SAV.SIZE_STORED} bytes.", $"QR Data Size: {SAV.SIZE_STORED}"); }
else
{
PKM pk = PKMConverter.getPKMfromBytes(ekx);
if (!pk.Valid || pk.Species <= 0)
{ Util.Alert("Invalid data detected."); return; }
if (ekx.Length != PKX.SIZE_6STORED) { Util.Alert($"Decoded data not {PKX.SIZE_6STORED} bytes.", $"QR Data Size: {ekx.Length}"); }
else try
{
PK6 pk = new PK6(PKX.decryptArray(ekx));
if (pk.ChecksumValid) { populateFields(pk); }
else Util.Alert("Invalid checksum in QR data.");
}
catch { Util.Alert("Error loading decrypted data."); }
string c; PKM pkz = PKMConverter.convertToFormat(pk, SAV.PKMType, out c);
if (pkz == null)
{ Util.Alert(c); return; }
populateFields(pkz);
}
}
else
{
@ -1699,12 +1702,13 @@ namespace PKHeX
PKM pkx = preparePKM();
byte[] ekx = pkx.EncryptedBoxData;
const string server = "http://loadcode.projectpokemon.org/b1s1.html#"; // Rehosted with permission from LC/MS -- massive thanks!
Image qr = QR.getQRImage(ekx, server);
Image qr = QR.getQRImage(ekx, pkx.Format == 6 ? server : "null/#"); // pls no use QR on non gen6 -- bad user!
if (qr == null) return;
string[] r = pkx.QRText;
new QR(qr, dragout.Image, r[0], r[1], r[2], "PKHeX @ ProjectPokemon.org").ShowDialog();
const string refURL = "PKHeX @ ProjectPokemon.org";
new QR(qr, dragout.Image, r[0], r[1], r[2], $"{refURL} ({pkx.GetType().Name})").ShowDialog();
}
}
private void clickFriendship(object sender, EventArgs e)
@ -2076,13 +2080,8 @@ namespace PKHeX
private void updateRandomPID(object sender, EventArgs e)
{
if (fieldsLoaded)
{
pkm.Version = Util.getIndex(CB_GameOrigin);
pkm.PID = Util.getHEXval(TB_PID.Text);
pkm.Species = Util.getIndex(CB_Species);
pkm.Nature = Util.getIndex(CB_Nature);
pkm.AltForm = CB_Form.SelectedIndex;
}
if (sender == Label_Gender)
pkm.setPIDGender(pkm.Gender);
else if (sender == CB_Nature && pkm.Nature != Util.getIndex(CB_Nature))
@ -2094,7 +2093,7 @@ namespace PKHeX
TB_PID.Text = pkm.PID.ToString("X8");
getQuickFiller(dragout);
if (pkm.GenNumber < 6 && TB_EC.Visible)
if (pkm.GenNumber < 6 && SAV.Generation >= 6)
TB_EC.Text = TB_PID.Text;
}
private void updateRandomEC(object sender, EventArgs e)
@ -2209,12 +2208,8 @@ namespace PKHeX
// If no days are selected
if (CB_PKRSStrain.SelectedIndex == 0)
{
// Never Infected
CHK_Cured.Checked = false;
CHK_Infected.Checked = false;
}
else CHK_Cured.Checked = true;
CHK_Cured.Checked = CHK_Infected.Checked = false; // No Strain = Never Cured / Infected, triggers Strain update
else CHK_Cured.Checked = true; // Any Strain = Cured
}
private void updatePKRSCured(object sender, EventArgs e)
{
@ -2270,21 +2265,22 @@ namespace PKHeX
}
private void updateSpecies(object sender, EventArgs e)
{
// Change Species Prompted
int Species = Util.getIndex(CB_Species);
int Level = Util.ToInt32(TB_Level.Text);
if (MT_Level.Visible) Level = Util.ToInt32(MT_Level.Text);
// Get Forms for Given Species
// Get Species dependent information
setAbilityList();
setForms();
updateForm(null, null);
if (!fieldsLoaded)
return;
pkm.Species = Util.getIndex(CB_Species);
// Recalculate EXP for Given Level
uint EXP = PKX.getEXP(Level, Species);
uint EXP = PKX.getEXP(pkm.CurrentLevel, pkm.Species);
TB_EXP.Text = EXP.ToString();
// Check for Gender Changes
// Get Gender Threshold
int gt = SAV.Personal[Species].Gender;
int gt = SAV.Personal[pkm.Species].Gender;
int cg = Array.IndexOf(gendersymbols, Label_Gender.Text);
int Gender;
@ -2301,8 +2297,6 @@ namespace PKHeX
Label_Gender.Text = gendersymbols[Gender];
Label_Gender.ForeColor = Gender == 2 ? Label_Species.ForeColor : (Gender == 1 ? Color.Red : Color.Blue);
setAbilityList();
updateForm(null, null);
// If species changes and no nickname, set the new name == speciesName.
if (!CHK_Nicknamed.Checked)
@ -2502,7 +2496,6 @@ namespace PKHeX
((PK1)pkm).setNotNicknamed();
if (SAV.Generation == 2)
((PK2)pkm).setNotNicknamed();
}
}
private void updateNicknameClick(object sender, MouseEventArgs e)
@ -2530,28 +2523,39 @@ namespace PKHeX
}
private void updateIsEgg(object sender, EventArgs e)
{
// Display hatch counter if it is an egg, Display Friendship if it is not.
Label_HatchCounter.Visible = CHK_IsEgg.Checked && SAV.Generation > 1;
Label_Friendship.Visible = !CHK_IsEgg.Checked && SAV.Generation > 1;
if (!fieldsLoaded)
return;
pkm.IsEgg = CHK_IsEgg.Checked;
if (CHK_IsEgg.Checked)
{
CHK_Nicknamed.Checked = false;
TB_Friendship.Text = "1";
if (SAV.Generation == 2)
pkm.IsEgg = true;
// If we are an egg, it won't have a met location.
CHK_AsEgg.Checked = true;
GB_EggConditions.Enabled = true;
CAL_MetDate.Value = new DateTime(2000, 01, 01);
CB_MetLocation.SelectedIndex = 2;
// if egg wasn't originally obtained by OT => Link Trade, else => None
bool isTraded = SAV.OT != TB_OT.Text || SAV.TID != Util.ToInt32(TB_TID.Text) || SAV.SID != Util.ToInt32(TB_SID.Text);
CB_MetLocation.SelectedIndex = isTraded ? 2 : 0;
if (!CHK_Nicknamed.Checked)
{
TB_Nickname.Text = PKX.getSpeciesName(0, Util.getIndex(CB_Language));
CHK_Nicknamed.Checked = true;
}
}
else // Not Egg
{
if (!CHK_Nicknamed.Checked)
updateNickname(null, null);
if (SAV.Generation == 2)
pkm.IsEgg = false;
TB_Friendship.Text = SAV.Personal[Util.getIndex(CB_Species)].BaseFriendship.ToString();
if (CB_EggLocation.SelectedIndex == 0)
@ -2560,14 +2564,11 @@ namespace PKHeX
CHK_AsEgg.Checked = false;
GB_EggConditions.Enabled = false;
}
if (TB_Nickname.Text == PKX.getSpeciesName(0, Util.getIndex(CB_Language)))
CHK_Nicknamed.Checked = false;
}
// Display hatch counter if it is an egg, Display Friendship if it is not.
Label_HatchCounter.Visible = CHK_IsEgg.Checked && SAV.Generation > 1;
Label_Friendship.Visible = !CHK_IsEgg.Checked && SAV.Generation > 1;
// Update image to (not) show egg.
if (!fieldsInitialized) return;
updateNickname(null, null);
getQuickFiller(dragout);
}
@ -2715,7 +2716,10 @@ namespace PKHeX
if (sender == CB_Ability && SAV.Generation <= 5 && CB_Ability.SelectedIndex < 2) // not hidden
updateRandomPID(sender, e);
if (sender == CB_Nature && SAV.Generation <= 4)
{
pkm.Nature = CB_Nature.SelectedIndex;
updateRandomPID(sender, e);
}
}
updateNatureModification(sender, null);
updateIVs(null, null); // updating Nature will trigger stats to update as well
@ -2753,7 +2757,7 @@ namespace PKHeX
{
((ComboBox)sender).DroppedDown = false;
}
private void showLegality(PK6 pk, bool tabs, bool verbose)
private void showLegality(PKM pk, bool tabs, bool verbose)
{
LegalityAnalysis la = new LegalityAnalysis(pk);
if (tabs)
@ -2786,14 +2790,14 @@ namespace PKHeX
private void updateStats()
{
// Generate the stats.
ushort[] stats = pkm.getStats(SAV.Personal.getFormeEntry(pkm.Species, pkm.AltForm));
pkm.setStats(pkm.getStats(SAV.Personal.getFormeEntry(pkm.Species, pkm.AltForm)));
Stat_HP.Text = stats[0].ToString();
Stat_ATK.Text = stats[1].ToString();
Stat_DEF.Text = stats[2].ToString();
Stat_SPA.Text = stats[4].ToString();
Stat_SPD.Text = stats[5].ToString();
Stat_SPE.Text = stats[3].ToString();
Stat_HP.Text = pkm.Stat_HPCurrent.ToString();
Stat_ATK.Text = pkm.Stat_ATK.ToString();
Stat_DEF.Text = pkm.Stat_DEF.ToString();
Stat_SPA.Text = pkm.Stat_SPA.ToString();
Stat_SPD.Text = pkm.Stat_SPD.ToString();
Stat_SPE.Text = pkm.Stat_SPE.ToString();
// Recolor the Stat Labels based on boosted stats.
{
@ -2844,10 +2848,8 @@ namespace PKHeX
}
private void openHistory(object sender, EventArgs e)
{
if (pkm.Format < 6) return;
// Write back current values
PK6 pk6 = pkm as PK6;
pk6.Version = Util.getIndex(CB_GameOrigin);
pk6.HT_Name = TB_OTt2.Text;
pk6.OT_Name = TB_OT.Text;
pk6.IsEgg = CHK_IsEgg.Checked;
@ -2892,35 +2894,14 @@ namespace PKHeX
List<string> errata = new List<string>();
if (SAV.Generation > 1)
{
ushort held;
switch (pk.GetType().Name)
{
case "PK2":
held = (ushort)(((PK2)pk).G2Item);
break;
case "CK3":
held = (ushort)(((CK3)pk).G3Item);
break;
case "XK3":
held = (ushort)(((XK3)pk).G3Item);
break;
case "PK3":
held = (ushort)(((PK3)pk).G3Item);
break;
default:
held = (ushort)(pk.HeldItem);
break;
}
ushort held = (ushort)pk.HeldItem;
if (held > itemlist.Length)
errata.Add($"Item Index beyond range: {held}");
else
{
if (held > SAV.MaxItemID)
errata.Add($"Game can't obtain item: {itemlist[held]}");
if (!pk.CanHoldItem(SAV.HeldItems))
errata.Add($"Game can't hold item: {itemlist[held]}");
}
else if (held > SAV.MaxItemID)
errata.Add($"Game can't obtain item: {itemlist[held]}");
else if (!pk.CanHoldItem(SAV.HeldItems))
errata.Add($"Game can't hold item: {itemlist[held]}");
}
if (pk.Species > specieslist.Length)
@ -3470,6 +3451,7 @@ namespace PKHeX
{
if (!fieldsLoaded)
return;
if (!CHK_Nicknamed.Checked)
{
int species = Util.getIndex(CB_Species);

View file

@ -27,8 +27,7 @@ namespace PKHeX
Label_OTGender.Text = gendersymbols[ck3.OT_Gender];
Label_OTGender.ForeColor = ck3.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = ck3.PID.ToString("X8");
CB_HeldItem.SelectedValue = ck3.G3Item;
setAbilityList();
CB_HeldItem.SelectedValue = ck3.HeldItem;
CB_Ability.SelectedIndex = ck3.AbilityNumber > CB_Ability.Items.Count ? 0 : ck3.AbilityNumber;
CB_Nature.SelectedValue = ck3.Nature;
TB_TID.Text = ck3.TID.ToString("00000");
@ -131,7 +130,7 @@ namespace PKHeX
return null;
ck3.Species = Util.getIndex(CB_Species);
ck3.G3Item = Util.getIndex(CB_HeldItem);
ck3.HeldItem = Util.getIndex(CB_HeldItem);
ck3.TID = Util.ToInt32(TB_TID.Text);
ck3.SID = Util.ToInt32(TB_SID.Text);
ck3.EXP = Util.ToUInt32(TB_EXP.Text);

View file

@ -21,7 +21,7 @@ namespace PKHeX
MT_Level.Text = pk2.Stat_Level.ToString();
TB_Level.Text = pk2.Stat_Level.ToString();
TB_EXP.Text = pk2.EXP.ToString();
CB_HeldItem.SelectedValue = pk2.G2Item;
CB_HeldItem.SelectedValue = pk2.HeldItem;
CB_Form.SelectedIndex = pk2.AltForm;
CHK_IsEgg.Checked = pk2.IsEgg;
TB_Friendship.Text = pk2.CurrentFriendship.ToString();
@ -85,7 +85,7 @@ namespace PKHeX
pk2.Species = Util.getIndex(CB_Species);
pk2.TID = Util.ToInt32(TB_TID.Text);
pk2.EXP = Util.ToUInt32(TB_EXP.Text);
pk2.G2Item = Util.getIndex(CB_HeldItem);
pk2.HeldItem = Util.getIndex(CB_HeldItem);
pk2.IsEgg = CHK_IsEgg.Checked;
pk2.CurrentFriendship = Util.ToInt32(TB_Friendship.Text);
pk2.Met_Level = Util.ToInt32(TB_MetLevel.Text);

View file

@ -27,8 +27,7 @@ namespace PKHeX
Label_OTGender.Text = gendersymbols[pk3.OT_Gender];
Label_OTGender.ForeColor = pk3.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = pk3.PID.ToString("X8");
CB_HeldItem.SelectedValue = pk3.G3Item;
setAbilityList();
CB_HeldItem.SelectedValue = pk3.HeldItem;
CB_Ability.SelectedIndex = pk3.AbilityNumber > CB_Ability.Items.Count ? 0 : pk3.AbilityNumber;
CB_Nature.SelectedValue = pk3.Nature;
TB_TID.Text = pk3.TID.ToString("00000");
@ -109,7 +108,7 @@ namespace PKHeX
return null;
pk3.Species = Util.getIndex(CB_Species);
pk3.G3Item = Util.getIndex(CB_HeldItem);
pk3.HeldItem = Util.getIndex(CB_HeldItem);
pk3.TID = Util.ToInt32(TB_TID.Text);
pk3.SID = Util.ToInt32(TB_SID.Text);
pk3.EXP = Util.ToUInt32(TB_EXP.Text);

View file

@ -28,7 +28,6 @@ namespace PKHeX
Label_OTGender.ForeColor = pk4.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = pk4.PID.ToString("X8");
CB_HeldItem.SelectedValue = pk4.HeldItem;
setAbilityList();
CB_Nature.SelectedValue = pk4.Nature;
TB_TID.Text = pk4.TID.ToString("00000");
TB_SID.Text = pk4.SID.ToString("00000");

View file

@ -28,7 +28,6 @@ namespace PKHeX
Label_OTGender.ForeColor = pk5.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = pk5.PID.ToString("X8");
CB_HeldItem.SelectedValue = pk5.HeldItem;
setAbilityList();
CB_Nature.SelectedValue = pk5.Nature;
TB_TID.Text = pk5.TID.ToString("00000");
TB_SID.Text = pk5.SID.ToString("00000");

View file

@ -29,7 +29,6 @@ namespace PKHeX
Label_OTGender.ForeColor = pk6.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = pk6.PID.ToString("X8");
CB_HeldItem.SelectedValue = pk6.HeldItem;
setAbilityList();
TB_AbilityNumber.Text = pk6.AbilityNumber.ToString();
CB_Ability.SelectedIndex = pk6.AbilityNumber < 6 ? pk6.AbilityNumber >> 1 : 0; // with some simple error handling
CB_Nature.SelectedValue = pk6.Nature;

View file

@ -27,8 +27,7 @@ namespace PKHeX
Label_OTGender.Text = gendersymbols[xk3.OT_Gender];
Label_OTGender.ForeColor = xk3.OT_Gender == 1 ? Color.Red : Color.Blue;
TB_PID.Text = xk3.PID.ToString("X8");
CB_HeldItem.SelectedValue = xk3.G3Item;
setAbilityList();
CB_HeldItem.SelectedValue = xk3.HeldItem;
CB_Ability.SelectedIndex = xk3.AbilityNumber > CB_Ability.Items.Count ? 0 : xk3.AbilityNumber;
CB_Nature.SelectedValue = xk3.Nature;
TB_TID.Text = xk3.TID.ToString("00000");
@ -128,7 +127,7 @@ namespace PKHeX
return null;
xk3.Species = Util.getIndex(CB_Species);
xk3.G3Item = Util.getIndex(CB_HeldItem);
xk3.HeldItem = Util.getIndex(CB_HeldItem);
xk3.TID = Util.ToInt32(TB_TID.Text);
xk3.SID = Util.ToInt32(TB_SID.Text);
xk3.EXP = Util.ToUInt32(TB_EXP.Text);

View file

@ -79,8 +79,8 @@ namespace PKHeX
public override int Move4_PP { get { return Data[0x86]; } set { Data[0x86] = (byte)value; } }
public override int Move4_PPUps { get { return Data[0x87]; } set { Data[0x87] = (byte)value; } }
public override int HeldItem { get { return PKX.getG4Item((ushort)G3Item); } set { } }
public int G3Item { get { return BigEndian.ToUInt16(Data, 0x88); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x88); } }
public override int SpriteItem => PKX.getG4Item((ushort)HeldItem);
public override int HeldItem { get { return BigEndian.ToUInt16(Data, 0x88); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x88); } }
// More party stats
public override int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x8A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8A); } }
@ -203,9 +203,5 @@ namespace PKHeX
return false;
}
public override bool CanHoldItem(ushort[] ValidArray)
{
return ValidArray.Contains((ushort)G3Item);
}
}
}

View file

@ -133,8 +133,8 @@ namespace PKHeX
Data[0] = (byte)value;
}
}
public override int HeldItem { get { return PKX.getG4Item((byte) G2Item); } set { } }
public int G2Item { get { return Data[0x1]; } set { Data[0x1] = (byte)value; } }
public override int SpriteItem => PKX.getG4Item((byte)HeldItem);
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; } }
@ -272,11 +272,6 @@ public override int Stat_Level
public bool hasMetData => CaughtData != 0;
public override bool CanHoldItem(ushort[] ValidArray)
{
return ValidArray.Contains((ushort)G2Item);
}
#region Future, Unused Attributes
public override uint EncryptionConstant { get { return 0; } set { } }
public override uint PID { get { return 0; } set { } }

View file

@ -59,8 +59,8 @@ namespace PKHeX
#region Block A
public override int Species { get { return PKX.getG4Species(BitConverter.ToUInt16(Data, 0x20)); } set { BitConverter.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x20); } }
public override int HeldItem { get { return PKX.getG4Item((ushort)G3Item); } set { } }
public int G3Item { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes((ushort) value).CopyTo(Data, 0x22); } }
public override int SpriteItem => PKX.getG4Item((ushort)HeldItem);
public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes((ushort) value).CopyTo(Data, 0x22); } }
public override uint EXP { get { return BitConverter.ToUInt32(Data, 0x24); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x24); } }
private byte PPUps { get { return Data[0x28]; } set { Data[0x28] = value; } }
@ -180,10 +180,6 @@ namespace PKHeX
return false;
}
public override bool CanHoldItem(ushort[] ValidArray)
{
return ValidArray.Contains((ushort)G3Item);
}
public PK4 convertToPK4()
{

View file

@ -227,6 +227,7 @@ namespace PKHeX
public abstract int CurrentHandler { get; set; }
// Derived
public virtual int SpriteItem => HeldItem;
public virtual bool IsShiny => TSV == PSV;
public bool Gen6 => Version >= 24 && Version <= 29;
public bool XY => Version == (int)GameVersion.X || Version == (int)GameVersion.Y;

View file

@ -548,7 +548,7 @@ namespace PKHeX
}
public static Image getSprite(PKM pkm)
{
return getSprite(pkm.Species, pkm.AltForm, pkm.Gender, pkm.HeldItem, pkm.IsEgg, pkm.IsShiny, pkm.Format);
return getSprite(pkm.Species, pkm.AltForm, pkm.Gender, pkm.SpriteItem, pkm.IsEgg, pkm.IsShiny, pkm.Format);
}
// Font Related

View file

@ -43,8 +43,8 @@ namespace PKHeX
public override ushort Checksum { get { return SaveUtil.ccitt16(Data); } set { } } // totally false, just a way to get a 'random' ident for the pkm.
public override int Species { get { return PKX.getG4Species(BigEndian.ToUInt16(Data, 0x00)); } set { BigEndian.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x00); } }
public override int HeldItem { get { return PKX.getG4Item((ushort)G3Item); } set { } }
public int G3Item { get { return BigEndian.ToUInt16(Data, 0x02); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x02); } }
public override int SpriteItem => PKX.getG4Item((ushort)HeldItem);
public override int HeldItem { get { return BigEndian.ToUInt16(Data, 0x02); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x02); } }
public override int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x04); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x04); } }
public override int OT_Friendship { get { return Data[0x06]; } set { Data[0x06] = (byte)value; } }
public override int Met_Location { get { return BigEndian.ToUInt16(Data, 0x08); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x08); } }
@ -210,9 +210,5 @@ namespace PKHeX
return false;
}
public override bool CanHoldItem(ushort[] ValidArray)
{
return ValidArray.Contains((ushort)G3Item);
}
}
}