public void SpawnWave()
        {
            List <Rectangle2D> zones = new List <Rectangle2D>(SpawnZones);

            for (int j = 0; j < 2; j++)
            {
                Rectangle2D spawnrec = zones[Utility.Random(zones.Count)];
                zones.Remove(spawnrec);

                int count = Utility.RandomMinMax(WaveCountMin, WaveCountMax);
                List <BaseCreature> list = new List <BaseCreature>();

                for (int i = 0; i < count; i++)
                {
                    BaseCreature bc = Activator.CreateInstance(_SpawnTable[(int)this.InvasionType][Utility.Random(_SpawnTable[(int)this.InvasionType].Length)]) as BaseCreature;

                    Server.Engines.XmlSpawner2.XmlAttach.AttachTo(bc, new Server.Engines.XmlSpawner2.XmlData("Notoriety", "red"));

                    if (SpawnMobile(bc, spawnrec))
                    {
                        list.Add(bc);
                    }
                    else
                    {
                        bc.Delete();
                    }
                }

                for (int i = 0; i < 3; i++)
                {
                    Invader invader = new Invader(this.InvasionType);

                    if (SpawnMobile(invader, spawnrec))
                    {
                        list.Add(invader);
                    }
                    else
                    {
                        invader.Delete();
                    }
                }

                InvaderCaptain capt = new InvaderCaptain(this.InvasionType);
                capt.Blessed = true;

                if (SpawnMobile(capt, spawnrec) || SpawnMobile(capt, new Rectangle2D(Defs[CurrentInvasion].BeaconLoc.X - 10, Defs[CurrentInvasion].BeaconLoc.Y - 10, 20, 20)))
                {
                    Spawn[capt] = list;
                }
            }
        }
Exemple #2
0
        public static BaseCreature Spawn(int level, Point3D p, Map map, Mobile target, bool guardian)
        {
            if (map == null)
            {
                return(null);
            }

            BaseCreature c = Spawn(level, p, guardian);

            if (c != null)
            {
                bool spawned = false;

                for (int i = 0; !spawned && i < 10; ++i)
                {
                    int x = p.X - 3 + Utility.Random(7);
                    int y = p.Y - 3 + Utility.Random(7);

                    if (map.CanSpawnMobile(x, y, p.Z))
                    {
                        c.MoveToWorld(new Point3D(x, y, p.Z), map);
                        spawned = true;
                    }
                    else
                    {
                        int z = map.GetAverageZ(x, y);

                        if (map.CanSpawnMobile(x, y, z))
                        {
                            c.MoveToWorld(new Point3D(x, y, z), map);
                            spawned = true;
                        }
                    }
                }

                if (!spawned)
                {
                    c.Delete();
                    return(null);
                }

                if (target != null)
                {
                    c.Combatant = target;
                }

                return(c);
            }

            return(null);
        }
