diff options
author | MW | 2007-04-01 12:02:44 +0000 |
---|---|---|
committer | MW | 2007-04-01 12:02:44 +0000 |
commit | f0a3edfb34580334a2b8c8ebced8ee380ec733d7 (patch) | |
tree | e839080d14b2bd7aa69769c0e0dc6e9287671154 /OpenSim.RegionServer/world/World.cs | |
parent | More work on adding Packets handlers and tested the first handler. (diff) | |
download | opensim-SC-f0a3edfb34580334a2b8c8ebced8ee380ec733d7.zip opensim-SC-f0a3edfb34580334a2b8c8ebced8ee380ec733d7.tar.gz opensim-SC-f0a3edfb34580334a2b8c8ebced8ee380ec733d7.tar.bz2 opensim-SC-f0a3edfb34580334a2b8c8ebced8ee380ec733d7.tar.xz |
Moved more packet types to handlers
Diffstat (limited to 'OpenSim.RegionServer/world/World.cs')
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 76 |
1 files changed, 53 insertions, 23 deletions
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 66247a2..7f4ecac 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs | |||
@@ -308,8 +308,9 @@ namespace OpenSim.world | |||
308 | this._primCount++; | 308 | this._primCount++; |
309 | } | 309 | } |
310 | 310 | ||
311 | public void DeRezObject(DeRezObjectPacket DeRezPacket, SimClient AgentClient) | 311 | public void DeRezObject(SimClient simClient, Packet packet) |
312 | { | 312 | { |
313 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; | ||
313 | // Console.WriteLine(DeRezPacket); | 314 | // Console.WriteLine(DeRezPacket); |
314 | //Needs to delete object from physics at a later date | 315 | //Needs to delete object from physics at a later date |
315 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | 316 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) |
@@ -369,7 +370,7 @@ namespace OpenSim.world | |||
369 | primAsset.Description = ""; | 370 | primAsset.Description = ""; |
370 | primAsset.Data = ((Primitive)ent).GetByteArray(); | 371 | primAsset.Data = ((Primitive)ent).GetByteArray(); |
371 | this._assetCache.AddAsset(primAsset); | 372 | this._assetCache.AddAsset(primAsset); |
372 | this._inventoryCache.AddNewInventoryItem(AgentClient, DeRezPacket.AgentBlock.DestinationID, primAsset); | 373 | this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset); |
373 | selectedEnt = ent; | 374 | selectedEnt = ent; |
374 | break; | 375 | break; |
375 | } | 376 | } |
@@ -394,27 +395,6 @@ namespace OpenSim.world | |||
394 | } | 395 | } |
395 | } | 396 | } |
396 | 397 | ||
397 | public void RezObject(SimClient remoteClient, RezObjectPacket packet) | ||
398 | { | ||
399 | AgentInventory inven =this._inventoryCache.GetAgentsInventory(remoteClient.AgentID); | ||
400 | if(inven != null) | ||
401 | { | ||
402 | if (inven.InventoryItems.ContainsKey(packet.InventoryData.ItemID)) | ||
403 | { | ||
404 | AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[packet.InventoryData.ItemID].AssetID); | ||
405 | if (asset != null) | ||
406 | { | ||
407 | PrimData primd = new PrimData(asset.Data); | ||
408 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
409 | nPrim.CreateFromStorage(primd, packet.RezData.RayEnd, this._primCount, true); | ||
410 | this.Entities.Add(nPrim.uuid, nPrim); | ||
411 | this._primCount++; | ||
412 | this._inventoryCache.DeleteInventoryItem(remoteClient, packet.InventoryData.ItemID); | ||
413 | } | ||
414 | } | ||
415 | } | ||
416 | } | ||
417 | |||
418 | public bool Backup() | 398 | public bool Backup() |
419 | { | 399 | { |
420 | 400 | ||
@@ -470,6 +450,56 @@ namespace OpenSim.world | |||
470 | } | 450 | } |
471 | return true; | 451 | return true; |
472 | } | 452 | } |
453 | |||
454 | public bool SimChat(SimClient simClient, Packet packet) | ||
455 | { | ||
456 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
457 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; | ||
458 | if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") | ||
459 | { | ||
460 | //empty message so don't bother with it | ||
461 | return true; | ||
462 | } | ||
463 | |||
464 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | ||
465 | reply.ChatData.Audible = 1; | ||
466 | reply.ChatData.Message = inchatpack.ChatData.Message; | ||
467 | reply.ChatData.ChatType = 1; | ||
468 | reply.ChatData.SourceType = 1; | ||
469 | reply.ChatData.Position = simClient.ClientAvatar.position; | ||
470 | reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); | ||
471 | reply.ChatData.OwnerID = simClient.AgentID; | ||
472 | reply.ChatData.SourceID = simClient.AgentID; | ||
473 | foreach (SimClient client in m_clientThreads.Values) | ||
474 | { | ||
475 | client.OutPacket(reply); | ||
476 | } | ||
477 | return true; | ||
478 | } | ||
479 | |||
480 | public bool RezObject(SimClient simClient, Packet packet) | ||
481 | { | ||
482 | RezObjectPacket rezPacket = (RezObjectPacket)packet; | ||
483 | AgentInventory inven = this._inventoryCache.GetAgentsInventory(simClient.AgentID); | ||
484 | if (inven != null) | ||
485 | { | ||
486 | if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) | ||
487 | { | ||
488 | AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); | ||
489 | if (asset != null) | ||
490 | { | ||
491 | PrimData primd = new PrimData(asset.Data); | ||
492 | Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); | ||
493 | nPrim.CreateFromStorage(primd, rezPacket.RezData.RayEnd, this._primCount, true); | ||
494 | this.Entities.Add(nPrim.uuid, nPrim); | ||
495 | this._primCount++; | ||
496 | this._inventoryCache.DeleteInventoryItem(simClient, rezPacket.InventoryData.ItemID); | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | return true; | ||
501 | } | ||
502 | |||
473 | #endregion | 503 | #endregion |
474 | } | 504 | } |
475 | } | 505 | } |