Inheritance: MonoBehaviour
Esempio n. 1
0
        public static bool CheckSpeech(BaseCreature m_Mobile, SpeechEventArgs e)
        {
            string response = null;
            Region reg = Region.Find(m_Mobile.Location, m_Mobile.Map);

            //Check Job

            //Check Region
            if (reg.Name == "Britain")
            {
                if (m_Mobile.Sophistication == SophisticationLevel.High)
                    response = BritainHigh(m_Mobile, e);
                else if (m_Mobile.Sophistication == SophisticationLevel.Medium)
                    response = BritainMedium(m_Mobile, e);
                else if (m_Mobile.Sophistication == SophisticationLevel.Low)
                    response = BritainLow(m_Mobile, e);
            }

            //Check World
            if (m_Mobile.Sophistication == SophisticationLevel.High)
                response = BritanniaHigh(m_Mobile, e);
            else if (m_Mobile.Sophistication == SophisticationLevel.Medium)
                response = BritanniaMedium(m_Mobile, e);
            else if (m_Mobile.Sophistication == SophisticationLevel.Low)
                response = BritanniaLow(m_Mobile, e);

            if (response != null)
                return true;
            else
                return false;
        }
Esempio n. 2
0
        public static void CheckArtifactGiving( BaseCreature boss )
        {
            int basePoints = ( boss is DemonKnight ) ? 500 : 100;

            List<DamageStore> rights = BaseCreature.GetLootingRights( boss.DamageEntries, boss.HitsMax );

            for ( int i = 0; i < rights.Count; i++ )
            {
                DamageStore store = rights[i];

                if ( !store.HasRight )
                    continue;

                PlayerMobile pm = store.Mobile as PlayerMobile;

                if ( pm != null )
                {
                    int awardPoints = (int) ( basePoints * ( 1.0 - Math.Ceiling( i / 2.0 ) * 0.02 ) );

                    pm.DoomCredits += awardPoints;

                    int chance = (int) ( pm.DoomCredits * ( 1.0 + LootPack.GetLuckChance( pm, boss ) / 10000.0 ) );

                    if ( chance > Utility.Random( 1000000 ) )
                        GiveArtifactTo( pm );
                }
            }
        }
Esempio n. 3
0
        public static string RudeFarewellLow(BaseCreature m_Mobile, Mobile from)
        {
            string response = null;

            if (m_Mobile.Attitude == AttitudeLevel.Wicked)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = "Fine."; break;
                    case 1: response = "Same to ye."; break;
                    case 2: response = "Ye's rude."; break;
                }
            }
            else if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = "Fine. "; break;
                    case 1: response = "Same to ye."; break;
                    case 2: response = "Aye, whatever."; break;
                }
            }

            return response;
        }
Esempio n. 4
0
		public PetReviveGump( Mobile from, BaseCreature mount,PetHoldingChamber petchamber,PetReviver doctor ) : base( 50,50 )
		{
			from.CloseGump( typeof( PetReviveGump ) );

			m_from = from;
			m_mount = mount;
			i_petchamber = petchamber;
			m_doctor = doctor;

			AddPage( 0 );

			AddBackground( 10, 10, 265, 140, 0x242C );

			AddItem( 205, 40, 0x4 );
			AddItem( 227, 40, 0x5 );

			AddItem( 180, 78, 0xCAE );
			AddItem( 195, 90, 0xCAD );
			AddItem( 218, 95, 0xCB0 );

			//AddHtmlLocalized( 30, 30, 150, 75, 1049665, false, false ); // <div align=center>Wilt thou sanctify the resurrection of:</div>
			AddHtml(30,30,150,75, String.Format( "Would you like to spend 6000 gold to revive this pet?", 0 ), false,false);
			AddHtml( 30, 70, 150, 25, String.Format( "<div align=CENTER>{0}</div>", mount.Name ), true, false );

			AddButton( 40, 105, 0x81A, 0x81B, 1, GumpButtonType.Reply, 0 ); // Okay
			AddButton( 110, 105, 0x819, 0x818, 0, GumpButtonType.Reply, 0 ); // Cancel
		}
Esempio n. 5
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
            m_Creature = (BaseCreature)reader.ReadMobile();
        }
        public static void BCLoot( BaseCreature creature, Container c, bool spawning )
        {
            if( creature.Controlled || creature.Summoned || creature.NoKillAwards )
                return;

            //if( creature.IsChampionMonster && 0.0005 > Utility.RandomDouble() )
            //	BaseCreatureLoot.GivePowerScroll(creature);

            if( creature.IsPlagued && !creature.IgnorePlagueLoot )
            {
                if ( creature.TreasureMapLevel >= 0 && Plague.ChestChance > Utility.RandomDouble() )
                    c.DropItem( new PlagueChest( creature.Name, creature.TreasureMapLevel ) );

                LootPackEntry.AddMoreLoot( creature, c, spawning, 1000, 1 );
                IncreaseTypeAmount( c, typeof(Gold), 1.50 );
            }
            else if ( creature.IsElder )
            {
                LootPackEntry.AddMoreLoot( creature, c, spawning, 1000, 1 );
                IncreaseTypeAmount( c, typeof(Gold), 1.60 );
            }
            else if ( creature.IsParagon )
            {
                LootPackEntry.AddMoreLoot( creature, c, spawning, 1000, 1 );
                IncreaseTypeAmount( c, typeof(Gold), 1.50 );
            }
        }
Esempio n. 7
0
		public static void ComputePoints( BaseCreature creature )
		{
			List<DamageStore> rights = BaseCreature.GetLootingRights( creature.DamageEntries, creature.HitsMax );

			for ( int i = rights.Count - 1; i >= 0; --i )
			{
				DamageStore ds = rights[i];

				if ( ds.m_HasRight )
				{
					double baseChance, factor;
					if ( creature is DemonKnight )
						baseChance = 1.5;
					else
						baseChance = 0.75;

					switch ( i )
					{
						case 0: factor = 0.1; break;
						case 1: factor = 0.065; break;
						case 2: factor = 0.05; break;
						default: factor = 0.04; break;
					}

					PlayerMobile pm = ds.m_Mobile as PlayerMobile;

					if ( pm != null )
						pm.GauntletPoints += ( factor * baseChance );
				}
			}
		}
Esempio n. 8
0
        public static string RudeFarewellHigh(BaseCreature m_Mobile, Mobile from)
        {
            string response = null;

            if (m_Mobile.Attitude == AttitudeLevel.Wicked)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = "Fine. Have a nice day, scum."; break;
                    case 1: response = "Same to thee."; break;
                    case 2: response = "Oh, don't be so immature about it."; break;
                }
            }
            else if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
            {
                switch (Utility.Random(4))
                {
                    case 0: response = "Fine. Have a nice day."; break;
                    case 1: response = "Same to thee."; break;
                    case 2: response = "There is no need to be so rude about it."; break;
                    case 3: response = "Very well, if thou dost not wish to speak to me, kindly do not interrupt me again."; break;
                }
            }

            return response;
        }
Esempio n. 9
0
        public static bool CheckArtifactChance(Mobile m, BaseCreature bc)
        {
            if (!Core.ML)
                return false;

            return Paragon.CheckArtifactChance(m, bc);
        }
Esempio n. 10
0
        public virtual void FindAbility(BaseCreature target, BaseMetaPet pet)
        {
            if (MetaSkillType.GoldFind == MetaSkillType)
            {
                DoAbilityGoldFind(target, pet);
            }

            if (MetaSkillType.VenemousBlood == MetaSkillType && DateTime.UtcNow >= NextUse &&
                Utility.RandomDouble() <= ChanceToActivate)
            {
                DoAbilityNoxiousBlood(target, pet);
            }

            if (MetaSkillType.Quicksilver == MetaSkillType && DateTime.UtcNow >= NextUse &&
                Utility.RandomDouble() <= ChanceToActivate && pet.GetStatMod("QuickSilver") == null)
            {
                DoAbilityQuicksilver(target, pet);
            }

            if (MetaSkillType.Bleed == MetaSkillType && DateTime.UtcNow >= NextUse &&
            Utility.RandomDouble() <= ChanceToActivate)
            {
                DoAbilityBleed(target, pet);
            }

            if (MetaSkillType.Molten == MetaSkillType && DateTime.UtcNow >= NextUse &&
                Utility.RandomDouble() <= ChanceToActivate)
            {
                DoAbilityMoltenBreath(target, pet);
            }
        }
Esempio n. 11
0
            public ParagonStamRegen(Mobile m)
                : base(FastRegenRate, FastRegenRate)
            {
                this.Priority = TimerPriority.FiftyMS;

                m_Owner = m as BaseCreature;
            }
