Ejemplo n.º 1
0
<?php

require_once get_file_loc('SmrGalaxy.class.inc');
if (isset($var['gal_on'])) {
    $gal_on = $var['gal_on'];
} else {
    $PHP_OUTPUT .= 'Gal_on not found!!';
}
$galaxy =& SmrGalaxy::getGalaxy($var['game_id'], $var['gal_on']);
$galSectors =& $galaxy->getSectors();
//get totals
$total = array();
$totalPorts = array();
$totalMines = array();
$total['Ports'] = 0;
$total['Mines'] = 0;
for ($i = 1; $i <= 9; $i++) {
    $totalPorts[$i] = 0;
}
for ($i = 1; $i <= 20; $i++) {
    $totalMines[$i] = 0;
}
foreach ($galSectors as &$galSector) {
    if ($galSector->hasPort()) {
        $totalPorts[$galSector->getPort()->getLevel()]++;
        $total['Ports']++;
    }
    if ($galSector->hasMine()) {
        $totalMines[$galSector->getMine()->getLevel()]++;
        $total['Mines']++;
    }
Ejemplo n.º 2
0
     if (!is_numeric($sectorID)) {
         header('location: ' . URL . '/error.php?msg=Sector id was not a number.');
     }
     $galaxy = SmrGalaxy::getGalaxyContaining(SmrSession::$game_id, $sectorID);
     if ($galaxy === false) {
         header('location: ' . URL . '/error.php?msg=Invalid sector id');
         exit;
     }
 } else {
     if (isset($_REQUEST['galaxy_id'])) {
         $galaxyID = $_REQUEST['galaxy_id'];
         if (!is_numeric($galaxyID)) {
             header('location: ' . URL . '/error.php?msg=Galaxy id was not a number.');
         }
         try {
             $galaxy =& SmrGalaxy::getGalaxy(SmrSession::$game_id, $galaxyID);
         } catch (Exception $e) {
             header('location: ' . URL . '/error.php?msg=Invalid galaxy id');
             exit;
         }
     }
 }
 $player =& SmrPlayer::getPlayer(SmrSession::$account_id, SmrSession::$game_id);
 // create account object
 $account =& $player->getAccount();
 if (!isset($galaxyID) && !isset($sectorID)) {
     $galaxy =& SmrGalaxy::getGalaxyContaining(SmrSession::$game_id, $player->getSectorID());
 }
 if (isset($sectorID) || $account->isCenterGalaxyMapOnPlayer()) {
     if (isset($sectorID)) {
         $topLeft =& SmrSector::getSector($player->getGameID(), $sectorID);
Ejemplo n.º 3
0
<?php

if (Globals::getGameStartDate($player->getGameID()) + TIME_MAP_BUY_WAIT > TIME) {
    create_error('You cannot buy maps for another ' . format_time(Globals::getGameStartDate($player->getGameID()) + TIME_MAP_BUY_WAIT - TIME) . '!');
}
if ($account->getTotalSmrCredits() < CREDITS_PER_GAL_MAP) {
    create_error('You don\'t have enough SMR Credits.  Donate money to SMR to gain SMR Credits!');
}
//gal map buy
if (isset($var['process'])) {
    $galaxyID = trim($_REQUEST['gal_id']);
    if (!is_numeric($galaxyID) || $galaxyID == 0) {
        create_error('You must select a galaxy to buy the map of!');
    }
    //get start sector
    $galaxy =& SmrGalaxy::getGalaxy($player->getGameID(), $galaxyID);
    $low = $galaxy->getStartSector();
    //get end sector
    $high = $galaxy->getEndSector();
    // Have they already got this map? (Are there any unexplored sectors?
    $db->query('SELECT * FROM player_visited_sector WHERE sector_id >= ' . $db->escapeNumber($low) . ' AND sector_id <= ' . $db->escapeNumber($high) . ' AND account_id = ' . $db->escapeNumber($player->getAccountID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' LIMIT 1');
    if (!$db->nextRecord()) {
        create_error('You already have maps of this galaxy!');
    }
    $player->increaseHOF(1, array('Bar', 'Maps Bought'), HOF_PUBLIC);
    //take money
    $account->decreaseTotalSmrCredits(CREDITS_PER_GAL_MAP);
    //now give maps
    // delete all entries from the player_visited_sector/port table
    $db->query('DELETE FROM player_visited_sector WHERE sector_id >= ' . $db->escapeNumber($low) . ' AND sector_id <= ' . $db->escapeNumber($high) . ' AND account_id = ' . $db->escapeNumber($player->getAccountID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
    //start section