Exemple #3
0
            protected override void OnTarget(Mobile from, object targ)
            {
                if (targ is BaseCreature)
                {
                    bool summoned = false;
                    m_Creature = (BaseCreature)targ;

                    Type[] m_Summoned = new Type[]
                    {
                        typeof(Skeleton),
                        typeof(SkeletalKnight),
                        typeof(Mummy),
                        typeof(Zombie),
                        typeof(SkeletalDragon),
                        typeof(Wraith),
                        typeof(ChaosDaemon),
                        typeof(BoneDemon)
                    };

                    if (m_Creature.Controled && m_Creature.ControlMaster == m_Player)
                    {
                        for (int i = 0; i < m_Summoned.Length; i++)
                        {
                            if (m_Summoned[i] == m_Creature.GetType())
                            {
                                summoned = true;
                                break;
                            }
                        }

                        if (summoned)
                        {
                            m_Player.SendMessage("You send the creature back to the netherworld!");
                            m_Player.Emote("*You see {0} send the {1} back to the netherworld*", m_Player.Name, m_Creature.Name);
                            m_Creature.Delete();
                        }
                        else
                        {
                            m_Player.SendMessage("That is not a creature from the netherworld.");
                        }
                    }
                    else
                    {
                        m_Player.SendMessage("You don't have power over that creature.");
                    }
                }
                else
                {
                    m_Player.SendMessage("You can only dismiss summoned creatures.");
                }
            }
        private void DeleteAnnoyingLlama(object annoyingllama)
        {
            BaseCreature mob = (BaseCreature)annoyingllama;
            Map          map = mob.Map;
            Mobile       c   = annoyingllama as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
Exemple #5
0
        private void DeleteQiraji(object qiraji)
        {
            BaseCreature mob = (BaseCreature)qiraji;
            Map          map = mob.Map;
            Mobile       c   = qiraji as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
Exemple #6
0
        private void DeleteZombie(object zombie)
        {
            BaseCreature mob = (BaseCreature)zombie;
            Map          map = mob.Map;
            Mobile       c   = zombie as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
Exemple #7
0
        private void DeleteWraith(object wraith)
        {
            BaseCreature mob = (BaseCreature)wraith;
            Map          map = mob.Map;
            Mobile       c   = wraith as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
        private void DeleteEncounterA(object encountera)
        {
            BaseCreature mob = (BaseCreature)encountera;
            Map          map = mob.Map;
            Mobile       c   = encountera as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 1344);

                mob.Delete();
            }
        }
Exemple #9
0
        private void DeleteGhoul(object ghoul)
        {
            BaseCreature mob = (BaseCreature)ghoul;
            Map          map = mob.Map;
            Mobile       c   = ghoul as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
        public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
        {
            for (int i = 0; i < this.m_Donations.Count; i++)
            {
                if (this.m_Donations[i].Type == pet.GetType())
                {
                    pet.Delete();
                    this.Donate(player, this.m_Donations[i], 1);
                    return;
                }
            }

            player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
        }
Exemple #11
0
        public void CleanupHelpers()
        {
            for (int i = 0; i < m_Helpers.Count; i++)
            {
                BaseCreature c = m_Helpers[i];

                if (c != null && c.Alive)
                {
                    c.Delete();
                }
            }

            m_Helpers.Clear();
        }
        private void DeleteCavernMongbatPlantkeeper(object cavernmongbatplantkeeper)
        {
            BaseCreature mob = (BaseCreature)cavernmongbatplantkeeper;
            Map          map = mob.Map;
            Mobile       c   = cavernmongbatplantkeeper as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
        private void DeleteWastelandMercenary(object wastelandmercenary)
        {
            BaseCreature mob = (BaseCreature)wastelandmercenary;
            Map          map = mob.Map;
            Mobile       c   = wastelandmercenary as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
Exemple #14
0
        private void DeleteSkeleton(object skeleton)
        {
            BaseCreature mob = (BaseCreature)skeleton;
            Map          map = mob.Map;
            Mobile       c   = skeleton as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
        private void DeleteFriendlyEncounter(object friendlyencounter)
        {
            BaseCreature mob = (BaseCreature)friendlyencounter;
            Map          map = mob.Map;
            Mobile       c   = friendlyencounter as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
        private void DeleteRandomEncounter(object randomencounter)
        {
            BaseCreature mob = (BaseCreature)randomencounter;
            Map          map = mob.Map;
            Mobile       c   = randomencounter as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 652);

                mob.Delete();
            }
        }
        private void DeleteIceFiend(object icefiend)
        {
            BaseCreature mob = (BaseCreature)icefiend;
            Map          map = mob.Map;
            Mobile       c   = icefiend as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
Exemple #18
0
        public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
        {
            for (int i = 0; i < m_Donations.Count; i++)
            {
                if (m_Donations[i].Type == pet.GetType() || MoonglowDonationBox.HasGroup(pet.GetType(), m_Donations[i].Type))
                {
                    pet.Delete();
                    Donate(player, m_Donations[i], 1);
                    return;
                }
            }

            player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
        }
        private void DeleteBeelzebug(object beelzebug)
        {
            BaseCreature mob = (BaseCreature)beelzebug;
            Map          map = mob.Map;
            Mobile       c   = beelzebug as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
        private void DeleteBrigandFemale3(object brigandfemale3)
        {
            BaseCreature mob = (BaseCreature)brigandfemale3;
            Map          map = mob.Map;
            Mobile       c   = brigandfemale3 as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
        private void DeleteCavernMongbatBerserkerQuest3(object cavernmongbatberserker3)
        {
            BaseCreature mob = (BaseCreature)cavernmongbatberserker3;
            Map          map = mob.Map;
            Mobile       c   = cavernmongbatberserker3 as Mobile;

            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
Exemple #22
0
        public void CleanupHelpers()
        {
            for (int i = this.m_Helpers.Count - 1; i >= 0; i--)
            {
                BaseCreature c = this.m_Helpers[i];

                if (c.Alive)
                {
                    c.Delete();
                }
            }

            this.m_Helpers.Clear();
        }
Exemple #23
0
            public void DoSpawn()
            {
                if (Spawner == null || Spawner.Controller == null || Spawner.Controller.Map == null || !Spawner.Active)
                {
                    return;
                }

                Map map = Spawner.Controller.Map;

                Type[] types = VoidPoolController.SpawnTable[(int)SpawnType];

                for (int i = 0; i < MaxCount; i++)
                {
                    BaseCreature bc = Activator.CreateInstance(types[Utility.Random(types.Length)], Utility.RandomMinMax(5, 15), false) as BaseCreature;

                    if (bc != null)
                    {
                        Rectangle2D rec = Bounds[Utility.Random(Bounds.Length)];
                        Point3D     p   = Point3D.Zero;

                        for (int j = 0; j < 50; j++)
                        {
                            p = map.GetRandomSpawnPoint(rec);

                            if (map.CanSpawnMobile(p))
                            {
                                break;
                            }
                        }

                        if (p != Point3D.Zero)
                        {
                            bc.Spawner = Spawner;

                            bc.Home      = p;
                            bc.RangeHome = 20;

                            bc.OnBeforeSpawn(p, map);
                            bc.MoveToWorld(p, map);
                            bc.OnAfterSpawn();

                            Spawn.Add(bc);
                        }
                        else
                        {
                            bc.Delete();
                        }
                    }
                }
            }
Exemple #24
0
        public override void OnRemoved(object parent)
        {
            base.OnRemoved(parent);

            if (parent is Mobile)
            {
                Mobile m = (Mobile)parent;
                m.RemoveStatMod(Serial.ToString() + "Forest-Dex");
                if (m_Summon != null && !m_Summon.Deleted)
                {
                    m_Summon.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                    m.SendMessage("The summoned creature fades as you release the bow from your hands.");
                    m_Summon.Delete();
                }
            }
        }
Exemple #25
0
            public override void Deserialize(GenericReader reader)
            {
                base.Deserialize(reader);
                int version = reader.ReadInt();

                Canceled         = reader.ReadInt();
                DistanceTraveled = reader.ReadInt();
                Completed        = reader.ReadInt();

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    BaseCreature bc = reader.ReadMobile() as BaseCreature;
                    DateTime     dt = reader.ReadDateTime();

                    if (bc != null)
                    {
                        if (dt < DateTime.UtcNow)
                        {
                            bc.Delete();
                        }
                        else
                        {
                            if (Ambushers == null)
                            {
                                Ambushers = new Dictionary <BaseCreature, DateTime>();
                            }

                            bc.IsAmbusher = true;

                            Ambushers[bc] = dt;
                        }
                    }
                }

                if (version == 0)
                {
                    Timer.DelayCall(() =>
                    {
                        if (Player.RemoveRewardTitle(2303807, true))
                        {
                            Player.AddRewardTitle(1151739);
                        }
                    });
                }
            }
        public void CleanupHelpers()
        {
            if (m_Helpers != null)
            {
                for (int i = m_Helpers.Count - 1; i >= 0; i--)
                {
                    BaseCreature c = m_Helpers[i];

                    if (c.Alive)
                    {
                        c.Delete();
                    }
                }

                m_Helpers.Clear();
            }
        }
Exemple #27
0
        private void SpawnHelper(bool initial)
        {
            if (Map == null || Beacon == null)
            {
                return;
            }

            Point3D p     = Location;
            Map     map   = Map;
            int     range = 15;

            if (Beacon.LastDamager != null && Beacon.LastDamager.InRange(Location, 20))
            {
                p     = Beacon.LastDamager.Location;
                range = 8;
            }

            BaseCreature creature = Activator.CreateInstance(_SpawnTypes[Utility.Random(_SpawnTypes.Length)]) as BaseCreature;

            for (int i = 0; i < 50; i++)
            {
                Point3D spawnLoc = new Point3D(Utility.RandomMinMax(p.X - range, p.X + range), Utility.RandomMinMax(p.Y - range, p.Y + range), -5);

                if (map.CanFit(spawnLoc.X, spawnLoc.Y, spawnLoc.Z, 16, true, true, false, creature))
                {
                    if (creature != null)
                    {
                        creature.MoveToWorld(spawnLoc, map);
                        creature.Home      = spawnLoc;
                        creature.RangeHome = 10;

                        if (BaseCreature.IsSoulboundEnemies)
                        {
                            creature.IsSoulBound = true;
                        }

                        Spawn.Add(creature, initial);

                        NextSpawn = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60));
                        return;
                    }
                }
            }

            creature.Delete();
        }
        private void DeleteTameable(object tamable)
        {
            BaseCreature mob = (BaseCreature)tamable;
            Map          map = mob.Map;
            Mobile       c   = tamable as Mobile;

            if (mob.Controlled)
            {
            }
            if (mob != null || !mob.Deleted)
            {
                Effects.SendLocationEffect(mob.Location, mob.Map, 0x3728, 10, 10);
                Effects.PlaySound(mob.Location, mob.Map, 0x1FC);

                mob.Delete();
            }
        }
 public void Disband(bool toDelete)
 {
     for (int i = Soldiers.Count - 1; i >= 0; i--)
     {
         BaseCreature soldier = (BaseCreature)Soldiers[i];
         soldier.ChangeAIToDefault();
         soldier.Controlled    = false;
         soldier.ControlMaster = null;
         soldier.Team          = 0;
         Soldiers.RemoveAt(i);
         soldier.Delete();
     }
     if (toDelete)
     {
         Delete();
     }
 }
        public void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, Point3D spawnAt)
        {
            Map map = caster.Map;

            if (map == null)
            {
                return;
            }

            if (map.CanFit(spawnAt.X, spawnAt.Y, spawnAt.Z, 1, true, false, true))
            {
                BaseCreature.Summon(creature, caster, spawnAt, sound, duration);
                return;
            }

            creature.Delete();
            caster.SendLocalizedMessage(501942); // That location is blocked.
        }
Exemple #31
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 ) );
		}
Exemple #32
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 );

            if (creature is BladeSpirits)
            {
                new BSTimer(creature).Start();
                Effects.SendLocationParticles(EffectItem.Create(creature.Location, creature.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
            }

            m_Summoning = false;

            return true;
        }
Exemple #33
0
		public static void Summon( BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats )
		{
			Map map = caster.Map;

			if( map == null )
				return;

			double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0);

			if( scaleDuration )
				duration = TimeSpan.FromSeconds( duration.TotalSeconds * scale );

			if( scaleStats )
			{
				creature.RawStr = (int)(creature.RawStr * scale);
				creature.Hits = creature.HitsMax;

				creature.RawDex = (int)(creature.RawDex * scale);
				creature.Stam = creature.StamMax;

				creature.RawInt = (int)(creature.RawInt * scale);
				creature.Mana = creature.ManaMax;
			}

			Point3D p = new Point3D( caster );

			if( SpellHelper.FindValidSpawnLocation( map, ref p, true ) )
			{
				BaseCreature.Summon( creature, caster, p, sound, duration );
				return;
			}


			/*
			int offset = Utility.Random( 8 ) * 2;

			for( int i = 0; i < m_Offsets.Length; i += 2 )
			{
				int x = caster.X + m_Offsets[(offset + i) % m_Offsets.Length];
				int y = caster.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

				if( map.CanSpawnMobile( x, y, caster.Z ) )
				{
					BaseCreature.Summon( creature, caster, new Point3D( x, y, caster.Z ), sound, duration );
					return;
				}
				else
				{
					int z = map.GetAverageZ( x, y );

					if( map.CanSpawnMobile( x, y, z ) )
					{
						BaseCreature.Summon( creature, caster, new Point3D( x, y, z ), sound, duration );
						return;
					}
				}
			}
			 * */

			creature.Delete();
			caster.SendLocalizedMessage( 501942 ); // That location is blocked.
		}
Exemple #34
0
        //25JUL2008 Lord_Greywolf fix for bad X *** START ***
        //        protected void Spawn( Point2D p, Map map, BaseCreature spawn )
        //        {
        //            if ( map == null )
        //            {
        //                spawn.Delete();
        //                return;
        //            }

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

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

        //            spawn.MoveToWorld( new Point3D( x, y, 0 ), map );
        //            spawn.PackItem( new TreasureMessageChest() );
        //}
        protected void Spawn(Point2D p, Map map, BaseCreature spawn)
        {
            if (map == null) { spawn.Delete(); return; }

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

            if (map.CanSpawnMobile(x, y, 0))
            {
                spawn.MoveToWorld(new Point3D(x, y, 0), map);
            }
            else
            {
                int z = map.GetAverageZ(x, y);
                if (map.CanSpawnMobile(x, y, z))
                {
                    spawn.MoveToWorld(new Point3D(x, y, z), map);
                }
                else if (map.CanSpawnMobile(x, y, z + 10))
                {
                    spawn.MoveToWorld(new Point3D(x, y, z + 10), map);
                }
                else if (map.CanSpawnMobile(x + 1, y + 1, z))
                {
                    spawn.MoveToWorld(new Point3D(x + 1, y + 1, z), map);
                }
                else if (map.CanSpawnMobile(x + 1, y + 1, z + 10))
                {
                    spawn.MoveToWorld(new Point3D(x + 1, y + 1, z + 10), map);
                }
                else
                {
                    spawn.MoveToWorld(new Point3D(x - 1, y - 1, 100), map);
                }
            }
            spawn.PackItem(new TreasureMessageChest(Utility.RandomMinMax((((m_Level - 1) * 400) + 100), (((m_Level - 1) * 400) + 500))));
        }
        public void SpawnMobile(BaseCreature bc)
        {
            if(this.Map == null || bc == null)
            {
                if(bc != null)
                    bc.Delete();
                return;
            }

            int x = this.X;
            int y = this.Y;
            int z = this.Z;
            Point3D p = new Point3D(x, y, z);

            for(int i = 0; i < 25; i++)
            {
                x = Utility.RandomMinMax(this.X - 15, this.X + 15);
                y = Utility.RandomMinMax(this.Y - 15, this.Y + 15);
                z = this.Map.GetAverageZ(x, y);

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

            bc.MoveToWorld(p, this.Map);
        }
        public static bool Summon( BaseCreature creature, bool controled, Mobile caster, Point3D p, int sound, TimeSpan duration )
        {
            if ( caster.Followers + creature.ControlSlots > caster.FollowersMax )
            {
                caster.SendAsciiMessage( "You have too many followers to summon that creature." );
                creature.Delete();
                return false;
            }

            m_Summoning = true;

            if ( controled )
                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;

                    ((Item)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;
        }
		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 );

				Tile 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 );
		}
		public virtual void DonatePet( PlayerMobile player, BaseCreature pet )
		{
			for ( int i = 0; i < m_Donations.Count; i ++ )
				if ( m_Donations[ i ].Type == pet.GetType() )
				{
					pet.Delete();
					Donate( player, m_Donations[ i ], 1 );
					return;
				}
				
			player.SendLocalizedMessage( 1073113 ); // This Collection is not accepting that type of creature.
		}
