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

// If itemObjectUid is not null, only that object will be returned

// Single Attribute
public GameItemObject GetWithAttribute(ItemAttribute itemAttribute, string itemObjectUid = null)
public GameItemObject GetWithAttribute(GameItemAttribute gameItemAttribute, string itemObjectUid = null)
public GameItemObject GetWithAttribute(string itemAttributeUid, string itemObjectUid = null)

public bool TryGetWithAttribute(ItemAttribute itemAttribute, out GameItemObject found, string itemObjectUid = null) 
public bool TryGetWithAttribute(GameItemAttribute gameItemAttribute, out GameItemObject found, string itemObjectUid = null) 
public bool TryGetWithAttribute(string itemAttributeUid, out GameItemObject found, string itemObjectUid = null)

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

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

// Any Attribute
public GameItemObject GetWithAnyAttribute(IEnumerable<ItemAttribute> itemAttributes, string uid = null)
public GameItemObject GetWithAnyAttribute(IEnumerable<GameItemAttribute> gameItemAttributes, string uid = null)
public GameItemObject GetWithAnyAttribute(IEnumerable<string> itemAttributeUids, string uid = null)

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

// Example
var goldenSword = GetWithAttribute(goldenUid, swordUid);

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

// If there are multiple, this will return the first found
// If itemObjectUid is not null, only that object will be returned

// With no attributes
public GameItemObject GetWithNoAttributes(ItemObject itemObject) => GetWithNoAttributes(itemObject.Uid());
public GameItemObject GetWithNoAttributes(GameItemObject gameItemObject) => GetWithNoAttributes(gameItemObject.Uid());
public GameItemObject GetWithNoAttributes(string itemObjectUid = null) 

public bool TryGetWithNoAttributes(out GameItemObject found, ItemObject itemObject)
public bool TryGetWithNoAttributes(out GameItemObject found, GameItemObject gameItemObject)
public bool TryGetWithNoAttributes(out GameItemObject found, string itemObjectUid = null) 

// With more than X number of attributes
public GameItemObject GetWithMoreThanXAttributes(int amount, ItemObject itemObject)
public GameItemObject GetWithMoreThanXAttributes(int amount, GameItemObject gameItemObject)
public GameItemObject GetWithMoreThanXAttributes(int amount, string itemObjectUid = null) 

public bool TryGetWithMoreThanXAttributes(int x, out GameItemObject found, ItemObject itemObject)
public bool TryGetWithMoreThanXAttributes(int x, out GameItemObject found, GameItemObject gameItemObject)
public bool TryGetWithMoreThanXAttributes(int x, out GameItemObject found, string itemObjectUid = null)

// With less than X number of attributes
public GameItemObject GetWithLessThanXAttributes(int amount, ItemObject itemObject)
public GameItemObject GetWithLessThanXAttributes(int amount, GameItemObject gameItemObject)
public GameItemObject GetWithLessThanXAttributes(int amount, string itemObjectUid = null) 

public bool TryGetWithLessThanXAttributes(int x, out GameItemObject found, ItemObject itemObject)
public bool TryGetWithLessThanXAttributes(int x, out GameItemObject found, GameItemObject gameItemObject)
public bool TryGetWithLessThanXAttributes(int x, out GameItemObject found, string itemObjectUid = null) 

// With exactly X number of attributes
public GameItemObject GetWithExactlyXAttributes(int amount, ItemObject itemObject)
public GameItemObject GetWithExactlyXAttributes(int amount, GameItemObject gameItemObject)
public GameItemObject GetWithExactlyXAttributes(int amount, string itemObjectUid = null) 

public bool TryGetWithExactlyXAttributes(int amount, out GameItemObject found, ItemObject itemObject)
public bool TryGetWithExactlyXAttributes(int amount, out GameItemObject found, GameItemObject gameItemObject)
public bool TryGetWithExactlyXAttributes(int amount, out GameItemObject found, string itemObjectUid = null) 

// Example
if (GetWithMoreThanXAttributes(3, out var found))
    Debug.Log($"We found {found.ObjectName()} which has at least 4 attributes!");

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

// If itemObjectUid is not null, only that object will be returned

