Пример #1
0
		public void SpawnAnt( BaseCreature ant )
		{
			m_Spawned.Add( ant );

			Map map = Map;
			Point3D p = Location;

			for ( int i = 0; i < 5; i++ )
				if ( SpellHelper.FindValidSpawnLocation( map, ref p, false ) )
					break;

			ant.MoveToWorld( p, map );
			ant.Home = Location;
			ant.RangeHome = 10;
		}
Пример #2
0
        public void EndClaimList(Mobile from, BaseCreature pet)
        {
            if (pet == null || pet.Deleted || from.Map != this.Map || !from.InRange(this, 14) || !from.Stabled.Contains(pet) || !from.CheckAlive())
                return;

            if ((from.Followers + pet.ControlSlots) <= from.FollowersMax)
            {
                pet.SetControlMaster(from);

                if (pet.Summoned)
                    pet.SummonMaster = from;

                pet.ControlTarget = from;
                pet.ControlOrder = OrderType.Follow;

                pet.MoveToWorld(from.Location, from.Map);

                pet.IsStabled = false;
                from.Stabled.Remove(pet);

                from.SendLocalizedMessage(1042559); // Here you go... and good day to you!
            }
            else
            {
                from.SendLocalizedMessage(1049612, pet.Name); // ~1_NAME~ remained in the stables because you have too many followers.
            }
        }
Пример #3
0
		public static bool Summon( BaseCreature creature, bool controlled, Mobile caster, Point3D p, int sound, TimeSpan duration )
		{
			if ( caster.Followers + creature.ControlSlots > caster.FollowersMax )
			{
				caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
				creature.Delete();
				return false;
			}

			m_Summoning = true;

			if ( controlled )
				creature.SetControlMaster( caster );

			creature.RangeHome = 10;
			creature.Summoned = true;

			creature.SummonMaster = caster;

			Container pack = creature.Backpack;

			if ( pack != null )
			{
				for ( int i = pack.Items.Count - 1; i >= 0; --i )
				{
					if ( i >= pack.Items.Count )
						continue;

					pack.Items[i].Delete();
				}
			}

			new UnsummonTimer( caster, creature, duration ).Start();
			creature.m_SummonEnd = DateTime.Now + duration;

			creature.MoveToWorld( p, caster.Map );

			Effects.PlaySound( p, creature.Map, sound );

			m_Summoning = false;

			return true;
		}
Пример #4
0
		private void DoClaim(Mobile from, BaseCreature pet)
		{
			pet.SetControlMaster(from);

			if (pet.Summoned)
			{
				pet.SummonMaster = from;
			}

			pet.ControlTarget = from;
			pet.ControlOrder = OrderType.Follow;

			pet.MoveToWorld(from.Location, from.Map);

			pet.IsStabled = false;

			pet.Loyalty = MaxLoyalty; // Wonderfully Happy
		}
Пример #5
0
        protected void Spawn(Point3D p, Map map, BaseCreature spawn)
        {
            if (map == null)
            {
                spawn.Delete();
                return;
            }

            int x = p.X, y = p.Y;

            for (int j = 0; j < 20; ++j)
            {
                int tx = p.X - 2 + Utility.Random(5);
                int ty = p.Y - 2 + Utility.Random(5);

                LandTile t = map.Tiles.GetLandTile(tx, ty);

                if (t.Z == p.Z && ((t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137)) && !Spells.SpellHelper.CheckMulti(new Point3D(tx, ty, p.Z), map))
                {
                    x = tx;
                    y = ty;
                    break;
                }
            }

            spawn.MoveToWorld(new Point3D(x, y, p.Z), map);

            if (spawn is Kraken && 0.2 > Utility.RandomDouble())
                spawn.PackItem(new MessageInABottle(map == Map.Felucca ? Map.Felucca : Map.Trammel));
        }
Пример #6
0
		protected bool SpawnCreature( BaseCreature creature )
		{
			for ( int i = 0; i < 5; i++ ) // Try 5 times
			{
				int x = Location.X + Utility.RandomMinMax( -1, 1 );
				int y = Location.Y + Utility.RandomMinMax( -1, 1 );
				int z = Map.GetAverageZ( x, y );

				if ( Map.CanSpawnMobile( x, y, Location.Z ) )
				{
					creature.MoveToWorld( new Point3D( x, y, Location.Z ), Map );
					creature.Combatant = From;
					return true;
				}
				else if ( Map.CanSpawnMobile( x, y, z ) )
				{
					creature.MoveToWorld( new Point3D( x, y, z ), Map );
					creature.Combatant = From;
					return true;
				}
			}

			return false;
		}
