Ejemplo n.º 1
0
		private void AddItem( Mobile from, int x, int y, int z, Item item, bool vis )
		{
			item.Visible = vis;
			item.MoveToWorld( new Point3D( from.Location.X + x, from.Location.Y + y, from.Location.Z + z ), from.Map );

			m_Components.Add( item );
		}
Ejemplo n.º 2
0
        public void Spawn()
        {
            Map map = Map;

            if (map == null || map == Map.Internal || m_Location == Point3D.Zero || m_Creature == null || m_Creature == "-invalid-")
            {
                return;
            }

            Type type = SpawnerType.GetType((string)m_Creature);

            if (type != null)
            {
                m_NextSpawn = DateTime.Now + m_Delay;

                try
                {
                    object o = Activator.CreateInstance(type);

                    if (o is Mobile)
                    {
                        Mobile m = (Mobile)o;

                        m_Creatures.Add(m);
                        InvalidateProperties();

                        m.Map      = map;
                        m.Location = m_Location;

                        if (m_Message != null)
                        {
                            m.PublicOverheadMessage(MessageType.Regular, 0x76C, false, m_Message);
                        }

                        if (m is BaseCreature)
                        {
                            BaseCreature c = (BaseCreature)m;

                            c.RangeHome = m_HomeRange;

                            if (m_Team > 0)
                            {
                                c.Team = m_Team;
                            }

                            c.Home = m_Location;
                        }
                    }
                    else if (o is Item)
                    {
                        Item item = (Item)o;

                        m_Creatures.Add(item);
                        InvalidateProperties();

                        item.MoveToWorld(m_Location, map);

                        if (m_Message != null)
                        {
                            item.PublicOverheadMessage(MessageType.Regular, 0x76C, false, m_Message);
                        }
                    }
                }
                catch
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3BD, false, string.Format("Exception Caught"));                        // debugging
                }
            }
        }