Exemplo n.º 1
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return(ShowUsage());
            }

            List <SimObject> PS;

            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return(Failure("Cannot find objects from " + args.GetString("targets")));
            }
            foreach (var o in PS)
            {
                //SimObject o = WorldSystem.GetSimObject(currentPrim);
                Primitive.ObjectProperties Properties = o.Properties;
                if (Properties == null)
                {
                    Failure("Still waiting on properties for " + o);
                    continue;
                }
                GridClient client = TheBotClient;
                client.Objects.BuyObject(o.GetSimulator(), o.LocalID, Properties.SaleType,
                                         Properties.SalePrice, client.Self.ActiveGroup,
                                         client.Inventory.FindFolderForType(AssetType.Object));
                AddSuccess(Name + " on " + o);
            }
            return(SuccessOrFailure());
        }
Exemplo n.º 2
0
 void Objects_OnObjectPropertiesFamily(Simulator simulator, Primitive.ObjectProperties properties,
                                       ReportType type)
 {
     Properties.SetFamilyProperties(properties);
     GotPermissions = true;
     GotPermissionsEvent.Set();
 }
Exemplo n.º 3
0
        void Objects_OnObjectProperties(Simulator simulator, Primitive.ObjectProperties props)
        {
            string id = props.ObjectID.ToString();

            addObjects.Start();
            addObjects.Enqueue(new ThreadStart(() =>
            {
                Invoke(
                    new MethodInvoker(
                        delegate()
                {
                    lock (lstPrims.Items)
                    {
                        if (lstPrims.Items.ContainsKey(id))
                        {
                            SimObject prim          = lstPrims.Items[id].Tag as SimObject;
                            lstPrims.Items[id].Text = GetObjectName(prim);
                        }
                    }
                    if (currentPrim != null && props.ObjectID == currentPrim.ID)
                    {
                        UpdateCurrentObject();
                    }
                }));
                return;
            }));
        }
Exemplo n.º 4
0
 void Objects_OnObjectPropertiesFamily(object sender, ObjectPropertiesFamilyEventArgs e)
 {
     Properties = new Primitive.ObjectProperties();
     Properties.SetFamilyProperties(e.Properties);
     GotPermissions = true;
     GotPermissionsEvent.Set();
 }
Exemplo n.º 5
0
        public PermissionWho EffectivePermissionWho(SimObject exportPrim)
        {
            if (WorldSystem.AssumeOwner)
            {
                return(PermissionWho.Owner);
            }
            Primitive.ObjectProperties permProps = exportPrim.Properties;
            Primitive prim          = exportPrim.Prim;
            UUID      objectGroupID = UUID.Zero;
            UUID      ownerID       = UUID.Zero;
            PrimFlags flag          = PrimFlags.None;

            if (prim != null)
            {
                objectGroupID = prim.GroupID;
                ownerID       = prim.OwnerID;
                flag          = prim.Flags;
            }
            else if (permProps != null)
            {
                objectGroupID = permProps.GroupID;
                ownerID       = permProps.OwnerID;
            }
            bool groupOwned = (flag & PrimFlags.ObjectGroupOwned) != 0;

            //  bool groupOwned = (flag & PrimFlags.) != 0;
            return(EffectivePermissionWho(ownerID, objectGroupID, groupOwned));
        }
Exemplo n.º 6
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return(ShowUsage());
            }
            SimObject o;

            if (!args.TryGetValue("target", out o))
            {
                return(Failure(string.Format("Cant find {0}", args.str)));
            }
            bool      isObject    = !(o is SimAvatar);
            UUID      target      = o.ID;
            Primitive currentPrim = o.Prim;

            if (currentPrim == null)
            {
                return(Failure(string.Format("No Prim localId for {0}", args.str)));
            }
            Primitive.ObjectProperties props = o.Properties;
            WorldObjects.EnsureSelected(currentPrim, WorldSystem.GetSimulator(currentPrim));
            if (props == null)
            {
                return(Failure("no props on " + o + " yet try again"));
            }
            GridClient client = TheBotClient;
            string     strA;

            if (!args.TryGetValue("ammount", out strA))
            {
                return(Success(string.Format("saletype {0} {1} {2}", o.ID, props.SalePrice, props.SaleType)));
            }
            int amount;

            strA = strA.Replace("$", "").Replace("L", "");
            if (!int.TryParse(strA, out amount))
            {
                return(Failure("Cant determine amount from: " + strA));
            }
            SaleType saletype;

            if (!args.TryGetValue("saletype", out saletype))
            {
                saletype = SaleType.Original;
                //return Failure("Cant determine SaleType: " + strA);
            }

            WriteLine("Setting Ammount={0} SaleType={1} for {2}", saletype, amount, o);
            TheBotClient.Objects.SetSaleInfo(WorldSystem.GetSimulator(currentPrim), currentPrim.LocalID, saletype,
                                             amount);

            return(Success(Name + " on " + o));
        }
Exemplo n.º 7
0
        //the scripting language might supply a number as a parameter in a foriegn method call, so when i iterate thru the method signatures.. i have to recognise which ones are claiming to accept a numeric argument
        static public List <SimObjectType> GuessSimObjectTypes(Primitive.ObjectProperties props, SimObject obj)
        {
            List <SimObjectType> possibles = obj.Affordances.ObjectType.SuperType;

            if (props != null)
            {
                LockInfo.WeaklyLock(possibles, TimeSpan.FromSeconds(10),
                                    () => DoGuessWork(props, obj, possibles),
                                    () => "Guess Sim Object Types for " + obj, DLRConsole.DebugWriteLine);
            }
            return(possibles);
        }
Exemplo n.º 8
0
        void Objects_OnObjectProperties(Simulator simulator, Primitive.ObjectProperties properties)
        {
            lock (PrimsWaiting)
            {
                PrimsWaiting.Remove(properties.ObjectID);

                if (PrimsWaiting.Count == 0)
                {
                    AllPropertiesReceived.Set();
                }
            }
        }
        private void SnagUsers(SimObject o)
        {
            var prim = o.Prim;

            AddExportUser(prim.OwnerID);
            AddExportGroup(prim.GroupID);
            Primitive.ObjectProperties primProperties = prim.Properties ?? o.Properties;
            if (primProperties != null)
            {
                AddExportUser(primProperties.CreatorID);
                AddExportGroup(primProperties.GroupID);
            }
        }
