Example #1
1
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) || !from.InLOS( this ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
			}
			else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse )
			{
				Point3D p = this.GetWorldLocation();

				if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
				{
					Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
					from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
					Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
				}

				Effects.PlaySound( this.GetWorldLocation(), this.Map, 0x387 );

				Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
				Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );

				Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );

				m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
			}
		}
 protected override void OnTarget( Mobile from, object targeted )
 {
    if ( targeted is BaseWeapon )
    {
       BaseWeapon Weapon = targeted as BaseWeapon;
       if ( !from.InRange( m_LTub.GetWorldLocation(), 1 ) || !from.InRange( ((Item)targeted).GetWorldLocation(), 1 ) )
       {
          from.SendLocalizedMessage( 500446 ); // That is too far away.
       }
       else if (( ((Item)targeted).Parent != null ) && ( ((Item)targeted).Parent is Mobile ) )
       {
          from.SendMessage( "You cannot dye that in it's current location." );
       }
       else if ( Weapon.Type == WeaponType.Polearm || Weapon.Type == WeaponType.Piercing
       || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Slashing
       || Weapon.Type == WeaponType.Bashing || Weapon.Type == WeaponType.Axe || Weapon.Type == WeaponType.Ranged )
       {
          Weapon.Hue = m_LTub.Hue;
          from.PlaySound( 0x23E );
       }
    }
    else if ( targeted is BaseLeather )
    {
       from.SendLocalizedMessage( 1042083 ); // You can not dye that.
    }
 }
Example #3
0
        // When this object -- the bottle -- is double-clicked...
        public override void OnDoubleClick(Mobile m)
        {
            if (m.Followers >= m.FollowersMax) // If the player's followers is greater than or equal to his max followers...
            {
                m.SendMessage("You need at least one free follower slot to open the bottle.");
            }
            else if (((m.InRange(this, 1) && m.CanSee(this)) || this.IsChildOf(m.Backpack)) && (!GetGooInBottle())) // If the bottle is in-range and the goo is not in its bottle...
            {
                m.SendMessage("The goo is out of its bottle!");
                m.SendLocalizedMessage(1010018); // What do you want to use this item on?

                m.Target = new BottleOfGooTarget(this, gooPet); // Creates a target from this mobile with the goo mobile thrown to the new class as a reference.
            }
            else if (((m.InRange(this, 1) && m.CanSee(this)) || this.IsChildOf(m.Backpack)) && (GetGooInBottle())) // If the bottle is in-range and the goo IS in its bottle, this function creates a new goo mobile.
            {
                gooPet = new Goo(this);

                ((GenericWarrior)gooPet).Controlled = true;
                ((GenericWarrior)gooPet).ControlMaster = m;

                gooPet.MoveToWorld(m.Location, m.Map);
                gooPet.PlaySound(0x1CC);
                gooPet.Emote("*leaps out of " + m.Name + "'s bottle!*");

                SetGooInBottle(false);
            }
            else
            {
                m.SendLocalizedMessage(500446); //That is too far away.
            }
        }
