Esempio n. 1
1
        public void OnTarget(Mobile from, object obj)
        {
            if (!from.InRange(GetWorldLocation(), 5) || !from.InLOS(this))
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            else if (obj is Corpse)
            {
                Corpse c = obj as Corpse;

                if (c.Carved)
                    return;

                if (c.Owner is PlayerMobile)
                {
                    ((ICarvable)obj).Carve(from, this);
                    c.PublicOverheadMessage(MessageType.Emote, 33, true, string.Format("*You see {0} steal the soul of {1}*", from.Name, c.Owner.Name));
                    from.PlaySound(0x19c);
                    from.PlaySound(20);
                    from.PlaySound(230);
                    Effects.SendLocationEffect(c.Location, c.Map, 0x37c4, 18, 15, 1);
                }
                else
                    ((ICarvable) obj).Carve(from, this);
            }
            else
                from.SendAsciiMessage("You cannot use this on that");
        }
Esempio n. 2
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();
        }
Esempio n. 3
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();
 }
Esempio n. 4
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 );
        }
Esempio n. 5
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();
		}
		public override void OnDamage( int amount, Mobile attacker, bool willKill )
		{
			if ( attacker != null && !willKill && amount > 5 && 50 > Utility.Random( 100 ) )
			{
				if ( this.Hits < (this.HitsMax/3) && this.Sacked )
				{
					attacker.SendMessage("The elemental's body bursts open!");
					AcidPool acid = new AcidPool(attacker);
					acid.Map = attacker.Map;
					acid.Location = attacker.Location;
					attacker.PlaySound( 0x25 );
				}
				else if ( !this.Sacked )
				{
					attacker.SendMessage("Acid spills from the damaged elemental!");
					AcidPool acid = new AcidPool(attacker);
					acid.Map = attacker.Map;
					acid.Location = attacker.Location;
					attacker.PlaySound( 0x25 );
				}
				BurnTimer = new m_Timer( attacker );
				BurnTimer.Start();
			}

			base.OnDamage( amount, attacker, willKill );
		}
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.SendLocalizedMessage(500446); // That is too far away. 
            }
            else
            {
                if (from.Mounted == true)
                {
                    from.SendLocalizedMessage(1042561);
                }
                else
                {
                    if (from.BodyValue == 0x190 || from.BodyValue == 0x191 || from.BodyValue == 0x25D || from.BodyValue == 0x25E)
                    {
                        from.BodyMod = 173; //wolf spider
                        from.HueMod = 1265;

                        from.PlaySound(535);
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x376A, 1, 29, 0x47D, 2, 9962, 0);
                        Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z), from.Map, EffectItem.DefaultDuration), 0x37C4, 1, 29, 0x47D, 2, 9502, 0);
                    }
                    else
                    {
                        from.BodyMod = 0x0;
                        from.HueMod = 1265;//make grey.

                        from.PlaySound(586);
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x376A, 1, 29, 0x47D, 2, 9962, 0);
                        Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z), from.Map, EffectItem.DefaultDuration), 0x37C4, 1, 29, 0x47D, 2, 9502, 0);
                    }
                }
            }
        }
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Item)
                {
                    Item item = (Item)target;

                    if (item.IsChildOf(from.Backpack))
                    {
                        if (m_Deed != null && !m_Deed.Deleted)
                        {
                            item.Name = from.Name + "'s " + ((item.Name == null || item.Name == string.Empty || item.Name == "") ? item.ItemData.Name : item.Name);
                            from.SendMessage("You have engraved your name into the item.");
                            Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x376A, 1, 29, 0x47D, 2, 9962, 0);
                            Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z - 7), from.Map, EffectItem.DefaultDuration), 0x37C4, 1, 29, 0x47D, 2, 9502, 0);
                            from.PlaySound(0x212);
                            from.PlaySound(0x206);
                            m_Deed.Delete();
                        }
                    }
                    else
                        from.SendLocalizedMessage(1061005); // The item must be in your backpack to enhance it.

                }
                else
                   from.SendMessage("That is not an item.");
            }
Esempio n. 9
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Filled)
            {
                if (from.InRange(this, 3) && from.InLOS(this))
                {
                    from.SendAsciiMessage("You look at the Tombstone");
                    from.PlaySound(47);
                    from.SendGump(new GraveGump());
                }
                else if (IsChildOf(from.Backpack))
                {
                    from.SendAsciiMessage("You look at the Tombstone");
                    from.PlaySound(47);
                    from.SendGump(new GraveGump());
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                }
            }

            if (!(Filled))
            {
                if (!IsChildOf(from.Backpack))
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                else
                {
                    from.Target = new InternalTarget(this);
                    from.SendAsciiMessage("This tombstone is blank!");
                    from.SendAsciiMessage("Target a players head to bury them.");
                }
            }
        }
Esempio n. 10
0
        }// A tasty bite of the enchanted apple lifts all curses from your soul.
        public override bool Eat(Mobile from)
        {
            if (base.Eat(from))
            {
                from.PlaySound(0xF6);
                from.PlaySound(0x1F7);
                from.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                IEntity mfrom = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z - 10), from.Map);
                IEntity mto = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);
                Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                from.RemoveStatMod("[Magic] Str Curse");
				from.RemoveStatMod("[Magic] Dex Curse");
				from.RemoveStatMod("[Magic] Int Curse");

                from.Paralyzed = false;
                from.Asleep = false;

                EvilOmenSpell.TryEndEffect(from);
                StrangleSpell.RemoveCurse(from);
                CorpseSkinSpell.RemoveCurse(from);
                CurseSpell.RemoveEffect(from);

                BuffInfo.RemoveBuff(from, BuffIcon.Clumsy);
                BuffInfo.RemoveBuff(from, BuffIcon.FeebleMind);
                BuffInfo.RemoveBuff(from, BuffIcon.Weaken);
                BuffInfo.RemoveBuff(from, BuffIcon.MassCurse);	
				
                return true;
            }
			
            return false;
        }
Esempio n. 11
0
		public void Target( Mobile m )
		{
			if ( HasMindRotScalar( m ) )
			{
				Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

				/* Attempts to place a curse on the Target that increases the mana cost of any spells they cast,
				 * for a duration based off a comparison between the Caster's Spirit Speak skill and the Target's Resisting Spells skill.
				 * The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 50 ) + 20 seconds.
				 */

				 if ( m.Spell != null )
					m.Spell.OnCasterHurt();
				
				m.PlaySound( 0x1FB );
				m.PlaySound( 0x258 );
				m.FixedParticles( 0x373A, 1, 17, 9903, 15, 4, EffectLayer.Head );

				TimeSpan duration = TimeSpan.FromSeconds( (((GetDamageSkill( Caster ) - GetResistSkill( m )) / 5.0) + 20.0) * (m.Player ? 1.0 : 2.0 ) );
				m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 );	//Skill check for gain

				if ( m.Player )
					SetMindRotScalar( Caster, m, 1.25, duration );
				else
					SetMindRotScalar( Caster, m, 2.00, duration );

				HarmfulSpell( m );
			}

			FinishSequence();
		}
        public override void OnDoubleClick( Mobile from )
        {
            if ( !( IsChildOf( from.Backpack ) ) ) from.SendMessage( "That has to be in your pack to be able to use it" );
            else if ( from.Mounted ) from.SendMessage( "You can not use this while riding" );
            else if ( bodyadjust != from.BodyMod && from.BodyMod != 0 ) from.SendMessage( "You can not use this while all ready morphed" );
            else
            {
                if ( bodyadjust == 0 && (from.BodyValue == 0x190 || from.BodyValue == 0x191 || from.BodyValue == 605 || from.BodyValue == 606 ))
                {
                    from.BodyMod = 157;
                    bodyadjust = from.BodyMod;
                    from.PlaySound( 1105 );
                  	Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
                  	Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );

                }
                else if(bodyadjust == from.BodyMod)
                {
                    from.BodyMod = 0;
                    bodyadjust = from.BodyMod;
                    from.PlaySound( 1105 );
                    Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );
                    Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 );

                    this.Delete();
                }
                else bodyadjust = 0;
            }
        }
      public override void OnDoubleClick( Mobile from ) 
      	{ 
         	if ( !from.InRange( GetWorldLocation(), 2 ) ) 
        	{ 
            		from.SendLocalizedMessage( 500446 ); // That is too far away. 
         	} 
         	else 
		{
			if ( from.Mounted == true )
			{
				from.SendLocalizedMessage( 1042561 );
			}

			else
         		{ 
           		 	if ( from.BodyValue == 0x190 ) 
           			{ 
              				from.BodyMod = 0x191; 
               				from.HueMod = 0x0; 
               				from.PlaySound( 61 );
					from.PlaySound( 813 );
					this.Delete();
            			} 
           			else 
            			{  
                  			from.BodyMod = 0x190;
					from.HueMod = 0x0; 
                  			from.PlaySound( 61 );
					from.PlaySound( 1087 );
					this.Delete();
				}
  			}
		} 
	} 
Esempio n. 14
0
        public override bool OnMoveOver( Mobile m )
        {
            if(m_refresh) {
                m.PlaySound( 0x214 );
                m.FixedEffect( 0x376A, 10, 16 );

                m.Resurrect();

                m.Hits = m.HitsMax;
                m.Stam = m.Dex;
                m.Mana = m.Int;
            } else {
                if ( !m.Alive && m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) )
                {
                    m.PlaySound( 0x214 );
                    m.FixedEffect( 0x376A, 10, 16 );

                    m.CloseGump( typeof( ResurrectGump ) );
                    m.SendGump( new ResurrectGump( m ) );
                }
                else
                {
                    m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
                }
            }

            return false;
        }
