本文整理汇总了PHP中Globals::getHardwareTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::getHardwareTypes方法的具体用法?PHP Globals::getHardwareTypes怎么用?PHP Globals::getHardwareTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::getHardwareTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCategories
$total['SDs'] = $db->getInt('tot_sds');
}
$db->query('
SELECT sector_has_forces.sector_id, sector_has_forces.owner_id
FROM player
JOIN sector_has_forces ON player.game_id = sector_has_forces.game_id AND player.account_id = sector_has_forces.owner_id
WHERE player.game_id=' . $db->escapeNumber($alliance->getGameID()) . '
AND player.alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . '
AND expire_time >= ' . $db->escapeNumber(TIME) . '
ORDER BY ' . $categorySQL . ', ' . $subcategory);
$PHP_OUTPUT .= '<div align="center"><a href="http://wiki.smrealms.de/index.php?title=Game_Guide:_Forces" target="_blank"><img align="right" src="images/silk/help.png" width="16" height="16" alt="Wiki Link" title="Goto SMR Wiki: Forces"/></a>';
if ($db->getNumRows() > 0) {
$PHP_OUTPUT .= 'Your alliance currently has ';
$PHP_OUTPUT .= $db->getNumRows();
$PHP_OUTPUT .= ' stacks of forces in the universe!<br />';
$hardwareTypes =& Globals::getHardwareTypes();
$PHP_OUTPUT .= create_table();
$PHP_OUTPUT .= '<th>Number of Force</th><th>Value</th></tr>';
$PHP_OUTPUT .= '<tr><td><span class="yellow">' . number_format($total['Mines']) . '</span> mines</td><td><span class="creds">' . number_format($total['Mines'] * $hardwareTypes[HARDWARE_MINE]['Cost']) . '</span> credits</td></tr>';
$PHP_OUTPUT .= '<tr><td><span class="yellow">' . number_format($total['CDs']) . '</span> combat drones</td><td><span class="creds">' . number_format($total['CDs'] * $hardwareTypes[HARDWARE_COMBAT]['Cost']) . '</span> credits</td></tr>';
$PHP_OUTPUT .= '<tr><td><span class="yellow">' . number_format($total['SDs']) . '</span> scout drones</td><td><span class="creds">' . number_format($total['SDs'] * $hardwareTypes[HARDWARE_SCOUT]['Cost']) . '</span> credits</td></tr>';
$PHP_OUTPUT .= '<tr><td><span class="yellow bold">' . number_format(array_sum($total)) . '</span> forces</td><td><span class="creds bold">' . number_format($total['Mines'] * $hardwareTypes[HARDWARE_MINE]['Cost'] + $total['CDs'] * $hardwareTypes[HARDWARE_COMBAT]['Cost'] + $total['SDs'] * $hardwareTypes[HARDWARE_SCOUT]['Cost']) . '</span> credits</td></tr>';
$PHP_OUTPUT .= '</table><br />';
$PHP_OUTPUT .= '<table class="standard inset"><tr>';
$container = create_container('skeleton.php', 'alliance_forces.php');
$container['seq'] = $order == 'ASC' ? 'DESC' : 'ASC';
setCategories($container, 'player_name', $category, $categorySQL, $subcategory);
$PHP_OUTPUT .= '<th>';
$PHP_OUTPUT .= create_header_link($container, 'Player Name');
$PHP_OUTPUT .= '</th>';
setCategories($container, 'sector_has_forces.sector_id', $category, $categorySQL, $subcategory);
示例2: canWeUNO
function canWeUNO(AbstractSmrPlayer &$player, $oppurtunisticOnly)
{
if ($player->getCredits() < MINUMUM_RESERVE_CREDITS) {
return false;
}
$ship =& $player->getShip();
if ($ship->hasMaxShields() && $ship->hasMaxArmour() && $ship->hasMaxCargoHolds()) {
return false;
}
$sector =& $player->getSector();
// We buy armour in preference to shields as it's cheaper.
// We buy cargo holds last if we have no newbie turns because we'd rather not die
$hardwareArray = array(HARDWARE_ARMOUR, HARDWARE_SHIELDS, HARDWARE_CARGO);
$amount = 0;
$locations =& $sector->getLocations();
foreach ($locations as &$location) {
if ($location->isHardwareSold()) {
$hardwareSold =& $location->getHardwareSold();
if ($player->getNewbieTurns() > MIN_NEWBIE_TURNS_TO_BUY_CARGO && !$ship->hasMaxCargoHolds() && isset($hardwareSold[HARDWARE_CARGO]) && ($amount = floor(($player->getCredits() - MINUMUM_RESERVE_CREDITS) / Globals::getHardwareCost(HARDWARE_CARGO))) > 0) {
// Buy cargo holds first if we have plenty of newbie turns left.
$hardwareID = HARDWARE_CARGO;
} else {
foreach ($hardwareArray as $hardwareArrayID) {
if (!$ship->hasMaxHardware($hardwareArrayID) && isset($hardwareSold[$hardwareArrayID]) && ($amount = floor(($player->getCredits() - MINUMUM_RESERVE_CREDITS) / Globals::getHardwareCost($hardwareArrayID))) > 0) {
$hardwareID = $hardwareArrayID;
break;
}
}
}
if (isset($hardwareID)) {
return doUNO($hardwareID, min($ship->getMaxHardware($hardwareID) - $ship->getHardware($hardwareID), $amount));
}
}
}
if ($oppurtunisticOnly === true) {
return false;
}
if ($player->getCredits() - $ship->getCostToUNO() < MINUMUM_RESERVE_CREDITS) {
return false;
}
//Only do non-oppurtunistic UNO if we have the money to do it properly!
foreach ($hardwareArray as $hardwareArrayID) {
if (!$ship->hasMaxHardware($hardwareArrayID)) {
$hardwareNeededID = $hardwareArrayID;
return plotToNearest($player, Globals::getHardwareTypes($hardwareArrayID));
}
}
}