예제 #1
0
파일: Autotext.cs 프로젝트: KylerM/Skylight
        /// <summary>
        /// Called when someone says a message using the auto text function.
        /// </summary>
        /// <param name="m">The m.</param>
        public void OnAutotext(Message m)
        {
            // Extract data.
            int id = m.GetInteger(0);

            string message = m.GetString(1);

            var autoTextConversions = new Dictionary<int, string>
                                          {
                                              { 0, "Left." },
                                              { 1, "Hi." },
                                              { 2, "Goodbye." },
                                              { 3, "Help me!" },
                                              { 4, "Thank you." },
                                              { 5, "Follow me." },
                                              { 6, "Stop!" },
                                              { 7, "Yes." },
                                              { 8, "No." },
                                              { 9, "Right." }
                                          };

            // Update relevant objects.
            Player subject = Tools.GetPlayer(id, this._in.Source);

            this._in.Source.ChatLog.Add(new KeyValuePair<string, Player>(message, subject));

            // Fire the event.
            var e = new ChatEventArgs(subject, m, this._in.Source, message);

            this._in.Source.Pull.Autotext.AutotextEvent(e);
        }
예제 #2
0
파일: ChatOld.cs 프로젝트: KylerM/Skylight
        /// <summary>
        /// Called when premature messages are given to the client.
        /// </summary>
        /// <param name="m">The message.</param>
        public void OnSayOld(Message m)
        {
            // Extract data.
            string message = m.GetString(1);

            // Update relevant objects.

            _in.Source.ChatLog.Add(new KeyValuePair<string, Player>(message, null));

            // Fire the event.
            var e = new ChatEventArgs(null, m, _in.Source, message);

            _in.Source.Pull.ChatOld.SayOldEvent(e);
        }