Beispiel #1
1
			private static void DisRobe( Mobile m_from, Container cont, Layer layer ) 
			{ 
				if ( m_from.FindItemOnLayer( layer ) != null )
				{
					Item item = m_from.FindItemOnLayer( layer );
					cont.AddItem( item );
				}
			}
		public override void OnDoubleClick( Mobile from )
		{
			if( from.Mounted )
			{
				from.SendMessage( "You cannot harvest crops while mounted." );
			}
			else
			{
				Item oneHanded = from.FindItemOnLayer( Layer.OneHanded );
				Item twoHanded = from.FindItemOnLayer( Layer.TwoHanded );

				if( oneHanded != null && oneHanded is Server.Items.BaseAxe )
				{
					Chop( from );
				}
				else if( twoHanded != null && twoHanded is Server.Items.BaseAxe )
				{
					Chop( from );
				}
				else
				{
					from.SendMessage( "You need an axe to cut down this sapling!" );
				}
			}
		}
Beispiel #3
0
 public override void OnDoubleClick( Mobile from )
 {
     if ( !IsChildOf( from.Backpack ) )
     {
         from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
     }
     else if ( !from.CanBeginAction( typeof( Bola ) ) )
     {
         from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
     }
     else if ( from.Target is BolaTarget )
     {
         from.SendLocalizedMessage( 1049631 ); // This bola is already being used.
     }
     else if ( from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null )
     {
         from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
     }
     else if ( from.Mounted )
     {
         from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
     }
     else
     {
         from.Target = new BolaTarget( this );
         from.LocalOverheadMessage( MessageType.Emote, 0x3B2, 1049632 ); // * You begin to swing the bola...*
         from.NonlocalOverheadMessage( MessageType.Emote, 0x3B2, 1049633, from.Name ); // ~1_NAME~ begins to menacingly swing a bola...
     }
 }
Beispiel #4
0
		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			base.OnDamage( amount, from, willKill );

			if( from == null || !from.Alive || from.Map != this.Map )
				return;

			Item i = from.FindItemOnLayer( Layer.FirstValid );
			Item ii = from.FindItemOnLayer( Layer.TwoHanded );

			if( i != null && i is BaseWeapon )
			{
				if( i is BaseRanged )
				{
					if( 0.40 > Utility.RandomDouble() )
						FireBullets( from );
				}
			}
			else if( ii != null && ii is BaseWeapon )
			{
				if( ii is BaseRanged )
				{
					if( 0.45 > Utility.RandomDouble() )
						FireBullets( from );
				}
			}
		}
Beispiel #5
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 1 ) )
			{
				from.SendLocalizedMessage( 502138 ); // That is too far away for you to use
				return;
			}
			else if ( from != m_Caster )
			{
				// from.SendLocalizedMessage( ); // 
				return;
			}

			BaseWeapon weapon = from.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;

			if ( weapon == null )
				weapon = from.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;

			if ( weapon != null )
			{
				from.SendLocalizedMessage( 1080116 ); // You must have a free hand to use a Healing Stone.
			}
			else if ( from.BeginAction( typeof( BaseHealPotion ) ) )
			{
				from.Heal( Utility.RandomMinMax( BasePotion.Scale( from, 13 ) , BasePotion.Scale( from, 16 ) ) );
				this.Consume();
				Timer.DelayCall( TimeSpan.FromSeconds( 8.0 ), new TimerStateCallback( ReleaseHealLock ), from );
			}
			else
				from.SendLocalizedMessage( 1095172 ); // You must wait a few seconds before using another Healing Stone.
		}
 private static void DisRobe( Mobile m_from, Layer layer )
 {
    if ( m_from.FindItemOnLayer( layer ) != null )
    {
       Item item = m_from.FindItemOnLayer( layer );
       m_from.PlaceInBackpack( item ); // Place in a bag first?
    }
 }
Beispiel #7
0
        public static bool IsEmptyHanded( Mobile from )
        {
            if ( from.FindItemOnLayer( Layer.OneHanded ) != null )
                return false;

            if ( from.FindItemOnLayer( Layer.TwoHanded ) != null )
                return false;

            return true;
        }
		public static bool HasFreeHand( Mobile m )
		{
			Item handOne = m.FindItemOnLayer( Layer.OneHanded );
			Item handTwo = m.FindItemOnLayer( Layer.TwoHanded );

			if ( handTwo is BaseWeapon )
				handOne = handTwo;

			return ( handOne == null || handTwo == null );
		}
		public bool UnMorph(Mobile from)
		{

		if (from.FindItemOnLayer(Layer.OuterTorso) == null || from.FindItemOnLayer(Layer.OuterTorso).Name != "a Shroud of Phasing")
			{
			this.Hue = 1153;
			}
			else
			{
			}
		return true;
		}
