Example #1
0
        private static void EventSink_Speech( SpeechEventArgs args )
        {
            if ( !args.Handled )
            {
                if ( Insensitive.StartsWith( args.Speech, "set" ) )
                {
                    Mobile from = args.Mobile;

                    string[] split = args.Speech.Split( ' ' );

                    if ( split.Length == 3 )
                    {
                        try
                        {
                            string name = split[1];
                            double value = Convert.ToDouble( split[2] );

                            if ( Insensitive.Equals( name, "str" ) )
                                ChangeStrength( from, (int) value );
                            else if ( Insensitive.Equals( name, "dex" ) )
                                ChangeDexterity( from, (int) value );
                            else if ( Insensitive.Equals( name, "int" ) )
                                ChangeIntelligence( from, (int) value );
                            else
                                ChangeSkill( from, name, value );
                        }
                        catch
                        {
                        }
                    }
                }
                else if ( Insensitive.Equals( args.Speech, "help" ) )
                {
                    args.Mobile.SendGump( new TCHelpGump() );

                    args.Handled = true;
                }
            }
        }
Example #2
0
        public override void OnSpeech( SpeechEventArgs e )
        {
            InhumanSpeech speechType = this.SpeechType;

            if( speechType != null && speechType.OnSpeech(this, e.Mobile, e.Speech) )
                e.Handled = true;
            else if( !e.Handled && m_AI != null && e.Mobile.InRange(this, m_iRangePerception) )
                m_AI.OnSpeech(e);
        }
