aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs228
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.Grid.cs138
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs35
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs118
-rw-r--r--OpenSim/OpenSim.RegionServer/Grid.cs78
-rw-r--r--OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj51
-rw-r--r--OpenSim/OpenSim.RegionServer/PacketServer.cs5
-rw-r--r--OpenSim/OpenSim.RegionServer/RegionInfo.cs52
-rw-r--r--OpenSim/OpenSim.RegionServer/world/Avatar.cs21
-rw-r--r--OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs109
-rw-r--r--OpenSim/OpenSim.RegionServer/world/World.cs1
11 files changed, 47 insertions, 789 deletions
diff --git a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 2299fa4..1f508ce 100644
--- a/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -19,238 +19,16 @@ namespace OpenSim.CAPS
19 private string NewAccountForm; 19 private string NewAccountForm;
20 private string LoginForm; 20 private string LoginForm;
21 private string passWord = "Admin"; 21 private string passWord = "Admin";
22 private World m_world;
23 private LoginServer _userServer;
24 private InventoryCache _inventoryCache;
25 22
26 public AdminWebFront(string password, World world, InventoryCache inventoryCache, LoginServer userserver) 23
24 public AdminWebFront(string password)
27 { 25 {
28 _inventoryCache = inventoryCache;
29 _userServer = userserver;
30 m_world = world;
31 passWord = password; 26 passWord = password;
32 LoadAdminPage();
33 } 27 }
34 28
35 public void LoadMethods( BaseHttpServer server ) 29 public void LoadMethods( BaseHttpServer server )
36 { 30 {
37 server.AddRestHandler("GET", "/Admin", GetAdminPage); 31
38 server.AddRestHandler("GET", "/Admin/Welcome", GetWelcomePage);
39 server.AddRestHandler("GET", "/Admin/Accounts", GetAccountsPage );
40 server.AddRestHandler("GET", "/Admin/Clients", GetConnectedClientsPage);
41 server.AddRestHandler("GET", "/Admin/Entities", GetEntitiesPage);
42 server.AddRestHandler("GET", "/Admin/Scripts", GetScriptsPage);
43 server.AddRestHandler("GET", "/Admin/AddTestScript", AddTestScript );
44 server.AddRestHandler("GET", "/ClientInventory", GetClientsInventory);
45
46 server.AddRestHandler("POST", "/Admin/NewAccount", PostNewAccount );
47 server.AddRestHandler("POST", "/Admin/Login", PostLogin );
48 }
49
50 private string GetWelcomePage(string request, string path, string param)
51 {
52 string responseString;
53 responseString = "Welcome to the OpenSim Admin Page";
54 responseString += "<br><br><br> " + LoginForm;
55 return responseString;
56 }
57
58 private string PostLogin(string requestBody, string path, string param)
59 {
60 string responseString;
61// Console.WriteLine(requestBody);
62 if (requestBody == passWord)
63 {
64 responseString = "<p> Login Successful </p>";
65 }
66 else
67 {
68 responseString = "<p> Password Error </p>";
69 responseString += "<p> Please Login with the correct password </p>";
70 responseString += "<br><br> " + LoginForm;
71 }
72 return responseString;
73 }
74
75 private string PostNewAccount(string requestBody, string path, string param)
76 {
77 string responseString;
78 string firstName = "";
79 string secondName = "";
80 string userPasswd = "";
81 string[] comp;
82 string[] passw;
83 string[] line;
84 string delimStr = "&";
85 char[] delimiter = delimStr.ToCharArray();
86 string delimStr2 = "=";
87 char[] delimiter2 = delimStr2.ToCharArray();
88
89 //Console.WriteLine(requestBody);
90 comp = requestBody.Split(delimiter);
91 passw = comp[3].Split(delimiter2);
92 if (passw[1] == passWord) // check admin password is correct
93 {
94
95 line = comp[0].Split(delimiter2); //split firstname
96 if (line.Length > 1)
97 {
98 firstName = line[1];
99 }
100 line = comp[1].Split(delimiter2); //split secondname
101 if (line.Length > 1)
102 {
103 secondName = line[1];
104 }
105 line = comp[2].Split(delimiter2); //split user password
106 if (line.Length > 1)
107 {
108 userPasswd = line[1];
109 }
110 if (this._userServer != null)
111 {
112 this._userServer.CreateUserAccount(firstName, secondName, userPasswd);
113 }
114 responseString = "<p> New Account created </p>";
115 }
116 else
117 {
118 responseString = "<p> Admin password is incorrect, please login with the correct password</p>";
119 responseString += "<br><br>" + LoginForm;
120 }
121 return responseString;
122 } 32 }
123
124 private string GetConnectedClientsPage(string request, string path, string param)
125 {
126 string responseString;
127 responseString = " <p> Listing connected Clients </p>";
128 OpenSim.world.Avatar TempAv;
129 foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys)
130 {
131 if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar")
132 {
133 TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID];
134 responseString += "<p> Client: ";
135 responseString += TempAv.firstname + " , " + TempAv.lastname + " , <A HREF=\"javascript:loadXMLDoc('ClientInventory/" + UUID.ToString() + "')\">" + UUID + "</A> , " + TempAv.ControllingClient.SessionID + " , " + TempAv.ControllingClient.CircuitCode + " , " + TempAv.ControllingClient.userEP.ToString();
136 responseString += "</p>";
137 }
138 }
139 return responseString;
140 }
141
142 private string AddTestScript(string request, string path, string param)
143 {
144 int index = path.LastIndexOf('/');
145
146 string lluidStr = path.Substring(index+1);
147
148 LLUUID id;
149
150 if( LLUUID.TryParse( lluidStr, out id ) )
151 {
152 // This is just here for concept purposes... Remove!
153 m_world.AddScript( m_world.Entities[id], new FollowRandomAvatar());
154 return String.Format("Added new script to object [{0}]", id);
155 }
156 else
157 {
158 return String.Format("Couldn't parse [{0}]", lluidStr );
159 }
160 }
161
162 private string GetScriptsPage(string request, string path, string param)
163 {
164 return String.Empty;
165 }
166
167 private string GetEntitiesPage(string request, string path, string param)
168 {
169 string responseString;
170 responseString = " <p> Listing current entities</p><ul>";
171
172 foreach (Entity entity in m_world.Entities.Values)
173 {
174 string testScriptLink = "javascript:loadXMLDoc('Admin/AddTestScript/" + entity.uuid.ToString() + "');";
175 responseString += String.Format( "<li>[{0}] \"{1}\" @ {2} <a href=\"{3}\">add test script</a></li>", entity.uuid, entity.Name, entity.Pos, testScriptLink );
176 }
177 responseString += "</ul>";
178 return responseString;
179 }
180
181 private string GetClientsInventory(string request, string path, string param)
182 {
183 string[] line;
184 string delimStr = "/";
185 char[] delimiter = delimStr.ToCharArray();
186 string responseString;
187 responseString = " <p> Listing Inventory </p>";
188
189 line = path.Split(delimiter);
190 if (line.Length > 2)
191 {
192 if (line[1] == "ClientInventory")
193 {
194 AgentInventory inven = this._inventoryCache.GetAgentsInventory(new libsecondlife.LLUUID(line[2]));
195 responseString += " <p> Client: " + inven.AgentID.ToStringHyphenated() +" </p>";
196 if (inven != null)
197 {
198 foreach (InventoryItem item in inven.InventoryItems.Values)
199 {
200 responseString += "<p> InventoryItem: ";
201 responseString += item.Name +" , "+ item.ItemID +" , "+ item.Type +" , "+ item.FolderID +" , "+ item.AssetID +" , "+ item.Description ;
202 responseString += "</p>";
203 }
204 }
205 }
206 }
207 return responseString;
208 }
209
210 private string GetCachedAssets(string request, string path, string param)
211 {
212 return "";
213 }
214
215 private string GetAccountsPage(string request, string path, string param)
216 {
217 string responseString;
218 responseString = "<p> Account management </p>";
219 responseString += "<br> ";
220 responseString += "<p> Create New Account </p>";
221 responseString += NewAccountForm;
222 return responseString;
223 }
224
225 private string GetAdminPage(string request, string path, string param)
226 {
227 return AdminPage;
228 }
229
230 private void LoadAdminPage()
231 {
232 try
233 {
234 StreamReader SR;
235
236 SR = File.OpenText("testadmin.htm");
237 AdminPage = SR.ReadToEnd();
238 SR.Close();
239
240 SR = File.OpenText("newaccountform.htm");
241 NewAccountForm = SR.ReadToEnd();
242 SR.Close();
243
244 SR = File.OpenText("login.htm");
245 LoginForm = SR.ReadToEnd();
246 SR.Close();
247 }
248 catch (Exception e)
249 {
250 Console.WriteLine(e.ToString());
251 }
252
253 }
254
255 } 33 }
256} 34}
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
index 1121839..b4e4b5f 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.Grid.cs
@@ -23,145 +23,11 @@ namespace OpenSim
23 23
24 public void EnableNeighbours() 24 public void EnableNeighbours()
25 { 25 {
26 if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child)) 26
27 {
28 Hashtable SimParams;
29 ArrayList SendParams;
30 XmlRpcRequest GridReq;
31 XmlRpcResponse GridResp;
32 List<Packet> enablePackets = new List<Packet>();
33
34 RemoteGridBase gridServer = (RemoteGridBase)this.m_gridServer;
35
36 foreach (Hashtable neighbour in gridServer.neighbours)
37 {
38 try
39 {
40 string neighbourIPStr = (string)neighbour["sim_ip"];
41 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr);
42 ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]);
43 string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString();
44
45 Console.WriteLine(reqUrl);
46
47 SimParams = new Hashtable();
48 SimParams["session_id"] = this.SessionID.ToString();
49 SimParams["secure_session_id"] = this.SecureSessionID.ToString();
50 SimParams["firstname"] = this.ClientAvatar.firstname;
51 SimParams["lastname"] = this.ClientAvatar.lastname;
52 SimParams["agent_id"] = this.AgentID.ToString();
53 SimParams["circuit_code"] = (Int32)this.CircuitCode;
54 SimParams["child_agent"] = "1";
55 SendParams = new ArrayList();
56 SendParams.Add(SimParams);
57
58 GridReq = new XmlRpcRequest("expect_user", SendParams);
59 GridResp = GridReq.Send(reqUrl, 3000);
60 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
61 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
62 enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
63
64
65 byte[] byteIP = neighbourIP.GetAddressBytes();
66 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
67 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
68 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
69 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
70 enablesimpacket.SimulatorInfo.Port = neighbourPort;
71 enablePackets.Add(enablesimpacket);
72 }
73 catch (Exception e)
74 {
75 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing.");
76 }
77 }
78 Thread.Sleep(3000);
79 foreach (Packet enable in enablePackets)
80 {
81 this.OutPacket(enable);
82 }
83 enablePackets.Clear();
84
85 }
86 } 27 }
87 28
88 public void CrossSimBorder(LLVector3 avatarpos) 29 public void CrossSimBorder(LLVector3 avatarpos)
89 { // VERY VERY BASIC 30 {
90
91 LLVector3 newpos = avatarpos;
92 uint neighbourx = this.m_regionData.RegionLocX;
93 uint neighboury = this.m_regionData.RegionLocY;
94
95 if (avatarpos.X < 0)
96 {
97 neighbourx -= 1;
98 newpos.X = 254;
99 }
100 if (avatarpos.X > 255)
101 {
102 neighbourx += 1;
103 newpos.X = 1;
104 }
105 if (avatarpos.Y < 0)
106 {
107 neighboury -= 1;
108 newpos.Y = 254;
109 }
110 if (avatarpos.Y > 255)
111 {
112 neighboury += 1;
113 newpos.Y = 1;
114 }
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]");
116
117 Hashtable SimParams;
118 ArrayList SendParams;
119 XmlRpcRequest GridReq;
120 XmlRpcResponse GridResp;
121 foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours)
122 {
123 if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString()))
124 {
125 Console.WriteLine("found the neighbouring sim");
126 SimParams = new Hashtable();
127 SimParams["firstname"] = this.ClientAvatar.firstname;
128 SimParams["lastname"] = this.ClientAvatar.lastname;
129 SimParams["circuit_code"] = this.CircuitCode.ToString();
130 SimParams["pos_x"] = newpos.X.ToString();
131 SimParams["pos_y"] = newpos.Y.ToString();
132 SimParams["pos_z"] = newpos.Z.ToString();
133 SendParams = new ArrayList();
134 SendParams.Add(SimParams);
135
136 GridReq = new XmlRpcRequest("agent_crossing", SendParams);
137 GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000);
138
139 CrossedRegionPacket NewSimPack = new CrossedRegionPacket();
140 NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
141 NewSimPack.AgentData.AgentID = this.AgentID;
142 NewSimPack.AgentData.SessionID = this.SessionID;
143 NewSimPack.Info = new CrossedRegionPacket.InfoBlock();
144 NewSimPack.Info.Position = newpos;
145 NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
146 NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
147 NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256));
148 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]);
149 byte[] byteIP = neighbourIP.GetAddressBytes();
150 NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
151 NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
152 NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
153 NewSimPack.RegionData.SimIP += (uint)byteIP[0];
154 NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]);
155 NewSimPack.RegionData.SeedCapability = new byte[0];
156 this.OutPacket(NewSimPack);
157 this.DowngradeClient();
158 /* lock (PacketQueue)
159 {
160 ProcessOutPacket(NewSimPack);
161 DowngradeClient();
162 }*/
163 }
164 }
165 } 31 }
166 } 32 }
167} 33}
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 977162f..6a33432 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -20,40 +20,7 @@ namespace OpenSim
20{ 20{
21 public partial class ClientView 21 public partial class ClientView
22 { 22 {
23 public delegate void GenericCall(ClientView remoteClient); 23
24 public delegate void GenericCall2();
25 public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary.
26 public delegate void GenericCall4(Packet packet, ClientView remoteClient);
27 public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
28 public delegate void ObjectSelect(uint localID, ClientView remoteClient);
29 public delegate void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient);
30 public delegate void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient);
31 public delegate void UpdatePrimVector(uint localID, LLVector3 pos, ClientView remoteClient);
32 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient);
33 public delegate void StatusChange(bool status);
34
35 public event ChatFromViewer OnChatFromViewer;
36 public event RezObject OnRezObject;
37 public event GenericCall4 OnDeRezObject;
38 public event ModifyTerrain OnModifyTerrain;
39 public event GenericCall OnRegionHandShakeReply;
40 public event GenericCall OnRequestWearables;
41 public event SetAppearance OnSetAppearance;
42 public event GenericCall2 OnCompleteMovementToRegion;
43 public event GenericCall3 OnAgentUpdate;
44 public event StartAnim OnStartAnim;
45 public event GenericCall OnRequestAvatarsData;
46 public event LinkObjects OnLinkObjects;
47 public event GenericCall4 OnAddPrim;
48 public event UpdateShape OnUpdatePrimShape;
49 public event ObjectSelect OnObjectSelect;
50 public event UpdatePrimFlags OnUpdatePrimFlags;
51 public event UpdatePrimTexture OnUpdatePrimTexture;
52 public event UpdatePrimVector OnUpdatePrimPosition;
53 public event UpdatePrimRotation OnUpdatePrimRotation;
54 public event UpdatePrimVector OnUpdatePrimScale;
55 public event StatusChange OnChildAgentStatus;
56 public event GenericCall2 OnStopMovement;
57 24
58 protected override void ProcessInPacket(Packet Pack) 25 protected override void ProcessInPacket(Packet Pack)
59 { 26 {
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index 295cd7b..a422102 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -315,133 +315,21 @@ namespace OpenSim
315 this.ClientThread.Abort(); 315 this.ClientThread.Abort();
316 } 316 }
317 317
318 #region World/Avatar To Viewer Methods
319
320 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
321 {
322 System.Text.Encoding enc = System.Text.Encoding.ASCII;
323 libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
324 reply.ChatData.Audible = 1;
325 reply.ChatData.Message = message;
326 reply.ChatData.ChatType = type;
327 reply.ChatData.SourceType = 1;
328 reply.ChatData.Position = fromPos;
329 reply.ChatData.FromName = enc.GetBytes(fromName + "\0");
330 reply.ChatData.OwnerID = fromAgentID;
331 reply.ChatData.SourceID = fromAgentID;
332
333 this.OutPacket(reply);
334 }
335
336 public void SendAppearance(AvatarWearable[] wearables)
337 {
338 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
339 aw.AgentData.AgentID = this.AgentID;
340 aw.AgentData.SerialNum = 0;
341 aw.AgentData.SessionID = this.SessionID;
342
343 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
344 AgentWearablesUpdatePacket.WearableDataBlock awb;
345 for (int i = 0; i < wearables.Length; i++)
346 {
347 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
348 awb.WearableType = (byte)i;
349 awb.AssetID = wearables[i].AssetID;
350 awb.ItemID = wearables[i].ItemID;
351 aw.WearableData[i] = awb;
352 }
353
354 this.OutPacket(aw);
355 }
356 #endregion
357
358 #region Inventory Creation 318 #region Inventory Creation
359 private void SetupInventory(AuthenticateResponse sessionInfo) 319 private void SetupInventory(AuthenticateResponse sessionInfo)
360 { 320 {
361 AgentInventory inventory = null; 321
362 if (sessionInfo.LoginInfo.InventoryFolder != null)
363 {
364 inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
365 if (sessionInfo.LoginInfo.BaseFolder != null)
366 {
367 if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder))
368 {
369 m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
370 }
371 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
372 AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
373 if (inventorySet != null)
374 {
375 for (int i = 0; i < inventorySet.Length; i++)
376 {
377 if (inventorySet[i] != null)
378 {
379 m_inventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
380 }
381 }
382 }
383 }
384 }
385 } 322 }
386 private AgentInventory CreateInventory(LLUUID baseFolder) 323 private AgentInventory CreateInventory(LLUUID baseFolder)
387 { 324 {
388 AgentInventory inventory = null; 325 AgentInventory inventory = null;
389 if (this.m_userServer != null) 326
390 {
391 // a user server is set so request the inventory from it
392 Console.WriteLine("getting inventory from user server");
393 inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer);
394 }
395 else
396 {
397 inventory = new AgentInventory();
398 inventory.AgentID = this.AgentID;
399 inventory.CreateRootFolder(this.AgentID, false);
400 m_inventoryCache.AddNewAgentsInventory(inventory);
401 m_inventoryCache.CreateNewInventoryFolder(this, baseFolder);
402 }
403 return inventory; 327 return inventory;
404 } 328 }
405 329
406 private void CreateInventoryItem(CreateInventoryItemPacket packet) 330 private void CreateInventoryItem(CreateInventoryItemPacket packet)
407 { 331 {
408 if (!(packet.InventoryBlock.Type == 3 || packet.InventoryBlock.Type == 7)) 332
409 {
410 System.Console.WriteLine("Attempted to create " + Util.FieldToString(packet.InventoryBlock.Name) + " in inventory. Unsupported type");
411 return;
412 }
413
414 //lets try this out with creating a notecard
415 AssetBase asset = new AssetBase();
416
417 asset.Name = Util.FieldToString(packet.InventoryBlock.Name);
418 asset.Description = Util.FieldToString(packet.InventoryBlock.Description);
419 asset.InvType = packet.InventoryBlock.InvType;
420 asset.Type = packet.InventoryBlock.Type;
421 asset.FullID = LLUUID.Random();
422
423 switch (packet.InventoryBlock.Type)
424 {
425 case 7: // Notecard
426 asset.Data = new byte[0];
427 break;
428
429 case 3: // Landmark
430 String content;
431 content = "Landmark version 2\n";
432 content += "region_id " + m_regionData.SimUUID + "\n";
433 String strPos = String.Format("%.2f %.2f %.2f>",
434 this.ClientAvatar.Pos.X,
435 this.ClientAvatar.Pos.Y,
436 this.ClientAvatar.Pos.Z);
437 content += "local_pos " + strPos + "\n";
438 asset.Data = (new System.Text.ASCIIEncoding()).GetBytes(content);
439 break;
440 default:
441 break;
442 }
443 m_assetCache.AddAsset(asset);
444 m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
445 } 333 }
446 #endregion 334 #endregion
447 335
diff --git a/OpenSim/OpenSim.RegionServer/Grid.cs b/OpenSim/OpenSim.RegionServer/Grid.cs
index db5b8fe..0b8db4d 100644
--- a/OpenSim/OpenSim.RegionServer/Grid.cs
+++ b/OpenSim/OpenSim.RegionServer/Grid.cs
@@ -9,82 +9,6 @@ namespace OpenSim
9{ 9{
10 public class Grid 10 public class Grid
11 { 11 {
12 public IAssetServer AssetServer; 12
13 public IGridServer GridServer;
14 public IUserServer UserServer;
15 public string AssetDll = "";
16 public string GridDll = "";
17
18 public Grid()
19 {
20 }
21
22 public virtual void Initialise()
23 {
24 //load the dlls
25 this.AssetServer = this.LoadAssetDll(this.AssetDll);
26 this.GridServer = this.LoadGridDll(this.GridDll);
27 }
28 public virtual void Close()
29 {
30 this.AssetServer.Close();
31 this.GridServer.Close();
32 }
33
34 private IAssetServer LoadAssetDll(string dllName)
35 {
36 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
37 IAssetServer server = null;
38
39 foreach (Type pluginType in pluginAssembly.GetTypes())
40 {
41 if (pluginType.IsPublic)
42 {
43 if (!pluginType.IsAbstract)
44 {
45 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
46
47 if (typeInterface != null)
48 {
49 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
50 server = plug.GetAssetServer();
51 break;
52 }
53
54 typeInterface = null;
55 }
56 }
57 }
58 pluginAssembly = null;
59 return server;
60 }
61
62 private IGridServer LoadGridDll(string dllName)
63 {
64 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
65 IGridServer server = null;
66
67 foreach (Type pluginType in pluginAssembly.GetTypes())
68 {
69 if (pluginType.IsPublic)
70 {
71 if (!pluginType.IsAbstract)
72 {
73 Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
74
75 if (typeInterface != null)
76 {
77 IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
78 server = plug.GetGridServer();
79 break;
80 }
81
82 typeInterface = null;
83 }
84 }
85 }
86 pluginAssembly = null;
87 return server;
88 }
89 } 13 }
90} 14}
diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index f06e16a..08a9e4c 100644
--- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,28 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Data" />
73 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 74 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 75 <Private>False</Private>
68 </Reference> 76 </Reference>
69 <Reference Include="libsecondlife.dll" > 77 <Reference Include="libsecondlife.dll">
70 <HintPath>..\..\bin\libsecondlife.dll</HintPath> 78 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 79 <Private>False</Private>
72 </Reference> 80 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 81 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath> 82 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 83 <Private>False</Private>
76 </Reference> 84 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 85 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> 86 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 87 <Private>False</Private>
80 </Reference> 88 </Reference>
@@ -84,43 +92,43 @@
84 <Name>OpenSim.Terrain.BasicTerrain</Name> 92 <Name>OpenSim.Terrain.BasicTerrain</Name>
85 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> 93 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 94 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 95 <Private>False</Private>
88 </ProjectReference> 96 </ProjectReference>
89 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> 97 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
90 <Name>OpenSim.Framework</Name> 98 <Name>OpenSim.Framework</Name>
91 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 99 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 100 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 101 <Private>False</Private>
94 </ProjectReference> 102 </ProjectReference>
95 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 103 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
96 <Name>OpenSim.Framework.Console</Name> 104 <Name>OpenSim.Framework.Console</Name>
97 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 105 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 106 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 107 <Private>False</Private>
100 </ProjectReference> 108 </ProjectReference>
101 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> 109 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
102 <Name>OpenSim.GenericConfig.Xml</Name> 110 <Name>OpenSim.GenericConfig.Xml</Name>
103 <Project>{E88EF749-0000-0000-0000-000000000000}</Project> 111 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 112 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 113 <Private>False</Private>
106 </ProjectReference> 114 </ProjectReference>
107 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 115 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
108 <Name>OpenSim.Physics.Manager</Name> 116 <Name>OpenSim.Physics.Manager</Name>
109 <Project>{8BE16150-0000-0000-0000-000000000000}</Project> 117 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 118 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private> 119 <Private>False</Private>
112 </ProjectReference> 120 </ProjectReference>
113 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> 121 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
114 <Name>OpenSim.Servers</Name> 122 <Name>OpenSim.Servers</Name>
115 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> 123 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 124 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private> 125 <Private>False</Private>
118 </ProjectReference> 126 </ProjectReference>
119 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj"> 127 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
120 <Name>XMLRPC</Name> 128 <Name>XMLRPC</Name>
121 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> 129 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 130 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
123 <Private>False</Private> 131 <Private>False</Private>
124 </ProjectReference> 132 </ProjectReference>
125 </ItemGroup> 133 </ItemGroup>
126 <ItemGroup> 134 <ItemGroup>
@@ -136,6 +144,7 @@
136 <Compile Include="AuthenticateSessionsRemote.cs"> 144 <Compile Include="AuthenticateSessionsRemote.cs">
137 <SubType>Code</SubType> 145 <SubType>Code</SubType>
138 </Compile> 146 </Compile>
147 <Compile Include="ClientView.API.cs" />
139 <Compile Include="ClientView.cs"> 148 <Compile Include="ClientView.cs">
140 <SubType>Code</SubType> 149 <SubType>Code</SubType>
141 </Compile> 150 </Compile>
@@ -255,4 +264,4 @@
255 <PostBuildEvent> 264 <PostBuildEvent>
256 </PostBuildEvent> 265 </PostBuildEvent>
257 </PropertyGroup> 266 </PropertyGroup>
258</Project> 267</Project> \ No newline at end of file
diff --git a/OpenSim/OpenSim.RegionServer/PacketServer.cs b/OpenSim/OpenSim.RegionServer/PacketServer.cs
index 9c8f65c..6c6f4ca 100644
--- a/OpenSim/OpenSim.RegionServer/PacketServer.cs
+++ b/OpenSim/OpenSim.RegionServer/PacketServer.cs
@@ -56,10 +56,7 @@ namespace OpenSim
56 56
57 public virtual void RegisterClientPacketHandlers() 57 public virtual void RegisterClientPacketHandlers()
58 { 58 {
59 if (this._localWorld != null) 59
60 {
61 ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
62 }
63 } 60 }
64 61
65 #region Client Packet Handlers 62 #region Client Packet Handlers
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs
index f82495a..76f05b6 100644
--- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs
+++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs
@@ -32,53 +32,6 @@ namespace OpenSim
32 32
33 } 33 }
34 34
35 public void SaveToGrid()
36 {
37 //we really want to keep any server connection code out of here and out of the code code
38 // and put it in the server connection classes (those inheriting from IGridServer etc)
39 string reqtext;
40 reqtext = "<Root>";
41 reqtext += "<authkey>" + this.GridSendKey + "</authkey>";
42 reqtext += "<sim>";
43 reqtext += "<uuid>" + this.SimUUID.ToString() + "</uuid>";
44 reqtext += "<regionname>" + this.RegionName + "</regionname>";
45 reqtext += "<sim_ip>" + this.IPListenAddr + "</sim_ip>";
46 reqtext += "<sim_port>" + this.IPListenPort.ToString() + "</sim_port>";
47 reqtext += "<region_locx>" + this.RegionLocX.ToString() + "</region_locx>";
48 reqtext += "<region_locy>" + this.RegionLocY.ToString() + "</region_locy>";
49 reqtext += "<estate_id>1</estate_id>";
50 reqtext += "</sim>";
51 reqtext += "</Root>";
52
53 byte[] reqdata = (new System.Text.ASCIIEncoding()).GetBytes(reqtext);
54 string newpath = "";
55 if (this.GridURL.EndsWith("/"))
56 {
57 newpath = this.GridURL + "sims/";
58 }
59 else
60 {
61 newpath = this.GridURL + "/sims/";
62 }
63
64 WebRequest GridSaveReq = WebRequest.Create(newpath + this.SimUUID.ToString());
65 GridSaveReq.Method = "POST";
66 GridSaveReq.ContentType = "application/x-www-form-urlencoded";
67 GridSaveReq.ContentLength = reqdata.Length;
68
69 Stream stOut = GridSaveReq.GetRequestStream();
70 stOut.Write(reqdata, 0, reqdata.Length);
71 stOut.Close();
72
73 WebResponse gridresp = GridSaveReq.GetResponse();
74 StreamReader stIn = new StreamReader(gridresp.GetResponseStream(), Encoding.ASCII);
75 string GridResponse = stIn.ReadToEnd();
76 stIn.Close();
77 gridresp.Close();
78
79 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse);
80 }
81
82 public void InitConfig(bool sandboxMode, IGenericConfig configData) 35 public void InitConfig(bool sandboxMode, IGenericConfig configData)
83 { 36 {
84 this.isSandbox = sandboxMode; 37 this.isSandbox = sandboxMode;
@@ -233,10 +186,7 @@ namespace OpenSim
233 186
234 } 187 }
235 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); 188 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
236 if (!this.isSandbox) 189
237 {
238 this.SaveToGrid();
239 }
240 configData.Commit(); 190 configData.Commit();
241 } 191 }
242 catch (Exception e) 192 catch (Exception e)
diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.cs
index a95b65d..cca266b 100644
--- a/OpenSim/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim/OpenSim.RegionServer/world/Avatar.cs
@@ -90,21 +90,7 @@ namespace OpenSim.world
90 90
91 public void ChildStatusChange(bool status) 91 public void ChildStatusChange(bool status)
92 { 92 {
93 Console.WriteLine("child agent status change"); 93
94 this.childAvatar = status;
95
96 if (this.childAvatar == true)
97 {
98 this.StopMovement();
99 }
100 else
101 {
102 LLVector3 startp = ControllingClient.StartPos;
103 lock (m_world.LockPhysicsEngine)
104 {
105 this._physActor.Position = new PhysicsVector(startp.X, startp.Y, startp.Z);
106 }
107 }
108 } 94 }
109 95
110 public override void addForces() 96 public override void addForces()
@@ -147,13 +133,12 @@ namespace OpenSim.world
147 133
148 public static void LoadAnims() 134 public static void LoadAnims()
149 { 135 {
150 Avatar.Animations = new AvatarAnimations(); 136
151 Avatar.Animations.LoadAnims();
152 } 137 }
153 138
154 public override void LandRenegerated() 139 public override void LandRenegerated()
155 { 140 {
156 Pos = new LLVector3(100.0f, 100.0f, m_world.Terrain[(int)Pos.X, (int)Pos.Y] + 50.0f); 141
157 } 142 }
158 } 143 }
159 144
diff --git a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs
index 4f32335..ee5a23a 100644
--- a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs
+++ b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs
@@ -87,42 +87,7 @@ namespace OpenSim.world
87 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 87 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
88 { 88 {
89 //currently following code not used (or don't know of any case of destination being zero 89 //currently following code not used (or don't know of any case of destination being zero
90 libsecondlife.LLUUID[] DeRezEnts; 90
91 DeRezEnts = new libsecondlife.LLUUID[DeRezPacket.ObjectData.Length];
92 int i = 0;
93 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
94 {
95
96 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
97 foreach (Entity ent in this.Entities.Values)
98 {
99 if (ent.localid == Data.ObjectLocalID)
100 {
101 DeRezEnts[i++] = ent.uuid;
102 this.localStorage.RemovePrim(ent.uuid);
103 KillObjectPacket kill = new KillObjectPacket();
104 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
105 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
106 kill.ObjectData[0].ID = ent.localid;
107 foreach (ClientView client in m_clientThreads.Values)
108 {
109 client.OutPacket(kill);
110 }
111 //Uncommenting this means an old UUID will be re-used, thus crashing the asset server
112 //Uncomment when prim/object UUIDs are random or such
113 //2007-03-22 - Randomskk
114 //this._primCount--;
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Deleted UUID " + ent.uuid);
116 }
117 }
118 }
119 foreach (libsecondlife.LLUUID uuid in DeRezEnts)
120 {
121 lock (Entities)
122 {
123 Entities.Remove(uuid);
124 }
125 }
126 } 91 }
127 else 92 else
128 { 93 {
@@ -292,77 +257,5 @@ namespace OpenSim.world
292 } 257 }
293 } 258 }
294 } 259 }
295
296 /*
297 public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY)
298 {
299 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
300 if (((m_regInfo.RegionLocX > minX) && (m_regInfo.RegionLocX < maxX)) && ((m_regInfo.RegionLocY > minY) && (m_regInfo.RegionLocY < maxY)))
301 {
302 MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
303 mapReply.AgentData.AgentID = simClient.AgentID;
304 mapReply.AgentData.Flags = 0;
305 mapReply.Data = new MapBlockReplyPacket.DataBlock[1];
306 mapReply.Data[0] = new MapBlockReplyPacket.DataBlock();
307 mapReply.Data[0].MapImageID = new LLUUID("00000000-0000-0000-9999-000000000007");
308 mapReply.Data[0].X = (ushort)m_regInfo.RegionLocX;
309 mapReply.Data[0].Y = (ushort)m_regInfo.RegionLocY;
310 mapReply.Data[0].WaterHeight = (byte)m_regInfo.RegionWaterHeight;
311 mapReply.Data[0].Name = _enc.GetBytes(this.m_regionName);
312 mapReply.Data[0].RegionFlags = 72458694;
313 mapReply.Data[0].Access = 13;
314 mapReply.Data[0].Agents = 1; //should send number of clients connected
315 simClient.OutPacket(mapReply);
316 }
317 }
318 public bool RezObjectHandler(ClientView simClient, Packet packet)
319 {
320 RezObjectPacket rezPacket = (RezObjectPacket)packet;
321 AgentInventory inven = this._inventoryCache.GetAgentsInventory(simClient.AgentID);
322 if (inven != null)
323 {
324 if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID))
325 {
326 AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
327 if (asset != null)
328 {
329 PrimData primd = new PrimData(asset.Data);
330 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
331 nPrim.CreateFromStorage(primd, rezPacket.RezData.RayEnd, this._primCount, true);
332 this.Entities.Add(nPrim.uuid, nPrim);
333 this._primCount++;
334 this._inventoryCache.DeleteInventoryItem(simClient, rezPacket.InventoryData.ItemID);
335 }
336 }
337 }
338 return true;
339 }
340 public bool ModifyTerrain(ClientView simClient, Packet packet)
341 {
342 ModifyLandPacket modify = (ModifyLandPacket)packet;
343
344 switch (modify.ModifyBlock.Action)
345 {
346 case 1:
347 // raise terrain
348 if (modify.ParcelData.Length > 0)
349 {
350 Terrain.raise(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
351 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
352 }
353 break;
354 case 2:
355 //lower terrain
356 if (modify.ParcelData.Length > 0)
357 {
358 Terrain.lower(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
359 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
360 }
361 break;
362 }
363 return true;
364 }
365 */
366
367 } 260 }
368} 261}
diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs
index bb24011..ec9bbc9 100644
--- a/OpenSim/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim/OpenSim.RegionServer/world/World.cs
@@ -548,6 +548,7 @@ namespace OpenSim.world
548 agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); 548 agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation);
549 agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); 549 agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale);
550 agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); 550 agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject);
551
551 Avatar newAvatar = null; 552 Avatar newAvatar = null;
552 try 553 try
553 { 554 {