private function showSites($input) { $input = substr($input, 1); $sitename = trim(Common::substrUntil($input, ' ')); $username = trim(Common::substrFrom($input, ' ', '')); if ($username === '') { die($this->showUsageSites()); } if (false !== ($user = GWF_User::getByName($username))) { if ($user->isOptionEnabled(0x10000000)) { die('This user is not ranked!'); } $rank = WC_RegAt::calcExactRank($user); } elseif (false !== ($user = WC_RegAt::getUserByGlobalRank($username))) { $rank = (int) $username; } else { die("The user doesnt exist at https://www.wechall.net"); } // if (false !== ($error = $this->module->isExcludedFromAPI($user))) { // die($error); // } $username = $user->displayUsername(); $regats = WC_RegAt::getRegats($user->getID(), 'regat_solved DESC'); $sitedata = array(); $keepthrough = 5; foreach ($regats as $row) { $perc = $row->getVar('regat_solved') * 100; if ($perc < 10 && $keepthrough < 0) { continue; } $keepthrough--; $sitedata[] = sprintf('%s(%.02f%%)', $this->getClassnameFromID($row->getVar('regat_sid')), $perc); } $count = count($sitedata); $sitedata = implode(', ', $sitedata); $out = sprintf('%s plays %d sites, primary: %s.', $username, count($regats), $sitedata); die($out); }