当前位置: 首页>>代码示例>>PHP>>正文


PHP WoW::GetServerType方法代码示例

本文整理汇总了PHP中WoW::GetServerType方法的典型用法代码示例。如果您正苦于以下问题:PHP WoW::GetServerType方法的具体用法?PHP WoW::GetServerType怎么用?PHP WoW::GetServerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WoW的用法示例。


在下文中一共展示了WoW::GetServerType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetTopTeams

 public function GetTopTeams($format, $bg_id, $limit = 3, $offset = 0, $count = false)
 {
     if (!isset(WoWConfig::$BattleGroups[$bg_id])) {
         WoW_Log::WriteError('%s : battleGroupd #%d was not found!', __METHOD__, $bg_id);
         return false;
     }
     $realms = WoWConfig::$BattleGroups[$bg_id]['realms'];
     if (!$realms) {
         WoW_Log::WriteError('%s : no realms found for battleGroup #%d, using first available bg instead.', __METHOD__, $bg_id);
         $realms = WoWConfig::$BattleGroups[1]['realms'];
         if (!$realms) {
             WoW_Log::WriteError('%s : default BG has no realms, unable to continue.', __METHOD__);
             return false;
         }
     }
     $top_teams_data = array();
     $counter = 0;
     foreach ($realms as $realmId) {
         DB::ConnectToDB(DB_CHARACTERS, $realmId);
         if (!DB::Characters()->TestLink()) {
             continue;
         }
         if (WoW::GetServerType($realmId) == SERVER_MANGOS) {
             if ($count) {
                 $counter += DB::Characters()->selectCell("\n                    SELECT COUNT(*)\n                    FROM `arena_team` AS `a`\n                    LEFT JOIN `arena_team_stats` AS `b` ON `b`.`arenateamid` = `a`.`arenateamid`\n                    WHERE `a`.`type` = %d\n                    AND `b`.`rank` > 0 AND `b`.`rank` < 4", $format);
                 continue;
             }
             $teams = DB::Characters()->select("SELECT\n                `a`.`arenateamid` AS `id`,\n                `a`.`rank`,\n                `a`.`rating`,\n                '%d' AS `realmId`,\n                `b`.`type`\n                FROM `arena_team_stats` AS `a`\n                LEFT JOIN `arena_team` AS `b` ON `b`.`arenateamid` = `a`.`arenateamid`\n                WHERE `a`.`rank` > 0 AND `a`.`rank` < 4 AND `b`.`type` = %d ORDER BY `rank`, `rating` LIMIT %d, %d", $realmId, $format, $offset, $limit);
         } else {
             $teams = DB::Characters()->select("SELECT `arenaTeamId` AS `id`, `rank`, `rating`, '%d' AS `realmId`, `type` FROM `arena_team` WHERE `rank` > 0 AND `rank` < 4 AND `type` = %d ORDER BY `rank`, `rating` LIMIT %d, %d", $realmId, $format, $offset, $limit);
         }
         if (!$teams) {
             continue;
         }
         $top_teams_data[] = array('realmId' => $realmId, 'teamsId' => $teams);
     }
     if ($count) {
         return $counter;
     }
     // Find top 3 teams
     $top_teams = array();
     foreach ($top_teams_data as &$teams) {
         foreach ($teams['teamsId'] as &$team) {
             if (!isset($top_teams[$team['rank']])) {
                 $top_teams[$team['rank']] = $team;
             }
             if ($top_teams[$team['rank']]['rating'] < $team['rating']) {
                 $top_teams[$team['rank']] = $team;
             }
         }
     }
     // Create objects
     $top_teams_objects = array();
     foreach ($top_teams as &$team) {
         $top_teams_objects[] = new WoW_ArenaTeam($team['realmId'], '', $team['id']);
     }
     unset($top_teams, $top_teams_data, $team, $teams);
     return $top_teams_objects;
 }
开发者ID:GetPlay,项目名称:WorldOfWarCraft-WebSite,代码行数:59,代码来源:class.arena.php

示例2: LoadTeam

 private function LoadTeam()
 {
     switch (WoW::GetServerType($this->m_realmId)) {
         case SERVER_MANGOS:
             $this->LoadMaNGOS();
             break;
         case SERVER_TRINITY:
             $this->LoadTrinity();
             break;
         default:
             WoW_Log::WriteError('%s : unknown realm type: %d (realm ID: %d)', __METHOD__, WoW::GetServerType($this->m_realmId), $this->m_realmId);
             return false;
     }
     $this->m_teamURL = sprintf('%s/wow/%s/arena/%s/%s/', WoW::GetWoWPath(), WoW_Locale::GetLocale(), $this->GetTeamRealmName(), $this->GetTeamName());
     return true;
 }
开发者ID:JunkyBulgaria,项目名称:WoWCS,代码行数:16,代码来源:class.arenateam.php

示例3: GetTopTeams

 public function GetTopTeams($format, $bg_id)
 {
     if (!isset(WoWConfig::$BattleGroups[$bg_id])) {
         WoW_Log::WriteError('%s : battleGroupd #%d was not found!', __METHOD__, $bg_id);
         return false;
     }
     $realms = WoWConfig::$BattleGroups[$bg_id]['realms'];
     if (!$realms) {
         WoW_Log::WriteError('%s : no realms found for battleGroup #%d, using first available bg instead.', __METHOD__, $bg_id);
         $realms = WoWConfig::$BattleGroups[1]['realms'];
         if (!$realms) {
             WoW_Log::WriteError('%s : default BG has no realms, unable to continue.', __METHOD__);
             return false;
         }
     }
     $top_teams_data = array();
     foreach ($realms as $realmId) {
         DB::ConnectToDB(DB_CHARACTERS, $realmId);
         if (!DB::Characters()->TestLink()) {
             continue;
         }
         $teams = DB::Characters()->select("SELECT `%s`, `rank`, `rating` FROM `arena_team` ORDER BY `rank` LIMIT 3", WoW::GetServerType($realmId) == SERVER_MANGOS ? 'arenateamid' : 'arenaTeamId');
         if (!$teams) {
             continue;
         }
         $top_teams_data[] = array('realmId' => $realmId, 'teamsId' => $teams);
     }
     // Find top 3 teams
     foreach ($top_teams_data as &$teams) {
         foreach ($teams['teamsId'] as &$team) {
             if (!isset($top_teams[$team['rank']])) {
                 $top_teams[$team['rank']] = $team;
             }
             if ($top_teams[$team['rank']]['rating'] < $team['rating']) {
                 $top_teams[$team['rank']] = $team;
             }
         }
     }
     print_r($top_teams);
 }
开发者ID:JunkyBulgaria,项目名称:WoWCS,代码行数:40,代码来源:class.arenateams.php


注:本文中的WoW::GetServerType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。