コード例 #1
0
 public function show()
 {
     global $USER, $PLANET, $resource, $LNG, $reslist, $CONF;
     $this->tplObj->loadscript("jquery.countdown.js");
     $action = HTTP::_GP('action', '');
     $galaxyLeft = HTTP::_GP('galaxyLeft', '');
     $galaxyRight = HTTP::_GP('galaxyRight', '');
     $systemLeft = HTTP::_GP('systemLeft', '');
     $systemRight = HTTP::_GP('systemRight', '');
     $galaxy = min(max(HTTP::_GP('galaxy', (int) $PLANET['galaxy']), 1), Config::get('max_galaxy'));
     $system = min(max(HTTP::_GP('system', (int) $PLANET['system']), 1), Config::get('max_system'));
     $planet = min(max(HTTP::_GP('planet', (int) $PLANET['planet']), 1), Config::get('max_planets'));
     $type = HTTP::_GP('type', 1);
     $current = HTTP::_GP('current', 0);
     if (!empty($galaxyLeft)) {
         $galaxy = max($galaxy - 1, 1);
     } elseif (!empty($galaxyRight)) {
         $galaxy = min($galaxy + 1, Config::get('max_galaxy'));
     }
     if (!empty($systemLeft)) {
         $system = max($system - 1, 1);
     } elseif (!empty($systemRight)) {
         $system = min($system + 1, Config::get('max_system'));
     }
     if ($galaxy != $PLANET['galaxy'] || $system != $PLANET['system']) {
         if ($PLANET['deuterium'] < Config::get('deuterium_cost_galaxy')) {
             $this->printMessage($LNG['gl_no_deuterium_to_view_galaxy'], array("game.php?page=galaxy", 3));
             exit;
         } else {
             $PLANET['deuterium'] -= Config::get('deuterium_cost_galaxy');
         }
     }
     $targetDefensive = $reslist['defense'];
     $targetDefensive[] = 502;
     $MissleSelector[0] = $LNG['gl_all_defenses'];
     foreach ($targetDefensive as $Element) {
         $MissleSelector[$Element] = $LNG['tech'][$Element];
     }
     $galaxyRows = new GalaxyRows();
     $galaxyRows->setGalaxy($galaxy);
     $galaxyRows->setSystem($system);
     $Result = $galaxyRows->getGalaxyData();
     $tut_info = 1;
     $db_link = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 18) {
         $tut_info = 0;
         $db_link = 0;
     }
     $this->tplObj->loadscript('galaxy.js');
     $this->tplObj->assign_vars(array('man_p' => $USER['id_planet'], 'GalaxyRows' => $Result, 'tut_info' => $tut_info, 'db_link' => $db_link, 'planetcount' => $LNG['gl_populed_planets'], 'planetcount1' => count($Result), 'action' => $action, 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'type' => $type, 'current' => $current, 'maxfleetcount' => FleetFunctions::GetCurrentFleets($USER['id']), 'fleetmax' => FleetFunctions::GetMaxFleetSlots($USER), 'currentmip' => $PLANET[$resource[503]], 'grecyclers' => $PLANET[$resource[219]], 'recyclers' => $PLANET[$resource[209]], 'spyprobes' => $PLANET[$resource[210]], 'missile_count' => sprintf($LNG['gl_missil_to_launch'], $PLANET[$resource[503]]), 'spyShips' => array(210 => $USER['spio_anz']), 'settings_fleetactions' => $USER['settings_fleetactions'], 'current_galaxy' => $PLANET['galaxy'], 'immunity' => $LNG['gl_short_immunity'], 'current_system' => $PLANET['system'], 'current_planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type'], 'max_planets' => Config::get('max_planets'), 'MissleSelector' => $MissleSelector, 'ShortStatus' => array('vacation' => $LNG['gl_short_vacation'], 'banned' => $LNG['gl_short_ban'], 'inactive' => $LNG['gl_short_inactive'], 'longinactive' => $LNG['gl_short_long_inactive'], 'noob' => $LNG['gl_short_newbie'], 'strong' => $LNG['gl_short_strong'], 'enemy' => $LNG['gl_short_enemy'], 'friend' => $LNG['gl_short_friend'], 'member' => $LNG['gl_short_member'])));
     $this->display('page.galaxy2.default.tpl');
 }
