public void Target( Mobile tinker, Mobile assembly )
		{
			if ( Deleted || !tinker.CanSee( this ) )
				return;

			int number = -1;

			if ( !tinker.CanSee( assembly ) )
			{
				number = 500237; // Target can not be seen.
			}
			else if ( assembly.Hits == assembly.HitsMax )
			{
				number = 1044281; // That being is not damaged!
			}
			else
			{
				if ( !tinker.BeginAction( typeof( AssemblyRepairKit ) ) )
				{
					number = 500310;// You are busy with something else
				}
				else
				{
					TimeSpan duration = TimeSpan.FromSeconds( 8 );

					InternalTimer t = new InternalTimer( this, tinker, assembly, duration );
					t.Start();

					tinker.SendMessage( "You begin to repair the assembly" );
					return;
				}
			}

			tinker.SendLocalizedMessage( number );
		}
Ejemplo n.º 2
0
		public override void OnHit(Mobile attacker, Mobile defender, int damage)
		{
			ClearCurrentAbility(attacker);

			attacker.SendLocalizedMessage(1060084); // You attack with lightning speed!
			defender.SendLocalizedMessage(1060085); // Your attacker strikes with lightning speed!

			defender.PlaySound(0x3BB);
			defender.FixedEffect(0x37B9, 244, 25);

			// Swing again:

			// If no combatant, wrong map, one of us is a ghost, or cannot see, or deleted, then stop combat
			if (defender == null || defender.Deleted || attacker.Deleted || defender.Map != attacker.Map || !defender.Alive || !attacker.Alive || !attacker.CanSee(defender))
			{
				attacker.Combatant = null;
				return;
			}

			IWeapon weapon = attacker.Weapon;

			if (weapon == null)
				return;

			if (!attacker.InRange(defender, weapon.MaxRange))
				return;

			if (attacker.InLOS(defender))
			{
				BaseWeapon.InDoubleStrike = true;
				attacker.RevealingAction();
				attacker.NextCombatTime = DateTime.Now + weapon.OnSwing(attacker, defender);
				BaseWeapon.InDoubleStrike = false;
			}
		}
Ejemplo n.º 3
0
		private void SendMessageTo( Mobile to, string text, int hue )
		{
			if ( Deleted || !to.CanSee( this ) )
				return;

			to.Send( new Network.UnicodeMessage( Serial, ItemID, Network.MessageType.Regular, hue, 3, "ENU", "", text ) );
		}
Ejemplo n.º 4
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            if (DateTime.UtcNow >= LastSpit && m.InRange(Location, 6) && m.CanSee(this))
            {
                PublicOverheadMessage(MessageType.Emote, 61, true, "*spits*");
                Effects.PlaySound(m.Location, m.Map, 0x19C);

                Timer.DelayCall(
                    TimeSpan.FromMilliseconds(100),
                    () =>
                    {
                            int bloodID = Utility.RandomMinMax(4650, 4655);

                            new MovingEffectInfo(this, m, m.Map, bloodID, 60).MovingImpact(
                                info =>
                                {
                                    var blood = new Blood
                                    {
                                        Name = "slime",
                                        ItemID = bloodID,
                                        Hue = 61
                                    };
                                    blood.MoveToWorld(info.Target.Location, info.Map);

                                    Effects.PlaySound(info.Target, info.Map, 0x028);
                                });
                    });
                LastSpit = DateTime.UtcNow + TimeSpan.FromSeconds(10);
            }
            base.OnMovement(m, oldLocation);
        }
		private void SendMessageTo( Mobile to, int number, int hue )
		{
			if ( Deleted || !to.CanSee( this ) )
				return;

			to.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, hue, 3, number, "", "" ) );
		}
Ejemplo n.º 6
0
        private void SendMessageTo(Mobile to, string text, int hue)
        {
            if (Deleted || !to.CanSee(this))
                return;

            to.Send(new UnicodeMessage(Serial, ItemID, MessageType.Regular, hue, 3, to.Language, "", text));
        }
Ejemplo n.º 7
0
        private static void Grab_OnTarget(Mobile from, object target)
        {
            if (!from.Alive || !from.CanSee(target) || !(target is Container))
                return;

            bool canLoot = false;
            Container cont = (Container)target;

            if (target is Corpse)
            {
                Corpse c = (Corpse)target;

                if (c.Owner == null || c.Killer == null) //unable to determine cause of death
                {
                    canLoot = true;
                }

                if (c.Owner is PlayerMobile)
                {
                    canLoot = false;
                    from.SendMessage("You cannot loot a player corpse.");
                }

                else if (c.Owner is BaseCreature && !(c.Owner is PlayerMobile)) //it's a monster corpse: do you have looting rights?
                {
                    BaseCreature bc = (BaseCreature)c.Owner;
                    List<DamageStore> lootingRights = BaseCreature.GetLootingRights(bc.DamageEntries, bc.HitsMax);
                    Mobile master = bc.GetMaster();

                    if (master != null && master == from) //if it's your pet, you always have the right
                        canLoot = true;

                    for (int i = 0; !canLoot && i < lootingRights.Count; i++)
                    {
                        if (lootingRights[i].m_Mobile != from)
                            continue;

                        canLoot = lootingRights[i].m_HasRight;
                    }

                    if (!canLoot)
                        from.SendMessage("You do not have the right to loot from that corpse.");
                }

                else
                {
                    canLoot = false;
                    from.SendMessage("You cannot loot that corpse.");
                }
            }
            else
            {
                canLoot = false;
                from.SendMessage("You cannot loot that!");
            }

            if (canLoot)
                GrabLoot(from, cont);
        }
Ejemplo n.º 8
0
        public override bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;

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

            return true;
        }
Ejemplo n.º 9
0
		public bool Scissor( Mobile from, Scissors scissors )
		{
			if ( Deleted || !from.CanSee( this ) ) return false;

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

			return true;
		}
Ejemplo n.º 10
0
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (this.Deleted || !from.CanSee(this))
                return false;

            base.ScissorHelper(from, new Bone(), Utility.RandomMinMax(3, 5));

            return true;
        }
Ejemplo n.º 11
0
        public bool Scissor(Mobile from, Scissors scissors)
        {
            if (this.Deleted || !from.CanSee(this))
                return false;

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

            return true;
        }
Ejemplo n.º 12
0
		public override void OnSingleClick( Mobile from )
		{
			base.OnSingleClick( from );

			if ( Deleted || !from.CanSee( this ) )
				return;

			//if ( m_Account == null || from.Account != m_Account )
			LabelTo( from, 38, 1149839 ); // * Non-Transferable Account Bound Item *
		}
Ejemplo n.º 13
0
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;

            Cloth c = new Cloth();
            c.Hue = this.Hue;
            base.ScissorHelper( from, c, 50 );

            return true;
        }
Ejemplo n.º 14
0
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) )
                return false;

            from.SendLocalizedMessage( 1008117 ); // You cut the material into bandages and place them in your backpack.

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

            return true;
        }
Ejemplo n.º 15
0
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;

            //base.ScissorHelper( from, new Bandage(), 1 );
            this.Consume( 1 );
            Bandage give = new Bandage();
            give.Hue = this.Hue;
            from.AddToBackpack( give );

            return true;
        }
Ejemplo n.º 16
0
        public override void OnStatsQuery(Mobile from)
        {
            if (from.Map == 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 MobileStatus(from, this));
            }
        }
Ejemplo n.º 17
0
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;

            if ( !IsChildOf ( from.Backpack ) )
            {
                from.SendLocalizedMessage ( 502437 ); // Items you wish to cut must be in your backpack
                return false;
            }

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

            return true;
        }
Ejemplo n.º 18
0
        public static bool CheckCombat( Mobile m, int range )
        {
            if ( m.Combatant != null && !m.Combatant.Deleted && m.Combatant.Alive && m.CanSee( m.Combatant ) && m.InRange( m.Combatant, (int)(range*1.5) ) && m.Combatant.InLOS( m ) )
                return true;

            IPooledEnumerable eable = m.GetMobilesInRange( range );
            foreach ( Mobile check in eable )
            {
                if ( check.Combatant == m && check.InLOS( m ) )
                {
                    eable.Free();
                    return true;
                }
            }

            eable.Free();
            return false;
        }
Ejemplo n.º 19
0
		public CorpseEquip(Mobile beholder, Corpse beheld)
			: base(0x89)
		{
			var 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(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(item.Serial);
				}
			}

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

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

			m_Stream.Write((byte)Layer.Invalid);
		}
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) )
                return false;

            int amount = RandomAmount();

            Item bones = new Bone( amount );
            from.PlaySound( 0x21B );

            if ( from.Backpack != null && from.Backpack.TryDropItem( from, bones, false ) )
            {
                from.SendLocalizedMessage( 1008123 ); // You cut the material and place it into your backpack.
                Delete();
            }
            else
                base.ScissorHelper( from, bones, 1 );

            return true;
        }
Ejemplo n.º 21
0
			protected override void OnTarget( Mobile from, object o )
			{
                IEntity entity = o as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner))
                {
                    return;
                }
                if ( o is Mobile )
				{
					Mobile m = (Mobile)o;
					BaseCreature bc = m as BaseCreature;

					if ( !from.CanSee( m ) )
					{
						from.SendLocalizedMessage( 500237 ); // Target can not be seen.
					}
					else if ( bc == null || !bc.IsDispellable )
					{
						from.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
					}
					else if ( m_Owner.CheckHSequence( m ) )
					{
						m_Owner.Caster.DoHarmful( m );
						SpellHelper.Turn( from, m );

						double dispelChance = (50.0 + ((100 * (from.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100;

						if ( dispelChance > Utility.RandomDouble() )
						{
							Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
							Effects.PlaySound( m, m.Map, 0x201 );

							m.Delete();
						}
						else
						{
							m.FixedEffect( 0x3779, 10, 20 );
							from.SendLocalizedMessage( 1010084 ); // The creature resisted the attempt to dispel it!
						}
					}
				}
			}
Ejemplo n.º 22
0
            public BBContent6017(Mobile beholder, Item beheld) : base(0x3C)
            {
                List<Item> items = new List<Item>(beheld.Items);
                items = items.Where(x => x is BountyMessage).OrderByDescending(x => ((BountyMessage)x).BountyAmount).ToList();
                int count = items.Count;

                this.EnsureCapacity(5 + (count * 20));

                long pos = m_Stream.Position;

                int written = 0;

                m_Stream.Write((ushort)0);

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

                    if (!child.Deleted && beholder.CanSee(child))
                    {
                        Point3D loc = child.Location;

                        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)loc.X);
                        m_Stream.Write((short)loc.Y);
                        m_Stream.Write((byte)0); // Grid Location?
                        m_Stream.Write((int)beheld.Serial);
                        m_Stream.Write((ushort)(child.Hue));

                        ++written;
                    }
                }

                m_Stream.Seek(pos, SeekOrigin.Begin);
                m_Stream.Write((ushort)written);
            }
