Exemplo n.º 1
0
    $player->setTurns($player->getTurns() * ($speed / $ship->getSpeed()));
    doUNO($player, $ship);
} elseif ($var['func'] == 'Weapon') {
    $weapon_id = $_REQUEST['weapon_id'];
    $amount = $_REQUEST['amount'];
    for ($i = 1; $i <= $amount; $i++) {
        $ship->addWeapon($weapon_id);
    }
} elseif ($var['func'] == 'Uno') {
    doUNO($player, $ship);
} elseif ($var['func'] == 'Warp') {
    $sector_to = trim($_REQUEST['sector_to']);
    if (!is_numeric($sector_to)) {
        create_error('Sector ID has to be a number.');
    }
    if (!SmrGalaxy::getGalaxyContaining($player->getGameID(), $sector_to)) {
        create_error('Sector ID is not in any galaxy.');
    }
    $player->setSectorID($sector_to);
    $player->setLandedOnPlanet(false);
} elseif ($var['func'] == 'Turns') {
    $player->setTurns((int) $_REQUEST['turns']);
} elseif ($var['func'] == 'Exp') {
    $exp = min(500000, (int) $_REQUEST['exp']);
    $player->setExperience($exp);
} elseif ($var['func'] == 'Align') {
    $align = max(-500, min(500, (int) $_REQUEST['align']));
    $player->setAlignment($align);
} elseif ($var['func'] == 'Kills') {
    $kills = (int) $_REQUEST['kills'];
    $db->query('UPDATE account_has_stats SET kills = ' . $db->escapeNumber($kills) . ' WHERE account_id = ' . $db->escapeNumber($player->getAccountID()));
Exemplo n.º 2
0
         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);
     } else {
         $topLeft =& $player->getSector();
     }
     if (!$galaxy->contains($topLeft->getSectorID())) {
         $topLeft =& SmrSector::getSector($player->getGameID(), $galaxy->getStartSector());
     } else {
         $template->assign('FocusSector', $topLeft->getSectorID());
         //go left then up
         for ($i = 0; $i < floor($galaxy->getWidth() / 2); $i++) {
             $topLeft =& $topLeft->getNeighbourSector('Left');
         }
Exemplo n.º 3
0
if (!is_numeric($target)) {
    create_error('Please enter only numbers!');
}
if ($player->getSectorID() == $target) {
    create_error('Hmmmm...if ' . $player->getSectorID() . '=' . $target . ' then that means...YOU\'RE ALREADY THERE! *cough*you\'re real smart*cough*');
}
if ($sector->hasForces()) {
    $sectorForces =& $sector->getForces();
    foreach ($sectorForces as &$forces) {
        if ($forces->hasMines() && !$player->forceNAPAlliance($forces->getOwner())) {
            create_error('You cant jump when there are unfriendly forces in the sector!');
        }
    }
    unset($forces);
}
if (!SmrGalaxy::getGalaxyContaining($player->getGameID(), $target)) {
    create_error('The target sector doesn\'t exist!');
}
// create sector object for target sector
$targetSector =& SmrSector::getSector($player->getGameID(), $target);
require_once get_file_loc('Plotter.class.inc');
$path =& Plotter::findDistanceToX($targetSector, $player->getSector(), true);
if ($path === false) {
    create_error('Unable to plot from ' . $start . ' to ' . $target . '.');
}
// send scout msg
$sector->leavingSector($player, MOVEMENT_JUMP);
// Move the user around
// TODO: (Must be done while holding both sector locks)
$distance = $path->getRelativeDistance();
$turnsToJump = max(TURNS_JUMP_MINIMUM, round($distance * TURNS_PER_JUMP_DISTANCE));