Table of Contents

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 static bool DropInto(ItemBehaviour item, InteractiveBehaviour target)

Parameters

item ItemBehaviour

Item to drop

target InteractiveBehaviour

Target 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.

Store items in a chest:
var chest = Hero.FindNearestInteractive("Stash");
if (chest != null)
{
    foreach(var healthPotion in Hero.Inventory.Where(item => Hero.IsHealthPotion(item)).ToList()) // ToList() creates a copy to avoid modifying the collection while iterating
    {
        if (Hero.DropInto(healthPotion, chest))
        {
            Hero.Say("Storing potion for later!");
        }
    }
}