Example #1
0
        void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
        {
            lock (ReceivedProfileEvent)
            {
                Properties = properties;
                ReceivedProperties = true;

                if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
                    ReceivedProfileEvent.Set();
            }
        }
Example #2
0
        public void AddAvatar(Avatar av)
        {
            if (av == null) return;
            string name = av.Name;

            if (lvwObjects.Items.ContainsKey(name)) return;

            ListViewItem item = lvwObjects.Items.Add(name, name, string.Empty);
            if (name == client.Self.Name) item.Font = new Font(item.Font, FontStyle.Bold);
            item.Tag = av;
        }
        void Avatars_OnAvatarInterests(LLUUID avatarID, Avatar.Interests interests)
        {
            lock (ReceivedProfileEvent)
            {
                Interests = interests;
                ReceivedInterests = true;

                if (ReceivedInterests && ReceivedProperties)
                    ReceivedProfileEvent.Set();
            }
        }
Example #4
0
 bool Follow(LLUUID id)
 {
     foreach (Avatar av in Client.AvatarList.Values)
     {
         if (av.ID == id)
         {
             followAvatar = av;
             Active = true;
             return true;
         }
     }
     return false;
 }
Example #5
0
        bool Follow(string name)
        {
            foreach (Avatar av in Client.AvatarList.Values)
            {
                if (av.Name == name)
				{
					followAvatar = av;
					Active = true;
	                return true;
				}
            }
            return false;
        }
