OpenSim.Region.ScriptEngine.Shared.Api.LSL_Api.llTransferLindenDollars C# (CSharp) Method

llTransferLindenDollars() public method

public llTransferLindenDollars ( string destination, int amount ) : OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString
destination string
amount int
return OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString
        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
                {
                    if (amount <= 0)
                    {
                        replydata = "INVALID_AMOUNT";
                        return;
                    }

                    TaskInventoryItem item = m_item;
                    if (item == null)
                    {
                        replydata = "SERVICE_ERROR";
                        return;
                    }

                    if (m_host.OwnerID == m_host.GroupID)
                    {
                        replydata = "GROUP_OWNED";
                        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;
                    }

                    UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, toID);
                    if (account == null)
                    {
                        replydata = "LINDENDOLLAR_ENTITYDOESNOTEXIST";
                        return;
                    }

                    IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();

                    if (money == null)
                    {
                        replydata = "TRANSFERS_DISABLED";
                        return;
                    }

                    string reason;
                    bool result = money.ObjectGiveMoney( m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);

                    if (result)
                    {
                        replycode = 1;
                        return;
                    }

                    replydata = reason;
                }
                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]));
                }
            }, null, "LSL_Api.llTransferLindenDollars");

            return txn.ToString();
        }
LSL_Api