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


PHP Globals::getGameCreditsRequired方法代码示例

本文整理汇总了PHP中Globals::getGameCreditsRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::getGameCreditsRequired方法的具体用法?PHP Globals::getGameCreditsRequired怎么用?PHP Globals::getGameCreditsRequired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Globals的用法示例。


在下文中一共展示了Globals::getGameCreditsRequired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_error

if (empty($race_id) || $race_id == 1) {
    create_error('Please choose a race!');
}
if (!is_numeric($var['game_id'])) {
    create_error('Game ID is not numeric');
}
$gameID = $var['game_id'];
$db->query('SELECT 1 FROM player WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND player_name = ' . $db->escape_string($player_name, true) . ' LIMIT 1');
if ($db->nextRecord() > 0) {
    create_error('The player name already exists.');
}
if (!Globals::isValidGame($gameID)) {
    create_error('Game not found!');
}
// does it cost something to join that game?
$credits = Globals::getGameCreditsRequired($gameID);
if ($credits > 0) {
    if ($account->getTotalSmrCredits() < $credits) {
        create_error('You do not have enough credits to join this game!');
    }
    $account->decreaseTotalSmrCredits($credits);
}
// check if hof entry is there
$db->query('SELECT 1 FROM account_has_stats WHERE account_id = ' . $db->escapeNumber(SmrSession::$account_id) . ' LIMIT 1');
if (!$db->nextRecord()) {
    $db->query('INSERT INTO account_has_stats (account_id, HoF_name) VALUES (' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escape_string($account->getLogin(), true) . ')');
}
// put him in a sector with a hq
$hq_id = $race_id + 101;
$db->query('SELECT * FROM location JOIN sector USING(game_id, sector_id) ' . 'WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND ' . 'location_type_id = ' . $db->escapeNumber($hq_id));
if ($db->nextRecord()) {
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:game_join_processing.php

示例2: number_format

?>
</td>
					</tr>
					<tr>
						<td align="right">Game Speed</td>
						<td>&nbsp;</td>
						<td align="left"><?php 
echo Globals::getGameSpeed($StatsGameID);
?>
</td>
					</tr>
					<tr>
						<td align="right">Credits Needed</td>
						<td>&nbsp;</td>
						<td align="left"><?php 
echo number_format(Globals::getGameCreditsRequired($StatsGameID));
?>
</td>
					</tr>
					<tr>
						<td align="right">Stats Ignored</td>
						<td>&nbsp;</td>
						<td align="left"><?php 
echo Globals::getGameIgnoreStats($StatsGameID) ? 'Yes' : 'No';
?>
</td>
					</tr>
					<tr>
						<td align="right">Starting Credits</td>
						<td>&nbsp;</td>
						<td align="left"><?php 
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:game_stats.php


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