示例#1
0
 public void AddItem(InventoryItemWrapper A)
 {
     if (A == null)
     {
         return;
     }
     Debug.Assert(canAddWeight(A.Weight), "ADDED MORE WEIGHT THAN COULD CARRY!");
     TotalWeight += A.Weight;
     if (A.GetStackable() && !A.isUniqueInstance())
     {
         foreach (ItemStack B in myInventoryItems)
         {
             if (B.hasItemData(A.GetItemData()))
             {
                 B.AddItem(A);
                 return;
             }
         }
     }
     else
     {
         ItemStack myNewStack = new ItemStack();
         myNewStack.AddItem(A);
         myInventoryItems.Add(myNewStack);
     }
     SortItems();
 }
示例#2
0
 public bool hasItemInQuantity(InventoryItemWrapper plantItem, int v)
 {
     return(GetItemAmount(plantItem.GetItemData()) >= v);
 }