Ejemplo n.º 23
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 );
				}
Ejemplo n.º 24
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;
                    BaseCreature bc = m as BaseCreature;

                    if (!from.CanSee(m))
                    {
                        from.SendLocalizedMessage(500237); // Target can not be seen.
                    }
                    else if (bc == null || !bc.IsDispellable)
                    {
                        from.SendLocalizedMessage(1005049); // That cannot be dispelled.
                    }
                    else if (this.m_Owner.CheckHSequence(m))
                    {
                        SpellHelper.Turn(from, m);

                        double dispelChance = (50.0 + ((100 * (from.Skills.Magery.Value - bc.GetDispelDifficulty())) / (bc.DispelFocus * 2))) / 100;

                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);

                            m.Delete();
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                }
            }
Ejemplo n.º 25
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;
            }

            List <Mobile>     targets = new List <Mobile>();
            IPooledEnumerable eable   = defender.GetMobilesInRange(5);

            foreach (Mobile m in eable)
            {
                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange) || !attacker.InLOS(m))
                    {
                        continue;
                    }

                    targets.Add(m);
                }
            }

            eable.Free();
            defender.BoltEffect(0);

            if (targets.Count > 0)
            {
                while (targets.Count > 2)
                {
                    targets.Remove(targets[Utility.Random(targets.Count)]);
                }

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

                    m.BoltEffect(0);

                    AOS.Damage(m, attacker, Utility.RandomMinMax(29, 40), 0, 0, 0, 0, 100);
                }
            }

            ColUtility.Free(targets);
        }
Ejemplo n.º 26
0
//		public override int BaseMana{ get{ return 15; } }

        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(weapon.MaxRange))
            {
                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) && (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);
                    }
                }
            }
        }
Ejemplo n.º 27
0
        public void Invoke(Mobile from, object targeted)
        {
            CancelTimeout();
            from.ClearTarget();

            if (from.Deleted)
            {
                OnTargetCancel(from, TargetCancelType.Canceled);
                OnTargetFinish(from);
                return;
            }

            Point3D loc;
            Map     map;

            if (targeted is LandTarget)
            {
                loc = ((LandTarget)targeted).Location;
                map = from.Map;
            }
            else if (targeted is StaticTarget)
            {
                loc = ((StaticTarget)targeted).Location;
                map = from.Map;
            }
            else if (targeted is Mobile)
            {
                if (((Mobile)targeted).Deleted)
                {
                    OnTargetDeleted(from, targeted);
                    OnTargetFinish(from);
                    return;
                }
                else if (!((Mobile)targeted).CanTarget)
                {
                    OnTargetUntargetable(from, targeted);
                    OnTargetFinish(from);
                    return;
                }

                loc = ((Mobile)targeted).Location;
                map = ((Mobile)targeted).Map;
            }
            else if (targeted is Item)
            {
                Item item = (Item)targeted;

                if (item.Deleted)
                {
                    OnTargetDeleted(from, targeted);
                    OnTargetFinish(from);
                    return;
                }
                else if (!item.CanTarget)
                {
                    OnTargetUntargetable(from, targeted);
                    OnTargetFinish(from);
                    return;
                }

                object root = item.RootParent;

                if (!m_AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player)
                {
                    OnNonlocalTarget(from, targeted);
                    OnTargetFinish(from);
                    return;
                }

                loc = item.GetWorldLocation();
                map = item.Map;
            }
            else
            {
                OnTargetCancel(from, TargetCancelType.Canceled);
                OnTargetFinish(from);
                return;
            }

            if (map == null || map != from.Map || (m_Range != -1 && !from.InRange(loc, m_Range)))
            {
                OnTargetOutOfRange(from, targeted);
            }
            else
            {
                if (!from.CanSee(targeted))
                {
                    OnCantSeeTarget(from, targeted);
                }
                else if (m_CheckLOS && !from.InLOS(targeted))
                {
                    OnTargetOutOfLOS(from, targeted);
                }
                else if (targeted is Item && ((Item)targeted).InSecureTrade)
                {
                    OnTargetInSecureTrade(from, targeted);
                }
                else if (targeted is Item && !((Item)targeted).IsAccessibleTo(from))
                {
                    OnTargetNotAccessible(from, targeted);
                }
                else if (targeted is Item && !((Item)targeted).CheckTarget(from, this, targeted))
                {
                    OnTargetUntargetable(from, targeted);
                }
                else if (targeted is Mobile && !((Mobile)targeted).CheckTarget(from, this, targeted))
                {
                    OnTargetUntargetable(from, targeted);
                }
                else if (from.Region.OnTarget(from, this, targeted))
                {
                    OnTarget(from, targeted);
                }
            }

            OnTargetFinish(from);
        }
Ejemplo n.º 28
0
        public MobileIncoming( Mobile beholder, Mobile beheld )
            : base(0x78)
        {
            m_Beheld = beheld;
            ++m_Version;

            ArrayList eq = beheld.Items;
            int count = eq.Count;

            this.EnsureCapacity( 23 + (count * 9) );

            int hue = beheld.Hue;

            if ( beheld.SolidHueOverride >= 0 )
                hue = beheld.SolidHueOverride;

            m_Stream.Write( (int) beheld.Serial );
            m_Stream.Write( (short) beheld.Body );
            m_Stream.Write( (short) beheld.X );
            m_Stream.Write( (short) beheld.Y );
            m_Stream.Write( (sbyte) beheld.Z );
            m_Stream.Write( (byte) beheld.Direction );
            m_Stream.Write( (short) hue );
            m_Stream.Write( (byte) beheld.GetPacketFlags() );
            m_Stream.Write( (byte) Notoriety.Compute( beholder, beheld ) );

            for ( int i = 0; i < count; ++i )
            {
                Item item = (Item)eq[i];

                byte layer = (byte) item.Layer;

                if ( !item.Deleted && beholder.CanSee( item ) && m_DupedLayers[layer] != m_Version )
                {
                    m_DupedLayers[layer] = m_Version;

                    hue = item.Hue;

                    if ( beheld.SolidHueOverride >= 0 )
                        hue = beheld.SolidHueOverride;

                    int itemID = item.ItemID & 0x3FFF;
                    bool writeHue = ( hue != 0 );

                    if ( writeHue )
                        itemID |= 0x8000;

                    m_Stream.Write( (int) item.Serial );
                    m_Stream.Write( (short) itemID );
                    m_Stream.Write( (byte) layer );

                    if ( writeHue )
                        m_Stream.Write( (short) hue );
                }
            }

            m_Stream.Write( (int) 0 ); // terminate
        }
Ejemplo n.º 29
0
        public void DoubleClick(Mobile from)
        {
            Mobile m_Player = from as PlayerMobile;

            if (!m_Player.CanSee(this) || !m_Player.InLOS(this))
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are too far from the bed!");
                return;
            }

            if (m_Player.CantWalk && !m_Sleeping)
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are already sleeping somewhere!");
            }
            else
            {
                if (!m_Sleeping)
                {
                    m_Owner = m_Player;

                    m_Player.Hidden    = true;
                    m_Player.Squelched = true;
                    m_Player.Frozen    = true;
                    m_wakeup           = 0;
                    m_Player.CantWalk  = true;
                    m_Sleeping         = true;
                    m_Player.Blessed   = true;

                    m_SleepingBodies = new SleepingBodies(m_Player, false, false);

                    #region Sleeping Body Position

                    Point3D m_Location = new Point3D(this.Location.X, this.Location.Y + 1, this.Location.Z + 9);

                    #endregion

                    m_SleepingBodies.Direction = Direction.South;
                    m_SleepingBodies.MoveToWorld(m_Location, this.Map);
                }
                else
                {
                    if (m_Owner == m_Player)
                    {
                        m_Player.Hidden    = false;
                        m_Player.Squelched = false;
                        m_Player.Frozen    = false;
                        m_wakeup           = 0;
                        m_Player.CantWalk  = false;
                        m_Sleeping         = false;
                        m_Player.Blessed   = false;

                        if (m_SleepingBodies != null)
                        {
                            m_SleepingBodies.Delete();
                        }
                        m_SleepingBodies = null;

                        switch (Utility.RandomMinMax(1, 3))
                        {
                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You wake up and feel strong and well rested.");
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You spring out of bed, ready for another day!");
                            break;

                        case 3:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You fall out of bed and crack your knee on the wooden bedframe!");
                            m_Player.Hits = m_Player.Hits - 25;
                            break;
                        }
                    }
                    else
                    {
                        switch (m_wakeup)
                        {
                        case 0:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "Shhh, don't wake them up. They really need their beauty rest!");
                            m_wakeup = m_wakeup + 1;
                            break;

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

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, 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;
                        }
                    }
                }
            }
        }
Ejemplo n.º 30
0
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                Map map = m_Owner.Map;

                if (map == null)
                {
                    return;
                }

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

                Mobile toTeleport = null;

                foreach (Mobile m in m_Owner.GetMobilesInRange(BlastRange))
                {
                    if (m != m_Owner && m.IsPlayer() && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m))
                    {
                        if (m is ShadowDweller)
                        {
                            continue;
                        }

                        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;
                }
            }
