function tradeGoods($goodID, AbstractSmrPlayer &$player, SmrPort &$port) { sleepNPC(); //We have an extra sleep at port to make the NPC more vulnerable. $ship =& $player->getShip(); $portRelations = Globals::getRaceRelations($player->getGameID(), $port->getRaceID()); $relations = $player->getRelation($port->getRaceID()) + $portRelations[$player->getRaceID()]; $portGood = $port->getGood($goodID); if ($portGood['TransactionType'] == 'Buy') { $amount = $ship->getEmptyHolds(); } else { $amount = $ship->getCargo($goodID); } $idealPrice = $port->getIdealPrice($goodID, $portGood['TransactionType'], $amount, $relations); $offeredPrice = $port->getOfferPrice($idealPrice, $relations, $portGood['TransactionType']); return create_container('shop_goods_processing.php', '', array('offered_price' => $offeredPrice, 'ideal_price' => $idealPrice, 'amount' => $amount, 'good_id' => $goodID, 'bargain_price' => $offeredPrice)); }