public SleeperBedBodyContent( Mobile beholder, SleeperBedBody beheld ) : base( 0x3C )
		{
			ArrayList items = beheld.EquipItems;
			int count = items.Count;

			EnsureCapacity( 5 + (count * 19) );

			long pos = m_Stream.Position;

			int written = 0;

			m_Stream.Write( (ushort) 0 );

			for ( int i = 0; i < count; ++i )
			{
				Item child = (Item)items[i];

				if ( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) )
				{
					m_Stream.Write( (int) child.Serial );
					m_Stream.Write( (ushort) child.ItemID );
					m_Stream.Write( (byte) 0 ); // signed, itemID offset
					m_Stream.Write( (ushort) child.Amount );
					m_Stream.Write( (short) child.X );
					m_Stream.Write( (short) child.Y );
					m_Stream.Write( (int) beheld.Serial );
					m_Stream.Write( (ushort) child.Hue );

					++written;
				}
			}

			m_Stream.Seek( pos, SeekOrigin.Begin );
			m_Stream.Write( (ushort) written );
		}
示例#2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_SleeperBedBody = (SleeperBedBody)reader.ReadItem();
            m_Player         = reader.ReadMobile();
            m_Active         = reader.ReadBool();
            m_Location       = reader.ReadPoint3D();
            m_Sleeping       = reader.ReadBool();
            m_Owner          = reader.ReadMobile();

            m_Debug = false;
        }
		public SleeperBedBodyEquip( Mobile beholder, SleeperBedBody beheld ) : base( 0x89 )
		{
			ArrayList list = beheld.EquipItems;

			EnsureCapacity( 8 + (list.Count * 5) );

			m_Stream.Write( (int) beheld.Serial );

			for ( int i = 0; i < list.Count; ++i )
			{
				Item item = (Item)list[i];

				if ( !item.Deleted && beholder.CanSee( item ) && item.Parent == beheld )
				{
					m_Stream.Write( (byte) (item.Layer + 1) );
					m_Stream.Write( (int) item.Serial );
				}
			}

			m_Stream.Write( (byte) Layer.Invalid );
		}
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
			m_SleeperBedBody = (SleeperBedBody)reader.ReadItem();
			m_Player = reader.ReadMobile();
			m_Active = reader.ReadBool();
			m_Location = reader.ReadPoint3D();
			m_Sleeping = reader.ReadBool();
			m_Owner = reader.ReadMobile();

			m_Debug = false;
		}
		public void DoubleClick( Mobile from ) 
		{ 
			Mobile m_Player = from as PlayerMobile;
			if(m_Player.CantWalk && !m_Sleeping)
			{
				m_Player.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You are already sleeping somewhere!" );
			}
			else
			{
				if( !m_Sleeping ) 
				{	
					BaseHouse m_house = BaseHouse.FindHouseAt( from );
					BaseHouse this_house = BaseHouse.FindHouseAt ( this );
					if (m_house!= null && (m_house != this_house))
					{
						from.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You cannot sleep in someone elses bed! Get a bed of your own." );
						return;
					}
					if ( m_house!= null && (m_house.IsOwner(from) || m_house.IsCoOwner(from) || m_house.IsFriend( from )))
					{
						wtry=0;
						m_Owner = m_Player;
						m_Player.Hidden = true;
						m_Player.CantWalk = true;
						m_Sleeping = true;
						m_SleeperBedBody = new SleeperBedBody( m_Player, false, false );
						Point3D m_Location = new Point3D(this.Location.X, this.Location.Y+2, this.Location.Z+14);
						m_SleeperBedBody.Direction=Direction.South;
						m_SleeperBedBody.MoveToWorld( m_Location, this.Map );
					}
					else
					{
						from.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You must be in the house and be the owner, co-owner or friend of the house this bed is in to sleep in it." );
						return;
					}

				}
				else 
				{
					if(m_Owner==m_Player)
					{
						m_Sleeping = false;
						m_Player.Hidden = false;
						m_Player.CantWalk = false;
						if( m_SleeperBedBody != null )
							m_SleeperBedBody.Delete();
						m_SleeperBedBody = null;
						switch( Utility.RandomMinMax( 1, 3 ) )
						{
						case 1:
							m_Player.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You wake up and feel rested and strong." );
							break;
						case 2:
							m_Player.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You spring out of bed, ready for another day!" );
							break;
						case 3:
							m_Player.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You fall out of bed and blearily reach for the coffee pot." );
							break;
						}
					}
					else
					{
						switch (wtry)
						{
						case 0:
							m_Player.LocalOverheadMessage( MessageType.Regular, 0x33, true, "Shhh, don't wake them up. They really need their beauty rest!" );
							wtry=wtry+1;
							break;
						case 1: 
							m_Player.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You really should NOT bother someone that is sleeping. Bad things might happen." );
							wtry=wtry+1;
							break;
						case 2:
							m_Player.LocalOverheadMessage( MessageType.Regular, 0x33, true, "You were warned!! Now leave them alone." );
							m_Player.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.Head );
							m_Player.PlaySound( 0x208 );
							m_Player.Hits=m_Player.Hits-40;
							break;
						}
					}
				}
			}
		}