Example #3
0
        /// <summary>
        /// Grants EoC for speaking and emoting
        /// </summary>
        private static void OnSpeech( SpeechEventArgs args )
        {
            Player p = args.Mobile as Player;

            if( p != null && p.Map != null && p.Map != Map.Internal )
            {
                int playerCount = 0;
                IPooledEnumerable eable = p.Map.GetClientsInRange(p.Location);

                foreach( NetState ns in eable )
                {
                    if( ns.Mobile != null && ns.Mobile != p && ns.Mobile.CanSee(p) && ns.Mobile.Alive == p.Alive )
                    {
                        playerCount++;
                    }
                }

                eable.Free();

                if( args.Type == MessageType.Emote || args.Type == MessageType.Regular )
                {
                    p.EssenceOfCharacter += (1 * playerCount);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Overridden to add handlers for fame locking
        /// </summary>
        public override void OnSaid( SpeechEventArgs args )
        {
            string speech = args.Speech.ToLower();

            if( speech.IndexOf("i wish to lock my fame") > -1 )
            {
                FameLocked = true;
                SendMessage("Your fame has been locked.");
            }
            else if( speech.IndexOf("i wish to unlock my fame") > -1 )
            {
                FameLocked = false;
                SendMessage("Your fame has been unlocked.");
            }
            else
            {
                string[] jumpWords = new string[] { "jump", "jumps" };

                for( int i = 0; i < jumpWords.Length; i++ )
                {
                    string word = jumpWords[i];

                    if( speech == "*" + word + "*" || (args.Type == MessageType.Emote && speech == word) )
                    {
                        JumpCommand.BeginJump(this);
                        break;
                    }
                }
            }

            base.OnSaid(args);
        }
Example #5
0
        // Temporary
        public override void OnSpeech( SpeechEventArgs e )
        {
            base.OnSpeech( e );

            Mobile from = e.Mobile;

            if ( m_Mobile is BaseVendor && from.InRange( m_Mobile, 4 ) && !e.Handled )
            {
                if ( e.HasKeyword( 0x14D ) ) // *vendor sell*
                {
                    e.Handled = true;

                    ( (BaseVendor) m_Mobile ).VendorSell( from );
                    m_Mobile.FocusMob = from;
                }
                else if ( e.HasKeyword( 0x3C ) )
                {
                    e.Handled = true;

                    ( (BaseVendor) m_Mobile ).VendorBuy( from );
                    m_Mobile.FocusMob = from;
                }
                else if ( WasNamed( e.Speech ) )
                {
                    e.Handled = true;

                    if ( e.HasKeyword( 0x177 ) ) // *sell*
                        ( (BaseVendor) m_Mobile ).VendorSell( from );
                    else if ( e.HasKeyword( 0x171 ) ) // *buy*
                        ( (BaseVendor) m_Mobile ).VendorBuy( from );

                    m_Mobile.FocusMob = from;
                }
            }
        }
		private static void EventSink_Speech( SpeechEventArgs e )
		{
			if ( DesignContext.Find( e.Mobile ) != null )
			{
				e.Mobile.SendLocalizedMessage( 1061925 ); // You cannot speak while customizing your house.
				e.Blocked = true;
			}
		}
Example #7
0
        public override void OnSpeech( SpeechEventArgs e )
        {
            if ( SpeechLog.Enabled && this.Client != null )
            {
                if ( m_SpeechLog == null )
                    m_SpeechLog = new SpeechLog();

                m_SpeechLog.Add( e.Mobile, e.Speech );
            }
        }
Example #8
0
        public virtual void OnSpeech( SpeechEventArgs e )
        {
            if( e.Mobile.Alive && e.Mobile.InRange(m_Mobile.Location, 3) && m_Mobile.IsHumanInTown() )
            {
                if( e.HasKeyword(0x9D) && WasNamed(e.Speech) ) // *move*
                {
                    if( m_Mobile.Combatant != null )
                    {
                        // I am too busy fighting to deal with thee!
                        m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501482);
                    }
                    else
                    {
                        // Excuse me?
                        m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501516);
                        WalkRandomInHome(2, 2, 1);
                    }
                }
                else if( e.HasKeyword(0x9E) && WasNamed(e.Speech) ) // *time*
                {
                    if( m_Mobile.Combatant != null )
                    {
                        // I am too busy fighting to deal with thee!
                        m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501482);
                    }
                    else
                    {
                        int generalNumber;
                        string exactTime;

                        Clock.GetTime(m_Mobile, out generalNumber, out exactTime);

                        m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, generalNumber);
                    }
                }
                else if( e.HasKeyword(0x6C) && WasNamed(e.Speech) ) // *train
                {
                    if( m_Mobile.Combatant != null )
                    {
                        // I am too busy fighting to deal with thee!
                        m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501482);
                    }
                    else
                    {
                        bool foundSomething = false;

                        Skills ourSkills = m_Mobile.Skills;
                        Skills theirSkills = e.Mobile.Skills;

                        for( int i = 0; i < ourSkills.Length && i < theirSkills.Length; ++i )
                        {
                            Skill skill = ourSkills[i];
                            Skill theirSkill = theirSkills[i];

                            if( skill != null && theirSkill != null && skill.Base >= 60.0 && m_Mobile.CheckTeach(skill.SkillName, e.Mobile) )
                            {
                                double toTeach = skill.Base / 3.0;

                                if( toTeach > 42.0 )
                                    toTeach = 42.0;

                                if( toTeach > theirSkill.Base )
                                {
                                    int number = 1043059 + i;

                                    if( number > 1043107 )
                                        continue;

                                    if( !foundSomething )
                                        m_Mobile.Say(1043058); // I can train the following:

                                    m_Mobile.Say(number);

                                    foundSomething = true;
                                }
                            }
                        }

                        if( !foundSomething )
                            m_Mobile.Say(501505); // Alas, I cannot teach thee anything.
                    }
                }
                else
                {
                    SkillName toTrain = (SkillName)(-1);

                    for( int i = 0; toTrain == (SkillName)(-1) && i < e.Keywords.Length; ++i )
                    {
                        int keyword = e.Keywords[i];

                        if( keyword == 0x154 )
                        {
                            toTrain = SkillName.Anatomy;
                        }
                        else if( keyword >= 0x6D && keyword <= 0x9C )
                        {
                            int index = keyword - 0x6D;

                            if( index >= 0 && index < m_KeywordTable.Length )
                                toTrain = m_KeywordTable[index];
                        }
                    }

                    if( toTrain != (SkillName)(-1) && WasNamed(e.Speech) )
                    {
                        if( m_Mobile.Combatant != null )
                        {
                            // I am too busy fighting to deal with thee!
                            m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501482);
                        }
                        else
                        {
                            Skills skills = m_Mobile.Skills;
                            Skill skill = skills[toTrain];

                            if( skill == null || skill.Base < 60.0 || !m_Mobile.CheckTeach(toTrain, e.Mobile) )
                            {
                                m_Mobile.Say(501507); // 'Tis not something I can teach thee of.
                            }
                            else
                            {
                                m_Mobile.Teach(toTrain, e.Mobile, 0, false);
                            }
                        }
                    }
                }
            }

            if( m_Mobile.Controlled && m_Mobile.Commandable )
            {
                m_Mobile.DebugSay("Listening...");

                bool isOwner = (e.Mobile == m_Mobile.ControlMaster);
                bool isFriend = (!isOwner && m_Mobile.IsPetFriend(e.Mobile));

                if( e.Mobile.Alive && (isOwner || isFriend) )
                {
                    m_Mobile.DebugSay("It's from my master");

                    int[] keywords = e.Keywords;
                    string speech = e.Speech;

                    // First, check the all*
                    for( int i = 0; i < keywords.Length; ++i )
                    {
                        int keyword = keywords[i];

                        switch( keyword )
                        {
                            case 0x164: // all come
                                {
                                    if( !isOwner )
                                        break;

                                    if( m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Come;
                                    }

                                    return;
                                }
                            case 0x165: // all follow
                                {
                                    BeginPickTarget(e.Mobile, OrderType.Follow);
                                    return;
                                }
                            case 0x166: // all guard
                            case 0x16B: // all guard me
                                {
                                    if( !isOwner )
                                        break;

                                    if( m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Guard;
                                    }
                                    return;
                                }
                            case 0x167: // all stop
                                {
                                    if( m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Stop;
                                    }
                                    return;
                                }
                            case 0x168: // all kill
                            case 0x169: // all attack
                                {
                                    if( !isOwner )
                                        break;

                                    BeginPickTarget(e.Mobile, OrderType.Attack);
                                    return;
                                }
                            case 0x16C: // all follow me
                                {
                                    if( m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = e.Mobile;
                                        m_Mobile.ControlOrder = OrderType.Follow;
                                    }
                                    return;
                                }
                            case 0x170: // all stay
                                {
                                    if( m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Stay;
                                    }
                                    return;
                                }
                        }
                    }

                    // No all*, so check *command
                    for( int i = 0; i < keywords.Length; ++i )
                    {
                        int keyword = keywords[i];

                        switch( keyword )
                        {
                            case 0x155: // *come
                                {
                                    if( !isOwner )
                                        break;

                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Come;
                                    }

                                    return;
                                }
                            case 0x156: // *drop
                                {
                                    if( !isOwner )
                                        break;

                                    if( !m_Mobile.IsDeadPet && !m_Mobile.Summoned && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Drop;
                                    }

                                    return;
                                }
                            case 0x15A: // *follow
                                {
                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                        BeginPickTarget(e.Mobile, OrderType.Follow);

                                    return;
                                }
                            case 0x15B: // *friend
                                {
                                    if( !isOwner )
                                        break;

                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        if( m_Mobile.Summoned )
                                            e.Mobile.SendLocalizedMessage(1005481); // Summoned creatures are loyal only to their summoners.
                                        else if( e.Mobile.HasTrade )
                                            e.Mobile.SendLocalizedMessage(1070947); // You cannot friend a pet with a trade pending
                                        else
                                            BeginPickTarget(e.Mobile, OrderType.Friend);
                                    }

                                    return;
                                }
                            case 0x15C: // *guard
                                {
                                    if( !isOwner )
                                        break;

                                    if( !m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Guard;
                                    }

                                    return;
                                }
                            case 0x15D: // *kill
                            case 0x15E: // *attack
                                {
                                    if( !isOwner )
                                        break;

                                    if( !m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                        BeginPickTarget(e.Mobile, OrderType.Attack);

                                    return;
                                }
                            case 0x15F: // *patrol
                                {
                                    if( !isOwner )
                                        break;

                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Patrol;
                                    }

                                    return;
                                }
                            case 0x161: // *stop
                                {
                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Stop;
                                    }

                                    return;
                                }
                            case 0x163: // *follow me
                                {
                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = e.Mobile;
                                        m_Mobile.ControlOrder = OrderType.Follow;
                                    }

                                    return;
                                }
                            case 0x16D: // *release
                                {
                                    if( !isOwner )
                                        break;

                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        if( !m_Mobile.Summoned )
                                        {
                                            e.Mobile.SendGump(new Gumps.ConfirmReleaseGump(e.Mobile, m_Mobile));
                                        }
                                        else
                                        {
                                            m_Mobile.ControlTarget = null;
                                            m_Mobile.ControlOrder = OrderType.Release;
                                        }
                                    }

                                    return;
                                }
                            case 0x16E: // *transfer
                                {
                                    if( !isOwner )
                                        break;

                                    if( !m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        if( m_Mobile.Summoned )
                                            e.Mobile.SendLocalizedMessage(1005487); // You cannot transfer ownership of a summoned creature.
                                        else if( e.Mobile.HasTrade )
                                            e.Mobile.SendLocalizedMessage(1010507); // You cannot transfer a pet with a trade pending
                                        else
                                            BeginPickTarget(e.Mobile, OrderType.Transfer);
                                    }

                                    return;
                                }
                            case 0x16F: // *stay
                                {
                                    if( WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile) )
                                    {
                                        m_Mobile.ControlTarget = null;
                                        m_Mobile.ControlOrder = OrderType.Stay;
                                    }

                                    return;
                                }
                        }
                    }
                }
            }
            else
            {
                if( e.Mobile.AccessLevel >= AccessLevel.GameMaster )
                {
                    m_Mobile.DebugSay("It's from a GM");

                    if( m_Mobile.FindMyName(e.Speech, true) )
                    {
                        string[] str = e.Speech.Split(' ');
                        int i;

                        for( i = 0; i < str.Length; i++ )
                        {
                            string word = str[i];

                            if( Insensitive.Equals(word, "obey") )
                            {
                                m_Mobile.SetControlMaster(e.Mobile);

                                if( m_Mobile.Summoned )
                                    m_Mobile.SummonMaster = e.Mobile;

                                return;
                            }
                        }
                    }
                }
            }
        }
