-
-{$this->method}
-
-
-EOD;
- foreach ($this->args as $arg) {
- $this->xml .= '';
- $v = new IXR_Value($arg);
- $this->xml .= $v->getXml();
- $this->xml .= "";
- }
- $this->xml .= '';
- }
- function getLength() {
- return strlen($this->xml);
- }
- function getXml() {
- return $this->xml;
- }
-}
-
-
-class IXR_Client {
- var $server;
- var $port;
- var $path;
- var $useragent;
- var $response;
- var $message = false;
- var $debug = false;
- // Storage place for an error message
- var $error = false;
- function IXR_Client($server, $path = false, $port = 80) {
- if (!$path) {
- // Assume we have been given a URL instead
- $bits = parse_url($server);
- $this->server = $bits['host'];
- $this->port = isset($bits['port']) ? $bits['port'] : 80;
- $this->path = isset($bits['path']) ? $bits['path'] : '/';
- // Make absolutely sure we have a path
- if (!$this->path) {
- $this->path = '/';
- }
- } else {
- $this->server = $server;
- $this->path = $path;
- $this->port = $port;
- }
- $this->useragent = 'The Incutio XML-RPC PHP Library';
- }
- function query() {
- $args = func_get_args();
- $method = array_shift($args);
- $request = new IXR_Request($method, $args);
- $length = $request->getLength();
- $xml = $request->getXml();
- $r = "\r\n";
- $request = "POST {$this->path} HTTP/1.0$r";
- $request .= "Host: {$this->server}$r";
- $request .= "Content-Type: text/xml$r";
- $request .= "User-Agent: {$this->useragent}$r";
- $request .= "Content-length: {$length}$r$r";
- $request .= $xml;
- // Now send the request
- if ($this->debug) {
- echo ''.htmlspecialchars($request)."\n
\n\n";
- }
- $fp = @fsockopen($this->server, $this->port);
- if (!$fp) {
- $this->error = new IXR_Error(-32300, 'transport error - could not open socket');
- return false;
- }
- fputs($fp, $request);
- $contents = '';
- $gotFirstLine = false;
- $gettingHeaders = true;
- while (!feof($fp)) {
- $line = fgets($fp, 4096);
- if (!$gotFirstLine) {
- // Check line for '200'
- if (strstr($line, '200') === false) {
- $this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200');
- return false;
- }
- $gotFirstLine = true;
- }
- if (trim($line) == '') {
- $gettingHeaders = false;
- }
- if (!$gettingHeaders) {
- $contents .= trim($line)."\n";
- }
- }
- if ($this->debug) {
- echo ''.htmlspecialchars($contents)."\n
\n\n";
- }
- // Now parse what we've got back
- $this->message = new IXR_Message($contents);
- if (!$this->message->parse()) {
- // XML error
- $this->error = new IXR_Error(-32700, 'parse error. not well formed');
- return false;
- }
- // Is the message a fault?
- if ($this->message->messageType == 'fault') {
- $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
- return false;
- }
- // Message must be OK
- return true;
- }
- function getResponse() {
- // methodResponses can only have one param - return that
- return $this->message->params[0];
- }
- function isError() {
- return (is_object($this->error));
- }
- function getErrorCode() {
- return $this->error->code;
- }
- function getErrorMessage() {
- return $this->error->message;
- }
-}
-
-
-class IXR_Error {
- var $code;
- var $message;
- function IXR_Error($code, $message) {
- $this->code = $code;
- $this->message = $message;
- }
- function getXml() {
- $xml = <<
-
-
-
-
- faultCode
- {$this->code}
-
-
- faultString
- {$this->message}
-
-
-
-
-
-
-EOD;
- return $xml;
- }
-}
-
-
-class IXR_Date {
- var $year;
- var $month;
- var $day;
- var $hour;
- var $minute;
- var $second;
- function IXR_Date($time) {
- // $time can be a PHP timestamp or an ISO one
- if (is_numeric($time)) {
- $this->parseTimestamp($time);
- } else {
- $this->parseIso($time);
- }
- }
- function parseTimestamp($timestamp) {
- $this->year = date('Y', $timestamp);
- $this->month = date('Y', $timestamp);
- $this->day = date('Y', $timestamp);
- $this->hour = date('H', $timestamp);
- $this->minute = date('i', $timestamp);
- $this->second = date('s', $timestamp);
- }
- function parseIso($iso) {
- $this->year = substr($iso, 0, 4);
- $this->month = substr($iso, 4, 2);
- $this->day = substr($iso, 6, 2);
- $this->hour = substr($iso, 9, 2);
- $this->minute = substr($iso, 12, 2);
- $this->second = substr($iso, 15, 2);
- }
- function getIso() {
- return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second;
- }
- function getXml() {
- return ''.$this->getIso().'';
- }
- function getTimestamp() {
- return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
- }
-}
-
-class LLBlock {
- var $data;
- var $xml;
-
- function LLBlock($data) {
- $this->data = $data;
- }
-
- function getXml() {
- if(count($this->data)>0) {
- $this->xml="";
- foreach($this->data as $name => $value) {
- $this->xml=$this->xml."".$name."".$value."";
- }
- $this->xml=$this->xml."";
- return $this->xml;
- }
- }
-}
-
-class IXR_Base64 {
- var $data;
- function IXR_Base64($data) {
- $this->data = $data;
- }
- function getXml() {
- return ''.base64_encode($this->data).'';
- }
-}
-
-
-class IXR_IntrospectionServer extends IXR_Server {
- var $signatures;
- var $help;
- function IXR_IntrospectionServer() {
- $this->setCallbacks();
- $this->setCapabilities();
- $this->capabilities['introspection'] = array(
- 'specUrl' => 'http://xmlrpc.usefulinc.com/doc/reserved.html',
- 'specVersion' => 1
- );
- $this->addCallback(
- 'system.methodSignature',
- 'this:methodSignature',
- array('array', 'string'),
- 'Returns an array describing the return type and required parameters of a method'
- );
- $this->addCallback(
- 'system.getCapabilities',
- 'this:getCapabilities',
- array('struct'),
- 'Returns a struct describing the XML-RPC specifications supported by this server'
- );
- $this->addCallback(
- 'system.listMethods',
- 'this:listMethods',
- array('array'),
- 'Returns an array of available methods on this server'
- );
- $this->addCallback(
- 'system.methodHelp',
- 'this:methodHelp',
- array('string', 'string'),
- 'Returns a documentation string for the specified method'
- );
- }
- function addCallback($method, $callback, $args, $help) {
- $this->callbacks[$method] = $callback;
- $this->signatures[$method] = $args;
- $this->help[$method] = $help;
- }
- function call($methodname, $args) {
- // Make sure it's in an array
- if ($args && !is_array($args)) {
- $args = array($args);
- }
- // Over-rides default call method, adds signature check
- if (!$this->hasMethod($methodname)) {
- return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.');
- }
- $method = $this->callbacks[$methodname];
- $signature = $this->signatures[$methodname];
- $returnType = array_shift($signature);
- // Check the number of arguments
- if (count($args) != count($signature)) {
- // print 'Num of args: '.count($args).' Num in signature: '.count($signature);
- return new IXR_Error(-32602, 'server error. wrong number of method parameters');
- }
- // Check the argument types
- $ok = true;
- $argsbackup = $args;
- for ($i = 0, $j = count($args); $i < $j; $i++) {
- $arg = array_shift($args);
- $type = array_shift($signature);
- switch ($type) {
- case 'int':
- case 'i4':
- if (is_array($arg) || !is_int($arg)) {
- $ok = false;
- }
- break;
- case 'base64':
- case 'string':
- if (!is_string($arg)) {
- $ok = false;
- }
- break;
- case 'boolean':
- if ($arg !== false && $arg !== true) {
- $ok = false;
- }
- break;
- case 'float':
- case 'double':
- if (!is_float($arg)) {
- $ok = false;
- }
- break;
- case 'date':
- case 'dateTime.iso8601':
- if (!is_a($arg, 'IXR_Date')) {
- $ok = false;
- }
- break;
- }
- if (!$ok) {
- return new IXR_Error(-32602, 'server error. invalid method parameters');
- }
- }
- // It passed the test - run the "real" method call
- return parent::call($methodname, $argsbackup);
- }
- function methodSignature($method) {
- if (!$this->hasMethod($method)) {
- return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
- }
- // We should be returning an array of types
- $types = $this->signatures[$method];
- $return = array();
- foreach ($types as $type) {
- switch ($type) {
- case 'string':
- $return[] = 'string';
- break;
- case 'int':
- case 'i4':
- $return[] = 42;
- break;
- case 'double':
- $return[] = 3.1415;
- break;
- case 'dateTime.iso8601':
- $return[] = new IXR_Date(time());
- break;
- case 'boolean':
- $return[] = true;
- break;
- case 'base64':
- $return[] = new IXR_Base64('base64');
- break;
- case 'array':
- $return[] = array('array');
- break;
- case 'struct':
- $return[] = array('struct' => 'struct');
- break;
- }
- }
- return $return;
- }
- function methodHelp($method) {
- return $this->help[$method];
- }
-}
-
-
-class IXR_ClientMulticall extends IXR_Client {
- var $calls = array();
- function IXR_ClientMulticall($server, $path = false, $port = 80) {
- parent::IXR_Client($server, $path, $port);
- $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
- }
- function addCall() {
- $args = func_get_args();
- $methodName = array_shift($args);
- $struct = array(
- 'methodName' => $methodName,
- 'params' => $args
- );
- $this->calls[] = $struct;
- }
- function query() {
- // Prepare multicall, then call the parent::query() method
- return parent::query('system.multicall', $this->calls);
- }
-}
-
-?>
diff --git a/ogs/gridserver/gridserver_config.inc.php b/ogs/gridserver/gridserver_config.inc.php
deleted file mode 100644
index 98ebed360e..0000000000
--- a/ogs/gridserver/gridserver_config.inc.php
+++ /dev/null
@@ -1,14 +0,0 @@
-
-// All the grid server specific stuff lives here
-
-// What we send to authenticate to the user/login server
-$userserver_sendkey="1234";
-
-// What we expect to get back from the user/login server
-$userserver_recvkey="1234";
-
-$sim_recvkey = "1234";
-$sim_sendkey = "1234";
-
-$grid_home = "/ogs/gridserver/";
-?>
diff --git a/ogs/gridserver/index.php b/ogs/gridserver/index.php
deleted file mode 100644
index f7754c687b..0000000000
--- a/ogs/gridserver/index.php
+++ /dev/null
@@ -1,176 +0,0 @@
-
-error_reporting(E_ALL); // yes, we remember this from the login server, don't we boys and girls? don't kill innocent XML-RPC!
-
-// these files are soooo common..... (to the grid)
-include("../common/xmlrpc.inc.php");
-include("../common/database.inc.php");
-include("../common/grid_config.inc.php");
-include("../common/util.inc.php");
-
-include("gridserver_config.inc.php"); // grid server specific config stuff
-
-function get_sim_info($args) {
- global $dbhost,$dbuser,$dbpasswd,$dbname;
- global $userserver_sendkey, $userserver_recvkey;
-
- // First see who's talking to us, if key is invalid then send an invalid one back and nothing more
- if($args['authkey']!=$userserver_recvkey) {
- return Array(
- 'authkey' => 'I can play the bad key trick too you know',
- 'login' => 'false'
- );
- }
-
- // if we get to here, the key is valid, give that login server what it wants!
-
- $link = mysql_connect($dbhost,$dbuser,$dbpasswd)
- OR die("Unable to connect to database");
-
- mysql_select_db($dbname)
- or die("Unable to select database");
-
- $region_handle = $args['region_handle'];
- $query = "SELECT * FROM region_profiles WHERE region_handle='$region_handle'";
- $result = mysql_query($query);
-
- return mysql_fetch_assoc($result);
-}
-
-function get_session_info($args) {
- global $dbhost,$dbuser,$dbpasswd,$dbname;
- global $sim_sendkey, $sim_recvkey;
-
- // authkey, session-id, agent-id
-
- // First see who's talking to us, if key is invalid then send an invalid one back and nothing more
- if($args[0]!=$sim_recvkey) {
- return Array(
- 'authkey' => "I can play the bad key trick too you know"
- );
- }
-
- $link = mysql_connect($dbhost,$dbuser,$dbpasswd)
- OR die("Unable to connect to database");
-
- mysql_select_db($dbname)
- or die("Unable to select database");
-
- $session_id = $args[1];
- $agent_id = $args[2];
-
- $query = "SELECT * FROM sessions WHERE session_id = '$session_id' AND agent_id='$agent_id' AND session_active=1";
- $result = mysql_query($query);
- if(mysql_num_rows($result)>0) {
- $info=mysql_fetch_assoc($result);
- $circuit_code = $info['circuit_code'];
- $secure_session_id=$info['secure_session_id'];
-
- $query = "SELECT * FROM local_user_profiles WHERE userprofile_LLUUID='$agent_id'";
- $result=mysql_query($query);
- $userinfo=mysql_fetch_assoc($result);
- $firstname=$userinfo['profile_firstname'];
- $lastname=$userinfo['profile_lastname'];
- $agent_id=$userinfo['userprofile_LLUUID'];
- return Array(
- 'authkey' => $sim_sendkey,
- 'circuit_code' => $circuit_code,
- 'agent_id' => $agent_id,
- 'session_id' => $session_id,
- 'secure_session_id' => $secure_session_id,
- 'firstname' => $firstname,
- 'lastname' => $lastname
- );
- }
-}
-
-function check_loggedin($args) {
- global $dbhost,$dbuser,$dbpasswd,$dbname;
- global $userserver_sendkey, $userserver_recvkey;
-
- // First see who's talking to us, if key is invalid then send an invalid one back and nothing more
- if($args['authkey']!=$userserver_recvkey) {
- return Array(
- 'authkey' => "I can play the bad key trick too you know"
- );
- }
-
- // if we get to here, the key is valid, give that login server what it wants!
-
- $link = mysql_connect($dbhost,$dbuser,$dbpasswd)
- OR die("Unable to connect to database");
-
- mysql_select_db($dbname)
- or die("Unable to select database");
-
- $userprofile_LLUUID = $args['userprofile_LLUUID'];
- $query = "SELECT * FROM sessions WHERE agent_id='$userprofile_LLUUID' AND session_active=1";
- $result = mysql_query($query);
-
- if(mysql_num_rows($result)>1) {
- return Array(
- 'authkey' => $userserver_sendkey,
- 'logged_in' => 1
- );
- } else {
- return Array(
- 'authkey' => $userserver_sendkey,
- 'logged_in' => 0
- );
- }
-}
-
-function create_session($args) {
- global $dbhost,$dbuser,$dbpasswd,$dbname;
- global $userserver_sendkey, $userserver_recvkey;
-
- // First see who's talking to us, if key is invalid then send an invalid one back and nothing more
- if($args['authkey']!=$userserver_recvkey) {
- return Array(
- 'authkey' => "I can play the bad key trick too you know"
- );
- }
-
- // if we get to here, the key is valid, give that login server what it wants!
-
- $link = mysql_connect($dbhost,$dbuser,$dbpasswd)
- OR die("Unable to connect to database");
-
- mysql_select_db($dbname)
- or die("Unable to select database");
-
- // yes, secure_sessionid should be different, i know...
- $query = "SELECT value FROM Grid_settings WHERE setting='highest_LLUUID'";
- $result = mysql_query($query);
- $row = mysql_fetch_array($result);
- $highest_LLUUID = $row['value'];
- $newsession_id=inc_lluuid($highest_LLUUID);
- $secure_session_id=inc_lluuid($newsession_id);
-
- $query="UPDATE Grid_settings SET value='$secure_session_id' WHERE setting='highest_LLUUID' LIMIT 1";
- $result=mysql_query($query);
-
- $userprofile_LLUUID=$args['userprofile_LLUUID'];
- $current_location=$args['current_location'];
- $remote_ip=$args['remote_ip'];
- $query="INSERT INTO sessions(session_id,secure_session_id,agent_id,session_start,session_active,current_location,remote_ip) VALUES('$newsession_id','$secure_session_id','$userprofile_LLUUID',NOW(),1,'$current_location','$remote_ip')";
- $result=mysql_query($query);
- if(!isset($result)) {
- die();
- }
- return Array(
- 'authkey' => $userserver_sendkey,
- 'session_id' => $newsession_id,
- 'secure_session_id' => $secure_session_id
- );
-}
-
-$server=new IXR_Server(
- Array(
- 'check_session_loggedin' => 'check_loggedin',
- 'create_session' => 'create_session',
- 'get_sim_info' => 'get_sim_info',
- 'get_session_info' => 'get_session_info'
- )
-);
-
-?>
\ No newline at end of file
diff --git a/ogs/gridserver/usersessions/.htaccess b/ogs/gridserver/usersessions/.htaccess
deleted file mode 100644
index 3b76a74ec4..0000000000
--- a/ogs/gridserver/usersessions/.htaccess
+++ /dev/null
@@ -1,5 +0,0 @@
-Options +FollowSymlinks
-
-RewriteEngine on
-RewriteOptions MaxRedirects=1
-RewriteRule .* index.php [L]
diff --git a/ogs/gridserver/usersessions/index.php b/ogs/gridserver/usersessions/index.php
deleted file mode 100644
index e7a3817c35..0000000000
--- a/ogs/gridserver/usersessions/index.php
+++ /dev/null
@@ -1,85 +0,0 @@
-
-// DIRTY HACK ALERT!!!!!!!!!!!!!
-// The following code shows the vital importance of the r69 revision of the original gareth/ branch
-
-
-// This file parses URLs of the format:
-// usersessions/key/userid/data
-// where key is the key to authenticate with the grid, userid is the user's LLUUID and data is the data about the user's session being requested
-// if the data requested is left out, an XML response will be sent
-
-error_reporting(E_ALL); // Remember kids, PHP errors kill XML-RPC responses and REST too! will the slaughter ever end?
-
-include("../gridserver_config.inc.php");
-include("../../common/database.inc.php");
-include("../../common/util.inc.php");
-
-// Parse out the parameters from the URL
-$params = str_replace($grid_home,'', $_SERVER['REQUEST_URI']);
-$params = str_replace("index.php/","",$params);
-$params = split('/',$params);
-
-// Die if the key doesn't match
-if($params[1]!=$sim_recvkey) {
- die();
-}
-
-$link = mysql_connect($dbhost,$dbuser,$dbpasswd)
- OR die("Unable to connect to database");
-
-mysql_select_db($dbname)
- or die("Unable to select database");
-
-$agent_id = strtolower($params[2]);
-$query = "SELECT * FROM sessions WHERE agent_id='$agent_id' AND session_active=1";
-
-// if we have 4 params, then param 4 is the command
-if(count($params)==4) {
- $cmd=$params['3'];
-} else if(count($params)==5) {
- $circuit_code=$params[3];
- $cmd=$params[4]; // otherwise, 5 is the command and 4 is the circuit code
-}
-
-$result = mysql_query($query);
-if(mysql_num_rows($result)>0) {
- $info=mysql_fetch_assoc($result);
- $circuit_code = $info['circuit_code'];
- if($circuit_code == 0) $circuit_code=$params['4'];
- $secure_session_id=$info['secure_session_id'];
- $session_id=$info['session_id'];
-
- $query = "SELECT * FROM local_user_profiles WHERE userprofile_LLUUID='$agent_id'";
- $result=mysql_query($query);
- $userinfo=mysql_fetch_assoc($result);
- $firstname=$userinfo['profile_firstname'];
- $lastname=$userinfo['profile_lastname'];
- $agent_id=$userinfo['userprofile_LLUUID'];
- $exists=1;
-} else {
- $exists=0;
-}
-
-// if only 3 params, assume we are sending an XML response
-if(count($params)==3) {
- output_xml_block("usersession",Array(
- 'authkey' => $sim_sendkey,
- 'circuit_code' => $circuit_code,
- 'agent_id' => $agent_id,
- 'session_id' => $session_id,
- 'secure_session_id' => $secure_session_id,
- 'firstname' => $firstname,
- 'lastname' => $lastname
- ));
-}
-
-switch($cmd) {
- case 'exists':
- echo $exists;
- break;
- case 'delete':
- $query = "UPDATE sessions SET session_active=0, session_end=NOW() WHERE agent_id='$agent_id' LIMIT 1";
- $deleteresult = mysql_query($query);
- break;
-}
-?>
diff --git a/ogs/login/index.php b/ogs/login/index.php
deleted file mode 100644
index 4f53c11e46..0000000000
--- a/ogs/login/index.php
+++ /dev/null
@@ -1,170 +0,0 @@
-
-error_reporting(0); // Remember kids, PHP errors kill XML-RPC responses!
-
-// include all the common stuff
-include("../common/xmlrpc.inc.php");
-include("../common/database.inc.php");
-include("../common/grid_config.inc.php");
-include("../common/util.inc.php");
-
-include("login_config.inc.php"); // include login/user specific config stuff (authentication keys etc)
-
-function login($args) {
- global $dbhost,$dbuser,$dbpasswd,$dbname;
- global $grid_owner, $gridserver_sendkey, $gridserver_recvkey, $gridserver_url;
-
-
- if(get_magic_quotes_gpc()) {
- $firstname=addslashes($args['first']);
- $lastname=addslashes($args['last']);
- $passwd=addslashes($args['passwd']);
- } else {
- $firstname=$args['first'];
- $lastname=$args['last'];
- $passwd=$args['passwd'];
- }
-
- $link = mysql_connect($dbhost,$dbuser,$dbpasswd)
- OR die("Unable to connect to database");
-
- mysql_select_db($dbname)
- or die("Unable to select database");
-
- $query = "SELECT userprofile_LLUUID, profile_firstname, profile_lastname, profile_passwdmd5, homesim_ip, homesim_port, homeasset_url, look_at, region_handle, position FROM local_user_profiles WHERE profile_firstname='".$firstname."' AND profile_lastname='".$lastname."' AND profile_passwdmd5='" .$passwd."'";
-
- $profile_lookup_result=mysql_query($query);
-
- if(mysql_num_rows($profile_lookup_result) >0) {
- $profiledata = mysql_fetch_assoc($profile_lookup_result);
-
- // if we get here, the username/password is valid, but still need to check there's not an already existing session
- $client = new IXR_Client($gridserver_url);
- if (!$client->query('check_session_loggedin', Array('userprofile_LLUUID' => $profiledata['userprofile_LLUUID'], 'authkey' => $gridserver_sendkey, 'server_type' => 'login'))) { // if this doesn't work, grid server is down - that's bad
- return Array (
- 'reason' => 'key',
- 'message' => "Could not connect to grid server. Please try again later or contact the grid owner ". $grid_owner,
- 'login' => "false"
- );
- }
-
- $response=$client->getResponse();
- if($response['authkey'] != $gridserver_recvkey) { // if this doesn't match up, it's a fake grid server
- return Array (
- 'reason' => 'key',
- 'message' => "Could not connect to grid server due to possible security issues. It is possible that the grid has been compromised. Please contact the grid owner " . $grid_owner . " and report this issue",
- 'login' => "false"
- );
- }
-
-
- if($response['logged_in'] == 1) { // if the user is already logged in, tell them
- return Array (
- 'reason' => 'presence',
- 'message' => "You appear to already be logged into this grid, if your client has recently crashed then please try again later",
- 'login' => "false"
- );
- }
-
- // now we start a new session on the grid
- $remote_ip=$_SERVER['REMOTE_ADDR'];
- $region_handle=$profiledata['region_handle'];
- $client->query('create_session',Array('userprofile_LLUUID' => $profiledata['userprofile_LLUUID'], 'authkey' => $gridserver_sendkey, 'remote_ip' => $remote_ip, 'current_location' => $region_handle));
- $response = $client->getResponse();
- $session_id = $response['session_id'];
- $secure_session_id = $response['secure_session_id'];
-
- // ask the grid server what the IP address and port of the sim we want to connect to is
- $client->query('get_sim_info', Array('region_handle' => $region_handle, 'authkey' => $gridserver_sendkey) );
- $siminfo = $client->getResponse();
-
- // send the final response!
- $position=$profiledata['position'];
- $look_at=$profiledata['look_at'];
-
- $LocX=intval($siminfo['GridLocX'])*256;
- $LocY=intval($siminfo['GridLocY'])*256;
- $home="{'region_handle':'$region_handle', 'position':'$position', 'look_at':'$look_at'}";
-
- $globaltextures = new LLBlock(
- Array(
- 'sun_texture_id' => "cce0f112-878f-4586-a2e2-a8f104bba271",
- 'cloud_texture_id' => "fc4b9f0b-d008-45c6-96a4-01dd947ac621",
- 'moon_texture_id' => "d07f6eed-b96a-47cd-b51d-400ad4a1c428"
- ));
-
- $login_flags = new LLBlock(
- Array(
- 'stipend_since_login' => "N",
- 'ever_logged_in' => "Y",
- 'gendered' => "Y",
- 'daylight_savings' => "N"
- ));
- $ui_config = new LLBlock(
- Array(
- 'allow_first_life' => "Y"
- ));
- $inventory_skeleton = new LLBlock(Array(
- Array(
- 'name' => 'My inventory',
- 'parent_id' => '00000000-0000-0000-0000-000000000000',
- 'version' => 4,
- 'type_default' => 8,
- 'folder_id' => 'f798e114-c10f-409b-a90d-a11577ff1de8'
- ),
- Array(
- 'name' => 'Textures',
- 'parent_id' => 'f798e114-c10f-409b-a90d-a11577ff1de8',
- 'version' => 1,
- 'type_default' => 0,
- 'folder_id' => 'fc8b4059-30bb-43a8-a042-46f5b431ad82'
- )));
- $inventory_root = new LLBlock(
- Array(
- 'folder_id' => "f798e114-c10f-409b-a90d-a11577ff1de8"
- ));
- $initial_outfit = new LLBlock(
- Array(
- 'folder_name' => "Nightclub Female",
- 'gender' => "female"
- ));
- return Array (
- 'message' => "Welcome to OGS!",
- 'session_id' => format_lluuid($session_id),
- 'sim_port' => intval($siminfo['port']),
- 'agent_access' => "M",
- 'start_location' => "last",
- 'global-textures' => $globaltextures,
- 'seconds_since_epoch' => time(),
- 'first_name' => $profiledata['profile_firstname'],
- 'circuit_code' => 50633318,
- 'login_flags' => $login_flags,
- 'seed_capability' => '',
- 'home' => $home,
- 'secure_session_id' => format_lluuid($secure_session_id),
- 'last_name' => $profiledata['profile_lastname'],
- 'ui-config' => $ui_config,
- 'region_x' => $LocX,
- 'inventory_skeleton' => $inventory_skeleton,
- 'sim_ip' => $siminfo['ip_addr'],
- 'region_y' => $LocY,
- 'inventory-root' => $inventory_root,
- 'login' => "true",
- 'look_at' => $look_at,
- 'agent_id' => format_lluuid($profiledata['userprofile_LLUUID']),
- 'initial-outfit' => $initial_outfit
- );
-
-
- } else {
- // this is the default invalid username/password error
- return Array (
- 'reason' => 'key',
- 'message' => "You have entered an invalid name/password combination or are using an incompatible client. Please check with the grid owner " .$grid_owner . " if you are sure your login details are accurate.",
- 'login' => "false",
- );
- }
-
-}
-
-$server=new IXR_Server(array('login_to_simulator' => 'login'));
-?>
diff --git a/ogs/login/login_config.inc.php b/ogs/login/login_config.inc.php
deleted file mode 100644
index 4cce696522..0000000000
--- a/ogs/login/login_config.inc.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
-// All the user/login server specific stuff lives here
-
-// What we send to authenticate to the grid server
-$gridserver_sendkey="1234";
-
-// What we expect to get back from the grid server
-$gridserver_recvkey="1234";
-
-$gridserver_url="http://www.osgrid.org/ogs/gridserver/index.php";
-?>
diff --git a/opensim.build b/opensim.build
deleted file mode 100644
index 2fdf1cb51d..0000000000
--- a/opensim.build
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
- First nant buildfile for OpenSim
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/opensim.mdp b/opensim.mdp
deleted file mode 100644
index f41280ff4f..0000000000
--- a/opensim.mdp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/opensim.mds b/opensim.mds
deleted file mode 100644
index 7587db3192..0000000000
--- a/opensim.mds
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Config.cs b/src/Config.cs
deleted file mode 100644
index 9bb92962d0..0000000000
--- a/src/Config.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-Copyright (c) OpenSim project, http://osgrid.org/
-
-* Copyright (c) ,
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Db4objects.Db4o;
-using libsecondlife;
-using OpenSim.world;
-
-namespace OpenSim
-{
- ///
- /// This class handles connection to the underlying database used for configuration of the region.
- /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
- /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
- /// what is hardcoded here and then saved into opensim.yap for future startups.
- ///
- public class SimConfig
- {
- public string RegionName;
-
- public uint RegionLocX;
- public uint RegionLocY;
- public ulong RegionHandle;
-
- public int IPListenPort;
- public string IPListenAddr;
-
- public bool sandbox = true;
- public string AssetURL = String.Empty;
- public string AssetSendKey = String.Empty;
-
- public string GridURL = String.Empty;
- public string GridSendKey = String.Empty;
-
- private IObjectContainer db;
-
- public void LoadDefaults()
- {
- string tempstring;
- OpenSim_Main.localcons.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
-
- this.RegionName = OpenSim_Main.localcons.CmdPrompt("Name [OpenSim test]: ", "OpenSim test");
- this.RegionLocX = (uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location X [997]: ", "997"));
- this.RegionLocY = (uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location Y [996]: ", "996"));
- this.IPListenPort = Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("UDP port for client connections [9000]: ", "9000"));
- this.IPListenAddr = OpenSim_Main.localcons.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ", "127.0.0.1");
-
- tempstring = OpenSim_Main.localcons.CmdPrompt("Run in sandbox or grid mode? [sandbox]: ", "sandbox", "sandbox", "grid");
- this.sandbox = tempstring.Equals("sandbox");
-
- if (!this.sandbox)
- {
- this.AssetURL = OpenSim_Main.localcons.CmdPrompt("Asset server URL: ");
- this.AssetSendKey = OpenSim_Main.localcons.CmdPrompt("Asset server key: ");
- this.GridURL = OpenSim_Main.localcons.CmdPrompt("Grid server URL: ");
- this.GridSendKey = OpenSim_Main.localcons.CmdPrompt("Grid server key: ");
- }
- this.RegionHandle = Helpers.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
- }
-
- public void InitConfig()
- {
- try
- {
- db = Db4oFactory.OpenFile("opensim.yap");
- IObjectSet result = db.Get(typeof(SimConfig));
- if (result.Count == 1)
- {
- OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
- foreach (SimConfig cfg in result)
- {
- this.sandbox = cfg.sandbox;
- this.RegionName = cfg.RegionName;
- this.RegionLocX = cfg.RegionLocX;
- this.RegionLocY = cfg.RegionLocY;
- this.RegionHandle = Helpers.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
- this.IPListenPort = cfg.IPListenPort;
- this.IPListenAddr = cfg.IPListenAddr;
- this.AssetURL = cfg.AssetURL;
- this.AssetSendKey = cfg.AssetSendKey;
- this.GridURL = cfg.GridURL;
- this.GridSendKey = cfg.GridSendKey;
- }
- }
- else
- {
- OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
- LoadDefaults();
- OpenSim_Main.localcons.WriteLine("Writing out default settings to local database");
- db.Set(this);
- }
- }
- catch (Exception e)
- {
- db.Close();
- OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Exception occured");
- OpenSim_Main.localcons.WriteLine(e.ToString());
- }
- OpenSim_Main.localcons.WriteLine("Sim settings loaded:");
- OpenSim_Main.localcons.WriteLine("Name: " + this.RegionName);
- OpenSim_Main.localcons.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
- OpenSim_Main.localcons.WriteLine("Region Handle: " + this.RegionHandle.ToString());
- OpenSim_Main.localcons.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
- OpenSim_Main.localcons.WriteLine("Sandbox Mode? " + this.sandbox.ToString());
- OpenSim_Main.localcons.WriteLine("Asset URL: " + this.AssetURL);
- OpenSim_Main.localcons.WriteLine("Asset key: " + this.AssetSendKey);
- OpenSim_Main.localcons.WriteLine("Grid URL: " + this.GridURL);
- OpenSim_Main.localcons.WriteLine("Grid key: " + this.GridSendKey);
- }
-
- public World LoadWorld()
- {
- OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Loading world....");
- World blank = new World();
- OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
- IObjectSet world_result = db.Get(new float[65536]);
- if (world_result.Count > 0)
- {
- OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
- blank.LandMap = (float[])world_result.Next();
- }
- else
- {
- OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
- HeightmapGenHills hills = new HeightmapGenHills();
- blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
-
- OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
- db.Set(blank.LandMap);
- db.Commit();
- }
- return blank;
- }
-
- public void LoadFromGrid()
- {
- OpenSim_Main.localcons.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
- // TODO: Make this crap work
- }
-
- public void Shutdown()
- {
- db.Close();
- }
- }
-}
diff --git a/src/Main.cs b/src/Main.cs
deleted file mode 100644
index f3fa6097af..0000000000
--- a/src/Main.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-Copyright (c) OpenSim project, http://osgrid.org/
-
-
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-using System.Text;
-using System.IO;
-using System.Threading;
-using System.Net;
-using System.Net.Sockets;
-using System.Collections;
-using System.Collections.Generic;
-using libsecondlife;
-using libsecondlife.Packets;
-using OpenSim.world;
-
-namespace OpenSim
-{
- ///
- /// Description of MainForm.
- ///
- public class OpenSim_Main
- {
- public static DateTime startuptime;
- public static OpenSim_Main sim;
- public static SimConfig cfg;
- public static World local_world;
- public static ServerConsole localcons;
- private static Thread MainListener;
- public static Socket Server;
- private static IPEndPoint ServerIncoming;
- private static byte[] RecvBuffer = new byte[4096];
- private byte[] ZeroBuffer = new byte[8192];
- private static IPEndPoint ipeSender;
- private static EndPoint epSender;
- private static AsyncCallback ReceivedData;
- public Dictionary ClientThreads = new Dictionary();
-
- [STAThread]
- public static void Main( string[] args )
- {
- Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
- Console.WriteLine("Starting...\n");
- sim = new OpenSim_Main();
- sim.Startup();
- while(true) {
- localcons.MainConsolePrompt();
- }
- }
-
- private OpenSim_Main() {
- }
-
- public static void Shutdown() {
- localcons.WriteLine("Main.cs:Shutdown() - Closing all threads");
- localcons.WriteLine("Main.cs:Shutdown() - Killing listener thread");
- MainListener.Abort();
- localcons.WriteLine("Main.cs:Shutdown() - Killing clients");
- // IMPLEMENT THIS
- localcons.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
- localcons.Close();
- Environment.Exit(0);
- }
-
- private void Startup() {
- startuptime=DateTime.Now;
- localcons=new ServerConsole(ServerConsole.ConsoleType.Local,"",0);
- // We check our local database first, then the grid for config options
- localcons.WriteLine("Main.cs:Startup() - Loading configuration");
- cfg = new SimConfig();
- cfg.InitConfig();
- localcons.WriteLine("Main.cs:Startup() - Contacting gridserver");
- cfg.LoadFromGrid();
-
- localcons.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
- localcons.WriteLine("Initialising world");
- local_world = cfg.LoadWorld();
-
- localcons.WriteLine("Main.cs:Startup() - Starting up main world loop");
- local_world.InitLoop();
-
- localcons.WriteLine("Main.cs:Startup() - Starting up messaging system");
- MainListener = new Thread(new ThreadStart(MainServerListener));
- MainListener.Start();
-
- Thread.Sleep(500); // give other threads a chance to catch up
- string[] noparams = new string[1];
- noparams[0]="";
- localcons.WriteLine("\nOpenSim ready\nType help for list of commands");
- }
-
- private void OnReceivedData(IAsyncResult result) {
- ipeSender = new IPEndPoint(IPAddress.Any, 0);
- epSender = (EndPoint)ipeSender;
- Packet packet = null;
- int numBytes = Server.EndReceiveFrom(result, ref epSender);
- int packetEnd = numBytes - 1;
- packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
-
- // This is either a new client or a packet to send to an old one
- if(ClientThreads.ContainsKey(epSender)) {
- ClientThreads[epSender].InPacket(packet);
- } else if( packet.Type == PacketType.UseCircuitCode ) { // new client
- OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet);
- ClientThreads.Add(epSender, newuser);
- } else { // invalid client
- Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
- }
- Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
- }
-
- private void MainServerListener() {
- localcons.WriteLine("Main.cs:MainServerListener() - New thread started");
- localcons.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
-
- ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
- Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
- Server.Bind(ServerIncoming);
-
- localcons.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
-
- ipeSender = new IPEndPoint(IPAddress.Any, 0);
- epSender = (EndPoint) ipeSender;
- ReceivedData = new AsyncCallback(this.OnReceivedData);
- Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
-
- localcons.WriteLine("Main.cs:MainServerListener() - Listening...");
- while(true) {
- Thread.Sleep(100);
- local_world.DoStuff();
- }
- }
- }
-}
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
deleted file mode 100644
index 497df000c8..0000000000
--- a/src/OpenSimClient.cs
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
-Copyright (c) OpenSim project, http://osgrid.org/
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using libsecondlife;
-using libsecondlife.Packets;
-using System.Net;
-using System.Net.Sockets;
-using System.IO;
-using System.Threading;
-using System.Timers;
-
-namespace OpenSim
-{
- ///
- /// Handles new client connections
- /// Constructor takes a single Packet and authenticates everything
- ///
- public class OpenSimClient
- {
-
- public LLUUID AgentID;
- public LLUUID SessionID;
- public uint CircuitCode;
- public world.Avatar ClientAvatar;
- private UseCircuitCodePacket cirpack;
- private Thread ClientThread;
- public EndPoint userEP;
- private BlockingQueue PacketQueue;
- private BlockingQueue AssetRequests;
- private Dictionary PendingAcks = new Dictionary();
- private Dictionary NeedAck = new Dictionary();
- private System.Timers.Timer AckTimer;
- private uint Sequence = 0;
- private object SequenceLock = new object();
- private const int MAX_APPENDED_ACKS = 10;
- private const int RESEND_TIMEOUT = 4000;
- private const int MAX_SEQUENCE = 0xFFFFFF;
- //private Queue Inbox;
-
- public void ack_pack(Packet Pack)
- {
- //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket();
- //ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
- //ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
- //ack_it.Packets[0].ID = Pack.Header.ID;
- //ack_it.Header.Reliable = false;
-
- //OutPacket(ack_it);
-
- if (Pack.Header.Reliable)
- {
- lock (PendingAcks)
- {
- uint sequence = (uint)Pack.Header.Sequence;
- if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; }
- }
- }
- }
-
- public void AssetLoader()
- {
- if (OpenSim_Main.cfg.sandbox == false)
- {
- WebResponse AssetResponse;
- byte[] idata;
-
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AssetLoader() - Starting new thread");
- TransferRequestPacket reqPacket = AssetRequests.Dequeue();
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AssetLoader() - Got a request, processing it");
- LLUUID AssetID = new LLUUID(reqPacket.TransferInfo.Params, 0);
-
- try
- {
- WebRequest AssetLoad = WebRequest.Create(OpenSim_Main.cfg.AssetURL + "getasset/" + OpenSim_Main.cfg.AssetSendKey + "/" + AssetID + "/data");
- AssetResponse = AssetLoad.GetResponse();
- idata = new byte[(int)AssetResponse.ContentLength];
- BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
- idata = br.ReadBytes((int)AssetResponse.ContentLength);
- br.Close();
- }
- catch (Exception e)
- {
- Console.WriteLine(e.ToString());
- return;
- }
-
- TransferInfoPacket Transfer = new TransferInfoPacket();
- Transfer.TransferInfo.ChannelType = 2;
- Transfer.TransferInfo.Status = 0;
- Transfer.TransferInfo.TargetType = 0;
- Transfer.TransferInfo.Params = reqPacket.TransferInfo.Params;
- Transfer.TransferInfo.Size = (int)AssetResponse.ContentLength;
- Transfer.TransferInfo.TransferID = reqPacket.TransferInfo.TransferID;
-
- OutPacket(Transfer);
-
- TransferPacketPacket TransferPacket = new TransferPacketPacket();
- TransferPacket.TransferData.Packet = 0;
- TransferPacket.TransferData.ChannelType = 2;
- TransferPacket.TransferData.TransferID = reqPacket.TransferInfo.TransferID;
-
- if (AssetResponse.ContentLength > 1000)
- {
- byte[] chunk = new byte[1000];
- Array.Copy(idata, chunk, 1000);
- TransferPacket.TransferData.Data = chunk;
- TransferPacket.TransferData.Status = 0;
- OutPacket(TransferPacket);
-
- TransferPacket = new TransferPacketPacket();
- TransferPacket.TransferData.Packet = 1;
- TransferPacket.TransferData.ChannelType = 2;
- TransferPacket.TransferData.TransferID = reqPacket.TransferInfo.TransferID;
- byte[] chunk1 = new byte[(idata.Length - 1000)];
- Array.Copy(idata, 1000, chunk1, 0, chunk1.Length);
- TransferPacket.TransferData.Data = chunk1;
- TransferPacket.TransferData.Status = 1;
- OutPacket(TransferPacket);
- }
- else
- {
- TransferPacket.TransferData.Status = 1;
- TransferPacket.TransferData.Data = idata;
- OutPacket(TransferPacket);
- }
- AssetResponse.Close();
- }
- }
-
- public void Logout()
- {
- // TODO - kill any AssetLoaders
- ClientThread.Abort();
- }
-
- public void ProcessInPacket(Packet Pack)
- {
- ack_pack(Pack);
- switch (Pack.Type)
- {
- case PacketType.CompleteAgentMovement:
- ClientAvatar.CompleteMovement(OpenSim_Main.local_world);
- ClientAvatar.SendInitialPosition();
- break;
- case PacketType.RegionHandshakeReply:
- OpenSim_Main.local_world.SendLayerData(this);
- break;
- case PacketType.AgentWearablesRequest:
- ClientAvatar.SendInitialAppearance();
- break;
- case PacketType.TransferRequest:
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
- // We put transfer requests into a big queue and then spawn a thread for each new one
- TransferRequestPacket transfer = (TransferRequestPacket)Pack;
- AssetRequests.Enqueue(transfer);
- Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader));
- AssetLoaderThread.Start();
- break;
- case PacketType.LogoutRequest:
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
- lock (OpenSim_Main.local_world.Entities)
- {
- OpenSim_Main.local_world.Entities.Remove(this.AgentID);
- }
-
- if (OpenSim_Main.cfg.sandbox == false)
- {
- WebRequest DeleteSession = WebRequest.Create(OpenSim_Main.cfg.GridURL + "/usersessions/" + OpenSim_Main.cfg.GridSendKey + "/" + this.AgentID.ToString() + this.CircuitCode.ToString() + "/delete");
- WebResponse GridResponse = DeleteSession.GetResponse();
- StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
- String grTest = sr.ReadLine();
- sr.Close();
- GridResponse.Close();
- OpenSim_Main.localcons.WriteLine("DEBUG: " + grTest);
- }
- this.ClientThread.Abort();
- break;
- case PacketType.AgentUpdate:
- ClientAvatar.HandleAgentUpdate((AgentUpdatePacket)Pack);
- break;
- case PacketType.ChatFromViewer:
- ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
- if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") break;
-
- System.Text.Encoding _enc = System.Text.Encoding.ASCII;
- libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
- reply.ChatData.Audible = 1;
- reply.ChatData.Message = inchatpack.ChatData.Message;
- reply.ChatData.ChatType = 1;
- reply.ChatData.SourceType = 1;
- reply.ChatData.Position = this.ClientAvatar.position;
- reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
- reply.ChatData.OwnerID = this.AgentID;
- reply.ChatData.SourceID = this.AgentID;
-
-
-
- foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
- {
- client.OutPacket(reply);
- }
- break;
- }
- }
-
- private void ResendUnacked()
- {
- int now = Environment.TickCount;
-
- lock (NeedAck)
- {
- foreach (Packet packet in NeedAck.Values)
- {
- if (now - packet.TickCount > RESEND_TIMEOUT)
- {
-
- packet.Header.Resent = true;
- OutPacket(packet);
- }
- }
- }
- }
-
- private void SendAcks()
- {
- lock (PendingAcks)
- {
- if (PendingAcks.Count > 0)
- {
- if (PendingAcks.Count > 250)
- {
- return;
- }
-
-
-
- int i = 0;
- PacketAckPacket acks = new PacketAckPacket();
- acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count];
-
- foreach (uint ack in PendingAcks.Values)
- {
- acks.Packets[i] = new PacketAckPacket.PacketsBlock();
- acks.Packets[i].ID = ack;
- i++;
- }
-
- acks.Header.Reliable = false;
- OutPacket(acks);
-
- PendingAcks.Clear();
- }
- }
- }
-
- private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
- {
- SendAcks();
- ResendUnacked();
- }
-
- public void ProcessOutPacket(Packet Pack)
- {
-
- // Keep track of when this packet was sent out
- Pack.TickCount = Environment.TickCount;
-
- if (!Pack.Header.Resent)
- {
- // Set the sequence number
- lock (SequenceLock)
- {
- if (Sequence >= MAX_SEQUENCE)
- Sequence = 1;
- else
- Sequence++;
- Pack.Header.Sequence = Sequence;
- }
-
- if (Pack.Header.Reliable) //DIRTY HACK
- {
- lock (NeedAck)
- {
- if (!NeedAck.ContainsKey(Pack.Header.Sequence))
- {
- NeedAck.Add(Pack.Header.Sequence, Pack);
- }
- else
- {
- // Client.Log("Attempted to add a duplicate sequence number (" +
- // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " +
- // packet.Type.ToString(), Helpers.LogLevel.Warning);
- }
- }
-
- // Don't append ACKs to resent packets, in case that's what was causing the
- // delivery to fail
- if (!Pack.Header.Resent)
- {
- // Append any ACKs that need to be sent out to this packet
- lock (PendingAcks)
- {
- if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS &&
- Pack.Type != PacketType.PacketAck &&
- Pack.Type != PacketType.LogoutRequest)
- {
- Pack.Header.AckList = new uint[PendingAcks.Count];
- int i = 0;
-
- foreach (uint ack in PendingAcks.Values)
- {
- Pack.Header.AckList[i] = ack;
- i++;
- }
-
- PendingAcks.Clear();
- Pack.Header.AppendedAcks = true;
- }
- }
- }
- }
- }
-
-
- byte[] ZeroOutBuffer = new byte[4096];
- byte[] sendbuffer;
- sendbuffer = Pack.ToBytes();
-
- try
- {
- if (Pack.Header.Zerocoded)
- {
- int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
- OpenSim_Main.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None, userEP);
- }
- else
- {
- OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None, userEP);
- }
- }
- catch (Exception)
- {
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
- ClientThread.Abort();
- }
-
- }
-
- public void InPacket(Packet NewPack)
- {
- // Handle appended ACKs
- if (NewPack.Header.AppendedAcks)
- {
- lock (NeedAck)
- {
- foreach (uint ack in NewPack.Header.AckList)
- {
- OpenSim_Main.localcons.WriteLine("Got appended ack: " + ack);
- NeedAck.Remove(ack);
- }
- }
- }
-
- // Handle PacketAck packets
- if (NewPack.Type == PacketType.PacketAck)
- {
- PacketAckPacket ackPacket = (PacketAckPacket)NewPack;
-
- lock (NeedAck)
- {
- foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
- {
- NeedAck.Remove(block.ID);
- }
- }
- }
- else if ((NewPack.Type == PacketType.StartPingCheck))
- {
- //reply to pingcheck
- libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack;
- libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket();
- endPing.PingID.PingID = startPing.PingID.PingID;
- OutPacket(endPing);
- }
- else
- {
- QueItem item = new QueItem();
- item.Packet = NewPack;
- item.Incoming = true;
- this.PacketQueue.Enqueue(item);
- }
-
- }
-
- public void OutPacket(Packet NewPack)
- {
- QueItem item = new QueItem();
- item.Packet = NewPack;
- item.Incoming = false;
- this.PacketQueue.Enqueue(item);
- }
-
- public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack)
- {
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
- cirpack = initialcirpack;
- userEP = remoteEP;
- PacketQueue = new BlockingQueue();
- AssetRequests = new BlockingQueue();
- AckTimer = new System.Timers.Timer(500);
- AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
- AckTimer.Start();
-
- ClientThread = new Thread(new ThreadStart(AuthUser));
- ClientThread.IsBackground = true;
- ClientThread.Start();
- }
-
- private void ClientLoop()
- {
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop");
- while (true)
- {
- QueItem nextPacket = PacketQueue.Dequeue();
- if (nextPacket.Incoming)
- {
- //is a incoming packet
- ProcessInPacket(nextPacket.Packet);
- }
- else
- {
- //is a out going packet
- ProcessOutPacket(nextPacket.Packet);
- }
- }
- }
-
- private void InitNewClient()
- {
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
- OpenSim_Main.local_world.AddViewerAgent(this);
- world.Entity tempent = OpenSim_Main.local_world.Entities[this.AgentID];
- this.ClientAvatar = (world.Avatar)tempent;
- }
-
- private void AuthUser()
- {
- if (OpenSim_Main.cfg.sandbox == false)
- {
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - Authenticating new user request with grid");
- WebRequest CheckSession = WebRequest.Create(OpenSim_Main.cfg.GridURL + "/usersessions/" + OpenSim_Main.cfg.GridSendKey + "/" + cirpack.CircuitCode.ID.ToString() + "/" + cirpack.CircuitCode.Code.ToString() + "/exists");
- OpenSim_Main.localcons.WriteLine(OpenSim_Main.cfg.GridURL);
- WebResponse GridResponse = CheckSession.GetResponse();
- StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
- String grTest = sr.ReadLine();
- sr.Close();
- GridResponse.Close();
- if (String.IsNullOrEmpty(grTest) || grTest.Equals("1"))
- { // YAY! Valid login
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
- this.AgentID = cirpack.CircuitCode.ID;
- this.SessionID = cirpack.CircuitCode.SessionID;
- this.CircuitCode = cirpack.CircuitCode.Code;
- InitNewClient();
- ClientLoop();
- }
- else
- { // Invalid
- OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
- ClientThread.Abort();
- }
- }
- else
- {
- this.AgentID = cirpack.CircuitCode.ID;
- this.SessionID = cirpack.CircuitCode.SessionID;
- this.CircuitCode = cirpack.CircuitCode.Code;
- InitNewClient();
- ClientLoop();
- }
- }
- }
-
-}
diff --git a/src/Second-server.csproj b/src/Second-server.csproj
deleted file mode 100644
index 8d55e06e04..0000000000
--- a/src/Second-server.csproj
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
- Exe
- OpenSim
- OpenSim
- Debug
- AnyCPU
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}
- OpenSim.OpenSim_Main
-
-
- ..\bin\
- False
- DEBUG;TRACE
- True
- Full
- True
-
-
- ..\bin\
- True
- TRACE
- False
- None
- False
-
-
-
- False
- ..\bin\Axiom.MathLib.dll
-
-
-
- False
- ..\bin\libsecondlife.dll
-
-
- False
- ..\bin\log4net.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Second-server.sln b/src/Second-server.sln
deleted file mode 100644
index 86fc54c313..0000000000
--- a/src/Second-server.sln
+++ /dev/null
@@ -1,26 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|.NET 1.1 = Debug|.NET 1.1
- Debug|Any CPU = Debug|Any CPU
- Release|.NET 1.1 = Release|.NET 1.1
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.ActiveCfg = Debug|Any CPU
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.Build.0 = Debug|Any CPU
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.ActiveCfg = Release|Any CPU
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.Build.0 = Release|.NET 1.1
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/src/ServerConsole.cs b/src/ServerConsole.cs
deleted file mode 100644
index 21a465d88b..0000000000
--- a/src/ServerConsole.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-Copyright (c) OpenSim project, http://osgrid.org/
-
-* Copyright (c) ,
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.IO;
-using System.Net;
-using libsecondlife;
-using libsecondlife.Packets;
-
-namespace OpenSim
-{
- public class ServerConsole {
- private ConsoleType ConsType;
- StreamWriter Log;
-
- public enum ConsoleType {
- Local, // Use stdio
- TCP, // Use TCP/telnet
- SimChat // Use in-world chat (for gods)
- }
-
-
- // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!!
- // constype - the type of console to use (see enum ConsoleType)
- // sparam - depending on the console type:
- // TCP - the IP to bind to (127.0.0.1 if blank)
- // Local - param ignored
- // SimChat - the AgentID of this sim's admin
- // and for the iparam:
- // TCP - the port to bind to
- // Local - param ignored
- // SimChat - the chat channel to accept commands from
- public ServerConsole(ConsoleType constype, string sparam, int iparam) {
- ConsType = constype;
- switch(constype) {
- case ConsoleType.Local:
- Console.WriteLine("ServerConsole.cs - creating new local console");
- Console.WriteLine("Logs will be saved to current directory in opensim-console.log");
- Log=File.AppendText("opensim-console.log");
- Log.WriteLine("========================================================================");
- Log.WriteLine("OpenSim " + VersionInfo.Version + " Started at " + DateTime.Now.ToString());
- break;
- case ConsoleType.TCP:
- break;
- case ConsoleType.SimChat:
- break;
-
- default:
- Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!");
- break;
- }
- }
-
- public void Close() {
- Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString());
- Log.Close();
- }
-
- // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here
- public void WriteLine(string Line) {
- Log.WriteLine(Line);
- Console.WriteLine(Line);
- return;
- }
-
- public string ReadLine() {
- string TempStr=Console.ReadLine();
- Log.WriteLine(TempStr);
- return TempStr;
- }
-
- public int Read() {
- int TempInt= Console.Read();
- Log.Write((char)TempInt);
- return TempInt;
- }
-
- public void Write(string Line) {
- Console.Write(Line);
- Log.Write(Line);
- return;
- }
-
- // Displays a command prompt and waits for the user to enter a string, then returns that string
- public string CmdPrompt(string prompt) {
- this.Write(prompt);
- return this.ReadLine();
- }
-
- // Displays a command prompt and returns a default value if the user simply presses enter
- public string CmdPrompt(string prompt, string defaultresponse) {
- string temp=CmdPrompt(prompt);
- if(temp=="") {
- return defaultresponse;
- } else {
- return temp;
- }
- }
-
- // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
- public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) {
- bool itisdone=false;
- string temp=CmdPrompt(prompt,defaultresponse);
- while(itisdone==false) {
- if((temp==OptionA) || (temp==OptionB)) {
- itisdone=true;
- } else {
- this.WriteLine("Valid options are " + OptionA + " or " + OptionB);
- temp=CmdPrompt(prompt,defaultresponse);
- }
- }
- return temp;
- }
-
- // Runs a command with a number of parameters
- public Object RunCmd(string Cmd, string[] cmdparams) {
- switch(Cmd) {
- case "help":
- this.WriteLine("show users - show info about connected users");
- this.WriteLine("shutdown - disconnect all clients and shutdown");
- break;
-
- case "show":
- ShowCommands(cmdparams[0]);
- break;
-
- case "shutdown":
- OpenSim_Main.Shutdown();
- break;
- }
- return null;
- }
-
- // Shows data about something
- public void ShowCommands(string ShowWhat) {
- switch(ShowWhat) {
- case "uptime":
- this.WriteLine("OpenSim has been running since " + OpenSim_Main.startuptime.ToString());
- this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.startuptime).ToString());
- break;
- case "users":
- OpenSim.world.Avatar TempAv;
- this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
- foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
- TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID];
- this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
- }
- break;
- }
- }
-
- // Displays a prompt to the user and then runs the command they entered
- public void MainConsolePrompt() {
- string[] tempstrarray;
- string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # ");
- tempstrarray = tempstr.Split(' ');
- string cmd=tempstrarray[0];
- Array.Reverse(tempstrarray);
- Array.Resize(ref tempstrarray,tempstrarray.Length-1);
- Array.Reverse(tempstrarray);
- string[] cmdparams=(string[])tempstrarray;
- RunCmd(cmd,cmdparams);
- }
- }
-
-}
diff --git a/src/Util.cs b/src/Util.cs
deleted file mode 100644
index 3b89b25886..0000000000
--- a/src/Util.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-Copyright (c) OpenSim project, http://osgrid.org/
-
-* Copyright (c) ,
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using libsecondlife;
-using libsecondlife.Packets;
-
-namespace OpenSim
-{
- ///
- ///
- public class QueItem {
- public QueItem()
- {
- }
-
- public Packet Packet;
- public bool Incoming;
- }
-
-
- public class BlockingQueue< T > {
- private Queue< T > _queue = new Queue< T >();
- private object _queueSync = new object();
-
- public void Enqueue(T value)
- {
- lock(_queueSync)
- {
- _queue.Enqueue(value);
- Monitor.Pulse(_queueSync);
- }
- }
-
- public T Dequeue()
- {
- lock(_queueSync)
- {
- if( _queue.Count < 1)
- Monitor.Wait(_queueSync);
-
- return _queue.Dequeue();
- }
- }
- }
-
-}
diff --git a/src/VersionInfo.cs b/src/VersionInfo.cs
deleted file mode 100644
index 14581eeeb9..0000000000
--- a/src/VersionInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright (c) OpenSim project, http://osgrid.org/
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-
-namespace OpenSim
-{
- ///
- ///
- public class VersionInfo
- {
- public static string Version = "0.0.1-unofficial";
- }
-}
diff --git a/src/VersionInfo.cs.template b/src/VersionInfo.cs.template
deleted file mode 100644
index e4e1b95ae3..0000000000
--- a/src/VersionInfo.cs.template
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright (c) OpenSim project, http://osgrid.org/
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-
-namespace OpenSim
-{
- ///
- ///
- public class VersionInfo
- {
- public static string Version = "@@VERSION";
- }
-}
diff --git a/src/types/Mesh.cs b/src/types/Mesh.cs
deleted file mode 100644
index 3e00c9130b..0000000000
--- a/src/types/Mesh.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenSim.types
-{
- // TODO: This will need some performance tuning no doubt.
- public class Mesh
- {
- public List mesh;
-
- public Mesh()
- {
- mesh = new List();
- }
-
- public void AddTri(Triangle tri)
- {
- mesh.Add(tri);
- }
-
- public static Mesh operator +(Mesh a, Mesh b)
- {
- a.mesh.AddRange(b.mesh);
- return a;
- }
- }
-}
diff --git a/src/types/Triangle.cs b/src/types/Triangle.cs
deleted file mode 100644
index 8dfea6e762..0000000000
--- a/src/types/Triangle.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Axiom.MathLib;
-
-namespace OpenSim.types
-{
- public class Triangle
- {
- Vector3 a;
- Vector3 b;
- Vector3 c;
-
- public Triangle()
- {
- a = new Vector3();
- b = new Vector3();
- c = new Vector3();
- }
-
- public Triangle(Vector3 A, Vector3 B, Vector3 C)
- {
- a = A;
- b = B;
- c = C;
- }
- }
-}
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
deleted file mode 100644
index 9d8d7d2322..0000000000
--- a/src/world/Avatar.cs
+++ /dev/null
@@ -1,256 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using libsecondlife;
-using libsecondlife.Packets;
-using Axiom.MathLib;
-
-namespace OpenSim.world
-{
- public class Avatar : Entity
- {
- public string firstname;
- public string lastname;
- public OpenSimClient ControllingClient;
- public LLVector3 oldvel;
- public LLVector3 oldpos;
- public uint CurrentKeyMask;
- public bool walking;
-
- private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
-
- public Avatar(OpenSimClient TheClient) {
- OpenSim_Main.localcons.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
- ControllingClient=TheClient;
- SetupTemplate("avatar-template.dat");
-
- position = new LLVector3(100.0f,100.0f,60.0f);
- }
-
- public override void update() {
- lock(this) {
- base.update();
-
- oldvel=this.velocity;
- oldpos=this.position;
- if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) {
- Vector3 tmpVelocity = this.rotation * new Vector3(1.0f,0.0f,0.0f);
- tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.5f;
- this.velocity.X = tmpVelocity.x;
- this.velocity.Y = tmpVelocity.y;
- this.velocity.Z = tmpVelocity.z;
- this.walking=true;
- } else {
- this.velocity.X=0;
- this.velocity.Y=0;
- this.velocity.Z=0;
- this.walking=false;
- }
- }
- }
-
- private void SetupTemplate(string name)
- {
-
- int i = 0;
- FileInfo fInfo = new FileInfo(name);
- long numBytes = fInfo.Length;
- FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
- BinaryReader br = new BinaryReader(fStream);
- byte [] data1 = br.ReadBytes((int)numBytes);
- br.Close();
- fStream.Close();
-
- libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
-
- System.Text.Encoding enc = System.Text.Encoding.ASCII;
- libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
- pos.X = 100f;
- objdata.ID = this.localid;
- objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
- libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f);
- //objdata.FullID=user.AgentID;
- byte[] pb = pos.GetBytes();
- Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
-
- AvatarTemplate = objdata;
-
- }
-
- public void CompleteMovement(World RegionInfo) {
- OpenSim_Main.localcons.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
- AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
- mov.AgentData.SessionID = this.ControllingClient.SessionID;
- mov.AgentData.AgentID = this.ControllingClient.AgentID;
- mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle;
- // TODO - dynamicalise this stuff
- mov.Data.Timestamp = 1172750370;
- mov.Data.Position = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z);
- mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
-
- OpenSim_Main.localcons.WriteLine("Sending AgentMovementComplete packet");
- ControllingClient.OutPacket(mov);
- }
-
- public void SendInitialPosition() {
- System.Text.Encoding _enc = System.Text.Encoding.ASCII;
-
-
- //send a objectupdate packet with information about the clients avatar
- ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
- objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
- objupdate.RegionData.TimeDilation = 64096;
- objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
-
- objupdate.ObjectData[0] = AvatarTemplate;
- //give this avatar object a local id and assign the user a name
- objupdate.ObjectData[0].ID = this.localid;
- //User_info.name="Test"+this.local_numer+" User";
- objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
- objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
-
- libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z);
-
- byte[] pb = pos2.GetBytes();
-
- Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
- OpenSim_Main.local_world._localNumber++;
- this.ControllingClient.OutPacket(objupdate);
- }
-
- public override ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() {
- byte[] bytes = new byte[60];
- int i=0;
- ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
-
- dat.TextureEntry = AvatarTemplate.TextureEntry;
- libsecondlife.LLVector3 pos2 = new LLVector3(this.position.X, this.position.Y, this.position.Z);
-
- uint ID = this.localid;
- bytes[i++] = (byte)(ID % 256);
- bytes[i++] = (byte)((ID >> 8) % 256);
- bytes[i++] = (byte)((ID >> 16) % 256);
- bytes[i++] = (byte)((ID >> 24) % 256);
- bytes[i++] = 0;
- bytes[i++] = 1;
- i += 14;
- bytes[i++] = 128;
- bytes[i++] = 63;
-
- byte[] pb = pos2.GetBytes();
- Array.Copy(pb, 0, bytes, i, pb.Length);
- i += 12;
-
-
- ushort ac = 32767;
- bytes[i++] = (byte)((ushort)(((this.velocity.X/128f)+1)*32767) % 256 );
- bytes[i++] = (byte)(((ushort)(((this.velocity.X/128f)+1)*32767) >> 8) % 256);
- bytes[i++] = (byte)((ushort)(((this.velocity.Y/128f)+1)*32767) % 256);
- bytes[i++] = (byte)(((ushort)(((this.velocity.Y/128f)+1)*32767) >> 8) % 256);
- bytes[i++] = (byte)((ushort)(((this.velocity.Z/128f)+1)*32767) % 256);
- bytes[i++] = (byte)(((ushort)(((this.velocity.Z/128f)+1)*32767) >> 8) % 256);
-
-
-
-
- //accel
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
-
- //rot
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
-
- //rotation vel
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
- bytes[i++] = (byte)(ac % 256);
- bytes[i++] = (byte)((ac >> 8) % 256);
-
- dat.Data=bytes;
- return(dat);
-
- }
-
- public void SendInitialAppearance() {
- AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
- aw.AgentData.AgentID = this.ControllingClient.AgentID;
- aw.AgentData.SerialNum = 0;
- aw.AgentData.SessionID = ControllingClient.SessionID;
-
- aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
- AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock();
- awb.WearableType = (byte)0;
- awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
- awb.ItemID = LLUUID.Random();
- aw.WearableData[0] = awb;
-
- for(int i=1; i<13; i++) {
- awb = new AgentWearablesUpdatePacket.WearableDataBlock();
- awb.WearableType = (byte)i;
- awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
- awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
- aw.WearableData[i] = awb;
- }
-
- ControllingClient.OutPacket(aw);
- }
-
- public void SendRegionHandshake(World RegionInfo) {
- OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
- System.Text.Encoding _enc = System.Text.Encoding.ASCII;
- RegionHandshakePacket handshake = new RegionHandshakePacket();
-
- OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
- handshake.RegionInfo.BillableFactor = 0;
- handshake.RegionInfo.IsEstateManager = false;
- handshake.RegionInfo.TerrainHeightRange00 = 60;
- handshake.RegionInfo.TerrainHeightRange01 = 60;
- handshake.RegionInfo.TerrainHeightRange10 = 60;
- handshake.RegionInfo.TerrainHeightRange11 = 60;
- handshake.RegionInfo.TerrainStartHeight00 = 10;
- handshake.RegionInfo.TerrainStartHeight01 = 10;
- handshake.RegionInfo.TerrainStartHeight10 = 10;
- handshake.RegionInfo.TerrainStartHeight11 = 10;
- handshake.RegionInfo.SimAccess = 13;
- handshake.RegionInfo.WaterHeight = 20.0f;
- handshake.RegionInfo.RegionFlags = 72458694; // TODO: WTF sirs? Use an enum!
- handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0");
- handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
- handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
- handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
- handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
- handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
- handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
- handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
- handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
- handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
- handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
-
- OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
- this.ControllingClient.OutPacket(handshake);
- }
-
- public void HandleAgentUpdate(AgentUpdatePacket update) {
- lock(this) {
- this.CurrentKeyMask = update.AgentData.ControlFlags;
- this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z);
- this.needupdate = true;
- }
- }
-
- }
-}
diff --git a/src/world/Entity.cs b/src/world/Entity.cs
deleted file mode 100644
index 7880a4675b..0000000000
--- a/src/world/Entity.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Axiom.MathLib;
-using libsecondlife;
-using OpenSim.types;
-using libsecondlife.Packets;
-
-namespace OpenSim.world
-{
- public class Entity
- {
- protected libsecondlife.LLUUID uuid;
- protected uint localid;
- public LLVector3 position;
- public LLVector3 velocity;
- protected Quaternion rotation;
- protected string name;
- protected List children;
- public bool needupdate;
-
- public Entity()
- {
- uuid = new libsecondlife.LLUUID();
- localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition!
- position = new LLVector3();
- velocity = new LLVector3();
- rotation = new Quaternion();
- name = "(basic entity)";
- children = new List();
- }
-
- public virtual void update() {
- // Do any per-frame updates needed that are applicable to every type of entity
- foreach (Entity child in children)
- {
- if(child.needupdate)
- child.update();
- }
- this.needupdate=false;
- }
-
- public virtual ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() {
- return null;
- }
-
-
- public virtual string getName()
- {
- return name;
- }
-
- public virtual Mesh getMesh()
- {
- Mesh mesh = new Mesh();
-
- foreach (Entity child in children)
- {
- mesh += child.getMesh();
- }
-
- return mesh;
- }
- }
-}
diff --git a/src/world/HeightmapGenHills.cs b/src/world/HeightmapGenHills.cs
deleted file mode 100644
index 12af005b0e..0000000000
--- a/src/world/HeightmapGenHills.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-using System;
-
-namespace libsecondlife
-{
- public class HeightmapGenHills
- {
- private Random Rand = new Random();
- private int NumHills;
- private float HillMin;
- private float HillMax;
- private bool Island;
- private float[] heightmap;
-
- public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island)
- {
- NumHills = numHills;
- HillMin = hillMin;
- HillMax = hillMax;
- Island = island;
-
- heightmap = new float[256 * 256];
-
- for (int i = 0; i < numHills; i++)
- {
- AddHill();
- }
-
- Normalize();
-
- return heightmap;
- }
-
- private void AddHill()
- {
- float x, y;
- float radius = RandomRange(HillMin, HillMax);
-
- if (Island)
- {
- // Which direction from the center of the map the hill is placed
- float theta = RandomRange(0, 6.28f);
-
- // How far from the center of the map to place the hill. The radius
- // is subtracted from the range to prevent any part of the hill from
- // reaching the edge of the map
- float distance = RandomRange(radius / 2.0f, 128.0f - radius);
-
- x = 128.0f + (float)Math.Cos(theta) * distance;
- y = 128.0f + (float)Math.Sin(theta) * distance;
- }
- else
- {
- x = RandomRange(-radius, 256.0f + radius);
- y = RandomRange(-radius, 256.0f + radius);
- }
-
- float radiusSq = radius * radius;
- float distSq;
- float height;
-
- int xMin = (int)(x - radius) - 1;
- int xMax = (int)(x + radius) + 1;
- if (xMin < 0) xMin = 0;
- if (xMax > 255) xMax = 255;
-
- int yMin = (int)(y - radius) - 1;
- int yMax = (int)(y + radius) + 1;
- if (yMin < 0) yMin = 0;
- if (yMax > 255) yMax = 255;
-
- // Loop through each affected cell and determine the height at that point
- for (int v = yMin; v <= yMax; ++v)
- {
- float fv = (float)v;
-
- for (int h = xMin; h <= xMax; ++h)
- {
- float fh = (float)h;
-
- // Determine how far from the center of this hill this point is
- distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv);
- height = radiusSq - distSq;
-
- // Don't add negative hill values
- if (height > 0.0f) heightmap[h + v * 256] += height;
- }
- }
- }
-
- private void Normalize()
- {
- float min = heightmap[0];
- float max = heightmap[0];
-
- for (int x = 0; x < 256; x++)
- {
- for (int y = 0; y < 256; y++)
- {
- if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256];
- if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256];
- }
- }
-
- // Avoid a rare divide by zero
- if (min != max)
- {
- for (int x = 0; x < 256; x++)
- {
- for (int y = 0; y < 256; y++)
- {
- heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin);
- }
- }
- }
- }
-
- private float RandomRange(float min, float max)
- {
- return (float)Rand.NextDouble() * (max - min) + min;
- }
- }
-}
diff --git a/src/world/PhysicsEngine.cs b/src/world/PhysicsEngine.cs
deleted file mode 100644
index b237f5e133..0000000000
--- a/src/world/PhysicsEngine.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Threading;
-using libsecondlife;
-using libsecondlife.Packets;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenSim.world
-{
- public class PhysicsEngine
- {
-
- public PhysicsEngine() {
- }
-
- public void Startup() {
- OpenSim_Main.localcons.WriteLine("PhysicsEngine.cs:Startup() - DOING NOTHING, DUMMY FUNCTION!");
- }
-
- public void DoStuff(World simworld) {
- foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys)
- {
- simworld.Entities[UUID].position += simworld.Entities[UUID].velocity;
- simworld.Entities[UUID].position.Z = simworld.LandMap[(int)simworld.Entities[UUID].position.Y * 256 + (int)simworld.Entities[UUID].position.X]+1;
- if(simworld.Entities[UUID].position.X<0) simworld.Entities[UUID].position.X=0;
- if(simworld.Entities[UUID].position.Y<0) simworld.Entities[UUID].position.Y=0;
- if(simworld.Entities[UUID].position.X>255) simworld.Entities[UUID].position.X=255;
- if(simworld.Entities[UUID].position.Y>255) simworld.Entities[UUID].position.Y=255;
- }
- }
- }
-}
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs
deleted file mode 100644
index 143fa55a33..0000000000
--- a/src/world/Primitive.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using OpenSim.types;
-
-namespace OpenSim.world
-{
- public class Primitive : Entity
- {
- protected float mesh_cutbegin;
- protected float mesh_cutend;
-
- public Primitive()
- {
- mesh_cutbegin = 0.0f;
- mesh_cutend = 1.0f;
- }
-
- public override Mesh getMesh()
- {
- Mesh mesh = new Mesh();
- Triangle tri = new Triangle(
- new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f),
- new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f),
- new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f));
-
- mesh.AddTri(tri);
- mesh += base.getMesh();
-
- return mesh;
- }
- }
-}
diff --git a/src/world/ScriptEngine.cs b/src/world/ScriptEngine.cs
deleted file mode 100644
index f20a08ec1b..0000000000
--- a/src/world/ScriptEngine.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenSim.world
-{
- public class ScriptEngine
- {
- public ScriptEngine(World env)
- {
- }
-
- public void LoadScript()
- {
-
- }
- }
-}
diff --git a/src/world/SurfacePatch.cs b/src/world/SurfacePatch.cs
deleted file mode 100644
index 71e4116d11..0000000000
--- a/src/world/SurfacePatch.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenSim.world
-{
- public class SurfacePatch
- {
- public float[] HeightMap;
-
- public SurfacePatch() {
- HeightMap = new float[16*16];
-
- int xinc;
- int yinc;
- for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) {
- HeightMap[xinc+(yinc*16)]=100.0f;
- }
-
- }
- }
-}
diff --git a/src/world/World.cs b/src/world/World.cs
deleted file mode 100644
index 158ddc2a1c..0000000000
--- a/src/world/World.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using System;
-using System.Threading;
-using System.Collections.Generic;
-using System.Text;
-using libsecondlife;
-using libsecondlife.Packets;
-
-namespace OpenSim.world
-{
- public class World
- {
- public Dictionary Entities;
- public float[] LandMap;
- public ScriptEngine Scripts;
- public uint _localNumber = 0;
- public PhysicsEngine physics;
-
- private libsecondlife.TerrainManager TerrainManager;
- private Random Rand = new Random();
-
- public World()
- {
- OpenSim_Main.localcons.WriteLine("World.cs - creating new entitities instance");
- Entities = new Dictionary();
-
- OpenSim_Main.localcons.WriteLine("World.cs - creating LandMap");
- TerrainManager = new TerrainManager(new SecondLife());
- }
-
- public void InitLoop()
- {
- OpenSim_Main.localcons.WriteLine("World.cs:StartLoop() - Initialising physics");
- this.physics = new PhysicsEngine();
- physics.Startup();
- }
-
- public void DoStuff()
- {
- lock (this)
- {
- physics.DoStuff(this);
- this.Update();
- }
- }
-
- public void Update()
- {
- foreach (libsecondlife.LLUUID UUID in Entities.Keys)
- {
- if (Entities[UUID].needupdate)
- {
- Entities[UUID].update();
-
- if (Entities[UUID] is Avatar)
- {
- Avatar avatar = (Avatar)Entities[UUID];
- if ((avatar.oldpos != avatar.position) || (avatar.oldvel != avatar.velocity) || avatar.walking)
- {
- ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock();
- foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
- {
- ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
- terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
- terse.RegionData.TimeDilation = 0;
- terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
- terse.ObjectData[0] = terseBlock;
- client.OutPacket(terse);
- }
- }
- }
- }
- }
- }
-
- public void SendLayerData(OpenSimClient RemoteClient)
- {
- int[] patches = new int[4];
-
- for (int y = 0; y < 16; y++)
- {
- for (int x = 0; x < 16; x = x + 4)
- {
- patches[0] = x + 0 + y * 16;
- patches[1] = x + 1 + y * 16;
- patches[2] = x + 2 + y * 16;
- patches[3] = x + 3 + y * 16;
-
- Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches);
- RemoteClient.OutPacket(layerpack);
- }
- }
- }
-
- public void AddViewerAgent(OpenSimClient AgentClient)
- {
- OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
- Avatar NewAvatar = new Avatar(AgentClient);
- OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
- this.Entities.Add(AgentClient.AgentID, NewAvatar);
- OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
- NewAvatar.SendRegionHandshake(this);
- this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
- }
-
- public bool Backup()
- {
- /* TODO: Save the current world entities state. */
-
- return false;
- }
- }
-}
diff --git a/src/world/scripting/IScript.cs b/src/world/scripting/IScript.cs
deleted file mode 100644
index 550594d343..0000000000
--- a/src/world/scripting/IScript.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenSim.world.scripting
-{
- public interface IScriptHost {
- bool Register(IScript iscript);
- }
- public interface IScript
- {
- string Name{get;set;}
- IScriptHost Host{get;set;}
- void Show();
- }
-}