Esempio n. 12
0
		public PetResurrectGump( Mobile from, BaseCreature pet ) : base( 50, 50 )
		{
			from.CloseGump( typeof( PetResurrectGump ) );

			bool bStatLoss = false;
			if( pet.BondedDeadPetStatLossTime > DateTime.Now )
			{
				bStatLoss = true;
			}

			m_Pet = pet;

			AddPage( 0 );

			AddBackground( 10, 10, 265, bStatLoss ? 250 : 140, 0x242C );

			AddItem( 205, 40, 0x4 );
			AddItem( 227, 40, 0x5 );

			AddItem( 180, 78, 0xCAE );
			AddItem( 195, 90, 0xCAD );
			AddItem( 218, 95, 0xCB0 );

			AddHtmlLocalized( 30, 30, 150, 75, 1049665, false, false ); // <div align=center>Wilt thou sanctify the resurrection of:</div>
			AddHtml( 30, 70, 150, 25, String.Format( "<div align=CENTER>{0}</div>", pet.Name ), true, false );

			if( bStatLoss )
			{
				string statlossmessage = "Your pet lacks the ability to return to the living at this time without suffering skill loss.";
				AddHtml( 30, 105, 150, 105, String.Format( "<div align=CENTER>{0}</div>", statlossmessage), true, false);
			}

			AddButton( 40, bStatLoss ? 215 : 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0 ); // Okay
			AddButton( 110, bStatLoss ? 215 : 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0 ); // Cancel
		}
Esempio n. 13
0
		/// <summary>
		/// Converta a given BaseCreature object into a statuette object which can be sold through the auction
		/// system. Will provide feedback to the user in case some of the requirements aren't met.
		/// </summary>
		/// <param name="from">The player auctioning the creature</param>
		/// <param name="creatue">The creature being auctioned</param>
		/// <returns>A MobileStatuette if the creature can be auctioned, null if the process fails</returns>
		public static MobileStatuette Create( Mobile from, BaseCreature creature )
		{
			if ( !creature.Controlled || creature.ControlMaster != from )
			{
				from.SendMessage( AuctionSystem.MessageHue, AuctionSystem.ST[ 139 ] );
				return null;
			}

			if ( creature.IsAnimatedDead || creature.IsDeadPet )
			{
				from.SendMessage( AuctionSystem.MessageHue, AuctionSystem.ST[ 140 ] );
				return null;
			}

			if ( creature.Summoned )
			{
				from.SendMessage( AuctionSystem.MessageHue, AuctionSystem.ST[ 141 ] );
				return null;
			}

			if ( creature is BaseFamiliar )
			{
				from.SendMessage( AuctionSystem.MessageHue, AuctionSystem.ST[ 142 ] );
				return null;
			}

			if ( (creature is PackLlama || creature is PackHorse || creature is Beetle) && (creature.Backpack != null && creature.Backpack.Items.Count > 0) )
			{
				from.SendMessage( AuctionSystem.MessageHue, AuctionSystem.ST[ 143 ] );
				return null;
			}

			return new MobileStatuette( creature );
		}
Esempio n. 14
0
		public static void UnConvert( BaseCreature bc )
		{
			if ( !bc.IsParagon )
				return;

			bc.Hue = 0;

			bc.HitsMaxSeed = (int)( bc.HitsMaxSeed / HitsBuff );
			bc.Hits = bc.HitsMax;

			bc.RawStr = (int)( bc.RawStr / StrBuff );
			bc.RawInt = (int)( bc.RawInt / IntBuff );
			bc.RawDex = (int)( bc.RawDex / DexBuff );

			for( int i = 0; i < bc.Skills.Length; i++ )
			{
				Skill skill = (Skill)bc.Skills[i];
				if ( skill.Base == 0.0 )
					continue;
				else
					skill.Base /= SkillsBuff;
			}

			bc.PassiveSpeed *= SpeedBuff;
			bc.ActiveSpeed *= SpeedBuff;

			bc.DamageMin -= DamageBuff;
			bc.DamageMax -= DamageBuff;

			if ( bc.Fame > 0 )
				bc.Fame = (int)( bc.Fame / FameBuff );
			if ( bc.Karma != 0 )
				bc.Karma = (int)( bc.Karma / KarmaBuff );
		}
Esempio n. 15
0
		public override void OnKill( BaseCreature creature, Container corpse )
		{
			if ( creature is CursedSoul )
			{
				if ( m_CursedSoulsKilled == 0 )
					System.AddConversation( new GainKarmaConversation( true ) );

				m_CursedSoulsKilled++;

				// Cursed Souls killed:  ~1_COUNT~
				System.From.SendLocalizedMessage( 1063038, m_CursedSoulsKilled.ToString() );
			}
			else if ( creature is YoungRonin )
			{
				if ( m_YoungRoninKilled == 0 )
					System.AddConversation( new GainKarmaConversation( false ) );

				m_YoungRoninKilled++;

				// Young Ronin killed:  ~1_COUNT~
				System.From.SendLocalizedMessage( 1063039, m_YoungRoninKilled.ToString() );
			}

			CurProgress = Math.Max( m_CursedSoulsKilled, m_YoungRoninKilled );
		}
Esempio n. 16
0
 public override void OnKill( BaseCreature creature, Container corpse )
 {
     if ( creature is DeathWatchBeetleHatchling && corpse.Map == Map.Tokuno )
     {
         CurProgress++;
     }
 }
		public static void AddSheep( Mobile m, BaseCreature sheep )
		{
			if ( SheepList == null )
				m.SendMessage( "An Error has occured, please contact a GM" );
			else
			{
			
				if ( SheepList.ContainsKey( m ) )
				{
					List<BaseCreature> list;
					if ( SheepList.TryGetValue( m, out list ) )
					{
						if ( list == null )  //Should never happen but crash preventative.
						{
							list = new List<BaseCreature>();
							SheepList[m] = list;
							SheepList[m].Add( sheep );
						}
						else
						{
							SheepList[m].Add( sheep );
						}
					}
				}
				else
				{
					List<BaseCreature> list = new List<BaseCreature>();
					SheepList.Add( m, list );
					SheepList[m].Add( sheep );
				}
			}
			    	
		}
Esempio n. 18
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 1:
                    {
                        m_Caster = (BaseCreature)reader.ReadMobile();

                        goto case 0;
                    }
                case 0:
                    {
                        m_End = reader.ReadDeltaTime();

                        m_Timer = new InternalTimer(this, TimeSpan.Zero, true, true);
                        m_Timer.Start();

                        break;
                    }
            }
        }
		//END ANTI ARCHERY

		//BEGIN ANTI ESCAPE

		public static void DoAntiEscape(BaseCreature mobile, Mobile player)
		{
			if ( mobile.Combatant != null )
				if ( !player.InRange( mobile, 5 ) )
				{                 
					Point3D from = mobile.Location;
					Point3D to = player.Location;

					if ( mobile.Mana >= 10 )
					{
						mobile.Location = to;
						
						mobile.Mana -= 10;

						mobile.Say( "Grrrr" );

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

						mobile.PlaySound( 0x1FE );
					}
					else if ( !player.InRange( mobile, 20 ) )
						return;
				}
		}
Esempio n. 20
0
		private static bool IsFireBreathingCreature( BaseCreature bc )
		{
			if ( bc == null )
				return false;

			return bc.HasBreath;
		}
Esempio n. 21
0
        public static string RudeFarewellMedium(BaseCreature m_Mobile, Mobile from)
        {
            string response = null;

            if (m_Mobile.Attitude == AttitudeLevel.Wicked)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = "Fine. Have a nice day. "; break;
                    case 1: response = "Same to thee."; break;
                    case 2: response = "Thou'rt very rude."; break;
                }
            }
            else if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = "Fine. Have a nice day."; break;
                    case 1: response = "Same to thee."; break;
                    case 2: response = "There is no need to be so rude about it."; break;
                }
            }

            return response;
        }
		public static void Scale( BaseCreature bc, double scalar, bool scaleStats )
		{
			if ( scaleStats )
			{
				if ( bc.RawStr > 0 )
					bc.RawStr = (int)Math.Max( 1, bc.RawStr * scalar );

				if ( bc.RawDex > 0 )
					bc.RawDex = (int)Math.Max( 1, bc.RawDex * scalar );

				if ( bc.HitsMaxSeed > 0 )
				{
					bc.HitsMaxSeed = (int)Math.Max( 1, bc.HitsMaxSeed * scalar );
					bc.Hits = bc.Hits;
				}

				if ( bc.StamMaxSeed > 0 )
				{
					bc.StamMaxSeed = (int)Math.Max( 1, bc.StamMaxSeed * scalar );
					bc.Stam = bc.Stam;
				}
			}

			for ( int i = 0; i < bc.Skills.Length; ++i )
				bc.Skills[i].Base *= scalar;
		}
