mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 20:46:56 -05:00
Set Slot id to 3 if no pcd found
Closes #730 Adds ability to set a PCD to a PGT slot (grabs the PGT from card)
This commit is contained in:
@@ -203,7 +203,10 @@ private void clickSet(object sender, EventArgs e)
|
||||
int lastUnfilled = getLastUnfilledByType(mg, mga);
|
||||
if (lastUnfilled > -1 && lastUnfilled < index)
|
||||
index = lastUnfilled;
|
||||
if (mg.Type != mga.Gifts[index].Type)
|
||||
|
||||
if (mg is PCD && mga.Gifts[index] is PGT)
|
||||
mg = (mg as PCD).Gift;
|
||||
else if (mg.Type != mga.Gifts[index].Type)
|
||||
{
|
||||
WinFormsUtil.Alert("Can't set slot here.", $"{mg.Type} != {mga.Gifts[index].Type}");
|
||||
return;
|
||||
@@ -417,14 +420,18 @@ private void pbBoxSlot_DragDrop(object sender, DragEventArgs e)
|
||||
{ WinFormsUtil.Alert("Data size invalid.", files[0]); return; }
|
||||
|
||||
byte[] data = File.ReadAllBytes(files[0]);
|
||||
if (data.Length != mga.Gifts[index].Data.Length)
|
||||
MysteryGift mg = MysteryGift.getMysteryGift(data, new FileInfo(files[0]).Extension);
|
||||
|
||||
if (mg is PCD && mga.Gifts[index] is PGT)
|
||||
mg = (mg as PCD).Gift;
|
||||
else if (mg.Type != mga.Gifts[index].Type)
|
||||
{
|
||||
WinFormsUtil.Alert("Can't set slot here.",
|
||||
$"{data.Length} != {mga.Gifts[index].Data.Length}, {mga.Gifts[index].Type}", files[0]);
|
||||
WinFormsUtil.Alert("Can't set slot here.", $"{mg.Type} != {mga.Gifts[index].Type}");
|
||||
return;
|
||||
}
|
||||
|
||||
mga.Gifts[index].Data = data;
|
||||
setBackground(index, Core.Properties.Resources.slotSet);
|
||||
mga.Gifts[index] = mg.Clone();
|
||||
|
||||
setCardID(mga.Gifts[index].CardID);
|
||||
viewGiftData(mga.Gifts[index]);
|
||||
}
|
||||
|
||||
@@ -605,6 +605,7 @@ private static int[] matchMysteryGifts(MysteryGift[] value)
|
||||
if (pgt == null)
|
||||
continue;
|
||||
|
||||
cardMatch[i] = pgt.Slot = 3;
|
||||
for (byte j = 0; j < 3; j++)
|
||||
{
|
||||
var pcd = value[8 + j] as PCD;
|
||||
|
||||
Reference in New Issue
Block a user