Esempio n. 15
0
        public void Target( Mobile m )
        {
            if ( !Caster.CanSee( m ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

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

                double damage = GetDamage( m );

                if ( Core.AOS )
                {
                    m.FixedParticles( 0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist );
                    m.PlaySound( 0x0FC );
                }
                else
                {
                    m.FixedParticles( 0x374A, 10, 15, 5013, EffectLayer.Waist );
                    m.PlaySound( 0x1F1 );
                }

                SpellHelper.Damage( this, m, damage, 0, 0, 100, 0, 0 );
            }

            FinishSequence();
        }
Esempio n. 16
0
        public override bool OnBeforeDamage(Mobile attacker, Mobile defender)
        {
            if (!this.Validate(attacker) || !this.CheckMana(attacker, true))
                return false;

            ClearCurrentAbility(attacker);

            attacker.SendMessage("You become one with you weapon, allowing it to guide you hand. The effects of this attack are unpredictable, but effective.");
            defender.SendMessage("Your enemy becomes one with their weapon and the effects of his attack are unpredictable");

            attacker.PlaySound(0x20C);
            attacker.PlaySound(0x56);
            attacker.FixedParticles(0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist);

            IEntity from = new Entity(Serial.Zero, new Point3D(attacker.X, attacker.Y, attacker.Z), attacker.Map);
            IEntity to = new Entity(Serial.Zero, new Point3D(attacker.X, attacker.Y, attacker.Z + 50), attacker.Map);
            Effects.SendMovingParticles(from, to, 0xF5F, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

            int damage = 10; 

            damage += Math.Min(5, (int)(Math.Abs(attacker.Skills[SkillName.Anatomy].Value + attacker.Skills[SkillName.ArmsLore].Value) / 8));

            defender.Damage(damage, attacker);

            return true;
        }
Esempio n. 17
0
      public override void OnDoubleClick( Mobile from ) 
      { 
      
      if ( Parent != from ) 
      if (from.AccessLevel < AccessLevel.GameMaster) 
          from.SendMessage( "When you touch, it vanishes without trace..." ); 
      if (from.AccessLevel < AccessLevel.GameMaster) 
         this.Consume() ; 
      if (from.AccessLevel < AccessLevel.GameMaster)    
         return ; 
      { 
                      
          if ( !from.Hidden == true ) 
            { 
           from.FixedParticles( 0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head ); 
           from.FixedParticles( 0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255 ); 
         from.PlaySound( 0x22F ); 
          from.Hidden = true; 
            
            } 
            else 
            { 
           from.Hidden=false; 
           from.FixedParticles( 0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head ); 
           from.FixedParticles( 0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255 ); 
         from.PlaySound( 0x22F ); 

                      
            } 
      } 

      
      } 
		public void Target( Mobile m )
		{
			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

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

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

				m.Paralyzed = false;

				int toDrain = 0;

				if ( Core.AOS )
				{
					toDrain = (int)(GetDamageSkill( Caster ) - GetResistSkill( m ));

					if ( toDrain < 0 )
						toDrain = 0;
					else if ( toDrain > m.Mana )
						toDrain = m.Mana;
				}
				else
				{
					if ( CheckResisted( m ) )
						m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
					else
						toDrain = m.Mana;
				}

				if ( toDrain > (Caster.ManaMax - Caster.Mana) )
					toDrain = Caster.ManaMax - Caster.Mana;

				m.Mana -= toDrain;
				Caster.Mana += toDrain;

				if ( Core.AOS )
				{
					m.FixedParticles( 0x374A, 1, 15, 5054, 23, 7, EffectLayer.Head );
					m.PlaySound( 0x1F9 );

					Caster.FixedParticles( 0x0000, 10, 5, 2054, EffectLayer.Head );
				}
				else
				{
					m.FixedParticles( 0x374A, 10, 15, 5054, EffectLayer.Head );
					m.PlaySound( 0x1F9 );
				}
			}

			FinishSequence();
		}
Esempio n. 19
0
        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);

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

                m.Paralyzed = false;

                if (Core.AOS)
                {
                    int toDrain = 40 + (int)(this.GetDamageSkill(this.Caster) - this.GetResistSkill(m));

                    if (toDrain < 0)
                        toDrain = 0;
                    else if (toDrain > m.Mana)
                        toDrain = m.Mana;

                    if (m_Table.ContainsKey(m))
                        toDrain = 0;

                    m.FixedParticles(0x3789, 10, 25, 5032, EffectLayer.Head);
                    m.PlaySound(0x1F8);

                    if (toDrain > 0)
                    {
                        m.Mana -= toDrain;

                        m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(AosDelay_Callback), new object[] { m, toDrain });
                    }
                }
                else
                {
                    if (this.CheckResisted(m))
                        m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                    else if (m.Mana >= 100)
                        m.Mana -= Utility.Random(1, 100);
                    else
                        m.Mana -= Utility.Random(1, m.Mana);

                    m.FixedParticles(0x374A, 10, 15, 5032, EffectLayer.Head);
                    m.PlaySound(0x1F8);
                }

                this.HarmfulSpell(m);
            }

            this.FinishSequence();
        }
Esempio n. 20
0
		public override void PlayCraftEffect( Mobile from )
		{
			// no animation
			//if ( from.Body.Type == BodyType.Human && !from.Mounted )
			//	from.Animate( 9, 5, 1, true, false, 0 );

			from.PlaySound( 0xF9 );
			from.PlaySound( 0x101 );
		}
Esempio n. 21
0
        public static void DoGraphicalEffect( Mobile m )
        {
            m.PlaySound( 0xF6 );
            m.PlaySound( 0x1F7 );

            m.FixedParticles( 0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head );

            IEntity from = new DummyEntity( Serial.Zero, new Point3D( m.X, m.Y, m.Z - 10 ), m.Map );
            IEntity to = new DummyEntity( Serial.Zero, new Point3D( m.X, m.Y, m.Z + 50 ), m.Map );

            Effects.SendMovingParticles( from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100 );
        }
Esempio n. 22
0
		public void Target( Mobile m )
		{
			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

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

				double damage;
				
				if ( Core.AOS )
				{
					damage = GetNewAosDamage( 17, 1, 5, m );
				}
				else
				{
					damage = Utility.Random( 1, 15 );

					if ( CheckResisted( m ) )
					{
						damage *= 0.75;

						m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
					}

					damage *= GetDamageScalar( m );
				}

				if ( !m.InRange( Caster, 2 ) )
					damage *= 0.25; // 1/4 damage at > 2 tile range
				else if ( !m.InRange( Caster, 1 ) )
					damage *= 0.50; // 1/2 damage at 2 tile range

				if ( Core.AOS )
				{
					m.FixedParticles( 0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist );
					m.PlaySound( 0x0FC );
				}
				else
				{
					m.FixedParticles( 0x374A, 10, 15, 5013, EffectLayer.Waist );
					m.PlaySound( 0x1F1 );
				}

				SpellHelper.Damage( this, m, damage, 0, 0, 100, 0, 0 );
			}

			FinishSequence();
		}
Esempio n. 23
0
 public override void OnDoubleClick(Mobile from)
 {
     if (!from.InRange(GetWorldLocation(), 1))
     {
         from.SendMessage( 33, "Step Closer To The Stone, You Are Too Far Away");
         from.PlaySound(0x1F0);
     }
     else
     {
         from.CloseGump(typeof(LotteryInfoGump));
         from.SendGump(new LotteryInfoGump());
         from.PlaySound(0x1ED);
     }
 }
			protected override void OnTarget(Mobile from, object target)
			{
				if (target is BodySash)
				{
					BodySash sash = (BodySash)target;

					if (sash.IsChildOf(from.Backpack))
					{
						if (m_Deed != null && !m_Deed.Deleted)
						{
							if (sash.Layer == Layer.Earrings)
								sash.Name = "I do my part to keep the shard Online [Layered]";
							else
								sash.Name = "I do my part to keep the shard Online";
							sash.Hue = 1177;
							from.SendMessage("You have enhanced the item.");
							Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x376A, 1, 29, 0x47D, 2, 9962, 0);
							Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z - 7), from.Map, EffectItem.DefaultDuration), 0x37C4, 1, 29, 0x47D, 2, 9502, 0);
							from.PlaySound(0x212);
							from.PlaySound(0x206);
							m_Deed.Delete();
						}
					}
					else
						from.SendLocalizedMessage(1061005); // The item must be in your backpack to enhance it.
				}
				else if (target is Bandana)
				{
					Bandana band = (Bandana)target;

					if (band.IsChildOf(from.Backpack))
					{
						if (m_Deed != null && !m_Deed.Deleted)
						{
							band.Name = String.Format( "I do my part to keep the shard Online");
							band.Hue = 1177;
							from.SendMessage("You have enhanced the item.");
							Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x376A, 1, 29, 0x47D, 2, 9962, 0);
							Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z - 7), from.Map, EffectItem.DefaultDuration), 0x37C4, 1, 29, 0x47D, 2, 9502, 0);
							from.PlaySound(0x212);
							from.PlaySound(0x206);
							m_Deed.Delete();
						}
					}
					else
						from.SendLocalizedMessage(1061005); // The item must be in your backpack to enhance it.
				}
				else
					from.SendMessage("You cannot enhance that item.");
			}
Esempio n. 25
0
		public static void Toggle( Mobile caster, Mobile target )
		{
			/* Players under the protection spell effect can no longer have their spells "disrupted" when hit.
			 * Players under the protection spell have decreased physical resistance stat value (-15 + (Inscription/20),
			 * a decreased "resisting spells" skill value by -35 + (Inscription/20),
			 * and a slower casting speed modifier (technically, a negative "faster cast speed") of 2 points.
			 * The protection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
			 * Reactive Armor, Protection, and Magic Reflection will stay on—even after logging out,
			 * even after dying—until you “turn them off” by casting them again.
			 */

			object[] mods = (object[])m_Table[target];

			if ( mods == null )
			{
				target.PlaySound( 0x1E9 );
				target.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist );

				mods = new object[2]
					{
						new ResistanceMod( ResistanceType.Physical, -15 + Math.Min( (int)(caster.Skills[SkillName.Inscribe].Value / 20), 15 ) ),
						new DefaultSkillMod( SkillName.MagicResist, true, -35 + Math.Min( (int)(caster.Skills[SkillName.Inscribe].Value / 20), 35 ) )
					};

				m_Table[target] = mods;
				Registry[target] = 100.0;

				target.AddResistanceMod( (ResistanceMod)mods[0] );
				target.AddSkillMod( (SkillMod)mods[1] );

				int physloss = -15 + (int) (caster.Skills[SkillName.Inscribe].Value / 20);
				int resistloss = -35 + (int) (caster.Skills[SkillName.Inscribe].Value / 20);
				string args = String.Format("{0}\t{1}", physloss, resistloss);
				BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args.ToString()));
			}
			else
			{
				target.PlaySound( 0x1ED );
				target.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist );

				m_Table.Remove( target );
				Registry.Remove( target );

				target.RemoveResistanceMod( (ResistanceMod)mods[0] );
				target.RemoveSkillMod( (SkillMod)mods[1] );

				BuffInfo.RemoveBuff(target, BuffIcon.Protection);
			}
		}
