当前位置: 首页>>代码示例>>PHP>>正文


PHP Globals::getGoodName方法代码示例

本文整理汇总了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);
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:cargo_dump_processing.php

示例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
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:planet_stockpile_processing.php


注:本文中的Globals::getGoodName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。