public void PostMessage(Mobile from, BulletinMessage thread, string subject, string[] lines) { if (thread != null) { thread.LastPostTime = DateTime.Now; } AddItem(new BulletinMessage(from, thread, subject, lines)); }
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 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); }
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)); }
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 void PostMessage(Mobile from, BulletinMessage thread, string subject, string[] lines) { if (thread != null) { thread.LastPostTime = DateTime.Now; } BulletinMessage newbm = new BulletinMessage(from, thread, subject, lines); AddItem(newbm); from.Send(new BBMessageHeader(this, newbm)); }
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); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: case 0: { m_Poster = reader.ReadMobile(); m_Subject = reader.ReadString(); m_Time = reader.ReadDateTime(); m_LastPostTime = reader.ReadDateTime(); bool hasThread = reader.ReadBool(); m_Thread = reader.ReadItem() as BulletinMessage; m_PostedName = reader.ReadString(); m_PostedBody = reader.ReadInt(); m_PostedHue = reader.ReadInt(); m_PostedEquip = new BulletinEquip[reader.ReadInt()]; for (int i = 0; i < m_PostedEquip.Length; ++i) { m_PostedEquip[i].itemID = reader.ReadInt(); m_PostedEquip[i].hue = reader.ReadInt(); } m_Lines = new string[reader.ReadInt()]; for (int i = 0; i < m_Lines.Length; ++i) { m_Lines[i] = reader.ReadString(); } if (hasThread && m_Thread == null) { Delete(); } if (version == 0) { ValidationQueue <BulletinMessage> .Add(this); } break; } } }
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); } }
public virtual void Cleanup() { List <Item> items = this.Items; for (int i = items.Count - 1; i >= 0; --i) { if (i >= items.Count) { continue; } BulletinMessage msg = items[i] as BulletinMessage; if (msg == null) { continue; } // Bounty Clean-up BountyMessage bm = msg as BountyMessage; if (bm != null) { if (!((PlayerMobile)bm.BountyPlayer).BountyMark) { msg.Delete(); RecurseDelete(msg); } continue; } // End Bounty Clean-up //Stop escort messages from being deleted if (msg is EscortMessage) { continue; } if (msg.Thread == null && CheckTime(msg.LastPostTime, ThreadDeletionTime)) { msg.Delete(); RecurseDelete(msg); // A root-level thread has expired } } }
public override void PostMessage(Mobile from, BulletinMessage thread, string subject, string[] lines) { if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendMessage("You have acces"); } else { from.SendMessage("You do not have access"); } if (thread != null) { thread.LastPostTime = DateTime.Now; } AddItem(new BulletinMessage(from, thread, subject, lines)); }
public virtual DateTime GetLastPostTime(BulletinMessage check) { DateTime lastPostTime = check.Time; for (int i = 0; i < this.Items.Count; ++i) { BulletinMessage msg = this.Items[i] as BulletinMessage; if (msg == null || msg.Thread != check) { continue; } if (msg.Time > lastPostTime) { lastPostTime = msg.Time; } } return(lastPostTime); }
public virtual void Cleanup() { List<Item> items = this.Items; for ( int i = items.Count - 1; i >= 0; --i ) { if ( i >= items.Count ) continue; BulletinMessage msg = items[i] as BulletinMessage; if ( msg == null ) continue; if ( msg.Thread == null && CheckTime( msg.LastPostTime, ThreadDeletionTime ) ) { msg.Delete(); RecurseDelete( msg ); // A root-level thread has expired } } }
public BulletinMessage(Mobile poster, BulletinMessage thread, string subject, string[] lines) : base(0xEB0) { Movable = false; m_Poster = poster; m_Subject = subject; m_Time = DateTime.Now; m_LastPostTime = m_Time; m_Thread = thread; m_PostedName = m_Poster.Name; m_PostedBody = m_Poster.Body; m_PostedHue = m_Poster.Hue; m_Lines = lines; var postedEquip = from item in poster.GetEquippedItems() where item.Layer >= Layer.OneHanded && item.Layer <= Layer.Mount select new BulletinEquip(item.ItemID, item.Hue); m_PostedEquip = postedEquip.ToArray(); }
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 ); }
private void BFSDelete(BulletinMessage msg, ref PooledRefQueue <Item> queue) { var items = Items; for (var i = items.Count - 1; i >= 0; --i) { if (i >= items.Count) { continue; } if (items[i] is not BulletinMessage check || check.Deleted) { continue; } if (check.Thread == msg) { check.Delete(); queue.Enqueue(check); } } }
public virtual void Cleanup() { List <Item> items = this.Items; for (int i = items.Count - 1; i >= 0; --i) { if (i >= items.Count) { continue; } BulletinMessage msg = items[i] as BulletinMessage; if (msg == null) { continue; } #region BBS Quests //Stop escort messages from being deleted if (msg is EscortMessage) { continue; } //Stop prisoner messages from being deleted if (msg is PrisonerMessage) { continue; } #endregion if (msg.Thread == null && CheckTime(msg.LastPostTime, ThreadDeletionTime)) { msg.Delete(); this.RecurseDelete(msg); // A root-level thread has expired } } }
public virtual bool GetLastPostTime( Mobile poster, bool onlyCheckRoot, ref DateTime lastPostTime ) { List<Item> items = this.Items; bool wasSet = false; for ( int i = 0; i < items.Count; ++i ) { BulletinMessage msg = items[i] as BulletinMessage; if ( msg == null || msg.Poster != poster ) continue; if ( onlyCheckRoot && msg.Thread != null ) continue; if ( msg.Time > lastPostTime ) { wasSet = true; lastPostTime = msg.Time; } } return wasSet; }
public virtual void Cleanup() { List <Item> items = this.Items; for (int i = items.Count - 1; i >= 0; --i) { if (i >= items.Count) { continue; } BulletinMessage msg = items[i] as BulletinMessage; if (msg == null || msg.Thread != null) { continue; } DateTime lpt = GetLastPostTime(msg); if (lpt != DateTime.MinValue && (lpt + ThreadDeletionTime) < DateTime.Now) { RecurseDelete(msg); // A root-level thread has expired } } }
private void RecurseDelete( BulletinMessage msg ) { ArrayList found = null; List<Item> items = this.Items; for ( int i = items.Count - 1; i >= 0; --i ) { BulletinMessage check = items[i] as BulletinMessage; if ( check != null && check.Thread == msg ) { if ( found == null ) found = new ArrayList( 1 ); found.Add( check ); } } if ( found != null ) { for ( int i = 0; i < found.Count; ++i ) RecurseDelete( (BulletinMessage)found[i] ); } msg.Delete(); }
public virtual void PostMessage( Mobile from, BulletinMessage thread, string subject, string[] lines ) { AddItem( new BulletinMessage( from, thread, subject, lines ) ); }
public override bool MessageOK(BulletinMessage msg) { return(BountyMessage.List.Contains(msg)); }
public override DateTime GetLastPostTime( BulletinMessage check ) { return check.Time; }
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 BulletinMessage( Mobile poster, BulletinMessage thread, string subject, string[] lines ) : base(0xEB0) { Movable = false; m_Poster = poster; m_Subject = subject; m_Time = DateTime.Now; m_LastPostTime = m_Time; m_Thread = thread; m_PostedName = m_Poster.Name; m_PostedBody = m_Poster.Body; m_PostedHue = m_Poster.Hue; m_Lines = lines; ArrayList list = new ArrayList(); for ( int i = 0; i < poster.Items.Count; ++i ) { Item item = poster.Items[i]; if ( item.Layer >= Layer.OneHanded && item.Layer <= Layer.Mount ) list.Add( new BulletinEquip( item.ItemID, item.Hue ) ); } m_PostedEquip = (BulletinEquip[])list.ToArray( typeof( BulletinEquip ) ); }
public override DateTime GetLastPostTime(BulletinMessage check) { return(check.Time); }
public void PostMessage( Mobile from, BulletinMessage thread, string subject, string[] lines ) { if ( thread != null ) thread.LastPostTime = DateTime.Now; AddItem( new BulletinMessage( from, thread, subject, lines ) ); }
public virtual void PostMessage(Mobile from, BulletinMessage thread, string subject, string[] lines) { AddItem(new BulletinMessage(from, thread, subject, lines)); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); if ( reader.ReadBool() ) m_DestinationString = reader.ReadString(); // NOTE: We cannot EDI.Find here, regions have not yet been loaded :-( if ( reader.ReadBool() ) { m_DeleteTime = reader.ReadDeltaTime(); m_DeleteTimer = new DeleteTimer( this, m_DeleteTime - DateTime.Now ); m_DeleteTimer.Start(); } m_Message = reader.ReadItem() as BulletinMessage; }
public virtual bool MessageOK(BulletinMessage msg) { return(msg.Parent == this); }
protected override void OnLocationChange(Point3D oldLocation) { base.OnLocationChange(oldLocation); if (oldLocation == Point3D.Zero) { EDI dest = GetDestination(); if (dest != null && m_Message == null) { if (m_Camp != null) m_Message = new PrisonerMessage(m_Camp, this); else m_Message = new EscortMessage(this); } } }
public virtual DateTime GetLastPostTime( BulletinMessage check ) { DateTime lastPostTime = check.Time; for ( int i = 0; i < this.Items.Count; ++i ) { BulletinMessage msg = this.Items[i] as BulletinMessage; if ( msg == null || msg.Thread != check ) continue; if ( msg.Time > lastPostTime ) lastPostTime = msg.Time; } return lastPostTime; }
public BulletinMessage(Mobile poster, BulletinMessage thread, string subject, string[] lines) : base(0xEB0) { this.Movable = false; this.m_Poster = poster; this.m_Subject = subject; this.m_Time = DateTime.UtcNow; this.m_LastPostTime = this.m_Time; this.m_Thread = thread; this.m_PostedName = this.m_Poster.Name; this.m_PostedBody = this.m_Poster.Body; this.m_PostedHue = this.m_Poster.Hue; this.m_Lines = lines; List<BulletinEquip> list = new List<BulletinEquip>(); for (int i = 0; i < poster.Items.Count; ++i) { Item item = poster.Items[i]; if (item.Layer >= Layer.OneHanded && item.Layer <= Layer.Mount) list.Add(new BulletinEquip(item.ItemID, item.Hue)); } this.m_PostedEquip = list.ToArray(); }
public override void PostMessage(Mobile from, BulletinMessage thread, string subject, string[] lines) { from.SendAsciiMessage("This board is for automated bounty postings only. For communications you should use the forums at http://www.uorebirth.com"); return; }
public virtual bool MessageOK( BulletinMessage msg ) { return msg.Parent == this; }
public BulletinMessage( Mobile poster, BulletinMessage thread, string subject, string[] lines ) : base(0xEB0) { Movable = false; m_Poster = poster; m_Subject = subject; m_Time = DateTime.Now; m_Thread = thread; m_Lines = lines; if ( m_Poster == null ) { m_PostedName = ""; m_PostedBody = 0x0190; m_PostedHue = 0x83EA; m_PostedEquip = new BulletinEquip[0]; } else { m_PostedName = m_Poster.Name; m_PostedBody = m_Poster.Body; m_PostedHue = m_Poster.Hue; ArrayList list = new ArrayList( poster.Items.Count ); for ( int i = 0; i < poster.Items.Count; ++i ) { Item item = (Item)poster.Items[i]; if ( item.Layer >= Layer.FirstValid && item.Layer <= Layer.LastValid ) list.Add( new BulletinEquip( item.ItemID, item.Hue ) ); } m_PostedEquip = (BulletinEquip[])list.ToArray( typeof( BulletinEquip ) ); } }
private void RecurseDelete( BulletinMessage msg ) { List<Item> found = new List<Item>(); List<Item> items = this.Items; for ( int i = items.Count - 1; i >= 0; --i ) { if ( i >= items.Count ) continue; BulletinMessage check = items[i] as BulletinMessage; if ( check == null ) continue; if ( check.Thread == msg ) { check.Delete(); found.Add( check ); } } for ( int i = 0; i < found.Count; ++i ) RecurseDelete( (BulletinMessage)found[i] ); }
public override void PostMessage( Mobile from, BulletinMessage thread, string subject, string[] lines ) { from.SendAsciiMessage( "This board is for automated bounty postings only. For communications you should use the forums at http://www.uorebirth.com" ); return; }
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 override bool MessageOK( BulletinMessage msg ) { return BountyMessage.List.Contains( msg ); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 0: { m_Poster = reader.ReadMobile(); m_Subject = reader.ReadString(); m_Time = reader.ReadDateTime(); m_LastPostTime = reader.ReadDateTime(); bool hasThread = reader.ReadBool(); m_Thread = reader.ReadItem() as BulletinMessage; m_PostedName = reader.ReadString(); m_PostedBody = reader.ReadInt(); m_PostedHue = reader.ReadInt(); m_PostedEquip = new BulletinEquip[reader.ReadInt()]; for ( int i = 0; i < m_PostedEquip.Length; ++i ) { m_PostedEquip[i].itemID = reader.ReadInt(); m_PostedEquip[i].hue = reader.ReadInt(); } m_Lines = new string[reader.ReadInt()]; for ( int i = 0; i < m_Lines.Length; ++i ) m_Lines[i] = reader.ReadString(); if ( hasThread && m_Thread == null ) Delete(); break; } } }
public BulletinMessage( Mobile poster, BulletinMessage thread, string subject, string[] lines ) : base( 0xEB0 ) { Movable = false; m_Poster = poster; m_Subject = subject; m_Time = DateTime.Now; m_LastPostTime = m_Time; m_Thread = thread; m_PostedName = m_Poster.Name; m_PostedBody = m_Poster.Body; m_PostedHue = m_Poster.Hue; m_Lines = lines; List<BulletinEquip> list = new List<BulletinEquip>(); for (int i = 0; i < poster.Items.Count; ++i) { Item item = poster.Items[i]; if (item.Layer >= Layer.OneHanded && item.Layer <= Layer.Mount) list.Add(new BulletinEquip(item.ItemID, item.Hue)); } /* var postedEquip = from item in poster.item() where item.Layer >= Layer.OneHanded && item.Layer <= Layer.Mount select new BulletinEquip( item.ItemID, item.Hue ); */ m_PostedEquip = list.ToArray(); }