Quasilocal quantities for general relativity and other gravity theories