Aurora.ScriptEngine.AuroraDotNetEngine.APIs.LSL_Api.llGetObjectDetails C# (CSharp) Method

llGetObjectDetails() public method

public llGetObjectDetails ( string id, Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list args ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
id string
args Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
return Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
        public LSL_List llGetObjectDetails(string id, LSL_List args)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_List();

            LSL_List ret = new LSL_List();
            UUID key = new UUID();
            if (UUID.TryParse(id, out key))
            {
                IScenePresence av = World.GetScenePresence(key);

                if (av != null)
                {
                    foreach (object o in args.Data)
                    {
                        if ((LSL_Integer)o == ScriptBaseClass.OBJECT_NAME)
                        {
                            ret.Add(new LSL_String(av.Name));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_DESC)
                        {
                            ret.Add(new LSL_String(""));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_POS)
                        {
                            Vector3 tmp = av.AbsolutePosition;
                            ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_ROT)
                        {
                            Quaternion rtmp = av.Rotation;
                            ret.Add(new LSL_Rotation(rtmp.X, rtmp.Y, rtmp.Z, rtmp.W));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_VELOCITY)
                        {
                            Vector3 tmp = av.Velocity;
                            ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_OWNER)
                        {
                            ret.Add(id);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_GROUP)
                        {
                            ret.Add(UUID.Zero.ToString());
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_CREATOR)
                        {
                            ret.Add(UUID.Zero.ToString());
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT)
                        {
                            IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
#if (!ISWIN)
                            int activeScripts = 0;
                            foreach (IScriptModule mod in modules)
                                activeScripts += mod.GetActiveScripts(av);
#else
                            int activeScripts = modules.Sum(mod => mod.GetActiveScripts(av));
#endif
                            ret.Add(activeScripts);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT)
                        {
                            IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
#if (!ISWIN)
                            int totalScripts = 0;
                            foreach (IScriptModule mod in modules)
                                totalScripts += mod.GetTotalScripts(av);
#else
                            int totalScripts = modules.Sum(mod => mod.GetTotalScripts(av));
#endif
                            ret.Add(totalScripts);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_SCRIPT_MEMORY)
                        {
                            ret.Add(0);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_SCRIPT_TIME)
                        {
                            IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
#if (!ISWIN)
                            int scriptTime = 0;
                            foreach (IScriptModule mod in modules)
                                scriptTime += mod.GetScriptTime(m_itemID);
#else
                            int scriptTime = modules.Sum(mod => mod.GetScriptTime(m_itemID));
#endif
                            ret.Add(scriptTime);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE)
                        {
                            ret.Add(0);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_SERVER_COST)
                        {
                            ret.Add(0);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_STREAMING_COST)
                        {
                            ret.Add(0);
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_PHYSICS_COST)
                        {
                            ret.Add(0);
                        }
                        else
                        {
                            ret.Add(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL);
                        }
                    }
                    return ret;
                }
                ISceneChildEntity obj = World.GetSceneObjectPart(key);
                if (obj != null)
                {
                    foreach (object o in args.Data)
                    {
                        if ((LSL_Integer)o == ScriptBaseClass.OBJECT_NAME)
                        {
                            ret.Add(new LSL_String(obj.Name));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_DESC)
                        {
                            ret.Add(new LSL_String(obj.Description));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_POS)
                        {
                            Vector3 tmp = obj.AbsolutePosition;
                            ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_ROT)
                        {
                            Quaternion rtmp = obj.RotationOffset;
                            ret.Add(new LSL_Rotation(rtmp.X, rtmp.Y, rtmp.Z, rtmp.W));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_VELOCITY)
                        {
                            Vector3 tmp = obj.Velocity;
                            ret.Add(new LSL_Vector(tmp.X, tmp.Y, tmp.Z));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_OWNER)
                        {
                            ret.Add(new LSL_Key(obj.OwnerID.ToString()));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_GROUP)
                        {
                            ret.Add(new LSL_Key(obj.GroupID.ToString()));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_CREATOR)
                        {
                            ret.Add(new LSL_Key(obj.CreatorID.ToString()));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT)
                        {
                            IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
#if (!ISWIN)
                            int activeScripts = 0;
                            foreach (IScriptModule mod in modules)
                                activeScripts += mod.GetActiveScripts(obj);
#else
                            int activeScripts = modules.Sum(mod => mod.GetActiveScripts(obj));
#endif
                            ret.Add(new LSL_Integer(activeScripts));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT)
                        {
                            IScriptModule[] modules = World.RequestModuleInterfaces<IScriptModule>();
#if (!ISWIN)
                            int totalScripts = 0;
                            foreach (IScriptModule mod in modules)
                                totalScripts += mod.GetTotalScripts(obj);
#else
                            int totalScripts = modules.Sum(mod => mod.GetTotalScripts(obj));
#endif
                            ret.Add(new LSL_Integer(totalScripts));
                        }
                        else if ((LSL_Integer)o == ScriptBaseClass.OBJECT_SCRIPT_MEMORY)
                        {
                            ret.Add(new LSL_Integer(0));
                        }
                        else
                        {
                            ret.Add(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL);
                        }
                    }
                    return ret;
                }
            }
            return new LSL_List();
        }
LSL_Api