Ejemplo n.º 1
0
        public override void OnSpeech(SpeechEventArgs args)
        {
            if (m_Done)
            {
                return;
            }

            if (args.Mobile.InRange(this, 2)) //if a player is within 2 tiles of the NPC
            {
                if (args.Speech.ToLower().IndexOf("name") >= 0)
                {
                    Direction = GetDirectionTo(args.Mobile.Location);
                    Say(String.Format("My name is {0}, in your service.", Name)); //Npc tells the player it's name
                    Animate(32, 5, 1, true, false, 0);                            // Bow
                }

                else if (args.Speech.ToLower().IndexOf("hello") >= 0 || args.Speech.ToLower().IndexOf("hail") >= 0) //Checks to see if the player says Hail or Hello
                {
                    Say(String.Format("Hail "));                                                                    //Npc says hello to the player
                }
                else if (args.Speech.ToLower().IndexOf("buy") >= 0)                                                 //If player says buy
                {
                    Say(String.Format("I have nothing to sell but the rags I wear!"));                              //Npc will respond
                }
                else if (args.Speech.ToLower().IndexOf("news") >= 0)                                                //If player says news
                {
                    SpeechHelper.SayRandom(newssay, this);
                }
            }

            base.OnSpeech(args);
        }
Ejemplo n.º 2
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            if (m_Done)
            {
                return;
            }

            if (m_Talked == false)
            {
                if (m.InRange(this, 3) && !m.Hidden)
                {
                    m_Talked = true;
                    SpeechHelper.SayRandom(begsay, this);
                    Move(GetDirectionTo(m.Location));
                    // Start timer to prevent spam
                    SpamTimer t = new SpamTimer(this);
                    t.Start();
                }
            }
        }