More refactoring, Removed the static variables from OpenSim_Main, and now just have that a singleton of that class.

Moved the abstract SimConfig class to the framework as well as HeightmapGenHills.cs.
Added IUserServer.cs for the interface through which the sim will contact the user server for things like inventory details.
physics-inventorytesting
MW 2007-03-18 16:18:53 +00:00
parent 423c51ac7f
commit d363a96e8d
25 changed files with 446 additions and 464 deletions

View File

@ -27,7 +27,7 @@
using System; using System;
namespace OpenSim namespace OpenSim.Framework.Terrain
{ {
public class HeightmapGenHills public class HeightmapGenHills
{ {

View File

@ -61,21 +61,6 @@ namespace OpenSim.Framework.Interfaces
public bool IsTexture; public bool IsTexture;
} }
/*public class AssetBase
{
public byte[] Data;
public LLUUID FullID;
public sbyte Type;
public sbyte InvType;
public string Name;
public string Description;
public AssetBase()
{
}
}*/
public interface IAssetPlugin public interface IAssetPlugin
{ {
IAssetServer GetAssetServer(); IAssetServer GetAssetServer();

View File

@ -31,9 +31,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.world; //using OpenSim.world;
namespace OpenSim namespace OpenSim.Framework.Interfaces
{ {
/// <summary> /// <summary>
/// This class handles connection to the underlying database used for configuration of the region. /// This class handles connection to the underlying database used for configuration of the region.
@ -60,10 +60,10 @@ namespace OpenSim
public string GridURL; public string GridURL;
public string GridSendKey; public string GridSendKey;
public abstract void InitConfig(); public abstract void InitConfig(bool sandboxMode);
public abstract void LoadFromGrid(); public abstract void LoadFromGrid();
public abstract World LoadWorld(); public abstract float[] LoadWorld();
public abstract void SaveMap(); public abstract void SaveMap(float[] heightmap);
} }

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Inventory;
using libsecondlife;
namespace OpenSim.Framework.Interfaces
{
public interface IUserServer
{
AgentInventory RequestAgentsInventory(LLUUID agentID);
}
}

View File

@ -41,10 +41,13 @@
<ItemGroup> <ItemGroup>
<Compile Include="AssetBase.cs" /> <Compile Include="AssetBase.cs" />
<Compile Include="BlockingQueue.cs" /> <Compile Include="BlockingQueue.cs" />
<Compile Include="HeightMapGenHills.cs" />
<Compile Include="IAssetServer.cs" /> <Compile Include="IAssetServer.cs" />
<Compile Include="IConfig.cs" />
<Compile Include="IGridServer.cs" /> <Compile Include="IGridServer.cs" />
<Compile Include="ILocalStorage.cs" /> <Compile Include="ILocalStorage.cs" />
<Compile Include="Inventory.cs" /> <Compile Include="Inventory.cs" />
<Compile Include="IUserServer.cs" />
<Compile Include="LoginService.cs" /> <Compile Include="LoginService.cs" />
<Compile Include="PrimData.cs" /> <Compile Include="PrimData.cs" />
<Compile Include="SimProfile.cs" /> <Compile Include="SimProfile.cs" />

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory;
namespace OpenSim.Framework.User namespace OpenSim.Framework.User
{ {
@ -75,5 +76,16 @@ namespace OpenSim.Framework.User
return newprofile; return newprofile;
} }
public virtual AgentInventory GetUsersInventory(LLUUID agentID)
{
UserProfile user = this.GetProfileByLLUUID(agentID);
if (user != null)
{
return user.Inventory;
}
return null;
}
} }
} }

View File