Ejemplo n.º 31
0
        public void OnTarget(Mobile from, object targeted)
        {
            if (this.Deleted || this.Amount <= 0)
            {
                return;
            }

            Mobile targ = targeted as Mobile;

            if (from.NextSkillTime > DateTime.Now)
            {
                from.SendSkillMessage();                 // You must wait...
            }
            else if (targ == null || targ.Deleted || !targ.Alive || !(targ.Body.IsHuman || targ.Body.IsAnimal || targ.Body.IsSea || (targ is BaseCreature && ((BaseCreature)targ).Controled && !((BaseCreature)targ).Summoned)))
            {
                // you can heal anything tamable... I guess.
                from.SendLocalizedMessage(500951);                   // You cannot heal that.
            }
            else if (!from.InRange(targ, 3))
            {
                from.SendLocalizedMessage(500295);                     // You are too far away to do that.
            }
            else if (Notoriety.Compute(from, targ) == Notoriety.Enemy) // || Server.Misc.NotorietyHandlers.CheckAggressor( from.Aggressors, targ ) || Server.Misc.NotorietyHandlers.CheckAggressed( from.Aggressed, targ ) )
            {
                from.SendAsciiMessage("You cannot heal them right now.");
            }
            else if (!from.CanSee(targ) || !from.InLOS(targ))
            {
                from.SendAsciiMessage("You can't see that.");
            }
            else if (targ.Hits >= targ.HitsMax)
            {
                from.SendLocalizedMessage(500955);                   // That being is not damaged!
            }
            else if (!targ.CanBeginAction(typeof(Bandage)) || !from.CanBeBeneficial(targ, true, true))
            {
                from.SendAsciiMessage("This being cannot be newly bandaged yet.");
            }
            else
            {
                from.DoBeneficial(targ);
                from.RevealingAction();

                this.Consume();

                int       damage = targ.HitsMax - targ.Hits;
                int       sk     = damage * 100 / targ.HitsMax;
                int       healed = 1;
                SkillName skill  = GetSkillFor(targ);
                if (from.CheckSkill(skill, sk - 25.0, sk + 25.0))
                {
                    targ.PlaySound(0x57);

                    double scale = (75.0 + from.Skills[skill].Value - sk) / 100.0;
                    if (scale > 1.0)
                    {
                        scale = 1.0;
                    }
                    else if (scale < 0.5)
                    {
                        scale = 0.5;
                    }
                    healed = (int)(damage * scale);

                    if (healed < 1)
                    {
                        healed = 1;
                    }
                    else if (healed > 100)
                    {
                        healed = 100;
                    }
                }

                targ.Hits += healed;
                if (healed > 1)
                {
                    from.SendAsciiMessage("You apply the bandages.");
                }
                else
                {
                    from.SendAsciiMessage("You apply the bandages, but they barely help.");
                }

                targ.BeginAction(typeof(Bandage));
                new BandageExpire(targ).Start();
            }
        }
Ejemplo n.º 32
0
        private static void Mobile_LocationChanged(Mobile from, LocationChangedEventArgs args)
        {
            Point3D oldLocation = args.OldLocation;
            Point3D newLocation = args.NewLocation;
            bool    isTeleport  = args.IsTeleport;

            Map map = from.Map;

            if (map != null)
            {
                // First, send a remove message to everyone who can no longer see us. (inOldRange && !inNewRange)
                Packet removeThis = null;

                foreach (GameClient ns in map.GetClientsInRange(oldLocation))
                {
                    if (ns != from.Client && !ns.Mobile.InUpdateRange(newLocation))
                    {
                        if (removeThis == null)
                        {
                            removeThis = from.RemovePacket;
                        }

                        ns.Send(removeThis);
                    }
                }

                GameClient ourState = from.Client;

                // Check to see if we are attached to a client
                if (ourState != null)
                {
                    // We are attached to a client, so it's a bit more complex. We need to send new items and people to ourself, and ourself to other clients
                    foreach (object o in map.GetObjectsInRange(newLocation, Mobile.GlobalMaxUpdateRange))
                    {
                        if (o is Item)
                        {
                            Item item = (Item)o;

                            if (!item.InUpdateRange(oldLocation) && item.InUpdateRange(newLocation) && from.CanSee(item))
                            {
                                item.SendInfoTo(ourState);
                            }
                        }
                        else if (o != from && o is Mobile)
                        {
                            Mobile m = (Mobile)o;

                            if (!m.InUpdateRange(newLocation))
                            {
                                continue;
                            }

                            bool inOldRange = m.InUpdateRange(oldLocation);

                            if ((isTeleport || !inOldRange) && m.Client != null && m.CanSee(from))
                            {
                                m.Client.Send(new MobileIncoming(m, from));

                                if (from.IsDeadBondedPet)
                                {
                                    m.Client.Send(new BondedStatus(0, from.Serial, 1));
                                }

                                if (ObjectPropertyListPacket.Enabled)
                                {
                                    m.Client.Send(from.OPLPacket);
                                }
                            }

                            if (!inOldRange && from.CanSee(m))
                            {
                                ourState.Send(new MobileIncoming(from, m));

                                if (m.IsDeadBondedPet)
                                {
                                    ourState.Send(new BondedStatus(0, m.Serial, 1));
                                }

                                if (ObjectPropertyListPacket.Enabled)
                                {
                                    ourState.Send(m.OPLPacket);
                                }
                            }
                        }
                    }
                }
                else
                {
                    // We're not attached to a client, so simply send an Incoming
                    foreach (GameClient ns in map.GetClientsInRange(newLocation))
                    {
                        if ((isTeleport || !ns.Mobile.InUpdateRange(oldLocation)) && ns.Mobile.CanSee(from))
                        {
                            ns.Send(new MobileIncoming(ns.Mobile, from));

                            if (from.IsDeadBondedPet)
                            {
                                ns.Send(new BondedStatus(0, from.Serial, 1));
                            }

                            if (ObjectPropertyListPacket.Enabled)
                            {
                                ns.Send(from.OPLPacket);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 33
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                       // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                       // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0)
                {
                    m_Thief.SendLocalizedMessage(502706);                       // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                       // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                       // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                       // Your backpack can't hold anything else.
                }
                else if (toSteal.Parent == null || !toSteal.Movable)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                       // You must be standing next to an item to steal it.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                       // You cannot steal items which are equiped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704);                       // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)(m_Thief.Skills[SkillName.Stealing].Value / 10.0 / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                               // You succesfully steal the item.
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                               // You fail to steal the item.
                        }

                        caught = m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150);
                    }
                }

                return(stolen);
            }
Ejemplo n.º 34
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;
            }

            ArrayList list = new ArrayList();

            defender.PlaySound(1471);
            defender.BoltEffect(0);
            attacker.SendMessage("Your lightning arrow strikes {0}!", defender.Name);
            defender.SendMessage("Lightning arcs from {0}{1} arrow onto you!", attacker.Name, attacker.Name.ToLower().EndsWith("s") ? "'" : "'s");

            foreach (Mobile m in defender.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            ArrayList targets = new ArrayList();

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

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

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

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }

            if (targets.Count > 0)
            {
                double damageBonus = 1.0 + Math.Pow(1, 2) / 100;

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

                    attacker.SendMessage("Lightning arcs from your arrow onto {0}!", m.Name);
                    m.SendMessage("Lightning arcs from {0}{1} arrow onto you!", attacker.Name, attacker.Name.ToLower().EndsWith("s") ? "'" : "'s");
                    m.PlaySound(1471);
                    m.BoltEffect(0);
                    weapon.OnHit(attacker, m, damageBonus);
                }
            }
        }
Ejemplo n.º 35
0
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                Map map = m_Owner.Map;

                if (map == null)
                {
                    return;
                }

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

                Mobile toTeleport = null;

                foreach (Mobile m in m_Owner.GetMobilesInRange(10))
                {
                    if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m) && m.AccessLevel == AccessLevel.Player && ((BaseCreature)m_Owner).IsEnemy(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();

                    m.PlaySound(0x58D);

                    m_Owner.Combatant = toTeleport;

                    BaseCreature.TeleportPets(m, m.Location, m.Map, false);
                }
            }
Ejemplo n.º 36
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                StealableArtifactsSpawner.StealableInstance si = null;

                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = toSteal is AddonComponent?StealableArtifactsSpawner.GetStealableInstance(((AddonComponent)toSteal).Addon) : StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0)
                {
                    m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237); // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else.
                }
                else if (toSteal is VvVSigil && ViceVsVirtueSystem.Instance != null)
                {
                    VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry <VvVPlayerEntry>(m_Thief);

                    VvVSigil sig = (VvVSigil)toSteal;

                    if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                    {
                        m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it.
                    }
                    else if (root != null)                    // not on the ground
                    {
                        m_Thief.SendLocalizedMessage(502710); // You can't steal that!
                    }
                    else if (entry != null)
                    {
                        if (!m_Thief.CanBeginAction(typeof(IncognitoSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010581); //	You cannot steal the sigil when you are incognito
                        }
                        else if (DisguiseTimers.IsDisguised(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1010583); //	You cannot steal the sigil while disguised
                        }
                        else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010582); //	You cannot steal the sigil while polymorphed
                        }
                        else if (TransformationSpellHelper.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form.
                        }
                        else if (AnimalForm.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1063222); // You cannot steal the sigil while mimicking an animal.
                        }
                        else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 100.0, 120.0))
                        {
                            if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true))
                            {
                                m_Thief.SendLocalizedMessage(1010259); //	The sigil has gone home because your backpack is full
                            }
                            else
                            {
                                m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                sig.OnStolen(entry);

                                return(sig);
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(1005594); //	You do not have enough skill to steal the sigil
                        }
                    }
                    else
                    {
                        m_Thief.SendLocalizedMessage(1155415); //	Only participants in Vice vs Virtue may use this item.
                    }
                }
                else if (si == null && (toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal))
                {
                    m_Thief.SendLocalizedMessage(502710); // You can't steal that!
                }
                else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal))
                {
                    m_Thief.SendLocalizedMessage(502710); // You can't steal that!
                }
                else if (si == null && toSteal is Container && !ItemFlags.GetStealable(toSteal))
                {
                    m_Thief.SendLocalizedMessage(502710); // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0)
                {
                    m_Thief.SendLocalizedMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).IsStaff())
                {
                    m_Thief.SendLocalizedMessage(502710); // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse || !CheckHouse(toSteal, root))
                {
                    m_Thief.SendLocalizedMessage(502710); // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        // Non-movable stealable (not in fillable container) items cannot result in the stealer getting caught
                        if (stolen != null && (root is FillableContainer || stolen.Movable))
                        {
                            double skillValue = m_Thief.Skills[SkillName.Stealing].Value;

                            if (root is FillableContainer)
                            {
                                caught = (Utility.Random((int)(skillValue / 2.5)) == 0); // 1 of 48 chance at 120
                            }
                            else
                            {
                                caught = (skillValue < Utility.Random(150));
                            }
                        }
                        else
                        {
                            caught = false;
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item.

                            ItemFlags.SetTaken(stolen, true);
                            ItemFlags.SetStealable(stolen, false);
                            stolen.Movable = true;

                            InvokeItemStoken(new ItemStolenEventArgs(stolen, m_Thief));

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723); // You fail to steal the item.
                        }
                    }
                }

                return(stolen);
            }