Beispiel #10
0
        public static bool CheckTool( Item tool, Mobile m )
        {
            Item check = m.FindItemOnLayer( Layer.OneHanded );

            if ( check is BaseTool && check != tool && !(check is AncientSmithyHammer) )
                return false;

            check = m.FindItemOnLayer( Layer.TwoHanded );

            if ( check is BaseTool && check != tool && !(check is AncientSmithyHammer) )
                return false;

            return true;
        }
Beispiel #11
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to )
                source.DoHarmful( to );
            int chance = Utility.RandomMinMax( 1, 8 );
            string sundname = "";

            BaseArmor sundered = null;
            Layer layer = Layer.FirstValid;

            switch( chance )
            {
                case 1: layer = Layer.InnerTorso; sundname = "armour"; break;
                case 2: layer = Layer.InnerLegs; sundname = "leggings"; break;
                case 3: layer = Layer.TwoHanded; sundname = "shield"; break;
                case 4: layer = Layer.Neck; sundname = "gorget"; break;
                case 5: layer = Layer.Gloves; sundname = "gauntlets"; break;
                case 6: layer = Layer.Helm; sundname = "helm"; break;
                case 7: layer = Layer.Arms; sundname = "arm pads"; break;
                case 8: layer = Layer.OneHanded; sundname = "weapon"; break;
            }

            if( to.FindItemOnLayer( layer ) != null && to.FindItemOnLayer( layer ) is BaseArmor )
                sundered = to.FindItemOnLayer( layer ) as BaseArmor;

            if( sundered != null )
            {
                int amt = (int)(intensity * Divisor);
                if ( amt <= 0 )
                    amt = 0;

                sundered.HitPoints -= Utility.Random( amt ) + 1;

                if( sundered.HitPoints < 0 )
                {
                    sundered.MaxHitPoints += sundered.HitPoints;
                    sundered.HitPoints = 0;

                    if( sundered.MaxHitPoints < 0 )
                    {
                        sundered.Delete();
                        to.Emote( "*got {0} {1} destroyed by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
                    }
                }

                to.Emote( "*got {0} {1} damaged by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
            }
        }
Beispiel #12
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) )
            {
                if ( !from.CanBeginAction( typeof( Spells.Fifth.IncognitoSpell ) ) )
                    from.SendLocalizedMessage( 501698 ); // You cannot disguise yourself while incognitoed.
                else if ( !from.CanBeginAction( typeof( Spells.Seventh.PolymorphSpell ) ) )
                    from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
                else if ( Spells.Necromancy.TransformationSpell.UnderTransformation( from ) )
                    from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
                else if ( from.IsBodyMod || from.FindItemOnLayer( Layer.Helm ) is OrcishKinMask )
                    from.SendLocalizedMessage( 501605 ); // You are already disguised.
                else
                {
                    /* TODO: Desde el Publish 37 OSI no modifica el body del personaje al
                     * usar la TribalPaint, para que los elfos se sigan viendo con body
                     * de elfo. No obstante, no podemos eliminar esto ya que RunUO basa
                     * todo el código del efecto en si el personaje tiene este body o no.
                     */
                    from.BodyMod = ( from.Female ? 184 : 183 );
                    from.HueMod = 0;

                    if ( from is PlayerMobile )
                        ( (PlayerMobile) from ).SavagePaintExpiration = TimeSpan.FromDays( 7.0 );

                    from.SendLocalizedMessage( 1042537 ); // You now bear the markings of the savage tribe.  Your body paint will last about a week or you can remove it with an oil cloth.

                    Consume();
                }
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            MerlinsStaff Staff = from.FindItemOnLayer(Layer.TwoHanded) as MerlinsStaff;

            if (Parent != from)
            {
                from.SendMessage("You remember that you must equip the staff to summon a portal to Merlin");
            }
            else
            {
                Item marker1 = from.Backpack.FindItemByType(typeof(Marker1));
                if (marker1 != null)
                {
                    marker1.Delete();

                    from.AddToBackpack(new Marker2());
                    from.AddToBackpack(new Tablet());
                    from.FixedParticles(0x3709, 1, 30, 9904, 1108, 6, EffectLayer.RightFoot);
                    from.SendGump(new MerlinsQuestGump6(from));
                    from.SendMessage("Muahahahaha!!!! You fool!");
                    Talon2 tl = new Talon2();
                    tl.Map = from.Map;
                    tl.Location = from.Location;
                    Delete();
                }
                else
                {
                    from.SendMessage("You have no right to have this staff!!!!");
                }
            }
        }
		public override bool OnEquip( Mobile from )
		{
			if ( ItemID == 0x204F )
			{
				from.Title = "[Owner]";
				from.DisplayGuildTitle = false;
			}

			Container mobilePack = from.Backpack;

			Item bracelet = from.FindItemOnLayer( Layer.Bracelet );

			if ( bracelet != null )
			{
				mobilePack.DropItem( bracelet );
			}

			GoldBracelet brace = new GoldBracelet();
  			brace.Movable = false;
			brace.Attributes.LowerManaCost = 100;
			brace.Attributes.LowerRegCost = 100;
			brace.Attributes.RegenHits = 100;
			brace.Attributes.RegenStam = 100;
			brace.Attributes.RegenMana = 100;
			brace.Attributes.SpellDamage = 100;
			brace.Attributes.CastRecovery = 12;
			brace.Attributes.CastSpeed = 12;
			from.EquipItem( brace );
			return base.OnEquip( from );
		}
