public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
			}
			else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse )
			{
				Point3D p = GetWorldLocation();

				if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
				{
					Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
					from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
					SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
				}

				Effects.PlaySound( GetWorldLocation(), Map, 0x387 );

				Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
				Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );

				Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );

				m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
			}
		}
Exemple #2
0
		public void PokerMessage( Mobile from, string message )
		{
			from.PublicOverheadMessage( Server.Network.MessageType.Regular, 0x9A, true, message );

			for ( int i = 0; i < m_Players.Count; ++i )
				if ( m_Players[i].Mobile != null )
					m_Players[i].Mobile.SendMessage( 0x9A, "[{0}]: {1}", from.Name, message );
		}
 public override void OnDoubleClick(Mobile from)
 {
     if (from.EquipItem(this) || IsChildOf(from))
     {
         from.PlaySound(0x166);
         from.PublicOverheadMessage(MessageType.Emote, 33, true, "*The Daemon claws demand a soul*");
         from.BeginTarget(-1, true, TargetFlags.None, OnTarget);
     }
     else
         from.SendAsciiMessage("You must equip the claws to use them");
 }
Exemple #4
0
		public override void OnDoubleClick( Mobile from )
		{
			if( from.InRange( this, 2 ) && m_Tent != null )
			{
				if( from == m_Owner || IsFriend( from ) || m_Tent.Bounds.Contains( from ) || from.AccessLevel >= AccessLevel.GameMaster )
				{
					if( ItemID == 0x1F7 )
					{
						ItemID = 0x1F6;
						X += 1;
						Y -= 1;

						FlapTimer timer = new FlapTimer( this );
						timer.Start();

						from.PublicOverheadMessage( MessageType.Regular, from.EmoteHue, false, "*unclasps the tent flap*" );
					}
					else if( ItemID == 0x1F6 )
					{
						ItemID = 0x1F7;
						X -= 1;
						Y += 1;

						from.PublicOverheadMessage( MessageType.Regular, from.EmoteHue, false, "*closes the flap*" );
					}
				}
				else
				{
					from.SendMessage( "This is not your tent." );
				}
			}
			else
			{
				from.SendMessage( "That is too far away." );
			}
		}
		public override void OnDoubleClick( Mobile m )
		{
			if ( !m.InRange( this.GetWorldLocation(), 3 ) )
				return;
			if ( m_Controller.Enabled )
				return;

			if ( (m_Wanderer == null || !m_Wanderer.Alive) )
			{
				m_Wanderer = new WandererOfTheVoid();
				m_Wanderer.MoveToWorld( LeverPuzzleController.lr_Enter, Map.Malas );
				m_Wanderer.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1060002, "" ); // I am the guardian of...
				Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerCallback( CallBackMessage ) );
			}
		}
        public override void OnHit(Mobile attacker, Mobile defender)
        {
            CustomRegion cR = defender.Region as CustomRegion;

            if (cR == null || cR.Controller.AllowSpecialAttacks)
            {
                if (Utility.Random(20) <= 2) // 10% chance of scoring a critical hit
                {
                    attacker.SendAsciiMessage("You poison your target!");
                    defender.PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*{0} suddenly feels very ill*", defender.Name));
                    defender.ApplyPoison(attacker, Poison.GetPoison(0));
                    new InternalTimer(defender).Start();
                }
            }

            base.OnHit(attacker, defender);
        }
Exemple #7
0
	    public override void OnDoubleClick( Mobile from )
		{
			// Fill the Mobile with FillFactor
			if( Food.FillHunger( from, 4 ) )
			{
				// Play a random "eat" sound
				from.PlaySound( Utility.Random( 0x3A, 3 ) );

				if( from.Body.IsHuman && !from.Mounted )
					from.Animate( 34, 5, 1, true, false, 0 );

				if( Owner != null )
					from.PublicOverheadMessage( MessageType.Emote, 0x22, true, string.Format( "*You see {0} eat some {1}*", from.Name, Name ) );

				Consume();
			}
		}
        public override void OnHit(Mobile attacker, Mobile defender)
        {
            CustomRegion cR = defender.Region as CustomRegion;

            if (cR == null || cR.Controller.AllowSpecialAttacks)
            {
                if (Utility.Random(20) <= 2) // 10% chance of scoring a critical hit
                {
                    attacker.SendAsciiMessage("You score a critical hit!");
                    defender.PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*Critical hit!*"));
                    defender.BoltEffect(0);
                    defender.Hits -= 10;
                }
            }

            base.OnHit(attacker, defender);
        }
	    public override void OnDoubleClick(Mobile from)
	    {
            if (ParentEntity != null && ParentEntity == from)
	        {
                from.PublicOverheadMessage(MessageType.Label, 54, true, "*You see " + from.Name + " rubbing his bracelet furiously*");
	            int range = Utility.RandomMinMax(5, 7);
	            int zOffset = from.Mounted ? 20 : 10;

	            Point3D src = from.Location.Clone3D(0, 0, zOffset);
	            var points = src.GetAllPointsInRange(from.Map, 0, range);

	            Effects.PlaySound(from.Location, from.Map, 0x19C);

	            Timer.DelayCall(
	                TimeSpan.FromMilliseconds(100),
	                () =>
	                {
	                    foreach (Point3D trg in points)
	                    {
	                        int bloodID = Utility.RandomMinMax(4650, 4655);

                            new MovingEffectInfo(src, trg.Clone3D(0, 0, 2), from.Map, bloodID, 1152).MovingImpact(
	                            info =>
	                            {
	                                var blood = new Blood
	                                {
	                                    ItemID = bloodID,
                                        Hue = 1153
	                                };
	                                blood.MoveToWorld(info.Target.Location, info.Map);

	                                Effects.PlaySound(info.Target, info.Map, 0x028);
	                            });
	                    }
	                });
	        }
            else if (ParentEntity == null || from != ParentEntity)
            {
                from.SendMessage(54, "You must be wearing this to use it.");
                return;
            }
	        base.OnDoubleClick(from);
	    }
		public override bool OnMoveOver( Mobile m )
		{
			if( Active )
			{
				if( !Creatures && !m.Player )
					return true;

				double totalSkills = m.Skills[SkillName.Swords].Base + m.Skills[SkillName.Fencing].Base + m.Skills[SkillName.Parry].Base + m.Skills[SkillName.Tactics].Base + m.Skills[SkillName.Macing].Base + m.Skills[SkillName.Wrestling].Base + m.Skills[SkillName.Healing].Base + m.Skills[SkillName.Archery].Base + m.Skills[SkillName.Anatomy].Base + m.Skills[SkillName.Magery].Base;

				if( ( totalSkills <= 500.0 ) || ( m.AccessLevel > AccessLevel.Player ) )
				{
					StartTeleport( m );
					return false;
				}
				else
                    m.PublicOverheadMessage(MessageType.Regular, 906, true, string.Format("Your skill exceeds the level acceptable to enter this area."));
			}
			return true;
		}
        public override void OnHit(Mobile attacker, Mobile defender)
        {
            CustomRegion cR = defender.Region as CustomRegion;

            if (cR == null || cR.Controller.AllowSpecialAttacks)
            {
                if (Utility.Random(28) <= 2) // 7% chance of scoring a critical hit
                {
                    attacker.SendAsciiMessage("You score a critical hit!");
                    defender.PublicOverheadMessage(MessageType.Emote, 34, false, string.Format("*Critical hit!*"));
                    defender.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                    defender.PlaySound(283);

                    int damage = 15;

                    #region Damage based on AR
                    if (defender is PlayerMobile)
                    {
                        int basedamage = damage;
                        damage = (damage * 4) - (int)defender.ArmorRating - 5;

                        //Minimum damage 15
                        if (damage < basedamage)
                            damage = basedamage;

                        //Maximum damage 30
                        if (damage > 30)
                            damage = 30;
                    }
                    else //Always deal maxdamage when fighting monsters
                        damage = 30;
                    #endregion

                    defender.Hits -= damage;
                }
            }
            
            base.OnHit(attacker, defender);
        }
Exemple #12
0
        public override void OnDoubleClickDead(Mobile from)
        {
            if (!from.Alive && from is PlayerMobile)
            {
                ((PlayerMobile)from).ForceResurrect();
                CommandLogging.WriteLine(from, "Refreshing and resurrecting " + from.Name);
            }
            else if (!from.Alive)
            {
                from.Resurrect();
                CommandLogging.WriteLine(from, "Refreshing and resurrecting " + from.Name);
            }

            CommandLogging.WriteLine(from, "Refreshing but not resurrecting " + from.Name);

            from.PublicOverheadMessage(MessageType.Regular, from.SpeechHue, true, "I've been refreshed.");

            from.Hits = from.HitsMax;
            from.Stam = from.StamMax;
            from.Mana = from.ManaMax;
            from.CurePoison(from);
        }
Exemple #13
0
		public virtual bool Eat( Mobile from )
		{
			// Fill the Mobile with FillFactor
			if ( FillHunger( from, m_FillFactor ) )
			{
				// Play a random "eat" sound
				from.PlaySound( Utility.Random( 0x3A, 3 ) );

                from.PublicOverheadMessage(MessageType.Emote, 0x22, true, string.Format("*You see {0} eating some {1}*", from.Name, Name==null ? CliLoc.LocToString(LabelNumber) : Name));

				if ( from.Body.IsHuman && !from.Mounted )
					from.Animate( 34, 5, 1, true, false, 0 );

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

				Consume();

				return true;
			}

			return false;
		}
Exemple #14
0
        public void FindCreature(Mobile from, int creatureLevel)
        {
            if (from == null)
            {
                return;
            }

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            int waterLocationChecks = 20;

            int minSpawnRadius = 3;
            int maxSpawnRadius = 6;

            bool foundWaterSpot   = false;
            bool spawnedCreatures = false;

            Point3D spawnLocation = Location;
            Point3D newLocation   = new Point3D();

            for (int a = 0; a < waterLocationChecks; a++)
            {
                int x = X;

                int xOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    xOffset *= -1;
                }

                x += xOffset;

                int y = Y;

                int yOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    yOffset *= -1;
                }

                y += yOffset;

                newLocation.X = x;
                newLocation.Y = y;
                newLocation.Z = -5;

                bool waterTile = BaseShip.IsWaterTile(newLocation, Map);

                if (waterTile)
                {
                    if (BaseShip.FindShipAt(newLocation, Map) != null)
                    {
                        continue;
                    }

                    SpellHelper.AdjustField(ref spawnLocation, Map, 12, false);

                    foundWaterSpot = true;
                    break;
                }
            }

            if (!foundWaterSpot)
            {
                return;
            }

            int count = 0;

            switch (creatureLevel)
            {
            case 1:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Puddle();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something was hiding in the wreckage!*");
                }
                break;

            case 2:
                if (player.ShipOccupied != null)
                {
                    if (!player.ShipOccupied.Deleted && player.ShipOccupied.m_SinkTimer == null)
                    {
                        count = Utility.RandomMinMax(2, 4);

                        for (int a = 0; a < count; a++)
                        {
                            BaseCreature bc_Creature = new ColossusTermite();

                            bc_Creature.m_WasFishedUp = true;
                            bc_Creature.MoveToWorld(player.ShipOccupied.GetRandomEmbarkLocation(false), from.Map);
                            spawnedCreatures = true;
                        }
                    }
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*the wreckage was full of termites!*");
                }
                break;

            case 3:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new DeepSeaSerpent();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something was hiding in the wreckage!*");
                }
                break;

            case 4:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Kraken();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something was hiding in the wreckage!*");
                }
                break;
            }
        }
        public void OnTarget(Mobile from, object obj)
        {
            if (this.Deleted || this.m_InUse)
            {
                return;
            }

            IPoint3D p3D = obj as IPoint3D;

            if (p3D == null)
            {
                return;
            }

            Map map = from.Map;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            int x = p3D.X, y = p3D.Y, z = map.GetAverageZ(x, y); // OSI just takes the targeted Z

            if (!from.InLOS(obj))
            {
                from.SendLocalizedMessage(500979); // You cannot see that location.
            }
            else if (this.RequireDeepWater ? FullValidation(map, x, y) : (ValidateDeepWater(map, x, y) || ValidateUndeepWater(map, obj, ref z)))
            {
                Point3D p = new Point3D(x, y, z);

                if (this.GetType() == typeof(SpecialSalvageHook))
                {
                    for (int i = 1; i < this.Amount; ++i) // these were stackable before, doh
                    {
                        from.AddToBackpack(new SpecialSalvageHook());
                    }
                }

                _Tick = 0;

                this.m_InUse = true;
                this.Movable = false;
                this.MoveToWorld(p, map);

                SpellHelper.Turn(from, p);
                from.Animate(12, 5, 1, true, false, 0);

                Effects.SendLocationEffect(p, map, 0x352D, 16, 4);
                Effects.PlaySound(p, map, 0x364);

                _EffectTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), new TimerStateCallback(DoEffect), new object[] { p, from });
                _EffectTimer.Start();

                from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154220); // *You cast the mighty hook into the sea!*
            }
            else
            {
                from.SendLocalizedMessage(1010485); // You can only use this in deep water!
            }
        }