Ejemplo n.º 37
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                /// WIZARD WANTS THEM TO BE ABLE TO STEAL THE DUNGEON CHESTS ///
                if (toSteal is DungeonChest)
                {
                    DungeonChest dBox = (DungeonChest)toSteal;

                    if (m_Thief.Blessed)
                    {
                        m_Thief.SendMessage("You cannot steal while in this state.");
                    }
                    else if (dBox.ItemID == 0x3582 || dBox.ItemID == 0x3583 || dBox.ItemID == 0x35AD || dBox.ItemID == 0x3868 || (dBox.ItemID >= 0x4B5A && dBox.ItemID <= 0x4BAB) || (dBox.ItemID >= 0xECA && dBox.ItemID <= 0xED2))
                    {
                        m_Thief.SendMessage("It is best to leave the dead be.");
                    }
                    else if (dBox.ItemID == 0x3564 || dBox.ItemID == 0x3565)
                    {
                        m_Thief.SendMessage("You have not use for this broken golem thing.");
                    }
                    else
                    {
                        if (m_Thief.CheckSkill(SkillName.Stealing, 0, 125))
                        {
                            m_Thief.SendMessage("You dump out the entire contents while stealing the item.");
                            StolenChest sBox   = new StolenChest();
                            int         dValue = 0;

                            dValue               = (dBox.ContainerLevel + 1) * 50;
                            sBox.ContainerID     = dBox.ContainerID;
                            sBox.ContainerGump   = dBox.ContainerGump;
                            sBox.ContainerHue    = dBox.ContainerHue;
                            sBox.ContainerFlip   = dBox.ContainerFlip;
                            sBox.ContainerWeight = dBox.ContainerWeight;
                            sBox.ContainerName   = dBox.ContainerName;

                            sBox.ContainerValue = dValue;

                            Item iBox = (Item)sBox;

                            iBox.ItemID = sBox.ContainerID;
                            iBox.Hue    = sBox.ContainerHue;
                            iBox.Weight = sBox.ContainerWeight;
                            iBox.Name   = sBox.ContainerName;

                            Bag oBox = (Bag)iBox;

                            oBox.GumpID = sBox.ContainerGump;

                            m_Thief.AddToBackpack(oBox);

                            Titles.AwardFame(m_Thief, dValue, true);
                            Titles.AwardKarma(m_Thief, -dValue, true);

                            LoggingFunctions.LogGeneric(m_Thief, "has stolen a " + iBox.Name + "");
                        }
                        else
                        {
                            m_Thief.SendMessage("You were not quick enough to steal it.");
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED
                        }

                        Item spawnBox = new DungeonChestSpawner(dBox.ContainerLevel, (double)(Utility.RandomMinMax(45, 105)));
                        spawnBox.MoveToWorld(new Point3D(dBox.X, dBox.Y, dBox.Z), dBox.Map);

                        toSteal.Delete();
                    }
                }
                else if (toSteal is LandChest)
                {
                    m_Thief.SendMessage("It is best to leave the dead be.");
                }
                else if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendMessage("You cannot be wielding a weapon when trying to steal something.");
                }
                else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                       // You must be in the thieves guild to steal from other players.
                }
                else if (toSteal is Coffer)
                {
                    Coffer coffer = (Coffer)toSteal;
                    bool   Pilfer = true;

                    if (m_Thief.Backpack.FindItemByType(typeof(ThiefNote)) != null)
                    {
                        Item      mail     = m_Thief.Backpack.FindItemByType(typeof(ThiefNote));
                        ThiefNote envelope = (ThiefNote)mail;

                        if (envelope.NoteOwner == m_Thief)
                        {
                            if (envelope.NoteItemArea == Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) && envelope.NoteItemGot == 0 && envelope.NoteItemCategory == coffer.CofferType)
                            {
                                envelope.NoteItemGot = 1;
                                m_Thief.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found " + envelope.NoteItem + ".");
                                m_Thief.SendSound(0x3D);
                                envelope.InvalidateProperties();
                                Pilfer = false;
                            }
                        }
                    }

                    if (Pilfer)
                    {
                        if (coffer.CofferGold < 1)
                        {
                            m_Thief.SendMessage("There seems to be no gold in the coffer.");
                        }
                        else if (m_Thief.CheckSkill(SkillName.Stealing, 0, 100))
                        {
                            m_Thief.SendMessage("You slip out " + coffer.CofferGold + " gold from the coffer.");
                            m_Thief.SendSound(0x2E6);
                            m_Thief.AddToBackpack(new Gold(coffer.CofferGold));

                            Titles.AwardFame(m_Thief, (coffer.CofferGold * 2), true);
                            Titles.AwardKarma(m_Thief, -(coffer.CofferGold * 2), true);

                            coffer.CofferRobbed = 1;
                            coffer.CofferRobber = m_Thief.Name + " the " + Server.Misc.GetPlayerInfo.GetSkillTitle(m_Thief);
                            coffer.CofferGold   = 0;

                            LoggingFunctions.LogGeneric(m_Thief, "has stolen " + coffer.CofferGold + " gold from a " + coffer.CofferType + " in " + Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) + "");
                        }
                        else
                        {
                            m_Thief.SendMessage("You fingers slip, causing you to get noticed!");
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED

                            if (!m_Thief.CheckSkill(SkillName.Snooping, 0, 150))
                            {
                                List <Mobile> spotters = new List <Mobile>();
                                foreach (Mobile m in m_Thief.GetMobilesInRange(10))
                                {
                                    if (m is BaseVendor && m.CanSee(m_Thief) && m.InLOS(m_Thief))
                                    {
                                        m_Thief.CriminalAction(false);
                                        m.PublicOverheadMessage(MessageType.Regular, 0, false, string.Format("Stop! Thief!"));
                                    }
                                }
                            }
                        }
                    }
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                       // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                       // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                       // Your backpack can't hold anything else.
                }
                else if (si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (Core.AOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                       // You must be standing next to an item to steal it.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0)
                {
                    m_Thief.SendLocalizedMessage(1060025, "", 0x66D);                       // You're not skilled enough to attempt the theft of this item.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                       // You cannot steal items which are equipped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704);                       // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                               // You successfully steal the item.

                            Titles.AwardKarma(m_Thief, -1000, true);

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                  // You fail to steal the item.
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED
                        }

                        caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }
Ejemplo n.º 38
0
        public void DoMeteorSwarm(Mobile attacker, Mobile defender)
        {
            if (!attacker.CanBeHarmful(defender, false))
            {
                return;
            }

            IPoint3D p = defender.Location;

            if (!attacker.CanSee(p))
            {
                attacker.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, attacker))
            {
                SpellHelper.Turn(attacker, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

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

                Map map = attacker.Map;

                bool playerVsPlayer = false;

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

                    foreach (Mobile m in eable)
                    {
                        if (attacker != m && SpellHelper.ValidIndirectTarget(attacker, m) && attacker.CanBeHarmful(m, false))
                        {
                            if (Core.AOS && !attacker.InLOS(m))
                            {
                                continue;
                            }

                            targets.Add(m);

                            if (m.Player)
                            {
                                playerVsPlayer = true;
                            }
                        }
                    }

                    eable.Free();
                }

                double damage;

                damage = Utility.Random(37, 33);

                if (targets.Count > 0)
                {
                    Effects.PlaySound(p, attacker.Map, 0x160);

                    if (targets.Count > 2)
                    {
                        damage = (damage * 2) / targets.Count;
                    }

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

                        double toDeal = damage;

                        attacker.DoHarmful(m);
                        SpellHelper.Damage(TimeSpan.FromSeconds(1.0), m, attacker, toDeal, 0, 100, 0, 0, 0);

                        attacker.MovingParticles(m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                    }
                }
                SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, 1, 0, 100, 0, 0, 0);
            }
        }
Ejemplo n.º 39
0
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                Map map = m_Owner.Map;

                if (map == null)
                {
                    return;
                }

                if (0.25 < 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), 0x3709, 1, 30, 9904, 1108);
                    Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3709, 1, 30, 9904, 1108);

                    m.PlaySound(0x1FE);

                    m_Owner.Combatant = toTeleport;
                    m_Owner.PrivateOverheadMessage(MessageType.Regular, 1153, false, "AHHHHH!!!! Help me!!!", m_Owner.NetState);
                }
            }