Beispiel #15
0
		public override void OnDoubleClick(Mobile from)
		{
			if(m_Charges <= 0)
                from.SendLocalizedMessage(501259); //This magic item is out of charges.
            if (IsUnderEffects(from, m_Ward))
                from.SendLocalizedMessage(502173); //You are already under a similar effect.
            else if (from.FindItemOnLayer(Layer.MiddleTorso) == this)
            {
                Charges--;

                m_Table[from] = m_Ward;
                Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(RemoveEffects), from);

                from.FixedParticles(14154, 1, 30, 9964, 3, 3, EffectLayer.Waist);

                for (int i = -1; i <= 1; i++)
                {
                    IEntity entity = new Entity(Serial.Zero, new Point3D(from.X + i, from.Y, from.Z), from.Map);
                    IEntity to = new Entity(Serial.Zero, new Point3D(from.X + i, from.Y, from.Z + 50), from.Map);
                    Effects.SendMovingParticles(entity, to, 7956, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100);
                }

                from.PlaySound(0x5C1);
                from.SendLocalizedMessage(1116243); //The runes glow and a magical warding forms around your body.

                BuffInfo.AddBuff(from, new BuffInfo(BuffIcon.Warding, 1151395, 1151396, m_Ward == WardingEffect.WeaponDamage ? 1116172 : 1116173)); 
            }
            else
            {
                from.SendLocalizedMessage(1112886); //You must be wearing this item in order to use it.
            }
		}
Beispiel #16
0
        public static void OnAccepted( Mobile from )
        {
            if ( from.Backpack == null )
                return;

            PlainGreyCloak cloak = from.FindItemOnLayer( Layer.Cloak ) as PlainGreyCloak;

            if ( cloak == null )
            {
                from.DropHolding();
                cloak = from.Backpack.FindItemByType<PlainGreyCloak>();
            }

            if ( cloak == null )
                return;

            cloak.Delete();
            from.PlaceInBackpack( new ShieldOfRecognition() );

            /* *smiles* Surely thy deeds will be recognized by those who see thee
             * wearing this shield! It shall serve as a reminder of the exalted
             * path that thou hast journeyed upon, and I wish to thank thee on
             * behalf of all whom thine efforts shall benefit. Ah, let us not
             * forget that old cloak I gavest thee - I shall take it back now and
             * give thee thine reward. */
            from.SendGump( new GenericQuestGump( 1075783 ) );

            if ( from is PlayerMobile )
                ( (PlayerMobile) from ).HumilityQuestStatus = HumilityQuestStatus.RewardAccepted;
        }
		public static bool IsMonk( Mobile m )
		{
			if ( m is BaseCreature )
				return true;
			else
				return (m.FindItemOnLayer( Layer.Gloves ) is MonkFists);
		}
Beispiel #18
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Surge == SurgeType.None || Charges <= 0)
                base.OnDoubleClick(from);
            else if (from.FindItemOnLayer(Layer.TwoHanded) != this)
                from.SendLocalizedMessage(1116250); //That must be equipped before you can use it.
            else if (!IsUnderEffects(from, m_Surge))
            {
                Charges--;

                m_Table[from] = m_Surge;
                Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(RemoveEffects), from);

                from.PlaySound(0x0F5);
                from.PlaySound(0x1ED);
                from.FixedParticles(0x375A, 1, 30, 9966, 33, 2, EffectLayer.Waist);
                from.FixedParticles(0x37B9, 1, 30, 9502, 43, 3, EffectLayer.Waist);

                from.SendMessage("You feel a surge of energy through your body.");

                BuffInfo.AddBuff(from, new BuffInfo(BuffIcon.Surge, 1151397, 1151398, m_Surge.ToString()));
            }
            else
            {
                from.SendLocalizedMessage(1116174); //You must wait for the energy to recharge before using the surge effect again.
            }
        }