示例#6
0
        public void DoubleClick(Mobile from)
        {
            Mobile m_Player = from as PlayerMobile;

            if (m_Player.CantWalk && !m_Sleeping)
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are already sleeping somewhere!");
            }
            else
            {
                if (!m_Sleeping)
                {
                    BaseHouse m_house    = BaseHouse.FindHouseAt(from);
                    BaseHouse this_house = BaseHouse.FindHouseAt(this);
                    if (m_house != null && (m_house != this_house))
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You cannot sleep in someone elses bed! Get a bed of your own.");
                        return;
                    }
                    if (m_house != null && (m_house.IsOwner(from) || m_house.IsCoOwner(from) || m_house.IsFriend(from)))
                    {
                        wtry              = 0;
                        m_Owner           = m_Player;
                        m_Player.Hidden   = true;
                        m_Player.CantWalk = true;
                        m_Sleeping        = true;
                        m_SleeperBedBody  = new SleeperBedBody(m_Player, false, false);
                        Point3D m_Location = new Point3D(this.Location.X, this.Location.Y + 1, this.Location.Z + 8);
                        m_SleeperBedBody.Direction = Direction.South;
                        m_SleeperBedBody.MoveToWorld(m_Location, this.Map);
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You must be in the house and be the owner, co-owner or friend of the house this bed is in to sleep in it.");
                        return;
                    }
                }
                else
                {
                    if (m_Owner == m_Player)
                    {
                        m_Sleeping        = false;
                        m_Player.Hidden   = false;
                        m_Player.CantWalk = false;
                        if (m_SleeperBedBody != null)
                        {
                            m_SleeperBedBody.Delete();
                        }
                        m_SleeperBedBody = null;
                        switch (Utility.RandomMinMax(1, 3))
                        {
                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You wake up and feel rested and strong.");
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You spring out of bed, ready for another day!");
                            break;

                        case 3:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You fall out of bed and blearily reach for the coffee pot.");
                            break;
                        }
                    }
                    else
                    {
                        switch (wtry)
                        {
                        case 0:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "Shhh, don't wake them up. They really need their beauty rest!");
                            wtry = wtry + 1;
                            break;

                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You really should NOT bother someone that is sleeping. Bad things might happen.");
                            wtry = wtry + 1;
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You were warned!! Now leave them alone.");
                            m_Player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.Head);
                            m_Player.PlaySound(0x208);
                            m_Player.Hits = m_Player.Hits - 40;
                            break;
                        }
                    }
                }
            }
        }
示例#7
0
        public void DoubleClick(Mobile from)
        {
            Mobile m_Player = from as PlayerMobile;

            if (m_Player.CantWalk && !m_Sleeping)
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are already sleeping somewhere!");
            }
            else
            {
                if (!m_Sleeping)
                {
                    wtry              = 0;
                    m_Owner           = m_Player;
                    m_Player.Hidden   = true;
                    m_Player.CantWalk = true;
                    m_Sleeping        = true;
                    m_SleeperBedBody  = new SleeperBedBody(m_Player, false, false);
                    Point3D m_Location = new Point3D(this.Location.X + 1, this.Location.Y, this.Location.Z + 5);
                    m_SleeperBedBody.Direction = Direction.East;
                    m_SleeperBedBody.MoveToWorld(m_Location, this.Map);
                }
                else
                {
                    if (m_Owner == m_Player)
                    {
                        m_Sleeping        = false;
                        m_Player.Hidden   = false;
                        m_Player.CantWalk = false;
                        if (m_SleeperBedBody != null)
                        {
                            m_SleeperBedBody.Delete();
                        }
                        m_SleeperBedBody = null;
                        switch (Utility.RandomMinMax(1, 3))
                        {
                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You wake up and feel rested and strong.");
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You spring out of bed, ready for another day!");
                            break;

                        case 3:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You fall out of bed and blearily reach for the coffee pot.");
                            break;
                        }
                    }
                    else
                    {
                        switch (wtry)
                        {
                        case 0:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "Shhh, don't wake them up. They really need their beauty rest!");
                            wtry = wtry + 1;
                            break;

                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You really should NOT bother someone that is sleeping. Bad things might happen.");
                            wtry = wtry + 1;
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You were warned!! Now leave them alone.");
                            m_Player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.Head);
                            m_Player.PlaySound(0x208);
                            m_Player.Hits = m_Player.Hits - 40;
                            break;
                        }
                    }
                }
            }
        }
        public void DoubleClick(Mobile from)
        {
            Mobile m_Player = from as PlayerMobile;
            if (m_Player.CantWalk && !m_Sleeping)
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are already sleeping somewhere!");
            }
            else
            {
                if (!m_Sleeping)
                {
                    wtry = 0;
                    m_Owner = m_Player;
                    m_Player.Hidden = true;
                    m_Player.CantWalk = true;
                    m_Sleeping = true;
                    m_SleeperBedBody = new SleeperBedBody(m_Player, false, false);
                    Point3D m_Location = new Point3D(this.Location.X + 1, this.Location.Y, this.Location.Z + 5);
                    m_SleeperBedBody.Direction = Direction.East;
                    m_SleeperBedBody.MoveToWorld(m_Location, this.Map);

                }
                else
                {
                    if (m_Owner == m_Player)
                    {
                        m_Sleeping = false;
                        m_Player.Hidden = false;
                        m_Player.CantWalk = false;
                        if (m_SleeperBedBody != null)
                            m_SleeperBedBody.Delete();
                        m_SleeperBedBody = null;
                        switch (Utility.RandomMinMax(1, 3))
                        {
                            case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You wake up and feel rested and strong.");
                            break;
                            case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You spring out of bed, ready for another day!");
                            break;
                            case 3:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You fall out of bed and blearily reach for the coffee pot.");
                            break;
                        }
                    }
                    else
                    {
                        switch (wtry)
                        {
                            case 0:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "Shhh, don't wake them up. They really need their beauty rest!");
                            wtry = wtry + 1;
                            break;
                            case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You really should NOT bother someone that is sleeping. Bad things might happen.");
                            wtry = wtry + 1;
                            break;
                            case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You were warned!! Now leave them alone.");
                            m_Player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.Head);
                            m_Player.PlaySound(0x208);
                            m_Player.Hits = m_Player.Hits - 40;
                            break;
                        }
                    }
                }
            }
        }