Core/Misc: Remove unsafe not thread-safe localtime() calls

Replace not thread-safe localtime() calls with thread-safe localtime_r().
Core/Misc: fixed a scenario when character factionchange create unexpected results, also moved packet generating code into unique methods

(Packet structure not verificated to 6.0.2)
Merge pull request #1 from TrinityCore/6.x

merge