Exemplo n.º 10
0
 void Objects_OnObjectPropertiesFamily(object sender, ObjectPropertiesFamilyEventArgs e)
 {
     Properties = new Primitive.ObjectProperties();
     Properties.SetFamilyProperties(e.Properties);
     if (e.Properties.CreatorID == UUID.Zero)
     {
         Client.Objects.SelectObject(Client.Network.CurrentSim, uLocalID);
     }
     else
     {
         GotPermissions = true;
         GotPermissionsEvent.Set();
     }
 }
Exemplo n.º 11
0
        private void Objects_OnObjectProperties(Simulator simulator, Primitive.ObjectProperties properties)
        {
            if (PermsSent)
            {
                if (Objects.ContainsKey(properties.ObjectID))
                {
                    // FIXME: Confirm the current operation against properties.Permissions.GroupMask

                    ++PermCount;
                    //   if (PermCount >= Objects.Count)
                    //      GotPermissionsEvent.Set();
                }
            }
        }
Exemplo n.º 12
0
        void Objects_OnObjectProperties(Simulator simulator, Primitive.ObjectProperties properties)
        {
            lock (PrimsWaiting) {
                Primitive prim;
                if (PrimsWaiting.TryGetValue(properties.ObjectID, out prim))
                {
                    prim.Properties = properties;
                }
                PrimsWaiting.Remove(properties.ObjectID);

                if (PrimsWaiting.Count == 0)
                {
                    AllPropertiesReceived.Set();
                }
            }
        }
Exemplo n.º 13
0
        void Objects_OnObjectProperties(Simulator simulator, Primitive.ObjectProperties props)
        {
            Primitive prim;

            if (prims.TryGetValue(props.ObjectID, out prim))
            {
                if (Program.Verbosity > 2)
                {
                    Logger.Log("Received properties for " + props.ObjectID.ToString(), Helpers.LogLevel.Info);
                }

                lock (prim)
                    prim.Properties = props;
            }
            else
            {
                Logger.Log("Received object properties for untracked object " + props.ObjectID.ToString(),
                           Helpers.LogLevel.Warning);
            }
        }
Exemplo n.º 14
0
        private void Objects_OnObjectPropertiesFamily(Simulator simulator, Primitive.ObjectProperties properties, ReportType type)
        {
            if (properties.ObjectID != prim.ID)
            {
                return;
            }

            try
            {
                gettingProperties = false;
                gotProperties     = true;
                prim.Properties   = properties;

                listBox.BeginInvoke(
                    new OnPropReceivedRaise(OnPropertiesReceived),
                    new object[] { EventArgs.Empty });
            }
            catch (Exception exp)
            {
                string sex = exp.Message;
            }
        }
Exemplo n.º 15
0
        //static public string GetPrimTypeName(Primitive target)
        //{
        //    if (target.PrimData.PCode == PCode.Prim)
        //        return target.PrimData.Type.ToString();
        //    return target.PrimData.PCode.ToString();
        //}

        static private void SetNames(Primitive.ObjectProperties props, SimObjectType otype)
        {
            //= prim.Properties;
            if (props != null)
            {
                //      Primitive prim = null;
                if (String.IsNullOrEmpty(props.SitName))
                {
                    props.SitName = otype.GetSitName();
                    if (!String.IsNullOrEmpty(props.SitName))
                    {
                        // DLRConsole.WriteLine("[TODO] SetSitName(" + prim + "," + otype.GetSitName());
                    }
                }
                if (String.IsNullOrEmpty(props.TouchName))
                {
                    props.TouchName = otype.GetTouchName();
                    if (!String.IsNullOrEmpty(props.TouchName))
                    {
                        //  DLRConsole.WriteLine("[TODO] SetTextName(" + prim + "," + otype.GetTouchName());
                    }
                }
            }
        }
Exemplo n.º 16
0
 void Objects_OnObjectPropertiesFamily(object sender, ObjectPropertiesFamilyEventArgs e)
 {
     Properties = new Primitive.ObjectProperties();
     Properties.SetFamilyProperties(e.Properties);
     if (e.Properties.CreatorID == UUID.Zero)
     {
         Client.Objects.SelectObject(Client.Network.CurrentSim,uLocalID);
     }
     else
     {
         GotPermissions = true;
         GotPermissionsEvent.Set();
     }
 }
 public void Objects_OnObjectProperties11(Simulator simulator, Primitive prim, Primitive.ObjectProperties props)
 {
     //Primitive prim = GetPrimitive(props.ObjectID, simulator);
     if (prim == null)
     {
         prim = GetPrimitive(props.ObjectID, simulator);
     }
     DeclareProperties(prim, props, simulator);
     if (prim != null)
     {
         prim.RegionHandle = simulator.Handle;
         SimObject updateMe = GetSimObject(prim, simulator);
         if (updateMe == null)
         {
             return;
         }
         if (prim.ParentID == 0 && !SimRegion.OutOfRegion(prim.Position))
         {
             updateMe.ResetPrim(prim, client, simulator);
         }
         if (MaintainObjectProperties)
         {
             //updateMe.Properties = null;
             updateMe.Properties = (props);
         }
         //Debug("UpdateProperties: {0}", updateMe.DebugInfo());
         describePrimToAI(prim, simulator);
     }
 }
