本文整理汇总了C#中PacketWriter.WriteFixedLengthUtf16方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.WriteFixedLengthUtf16方法的具体用法?C# PacketWriter.WriteFixedLengthUtf16怎么用?C# PacketWriter.WriteFixedLengthUtf16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.WriteFixedLengthUtf16方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public override byte[] Build()
{
var writer = new PacketWriter();
writer.Write((byte) 1); // Always 1?
// Padding? Or the above is actually a uint
for (var i = 0; i < 3; i++)
writer.Write((byte) 0);
// Character ID
writer.Write((uint) _character.CharacterId);
// Padding?
for (var i = 0; i < 4; i++)
writer.Write((byte) 0);
// Nickname
// TODO: The above and below may be switched around, need more data
writer.WriteFixedLengthUtf16(_character.Player.Nickname, 16);
// Padding?
for (var i = 0; i < 36; i++)
writer.Write((byte) 0);
// Player name
writer.WriteFixedLengthUtf16(_character.Name, 16);
// Unknown?
for (var i = 0; i < 24; i++)
writer.Write((byte) 0);
// Team Name
// We don't actually have team names anywhere, just dump a test here
writer.WriteFixedLengthUtf16("Polaris Team", 16);
// Unknown
// Somewhere in here is likely a Team ID
for (var i = 0; i < 32; i++)
writer.Write((byte) 0);
return writer.ToArray();
}
示例2: Build
public override byte[] Build()
{
var writer = new PacketWriter();
// Player header
writer.WritePlayerHeader((uint) _character.Player.PlayerId);
// Spawn position
writer.Write(Position);
writer.Write((ushort) 0); // padding?
writer.WriteFixedLengthASCII("Character", 32);
writer.Write((ushort) 1); // 0x44
writer.Write((ushort) 0); // 0x46
writer.Write((uint) 602); // 0x48
writer.Write((uint) 1); // 0x4C
writer.Write((uint) 53); // 0x50
writer.Write((uint) 0); // 0x54
writer.Write((uint) (IsItMe ? 47 : 39)); // 0x58
writer.Write((ushort) 559); // 0x5C
writer.Write((ushort) 306); // 0x5E
writer.Write((uint) _character.Player.PlayerId); // player ID copy
writer.Write((uint) 0); // "char array ugggghhhhh" according to PolarisLegacy
writer.Write((uint) 0); // "voiceParam_unknown4"
writer.Write((uint) 0); // "voiceParam_unknown8"
writer.WriteFixedLengthUtf16(_character.Name, 16);
writer.Write((uint) 0); // 0x90
writer.WriteStruct(_character.Looks);
writer.WriteStruct(_character.Jobs);
writer.WriteFixedLengthUtf16("", 32); // title?
writer.Write((uint) 0); // 0x204
writer.Write((uint) 0); // gmflag?
writer.WriteFixedLengthUtf16(_character.Player.Nickname, 16); // nickname, maybe not 16 chars?
for (var i = 0; i < 64; i++)
writer.Write((byte) 0);
return writer.ToArray();
}
示例3: 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();
}
示例4: HandlePacket
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
if (context.User == null)
return;
var writer = new PacketWriter();
using (var db = new PolarisEf())
{
var chars = db.Characters
.Where(w => w.Player.PlayerId == context.User.PlayerId)
.OrderBy(o => o.CharacterId) // TODO: Order by last played
.Select(s => s);
writer.Write((uint)chars.Count()); // Number of characters
for (var i = 0; i < 0x4; i++) // Whatever this is
writer.Write((byte)0);
foreach (var ch in chars)
{
writer.Write((uint)ch.CharacterId);
writer.Write((uint)context.User.PlayerId);
for (var i = 0; i < 0x10; i++)
writer.Write((byte)0);
writer.WriteFixedLengthUtf16(ch.Name, 16);
writer.Write((uint)0);
writer.WriteStruct(ch.Looks); // Note: Pre-Episode 4 created looks doesn't seem to work anymore
writer.WriteStruct(ch.Jobs);
for (var i = 0; i < 0xFC; i++)
writer.Write((byte)0);
}
}
// Ninji note: This packet may be followed by extra data,
// after a fixed-length array of character data structures.
// Needs more investigation at some point.
// ---
// CK note: Extra data is likely current equipment, playtime, etc.
// All of that data is currently unaccounted for at the moment.
context.SendPacket(0x11, 0x03, 0, writer.ToArray());
}
示例5: HandlePacket
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
if (context.User == null)
return;
var writer = new PacketWriter();
using (var db = new PolarisEf())
{
var chars = from c in db.Characters
where c.Player.PlayerId == context.User.PlayerId
select c;
writer.Write((uint)chars.Count());
foreach (var ch in chars)
{
writer.Write((uint)ch.CharacterId);
writer.Write((uint)context.User.PlayerId);
for (var i = 0; i < 0xC; i++)
writer.Write((byte)0);
writer.WriteFixedLengthUtf16(ch.Name, 16);
writer.Write((uint)0);
writer.WriteStruct(ch.Looks);
writer.WriteStruct(ch.Jobs);
for (var i = 0; i < 0x44; i++)
writer.Write((byte)0);
}
}
// Ninji note: This packet may be followed by extra data,
// after a fixed-length array of character data structures.
// Needs more investigation at some point.
// ---
// CK note: Extra data is likely current equipment, playtime, etc.
// All of that data is currently unaccounted for at the moment.
context.SendPacket(0x11, 0x03, 0, writer.ToArray());
}