Die WebFrontEnd, Die Grid class!

merge
MW 2007-05-26 14:34:57 +00:00
parent 5f62631332
commit c3a40b7d42
11 changed files with 47 additions and 789 deletions

View File

@ -19,238 +19,16 @@ namespace OpenSim.CAPS
private string NewAccountForm; private string NewAccountForm;
private string LoginForm; private string LoginForm;
private string passWord = "Admin"; private string passWord = "Admin";
private World m_world;
private LoginServer _userServer;
private InventoryCache _inventoryCache;
public AdminWebFront(string password, World world, InventoryCache inventoryCache, LoginServer userserver)
public AdminWebFront(string password)
{ {
_inventoryCache = inventoryCache;
_userServer = userserver;
m_world = world;
passWord = password; passWord = password;
LoadAdminPage();
} }
public void LoadMethods( BaseHttpServer server ) public void LoadMethods( BaseHttpServer server )
{ {
server.AddRestHandler("GET", "/Admin", GetAdminPage);
server.AddRestHandler("GET", "/Admin/Welcome", GetWelcomePage);
server.AddRestHandler("GET", "/Admin/Accounts", GetAccountsPage );
server.AddRestHandler("GET", "/Admin/Clients", GetConnectedClientsPage);
server.AddRestHandler("GET", "/Admin/Entities", GetEntitiesPage);
server.AddRestHandler("GET", "/Admin/Scripts", GetScriptsPage);
server.AddRestHandler("GET", "/Admin/AddTestScript", AddTestScript );
server.AddRestHandler("GET", "/ClientInventory", GetClientsInventory);
server.AddRestHandler("POST", "/Admin/NewAccount", PostNewAccount );
server.AddRestHandler("POST", "/Admin/Login", PostLogin );
}
private string GetWelcomePage(string request, string path, string param)
{
string responseString;
responseString = "Welcome to the OpenSim Admin Page";
responseString += "<br><br><br> " + LoginForm;
return responseString;
}
private string PostLogin(string requestBody, string path, string param)
{
string responseString;
// Console.WriteLine(requestBody);
if (requestBody == passWord)
{
responseString = "<p> Login Successful </p>";
}
else
{
responseString = "<p> Password Error </p>";
responseString += "<p> Please Login with the correct password </p>";
responseString += "<br><br> " + LoginForm;
}
return responseString;
}
private string PostNewAccount(string requestBody, string path, string param)
{
string responseString;
string firstName = "";
string secondName = "";
string userPasswd = "";
string[] comp;
string[] passw;
string[] line;
string delimStr = "&";
char[] delimiter = delimStr.ToCharArray();
string delimStr2 = "=";
char[] delimiter2 = delimStr2.ToCharArray();
//Console.WriteLine(requestBody);
comp = requestBody.Split(delimiter);
passw = comp[3].Split(delimiter2);
if (passw[1] == passWord) // check admin password is correct
{
line = comp[0].Split(delimiter2); //split firstname
if (line.Length > 1)
{
firstName = line[1];
}
line = comp[1].Split(delimiter2); //split secondname
if (line.Length > 1)
{
secondName = line[1];
}
line = comp[2].Split(delimiter2); //split user password
if (line.Length > 1)
{
userPasswd = line[1];
}
if (this._userServer != null)
{
this._userServer.CreateUserAccount(firstName, secondName, userPasswd);
}
responseString = "<p> New Account created </p>";
}
else
{
responseString = "<p> Admin password is incorrect, please login with the correct password</p>";
responseString += "<br><br>" + LoginForm;
}
return responseString;
}
private string GetConnectedClientsPage(string request, string path, string param)
{
string responseString;
responseString = " <p> Listing connected Clients </p>";
OpenSim.world.Avatar TempAv;
foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys)
{
if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar")
{
TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID];
responseString += "<p> Client: ";
responseString += TempAv.firstname + " , " + TempAv.lastname + " , <A HREF=\"javascript:loadXMLDoc('ClientInventory/" + UUID.ToString() + "')\">" + UUID + "</A> , " + TempAv.ControllingClient.SessionID + " , " + TempAv.ControllingClient.CircuitCode + " , " + TempAv.ControllingClient.userEP.ToString();
responseString += "</p>";
}
}
return responseString;
}
private string AddTestScript(string request, string path, string param)
{
int index = path.LastIndexOf('/');
string lluidStr = path.Substring(index+1);
LLUUID id;
if( LLUUID.TryParse( lluidStr, out id ) )
{
// This is just here for concept purposes... Remove!
m_world.AddScript( m_world.Entities[id], new FollowRandomAvatar());
return String.Format("Added new script to object [{0}]", id);
}
else
{
return String.Format("Couldn't parse [{0}]", lluidStr );
}
}
private string GetScriptsPage(string request, string path, string param)
{
return String.Empty;
}
private string GetEntitiesPage(string request, string path, string param)
{
string responseString;
responseString = " <p> Listing current entities</p><ul>";
foreach (Entity entity in m_world.Entities.Values)
{
string testScriptLink = "javascript:loadXMLDoc('Admin/AddTestScript/" + entity.uuid.ToString() + "');";
responseString += String.Format( "<li>[{0}] \"{1}\" @ {2} <a href=\"{3}\">add test script</a></li>", entity.uuid, entity.Name, entity.Pos, testScriptLink );
}
responseString += "</ul>";
return responseString;
}
private string GetClientsInventory(string request, string path, string param)
{
string[] line;
string delimStr = "/";
char[] delimiter = delimStr.ToCharArray();
string responseString;
responseString = " <p> Listing Inventory </p>";
line = path.Split(delimiter);
if (line.Length > 2)
{
if (line[1] == "ClientInventory")
{
AgentInventory inven = this._inventoryCache.GetAgentsInventory(new libsecondlife.LLUUID(line[2]));
responseString += " <p> Client: " + inven.AgentID.ToStringHyphenated() +" </p>";
if (inven != null)
{
foreach (InventoryItem item in inven.InventoryItems.Values)
{
responseString += "<p> InventoryItem: ";
responseString += item.Name +" , "+ item.ItemID +" , "+ item.Type +" , "+ item.FolderID +" , "+ item.AssetID +" , "+ item.Description ;
responseString += "</p>";
}
}
}
}
return responseString;
}
private string GetCachedAssets(string request, string path, string param)
{
return "";
}
private string GetAccountsPage(string request, string path, string param)
{
string responseString;
responseString = "<p> Account management </p>";
responseString += "<br> ";
responseString += "<p> Create New Account </p>";
responseString += NewAccountForm;
return responseString;
}
private string GetAdminPage(string request, string path, string param)
{
return AdminPage;
}
private void LoadAdminPage()
{
try
{
StreamReader SR;
SR = File.OpenText("testadmin.htm");
AdminPage = SR.ReadToEnd();
SR.Close();
SR = File.OpenText("newaccountform.htm");
NewAccountForm = SR.ReadToEnd();
SR.Close();
SR = File.OpenText("login.htm");
LoginForm = SR.ReadToEnd();
SR.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
} }
} }
}