Esempio n. 26
0
			protected override void OnTarget( Mobile from, object targeted )
			{
                if (m_Item.Deleted)
                    return;

				if(targeted == from )
				{
                    if (from.HairItemID == 5147 || from.HairItemID == 7947)
                        return;

				    from.FacialHairItemID = 0;
				    from.HairItemID = 0;

                    from.PlaySound(0x248);
				    return;
     			}
                if (targeted is Item && !((Item)targeted).Movable)
                {
                    if (targeted is IScissorable && (targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore))
                    {
                        IScissorable obj = (IScissorable)targeted;

                        if (obj.Scissor(from, m_Item))
                            from.PlaySound(0x248);
                    }
                }
				if( targeted is IScissorable )
				{
                    if (targeted is Item)
                    {
                        Item item = (Item)targeted;
                        if (item.LootType == LootType.Newbied || item.LootType == LootType.Blessed)
                        {
                            from.SendAsciiMessage("You cannot cut up newbied items");
                            return;
                        }
                    }

					IScissorable obj = (IScissorable)targeted;

					if( obj.Scissor( from, m_Item ) )
						from.PlaySound( 0x248 );
				}
				else
				{
					from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
				}
			}
Esempio n. 27
0
        public void Target( Mobile m )
        {
            if ( !Caster.CanSee( m ) )
            {
                Caster.SendAsciiMessage( "Target can not be seen." ); // Target can not be seen.
            }
            else if ( CheckBSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

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

                SpellHelper.AddStatBonus( Caster, m, StatType.Str );

                m.FixedParticles( 0x375A, 10, 15, 5017, EffectLayer.Waist );
                m.PlaySound( 0x1EE );

                //int percentage = (int)(SpellHelper.GetOffsetScalar( Caster, m, false )*100);
                //TimeSpan length = SpellHelper.GetDuration( Caster, m );
                int percentage = (int)((Caster.Skills[SkillName.Magery].Value / 10) + 1);
                TimeSpan length = TimeSpan.FromSeconds((6 * Caster.Skills[SkillName.Magery].Value / 5) + 1);

                BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Strength, 1075845, length, m, percentage.ToString() ) );
            }

            FinishSequence();
        }
Esempio n. 28
0
		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
				return;

			ClearCurrentAbility( attacker );

			// Necromancers under Lich or Wraith Form are immune to Bleed Attacks.
			TransformContext context = TransformationSpell.GetContext( defender );

			if ( (context != null && ( context.Type == typeof( LichFormSpell ) || context.Type == typeof( WraithFormSpell ))) ||
				(defender is BaseCreature && ((BaseCreature)defender).BleedImmune) )
			{
				attacker.SendLocalizedMessage( 1062052 ); // Your target is not affected by the bleed attack!
				return;
			}

			attacker.SendLocalizedMessage( 1060159 ); // Your target is bleeding!
			defender.SendLocalizedMessage( 1060160 ); // You are bleeding!

			if ( defender is PlayerMobile )
			{
				defender.LocalOverheadMessage( MessageType.Regular, 0x21, 1060757 ); // You are bleeding profusely
				defender.NonlocalOverheadMessage( MessageType.Regular, 0x21, 1060758, defender.Name ); // ~1_NAME~ is bleeding profusely
			}

			defender.PlaySound( 0x133 );
			defender.FixedParticles( 0x377A, 244, 25, 9950, 31, 0, EffectLayer.Waist );

			BeginBleed( defender, attacker );
		}
Esempio n. 29
0
        public void Target( Mobile m )
        {
            if ( !Caster.CanSee( m ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

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

                m.Paralyzed = false;

                if ( CheckResistedEasy( m ) )
                {
                    m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                }
                else
                {
                    if ( m.Spell is Spells.Spell )
                        ((Spells.Spell)m.Spell).OnCasterHurt( m.Mana );
                    m.Mana = 0;
                }

                m.FixedParticles( 0x374A, 10, 15, 5032, EffectLayer.Head );
                m.PlaySound( 0x1F8 );
            }

            FinishSequence();
        }
Esempio n. 30
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendAsciiMessage("Target can not be seen."); // Target can not be seen.
            }
            else if (Core.AOS && (m.Frozen || m.Paralyzed || (m.Spell != null && m.Spell.IsCasting)))
            {
                Caster.SendAsciiMessage("The target is already frozen."); // The target is already frozen.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

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

                double duration;
                duration = (((Caster.Skills[SkillName.Magery].Value / 10) + 1) * 2) + 5;

                if (CheckResisted(m, 5))
                    duration /= 2;

                m.Paralyze(TimeSpan.FromSeconds(duration));

                if (m.Spell != null && m.Spell is Spell)
                    ((Spell)m.Spell).Disturb(DisturbType.Hurt);

                m.PlaySound(0x204);
                m.FixedEffect(0x376A, 6, 1);
            }

            FinishSequence();
        }
Esempio n. 31
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            if (m.Target != null)
            {
                m.SendLocalizedMessage(501845); // You are busy doing something else and cannot focus.

                return(TimeSpan.FromSeconds(5.0));
            }
            else if (m.Mana >= m.ManaMax)
            {
                m.SendLocalizedMessage(501846); // You are at peace.

                return(TimeSpan.FromSeconds(10.0));
            }
            else if (Server.Misc.RegenRates.GetArmorOffset(m) > 0)
            {
                m.SendLocalizedMessage(500135); // Regenative forces cannot penetrate your armor!

                return(TimeSpan.FromSeconds(10.0));
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer(Layer.OneHanded);
                Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded);

                if (m.Player)
                {
                    if (!CheckOkayHolding(oneHanded))
                    {
                        m.AddToBackpack(oneHanded);
                    }

                    if (!CheckOkayHolding(twoHanded))
                    {
                        m.AddToBackpack(twoHanded);
                    }
                }
                else if (!CheckOkayHolding(oneHanded) || !CheckOkayHolding(twoHanded))
                {
                    m.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate.

                    return(TimeSpan.FromSeconds(2.5));
                }

                double skillVal = m.Skills[SkillName.Meditation].Value;
                double chance   = (50.0 + ((skillVal - (m.ManaMax - m.Mana)) * 2)) / 100;

                // must bypass normal checks so passive skill checks aren't triggered
                CrystalBallOfKnowledge.TellSkillDifficultyActive(m, SkillName.Meditation, chance);

                if (chance > Utility.RandomDouble())
                {
                    m.CheckSkill(SkillName.Meditation, 0.0, 100.0);

                    m.SendLocalizedMessage(501851); // You enter a meditative trance.
                    m.Meditating = true;
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657));

                    if (m.Player || m.Body.IsHuman)
                    {
                        m.PlaySound(0xF9);
                    }

                    m.ResetStatTimers();
                }
                else
                {
                    m.SendLocalizedMessage(501850); // You cannot focus your concentration.
                }

                return(TimeSpan.FromSeconds(10.0));
            }
        }
Esempio n. 32
0
        public void DoubleClick(Mobile from)
        {
            Mobile m_Player = from as PlayerMobile;

            if (m_Player.CantWalk && !m_Sleeping)
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x22, true, "You are already sleeping somewhere!");
            }
            else
            {
                if (!m_Sleeping)
                {
                    BaseHouse m_house    = BaseHouse.FindHouseAt(from);
                    BaseHouse this_house = BaseHouse.FindHouseAt(this);
                    if (m_house != null && (m_house != this_house))
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You cannot sleep in someone elses sarcophagus! Get a sarcophagus of your own.");
                        return;
                    }
                    if (m_house != null && (m_house.IsOwner(from) || m_house.IsCoOwner(from) || m_house.IsFriend(from)))
                    {
                        wtry                     = 0;
                        m_Owner                  = m_Player;
                        m_Player.Hidden          = true;
                        m_Player.CantWalk        = true;
                        m_Sleeping               = true;
                        m_SleeperBedBody         = new SleeperBedBody(m_Player, false, false);
                        m_SleeperBedBody.Visible = false;
                        Point3D m_Location = new Point3D(this.Location.X, this.Location.Y + 1, this.Location.Z + 6);
                        m_SleeperBedBody.Direction = Direction.South;
                        m_SleeperBedBody.MoveToWorld(m_Location, this.Map);
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You must be in the house and be the owner, co-owner or friend of the house this sarcophagus is in to sleep in it.");
                        return;
                    }
                }
                else
                {
                    if (m_Owner == m_Player)
                    {
                        m_Sleeping        = false;
                        m_Player.Hidden   = false;
                        m_Player.CantWalk = false;
                        if (m_SleeperBedBody != null)
                        {
                            m_SleeperBedBody.Delete();
                        }
                        m_SleeperBedBody = null;
                        switch (Utility.RandomMinMax(1, 3))
                        {
                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You wake up and feel rested and strong.");
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You rise from your sarcophagus, ready for another day!");
                            break;

                        case 3:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You rise from your sarcophagus and blearily reach for the coffee pot.");
                            break;
                        }
                    }
                    else
                    {
                        switch (wtry)
                        {
                        case 0:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x22, true, "Shhh, don't wake them up. They really need their beauty rest!");
                            wtry = wtry + 1;
                            break;

                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x22, true, "You really should NOT bother someone that is sleeping. Bad things might happen.");
                            wtry = wtry + 1;
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x22, true, "You were warned!! Now leave them alone.");
                            m_Player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.Head);
                            m_Player.PlaySound(0x208);
                            m_Player.Hits = m_Player.Hits - 40;
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 33
0
 protected override void OnTick()
 {
     m_From.PlaySound(0x1C6);
 }
Esempio n. 34
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 3);

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                Effects.PlaySound(p, Caster.Map, 0x299);

                if (targets.Count > 0)
                {
                    int cured = 0;

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

                        Caster.DoBeneficial(m);

                        if (m.CurePoison(Caster))
                        {
                            ++cured;
                        }

                        m.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                        m.PlaySound(0x1E0);
                    }

                    if (cured > 0)
                    {
                        Caster.SendLocalizedMessage(1010058);                           // You have cured the target of all poisons!
                    }
                }
            }

            FinishSequence();
        }
