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


PHP Globals::getGood方法代码示例

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

示例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 
        }
    }
    ?>
								
开发者ID:smrealms,项目名称:smrv2.0,代码行数:30,代码来源:skeleton.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());
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:cargo_dump_processing.php


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