mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Merge branch 'avination' into careminster
This commit is contained in:
@@ -3039,42 +3039,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return src.ToLower();
|
||||
}
|
||||
|
||||
public LSL_Integer llGiveMoney(string destination, int amount)
|
||||
public void llGiveMoney(string destination, int amount)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (m_item.PermsGranter == UUID.Zero)
|
||||
return 0;
|
||||
|
||||
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||
Util.FireAndForget(x =>
|
||||
{
|
||||
LSLError("No permissions to give money");
|
||||
return 0;
|
||||
}
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
UUID toID = new UUID();
|
||||
if (m_item.PermsGranter == UUID.Zero)
|
||||
return;
|
||||
|
||||
if (!UUID.TryParse(destination, out toID))
|
||||
{
|
||||
LSLError("Bad key in llGiveMoney");
|
||||
return 0;
|
||||
}
|
||||
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||
{
|
||||
LSLError("No permissions to give money");
|
||||
return;
|
||||
}
|
||||
|
||||
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||
UUID toID = new UUID();
|
||||
|
||||
if (money == null)
|
||||
{
|
||||
NotImplemented("llGiveMoney");
|
||||
return 0;
|
||||
}
|
||||
if (!UUID.TryParse(destination, out toID))
|
||||
{
|
||||
LSLError("Bad key in llGiveMoney");
|
||||
return;
|
||||
}
|
||||
|
||||
bool result = money.ObjectGiveMoney(
|
||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
|
||||
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||
|
||||
if (result)
|
||||
return 1;
|
||||
if (money == null)
|
||||
{
|
||||
NotImplemented("llGiveMoney");
|
||||
return;
|
||||
}
|
||||
|
||||
return 0;
|
||||
money.ObjectGiveMoney(
|
||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
if (xmlrpcMod.IsEnabled())
|
||||
if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
|
||||
{
|
||||
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
|
||||
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
||||
@@ -7362,6 +7360,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
ScriptSleep(3000);
|
||||
if (xmlrpcMod == null)
|
||||
return "";
|
||||
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
|
||||
}
|
||||
|
||||
@@ -7369,7 +7369,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
|
||||
if (xmlrpcMod != null)
|
||||
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
|
||||
ScriptSleep(3000);
|
||||
}
|
||||
|
||||
@@ -7384,7 +7385,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
||||
if (xmlrpcMod != null)
|
||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
||||
ScriptSleep(1000);
|
||||
}
|
||||
|
||||
@@ -7797,8 +7799,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
|
||||
|
||||
ScriptSleep(200);
|
||||
}
|
||||
|
||||
private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
|
||||
@@ -12677,7 +12677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
bool result = money.ObjectGiveMoney(
|
||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero);
|
||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn);
|
||||
|
||||
if (result)
|
||||
{
|
||||
|
||||
@@ -1857,17 +1857,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
UUID assetID = UUID.Zero;
|
||||
|
||||
if (!UUID.TryParse(notecardNameOrUuid, out assetID))
|
||||
bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID);
|
||||
|
||||
if (!notecardNameIsUUID)
|
||||
{
|
||||
m_host.TaskInventory.LockItemsForRead(true);
|
||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||
{
|
||||
if (item.Type == 7 && item.Name == notecardNameOrUuid)
|
||||
{
|
||||
assetID = item.AssetID;
|
||||
}
|
||||
}
|
||||
m_host.TaskInventory.LockItemsForRead(false);
|
||||
assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
|
||||
}
|
||||
|
||||
if (assetID == UUID.Zero)
|
||||
@@ -1878,7 +1872,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
AssetBase a = World.AssetService.Get(assetID.ToString());
|
||||
|
||||
if (a == null)
|
||||
return UUID.Zero;
|
||||
{
|
||||
// Whoops, it's still possible here that the notecard name was properly
|
||||
// formatted like a UUID but isn't an asset UUID so lets look it up by name after all
|
||||
assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
|
||||
if (assetID == UUID.Zero)
|
||||
return UUID.Zero;
|
||||
|
||||
if (!NotecardCache.IsCached(assetID))
|
||||
{
|
||||
a = World.AssetService.Get(assetID.ToString());
|
||||
|
||||
if (a == null)
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string data = Encoding.UTF8.GetString(a.Data);
|
||||
NotecardCache.Cache(assetID, data);
|
||||
@@ -1886,6 +1896,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
return assetID;
|
||||
}
|
||||
protected UUID SearchTaskInventoryForAssetId(string name)
|
||||
{
|
||||
UUID assetId = UUID.Zero;
|
||||
m_host.TaskInventory.LockItemsForRead(true);
|
||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||
{
|
||||
if (item.Type == 7 && item.Name == name)
|
||||
{
|
||||
assetId = item.AssetID;
|
||||
}
|
||||
}
|
||||
m_host.TaskInventory.LockItemsForRead(false);
|
||||
return assetId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Directly get an entire notecard at once.
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_Float llGetWallclock();
|
||||
void llGiveInventory(string destination, string inventory);
|
||||
void llGiveInventoryList(string destination, string category, LSL_List inventory);
|
||||
LSL_Integer llGiveMoney(string destination, int amount);
|
||||
void llGiveMoney(string destination, int amount);
|
||||
LSL_String llTransferLindenDollars(string destination, int amount);
|
||||
void llGodLikeRezObject(string inventory, LSL_Vector pos);
|
||||
LSL_Float llGround(LSL_Vector offset);
|
||||
|
||||
@@ -876,9 +876,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
|
||||
}
|
||||
|
||||
public LSL_Integer llGiveMoney(string destination, int amount)
|
||||
public void llGiveMoney(string destination, int amount)
|
||||
{
|
||||
return m_LSL_Functions.llGiveMoney(destination, amount);
|
||||
m_LSL_Functions.llGiveMoney(destination, amount);
|
||||
}
|
||||
|
||||
public LSL_String llTransferLindenDollars(string destination, int amount)
|
||||
|
||||
Reference in New Issue
Block a user