Ejemplo n.º 1
0
 public void osMessageObject(key objectUUID, string message)
 {
     m_OSSL_Functions.osMessageObject(objectUUID, message);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Set parameters for light projection with uuid of target prim
        /// </summary>
        public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb)
        {
            CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams");
            m_host.AddScriptLPS(1);

            SceneObjectPart obj = null;
            if (prim == UUID.Zero.ToString())
            {
                obj = m_host;
            }
            else
            {
                obj = World.GetSceneObjectPart(new UUID(prim));
                if (obj == null)
                    return;
            }

            obj.Shape.ProjectionEntry = projection;
            obj.Shape.ProjectionTextureUUID = new UUID(texture);
            obj.Shape.ProjectionFOV = (float)fov;
            obj.Shape.ProjectionFocus = (float)focus;
            obj.Shape.ProjectionAmbiance = (float)amb;

            obj.ParentGroup.HasGroupChanged = true;
            obj.ScheduleFullUpdate();
        }
Ejemplo n.º 3
0
        public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
        {
            CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments");

            m_host.AddScriptLPS(1);

            UUID targetUUID;
            ScenePresence target;
            LSL_List resp = new LSL_List();

            if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
            {
                foreach (object point in attachmentPoints.Data)
                {
                    LSL_Integer ipoint = new LSL_Integer(
                        (point is LSL_Integer || point is int || point is uint) ?
                            (int)point :
                            0
                    );
                    resp.Add(ipoint);
                    if (ipoint == 0)
                    {
                        // indicates zero attachments
                        resp.Add(new LSL_Integer(0));
                    }
                    else
                    {
                        // gets the number of attachments on the attachment point
                        resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count));
                    }
                }
            }

            return resp;
        }
Ejemplo n.º 4
0
        public void osNpcWhisper(LSL_Key npc, int channel, string message)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcWhisper");
            m_host.AddScriptLPS(1);

            INPCModule module = World.RequestModuleInterface<INPCModule>();
            if (module != null)
            {
                UUID npcId = new UUID(npc.m_string);

                if (!module.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                module.Whisper(npcId, World, message, channel);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get the gender as specified in avatar appearance for a given avatar key
        /// </summary>
        /// <param name="rawAvatarId"></param>
        /// <returns>"male" or "female" or "unknown"</returns>
        public LSL_String osGetGender(LSL_Key rawAvatarId)
        {
            CheckThreatLevel(ThreatLevel.None, "osGetGender");
            m_host.AddScriptLPS(1);

            UUID avatarId;
            if (!UUID.TryParse(rawAvatarId, out avatarId))
                return new LSL_String("unknown");

            ScenePresence sp = World.GetScenePresence(avatarId);

            if (sp == null || sp.IsChildAgent || sp.Appearance == null || sp.Appearance.VisualParams == null)
                return new LSL_String("unknown");

            // find the index of "shape" parameter "male"
            int vpShapeMaleIndex = 0;
            bool indexFound = false;
            VisualParam param = new VisualParam();
            foreach(var vpEntry in VisualParams.Params)
            {
                param = vpEntry.Value;
                if (param.Name == "male" && param.Wearable == "shape")
                {
                    indexFound = true;
                    break;
                }

                if (param.Group == 0)
                    vpShapeMaleIndex++;
            }

            if (!indexFound)
                return new LSL_String("unknown");

            float vpShapeMale = Utils.ByteToFloat(sp.Appearance.VisualParams[vpShapeMaleIndex], param.MinValue, param.MaxValue);

            bool isMale = vpShapeMale > 0.5f;
            return new LSL_String(isMale ? "male" : "female");
        }
Ejemplo n.º 6
0
        public LSL_Rotation osNpcGetRot(LSL_Key npc)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcGetRot");
            m_host.AddScriptLPS(1);

            INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
            if (npcModule != null)
            {
                UUID npcId;
                if (!UUID.TryParse(npc.m_string, out npcId))
                    return new LSL_Rotation(Quaternion.Identity);

                if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
                    return new LSL_Rotation(Quaternion.Identity);

                ScenePresence sp = World.GetScenePresence(npcId);

                if (sp != null)
                    return new LSL_Rotation(sp.GetWorldRotation());
            }

            return Quaternion.Identity;
        }
Ejemplo n.º 7
0
 public void osNpcSay(LSL_Key npc, string message)
 {
     osNpcSay(npc, 0, message);
 }
Ejemplo n.º 8
0
 public vector osNpcGetPos(LSL_Key npc)
 {
     return(m_OSSL_Functions.osNpcGetPos(npc));
 }
Ejemplo n.º 9
0
 public void osNpcMoveTo(key npc, vector position)
 {
     m_OSSL_Functions.osNpcMoveTo(npc, position);
 }
Ejemplo n.º 10
0
 public void osNpcLoadAppearance(key npc, string notecard)
 {
     m_OSSL_Functions.osNpcLoadAppearance(npc, notecard);
 }
Ejemplo n.º 11
0
 public LSL_Key osNpcGetOwner(LSL_Key npc)
 {
     return(m_OSSL_Functions.osNpcGetOwner(npc));
 }
Ejemplo n.º 12
0
 public key osNpcSaveAppearance(key npc, string notecard)
 {
     return(m_OSSL_Functions.osNpcSaveAppearance(npc, notecard));
 }
Ejemplo n.º 13
0
 public key osNpcCreate(string user, string name, vector position, key cloneFrom, int options)
 {
     return(m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom, options));
 }
