Example #1
0
        public static void BondInfo_OnTarget(Mobile from, object targeted)
        {	
            var baseCreature = targeted as BaseCreature;
            if (baseCreature != null)
            {
                if (baseCreature.ControlMaster == from)
                {
                    if (baseCreature.BondingBegin == DateTime.MinValue)
                    {
                        from.SendMessage("Your pet hasn't started to bond yet, please feed it and try again.");
                    }
                    else
                    {
                        DateTime today = DateTime.UtcNow;
                        DateTime willbebonded = baseCreature.BondingBegin.AddDays(7);
                        TimeSpan daystobond = willbebonded - today;
                        string BondInfo = string.Format("The pet started bonding with you at {0}. Its {1} days, {2} hours and {3} minutes until it bonds.", baseCreature.BondingBegin, daystobond.Days, daystobond.Hours, daystobond.Minutes);
                        from.SendMessage(BondInfo);
                    }		
							
                }
                else
                { 
                    from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(BondInfo_OnTarget));
                    from.SendMessage("That is not your pet!"); 
                } 	
			
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(BondInfo_OnTarget));
                from.SendMessage("That is not a pet!"); 
            }
        }
        public void OnTarget( Mobile from, object targeted, object state )
        {
            object[] states = (object[])state;
            BaseCommand command = (BaseCommand)states[0];
            string[] args = (string[])states[1];

            if ( !BaseCommand.IsAccessible( from, targeted ) )
            {
                from.SendMessage( "That is not accessible." );
                from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[]{ command, args } );
                return;
            }

            switch ( command.ObjectTypes )
            {
                case ObjectTypes.Both:
                {
                    if ( !(targeted is Item) && !(targeted is Mobile) )
                    {
                        from.SendMessage( "This command does not work on that." );
                        return;
                    }

                    break;
                }
                case ObjectTypes.Items:
                {
                    if ( !(targeted is Item) )
                    {
                        from.SendMessage( "This command only works on items." );
                        return;
                    }

                    break;
                }
                case ObjectTypes.Mobiles:
                {
                    if ( !(targeted is Mobile) )
                    {
                        from.SendMessage( "This command only works on mobiles." );
                        return;
                    }

                    break;
                }
            }

            RunCommand( from, targeted, command, args );

            from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[]{ command, args } );
        }
Example #3
0
        public void OnSelectBuilding(Mobile from, object target, object state)
        {
            BattleBuilding bb = target as BattleBuilding;
            ArrayList list = state as ArrayList;

            if (bb == null)
            {
                from.SendAsciiMessage(0x25, "Select the building to add the items to!");
                from.BeginTarget(18, false, TargetFlags.None, new TargetStateCallback(OnSelectBuilding), state);
                return;
            }

            int count = 0;

            foreach (Item i in list)
            {
                if (i != bb && !bb.Decorations.Contains(i))
                {
                    bb.Decorations.Add(i);
                    count++;
                }
            }

            from.SendAsciiMessage(count.ToString() + " items added to building.");
        }
Example #4
0
        private static void AllNames_OnTarget(Mobile from, object obj)
        {
            if (obj is AddressBook)
            {
                int count = 0;
                AddressBook book = (AddressBook)obj;

                if (book.Entries != null)

                    book.Entries.Clear();
                else
                    book.Entries = new ArrayList();
                foreach (Mobile m in World.Mobiles.Values)
                {
                    PlayerMobile mp = m as PlayerMobile;
                    if (mp != null)
                    {
                        count += 1;
                        book.AddEntry(mp);
                    }
                }

                from.SendMessage("The Address Book has been filled with " + count + " entries");

                CommandLogging.WriteLine(from, "{0} {1} filling Address Book {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(book));
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(AllNames_OnTarget));
                from.SendMessage("That is not a Address Book. Try again.");
            }
        }
Example #5
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                from.BeginTarget(-1, false, TargetFlags.None, (m, targeted) =>
                    {
                        if (!IsChildOf(m.Backpack))
                            m.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                        else if (targeted is BaseWeapon)
                        {
                            BaseWeapon wep = targeted as BaseWeapon;

                            if(!wep.IsChildOf(m.Backpack))
                                m.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                            else if (wep.TimesImbued > 0)
                                m.SendLocalizedMessage(1046439); // Invalid target.
                            else if (wep.Attributes.WeaponDamage > 0)
                            {
                                wep.Attributes.WeaponDamage = 0;
                                m.SendLocalizedMessage(1151814); // You have removed the damage increase from this weapon.

                                this.Consume();
                            }
                            else
                                m.SendLocalizedMessage(1046439); // Invalid target.
                        }
                        else
                            m.SendLocalizedMessage(1046439); // Invalid target.
                    });
            }
            else
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
        }
 public override void Process( Mobile from, BaseCommand command, string[] args )
 {
     if ( command.ValidateArgs( this, new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args ) ) )
     {
         from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[] { command, args } );
     }
 }