Example #4
0
		public virtual void OnDoubleClick( Mobile from, bool createWeedsAndDelete )
		{
			if( !from.CanSee( this ) )
			{
				from.SendMessage( "You cannot see that." );
			}
			else if( !(this is HarvestableTree) && !from.InRange( this, 1 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( this is HarvestableTree && !from.InRange( this, 2 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( (Sower != null && from != m_Sower) && !(this is HarvestableTree) )
			{
				from.SendMessage( "You cannot harvest any of this crop." );
			}
			else if( from.Mounted )
			{
				from.SendMessage( "You cannot do this while riding a mount." );
			}
			else
			{
				int calcYield = CalculateYield( from );
				Item crop = null;

				try { crop = CreateCrop( calcYield ); }
				catch( Exception e ) { Server.Utilities.ExceptionManager.LogException( "BaseGrownCrop.cs", e ); }

				if( crop == null )
				{
					from.SendMessage( "You are unable to harvest any of this crop!" );
				}
				else
				{
					from.AddToBackpack( crop );

					from.Direction = from.GetDirectionTo( this );
					from.Animate( AnimationFrame, 5, 1, true, false, 0 );
					from.PlaySound( 0x133 );
					from.SendMessage( "You successfully harvest the crop!" );
				}

				if( createWeedsAndDelete )
				{
					new Weeds().MoveToWorld( this.Location, this.Map );
					this.Delete();
				}
				else
				{
					OnHarvest( from );
				}
			}
		}
 public override void OnDoubleClick(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 1))
     {
         from.SendMessage("You try to examine the strange wall but the vines get in your way.");
     }
     else if (!from.InRange(this.GetWorldLocation(), 1))
     {
         from.SendMessage("I can't reach that.");
     }
     base.OnDoubleClick(from);
 }
        public override void OnDoubleClick(Mobile from)
        {
            if (from != base.Owner || !base.IncludedEntities.Contains(from))
                from.SendMessage("You are not permitted to board this carpet.");

            if (!from.InRange(this.Location, 1))
                from.SendMessage("You must be closer if you wish to board this.");

            if ((from == base.Owner || base.IncludedEntities.Contains(from))
                && from.InRange(this.Location, 1))
            {
                from.MoveToWorld(this.Location, this.Map);
            }
        }
        public override void OnDoubleClick( Mobile from )
        {
            Direction dir;
            if ( from.Location != this.Location )
                dir = from.GetDirectionTo( this );
            else if ( this.East )
                dir = Direction.West;
            else
                dir = Direction.North;

            from.Direction = dir;

            bool canThrow = true;

            if ( !from.InRange( this, 4 ) || !from.InLOS( this ) )
                canThrow = false;
            else if ( this.East )
                canThrow = ( dir == Direction.Left || dir == Direction.West || dir == Direction.Up );
            else
                canThrow = ( dir == Direction.Up || dir == Direction.North || dir == Direction.Right );

            if ( canThrow )
                Throw( from );
            else
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
        }
		public bool ValidatePlacement( Mobile from, Point3D loc )
		{
			if ( from.AccessLevel >= AccessLevel.GameMaster )
				return true;

			if ( !from.InRange( this.GetWorldLocation(), 1 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return false;
			}

			Map map = from.Map;

			if ( map == null )
				return false;

			BaseHouse house = BaseHouse.FindHouseAt( loc, map, 20 );

			if ( house != null && !house.IsFriend( from ) )
			{
				from.SendLocalizedMessage(500269); // You cannot build that there.
				return false;
			}

			if ( !map.CanFit( loc, 20 ) )
			{
				from.SendLocalizedMessage( 500269 ); // You cannot build that there.
				return false;
			}

			return true;
		}
Example #9
0
        protected void OnTarget( Mobile from, object targeted )
        {
            if ( from.Backpack == null || !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1080063 ); // This must be in your backpack to use it.
                return;
            }

            if ( targeted is MagicVines )
            {
                MagicVines vines = targeted as MagicVines;

                if ( from.InRange( vines, 1 ) )
                {
                    vines.OnAcidSac( from );
                    Consume();
                }
                else
                {
                    from.SendLocalizedMessage( 1076766 ); // That is too far away.
                }
            }
            else
            {
                from.SendLocalizedMessage( 1046439 ); // That is not a valid target.
            }
        }
Example #10
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( this.Parent != null || !this.VerifyMove( from ) )
                return;

            if ( !from.InRange( this, 2 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "I can't reach that." ); // I can't reach that.
                return;
            }

            if ( this.ItemID == 0xA57 ) // rolled
            {
                Direction dir = PlayerMobile.GetDirection4( from.Location, this.Location );

                if ( dir == Direction.North || dir == Direction.South )
                    this.ItemID = 0xA55;
                else
                    this.ItemID = 0xA56;
            }
            else // unrolled
            {
                this.ItemID = 0xA57;

                if ( !from.HasGump( typeof( LogoutGump ) ) )
                {
                    CampfireEntry entry = Campfire.GetEntry( from );

                    if ( entry != null && entry.Safe )
                        from.SendGump( new LogoutGump( entry, this ) );
                }
            }
        }
Example #11
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
		{
			if(from.InRange(c.Location, 3) && from.Backpack != null)
			{
				foreach(WispOrb orb in WispOrb.Orbs)
				{
					if(orb.Owner == from)
					{
						LabelTo(from, 1153357); // Thou can guide but one of us.
						return;
					}
				}
				
				Alignment alignment = Alignment.Neutral;
				
				if(from.Karma > 0 && m_Alignment == Alignment.Good)
					alignment = Alignment.Good;
				else if (from.Karma < 0 && m_Alignment == Alignment.Evil)
					alignment = Alignment.Evil;
					
				if(alignment != Alignment.Neutral)
				{
                    WispOrb orb = new WispOrb(from, alignment);
					from.Backpack.DropItem(orb);

                    Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(SendMessage_Callback), new object[] { orb, from } );
				}
				else
					LabelTo(from, 1153350); // Thy spirit be not compatible with our goals!
			}
		}
