mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Fix gen2 money/coin getset
Wasn't Binary Coded Decimal (only gen1 was)
This commit is contained in:
parent
9bb799367d
commit
5ae2849cdb
1 changed files with 5 additions and 5 deletions
|
@ -397,23 +397,23 @@ namespace PKHeX.Core
|
|||
}
|
||||
public override uint Money
|
||||
{
|
||||
get { return (uint)BigEndian.BCDToInt32(Data, MoneyOffset, 3); }
|
||||
get { return BigEndian.ToUInt32(Data, MoneyOffset-1) & 0xFFFFFF; }
|
||||
set
|
||||
{
|
||||
value = (uint)Math.Min(value, MaxMoney);
|
||||
BigEndian.Int32ToBCD((int)value, 3).CopyTo(Data, MoneyOffset);
|
||||
byte[] data = BigEndian.GetBytes((uint) Math.Min(value, MaxMoney));
|
||||
Array.Copy(data, 1, Data, MoneyOffset, 3);
|
||||
}
|
||||
}
|
||||
public uint Coin
|
||||
{
|
||||
get
|
||||
{
|
||||
return (uint)BigEndian.BCDToInt32(Data, MoneyOffset + 7, 2);
|
||||
return BigEndian.ToUInt16(Data, MoneyOffset + 7);
|
||||
}
|
||||
set
|
||||
{
|
||||
value = (ushort)Math.Min(value, MaxCoins);
|
||||
BigEndian.Int32ToBCD((int)value, 2).CopyTo(Data, MoneyOffset + 7);
|
||||
BigEndian.GetBytes((ushort)value).CopyTo(Data, MoneyOffset + 7);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue