Inheritance: System.Web.UI.Page
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( 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 = 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!" );
					SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
				}

				Effects.PlaySound( GetWorldLocation(), 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 );
			}
		}
 public override bool IsAccessibleTo(Mobile check)
 {
     //if ( ( check == m_Owner && m_Open ) || check.AccessLevel >= AccessLevel.GameMaster )
      		return base.IsAccessibleTo (check);
      	//else
      		//return false;
 }
Exemple #3
1
        public void Target(Mobile m)
        {
            if (!this.Caster.CanSee(m))
            {
                this.Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (this.CheckHSequence(m))
            {
                SpellHelper.Turn(this.Caster, m);

                SpellHelper.CheckReflect((int)this.Circle, this.Caster, ref m);

                SpellHelper.AddStatCurse(this.Caster, m, StatType.Dex);

                if (m.Spell != null)
                    m.Spell.OnCasterHurt();

                m.Paralyzed = false;

                m.FixedParticles(0x3779, 10, 15, 5002, EffectLayer.Head);
                m.PlaySound(0x1DF);

                int percentage = (int)(SpellHelper.GetOffsetScalar(this.Caster, m, true) * 100);
                TimeSpan length = SpellHelper.GetDuration(this.Caster, m);

                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Clumsy, 1075831, length, m, percentage.ToString()));

                this.HarmfulSpell(m);
            }

            this.FinishSequence();
        }
		public override bool IsEnemy( Mobile m )
		{
			if ( m.Player && m.FindItemOnLayer( Layer.Helm ) is OrcishKinMask )
				return false;

			return base.IsEnemy( m );
		}
 public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
 {
     from.RevealingAction();
     from.SendLocalizedMessage( 1049525 ); // Whom do you wish to calm?
     from.Target = new InternalTarget( from, instrument );
     from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.0 );
 }
Exemple #6
1
        public override bool OnMoveOver(Mobile m)
        {
            if (Core.ML)
                return true;

            return base.OnMoveOver(m);
        }
		public override void OnDoubleClick( Mobile from )
		{
			if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
				return;

			base.OnDoubleClick( from );
		}
 public SewerQuestGump( Mobile owner )
     : base(50,50)
 {
     //----------------------------------------------------------------------------------------------------
     AddPage( 0 );AddImageTiled(  54, 33, 369, 400, 2624 );AddAlphaRegion( 54, 33, 369, 400 );AddImageTiled( 416, 39, 44, 389, 203 );
     //--------------------------------------Window size bar--------------------------------------------
     AddImage( 97, 49, 9005 );AddImageTiled( 58, 39, 29, 390, 10460 );AddImageTiled( 412, 37, 31, 389, 10460 );
     AddBackground(85, 30, 329, 408, 3500);
     AddLabel( 140, 60, 0x34, "Infested Sewer" );
     //----------------------/----------------------------------------------/
     AddHtml( 107, 140, 300, 230, " < BODY > " +
     "<BASEFONT COLOR=YELLOW>Hi, I'm Brent. I work for Britain's <BR>" +
     "<BASEFONT COLOR=YELLOW>sewer management department. Recently<BR>" +
     "<BASEFONT COLOR=YELLOW>radioactive slimes have infested the<BR>" +
     "<BASEFONT COLOR=YELLOW>sewers. Needless to say I havent been<BR>" +
     "<BASEFONT COLOR=YELLOW>back to work since.  If you could kill<BR>" +
     "<BASEFONT COLOR=YELLOW>a few of them off and bring me back<BR>" +
     "<BASEFONT COLOR=YELLOW>30 bottles of radioactive acid as proof<BR>" +
     "<BASEFONT COLOR=YELLOW>I will reward you. Just be cautious, you<BR>" +
     "<BASEFONT COLOR=YELLOW>wouldn't believe the weird stuff people<BR>" +
     "<BASEFONT COLOR=YELLOW>flush down the drain.<BR>" +
     "<BASEFONT COLOR=YELLOW><BR>" +
     "<BASEFONT COLOR=YELLOW><BR>" +
     "<BASEFONT COLOR=YELLOW><BR>" +
     "<BASEFONT COLOR=YELLOW><BR>" +
     "<BASEFONT COLOR=YELLOW><BR>" +
     "</BODY>", false, true);
     //----------------------/----------------------------------------------/
     AddImage( 430, 9, 10441);AddImageTiled( 40, 38, 17, 391, 9263 );AddImage( 6, 25, 10421 );AddImage( 34, 12, 10420 );AddImageTiled( 94, 25, 342, 15, 10304 );AddImageTiled( 40, 427, 415, 16, 10304 );AddImage( -10, 314, 10402 );AddImage( 56, 150, 10411 );AddImage( 155, 120, 2103 );AddImage( 136, 84, 96 );AddButton( 225, 390, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 );
 }
Exemple #9
1
 public override void OnSingleClick(Mobile from)
 {
     if (this.Name != null)
     {
         if (Amount >= 2)
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " " + this.Name));
         }
         else
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", this.Name));
         }
     }
     else
     {
         if (Amount >= 2)
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " bales of cotton"));
         }
         else
         {
             from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", "a bale of cotton"));
         }
     }
 }
        public override int CanCraft( Mobile from, BaseTool tool, Type typeItem )
        {
            if ( tool.Deleted || tool.UsesRemaining < 0 )
                return 1044038; // You have worn out your tool!
            else if ( !BaseTool.CheckAccessible( tool, from ) )
                return 1044263; // The tool must be on your person to use.

            if ( typeItem != null )
            {
                object o = Activator.CreateInstance( typeItem );

                if ( o is SpellScroll )
                {
                    SpellScroll scroll = (SpellScroll)o;
                    Spellbook book = Spellbook.Find( from, scroll.SpellID );

                    bool hasSpell = ( book != null && book.HasSpell( scroll.SpellID ) );

                    scroll.Delete();

                    return ( hasSpell ? 0 : 1042404 ); // null : You don't have that spell!
                }
                else if ( o is Item )
                {
                    ((Item)o).Delete();
                }
            }

            return 0;
        }