@ -8,11 +8,21 @@ namespace OpenSim.Framework.Utilities
{ {
public class Util public class Util
{ {
private static Random randomClass = new Random();
public static ulong UIntsToLong(uint X, uint Y) public static ulong UIntsToLong(uint X, uint Y)
{ {
return Helpers.UIntsToLong(X, Y); return Helpers.UIntsToLong(X, Y);
} }
public static Random RandomClass
{
get
{
return randomClass;
}
}
public Util() public Util()
{ {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -63,7 +63,7 @@ namespace OpenSim
ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
Listener = new HttpListener(); Listener = new HttpListener();
Listener.Prefixes.Add("http://+:" + OpenSim_Main.cfg.IPListenPort + "/"); Listener.Prefixes.Add("http://+:" + OpenSim_Main.Instance.Cfg.IPListenPort + "/");
Listener.Start(); Listener.Start();
HttpListenerContext context; HttpListenerContext context;
@ -96,9 +96,9 @@ namespace OpenSim
agent_data.lastname = (string)requestData["lastname"]; agent_data.lastname = (string)requestData["lastname"];
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote") if (OpenSim_Main.Instance.GridServers.GridServer.GetName() == "Remote")
{ {
((RemoteGridBase)OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); ((RemoteGridBase)OpenSim_Main.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
} }
return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
break; break;

View File

@ -28,7 +28,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim; using OpenSim;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.world; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Terrain;
//using OpenSim.world;
using Db4objects.Db4o; using Db4objects.Db4o;
namespace Db40SimConfig namespace Db40SimConfig
@ -44,6 +46,7 @@ namespace Db40SimConfig
public class DbSimConfig :SimConfig public class DbSimConfig :SimConfig
{ {
private bool isSandbox;
private IObjectContainer db; private IObjectContainer db;
public void LoadDefaults() { public void LoadDefaults() {
@ -55,7 +58,7 @@ namespace Db40SimConfig
this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000")); this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1"); this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
if(!OpenSim_Main.sim.sandbox) if(!isSandbox)
{ {
this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: "); this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: ");
this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: "); this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: ");
@ -65,7 +68,8 @@ namespace Db40SimConfig
this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
} }
public override void InitConfig() { public override void InitConfig(bool sandboxMode) {
this.isSandbox = sandboxMode;
try { try {
db = Db4oFactory.OpenFile("opensim.yap"); db = Db4oFactory.OpenFile("opensim.yap");
IObjectSet result = db.Get(typeof(DbSimConfig)); IObjectSet result = db.Get(typeof(DbSimConfig));
@ -100,37 +104,40 @@ namespace Db40SimConfig
ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString()); ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + isSandbox.ToString());
ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL); ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey); ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL); ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey); ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
} }
public override World LoadWorld() public override float[] LoadWorld()
{ {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world...."); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
World blank = new World(); //World blank = new World();
float[] heightmap = null;
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
IObjectSet world_result = db.Get(typeof(MapStorage)); IObjectSet world_result = db.Get(typeof(MapStorage));
if(world_result.Count>0) { if(world_result.Count>0) {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
MapStorage map=(MapStorage)world_result.Next(); MapStorage map=(MapStorage)world_result.Next();
blank.LandMap = map.Map; //blank.LandMap = map.Map;
heightmap = map.Map;
} else { } else {
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
HeightmapGenHills hills = new HeightmapGenHills(); HeightmapGenHills hills = new HeightmapGenHills();
blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
MapStorage map= new MapStorage(); MapStorage map= new MapStorage();
map.Map = blank.LandMap; map.Map = heightmap; //blank.LandMap;
db.Set(map); db.Set(map);
db.Commit(); db.Commit();
} }
return blank; return heightmap;
} }
public override void SaveMap() public override void SaveMap(float[] heightmap)
{ {
IObjectSet world_result = db.Get(typeof(MapStorage)); IObjectSet world_result = db.Get(typeof(MapStorage));
if(world_result.Count>0) { if(world_result.Count>0) {
@ -139,7 +146,7 @@ namespace Db40SimConfig
db.Delete(map); db.Delete(map);
} }
MapStorage map1= new MapStorage(); MapStorage map1= new MapStorage();
map1.Map = OpenSim_Main.local_world.LandMap; map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
db.Set(map1); db.Set(map1);
db.Commit(); db.Commit();
} }

View File

@ -44,10 +44,6 @@
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
<Name>ServerConsole</Name> <Name>ServerConsole</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\Second-server.csproj">
<Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
<Name>Second-server</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project> </Project>

88
src/Grid.cs Normal file
View File

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.LocalServers;
namespace OpenSim
{
public class Grid
{
public IAssetServer AssetServer;
public IGridServer GridServer;
public string AssetDll = "";
public string GridDll = "";
public Grid()
{
}
public void LoadPlugins()
{
this.AssetServer = this.LoadAssetDll(this.AssetDll);
this.GridServer = this.LoadGridDll(this.GridDll);
}
public void Close()
{
this.AssetServer.Close();
this.GridServer.Close();
}
private IAssetServer LoadAssetDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
IAssetServer server = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
if (!pluginType.IsAbstract)
{
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
if (typeInterface != null)
{
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
server = plug.GetAssetServer();
break;
}
typeInterface = null;
}
}
}
pluginAssembly = null;
return server;
}
private IGridServer LoadGridDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
IGridServer server = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
if (!pluginType.IsAbstract)
{
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
if (typeInterface != null)
{
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
server = plug.GetGridServer();
break;
}
typeInterface = null;
}
}
}
pluginAssembly = null;
return server;
}
}
}

View File

