Пример #1
0
        // When this object -- the bottle -- is double-clicked...
        public override void OnDoubleClick(Mobile m)
        {
            if (m.Followers >= m.FollowersMax) // If the player's followers is greater than or equal to his max followers...
            {
                m.SendMessage("You need at least one free follower slot to open the bottle.");
            }
            else if (((m.InRange(this, 1) && m.CanSee(this)) || this.IsChildOf(m.Backpack)) && (!GetGooInBottle())) // If the bottle is in-range and the goo is not in its bottle...
            {
                m.SendMessage("The goo is out of its bottle!");
                m.SendLocalizedMessage(1010018); // What do you want to use this item on?

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

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

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

                SetGooInBottle(false);
            }
            else
            {
                m.SendLocalizedMessage(500446); //That is too far away.
            }
        }
Пример #2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (lastused + delay > DateTime.Now)
                return;
            else
                lastused = DateTime.Now;

            if (IsChildOf(from.Backpack) || from.InRange(this, 2) && from.CanSee(this))
            {
                switch (Utility.Random(8))
                {
                    default:
                    case 0: from.SendMessage("IT IS CERTAIN"); break;
                    case 1: from.SendMessage("WITHOUT A DOUBT"); break;
                    case 2: from.SendMessage("MY REPLY IS NO"); break;
                    case 3: from.SendMessage("ASK AGAIN LATER"); break;
                    case 4: from.SendMessage("VERY DOUBTFUL"); break;
                    case 5: from.SendMessage("CONCENTRATE AND ASK AGAIN"); break;
                    case 6: from.SendMessage("DON'T COUNT ON IT"); break;
                    case 7: from.SendMessage("YES"); break;
                }
                
               // this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1007000 + Utility.Random(28)); 
            }
            else
            {
                from.SendLocalizedMessage(500446); // That is too far away. 
            }
        }
Пример #3
0
        public static void Effect( Mobile attacker, Mobile defender, int featlevel )
        {
            IKhaerosMobile featuser = attacker as IKhaerosMobile;
            ArrayList list = new ArrayList();

            foreach( Mobile m in defender.GetMobilesInRange( featlevel + 2 ) )
            {
                if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) || featuser.IsAllyOf( m ) )
                    continue;

                if( !attacker.InRange( m, ((BaseWeapon)attacker.Weapon).MaxRange ) )
                    continue;

                if( m != attacker && Spells.SpellHelper.ValidIndirectTarget( attacker, m ) )
                {
                    if( attacker.InLOS( m ) )
                        list.Add( m );
                }
            }

            for( int i = 0; i < Math.Min( list.Count, featlevel + 1 ); ++i )
            {
                int random = Utility.Random( list.Count );
                Mobile m = (Mobile)list[random];

                featuser.CleaveAttack = true;
                ((BaseWeapon)attacker.Weapon).OnSwing( attacker, m, 0.5, true );

            }
        }
		public SleeperBedBodyContent( Mobile beholder, SleeperBedBody beheld ) : base( 0x3C )
		{
			ArrayList items = beheld.EquipItems;
			int count = items.Count;

			EnsureCapacity( 5 + (count * 19) );

			long pos = m_Stream.Position;

			int written = 0;

			m_Stream.Write( (ushort) 0 );

			for ( int i = 0; i < count; ++i )
			{
				Item child = (Item)items[i];

				if ( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) )
				{
					m_Stream.Write( (int) child.Serial );
					m_Stream.Write( (ushort) child.ItemID );
					m_Stream.Write( (byte) 0 ); // signed, itemID offset
					m_Stream.Write( (ushort) child.Amount );
					m_Stream.Write( (short) child.X );
					m_Stream.Write( (short) child.Y );
					m_Stream.Write( (int) beheld.Serial );
					m_Stream.Write( (ushort) child.Hue );

					++written;
				}
			}

			m_Stream.Seek( pos, SeekOrigin.Begin );
			m_Stream.Write( (ushort) written );
		}
Пример #5
0
		public virtual void BlessingOfKhopesh_OnTarget( Mobile from, object target )
		{
			if( !from.CanSee( target ) )
			{
				from.SendLocalizedMessage( 500237 ); //Target cannot be seen.
			}
			else if( target is Mobile )
			{
				Mobile t = (Mobile)target;
				
				if( !from.InRange( t.Location, 10 ) )
					from.SendMessage( "That is too far away." );
				
				t.BoltEffect( 2 );
				Effects.SendLocationParticles( EffectItem.Create( new Point3D( t.X, t.Y, t.Z + 10 ), t.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 );
				t.PlaySound( 0x1E1 );
				
				t.Hidden = true;
				t.AllowedStealthSteps = Utility.RandomMinMax( 50, 75 );
				
				from.SendMessage( "You have hidden your target well." );
				t.SendMessage( "You have been hidden well, and can move quietly in the shadows." );
				
				t.AddToBackpack( new KhoMarkGem() );
				
				this.Delete();
			}
			else
			{
				from.SendMessage( "This would not work on that." );
			}

			from.Frozen = false;
		}
            protected override void OnTarget(Mobile from, object o)
            {
                if (m_deed == null || m_deed.Deleted || !m_deed.IsChildOf(from.Backpack) || !from.CanSee(o))
                    return;

                if (o is Corpse && !((Corpse)o).Deleted)
                {
                    Corpse corpse = (Corpse)o;

                    if (!from.InRange(corpse.Location, 4))
                    {
                        from.SendLocalizedMessage(500446); // That is too far away.
                        return;
                    }

                    if (CheckCorpseType(from, corpse, m_deed) && CanUseWithDeed(from, corpse) && CheckUseWithDeedTime(from, corpse))
                    {
                        corpse.Delete();
                        m_deed.AmountCur++;
                        from.SendMessage("The corpse has been combined with the deed.");

                        from.SendGump(new SmallBODGump(from, m_deed));
                    }
                }
                else
                    from.SendLocalizedMessage(1042600); // That is not a corpse!
            }
Пример #7
0
        public bool Diaper(Mobile from, Diaper Diaper)
        {
            if (Deleted || !from.CanSee(this)) return false;

            from.AddToBackpack(new DirtyDiaper());

            return true;
        }
Пример #8
0
 public static bool CanUse(Mobile from, Mobile target, bool harm)
 {
     if (!CanUse(from) || target == null)
         return false;
     else if (!from.CanSee(target))
         return false;
     else
         return CanTarget(from, target, harm);
 }
Пример #9
0
		public bool Scissor( Mobile from, Scissors scissors )
		{
			if ( Deleted || !from.CanSee( this ) )
				return false;

			base.ScissorHelper( from, new Bandage(), 1 );

			return true;
		}
Пример #10
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker )  )
                return;

            ClearCurrentAbility( attacker );

            Map map = attacker.Map;

            if ( map == null )
                return;

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if ( weapon == null )
                return;

            if ( !CheckMana( attacker, true ) )
                return;

            attacker.FixedEffect( 0x3728, 10, 15 );
            attacker.PlaySound( 0x2A1 );

            ArrayList list = new ArrayList();

            foreach ( Mobile m in attacker.GetMobilesInRange( 1 ) )
                list.Add( m );

            Party p = Party.Get( attacker );

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

                if (m != defender && m != attacker &&
                    SpellHelper.ValidIndirectTarget(attacker, m) &&
                    attacker.CanBeHarmful(m, false) &&
                    (p == null || !p.Contains(m)))
                {
                    if ( m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee( m ) )
                        continue;

                    if ( !attacker.InRange( m, weapon.MaxRange ) )
                        continue;

                    if ( attacker.InLOS( m ) )
                    {
                        attacker.RevealingAction();

                        attacker.SendLocalizedMessage( 1060161 ); // The whirling attack strikes a target!
                        m.SendLocalizedMessage( 1060162 ); // You are struck by the whirling attack and take damage!

                        weapon.OnHit( attacker, m );
                    }
                }
            }
        }