Exemple #16
0
 public static void Say(this Mobile mobile, int number, string args, int hue)
 {
     mobile.PublicOverheadMessage(MessageType.Regular, hue, number, args);
 }
Exemple #17
0
                protected override void OnTick()
                {
                    m_Count++;

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

                    if (!m_Tamer.InRange(m_Creature, 6))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.Now;
                        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.Now;
                        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))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049654, m_Tamer.NetState);                           // 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.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState);                           // That creature cannot be tamed.
                        Stop();
                    }
                    else if (m_Creature.Controled)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.Now;
                        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.Now;
                        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.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState);                           // You must subdue this creature before you can tame it!
                        Stop();
                    }
                    else if (de != null && de.LastDamage > m_StartTime)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.Now;
                        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.Now;
                        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);
                        }

                        double 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 (alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0))
                        {
                            if (m_Creature.Owners.Count == 0)                               // First tame
                            {
                                if (m_Paralyzed)
                                {
                                    Scale(m_Creature, 0.86, false);                                       // 86% of original skills if they were paralyzed during the taming
                                }
                                else
                                {
                                    Scale(m_Creature, 0.90, false);                                       // 90% of original skills
                                }
                                if (m_Creature.SubdueBeforeTame)
                                {
                                    Scale(m_Creature, 0.50, true);                                       // Creatures which must be subdued take an additional 50% loss of skills and stats
                                }
                            }

                            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.
                        }
                    }
                }
Exemple #18
0
        public static void ShowPointsOverhead(Mobile from)
        {
            if (from == null)
                return;

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, false, GetPoints(from).ToString());
        }
            public static void JunkBeg(Mobile m, object targeted, double chance)             //Nothing Good. Here have some crap
            {
                Mobile    t          = (Mobile)targeted;
                bool      orcs       = IsOrc(t);
                Container theirPack  = t.Backpack;
                Item      reward     = null;
                string    rewardName = "";

                if (chance >= .76 && m.Skills.Begging.Base >= 75)
                {
                    int rand = Utility.Random(10);

                    if (rand == 0)
                    {
                        reward     = new WoodenBowlOfPeas();
                        rewardName = "a bowl of peas";
                    }
                    else if (rand == 1)
                    {
                        reward     = new CheeseWedge();
                        rewardName = "a cheese wedge";
                    }
                    else if (rand == 2)
                    {
                        reward     = new Dates();
                        rewardName = "some dates";
                    }
                    else if (rand == 3)
                    {
                        reward     = new BeggerCoins(6);
                        rewardName = "6 dull silver coins.";
                    }
                    else if (rand == 4)
                    {
                        reward     = new BeverageBottle(BeverageType.Ale);
                        rewardName = "a bottle of ale";
                    }
                    else if (rand == 5)
                    {
                        reward     = new CheesePizza();
                        rewardName = "a cheese pizza";
                    }
                    else if (rand == 6)
                    {
                        reward     = new Shirt();
                        rewardName = "a shirt";
                    }
                }
                Console.WriteLine("RewardName (3) {0}", reward);
                if (chance >= .25 && reward == null)
                {
                    reward     = new FrenchBread();
                    rewardName = "french bread";
                }

                if (reward == null && orcs == false)                 //Gold from Non Orcs and if you got nothing else from above.
                {
                    int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                    int max       = 10 + (m.Fame / 2500);

                    if (max > 14)
                    {
                        max = 14;
                    }
                    else if (max < 10)
                    {
                        max = 10;
                    }

                    if (toConsume > max)
                    {
                        toConsume = max;
                    }

                    if (toConsume > 0)
                    {
                        int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                        if (consumed > 0)
                        {
                            t.PublicOverheadMessage(MessageType.Regular, t.SpeechHue, 500405);
                            // I feel sorry for thee...

                            Gold gold = new Gold(consumed);

                            reward     = new Gold(consumed);
                            rewardName = "Gold";
                            m.PlaySound(gold.GetDropSound());
                            if (orcs == false)
                            {
                                if (m.Karma > -3000)
                                {
                                    int toLose = m.Karma + 3000;

                                    if (toLose > 40)
                                    {
                                        toLose = 40;
                                    }

                                    Titles.AwardKarma(m, -toLose, true);
                                }
                            }
                        }
                        else
                        {
                            if (orcs == false)                             //Orcs Dont speak English
                            {
                                t.PublicOverheadMessage(MessageType.Regular, t.SpeechHue, 500407);
                            }
                            // I have not enough money to give thee any!
                        }
                    }
                    else
                    {
                        if (orcs == false)                         //Orcs Dont Speak English
                        {
                            t.PublicOverheadMessage(MessageType.Regular, t.SpeechHue, 500407);
                        }
                        // I have not enough money to give thee any!
                    }
                }
                Reward(m, t, reward, rewardName);
            }
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Material.Deleted )
					return;

				ILoom loom = targeted as ILoom;

				if ( loom == null && targeted is AddonComponent )
					loom = ((AddonComponent)targeted).Addon as ILoom;

				if ( loom != null && loom is Item)
				{
                    Item item = (Item)loom;
					if ( !m_Material.IsChildOf( from.Backpack ) )
					{
						from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
					}
                    else if (loom.Looming)
                    {
                        from.SendMessage("That loom is being used.");
                    }
					else
					{
                        LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment));

                        if (att == null)
                        {
                            att = new LoomQuotaAttachment();
                            XmlAttach.AttachTo(from, att);
                        }
                        if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap)
                        {
                            att.AddLooms(item);
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*");
                            m_Material.Consume();
                            loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, m_Material.Hue, m_Material);
                        }
                        else
                            from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running.");
					}
				}
				else
				{
					from.SendLocalizedMessage( 500367 ); // Try using that on a loom.
				}
			}
                public InternalTimer(Mobile tamer, BaseCreature creature, int count)
                    : base(TimeSpan.FromSeconds(3.0), TimeSpan.FromSeconds(3.0), count)
                {
                    m_Tamer = tamer;
                    m_Creature = creature;
                    m_MaxCount = count;
                    m_Paralyzed = creature.Paralyzed;
                    m_StartTime = DateTime.Now;
                    Priority = TimerPriority.TwoFiftyMS;

                    if (tamer is PlayerMobile)
                        ((PlayerMobile)tamer).ResetPlayerAction(this);

                    m_Tamer.RevealingAction();
                    string msg = "";

                    switch (Utility.Random(3))
                    {
                        case 0:
                            if (!string.IsNullOrEmpty(m_Creature.Name))
                                msg = string.Format("I always wanted {0} like you.", m_Creature.Name);
                            else
                                msg = CliLoc.LocToString(502790);
                            break;

                        case 1:
                            if (!string.IsNullOrEmpty(m_Creature.Name))
                                msg = string.Format("Good {0}.", m_Creature.Name);
                            else
                                msg = CliLoc.LocToString(1005608);
                            break;

                        case 2:
                            if (!string.IsNullOrEmpty(m_Creature.Name))
                                msg = string.Format("Here {0}.", m_Creature.Name);
                            else
                                msg = CliLoc.LocToString(1010593);
                            break;

                        case 3:
                            if (!string.IsNullOrEmpty(m_Creature.Name))
                                msg = string.Format("I won't hurt you");
                            else
                                msg = CliLoc.LocToString(1010593);
                            break;
                    }

                    SpellHelper.Turn(m_Tamer, m_Creature);
                    m_Tamer.PublicOverheadMessage(MessageType.Regular, 906, true, msg);

                }
Exemple #22
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154237);             // *The hat emits a sour smelling odor indicative of spending a significant period of time in the belly of a dragon.*
        }
Exemple #23
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Movable)
            {
                from.SendAsciiMessage("You cannot eat this head");
                return;
            }

            // Fill the Mobile with FillFactor
            if (Food.FillHunger(from, 4))
            {
                // Play a random "eat" sound
                from.PlaySound(Utility.Random(0x3A, 3));

                if (from.Body.IsHuman && !from.Mounted)
                    from.Animate(34, 5, 1, true, false, 0);

                if (PlayerName != null)
                    from.PublicOverheadMessage(Network.MessageType.Emote, 0x22, true, string.Format("*You see {0} eat the head of {1}*", from.Name, m_PlayerName));

                Consume();
            }
        }
Exemple #24
0
                protected override void OnTick()
                {
                    m_Count++;

                    DamageEntry de           = m_Creature.FindMostRecentDamageEntry(false);
                    bool        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 = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous vous êtes trop éloigné pour continuer de l'apprivoiser", 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 = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous êtes morts et ne pouvez donc continuer de l'apprivoiser", 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 = DateTime.Now;
                        m_Tamer.SendMessage("Vous n'arrivez pas à suivre l'animal et devez donc cesser de l'apprivoiser"); // 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 = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cette créature ne peut être apprivoisée", m_Tamer.NetState);                           // That creature cannot be tamed.
                        Stop();
                    }
                    else if (m_Creature.Controlled)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a déjà un maître", 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 = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a eu suffisamment de maître dans le passé et souhaite qu'on le laisse tranquille", 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 = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous devez assujetir cette créature avant de l'apprivoiser", m_Tamer.NetState);                           // You must subdue this creature before you can tame it!
                        Stop();
                    }
                    else if (de != null && de.LastDamage > m_StartTime)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal est trop irrité pour être apprivoisé", 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 = DateTime.Now;
                        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);
                        }

                        double 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[SkillName.Magery].Base = m_Creature.Skills[SkillName.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.SendMessage("L'animal vient instinctivement près de vous");                                   // That wasn't even challenging.
                            }
                            else
                            {
                                m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Il semble vous accepter comme maître", 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, false, "L'animal refuse de vous laisser approcher", m_Tamer.NetState);                               // You fail to tame the creature.
                        }
                    }
                }
