diff options
author | Melanie | 2013-01-23 19:31:27 +0000 |
---|---|---|
committer | Melanie | 2013-01-23 19:31:27 +0000 |
commit | fc1c77b42d6e35ecb6ad371484f355a3430018b1 (patch) | |
tree | e3c5fed0229a21902aa85a80b587e98fe397ac6c /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Remove the return value from llGiveMoney (it was a LSL extension of OpenSim) and (diff) | |
download | opensim-SC-fc1c77b42d6e35ecb6ad371484f355a3430018b1.zip opensim-SC-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.gz opensim-SC-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.bz2 opensim-SC-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
4 files changed, 71 insertions, 47 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4ed6d75..9df04df 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3039,42 +3039,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3039 | return src.ToLower(); | 3039 | return src.ToLower(); |
3040 | } | 3040 | } |
3041 | 3041 | ||
3042 | public LSL_Integer llGiveMoney(string destination, int amount) | 3042 | public void llGiveMoney(string destination, int amount) |
3043 | { | 3043 | { |
3044 | m_host.AddScriptLPS(1); | 3044 | Util.FireAndForget(x => |
3045 | |||
3046 | if (m_item.PermsGranter == UUID.Zero) | ||
3047 | return 0; | ||
3048 | |||
3049 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) | ||
3050 | { | 3045 | { |
3051 | LSLError("No permissions to give money"); | 3046 | m_host.AddScriptLPS(1); |
3052 | return 0; | ||
3053 | } | ||
3054 | 3047 | ||
3055 | UUID toID = new UUID(); | 3048 | if (m_item.PermsGranter == UUID.Zero) |
3049 | return; | ||
3056 | 3050 | ||
3057 | if (!UUID.TryParse(destination, out toID)) | 3051 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) |
3058 | { | 3052 | { |
3059 | LSLError("Bad key in llGiveMoney"); | 3053 | LSLError("No permissions to give money"); |
3060 | return 0; | 3054 | return; |
3061 | } | 3055 | } |
3062 | 3056 | ||
3063 | IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); | 3057 | UUID toID = new UUID(); |
3064 | 3058 | ||
3065 | if (money == null) | 3059 | if (!UUID.TryParse(destination, out toID)) |
3066 | { | 3060 | { |
3067 | NotImplemented("llGiveMoney"); | 3061 | LSLError("Bad key in llGiveMoney"); |
3068 | return 0; | 3062 | return; |
3069 | } | 3063 | } |
3070 | 3064 | ||
3071 | bool result = money.ObjectGiveMoney( | 3065 | IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); |
3072 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | ||
3073 | 3066 | ||
3074 | if (result) | 3067 | if (money == null) |
3075 | return 1; | 3068 | { |
3069 | NotImplemented("llGiveMoney"); | ||
3070 | return; | ||
3071 | } | ||
3076 | 3072 | ||
3077 | return 0; | 3073 | money.ObjectGiveMoney( |
3074 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | ||
3075 | }); | ||
3078 | } | 3076 | } |
3079 | 3077 | ||
3080 | public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) | 3078 | public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) |
@@ -7330,7 +7328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7330 | { | 7328 | { |
7331 | m_host.AddScriptLPS(1); | 7329 | m_host.AddScriptLPS(1); |
7332 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7330 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7333 | if (xmlrpcMod.IsEnabled()) | 7331 | if (xmlrpcMod != null && xmlrpcMod.IsEnabled()) |
7334 | { | 7332 | { |
7335 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); | 7333 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); |
7336 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | 7334 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); |
@@ -7362,6 +7360,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7362 | m_host.AddScriptLPS(1); | 7360 | m_host.AddScriptLPS(1); |
7363 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7361 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7364 | ScriptSleep(3000); | 7362 | ScriptSleep(3000); |
7363 | if (xmlrpcMod == null) | ||
7364 | return ""; | ||
7365 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); | 7365 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); |
7366 | } | 7366 | } |
7367 | 7367 | ||
@@ -7369,7 +7369,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7369 | { | 7369 | { |
7370 | m_host.AddScriptLPS(1); | 7370 | m_host.AddScriptLPS(1); |
7371 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7371 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7372 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | 7372 | if (xmlrpcMod != null) |
7373 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | ||
7373 | ScriptSleep(3000); | 7374 | ScriptSleep(3000); |
7374 | } | 7375 | } |
7375 | 7376 | ||
@@ -7384,7 +7385,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7384 | } | 7385 | } |
7385 | 7386 | ||
7386 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7387 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7387 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); | 7388 | if (xmlrpcMod != null) |
7389 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); | ||
7388 | ScriptSleep(1000); | 7390 | ScriptSleep(1000); |
7389 | } | 7391 | } |
7390 | 7392 | ||
@@ -7797,8 +7799,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7797 | m_host.AddScriptLPS(1); | 7799 | m_host.AddScriptLPS(1); |
7798 | 7800 | ||
7799 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); | 7801 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); |
7800 | |||
7801 | ScriptSleep(200); | ||
7802 | } | 7802 | } |
7803 | 7803 | ||
7804 | private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) | 7804 | private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) |
@@ -12677,7 +12677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12677 | } | 12677 | } |
12678 | 12678 | ||
12679 | bool result = money.ObjectGiveMoney( | 12679 | bool result = money.ObjectGiveMoney( |
12680 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | 12680 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn); |
12681 | 12681 | ||
12682 | if (result) | 12682 | if (result) |
12683 | { | 12683 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d6ce069..10ec34d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1857,17 +1857,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1857 | { | 1857 | { |
1858 | UUID assetID = UUID.Zero; | 1858 | UUID assetID = UUID.Zero; |
1859 | 1859 | ||
1860 | if (!UUID.TryParse(notecardNameOrUuid, out assetID)) | 1860 | bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID); |
1861 | |||
1862 | if (!notecardNameIsUUID) | ||
1861 | { | 1863 | { |
1862 | m_host.TaskInventory.LockItemsForRead(true); | 1864 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); |
1863 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1864 | { | ||
1865 | if (item.Type == 7 && item.Name == notecardNameOrUuid) | ||
1866 | { | ||
1867 | assetID = item.AssetID; | ||
1868 | } | ||
1869 | } | ||
1870 | m_host.TaskInventory.LockItemsForRead(false); | ||
1871 | } | 1865 | } |
1872 | 1866 | ||
1873 | if (assetID == UUID.Zero) | 1867 | if (assetID == UUID.Zero) |
@@ -1878,7 +1872,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1878 | AssetBase a = World.AssetService.Get(assetID.ToString()); | 1872 | AssetBase a = World.AssetService.Get(assetID.ToString()); |
1879 | 1873 | ||
1880 | if (a == null) | 1874 | if (a == null) |
1881 | return UUID.Zero; | 1875 | { |
1876 | // Whoops, it's still possible here that the notecard name was properly | ||
1877 | // formatted like a UUID but isn't an asset UUID so lets look it up by name after all | ||
1878 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); | ||
1879 | if (assetID == UUID.Zero) | ||
1880 | return UUID.Zero; | ||
1881 | |||
1882 | if (!NotecardCache.IsCached(assetID)) | ||
1883 | { | ||
1884 | a = World.AssetService.Get(assetID.ToString()); | ||
1885 | |||
1886 | if (a == null) | ||
1887 | { | ||
1888 | return UUID.Zero; | ||
1889 | } | ||
1890 | } | ||
1891 | } | ||
1882 | 1892 | ||
1883 | string data = Encoding.UTF8.GetString(a.Data); | 1893 | string data = Encoding.UTF8.GetString(a.Data); |
1884 | NotecardCache.Cache(assetID, data); | 1894 | NotecardCache.Cache(assetID, data); |
@@ -1886,6 +1896,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1886 | 1896 | ||
1887 | return assetID; | 1897 | return assetID; |
1888 | } | 1898 | } |
1899 | protected UUID SearchTaskInventoryForAssetId(string name) | ||
1900 | { | ||
1901 | UUID assetId = UUID.Zero; | ||
1902 | m_host.TaskInventory.LockItemsForRead(true); | ||
1903 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1904 | { | ||
1905 | if (item.Type == 7 && item.Name == name) | ||
1906 | { | ||
1907 | assetId = item.AssetID; | ||
1908 | } | ||
1909 | } | ||
1910 | m_host.TaskInventory.LockItemsForRead(false); | ||
1911 | return assetId; | ||
1912 | } | ||
1889 | 1913 | ||
1890 | /// <summary> | 1914 | /// <summary> |
1891 | /// Directly get an entire notecard at once. | 1915 | /// Directly get an entire notecard at once. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 9bf6f9b..8eeb4d2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -208,7 +208,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
208 | LSL_Float llGetWallclock(); | 208 | LSL_Float llGetWallclock(); |
209 | void llGiveInventory(string destination, string inventory); | 209 | void llGiveInventory(string destination, string inventory); |
210 | void llGiveInventoryList(string destination, string category, LSL_List inventory); | 210 | void llGiveInventoryList(string destination, string category, LSL_List inventory); |
211 | LSL_Integer llGiveMoney(string destination, int amount); | 211 | void llGiveMoney(string destination, int amount); |
212 | LSL_String llTransferLindenDollars(string destination, int amount); | 212 | LSL_String llTransferLindenDollars(string destination, int amount); |
213 | void llGodLikeRezObject(string inventory, LSL_Vector pos); | 213 | void llGodLikeRezObject(string inventory, LSL_Vector pos); |
214 | LSL_Float llGround(LSL_Vector offset); | 214 | LSL_Float llGround(LSL_Vector offset); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 8ecc4f8..ef71d7b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -876,9 +876,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
876 | m_LSL_Functions.llGiveInventoryList(destination, category, inventory); | 876 | m_LSL_Functions.llGiveInventoryList(destination, category, inventory); |
877 | } | 877 | } |
878 | 878 | ||
879 | public LSL_Integer llGiveMoney(string destination, int amount) | 879 | public void llGiveMoney(string destination, int amount) |
880 | { | 880 | { |
881 | return m_LSL_Functions.llGiveMoney(destination, amount); | 881 | m_LSL_Functions.llGiveMoney(destination, amount); |
882 | } | 882 | } |
883 | 883 | ||
884 | public LSL_String llTransferLindenDollars(string destination, int amount) | 884 | public LSL_String llTransferLindenDollars(string destination, int amount) |