Beispiel #19
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) )
            {
                if ( !from.CanBeginAction( typeof( Spells.Fifth.IncognitoSpell ) ) )
                {
                    from.SendLocalizedMessage( 501698 ); // You cannot disguise yourself while incognitoed.
                }
                else if ( !from.CanBeginAction( typeof( Spells.Seventh.PolymorphSpell ) ) )
                {
                    from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
                }
                else if ( from.IsBodyMod || from.FindItemOnLayer( Layer.Helm ) is OrcishKinMask )
                {
                    from.SendLocalizedMessage( 501605 ); // You are already disguised.
                }
                else
                {
                    from.BodyMod = ( from.Female ? 184 : 183 );
                    from.HueMod = 0;

                    if ( from is PlayerMobile )
                        ((PlayerMobile)from).SavagePaintExpiration = TimeSpan.FromDays( 7.0 );

                    from.SendLocalizedMessage( 1042537 ); // You now bear the markings of the savage tribe.  Your body paint will last about a week or you can remove it with an oil cloth.

                    Consume();
                }
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
		public override bool IsEnemy( Mobile m )
		{
			if ( m.Player && m.FindItemOnLayer( Layer.Helm ) is OrcishKinMask )
				return false;

			return base.IsEnemy( m );
		}
Beispiel #21
0
        public override void OnDoubleClick(Mobile from)
        {
            // Scriptiz : gestion du double clic pour équipper un objet
            if (from.FindItemOnLayer(this.Layer) != this)
            {
                base.OnDoubleClick(from);
                return;
            }

            if (HarvestSystem == null || Deleted)
                return;

            Point3D loc = GetWorldLocation();

            if (!from.InLOS(loc) || !from.InRange(loc, 2))
            {
                from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3E9, 1019045); // I can't reach that
                return;
            }
            else if (!this.IsAccessibleTo(from))
            {
                this.PublicOverheadMessage(MessageType.Regular, 0x3E9, 1061637); // You are not allowed to access this.
                return;
            }

            if (!(this.HarvestSystem is Mining))
                from.SendLocalizedMessage(1010018); // What do you want to use this item on?

            HarvestSystem.BeginHarvesting(from, this);
        }
		// Healing Ki
		// Activate to heal all nearby allies for 1d4 (1 to 4), plus an additional 
		// 1d4 (1 to 4) for every two monk levels. (Does not harm undead)
		public static void LightCombo( Mobile from )
		{
			from.SendMessage( 2075, "You execute the maneuver: Healing Ki" );

			List<Mobile> mobiles = new List<Mobile>();

			foreach ( Mobile m in from.GetMobilesInRange( 4 ) )
			{
				if ( m != null )
					if ( NotorietyHandlers.Mobile_AllowBeneficial( from, m ) )
						mobiles.Add( m );
			}

			MonkFists mf = from.FindItemOnLayer( Layer.Gloves ) as MonkFists;
			int amount = 0;	

			if ( mf != null )
				amount = Utility.Dice( mf.Teir, 3, (3 * mf.Teir) );
			else
				amount = Utility.Dice( 2, 6, 0 );

			for ( int i = 0; i < mobiles.Count; i++ )
			{
				mobiles[i].FixedParticles( 0x3967, 10, 30, 5013, 36, 4, EffectLayer.CenterFeet, 0 );
				mobiles[i].Heal( amount, from );
			}

			if ( from.Female )
				from.PlaySound( 0x339 );
			else
				from.PlaySound( 0x44B );
		}
Beispiel #23
0
        public override void CheckReflect(Mobile caster, ref bool reflect)
        {
            if(caster.FindItemOnLayer(Layer.Neck) is BaseJewel)
            {
                BaseJewel neck = (BaseJewel) caster.FindItemOnLayer(Layer.Neck);
                if (neck.Resource != CraftResource.MGlowing)
                        reflect = false;
            }
            else if(Utility.RandomDouble()<0.5)
            {
                reflect = true; // Always reflect is not protected by Glowing
                caster.SendMessage("Un porte bonheur de lumière, voilà ce qu'il manque");
            }

            return;
        }
Beispiel #24
0
		public static bool HasFreeHand( Mobile m )
		{
			Item handOne = m.FindItemOnLayer( Layer.OneHanded );
			Item handTwo = m.FindItemOnLayer( Layer.TwoHanded );

			if ( handTwo is BaseWeapon )
				handOne = handTwo;
			if ( handTwo is BaseRanged )
			{
				BaseRanged ranged = (BaseRanged) handTwo;
				
				if ( ranged.Balanced )
					return true;
			}

			return ( handOne == null || handTwo == null );
		}
