Overhauled automatic attribute allocation logic (Shared)

habitrpg-shared side of [this Web HabitRPG pull request](https://github.com/HabitRPG/habitrpg/pull/2219). See there for details.