Exemplo n.º 18
0
        public void CheckPropsForGameComponents(Primitive.ObjectProperties props)
        {
            if (props.CreatorID != creatorId)
            {
                return;
            }

            if (HasFoundAllGameComponents())
            {
                return;
            }

            if (props.Name == "Dice")
            {
                if (props.Description == "1,3;2,0;3,1")
                {
                    diceLeftId = props.ObjectID;
                }
                else if (props.Description == "4,3;5,0;6,1")
                {
                    diceRightId = props.ObjectID;
                }
            }
            else if (props.Name == "Action Buttons")
            {
                gameButtonsId = props.ObjectID;
            }
            else if (props.Name == "PointsDisplay")
            {
                scoreId = props.ObjectID;
            }
            else if (props.Name == "Player Light")
            {
                if (props.Description.Length == 0)
                {
                    return;
                }

                int seatId = props.Description[0] - '0';
                if (seatId < 1 || seatId > 8)
                {
                    return;
                }

                playerLightIds[seatId - 1] = props.ObjectID;
            }
            else if (props.Name.StartsWith("Game Player"))
            {
                if (props.Description.Length == 0)
                {
                    return;
                }

                int seatId = props.Description[0] - '0';
                if (seatId < 1 || seatId > 8)
                {
                    return;
                }

                if (props.Name == "Game Player (" + GreedyBotPlugin.Instance.Client.Self.Name + ")")
                {
                    PlayerIndex = seatId - 1;
                    Utils.OutputLine("CheckPropsForGameComponents: We're player #" + PlayerIndex, Utils.OutputLevel.Game);
                }
                else if (props.Name != "Game Player (empty)")
                {
                }
                else
                {
                }
                Utils.OutputLine("Update player seat #" + seatId + " -> " + props.Name, Utils.OutputLevel.Game);

                playerSeatIds[seatId - 1] = props.ObjectID;
            }
        }
Exemplo n.º 19
0
        protected void ObjectPropertiesFamilyHandler(Packet p, Simulator sim)
        {
            ObjectPropertiesFamilyPacket op = (ObjectPropertiesFamilyPacket)p;
            Primitive.ObjectProperties props = new Primitive.ObjectProperties();

            ReportType requestType = (ReportType)op.ObjectData.RequestFlags;

            props.ObjectID = op.ObjectData.ObjectID;
            props.Category = (ObjectCategory)op.ObjectData.Category;
            props.Description = Utils.BytesToString(op.ObjectData.Description);
            props.GroupID = op.ObjectData.GroupID;
            props.LastOwnerID = op.ObjectData.LastOwnerID;
            props.Name = Utils.BytesToString(op.ObjectData.Name);
            props.OwnerID = op.ObjectData.OwnerID;
            props.OwnershipCost = op.ObjectData.OwnershipCost;
            props.SalePrice = op.ObjectData.SalePrice;
            props.SaleType = (SaleType)op.ObjectData.SaleType;
            props.Permissions.BaseMask = (PermissionMask)op.ObjectData.BaseMask;
            props.Permissions.EveryoneMask = (PermissionMask)op.ObjectData.EveryoneMask;
            props.Permissions.GroupMask = (PermissionMask)op.ObjectData.GroupMask;
            props.Permissions.NextOwnerMask = (PermissionMask)op.ObjectData.NextOwnerMask;
            props.Permissions.OwnerMask = (PermissionMask)op.ObjectData.OwnerMask;

            if (ObjectTracking)
            {
                Primitive findPrim = sim.ObjectsPrimitives.Find(
                        delegate(Primitive prim) { return prim.ID == op.ObjectData.ObjectID; });

                if (findPrim != null)
                {
                    lock (sim.ObjectsPrimitives.Dictionary)
                    {
                        if (sim.ObjectsPrimitives.Dictionary.ContainsKey(findPrim.LocalID))
                        {
                            if (sim.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties == null)
                                sim.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties = new Primitive.ObjectProperties();
                            sim.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties.SetFamilyProperties(props);
                        }
                    }
                }
            }

            FireOnObjectPropertiesFamily(sim, props, requestType);
        }
        public static void WriteShape(XmlTextWriter writer, Primitive prim, Primitive.ObjectProperties props, Primitive.ConstructionData shp, ImportSettings options)
        {
            if (true /*shp != null*/)
            {
                writer.WriteStartElement("Shape");

                WriteEnum(writer, "ProfileCurve", shp.ProfileCurve);

                writer.WriteStartElement("TextureEntry");
                byte[] te;
                if (prim.Textures != null)
                {
                    te = prim.Textures.GetBytes();
                }
                else
                {
                    te = Utils.EmptyBytes;
                }
                writer.WriteBase64(te, 0, te.Length);
                writer.WriteEndElement(); // TextureEntry

                writer.WriteStartElement("ExtraParams");
                byte[] ep;
                if (prim.GetExtraParamsBytes() != null)
                {
                    ep = prim.GetExtraParamsBytes();
                }
                else
                {
                    ep = Utils.EmptyBytes;
                }
                writer.WriteBase64(ep, 0, ep.Length);
                writer.WriteEndElement(); // ExtraParams

                writer.WriteElementString("PathBegin", Primitive.PackBeginCut(shp.PathBegin).ToString());
                WriteEnum(writer, "PathCurve", shp.PathCurve);
                writer.WriteElementString("PathEnd", Primitive.PackEndCut(shp.PathEnd).ToString());
                writer.WriteElementString("PathRadiusOffset", Primitive.PackPathTwist(shp.PathRadiusOffset).ToString());
                writer.WriteElementString("PathRevolutions", Primitive.PackPathRevolutions(shp.PathRevolutions).ToString());
                writer.WriteElementString("PathScaleX", Primitive.PackPathScale(shp.PathScaleX).ToString());
                writer.WriteElementString("PathScaleY", Primitive.PackPathScale(shp.PathScaleY).ToString());
                writer.WriteElementString("PathShearX", ((byte)Primitive.PackPathShear(shp.PathShearX)).ToString());
                writer.WriteElementString("PathShearY", ((byte)Primitive.PackPathShear(shp.PathShearY)).ToString());
                writer.WriteElementString("PathSkew", Primitive.PackPathTwist(shp.PathSkew).ToString());
                writer.WriteElementString("PathTaperX", Primitive.PackPathTaper(shp.PathTaperX).ToString());
                writer.WriteElementString("PathTaperY", Primitive.PackPathTaper(shp.PathTaperY).ToString());
                writer.WriteElementString("PathTwist", Primitive.PackPathTwist(shp.PathTwist).ToString());
                writer.WriteElementString("PathTwistBegin", Primitive.PackPathTwist(shp.PathTwistBegin).ToString());
                writer.WriteElementString("ProfileBegin", Primitive.PackBeginCut(shp.ProfileBegin).ToString());
                writer.WriteElementString("ProfileEnd", Primitive.PackEndCut(shp.ProfileEnd).ToString());
                writer.WriteElementString("ProfileHollow", Primitive.PackProfileHollow(shp.ProfileHollow).ToString());

                WriteEnum(writer, "PCode", shp.PCode);

                // this is Attachment in a way?
                WriteInt(writer, "State", shp.State);
                //WriteEnum(writer, "State", shp.AttachmentPoint);

                WriteFlags(writer, "ProfileShape", shp.ProfileCurve, options);
                WriteFlags(writer, "HollowShape", shp.ProfileHole, options);

                var Sculpt = prim.Sculpt;
                if (Sculpt != null)
                {
                    WriteUUID(writer, "SculptTexture", Sculpt.SculptTexture, options);
                    WriteEnum(writer, "SculptType", Sculpt.Type);
                    writer.WriteStartElement("SculptData");
                    byte[] sd;
                    if (prim.Sculpt != null)
                    {
                        sd = Sculpt.GetBytes();
                    }
                    else
                    {
                        sd = Utils.EmptyBytes;
                    }
                    writer.WriteBase64(sd, 0, sd.Length);
                    writer.WriteEndElement(); // SculptData
                }

                Primitive.FlexibleData Flexi = prim.Flexible;
                if (Flexi != null)
                {
                    WriteInt(writer, "FlexiSoftness", Flexi.Softness);
                    WriteFloat(writer, "FlexiTension", Flexi.Tension);
                    WriteFloat(writer, "FlexiDrag", Flexi.Drag);
                    WriteFloat(writer, "FlexiGravity", Flexi.Gravity);
                    WriteFloat(writer, "FlexiWind", Flexi.Wind);
                    WriteFloat(writer, "FlexiForceX", Flexi.Force.X);
                    WriteFloat(writer, "FlexiForceY", Flexi.Force.Y);
                    WriteFloat(writer, "FlexiForceZ", Flexi.Force.Z);
                }

                Primitive.LightData Light = prim.Light;
                if (Light != null)
                {
                    WriteFloat(writer, "LightColorR", Light.Color.R);
                    WriteFloat(writer, "LightColorG", Light.Color.G);
                    WriteFloat(writer, "LightColorB", Light.Color.B);
                    WriteFloat(writer, "LightColorA", Light.Color.A);
                    WriteFloat(writer, "LightRadius", Light.Radius);
                    WriteFloat(writer, "LightCutoff", Light.Cutoff);
                    WriteFloat(writer, "LightFalloff", Light.Falloff);
                    WriteFloat(writer, "LightIntensity", Light.Intensity);
                }

                WriteValue(writer, "FlexiEntry", (Flexi != null).ToString().ToLower());
                WriteValue(writer, "LightEntry", (Light != null).ToString().ToLower());
                WriteValue(writer, "SculptEntry", (Sculpt != null).ToString().ToLower());

                //todo if (shp.Media != null) WES(writer,"Media", shp.Media.ToXml());

                writer.WriteEndElement(); // Shape
            }
        }
