Beispiel #1
0
        /// <summary>Get unfinished bundles which require this item.</summary>
        /// <param name="item">The item for which to find bundles.</param>
        private IEnumerable <BundleModel> GetUnfinishedBundles(SObject item)
        {
            // no bundles for Joja members
            if (Game1.player.hasOrWillReceiveMail(Constant.MailLetters.JojaMember))
            {
                yield break;
            }

            // get community center
            CommunityCenter communityCenter = Game1.locations.OfType <CommunityCenter>().First();

            if (communityCenter.areAllAreasComplete())
            {
                yield break;
            }

            // get bundles
            if (item.GetType() == typeof(SObject) && !item.bigCraftable.Value) // avoid false positives with hats, furniture, etc
            {
                foreach (BundleModel bundle in DataParser.GetBundles())
                {
                    // ignore completed bundle
                    if (communityCenter.isBundleComplete(bundle.ID))
                    {
                        continue;
                    }

                    // get ingredient
                    BundleIngredientModel ingredient = bundle.Ingredients.FirstOrDefault(p => p.ItemID == item.ParentSheetIndex && p.Quality <= (ItemQuality)item.Quality);
                    if (ingredient == null)
                    {
                        continue;
                    }

                    // yield if missing
                    if (!communityCenter.bundles[bundle.ID][ingredient.Index])
                    {
                        yield return(bundle);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>Get whether an ingredient is still needed for a bundle.</summary>
        /// <param name="bundle">The bundle to check.</param>
        /// <param name="ingredient">The ingredient to check.</param>
        private bool IsIngredientNeeded(BundleModel bundle, BundleIngredientModel ingredient)
        {
            CommunityCenter communityCenter = Game1.locations.OfType <CommunityCenter>().First();

            return(!communityCenter.bundles[bundle.ID][ingredient.Index]);
        }