View File

@ -23,145 +23,11 @@ namespace OpenSim
public void EnableNeighbours() public void EnableNeighbours()
{ {
if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child))
{
Hashtable SimParams;
ArrayList SendParams;
XmlRpcRequest GridReq;
XmlRpcResponse GridResp;
List<Packet> enablePackets = new List<Packet>();
RemoteGridBase gridServer = (RemoteGridBase)this.m_gridServer;
foreach (Hashtable neighbour in gridServer.neighbours)
{
try
{
string neighbourIPStr = (string)neighbour["sim_ip"];
System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr);
ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]);
string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString();
Console.WriteLine(reqUrl);
SimParams = new Hashtable();
SimParams["session_id"] = this.SessionID.ToString();
SimParams["secure_session_id"] = this.SecureSessionID.ToString();
SimParams["firstname"] = this.ClientAvatar.firstname;
SimParams["lastname"] = this.ClientAvatar.lastname;
SimParams["agent_id"] = this.AgentID.ToString();
SimParams["circuit_code"] = (Int32)this.CircuitCode;
SimParams["child_agent"] = "1";
SendParams = new ArrayList();
SendParams.Add(SimParams);
GridReq = new XmlRpcRequest("expect_user", SendParams);
GridResp = GridReq.Send(reqUrl, 3000);
EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
byte[] byteIP = neighbourIP.GetAddressBytes();
enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
enablesimpacket.SimulatorInfo.Port = neighbourPort;
enablePackets.Add(enablesimpacket);
}
catch (Exception e)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing.");
}
}
Thread.Sleep(3000);
foreach (Packet enable in enablePackets)
{
this.OutPacket(enable);
}
enablePackets.Clear();
}
} }
public void CrossSimBorder(LLVector3 avatarpos) public void CrossSimBorder(LLVector3 avatarpos)
{ // VERY VERY BASIC
LLVector3 newpos = avatarpos;
uint neighbourx = this.m_regionData.RegionLocX;
uint neighboury = this.m_regionData.RegionLocY;
if (avatarpos.X < 0)
{ {
neighbourx -= 1;
newpos.X = 254;
}
if (avatarpos.X > 255)
{
neighbourx += 1;
newpos.X = 1;
}
if (avatarpos.Y < 0)
{
neighboury -= 1;
newpos.Y = 254;
}
if (avatarpos.Y > 255)
{
neighboury += 1;
newpos.Y = 1;
}
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]");
Hashtable SimParams;
ArrayList SendParams;
XmlRpcRequest GridReq;
XmlRpcResponse GridResp;
foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours)
{
if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString()))
{
Console.WriteLine("found the neighbouring sim");
SimParams = new Hashtable();
SimParams["firstname"] = this.ClientAvatar.firstname;
SimParams["lastname"] = this.ClientAvatar.lastname;
SimParams["circuit_code"] = this.CircuitCode.ToString();
SimParams["pos_x"] = newpos.X.ToString();
SimParams["pos_y"] = newpos.Y.ToString();
SimParams["pos_z"] = newpos.Z.ToString();
SendParams = new ArrayList();
SendParams.Add(SimParams);
GridReq = new XmlRpcRequest("agent_crossing", SendParams);
GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000);
CrossedRegionPacket NewSimPack = new CrossedRegionPacket();
NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
NewSimPack.AgentData.AgentID = this.AgentID;
NewSimPack.AgentData.SessionID = this.SessionID;
NewSimPack.Info = new CrossedRegionPacket.InfoBlock();
NewSimPack.Info.Position = newpos;
NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256));
System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]);
byte[] byteIP = neighbourIP.GetAddressBytes();
NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
NewSimPack.RegionData.SimIP += (uint)byteIP[0];
NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]);
NewSimPack.RegionData.SeedCapability = new byte[0];
this.OutPacket(NewSimPack);
this.DowngradeClient();
/* lock (PacketQueue)
{
ProcessOutPacket(NewSimPack);
DowngradeClient();
}*/
}
}
} }
} }
} }

