本文整理汇总了C#中fCraft.Packet类的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Packet类属于fCraft命名空间,在下文中一共展示了Packet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeSetBlock
/// <summary> Creates a new SetBlockServer (0x06) packet. </summary>
/// <param name="coords"> Coordinates of the block. </param>
/// <param name="type"> Block type to set at given coordinates. </param>
/// <param name="player"> Player packet is being sent to, used to get fallback block </param>
public static Packet MakeSetBlock( Vector3I coords, Block type, Player player ) {
Packet packet = new Packet( OpCode.SetBlockServer );
//Logger.Log(LogType.Debug, "Send: MakeSetBlock({0})({1})", coords, type);
ToNetOrder( (short)coords.X, packet.Bytes, 1 );
ToNetOrder( (short)coords.Z, packet.Bytes, 3 );
ToNetOrder( (short)coords.Y, packet.Bytes, 5 );
packet.Bytes[7] = (byte)player.getFallback(type);
return packet;
}
示例2: MakeCustomBlockSupportLevel
public static Packet MakeCustomBlockSupportLevel(byte level)
{
Logger.Log(LogType.Debug, "Send: CustomBlockSupportLevel({0})", level);
Packet packet = new Packet(OpCode.CustomBlocks);
packet.Data[1] = level;
return packet;
}
示例3: MakeChangeModel
public static Packet MakeChangeModel(byte EntityID, string modelName)
{
Packet packet = new Packet(OpCode.ChangeModel);
packet.Data[1] = EntityID;
Encoding.ASCII.GetBytes(modelName.PadRight(64), 0, 64, packet.Data, 2);
return packet;
}
示例4: MakeSetBlock
public static Packet MakeSetBlock( short x, short y, short z, Block type ) {
Packet packet = new Packet( OpCode.SetBlockServer );
ToNetOrder( x, packet.Bytes, 1 );
ToNetOrder( z, packet.Bytes, 3 );
ToNetOrder( y, packet.Bytes, 5 );
packet.Bytes[7] = (byte)type;
return packet;
}
示例5: MakeSetBlockPermission
public static Packet MakeSetBlockPermission(Block block, bool canPlace, bool canDelete)
{
Packet packet = new Packet(OpCode.SetBlockPermissions);
packet.Data[1] = (byte)block;
packet.Data[2] = (byte)(canPlace ? 1 : 0);
packet.Data[3] = (byte)(canDelete ? 1 : 0);
return packet;
}
示例6: MakeExtEntry
public static Packet MakeExtEntry(string name, int version)
{
Logger.Log(LogType.Debug, "Send: ExtEntry({0},{1})", name, version);
Packet packet = new Packet(OpCode.ExtEntry);
Encoding.ASCII.GetBytes(name.PadRight(64), 0, 64, packet.Data, 1);
ToNetOrder(version, packet.Data, 65);
return packet;
}
示例7: MakeExtAddEntity
public static Packet MakeExtAddEntity(byte EntityID, string entityName, string skinName)
{
Packet packet = new Packet(OpCode.ExtAddEntity);
packet.Data[1] = EntityID;
Encoding.ASCII.GetBytes(entityName.PadRight(64), 0, 64, packet.Data, 2);
Encoding.ASCII.GetBytes(skinName.PadRight(64), 0, 64, packet.Data, 66);
return packet;
}
示例8: MakeDisconnect
internal static Packet MakeDisconnect( string reason )
{
if ( reason == null )
throw new ArgumentNullException( "reason" );
Packet packet = new Packet( OpCode.Kick );
Encoding.ASCII.GetBytes( reason.PadRight( 64 ), 0, 64, packet.Data, 1 );
return packet;
}
示例9: MakeSetBlock
public static Packet MakeSetBlock( int x, int y, int z, Block type )
{
Packet packet = new Packet( OpCode.SetBlockServer );
ToNetOrder( x, packet.Data, 1 );
ToNetOrder( z, packet.Data, 3 );
ToNetOrder( y, packet.Data, 5 );
packet.Data[7] = (byte)type;
return packet;
}
示例10: MakeEnvSetMapAppearance
public static Packet MakeEnvSetMapAppearance(string textureURL, byte sideBlock, byte edgeBlock, short sideLevel)
{
Packet packet = new Packet(OpCode.EnvSetMapAppearance);
Encoding.ASCII.GetBytes(textureURL.PadRight(64), 0, 64, packet.Data, 1);
packet.Data[65] = sideBlock;
packet.Data[66] = edgeBlock;
ToNetOrder((short)sideLevel, packet.Data, 67);
return packet;
}
示例11: MakeMove
internal static Packet MakeMove( int id, Position pos )
{
Packet packet = new Packet( OpCode.Move );
packet.Data[1] = ( byte )id;
packet.Data[2] = ( byte )pos.X;
packet.Data[3] = ( byte )pos.Z;
packet.Data[4] = ( byte )pos.Y;
return packet;
}
示例12: MakeExtInfo
public static Packet MakeExtInfo(short extCount)
{
String VersionString = "LegendCraft " + Updater.LatestStable;
Logger.Log(LogType.Debug, "Send: ExtInfo({0},{1})", VersionString, extCount);
Packet packet = new Packet(OpCode.ExtInfo);
Encoding.ASCII.GetBytes(VersionString.PadRight(64), 0, 64, packet.Data, 1);
ToNetOrder(extCount, packet.Data, 65);
return packet;
}
示例13: MakeExtAddPlayerName
/// <summary> Packet used to change players names/group in TabList as well as their autocomplete name. Color code friendly. </summary>
/// <param name="NameID"> Name ID number from 0-255 </param>
/// <param name="PlayerName"> Name used for autocompletion (can be null) </param>
/// <param name="ListName"> Name displayed in Tab List </param>
/// <param name="GroupName"> Name of group in Tab List </param>
/// <param name="GroupRank"> Rank of group in Tab list (0 is highest) </param>
public static Packet MakeExtAddPlayerName(short NameID, [CanBeNull]string PlayerName, string ListName, string GroupName, byte GroupRank)
{
Packet packet = new Packet(OpCode.ExtAddPlayerName); //0
ToNetOrder((short)NameID, packet.Data, 1); //1
Encoding.ASCII.GetBytes(PlayerName.PadRight(64), 0, 64, packet.Data, 3); //2
Encoding.ASCII.GetBytes(ListName.PadRight(64), 0, 64, packet.Data, 67); //67
Encoding.ASCII.GetBytes(GroupName.PadRight(64), 0, 64, packet.Data, 131); //131
packet.Data[195] = (byte)GroupRank;
return packet;
}
示例14: MakeEnvSetColor
public static Packet MakeEnvSetColor(byte selection, string colorcode)
{
System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml(colorcode.ToUpper());
Packet packet = new Packet(OpCode.EnvSetColor);
packet.Data[1] = selection;
ToNetOrder((short)(col.R), packet.Data, 2);
ToNetOrder((short)(col.G), packet.Data, 4);
ToNetOrder((short)(col.B), packet.Data, 6);
return packet;
}
示例15: MakeMessage
internal static Packet MakeMessage( string message )
{
if ( message == null )
throw new ArgumentNullException( "message" );
Packet packet = new Packet( OpCode.Message );
packet.Data[1] = 0; // unused
Encoding.ASCII.GetBytes( message.PadRight( 64 ), 0, 64, packet.Data, 2 );
return packet;
}