Exemple #25
0
		public BandageContext( Mobile healer, Mobile patient, TimeSpan delay, Bandage origin )
		{
			m_Healer = healer;
			m_Patient = patient;

			if( m_Patient != null && !m_Patient.Alive )
			{
				if( m_Healer.Skills[SkillName.Anatomy].Base < 100.0 || m_Healer.Skills[SkillName.Healing].Base < 100.0 )
				{
					if( m_Healer.Skills[SkillName.Anatomy].Base < 100.0 && m_Healer.Skills[SkillName.Healing].Base < 100.0 )
					{
						m_Healer.SendAsciiMessage( "You need GM healing and anatomy to resurrect your target." );
						return;
					}
					else if( m_Healer.Skills[SkillName.Anatomy].Base < 100.0 )
					{
						m_Healer.SendAsciiMessage( "You need GM anatomy to resurrect your target." );
						return;
					}
					else if( m_Healer.Skills[SkillName.Healing].Base < 100.0 )
					{
						m_Healer.SendAsciiMessage( "You need GM healing to resurrect your target." );
						return;
					}
				}

				if( m_Healer.Hits <= 50 )
				{
					m_Healer.SendAsciiMessage( "You need to have more than 50 hp to resurrect your target" );
					return;
				}

				if( m_Patient.Region is HouseRegion )
				{
					m_Healer.SendAsciiMessage( "You can't resurrect people in house regions." );

					//Server.Multis.BaseHouse patientHouse = (m_Patient.Region as HouseRegion).House;

					////The owner can resurrect who ever he wants.
					//if (patientHouse.IsOwner(m_Healer) || patientHouse.IsCoOwner(m_Healer))
					//{
					//    m_Patient.Resurrect();
					//    m_Patient.Hits = 10;
					//    m_Healer.PublicOverheadMessage(MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*");
					//    m_Healer.Hits -= 50;
					//}
					////The patient can be ressed by anoyone as long as he is an owner, co owner or friend
					//else if (patientHouse.IsOwner(m_Patient) || patientHouse.IsCoOwner(m_Patient) || patientHouse.IsFriend(m_Patient))
					//{
					//    m_Patient.Resurrect();
					//    m_Patient.Hits = 10;
					//    m_Healer.PublicOverheadMessage(MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*");
					//    m_Healer.Hits -= 50;
					//}
					//else
					//{
					//    m_Patient.SendAsciiMessage("You cannot be resurrected in this region!");
					//    m_Healer.SendAsciiMessage("You cannot resurrect in this region!");
					//}
				}
				else
				{
					m_Patient.PlaySound( 0x214 );
					m_Patient.Resurrect();
					m_Patient.Hits = 10;
					m_Healer.PublicOverheadMessage( MessageType.Regular, 0x22, true, "*You see " + m_Healer.Name + " resurrecting " + m_Patient.Name + "*" );
					m_Healer.Hits -= 50;
                    origin.Consume(1);
				}
			}
			else
			{
				m_Timer = new InternalTimer( this, delay, origin );
				m_Timer.Start();
			}
		}
Exemple #26
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154233); // *It appears to be the crude schematic to a drilling machine of Orcish origin. It is poorly devised and looks as if one were to build it the machine would explode*
        }
Exemple #27
0
        public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread)
        {
            if (loom.Phase > 4)
            {
                loom.Phase = 0;
                Item item = new BoltOfCloth();
                item.Hue = hue;
                from.AddToBackpack(item);
                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
            }

            LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment));

            if (att == null)
            {
                att = new LoomQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveLooms((Item)loom);

            if (from.NetState == null) // player logged off
            {
                return;
            }
            if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial))
            {
                from.SendMessage("You finished processing all the threads/yarns.");
            }
            else if (!thread.IsChildOf(from.Backpack))
            {
                from.SendMessage("You can not continue without the threads/yarns in your backpack.");
            }
            else if (loom is Item)
            {
                Item loom1 = (Item)loom;

                if (loom1.Deleted)
                {
                    from.SendMessage("Where did the loom go?");
                }
                else if (!from.InRange(loom1.GetWorldLocation(), 3))
                {
                    from.SendMessage("You are too far away from the loom to continue your work.");
                }
                else if (loom.Looming)
                {
                    from.SendMessage("That loom is being used.");
                }
                else
                {
                    if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap)
                    {
                        att.AddLooms(loom1);
                        if (Utility.Random(20 * att.getNumLooms()) < 1)
                        {
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*");
                        }
                        thread.Consume();
                        loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread);
                        return;
                    }
                    else
                    {
                        from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running.");
                    }
                }
            }
        }
                protected override void OnTick()
                {
                    m_Count++;

                    DamageEntry de           = m_Creature.FindMostRecentDamageEntry(false);
                    bool        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 != null && 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);
                        }

                        double minSkill = m_Creature.CurrentTameSkill + (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;

                        minSkill += XmlMobFactions.GetScaledFaction(m_Tamer, m_Creature, -25, 25, -0.001);

                        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[SkillName.Magery].Base = m_Creature.Skills[SkillName.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;

                            m_Creature.OnAfterTame(m_Tamer);

                            PetTrainingHelper.GetAbilityProfile(m_Creature, true).OnTame();
                        }
                        else
                        {
                            m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState);
                            // You fail to tame the creature.
                        }
                    }
                }
Exemple #29
0
		public void CheckTriggers(Mobile m, Skill s, bool hasproximity)
		{
			// only proximity trigger when no spawns have already been triggered
			if (AllowTriggering && !m_proximityActivated)
			{
				bool needs_item_trigger = false;
				bool needs_speech_trigger = false;
				bool needs_skill_trigger = false;
				bool needs_object_trigger = false;
				bool needs_mob_trigger = false;
				bool needs_player_trigger = false;
				bool needs_noitem_trigger = false;
				bool has_object_trigger = false;
				bool has_mob_trigger = false;
				bool has_player_trigger = false;
				bool has_item_trigger = false;
				bool has_noitem_trigger = true;
					// assume the player doesnt have the trigger-blocking item until it is found by search

				m_skipped = false;

				// test for the various triggering options in the order of increasing computational demand.  No point checking a high demand test
				// if a low demand one has already failed.

				// check for external triggering
				if (m_ExternalTriggering && !m_ExternalTrigger)
				{
					return;
				}

				// if speech triggering is set then test for successful activation
				if (m_SpeechTrigger != null && m_SpeechTrigger.Length > 0)
				{
					needs_speech_trigger = true;
				}
				// check to see if we have to continue
				if (needs_speech_trigger && !m_speechTriggerActivated)
				{
					return;
				}

				// if skill triggering is set then test for successful activation
				if (m_SkillTrigger != null && m_SkillTrigger.Length > 0)
				{
					needs_skill_trigger = true;
				}
				// check to see if we have to continue
				if (needs_skill_trigger && !m_skillTriggerActivated)
				{
					return;
				}

				// if item property triggering is set then test for the property value
				//
				if (m_ObjectPropertyName != null && m_ObjectPropertyName.Length > 0)
				{
					needs_object_trigger = true;
					string status_str;

					if (BaseXmlSpawner.TestItemProperty(this, m_ObjectPropertyItem, m_ObjectPropertyName, null, out status_str))
					{
						has_object_trigger = true;
					}
					else
					{
						has_object_trigger = false;
					}
					if (status_str != null && status_str.Length > 0)
					{
						this.status_str = status_str;
					}
				}

				// check to see if we have to continue
				if (needs_object_trigger && !has_object_trigger)
				{
					return;
				}

				// if player property triggering is set then look for the mob and test properties
				if (m_PlayerPropertyName != null && m_PlayerPropertyName.Length > 0)
				{
					needs_player_trigger = true;
					string status_str;

					if (BaseXmlSpawner.TestMobProperty(this, m, m_PlayerPropertyName, null, out status_str))
					{
						has_player_trigger = true;
					}
					else
					{
						has_player_trigger = false;
					}
					if (status_str != null && status_str.Length > 0)
					{
						this.status_str = status_str;
					}
				}

				// check to see if we have to continue
				if (needs_player_trigger && !has_player_trigger)
				{
					return;
				}

				// if mob property triggering is set then look for the mob and test properties
				if (m_MobPropertyName != null && m_MobPropertyName.Length > 0 && m_MobTriggerName != null &&
					m_MobTriggerName.Length > 0)
				{
					needs_mob_trigger = true;

					string status_str;

					if (BaseXmlSpawner.TestMobProperty(this, MobTriggerId, m_MobPropertyName, null, out status_str))
					{
						has_mob_trigger = true;
					}
					else
					{
						has_mob_trigger = false;
					}

					if (status_str != null && status_str.Length > 0)
					{
						this.status_str = status_str;
					}
				}

				// check to see if we have to continue
				if (needs_mob_trigger && !has_mob_trigger)
				{
					return;
				}

				// if player-carried item triggering is set then test for the presence of an item on the player an in their pack
				if (m_ItemTriggerName != null && m_ItemTriggerName.Length > 0)
				{
					//enable_triggering = false;
					needs_item_trigger = true;

					has_item_trigger = BaseXmlSpawner.CheckForCarried(m, m_ItemTriggerName);
				}
				// check to see if we have to continue
				if (needs_item_trigger && !has_item_trigger)
				{
					return;
				}

				// if player-carried noitem triggering is set then test for the presence of an item in the players pack that should block triggering
				if (m_NoItemTriggerName != null && m_NoItemTriggerName.Length > 0)
				{
					needs_noitem_trigger = true;

					has_noitem_trigger = BaseXmlSpawner.CheckForNotCarried(m, m_NoItemTriggerName);
				}
				// check to see if we have to continue
				if (needs_noitem_trigger && !has_noitem_trigger)
				{
					return;
				}

				// if this was called without being proximity triggered then check to see that the non-movement triggers were enabled.
				if (!hasproximity && !needs_object_trigger && !needs_mob_trigger && !m_ExternalTriggering)
				{
					return;
				}

				// all of the necessary trigger conditions have been met so go ahead and trigger
				// after you make the probability check

				if (Utility.RandomDouble() < m_TriggerProbability)
				{
					// play a sound indicating the spawner has been triggered
					if (m_ProximityTriggerSound > 0 && m != null && !m.Deleted)
					{
						m.PlaySound(m_ProximityTriggerSound);
					}

					// display the trigger message
					if (m_ProximityTriggerMessage != null && m_ProximityTriggerMessage.Length > 0 && m != null && !m.Deleted)
					{
						m.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, m_ProximityTriggerMessage);
					}

					// enable spawning at the next ontick
					// this will also start the refractory timer and send the triggering indicators
					ProximityActivated = true;

					// keep track of who triggered this
					m_mob_who_triggered = m;

					// keep track of the skill that triggered this
					if (s != null)
					{
						m_skill_that_triggered = s.SkillName;
					}
					else
					{
						m_skill_that_triggered = XmlSpawnerSkillCheck.RegisteredSkill.Invalid;
					}
				}
				else
				{
					m_skipped = true;
					// reset speech triggering if it was set

					m_speechTriggerActivated = false;

					// reset skill triggering if it was set
					m_skillTriggerActivated = false;
					// reset external triggering if it was set
					//this.m_ExternalTrigger = false;
				}
			}
		}
        private void DoEffect(object state)
        {
            if (this.Deleted)
            {
                return;
            }

            object[] states = (object[])state;

            Point3D p    = (Point3D)states[0];
            Mobile  from = (Mobile)states[1];

            if (_Tick == 1)
            {
                Effects.SendLocationEffect(p, this.Map, 0x352D, 16, 4);
                Effects.PlaySound(p, this.Map, 0x364);
            }
            else if (_Tick <= 7 || _Tick == 14)
            {
                if (this.RequireDeepWater)
                {
                    for (int i = 0; i < 3; ++i)
                    {
                        int x, y = 0;

                        do
                        {
                            x = Utility.RandomMinMax(-1, 1);
                            y = Utility.RandomMinMax(-1, 1);
                        }while (x == 0 && y == 0);

                        Effects.SendLocationEffect(new Point3D(p.X + x, p.Y + y, p.Z), this.Map, 0x352D, 16, 4);
                    }

                    if (_Tick == 14)
                    {
                        if (0.6 >= Utility.RandomDouble())
                        {
                            if (0.5 >= Utility.RandomDouble())
                            {
                                from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154218); // *The line snaps tight as you snare a piece of wreckage from the sea floor!*

                                from.AddToBackpack(new BrokenShipwreckRemains());
                            }
                            else
                            {
                                SpawnBaddies(p, this.Map, from);
                            }
                        }

                        //TODO: Message?

                        this.Delete();
                    }
                }
                else
                {
                    Effects.SendLocationEffect(p, this.Map, 0x352D, 16, 4);
                }

                if (Utility.RandomBool())
                {
                    Effects.PlaySound(p, this.Map, 0x364);
                }

                this.Z -= 1;
            }

            _Tick++;
        }