Esempio n. 23
0
        public override void OnAttack( BaseCreature creature )
        {
            HaochisTrialsQuest htq = System as HaochisTrialsQuest;

            if ( htq == null )
            {
                return;
            }

            if ( creature is FierceDragon )
            {
                Complete();

                htq.Opponent = OpponentType.FierceDragon;

                System.AddObjective( new SecondTrialCompleteObjective() );
            }

            if ( creature is DeadlyImp )
            {
                Complete();

                htq.Opponent = OpponentType.DeadlyImp;

                System.AddObjective( new SecondTrialCompleteObjective() );
            }
        }
Esempio n. 24
0
        public PetResurrectGump(Mobile from, BaseCreature pet, double hitsScalar)
            : base(50, 50)
        {
            from.CloseGump(typeof(PetResurrectGump));

            m_Pet = pet;
            m_HitsScalar = hitsScalar;

            AddPage(0);

            AddBackground(10, 10, 265, 140, 0x242C);

            AddItem(205, 40, 0x4);
            AddItem(227, 40, 0x5);

            AddItem(180, 78, 0xCAE);
            AddItem(195, 90, 0xCAD);
            AddItem(218, 95, 0xCB0);

            AddHtmlLocalized(30, 30, 150, 75, 1049665, false, false); // <div align=center>Wilt thou sanctify the resurrection of:</div>
            AddHtml(30, 70, 150, 25, String.Format("<div align=CENTER>{0}</div>", pet.Name), true, false);

            AddButton(40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0); // Okay
            AddButton(110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0); // Cancel
        }
Esempio n. 25
0
        public static void Convert( BaseCreature bc )
        {
            if ( bc.IsPlagued )
                return;

            bc.Hue = Hue;

            bc.HitsMaxSeed = (int)( bc.HitsMaxSeed * HitsBuff );
            bc.Hits = bc.HitsMax;

            bc.RawStr = (int)( bc.RawStr * StrBuff );
            bc.RawInt = (int)( bc.RawInt * IntBuff );
            bc.RawDex = (int)( bc.RawDex * DexBuff );

            for( int i = 0; i < bc.Skills.Length; i++ )
            {
                Skill skill = (Skill)bc.Skills[i];
                if ( skill.Base == 0.0 )
                    continue;
                else
                    skill.Base *= SkillsBuff;
            }

            bc.PassiveSpeed /= SpeedBuff;
            bc.ActiveSpeed /= SpeedBuff;

            bc.DamageMin += DamageBuff;
            bc.DamageMax += DamageBuff;

            if ( bc.Fame > 0 )
                bc.Fame = (int)( bc.Fame * FameBuff );
            if ( bc.Karma != 0 )
                bc.Karma = (int)( bc.Karma * KarmaBuff );
        }
Esempio n. 26
0
        public static string ReGreetingMedium(BaseCreature m_Mobile, Mobile from)
        {
            string response = null;

            if (m_Mobile.Attitude == AttitudeLevel.Wicked)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = String.Format("Was that thee, or a parrot, {0}?", from.Name); break;
                    case 1: response = String.Format("Get to thy point, {0}!",from.Name); break;
                    case 2: response = "Lose thy greetings and acquire some meaning."; break;
                }
            }

            //Dastardly
            if (from.Karma <= -60)
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = "I greet thee a thousand times."; break;
                        case 1: response = String.Format("Yes, {0}, hello. I heard thee.", from.Female ? "Lady" : "Sir"); break;
                        case 2: response = String.Format("Thou'rt a repetitive {0} to talk to.", from.Female ? "woman" : "man"); break;
                        case 3: response = "Uh, right. Art thou having me on?"; break;
                    }
                }
            }
            //Famous
            else if (from.Karma >= 60)
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = String.Format("I'd think a renown {0}'d too busy for repeatin' thyself.", from.Female ? "lady" : "rogue"); break;
                        case 1: response = "Yes, I heard thou."; break;
                        case 2: response = String.Format("So famous, yet so addled. Hello, {0}.", from.Name); break;
                        case 3: response = String.Format("I am listening to thee, {0}. But hello anyway.", from.Name); break;
                    }
                }
            }
            //Annonymous
            else
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = String.Format("Hello again. My, what a friendly {0}.", from.Female ? "lady" : "fellow"); break;
                        case 1: response = "Hee-hee. Hello. Thou art a rascal."; break;
                        case 2: response = "What is it thou wishest?"; break;
                        case 3: response = "Yes, goodtidings to thee as well."; break;
                    }
                }
            }

            return response;
        }
Esempio n. 27
0
        public static string ConvoInitLow(BaseCreature m_Mobile, Mobile from)
        {
            string response = null;

            if (m_Mobile.Attitude == AttitudeLevel.Wicked)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = "Go 'way."; break;
                    case 1: response = "I ain't wantin' to talk to thee."; break;
                    case 2: response = "Thou'rt rude."; break;
                }
            }

            //Dastardly
            if (from.Karma <= -60)
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = "Don't hurt me."; break;
                        case 1: response = "What do thou want? I can't help."; break;
                        case 2: response = "Thou wants to talk to me? Umm..."; break;
                        case 3: response = "Thou'rt talkin' to me?"; break;
                    }
                }
            }
            //Famous
            else if (from.Karma >= 60)
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = String.Format("Yes, {0}?", from.Name); break;
                        case 1: response = String.Format("Hmm? Oh! Tis thee, {0}!", from.Name); break;
                        case 2: response = "Can I help thee?"; break;
                        case 3: response = String.Format("{0}! Nice to see thee.", from.Name); break;
                    }
                }
            }
            //Annonymous
            else
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = "Hmm?"; break;
                        case 1: response = "Aye?"; break;
                        case 2: response = "What's thee wantin'?"; break;
                        case 3: response = "I'm listenin'."; break;
                    }
                }
            }

            return response;
        }
Esempio n. 28
0
        public static int GetResurrectionFee( BaseCreature bc )
        {
            int fee = (int) ( 100 + Math.Pow( 1.1041, bc.MinTameSkill ) );

            Utility.FixMinMax( ref fee, 100, 30000 );

            return fee;
        }
Esempio n. 29
0
        public static void HandleKill(BaseCreature victim, Mobile damager, bool highestDamager)
        {
            if (victim == null || damager == null || damager.Map != Map.TerMur)
                return;

            if(PointsEntry.Entries.ContainsKey(victim.GetType()))
                ProcessKill(victim, damager, highestDamager);
        }
Esempio n. 30
0
        public static string ConvoInitMedium(BaseCreature m_Mobile, Mobile from)
        {
            string response = null;

            if (m_Mobile.Attitude == AttitudeLevel.Wicked)
            {
                switch (Utility.Random(3))
                {
                    case 0: response = "Be quiet, mine head hurts."; break;
                    case 1: response = "What if I do not wish to speak with thee?"; break;
                    case 2: response = "Waste not my time."; break;
                }
            }

            //Dastardly or Famous
            if (from.Karma <= -60)
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = "Prithee, do not hurt me."; break;
                        case 1: response = "Hurt me not, and I will talk with thee."; break;
                        case 2: response = String.Format("Thou'rt a dangerous {0} to talk to.", from.Female ? "woman" : "man"); break;
                        case 3: response = "Thou wishest to speak to me? Please, harm me not..."; break;
                    }
                }
            }
            else if (from.Karma >= 60)
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = String.Format("Thou wishest to speak with me, {0}?", from.Name); break;
                        case 1: response = String.Format("Thou hast mine attention, {0}.", from.Name); break;
                        case 2: response = String.Format("What is it thou wishest, {0}?", from.Name); break;
                        case 3: response = String.Format("I am listening to thee, {0}.", from.Name); break;
                    }
                }
            }
            //Annonymous
            else
            {
                if (m_Mobile.Attitude == AttitudeLevel.Neutral || m_Mobile.Attitude == AttitudeLevel.Goodhearted)
                {
                    switch (Utility.Random(4))
                    {
                        case 0: response = "Thou wishest to speak with me?"; break;
                        case 1: response = "Thou hast mine attention."; break;
                        case 2: response = "What is it thou wishest?"; break;
                        case 3: response = "I am listening to thee."; break;
                    }
                }
            }

            return response;
        }
Esempio n. 31
0
 public PetResurrectGump(Mobile from, BaseCreature pet)
     : this(from, pet, 0.0)
 {
 }
Esempio n. 32
0
 public CombatTarget(BaseAI ai, BaseCreature bc)
     : base(10, false, TargetFlags.None)
 {
     m_AI     = ai;
     creature = bc;
 }