Ejemplo n.º 40
0
        private static void EventSink_OpenDoorMacroUsed(OpenDoorMacroEventArgs args)
        {
            Mobile m = args.Mobile;

            if (m.Map != null)
            {
                int x = m.X, y = m.Y;

                switch (m.Direction & Direction.Mask)
                {
                case Direction.North: --y; break;

                case Direction.Right: ++x; --y; break;

                case Direction.East: ++x; break;

                case Direction.Down: ++x; ++y; break;

                case Direction.South: ++y; break;

                case Direction.Left: --x; ++y; break;

                case Direction.West: --x; break;

                case Direction.Up: --x; --y; break;
                }

                Sector sector = m.Map.GetSector(x, y);

                foreach (Item item in sector.Items)
                {
                    if (item.Location.X == x && item.Location.Y == y && (item.Z + item.ItemData.Height) > m.Z && (m.Z + 16) > item.Z && item is BaseDoor && m.CanSee(item) && m.InLOS(item))
                    {
                        if (m.CheckAlive())
                        {
                            m.SendLocalizedMessage(500024); // Opening door...
                            item.OnDoubleClick(m);
                        }

                        break;
                    }
                }
            }
        }
Ejemplo n.º 41
0
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                var map = m_Owner.Map;

                if (map == null)
                {
                    return;
                }

                if (Utility.RandomDouble() > 0.25)
                {
                    return;
                }

                var toTeleport = m_Owner.GetMobilesInRange(16)
                                 .FirstOrDefault(mob => mob != m_Owner && mob.Player && m_Owner.CanBeHarmful(mob) && m_Owner.CanSee(mob));

                if (toTeleport == null)
                {
                    return;
                }

                var offset = Utility.Random(8) * 2;

                var to = m_Owner.Location;

                for (var i = 0; i < m_Offsets.Length; i += 2)
                {
                    var x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length];
                    var 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;
                    }

                    var z = map.GetAverageZ(x, y);

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

                var m = toTeleport;

                var from = m.Location;

                m.Location = to;

                SpellHelper.Turn(m_Owner, toTeleport);
                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;
            }
Ejemplo n.º 42
0
                protected override void OnTick()
                {
                    m_Count++;

                    var de           = m_Creature.FindMostRecentDamageEntry(false);
                    var alreadyOwned = m_Creature.Owners.Contains(m_Tamer);

                    if (!m_Tamer.InRange(m_Creature, Core.AOS ? 7 : 6))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(
                            MessageType.Regular,
                            0x3B2,
                            502795,
                            m_Tamer.NetState
                            ); // You are too far away to continue taming.
                        Stop();
                    }
                    else if (!m_Tamer.CheckAlive())
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(
                            MessageType.Regular,
                            0x3B2,
                            502796,
                            m_Tamer.NetState
                            ); // You are dead, and cannot continue taming.
                        Stop();
                    }
                    else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath())
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Tamer.SendLocalizedMessage(
                            1049654
                            ); // You do not have a clear path to the animal you are taming, and must cease your attempt.
                        Stop();
                    }
                    else if (!m_Creature.Tamable)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(
                            MessageType.Regular,
                            0x3B2,
                            1049655,
                            m_Tamer.NetState
                            ); // That creature cannot be tamed.
                        Stop();
                    }
                    else if (m_Creature.Controlled)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(
                            MessageType.Regular,
                            0x3B2,
                            502804,
                            m_Tamer.NetState
                            ); // That animal looks tame already.
                        Stop();
                    }
                    else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(
                            MessageType.Regular,
                            0x3B2,
                            1005615,
                            m_Tamer.NetState
                            ); // This animal has had too many owners and is too upset for you to tame.
                        Stop();
                    }
                    else if (MustBeSubdued(m_Creature))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(
                            MessageType.Regular,
                            0x3B2,
                            1054025,
                            m_Tamer.NetState
                            ); // You must subdue this creature before you can tame it!
                        Stop();
                    }
                    else if (de?.LastDamage > m_StartTime)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(
                            MessageType.Regular,
                            0x3B2,
                            502794,
                            m_Tamer.NetState
                            ); // The animal is too angry to continue taming.
                        Stop();
                    }
                    else if (m_Count < m_MaxCount)
                    {
                        m_Tamer.RevealingAction();

                        switch (Utility.Random(3))
                        {
                        case 0:
                            m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4));
                            break;

                        case 1:
                            m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6));
                            break;

                        case 2:
                            m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4));
                            break;
                        }

                        if (!alreadyOwned) // Passively check animal lore for gain
                        {
                            m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0);
                        }

                        if (m_Creature.Paralyzed)
                        {
                            m_Paralyzed = true;
                        }
                    }
                    else
                    {
                        m_Tamer.RevealingAction();
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_BeingTamed.Remove(m_Creature);

                        if (m_Creature.Paralyzed)
                        {
                            m_Paralyzed = true;
                        }

                        if (!alreadyOwned) // Passively check animal lore for gain
                        {
                            m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0);
                        }

                        var minSkill = m_Creature.MinTameSkill + m_Creature.Owners.Count * 6.0;

                        if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature))
                        {
                            minSkill = -24.9; // 50% at 0.0?
                        }
                        minSkill += 24.9;

                        if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned ||
                            m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0))
                        {
                            if (m_Creature.Owners.Count == 0) // First tame
                            {
                                if (m_Creature is GreaterDragon)
                                {
                                    ScaleSkills(m_Creature, 0.72, 0.90); // 72% of original skills trainable to 90%
                                    m_Creature.Skills.Magery.Base =
                                        m_Creature.Skills.Magery
                                        .Cap;     // Greater dragons have a 90% cap reduction and 90% skill reduction on magery
                                }
                                else if (m_Paralyzed)
                                {
                                    ScaleSkills(
                                        m_Creature,
                                        0.86
                                        ); // 86% of original skills if they were paralyzed during the taming
                                }
                                else
                                {
                                    ScaleSkills(m_Creature, 0.90); // 90% of original skills
                                }

                                if (m_Creature.StatLossAfterTame)
                                {
                                    ScaleStats(m_Creature, 0.50);
                                }
                            }

                            if (alreadyOwned)
                            {
                                m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging.
                            }
                            else
                            {
                                m_Creature.PrivateOverheadMessage(
                                    MessageType.Regular,
                                    0x3B2,
                                    502799,
                                    m_Tamer.NetState
                                    ); // It seems to accept you as master.
                                m_Creature.Owners.Add(m_Tamer);
                            }

                            m_Creature.SetControlMaster(m_Tamer);
                            m_Creature.IsBonded = false;
                        }
                        else
                        {
                            m_Creature.PrivateOverheadMessage(
                                MessageType.Regular,
                                0x3B2,
                                502798,
                                m_Tamer.NetState
                                ); // You fail to tame the creature.
                        }
                    }
                }
Ejemplo n.º 43
0
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = false;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = 1 + (int)(srcSkill / 20.0);

                // *** Teiravon Light Level & Feat Checks
                srcSkill *= 0.5;

                if (src.LightLevel < 10)
                {
                    srcSkill += (Math.Abs(src.LightLevel - 10)) * 2.5;
                }
                else if (src.LightLevel > 10)
                {
                    srcSkill -= (src.LightLevel - 10) * 2.5;
                }

                //if ( targ is TeiravonMobile && ((TeiravonMobile)targ).HasFeat( TeiravonMobile.Feats.AdvancedStealth ) )
                //	skill *= 0.3;

                if (srcSkill < 0.0)
                {
                    srcSkill = 0.0;
                }
                // ***

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = (house != null && house.IsFriend(src));

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double distance = trg.GetDistanceToSqrt(p);

                            double ss = srcSkill + (80 - (20 * distance));
                            double ts = trg.Skills[SkillName.Stealth].Value + Utility.Random(21) - 10;

                            if (p == trg.Location)
                            {
                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814); // You have been revealed!
                                foundAnyone = true;
                            }

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg))))
                            {
                                if (!src.CanSee(trg))
                                {
                                    continue;
                                }

                                if (trg is Mobiles.ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814);                                   // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    if (Faction.Find(src) != null)
                    {
                        IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                        foreach (Item item in itemsInRange)
                        {
                            if (item is BaseFactionTrap)
                            {
                                BaseFactionTrap trap = (BaseFactionTrap)item;

                                if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0))
                                {
                                    src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName));                                       // You reveal a trap placed by a faction:

                                    trap.Visible = true;
                                    trap.BeginConceal();

                                    foundAnyone = true;
                                }
                            }
                        }

                        itemsInRange.Free();
                    }
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817);                       // You can see nothing hidden there.
                }
            }
Ejemplo n.º 44
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 (!CheckStam(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);
            }

            ArrayList targets = new ArrayList();

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

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

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

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }

            if (targets.Count > 0)
            {
                double bushido     = attacker.Skills.Bushido.Value;
                double damageBonus = 1.0 + Math.Pow((targets.Count * bushido) / 60, 2) / 100;

                if (damageBonus > 2.0)
                {
                    damageBonus = 2.0;
                }

                attacker.RevealingAction();

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

                    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, damageBonus);
                }
            }
        }
Ejemplo n.º 45
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))    //Mana check after check that there are targets
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

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

            IPooledEnumerable eable = attacker.GetMobilesInRange(2);

            foreach (Mobile m in eable)
            {
                if (m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

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

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }
            eable.Free();

            if (targets.Count > 0)
            {
                if (!CheckMana(attacker, true))
                {
                    return;
                }

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

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

                    if (m_Registry.ContainsKey(m) && m_Registry[m] != null)
                    {
                        m_Registry[m].Stop();
                    }

                    Timer t = new InternalTimer(attacker, m);
                    t.Start();
                    m_Registry[m] = t;

                    m.Send(SpeedControl.WalkSpeed);
                }
            }
        }