Exemple #31
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154247);             // *As you hold the pendant in your hands you suddenly feel as though you no longer need to breathe.  The pendant pulses with magical energy!*
        }
Exemple #32
0
        public static void HungerDecay(Mobile m)
        {
            if (m != null && m is Player)
            {
                Adventurer adv = Perk.GetByType <Adventurer>((Player)m);

                if (adv != null)
                {
                    if (Utility.RandomDouble() < 0.33 && m.Hunger < 20)
                    {
                        m.Hunger += adv.HungerThirstBonus();
                    }
                }
            }

            if ((m != null && m.Alive && m.Hunger >= 1 && m.AccessLevel == AccessLevel.Player) &&
                ((Player)m).Race != Race.Liche && ((Player)m).Race != Race.Elemental)
            {
                m.Hunger--;
            }

            if (m != null && m.Alive)
            {
                if (m.Hunger > 14)
                {
                    return;
                }

                else if (m.Hunger >= 10 && m.Hunger <= 14)
                {
                    m.SendMessage("You feel somewhat hungry.");
                }

                else if (m.Hunger >= 5 && m.Hunger < 10)
                {
                    m.SendMessage("You feel quite hungry.");
                }

                else if (m.Hunger > 0 && m.Hunger < 5)
                {
                    m.SendMessage("You are very hungry, and should find something to eat.");
                }

                else
                {
                    m.SendMessage("Your lack of food is wasting away at your body!");
                    m.Damage(Utility.RandomMinMax(25, 45));
                    m.Stam -= Utility.RandomMinMax(20, 30);
                    m.Mana -= Utility.RandomMinMax(20, 30);
                }

                if (m.Hunger < 10)
                {
                    m.PublicOverheadMessage(MessageType.Regular, m.EmoteHue, true, String.Format("*{0} stomach growls softly*", m.Female ? "her" : "his"));

                    if (m.Hidden)
                    {
                        m.RevealingAction();
                    }
                }
            }
        }
