cast user.items[type] to int, this was the "not enough gp" bug