Exemple #11
1
		public void Target( Mobile m )
		{
			if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

				/* Transmogrifies the flesh of the target creature or player to resemble rotted corpse flesh,
				 * making them more vulnerable to Fire and Poison damage,
				 * but increasing their resistance to Physical and Cold damage.
				 * 
				 * The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 25 ) + 40 seconds.
				 * 
				 * NOTE: Algorithm above is fixed point, should be:
				 * ((ss-mr)/2.5) + 40
				 * 
				 * NOTE: Resistance is not checked if targeting yourself
				 */

				ExpireTimer timer = (ExpireTimer)m_Table[m];

				if ( timer != null )
					timer.DoExpire();
				else
					m.SendLocalizedMessage( 1061689 ); // Your skin turns dry and corpselike.

				 if ( m.Spell != null )
					m.Spell.OnCasterHurt();
				
				m.FixedParticles( 0x373A, 1, 15, 9913, 67, 7, EffectLayer.Head );
				m.PlaySound( 0x1BB );

				double ss = GetDamageSkill( Caster );
				double mr = ( Caster == m ? 0.0 : GetResistSkill( m ) );
				m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 );	//Skill check for gain

				TimeSpan duration = TimeSpan.FromSeconds( ((ss - mr) / 2.5) + 40.0 );

				ResistanceMod[] mods = new ResistanceMod[4]
					{
						new ResistanceMod( ResistanceType.Fire, -15 ),
						new ResistanceMod( ResistanceType.Poison, -15 ),
						new ResistanceMod( ResistanceType.Cold, +10 ),
						new ResistanceMod( ResistanceType.Physical, +10 )
					};

				timer = new ExpireTimer( m, mods, duration );
				timer.Start();

				BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.CorpseSkin, 1075663, duration, m ) );

				m_Table[m] = timer;

				for ( int i = 0; i < mods.Length; ++i )
					m.AddResistanceMod( mods[i] );

				HarmfulSpell( m );
			}

			FinishSequence();
		}
Exemple #12
1
		public override void CraftInit( Mobile from )
		{
			double skillValue = from.Skills[SkillName.Cartography].Value;
			int dist = 64 + (int)(skillValue * 2);

			SetDisplay( from.X - dist, from.Y - dist, from.X + dist, from.Y + dist, 200, 200 );
		}
		public override void OnDoubleClick(Mobile from)
		{

		  if (from == null || from.Deleted || from.Backpack == null || from.Backpack.Deleted )
		    return;

		  PlayerMobile m_PMobile = (PlayerMobile)from;


		  if ( !this.IsChildOf(from.Backpack ))
		  {
			from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
			return;
		  }

		  if ( !m_PMobile.Young )
		  {
			from.SendMessage("Only young players are allowed to use and have this.");
			this.Delete();
			return;
		  }

		  from.CloseGump(typeof(NewPlayerGump));
		  from.SendGump(new NewPlayerGump(from));
		}
Exemple #14
1
        public static bool HasSpellMastery(Mobile m)
        {
            //Publish 71 PVP Spell damage increase cap changes. If you have GM of one school of magic and no others, you are "focused" in that school of magic and have 30% sdi cap instead of 15%.
            List<SkillName> schools = new List<SkillName>()
            {
                SkillName.Magery,
                SkillName.AnimalTaming,
                SkillName.Musicianship,
                SkillName.Mysticism,
                SkillName.Spellweaving,
                SkillName.Chivalry,
                SkillName.Necromancy,
                SkillName.Bushido,
                SkillName.Ninjitsu
            };

            bool spellMastery = false;

            foreach (SkillName skill in schools)
            {
                if (m.Skills[skill].Base >= 30.0 && spellMastery)
                    return false;
                if (m.Skills[skill].Base >= 100.0)
                    spellMastery = true;
            }
            return spellMastery;
        }
		protected override void OnTarget( Mobile from, object o )
		{
			if ( o is Mobile )
			{
				Mobile m = (Mobile)o;
				Party p = Party.Get( from );
				Party mp = Party.Get( m );

				if ( from == m )
					from.SendLocalizedMessage( 1005439 ); // You cannot add yourself to a party.
				else if ( p != null && p.Leader != from )
					from.SendLocalizedMessage( 1005453 ); // You may only add members to the party if you are the leader.
				else if ( m.Party is Mobile )
					return;
				else if ( p != null && (p.Members.Count + p.Candidates.Count) >= Party.Capacity )
					from.SendLocalizedMessage( 1008095 ); // You may only have 10 in your party (this includes candidates).
				else if ( !m.Player && m.Body.IsHuman )
					m.SayTo( from, 1005443 ); // Nay, I would rather stay here and watch a nail rust.
				else if ( !m.Player )
					from.SendLocalizedMessage( 1005444 ); // The creature ignores your offer.
				else if ( mp != null && mp == p )
					from.SendLocalizedMessage( 1005440 ); // This person is already in your party!
				else if ( mp != null )
					from.SendLocalizedMessage( 1005441 ); // This person is already in a party!
				else
					Party.Invite( from, m );
			}
			else
			{
				from.SendLocalizedMessage( 1005442 ); // You may only add living things to your party!
			}
		}
Exemple #16
1
        public override void OnDoubleClick(Mobile from)
        {
            bool wasBurning = this.Burning;

            base.OnDoubleClick(from);

            if (!wasBurning && this.Burning)
            {
                PlayerMobile player = from as PlayerMobile;

                if (player == null)
                    return;

                QuestSystem qs = player.Quest;

                if (qs != null && qs is HaochisTrialsQuest)
                {
                    QuestObjective obj = qs.FindObjective(typeof(SixthTrialIntroObjective));

                    if (obj != null && !obj.Completed)
                        obj.Complete();

                    this.SendLocalizedMessageTo(from, 1063251); // You light a candle in honor.
                }
            }
        }
Exemple #17
1
        public override void OnSingleClick(Mobile from)
        {
            base.OnSingleClick(from);

            if (!String.IsNullOrEmpty(this.m_Subtext))
                this.LabelTo(from, m_Subtext);
        }
