コード例 #1
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!from.Alive || !m_House.IsInside(from))
            {
                return;
            }

            bool isOwner   = (from.AccessLevel >= AccessLevel.GameMaster || from == m_House.Owner);
            bool isCoOwner = isOwner || m_House.IsCoOwner(from);
            bool isFriend  = isCoOwner || m_House.IsFriend(from);

            if (!isFriend)
            {
                return;
            }

            if (e.HasKeyword(0x33))                 // remove thyself
            {
                if (isFriend)
                {
                    from.SendLocalizedMessage(501326);                       // Target the individual to eject from this house.
                    from.Target = new StaticHouseKickTarget(m_House);
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x34))                 // I ban thee
            {
                if (isFriend)
                {
                    from.Target = new StaticHouseBanTarget(true, m_House);
                    from.SendLocalizedMessage(501325);                       // Target the individual to ban from this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x23))                 // I wish to lock this down
            {
                if (isCoOwner)
                {
                    from.Target = new LockdownTarget(false, m_House);
                    from.SendLocalizedMessage(502097);                       // Lock what down?
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x24))                 // I wish to release this
            {
                if (isCoOwner)
                {
                    from.Target = new LockdownTarget(true, m_House);
                    from.SendLocalizedMessage(502100);                       // Choose the item you wish to release
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }

            /*else if ( e.HasKeyword( 0x25 ) ) // I wish to secure this
             * {
             *      if ( isCoOwner )
             *      {
             *              from.Target = new  SecureTarget( false, m_House );
             *              from.SendLocalizedMessage( 502103 ); // Choose the item you wish to secure
             *      }
             *      else if ( isFriend )
             *      {
             *              from.SendLocalizedMessage( 1010587 ); // You are not a co-owner of this house.
             *      }
             *      else
             *      {
             *              from.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
             *      }
             * }*/
            else if (e.HasKeyword(0x26))                 // I wish to unsecure this
            {
                if (isCoOwner)
                {
                    from.Target = new  SecureTarget(true, m_House);
                    from.SendLocalizedMessage(502106);                       // Choose the item you wish to unsecure
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x27))                 // I wish to place a strong box
            {
                if (isOwner)
                {
                    from.SendLocalizedMessage(502109);                       // Owners do not get a strongbox of their own.
                }
                else if (isCoOwner)
                {
                    m_House.AddStrongBox(from);
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x28))
            {
                if (isCoOwner)
                {
                    m_House.AddTrashBarrel(from);
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
        }