@ -19,13 +19,18 @@ namespace OpenSim.Framework.LocalServers
_gridServer = gridServer; _gridServer = gridServer;
} }
public override void InitUserProfiles()
{
// TODO: need to load from database
}
public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser) public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
{ {
uint circode = (uint)response["circuit_code"]; uint circode = (uint)response["circuit_code"];
theUser.AddSimCircuit(circode, LLUUID.Random()); theUser.AddSimCircuit(circode, LLUUID.Random());
response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
response["sim_port"] = OpenSim_Main.cfg.IPListenPort; response["sim_port"] = OpenSim_Main.Instance.Cfg.IPListenPort;
response["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; response["sim_ip"] = OpenSim_Main.Instance.Cfg.IPListenAddr;
response["region_y"] = (Int32)996 * 256; response["region_y"] = (Int32)996 * 256;
response["region_x"] = (Int32)997* 256; response["region_x"] = (Int32)997* 256;
@ -62,7 +67,7 @@ namespace OpenSim.Framework.LocalServers
_login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]); _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
//working on local computer if so lets add to the gridserver's list of sessions? //working on local computer if so lets add to the gridserver's list of sessions?
if (OpenSim_Main.gridServers.GridServer.GetName() == "Local") if (OpenSim_Main.Instance.GridServers.GridServer.GetName() == "Local")
{ {
((LocalGridBase)this._gridServer).AddNewSession(_login); ((LocalGridBase)this._gridServer).AddNewSession(_login);
} }

View File

@ -42,6 +42,7 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Grid; using OpenSim.Framework.Grid;
using OpenSim.Framework.Inventory; using OpenSim.Framework.Inventory;
using OpenSim.Framework.User; using OpenSim.Framework.User;
using OpenSim.Framework.Utilities;
namespace OpenSim.Framework.LocalServers namespace OpenSim.Framework.LocalServers
{ {
@ -49,20 +50,13 @@ namespace OpenSim.Framework.LocalServers
/// <summary> /// <summary>
/// When running in local (default) mode , handles client logins. /// When running in local (default) mode , handles client logins.
/// </summary> /// </summary>
public class LoginServer : LoginService public class LoginServer : LoginService , IUserServer
{ {
public LoginServer(IGridServer gridServer)
{
_gridServer = gridServer;
}
private Login _login;
private IGridServer _gridServer; private IGridServer _gridServer;
private ushort _loginPort = 8080; private ushort _loginPort = 8080;
public IPAddress clientAddress = IPAddress.Loopback; public IPAddress clientAddress = IPAddress.Loopback;
public IPAddress remoteAddress = IPAddress.Any; public IPAddress remoteAddress = IPAddress.Any;
private Socket loginServer; private Socket loginServer;
private Random RandomClass = new Random();
private int NumClients; private int NumClients;
private string _defaultResponse; private string _defaultResponse;
private bool userAccounts = false; private bool userAccounts = false;
@ -70,6 +64,11 @@ namespace OpenSim.Framework.LocalServers
private bool _needPasswd = false; private bool _needPasswd = false;
private LocalUserProfileManager userManager; private LocalUserProfileManager userManager;
public LoginServer(IGridServer gridServer)
{
_gridServer = gridServer;
}
// InitializeLogin: initialize the login // InitializeLogin: initialize the login
private void InitializeLogin() private void InitializeLogin()
{ {
@ -89,7 +88,10 @@ namespace OpenSim.Framework.LocalServers
} }
SR.Close(); SR.Close();
this._mpasswd = EncodePassword("testpass"); this._mpasswd = EncodePassword("testpass");
userManager = new LocalUserProfileManager(this._gridServer); userManager = new LocalUserProfileManager(this._gridServer);
userManager.InitUserProfiles();
userManager.SetKeys("", "", "", "Welcome to OpenSim");
loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort)); loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
@ -174,6 +176,7 @@ namespace OpenSim.Framework.LocalServers
if (this.userAccounts) if (this.userAccounts)
{ {
//ask the UserProfile Manager to process the request
string reply = this.userManager.ParseXMLRPC(new String(content)); string reply = this.userManager.ParseXMLRPC(new String(content));
// forward the XML-RPC response to the client // forward the XML-RPC response to the client
writer.WriteLine("HTTP/1.0 200 OK"); writer.WriteLine("HTTP/1.0 200 OK");
@ -183,15 +186,31 @@ namespace OpenSim.Framework.LocalServers
} }
else else
{ {
//handle ourselves
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
if (request.MethodName == "login_to_simulator")
{
this.ProcessXmlRequest(request, writer); this.ProcessXmlRequest(request, writer);
} }
else
{
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
Hashtable PresenceErrorRespData = new Hashtable();
PresenceErrorRespData["reason"] = "XmlRequest"; ;
PresenceErrorRespData["message"] = "Unknown Rpc request";
PresenceErrorRespData["login"] = "false";
PresenceErrorResp.Value = PresenceErrorRespData;
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
writer.WriteLine("HTTP/1.0 200 OK");
writer.WriteLine("Content-type: text/xml");
writer.WriteLine();
writer.WriteLine(reply);
}
}
} }
} }
public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer) public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer)
{
if (request.MethodName == "login_to_simulator")
{ {
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
string first; string first;
@ -230,16 +249,25 @@ namespace OpenSim.Framework.LocalServers
if (!Authenticate(first, last, passwd)) if (!Authenticate(first, last, passwd))
{ {
// Fail miserably XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
writer.WriteLine("HTTP/1.0 403 Authentication Forbidden"); Hashtable PresenceErrorRespData = new Hashtable();
PresenceErrorRespData["reason"] = "key"; ;
PresenceErrorRespData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
PresenceErrorRespData["login"] = "false";
PresenceErrorResp.Value = PresenceErrorRespData;
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
writer.WriteLine("HTTP/1.0 200 OK");
writer.WriteLine("Content-type: text/xml");
writer.WriteLine(); writer.WriteLine();
writer.WriteLine(reply);
return false; return false;
} }
NumClients++; NumClients++;
//create a agent and session LLUUID //create a agent and session LLUUID
Agent = GetAgentId(first, last); Agent = GetAgentId(first, last);
int SessionRand = this.RandomClass.Next(1, 999); int SessionRand = Util.RandomClass.Next(1, 999);
Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797"); Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
//create some login info //create some login info
@ -261,8 +289,8 @@ namespace OpenSim.Framework.LocalServers
XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
Hashtable responseData = (Hashtable)response.Value; Hashtable responseData = (Hashtable)response.Value;
responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort; responseData["sim_port"] = OpenSim_Main.Instance.Cfg.IPListenPort;
responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr; responseData["sim_ip"] = OpenSim_Main.Instance.Cfg.IPListenAddr;
responseData["agent_id"] = Agent.ToStringHyphenated(); responseData["agent_id"] = Agent.ToStringHyphenated();
responseData["session_id"] = Session.ToStringHyphenated(); responseData["session_id"] = Session.ToStringHyphenated();
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
@ -286,7 +314,7 @@ namespace OpenSim.Framework.LocalServers
CustomiseLoginResponse(responseData, first, last); CustomiseLoginResponse(responseData, first, last);
this._login = new Login(); Login _login = new Login();
//copy data to login object //copy data to login object
_login.First = first; _login.First = first;
_login.Last = last; _login.Last = last;
@ -296,7 +324,7 @@ namespace OpenSim.Framework.LocalServers
_login.InventoryFolder = InventoryFolderID; _login.InventoryFolder = InventoryFolderID;
//working on local computer if so lets add to the gridserver's list of sessions? //working on local computer if so lets add to the gridserver's list of sessions?
if (OpenSim_Main.gridServers.GridServer.GetName() == "Local") if (OpenSim_Main.Instance.GridServers.GridServer.GetName() == "Local")
{ {
((LocalGridBase)this._gridServer).AddNewSession(_login); ((LocalGridBase)this._gridServer).AddNewSession(_login);
} }
@ -309,12 +337,7 @@ namespace OpenSim.Framework.LocalServers
XmlTextWriter responseWriter = new XmlTextWriter(writer); XmlTextWriter responseWriter = new XmlTextWriter(writer);
XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response); XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
responseWriter.Close(); responseWriter.Close();
}
else
{
writer.WriteLine("HTTP/1.0 403 Authentication Forbidden");
writer.WriteLine();
}
return true; return true;
} }
@ -325,7 +348,7 @@ namespace OpenSim.Framework.LocalServers
protected virtual LLUUID GetAgentId(string firstName, string lastName) protected virtual LLUUID GetAgentId(string firstName, string lastName)
{ {
LLUUID Agent; LLUUID Agent;
int AgentRand = this.RandomClass.Next(1, 9999); int AgentRand = Util.RandomClass.Next(1, 9999);
Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead"); Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
return Agent; return Agent;
} }
@ -365,6 +388,17 @@ namespace OpenSim.Framework.LocalServers
return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower(); return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
} }
public AgentInventory RequestAgentsInventory(LLUUID agentID)
{
AgentInventory aInventory = null;
if (this.userAccounts)
{
aInventory = this.userManager.GetUsersInventory(agentID);
}
return aInventory;
}
} }

