本文整理汇总了C#中PacketWriter.WriteUtf16方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.WriteUtf16方法的具体用法?C# PacketWriter.WriteUtf16怎么用?C# PacketWriter.WriteUtf16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.WriteUtf16方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public override byte[] Build()
{
var writer = new PacketWriter();
writer.WriteUtf16(_message, 0x78F7, 0xA2);
writer.Write((UInt32) _type);
return writer.ToArray();
}
示例2: 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();
}
示例3: 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();
}