Ejemplo n.º 14
0
 public LSL_Integer osIsNpc(LSL_Key npc)
 {
     return(m_OSSL_Functions.osIsNpc(npc));
 }
Ejemplo n.º 15
0
        public LSL_Key osNpcGetOwner(LSL_Key npc)
        {
            CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner");
            m_host.AddScriptLPS(1);

            INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
            if (npcModule != null)
            {
                UUID npcId;
                if (UUID.TryParse(npc.m_string, out npcId))
                {
                    UUID owner = npcModule.GetOwner(npcId);
                    if (owner != UUID.Zero)
                        return new LSL_Key(owner.ToString());
                    else
                        return npc;
                }
            }

            return new LSL_Key(UUID.Zero.ToString());
        }
Ejemplo n.º 16
0
 public void osNpcMoveToTarget(key npc, vector target, int options)
 {
     m_OSSL_Functions.osNpcMoveToTarget(npc, target, options);
 }
Ejemplo n.º 17
0
        public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
            m_host.AddScriptLPS(1);

            INPCModule module = World.RequestModuleInterface<INPCModule>();
            if (module != null)
            {
                UUID npcId;
                if (!UUID.TryParse(npc.m_string, out npcId))
                    return;

                if (!module.CheckPermissions(npcId, m_host.OwnerID))
                    return;
                
                module.MoveToTarget(npcId, World, pos, false, true, false);
            }
        }
Ejemplo n.º 18
0
 public rotation osNpcGetRot(key npc)
 {
     return(m_OSSL_Functions.osNpcGetRot(npc));
 }
Ejemplo n.º 19
0
        public void osNpcSetProfileAbout(LSL_Key npc, string about)
        {
            CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileAbout");
            m_host.AddScriptLPS(1);

            INPCModule module = World.RequestModuleInterface<INPCModule>();
            if (module != null)
            {
                UUID npcId = new UUID(npc.m_string);

                if (!module.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                ScenePresence sp = World.GetScenePresence(npcId);
                if (sp != null)
                    ((INPC)(sp.ControllingClient)).profileAbout = about;
            }
        }
Ejemplo n.º 20
0
 public void osNpcSetRot(key npc, rotation rot)
 {
     m_OSSL_Functions.osNpcSetRot(npc, rot);
 }
Ejemplo n.º 21
0
        public void osNpcRemove(LSL_Key npc)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
            m_host.AddScriptLPS(1);

            try
            {
                INPCModule module = World.RequestModuleInterface<INPCModule>();
                if (module != null)
                {
                    UUID npcId = new UUID(npc.m_string);

                    if (!module.CheckPermissions(npcId, m_host.OwnerID))
                        return;

                    module.DeleteNPC(npcId, World);                   
                }
            }
            catch { }
        }
Ejemplo n.º 22
0
 public void osNpcStopMoveToTarget(LSL_Key npc)
 {
     m_OSSL_Functions.osNpcStopMoveToTarget(npc);
 }
