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


PHP Team::getLevel方法代码示例

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


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

示例1: detectChanceOfWin

 public static function detectChanceOfWin(Team $userTeam, Team $enemyTeam)
 {
     $userSumParameters = $userTeam->getParameterSum();
     $enemySumParameters = $userTeam->getParameterSum();
     if ($userSumParameters == 0 || $enemySumParameters == 0) {
         return 1;
     }
     /*   if($userSumParameters >= $enemySumParameters){
              return 1;
          }*/
     $max = max($userSumParameters, $enemySumParameters);
     $min = min($userSumParameters, $enemySumParameters);
     $percent = $min * 100 / $max;
     if ($percent < 90) {
         if ($userSumParameters > $enemySumParameters) {
             return 1;
         } else {
             return -1;
         }
     }
     $rand = mt_rand(0, 99);
     $SumParameters = $enemySumParameters + $userSumParameters;
     if ($SumParameters == 0) {
         $SumParameters = 100;
     }
     $userPercentParameters = floor($userSumParameters * 100 / $SumParameters);
     if ($userTeam->getLevel() < 3) {
         $userPercentParameters += 35;
     } elseif ($userTeam->getLevel() < 6) {
         $userPercentParameters += 30;
     } elseif ($userTeam->getLevel() < 9) {
         $userPercentParameters += 25;
     }
     if ($userPercentParameters - GlobalParameters::DETECT_RESULT_FOR_TIE < $rand && $userPercentParameters + GlobalParameters::DETECT_RESULT_FOR_TIE > $rand) {
         // стоит подумать о ничье
         $score = rand(1, 2) - 1;
     } elseif ($rand <= $userPercentParameters) {
         // С учётом коефициента на ничью
         $score = 1;
     } else {
         $score = -1;
     }
     return $score;
 }
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:44,代码来源:Utils.php

示例2: team

 public static function team(Team $team)
 {
     $forJSON = array("level" => $team->getLevel(), "experience" => $team->getExperience(), "money" => $team->getMoney(), "realMoney" => $team->getRealMoney(), "studyPoints" => $team->getStudyPoints(), "energy" => $team->getCurrentEnergy(), "energyMax" => floor($team->getEnergyMax()), "trainerId" => $team->getTrainerId(), "teamName" => $team->getTeamName(), "teamLogoId" => $team->getTeamLogoId(), "paramForward" => $team->getParameterForward(), "paramHalf" => $team->getParameterHalf(), "paramSafe" => $team->getParameterSafe(), "isInstalled" => $team->getIsInstalled(), "socialUserId" => $team->getSocialUserId(), "userPhoto" => $team->getUserPhoto(), "userName" => $team->getUserName(), "isInTeam" => $team->getIsInTeam(), "studyPointsViaPrize" => $team->getStudyPointsViaPrize(), "inGroup" => $team->getInGroup(), "counterChoose" => $team->getCounterChoose(), "counterWon" => $team->getCounterWon(), "counterLose" => $team->getCounterLose(), "stadiumId" => $team->getStadiumId(), "needDailyBonus" => $team->isNeedDailyBonus(), "placeCountry" => $team->getPlaceCountry(), "placeCity" => $team->getPlaceCity(), "placeUniversity" => $team->getPlaceUniversity(), "placeVK" => $team->getPlaceVK(), "tourIIIcounter" => $team->getTourIII(), "tourPlaceCountry" => $team->getTourPlaceCountry(), "tourPlaceCity" => $team->getTourPlaceCity(), "tourPlaceUniversity" => $team->getTourPlaceUniversity(), "tourPlaceVK" => $team->getTourPlaceVK(), "tourNotify" => $team->getTourNotify(), "tourBonus" => $team->getTourBonus(), "tourBonusTime" => $team->getTourBonusTime(), "counterChoose" => $team->getCounterChoose(), "counterWon" => $team->getCounterWon(), "counterLose" => $team->getCounterLose(), "totalPlace" => $team->getTotalPlace(), "place" => isset($team->place) ? $team->place : 99);
     if (count($team->getFootballers())) {
         $forJSON["footballers"] = JSONPrepare::footballers($team->getFootballers());
     }
     if (count($team->getSponsors())) {
         $forJSON["sponsors"] = JSONPrepare::sponsors($team->getSponsors());
     }
     return $forJSON;
 }
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:11,代码来源:JSONPrepare.php