Exemple #18
1
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
                return;

            ClearCurrentAbility( attacker );

            defender.PlaySound( 0x213 );

            attacker.SendLocalizedMessage( 1074383 ); // Your shot sends forth a wave of psychic energy.
            defender.SendLocalizedMessage( 1074384 ); // Your mind is attacked by psychic force!

            int extraDamage = 10 * (int) ( attacker.Int / defender.Int );

            if ( extraDamage < 10 )
                extraDamage = 10;
            if ( extraDamage > 20 )
                extraDamage = 20;

            AOS.Damage( defender, attacker, extraDamage, 100, 0, 0, 0, 0 ); // 100% Physical Damage

            if ( m_EffectTable.ContainsKey( defender ) )
                m_EffectTable[defender].Stop();

            m_EffectTable[defender] = Timer.DelayCall( TimeSpan.FromSeconds( 8.0 ), new TimerStateCallback( Expire_Callback ), defender );
        }
        public override void OnSingleClick(Mobile from)
        {
            base.OnSingleClick(from);

            if (IsArcane)
                LabelTo(from, 1061837, String.Format("{0}\t{1}", m_CurArcaneCharges, m_MaxArcaneCharges));
        }
		public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) {
			// Make sure we've been standing still for one second
			if( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.AOS ? 0.5 : 1.0 )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) ) {
				bool canSwing = true;

				if( Core.AOS ) {
					canSwing = (!attacker.Paralyzed && !attacker.Frozen);

					if( canSwing ) {
						Spell sp = attacker.Spell as Spell;

						canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement);
					}
				}

				if( canSwing && attacker.HarmfulCheck( defender ) ) {
					attacker.DisruptiveAction();
					attacker.Send( new Swing( 0, attacker, defender ) );

					if( OnFired( attacker, defender ) ) {
						if( CheckHit( attacker, defender ) )
							OnHit( attacker, defender );
						else
							OnMiss( attacker, defender );
					}
				}

				return GetDelay( attacker );
			} else {
				return TimeSpan.FromSeconds( 0.25 );
			}
		}
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted == m_Ticket )
				{
					from.SendLocalizedMessage( 501928 ); // You can't target the same ticket!
				}
				else if ( targeted is EtherealMountDeed )
				{
					EtherealMountDeed theirTicket = targeted as EtherealMountDeed;
					Mobile them = theirTicket.m_Owner;

					if ( them == null || them.Deleted )
					{
						from.SendLocalizedMessage( 501930 ); // That is not a valid ticket.
					}
					else
					{
						from.SendGump( new InternalGump( from, m_Ticket ) );
						them.SendGump( new InternalGump( them, theirTicket ) );
					}
				}
				else if ( targeted is Item && ((Item)targeted).ItemID == 0x14F0 )
				{
					from.SendLocalizedMessage( 501931 ); // You need to find another ticket marked NEW PLAYER.
				}
				else
				{
					from.SendLocalizedMessage( 501929 ); // You will need to select a ticket.
				}
			}
		//public override bool DisplayLootType{ get{ return true; } }

		public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target
		{
			if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
			{
				 from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else
			{
		 		this.Delete(); 
				from.SendMessage( "The item has been placed in your backpack." );
				switch ( Utility.Random( 5 ) ) //Random chance of armor 
                        	{ 
                          		case 0: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 1: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 2: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 3: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 4: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                        	} 

			 }
		}	
			public override void OnDoubleClick( Mobile from )
			{
				if(IsPartOf != null)
					IsPartOf.OnDoubleClick(from);
				else
					base.OnDoubleClick(from);
			}
Exemple #24
1
        public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item)
        {
            if (toolBroken)
                from.SendLocalizedMessage(1044038); // You have worn out your tool

            if (failed)
            {
                if (lostMaterial)
                    return 1044043; // You failed to create the item, and some of your materials are lost.
                else
                    return 1044157; // You failed to create the item, but no materials were lost.
            }
            else
            {
                from.PlaySound(0x41); // glass breaking

                if (quality == 0)
                    return 502785; // You were barely able to make this item.  It's quality is below average.
                else if (makersMark && quality == 2)
                    return 1044156; // You create an exceptional quality item and affix your maker's mark.
                else if (quality == 2)
                    return 1044155; // You create an exceptional quality item.
                else
                    return 1044154; // You create the item.
            }
        }
		public override void OnDoubleClick( Mobile from )
		{
			if (! from.InRange( this.GetWorldLocation(), 1 ))
			{
				from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that.
			}	
		}
Exemple #26
1
 public override void PlayCraftEffect(Mobile from)
 {
     from.PlaySound(0x2B); // bellows
     //if ( from.Body.Type == BodyType.Human && !from.Mounted )
     //	from.Animate( 9, 5, 1, true, false, 0 );
     //new InternalTimer( from ).Start();
 }
Exemple #27
0
		public override bool DropToItem( Mobile from, Item target, Point3D p )
		{
			bool ret = base.DropToItem( from, target, p );

			if ( ret && !Accepted && Parent != from.Backpack )
			{
				if ( from.AccessLevel > AccessLevel.Player )
				{
					return true;
				}
				else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
				{
					return true;
				}
				else
				{
					from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
					return false;
				}
			}
			else
			{
				return ret;
			}
		}
Exemple #28
0
		public void OnTargetGears( Mobile from, object targ )
		{
			Gears g = targ as Gears;

			if ( g == null || !g.IsChildOf( from.Backpack ) )
			{
				from.SendMessage( "Those are not gears." ); // Apparently gears that aren't in your backpack aren't really gears at all. :-(
			}
			else if ( IsModified )
			{
				from.SendMessage( "That has already been modified." );
			}
			else if ( !IsChildOf( from.Backpack ) )
			{
				from.SendMessage( "This must be in your backpack to modify it." );
			}
			else if ( from.Skills[SkillName.Fletching].Base < 100.0 )
			{
				from.SendMessage( "Only a grandmaster bowcrafter can modify this weapon." );
			}
			else
			{
				g.Consume();

				Hue = 0x453;
				Slayer = (SlayerName)Utility.Random( 2, 25 );

				from.SendMessage( "You modify it." );
			}
		}
Exemple #29
0
		public override bool HandlesOnSpeech( Mobile from )
		{
			if ( from.AccessLevel >= AccessLevel.GameMaster )
				return true;

			return base.HandlesOnSpeech( from );
		}
Exemple #30
0
 protected override void OnTarget(Mobile from, object o)
 {
     if (o is Mobile)
     {
         this.m_Owner.Target((Mobile)o);
     }
 }
Exemple #31
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;


            if (info == null || sender == null || sender.Mobile == null)
            {
                return;
            }

            switch (info.ButtonID)
            {
            case ( int )Buttons.CloseBtn:
            {
                break;
            }

            case 12:
                // page up
                int nitems = 0;
                nitems = 5000;

                int page = viewpage + 1;
                if (page > nitems / maxItemsPerPage)
                {
                    page = nitems / maxItemsPerPage;
                }
                from.SendGump(new ViewHueGump(from, page));
                break;

            case 13:
                // page down
                page = viewpage - 1;
                if (page < 0)
                {
                    page = 0;
                }
                from.SendGump(new ViewHueGump(from, page));
                break;

            case 15:
            {
                // go to hue page
                int hueToFind = 0;

                string huestring = info.GetTextEntry(14).Text;

                try
                {
                    hueToFind = Convert.ToInt32(huestring, 10);
                }
                catch
                {
                    hueToFind = 1;
                }

                if (hueToFind < 1)
                {
                    hueToFind = 1;
                }

                if (hueToFind > TOTAL_HUES)
                {
                    hueToFind = TOTAL_HUES;
                }

                if (hueToFind == null)
                {
                    hueToFind = 1;
                }

                int pageHueFound = (hueToFind - 1) / maxItemsPerPage;

                from.SendGump(new ViewHueGump(from, pageHueFound));

                break;
            }

            case 99:
            {
                int hueselection = 0;
                int pageHueFound = 0;

                CommandSystem.Handle(from, String.Format("{0}Set Hue {1}", CommandSystem.Prefix, hueselection));

                from.SendGump(new ViewHueGump(from, viewpage));
                break;
            }

            default:
            {
                if (info.ButtonID >= 4000 && info.ButtonID < 7001)
                {
                    int hueselection = info.ButtonID - 3999;
                    int pageHueFound = (hueselection) / maxItemsPerPage;


                    CommandSystem.Handle(from, String.Format("{0}Set Hue {1}", CommandSystem.Prefix, hueselection));

                    from.SendGump(new ViewHueGump(from, viewpage));
                    break;
                }
                break;
            }
            }
        }
