예제 #1
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            base.OnSpeech(e);

            if (!e.Handled && InRange(e.Mobile, 3))
            {
                if (m_NewsTimer == null && e.HasKeyword(0x30))                     // *news*
                {
                    TownCrierEntry tce = GlobalTownCrierEntryList.Instance.GetRandomEntry();

                    if (tce == null)
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 1005643);                           // I have no news at this time.
                    }
                    else
                    {
                        m_NewsTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(3.0), new TimerStateCallback(ShoutNews_Callback), new object[] { tce, 0 });

                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 502978);                           // Some of the latest news!
                    }
                }

                for (int i = 0; i < m_Rumors.Length; ++i)
                {
                    ScribeRumor rumor = m_Rumors[i];

                    if (rumor == null)
                    {
                        continue;
                    }

                    string keyword = rumor.Keyword;

                    if (keyword == null || (keyword = keyword.Trim()).Length == 0)
                    {
                        continue;
                    }

                    if (Insensitive.Equals(keyword, e.Speech))
                    {
                        string message = rumor.Message;

                        if (message == null || (message = message.Trim()).Length == 0)
                        {
                            continue;
                        }

                        PublicOverheadMessage(MessageType.Regular, 0x3B2, false, message);
                    }
                }
            }
        }
예제 #2
0
 public static void Serialize(GenericWriter writer, ScribeRumor rumor)
 {
     if (rumor == null)
     {
         writer.Write(false);
     }
     else
     {
         writer.Write(true);
         writer.Write(rumor.m_Message);
         writer.Write(rumor.m_Keyword);
     }
 }
예제 #3
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)1);                // version;

            writer.Write((Item)m_House);

            writer.Write((Mobile)m_Owner);

            writer.WriteEncodedInt((int)m_Rumors.Length);

            for (int i = 0; i < m_Rumors.Length; ++i)
            {
                ScribeRumor.Serialize(writer, m_Rumors[i]);
            }

            writer.Write((string)m_TipMessage);
        }
예제 #4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                House = (BaseHouse)reader.ReadItem();

                goto case 0;
            }

            case 0:
            {
                m_Owner = reader.ReadMobile();

                m_Rumors = new ScribeRumor[reader.ReadEncodedInt()];

                for (int i = 0; i < m_Rumors.Length; ++i)
                {
                    m_Rumors[i] = ScribeRumor.Deserialize(reader);
                }

                m_TipMessage = reader.ReadString();

                break;
            }
            }

            if (version < 1)
            {
                Timer.DelayCall(TimeSpan.Zero, new TimerCallback(UpgradeFromVersion0));
            }
        }