Пример #1
0
        public override bool Verify(VM vm, VMAvatar caller)
        {
            if (Verified)
            {
                return(true);
            }
            ObjectPID = 0;
            VMEntity obj = vm.GetObjectById(ObjectID);

            if (!vm.TS1)
            {
                if (caller == null)
                {
                    return(false);
                }
                var permissions = caller.AvatarState.Permissions;
                if (permissions < VMTSOAvatarPermissions.Roommate)
                {
                    return(false);
                }
                if (obj != null && obj is VMGameObject && permissions == VMTSOAvatarPermissions.Admin)
                {
                    VMNetLockCmd.LockObj(vm, obj);
                    return(true); //admins can always deete
                }
            }
            if (obj == null || (obj is VMAvatar) || obj.IsUserMovable(vm.Context, true) != VMPlacementError.Success)
            {
                return(false);
            }
            if ((((VMGameObject)obj).Disabled & VMGameObjectDisableFlags.TransactionIncomplete) > 0)
            {
                return(false);                                                                                     //can't delete objects mid trasaction...
            }
            VMNetLockCmd.LockObj(vm, obj);

            var canDelete = vm.TS1 || obj.PersistID == 0 || ((VMTSOObjectState)obj.TSOState).OwnerID == caller.PersistID;

            if (canDelete)
            {
                //straight up delete this object. another check will be done at the execution stage.
                return(true);
            }
            else
            {
                //send to the owner's inventory
                ObjectPID = obj.PersistID; //we don't want to accidentally delete the wrong object - so use its real persist id.
                vm.GlobalLink.MoveToInventory(vm, obj.MultitileGroup, (bool success, uint pid) =>
                {
                    Success  = success;
                    Verified = true;
                    vm.ForwardCommand(this);
                });
                return(false);
            }
        }
Пример #2
0
        public override bool Verify(VM vm, VMAvatar caller)
        {
            if (Verified)
            {
                return(true);
            }
            if (ObjectPID == 0)
            {
                return(false);
            }
            var targObj = vm.GetObjectByPersist(ObjectPID);

            if (targObj == null)
            {
                return(false);
            }
            if (caller == null || //caller must be on lot
                targObj.PersistID == 0 || targObj is VMAvatar || targObj.IsUserMovable(vm.Context, true) != VMPlacementError.Success)
            {
                return(false);
            }

            if ((((VMGameObject)targObj).Disabled & VMGameObjectDisableFlags.ForSale) == 0)
            {
                return(false);                                                                            //must be for sale to buy it
            }
            if ((((VMGameObject)targObj).Disabled & VMGameObjectDisableFlags.TransactionIncomplete) > 0)
            {
                return(false);                                                                                         //someone else can't be buying it
            }
            VMNetLockCmd.LockObj(vm, targObj);

            vm.GlobalLink.PurchaseFromOwner(vm, targObj.MultitileGroup, caller.PersistID, (bool success, uint pid) =>
            {
                Success  = success;
                Verified = true;
                vm.ForwardCommand(this);
            },
                                            (bool success, int transferAmount, uint uid1, uint budget1, uint uid2, uint budget2) =>
            {
                vm.SendCommand(new VMNetAsyncResponseCmd(0, new VMTransferFundsState
                { //update budgets on clients. id of 0 means there is no target thread.
                    Responded      = true,
                    Success        = success,
                    TransferAmount = transferAmount,
                    UID1           = uid1,
                    Budget1        = budget1,
                    UID2           = uid2,
                    Budget2        = budget2
                }));
            });
            return(false);
        }
Пример #3
0
        public override bool Verify(VM vm, VMAvatar caller)
        {
            if (Verified)
            {
                return(true);
            }
            if (ObjectPID == 0)
            {
                return(false);
            }
            var targObj = vm.GetObjectByPersist(ObjectPID);

            if (targObj == null)
            {
                return(false);
            }
            if (!InternalDispatch && (caller == null || //caller must be on lot, be a roommate.
                                      caller.AvatarState.Permissions < VMTSOAvatarPermissions.Roommate ||
                                      targObj.PersistID == 0 || targObj is VMAvatar || targObj.IsUserMovable(vm.Context, true) != VMPlacementError.Success))
            {
                return(false);
            }

            if (vm.PlatformState.Validator.GetDeleteMode(DeleteMode.Sendback, caller, targObj) != DeleteMode.Sendback)
            {
                return(false);
            }

            if ((((VMGameObject)targObj).Disabled & VMGameObjectDisableFlags.TransactionIncomplete) > 0)
            {
                return(false);
            }
            VMNetLockCmd.LockObj(vm, targObj);
            vm.GlobalLink.MoveToInventory(vm, targObj.MultitileGroup, (bool success, uint pid) =>
            {
                Success  = success;
                Verified = true;
                vm.ForwardCommand(this);
            });
            return(false);
        }