diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 352 |
1 files changed, 325 insertions, 27 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 503b5d0..b1583eb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -157,6 +157,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
157 | string risk = m_ScriptEngine.Config.GetString("OSFunctionThreatLevel", "VeryLow"); | 157 | string risk = m_ScriptEngine.Config.GetString("OSFunctionThreatLevel", "VeryLow"); |
158 | switch (risk) | 158 | switch (risk) |
159 | { | 159 | { |
160 | case "NoAccess": | ||
161 | m_MaxThreatLevel = ThreatLevel.NoAccess; | ||
162 | break; | ||
160 | case "None": | 163 | case "None": |
161 | m_MaxThreatLevel = ThreatLevel.None; | 164 | m_MaxThreatLevel = ThreatLevel.None; |
162 | break; | 165 | break; |
@@ -413,6 +416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
413 | public LSL_Integer osSetTerrainHeight(int x, int y, double val) | 416 | public LSL_Integer osSetTerrainHeight(int x, int y, double val) |
414 | { | 417 | { |
415 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); | 418 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); |
419 | |||
416 | return SetTerrainHeight(x, y, val); | 420 | return SetTerrainHeight(x, y, val); |
417 | } | 421 | } |
418 | 422 | ||
@@ -420,12 +424,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
420 | { | 424 | { |
421 | CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); | 425 | CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); |
422 | OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); | 426 | OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); |
427 | |||
423 | return SetTerrainHeight(x, y, val); | 428 | return SetTerrainHeight(x, y, val); |
424 | } | 429 | } |
425 | 430 | ||
426 | private LSL_Integer SetTerrainHeight(int x, int y, double val) | 431 | private LSL_Integer SetTerrainHeight(int x, int y, double val) |
427 | { | 432 | { |
428 | m_host.AddScriptLPS(1); | 433 | m_host.AddScriptLPS(1); |
434 | |||
429 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) | 435 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) |
430 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); | 436 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); |
431 | 437 | ||
@@ -465,6 +471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
465 | public void osTerrainFlush() | 471 | public void osTerrainFlush() |
466 | { | 472 | { |
467 | CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush"); | 473 | CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush"); |
474 | m_host.AddScriptLPS(1); | ||
468 | 475 | ||
469 | ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>(); | 476 | ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>(); |
470 | if (terrainModule != null) terrainModule.TaintTerrain(); | 477 | if (terrainModule != null) terrainModule.TaintTerrain(); |
@@ -736,7 +743,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
736 | { | 743 | { |
737 | // High because there is no security check. High griefer potential | 744 | // High because there is no security check. High griefer potential |
738 | // | 745 | // |
739 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 746 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); |
740 | 747 | ||
741 | TeleportAgent(agent, regionName, position, lookat, false); | 748 | TeleportAgent(agent, regionName, position, lookat, false); |
742 | } | 749 | } |
@@ -753,11 +760,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
753 | { | 760 | { |
754 | // For osTeleportAgent, agent must be over owners land to avoid abuse | 761 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
755 | // For osTeleportOwner, this restriction isn't necessary | 762 | // For osTeleportOwner, this restriction isn't necessary |
756 | if (relaxRestrictions || | 763 | |
757 | m_host.OwnerID | 764 | // commented out because its redundant and uneeded please remove eventually. |
758 | == World.LandChannel.GetLandObject( | 765 | // if (relaxRestrictions || |
759 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 766 | // m_host.OwnerID |
760 | { | 767 | // == World.LandChannel.GetLandObject( |
768 | // presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
769 | // { | ||
770 | |||
761 | // We will launch the teleport on a new thread so that when the script threads are terminated | 771 | // We will launch the teleport on a new thread so that when the script threads are terminated |
762 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. | 772 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. |
763 | Util.FireAndForget( | 773 | Util.FireAndForget( |
@@ -766,7 +776,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
766 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); | 776 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); |
767 | 777 | ||
768 | ScriptSleep(5000); | 778 | ScriptSleep(5000); |
769 | } | 779 | |
780 | // } | ||
781 | |||
770 | } | 782 | } |
771 | } | 783 | } |
772 | } | 784 | } |
@@ -775,7 +787,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
775 | { | 787 | { |
776 | // High because there is no security check. High griefer potential | 788 | // High because there is no security check. High griefer potential |
777 | // | 789 | // |
778 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 790 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); |
779 | 791 | ||
780 | TeleportAgent(agent, regionX, regionY, position, lookat, false); | 792 | TeleportAgent(agent, regionX, regionY, position, lookat, false); |
781 | } | 793 | } |
@@ -794,11 +806,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
794 | { | 806 | { |
795 | // For osTeleportAgent, agent must be over owners land to avoid abuse | 807 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
796 | // For osTeleportOwner, this restriction isn't necessary | 808 | // For osTeleportOwner, this restriction isn't necessary |
797 | if (relaxRestrictions || | 809 | |
798 | m_host.OwnerID | 810 | // commented out because its redundant and uneeded please remove eventually. |
799 | == World.LandChannel.GetLandObject( | 811 | // if (relaxRestrictions || |
800 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 812 | // m_host.OwnerID |
801 | { | 813 | // == World.LandChannel.GetLandObject( |
814 | // presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
815 | // { | ||
816 | |||
802 | // We will launch the teleport on a new thread so that when the script threads are terminated | 817 | // We will launch the teleport on a new thread so that when the script threads are terminated |
803 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. | 818 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. |
804 | Util.FireAndForget( | 819 | Util.FireAndForget( |
@@ -807,7 +822,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
807 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); | 822 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); |
808 | 823 | ||
809 | ScriptSleep(5000); | 824 | ScriptSleep(5000); |
810 | } | 825 | |
826 | // } | ||
827 | |||
811 | } | 828 | } |
812 | } | 829 | } |
813 | } | 830 | } |
@@ -871,6 +888,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
871 | // threat level is None as we could get this information with an | 888 | // threat level is None as we could get this information with an |
872 | // in-world script as well, just not as efficient | 889 | // in-world script as well, just not as efficient |
873 | CheckThreatLevel(ThreatLevel.None, "osGetAgents"); | 890 | CheckThreatLevel(ThreatLevel.None, "osGetAgents"); |
891 | m_host.AddScriptLPS(1); | ||
874 | 892 | ||
875 | LSL_List result = new LSL_List(); | 893 | LSL_List result = new LSL_List(); |
876 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 894 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
@@ -885,6 +903,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
885 | { | 903 | { |
886 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); | 904 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); |
887 | 905 | ||
906 | AvatarPlayAnimation(avatar, animation); | ||
907 | } | ||
908 | |||
909 | private void AvatarPlayAnimation(string avatar, string animation) | ||
910 | { | ||
888 | UUID avatarID = (UUID)avatar; | 911 | UUID avatarID = (UUID)avatar; |
889 | 912 | ||
890 | m_host.AddScriptLPS(1); | 913 | m_host.AddScriptLPS(1); |
@@ -918,6 +941,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
918 | { | 941 | { |
919 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); | 942 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); |
920 | 943 | ||
944 | AvatarStopAnimation(avatar, animation); | ||
945 | } | ||
946 | |||
947 | private void AvatarStopAnimation(string avatar, string animation) | ||
948 | { | ||
921 | UUID avatarID = (UUID)avatar; | 949 | UUID avatarID = (UUID)avatar; |
922 | 950 | ||
923 | m_host.AddScriptLPS(1); | 951 | m_host.AddScriptLPS(1); |
@@ -1141,6 +1169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1141 | // should be removed | 1169 | // should be removed |
1142 | // | 1170 | // |
1143 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); | 1171 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); |
1172 | m_host.AddScriptLPS(1); | ||
1144 | 1173 | ||
1145 | m_host.SetScriptEvents(m_itemID, events); | 1174 | m_host.SetScriptEvents(m_itemID, events); |
1146 | } | 1175 | } |
@@ -1488,7 +1517,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1488 | 1517 | ||
1489 | m_host.AddScriptLPS(1); | 1518 | m_host.AddScriptLPS(1); |
1490 | 1519 | ||
1491 | |||
1492 | ILandObject land | 1520 | ILandObject land |
1493 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 1521 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
1494 | 1522 | ||
@@ -1549,6 +1577,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1549 | // | 1577 | // |
1550 | CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion"); | 1578 | CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion"); |
1551 | m_host.AddScriptLPS(1); | 1579 | m_host.AddScriptLPS(1); |
1580 | |||
1552 | return m_ScriptEngine.World.GetSimulatorVersion(); | 1581 | return m_ScriptEngine.World.GetSimulatorVersion(); |
1553 | } | 1582 | } |
1554 | 1583 | ||
@@ -1886,6 +1915,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1886 | public string osAvatarName2Key(string firstname, string lastname) | 1915 | public string osAvatarName2Key(string firstname, string lastname) |
1887 | { | 1916 | { |
1888 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); | 1917 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); |
1918 | m_host.AddScriptLPS(1); | ||
1889 | 1919 | ||
1890 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); | 1920 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); |
1891 | if (null == account) | 1921 | if (null == account) |
@@ -1901,6 +1931,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1901 | public string osKey2Name(string id) | 1931 | public string osKey2Name(string id) |
1902 | { | 1932 | { |
1903 | CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); | 1933 | CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); |
1934 | m_host.AddScriptLPS(1); | ||
1935 | |||
1904 | UUID key = new UUID(); | 1936 | UUID key = new UUID(); |
1905 | 1937 | ||
1906 | if (UUID.TryParse(id, out key)) | 1938 | if (UUID.TryParse(id, out key)) |
@@ -1921,6 +1953,69 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1921 | } | 1953 | } |
1922 | } | 1954 | } |
1923 | 1955 | ||
1956 | private enum InfoType | ||
1957 | { | ||
1958 | Nick, | ||
1959 | Name, | ||
1960 | Login, | ||
1961 | Home, | ||
1962 | Custom | ||
1963 | }; | ||
1964 | |||
1965 | private string GridUserInfo(InfoType type) | ||
1966 | { | ||
1967 | return GridUserInfo(type, ""); | ||
1968 | } | ||
1969 | |||
1970 | private string GridUserInfo(InfoType type, string key) | ||
1971 | { | ||
1972 | string retval = String.Empty; | ||
1973 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
1974 | string url = config.Configs["GridInfo"].GetString("GridInfoURI", String.Empty); | ||
1975 | |||
1976 | if (String.IsNullOrEmpty(url)) | ||
1977 | return "Configuration Error!"; | ||
1978 | |||
1979 | string verb ="/json_grid_info"; | ||
1980 | OSDMap json = new OSDMap(); | ||
1981 | |||
1982 | OSDMap info = WebUtil.GetFromService(String.Format("{0}{1}",url,verb), 3000); | ||
1983 | |||
1984 | if (info["Success"] != true) | ||
1985 | return "Get GridInfo Failed!"; | ||
1986 | |||
1987 | json = (OSDMap)OSDParser.DeserializeJson(info["_RawResult"].AsString()); | ||
1988 | |||
1989 | switch (type) | ||
1990 | { | ||
1991 | case InfoType.Nick: | ||
1992 | retval = json["gridnick"]; | ||
1993 | break; | ||
1994 | |||
1995 | case InfoType.Name: | ||
1996 | retval = json["gridname"]; | ||
1997 | break; | ||
1998 | |||
1999 | case InfoType.Login: | ||
2000 | retval = json["login"]; | ||
2001 | break; | ||
2002 | |||
2003 | case InfoType.Home: | ||
2004 | retval = json["home"]; | ||
2005 | break; | ||
2006 | |||
2007 | case InfoType.Custom: | ||
2008 | retval = json[key]; | ||
2009 | break; | ||
2010 | |||
2011 | default: | ||
2012 | retval = "error"; | ||
2013 | break; | ||
2014 | } | ||
2015 | |||
2016 | return retval; | ||
2017 | } | ||
2018 | |||
1924 | /// <summary> | 2019 | /// <summary> |
1925 | /// Get the nickname of this grid, as set in the [GridInfo] config section. | 2020 | /// Get the nickname of this grid, as set in the [GridInfo] config section. |
1926 | /// </summary> | 2021 | /// </summary> |
@@ -1934,10 +2029,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1934 | { | 2029 | { |
1935 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); | 2030 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); |
1936 | m_host.AddScriptLPS(1); | 2031 | m_host.AddScriptLPS(1); |
1937 | string nick = "hippogrid"; | 2032 | |
2033 | string nick = String.Empty; | ||
1938 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2034 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2035 | |||
1939 | if (config.Configs["GridInfo"] != null) | 2036 | if (config.Configs["GridInfo"] != null) |
1940 | nick = config.Configs["GridInfo"].GetString("gridnick", nick); | 2037 | nick = config.Configs["GridInfo"].GetString("gridnick", nick); |
2038 | |||
2039 | if (String.IsNullOrEmpty(nick)) | ||
2040 | nick = GridUserInfo(InfoType.Nick); | ||
2041 | |||
1941 | return nick; | 2042 | return nick; |
1942 | } | 2043 | } |
1943 | 2044 | ||
@@ -1945,10 +2046,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1945 | { | 2046 | { |
1946 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); | 2047 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); |
1947 | m_host.AddScriptLPS(1); | 2048 | m_host.AddScriptLPS(1); |
1948 | string name = "the lost continent of hippo"; | 2049 | |
2050 | string name = String.Empty; | ||
1949 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2051 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2052 | |||
1950 | if (config.Configs["GridInfo"] != null) | 2053 | if (config.Configs["GridInfo"] != null) |
1951 | name = config.Configs["GridInfo"].GetString("gridname", name); | 2054 | name = config.Configs["GridInfo"].GetString("gridname", name); |
2055 | |||
2056 | if (String.IsNullOrEmpty(name)) | ||
2057 | name = GridUserInfo(InfoType.Name); | ||
2058 | |||
1952 | return name; | 2059 | return name; |
1953 | } | 2060 | } |
1954 | 2061 | ||
@@ -1956,13 +2063,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1956 | { | 2063 | { |
1957 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); | 2064 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); |
1958 | m_host.AddScriptLPS(1); | 2065 | m_host.AddScriptLPS(1); |
1959 | string loginURI = "http://127.0.0.1:9000/"; | 2066 | |
2067 | string loginURI = String.Empty; | ||
1960 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2068 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2069 | |||
1961 | if (config.Configs["GridInfo"] != null) | 2070 | if (config.Configs["GridInfo"] != null) |
1962 | loginURI = config.Configs["GridInfo"].GetString("login", loginURI); | 2071 | loginURI = config.Configs["GridInfo"].GetString("login", loginURI); |
2072 | |||
2073 | if (String.IsNullOrEmpty(loginURI)) | ||
2074 | loginURI = GridUserInfo(InfoType.Login); | ||
2075 | |||
1963 | return loginURI; | 2076 | return loginURI; |
1964 | } | 2077 | } |
1965 | 2078 | ||
2079 | public string osGetGridHomeURI() | ||
2080 | { | ||
2081 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); | ||
2082 | m_host.AddScriptLPS(1); | ||
2083 | |||
2084 | string HomeURI = String.Empty; | ||
2085 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
2086 | |||
2087 | if (config.Configs["LoginService"] != null) | ||
2088 | HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI); | ||
2089 | |||
2090 | if (String.IsNullOrEmpty(HomeURI)) | ||
2091 | HomeURI = GridUserInfo(InfoType.Home); | ||
2092 | |||
2093 | return HomeURI; | ||
2094 | } | ||
2095 | |||
2096 | public string osGetGridCustom(string key) | ||
2097 | { | ||
2098 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); | ||
2099 | m_host.AddScriptLPS(1); | ||
2100 | |||
2101 | string retval = String.Empty; | ||
2102 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
2103 | |||
2104 | if (config.Configs["GridInfo"] != null) | ||
2105 | retval = config.Configs["GridInfo"].GetString(key, retval); | ||
2106 | |||
2107 | if (String.IsNullOrEmpty(retval)) | ||
2108 | retval = GridUserInfo(InfoType.Custom, key); | ||
2109 | |||
2110 | return retval; | ||
2111 | } | ||
2112 | |||
1966 | public LSL_String osFormatString(string str, LSL_List strings) | 2113 | public LSL_String osFormatString(string str, LSL_List strings) |
1967 | { | 2114 | { |
1968 | CheckThreatLevel(ThreatLevel.Low, "osFormatString"); | 2115 | CheckThreatLevel(ThreatLevel.Low, "osFormatString"); |
@@ -2064,10 +2211,45 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2064 | return retVal; | 2211 | return retVal; |
2065 | } | 2212 | } |
2066 | 2213 | ||
2214 | public LSL_Integer osIsNpc(LSL_Key npc) | ||
2215 | { | ||
2216 | CheckThreatLevel(ThreatLevel.None, "osIsNpc"); | ||
2217 | m_host.AddScriptLPS(1); | ||
2218 | |||
2219 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2220 | if (module != null) | ||
2221 | { | ||
2222 | UUID npcId; | ||
2223 | if (UUID.TryParse(npc.m_string, out npcId)) | ||
2224 | if (module.IsNPC(npcId, World)) | ||
2225 | return ScriptBaseClass.TRUE; | ||
2226 | } | ||
2227 | |||
2228 | return ScriptBaseClass.FALSE; | ||
2229 | } | ||
2230 | |||
2067 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) | 2231 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) |
2068 | { | 2232 | { |
2069 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2233 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2234 | m_host.AddScriptLPS(1); | ||
2235 | |||
2236 | return NpcCreate(firstname, lastname, position, notecard, false, true); | ||
2237 | } | ||
2238 | |||
2239 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) | ||
2240 | { | ||
2241 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | ||
2242 | m_host.AddScriptLPS(1); | ||
2070 | 2243 | ||
2244 | return NpcCreate( | ||
2245 | firstname, lastname, position, notecard, | ||
2246 | (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, | ||
2247 | (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); | ||
2248 | } | ||
2249 | |||
2250 | private LSL_Key NpcCreate( | ||
2251 | string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent) | ||
2252 | { | ||
2071 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2253 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2072 | if (module != null) | 2254 | if (module != null) |
2073 | { | 2255 | { |
@@ -2096,9 +2278,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2096 | if (appearance == null) | 2278 | if (appearance == null) |
2097 | return new LSL_Key(UUID.Zero.ToString()); | 2279 | return new LSL_Key(UUID.Zero.ToString()); |
2098 | 2280 | ||
2281 | UUID ownerID = UUID.Zero; | ||
2282 | if (owned) | ||
2283 | ownerID = m_host.OwnerID; | ||
2099 | UUID x = module.CreateNPC(firstname, | 2284 | UUID x = module.CreateNPC(firstname, |
2100 | lastname, | 2285 | lastname, |
2101 | new Vector3((float) position.x, (float) position.y, (float) position.z), | 2286 | new Vector3((float) position.x, (float) position.y, (float) position.z), |
2287 | ownerID, | ||
2288 | senseAsAgent, | ||
2102 | World, | 2289 | World, |
2103 | appearance); | 2290 | appearance); |
2104 | 2291 | ||
@@ -2117,6 +2304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2117 | public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) | 2304 | public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) |
2118 | { | 2305 | { |
2119 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); | 2306 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); |
2307 | m_host.AddScriptLPS(1); | ||
2120 | 2308 | ||
2121 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2309 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2122 | 2310 | ||
@@ -2126,7 +2314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2126 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2314 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2127 | return new LSL_Key(UUID.Zero.ToString()); | 2315 | return new LSL_Key(UUID.Zero.ToString()); |
2128 | 2316 | ||
2129 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2317 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2130 | return new LSL_Key(UUID.Zero.ToString()); | 2318 | return new LSL_Key(UUID.Zero.ToString()); |
2131 | 2319 | ||
2132 | return SaveAppearanceToNotecard(npcId, notecard); | 2320 | return SaveAppearanceToNotecard(npcId, notecard); |
@@ -2138,6 +2326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2138 | public void osNpcLoadAppearance(LSL_Key npc, string notecard) | 2326 | public void osNpcLoadAppearance(LSL_Key npc, string notecard) |
2139 | { | 2327 | { |
2140 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); | 2328 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); |
2329 | m_host.AddScriptLPS(1); | ||
2141 | 2330 | ||
2142 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2331 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2143 | 2332 | ||
@@ -2147,6 +2336,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2147 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2336 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2148 | return; | 2337 | return; |
2149 | 2338 | ||
2339 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) | ||
2340 | return; | ||
2341 | |||
2150 | string appearanceSerialized = LoadNotecard(notecard); | 2342 | string appearanceSerialized = LoadNotecard(notecard); |
2151 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2343 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); |
2152 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2344 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); |
@@ -2159,9 +2351,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2159 | } | 2351 | } |
2160 | } | 2352 | } |
2161 | 2353 | ||
2354 | public LSL_Key osNpcGetOwner(LSL_Key npc) | ||
2355 | { | ||
2356 | CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner"); | ||
2357 | m_host.AddScriptLPS(1); | ||
2358 | |||
2359 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | ||
2360 | if (npcModule != null) | ||
2361 | { | ||
2362 | UUID npcId; | ||
2363 | if (UUID.TryParse(npc.m_string, out npcId)) | ||
2364 | { | ||
2365 | UUID owner = npcModule.GetOwner(npcId); | ||
2366 | if (owner != UUID.Zero) | ||
2367 | return new LSL_Key(owner.ToString()); | ||
2368 | else | ||
2369 | return npc; | ||
2370 | } | ||
2371 | } | ||
2372 | |||
2373 | return new LSL_Key(UUID.Zero.ToString()); | ||
2374 | } | ||
2375 | |||
2162 | public LSL_Vector osNpcGetPos(LSL_Key npc) | 2376 | public LSL_Vector osNpcGetPos(LSL_Key npc) |
2163 | { | 2377 | { |
2164 | CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); | 2378 | CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); |
2379 | m_host.AddScriptLPS(1); | ||
2165 | 2380 | ||
2166 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2381 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2167 | if (npcModule != null) | 2382 | if (npcModule != null) |
@@ -2170,7 +2385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2170 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2385 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2171 | return new LSL_Vector(0, 0, 0); | 2386 | return new LSL_Vector(0, 0, 0); |
2172 | 2387 | ||
2173 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2388 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2174 | return new LSL_Vector(0, 0, 0); | 2389 | return new LSL_Vector(0, 0, 0); |
2175 | 2390 | ||
2176 | Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; | 2391 | Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; |
@@ -2183,6 +2398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2183 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) | 2398 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) |
2184 | { | 2399 | { |
2185 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); | 2400 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); |
2401 | m_host.AddScriptLPS(1); | ||
2186 | 2402 | ||
2187 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2403 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2188 | if (module != null) | 2404 | if (module != null) |
@@ -2190,6 +2406,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2190 | UUID npcId; | 2406 | UUID npcId; |
2191 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2407 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2192 | return; | 2408 | return; |
2409 | |||
2410 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2411 | return; | ||
2193 | 2412 | ||
2194 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); | 2413 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); |
2195 | module.MoveToTarget(npcId, World, pos, false, true); | 2414 | module.MoveToTarget(npcId, World, pos, false, true); |
@@ -2199,6 +2418,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2199 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) | 2418 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) |
2200 | { | 2419 | { |
2201 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); | 2420 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); |
2421 | m_host.AddScriptLPS(1); | ||
2202 | 2422 | ||
2203 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2423 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2204 | if (module != null) | 2424 | if (module != null) |
@@ -2207,6 +2427,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2207 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2427 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2208 | return; | 2428 | return; |
2209 | 2429 | ||
2430 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2431 | return; | ||
2432 | |||
2210 | Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); | 2433 | Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); |
2211 | module.MoveToTarget( | 2434 | module.MoveToTarget( |
2212 | new UUID(npc.m_string), | 2435 | new UUID(npc.m_string), |
@@ -2220,6 +2443,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2220 | public LSL_Rotation osNpcGetRot(LSL_Key npc) | 2443 | public LSL_Rotation osNpcGetRot(LSL_Key npc) |
2221 | { | 2444 | { |
2222 | CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); | 2445 | CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); |
2446 | m_host.AddScriptLPS(1); | ||
2223 | 2447 | ||
2224 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2448 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2225 | if (npcModule != null) | 2449 | if (npcModule != null) |
@@ -2228,7 +2452,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2228 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2452 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2229 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2453 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
2230 | 2454 | ||
2231 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2455 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2232 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2456 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
2233 | 2457 | ||
2234 | ScenePresence sp = World.GetScenePresence(npcId); | 2458 | ScenePresence sp = World.GetScenePresence(npcId); |
@@ -2243,6 +2467,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2243 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) | 2467 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) |
2244 | { | 2468 | { |
2245 | CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); | 2469 | CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); |
2470 | m_host.AddScriptLPS(1); | ||
2246 | 2471 | ||
2247 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2472 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2248 | if (npcModule != null) | 2473 | if (npcModule != null) |
@@ -2251,7 +2476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2251 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2476 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2252 | return; | 2477 | return; |
2253 | 2478 | ||
2254 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2479 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2255 | return; | 2480 | return; |
2256 | 2481 | ||
2257 | ScenePresence sp = World.GetScenePresence(npcId); | 2482 | ScenePresence sp = World.GetScenePresence(npcId); |
@@ -2262,53 +2487,115 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2262 | public void osNpcStopMoveToTarget(LSL_Key npc) | 2487 | public void osNpcStopMoveToTarget(LSL_Key npc) |
2263 | { | 2488 | { |
2264 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); | 2489 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); |
2490 | m_host.AddScriptLPS(1); | ||
2265 | 2491 | ||
2266 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2492 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2267 | if (module != null) | 2493 | if (module != null) |
2268 | module.StopMoveToTarget(new UUID(npc.m_string), World); | 2494 | { |
2495 | UUID npcId = new UUID(npc.m_string); | ||
2496 | |||
2497 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2498 | return; | ||
2499 | |||
2500 | module.StopMoveToTarget(npcId, World); | ||
2501 | } | ||
2269 | } | 2502 | } |
2270 | 2503 | ||
2271 | public void osNpcSay(LSL_Key npc, string message) | 2504 | public void osNpcSay(LSL_Key npc, string message) |
2272 | { | 2505 | { |
2273 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 2506 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
2507 | m_host.AddScriptLPS(1); | ||
2274 | 2508 | ||
2275 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2509 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2276 | if (module != null) | 2510 | if (module != null) |
2277 | { | 2511 | { |
2278 | module.Say(new UUID(npc.m_string), World, message); | 2512 | UUID npcId = new UUID(npc.m_string); |
2513 | |||
2514 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2515 | return; | ||
2516 | |||
2517 | module.Say(npcId, World, message); | ||
2279 | } | 2518 | } |
2280 | } | 2519 | } |
2281 | 2520 | ||
2282 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | 2521 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) |
2283 | { | 2522 | { |
2284 | CheckThreatLevel(ThreatLevel.High, "osNpcSit"); | 2523 | CheckThreatLevel(ThreatLevel.High, "osNpcSit"); |
2524 | m_host.AddScriptLPS(1); | ||
2285 | 2525 | ||
2286 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2526 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2287 | if (module != null) | 2527 | if (module != null) |
2288 | { | 2528 | { |
2289 | module.Sit(new UUID(npc.m_string), new UUID(target.m_string), World); | 2529 | UUID npcId = new UUID(npc.m_string); |
2530 | |||
2531 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2532 | return; | ||
2533 | |||
2534 | module.Sit(npcId, new UUID(target.m_string), World); | ||
2290 | } | 2535 | } |
2291 | } | 2536 | } |
2292 | 2537 | ||
2293 | public void osNpcStand(LSL_Key npc) | 2538 | public void osNpcStand(LSL_Key npc) |
2294 | { | 2539 | { |
2295 | CheckThreatLevel(ThreatLevel.High, "osNpcStand"); | 2540 | CheckThreatLevel(ThreatLevel.High, "osNpcStand"); |
2541 | m_host.AddScriptLPS(1); | ||
2296 | 2542 | ||
2297 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2543 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2298 | if (module != null) | 2544 | if (module != null) |
2299 | { | 2545 | { |
2300 | module.Stand(new UUID(npc.m_string), World); | 2546 | UUID npcId = new UUID(npc.m_string); |
2547 | |||
2548 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2549 | return; | ||
2550 | |||
2551 | module.Stand(npcId, World); | ||
2301 | } | 2552 | } |
2302 | } | 2553 | } |
2303 | 2554 | ||
2304 | public void osNpcRemove(LSL_Key npc) | 2555 | public void osNpcRemove(LSL_Key npc) |
2305 | { | 2556 | { |
2306 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); | 2557 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); |
2558 | m_host.AddScriptLPS(1); | ||
2559 | |||
2560 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2561 | if (module != null) | ||
2562 | { | ||
2563 | UUID npcId = new UUID(npc.m_string); | ||
2564 | |||
2565 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2566 | return; | ||
2567 | |||
2568 | module.DeleteNPC(npcId, World); | ||
2569 | } | ||
2570 | } | ||
2571 | |||
2572 | public void osNpcPlayAnimation(LSL_Key npc, string animation) | ||
2573 | { | ||
2574 | CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); | ||
2575 | m_host.AddScriptLPS(1); | ||
2576 | |||
2577 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2578 | if (module != null) | ||
2579 | { | ||
2580 | UUID npcID = new UUID(npc.m_string); | ||
2581 | |||
2582 | if (module.CheckPermissions(npcID, m_host.OwnerID)) | ||
2583 | AvatarPlayAnimation(npcID.ToString(), animation); | ||
2584 | } | ||
2585 | } | ||
2586 | |||
2587 | public void osNpcStopAnimation(LSL_Key npc, string animation) | ||
2588 | { | ||
2589 | CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); | ||
2590 | m_host.AddScriptLPS(1); | ||
2307 | 2591 | ||
2308 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2592 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2309 | if (module != null) | 2593 | if (module != null) |
2310 | { | 2594 | { |
2311 | module.DeleteNPC(new UUID(npc.m_string), World); | 2595 | UUID npcID = new UUID(npc.m_string); |
2596 | |||
2597 | if (module.CheckPermissions(npcID, m_host.OwnerID)) | ||
2598 | AvatarPlayAnimation(npcID.ToString(), animation); | ||
2312 | } | 2599 | } |
2313 | } | 2600 | } |
2314 | 2601 | ||
@@ -2320,6 +2607,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2320 | public LSL_Key osOwnerSaveAppearance(string notecard) | 2607 | public LSL_Key osOwnerSaveAppearance(string notecard) |
2321 | { | 2608 | { |
2322 | CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); | 2609 | CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); |
2610 | m_host.AddScriptLPS(1); | ||
2323 | 2611 | ||
2324 | return SaveAppearanceToNotecard(m_host.OwnerID, notecard); | 2612 | return SaveAppearanceToNotecard(m_host.OwnerID, notecard); |
2325 | } | 2613 | } |
@@ -2327,6 +2615,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2327 | public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) | 2615 | public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) |
2328 | { | 2616 | { |
2329 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); | 2617 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); |
2618 | m_host.AddScriptLPS(1); | ||
2330 | 2619 | ||
2331 | return SaveAppearanceToNotecard(avatarId, notecard); | 2620 | return SaveAppearanceToNotecard(avatarId, notecard); |
2332 | } | 2621 | } |
@@ -2377,6 +2666,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2377 | public LSL_Key osGetMapTexture() | 2666 | public LSL_Key osGetMapTexture() |
2378 | { | 2667 | { |
2379 | CheckThreatLevel(ThreatLevel.None, "osGetMapTexture"); | 2668 | CheckThreatLevel(ThreatLevel.None, "osGetMapTexture"); |
2669 | m_host.AddScriptLPS(1); | ||
2670 | |||
2380 | return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); | 2671 | return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); |
2381 | } | 2672 | } |
2382 | 2673 | ||
@@ -2388,6 +2679,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2388 | public LSL_Key osGetRegionMapTexture(string regionName) | 2679 | public LSL_Key osGetRegionMapTexture(string regionName) |
2389 | { | 2680 | { |
2390 | CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); | 2681 | CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); |
2682 | m_host.AddScriptLPS(1); | ||
2683 | |||
2391 | Scene scene = m_ScriptEngine.World; | 2684 | Scene scene = m_ScriptEngine.World; |
2392 | UUID key = UUID.Zero; | 2685 | UUID key = UUID.Zero; |
2393 | GridRegion region; | 2686 | GridRegion region; |
@@ -2453,6 +2746,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2453 | public void osKickAvatar(string FirstName,string SurName,string alert) | 2746 | public void osKickAvatar(string FirstName,string SurName,string alert) |
2454 | { | 2747 | { |
2455 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 2748 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
2749 | m_host.AddScriptLPS(1); | ||
2750 | |||
2456 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 2751 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
2457 | { | 2752 | { |
2458 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 2753 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
@@ -2587,6 +2882,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2587 | public LSL_List osGetAvatarList() | 2882 | public LSL_List osGetAvatarList() |
2588 | { | 2883 | { |
2589 | CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); | 2884 | CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); |
2885 | m_host.AddScriptLPS(1); | ||
2590 | 2886 | ||
2591 | LSL_List result = new LSL_List(); | 2887 | LSL_List result = new LSL_List(); |
2592 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) | 2888 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) |
@@ -2611,6 +2907,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2611 | public LSL_String osUnixTimeToTimestamp(long time) | 2907 | public LSL_String osUnixTimeToTimestamp(long time) |
2612 | { | 2908 | { |
2613 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); | 2909 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); |
2910 | m_host.AddScriptLPS(1); | ||
2911 | |||
2614 | long baseTicks = 621355968000000000; | 2912 | long baseTicks = 621355968000000000; |
2615 | long tickResolution = 10000000; | 2913 | long tickResolution = 10000000; |
2616 | long epochTicks = (time * tickResolution) + baseTicks; | 2914 | long epochTicks = (time * tickResolution) + baseTicks; |