Example #12
0
        protected override void OnTarget( Mobile from, object target )
        {
            if( target is HitchingPost )
            {
                HitchingPost post = (HitchingPost)target;

                if( !from.InRange(post.GetWorldLocation(), 1) )
                    from.SendLocalizedMessage(500295);

                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, from.EmoteHue, false, "*ties the rope to the hitching post ring*");
                    from.SendMessage("Target the pet you wish to hitch.");

                    from.Target = new PostToPetTarget();
                }
            }
            else if( target is BaseCreature )
                from.SendMessage("You must tie the rope to a hitching post before being able to hitch your pet.");

            else if( target is PlayerMobile )
                from.SendMessage("The person looks at you in disgust.");

            else if( target == from )
                from.SendMessage("That would be a stupid idea.");
        }
Example #13
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( from.InRange( GetWorldLocation(), 1 ) )
				UseGate( from );
			else
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
		}
		private void DestroyFurniture( Mobile from, Item item )
		{
			if ( !from.InRange( item.GetWorldLocation(), 3 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return;
			}
			else if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
			{
				from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
				return;
			}

			from.SendLocalizedMessage( 500461 ); // You destroy the item.
			Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );

			if ( item is Container )
			{
				if ( item is TrapableContainer )
					(item as TrapableContainer).ExecuteTrap( from );

				((Container)item).Destroy();
			}
			else
			{
				item.Delete();
			}
		}
Example #15
0
		public override bool HandlesOnSpeech( Mobile m )
		{
			if( m.InRange( this.Location, 2 ) && m.Alive && !m.Hidden && m_Board != null )
				return true;
			
			return base.HandlesOnSpeech( m );
		}
Example #16
0
        public void WoundingShot(Mobile attacker, Mobile defender)
        {
            if (Level >= PerkLevel.Fifth)
            {
                int distance = 0;

                for (int x = 0; x <= 12; x++)
                {
                    if (attacker.InRange(defender, x))
                    {
                        distance = x;
                    }
                }

                int woundChance = (int)((attacker.Skills.Anatomy.Value / 8) - (distance / 2));

                if (woundChance >= Utility.RandomMinMax(0, 100))
                {
                    BleedAttack.BeginBleed(defender, attacker);

                    attacker.SendMessage("You wound your opponent, causing them to bleed!");
                    defender.SendMessage("You've been wounded!");
                }
            }
        }
Example #17
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) )
			from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
			else if ( from is PlayerMobile )
			from.SendGump( new FoodPantryGump( (PlayerMobile)from, this ) );
		}
Example #18
0
		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{
			if ( from.InRange( c.Location, 2 ) )
			{
				if ( m_Fruits > 0 )
				{
					Item fruit = Fruit;

					if ( fruit == null )
						return;

					if ( !from.PlaceInBackpack( fruit ) )
					{
						fruit.Delete();
						from.SendLocalizedMessage( 501015 ); // There is no room in your backpack for the fruit.
					}
					else
					{
						if ( --m_Fruits == 0 )
							Timer.DelayCall( TimeSpan.FromMinutes( 30 ), new TimerCallback( Respawn ) );

						from.SendLocalizedMessage( 501016 ); // You pick some fruit and put it in your backpack.
					}
				}
				else
					from.SendLocalizedMessage( 501017 ); // There is no more fruit on this tree
			}
			else
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
		}
		public override bool HandlesOnSpeech( Mobile from )
		{
			if ( from.InRange( this.Location, 4 ) )
				return true;

			return base.HandlesOnSpeech( from );
		}
Example #20
0
        public override void Open( Mobile from, bool checkSelfLoot )
        {
            if ( !from.InRange( this.GetWorldLocation(), 2 ) )
                return;

            PlayerMobile player = from as PlayerMobile;

            if ( player != null )
            {
                QuestSystem qs = player.Quest;

                if ( qs is WitchApprenticeQuest )
                {
                    FindApprenticeObjective obj = qs.FindObjective( typeof( FindApprenticeObjective ) ) as FindApprenticeObjective;

                    if ( obj != null && !obj.Completed )
                    {
                        if ( obj.Corpse == this )
                        {
                            obj.Complete();
                            Delete();
                        }
                        else
                        {
                            SendLocalizedMessageTo( from, 1055047 ); // You examine the corpse, but it doesn't fit the description of the particular apprentice the Hag tasked you with finding.
                        }

                        return;
                    }
                }
            }

            SendLocalizedMessageTo( from, 1055048 ); // You examine the corpse, but find nothing of interest.
        }
