private static function LoadAchievements()
 {
     if (self::IsLoaded()) {
         return true;
     }
     self::$achievements_storage = DB::Characters()->select("SELECT * FROM `character_achievement` WHERE `guid` = %d ORDER BY `date` DESC", self::$guid);
     if (!self::$achievements_storage) {
         WoW_Log::WriteError('%s : achievements for character %s (GUID: %d) were not found!', __METHOD__, WoW_Characters::GetName(), WoW_Characters::GetGUID());
         return false;
     }
     self::$criterias_storage = DB::Characters()->select("SELECT * FROM `character_achievement_progress` WHERE `guid` = %d", self::$guid);
     if (!self::$criterias_storage) {
         WoW_Log::WriteError('%s : criterias for character %s (GUID: %d) were not found!', __METHOD__, WoW_Characters::GetName(), WoW_Characters::GetGUID());
     }
     self::$isAchievementsLoaded = true;
     return true;
 }
Exemplo n.º 2
0
 public function GetMember($guid = 0)
 {
     if ($guid == 0) {
         $guid = WoW_Characters::GetGUID();
     }
     if (isset($this->m_cacheMember[$guid])) {
         return $this->m_cacheMember[$guid];
     }
     foreach ($this->m_teamMembers as $member) {
         if ($member['guid'] == $guid) {
             $this->m_cacheMember[$guid] = $member;
             return $this->m_cacheMember[$guid];
         }
     }
     return null;
 }
Exemplo n.º 3
0
 public function main()
 {
     WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE));
     WoW_Template::SetTemplateTheme('wow');
     $url_data = WoW::GetUrlData('character');
     if (!$url_data) {
         WoW_Template::SetPageIndex('404');
         WoW_Template::SetPageData('page', '404');
         WoW_Template::SetPageData('errorProfile', 'template_404');
     } else {
         if ($url_data['action0'] == 'advanced') {
             // Set "wow.character.summary.view" cookie as "advanced"
             setcookie('wow.character.summary.view', 'advanced', strtotime('NEXT YEAR'), '/' . WoW::GetWoWPath() . '/character/');
         } elseif ($url_data['action0'] == null && (isset($url_data['name']) && isset($url_data['realmName']))) {
             WoW::RedirectToCorrectProfilePage('simple');
             //change to WoW::RedirectTo()?
         } elseif ($url_data['action0'] == 'simple') {
             // Set "wow.character.summary.view" cookie as "simple"
             setcookie('wow.character.summary.view', 'simple', strtotime('NEXT YEAR'), '/' . WoW::GetWoWPath() . '/character/');
         }
         $load_result = WoW_Characters::LoadCharacter($url_data['name'], WoW_Utils::GetRealmIDByName($url_data['realmName']), true, true);
         if (!WoW_Characters::IsCorrect() || $load_result != 3) {
             if ($url_data['action0'] == 'tooltip') {
                 exit;
             }
             if ($load_result == 2) {
                 WoW_Template::SetPageData('errorProfile', 'template_lowlevel');
             } else {
                 WoW_Template::SetPageData('errorProfile', 'template_404');
             }
             WoW_Template::SetPageIndex('404');
             WoW_Template::SetPageData('page', '404');
         } else {
             WoW_Achievements::Initialize();
             WoW_Template::SetPageData('characterName', WoW_Characters::GetName());
             WoW_Template::SetPageData('characterRealmName', WoW_Characters::GetRealmName());
             switch ($url_data['action0']) {
                 default:
                     WoW_Template::SetPageIndex('character_profile_simple');
                     WoW_Template::SetPageData('page', 'character_profile');
                     WoW_Characters::CalculateStats(true);
                     break;
                 case 'advanced':
                     WoW_Template::SetPageIndex('character_profile_advanced');
                     WoW_Template::SetPageData('page', 'character_profile');
                     WoW_Characters::CalculateStats(true);
                     break;
                     /*
                     case 'talent':
                         WoW_Template::SetPageIndex('character_talents');
                         WoW_Template::SetPageData('page', 'character_talents');
                         WoW_Template::SetPageData('talents', 'primary');
                         if($url_data['action1'] == 'secondary') {
                             WoW_Template::SetPageData('talents', 'secondary');
                         }
                         break;
                     */
                 /*
                 case 'talent':
                     WoW_Template::SetPageIndex('character_talents');
                     WoW_Template::SetPageData('page', 'character_talents');
                     WoW_Template::SetPageData('talents', 'primary');
                     if($url_data['action1'] == 'secondary') {
                         WoW_Template::SetPageData('talents', 'secondary');
                     }
                     break;
                 */
                 case 'tooltip':
                     WoW_Template::LoadTemplate('page_character_tooltip');
                     exit;
                     break;
                 case 'achievement':
                     for ($i = 2; $i > 0; $i--) {
                         if (isset($url_data['action' . $i]) && $url_data['action' . $i] != null) {
                             WoW_Achievements::SetCategoryForTemplate($url_data['action' . $i]);
                             WoW_Template::LoadTemplate('page_character_achievements');
                             exit;
                         }
                     }
                     WoW_Template::SetPageIndex('character_achievements');
                     WoW_Template::SetPageData('page', 'character_achievements');
                     break;
                 case 'reputation':
                     if (isset($url_data['action1']) && $url_data['action1'] == 'tabular') {
                         WoW_Template::SetPageIndex('character_reputation_tabular');
                     } else {
                         WoW_Template::SetPageIndex('character_reputation');
                     }
                     WoW_Template::SetPageData('page', 'character_reputation');
                     WoW_Reputation::InitReputation(WoW_Characters::GetGUID());
                     break;
                 case 'pvp':
                     WoW_Template::SetPageIndex('character_pvp');
                     WoW_Template::SetPageData('page', 'character_pvp');
                     WoW_Characters::InitPvP();
                     break;
                 case 'statistic':
                     for ($i = 2; $i > 0; $i--) {
                         if (isset($url_data['action' . $i]) && $url_data['action' . $i] != null) {
                             WoW_Achievements::SetCategoryForTemplate($url_data['action' . $i]);
                             WoW_Template::LoadTemplate('page_character_statistics');
                             exit;
                         }
                     }
                     WoW_Template::SetPageIndex('character_statistics');
                     WoW_Template::SetPageData('page', 'character_statistics');
                     break;
                 case 'feed':
                     WoW_Template::SetPageIndex('character_feed');
                     WoW_Template::SetPageData('page', 'character_feed');
                     break;
                 case 'companion':
                 case 'mount':
                     WoW_Template::SetPageIndex('character_companions_mounts');
                     WoW_Template::SetPageData('page', 'character_companions_mounts');
                     WoW_Template::SetPageData('category', $url_data['action0']);
                     WoW_Characters::InitMounts();
                     break;
             }
         }
     }
     WoW_Template::SetMenuIndex('menu-game');
     WoW_Template::LoadTemplate('page_index');
 }
 private static function LoadPlayerStats()
 {
     if (!WoW_Characters::IsCorrect()) {
         WoW_Log::WriteError('%s : character was not found!', __METHOD__);
         return false;
     }
     self::$player_stats = DB::Characters()->selectRow("SELECT * FROM `character_stats` WHERE `guid` = %d", WoW_Characters::GetGUID());
     if (!self::$player_stats) {
         WoW_Log::WriteError('%s : unable to find player stats for player %s (GUID: %d)!', __METHOD__, WoW_Characters::GetName(), WoW_Characters::GetGUID());
         return false;
     }
     self::$stats_loaded = true;
     return true;
 }