本文整理汇总了C#中PacketWriter.WriteBytes方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.WriteBytes方法的具体用法?C# PacketWriter.WriteBytes怎么用?C# PacketWriter.WriteBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.WriteBytes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// </summary>
/// <param name="username">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(string username)
{
PacketWriter writer = new PacketWriter(0x07);
IEnumerable<DBCharacter> chars = CharacterDao.Instance.GetAllForUser(username);
byte[] numberOfCharacters = BitConverter.GetBytes(IPAddress.HostToNetworkOrder((Int16)chars.Count()));
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteUInt32((UInt32)character.Id);
}
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteString(character.Name);
}
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteUInt32((UInt32)StatDao.Instance.GetById(50000, character.Id, 54).StatValue);
}
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteUInt32((uint)CharacterDao.Instance.IsOnline(character.Id));
}
return writer.Finish();
}
示例2: Create
/// <summary>
/// The create.
/// </summary>
/// <param name="playerid">
/// </param>
/// <param name="online">
/// </param>
/// <param name="status">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(uint playerid, uint online, byte[] status)
{
PacketWriter writer = new PacketWriter(40);
writer.WriteUInt32(playerid);
writer.WriteUInt32(online);
writer.WriteBytes(status);
return writer.Finish();
}
示例3: Create
/// <summary>
/// The create.
/// </summary>
/// <param name="channelid">
/// </param>
/// <param name="channelname">
/// </param>
/// <param name="flags">
/// </param>
/// <param name="otherdata">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(ulong channelid, string channelname, uint flags, byte[] otherdata)
{
PacketWriter writer = new PacketWriter(60);
writer.Write5of8(channelid);
writer.WriteString(channelname);
writer.WriteUInt32(flags);
writer.WriteBytes(otherdata);
return writer.Finish();
}
示例4: Create
/// <summary>
/// The create.
/// </summary>
/// <param name="channelid">
/// </param>
/// <param name="playerid">
/// </param>
/// <param name="message">
/// </param>
/// <param name="blob">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(byte[] channelid, uint playerid, string message, string blob)
{
PacketWriter writer = new PacketWriter(65);
writer.WriteBytes(channelid);
writer.WriteUInt32(playerid);
writer.WriteString(message);
writer.WriteString(blob);
return writer.Finish();
}
示例5: Build
public override byte[] Build()
{
var resp = new PacketWriter();
resp.Write((uint)((userid == 0) ? 1 : 0)); // Status flag: 0=success, 1=error
resp.WriteUtf16(error, 0x8BA4, 0xB6);
if (userid == 0)
{
for (var i = 0; i < 0xEC; i++)
resp.Write((byte)0);
return resp.ToArray();
}
// TODO: Explore this data! Some if it seems really important. (May contain level cap setting + more)
resp.WriteStruct(new ObjectHeader(userid, EntityType.Player));
resp.WriteFixedLengthUtf16(blockName, 0x20); // This is right
// Set things to "default" values; Dunno these purposes yet.
resp.Write(0x42700000); //0
resp.Write(7); //4
resp.Write(0xA); //8 - Level Cap!
resp.Write(1); //C
resp.Write(0x41200000); //10
resp.Write(0x40A00000); //14
resp.Write(11); //18
resp.Write(0x3F800000); //1C (1 as a float)
resp.Write(0x42960000); //20
resp.Write(40); //24
resp.Write(0x41200000); //28
resp.Write(1); //2C?
resp.Write(1120403456); //30
//WHAT
for (int i = 0; i < 10; i++)
{
resp.Write(1065353216);
}
//ARE
for (int i = 0; i < 21; i++)
{
resp.Write(1120403456);
}
//THESE?
resp.Write(0x91A2B); //B0
resp.Write(0x91A2B); //B4
resp.WriteBytes(0, 12);
return resp.ToArray();
}
示例6: Create
/// <summary>
/// The create.
/// </summary>
/// <param name="channelid">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(byte[] channelid)
{
PacketWriter writer = new PacketWriter(61);
writer.WriteBytes(channelid);
return writer.Finish();
}
示例7: Create
/// <summary>
/// </summary>
/// <param name="channelType">
/// </param>
/// <param name="channelId">
/// </param>
/// <param name="channelName">
/// </param>
/// <param name="flags">
/// </param>
/// <param name="otherData">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(
ChannelType channelType,
uint channelId,
string channelName,
ChannelFlags flags,
byte[] otherData)
{
PacketWriter writer = new PacketWriter(60);
writer.WriteByte((byte)channelType);
writer.WriteUInt32(channelId);
writer.WriteString(channelName);
writer.WriteUInt32((UInt32)flags);
writer.WriteBytes(otherData);
return writer.Finish();
}
示例8: Build
public override byte[] Build()
{
if (members.Length < 1)
return new byte[0];
// xor: 0xD863, sub: 0xA9
PacketWriter writer = new PacketWriter();
writer.WriteBytes(0, 12); // Unknown 12 bytes, not obj header
writer.WriteStruct(new ObjectHeader((uint)members[0].Player.PlayerId, EntityType.Player)); // Player receiving the thing
writer.WriteStruct(members.Length); // Likely partymembercount
for(int i = 0; i < members.Length; i++)
{
writer.WriteStruct(new ObjectHeader((uint)members[i].Player.PlayerId, EntityType.Player)); // Header of player
writer.WriteUtf16(members[i].Name, 0xD863, 0xA9);
writer.WriteUtf16(members[i].Player.Nickname, 0xD863, 0xA9);
writer.Write((byte)members[i].Jobs.entries.hunter.level); // Active class level
writer.Write((byte)0); // idk
writer.Write((byte)4); // idk
writer.Write((byte)0xFF); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0xFF); // idk
writer.Write((byte)0xFF); // idk
writer.Write((byte)0); // idk
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.WriteBytes(0, 12);
writer.Write(0);
writer.Write(0);
}
for(int i = 0; i < 4 - members.Length; i++) // Empty entries
{
writer.WriteStruct(new ObjectHeader(0, 0)); // Header of player
writer.WriteMagic(0, 0xD863, 0xA9);
writer.WriteMagic(0, 0xD863, 0xA9);
writer.Write((byte)0); // Active class level
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.WriteBytes(0, 12);
writer.Write(0);
}
return writer.ToArray();
}