aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/ClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/ClientView.cs')
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs118
1 files changed, 3 insertions, 115 deletions
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