Esempio n. 1
0
        private static void EventSink_Speech(SpeechEventArgs args)
        {
            Mobile m = args.Mobile;

            if (m == null)
            {
                return;
            }

            DateTime now = DateTime.Now;

            // check for logging (pseudoseer or counselor)
            if (m.AccessLevel == AccessLevel.Counselor)
            {
                LoggingCustom.LogCounselor(now + "\t" + m.Name + ":\t" + args.Speech);
            }

            if (m.Account != null && PseudoSeerStone.Instance != null &&
                PseudoSeerStone.Instance.PseudoSeers.ContainsKey(m.Account))
            {
                LoggingCustom.LogPseudoseer(now + "\t" + m.Account + "\t" + m.Name + ":\t" + args.Speech);
            }

            if (m is PlayerMobile && ((PlayerMobile)m).Companion)
            {
                LoggingCustom.Log(
                    Path.Combine(new[] { CompanionListGump.LogFileLocation, m.Name + ".txt" }),
                    now + "\t" + m.Name + ":\t" + args.Speech);
                LoggingCustom.LogCompanion(now + "\t" + m.Name + ":\t" + args.Speech);
            }

            if (!args.Blocked)             // might turn it to true if return override encountered
            {
                if (XmlScript.HasTrigger(m, TriggerName.onSay))
                {
                    args.Blocked = Trigger(m, m, TriggerName.onSay, null, args.Speech);
                }
                args.Handled = args.Blocked;
            }
            else if (XmlScript.HasTrigger(m, TriggerName.onSay))
            {
                Trigger(m, m, TriggerName.onSay, null, args.Speech);
            }
        }