Exemplo n.º 1
0
        //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"));
        }
Exemplo n.º 2
0
        private void AvatarAppearanceHandler(Packet packet, Simulator simulator)
        {
            AvatarAppearancePacket appearance = (AvatarAppearancePacket)packet;

            LLObject.TextureEntry te = new LLObject.TextureEntry(appearance.ObjectData.TextureEntry, 0, 
                appearance.ObjectData.TextureEntry.Length);

            if (IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.EyesBaked] ) &&
                IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.HeadBaked]) &&
                IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.LowerBaked]) &&
                IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.SkirtBaked]) &&
                IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.UpperBaked]))
            {
                Console.WriteLine("Avatar " + appearance.Sender.ID.ToString() + " may be a bot");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// TextureEntry must have it's face textures in a specific order for avatars.  
        /// Should be called at least once before sending an AgentSetAppearance packet.
        /// </summary>
        protected void UpdateAgentTextureEntryOrder()
        {
            // Correct the order of the textures
            foreach (uint faceid in AgentTextureEntry.FaceTextures.Keys)
            {
                if (faceid > 18)
                {
                    Client.Log("Unknown order for FaceID: " + faceid + Environment.NewLine +
                        "Your wearables define a face that we don't know the order of.  Please " +
                        "capture a AgentSetAppearance packet for your current outfit and submit to " +
                        "[email protected], thanks!", Helpers.LogLevel.Info);
                    break;
                }
            }

            //Re-order texture faces to match Linden Labs internal data structure.
            LLObject.TextureEntry te2 = new LLObject.TextureEntry(AgentTextureEntry.DefaultTexture.TextureID);
            te2.CreateFace(18).TextureID = AgentTextureEntry.GetFace(18).TextureID;
            te2.CreateFace(17).TextureID = AgentTextureEntry.GetFace(17).TextureID;
            te2.CreateFace(16).TextureID = AgentTextureEntry.GetFace(16).TextureID;
            te2.CreateFace(15).TextureID = AgentTextureEntry.GetFace(15).TextureID;
            te2.CreateFace(14).TextureID = AgentTextureEntry.GetFace(14).TextureID;
            te2.CreateFace(13).TextureID = AgentTextureEntry.GetFace(13).TextureID;
            te2.CreateFace(12).TextureID = AgentTextureEntry.GetFace(12).TextureID;
            // I wonder if shoes are somewhere in here?
            te2.CreateFace(7).TextureID = AgentTextureEntry.GetFace(7).TextureID;
            te2.CreateFace(6).TextureID = AgentTextureEntry.GetFace(6).TextureID;
            te2.CreateFace(5).TextureID = AgentTextureEntry.GetFace(5).TextureID;
            te2.CreateFace(4).TextureID = AgentTextureEntry.GetFace(4).TextureID;
            te2.CreateFace(3).TextureID = AgentTextureEntry.GetFace(3).TextureID;
            te2.CreateFace(2).TextureID = AgentTextureEntry.GetFace(2).TextureID;
            te2.CreateFace(1).TextureID = AgentTextureEntry.GetFace(1).TextureID;
            te2.CreateFace(0).TextureID = AgentTextureEntry.GetFace(0).TextureID;

            AgentTextureEntry = te2;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Update the local Avatar Appearance information based on the contents of the assets as defined in the cached wearable data info.
        /// </summary>
        protected void GetAvatarAppearanceInfoFromWearableAssets()
        {
            // Make sure we have some Wearable Data to start with.
            if (AgentWearablesSignal.WaitOne(1000, false) == false)
            {
                Client.Log("Cannot get Visual Param data from wearable assets.  AgentWearablesSignal not set.", Helpers.LogLevel.Error);
                return;
            }

            // Clear current look
            AgentTextureEntry = new LLObject.TextureEntry("C228D1CF4B5D4BA884F4899A0796AA97"); // if this isn't valid, blame JH ;-)
            AgentAppearanceParams = new SerializableDictionary<int, float>();


            // Build params and texture entries from wearable data
            foreach (AgentWearablesUpdatePacket.WearableDataBlock wdb in AgentWearablesData)
            {
                if (wdb.ItemID == LLUUID.Zero)
                {
                    continue;
                }


                AssetWearable wearableAsset;

                switch (wdb.WearableType)
                {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                        wearableAsset = new AssetWearable_Body(wdb.AssetID, null);
                        break;
                    default:
                        wearableAsset = new AssetWearable_Clothing(wdb.AssetID, null);
                        break;
                }

                AssetRequestDownload request = Client.Assets.RequestInventoryAsset(wearableAsset.AssetID, wearableAsset.Type);
                if (request.Wait(AssetManager.DefaultTimeout) != AssetRequestDownload.RequestStatus.Success)
                {
                    Client.Log("Asset (" + wearableAsset.AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ")", Helpers.LogLevel.Error);
                }
                else
                {
                    wearableAsset.SetAssetData(request.GetAssetData());
                }

                if ((wearableAsset.AssetData == null) || (wearableAsset.AssetData.Length == 0))
                {
                    Client.Log("Asset retrieval failed for AssetID: " + wearableAsset.AssetID, Helpers.LogLevel.Warning);
                }

                UpdateAgentTextureEntryAndAppearanceParams(wearableAsset);

            }


            UpdateAgentTextureEntryOrder();
        }
Exemplo n.º 5
0
        static void Objects_OnNewPrim(Simulator simulator, Primitive prim, ulong regionHandle, ushort timeDilation)
        {
            if (CurrentSculpt != null && (prim.Flags & LLObject.ObjectFlags.CreateSelected) != 0 &&
                !RezzedPrims.Contains(prim.LocalID))
            {
                lock (RezzedPrims) RezzedPrims.Add(prim.LocalID);

                Console.WriteLine("Rezzed prim " + CurrentSculpt.Name + ", setting properties");

                // Deselect the prim
                Client.Objects.DeselectObject(Client.Network.CurrentSim, prim.LocalID);

                // Set the prim position
                Client.Objects.SetPosition(Client.Network.CurrentSim, prim.LocalID,
                    RootPosition + CurrentSculpt.Offset);

                // Set the texture
                LLObject.TextureEntry textures = new LLObject.TextureEntry(CurrentSculpt.TextureID);
                Client.Objects.SetTextures(Client.Network.CurrentSim, prim.LocalID, textures);

                // Turn it in to a sculpted prim
                Primitive.SculptData sculpt = new Primitive.SculptData();
                sculpt.SculptTexture = CurrentSculpt.SculptID;
                sculpt.Type = Primitive.SculptType.Sphere;
                Client.Objects.SetSculpt(Client.Network.CurrentSim, prim.LocalID, sculpt);

                // Set the prim name
                if (!String.IsNullOrEmpty(CurrentSculpt.Name))
                    Client.Objects.SetName(Client.Network.CurrentSim, prim.LocalID, CurrentSculpt.Name);

                RezzedEvent.Set();
            }
        }
Exemplo n.º 6
0
        public void TextureEntry()
        {
            LLObject.TextureEntry te = new LLObject.TextureEntry(LLUUID.Random());
            LLObject.TextureEntryFace face = te.CreateFace(0);
            face.Bump = Bumpiness.Concrete;
            face.Fullbright = true;
            face.MediaFlags = true;
            face.OffsetU = 0.5f;
            face.OffsetV = -0.5f;
            face.RepeatU = 3.0f;
            face.RepeatV = 4.0f;
            face.RGBA = new LLColor(0f, 0.25f, 0.75f, 1f);
            face.Rotation = 1.5f;
            face.Shiny = Shininess.Medium;
            face.TexMapType = MappingType.Planar;
            face.TextureID = LLUUID.Random();

            byte[] teBytes = te.ToBytes();

            LLObject.TextureEntry te2 = new LLObject.TextureEntry(teBytes, 0, teBytes.Length);

            byte[] teBytes2 = te2.ToBytes();

            Assert.IsTrue(teBytes.Length == teBytes2.Length);

            for (int i = 0; i < teBytes.Length; i++)
            {
                Assert.IsTrue(teBytes[i] == teBytes2[i], "Byte " + i + " is not equal");
            }
        }
Exemplo n.º 7
0
        private void SendAgentSetAppearance()
        {
            AgentSetAppearancePacket set = new AgentSetAppearancePacket();
            set.AgentData.AgentID = Client.Self.AgentID;
            set.AgentData.SessionID = Client.Self.SessionID;
            set.AgentData.SerialNum = SetAppearanceSerialNum++;
            set.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[VisualParams.Params.Count];



            float AgentSizeVPHeight = 0.0f;
            float AgentSizeVPHeelHeight = 0.0f;
            float AgentSizeVPPlatformHeight = 0.0f;
            float AgentSizeVPHeadSize = 0.0f;
            float AgentSizeVPLegLength = 0.0f;
            float AgentSizeVPNeckLength = 0.0f;
            float AgentSizeVPHipLength = 0.0f;

            lock (Wearables.Dictionary)
            {
                // Only for debugging output
                int count = 0, vpIndex = 0;

                // Build the visual param array
                foreach (KeyValuePair<int, VisualParam> kvp in VisualParams.Params)
                {
                    bool found = false;
                    set.VisualParam[vpIndex] = new AgentSetAppearancePacket.VisualParamBlock();
                    VisualParam vp = kvp.Value;

                    // Try and find this value in our collection of downloaded wearables
                    foreach (WearableData data in Wearables.Dictionary.Values)
                    {
                        if (data.Asset != null && data.Asset.Params.ContainsKey(vp.ParamID))
                        {
                            set.VisualParam[vpIndex].ParamValue = Helpers.FloatToByte(data.Asset.Params[vp.ParamID], vp.MinValue, vp.MaxValue);
                            found = true;
                            count++;

                            switch (vp.ParamID)
                            {
                                case 33:
                                    AgentSizeVPHeight = data.Asset.Params[vp.ParamID];
                                    break;
                                case 198:
                                    AgentSizeVPHeelHeight = data.Asset.Params[vp.ParamID];
                                    break;
                                case 503:
                                    AgentSizeVPPlatformHeight = data.Asset.Params[vp.ParamID];
                                    break;
                                case 682:
                                    AgentSizeVPHeadSize = data.Asset.Params[vp.ParamID];
                                    break;
                                case 692:
                                    AgentSizeVPLegLength = data.Asset.Params[vp.ParamID];
                                    break;
                                case 756:
                                    AgentSizeVPNeckLength = data.Asset.Params[vp.ParamID];
                                    break;
                                case 842:
                                    AgentSizeVPHipLength = data.Asset.Params[vp.ParamID];
                                    break;
                            }
                            break;
                        }
                    }

                    // Use a default value if we don't have one set for it
                    if (!found)
                    {
                        set.VisualParam[vpIndex].ParamValue = Helpers.FloatToByte(vp.DefaultValue, vp.MinValue, vp.MaxValue);

                        switch (vp.ParamID)
                        {
                            case 33:
                                AgentSizeVPHeight = vp.DefaultValue;
                                break;
                            case 198:
                                AgentSizeVPHeelHeight = vp.DefaultValue;
                                break;
                            case 503:
                                AgentSizeVPPlatformHeight = vp.DefaultValue;
                                break;
                            case 682:
                                AgentSizeVPHeadSize = vp.DefaultValue;
                                break;
                            case 692:
                                AgentSizeVPLegLength = vp.DefaultValue;
                                break;
                            case 756:
                                AgentSizeVPNeckLength = vp.DefaultValue;
                                break;
                            case 842:
                                AgentSizeVPHipLength = vp.DefaultValue;
                                break;
                        }
                    }

                    vpIndex++;
                }

                Client.DebugLog("AgentSetAppearance contains " + count + " VisualParams");

                // Build the texture entry for our agent
                LLObject.TextureEntry te = new LLObject.TextureEntry(DEFAULT_AVATAR_TEXTURE);

                // Put our AgentTextures array in to TextureEntry
                lock (AgentTextures)
                {
                    for (uint i = 0; i < AgentTextures.Length; i++)
                    {
                        if (AgentTextures[i] != LLUUID.Zero)
                        {
                            LLObject.TextureEntryFace face = te.CreateFace(i);
                            face.TextureID = AgentTextures[i];
                        }
                    }
                }

                foreach (WearableData data in Wearables.Dictionary.Values)
                {
                    if (data.Asset != null)
                    {
                        foreach (KeyValuePair<TextureIndex, LLUUID> texture in data.Asset.Textures)
                        {
                            LLObject.TextureEntryFace face = te.CreateFace((uint)texture.Key);
                            face.TextureID = texture.Value;

                            Client.DebugLog("Setting texture " + ((TextureIndex)texture.Key).ToString() + " to " +
                                texture.Value.ToString());
                        }
                    }
                }

                // Set the packet TextureEntry
                set.ObjectData.TextureEntry = te.ToBytes();
            }

            // FIXME: Our hackish algorithm is making squished avatars. See
            // http://www.libsecondlife.org/wiki/Agent_Size for discussion of the correct algorithm
            //float height = Helpers.ByteToFloat(set.VisualParam[33].ParamValue, VisualParams.Params[33].MinValue,
            //    VisualParams.Params[33].MaxValue);

            // Takes into account the Shoe Heel/Platform offsets but not the Head Size Offset.  But seems to work.
            double AgentSizeBase = 1.706;

            // The calculation for the Head Size scalar may be incorrect.  But seems to work.
            double AgentHeight = AgentSizeBase + (AgentSizeVPLegLength * .1918) + (AgentSizeVPHipLength * .0375) + (AgentSizeVPHeight * .12022) + (AgentSizeVPHeadSize * .01117) + (AgentSizeVPNeckLength * .038) + (AgentSizeVPHeelHeight * .08) + (AgentSizeVPPlatformHeight * .07);

            set.AgentData.Size = new LLVector3(0.45f, 0.6f, (float)AgentHeight);

            // TODO: Account for not having all the textures baked yet
            set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[BAKED_TEXTURE_COUNT];

            // Build hashes for each of the bake layers from the individual components
            for (int bakedIndex = 0; bakedIndex < BAKED_TEXTURE_COUNT; bakedIndex++)
            {
                LLUUID hash = new LLUUID();

                for (int wearableIndex = 0; wearableIndex < WEARABLES_PER_LAYER; wearableIndex++)
                {
                    WearableType type = WEARABLE_BAKE_MAP[bakedIndex][wearableIndex];
                    LLUUID assetID = GetWearableAsset(type);

                    // Build a hash of all the texture asset IDs in this baking layer
                    if (assetID != LLUUID.Zero) hash ^= assetID;
                }

                if (hash != LLUUID.Zero)
                {
                    // Hash with our secret value for this baked layer
                    hash ^= BAKED_TEXTURE_HASH[bakedIndex];
                }

                // Tell the server what cached texture assetID to use for each bake layer
                set.WearableData[bakedIndex] = new AgentSetAppearancePacket.WearableDataBlock();
                set.WearableData[bakedIndex].TextureIndex = (byte)bakedIndex;
                set.WearableData[bakedIndex].CacheID = hash;
            }

            // Finally, send the packet
            Client.Network.SendPacket(set);
        }
Exemplo n.º 8
0
        private void SendAgentSetAppearance()
        {
            AgentSetAppearancePacket set = new AgentSetAppearancePacket();
            set.AgentData.AgentID = Client.Self.AgentID;
            set.AgentData.SessionID = Client.Self.SessionID;
            set.AgentData.SerialNum = SetAppearanceSerialNum++;
            set.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[VisualParams.Params.Count];

            lock (Wearables)
            {
                // Only for debugging output
                int count = 0, vpIndex = 0;

                // Build the visual param array
                foreach (KeyValuePair<int,VisualParam> kvp in VisualParams.Params)
                {
                    bool found = false;
                    set.VisualParam[vpIndex] = new AgentSetAppearancePacket.VisualParamBlock();
                    VisualParam vp = kvp.Value;

                    // Try and find this value in our collection of downloaded wearables
                    foreach (WearableData data in Wearables.Values)
                    {
                        if (data.Asset != null && data.Asset.Params.ContainsKey(vp.ParamID))
                        {
                            set.VisualParam[vpIndex].ParamValue = Helpers.FloatToByte(data.Asset.Params[vp.ParamID], 
                                vp.MinValue, vp.MaxValue);
                            found = true;
                            count++;
                            break;
                        }
                    }

                    // Use a default value if we don't have one set for it
                    if (!found)
                    {
                        set.VisualParam[vpIndex].ParamValue = Helpers.FloatToByte(vp.DefaultValue,
                            vp.MinValue, vp.MaxValue);
                    }

                    vpIndex++;
                }

                Client.DebugLog("AgentSetAppearance contains " + count + " VisualParams");

                // Build the texture entry for our agent
                LLObject.TextureEntry te = new LLObject.TextureEntry(DEFAULT_AVATAR_TEXTURE);

                // Put our AgentTextures array in to TextureEntry
                lock (AgentTextures)
                {
                    for (uint i = 0; i < AgentTextures.Length; i++)
                    {
                        if (AgentTextures[i] != LLUUID.Zero)
                        {
                            LLObject.TextureEntryFace face = te.CreateFace(i);
                            face.TextureID = AgentTextures[i];
                        }
                    }
                }

                foreach (WearableData data in Wearables.Values)
                {
                    if (data.Asset != null)
                    {
                        foreach (KeyValuePair<TextureIndex, LLUUID> texture in data.Asset.Textures)
                        {
                            LLObject.TextureEntryFace face = te.CreateFace((uint)texture.Key);
                            face.TextureID = texture.Value;

                            Client.DebugLog("Setting texture " + ((TextureIndex)texture.Key).ToString() + " to " +
                                texture.Value.ToString());
                        }
                    }
                }

                // Set the packet TextureEntry
                set.ObjectData.TextureEntry = te.ToBytes();
            }

            // FIXME: Our hackish algorithm is making squished avatars. See
            // http://www.libsecondlife.org/wiki/Agent_Size for discussion of the correct algorithm
            float height = Helpers.ByteToFloat(set.VisualParam[33].ParamValue, VisualParams.Params[33].MinValue,
                VisualParams.Params[33].MaxValue);
            set.AgentData.Size = new LLVector3(0.45f, 0.6f, 1.50856f + ((height / 255.0f) * (2.025506f - 1.50856f)));

            // TODO: Account for not having all the textures baked yet
            set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[BAKED_TEXTURE_COUNT];

            // Build hashes for each of the bake layers from the individual components
            for (int bakedIndex = 0; bakedIndex < BAKED_TEXTURE_COUNT; bakedIndex++)
            {
                LLUUID hash = new LLUUID();

                for (int wearableIndex = 0; wearableIndex < WEARABLES_PER_LAYER; wearableIndex++)
                {
                    WearableType type = WEARABLE_BAKE_MAP[bakedIndex][wearableIndex];
                    LLUUID assetID = GetWearableAsset(type);

                    // Build a hash of all the texture asset IDs in this baking layer
                    if (assetID != LLUUID.Zero) hash ^= assetID;
                }

                if (hash != LLUUID.Zero)
                {
                    // Hash with our secret value for this baked layer
                    hash ^= BAKED_TEXTURE_HASH[bakedIndex];
                }

                // Tell the server what cached texture assetID to use for each bake layer
                set.WearableData[bakedIndex] = new AgentSetAppearancePacket.WearableDataBlock();
                set.WearableData[bakedIndex].TextureIndex = (byte)bakedIndex;
                set.WearableData[bakedIndex].CacheID = hash;
            }

            // Finally, send the packet
            Client.Network.SendPacket(set);
        }
Exemplo n.º 9
0
        public void CreateFromStorage(PrimData store, LLVector3 posi, uint localID, bool newprim)
        {
            //need to clean this up as it shares a lot of code with CreateFromPacket()
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
            objupdate.RegionData.RegionHandle = m_regionHandle;
            objupdate.RegionData.TimeDilation = 64096;
            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];

            this.primData = store;
            objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
            objupdate.ObjectData[0].PSBlock = new byte[0];
            objupdate.ObjectData[0].ExtraParams = new byte[1];
            objupdate.ObjectData[0].MediaURL = new byte[0];
            objupdate.ObjectData[0].NameValue = new byte[0];
            objupdate.ObjectData[0].Text = new byte[0];
            objupdate.ObjectData[0].TextColor = new byte[4];
            objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
            objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
            objupdate.ObjectData[0].Material = 3;
            objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
            objupdate.ObjectData[0].TextureAnim = new byte[0];
            objupdate.ObjectData[0].Sound = LLUUID.Zero;

            if (store.Texture == null)
            {
                LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
                objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
            }
            else
            {
                objupdate.ObjectData[0].TextureEntry = store.Texture;
            }

            objupdate.ObjectData[0].State = 0;
            objupdate.ObjectData[0].Data = new byte[0];
            objupdate.ObjectData[0].OwnerID = this.primData.OwnerID;
            objupdate.ObjectData[0].PCode = this.primData.PCode;
            objupdate.ObjectData[0].PathBegin = this.primData.PathBegin;
            objupdate.ObjectData[0].PathEnd = this.primData.PathEnd;
            objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX;
            objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY;
            objupdate.ObjectData[0].PathShearX = this.primData.PathShearX;
            objupdate.ObjectData[0].PathShearY = this.primData.PathShearY;
            objupdate.ObjectData[0].PathSkew = this.primData.PathSkew;
            objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
            objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
            objupdate.ObjectData[0].Scale = this.primData.Scale;
            objupdate.ObjectData[0].PathCurve = this.primData.PathCurve;
            objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
            objupdate.ObjectData[0].ParentID = 0;
            objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
            //finish off copying rest of shape data
            objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
            objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
            objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX;
            objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY;
            objupdate.ObjectData[0].PathTwist = this.primData.PathTwist;
            objupdate.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin;

            objupdate.ObjectData[0].ID = localID; // (uint)store.LocalID;
            objupdate.ObjectData[0].FullID = store.FullID;

            objupdate.ObjectData[0].ObjectData = new byte[60];
            objupdate.ObjectData[0].ObjectData[46] = 128;
            objupdate.ObjectData[0].ObjectData[47] = 63;
            LLVector3 pos1 = posi; // store.Position;
            //update position
            byte[] pb = pos1.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);

            this.uuid = objupdate.ObjectData[0].FullID;
            this.localid = objupdate.ObjectData[0].ID;
            this.Pos = pos1;
            this.OurPacket = objupdate;
            if (newprim)
            {
                this.newPrimFlag = true;
            }
        }
