GameItemObjectList Contains() Methods

v4.0

Contains amounts of a group of GameItemObjects, optionally distinct

// Most of these have an optional bool distinct parameter, false by default. When true
// the comparison will only count one GameItemObject of each uid. No differentiation 
// will be made for GameItemObjects of the same uid with different ItemAttributes

// Contains > X ItemObjects
public bool ContainsMoreThanXItemObjects(int amount, IEnumerable<ItemObject> itemObjects, bool distinct = false)
public bool ContainsMoreThanXItemObjects(int amount, IEnumerable<GameItemObject> gameItemObjects, bool distinct = false)
public bool ContainsMoreThanXItemObjects(int amount, IEnumerable<string> itemObjectUids, bool distinct = false) 

// Contains < X ItemObjects
public bool ContainsLessThanXItemObjects(int amount, IEnumerable<ItemObject> itemObjects, bool distinct = false)
public bool ContainsLessThanXItemObjects(int amount, IEnumerable<GameItemObject> gameItemObjects, bool distinct = false)
public bool ContainsLessThanXItemObjects(int amount, IEnumerable<string> itemObjectUids, bool distinct = false) 

// Contains exactly X ItemObjects
public bool ContainsExactlyXItemObjects(int amount, IEnumerable<ItemObject> itemObjects, bool distinct = false)
public bool ContainsExactlyXItemObjects(int amount, IEnumerable<GameItemObject> gameItemObjects, bool distinct = false)
public bool ContainsExactlyXItemObjects(int amount, IEnumerable<string> itemObjectUids, bool distinct = false)

// Contains any of the ItemObjects [No distinct option]
public bool ContainsAnyItemObjects(IEnumerable<ItemObject> itemObjects, bool distinct = false)
public bool ContainsAnyItemObjects(IEnumerable<GameItemObject> gameItemObjects, bool distinct = false)
public bool ContainsAnyItemObjects(IEnumerable<string> itemObjectUids, bool distinct = false)

// Contains all of the ItemObjects
public bool ContainsAllItemObjects(IEnumerable<ItemObject> itemObjects, bool distinct = false)
public bool ContainsAllItemObjects(IEnumerable<GameItemObject> gameItemObjects, bool distinct = false)
public bool ContainsAllItemObjects(IEnumerable<string> itemObjectUids, bool distinct = false) 

// Contains none of the ItemObjets [No distinct option]
public bool ContainsNoItemObjects(IEnumerable<ItemObject> itemObjects, bool distinct = false)
public bool ContainsNoItemObjects(IEnumerable<GameItemObject> gameItemObjects, bool distinct = false)
public bool ContainsNoItemObjects(IEnumerable<string> itemObjectUids, bool distinct = false) 

// Example
ItemObject[] itemObjects = new[] { WhistleBerry, Lemon, Cranberries };
if (gameItemObjectList.ContainsAllItemObjects(itemObjects))
    MakeCranberryCocktail();

Contains a GameItemObject with Attribute(s)

// If itemObjectUid is provided, then only that itemObject will be checked

// Contains a GameItemObject with a specific ItemAttribute
public bool ContainsWithAttribute(ItemAttribute attribute, string itemObjectUid = null)
public bool ContainsWithAttribute(GameItemAttribute gameAttribute, string itemObjectUid = null)
public bool ContainsWithAttribute(string attributeUid, string itemObjectUid = null)

// Contains a GameItemObject with all of the provided ItemAttributes
public bool ContainsWithAllAttributes(IEnumerable<ItemAttribute> attributes, string itemObjectUid = null)
public bool ContainsWithAllAttributes(IEnumerable<GameItemAttribute> gameAttributes, string itemObjectUid = null)
public bool ContainsWithAllAttributes(IEnumerable<string> attributeUids, string itemObjectUid = null)

// Contains a GameItemObject with ANY of the provided ItemAttributes
public bool ContainsWithAnyAttributes(IEnumerable<ItemAttribute> attributes, string itemObjectUid = null)
public bool ContainsWithAnyAttributes(IEnumerable<GameItemAttribute> gameAttributes, string itemObjectUid = null)
public bool ContainsWithAnyAttributes(IEnumerable<string> attributeUids, string itemObjectUid = null)

// Contains a GameItemObject with Exactly X ItemAttributes
public bool ContainsWithExactlyXAttributes(int amount, ItemObject itemObject)
public bool ContainsWithExactlyXAttributes(int amount, GameItemObject gameItemObject)
public bool ContainsWithExactlyXAttributes(int amount, string itemObjectUid = null)

