本文整理匯總了PHP中Globals::getGoodName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Globals::getGoodName方法的具體用法?PHP Globals::getGoodName怎麽用?PHP Globals::getGoodName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Globals
的用法示例。
在下文中一共展示了Globals::getGoodName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
<?php
$good_id = $var['good_id'];
$good_name = Globals::getGoodName($good_id);
if (isset($_REQUEST['amount'])) {
SmrSession::updateVar('amount', $_REQUEST['amount']);
}
$amount = $var['amount'];
if (!is_numeric($amount)) {
create_error('Numbers only please!');
}
if ($amount <= 0) {
create_error('You must actually enter an ammount > 0!');
}
if ($player->isLandedOnPlanet()) {
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);
示例2: create_error
$planet =& $player->getSectorPlanet();
$action = $_REQUEST['action'];
// transfer to ship
if ($action == 'Ship') {
// do we want transfer more than we have?
if ($amount > $planet->getStockpile($var['good_id'])) {
create_error('You can\'t take more than on planet!');
}
// do we want to transfer more than we can carry?
if ($amount > $ship->getEmptyHolds()) {
create_error('You can\'t take more than you can carry!');
}
// now transfer
$planet->decreaseStockpile($var['good_id'], $amount);
$ship->increaseCargo($var['good_id'], $amount);
$account->log(LOG_TYPE_PLANETS, 'Player takes ' . $amount . ' ' . Globals::getGoodName($var['good_id']) . ' from planet.', $player->getSectorID());
// transfer to planet
} elseif ($action == 'Planet') {
// do we want transfer more than we have?
if ($amount > $ship->getCargo($var['good_id'])) {
create_error('You can\'t store more than you carry!');
}
// do we want to transfer more than the planet can hold?
if ($amount > $planet->getRemainingStockpile($var['good_id'])) {
create_error('You can only put 600 per item at planet!');
}
// now transfer
$planet->increaseStockpile($var['good_id'], $amount);
$ship->decreaseCargo($var['good_id'], $amount);
}
// update both