Пример #7
0
        public static bool Summon( BaseCreature creature, bool controlled, Mobile caster, Point3D p, int sound, TimeSpan duration )
        {
            if ( caster.Followers + creature.ControlSlots > caster.FollowersMax )
            {
                caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
                creature.Delete();
                return false;
            }

            m_Summoning = true;

            creature.RangeHome = 10;
            creature.Summoned = true;

            if ( controlled )
                creature.SetControlMaster( caster );

            creature.SummonMaster = caster;

            Container pack = creature.Backpack;

            if ( pack != null )
            {
                for ( int i = pack.Items.Count - 1; i >= 0; --i )
                {
                    if ( i >= pack.Items.Count )
                        continue;

                    ( (Item) pack.Items[i] ).Delete();
                }
            }

            double hitsScalar = 1.0 + ( ArcaneEmpowermentSpell.GetSummonHitsBonus( caster ) / 100 );

            if ( hitsScalar != 1.0 )
                creature.SetHits( (int) ( creature.HitsMax * hitsScalar ) );

            new UnsummonTimer( caster, creature, duration ).Start();
            creature.m_SummonEnd = DateTime.Now + duration;

            creature.MoveToWorld( p, caster.Map );

            Effects.PlaySound( p, creature.Map, sound );

            if ( creature is EnergyVortex || creature is BladeSpirits )
                SpellHelper.CheckSummonLimits( creature );

            m_Summoning = false;

            return true;
        }
Пример #8
0
        public static void UnStablePet(Mobile from, BaseCreature pet, Mobile gm)
        {
            if (from == null || from.Deleted || pet == null || pet.Deleted || gm == null || gm.Deleted)
            {
                return;
            }

            if (from.Stabled.Contains(pet))
            {
                gm.SendMessage("Warning: This is a force claiming. Followers count will not be checked!");

                pet.SetControlMaster(from);
                if (pet.Summoned)
                {
                    pet.SummonMaster = from;
                }

                pet.ControlTarget = from;
                pet.ControlOrder = OrderType.Follow;

                if (from.Map == Map.Internal)
                {
                    gm.MoveToWorld(from.Location, from.Map);
                }
                else
                {
                    pet.MoveToWorld(from.Location, from.Map);
                }

                pet.IsStabled = false;
                from.Stabled.Remove(pet);
            }
        }
Пример #9
0
        public static void Summon( Mobile caster, BaseCreature summoned, int duration, int sound, bool cooldown )
        {
            summoned.Controlled = true;
            summoned.ControlMaster = caster;
            Map map = caster.Map;
            bool validLocation = false;
            Point3D loc = caster.Location;

            for ( int j = 0; !validLocation && j < 10; ++j )
            {
                int x = caster.X + Utility.Random( 3 ) - 1;
                int y = caster.Y + Utility.Random( 3 ) - 1;
                int z = map.GetAverageZ( x, y );

                if ( validLocation = map.CanFit( x, y, caster.Z, 16, false, false ) )
                    loc = new Point3D( x, y, caster.Z );
                else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )
                    loc = new Point3D( x, y, z );
            }

            summoned.MoveToWorld( loc, map );
            summoned.VanishTime = DateTime.Now + TimeSpan.FromHours( 1 );
            caster.PlaySound( sound );

            if( caster is PlayerMobile && cooldown )
                ((PlayerMobile)caster).NextSummoningAllowed = DateTime.Now + TimeSpan.FromMinutes( duration );

            else if( caster is BaseCreature )
                ((BaseCreature)caster).NextFeatUse = DateTime.Now + TimeSpan.FromMinutes( 1 );

            summoned.m_SummoningTimer = new SummoningTimer( summoned, duration );
            summoned.m_SummoningTimer.Start();
            summoned.Lives = -100;
        }
Пример #10
0
		protected static void Spawn( Point3D p, Map map, BaseCreature spawn )
		{
			if ( map == null )
			{
				spawn.Delete();
				return;
			}

			int x = p.X, y = p.Y;

			for ( int j = 0; j < 20; ++j )
			{
				int tx = p.X - 2 + Utility.Random( 5 );
				int ty = p.Y - 2 + Utility.Random( 5 );

				LandTile t = map.Tiles.GetLandTile( tx, ty );

				if ( t.Z == p.Z && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !SpellHelper.CheckMulti( new Point3D( tx, ty, p.Z ), map ) )
				{
					x = tx;
					y = ty;
					break;
				}
			}

			spawn.MoveToWorld( new Point3D( x, y, p.Z ), map );

			if ( spawn is AncientLich && 0.1 > Utility.RandomDouble() )
				spawn.PackItem( new MysticFishingNet() );
		}