Esempio n. 35
0
        public virtual bool OnBuyItems(Mobile buyer, List <BuyItemResponse> list)
        {
            if (!IsActiveSeller)
            {
                return(false);
            }

            if (!buyer.CheckAlive())
            {
                return(false);
            }

            if (!CheckVendorAccess(buyer))
            {
                Say(501522); // I shall not treat with scum like thee!
                return(false);
            }

            UpdateBuyInfo();

            // IBuyItemInfo[] buyInfo = this.GetBuyInfo();
            var  info      = GetSellInfo();
            var  totalCost = 0;
            var  validBuy  = new List <BuyItemResponse>(list.Count);
            bool bought;
            var  fromBank     = false;
            var  fullPurchase = true;
            var  controlSlots = buyer.FollowersMax - buyer.Followers;

            foreach (var buy in list)
            {
                var ser    = buy.Serial;
                var amount = buy.Amount;

                if (ser.IsItem)
                {
                    var item = World.FindItem(ser);

                    if (item == null)
                    {
                        continue;
                    }

                    var gbi = LookupDisplayObject(item);

                    if (gbi != null)
                    {
                        ProcessSinglePurchase(buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost);
                    }
                    else if (item != BuyPack && item.IsChildOf(BuyPack))
                    {
                        if (amount > item.Amount)
                        {
                            amount = item.Amount;
                        }

                        if (amount <= 0)
                        {
                            continue;
                        }

                        foreach (var ssi in info)
                        {
                            if (ssi.IsSellable(item))
                            {
                                if (ssi.IsResellable(item))
                                {
                                    totalCost += ssi.GetBuyPriceFor(item) * amount;
                                    validBuy.Add(buy);
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (ser.IsMobile)
                {
                    var mob = World.FindMobile(ser);

                    if (mob == null)
                    {
                        continue;
                    }

                    var gbi = LookupDisplayObject(mob);

                    if (gbi != null)
                    {
                        ProcessSinglePurchase(buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost);
                    }
                }
            } // foreach

            if (fullPurchase && validBuy.Count == 0)
            {
                SayTo(buyer, 500190); // Thou hast bought nothing!
            }
            else if (validBuy.Count == 0)
            {
                SayTo(buyer, 500187); // Your order cannot be fulfilled, please try again.
            }
            if (validBuy.Count == 0)
            {
                return(false);
            }

            bought = buyer.AccessLevel >= AccessLevel.GameMaster;

            var cont = buyer.Backpack;

            if (!bought && cont != null)
            {
                if (cont.ConsumeTotal(typeof(Gold), totalCost))
                {
                    bought = true;
                }
                else if (totalCost < 2000)
                {
                    SayTo(buyer, 500192); // Begging thy pardon, but thou canst not afford that.
                }
            }

            if (!bought && totalCost >= 2000)
            {
                cont = buyer.FindBankNoCreate();
                if (cont?.ConsumeTotal(typeof(Gold), totalCost) == true)
                {
                    bought   = true;
                    fromBank = true;
                }
                else
                {
                    SayTo(buyer, 500191); // Begging thy pardon, but thy bank account lacks these funds.
                }
            }

            if (!bought)
            {
                return(false);
            }

            buyer.PlaySound(0x32);

            cont = buyer.Backpack ?? buyer.BankBox;

            foreach (var buy in validBuy)
            {
                var ser    = buy.Serial;
                var amount = buy.Amount;

                if (amount < 1)
                {
                    continue;
                }

                if (ser.IsItem)
                {
                    var item = World.FindItem(ser);

                    if (item == null)
                    {
                        continue;
                    }

                    var gbi = LookupDisplayObject(item);

                    if (gbi != null)
                    {
                        ProcessValidPurchase(amount, gbi, buyer, cont);
                    }
                    else
                    {
                        if (amount > item.Amount)
                        {
                            amount = item.Amount;
                        }

                        foreach (var ssi in info)
                        {
                            if (ssi.IsSellable(item))
                            {
                                if (ssi.IsResellable(item))
                                {
                                    Item buyItem;
                                    if (amount >= item.Amount)
                                    {
                                        buyItem = item;
                                    }
                                    else
                                    {
                                        buyItem = LiftItemDupe(item, item.Amount - amount) ?? item;
                                    }

                                    if (cont?.TryDropItem(buyer, buyItem, false) != true)
                                    {
                                        buyItem.MoveToWorld(buyer.Location, buyer.Map);
                                    }

                                    break;
                                }
                            }
                        }
                    }
                }
                else if (ser.IsMobile)
                {
                    var mob = World.FindMobile(ser);

                    if (mob == null)
                    {
                        continue;
                    }

                    var gbi = LookupDisplayObject(mob);

                    if (gbi != null)
                    {
                        ProcessValidPurchase(amount, gbi, buyer, cont);
                    }
                }
            } // foreach

            if (fullPurchase)
            {
                if (buyer.AccessLevel >= AccessLevel.GameMaster)
                {
                    SayTo(buyer, true, "I would not presume to charge thee anything.  Here are the goods you requested.");
                }
                else if (fromBank)
                {
                    SayTo(
                        buyer,
                        1151638,
                        totalCost
                        .ToString()
                        ); // The total of your purchase is ~1_val~ gold, which has been drawn from your bank account.  My thanks for the patronage.
                }
                else
                {
                    SayTo(
                        buyer,
                        1151639,
                        totalCost.ToString()
                        ); // The total of your purchase is ~1_val~ gold.  My thanks for the patronage.
                }
            }
            else
            {
                if (buyer.AccessLevel >= AccessLevel.GameMaster)
                {
                    SayTo(
                        buyer,
                        true,
                        "I would not presume to charge thee anything.  Unfortunately, I could not sell you all the goods you requested."
                        );
                }
                else if (fromBank)
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold, which has been withdrawn from your bank account.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.",
                        totalCost
                        );
                }
                else
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.",
                        totalCost
                        );
                }
            }

            return(true);
        }
Esempio n. 36
0
        public virtual bool OnSellItems(Mobile seller, List <SellItemResponse> list)
        {
            if (!IsActiveBuyer)
            {
                return(false);
            }

            if (!seller.CheckAlive())
            {
                return(false);
            }

            if (!CheckVendorAccess(seller))
            {
                Say(501522); // I shall not treat with scum like thee!
                return(false);
            }

            seller.PlaySound(0x32);

            var info     = GetSellInfo();
            var buyInfo  = GetBuyInfo();
            var GiveGold = 0;
            var Sold     = 0;

            foreach (var resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() ||
                    !resp.Item.Movable || resp.Item is Container container && container.Items.Count != 0)
                {
                    continue;
                }

                foreach (var ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        Sold++;
                        break;
                    }
                }
            }

            if (Sold > MaxSell)
            {
                SayTo(seller, true, "You may only sell {0} items at a time!", MaxSell);
                return(false);
            }

            if (Sold == 0)
            {
                return(true);
            }

            foreach (var resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() ||
                    !resp.Item.Movable || resp.Item is Container container && container.Items.Count != 0)
                {
                    continue;
                }

                foreach (var ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        var amount = resp.Amount;

                        if (amount > resp.Item.Amount)
                        {
                            amount = resp.Item.Amount;
                        }

                        if (ssi.IsResellable(resp.Item))
                        {
                            var found = false;

                            foreach (var bii in buyInfo)
                            {
                                if (bii.Restock(resp.Item, amount))
                                {
                                    resp.Item.Consume(amount);
                                    found = true;

                                    break;
                                }
                            }

                            if (!found)
                            {
                                var cont = BuyPack;

                                if (amount < resp.Item.Amount)
                                {
                                    var item = LiftItemDupe(resp.Item, resp.Item.Amount - amount);

                                    if (item != null)
                                    {
                                        item.SetLastMoved();
                                        cont.DropItem(item);
                                    }
                                    else
                                    {
                                        resp.Item.SetLastMoved();
                                        cont.DropItem(resp.Item);
                                    }
                                }
                                else
                                {
                                    resp.Item.SetLastMoved();
                                    cont.DropItem(resp.Item);
                                }
                            }
                        }
                        else
                        {
                            if (amount < resp.Item.Amount)
                            {
                                resp.Item.Amount -= amount;
                            }
                            else
                            {
                                resp.Item.Delete();
                            }
                        }

                        GiveGold += ssi.GetSellPriceFor(resp.Item) * amount;
                        break;
                    }
                }
            }

            if (GiveGold > 0)
            {
                while (GiveGold > 60000)
                {
                    seller.AddToBackpack(new Gold(60000));
                    GiveGold -= 60000;
                }

                seller.AddToBackpack(new Gold(GiveGold));

                seller.PlaySound(0x0037); // Gold dropping sound

                if (SupportsBulkOrders(seller))
                {
                    var bulkOrder = CreateBulkOrder(seller, false);

                    if (bulkOrder is LargeBOD largeBod)
                    {
                        seller.SendGump(new LargeBODAcceptGump(seller, largeBod));
                    }
                    else if (bulkOrder is SmallBOD smallBod)
                    {
                        seller.SendGump(new SmallBODAcceptGump(seller, smallBod));
                    }
                }
            }
            // no cliloc for this?
            // SayTo( seller, true, "Thank you! I bought {0} item{1}. Here is your {2}gp.", Sold, (Sold > 1 ? "s" : ""), GiveGold );

            return(true);
        }
