/// <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 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); } } }
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 llRegionSayTo(LSL_Key toID, int channelID, string text) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; IChatModule chatModule = World.RequestModuleInterface<IChatModule>(); if (text.Length > 1023) text = text.Substring(0, 1023); if (channelID == 0) { IScenePresence presence = World.GetScenePresence(UUID.Parse(toID.m_string)); if (presence != null) { if (chatModule != null) chatModule.TrySendChatMessage(presence, m_host.AbsolutePosition, m_host.UUID, m_host.Name, ChatTypeEnum.Say, text, ChatSourceType.Object, 10000); } } if (m_comms != null) m_comms.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, UUID.Parse(toID.m_string), text); }
public LSL_Key llRequestUsername(LSL_Key uuid) { UUID userID = UUID.Zero; if (!UUID.TryParse(uuid, out userID)) { // => complain loudly, as specified by the LSL docs ShoutError("Failed to parse uuid for avatar."); return UUID.Zero.ToString(); } DataserverPlugin dataserverPlugin = (DataserverPlugin) m_ScriptEngine.GetScriptPlugin("Dataserver"); UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, uuid.ToString()); Util.FireAndForget(delegate { string name = ""; UserAccount info = World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, userID); if (info != null) name = info.Name; dataserverPlugin.AddReply(uuid.ToString(), name, 100); }); ScriptSleep(100); return tid.ToString(); }
public LSL_String llJsonValueType(LSL_String json, LSL_List specifiers) { OSD o = OSDParser.DeserializeJson(json); OSD specVal = JsonGetSpecific(o, specifiers, 0); if (specVal == null) return ScriptBaseClass.JSON_INVALID; switch (specVal.Type) { case OSDType.Array: return ScriptBaseClass.JSON_ARRAY; case OSDType.Boolean: return specVal.AsBoolean() ? ScriptBaseClass.JSON_TRUE : ScriptBaseClass.JSON_FALSE; case OSDType.Integer: case OSDType.Real: return ScriptBaseClass.JSON_NUMBER; case OSDType.Map: return ScriptBaseClass.JSON_OBJECT; case OSDType.String: case OSDType.UUID: return ScriptBaseClass.JSON_STRING; case OSDType.Unknown: return ScriptBaseClass.JSON_NULL; } return ScriptBaseClass.JSON_INVALID; }
public LSL_Integer llManageEstateAccess(LSL_Integer action, LSL_String avatar) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return LSL_Integer.FALSE; if (World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) { if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_ADD) World.RegionInfo.EstateSettings.AddEstateUser(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_REMOVE) World.RegionInfo.EstateSettings.RemoveEstateUser(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_ADD) World.RegionInfo.EstateSettings.AddEstateGroup(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_REMOVE) World.RegionInfo.EstateSettings.RemoveEstateGroup(UUID.Parse(avatar)); else if (action == ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_ADD) World.RegionInfo.EstateSettings.AddBan(new EstateBan { EstateID = World.RegionInfo.EstateSettings.EstateID, BannedUserID = UUID.Parse(avatar) }); else if (action == ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_REMOVE) World.RegionInfo.EstateSettings.RemoveBan(UUID.Parse(avatar)); return LSL_Integer.TRUE; } else ShoutError("llManageEstateAccess object owner must manage estate."); return LSL_Integer.FALSE; }
public LSL_String llTransferLindenDollars(LSL_String destination, LSL_Integer amt) { LSL_String transferID = UUID.Random().ToString(); IMoneyModule moneyMod = World.RequestModuleInterface<IMoneyModule>(); LSL_String data = ""; LSL_Integer success = LSL_Integer.FALSE; TaskInventoryItem item = m_host.TaskInventory[m_itemID]; UUID destID; if (item.PermsGranter == UUID.Zero || (item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) data = llList2CSV(new LSL_Types.list("MISSING_PERMISSION_DEBIT")); else if (!UUID.TryParse(destination, out destID)) data = llList2CSV(new LSL_Types.list("INVALID_AGENT")); else if (amt <= 0) data = llList2CSV(new LSL_Types.list("INVALID_AMOUNT")); else if (World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, destID) == null) data = llList2CSV(new LSL_Types.list("LINDENDOLLAR_ENTITYDOESNOTEXIST")); else if (m_host.ParentEntity.OwnerID == m_host.ParentEntity.GroupID) data = llList2CSV(new LSL_Types.list("GROUP_OWNED")); else if (moneyMod != null) { success = moneyMod.Transfer(UUID.Parse(destination), m_host.OwnerID, amt, "", TransactionType.ObjectPays); data = llList2CSV(success ? new LSL_List(destination, amt) : new LSL_Types.list("LINDENDOLLAR_INSUFFICIENTFUNDS")); } else data = llList2CSV(new LSL_Types.list("SERVICE_ERROR")); m_ScriptEngine.PostScriptEvent(m_itemID, m_host.UUID, new EventParams( "transaction_result", new Object[] { transferID, success, data }, new DetectParams[0]), EventPriority.FirstStart); return transferID; }
public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams", m_host, "OSSL", m_itemID)) return; ISceneChildEntity obj = World.GetSceneObjectPart(prim); if (obj == null) return; if (obj.OwnerID != m_host.OwnerID) return; SetPrimParams(obj, rules, m_allowOpenSimParams); }
public void llTeleportAgentGlobalCoords(LSL_Key agent, LSL_Vector global_coordinates, LSL_Vector region_coordinates, 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; } } IScenePresence presence = World.GetScenePresence(m_host.OwnerID); if (presence != null) { IEntityTransferModule module = World.RequestModuleInterface<IEntityTransferModule>(); if (module != null) { module.Teleport(presence, Utils.UIntsToLong((uint) global_coordinates.x, (uint) global_coordinates.y), region_coordinates.ToVector3(), look_at.ToVector3(), (uint) TeleportFlags.ViaLocation); } } }
public DateTime llTeleportAgentHome(LSL_Key _agent) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return DateTime.Now; string agent = _agent.ToString(); UUID agentId = new UUID(); if (UUID.TryParse(agent, out agentId)) { IScenePresence presence = World.GetScenePresence(agentId); if (presence != null) { // agent must be over the owners land IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>(); if (parcelManagement != null) { if (m_host.OwnerID != parcelManagement.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID && !World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) { return PScriptSleep(5000); } } //Send disable cancel so that the agent cannot attempt to stay in the region presence.ControllingClient.SendTeleportStart((uint) TeleportFlags.DisableCancel); IEntityTransferModule transferModule = World.RequestModuleInterface<IEntityTransferModule>(); if (transferModule != null) transferModule.TeleportHome(agentId, presence.ControllingClient); else presence.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator."); } } return PScriptSleep(5000); }
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 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(); }
/// <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 LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers) { OSD o = OSDParser.DeserializeJson(json); OSD specVal = JsonGetSpecific(o, specifiers, 0); return specVal.AsString(); }
private OSD JsonBuildRestOfSpec(LSL_List specifiers, int i, LSL_String val) { object spec = i >= specifiers.Data.Length ? null : specifiers.Data[i]; object specNext = i+1 >= specifiers.Data.Length ? null : specifiers.Data[i+1]; if (spec == null) return OSD.FromString(val); if (spec is LSL_Integer || (spec is LSL_String && ((LSL_String)spec) == ScriptBaseClass.JSON_APPEND)) { OSDArray array = new OSDArray(); array.Add(JsonBuildRestOfSpec(specifiers, i+1, val)); return array; } else if (spec is LSL_String) { OSDMap map = new OSDMap(); map.Add((LSL_String)spec, JsonBuildRestOfSpec(specifiers, i+1, val)); return map; } return new OSD(); }
public LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value) { try { OSD o = OSDParser.DeserializeJson(json); JsonSetSpecific(o, specifiers, 0, value); return OSDParser.SerializeJsonString(o); } catch (Exception) { } return ScriptBaseClass.JSON_INVALID; }
private void JsonSetSpecific(OSD o, LSL_List specifiers, int i, LSL_String val) { object spec = specifiers.Data[i]; object specNext = i+1 == specifiers.Data.Length ? null : specifiers.Data[i+1]; OSD nextVal = null; if (o is OSDArray) { OSDArray array = ((OSDArray)o); if (spec is LSL_Integer) { int v = ((LSL_Integer)spec).value; if(v >= array.Count) array.Add(JsonBuildRestOfSpec(specifiers, i+1, val)); else nextVal = ((OSDArray)o)[v]; } else if (spec is LSL_String && ((LSL_String)spec) == ScriptBaseClass.JSON_APPEND) array.Add(JsonBuildRestOfSpec(specifiers, i+1, val)); } if (o is OSDMap) { if (spec is LSL_String) { OSDMap map = ((OSDMap)o); if (map.ContainsKey(((LSL_String)spec).m_string)) nextVal = map[((LSL_String)spec).m_string]; else map.Add(((LSL_String)spec).m_string, JsonBuildRestOfSpec(specifiers, i+1, val)); } } if (nextVal != null) { if (specifiers.Data.Length - 1 > i) { JsonSetSpecific(nextVal, specifiers, i + 1, val); return; } } }
public LSL_String llList2Json(LSL_String type, LSL_List values) { try { if (type == ScriptBaseClass.JSON_ARRAY) { OSDArray array = new OSDArray(); foreach (object o in values.Data) { array.Add(ListToJson(o)); } return OSDParser.SerializeJsonString(array); } else if (type == ScriptBaseClass.JSON_OBJECT) { OSDMap map = new OSDMap(); for (int i = 0; i < values.Data.Length; i += 2) { if (!(values.Data[i] is LSL_String)) return ScriptBaseClass.JSON_INVALID; map.Add(((LSL_String)values.Data[i]).m_string, ListToJson(values.Data[i+1])); } return OSDParser.SerializeJsonString(map); } return ScriptBaseClass.JSON_INVALID; } catch (Exception ex) { return ex.Message; } }
public void llEvade(LSL_String target, LSL_List options) { NotImplemented("llEvade"); }
public void llPursue(LSL_String target, LSL_List options) { IBotManager botManager = World.RequestModuleInterface<IBotManager>(); if (botManager != null) { float fuzz = 2; Vector3 offset = Vector3.Zero; bool requireLOS = false; bool intercept = false; //Not implemented for (int i = 0; i < options.Length; i += 2) { LSL_Types.LSLInteger opt = options.GetLSLIntegerItem(i); if (opt == ScriptBaseClass.PURSUIT_FUZZ_FACTOR) fuzz = (float) options.GetLSLFloatItem(i + 1).value; if (opt == ScriptBaseClass.PURSUIT_OFFSET) offset = options.GetVector3Item(i + 1).ToVector3(); if (opt == ScriptBaseClass.REQUIRE_LINE_OF_SIGHT) requireLOS = options.GetLSLIntegerItem(i + 1) == 1; if (opt == ScriptBaseClass.PURSUIT_INTERCEPT) intercept = options.GetLSLIntegerItem(i + 1) == 1; } botManager.FollowAvatar(m_host.ParentEntity.UUID, target.m_string, fuzz, fuzz, requireLOS, offset, m_host.ParentEntity.OwnerID); } }
public LSL_String llGetEnv(LSL_String name) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return ""; if (name == "sim_channel") return "Aurora-Sim Server"; if (name == "sim_version") return World.RequestModuleInterface<ISimulationBase>().Version; if (name == "frame_number") return new LSL_String(World.Frame.ToString()); if (name == "region_idle") return new LSL_String("1"); if (name == "dynamic_pathfinding") return new LSL_String("disabled"); return ""; }
public LSL_Key llRequestDisplayName(LSL_Key uuid) { UUID userID = UUID.Zero; if (!UUID.TryParse(uuid, out userID)) { // => complain loudly, as specified by the LSL docs ShoutError("Failed to parse uuid for avatar."); return UUID.Zero.ToString(); } DataserverPlugin dataserverPlugin = (DataserverPlugin) m_ScriptEngine.GetScriptPlugin("Dataserver"); UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, uuid.ToString()); Util.FireAndForget(delegate { string name = ""; IProfileConnector connector = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector>(); if (connector != null) { IUserProfileInfo info = connector.GetUserProfile(userID); if (info != null) name = info.DisplayName; } dataserverPlugin.AddReply(uuid.ToString(), name, 100); }); ScriptSleep(100); return tid.ToString(); }
public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return ""; if (m_UrlModule != null) return m_UrlModule.GetHttpHeader(request_id, header); return String.Empty; }
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); } } }
public void llHTTPResponse(LSL_Key id, int status, string body) { // Partial implementation: support for parameter flags needed // see http://wiki.secondlife.com/wiki/llHTTPResponse if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return; if (m_UrlModule != null) m_UrlModule.HttpResponse(id, status, body); }
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 LSL_List llJson2List(LSL_String json) { try { OSD o = OSDParser.DeserializeJson(json); return (LSL_List)ParseJsonNode(o); } catch (Exception) { return new LSL_List(ScriptBaseClass.JSON_INVALID); } }
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 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; } }