Example #21
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) )
				return;

			this.PublicOverheadMessage( MessageType.Regular, 0, false, string.Format( "*{0} rolls {1}, {2}*", from.Name, Utility.Random( 1, 6 ), Utility.Random( 1, 6 ) ) );
		}
		private bool CheckUse( Mobile from )
		{
			if ( !this.IsAccessibleTo( from ) )
				return false;

			if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 2 ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
				return false;
			}

			if ( !from.CanBeginAction( typeof( FireHorn ) ) )
			{
				from.SendLocalizedMessage( 1049615 ); // You must take a moment to catch your breath.
				return false;
			}

			int sulfAsh = Core.AOS ? 4 : 15;
			if ( from.Backpack == null || from.Backpack.GetAmount( typeof( SulfurousAsh ) ) < sulfAsh )
			{
				from.SendLocalizedMessage( 1049617 ); // You do not have enough sulfurous ash.
				return false;
			}

			return true;
		}
Example #23
0
        public virtual bool Dye( Mobile from, DyeTub sender )
        {
            if ( Deleted )
                return false;

            BaseHouse house = BaseHouse.FindHouseAt( this );

            if ( house != null && house.IsCoOwner( from ) )
            {
                if ( from.InRange( GetWorldLocation(), 1 ) )
                {
                    Hue = sender.DyedHue;
                    return true;
                }
                else
                {
                    from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
Example #24
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) )
				return;

			Roll( from );
		}
Example #25
0
		public override void OnDoubleClickSecureTrade( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
			}
			else if ( m_Entries.Count == 0 )
			{
				from.SendLocalizedMessage( 1062381 ); // The book is empty.
			}
			else
			{
				from.SendGump( new BOBGump( (PlayerMobile)from, this ) );

				SecureTradeContainer cont = GetSecureTradeCont();

				if ( cont != null )
				{
					SecureTrade trade = cont.Trade;

					if ( trade != null && trade.From.Mobile == from )
						trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.To.Mobile), this ) );
					else if ( trade != null && trade.To.Mobile == from )
						trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.From.Mobile), this ) );
				}
			}
		}
Example #26
0
 protected override void OnTarget( Mobile from, object targeted )
 {
     if ( !m_Plant.Deleted && from.InRange( m_Plant.GetWorldLocation(), 3 ) && targeted is Item )
     {
         m_Plant.Pour( from, (Item)targeted );
     }
 }
Example #27
0
		protected override void OnTargetOutOfRange( Mobile from, object targeted )
		{
			if ( targeted is UnholyBone && from.InRange( ((UnholyBone)targeted), 12 ) )
				((UnholyBone)targeted).Carve( from, m_Item );
			else
				base.OnTargetOutOfRange (from, targeted);
		}
Example #28
0
 protected override void OnTargetFinish( Mobile from )
 {
     if ( !m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && from.InRange( m_Plant.GetWorldLocation(), 3 ) && m_Plant.IsUsableBy( from ) && !from.HasGump( typeof(MainPlantGump) ) )
     {
         from.SendGump( new MainPlantGump( m_Plant ) );
     }
 }
		protected override void OnTargetFinish( Mobile from )
		{
			if ( !m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && m_Plant.PlantStatus != PlantStatus.BowlOfDirt && from.InRange( m_Plant.GetWorldLocation(), 3 ) && m_Plant.IsUsableBy( from ) )
			{
				from.SendGump( new ReproductionGump( m_Plant ) );
			}
		}
Example #30
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !from.InRange( Location, 2 ) )
            {
                // I can't reach that.
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 );
            }
            else if ( from is PlayerMobile && ( (PlayerMobile) from ).SacredQuest )
            {
                // You cannot think of any reason to want to do this.
                from.SendLocalizedMessage( 1080538 );
            }
            else if ( from.Backpack != null )
            {
                from.DropHolding();

                Item key = from.Backpack.FindItemByType( KeyType );

                if ( key != null )
                {
                    // You are already carrying a copy of this key fragment.
                    from.SendLocalizedMessage( 1111653 );
                }
                else
                {
                    from.PlaceInBackpack( (Item) Activator.CreateInstance( KeyType ) );

                    // You reach for the key and receive a glowing copy that you place in your bag.
                    from.SendLocalizedMessage( 1111652 );
                }
            }
        }