예제 #1
0
<?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
0
			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
0
<?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>&nbsp;</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
0
파일: npc.php 프로젝트: smrealms/smrv2.0
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));
}