Ejemplo n.º 1
0
function getGoodDistanceNew(SmrSector &$sector, $goodID, $transaction)
{
    global $var, $container;
    // check if we already did this
    if (isset($var['good_distance'])) {
        // transfer this value
        transfer('good_distance');
        // return this value
        return $var['good_distance'];
    }
    $x = Globals::getGood($goodID);
    switch ($transaction) {
        case 'Buy':
            $x['TransactionType'] = 'Sell';
            break;
        case 'Sell':
            $x['TransactionType'] = 'Buy';
    }
    $di = Plotter::findDistanceToX($x, $sector, true);
    if (is_object($di)) {
        $di = $di->getRelativeDistance();
    }
    $container['good_distance'] = $di;
    return $di;
}
Ejemplo n.º 2
0
<br />
								<br />
								
								<a class="nav" href="<?php 
    echo $CargoJettisonLink;
    ?>
">Cargo Holds (<?php 
    echo $ThisShip->getCargoHolds();
    ?>
/<?php 
    echo $ThisShip->getMaxCargoHolds();
    ?>
)</a><br /><?php 
    if ($ThisShip->hasCargo()) {
        foreach ($ThisShip->getCargo() as $GoodID => $GoodAmount) {
            $Good =& Globals::getGood($GoodID);
            ?>
										<img src="<?php 
            echo $Good['ImageLink'];
            ?>
" alt="<?php 
            echo $Good['Name'];
            ?>
" /> : <?php 
            echo $GoodAmount;
            ?>
<br /><?php 
        }
    }
    ?>
								
Ejemplo n.º 3
0
    create_error('You can\'t dump cargo while on a planet!');
}
if ($player->getTurns() < 1) {
    create_error('You do not have enough turns to dump cargo!');
}
//lets make sure there is actually that much on the ship
if ($amount > $ship->getCargo($good_id)) {
    create_error('You can\'t dump more than you have.');
}
$sector =& $player->getSector();
if ($sector->offersFederalProtection()) {
    create_error('You can\'t dump cargo in a Federal Sector!');
}
require_once 'shop_goods.inc';
// get the distance
$x = Globals::getGood($good_id);
$x['TransactionType'] = 'Sell';
$good_distance = Plotter::findDistanceToX($x, $sector, true);
if (is_object($good_distance)) {
    $good_distance = $good_distance->getRelativeDistance();
}
$good_distance = max(1, $good_distance);
$lost_xp = round(SmrPort::getBaseExperience($amount, $good_distance));
$player->decreaseExperience($lost_xp);
$player->increaseHOF($lost_xp, array('Trade', 'Experience', 'Jettisoned'), HOF_PUBLIC);
// take turn
$player->takeTurns(1, 1);
$ship->decreaseCargo($good_id, $amount);
$player->increaseHOF($amount, array('Trade', 'Goods', 'Jettisoned'), HOF_PUBLIC);
// log action
$account->log(LOG_TYPE_TRADING, 'Dumps ' . $amount . ' of ' . $good_name . ' and looses ' . $lost_xp . ' experience', $player->getSectorID());