Esempio n. 33
0
        public override bool CheckCast()
        {
            if (Caster is BaseCreature)
            {
                BaseCreature bc = Caster as BaseCreature;
                bc.DebugSay("Blue Spell: CheckCast is returning base");
                return(base.CheckCast());
            }
            else if (Caster.AccessLevel == AccessLevel.Counselor)
            {
                // Counselors are blocked becuase counselors are not meant to have leet god powers. Lock the level down like you're supposed to and you can hire the position out as the advice giving only position as it's supposed to be.
                Caster.SendMessage("You are blocked from these spells.");
                return(false);
            }
            else if (Caster is PlayerMobile && !BlueMageControl.IsBlueMage(Caster) && Caster.AccessLevel == AccessLevel.Player)
            {
                Caster.SendMessage("Only a blue mage can cast this spell.");
                return(false);
            }

            // Not a real class system, because class systems suck, but you can't use higher levels of spells as part of an intended balence.
            if (BlueMageControl.SkillLock && Caster.AccessLevel == AccessLevel.Player)
            {
                if (Caster.Skills[SkillName.Magery].Base > 50.0)
                {
                    //Caster.SendMessage( "You study true magic and cannot mimic such a choatic spell." );
                    Caster.Skills[SkillName.Magery].Base = 50.0;
                }
                if (Caster.Skills[SkillName.Chivalry].Base > 50.0)
                {
                    //Caster.SendMessage( "Your oath prevents you from using such a dishonorable spell." );
                    Caster.Skills[SkillName.Chivalry].Base = 50.0;
                }
                if (Caster.Skills[SkillName.Necromancy].Base > 50.0)
                {
                    //Caster.SendMessage( "Your dark power prevents you from casting this spell." );
                    Caster.Skills[SkillName.Necromancy].Base = 50.0;
                }
                if (Caster.Skills[SkillName.AnimalTaming].Base > 0.0)
                {
                    //Caster.SendMessage( "You refuse to cast the spell, you believe monsters should be used, not studied." );
                    Caster.Skills[SkillName.AnimalTaming].Base = 0.0;
                }
                else if (Caster.Skills[SkillName.Spellweaving].Base > 50.0)
                {
                    Caster.Skills[SkillName.Spellweaving].Base = 50.0;
                }
                else if (Caster.Skills[SkillName.Mysticism].Base > 50.0)
                {
                    Caster.Skills[SkillName.Mysticism].Base = 50.0;
                }

                if (Caster is PlayerMobile && !BlueMageControl.CheckKnown(Caster, this, false))
                {
                    Caster.SendMessage("You do not know this spell");
                    return(false);
                }
            }

            if (!base.CheckCast())               //|| !base.CheckSequence() )
            {
                return(false);
            }
            else
            {
                //Caster.PublicOverheadMessage( MessageType.Regular, 1365, false, this.type.toString() );
                BaseAnimation();
                return(true);
            }
        }
Esempio n. 34
0
        public static void Pause_OnCommand(CommandEventArgs e)
        {
            Pause pauseatt = (Pause)XmlAttach.FindAttachment(e.Mobile, typeof(Pause));

            if (pauseatt == null)
            {
                XmlAttach.AttachTo(e.Mobile, new Pause());

                return;
            }

            if (pauseatt.Paused == true)
            {
                pauseatt.Paused    = false;
                e.Mobile.Hidden    = false;
                e.Mobile.Paralyzed = false;
                e.Mobile.Frozen    = false;
                e.Mobile.Blessed   = false;

                if (e.Mobile.HasGump(typeof(Pausegump)))
                {
                    ;
                }
                {
                    e.Mobile.CloseGump(typeof(Pausegump));
                }


                PlayerMobile pm = (PlayerMobile)e.Mobile;
                ((PlayerMobile)pm).ClaimAutoStabledPets();
            }

            else
            {
                // region check only requires player to be about 30 steps away from the altar. this still puts them too close to the altar and could allow players to "steal" a champion spawn from another player. so I've used range check instead.
                //if (e.Mobile.Region.IsPartOf(typeof(ChampionSpawnRegion)) )
                foreach (Item item in e.Mobile.GetItemsInRange(50))                     // 50 = range.
                {
                    if (item is ChampionAltar)
                    {
                        // if you change the range above or if you use Region check instead of range, you'll want to change the message below
                        e.Mobile.SendMessage("You must be more than 50 steps away from the Champion's altar to use Pause.");
                        return;
                    }
                }
                // prevents players from using pause if they're paralyzed, frozen, holding a faction sigil, "holding" a spell target, in the middle of casting a spell, or currently attacking something.

                if (e.Mobile.Paralyzed == true || e.Mobile.Frozen == true || Factions.Sigil.ExistsOn(e.Mobile) || Server.Spells.SpellHelper.CheckCombat(e.Mobile) || e.Mobile.Spell != null || e.Mobile.Combatant != null)
                {
                    e.Mobile.SendMessage("You cannot pause at this time.");
                    return;
                }

                if (e.Mobile is PlayerMobile && (e.Mobile as PlayerMobile).DuelContext != null)
                {
                    e.Mobile.SendMessage("You cannot pause while duelling!");
                    return;
                }
                if (e.Mobile.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    e.Mobile.SendMessage("You cannot pause while duelling!");
                    return;
                }
                if (pauseatt.CanPause == false)
                {
                    e.Mobile.SendMessage("Your ability to Pause has been deactivated.");
                    return;
                }

                pauseatt.Paused    = true;
                e.Mobile.Hidden    = true;
                e.Mobile.Paralyzed = true;
                e.Mobile.Frozen    = true;
                e.Mobile.Warmode   = false;
                e.Mobile.Blessed   = true;

                e.Mobile.SendGump(new Pausegump(e.Mobile));

                PlayerMobile pm = (PlayerMobile)e.Mobile;

                if (((!pm.Mounted || (pm.Mount != null && pm.Mount is EtherealMount)) && (pm.AllFollowers.Count > pm.AutoStabled.Count)) || (pm.Mounted && (pm.AllFollowers.Count > (pm.AutoStabled.Count + 1))))
                {
                    pm.AutoStablePets();                             /* autostable checks summons, et al: no need here */
                }

                for (int i = pm.AllFollowers.Count - 1; i >= 0; --i)
                {
                    BaseCreature pet = pm.AllFollowers[i] as BaseCreature;
                    if (pet.Summoned)
                    {
                        //if (pet.Map != Map)
                        //{
                        pet.PlaySound(pet.GetAngerSound());
                        Timer.DelayCall(TimeSpan.Zero, pet.Delete);
                        //}
                    }
                }
            }
        }
Esempio n. 35
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

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

                Map map = Caster.Map;

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

                    foreach (Mobile m in eable)
                    {
                        if (m is BaseCreature && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                    BaseCreature bc = m as BaseCreature;

                    if (bc == null)
                    {
                        continue;
                    }

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

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

                        m.Delete();
                    }
                    else
                    {
                        Caster.DoHarmful(m);

                        m.FixedEffect(0x3779, 10, 20);
                    }
                }
            }

            FinishSequence();
        }
Esempio n. 36
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            QuestSystem qs = player.Quest;

            if (qs is DarkTidesQuest)
            {
                if (DarkTidesQuest.HasLostCallingScroll(player))
                {
                    qs.AddConversation(new LostCallingScrollConversation(true));
                }
                else
                {
                    QuestObjective obj = qs.FindObjective(typeof(FindMardothAboutVaultObjective));

                    if (obj != null && !obj.Completed)
                    {
                        obj.Complete();
                    }
                    else
                    {
                        obj = qs.FindObjective(typeof(FindMardothAboutKronusObjective));

                        if (obj != null && !obj.Completed)
                        {
                            obj.Complete();
                        }
                        else
                        {
                            obj = qs.FindObjective(typeof(FindMardothEndObjective));

                            if (obj != null && !obj.Completed)
                            {
                                Container cont = GetNewContainer();

                                cont.DropItem(new PigIron(20));
                                cont.DropItem(new NoxCrystal(20));
                                cont.DropItem(new BatWing(25));
                                cont.DropItem(new DaemonBlood(20));
                                cont.DropItem(new GraveDust(20));

                                BaseWeapon weapon = new NoDachi();// new BoneHarvester();

                                weapon.Slayer = SlayerName.OrcSlaying;

                                if (Core.AOS)
                                {
                                    BaseRunicTool.ApplyAttributesTo(weapon, 3, 20, 40);
                                }
                                else
                                {
                                    weapon.DamageLevel     = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                }

                                cont.DropItem(weapon);

                                cont.DropItem(new BankCheck(2000));
                                cont.DropItem(new EnchantedSextant());

                                if (!player.PlaceInBackpack(cont))
                                {
                                    cont.Delete();
                                    player.SendLocalizedMessage(1046260);                                       // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                }
                                else
                                {
                                    obj.Complete();
                                }
                            }
                            else if (contextMenu)
                            {
                                FocusTo(player);
                                player.SendLocalizedMessage(1061821);                                   // Mardoth has nothing more for you at this time.
                            }
                        }
                    }
                }
            }
            else if (qs == null && QuestSystem.CanOfferQuest(player, typeof(DarkTidesQuest)))
            {
                new DarkTidesQuest(player).SendOffer();
            }
        }
 public InternalTarget(BaseCreature c) : base(10, true, TargetFlags.None)
 {
     m_Creature = c;
 }