Exemple #33
0
        public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus )
        {
            #region coisa de ninja, nao usaremos por agora

            if ( MirrorImage.HasClone( defender ) && (defender.Skills.Ninjitsu.Value / 150.0) > Utility.RandomDouble() )
            {
                Clone bc;

                foreach ( Mobile m in defender.GetMobilesInRange( 4 ) )
                {
                    bc = m as Clone;

                    if ( bc != null && bc.Summoned && bc.SummonMaster == defender )
                    {
                        attacker.SendLocalizedMessage( 1063141 ); // Your attack has been diverted to a nearby mirror image of your target!
                        defender.SendLocalizedMessage( 1063140 ); // You manage to divert the attack onto one of your nearby mirror images.

                        /*
                         * TODO: What happens if the Clone parries a blow?
                         * And what about if the attacker is using Honorable Execution
                         * and kills it?
                         */

                        defender = m;
                        break;
                    }
                }
            }

            #endregion

            PlaySwingAnimation( attacker );
            PlayHurtAnimation( defender );

            attacker.PlaySound( GetHitAttackSound( attacker, defender ) );
            defender.PlaySound( GetHitDefendSound( attacker, defender ) );

            //onde o dano e computado
            int damage = ComputeDamage( attacker, defender );

            #region Kaltar, bonus de dano por habilidade

            //adiciona o bonus da habilidade
            int habilidadeBonus = 0;
            if (attacker is Jogador)
            {
                habilidadeBonus = CombateUtil.Instance.danoBonus((Jogador)attacker, defender);
                damage += habilidadeBonus;
            }

            #endregion

            #region Damage Multipliers
            /*
             * The following damage bonuses multiply damage by a factor.
             * Capped at x3 (300%).
             */
            //double factor = 1.0;
            int percentageBonus = 0;

            WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );
            SpecialMove move = SpecialMove.GetCurrentMove( attacker );

            if( a != null )
            {
                //factor *= a.DamageScalar;
                percentageBonus += (int)(a.DamageScalar * 100) - 100;
            }

            if( move != null )
            {
                //factor *= move.GetDamageScalar( attacker, defender );
                percentageBonus += (int)(move.GetDamageScalar( attacker, defender ) * 100) - 100;
            }

            //factor *= damageBonus;
            percentageBonus += (int)(damageBonus * 100) - 100;

            CheckSlayerResult cs = CheckSlayers( attacker, defender );

            if ( cs != CheckSlayerResult.None )
            {
                if ( cs == CheckSlayerResult.Slayer )
                    defender.FixedEffect( 0x37B9, 10, 5 );

                //factor *= 2.0;
                percentageBonus += 100;
            }

            if ( !attacker.Player )
            {
                if ( defender is PlayerMobile )
                {
                    PlayerMobile pm = (PlayerMobile)defender;

                    if( pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType() )
                    {
                        //factor *= 2.0;
                        percentageBonus += 100;
                    }
                }
            }
            else if ( !defender.Player )
            {
                if ( attacker is PlayerMobile )
                {
                    PlayerMobile pm = (PlayerMobile)attacker;

                    if ( pm.WaitingForEnemy )
                    {
                        pm.EnemyOfOneType = defender.GetType();
                        pm.WaitingForEnemy = false;
                    }

                    if ( pm.EnemyOfOneType == defender.GetType() )
                    {
                        defender.FixedEffect( 0x37B9, 10, 5, 1160, 0 );
                        //factor *= 1.5;
                        percentageBonus += 50;
                    }
                }
            }

            int packInstinctBonus = GetPackInstinctBonus( attacker, defender );

            if( packInstinctBonus != 0 )
            {
                //factor *= 1.0 + (double)packInstinctBonus / 100.0;
                percentageBonus += packInstinctBonus;
            }

            if( m_InDoubleStrike )
            {
                //factor *= 0.9; // 10% loss when attacking with double-strike
                percentageBonus -= 10;
            }

            TransformContext context = TransformationSpellHelper.GetContext( defender );

            if( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Spell is NecromancerSpell && context.Type != typeof( HorrificBeastSpell ) )
            {
                //factor *= 1.25; // Every necromancer transformation other than horrific beast takes an additional 25% damage
                percentageBonus += 25;
            }

            if ( attacker is PlayerMobile && !(Core.ML && defender is PlayerMobile ))
            {
                PlayerMobile pmAttacker = (PlayerMobile) attacker;

                if( pmAttacker.HonorActive && pmAttacker.InRange( defender, 1 ) )
                {
                    //factor *= 1.25;
                    percentageBonus += 25;
                }

                if( pmAttacker.SentHonorContext != null && pmAttacker.SentHonorContext.Target == defender )
                {
                    //pmAttacker.SentHonorContext.ApplyPerfectionDamageBonus( ref factor );
                    percentageBonus += pmAttacker.SentHonorContext.PerfectionDamageBonus;
                }
            }

            //if ( factor > 3.0 )
            //	factor = 3.0;

            percentageBonus = Math.Min( percentageBonus, 300 );

            //damage = (int)(damage * factor);
            damage = AOS.Scale( damage, 100 + percentageBonus );
            #endregion

            #region ataque crítico

            //bonus de habilida para ataque crítico
            int bonusChanceAtaqueCritico = 0;
            int bonusDanoAtaqueCritico = 0;
            if (attacker is Jogador)
            {
                bonusChanceAtaqueCritico = CombateUtil.Instance.chanceAtaqueCriticoBonus((Jogador)attacker, defender);
                bonusDanoAtaqueCritico = CombateUtil.Instance.danoAtaqueCriticoBonus((Jogador)attacker, defender);
            }

            double chanceAtaqueCritico = (5.0 + bonusChanceAtaqueCritico) / 100.0;   //chance de 5% de acertar um ataque crítico
            int porcentagemDeDanoAtaqueCritico = 100 + bonusDanoAtaqueCritico;    //100% de dano a mais no ataque crítico

            //Console.WriteLine("Chance de critivo: {0} randor {1}", chanceAtaqueCritico, Utility.RandomDouble());

            //teste pata verificar se foi ataque crítico
            if (chanceAtaqueCritico > Utility.RandomDouble())
            {
                attacker.PublicOverheadMessage(MessageType.Regular, 0, false, "Crítico!!!");
                defender.PrivateOverheadMessage(MessageType.Regular, 0, false, "Recebeu ataque crítico!", defender.NetState);

                //Console.WriteLine("Dano normal {0}", damage);

                //calcula a porcentagem no dano.
                damage = AOS.Scale(damage, 100 + porcentagemDeDanoAtaqueCritico);

                //Console.WriteLine("Dano critico {0}", damage);

                //evento quando ocorre um ataque crítico
                CombateUtil.Instance.onAtaqueCritico(attacker, defender, damage);
            }

            #endregion

            if ( attacker is BaseCreature )
                ((BaseCreature)attacker).AlterMeleeDamageTo( defender, ref damage );

            if ( defender is BaseCreature )
                ((BaseCreature)defender).AlterMeleeDamageFrom( attacker, ref damage );

            damage = AbsorbDamage( attacker, defender, damage );

            if ( !Core.AOS && damage < 1 )
                damage = 1;
            else if ( Core.AOS && damage == 0 ) // parried
            {
                if ( a != null && a.Validate( attacker ) /*&& a.CheckMana( attacker, true )*/ ) // Parried special moves have no mana cost
                {
                    a = null;
                    WeaponAbility.ClearCurrentAbility( attacker );

                    attacker.SendLocalizedMessage( 1061140 ); // Your attack was parried!
                }
            }

            AddBlood( attacker, defender, damage );

            int phys, fire, cold, pois, nrgy;

            GetDamageTypes( attacker, out phys, out fire, out cold, out pois, out nrgy );

            #region consecrated

            if ( m_Consecrated )
            {
                phys = defender.PhysicalResistance;
                fire = defender.FireResistance;
                cold = defender.ColdResistance;
                pois = defender.PoisonResistance;
                nrgy = defender.EnergyResistance;

                int low = phys, type = 0;

                if ( fire < low ){ low = fire; type = 1; }
                if ( cold < low ){ low = cold; type = 2; }
                if ( pois < low ){ low = pois; type = 3; }
                if ( nrgy < low ){ low = nrgy; type = 4; }

                phys = fire = cold = pois = nrgy = 0;

                if ( type == 0 ) phys = 100;
                else if ( type == 1 ) fire = 100;
                else if ( type == 2 ) cold = 100;
                else if ( type == 3 ) pois = 100;
                else if ( type == 4 ) nrgy = 100;
            }

            #endregion

            int damageGiven = damage;

            if ( a != null && !a.OnBeforeDamage( attacker, defender ) )
            {
                WeaponAbility.ClearCurrentAbility( attacker );
                a = null;
            }

            if ( move != null && !move.OnBeforeDamage( attacker, defender ) )
            {
                SpecialMove.ClearCurrentMove( attacker );
                move = null;
            }

            bool ignoreArmor = ( a is ArmorIgnore || (move != null && move.IgnoreArmor( attacker )) );

            //calculo do dano pelo seu tipo e resistencia
            damageGiven = AOS.Damage( defender, attacker, damage, ignoreArmor, phys, fire, cold, pois, nrgy );

            double propertyBonus = ( move == null ) ? 1.0 : move.GetPropertyBonus( attacker );

            #region Leech Habilidades das armas de sugar coisas Hits, Mana e Stamina

            if ( Core.AOS )
            {
                int lifeLeech = 0;
                int stamLeech = 0;
                int manaLeech = 0;
                int wraithLeech = 0;

                if ( (int)(m_AosWeaponAttributes.HitLeechHits * propertyBonus) > Utility.Random( 100 ) )
                    lifeLeech += 30; // HitLeechHits% chance to leech 30% of damage as hit points

                if ( (int)(m_AosWeaponAttributes.HitLeechStam * propertyBonus) > Utility.Random( 100 ) )
                    stamLeech += 100; // HitLeechStam% chance to leech 100% of damage as stamina

                if ( (int)(m_AosWeaponAttributes.HitLeechMana * propertyBonus) > Utility.Random( 100 ) )
                    manaLeech += 40; // HitLeechMana% chance to leech 40% of damage as mana

                if ( m_Cursed )
                    lifeLeech += 50; // Additional 50% life leech for cursed weapons (necro spell)

                context = TransformationSpellHelper.GetContext( attacker );

                if ( context != null && context.Type == typeof( VampiricEmbraceSpell ) )
                    lifeLeech += 20; // Vampiric embrace gives an additional 20% life leech

                if ( context != null && context.Type == typeof( WraithFormSpell ) )
                {
                    wraithLeech = (5 + (int)((15 * attacker.Skills.SpiritSpeak.Value) / 100)); // Wraith form gives an additional 5-20% mana leech

                    // Mana leeched by the Wraith Form spell is actually stolen, not just leeched.
                    defender.Mana -= AOS.Scale( damageGiven, wraithLeech );

                    manaLeech += wraithLeech;
                }

                if ( lifeLeech != 0 )
                    attacker.Hits += AOS.Scale( damageGiven, lifeLeech );

                if ( stamLeech != 0 )
                    attacker.Stam += AOS.Scale( damageGiven, stamLeech );

                if ( manaLeech != 0 )
                    attacker.Mana += AOS.Scale( damageGiven, manaLeech );

                if ( lifeLeech != 0 || stamLeech != 0 || manaLeech != 0 )
                    attacker.PlaySound( 0x44D );
            }

            #endregion

            #region defensor e slime ou toxicElemental para destruir arma

            if ( m_MaxHits > 0 && ((MaxRange <= 1 && (defender is Slime || defender is ToxicElemental)) || Utility.Random( 25 ) == 0) ) // Stratics says 50% chance, seems more like 4%..
            {
                if ( MaxRange <= 1 && (defender is Slime || defender is ToxicElemental) )
                    attacker.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500263 ); // *Acid blood scars your weapon!*

                if ( Core.AOS && m_AosWeaponAttributes.SelfRepair > Utility.Random( 10 ) )
                {
                    HitPoints += 2;
                }
                else
                {
                    if ( m_Hits > 0 )
                    {
                        --HitPoints;
                    }
                    else if ( m_MaxHits > 1 )
                    {
                        --MaxHitPoints;

                        if ( Parent is Mobile )
                            ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
                    }
                    else
                    {
                        Delete();
                    }
                }
            }

            #endregion

            #region se o atacando for um familiar vampiro dar HP para o mestre
            if ( attacker is VampireBatFamiliar )
            {
                BaseCreature bc = (BaseCreature)attacker;
                Mobile caster = bc.ControlMaster;

                if ( caster == null )
                    caster = bc.SummonMaster;

                if ( caster != null && caster.Map == bc.Map && caster.InRange( bc, 2 ) )
                    caster.Hits += damage;
                else
                    bc.Hits += damage;
            }

            #endregion

            #region Efeitos magicos das armas

            if ( Core.AOS )
            {
                int physChance = (int)(m_AosWeaponAttributes.HitPhysicalArea * propertyBonus);
                int fireChance = (int)(m_AosWeaponAttributes.HitFireArea * propertyBonus);
                int coldChance = (int)(m_AosWeaponAttributes.HitColdArea * propertyBonus);
                int poisChance = (int)(m_AosWeaponAttributes.HitPoisonArea * propertyBonus);
                int nrgyChance = (int)(m_AosWeaponAttributes.HitEnergyArea * propertyBonus);

                if ( physChance != 0 && physChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x10E,   50, 100, 0, 0, 0, 0 );

                if ( fireChance != 0 && fireChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x11D, 1160, 0, 100, 0, 0, 0 );

                if ( coldChance != 0 && coldChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x0FC, 2100, 0, 0, 100, 0, 0 );

                if ( poisChance != 0 && poisChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x205, 1166, 0, 0, 0, 100, 0 );

                if ( nrgyChance != 0 && nrgyChance > Utility.Random( 100 ) )
                    DoAreaAttack( attacker, defender, 0x1F1,  120, 0, 0, 0, 0, 100 );

                int maChance = (int)(m_AosWeaponAttributes.HitMagicArrow * propertyBonus);
                int harmChance = (int)(m_AosWeaponAttributes.HitHarm * propertyBonus);
                int fireballChance = (int)(m_AosWeaponAttributes.HitFireball * propertyBonus);
                int lightningChance = (int)(m_AosWeaponAttributes.HitLightning * propertyBonus);
                int dispelChance = (int)(m_AosWeaponAttributes.HitDispel * propertyBonus);

                if ( maChance != 0 && maChance > Utility.Random( 100 ) )
                    DoMagicArrow( attacker, defender );

                if ( harmChance != 0 && harmChance > Utility.Random( 100 ) )
                    DoHarm( attacker, defender );

                if ( fireballChance != 0 && fireballChance > Utility.Random( 100 ) )
                    DoFireball( attacker, defender );

                if ( lightningChance != 0 && lightningChance > Utility.Random( 100 ) )
                    DoLightning( attacker, defender );

                if ( dispelChance != 0 && dispelChance > Utility.Random( 100 ) )
                    DoDispel( attacker, defender );

                int laChance = (int)(m_AosWeaponAttributes.HitLowerAttack * propertyBonus);
                int ldChance = (int)(m_AosWeaponAttributes.HitLowerDefend * propertyBonus);

                if ( laChance != 0 && laChance > Utility.Random( 100 ) )
                    DoLowerAttack( attacker, defender );

                if ( ldChance != 0 && ldChance > Utility.Random( 100 ) )
                    DoLowerDefense( attacker, defender );
            }

            #endregion

            if ( attacker is BaseCreature )
                ((BaseCreature)attacker).OnGaveMeleeAttack( defender );

            if ( defender is BaseCreature )
                ((BaseCreature)defender).OnGotMeleeAttack( attacker );

            if ( a != null )
                a.OnHit( attacker, defender, damage );

            if ( move != null )
                move.OnHit( attacker, defender, damage );

            if ( defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null )
                ((IHonorTarget)defender).ReceivedHonorContext.OnTargetHit( attacker );

            if ( !(this is BaseRanged) )
            {
                if ( AnimalForm.UnderTransformation( attacker, typeof( GiantSerpent ) ) )
                    defender.ApplyPoison( attacker, Poison.Lesser );

                if ( AnimalForm.UnderTransformation( defender, typeof( BullFrog ) ) )
                    attacker.ApplyPoison( defender, Poison.Regular );
            }
        }
Exemple #34
0
        public override void OnDoubleClick(Mobile from)
        {
            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154226); // *It's an unassuming strong box. You examine the lock more closely and determine there is no way to pick it. You'll need to find a key.*

            base.OnDoubleClick(from);
        }