View File

@ -20,40 +20,7 @@ namespace OpenSim
{ {
public partial class ClientView public partial class ClientView
{ {
public delegate void GenericCall(ClientView remoteClient);
public delegate void GenericCall2();
public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary.
public delegate void GenericCall4(Packet packet, ClientView remoteClient);
public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
public delegate void ObjectSelect(uint localID, ClientView remoteClient);
public delegate void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient);
public delegate void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient);
public delegate void UpdatePrimVector(uint localID, LLVector3 pos, ClientView remoteClient);
public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient);
public delegate void StatusChange(bool status);
public event ChatFromViewer OnChatFromViewer;
public event RezObject OnRezObject;
public event GenericCall4 OnDeRezObject;
public event ModifyTerrain OnModifyTerrain;
public event GenericCall OnRegionHandShakeReply;
public event GenericCall OnRequestWearables;
public event SetAppearance OnSetAppearance;
public event GenericCall2 OnCompleteMovementToRegion;
public event GenericCall3 OnAgentUpdate;
public event StartAnim OnStartAnim;
public event GenericCall OnRequestAvatarsData;
public event LinkObjects OnLinkObjects;
public event GenericCall4 OnAddPrim;
public event UpdateShape OnUpdatePrimShape;
public event ObjectSelect OnObjectSelect;
public event UpdatePrimFlags OnUpdatePrimFlags;
public event UpdatePrimTexture OnUpdatePrimTexture;
public event UpdatePrimVector OnUpdatePrimPosition;
public event UpdatePrimRotation OnUpdatePrimRotation;
public event UpdatePrimVector OnUpdatePrimScale;
public event StatusChange OnChildAgentStatus;
public event GenericCall2 OnStopMovement;
protected override void ProcessInPacket(Packet Pack) protected override void ProcessInPacket(Packet Pack)
{ {

View File

@ -315,133 +315,21 @@ namespace OpenSim
this.ClientThread.Abort(); this.ClientThread.Abort();
} }
#region World/Avatar To Viewer Methods
public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
System.Text.Encoding enc = System.Text.Encoding.ASCII;
libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
reply.ChatData.Audible = 1;
reply.ChatData.Message = message;
reply.ChatData.ChatType = type;
reply.ChatData.SourceType = 1;
reply.ChatData.Position = fromPos;
reply.ChatData.FromName = enc.GetBytes(fromName + "\0");
reply.ChatData.OwnerID = fromAgentID;
reply.ChatData.SourceID = fromAgentID;
this.OutPacket(reply);
}
public void SendAppearance(AvatarWearable[] wearables)
{
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
aw.AgentData.AgentID = this.AgentID;
aw.AgentData.SerialNum = 0;
aw.AgentData.SessionID = this.SessionID;
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
AgentWearablesUpdatePacket.WearableDataBlock awb;
for (int i = 0; i < wearables.Length; i++)
{
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType = (byte)i;
awb.AssetID = wearables[i].AssetID;
awb.ItemID = wearables[i].ItemID;
aw.WearableData[i] = awb;
}
this.OutPacket(aw);
}
#endregion
#region Inventory Creation #region Inventory Creation
private void SetupInventory(AuthenticateResponse sessionInfo) private void SetupInventory(AuthenticateResponse sessionInfo)
{ {
AgentInventory inventory = null;
if (sessionInfo.LoginInfo.InventoryFolder != null)
{
inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
if (sessionInfo.LoginInfo.BaseFolder != null)
{
if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder))
{
m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
}
this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
if (inventorySet != null)
{
for (int i = 0; i < inventorySet.Length; i++)
{
if (inventorySet[i] != null)
{
m_inventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
}
}
}
}
}
} }
private AgentInventory CreateInventory(LLUUID baseFolder) private AgentInventory CreateInventory(LLUUID baseFolder)
{ {
AgentInventory inventory = null; AgentInventory inventory = null;
if (this.m_userServer != null)
{
// a user server is set so request the inventory from it
Console.WriteLine("getting inventory from user server");
inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer);
}
else
{
inventory = new AgentInventory();
inventory.AgentID = this.AgentID;
inventory.CreateRootFolder(this.AgentID, false);
m_inventoryCache.AddNewAgentsInventory(inventory);
m_inventoryCache.CreateNewInventoryFolder(this, baseFolder);
}
return inventory; return inventory;
} }
private void CreateInventoryItem(CreateInventoryItemPacket packet) private void CreateInventoryItem(CreateInventoryItemPacket packet)
{ {
if (!(packet.InventoryBlock.Type == 3 || packet.InventoryBlock.Type == 7))
{
System.Console.WriteLine("Attempted to create " + Util.FieldToString(packet.InventoryBlock.Name) + " in inventory. Unsupported type");
return;
}
//lets try this out with creating a notecard
AssetBase asset = new AssetBase();
asset.Name = Util.FieldToString(packet.InventoryBlock.Name);
asset.Description = Util.FieldToString(packet.InventoryBlock.Description);
asset.InvType = packet.InventoryBlock.InvType;
asset.Type = packet.InventoryBlock.Type;
asset.FullID = LLUUID.Random();
switch (packet.InventoryBlock.Type)
{
case 7: // Notecard
asset.Data = new byte[0];
break;
case 3: // Landmark
String content;
content = "Landmark version 2\n";
content += "region_id " + m_regionData.SimUUID + "\n";
String strPos = String.Format("%.2f %.2f %.2f>",
this.ClientAvatar.Pos.X,
this.ClientAvatar.Pos.Y,
this.ClientAvatar.Pos.Z);
content += "local_pos " + strPos + "\n";
asset.Data = (new System.Text.ASCIIEncoding()).GetBytes(content);
break;
default:
break;
}
m_assetCache.AddAsset(asset);
m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
} }
#endregion #endregion