View File

@ -52,12 +52,23 @@ namespace OpenSim
/// </summary> /// </summary>
public class OpenSim_Main public class OpenSim_Main
{ {
public static OpenSim_Main sim; private static OpenSim_Main instance = null;
public static SimConfig cfg;
public static World local_world; public static OpenSim_Main Instance
public static Grid gridServers; {
get
{
return instance;
}
}
public World LocalWorld;
public Grid GridServers;
public SimConfig Cfg;
public SimCAPSHTTPServer HttpServer;
public AssetCache AssetCache;
public InventoryManager InventoryCache;
public SimCAPSHTTPServer http_server;
public Socket Server; public Socket Server;
private IPEndPoint ServerIncoming; private IPEndPoint ServerIncoming;
private byte[] RecvBuffer = new byte[4096]; private byte[] RecvBuffer = new byte[4096];
@ -66,8 +77,6 @@ namespace OpenSim
private EndPoint epSender; private EndPoint epSender;
private AsyncCallback ReceivedData; private AsyncCallback ReceivedData;
public AssetCache assetCache;
public InventoryManager inventoryManager;
public DateTime startuptime; public DateTime startuptime;
public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>(); public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
private PhysicsManager physManager; private PhysicsManager physManager;
@ -84,55 +93,55 @@ namespace OpenSim
Console.WriteLine("Starting...\n"); Console.WriteLine("Starting...\n");
ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0); ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0);
sim = new OpenSim_Main(); instance = new OpenSim_Main();
sim.sandbox = false; Instance.sandbox = false;
sim.loginserver = false; Instance.loginserver = false;
sim._physicsEngine = "PhysX"; Instance._physicsEngine = "PhysX";
for (int i = 0; i < args.Length; i++) for (int i = 0; i < args.Length; i++)
{ {
if (args[i] == "-sandbox") if (args[i] == "-sandbox")
{ {
sim.sandbox = true; Instance.sandbox = true;
} }
if (args[i] == "-loginserver") if (args[i] == "-loginserver")
{ {
sim.loginserver = true; Instance.loginserver = true;
} }
if (args[i] == "-realphysx") if (args[i] == "-realphysx")
{ {
sim._physicsEngine = "RealPhysX"; Instance._physicsEngine = "RealPhysX";
OpenSim.world.Avatar.PhysicsEngineFlying = true; OpenSim.world.Avatar.PhysicsEngineFlying = true;
} }
} }
OpenSim_Main.gridServers = new Grid(); OpenSim_Main.Instance.GridServers = new Grid();
if (sim.sandbox) if (Instance.sandbox)
{ {
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll"; OpenSim_Main.Instance.GridServers.AssetDll = "LocalGridServers.dll";
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll"; OpenSim_Main.Instance.GridServers.GridDll = "LocalGridServers.dll";
OpenSim_Main.gridServers.LoadPlugins(); OpenSim_Main.Instance.GridServers.LoadPlugins();
ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode"); ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
} }
else else
{ {
OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll"; OpenSim_Main.Instance.GridServers.AssetDll = "RemoteGridServers.dll";
OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll"; OpenSim_Main.Instance.GridServers.GridDll = "RemoteGridServers.dll";
OpenSim_Main.gridServers.LoadPlugins(); OpenSim_Main.Instance.GridServers.LoadPlugins();
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode"); ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
} }
if (sim.loginserver && sim.sandbox) if (Instance.loginserver && Instance.sandbox)
{ {
LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer); LoginServer loginServer = new LoginServer(OpenSim_Main.Instance.GridServers.GridServer);
loginServer.Startup(); loginServer.Startup();
} }
sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer); Instance.AssetCache = new AssetCache(OpenSim_Main.Instance.GridServers.AssetServer);
sim.inventoryManager = new InventoryManager(); Instance.InventoryCache = new InventoryManager();
sim.Startup(); Instance.Startup();
while (true) while (true)
{ {
@ -150,41 +159,41 @@ namespace OpenSim
// We check our local database first, then the grid for config options // We check our local database first, then the grid for config options
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
cfg = this.LoadConfigDll(this.ConfigDll); Cfg = this.LoadConfigDll(this.ConfigDll);
cfg.InitConfig(); Cfg.InitConfig(this.sandbox);
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver"); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
cfg.LoadFromGrid(); Cfg.LoadFromGrid();
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + Cfg.RegionName + " at " + Cfg.RegionLocX.ToString() + "," + Cfg.RegionLocY.ToString());
ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
local_world = cfg.LoadWorld(); Instance.LocalWorld = new World();
Instance.LocalWorld.LandMap = Cfg.LoadWorld();
this.physManager = new PhysicsSystem.PhysicsManager(); this.physManager = new PhysicsSystem.PhysicsManager();
this.physManager.LoadPlugins(); this.physManager.LoadPlugins();
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
local_world.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
local_world.PhysScene.SetTerrain(local_world.LandMap); Instance.LocalWorld.PhysScene.SetTerrain(Instance.LocalWorld.LandMap);
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey); OpenSim_Main.Instance.GridServers.AssetServer.SetServerInfo(OpenSim_Main.Instance.Cfg.AssetURL, OpenSim_Main.Instance.Cfg.AssetSendKey);
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey); OpenSim_Main.Instance.GridServers.GridServer.SetServerInfo(OpenSim_Main.Instance.Cfg.GridURL, OpenSim_Main.Instance.Cfg.GridSendKey);
local_world.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded. Instance.LocalWorld.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded.
local_world.LoadPrimsFromStorage(); Instance.LocalWorld.LoadPrimsFromStorage();
if (this.sandbox) if (this.sandbox)
{ {
this.assetCache.LoadDefaultTextureSet(); this.AssetCache.LoadDefaultTextureSet();
} }
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
http_server = new SimCAPSHTTPServer(); HttpServer = new SimCAPSHTTPServer();
timer1.Enabled = true; timer1.Enabled = true;
timer1.Interval = 100; timer1.Interval = 100;
timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick); timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick);
MainServerListener(); MainServerListener();
} }
private SimConfig LoadConfigDll(string dllName) private SimConfig LoadConfigDll(string dllName)
@ -244,9 +253,9 @@ namespace OpenSim
private void MainServerListener() private void MainServerListener()
{ {
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started"); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + Cfg.IPListenAddr + ":" + Cfg.IPListenPort);
ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); ServerIncoming = new IPEndPoint(IPAddress.Any, Cfg.IPListenPort);
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
Server.Bind(ServerIncoming); Server.Bind(ServerIncoming);
@ -268,8 +277,8 @@ namespace OpenSim
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients"); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
// IMPLEMENT THIS // IMPLEMENT THIS
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
OpenSim_Main.local_world.Close(); OpenSim_Main.Instance.LocalWorld.Close();
OpenSim_Main.gridServers.Close(); OpenSim_Main.Instance.GridServers.Close();
ServerConsole.MainConsole.Instance.Close(); ServerConsole.MainConsole.Instance.Close();
Environment.Exit(0); Environment.Exit(0);
} }
@ -277,86 +286,9 @@ namespace OpenSim
void Timer1Tick(object sender, System.EventArgs e) void Timer1Tick(object sender, System.EventArgs e)
{ {
local_world.Update(); Instance.LocalWorld.Update();
} }
} }
public class Grid
{
public IAssetServer AssetServer;
public IGridServer GridServer;
public string AssetDll = "";
public string GridDll = "";
public Grid()
{
}
public void LoadPlugins()
{
this.AssetServer = this.LoadAssetDll(this.AssetDll);
this.GridServer = this.LoadGridDll(this.GridDll);
}
public void Close()
{
this.AssetServer.Close();
this.GridServer.Close();
}
private IAssetServer LoadAssetDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
IAssetServer server = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
if (!pluginType.IsAbstract)
{
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
if (typeInterface != null)
{
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
server = plug.GetAssetServer();
break;
}
typeInterface = null;
}
}
}
pluginAssembly = null;
return server;
}
private IGridServer LoadGridDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
IGridServer server = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
if (!pluginType.IsAbstract)
{
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
if (typeInterface != null)
{
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
server = plug.GetGridServer();
break;
}
typeInterface = null;
}
}
}
pluginAssembly = null;
return server;
}
}
} }

