本文整理汇总了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