Esempio n. 37
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (this.IsEmpty || !this.Pourable || !this.ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (!bev.ValidateUse(from, true))
                {
                    return;
                }

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848); // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846); // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

                    if (this.Quantity > bev.MaxQuantity)
                    {
                        bev.Quantity   = bev.MaxQuantity;
                        this.Quantity -= bev.MaxQuantity;
                    }
                    else
                    {
                        bev.Quantity += this.Quantity;
                        this.Quantity = 0;
                    }

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
                if (from.Thirst < 20)
                {
                    from.Thirst += 1;
                }

                if (this.ContainsAlchohol)
                {
                    int bac = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale:
                        bac = 1;
                        break;

                    case BeverageType.Wine:
                        bac = 2;
                        break;

                    case BeverageType.Cider:
                        bac = 3;
                        break;

                    case BeverageType.Liquor:
                        bac = 4;
                        break;
                    }

                    from.BAC += bac;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (this.m_Poison != null)
                {
                    from.ApplyPoison(this.m_Poisoner, this.m_Poison);
                }

                --this.Quantity;
            }
            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (this.Content != BeverageType.Water)
                {
                    from.SendLocalizedMessage(500842); // Can't pour that in there.
                }
                else if (bwc.Items.Count != 0)
                {
                    from.SendLocalizedMessage(500841); // That has something in it.
                }
                else
                {
                    int itNeeds = Math.Min((bwc.MaxQuantity - bwc.Quantity), this.Quantity);

                    if (itNeeds > 0)
                    {
                        bwc.Quantity  += itNeeds;
                        this.Quantity -= itNeeds;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is PlantItem)
            {
                ((PlantItem)targ).Pour(from, this);
            }
            else if (targ is AddonComponent &&
                     (((AddonComponent)targ).Addon is WaterVatEast || ((AddonComponent)targ).Addon is WaterVatSouth) &&
                     this.Content == BeverageType.Water)
            {
                PlayerMobile player = from as PlayerMobile;

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

                    if (qs != null)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(GatherWaterObjective));

                        if (obj != null && !obj.Completed)
                        {
                            BaseAddon vat = ((AddonComponent)targ).Addon;

                            if (vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 &&
                                ((qs.RedSolen && vat.Map == Map.Trammel) || (!qs.RedSolen && vat.Map == Map.Felucca)))
                            {
                                if (obj.CurProgress + this.Quantity > obj.MaxProgress)
                                {
                                    int delta = obj.MaxProgress - obj.CurProgress;

                                    this.Quantity  -= delta;
                                    obj.CurProgress = obj.MaxProgress;
                                }
                                else
                                {
                                    obj.CurProgress += this.Quantity;
                                    this.Quantity    = 0;
                                }
                            }
                        }
                    }
                }
            }
            else if (targ is WaterElemental)
            {
                if (this is Pitcher && this.Content == BeverageType.Water)
                {
                    EndlessDecanter.HandleThrow(this, (WaterElemental)targ, from);
                }
            }
            else
            {
                from.SendLocalizedMessage(500846); // Can't pour it there.
            }
        }
Esempio n. 38
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!this.IsEmpty || !this.Fillable || !this.ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                this.Content  = bev.Content;
                this.Poison   = bev.Poison;
                this.Poisoner = bev.Poisoner;

                if (bev.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    bev.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }
            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (this.Quantity == 0 || (this.Content == BeverageType.Water && !this.IsFull))
                {
                    this.Content = BeverageType.Water;

                    int iNeed = Math.Min((this.MaxQuantity - this.Quantity), bwc.Quantity);

                    if (iNeed > 0 && !bwc.IsEmpty && !this.IsFull)
                    {
                        bwc.Quantity  -= iNeed;
                        this.Quantity += iNeed;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    return;
                }

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

                this.Content  = BeverageType.Water;
                this.Poison   = null;
                this.Poisoner = null;

                if (src.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    src.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += src.Quantity;
                    src.Quantity   = 0;
                }

                from.SendLocalizedMessage(1010089); // You fill the container with water.
            }
            else if (targ is Cow)
            {
                Cow cow = (Cow)targ;

                if (cow.TryMilk(from))
                {
                    this.Content  = BeverageType.Milk;
                    this.Quantity = this.MaxQuantity;
                    from.SendLocalizedMessage(1080197); // You fill the container with milk.
                }
            }
            else if (targ is LandTarget)
            {
                int tileID = ((LandTarget)targ).TileID;

                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.SwampWater)
                        {
                            bool contains = false;

                            for (int i = 0; !contains && i < m_SwampTiles.Length; i += 2)
                            {
                                contains = (tileID >= m_SwampTiles[i] && tileID <= m_SwampTiles[i + 1]);
                            }

                            if (contains)
                            {
                                this.Delete();

                                player.SendLocalizedMessage(1055035); // You dip the container into the disgusting swamp water, collecting enough for the Hag's vile stew.
                                obj.Complete();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 39
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("That character is no longer online.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("That character no longer exists.");
                return;
            }
            else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel)
            {
                from.SendMessage("That character is no longer visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} tells you:", from.Name);
                    focus.SendMessage(0x482, text.Text);

                    CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:                     // Props
            {
                Resend(from, info);

                if (!BaseCommand.IsAccessible(from, focus))
                {
                    from.SendMessage("That is not accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, focus));
                    CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 5:                     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("That character is not in the world.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
                }

                break;
            }

            case 6:                     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("You cannot bring that person here.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
                }

                break;
            }

            case 7:                     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:                     // Kick
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();

                    CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 9:                     // Kill
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Kill();
                    CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 10:                     //Res
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    focus.FixedEffect(0x376A, 10, 16);

                    focus.Resurrect();

                    CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 11:                     // Skills
            {
                Resend(from, info);

                if (from.AccessLevel > focus.AccessLevel)
                {
                    from.SendGump(new SkillsGump(from, (Mobile)focus));
                    CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }
            }
        }
Esempio n. 40
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

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

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

                m.Paralyzed = false;

                if (CheckResisted(m))
                {
                    m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                }
                else
                {
                    int level;

                    if (Core.AOS)
                    {
                        int total = (Caster.Skills.Magery.Fixed + Caster.Skills.Poisoning.Fixed) / 2;

                        if (Core.SA && Caster.InRange(m, 8))
                        {
                            int range = (int)Caster.GetDistanceToSqrt(m.Location);

                            if (total >= 1000)
                            {
                                level = Utility.RandomDouble() <= .1 ? 4 : 3;
                            }
                            else if (total > 850)
                            {
                                level = 2;
                            }
                            else if (total > 650)
                            {
                                level = 1;
                            }
                            else
                            {
                                level = 0;
                            }

                            if (!Caster.InRange(m, 2))
                            {
                                level -= range / 2;
                            }

                            if (level < 0)
                            {
                                level = 0;
                            }
                        }
                        else if (Caster.InRange(m, 2))
                        {
                            if (total >= 1000)
                            {
                                level = 3;
                            }
                            else if (total > 850)
                            {
                                level = 2;
                            }
                            else if (total > 650)
                            {
                                level = 1;
                            }
                            else
                            {
                                level = 0;
                            }
                        }
                        else
                        {
                            level = 0;
                        }
                    }
                    else
                    {
                        //double total = Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Poisoning].Value;
                        #region Dueling
                        double total = Caster.Skills[SkillName.Magery].Value;

                        if (Caster is Mobiles.PlayerMobile)
                        {
                            Mobiles.PlayerMobile pm = (Mobiles.PlayerMobile)Caster;

                            if (pm.DuelContext != null && pm.DuelContext.Started && !pm.DuelContext.Finished && !pm.DuelContext.Ruleset.GetOption("Skills", "Poisoning"))
                            {
                            }
                            else
                            {
                                total += Caster.Skills[SkillName.Poisoning].Value;
                            }
                        }
                        else
                        {
                            total += Caster.Skills[SkillName.Poisoning].Value;
                        }
                        #endregion

                        double dist = Caster.GetDistanceToSqrt(m);

                        if (dist >= 3.0)
                        {
                            total -= (dist - 3.0) * 10.0;
                        }

                        if (total >= 200.0 && 1 > Utility.Random(10))
                        {
                            level = 3;
                        }
                        else if (total > (Core.AOS ? 170.1 : 170.0))
                        {
                            level = 2;
                        }
                        else if (total > (Core.AOS ? 130.1 : 130.0))
                        {
                            level = 1;
                        }
                        else
                        {
                            level = 0;
                        }
                    }

                    m.ApplyPoison(Caster, Poison.GetPoison(level));
                }

                m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
                m.PlaySound(0x205);

                HarmfulSpell(m);
            }

            FinishSequence();
        }
Esempio n. 41
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallRune)
            {
                //Close all runebooks
                from.CloseGump(typeof(RunebookGump));

                if (!CheckAccess(from))
                {
                    from.SendLocalizedMessage(502413);                     // That cannot be done while the book is locked down.
                }
                //else if ( IsOpen( from ) )
                //{
                //	from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
                //}
                else if (m_Entries.Count < 16)
                {
                    RecallRune rune = (RecallRune)dropped;

                    if (rune.Marked && rune.TargetMap != null)
                    {
                        m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House));

                        dropped.Delete();

                        from.Send(new PlaySound(0x42, GetWorldLocation()));

                        string desc = rune.Description;

                        if (desc == null || (desc = desc.Trim()).Length == 0)
                        {
                            desc = "(indescript)";
                        }

                        from.SendMessage(desc);

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502409);                         // This rune does not have a marked location.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502401);                     // This runebook is full.
                }
            }
            else if (dropped is RecallScroll)
            {
                if (m_CurCharges < m_MaxCharges)
                {
                    from.Send(new PlaySound(0x249, GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (m_MaxCharges - m_CurCharges))
                    {
                        dropped.Consume(m_MaxCharges - m_CurCharges);
                        m_CurCharges = m_MaxCharges;
                    }
                    else
                    {
                        m_CurCharges += amount;
                        dropped.Delete();

                        return(true);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502410);                     // This book already has the maximum amount of charges.
                }
            }
            else
            {
                // Adam: anything other than a scroll will get dropped into your backpack
                // (so your best sword doesn't get dropped on the ground.)
                from.AddToBackpack(dropped);
                //	For richness, we add the drop sound of the item dropped.
                from.PlaySound(dropped.GetDropSound());
                return(true);
            }

            return(false);
        }
Esempio n. 42
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Corpse)
                {
                    Corpse c = targeted as Corpse;

                    if (!from.InRange(c.Location, 3))
                    {
                        from.SendLocalizedMessage(500446); // That is too far away.
                    }
                    if (c.VisitedByTaxidermist)
                    {
                        from.SendLocalizedMessage(1042596); // That corpse seems to have been visited by a taxidermist already.
                    }
                    else if (!m_Permit.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                    else if (c.Owner == null)
                    {
                        from.SendLocalizedMessage(1155706); // That is not a valid kill.
                    }
                    else if (!IsOnlyAttacker(from, c.Owner))
                    {
                        from.SendLocalizedMessage(1155707);       // You cannot document someone else's kill.
                    }
                    else
                    {
                        for (int i = 0; i < HuntingTrophyInfo.Infos.Count; i++)
                        {
                            HuntingTrophyInfo info = HuntingTrophyInfo.Infos[i];

                            if (c.Owner.GetType() == info.CreatureType)
                            {
                                int v = 0;

                                if (HuntingSystem.Instance != null && HuntingSystem.Instance.IsPrimeHunt(from, c.Location))
                                {
                                    v = Utility.RandomMinMax(0, 100);
                                }
                                else
                                {
                                    v = Utility.RandomMinMax(0, 10000);
                                    v = (int)Math.Sqrt(v);
                                    v = 100 - v;
                                }

                                int measurement = info.MinMeasurement + (int)((double)(info.MaxMeasurement - info.MinMeasurement) * (double)((double)v / 100.0));
                                m_Permit.KillEntry     = new HuntingKillEntry(m_Permit.Owner, measurement, DateTime.Now, i, WorldLocationInfo.GetLocationString(c.Location, c.Map));
                                c.VisitedByTaxidermist = true;

                                from.PlaySound(0x249);
                                from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x45, 1155713, from.NetState); // *You document your kill on the permit*
                                m_Permit.InvalidateProperties();
                                return;
                            }
                        }

                        from.SendLocalizedMessage(1155706); // That is not a valid kill.
                    }
                }
            }
