GameItemObjectList Get() Methods

v4.0

Get an IEnumerable<GameItemObject> group of GameItemObjects of a specific uid, ItemObject, or GameItemObject

public IEnumerable<GameItemObject> GetAll(ItemObject itemObject)
public IEnumerable<GameItemObject> GetAll(GameItemObject gameItemObject)
public IEnumerable<GameItemObject> GetAll(string uid)

// Example
List<GameItemObject> allShortSwords = GetAll(shortSwordUid).ToList();

Get an IEnumerable<GameItemObject> group of GameItemObjects which have a specific ItemAttribute, all from a group of ItemAttributes, or any from a group of ItemAttributes

// If itemObjectUid is not null, only those objects will be returned

// Single Attribute
public IEnumerable<GameItemObject> GetAllWithAttribute(GameItemAttribute gameItemAttribute, string itemObjectUid = null) 
public IEnumerable<GameItemObject> GetAllWithAttribute(ItemAttribute itemAttribute, string itemObjectUid = null) 
public IEnumerable<GameItemObject> GetAllWithAttribute(string itemAttributeUid, string itemObjectUid = null) 

public bool TryGetAllWithAttribute(GameItemAttribute gameItemAttribute, out IEnumerable<GameItemObject> found, string itemObjectUid = null) 
public bool TryGetAllWithAttribute(ItemAttribute itemAttribute, out IEnumerable<GameItemObject> found, string itemObjectUid = null) 
public bool TryGetAllWithAttribute(string itemAttributeUid, out IEnumerable<GameItemObject> found, string itemObjectUid = null) 

// All Attributes
public IEnumerable<GameItemObject> GetAllWithAttributes(IEnumerable<ItemAttribute> itemAttributes, string itemObjectUid = null)
public IEnumerable<GameItemObject> GetAllWithAttributes(IEnumerable<GameItemAttribute> gameItemAttributes, string itemObjectUid = null)
public IEnumerable<GameItemObject> GetAllWithAttributes(IEnumerable<string> itemAttributeUids, string itemObjectUid = null)

public bool TryGetAllWithAttributes(IEnumerable<ItemAttribute> itemAttributes, out IEnumerable<GameItemObject> found, string itemObjectUid = null)
public bool TryGetAllWithAttributes(IEnumerable<GameItemAttribute> gameItemAttributes, out IEnumerable<GameItemObject> found, string itemObjectUid = null)
public bool TryGetAllWithAttributes(IEnumerable<string> itemAttributeUids, out IEnumerable<GameItemObject> found, string itemObjectUid = null) 

// Any Attributes
public IEnumerable<GameItemObject> GetAllWithAnyAttribute(IEnumerable<ItemAttribute> itemAttributes, string itemObjectUid = null)
public IEnumerable<GameItemObject> GetAllWithAnyAttribute(IEnumerable<GameItemAttribute> gameItemAttributes, string itemObjectUid = null)
public IEnumerable<GameItemObject> GetAllWithAnyAttribute(IEnumerable<string> itemAttributeUids, string itemObjectUid = null) 

public bool TryGetAllWithAnyAttribute(IEnumerable<ItemAttribute> itemAttributes, out IEnumerable<GameItemObject> found, string itemObjectUid = null)
public bool TryGetAllWithAnyAttribute(IEnumerable<GameItemAttribute> gameItemAttributes, out IEnumerable<GameItemObject> found, string itemObjectUid = null)
public bool TryGetAllWithAnyAttribute(IEnumerable<string> itemAttributeUids, out IEnumerable<GameItemObject> found, string itemObjectUid = null)

// Examples
List<GameItemObject> allRareItems = GetAllWithAttribute(rareUid).ToList();

var itemAttributUids = new[] { "rareUid", "epicUid", "legendaryUid" };
if (!TryGetAllWithAnyAttribute(itemAttributeUids, out var foundItems, simpleStaffUid)
    Debug.Log("Did not find a Simple Staff with special rarity");
else
    Debug.Log($"We found {foundItems.Count} Simple Staffs that are rare or better");

Get a GameItemObject with a specific ItemAttribute, all of a group, or any of a group of ItemAttributes

Get a single GameItemObject based on the number of ItemAttributes it contains

Get an IEnumerable<GameItemObject> group of GameItemObjects based on the number of ItemAttributes it contains

Get duplicates

These methods will get any duplicates. The single-object methods have an optional itemObjectUid, when null, will get any duplicate in the entire list.

There is also an optional bool includeItemAttributes, which is false by default. When true, a GameItemObject must match both its Uid() and its list of ItemAttributes to qualify as a duplicate.

Last updated

Was this helpful?