Exemplo n.º 21
0
 void Objects_OnObjectPropertiesFamily(object sender, ObjectPropertiesFamilyEventArgs e)
 {
     Properties = new Primitive.ObjectProperties();
     Properties.SetFamilyProperties(e.Properties);
     GotPermissions = true;
     GotPermissionsEvent.Set();
 }
Exemplo n.º 22
0
 /// <summary>
 /// Construct a new instance of the ObjectPropertiesUpdatedEvenrArgs class
 /// </summary>                
 /// <param name="simulator">The simulator the object is located</param>
 /// <param name="prim">The Primitive</param>
 /// <param name="props">The primitive Properties</param>
 public ObjectPropertiesUpdatedEventArgs(Simulator simulator, Primitive prim, Primitive.ObjectProperties props)
 {
     this.m_Simulator = simulator;
     this.m_Prim = prim;
     this.m_Properties = props;
 }
Exemplo n.º 23
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void ObjectPropertiesHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            Simulator simulator = e.Simulator;

            ObjectPropertiesPacket op = (ObjectPropertiesPacket)packet;
            ObjectPropertiesPacket.ObjectDataBlock[] datablocks = op.ObjectData;

            for (int i = 0; i < datablocks.Length; ++i)
            {
                ObjectPropertiesPacket.ObjectDataBlock objectData = datablocks[i];
                Primitive.ObjectProperties props = new Primitive.ObjectProperties();

                props.ObjectID = objectData.ObjectID;
                props.AggregatePerms = objectData.AggregatePerms;
                props.AggregatePermTextures = objectData.AggregatePermTextures;
                props.AggregatePermTexturesOwner = objectData.AggregatePermTexturesOwner;
                props.Permissions = new Permissions(objectData.BaseMask, objectData.EveryoneMask, objectData.GroupMask,
                    objectData.NextOwnerMask, objectData.OwnerMask);
                props.Category = (ObjectCategory)objectData.Category;
                props.CreationDate = Utils.UnixTimeToDateTime((uint)objectData.CreationDate);
                props.CreatorID = objectData.CreatorID;
                props.Description = Utils.BytesToString(objectData.Description);
                props.FolderID = objectData.FolderID;
                props.FromTaskID = objectData.FromTaskID;
                props.GroupID = objectData.GroupID;
                props.InventorySerial = objectData.InventorySerial;
                props.ItemID = objectData.ItemID;
                props.LastOwnerID = objectData.LastOwnerID;
                props.Name = Utils.BytesToString(objectData.Name);
                props.OwnerID = objectData.OwnerID;
                props.OwnershipCost = objectData.OwnershipCost;
                props.SalePrice = objectData.SalePrice;
                props.SaleType = (SaleType)objectData.SaleType;
                props.SitName = Utils.BytesToString(objectData.SitName);
                props.TouchName = Utils.BytesToString(objectData.TouchName);

                int numTextures = objectData.TextureID.Length / 16;
                props.TextureIDs = new UUID[numTextures];
                for (int j = 0; j < numTextures; ++j)
                    props.TextureIDs[j] = new UUID(objectData.TextureID, j * 16);

                if (Client.Settings.OBJECT_TRACKING)
                {
                    Primitive findPrim = simulator.ObjectsPrimitives.Find(
                        delegate(Primitive prim) { return prim.ID == props.ObjectID; });

                    if (findPrim != null)
                    {
                        OnObjectPropertiesUpdated(new ObjectPropertiesUpdatedEventArgs(simulator, findPrim, props));

                        lock (simulator.ObjectsPrimitives.Dictionary)
                        {
                            if (simulator.ObjectsPrimitives.Dictionary.ContainsKey(findPrim.LocalID))
                                simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties = props;
                        }
                    }
                }

                OnObjectProperties(new ObjectPropertiesEventArgs(simulator, props));
            }
        }