View File

@ -9,82 +9,6 @@ namespace OpenSim
{ {
public class Grid public class Grid
{ {
public IAssetServer AssetServer;
public IGridServer GridServer;
public IUserServer UserServer;
public string AssetDll = "";
public string GridDll = "";
public Grid()
{
}
public virtual void Initialise()
{
//load the dlls
this.AssetServer = this.LoadAssetDll(this.AssetDll);
this.GridServer = this.LoadGridDll(this.GridDll);
}
public virtual 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

@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectType>Local</ProjectType> <ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon> <ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName> <AssemblyKeyContainerName>
</AssemblyKeyContainerName> </AssemblyKeyContainerName>
<AssemblyName>OpenSim.RegionServer</AssemblyName> <AssemblyName>OpenSim.RegionServer</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema> <DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder> <AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.RegionServer</RootNamespace> <RootNamespace>OpenSim.RegionServer</RootNamespace>
<StartupObject></StartupObject> <StartupObject>
</StartupObject>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
</PropertyGroup> </PropertyGroup>
@ -28,7 +31,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants> <DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -46,7 +51,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols> <DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
@ -55,13 +61,15 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System"> <Reference Include="System">
<HintPath>System.dll</HintPath> <HintPath>System.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml"> <Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath> <HintPath>System.Xml.dll</HintPath>
<Private>False</Private> <Private>False</Private>
@ -136,6 +144,7 @@
<Compile Include="AuthenticateSessionsRemote.cs"> <Compile Include="AuthenticateSessionsRemote.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="ClientView.API.cs" />
<Compile Include="ClientView.cs"> <Compile Include="ClientView.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>

View File

@ -56,10 +56,7 @@ namespace OpenSim
public virtual void RegisterClientPacketHandlers() public virtual void RegisterClientPacketHandlers()
{ {
if (this._localWorld != null)
{
ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
}
} }
#region Client Packet Handlers #region Client Packet Handlers

View File

@ -32,53 +32,6 @@ namespace OpenSim
} }
public void SaveToGrid()
{
//we really want to keep any server connection code out of here and out of the code code
// and put it in the server connection classes (those inheriting from IGridServer etc)
string reqtext;
reqtext = "<Root>";
reqtext += "<authkey>" + this.GridSendKey + "</authkey>";
reqtext += "<sim>";
reqtext += "<uuid>" + this.SimUUID.ToString() + "</uuid>";
reqtext += "<regionname>" + this.RegionName + "</regionname>";
reqtext += "<sim_ip>" + this.IPListenAddr + "</sim_ip>";
reqtext += "<sim_port>" + this.IPListenPort.ToString() + "</sim_port>";
reqtext += "<region_locx>" + this.RegionLocX.ToString() + "</region_locx>";
reqtext += "<region_locy>" + this.RegionLocY.ToString() + "</region_locy>";
reqtext += "<estate_id>1</estate_id>";
reqtext += "</sim>";
reqtext += "</Root>";
byte[] reqdata = (new System.Text.ASCIIEncoding()).GetBytes(reqtext);
string newpath = "";
if (this.GridURL.EndsWith("/"))
{
newpath = this.GridURL + "sims/";
}
else
{
newpath = this.GridURL + "/sims/";
}
WebRequest GridSaveReq = WebRequest.Create(newpath + this.SimUUID.ToString());
GridSaveReq.Method = "POST";
GridSaveReq.ContentType = "application/x-www-form-urlencoded";
GridSaveReq.ContentLength = reqdata.Length;
Stream stOut = GridSaveReq.GetRequestStream();
stOut.Write(reqdata, 0, reqdata.Length);
stOut.Close();
WebResponse gridresp = GridSaveReq.GetResponse();
StreamReader stIn = new StreamReader(gridresp.GetResponseStream(), Encoding.ASCII);
string GridResponse = stIn.ReadToEnd();
stIn.Close();
gridresp.Close();
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse);
}
public void InitConfig(bool sandboxMode, IGenericConfig configData) public void InitConfig(bool sandboxMode, IGenericConfig configData)
{ {
this.isSandbox = sandboxMode; this.isSandbox = sandboxMode;
@ -233,10 +186,7 @@ namespace OpenSim
} }
this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
if (!this.isSandbox)
{
this.SaveToGrid();
}
configData.Commit(); configData.Commit();
} }
catch (Exception e) catch (Exception e)