Example #7
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from ) )
				return;

			if ( m_UsesRemaining < 1 )
			{
				// You have no fukiya darts!
				from.SendLocalizedMessage( 1063325 );
			}
			else if ( m_Using )
			{
				// You are already using that fukiya.
				from.SendLocalizedMessage( 1063326 );
			}
			else if ( !BasePotion.HasFreeHand( from ) )
			{
				// You must have a free hand to use a fukiya.
				from.SendLocalizedMessage( 1063327 );
			}
			else
			{
				from.BeginTarget( 5, false, TargetFlags.Harmful, new TargetCallback( OnTarget ) );
			}
		}
Example #8
0
        public static void AddNewOrder( Mobile seller, MarketEntry entry )
        {
            seller.SendMessage("Select the object for this order.");
            seller.BeginTarget(12, false, Server.Targeting.TargetFlags.None, new TargetCallback(
                delegate( Mobile from, object targeted )
                {
                    if( targeted is IEntity )
                    {
                        if( targeted is Mobile )
                        {
                            Mobile mob = (Mobile)targeted;

                            if( mob is BaseCreature && ((BaseCreature)mob).ControlMaster == from )
                                FinalizeNewOrder(seller, entry, mob);
                            else
                                from.SendMessage("You do not have the right to sell that.");
                        }
                        else if( targeted is Item )
                        {
                            Item item = (Item)targeted;

                            if( item.IsChildOf(from.Backpack) || item.RootParent == from )
                                FinalizeNewOrder(seller, entry, item);
                            else
                                from.SendMessage("You do not have the right to sell that.");
                        }
                    }
                    else
                    {
                        from.SendMessage("That is not a valid market entity.");
                    }
                }));
        }
Example #9
0
		public override void OnDoubleClick( Mobile from )
		{
			if( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); //That must be in your pack to use it.
			}
			else
			{
				if( from.Skills.Magery.Base < 85 )
				{
					from.SendMessage( "The scroll bursts into flame in your hands!" );
					from.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Waist );
					from.Damage( Utility.RandomMinMax( 40, 55 ) );
					
					this.Delete();
				}
				else
				{
					from.Frozen = true;
					from.PublicOverheadMessage( MessageType.Spell, from.SpeechHue, true, "In Kal Quas", false );
					
					if( !from.Mounted && from.Body.IsHuman )
						from.Animate( 206, 7, 1, true, false, 0 );
					
					from.BeginTarget( 10, false, TargetFlags.None, new TargetCallback( BlessingOfKhopesh_OnTarget ) );
				}
			}
		}
Example #10
0
 public override void OnDoubleClick( Mobile from )
 {
     if ( !IsChildOf( from.Backpack ) )
         from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
     else
         from.BeginTarget( 1, false, TargetFlags.None, new TargetCallback( BurnWeb_Callback ) );
 }
Example #11
0
        public override void OnDoubleClick( Mobile from )
        {
            if( _owner == null )
                _owner = from;

            from.BeginTarget(1, false, TargetFlags.None, new TargetStateCallback(this_doorSelected), this);
            from.SendMessage("Select the door to install this trap onto.");
        }
		public override void OnDoubleClick(Mobile from)
		{
				if (from == null)
					return;

				from.RevealingAction();
				from.BeginTarget(1, false, TargetFlags.None, new TargetCallback(ItemClaimer_OnTarget));
		}
Example #13
0
 public override void OnDoubleClick(Mobile from)
 {
     if (IsChildOf(from.Backpack))
     {
         from.SendMessage("Target a corpse you'd like to net.");
         from.BeginTarget(10, false, TargetFlags.None, new TargetCallback(Net_OnTarget));
     }
 }
Example #14
0
 public override void OnDoubleClick(Mobile from)
 {
     if(ItemID == UnlitItemID)
     {
         from.SendMessage("Que voulez vous chauffer?");
         from.BeginTarget(2, false, TargetFlags.None, new TargetCallback(OnTarget));
     }
     base.OnDoubleClick(from);
 }
		public override void OnDoubleClick( Mobile from )
		{
			if( IsAccessibleTo( from ) && from.InRange( GetWorldLocation(), 3 ) )
			{
				from.SendLocalizedMessage( 1070929 ); // Select the artifact or enhanced magic item to dye.
				from.BeginTarget( 3, false, Server.Targeting.TargetFlags.None, new TargetStateCallback( InternalCallback ), this );
			}
			else
				from.SendLocalizedMessage( 502436 ); // That is not accessible.
		}
