Esempio n. 1
0
function check_for_registration(&$account, &$player, $fp, $nick, $channel, $callback, $validationMessages = true)
{
    //Force $validationMessages to always be boolean.
    $validationMessages = $validationMessages === true;
    $db = new SmrMySqlDatabase();
    // only registered users are allowed to use this command
    $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND registered = 1 AND channel = ' . $db->escapeString($channel));
    if (!$db->nextRecord()) {
        global $actions;
        // execute a whois and continue here on whois
        fputs($fp, 'WHOIS ' . $nick . EOL);
        array_push($actions, array('MSG_318', $channel, $nick, $callback, time(), $validationMessages));
        return true;
    }
    $registeredNick = $db->getField('registered_nick');
    // get alliance_id and game_id for this channel
    $alliance =& SmrAlliance::getAllianceByIrcChannel($channel, true);
    if ($alliance == null) {
        if ($validationMessages === true) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', the channel ' . $channel . ' has not been registered with me.' . EOL);
        }
        return true;
    }
    // get smr account
    $account = SmrAccount::getAccountByIrcNick($nick, true);
    if ($account == null) {
        if ($registeredNick != '') {
            $account = SmrAccount::getAccountByIrcNick($registeredNick, true);
        }
        if ($account == null) {
            if ($validationMessages === true) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', please set your \'irc nick\' in SMR preferences to your registered nick so i can recognize you.' . EOL);
            }
            return true;
        }
    }
    // get smr player
    $player = SmrPlayer::getPlayer($account->getAccountID(), $alliance->getGameId(), true);
    if ($player == null) {
        if ($validationMessages === true) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you have not joined the game that this channel belongs to.' . EOL);
        }
        return true;
    }
    // is the user part of this alliance? (no need to check for 0, cannot happen at this point in code)
    if ($player->getAllianceID() != $alliance->getAllianceID()) {
        if ($validationMessages === true) {
            fputs($fp, 'KICK ' . $channel . ' ' . $nick . ' :You are not a member of this alliance!' . EOL);
        }
        return true;
    }
    return false;
}
Esempio n. 2
0
function doBountyList(&$PHP_OUTPUT, &$db, &$player)
{
    $PHP_OUTPUT .= '<td style="width:50%" class="top">';
    $any = false;
    while ($db->nextRecord()) {
        $any = true;
        $bountyPlayer =& SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID());
        $PHP_OUTPUT .= $bountyPlayer->getLinkedDisplayName() . ' : <span class="creds">' . number_format($db->getInt('amount')) . '</span> credits and' . ' <span class="yellow">' . number_format($db->getInt('smr_credits')) . '</span> SMR credits<br />';
    }
    if (!$any) {
        $PHP_OUTPUT .= 'None';
    }
    $PHP_OUTPUT .= '</td>';
}
}
// ********************************
// *
// * A t t a c k e r   s h o o t s
// *
// ********************************
$attacker_total_msg = array();
$attacker_msg = array();
if ($player->getAllianceID() != 0) {
    $db->query('SELECT * FROM player ' . 'WHERE game_id = ' . $player->getGameID() . ' AND ' . 'alliance_id = ' . $player->getAllianceID() . ' AND ' . 'sector_id = ' . $player->getSectorID() . ' AND ' . 'land_on_planet = \'FALSE\' AND ' . 'newbie_turns = 0 ' . 'ORDER BY rand() LIMIT 10');
} else {
    $db->query('SELECT * FROM player ' . 'WHERE game_id = ' . $player->getGameID() . ' AND ' . 'sector_id = ' . $player->getSectorID() . ' AND ' . 'account_id = ' . $player->getAccountID() . ' AND ' . 'land_on_planet = \'FALSE\' AND ' . 'newbie_turns = 0');
}
$db2 = new SmrMySqlDatabase();
while ($db->next_record() && ($forces->hasCDs() || $forces->hasSDs() || $forces->hasMines())) {
    $curr_attacker =& SmrPlayer::getPlayer($db->f('account_id'), SmrSession::$game_id);
    $curr_attacker_ship = new SMR_SHIP($db->f('account_id'), SmrSession::$game_id);
    // disable cloak
    $curr_attacker_ship->disable_cloak();
    $db2->query('SELECT * FROM ship_has_weapon, weapon_type ' . 'WHERE account_id = ' . $curr_attacker->getAccountID() . ' AND ' . 'game_id = ' . SmrSession::$game_id . ' AND ' . 'ship_has_weapon.weapon_type_id = weapon_type.weapon_type_id ' . 'ORDER BY order_id');
    // iterate over all existing weapons
    while ($db2->next_record() && ($forces->hasCDs() || $forces->hasSDs() || $forces->hasMines())) {
        $weapon_name = $db2->f('weapon_name');
        $shield_damage = $db2->f('shield_damage');
        $armour_damage = $db2->f('armour_damage');
        $accuracy = $db2->f('accuracy');
        if ($forces->hasMines()) {
            if ($armour_damage > 0) {
                // mines take 20 armour damage each
                $mines_dead = round($armour_damage / 20);
                // more damage than mines?
Esempio n. 4
0
    if ($i == $home_sector_id) {
        continue;
    }
    $db->query('INSERT INTO player_visited_sector (account_id, game_id, sector_id) VALUES (' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ', ' . $db->escapeNumber($i) . ')');
}
$db->query('INSERT INTO player_has_stats (account_id, game_id) VALUES (' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ')');
// update stats
$db->query('UPDATE account_has_stats SET games_joined = games_joined + 1 WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
// is this our first game?
$db->query('SELECT * FROM account_has_stats WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
if ($db->nextRecord() && $db->getInt('games_joined') == 1) {
    //we are a newb set our alliance to be Newbie Help Allaince
    $db->query('UPDATE player SET alliance_id = ' . $db->escapeNumber(NHA_ID) . ' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()) . ' AND game_id = ' . $db->escapeNumber($gameID));
    $db->query('INSERT INTO player_has_alliance_role (game_id, account_id, role_id,alliance_id) VALUES (' . $db->escapeNumber($gameID) . ', ' . $db->escapeNumber($account->getAccountID()) . ', 2,' . $db->escapeNumber(NHA_ID) . ')');
    //we need to send them some messages
    $message = 'Welcome to Space Merchant Realms, this message is to get you underway with information to start you off in the game. All newbie and beginner rated player are placed into a teaching alliance run by a Veteran player who is experienced enough to answer all your questions and give you a helping hand at learning the basics of the game.<br /><br />
	Apart from your leader (denoted with a star on your alliance roster) there are various other ways to get information and help. Newbie helpers are players in Blue marked on the Current Players List which you can view by clicking the link on the left-hand side of the screen that says "Current Players". Also you can visit the SMR Wiki via a link on the left which gives detailed information on all aspects fo the game.<br /><br />
	SMR is a very community orientated game and as such there is an IRC Chat server setup for people to talk with each other and coordinate your alliances. There is a link on the left which will take you directly to the main SMR room where people come to hang out and chat. You can also get help in the game in the #smr room. You can access this by typing /join #smr-help in the server window. If you prefer to use a dedicated program to access IRC Chat rather than a browser you can goto http://www.mirc.com which is a good shareware program (asks to register the program after 30 days but you can still use it after 30 days so you won\'t get cut off from using it) or http://www.xchat.org which is a free alternative. In the options of either program you will need to enter the server information to access the server. Add a new server and enter the server address irc.coldfront.net using port 6667. Once connected you can use the /join command to join #smr (/join #smr) or any other room on the server as normal.<br /><br />
	Apart from this you can view the webboard via a link on the left to join in community chat and conversations, ask questions for help and make suggestions for the game in various forums.<br /><br />
	To get underway, click the alliance link on the left where you can get more information on 	how to get started on the alliance message board which will get you into your alliance chat 	on IRC so you can get started and have your questions answered.<br /><br />Depending on the size and resolution of your monitor the default font size may be too large or small. This can be changed using the preferences link on the left panel.';
    SmrPlayer::sendMessageFromAdmin($gameID, $account->getAccountID(), $message);
}
if ($race_id == RACE_ALSKANT) {
    // Give Alskants 250 personal relations to start.
    $player =& SmrPlayer::getPlayer($account->getAccountID(), $gameID);
    $RACES =& Globals::getRaces();
    foreach ($RACES as $raceID => $raceInfo) {
        $player->setRelations(250, $raceID);
    }
}
forward(create_container('skeleton.php', 'game_play.php'));
<?php

$accountIDs = $_REQUEST['account_id'];
if (empty($accountIDs)) {
    create_error('You have to choose someone to remove them!');
}
if (in_array($player->getAlliance()->getLeaderID(), $accountIDs)) {
    create_error('You can\'t kick the leader!');
}
if (in_array($player->getAccountID(), $accountIDs)) {
    create_error('You can\'t kick yourself!');
}
foreach ($accountIDs as $accountID) {
    $currPlayer =& SmrPlayer::getPlayer($accountID, $player->getGameID());
    if (!$player->sameAlliance($currPlayer)) {
        throw new Exception('Cannot kick someone from another alliance!');
    }
    $currPlayer->leaveAlliance($player);
}
forward(create_container('skeleton.php', 'alliance_roster.php'));
Esempio n. 6
0
    $account_id = $player->getAccountID();
    $game_id = $player->getGameID();
    // delete all entries from the player_visited_sector/port table
    $db->query('DELETE FROM player_visited_sector WHERE account_id = ' . $db->escapeNumber($account_id) . ' AND game_id = ' . $db->escapeNumber($game_id));
    // add port infos
    $db->query('SELECT sector_id FROM port WHERE game_id = ' . $db->escapeNumber($game_id) . ' ORDER BY sector_id');
    while ($db->nextRecord()) {
        SmrPort::getPort($game_id, $db->getField('sector_id'))->addCachePort($account_id);
    }
} elseif ($var['func'] == 'Money') {
    $player->setCredits(50000000);
} elseif ($var['func'] == 'PageNewb') {
    if (!defined('ACCOUNT_ID_PAGE')) {
        create_error('You\'re so mean! Go pick on someone else!');
    }
    $page =& SmrPlayer::getPlayer(ACCOUNT_ID_PAGE, $player->getGameID());
    $page->setNewbieTurns(0);
} elseif ($var['func'] == 'Ship' && $_REQUEST['ship_id'] <= 75 && $_REQUEST['ship_id'] != 68) {
    $ship_id = (int) $_REQUEST['ship_id'];
    $speed = $ship->getSpeed();
    // assign the new ship
    $ship->decloak();
    $ship->disableIllusion();
    $ship->setShipTypeID($ship_id);
    //now adapt turns
    $player->setTurns($player->getTurns() * ($speed / $ship->getSpeed()));
    doUNO($player, $ship);
} elseif ($var['func'] == 'Weapon') {
    $weapon_id = $_REQUEST['weapon_id'];
    $amount = $_REQUEST['amount'];
    for ($i = 1; $i <= $amount; $i++) {
if ($player->hasNewbieTurns()) {
    create_error('You are under newbie protection.');
}
if ($player->hasFederalProtection()) {
    create_error('You are under federal protection.');
}
if ($player->isLandedOnPlanet()) {
    create_error('You cannot attack whilst on a planet!');
}
if ($player->getTurns() < 3) {
    create_error('You have insufficient turns to perform that action.');
}
if (!$player->canFight()) {
    create_error('You are not allowed to fight!');
}
$targetPlayer =& SmrPlayer::getPlayer($var['target'], $player->getGameID());
if ($player->traderNAPAlliance($targetPlayer)) {
    create_error('Your alliance does not allow you to attack this trader.');
} else {
    if ($targetPlayer->isDead()) {
        create_error('Target is already dead.');
    } else {
        if ($targetPlayer->getSectorID() != $player->getSectorID()) {
            create_error('Target is no longer in this sector.');
        } else {
            if ($targetPlayer->hasNewbieTurns()) {
                create_error('Target is under newbie protection.');
            } else {
                if ($targetPlayer->isLandedOnPlanet()) {
                    create_error('Target is protected by planetary shields.');
                } else {
Esempio n. 8
0
        ++$rank;
        $expRankings[$rank] =& SmrPlayer::getPlayer($db->getField('account_id'), $gameID);
    }
    $template->assign('ExperienceRankings', $expRankings);
}
$db->query('SELECT account_id FROM player WHERE game_id = ' . $gameID . ' ORDER BY kills DESC LIMIT 10');
if ($db->getNumRows() > 0) {
    $rank = 0;
    $killRankings = array();
    while ($db->nextRecord()) {
        ++$rank;
        $killRankings[$rank] =& SmrPlayer::getPlayer($db->getField('account_id'), $gameID);
    }
    $template->assign('KillRankings', $killRankings);
}
$db->query('SELECT * FROM active_session
			WHERE last_accessed >= ' . (TIME - 600) . ' AND
				game_id = ' . $gameID);
$count_real_last_active = $db->getNumRows();
$db->query('SELECT account_id FROM player ' . 'WHERE last_cpl_action >= ' . (TIME - 600) . ' AND ' . 'game_id = ' . $gameID . ' ' . 'ORDER BY experience DESC, player_name');
$count_last_active = $db->getNumRows();
// fix it if some1 is using the logoff button
if ($count_real_last_active < $count_last_active) {
    $count_real_last_active = $count_last_active;
}
$template->assign('PlayersAccessed', $count_real_last_active);
$currentPlayers = array();
while ($db->nextRecord()) {
    $currentPlayers[] =& SmrPlayer::getPlayer($db->getField('account_id'), $gameID);
}
$template->assign('CurrentPlayers', $currentPlayers);
Esempio n. 9
0
<?php

$results = unserialize($var['results']);
$template->assignByRef('TraderCombatResults', $results);
if ($var['target']) {
    $template->assignByRef('Target', SmrPlayer::getPlayer($var['target'], $player->getGameID()));
}
if (isset($var['override_death'])) {
    $template->assign('OverrideDeath', true);
} else {
    $template->assign('OverrideDeath', false);
}
Esempio n. 10
0
 $template->assign('BackHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'box_view.php')));
 $db->query('SELECT * FROM message_boxes WHERE box_type_id=' . $db->escapeNumber($var['box_type_id']) . ' ORDER BY send_time DESC');
 $messages = array();
 if ($db->getNumRows()) {
     $container = create_container('box_delete_processing.php');
     $container['box_type_id'] = $var['box_type_id'];
     $template->assign('DeleteHREF', SmrSession::getNewHREF($container));
     while ($db->nextRecord()) {
         $gameID = $db->getInt('game_id');
         $validGame = $gameID > 0 && Globals::isValidGame($gameID);
         $messageID = $db->getInt('message_id');
         $messages[$messageID] = array('ID' => $messageID);
         $senderAccount =& SmrAccount::getAccount($db->getField('sender_id'));
         $senderName = $senderAccount->getLogin() . ' (' . $senderAccount->getAccountID() . ')';
         if ($validGame) {
             $senderPlayer =& SmrPlayer::getPlayer($senderAccount->getAccountID(), $gameID);
             if ($senderAccount->getLogin() != $senderPlayer->getPlayerName()) {
                 $senderName .= ' a.k.a ' . $senderPlayer->getPlayerName();
             }
             $container = create_container('skeleton.php', 'box_reply.php');
             $container['sender_id'] = $senderAccount->getAccountID();
             $container['game_id'] = $gameID;
             $messages[$messageID]['ReplyHREF'] = SmrSession::getNewHREF($container);
         }
         $messages[$messageID]['SenderName'] = $senderName;
         if (!$validGame) {
             $messages[$messageID]['GameName'] = 'Game no longer exists';
         } else {
             $messages[$messageID]['GameName'] = Globals::getGameName($gameID);
         }
         $messages[$messageID]['SendTime'] = date(DATE_FULL_SHORT, $db->getField('send_time'));
Esempio n. 11
0
<?php

$template->assign('PageTopic', 'Send Message');
require_once get_file_loc('menu.inc');
create_message_menu();
$container = create_container('message_send_processing.php');
transfer('receiver');
$template->assign('MessageSendFormHref', SmrSession::getNewHREF($container));
if (!empty($var['receiver'])) {
    $template->assignByRef('Receiver', SmrPlayer::getPlayer($var['receiver'], $player->getGameID()));
} else {
    $template->assign('Receiver', 'All Online');
}
if (isset($var['preview'])) {
    $template->assign('Preview', $var['preview']);
}
Esempio n. 12
0
<?php

$template->assign('PageTopic', 'Reply To Reported Messages');
$container = create_container('box_reply_processing.php');
transfer('game_id');
transfer('sender_id');
$template->assign('BoxReplyFormHref', SmrSession::getNewHREF($container));
$template->assignByRef('Sender', SmrPlayer::getPlayer($var['sender_id'], $var['game_id']));
$template->assignByRef('SenderAccount', SmrAccount::getAccount($var['sender_id']));
if (isset($var['Preview'])) {
    $template->assign('Preview', $var['Preview']);
}
if (isset($var['BanPoints'])) {
    $template->assign('BanPoints', $var['BanPoints']);
}
Esempio n. 13
0
}
// get account from db
$db->query('SELECT account_id FROM account WHERE account_id = ' . $db->escapeNumber($account_id) . ' OR ' . 'login LIKE ' . $db->escape_string($var['login']) . ' OR ' . 'email LIKE ' . $db->escape_string($var['email']) . ' OR ' . 'hof_name LIKE ' . $db->escapeString($var['hofname']) . ' OR ' . 'validation_code LIKE ' . $db->escape_string($var['val_code']));
if ($db->nextRecord()) {
    $curr_account =& SmrAccount::getAccount($db->getField('account_id'));
    $template->assignByRef('EditingAccount', $curr_account);
    $template->assign('EditFormHREF', SmrSession::getNewHREF(create_container('account_edit_processing.php', '', array('account_id' => $curr_account->getAccountID()))));
} else {
    $template->assign('EditFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'account_edit.php')));
}
$template->assign('ResetFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'account_edit.php')));
if ($curr_account !== false) {
    $editingPlayers = array();
    $db->query('SELECT game_id FROM player WHERE account_id = ' . $db->escapeNumber($curr_account->getAccountID()) . ' ORDER BY game_id ASC');
    while ($db->nextRecord()) {
        $editingPlayers[] =& SmrPlayer::getPlayer($curr_account->getAccountID(), $db->getInt('game_id'));
    }
    $template->assign('EditingPlayers', $editingPlayers);
    $banReasons = array();
    $db->query('SELECT * FROM closing_reason');
    while ($db->nextRecord()) {
        $reason = $db->getField('reason');
        if (strlen($reason) > 50) {
            $reason = substr($reason, 0, 75) . '...';
        }
        $banReasons[$db->getInt('reason_id')] = $reason;
    }
    $template->assign('BanReasons', $banReasons);
    $closingHistory = array();
    $db->query('SELECT * FROM account_has_closing_history WHERE account_id = ' . $db->escapeNumber($curr_account->getAccountID()) . ' ORDER BY time DESC');
    while ($db->nextRecord()) {
Esempio n. 14
0
function NPCStuff()
{
    global $actions, $var, $previousContainer, $underAttack, $NPC_LOGIN, $db;
    $underAttack = false;
    $actions = -1;
    //	for($i=0;$i<40;$i++)
    while (true) {
        $actions++;
        try {
            $TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE'];
            debug('Action #' . $actions);
            SmrSession::$game_id = NPC_GAME_ID;
            debug('Getting player for account id: ' . SmrSession::$account_id);
            //We have to reload player on each loop
            $player =& SmrPlayer::getPlayer(SmrSession::$account_id, SmrSession::$game_id, true);
            $player->updateTurns();
            if ($actions == 0) {
                if ($player->getAllianceName() != $NPC_LOGIN['AllianceName']) {
                    // dirty hack so we can revisit the init block here on next iteration
                    $actions--;
                    if ($player->hasAlliance()) {
                        processContainer(leaveAlliance());
                    }
                    // figure out if the selected alliance already exist
                    $db->query('SELECT alliance_id FROM alliance WHERE alliance_name=' . $db->escapeString($NPC_LOGIN['AllianceName']) . ' AND game_id=' . $db->escapeNumber(SmrSession::$game_id));
                    if ($db->nextRecord()) {
                        processContainer(joinAlliance($db->getField('alliance_id'), '*--NPCS--*'));
                    } else {
                        processContainer(createAlliance($NPC_LOGIN['AllianceName'], '*--NPCS--*'));
                    }
                }
                if ($player->getTurns() <= mt_rand($player->getMaxTurns() / 2, $player->getMaxTurns()) && ($player->hasNewbieTurns() || $player->hasFederalProtection())) {
                    debug('We don\'t have enough turns to bother starting trading, and we are protected: ' . $player->getTurns());
                    changeNPCLogin();
                }
            }
            if (!isset($TRADE_ROUTE)) {
                //We only want to change trade route if there isn't already one set.
                $TRADE_ROUTES =& findRoutes($player);
                $TRADE_ROUTE =& changeRoute($TRADE_ROUTES);
            }
            if ($player->isDead()) {
                debug('Some evil person killed us, let\'s move on now.');
                $previousContainer = null;
                //We died, we don't care what we were doing beforehand.
                $TRADE_ROUTE =& changeRoute($TRADE_ROUTES);
                //Change route
                processContainer(create_container('death_processing.php'));
            }
            if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) {
                processContainer(create_container('newbie_warning_processing.php'));
            }
            $fedContainer = null;
            if ($var['url'] == 'shop_ship_processing.php' && ($fedContainer = plotToFed($player, true)) !== true) {
                //We just bought a ship, we should head back to our trade gal/uno - we use HQ for now as it's both in our gal and a UNO, plus it's safe which is always a bonus
                processContainer($fedContainer);
            } else {
                if ($player->getShip()->isUnderAttack() === true && ($player->hasPlottedCourse() === false || $player->getPlottedCourse()->getEndSector()->offersFederalProtection() === false) && ($fedContainer == null ? $fedContainer = plotToFed($player, true) : $fedContainer) !== true) {
                    //We're under attack and need to plot course to fed.
                    // Get the lock, remove under attack and update.
                    acquire_lock($player->getSectorID());
                    $ship =& $player->getShip(true);
                    $ship->removeUnderAttack();
                    $ship->updateHardware();
                    release_lock();
                    debug('Under Attack');
                    $underAttack = true;
                    processContainer($fedContainer);
                } else {
                    if ($player->hasPlottedCourse() === true && $player->getPlottedCourse()->getEndSector()->offersFederalProtection()) {
                        //We have a route to fed to follow, figure it's probably a damned sensible thing to follow.
                        debug('Follow Course: ' . $player->getPlottedCourse()->getNextOnPath());
                        processContainer(moveToSector($player, $player->getPlottedCourse()->getNextOnPath()));
                    } else {
                        if (($container = canWeUNO($player, true)) !== false) {
                            //We have money and are at a uno, let's uno!
                            debug('We\'re UNOing');
                            processContainer($container);
                        } else {
                            if ($player->hasPlottedCourse() === true) {
                                //We have a route to follow, figure it's probably a sensible thing to follow.
                                debug('Follow Course: ' . $player->getPlottedCourse()->getNextOnPath());
                                processContainer(moveToSector($player, $player->getPlottedCourse()->getNextOnPath()));
                            } else {
                                if ($player->getTurns() < NPC_LOW_TURNS || $player->getTurns() < $player->getMaxTurns() / 2 && $player->getNewbieTurns() < NPC_LOW_NEWBIE_TURNS || $underAttack) {
                                    //We're low on turns or have been under attack and need to plot course to fed
                                    if ($player->getTurns() < NPC_LOW_TURNS) {
                                        debug('Low Turns:' . $player->getTurns());
                                    }
                                    if ($underAttack) {
                                        debug('Fedding after attack.');
                                    }
                                    if ($player->hasNewbieTurns()) {
                                        //We have newbie turns, we can just wait here.
                                        debug('We have newbie turns, let\'s just switch to another NPC.');
                                        changeNPCLogin();
                                    }
                                    if ($player->hasFederalProtection()) {
                                        debug('We are in fed, time to switch to another NPC.');
                                        changeNPCLogin();
                                    }
                                    $ship =& $player->getShip();
                                    processContainer(plotToFed($player, !$ship->hasMaxShields() || !$ship->hasMaxArmour() || !$ship->hasMaxCargoHolds()));
                                } else {
                                    if (($container = checkForShipUpgrade($player)) !== false) {
                                        //We have money and are at a uno, let's uno!
                                        debug('We\'re reshipping!');
                                        processContainer($container);
                                    } else {
                                        if (($container = canWeUNO($player, false)) !== false) {
                                            //We need to UNO and have enough money to do it properly so let's do it sooner rather than later.
                                            debug('We need to UNO, so off we go!');
                                            processContainer($container);
                                        } else {
                                            if ($TRADE_ROUTE instanceof Route) {
                                                debug('Trade Route');
                                                $forwardRoute =& $TRADE_ROUTE->getForwardRoute();
                                                $returnRoute =& $TRADE_ROUTE->getReturnRoute();
                                                if ($forwardRoute->getBuySectorId() == $player->getSectorID() || $returnRoute->getBuySectorId() == $player->getSectorID()) {
                                                    if ($forwardRoute->getBuySectorId() == $player->getSectorID()) {
                                                        $buyRoute =& $forwardRoute;
                                                        $sellRoute =& $returnRoute;
                                                    } else {
                                                        if ($returnRoute->getBuySectorId() == $player->getSectorID()) {
                                                            $buyRoute =& $returnRoute;
                                                            $sellRoute =& $forwardRoute;
                                                        }
                                                    }
                                                    $ship =& $player->getShip();
                                                    if ($ship->getUsedHolds() > 0) {
                                                        if ($ship->hasCargo($sellRoute->getGoodID())) {
                                                            //Sell goods
                                                            $goodID = $sellRoute->getGoodID();
                                                            $port =& $player->getSector()->getPort();
                                                            $tradeable = checkPortTradeable($port, $player);
                                                            if ($tradeable === true && $port->getGoodAmount($goodID) >= $ship->getCargo($sellRoute->getGoodID())) {
                                                                //TODO: Sell what we can rather than forcing sell all at once?
                                                                //Sell goods
                                                                debug('Sell Goods');
                                                                processContainer(tradeGoods($goodID, $player, $port));
                                                            } else {
                                                                //Move to next route or fed.
                                                                if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
                                                                    //									var_dump($TRADE_ROUTES);
                                                                    debug('Changing Route Failed');
                                                                    processContainer(plotToFed($player));
                                                                } else {
                                                                    debug('Route Changed');
                                                                    continue;
                                                                }
                                                            }
                                                        } else {
                                                            if ($ship->hasCargo($buyRoute->getGoodID()) === true) {
                                                                //We've bought goods, plot to sell
                                                                debug('Plot To Sell: ' . $buyRoute->getSellSectorId());
                                                                processContainer(plotToSector($player, $buyRoute->getSellSectorId()));
                                                            } else {
                                                                //Dump goods
                                                                debug('Dump Goods');
                                                                processContainer(dumpCargo($player));
                                                            }
                                                        }
                                                    } else {
                                                        //Buy goods
                                                        $goodID = $buyRoute->getGoodID();
                                                        $port =& $player->getSector()->getPort();
                                                        $tradeable = checkPortTradeable($port, $player);
                                                        if ($tradeable === true && $port->getGoodAmount($goodID) >= $ship->getEmptyHolds()) {
                                                            //Buy goods
                                                            debug('Buy Goods');
                                                            processContainer(tradeGoods($goodID, $player, $port));
                                                        } else {
                                                            //Move to next route or fed.
                                                            if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
                                                                //								var_dump($TRADE_ROUTES);
                                                                debug('Changing Route Failed');
                                                                processContainer(plotToFed($player));
                                                            } else {
                                                                debug('Route Changed');
                                                                continue;
                                                            }
                                                        }
                                                    }
                                                } else {
                                                    debug('Plot To Buy: ' . $forwardRoute->getBuySectorId());
                                                    processContainer(plotToSector($player, $forwardRoute->getBuySectorId()));
                                                }
                                            } else {
                                                //Something weird is going on.. Let's fed and wait.
                                                debug('No actual action? Wtf?');
                                                processContainer(plotToFed($player));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            /*
            else { //Otherwise let's run around at random.
            	$links = $player->getSector()->getLinks();
            	$moveTo = $links[array_rand($links)];
            	debug('Random Wanderings: '.$moveTo);
            	processContainer(moveToSector($player,$moveTo));
            }
            */
        } catch (Exception $e) {
            if ($e->getMessage() != 'Forward') {
                throw $e;
            }
            global $lock;
            if ($lock) {
                //only save if we have the lock.
                SmrSector::saveSectors();
                SmrShip::saveShips();
                SmrPlayer::savePlayers();
                SmrForce::saveForces();
                SmrPort::savePorts();
                if (class_exists('WeightedRandom', false)) {
                    WeightedRandom::saveWeightedRandoms();
                }
                release_lock();
            }
            //Clean up the caches as the data may get changed by other players
            clearCaches();
            //Clear up some global vars
            global $locksFailed;
            $locksFailed = array();
            $_REQUEST = array();
            //Have a sleep between actions
            sleepNPC();
        }
    }
    debug('Actions Finished.');
    exitNPC();
}
Esempio n. 15
0
					AND time>' . $db2->escapeNumber($db->getInt('sendtime')) . ' LIMIT 1');
        $threads[$i]['Unread'] = $db2->getNumRows() == 0;
        if ($db->getInt('sender_id') > 0) {
            $db2->query('SELECT
						player.player_name as player_name,
						alliance_thread.sender_id as sender_id
						FROM player
						JOIN alliance_thread ON alliance_thread.game_id = player.game_id AND player.account_id=alliance_thread.sender_id
						WHERE player.game_id=' . $db2->escapeNumber($player->getGameID()) . '
						AND alliance_thread.alliance_id=' . $db2->escapeNumber($alliance->getAllianceID()) . '
						AND alliance_thread.thread_id=' . $db2->escapeNumber($threadID) . '
						AND alliance_thread.reply_id=1 LIMIT 1
						');
            if ($db2->nextRecord()) {
                $sender_id = $db2->getInt('sender_id');
                $author =& SmrPlayer::getPlayer($sender_id, $player->getGameID());
                $playerName = $author->getLinkedDisplayName(false);
            } else {
                $playerName = 'Unknown';
            }
        } else {
            $sender_id = $db->getInt('sender_id');
            if ($sender_id == 0) {
                $playerName = 'Planet Reporter';
            }
            if ($sender_id == -1) {
                $playerName = 'Bank Reporter';
            }
            if ($sender_id == -2) {
                $playerName = 'Forces Reporter';
            }
Esempio n. 16
0
	FROM alliance_bank_transactions
	WHERE game_id=' . $db->escapeNumber($alliance->getGameID()) . '
	AND alliance_id=' . $db->escapeNumber($alliance->getAllianceID());
if ($maxValue > 0 && $minValue > 0) {
    $query .= ' AND transaction_id>=' . $db->escapeNumber($minValue) . '
				AND transaction_id<=' . $db->escapeNumber($maxValue) . '
				ORDER BY time LIMIT ' . (1 + $maxValue - $minValue);
} else {
    $query .= ' ORDER BY time LIMIT 10';
}
$db->query($query);
// only if we have at least one result
if ($db->getNumRows() > 0) {
    $bankTransactions = array();
    while ($db->nextRecord()) {
        $bankTransactions[$db->getInt('transaction_id')] = array('Time' => $db->getInt('time'), 'Player' => SmrPlayer::getPlayer($db->getInt('payee_id'), $player->getGameID()), 'Reason' => $db->getField('reason'), 'TransactionType' => $db->getField('transaction'), 'Withdrawal' => $db->getField('transaction') == 'Payment' ? $db->getInt('amount') : '', 'Deposit' => $db->getField('transaction') == 'Deposit' ? $db->getInt('amount') : '', 'Exempt' => $db->getInt('exempt') == 1);
    }
    $template->assignByRef('BankTransactions', $bankTransactions);
    $template->assign('MinValue', $minValue);
    $template->assign('MaxValue', $maxValue);
    $container = create_container('skeleton.php', 'bank_alliance.php');
    $container['alliance_id'] = $alliance->getAllianceID();
    $template->assign('FilterTransactionsFormHREF', SmrSession::getNewHREF($container));
    $container = create_container('bank_alliance_exempt_processing.php');
    $container['minVal'] = $minValue;
    $container['maxVal'] = $maxValue;
    $template->assign('ExemptTransactionsFormHREF', SmrSession::getNewHREF($container));
    $template->assignByRef('Alliance', $alliance);
}
$container = create_container('skeleton.php', 'bank_report.php');
$container['alliance_id'] = $alliance->getAllianceID();
Esempio n. 17
0
 function getParticipantName($accountID, $sectorID)
 {
     global $player;
     if ($accountID == ACCOUNT_ID_PORT) {
         return '<a href="' . Globals::getPlotCourseHREF($player->getSectorID(), $sectorID) . '">Port <span class="sectorColour">#' . $sectorID . '</span></a>';
     }
     if ($accountID == ACCOUNT_ID_PLANET) {
         return '<span class="yellow">Planetary Defenses</span>';
     }
     return SmrPlayer::getPlayer($accountID, $player->getGameID())->getLinkedDisplayName(false);
 }
<?php

require_once get_file_loc('hof.functions.inc');
if (isset($var['account_id'])) {
    $account_id = $var['account_id'];
} else {
    $account_id = $account->getAccountID();
}
$game_id = null;
if (isset($var['game_id'])) {
    $game_id = $var['game_id'];
}
$base = array();
if (isset($var['game_id'])) {
    try {
        $hofPlayer =& SmrPlayer::getPlayer($account_id, $var['game_id']);
    } catch (Exception $e) {
        create_error('That player has not yet joined this game.');
    }
    $template->assign('PageTopic', $hofPlayer->getPlayerName() . '\'s Personal Hall of Fame For ' . Globals::getGameName($var['game_id']));
} else {
    $template->assign('PageTopic', $account->getHofName() . '\'s All Time Personal Hall of Fame');
}
$PHP_OUTPUT .= '<div class="center">';
$allowedVisibities = array(HOF_PUBLIC);
if ($account->getAccountID() == $account_id) {
    $allowedVisibities[] = HOF_ALLIANCE;
    $allowedVisibities[] = HOF_PRIVATE;
} else {
    if (isset($hofPlayer) && $hofPlayer->sameAlliance($player)) {
        $allowedVisibities[] = HOF_ALLIANCE;
Esempio n. 19
0
<?php

if (isset($var['owner_id'])) {
    $owner =& SmrPlayer::getPlayer($var['owner_id'], $player->getGameID());
    $template->assign('PageTopic', 'Change ' . $owner->getPlayerName() . '\'s Forces');
    $owner_id = $var['owner_id'];
} else {
    $template->assign('PageTopic', 'Drop Forces');
    $owner_id = $player->getAccountID();
}
require_once get_file_loc('SmrForce.class.inc');
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $owner_id);
$container = array();
$container['url'] = 'forces_drop_processing.php';
$container['owner_id'] = $owner_id;
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= create_table();
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th align="center">Force</th>';
$PHP_OUTPUT .= '<th align="center">On Ship</th>';
$PHP_OUTPUT .= '<th align="center">In Sector</th>';
$PHP_OUTPUT .= '<th align="center">Drop</th>';
$PHP_OUTPUT .= '<th align="center">Take</th>';
$PHP_OUTPUT .= '</tr>';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<td align="center">Mines</td>';
$PHP_OUTPUT .= '<td align="center">' . $ship->getMines() . '</td>';
$PHP_OUTPUT .= '<td align="center">' . $forces->getMines() . '</td>';
$PHP_OUTPUT .= '<td align="center"><input type="number" name="drop_mines" min="0" max="50" value="0" id="InputFields" style="width:100px;" class="center"></td>';
$PHP_OUTPUT .= '<td align="center"><input type="number" name="take_mines" min="0" max="50" value="0" id="InputFields" style="width:100px;" class="center"></td>';
$PHP_OUTPUT .= '</tr>';
Esempio n. 20
0
<?php

header('Content-Type: text/plain; charset=ISO-8859-1');
header('Content-Disposition: attachment; filename="Game.ini"');
header('Content-transfer-encoding: base64');
$game_id = $_REQUEST['game_id'];
echo '[Settings]' . EOL;
echo 'Name=' . Globals::getGameName($game_id) . EOL;
echo 'ID=' . $game_id . EOL . EOL;
echo '[Galaxy]' . EOL;
$gameGals =& SmrGalaxy::getGameGalaxies($game_id);
foreach ($gameGals as &$gameGal) {
    echo $gameGal->getName() . '=' . $gameGal->getWidth() . ';' . $gameGal->getHeight() . EOL;
}
unset($gameGal);
// expire all forces first
$db->query('DELETE FROM sector_has_forces WHERE expire_time < ' . TIME);
echo EOL . '[Marks]' . EOL;
$db->query('SELECT * FROM sector_has_forces WHERE game_id = ' . $game_id . ' GROUP BY sector_id ORDER BY sector_id');
while ($db->nextRecord()) {
    $owner =& SmrPlayer::getPlayer($db->getField('owner_id'), $game_id);
    $user =& SmrPlayer::getPlayer($account->getAccountID(), $game_id);
    $sector = $db->getField('sector_id');
    if ($owner->sameAlliance($user)) {
        echo $sector . '=2' . EOL;
    } else {
        echo $sector . '=1' . EOL;
    }
}
Esempio n. 21
0
}
// get values from container
$amount = $var['amount'];
$smrCredits = $var['SmrCredits'];
$account_id = $var['account_id'];
if (!is_numeric($amount) && !is_numeric($smrCredits) || $amount == 0 && $smrCredits == 0) {
    create_error('You must enter an amount!');
}
if ($amount < 0) {
    create_error('You must enter a positive amount!');
}
if ($smrCredits < 0) {
    create_error('You must enter a positive SMR credits amount!');
}
// take the bounty from the cash
$player->decreaseCredits($amount);
$account->decreaseSmrCredits($smrCredits);
$player->increaseHOF($smrCredits, array('Bounties', 'Placed', 'SMR Credits'), HOF_PUBLIC);
$player->increaseHOF($amount, array('Bounties', 'Placed', 'Money'), HOF_PUBLIC);
$player->increaseHOF(1, array('Bounties', 'Placed', 'Number'), HOF_PUBLIC);
$placed =& SmrPlayer::getPlayer($account_id, $player->getGameID());
$placed->increaseCurrentBountyAmount($type, $amount);
$placed->increaseCurrentBountySmrCredits($type, $smrCredits);
$placed->increaseHOF($smrCredits, array('Bounties', 'Received', 'SMR Credits'), HOF_PUBLIC);
$placed->increaseHOF($amount, array('Bounties', 'Received', 'Money'), HOF_PUBLIC);
$placed->increaseHOF(1, array('Bounties', 'Received', 'Number'), HOF_PUBLIC);
//Update for top bounties list
$player->update();
$account->update();
$placed->update();
forward($container);
Esempio n. 22
0
<?php

if (!$player->isLandedOnPlanet()) {
    create_error('You are not on a planet!');
}
$planet =& $player->getSectorPlanet();
$planetPlayer =& SmrPlayer::getPlayer($var['account_id'], $player->getGameID());
$owner =& $planet->getOwner();
if ($owner->getAllianceID() != $player->getAllianceID()) {
    create_error('You can not kick someone off a planet your alliance does not own!');
}
$message = 'You have been kicked from ' . $planet->getName() . ' in ' . Globals::getSectorBBLink($player->getSectorID());
$player->sendMessage($planetPlayer->getAccountID(), 2, $message, false);
$planetPlayer->setLandedOnPlanet(false);
$planetPlayer->setKicked(true);
$planetPlayer->update();
forward(create_container('skeleton.php', 'planet_main.php'));
create_galactic_post_menu();
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'galactic_post_view_members.php';
if ($action == 'Remove') {
    $db->query('DELETE FROM galactic_post_writer WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND account_id = ' . $db->escapeNumber($var['id']));
}
$db->query('SELECT * FROM galactic_post_writer WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND account_id != ' . $db->escapeNumber($player->getAccountID()));
if ($db->getNumRows()) {
    $PHP_OUTPUT .= create_table();
    $PHP_OUTPUT .= '<tr>';
    $PHP_OUTPUT .= '<th align="center">Player Name</th>';
    $PHP_OUTPUT .= '<th align="center">Last Wrote</th>';
    $PHP_OUTPUT .= '<th align="center">Options</th>';
    $PHP_OUTPUT .= '</tr>';
    while ($db->nextRecord()) {
        $curr_writter =& SmrPlayer::getPlayer($db->getField('account_id'), $player->getGameID());
        $time = $db->getField('last_wrote');
        $PHP_OUTPUT .= '<tr>';
        $PHP_OUTPUT .= '<td align="center">' . $curr_writter->getPlayerName() . '</td>';
        $PHP_OUTPUT .= '<td align="center"> ' . date(DATE_FULL_SHORT, $time) . '</td>';
        $container['id'] = $curr_writter->getAccountID();
        $PHP_OUTPUT .= create_echo_form($container);
        $PHP_OUTPUT .= '<td>';
        $PHP_OUTPUT .= create_submit('Remove');
        $PHP_OUTPUT .= '</td>';
        $PHP_OUTPUT .= '</tr>';
        $PHP_OUTPUT .= '</form>';
    }
    $PHP_OUTPUT .= '</table>';
}
Esempio n. 24
0
    $template->assign('NextThread', array('Topic' => $var['thread_topics'][$thread_index + 1], 'Href' => SmrSession::getNewHREF($container)));
}
$thread = array();
$thread['AllianceEyesOnly'] = is_array($var['alliance_eyes']) && $var['alliance_eyes'][$thread_index];
//for report type (system sent) messages
$players[ACCOUNT_ID_PLANET] = 'Planet Reporter';
$players[ACCOUNT_ID_BANK_REPORTER] = 'Bank Reporter';
$players[-2] = 'Forces Reporter';
$players[-3] = 'Game Admins';
$db->query('SELECT account_id
			FROM player
			JOIN alliance_thread USING (game_id)
			WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
				AND alliance_thread.alliance_id = ' . $db->escapeNumber($alliance->getAllianceID()) . ' AND alliance_thread.thread_id = ' . $db->escapeNumber($thread_id));
while ($db->nextRecord()) {
    $players[$db->getInt('account_id')] = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID())->getLinkedDisplayName(false);
}
$db->query('SELECT mb_messages FROM player_has_alliance_role JOIN alliance_has_roles USING(game_id,alliance_id,role_id) WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . ' LIMIT 1');
$db->nextRecord();
$thread['CanDelete'] = $db->getBoolean('mb_messages');
$db->query('SELECT text, sender_id, time, reply_id
FROM alliance_thread
WHERE game_id=' . $db->escapeNumber($player->getGameID()) . '
AND alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . '
AND thread_id=' . $db->escapeNumber($thread_id) . '
ORDER BY reply_id LIMIT ' . $var['thread_replies'][$thread_index]);
$thread['CanDelete'] = $db->getNumRows() > 1 && $thread['CanDelete'];
$thread['Replies'] = array();
$container = create_container('alliance_message_delete_processing.php', '', $var);
$container['thread_id'] = $thread_id;
while ($db->nextRecord()) {
Esempio n. 25
0
     }
 } else {
     if (isset($_REQUEST['galaxy_id'])) {
         $galaxyID = $_REQUEST['galaxy_id'];
         if (!is_numeric($galaxyID)) {
             header('location: ' . URL . '/error.php?msg=Galaxy id was not a number.');
         }
         try {
             $galaxy =& SmrGalaxy::getGalaxy(SmrSession::$game_id, $galaxyID);
         } catch (Exception $e) {
             header('location: ' . URL . '/error.php?msg=Invalid galaxy id');
             exit;
         }
     }
 }
 $player =& SmrPlayer::getPlayer(SmrSession::$account_id, SmrSession::$game_id);
 // create account object
 $account =& $player->getAccount();
 if (!isset($galaxyID) && !isset($sectorID)) {
     $galaxy =& SmrGalaxy::getGalaxyContaining(SmrSession::$game_id, $player->getSectorID());
 }
 if (isset($sectorID) || $account->isCenterGalaxyMapOnPlayer()) {
     if (isset($sectorID)) {
         $topLeft =& SmrSector::getSector($player->getGameID(), $sectorID);
     } else {
         $topLeft =& $player->getSector();
     }
     if (!$galaxy->contains($topLeft->getSectorID())) {
         $topLeft =& SmrSector::getSector($player->getGameID(), $galaxy->getStartSector());
     } else {
         $template->assign('FocusSector', $topLeft->getSectorID());
    $container['id'] = $appliee->getAccountID();
    $PHP_OUTPUT .= create_link($container, '<span class="yellow">' . $appliee->getPlayerName() . '</span>');
    $PHP_OUTPUT .= ' who has ';
    if ($db->getField('written_before') == 'YES') {
        $PHP_OUTPUT .= 'written for some kind of a newspaper before.';
    } else {
        $PHP_OUTPUT .= 'not written for a newspaper before.';
    }
    $PHP_OUTPUT .= '<br />';
}
$PHP_OUTPUT .= '<br /><br />';
if (isset($var['id'])) {
    $db->query('SELECT * FROM galactic_post_applications WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND account_id = ' . $db->escapeNumber($var['id']));
    $db->nextRecord();
    $desc = stripslashes($db->getField('description'));
    $applie =& SmrPlayer::getPlayer($var['id'], $player->getGameID());
    $PHP_OUTPUT .= 'Name : ' . $applie->getPlayerName() . '<br />';
    $PHP_OUTPUT .= 'Have you written for some kind of newspaper before? ' . $db->getField('written_before');
    $PHP_OUTPUT .= '<br />';
    $PHP_OUTPUT .= 'How many articles are you willing to write per week? ' . $db->getField('articles_per_day');
    $PHP_OUTPUT .= '<br />';
    $PHP_OUTPUT .= 'What do you want to tell the editor?<br /><br />' . $desc;
    $container = array();
    $container['url'] = 'galactic_post_application_answer.php';
    transfer('id');
    $PHP_OUTPUT .= create_echo_form($container);
    $PHP_OUTPUT .= '<br /><br />';
    $PHP_OUTPUT .= create_submit('Accept');
    $PHP_OUTPUT .= create_submit('Reject');
    $PHP_OUTPUT .= '</form>';
}
Esempio n. 27
0
function displayMessage(&$messageBox, $message_id, $receiver_id, $sender_id, $message_text, $send_time, $msg_read, $type, $sentMessage = false)
{
    require_once get_file_loc('message.functions.inc');
    global $player, $account;
    $message = array();
    $sender = false;
    $senderName =& getMessagePlayer($sender_id, $player->getGameID(), $type);
    if ($senderName instanceof SmrPlayer) {
        $sender =& $senderName;
        unset($senderName);
        $replace = explode('?', $message_text);
        foreach ($replace as $key => $timea) {
            if ($sender_id > 0 && $timea != '' && ($final = strtotime($timea)) !== false) {
                //WARNING: Expects PHP 5.1.0 or later
                $send_acc =& $sender->getAccount();
                $final += $account->getOffset() * 3600 - $send_acc->getOffset() * 3600;
                $message_text = str_replace('?' . $timea . '?', date(DATE_FULL_SHORT, $final), $message_text);
            }
        }
        $container = create_container('skeleton.php', 'trader_search_result.php');
        $container['player_id'] = $sender->getPlayerID();
        $senderName =& create_link($container, $sender->getDisplayName());
    }
    $container = create_container('skeleton.php', 'message_notify_confirm.php');
    $container['message_id'] = $message_id;
    $container['sent_time'] = $send_time;
    $message['ReportHref'] = SmrSession::getNewHREF($container);
    if (is_object($sender)) {
        $container = create_container('skeleton.php', 'message_blacklist_add.php');
        $container['account_id'] = $sender_id;
        $message['BlacklistHref'] = SmrSession::getNewHREF($container);
        $container = create_container('skeleton.php', 'message_send.php');
        $container['receiver'] = $sender->getAccountID();
        $message['ReplyHref'] = SmrSession::getNewHREF($container);
        $message['Sender'] =& $sender;
    }
    $message['ID'] = $message_id;
    $message['Text'] = $message_text;
    $message['SenderDisplayName'] = $senderName;
    $receiver =& SmrPlayer::getPlayer($receiver_id, $player->getGameID());
    if ($sentMessage && is_object($receiver)) {
        $container = create_container('skeleton.php', 'trader_search_result.php');
        $container['player_id'] = $receiver->getPlayerID();
        $message['ReceiverDisplayName'] = create_link($container, $receiver->getDisplayName());
    }
    $message['Unread'] = $msg_read == 'FALSE';
    $message['SendTime'] = $send_time;
    $messageBox['Messages'][] =& $message;
}
Esempio n. 28
0
    }
    if ($HasHQBounty) {
        ?>
<br /><br /><br /><?php 
    }
    foreach ($Bounties as $Bounty) {
        if ($Bounty['Type'] == 'UG') {
            ?>
			The <span class="red">Underground</span> is offering a bounty on <?php 
            echo $BountyPlayer->getPlayerName();
            ?>
 worth <span class="creds"><?php 
            echo $Bounty['Amount'];
            ?>
</span> credits and <span class="yellow"><?php 
            echo $Bounty['SmrCredits'];
            ?>
</span> SMR credits.<br /><?php 
            if ($Bounty['Claimer'] != 0) {
                ?>
This bounty can be claimed by <?php 
                echo SmrPlayer::getPlayer($Bounty['Claimer'], $ThisPlayer->getGameID())->getPlayerName();
                ?>
<br /><?php 
            }
        }
    }
} else {
    ?>
This player has no bounties<br /><?php 
}
$db2 = new SmrMySqlDatabase();
if (isset($var['news'])) {
    $db->query('INSERT INTO news (game_id, time, news_message, type) ' . 'VALUES(' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber(TIME) . ', ' . $db->escape_string($var['news'], false) . ', \'BREAKING\')');
}
$db->query('SELECT * FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()));
if ($db->getNumRows()) {
    $PHP_OUTPUT .= 'It is your responsibility to make sure ALL HTML tags are closed!<br />';
    $PHP_OUTPUT .= 'You have the following articles to view.<br /><br />';
} else {
    $PHP_OUTPUT .= 'There are no articles to view';
}
while ($db->nextRecord()) {
    $db2->query('SELECT * FROM galactic_post_paper_content WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($db->getInt('article_id')));
    if (!$db2->nextRecord()) {
        $title = stripslashes($db->getField('title'));
        $writter =& SmrPlayer::getPlayer($db->getField('writer_id'), $player->getGameID());
        $container = array();
        $container['url'] = 'skeleton.php';
        $container['body'] = 'galactic_post_view_article.php';
        $container['id'] = $db->getField('article_id');
        $PHP_OUTPUT .= create_link($container, '<span class="yellow">' . $title . '</span> written by ' . $writter->getPlayerName());
        $PHP_OUTPUT .= '<br />';
    }
}
$PHP_OUTPUT .= '<br /><br />';
if (isset($var['id'])) {
    $db->query('SELECT * FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($var['id']));
    $db->nextRecord();
    $title = stripslashes($db->getField('title'));
    $message = stripslashes($db->getField('text'));
    $PHP_OUTPUT .= $title;
Esempio n. 30
0
$CouncilMembers = Council::getRaceCouncil($ThisPlayer->getGameID(), $RaceID);
if (count($CouncilMembers) > 0) {
    ?>
		<table id="council-members" class="standard" width="85%">
			<thead>
				<tr>
					<th>&nbsp;</th>
					<th class="sort" data-sort="name">Name</th>
					<th>Race</th>
					<th class="sort" data-sort="alliance">Alliance</th>
					<th class="sort" data-sort="experience">Experience</th>
				</tr>
			</thead>
			<tbody class="list"><?php 
    foreach ($CouncilMembers as $Ranking => $AccountID) {
        $CouncilPlayer =& SmrPlayer::getPlayer($AccountID, $ThisPlayer->getGameID());
        ?>
					<tr id="player-<?php 
        echo $CouncilPlayer->getPlayerID();
        ?>
" class="ajax<?php 
        if ($ThisPlayer->equals($CouncilPlayer)) {
            ?>
 bold<?php 
        }
        ?>
">
						<td class="right"><?php 
        echo $Ranking;
        ?>
</td>