Exemple #39
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();
				}
			}

			#region Mondain's Legacy
			creature.SetHits((int)Math.Floor(creature.HitsMax * (1 + ArcaneEmpowermentSpell.GetSpellBonus(caster, false) / 100.0)));
			#endregion

			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;
		}
	//RUFO beginfunction
	private void SellPetForGold(Mobile from, BaseCreature pet, int goldamount)
	{
               		Item gold = new Gold(goldamount);
               		pet.ControlTarget = null; 
               		pet.ControlOrder = OrderType.None; 
               		pet.Internalize(); 
               		pet.SetControlMaster( null ); 
               		pet.SummonMaster = null;
               		pet.Delete();
               		
               		Container backpack = from.Backpack;
               		if ( backpack == null || !backpack.TryDropItem( from, gold, false ) ) 
            		{ 
            			gold.MoveToWorld( from.Location, from.Map );           			
            		}

	}
Exemple #41
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;

            #region Kaltar, OnSummon

            if (caster is Jogador)
            {
                SummonUtil.Instance.OnSummon((Jogador)caster, creature, ref p, ref duration);
            }

            #endregion

            #region DeletarItensDaMochila

            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();
                }
            }

            #endregion

            #region Duracao do summon

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

            #endregion

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

            m_Summoning = false;

            return true;
        }