Esempio n. 43
0
        private bool Resmelt(Mobile from, Item item, CraftResource resource)
        {
            try
            {
                if (CraftResources.GetType(resource) != CraftResourceType.Metal)
                {
                    return(false);
                }

                CraftResourceInfo info = CraftResources.GetInfo(resource);

                if (info == null || info.ResourceTypes.Length == 0)
                {
                    return(false);
                }

                CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType());

                if (craftItem == null || craftItem.Resources.Count == 0)
                {
                    return(false);
                }

                CraftRes craftResource = craftItem.Resources.GetAt(0);

                if (craftResource.Amount < 2)
                {
                    return(false); // Not enough metal to resmelt
                }
                double difficulty = 0.0;

                switch (resource)
                {
                case CraftResource.DullCopper:
                    difficulty = 65.0;
                    break;

                case CraftResource.ShadowIron:
                    difficulty = 70.0;
                    break;

                case CraftResource.Copper:
                    difficulty = 75.0;
                    break;

                case CraftResource.Bronze:
                    difficulty = 80.0;
                    break;

                case CraftResource.Gold:
                    difficulty = 85.0;
                    break;

                case CraftResource.Agapite:
                    difficulty = 90.0;
                    break;

                case CraftResource.Verite:
                    difficulty = 95.0;
                    break;

                case CraftResource.Valorite:
                    difficulty = 99.0;
                    break;
                }

                Type resourceType = info.ResourceTypes[0];
                Item ingot        = (Item)Activator.CreateInstance(resourceType);

                if (item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed))
                {
                    double mining = from.Skills[SkillName.Mining].Value;
                    if (mining > 100.0)
                    {
                        mining = 100.0;
                    }
                    double amount = (((4 + mining) * craftResource.Amount - 4) * 0.0068);
                    if (amount < 2)
                    {
                        ingot.Amount = 2;
                    }
                    else
                    {
                        ingot.Amount = (int)amount;
                    }
                }
                else
                {
                    ingot.Amount = 2;
                }

                if (difficulty > from.Skills[SkillName.Mining].Value)
                {
                    this.m_Failure = true;
                    ingot.Delete();
                }
                else
                {
                    item.Delete();
                }

                from.AddToBackpack(ingot);

                from.PlaySound(0x2A);
                from.PlaySound(0x240);

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(false);
        }
Esempio n. 44
0
 public override void OnDoubleClick(Mobile m)
 {
     m.SendMessage("an imp claw that can be sold to butchers.");
     m.PlaySound(422);
 }
            protected override void OnTarget(Mobile from, object targetyouselect)
            {
                if (targetyouselect is Item)
                {
                    if (from.CheckTargetSkill(SkillName.ItemID, targetyouselect, 0, 100))
                    {
                        if (((Item)targetyouselect).IsChildOf(from.Backpack))
                        {
                            if (targetyouselect is BaseWeapon && ((BaseWeapon)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseWeapon)targetyouselect).SkillBonuses.SetValues(0, SkillName.Necromancy, 1);
                            }
                            else if (targetyouselect is BaseArmor && ((BaseArmor)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseArmor)targetyouselect).SkillBonuses.SetValues(0, SkillName.Necromancy, 1);
                            }
                            else if (targetyouselect is BaseJewel && ((BaseJewel)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseJewel)targetyouselect).SkillBonuses.SetValues(0, SkillName.Necromancy, 1);
                            }
                            else if (targetyouselect is BaseClothing && ((BaseClothing)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseClothing)targetyouselect).SkillBonuses.SetValues(0, SkillName.Necromancy, 1);
                            }
                            else if (targetyouselect is BaseWeapon && ((BaseWeapon)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseWeapon)targetyouselect).SkillBonuses.SetValues(1, SkillName.Necromancy, 1);
                            }
                            else if (targetyouselect is BaseArmor && ((BaseArmor)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseArmor)targetyouselect).SkillBonuses.SetValues(1, SkillName.Necromancy, 1);
                            }
                            else if (targetyouselect is BaseJewel && ((BaseJewel)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseJewel)targetyouselect).SkillBonuses.SetValues(1, SkillName.Necromancy, 1);
                            }
                            else if (targetyouselect is BaseClothing && ((BaseClothing)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseClothing)targetyouselect).SkillBonuses.SetValues(1, SkillName.Necromancy, 1);
                            }
                            else
                            {
                                from.SendMessage("That can not be enhanced.");
                                return; //continue might work also
                            }

                            from.SendMessage("You Successfully enhance the Item.");
                            from.PlaySound(Utility.Random(0x520, 0));
                            m_cOrb.Delete();
                        }
                        else
                        {
                            from.SendMessage("The target item must be in your backpack to use this.");
                            return; //continue might work also
                        }
                    }
                    else
                    {
                        from.SendMessage("You fail to enhance the item. Try again."); // You cannot augment that...
                    }
                }
                else if (targetyouselect is Mobile)
                {
                    ((Mobile)targetyouselect).OnSingleClick(from);
                }
                else
                {
                    from.SendMessage("You can only enhance Weapons, Armors, Jewlery, or Clothing.");
                }
            }
Esempio n. 46
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.CheckReflect((int)Circle, Caster, ref m);

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

                if (BlessSpell.UnderEffect(m))
                {
                    bool message = true;

                    if (m.Str > m.RawStr)
                    {
                        m.RemoveStatMod(String.Format("[Magic] {0} Offset", StatType.Str));
                        message = false;
                    }
                    if (m.Dex > m.RawDex)
                    {
                        m.RemoveStatMod(String.Format("[Magic] {0} Offset", StatType.Dex));
                        message = false;
                    }
                    if (m.Int > m.RawInt)
                    {
                        m.RemoveStatMod(String.Format("[Magic] {0} Offset", StatType.Int));
                        message = false;
                    }

                    if (message)
                    {
                        m.SendAsciiMessage("You are under the effect of a bless spell and cannot get any stat penalties");
                    }
                }
                else
                {
                    SpellHelper.AddStatCurse(Caster, m, StatType.Str);
                    SpellHelper.DisableSkillCheck = true;
                    SpellHelper.AddStatCurse(Caster, m, StatType.Dex);
                    SpellHelper.AddStatCurse(Caster, m, StatType.Int);
                    SpellHelper.DisableSkillCheck = false;
                }

                TimeSpan duration = SpellHelper.GetDuration(Caster, m);
                m_UnderEffect[m] = Timer.DelayCall(duration, new TimerStateCallback(RemoveEffect), m);
                m.UpdateResistances();

                //m.Paralyzed = false;
                m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
                m.PlaySound(Sound);

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

                string args = String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", percentage, percentage, percentage, 10, 10, 10, 10);

                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Curse, 1075835, 1075836, length, m, args));

                HarmfulSpell(m);
            }

            FinishSequence();
        }
Esempio n. 47
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile m = sender.Mobile;

                switch (info.ButtonID)
                {
                case 0:
                {
                    break;
                }

                case 1:
                {
                    if (!_Item.IsChildOf(m.Backpack))
                    {
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    if (_Item.SourceObject == null || _Item.DestinationObject == null)
                    {
                        m.SendLocalizedMessage(1159500);     // That is not a valid robe-slot item.
                        return;
                    }

                    if (!_Item.SourceObject.IsChildOf(m.Backpack))
                    {
                        _Item.SourceObject = null;
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    if (!_Item.DestinationObject.IsChildOf(m.Backpack))
                    {
                        _Item.DestinationObject = null;
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    if (_Item.CheckMagicalItem(_Item.DestinationObject))
                    {
                        m.SendLocalizedMessage(1159504);     // The destination item must be free of any magical properties.
                        return;
                    }

                    m.CloseGump(typeof(TransmogrificationPotionGump));

                    m.PlaySound(491);

                    _Item.SourceObject.ItemID   = _Item.DestinationObject.ItemID;
                    _Item.SourceObject.Hue      = _Item.DestinationObject.Hue;
                    _Item.SourceObject.LootType = _Item.DestinationObject.LootType;
                    _Item.SourceObject.Insured  = _Item.DestinationObject.Insured;

                    _Item.DestinationObject.Delete();
                    _Item.Delete();

                    break;
                }
                }
            }
Esempio n. 48
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.IsStaff() || from.InRange(GetWorldLocation(), 2))
            {
                #region Self Looting
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    var items = new List <Item>(Items);

                    bool gathered = false;

                    for (int k = 0; k < EquipItems.Count; ++k)
                    {
                        Item item2 = EquipItems[k];

                        if (!items.Contains(item2) && item2.IsChildOf(from.Backpack))
                        {
                            items.Add(item2);
                            gathered = true;
                        }
                    }

                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable)
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                if (Core.SA)
                                {
                                    robe.Delete();
                                }
                                else
                                {
                                    Map map = from.Map;

                                    if (map != null && map != Map.Internal)
                                    {
                                        robe.MoveToWorld(from.Location, map);
                                    }
                                }
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        SetFlag(CorpseFlag.Carved, true);

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID = Utility.Random(0xECA, 9);                             // bone graphic
                            Hue    = 0;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                         // You quickly gather all of your belongings.
                        items.Clear();
                        m_EquipItems.Clear();
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                         // You gather some of your belongings. The rest remain on the corpse.
                    }
                }
                #endregion

                if (!CheckLoot(from, null))
                {
                    return;
                }

                #region Quests
                PlayerMobile player = from as PlayerMobile;

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

                    if (qs is UzeraanTurmoilQuest)
                    {
                        GetDaemonBoneObjective obj = qs.FindObjective(typeof(GetDaemonBoneObjective)) as GetDaemonBoneObjective;

                        if (obj != null && obj.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
                        {
                            Item bone = new QuestDaemonBone();

                            if (player.PlaceInBackpack(bone))
                            {
                                obj.CorpseWithBone = null;
                                player.SendLocalizedMessage(1049341, "", 0x22);
                                // You rummage through the bones and find a Daemon Bone!  You quickly place the item in your pack.

                                if (!obj.Completed)
                                {
                                    obj.Complete();
                                }
                            }
                            else
                            {
                                bone.Delete();
                                player.SendLocalizedMessage(1049342, "", 0x22);
                                // Rummaging through the bones you find a Daemon Bone, but can't pick it up because your pack is too full.  Come back when you have more room in your pack.
                            }

                            return;
                        }
                    }
                    else if (qs is TheSummoningQuest)
                    {
                        VanquishDaemonObjective obj = qs.FindObjective(typeof(VanquishDaemonObjective)) as VanquishDaemonObjective;

                        if (obj != null && obj.Completed && obj.CorpseWithSkull == this)
                        {
                            GoldenSkull sk = new GoldenSkull();

                            if (player.PlaceInBackpack(sk))
                            {
                                obj.CorpseWithSkull = null;
                                player.SendLocalizedMessage(1050022);
                                // For your valor in combating the devourer, you have been awarded a golden skull.
                                qs.Complete();
                            }
                            else
                            {
                                sk.Delete();
                                player.SendLocalizedMessage(1050023);                                 // You find a golden skull, but your backpack is too full to carry it.
                            }
                        }
                    }
                }
                #endregion

                base.OnDoubleClick(from);
            }
            else
            {
                from.SendLocalizedMessage(500446);                 // That is too far away.
                return;
            }
        }
