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 ArrayList GetMessages() { if (m_UpdateMsgs) { ArrayList del = new ArrayList(); ArrayList list = BountyMessage.List; for (int i = 0; i < m_List.Length; i++) { BountyMessage post; if (m_List[i] == null || m_List[i].Kills <= 0 || m_List[i].Bounty <= 0) { if (i < list.Count) { post = (BountyMessage)list[i]; if (post != null && !post.Deleted) { del.Add(post); } } continue; } if (i < list.Count) { post = (BountyMessage)list[i]; } else { post = new BountyMessage(); // autromatically adds itself to the list } post.Time = DateTime.MinValue + TimeSpan.FromTicks(m_List[i].Kills); //DateTime.Now; post.PostedName = ""; post.PostedBody = 0x0190; post.PostedHue = 0x83EA; if (post.PostedEquip.Length > 0) { post.PostedEquip = new BulletinEquip[0]; } post.Poster = null; post.Thread = null; post.Subject = String.Format("{0}: {1}gp", m_List[i].Name, m_List[i].Bounty); post.FormatMessage("A price on {0}!\n The foul scum known as {0} hath murdered one too many! For {1} is guilty of {2} murder{3}.\n A bounty of {4}gp is hereby offered for {5} head!\n If you kill {0}, bring {5} head to a guard here in this city to claim your reward.", m_List[i].Name, m_List[i].Female ? "she" : "he", m_List[i].Kills, m_List[i].Kills != 1 ? "s" : "", m_List[i].Bounty, m_List[i].Female ? "her" : "his"); } for (int i = 0; i < del.Count; i++) { ((Item)del[i]).Delete(); } if (list.Count > m_List.Length) { BountyMessage.RemoveRange(m_List.Length, list.Count - m_List.Length); } m_UpdateMsgs = false; return(list); } else { return(BountyMessage.List); } }
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 override ArrayList GetMessages() { if ( m_UpdateMsgs ) { ArrayList del = new ArrayList(); ArrayList list = BountyMessage.List; for(int i=0;i<m_List.Length;i++ ) { BountyMessage post; if ( m_List[i] == null || m_List[i].Kills <= 0 || m_List[i].Bounty <= 0 ) { if ( i < list.Count ) { post = (BountyMessage)list[i]; if ( post != null && !post.Deleted ) del.Add( post ); } continue; } if ( i < list.Count ) post = (BountyMessage)list[i]; else post = new BountyMessage(); // autromatically adds itself to the list post.Time = DateTime.MinValue + TimeSpan.FromTicks( m_List[i].Kills );//DateTime.Now; post.PostedName = ""; post.PostedBody = 0x0190; post.PostedHue = 0x83EA; if ( post.PostedEquip.Length > 0 ) post.PostedEquip = new BulletinEquip[0]; post.Poster = null; post.Thread = null; post.Subject = String.Format( "{0}: {1}gp", m_List[i].Name, m_List[i].Bounty ); post.FormatMessage( "A price on {0}!\n The foul scum known as {0} hath murdered one too many! For {1} is guilty of {2} murder{3}.\n A bounty of {4}gp is hereby offered for {5} head!\n If you kill {0}, bring {5} head to a guard here in this city to claim your reward.", m_List[i].Name, m_List[i].Female ? "she" : "he", m_List[i].Kills , m_List[i].Kills != 1 ? "s" : "", m_List[i].Bounty, m_List[i].Female ? "her" : "his" ); } for(int i=0;i<del.Count;i++) ((Item)del[i]).Delete(); if ( list.Count > m_List.Length ) BountyMessage.RemoveRange( m_List.Length, list.Count - m_List.Length ); m_UpdateMsgs = false; return list; } else { return BountyMessage.List; } }
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 );*/ }