コード例 #1
0
ファイル: WC_Warbox.php プロジェクト: sinfocol/gwf3
 public function parseFlagStats(GWF_User $user, &$stats)
 {
     $flags = WC_Warflag::getForBoxAndUser($this, $user);
     $ssh = 0;
     $flg = 0;
     if (count($flags) > 0) {
         $score = 0;
         $challs = 0;
         $maxscore = 0;
         foreach ($flags as $flag) {
             $flag instanceof WC_Warflag;
             if ($flag->getVar('wf_solved_at') !== NULL) {
                 $score += $flag->getVar('wf_score');
                 $challs++;
             }
             if ($flag->isWarflag()) {
                 $flg++;
             } else {
                 $ssh++;
             }
             $maxscore += $flag->getVar('wf_score');
         }
         # Remember challcount
         $this->saveVars(array('wb_challs' => count($flags), 'wb_levels' => $ssh, 'wb_flags' => $flg));
         # Save usercount?
         $site = $this->getSite();
         if ($site->isNoV1()) {
             $site->saveVar('site_usercount', WC_Warflags::getPlayercountForSite($site));
         }
         // score, rank, challssolved, maxscore, usercount, challcount
         $stats[0] += $score;
         // 			$stats[1]; RANK
         $stats[2] += $challs;
         $stats[3] += $maxscore;
         // 			$stats[4]; USERCOUNT
         $stats[5] += count($flags);
     }
 }