Esempio n. 1
0
        /// <summary>
        /// Add a scene object as a new attachment in the user inventory.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="grp"></param>
        /// <returns>The user inventory item created that holds the attachment.</returns>
        private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp)
        {
            //            m_log.DebugFormat(
            //                "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}",
            //                grp.Name, grp.LocalId, remoteClient.Name);

            Vector3 inventoryStoredPosition = new Vector3
                                                  (((grp.AbsolutePosition.X > (int)Constants.RegionSize)
                         ? Constants.RegionSize - 6
                         : grp.AbsolutePosition.X)
                                                  ,
                                                  (grp.AbsolutePosition.Y > (int)Constants.RegionSize)
                        ? Constants.RegionSize - 6
                        : grp.AbsolutePosition.Y,
                                                  grp.AbsolutePosition.Z);

            Vector3 originalPosition = grp.AbsolutePosition;

            grp.AbsolutePosition = inventoryStoredPosition;

            // If we're being called from a script, then trying to serialize that same script's state will not complete
            // in any reasonable time period.  Therefore, we'll avoid it.  The worst that can happen is that if
            // the client/server crashes rather than logging out normally, the attachment's scripts will resume
            // without state on relog.  Arguably, this is what we want anyway.
            string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false);

            grp.AbsolutePosition = originalPosition;

            AssetBase asset = m_scene.CreateAsset(
                grp.GetPartName(grp.LocalId),
                grp.GetPartDescription(grp.LocalId),
                (sbyte)AssetType.Object,
                Utils.StringToBytes(sceneObjectXml),
                sp.UUID);

            m_scene.AssetService.Store(asset);

            InventoryItemBase item = new InventoryItemBase();

            item.CreatorId   = grp.RootPart.CreatorID.ToString();
            item.CreatorData = grp.RootPart.CreatorData;
            item.Owner       = sp.UUID;
            item.ID          = UUID.Random();
            item.AssetID     = asset.FullID;
            item.Description = asset.Description;
            item.Name        = asset.Name;
            item.AssetType   = asset.Type;
            item.InvType     = (int)InventoryType.Object;

            InventoryFolderBase folder = m_scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object);

            if (folder != null)
            {
                item.Folder = folder.ID;
            }
            else // oopsies
            {
                item.Folder = UUID.Zero;
            }

            if ((sp.UUID != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions())
            {
                item.BasePermissions     = grp.RootPart.NextOwnerMask;
                item.CurrentPermissions  = grp.RootPart.NextOwnerMask;
                item.NextPermissions     = grp.RootPart.NextOwnerMask;
                item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
                item.GroupPermissions    = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
            }
            else
            {
                item.BasePermissions     = grp.RootPart.BaseMask;
                item.CurrentPermissions  = grp.RootPart.OwnerMask;
                item.NextPermissions     = grp.RootPart.NextOwnerMask;
                item.EveryOnePermissions = grp.RootPart.EveryoneMask;
                item.GroupPermissions    = grp.RootPart.GroupMask;
            }
            item.CreationDate = Util.UnixTimeSinceEpoch();

            // sets itemID so client can show item as 'attached' in inventory
            grp.SetFromItemID(item.ID);

            if (m_scene.AddInventoryItem(item))
            {
                sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
            }
            else
            {
                if (m_dialogModule != null)
                {
                    m_dialogModule.SendAlertToUser(sp.ControllingClient, "Operation failed");
                }
            }

            return(item);
        }