Пример #11
0
		public virtual bool Dye(Mobile mob, DyeTub sender)
		{
			if (mob == null || sender == null || !mob.CanSee(sender) || !sender.IsAccessibleTo(mob))
			{
				return false;
			}

			Hue = sender.DyedHue;
			return true;
		}
Пример #12
0
		public bool Scissor( Mobile from, Scissors scissors )
		{
			if ( Deleted || !from.CanSee( this ) )
				return false;

			base.ScissorHelper( from, new Bone(), 1 );
			from.PlaySound( 0x21B );

			return false;
		}
Пример #13
0
		public virtual void OnDoubleClick( Mobile from, bool createWeedsAndDelete )
		{
			if( !from.CanSee( this ) )
			{
				from.SendMessage( "You cannot see that." );
			}
			else if( !(this is HarvestableTree) && !from.InRange( this, 1 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( this is HarvestableTree && !from.InRange( this, 2 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( (Sower != null && from != m_Sower) && !(this is HarvestableTree) )
			{
				from.SendMessage( "You cannot harvest any of this crop." );
			}
			else if( from.Mounted )
			{
				from.SendMessage( "You cannot do this while riding a mount." );
			}
			else
			{
				int calcYield = CalculateYield( from );
				Item crop = null;

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

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

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

				if( createWeedsAndDelete )
				{
					new Weeds().MoveToWorld( this.Location, this.Map );
					this.Delete();
				}
				else
				{
					OnHarvest( from );
				}
			}
		}
Пример #14
0
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (Deleted || !from.CanSee(this)) return false;

            //base.ScissorHelper(from, new Cloth(), 50);

            from.SendMessage("You removed the tag from the pillow, that is illegal.  You are now a criminal.");
            from.Criminal = true;

            return true;
        }
Пример #15
0
		public override void OnStatsQuery( Mobile from )
		{
			if ( from.Map == this.Map && Utility.InUpdateRange( this, from ) && from.CanSee( this ) )
			{
				BaseHouse house = BaseHouse.FindHouseAt( this );

				if ( house != null && house.IsCoOwner( from ) )
					from.SendLocalizedMessage( 1072625 ); // As the house owner, you may rename this Parrot.
					
				from.Send( new Server.Network.MobileStatus( from, this ) );
			}
		}
Пример #16
0
		public override bool Dye(Mobile from, DyeTub sender)
		{
			if (from == null || sender == null || !from.CanSee(sender) || !sender.IsAccessibleTo(from))
			{
				return false;
			}

			if (!(sender is FurnitureDyeTub))
			{
				return false;
			}

			return base.Dye(from, sender);
		}
Пример #17
0
        public static void Effect( Mobile attacker, Mobile defender, int featlevel )
        {
            if( !BaseCustomSpell.HasEnoughMana( attacker, ( featlevel * 5 ) ) )
                return;

            ArrayList list = new ArrayList();
            IKhaerosMobile featuser = attacker as IKhaerosMobile;

            foreach( Mobile m in attacker.GetMobilesInRange( 5 ) )
                list.Add( m );

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

                if( ((IKhaerosMobile)attacker).IsAllyOf( m ) )
                {
                    if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) )
                        continue;

                    if( attacker.InLOS( m ) && m.Hits < m.HitsMax )
                    {
                        double heal = ( 0.10 * featlevel ) * attacker.Skills[SkillName.Faith].Base;

                        if( m is PlayerMobile && attacker is PlayerMobile && ((PlayerMobile)m).ChosenDeity != ChosenDeity.None &&
                           ((PlayerMobile)m).ChosenDeity == ((PlayerMobile)attacker).ChosenDeity &&
                           ((PlayerMobile)m).Backgrounds.BackgroundDictionary[BackgroundList.Faithful].Level > 0 )
                            heal = heal + ( heal * 0.1 );

                        m.PlaySound( 0x1F2 );
                        m.FixedEffect( 0x376A, 9, 32 );
                        m.Hits += Convert.ToInt32( heal );
                        attacker.Mana -= ( 5 * featlevel );
                        m.LocalOverheadMessage( Network.MessageType.Regular, 170, false, "+" + Convert.ToInt32( heal ) );

                        if( attacker.Target != null && attacker.Target is BaseCustomSpell.CustomSpellTarget )
                            attacker.Target = null;

                        break;
                    }
                }
            }
        }
 protected override void OnTarget( Mobile from, object targeted ) 
 { 
     if ( targeted is Mobile ) 
     { 
         Mobile targ = (Mobile)targeted; 
     if ( !from.CanSee( targ ) ) 
     { 
    from.SendMessage( "You Cannot See This Target" ); 
     } 
     else 
     { 
     targ.Emote( "* Ohh-Rah! Get Vanqusihed by the Hands of The Ice-God *" ); 
     targ.BoltEffect( 0 ); 
     targ.Damage( Utility.Random( 5, 65 ) ); 
     from.Emote( "* In Rememberance of Old Man Ice-God!*" ); 
     } 
    } 
   
 } 
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Powder.Deleted )
					return;

				if ( !from.InRange( m_Powder.GetWorldLocation(), 2 ) )
				{
					from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
				}
				else if ( targeted is Moonstone )
				{
					Moonstone stone = (Moonstone)targeted;
					if ( !from.CanSee( stone ) )
					{
						from.SendLocalizedMessage( 500237 ); // Target can not be seen.
					}
					else if ( !SpellHelper.CheckTravel( from, TravelCheckType.Mark ) )
					{
					}
					else if ( SpellHelper.CheckMulti( from.Location, from.Map, !Core.AOS ) )
					{
						from.SendLocalizedMessage( 501942 ); // That location is blocked.
					}
					else if ( !stone.IsChildOf( from.Backpack))
					{
						from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "That must be in your pack");
					}
					else
					{
						stone.Mark( from );
						
						from.PlaySound( 0x1FA );
						Effects.SendLocationEffect( from, from.Map, 14201, 16 );
						m_Powder.Amount = m_Powder.Amount - 1;
						if (m_Powder.Amount <= 0)
							m_Powder.Delete();
					}
				}
				else
				{
					from.SendMessage( "Powder of translocation has no effect on this item" ); // Powder of translocation has no effect on this item.
				}
			}
