Example #1
2
		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 );
			}
		}
Example #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 );
		}
Example #3
0
 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");
 }
Example #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 ) );
			}
		}
Example #6
0
        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);
        }
Example #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;
		}
Example #11
0
        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);
        }
Example #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);
        }
Example #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;
		}
Example #14
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);
		}
Example #15
0
                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);

                }
Example #16
0
		public void Carve( Mobile from, Item item )
		{
            from.PublicOverheadMessage(MessageType.Regular, 33, true, "Auto cut detected - Killing.");
            from.Kill();
		}
Example #17
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();
			}
Example #18
0
			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.
				}
			}
Example #19
0
        public static void ShowPointsOverhead(Mobile from)
        {
            if (from == null)
                return;

            from.PublicOverheadMessage(MessageType.Regular, 0x3B2, false, GetPoints(from).ToString());
        }
Example #20
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;
				}
			}
		}
Example #21
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);
            }
        }
Example #22
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();
            }
        }
Example #23
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();
		}
Example #24
0
        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.
        }
Example #25
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 );
            }
        }
        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.");
                }
            }
        }
Example #27
0
        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 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.
				}
			}
Example #29
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.
			}
		}
Example #30
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();
			}
		}