Esempio n. 2
0
        public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType, int salePrice)
        {
            SceneObjectPart part = m_scene.GetSceneObjectPart(localID);

            if (part == null)
            {
                return(false);
            }

            if (part.ParentGroup == null)
            {
                return(false);
            }

            SceneObjectGroup group = part.ParentGroup;

            switch (saleType)
            {
            case 1: // Sell as original (in-place sale)
                uint effectivePerms = group.GetEffectivePermissions();

                if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
                    }
                    return(false);
                }

                group.SetOwnerId(remoteClient.AgentId);
                group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);

                if (m_scene.Permissions.PropagatePermissions())
                {
                    foreach (SceneObjectPart child in group.Parts)
                    {
                        child.Inventory.ChangeInventoryOwner(remoteClient.AgentId);
                        child.TriggerScriptChangedEvent(Changed.OWNER);
                        child.ApplyNextOwnerPermissions();
                    }
                }

                part.ObjectSaleType = 0;
                part.SalePrice      = 10;

                group.HasGroupChanged = true;
                part.GetProperties(remoteClient);
                part.TriggerScriptChangedEvent(Changed.OWNER);
                group.ResumeScripts();
                part.ScheduleFullUpdate();

                break;

            case 2: // Sell a copy
                Vector3 inventoryStoredPosition = new Vector3
                                                      (((group.AbsolutePosition.X > (int)Constants.RegionSize)
                             ? 250
                             : group.AbsolutePosition.X)
                                                      ,
                                                      (group.AbsolutePosition.X > (int)Constants.RegionSize)
                            ? 250
                            : group.AbsolutePosition.X,
                                                      group.AbsolutePosition.Z);

                Vector3 originalPosition = group.AbsolutePosition;

                group.AbsolutePosition = inventoryStoredPosition;

                string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
                group.AbsolutePosition = originalPosition;

                uint perms = group.GetEffectivePermissions();

                if ((perms & (uint)PermissionMask.Transfer) == 0)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
                    }
                    return(false);
                }

                AssetBase asset = m_scene.CreateAsset(
                    group.GetPartName(localID),
                    group.GetPartDescription(localID),
                    (sbyte)AssetType.Object,
                    Utils.StringToBytes(sceneObjectXml),
                    group.OwnerID);
                m_scene.AssetService.Store(asset);

                InventoryItemBase item = new InventoryItemBase();
                item.CreatorId = part.CreatorID.ToString();

                item.ID          = UUID.Random();
                item.Owner       = remoteClient.AgentId;
                item.AssetID     = asset.FullID;
                item.Description = asset.Description;
                item.Name        = asset.Name;
                item.AssetType   = asset.Type;
                item.InvType     = (int)InventoryType.Object;
                item.Folder      = categoryID;

                uint nextPerms = (perms & 7) << 13;
                if ((nextPerms & (uint)PermissionMask.Copy) == 0)
                {
                    perms &= ~(uint)PermissionMask.Copy;
                }
                if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
                {
                    perms &= ~(uint)PermissionMask.Transfer;
                }
                if ((nextPerms & (uint)PermissionMask.Modify) == 0)
                {
                    perms &= ~(uint)PermissionMask.Modify;
                }

                item.BasePermissions     = perms & part.NextOwnerMask;
                item.CurrentPermissions  = perms & part.NextOwnerMask;
                item.NextPermissions     = part.NextOwnerMask;
                item.EveryOnePermissions = part.EveryoneMask &
                                           part.NextOwnerMask;
                item.GroupPermissions = part.GroupMask &
                                        part.NextOwnerMask;
                item.Flags       |= (uint)InventoryItemFlags.ObjectSlamPerm;
                item.CreationDate = Util.UnixTimeSinceEpoch();

                if (m_scene.AddInventoryItem(item))
                {
                    remoteClient.SendInventoryItemCreateUpdate(item, 0);
                }
                else
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
                    }
                    return(false);
                }
                break;

            case 3: // Sell contents
                List <UUID> invList = part.Inventory.GetInventoryList();

                bool okToSell = true;

                foreach (UUID invID in invList)
                {
                    TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID);
                    if ((item1.CurrentPermissions &
                         (uint)PermissionMask.Transfer) == 0)
                    {
                        okToSell = false;
                        break;
                    }
                }

                if (!okToSell)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(
                            remoteClient, "This item's inventory doesn't appear to be for sale");
                    }
                    return(false);
                }

                if (invList.Count > 0)
                {
                    m_scene.MoveTaskInventoryItems(remoteClient.AgentId, part.Name, part, invList);
                }
                break;
            }

            return(true);
        }