Пример #20
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            Timer t = m_Table[m] as Timer;
            if (t != null && t.Running)
                t.Stop();
            if (m.CheckSkill(SkillName.SpiritSpeak, 0, 100))
            {
                if (t == null)
                    m_Table[m] = t = new SpiritSpeakTimer(m);

                double secs = m.Skills[SkillName.SpiritSpeak].Base / 50;
                secs *= 90;
                if (secs < 10)
                    secs = 10;

                t.Delay = TimeSpan.FromSeconds(secs);//15 seconds to 3 minutes
                t.Start();
                m.CanHearGhosts = true;

                IPooledEnumerable eable = m.Map.GetMobilesInRange(m.Location, Core.GlobalMaxUpdateRange);
                // find all the dead people we can see in range and send them
                foreach (Mobile g in eable)
                {
                    if (!g.Alive && m.CanSee(g) && Utility.InUpdateRange(m.Location, g.Location))
                        m.Send(new MobileIncoming(m, g));
                }
                eable.Free();

                m.PlaySound(0x24A);
                m.SendLocalizedMessage(502444);//You contact the neitherworld.
            }
            else
            {
                m_Table.Remove(m);
                m.SendLocalizedMessage(502443);//You fail to contact the neitherworld.
                m.CanHearGhosts = false;
            }

            return TimeSpan.FromSeconds(10.0);
        }
Пример #21
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
                return;

            ClearCurrentAbility( attacker );

            Map map = attacker.Map;

            if ( map != null )
            {
                defender.PlaySound( 0x5BF );

                ArrayList targets = new ArrayList();

                foreach ( Mobile m in defender.GetMobilesInRange( 5 ) )
                {
                    if ( SpellHelper.ValidIndirectTarget( attacker, m ) && attacker.CanBeHarmful( m, false ) && defender.InLOS( m ) && defender.CanSee( m ) )
                        targets.Add( m );
                }

                double dm;

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

                    if ( attacker.CanBeHarmful( m ) && attacker != m )
                    {
                        attacker.DoHarmful( m );

                        Effects.SendBoltEffect( m, false, 0 );

                        // TODO: Revisar formula del daño

                        dm = Utility.RandomMinMax( 25, 30 );

                        SpellHelper.Damage( TimeSpan.Zero, m, attacker, dm, 0, 0, 0, 0, 100 );
                    }
                }
            }
        }