Exemplo n.º 10
0
        public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
        {
            ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
            objupdate.RegionData.RegionHandle = m_regionHandle;
            objupdate.RegionData.TimeDilation = 64096;

            objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
            PrimData PData = new PrimData();
            this.primData = PData;
            this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;

            objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
            objupdate.ObjectData[0].PSBlock = new byte[0];
            objupdate.ObjectData[0].ExtraParams = new byte[1];
            objupdate.ObjectData[0].MediaURL = new byte[0];
            objupdate.ObjectData[0].NameValue = new byte[0];
            objupdate.ObjectData[0].Text = new byte[0];
            objupdate.ObjectData[0].TextColor = new byte[4];
            objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
            objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
            objupdate.ObjectData[0].Material = 3;
            objupdate.ObjectData[0].UpdateFlags =  32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
            objupdate.ObjectData[0].TextureAnim = new byte[0];
            objupdate.ObjectData[0].Sound = LLUUID.Zero;
            LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
            this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
            objupdate.ObjectData[0].State = 0;
            objupdate.ObjectData[0].Data = new byte[0];
            PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID;
            PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
            PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
            PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
            PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
            PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
            PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
            PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
            PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
            PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
            PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
            PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
            PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
            PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
            PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
            PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
            PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
            PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions;
            PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX;
            PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY;
            PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
            PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
            objupdate.ObjectData[0].ID = (uint)(localID);
            objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000"));
            objupdate.ObjectData[0].ObjectData = new byte[60];
            objupdate.ObjectData[0].ObjectData[46] = 128;
            objupdate.ObjectData[0].ObjectData[47] = 63;
            LLVector3 pos1 = addPacket.ObjectData.RayEnd;
            //update position
            byte[] pb = pos1.GetBytes();
            Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
            this.newPrimFlag = true;
            this.primData.FullID = this.uuid = objupdate.ObjectData[0].FullID;
            this.localid = objupdate.ObjectData[0].ID;
            this.primData.Position =  this.Pos = pos1;
            this.OurPacket = objupdate;
        }