Exemplo n.º 24
0
 void Objects_OnObjectPropertiesFamily(Simulator simulator, Primitive.ObjectProperties properties,
     ReportType type)
 {
     Properties = new Primitive.ObjectProperties();
     Properties.SetFamilyProperties(properties);
     GotPermissions = true;
     GotPermissionsEvent.Set();
 }
Exemplo n.º 25
0
        static List <SimObjectType> DoGuessWork(Primitive.ObjectProperties props, SimObject obj, List <SimObjectType> possibles)
        {
            {
                {
                    List <SimObjectType> objectTypesLocally =
                        new List <SimObjectType>();
                    lock (SimTypeSystem.objectTypes)
                        objectTypesLocally.AddRange(SimTypeSystem.objectTypes);
                    foreach (SimObjectType otype in objectTypesLocally)
                    {
                        foreach (Regex smatch in otype.NoMatch)
                        {
                            // NoMatch
                            if (smatch.IsMatch(props.Name.ToLower()) && smatch.IsMatch(props.Description.ToLower()))
                            {
                                goto nextOType;
                            }
                        }
                        foreach (Object smatch in otype.CodeMatch)
                        {
                            // CodeMatch
                            if (IsCodeMatch(obj, smatch))
                            {
                                if (!possibles.Contains(otype))
                                {
                                    possibles.Add(otype);
                                    goto nextOType;
                                }
                            }
                            else
                            {
                                possibles.Remove(otype);
                            }
                        }
                        foreach (Regex smatch in otype.Match)
                        {
                            // Match
                            if (smatch.IsMatch(props.Name.ToLower()) && smatch.IsMatch(props.Description.ToLower()))
                            {
                                if (!possibles.Contains(otype))
                                {
                                    possibles.Add(otype);
                                    SetNames(props, otype);
                                }
                                break;
                            }
                        }
nextOType:
                        {
                        }
                    }
                    if (!String.IsNullOrEmpty(props.TouchName))
                    {
                        string verb = props.TouchName;
                        possibles.Add(SimTypeSystem.CreateObjectUse(verb,
                                                                    new object[]
                        {
                            "UseGrab", true
                            ,
                            "TextName",
                            verb
                        }));
                    }
                    if (!String.IsNullOrEmpty(props.SitName))
                    {
                        string verb = props.SitName;
                        possibles.Add(SimTypeSystem.CreateObjectUse(verb,
                                                                    new object[]
                        {
                            "UseSit", true,
                            "TextName",
                            verb
                        }));
                    }
                    return(possibles);
                }
            }
        }