Exemple #35
0
                protected override void OnTick()
                {
                    Container theirPack = m_Target.Backpack;

                    double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570);

                    if (theirPack == null)
                    {
                        m_From.SendLocalizedMessage(500404);                         // They seem unwilling to give you any money.
                    }
                    else if (m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0))
                    {
                        int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                        int max       = 10 + (m_From.Fame / 2500);

                        if (max > 14)
                        {
                            max = 14;
                        }
                        else if (max < 10)
                        {
                            max = 10;
                        }

                        if (toConsume > max)
                        {
                            toConsume = max;
                        }

                        if (toConsume > 0)
                        {
                            int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                            if (consumed > 0)
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405);                                 // I feel sorry for thee...

                                Gold gold = new Gold(consumed);

                                m_From.AddToBackpack(gold);
                                m_From.PlaySound(gold.GetDropSound());

                                if (m_From.Karma > -3000)
                                {
                                    int toLose = m_From.Karma + 3000;

                                    if (toLose > 40)
                                    {
                                        toLose = 40;
                                    }

                                    Titles.AwardKarma(m_From, -toLose, true);
                                }
                            }
                            else
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);
                                // I have not enough money to give thee any!
                            }
                        }
                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);
                            // I have not enough money to give thee any!
                        }
                    }
                    else
                    {
                        m_Target.SendLocalizedMessage(500404);                         // They seem unwilling to give you any money.
                    }

                    m_From.NextSkillTime = Core.TickCount + 10000;
                }
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Cotton.Deleted )
					return;

				ISpinningWheel wheel = targeted as ISpinningWheel;

				if ( wheel == null && targeted is AddonComponent )
					wheel = ((AddonComponent)targeted).Addon as ISpinningWheel;

				if ( wheel is Item )
				{
					Item item = (Item)wheel;

					if ( !m_Cotton.IsChildOf( from.Backpack ) )
					{
						from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
					}
					else if ( wheel.Spinning )
					{
						from.SendLocalizedMessage( 502656 ); // That spinning wheel is being used.
					}
					else
					{
                        SpinningWheelQuotaAttachment att = (SpinningWheelQuotaAttachment)XmlAttach.FindAttachment(from, typeof(SpinningWheelQuotaAttachment));

                        if (att == null)
                        {
                            att = new SpinningWheelQuotaAttachment();
                            XmlAttach.AttachTo(from, att);
                        }
                        if (att.getNumWheels() < SpinningWheelQuotaAttachment.m_WheelQuotaCap)
                        {
                            att.AddWheels(item);
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*spinning*");
                            m_Cotton.Consume();
                            wheel.BeginSpin(new SpinCallback(Cotton.OnSpunLoop), from, m_Cotton.Hue, m_Cotton);
                        }
                        else
                            from.SendMessage("You are too occupied with the " + SpinningWheelQuotaAttachment.m_WheelQuotaCap.ToString() + " spinning wheels you are running.");
					}
				}
				else
				{
					from.SendLocalizedMessage( 502658 ); // Use that on a spinning wheel.
				}
			}
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();                 //Reveals Beggers

                int number = -1;

                if (targeted is Mobile)                   //Determine the Creature
                {
                    Mobile targ = (Mobile)targeted;       //Rename to Targ

                    bool orcs = IsOrc(targ);              //Sets True/False for Orc

                    if (targ.Player)                      // We can't beg from players
                    {
                        number = 500398;                  // Perhaps just asking would work better.
                    }
                    else if (!targ.Body.IsHuman && !orcs) // Make sure the NPC is human | or Orc
                    {
                        number = 500399;                  // There is little chance of getting money from that!
                    }
                    else if (!from.InRange(targ, 2))      //Gender Differences
                    {
                        if (!targ.Female)
                        {
                            number = 500401;                             // You are too far away to beg from him.
                        }
                        else
                        {
                            number = 500402;                             // You are too far away to beg from her.
                        }
                    }
                    else if (from.Mounted)                     // If we're on a mount, who would give us money? Possible used on server?
                    {
                        number = 500404;                       // They seem unwilling to give you any money.
                    }

                    else
                    {
                        if (targ is BaseVendor)                         //Vendors Themselves are on a 60-90 minute cool down to help prevent macroing
                        {
                            DateTime   now      = DateTime.UtcNow;
                            BaseVendor targvend = targ as BaseVendor;                   //Is Target Vendor?
                            //	Console.WriteLine(targvend.GeneralNextBegging);
                            if (targvend.NextBegging > now)                             //Vendor be used
                            {
                                from.SendLocalizedMessage(500404);                      // They seem unwilling to give you any money.
                                return;
                            }
                            else
                            {
                                //		Console.WriteLine(targvend.GeneralNextBegging);
                                targvend.NextBegging = now + TimeSpan.FromMinutes(Utility.RandomMinMax(60, 90));                                 //Set Vendor Timer 60-90 minutes (Change for Balance)
                            }
                        }
                        else
                        {
                            DateTime     now       = DateTime.UtcNow;
                            BaseCreature targcreat = targ as BaseCreature;
                            //	Console.WriteLine(targcreat.GeneralNextBegging);
                            if (targcreat.GeneralNextBegging > now)                             //Vendor be used
                            {
                                from.SendLocalizedMessage(500404);                              // They seem unwilling to give you any money.
                                return;
                            }
                            else
                            {
                                //		Console.WriteLine(targcreat.GeneralNextBegging);
                                targcreat.GeneralNextBegging = now + TimeSpan.FromMinutes(Utility.RandomMinMax(5, 10));                                 //Set Vendor Timer 60-90 minutes (Change for Balance)
                            }
                        }
                        // Face eachother
                        from.Direction = from.GetDirectionTo(targ);
                        targ.Direction = targ.GetDirectionTo(from);

                        from.Animate(32, 5, 1, true, false, 0);                         // Bow
                        switch (Utility.Random(2))
                        {
                        case 0: from.PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Please could you spare some change"); break;

                        case 1: from.PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Anything you give will help. Please"); break;

                        case 2: from.PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Do you really need that item?"); break;
                        }
                        new InternalTimer(from, targ).Start();                         //Commence Timer

                        m_SetSkillTime = false;
                    }
                }
                else                 // Not a Mobile
                {
                    number = 500399; // There is little chance of getting money from that!
                }

                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }
        public static void OnSpunLoop(ISpinningWheel wheel, Mobile from, int hue, Item cotton)
        {
            Item item = new SpoolOfThread(3);
            item.Hue = hue;
            from.AddToBackpack(item);

            SpinningWheelQuotaAttachment att = (SpinningWheelQuotaAttachment)XmlAttach.FindAttachment(from, typeof(SpinningWheelQuotaAttachment));
            if (att == null)
            {
                att = new SpinningWheelQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveWheels((Item)wheel);

            if (from.NetState == null) // player logged off
                return;
            if (cotton.Deleted || cotton.Amount < 1 || !(cotton is Cotton))
                from.SendMessage("You finished processing all the cotton.");
            else if (!cotton.IsChildOf(from.Backpack))
                from.SendMessage("You can not continue without the cotton in your backpack.");
            else if (wheel is Item)
            {
                Item wheel1 = (Item)wheel;

                if (wheel1.Deleted)
                    from.SendMessage("Where did the spinning wheel go?");
                else if (!from.InRange(wheel1.GetWorldLocation(), 3))
                    from.SendMessage("You are too far away from the spinning wheel to continue your work.");
                else if (wheel.Spinning)
                    from.SendLocalizedMessage(502656); // That spinning wheel is being used.
                else
                {
                    if (att.getNumWheels() < SpinningWheelQuotaAttachment.m_WheelQuotaCap)
                    {
                        att.AddWheels(wheel1);
                        if (Utility.Random(6 * att.getNumWheels()) < 1)
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*spinning*");
                        cotton.Consume();
                        wheel.BeginSpin(new SpinCallback(Cotton.OnSpunLoop), from, cotton.Hue, cotton);
                        return;
                    }
                    else
                        from.SendMessage("You are too occupied with the " + SpinningWheelQuotaAttachment.m_WheelQuotaCap.ToString() + " spinning wheels you are running.");
                }
            }
            from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
        }
Exemple #39
0
 public static void Say(this Mobile mobile, string text, int hue, bool ascii = false)
 {
     mobile.PublicOverheadMessage(MessageType.Regular, hue, ascii, text);
 }
Exemple #40
0
                protected override void OnTick()
                {
                    Container theirPack = m_Target.Backpack;

                    double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570);

                    if (theirPack == null && m_Target.Race != Race.Elf)
                    {
                        m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                    }
                    else if (m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0))
                    {
                        if (m_Target.Race != Race.Elf)
                        {
                            int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                            int max       = 10 + (m_From.Fame / 2500);

                            if (max > 14)
                            {
                                max = 14;
                            }
                            else if (max < 10)
                            {
                                max = 10;
                            }

                            if (toConsume > max)
                            {
                                toConsume = max;
                            }

                            if (toConsume > 0)
                            {
                                int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                                if (consumed > 0)
                                {
                                    m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405);
                                    // I feel sorry for thee...

                                    Gold gold = new Gold(consumed);

                                    m_From.AddToBackpack(gold);
                                    m_From.PlaySound(gold.GetDropSound());

                                    if (m_From.Karma > -3000)
                                    {
                                        int toLose = m_From.Karma + 3000;

                                        if (toLose > 40)
                                        {
                                            toLose = 40;
                                        }

                                        Titles.AwardKarma(m_From, -toLose, true);
                                    }
                                }
                                else
                                {
                                    m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);
                                    // I have not enough money to give thee any!
                                }
                            }
                            else
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);
                                // I have not enough money to give thee any!
                            }
                        }
                        else
                        {
                            double chance     = Utility.RandomDouble();
                            Item   reward     = new Gold(1);
                            string rewardName = "";
                            if (chance >= .99)
                            {
                                int rand = Utility.Random(8);

                                if (rand == 0)
                                {
                                    reward     = new BegBedRoll();
                                    rewardName = "a bedroll";
                                }
                                else if (rand == 1)
                                {
                                    reward     = new BegCookies();
                                    rewardName = "a plate of cookies.";
                                }
                                else if (rand == 2)
                                {
                                    reward     = new BegFishSteak();
                                    rewardName = "a fish steak.";
                                }
                                else if (rand == 3)
                                {
                                    reward     = new BegFishingPole();
                                    rewardName = "a fishing pole.";
                                }
                                else if (rand == 4)
                                {
                                    reward     = new BegFlowerGarland();
                                    rewardName = "a flower garland.";
                                }
                                else if (rand == 5)
                                {
                                    reward     = new BegSake();
                                    rewardName = "a bottle of Sake.";
                                }
                                else if (rand == 6)
                                {
                                    reward     = new BegTurnip();
                                    rewardName = "a turnip.";
                                }
                                else if (rand == 7)
                                {
                                    reward     = new BegWine();
                                    rewardName = "a Bottle of wine.";
                                }
                                else if (rand == 8)
                                {
                                    reward     = new BegWinePitcher();
                                    rewardName = "a Pitcher of wine.";
                                }
                            }
                            else if (chance >= .76)
                            {
                                int rand = Utility.Random(6);

                                if (rand == 0)
                                {
                                    reward     = new BegStew();
                                    rewardName = "a bowl of stew.";
                                }
                                else if (rand == 1)
                                {
                                    reward     = new BegCheeseWedge();
                                    rewardName = "a wedge of cheese.";
                                }
                                else if (rand == 2)
                                {
                                    reward     = new BegDates();
                                    rewardName = "a bunch of dates.";
                                }
                                else if (rand == 3)
                                {
                                    reward     = new BegLantern();
                                    rewardName = "a lantern.";
                                }
                                else if (rand == 4)
                                {
                                    reward     = new BegLiquorPitcher();
                                    rewardName = "a Pitcher of liquor";
                                }
                                else if (rand == 5)
                                {
                                    reward     = new BegPizza();
                                    rewardName = "pizza";
                                }
                                else if (rand == 6)
                                {
                                    reward     = new BegShirt();
                                    rewardName = "a shirt.";
                                }
                            }
                            else if (chance >= .25)
                            {
                                int rand = Utility.Random(1);

                                if (rand == 0)
                                {
                                    reward     = new BegFrenchBread();
                                    rewardName = "french bread.";
                                }
                                else
                                {
                                    reward     = new BegWaterPitcher();
                                    rewardName = "a Pitcher of water.";
                                }
                            }

                            m_Target.Say(1074854);                            // Here, take this...
                            m_From.AddToBackpack(reward);
                            m_From.SendLocalizedMessage(1074853, rewardName); // You have been given ~1_name~

                            if (m_From.Karma > -3000)
                            {
                                int toLose = m_From.Karma + 3000;

                                if (toLose > 40)
                                {
                                    toLose = 40;
                                }

                                Titles.AwardKarma(m_From, -toLose, true);
                            }
                        }
                    }

                    else
                    {
                        m_Target.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                    }


                    m_From.NextSkillTime = Core.TickCount + 10000;
                }
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154241); // *It is a beautifully and masterfully crafted blade. The hilt bears the family crest of the former owner*
        }