Example #9
0
        public override void OnSpeech( SpeechEventArgs e )
        {
            base.OnSpeech( e );

            Mobile from = e.Mobile;
            Item sign = m_House.Sign;

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

            bool isOwner = m_House.IsOwner( from );
            bool isCoOwner = isOwner || m_House.IsCoOwner( from );
            bool isFriend = isCoOwner || m_House.IsFriend( from );

            if ( !isFriend )
                return;

            if ( Insensitive.Equals( e.Speech, "I wish to resize my house" ) )
            {
                if ( from.Map != sign.Map || !from.InRange( sign, 1 ) )
                {
                    from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
                }
                else if ( DateTime.Now <= m_House.BuiltOn.AddHours( 1.0 ) )
                {
                    from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition.
                }
                else if ( m_House.MovingCrate != null && m_House.MovingCrate.TotalItems > 0 )
                {
                    from.SendLocalizedMessage( 1080455 ); // You cannot resize your house at this time. Please remove all items from the moving crate and try again.
                }
                else if ( isOwner )
                {
                    from.CloseGump( typeof( ConfirmHouseResize ) );
                    from.CloseGump( typeof( HouseGump ) );
                    from.SendGump( new ConfirmHouseResize( from, m_House ) );
                }
                else
                {
                    from.SendLocalizedMessage( 501320 ); // Only the house owner may do this.
                }
            }
            else if ( e.HasKeyword( 0x33 ) ) // remove thyself
            {
                if ( isFriend )
                {
                    from.SendLocalizedMessage( 501326 ); // Target the individual to eject from this house.
                    from.Target = new HouseKickTarget( 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.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
                }
                else if ( !m_House.Public )
                {
                    from.SendLocalizedMessage( 1062521 ); // You cannot ban someone from a private house.  Revoke their access instead.
                }
                else
                {
                    from.SendLocalizedMessage( 501325 ); // Target the individual to ban from this house.
                    from.Target = new HouseBanTarget( true, m_House );
                }
            }
            else if ( e.HasKeyword( 0x23 ) ) // I wish to lock this down
            {
                if ( isCoOwner )
                {
                    from.SendLocalizedMessage( 502097 ); // Lock what down?
                    from.Target = new LockdownTarget( false, m_House );
                }
                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.SendLocalizedMessage( 502100 ); // Choose the item you wish to release
                    from.Target = new LockdownTarget( true, m_House );
                }
                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 ( isOwner )
                {
                    from.SendLocalizedMessage( 502103 ); // Choose the item you wish to secure
                    from.Target = new SecureTarget( false, m_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 ( isOwner )
                {
                    from.SendLocalizedMessage( 502106 ); // Choose the item you wish to unsecure
                    from.Target = new SecureTarget( true, m_House );
                }
                else
                {
                    from.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
                }
            }
            else if ( e.HasKeyword( 0x27 ) ) // I wish to place a strongbox
            {
                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 ) ) // trash barrel
            {
                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.
                }
            }
        }
