Inheritance: Server.BaseItem
        public static void BBRequestContent(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
        {
            BulletinMessage msg = World.FindItem(pvSrc.ReadInt32()) as BulletinMessage;

            if (msg == null || msg.Parent != board)
            {
                return;
            }

            from.Send(new BBMessageContent(board, msg));
        }
Exemple #2
0
		public static void BBRemoveMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
		{
			BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;

			if ( msg == null || msg.Parent != board )
				return;

			if ( from.AccessLevel < AccessLevel.GameMaster && msg.Poster != from )
				return;

			msg.Delete();
		}
        public BBMessageContent(BaseBulletinBoard board, BulletinMessage msg)
            : base(0x71)
        {
            string poster  = this.SafeString(msg.PostedName);
            string subject = this.SafeString(msg.Subject);
            string time    = this.SafeString(msg.GetTimeAsString());

            this.EnsureCapacity(22 + poster.Length + subject.Length + time.Length);

            this.m_Stream.Write((byte)0x02);        // PacketID
            this.m_Stream.Write((int)board.Serial); // Bulletin board serial
            this.m_Stream.Write((int)msg.Serial);   // Message serial

            this.WriteString(poster);
            this.WriteString(subject);
            this.WriteString(time);

            this.m_Stream.Write((short)msg.PostedBody);
            this.m_Stream.Write((short)msg.PostedHue);

            int len = msg.PostedEquip.Length;

            if (len > 255)
            {
                len = 255;
            }

            this.m_Stream.Write((byte)len);

            for (int i = 0; i < len; ++i)
            {
                BulletinEquip eq = msg.PostedEquip[i];

                this.m_Stream.Write((short)eq.itemID);
                this.m_Stream.Write((short)eq.hue);
            }

            len = msg.Lines.Length;

            if (len > 255)
            {
                len = 255;
            }

            this.m_Stream.Write((byte)len);

            for (int i = 0; i < len; ++i)
            {
                this.WriteString(msg.Lines[i], true);
            }
        }
Exemple #4
0
        public static void BBPostMessage(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
        {
            BulletinMessage thread = World.FindItem(pvSrc.ReadInt32()) as BulletinMessage;

            if (thread != null && !board.MessageOK(thread))
            {
                thread = null;
            }

            int breakout = 0;

            while (thread != null && thread.Thread != null && breakout++ < 10)
            {
                thread = thread.Thread;
            }

            DateTime lastPostTime = board.GetLastPostTime(from, (thread == null));

            if (lastPostTime + (thread == null ? ThreadCreateTime : ThreadReplyTime) > DateTime.Now)
            {
                if (thread == null)
                {
                    from.SendAsciiMessage("You must wait {0} before creating a new thread.", FormatTS(ThreadCreateTime));
                }
                else
                {
                    from.SendAsciiMessage("You must wait {0} before replying to another thread.", FormatTS(ThreadReplyTime));
                }
                return;
            }

            string subject = pvSrc.ReadUTF8StringSafe(pvSrc.ReadByte());

            if (subject.Length == 0)
            {
                return;
            }

            string[] lines = new string[pvSrc.ReadByte()];
            if (lines.Length == 0)
            {
                return;
            }
            for (int i = 0; i < lines.Length; ++i)
            {
                lines[i] = pvSrc.ReadUTF8StringSafe(pvSrc.ReadByte());
            }

            board.PostMessage(from, thread, subject, lines);
        }
Exemple #5
0
        public static void BBRemoveMessage(Mobile from, BaseBulletinBoard board, PacketReader reader)
        {
            if (!(World.FindItem(reader.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
            {
                return;
            }

            if (from.AccessLevel < AccessLevel.GameMaster && msg.Poster != from)
            {
                return;
            }

            msg.Delete();
        }
Exemple #6
0
        public BBMessageContent(BaseBulletinBoard board, BulletinMessage msg) : base(0x71)
        {
            var poster  = SafeString(msg.PostedName);
            var subject = SafeString(msg.Subject);
            var time    = SafeString(msg.GetTimeAsString());

            EnsureCapacity(22 + poster.Length + subject.Length + time.Length);

            Stream.Write((byte)0x02);   // PacketID
            Stream.Write(board.Serial); // Bulletin board serial
            Stream.Write(msg.Serial);   // Message serial

            WriteString(poster);
            WriteString(subject);
            WriteString(time);

            Stream.Write((short)msg.PostedBody);
            Stream.Write((short)msg.PostedHue);

            var len = msg.PostedEquip.Length;

            if (len > 255)
            {
                len = 255;
            }

            Stream.Write((byte)len);

            for (var i = 0; i < len; ++i)
            {
                var eq = msg.PostedEquip[i];

                Stream.Write((short)eq.itemID);
                Stream.Write((short)eq.hue);
            }

            len = msg.Lines.Length;

            if (len > 255)
            {
                len = 255;
            }

            Stream.Write((byte)len);

            for (var i = 0; i < len; ++i)
            {
                WriteString(msg.Lines[i], true);
            }
        }
Exemple #7
0
		public static void BBClientRequest( NetState state, PacketReader pvSrc )
		{
			Mobile from = state.Mobile;

			int packetID = pvSrc.ReadByte();
			BaseBulletinBoard board = World.FindItem( pvSrc.ReadInt32() ) as BaseBulletinBoard;

			if ( board == null || !board.CheckRange( from ) )
				return;

			switch ( packetID )
			{
				case 3: BBRequestContent( from, board, pvSrc ); break;
				case 4: BBRequestHeader( from, board, pvSrc ); break;
				case 5: BBPostMessage( from, board, pvSrc ); break;
				case 6: BBRemoveMessage( from, board, pvSrc ); break;
			}
		}
Exemple #8
0
            public override void OnResponse(Mobile from, string text)
            {
                int page = m_Page;
                BaseBulletinBoard board = m_Board;

                if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                    return;
                }

                text = text.Trim();

                if (text.Length > 255)
                {
                    text = text.Substring(0, 255);
                }

                if (text.Length > 0)
                {
                    BulletinBoardMessage message = new BulletinBoardMessage(DateTime.Now, from, text);

                    if (m_Greeting)
                    {
                        board.Greeting = message;
                    }
                    else
                    {
                        board.Messages.Add(message);

                        if (board.Messages.Count > 50)
                        {
                            board.Messages.RemoveAt(0);

                            if (page > 0)
                            {
                                --page;
                            }
                        }
                    }
                }

                from.SendGump(new BulletinBoardGump(from, board, page));
            }
Exemple #9
0
		public static void BBPostMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
		{
			BulletinMessage thread = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;

			if ( thread != null && thread.Parent != board )
				thread = null;

			int breakout = 0;

			while ( thread != null && thread.Thread != null && breakout++ < 10 )
				thread = thread.Thread;

			DateTime lastPostTime = DateTime.MinValue;

			if ( board.GetLastPostTime( from, ( thread == null ), ref lastPostTime ) )
			{
				if ( !CheckTime( lastPostTime, (thread == null ? ThreadCreateTime : ThreadReplyTime) ) )
				{
					if ( thread == null )
						from.SendMessage( "You must wait {0} before creating a new thread.", FormatTS( ThreadCreateTime ) );
					else
						from.SendMessage( "You must wait {0} before replying to another thread.", FormatTS( ThreadReplyTime ) );

					return;
				}
			}

			string subject = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() );

			if ( subject.Length == 0 )
				return;

			string[] lines = new string[pvSrc.ReadByte()];

			if ( lines.Length == 0 )
				return;

			for ( int i = 0; i < lines.Length; ++i )
				lines[i] = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() );

			board.PostMessage( from, thread, subject, lines );
		}
Exemple #10
0
        public BBDisplayBoard(BaseBulletinBoard board) : base(0x71)
        {
            EnsureCapacity(38);

            var buffer = Utility.UTF8.GetBytes(board.BoardName ?? "");

            Stream.Write((byte)0x00);   // PacketID
            Stream.Write(board.Serial); // Bulletin board serial

            // Bulletin board name
            if (buffer.Length >= 29)
            {
                Stream.Write(buffer, 0, 29);
                Stream.Write((byte)0);
            }
            else
            {
                Stream.Write(buffer, 0, buffer.Length);
                Stream.Fill(30 - buffer.Length);
            }
        }
Exemple #11
0
		public BBMessageHeader( BaseBulletinBoard board, BulletinMessage msg ) : base( 0x71 )
		{
			string poster = SafeString( msg.PostedName );
			string subject = SafeString( msg.Subject );
			string time = SafeString( msg.GetTimeAsString() );

			EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );

			m_Stream.Write( (byte) 0x01 ); // PacketID
			m_Stream.Write( (int) board.Serial ); // Bulletin board serial
			m_Stream.Write( (int) msg.Serial ); // Message serial

			BulletinMessage thread = msg.Thread;

			if ( thread == null )
				m_Stream.Write( (int) 0 ); // Thread serial--root
			else
				m_Stream.Write( (int) thread.Serial ); // Thread serial--parent

			WriteString( poster );
			WriteString( subject );
			WriteString( time );
		}
        public static void BBRequestHeader( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
        {
            BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;

            if ( msg == null || msg.Parent != board )
                return;

            from.Send( new BBMessageHeader( board, msg ) );
        }
        public static void BBRemoveMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
        {
            BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;

            if ( msg == null || msg.Parent != board )
                return;

            if ( from.AccessLevel < AccessLevel.GameMaster && msg.Poster != from )
                return;

            msg.Delete();
        }
		public BountyMessageContent( BaseBulletinBoard board, BountyMessage msg ) : base( 0x71 )
		{
			BountyTable.BountyEntry be = msg.BountyEntry;


			string poster = "a royal guard";
			string subject = String.Format( "{0}: {1}gp [{2} kills]", be.Owner.Name, BountyTable.Bounty( be.Owner ), be.Owner.ShortTermMurders );
			string time = "";

			EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );

			m_Stream.Write( (byte) 0x02 ); // PacketID
			m_Stream.Write( (int) board.Serial ); // Bulletin board serial
			m_Stream.Write( (int) msg.Serial ); // Message serial

			WriteString( poster );
			WriteString( subject );
			WriteString( time );

			m_Stream.Write( (short) 400 );
			m_Stream.Write( (short) 1015 );

			m_Stream.Write( (byte) 0 );



			/*int len = 1;
			m_Stream.Write( (byte) len );
			WriteString( String.Format( "The foul scum known as {0} cannot continue to kill! For {1} is responsible for {2} murder{3}. Lord British's bounty of {4} gold pieces will be paid out in exchange for the swine's head.", be.Owner.Name, be.Owner.Female ? "she" : "he", be.Owner.ShortTermMurders, be.Owner.ShortTermMurders > 1 ? "s" : "", BountyTable.Bounty( be.Owner ) ) );*/

            m_Stream.Write((byte) 3);//Length

            WriteString(String.Format("The foul scum {0} must hang!", be.Owner.Name));
            WriteString(String.Format("for they committed {0} murders.", be.Owner.Kills));
            WriteString(String.Format("claim {0} gp for their head.", BountyTable.Bounty(be.Owner)));

			/*
			BountyTable.BountyEntry be = msg.BountyEntry;

			string poster = "a royal guard";
			string subject = String.Format( "{0}: {1}gp [{2} kills]", be.Owner.Name, BountyTable.Bounty( be.Owner ), be.Owner.Kills );
			string time = "-";

			Console.WriteLine( subject );

			EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );

			m_Stream.Write( (byte) 0x02 ); // PacketID
			m_Stream.Write( (int) board.Serial ); // Bulletin board serial
			m_Stream.Write( (int) msg.Serial ); // Message serial

			WriteString( poster ); // poster
			WriteString( subject ); // subject
			WriteString( time ); // time

			m_Stream.Write( (short) 1 );
			m_Stream.Write( (short) 1 );

			//int len = msg.PostedEquip.Length;

			//if ( len > 255 )
			//	len = 255;

			//m_Stream.Write( (byte) len );

			//for ( int i = 0; i < len; ++i )
			//{
			//	BulletinEquip eq = msg.PostedEquip[i];

			//	m_Stream.Write( (short) eq.itemID );
			//	m_Stream.Write( (short) eq.hue );
			//}

			len = 3;

			m_Stream.Write( (byte) len );

			WriteString( String.Format( "The fould scum known as {0} cannot continue to kill!", be.Owner.Name ) );
			WriteString( String.Format( "For he is responsible for {0} murders.", be.Owner.Kills ) );
			WriteString( String.Format( "Lord British's bounty of {0} gold pieces will be paid out in exchange for the swine's head.", BountyTable.Bounty( be.Owner ) ) );

			//for ( int i = 0; i < len; ++i )
			//	WriteString( msg.Lines[i] );*/
		}
        public static void BBRequestContent( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
        {
            BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;

            if ( msg == null || !board.MessageOK( msg ) )
                return;

            from.Send( new BBMessageContent( board, msg ) );
        }
Exemple #16
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int               page  = m_Page;
            Mobile            from  = m_From;
            BaseBulletinBoard board = m_Board;

            if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Post message
            {
                if (m_Board.BannedPlayers != null && m_Board.BannedPlayers.Contains(from))
                {
                    from.SendGump(new BulletinBoardGump(from, board, page));
                    from.SendAsciiMessage("You are banned from posting on this board");
                }
                else
                {
                    from.Prompt = new BaseBulletinBoard.PostPrompt(page, board, false);
                    from.SendLocalizedMessage(1062397);         // Please enter your message:
                }

                break;
            }

            case 2:     // Set title
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.Prompt = new BaseBulletinBoard.SetTitlePrompt(page, board);
                    from.SendLocalizedMessage(1062402);         // Enter new title:
                }

                break;
            }

            case 3:     // Post greeting
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.Prompt = new BaseBulletinBoard.PostPrompt(page, board, true);
                    from.SendLocalizedMessage(1062404);         // Enter new greeting (this will always be the first post):
                }

                break;
            }

            case 4:     // Scroll up
            {
                if (page == 0)
                {
                    page = board.Messages.Count;
                }
                else
                {
                    page -= 1;
                }

                from.SendGump(new BulletinBoardGump(from, board, page));

                break;
            }

            case 5:     // Scroll down
            {
                page += 1;
                page %= board.Messages.Count + 1;

                from.SendGump(new BulletinBoardGump(from, board, page));

                break;
            }

            case 6:     // Banish poster
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        BulletinBoardMessage message = board.Messages[page - 1];
                        Mobile poster = message.Poster;

                        if (poster == null)
                        {
                            from.SendGump(new BulletinBoardGump(from, board, page));
                            return;
                        }

                        if (poster.AccessLevel > AccessLevel.Player && from.AccessLevel <= poster.AccessLevel)
                        {
                            from.SendLocalizedMessage(501354);         // Uh oh...a bigger boot may be required.
                        }
                        else if (poster is PlayerVendor)
                        {
                            from.SendLocalizedMessage(501351);         // You cannot eject a vendor.
                        }
                        else if (m_Board.BannedPlayers != null && m_Board.BannedPlayers.Contains(poster))
                        {
                            from.SendLocalizedMessage(501356);         // This person is already banned!
                        }
                        else if (poster is BaseCreature && ((BaseCreature)poster).NoHouseRestrictions)
                        {
                            from.SendLocalizedMessage(1062040);         // You cannot ban that.
                        }
                        else
                        {
                            if (m_Board.BannedPlayers == null)
                            {
                                m_Board.BannedPlayers = new ArrayList();
                            }

                            m_Board.BannedPlayers.Add(poster);

                            from.SendAsciiMessage("That person can no longer post messages on this board");
                        }
                    }

                    from.SendGump(new BulletinBoardGump(from, board, page));
                }

                break;
            }

            case 7:     // Delete message
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        board.Messages.RemoveAt(page - 1);
                    }

                    from.SendGump(new BulletinBoardGump(from, board, 0));
                }

                break;
            }

            case 8:     // Post props
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    BulletinBoardMessage message = board.Greeting;

                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        message = board.Messages[page - 1];
                    }

                    from.SendGump(new BulletinBoardGump(from, board, page));
                    from.SendGump(new PropertiesGump(from, message));
                }

                break;
            }
            }
        }
        public BBMessageHeader( BaseBulletinBoard board, BulletinMessage msg )
            : base(0x71)
        {
            string poster = SafeString( msg.PostedName );
            string subject = SafeString( msg.Subject );
            string time = SafeString( msg.GetTimeAsString() );

            EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );

            m_Stream.Write( (byte) 0x01 ); // PacketID
            m_Stream.Write( (int) board.Serial ); // Bulletin board serial
            m_Stream.Write( (int) msg.Serial ); // Message serial

            BulletinMessage thread = msg.Thread;

            if ( thread == null )
                m_Stream.Write( (int) 0 ); // Thread serial--root
            else
                m_Stream.Write( (int) thread.Serial ); // Thread serial--parent

            WriteString( poster );
            WriteString( subject );
            WriteString( time );
        }
		public BountyMessageHeader( BaseBulletinBoard board, BountyMessage msg ) : base( 0x71 )
		{
			BountyTable.BountyEntry be = msg.BountyEntry;

			string poster = "";//be.Owner.Name;
			string subject = String.Format( "{0}: {1} gold", be.Owner.Name, BountyTable.Bounty( be.Owner ) );
			string time = String.Format( "{0} kills", be.Owner.ShortTermMurders );

			EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );

			m_Stream.Write( (byte) 0x01 ); // PacketID
			m_Stream.Write( (int) board.Serial ); // Bulletin board serial
			m_Stream.Write( (int) msg.Serial ); // Message serial

			m_Stream.Write( (int) 0 ); // Thread serial--root

			WriteString( "" );
			WriteString( subject );
			WriteString( time );
			/*WriteString( poster );
			WriteString( subject );
			WriteString( time );*/
		}
        public BulletinBoardGump(Mobile from, BaseBulletinBoard board, int page) : base(50, 10)
        {
            from.CloseGump(typeof(BulletinBoardGump));

            m_Page = page;
            m_From = from;
            m_Board = board;

            AddPage(0);

            AddImage(30, 30, 5400);

            AddButton(393, 145, 2084, 2084, 4, GumpButtonType.Reply, 0); // Scroll up
            AddButton(390, 371, 2085, 2085, 5, GumpButtonType.Reply, 0); // Scroll down

            AddButton(32, 183, 5412, 5413, 1, GumpButtonType.Reply, 0); // Post message

            if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                AddButton(63, 90, 5601, 5605, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(81, 89, 230, 20, 1062400, LabelColor, false, false); // Set title

                AddButton(63, 109, 5601, 5605, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(81, 108, 230, 20, 1062401, LabelColor, false, false); // Post greeting
            }

            string title = board.Title;

            if (title != null)
                AddHtml(183, 68, 180, 23, title, false, false);

            AddHtmlLocalized(385, 89, 60, 20, 1062409, LabelColor, false, false); // Post

            AddLabel(440, 89, LabelHue, page.ToString());
            AddLabel(455, 89, LabelHue, "/");
            AddLabel(470, 89, LabelHue, board.Messages.Count.ToString());

            BulletinBoardMessage message = board.Greeting;

            if (page >= 1 && page <= board.Messages.Count)
                message = board.Messages[page - 1];

            AddImageTiled(150, 220, 240, 1, 2700); // Separator

            AddHtmlLocalized(150, 180, 100, 20, 1062405, 16715, false, false); // Posted On:
            AddHtmlLocalized(150, 200, 100, 20, 1062406, 16715, false, false); // Posted By:

            if (message != null)
            {
                AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss"), false, false);

                Mobile poster = message.Poster;
                string name = (poster == null ? null : poster.Name);

                if (name == null || (name = name.Trim()).Length == 0)
                    name = "Someone";

                AddHtml(255, 200, 150, 20, name, false, false);

                string body = message.Message ?? "";

                AddHtml(150, 240, 250, 100, body, false, false);

                if (message != board.Greeting && from.AccessLevel >= AccessLevel.GameMaster)
                {
                    AddButton(130, 395, 1209, 1210, 6, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(150, 393, 150, 20, 1062410, LabelColor, false, false); // Banish Poster

                    AddButton(310, 395, 1209, 1210, 7, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(330, 393, 150, 20, 1062411, LabelColor, false, false); // Delete Message
                }

                if (from.AccessLevel >= AccessLevel.GameMaster)
                    AddButton(135, 242, 1209, 1210, 8, GumpButtonType.Reply, 0); // Post props
            }
        }
Exemple #20
0
 public PostPrompt(int page, BaseBulletinBoard board, bool greeting)
 {
     m_Page     = page;
     m_Board    = board;
     m_Greeting = greeting;
 }
		public static void BBRequestContent( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
		{
			Item item = World.FindItem( pvSrc.ReadInt32() ) as Item;
			if ( item == null )
				return;

			if ( item is BountyMessage )
			{
				from.Send( new BountyMessageContent( board, (BountyMessage)item ) );
			}
			else if ( item is BulletinMessage )
			{
				BulletinMessage msg = item as BulletinMessage;

				if ( msg == null || msg.Parent != board )
					return;

				from.Send( new BBMessageContent( board, msg ) );
			}
		}
Exemple #22
0
        public BulletinBoardGump(Mobile from, BaseBulletinBoard board, int page) : base(50, 10)
        {
            from.CloseGump(typeof(BulletinBoardGump));

            m_Page  = page;
            m_From  = from;
            m_Board = board;

            AddPage(0);

            AddImage(30, 30, 5400);

            AddButton(393, 145, 2084, 2084, 4, GumpButtonType.Reply, 0); // Scroll up
            AddButton(390, 371, 2085, 2085, 5, GumpButtonType.Reply, 0); // Scroll down

            AddButton(32, 183, 5412, 5413, 1, GumpButtonType.Reply, 0);  // Post message

            if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                AddButton(63, 90, 5601, 5605, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(81, 89, 230, 20, 1062400, LabelColor, false, false); // Set title

                AddButton(63, 109, 5601, 5605, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(81, 108, 230, 20, 1062401, LabelColor, false, false); // Post greeting
            }

            string title = board.Title;

            if (title != null)
            {
                AddHtml(183, 68, 180, 23, title, false, false);
            }

            AddHtmlLocalized(385, 89, 60, 20, 1062409, LabelColor, false, false); // Post

            AddLabel(440, 89, LabelHue, page.ToString());
            AddLabel(455, 89, LabelHue, "/");
            AddLabel(470, 89, LabelHue, board.Messages.Count.ToString());

            BulletinBoardMessage message = board.Greeting;

            if (page >= 1 && page <= board.Messages.Count)
            {
                message = board.Messages[page - 1];
            }

            AddImageTiled(150, 220, 240, 1, 2700);                             // Separator

            AddHtmlLocalized(150, 180, 100, 20, 1062405, 16715, false, false); // Posted On:
            AddHtmlLocalized(150, 200, 100, 20, 1062406, 16715, false, false); // Posted By:

            if (message != null)
            {
                AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss"), false, false);

                Mobile poster = message.Poster;
                string name   = (poster == null ? null : poster.Name);

                if (name == null || (name = name.Trim()).Length == 0)
                {
                    name = "Someone";
                }

                AddHtml(255, 200, 150, 20, name, false, false);

                string body = message.Message ?? "";

                AddHtml(150, 240, 250, 100, body, false, false);

                if (message != board.Greeting && from.AccessLevel >= AccessLevel.GameMaster)
                {
                    AddButton(130, 395, 1209, 1210, 6, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(150, 393, 150, 20, 1062410, LabelColor, false, false); // Banish Poster

                    AddButton(310, 395, 1209, 1210, 7, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(330, 393, 150, 20, 1062411, LabelColor, false, false); // Delete Message
                }

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    AddButton(135, 242, 1209, 1210, 8, GumpButtonType.Reply, 0); // Post props
                }
            }
        }
        public BBDisplayBoard( BaseBulletinBoard board )
            : base(0x71)
        {
            string name = board.BoardName;

            if ( name == null )
                name = "";

            EnsureCapacity( 38 );

            byte[] buffer = Utility.UTF8.GetBytes( name );

            m_Stream.Write( (byte) 0x00 ); // PacketID
            m_Stream.Write( (int) board.Serial ); // Bulletin board serial

            // Bulletin board name
            if ( buffer.Length >= 29 )
            {
                m_Stream.Write( buffer, 0, 29 );
                m_Stream.Write( (byte) 0 );
            }
            else
            {
                m_Stream.Write( buffer, 0, buffer.Length );
                m_Stream.Fill( 30 - buffer.Length );
            }
        }
 public SetTitlePrompt(int page, BaseBulletinBoard board)
 {
     m_Page = page;
     m_Board = board;
 }
        public BBMessageContent( BaseBulletinBoard board, BulletinMessage msg )
            : base(0x71)
        {
            string poster = SafeString( msg.PostedName );
            string subject = SafeString( msg.Subject );
            string time = SafeString( msg.GetTimeAsString() );

            EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );

            m_Stream.Write( (byte) 0x02 ); // PacketID
            m_Stream.Write( (int) board.Serial ); // Bulletin board serial
            m_Stream.Write( (int) msg.Serial ); // Message serial

            WriteString( poster );
            WriteString( subject );
            WriteString( time );

            m_Stream.Write( (short) msg.PostedBody );
            m_Stream.Write( (short) msg.PostedHue );

            int len = msg.PostedEquip.Length;

            if ( len > 255 )
                len = 255;

            m_Stream.Write( (byte) len );

            for ( int i = 0; i < len; ++i )
            {
                BulletinEquip eq = msg.PostedEquip[i];

                m_Stream.Write( (short) eq.itemID );
                m_Stream.Write( (short) eq.hue );
            }

            len = msg.Lines.Length;

            if ( len > 255 )
                len = 255;

            m_Stream.Write( (byte) len );

            for ( int i = 0; i < len; ++i )
                WriteString( msg.Lines[i] );
        }
 public PostPrompt(int page, BaseBulletinBoard board, bool greeting)
 {
     m_Page = page;
     m_Board = board;
     m_Greeting = greeting;
 }
        public static void BBPostMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
        {
            BulletinMessage thread = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;

            if ( thread != null && thread.Parent != board )
                thread = null;

            int breakout = 0;

            while ( thread != null && thread.Thread != null && breakout++ < 10 )
                thread = thread.Thread;

            DateTime lastPostTime = DateTime.MinValue;

            if ( board.GetLastPostTime( from, ( thread == null ), ref lastPostTime ) )
            {
                if ( !CheckTime( lastPostTime, (thread == null ? ThreadCreateTime : ThreadReplyTime) ) )
                {
                    if ( thread == null )
                        from.SendMessage( "You must wait {0} before creating a new thread.", FormatTS( ThreadCreateTime ) );
                    else
                        from.SendMessage( "You must wait {0} before replying to another thread.", FormatTS( ThreadReplyTime ) );

                    return;
                }
            }

            string subject = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() );

            if ( subject.Length == 0 )
                return;

            string[] lines = new string[pvSrc.ReadByte()];

            if ( lines.Length == 0 )
                return;

            for ( int i = 0; i < lines.Length; ++i )
                lines[i] = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() );

            board.PostMessage( from, thread, subject, lines );
        }
Exemple #28
0
 public SetTitlePrompt(int page, BaseBulletinBoard board)
 {
     m_Page  = page;
     m_Board = board;
 }