private void L_QR_Click(object sender, EventArgs e) { if (ModifierKeys == Keys.Alt) { byte[] data = QR.getQRData(); if (data == null) { return; } string[] types = mga.Gifts.Select(g => g.Type).Distinct().ToArray(); MysteryGift gift = MysteryGift.getMysteryGift(data); string giftType = gift.Type; if (mga.Gifts.All(card => card.Data.Length != data.Length)) { Util.Alert("Decoded data not valid for loaded save file.", $"QR Data Size: 0x{data.Length.ToString("X")}"); } else if (types.All(type => type != giftType)) { Util.Alert("Gift type is not compatible with the save file.", $"QR Gift Type: {gift.Type}" + Environment.NewLine + $"Expected Types: {string.Join(", ", types)}"); } else if (gift.Species > SAV.MaxSpeciesID || gift.Moves.Any(move => move > SAV.MaxMoveID) || gift.HeldItem > SAV.MaxItemID) { Util.Alert("Gift Details are not compatible with the save file."); } else { try { viewGiftData(gift); } catch { Util.Alert("Error loading Mystery Gift data."); } } } else { if (mg.Data.SequenceEqual(new byte[mg.Data.Length])) { Util.Alert("No wondercard data found in loaded slot!"); return; } if (SAV.Generation == 6 && mg.Item == 726 && mg.IsItem) { Util.Alert("Eon Ticket Wonder Cards will not function properly", "Inject to the save file instead."); return; } const string server = "http://lunarcookies.github.io/wc.html#"; Image qr = QR.getQRImage(mg.Data, server); if (qr == null) { return; } string desc = $"({mg.Type}) {getDescription(mg)}"; new QR(qr, PB_Preview.Image, desc, "", "", "PKHeX Wonder Card @ ProjectPokemon.org").ShowDialog(); } }