Ejemplo n.º 23
0
        public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard)
        {
            CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance");
            m_host.AddScriptLPS(1);

            return SaveAppearanceToNotecard(avatarId, notecard);
        }
Ejemplo n.º 24
0
 public void osNpcSay(key npc, string message)
 {
     m_OSSL_Functions.osNpcSay(npc, message);
 }
Ejemplo n.º 25
0
 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
 {
     CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams");
     m_host.AddScriptLPS(1);
     InitLSL();
     
     m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams");
 }
Ejemplo n.º 26
0
 public void osNpcShout(key npc, int channel, string message)
 {
     m_OSSL_Functions.osNpcShout(npc, channel, message);
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Eject user from the group this object is set to
        /// </summary>
        /// <param name="agentId"></param>
        /// <returns></returns>
        public LSL_Integer osEjectFromGroup(LSL_Key agentId)
        {
            CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup");
            m_host.AddScriptLPS(1);

            UUID agent = new UUID(agentId);

            // groups module is required
            IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>();
            if (groupsModule == null) return ScriptBaseClass.FALSE;

            // object has to be set to a group, but not group owned
            if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE;

            // object owner has to be in that group and required permissions
            GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
            if (member == null || (member.GroupPowers & (ulong)GroupPowers.Eject) == 0) return ScriptBaseClass.FALSE;

            // agent has to be in that group
            //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent);
            //if (member == null) return ScriptBaseClass.FALSE;

            // ejectee can be offline

            groupsModule.EjectGroupMember(null, m_host.OwnerID, m_host.GroupID, agent);

            return ScriptBaseClass.TRUE;
        }
Ejemplo n.º 28
0
 public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
 {
     m_OSSL_Functions.osNpcSit(npc, target, options);
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Sets the response type for an HTTP request/response
        /// </summary>
        /// <returns></returns>
        public void osSetContentType(LSL_Key id, string type)
        {
            CheckThreatLevel(ThreatLevel.High, "osSetContentType");

            if (m_UrlModule != null)
                m_UrlModule.HttpContentType(new UUID(id),type);
        }
Ejemplo n.º 30
0
 public void osNpcStand(LSL_Key npc)
 {
     m_OSSL_Functions.osNpcStand(npc);
 }
Ejemplo n.º 31
0
        public void osNpcLoadAppearance(LSL_Key npc, string notecard)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance");
            m_host.AddScriptLPS(1);

            INPCModule npcModule = World.RequestModuleInterface<INPCModule>();

            if (npcModule != null)
            {
                UUID npcId;
                if (!UUID.TryParse(npc.m_string, out npcId))
                    return;

                if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                string appearanceSerialized = LoadNotecard(notecard);

                if (appearanceSerialized == null)
                    OSSLError(string.Format("osNpcCreate: Notecard reference '{0}' not found.", notecard));

                OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
//                OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized);
//                Console.WriteLine("appearanceSerialized {0}", appearanceSerialized);
//                Console.WriteLine("a.Type {0}, a.ToString() {1}", a.Type, a);
                AvatarAppearance appearance = new AvatarAppearance();
                appearance.Unpack(appearanceOsd);

                npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene);
            }
        }
Ejemplo n.º 32
0
 public void osNpcRemove(key npc)
 {
     m_OSSL_Functions.osNpcRemove(npc);
 }
Ejemplo n.º 33
0
        public LSL_Vector osNpcGetPos(LSL_Key npc)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcGetPos");
            m_host.AddScriptLPS(1);

            INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
            if (npcModule != null)
            {
                UUID npcId;
                if (!UUID.TryParse(npc.m_string, out npcId))
                    return new LSL_Vector(0, 0, 0);

                if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
                    return new LSL_Vector(0, 0, 0);

                ScenePresence sp = World.GetScenePresence(npcId);

                if (sp != null)
                    return new LSL_Vector(sp.AbsolutePosition);
            }

            return Vector3.Zero;
        }
Ejemplo n.º 34
0
 public void osNpcStopAnimation(LSL_Key npc, string animation)
 {
     m_OSSL_Functions.osNpcStopAnimation(npc, animation);
 }