View File

@ -103,15 +103,15 @@ namespace OpenSim
switch (Pack.Type) switch (Pack.Type)
{ {
case PacketType.CompleteAgentMovement: case PacketType.CompleteAgentMovement:
ClientAvatar.CompleteMovement(OpenSim_Main.local_world); ClientAvatar.CompleteMovement(OpenSim_Main.Instance.LocalWorld);
ClientAvatar.SendInitialPosition(); ClientAvatar.SendInitialPosition();
break; break;
case PacketType.RegionHandshakeReply: case PacketType.RegionHandshakeReply:
OpenSim_Main.local_world.SendLayerData(this); OpenSim_Main.Instance.LocalWorld.SendLayerData(this);
break; break;
case PacketType.AgentWearablesRequest: case PacketType.AgentWearablesRequest:
ClientAvatar.SendInitialAppearance(); ClientAvatar.SendInitialAppearance();
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
if (client.AgentID != this.AgentID) if (client.AgentID != this.AgentID)
{ {
@ -120,10 +120,10 @@ namespace OpenSim
client.ClientAvatar.SendAppearanceToOtherAgent(this); client.ClientAvatar.SendAppearanceToOtherAgent(this);
} }
} }
OpenSim_Main.local_world.GetInitialPrims(this); OpenSim_Main.Instance.LocalWorld.GetInitialPrims(this);
break; break;
case PacketType.ObjectAdd: case PacketType.ObjectAdd:
OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); OpenSim_Main.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this);
break; break;
case PacketType.ObjectLink: case PacketType.ObjectLink:
ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString()); ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString());
@ -135,7 +135,7 @@ namespace OpenSim
ObjectShapePacket shape = (ObjectShapePacket)Pack; ObjectShapePacket shape = (ObjectShapePacket)Pack;
for (int i = 0; i < shape.ObjectData.Length; i++) for (int i = 0; i < shape.ObjectData.Length; i++)
{ {
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
{ {
if (ent.localid == shape.ObjectData[i].ObjectLocalID) if (ent.localid == shape.ObjectData[i].ObjectLocalID)
{ {
@ -152,7 +152,7 @@ namespace OpenSim
if (multipleupdate.ObjectData[i].Type == 9) //change position if (multipleupdate.ObjectData[i].Type == 9) //change position
{ {
libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
{ {
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
{ {
@ -166,7 +166,7 @@ namespace OpenSim
else if (multipleupdate.ObjectData[i].Type == 10)//rotation else if (multipleupdate.ObjectData[i].Type == 10)//rotation
{ {
libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
{ {
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
{ {
@ -179,7 +179,7 @@ namespace OpenSim
{ {
libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
{ {
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
{ {
@ -193,13 +193,13 @@ namespace OpenSim
RequestImagePacket imageRequest = (RequestImagePacket)Pack; RequestImagePacket imageRequest = (RequestImagePacket)Pack;
for (int i = 0; i < imageRequest.RequestImage.Length; i++) for (int i = 0; i < imageRequest.RequestImage.Length; i++)
{ {
OpenSim_Main.sim.assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); OpenSim_Main.Instance.AssetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
} }
break; break;
case PacketType.TransferRequest: case PacketType.TransferRequest:
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
TransferRequestPacket transfer = (TransferRequestPacket)Pack; TransferRequestPacket transfer = (TransferRequestPacket)Pack;
OpenSim_Main.sim.assetCache.AddAssetRequest(this, transfer); OpenSim_Main.Instance.AssetCache.AddAssetRequest(this, transfer);
break; break;
case PacketType.AgentUpdate: case PacketType.AgentUpdate:
ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
@ -219,17 +219,17 @@ namespace OpenSim
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
kill.ObjectData[0].ID = this.ClientAvatar.localid; kill.ObjectData[0].ID = this.ClientAvatar.localid;
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(kill); client.OutPacket(kill);
} }
OpenSim_Main.gridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); OpenSim_Main.Instance.GridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
lock (OpenSim_Main.local_world.Entities) lock (OpenSim_Main.Instance.LocalWorld.Entities)
{ {
OpenSim_Main.local_world.Entities.Remove(this.AgentID); OpenSim_Main.Instance.LocalWorld.Entities.Remove(this.AgentID);
} }
//need to do other cleaning up here too //need to do other cleaning up here too
OpenSim_Main.sim.ClientThreads.Remove(this.userEP); OpenSim_Main.Instance.ClientThreads.Remove(this.userEP);
this.ClientThread.Abort(); this.ClientThread.Abort();
break; break;
case PacketType.ChatFromViewer: case PacketType.ChatFromViewer:
@ -246,7 +246,7 @@ namespace OpenSim
reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
reply.ChatData.OwnerID = this.AgentID; reply.ChatData.OwnerID = this.AgentID;
reply.ChatData.SourceID = this.AgentID; reply.ChatData.SourceID = this.AgentID;
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(reply); client.OutPacket(reply);
} }
@ -255,7 +255,7 @@ namespace OpenSim
ObjectImagePacket imagePack = (ObjectImagePacket)Pack; ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
for (int i = 0; i < imagePack.ObjectData.Length; i++) for (int i = 0; i < imagePack.ObjectData.Length; i++)
{ {
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
{ {
if (ent.localid == imagePack.ObjectData[i].ObjectLocalID) if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
{ {
@ -266,7 +266,7 @@ namespace OpenSim
break; break;
case PacketType.ObjectFlagUpdate: case PacketType.ObjectFlagUpdate:
ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values) foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
{ {
if (ent.localid == flags.AgentData.ObjectLocalID) if (ent.localid == flags.AgentData.ObjectLocalID)
{ {
@ -321,11 +321,11 @@ namespace OpenSim
case PacketType.FetchInventory: case PacketType.FetchInventory:
Console.WriteLine("fetch item packet"); Console.WriteLine("fetch item packet");
FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
OpenSim_Main.sim.inventoryManager.FetchInventory(this, FetchInventory); OpenSim_Main.Instance.InventoryCache.FetchInventory(this, FetchInventory);
break; break;
case PacketType.FetchInventoryDescendents: case PacketType.FetchInventoryDescendents:
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
OpenSim_Main.sim.inventoryManager.FetchInventoryDescendents(this, Fetch); OpenSim_Main.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch);
break; break;
} }
} }
@ -464,11 +464,11 @@ namespace OpenSim
if (Pack.Header.Zerocoded) if (Pack.Header.Zerocoded)
{ {
int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
OpenSim_Main.sim.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None, userEP); OpenSim_Main.Instance.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None, userEP);
} }
else else
{ {
OpenSim_Main.sim.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None, userEP); OpenSim_Main.Instance.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None, userEP);
} }
} }
catch (Exception) catch (Exception)
@ -569,14 +569,14 @@ namespace OpenSim
private void InitNewClient() private void InitNewClient()
{ {
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
OpenSim_Main.local_world.AddViewerAgent(this); OpenSim_Main.Instance.LocalWorld.AddViewerAgent(this);
world.Entity tempent = OpenSim_Main.local_world.Entities[this.AgentID]; world.Entity tempent = OpenSim_Main.Instance.LocalWorld.Entities[this.AgentID];
this.ClientAvatar = (world.Avatar)tempent; this.ClientAvatar = (world.Avatar)tempent;
} }
private void AuthUser() private void AuthUser()
{ {
AuthenticateResponse sessionInfo = OpenSim_Main.gridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); AuthenticateResponse sessionInfo = OpenSim_Main.Instance.GridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
if (!sessionInfo.Authorised) if (!sessionInfo.Authorised)
{ {
//session/circuit not authorised //session/circuit not authorised
@ -595,16 +595,16 @@ namespace OpenSim
this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last; this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
// Create Inventory, currently only works for sandbox mode // Create Inventory, currently only works for sandbox mode
if (OpenSim_Main.sim.sandbox) if (OpenSim_Main.Instance.sandbox)
{ {
if (sessionInfo.LoginInfo.InventoryFolder != null) if (sessionInfo.LoginInfo.InventoryFolder != null)
{ {
this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
if (sessionInfo.LoginInfo.BaseFolder != null) if (sessionInfo.LoginInfo.BaseFolder != null)
{ {
OpenSim_Main.sim.inventoryManager.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); OpenSim_Main.Instance.InventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
AssetBase[] inventorySet = OpenSim_Main.sim.assetCache.CreateNewInventorySet(this.AgentID); AssetBase[] inventorySet = OpenSim_Main.Instance.AssetCache.CreateNewInventorySet(this.AgentID);
if (inventorySet != null) if (inventorySet != null)
{ {
for (int i = 0; i < inventorySet.Length; i++) for (int i = 0; i < inventorySet.Length; i++)
@ -612,7 +612,7 @@ namespace OpenSim
if (inventorySet[i] != null) if (inventorySet[i] != null)
{ {
Console.WriteLine(Helpers.FieldToString(inventorySet[i].Data)); Console.WriteLine(Helpers.FieldToString(inventorySet[i].Data));
OpenSim_Main.sim.inventoryManager.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]); OpenSim_Main.Instance.InventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
} }
} }
} }
@ -628,8 +628,8 @@ namespace OpenSim
{ {
AgentInventory inventory = new AgentInventory(); AgentInventory inventory = new AgentInventory();
inventory.AgentID = this.AgentID; inventory.AgentID = this.AgentID;
OpenSim_Main.sim.inventoryManager.AddNewAgentsInventory(inventory); OpenSim_Main.Instance.InventoryCache.AddNewAgentsInventory(inventory);
OpenSim_Main.sim.inventoryManager.CreateNewInventoryFolder(this, baseFolder); OpenSim_Main.Instance.InventoryCache.CreateNewInventoryFolder(this, baseFolder);
} }
} }

View File

@ -156,7 +156,7 @@ namespace OpenSim
break; break;
case "regenerate": case "regenerate":
OpenSim_Main.local_world.RegenerateTerrain(); OpenSim_Main.Instance.LocalWorld.RegenerateTerrain();
break; break;
case "shutdown": case "shutdown":
@ -170,16 +170,16 @@ namespace OpenSim
public override void ShowCommands(string ShowWhat) { public override void ShowCommands(string ShowWhat) {
switch(ShowWhat) { switch(ShowWhat) {
case "uptime": case "uptime":
this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString()); this.WriteLine("OpenSim has been running since " + OpenSim_Main.Instance.startuptime.ToString());
this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString()); this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.Instance.startuptime).ToString());
break; break;
case "users": case "users":
OpenSim.world.Avatar TempAv; 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")); 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) { foreach (libsecondlife.LLUUID UUID in OpenSim_Main.Instance.LocalWorld.Entities.Keys) {
if(OpenSim_Main.local_world.Entities[UUID].ToString()== "OpenSim.world.Avatar") if(OpenSim_Main.Instance.LocalWorld.Entities[UUID].ToString()== "OpenSim.world.Avatar")
{ {
TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID]; TempAv=(OpenSim.world.Avatar)OpenSim_Main.Instance.LocalWorld.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())); 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()));
} }
} }
@ -190,7 +190,7 @@ namespace OpenSim
// Displays a prompt to the user and then runs the command they entered // Displays a prompt to the user and then runs the command they entered
public override void MainConsolePrompt() { public override void MainConsolePrompt() {
string[] tempstrarray; string[] tempstrarray;
string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # "); string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.Instance.Cfg.RegionHandle.ToString() + " # ");
tempstrarray = tempstr.Split(' '); tempstrarray = tempstr.Split(' ');
string cmd=tempstrarray[0]; string cmd=tempstrarray[0];
Array.Reverse(tempstrarray); Array.Reverse(tempstrarray);

View File

@ -57,7 +57,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets\InventoryManager.cs" /> <Compile Include="Assets\InventoryManager.cs" />
<Compile Include="Config.cs" /> <Compile Include="Grid.cs" />
<Compile Include="GridServers\LocalUserProfileManager.cs" /> <Compile Include="GridServers\LocalUserProfileManager.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="OpenSimClient.cs" /> <Compile Include="OpenSimClient.cs" />
@ -73,20 +73,11 @@
<Compile Include="GridServers\LoginServer.cs" /> <Compile Include="GridServers\LoginServer.cs" />
<Compile Include="Assets\AssetCache.cs" /> <Compile Include="Assets\AssetCache.cs" />
<Compile Include="OpenSimConsole.cs" /> <Compile Include="OpenSimConsole.cs" />
<Compile Include="HeightMapGenHills.cs" />
<Compile Include="VersionInfo.cs" /> <Compile Include="VersionInfo.cs" />
<Compile Include="CAPS\SimHttp.cs"> <Compile Include="CAPS\SimHttp.cs">
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="LocalServers\LocalGridServers\LocalGridServers.csproj">
<Project>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</Project>
<Name>LocalGridServers</Name>
</ProjectReference>
<ProjectReference Include="LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj">
<Project>{74784F23-B0FD-484C-82C1-96C0215733DC}</Project>
<Name>Db4LocalStorage</Name>
</ProjectReference>
<ProjectReference Include="..\OpenSim.FrameWork\OpenSim.Framework.csproj"> <ProjectReference Include="..\OpenSim.FrameWork\OpenSim.Framework.csproj">
<Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project> <Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project>
<Name>OpenSim.Framework</Name> <Name>OpenSim.Framework</Name>
@ -95,10 +86,6 @@
<Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project> <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
<Name>PhysicsManager</Name> <Name>PhysicsManager</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="RemoteServers\RemoteGridServers\RemoteGridServers.csproj">
<Project>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</Project>
<Name>RemoteGridServers</Name>
</ProjectReference>
<ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj"> <ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj">
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
<Name>ServerConsole</Name> <Name>ServerConsole</Name>

View File

@ -1,88 +0,0 @@
/*
Copyright (c) OpenSim project, http://osgrid.org/
* Copyright (c) <year>, <copyright holder>
* 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 <organization> 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 <copyright holder> ``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 <copyright holder> 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
{
/// <summary>
/// </summary>
///
public class Util
{
public static ulong UIntsToLong(uint X, uint Y)
{
return Helpers.UIntsToLong(X, Y);
}
public Util()
{
}
}
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();
}
}
}
}

View File

@ -27,9 +27,9 @@ namespace OpenSim.world
{ {
ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
ControllingClient = TheClient; ControllingClient = TheClient;
localid = 8880000 + (OpenSim_Main.local_world._localNumber++); localid = 8880000 + (OpenSim_Main.Instance.LocalWorld._localNumber++);
position = new LLVector3(100.0f, 100.0f, 30.0f); position = new LLVector3(100.0f, 100.0f, 30.0f);
position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1; position.Z = OpenSim_Main.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
} }
public PhysicsActor PhysActor public PhysicsActor PhysActor
@ -73,11 +73,11 @@ namespace OpenSim.world
//use CreateTerseBlock() //use CreateTerseBlock()
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME terse.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle; // FIXME
terse.RegionData.TimeDilation = 64096; terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock; terse.ObjectData[0] = terseBlock;
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(terse); client.OutPacket(terse);
} }
@ -95,11 +95,11 @@ namespace OpenSim.world
//It has been a while since last update was sent so lets send one. //It has been a while since last update was sent so lets send one.
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME terse.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle; // FIXME
terse.RegionData.TimeDilation = 64096; terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock; terse.ObjectData[0] = terseBlock;
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(terse); client.OutPacket(terse);
} }
@ -141,7 +141,7 @@ namespace OpenSim.world
AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.AgentData.SessionID = this.ControllingClient.SessionID; mov.AgentData.SessionID = this.ControllingClient.SessionID;
mov.AgentData.AgentID = this.ControllingClient.AgentID; mov.AgentData.AgentID = this.ControllingClient.AgentID;
mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle; mov.Data.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
// TODO - dynamicalise this stuff // TODO - dynamicalise this stuff
mov.Data.Timestamp = 1172750370; mov.Data.Timestamp = 1172750370;
mov.Data.Position = new LLVector3(100f, 100f, 23f); mov.Data.Position = new LLVector3(100f, 100f, 23f);
@ -156,7 +156,7 @@ namespace OpenSim.world
System.Text.Encoding _enc = System.Text.Encoding.ASCII; System.Text.Encoding _enc = System.Text.Encoding.ASCII;
//send a objectupdate packet with information about the clients avatar //send a objectupdate packet with information about the clients avatar
ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; objupdate.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
objupdate.RegionData.TimeDilation = 64096; objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
@ -171,9 +171,9 @@ namespace OpenSim.world
byte[] pb = pos2.GetBytes(); byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
OpenSim_Main.local_world._localNumber++; OpenSim_Main.Instance.LocalWorld._localNumber++;
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(objupdate); client.OutPacket(objupdate);
if (client.AgentID != ControllingClient.AgentID) if (client.AgentID != ControllingClient.AgentID)
@ -215,7 +215,7 @@ namespace OpenSim.world
System.Text.Encoding _enc = System.Text.Encoding.ASCII; System.Text.Encoding _enc = System.Text.Encoding.ASCII;
//send a objectupdate packet with information about the clients avatar //send a objectupdate packet with information about the clients avatar
ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; objupdate.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
objupdate.RegionData.TimeDilation = 64096; objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
@ -394,7 +394,7 @@ namespace OpenSim.world
handshake.RegionInfo.SimAccess = 13; handshake.RegionInfo.SimAccess = 13;
handshake.RegionInfo.WaterHeight = 20; handshake.RegionInfo.WaterHeight = 20;
handshake.RegionInfo.RegionFlags = 72458694; handshake.RegionInfo.RegionFlags = 72458694;
handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0"); handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.Instance.Cfg.RegionName + "\0");
handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");

View File

@ -99,7 +99,7 @@ namespace OpenSim.world
{ {
if (this.newPrimFlag) if (this.newPrimFlag)
{ {
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(OurPacket); client.OutPacket(OurPacket);
} }
@ -108,11 +108,11 @@ namespace OpenSim.world
else if (this.updateFlag) else if (this.updateFlag)
{ {
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME terse.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle; // FIXME
terse.RegionData.TimeDilation = 64096; terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = this.CreateImprovedBlock(); terse.ObjectData[0] = this.CreateImprovedBlock();
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(terse); client.OutPacket(terse);
} }
@ -120,7 +120,7 @@ namespace OpenSim.world
} }
else if (this.dirtyFlag) else if (this.dirtyFlag)
{ {
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
UpdateClient(client); UpdateClient(client);
} }
@ -131,11 +131,11 @@ namespace OpenSim.world
if (this._physActor != null && this.physicsEnabled) if (this._physActor != null && this.physicsEnabled)
{ {
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME terse.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle; // FIXME
terse.RegionData.TimeDilation = 64096; terse.RegionData.TimeDilation = 64096;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = this.CreateImprovedBlock(); terse.ObjectData[0] = this.CreateImprovedBlock();
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
{ {
client.OutPacket(terse); client.OutPacket(terse);
} }
@ -254,7 +254,7 @@ namespace OpenSim.world
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
{ {
ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; objupdate.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
objupdate.RegionData.TimeDilation = 64096; objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
@ -301,8 +301,6 @@ namespace OpenSim.world
PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
//finish off copying rest of shape data
objupdate.ObjectData[0].ID = (uint)(localID); objupdate.ObjectData[0].ID = (uint)(localID);
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000")); objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000"));
objupdate.ObjectData[0].ObjectData = new byte[60]; objupdate.ObjectData[0].ObjectData = new byte[60];
@ -324,7 +322,7 @@ namespace OpenSim.world
{ {
//need to clean this up as it shares a lot of code with CreateFromPacket() //need to clean this up as it shares a lot of code with CreateFromPacket()
ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; objupdate.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
objupdate.RegionData.TimeDilation = 64096; objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
@ -476,12 +474,11 @@ namespace OpenSim.world
public override void BackUp() public override void BackUp()
{ {
this.primData.FullID = this.uuid; this.primData.FullID = this.uuid;
this.primData.LocalID = this.localid; this.primData.LocalID = this.localid;
this.primData.Position = this.position; this.primData.Position = this.position;
this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w); this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
OpenSim_Main.local_world.localStorage.StorePrim(this.primData); OpenSim_Main.Instance.LocalWorld.localStorage.StorePrim(this.primData);
} }
} }

View File

@ -8,6 +8,7 @@ using System.IO;
using PhysicsSystem; using PhysicsSystem;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Assets; using OpenSim.Framework.Assets;
using OpenSim.Framework.Terrain;
namespace OpenSim.world namespace OpenSim.world
{ {
@ -113,9 +114,9 @@ namespace OpenSim.world
HeightmapGenHills hills = new HeightmapGenHills(); HeightmapGenHills hills = new HeightmapGenHills();
this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
this.phyScene.SetTerrain(this.LandMap); this.phyScene.SetTerrain(this.LandMap);
OpenSim_Main.cfg.SaveMap(); OpenSim_Main.Instance.Cfg.SaveMap(this.LandMap);
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { foreach(OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values) {
this.SendLayerData(client); this.SendLayerData(client);
} }
} }