本文整理汇总了PHP中Globals::getGood方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::getGood方法的具体用法?PHP Globals::getGood怎么用?PHP Globals::getGood使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::getGood方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGoodDistanceNew
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;
}
示例2: Holds
<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
}
}
?>
示例3: create_error
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());