Пример #22
0
		public SleeperBedBodyEquip( Mobile beholder, SleeperBedBody beheld ) : base( 0x89 )
		{
			ArrayList list = beheld.EquipItems;

			EnsureCapacity( 8 + (list.Count * 5) );

			m_Stream.Write( (int) beheld.Serial );

			for ( int i = 0; i < list.Count; ++i )
			{
				Item item = (Item)list[i];

				if ( !item.Deleted && beholder.CanSee( item ) && item.Parent == beheld )
				{
					m_Stream.Write( (byte) (item.Layer + 1) );
					m_Stream.Write( (int) item.Serial );
				}
			}

			m_Stream.Write( (byte) Layer.Invalid );
		}
Пример #23
0
        public AckPartyLocations( Mobile from, Party party )
            : base(0x01, ( ( party.Members.Count - 1 ) * 9 ) + 4)
        {
            foreach ( PartyMemberInfo pmi in party.Members )
            {
                if ( pmi == null || pmi.Mobile == from )
                    continue;

                Mobile m = pmi.Mobile;

                if ( from.InUpdateRange( m ) && from.CanSee( m ) )
                    continue;

                m_Stream.Write( (int) m.Serial );
                m_Stream.Write( (short) m.X );
                m_Stream.Write( (short) m.Y );
                m_Stream.Write( (byte) ( m.Map == null ? 0 : m.Map.MapID ) );
            }

            m_Stream.Write( (int) 0 );
        }
Пример #24
0
		public CorpseEquip( Mobile beholder, Corpse beheld ) : base( 0x89 )
		{
			List<Item> list = beheld.EquipItems;

			int count = list.Count;
			if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
				count++;
			if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
				count++;

			EnsureCapacity( 8 + (count * 5) );

			m_Stream.Write( (int) beheld.Serial );

			for ( int i = 0; i < list.Count; ++i )
			{
				Item item = list[i];

				if ( !item.Deleted && beholder.CanSee( item ) && item.Parent == beheld )
				{
					m_Stream.Write( (byte) (item.Layer + 1) );
					m_Stream.Write( (int) item.Serial );
				}
			}

			if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
			{
				m_Stream.Write( (byte)(Layer.Hair + 1) );
				m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
			}

			if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
			{
				m_Stream.Write( (byte)(Layer.FacialHair + 1) );
				m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
			}

			m_Stream.Write( (byte) Layer.Invalid );
		}