Exemple #42
0
        public bool ReceivePrize(Mobile from, int seed)
        {
            Item   i    = null;
            string text = "";

            if (seed <= 5)
            {
                text = "You win a brown bear rug!";
                i    = new BrownBearRugSouthDeed();
            }
            else if (seed < 10)
            {
                text = "You win a brown bear rug!";
                i    = new BrownBearRugEastDeed();
            }
            else if (seed < 25)
            {
                text  = "You win pet dye!";
                i     = new PetDye();
                i.Hue = Utility.RandomList(2419, 2418, 2413, 2406, 2215, 2425, 2219, 2207);
            }
            else if (seed < 30)
            {
                text = "You win a Monster Statuette!";
                i    = new MonsterStatuette(MonsterStatuetteType.Dragon);
            }
            else if (seed < 35)
            {
                text = "You win a rare artifact!";
                i    = new FullJars3();
            }
            else if (seed < 40)
            {
                text = "You win a rare artifact!";
                i    = new TarotCardsArtifact();
            }
            else if (seed < 45)
            {
                text = "You win a rare artifact!";
                i    = new PottedTree();
            }
            else if (seed < 55)
            {
                text = "You win a pouch with many pockets!";
                i    = new PouchWithManyPockets();
            }
            else if (seed < 60)
            {
                text = "You win an item rename deed!";
                i    = new ItemRenameDeed();
            }
            else if (seed < 65)
            {
                text = "You win a magical weapon!";
                BaseWeapon wep = Loot.RandomWeapon();
                if (wep != null)
                {
                    wep.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                    wep.DamageLevel     = WeaponDamageLevel.Might;
                    wep.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                }

                i = wep;
            }
            else if (seed < 70)
            {
                text = "You win Town Sandals!";
                i    = new Sandals()
                {
                    Hue = Utility.RandomList(TownCloth.Hues)
                };
            }
            else if (seed < 75)
            {
                text = "You win a rare artifact!";
                i    = new LongFlask();
            }
            else if (seed < 80)
            {
                text = "You win a rare artifact!";
                i    = new FullJars2();
            }
            else if (seed < 85)
            {
                text = "You win a rare title dye!";
                i    = TitleDye.RandomRareTitleDye();
            }
            else if (seed < 95)
            {
                text = "You win an uncommon title dye!";
                i    = TitleDye.RandomUncommonTitleDye();
            }
            else if (seed < 100)
            {
                text = "You win another Dragon Ticket!";
                i    = new DragonLotteryTicket();
            }
            else if (seed < 105)
            {
                text = "You win some rare cloth!";
                i    = new RareCloth();
            }
            else
            {
                text = "Sorry! Try another ticket.";
            }


            if (text.Length > 0)
            {
                from.PublicOverheadMessage(Network.MessageType.Regular, 0, false, text);
            }

            if (i != null)
            {
                if (!from.AddToBackpack(i))
                {
                    i.Delete();
                    from.SendMessage("You don't have enough room in your backpack. Please make room and try again.");
                    return(false);
                }
            }

            return(true);
        }
        public virtual void Comm(Mobile from, int hue, string speech)
        {
            if (!Active || m_Charges <= 0 || !from.Alive)
            {
                return;
            }
            else if (from.Hidden && from.AccessLevel > AccessLevel.Player)
            {
                return;
            }
            else if (!from.InRange(GetWorldLocation(), Range)) // || ( RootParent is Mobile && from != RootParent ) )
            {
                return;
            }
            object cont = RootParent;

            if (cont is Mobile && (from != cont || !IsChildOf(((Mobile)cont).Backpack, false)))
            {
                return;
            }

            string p_str = null;
            string str   = String.Format("{0} says {1}", from.Name, speech);

            ArrayList done = new ArrayList();

            for (int i = 0; i < m_Links.Count && m_Charges > 0; i++)
            {
                ComCrystal link = m_Links[i] as ComCrystal;
                if (link == null || link.Deleted)
                {
                    continue;
                }

                if (link.Parent == null)
                {
                    bool msg = true;
                    for (int d = 0; d < done.Count; d++)
                    {
                        if (Utility.InRange(((Item)done[d]).GetWorldLocation(), link.GetWorldLocation(), Range))
                        {
                            msg = false;
                            break;
                        }
                    }
                    if (msg)
                    {
                        --Charges;
                        link.PublicLOSMessage(MessageType.Regular, hue, true, str);
                        done.Add(link);
                    }
                }
                else
                {
                    object root = link.RootParent;
                    if (root is Mobile)
                    {
                        Mobile r = (Mobile)root;

                        if (link.IsChildOf(r.Backpack, false))
                        {
                            if (p_str == null)
                            {
                                p_str = String.Format("Crystal: {0}", str);
                            }

                            if (r.Player)
                            {
                                if (r.NetState != null)
                                {
                                    r.SendAsciiMessage(hue, p_str);
                                    --Charges;
                                }
                            }
                            else
                            {
                                r.PublicOverheadMessage(MessageType.Regular, hue, true, p_str, false);
                                --Charges;
                            }
                        }
                    }
                    else if (root is Item)
                    {
                        bool msg = true;
                        for (int d = 0; d < done.Count; d++)
                        {
                            if (Utility.InRange(((Item)done[d]).GetWorldLocation(), link.GetWorldLocation(), Range))
                            {
                                msg = false;
                                break;
                            }
                        }
                        if (msg)
                        {
                            --Charges;
                            ((Item)root).PublicLOSMessage(MessageType.Regular, hue, true, str);
                            done.Add(root);
                        }
                    }
                }
            }
        }
Exemple #44
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154235);             // *Finely crafted lenses for use in allowing the wearer to maintain visual acuity while navigating an aquatic environment*
        }
Exemple #45
0
		public void Carve( Mobile from, Item item )
		{
            if (IsCriminalAction(from) && this.Map != null && (this.Map.Rules & MapRules.HarmfulRestrictions) != 0)
            {
                if (m_Owner == null || !m_Owner.Player)
                    from.SendLocalizedMessage(1005035); // You did not earn the right to loot this creature!
                else
                    from.SendLocalizedMessage(1010049); // You may not loot this corpse.

                return;
            }

            //Taran: Had to add this or you could carve corpses with an axe without range or los checks
            //Couldn't find the range/los checks for daggers, they should be removed.
            if (!from.InRange(GetWorldLocation(), 3) || !from.InLOS(this))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                return;
            }

            if (from.Region is CustomRegion && !((CustomRegion)from.Region).Controller.CanCutCorpse)
            {
                from.SendAsciiMessage("You can't cut corpses here.");
                return;
            }

		    Mobile dead = m_Owner;

            if (GetFlag(CorpseFlag.Carved) || dead == null)
            {
				from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse.
			}
			else if ( ((Body)Amount).IsHuman && (ItemID == 0x2006 || dead is PlayerMobile) )
			{
                if (from.Mounted)
                    from.Animate(28, 5, 1, true, false, 1);
                else
                    from.Animate(32, 5, 1, true, false, 1);

                from.PublicOverheadMessage(MessageType.Regular, 906, true, "*Chop Chop*");

                if (IsCriminalAction(from))
                    from.CriminalAction(true);

                new Blood(0x122D).MoveToWorld(Location, Map);

                Head head = new Head {Name = string.Format("head of {0}", dead.Name), PlayerName = Owner.Name, Owner = dead, Fame = (int)(dead.Fame / 0.9)};
			    head.MoveToWorld(Location, Map);

                Heart heart = new Heart {Name = string.Format("heart of {0}", dead.Name), Owner = dead};
			    heart.MoveToWorld(Location, Map);

                LeftLeg ll = new LeftLeg {Name = string.Format("leg of {0}", dead.Name), Owner = dead};
			    ll.MoveToWorld(Location, Map);

                LeftArm la = new LeftArm {Name = string.Format("arm of {0}", dead.Name), Owner = dead};
			    la.MoveToWorld(Location, Map);

                RightLeg rl = new RightLeg {Name = string.Format("leg of {0}", dead.Name), Owner = dead};
			    rl.MoveToWorld(Location, Map);

                RightArm ra = new RightArm {Name = string.Format("arm of {0}", dead.Name), Owner = dead};
			    ra.MoveToWorld(Location, Map);

                //bounty system here
                if (m_Killer is PlayerMobile)
                {
                    head.Owner = m_Owner;
                    head.Killer = m_Killer;
                    head.CreationTime = DateTime.Now;
                    head.IsPlayer = true;
                }
                //end bounty sytem
                
                new RawRibs(2).MoveToWorld(Location, Map);

                SetFlag(CorpseFlag.Carved, true);

                ProcessDelta();
                SendRemovePacket();
                ItemID = Utility.Random(0xECA, 9); // bone graphic
                Hue = 0;
                ProcessDelta();
            }
			else if ( dead is BaseCreature )
			{
                ((BaseCreature)dead).OnCarve(from, this, item);
            }
			else
			{
				from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse.
			}
		}
Exemple #46
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154239); // *It is a thick canvass robe with specially sewn seals around the wrists and ankles. It appears as though it would protect its wearer from the harsh conditions of a deep aquatic environment.*
        }
Exemple #47
0
        public static void StopEffect(Mobile m, bool message)
        {
            Timer t = (Timer)m_Table[m];

            if (t != null)
            {
                if (message)
                    m.PublicOverheadMessage(Network.MessageType.Emote, m.SpeechHue, true, "* The open flame begins to scatter the swarm of insects *");

                t.Stop();
                m_Table.Remove(m);
            }
        }
Exemple #48
0
		public void Target( Mobile m )
		{
			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( Core.AOS && (m.Frozen || m.Paralyzed || (m.Spell != null && m.Spell.IsCasting)) )
			{
				Caster.SendLocalizedMessage( 1061923 ); // The target is already frozen.
			}
			else if ( CheckHSequence( m ) )
			{
			    SpellHelper.CheckReflect((int) Circle, Caster, ref m);

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

				double duration;
				
				if ( Core.AOS )
				{
                    int secs = (int)((GetDamageSkill(Caster) / 10) - (GetResistSkill(m) / 10));

					if ( !m.Player )
						secs *= 3;

					if ( secs < 0 )
						secs = 0;

					duration = secs;
				}
				else
				{

                    //Loki edit: duration = 120.0 + (Caster.Skills.Magery.Value/2);
                    duration = 30.0 + (Caster.Skills.Magery.Value / 4);

					if ( CheckResisted( m ) )
						duration *= 0.65; //Loki edit: Was 0.85
				}

                if (m is PlagueBeastLord)
                {
                    ((PlagueBeastLord)m).OnParalyzed(Caster);
                    duration = 120;
                }

                if (m is BaseCreature && ((BaseCreature)m).ParalyzeImmune)
                    m.PublicOverheadMessage(MessageType.Emote, 0x3B2, true, "The paralyze spell seems to have no effect");
                else
                    m.Paralyze(TimeSpan.FromSeconds(duration));

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

                HarmfulSpell(m);
			}

			FinishSequence();
		}
        public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread)
        {
            if (loom.Phase > 4)
            {
                loom.Phase = 0;
                Item item = new BoltOfCloth();
                item.Hue = hue;
                from.AddToBackpack(item);
                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
            }

            LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment));
            if (att == null)
            {
                att = new LoomQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveLooms((Item)loom);

            if (from.NetState == null) // player logged off
                return;
            if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial))
                from.SendMessage("You finished processing all the threads/yarns.");
            else if (!thread.IsChildOf(from.Backpack))
                from.SendMessage("You can not continue without the threads/yarns in your backpack.");
            else if (loom is Item)
            {
                Item loom1 = (Item)loom;

                if (loom1.Deleted)
                    from.SendMessage("Where did the loom go?");
                else if (!from.InRange(loom1.GetWorldLocation(), 3))
                    from.SendMessage("You are too far away from the loom to continue your work.");
                else if (loom.Looming)
                    from.SendMessage("That loom is being used.");
                else
                {
                    if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap)
                    {
                        att.AddLooms(loom1);
                        if (Utility.Random(20 * att.getNumLooms()) < 1)
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*");
                        thread.Consume();
                        loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread);
                        return;
                    }
                    else
                        from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running.");
                }
            }
        }
Exemple #50
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.");
            }
        }
Exemple #51
0
			public void AbortAction(Mobile from)
			{
				if (m_CraftSystem == DefAlchemy.CraftSystem)
					from.PublicOverheadMessage(MessageType.Emote, 0x22, true, string.Format("*You see {0} toss the failed mixture*", m_From.Name));
				else //Display message
					from.SendAsciiMessage("You failed to craft that item.");

				if (from is PlayerMobile)
					((PlayerMobile)from).EndPlayerAction();

				Stop();
			}
