public function recalcSolvers() { return $this->saveVar('wf_solvers', WC_Warflags::getSolvecount($this)); }
function warscore_levelup_single($socket, WC_Warbox $box, GWF_User $user, $level) { if (false === ($warchall = WC_Warflag::getWarchall($box, $level))) { return false; } if (WC_Warflags::hasSolved($warchall, $user)) { return false; } if (!WC_Warflags::insertSuccess($warchall, $user)) { return false; } $warchall->setLastSolver($user); $warchall->recalcSolvers(); return true; }
private function onSingleSolved(WC_Warflag $flag) { if (!WC_Warflags::insertSuccess($flag, $this->user)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $flag->setLastSolver($this->user); $flag->recalcSolvers(); return false; }
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); } }