private static function CalculateTalentsBuild()
 {
     if (!self::IsCorrect()) {
         WoW_Log::WriteError('%s : character was not found.', __METHOD__);
         return false;
     }
     $build_tree = array(1 => null, 2 => null);
     $tab_class = self::GetTalentTabForClass();
     if (!$tab_class) {
         return false;
     }
     $specs_talents = array();
     $character_talents = self::$talents;
     $talent_data = array(0 => null, 1 => null);
     // Talent build
     if (!$character_talents) {
         WoW_Log::WriteError('%s : unable to get talent data for character %s (GUID: %d)!', __METHOD__, self::GetName(), self::GetGUID());
         return false;
     }
     foreach ($character_talents as $_tal) {
         if (self::GetServerType() == SERVER_MANGOS) {
             $specs_talents[$_tal['spec']][$_tal['talent_id']] = $_tal['current_rank'] + 1;
         } elseif (self::GetServerType() == SERVER_TRINITY) {
             $specs_talents[$_tal['spec']][$_tal['spell']] = true;
         } else {
             WoW_Log::WriteError('%s : wrong server type (%d)!', __METHOD__, self::GetServerType());
             return false;
         }
     }
     switch (self::GetServerType()) {
         case SERVER_TRINITY:
             for ($i = 0; $i < 3; $i++) {
                 $current_tab = DB::WoW()->select("SELECT * FROM `DBPREFIX_talents` WHERE `TalentTab` = %d ORDER BY `TalentTab`, `Row`, `Col`", $tab_class[$i]);
                 if (!$current_tab) {
                     continue;
                 }
                 foreach ($current_tab as $tab) {
                     for ($j = 0; $j < 2; $j++) {
                         if (isset($specs_talents[$j][$tab['Rank_5']])) {
                             $talent_data[$j] .= 5;
                         } elseif (isset($specs_talents[$j][$tab['Rank_4']])) {
                             $talent_data[$j] .= 4;
                         } elseif (isset($specs_talents[$j][$tab['Rank_3']])) {
                             $talent_data[$j] .= 3;
                         } elseif (isset($specs_talents[$j][$tab['Rank_2']])) {
                             $talent_data[$j] .= 2;
                         } elseif (isset($specs_talents[$j][$tab['Rank_1']])) {
                             $talent_data[$j] .= 1;
                         } else {
                             $talent_data[$j] .= 0;
                         }
                     }
                 }
             }
             break;
         case SERVER_MANGOS:
             for ($i = 0; $i < 3; $i++) {
                 if (!isset($tab_class[$i])) {
                     continue;
                 }
                 $current_tab = DB::WoW()->select("SELECT * FROM `DBPREFIX_talents` WHERE `TalentTab` = %d ORDER BY `TalentTab`, `Row`, `Col`", $tab_class[$i]);
                 if (!$current_tab) {
                     continue;
                 }
                 foreach ($current_tab as $tab) {
                     for ($j = 0; $j < 2; $j++) {
                         if (isset($specs_talents[$j][$tab['TalentID']])) {
                             $talent_data[$j] .= $specs_talents[$j][$tab['TalentID']];
                         } else {
                             $talent_data[$j] .= 0;
                         }
                     }
                 }
             }
             break;
         default:
             WoW_Log::WriteError('%s : wrong server type (%d)!', __METHOD__, self::GetServerType());
             return false;
             break;
     }
     self::$talent_build = $talent_data;
 }