コード例 #2
0
    public function show()
    {
        global $USER, $PLANET, $resource, $LNG, $reslist;
        $config = Config::get();
        $action = HTTP::_GP('action', '');
        $galaxyLeft = HTTP::_GP('galaxyLeft', '');
        $galaxyRight = HTTP::_GP('galaxyRight', '');
        $systemLeft = HTTP::_GP('systemLeft', '');
        $systemRight = HTTP::_GP('systemRight', '');
        $galaxy = min(max(HTTP::_GP('galaxy', (int) $PLANET['galaxy']), 1), $config->max_galaxy);
        $system = min(max(HTTP::_GP('system', (int) $PLANET['system']), 1), $config->max_system);
        $planet = min(max(HTTP::_GP('planet', (int) $PLANET['planet']), 1), $config->max_planets);
        $type = HTTP::_GP('type', 1);
        $current = HTTP::_GP('current', 0);
        if (!empty($galaxyLeft)) {
            $galaxy = max($galaxy - 1, 1);
        } elseif (!empty($galaxyRight)) {
            $galaxy = min($galaxy + 1, $config->max_galaxy);
        }
        if (!empty($systemLeft)) {
            $system = max($system - 1, 1);
        } elseif (!empty($systemRight)) {
            $system = min($system + 1, $config->max_system);
        }
        if ($galaxy != $PLANET['galaxy'] || $system != $PLANET['system']) {
            if ($PLANET['deuterium'] < $config->deuterium_cost_galaxy) {
                $this->printMessage($LNG['gl_no_deuterium_to_view_galaxy'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=galaxy')));
            } else {
                $PLANET['deuterium'] -= $config->deuterium_cost_galaxy;
            }
        }
        $targetDefensive = $reslist['defense'];
        $targetDefensive[] = 502;
        $missileSelector[0] = $LNG['gl_all_defenses'];
        foreach ($targetDefensive as $Element) {
            $missileSelector[$Element] = $LNG['tech'][$Element];
        }
        $sql = 'SELECT total_points
		FROM %%STATPOINTS%%
		WHERE id_owner = :userId AND stat_type = :statType';
        $USER += Database::get()->selectSingle($sql, array(':userId' => $USER['id'], ':statType' => 1));
        $galaxyRows = new GalaxyRows();
        $galaxyRows->setGalaxy($galaxy);
        $galaxyRows->setSystem($system);
        $Result = $galaxyRows->getGalaxyData();
        $this->tplObj->loadscript('galaxy.js');
        $this->assign(array('GalaxyRows' => $Result, 'planetcount' => sprintf($LNG['gl_populed_planets'], count($Result)), 'action' => $action, 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'type' => $type, 'current' => $current, 'maxfleetcount' => FleetFunctions::GetCurrentFleets($USER['id']), 'fleetmax' => FleetFunctions::GetMaxFleetSlots($USER), 'currentmip' => $PLANET[$resource[503]], 'grecyclers' => $PLANET[$resource[219]], 'recyclers' => $PLANET[$resource[209]], 'spyprobes' => $PLANET[$resource[210]], 'missile_count' => sprintf($LNG['gl_missil_to_launch'], $PLANET[$resource[503]]), 'spyShips' => array(210 => $USER['spio_anz']), 'settings_fleetactions' => $USER['settings_fleetactions'], 'current_galaxy' => $PLANET['galaxy'], 'current_system' => $PLANET['system'], 'current_planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type'], 'max_planets' => $config->max_planets, 'missileSelector' => $missileSelector, 'ShortStatus' => array('vacation' => $LNG['gl_short_vacation'], 'banned' => $LNG['gl_short_ban'], 'inactive' => $LNG['gl_short_inactive'], 'longinactive' => $LNG['gl_short_long_inactive'], 'noob' => $LNG['gl_short_newbie'], 'strong' => $LNG['gl_short_strong'], 'enemy' => $LNG['gl_short_enemy'], 'friend' => $LNG['gl_short_friend'], 'member' => $LNG['gl_short_member'])));
        $this->display('page.galaxy.default.tpl');
    }