Exemple #32
0
 public static TimeSpan GetDelay(Mobile healer, Mobile patient, bool dead)
 {
     return(GetDelay(healer, patient, dead, GetPrimarySkill(healer, patient)));
 }
Exemple #33
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!BaseCommand.IsAccessible(from, m_Object))
            {
                from.SendMessage("You may no longer access their properties.");
                return;
            }

            switch (info.ButtonID)
            {
            case 0:                     // Closed
            {
                if (m_Stack != null && m_Stack.Count > 0)
                {
                    object obj = m_Stack.Pop();

                    from.SendGump(new XmlPropertiesGump(from, obj, m_Stack, null));
                }

                break;
            }

            case 1:                     // Previous
            {
                if (m_Page > 0)
                {
                    from.SendGump(new XmlPropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1));
                }

                break;
            }

            case 2:                     // Next
            {
                if ((m_Page + 1) * EntryCount < m_List.Count)
                {
                    from.SendGump(new XmlPropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1));
                }

                break;
            }

            default:
            {
                int index = (m_Page * EntryCount) + (info.ButtonID - 3);

                if (index >= 0 && index < m_List.Count)
                {
                    PropertyInfo prop = m_List[index] as PropertyInfo;

                    if (prop == null)
                    {
                        return;
                    }

                    CPA attr = GetCPA(prop);

                    if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel)
                    {
                        return;
                    }

                    Type type = prop.PropertyType;

                    if (IsType(type, typeofMobile) || IsType(type, typeofItem))
                    {
                        from.SendGump(new XmlSetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List));
                    }
                    else if (IsType(type, typeofType))
                    {
                        from.Target = new XmlSetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List);
                    }
                    else if (IsType(type, typeofPoint3D))
                    {
                        from.SendGump(new XmlSetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofPoint2D))
                    {
                        from.SendGump(new XmlSetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofTimeSpan))
                    {
                        from.SendGump(new XmlSetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsCustomEnum(type))
                    {
                        from.SendGump(new XmlSetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List, GetCustomEnumNames(type)));
                    }
                    else if (IsType(type, typeofEnum))
                    {
                        from.SendGump(
                            new XmlSetListOptionGump(
                                prop, from, m_Object, m_Stack, m_Page, m_List, Enum.GetNames(type), GetObjects(Enum.GetValues(type))));
                    }
                    else if (IsType(type, typeofBool))
                    {
                        from.SendGump(
                            new XmlSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames, m_BoolValues));
                    }
                    else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric))
                    {
                        from.SendGump(new XmlSetGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofPoison))
                    {
                        from.SendGump(
                            new XmlSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues));
                    }
                    else if (IsType(type, typeofMap))
                    {
                        from.SendGump(
                            new XmlSetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), Map.GetMapValues()));
                    }
                    else if (IsType(type, typeofSkills) && m_Object is Mobile)
                    {
                        from.SendGump(new XmlPropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
                        from.SendGump(new SkillsGump(from, (Mobile)m_Object));
                    }
                    else if (HasAttribute(type, typeofPropertyObject, true))
                    {
                        from.SendGump(new XmlPropertiesGump(from, prop.GetValue(m_Object, null), m_Stack, m_Object));
                    }
                }

                break;
            }
            }
        }
Exemple #34
0
 public SecureTrade FindTrade(Mobile m)
 {
     return(m_Trades.Where(t => t.From.Mobile == m || t.To.Mobile == m).FirstOrDefault());
 }
Exemple #35
0
 public bool CanDispel(Mobile m)
 {
     return(m is BaseCreature && ((BaseCreature)m).Summoned && m_Mobile.CanBeHarmful(m, false) && !((BaseCreature)m).IsAnimatedDead);
 }
Exemple #36
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            Spell spell = null;

            if (!SmartAI)
            {
                spell = CheckCastHealingSpell();

                if (spell != null)
                {
                    return(spell);
                }

                if (IsNecromancer)
                {
                    double psDamage = ((m_Mobile.Skills[SkillName.SpiritSpeak].Value - c.Skills[SkillName.MagicResist].Value) / 10) + (c.Player ? 18 : 30);

                    if (psDamage > c.Hits)
                    {
                        return(new PainSpikeSpell(m_Mobile, null));
                    }
                }

                switch (Utility.Random(16))
                {
                case 0:
                case 1:                         // Poison them
                {
                    if (c.Poisoned)
                    {
                        goto default;
                    }

                    m_Mobile.DebugSay("Attempting to poison");

                    spell = new PoisonSpell(m_Mobile, null);
                    break;
                }

                case 2:                         // Bless ourselves
                {
                    m_Mobile.DebugSay("Blessing myself");

                    spell = new BlessSpell(m_Mobile, null);
                    break;
                }

                case 3:
                case 4:                         // Curse them
                {
                    m_Mobile.DebugSay("Attempting to curse");

                    spell = GetRandomCurseSpell();
                    break;
                }

                case 5:                         // Paralyze them
                {
                    if (c.Paralyzed || m_Mobile.Skills[SkillName.Magery].Value <= 50.0)
                    {
                        goto default;
                    }

                    m_Mobile.DebugSay("Attempting to paralyze");

                    spell = new ParalyzeSpell(m_Mobile, null);
                    break;
                }

                case 6:                         // Drain mana
                {
                    m_Mobile.DebugSay("Attempting to drain mana");

                    spell = GetRandomManaDrainSpell();
                    break;
                }

                case 7:                         // Invis ourselves
                {
                    if (Utility.RandomBool())
                    {
                        goto default;
                    }

                    m_Mobile.DebugSay("Attempting to invis myself");

                    spell = new InvisibilitySpell(m_Mobile, null);
                    break;
                }

                default:                         // Damage them
                {
                    m_Mobile.DebugSay("Just doing damage");

                    spell = GetRandomDamageSpell();
                    break;
                }
                }

                return(spell);
            }

            spell = CheckCastHealingSpell();

            if (spell != null)
            {
                return(spell);
            }

            switch (Utility.Random(3))
            {
            case 0:                     // Poison them
            {
                if (c.Poisoned)
                {
                    goto case 1;
                }

                spell = new PoisonSpell(m_Mobile, null);
                break;
            }

            case 1:                     // Deal some damage
            {
                spell = GetRandomDamageSpell();

                break;
            }

            default:                     // Set up a combo
            {
                if (m_Mobile.Mana > 15 && m_Mobile.Mana < 40)
                {
                    if (c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating)
                    {
                        m_Mobile.DebugSay("I am going to meditate");

                        m_Mobile.UseSkill(SkillName.Meditation);
                    }
                    else if (!c.Poisoned)
                    {
                        spell = new ParalyzeSpell(m_Mobile, null);
                    }
                }
                else if (m_Mobile.Mana > 60)
                {
                    if (Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Combo = 0;
                        spell   = new ParalyzeSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Combo = 1;
                        spell   = new ExplosionSpell(m_Mobile, null);
                    }
                }

                break;
            }
            }

            return(spell);
        }
