Exemplo n.º 1
0
		private static Mobile GetOwner()
		{
			Mobile m_Corpse = new Mobile();

			MobileSex = Utility.RandomBool(); // true for female, false for male (no reason)
			m_Corpse.Hue = Utility.RandomSkinHue();

			Utility.AssignRandomHair( m_Corpse, true );

			if( MobileSex )
			{
				m_Corpse.Female = true;
				m_Corpse.Body = 0x191;
				m_Corpse.Name = NameList.RandomName( "female" ); // don't need a name, but it can't hurt
			}
			else
			{
				m_Corpse.Female = false;
				m_Corpse.Body = 0x190;
				m_Corpse.Name = NameList.RandomName( "male" ); // don't need a name, but it can't hurt

				Utility.AssignRandomFacialHair( m_Corpse, m_Corpse.HairHue );
			}

			m_Corpse.Delete();

			return m_Corpse;
		}
Exemplo n.º 2
0
		private void DeleteImp( Mobile m )
		{
			if ( m != null && !m.Deleted )
			{
				Effects.SendLocationEffect( m.Location, m.Map, 0x3728, 10, 10 );
				Effects.PlaySound( m.Location, m.Map, 0x1FE );

				m.Delete();
			}
		}
Exemplo n.º 3
0
		private static Mobile GetOwner()
		{
			Mobile apprentice = new Mobile();

			apprentice.Hue = Utility.RandomSkinHue();
			apprentice.Female = false;
			apprentice.Body = 0x190;

			apprentice.Delete();

			return apprentice;
		}
Exemplo n.º 4
0
        private static void LoadMobiles(BinaryFileReader reader,
                                        MobileEntry[] entries)
        {
            for (int i = 0; i < entries.Length; ++i)
            {
                MobileEntry entry = entries[i];
                Mobile      m     = (Mobile)entry.Object;
                if (m == null)
                {
                    continue;
                }

                reader.Seek(entry.Position, SeekOrigin.Begin);

                try {
                    m_LoadingType = entry.TypeName;
                    m.Deserialize(reader);
                } catch (Exception e) {
                    log.Error(String.Format("failed to load mobile {0}", m),
                              e);
                    m.Delete();
                    entries[i].Clear();
                    ++m_LoadErrors;
                    continue;
                }

                if (reader.Position != entry.Position + entry.Length)
                {
                    log.ErrorFormat("Bad deserialize on mobile {0}, type {1}: position={2}, should be {3}",
                                    entry.Serial, entry.TypeName,
                                    reader.Position, entry.Position + entry.Length);
                    m.Delete();
                    entries[i].Clear();
                    ++m_LoadErrors;
                }
            }
        }
Exemplo n.º 5
0
        private static void ProcessSafetyQueues()
        {
            while (_addQueue.Count > 0)
            {
                IEntity entity = _addQueue.Dequeue();

                Item item = entity as Item;

                if (item != null)
                {
                    AddItem(item);
                }
                else
                {
                    Mobile mob = entity as Mobile;

                    if (mob != null)
                    {
                        AddMobile(mob);
                    }
                }
            }

            while (_deleteQueue.Count > 0)
            {
                IEntity entity = _deleteQueue.Dequeue();

                Item item = entity as Item;

                if (item != null)
                {
                    item.Delete();
                }
                else
                {
                    Mobile mob = entity as Mobile;

                    if (mob != null)
                    {
                        mob.Delete();
                    }
                }
            }
        }
Exemplo n.º 6
0
        public void DispelTarget( Mobile m )
        {
            //Type t = m.GetType();

            bool dispellable = false;

            if ( m is BaseCreature )
            {
                dispellable = ( (BaseCreature) m ).Summoned;
            }

            if ( m_Mobile.CanSee( m ) && dispellable )
            {
                Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );

                Effects.PlaySound( m, m.Map, 0x201 );

                m.Delete();
            }
        }
Exemplo n.º 7
0
        public virtual void Dispel( Mobile m )
        {
            Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
            Effects.PlaySound( m, m.Map, 0x201 );

            m.Delete();
        }
        public void SpawnMob(Mobile m)
        {
            Point3D loc = GetRandomRegionPoint();

            if (loc.X != 0 && loc.Y != 0)
            {
                m.Location = loc;
                m.Map = regionmap;
                Spawn.Add(m);
            }
            else
            {
                m.Delete();
                return;
            }
        }
Exemplo n.º 9
0
		private void DeleteImp( Mobile m )
		{
			if ( m != null && !m.Deleted )
			{
				Effects.SendLocationEffect( m.Location, m.Map, 0x3728, 10, 10 );
				Effects.PlaySound( m.Location, m.Map, 0x1FE );

				m.Delete();
			}

			System.From.SendLocalizedMessage( 1055062 ); // You have received the Magic Brew Recipe.

			System.AddConversation( new ZeefzorpulConversation() );
		}
