Пример #1
0
        public void RenderMessageManagement_Message_Remove()
        {
            AddPage(5);

            AddHtml(190, 60, 500, 25, "Choose the message you would like to remove", false, false);

            BarkeeperRumor[] rumors = m_Barkeeper.Rumors;

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

                AddHtml(100, 70 + (i * 120), 50, 20, "Message", false, false);
                AddHtml(100, 90 + (i * 120), 450, 40, rumor == null ? "No current message" : rumor.Message, true, false);
                AddHtml(100, 130 + (i * 120), 50, 20, "Keyword", false, false);
                AddHtml(100, 150 + (i * 120), 450, 40, rumor == null ? "None" : rumor.Keyword, true, false);

                AddButton(60, 90 + (i * 120), 4005, 4007, GetButtonID(2, i), GumpButtonType.Reply, 0);
            }

            AddButton(338, 437, 4014, 4016, 0, GumpButtonType.Page, 2);
            AddHtml(290, 440, 35, 40, "Back", false, false);

            AddItem(580, 46, 4030);
        }
Пример #2
0
        public void RenderMessageManagement_Message_AddOrChange()
        {
            AddPage(4);

            AddHtml(250, 60, 500, 25, "Add or change a message", false, false);

            var rumors = m_Barkeeper.Rumors;

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

                AddHtml(100, 70 + (i * 120), 50, 20, "Message", false, false);
                AddHtml(100, 90 + (i * 120), 450, 40, rumor == null ? "No current message" : rumor.Message, true, false);
                AddHtml(100, 130 + (i * 120), 50, 20, "Keyword", false, false);
                AddHtml(100, 150 + (i * 120), 450, 40, rumor == null ? "None" : rumor.Keyword, true, false);

                AddButton(60, 90 + (i * 120), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);
            }

            AddButton(338, 437, 4014, 4016, 0, GumpButtonType.Page, 2);
            AddHtml(290, 440, 35, 40, "Back", false, false);

            AddItem(580, 46, 4030);
        }
Пример #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_IsActiveSeller = reader.ReadBool();

                goto case 0;
            }

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

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

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

                m_TipMessage = reader.ReadString();

                break;
            }
            }
        }
Пример #4
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)
                {
                    BarkeeperRumor 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);
                    }
                }
            }
        }
Пример #5
0
 public static void Serialize(GenericWriter writer, BarkeeperRumor rumor)
 {
     if (rumor == null)
     {
         writer.Write(false);
     }
     else
     {
         writer.Write(true);
         writer.Write(rumor.m_Message);
         writer.Write(rumor.m_Keyword);
     }
 }
Пример #6
0
        public void EndChangeKeyword(Mobile from, int index, string text)
        {
            if (index < 0 || index >= m_Rumors.Length)
            {
                return;
            }

            if (m_Rumors[index] == null)
            {
                m_Rumors[index] = new BarkeeperRumor(null, text);
            }
            else
            {
                m_Rumors[index].Keyword = text;
            }

            PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I'll pass on the message.", from.NetState);
        }
Пример #7
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)
            {
                BarkeeperRumor.Serialize(writer, m_Rumors[i]);
            }

            writer.Write((string)m_TipMessage);
        }
Пример #8
0
        public void EndChangeRumor(Mobile from, int index, string text)
        {
            if (index < 0 || index >= m_Rumors.Length)
            {
                return;
            }

            if (m_Rumors[index] == null)
            {
                m_Rumors[index] = new BarkeeperRumor(text, null);
            }
            else
            {
                m_Rumors[index].Message = text;
            }

            from.Prompt = new ChangeRumorKeywordPrompt(this, index);
            PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "What keyword should a guest say to me to get this news?", from.NetState);
        }
Пример #9
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*
                {
                }

                for (int i = 0; i < m_Rumors.Length; ++i)
                {
                    BarkeeperRumor 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);
                    }
                }
            }
        }
Пример #10
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 BarkeeperRumor[reader.ReadEncodedInt()];

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

                m_TipMessage = reader.ReadString();

                break;
            }
            }

            if (version < 1)
            {
                Timer.DelayCall(TimeSpan.Zero, new TimerCallback(UpgradeFromVersion0));
            }
        }
Пример #11
0
        public void EndChangeRumor( Mobile from, int index, string text )
        {
            if ( index < 0 || index >= m_Rumors.Length )
                return;

            if ( m_Rumors[index] == null )
                m_Rumors[index] = new BarkeeperRumor( text, null );
            else
                m_Rumors[index].Message = text;

            from.Prompt = new ChangeRumorKeywordPrompt( this, index );
            PrivateOverheadMessage( MessageType.Regular, 0x3B2, false, "What keyword should a guest say to me to get this news?", from.Client );
        }
Пример #12
0
        public void EndChangeKeyword( Mobile from, int index, string text )
        {
            if ( index < 0 || index >= m_Rumors.Length )
                return;

            if ( m_Rumors[index] == null )
                m_Rumors[index] = new BarkeeperRumor( null, text );
            else
                m_Rumors[index].Keyword = text;

            PrivateOverheadMessage( MessageType.Regular, 0x3B2, false, "I'll pass on the message.", from.Client );
        }
Пример #13
0
 public static void Serialize( GenericWriter writer, BarkeeperRumor rumor )
 {
     if ( rumor == null )
     {
         writer.Write( false );
     }
     else
     {
         writer.Write( true );
         writer.Write( rumor.m_Message );
         writer.Write( rumor.m_Keyword );
     }
 }