Beispiel #25
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
            }
            else if ( !from.CanBeginAction( typeof( Bola ) ) )
            {
                from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
            }
            else if ( from.Target is BolaTarget )
            {
                from.SendLocalizedMessage( 1049631 ); // This bola is already being used.
            }
            else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) )
            {
                from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
            }
            else if ( from.Mounted )
            {
                from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
            }
            else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) )
            {
                from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form!
            }
            else
            {
                EtherealMount.StopMounting( from );

                if ( Core.AOS ) {
                    Item one = from.FindItemOnLayer( Layer.OneHanded );
                    Item two = from.FindItemOnLayer( Layer.TwoHanded );

                    if ( one != null )
                        from.AddToBackpack( one );

                    if ( two != null )
                        from.AddToBackpack( two );
                }

                from.Target = new BolaTarget( this );
                from.LocalOverheadMessage( MessageType.Emote, 0x3B2, 1049632 ); // * You begin to swing the bola...*
                from.NonlocalOverheadMessage( MessageType.Emote, 0x3B2, 1049633, from.Name ); // ~1_NAME~ begins to menacingly swing a bola...
            }
        }
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from.Backpack ) )
			{
				if ( !from.CanBeginAction( typeof( Spells.Fifth.IncognitoSpell ) ) )
				{
					//from.SendLocalizedMessage( 501698 ); // You cannot disguise yourself while incognitoed.
					from.SendMessage( "You decide against eating it while incognitoed " );
				}
				else if ( !from.CanBeginAction( typeof( Spells.Seventh.PolymorphSpell ) ) )
				{
					//from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
					from.SendMessage( "You can not be polymorphed at this time" );
				}
				else if ( Spells.Necromancy.TransformationSpell.UnderTransformation( from ) )
				{
					//from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
					from.SendMessage( "You decide against eating it while polymorphed" );
				}
				else if ( from.IsBodyMod || from.FindItemOnLayer( Layer.Helm ) is OrcishKinMask || from.FindItemOnLayer( Layer.Helm ) is OrcishKinRPMask )
				{
					//from.SendLocalizedMessage( 501605 ); // You are already disguised.
					from.SendMessage( "You decide against eating it while as your disguised" );
				}
				else
				{
					from.BodyMod = ( from.Female ? 186 : 185 );
					from.HueMod = 0;

					if ( from is PlayerMobile )
						((PlayerMobile)from).SavagePaintExpiration = TimeSpan.FromDays( 7.0 );

					//from.SendLocalizedMessage( 1042537 ); // You now bear the markings of the savage tribe.  Your body paint will last about a week or you can remove it with an oil cloth.
					from.SendMessage( "You now bear the markings of the undead pirates.  This will last about a week" );
					from.PlaySound( Utility.Random( 0x3A, 3 ) );
					if ( from.Body.IsHuman && !from.Mounted )
						from.Animate( 34, 5, 1, true, false, 0 );
					from.ApplyPoison( from, Poison.Lethal );
					Consume();
				}
			}
			else
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
		}
		public override bool IsEnemy( Mobile m )
		{
			Item helm = m.FindItemOnLayer( Layer.Helm );
			if ( m.Player && helm is OrcishKinMask || helm is OrcishKinRPMask )
				return false;

			return base.IsEnemy( m );
		}
Beispiel #28
0
        // nickfly|gorgan edits for equip method - start

        public override void OnDoubleClick(Mobile from)
        {
            if (!this.Movable)
            {
                from.SendMessage("That item cannot be moved, let alone equipped. Nice try.");
                return;
            }

            if (from.FindItemOnLayer(this.Layer) == this)
            {
                from.Backpack.DropItem(this);
                //from.SendMessage("");
                return;
            }

            if (Parent != from)
            {
                if (!from.InRange(this.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 906, 1019045); //I can't reach that.
                    return;
                }
            }

            if (!from.Backpack.TryDropItem(from, this, false))
            {
                from.SendMessage("You don't have enough room in your backpack.");
                return;
            }

            if (this.Layer == Layer.TwoHanded)
            {
                from.Backpack.DropItem(from.FindItemOnLayer(Layer.TwoHanded));
                from.Backpack.DropItem(from.FindItemOnLayer(Layer.FirstValid));
                from.EquipItem(this);
                return;
            }

            if (from.FindItemOnLayer(this.Layer) != this)
            {
                from.Backpack.DropItem(from.FindItemOnLayer(this.Layer));
                from.EquipItem(this);
                //from.SendMessage("");
                return;
            }
        }
        public override void OnDoubleClick( Mobile from )
        {
            RobeofRite robe = from.FindItemOnLayer(Layer.OuterTorso) as RobeofRite;
            ExodusSacrificalDagger dagger = from.FindItemOnLayer(Layer.OneHanded) as ExodusSacrificalDagger;

            if (robe != null && dagger != null)
            {
                if (PeerlessExodusAltar.m_Rituals != null)
                {
                    if (PeerlessExodusAltar.m_Rituals.Count != 0)
                    {
                        from.SendLocalizedMessage(1153604); // Target the summoning tome or yourself to declare your intentions for performing this ritual...
                        ExodusTomeAltar.RitualTarget(this, from, null);                        
                    }
                }                
            }
            else
                base.OnDoubleClick(from);
        }
        public static void From(Mobile m)
        {
            if (m.Backpack == null || !m.Alive)
                return;

            int key = m.Serial.Value;

            if (Config.AllowPlayerToggle && DisabledPlayers.Contains(key))
                return;

            Item weapon = m.FindItemOnLayer(Layer.OneHanded);

            if (weapon == null || !weapon.Movable)
                weapon = m.FindItemOnLayer(Layer.TwoHanded);

            Item lastWeapon = null;

            if (PlayerWeapons.ContainsKey(key))
                lastWeapon = PlayerWeapons[key];

            if (m.Warmode)
            {
                if ((weapon == null || AllowedToKeep(weapon)) && lastWeapon != null && lastWeapon.IsChildOf(m.Backpack) && lastWeapon.Movable && lastWeapon.Visible && !lastWeapon.Deleted)
                {
                    m.EquipItem(lastWeapon);

                    if (Config.SendOverheadMessage)
                        m.LocalOverheadMessage(MessageType.Emote, m.EmoteHue, false, "*Unsheathes Weapon*");
                }
            }
            else
            {
                if (weapon != null && !AllowedToKeep(weapon))
                {
                    m.Backpack.DropItem(weapon);
                    PlayerWeapons[key] = weapon;

                    if (Config.SendOverheadMessage)
                        m.LocalOverheadMessage(MessageType.Emote, m.EmoteHue, false, "*Sheathes Weapon*");
                }
            }
        }