Esempio n. 49
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.CheckSkill(SkillName.Fishing, SkillNeeded, 125))
            {
                if (!from.Backpack.ConsumeTotal(typeof(Bottle), 1))
                {
                    from.SendMessage("You need an empty bottle to drain the fluid from the seaweed.");
                    return;
                }
                else
                {
                    from.PlaySound(0x240);

                    if (this.Name == "Seaweed of Nightsight")
                    {
                        from.AddToBackpack(new NightSightPotion());
                    }
                    else if (this.Name == "Seaweed of Lesser Cure")
                    {
                        from.AddToBackpack(new LesserCurePotion());
                    }
                    else if (this.Name == "Seaweed of Cure")
                    {
                        from.AddToBackpack(new CurePotion());
                    }
                    else if (this.Name == "Seaweed of Greater Cure")
                    {
                        from.AddToBackpack(new GreaterCurePotion());
                    }
                    else if (this.Name == "Seaweed of Agility")
                    {
                        from.AddToBackpack(new AgilityPotion());
                    }
                    else if (this.Name == "Seaweed of Greater Agility")
                    {
                        from.AddToBackpack(new GreaterAgilityPotion());
                    }
                    else if (this.Name == "Seaweed of Strength")
                    {
                        from.AddToBackpack(new StrengthPotion());
                    }
                    else if (this.Name == "Seaweed of Greater Strength")
                    {
                        from.AddToBackpack(new GreaterStrengthPotion());
                    }
                    else if (this.Name == "Seaweed of Lesser Poison")
                    {
                        from.AddToBackpack(new LesserPoisonPotion());
                    }
                    else if (this.Name == "Seaweed of Poison")
                    {
                        from.AddToBackpack(new PoisonPotion());
                    }
                    else if (this.Name == "Seaweed of Greater Poison")
                    {
                        from.AddToBackpack(new GreaterPoisonPotion());
                    }
                    else if (this.Name == "Seaweed of Deadly Poison")
                    {
                        from.AddToBackpack(new DeadlyPoisonPotion());
                    }
                    else if (this.Name == "Seaweed of Lethal Poison")
                    {
                        from.AddToBackpack(new LethalPoisonPotion());
                    }
                    else if (this.Name == "Seaweed of Refresh")
                    {
                        from.AddToBackpack(new RefreshPotion());
                    }
                    else if (this.Name == "Seaweed of Total Refresh")
                    {
                        from.AddToBackpack(new TotalRefreshPotion());
                    }
                    else if (this.Name == "Seaweed of Lesser Heal")
                    {
                        from.AddToBackpack(new LesserHealPotion());
                    }
                    else if (this.Name == "Seaweed of Heal")
                    {
                        from.AddToBackpack(new HealPotion());
                    }
                    else if (this.Name == "Seaweed of Greater Heal")
                    {
                        from.AddToBackpack(new GreaterHealPotion());
                    }
                    else if (this.Name == "Seaweed of Lesser Explosion")
                    {
                        from.AddToBackpack(new LesserExplosionPotion());
                    }
                    else if (this.Name == "Seaweed of Explosion")
                    {
                        from.AddToBackpack(new ExplosionPotion());
                    }
                    else if (this.Name == "Seaweed of Greater Explosion")
                    {
                        from.AddToBackpack(new GreaterExplosionPotion());
                    }
                    else if (this.Name == "Seaweed of Lesser Invisibility")
                    {
                        from.AddToBackpack(new LesserInvisibilityPotion());
                    }
                    else if (this.Name == "Seaweed of Invisibility")
                    {
                        from.AddToBackpack(new InvisibilityPotion());
                    }
                    else if (this.Name == "Seaweed of Greater Invisibility")
                    {
                        from.AddToBackpack(new GreaterInvisibilityPotion());
                    }
                    else if (this.Name == "Seaweed of Lesser Rejuvenate")
                    {
                        from.AddToBackpack(new LesserRejuvenatePotion());
                    }
                    else if (this.Name == "Seaweed of Rejuvenate")
                    {
                        from.AddToBackpack(new RejuvenatePotion());
                    }
                    else if (this.Name == "Seaweed of Greater Rejuvenate")
                    {
                        from.AddToBackpack(new GreaterRejuvenatePotion());
                    }
                    else if (this.Name == "Seaweed of Lesser Mana")
                    {
                        from.AddToBackpack(new LesserManaPotion());
                    }
                    else if (this.Name == "Seaweed of Mana")
                    {
                        from.AddToBackpack(new ManaPotion());
                    }
                    else if (this.Name == "Seaweed of Greater Mana")
                    {
                        from.AddToBackpack(new GreaterManaPotion());
                    }
                    else if (this.Name == "Seaweed of Invulnerability")
                    {
                        from.AddToBackpack(new InvulnerabilityPotion());
                    }

                    from.SendMessage("You squeeze the fluid into the bottle.");
                    this.Consume();

                    return;
                }
            }
            else
            {
                from.SendMessage("You fail to get any fluid from the seaweed.");
                this.Consume();
                return;
            }
        }
Esempio n. 50
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5040);
                        }
                    }
                    else if (DateTime.Now > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            bool eastToWest         = (m_Item.ItemID == 0x3915);
                            IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1)));

                            foreach (Mobile m in eable)
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            eable.Free();

                            while (m_Queue.Count > 0)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                caster.DoHarmful(m);

                                m_Item.ApplyPoisonTo(m);
                                m.PlaySound(0x474);
                            }
                        }
                    }
                }
Esempio n. 51
0
        public void Pour(Mobile from, Item item)
        {
            if (m_PlantStatus >= PlantStatus.DeadTwigs)
            {
                return;
            }

            if (m_PlantStatus == PlantStatus.DecorativePlant)
            {
                LabelTo(from, 1053049);                   // This is a decorative plant, it does not need watering!
                return;
            }

            if (!IsUsableBy(from))
            {
                LabelTo(from, 1061856);                   // You must have the item in your backpack or locked down in order to use it.
                return;
            }

            if (item is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)item;

                if (beverage.IsEmpty || !beverage.Pourable || beverage.Content != BeverageType.Water)
                {
                    LabelTo(from, 1053069);                       // You can't use that on a plant!
                    return;
                }

                if (!beverage.ValidateUse(from, true))
                {
                    return;
                }

                beverage.Quantity--;
                m_PlantSystem.Water++;

                from.PlaySound(0x4E);
                LabelTo(from, 1061858);                   // You soften the dirt with water.
            }
            else if (item is BasePotion)
            {
                BasePotion potion = (BasePotion)item;

                int message;
                if (ApplyPotion(potion.PotionEffect, false, out message))
                {
                    potion.Consume();
                    from.PlaySound(0x240);
                    from.AddToBackpack(new Bottle());
                }
                LabelTo(from, message);
            }
            else if (item is PotionKeg)
            {
                PotionKeg keg = (PotionKeg)item;

                if (keg.Held <= 0)
                {
                    LabelTo(from, 1053069);                       // You can't use that on a plant!
                    return;
                }

                int message;
                if (ApplyPotion(keg.Type, false, out message))
                {
                    keg.Held--;
                    from.PlaySound(0x240);
                }
                LabelTo(from, message);
            }
            else
            {
                LabelTo(from, 1053069);                   // You can't use that on a plant!
            }
        }
 protected override void OnTick()
 {
     m_Mobile.PlaySound(0xFA);
 }
Esempio n. 53
0
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                Map map = m_Owner.Map;

                if (map == null)
                {
                    return;
                }

                if (0.5 < Utility.RandomDouble())
                {
                    return;
                }

                Mobile toTeleport = null;

                foreach (Mobile m in m_Owner.GetMobilesInRange(16))
                {
                    if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m))
                    {
                        toTeleport = m;
                        break;
                    }
                }

                if (toTeleport != null)
                {
                    int offset = Utility.Random(8) * 2;

                    Point3D to = m_Owner.Location;

                    for (int i = 0; i < m_Offsets.Length; i += 2)
                    {
                        int x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length];
                        int y = m_Owner.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

                        if (map.CanSpawnMobile(x, y, m_Owner.Z))
                        {
                            to = new Point3D(x, y, m_Owner.Z);
                            break;
                        }
                        else
                        {
                            int z = map.GetAverageZ(x, y);

                            if (map.CanSpawnMobile(x, y, z))
                            {
                                to = new Point3D(x, y, z);
                                break;
                            }
                        }
                    }

                    Mobile m = toTeleport;

                    Point3D from = m.Location;

                    m.Location = to;

                    Server.Spells.SpellHelper.Turn(m_Owner, toTeleport);
                    Server.Spells.SpellHelper.Turn(toTeleport, m_Owner);

                    m.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                    Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);

                    m.PlaySound(0x1FE);

                    m_Owner.Combatant = toTeleport;
                }
            }
Esempio n. 54
0
 public override void PlayCraftEffect(Mobile from)
 {
     from.PlaySound(0x1C6);
 }