Exemplo n.º 26
0
        public OSDMap GetOSD()
        {
            Primitive.ConstructionData primData = Prim.PrimData;
            Primitive.ObjectProperties properties = Prim.Properties;

            OSDMap pathMap = new OSDMap();
            pathMap["begin"] = OSD.FromReal(primData.PathBegin);
            pathMap["curve"] = OSD.FromInteger((int)primData.PathCurve);
            pathMap["end"] = OSD.FromReal(primData.PathEnd);
            pathMap["radius_offset"] = OSD.FromReal(primData.PathRadiusOffset);
            pathMap["revolutions"] = OSD.FromReal(primData.PathRevolutions);
            pathMap["scale_x"] = OSD.FromReal(primData.PathScaleX);
            pathMap["scale_y"] = OSD.FromReal(primData.PathScaleY);
            pathMap["shear_x"] = OSD.FromReal(primData.PathShearX);
            pathMap["shear_y"] = OSD.FromReal(primData.PathShearY);
            pathMap["skew"] = OSD.FromReal(primData.PathSkew);
            pathMap["taper_x"] = OSD.FromReal(primData.PathTaperX);
            pathMap["taper_y"] = OSD.FromReal(primData.PathTaperY);
            pathMap["twist"] = OSD.FromReal(primData.PathTwist);
            pathMap["twist_begin"] = OSD.FromReal(primData.PathTwistBegin);

            OSDMap profileMap = new OSDMap();
            profileMap["begin"] = OSD.FromReal(primData.ProfileBegin);
            profileMap["curve"] = OSD.FromInteger((int)primData.ProfileCurve);
            profileMap["hole"] = OSD.FromInteger((int)primData.ProfileHole);
            profileMap["end"] = OSD.FromReal(primData.ProfileEnd);
            profileMap["hollow"] = OSD.FromReal(primData.ProfileHollow);

            OSDMap propertiesMap = new OSDMap();

            if (properties != null)
            {
                propertiesMap["aggregate_perms"] = OSD.FromInteger(properties.AggregatePerms);
                propertiesMap["aggregate_perms_textures"] = OSD.FromInteger(properties.AggregatePermTextures);
                propertiesMap["aggregate_perms_textures_owner"] = OSD.FromInteger(properties.AggregatePermTexturesOwner);
                propertiesMap["category"] = OSD.FromInteger((int)properties.Category);
                propertiesMap["creation_date"] = OSD.FromDate(properties.CreationDate);
                propertiesMap["creator_id"] = OSD.FromUUID(properties.CreatorID);
                propertiesMap["description"] = OSD.FromString(properties.Description);
                propertiesMap["folder_id"] = OSD.FromUUID(properties.FolderID);
                propertiesMap["from_task_id"] = OSD.FromUUID(properties.FromTaskID);
                // properties.GroupID is redundant
                propertiesMap["inventory_serial"] = OSD.FromInteger(properties.InventorySerial);
                propertiesMap["item_id"] = OSD.FromUUID(properties.ItemID);
                propertiesMap["last_owner_id"] = OSD.FromUUID(properties.LastOwnerID);
                propertiesMap["name"] = OSD.FromString(properties.Name);
                // properties.ObjectID is redundant
                // properties.OwnerID is redundant
                propertiesMap["ownership_cost"] = OSD.FromInteger(properties.OwnershipCost);
                propertiesMap["permissions"] = properties.Permissions.GetOSD();
                propertiesMap["sale_price"] = OSD.FromInteger(properties.SalePrice);
                propertiesMap["sale_type"] = OSD.FromInteger((int)properties.SaleType);
                propertiesMap["sit_name"] = OSD.FromString(properties.SitName);
                propertiesMap["touch_name"] = OSD.FromString(properties.TouchName);
            }

            OSDMap primMap = new OSDMap();
            primMap["path"] = pathMap;
            primMap["profile"] = profileMap;
            primMap["properties"] = propertiesMap;

            primMap["acceleration"] = OSD.FromVector3(Prim.Acceleration);
            primMap["ang_velocity"] = OSD.FromVector3(Prim.AngularVelocity);
            primMap["click_action"] = OSD.FromInteger((int)Prim.ClickAction);
            primMap["flags"] = OSD.FromInteger((uint)Prim.Flags);
            primMap["group_id"] = OSD.FromUUID(Prim.GroupID);
            primMap["id"] = OSD.FromUUID(Prim.ID);
            primMap["local_id"] = OSD.FromInteger(Prim.LocalID);
            primMap["media_url"] = OSD.FromString(Prim.MediaURL);
            primMap["owner_id"] = OSD.FromUUID(Prim.OwnerID);
            primMap["parent_id"] = OSD.FromInteger(Prim.ParentID);
            primMap["particles"] = Prim.ParticleSys.GetOSD();
            primMap["position"] = OSD.FromVector3(Prim.Position);
            primMap["rotation"] = OSD.FromQuaternion(Prim.Rotation);
            primMap["scale"] = OSD.FromVector3(Prim.Scale);
            primMap["scratch_pad"] = OSD.FromBinary(Prim.ScratchPad);
            primMap["sound"] = OSD.FromUUID(Prim.Sound);
            primMap["sound_flags"] = OSD.FromInteger((int)Prim.SoundFlags);
            primMap["sound_gain"] = OSD.FromReal(Prim.SoundGain);
            primMap["sound_radius"] = OSD.FromReal(Prim.SoundRadius);
            primMap["text"] = OSD.FromString(Prim.Text);
            primMap["text_color"] = OSD.FromColor4(Prim.TextColor);
            primMap["texture_anim"] = Prim.TextureAnim.GetOSD();
            primMap["tree_species"] = OSD.FromInteger((int)Prim.TreeSpecies);
            primMap["velocity"] = OSD.FromVector3(Prim.Velocity);

            primMap["material"] = OSD.FromInteger((int)primData.Material);
            primMap["state"] = OSD.FromInteger(primData.State);
            primMap["pcode"] = OSD.FromInteger((int)primData.PCode);

            if (Prim.NameValues != null)
                primMap["name_values"] = OSD.FromString(NameValue.NameValuesToString(Prim.NameValues));
            if (Prim.Textures != null)
                primMap["textures"] = Prim.Textures.GetOSD();
            if (Prim.Light != null)
                primMap["light"] = Prim.Light.GetOSD();
            if (Prim.Flexible != null)
                primMap["flex"] = Prim.Flexible.GetOSD();
            if (Prim.Sculpt != null)
                primMap["sculpt"] = Prim.Sculpt.GetOSD();

            OSDMap map = new OSDMap();
            map["prim"] = primMap;
            map["sit_position"] = OSD.FromVector3(SitPosition);
            map["sit_rotation"] = OSD.FromQuaternion(SitRotation);
            map["attachment_position"] = OSD.FromVector3(AttachmentPosition);
            map["attachment_rotation"] = OSD.FromQuaternion(AttachmentRotation);
            map["last_attachment_point"] = OSD.FromInteger((int)LastAttachmentPoint);
            map["before_attachment_rotation"] = OSD.FromQuaternion(BeforeAttachmentRotation);
            map["rotation_axis"] = OSD.FromVector3(m_rotationAxis);
            map["link_number"] = OSD.FromInteger(m_linkNumber);
            map["remote_script_access_pin"] = OSD.FromInteger(RemoteScriptAccessPIN);
            map["inventory"] = OSD.FromString(Inventory.GetTaskInventoryAsset());

            OSDArray buttons = new OSDArray { 
                OSD.FromInteger(PayPriceButtons[0]),
                OSD.FromInteger(PayPriceButtons[1]),
                OSD.FromInteger(PayPriceButtons[2]),
                OSD.FromInteger(PayPriceButtons[3])
            };

            map["pay_price_buttons"] = buttons;
            map["pay_price"] = OSD.FromInteger(PayPrice);

            if (Prim.FaceMedia != null)
            {
                OSDArray faceMedia = new OSDArray(Prim.FaceMedia.Length);
                for (int i = 0; i < Prim.FaceMedia.Length; i++)
                {
                    MediaEntry entry = Prim.FaceMedia[i];
                    if (entry != null)
                        faceMedia.Add(entry.GetOSD());
                    else
                        faceMedia.Add(new OSD());
                }
                map["face_media"] = faceMedia;
            }
            map["media_version"] = OSD.FromString(Prim.MediaVersion);

            map["last_updated"] = OSD.FromDate(m_lastUpdated);

            return map;
        }
        private void DeclareProperties(Primitive prim0, Primitive.ObjectProperties props, Simulator simulator)
        {
            if (props == null)
            {
                return;
            }
            if (prim0 != null)
            {
                bool go = PrimFlags.ObjectGroupOwned == (prim0.Flags & PrimFlags.ObjectGroupOwned);
                if (go && UUID.Zero != props.OwnerID)
                {
                    DeclareAvatarProfile(props.OwnerID);
                }
            }
            string debugInfo = "" + prim0;

            DeclareGroup(props.GroupID);

            if (UUID.Zero != props.OwnerID)
            {
                DeclareAvatarProfile(props.OwnerID);
            }
            if (UUID.Zero != props.LastOwnerID)
            {
                DeclareAvatarProfile(props.LastOwnerID);
            }
            if (UUID.Zero != props.FolderID)
            {
                if (ZeroOutUselessUUIDs)
                {
                    props.FolderID = UUID.Zero;
                }
                //DeclareGeneric("Folder", props.FolderID, debugInfo);
            }

            if (UUID.Zero != props.ItemID)
            {
                if (ZeroOutUselessUUIDs)
                {
                    props.ItemID = UUID.Zero;
                }
                //DeclareGeneric("Item", props.ItemID, debugInfo);
            }


            if (UUID.Zero != props.FromTaskID && client.Self.AgentID != props.FromTaskID)
            {
                if (DeclareTask(props.FromTaskID, simulator) == null)
                {
                    if (ZeroOutUselessUUIDs)
                    {
                        props.FromTaskID = UUID.Zero;
                    }
                }
            }

            var tids = props.TextureIDs;

            if (tids != null)
            {
                foreach (UUID tid in tids)
                {
                    DeclareTexture(tid);
                }
            }
        }
