本文整理汇总了PHP中Globals::getRaceRelations方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::getRaceRelations方法的具体用法?PHP Globals::getRaceRelations怎么用?PHP Globals::getRaceRelations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::getRaceRelations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_file_loc
<?php
require_once get_file_loc('menu.inc');
if (!isset($var['race_id'])) {
SmrSession::updateVar('race_id', $player->getRaceID());
}
$raceID = $var['race_id'];
$template->assign('PageTopic', 'Ruling Council Of ' . Globals::getRaceName($raceID));
// echo menu
create_council_menu($raceID);
$RACES =& Globals::getRaces();
$raceRelations =& Globals::getRaceRelations($player->getGameID(), $raceID);
$peaceRaces = array();
$neutralRaces = array();
$warRaces = array();
foreach ($RACES as $otherRaceID => $raceInfo) {
if ($otherRaceID != RACE_NEUTRAL && $raceID != $otherRaceID) {
if ($raceRelations[$otherRaceID] >= 300) {
$peaceRaces[$otherRaceID] = $raceInfo;
} else {
if ($raceRelations[$otherRaceID] <= -300) {
$warRaces[$otherRaceID] = $raceInfo;
} else {
$neutralRaces[$otherRaceID] = $raceInfo;
}
}
}
}
$template->assignByRef('PeaceRaces', $peaceRaces);
$template->assignByRef('NeutralRaces', $neutralRaces);
$template->assignByRef('WarRaces', $warRaces);
示例2: array
WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()));
$votedForRace = -1;
if ($db->nextRecord()) {
$votedForRace = $db->getField('race_id_2');
$votedFor = $db->getField('action');
}
$voteRelations = array();
$playerRaceGlobalRelations = Globals::getRaceRelations($player->getGameID(), $player->getRaceID());
$races =& Globals::getRaces();
foreach ($races as $raceID => $raceInfo) {
if ($raceID == RACE_NEUTRAL || $raceID == $player->getRaceID()) {
continue;
}
$container = create_container('council_vote_processing.php', '', array('race_id' => $raceID));
$otherRaceGlobalRelations = Globals::getRaceRelations($player->getGameID(), $raceID);
$voteRelations[$raceID] = array('HREF' => SmrSession::getNewHREF($container), 'Increased' => $votedForRace == $raceID && $votedFor == 'INC', 'Decreased' => $votedForRace == $raceID && $votedFor == 'DEC', 'RelationToThem' => $playerRaceGlobalRelations[$raceID], 'RelationToUs' => $otherRaceGlobalRelations[$player->getRaceID()]);
}
$template->assign('VoteRelations', $voteRelations);
$voteTreaties = array();
$db->query('SELECT * FROM race_has_voting
WHERE ' . $db->escapeNumber(TIME) . ' < end_time
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND race_id_1 = ' . $db->escapeNumber($player->getRaceID()));
if ($db->getNumRows() > 0) {
$db2 = new SmrMySqlDatabase();
while ($db->nextRecord()) {
$otherRaceID = $db->getField('race_id_2');
$container = create_container('council_vote_processing.php', '', array('race_id' => $otherRaceID));
// get 'yes' votes
$db2->query('SELECT count(*) FROM player_votes_pact
示例3: checkPortTradeable
<?php
// include helper file
require_once 'shop_goods.inc';
// create object from port we can work with
$port =& $player->getSectorPort();
$tradeable = checkPortTradeable($port, $player);
if ($tradeable !== true) {
create_error($tradeable);
}
$portRelations = Globals::getRaceRelations($player->getGameID(), $port->getRaceID());
$relations = $player->getRelation($port->getRaceID());
// topic
$template->assign('PageTopic', 'Port In Sector #' . $player->getSectorID());
$container = create_container('skeleton.php', 'council_list.php');
$container['race_id'] = $port->getRaceID();
$PHP_OUTPUT .= '<p>This is a level ' . $port->getLevel() . ' port and run by the ' . create_link($container, $player->getColouredRaceName($port->getRaceID())) . '.<br />';
$PHP_OUTPUT .= 'Your relations with them are ' . get_colored_text($relations, $relations) . '.</p>';
$PHP_OUTPUT .= '<p> </p>';
$account->log(LOG_TYPE_TRADING, 'Player examines port', $player->getSectorID());
//The player is sent here after trading and sees this if his offer is accepted.
//You have bought/sold 300 units of Luxury Items for 1738500 credits. For your excellent trading skills you receive 220 experience points!
if (!empty($var['traded_xp']) || !empty($var['traded_amount']) || !empty($var['traded_good']) || !empty($var['traded_credits']) || !empty($var['traded_transaction'])) {
$PHP_OUTPUT .= '<p>You have just ' . $var['traded_transaction'] . ' <span class="yellow">' . $var['traded_amount'] . '</span> units ';
$PHP_OUTPUT .= 'of <span class="yellow">' . $var['traded_good'] . '</span> for ';
$PHP_OUTPUT .= '<span class="creds">' . $var['traded_credits'] . '</span> credits.<br />';
if ($var['traded_xp'] > 0) {
$PHP_OUTPUT .= '<p>For your excellent trading skills you have gained <span class="exp">' . $var['traded_xp'] . '</span> experience points!</p>';
}
// test if we are searched. (but only if we hadn't a previous trade here
} elseif ($player->getLastPort() != $player->getSectorID()) {
示例4: tradeGoods
function tradeGoods($goodID, AbstractSmrPlayer &$player, SmrPort &$port)
{
sleepNPC();
//We have an extra sleep at port to make the NPC more vulnerable.
$ship =& $player->getShip();
$portRelations = Globals::getRaceRelations($player->getGameID(), $port->getRaceID());
$relations = $player->getRelation($port->getRaceID()) + $portRelations[$player->getRaceID()];
$portGood = $port->getGood($goodID);
if ($portGood['TransactionType'] == 'Buy') {
$amount = $ship->getEmptyHolds();
} else {
$amount = $ship->getCargo($goodID);
}
$idealPrice = $port->getIdealPrice($goodID, $portGood['TransactionType'], $amount, $relations);
$offeredPrice = $port->getOfferPrice($idealPrice, $relations, $portGood['TransactionType']);
return create_container('shop_goods_processing.php', '', array('offered_price' => $offeredPrice, 'ideal_price' => $idealPrice, 'amount' => $amount, 'good_id' => $goodID, 'bargain_price' => $offeredPrice));
}