Ejemplo n.º 46
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from is PlayerMobile && targeted is Mobile)
                {
                    PlayerMobile pm   = (PlayerMobile)from;
                    Mobile       targ = (Mobile)targeted;

                    if (targ.AccessLevel <= from.AccessLevel)
                    {
                        List <Mobile> list = pm.VisibilityList;

                        if (list.Contains(targ))
                        {
                            list.Remove(targ);
                            from.SendMessage("{0} has been removed from your visibility list.", targ.Name);
                        }
                        else
                        {
                            list.Add(targ);
                            from.SendMessage("{0} has been added to your visibility list.", targ.Name);
                        }

                        if (Utility.InUpdateRange(targ, from))
                        {
                            NetState ns = targ.NetState;

                            if (ns != null)
                            {
                                if (targ.CanSee(from))
                                {
                                    if (ns.IsPost7000)
                                    {
                                        ns.Send(new MobileIncoming(targ, from));
                                    }
                                    else
                                    {
                                        ns.Send(new MobileIncomingOld(targ, from));
                                    }

                                    if (ObjectPropertyList.Enabled)
                                    {
                                        ns.Send(from.OPLPacket);

                                        foreach (Item item in from.Items)
                                        {
                                            ns.Send(item.OPLPacket);
                                        }
                                    }
                                }
                                else
                                {
                                    ns.Send(from.RemovePacket);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendMessage("They can already see you!");
                    }
                }
                else
                {
                    from.SendMessage("Add only mobiles to your visibility list.");
                }
            }
Ejemplo n.º 47
0
        public void NotifyLocationChangeOnSmooth(Mobile mobile, Point3D oldLocation)
        {
            Map     map         = mobile.Map;
            Point3D newLocation = mobile.Location;

            if (map != null)
            {
                // First, send a remove message to everyone who can no longer see us. (inOldRange && !inNewRange)
                Packet removeThis = null;

                IPooledEnumerable eable = map.GetClientsInRange(oldLocation);

                foreach (NetState ns in eable)
                {
                    if (ns != mobile.NetState && !Utility.InUpdateRange(newLocation, ns.Mobile.Location))
                    {
                        if (removeThis == null)
                        {
                            removeThis = mobile.RemovePacket;
                        }

                        ns.Send(removeThis);
                    }
                }

                eable.Free();

                NetState ourState = mobile.NetState;

                // Check to see if we are attached to a client
                if (ourState != null)
                {
                    eable = mobile.Map.GetObjectsInRange(newLocation, Core.GlobalMaxUpdateRange);

                    // We are attached to a client, so it's a bit more complex. We need to send new items and people to ourself, and ourself to other clients
                    foreach (object o in eable)
                    {
                        if (o is Item)
                        {
                            Item item = (Item)o;

                            if (item.NoMoveHS)
                            {
                                continue;
                            }

                            int     range = item.GetUpdateRange(mobile);
                            Point3D loc   = item.Location;

                            if (/*!Utility.InRange(oldLocation, loc, range) && */ Utility.InRange(newLocation, loc, range) && mobile.CanSee(item))
                            {
                                item.SendInfoTo(ourState);
                            }
                        }
                        else if (o != mobile && o is Mobile)
                        {
                            Mobile m = (Mobile)o;

                            if (m.NoMoveHS)
                            {
                                continue;
                            }

                            if (!Utility.InUpdateRange(newLocation, m.Location))
                            {
                                continue;
                            }

                            bool inOldRange = Utility.InUpdateRange(oldLocation, m.Location);

                            if (!inOldRange && m.NetState != null && m.CanSee(mobile))
                            {
                                m.NetState.Send(new MobileIncoming(m, mobile));

                                if (mobile.Poison != null)
                                {
                                    m.NetState.Send(new HealthbarPoison(mobile));
                                }

                                if (mobile.Blessed || mobile.YellowHealthbar)
                                {
                                    m.NetState.Send(new HealthbarYellow(mobile));
                                }

                                if (mobile.IsDeadBondedPet)
                                {
                                    m.NetState.Send(new BondedStatus(0, mobile.Serial, 1));
                                }

                                if (ObjectPropertyList.Enabled)
                                {
                                    m.NetState.Send(m.OPLPacket);
                                }
                            }

                            if (!inOldRange && mobile.CanSee(m))
                            {
                                ourState.Send(new MobileIncoming(mobile, m));

                                if (m.Poisoned)
                                {
                                    ourState.Send(new HealthbarPoison(m));
                                }

                                if (m.Blessed || m.YellowHealthbar)
                                {
                                    ourState.Send(new HealthbarYellow(m));
                                }

                                if (m.IsDeadBondedPet)
                                {
                                    ourState.Send(new BondedStatus(0, mobile.Serial, 1));
                                }

                                if (ObjectPropertyList.Enabled)
                                {
                                    ourState.Send(m.OPLPacket);
                                }
                            }
                        }
                    }

                    eable.Free();
                }
                else
                {
                    if (mobile == null)
                    {
                        return;
                    }

                    eable = mobile.Map.GetClientsInRange(newLocation);

                    // We're not attached to a client, so simply send an Incoming
                    foreach (NetState ns in eable)
                    {
                        if (mobile.NoMoveHS)
                        {
                            continue;
                        }

                        if (Utility.InUpdateRange(oldLocation, ns.Mobile.Location) && ns.Mobile.CanSee(mobile))
                        {
                            if (ns.StygianAbyss)
                            {
                                ns.Send(new MobileIncoming(ns.Mobile, mobile));

                                if (mobile.Poison != null)
                                {
                                    ns.Send(new HealthbarPoison(mobile));
                                }

                                if (mobile.Blessed || mobile.YellowHealthbar)
                                {
                                    ns.Send(new HealthbarYellow(mobile));
                                }
                            }
                            else
                            {
                                ns.Send(new MobileIncomingOld(ns.Mobile, mobile));
                            }

                            if (mobile.IsDeadBondedPet)
                            {
                                ns.Send(new BondedStatus(0, mobile.Serial, 1));
                            }

                            if (ObjectPropertyList.Enabled)
                            {
                                ns.Send(mobile.OPLPacket);
                            }
                        }
                    }

                    eable.Free();
                }
            }
        }
Ejemplo n.º 48
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                       // Both hands must be free to steal.
                }
                else if (m_Thief.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    m_Thief.SendMessage("You may not steal in this area.");
                }
                else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                       // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0)
                {
                    m_Thief.SendLocalizedMessage(502706);                       // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                       // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                       // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                       // Your backpack can't hold anything else.
                }
                #region Sigils
                else if (toSteal is Sigil)
                {
                    PlayerState pl      = PlayerState.Find(m_Thief);
                    Faction     faction = (pl == null ? null : pl.Faction);

                    Sigil sig = (Sigil)toSteal;

                    if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                    {
                        m_Thief.SendLocalizedMessage(502703);    // You must be standing next to an item to steal it.
                    }
                    else if (root != null)                       // not on the ground
                    {
                        m_Thief.SendLocalizedMessage(502710);    // You can't steal that!
                    }
                    else if (faction != null)
                    {
                        if (!m_Thief.CanBeginAction(typeof(IncognitoSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010581);                               //	You cannot steal the sigil when you are incognito
                        }
                        else if (DisguiseTimers.IsDisguised(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1010583);                               //	You cannot steal the sigil while disguised
                        }
                        else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010582);                               //	You cannot steal the sigil while polymorphed
                        }
                        else if (TransformationSpellHelper.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                               // You cannot steal the sigil while in that form.
                        }
                        else if (AnimalForm.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1063222);                               // You cannot steal the sigil while mimicking an animal.
                        }
                        else if (pl.IsLeaving)
                        {
                            m_Thief.SendLocalizedMessage(1005589);                               // You are currently quitting a faction and cannot steal the town sigil
                        }
                        else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction)
                        {
                            m_Thief.SendLocalizedMessage(1005590);                               //	You cannot steal your own sigil
                        }
                        else if (sig.IsPurifying)
                        {
                            m_Thief.SendLocalizedMessage(1005592);                               // You cannot steal this sigil until it has been purified
                        }
                        else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0))
                        {
                            if (Sigil.ExistsOn(m_Thief))
                            {
                                m_Thief.SendLocalizedMessage(1010258);                                   //	The sigil has gone back to its home location because you already have a sigil.
                            }
                            else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true))
                            {
                                m_Thief.SendLocalizedMessage(1010259);                                   //	The sigil has gone home because your backpack is full
                            }
                            else
                            {
                                if (sig.IsBeingCorrupted)
                                {
                                    sig.GraceStart = DateTime.UtcNow;                                    // begin grace period
                                }
                                m_Thief.SendLocalizedMessage(1010586);                                   // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                    sig.LastStolen         = DateTime.UtcNow;
                                }

                                return(sig);
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(1005594);                               //	You do not have enough skill to steal the sigil
                        }
                    }
                    else
                    {
                        m_Thief.SendLocalizedMessage(1005588);                           //	You must join a faction to do that
                    }
                }
                #endregion
                else if (si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (Core.AOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                       // You must be standing next to an item to steal it.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0)
                {
                    m_Thief.SendLocalizedMessage(1060025, "", 0x66D);                       // You're not skilled enough to attempt the theft of this item.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                       // You cannot steal items which are equiped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704);                       // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                               // You succesfully steal the item.

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                               // You fail to steal the item.
                        }

                        caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }
Ejemplo n.º 49
0
        public void Invoke(Mobile from, object targeted)
        {
            CancelTimeout();
            from.ClearTarget();

            if (from.Deleted)
            {
                OnTargetCancel(from, TargetCancelType.Canceled);
                OnTargetFinish(from);
                return;
            }

            Point3D loc;
            Map     map;

            var item   = targeted as Item;
            var mobile = targeted as Mobile;

            if (targeted is LandTarget target)
            {
                loc = target.Location;
                map = from.Map;
            }
            else if (targeted is StaticTarget staticTarget)
            {
                loc = staticTarget.Location;
                map = from.Map;
            }
            else if (mobile != null)
            {
                if (mobile.Deleted)
                {
                    OnTargetDeleted(from, mobile);
                    OnTargetFinish(from);
                    return;
                }

                if (!mobile.CanTarget)
                {
                    OnTargetUntargetable(from, mobile);
                    OnTargetFinish(from);
                    return;
                }

                loc = mobile.Location;
                map = mobile.Map;
            }
            else if (item != null)
            {
                if (item.Deleted)
                {
                    OnTargetDeleted(from, item);
                    OnTargetFinish(from);
                    return;
                }

                if (!item.CanTarget)
                {
                    OnTargetUntargetable(from, item);
                    OnTargetFinish(from);
                    return;
                }

                if (!AllowNonlocal && item.RootParent is Mobile && item.RootParent != from && from.AccessLevel == AccessLevel.Player)
                {
                    OnNonlocalTarget(from, item);
                    OnTargetFinish(from);
                    return;
                }

                loc = item.GetWorldLocation();
                map = item.Map;
            }
            else
            {
                OnTargetCancel(from, TargetCancelType.Canceled);
                OnTargetFinish(from);
                return;
            }

            if (map == null || map != from.Map || (Range != -1 && !from.InRange(loc, Range)))
            {
                OnTargetOutOfRange(from, targeted);
            }
            else
            {
                if (!from.CanSee(targeted))
                {
                    OnCantSeeTarget(from, targeted);
                }
                else if (CheckLOS && !from.InLOS(targeted))
                {
                    OnTargetOutOfLOS(from, targeted);
                }
                else if (item?.InSecureTrade == true)
                {
                    OnTargetInSecureTrade(from, targeted);
                }
                else if (item?.IsAccessibleTo(from) == false)
                {
                    OnTargetNotAccessible(from, targeted);
                }
                else if (item?.CheckTarget(from, this, targeted) == false)
                {
                    OnTargetUntargetable(from, targeted);
                }
                else if (mobile?.CheckTarget(from, this, mobile) == false)
                {
                    OnTargetUntargetable(from, mobile);
                }
                else if (from.Region.OnTarget(from, this, targeted))
                {
                    OnTarget(from, targeted);
                }
            }

            OnTargetFinish(from);
        }
Ejemplo n.º 50
0
		public override void OnSingleClick( Mobile from )
		{
			if ( Deleted || !from.CanSee( this ) )
				return;

			LabelToExpansion(from);

			LabelTo( from, String.Format( GetLabelName(), m_SkillBonus ) );

			if ( Expires )
			{
				if ( DateTime.UtcNow < m_ExpireDate )
				{
					int hours = (int)(m_ExpireDate - DateTime.UtcNow).TotalHours;
					if ( hours > 24 )
						LabelTo( from, String.Format( "Remaining Time: about {0} day(s) {1} hour(s)", hours / 24, hours % 24 ) );
					else if ( hours > 0 )
						LabelTo( from, String.Format( "Remaining Time: about {0} hour(s)", hours ) );
					else
						LabelTo( from, "Remaining Time: within 1 hour" );
				}
				else
					LabelTo( from, 1150487 );
			}
		}
Ejemplo n.º 51
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            var map = attacker.Map;

            if (map == null)
            {
                return;
            }

            if (attacker.Weapon is not BaseWeapon weapon)
            {
                return;
            }

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

            var eable = attacker.GetMobilesInRange(1);

            using var queue = PooledRefQueue <Mobile> .Create();

            foreach (var m in eable)
            {
                if (m?.Deleted == false && m != defender && m != attacker &&
                    m.Map == attacker.Map && m.Alive &&
                    SpellHelper.ValidIndirectTarget(attacker, m) &&
                    attacker.CanSee(m) && attacker.CanBeHarmful(m) &&
                    attacker.InRange(m, weapon.MaxRange) && attacker.InLOS(m))
                {
                    queue.Enqueue(m);
                }
            }

            eable.Free();

            if (queue.Count <= 0)
            {
                return;
            }

            var bushido     = attacker.Skills.Bushido.Value;
            var damageBonus = 1.0 + Math.Pow(queue.Count * bushido / 60, 2) / 100;

            if (damageBonus > 2.0)
            {
                damageBonus = 2.0;
            }

            attacker.RevealingAction();

            while (queue.Count > 0)
            {
                var m = queue.Dequeue();
                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, damageBonus);
            }
        }
