Example #1
0
 public void NewDay()
 {
     readyChecks.Clear();
     luauIngredients.Clear();
     grangeDisplay.Clear();
     movieInvitations.Clear();
 }
        public void UpdateLocalStockWithSyncedQuanitities(SynchedShop shop, Dictionary <ISalable, int[]> localStock, Dictionary <string, Func <bool> > conditionalItemFilters = null)
        {
            List <Item> itemsToRemove = new List <Item>();
            NetStringDictionary <int, NetInt> sharedStock = getSharedStock(shop);

            if (getLastDayUpdated(shop) != Game1.Date.TotalDays)
            {
                setLastDayUpdated(shop, Game1.Date.TotalDays);
                sharedStock.Clear();
                foreach (Item item5 in localStock.Keys)
                {
                    string itemString3 = Utility.getStandardDescriptionFromItem(item5, 1);
                    sharedStock.Add(itemString3, localStock[item5][1]);
                    if (sharedStock[itemString3] != int.MaxValue)
                    {
                        item5.Stack = sharedStock[itemString3];
                    }
                }
            }
            else
            {
                itemsToRemove.Clear();
                foreach (Item item4 in localStock.Keys)
                {
                    string itemString2 = Utility.getStandardDescriptionFromItem(item4, 1);
                    if (sharedStock.ContainsKey(itemString2) && sharedStock[itemString2] > 0)
                    {
                        localStock[item4][1] = sharedStock[itemString2];
                        if (sharedStock[itemString2] != int.MaxValue)
                        {
                            item4.Stack = sharedStock[itemString2];
                        }
                    }
                    else
                    {
                        itemsToRemove.Add(item4);
                    }
                }
                foreach (Item item3 in itemsToRemove)
                {
                    localStock.Remove(item3);
                }
            }
            itemsToRemove.Clear();
            if (conditionalItemFilters != null)
            {
                foreach (Item item2 in localStock.Keys)
                {
                    string itemString = Utility.getStandardDescriptionFromItem(item2, 1);
                    if (conditionalItemFilters.ContainsKey(itemString) && !conditionalItemFilters[itemString]())
                    {
                        itemsToRemove.Add(item2);
                    }
                }
                foreach (Item item in itemsToRemove)
                {
                    localStock.Remove(item);
                }
            }
        }
Example #3
0
 public void NewDay()
 {
     if (Game1.IsClient)
     {
         return;
     }
     readyChecks.Clear();
     luauIngredients.Clear();
     if (grangeDisplay.Count > 0)
     {
         for (int i = 0; i < grangeDisplay.Count; i++)
         {
             Item item = grangeDisplay[i];
             grangeDisplay[i] = null;
             if (item != null)
             {
                 returnedDonations.Add(item);
                 newLostAndFoundItems.Value = true;
             }
         }
     }
     grangeDisplay.Clear();
     movieInvitations.Clear();
 }