Beispiel #31
0
        public static void AwardScorePoints(IEntity e, Mobile m, bool champ, ref double points)
        {
            if (m == null)
            {
                return;
            }

            Dictionary <Mobile, double> list = GetPlayerScores(e, true);

            if (list == null)
            {
                return;
            }

            Mobile creditMob = null;

            var oneHandedWeapon = m.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
            var twoHandedWeapon = m.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
            var equipRanged     = twoHandedWeapon as BaseRanged;

            if (m is BaseCreature)
            {
                var bc = (BaseCreature)m;

                if (bc.ControlMaster is PlayerMobile)
                {
                    creditMob = bc.ControlMaster;
                    points   *= CSOptions.TamerMod;
                }
                else if (bc.SummonMaster is PlayerMobile)
                {
                    creditMob = bc.SummonMaster;
                    points   *= CSOptions.SummonMod;
                }
                else if (bc.BardMaster is PlayerMobile)
                {
                    creditMob = bc.BardMaster;
                    points   *= CSOptions.BardMod;
                }
            }
            else if (m is PlayerMobile)
            {
                creditMob = m;

                if (champ)
                {
                    if (equipRanged != null)
                    {
                        points *= CSOptions.ArcherVsChampMod;
                    }
                    else if (oneHandedWeapon != null || twoHandedWeapon != null)
                    {
                        points *= CSOptions.MeleeVsChampMod;
                    }
                }
                else
                {
                    if (equipRanged != null)
                    {
                        points *= CSOptions.ArcherMod;
                    }
                    else if (oneHandedWeapon != null || twoHandedWeapon != null)
                    {
                        points *= CSOptions.MeleeMod;
                    }
                }
            }

            if (creditMob == null)
            {
                return;
            }

            if (champ)
            {
                points *= CSOptions.ChampionMod;
            }

            if (!list.ContainsKey(creditMob))
            {
                list.Add(creditMob, points);
            }
            else
            {
                list[creditMob] += points;
                list[creditMob]  = Math.Min(CSOptions.MaxPoints, list[creditMob]);
                var creature = e as BaseChampion;
                if (creature != null && creature.Invasion == null && creature.Portal == null && Engines.CentralGump.CentralGump.EnsureProfile(creditMob as PlayerMobile).MiniGump || e is ChampionSpawn && Engines.CentralGump.CentralGump.EnsureProfile(creditMob as PlayerMobile).MiniGump)
                {
                    var scoregump = new ScoreGumpPlayerScores(creditMob as PlayerMobile, list[creditMob]).Send <ScoreGumpPlayerScores>();
                }
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            if (from is PlayerMobile)
            {
                Region reg  = Region.Find(from.Location, from.Map);
                Item   tome = from.FindItemOnLayer(Layer.Talisman);

                if (!IsChildOf(from.Backpack) && tome != this)
                {
                    from.SendLocalizedMessage(1060640);                       // The item must be in your backpack to use it.
                }
                else if (CodexOwner != from)
                {
                    from.SendMessage("This Codex does not belong to you so it vanishes!");
                    bool remove = true;
                    foreach (Account a in Accounts.GetAccounts())
                    {
                        if (a == null)
                        {
                            break;
                        }

                        int index = 0;

                        for (int i = 0; i < a.Length; ++i)
                        {
                            Mobile m = a[i];

                            if (m == null)
                            {
                                continue;
                            }

                            if (m == CodexOwner)
                            {
                                m.AddToBackpack(this);
                                remove = false;
                            }

                            ++index;
                        }
                    }
                    if (remove)
                    {
                        this.Delete();
                    }
                }
                else if (HasConvexLense == 0 || HasConcaveLense == 0)
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(LenseGump));
                    from.SendGump(new LenseGump(this, 0));
                }
                else if (!reg.IsPartOf("the Chamber of the Codex"))
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(LenseGump));
                    from.SendGump(new LenseGump(this, 1));
                }
                else
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(CodexGump));
                    from.SendGump(new CodexGump(this));
                }
            }
        }
