Exemplo n.º 1
0
Arquivo: game.php Projeto: sherdog/wnd
 public function gamedata($playerID = null, $return = false)
 {
     Validate::player($playerID);
     //we are going to pass all data's
     $array = array();
     //this is what we store the data in.
     $player = new PlayerModel();
     $level = new LevelModel();
     $playerLevel = new PlayerLevelModel($playerID);
     $store = new StoreModel();
     $abModel = new ABModel();
     $rankModel = new RankModel();
     $array['status'] = 'ok';
     $array['player'] = $player->getPlayerData(array($playerID, false));
     $array['featuretests'] = $abModel->getTests($playerID);
     $array['scores'] = $playerLevel->load($playerID);
     $array['stores'] = $store->getStores();
     $array['gifts'] = $player->getGifts($playerID);
     $array['liferequests'] = $player->getRequests($playerID);
     $array['levels'] = $level->getLevelData();
     $array['ranks'] = $rankModel->getRanks();
     $levelData = null;
     $tmpObject = null;
     if ($return) {
         return $array;
     } else {
         $this->printJson($array);
     }
 }
Exemplo n.º 2
0
 public function set_ranks($playerID)
 {
     $rankModel = new RankModel();
     $data = $rankModel->getRanks();
     $this->printJson($data);
 }
Exemplo n.º 3
0
 private function getPlayerRank($currentLevel)
 {
     //get ranks
     $rankModel = new RankModel();
     $ranks = $rankModel->getRanks();
     $currentRank = "";
     for ($i = 0; $i < count($ranks); $i++) {
         if ((int) $currentLevel >= (int) $ranks[$i]["unlockLevel"]) {
             $currentRank = $i;
         }
     }
     return $currentRank;
 }