示例3: initFromRAM

 public function initFromRAM(Team $team)
 {
     $this->socialUserId = $team->getSocialUserId();
     $this->setLevel($team->getLevel());
     $this->setExperience($team->getExperience());
     $this->setMoney($team->getMoney());
     $this->setRealMoney($team->getRealMoney());
     $this->setStudyPoints($team->getStudyPoints());
     $this->setStudyPointsViaPrize($team->getStudyPointsViaPrize());
     $this->setInGroup($team->getInGroup());
     $this->setParameterForward($team->getParameterForward());
     $this->setParameterHalf($team->getParameterHalf());
     $this->setParameterSafe($team->getParameterSafe());
     $this->setEnergy($team->getCurrentEnergy());
     $this->setMaxEnergy($team->getEnergyMax());
     $this->trainerId = $team->getTrainerId();
     $this->teamName = trim($team->getTeamName());
     $this->teamLogoId = $team->getTeamLogoId();
     $this->inTeam = $team->getIsInTeam();
     $this->isAbleToChoose = $team->getIsAbleToChoose();
     $this->userPhoto = trim($team->getUserPhoto());
     $this->userName = trim($team->getUserName());
     $this->counterWon = $team->getCounterWon();
     $this->counterChoose = $team->getCounterChoose();
     $this->counterLose = $team->getCounterLose();
     $this->counterTie = $team->getCounterTie();
     $this->stadiumId = $team->getStadiumId();
     $this->setUserCountry($team->getUserCountry());
     $this->setUserCity($team->getUserCity());
     $this->setUserUniversity($team->getUserUniversity());
     $this->setPlaceCountry($team->getPlaceCountry());
     $this->setPlaceCity($team->getPlaceCity());
     $this->setPlaceUniversity($team->getPlaceUniversity());
     $this->setPlaceVK($team->getPlaceVK());
     $this->setTourIII($team->getTourIII());
     $this->setDailyBonus($team->isNeedDailyBonus());
     $this->setTourPlaceCountry($team->getTourPlaceCountry());
     $this->setTourPlaceCity($team->getTourPlaceCity());
     $this->setTourPlaceUniversity($team->getTourPlaceUniversity());
     $this->setTourPlaceVK($team->getTourPlaceVK());
     $this->setTourNotify($team->getTourNotify());
     $this->setTourBonus($team->getTourBonus());
     $this->setTourBonusTime($team->getTourBonusTime());
     $this->setIsPrized($team->getIsPrized());
     $this->setParameterSum($team->getParameterSum());
     $this->setTotalPlace($team->getTotalPlace());
     $this->setAllFootballersCount($team->getAllFootballersCount());
     $this->setAllFootballersFriendsCount($team->getAllFootballersFriendsCount());
     $this->setSponsorsCount($team->getSponsorsCount());
 }
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:50,代码来源:Team.php