Exemplo n.º 28
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void ObjectPropertiesFamilyHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            Simulator simulator = e.Simulator;

            ObjectPropertiesFamilyPacket op = (ObjectPropertiesFamilyPacket)packet;
            Primitive.ObjectProperties props = new Primitive.ObjectProperties();

            ReportType requestType = (ReportType)op.ObjectData.RequestFlags;

            props.ObjectID = op.ObjectData.ObjectID;
            props.Category = (ObjectCategory)op.ObjectData.Category;
            props.Description = Utils.BytesToString(op.ObjectData.Description);
            props.GroupID = op.ObjectData.GroupID;
            props.LastOwnerID = op.ObjectData.LastOwnerID;
            props.Name = Utils.BytesToString(op.ObjectData.Name);
            props.OwnerID = op.ObjectData.OwnerID;
            props.OwnershipCost = op.ObjectData.OwnershipCost;
            props.SalePrice = op.ObjectData.SalePrice;
            props.SaleType = (SaleType)op.ObjectData.SaleType;
            props.Permissions.BaseMask = (PermissionMask)op.ObjectData.BaseMask;
            props.Permissions.EveryoneMask = (PermissionMask)op.ObjectData.EveryoneMask;
            props.Permissions.GroupMask = (PermissionMask)op.ObjectData.GroupMask;
            props.Permissions.NextOwnerMask = (PermissionMask)op.ObjectData.NextOwnerMask;
            props.Permissions.OwnerMask = (PermissionMask)op.ObjectData.OwnerMask;

            if (Client.Settings.OBJECT_TRACKING)
            {
                Primitive findPrim = simulator.ObjectsPrimitives.Find(
                        delegate(Primitive prim) { return prim.ID == op.ObjectData.ObjectID; });

                if (findPrim != null)
                {
                    lock (simulator.ObjectsPrimitives.Dictionary)
                    {
                        if (simulator.ObjectsPrimitives.Dictionary.ContainsKey(findPrim.LocalID))
                        {
                            if (simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties == null)
                                simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties = new Primitive.ObjectProperties();
                            simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties.SetFamilyProperties(props);
                        }
                    }
                }
            }

            OnObjectPropertiesFamily(new ObjectPropertiesFamilyEventArgs(simulator, props, requestType));
        }
