示例#1
0
 /// <summary>
 /// Checks whether the player has an item.
 /// </summary>
 public static Func <int, bool> HasItem(int itemID, int quantity = 1)
 {
     return((b) =>
     {
         int slot = InstanceTracker.GameScript.ItemExistsSlot(itemID);
         return slot != -1 && GadgetCoreAPI.GetInventory()[slot].q >= quantity;
     });
 }
示例#2
0
 /// <summary>
 /// Takes an item from the player.
 /// </summary>
 public static Action TakeItem(int itemID, int quantity = 1)
 {
     return(() =>
     {
         int slot = InstanceTracker.GameScript.ItemExistsSlot(itemID);
         if (slot != -1 && GadgetCoreAPI.GetInventory()[slot].q >= quantity)
         {
             GadgetCoreAPI.GetInventory()[slot].q -= quantity;
             InstanceTracker.GameScript.RefreshSlot(slot);
         }
     });
 }