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
stringPrimary name to search for. Item name must contain this string. If empty, matches any name.
name2
stringOptional secondary name to search for. If provided, item name must contain either this or name1.
name3
stringOptional tertiary name to search for. If provided, item name must contain either this, name2, or name1.
maxDistance
floatMaximum 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
foreach (var item in FindItemsOnGround("Gold"))
{
PickUp(item);
Say($"Found gold worth {item.Gold.Amount}!");
}
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!");
}
// 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}");
}