Esempio n. 38
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)               // Cancel
            {
                return;
            }
            else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            PMList list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            PMEntry entry = list.Entries[listEntry];

            if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Factions.Sigil.ExistsOn(m_Mobile) && list.Map != Factions.Faction.Facet)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (m_Mobile.Criminal)
            {
                m_Mobile.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (m_Mobile.Spell != null)
            {
                m_Mobile.SendLocalizedMessage(1049616);                   // You are too busy to do that at the moment.
            }
            else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                m_Mobile.Combatant = null;
                m_Mobile.Warmode   = false;
                m_Mobile.Hidden    = true;

                m_Mobile.MoveToWorld(entry.Location, list.Map);

                Effects.PlaySound(entry.Location, list.Map, 0x1FE);
            }
        }
Esempio n. 39
0
        private static void SummonDelay_Callback(object state)
        {
            object[] states = (object[])state;

            Mobile        caster = (Mobile)states[0];
            Corpse        corpse = (Corpse)states[1];
            Point3D       loc    = (Point3D)states[2];
            Map           map    = (Map)states[3];
            CreatureGroup group  = (CreatureGroup)states[4];

            if (corpse.Animated)
            {
                return;
            }

            Mobile owner = corpse.Owner;

            if (owner == null)
            {
                return;
            }

            double necromancy  = caster.Skills[SkillName.Necromancy].Value;
            double spiritSpeak = caster.Skills[SkillName.SpiritSpeak].Value;

            int casterAbility = 0;

            casterAbility += (int)(necromancy * 30);
            casterAbility += (int)(spiritSpeak * 70);
            casterAbility /= 10;
            casterAbility *= 18;

            if (casterAbility > owner.Fame)
            {
                casterAbility = owner.Fame;
            }

            if (casterAbility < 0)
            {
                casterAbility = 0;
            }

            Type toSummon = null;

            SummonEntry[] entries = group.m_Entries;

            for (int i = 0; toSummon == null && i < entries.Length; ++i)
            {
                SummonEntry entry = entries[i];

                if (casterAbility < entry.m_Requirement)
                {
                    continue;
                }

                Type[] animates = entry.m_ToSummon;

                if (animates.Length >= 0)
                {
                    toSummon = animates[Utility.Random(animates.Length)];
                }
            }

            if (toSummon == null)
            {
                return;
            }

            Mobile summoned = null;

            try{ summoned = Activator.CreateInstance(toSummon) as Mobile; }
            catch {}

            if (summoned == null)
            {
                return;
            }

            if (summoned is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)summoned;

                // to be sure
                bc.Tamable = false;

                if (bc is BaseMount)
                {
                    bc.ControlSlots = 1;
                }
                else
                {
                    bc.ControlSlots = 0;
                }

                Effects.PlaySound(loc, map, bc.GetAngerSound());

                BaseCreature.Summon((BaseCreature)summoned, false, caster, loc, 0x28, TimeSpan.FromDays(1.0));
            }

            if (summoned is SkeletalDragon)
            {
                Scale((SkeletalDragon)summoned, 50);                   // lose 50% hp and strength
            }
            summoned.Fame  = 0;
            summoned.Karma = -1500;

            summoned.MoveToWorld(loc, map);

            corpse.Hue      = 1109;
            corpse.Animated = true;

            Register(caster, summoned);
        }
Esempio n. 40
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState);
                            // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState);
                            // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState);
                            // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState);
                            // That creature can only be tamed by females.
                        }
                        else if (creature is CuSidhe && from.Race != Race.Elf)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502801, from.NetState);                             // You can't tame that!
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611);                             // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState);
                            // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState);
                            // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042590, from.NetState);
                                    // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState);
                                // Someone else is already taming this.
                            }
                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState);
                                // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);

                                if (creature.BardPacified && Utility.RandomDouble() > .24)
                                {
                                    Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature);
                                }
                                else
                                {
                                    creature.BardEndTime = DateTime.UtcNow;
                                }

                                creature.BardPacified = false;

                                if (creature.AIObject != null)
                                {
                                    creature.AIObject.DoMove(creature.Direction);
                                }

                                if (from is PlayerMobile &&
                                    !(((PlayerMobile)from).HonorActive ||
                                      TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell))))
                                {
                                    creature.Combatant = from;
                                }
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);                                 // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598);                              // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState);
                            // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState);
                        // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801);                     // You can't tame that!
                }
            }
Esempio n. 41
0
 public static void ScaleSkills(BaseCreature bc, double scalar)
 {
     ScaleSkills(bc, scalar, scalar);
 }
Esempio n. 42
0
        public static void SpawnCreatures(Mobile m, double difficulty)
        {
            BaseBoat boat = BaseBoat.FindBoatAt(m.Location, m.Map);

            Type[] types = GetCreatureType(m, boat != null);

            if (types == null)
            {
                return;
            }

            int amount = Utility.RandomMinMax(3, 5);

            for (int i = 0; i < amount; i++)
            {
                BaseCreature bc = Activator.CreateInstance(types[Utility.Random(types.Length)]) as BaseCreature;

                if (bc != null)
                {
                    if (KrampusEncounterActive)
                    {
                        bc.Name = "An Icy Creature";
                    }

                    Rectangle2D zone;

                    if (boat != null)
                    {
                        if (boat.Facing == Direction.North || boat.Facing == Direction.South)
                        {
                            if (Utility.RandomBool())
                            {
                                zone = new Rectangle2D(boat.X - 7, m.Y - 4, 3, 3);
                            }
                            else
                            {
                                zone = new Rectangle2D(boat.X + 4, m.Y - 4, 3, 3);
                            }
                        }
                        else
                        {
                            if (Utility.RandomBool())
                            {
                                zone = new Rectangle2D(m.X + 4, boat.Y - 7, 3, 3);
                            }
                            else
                            {
                                zone = new Rectangle2D(m.X + 4, boat.Y + 4, 3, 3);
                            }
                        }
                    }
                    else
                    {
                        zone = new Rectangle2D(m.X - 3, m.Y - 3, 6, 6);
                    }

                    Point3D p = m.Location;

                    if (m.Map != null)
                    {
                        for (int j = 0; j < 25; j++)
                        {
                            Point3D check = m.Map.GetRandomSpawnPoint(zone);

                            if (CanFit(check.X, check.Y, check.Z, m.Map, bc))
                            {
                                p = check;
                                break;
                            }
                        }
                    }

                    foreach (Skill sk in bc.Skills.Where(s => s.Base > 0))
                    {
                        sk.Base += sk.Base * (difficulty);
                    }

                    bc.RawStr += (int)(bc.RawStr * difficulty);
                    bc.RawInt += (int)(bc.RawInt * difficulty);
                    bc.RawDex += (int)(bc.RawDex * difficulty);

                    if (bc.HitsMaxSeed == -1)
                    {
                        bc.HitsMaxSeed = bc.RawStr;
                    }

                    if (bc.StamMaxSeed == -1)
                    {
                        bc.StamMaxSeed = bc.RawDex;
                    }

                    if (bc.ManaMaxSeed == -1)
                    {
                        bc.ManaMaxSeed = bc.RawInt;
                    }

                    bc.HitsMaxSeed += (int)(bc.HitsMaxSeed * difficulty);
                    bc.StamMaxSeed += (int)(bc.StamMaxSeed * difficulty);
                    bc.ManaMaxSeed += (int)(bc.ManaMaxSeed * difficulty);

                    bc.Hits = bc.HitsMaxSeed;
                    bc.Stam = bc.RawDex;
                    bc.Mana = bc.RawInt;

                    bc.PhysicalResistanceSeed += (int)(bc.PhysicalResistanceSeed * (difficulty / 3));
                    bc.FireResistSeed         += (int)(bc.FireResistSeed * (difficulty / 3));
                    bc.ColdResistSeed         += (int)(bc.ColdResistSeed * (difficulty / 3));
                    bc.PoisonResistSeed       += (int)(bc.PoisonResistSeed * (difficulty / 3));
                    bc.EnergyResistSeed       += (int)(bc.EnergyResistSeed * (difficulty / 3));

                    bc.IsAmbusher = true;

                    if (Ambushers == null)
                    {
                        Ambushers = new Dictionary <BaseCreature, DateTime>();
                    }

                    Ambushers.Add(bc, DateTime.UtcNow + TimeSpan.FromMinutes(AmbusherDelete));

                    bc.MoveToWorld(p, m.Map);
                    Timer.DelayCall(() => bc.Combatant = m);
                }
            }

            m.LocalOverheadMessage(Server.Network.MessageType.Regular, 1150, 1155479); // *Your keen senses alert you to an incoming ambush of attackers!*
            m.SendLocalizedMessage(1049330, "", 0x22);                                 // You have been ambushed! Fight for your honor!!!
        }