Esempio n. 3
0
        public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType)
        {
            ISceneChildEntity part = m_scene.GetSceneObjectPart(localID);

            if (part == null)
            {
                return(false);
            }

            if (part.ParentEntity == null)
            {
                return(false);
            }

            ISceneEntity       group           = part.ParentEntity;
            ILLClientInventory inventoryModule = m_scene.RequestModuleInterface <ILLClientInventory>();

            switch (saleType)
            {
            case 1:     // Sell as original (in-place sale)
                uint effectivePerms = group.GetEffectivePermissions();

                if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
                    }
                    return(false);
                }

                group.SetOwnerId(remoteClient.AgentId);
                group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);

                if (m_scene.Permissions.PropagatePermissions())
                {
                    foreach (ISceneChildEntity child in group.ChildrenEntities())
                    {
                        child.Inventory.ChangeInventoryOwner(remoteClient.AgentId);
                        child.TriggerScriptChangedEvent(Changed.OWNER);
                        child.ApplyNextOwnerPermissions();
                    }
                }

                part.ObjectSaleType = 0;
                part.SalePrice      = 10;

                group.HasGroupChanged = true;
                part.GetProperties(remoteClient);
                part.TriggerScriptChangedEvent(Changed.OWNER);
                group.ResumeScripts();
                part.ScheduleUpdate(PrimUpdateFlags.ForcedFullUpdate);

                break;

            case 2:     // Sell a copy
                Vector3 inventoryStoredPosition = new Vector3
                                                      (((group.AbsolutePosition.X > m_scene.RegionInfo.RegionSizeX)
                              ? m_scene.RegionInfo.RegionSizeX - 1
                              : group.AbsolutePosition.X)
                                                      ,
                                                      (group.AbsolutePosition.X > m_scene.RegionInfo.RegionSizeY)
                             ? m_scene.RegionInfo.RegionSizeY - 1
                             : group.AbsolutePosition.X,
                                                      group.AbsolutePosition.Z);

                Vector3 originalPosition = group.AbsolutePosition;

                group.AbsolutePosition = inventoryStoredPosition;

                string sceneObjectXml = SceneEntitySerializer.SceneObjectSerializer.ToOriginalXmlFormat(group);
                group.AbsolutePosition = originalPosition;

                uint perms = group.GetEffectivePermissions();

                if ((perms & (uint)PermissionMask.Transfer) == 0)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
                    }
                    return(false);
                }

                AssetBase asset = new AssetBase(UUID.Random(), part.Name,
                                                AssetType.Object, group.OwnerID)
                {
                    Description = part.Description, Data = Utils.StringToBytes(sceneObjectXml)
                };
                asset.ID = m_scene.AssetService.Store(asset);

                InventoryItemBase item = new InventoryItemBase
                {
                    CreatorId   = part.CreatorID.ToString(),
                    CreatorData = part.CreatorData,
                    ID          = UUID.Random(),
                    Owner       = remoteClient.AgentId,
                    AssetID     = asset.ID,
                    Description = asset.Description,
                    Name        = asset.Name,
                    AssetType   = asset.Type,
                    InvType     = (int)InventoryType.Object,
                    Folder      = categoryID
                };


                uint nextPerms = (perms & 7) << 13;
                if ((nextPerms & (uint)PermissionMask.Copy) == 0)
                {
                    perms &= ~(uint)PermissionMask.Copy;
                }
                if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
                {
                    perms &= ~(uint)PermissionMask.Transfer;
                }
                if ((nextPerms & (uint)PermissionMask.Modify) == 0)
                {
                    perms &= ~(uint)PermissionMask.Modify;
                }

                item.BasePermissions     = perms & part.NextOwnerMask;
                item.CurrentPermissions  = perms & part.NextOwnerMask;
                item.NextPermissions     = part.NextOwnerMask;
                item.EveryOnePermissions = part.EveryoneMask &
                                           part.NextOwnerMask;
                item.GroupPermissions = part.GroupMask &
                                        part.NextOwnerMask;
                item.CurrentPermissions |= 16;     // Slam!
                item.CreationDate        = Util.UnixTimeSinceEpoch();

                m_scene.InventoryService.AddItemAsync(item,
                                                      (itm) => remoteClient.SendInventoryItemCreateUpdate(itm, 0));
                break;

            case 3:     // Sell contents
                List <UUID> invList = part.Inventory.GetInventoryList();

                bool okToSell =
                    invList.Select(invID => part.Inventory.GetInventoryItem(invID))
                    .All(item1 => (item1.CurrentPermissions & (uint)PermissionMask.Transfer) != 0);

                if (!okToSell)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(
                            remoteClient, "This item's inventory doesn't appear to be for sale");
                    }
                    return(false);
                }

                if (invList.Count > 0)
                {
                    if (inventoryModule != null)
                    {
                        inventoryModule.MoveTaskInventoryItemsToUserInventory(remoteClient.AgentId, part.Name, part,
                                                                              invList);
                    }
                }
                break;
            }

            return(true);
        }
