mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 20:56:59 -05:00
Add DP gift active flags
Only for DP active = !(gift data is all zero); Thanks @BernardoGiordano ! #730
This commit is contained in:
@@ -648,6 +648,12 @@ public override MysteryGiftAlbum GiftAlbum
|
||||
|
||||
MysteryGiftReceivedFlags = value.Flags;
|
||||
MysteryGiftCards = value.Gifts;
|
||||
|
||||
if (Version != GameVersion.DP)
|
||||
return;
|
||||
|
||||
bool[] activeGifts = value.Gifts.Select(gift => !gift.Empty).ToArray();
|
||||
MysteryGiftDPSlotActiveFlags = activeGifts;
|
||||
}
|
||||
}
|
||||
protected override bool[] MysteryGiftReceivedFlags
|
||||
@@ -678,6 +684,39 @@ protected override bool[] MysteryGiftReceivedFlags
|
||||
Edited = true;
|
||||
}
|
||||
}
|
||||
|
||||
private const uint MysteryGiftDPSlotActive = 0xEDB88320;
|
||||
private bool[] MysteryGiftDPSlotActiveFlags
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Version != GameVersion.DP)
|
||||
return null;
|
||||
|
||||
int ofs = WondercardFlags + 0x100; // skip over flags
|
||||
bool[] active = new bool[GiftCountMax]; // 8 PGT, 3 PCD
|
||||
for (int i = 0; i < active.Length; i++)
|
||||
active[i] = BitConverter.ToUInt32(Data, ofs + 4*i) == MysteryGiftDPSlotActive;
|
||||
|
||||
return active;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (Version != GameVersion.DP)
|
||||
return;
|
||||
if (value == null || value.Length != GiftCountMax)
|
||||
return;
|
||||
|
||||
int ofs = WondercardFlags + 0x100; // skip over flags
|
||||
bool[] active = new bool[GiftCountMax]; // 8 PGT, 3 PCD
|
||||
for (int i = 0; i < active.Length; i++)
|
||||
{
|
||||
byte[] magic = BitConverter.GetBytes(value[i] ? MysteryGiftDPSlotActive : 0); // 4 bytes
|
||||
setData(magic, ofs + 4*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override MysteryGift[] MysteryGiftCards
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user