Ejemplo n.º 35
0
        public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget");
            m_host.AddScriptLPS(1);

            INPCModule module = World.RequestModuleInterface<INPCModule>();
            if (module != null)
            {
                UUID npcId;
                if (!UUID.TryParse(npc.m_string, out npcId))
                    return;

                if (!module.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                module.MoveToTarget(
                    new UUID(npc.m_string),
                    World,
                    target,
                    (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
                    (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0,
                    (options & ScriptBaseClass.OS_NPC_RUNNING) != 0);
            }
        }
Ejemplo n.º 36
0
 public void osNpcWhisper(key npc, int channel, string message)
 {
     m_OSSL_Functions.osNpcWhisper(npc, channel, message);
 }
Ejemplo n.º 37
0
        public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcSetRot");
            m_host.AddScriptLPS(1);

            INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
            if (npcModule != null)
            {
                UUID npcId;
                if (!UUID.TryParse(npc.m_string, out npcId))
                    return;

                if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                ScenePresence sp = World.GetScenePresence(npcId);

                if (sp != null)
                    sp.Rotation = rotation;
            }
        }
Ejemplo n.º 38
0
 public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num)
 {
     m_OSSL_Functions.osNpcTouch(npcLSL_Key, object_key, link_num);
 }
Ejemplo n.º 39
0
        public void osNpcSetProfileImage(LSL_Key npc, string image)
        {
            CheckThreatLevel(ThreatLevel.Low, "osNpcSetProfileImage");
            m_host.AddScriptLPS(1);

            INPCModule module = World.RequestModuleInterface<INPCModule>();
            if (module != null)
            {
                UUID npcId = new UUID(npc.m_string);

                if (!module.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                UUID ImageID = new UUID();

                ImageID = ScriptUtils.GetAssetIdFromItemName(m_host, image, (int)AssetType.Texture);

                if (ImageID == null || ImageID == UUID.Zero)
                {
                    if (!UUID.TryParse(image, out ImageID))
                        return;
                }

                ScenePresence sp = World.GetScenePresence(npcId);
                if (sp != null)
                    ((INPC)(sp.ControllingClient)).profileImage = ImageID;
            }
        }
Ejemplo n.º 40
0
 public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecard)
 {
     return(m_OSSL_Functions.osAgentSaveAppearance(agentId, notecard));
 }
Ejemplo n.º 41
0
        public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcSit");
            m_host.AddScriptLPS(1);

            INPCModule module = World.RequestModuleInterface<INPCModule>();
            if (module != null)
            {
                UUID npcId = new UUID(npc.m_string);

                if (!module.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                module.Sit(npcId, new UUID(target.m_string), World);
            }
        }
Ejemplo n.º 42
0
 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
 {
     return(m_OSSL_Functions.osGetPrimitiveParams(prim, rules));
 }
Ejemplo n.º 43
0
        public void osNpcStopAnimation(LSL_Key npc, string animation)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation");
            m_host.AddScriptLPS(1);

            INPCModule module = World.RequestModuleInterface<INPCModule>();
            if (module != null)
            {
                UUID npcID = new UUID(npc.m_string);

                if (module.CheckPermissions(npcID, m_host.OwnerID))
                    AvatarStopAnimation(npcID.ToString(), animation);
            }
        }
Ejemplo n.º 44
0
 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
 {
     m_OSSL_Functions.osSetPrimitiveParams(prim, rules);
 }
Ejemplo n.º 45
0
        public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
            m_host.AddScriptLPS(1);
            
            INPCModule module = World.RequestModuleInterface<INPCModule>();
            int linkNum = link_num.value;
            if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS))
            {
                UUID npcId;
                if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID))
                    return;

                SceneObjectPart part = null;
                UUID objectId;
                if (UUID.TryParse(LSL_String.ToString(object_key), out objectId))
                    part = World.GetSceneObjectPart(objectId);

                if (part == null)
                    return;

                if (linkNum != ScriptBaseClass.LINK_THIS)
                {
                    if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT)
                    { // 0 and 1 are treated as root, find the root if the current part isnt it
                        if (!part.IsRoot)
                            part = part.ParentGroup.RootPart;
                    }
                    else
                    { // Find the prim with the given link number if not found then fail silently
                        part = part.ParentGroup.GetLinkNumPart(linkNum);
                        if (part == null)
                            return;
                    }
                }

                module.Touch(npcId, part.UUID);
            }
        }
