Ejemplo n.º 1
0
        /// <summary>
        /// Checks if the <see cref="MysteryGift"/> data is compatible with the <see cref="SaveFile"/>. Sets appropriate data to the save file in order to receive the gift.
        /// </summary>
        /// <param name="g">Gift data to potentially insert to the save file.</param>
        /// <param name="sav">Save file receiving the gift data.</param>
        /// <param name="message">Error message if incompatible.</param>
        /// <returns>True if compatible, false if incompatible.</returns>
        public static bool IsCardCompatible(this MysteryGift g, SaveFile sav, out string message)
        {
            if (g.Generation != sav.Generation)
            {
                message = MsgMysteryGiftSlotSpecialReject;
                return(false);
            }

            if (!sav.CanReceiveGift(g))
            {
                message = MsgMysteryGiftTypeDetails;
                return(false);
            }

            if (g is WC6 && g.CardID == 2048 && g.ItemID == 726) // Eon Ticket (OR/AS)
            {
                if (sav is not SAV6AO)
                {
                    message = MsgMysteryGiftSlotSpecialReject;
                    return(false);
                }
            }

            message = string.Empty;
            return(true);
        }