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,17 +2738,19 @@ 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)
|
||||||
|
{
|
||||||
|
Util.FireAndForget(x =>
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_item.PermsGranter == UUID.Zero)
|
if (m_item.PermsGranter == UUID.Zero)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
|
||||||
{
|
{
|
||||||
LSLError("No permissions to give money");
|
LSLError("No permissions to give money");
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID toID = new UUID();
|
UUID toID = new UUID();
|
||||||
|
@ -2756,7 +2758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (!UUID.TryParse(destination, out toID))
|
if (!UUID.TryParse(destination, out toID))
|
||||||
{
|
{
|
||||||
LSLError("Bad key in llGiveMoney");
|
LSLError("Bad key in llGiveMoney");
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
|
||||||
|
@ -2764,16 +2766,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (money == null)
|
if (money == null)
|
||||||
{
|
{
|
||||||
NotImplemented("llGiveMoney");
|
NotImplemented("llGiveMoney");
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = money.ObjectGiveMoney(
|
money.ObjectGiveMoney(
|
||||||
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
|
||||||
|
});
|
||||||
if (result)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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,6 +6878,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 != null)
|
||||||
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
|
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
}
|
}
|
||||||
|
@ -6893,6 +6894,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||||
|
if (xmlrpcMod != null)
|
||||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
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