Exemple #52
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154225); // *You run your hand across the scale, it is cold to the touch and smooth like glass. You decide to take it to the Master Tinker*
        }
Exemple #53
0
		public void Carve( Mobile from, Item item )
		{
            from.PublicOverheadMessage(MessageType.Regular, 33, true, "Auto cut detected - Killing.");
            from.Kill();
		}
Exemple #54
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154243); // *You struggle to lift the heavy boots for examination! You determine anyone venturing into the sea wearing such a thing would quickly sink to the bottom*
        }
Exemple #55
0
		public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
		{
			if (item.GetSavedFlag(0x01)) //Not lootable
			{
				reject = LRReason.CannotLift;
				from.PublicOverheadMessage(MessageType.Regular, 33, false, "[Looting] Attempted to loot sticky item!");
				return false;
			}

			if (!base.CheckLift(from, item, ref reject))
			{
				return false;
			}

			return CanLoot(from, item);
		}
Exemple #56
0
 public override void OnDoubleClick(Mobile from)
 {
     from.PublicOverheadMessage(MessageType.Regular, 0x559, 1154217); // *You carefully examine the sodden remains of the wooden ship. You discern the ship was recently foundered. You decide to show it to the Salvage Master*
 }
        public virtual void OnCarve(Mobile from, Corpse corpse, Item with)
        {
            int feathers = Feathers;
            int wool = Wool;
            int meat = Meat;
            int hides = Hides;
            int scales = Scales;

            if ((feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded || corpse.Animated)
            {
                if (corpse.Animated)
                    corpse.SendLocalizedMessageTo(from, 500464); // Use this on corpses to carve away meat and hide
                else
                    from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
            }
            else
            {
                if (Core.ML && from.Race == Race.Human)
                    hides = (int)Math.Ceiling(hides * 1.1); // 10% bonus only applies to hides, ore & logs

                if (corpse.Map == Map.Felucca)
                {
                    feathers *= 2;
                    wool *= 2;
                    hides *= 2;
                }

                new Blood(0x122D).MoveToWorld(corpse.Location, corpse.Map);

                if (feathers != 0)
                {
                    corpse.AddCarvedItem(new Feather(feathers), from);
                    from.SendLocalizedMessage(500479); // You pluck the bird. The feathers are now on the corpse.
                }

                if (wool != 0)
                {
                    corpse.AddCarvedItem(new TaintedWool(wool), from);
                    from.SendLocalizedMessage(500483); // You shear it, and the wool is now on the corpse.
                }

                if (meat != 0)
                {
                    if (MeatType == MeatType.Ribs)
                        corpse.AddCarvedItem(new RawRibs(meat), from);
                    else if (MeatType == MeatType.Bird)
                        corpse.AddCarvedItem(new RawBird(meat), from);
                    else if (MeatType == MeatType.LambLeg)
                        corpse.AddCarvedItem(new RawLambLeg(meat), from);

                    from.SendLocalizedMessage(500467); // You carve some meat, which remains on the corpse.
                }

                if (hides != 0)
                {
                    Item holding = from.Weapon as Item;
                    if (Core.AOS && (holding is SkinningKnife /* TODO: || holding is ButcherWarCleaver || with is ButcherWarCleaver */ ))
                    {
                        Item leather = null;

                        switch (HideType)
                        {
                            case HideType.Regular: leather = new Leather(hides); break;
                            case HideType.Spined: leather = new SpinedLeather(hides); break;
                            case HideType.Horned: leather = new HornedLeather(hides); break;
                            case HideType.Barbed: leather = new BarbedLeather(hides); break;
                        }

                        if (leather != null)
                        {
                            if (!from.PlaceInBackpack(leather))
                            {
                                corpse.DropItem(leather);
                                from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse.
                            }
                            else
                                from.SendLocalizedMessage(1073555); // You skin it and place the cut-up hides in your backpack.
                        }
                    }
                    else
                    {
                        switch (HideType)
                        {
                            case HideType.Regular:
                                corpse.DropItem(new Hides(hides));
                                break;
                            case HideType.Spined:
                                corpse.DropItem(new SpinedHides((hides / 2)));
                                break;
                            case HideType.Horned:
                                corpse.DropItem(new HornedHides((hides / 2)));
                                break;
                            case HideType.Barbed:
                                corpse.DropItem(new BarbedHides((hides / 2)));
                                break;
                        }

                        from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse.
                    }
                }

                if (scales != 0)
                {
                    ScaleType sc = ScaleType;

                    switch (sc)
                    {
                        case ScaleType.Red: corpse.AddCarvedItem(new RedScales(scales), from); break;
                        case ScaleType.Yellow: corpse.AddCarvedItem(new YellowScales(scales), from); break;
                        case ScaleType.Black: corpse.AddCarvedItem(new BlackScales(scales), from); break;
                        case ScaleType.Green: corpse.AddCarvedItem(new GreenScales(scales), from); break;
                        case ScaleType.White: corpse.AddCarvedItem(new WhiteScales(scales), from); break;
                        case ScaleType.Blue: corpse.AddCarvedItem(new BlueScales(scales), from); break;
                        case ScaleType.All:
                            {
                                corpse.AddCarvedItem(new RedScales(scales), from);
                                corpse.AddCarvedItem(new YellowScales(scales), from);
                                corpse.AddCarvedItem(new BlackScales(scales), from);
                                corpse.AddCarvedItem(new GreenScales(scales), from);
                                corpse.AddCarvedItem(new WhiteScales(scales), from);
                                corpse.AddCarvedItem(new BlueScales(scales), from);
                                break;
                            }
                    }

                    from.SendMessage("You cut away some scales, but they remain on the corpse.");
                }

                if (from.Mounted)
                    from.Animate(28, 5, 1, true, false, 1);
                else
                    from.Animate(32, 5, 1, true, false, 1);

                from.PublicOverheadMessage(MessageType.Regular, 906, true, "*Chop Chop*");

                corpse.Carved = true;

                if (corpse.IsCriminalAction(from))
                    from.CriminalAction(true);
            }
        }
                protected override void OnTick()
                {
                    bool orcs   = IsOrc(m_Target);
                    bool savage = IsSavage(m_Target);

                    var badKarmaChance  = 0.5 - ((double)m_From.Karma / 8570);         //Lower your Karma Less chance you get
                    var goodKarmaChance = 0.5 + ((double)m_From.Karma / 8570);         //Higher Karma less chance for Monsters

                    m_From.NextSkillTime = Core.TickCount + 10000;                     //Set next skill use 10 seconds
                    if (!orcs && !savage && m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        if (!orcs && m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0, 100))
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        }
                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        }
                        // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (orcs)
                    {
                        if (m_From.Karma > 0 && goodKarmaChance > Utility.RandomDouble())
                        {
                            m_From.SendMessage("You seem to notable to beg");
                        }
                        else
                        {
                            //Console.WriteLine("Orc Begged");
                            if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 80, 100)) //Need 80+ Skill to Attempt to Beg Orc
                            {
                                int begchance = Utility.Random(100);                           //Lets see if you have bad accident
                                if (begchance <= 10)                                           //10% chance to blow up mask
                                {
                                    Item item = m_From.FindItemOnLayer(Layer.Helm);

                                    if (item is OrcishKinMask)
                                    {
                                        m_From.SendMessage("{0} alerts the other orcs that you are a fake", m_Target);                                         //Orcs dont beg
                                        AOS.Damage(m_From, 50, 0, 100, 0, 0, 0);
                                        item.Delete();
                                        m_From.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                                        m_From.PlaySound(0x307);
                                    }
                                }
                                else if (begchance <= 30)                                 //30% to just attack player
                                {
                                    m_Target.Attack(m_From);
                                    m_From.SendMessage("{0} seems upset", m_Target);                                     //Well they dont like beggers
                                }
                                else
                                {
                                    BegChance(m_From, m_Target, true, false);                                     //What is your chance to beg?
                                }
                            }
                            else
                            {
                                m_From.SendMessage("They don't seem to have noticed you");
                            }
                        }
                    }
                    else if (savage)
                    {
                        //Console.WriteLine("Savage Beg");
                        if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 80, 100))                         //Need 80+ Skill to Attempt to beg from Savages
                        {
                            int begchance = Utility.Random(100);
                            if (begchance <= 10)                             //10% chance to blow up paint, Pride Tribesman/Women!
                            {
                                if (m_From.BodyMod == 183 || m_From.BodyMod == 184)
                                {
                                    AOS.Damage(m_From, 50, 0, 100, 0, 0, 0);
                                    m_From.BodyMod = 0;
                                    m_From.HueMod  = -1;
                                    m_From.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                                    m_From.PlaySound(0x307);
                                    m_From.SendLocalizedMessage(1040008);                                     // Your skin is scorched as the tribal paint burns away!
                                    ((PlayerMobile)m_From).SavagePaintExpiration = TimeSpan.Zero;
                                }
                            }
                            else if (begchance <= 30)                             //30% to just attack player
                            {
                                m_Target.Attack(m_From);
                                m_From.SendMessage("{0} seems upset", m_Target);
                            }
                            else
                            {
                                BegChance(m_From, m_Target, false, true);                                 //Whats your Beg Chance?
                            }
                        }
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0, 100))
                    {
                        //Console.WriteLine("Human Beg");
                        BegChance(m_From, m_Target, false, false);                         //Not a Savage or Orc? Human than!
                    }
                    else
                    {
                        //Console.WriteLine("Fail Beg");
                        m_Target.SendLocalizedMessage(500404);                         // They seem unwilling to give you any money.
                    }
                }
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154230); // *You examine the document carefully.  It appears to be the detailed schematic of some kind of suit.  It is beyond your understanding.  You decide to take it back to the Master Tinker*
        }
Exemple #60
0
        public static void Sacrifice(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            Mobile targ = targeted as Mobile;

            if (targ == null)
            {
                return;
            }

            if (!ValidateCreature(targ))
            {
                from.SendLocalizedMessage(1052014); // You cannot sacrifice your fame for that creature.
            }
            else if (((targ.Hits * 100) / Math.Max(targ.HitsMax, 1)) < 90)
            {
                from.SendLocalizedMessage(1052013); // You cannot sacrifice for this monster because it is too damaged.
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015); // You cannot do that while hidden.
            }
            else if (VirtueHelper.IsHighestPath(from, VirtueName.Sacrifice))
            {
                from.SendLocalizedMessage(1052068); // You have already attained the highest path in this virtue.
            }
            else if (from.Fame < 2500)
            {
                from.SendLocalizedMessage(1052017); // You do not have enough fame to sacrifice.
            }
            else if (DateTime.UtcNow < (pm.LastSacrificeGain + GainDelay))
            {
                from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
            }
            else
            {
                int toGain;

                if (from.Fame < 5000)
                {
                    toGain = 500;
                }
                else if (from.Fame < 10000)
                {
                    toGain = 1000;
                }
                else
                {
                    toGain = 2000;
                }

                from.Fame = 0;

                // I have seen the error of my ways!
                targ.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1052009);

                from.SendLocalizedMessage(1052010); // You have set the creature free.

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), targ.Delete);

                pm.LastSacrificeGain = DateTime.UtcNow;

                bool gainedPath = false;

                if (VirtueHelper.Award(from, VirtueName.Sacrifice, toGain, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        from.SendLocalizedMessage(1052008); // You have gained a path in Sacrifice!

                        if (pm.AvailableResurrects < 3)
                        {
                            ++pm.AvailableResurrects;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054160); // You have gained in sacrifice.
                    }
                }

                from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
            }
        }