private static bool Chest_addItem_Prefix(Chest __instance, Item item, ref Item __result)
        {
            DataAccess  DataAccess = DataAccess.GetDataAccess();
            List <Node> nodes      = DataAccess.LocationNodes[Game1.currentLocation];
            Node        node       = nodes.Find(n => n.Position.Equals(__instance.tileLocation));

            if (node is FilterPipeNode)
            {
                item.resetState();
                __instance.clearNulls();
                NetObjectList <Item> item_list = __instance.items;
                if (__instance.SpecialChestType == Chest.SpecialChestTypes.MiniShippingBin || __instance.SpecialChestType == Chest.SpecialChestTypes.JunimoChest)
                {
                    item_list = __instance.GetItemsForPlayer(Game1.player.UniqueMultiplayerID);
                }
                if (!item_list.Any(x => x.Name.Equals(item.Name)))
                {
                    if (item_list.Count < __instance.GetActualCapacity())
                    {
                        item_list.Add(item.getOne());
                        __result = null;
                    }
                    else
                    {
                        __result = item;
                    }
                }
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        public void UpdateHutContainsItemCategory(Guid id, int itemCategory)
        {
            JunimoHut            hut   = Util.GetHutFromId(id);
            NetObjectList <Item> chest = hut.output.Value.items;

            if (!ItemsInHuts.ContainsKey(id))
            {
                ItemsInHuts.Add(id, new Dictionary <int, bool>());
            }
            ItemsInHuts[id][itemCategory] = chest.Any(item => item.category == itemCategory);
        }
Beispiel #3
0
        public override bool CanStackItem(Item item)
        {
            bool canStack = false;
            NetObjectList <Item> itemList = GetItemList();

            if (itemList.Any(i => i.ParentSheetIndex.Equals(item.ParentSheetIndex)))
            {
                foreach (Item i in itemList.ToList())
                {
                    if (i.ParentSheetIndex == item.ParentSheetIndex && i.canStackWith(item))
                    {
                        canStack = true;
                    }
                }
            }
            return(canStack);
        }
Beispiel #4
0
 private bool isExactItemInChest(Item sourceItem, NetObjectList <Item> items)
 {
     return(items.Any(item => item == sourceItem));
 }