AutoSelect() public method

public AutoSelect ( int i, int j, Item item ) : bool
i int
j int
item Item
return bool
Beispiel #1
0
        public static int AutoSelect(int i, int j, Player player)
        {
            if (!Main.tile[i, j].active())
            {
                return(-1);
            }
            int     type    = Main.tile[i, j].type;
            ModTile modTile = GetTile(type);

            for (int k = 0; k < 50; k++)
            {
                Item item = player.inventory[k];
                if (item.type == 0 || item.stack == 0)
                {
                    continue;
                }
                if (modTile != null && modTile.AutoSelect(i, j, item))
                {
                    return(k);
                }
                foreach (var hook in HookAutoSelect)
                {
                    if (hook(i, j, type, item))
                    {
                        return(k);
                    }
                }
            }
            return(-1);
        }