Exemple #42
0
		public void Eject(BaseCreature bc, bool teleportOrStable)
		{
			if (bc == null || bc.Deleted)
			{
				return;
			}

			if (!teleportOrStable)
			{
				bc.Delete();
				return;
			}

			if (bc.ControlMaster is PlayerMobile)
			{
				bc.Stable();
			}
			else
			{
				Teleport(bc, Options.Locations.Eject, Options.Locations.Eject.Map);
			}
		}
Exemple #43
0
        public static void Summon( BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats )
        {
            Map map = caster.Map;

            if ( map == null )
                return;

            double scale = 1.0 + ( ( caster.Skills[SkillName.Magery].Value - 100.0 ) / 200.0 );

            if ( scaleDuration )
                duration = TimeSpan.FromSeconds( duration.TotalSeconds * scale );

            if ( scaleStats )
            {
                creature.RawStr = (int) ( creature.RawStr * scale );
                creature.Hits = creature.HitsMax;

                creature.RawDex = (int) ( creature.RawDex * scale );
                creature.Stam = creature.StamMax;

                creature.RawInt = (int) ( creature.RawInt * scale );
                creature.Mana = creature.ManaMax;
            }

            Point3D p = new Point3D( caster );

            if ( SpellHelper.FindValidSpawnLocation( map, ref p, true ) )
            {
                BaseCreature.Summon( creature, caster, p, sound, duration );
                return;
            }

            creature.Delete();
            caster.SendLocalizedMessage( 501942 ); // That location is blocked.
        }