refactorings in player, and fixed a bug when buying tool