Exemplo n.º 1
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));
            }
Exemplo n.º 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Title = reader.ReadString();

                        if (reader.ReadBool())
                            m_Greeting = new BulletinBoardMessage(reader);

                        int count = reader.ReadEncodedInt();

                        m_Messages = new List<BulletinBoardMessage>(count);

                        for (int i = 0; i < count; ++i)
                            m_Messages.Add(new BulletinBoardMessage(reader));

                        if (m_BannedPlayers != null)
                            m_BannedPlayers = reader.ReadMobileList();
                        else
                        {
                            m_BannedPlayers = new ArrayList();
                            m_BannedPlayers = reader.ReadMobileList();
                        }

                        break;
                    }
            }
        }