Esempio n. 43
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (!(targeted is Mobile))
                {
                    from.SendLocalizedMessage(1049528);                       // You cannot calm that!
                }
                else if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488);                       // The instrument you are trying to play is no longer in your backpack!
                }
                else
                {
                    m_SetSkillTime     = false;
                    from.NextSkillTime = DateTime.UtcNow + BaseInstrument.GetBardSkillTimeout(SkillName.Peacemaking, from);

                    if (targeted == from)
                    {
                        // Standard mode : reset combatants for everyone in the area

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (!BaseInstrument.CheckBardSkillChance(from, SkillName.Peacemaking, 0.0, 120.0))
                        {
                            from.SendLocalizedMessage(500613);                               // You attempt to calm everyone, but fail.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            Map map = from.Map;

                            if (map != null)
                            {
                                int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking);

                                bool calmed = false;

                                foreach (Mobile m in from.GetMobilesInRange(range))
                                {
                                    if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful(m, false))
                                    {
                                        continue;
                                    }

                                    calmed = true;

                                    m.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    m.Combatant = null;
                                    m.Warmode   = false;

                                    if (m is BaseCreature && !((BaseCreature)m).BardPacified)
                                    {
                                        ((BaseCreature)m).Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(1.0));
                                    }
                                }

                                if (!calmed)
                                {
                                    from.SendLocalizedMessage(1049648);                                       // You play hypnotic music, but there is nothing in range for you to calm.
                                }
                                else
                                {
                                    from.SendLocalizedMessage(500615);                                       // You play your hypnotic music, stopping the battle.
                                }
                            }
                        }
                    }
                    else
                    {
                        // Target mode : pacify a single target for a longer duration

                        Mobile targ = (Mobile)targeted;

                        if (!from.CanBeHarmful(targ, false))
                        {
                            from.SendLocalizedMessage(1049528);
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).Uncalmable)
                        {
                            from.SendLocalizedMessage(1049526);                               // You have no chance of calming that creature.
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).BardPacified)
                        {
                            from.SendLocalizedMessage(1049527);                               // That creature is already being calmed.
                            m_SetSkillTime = true;
                        }
                        else if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (!BaseInstrument.CheckBardSkillChance(from, SkillName.Peacemaking, targ, diff - 25.0, diff + 25.0))
                            {
                                from.SendLocalizedMessage(1049531);                                   // You attempt to calm your target, but fail.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);

                                if (targ is BaseCreature)
                                {
                                    BaseCreature bc = (BaseCreature)targ;

                                    from.SendLocalizedMessage(1049532);                                       // You play hypnotic music, calming your target.

                                    targ.Combatant = null;
                                    targ.Warmode   = false;

                                    double seconds = 100 - (diff / 1.5);
                                    Utility.FixMinMax(ref seconds, 10, 120);

                                    bc.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds));

                                    PlayerMobile pm = from as PlayerMobile;

                                    if (pm != null)
                                    {
                                        QuestHelper.OnCalmed(pm, targ);
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049532);                                      // You play hypnotic music, calming your target.

                                    targ.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    targ.Combatant = null;
                                    targ.Warmode   = false;
                                }
                            }
                        }
                    }
                }
            }
Esempio n. 44
0
        public override bool CheckContentDisplay(Mobile from)
        {
            BaseCreature bc = this.RootParent as BaseCreature;

            return((bc != null && bc.Controlled && bc.ControlMaster == from) || base.CheckContentDisplay(from));
        }
Esempio n. 45
0
        public bool MoveToNearestDockOrLand(Mobile from)
        {
            if ((Boat != null && !Boat.Contains(from)) || !ValidateDockOrLand())
            {
                return(false);
            }

            Map map = Map;

            if (map == null)
            {
                return(false);
            }

            Rectangle2D rec;
            Point3D     nearest = Point3D.Zero;
            Point3D     p       = Point3D.Zero;

            if (Boat.IsRowBoat)
            {
                rec = new Rectangle2D(Boat.X - 8, Boat.Y - 8, 16, 16);
            }
            else
            {
                switch (Boat.Facing)
                {
                default:
                case Direction.North:
                case Direction.South:
                    if (X < Boat.X)
                    {
                        rec = new Rectangle2D(X - 8, Y - 8, 8, 16);
                    }
                    else
                    {
                        rec = new Rectangle2D(X, Y - 8, 8, 16);
                    }
                    break;

                case Direction.West:
                case Direction.East:
                    if (Y < Boat.Y)
                    {
                        rec = new Rectangle2D(X - 8, Y - 8, 16, 8);
                    }
                    else
                    {
                        rec = new Rectangle2D(X - 8, Y, 16, 8);
                    }
                    break;
                }
            }

            for (int x = rec.X; x <= rec.X + rec.Width; x++)
            {
                for (int y = rec.Y; y <= rec.Y + rec.Height; y++)
                {
                    p = new Point3D(x, y, map.GetAverageZ(x, y));

                    if (ValidateTile(from, ref p))
                    {
                        if (nearest == Point3D.Zero || from.GetDistanceToSqrt(p) < from.GetDistanceToSqrt(nearest))
                        {
                            nearest = p;
                        }
                    }
                }
            }

            if (nearest != Point3D.Zero)
            {
                BaseCreature.TeleportPets(from, nearest, Map);
                from.MoveToWorld(nearest, Map);

                return(true);
            }

            return(false);
        }
Esempio n. 46
0
        public void Effect(Point3D loc, Map map, bool checkMulti)
        {
            Region r = Region.Find(loc, map);

            if (Factions.Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1061632);                   // You can't do that while carrying the sigil.
            }
            else if (map == null || (!Core.AOS && Caster.Map != map))
            {
                Caster.SendLocalizedMessage(1005569);                   // You can not recall to another facet.
            }
            else if (r.IsPartOf(typeof(HouseRegion)))
            {
                Caster.SendLocalizedMessage(501025);                   // Something is blocking the location.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
            {
            }
            else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
            {
                Caster.SendLocalizedMessage(1049543);                   // You decide against traveling to Felucca while you are still young.
            }
            else if (Caster.Kills >= 5 && map != Map.Felucca)
            {
                Caster.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Caster.Criminal)
            {
                Caster.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(Caster))
            {
                Caster.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (Server.Misc.WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22);                   // Thou art too encumbered to move.
            }
            else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
            {
                Caster.SendLocalizedMessage(501942);                   // That location is blocked.
            }
            else if ((checkMulti && SpellHelper.CheckMulti(loc, map)))
            {
                Caster.SendLocalizedMessage(501942);                   // That location is blocked.
            }
            else if (m_Book != null && m_Book.CurCharges <= 0)
            {
                Caster.SendLocalizedMessage(502412);                   // There are no charges left on that item.
            }
//added to stop player from teleporting if draging something.
            else if (this.Caster.Holding != null)
            {
                this.Caster.SendLocalizedMessage(1071955);                 // You cannot teleport while dragging an object.
            }
//added fin
            else if (CheckSequence())
            {
                BaseCreature.TeleportPets(Caster, loc, map, true);

                if (m_Book != null)
                {
                    --m_Book.CurCharges;
                }

                Caster.PlaySound(0x1FC);
                Caster.MoveToWorld(loc, map);
                Caster.PlaySound(0x1FC);
            }

            FinishSequence();
        }
Esempio n. 47
0
            protected override void OnTick()
            {
                if (DateTime.UtcNow < m_End)
                {
                    m_Mobile.Frozen = true;
                }
                else if (CityTradeSystem.HasTrade(m_Mobile))
                {
                    m_Mobile.Frozen = false;
                    Stop();
                    m_Mobile.SendLocalizedMessage(1151733);                     // You cannot do that while carrying a Trade Order.
                }
                else
                {
                    m_Mobile.Frozen = false;
                    Stop();

                    int     idx  = Utility.Random(m_Destination.Locations.Length);
                    Point3D dest = m_Destination.Locations[idx];

                    Map destMap;
                    if (m_Mobile.Map == Map.Trammel || SpellHelper.IsEodon(m_Mobile.Map, m_Mobile.Location))
                    {
                        destMap = Map.Trammel;
                    }
                    else if (m_Mobile.Map == Map.Felucca)
                    {
                        destMap = Map.Felucca;
                    }
                    else if (m_Mobile.Map == Map.TerMur && !SpellHelper.IsEodon(m_Mobile.Map, m_Mobile.Location))
                    {
                        destMap = Map.TerMur;
                    }
                    else if (m_Mobile.Map == Map.Internal)
                    {
                        destMap = m_Mobile.LogoutMap == Map.Felucca ? Map.Felucca : Map.Trammel;
                    }
                    else
                    {
                        destMap = m_Mobile.Murderer ? Map.Felucca : Map.Trammel;
                    }

                    if (destMap == Map.Trammel && Siege.SiegeShard)
                    {
                        destMap = Map.Felucca;
                    }

                    if (m_Mobile.Map != Map.Internal)
                    {
                        BaseCreature.TeleportPets(m_Mobile, dest, destMap);
                        m_Mobile.MoveToWorld(dest, destMap);
                    }
                    else
                    {
                        // for shards without auto stabling
                        MovePetsOfLoggedCharacter(dest, destMap);

                        m_Mobile.LogoutLocation = dest;
                        m_Mobile.LogoutMap      = destMap;
                    }
                }
            }