Example #16
0
        public override void OnDoubleClick(Mobile from)
        {
            if (this.RootParent != from)
            {
                from.SendMessage("This must be in your pack to use it.");
            }

            from.SendMessage("Select an item to repair.");
            from.BeginTarget(3, false, TargetFlags.None, new TargetCallback(OnTarget));
        }
		public override void OnDoubleClick(Mobile from)
		{
			if (from == null || from.Backpack == null)
				return;

			if (!IsChildOf(from.Backpack))
				from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
			else
				from.BeginTarget(1, false, TargetFlags.None, new TargetCallback(UseKey_OnTarget));
		}
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                return;
            }

            from.SendMessage("Who would you like to resurrect?");
            from.BeginTarget(2, false, TargetFlags.Beneficial, OnTarget);
        }
Example #19
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( from.Backpack == null || !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1080063 ); // This must be in your backpack to use it.
                return;
            }

            from.SendLocalizedMessage( 1111656 ); // What do you wish to use the acid on?
            from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( OnTarget ) );
        }
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
				return;
			}		
				
			from.SendLocalizedMessage( 1010484 ); // Where do you wish to use the net?
			from.BeginTarget( -1, true, TargetFlags.None, new TargetCallback( OnTarget ) );
		}
Example #21
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from.Backpack ) )
			{
				from.BeginTarget( 2, false, TargetFlags.None, new TargetCallback( OnTarget ) );
				from.SendMessage( "Select the Ancient Forge you wish to dip the weapon in." );
			}
			else
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
		}
Example #22
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from.Backpack ) )
			{
				from.BeginTarget( 6, false, TargetFlags.None, new TargetCallback( OnTarget ) );
				from.SendLocalizedMessage( 1053024 ); // Select the swamp dragon you wish to place the barding on.
			}
			else
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
		}
Example #23
0
 public override void OnDoubleClick( Mobile from )
 {
     if ( IsChildOf( from.Backpack ) )
     {
         from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( OnTarget ) );
         from.SendLocalizedMessage( 1005424 ); // Select the weapon or armor you wish to use the cloth on.
     }
     else
     {
         from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
     }
 }
Example #24
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else
			{
				from.BeginTarget( 2, false, TargetFlags.None, new TargetCallback( OnTarget ) );
				from.SendMessage( "What do you wish to use the gem on?" );
			}
		}
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			else
			{
				from.SendMessage( "Select a pair of Monk Fists you own." );
				from.BeginTarget( 1, false, TargetFlags.None, new TargetCallback( OnTarget ) );
			}

			return;
		}
Example #26
0
 public override void OnDoubleClick( Mobile from )
 {
     if ( IsChildOf( from.Backpack ) )
     {
         from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( OnTarget ) );
         from.SendAsciiMessage( "Select the weapon or armor you wish to use the cloth on." );
     }
     else
     {
         from.SendAsciiMessage( "That must be in your pack for you to use it." );
     }
 }
Example #27
0
        public static void ChooseItem_OnTarget(Mobile from, object targeted)
        {
            Item it = targeted as Item;

            if (it == null || !it.Movable || !(it.Parent is Container) || !(((Container)it.Parent).CheckItemUse(from, it)))
                from.SendMessage("Impossible de déplacer ceci!");
            else
            {
                from.SendMessage("Dans quel contenant voulez vous déposer le tout ?");
                from.BeginTarget(-1, true, TargetFlags.None, new TargetStateCallback(ChooseBag_OnTarget), it);
            }
        }
		public override void OnDoubleClick( Mobile from )
		{
			if ( from != Parent )
				from.SendLocalizedMessage( 1112886 ); // You must be wearing this item in order to use it.
			else if ( m_Ammo < 1 )
				from.SendMessage( "You do not have any knives ready for use." );
			else if ( ThrowDelay > DateTime.Now )
				from.SendLocalizedMessage( 501789 ); // You must wait before trying again.
			else
			{
				from.BeginTarget( 10, false, TargetFlags.Harmful, new TargetStateCallback<ACreedJinBori>( Target ), this );
			}
		}
Example #29
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsSigned || !CheckSeason( from ) )
				return;

			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1080063 ); // This must be in your backpack to use it.
				return;
			}

			from.BeginTarget( 10, false, TargetFlags.None, new TargetCallback( OnTarget ) );
			from.SendMessage( "Who do you wish to use this on?" );
		}
Example #30
0
		private static void EndGame_Target( Mobile from, object o )
		{
			if ( o is CTFGame )
			{
				CTFGame game = (CTFGame)o;
				game.EndGame();
				from.SendMessage( "The game has been ended." );
			}
			else
			{
				from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( EndGame_Target ) );
				from.SendMessage( "Target the game stone." );
			}
		}