if ($amount <= 0) {
    create_error("You must actually enter an ammount > 0!");
}
//lets make sure there is actually that much on the ship
if ($amount > $ship->cargo[$good_id]) {
    create_error("You can't dump more than you have.");
}
if ($sector->has_fed_beacon()) {
    create_error("You can't dump cargo in a Federal Sector!");
}
if ($player->turns < 1) {
    create_error("You do not have enough turns to dump cargo!");
}
require_once "shop_goods.inc";
// get the distance
$good_distance = get_good_distance($good_id, "Buy");
$lost_xp = (round($amount / 30) + 1) * 2 * $good_distance;
$player->experience -= $lost_xp;
if ($player->experience < 0) {
    $player->experience = 0;
}
// take turn
$player->take_turns(1);
$player->update();
$ship->cargo[$good_id] -= $amount;
$ship->update_cargo();
// log action
$account->log(6, "Dumps {$amount} of {$good_name} and looses {$lost_xp} experience", $player->sector_id);
$container = array();
$container["url"] = "skeleton.php";
if ($amount > 1) {
// does we have what we are going to sell?
if ($port->transaction[$good_id] == 'Sell' && $amount > $ship->cargo[$good_id]) {
    create_error("Scanning your ships indicates you don't have {$amount} pcs. of {$good_name}!");
}
// check if we have enough room for the thing we are going to buy
if ($port->transaction[$good_id] == 'Buy' && $amount > $ship->cargo_left) {
    create_error("Scanning your ships indicates you don't have enough free cargo bay!");
}
// check if the guy has enough money
if ($port->transaction[$good_id] == "Buy" && $player->credits < $bargain_price) {
    create_error("You don't have enough credits!");
}
// get relations for us (global + personal)
$relations = $player->relations[$port->race_id] + $player->relations_global_rev[$port->race_id];
$container = array();
$good_distance = get_good_distance($good_id, $port->transaction[$good_id]);
$ideal_price = get_ideal_price($good_id);
$offered_price = get_offered_price($good_id);
// nothing should happen here but just to avoid / by 0
if ($ideal_price == 0 || $offered_price == 0) {
    create_error("Port calculation error...buy more goods.");
}
// can we accept the current price?
if (!empty($bargain_price) && ($port->transaction[$good_id] == 'Buy' && $bargain_price >= $ideal_price || $port->transaction[$good_id] == 'Sell' && $bargain_price <= $ideal_price)) {
    // the url we going to
    $container["url"] = "skeleton.php";
    /*
    $first = pow($relations, 6);
    $second = pow(1000, 6) + .01;
    
    $factor = ($bargain_price - $offered_price) / (($ideal_price - $offered_price) + .01) + ($first / $second);