Remove the return value from llGiveMoney and add llTransferLindenDollars. Also
make llGiveMoney async so the script thread is not held up waiting for comms to an external server.user_profiles
parent
2841ed05cf
commit
6a2b673fca
|
@ -2738,42 +2738,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return src.ToLower();
|
return src.ToLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGiveMoney(string destination, int amount)
|
public void llGiveMoney(string destination, int amount)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
Util.FireAndForget(x =>
|
||||||
|
|
||||||
if (m_item.PermsGranter == UUID.Zero)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
|
||||||
{
|
{
|
||||||
LSLError("No permissions to give money");
|
m_host.AddScriptLPS(1);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID toID = new UUID();
|
if (m_item.PermsGranter == UUID.Zero)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!UUID.TryParse(destination, out toID))
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||||
{
|
{
|
||||||
LSLError("Bad key in llGiveMoney");
|
LSLError("No permissions to give money");
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
UUID toID = new UUID();
|
||||||
|
|
||||||
if (money == null)
|
if (!UUID.TryParse(destination, out toID))
|
||||||
{
|
{
|
||||||
NotImplemented("llGiveMoney");
|
LSLError("Bad key in llGiveMoney");
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = money.ObjectGiveMoney(
|
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
|
||||||
|
|
||||||
if (result)
|
if (money == null)
|
||||||
return 1;
|
{
|
||||||
|
NotImplemented("llGiveMoney");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
money.ObjectGiveMoney(
|
||||||
|
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
|
public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
|
||||||
|
@ -6839,7 +6837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
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);
|
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
|
||||||
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
||||||
|
@ -6871,6 +6869,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
|
if (xmlrpcMod == null)
|
||||||
|
return "";
|
||||||
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
|
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6878,7 +6878,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
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);
|
ScriptSleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6893,7 +6894,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
if (xmlrpcMod != null)
|
||||||
|
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
||||||
ScriptSleep(1000);
|
ScriptSleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11554,6 +11556,79 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
NotImplemented("llGodLikeRezObject");
|
NotImplemented("llGodLikeRezObject");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_String llTransferLindenDollars(string destination, int amount)
|
||||||
|
{
|
||||||
|
UUID txn = UUID.Random();
|
||||||
|
|
||||||
|
Util.FireAndForget(delegate(object x)
|
||||||
|
{
|
||||||
|
int replycode = 0;
|
||||||
|
string replydata = destination + "," + amount.ToString();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TaskInventoryItem item = m_item;
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
replydata = "SERVICE_ERROR";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
if (item.PermsGranter == UUID.Zero)
|
||||||
|
{
|
||||||
|
replydata = "MISSING_PERMISSION_DEBIT";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||||
|
{
|
||||||
|
replydata = "MISSING_PERMISSION_DEBIT";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UUID toID = new UUID();
|
||||||
|
|
||||||
|
if (!UUID.TryParse(destination, out toID))
|
||||||
|
{
|
||||||
|
replydata = "INVALID_AGENT";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||||
|
|
||||||
|
if (money == null)
|
||||||
|
{
|
||||||
|
replydata = "TRANSFERS_DISABLED";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool result = money.ObjectGiveMoney(
|
||||||
|
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
replycode = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
replydata = "LINDENDOLLAR_INSUFFICIENTFUNDS";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
|
||||||
|
"transaction_result", new Object[] {
|
||||||
|
new LSL_String(txn.ToString()),
|
||||||
|
new LSL_Integer(replycode),
|
||||||
|
new LSL_String(replydata) },
|
||||||
|
new DetectParams[0]));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return txn.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_Float llGetWallclock();
|
LSL_Float llGetWallclock();
|
||||||
void llGiveInventory(string destination, string inventory);
|
void llGiveInventory(string destination, string inventory);
|
||||||
void llGiveInventoryList(string destination, string category, LSL_List 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);
|
void llGodLikeRezObject(string inventory, LSL_Vector pos);
|
||||||
LSL_Float llGround(LSL_Vector offset);
|
LSL_Float llGround(LSL_Vector offset);
|
||||||
LSL_Vector llGroundContour(LSL_Vector offset);
|
LSL_Vector llGroundContour(LSL_Vector offset);
|
||||||
|
|
|
@ -869,9 +869,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
|
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)
|
||||||
|
{
|
||||||
|
return m_LSL_Functions.llTransferLindenDollars(destination, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
|
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
|
||||||
|
|
Loading…
Reference in New Issue