Example #10
0
        static void QueryListeners(Player p, SpeechEventArgs args)
        {
            if (p != null && p.Map != null && p.Map != Map.Internal)
            {
                int playerCount = 0;
                IPooledEnumerable eable = p.Map.GetClientsInRange(p.Location);

                foreach (NetState ns in eable)
                {
                    if (ns.Mobile != null && ns.Mobile != p && ns.Mobile.CanSee(p)
                        && ns.Mobile.Alive == p.Alive && ns.Mobile.AccessLevel == AccessLevel.Player)
                    {
                        playerCount++; break;
                    }
                }

                eable.Free();

                if (args.Type == MessageType.Emote || args.Type == MessageType.Regular)
                {
                    if (playerCount > 0)
                        p.EssenceOfCharacter += Utility.RandomMinMax(1,2);
                }
            }
        }
Example #11
0
        /// <summary>
        /// Grants EoC for speaking and emoting
        /// </summary>
        private static void OnSpeech( SpeechEventArgs args )
        {
            Player p = args.Mobile as Player;

            if (!speechCache.ContainsKey(p) && p != null)
            {
                List<String> newList = new List<string>();
                newList.Add(args.Speech.Trim());
                speechCache.Add(p, newList);

                QueryListeners(p, args);
            }

            else if (speechCache.ContainsKey(p) && p != null)
            {
                List<String> pastEntries = new List<string>();
                pastEntries = speechCache[p];

                if (!pastEntries.Contains(args.Speech.Trim()))
                {
                    pastEntries.Add(args.Speech.Trim());
                    QueryListeners(p, args);
                }

                else
                {
                    if (speechCache[p].Count > 10)
                        speechCache[p].Clear();
                }
            }
        }