[TW342] remove repeated code and clean it up a bit
Merge branch 'master' of https://github.com/TrueWoW/TrinityCore