public bool ModifyTerrain(SimClient 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); }
/// <summary> /// Send the region heightmap to the client /// </summary> /// <param name="RemoteClient">Client to send to</param> public void SendLayerData(SimClient RemoteClient) { try { int[] patches = new int[4]; for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x = x + 4) { patches[0] = x + 0 + y * 16; patches[1] = x + 1 + y * 16; patches[2] = x + 2 + y * 16; patches[3] = x + 3 + y * 16; Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); RemoteClient.OutPacket(layerpack); } } } catch (Exception e) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: SendLayerData() - Failed with exception " + e.ToString()); } }
//private bool childShadowAvatar = false; public Avatar(SimClient TheClient, World world, string regionName, Dictionary <uint, SimClient> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) { m_world = world; m_clientThreads = clientThreads; m_regionName = regionName; m_regionHandle = regionHandle; m_regionTerraform = regionTerraform; m_regionWaterHeight = regionWater; OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; localid = 8880000 + (this.m_world._localNumber++); Pos = ControllingClient.startpos; visualParams = new byte[218]; for (int i = 0; i < 218; i++) { visualParams[i] = 100; } Wearables = new AvatarWearable[13]; //should be 13 of these for (int i = 0; i < 13; i++) { Wearables[i] = new AvatarWearable(); } this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); this.Wearables[0].ItemID = LLUUID.Random(); this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); }
private void SendItemUpdateCreate(SimClient remoteClient, InventoryItem Item) { UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); InventoryReply.AgentData.AgentID = remoteClient.AgentID; InventoryReply.AgentData.SimApproved = true; InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); InventoryReply.InventoryData[0].ItemID = Item.ItemID; InventoryReply.InventoryData[0].AssetID = Item.AssetID; InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].CreationDate = 1000; InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].Flags = 0; InventoryReply.InventoryData[0].FolderID = Item.FolderID; InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].InvType = Item.InvType; InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].SalePrice = 100; InventoryReply.InventoryData[0].SaleType = 0; InventoryReply.InventoryData[0].Type = Item.Type; InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); remoteClient.OutPacket(InventoryReply); }
public void GetProperites(SimClient client) { ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); proper.ObjectData[0].ItemID = LLUUID.Zero; // this.uuid; proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; proper.ObjectData[0].CreatorID = this.primData.OwnerID; proper.ObjectData[0].FolderID = LLUUID.Zero; proper.ObjectData[0].FromTaskID = LLUUID.Zero; proper.ObjectData[0].GroupID = LLUUID.Zero; proper.ObjectData[0].InventorySerial = 0; proper.ObjectData[0].LastOwnerID = LLUUID.Zero; proper.ObjectData[0].ObjectID = this.uuid; proper.ObjectData[0].OwnerID = primData.OwnerID; proper.ObjectData[0].TouchName = new byte[0]; proper.ObjectData[0].TextureID = new byte[0]; proper.ObjectData[0].SitName = new byte[0]; proper.ObjectData[0].Name = new byte[0]; proper.ObjectData[0].Description = new byte[0]; proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; proper.ObjectData[0].GroupMask = this.primData.GroupMask; proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; proper.ObjectData[0].BaseMask = this.primData.BaseMask; client.OutPacket(proper); }
//private bool childShadowAvatar = false; public Avatar(SimClient TheClient, World world, string regionName, Dictionary<uint, SimClient> clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) { m_world = world; m_clientThreads = clientThreads; m_regionName = regionName; m_regionHandle = regionHandle; m_regionTerraform = regionTerraform; m_regionWaterHeight = regionWater; OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); ControllingClient = TheClient; localid = 8880000 + (this.m_world._localNumber++); Pos = ControllingClient.startpos; visualParams = new byte[218]; for (int i = 0; i < 218; i++) { visualParams[i] = 100; } Wearables = new AvatarWearable[13]; //should be 13 of these for (int i = 0; i < 13; i++) { Wearables[i] = new AvatarWearable(); } this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); this.Wearables[0].ItemID = LLUUID.Random(); this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); }
public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient) { try { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z); PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f); if (OpenSim.world.Avatar.PhysicsEngineFlying) { lock (this.LockPhysicsEngine) { prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); } } this.Entities.Add(prim.uuid, prim); this._primCount++; } catch (Exception e) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); } }
/// <summary> /// Sends a specified patch to a client /// </summary> /// <param name="px">Patch coordinate (x) 0..16</param> /// <param name="py">Patch coordinate (y) 0..16</param> /// <param name="RemoteClient">The client to send to</param> public void SendLayerData(int px, int py, SimClient RemoteClient) { try { int[] patches = new int[1]; int patchx, patchy; patchx = px / 16; /* if (patchx > 12) * { * patchx = 12; * }*/ patchy = py / 16; patches[0] = patchx + 0 + patchy * 16; //patches[1] = patchx + 1 + patchy * 16; //patches[2] = patchx + 2 + patchy * 16; //patches[3] = patchx + 3 + patchy * 16; Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); RemoteClient.OutPacket(layerpack); } catch (Exception e) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: SendLayerData() - Failed with exception " + e.ToString()); } }
public void AddViewerAgent(SimClient agentClient) { try { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); Avatar newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); newAvatar.SendRegionHandshake(this); if (!agentClient.m_child) { PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.LockPhysicsEngine) { newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); } } lock (Entities) { this.Entities.Add(agentClient.AgentID, newAvatar); } lock (Avatars) { this.Avatars.Add(agentClient.AgentID, newAvatar); } } catch (Exception e) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); } }
// TODO: Create smaller variant [Fact] public void TestHotSpotReconnect() { int numClients = 10; SimClient[] clients = new SimClient[100]; Options opts = utils.DefaultTestOptions; opts.Servers = testServers; NATSServer s1 = utils.CreateServerOnPort(1222); Task[] waitgroup = new Task[numClients]; for (int i = 0; i < numClients; i++) { clients[i] = new SimClient(); Task t = new Task(() => { clients[i].Connect(testServers); clients[i].waitForReconnect(); }); t.Start(); waitgroup[i] = t; } NATSServer s2 = utils.CreateServerOnPort(1224); NATSServer s3 = utils.CreateServerOnPort(1226); s1.Shutdown(); Task.WaitAll(waitgroup); int s2Count = 0; int s3Count = 0; int unknown = 0; for (int i = 0; i < numClients; i++) { if (testServers[3].Equals(clients[i].ConnectedUrl)) { s2Count++; } else if (testServers[5].Equals(clients[i].ConnectedUrl)) { s3Count++; } else { unknown++; } } Assert.True(unknown == 0); int delta = Math.Abs(s2Count - s3Count); int range = numClients / 30; Assert.False(delta > range, string.Format("Connected clients to servers out of range: {0}/{0}", delta, range)); }
public void TestHotSpotReconnect() { int numClients = 10; SimClient[] clients = new SimClient[100]; Options opts = Context.GetTestOptions(); opts.Servers = Context.GetTestServersUrls(); NATSServer s1 = NATSServer.Create(Context.Server1.Port); Task[] waitgroup = new Task[numClients]; for (int i = 0; i < numClients; i++) { clients[i] = new SimClient(); waitgroup[i] = Task.Run(() => { clients[i].Connect(Context.GetTestServersUrls()); clients[i].waitForReconnect(); }); } NATSServer s3 = NATSServer.Create(Context.Server3.Port); NATSServer s5 = NATSServer.Create(Context.Server5.Port); s1.Shutdown(); Task.WaitAll(waitgroup); int s3Count = 0; int s5Count = 0; int unknown = 0; for (int i = 0; i < numClients; i++) { if (Context.Server3.Url.Equals(clients[i].ConnectedUrl)) { s3Count++; } else if (Context.Server5.Url.Equals(clients[i].ConnectedUrl)) { s5Count++; } else { unknown++; } } Assert.True(unknown == 0); int delta = Math.Abs(s3Count - s5Count); int range = numClients / 30; Assert.False(delta > range, string.Format("Connected clients to servers out of range: {0}/{0}", delta, range)); }
public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend) { if (this._agentsInventory.ContainsKey(userInfo.AgentID)) { AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; if (FetchDescend.InventoryData.FetchItems) { if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID)) { InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID]; InventoryDescendentsPacket Descend = new InventoryDescendentsPacket(); Descend.AgentData.AgentID = userInfo.AgentID; Descend.AgentData.OwnerID = Folder.OwnerID; Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID; Descend.AgentData.Descendents = Folder.Items.Count; Descend.AgentData.Version = Folder.Items.Count; Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count]; for (int i = 0; i < Folder.Items.Count; i++) { InventoryItem Item = Folder.Items[i]; Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); Descend.ItemData[i].ItemID = Item.ItemID; Descend.ItemData[i].AssetID = Item.AssetID; Descend.ItemData[i].CreatorID = Item.CreatorID; Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; Descend.ItemData[i].CreationDate = 1000; Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0"); Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; Descend.ItemData[i].Flags = 1; Descend.ItemData[i].FolderID = Item.FolderID; Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; Descend.ItemData[i].InvType = Item.InvType; Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0"); Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; Descend.ItemData[i].OwnerID = Item.OwnerID; Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; Descend.ItemData[i].SalePrice = 100; Descend.ItemData[i].SaleType = 0; Descend.ItemData[i].Type = Item.Type; Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); } userInfo.OutPacket(Descend); } } else { Console.WriteLine("fetch subfolders"); } } }
public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent) { bool res = false; if (folderID != LLUUID.Zero) //don't create a folder with a zero id { if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent); } } return(res); }
public bool SimChat(SimClient simClient, Packet packet) { System.Text.Encoding enc = System.Text.Encoding.ASCII; ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; if (Util.FieldToString(inchatpack.ChatData.Message) == "") { //empty message so don't bother with it return(true); } libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); reply.ChatData.Audible = 1; reply.ChatData.Message = inchatpack.ChatData.Message; reply.ChatData.ChatType = inchatpack.ChatData.Type; reply.ChatData.SourceType = 1; reply.ChatData.Position = simClient.ClientAvatar.Pos; reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); reply.ChatData.OwnerID = simClient.AgentID; reply.ChatData.SourceID = simClient.AgentID; foreach (SimClient client in m_clientThreads.Values) { switch (inchatpack.ChatData.Type) { case 0: int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); if ((dis < 10) && (dis > -10)) { client.OutPacket(reply); } break; case 1: dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); if ((dis < 30) && (dis > -30)) { client.OutPacket(reply); } break; case 2: dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); if ((dis < 100) && (dis > -100)) { client.OutPacket(reply); } break; } } return(true); }
public bool UpdateInventoryItemDetails(SimClient remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) { if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet); if (res) { InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; this.SendItemUpdateCreate(remoteClient, Item); } return(res); } return(false); }
public bool UpdateInventoryItemAsset(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Types.AssetBase asset) { if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset); if (res) { InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; this.SendItemUpdateCreate(remoteClient, Item); } return(res); } return(false); }
public LLUUID AddNewInventoryItem(SimClient remoteClient, LLUUID folderID, OpenSim.Framework.Types.AssetBase asset) { LLUUID newItem = null; if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset); if (newItem != null) { InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[newItem]; this.SendItemUpdateCreate(remoteClient, Item); } } return(newItem); }
/// <summary> /// Sends prims to a client /// </summary> /// <param name="RemoteClient">Client to send to</param> public void GetInitialPrims(SimClient RemoteClient) { try { foreach (libsecondlife.LLUUID UUID in Entities.Keys) { if (Entities[UUID] is Primitive) { Primitive primitive = Entities[UUID] as Primitive; primitive.UpdateClient(RemoteClient); } } } catch (Exception e) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: GetInitialPrims() - Failed with exception " + e.ToString()); } }
public void RemoveViewerAgent(SimClient agentClient) { try { lock (Entities) { Entities.Remove(agentClient.AgentID); } lock (Avatars) { Avatars.Remove(agentClient.AgentID); } } catch (Exception e) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString()); } }
/// <summary> /// /// </summary> /// <param name="userInfo"></param> /// <param name="transferRequest"></param> public void AddAssetRequest(SimClient userInfo, TransferRequestPacket transferRequest) { LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); //check to see if asset is in local cache, if not we need to request it from asset server. if (!this.Assets.ContainsKey(requestID)) { //not found asset // so request from asset server if (!this.RequestedAssets.ContainsKey(requestID)) { AssetRequest request = new AssetRequest(); request.RequestUser = userInfo; request.RequestAssetID = requestID; request.TransferRequestID = transferRequest.TransferInfo.TransferID; this.RequestedAssets.Add(requestID, request); this._assetServer.RequestAsset(requestID, false); } return; } //it is in our cache AssetInfo asset = this.Assets[requestID]; //work out how many packets it should be sent in // and add to the AssetRequests list AssetRequest req = new AssetRequest(); req.RequestUser = userInfo; req.RequestAssetID = requestID; req.TransferRequestID = transferRequest.TransferInfo.TransferID; req.AssetInf = asset; if (asset.Data.LongLength > 600) { //over 600 bytes so split up file req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; } else { req.NumPackets = 1; } this.AssetRequests.Add(req); }
public void UpdateClient(SimClient RemoteClient) { LLVector3 lPos; if (this._physActor != null && this.physicsEnabled) { PhysicsVector pPos = this._physActor.Position; lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); } else { lPos = this.Pos; } byte[] pb = lPos.GetBytes(); Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); // OurPacket should be update with the follwing in updateShape() rather than having to do it here OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; OurPacket.ObjectData[0].PCode = this.primData.PCode; OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; OurPacket.ObjectData[0].Scale = this.primData.Scale; OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; OurPacket.ObjectData[0].ParentID = this.primData.ParentID; OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; //finish off copying rest of shape data OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; RemoteClient.OutPacket(OurPacket); }
public bool DeleteInventoryItem(SimClient remoteClient, LLUUID itemID) { bool res = false; if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { res = this._agentsInventory[remoteClient.AgentID].DeleteFromInventory(itemID); if (res) { RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); remove.AgentData.AgentID = remoteClient.AgentID; remove.AgentData.SessionID = remoteClient.SessionID; remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); remove.InventoryData[0].ItemID = itemID; remoteClient.OutPacket(remove); } } return(res); }
public void FetchInventory(SimClient userInfo, FetchInventoryPacket FetchItems) { if (this._agentsInventory.ContainsKey(userInfo.AgentID)) { AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; for (int i = 0; i < FetchItems.InventoryData.Length; i++) { if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID)) { InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID]; FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket(); InventoryReply.AgentData.AgentID = userInfo.AgentID; InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); InventoryReply.InventoryData[0].ItemID = Item.ItemID; InventoryReply.InventoryData[0].AssetID = Item.AssetID; InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].Flags = 0; InventoryReply.InventoryData[0].FolderID = Item.FolderID; InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].InvType = Item.InvType; InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0"); InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].OwnerID = Item.OwnerID; InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; InventoryReply.InventoryData[0].SalePrice = 100; InventoryReply.InventoryData[0].SaleType = 0; InventoryReply.InventoryData[0].Type = Item.Type; InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); userInfo.OutPacket(InventoryReply); } } } }
public void SendAppearanceToOtherAgent(SimClient userInfo) { AvatarAppearancePacket avp = new AvatarAppearancePacket(); avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); //a wearable update packets should only be sent about the viewers/agents own avatar not for other avatars //but it seems that the following code only created the packets and never actually sent them anyway /*AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); * aw.AgentData.AgentID = this.ControllingClient.AgentID; * aw.AgentData.SessionID = userInfo.SessionID; * aw.AgentData.SerialNum = 0; //removed the use of a random number as a random number could be less than the last number, should have a counter variable for this * * aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; * AgentWearablesUpdatePacket.WearableDataBlock awb; * for (int i = 0; i < 13; i++) * { * awb = new AgentWearablesUpdatePacket.WearableDataBlock(); * awb.WearableType = (byte)i; * awb.AssetID = this.Wearables[i].AssetID; * awb.ItemID = this.Wearables[i].ItemID; * aw.WearableData[i] = awb; * }*/ AvatarAppearancePacket.VisualParamBlock avblock = null; for (int i = 0; i < 218; i++) { avblock = new AvatarAppearancePacket.VisualParamBlock(); avblock.ParamValue = visualParams[i]; avp.VisualParam[i] = avblock; } avp.Sender.IsTrial = false; avp.Sender.ID = ControllingClient.AgentID; userInfo.OutPacket(avp); }
public bool RezObject(SimClient 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); }
/// <summary> /// /// </summary> /// <param name="userInfo"></param> /// <param name="imageID"></param> public void AddTextureRequest(SimClient userInfo, LLUUID imageID) { //check to see if texture is in local cache, if not request from asset server if (!this.Textures.ContainsKey(imageID)) { if (!this.RequestedTextures.ContainsKey(imageID)) { //not is cache so request from asset server AssetRequest request = new AssetRequest(); request.RequestUser = userInfo; request.RequestAssetID = imageID; request.IsTextureRequest = true; this.RequestedTextures.Add(imageID, request); this._assetServer.RequestAsset(imageID, true); } return; } TextureImage imag = this.Textures[imageID]; AssetRequest req = new AssetRequest(); req.RequestUser = userInfo; req.RequestAssetID = imageID; req.IsTextureRequest = true; req.ImageInfo = imag; if (imag.Data.LongLength > 600) { //over 600 bytes so split up file req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000; } else { req.NumPackets = 1; } this.TextureRequests.Add(req); }
public bool DeRezObject(SimClient simClient, Packet packet) { DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; //Needs to delete object from physics at a later date if (DeRezPacket.AgentBlock.DestinationID == LLUUID.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 (SimClient 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("Deleted UUID " + ent.uuid); } } } foreach (libsecondlife.LLUUID uuid in DeRezEnts) { lock (Entities) { Entities.Remove(uuid); } } } else { foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) { Entity selectedEnt = null; //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); foreach (Entity ent in this.Entities.Values) { if (ent.localid == Data.ObjectLocalID) { AssetBase primAsset = new AssetBase(); primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid primAsset.InvType = 6; primAsset.Type = 6; primAsset.Name = "Prim"; primAsset.Description = ""; primAsset.Data = ((Primitive)ent).GetByteArray(); this._assetCache.AddAsset(primAsset); this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset); selectedEnt = ent; break; } } if (selectedEnt != null) { this.localStorage.RemovePrim(selectedEnt.uuid); KillObjectPacket kill = new KillObjectPacket(); kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); kill.ObjectData[0].ID = selectedEnt.localid; foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(kill); } lock (Entities) { Entities.Remove(selectedEnt.uuid); } } } } return(true); }
/// <summary> /// Sends a specified patch to a client /// </summary> /// <param name="px">Patch coordinate (x) 0..16</param> /// <param name="py">Patch coordinate (y) 0..16</param> /// <param name="RemoteClient">The client to send to</param> public void SendLayerData(int px, int py, SimClient RemoteClient) { try { int[] patches = new int[1]; int patchx, patchy; patchx = px / 16; /* if (patchx > 12) { patchx = 12; }*/ patchy = py / 16; patches[0] = patchx + 0 + patchy * 16; //patches[1] = patchx + 1 + patchy * 16; //patches[2] = patchx + 2 + patchy * 16; //patches[3] = patchx + 3 + patchy * 16; Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); RemoteClient.OutPacket(layerpack); } catch (Exception e) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: SendLayerData() - Failed with exception " + e.ToString()); } }
public bool SimChat(SimClient simClient, Packet packet) { System.Text.Encoding enc = System.Text.Encoding.ASCII; ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)packet; if (Util.FieldToString(inchatpack.ChatData.Message) == "") { //empty message so don't bother with it return true; } libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); reply.ChatData.Audible = 1; reply.ChatData.Message = inchatpack.ChatData.Message; reply.ChatData.ChatType = inchatpack.ChatData.Type; reply.ChatData.SourceType = 1; reply.ChatData.Position = simClient.ClientAvatar.Pos; reply.ChatData.FromName = enc.GetBytes(simClient.ClientAvatar.firstname + " " + simClient.ClientAvatar.lastname + "\0"); reply.ChatData.OwnerID = simClient.AgentID; reply.ChatData.SourceID = simClient.AgentID; foreach (SimClient client in m_clientThreads.Values) { switch (inchatpack.ChatData.Type) { case 0: int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); if ((dis < 10) && (dis > -10)) { client.OutPacket(reply); } break; case 1: dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); if ((dis < 30) && (dis > -30)) { client.OutPacket(reply); } break; case 2: dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); if ((dis < 100) && (dis > -100)) { client.OutPacket(reply); } break; } } return true; }
//[TestMethod] public void TestHotSpotReconnect() { int numClients = 10; SimClient[] clients = new SimClient[100]; Options opts = ConnectionFactory.GetDefaultOptions(); opts.Servers = testServers; NATSServer s1 = utils.CreateServerOnPort(1222); Task[] waitgroup = new Task[numClients]; for (int i = 0; i < numClients; i++) { clients[i] = new SimClient(); Task t = new Task(() => { clients[i].Connect(testServers); clients[i].waitForReconnect(); }); t.Start(); waitgroup[i] = t; } NATSServer s2 = utils.CreateServerOnPort(1224); NATSServer s3 = utils.CreateServerOnPort(1226); s1.Shutdown(); Task.WaitAll(waitgroup); int s2Count = 0; int s3Count = 0; int unknown = 0; for (int i = 0; i < numClients; i++) { if (testServers[3].Equals(clients[i].ConnectedUrl)) s2Count++; else if (testServers[5].Equals(clients[i].ConnectedUrl)) s3Count++; else unknown++; } Assert.IsTrue(unknown == 0); int delta = Math.Abs(s2Count - s3Count); int range = numClients / 30; if (delta > range) { Assert.Fail("Connected clients to servers out of range: {0}/{1}", delta, range); } }
public void UpdateClient(SimClient RemoteClient) { LLVector3 lPos; if (this._physActor != null && this.physicsEnabled) { PhysicsVector pPos = this._physActor.Position; lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); } else { lPos = this.Pos; } byte[] pb = lPos.GetBytes(); Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); // OurPacket should be update with the follwing in updateShape() rather than having to do it here OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; OurPacket.ObjectData[0].PCode = this.primData.PCode; OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; OurPacket.ObjectData[0].Scale = this.primData.Scale; OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; OurPacket.ObjectData[0].ParentID = this.primData.ParentID ; OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; //finish off copying rest of shape data OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; RemoteClient.OutPacket(OurPacket); }
public void SendTerseUpdateToClient(SimClient RemoteClient) { }
public void GetProperites(SimClient client) { ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); proper.ObjectData[0].ItemID = LLUUID.Zero; // this.uuid; proper.ObjectData[0].CreationDate = (ulong) this.primData.CreationDate; proper.ObjectData[0].CreatorID = this.primData.OwnerID; proper.ObjectData[0].FolderID = LLUUID.Zero; proper.ObjectData[0].FromTaskID = LLUUID.Zero; proper.ObjectData[0].GroupID = LLUUID.Zero; proper.ObjectData[0].InventorySerial = 0; proper.ObjectData[0].LastOwnerID = LLUUID.Zero; proper.ObjectData[0].ObjectID = this.uuid; proper.ObjectData[0].OwnerID = primData.OwnerID; proper.ObjectData[0].TouchName = new byte[0]; proper.ObjectData[0].TextureID = new byte[0]; proper.ObjectData[0].SitName = new byte[0]; proper.ObjectData[0].Name = new byte[0]; proper.ObjectData[0].Description = new byte[0]; proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; proper.ObjectData[0].GroupMask = this.primData.GroupMask; proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; proper.ObjectData[0].BaseMask = this.primData.BaseMask; client.OutPacket(proper); }
public void SendAppearanceToOtherAgent(SimClient userInfo) { AvatarAppearancePacket avp = new AvatarAppearancePacket(); avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); //a wearable update packets should only be sent about the viewers/agents own avatar not for other avatars //but it seems that the following code only created the packets and never actually sent them anyway /*AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); aw.AgentData.AgentID = this.ControllingClient.AgentID; aw.AgentData.SessionID = userInfo.SessionID; aw.AgentData.SerialNum = 0; //removed the use of a random number as a random number could be less than the last number, should have a counter variable for this aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; AgentWearablesUpdatePacket.WearableDataBlock awb; for (int i = 0; i < 13; i++) { awb = new AgentWearablesUpdatePacket.WearableDataBlock(); awb.WearableType = (byte)i; awb.AssetID = this.Wearables[i].AssetID; awb.ItemID = this.Wearables[i].ItemID; aw.WearableData[i] = awb; }*/ AvatarAppearancePacket.VisualParamBlock avblock = null; for (int i = 0; i < 218; i++) { avblock = new AvatarAppearancePacket.VisualParamBlock(); avblock.ParamValue = visualParams[i]; avp.VisualParam[i] = avblock; } avp.Sender.IsTrial = false; avp.Sender.ID = ControllingClient.AgentID; userInfo.OutPacket(avp); }
public bool DeRezObject(SimClient simClient, Packet packet) { DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; //Needs to delete object from physics at a later date if (DeRezPacket.AgentBlock.DestinationID == LLUUID.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 (SimClient 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("Deleted UUID " + ent.uuid); } } } foreach (libsecondlife.LLUUID uuid in DeRezEnts) { lock (Entities) { Entities.Remove(uuid); } } } else { foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) { Entity selectedEnt = null; //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); foreach (Entity ent in this.Entities.Values) { if (ent.localid == Data.ObjectLocalID) { AssetBase primAsset = new AssetBase(); primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid primAsset.InvType = 6; primAsset.Type = 6; primAsset.Name = "Prim"; primAsset.Description = ""; primAsset.Data = ((Primitive)ent).GetByteArray(); this._assetCache.AddAsset(primAsset); this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset); selectedEnt = ent; break; } } if (selectedEnt != null) { this.localStorage.RemovePrim(selectedEnt.uuid); KillObjectPacket kill = new KillObjectPacket(); kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); kill.ObjectData[0].ID = selectedEnt.localid; foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(kill); } lock (Entities) { Entities.Remove(selectedEnt.uuid); } } } } return true; }
public void SendFullUpdateToClient(SimClient remoteClient) { LLVector3 lPos; if (this._physActor != null && this.physicsEnabled) { PhysicsVector pPos = this._physActor.Position; lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); } else { lPos = this.Pos; } ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; outPacket.ObjectData[0] = this.CreateUpdateBlock(); byte[] pb = lPos.GetBytes(); Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); remoteClient.OutPacket(outPacket); }
public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) { return(this.CreateNewInventoryFolder(remoteClient, folderID, 0)); }
public void RequestXferInventory(SimClient simClient, ulong xferID) { //will only currently work if the total size of the inventory data array is under about 1000 bytes SendXferPacketPacket send = new SendXferPacketPacket(); send.XferID.ID = xferID; send.XferID.Packet = 1 + 2147483648; send.DataPacket.Data = this.ConvertInventoryToBytes(); simClient.OutPacket(send); }
public void RequestInventoryInfo(SimClient simClient, RequestTaskInventoryPacket packet) { }
public bool RezObject(SimClient 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(SimClient 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; }