Esempio n. 4
0
        public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType, int salePrice)
        {
            SceneObjectPart rootpart = m_scene.GetSceneObjectPart(localID);

            if (rootpart == null)
            {
                return(false);
            }

            SceneObjectGroup group = rootpart.ParentGroup;

            if (group == null || group.IsDeleted || group.inTransit)
            {
                return(false);
            }

            // make sure we are not buying a child part
            rootpart = group.RootPart;

            switch (saleType)
            {
            case 1: // Sell as original (in-place sale)
                uint effectivePerms = group.EffectiveOwnerPerms;

                if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
                    }
                    return(false);
                }

                group.SetOwner(remoteClient.AgentId, remoteClient.ActiveGroupId);

                if (m_scene.Permissions.PropagatePermissions())
                {
                    foreach (SceneObjectPart child in group.Parts)
                    {
                        child.Inventory.ChangeInventoryOwner(remoteClient.AgentId);
                        child.TriggerScriptChangedEvent(Changed.OWNER);
                        child.ApplyNextOwnerPermissions();
                    }
                    group.InvalidateDeepEffectivePerms();
                }

                rootpart.ObjectSaleType = 0;
                rootpart.SalePrice      = 10;
                rootpart.ClickAction    = 0;

                group.HasGroupChanged = true;
                rootpart.SendPropertiesToClient(remoteClient);
                rootpart.TriggerScriptChangedEvent(Changed.OWNER);
                group.ResumeScripts();
                rootpart.ScheduleFullUpdate();

                break;

            case 2: // Sell a copy
                uint perms = group.EffectiveOwnerPerms;

                if ((perms & (uint)PermissionMask.Transfer) == 0)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
                    }
                    return(false);
                }

                if ((perms & (uint)PermissionMask.Copy) == 0)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "This sale has been blocked by the permissions system");
                    }
                    return(false);
                }

                // save sell data
                int  price       = rootpart.SalePrice;
                byte clickAction = rootpart.ClickAction;

                // reset sale data for the copy
                rootpart.ObjectSaleType = 0;
                rootpart.SalePrice      = 10;
                rootpart.ClickAction    = 0;

                string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);

                rootpart.ObjectSaleType = saleType;
                rootpart.SalePrice      = price;
                rootpart.ClickAction    = clickAction;

                string name = rootpart.Name;
                string desc = rootpart.Description;

                AssetBase asset = m_scene.CreateAsset(
                    name, desc,
                    (sbyte)AssetType.Object,
                    Utils.StringToBytes(sceneObjectXml),
                    rootpart.CreatorID);
                m_scene.AssetService.Store(asset);

                InventoryItemBase item = new InventoryItemBase();
                item.CreatorId   = rootpart.CreatorID.ToString();
                item.CreatorData = rootpart.CreatorData;

                item.ID          = UUID.Random();
                item.Owner       = remoteClient.AgentId;
                item.AssetID     = asset.FullID;
                item.Description = desc;
                item.Name        = name;
                item.AssetType   = asset.Type;
                item.InvType     = (int)InventoryType.Object;
                item.Folder      = categoryID;

                perms = group.CurrentAndFoldedNextPermissions();
                // apply parts inventory next perms
                PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms);
                // change to next owner perms
                perms &= rootpart.NextOwnerMask;
                // update folded
                perms = PermissionsUtil.FixAndFoldPermissions(perms);

                item.BasePermissions     = perms;
                item.CurrentPermissions  = perms;
                item.NextPermissions     = rootpart.NextOwnerMask & perms;
                item.EveryOnePermissions = rootpart.EveryoneMask & perms;
                item.GroupPermissions    = rootpart.GroupMask & perms;

                item.Flags       |= (uint)InventoryItemFlags.ObjectSlamPerm;
                item.CreationDate = Util.UnixTimeSinceEpoch();

                if (m_scene.AddInventoryItem(item))
                {
                    remoteClient.SendInventoryItemCreateUpdate(item, 0);
                }
                else
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
                    }
                    return(false);
                }
                break;

            case 3: // Sell contents
                List <UUID> invList = rootpart.Inventory.GetInventoryList();

                bool okToSell = true;

                foreach (UUID invID in invList)
                {
                    TaskInventoryItem item1 = rootpart.Inventory.GetInventoryItem(invID);
                    if ((item1.CurrentPermissions &
                         (uint)PermissionMask.Transfer) == 0)
                    {
                        okToSell = false;
                        break;
                    }
                }

                if (!okToSell)
                {
                    if (m_dialogModule != null)
                    {
                        m_dialogModule.SendAlertToUser(
                            remoteClient, "This item's inventory doesn't appear to be for sale");
                    }
                    return(false);
                }

                if (invList.Count > 0)
                {
                    m_scene.MoveTaskInventoryItems(remoteClient.AgentId, rootpart.Name, rootpart, invList);
                }
                break;
            }

            return(true);
        }