Beispiel #33
0
 public static bool IsEquippedBy(this Item item, Mobile m)
 {
     return(item != null && item.Parent == m && m.FindItemOnLayer(item.Layer) == item);
 }
Beispiel #34
0
        public static int Damage(bool directDamage, Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, int chao, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chao);

            switch (Utility.RandomMinMax(1, 5))
            {
            case 1: phys += chao; break;

            case 2: fire += chao; break;

            case 3: cold += chao; break;

            case 4: pois += chao; break;

            case 5: nrgy += chao; break;
            }

            chao = 0;

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (m_ArmorIgnore)
            {
                resPhys = fire = cold = pois = nrgy = 0;
                phys    = 100;
            }

            if (m_ArmorPierce)
            {
                double delta = 0.6;                 // is this correct?

                resPhys -= (int)(delta * resPhys);
            }

            int totalDamage;

            totalDamage  = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

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

            int absorbed;

            #region Damage Eater
            int dmgEater = Math.Min((int)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.DamageEater), 18);

            int physEater = dmgEater;
            int fireEater = dmgEater;
            int coldEater = dmgEater;
            int poisEater = dmgEater;
            int nrgyEater = dmgEater;

            if (!m_ArmorIgnore)
            {
                physEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticEater), dmgEater), 30);
                fireEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireEater), dmgEater), 30);
                coldEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdEater), dmgEater), 30);
                poisEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonEater), dmgEater), 30);
                nrgyEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyEater), dmgEater), 30);
            }

            absorbed  = damage * phys * (100 - resPhys) * physEater;
            absorbed += damage * fire * (100 - resFire) * fireEater;
            absorbed += damage * cold * (100 - resCold) * coldEater;
            absorbed += damage * pois * (100 - resPois) * poisEater;
            absorbed += damage * nrgy * (100 - resNrgy) * nrgyEater;

            absorbed /= 1000000;

            if (m is PlayerMobile)
            {
                ((PlayerMobile)m).EatDamage(absorbed);
            }
            #endregion

            if (!m_ArmorIgnore)
            {
                #region Resonance
                if (m.Spell is Spell && m.Spell.IsCasting)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        double chance = 0.0;

                        switch (i)
                        {
                        case 0: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticResonance) / phys; break;

                        case 1: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireResonance) / fire; break;

                        case 2: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdResonance) / cold; break;

                        case 3: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonResonance) / pois; break;

                        case 4: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyResonance) / nrgy; break;
                        }

                        if (chance > Utility.RandomDouble())
                        {
                            ((Spell)m.Spell).Resonates = true;
                            break;
                        }
                    }
                }
                #endregion
            }

            #region Dragon Barding
            if ((from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent = (pet.BardingExceptional ? 20 : 10);
                    absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;
                    if (!(pet is ParoxysmusSwampDragon))
                    {
                        pet.BardingHP -= absorbed;
                    }

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null)
            {
                int reflectPhys = m.GetMagicalAttribute(AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        int rpd_damage = Scale((damage * phys * (100 - from.PhysicalResistance)) / 10000, reflectPhys);
                        if (m is PlayerMobile && from is PlayerMobile && directDamage)
                        {
                            rpd_damage = Math.Min(rpd_damage, 35);
                        }
                        from.Damage(rpd_damage, m);
                    }
                }
            }

            if (from is BaseCreature)
            {
                Mobile master = ((BaseCreature)from).ControlMaster;

                if (master != null)
                {
                    master.RevealingAction();
                }

                #region Talismans
                BaseTalisman talis = BaseTalisman.GetTalisman(m);

                if (talis != null && talis.ProtectionTalis != NPC_Name.None && talis.ProtectionValue > 0)
                {
                    if (ProtectionKillerEntry.IsProtectionKiller(talis.ProtectionTalis, from))
                    {
                        totalDamage = totalDamage - ((totalDamage * talis.ProtectionValue) / 100);
                    }
                }
                #endregion
            }

            if (from != null)
            {
                Item cloak     = from.FindItemOnLayer(Layer.Cloak);
                Item twohanded = from.FindItemOnLayer(Layer.TwoHanded);

                if (directDamage && cloak is BaseQuiver && twohanded is BaseRanged)
                {
                    BaseQuiver quiver = cloak as BaseQuiver;
                    totalDamage += (int)(totalDamage * quiver.DamageModifier * 0.01);
                }
            }

            if (m is PlayerMobile && from is PlayerMobile && directDamage)
            {
                totalDamage = Math.Min(totalDamage, 35);
            }

            /* TODO: El efecto del Attunement deber�a ir despues de aplicar el Blood Oath.
             * Seg�n parece, en OSI los Necro-Arcanists lo usan mucho en PvP, de manera que
             * el da�o recibido se refleja al atacante por Blood Oath, pero luego es
             * absorbido por el Attunement en el defensor.
             */
            if (directDamage)
            {
                Spells.Spellweaving.AttunementSpell.TryAbsorb(m, ref totalDamage);
            }

            if (from != null)
            {
                SpellHelper.DoLeech(totalDamage, from, m);
            }

            m.Damage(totalDamage, from);

            return(totalDamage);
        }
