Ejemplo n.º 1
0
 public Item tryToDepositThisItem(Item item, ClickableTextureComponent slot, string noteTextureName)
 {
     if (!depositsAllowed)
     {
         if (Game1.player.hasCompletedCommunityCenter())
         {
             Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:JunimoNote_MustBeAtAJM"));
         }
         else
         {
             Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:JunimoNote_MustBeAtCC"));
         }
         return(item);
     }
     if (!(item is Object) || item is Furniture)
     {
         return(item);
     }
     for (int i = 0; i < ingredients.Count; i++)
     {
         if (IsValidItemForThisIngredientDescription(item, ingredients[i]) && slot.item == null)
         {
             item.Stack    -= ingredients[i].stack;
             ingredients[i] = new BundleIngredientDescription(ingredients[i].index, ingredients[i].stack, ingredients[i].quality, completed: true);
             ingredientDepositAnimation(slot, noteTextureName);
             int index = ingredients[i].index;
             if (index < 0)
             {
                 index = JunimoNoteMenu.GetObjectOrCategoryIndex(index);
             }
             slot.item = new Object(index, ingredients[i].stack, isRecipe: false, -1, ingredients[i].quality);
             Game1.playSound("newArtifact");
             (Game1.getLocationFromName("CommunityCenter") as CommunityCenter).bundles.FieldDict[bundleIndex][i] = true;
             slot.sourceRect.X = 512;
             slot.sourceRect.Y = 244;
             Game1.multiplayer.globalChatInfoMessage("BundleDonate", Game1.player.displayName, slot.item.DisplayName);
             break;
         }
     }
     if (item.Stack > 0)
     {
         return(item);
     }
     return(null);
 }
Ejemplo n.º 2
0
 public bool IsValidItemForThisIngredientDescription(Item item, BundleIngredientDescription ingredient)
 {
     if (item is Object)
     {
         Object o = item as Object;
         if (!ingredient.completed && ingredient.quality <= (int)o.quality)
         {
             if (ingredient.index < 0)
             {
                 if (item.Category == ingredient.index)
                 {
                     return(true);
                 }
             }
             else if (ingredient.index == (int)item.parentSheetIndex)
             {
                 return(true);
             }
         }
         return(false);
     }
     return(false);
 }