Exemple #37
0
 public static TimeSpan GetDelay(Mobile healer, Mobile patient)
 {
     return(GetDelay(healer, patient, !patient.Alive || patient.IsDeadBondedPet));
 }
Exemple #38
0
        public ReforgingContext(Mobile m)
        {
            Contexts = new Dictionary <BaseTool, ReforgingOption>();

            ReforgingContexts[m] = this;
        }
Exemple #39
0
 public SoulReaperSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
 {
 }
Exemple #40
0
 public InternalTimer(Mobile owner) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.5))
 {
     m_Owner  = owner;
     m_Expire = DateTime.UtcNow + TimeSpan.FromSeconds(30.0);
 }
		public override void BreathDealDamage( Mobile target, int form ){ base.BreathDealDamage( target, 6 ); }
 public StoneFormSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
 {
 }
 public static bool HasEffect(Mobile m)
 {
     return (m_Table[m] != null);
 }
Exemple #44
0
        public override bool DoActionCombat()
        {
            Mobile c = m_Mobile.Combatant;

            m_Mobile.Warmode = true;

            if (c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map)
            {
                // Our combatant is deleted, dead, hidden, or we cannot hurt them
                // Try to find another combatant

                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name);

                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob  = null;
                }
                else
                {
                    m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard.");
                    Action = ActionType.Guard;
                    return(true);
                }
            }

            if (!m_Mobile.InLOS(c))
            {
                m_Mobile.DebugSay("I can't see my target");

                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.DebugSay("I will switch to {0}", m_Mobile.FocusMob.Name);
                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob  = null;
                }
            }

            if (!Core.AOS && SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0)
            {
                EventSink.InvokeStunRequest(new StunRequestEventArgs(m_Mobile));
            }

            if (!m_Mobile.InRange(c, m_Mobile.RangePerception))
            {
                // They are somewhat far away, can we find something else?

                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.Combatant = m_Mobile.FocusMob;
                    m_Mobile.FocusMob  = null;
                }
                else if (!m_Mobile.InRange(c, m_Mobile.RangePerception * 3))
                {
                    m_Mobile.Combatant = null;
                }

                c = m_Mobile.Combatant;

                if (c == null)
                {
                    m_Mobile.DebugSay("My combatant has fled, so I am on guard");
                    Action = ActionType.Guard;

                    return(true);
                }
            }

            if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee)
            {
                if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100)
                {
                    // We are low on health, should we flee?

                    bool flee = false;

                    if (m_Mobile.Hits < c.Hits)
                    {
                        // We are more hurt than them

                        int diff = c.Hits - m_Mobile.Hits;

                        flee = (Utility.Random(0, 100) > (10 + diff));                               // (10 + diff)% chance to flee
                    }
                    else
                    {
                        flee = Utility.Random(0, 100) > 10;                           // 10% chance to flee
                    }

                    if (flee)
                    {
                        m_Mobile.DebugSay("I am going to flee from {0}", c.Name);

                        Action = ActionType.Flee;
                        return(true);
                    }
                }
            }

            if (m_Mobile.Spell == null && Core.TickCount - m_NextCastTime >= 0 && m_Mobile.InRange(c, Core.ML ? 10 : 12))
            {
                // We are ready to cast a spell

                Spell  spell    = null;
                Mobile toDispel = FindDispelTarget(true);

                if (m_Mobile.Poisoned)                  // Top cast priority is cure
                {
                    m_Mobile.DebugSay("I am going to cure myself");

                    spell = new CureSpell(m_Mobile, null);
                }
                else if (toDispel != null)                  // Something dispellable is attacking us
                {
                    m_Mobile.DebugSay("I am going to dispel {0}", toDispel);

                    spell = DoDispel(toDispel);
                }
                else if (SmartAI && m_Combo != -1)                  // We are doing a spell combo
                {
                    spell = DoCombo(c);
                }
                else if (SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned)                    // They have a heal spell out
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }
                else
                {
                    spell = ChooseSpell(c);
                }

                // Now we have a spell picked
                // Move first before casting

                if (SmartAI && toDispel != null)
                {
                    if (m_Mobile.InRange(toDispel, 10))
                    {
                        RunFrom(toDispel);
                    }
                    else if (!m_Mobile.InRange(toDispel, Core.ML ? 10 : 12))
                    {
                        RunTo(toDispel);
                    }
                }
                else
                {
                    RunTo(c);
                }

                if (spell != null)
                {
                    spell.Cast();
                }

                m_NextCastTime = Core.TickCount + (int)GetDelay(spell).TotalMilliseconds;
            }
            else if (m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting)
            {
                RunTo(c);
            }

            m_LastTarget    = c;
            m_LastTargetLoc = c.Location;

            return(true);
        }
Exemple #45
0
 protected override void OnTargetFinish(Mobile from)
 {
     m_Owner.FinishSequence();
 }
Exemple #46
0
        public ViewHueGump(Mobile from, int page) : base(0, 0)
        {
            viewpage = page;

            int gotopageheight = 500;
            int pagewidth      = 353;
            int height         = maxItemsPerPage * y_inc + 150;
            int width          = x_pointsoffset + 45;

            PlayerMobile pm = from as PlayerMobile;

            this.Closable   = false;
            this.Disposable = false;
            this.Dragable   = true;
            this.Resizable  = false;

            AddPage(0);
            AddBackground(35, 67, 190, 460, 9200);
            //AddBackground(35, 67, 190, 460, 9200);
            //AddBackground(42, 93, 175, 342, 1755);

            AddHtml(46, 72, 150, 20,
                    @"<basefont color = #478cf7><center><h1>View Hue", ( bool )false, ( bool )false);
            AddButton(200, 76, 3, 4, ( int )Buttons.CloseBtn, GumpButtonType.Reply, 0);

            AddLabel(60, 100, 294, "Hue");

            int y = 100;

            for (int i = 0; i < TOTAL_HUES; i++)
            {
                if (i / maxItemsPerPage != viewpage)
                {
                    continue;
                }

                y += 20;

                int    texthue = i;
                string color   = Convert.ToString(texthue + 1);

                AddLabel(60, y + 3, texthue, color);

                AddItem(85, y, 0xFAB, texthue + 1);

                //The Button That Hues
                AddButton(pagewidth - 205, y, 0x992, 0x993, i + 4000, GumpButtonType.Reply, 0);
            }

            AddHtml(85, 435, 200, 20, String.Format(
                        @"<basefont color =  #478cf7 >Page: {0}/{1}"
                        , viewpage + 1, 3000 / maxItemsPerPage), ( bool )false, ( bool )false);
            // page up and down buttons
            AddButton(65, 437, 0x15E0, 0x15E4, 13, GumpButtonType.Reply, 0);
            AddButton(50, 437, 0x15E2, 0x15E6, 12, GumpButtonType.Reply, 0);

            AddHtml(50, 455, 160, 60,
                    @"<basefont color = #094175><center>Enter a hue number to jump directly to it's page", false, false);
            AddAlphaRegion(80, gotopageheight - 4, 65, 20);
            AddTextEntry(80, gotopageheight - 4, 65, 20, 294, 14, @"1");
            // GoTo Hue Button
            AddButton(150, gotopageheight - 2, 2224, 2224, 15, GumpButtonType.Reply, 0);

            AddButton(195, 438, 0x4B9, 0x4BA, 99, GumpButtonType.Reply, 0);//Hue 0 Button
            AddHtml(185, 435, 50, 20, @"<basefont color = #478cf7 >0",
                    ( bool )false, ( bool )false);
        }
