aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs191
1 files changed, 1 insertions, 190 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 0449cd9..1db9d29 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -207,120 +207,6 @@ namespace OpenSim.Region.Environment.Scenes
207 }); 207 });
208 } 208 }
209 209
210 /// <summary>
211 ///
212 /// </summary>
213 /// <param name="packet"></param>
214 /// <param name="simClient"></param>
215 public void DeRezObject(Packet packet, IClientAPI remoteClient)
216 {
217 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
218
219
220 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
221 {
222 //currently following code not used (or don't know of any case of destination being zero
223 }
224 else
225 {
226 foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
227 {
228 EntityBase selectedEnt = null;
229 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
230 foreach (EntityBase ent in this.Entities.Values)
231 {
232 if (ent.LocalId == Data.ObjectLocalID)
233 {
234 selectedEnt = ent;
235 break;
236 }
237 }
238 if (selectedEnt != null)
239 {
240 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId,((SceneObjectGroup)selectedEnt).UUID))
241 {
242 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString();
243 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
244 if (userInfo != null)
245 {
246 AssetBase asset = new AssetBase();
247 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId);
248 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId);
249 asset.InvType = 6;
250 asset.Type = 6;
251 asset.FullID = LLUUID.Random();
252 asset.Data = Helpers.StringToField(sceneObjectXml);
253 this.assetCache.AddAsset(asset);
254
255
256 InventoryItemBase item = new InventoryItemBase();
257 item.avatarID = remoteClient.AgentId;
258 item.creatorsID = remoteClient.AgentId;
259 item.inventoryID = LLUUID.Random();
260 item.assetID = asset.FullID;
261 item.inventoryDescription = asset.Description;
262 item.inventoryName = asset.Name;
263 item.assetType = asset.Type;
264 item.invType = asset.InvType;
265 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
266 item.inventoryCurrentPermissions = 2147483647;
267 item.inventoryNextPermissions = 2147483647;
268
269 userInfo.AddItem(remoteClient.AgentId, item);
270 remoteClient.SendInventoryItemUpdate(item);
271 }
272
273 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
274 ((SceneObjectGroup)selectedEnt).DeleteGroup();
275
276 lock (Entities)
277 {
278 Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
279 }
280 }
281 }
282 }
283 }
284 }
285
286 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
287 {
288 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
289 if (userInfo != null)
290 {
291 if(userInfo.RootFolder != null)
292 {
293 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
294 if (item != null)
295 {
296 AssetBase rezAsset = this.assetCache.GetAsset(item.assetID, false);
297 if (rezAsset != null)
298 {
299 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
300 userInfo.DeleteItem(remoteClient.AgentId, item);
301 remoteClient.SendRemoveInventoryItem(itemID);
302 }
303 else
304 {
305 rezAsset = this.assetCache.GetAsset(item.assetID, false);
306 if (rezAsset != null)
307 {
308 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
309 userInfo.DeleteItem(remoteClient.AgentId, item);
310 remoteClient.SendRemoveInventoryItem(itemID);
311 }
312 }
313 }
314 }
315 }
316 }
317
318 private void AddRezObject(string xmlData, LLVector3 pos)
319 {
320 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
321 this.AddEntity(group);
322 group.AbsolutePosition = pos;
323 }
324 210
325 /// <summary> 211 /// <summary>
326 /// 212 ///
@@ -459,29 +345,6 @@ namespace OpenSim.Region.Environment.Scenes
459 /// <summary> 345 /// <summary>
460 /// 346 ///
461 /// </summary> 347 /// </summary>
462 /// <param name="remoteClient"></param>
463 /// <param name="primLocalID"></param>
464 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
465 {
466
467 bool hasPrim = false;
468 foreach (EntityBase ent in Entities.Values)
469 {
470 if (ent is SceneObjectGroup)
471 {
472 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
473 if (hasPrim != false)
474 {
475 ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID);
476 break;
477 }
478 }
479 }
480 }
481
482 /// <summary>
483 ///
484 /// </summary>
485 /// <param name="primLocalID"></param> 348 /// <param name="primLocalID"></param>
486 /// <param name="remoteClient"></param> 349 /// <param name="remoteClient"></param>
487 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 350 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
@@ -790,59 +653,7 @@ namespace OpenSim.Region.Environment.Scenes
790 }*/ 653 }*/
791 } 654 }
792 655
793 /// <summary> 656
794 /// temporary method to test out creating new inventory items
795 /// </summary>
796 /// <param name="remoteClient"></param>
797 /// <param name="transActionID"></param>
798 /// <param name="folderID"></param>
799 /// <param name="callbackID"></param>
800 /// <param name="description"></param>
801 /// <param name="name"></param>
802 /// <param name="invType"></param>
803 /// <param name="type"></param>
804 /// <param name="wearableType"></param>
805 /// <param name="nextOwnerMask"></param>
806 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask)
807 {
808 if (transActionID == LLUUID.Zero)
809 {
810 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
811 if (userInfo != null)
812 {
813 AssetBase asset = new AssetBase();
814 asset.Name = name;
815 asset.Description = description;
816 asset.InvType = invType;
817 asset.Type = type;
818 asset.FullID = LLUUID.Random();
819 asset.Data = new byte[1];
820 this.assetCache.AddAsset(asset);
821
822 InventoryItemBase item = new InventoryItemBase();
823 item.avatarID = remoteClient.AgentId;
824 item.creatorsID = remoteClient.AgentId;
825 item.inventoryID = LLUUID.Random();
826 item.assetID = asset.FullID;
827 item.inventoryDescription = description;
828 item.inventoryName = name;
829 item.assetType = invType;
830 item.invType = invType;
831 item.parentFolderID = folderID;
832 item.inventoryCurrentPermissions = 2147483647;
833 item.inventoryNextPermissions = nextOwnerMask;
834
835 userInfo.AddItem(remoteClient.AgentId, item);
836 remoteClient.SendInventoryItemUpdate(item);
837 }
838 }
839 else
840 {
841 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask);
842 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
843 }
844 }
845
846 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 657 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
847 { 658 {
848 this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); 659 this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);