コード例 #1
0
        public void RenderMessageManagement_Message_Remove()
        {
            AddPage(5);

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

            RoomAttendantRumor[] rumors = m_Roomattendant.Rumors;

            for (int i = 0; i < rumors.Length; ++i)
            {
                RoomAttendantRumor 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 static void Serialize(GenericWriter writer, RoomAttendantRumor rumor)
 {
     if (rumor == null)
     {
         writer.Write(false);
     }
     else
     {
         writer.Write(true);
         writer.Write(rumor.m_Message);
         writer.Write(rumor.m_Keyword);
     }
 }
コード例 #3
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 RoomAttendantRumor(null, text);
            }
            else
            {
                m_Rumors[index].Keyword = text;
            }

            PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I'll pass on the message.", from.NetState);
        }
コード例 #4
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)
            {
                RoomAttendantRumor.Serialize(writer, m_Rumors[i]);
            }

            writer.Write((string)m_TipMessage);
        }
コード例 #5
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 RoomAttendantRumor(text, null);
            }
            else
            {
                m_Rumors[index].Message = text;
            }

            from.Prompt = new ChangeARumorKeywordPrompt(this, index);
            PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "What keyword should a guest say to me to get this news?", from.NetState);
        }
コード例 #6
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 RoomAttendantRumor[reader.ReadEncodedInt()];

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

                m_TipMessage = reader.ReadString();

                break;
            }
            }

            if (version < 1)
            {
                Timer.DelayCall(TimeSpan.Zero, new TimerCallback(UpgradeFromVersion0));
            }
        }
コード例 #7
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            Mobile    from = e.Mobile;
            Container bank = from.FindBankNoCreate();

            object command = RoomAttendantCommands.None;

            if (e.Speech.Length > "vendor ".Length && e.Speech.Substring(0, "vendor ".Length).ToLower() == "vendor ")
            {
                command = s_Keywords[e.Speech.Substring("vendor ".Length)];
            }
            else if (e.Speech.Length > Name.Length + 1 && e.Speech.Substring(0, Name.Length + 1).ToLower() == Name.ToLower() + ' ')
            {
                command = s_Keywords[e.Speech.Substring(Name.Length + 1)];
            }
            else if (e.Speech.Length > "attendant ".Length && e.Speech.Substring(0, "attendant ".Length).ToLower() == "attendant ")
            {
                command = s_Keywords[e.Speech.Substring("attendant ".Length)];
            }

            switch ((command == null ? (int)RoomAttendantCommands.None : (int)command))
            {
            case (int)RoomAttendantCommands.Room:
            {
                if ((from.Backpack == null || from.Backpack.GetAmount(typeof(Gold)) < 30) && (bank == null || Banker.Withdraw(from, 30))) //bank.GetAmount( typeof( Gold ) ) < 30 ) )
                {
                    SayTo(from, "Thou dost not have enough gold, not even in thy bank account.");                                         // Thou dost not have enough gold, not even in thy bank account.
                }
                else
                {
                    SayTo(from, "I need thirty gold for the carrier pigeon rental.");

                    from.Target = new RoomTarget(this);
                }
                break;
            }

            case (int)RoomAttendantCommands.Help:
            {
                SayTo(from, "For a fee I can rent a carrier pigeon for you to call your squire with from their room.");
                break;
            }

            default:
            {
                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)
                    {
                        RoomAttendantRumor 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);
                        }
                    }
                }

                break;
            }
            }
        }
コード例 #8
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 RoomAttendantRumor( null, text );
			else
				m_Rumors[index].Keyword = text;

			PrivateOverheadMessage( MessageType.Regular, 0x3B2, false, "I'll pass on the message.", from.NetState );
		}
コード例 #9
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 RoomAttendantRumor( text, null );
			else
				m_Rumors[index].Message = text;

			from.Prompt = new ChangeARumorKeywordPrompt( this, index );
			PrivateOverheadMessage( MessageType.Regular, 0x3B2, false, "What keyword should a guest say to me to get this news?", from.NetState );
		}
コード例 #10
0
		public static void Serialize( GenericWriter writer, RoomAttendantRumor rumor )
		{
			if ( rumor == null )
			{
				writer.Write( false );
			}
			else
			{
				writer.Write( true );
				writer.Write( rumor.m_Message );
				writer.Write( rumor.m_Keyword );
			}
		}