View File

@ -90,21 +90,7 @@ namespace OpenSim.world
public void ChildStatusChange(bool status) public void ChildStatusChange(bool status)
{ {
Console.WriteLine("child agent status change");
this.childAvatar = status;
if (this.childAvatar == true)
{
this.StopMovement();
}
else
{
LLVector3 startp = ControllingClient.StartPos;
lock (m_world.LockPhysicsEngine)
{
this._physActor.Position = new PhysicsVector(startp.X, startp.Y, startp.Z);
}
}
} }
public override void addForces() public override void addForces()
@ -147,13 +133,12 @@ namespace OpenSim.world
public static void LoadAnims() public static void LoadAnims()
{ {
Avatar.Animations = new AvatarAnimations();
Avatar.Animations.LoadAnims();
} }
public override void LandRenegerated() public override void LandRenegerated()
{ {
Pos = new LLVector3(100.0f, 100.0f, m_world.Terrain[(int)Pos.X, (int)Pos.Y] + 50.0f);
} }
} }

View File

@ -87,42 +87,7 @@ namespace OpenSim.world
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
{ {
//currently following code not used (or don't know of any case of destination being zero //currently following code not used (or don't know of any case of destination being zero
libsecondlife.LLUUID[] DeRezEnts;
DeRezEnts = new libsecondlife.LLUUID[DeRezPacket.ObjectData.Length];
int i = 0;
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
{
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
foreach (Entity ent in this.Entities.Values)
{
if (ent.localid == Data.ObjectLocalID)
{
DeRezEnts[i++] = ent.uuid;
this.localStorage.RemovePrim(ent.uuid);
KillObjectPacket kill = new KillObjectPacket();
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
kill.ObjectData[0].ID = ent.localid;
foreach (ClientView client in m_clientThreads.Values)
{
client.OutPacket(kill);
}
//Uncommenting this means an old UUID will be re-used, thus crashing the asset server
//Uncomment when prim/object UUIDs are random or such
//2007-03-22 - Randomskk
//this._primCount--;
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Deleted UUID " + ent.uuid);
}
}
}
foreach (libsecondlife.LLUUID uuid in DeRezEnts)
{
lock (Entities)
{
Entities.Remove(uuid);
}
}
} }
else else
{ {
@ -292,77 +257,5 @@ namespace OpenSim.world
} }
} }
} }
/*
public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY)
{
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
if (((m_regInfo.RegionLocX > minX) && (m_regInfo.RegionLocX < maxX)) && ((m_regInfo.RegionLocY > minY) && (m_regInfo.RegionLocY < maxY)))
{
MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
mapReply.AgentData.AgentID = simClient.AgentID;
mapReply.AgentData.Flags = 0;
mapReply.Data = new MapBlockReplyPacket.DataBlock[1];
mapReply.Data[0] = new MapBlockReplyPacket.DataBlock();
mapReply.Data[0].MapImageID = new LLUUID("00000000-0000-0000-9999-000000000007");
mapReply.Data[0].X = (ushort)m_regInfo.RegionLocX;
mapReply.Data[0].Y = (ushort)m_regInfo.RegionLocY;
mapReply.Data[0].WaterHeight = (byte)m_regInfo.RegionWaterHeight;
mapReply.Data[0].Name = _enc.GetBytes(this.m_regionName);
mapReply.Data[0].RegionFlags = 72458694;
mapReply.Data[0].Access = 13;
mapReply.Data[0].Agents = 1; //should send number of clients connected
simClient.OutPacket(mapReply);
}
}
public bool RezObjectHandler(ClientView simClient, Packet packet)
{
RezObjectPacket rezPacket = (RezObjectPacket)packet;
AgentInventory inven = this._inventoryCache.GetAgentsInventory(simClient.AgentID);
if (inven != null)
{
if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID))
{
AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
if (asset != null)
{
PrimData primd = new PrimData(asset.Data);
Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
nPrim.CreateFromStorage(primd, rezPacket.RezData.RayEnd, this._primCount, true);
this.Entities.Add(nPrim.uuid, nPrim);
this._primCount++;
this._inventoryCache.DeleteInventoryItem(simClient, rezPacket.InventoryData.ItemID);
}
}
}
return true;
}
public bool ModifyTerrain(ClientView simClient, Packet packet)
{
ModifyLandPacket modify = (ModifyLandPacket)packet;
switch (modify.ModifyBlock.Action)
{
case 1:
// raise terrain
if (modify.ParcelData.Length > 0)
{
Terrain.raise(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
}
break;
case 2:
//lower terrain
if (modify.ParcelData.Length > 0)
{
Terrain.lower(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
}
break;
}
return true;
}
*/
} }
} }

View File

@ -548,6 +548,7 @@ namespace OpenSim.world
agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation);
agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale);
agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject);
Avatar newAvatar = null; Avatar newAvatar = null;
try try
{ {