// With no attributes
public IEnumerable<GameItemObject> GetAllWithNoAttributes(ItemObject itemObject)
public IEnumerable<GameItemObject> GetAllWithNoAttributes(GameItemObject gameItemObject)
public IEnumerable<GameItemObject> GetAllWithNoAttributes(string itemObjectUid = null) 

public bool TryGetAllWithNoAttributes(out IEnumerable<GameItemObject> found, ItemObject itemObject)
public bool TryGetAllWithNoAttributes(out IEnumerable<GameItemObject> found, GameItemObject gameItemObject)
public bool TryGetAllWithNoAttributes(out IEnumerable<GameItemObject> found, string itemObjectUid = null) 

// With more than X number of attributes
public IEnumerable<GameItemObject> GetAllWithMoreThanXAttributes(int amount, ItemObject itemObject)
public IEnumerable<GameItemObject> GetAllWithMoreThanXAttributes(int amount, GameItemObject gameItemObject) 
public IEnumerable<GameItemObject> GetAllWithMoreThanXAttributes(int amount, string itemObjectUid = null) 

public bool TryGetAllWithMoreThanXAttributes(int x, out IEnumerable<GameItemObject> found, ItemObject itemObject)
public bool TryGetAllWithMoreThanXAttributes(int x, out IEnumerable<GameItemObject> found, GameItemObject gameItemObject)
public bool TryGetAllWithMoreThanXAttributes(int x, out IEnumerable<GameItemObject> found, string itemObjectUid = null) 

// With less than X number of attributes
public IEnumerable<GameItemObject> GetAllWithLessThanXAttributes(int amount, ItemObject itemObject)
public IEnumerable<GameItemObject> GetAllWithLessThanXAttributes(int amount, GameItemObject gameItemObject)
public IEnumerable<GameItemObject> GetAllWithLessThanXAttributes(int amount, string itemObjectUid = null)

public bool TryGetAllWithLessThanXAttributes(int x, out IEnumerable<GameItemObject> found, ItemObject itemObject)
public bool TryGetAllWithLessThanXAttributes(int x, out IEnumerable<GameItemObject> found, GameItemObject gameItemObject)
public bool TryGetAllWithLessThanXAttributes(int x, out IEnumerable<GameItemObject> found, string itemObjectUid = null) 

// With exactly X number of attributes
public IEnumerable<GameItemObject> GetAllWithExactlyXAttributes(int amount, ItemObject itemObject)
public IEnumerable<GameItemObject> GetAllWithExactlyXAttributes(int amount, GameItemObject gameItemObject)
public IEnumerable<GameItemObject> GetAllWithExactlyXAttributes(int amount, string itemObjectUid = null)

public bool TryGetAllWithExactlyXAttributes(int amount, out IEnumerable<GameItemObject> found, ItemObject itemObject)
public bool TryGetAllWithExactlyXAttributes(int amount, out IEnumerable<GameItemObject> found, GameItemObject gameItemObject)
public bool TryGetAllWithExactlyXAttributes(int amount, out IEnumerable<GameItemObject> found, string itemObjectUid = null) 

// Example
if (TryGetAllWithExactlyXAttributes(1, out var found, leatherHelmetUid))
    AddRandomAttribute(found); // Adds a random attribute to all GameItemObjects in the list

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.

public IEnumerable<GameItemObject> GetDuplicates(ItemObject itemObject, bool includeItemAttributes = false)
public IEnumerable<GameItemObject> GetDuplicates(GameItemObject gameItemObject, bool includeItemAttributes = false)
public IEnumerable<GameItemObject> GetDuplicates(string itemObjectUid = null, bool includeItemAttributes = false)

// Only check a specific set of ItemObjects
public IEnumerable<GameItemObject> GetDuplicates(IEnumerable<ItemObject> itemObjects, bool includeItemAttributes = false)
public IEnumerable<GameItemObject> GetDuplicates(IEnumerable<GameItemObject> gameItemObjects, bool includeItemAttributes = false)
public IEnumerable<GameItemObject> GetDuplicates(IEnumerable<string> itemObjectUids, bool includeItemAttributes = false)

Last updated