diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
3 files changed, 63 insertions, 127 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8e5c203..62eae76 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -39,7 +39,7 @@ using OpenMetaverse; | |||
39 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
40 | using OpenSim; | 40 | using OpenSim; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Communications.Cache; | 42 | |
43 | using OpenSim.Region.CoreModules; | 43 | using OpenSim.Region.CoreModules; |
44 | using OpenSim.Region.CoreModules.World.Land; | 44 | using OpenSim.Region.CoreModules.World.Land; |
45 | using OpenSim.Region.CoreModules.World.Terrain; | 45 | using OpenSim.Region.CoreModules.World.Terrain; |
@@ -53,9 +53,9 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | |||
53 | using OpenSim.Region.ScriptEngine.Interfaces; | 53 | using OpenSim.Region.ScriptEngine.Interfaces; |
54 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 54 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
55 | using OpenSim.Services.Interfaces; | 55 | using OpenSim.Services.Interfaces; |
56 | |||
57 | using PrimType = OpenSim.Region.Framework.Scenes.PrimType; | ||
58 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 56 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
57 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | ||
58 | using PrimType = OpenSim.Region.Framework.Scenes.PrimType; | ||
59 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 59 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
60 | 60 | ||
61 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | 61 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
@@ -917,10 +917,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
917 | public string resolveName(UUID objecUUID) | 917 | public string resolveName(UUID objecUUID) |
918 | { | 918 | { |
919 | // try avatar username surname | 919 | // try avatar username surname |
920 | CachedUserInfo profile = World.CommsManager.UserProfileCacheService.GetUserDetails(objecUUID); | 920 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, objecUUID); |
921 | if (profile != null && profile.UserProfile != null) | 921 | if (account != null) |
922 | { | 922 | { |
923 | string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName; | 923 | string avatarname = account.Name; |
924 | return avatarname; | 924 | return avatarname; |
925 | } | 925 | } |
926 | // try an scene object | 926 | // try an scene object |
@@ -3067,9 +3067,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3067 | 3067 | ||
3068 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3068 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
3069 | 3069 | ||
3070 | m_ScriptEngine.World.AttachObject(presence.ControllingClient, | 3070 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3071 | grp.LocalId, (uint)attachment, Quaternion.Identity, | 3071 | if (attachmentsModule != null) |
3072 | Vector3.Zero, false); | 3072 | attachmentsModule.AttachObject( |
3073 | presence.ControllingClient, grp.LocalId, | ||
3074 | (uint)attachment, Quaternion.Identity, Vector3.Zero, false); | ||
3073 | } | 3075 | } |
3074 | } | 3076 | } |
3075 | 3077 | ||
@@ -3106,8 +3108,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3106 | 3108 | ||
3107 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3109 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
3108 | 3110 | ||
3109 | m_ScriptEngine.World.DetachSingleAttachmentToInv(itemID, | 3111 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3110 | presence.ControllingClient); | 3112 | if (attachmentsModule != null) |
3113 | attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); | ||
3111 | } | 3114 | } |
3112 | } | 3115 | } |
3113 | 3116 | ||
@@ -4083,13 +4086,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4083 | 4086 | ||
4084 | UUID uuid = (UUID)id; | 4087 | UUID uuid = (UUID)id; |
4085 | 4088 | ||
4086 | UserProfileData userProfile = | 4089 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); |
4087 | World.CommsManager.UserService.GetUserProfile(uuid); | ||
4088 | 4090 | ||
4089 | UserAgentData userAgent = | 4091 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); |
4090 | World.CommsManager.UserService.GetAgentByUUID(uuid); | 4092 | PresenceInfo pinfo = PresenceInfo.GetOnlinePresence(pinfos); |
4091 | 4093 | ||
4092 | if (userProfile == null || userAgent == null) | 4094 | if (pinfo == null) |
4093 | return UUID.Zero.ToString(); | 4095 | return UUID.Zero.ToString(); |
4094 | 4096 | ||
4095 | string reply = String.Empty; | 4097 | string reply = String.Empty; |
@@ -4098,17 +4100,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4098 | { | 4100 | { |
4099 | case 1: // DATA_ONLINE (0|1) | 4101 | case 1: // DATA_ONLINE (0|1) |
4100 | // TODO: implement fetching of this information | 4102 | // TODO: implement fetching of this information |
4101 | if (userProfile.CurrentAgent!=null && userProfile.CurrentAgent.AgentOnline) | 4103 | if (pinfo != null) |
4102 | reply = "1"; | 4104 | reply = "1"; |
4103 | else | 4105 | else |
4104 | reply = "0"; | 4106 | reply = "0"; |
4105 | break; | 4107 | break; |
4106 | case 2: // DATA_NAME (First Last) | 4108 | case 2: // DATA_NAME (First Last) |
4107 | reply = userProfile.FirstName + " " + userProfile.SurName; | 4109 | reply = account.FirstName + " " + account.LastName; |
4108 | break; | 4110 | break; |
4109 | case 3: // DATA_BORN (YYYY-MM-DD) | 4111 | case 3: // DATA_BORN (YYYY-MM-DD) |
4110 | DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); | 4112 | DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); |
4111 | born = born.AddSeconds(userProfile.Created); | 4113 | born = born.AddSeconds(account.Created); |
4112 | reply = born.ToString("yyyy-MM-dd"); | 4114 | reply = born.ToString("yyyy-MM-dd"); |
4113 | break; | 4115 | break; |
4114 | case 4: // DATA_RATING (0,0,0,0,0,0) | 4116 | case 4: // DATA_RATING (0,0,0,0,0,0) |
@@ -4204,10 +4206,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4204 | ScriptSleep(5000); | 4206 | ScriptSleep(5000); |
4205 | } | 4207 | } |
4206 | 4208 | ||
4207 | public void llTextBox(string avatar, string message, int chat_channel) | 4209 | public void llTextBox(string agent, string message, int chatChannel) |
4208 | { | 4210 | { |
4211 | IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); | ||
4212 | |||
4213 | if (dm == null) | ||
4214 | return; | ||
4215 | |||
4209 | m_host.AddScriptLPS(1); | 4216 | m_host.AddScriptLPS(1); |
4210 | NotImplemented("llTextBox"); | 4217 | UUID av = new UUID(); |
4218 | if (!UUID.TryParse(agent,out av)) | ||
4219 | { | ||
4220 | LSLError("First parameter to llDialog needs to be a key"); | ||
4221 | return; | ||
4222 | } | ||
4223 | |||
4224 | if( message == string.Empty) | ||
4225 | { | ||
4226 | ShoutError("Trying to use llTextBox with empty message."); | ||
4227 | } | ||
4228 | else if (message.Length > 512) | ||
4229 | { | ||
4230 | ShoutError("Trying to use llTextBox with message over 512 characters."); | ||
4231 | } | ||
4232 | else | ||
4233 | { | ||
4234 | dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID); | ||
4235 | ScriptSleep(1000); | ||
4236 | } | ||
4211 | } | 4237 | } |
4212 | 4238 | ||
4213 | public void llModifyLand(int action, int brush) | 4239 | public void llModifyLand(int action, int brush) |
@@ -4222,6 +4248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4222 | 4248 | ||
4223 | public void llCollisionSound(string impact_sound, double impact_volume) | 4249 | public void llCollisionSound(string impact_sound, double impact_volume) |
4224 | { | 4250 | { |
4251 | |||
4225 | m_host.AddScriptLPS(1); | 4252 | m_host.AddScriptLPS(1); |
4226 | // TODO: Parameter check logic required. | 4253 | // TODO: Parameter check logic required. |
4227 | UUID soundId = UUID.Zero; | 4254 | UUID soundId = UUID.Zero; |
@@ -10134,90 +10161,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10134 | 10161 | ||
10135 | Notecard nc = new Notecard(); | 10162 | Notecard nc = new Notecard(); |
10136 | nc.lastRef = DateTime.Now; | 10163 | nc.lastRef = DateTime.Now; |
10137 | nc.text = ParseText(text.Replace("\r", "").Split('\n')); | 10164 | nc.text = SLUtil.ParseNotecardToList(text).ToArray(); |
10138 | m_Notecards[assetID] = nc; | 10165 | m_Notecards[assetID] = nc; |
10139 | } | 10166 | } |
10140 | } | 10167 | } |
10141 | 10168 | ||
10142 | protected static string[] ParseText(string[] input) | ||
10143 | { | ||
10144 | int idx = 0; | ||
10145 | int level = 0; | ||
10146 | List<string> output = new List<string>(); | ||
10147 | string[] words; | ||
10148 | |||
10149 | while (idx < input.Length) | ||
10150 | { | ||
10151 | if (input[idx] == "{") | ||
10152 | { | ||
10153 | level++; | ||
10154 | idx++; | ||
10155 | continue; | ||
10156 | } | ||
10157 | |||
10158 | if (input[idx]== "}") | ||
10159 | { | ||
10160 | level--; | ||
10161 | idx++; | ||
10162 | continue; | ||
10163 | } | ||
10164 | |||
10165 | switch (level) | ||
10166 | { | ||
10167 | case 0: | ||
10168 | words = input[idx].Split(' '); // Linden text ver | ||
10169 | // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard) | ||
10170 | if (words.Length < 3) | ||
10171 | return new String[0]; | ||
10172 | |||
10173 | int version = int.Parse(words[3]); | ||
10174 | if (version != 2) | ||
10175 | return new String[0]; | ||
10176 | break; | ||
10177 | case 1: | ||
10178 | words = input[idx].Split(' '); | ||
10179 | if (words[0] == "LLEmbeddedItems") | ||
10180 | break; | ||
10181 | if (words[0] == "Text") | ||
10182 | { | ||
10183 | int len = int.Parse(words[2]); | ||
10184 | idx++; | ||
10185 | |||
10186 | int count = -1; | ||
10187 | |||
10188 | while (count < len) | ||
10189 | { | ||
10190 | // int l = input[idx].Length; | ||
10191 | string ln = input[idx]; | ||
10192 | |||
10193 | int need = len-count-1; | ||
10194 | if (ln.Length > need) | ||
10195 | ln = ln.Substring(0, need); | ||
10196 | |||
10197 | output.Add(ln); | ||
10198 | count += ln.Length + 1; | ||
10199 | idx++; | ||
10200 | } | ||
10201 | |||
10202 | return output.ToArray(); | ||
10203 | } | ||
10204 | break; | ||
10205 | case 2: | ||
10206 | words = input[idx].Split(' '); // count | ||
10207 | if (words[0] == "count") | ||
10208 | { | ||
10209 | int c = int.Parse(words[1]); | ||
10210 | if (c > 0) | ||
10211 | return new String[0]; | ||
10212 | break; | ||
10213 | } | ||
10214 | break; | ||
10215 | } | ||
10216 | idx++; | ||
10217 | } | ||
10218 | return output.ToArray(); | ||
10219 | } | ||
10220 | |||
10221 | public static bool IsCached(UUID assetID) | 10169 | public static bool IsCached(UUID assetID) |
10222 | { | 10170 | { |
10223 | lock (m_Notecards) | 10171 | lock (m_Notecards) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1ddba1e..845834e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -36,12 +36,11 @@ using OpenMetaverse; | |||
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenSim; | 37 | using OpenSim; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications.Cache; | 39 | |
40 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | using OpenSim.Region.CoreModules.Avatar.NPC; | 41 | using OpenSim.Region.CoreModules.Avatar.NPC; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
45 | using OpenSim.Region.ScriptEngine.Shared; | 44 | using OpenSim.Region.ScriptEngine.Shared; |
46 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 45 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
47 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 46 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
@@ -607,21 +606,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
607 | // and convert the regionName to the target region | 606 | // and convert the regionName to the target region |
608 | if (regionName.Contains(".") && regionName.Contains(":")) | 607 | if (regionName.Contains(".") && regionName.Contains(":")) |
609 | { | 608 | { |
609 | List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
610 | // Try to link the region | 610 | // Try to link the region |
611 | IHyperlinkService hyperService = World.RequestModuleInterface<IHyperlinkService>(); | 611 | if (regions != null && regions.Count > 0) |
612 | if (hyperService != null) | ||
613 | { | 612 | { |
614 | GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient, | 613 | GridRegion regInfo = regions[0]; |
615 | regionName); | 614 | regionName = regInfo.RegionName; |
616 | // Get the region name | ||
617 | if (regInfo != null) | ||
618 | { | ||
619 | regionName = regInfo.RegionName; | ||
620 | } | ||
621 | else | ||
622 | { | ||
623 | // Might need to ping the client here in case of failure?? | ||
624 | } | ||
625 | } | 615 | } |
626 | } | 616 | } |
627 | presence.ControllingClient.SendTeleportLocationStart(); | 617 | presence.ControllingClient.SendTeleportLocationStart(); |
@@ -1482,7 +1472,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1482 | m_host.AddScriptLPS(1); | 1472 | m_host.AddScriptLPS(1); |
1483 | 1473 | ||
1484 | // Create new asset | 1474 | // Create new asset |
1485 | AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard); | 1475 | AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); |
1486 | asset.Description = "Script Generated Notecard"; | 1476 | asset.Description = "Script Generated Notecard"; |
1487 | string notecardData = String.Empty; | 1477 | string notecardData = String.Empty; |
1488 | 1478 | ||
@@ -1695,15 +1685,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1695 | { | 1685 | { |
1696 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); | 1686 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); |
1697 | 1687 | ||
1698 | CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(firstname, lastname); | 1688 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); |
1699 | 1689 | if (null == account) | |
1700 | if (null == userInfo) | ||
1701 | { | 1690 | { |
1702 | return UUID.Zero.ToString(); | 1691 | return UUID.Zero.ToString(); |
1703 | } | 1692 | } |
1704 | else | 1693 | else |
1705 | { | 1694 | { |
1706 | return userInfo.UserProfile.ID.ToString(); | 1695 | return account.PrincipalID.ToString(); |
1707 | } | 1696 | } |
1708 | } | 1697 | } |
1709 | 1698 | ||
@@ -1714,15 +1703,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1714 | 1703 | ||
1715 | if (UUID.TryParse(id, out key)) | 1704 | if (UUID.TryParse(id, out key)) |
1716 | { | 1705 | { |
1717 | CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(key); | 1706 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key); |
1718 | 1707 | if (null == account) | |
1719 | if (null == userInfo) | ||
1720 | { | 1708 | { |
1721 | return ""; | 1709 | return ""; |
1722 | } | 1710 | } |
1723 | else | 1711 | else |
1724 | { | 1712 | { |
1725 | return userInfo.UserProfile.Name; | 1713 | return account.Name; |
1726 | } | 1714 | } |
1727 | } | 1715 | } |
1728 | else | 1716 | else |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index b75a2e4..829fbb7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -29,7 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Communications.Cache; | 32 | |
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Region.ScriptEngine.Shared; | 34 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 35 | using OpenSim.Region.ScriptEngine.Shared.Api; |