本文整理汇总了C#中Server.Items.BaseBulletinBoard类的典型用法代码示例。如果您正苦于以下问题:C# BaseBulletinBoard类的具体用法?C# BaseBulletinBoard怎么用?C# BaseBulletinBoard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseBulletinBoard类属于Server.Items命名空间,在下文中一共展示了BaseBulletinBoard类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BBMessageHeader
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 );
}
示例2: BBPostMessage
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 );
}
示例3: BBDisplayBoard
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 );
}
}
示例4: BBMessageContent
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] );
}
示例5: BBRemoveMessage
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();
}
示例6: BBRequestHeader
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 ) );
}
示例7: BulletinBoardGump
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
}
}
示例8: BBRequestContent
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 ) );
}
}
示例9: SetTitlePrompt
public SetTitlePrompt(int page, BaseBulletinBoard board)
{
m_Page = page;
m_Board = board;
}
示例10: PostPrompt
public PostPrompt(int page, BaseBulletinBoard board, bool greeting)
{
m_Page = page;
m_Board = board;
m_Greeting = greeting;
}
示例11: BBRequestContent
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 ) );
}
示例12: BountyMessageContent
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] );*/
}
示例13: BountyMessageHeader
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 );*/
}