示例#1
0
文件: Rank.php 项目: Kuzat/kofradia
 /**
  * Generate object
  *
  * @param int points
  * @param int pos
  * @param int access level (0 = dead)
  */
 public function __construct($points, $pos = 0, $access_level = 0)
 {
     // set correct points-rank
     $this->pointsRank = \Kofradia\Game\Rank\Points::getRank($points);
     // set correct pos-rank
     $this->posRank = \Kofradia\Game\Rank\Pos::getRank($pos);
     // dead?
     if ($access_level == 0) {
         $this->isDead = true;
     }
     // access?
     if (isset(\ess::$g['ranks_access_levels'][$access_level])) {
         $this->accessTitle = \ess::$g['ranks_access_levels'][$access_level];
     }
 }
示例#2
0
文件: Option.php 项目: Kuzat/kofradia
 /**
  * Get rank limits
  *
  * We can only find players 2 ranks below and 2 ranks above ourself
  *
  * If we are first rank, or highest rank, it will adjust so it will be
  * a total of 5 possible ranks
  *
  * @return array(TODO)
  */
 protected function getRankLimits()
 {
     $num_min = max(1, $this->ut->up->rank['number'] - 2);
     $num_max = $num_min + 4;
     $ranks = \Kofradia\Game\Rank\Points::getRanks();
     $c = count($ranks);
     if ($num_max > $c) {
         $num_min -= $num_max - $c;
         $num_max = $c;
     }
     return array($ranks[$num_min], $num_max == $c ? null : $ranks[$num_max + 1]);
 }