Method DropInto
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
DropInto(ItemBehaviour, InteractiveBehaviour)
Drops an item from inventory into another container like a chest or another character's inventory.
public bool DropInto(ItemBehaviour item, InteractiveBehaviour target)
Parameters
item
ItemBehaviourItem to drop
target
InteractiveBehaviourTarget object that can receive the item (chest, character, etc.)
Returns
- bool
True if the item was dropped into the target, false if still moving or the operation failed
Remarks
This method will move the hero to the target if necessary, then drop the item into it. Common targets include chests, stashes, or other characters.
var chest = FindNearestInteractive("Stash");
if (chest != null)
{
foreach(var healthPotion in Inventory.Where(item => IsHealthPotion(item)).ToList()) // ToList() creates a copy to avoid modifying the collection while iterating
{
if (DropInto(healthPotion, chest))
{
Say("Storing potion for later!");
}
}
}