Ejemplo n.º 52
0
        public override void OnSingleClick(Mobile from)
        {
            if (this.Deleted || !from.CanSee(this))
                return;

            this.LabelTo(from, 1061133, String.Format("{0}\t{1}", GetSkillTitle(this.m_SkillLevel).ToString(), RepairSkillInfo.GetInfo(this.m_Skill).Name)); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.

            if (this.m_Crafter != null)
                this.LabelTo(from, 1050043, this.m_Crafter.Name); // crafted by ~1_NAME~
        }
Ejemplo n.º 53
0
        public MobileIncoming( Mobile beholder, Mobile beheld )
            : base(0x78)
        {
            m_Beheld = beheld;
            ++m_Version;

            List<Item> eq = beheld.Items;
            int count = eq.Count;

            if( beheld.HairItemID > 0 )
                count++;
            if( beheld.FacialHairItemID > 0 )
                count++;

            this.EnsureCapacity( 23 + (count * 9) );

            int hue = beheld.Hue;

            if ( beheld.SolidHueOverride >= 0 )
                hue = beheld.SolidHueOverride;

            m_Stream.Write( (int) beheld.Serial );
            m_Stream.Write( (short) beheld.Body );
            m_Stream.Write( (short) beheld.X );
            m_Stream.Write( (short) beheld.Y );
            m_Stream.Write( (sbyte) beheld.Z );
            m_Stream.Write( (byte) beheld.Direction );
            m_Stream.Write( (short) hue );
            m_Stream.Write( (byte) beheld.GetPacketFlags() );
            m_Stream.Write( (byte) Notoriety.Compute( beholder, beheld ) );

            NetState ns = beholder.RawNetState;
            bool useHueFlag = ( ns == null || !ns.NewMobileIncoming );

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

                byte layer = (byte) item.Layer;

                if ( !item.Deleted && beholder.CanSee( item ) && m_DupedLayers[layer] != m_Version )
                {
                    m_DupedLayers[layer] = m_Version;

                    hue = item.Hue;

                    if ( beheld.SolidHueOverride >= 0 )
                        hue = beheld.SolidHueOverride;

                    int itemID = item.ItemID & 0xFFFF;

                    if ( useHueFlag )
                    {
                        itemID &= 0x7FFF;

                        if ( hue != 0 )
                            itemID |= 0x8000;
                    }

                    m_Stream.Write( (int) item.Serial );
                    m_Stream.Write( (ushort) itemID );
                    m_Stream.Write( (byte) layer );

                    if ( !useHueFlag || hue != 0 )
                        m_Stream.Write( (short) hue );
                }
            }

            if( beheld.HairItemID > 0 )
            {
                if( m_DupedLayers[(int)Layer.Hair] != m_Version )
                {
                    m_DupedLayers[(int)Layer.Hair] = m_Version;
                    hue = beheld.HairHue;

                    if( beheld.SolidHueOverride >= 0 )
                        hue = beheld.SolidHueOverride;

                    int itemID = beheld.HairItemID & 0xFFFF;

                    if ( useHueFlag )
                    {
                        itemID &= 0x7FFF;

                        if ( hue != 0 )
                            itemID |= 0x8000;
                    }

                    m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) );
                    m_Stream.Write( (ushort)itemID );
                    m_Stream.Write( (byte)Layer.Hair );

                    if ( !useHueFlag || hue != 0 )
                        m_Stream.Write( (short)hue );
                }
            }

            if( beheld.FacialHairItemID > 0 )
            {
                if( m_DupedLayers[(int)Layer.FacialHair] != m_Version )
                {
                    m_DupedLayers[(int)Layer.FacialHair] = m_Version;
                    hue = beheld.FacialHairHue;

                    if( beheld.SolidHueOverride >= 0 )
                        hue = beheld.SolidHueOverride;

                    int itemID = beheld.FacialHairItemID & 0xFFFF;

                    if ( useHueFlag )
                    {
                        itemID &= 0x7FFF;

                        if ( hue != 0 )
                            itemID |= 0x8000;
                    }

                    m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) );
                    m_Stream.Write( (ushort)itemID );
                    m_Stream.Write( (byte)Layer.FacialHair );

                    if ( !useHueFlag || hue != 0 )
                        m_Stream.Write( (short)hue );
                }
            }

            m_Stream.Write( (int) 0 ); // terminate
        }
Ejemplo n.º 54
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker)) // Mana check after check that there are targets
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (!(map != null && attacker.Weapon is BaseWeapon weapon))
            {
                return;
            }

            List <Mobile> targets = attacker.GetMobilesInRange(1).Where(m =>
                                                                        m?.Deleted == false && m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m) &&
                                                                        m.Map == attacker.Map && m.Alive && attacker.CanSee(m) && attacker.CanBeHarmful(m) &&
                                                                        attacker.InRange(m, weapon.MaxRange) && attacker.InLOS(m)).ToList();

            if (targets.Count == 0 || !CheckMana(attacker, true))
            {
                return;
            }

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

            // 5-15 damage
            int amount = (int)(10.0 * ((Math.Max(attacker.Skills.Bushido.Value,
                                                 attacker.Skills.Ninjitsu.Value) - 50.0) / 70.0 + 5));

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

                if (Registry.TryGetValue(m, out FrenziedWirlwindTimer timer))
                {
                    timer.Stop();
                    Registry.Remove(m);
                }

                timer = new FrenziedWirlwindTimer(attacker, m, amount);
                timer.Start();
                Registry.Add(m, timer);
            }

            Timer.DelayCall(TimeSpan.FromSeconds(2.0), RepeatEffect, attacker);
        }
Ejemplo n.º 55
0
        public ContainerContent( Mobile beholder, Item beheld )
            : base(0x3C)
        {
            ArrayList items = beheld.Items;
            int count = items.Count;

            this.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 && beholder.CanSee( child ) )
                {
                    Point3D loc = child.Location;

                    ushort cid = (ushort) child.ItemID;

                    if ( cid > 0x3FFF )
                        cid = 0x9D7;

                    m_Stream.Write( (int) child.Serial );
                    m_Stream.Write( (ushort) cid );
                    m_Stream.Write( (byte) 0 ); // signed, itemID offset
                    m_Stream.Write( (ushort) child.Amount );
                    m_Stream.Write( (short) loc.m_X );
                    m_Stream.Write( (short) loc.m_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 );
        }
