Table of Contents

Method FindItemsOnGround

Namespace
GrindFest
Assembly
GrindFest.dll

FindItemsOnGround(string, string, string, float)

Returns a list of all items on the ground within range that match the specified name criteria.

public IReadOnlyList<ItemBehaviour> FindItemsOnGround(string name1 = "", string name2 = null, string name3 = null, float maxDistance = 15)

Parameters

name1 string

Primary name to search for. Item name must contain this string. If empty, matches any name.

name2 string

Optional secondary name to search for. If provided, item name must contain either this or name1.

name3 string

Optional tertiary name to search for. If provided, item name must contain either this, name2, or name1.

maxDistance float

Maximum search distance from the hero. Defaults to 15 units.

Returns

IReadOnlyList<ItemBehaviour>

A read-only list of all matching ItemBehaviour objects found on the ground.

Remarks

This method searches for multiple items in a box-shaped area around the hero. Items must meet these criteria:

  • Within the specified maxDistance
  • Not already in an inventory
  • Not currently equipped
  • Not being carried by a player
  • Reachable by the hero's navigation system

Unlike FindNearestItem(string, string, string, float), this method returns all matching items rather than just the closest one. This is useful for:

  • Mass item collection
  • Equipment comparison
  • Resource gathering
  • Inventory management
Find and collect all gold on the ground:
foreach (var item in FindItemsOnGround("Gold"))
{
    PickUp(item);
    Say($"Found gold worth {item.Gold.Amount}!");
}
Find the best weapon by comparing damage:
var bestWeapon = FindItemsOnGround()
    .Where(item => item.Weapon != null)
    .OrderByDescending(item => item.Weapon.MaxDamage)
    .FirstOrDefault();

if (bestWeapon != null) { Equip(bestWeapon); Say($"Found {bestWeapon.name} with {bestWeapon.Weapon.MaxDamage} damage!"); }

Collect multiple types of items:
// Find all health or mana potions
foreach (var item in FindItemsOnGround("Vial of Health", "Vial of Mana"))
{
    PickUp(item);
    Say($"Picked up a {item.name}");
}