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 Error("llRequestDisplayName", "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); }); PScriptSleep(m_sleepMsOnRequestUserName); return(tid.ToString()); }
OSD JsonBuildRestOfSpec(LSL_List specifiers, int i, LSL_String val) { object spec = i >= specifiers.Data.Length ? null : specifiers.Data[i]; // 20131224 not used 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); } 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 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_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 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 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; // 20131224 not used bool intercept; = false; //Not implemented for (int i = 0; i < options.Length; i += 2) { LSL_Integer 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; } // 20131224 not used if (opt == ScriptBaseClass.PURSUIT_INTERCEPT) // 20131224 not used 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_Key llRequestUsername(LSL_Key uuid) { UUID userID = UUID.Zero; if (!UUID.TryParse(uuid, out userID)) { // => complain loudly, as specified by the LSL docs Error("llRequestUsername", "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 userAcct = World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, userID); name = userAcct.Name; dataserverPlugin.AddReply(uuid.ToString(), name, 100); }); PScriptSleep(m_sleepMsOnRequestUserName); return(tid.ToString()); }
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 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); }
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_List("MISSING_PERMISSION_DEBIT")); } else if (!UUID.TryParse(destination, out destID)) { data = llList2CSV(new LSL_List("INVALID_AGENT")); } else if (amt <= 0) { data = llList2CSV(new LSL_List("INVALID_AMOUNT")); } else if (!World.UserAccountService.GetUserAccount(World.RegionInfo.AllScopeIDs, destID).Valid) { data = llList2CSV(new LSL_List("LINDENDOLLAR_ENTITYDOESNOTEXIST")); } else if (m_host.ParentEntity.OwnerID == m_host.ParentEntity.GroupID) { data = llList2CSV(new LSL_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_List("LINDENDOLLAR_INSUFFICIENTFUNDS")); } else { data = llList2CSV(new LSL_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 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 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); } }
void JsonSetSpecific(OSD o, LSL_List specifiers, int i, LSL_String val) { object spec = specifiers.Data[i]; // 20131224 not used 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 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 LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers) { try { OSD o = OSDParser.DeserializeJson(json); OSD specVal = JsonGetSpecific(o, specifiers, 0); if (specVal != null) { return(specVal.AsString()); } else { return(ScriptBaseClass.JSON_INVALID); } } catch (Exception) { 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 { Error("llManageEstateAccess", "llManageEstateAccess object owner must manage estate."); } return(LSL_Integer.FALSE); }
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) { Error("llTeleportAgentGlobalCoords", "No permissions to teleport the agent"); return; } if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) == 0) { Error("llTeleportAgentGlobalCoords", "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(m_sleepMsOnTeleportAgentHome)); } } //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(m_sleepMsOnTeleportAgentHome)); }
public void botSetRotation(LSL_Key npc, LSL_Rotation rotation) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botSetRotation", m_host, "bot", m_itemID)) { return; } IScenePresence sp = World.GetScenePresence(UUID.Parse(npc)); if (sp == null) { return; } UUID uid; if (!UUID.TryParse(npc.m_string, out uid)) // not actually interested in the UUID, just need to make sure it is 'real' { return; } sp.Rotation = rotation.ToQuaternion(); }
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 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 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 LSL_List llGetExperienceList(LSL_Key agent) { NotImplemented("llGetExperienceDetails", "Function was deprecated"); return(new LSL_List()); }
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_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 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 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 LSL_Integer llSitOnLink(LSL_Key agent_id, LSL_Integer link) { NotImplemented("llSitOnLink", "Not implemented at this moment"); return(0); }
public LSL_Integer llReturnObjectsByOwner(LSL_Key owner, LSL_Integer scope) { NotImplemented("llReturnObjectsByOwner", "Not implemented at this moment"); return(0); }
public LSL_List llGetExperienceDetails(LSL_Key experience_id) { NotImplemented("llGetExperienceDetails", "Not implemented at this moment"); return new LSL_List(); }
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 llClearExperiencePermissions(LSL_Key agent) { NotImplemented("llClearExperiencePermissions", "Not implemented at this moment"); }
public LSL_Key llCreateKeyValue(LSL_String key, LSL_String value) { NotImplemented("llClearExperiencePermissions", "Not implemented at this moment"); return UUID.Zero.ToString(); }
public LSL_Integer llAgentInExperience(LSL_Key agent) { NotImplemented("llAgentInExperience", "Not implemented at this moment"); return 0; }
public LSL_String llXorBase64(LSL_String str1, LSL_String str2) { NotImplemented("llXorBase64", "Not implemented at this moment"); return string.Empty; }
public LSL_Integer llReturnObjectsByOwner(LSL_Key owner, LSL_Integer scope) { NotImplemented("llReturnObjectsByOwner", "Not implemented at this moment"); return 0; }
public LSL_Key llReadKeyValue(LSL_String key) { NotImplemented("llReadKeyValue", "Not implemented at this moment"); return(UUID.Zero.ToString()); }
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 void llRequestExperiencePermissions(LSL_Key agent, LSL_String name) { NotImplemented("llRequestExperiencePermissions", "Not implemented at this moment"); }
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 LSL_Key llUpdateKeyValue(LSL_Key key, LSL_String value, LSL_Integer check, LSL_String original_value) { NotImplemented("llUpdateKeyValue", "Not implemented at this moment"); return(UUID.Zero.ToString()); }
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 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 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; } } } }
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; }
void JsonSetSpecific(OSD o, LSL_List specifiers, int i, LSL_String val) { object spec = specifiers.Data[i]; // 20131224 not used 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_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; }
private OSD JsonBuildRestOfSpec(LSL_List specifiers, int i, LSL_String val) { object spec = i >= specifiers.Data.Length ? null : specifiers.Data[i]; // 20131224 not used 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; } 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 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(); } } } }
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; }
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(); } }
public LSL_Key llReadKeyValue(LSL_String key) { NotImplemented("llReadKeyValue", "Not implemented at this moment"); return UUID.Zero.ToString(); }
public void llEvade(LSL_String target, LSL_List options) { NotImplemented("llEvade"); }
public void llRequestExperiencePermissions(LSL_Key agent, LSL_String name ) { NotImplemented("llRequestExperiencePermissions", "Not implemented at this moment"); }
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 LSL_Integer llSitOnLink( LSL_Key agent_id, LSL_Integer link ) { NotImplemented("llSitOnLink", "Not implemented at this moment"); return 0; }
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) { Error("llTeleportAgent", "No permissions to teleport the agent"); return; } if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) == 0) { Error("llTeleportAgent", "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) { return; } IScenePresence presence = World.GetScenePresence(m_host.OwnerID); if (presence != null) { IEntityTransferModule module = World.RequestModuleInterface <IEntityTransferModule>(); if (module != null) { if (landmark != "") { var worldAsset = World.AssetService.Get(item.AssetID.ToString()); if (worldAsset != null) { var lm = new AssetLandmark(worldAsset); worldAsset.Dispose(); module.Teleport(presence, lm.RegionHandle, lm.Position, look_at.ToVector3(), (uint)TeleportFlags.ViaLocation); lm.Dispose(); return; } } // no landmark details module.Teleport(presence, World.RegionInfo.RegionHandle, position.ToVector3(), look_at.ToVector3(), (uint)TeleportFlags.ViaLocation); } } }
public LSL_Key llUpdateKeyValue( LSL_Key key, LSL_String value, LSL_Integer check, LSL_String original_value ) { NotImplemented("llUpdateKeyValue", "Not implemented at this moment"); return UUID.Zero.ToString(); }
public LSL_List llGetExperienceList(LSL_Key agent) { NotImplemented("llGetExperienceDetails", "Function was deprecated"); return new LSL_List(); }
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(m_sleepMsOnTeleportAgentHome); } } //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(m_sleepMsOnTeleportAgentHome); }