Exemplo n.º 10
0
        public bool TurnIn(PlayerMobile player, Mobile vendor)
        {
            bool completed = false;

            if (player == null)
            {
                return(false);
            }
            if (player.Backpack == null)
            {
                return(false);
            }

            SocietyJobPlayerProgress jobProgress = Societies.GetSocietiesJobPlayerProgress(player, this);

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

            if (m_TurnInRequirementAmount >= 1)
            {
                bool turnInItem     = false;
                bool turnInCreature = false;

                double remainingNeeded = m_TurnInRequirementAmount - jobProgress.m_TurnedInAmount;
                int    amountTurnedIn  = 0;

                Queue m_Queue = new Queue();

                if (m_JobType == JobType.CraftItem || m_JobType == JobType.RetrieveFish || m_JobType == JobType.StealItem)
                {
                    turnInItem = true;

                    Item[] m_MatchingItems = player.Backpack.FindItemsByType(m_PrimaryType);

                    foreach (Item item in m_MatchingItems)
                    {
                        if (item == null)
                        {
                            continue;
                        }
                        if (m_CraftResourceRequired != CraftResource.None && item.Resource != m_CraftResourceRequired)
                        {
                            continue;
                        }
                        if (m_PrimaryJobModifier == JobModifierType.ExceptionalQuality && item.Quality != Quality.Exceptional)
                        {
                            continue;
                        }
                        if (m_SecondaryJobModifier == JobModifierType.ExceptionalQuality && item.Quality != Quality.Exceptional)
                        {
                            continue;
                        }

                        jobProgress.m_TurnedInAmount++;
                        amountTurnedIn++;
                        remainingNeeded--;

                        m_Queue.Enqueue(item);

                        if (remainingNeeded <= 0)
                        {
                            break;
                        }
                    }

                    while (m_Queue.Count > 0)
                    {
                        Item mobile = (Item)m_Queue.Dequeue();
                        mobile.Delete();
                    }
                }

                else if (m_JobType == JobType.TameCreature)
                {
                    turnInCreature = true;

                    for (int a = 0; a < player.AllFollowers.Count; a++)
                    {
                        Mobile follower = player.AllFollowers[a];

                        if (follower.GetType() != m_PrimaryType)
                        {
                            continue;
                        }
                        if (follower == null)
                        {
                            continue;
                        }
                        if (!follower.Alive || follower.IsDeadBondedFollower)
                        {
                            continue;
                        }
                        if (Utility.GetDistance(follower.Location, vendor.Location) >= 12)
                        {
                            continue;
                        }

                        jobProgress.m_TurnedInAmount++;
                        amountTurnedIn++;
                        remainingNeeded--;

                        m_Queue.Enqueue(follower);

                        if (remainingNeeded <= 0)
                        {
                            break;
                        }
                    }

                    while (m_Queue.Count > 0)
                    {
                        Mobile mobile = (Mobile)m_Queue.Dequeue();
                        mobile.Delete();
                    }
                }

                if (amountTurnedIn == 0)
                {
                    if (turnInCreature)
                    {
                        player.SendMessage("You do not have any of the required creatures nearby needed to complete that job.");
                    }

                    else if (turnInItem)
                    {
                        player.SendMessage("You do not have any of the required items neccessary to complete that job in your backpack.");
                    }

                    return(false);
                }

                else if (amountTurnedIn > 0 && remainingNeeded > 0)
                {
                    if (turnInCreature)
                    {
                        player.SendMessage("You turn in some of the creatures neccessary for this job but still require more to complete it fully.");
                    }

                    else if (turnInItem)
                    {
                        player.SendMessage("You turn in some of the items neccessary for this job but still require more to complete it fully.");
                    }

                    return(false);
                }

                else
                {
                    return(true);
                }
            }

            else if (jobProgress.m_ProgressAmount >= m_TargetNumber)
            {
                return(true);
            }

            return(completed);
        }
Exemplo n.º 11
0
        public virtual void Dispel( Mobile m )
        {
            if ( m_LastAutoDispel+TimeSpan.FromSeconds( 10.0 ) > DateTime.Now || Mana < 20 )
                return;

            Mana -= 20;
            if ( Mana < 0 )
                Mana = 0;
            m_LastAutoDispel = DateTime.Now;

            int diff = 0;
            if ( m is Daemon )
                diff = 95;
            else if ( m is EnergyVortex )
                diff = 80;
            else if ( m is FireElemental || m is WaterElemental || m is AirElemental || m is EarthElemental )
                diff = 75;
            else if ( m is BladeSpirit )
                diff = 50;

            Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
            if ( this.Skills[SkillName.Magery].Value >= Utility.Random( 41 )+diff )
            {
                Effects.PlaySound( m, m.Map, 0x201 );
                m.Delete();
            }
        }
Exemplo n.º 12
0
		private static Skill ShopkeeperSkill(Mobile m)
		{
			try
			{
				Mobile tmp = new Mobile();
				Skill sx = new Skill(tmp.Skills, new SkillInfo(-1, "Shopkeeper", 0, 0, 0, "Shopkeeper", null, 0, 0, 0, 0), 100, 1200, SkillLock.Locked);
				sx.BaseFixedPoint = ComputeShopkeeperSkill(m);
				tmp.Delete();
				return sx;
			}
			catch (Exception ex)
			{
				LogHelper.LogException(ex);
			}

			return null;
		}