Ejemplo n.º 56
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))                    //Mana check after check that there are targets
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            ArrayList list = new ArrayList();

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

            ArrayList targets = new ArrayList();

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

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

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

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }

            if (targets.Count > 0)
            {
                if (!CheckMana(attacker, true))
                {
                    return;
                }

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

                // 5-15 damage
                int amount = (int)(10.0 * ((Math.Max(attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value) - 50.0) / 70.0 + 5));

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

                    Timer t = Registry[m] as Timer;

                    if (t != null)
                    {
                        t.Stop();
                        Registry.Remove(m);
                    }

                    t = new InternalTimer(attacker, m, amount);
                    t.Start();
                    Registry.Add(m, t);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(RepeatEffect), attacker);
            }
        }
Ejemplo n.º 57
0
        public override void OnSingleClick(Mobile from)
        {
            if (Deleted || !from.CanSee(this))
            {
                return;
            }

            LabelToExpansion(from);

            LabelTo(from, String.Format(GetLabelName(), m_SkillBonus));
        }
Ejemplo n.º 58
0
            private Item TryStealItem(Item item, ref int amount)
            {
                Item stolen = null;

                object root = item.RootParent;

                if (!IsEmptyHanded(from))
                {
                    from.SendLocalizedMessage(1005584); // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(from))
                {
                    from.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(from) && from.ShortTermMurders > 0)
                {
                    from.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    from.SendLocalizedMessage(1005598); // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    from.SendLocalizedMessage(502709); // You can't steal from vendors.
                }
                else if (!from.CanSee(item))
                {
                    from.SendLocalizedMessage(500237); // Target can not be seen.
                }
                else if (from.Backpack == null || !from.Backpack.CheckHold(from, item, false, true))
                {
                    from.SendLocalizedMessage(1048147); // Your backpack can't hold anything else.
                }
                else if (!from.InRange(item.GetWorldLocation(), 1))
                {
                    from.SendLocalizedMessage(502703); // You must be standing next to an item to steal it.
                }
                else if (item.Parent is Mobile)
                {
                    from.SendLocalizedMessage(1005585); // You cannot steal items which are equiped.
                }
                else if (root == from)
                {
                    from.SendLocalizedMessage(502704); // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    from.SendLocalizedMessage(502710); // You can't steal that!
                }
                else if (root is Mobile && !from.CanBeHarmful((Mobile)root))
                {
                }

                else if (root is Corpse)
                {
                    from.SendLocalizedMessage(502710); // You can't steal that!
                }
                else if (item.Stealable && !item.AlreadyStolen)
                {
                    //TEST: Check This (Rares Stealing?)
                    if (from.CheckTargetSkill(SkillName.Stealing, item, item.MinimumStealing, item.MaximumStealing, 1.0))
                    {
                        item.AlreadyStolen = true;
                        stolen             = item;
                    }

                    else
                    {
                        from.SendLocalizedMessage(502723); // You fail to steal the item.
                    }
                }

                else if (!item.Movable || item.LootType == LootType.Unlootable || item.LootType == LootType.Newbied || item.CheckBlessed(root) || item.DonationItem)
                {
                    from.SendLocalizedMessage(502710); // You can't steal that!
                }
                else
                {
                    double itemWeight = item.Weight + item.TotalWeight;

                    if (itemWeight > MaxWeightStealable)
                    {
                        from.SendMessage("That is too heavy to steal.");
                    }

                    else
                    {
                        from.CheckTargetSkill(SkillName.Stealing, item, 0.0, 100.0, 1.0);

                        double stealingSkill = from.Skills[SkillName.Stealing].Value / 100;
                        double successChance = stealingSkill * SkillSuccessChanceScalar;

                        if (from.Hidden)
                        {
                            double hidingBonus = HidingBonus;

                            if (hidingBonus > stealingSkill)
                            {
                                hidingBonus = stealingSkill;
                            }

                            successChance += hidingBonus;
                        }

                        if (from.LastCombatTime + TimeSpan.FromSeconds(30) > DateTime.UtcNow)
                        {
                            successChance -= CombatPenalty;
                        }

                        bool successful = (Utility.RandomDouble() <= successChance);

                        double maxWeightStealable = (from.Skills[SkillName.Stealing].Value / 100) * MaxWeightStealable;

                        if (item.Stackable && item.Amount > 1)
                        {
                            double weightVariation = maxWeightStealable * StackedMaxWeightVariance;

                            if (Utility.RandomDouble() < .5)
                            {
                                maxWeightStealable += (Utility.RandomDouble() * weightVariation);
                            }

                            else
                            {
                                maxWeightStealable -= (Utility.RandomDouble() * weightVariation);
                            }

                            maxWeightStealable *= StackStealScalar;

                            amount = (int)(Math.Round(maxWeightStealable / (double)item.Weight));

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

                            if (successful)
                            {
                                stolen = item;
                            }
                        }

                        else
                        {
                            if (successful)
                            {
                                stolen = item;
                            }
                        }
                    }
                }

                return(stolen);
            }
Ejemplo n.º 59
0
        protected override void OnTarget(Mobile from, object target)
        {
            if (!from.CanSee(target))
            {
                from.SendMessage("Target cannot be seen.");
            }
            else if (!from.Alive)
            {
                from.SendMessage("You cannot transform out of your current state.");
            }
            else if (target is Mobile && ((Mobile)target).Alive)
            {
                Mobile t = (Mobile)target;

                if (t == from)
                {
                    from.HueMod = -1;

                    ((Player)from).RawStr -= ((Player)from).StrMod;
                    ((Player)from).RawDex -= ((Player)from).DexMod;
                    ((Player)from).RawInt -= ((Player)from).IntMod;

                    ((Player)from).RaceBody = 58;
                    ((Player)from).AdjustBody();

                    ((Player)from).StrMod = 0;
                    ((Player)from).DexMod = 0;
                    ((Player)from).IntMod = 0;

                    ((Player)from).BodyDamageBonus = 0;
                }

                else if (from.Mounted && !t.Body.IsHuman)
                {
                    from.SendMessage("You cannot transform while mounted.");
                }

                else
                {
                    from.FixedParticles(14089, 0, 30, 0, 1155, 7, EffectLayer.CenterFeet);

                    ((Player)from).RaceBody = t.Body;
                    ((Player)from).AdjustBody();

                    from.HueMod = t.Hue;

                    ((Player)from).RawStr -= ((Player)from).StrMod;
                    ((Player)from).RawDex -= ((Player)from).DexMod;
                    ((Player)from).RawInt -= ((Player)from).IntMod;

                    ((Player)from).StrMod = (int)(t.RawStr / 10);
                    ((Player)from).DexMod = (int)(t.RawDex / 10);
                    ((Player)from).IntMod = (int)(t.RawInt / 10);

                    from.RawStr += ((Player)from).StrMod;
                    from.RawDex += ((Player)from).DexMod;
                    from.RawInt += ((Player)from).IntMod;

                    if (t.Body.IsHuman == false)
                    {
                        ((Player)from).BodyDamageBonus = (int)(t.RawStr / 15);
                    }

                    if (t.Body.IsHuman)
                    {
                        from.HairItemID       = t.HairItemID;
                        from.FacialHairItemID = t.FacialHairItemID;
                        from.HairHue          = t.HairHue;
                        from.FacialHairHue    = t.FacialHairHue;
                    }

                    from.PublicOverheadMessage(MessageType.Regular, from.EmoteHue, false, String.Format("*transforms into the shape of {0}*", t.RawName));

                    hasChanged = true;

                    for (int x = 1; x <= 2; x++)
                    {
                        Item toDisarm = from.FindItemOnLayer(Layer.OneHanded);

                        if (toDisarm == null || !toDisarm.Movable)
                        {
                            toDisarm = from.FindItemOnLayer(Layer.TwoHanded);
                        }

                        Container pack = from.Backpack;
                        pack.DropItem(toDisarm);
                    }
                }
            }

            else
            {
                from.SendMessage("You cannot take that form.");
            }
        }
Ejemplo n.º 60
0
        public CorpseContent(Mobile beholder, Corpse beheld)
            : base(0x3C)
        {
            var items = beheld.EquipItems;
            int count = items.Count;

            if (beheld.Hair != null && beheld.Hair.ItemID > 0)
            {
                count++;
            }
            if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
            {
                count++;
            }

            EnsureCapacity(5 + (count * 19));

            long pos = m_Stream.Position;

            int written = 0;

            m_Stream.Write((ushort)0);

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

                if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
                {
                    m_Stream.Write(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(beheld.Serial);
                    m_Stream.Write((ushort)child.Hue);

                    ++written;
                }
            }

            if (beheld.Hair != null && beheld.Hair.ItemID > 0)
            {
                m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
                m_Stream.Write((ushort)beheld.Hair.ItemID);
                m_Stream.Write((byte)0); // signed, itemID offset
                m_Stream.Write((ushort)1);
                m_Stream.Write((short)0);
                m_Stream.Write((short)0);
                m_Stream.Write(beheld.Serial);
                m_Stream.Write((ushort)beheld.Hair.Hue);

                ++written;
            }

            if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
            {
                m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
                m_Stream.Write((ushort)beheld.FacialHair.ItemID);
                m_Stream.Write((byte)0); // signed, itemID offset
                m_Stream.Write((ushort)1);
                m_Stream.Write((short)0);
                m_Stream.Write((short)0);
                m_Stream.Write(beheld.Serial);
                m_Stream.Write((ushort)beheld.FacialHair.Hue);

                ++written;
            }

            m_Stream.Seek(pos, SeekOrigin.Begin);
            m_Stream.Write((ushort)written);
        }