Exemplo n.º 1
0
 private function templatePlayers()
 {
     $bid = $this->box->getID();
     $_GET['sid'] = $this->box->getSiteID();
     $_GET['bid'] = $bid;
     $table = GDO::table('WC_Warflags');
     $where = "wf_wbid={$bid} AND wf_solved_at IS NOT NULL";
     $orderby = 'score DESC, solvedate ASC';
     $joins = array('flag', 'flagbox', 'solvers');
     $ipp = 50;
     $nItems = $table->countRows($where, $joins, 'user_name');
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $tVars = array('site_quickjump' => $this->module->templateSiteQuickjump('boxranking'), 'data' => $table->selectAll("user_name, user_countryid country, COUNT(*) solved, SUM(wf_score) score, SUM(wf_score)/{$this->box->getVar('wb_totalscore')}*100 percent, MAX(wf_solved_at) solvedate", $where, $orderby, $joins, $ipp, $from, GDO::ARRAY_A, 'user_name'), 'box' => $this->box, 'playercount' => $nItems, 'rank' => $from + 1, 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=WeChall&me=WarboxPlayers&boxid=' . $bid . '&page=%PAGE%'));
     return $this->module->templatePHP('warbox_players.php', $tVars);
 }
Exemplo n.º 2
0
function warscore_success($socket, WC_Warbox $box, GWF_User $user, $level)
{
    $boxes = WC_Warbox::getByIPAndPort($box->getVar('wb_ip'), $box->getVar('wb_port'));
    foreach ($boxes as $box) {
        $box instanceof WC_Warbox;
        if (warscore_has_level($box, $level)) {
            warscore_levelup($socket, $box, $user, $level);
            return;
        }
    }
    warscore_error($socket, 'This login is not part of the wargame!');
}
Exemplo n.º 3
0
 private function formEdit(WC_Warbox $box)
 {
     $data = array('name' => array(GWF_Form::STRING, $box->getVar('wb_name'), $this->l('th_wb_name')), 'url' => array(GWF_Form::STRING, $box->getVar('wb_weburl'), $this->l('th_wb_url')), 'host' => array(GWF_Form::STRING, $box->getVar('wb_host'), $this->l('th_wb_host')), 'port' => array(GWF_Form::INT, $box->getVar('wb_port'), $this->l('th_wb_port')), 'user' => array(GWF_Form::STRING, $box->getVar('wb_user'), $this->l('th_wb_user')), 'pass' => array(GWF_Form::STRING, $box->getVar('wb_pass'), $this->l('th_wb_pass')), 'wlist' => array(GWF_Form::STRING, $box->getVar('wb_whitelist'), $this->l('th_wb_wlist')), 'blist' => array(GWF_Form::STRING, $box->getVar('wb_blacklist'), $this->l('th_wb_blist')), 'launch' => array(GWF_Form::DATE, $box->getVar('wb_launched_at'), $this->l('th_wb_launch'), '', 8), 'status' => array(GWF_Form::ENUM, $box->getVar('wb_status'), $this->l('th_wb_status'), '', $this->statusValues()), 'warbox' => array(GWF_Form::CHECKBOX, $box->isWarbox(), $this->l('th_warbox')), 'multi' => array(GWF_Form::CHECKBOX, $box->isMultisolve(), $this->l('th_multisolve')), 'buttons' => array(GWF_Form::SUBMITS, array('edit' => $this->l('btn_edit_warbox'), 'flags' => $this->l('btn_edit_warflags'))));
     return new GWF_Form($this, $data);
 }