Exemple #47
0
        public Mobile FindDispelTarget(bool activeOnly)
        {
            if (m_Mobile.Deleted || m_Mobile.Int < 95 || CanDispel(m_Mobile) || m_Mobile.AutoDispel)
            {
                return(null);
            }

            if (activeOnly)
            {
                List <AggressorInfo> aggressed  = m_Mobile.Aggressed;
                List <AggressorInfo> aggressors = m_Mobile.Aggressors;

                Mobile active     = null;
                double activePrio = 0.0;

                Mobile comb = m_Mobile.Combatant;

                if (comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange(comb, Core.ML ? 10 : 12) && CanDispel(comb))
                {
                    active     = comb;
                    activePrio = m_Mobile.GetDistanceToSqrt(comb);

                    if (activePrio <= 2)
                    {
                        return(active);
                    }
                }

                for (int i = 0; i < aggressed.Count; ++i)
                {
                    AggressorInfo info = aggressed[i];
                    Mobile        m    = info.Defender;

                    if (m != comb && m.Combatant == m_Mobile && m_Mobile.InRange(m, Core.ML ? 10 : 12) && CanDispel(m))
                    {
                        double prio = m_Mobile.GetDistanceToSqrt(m);

                        if (active == null || prio < activePrio)
                        {
                            active     = m;
                            activePrio = prio;

                            if (activePrio <= 2)
                            {
                                return(active);
                            }
                        }
                    }
                }

                for (int i = 0; i < aggressors.Count; ++i)
                {
                    AggressorInfo info = aggressors[i];
                    Mobile        m    = info.Attacker;

                    if (m != comb && m.Combatant == m_Mobile && m_Mobile.InRange(m, Core.ML ? 10 : 12) && CanDispel(m))
                    {
                        double prio = m_Mobile.GetDistanceToSqrt(m);

                        if (active == null || prio < activePrio)
                        {
                            active     = m;
                            activePrio = prio;

                            if (activePrio <= 2)
                            {
                                return(active);
                            }
                        }
                    }
                }

                return(active);
            }
            else
            {
                Map map = m_Mobile.Map;

                if (map != null)
                {
                    Mobile active = null, inactive = null;
                    double actPrio = 0.0, inactPrio = 0.0;

                    Mobile comb = m_Mobile.Combatant;

                    if (comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel(comb))
                    {
                        active  = inactive = comb;
                        actPrio = inactPrio = m_Mobile.GetDistanceToSqrt(comb);
                    }

                    foreach (Mobile m in m_Mobile.GetMobilesInRange(Core.ML ? 10 : 12))
                    {
                        if (m != m_Mobile && CanDispel(m))
                        {
                            double prio = m_Mobile.GetDistanceToSqrt(m);

                            if (!activeOnly && (inactive == null || prio < inactPrio))
                            {
                                inactive  = m;
                                inactPrio = prio;
                            }

                            if ((m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio))
                            {
                                active  = m;
                                actPrio = prio;
                            }
                        }
                    }

                    return(active != null ? active : inactive);
                }
            }

            return(null);
        }
        protected virtual void GenerateTreasure(Mobile from)
        {
            int  MinGold = 1;
            int  MaxGold = 2;
            bool trapped = TrapOnLockpick;

            switch (m_TreasureLevel)
            {
            case TreasureLevel.Level1:
                MinGold = 25;
                MaxGold = 75;
                if (trapped)
                {
                    AddLoot(LootPack.Meager);
                }
                break;

            case TreasureLevel.Level2:
                MinGold = 50;
                MaxGold = 100;
                if (trapped)
                {
                    AddLoot(LootPack.Meager);
                }
                break;

            case TreasureLevel.Level3:
                MinGold = 80;
                MaxGold = 125;
                if (trapped)
                {
                    AddLoot(LootPack.Average);
                }
                break;

            case TreasureLevel.Level4:
                MinGold = 150;
                MaxGold = 275;
                if (trapped)
                {
                    AddLoot(LootPack.Average);
                }
                break;

            case TreasureLevel.Level5:
                MinGold = 325;
                MaxGold = 405;
                AddLoot(LootPack.Average);
                if (trapped)
                {
                    AddLoot(LootPack.Rich);
                }
                break;

            case TreasureLevel.Level6:
                MinGold = 575;
                MaxGold = 725;
                AddLoot(LootPack.Rich);
                if (trapped)
                {
                    AddLoot(LootPack.Rich);
                }
                break;

            case TreasureLevel.Level7:
                MinGold = 975;
                MaxGold = 1790;
                AddLoot(LootPack.Rich);
                if (trapped)
                {
                    AddLoot(LootPack.FilthyRich);
                }
                break;

            default:
            case TreasureLevel.Level8:
                MinGold = 1475;
                MaxGold = 2635;
                AddLoot(LootPack.FilthyRich);
                if (trapped)
                {
                    AddLoot(LootPack.UltraRich);
                }
                break;
            }

            double scalar = GetDifficultyScalar(from);

            if (scalar > 0)
            {
                DropItem(new Gold((int)(MinGold * scalar), (int)(MaxGold * scalar)));
            }
        }
