Add pk1 current level property party->box setter

https://projectpokemon.org/home/forums/topic/47086-bug-trades-between-two-saves-1g/?do=findComment&comment=235241

fresh encounters have yet to be boxed and don't have the value; set it
whenever setting a Stored slot.
This commit is contained in:
Kurt 2018-08-19 13:35:20 -07:00
parent 8c64f378c1
commit 7ef5d9e547
2 changed files with 10 additions and 1 deletions

View file

@ -177,6 +177,7 @@ namespace PKHeX.Core
}
public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x1); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1); }
public int Stat_LevelBox { get => Data[3];set => Data[3] = (byte)value; }
public int Status_Condition { get => Data[4]; set => Data[4] = (byte)value; }
public int Type_A { get => Data[5]; set => Data[5] = (byte)value; }
public int Type_B { get => Data[6]; set => Data[6] = (byte)value; }
@ -220,7 +221,7 @@ namespace PKHeX.Core
public override int Stat_Level
{
get => Data[0x21];
set { Data[0x21] = (byte)value; Data[0x3] = (byte)value; }
set => Stat_LevelBox = Data[0x21] = (byte)value;
}
public override int Stat_HPMax { get => BigEndian.ToUInt16(Data, 0x22); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x22); }
public override int Stat_ATK { get => BigEndian.ToUInt16(Data, 0x24); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); }

View file

@ -526,6 +526,14 @@ namespace PKHeX.Core
return GetFlag(Offsets.DexCaught + ofs, bit & 7);
}
public override void SetStoredSlot(PKM pkm, int offset, bool? trade = null, bool? dex = null)
{
// pkm that have never been boxed have yet to save the 'current level' for box indication
// set this value at this time
((PK1)pkm).Stat_LevelBox = pkm.CurrentLevel;
base.SetStoredSlot(pkm, offset, trade, dex);
}
private const int SpawnFlagCount = 0xF0;
public bool[] EventSpawnFlags