本文整理汇总了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;
}
示例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;
}
示例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);
}