Пример #25
0
				public PartyTrack( Mobile from, Party party ) : base( 0x01, ( ( party.Members.Count - 1 ) * 9 ) + 4 )
				{
					for ( int i = 0; i < party.Members.Count; ++i )
					{
						PartyMemberInfo pmi = (PartyMemberInfo)party.Members[i];

						if ( pmi == null || pmi.Mobile == from )
							continue;

						Mobile mob = pmi.Mobile;

						if ( Utility.InUpdateRange( from, mob ) && from.CanSee( mob ) )
							continue;

						m_Stream.Write( (int) mob.Serial );
						m_Stream.Write( (short) mob.X );
						m_Stream.Write( (short) mob.Y );
						m_Stream.Write( (byte) ( mob.Map == null ? 0 : mob.Map.MapID ) );
					}

					m_Stream.Write( (int) 0 );
				}
			protected override void OnTarget( Mobile from, object o )
			{
				if ( !from.CanSee( o ) )
					from.SendLocalizedMessage( 500237 ); // Target can not be seen.

				if ( o is ACreedGarb )
				{
					ACreedGarb ag = (ACreedGarb)o;

					if ( ag.Level < 3 )
					{
						++ag.Level;
						from.SendMessage( "You upgrade the Assassin's Garb." );
						m_Deed.Delete();
					}
					else
					{
						from.SendMessage( "That is fully upgraded." );
					}
				}
				else
					from.SendMessage( "You cannot use this on that." );
			}
			protected override void OnTarget( Mobile from, object o )
			{
				if ( !from.CanSee( o ) )
					from.SendLocalizedMessage( 500237 ); // Target can not be seen.

				if ( o is NeedleFork )
				{
					NeedleFork needle = (NeedleFork)o;
					needle.Attributes.WeaponDamage += 20;
					needle.WeaponAttributes.HitManaDrain = 25;
					m_Deed.Delete();
				}
				else if ( o is SilverFork )
				{
					SilverFork silver = (SilverFork)o;
					silver.Attributes.WeaponDamage += 20;
					silver.WeaponAttributes.HitLeechStam = 50;
					m_Deed.Delete();
				}
				else if ( o is BistroFork )
				{
					BistroFork bistro = (BistroFork)o;
					bistro.Attributes.WeaponDamage += 20;
					bistro.WeaponAttributes.HitFireball = 25;
					m_Deed.Delete();
				}
				else if ( o is GastroFork )
				{
					GastroFork gastro = (GastroFork)o;
					gastro.Attributes.WeaponDamage += 20;
					gastro.WeaponAttributes.HitLeechMana = 40;
					m_Deed.Delete();
				}
				else
					from.SendMessage( "You cannot use this on that." );
			}
Пример #28
0
		public bool CanInteractWith( Mobile from, bool ownerOnly )
		{
			if ( !from.CanSee( this ) || !Utility.InUpdateRange( from, this ) || !from.CheckAlive() )
				return false;

			if ( ownerOnly )
				return IsOwner( from );

			if ( House != null && House.IsBanned( from ) && !IsOwner( from ) )
			{
				from.SendLocalizedMessage( 1062674 ); // You can't shop from this home as you have been banned from this establishment.
				return false;
			}

			return true;
		}
Пример #29
0
        public static bool CheckDoubleClick(
            this Item item,
            Mobile from,
            bool handle        = true,
            bool allowDead     = false,
            int range          = -1,
            bool packOnly      = false,
            bool inTrade       = false,
            bool inDisplay     = true,
            AccessLevel access = AccessLevel.Player)
        {
            if (item == null || item.Deleted || from == null || from.Deleted)
            {
                return(false);
            }

            if (from.AccessLevel < access)
            {
                if (handle)
                {
                    from.SendMessage("You do not have sufficient access to use this item.");
                }

                return(false);
            }

            if (!from.CanSee(item))
            {
                if (handle)
                {
                    from.SendMessage("This item can't be seen.");
                    item.OnDoubleClickCantSee(from);
                }

                return(false);
            }

            if (!item.IsAccessibleTo(from))
            {
                if (handle)
                {
                    item.OnDoubleClickNotAccessible(from);
                }

                return(false);
            }

            if (item.InSecureTrade && !inTrade)
            {
                if (handle)
                {
                    item.OnDoubleClickSecureTrade(from);
                }

                return(false);
            }

            if (((item.Parent == null && !item.Movable && !item.IsLockedDown && !item.IsSecure && !item.InSecureTrade) ||
                 IsShopItem(item)) && !inDisplay)
            {
                if (handle)
                {
                    from.SendMessage("This item can not be accessed because it is part of a display.");
                }

                return(false);
            }

            if (!from.Alive && !allowDead)
            {
                if (handle)
                {
                    item.OnDoubleClickDead(from);
                }

                return(false);
            }

            if (range >= 0 && !from.InRange(item.GetWorldLocation(), range) && !packOnly)
            {
                if (handle)
                {
                    if (range > 0)
                    {
                        from.SendMessage("You must be within {0:#,0} paces to use this item.", range);
                    }
                    else
                    {
                        from.SendMessage("You must be standing on this item to use it.");
                    }

                    item.OnDoubleClickOutOfRange(from);
                }

                return(false);
            }

            if (packOnly && item.RootParent != from)
            {
                if (handle)
                {
                    // This item must be in your backpack.
                    from.SendLocalizedMessage(1054107);
                }

                return(false);
            }

            return(true);
        }