Example #6
0
 void MoveToAvatar(Avatar avatar)
 {
     if (avatar.SittingOn > 0)
     {
         Primitive prim;
         if (Network.CurrentSim.ObjectsPrimitives.TryGetValue(avatar.SittingOn, out prim))
             Self.RequestSit(prim.ID, LLVector3.Zero);
     }
     else
     {
         Self.Stand();
         AutoPilotLocal(avatar.Position.X, avatar.Position.Y, avatar.Position.Z);
         Self.Movement.TurnToward(avatar.Position);
     }
 }
        private void Objects_OnNewAvatar(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
        {
            if (imgManager == null)
            {
                Console.WriteLine("ImageManager not ready yet, queueing Avatar textures.");
                TextureQueue.Enqueue(avatar.FirstLifeImage);
                TextureQueue.Enqueue(avatar.ProfileImage);

                foreach (TextureEntryFace tef in avatar.Textures.FaceTextures.Values)
                {
                    TextureQueue.Enqueue(tef.TextureID);
                }
            }
            else
            {
                if (avatar.FirstLifeImage != null)
                {
                    if (imgManager.isCachedImage(avatar.FirstLifeImage) == false)
                    {
                        imgManager.RequestImageAsync(avatar.FirstLifeImage);
                    }
                }

                if (avatar.ProfileImage != null)
                {
                    if (imgManager.isCachedImage(avatar.FirstLifeImage) == false)
                    {
                        imgManager.RequestImageAsync(avatar.ProfileImage);
                    }
                }

                if (avatar.Textures != null)
                {
                    foreach (TextureEntryFace tef in avatar.Textures.FaceTextures.Values)
                    {
                        if (imgManager.isCachedImage(tef.TextureID) == false)
                        {
                            imgManager.RequestImageAsync(tef.TextureID);
                        }
                        else
                        {
                            Console.WriteLine("Already cached: " + tef.TextureID);
                        }
                    }
                }
            }
        }
        private void UpdateHandler(Packet packet, Simulator simulator)
        {
            if (OnNewPrim != null || OnNewAvatar != null)
            {
                ObjectUpdatePacket update = (ObjectUpdatePacket)packet;

                foreach (ObjectUpdatePacket.ObjectDataBlock block in update.ObjectData)
                {
                    if (block.PCode == (byte)PCode.Prim)
                    {
                        if (OnNewPrim != null)
                        {
                            // New prim spotted
                            PrimObject prim = new PrimObject(Client);

                            prim.Position = new LLVector3(block.ObjectData, 0);
                            prim.Rotation = new LLQuaternion(block.ObjectData, 36, true);

                            // TODO: Parse the rest of the ObjectData byte array fields

                            prim.LocalID = block.ID;
                            prim.State = block.State;
                            prim.ID = block.FullID;
                            prim.ParentID = block.ParentID;
                            //block.OwnerID Sound-related
                            prim.Material = block.Material;
                            prim.PathCurve = block.PathCurve;
                            prim.ProfileCurve = block.ProfileCurve;
                            prim.PathBegin = PrimObject.PathBeginFloat(block.PathBegin);
                            prim.PathEnd = PrimObject.PathEndFloat(block.PathEnd);
                            prim.PathTaperX = PrimObject.PathScaleFloat(block.PathScaleX);
                            prim.PathTaperY = PrimObject.PathScaleFloat(block.PathScaleY);
                            prim.PathShearX = PrimObject.PathShearFloat(block.PathShearX);
                            prim.PathShearY = PrimObject.PathShearFloat(block.PathShearY);
                            prim.PathTwist = block.PathTwist; //PrimObject.PathTwistFloat(block.PathTwist);
                            prim.PathTwistBegin = block.PathTwistBegin; //PrimObject.PathTwistFloat(block.PathTwistBegin);
                            prim.PathRadiusOffset = PrimObject.PathRadiusOffsetFloat(block.PathRadiusOffset);
                            //prim.PathTaperX = PrimObject.PathTaperFloat((byte)block.PathTaperX);
                            //prim.PathTaperY = PrimObject.PathTaperFloat((byte)block.PathTaperY);
                            prim.PathRevolutions = PrimObject.PathRevolutionsFloat(block.PathRevolutions);
                            prim.PathSkew = PrimObject.PathSkewFloat((byte)block.PathSkew);
                            prim.ProfileBegin = PrimObject.ProfileBeginFloat(block.ProfileBegin);
                            prim.ProfileEnd = PrimObject.ProfileEndFloat(block.ProfileEnd);
                            prim.ProfileHollow = block.ProfileHollow;
                            prim.Name = Helpers.FieldToString(block.NameValue);
                            //block.Data ?
                            prim.Text = ASCIIEncoding.ASCII.GetString(block.Text);
                            //block.TextColor LLColor4U of the hovering text
                            //block.MediaURL Quicktime stream
                            prim.Textures = new TextureEntry(block.TextureEntry, 0, block.TextureEntry.Length);
                            prim.TextureAnim = new TextureAnimation(block.TextureAnim, 0);
                            //block.JointType ?
                            //block.JointPivot ?
                            //block.JointAxisOrAnchor ?
                            prim.ParticleSys = new ParticleSystem(block.PSBlock, 0);
                            prim.SetExtraParamsFromBytes(block.ExtraParams, 0);
                            prim.Scale = block.Scale;
                            //block.Flags ?
                            //block.UpdateFlags ?
                            //block.ClickAction ?
                            //block.Gain Sound-related
                            //block.Sound Sound-related
                            //block.Radius Sound-related

                            if (OnNewPrim != null)
                            {
                                OnNewPrim(simulator, prim, update.RegionData.RegionHandle, update.RegionData.TimeDilation);
                            }
                        }
                    }
                    else if (block.PCode == (byte)PCode.Avatar)
                    {
                        if (OnNewAvatar != null)
                        {
                            Avatar avatar = new Avatar();

                            string FirstName = "";
                            string LastName = "";
                            string GroupName = "";

                            //avatar.CollisionPlane = new LLQuaternion(block.ObjectData, 0);
                            avatar.Position = new LLVector3(block.ObjectData, 16);
                            avatar.Rotation = new LLQuaternion(block.ObjectData, 52, true);

                            // TODO: Parse the rest of the ObjectData byte array fields

                            ParseAvName(Helpers.FieldToString(block.NameValue), ref FirstName, ref LastName, ref GroupName);

                            avatar.ID = block.FullID;
                            avatar.LocalID = block.ID;
                            avatar.Name = FirstName + " " + LastName;
                            avatar.GroupName = GroupName;
                            avatar.Online = true;
                            avatar.CurrentRegion = simulator.Region;

                            avatar.Textures = new TextureEntry(block.TextureEntry, 0, block.TextureEntry.Length);

                            if (FirstName == Client.Self.FirstName && LastName == Client.Self.LastName)
                            {
                                // Update our avatar
                                Client.Self.LocalID = avatar.LocalID;
                                Client.Self.Position = avatar.Position;
                                Client.Self.Rotation = avatar.Rotation;
                            }
                            else
                            {
                                if (OnNewAvatar != null)
                                {
                                    OnNewAvatar(simulator, avatar, update.RegionData.RegionHandle, update.RegionData.TimeDilation);
                                }
                            }
                        }
                    }
                    else if (block.PCode == (byte)PCode.Grass)
                    {
                        // FIXME: Handle grass objects
                        ;
                    }
                    else if (block.PCode == (byte)PCode.Tree)
                    {
                        // FIXME: Handle tree objects
                        ;
                    }
                    else if (block.PCode == (byte)PCode.ParticleSystem)
                    {
                        ;
                    }
                    else
                    {
                        // FIXME: How many of the PCodes do we actually need to handle?
                        ;
                    }
                }
            }
        }
Example #9
0
 void onAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
 {
     lock (ReceivedAvatarPropertiesEvent)
     {
         avatarProperties = properties;
         ReceivedAvatarPropertiesEvent.Set();
     }
 }
Example #10
0
        //comes in on separate thread
        private void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
        {
            if (avatarID != agentID) return;

            FLImageID = properties.FirstLifeImage;
            SLImageID = properties.ProfileImage;

            if (SLImageID != LLUUID.Zero)
            {
                if (!instance.ImageCache.ContainsImage(SLImageID))
                    client.Assets.RequestImage(SLImageID, ImageType.Normal, 125000.0f, 0);
                else
                    BeginInvoke(
                        new OnSetProfileImage(SetProfileImage),
                        new object[] { SLImageID, instance.ImageCache.GetImage(SLImageID) });
            }
            else
            {
                BeginInvoke(new MethodInvoker(SetBlankSLImage));
            }

            if (FLImageID != LLUUID.Zero)
            {
                if (!instance.ImageCache.ContainsImage(FLImageID))
                    client.Assets.RequestImage(FLImageID, ImageType.Normal, 125000.0f, 0);
                else
                    BeginInvoke(
                        new OnSetProfileImage(SetProfileImage),
                        new object[] { FLImageID, instance.ImageCache.GetImage(FLImageID) });
            }
            else
            {
                BeginInvoke(new MethodInvoker(SetBlankFLImage));
            }

            this.BeginInvoke(
                new OnSetProfileProperties(SetProfileProperties),
                new object[] { properties });
        }
Example #11
0
        /// <summary>
        /// Update agent profile
        /// </summary>
        /// <param name="profile"><seealso cref="libsecondlife.Avatar.AvatarProperties"/> struct containing updated 
        /// profile information</param>
        public void UpdateProfile(Avatar.AvatarProperties profile)
        {
            AvatarPropertiesUpdatePacket apup = new AvatarPropertiesUpdatePacket();
            apup.AgentData.AgentID = id;
            apup.AgentData.SessionID = sessionID;
            apup.PropertiesData.AboutText = Helpers.StringToField(profile.AboutText);
            apup.PropertiesData.AllowPublish = profile.AllowPublish;
            apup.PropertiesData.FLAboutText = Helpers.StringToField(profile.FirstLifeText);
            apup.PropertiesData.FLImageID = profile.FirstLifeImage;
            apup.PropertiesData.ImageID = profile.ProfileImage;
            apup.PropertiesData.MaturePublish = profile.MaturePublish;
            apup.PropertiesData.ProfileURL = Helpers.StringToField(profile.ProfileURL);

            Client.Network.SendPacket(apup);
        }
Example #12
0
		private void Objects_OnNewAvatar(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
		{
		    lock (AvatarList)
		    {
		        AvatarList[avatar.LocalID] = avatar;
		    }
		}
Example #13
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="simulator"></param>
        /// <param name="localID"></param>
        /// <param name="fullID"></param>
        /// <returns></returns>
        protected Avatar GetAvatar(Simulator simulator, uint localID, LLUUID fullID)
        {
            if (Client.Settings.OBJECT_TRACKING)
            {
                Avatar avatar;

                if (simulator.ObjectsAvatars.TryGetValue(localID, out avatar))
                {
                    return avatar;
                }
                else
                {
                    avatar = new Avatar();
                    avatar.LocalID = localID;
                    avatar.ID = fullID;
                    lock (simulator.ObjectsAvatars.Dictionary)
                        simulator.ObjectsAvatars.Dictionary[localID] = avatar;

                    return avatar;
                }
            }
            else
            {
                return new Avatar();
            }
        }
Example #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sim"></param>
        /// <param name="av"></param>
        /// <param name="localid"></param>
        /// <param name="oldSeatID"></param>
        protected void SetAvatarSittingOn(Simulator sim, Avatar av, uint localid, uint oldSeatID)
        {
            if (av.LocalID == Client.Self.localID) Client.Self.sittingOn = localid;
            av.sittingOn = localid;
                        

            if (OnAvatarSitChanged != null && oldSeatID != localid)
            {
                try { OnAvatarSitChanged(sim, av, localid, oldSeatID); }
                catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
            }
        }
Example #15
0
 public void AvatarTracker_OnAvatarUpdated(Avatar avatar)
 {
     Hashtable hash = new Hashtable();
     hash.Add("MessageType", "AvatarUpdated");
     hash.Add("ID", avatar.ID);
     hash.Add("Position", avatar.Position);
     enqueue(hash);
 }
Example #16
0
 public void AvatarTracker_OnAvatarRemoved(Avatar avatar)
 {
     Hashtable hash = new Hashtable();
     hash.Add("MessageType", "AvatarRemoved");
     hash.Add("Name", avatar.Name);
     hash.Add("ID", avatar.ID);
     hash.Add("LocalID", avatar.LocalID);
     enqueue(hash);
 }
Example #17
0
 public void AvatarTracker_OnAvatarAdded(Avatar avatar)
 {
     Hashtable hash = new Hashtable();
     hash.Add("MessageType", "AvatarAdded");
     hash.Add("Name", avatar.Name);
     hash.Add("ID", avatar.ID);
     hash.Add("LocalID", avatar.LocalID);
     hash.Add("Position", avatar.Position);
     hash.Add("Scale", avatar.Scale);
     hash.Add("GroupName", avatar.GroupName);
     enqueue(hash);
 }
Example #18
0
 public void Avatars_OnAvatarInterests(LLUUID avatarID, Avatar.Interests interests)
 {
     Hashtable item = new Hashtable();
     item.Add("MessageType", "AvatarInterests");
     item.Add("AvatarID", avatarID);
     item.Add("WantToMask", interests.WantToMask);
     item.Add("WantToText", interests.WantToText);
     item.Add("SkillsMask", interests.SkillsMask);
     item.Add("SkillsText", interests.SkillsText);
     item.Add("LanguagesText", interests.LanguagesText);
     enqueue(item);
 }
Example #19
0
 void Objects_OnNewAvatar(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
 {
     // Check if we already know about this avatar. If not, add it and announce the callback.
     // Otherwise just update the cache with the new information (e.g. changed position)
     if (!this.avatars.ContainsKey(avatar.LocalID))
     {
         lock(this.avatars) this.avatars.Add(avatar.LocalID, avatar);
         if(OnAvatarAdded != null) OnAvatarAdded(avatar);
     }
     else
     {
         lock(this.avatars) this.avatars[avatar.LocalID] = avatar;
     }
 }
        /// <summary>
        /// Sends camera and action updates to the server including the 
        /// position and orientation of our camera, and a ControlFlags field
        /// specifying our current movement actions
        /// </summary>
        /// <param name="reliable">Whether to ensure this packet makes it to the server</param>
        public void UpdateCamera(Avatar.AgentUpdateFlags controlFlags, LLVector3 position, LLVector3 forwardAxis,
            LLVector3 leftAxis, LLVector3 upAxis, LLQuaternion bodyRotation, LLQuaternion headRotation, float farClip,
            bool reliable)
        {
            AgentUpdatePacket update = new AgentUpdatePacket();

            update.AgentData.AgentID = Client.Network.AgentID;
            update.AgentData.SessionID = Client.Network.SessionID;
            update.AgentData.State = 0;
            update.AgentData.BodyRotation = bodyRotation;
            update.AgentData.HeadRotation = headRotation;
            update.AgentData.CameraCenter = position;
            update.AgentData.CameraAtAxis = forwardAxis;
            update.AgentData.CameraLeftAxis = leftAxis;
            update.AgentData.CameraUpAxis = upAxis;
            update.AgentData.Far = farClip;
            update.AgentData.ControlFlags = (uint)controlFlags;
            update.AgentData.Flags = 0;
            update.Header.Reliable = reliable;

            Client.Network.SendPacket(update);
        }
 void AvatarSeen(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
 {
     lock (Avatars)
     {
         Avatars.Add(avatar.LocalID);
     }
 }
Example #22
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="simulator"></param>
 /// <param name="avatar"></param>
 /// <param name="RegionHandle"></param>
 /// <param name="TimeDilation"></param>
 protected void FireOnNewAvatar(Simulator simulator, Avatar avatar, ulong RegionHandle, ushort TimeDilation)
 {
     if (OnNewAvatar != null)
     {
         try { OnNewAvatar(simulator, avatar, RegionHandle, TimeDilation); }
         catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
     }
 }
 /// <summary>
 /// Add an Avatar into the Avatars Dictionary
 /// </summary>
 /// <param name="avatar">Filled-out Avatar class to insert</param>
 public void AddAvatar(Avatar avatar)
 {
     lock (Avatars)
     {
         Avatars[avatar.ID] = avatar;
     }
 }
        private void UpdateHandler(Packet packet, Simulator simulator)
        {
            if (OnNewPrim != null || OnNewAttachment != null || OnNewAvatar != null || OnNewFoliage != null)
            {
                ObjectUpdatePacket update = (ObjectUpdatePacket)packet;

                foreach (ObjectUpdatePacket.ObjectDataBlock block in update.ObjectData)
                {
                    byte pcode = block.PCode;
                    switch (pcode)
                    {
                        case (byte)PCode.Grass:
                        case (byte)PCode.Tree:
                        case (byte)PCode.Prim:
                            string name = Helpers.FieldToString(block.NameValue);

                            // New prim spotted
                            PrimObject prim = new PrimObject();

                            prim.Name = name;

							prim.RegionHandle = update.RegionData.RegionHandle;
                            prim.Position = new LLVector3(block.ObjectData, 0);
                            prim.Rotation = new LLQuaternion(block.ObjectData, 36, true);
                            // TODO: Parse the rest of the ObjectData byte array fields

                            prim.LocalID = block.ID;
                            prim.State = block.State;
                            prim.ID = block.FullID;
                            prim.ParentID = block.ParentID;
                            //block.OwnerID Sound-related
                            prim.Material = block.Material;
                            prim.PathCurve = block.PathCurve;
                            prim.ProfileCurve = block.ProfileCurve;
                            prim.PathBegin = PrimObject.PathBeginFloat(block.PathBegin);
                            prim.PathEnd = PrimObject.PathEndFloat(block.PathEnd);
                            prim.PathScaleX = PrimObject.PathScaleFloat(block.PathScaleX);
                            prim.PathScaleY = PrimObject.PathScaleFloat(block.PathScaleY);
                            prim.PathShearX = PrimObject.PathShearFloat(block.PathShearX);
                            prim.PathShearY = PrimObject.PathShearFloat(block.PathShearY);
                            prim.PathTwist = block.PathTwist;
                            prim.PathTwistBegin = block.PathTwistBegin;
                            prim.PathRadiusOffset = PrimObject.PathRadiusOffsetFloat(block.PathRadiusOffset);
                            prim.PathTaperX = PrimObject.PathTaperFloat(block.PathTaperX);
                            prim.PathTaperY = PrimObject.PathTaperFloat(block.PathTaperY);
                            prim.PathRevolutions = PrimObject.PathRevolutionsFloat(block.PathRevolutions);
                            prim.PathSkew = PrimObject.PathSkewFloat(block.PathSkew);
                            prim.ProfileBegin = PrimObject.ProfileBeginFloat(block.ProfileBegin);
                            prim.ProfileEnd = PrimObject.ProfileEndFloat(block.ProfileEnd);
                            prim.ProfileHollow = block.ProfileHollow;


                            //block.Data ?
                            prim.Text = ASCIIEncoding.ASCII.GetString(block.Text);
                            //block.TextColor LLColor4U of the hovering text
                            //block.MediaURL Quicktime stream
                            prim.Textures = new TextureEntry(block.TextureEntry, 0, block.TextureEntry.Length);
                            prim.TextureAnim = new TextureAnimation(block.TextureAnim, 0);
                            //block.JointType ?
                            //block.JointPivot ?
                            //block.JointAxisOrAnchor ?
                            prim.ParticleSys = new ParticleSystem(block.PSBlock, 0);
                            prim.SetExtraParamsFromBytes(block.ExtraParams, 0);
                            prim.Scale = block.Scale;
                            //block.Flags ?
                            prim.Flags = (ObjectFlags)block.UpdateFlags;
                            //block.ClickAction ?
                            //block.Gain Sound-related
                            //block.Sound Sound-related
                            //block.Radius Sound-related

                            if (prim.Name.StartsWith("AttachItemID"))
                            {
                                if (OnNewAttachment != null)
                                {
                                    OnNewAttachment(simulator, prim, update.RegionData.RegionHandle, update.RegionData.TimeDilation);
                                }
                            }
                            else if (block.PCode == (byte)PCode.Tree || block.PCode == (byte)PCode.Grass)
                            {
                                if (OnNewFoliage != null)
                                {
                                    OnNewFoliage(simulator, prim, update.RegionData.RegionHandle, update.RegionData.TimeDilation);
                                }
                            }
                            else if (OnNewPrim != null)
                            {
                                OnNewPrim(simulator, prim, update.RegionData.RegionHandle, update.RegionData.TimeDilation);
                            }

                            break;
                        case (byte)PCode.Avatar:
                            // Update some internals if this is our avatar
                            if (block.FullID == Client.Network.AgentID)
                            {
                                // Update our current position information
                                Client.Self.LocalID = block.ID;
                                //avatar.CollisionPlane = new LLQuaternion(block.ObjectData, 0);
                                Client.Self.Position = new LLVector3(block.ObjectData, 16);
                                Client.Self.Rotation = new LLQuaternion(block.ObjectData, 52, true);
                                // TODO: Parse the rest of the ObjectData byte array fields

                                // Detect if we are sitting or standing
                                uint oldSittingOn = Client.Self.sittingOn;
                                Client.Self.sittingOn = block.ParentID;

                                // Fire the callback for our sitting orientation changing
                                if (Client.Self.sittingOn != oldSittingOn && OnAvatarSitChanged != null)
                                {
                                    OnAvatarSitChanged(simulator, Client.Self.sittingOn);
                                }
                            }

                            if (OnNewAvatar != null)
                            {
                                Avatar avatar = new Avatar();

                                string FirstName = "";
                                string LastName = "";
                                string GroupName = "";

                                //avatar.CollisionPlane = new LLQuaternion(block.ObjectData, 0);
                                avatar.Position = new LLVector3(block.ObjectData, 16);
                                avatar.Rotation = new LLQuaternion(block.ObjectData, 52, true);
                                // TODO: Parse the rest of the ObjectData byte array fields

                                avatar.sittingOn = block.ParentID;

                                ParseAvName(Helpers.FieldToString(block.NameValue), ref FirstName, ref LastName, ref GroupName);

                                avatar.ID = block.FullID;
                                avatar.LocalID = block.ID;
                                avatar.Name = FirstName + " " + LastName;
                                avatar.GroupName = GroupName;
                                avatar.Online = true;
                                avatar.CurrentRegion = simulator.Region;

                                avatar.Textures = new TextureEntry(block.TextureEntry, 0, block.TextureEntry.Length);

                                if (OnNewAvatar != null)
                                {
                                    OnNewAvatar(simulator, avatar, update.RegionData.RegionHandle, update.RegionData.TimeDilation);
                                }
                            }
                            break;
                        case (byte)PCode.ParticleSystem:
                            // FIXME: Handle ParticleSystem
                            Client.DebugLog("Got an ObjectUpdate block with a ParticleSystem PCode");
                            break;
                        default:
                            break;
                    }
                }
            }
        }
 public void AvatarIntrestsHandler(Packet packet, Simulator simulator)
 {
     AvatarInterestsReplyPacket airp = (AvatarInterestsReplyPacket)packet;
     Avatar av;
     lock (Avatars)
     {
         if (!Avatars.ContainsKey(airp.AgentData.AvatarID))
         {
             //not in our "cache", create a new object
             av = new Avatar();
             av.ID = airp.AgentData.AvatarID;
         }
         else
         {
             //Cache hit, modify existing avatar
             av = Avatars[airp.AgentData.AvatarID];
         }
         //The rest of the properties, thanks LL.
         av.WantToMask = airp.PropertiesData.WantToMask;
         av.WantToText = Helpers.FieldToString(airp.PropertiesData.WantToText);
         av.SkillsMask = airp.PropertiesData.SkillsMask;
         av.SkillsText = Helpers.FieldToString(airp.PropertiesData.SkillsText);
         av.LanguagesText = Helpers.FieldToString(airp.PropertiesData.LanguagesText);
     }
     if (AvatarIntrestsCallbacks.ContainsKey(airp.AgentData.AvatarID) && AvatarIntrestsCallbacks[airp.AgentData.AvatarID] != null)
         AvatarIntrestsCallbacks[airp.AgentData.AvatarID](av);
 }
 public void UpdateAvatar(Avatar a)
 {
     //Basic profile properties
     AvatarPropertiesUpdatePacket apup = new AvatarPropertiesUpdatePacket();
     AvatarPropertiesUpdatePacket.AgentDataBlock adb = new AvatarPropertiesUpdatePacket.AgentDataBlock();
     adb.AgentID = a.ID;
     adb.SessionID = Client.Network.SessionID;
     apup.AgentData = adb;
     AvatarPropertiesUpdatePacket.PropertiesDataBlock pdb = new AvatarPropertiesUpdatePacket.PropertiesDataBlock();
     pdb.AllowPublish = a.AllowPublish;
     pdb.FLAboutText = Helpers.StringToField(a.FirstLifeText);
     pdb.FLImageID = a.FirstLifeImage;
     pdb.ImageID = a.ProfileImage;
     pdb.MaturePublish = a.MaturePublish;
     pdb.ProfileURL = Helpers.StringToField(a.ProfileURL);
     apup.PropertiesData = pdb;
     //Intrests
     AvatarInterestsUpdatePacket aiup = new AvatarInterestsUpdatePacket();
     AvatarInterestsUpdatePacket.AgentDataBlock iadb = new AvatarInterestsUpdatePacket.AgentDataBlock();
     iadb.AgentID = a.ID;
     iadb.SessionID = Client.Network.SessionID;
     aiup.AgentData = iadb;
     AvatarInterestsUpdatePacket.PropertiesDataBlock ipdb = new AvatarInterestsUpdatePacket.PropertiesDataBlock();
     ipdb.LanguagesText = Helpers.StringToField(a.LanguagesText);
     ipdb.SkillsMask = a.SkillsMask;
     ipdb.SkillsText = Helpers.StringToField(a.SkillsText);
     ipdb.WantToMask = a.WantToMask;
     ipdb.WantToText = Helpers.StringToField(a.WantToText);
     aiup.PropertiesData = ipdb;
     //Send packets
     Client.Network.SendPacket(apup);
     Client.Network.SendPacket(aiup);
 }
        private void AvatarPropertiesHandler(Packet packet, Simulator sim)
        {
            Avatar av;
            AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet;
            lock(Avatars)
            {
            if (!Avatars.ContainsKey(reply.AgentData.AvatarID))
            {
                //not in our "cache", create a new object
                av = new Avatar();
            }
            else
            {
                //Cache hit, modify existing avatar
                av = Avatars[reply.AgentData.AvatarID];
            }
            av.ID = reply.AgentData.AvatarID;
            av.ProfileImage = reply.PropertiesData.ImageID;
            av.FirstLifeImage = reply.PropertiesData.FLImageID;
            av.PartnerID = reply.PropertiesData.PartnerID;
            av.AboutText = Helpers.FieldToString(reply.PropertiesData.AboutText);

            av.FirstLifeText = Helpers.FieldToString(reply.PropertiesData.FLAboutText);
            av.BornOn = Helpers.FieldToString(reply.PropertiesData.BornOn);
            av.CharterMember = Helpers.FieldToString(reply.PropertiesData.CharterMember);
            av.AllowPublish = reply.PropertiesData.AllowPublish;
            av.MaturePublish = reply.PropertiesData.MaturePublish;
            av.Identified = reply.PropertiesData.Identified;
            av.Transacted = reply.PropertiesData.Transacted;
            av.ProfileURL = Helpers.FieldToString(reply.PropertiesData.ProfileURL);
            //reassign in the cache
            Avatars[av.ID] = av;
            //Heaven forbid that we actually get a packet we didn't ask for.
            if (AvatarPropertiesCallbacks.ContainsKey(av.ID) && AvatarPropertiesCallbacks[av.ID] != null)
                AvatarPropertiesCallbacks[av.ID](av);
            }
        }
Example #28
0
        /// <summary>
        /// Update agents profile interests
        /// </summary>
        /// <param name="interests">selection of interests from <seealso cref="T:libsecondlife.Avatar.Interests"/> struct</param>
        public void UpdateInterests(Avatar.Interests interests)
        {
            AvatarInterestsUpdatePacket aiup = new AvatarInterestsUpdatePacket();
            aiup.AgentData.AgentID = id;
            aiup.AgentData.SessionID = sessionID;
            aiup.PropertiesData.LanguagesText = Helpers.StringToField(interests.LanguagesText);
            aiup.PropertiesData.SkillsMask = interests.SkillsMask;
            aiup.PropertiesData.SkillsText = Helpers.StringToField(interests.SkillsText);
            aiup.PropertiesData.WantToMask = interests.WantToMask;
            aiup.PropertiesData.WantToText = Helpers.StringToField(interests.WantToText);

            Client.Network.SendPacket(aiup);
        }
        private void AvatarStatisticsHandler(Packet packet, Simulator simulator)
        {
            AvatarStatisticsReplyPacket asr = (AvatarStatisticsReplyPacket)packet;
            lock(Avatars)
            {
            Avatar av;
            if (!Avatars.ContainsKey(asr.AvatarData.AvatarID))
            {
             av = new Avatar();
             av.ID = asr.AvatarData.AvatarID;
            }
            else
            {
             av = Avatars[asr.AvatarData.AvatarID];
            }

                foreach(AvatarStatisticsReplyPacket.StatisticsDataBlock b in asr.StatisticsData)
            {
            string n = Helpers.FieldToString(b.Name);
            if(n.Equals("Behavior"))
            {
                av.Behavior = b.Positive;
            }
            else if(n.Equals("Appearance"))
            {
                av.Appearance = b.Positive;
            }
            else if(n.Equals("Building"))
            {
                av.Building = b.Positive;
            }
            }

            //Call it
            if (AvatarStatisticsCallbacks.ContainsKey(av.ID) && AvatarStatisticsCallbacks[av.ID] != null)
                    AvatarStatisticsCallbacks[av.ID](av);
            }
        }
Example #30
0
        private void SetProfileProperties(Avatar.AvatarProperties properties)
        {
            txtBornOn.Text = properties.BornOn;
            if (properties.Partner != LLUUID.Zero) client.Avatars.RequestAvatarName(properties.Partner);

            if (fullName.EndsWith("Linden")) rtbAccountInfo.AppendText("Linden Lab Employee\n");
            if (properties.Identified) rtbAccountInfo.AppendText("Identified\n");
            if (properties.Transacted) rtbAccountInfo.AppendText("Transacted\n");

            rtbAbout.AppendText(properties.AboutText);

            txtWebURL.Text = properties.ProfileURL;
            btnWebView.Enabled = btnWebOpen.Enabled = (txtWebURL.TextLength > 0);

            rtbAboutFL.AppendText(properties.FirstLifeText);
        }
Example #31
0
 public bool TryGetAvatar(uint avatarLocalID, out Avatar avatar)
 {
     return(Avatars.TryGetValue(avatarLocalID, out avatar));
 }