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>';
}
    $container['raidAssist'] = $raidAssist;
    $container['traderDefend'] = $traderDefend;
    $container['traderNAP'] = $traderNAP;
    $container['planetNAP'] = $planetNAP;
    $container['forcesNAP'] = $forcesNAP;
    $container['aaAccess'] = $aaAccess;
    $container['mbRead'] = $mbRead;
    $container['mbWrite'] = $mbWrite;
    $container['modRead'] = $modRead;
    $container['planetLand'] = $planetLand;
    $PHP_OUTPUT .= create_button($container, 'Yes');
    $PHP_OUTPUT .= '&nbsp;';
    $container = create_container('skeleton.php', 'alliance_treaties.php');
    $container['alliance_id'] = $alliance_id_1;
    $PHP_OUTPUT .= create_button($container, 'No');
    $PHP_OUTPUT .= '</div>';
} else {
    $alliance_id_2 = $var['proposedAlliance'];
    $db->query('INSERT INTO alliance_treaties (alliance_id_1,alliance_id_2,game_id,trader_assist,trader_defend,trader_nap,raid_assist,planet_land,planet_nap,forces_nap,aa_access,mb_read,mb_write,mod_read,official)
				VALUES (' . $db->escapeNumber($alliance_id_1) . ', ' . $db->escapeNumber($alliance_id_2) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeBoolean($var['traderAssist']) . ', ' . $db->escapeBoolean($var['traderDefend']) . ', ' . $db->escapeNumber($var['traderNAP']) . ', ' . $db->escapeBoolean($var['raidAssist']) . ', ' . $db->escapeBoolean($var['planetLand']) . ', ' . $db->escapeBoolean($var['planetNAP']) . ', ' . $db->escapeBoolean($var['forcesNAP']) . ', ' . $db->escapeBoolean($var['aaAccess']) . ', ' . $db->escapeBoolean($var['mbRead']) . ', ' . $db->escapeBoolean($var['mbWrite']) . ', ' . $db->escapeBoolean($var['modRead']) . ', \'FALSE\')');
    //send a message to the leader letting them know the offer is waiting.
    $db->query('SELECT leader_id FROM alliance WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND alliance_id=' . $db->escapeNumber($alliance_id_2) . ' LIMIT 1');
    $db->nextRecord();
    $leader_2 = $db->getField('leader_id');
    $message = 'An ambassador from <span class="yellow">' . $alliance1->getAllianceName() . '</span> has arrived.';
    SmrPlayer::sendMessageFromAllianceAmbassador($player->getGameID(), $leader_2, $message, MESSAGE_EXPIRES);
    $container = create_container('skeleton.php', 'alliance_treaties.php');
    $container['alliance_id'] = $alliance_id_1;
    $container['message'] = 'The treaty offer has been sent.';
    forward($container);
}
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'));
Esempio n. 5
0
<?php

$message = trim($_REQUEST['message']);
if ($_REQUEST['action'] == 'Preview message') {
    $container = create_container('skeleton.php', 'box_reply.php');
    $container['BanPoints'] = $_REQUEST['BanPoints'];
    transfer('game_id');
    transfer('sender_id');
    $container['Preview'] = $message;
    forward($container);
}
if (!empty($message)) {
    SmrPlayer::sendMessageFromAdmin($var['game_id'], $var['sender_id'], $_REQUEST['message']);
    //do we have points?
    if ($_REQUEST['BanPoints']) {
        $suspicion = 'Inappropriate Actions';
        $senderAccount =& SmrAccount::getAccount($var['sender_id']);
        $senderAccount->addPoints($_REQUEST['BanPoints'], $account, 7, $suspicion);
    }
}
forward(create_container('skeleton.php', 'box_view.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>';
}
}
// 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);
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 {
<?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'));
<?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. 11
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. 12
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. 13
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. 14
0
	WHERE alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . '
	AND game_id = ' . $db->escapeNumber($alliance->getGameID()) . '
	GROUP BY alliance_id');
$db->nextRecord();
$template->assign('AllianceExp', $db->getInt('alliance_xp'));
$template->assign('AllianceAverageExp', $db->getInt('alliance_avg'));
if ($account->getAccountID() == $alliance->getLeaderID() || $account->hasPermission(PERMISSION_EDIT_ALLIANCE_DESCRIPTION)) {
    $container = create_container('skeleton.php', 'alliance_stat.php');
    $container['alliance_id'] = $alliance->getAllianceID();
    $template->assign('EditAllianceDescriptionHREF', SmrSession::getNewHREF($container));
}
$db->query('SELECT 1 FROM alliance_has_roles WHERE alliance_id = ' . $db->escapeNumber($alliance->getAllianceID()) . ' AND game_id = ' . $db->escapeNumber($alliance->getGameID()) . '
			AND role_id = ' . $db->escapeNumber($player->getAllianceRole()) . ' AND change_roles = \'TRUE\'');
$allowed = $db->nextRecord();
$template->assign('CanChangeRoles', $allowed);
$alliancePlayers =& SmrPlayer::getAlliancePlayers($player->getGameID(), $alliance->getAllianceID());
$template->assignByRef('AlliancePlayers', $alliancePlayers);
if ($alliance->getAllianceID() == $player->getAllianceID()) {
    // Alliance members get to see active/inactive status of members
    $template->assign('ActiveIDs', $alliance->getActiveIDs());
    $container = create_container('skeleton.php', 'alliance_roster.php');
    if ($showRoles) {
        $container['action'] = 'Hide Alliance Roles';
    } else {
        $container['action'] = 'Show Alliance Roles';
    }
    $template->assign('ToggleRolesHREF', SmrSession::getNewHREF($container));
}
$canJoin = $alliance->canJoinAlliance($player);
$template->assign('CanJoin', $canJoin);
if ($canJoin === true) {
Esempio n. 15
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. 16
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. 17
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. 18
0
}
$smrCredits = round($smrCredits);
if ($account->getSmrCredits() < $smrCredits) {
    create_error('You dont have that many SMR credits.');
}
if ($amount <= 0 && $smrCredits <= 0) {
    create_error('You must enter an amount greater than 0!');
}
if (empty($amount) && empty($smrCredits) || empty($playerID)) {
    create_error('Don\'t you want to place bounty?');
}
$template->assign('PageTopic', 'Placing a bounty');
require_once get_file_loc('menu.inc');
if ($sector->hasHQ()) {
    create_hq_menu();
} else {
    create_ug_menu();
}
// get this guy from db
$bounty_guy =& SmrPlayer::getPlayerByPlayerID($playerID, $player->getGameID());
$PHP_OUTPUT .= 'Are you sure you want to place a <span class="creds">' . number_format($amount) . '</span> credits and <span class="yellow">' . number_format($smrCredits) . '</span> SMR credits bounty on ' . $bounty_guy->getLinkedDisplayName() . '?';
$container = create_container('bounty_place_processing.php');
$container['account_id'] = $bounty_guy->getAccountID();
$container['amount'] = $amount;
$container['SmrCredits'] = $smrCredits;
transfer('LocationID');
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= create_submit('Yes');
$PHP_OUTPUT .= '&nbsp;&nbsp;';
$PHP_OUTPUT .= create_submit('No');
$PHP_OUTPUT .= '</form>';
Esempio n. 19
0
<?php

require_once get_file_loc('ChessGame.class.inc');
if (!is_numeric($_REQUEST['player_id'])) {
    create_error('You must select a player.');
}
ChessGame::insertNewGame(TIME, null, $player, SmrPlayer::getPlayerByPlayerID($_REQUEST['player_id'], $player->getGameID()));
forward(create_container('skeleton.php', 'chess.php'));
    $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. 21
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++) {
Esempio n. 22
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 
}
<?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. 24
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. 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());
}
unset($attacker);
$results['Attackers']['Downgrades'] = $planet->checkForDowngrade($results['Attackers']['TotalDamage']);
$results['Planet'] =& $planet->shootPlayers($attackers);
$account->log(LOG_TYPE_PLANET_BUSTING, 'Player attacks planet, the planet does ' . $results['Planet']['TotalDamage'] . ', their team does ' . $results['Attackers']['TotalDamage'] . ' and downgrades: ' . var_export($results['Attackers']['Downgrades'], true), $planet->getSectorID());
$ship->removeUnderAttack();
//Don't show attacker the under attack message.
$planetAttackMessage = 'Reports from the surface of ' . $planet->getDisplayName() . ' confirm that it is under <span class="red">attack</span>!';
if ($planetOwner->hasAlliance()) {
    $db->query('SELECT account_id FROM player WHERE game_id=' . $planetOwner->getGameID() . ' AND alliance_id=' . $planetOwner->getAllianceID());
    //No limit in case they are over limit - ie NHA
    while ($db->nextRecord()) {
        SmrPlayer::sendMessageFromPlanet($planet->getGameID(), $db->getField('account_id'), $planetAttackMessage);
    }
} else {
    SmrPlayer::sendMessageFromPlanet($planet->getGameID(), $planetOwner->getAccountID(), $planetAttackMessage);
}
$serializedResults = serialize($results);
$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'PLANET\',' . $planet->getSectorID() . ',' . TIME . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $planetOwner->getAccountID() . ',' . $planetOwner->getAllianceID() . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
unserialize($serializedResults);
//because of references we have to undo this.
$logId = $db->escapeString('[ATTACK_RESULTS]' . $db->getInsertID());
foreach ($attackers as &$attacker) {
    if (!$player->equals($attacker)) {
        $db->query('REPLACE INTO sector_message VALUES(' . $attacker->getAccountID() . ',' . $attacker->getGameID() . ',' . $logId . ')');
    }
}
unset($attacker);
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'planet_attack.php';
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
 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);
 }
$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
<?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']);
}