Esempio n. 55
0
 protected override void OnTick()
 {
     m_Mobile.PlaySound(0x033);
     m_Mobile.AddToBackpack(new NiporailemsTreasure());
     m_Mobile.SendLocalizedMessage(1112111);                   // To steal my gold? To give it freely!
 }
Esempio n. 56
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029);
                        }
                    }
                    else if (DateTime.Now > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            foreach (Mobile m in m_Item.GetMobilesInRange(0))
                            {
                                if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && m != caster && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            while (m_Queue.Count > 0)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                if (SpellHelper.CanRevealCaster(m))
                                {
                                    caster.RevealingAction();
                                }

                                caster.DoHarmful(m);

                                int damage = m_Item.m_Damage;

                                if (m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
                                {
                                    damage = 1;

                                    m.SendLocalizedMessage(501783);                                       // You feel yourself resisting magical energy.
                                }

                                m.Damage(damage, caster);
                                m.PlaySound(0x208);

                                if (m is BaseCreature)
                                {
                                    ((BaseCreature)m).OnHarmfulSpell(caster);
                                }
                            }
                        }
                    }
                }
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                IceBlock ice = new IceBlock();
                ice.MoveToWorld(new Point3D(from.X + 1, from.Y, from.Z), from.Map);
                from.PlaySound(0x229);


                IceBlock icea = new IceBlock();
                icea.MoveToWorld(new Point3D(from.X + 1, from.Y + 1, from.Z), from.Map);
                from.PlaySound(0x229);


                IceBlock iceb = new IceBlock();
                iceb.MoveToWorld(new Point3D(from.X + 1, from.Y - 1, from.Z), from.Map);
                from.PlaySound(0x229);

                IceBlock icec = new IceBlock();
                icec.MoveToWorld(new Point3D(from.X, from.Y + 1, from.Z), from.Map);
                from.PlaySound(0x229);

                IceBlock iced = new IceBlock();
                iced.MoveToWorld(new Point3D(from.X, from.Y - 1, from.Z), from.Map);
                from.PlaySound(0x229);

                IceBlock icee = new IceBlock();
                icee.MoveToWorld(new Point3D(from.X - 1, from.Y, from.Z), from.Map);
                from.PlaySound(0x229);

                IceBlock icef = new IceBlock();
                icef.MoveToWorld(new Point3D(from.X - 1, from.Y - 1, from.Z), from.Map);
                from.PlaySound(0x229);

                IceBlock iceg = new IceBlock();
                iceg.MoveToWorld(new Point3D(from.X - 1, from.Y + 1, from.Z), from.Map);
                from.PlaySound(0x229);

                IceBlock iceh = new IceBlock();
                iceh.ItemID = 0x8e1;
                iceh.MoveToWorld(new Point3D(from.X, from.Y, from.Z + 19), from.Map);
                from.PlaySound(0x229);

                from.PlaySound(0x390);
                from.PlaySound(0x38D);
                from.FixedParticles(0x3728, 1, 10, 9910, 1152, 1, EffectLayer.Head);
                from.Hits = from.Hits - from.Hits / 10;

                this.Delete();
            }
        }
Esempio n. 58
0
        protected override void OnTarget(Mobile from, object target)
        {
            BaseCreature pet = target as BaseCreature;

            if (target == from)
            {
                from.SendMessage(38, "You cannot shrink yourself!");
            }

            else if (target is Item)
            {
                from.SendMessage(38, "You cannot shrink that!");
            }

            else if (target is PlayerMobile)
            {
                from.SendMessage(38, "That person gives you a dirty look!");
            }

            else if (Server.Spells.SpellHelper.CheckCombat(from))
            {
                from.SendMessage(38, "You cannot shrink your pet while you are fighting.");
            }

            else if (null == pet)
            {
                from.SendMessage(38, "That is not a pet!");
            }

            else if ((pet.BodyValue == 400 || pet.BodyValue == 401) && pet.Controlled == false)
            {
                from.SendMessage(38, "That person gives you a dirty look!");
            }

            else if (pet.IsDeadPet)
            {
                from.SendMessage(38, "You cannot shrink the dead!");
            }

            else if (pet.Summoned)
            {
                from.SendMessage(38, "You cannot shrink a summoned creature!");
            }

            else if (!m_StaffCommand && pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                from.SendMessage(38, "Your pet is fighting; you cannot shrink it yet.");
            }

            else if (pet.BodyMod != 0)
            {
                from.SendMessage(38, "You cannot shrink your pet while it is polymorphed.");
            }

            else if (!m_StaffCommand && pet.Controlled == false)
            {
                from.SendMessage(38, "You cannot not shrink wild creatures.");
            }

            else if (!m_StaffCommand && pet.ControlMaster != from)
            {
                from.SendMessage(38, "That is not your pet.");
            }

            else if (!m_StaffCommand && ShrinkItem.IsPackAnimal(pet) && (null != pet.Backpack && pet.Backpack.Items.Count > 0))
            {
                from.SendMessage(38, "You must unload this pet's pack before it can be shrunk.");
            }

            else
            {
                if (pet.ControlMaster != from && !pet.Controlled)
                {
                    SpawnEntry se = pet.Spawner as SpawnEntry;
                    if (se != null && se.UnlinkOnTaming)
                    {
                        pet.Spawner.Remove((ISpawnable)pet);
                        pet.Spawner = null;
                    }

                    pet.CurrentWayPoint = null;
                    pet.ControlMaster   = from;
                    pet.Controlled      = true;
                    pet.ControlTarget   = null;
                    pet.ControlOrder    = OrderType.Come;
                    pet.Guild           = null;
                    pet.Delta(MobileDelta.Noto);
                }

                IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);

                Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(pet), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                from.PlaySound(492);
                from.AddToBackpack(new ShrinkItem(pet));

                if (!m_StaffCommand && null != m_ShrinkTool && m_ShrinkTool.ShrinkCharges > 0)
                {
                    m_ShrinkTool.ShrinkCharges--;
                }
            }
        }
Esempio n. 59
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3);

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                if (Core.AOS)
                {
                    Party party = Party.Get(Caster);

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

                        if (m == Caster || (party != null && party.Contains(m)))
                        {
                            Caster.DoBeneficial(m);
                            Spells.Second.ProtectionSpell.Toggle(Caster, m);
                        }
                    }
                }
                else
                {
                    Effects.PlaySound(p, Caster.Map, 0x299);

                    int val = (int)(Caster.Skills[SkillName.Magery].Value / 10.0 + 1);

                    if (targets.Count > 0)
                    {
                        for (int i = 0; i < targets.Count; ++i)
                        {
                            Mobile m = (Mobile)targets[i];

                            if (m.BeginAction(typeof(ArchProtectionSpell)))
                            {
                                Caster.DoBeneficial(m);
                                m.VirtualArmorMod += val;
                                new InternalTimer(m, Caster, val).Start();

                                m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
                                m.PlaySound(0x1F7);
                            }
                        }
                    }
                }
            }

            FinishSequence();
        }
Esempio n. 60
0
        private bool Resmelt(Mobile from, Item item, CraftResource resource)
        {
            try
            {
                if (CraftResources.GetType(resource) != CraftResourceType.Metal)
                {
                    return(false);
                }

                CraftResourceInfo info = CraftResources.GetInfo(resource);

                if (info == null || info.ResourceTypes.Length == 0)
                {
                    return(false);
                }

                CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType());

                if (craftItem == null || craftItem.Resources.Count == 0)
                {
                    return(false);
                }

                CraftRes craftResource = craftItem.Resources.GetAt(0);

                if (craftResource.Amount < 2)
                {
                    return(false); // Not enough metal to resmelt
                }
                double difficulty = 0.0;

                switch (resource)
                {
                case CraftResource.MRusty: difficulty = 50.0; break;

                case CraftResource.MOldcopper: difficulty = 60.0; break;

                case CraftResource.MDullcopper: difficulty = 65.0; break;

                case CraftResource.MShadow: difficulty = 70.0; break;

                case CraftResource.MCopper: difficulty = 75.0; break;

                case CraftResource.MBronze: difficulty = 80.0; break;

                case CraftResource.MGold: difficulty = 85.0; break;

                case CraftResource.MRose: difficulty = 87.0; break;

                case CraftResource.MAgapite: difficulty = 90.0; break;

                case CraftResource.MValorite: difficulty = 90.0; break;

                case CraftResource.MBloodrock: difficulty = 93.0; break;

                case CraftResource.MVerite: difficulty = 95.0; break;

                case CraftResource.MSilver: difficulty = 95.0; break;

                case CraftResource.MDragon: difficulty = 95.0; break;

                case CraftResource.MTitan: difficulty = 95.0; break;

                case CraftResource.MCrystaline: difficulty = 95.0; break;

                case CraftResource.MKrynite: difficulty = 95.0; break;

                case CraftResource.MVulcan: difficulty = 95.0; break;

                case CraftResource.MBloodcrest: difficulty = 95.0; break;

                case CraftResource.MElvin: difficulty = 95.0; break;

                case CraftResource.MAcid: difficulty = 95.0; break;

                case CraftResource.MAqua: difficulty = 95.0; break;

                case CraftResource.MEldar: difficulty = 95.0; break;

                case CraftResource.MGlowing: difficulty = 95.0; break;

                case CraftResource.MGorgan: difficulty = 95.0; break;

                case CraftResource.MSteel: difficulty = 95.5; break;

                case CraftResource.MSandrock: difficulty = 95.0; break;

                case CraftResource.MMytheril: difficulty = 97.5; break;

                case CraftResource.MBlackrock: difficulty = 98.0; break;
                }

                Type resourceType = info.ResourceTypes[0];
                Item ingot        = (Item)Activator.CreateInstance(resourceType);

                if (item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed))
                {
                    double mining = from.Skills[SkillName.Mining].Value;
                    if (mining > 100.0)
                    {
                        mining = 100.0;
                    }
                    double amount = (((4 + mining) * craftResource.Amount - 4) * 0.0068);
                    if (amount < 2)
                    {
                        ingot.Amount = 2;
                    }
                    else
                    {
                        ingot.Amount = (int)amount;
                    }
                }
                else
                {
                    ingot.Amount = 2;
                }

                if (difficulty > from.Skills[SkillName.Mining].Value)
                {
                    m_Failure = true;
                    ingot.Delete();
                }
                else
                {
                    item.Delete();
                }

                from.AddToBackpack(ingot);

                from.PlaySound(0x2A);
                from.PlaySound(0x240);

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(false);
        }