Exemplo n.º 11
0
        protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
        {
            objdata.PSBlock = new byte[0];
            objdata.ExtraParams = new byte[1];
            objdata.MediaURL = new byte[0];
            objdata.NameValue = new byte[0];
            objdata.Text = new byte[0];
            objdata.TextColor = new byte[4];
            objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
            objdata.JointPivot = new LLVector3(0, 0, 0);
            objdata.Material = 4;
            objdata.TextureAnim = new byte[0];
            objdata.Sound = LLUUID.Zero;
            LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
            objdata.TextureEntry = ntex.ToBytes();
            objdata.State = 0;
            objdata.Data = new byte[0];

            objdata.ObjectData = new byte[76];
            objdata.ObjectData[15] = 128;
            objdata.ObjectData[16] = 63;
            objdata.ObjectData[56] = 128;
            objdata.ObjectData[61] = 102;
            objdata.ObjectData[62] = 40;
            objdata.ObjectData[63] = 61;
            objdata.ObjectData[64] = 189;
        }
Exemplo n.º 12
0
 public void SetAppearance(AgentSetAppearancePacket appear)
 {
     LLObject.TextureEntry tex = new LLObject.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
     this.avatarAppearanceTexture = tex;
     for (int i = 0; i < appear.VisualParam.Length; i++)
     {
         this.visualParams[i] = appear.VisualParam[i].ParamValue;
     }
     foreach (SimClient client in m_clientThreads.Values)
     {
         if (client.AgentID != ControllingClient.AgentID)
         {
             SendAppearanceToOtherAgent(client);
         }
     }
 }
Exemplo n.º 13
0
        protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
        {
            objdata.PSBlock = new byte[0];
            objdata.ExtraParams = new byte[1];
            objdata.MediaURL = new byte[0];
            objdata.NameValue = new byte[0];
            objdata.Text = new byte[0];
            objdata.TextColor = new byte[4];
            objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
            objdata.JointPivot = new LLVector3(0, 0, 0);
            objdata.Material = 3;
            objdata.TextureAnim = new byte[0];
            objdata.Sound = LLUUID.Zero;
            LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
            this.primData.Texture = objdata.TextureEntry = ntex.ToBytes();
            objdata.State = 0;
            objdata.Data = new byte[0];

            objdata.ObjectData = new byte[60];
            objdata.ObjectData[46] = 128;
            objdata.ObjectData[47] = 63;
        }