Exemple #49
0
        public virtual Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if (m_Combo == 0)
            {
                spell = new ExplosionSpell(m_Mobile, null);
                ++m_Combo;                 // Move to next spell
            }
            else if (m_Combo == 1)
            {
                spell = new WeakenSpell(m_Mobile, null);
                ++m_Combo;                 // Move to next spell
            }
            else if (m_Combo == 2)
            {
                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }
                else if (IsNecromancer)
                {
                    spell = new StrangleSpell(m_Mobile, null);
                }

                ++m_Combo;                 // Move to next spell
            }

            if (m_Combo == 3 && spell == null)
            {
                switch (Utility.Random(IsNecromancer ? 4 : 3))
                {
                case 0:
                {
                    if (c.Int < c.Dex)
                    {
                        spell = new FeeblemindSpell(m_Mobile, null);
                    }
                    else
                    {
                        spell = new ClumsySpell(m_Mobile, null);
                    }

                    ++m_Combo;                                     // Move to next spell

                    break;
                }

                case 1:
                {
                    spell   = new EnergyBoltSpell(m_Mobile, null);
                    m_Combo = -1;                                     // Reset combo state
                    break;
                }

                case 2:
                {
                    spell   = new FlameStrikeSpell(m_Mobile, null);
                    m_Combo = -1;                                     // Reset combo state
                    break;
                }

                default:
                {
                    spell   = new PainSpikeSpell(m_Mobile, null);
                    m_Combo = -1;                                     // Reset combo state
                    break;
                }
                }
            }
            else if (m_Combo == 4 && spell == null)
            {
                spell   = new MindBlastSpell(m_Mobile, null);
                m_Combo = -1;
            }

            return(spell);
        }
        public override void LockPick(Mobile from)
        {
            base.LockPick(from);

            GenerateTreasure(from);
        }
Exemple #51
0
 public void RunFrom(Mobile m)
 {
     Run((m_Mobile.GetDirectionTo(m) - 4) & Direction.Mask);
 }