Пример #30
0
        public static void FlameCross(Mobile from)
        {
            if (!CanUse(from))
            {
                return;
            }

            var point  = from.Location;
            var d      = Direction.North;
            var itemid = 0x3996;
            var map    = from.Map;

            for (var i = 0; i < 8; i++)
            {
                switch (i)
                {
                case 1:
                {
                    d      = Direction.Right;
                    itemid = 0;
                }
                break;

                case 2:
                {
                    d      = Direction.East;
                    itemid = 0x398C;
                }
                break;

                case 3:
                {
                    d      = Direction.Down;
                    itemid = 0;
                }
                break;

                case 4:
                {
                    d      = Direction.South;
                    itemid = 0x3996;
                }
                break;

                case 5:
                {
                    d      = Direction.Left;
                    itemid = 0;
                }
                break;

                case 6:
                {
                    d      = Direction.West;
                    itemid = 0x398C;
                }
                break;

                case 7:
                {
                    d      = Direction.Up;
                    itemid = 0;
                }
                break;
                }

                for (var j = 0; j < 16; j++)
                {
                    IncreaseByDirection(ref point, d);

                    if (from.CanSee(point))
                    {
                        // Damage was 2 on the nightmare which has 30~40% fire res. 4 - 35% = 2.6, close enough for me.
                        if (itemid != 0)
                        {
                            new FireFieldSpell.FireFieldItem(itemid, point, from, from.Map, TimeSpan.FromSeconds(30), 1,
                                                             100);
                        }
                        else
                        {
                            new OtherFireFieldItem(0x3996, point, from, from.Map, TimeSpan.FromSeconds(30), 1, 80);
                            new OtherFireFieldItem(0x398C, point, from, from.Map, TimeSpan.FromSeconds(30), 1, 80);
                        }
                    }
                }

                point = from.Location;
            }

            Effects.PlaySound(point, map, 0x44B);
        }
Пример #31
0
		public virtual bool Validate(Mobile user, bool message)
		{
			if (user == null || user.Deleted || !user.CanSee(this))
			{
				return false;
			}

			if (!IsChildOf(user.Backpack))
			{
				if (message)
				{
					user.SendMessage(SuperGump.DefaultErrorHue, "This codex must be in your backpack to read it.");
				}

				return false;
			}

			if (Count <= 0)
			{
				if (message)
				{
					user.SendMessage(SuperGump.DefaultErrorHue, "This codex does not contain any skills to learn.");
				}

				return false;
			}

			return true;
		}
Пример #32
0
		public override void OnDoubleClick(Mobile from)
		{
			if (from == null)
			{
				return;
			}

			if (!from.CanSee(this))
			{
				OnDoubleClickCantSee(from);
				return;
			}

			if (!IsAccessibleTo(from))
			{
				OnDoubleClickNotAccessible(from);
				return;
			}

			if (this.IsBound() && !this.IsBoundTo(from))
			{
				from.SendMessage(0x22, "That does not belong to you.");
				return;
			}

			base.OnDoubleClick(from);
		}
Пример #33
0
        private static void EraseStickyBar(Mobile target, Mobile toRemove)
        {
            if (target == null || toRemove == null || target.NetState == null || (Utility.InUpdateRange(target, toRemove) && target.CanSee(toRemove)))
            {
                return;
            }

            NetState ns  = target.NetState;
            Point3D  loc = target.Location;

            ns.Send(new MobileIncomingHAX(toRemove, loc));

            Timer.DelayCall(TimeSpan.FromMilliseconds(50),
                            delegate
            {
                if (target == null || toRemove == null || ns == null || (Utility.InUpdateRange(target, toRemove) && target.CanSee(toRemove)))
                {
                    return;
                }

                ns.Send(new DeathAnimation(toRemove, null));
                ns.Send(toRemove.RemovePacket);
            });
        }