Esempio n. 1
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;
                        }
                    }
                }
            }
        }
Esempio n. 2
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;
                        }
                    }
                }
            }
        }