Esempio n. 5
0
        OSDMap syncRecievedService_OnMessageReceived(OSDMap message)
        {
            string method = message ["Method"];

            if (method == "UpdateMoneyBalance")
            {
                UUID           agentID       = message ["AgentID"];
                int            Amount        = message ["Amount"];
                string         Message       = message ["Message"];
                UUID           TransactionID = message ["TransactionID"];
                IDialogModule  dialogModule  = GetSceneFor(agentID).RequestModuleInterface <IDialogModule> ();
                IScenePresence sp            = GetSceneFor(agentID).GetScenePresence(agentID);
                if (sp != null)
                {
                    if (dialogModule != null && !string.IsNullOrEmpty(Message))
                    {
                        dialogModule.SendAlertToUser(agentID, Message);
                    }

                    sp.ControllingClient.SendMoneyBalance(TransactionID, true, Utils.StringToBytes(Message), Amount);
                }
            }
            else if (method == "GetLandData")
            {
                MainConsole.Instance.Info(message);

                UUID   agentID = message["AgentID"];
                IScene region  = GetSceneFor(agentID);
                MainConsole.Instance.Info("Region: " + region.RegionInfo.RegionName);

                IParcelManagementModule parcelManagement = region.RequestModuleInterface <IParcelManagementModule> ();
                if (parcelManagement != null)
                {
                    IScenePresence sp = region.GetScenePresence(agentID);
                    if (sp != null)
                    {
                        MainConsole.Instance.DebugFormat("sp parcel UUID: {0} Pos: {1}, {2}",
                                                         sp.CurrentParcelUUID, sp.AbsolutePosition.X, sp.AbsolutePosition.Y);

                        ILandObject lo = sp.CurrentParcel;
                        if (lo == null)
                        {
                            // try for a position fix
                            lo = parcelManagement.GetLandObject((int)sp.AbsolutePosition.X, (int)sp.AbsolutePosition.Y);
                        }

                        if (lo != null)
                        {
                            if ((lo.LandData.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale)
                            {
                                if (lo.LandData.AuthBuyerID != UUID.Zero && lo.LandData.AuthBuyerID != agentID)
                                {
                                    return new OSDMap {
                                               new KeyValuePair <string, OSD> ("Success", false)
                                    }
                                }
                                ;
                                OSDMap map = lo.LandData.ToOSD();
                                map ["Success"] = true;
                                return(map);
                            }
                        }
                    }
                }
                return(new OSDMap {
                    new KeyValuePair <string, OSD>("Success", false)
                });
            }
            return(null);
        }

        IScene GetSceneFor(UUID userID)
        {
            foreach (IScene scene in m_scenes)
            {
                var sp = scene.GetScenePresence(userID);
                if (sp != null && !sp.IsChildAgent)
                {
                    return(scene);
                }
            }
            if (m_scenes.Count == 0)
            {
                MainConsole.Instance.Debug("User not present in any regions??");
                return(null);
            }

            MainConsole.Instance.Debug("Returning scene[0]: " + m_scenes [0].RegionInfo.RegionName);
            return(m_scenes[0]);
        }
Esempio n. 6
0
        /// <summary>
        /// Kicks User specified from the simulator. This logs them off of the grid
        /// If the client gets the UUID: 44e87126e7944ded05b37c42da3d5cdb it assumes
        /// that you're kicking it even if the avatar's UUID isn't the UUID that the
        /// agent is assigned
        /// </summary>
        /// <param name="godID">The person doing the kicking</param>
        /// <param name="sessionID">The session of the person doing the kicking</param>
        /// <param name="agentID">the person that is being kicked</param>
        /// <param name="kickflags">Tells what to do to the user</param>
        /// <param name="reason">The message to send to the user after it's been turned into a field</param>
        public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason)
        {
            if (!m_scene.Permissions.IsGod(godID))
            {
                return;
            }

            ScenePresence sp = m_scene.GetScenePresence(agentID);

            if (sp == null && agentID != ALL_AGENTS)
            {
                IMessageTransferModule transferModule =
                    m_scene.RequestModuleInterface <IMessageTransferModule>();
                if (transferModule != null)
                {
                    m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID);
                    transferModule.SendInstantMessage(new GridInstantMessage(
                                                          m_scene, godID, "God", agentID, (byte)250, false,
                                                          Utils.BytesToString(reason), UUID.Zero, true,
                                                          new Vector3(), new byte[] { (byte)kickflags }, true),
                                                      delegate(bool success) { });
                }
                return;
            }

            switch (kickflags)
            {
            case 0:
                if (sp != null)
                {
                    KickPresence(sp, Utils.BytesToString(reason));
                }
                else if (agentID == ALL_AGENTS)
                {
                    m_scene.ForEachRootScenePresence(
                        delegate(ScenePresence p)
                    {
                        if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID)))
                        {
                            KickPresence(p, Utils.BytesToString(reason));
                        }
                    }
                        );
                }
                break;

            case 1:
                if (sp != null)
                {
                    sp.AllowMovement = false;
                    m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
                    m_dialogModule.SendAlertToUser(godID, "User Frozen");
                }
                break;

            case 2:
                if (sp != null)
                {
                    sp.AllowMovement = true;
                    m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
                    m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
                }
                break;

            default:
                break;
            }
        }