コード例 #1
0
        public virtual bool Install( Mobile m, BaseDoor door, out string message )
        {
            if( door.CanInstallTrap(m) )
            {
                if( door.HasTrap() && this.TrapType == door.TrapType && door.DoorTrap.Refillable )
                {
                    door.DoorTrap.Recharge(this.InitialUses);
                    message = "A trap of the same type was already installed on this door, so you refill its ammunition.";
                    return true;
                }

                if (door.AttachTrap(BaseDoorTrap.CreateTrapByType(_trapType, _owner, _initialUses)))
                {
                    message = "You successfully install the trap.";
                    return true;
                }

                if (door.HasTrap() && this.TrapType != door.TrapType)
                {
                    message = "This door already appears to be trapped.";
                    return false;
                }
            }

            message = "You fail to install the trap.";
            return false;
        }