Ejemplo n.º 46
0
 public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb)
 {
     m_OSSL_Functions.osSetProjectionParams(prim, projection, texture, fov, focus, amb);
 }
Ejemplo n.º 47
0
        protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecard)
        {
            UUID avatarId;
            if (!UUID.TryParse(rawAvatarId, out avatarId))
                return new LSL_Key(UUID.Zero.ToString());

            return SaveAppearanceToNotecard(avatarId, notecard);
        }
Ejemplo n.º 48
0
 public LSL_Integer osInviteToGroup(LSL_Key agentId)
 {
     return(m_OSSL_Functions.osInviteToGroup(agentId));
 }
Ejemplo n.º 49
0
 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
 {
     CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
     m_host.AddScriptLPS(1);
     InitLSL();
     
     return m_LSL_Api.GetPrimitiveParamsEx(prim, rules);
 }
Ejemplo n.º 50
0
 public LSL_Integer osEjectFromGroup(LSL_Key agentId)
 {
     return(m_OSSL_Functions.osEjectFromGroup(agentId));
 }
Ejemplo n.º 51
0
        /// <summary>
        /// Set parameters for light projection in host prim 
        /// </summary>
        public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb)
        {
            CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams");

            osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb);
        }
Ejemplo n.º 52
0
 public void osSetTerrainTexture(int level, LSL_Key texture)
 {
     m_OSSL_Functions.osSetTerrainTexture(level, texture);
 }
Ejemplo n.º 53
0
        /// <summary>
        /// Invite user to the group this object is set to
        /// </summary>
        /// <param name="agentId"></param>
        /// <returns></returns>
        public LSL_Integer osInviteToGroup(LSL_Key agentId)
        {
            CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup");
            m_host.AddScriptLPS(1);

            UUID agent = new UUID(agentId);

            // groups module is required
            IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>();
            if (groupsModule == null) return ScriptBaseClass.FALSE;

            // object has to be set to a group, but not group owned
            if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE;

            // object owner has to be in that group and required permissions
            GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
            if (member == null || (member.GroupPowers & (ulong)GroupPowers.Invite) == 0) return ScriptBaseClass.FALSE;

            // check if agent is in that group already
            //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent);
            //if (member != null) return ScriptBaseClass.FALSE;

            // invited agent has to be present in this scene
            if (World.GetScenePresence(agent) == null) return ScriptBaseClass.FALSE;

            groupsModule.InviteGroup(null, m_host.OwnerID, m_host.GroupID, agent, UUID.Zero);

            return ScriptBaseClass.TRUE;
        }
Ejemplo n.º 54
0
 public void osSetContentType(LSL_Key id, string type)
 {
     m_OSSL_Functions.osSetContentType(id, type);
 }
Ejemplo n.º 55
0
        /// <summary>
        /// Sets terrain estate texture
        /// </summary>
        /// <param name="level"></param>
        /// <param name="texture"></param>
        /// <returns></returns>
        public void osSetTerrainTexture(int level, LSL_Key texture)
        {
            CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture");

            m_host.AddScriptLPS(1);
            //Check to make sure that the script's owner is the estate manager/master
            //World.Permissions.GenericEstatePermission(
            if (World.Permissions.IsGod(m_host.OwnerID))
            {
                if (level < 0 || level > 3)
                    return;

                UUID textureID = new UUID();
                if (!UUID.TryParse(texture, out textureID))
                    return;

                // estate module is required
                IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
                if (estate != null)
                    estate.setEstateTerrainBaseTexture(level, textureID);
            }
        }
Ejemplo n.º 56
0
 public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)
 {
     return(m_OSSL_Functions.osGetNumberOfAttachments(avatar, attachmentPoints));
 }
