Ejemplo n.º 1
0
        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);

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

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

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

            int len = msg.PostedEquip.Length;

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

            Stream.Write((byte)len);

            for (int i = 0; i < len; ++i)
            {
                BulletinEquip 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 (int i = 0; i < len; ++i)
            {
                WriteString(msg.Lines[i], true);
            }
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 3
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;
            }
        }