// Contains a GameItemObject with Less than X ItemAttributes
public bool ContainsWithLessThanXAttributes(int amount, ItemObject itemObject) 
public bool ContainsWithLessThanXAttributes(int amount, GameItemObject gameItemObject)
public bool ContainsWithLessThanXAttributes(int amount, string itemObjectUid = null)

// Contains a GameItemObject with more than X ItemAttributes
public bool ContainsWithMoreThanXAttributes(int amount, ItemObject itemObject)
public bool ContainsWithMoreThanXAttributes(int amount, GameItemObject gameItemObject)
public bool ContainsWithMoreThanXAttributes(int amount, string itemObjectUid = null)

// Contains a GameItemObject with no ItemAttributes
public bool ContainsWithNoAttributes(ItemObject itemObject)
public bool ContainsWithNoAttributes(GameItemObject gameItemObject)
public bool ContainsWithNoAttributes(string itemObjectUid = null)

Contains a GameItemObject with Attribute(s)

// If itemObjectUid is provided, then only that itemObject will be checked

// Contains exactly X GameItemObjects
public bool ContainsExactlyXItemObjects(int amount, ItemObject itemObject)
public bool ContainsExactlyXItemObjects(int amount, GameItemObject gameItemObject)
public bool ContainsExactlyXItemObjects(int amount, string itemObjectUid = null)

// Contains less than X GameItemObjects
public bool ContainsLessThanXItemObjects(int amount, ItemObject itemObject)
public bool ContainsLessThanXItemObjects(int amount, GameItemObject gameItemObject)
public bool ContainsLessThanXItemObjects(int amount, string itemObjectUid = null)

// Contains more than X GameItemObjects
public bool ContainsMoreThanXItemObjects(int amount, ItemObject itemObject)
public bool ContainsMoreThanXItemObjects(int amount, GameItemObject gameItemObject)
public bool ContainsMoreThanXItemObjects(int amount, string itemObjectUid = null)

// Is Empty
public bool IsEmpty()

Contains a ItemAttribute (anywhere in any item)

public bool ContainsAttribute(ItemAttribute itemAttribute)
public bool ContainsAttribute(GameItemAttribute gameItemAttribute)
public bool ContainsAttribute(string uid)

Contains by status

Find out if the list contains quests of a specific status, optionally of a specific uid.

public bool ContainsQuestsInProgress(string uid = null)
public bool ContainsQuestsSucceeded(string uid = null)
public bool ContainsQuestsFailed(string uid = null)
public bool ContainsQuestsCompleted(string uid = null)

// Example
if (gameQuestList.ContainsQuestsFailed())
    Debug.Log("At some point, we have failed in our quest!");

// Each of the above also has a version that accepts a Quest or GameQuest instead
// of the uid.
public bool ContainsQuestsFailed(Quest quest)
public bool ContainsQuestsFailed(GameQuest gameQuest)

Contains quests which affect stats

GameQuests can modify Stats while they are in any of their states.

public bool ContainsQuestsWhichModifyStats()

// Example
if (ContainsQuestsWhichModifyStats())
    Debug.Log("At least one quest may be modifying Stats");

Contains Duplicates

These methods will return true if there are duplicates. The single-object methods have an optional itemObjectUid, when null, will return true if there are any duplicates in the 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 bool ContainsDuplicates(ItemObject itemObject, bool includeItemAttributes = false)
public bool ContainsDuplicates(GameItemObject gameItemObject, bool includeItemAttributes = false)
public bool ContainsDuplicates(string itemObjectUid = null, bool includeItemAttributes = false)

// Specify a group of ItemObjects to check against
public bool ContainsDuplicates(IEnumerable<ItemObject> itemObjects, bool includeItemAttributes = false)
public bool ContainsDuplicates(IEnumerable<GameItemObject> gameItemObjects, bool includeItemAttributes = false)
public bool ContainsDuplicates(IEnumerable<string> itemObjectUids, bool includeItemAttributes = false)

// Examples
if (ContainsDuplicates())
    RemoveDuplicates();
    
ItemObject[] itemObjects = new[] { Sword, Shield, Helmet };
if (ContainsDuplicates(itemObjects, true))
    RemoveDuplicates(itemObjects, true);

Additional Contains Methods

// True if at least one ItemObject is a Quest Item
public bool ContainsQuestItem()

Last updated