Ejemplo n.º 57
0
        public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options)
        {
            CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments");
            m_host.AddScriptLPS(1);

            UUID targetUUID;
            if(!UUID.TryParse(avatar.ToString(), out targetUUID))
                return;
            
            if(targetUUID == UUID.Zero)
                return;
            
            ScenePresence target;
            if(!World.TryGetScenePresence(targetUUID, out target))
               return;

            if(target.IsDeleted || target.IsInTransit)
               return;

            List<int> aps = new List<int>();
            if(attachmentPoints.Length != 0)
            {
                foreach (object point in attachmentPoints.Data)
                {
                    int ipoint;
                    if (int.TryParse(point.ToString(), out ipoint))
                    {
                        aps.Add(ipoint);
                    }
                }
                // parsing failed
                if(aps.Count != attachmentPoints.Length)
                    return;
            }

            List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();

            bool msgAll;
            bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0;

            if(aps.Count == 0)
            {
                if(!invertPoints)
                    return;
                msgAll = true;
                invertPoints = false;
            }
            else
                msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL);

            if (msgAll && invertPoints)
                return;

            if (msgAll || invertPoints)
            {
                attachments = target.GetAttachments();
            }
            else
            {
                foreach (int point in aps)
                {
                    if (point > 0)
                    {
                        attachments.AddRange(target.GetAttachments((uint)point));
                    }
                }
            }

            // if we have no attachments at this point, exit now
            if (attachments.Count == 0)
            {
                return;
            }

            bool optionObjCreator = (options & 
                        ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0;
            bool optionScriptCreator = (options &
                        ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0;

            UUID hostCreatorID = m_host.CreatorID;
            UUID itemCreatorID = m_item.CreatorID;

            foreach (SceneObjectGroup sog in attachments)
            {
                if(sog.IsDeleted || sog.inTransit)
                    continue;

                if (invertPoints && aps.Contains((int)sog.AttachmentPoint))
                    continue;

                UUID CreatorID = sog.RootPart.CreatorID;
                if (optionObjCreator && CreatorID != hostCreatorID)
                    continue;

                if (optionScriptCreator && CreatorID != itemCreatorID)
                    continue;

                SceneObjectPart[] parts = sog.Parts;
                foreach(SceneObjectPart p in parts)
                    MessageObject(p.UUID, message);
            }
        }
Ejemplo n.º 58
0
        /// <summary>
        /// Save the current appearance of the NPC permanently to the named notecard.
        /// </summary>
        /// <param name="avatar"></param>
        /// <param name="notecard">The name of the notecard to which to save the appearance.</param>
        /// <returns>The asset ID of the notecard saved.</returns>
        public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard)
        {
            CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance");
            m_host.AddScriptLPS(1);

            INPCModule npcModule = World.RequestModuleInterface<INPCModule>();

            if (npcModule != null)
            {
                UUID npcId;
                if (!UUID.TryParse(npc.m_string, out npcId))
                    return new LSL_Key(UUID.Zero.ToString());

                if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
                    return new LSL_Key(UUID.Zero.ToString());

                return SaveAppearanceToNotecard(npcId, notecard);
            }

            return new LSL_Key(UUID.Zero.ToString());
        }
Ejemplo n.º 59
0
        public LSL_List modInvokeL(string fname, params object[] parms)
        {
            Type returntype = m_comms.LookupReturnType(fname);
            if (returntype != typeof(object[]))
                MODError(String.Format("return type mismatch for {0}",fname));

            object[] result = (object[])modInvoke(fname,parms);
            object[] llist = new object[result.Length];
            for (int i = 0; i < result.Length; i++)
            {
                if (result[i] is string)
                {
                    llist[i] = new LSL_String((string)result[i]);
                }
                else if (result[i] is int)
                {
                    llist[i] = new LSL_Integer((int)result[i]);
                }
                else if (result[i] is float)
                {
                    llist[i] = new LSL_Float((float)result[i]);
                }
                else if (result[i] is UUID)
                {
                    llist[i] = new LSL_Key(result[i].ToString());
                }
                else if (result[i] is OpenMetaverse.Vector3)
                {
                    OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i];
                    llist[i] = new LSL_Vector(vresult.X, vresult.Y, vresult.Z);
                }
                else if (result[i] is OpenMetaverse.Quaternion)
                {
                    OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i];
                    llist[i] = new LSL_Rotation(qresult.X, qresult.Y, qresult.Z, qresult.W);
                }
                else
                {
                    MODError(String.Format("unknown list element {1} returned by {0}", fname, result[i].GetType().Name));
                }
            }

            return new LSL_List(llist);
        }
Ejemplo n.º 60
0
 public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int flags)
 {
     m_OSSL_Functions.osMessageAttachments(avatar, message, attachmentPoints, flags);
 }