2 using System.Collections.Generic;
14 public static bool IsModifierRollableItem(
this Item item) => item.maxStack == 1 && item.
IsWeapon() || item.IsAccessory() || item.IsArmor();
15 public static bool IsWeapon(
this Item item) => item.damage > 0;
16 public static bool IsAccessory(
this Item item) => item.accessory && !item.vanity;
17 public static bool IsArmor(
this Item item) => (item.headSlot >= 0 || item.bodySlot >= 0 || item.legSlot >= 0) && !item.vanity;
19 public static IEnumerable<T> GetDistinctModItems<T>(
this Item[] inventory) where T :
ModItem 24 .Select(g => (T)g.First().modItem);
26 public static int CountModItemStack<T>(
this Item[] inventory,
bool includeMouseItem =
false) where T :
ModItem 27 => CountItemStack(inventory, includeMouseItem, item => item.modItem is T);
29 public static int CountItemStack(
this Item[] inventory,
int type,
bool includeMouseItem =
false)
30 => CountItemStack(inventory, includeMouseItem, item => item.type == type);
32 public static int CountItemStack(
this Item[] inventory,
bool includeMouseItem, Func<Item, bool> predicate)
34 int size = includeMouseItem ? 59 : 58;
35 return Main.LocalPlayer.inventory.Take(size)
static bool IsWeapon(this Item item)
static int CountItemStack(this Item[] inventory, bool includeMouseItem, Func< Item, bool > predicate)
Defines a set of utility methods for Item class