Пример #11
0
        public void SpawnHelper(BaseCreature helper, Point3D location)
        {
            if (helper == null)
                return;

            helper.Home = location;
            helper.RangeHome = 4;
		
            if (this.m_Altar != null)
                this.m_Altar.AddHelper(helper);
				
            helper.MoveToWorld(location, this.Map);			
        }
Пример #12
0
		private void DoClaim( Mobile from, BaseCreature pet )
		{
			pet.SetControlMaster( from );

			if ( pet.Summoned )
				pet.SummonMaster = from;

			pet.ControlTarget = from;
			pet.ControlOrder = OrderType.Follow;

			pet.MoveToWorld( from.Location, from.Map );

			pet.IsStabled = false;
			pet.StabledBy = null;
		}
Пример #13
0
        public static void GetLastMounted(Mobile from)
        {
            bool hasMount = false;

            List <BaseCreature> list = new List <BaseCreature>();

            BaseCreature bc      = null;
            int          stabled = 0;

            for (int i = 0; i < from.Stabled.Count; ++i)
            {
                BaseCreature pet = from.Stabled[i] as BaseCreature;

                if (pet == null || pet.Deleted)
                {
                    pet.IsStabled = false;
                    from.Stabled.RemoveAt(i);
                    --i;
                    continue;
                }
                else if (pet.Language == "mount")
                {
                    bc = pet;
                }
            }

            for (int i = 0; i < from.Stabled.Count; ++i)
            {
                BaseCreature pet = from.Stabled[i] as BaseCreature;

                ++stabled;

                if (CanGetLastMounted(from, pet) && pet is BaseMount && pet == bc)
                {
                    pet.SetControlMaster(from);
                    pet.ControlTarget = from;
                    pet.MoveToWorld(from.Location, from.Map);
                    pet.IsStabled = false;
                    pet.Loyalty   = BaseCreature.MaxLoyalty;                   // Wonderfully Happy

                    from.Stabled.RemoveAt(i);
                    --i;

                    ((Mobile)pet).Language = null;
                    Server.Mobiles.BaseMount.Ride(((BaseMount)pet), from);
                    hasMount = true;
                }
                else if (pet == bc)
                {
                    ((Mobile)pet).Language = null;
                }
            }

            Server.Mobiles.AnimalTrainer.CleanClaimList(from);

            if (!hasMount)
            {
                ArrayList ethy = new ArrayList();
                foreach (Item item in World.Items.Values)
                {
                    if (item is EtherealMount)
                    {
                        if (((EtherealMount)item).Owner == from)
                        {
                            ((EtherealMount)item).Rider = from;
                            ((EtherealMount)item).Owner = from;
                        }
                    }
                }
            }
        }
Пример #14
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            from.Frozen = false;

            switch (info.ButtonID)
            {
            case -1:
            {
                // You decide against paying the Veterinarian, and the ghost of your pet looks at you sadly...
                from.SendLocalizedMessage(1113197);

                break;
            }

            case 1:
            {
                for (int i = 0; i < m_Pets.Length; i++)
                {
                    BaseCreature pet = m_Pets[i];

                    if (info.IsSwitched(i))
                    {
                        int fee = Veterinarian.GetResurrectionFee(pet);

                        if (!pet.IsDeadBondedPet)
                        {
                            from.SendLocalizedMessage(501041);                                             // Target is not dead.
                        }
                        else if (!from.CanSee(pet) || !from.InLOS(pet))
                        {
                            from.SendLocalizedMessage(503376);                                             // Target cannot be seen.
                        }
                        else if (!from.InRange(pet, 12))
                        {
                            from.SendLocalizedMessage(500643);                                             // Target is too far away.
                        }
                        else if (pet.ControlMaster != from)
                        {
                            from.SendLocalizedMessage(1113200);                                             // You must be the owner of that pet to have it resurrected.
                        }
                        else if (pet.Corpse != null && !pet.Corpse.Deleted)
                        {
                            from.SendLocalizedMessage(1113279);                                             // That creature's spirit lacks cohesion. Try again in a few minutes.
                        }
                        else if (Banker.Withdraw(from, fee))
                        {
                            pet.PlaySound(0x214);
                            pet.ResurrectPet();

                            for (int j = 0; j < pet.Skills.Length; ++j)                                             // Decrease all skills on pet.
                            {
                                pet.Skills[j].Base -= 0.2;
                            }

                            if (pet.Map == Map.Internal)
                            {
                                pet.MoveToWorld(from.Location, from.Map);
                            }

                            from.SendLocalizedMessage(1060398, fee.ToString());                                             // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString(), 0x16);                   // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                                             // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                        }
                        break;
                    }
                }

                break;
            }
            }
        }