Exemple #52
0
        public static bool IsInCooldown(Mobile from)
        {
            Defrag();

            return(m_Table.ContainsKey(from));
        }
		protected override void OnTarget( Mobile from, object targeted )
		{
			if ( m_Item.Deleted )
				return;

			if ( targeted is ICarvable )
			{
				((ICarvable)targeted).Carve( from, m_Item );
			}
			else if ( targeted is SwampDragon && ((SwampDragon)targeted).HasBarding )
			{
				SwampDragon pet = (SwampDragon)targeted;

				if ( !pet.Controlled || pet.ControlMaster != from )
					from.SendLocalizedMessage( 1053022 ); // You cannot remove barding from a swamp dragon you do not own.
				else
					pet.HasBarding = false;
			}
			else
			{
				if ( targeted is StaticTarget )
				{
					int itemID = ((StaticTarget)targeted).ItemID;

					if ( itemID == 0xD15 || itemID == 0xD16 ) // red mushroom
					{
						PlayerMobile player = from as PlayerMobile;

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

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

								if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms )
								{
									player.SendLocalizedMessage( 1055036 ); // You slice a red cap mushroom from its stem.
									obj.Complete();
									return;
								}
							}
						}
					}
				}

				HarvestSystem system = Lumberjacking.System;
				HarvestDefinition def = Lumberjacking.System.Definition;

				int tileID;
				Map map;
				Point3D loc;

				if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else if ( !def.Validate( tileID ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else
				{
					HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

					if ( bank == null )
						return;

					if ( bank.Current < 5 )
					{
						from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
					}
					else
					{
						bank.Consume( 5, from );

						Item item = new Kindling();

						if ( from.PlaceInBackpack( item ) )
						{
							from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
							from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
						}
						else
						{
							from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!

							item.Delete();
						}
					}
				}
			}
		}
        public bool CanUse(Mobile from)
        {
            if (from == null)
            {
                return(false);
            }

            if (from.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            if (!from.Alive)
            {
                return(false);
            }

            if (IsChildOf(from.Backpack) || IsChildOf(from.BankBox))
            {
                return(true);
            }

            if (from.Map != Map || !from.InRange(GetWorldLocation(), 2))
            {
                from.SendMessage("That is too far away to use.");
                return(false);
            }

            if (!from.InLOS(this))
            {
                from.SendMessage("That item is out of your line of sight.");
                return(false);
            }

            if (IsLockedDown)
            {
                BaseHouse house = BaseHouse.FindHouseAt(Location, Map, 64);

                if (house == null)
                {
                    from.SendMessage("That is not accessible.");
                    return(false);
                }

                switch (m_LockedDownAccessLevel)
                {
                case LockedDownAccessLevelType.Owner:
                    if (house.Owner != null)
                    {
                        Account ownerAccount  = house.Owner.Account as Account;
                        Account playerAccount = from.Account as Account;

                        if (ownerAccount != null && playerAccount != null && ownerAccount == playerAccount)
                        {
                            return(true);
                        }

                        else
                        {
                            from.SendMessage("You do not have the neccessary access rights to use that.");
                            return(false);
                        }
                    }
                    break;

                case LockedDownAccessLevelType.CoOwner:
                    if (house.IsCoOwner(from))
                    {
                        return(true);
                    }
                    else
                    {
                        from.SendMessage("You do not have the neccessary access rights to use that.");
                        return(false);
                    }
                    break;

                case LockedDownAccessLevelType.Friend:
                    if (house.IsFriend(from))
                    {
                        return(true);
                    }

                    else
                    {
                        from.SendMessage("You do not have the neccessary access rights to use that.");
                        return(false);
                    }

                    break;

                case LockedDownAccessLevelType.Anyone:
                    return(true);

                    break;
                }
            }

            if (RootParent is PlayerMobile && RootParent != from)
            {
                from.SendMessage("That is not accessible.");
                return(false);
            }

            return(true);
        }
Exemple #55
0
        public override void OnSingleClick(Mobile from)
        {
            base.OnSingleClick(from);

            LabelTo(from, "Hue: " + Hue, Hue);
        }
        public void EjectDungeonCore(Mobile from, DungeonEnum dungeon, bool removeAll)
        {
            if (from == null || dungeon == null)
            {
                return;
            }

            DungeonCoreLibraryEntry entry = GetEntryDetail(dungeon);

            if (entry == null)
            {
                return;
            }

            if (entry.Count == 0)
            {
                from.SendMessage("You do not have any of that dungeon core currently stored within this library.");
                return;
            }

            if (from.Backpack == null)
            {
                return;
            }

            if (from.Backpack.TotalItems == from.Backpack.MaxItems)
            {
                from.SendMessage("Your backpack is at capacity. Please remove some items and try again.");
                return;
            }

            if (removeAll)
            {
                int itemCount = 0;

                for (int a = 0; a < 1000; a++)
                {
                    if (entry.Count == 0)
                    {
                        break;
                    }

                    if (from.Backpack.TotalItems == from.Backpack.MaxItems)
                    {
                        break;
                    }

                    DungeonCore dungeonCore = (DungeonCore)Activator.CreateInstance(typeof(DungeonCore));
                    dungeonCore.Dungeon = dungeon;

                    if (dungeonCore != null)
                    {
                        entry.Count--;

                        from.Backpack.DropItem(dungeonCore);
                        itemCount++;
                    }
                }

                if (itemCount > 1)
                {
                    from.SendMessage("You retrieve " + itemCount.ToString() + " dungeon cores from the library.");
                    from.SendSound(addItemSound);
                }

                else if (itemCount == 1)
                {
                    from.SendMessage("You retrieve a dungeon core from the library.");
                    from.SendSound(addItemSound);
                }

                else
                {
                    from.SendMessage("You do not have any dungeon cores of that in the library.");
                }
            }

            else
            {
                DungeonCore dungeonCore = (DungeonCore)Activator.CreateInstance(typeof(DungeonCore));
                dungeonCore.Dungeon = dungeon;

                if (dungeonCore != null)
                {
                    entry.Count--;

                    from.Backpack.DropItem(dungeonCore);
                    from.SendMessage("You retrieve a dungeon core from the library.");
                    from.SendSound(addItemSound);
                }
            }
        }
Exemple #57
0
        public static void Respond(SpeechEventArgs e, Mobile r, string input)
        {
            if (SpeechCheck(e, "job", "what do you do"))
            {
                res(r, "I am a living library of the arcane arts.");
            }
            else if (SpeechCheck(e, "abbey"))
            {
                res(r, "Oh, I haven't been to my abbey in ages.");
            }
            else if (SpeechCheck(e, "ability", "abilities"))
            {
                res(r, "One must have born propensity for magic, a natural ability if you will.");
            }
            else if (SpeechCheck(e, "arcane", "art"))
            {
                res(r, "The arcane art is one of keeping mystical secrets.");
            }
            else if (SpeechCheck(e, "cast", "casting"))
            {
                res(r, "Just close your eyes, say the words, and visualize.  You may need your Spellbook for assistance.");
            }
            else if (SpeechCheck(e, "component", "supplies"))
            {
                res(r, "Reagents and a heavy spellbook are all the components one needs.");
            }
            else if (SpeechCheck(e, "craft"))
            {
                res(r, "The craft of a mage takes many years to learn.");
            }
            else if (SpeechCheck(e, "des mani"))
            {
                res(r, "The words to weaken an opponent.");
            }
            else if (SpeechCheck(e, "empath"))
            {
                res(r, "I know not what someone feels nor do I wish to.");
            }
            else if (SpeechCheck(e, "ether"))
            {
                res(r, "I have heard rumors of ether, but have never seen it myself.");
            }
            else if (SpeechCheck(e, "guild"))
            {
                res(r, "Join the Mage's Guild, and you'll receive discounts on reagents.");
            }
            else if (SpeechCheck(e, "in lor"))
            {
                res(r, "Night Sight is very handy when reagent hunting.");
            }
            else if (SpeechCheck(e, "in mani"))
            {
                res(r, "You shall hear these words quite often on a battlefield.");
            }
            else if (SpeechCheck(e, "in mani ylem"))
            {
                res(r, "No, I am not very hungry.");
            }
            else if (SpeechCheck(e, "in por ylem"))
            {
                res(r, "Beginning mages use this spell quite often.");
            }
            else if (SpeechCheck(e, "ingredients"))
            {
                res(r, "Which reagent are you referring to?");
            }
            else if (SpeechCheck(e, "reagent"))
            {
                res(r, "Reagents are the basis for all magic.");
            }
            else if (SpeechCheck(e, "res wis"))
            {
                res(r, "The Feeblemind spell truly isn't that useful.");
            }
            else if (SpeechCheck(e, "relvinian"))
            {
                res(r, "I think you have been in the sun too long.");
            }
            else if (SpeechCheck(e, "scroll"))
            {
                res(r, "Oh yes, always carry a few extra scrolls.  One never knows.");
            }
            else if (SpeechCheck(e, "skill"))
            {
                res(r, "One needs to dedicate himself to the arcane arts to acquire great skill.");
            }
            else if (SpeechCheck(e, "spell"))
            {
                res(r, "One can never practice any spell enough.");
            }
            else if (SpeechCheck(e, "spellbook", "spell book", "spells"))
            {
                res(r, "Never leave town without your spellbook.");
            }
            else if (SpeechCheck(e, "talent"))
            {
                res(r, "I feel that one must have a natural talent when it comes to casting spells.");
            }
            else if (SpeechCheck(e, "uus jux"))
            {
                res(r, "Clumsy is one of the first spells that one learns.  Quite easy to cast.");
            }

            else
            {
                Humans.Respond(e, r, input);
            }
        }
 public CommandResult Execute(Mobile entity)
 {
     return new CommandResult(cost: 0);
 }
Exemple #59
0
        public static BandageContext BeginHeal(Mobile healer, Mobile patient, bool enhanced)
        {
            bool isDeadPet = patient is BaseCreature && ((BaseCreature)patient).IsDeadPet;

            if (patient is IRepairableMobile)
            {
                healer.SendLocalizedMessage(500970); // Bandages cannot be used on that.
            }
            else if (patient is BaseCreature && ((BaseCreature)patient).IsAnimatedDead)
            {
                healer.SendLocalizedMessage(500951); // You cannot heal that.
            }
            else if (!patient.Poisoned && patient.Hits == patient.HitsMax && !BleedAttack.IsBleeding(patient) && !isDeadPet)
            {
                healer.SendLocalizedMessage(500955); // That being is not damaged!
            }
            else if (!patient.Alive && (patient.Map == null || !patient.Map.CanFit(patient.Location, 16, false, false)))
            {
                healer.SendLocalizedMessage(501042); // Target cannot be resurrected at that location.
            }
            else if (healer.CanBeBeneficial(patient, true, true))
            {
                healer.DoBeneficial(patient);

                BandageContext context = GetContext(healer);

                if (context != null)
                {
                    context.StopHeal();
                }

                var delay = GetDelay(healer, patient);

                if (patient is PlayerMobile)
                {
                    BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Healing, 1002082, 1151400, delay, healer, string.Format("{0}", patient.Name)));
                }
                else
                {
                    BuffInfo.AddBuff(healer, new BuffInfo(BuffIcon.Veterinary, 1002167, 1151400, delay, healer, string.Format("{0}", patient.Name)));
                }

                context = new BandageContext(healer, patient, delay, enhanced);

                m_Table[healer] = context;

                if (healer != patient)
                {
                    patient.SendLocalizedMessage(1008078, false, healer.Name); //  : Attempting to heal you.
                }

                healer.SendLocalizedMessage(500956); // You begin applying the bandages.

                if (healer.NetState != null && healer.NetState.IsEnhancedClient)
                {
                    healer.NetState.Send(new BandageTimerPacket((int)delay.TotalSeconds));
                }

                return(context);
            }

            return(null);
        }
		public virtual void Use( Mobile from )
		{
		}