Beispiel #35
0
        public static int Damage(
            Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois,
            int nrgy, int chaos = 0, int direct = 0, bool keepAlive = false, bool archer = false, bool deathStrike = false
            )
        {
            if (m?.Deleted != false || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                MeerMage.StopEffect(m, true);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chaos);
            Fix(ref direct);

            if (Core.ML && chaos > 0)
            {
                switch (Utility.Random(5))
                {
                case 0:
                    phys += chaos;
                    break;

                case 1:
                    fire += chaos;
                    break;

                case 2:
                    cold += chaos;
                    break;

                case 3:
                    pois += chaos;
                    break;

                case 4:
                    nrgy += chaos;
                    break;
                }
            }

            BaseQuiver quiver = null;

            if (archer && from != null)
            {
                quiver = from.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            }

            int totalDamage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                var resPhys = m.PhysicalResistance;
                var resFire = m.FireResistance;
                var resCold = m.ColdResistance;
                var resPois = m.PoisonResistance;
                var resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (Core.ML)
                {
                    totalDamage += damage * direct / 100;

                    if (quiver != null)
                    {
                        totalDamage += totalDamage * quiver.DamageIncrease / 100;
                    }
                }

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                if (quiver != null)
                {
                    damage += damage * quiver.DamageIncrease / 100;
                }

                if (!deathStrike)
                {
                    totalDamage = Math.Min(damage, 35); // Direct Damage cap of 35
                }
                else
                {
                    totalDamage = Math.Min(damage, 70); // Direct Damage cap of 70
                }
            }
            else
            {
                totalDamage = damage;

                if (Core.ML && quiver != null)
                {
                    totalDamage += totalDamage * quiver.DamageIncrease / 100;
                }
            }

            if (from?.Player != true && m.Player && m.Mount is SwampDragon pet)
            {
                if (pet.HasBarding)
                {
                    var percent  = pet.BardingExceptional ? 20 : 10;
                    var absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
                    }
                }
            }

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from?.Deleted == false && from.Alive)
            {
                var reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if ((from as ExodusMinion)?.FieldActive == true ||
                        (from as ExodusOverseer)?.FieldActive == true)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(
                            Scale(damage * phys * (100 - (ignoreArmor ? 0 : m.PhysicalResistance)) / 10000, reflectPhys),
                            m
                            );
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Beispiel #36
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys > 0)
            {
                damage = m.AbsorbDamage(from, m, damage, true, false);
            }

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

            m.Damage(damage, from);

            return(damage);

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chaos);
            Fix(ref direct);

            BaseQuiver quiver = null;

            if (archer && from != null)
            {
                quiver = from.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            }

            int totalDamage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys = m.PhysicalResistance;
                int resFire = m.FireResistance;
                int resCold = m.ColdResistance;
                int resPois = m.PoisonResistance;
                int resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (Core.ML)
                {
                    totalDamage += damage * direct / 100;

                    if (quiver != null)
                    {
                        totalDamage += totalDamage * quiver.DamageIncrease / 100;
                    }
                }

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                if (quiver != null)
                {
                    damage += damage * quiver.DamageIncrease / 100;
                }

                if (!deathStrike)
                {
                    totalDamage = Math.Min(damage, 35);                 //Direct Damage cap of 35
                }
                else
                {
                    totalDamage = Math.Min(damage, 70);                         // Direct Damage cap of 70
                }
            }
            else
            {
                totalDamage = damage;

                if (Core.ML && quiver != null)
                {
                    totalDamage += totalDamage * quiver.DamageIncrease / 100;
                }
            }

            #region Dragon Barding
            if ((from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null && !from.Deleted && from.Alive)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - (ignoreArmor ? 0 : m.PhysicalResistance))) / 10000, reflectPhys), m);
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Beispiel #37
0
 public static TItem FindItemOnLayer <TItem>(this Mobile m, Layer layer) where TItem : Item
 {
     return(m == null ? null : m.FindItemOnLayer(layer) as TItem);
 }