Esempio n. 48
0
        public virtual void Summon()
        {
            int max = MaxSummons;
            Map map = Map;

            ShadowguardEncounter inst = ShadowguardController.GetEncounter(Location, Map);

            if (inst != null)
            {
                max += inst.PartySize() * 2;
            }

            if (map == null || SummonTypes == null || SummonTypes.Length == 0 || TotalSummons() > max)
            {
                return;
            }

            int count = Utility.RandomList(1, 2, 2, 2, 3, 3, 4, 5);

            for (int i = 0; i < count; i++)
            {
                if (Combatant == null)
                {
                    return;
                }

                Point3D p = Combatant.Location;

                for (int j = 0; j < 10; j++)
                {
                    int x = Utility.RandomMinMax(p.X - 3, p.X + 3);
                    int y = Utility.RandomMinMax(p.Y - 3, p.Y + 3);
                    int z = map.GetAverageZ(x, y);

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

                BaseCreature spawn = Activator.CreateInstance(SummonTypes[Utility.Random(SummonTypes.Length)]) as BaseCreature;

                if (spawn != null)
                {
                    spawn.MoveToWorld(p, map);
                    spawn.Team         = Team;
                    spawn.SummonMaster = this;

                    Timer.DelayCall(TimeSpan.FromSeconds(1), o =>
                    {
                        BaseCreature s = o;

                        if (s != null && s.Combatant != null)
                        {
                            if (!(s.Combatant is PlayerMobile) || !((PlayerMobile)s.Combatant).HonorActive)
                            {
                                s.Combatant = Combatant;
                            }
                        }
                    }, spawn);

                    AddHelper(spawn);
                }
            }

            _NextSummon = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 40));
        }
Esempio n. 49
0
 public InternalTimer(BaseCreature bc) : base(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2))
 {
     m_Creature = bc;
     Priority   = TimerPriority.OneMinute;
 }
Esempio n. 50
0
        public Corpse(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> equipItems)
            : base(0x2006)
        {
            // To suppress console warnings, stackable must be true
            Stackable = true;
            Amount    = owner.Body; // protocol defines that for itemid 0x2006, amount=body
            Stackable = false;

            Movable   = false;
            Hue       = owner.Hue;
            Direction = owner.Direction;
            Name      = owner.Name;

            Owner = owner;

            m_CorpseName = GetCorpseName(owner);

            TimeOfDeath = DateTime.UtcNow;

            AccessLevel = owner.AccessLevel;
            Guild       = owner.Guild as Guild;
            Kills       = owner.Kills;
            SetFlag(CorpseFlag.Criminal, owner.Criminal);

            Hair       = hair;
            FacialHair = facialhair;

            // This corpse does not turn to bones if: the owner is not a player
            SetFlag(CorpseFlag.NoBones, !owner.Player);

            Looters    = new List <Mobile>();
            EquipItems = equipItems;

            Aggressors = new List <Mobile>(owner.Aggressors.Count + owner.Aggressed.Count);
            // bool addToAggressors = !( owner is BaseCreature );

            var isBaseCreature = owner is BaseCreature;

            var lastTime = TimeSpan.MaxValue;

            for (var i = 0; i < owner.Aggressors.Count; ++i)
            {
                var info = owner.Aggressors[i];

                if (DateTime.UtcNow - info.LastCombatTime < lastTime)
                {
                    Killer   = info.Attacker;
                    lastTime = DateTime.UtcNow - info.LastCombatTime;
                }

                if (!isBaseCreature && !info.CriminalAggression)
                {
                    Aggressors.Add(info.Attacker);
                }
            }

            for (var i = 0; i < owner.Aggressed.Count; ++i)
            {
                var info = owner.Aggressed[i];

                if (DateTime.UtcNow - info.LastCombatTime < lastTime)
                {
                    Killer   = info.Defender;
                    lastTime = DateTime.UtcNow - info.LastCombatTime;
                }

                if (!isBaseCreature)
                {
                    Aggressors.Add(info.Defender);
                }
            }

            if (isBaseCreature)
            {
                var bc = (BaseCreature)owner;

                var master = bc.GetMaster();
                if (master != null)
                {
                    Aggressors.Add(master);
                }

                var rights = BaseCreature.GetLootingRights(bc.DamageEntries, bc.HitsMax);
                for (var i = 0; i < rights.Count; ++i)
                {
                    var ds = rights[i];

                    if (ds.m_HasRight)
                    {
                        Aggressors.Add(ds.m_Mobile);
                    }
                }
            }

            BeginDecay(m_DefaultDecayTime);

            DevourCorpse();
        }
Esempio n. 51
0
 public AnimalAI(BaseCreature m)
     : base(m)
 {
 }
Esempio n. 52
0
 /// <summary>
 /// 24000 is the normalized fame for MaxBaseBudget, ie Balron.
 /// Called in BaseCreature.cs virtual BaseLootBudget Property
 /// </summary>
 /// <param name="bc">Creature to be evaluated</param>
 /// <returns></returns>
 public static int GetBaseBudget(BaseCreature bc)
 {
     return(bc.Fame / (20500 / MaxBaseBudget));
 }
Esempio n. 53
0
        public void Effect(Point3D loc, Map map, bool checkMulti, bool isboatkey = false)
        {
            if (Server.Engines.VvV.VvVSigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            }
            else if (map == null)
            {
                Caster.SendLocalizedMessage(1005569); // You can not recall to another facet.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
            {
            }
            else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
            {
                Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
            }
            else if (SpellHelper.RestrictRedTravel && Caster.Murderer && map.Rules != MapRules.FeluccaRules)
            {
                Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
            }
            else if (Caster.Criminal)
            {
                Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(Caster))
            {
                Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
            }
            else if (Misc.WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }
            else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey)
            {
                Caster.SendLocalizedMessage(501025); // Something is blocking the location.
            }
            else if (checkMulti && SpellHelper.CheckMulti(loc, map) && !isboatkey)
            {
                Caster.SendLocalizedMessage(501025); // Something is blocking the location.
            }
            else if (m_Book != null && m_Book.CurCharges <= 0)
            {
                Caster.SendLocalizedMessage(502412); // There are no charges left on that item.
            }
            else if (Caster.Holding != null)
            {
                Caster.SendLocalizedMessage(1071955); // You cannot teleport while dragging an object.
            }
            else if (Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster))
            {
                Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order.
            }
            else if (CheckSequence())
            {
                BaseCreature.TeleportPets(Caster, loc, map, true);

                if (m_Book != null)
                {
                    --m_Book.CurCharges;
                }

                if (m_SearchMap != null)
                {
                    m_SearchMap.OnBeforeTravel(Caster);
                }

                if (m_AuctionMap != null)
                {
                    m_AuctionMap.OnBeforeTravel(Caster);
                }

                Caster.PlaySound(0x1FC);
                Caster.MoveToWorld(loc, map);
                Caster.PlaySound(0x1FC);
            }

            FinishSequence();
        }
Esempio n. 54
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_Boat == null)
            {
                return;
            }

            if (from.InRange(GetWorldLocation(), 8))
            {
                if (m_Boat.Contains(from))
                {
                    if (IsOpen)
                    {
                        Close();
                    }
                    else
                    {
                        Open();
                    }
                }
                else
                {
                    if (!IsOpen)
                    {
                        if (!Locked)
                        {
                            Open();
                        }
                        else if (from.AccessLevel >= AccessLevel.GameMaster)
                        {
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x00, 502502);                               // That is locked but your godly powers allow access
                            Open();
                        }
                        else
                        {
                            from.LocalOverheadMessage(Network.MessageType.Regular, 0x00, 502503);                               // That is locked.
                        }
                    }
                    else if (!Locked)
                    {
                        Point3D p = new Point3D(this.X, this.Y, this.Z + 3);

                        BaseCreature.TeleportPets(from, p, Map);
                        from.Location = p;
                    }
                    else if (from.AccessLevel >= AccessLevel.GameMaster)
                    {
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x00, 502502);                           // That is locked but your godly powers allow access

                        Point3D p = new Point3D(this.X, this.Y, this.Z + 3);

                        BaseCreature.TeleportPets(from, p, Map);
                        from.Location = p;
                    }
                    else
                    {
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x00, 502503);                           // That is locked.
                    }
                }
            }
        }
