public void llSetAnimationOverride(LSL_String anim_state, LSL_String anim) { //anim_state - animation state to be overriden //anim - an animation in the prim's inventory or the name of the built-in animation UUID invItemID = InventorySelf(); if (invItemID == UUID.Zero) return; TaskInventoryItem item; lock (m_host.TaskInventory) { if (!m_host.TaskInventory.ContainsKey(InventorySelf())) return; item = m_host.TaskInventory[InventorySelf()]; } if (item.PermsGranter == UUID.Zero) return; if ((item.PermsMask & ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS) != 0) { IScenePresence presence = World.GetScenePresence(item.PermsGranter); if (presence != null) { // Do NOT try to parse UUID, animations cannot be triggered by ID UUID animID = KeyOrName(anim, AssetType.Animation, false); presence.Animator.SetDefaultAnimationOverride(anim_state, animID, anim); } } }
/// <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) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams", m_host, "OSSL", m_itemID)) return; ISceneChildEntity obj = null; if (prim == UUID.Zero.ToString()) { obj = m_host; } else { obj = World.GetSceneObjectPart(prim); if (obj == null) return; } obj.Shape.ProjectionEntry = projection; obj.Shape.ProjectionTextureUUID = texture; obj.Shape.ProjectionFOV = (float) fov; obj.Shape.ProjectionFocus = (float) focus; obj.Shape.ProjectionAmbiance = (float) amb; obj.ParentEntity.HasGroupChanged = true; obj.ScheduleUpdate(PrimUpdateFlags.FullUpdate); }
/// <summary> /// Sets terrain estate texture /// </summary> /// <param name="level"></param> /// <param name="texture"></param> /// <returns></returns> public void osSetTerrainTexture(int level, LSL_Key texture) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osSetParcelDetails", m_host, "OSSL", m_itemID)) return; //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); } }
public LSL_Integer osAddAgentToGroup(LSL_Key AgentID, LSL_String GroupName, LSL_String RequestedRole) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "osAddAgentToGroup", m_host, "OSSL", m_itemID)) return new LSL_Integer(); IGroupsServiceConnector m_groupData = WhiteCore.Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector>(); // No groups module, no functionality if (m_groupData == null) { OSSLShoutError("No Groups Module found for osAddAgentToGroup."); return 0; } UUID roleID = UUID.Zero; GroupRecord groupRecord = m_groupData.GetGroupRecord(m_host.OwnerID, UUID.Zero, GroupName.m_string); if (groupRecord == null) { OSSLShoutError("Could not find the group."); return 0; } List<GroupRolesData> roles = m_groupData.GetGroupRoles(m_host.OwnerID, groupRecord.GroupID); foreach (GroupRolesData role in roles.Where(role => role.Name == RequestedRole.m_string)) { roleID = role.RoleID; } //It takes care of permission checks in the module m_groupData.AddAgentToGroup(m_host.OwnerID, UUID.Parse(AgentID.m_string), groupRecord.GroupID, roleID); return 1; }
public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams", m_host, "OSSL", m_itemID)) return; InitLSL(); m_LSL_Api.SetPrimitiveParamsEx(prim, rules); }
/// <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) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup", m_host, "OSSL", m_itemID)) return new LSL_Integer(); UUID agent = new UUID((string) agentId); // groups module is required IGroupsModule groupsModule = 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; }
// send a message to to object identified by the given UUID, a script in the object must implement the dataserver function // the dataserver function is passed the ID of the calling function and a string message public void osMessageObject(LSL_Key objectUUID, string message) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "osMessageObject", m_host, "OSSL", m_itemID)) return; object[] resobj = new object[] {new LSL_Key(m_host.UUID.ToString()), new LSL_Key(message)}; ISceneChildEntity sceneOP = World.GetSceneObjectPart(objectUUID); m_ScriptEngine.PostObjectEvent(sceneOP.UUID, "dataserver", resobj); }
public LSL_List aaDeserializeXMLValues(LSL_String xmlFile) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "aaDeserializeXMLValues", m_host, "AA", m_itemID)) return new LSL_List(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlFile.m_string); XmlNodeList children = doc.ChildNodes; LSL_List values = new LSL_List(); foreach (XmlNode node in children) { values.Add(node.InnerText); } return values; }
public LSL_Float aaGetHealth(LSL_Key uuid) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "aaGetHealth", m_host, "AA", m_itemID)) return new LSL_Float(); UUID avID; if (UUID.TryParse(uuid, out avID)) { IScenePresence SP = World.GetScenePresence(avID); if (SP != null) { ICombatPresence cp = SP.RequestModuleInterface<ICombatPresence>(); return new LSL_Float(cp.Health); } } return new LSL_Float(-1); }
public void botSetRot(LSL_Key npc, LSL_Rotation rotation) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botStandUp", m_host, "bot", m_itemID)) return; IScenePresence sp = World.GetScenePresence(UUID.Parse(npc)); if (sp == null) return; UUID npcId; if (!UUID.TryParse(npc.m_string, out npcId)) return; if (sp != null) sp.Rotation = rotation.ToQuaternion(); }
public void botSetSpeed(LSL_Key bot, LSL_Float SpeedModifier) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetSpeed", m_host, "OSSL", m_itemID)) return; IBotManager manager = World.RequestModuleInterface<IBotManager>(); if (manager != null) manager.SetSpeed(UUID.Parse(bot), m_host.OwnerID, (float)SpeedModifier); }
public void llTeleportAgent(LSL_Key avatar, LSL_String landmark, LSL_Vector position, LSL_Vector look_at) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; UUID invItemID = InventorySelf(); if (invItemID == UUID.Zero) return; lock (m_host.TaskInventory) { if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) { ShoutError("No permissions to teleport the agent"); return; } if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) == 0) { ShoutError("No permissions to teleport the agent"); return; } } TaskInventoryItem item = null; lock (m_host.TaskInventory) { foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) { if (inv.Value.Name == landmark) item = inv.Value; } } if (item == null && landmark != "") return; IScenePresence presence = World.GetScenePresence(m_host.OwnerID); if (presence != null) { IEntityTransferModule module = World.RequestModuleInterface<IEntityTransferModule>(); if (module != null) { if (landmark == "") module.Teleport(presence, World.RegionInfo.RegionHandle, position.ToVector3(), look_at.ToVector3(), (uint) TeleportFlags.ViaLocation); else { AssetLandmark lm = new AssetLandmark( World.AssetService.Get(item.AssetID.ToString())); module.Teleport(presence, lm.RegionHandle, lm.Position, look_at.ToVector3(), (uint) TeleportFlags.ViaLocation); } } } }
public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { ISceneChildEntity obj = World.GetSceneObjectPart(prim); if (obj == null) return new LSL_List(); if (obj.OwnerID == m_host.OwnerID) return new LSL_List(); return GetLinkPrimitiveParams(obj, rules, true); }
public void llSetContentType(LSL_Key id, LSL_Integer type) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; string content_type = "text/plain"; if (type == ScriptBaseClass.CONTENT_TYPE_HTML) content_type = "text/html"; else if (type == ScriptBaseClass.CONTENT_TYPE_XML) content_type = "application/xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_XHTML) content_type = "application/xhtml+xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_ATOM) content_type = "application/atom+xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_JSON) content_type = "application/json"; else if (type == ScriptBaseClass.CONTENT_TYPE_LLSD) content_type = "application/llsd+xml"; else if (type == ScriptBaseClass.CONTENT_TYPE_FORM) content_type = "application/x-www-form-urlencoded"; else if (type == ScriptBaseClass.CONTENT_TYPE_RSS) content_type = "application/rss+xml"; else content_type = "text/plain"; if (m_UrlModule != null) m_UrlModule.SetContentType(id, content_type); }
public void aaUpdateDatabase(LSL_String key, LSL_String value, LSL_String token) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "aaUpdateDatabase", m_host, "AA", m_itemID)) return; AssetConnector.UpdateLSLData(token.m_string, key.m_string, value.m_string); }
public LSL_String aaGetLastOwner(LSL_String PrimID) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "aaGetLastOwner", m_host, "AA", m_itemID)) return new LSL_String(); ISceneChildEntity part = m_host.ParentEntity.Scene.GetSceneObjectPart(UUID.Parse(PrimID.m_string)); if (part != null) return new LSL_String(part.LastOwnerID.ToString()); else return ScriptBaseClass.NULL_KEY; }
public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams", m_host, "OSSL", m_itemID)) return new LSL_List(); InitLSL(); return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); }
public LSL_String aaGetTeam(LSL_Key uuid) { UUID avID; if (UUID.TryParse(uuid, out avID)) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "aaGetTeam", m_host, "AA", m_itemID)) return new LSL_String(); IScenePresence SP = World.GetScenePresence(avID); if (SP != null) { ICombatPresence CP = SP.RequestModuleInterface<ICombatPresence>(); if (CP != null) { return CP.Team; } } } return "No Team"; }
public void osKickAvatar(LSL_String FirstName, LSL_String SurName, LSL_String alert) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar", m_host, "OSSL", m_itemID)) return; World.ForEachScenePresence(delegate(IScenePresence sp) { if (!sp.IsChildAgent && sp.Name == FirstName + " " + SurName) { // kick client... sp.ControllingClient.Kick(alert); // ...and close on our side IEntityTransferModule transferModule = sp.Scene.RequestModuleInterface<IEntityTransferModule>(); if (transferModule != null) transferModule.IncomingCloseAgent(sp.Scene, sp.UUID); } }); }
public LSL_List aaGetTeamMembers(LSL_String team) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "aaGetTeamMembers", m_host, "AA", m_itemID)) return new LSL_List(); List<UUID> Members = new List<UUID>(); ICombatModule module = World.RequestModuleInterface<ICombatModule>(); if (module != null) { Members = module.GetTeammates(team); } LSL_List members = new LSL_List(); foreach (UUID member in Members) members.Add(new LSL_Key(member.ToString())); return members; }
public void osReturnObject(LSL_Key userID) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "osReturnObjects", m_host, "OSSL", m_itemID)) return; Dictionary<UUID, List<ISceneEntity>> returns = new Dictionary<UUID, List<ISceneEntity>>(); IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { ILandObject LO = parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); IPrimCountModule primCountModule = World.RequestModuleInterface<IPrimCountModule>(); IPrimCounts primCounts = primCountModule.GetPrimCounts(LO.LandData.GlobalID); foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID == new UUID(userID.m_string))) { if (!returns.ContainsKey(obj.OwnerID)) returns[obj.OwnerID] = new List<ISceneEntity>(); returns[obj.OwnerID].Add(obj); } foreach (List<ISceneEntity> ol in returns.Values) { if (World.Permissions.CanReturnObjects(LO, m_host.OwnerID, ol)) { ILLClientInventory inventoryModule = World.RequestModuleInterface<ILLClientInventory>(); if (inventoryModule != null) inventoryModule.ReturnObjects(ol.ToArray(), m_host.OwnerID); } } } }
public void aaJoinCombatTeam(LSL_Key uuid, LSL_String team) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "aaJoinCombatTeam", m_host, "AA", m_itemID)) return; UUID avID; if (UUID.TryParse(uuid, out avID)) { IScenePresence SP = World.GetScenePresence(avID); if (SP != null) { ICombatPresence CP = SP.RequestModuleInterface<ICombatPresence>(); if (CP != null) { if (team.m_string == "No Team") { SP.ControllingClient.SendAlertMessage("You cannot join this team."); return; } CP.Team = team.m_string; } } } }
/// <summary> /// Sets the response type for an HTTP request/response /// </summary> /// <returns></returns> public void osSetContentType(LSL_Key id, string type) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osSetContentType", m_host, "OSSL", m_itemID)) return; IUrlModule urlModule = World.RequestModuleInterface<IUrlModule>(); if (urlModule != null) urlModule.SetContentType(new UUID(id.m_string), type); }
public void aaLeaveCombat(LSL_Key uuid) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "aaLeaveCombat", m_host, "AA", m_itemID)) return; UUID avID; if (UUID.TryParse(uuid, out avID)) { IScenePresence SP = World.GetScenePresence(avID); if (SP != null) { ICombatPresence CP = SP.RequestModuleInterface<ICombatPresence>(); if (CP != null) { CP.LeaveCombat(); } } } }
/// <summary> /// Set parameters for light projection in host prim /// </summary> public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams", m_host, "OSSL", m_itemID)) return; osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); }
public LSL_List aaQueryDatabase(LSL_String key, LSL_String token) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "aaQueryDatabase", m_host, "AA", m_itemID)) return new LSL_List(); List<string> query = AssetConnector.FindLSLData(token.m_string, key.m_string); LSL_List list = new LSL_List(query.ToArray()); return list; }
public void osSetSpeed(LSL_Key UUID, LSL_Float SpeedModifier) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed", m_host, "OSSL", m_itemID)) return; IScenePresence avatar = World.GetScenePresence(UUID); if (avatar != null) { if (avatar.UUID != m_host.OwnerID) { //We need to make sure that they can do this then if (!World.Permissions.IsGod(m_host.OwnerID)) return; } avatar.SpeedModifier = (float) SpeedModifier; } }
public void aaSetEnv(LSL_String name, LSL_List value) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.VeryHigh, "aaSetEnv", m_host, "AA", m_itemID)) return; if (!World.Permissions.IsGod(m_host.OwnerID)) { LSLError("You do not have god permissions."); return; } if (name == ScriptBaseClass.ENABLE_GRAVITY) { LSL_Integer enabled = value.GetLSLIntegerItem(0); float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce(); m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(enabled == 1, grav[0], grav[1], grav[2]); } else if (name == ScriptBaseClass.GRAVITY_FORCE_X) { LSL_Float f = value.GetLSLFloatItem(0); float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce(); m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(true, (float) f.value, grav[1], grav[2]); } else if (name == ScriptBaseClass.GRAVITY_FORCE_Y) { LSL_Float f = value.GetLSLFloatItem(0); float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce(); m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(true, grav[0], (float) f.value, grav[2]); } else if (name == ScriptBaseClass.GRAVITY_FORCE_Z) { LSL_Float f = value.GetLSLFloatItem(0); float[] grav = m_host.ParentEntity.Scene.PhysicsScene.GetGravityForce(); m_host.ParentEntity.Scene.PhysicsScene.SetGravityForce(true, grav[0], grav[1], (float) f.value); } else if (name == ScriptBaseClass.ADD_GRAVITY_POINT) { LSL_Vector pos = value.GetVector3Item(0); LSL_Float gravForce = value.GetLSLFloatItem(1); LSL_Float radius = value.GetLSLFloatItem(2); LSL_Integer ident = value.GetLSLIntegerItem(3); m_host.ParentEntity.Scene.PhysicsScene.AddGravityPoint(false, new Vector3((float) pos.x, (float) pos.y, (float) pos.z), 0, 0, 0, (float) gravForce.value, (float) radius.value, ident.value); } else if (name == ScriptBaseClass.ADD_GRAVITY_FORCE) { LSL_Vector pos = value.GetVector3Item(0); LSL_Float xForce = value.GetLSLFloatItem(1); LSL_Float yForce = value.GetLSLFloatItem(2); LSL_Float zForce = value.GetLSLFloatItem(3); LSL_Float radius = value.GetLSLFloatItem(4); LSL_Integer ident = value.GetLSLIntegerItem(5); m_host.ParentEntity.Scene.PhysicsScene.AddGravityPoint(true, new Vector3((float) pos.x, (float) pos.y, (float) pos.z), (float) xForce, (float) yForce, (float) zForce, 0, (float) radius.value, ident.value); } else if (name == ScriptBaseClass.START_TIME_REVERSAL_SAVING) { IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>(); if (physicsState != null) physicsState.StartSavingPhysicsTimeReversalStates(); } else if (name == ScriptBaseClass.STOP_TIME_REVERSAL_SAVING) { IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>(); if (physicsState != null) physicsState.StopSavingPhysicsTimeReversalStates(); } else if (name == ScriptBaseClass.START_TIME_REVERSAL) { IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>(); if (physicsState != null) physicsState.StartPhysicsTimeReversal(); } else if (name == ScriptBaseClass.STOP_TIME_REVERSAL) { IPhysicsStateModule physicsState = World.RequestModuleInterface<IPhysicsStateModule>(); if (physicsState != null) physicsState.StopPhysicsTimeReversal(); } }
/// <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) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup", m_host, "OSSL", m_itemID)) return new LSL_Integer(); UUID agent = new UUID((string) agentId); // groups module is required IGroupsModule groupsModule = 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; }
public void llResetAnimationOverride(LSL_String anim_state) { //anim_state - animation state to be reset UUID invItemID = InventorySelf(); if (invItemID == UUID.Zero) return; TaskInventoryItem item; lock (m_host.TaskInventory) { if (!m_host.TaskInventory.ContainsKey(InventorySelf())) return; item = m_host.TaskInventory[InventorySelf()]; } if (item.PermsGranter == UUID.Zero) return; if ((item.PermsMask & ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS) != 0) { IScenePresence presence = World.GetScenePresence(item.PermsGranter); if (presence != null) { presence.Animator.ResetDefaultAnimationOverride(anim_state); } } }