public void ObjectUpdateHandler(Packet packet, Simulator simulator)
        {
            uint id = 0;
            LLUUID uuid = null;

            if (WaitingOnUpdate)
            {
                CurrentPrimMutex.WaitOne();

                foreach (Block block in packet.Blocks())
                {
                    foreach (Field field in block.Fields)
                    {
                        if (field.Layout.Name == "ID")
                        {
                            id = (uint)field.Data;
                        }
                        else if (field.Layout.Name == "FullID")
                        {
                            uuid = (LLUUID)field.Data;
                        }
                        else if (field.Layout.Name == "ObjectData")
                        {
                            byte[] byteArray = (byte[])field.Data;
                            LLVector3 position = new LLVector3(byteArray, 0);
                            if (CurrentPrim != null && position != CurrentPrim.Position)
                            {
                                txtLog.AppendText(position.ToString() + " doesn't match CurrentPrim.Position " +
                                    CurrentPrim.Position.ToString() + "\n"/* + ", ignoring"*/);
                                //return;
                            }
                        }
                    }
                }

                CurrentPrim.ID = id;
                CurrentPrim.UUID = uuid;

                WaitingOnUpdate = false;

                CurrentPrimMutex.ReleaseMutex();
            }
        }
Ejemplo n.º 2
0
        public void VectorQuaternionMath()
        {
            // Convert a vector to a quaternion and back
            LLVector3 a = new LLVector3(1f, 0.5f, 0.75f);
            LLQuaternion b = a.ToQuaternion();
            LLVector3 c;
            b.GetEulerAngles(out c.X, out c.Y, out c.Z);

            Assert.IsTrue(a == c, c.ToString() + " does not equal " + a.ToString());
        }
Ejemplo n.º 3
0
        private void Self_OnInstantMessage(LLUUID fromAgentID, string fromAgentName, LLUUID toAgentID, 
            uint parentEstateID, LLUUID regionID, LLVector3 position, MainAvatar.InstantMessageDialog dialog, 
            bool groupIM, LLUUID imSessionID, DateTime timestamp, string message, 
            MainAvatar.InstantMessageOnline offline, byte[] binaryBucket)
        {
            if (MasterKey != LLUUID.Zero)
            {
                if (fromAgentID != MasterKey)
                {
                    // Received an IM from someone that is not the bot's master, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not master): " + message + "@"  + regionID.ToString() + ":" + position.ToString() );
                    return;
                }
            }
            else
            {
                if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID))
                {
                    // Received an IM from someone outside the bot's group, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not in group): " + message + "@" + regionID.ToString() + ":" + position.ToString());
                    return;
                }
            }

            Console.WriteLine("<IM>" + fromAgentName + ": " + message);

            if (dialog == MainAvatar.InstantMessageDialog.RequestTeleport)
            {
                Console.WriteLine("Accepting teleport lure.");
                Self.TeleportLureRespond(fromAgentID, true);
            }
            else
            {
                if (dialog == MainAvatar.InstantMessageDialog.InventoryOffered)
                {
                    Console.WriteLine("Accepting inventory offer.");

                    Self.InstantMessage(Self.FirstName + " " + Self.LastName, fromAgentID, String.Empty,
                        imSessionID, MainAvatar.InstantMessageDialog.InventoryAccepted,
                        MainAvatar.InstantMessageOnline.Offline, Self.Position, LLUUID.Zero,
                        Self.InventoryRootFolderUUID.GetBytes());
                }
                else
                {
                    DoCommand(message, fromAgentID, imSessionID);
                }
            }
        }
        private void Self_OnInstantMessage(LLUUID fromAgentID, string fromAgentName, LLUUID toAgentID, uint parentEstateID, 
            LLUUID regionID, LLVector3 position, byte dialog, bool groupIM, LLUUID imSessionID, DateTime timestamp,
            string message, byte offline, byte[] binaryBucket)
        {
            if (Master.Length > 0)
            {
                if (fromAgentName.ToLower().Trim() != Master.ToLower().Trim())
                {
                    // Received an IM from someone that is not the bot's master, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not master): " + message + "@"  + regionID.ToString() + ":" + position.ToString() );
                    return;
                }
            }
            else
            {
                if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID))
                {
                    // Received an IM from someone outside the bot's group, ignore
                    Console.WriteLine("<IM>" + fromAgentName + " (not in group): " + message + "@" + regionID.ToString() + ":" + position.ToString());
                    return;
                }
            }

            Console.WriteLine("<IM>" + fromAgentName + ": " + message);

            if (Self.ID == toAgentID)
            {
                if (dialog == 22)
                {
                    Console.WriteLine("Accepting teleport lure");
                    Self.TeleportLureRespond(fromAgentID, true);
                }
                else
                {
                    DoCommand(message, fromAgentID, imSessionID);
                }
            }
            else
            {
                // This shouldn't happen
                Console.WriteLine("A bot that we aren't tracking received an IM?");
            }
        }