Esempio n. 55
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile       from     = state.Mobile;
            BaseCreature toMobile = m_to;

            if (toMobile.Alive)
            {
                m_ai = toMobile.AIObject;

                if (m_ai == null)
                {
                    from.SendMessage("Mobile AI is null or unavailable. Unable to process with this item.");
                    return;
                }

                toMobile.CantWalk = false;

                m_ai.NextMove = DateTime.Now + TimeSpan.FromSeconds(60);
                DateTime delay = DateTime.Now + TimeSpan.FromSeconds(60);

                if (info.ButtonID == 0)
                {
                    from.SendMessage("You finish controlling " + toMobile.Name);
                    m_ai.NextMove = DateTime.Now;
                }

                if (info.ButtonID == 1)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.North);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 2)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.East);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 3)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.South);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 4)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.West);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 5)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.Up);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 6)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.Right);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 7)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.Down);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 8)
                {
                    m_ai.NextMove = DateTime.Now;
                    m_ai.DoMove(Direction.Left);
                    m_ai.NextMove = delay;
                    from.SendGump(new CreatureControl(toMobile, from));
                }

                if (info.ButtonID == 9)
                {
                    from.SendMessage("Who would you like this creature to attack?");
                    from.Target = new CombatTarget(m_ai, toMobile);
                }
            }
        }
Esempio n. 56
0
 public static void RemoveAllEffects(BaseCreature target)
 {
     RemoveAllEffects(target, null);
 }
Esempio n. 57
0
        public override void ProcessKill(Mobile victim, Mobile damager)
        {
            BaseCreature bc = victim as BaseCreature;

            if (bc == null)
            {
                return;
            }

            if (TOSDSpawner.Instance != null)
            {
                TOSDSpawner.Instance.OnCreatureDeath(bc);
            }

            if (!Enabled || bc.Controlled || bc.Summoned || !damager.Alive)
            {
                return;
            }

            Region r = bc.Region;

            if (damager is PlayerMobile && r.IsPartOf("Sorcerer's Dungeon"))
            {
                if (!DungeonPoints.ContainsKey(damager))
                {
                    DungeonPoints[damager] = 0;
                }

                int fame = bc.Fame / 4;
                int luck = Math.Max(0, ((PlayerMobile)damager).RealLuck);

                DungeonPoints[damager] += (int)(fame * (1 + Math.Sqrt(luck) / 100));

                int          x = DungeonPoints[damager];
                const double A = 0.000863316841;
                const double B = 0.00000425531915;

                double chance = A * Math.Pow(10, B * x);

                if (chance > Utility.RandomDouble())
                {
                    Item i = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(bc), LootPackEntry.IsMondain(bc), LootPackEntry.IsStygian(bc));

                    if (i != null)
                    {
                        RunicReforging.GenerateRandomItem(i, damager, Math.Max(100, RunicReforging.GetDifficultyFor(bc)), RunicReforging.GetLuckForKiller(bc), ReforgedPrefix.None, ReforgedSuffix.EnchantedOrigin);

                        damager.PlaySound(0x5B4);
                        damager.SendLocalizedMessage(1157613); // You notice some of your fallen foes' equipment to be of enchanted origin and decide it may be of some value...

                        if (!damager.PlaceInBackpack(i))
                        {
                            if (damager.BankBox != null && damager.BankBox.TryDropItem(damager, i, false))
                            {
                                damager.SendLocalizedMessage(1079730); // The item has been placed into your bank box.
                            }
                            else
                            {
                                damager.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it.
                                i.MoveToWorld(damager.Location, damager.Map);
                            }
                        }

                        DungeonPoints.Remove(damager);
                    }
                }
            }
        }
Esempio n. 58
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Boat == null || from == null)
            {
                return;
            }

            BaseBoat boat = BaseBoat.FindBoatAt(from, from.Map);

            int  range   = boat != null && boat == Boat ? 3 : 8;
            bool canMove = false;

            if (!Boat.IsRowBoat)
            {
                Boat.Refresh(from);
            }

            if (!from.InRange(Location, range))
            {
                from.SendLocalizedMessage(500295); //You are too far away to do that.
            }
            else if (!from.InLOS(Location))
            {
                from.SendLocalizedMessage(500950); //You cannot see that.
            }
            else if (Boat.IsMoving || Boat.IsTurning)
            {
                from.SendLocalizedMessage(1116611); //You can't use that while the ship is moving!
            }
            else if (BaseBoat.IsDriving(from))
            {
                from.SendLocalizedMessage(1116610); //You can't do that while piloting a ship!
            }
            else if (BaseHouse.FindHouseAt(from) != null)
            {
                from.SendLocalizedMessage(1149795); //You may not dock a ship while on another ship or inside a house.
            }
            else if (Boat == boat && !MoveToNearestDockOrLand(from))
            {
                from.SendLocalizedMessage(1149796); //You can not dock a ship this far out to sea. You must be near land or shallow water.
            }
            else if (boat == null || boat != null && Boat != boat)
            {
                if (Boat.HasAccess(from))
                {
                    canMove = true;
                }
                else
                {
                    from.SendLocalizedMessage(1116617); //You do not have permission to board this ship.
                }
            }

            if (canMove)
            {
                BaseCreature.TeleportPets(from, Location, Map);
                from.MoveToWorld(Location, Map);

                Boat.SendContainerPacket();
            }
        }
Esempio n. 59
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            PlayerMobile player = from as PlayerMobile;

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

                if (qs is UzeraanTurmoilQuest)
                {
                    if (dropped is UzeraanTurmoilHorn)
                    {
                        if (player.Young)
                        {
                            UzeraanTurmoilHorn horn = (UzeraanTurmoilHorn)dropped;

                            if (horn.Charges < 10)
                            {
                                this.SayTo(from, 1049384); // I have recharged the item for you.
                                horn.Charges = 10;
                            }
                            else
                            {
                                this.SayTo(from, 1049385); // That doesn't need recharging yet.
                            }
                        }
                        else
                        {
                            player.SendLocalizedMessage(1114333); //You must be young to have this item recharged.
                        }

                        return(false);
                    }

                    if (dropped is SchmendrickScrollOfPower)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnScrollOfPowerObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            cont.DropItem(new TreasureMap(player.Young ? 0 : 1, Map.Trammel));
                            cont.DropItem(new Shovel());
                            cont.DropItem(new UzeraanTurmoilHorn());

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestFertileDirt)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnFertileDirtObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            if (player.Profession == 2) // magician
                            {
                                cont.DropItem(new BlackPearl(20));
                                cont.DropItem(new Bloodmoss(20));
                                cont.DropItem(new Garlic(20));
                                cont.DropItem(new Ginseng(20));
                                cont.DropItem(new MandrakeRoot(20));
                                cont.DropItem(new Nightshade(20));
                                cont.DropItem(new SulfurousAsh(20));
                                cont.DropItem(new SpidersSilk(20));

                                for (int i = 0; i < 3; i++)
                                {
                                    cont.DropItem(Loot.RandomScroll(0, 23, SpellbookType.Regular));
                                }
                            }
                            else
                            {
                                cont.DropItem(new Gold(300));
                                cont.DropItem(new Bandage(25));

                                for (int i = 0; i < 5; i++)
                                {
                                    cont.DropItem(new LesserHealPotion());
                                }
                            }

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestDaemonBlood)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBloodObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Item reward;

                            if (player.Profession == 2) // magician
                            {
                                Container cont = GetNewContainer();

                                cont.DropItem(new ExplosionScroll(4));
                                cont.DropItem(new MagicWizardsHat());

                                reward = cont;
                            }
                            else
                            {
                                BaseWeapon weapon;
                                switch (Utility.Random(6))
                                {
                                case 0:
                                    weapon = new Broadsword();
                                    break;

                                case 1:
                                    weapon = new Cutlass();
                                    break;

                                case 2:
                                    weapon = new Katana();
                                    break;

                                case 3:
                                    weapon = new Longsword();
                                    break;

                                case 4:
                                    weapon = new Scimitar();
                                    break;

                                default:
                                    weapon = new VikingSword();
                                    break;
                                }

                                if (Core.AOS)
                                {
                                    BaseRunicTool.ApplyAttributesTo(weapon, 3, 20, 40);
                                }
                                else
                                {
                                    weapon.DamageLevel     = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                }

                                weapon.Slayer = SlayerName.Silver;

                                reward = weapon;
                            }

                            if (!player.PlaceInBackpack(reward))
                            {
                                reward.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestDaemonBone)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBoneObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            if (!Core.TOL)
                            {
                                cont.DropItem(new BankCheck(2000));
                            }
                            else
                            {
                                Banker.Deposit(from, 2000, true);
                            }

                            cont.DropItem(new EnchantedSextant());

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Esempio n. 60
0
        protected override void OnTarget(Mobile from, object target)
        {
            BaseCreature pet = target as BaseCreature;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if (!m_StaffCommand && null != m_ShrinkTool && m_ShrinkTool.ShrinkCharges > 0)
                {
                    m_ShrinkTool.ShrinkCharges--;
                }
            }
        }