Exemplo n.º 29
0
        public static bool IsSkipped(SimObject P, ImportSettings settings)
        {
            if (P is SimAvatar)
            {
                return(true);
            }
            if (P == null)
            {
                return(true);
            }
            if (IsIncluded(P.ID, P.LocalID))
            {
                return(false);
            }
            if (P.Parent != null)
            {
                if (IsIncluded(P.Parent.ID, P.ParentID))
                {
                    return(false);
                }
            }
            Primitive pp = P.Prim0;

            if (P.IsKilled)
            {
                if (pp != null)
                {
                    if (P.IsTemporary)
                    {
                        return(true);
                    }
                }
            }
            if (P.IsTemporary)
            {
                return(true);
            }
            if (!P.HasPrim)
            {
                return(true);
            }
            if (pp == null)
            {
                return(true);
            }
            var sp = P.SimPosition;

            if (!onlyObjectAt.IsInside(sp.X, sp.Y, sp.Z))
            {
                return(true);
            }
            Primitive.ObjectProperties props = pp.Properties;
            if (props != null)
            {
                if (IsSkippedName(props.Name))
                {
                    return(true);
                }
            }
            if (pp.ParentID == 0)
            {
                return(false);
            }
            SimObject parent = P.Parent;

            // yes SL really does have links two deep! (called attachment linksets)
            if (parent == null)
            {
                return(true);
            }
            if (parent == P)
            {
                return(false);
            }
            if (!IsSkipped(parent, settings))
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 30
0
 public ObjectPropertiesFamilyEventArgs(Simulator simulator, Primitive.ObjectProperties props, ReportType type)
 {
     this.m_Simulator = simulator;
     this.m_Properties = props;
     this.m_Type = type;
 }
        static void SOPToXml(XmlTextWriter writer, Primitive sop, int linkNum, Primitive parent, ICollection <InventoryBase> taskInventory, ImportSettings options)
        {
            // Primitive parent = null; throw new NotImplementedException();//"GETPArent"
            Primitive.ObjectProperties prop = sop.Properties;
            writer.WriteStartElement("SceneObjectPart");
            writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");

            WriteUUID(writer, "UUID", sop.ID, options);
            if (CogbotHelpers.IsNullOrZero(sop.ID))
            {
                throw new NullReferenceException("ID " + sop);
            }

            WriteValue(writer, "AllowedDrop",
                       ((sop.Flags & PrimFlags.AllowInventoryDrop) != 0).ToString().ToLower());

            WriteUserUUID(writer, "CreatorID", prop.CreatorID, options);

            /*
             * if (sop.CreatorData != null && sop.CreatorData != string.Empty)
             *  WES(writer,"CreatorData", sop.CreatorData);
             * else if (options.ContainsKey("home"))
             * {
             *  if (m_UserManagement == null)
             *      m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
             *  string name = m_UserManagement.GetUserName(sop.CreatorID);
             *  WES(writer,"CreatorData", (string)options["home"] + ";" + name);
             * }
             */
            WriteUUID(writer, "FolderID", prop.FolderID, options);
            WriteInt(writer, "InventorySerial", prop.InventorySerial);

            WriteTaskInventory(sop, writer, taskInventory, options);

            WriteFlags(writer, "ObjectFlags", sop.Flags, options);
            WriteInt(writer, "LocalId", sop.LocalID);
            WriteValue(writer, "Name", prop.Name);
            WriteEnum(writer, "Material", sop.PrimData.Material);
            WriteValue(writer, "PassTouches", "False");// sop.PassTouches.ToString().ToLower());
            WriteUInt(writer, "RegionHandle", sop.RegionHandle);
            WriteValue(writer, "ScriptAccessPin", "0");

            Vector3 groupPosition;

            if (parent == null)
            {
                groupPosition = sop.Position;
            }
            else
            {
                groupPosition = parent.Position;
            }

            WriteVector(writer, "GroupPosition", groupPosition);
            if (sop.ParentID == 0)
            {
                WriteVector(writer, "OffsetPosition", Vector3.Zero);
            }
            else
            {
                WriteVector(writer, "OffsetPosition", sop.Position);
            }
            WriteQuaternion(writer, "RotationOffset", sop.Rotation);

            WriteVector(writer, "Velocity", sop.Velocity);
            WriteVector(writer, "AngularVelocity", sop.AngularVelocity);
            WriteVector(writer, "Acceleration", sop.Acceleration);
            WriteValue(writer, "Description", prop.Description);

            writer.WriteStartElement("Color");
            WriteFloat(writer, "R", sop.TextColor.R);
            WriteFloat(writer, "G", sop.TextColor.G);
            WriteFloat(writer, "B", sop.TextColor.B);
            WriteFloat(writer, "A", sop.TextColor.G);
            writer.WriteEndElement();

            WriteValue(writer, "Text", sop.Text);
            WriteValue(writer, "SitName", prop.SitName);
            WriteValue(writer, "TouchName", prop.TouchName);

            WriteInt(writer, "LinkNum", linkNum);
            WriteEnum(writer, "ClickAction", sop.ClickAction);

            WriteShape(writer, sop, sop.Properties, sop.PrimData, options);

            WriteVector(writer, "Scale", sop.Scale);
            WriteValue(writer, "UpdateFlag", "0");
            WriteVector(writer, "SitTargetOrientation", Vector3.UnitZ);
            WriteVector(writer, "SitTargetPosition", Vector3.Zero);
            WriteVector(writer, "SitTargetPositionLL", Vector3.Zero);
            WriteQuaternion(writer, "SitTargetOrientationLL", Quaternion.Identity);
            WriteInt(writer, "ParentID", sop.ParentID);
            WriteDate(writer, "CreationDate", sop.Properties.CreationDate);
            WriteEnum(writer, "Category", sop.Properties.Category);
            WriteInt(writer, "SalePrice", sop.Properties.SalePrice);
            WriteEnum(writer, "ObjectSaleType", sop.Properties.SaleType);
            WriteInt(writer, "OwnershipCost", sop.Properties.OwnershipCost);
            WriteUUID(writer, "GroupID", sop.GroupID, options);

            UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;

            WriteUserUUID(writer, "OwnerID", ownerID, options);

            UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : prop.LastOwnerID;

            WriteUserUUID(writer, "LastOwnerID", lastOwnerID, options);

            var perms = prop.Permissions;

            if (!options.Contains("sameperm") || options.Contains("fullperm"))
            {
                perms = Permissions.FullPermissions;
            }
            WriteEnum(writer, "BaseMask", Reperm(perms.BaseMask, options));
            WriteEnum(writer, "OwnerMask", Reperm(perms.OwnerMask, options));
            WriteEnum(writer, "GroupMask", Reperm(perms.GroupMask, options));
            WriteEnum(writer, "EveryoneMask", Reperm(perms.EveryoneMask, options));
            WriteEnum(writer, "NextOwnerMask", Reperm(perms.NextOwnerMask, options));
            WriteFlags(writer, "Flags", sop.Flags, options);
            WriteUUID(writer, "CollisionSound", sop.Sound, options);
            WriteFloat(writer, "CollisionSoundVolume", sop.SoundGain);
            if (sop.MediaURL != null)
            {
                WriteValue(writer, "MediaUrl", sop.MediaURL);
            }
            WriteBytes(writer, "TextureAnimation", sop.TextureAnim.GetBytes());
            WriteBytes(writer, "ParticleSystem", sop.ParticleSys.GetBytes());

            /*
             * WES(writer,"PayPrice0", sop.PayPrice[0]);
             * WES(writer,"PayPrice1", sop.PayPrice[1]);
             * WES(writer,"PayPrice2", sop.PayPrice[2]);
             * WES(writer,"PayPrice3", sop.PayPrice[3]);
             * WES(writer,"PayPrice4", sop.PayPrice[4]);
             */

            writer.WriteEndElement();
        }