示例4: getFriendsTeams

 private function getFriendsTeams()
 {
     $this->result['teams'] = array();
     $this->result['news'] = array();
     $this->result['rating'] = array();
     if ($this->parameters->groupSourceId) {
         logGroupSource($this->parameters->groupSourceId);
     }
     $needToUpgrade = false;
     $userCountry = intval($this->parameters->userCountry);
     $userCity = intval($this->parameters->userCity);
     $userUniversity = intval($this->parameters->userUniversity);
     track_stats();
     // Отслеживаем производительность
     if ($userCountry != $this->teamProfile->getUserCountry()) {
         $this->teamProfile->setUserCountry($userCountry);
         $needToUpgrade = true;
     }
     if ($userCity != $this->teamProfile->getUserCity()) {
         $this->teamProfile->setUserCity($userCity);
         $needToUpgrade = true;
     }
     if ($userUniversity != $this->teamProfile->getUserUniversity()) {
         $this->teamProfile->setUserUniversity($userUniversity);
         $needToUpgrade = true;
     }
     if (isset($this->parameters->groupBonusNeeded) && $this->parameters->groupBonusNeeded == 1 && $this->teamProfile->getInGroup() == 0) {
         $this->teamProfile->setInGroup(1);
         $this->teamProfile->setRealMoney($this->teamProfile->getRealMoney() + GlobalParameters::GROUP_BONUS_REAL);
         $needToUpgrade = true;
     }
     track_stats();
     // Отслеживаем производительность
     if ($needToUpgrade) {
         $actionResult = $this->teamProfile->save();
         if ($actionResult instanceof ErrorPoint) {
             return $actionResult;
         }
     }
     if ($this->parameters->uids) {
         if (!is_object($this->parameters->uids)) {
             $this->parameters->uids = str_replace('\\\\', '', $this->parameters->uids);
             $this->parameters->uids = str_replace('\\"', '', $this->parameters->uids);
             $this->parameters->uids = json_decode($this->parameters->uids);
         }
         track_stats();
         // Отслеживаем производительность
         $sql_template = "SELECT\n    teams.team_name,\n    teams.param_forward,\n    teams.param_half,\n    teams.param_safe,\n    teams.user_photo,\n    teams.user_name, \n    teams.team_logo_id, \n    teams.vk_id,\n    teams.level\nFROM teams\nWHERE teams.vk_id IN (%s) order by teams.level desc,  teams.counter_won desc ";
         $sql = sprintf($sql_template, Utils::IdsSeparetedByComma($this->parameters->uids));
         $SQLresult = SQL::getInstance()->query($sql);
         if ($SQLresult instanceof ErrorPoint) {
             return $SQLresult;
         }
         if ($SQLresult->num_rows) {
             $counterPlace = 1;
             while ($teamObject = $SQLresult->fetch_object()) {
                 $team = new Team();
                 $team->initFromDB($teamObject, false);
                 if ($team->getLevel() == 0) {
                     continue;
                 }
                 $team->place = $counterPlace;
                 $teamInJSON = JSONPrepare::team($team);
                 $counterPlace++;
                 $this->result['teams'][] = $teamInJSON;
                 //  $this->result['teams'][] = $teamObject;
             }
         }
     }
     $this->result['news'] = RAM::getInstance()->getNews();
     if (count($this->result['news']) == 0) {
         $sql_template = "SELECT news_sport.* FROM news_sport ORDER BY news_id";
         $sql = $sql_template;
         $SQLresult = SQL::getInstance()->query($sql);
         if ($SQLresult instanceof ErrorPoint) {
             return $SQLresult;
         }
         if ($SQLresult->num_rows) {
             $counter = 0;
             while ($newsObject = $SQLresult->fetch_object()) {
                 $news = new NewsEntry($newsObject);
                 $news->id = $counter;
                 $this->result['news'][] = $news;
                 RAM::getInstance()->setNews($news);
                 $counter++;
             }
         }
     }
     $leadTeams = RAM::getInstance()->getLeaders();
     if (count($leadTeams) == 0) {
         $sql_template = "SELECT teams.* FROM teams WHERE total_place is not NULL ORDER BY total_place  LIMIT 6";
         $sql = $sql_template;
         $SQLresult = SQL::getInstance()->query($sql);
         if ($SQLresult instanceof ErrorPoint) {
             return $SQLresult;
         }
         if ($SQLresult->num_rows) {
             $counter = 0;
             while ($teamObject = $SQLresult->fetch_object()) {
                 $team = new Team();
//.........这里部分代码省略.........
开发者ID:rootree,项目名称:vk-footboller-server,代码行数:101,代码来源:FriendTeamsController.php


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